Merge branch 'dev-rectangle-rename' into 'dev'

Rectangle Refractoring

See merge request creyd/intelliphoto!19
This commit is contained in:
Conrad
2019-12-18 11:43:07 +00:00
4 changed files with 23 additions and 23 deletions

View File

@@ -28,7 +28,7 @@ SOURCES += \
Tool/IntelliToolLine.cpp \ Tool/IntelliToolLine.cpp \
Tool/IntelliToolPen.cpp \ Tool/IntelliToolPen.cpp \
Tool/IntelliToolPlain.cpp \ Tool/IntelliToolPlain.cpp \
Tool/IntelliToolRechteck.cpp \ Tool/IntelliToolRectangle.cpp \
main.cpp main.cpp
HEADERS += \ HEADERS += \
@@ -44,7 +44,7 @@ HEADERS += \
Tool/IntelliToolLine.h \ Tool/IntelliToolLine.h \
Tool/IntelliToolPen.h \ Tool/IntelliToolPen.h \
Tool/IntelliToolPlain.h \ Tool/IntelliToolPlain.h \
Tool/IntelliToolRechteck.h \ Tool/IntelliToolRectangle.h \
Tool/intellitoolcircle.h Tool/intellitoolcircle.h
FORMS += \ FORMS += \

View File

@@ -14,12 +14,12 @@
#include "Tool/IntelliToolPlain.h" #include "Tool/IntelliToolPlain.h"
#include "Tool/IntelliToolLine.h" #include "Tool/IntelliToolLine.h"
#include "Tool/IntelliToolCircle.h" #include "Tool/IntelliToolCircle.h"
#include "Tool/IntelliToolRechteck.h" #include "Tool/IntelliToolRectangle.h"
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent) PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
:QWidget(parent){ :QWidget(parent){
//test yout tool here and reset after accomplished test //test yout tool here and reset after accomplished test
this->Tool = new IntelliToolRechteck(this, &colorPicker); this->Tool = new IntelliToolRectangle(this, &colorPicker);
this->setUp(maxWidth, maxHeight); this->setUp(maxWidth, maxHeight);
//tetsing //tetsing
this->addLayer(200,200,0,0,ImageType::Shaped_Image); this->addLayer(200,200,0,0,ImageType::Shaped_Image);

View File

@@ -1,18 +1,18 @@
#include"IntelliToolRechteck.h" #include"IntelliToolRectangle.h"
#include "Layer/PaintingArea.h" #include "Layer/PaintingArea.h"
#include "QInputDialog" #include "QInputDialog"
IntelliToolRechteck::IntelliToolRechteck(PaintingArea* Area, IntelliColorPicker* colorPicker) IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker)
:IntelliTool(Area, colorPicker){ :IntelliTool(Area, colorPicker){
this->alphaInner = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 0,0,255,1); this->alphaInner = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 0,0,255,1);
this->edgeWidth = QInputDialog::getInt(nullptr,"Outer edge width", "Value:", 0,1,255,1); this->edgeWidth = QInputDialog::getInt(nullptr,"Outer edge width", "Value:", 0,1,255,1);
} }
IntelliToolRechteck::~IntelliToolRechteck(){ IntelliToolRectangle::~IntelliToolRectangle(){
} }
void IntelliToolRechteck::drawRechteck(QPoint otherCornor){ void IntelliToolRectangle::drawRectangle(QPoint otherCornor){
int xMin = std::min(originCornor.x(), otherCornor.x()); int xMin = std::min(originCornor.x(), otherCornor.x());
int xMax = std::max(originCornor.x(), otherCornor.x()); int xMax = std::max(originCornor.x(), otherCornor.x());
@@ -30,36 +30,36 @@ void IntelliToolRechteck::drawRechteck(QPoint otherCornor){
this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), edgeWidth); this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), edgeWidth);
} }
void IntelliToolRechteck::onMouseRightPressed(int x, int y){ void IntelliToolRectangle::onMouseRightPressed(int x, int y){
IntelliTool::onMouseRightPressed(x,y); IntelliTool::onMouseRightPressed(x,y);
} }
void IntelliToolRechteck::onMouseRightReleased(int x, int y){ void IntelliToolRectangle::onMouseRightReleased(int x, int y){
IntelliTool::onMouseRightReleased(x,y); IntelliTool::onMouseRightReleased(x,y);
} }
void IntelliToolRechteck::onMouseLeftPressed(int x, int y){ void IntelliToolRectangle::onMouseLeftPressed(int x, int y){
IntelliTool::onMouseLeftPressed(x,y); IntelliTool::onMouseLeftPressed(x,y);
this->originCornor=QPoint(x,y); this->originCornor=QPoint(x,y);
drawRechteck(originCornor); drawRectangle(originCornor);
Canvas->image->calculateVisiblity(); Canvas->image->calculateVisiblity();
} }
void IntelliToolRechteck::onMouseLeftReleased(int x, int y){ void IntelliToolRectangle::onMouseLeftReleased(int x, int y){
IntelliTool::onMouseLeftReleased(x,y); IntelliTool::onMouseLeftReleased(x,y);
} }
void IntelliToolRechteck::onMouseMoved(int x, int y){ void IntelliToolRectangle::onMouseMoved(int x, int y){
IntelliTool::onMouseMoved(x,y); IntelliTool::onMouseMoved(x,y);
if(this->drawing){ if(this->drawing){
this->Canvas->image->drawPlain(Qt::transparent); this->Canvas->image->drawPlain(Qt::transparent);
QPoint next(x,y); QPoint next(x,y);
drawRechteck(next); drawRectangle(next);
} }
IntelliTool::onMouseMoved(x,y); IntelliTool::onMouseMoved(x,y);
} }
void IntelliToolRechteck::onWheelScrolled(int value){ void IntelliToolRectangle::onWheelScrolled(int value){
IntelliTool::onWheelScrolled(value); IntelliTool::onWheelScrolled(value);
this->edgeWidth+=value; this->edgeWidth+=value;
if(this->edgeWidth<=0){ if(this->edgeWidth<=0){

View File

@@ -1,20 +1,20 @@
#ifndef INTELLIRECHTECKTOOL_H #ifndef INTELLIRECTANGLETOOL_H
#define INTELLIRECHTECKTOOL_H #define INTELLIRECTANGLETOOL_H
#include "IntelliTool.h" #include "IntelliTool.h"
#include "QColor" #include "QColor"
#include "QPoint" #include "QPoint"
class IntelliToolRechteck : public IntelliTool{ class IntelliToolRectangle : public IntelliTool{
void drawRechteck(QPoint otherCornor); void drawRectangle(QPoint otherCornor);
QPoint originCornor; QPoint originCornor;
int alphaInner; int alphaInner;
int edgeWidth; int edgeWidth;
public: public:
IntelliToolRechteck(PaintingArea* Area, IntelliColorPicker* colorPicker); IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker);
virtual ~IntelliToolRechteck() override; virtual ~IntelliToolRectangle() override;
virtual void onMouseRightPressed(int x, int y) override; virtual void onMouseRightPressed(int x, int y) override;
virtual void onMouseRightReleased(int x, int y) override; virtual void onMouseRightReleased(int x, int y) override;
@@ -26,4 +26,4 @@ public:
virtual void onMouseMoved(int x, int y) override; virtual void onMouseMoved(int x, int y) override;
}; };
#endif // INTELLIRECHTECKTOOL_H #endif // INTELLIRECTANGLETOOL_H