diff --git a/src/Painting/GUI/IntelliPhotoGui.cpp b/src/Painting/GUI/IntelliPhotoGui.cpp index 65a03d5..075e3ac 100644 --- a/src/Painting/GUI/IntelliPhotoGui.cpp +++ b/src/Painting/GUI/IntelliPhotoGui.cpp @@ -71,53 +71,23 @@ void IntelliPhotoGui::save() saveFile(fileFormat); } -// Opens a dialog to change the pen color -void IntelliPhotoGui::penColor() -{ - // Store the chosen color from the dialog - QColor newColor = QColorDialog::getColor(paintingArea->penColor()); - - // If a valid color set it - if (newColor.isValid()) - paintingArea->setPenColor(newColor); -} - -// Opens a dialog that allows the user to change the pen width -void IntelliPhotoGui::penWidth() -{ - // Stores button value - bool ok; - - // tr("Painting") is the title - // the next tr is the text to display - // Get the current pen width - // Define the min, max, step and ok button - int newWidth = QInputDialog::getInt(this, tr("Painting"), - tr("Select pen width:"), - paintingArea->penWidth(), - 1, 500, 1, &ok); - // Change the pen width - if (ok) - paintingArea->setPenWidth(newWidth); -} - // Opens a dialog that allows the user to create a New Layer void IntelliPhotoGui::newLayer() { // Stores button value - bool ok; + bool ok1, ok2; // tr("New Layer") is the title // the next tr is the text to display // Define the standard Value, min, max, step and ok button int width = QInputDialog::getInt(this, tr("New Layer"), tr("Width:"), - 200,1, 500, 1, &ok); + 200,1, 500, 1, &ok1); int height = QInputDialog::getInt(this, tr("New Layer"), tr("Height:"), - 200,1, 500, 1, &ok); + 200,1, 500, 1, &ok2); // Create New Layer - if (ok) + if (ok1&&ok2) { int layer = paintingArea->addLayer(width,height,100,100); paintingArea->activate(layer); @@ -135,12 +105,108 @@ void IntelliPhotoGui::deleteLayer() // Define the standard Value, min, max, step and ok button int layerNumber = QInputDialog::getInt(this, tr("delete Layer"), tr("Number:"), - 1,1, 500, 1, &ok); + 1,0, 500, 1, &ok); // Create New Layer if (ok) - paintingArea->deleteLayer(layerNumber-1); + paintingArea->deleteLayer(layerNumber); } + +void IntelliPhotoGui::onSetAlpha(){ + // Stores button value + bool ok1, ok2; + + // tr("Layer to set on") is the title + // 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,100,1, &ok1); + // tr("New Alpha") is the title + int alpha = QInputDialog::getInt(this, tr("New Alpha"), + tr("Alpha:"), + 255,0, 255, 1, &ok2); + if (ok1&&ok2) + { + paintingArea->setAlphaToLayer(layer,alpha); + } +} + +void IntelliPhotoGui::onMoveUp(){ + paintingArea->moveActive(0,-2); + update(); +} + +void IntelliPhotoGui::onMoveDown(){ + paintingArea->moveActive(0,2); + update(); +} + +void IntelliPhotoGui::onMoveLeft(){ + paintingArea->moveActive(-2,0); + update(); +} + +void IntelliPhotoGui::onMoveRight(){ + paintingArea->moveActive(2,0); + update(); +} + +void IntelliPhotoGui::onMoveLayerUp(){ + paintingArea->moveActiveLayer(1); + update(); +} + +void IntelliPhotoGui::onMoveLayerDown(){ + paintingArea->moveActiveLayer(-1); + update(); +} + +void IntelliPhotoGui::onClearedPressed(){ + // Stores button value + bool ok1, ok2, ok3, ok4; + + // tr("Red Input") is the title + // 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); + // tr("Green Input") is the title + int green = QInputDialog::getInt(this, tr("Green Input"), + tr("Green:"), + 255,0, 255, 1, &ok2); + // tr("Blue Input") is the title + int blue = QInputDialog::getInt(this, tr("Blue Input"), + tr("Blue:"), + 255,0, 255, 1, &ok3); + // tr("Alpha Input") is the title + int alpha = QInputDialog::getInt(this, tr("Alpha Input"), + tr("Alpha:"), + 255,0, 255, 1, &ok4); + if (ok1&&ok2&&ok3&&ok4) + { + paintingArea->clearImage(red, green, blue, alpha); + } +} + +void IntelliPhotoGui::onActivePressed(){ + // Stores button value + bool ok1; + + // tr("Layer to set on") is the title + // 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,0,255,1, &ok1); + if (ok1) + { + paintingArea->setLayerToActive(layer); + } +}; + + // Open an about dialog void IntelliPhotoGui::about() { @@ -149,88 +215,9 @@ void IntelliPhotoGui::about() tr("

IntelliPhoto Some nice ass looking software

")); } -void IntelliPhotoGui::onSetAlpha(){ - int a = this->setAlphaEdit->text().toInt(); - if (a >= 0 && a < 256) - emit this->sendAlpha(a); -} - -void IntelliPhotoGui::onMoveUp(){ - int a = 5; - emit this->moveUp(a); -} - -void IntelliPhotoGui::onMoveDown(){ - int a = 5; - emit this->moveDown(a); -} - -void IntelliPhotoGui::onMoveLeft(){ - int a = 5; - emit this->moveLeft(a); -} - -void IntelliPhotoGui::onMoveRight(){ - int a = 5; - emit this->moveRight(a); -} - -void IntelliPhotoGui::onMoveLayerUp(){ - emit this->moveLayerUp(); -} - -void IntelliPhotoGui::onMoveLayerDown(){ - emit this->moveLayerDown(); -} - -void IntelliPhotoGui::onClearedPressed(){ - int r = this->RedEdit->text().toInt(); - int g = this->GreenEdit->text().toInt(); - int b = this->BlueEdit->text().toInt(); - if(r < 256 && r >= 0 && g < 256 && g >= 0 && b < 256 && b >= 0) - emit this->sendClearColor(r,g,b); -} - -void IntelliPhotoGui::onActivePressed(){ - int a = this->selectActiveEdit->text().toInt(); - emit this->sendActiveLayer(a-1); -}; - - - // Define menu actions that call functions void IntelliPhotoGui::createActions() { - //connect signal and slots of gui element - connect(this->clearButton, SIGNAL(clicked()), this, SLOT(onClearedPressed())); - connect(this, SIGNAL(sendClearColor(int,int,int)), paintingArea, SLOT(clearImage(int, int, int))); - - connect(this->selectActiveButton, SIGNAL(clicked()), this, SLOT(onActivePressed())); - connect(this, SIGNAL(sendActiveLayer(int)),paintingArea, SLOT(activate(int))); - - connect(this->setAlphaButton, SIGNAL(clicked()), this, SLOT(onSetAlpha())); - connect(this, SIGNAL(sendAlpha(int)), paintingArea, SLOT(setAlpha(int))); - - connect(this->moveActiveUpButton, SIGNAL(clicked()), this, SLOT(onMoveUp())); - connect(this, SIGNAL(moveUp(int)), paintingArea, SLOT(getMoveUp(int))); - - connect(this->moveActiveDownButton, SIGNAL(clicked()), this, SLOT(onMoveDown())); - connect(this, SIGNAL(moveDown(int)), paintingArea, SLOT(getMoveDown(int))); - - connect(this->moveActiveLeftButton, SIGNAL(clicked()), this, SLOT(onMoveLeft())); - connect(this, SIGNAL(moveLeft(int)), paintingArea, SLOT(getMoveLeft(int))); - - connect(this->moveActiveRightButton, SIGNAL(clicked()), this, SLOT(onMoveRight())); - connect(this, SIGNAL(moveRight(int)), paintingArea, SLOT(getMoveRight(int))); - - connect(this->layerMoveActiveDownButton, SIGNAL(clicked()), this, SLOT(onMoveLayerDown())); - connect(this, SIGNAL(moveLayerDown()), paintingArea, SLOT(getMoveLayerDown())); - - connect(this->layerMoveActiveUpButton, SIGNAL(clicked()), this, SLOT(onMoveLayerUp())); - connect(this, SIGNAL(moveLayerUp()), paintingArea, SLOT(getMoveLayerUp())); - - - // Create the action tied to the menu openAct = new QAction(tr("&Open..."), this); @@ -258,16 +245,14 @@ void IntelliPhotoGui::createActions() saveAsActs.append(action); } - QAction *action = new QAction("PNG-8", this); - - // Set an action for each file format - action->setData("PNG"); - + //set exporter to actions + QAction *pngSaveAction = new QAction("PNG-8", this); + pngSaveAction->setData("PNG"); // When clicked call IntelliPhotoGui::save() - connect(action, SIGNAL(triggered()), this, SLOT(save())); + connect(pngSaveAction, SIGNAL(triggered()), this, SLOT(save())); + // Attach each PNG in save Menu + saveAsActs.append(pngSaveAction); - // Attach each file format option menu item to Save As - saveAsActs.append(action); // Create exit action and tie to IntelliPhotoGui::close() @@ -275,24 +260,11 @@ void IntelliPhotoGui::createActions() exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); - // Create pen color action and tie to IntelliPhotoGui::penColor() - penColorAct = new QAction(tr("&Pen Color..."), this); - connect(penColorAct, SIGNAL(triggered()), this, SLOT(penColor())); - - // Create pen width action and tie to IntelliPhotoGui::penWidth() - penWidthAct = new QAction(tr("Pen &Width..."), this); - connect(penWidthAct, SIGNAL(triggered()), this, SLOT(penWidth())); - - // Create clear screen action and tie to IntelliPhotoGui::clearImage() - clearScreenAct = new QAction(tr("&Clear Screen"), this); - clearScreenAct->setShortcut(tr("Ctrl+L")); - connect(clearScreenAct, SIGNAL(triggered()), - this, SLOT(onClearedPressed())); - // Create New Layer action and tie to IntelliPhotoGui::newLayer() newLayerAct = new QAction(tr("&New Layer..."), this); connect(newLayerAct, SIGNAL(triggered()), this, SLOT(newLayer())); + // Delete New Layer action and tie to IntelliPhotoGui::deleteLayer() deleteLayerAct = new QAction(tr("&Delete Layer..."), this); connect(deleteLayerAct, SIGNAL(triggered()), this, SLOT(deleteLayer())); @@ -301,6 +273,39 @@ void IntelliPhotoGui::createActions() deleteActiveLayerAct = new QAction(tr("&Delete active Layer"), this); connect(deleteActiveLayerAct, SIGNAL(triggered()), paintingArea, SLOT(deleteActiveLayer())); + clearedActions = new QAction(tr("&clear Image"), this); + connect(clearedActions, SIGNAL(triggered()), this, SLOT(onClearedPressed())); + + setActiveAction = new QAction(tr("&set Active"), this); + connect(setActiveAction, SIGNAL(triggered()), this, SLOT(onActivePressed())); + + setAlphaAction = new QAction(tr("&set Alpha"), this); + connect(setAlphaAction, SIGNAL(triggered()), this, SLOT(onSetAlpha())); + + moveUpAction = new QAction(tr("&move Up"), this); + moveUpAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up)); + connect(moveUpAction, SIGNAL(triggered()), this, SLOT(onMoveUp())); + + moveDownAction = new QAction(tr("&move Down"), this); + moveDownAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down)); + connect(moveDownAction, SIGNAL(triggered()), this, SLOT(onMoveDown())); + + moveLeftAction = new QAction(tr("&move Left"), this); + moveLeftAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left)); + connect(moveLeftAction, SIGNAL(triggered()), this, SLOT(onMoveLeft())); + + moveRightAction = new QAction(tr("&move Right"), this); + moveRightAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right)); + connect(moveRightAction, SIGNAL(triggered()), this, SLOT(onMoveRight())); + + moveLayerUpAction = new QAction(tr("&move Layer Up"), this); + moveLayerUpAction->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Up)); + connect(moveLayerUpAction, SIGNAL(triggered()), this, SLOT(onMoveLayerUp())); + + moveLayerDownAction= new QAction(tr("&move Layer Down"), this); + moveLayerDownAction->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down)); + connect(moveLayerDownAction, SIGNAL(triggered()), this, SLOT(onMoveLayerDown())); + // Create about action and tie to IntelliPhotoGui::about() aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); @@ -328,10 +333,15 @@ void IntelliPhotoGui::createMenus() // Attach all actions to Options optionMenu = new QMenu(tr("&Options"), this); - optionMenu->addAction(penColorAct); - optionMenu->addAction(penWidthAct); - optionMenu->addSeparator(); - optionMenu->addAction(clearScreenAct); + optionMenu->addAction(clearedActions); + optionMenu->addAction(setActiveAction); + optionMenu->addAction(setAlphaAction); + optionMenu->addAction(moveUpAction); + optionMenu->addAction(moveDownAction); + optionMenu->addAction(moveLeftAction); + optionMenu->addAction(moveRightAction); + optionMenu->addAction(moveLayerUpAction); + optionMenu->addAction(moveLayerDownAction); // Attach all actions to Layer layerMenu = new QMenu(tr("&Layer"), this); @@ -339,6 +349,9 @@ void IntelliPhotoGui::createMenus() layerMenu->addAction(deleteLayerAct); layerMenu->addAction(deleteActiveLayerAct); + //Attach all Tool Options + toolMenu = new QMenu(tr("&Tools"), this); + // Attach all actions to Help helpMenu = new QMenu(tr("&Help"), this); helpMenu->addAction(aboutAct); @@ -348,6 +361,7 @@ void IntelliPhotoGui::createMenus() menuBar()->addMenu(fileMenu); menuBar()->addMenu(optionMenu); menuBar()->addMenu(layerMenu); + menuBar()->addMenu(toolMenu); menuBar()->addMenu(helpMenu); } @@ -361,67 +375,10 @@ void IntelliPhotoGui::createGui(){ centralGuiWidget->setLayout(mainLayout); //create Gui elements - clearButton = new QPushButton("set Color"); paintingArea = new PaintingArea(); - - RedLabel = new QLabel("Red:"); - GreenLabel = new QLabel("Green"); - BlueLabel = new QLabel("Blue:"); - RedEdit = new QLineEdit("255"); - GreenEdit = new QLineEdit("255"); - BlueEdit = new QLineEdit("255"); - RedEdit->setMaximumSize(150,20); - GreenEdit->setMaximumSize(150,20); - BlueEdit->setMaximumSize(150,20); - - selectActiveButton = new QPushButton("select Active"); - selectActiveLabel = new QLabel("Active:"); - selectActiveEdit = new QLineEdit("1"); - selectActiveLabel->setMaximumSize(150,20); - selectActiveEdit->setMaximumSize(150,20); - - setAlphaButton = new QPushButton("set Alpha"); - setAlphaLabel = new QLabel("Alpha:"); - setAlphaEdit = new QLineEdit("255"); - setAlphaEdit->setMaximumSize(150,20); - - moveActiveUpButton = new QPushButton("move 5 Up"); - moveActiveDownButton = new QPushButton("move 5 Down"); - moveActiveLeftButton = new QPushButton("move 5 Left"); - moveActiveRightButton = new QPushButton("move 5 Right"); - - layerMoveActiveDownButton = new QPushButton("Active Layer Down"); - layerMoveActiveUpButton = new QPushButton("Active Layer Up"); - - //set gui elemtns position - mainLayout->addWidget(clearButton,0,25,1,1); - mainLayout->addWidget(paintingArea,0,0,25,25); - - mainLayout->addWidget(RedLabel,1,25,1,1); - mainLayout->addWidget(RedEdit,2,25,1,1); - mainLayout->addWidget(GreenLabel,3,25,1,1); - mainLayout->addWidget(GreenEdit,4,25,1,1); - mainLayout->addWidget(BlueLabel,5,25,1,1); - mainLayout->addWidget(BlueEdit,6,25,1,1); - - mainLayout->addWidget(selectActiveButton,7,25,1,1); - mainLayout->addWidget(selectActiveLabel,8,25,1,1); - mainLayout->addWidget(selectActiveEdit,9,25,1,1); - - mainLayout->addWidget(setAlphaButton,10,25,1,1); - mainLayout->addWidget(setAlphaLabel,11,25,1,1); - mainLayout->addWidget(setAlphaEdit,12,25,1,1); - - mainLayout->addWidget(moveActiveUpButton,13,25,1,1); - mainLayout->addWidget(moveActiveDownButton,14,25,1,1); - mainLayout->addWidget(moveActiveLeftButton,15,25,1,1); - mainLayout->addWidget(moveActiveRightButton,16,25,1,1); - - mainLayout->addWidget(layerMoveActiveDownButton,17,25,1,1); - mainLayout->addWidget(layerMoveActiveUpButton,18,25,1,1); - - + //set gui elements + mainLayout->addWidget(paintingArea); } void IntelliPhotoGui::setIntelliStyle(){ diff --git a/src/Painting/GUI/IntelliPhotoGui.h b/src/Painting/GUI/IntelliPhotoGui.h index c872ab8..ac2c2f9 100644 --- a/src/Painting/GUI/IntelliPhotoGui.h +++ b/src/Painting/GUI/IntelliPhotoGui.h @@ -18,19 +18,9 @@ class IntelliPhotoGui : public QMainWindow // for all Qt objects // QObjects handle events Q_OBJECT -signals: - void sendClearColor(int r, int g, int b); - void sendActiveLayer(int a); - void sendAlpha(int a); - void moveUp(int a); - void moveDown(int a); - void moveRight(int a); - void moveLeft(int a); - void moveLayerUp(); - void moveLayerDown(); - public: IntelliPhotoGui(); + protected: // Function used to close an event void closeEvent(QCloseEvent *event) override; @@ -39,8 +29,6 @@ protected: private slots: void open(); void save(); - void penColor(); - void penWidth(); void newLayer(); void deleteLayer(); void about(); @@ -59,73 +47,55 @@ private: // Will tie user actions to functions void createActions(); void createMenus(); - //setup GUI elements void createGui(); - //set style of the GUI void setIntelliStyle(); + // Will check if changes have occurred since last save bool maybeSave(); - // Opens the Save dialog and saves bool saveFile(const QByteArray &fileFormat); // What we'll draw on PaintingArea* paintingArea; - // The menu widgets QMenu *saveAsMenu; QMenu *fileMenu; QMenu *optionMenu; QMenu *layerMenu; + QMenu *toolMenu; QMenu *helpMenu; - // All the actions that can occur QAction *openAct; - - // Actions tied to specific file formats - QList saveAsActs; QAction *exitAct; - QAction *penColorAct; - QAction *penWidthAct; - QAction *clearScreenAct; + QAction *newLayerAct; QAction *deleteLayerAct; QAction *deleteActiveLayerAct; + QAction *aboutAct; QAction *aboutQtAct; + QAction* clearedActions; + QAction* setActiveAction; + QAction* setAlphaAction; + QAction* moveUpAction; + QAction* moveDownAction; + QAction* moveLeftAction; + QAction* moveRightAction; + QAction* moveLayerUpAction; + QAction* moveLayerDownAction; + + // Actions tied to specific file formats + QList saveAsActs; + //main GUI elements QWidget* centralGuiWidget; QGridLayout *mainLayout; - QPushButton *clearButton; - - QLabel *RedLabel; - QLabel *GreenLabel; - QLabel *BlueLabel; - QLineEdit *RedEdit; - QLineEdit *GreenEdit; - QLineEdit *BlueEdit; - - QPushButton *selectActiveButton; - QLabel *selectActiveLabel; - QLineEdit *selectActiveEdit; - - QPushButton *setAlphaButton; - QLabel *setAlphaLabel; - QLineEdit *setAlphaEdit; - - QPushButton *moveActiveUpButton; - QPushButton *moveActiveDownButton; - QPushButton *moveActiveLeftButton; - QPushButton *moveActiveRightButton; - - QPushButton *layerMoveActiveDownButton; - QPushButton *layerMoveActiveUpButton; }; diff --git a/src/Painting/Layer/PaintingArea.cpp b/src/Painting/Layer/PaintingArea.cpp index e68498a..1a7b9c1 100644 --- a/src/Painting/Layer/PaintingArea.cpp +++ b/src/Painting/Layer/PaintingArea.cpp @@ -128,71 +128,36 @@ bool PaintingArea::saveImage(const QString &fileName, const char *fileFormat) } } -// Used to change the pen color -void PaintingArea::setPenColor(const QColor &newColor) -{ - //TODO give to Tool -} - -// Used to change the pen width -void PaintingArea::setPenWidth(int newWidth) -{ - //TODO give to Tool -} // Color the image area with white -void PaintingArea::clearImage(int r, int g, int b){ +void PaintingArea::clearImage(int r, int g, int b, int a){ if(this->activeLayer==-1){ return; } IntelliImage* active = layerStructure[static_cast(activeLayer)].image; - active->floodFill(QColor(r, g, b, 255)); - + active->floodFill(QColor(r, g, b, a)); update(); } +void PaintingArea::moveActive(int x, int y){ + layerStructure[static_cast(activeLayer)].widthOffset += x; + layerStructure[static_cast(activeLayer)].heightOffset += y; +} + +void PaintingArea::moveActiveLayer(int idx){ + if(idx==1){ + this->activeLayerUp(); + }else if(idx==-1){ + this->activeLayerDown(); + } +} + void PaintingArea::activate(int a){ if(a>=0 && a < static_cast(layerStructure.size())){ this->setLayerToActive(a); } } -void PaintingArea::setAlpha(int a){ - if(activeLayer>=0){ - layerStructure[static_cast(activeLayer)].alpha=a; - } -} - -void PaintingArea::getMoveUp(int a){ - layerStructure[static_cast(activeLayer)].heightOffset-=a; -} - -void PaintingArea::getMoveDown(int a){ - layerStructure[static_cast(activeLayer)].heightOffset+=a; -} - -void PaintingArea::getMoveRight(int a){ - layerStructure[static_cast(activeLayer)].widthOffset+=a; -} - -void PaintingArea::getMoveLeft(int a){ - layerStructure[static_cast(activeLayer)].widthOffset-=a; -} - -void PaintingArea::getMoveLayerUp(){ - if(activeLayer(layerStructure.size()-1) && activeLayer>=0){ - std::swap(layerStructure[static_cast(activeLayer)], layerStructure[static_cast(activeLayer+1)]); - activeLayer++; - } -} - -void PaintingArea::getMoveLayerDown(){ - if(activeLayer>0){ - std::swap(layerStructure[static_cast(activeLayer)], layerStructure[static_cast(activeLayer-1)]); - activeLayer--; - } -} - // If a mouse button is pressed check if it was the // left button and if so store the current position // Set that we are currently drawing @@ -237,15 +202,25 @@ void PaintingArea::resizeEvent(QResizeEvent *event) update(); } -void PaintingArea::drawLineTo(const QPoint &endPoint) -{ - -} void PaintingArea::resizeImage(QImage *image_res, const QSize &newSize){ //TODO implement } +void PaintingArea::activeLayerUp(){ + if(activeLayer!=-1 && activeLayer0){ + std::swap(layerStructure[activeLayer], layerStructure[activeLayer-1]); + activeLayer--; + } +} + void PaintingArea::assembleLayers(bool forSaving){ if(forSaving){ Canvas->fill(Qt::GlobalColor::transparent); diff --git a/src/Painting/Layer/PaintingArea.h b/src/Painting/Layer/PaintingArea.h index b8e172d..f164cae 100644 --- a/src/Painting/Layer/PaintingArea.h +++ b/src/Painting/Layer/PaintingArea.h @@ -36,31 +36,19 @@ public: void deleteLayer(int index); void setLayerToActive(int index); void setAlphaToLayer(int index, int alpha); + void clearImage(int r, int g, int b, int a); + void moveActive(int x, int y); + void moveActiveLayer(int idx); // Has the image been modified since last save bool isModified() const { return modified; } - void setPenColor(const QColor &newColor); - QColor penColor() const { return myPenColor; } - - void setPenWidth(int newWidth); - int penWidth() const { return myPenWidth; } - - public slots: // Events to handle - void clearImage(int r, int g, int b); void activate(int a); void deleteActiveLayer(); - void setAlpha(int a); - void getMoveUp(int a); - void getMoveDown(int a); - void getMoveRight(int a); - void getMoveLeft(int a); - void getMoveLayerUp(); - void getMoveLayerDown(); //void setUp helper for konstruktor void setUp(int maxWidth, int maxHeight); protected: @@ -76,7 +64,8 @@ protected: void resizeEvent(QResizeEvent *event) override; private: - + void activeLayerUp(); + void activeLayerDown(); QImage* Canvas; int maxWidth; @@ -87,7 +76,6 @@ private: void assembleLayers(bool forSaving=false); - void drawLineTo(const QPoint &endPoint); void resizeImage(QImage *image_res, const QSize &newSize); // Will be marked true or false depending on if