Merge branch 'dev' into 'dev-rework'

# Conflicts:
#   cppcheck_errors.txt
#   src/GUI/IntelliPhotoGui.h
This commit is contained in:
Conrad
2020-01-15 13:57:27 +00:00
8 changed files with 216 additions and 118 deletions

View File

@@ -65,8 +65,8 @@ void IntelliPhotoGui::slotSave(){
saveFile(fileFormat);
}
// Opens a dialog that allows the user to create a New Layer
void IntelliPhotoGui::slotCreateNewLayer(){
// Opens a dialog that allows the user to create a New RASTER Layer
void IntelliPhotoGui::slotCreateNewRasterLayer(){
// Stores button value
bool ok1, ok2;
@@ -85,7 +85,32 @@ void IntelliPhotoGui::slotCreateNewLayer(){
200,1, 500, 1, &ok2);
// Create New Layer
if (ok1&&ok2) {
paintingArea->addLayer(width,height,0,0);
paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::RASTERIMAGE);
UpdateGui();
}
}
// Opens a dialog that allows the user to create a New SHAPED Layer
void IntelliPhotoGui::slotCreateNewShapedLayer(){
// Stores button value
bool ok1, ok2;
// "New Layer" is the title of the window
// the next tr is the text to display
// Define the standard Value, min, max, step and ok button
QInputDialog Input;
Input.setPalette(Palette);
int width = Input.getInt(this, tr("New Layer"),
tr("Width:"),
200,1, 500, 1, &ok1);
int height = QInputDialog::getInt(this, tr("New Layer"),
tr("Height:"),
200,1, 500, 1, &ok2);
// Create New Layer
if (ok1&&ok2) {
paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::SHAPEDIMAGE);
UpdateGui();
}
}
@@ -129,6 +154,24 @@ void IntelliPhotoGui::slotSetActiveAlpha(){
}
}
void IntelliPhotoGui::slotSetPolygon(){
// Stores button value
bool ok1;
// "Layer to set on" is the title of the window
// the next tr is the text to display
// Define the standard Value, min, max, step and ok button
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
tr("Layer:"),
1,1,500,1, &ok1);
if (ok1)
{
paintingArea->setPolygon(layer-1);
UpdateGui();
}
}
void IntelliPhotoGui::slotPositionMoveUp(){
paintingArea->movePositionActive(0,-20);
update();
@@ -159,35 +202,6 @@ void IntelliPhotoGui::slotMoveLayerDown(){
update();
}
void IntelliPhotoGui::slotClearActiveLayer(){
// Stores button value
bool ok1, ok2, ok3, ok4;
// "Red Input" is the title of the window
// the next tr is the text to display
// Define the standard Value, min, max, step and ok button
int red = QInputDialog::getInt(this, tr("Red Input"),
tr("Red:"),
255,0, 255,1, &ok1);
// "Green Input" is the title of the window
int green = QInputDialog::getInt(this, tr("Green Input"),
tr("Green:"),
255,0, 255, 1, &ok2);
// "Blue Input" is the title of the window
int blue = QInputDialog::getInt(this, tr("Blue Input"),
tr("Blue:"),
255,0, 255, 1, &ok3);
// "Alpha Input" is the title of the window
int alpha = QInputDialog::getInt(this, tr("Alpha Input"),
tr("Alpha:"),
255,0, 255, 1, &ok4);
if (ok1&&ok2&&ok3&&ok4)
{
paintingArea->floodFill(red, green, blue, alpha);
UpdateGui();
}
}
void IntelliPhotoGui::slotSetActiveLayer(){
// Stores button value
bool ok1;
@@ -343,10 +357,16 @@ void IntelliPhotoGui::createActions(){
actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
connect(actionOpen, SIGNAL(triggered()), this, SLOT(slotOpen()));
// Create New Layer action and tie to IntelliPhotoGui::newLayer()
actionCreateNewLayer = new QAction(tr("&New Layer..."), this);
actionCreateNewLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
connect(actionCreateNewLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewLayer()));
// Create New RASTER Layer action and tie to IntelliPhotoGui::newLayer()
actionCreateNewRasterLayer = new QAction(tr("&Raster Image"), this);
actionCreateNewRasterLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
connect(actionCreateNewRasterLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewRasterLayer()));
// Create New SHAPED Layer action and tie to IntelliPhotoGui::newLayer()
actionCreateNewShapedLayer = new QAction(tr("&Shaped Image"), this);
actionCreateNewShapedLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N + Qt::ALT));
connect(actionCreateNewShapedLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewShapedLayer()));
// Delete New Layer action and tie to IntelliPhotoGui::deleteLayer()
actionDeleteLayer = new QAction(tr("&Delete Layer..."), this);
@@ -361,6 +381,10 @@ void IntelliPhotoGui::createActions(){
actionSetActiveAlpha->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_A));
connect(actionSetActiveAlpha, SIGNAL(triggered()), this, SLOT(slotSetActiveAlpha()));
actionSetPolygon = new QAction(tr("&set new Polygondata"), this);
actionSetPolygon->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_P));
connect(actionSetPolygon, SIGNAL(triggered()), this, SLOT(slotSetPolygon()));
actionMovePositionUp = new QAction(tr("&move Up"), this);
actionMovePositionUp->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
connect(actionMovePositionUp, SIGNAL(triggered()), this, SLOT(slotPositionMoveUp()));
@@ -510,12 +534,17 @@ void IntelliPhotoGui::createMenus(){
renderMenu->addAction(actionUpdateRenderSettingsOn);
renderMenu->addAction(actionUpdateRenderSettingsOff);
//Attach all Layer Creations to Menu
layerCreationMenu = new QMenu(tr("&Create new Layer"), this);
layerCreationMenu->addAction(actionCreateNewRasterLayer);
layerCreationMenu->addAction(actionCreateNewShapedLayer);
// Attach all actions to Layer
layerMenu = new QMenu(tr("&Layer"), this);
layerMenu->addAction(actionCreateNewLayer);
layerMenu->addMenu(layerCreationMenu);
layerMenu->addSeparator();
layerMenu->addAction(actionSetActiveAlpha);
layerMenu->addAction(actionSetActiveLayer);
layerMenu->addAction(actionSetPolygon);
layerMenu->addSeparator();
layerMenu->addAction(actionMovePositionUp);
layerMenu->addAction(actionMovePositionDown);
@@ -730,6 +759,7 @@ void IntelliPhotoGui::setIntelliStyle(){
this->helpMenu->setPalette(Palette);
this->renderMenu->setPalette(Palette);
this->toolMenu->setPalette(Palette);
this->layerCreationMenu->setPalette(Palette);
this->layerMenu->setPalette(Palette);
this->colorMenu->setPalette(Palette);
this->toolCreationMenu->setPalette(Palette);

View File

@@ -40,11 +40,13 @@ private slots:
void slotOpen();
void slotSave();
void slotCreateNewLayer();
// layer slots here
void slotCreateNewRasterLayer();
void slotCreateNewShapedLayer();
void slotDeleteLayer();
void slotClearActiveLayer();
void slotSetActiveLayer();
void slotSetActiveAlpha();
void slotSetPolygon();
void slotPositionMoveUp();
void slotPositionMoveDown();
void slotPositionMoveLeft();
@@ -123,6 +125,7 @@ QMenu*saveAsMenu;
QMenu*fileMenu;
QMenu*renderMenu;
QMenu*optionMenu;
QMenu*layerCreationMenu;
QMenu*layerMenu;
QMenu*colorMenu;
QMenu*toolCreationMenu;
@@ -158,10 +161,12 @@ QAction*actionAboutDialog;
QAction*actionAboutQtDialog;
// layer change actions
QAction*actionCreateNewLayer;
QAction*actionDeleteLayer;
QAction* actionCreateNewRasterLayer;
QAction* actionCreateNewShapedLayer;
QAction* actionDeleteLayer;
QAction* actionSetActiveLayer;
QAction* actionSetActiveAlpha;
QAction* actionSetPolygon;
QAction* actionMovePositionUp;
QAction* actionMovePositionDown;
QAction* actionMovePositionLeft;