From 332e752371becfe203abdb7a99280f33d817b7d7 Mon Sep 17 00:00:00 2001 From: AshBastian Date: Thu, 16 Jan 2020 17:22:19 +0100 Subject: [PATCH 1/5] GUI Update 1 --- src/GUI/IntelliPhotoGui.cpp | 24 +++++++++++------------- src/GUI/IntelliPhotoGui.h | 3 +++ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 1425905..e76a39c 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -283,15 +283,6 @@ void IntelliPhotoGui::slotAboutDialog(){ tr("

IntelliPhoto - A Pretty basic editor.


Developed by Team 7.")); } -// Open an dialog about the dimensions -void IntelliPhotoGui::slotGetDim(){ - - // Window dimesnion display - QMessageBox::about(this, tr("Dimension"), - tr("Width: %1\nHeight: %2").arg(paintingArea->getMaxWidth()).arg(paintingArea->getMaxHeight())); -} - - void IntelliPhotoGui::slotEnterPressed(){ QString string = EditLineWidth->text(); if(string.toInt() > 50) { @@ -391,10 +382,6 @@ void IntelliPhotoGui::createActions(){ actionChangeDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_X)); connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim())); - actionGetDim = new QAction(tr("&Get Dimension"), this); - actionGetDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Y)); - connect(actionGetDim, SIGNAL(triggered()), this, SLOT(slotGetDim())); - actionSetActiveLayer = new QAction(tr("&set Active"), this); actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A)); connect(actionSetActiveLayer, SIGNAL(triggered()), this, SLOT(slotSetActiveLayer())); @@ -743,6 +730,15 @@ void IntelliPhotoGui::createGui(){ ActiveLayerImageLabel->setFixedSize(Buttonsize * 2); ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize * 2)); + dimActive = new QPushButton(); + dimActive->setFixedSize(Buttonsize.width()*2,Buttonsize.height()/2); + dimActive->setText("0x0"); + + dimCanvas = new QPushButton(); + dimCanvas->setFixedSize(Buttonsize.width()*2,Buttonsize.height()/2); + QString String = QString("%1x%2").arg(maxWidth).arg(maxHeight); + dimCanvas->setText(String); + // set gui elements mainLayout->addWidget(paintingArea,1,1,20,1); mainLayout->addWidget(CircleButton,1,2,1,1); @@ -761,6 +757,8 @@ void IntelliPhotoGui::createGui(){ mainLayout->addWidget(SwitchColorButton,10,2,1,2); mainLayout->addWidget(ActiveLayerLine,11,2,1,2); mainLayout->addWidget(ActiveLayerImageLabel,12,2,1,2); + mainLayout->addWidget(dimActive,13,2,1,2); + mainLayout->addWidget(dimCanvas,14,2,1,2); mainLayout->setHorizontalSpacing(0); } diff --git a/src/GUI/IntelliPhotoGui.h b/src/GUI/IntelliPhotoGui.h index dca2410..81a0b28 100644 --- a/src/GUI/IntelliPhotoGui.h +++ b/src/GUI/IntelliPhotoGui.h @@ -136,6 +136,9 @@ QPushButton* SwitchColorButton; QLabel* ActiveLayerLine; QLabel* ActiveLayerImageLabel; +QPushButton* dimActive; +QPushButton* dimCanvas; + // The menu widgets QMenu*saveAsMenu; QMenu*fileMenu; From 753a491695a1a01fac32169811f8f83cf911d471 Mon Sep 17 00:00:00 2001 From: AshBastian Date: Thu, 16 Jan 2020 17:36:52 +0100 Subject: [PATCH 2/5] GUI Update 2 --- src/GUI/IntelliPhotoGui.cpp | 13 +++++++++---- src/GUI/IntelliPhotoGui.h | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index e76a39c..1905140 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -112,12 +112,14 @@ void IntelliPhotoGui::slotChangeDim(){ // the next tr is the text to display // Define the standard Value, min, step and ok button int width = IntelliInputDialog::getInt("New Canvas Size", "Width:", 600, 1, 50000 , 1, &ok1); + maxWidth = width; int height = IntelliInputDialog::getInt("New Canvas Size", "Height:", 600, 1, 50000, 1, &ok2); + maxHeight = height; // Change dimension if (ok1&&ok2) { - paintingArea->setLayerDimensions(height,width); + paintingArea->setLayerDimensions(width,height); UpdateGui(); } } @@ -381,6 +383,7 @@ void IntelliPhotoGui::createActions(){ actionChangeDim = new QAction(tr("&Change Dimension"), this); actionChangeDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_X)); connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim())); + connect(dimCanvas, SIGNAL(clicked()), this, SLOT(slotChangeDim())); actionSetActiveLayer = new QAction(tr("&set Active"), this); actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A)); @@ -598,7 +601,6 @@ void IntelliPhotoGui::createMenus(){ optionMenu->addSeparator(); optionMenu->addMenu(renderMenu); optionMenu->addAction(actionChangeDim); - optionMenu->addAction(actionGetDim); // Attach all actions to Help helpMenu = new QMenu(tr("&Help"), this); @@ -622,8 +624,8 @@ void IntelliPhotoGui::createGui(){ // create Gui elements // get and set max width and height - int maxHeight = IntelliInputDialog::getInt("New Layer", "Height:", 600, 1); - int maxWidth = IntelliInputDialog::getInt("New Layer", "Width:", 600, 1); + maxHeight = IntelliInputDialog::getInt("New Layer", "Height:", 600, 1); + maxWidth = IntelliInputDialog::getInt("New Layer", "Width:", 600, 1); paintingArea = new PaintingArea(maxWidth, maxHeight); paintingArea->DummyGui = this; @@ -853,4 +855,7 @@ void IntelliPhotoGui::UpdateGui(){ FirstColorButton->setStyleSheet(string); string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name()); SecondColorButton->setStyleSheet(string); + + string = QString("%1x%2").arg(maxWidth).arg(maxHeight); + dimCanvas->setText(string); } diff --git a/src/GUI/IntelliPhotoGui.h b/src/GUI/IntelliPhotoGui.h index 81a0b28..ad1d731 100644 --- a/src/GUI/IntelliPhotoGui.h +++ b/src/GUI/IntelliPhotoGui.h @@ -87,7 +87,6 @@ void slotCreateFloodFillTool(); void slotAboutDialog(); void slotChangeDim(); -void slotGetDim(); void slotEnterPressed(); @@ -112,6 +111,8 @@ void setDefaultToolValue(); // What we'll draw on PaintingArea* paintingArea; +int maxHeight; +int maxWidth; const QSize Buttonsize = QSize(35,35); QPixmap preview; @@ -177,7 +178,6 @@ QAction* actionCreateFloodFillTool; // dimension actions QAction*actionChangeDim; -QAction*actionGetDim; // dialog actions QAction* actionAboutDialog; From 784e9c051ed7bdfd9398b36e47d8012a628864d8 Mon Sep 17 00:00:00 2001 From: Jonas Mucke Date: Thu, 16 Jan 2020 18:54:55 +0100 Subject: [PATCH 3/5] cmath --- src/Tool/IntelliToolPolygon.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tool/IntelliToolPolygon.cpp b/src/Tool/IntelliToolPolygon.cpp index d457395..c866424 100644 --- a/src/Tool/IntelliToolPolygon.cpp +++ b/src/Tool/IntelliToolPolygon.cpp @@ -3,6 +3,7 @@ #include #include #include +#include IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings, bool isSettingPolygon) : IntelliTool(Area, colorPicker, Toolsettings){ From c16a589a66effefd196d50121c92e6b15183a5fb Mon Sep 17 00:00:00 2001 From: AshBastian Date: Thu, 16 Jan 2020 21:19:17 +0100 Subject: [PATCH 4/5] GUI Update 3 --- src/GUI/IntelliPhotoGui.cpp | 25 +++++++++++++------------ src/GUI/IntelliPhotoGui.h | 2 -- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 1905140..3ae4f0d 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -15,7 +15,7 @@ IntelliPhotoGui::IntelliPhotoGui(){ setIntelliStyle(); // Size the app resize(600,600); - //showMaximized(); + showMaximized(); setDefaultToolValue(); } @@ -73,9 +73,9 @@ void IntelliPhotoGui::slotCreateNewRasterLayer(){ // "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 width = IntelliInputDialog::getInt("New Raster Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1); - int height = IntelliInputDialog::getInt("New Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2); + int height = IntelliInputDialog::getInt("New Raster Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2); // Create New Layer if (ok1&&ok2) { @@ -92,9 +92,9 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){ // "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 width = IntelliInputDialog::getInt("New Shaped Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1); - int height = IntelliInputDialog::getInt("New Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2); + int height = IntelliInputDialog::getInt("New Shaped Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2); // Create New Layer if (ok1&&ok2) { @@ -112,10 +112,8 @@ void IntelliPhotoGui::slotChangeDim(){ // the next tr is the text to display // Define the standard Value, min, step and ok button int width = IntelliInputDialog::getInt("New Canvas Size", "Width:", 600, 1, 50000 , 1, &ok1); - maxWidth = width; int height = IntelliInputDialog::getInt("New Canvas Size", "Height:", 600, 1, 50000, 1, &ok2); - maxHeight = height; // Change dimension if (ok1&&ok2) { @@ -624,9 +622,7 @@ void IntelliPhotoGui::createGui(){ // create Gui elements // get and set max width and height - maxHeight = IntelliInputDialog::getInt("New Layer", "Height:", 600, 1); - maxWidth = IntelliInputDialog::getInt("New Layer", "Width:", 600, 1); - paintingArea = new PaintingArea(maxWidth, maxHeight); + paintingArea = new PaintingArea(1280, 720); paintingArea->DummyGui = this; preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg"); @@ -738,7 +734,7 @@ void IntelliPhotoGui::createGui(){ dimCanvas = new QPushButton(); dimCanvas->setFixedSize(Buttonsize.width()*2,Buttonsize.height()/2); - QString String = QString("%1x%2").arg(maxWidth).arg(maxHeight); + QString String = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height()); dimCanvas->setText(String); // set gui elements @@ -856,6 +852,11 @@ void IntelliPhotoGui::UpdateGui(){ string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name()); SecondColorButton->setStyleSheet(string); - string = QString("%1x%2").arg(maxWidth).arg(maxHeight); + string = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height()); dimCanvas->setText(string); + + if(paintingArea->layerBundle.size() != 0){ + string = QString("%1x%2").arg(paintingArea->layerBundle[static_cast(paintingArea->getNumberOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast(paintingArea->getNumberOfActiveLayer())].height); + dimActive->setText(string); + } } diff --git a/src/GUI/IntelliPhotoGui.h b/src/GUI/IntelliPhotoGui.h index ad1d731..8d164a4 100644 --- a/src/GUI/IntelliPhotoGui.h +++ b/src/GUI/IntelliPhotoGui.h @@ -111,8 +111,6 @@ void setDefaultToolValue(); // What we'll draw on PaintingArea* paintingArea; -int maxHeight; -int maxWidth; const QSize Buttonsize = QSize(35,35); QPixmap preview; From 67e51c27a20ccdc7d4a049952654aca226d9cdda Mon Sep 17 00:00:00 2001 From: AshBastian Date: Thu, 16 Jan 2020 21:21:47 +0100 Subject: [PATCH 5/5] GUI Update 4 --- src/GUI/IntelliPhotoGui.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 3ae4f0d..3af696b 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -859,4 +859,7 @@ void IntelliPhotoGui::UpdateGui(){ string = QString("%1x%2").arg(paintingArea->layerBundle[static_cast(paintingArea->getNumberOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast(paintingArea->getNumberOfActiveLayer())].height); dimActive->setText(string); } + else{ + dimActive->setText("0x0"); + } }