From 2a37143835cb9ec311c70852da871a4e35e18af9 Mon Sep 17 00:00:00 2001 From: Sonaion Date: Mon, 27 Jan 2020 18:58:31 +0100 Subject: [PATCH 01/24] input dialog change --- src/GUI/IntelliInputDialog.h | 86 +++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/src/GUI/IntelliInputDialog.h b/src/GUI/IntelliInputDialog.h index 7775c0d..9d89ca7 100644 --- a/src/GUI/IntelliInputDialog.h +++ b/src/GUI/IntelliInputDialog.h @@ -9,35 +9,119 @@ #include #include +/*! + * \brief The IntelliInputDialog class is a customized Input Dialog to get Integers + */ class IntelliInputDialog : public QDialog { Q_OBJECT public: + /*! + * \brief IntelliInputDialog is the baisc constructor to for the InputDialog + * \param Title - Title of the Input Dialog. + * \param Label - A Label for the Iput Dialog, to show further information. + * \param value - The standart value in the Input Box. + * \param minValue - The minimal value to read. + * \param maxValue - The maximal value to read. + * \param step - The step size of Values. + * \param ok - A check if the input was okay + */ IntelliInputDialog(QString Title = nullptr, QString Label = nullptr, int value = 5, int minValue = -2147483647, int maxValue = 2147483647, int step = 1, bool* ok = nullptr); - +/*! + * \brief getInt is a static funktion ยด, which creates an Input Dialog and gets an Integer. + * \param Title - Title of the Input Dialog. + * \param Label - A Label for the Iput Dialog, to show further information. + * \param value - The standart value in the Input Box. + * \param minValue - The minimal value to read. + * \param maxValue - The maximal value to read. + * \param step - The step size of Values. + * \param ok - A check if the input was okay + * \return + */ static int getInt(QString Title = nullptr, QString Label = nullptr, int value = 5, int minValue = -2147483647, int maxValue = 2147483647, int step = 1, bool* ok = nullptr); public slots: +/*! + * \brief slotCloseEvent is a slot for catching the close Event. + */ void slotCloseEvent(); + +/*! + * \brief slotEingabe is a slot for catching the Input Event. + */ void slotEingabe(); private: +/*! + * \brief createInputBox creates an Input Box for reading values. + * \param Title - Title of the Input Dialog. + * \param Label - A Label for the Iput Dialog, to show further information. + * \param value - The standart value in the Input Box. + * \param minValue - The minimal value to read. + * \param maxValue - The maximal value to read. + * \param step - The step size of Values. + */ void createInputBox(QString Title = nullptr, QString Label = nullptr, int value = 5, int minValue = -2147483647, int maxValue = 2147483647, int step = 1); + +/*! + * \brief createConnections connects the close and Eingabe slot. + */ void createConnections(); + +/*! + * \brief setInputBoxStyle + */ void setInputBoxStyle(); +/*! + * \brief valueInt the variable where the input is saved. + */ int valueInt; +/*! + * \brief Layout to place als gui event onto. + */ QGridLayout* Layout; + +/*! + * \brief ButtonBox is a gui elment for the button. + */ QDialogButtonBox* ButtonBox; + +/*! + * \brief notClosed saves the value, if the InputDialog is closed. + */ bool* notClosed; +/*! + * \brief Linesize to standarize the line size. + */ const QSize Linesize = QSize(150,20); + +/*! + * \brief Buttonsize to standarize the button size. + */ const QSize Buttonsize = QSize(72,20); + +/*! + * \brief InputLabel a gui element for a label. + */ QLabel* InputLabel; + +/*! + * \brief Input a gui element for a SpinBox. + */ QSpinBox* Input; + +/*! + * \brief okButton a gui element for the ok Button. + */ QPushButton* okButton; + +/*! + * \brief cancelButton a gui element for the cancel button. + */ QPushButton* cancelButton; }; From 805c67edc55e3881741797bab3bcee363cf0c2e6 Mon Sep 17 00:00:00 2001 From: Conrad Date: Mon, 27 Jan 2020 19:07:16 +0100 Subject: [PATCH 02/24] Fixed a bug where sqrt wasn't found sqrt is a math library function, not in standard lib --- src/Tool/IntelliToolGradient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tool/IntelliToolGradient.cpp b/src/Tool/IntelliToolGradient.cpp index 216e5f2..8f33fb4 100644 --- a/src/Tool/IntelliToolGradient.cpp +++ b/src/Tool/IntelliToolGradient.cpp @@ -110,7 +110,7 @@ double IntelliToolGradient::dotProduct(double Vector1[2], double Vector2[2]){ } double IntelliToolGradient::lenghtVector(double Vector[2]){ - return static_cast((std::sqrt(Vector[0] * Vector[0] + Vector[1] * Vector[1]))); + return static_cast((sqrt(Vector[0] * Vector[0] + Vector[1] * Vector[1]))); } void IntelliToolGradient::computeGradientLayer(){ From 3a13904eead43f264957d5962ec2a66f44e3f0e5 Mon Sep 17 00:00:00 2001 From: Sonaion Date: Tue, 28 Jan 2020 10:41:54 +0100 Subject: [PATCH 03/24] added comments but gui --- src/GUI/IntelliPhotoGui.cpp | 16 +- src/Image/IntelliImage.h | 12 + src/IntelliHelper/IntelliDatamanager.cpp | 4 +- src/IntelliHelper/IntelliDatamanager.h | 13 + .../IntelliRenderSettings.h.autosave | 34 ++ .../IntelliToolsettings.h.autosave | 59 +++ src/Layer/PaintingArea.cpp | 24 +- src/Layer/PaintingArea.h | 101 +++- src/Layer/PaintingArea.h.autosave | 481 ++++++++++++++++++ src/Tool/IntelliTool.h | 18 + src/Tool/IntelliToolGradient.cpp | 1 + src/Tool/IntelliToolGradient.cpp.autosave | 131 +++++ src/Tool/IntelliToolGradient.h | 72 ++- src/Tool/IntelliToolPolygon.cpp | 8 +- 14 files changed, 935 insertions(+), 39 deletions(-) create mode 100644 src/IntelliHelper/IntelliRenderSettings.h.autosave create mode 100644 src/IntelliHelper/IntelliToolsettings.h.autosave create mode 100644 src/Layer/PaintingArea.h.autosave create mode 100644 src/Tool/IntelliToolGradient.cpp.autosave diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index d3ab832..7166490 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -141,7 +141,7 @@ void IntelliPhotoGui::slotChangeDim(){ // Change dimension if (ok1&&ok2) { - paintingArea->setLayerDimensions(width,height); + paintingArea->setCanvasDimensions(width,height); UpdateGui(); } } @@ -153,7 +153,7 @@ void IntelliPhotoGui::slotDeleteLayer(){ // "delete 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 layerNumber = IntelliInputDialog::getInt("Delete Layer", "Number:", paintingArea->getNumberOfActiveLayer() + 1, 1, static_cast(paintingArea->layerBundle.size()), 1, &ok1); + int layerNumber = IntelliInputDialog::getInt("Delete Layer", "Number:", paintingArea->getIndexOfActiveLayer() + 1, 1, static_cast(paintingArea->layerBundle.size()), 1, &ok1); // Create New Layer if(ok1) { @@ -169,7 +169,7 @@ void IntelliPhotoGui::slotSetActiveAlpha(){ // 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(paintingArea->layerBundle.size()), 1, &ok1); + int layer = IntelliInputDialog::getInt("Layer to set on", "Layer:", paintingArea->getIndexOfActiveLayer() + 1, 1, static_cast(paintingArea->layerBundle.size()), 1, &ok1); // "New Alpha" is the title of the window int alpha = IntelliInputDialog::getInt("Layer to set on", "Alpha:", 255, 0, 255, 1, &ok2); @@ -188,7 +188,7 @@ void IntelliPhotoGui::slotSetPolygon(){ // "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(paintingArea->layerBundle.size()), 1, &ok1); + int layer = IntelliInputDialog::getInt("Layer to set on", "Layer:", paintingArea->getIndexOfActiveLayer() + 1, 1, static_cast(paintingArea->layerBundle.size()), 1, &ok1); if (ok1) { @@ -784,7 +784,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->getIndexOfActiveLayer() + 1); ActiveLayerLine->setText(string); ActiveLayerLine->setFixedSize(Buttonsize.width() * 2 + 10,(Buttonsize.height() * 2) / 3); @@ -922,7 +922,7 @@ void IntelliPhotoGui::setToolWidth(int value){ } void IntelliPhotoGui::UpdateGui(){ - QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer() + 1); + QString string = QString("Active Layer: %1").arg(paintingArea->getIndexOfActiveLayer() + 1); ActiveLayerLine->setText(string); IntelliImage* activePicture = paintingArea->getImageOfActiveLayer(); @@ -947,8 +947,8 @@ void IntelliPhotoGui::UpdateGui(){ 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); + (paintingArea->getIndexOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast + (paintingArea->getIndexOfActiveLayer())].height); dimActive->setText(string); } else{ diff --git a/src/Image/IntelliImage.h b/src/Image/IntelliImage.h index ac6c3bc..1c114ca 100644 --- a/src/Image/IntelliImage.h +++ b/src/Image/IntelliImage.h @@ -171,10 +171,22 @@ virtual QImage getImageData(); */ virtual void setImageData(const QImage& newData); +/*! + * \brief getWidth returns the width of the Image. + * \return The width of the Image in pixel. + */ virtual int getWidth() const; +/*! + * \brief getHeight returns the height of the Image. + * \return The height of the Image in pixel. + */ virtual int getHeight() const; +/*! + * \brief isFastRendering returns if the Image is in fast rendering mode. + * \return True if the Image is fast rendered, flase otherwiese. + */ virtual bool isFastRendering() const; }; diff --git a/src/IntelliHelper/IntelliDatamanager.cpp b/src/IntelliHelper/IntelliDatamanager.cpp index a704f64..e82e378 100644 --- a/src/IntelliHelper/IntelliDatamanager.cpp +++ b/src/IntelliHelper/IntelliDatamanager.cpp @@ -61,7 +61,7 @@ bool IntelliDatamanager::loadProject(PaintingArea* Canvas, QString filePath){ in >> widthCanvas >> heightCanvas; in >> numberOffLayers; - Canvas->setLayerDimensions(widthCanvas, heightCanvas); + Canvas->setCanvasDimensions(widthCanvas, heightCanvas); for(int i = 0; i> width >> height >> widthOffset >> heightOffset >> alpha; @@ -88,7 +88,7 @@ bool IntelliDatamanager::loadProject(PaintingArea* Canvas, QString filePath){ for(int k = 0; k> red >> green >> blue >> alpha; - Canvas->setPixelToActive(QColor(red, green, blue, alpha), QPoint(j, k)); + Canvas->drawPixelOntoActive(QColor(red, green, blue, alpha), QPoint(j, k)); } } } diff --git a/src/IntelliHelper/IntelliDatamanager.h b/src/IntelliHelper/IntelliDatamanager.h index 777e591..9da93a4 100644 --- a/src/IntelliHelper/IntelliDatamanager.h +++ b/src/IntelliHelper/IntelliDatamanager.h @@ -8,7 +8,20 @@ class PaintingArea; namespace IntelliDatamanager { +/*! + * \brief loadProject loads a project from a file, closes current project. + * \param Canvas - Reference to the used Canvas. + * \param filePath - Filepath to the project which should be opened. + * \return True if everything worked, false otherwise. + */ bool loadProject(PaintingArea* Canvas, QString filePath = "unnamed.idf"); + +/*! + * \brief saveProject saves the current project to a file. + * \param Canvas - Reference to the used Canvas. + * \param filePath - Filepath to the project which should be saved. + * \return True if everything worked, false otherwise. + */ bool saveProject(PaintingArea* Canvas, QString filePath = "unnamed.idf"); } diff --git a/src/IntelliHelper/IntelliRenderSettings.h.autosave b/src/IntelliHelper/IntelliRenderSettings.h.autosave new file mode 100644 index 0000000..2fc3afb --- /dev/null +++ b/src/IntelliHelper/IntelliRenderSettings.h.autosave @@ -0,0 +1,34 @@ +#ifndef INTELLIRENDERSETTINGS_H +#define INTELLIRENDERSETTINGS_H + +//for unit testing +class UnitTest; + +/*! + * \brief The IntelliRenderSettings class which manages the render Settings. + */ +class IntelliRenderSettings +{ +friend UnitTest; +public: +IntelliRenderSettings(); + +/*! + * \brief setFastRendering sets fastRendering to Updatedsetting. + * \param Updatedsetting - Represents the new value for the Fast Rendering Flag. + */ +void setFastRendering(bool Updatedsetting); +/*! + * \brief The getfastRenderer gets the value of the flag for the fastRenderer setting. + * \return Returns true if fastRenderer is active else false + */ +bool isFastRenderering() const; + +private: +/*! + * \brief fastRenderering the state of the project, in relation the the render setting. + */ +bool fastRenderering = true; +}; + +#endif diff --git a/src/IntelliHelper/IntelliToolsettings.h.autosave b/src/IntelliHelper/IntelliToolsettings.h.autosave new file mode 100644 index 0000000..b251aa9 --- /dev/null +++ b/src/IntelliHelper/IntelliToolsettings.h.autosave @@ -0,0 +1,59 @@ +#ifndef INTELLITOOLSETTINGS_H +#define INTELLITOOLSETTINGS_H + +//for unit testing +class UnitTest; +/*! + * \brief The IntelliToolsettings class managing the settings of the tools, independent of an existing tool. + */ +class IntelliToolsettings { +friend UnitTest; +public: +/*! + * \brief IntelliToolsettings - basic constructor of the IntelliToolsettings, initializing the basics. + */ +IntelliToolsettings(); + +/*! + * \brief ~IntelliToolsettings - basic destructor. + */ +virtual ~IntelliToolsettings(); + +/*! + * \brief getLineWidth returns the width attribute of the line. + * \return returns the width attribute as integer. + */ +int getLineWidth() const; + +/*! + * \brief setLineWidth sets the width attribute of the line. + * \param LineWidth - the future width of the line + */ +void setLineWidth(int LineWidth); + +/*! + * \brief getInnerAlpha returns the inner alpha value. + * \return returns the inner alpha attribute as integer. + */ +int getInnerAlpha() const; + +/*! + * \brief setInnerAlpha sets the inner alpha attribute of the Tool. + * \param innerAlpha - the future inner alpha of the Tool. + */ +void setInnerAlpha(int innerAlpha); + +private: + +/*! + * \brief lineWidth attribute of a Tool. + */ +int lineWidth; + +/*! + * \brief innerAlpha aattribute of a Tool. + */ +int innerAlpha; +}; + +#endif diff --git a/src/Layer/PaintingArea.cpp b/src/Layer/PaintingArea.cpp index 1b4236b..64f6134 100644 --- a/src/Layer/PaintingArea.cpp +++ b/src/Layer/PaintingArea.cpp @@ -40,7 +40,7 @@ LayerObject::LayerObject(const LayerObject& layer){ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent) : QLabel(parent){ this->Tool = nullptr; - this->setLayerDimensions(maxWidth, maxHeight); + this->setCanvasDimensions(maxWidth, maxHeight); activeLayer = -1; } @@ -69,7 +69,7 @@ bool PaintingArea::getRenderSettings(){ return this->renderSettings.isFastRenderering(); } -void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){ +void PaintingArea::setCanvasDimensions(int maxWidth, int maxHeight){ //set standart parameter this->maxWidth = maxWidth; this->maxHeight = maxHeight; @@ -83,7 +83,7 @@ void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){ } -void PaintingArea::setPixelToActive(QColor color, QPoint point){ +void PaintingArea::drawPixelOntoActive(QColor color, QPoint point){ layerBundle[static_cast(activeLayer)].image->drawPixel(point, color); } @@ -296,11 +296,11 @@ int PaintingArea::getMaxHeight(){ return this->maxHeight; } -ImageType PaintingArea::getTypeOfImageRealLayer(){ +ImageType PaintingArea::getTypeOfImageActiveLayer(){ return this->layerBundle[static_cast(activeLayer)].image->getTypeOfImage(); } -std::vector PaintingArea::getPolygonDataOfRealLayer(){ +std::vector PaintingArea::getPolygonDataOfActiveLayer(){ return this->layerBundle[static_cast(activeLayer)].image->getPolygonData(); } @@ -463,7 +463,7 @@ IntelliTool* PaintingArea::copyActiveTool(){ } } -int PaintingArea::getNumberOfActiveLayer(){ +int PaintingArea::getIndexOfActiveLayer(){ return activeLayer; } @@ -510,14 +510,18 @@ void PaintingArea::updateTools(){ void PaintingArea::historyadd(){ - if (++historyPresent == 100) { + historyPresent++; + if (historyPresent == 100) { historyPresent = 0; } historyMaxFuture = historyPresent; - if (historyPresent == historyMaxPast) - if (++historyMaxPast == 100) + if (historyPresent == historyMaxPast){ + historyMaxPast++; + if (historyMaxPast == 100){ historyMaxPast = 0; - history[static_cast(historyPresent)] = layerBundle; + } + } + history[static_cast(historyPresent)] = layerBundle; } void PaintingArea::historyGoBack(){ diff --git a/src/Layer/PaintingArea.h b/src/Layer/PaintingArea.h index 6aafff1..9dd6799 100644 --- a/src/Layer/PaintingArea.h +++ b/src/Layer/PaintingArea.h @@ -176,36 +176,91 @@ void colorPickerSetSecondColor(); */ void colorPickerSwapColors(); +/*! + * \brief createPenTool creates a Pen Tool. + */ void createPenTool(); + +/*! + * \brief createPlainTool creates a Plain Tool. + */ void createPlainTool(); + +/*! + * \brief createLineTool creates a Line Tool. + */ void createLineTool(); + +/*! + * \brief createRectangleTool creates a Rectangle Tool. + */ void createRectangleTool(); + +/*! + * \brief createCircleTool creates a Circle Tool. + */ void createCircleTool(); + +/*! + * \brief createPolygonTool creates a Polygon Tool. + */ void createPolygonTool(); + +/*! + * \brief createFloodFillTool creates a Floodfill Tool. + */ void createFloodFillTool(); + +/*! + * \brief createGradientTool creates a Gradient Tool. + */ void createGradientTool(); /*! - * \brief The getWidthOfActive gets the horizontal dimensions of the active layer - * \return Returns the horizontal pixle count of the active layer + * \brief The getWidthOfActive gets the horizontal dimensions of the active layer. + * \return Returns the horizontal pixle count of the active layer. */ int getWidthOfActive(); /*! - * \brief The getHeightOfActive gets the vertical dimensions of the active layer - * \return Returns the vertical pixle count of the active layer + * \brief The getHeightOfActive gets the vertical dimensions of the active layer. + * \return Returns the vertical pixle count of the active layer. */ int getHeightOfActive(); +/*! + * \brief getMaxWidth gets the max width of the Canvas. + * \return return the width of the Canvas. + */ int getMaxWidth(); +/*! + * \brief getMaxHeight gets the max height of the Canvas. + * \return return the height of the Canvas. + */ int getMaxHeight(); -ImageType getTypeOfImageRealLayer(); +/*! + * \brief getTypeOfImageActiveLayer get the type of the active Layer. + * \return returns the image type of the active layer. + */ +ImageType getTypeOfImageActiveLayer(); -std::vector getPolygonDataOfRealLayer(); +/*! + * \brief getPolygonDataOfActiveLayer get the polygon data of the active Layer. + * \return return the polygon data of the active Layer. + */ +std::vector getPolygonDataOfActiveLayer(); -int getNumberOfActiveLayer(); +/*! + * \brief getIndexOfActiveLayer returns the index of athe active Layer. + * \return return the index of the active Layer. + */ +int getIndexOfActiveLayer(); +/*! + * \brief getImageOfActiveLayer returns the image of the active Layer. + * \return return the image of the active Layer. + */ IntelliImage* getImageOfActiveLayer(); /*! @@ -220,16 +275,44 @@ QImage getImageDataOfActiveLayer(); */ std::vector* getLayerBundle(); +/*! + * \brief Toolsettings - a class to manage Tool settings. + */ IntelliToolsettings Toolsettings; + +/*! + * \brief colorPicker a class to manage Tool color. + */ IntelliColorPicker colorPicker; +/*! + * \brief historyGoBack a function to return the previous state of the project. + */ void historyGoBack(); + +/*! + * \brief historyGoForward a function to undo the return of the previous state of the project. + */ void historyGoForward(); -void setLayerDimensions(int maxWidth, int maxHeight); +/*! + * \brief setCanvasDimensions sets the dimension of the Canvas + * \param maxWidth - the width of the Canvas. + * \param maxHeight - the height of the Canvas. + */ +void setCanvasDimensions(int maxWidth, int maxHeight); -void setPixelToActive(QColor color, QPoint point); +/*! + * \brief drawPixelOntoActive draws a pixel onto the image data of the active Layer. + * \param color - the color of the Pixel, which should be created. + * \param point - the Pixelposition. + */ +void drawPixelOntoActive(QColor color, QPoint point); +/*! + * \brief setPolygonDataToActive sets polygondata to the active Layer. + * \param points - the points of the polygon data. + */ void setPolygonDataToActive(std::vector points); public slots: /*! diff --git a/src/Layer/PaintingArea.h.autosave b/src/Layer/PaintingArea.h.autosave new file mode 100644 index 0000000..41d98db --- /dev/null +++ b/src/Layer/PaintingArea.h.autosave @@ -0,0 +1,481 @@ + +#ifndef PaintingArea_H +#define PaintingArea_H + +#include +#include +#include +#include +#include +#include +#include "Image/IntelliImage.h" +#include "Image/IntelliRasterImage.h" +#include "Image/IntelliShapedImage.h" +#include "Tool/IntelliTool.h" +#include "IntelliHelper/IntelliColorPicker.h" + +//for unit testing +class UnitTest; +class IntelliPhotoGui; +/*! + * \brief The LayerObject struct holds all the information needed to construct a layer + */ +struct LayerObject { + /*! + * \brief image - Stores the imageData of the current LayerObject. + */ + IntelliImage* image; + /*! + * \brief width - Stores the width of a layer in pixels. + */ + int width; + /*! + * \brief height - Stores the height of a layer in pixels. + */ + int height; + /*! + * \brief widthOffset - Stores the number of pixles from the left side of the painting area. + */ + int widthOffset; + /*! + * \brief heightOffset - Stores the number of pixles from the top of the painting area. + */ + int heightOffset; + /*! + * \brief alpha - Stores the alpha value of the layer (default=255). + */ + int alpha = 255; + + LayerObject(); + + LayerObject(const LayerObject& layer); +}; + +/*! + * \brief The PaintingArea class manages the methods and stores information about the current painting area, which is the currently opened project + */ +class PaintingArea : public QLabel +{ +friend UnitTest; +// Declares our class as a QObject which is the base class +// for all Qt objects +// QObjects handle events +Q_OBJECT +friend IntelliTool; +friend IntelliPhotoGui; +public: +/*! + * \brief PaintingArea is the constructor of the PaintingArea class, which initiates the working environment + * \param maxWidth - The maximum amount of pixles that are inside painting area from left to right (default=600px) + * \param maxHeight - The maximum amount of pixles that are inside painting area from top to bottom (default=600px) + * \param parent - The parent window of the main window (default=nullptr) + */ +PaintingArea(int maxWidth = 600, int maxHeight = 600, QWidget*parent = nullptr); + +/*! + * \brief This deconstructor is used to clear up the memory and remove the currently active window + */ +~PaintingArea() override; + +/*! + * \brief setRenderSettings updates all Images to the new Rendersetting. + * \param isFastRenderingOn is the new given flag for the FastRenderer. + */ +void setRenderSettings(bool isFastRenderingOn); + +/*! + * \brief getRenderSettings updates all Images to the new Rendersetting. + * \param isFastRenderingOn is the new given flag for the FastRenderer. + */ +bool getRenderSettings(); + +/*! + * \brief The open method is used for loading a picture into the current layer. + * \param filePath - Path and Name which are used to determine where the to-be-opened file is stored. + * \return Returns a boolean variable whether the file was successfully opened or not. + */ +bool open(const QString &filePath); +/*! + * \brief The save method is used for exporting the current project as one picture + * \param filePath - Specifies the path and name of the file to create. + * \param fileFormat - Specifies the format of the file to create. + * \return Returns a boolean variable, true if the file was saved successfully, false if not + */ +bool save(const QString &filePath, const char*fileFormat); + +/*! + * \brief deleteAllLayers deletes all layers + */ +void deleteAllLayers(); +/*! + * \brief The addLayer adds a layer to the current project/ painting area + * \param width - Width of the layer in pixles + * \param height - Height of the layer in pixles + * \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles + * \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles + * \param alpha - Transparence of the layer + * \param type - Defining the ImageType of the new layer + * \return Returns the number of layers in the project + */ +int addLayer(int width, int height, int widthOffset = 0, int heightOffset = 0, int alpha = 255, ImageType type = ImageType::RASTERIMAGE); +/*! + * \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack + * \param idx - Index of the position the new layer should be added + * \param width - Width of the layer in pixles + * \param height - Height of the layer in pixles + * \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles + * \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles + * \param type - Defining the ImageType of the new layer + * \return Returns the id of the layer position + */ +int addLayerAt(int idx, int width, int height, int widthOffset = 0, int heightOffset = 0, ImageType type = ImageType::RASTERIMAGE); +/*! + * \brief The deleteLayer method removes a layer at a given idx + * \param idx - The index of the layer to be removed + * \param isTool - Is the flag for when a tool uses this function. + */ +void deleteLayer(int idx, bool isTool = false); +/*! + * \brief The setLayerToActive method marks a specific layer as active + * \param idx - The index of the layer to be active + */ +void setLayerActive(int idx); +/*! + * \brief The setAlphaOfLayer method sets the alpha value of a specific layer + * \param idx - The index of the layer where the change should be applied + * \param alpha - New alpha value of the layer + */ +void setLayerAlpha(int idx, int alpha); +/*! + * \brief setPolygon is used for setting polygondata, it only works on RASTER images + * \param idx - represents the number of the layer with should be transformed + */ +void setPolygon(int idx); +/*! + * \brief The movePositionActive method moves the active layer to certain position + * \param x - The x value the new center of the layer should be at + * \param y - The y value the new center of the layer should be at + */ +void movePositionActive(int x, int y); +/*! + * \brief The moveActiveLayer moves the active layer to a specific position in the layer stack + * \param idx - The index of the new position the layer should be in + */ +void moveActiveLayer(int idx); + +/*! + * \brief The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color + */ +void colorPickerSetFirstColor(); +/*! + * \brief The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color + */ +void colorPickerSetSecondColor(); +/*! + * \brief The colorPickerSwitchColor swaps the primary color with the secondary drawing color + */ +void colorPickerSwapColors(); + +/*! + * \brief createPenTool creates a Pen Tool. + */ +void createPenTool(); + +/*! + * \brief createPlainTool creates a Plain Tool. + */ +void createPlainTool(); + +/*! + * \brief createLineTool creates a Line Tool. + */ +void createLineTool(); + +/*! + * \brief createRectangleTool creates a Rectangle Tool. + */ +void createRectangleTool(); + +/*! + * \brief createCircleTool creates a Circle Tool. + */ +void createCircleTool(); + +/*! + * \brief createPolygonTool creates a Polygon Tool. + */ +void createPolygonTool(); + +/*! + * \brief createFloodFillTool creates a Floodfill Tool. + */ +void createFloodFillTool(); + +/*! + * \brief createGradientTool creates a Gradient Tool. + */ +void createGradientTool(); + +/*! + * \brief The getWidthOfActive gets the horizontal dimensions of the active layer. + * \return Returns the horizontal pixle count of the active layer. + */ +int getWidthOfActive(); +/*! + * \brief The getHeightOfActive gets the vertical dimensions of the active layer. + * \return Returns the vertical pixle count of the active layer. + */ +int getHeightOfActive(); + +/*! + * \brief getMaxWidth gets the max width of the Canvas. + * \return return the width of the Canvas. + */ +int getMaxWidth(); + +/*! + * \brief getMaxHeight gets the max height of the Canvas. + * \return return the height of the Canvas. + */ +int getMaxHeight(); + +/*! + * \brief getTypeOfImageActiveLayer get the type of the active Layer. + * \return returns the image type of the active layer. + */ +ImageType getTypeOfImageActiveLayer(); + +/*! + * \brief getPolygonDataOfActiveLayer get the polygon data of the active Layer. + * \return return the polygon data of the active Layer. + */ +std::vector getPolygonDataOfActiveLayer(); + +/*! + * \brief getIndexOfActiveLayer returns the index of athe active Layer. + * \return return the index of the active Layer. + */ +int getIndexOfActiveLayer(); + +/*! + * \brief getImageOfActiveLayer returns the image of the active Layer. + * \return return the image of the active Layer. + */ +IntelliImage* getImageOfActiveLayer(); + +/*! + * \brief getImageDataOfActiveLayer used to get the currents active imageData (if there isn't any active layer it return a 10*10 white picture) + * \return return the image as an rgba32bit qImage + */ +QImage getImageDataOfActiveLayer(); + +/*! + * \brief getLayerBundle returns the real active layerbundle (care!) + * \return the reference of the currentLayerBundle + */ +std::vector* getLayerBundle(); + +/*! + * \brief Toolsettings - a class to manage Tool settings. + */ +IntelliToolsettings Toolsettings; + +/*! + * \brief colorPicker a class to manage Tool color. + */ +IntelliColorPicker colorPicker; + +/*! + * \brief historyGoBack a function to return the previous state of the project. + */ +void historyGoBack(); + +/*! + * \brief historyGoForward a function to undo the return of the previous state of the project. + */ +void historyGoForward(); + +/*! + * \brief setCanvasDimensions sets the dimension of the Canvas + * \param maxWidth - the width of the Canvas. + * \param maxHeight - the height of the Canvas. + */ +void setCanvasDimensions(int maxWidth, int maxHeight); + +/*! + * \brief drawPixelOntoActive draws a pixel onto the image data of the active Layer. + * \param color - the color of the Pixel, which should be created. + * \param point - the Pixelposition. + */ +void drawPixelOntoActive(QColor color, QPoint point); + +/*! + * \brief setPolygonDataToActive sets polygondata to the active Layer. + * \param points - the points of the polygon data. + */ +void setPolygonDataToActive(std::vector points); +public slots: +/*! + * \brief The slotActivateLayer method handles the event of selecting one layer as active + * \param a - idx of the layer to be active + */ +void slotActivateLayer(int a); +/*! + * \brief The slotDeleteActiveLayer method handles the deletion of the active layer + */ +void slotDeleteActiveLayer(); + +protected: +/*! + * \brief mousePressEvent handles a mouse pressed event. + * \param event - the specific mouse event. + */ +void mousePressEvent(QMouseEvent*event) override; + +/*! + * \brief mouseMoveEvent handles a mouse moved event + * \param event - the specific mouse event. + */ +void mouseMoveEvent(QMouseEvent*event) override; + +/*! + * \brief mouseReleaseEvent handles a mouse released event + * \param event - the specific mouse event. + */ +void mouseReleaseEvent(QMouseEvent*event) override; + +/*! + * \brief wheelEvent handles a mouse wheel event + * \param event - the specific mouse event. + */ +void wheelEvent(QWheelEvent*event) override; + +/*! + * \brief paintEvent handles a painting event + * \param event - the specific paint event. + */ +void paintEvent(QPaintEvent*event) override; + +private: +/*! + * \brief offsetXDimension - Offset for drawing the image. + */ +int offsetXDimension; + +/*! + * \brief offsetYDimension - Offset for drawing the image. + */ +int offsetYDimension; + +/*! + * \brief selectLayerUp moves the active Layer one Up. + */ +void selectLayerUp(); + +/*! + * \brief selectLayerDown moves the active Layer one Down. + */ +void selectLayerDown(); + +/*! + * \brief copyActiveTool copys the activ tool [allocated]. + * \return returns a allocates copy of the current tool. + */ +IntelliTool* copyActiveTool(); + +/*! + * \brief Canvas the underlying Image to display on. + */ +QImage* Canvas; + +/*! + * \brief ScaledCanvas the Canvas saved for output + */ +QImage ScaledCanvas; + +/*! + * \brief maxWidth is the width of the canvas + */ +int maxWidth; + +/*! + * \brief maxHeight is the height of the canvas + */ +int maxHeight; + +/*! + * \brief isSettingPolygon for checking the state of the drawing. + */ +bool isSettingPolygon = false; + +/*! + * \brief renderSettings a class to manage the render settings. + */ +IntelliRenderSettings renderSettings; + +/*! + * \brief Tool a class to manage the Tool. + */ +IntelliTool* Tool; + +/*! + * \brief guiReference to manage communication with the gui. + */ +IntelliPhotoGui* guiReference; + +/*! + * \brief layerBundle a container to save all layers. + */ +std::vector layerBundle; + +/*! + * \brief activeLayer the index of the active Layer. + */ +int activeLayer = -1; + +/*! + * \brief drawLayers draws the Layers to the Canvas + * \param forSaving an indecate if drawing for saving. + */ +void drawLayers(bool forSaving = false); + +/*! + * \brief createTempTopLayer creates a temporary Layer on top of the Layer. + * \param idx - the Layer which should get a temp Layer. + * \return True if it workes, false otherwise. + */ +bool createTempTopLayer(int idx); + +/*! + * \brief updateTools resets the Tools. + */ +void updateTools(); + +/*! + * \brief history - an array out of containers to save history actions. + */ +std::vector history[100] = {layerBundle}; + +/*! + * \brief historyMaxPast a indicator how many steps you can go into the past. + */ +int historyMaxPast = 0; + +/*! + * \brief historyMaxPast a indicator how many steps you can go into the future. + */ +int historyMaxFuture = 0; + +/*! + * \brief historyPresent a indicator where the present is. + */ +int historyPresent = 0; + +/*! + * \brief historyadd adds an past version to the history + */ +void historyadd(); + +}; + +#endif diff --git a/src/Tool/IntelliTool.h b/src/Tool/IntelliTool.h index 40901f0..07abb46 100644 --- a/src/Tool/IntelliTool.h +++ b/src/Tool/IntelliTool.h @@ -17,9 +17,13 @@ class PaintingArea; class IntelliTool { friend UnitTest; public: +/*! + * \brief The Tooltype enum categorising the toosl. + */ enum class Tooltype { CIRCLE, FLOODFILL, + GRADIENT, LINE, PEN, PLAIN, @@ -49,6 +53,9 @@ protected: */ PaintingArea* Area; +/*! + * \brief ActiveType the type of the active tool. + */ Tooltype ActiveType; /*! @@ -56,6 +63,9 @@ Tooltype ActiveType; */ IntelliColorPicker* colorPicker; +/*! + * \brief Toolsettings a refrence to the tool settings + */ IntelliToolsettings* Toolsettings; /*! @@ -127,8 +137,16 @@ virtual void onWheelScrolled(int value); */ virtual void onMouseMoved(int x, int y); +/*! + * \brief getTooltype returns the tools type + * \return returns the tool type of the current tool. + */ Tooltype getTooltype() const; +/*! + * \brief getIsDrawing returns if the tool is currently drawing + * \return returns if the tool is currently drawing + */ bool getIsDrawing() const; }; diff --git a/src/Tool/IntelliToolGradient.cpp b/src/Tool/IntelliToolGradient.cpp index 8f33fb4..25cb503 100644 --- a/src/Tool/IntelliToolGradient.cpp +++ b/src/Tool/IntelliToolGradient.cpp @@ -5,6 +5,7 @@ IntelliToolGradient::IntelliToolGradient(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) : IntelliTool(Area, colorPicker, Toolsettings){ + this->ActiveType = Tooltype::GRADIENT; this->LineColor = QColor(0,0,0,255); this->hasMoved = false; } diff --git a/src/Tool/IntelliToolGradient.cpp.autosave b/src/Tool/IntelliToolGradient.cpp.autosave new file mode 100644 index 0000000..eb90ea9 --- /dev/null +++ b/src/Tool/IntelliToolGradient.cpp.autosave @@ -0,0 +1,131 @@ +#include "IntelliToolGradient.h" +#include "Layer/PaintingArea.h" +#include "math.h" +#include + +IntelliToolGradient::IntelliToolGradient(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) + : IntelliTool(Area, colorPicker, Toolsettings){ + this->ActiveType = Tooltype::GRADIENT; + this->LineColor = QColor(0,0,0,255); + this->hasMoved = false; +} + +IntelliToolGradient::~IntelliToolGradient(){ + IntelliTool::onMouseRightPressed(0,0); +} + +void IntelliToolGradient::onMouseLeftPressed(int x, int y){ + IntelliTool::onMouseLeftPressed(x,y); + startPoint_double[0] = static_cast(x); + startPoint_double[1] = static_cast(y); + startPoint = QPoint(x,y); + endPoint = QPoint(x,y); + endPoint_double[0] = 0; + endPoint_double[1] = 0; + Canvas->image->drawPixel(startPoint,LineColor); +} + +void IntelliToolGradient::onMouseRightPressed(int x, int y){ + IntelliTool::onMouseRightPressed(x,y); +} + +void IntelliToolGradient::onMouseLeftReleased(int x, int y){ + if(hasMoved && this->isDrawing){ + computeGradientLayer(); + IntelliTool::onMouseLeftReleased(x,y); + } +} + +void IntelliToolGradient::onMouseRightReleased(int x, int y){ + IntelliTool::onMouseRightReleased(x,y); +} + +void IntelliToolGradient::onMouseMoved(int x, int y){ + if(this->isDrawing){ + hasMoved = true; + endPoint = QPoint(x,y); + endPoint_double[0] = static_cast(endPoint.x() - startPoint.x()); + endPoint_double[1] = static_cast(endPoint.y() - startPoint.y()); + NormalVector[0] = endPoint_double[1]; + NormalVector[1] = (-1*endPoint_double[0]); + NormalDotNormal = dotProduct(NormalVector,NormalVector); + this->Canvas->image->drawPlain(Qt::transparent); + computeGradientLayer(); + Canvas->image->drawLine(startPoint,endPoint,LineColor,1); + } + IntelliTool::onMouseMoved(x,y); +} + +void IntelliToolGradient::onWheelScrolled(int value){ + IntelliTool::onWheelScrolled(value); +} + +void IntelliToolGradient::computeAndDrawPixelColor(QPoint Point){ + double doublePoint[2]; + doublePoint[0] = static_cast(Point.x()); + doublePoint[1] = static_cast(Point.y()); + double doublePointSubA[2]; + doublePointSubA[0] = doublePoint[0] - startPoint_double[0]; + doublePointSubA[1] = doublePoint[1] - startPoint_double[1]; + double Perpendicular[2]; + double PointSubADotNormal = dotProduct(doublePointSubA,NormalVector); + Perpendicular[0] = doublePoint[0] - (PointSubADotNormal / NormalDotNormal) * NormalVector[0]; + Perpendicular[1] = doublePoint[1] - (PointSubADotNormal / NormalDotNormal) * NormalVector[1]; + double VectorAPoint[2]; + VectorAPoint[0] = static_cast(Perpendicular[0] - startPoint_double[0]); + VectorAPoint[1] = static_cast(Perpendicular[1] - startPoint_double[1]); + double ratio; + if(((VectorAPoint[0] < 0 && endPoint_double[0] < 0) || (VectorAPoint[0] > 0 && endPoint_double[0] > 0)) && ((VectorAPoint[1] < 0 && endPoint_double[1] < 0) || (VectorAPoint[1] > 0 && endPoint_double[1] > 0))) + ratio = lenghtVector(VectorAPoint)/lenghtVector(endPoint_double); + else{ + ratio = -1; + } + QColor computedColor; + if(ratio < 0){ + computedColor = colorPicker->getFirstColor(); + } + else if(ratio > 1){ + computedColor = colorPicker->getSecondColor(); + } + else{ + int red; + int green; + int blue; + int alpha; + int red2; + int green2; + int blue2; + int alpha2; + colorPicker->getFirstColor().getRgb(&red,&green,&blue,&alpha); + colorPicker->getSecondColor().getRgb(&red2,&green2,&blue2,&alpha2); + computedColor.setRed(static_cast(ratio * red2 + (1 - ratio) * red)); + computedColor.setGreen(static_cast(ratio * green2 + (1 - ratio) * green)); + computedColor.setBlue(static_cast(ratio * blue2 + (1 - ratio) * blue)); + computedColor.setAlpha(static_cast(ratio * alpha2 + (1 - ratio) * alpha)); + } + Canvas->image->drawPixel(Point,computedColor); +} + +double IntelliToolGradient::dotProduct(double Vector1[2], double Vector2[2]){ + return static_cast(Vector1[0]*Vector2[0]+Vector1[1]*Vector2[1]); +} + +double IntelliToolGradient::lenghtVector(double Vector[2]){ + return static_cast((sqrt(Vector[0] * Vector[0] + Vector[1] * Vector[1]))); +} + +void IntelliToolGradient::computeGradientLayer(){ + bool switched = false; + if(Canvas->image->isFastRendering()){ + switched = true; + Canvas->image->updateRendererSetting(false); + } + for(int i = 0; i < activeLayer->height; i++){ + for(int j = 0; j < activeLayer->width; j++){ + computeAndDrawPixelColor(QPoint(j,i)); + } + } + if(switched){ + Canvas->image->updateRendererSetting(true); + } +} diff --git a/src/Tool/IntelliToolGradient.h b/src/Tool/IntelliToolGradient.h index 01b0159..caf9b81 100644 --- a/src/Tool/IntelliToolGradient.h +++ b/src/Tool/IntelliToolGradient.h @@ -1,12 +1,23 @@ #ifndef INTELLITOOLGRADIENT_H #define INTELLITOOLGRADIENT_H #include "IntelliTool.h" - +/*! + * \brief The IntelliToolGradient class that represents a gradient call + */ class IntelliToolGradient : public IntelliTool{ public: + /*! + * \brief IntelliToolGradient basic constructor of the gradient tool. + * \param Area - a reference to the paintingArea + * \param colorPicker - a reference to the colorpicker + * \param Toolsettings - a regerence to the Toolsettings + */ IntelliToolGradient(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings); + /*! + * \brief ~IntelliToolGradient basic destructor. + */ virtual ~IntelliToolGradient() override; /*! @@ -51,21 +62,70 @@ public: virtual void onMouseMoved(int x, int y) override; private: - QPoint A; - QPoint B; - double doubleA[2]; - double VectorAB[2]; + + /*! + * \brief startPoint of the line + */ + QPoint startPoint; + + /*! + * \brief endPoint of the line + */ + QPoint endPoint; + /*! + * \brief doubleStartPoint startPoint as double Values + */ + double doubleStartPoint[2]; + + /*! + * \brief VectorStartEnd a vector between start and end point. + */ + double VectorStartEnd[2]; + + /*! + * \brief NormalVector of the VectorStartEnd + */ double NormalVector[2]; + + /*! + * \brief NormalDotNormal dot product of Normal*Normal + */ double NormalDotNormal; + + /*! + * \brief LineColor color of th line. + */ QColor LineColor; + + /*! + * \brief hasMoved indicates a movement + */ bool hasMoved; - void computePixelColor(QPoint Point); + /*! + * \brief computeAndDrawPixelColor computes the pixelcolor for a given point and sets it to the image. + * \param Point the point which shoud be computed + */ + void computeAndDrawPixelColor(QPoint Point); + /*! + * \brief dotProduct calculates the dot product of 2 vetors. + * \param Vector1 - first argument + * \param Vector2 - second argument + * \return returns the dot product. + */ double dotProduct(double Vector1[2], double Vector2[2]); + /*! + * \brief lenghtVector returns the length of a vector + * \param Vector - Vector to calculate the length + * \return returns the length of the vector + */ double lenghtVector(double Vector[2]); + /*! + * \brief computeGradientLayer computes the gradient over all pixels in the image. + */ void computeGradientLayer(); }; diff --git a/src/Tool/IntelliToolPolygon.cpp b/src/Tool/IntelliToolPolygon.cpp index 3efd0d5..b6d8b4e 100644 --- a/src/Tool/IntelliToolPolygon.cpp +++ b/src/Tool/IntelliToolPolygon.cpp @@ -24,9 +24,9 @@ IntelliToolPolygon::~IntelliToolPolygon(){ } void IntelliToolPolygon::onMouseLeftPressed(int x, int y){ - if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == ImageType::SHAPEDIMAGE && x > 0 && y > 0 && xgetWidthOfActive() && ygetHeightOfActive()) { - if(Area->getPolygonDataOfRealLayer().size()>2) { - std::vector Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer()); + if(!drawingOfPolygon && Area->getTypeOfImageActiveLayer() == ImageType::SHAPEDIMAGE && x > 0 && y > 0 && xgetWidthOfActive() && ygetHeightOfActive()) { + if(Area->getPolygonDataOfActiveLayer().size()>2) { + std::vector Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfActiveLayer()); QPoint Point(x,y); isInside = IntelliTriangulation::isInPolygon(Triangles,Point); } @@ -37,7 +37,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){ isInside = true; } } - else if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == ImageType::RASTERIMAGE && x >= 0 && y >= 0 && xgetWidthOfActive() && ygetHeightOfActive()) { + else if(!drawingOfPolygon && Area->getTypeOfImageActiveLayer() == ImageType::RASTERIMAGE && x >= 0 && y >= 0 && xgetWidthOfActive() && ygetHeightOfActive()) { isInside = true; } From 2dd527ca27719e1c9b278f509c0164257af80b14 Mon Sep 17 00:00:00 2001 From: Sonaion Date: Tue, 28 Jan 2020 10:42:32 +0100 Subject: [PATCH 04/24] added more comments --- src/IntelliHelper/IntelliRenderSettings.h | 7 +- .../IntelliRenderSettings.h.autosave | 34 -- src/IntelliHelper/IntelliToolsettings.h | 37 +- .../IntelliToolsettings.h.autosave | 59 --- src/Layer/PaintingArea.h | 108 +++- src/Layer/PaintingArea.h.autosave | 481 ------------------ src/Tool/IntelliToolGradient.cpp | 42 +- src/Tool/IntelliToolGradient.cpp.autosave | 131 ----- 8 files changed, 170 insertions(+), 729 deletions(-) delete mode 100644 src/IntelliHelper/IntelliRenderSettings.h.autosave delete mode 100644 src/IntelliHelper/IntelliToolsettings.h.autosave delete mode 100644 src/Layer/PaintingArea.h.autosave delete mode 100644 src/Tool/IntelliToolGradient.cpp.autosave diff --git a/src/IntelliHelper/IntelliRenderSettings.h b/src/IntelliHelper/IntelliRenderSettings.h index 296c186..2fc3afb 100644 --- a/src/IntelliHelper/IntelliRenderSettings.h +++ b/src/IntelliHelper/IntelliRenderSettings.h @@ -4,7 +4,9 @@ //for unit testing class UnitTest; - +/*! + * \brief The IntelliRenderSettings class which manages the render Settings. + */ class IntelliRenderSettings { friend UnitTest; @@ -23,6 +25,9 @@ void setFastRendering(bool Updatedsetting); bool isFastRenderering() const; private: +/*! + * \brief fastRenderering the state of the project, in relation the the render setting. + */ bool fastRenderering = true; }; diff --git a/src/IntelliHelper/IntelliRenderSettings.h.autosave b/src/IntelliHelper/IntelliRenderSettings.h.autosave deleted file mode 100644 index 2fc3afb..0000000 --- a/src/IntelliHelper/IntelliRenderSettings.h.autosave +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef INTELLIRENDERSETTINGS_H -#define INTELLIRENDERSETTINGS_H - -//for unit testing -class UnitTest; - -/*! - * \brief The IntelliRenderSettings class which manages the render Settings. - */ -class IntelliRenderSettings -{ -friend UnitTest; -public: -IntelliRenderSettings(); - -/*! - * \brief setFastRendering sets fastRendering to Updatedsetting. - * \param Updatedsetting - Represents the new value for the Fast Rendering Flag. - */ -void setFastRendering(bool Updatedsetting); -/*! - * \brief The getfastRenderer gets the value of the flag for the fastRenderer setting. - * \return Returns true if fastRenderer is active else false - */ -bool isFastRenderering() const; - -private: -/*! - * \brief fastRenderering the state of the project, in relation the the render setting. - */ -bool fastRenderering = true; -}; - -#endif diff --git a/src/IntelliHelper/IntelliToolsettings.h b/src/IntelliHelper/IntelliToolsettings.h index c2fd2bb..3ad9705 100644 --- a/src/IntelliHelper/IntelliToolsettings.h +++ b/src/IntelliHelper/IntelliToolsettings.h @@ -3,21 +3,56 @@ //for unit testing class UnitTest; - +/*! + * \brief The IntelliToolsettings class managing the settings of the tools, independent of an existing tool. + */ class IntelliToolsettings { friend UnitTest; public: +/*! + * \brief IntelliToolsettings - basic constructor of the IntelliToolsettings, initializing the basics. + */ IntelliToolsettings(); + +/*! + * \brief ~IntelliToolsettings - basic destructor. + */ virtual ~IntelliToolsettings(); +/*! + * \brief getLineWidth returns the width attribute of the line. + * \return returns the width attribute as integer. + */ int getLineWidth() const; + +/*! + * \brief setLineWidth sets the width attribute of the line. + * \param LineWidth - the future width of the line + */ void setLineWidth(int LineWidth); +/*! + * \brief getInnerAlpha returns the inner alpha value. + * \return returns the inner alpha attribute as integer. + */ int getInnerAlpha() const; + +/*! + * \brief setInnerAlpha sets the inner alpha attribute of the Tool. + * \param innerAlpha - the future inner alpha of the Tool. + */ void setInnerAlpha(int innerAlpha); private: + +/*! + * \brief lineWidth attribute of a Tool. + */ int lineWidth; + +/*! + * \brief innerAlpha aattribute of a Tool. + */ int innerAlpha; }; diff --git a/src/IntelliHelper/IntelliToolsettings.h.autosave b/src/IntelliHelper/IntelliToolsettings.h.autosave deleted file mode 100644 index b251aa9..0000000 --- a/src/IntelliHelper/IntelliToolsettings.h.autosave +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef INTELLITOOLSETTINGS_H -#define INTELLITOOLSETTINGS_H - -//for unit testing -class UnitTest; -/*! - * \brief The IntelliToolsettings class managing the settings of the tools, independent of an existing tool. - */ -class IntelliToolsettings { -friend UnitTest; -public: -/*! - * \brief IntelliToolsettings - basic constructor of the IntelliToolsettings, initializing the basics. - */ -IntelliToolsettings(); - -/*! - * \brief ~IntelliToolsettings - basic destructor. - */ -virtual ~IntelliToolsettings(); - -/*! - * \brief getLineWidth returns the width attribute of the line. - * \return returns the width attribute as integer. - */ -int getLineWidth() const; - -/*! - * \brief setLineWidth sets the width attribute of the line. - * \param LineWidth - the future width of the line - */ -void setLineWidth(int LineWidth); - -/*! - * \brief getInnerAlpha returns the inner alpha value. - * \return returns the inner alpha attribute as integer. - */ -int getInnerAlpha() const; - -/*! - * \brief setInnerAlpha sets the inner alpha attribute of the Tool. - * \param innerAlpha - the future inner alpha of the Tool. - */ -void setInnerAlpha(int innerAlpha); - -private: - -/*! - * \brief lineWidth attribute of a Tool. - */ -int lineWidth; - -/*! - * \brief innerAlpha aattribute of a Tool. - */ -int innerAlpha; -}; - -#endif diff --git a/src/Layer/PaintingArea.h b/src/Layer/PaintingArea.h index 9dd6799..aa221ef 100644 --- a/src/Layer/PaintingArea.h +++ b/src/Layer/PaintingArea.h @@ -326,48 +326,154 @@ void slotActivateLayer(int a); void slotDeleteActiveLayer(); protected: +/*! + * \brief mousePressEvent handles a mouse pressed event. + * \param event - the specific mouse event. + */ void mousePressEvent(QMouseEvent*event) override; + +/*! + * \brief mouseMoveEvent handles a mouse moved event + * \param event - the specific mouse event. + */ void mouseMoveEvent(QMouseEvent*event) override; + +/*! + * \brief mouseReleaseEvent handles a mouse released event + * \param event - the specific mouse event. + */ void mouseReleaseEvent(QMouseEvent*event) override; +/*! + * \brief wheelEvent handles a mouse wheel event + * \param event - the specific mouse event. + */ void wheelEvent(QWheelEvent*event) override; +/*! + * \brief paintEvent handles a painting event + * \param event - the specific paint event. + */ void paintEvent(QPaintEvent*event) override; private: -//offset for the displayable +/*! + * \brief offsetXDimension - Offset for drawing the image. + */ int offsetXDimension; + +/*! + * \brief offsetYDimension - Offset for drawing the image. + */ int offsetYDimension; +/*! + * \brief selectLayerUp moves the active Layer one Up. + */ void selectLayerUp(); + +/*! + * \brief selectLayerDown moves the active Layer one Down. + */ void selectLayerDown(); + +/*! + * \brief copyActiveTool copys the activ tool [allocated]. + * \return returns a allocates copy of the current tool. + */ IntelliTool* copyActiveTool(); +/*! + * \brief Canvas the underlying Image to display on. + */ QImage* Canvas; + +/*! + * \brief ScaledCanvas the Canvas saved for output + */ QImage ScaledCanvas; + +/*! + * \brief maxWidth is the width of the canvas + */ int maxWidth; + +/*! + * \brief maxHeight is the height of the canvas + */ int maxHeight; +/*! + * \brief isSettingPolygon for checking the state of the drawing. + */ bool isSettingPolygon = false; +/*! + * \brief renderSettings a class to manage the render settings. + */ IntelliRenderSettings renderSettings; + +/*! + * \brief Tool a class to manage the Tool. + */ IntelliTool* Tool; + +/*! + * \brief guiReference to manage communication with the gui. + */ IntelliPhotoGui* guiReference; +/*! + * \brief layerBundle a container to save all layers. + */ std::vector layerBundle; + +/*! + * \brief activeLayer the index of the active Layer. + */ int activeLayer = -1; +/*! + * \brief drawLayers draws the Layers to the Canvas + * \param forSaving an indecate if drawing for saving. + */ void drawLayers(bool forSaving = false); +/*! + * \brief createTempTopLayer creates a temporary Layer on top of the Layer. + * \param idx - the Layer which should get a temp Layer. + * \return True if it workes, false otherwise. + */ bool createTempTopLayer(int idx); +/*! + * \brief updateTools resets the Tools. + */ void updateTools(); +/*! + * \brief history - an array out of containers to save history actions. + */ std::vector history[100] = {layerBundle}; + +/*! + * \brief historyMaxPast a indicator how many steps you can go into the past. + */ int historyMaxPast = 0; + +/*! + * \brief historyMaxPast a indicator how many steps you can go into the future. + */ int historyMaxFuture = 0; + +/*! + * \brief historyPresent a indicator where the present is. + */ int historyPresent = 0; +/*! + * \brief historyadd adds an past version to the history + */ void historyadd(); }; diff --git a/src/Layer/PaintingArea.h.autosave b/src/Layer/PaintingArea.h.autosave deleted file mode 100644 index 41d98db..0000000 --- a/src/Layer/PaintingArea.h.autosave +++ /dev/null @@ -1,481 +0,0 @@ - -#ifndef PaintingArea_H -#define PaintingArea_H - -#include -#include -#include -#include -#include -#include -#include "Image/IntelliImage.h" -#include "Image/IntelliRasterImage.h" -#include "Image/IntelliShapedImage.h" -#include "Tool/IntelliTool.h" -#include "IntelliHelper/IntelliColorPicker.h" - -//for unit testing -class UnitTest; -class IntelliPhotoGui; -/*! - * \brief The LayerObject struct holds all the information needed to construct a layer - */ -struct LayerObject { - /*! - * \brief image - Stores the imageData of the current LayerObject. - */ - IntelliImage* image; - /*! - * \brief width - Stores the width of a layer in pixels. - */ - int width; - /*! - * \brief height - Stores the height of a layer in pixels. - */ - int height; - /*! - * \brief widthOffset - Stores the number of pixles from the left side of the painting area. - */ - int widthOffset; - /*! - * \brief heightOffset - Stores the number of pixles from the top of the painting area. - */ - int heightOffset; - /*! - * \brief alpha - Stores the alpha value of the layer (default=255). - */ - int alpha = 255; - - LayerObject(); - - LayerObject(const LayerObject& layer); -}; - -/*! - * \brief The PaintingArea class manages the methods and stores information about the current painting area, which is the currently opened project - */ -class PaintingArea : public QLabel -{ -friend UnitTest; -// Declares our class as a QObject which is the base class -// for all Qt objects -// QObjects handle events -Q_OBJECT -friend IntelliTool; -friend IntelliPhotoGui; -public: -/*! - * \brief PaintingArea is the constructor of the PaintingArea class, which initiates the working environment - * \param maxWidth - The maximum amount of pixles that are inside painting area from left to right (default=600px) - * \param maxHeight - The maximum amount of pixles that are inside painting area from top to bottom (default=600px) - * \param parent - The parent window of the main window (default=nullptr) - */ -PaintingArea(int maxWidth = 600, int maxHeight = 600, QWidget*parent = nullptr); - -/*! - * \brief This deconstructor is used to clear up the memory and remove the currently active window - */ -~PaintingArea() override; - -/*! - * \brief setRenderSettings updates all Images to the new Rendersetting. - * \param isFastRenderingOn is the new given flag for the FastRenderer. - */ -void setRenderSettings(bool isFastRenderingOn); - -/*! - * \brief getRenderSettings updates all Images to the new Rendersetting. - * \param isFastRenderingOn is the new given flag for the FastRenderer. - */ -bool getRenderSettings(); - -/*! - * \brief The open method is used for loading a picture into the current layer. - * \param filePath - Path and Name which are used to determine where the to-be-opened file is stored. - * \return Returns a boolean variable whether the file was successfully opened or not. - */ -bool open(const QString &filePath); -/*! - * \brief The save method is used for exporting the current project as one picture - * \param filePath - Specifies the path and name of the file to create. - * \param fileFormat - Specifies the format of the file to create. - * \return Returns a boolean variable, true if the file was saved successfully, false if not - */ -bool save(const QString &filePath, const char*fileFormat); - -/*! - * \brief deleteAllLayers deletes all layers - */ -void deleteAllLayers(); -/*! - * \brief The addLayer adds a layer to the current project/ painting area - * \param width - Width of the layer in pixles - * \param height - Height of the layer in pixles - * \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles - * \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles - * \param alpha - Transparence of the layer - * \param type - Defining the ImageType of the new layer - * \return Returns the number of layers in the project - */ -int addLayer(int width, int height, int widthOffset = 0, int heightOffset = 0, int alpha = 255, ImageType type = ImageType::RASTERIMAGE); -/*! - * \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack - * \param idx - Index of the position the new layer should be added - * \param width - Width of the layer in pixles - * \param height - Height of the layer in pixles - * \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles - * \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles - * \param type - Defining the ImageType of the new layer - * \return Returns the id of the layer position - */ -int addLayerAt(int idx, int width, int height, int widthOffset = 0, int heightOffset = 0, ImageType type = ImageType::RASTERIMAGE); -/*! - * \brief The deleteLayer method removes a layer at a given idx - * \param idx - The index of the layer to be removed - * \param isTool - Is the flag for when a tool uses this function. - */ -void deleteLayer(int idx, bool isTool = false); -/*! - * \brief The setLayerToActive method marks a specific layer as active - * \param idx - The index of the layer to be active - */ -void setLayerActive(int idx); -/*! - * \brief The setAlphaOfLayer method sets the alpha value of a specific layer - * \param idx - The index of the layer where the change should be applied - * \param alpha - New alpha value of the layer - */ -void setLayerAlpha(int idx, int alpha); -/*! - * \brief setPolygon is used for setting polygondata, it only works on RASTER images - * \param idx - represents the number of the layer with should be transformed - */ -void setPolygon(int idx); -/*! - * \brief The movePositionActive method moves the active layer to certain position - * \param x - The x value the new center of the layer should be at - * \param y - The y value the new center of the layer should be at - */ -void movePositionActive(int x, int y); -/*! - * \brief The moveActiveLayer moves the active layer to a specific position in the layer stack - * \param idx - The index of the new position the layer should be in - */ -void moveActiveLayer(int idx); - -/*! - * \brief The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color - */ -void colorPickerSetFirstColor(); -/*! - * \brief The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color - */ -void colorPickerSetSecondColor(); -/*! - * \brief The colorPickerSwitchColor swaps the primary color with the secondary drawing color - */ -void colorPickerSwapColors(); - -/*! - * \brief createPenTool creates a Pen Tool. - */ -void createPenTool(); - -/*! - * \brief createPlainTool creates a Plain Tool. - */ -void createPlainTool(); - -/*! - * \brief createLineTool creates a Line Tool. - */ -void createLineTool(); - -/*! - * \brief createRectangleTool creates a Rectangle Tool. - */ -void createRectangleTool(); - -/*! - * \brief createCircleTool creates a Circle Tool. - */ -void createCircleTool(); - -/*! - * \brief createPolygonTool creates a Polygon Tool. - */ -void createPolygonTool(); - -/*! - * \brief createFloodFillTool creates a Floodfill Tool. - */ -void createFloodFillTool(); - -/*! - * \brief createGradientTool creates a Gradient Tool. - */ -void createGradientTool(); - -/*! - * \brief The getWidthOfActive gets the horizontal dimensions of the active layer. - * \return Returns the horizontal pixle count of the active layer. - */ -int getWidthOfActive(); -/*! - * \brief The getHeightOfActive gets the vertical dimensions of the active layer. - * \return Returns the vertical pixle count of the active layer. - */ -int getHeightOfActive(); - -/*! - * \brief getMaxWidth gets the max width of the Canvas. - * \return return the width of the Canvas. - */ -int getMaxWidth(); - -/*! - * \brief getMaxHeight gets the max height of the Canvas. - * \return return the height of the Canvas. - */ -int getMaxHeight(); - -/*! - * \brief getTypeOfImageActiveLayer get the type of the active Layer. - * \return returns the image type of the active layer. - */ -ImageType getTypeOfImageActiveLayer(); - -/*! - * \brief getPolygonDataOfActiveLayer get the polygon data of the active Layer. - * \return return the polygon data of the active Layer. - */ -std::vector getPolygonDataOfActiveLayer(); - -/*! - * \brief getIndexOfActiveLayer returns the index of athe active Layer. - * \return return the index of the active Layer. - */ -int getIndexOfActiveLayer(); - -/*! - * \brief getImageOfActiveLayer returns the image of the active Layer. - * \return return the image of the active Layer. - */ -IntelliImage* getImageOfActiveLayer(); - -/*! - * \brief getImageDataOfActiveLayer used to get the currents active imageData (if there isn't any active layer it return a 10*10 white picture) - * \return return the image as an rgba32bit qImage - */ -QImage getImageDataOfActiveLayer(); - -/*! - * \brief getLayerBundle returns the real active layerbundle (care!) - * \return the reference of the currentLayerBundle - */ -std::vector* getLayerBundle(); - -/*! - * \brief Toolsettings - a class to manage Tool settings. - */ -IntelliToolsettings Toolsettings; - -/*! - * \brief colorPicker a class to manage Tool color. - */ -IntelliColorPicker colorPicker; - -/*! - * \brief historyGoBack a function to return the previous state of the project. - */ -void historyGoBack(); - -/*! - * \brief historyGoForward a function to undo the return of the previous state of the project. - */ -void historyGoForward(); - -/*! - * \brief setCanvasDimensions sets the dimension of the Canvas - * \param maxWidth - the width of the Canvas. - * \param maxHeight - the height of the Canvas. - */ -void setCanvasDimensions(int maxWidth, int maxHeight); - -/*! - * \brief drawPixelOntoActive draws a pixel onto the image data of the active Layer. - * \param color - the color of the Pixel, which should be created. - * \param point - the Pixelposition. - */ -void drawPixelOntoActive(QColor color, QPoint point); - -/*! - * \brief setPolygonDataToActive sets polygondata to the active Layer. - * \param points - the points of the polygon data. - */ -void setPolygonDataToActive(std::vector points); -public slots: -/*! - * \brief The slotActivateLayer method handles the event of selecting one layer as active - * \param a - idx of the layer to be active - */ -void slotActivateLayer(int a); -/*! - * \brief The slotDeleteActiveLayer method handles the deletion of the active layer - */ -void slotDeleteActiveLayer(); - -protected: -/*! - * \brief mousePressEvent handles a mouse pressed event. - * \param event - the specific mouse event. - */ -void mousePressEvent(QMouseEvent*event) override; - -/*! - * \brief mouseMoveEvent handles a mouse moved event - * \param event - the specific mouse event. - */ -void mouseMoveEvent(QMouseEvent*event) override; - -/*! - * \brief mouseReleaseEvent handles a mouse released event - * \param event - the specific mouse event. - */ -void mouseReleaseEvent(QMouseEvent*event) override; - -/*! - * \brief wheelEvent handles a mouse wheel event - * \param event - the specific mouse event. - */ -void wheelEvent(QWheelEvent*event) override; - -/*! - * \brief paintEvent handles a painting event - * \param event - the specific paint event. - */ -void paintEvent(QPaintEvent*event) override; - -private: -/*! - * \brief offsetXDimension - Offset for drawing the image. - */ -int offsetXDimension; - -/*! - * \brief offsetYDimension - Offset for drawing the image. - */ -int offsetYDimension; - -/*! - * \brief selectLayerUp moves the active Layer one Up. - */ -void selectLayerUp(); - -/*! - * \brief selectLayerDown moves the active Layer one Down. - */ -void selectLayerDown(); - -/*! - * \brief copyActiveTool copys the activ tool [allocated]. - * \return returns a allocates copy of the current tool. - */ -IntelliTool* copyActiveTool(); - -/*! - * \brief Canvas the underlying Image to display on. - */ -QImage* Canvas; - -/*! - * \brief ScaledCanvas the Canvas saved for output - */ -QImage ScaledCanvas; - -/*! - * \brief maxWidth is the width of the canvas - */ -int maxWidth; - -/*! - * \brief maxHeight is the height of the canvas - */ -int maxHeight; - -/*! - * \brief isSettingPolygon for checking the state of the drawing. - */ -bool isSettingPolygon = false; - -/*! - * \brief renderSettings a class to manage the render settings. - */ -IntelliRenderSettings renderSettings; - -/*! - * \brief Tool a class to manage the Tool. - */ -IntelliTool* Tool; - -/*! - * \brief guiReference to manage communication with the gui. - */ -IntelliPhotoGui* guiReference; - -/*! - * \brief layerBundle a container to save all layers. - */ -std::vector layerBundle; - -/*! - * \brief activeLayer the index of the active Layer. - */ -int activeLayer = -1; - -/*! - * \brief drawLayers draws the Layers to the Canvas - * \param forSaving an indecate if drawing for saving. - */ -void drawLayers(bool forSaving = false); - -/*! - * \brief createTempTopLayer creates a temporary Layer on top of the Layer. - * \param idx - the Layer which should get a temp Layer. - * \return True if it workes, false otherwise. - */ -bool createTempTopLayer(int idx); - -/*! - * \brief updateTools resets the Tools. - */ -void updateTools(); - -/*! - * \brief history - an array out of containers to save history actions. - */ -std::vector history[100] = {layerBundle}; - -/*! - * \brief historyMaxPast a indicator how many steps you can go into the past. - */ -int historyMaxPast = 0; - -/*! - * \brief historyMaxPast a indicator how many steps you can go into the future. - */ -int historyMaxFuture = 0; - -/*! - * \brief historyPresent a indicator where the present is. - */ -int historyPresent = 0; - -/*! - * \brief historyadd adds an past version to the history - */ -void historyadd(); - -}; - -#endif diff --git a/src/Tool/IntelliToolGradient.cpp b/src/Tool/IntelliToolGradient.cpp index 25cb503..eb90ea9 100644 --- a/src/Tool/IntelliToolGradient.cpp +++ b/src/Tool/IntelliToolGradient.cpp @@ -16,13 +16,13 @@ IntelliToolGradient::~IntelliToolGradient(){ void IntelliToolGradient::onMouseLeftPressed(int x, int y){ IntelliTool::onMouseLeftPressed(x,y); - doubleA[0] = static_cast(x); - doubleA[1] = static_cast(y); - A = QPoint(x,y); - B = QPoint(x,y); - VectorAB[0] = 0; - VectorAB[1] = 0; - Canvas->image->drawPixel(A,LineColor); + startPoint_double[0] = static_cast(x); + startPoint_double[1] = static_cast(y); + startPoint = QPoint(x,y); + endPoint = QPoint(x,y); + endPoint_double[0] = 0; + endPoint_double[1] = 0; + Canvas->image->drawPixel(startPoint,LineColor); } void IntelliToolGradient::onMouseRightPressed(int x, int y){ @@ -43,15 +43,15 @@ void IntelliToolGradient::onMouseRightReleased(int x, int y){ void IntelliToolGradient::onMouseMoved(int x, int y){ if(this->isDrawing){ hasMoved = true; - B = QPoint(x,y); - VectorAB[0] = static_cast(B.x() - A.x()); - VectorAB[1] = static_cast(B.y() - A.y()); - NormalVector[0] = VectorAB[1]; - NormalVector[1] = (-1*VectorAB[0]); + endPoint = QPoint(x,y); + endPoint_double[0] = static_cast(endPoint.x() - startPoint.x()); + endPoint_double[1] = static_cast(endPoint.y() - startPoint.y()); + NormalVector[0] = endPoint_double[1]; + NormalVector[1] = (-1*endPoint_double[0]); NormalDotNormal = dotProduct(NormalVector,NormalVector); this->Canvas->image->drawPlain(Qt::transparent); computeGradientLayer(); - Canvas->image->drawLine(A,B,LineColor,1); + Canvas->image->drawLine(startPoint,endPoint,LineColor,1); } IntelliTool::onMouseMoved(x,y); } @@ -60,23 +60,23 @@ void IntelliToolGradient::onWheelScrolled(int value){ IntelliTool::onWheelScrolled(value); } -void IntelliToolGradient::computePixelColor(QPoint Point){ +void IntelliToolGradient::computeAndDrawPixelColor(QPoint Point){ double doublePoint[2]; doublePoint[0] = static_cast(Point.x()); doublePoint[1] = static_cast(Point.y()); double doublePointSubA[2]; - doublePointSubA[0] = doublePoint[0] - doubleA[0]; - doublePointSubA[1] = doublePoint[1] - doubleA[1]; + doublePointSubA[0] = doublePoint[0] - startPoint_double[0]; + doublePointSubA[1] = doublePoint[1] - startPoint_double[1]; double Perpendicular[2]; double PointSubADotNormal = dotProduct(doublePointSubA,NormalVector); Perpendicular[0] = doublePoint[0] - (PointSubADotNormal / NormalDotNormal) * NormalVector[0]; Perpendicular[1] = doublePoint[1] - (PointSubADotNormal / NormalDotNormal) * NormalVector[1]; double VectorAPoint[2]; - VectorAPoint[0] = static_cast(Perpendicular[0] - doubleA[0]); - VectorAPoint[1] = static_cast(Perpendicular[1] - doubleA[1]); + VectorAPoint[0] = static_cast(Perpendicular[0] - startPoint_double[0]); + VectorAPoint[1] = static_cast(Perpendicular[1] - startPoint_double[1]); double ratio; - if(((VectorAPoint[0] < 0 && VectorAB[0] < 0) || (VectorAPoint[0] > 0 && VectorAB[0] > 0)) && ((VectorAPoint[1] < 0 && VectorAB[1] < 0) || (VectorAPoint[1] > 0 && VectorAB[1] > 0))) - ratio = lenghtVector(VectorAPoint)/lenghtVector(VectorAB); + if(((VectorAPoint[0] < 0 && endPoint_double[0] < 0) || (VectorAPoint[0] > 0 && endPoint_double[0] > 0)) && ((VectorAPoint[1] < 0 && endPoint_double[1] < 0) || (VectorAPoint[1] > 0 && endPoint_double[1] > 0))) + ratio = lenghtVector(VectorAPoint)/lenghtVector(endPoint_double); else{ ratio = -1; } @@ -122,7 +122,7 @@ void IntelliToolGradient::computeGradientLayer(){ } for(int i = 0; i < activeLayer->height; i++){ for(int j = 0; j < activeLayer->width; j++){ - computePixelColor(QPoint(j,i)); + computeAndDrawPixelColor(QPoint(j,i)); } } if(switched){ diff --git a/src/Tool/IntelliToolGradient.cpp.autosave b/src/Tool/IntelliToolGradient.cpp.autosave deleted file mode 100644 index eb90ea9..0000000 --- a/src/Tool/IntelliToolGradient.cpp.autosave +++ /dev/null @@ -1,131 +0,0 @@ -#include "IntelliToolGradient.h" -#include "Layer/PaintingArea.h" -#include "math.h" -#include - -IntelliToolGradient::IntelliToolGradient(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings) - : IntelliTool(Area, colorPicker, Toolsettings){ - this->ActiveType = Tooltype::GRADIENT; - this->LineColor = QColor(0,0,0,255); - this->hasMoved = false; -} - -IntelliToolGradient::~IntelliToolGradient(){ - IntelliTool::onMouseRightPressed(0,0); -} - -void IntelliToolGradient::onMouseLeftPressed(int x, int y){ - IntelliTool::onMouseLeftPressed(x,y); - startPoint_double[0] = static_cast(x); - startPoint_double[1] = static_cast(y); - startPoint = QPoint(x,y); - endPoint = QPoint(x,y); - endPoint_double[0] = 0; - endPoint_double[1] = 0; - Canvas->image->drawPixel(startPoint,LineColor); -} - -void IntelliToolGradient::onMouseRightPressed(int x, int y){ - IntelliTool::onMouseRightPressed(x,y); -} - -void IntelliToolGradient::onMouseLeftReleased(int x, int y){ - if(hasMoved && this->isDrawing){ - computeGradientLayer(); - IntelliTool::onMouseLeftReleased(x,y); - } -} - -void IntelliToolGradient::onMouseRightReleased(int x, int y){ - IntelliTool::onMouseRightReleased(x,y); -} - -void IntelliToolGradient::onMouseMoved(int x, int y){ - if(this->isDrawing){ - hasMoved = true; - endPoint = QPoint(x,y); - endPoint_double[0] = static_cast(endPoint.x() - startPoint.x()); - endPoint_double[1] = static_cast(endPoint.y() - startPoint.y()); - NormalVector[0] = endPoint_double[1]; - NormalVector[1] = (-1*endPoint_double[0]); - NormalDotNormal = dotProduct(NormalVector,NormalVector); - this->Canvas->image->drawPlain(Qt::transparent); - computeGradientLayer(); - Canvas->image->drawLine(startPoint,endPoint,LineColor,1); - } - IntelliTool::onMouseMoved(x,y); -} - -void IntelliToolGradient::onWheelScrolled(int value){ - IntelliTool::onWheelScrolled(value); -} - -void IntelliToolGradient::computeAndDrawPixelColor(QPoint Point){ - double doublePoint[2]; - doublePoint[0] = static_cast(Point.x()); - doublePoint[1] = static_cast(Point.y()); - double doublePointSubA[2]; - doublePointSubA[0] = doublePoint[0] - startPoint_double[0]; - doublePointSubA[1] = doublePoint[1] - startPoint_double[1]; - double Perpendicular[2]; - double PointSubADotNormal = dotProduct(doublePointSubA,NormalVector); - Perpendicular[0] = doublePoint[0] - (PointSubADotNormal / NormalDotNormal) * NormalVector[0]; - Perpendicular[1] = doublePoint[1] - (PointSubADotNormal / NormalDotNormal) * NormalVector[1]; - double VectorAPoint[2]; - VectorAPoint[0] = static_cast(Perpendicular[0] - startPoint_double[0]); - VectorAPoint[1] = static_cast(Perpendicular[1] - startPoint_double[1]); - double ratio; - if(((VectorAPoint[0] < 0 && endPoint_double[0] < 0) || (VectorAPoint[0] > 0 && endPoint_double[0] > 0)) && ((VectorAPoint[1] < 0 && endPoint_double[1] < 0) || (VectorAPoint[1] > 0 && endPoint_double[1] > 0))) - ratio = lenghtVector(VectorAPoint)/lenghtVector(endPoint_double); - else{ - ratio = -1; - } - QColor computedColor; - if(ratio < 0){ - computedColor = colorPicker->getFirstColor(); - } - else if(ratio > 1){ - computedColor = colorPicker->getSecondColor(); - } - else{ - int red; - int green; - int blue; - int alpha; - int red2; - int green2; - int blue2; - int alpha2; - colorPicker->getFirstColor().getRgb(&red,&green,&blue,&alpha); - colorPicker->getSecondColor().getRgb(&red2,&green2,&blue2,&alpha2); - computedColor.setRed(static_cast(ratio * red2 + (1 - ratio) * red)); - computedColor.setGreen(static_cast(ratio * green2 + (1 - ratio) * green)); - computedColor.setBlue(static_cast(ratio * blue2 + (1 - ratio) * blue)); - computedColor.setAlpha(static_cast(ratio * alpha2 + (1 - ratio) * alpha)); - } - Canvas->image->drawPixel(Point,computedColor); -} - -double IntelliToolGradient::dotProduct(double Vector1[2], double Vector2[2]){ - return static_cast(Vector1[0]*Vector2[0]+Vector1[1]*Vector2[1]); -} - -double IntelliToolGradient::lenghtVector(double Vector[2]){ - return static_cast((sqrt(Vector[0] * Vector[0] + Vector[1] * Vector[1]))); -} - -void IntelliToolGradient::computeGradientLayer(){ - bool switched = false; - if(Canvas->image->isFastRendering()){ - switched = true; - Canvas->image->updateRendererSetting(false); - } - for(int i = 0; i < activeLayer->height; i++){ - for(int j = 0; j < activeLayer->width; j++){ - computeAndDrawPixelColor(QPoint(j,i)); - } - } - if(switched){ - Canvas->image->updateRendererSetting(true); - } -} From 2a85e550af028f7314d8a9932c43ae9adac3bf65 Mon Sep 17 00:00:00 2001 From: Sonaion Date: Tue, 28 Jan 2020 10:44:54 +0100 Subject: [PATCH 05/24] hotfix --- src/Tool/IntelliToolGradient.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Tool/IntelliToolGradient.cpp b/src/Tool/IntelliToolGradient.cpp index eb90ea9..a47f087 100644 --- a/src/Tool/IntelliToolGradient.cpp +++ b/src/Tool/IntelliToolGradient.cpp @@ -16,12 +16,12 @@ IntelliToolGradient::~IntelliToolGradient(){ void IntelliToolGradient::onMouseLeftPressed(int x, int y){ IntelliTool::onMouseLeftPressed(x,y); - startPoint_double[0] = static_cast(x); - startPoint_double[1] = static_cast(y); + doubleStartPoint[0] = static_cast(x); + doubleStartPoint[1] = static_cast(y); startPoint = QPoint(x,y); endPoint = QPoint(x,y); - endPoint_double[0] = 0; - endPoint_double[1] = 0; + VectorStartEnd[0] = 0; + VectorStartEnd[1] = 0; Canvas->image->drawPixel(startPoint,LineColor); } @@ -44,10 +44,10 @@ void IntelliToolGradient::onMouseMoved(int x, int y){ if(this->isDrawing){ hasMoved = true; endPoint = QPoint(x,y); - endPoint_double[0] = static_cast(endPoint.x() - startPoint.x()); - endPoint_double[1] = static_cast(endPoint.y() - startPoint.y()); - NormalVector[0] = endPoint_double[1]; - NormalVector[1] = (-1*endPoint_double[0]); + VectorStartEnd[0] = static_cast(endPoint.x() - startPoint.x()); + VectorStartEnd[1] = static_cast(endPoint.y() - startPoint.y()); + NormalVector[0] = VectorStartEnd[1]; + NormalVector[1] = (-1*VectorStartEnd[0]); NormalDotNormal = dotProduct(NormalVector,NormalVector); this->Canvas->image->drawPlain(Qt::transparent); computeGradientLayer(); @@ -65,18 +65,18 @@ void IntelliToolGradient::computeAndDrawPixelColor(QPoint Point){ doublePoint[0] = static_cast(Point.x()); doublePoint[1] = static_cast(Point.y()); double doublePointSubA[2]; - doublePointSubA[0] = doublePoint[0] - startPoint_double[0]; - doublePointSubA[1] = doublePoint[1] - startPoint_double[1]; + doublePointSubA[0] = doublePoint[0] - doubleStartPoint[0]; + doublePointSubA[1] = doublePoint[1] - doubleStartPoint[1]; double Perpendicular[2]; double PointSubADotNormal = dotProduct(doublePointSubA,NormalVector); Perpendicular[0] = doublePoint[0] - (PointSubADotNormal / NormalDotNormal) * NormalVector[0]; Perpendicular[1] = doublePoint[1] - (PointSubADotNormal / NormalDotNormal) * NormalVector[1]; double VectorAPoint[2]; - VectorAPoint[0] = static_cast(Perpendicular[0] - startPoint_double[0]); - VectorAPoint[1] = static_cast(Perpendicular[1] - startPoint_double[1]); + VectorAPoint[0] = static_cast(Perpendicular[0] - doubleStartPoint[0]); + VectorAPoint[1] = static_cast(Perpendicular[1] - doubleStartPoint[1]); double ratio; - if(((VectorAPoint[0] < 0 && endPoint_double[0] < 0) || (VectorAPoint[0] > 0 && endPoint_double[0] > 0)) && ((VectorAPoint[1] < 0 && endPoint_double[1] < 0) || (VectorAPoint[1] > 0 && endPoint_double[1] > 0))) - ratio = lenghtVector(VectorAPoint)/lenghtVector(endPoint_double); + if(((VectorAPoint[0] < 0 && VectorStartEnd[0] < 0) || (VectorAPoint[0] > 0 && VectorStartEnd[0] > 0)) && ((VectorAPoint[1] < 0 && VectorStartEnd[1] < 0) || (VectorAPoint[1] > 0 && VectorStartEnd[1] > 0))) + ratio = lenghtVector(VectorAPoint)/lenghtVector(VectorStartEnd); else{ ratio = -1; } From 9c8378194d752a728079f13b4c807dc5ca77f9ce Mon Sep 17 00:00:00 2001 From: Conrad Date: Tue, 28 Jan 2020 11:44:09 +0100 Subject: [PATCH 06/24] New GUI Menu Bar Layout --- src/GUI/IntelliPhotoGui.cpp | 50 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index d3ab832..acf8457 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -20,7 +20,7 @@ IntelliPhotoGui::IntelliPhotoGui(){ setIntelliStyle(); // Size the app resize(600,600); - showMaximized(); + showMaximized(); setDefaultValues(); } @@ -242,13 +242,13 @@ void IntelliPhotoGui::slotSetActiveLayer(){ void IntelliPhotoGui::slotUpdateRenderSettingsOn(){ paintingArea->setRenderSettings(true); - FastRendererLabel->setText("Fast Render: On"); + FastRendererLabel->setText("Fast Render: On"); UpdateGui(); } void IntelliPhotoGui::slotUpdateRenderSettingsOff(){ paintingArea->setRenderSettings(false); - FastRendererLabel->setText("Fast Render: Off"); + FastRendererLabel->setText("Fast Render: Off"); UpdateGui(); } @@ -303,8 +303,8 @@ void IntelliPhotoGui::slotCreateFloodFillTool(){ } void IntelliPhotoGui::slotCreateGradientTool(){ - GradientButton->setChecked(true); - paintingArea->createGradientTool(); + GradientButton->setChecked(true); + paintingArea->createGradientTool(); } // Open an about dialog @@ -528,9 +528,9 @@ void IntelliPhotoGui::createActions(){ connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool())); - actionCreateGradientTool = new QAction(tr("&Gradient"),this); - connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); - connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotCreateGradientTool())); + actionCreateGradientTool = new QAction(tr("&Gradient"),this); + connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotCreateGradientTool())); // Create about action and tie to IntelliPhotoGui::about() actionAboutDialog = new QAction(tr("&About"), this); @@ -551,8 +551,8 @@ void IntelliPhotoGui::createActions(){ connect(FloodFillButton,SIGNAL(pressed()), this, SLOT(slotResetTools())); connect(FloodFillButton, SIGNAL(clicked()), this, SLOT(slotCreateFloodFillTool())); - connect(GradientButton, SIGNAL(pressed()), this, SLOT(slotResetTools())); - connect(GradientButton, SIGNAL(clicked()), this, SLOT(slotCreateGradientTool())); + connect(GradientButton, SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(GradientButton, SIGNAL(clicked()), this, SLOT(slotCreateGradientTool())); connect(LineButton,SIGNAL(pressed()), this, SLOT(slotResetTools())); connect(LineButton, SIGNAL(clicked()), this, SLOT(slotCreateLineTool())); @@ -636,8 +636,8 @@ void IntelliPhotoGui::createMenus(){ //Attach all Tool Creation Actions toolCreationMenu = new QMenu(tr("&Drawingtools"), this); toolCreationMenu->addAction(actionCreateCircleTool); - toolCreationMenu->addAction(actionCreateFloodFillTool); - toolCreationMenu->addAction(actionCreateGradientTool); + toolCreationMenu->addAction(actionCreateFloodFillTool); + toolCreationMenu->addAction(actionCreateGradientTool); toolCreationMenu->addAction(actionCreateLineTool); toolCreationMenu->addAction(actionCreatePenTool); toolCreationMenu->addAction(actionCreatePlainTool); @@ -659,8 +659,7 @@ void IntelliPhotoGui::createMenus(){ // Attach all actions to Options optionMenu = new QMenu(tr("&Options"), this); optionMenu->addAction(actionGoBack); - optionMenu->addAction(actionGoForward); - optionMenu->addMenu(layerMenu); + optionMenu->addAction(actionGoForward); optionMenu->addMenu(toolMenu); optionMenu->addSeparator(); optionMenu->addMenu(renderMenu); @@ -674,6 +673,7 @@ void IntelliPhotoGui::createMenus(){ // Add menu items to the menubar menuBar()->addMenu(fileMenu); menuBar()->addMenu(optionMenu); + menuBar()->addMenu(layerMenu); menuBar()->addMenu(helpMenu); } @@ -705,12 +705,12 @@ void IntelliPhotoGui::createGui(){ FloodFillButton->setIconSize(Buttonsize); FloodFillButton->setCheckable(true); - preview = QPixmap(":/Icons/Buttons/icons/icon.png"); - GradientButton = new QPushButton(); - GradientButton->setFixedSize(Buttonsize); - GradientButton->setIcon(preview); - GradientButton->setIconSize(Buttonsize); - GradientButton->setCheckable(true); + preview = QPixmap(":/Icons/Buttons/icons/icon.png"); + GradientButton = new QPushButton(); + GradientButton->setFixedSize(Buttonsize); + GradientButton->setIcon(preview); + GradientButton->setIconSize(Buttonsize); + GradientButton->setCheckable(true); preview = QPixmap(":/Icons/Buttons/icons/line-tool.svg"); LineButton = new QPushButton(); @@ -810,9 +810,9 @@ void IntelliPhotoGui::createGui(){ QString String = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height()); dimCanvas->setText(String); - FastRendererLabel = new QLabel(); - FastRendererLabel->setFixedSize(Buttonsize.width() * 2 + 15,(Buttonsize.height() * 2) / 3); - FastRendererLabel->setText("Fast Render: On"); + FastRendererLabel = new QLabel(); + FastRendererLabel->setFixedSize(Buttonsize.width() * 2 + 15,(Buttonsize.height() * 2) / 3); + FastRendererLabel->setText("Fast Render: On"); ScrollArea = new QScrollArea(this); ScrollArea->setBackgroundRole(QPalette::Dark); @@ -829,7 +829,7 @@ void IntelliPhotoGui::createGui(){ mainLayout->addWidget(PlainButton,3,2,1,1); mainLayout->addWidget(PolygonButton,3,3,1,1); mainLayout->addWidget(RectangleButton,4,2,1,1); - mainLayout->addWidget(GradientButton,4,3,1,1); + mainLayout->addWidget(GradientButton,4,3,1,1); mainLayout->addWidget(WidthLine,5,2,1,2); mainLayout->addWidget(EditLineWidth,6,2,1,2); mainLayout->addWidget(innerAlphaLine,7,2,1,2); @@ -841,7 +841,7 @@ void IntelliPhotoGui::createGui(){ mainLayout->addWidget(ActiveLayerImageLabel,12,2,1,2); mainLayout->addWidget(dimActive,13,2,1,2); mainLayout->addWidget(dimCanvas,14,2,1,2); - mainLayout->addWidget(FastRendererLabel,15,2,1,2); + mainLayout->addWidget(FastRendererLabel,15,2,1,2); mainLayout->setHorizontalSpacing(0); } From 8980571c1aed627000e844e3f55d453939d2b2c3 Mon Sep 17 00:00:00 2001 From: Conrad Date: Tue, 28 Jan 2020 11:48:22 +0100 Subject: [PATCH 07/24] Moved Tools to Menubar --- src/GUI/IntelliPhotoGui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index acf8457..c80b15b 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -660,7 +660,6 @@ void IntelliPhotoGui::createMenus(){ optionMenu = new QMenu(tr("&Options"), this); optionMenu->addAction(actionGoBack); optionMenu->addAction(actionGoForward); - optionMenu->addMenu(toolMenu); optionMenu->addSeparator(); optionMenu->addMenu(renderMenu); optionMenu->addAction(actionChangeDim); @@ -674,6 +673,7 @@ void IntelliPhotoGui::createMenus(){ menuBar()->addMenu(fileMenu); menuBar()->addMenu(optionMenu); menuBar()->addMenu(layerMenu); + menuBar()->addMenu(toolMenu); menuBar()->addMenu(helpMenu); } From ed462e4feca291b188e0c38e04820af4689cf71b Mon Sep 17 00:00:00 2001 From: Conrad Date: Tue, 28 Jan 2020 11:50:14 +0100 Subject: [PATCH 08/24] Unified Menu Bar Text --- src/GUI/IntelliPhotoGui.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index c80b15b..6d75ff4 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -430,39 +430,39 @@ void IntelliPhotoGui::createActions(){ connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim())); connect(dimCanvas, SIGNAL(clicked()), this, SLOT(slotChangeDim())); - actionSetActiveLayer = new QAction(tr("&set Active"), this); + actionSetActiveLayer = new QAction(tr("&Set Active"), this); actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A)); connect(actionSetActiveLayer, SIGNAL(triggered()), this, SLOT(slotSetActiveLayer())); - actionSetActiveAlpha = new QAction(tr("&set Alpha"), this); + actionSetActiveAlpha = new QAction(tr("&Set Alpha"), this); 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 = 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 = new QAction(tr("&Move Up"), this); actionMovePositionUp->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up)); connect(actionMovePositionUp, SIGNAL(triggered()), this, SLOT(slotPositionMoveUp())); - actionMovePositionDown = new QAction(tr("&move Down"), this); + actionMovePositionDown = new QAction(tr("&Move Down"), this); actionMovePositionDown->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down)); connect(actionMovePositionDown, SIGNAL(triggered()), this, SLOT(slotPositionMoveDown())); - actionMovePositionLeft = new QAction(tr("&move Left"), this); + actionMovePositionLeft = new QAction(tr("&Move Left"), this); actionMovePositionLeft->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left)); connect(actionMovePositionLeft, SIGNAL(triggered()), this, SLOT(slotPositionMoveLeft())); - actionMovePositionRight = new QAction(tr("&move Right"), this); + actionMovePositionRight = new QAction(tr("&Move Right"), this); actionMovePositionRight->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right)); connect(actionMovePositionRight, SIGNAL(triggered()), this, SLOT(slotPositionMoveRight())); - actionMoveLayerUp = new QAction(tr("&move Layer Up"), this); + actionMoveLayerUp = new QAction(tr("&Move Layer Up"), this); actionMoveLayerUp->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Up)); connect(actionMoveLayerUp, SIGNAL(triggered()), this, SLOT(slotMoveLayerUp())); - actionMoveLayerDown = new QAction(tr("&move Layer Down"), this); + actionMoveLayerDown = new QAction(tr("&Move Layer Down"), this); actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down)); connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown())); From a7deccac6b45a6dc9ad32e36610ed6a875d19a95 Mon Sep 17 00:00:00 2001 From: Conrad Date: Tue, 28 Jan 2020 12:33:05 +0100 Subject: [PATCH 09/24] Added Improved Z Labels --- src/GUI/IntelliPhotoGui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 6d75ff4..5b85dd9 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -458,11 +458,11 @@ void IntelliPhotoGui::createActions(){ actionMovePositionRight->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right)); connect(actionMovePositionRight, SIGNAL(triggered()), this, SLOT(slotPositionMoveRight())); - actionMoveLayerUp = new QAction(tr("&Move Layer Up"), this); + actionMoveLayerUp = new QAction(tr("&Move Forth"), this); actionMoveLayerUp->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Up)); connect(actionMoveLayerUp, SIGNAL(triggered()), this, SLOT(slotMoveLayerUp())); - actionMoveLayerDown = new QAction(tr("&Move Layer Down"), this); + actionMoveLayerDown = new QAction(tr("&Move Back"), this); actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down)); connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown())); From faec9a7f5eb771ce7a010a3540e5562b66312905 Mon Sep 17 00:00:00 2001 From: Paul Norberger Date: Tue, 28 Jan 2020 21:51:38 +0100 Subject: [PATCH 10/24] Add gradient tool icon --- src/icons/gradient-tool.svg | 135 ++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 src/icons/gradient-tool.svg diff --git a/src/icons/gradient-tool.svg b/src/icons/gradient-tool.svg new file mode 100644 index 0000000..8953735 --- /dev/null +++ b/src/icons/gradient-tool.svg @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + From 7bf881225078d35bbcdabfdf0a6f8fdea16f606a Mon Sep 17 00:00:00 2001 From: Paul Norberger Date: Tue, 28 Jan 2020 21:52:03 +0100 Subject: [PATCH 11/24] Remove icon folder in docs folder --- docs/Icons/circle-tool.svg | 94 ---------------- docs/Icons/eraser-tool.svg | 109 ------------------ docs/Icons/flood-fill-tool.svg | 194 --------------------------------- docs/Icons/line-tool.svg | 99 ----------------- docs/Icons/magic-wand-tool.svg | 169 ---------------------------- docs/Icons/pen-tool.svg | 105 ------------------ docs/Icons/plain-tool.svg | 125 --------------------- docs/Icons/polygon-tool.svg | 117 -------------------- docs/Icons/rectangle-tool.svg | 101 ----------------- 9 files changed, 1113 deletions(-) delete mode 100644 docs/Icons/circle-tool.svg delete mode 100644 docs/Icons/eraser-tool.svg delete mode 100644 docs/Icons/flood-fill-tool.svg delete mode 100644 docs/Icons/line-tool.svg delete mode 100644 docs/Icons/magic-wand-tool.svg delete mode 100644 docs/Icons/pen-tool.svg delete mode 100644 docs/Icons/plain-tool.svg delete mode 100644 docs/Icons/polygon-tool.svg delete mode 100644 docs/Icons/rectangle-tool.svg diff --git a/docs/Icons/circle-tool.svg b/docs/Icons/circle-tool.svg deleted file mode 100644 index a6cc0e4..0000000 --- a/docs/Icons/circle-tool.svg +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - diff --git a/docs/Icons/eraser-tool.svg b/docs/Icons/eraser-tool.svg deleted file mode 100644 index cdc518d..0000000 --- a/docs/Icons/eraser-tool.svg +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/docs/Icons/flood-fill-tool.svg b/docs/Icons/flood-fill-tool.svg deleted file mode 100644 index 980bb7a..0000000 --- a/docs/Icons/flood-fill-tool.svg +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - diff --git a/docs/Icons/line-tool.svg b/docs/Icons/line-tool.svg deleted file mode 100644 index 6ff03e8..0000000 --- a/docs/Icons/line-tool.svg +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/docs/Icons/magic-wand-tool.svg b/docs/Icons/magic-wand-tool.svg deleted file mode 100644 index 71f019d..0000000 --- a/docs/Icons/magic-wand-tool.svg +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/docs/Icons/pen-tool.svg b/docs/Icons/pen-tool.svg deleted file mode 100644 index 5dd9782..0000000 --- a/docs/Icons/pen-tool.svg +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/docs/Icons/plain-tool.svg b/docs/Icons/plain-tool.svg deleted file mode 100644 index 6dee885..0000000 --- a/docs/Icons/plain-tool.svg +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - diff --git a/docs/Icons/polygon-tool.svg b/docs/Icons/polygon-tool.svg deleted file mode 100644 index 7602729..0000000 --- a/docs/Icons/polygon-tool.svg +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - diff --git a/docs/Icons/rectangle-tool.svg b/docs/Icons/rectangle-tool.svg deleted file mode 100644 index 3056a02..0000000 --- a/docs/Icons/rectangle-tool.svg +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - From 7fb268dfa80cb6701d1dd079368532bcf0153f2a Mon Sep 17 00:00:00 2001 From: Conrad Date: Wed, 29 Jan 2020 09:47:10 +0100 Subject: [PATCH 12/24] Unified Naming in Menubar --- src/GUI/IntelliPhotoGui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 5b85dd9..8ebcae0 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -421,7 +421,7 @@ void IntelliPhotoGui::createActions(){ connect(actionCreateNewShapedLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewShapedLayer())); // Delete New Layer action and tie to IntelliPhotoGui::deleteLayer() - actionDeleteLayer = new QAction(tr("&Delete Layer..."), this); + actionDeleteLayer = new QAction(tr("&Delete Layer"), this); actionDeleteLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_D)); connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer())); @@ -438,7 +438,7 @@ 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 = new QAction(tr("&Set New Polygondata"), this); actionSetPolygon->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_P)); connect(actionSetPolygon, SIGNAL(triggered()), this, SLOT(slotSetPolygon())); @@ -606,7 +606,7 @@ void IntelliPhotoGui::createMenus(){ renderMenu->addAction(actionUpdateRenderSettingsOff); //Attach all Layer Creations to Menu - layerCreationMenu = new QMenu(tr("&Create new Layer"), this); + layerCreationMenu = new QMenu(tr("&Create New Layer"), this); layerCreationMenu->addAction(actionCreateNewRasterLayer); layerCreationMenu->addAction(actionCreateNewShapedLayer); From 48ea8f14f03c32f62935d5870649973768c369b9 Mon Sep 17 00:00:00 2001 From: Conrad Date: Wed, 29 Jan 2020 09:54:34 +0100 Subject: [PATCH 13/24] Added Shortcut for Gradient Tool - Added Shortcut for Gradient Tool - Moved Color Menu To Bar --- src/GUI/IntelliPhotoGui.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 8ebcae0..26ef973 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -529,6 +529,7 @@ void IntelliPhotoGui::createActions(){ connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool())); actionCreateGradientTool = new QAction(tr("&Gradient"),this); + actionCreateGradientTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_G)); connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotCreateGradientTool())); @@ -600,12 +601,12 @@ void IntelliPhotoGui::createMenus(){ fileMenu->addSeparator(); fileMenu->addAction(actionExit); - //Attach all actions to Render Settings + // Attach all actions to Render Settings renderMenu = new QMenu(tr("&Fast Renderer"), this); renderMenu->addAction(actionUpdateRenderSettingsOn); renderMenu->addAction(actionUpdateRenderSettingsOff); - //Attach all Layer Creations to Menu + // Attach all Layer Creations to Menu layerCreationMenu = new QMenu(tr("&Create New Layer"), this); layerCreationMenu->addAction(actionCreateNewRasterLayer); layerCreationMenu->addAction(actionCreateNewShapedLayer); @@ -627,14 +628,14 @@ void IntelliPhotoGui::createMenus(){ layerMenu->addSeparator(); layerMenu->addAction(actionDeleteLayer); - //Attach all Color Options + // Attach all Color Options colorMenu = new QMenu(tr("&Color"), this); colorMenu->addAction(actionColorPickerFirstColor); colorMenu->addAction(actionColorPickerSecondColor); colorMenu->addAction(actionColorSwap); - //Attach all Tool Creation Actions - toolCreationMenu = new QMenu(tr("&Drawingtools"), this); + // Attach all Tool Creation Actions + toolCreationMenu = new QMenu(tr("&Tool Selection"), this); toolCreationMenu->addAction(actionCreateCircleTool); toolCreationMenu->addAction(actionCreateFloodFillTool); toolCreationMenu->addAction(actionCreateGradientTool); @@ -644,17 +645,15 @@ void IntelliPhotoGui::createMenus(){ toolCreationMenu->addAction(actionCreatePolygonTool); toolCreationMenu->addAction(actionCreateRectangleTool); - //Attach all Tool Setting Actions - toolSettingsMenu = new QMenu(tr("&Toolsettings"), this); + // Attach all Tool Setting Actions + toolSettingsMenu = new QMenu(tr("&Tool Settings"), this); toolSettingsMenu->addAction(actionSetWidth); toolSettingsMenu->addAction(actionSetInnerAlpha); - //Attach all Tool Options + // Attach all Tool Options toolMenu = new QMenu(tr("&Tools"), this); toolMenu->addMenu(toolCreationMenu); - toolMenu->addMenu(toolSettingsMenu); - toolMenu->addSeparator(); - toolMenu->addMenu(colorMenu); + toolMenu->addMenu(toolSettingsMenu); // Attach all actions to Options optionMenu = new QMenu(tr("&Options"), this); @@ -674,6 +673,7 @@ void IntelliPhotoGui::createMenus(){ menuBar()->addMenu(optionMenu); menuBar()->addMenu(layerMenu); menuBar()->addMenu(toolMenu); + menuBar()->addMenu(colorMenu); menuBar()->addMenu(helpMenu); } From 6dbc23c0ae03ff5c767e719e4d45eb38b87d20d0 Mon Sep 17 00:00:00 2001 From: Conrad Date: Wed, 29 Jan 2020 09:59:39 +0100 Subject: [PATCH 14/24] Renamed History Tool Labels For Conventions --- src/GUI/IntelliPhotoGui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 26ef973..5c7eaea 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -578,11 +578,11 @@ void IntelliPhotoGui::createActions(){ actionSetInnerAlpha->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A)); connect(actionSetInnerAlpha, SIGNAL(triggered()), this, SLOT(slotSetInnerAlpha())); - actionGoBack = new QAction(tr("&Go back"),this); + actionGoBack = new QAction(tr("&Undo"),this); actionGoBack->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); connect(actionGoBack, SIGNAL(triggered()), this, SLOT(slotGoBack())); - actionGoForward = new QAction(tr("&Go forward"),this); + actionGoForward = new QAction(tr("&Redo"),this); actionGoForward->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y)); connect(actionGoForward, SIGNAL(triggered()), this, SLOT(slotGoForward())); } From 6ac4e4783ae7d4436ba808389665426bb12f9146 Mon Sep 17 00:00:00 2001 From: Conrad Date: Wed, 29 Jan 2020 10:04:05 +0100 Subject: [PATCH 15/24] Removed Shortcuts From Trivial Options --- src/GUI/IntelliPhotoGui.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 5c7eaea..09d4840 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -534,13 +534,11 @@ void IntelliPhotoGui::createActions(){ connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotCreateGradientTool())); // Create about action and tie to IntelliPhotoGui::about() - actionAboutDialog = new QAction(tr("&About"), this); - actionAboutDialog->setShortcut(Qt::Key_F2); + actionAboutDialog = new QAction(tr("&About"), this); connect(actionAboutDialog, SIGNAL(triggered()), this, SLOT(slotAboutDialog())); // Create about Qt action and tie to IntelliPhotoGui::aboutQt() - actionAboutQtDialog = new QAction(tr("About &Qt"), this); - actionAboutQtDialog->setShortcut(Qt::Key_F3); + actionAboutQtDialog = new QAction(tr("About &Qt"), this); connect(actionAboutQtDialog, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(EditLineWidth, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed())); @@ -607,7 +605,7 @@ void IntelliPhotoGui::createMenus(){ renderMenu->addAction(actionUpdateRenderSettingsOff); // Attach all Layer Creations to Menu - layerCreationMenu = new QMenu(tr("&Create New Layer"), this); + layerCreationMenu = new QMenu(tr("&Create Layer"), this); layerCreationMenu->addAction(actionCreateNewRasterLayer); layerCreationMenu->addAction(actionCreateNewShapedLayer); From c8812a8c00bfe0a7645d17e9ffffdc500fc9c20c Mon Sep 17 00:00:00 2001 From: Conrad Date: Wed, 29 Jan 2020 10:04:40 +0100 Subject: [PATCH 16/24] Updated Polygon Label --- src/GUI/IntelliPhotoGui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 09d4840..e1b3fd4 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -438,7 +438,7 @@ 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 = new QAction(tr("&Set Polygon Data"), this); actionSetPolygon->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_P)); connect(actionSetPolygon, SIGNAL(triggered()), this, SLOT(slotSetPolygon())); From fd1849475586c5fd83816897a0f0bcd75dcb0ecf Mon Sep 17 00:00:00 2001 From: Conrad Date: Wed, 29 Jan 2020 10:28:25 +0100 Subject: [PATCH 17/24] Bumped Version --- conf/intelliphoto_dox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/intelliphoto_dox b/conf/intelliphoto_dox index 8c10cda..c1d0642 100644 --- a/conf/intelliphoto_dox +++ b/conf/intelliphoto_dox @@ -5,7 +5,7 @@ #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = IntelliPhoto -PROJECT_NUMBER = 0.6 +PROJECT_NUMBER = 0.7 PROJECT_BRIEF = PROJECT_LOGO = OUTPUT_DIRECTORY = docs From 2b553f5f4159b35db500197d634864a932d2426a Mon Sep 17 00:00:00 2001 From: AshBastian Date: Wed, 29 Jan 2020 13:21:34 +0100 Subject: [PATCH 18/24] =?UTF-8?q?Icon=20Gradient=20eingef=C3=BCgt=20in=20G?= =?UTF-8?q?UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Bilder.qrc | 1 + src/GUI/IntelliPhotoGui.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bilder.qrc b/src/Bilder.qrc index 01e8468..f2c6dfa 100644 --- a/src/Bilder.qrc +++ b/src/Bilder.qrc @@ -10,5 +10,6 @@ icons/line-tool.svg icons/flood-fill-tool.svg icons/plain-tool.svg + icons/gradient-tool.svg diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index d3ab832..cd15dcf 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -705,7 +705,7 @@ void IntelliPhotoGui::createGui(){ FloodFillButton->setIconSize(Buttonsize); FloodFillButton->setCheckable(true); - preview = QPixmap(":/Icons/Buttons/icons/icon.png"); + preview = QPixmap(":/Icons/Buttons/icons/gradient-tool.svg"); GradientButton = new QPushButton(); GradientButton->setFixedSize(Buttonsize); GradientButton->setIcon(preview); From a9435e6d5664f78f81797fa325be1ccaeb8ce2b4 Mon Sep 17 00:00:00 2001 From: AshBastian Date: Wed, 29 Jan 2020 13:35:54 +0100 Subject: [PATCH 19/24] First Change Buttonsize --- src/GUI/IntelliPhotoGui.cpp | 7 +++++++ src/GUI/IntelliPhotoGui.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index e1b3fd4..787c9a8 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include // IntelliPhotoGui constructor IntelliPhotoGui::IntelliPhotoGui(){ @@ -689,6 +691,11 @@ void IntelliPhotoGui::createGui(){ paintingArea = new PaintingArea(1280, 720); paintingArea->guiReference = this; + QScreen *screen = QGuiApplication::primaryScreen(); + QRect screenGeometry = screen->geometry(); + Buttonsize.setWidth(screenGeometry.width()/10); + Buttonsize.setHeight(screenGeometry.height()/10); + preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg"); CircleButton = new QPushButton(); CircleButton->setFixedSize(Buttonsize); diff --git a/src/GUI/IntelliPhotoGui.h b/src/GUI/IntelliPhotoGui.h index 25f6145..aeb2ede 100644 --- a/src/GUI/IntelliPhotoGui.h +++ b/src/GUI/IntelliPhotoGui.h @@ -124,7 +124,7 @@ PaintingArea* paintingArea; QPixmap preview; //size of all buttons -const QSize Buttonsize = QSize(35,35); +QSize Buttonsize; //buttons used for gui QPushButton* CircleButton; From fe9f4263f98ac5cabc058ab13c511320a9fe48e9 Mon Sep 17 00:00:00 2001 From: AshBastian Date: Wed, 29 Jan 2020 13:47:52 +0100 Subject: [PATCH 20/24] =?UTF-8?q?Button=20Size=20an=20Destopaufl=C3=B6sung?= =?UTF-8?q?=20gekoppelt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/GUI/IntelliPhotoGui.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index b0e9137..b0c4de6 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -332,6 +332,7 @@ void IntelliPhotoGui::slotEnterPressed(){ void IntelliPhotoGui::slotResetTools(){ CircleButton->setChecked(false); FloodFillButton->setChecked(false); + GradientButton->setChecked(false); LineButton->setChecked(false); PenButton->setChecked(false); PlainButton->setChecked(false); @@ -693,8 +694,8 @@ void IntelliPhotoGui::createGui(){ QScreen *screen = QGuiApplication::primaryScreen(); QRect screenGeometry = screen->geometry(); - Buttonsize.setWidth(screenGeometry.width()/10); - Buttonsize.setHeight(screenGeometry.height()/10); + Buttonsize.setWidth(screenGeometry.width()/20); + Buttonsize.setHeight(screenGeometry.height()/20); preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg"); CircleButton = new QPushButton(); From 6c136d3299df019db8e0c89b1c72fb64efb9a4a9 Mon Sep 17 00:00:00 2001 From: Sonaion Date: Thu, 30 Jan 2020 13:30:41 +0100 Subject: [PATCH 21/24] all comments for headers --- src/GUI/IntelliPhotoGui.cpp | 64 ++--- src/GUI/IntelliPhotoGui.h | 480 +++++++++++++++++++++++++++++++++--- 2 files changed, 480 insertions(+), 64 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 7166490..a92c481 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -240,13 +240,13 @@ void IntelliPhotoGui::slotSetActiveLayer(){ } } -void IntelliPhotoGui::slotUpdateRenderSettingsOn(){ +void IntelliPhotoGui::slotUpdateFastRenderSettingsOn(){ paintingArea->setRenderSettings(true); FastRendererLabel->setText("Fast Render: On"); UpdateGui(); } -void IntelliPhotoGui::slotUpdateRenderSettingsOff(){ +void IntelliPhotoGui::slotUpdateFastRenderSettingsOff(){ paintingArea->setRenderSettings(false); FastRendererLabel->setText("Fast Render: Off"); UpdateGui(); @@ -327,7 +327,7 @@ void IntelliPhotoGui::slotEnterPressed(){ paintingArea->Toolsettings.setInnerAlpha(string.toInt()); } -void IntelliPhotoGui::slotResetTools(){ +void IntelliPhotoGui::slotResetToolButtons(){ CircleButton->setChecked(false); FloodFillButton->setChecked(false); LineButton->setChecked(false); @@ -467,13 +467,13 @@ void IntelliPhotoGui::createActions(){ connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown())); //Create Update RenderSettings Actions here - actionUpdateRenderSettingsOn = new QAction(tr("&On"), this); - actionUpdateRenderSettingsOn->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_A)); - connect(actionUpdateRenderSettingsOn, SIGNAL(triggered()),this, SLOT(slotUpdateRenderSettingsOn())); + actionUpdateFastRenderSettingsOn = new QAction(tr("&On"), this); + actionUpdateFastRenderSettingsOn->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_A)); + connect(actionUpdateFastRenderSettingsOn, SIGNAL(triggered()),this, SLOT(slotUpdateFastRenderSettingsOn())); - actionUpdateRenderSettingsOff = new QAction(tr("&Off"), this); - actionUpdateRenderSettingsOff->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_D)); - connect(actionUpdateRenderSettingsOff, SIGNAL(triggered()),this, SLOT(slotUpdateRenderSettingsOff())); + actionUpdateFastRenderSettingsOff = new QAction(tr("&Off"), this); + actionUpdateFastRenderSettingsOff->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_D)); + connect(actionUpdateFastRenderSettingsOff, SIGNAL(triggered()),this, SLOT(slotUpdateFastRenderSettingsOff())); //Create Color Actions here actionColorPickerFirstColor = new QAction(tr("&Main"), this); @@ -494,42 +494,42 @@ void IntelliPhotoGui::createActions(){ //Create Tool actions down here actionCreatePlainTool = new QAction(tr("&Plain"), this); actionCreatePlainTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_P)); - connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons())); connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotCreatePlainTool())); actionCreatePenTool = new QAction(tr("&Pen"),this); actionCreatePenTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_S)); - connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons())); connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool())); actionCreateLineTool = new QAction(tr("&Line"), this); actionCreateLineTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_L)); - connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons())); connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool())); actionCreateCircleTool = new QAction(tr("&Circle"), this); actionCreateCircleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_C)); - connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons())); connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotCreateCircleTool())); actionCreateRectangleTool = new QAction(tr("&Rectangle"), this); actionCreateRectangleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_R)); - connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons())); connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotCreateRectangleTool())); actionCreatePolygonTool = new QAction(tr("&Polygon"), this); actionCreatePolygonTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_V)); - connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons())); connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotCreatePolygonTool())); actionCreateFloodFillTool = new QAction(tr("&FloodFill"), this); actionCreateFloodFillTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_F)); - connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons())); connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool())); actionCreateGradientTool = new QAction(tr("&Gradient"),this); - connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons())); connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotCreateGradientTool())); // Create about action and tie to IntelliPhotoGui::about() @@ -545,28 +545,28 @@ void IntelliPhotoGui::createActions(){ connect(EditLineWidth, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed())); connect(EditLineInnerAlpha, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed())); - connect(CircleButton,SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(CircleButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); connect(CircleButton, SIGNAL(clicked()), this, SLOT(slotCreateCircleTool())); - connect(FloodFillButton,SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(FloodFillButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); connect(FloodFillButton, SIGNAL(clicked()), this, SLOT(slotCreateFloodFillTool())); - connect(GradientButton, SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(GradientButton, SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); connect(GradientButton, SIGNAL(clicked()), this, SLOT(slotCreateGradientTool())); - connect(LineButton,SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(LineButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); connect(LineButton, SIGNAL(clicked()), this, SLOT(slotCreateLineTool())); - connect(PenButton,SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(PenButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); connect(PenButton, SIGNAL(clicked()), this, SLOT(slotCreatePenTool())); - connect(PlainButton,SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(PlainButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); connect(PlainButton, SIGNAL(clicked()), this, SLOT(slotCreatePlainTool())); - connect(PolygonButton,SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(PolygonButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); connect(PolygonButton, SIGNAL(clicked()), this, SLOT(slotCreatePolygonTool())); - connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); connect(RectangleButton, SIGNAL(clicked()), this, SLOT(slotCreateRectangleTool())); actionSetWidth = new QAction(tr("&Set Width"),this); @@ -602,8 +602,8 @@ void IntelliPhotoGui::createMenus(){ //Attach all actions to Render Settings renderMenu = new QMenu(tr("&Fast Renderer"), this); - renderMenu->addAction(actionUpdateRenderSettingsOn); - renderMenu->addAction(actionUpdateRenderSettingsOff); + renderMenu->addAction(actionUpdateFastRenderSettingsOn); + renderMenu->addAction(actionUpdateFastRenderSettingsOff); //Attach all Layer Creations to Menu layerCreationMenu = new QMenu(tr("&Create new Layer"), this); @@ -783,10 +783,10 @@ void IntelliPhotoGui::createGui(){ SwitchColorButton->setIcon(preview); SwitchColorButton->setIconSize(QSize(Buttonsize.width() * 2,Buttonsize.height())); - ActiveLayerLine = new QLabel(); + ActiveLayerLabel = new QLabel(); QString string = QString("Active Layer: %1").arg(paintingArea->getIndexOfActiveLayer() + 1); - ActiveLayerLine->setText(string); - ActiveLayerLine->setFixedSize(Buttonsize.width() * 2 + 10,(Buttonsize.height() * 2) / 3); + ActiveLayerLabel->setText(string); + ActiveLayerLabel->setFixedSize(Buttonsize.width() * 2 + 10,(Buttonsize.height() * 2) / 3); IntelliImage* activePicture = paintingArea->getImageOfActiveLayer(); if(activePicture) { @@ -837,7 +837,7 @@ void IntelliPhotoGui::createGui(){ mainLayout->addWidget(FirstColorButton,9,2,1,1); mainLayout->addWidget(SecondColorButton,9,3,1,1); mainLayout->addWidget(SwitchColorButton,10,2,1,2); - mainLayout->addWidget(ActiveLayerLine,11,2,1,2); + mainLayout->addWidget(ActiveLayerLabel,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); @@ -923,7 +923,7 @@ void IntelliPhotoGui::setToolWidth(int value){ void IntelliPhotoGui::UpdateGui(){ QString string = QString("Active Layer: %1").arg(paintingArea->getIndexOfActiveLayer() + 1); - ActiveLayerLine->setText(string); + ActiveLayerLabel->setText(string); IntelliImage* activePicture = paintingArea->getImageOfActiveLayer(); if(activePicture) { diff --git a/src/GUI/IntelliPhotoGui.h b/src/GUI/IntelliPhotoGui.h index 25f6145..434d3a2 100644 --- a/src/GUI/IntelliPhotoGui.h +++ b/src/GUI/IntelliPhotoGui.h @@ -43,8 +43,15 @@ public: */ IntelliPhotoGui(); +/*! + * \brief UpdateGui a function to update all gui elements. + */ void UpdateGui(); +/*! + * \brief setToolWidth stes a width to the tool + * \param value - the width of the tool + */ void setToolWidth(int value); protected: @@ -54,182 +61,591 @@ protected: void closeEvent(QCloseEvent*event) override; private slots: + +/*! + * \brief slotOpen opens a new image + */ void slotOpen(); + +/*! + * \brief slotSave saves the current canvas + */ void slotSave(); -// layer slots here +/*! + * \brief slotCreateNewRasterLayer creates a new rasterImage + */ void slotCreateNewRasterLayer(); + +/*! + * \brief slotCreateNewShapedLayer creates a new shapedImage + */ void slotCreateNewShapedLayer(); + +/*! + * \brief slotDeleteLayer deletes a layer + */ void slotDeleteLayer(); + +/*! + * \brief slotSetActiveLayer sets a layer to be active + */ void slotSetActiveLayer(); + +/*! + * \brief slotSetActiveAlpha stes the alpha value of the active layer + */ void slotSetActiveAlpha(); + +/*! + * \brief slotSetPolygon sets a polygon to the active layer + */ void slotSetPolygon(); + +/*! + * \brief slotPositionMoveUp moves the current layer to the front + */ void slotPositionMoveUp(); + +/*! + * \brief slotPositionMoveDown moves the crrent layer to the back + */ void slotPositionMoveDown(); + +/*! + * \brief slotPositionMoveLeft moves the current layer left + */ void slotPositionMoveLeft(); + +/*! + * \brief slotPositionMoveRight moves the current layer right + */ void slotPositionMoveRight(); + +/*! + * \brief slotMoveLayerUp moves the current layer up + */ void slotMoveLayerUp(); + +/*! + * \brief slotMoveLayerDown moves the current layer down + */ void slotMoveLayerDown(); -void slotUpdateRenderSettingsOn(); -void slotUpdateRenderSettingsOff(); +/*! + * \brief slotUpdateFastRenderSettingsOn activates the fast renderer + */ +void slotUpdateFastRenderSettingsOn(); +/*! + * \brief slotUpdateFastRenderSettingsOff deactivates the fast render + */ +void slotUpdateFastRenderSettingsOff(); + +/*! + * \brief slotSetFirstColor sets the first color + */ void slotSetFirstColor(); + +/*! + * \brief slotSetSecondColor sets the second color + */ void slotSetSecondColor(); + +/*! + * \brief slotSwapColor swaps first and second color + */ void slotSwapColor(); +/*! + * \brief slotCreatePenTool creates the pen tool + */ void slotCreatePenTool(); + +/*! + * \brief slotCreatePlainTool creates the plain tool + */ void slotCreatePlainTool(); + +/*! + * \brief slotCreateLineTool creates the line tool + */ void slotCreateLineTool(); + +/*! + * \brief slotCreateRectangleTool creates the rectangle tool + */ void slotCreateRectangleTool(); + +/*! + * \brief slotCreateCircleTool creates the cricle tool + */ void slotCreateCircleTool(); + +/*! + * \brief slotCreatePolygonTool creates the polygon tool + */ void slotCreatePolygonTool(); + +/*! + * \brief slotCreateFloodFillTool creates the floodfill tool + */ void slotCreateFloodFillTool(); + +/*! + * \brief slotCreateGradientTool creates the gradient tool + */ void slotCreateGradientTool(); +/*! + * \brief slotAboutDialog displays the about dialog + */ void slotAboutDialog(); +/*! + * \brief slotChangeDim changes the dimension of the canvas + */ void slotChangeDim(); +/*! + * \brief slotEnterPressed read current input of input boxes, and adjusts settings + */ void slotEnterPressed(); +/*! + * \brief slotSetWidth sets the width of the tool + */ void slotSetWidth(); + +/*! + * \brief slotSetInnerAlpha sets the inner alpha of the tool + */ void slotSetInnerAlpha(); -void slotResetTools(); +/*! + * \brief slotResetTools resets all tool Buttons to unclikced + */ +void slotResetToolButtons(); +/*! + * \brief slotGoBack undoes the last action + */ void slotGoBack(); + +/*! + * \brief slotGoForward redoes the last action + */ void slotGoForward(); private: -//setup functions for gui +/*! + * \brief createActions creates all actions + */ void createActions(); + +/*! + * \brief createMenus creates all menus + */ void createMenus(); + +/*! + * \brief createGui sets up the gui + */ void createGui(); + +/*! + * \brief setIntelliStyle sets the stylesheet of the gui + */ void setIntelliStyle(); -// Will check if changes have occurred since last save +/*! + * \brief maybeSave chekcs if the canvas has unsaved work + * \return return true if there is unsaved work, false otherwise + */ bool maybeSave(); -// Opens the Save dialog and saves + +/*! + * \brief saveFile saves the canvas + * \param fileFormat the ileformat to save into + * \return true if saving worked, false otherwise + */ bool saveFile(const QByteArray &fileFormat); -//basic to set tool values to begin +/*! + * \brief setDefaultValues sets basic tool values + */ void setDefaultValues(); -// What we'll draw on +/*! + * \brief paintingArea the logic manager of the backbone + */ PaintingArea* paintingArea; -//used to display a preview of the active layer +/*! + * \brief preview a small pixmap to show the active layer + */ QPixmap preview; -//size of all buttons +/*! + * \brief Buttonsize the size of all standard buttons + */ const QSize Buttonsize = QSize(35,35); -//buttons used for gui +/*! + * \brief CircleButton for creating a circle Tool + */ QPushButton* CircleButton; + +/*! + * \brief FloodFillButton for creating a floodfill Tool + */ QPushButton* FloodFillButton; + +/*! + * \brief GradientButton for creating a gradient Tool + */ QPushButton* GradientButton; + +/*! + * \brief LineButton for creating a line Tool. + */ QPushButton* LineButton; + +/*! + * \brief PenButton for creating a pen tool. + */ QPushButton* PenButton; + +/*! + * \brief PlainButton for creating a plain Tool. + */ QPushButton* PlainButton; + +/*! + * \brief PolygonButton for creating a Polygon Tool. + */ QPushButton* PolygonButton; + +/*! + * \brief RectangleButton for creating a Rectangle Tool. + */ QPushButton* RectangleButton; + +/*! + * \brief FirstColorButton for setting the First color. + */ QPushButton* FirstColorButton; + +/*! + * \brief SecondColorButton for setting the Second color. + */ QPushButton* SecondColorButton; + +/*! + * \brief SwitchColorButton for switching second and first color + */ QPushButton* SwitchColorButton; + +/*! + * \brief dimActive for displaying the dimesnion of the active layer + */ QPushButton* dimActive; + +/*! + * \brief dimCanvas for displaying the dimension of the canvas + */ QPushButton* dimCanvas; -//labels used for gui +/*! + * \brief WidthLine to indicate the line width + */ QLabel* WidthLine; + +/*! + * \brief innerAlphaLine to indicate the inner alpha + */ QLabel* innerAlphaLine; -QLabel* ActiveLayerLine; + +/*! + * \brief ActiveLayerLine to indicate the active Layer + */ +QLabel* ActiveLayerLabel; + +/*! + * \brief ActiveLayerImageLabel to indicate the active Image + */ QLabel* ActiveLayerImageLabel; + +/*! + * \brief FastRendererLabel to indicate render settings + */ QLabel* FastRendererLabel; -//scroll area to display canvas +/*! + * \brief ScrollArea to scroll the painting area on + */ QScrollArea* ScrollArea; -//line edits used for gui +/*! + * \brief EditLineWidth to get the input of the line width + */ QLineEdit* EditLineWidth; + +/*! + * \brief EditLineInnerAlpha to get the input of the inner alpha + */ QLineEdit* EditLineInnerAlpha; -//int validator used for gui +/*! + * \brief ValidatorLineWidth to limit input + */ QIntValidator* ValidatorLineWidth; + +/*! + * \brief ValidatorInnerAlpha to limit input + */ QIntValidator* ValidatorInnerAlpha; -// The menu widgets +/*! + * \brief saveAsMenu to display save options + */ QMenu* saveAsMenu; + +/*! + * \brief fileMenu to display file options + */ QMenu* fileMenu; + +/*! + * \brief renderMenu to display render options + */ QMenu* renderMenu; + +/*! + * \brief optionMenu to display general options + */ QMenu* optionMenu; + +/*! + * \brief layerCreationMenu to display layer creation options + */ QMenu* layerCreationMenu; + +/*! + * \brief layerMenu to display layer options + */ QMenu* layerMenu; + +/*! + * \brief colorMenu to display color options + */ QMenu* colorMenu; + +/*! + * \brief toolCreationMenu to display tool creation options + */ QMenu* toolCreationMenu; + +/*! + * \brief toolSettingsMenu to display settings options + */ QMenu* toolSettingsMenu; + +/*! + * \brief toolMenu to display tool options + */ QMenu* toolMenu; + +/*! + * \brief helpMenu to display the help options + */ QMenu* helpMenu; -// All the actions that can occur -// meta image actions (need further modularisation) +/*! + * \brief actionOpen to open a project + */ QAction* actionOpen; + +/*! + * \brief actionExit to exit the project + */ QAction* actionExit; -//Rendersetting actions -QAction*actionUpdateRenderSettingsOn; -QAction*actionUpdateRenderSettingsOff; +/*! + * \brief actionUpdateFastRenderSettingsOn to set fast render settings to on + */ +QAction* actionUpdateFastRenderSettingsOn; -// color Picker actions +/*! + * \brief actionUpdateFastRenderSettingsOff to set fast render settings to false; + */ +QAction* actionUpdateFastRenderSettingsOff; + +/*! + * \brief actionColorPickerFirstColor to set the first color + */ QAction* actionColorPickerFirstColor; + +/*! + * \brief actionColorPickerSecondColor to set the second color + */ QAction* actionColorPickerSecondColor; + +/*! + * \brief actionColorSwap to swap first and second color + */ QAction* actionColorSwap; -// tool actions +/*! + * \brief actionCreatePenTool to create a pen tool + */ QAction* actionCreatePenTool; + +/*! + * \brief actionCreatePlainTool to create a plain tool + */ QAction* actionCreatePlainTool; + +/*! + * \brief actionCreateLineTool to create a line tool + */ QAction* actionCreateLineTool; + +/*! + * \brief actionCreateRectangleTool to create a rectangle tool + */ QAction* actionCreateRectangleTool; + +/*! + * \brief actionCreateCircleTool to create a circle tool + */ QAction* actionCreateCircleTool; + +/*! + * \brief actionCreatePolygonTool to create a polygon tool + */ QAction* actionCreatePolygonTool; + +/*! + * \brief actionCreateFloodFillTool to create a floodfill tool + */ QAction* actionCreateFloodFillTool; + +/*! + * \brief actionCreateGradientTool to create a gradient tool + */ QAction* actionCreateGradientTool; -// dimension actions +/*! + * \brief actionChangeDim + */ QAction* actionChangeDim; + +/*! + * \brief actionSetWidth to set the width + */ QAction* actionSetWidth; + +/*! + * \brief actionSetInnerAlpha to set the inner alha + */ QAction* actionSetInnerAlpha; -// dialog actions +/*! + * \brief actionAboutDialog to show the + */ QAction* actionAboutDialog; + +/*! + * \brief actionAboutQtDialog to show the qt input dialog + */ QAction* actionAboutQtDialog; -// layer change actions +/*! + * \brief actionCreateNewRasterLayer creates a raster image + */ QAction* actionCreateNewRasterLayer; + +/*! + * \brief actionCreateNewShapedLayer creates a shaped image + */ QAction* actionCreateNewShapedLayer; + +/*! + * \brief actionDeleteLayer deletes a layer + */ QAction* actionDeleteLayer; + +/*! + * \brief actionSetActiveLayer sets a layer to active + */ QAction* actionSetActiveLayer; + +/*! + * \brief actionSetActiveAlpha sets the alpha of the active layer + */ QAction* actionSetActiveAlpha; + +/*! + * \brief actionSetPolygon sets the polygon data to the image + */ QAction* actionSetPolygon; + +/*! + * \brief actionMovePositionUp moves the image up + */ QAction* actionMovePositionUp; + +/*! + * \brief actionMovePositionDown moves the image down + */ QAction* actionMovePositionDown; + +/*! + * \brief actionMovePositionLeft moves the image left + */ QAction* actionMovePositionLeft; + +/*! + * \brief actionMovePositionRight moves the image right + */ QAction* actionMovePositionRight; + +/*! + * \brief actionMoveLayerUp moves the layer to the front + */ QAction* actionMoveLayerUp; + +/*! + * \brief actionMoveLayerDown moves the layer to the back + */ QAction* actionMoveLayerDown; -// actions tied to specific file formats +/*! + * \brief actionSaveAs saves the project as + */ QList actionSaveAs; - -// history actions +/*! + * \brief actionGoBack does a undo action + */ QAction* actionGoBack; + +/*! + * \brief actionGoForward does a redo action + */ QAction* actionGoForward; -// main GUI elements +/*! + * \brief centralGuiWidget the main gui widget to place all others on + */ QWidget* centralGuiWidget; + +/*! + * \brief mainLayout the layout to order all gui elements + */ QGridLayout* mainLayout; }; From 00a7046bcd4fdd046ce29e9b403212b31f96cb23 Mon Sep 17 00:00:00 2001 From: Jan Schuffenhauer Date: Thu, 30 Jan 2020 17:43:26 +0100 Subject: [PATCH 22/24] hotfixed wrong slot --- src/GUI/IntelliPhotoGui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index 39e3a20..f09df2a 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -533,7 +533,7 @@ void IntelliPhotoGui::createActions(){ actionCreateGradientTool = new QAction(tr("&Gradient"),this); actionCreateGradientTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_G)); - connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotResetTools())); + connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons())); connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotCreateGradientTool())); // Create about action and tie to IntelliPhotoGui::about() @@ -553,7 +553,7 @@ void IntelliPhotoGui::createActions(){ connect(FloodFillButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); connect(FloodFillButton, SIGNAL(clicked()), this, SLOT(slotCreateFloodFillTool())); - connect(GradientButton, SIGNAL(pressed()), this, SLOT(slotResetTools())); + connect(GradientButton, SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); connect(GradientButton, SIGNAL(clicked()), this, SLOT(slotCreateGradientTool())); connect(LineButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons())); From 370955de85981dcf322572f6a073fcb794ca3100 Mon Sep 17 00:00:00 2001 From: Jonas Mucke Date: Thu, 30 Jan 2020 18:03:55 +0100 Subject: [PATCH 23/24] added to unit test --- src/IntelliUnitTest.pro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/IntelliUnitTest.pro b/src/IntelliUnitTest.pro index d389a8e..ae7efc7 100755 --- a/src/IntelliUnitTest.pro +++ b/src/IntelliUnitTest.pro @@ -24,6 +24,7 @@ SOURCES += tst_unittest.cpp \ Tool/IntelliTool.cpp \ Tool/IntelliToolCircle.cpp \ Tool/IntelliToolFloodFill.cpp \ + Tool/IntelliToolGradient.cpp \ Tool/IntelliToolLine.cpp \ Tool/IntelliToolPen.cpp \ Tool/IntelliToolPlain.cpp \ @@ -35,6 +36,7 @@ DISTFILES += \ icons/circle-tool.svg \ icons/eraser-tool.svg \ icons/flood-fill-tool.svg \ + icons/gradient-tool.svg \ icons/icon.png \ icons/line-tool.svg \ icons/pen-tool.svg \ @@ -57,6 +59,7 @@ HEADERS += \ Tool/IntelliTool.h \ Tool/IntelliToolCircle.h \ Tool/IntelliToolFloodFill.h \ + Tool/IntelliToolGradient.h \ Tool/IntelliToolLine.h \ Tool/IntelliToolPen.h \ Tool/IntelliToolPlain.h \ From 3bac3d85c433147e1edbe097b777ec24444ebf50 Mon Sep 17 00:00:00 2001 From: Jonas Mucke Date: Thu, 30 Jan 2020 18:24:07 +0100 Subject: [PATCH 24/24] hotfix for transparence --- src/Image/IntelliImage.cpp | 12 ++++++------ src/Image/IntelliRasterImage.cpp | 2 +- src/Image/IntelliShapedImage.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Image/IntelliImage.cpp b/src/Image/IntelliImage.cpp index 3ff8b13..b37ee29 100644 --- a/src/Image/IntelliImage.cpp +++ b/src/Image/IntelliImage.cpp @@ -115,13 +115,13 @@ void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& co } void IntelliImage::drawPlain(const QColor& color){ - if(fastRenderering) { - this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32); - } + if(fastRenderering) { + this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32); + } imageData.fill(color); - if(fastRenderering) { - this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); - } + if(fastRenderering) { + this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8); + } } QColor IntelliImage::getPixelColor(QPoint& point){ diff --git a/src/Image/IntelliRasterImage.cpp b/src/Image/IntelliRasterImage.cpp index 7fa51d8..a806616 100644 --- a/src/Image/IntelliRasterImage.cpp +++ b/src/Image/IntelliRasterImage.cpp @@ -23,7 +23,7 @@ IntelliRasterImage::~IntelliRasterImage(){ } IntelliImage* IntelliRasterImage::getDeepCopy(){ - IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), this->fastRenderering); + IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), false); raster->imageData.fill(Qt::transparent); raster->TypeOfImage = ImageType::RASTERIMAGE; return raster; diff --git a/src/Image/IntelliShapedImage.cpp b/src/Image/IntelliShapedImage.cpp index fa869e3..69013b9 100644 --- a/src/Image/IntelliShapedImage.cpp +++ b/src/Image/IntelliShapedImage.cpp @@ -12,7 +12,7 @@ IntelliShapedImage::IntelliShapedImage(int width, int height, bool fastRendererO IntelliShapedImage* IntelliShapedImage::copy(const IntelliShapedImage& image){ this->TypeOfImage = ImageType::SHAPEDIMAGE; - IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), this->fastRenderering); + IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), this->fastRenderering); shaped->imageData.copy(0,0,image.getWidth(),image.getWidth()); return shaped; } @@ -26,7 +26,7 @@ QImage IntelliShapedImage::getDisplayable(int alpha){ } IntelliImage* IntelliShapedImage::getDeepCopy(){ - IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), this->fastRenderering); + IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), false); shaped->setPolygon(this->polygonData); shaped->imageData.fill(Qt::transparent); shaped->TypeOfImage = ImageType::SHAPEDIMAGE;