mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-12 19:40:28 +02:00
Merge remote-tracking branch 'origin/dev_FormTool' into dev
This commit is contained in:
@@ -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;
|
||||
|
||||
47
src/Painting/IntelliHelper/IntelliColorPicker.cpp
Normal file
47
src/Painting/IntelliHelper/IntelliColorPicker.cpp
Normal 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;
|
||||
}
|
||||
28
src/Painting/IntelliHelper/IntelliColorPicker.h
Normal file
28
src/Painting/IntelliHelper/IntelliColorPicker.h
Normal 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
|
||||
@@ -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 \
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
36
src/Painting/Tool/IntelliColorPicker.cpp
Normal file
36
src/Painting/Tool/IntelliColorPicker.cpp
Normal 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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user