Merge branch 'dev' into dev-colorpalette

This commit is contained in:
Jan Schuffenhauer
2020-01-16 00:11:24 +01:00
9 changed files with 237 additions and 146 deletions

View File

@@ -65,8 +65,29 @@ 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;
// "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
int width = IntelliInputDialog::getInt("New Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1);
int height = IntelliInputDialog::getInt("New Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2);
// Create New Layer
if (ok1&&ok2) {
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;
bool ok1, ok2;
// "New Layer" is the title of the window
@@ -77,10 +98,10 @@ void IntelliPhotoGui::slotCreateNewLayer(){
int height = IntelliInputDialog::getInt("New Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2);
// Create New Layer
if(ok1&&ok2){
paintingArea->addLayer(width,height,0,0);
UpdateGui();
}
if (ok1&&ok2) {
paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::SHAPEDIMAGE);
UpdateGui();
}
}
// Opens a dialog that allows the user to delete a Layer
@@ -111,10 +132,27 @@ void IntelliPhotoGui::slotSetActiveAlpha(){
// "New Alpha" is the title of the window
int alpha = IntelliInputDialog::getInt("Layer to set on", "Alpha:", 255, 0, 255, 1, &ok2);
if(ok1&&ok2){
paintingArea->setLayerAlpha(layer-1,alpha);
UpdateGui();
}
if (ok1&&ok2)
{
paintingArea->setLayerAlpha(layer-1,alpha);
UpdateGui();
}
}
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 = IntelliInputDialog::getInt("Layer to set on", "Layer:", paintingArea->getNumberOfActiveLayer()+1, 1, static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
if (ok1)
{
paintingArea->setPolygon(layer-1);
UpdateGui();
}
}
void IntelliPhotoGui::slotPositionMoveUp(){
@@ -147,33 +185,13 @@ void IntelliPhotoGui::slotMoveLayerDown(){
update();
}
void IntelliPhotoGui::slotClearActiveLayer(){
// "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
// "Red Input" is the title of the window
int red = IntelliInputDialog::getInt("Green Input", "Green:", 255, 0, 255, 1);
// "Green Input" is the title of the window
int green = IntelliInputDialog::getInt("Green Input", "Green:", 255, 0, 255, 1);
// "Blue Input" is the title of the window
int blue = IntelliInputDialog::getInt("Blue Input", "Blue:", 255, 0, 255, 1);
// "Alpha Input" is the title of the window
int alpha = IntelliInputDialog::getInt("Alpha Input", "Alpha:", 255, 0, 255, 1);
paintingArea->floodFill(red, green, blue, alpha);
UpdateGui();
}
void IntelliPhotoGui::slotSetActiveLayer(){
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 = IntelliInputDialog::getInt("Layer to set on", "Layer:", 1, 1, static_cast<int>(paintingArea->layerBundle.size()), 1, &ok1);
if(ok1){
paintingArea->setLayerActive(layer-1);
UpdateGui();
@@ -326,10 +344,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);
@@ -344,6 +368,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()));
@@ -492,12 +520,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);
@@ -653,7 +686,7 @@ void IntelliPhotoGui::createGui(){
SwitchColorButton->setIconSize(QSize(Buttonsize.width()*2,Buttonsize.height()));
ActiveLayerLine = new QLabel();
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1);
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1);
ActiveLayerLine->setText(string);
ActiveLayerLine->setFixedSize(Buttonsize.width()*2+10,(Buttonsize.height()*2)/3);