Merge remote-tracking branch 'origin/dev_FormTool' into dev

This commit is contained in:
Sonaion
2019-12-12 11:30:26 +01:00
8 changed files with 135 additions and 2 deletions

View File

@@ -14,6 +14,8 @@ class PaintingArea;
class IntelliTool;
class IntelliColorPicker;
class IntelliPhotoGui : public QMainWindow
{
// Declares our class as a QObject which is the base class
@@ -66,7 +68,6 @@ private:
// What we'll draw on
PaintingArea* paintingArea;
IntelliTool* Tool;
// The menu widgets
QMenu *saveAsMenu;

View File

@@ -0,0 +1,47 @@
#include "IntelliColorPicker.h"
IntelliColorPicker::IntelliColorPicker(PaintingArea* Area){
firstColor = {255,0,0,255};
secondColor = {0,0,255,255};
}
IntelliColorPicker::~IntelliColorPicker(){
}
void IntelliColorPicker::getColorbar(int firstOrSecondColor = 1){
QString Titel;
QColor newColor;
if(firstOrSecondColor == 1){
Titel = "Choose first Color";
newColor = QColorDialog::getColor(this->firstColor,nullptr,Titel);
setFirstColor(newColor);
}
else{
Titel = "Choose second Color";
newColor = QColorDialog::getColor(this->secondColor,nullptr,Titel);
setFirstColor(newColor);
}
}
void IntelliColorPicker::switchColors(){
QColor temp = this->firstColor;
this->firstColor = this->secondColor;
this->secondColor = temp;
}
QColor IntelliColorPicker::getFirstColor(){
return this->firstColor;
}
QColor IntelliColorPicker::getSecondColor(){
return this->secondColor;
}
void IntelliColorPicker::setFirstColor(QColor Color){
this->firstColor = Color;
}
void IntelliColorPicker::setSecondColor(QColor Color){
this->secondColor = Color;
}

View File

@@ -0,0 +1,28 @@
#ifndef INTELLITOOLSETCOLORTOOL_H
#define INTELLITOOLSETCOLORTOOL_H
#include"Layer/PaintingArea.h"
#include"QColor"
#include"QPoint"
#include"QColorDialog"
class IntelliColorPicker{
public:
IntelliColorPicker(PaintingArea *Area);
virtual ~IntelliColorPicker();
void getColorbar(int firstOrSecondColor);
void switchColors();
QColor getFirstColor();
QColor getSecondColor();
void setFirstColor(QColor Color);
void setSecondColor(QColor Color);
private:
QColor firstColor;
QColor secondColor;
};
#endif // INTELLITOOLSETCOLORTOOL_H

View File

@@ -20,6 +20,7 @@ SOURCES += \
Image/IntelliImage.cpp \
Image/IntelliRasterImage.cpp \
Image/IntelliShapedImage.cpp \
IntelliHelper/IntelliColorPicker.cpp \
IntelliHelper/IntelliHelper.cpp \
Layer/PaintingArea.cpp \
Tool/IntelliTool.cpp \
@@ -33,6 +34,7 @@ HEADERS += \
Image/IntelliImage.h \
Image/IntelliRasterImage.h \
Image/IntelliShapedImage.h \
IntelliHelper/IntelliColorPicker.h \
IntelliHelper/IntelliHelper.h \
Layer/PaintingArea.h \
Tool/IntelliTool.h \

View File

@@ -37,6 +37,22 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
}
void PaintingArea::switchColors(){
ColorTool->switchColors();
}
void PaintingArea::createPenTool(){
IntelliTool *temp = this->Tool;
this->Tool = new IntelliToolPen(this);
delete temp;
}
void PaintingArea::createFloodFillTool(){
IntelliTool *temp = this->Tool;
this->Tool = new IntelliToolFloodFillTool(this);
delete temp;
}
void PaintingArea::setUp(int maxWidth, int maxHeight){
//set standart parameter
this->maxWidth = maxWidth;

View File

@@ -8,6 +8,8 @@
#include <QWidget>
#include <QList>
#include "Image/IntelliImage.h"
#include "Image/IntelliRasterImage.h"
#include "Image/IntelliShapedImage.h"
#include "Tool/IntelliTool.h"
@@ -22,6 +24,8 @@ struct LayerObject{
};
class IntelliColorPicker;
class PaintingArea : public QWidget
{
// Declares our class as a QObject which is the base class

View File

@@ -0,0 +1,36 @@
#include "IntelliColorPicker.h"
#include "QDebug"
IntelliColorPicker::IntelliColorPicker(PaintingArea* Area)
:IntelliTool(Area){
firstColor = {255,0,0,255};
secondColor = {0,0,255,255};
}
IntelliColorPicker::~IntelliColorPicker(){
}
void IntelliColorPicker::getColorbar(int firstOrSecondColor = 1){
QString Titel;
QColor newColor;
if(firstOrSecondColor == 1){
Titel = "Choose first Color";
newColor = QColorDialog::getColor(this->firstColor,nullptr,Titel);
this->firstColor = newColor;
qDebug() << "Firstcolor" << this->firstColor;
}
else{
Titel = "Choose second Color";
newColor = QColorDialog::getColor(this->secondColor,nullptr,Titel);
this->secondColor = newColor;
}
}
QColor IntelliColorPicker::getFirstColor(){
return firstColor;
}
QColor IntelliColorPicker::getSecondColor(){
return secondColor;
}

View File

@@ -21,7 +21,6 @@ public:
IntelliTool(PaintingArea* Area);
virtual ~IntelliTool() = 0;
virtual void onMouseRightPressed(int x, int y);
virtual void onMouseRightReleased(int x, int y);
virtual void onMouseLeftPressed(int x, int y);