From a099b2e9160df790c0bd816f4a01471655a5fa60 Mon Sep 17 00:00:00 2001 From: Conrad Date: Thu, 16 Jan 2020 11:35:58 +0100 Subject: [PATCH] Automated Merge Preparation --- cppcheck_config.txt | 6 ++ cppcheck_errors.txt | 18 ++--- releaseprep.sh | 4 -- src/GUI/IntelliInputDialog.cpp | 84 +++++++++++------------ src/IntelliHelper/IntelliToolsettings.cpp | 28 ++++---- src/Layer/PaintingArea.cpp | 10 +-- src/Tool/IntelliTool.cpp | 2 +- src/Tool/IntelliToolPolygon.cpp | 24 +++---- src/main.cpp | 2 +- 9 files changed, 90 insertions(+), 88 deletions(-) diff --git a/cppcheck_config.txt b/cppcheck_config.txt index 65db50d..6f6a929 100644 --- a/cppcheck_config.txt +++ b/cppcheck_config.txt @@ -1,3 +1,9 @@ +src/GUI/IntelliInputDialog.h:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ +src/GUI/IntelliInputDialog.cpp:2:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] + +^ src/GUI/IntelliPhotoGui.h:4:0: information: Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem] ^ diff --git a/cppcheck_errors.txt b/cppcheck_errors.txt index 0276a5e..bf06cfd 100644 --- a/cppcheck_errors.txt +++ b/cppcheck_errors.txt @@ -7,7 +7,7 @@ src/IntelliHelper/IntelliColorPicker.cpp:5:3: performance: Variable 'secondColor src/IntelliHelper/IntelliTriangulation.cpp:116:63: style: Parameter 'triangles' can be declared with const [constParameter] bool IntelliTriangulation::isInPolygon(std::vector &triangles, QPoint &point){ ^ -src/Layer/PaintingArea.cpp:334:22: style: Redundant condition: If 'activeLayer > 0', the comparison 'activeLayer != -1' is always true. [redundantCondition] +src/Layer/PaintingArea.cpp:344:22: style: Redundant condition: If 'activeLayer > 0', the comparison 'activeLayer != -1' is always true. [redundantCondition] if(activeLayer!=-1 && activeLayer>0) { ^ src/Tool/IntelliTool.cpp:4:14: warning: Member variable 'IntelliTool::ActiveType' is not initialized in the constructor. [uninitMemberVar] @@ -49,31 +49,31 @@ bool isDrawing; src/GUI/IntelliPhotoGui.cpp:23:0: style: The function 'closeEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:261:0: style: The function 'mouseMoveEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:271:0: style: The function 'mouseMoveEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:242:0: style: The function 'mousePressEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:252:0: style: The function 'mousePressEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:274:0: style: The function 'mouseReleaseEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:284:0: style: The function 'mouseReleaseEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:304:0: style: The function 'paintEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:314:0: style: The function 'paintEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:315:0: style: The function 'resizeEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:325:0: style: The function 'resizeEvent' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:320:0: style: The function 'resizeLayer' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:330:0: style: The function 'resizeLayer' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:168:0: style: The function 'slotActivateLayer' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:170:0: style: The function 'slotActivateLayer' is never used. [unusedFunction] ^ src/Layer/PaintingArea.cpp:88:0: style: The function 'slotDeleteActiveLayer' is never used. [unusedFunction] ^ -src/Layer/PaintingArea.cpp:289:0: style: The function 'wheelEvent' is never used. [unusedFunction] +src/Layer/PaintingArea.cpp:299:0: style: The function 'wheelEvent' is never used. [unusedFunction] ^ nofile:0:0: information: Cppcheck cannot find all the include files (use --check-config for details) [missingInclude] diff --git a/releaseprep.sh b/releaseprep.sh index 5392a6f..53956b2 100755 --- a/releaseprep.sh +++ b/releaseprep.sh @@ -11,10 +11,6 @@ echo "CPPCheck finished" echo "Running Uncrustify..." find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) -exec uncrustify -c conf/uncrustify.cfg --no-backup {} + echo "Uncrustify finished." -# Run Unit Tests -echo "Running unit tests..." - -echo "Finished unit testing." # Remove Overhead Folders/ Files echo "Cleaning directory..." rm -r src/build-* diff --git a/src/GUI/IntelliInputDialog.cpp b/src/GUI/IntelliInputDialog.cpp index 8ed0465..2b2ac32 100644 --- a/src/GUI/IntelliInputDialog.cpp +++ b/src/GUI/IntelliInputDialog.cpp @@ -4,83 +4,83 @@ IntelliInputDialog::IntelliInputDialog(QString Title, QString Label, int value, int minValue, int maxValue, int step, bool* ok) { - this->valueInt = value; - this->notClosed = ok; - if(notClosed != nullptr){ - *notClosed = false; - } + this->valueInt = value; + this->notClosed = ok; + if(notClosed != nullptr) { + *notClosed = false; + } createInputBox(Title, Label, value, minValue, maxValue, step); - createConnections(); + createConnections(); setInputBoxStyle(); - this->exec(); + this->exec(); } int IntelliInputDialog::getInt(QString Title, QString Label, int value, int minValue, int maxValue, int step, bool* ok){ - IntelliInputDialog dialog(Title, Label, value, minValue, maxValue, step, ok); - return dialog.valueInt; + IntelliInputDialog dialog(Title, Label, value, minValue, maxValue, step, ok); + return dialog.valueInt; } void IntelliInputDialog::createInputBox(QString Title, QString Label, int value, int minValue, int maxValue, int step){ - this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); + this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); if(Title == nullptr) { - this->setWindowTitle("Input Box"); + this->setWindowTitle("Input Box"); } else{ - this->setWindowTitle(Title); + this->setWindowTitle(Title); } - this->Layout = new QGridLayout(); - this->ButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + this->Layout = new QGridLayout(); + this->ButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - this->InputLabel = new QLabel(); + this->InputLabel = new QLabel(); if(Label == nullptr) { - this->InputLabel->setText("Width:"); + this->InputLabel->setText("Width:"); } else{ - this->InputLabel->setText(Label); + this->InputLabel->setText(Label); } - this->InputLabel->setFixedSize(Linesize); + this->InputLabel->setFixedSize(Linesize); - this->Input = new QSpinBox(); - this->Input->setFixedSize(Linesize); - this->Input->setRange(minValue,maxValue); - this->Input->setSingleStep(step); - this->Input->setValue(value); + this->Input = new QSpinBox(); + this->Input->setFixedSize(Linesize); + this->Input->setRange(minValue,maxValue); + this->Input->setSingleStep(step); + this->Input->setValue(value); - this->okButton = ButtonBox->button(QDialogButtonBox::Ok); - this->okButton->setFixedSize(Buttonsize); - this->okButton->setAutoDefault(false); - this->okButton->setDefault(false); + this->okButton = ButtonBox->button(QDialogButtonBox::Ok); + this->okButton->setFixedSize(Buttonsize); + this->okButton->setAutoDefault(false); + this->okButton->setDefault(false); - this->cancelButton = ButtonBox->button(QDialogButtonBox::Cancel); - this->cancelButton->setFixedSize(Buttonsize); - this->cancelButton->setAutoDefault(false); - this->cancelButton->setDefault(false); + this->cancelButton = ButtonBox->button(QDialogButtonBox::Cancel); + this->cancelButton->setFixedSize(Buttonsize); + this->cancelButton->setAutoDefault(false); + this->cancelButton->setDefault(false); Layout->addWidget(InputLabel,1,1,1,1); Layout->addWidget(Input,2,1,1,1); Layout->addWidget(ButtonBox,3,1,1,1); - this->setLayout(Layout); - this->resize(172,94); - this->show(); + this->setLayout(Layout); + this->resize(172,94); + this->show(); } void IntelliInputDialog::createConnections(){ - connect(okButton, SIGNAL(clicked()), this, SLOT(slotEingabe())); + connect(okButton, SIGNAL(clicked()), this, SLOT(slotEingabe())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(slotCloseEvent())); } void IntelliInputDialog::setInputBoxStyle(){ - this->setStyleSheet("color: white;" "background-color: rgb(64, 64, 64);" "selection-color: rgb(200, 10, 10);" "selection-background-color: rgb(64, 64, 64);"); + this->setStyleSheet("color: white;" "background-color: rgb(64, 64, 64);" "selection-color: rgb(200, 10, 10);" "selection-background-color: rgb(64, 64, 64);"); } void IntelliInputDialog::slotCloseEvent(){ - this->close(); + this->close(); } void IntelliInputDialog::slotEingabe(){ - valueInt = QString("%1").arg(Input->value()).toInt(); - if(notClosed != nullptr){ - *notClosed = true; - } - this->close(); + valueInt = QString("%1").arg(Input->value()).toInt(); + if(notClosed != nullptr) { + *notClosed = true; + } + this->close(); } diff --git a/src/IntelliHelper/IntelliToolsettings.cpp b/src/IntelliHelper/IntelliToolsettings.cpp index 07da575..c6a7cfc 100644 --- a/src/IntelliHelper/IntelliToolsettings.cpp +++ b/src/IntelliHelper/IntelliToolsettings.cpp @@ -16,13 +16,13 @@ int IntelliToolsettings::getLineWidth(){ } void IntelliToolsettings::setLineWidth(int LineWidth){ - if(LineWidth < 1){ - LineWidth = 1; - } - else if(LineWidth > 50){ - LineWidth = 50; - } - lineWidth = LineWidth; + if(LineWidth < 1) { + LineWidth = 1; + } + else if(LineWidth > 50) { + LineWidth = 50; + } + lineWidth = LineWidth; } int IntelliToolsettings::getInnerAlpha(){ @@ -30,11 +30,11 @@ int IntelliToolsettings::getInnerAlpha(){ } void IntelliToolsettings::setInnerAlpha(int innerAlpha){ - if(innerAlpha < 0){ - innerAlpha = 0; - } - else if(innerAlpha > 255){ - innerAlpha = 255; - } - this->innerAlpha = innerAlpha; + if(innerAlpha < 0) { + innerAlpha = 0; + } + else if(innerAlpha > 255) { + innerAlpha = 255; + } + this->innerAlpha = innerAlpha; } diff --git a/src/Layer/PaintingArea.cpp b/src/Layer/PaintingArea.cpp index 57b9ece..0b5913e 100644 --- a/src/Layer/PaintingArea.cpp +++ b/src/Layer/PaintingArea.cpp @@ -32,7 +32,7 @@ PaintingArea::~PaintingArea(){ } void PaintingArea::setRenderSettings(bool isFastRenderingOn){ - if(isFastRenderingOn != renderSettings.isFastRenderering() && !Tool->getIsDrawing()) { + if(isFastRenderingOn != renderSettings.isFastRenderering() && !Tool->getIsDrawing()) { renderSettings.setFastRendering(isFastRenderingOn); for(auto& layer : layerBundle) { layer.image->updateRendererSetting(isFastRenderingOn); @@ -110,7 +110,7 @@ void PaintingArea::setPolygon(int idx){ delete this->Tool; this->Tool = new IntelliToolPolygon(this,&colorPicker,&Toolsettings, true); isSettingPolygon = true; - this->DummyGui->setToolWidth(5); + this->DummyGui->setToolWidth(5); } } } @@ -164,7 +164,7 @@ void PaintingArea::moveActiveLayer(int idx){ }else if(idx==-1) { this->selectLayerDown(); } - DummyGui->UpdateGui(); + DummyGui->UpdateGui(); } void PaintingArea::slotActivateLayer(int a){ @@ -231,11 +231,11 @@ int PaintingArea::getHeightOfActive(){ } int PaintingArea::getMaxWidth(){ - return this->maxWidth; + return this->maxWidth; } int PaintingArea::getMaxHeight(){ - return this->maxHeight; + return this->maxHeight; } IntelliImage::ImageType PaintingArea::getTypeOfImageRealLayer(){ diff --git a/src/Tool/IntelliTool.cpp b/src/Tool/IntelliTool.cpp index 0b9168c..9b9ffc1 100644 --- a/src/Tool/IntelliTool.cpp +++ b/src/Tool/IntelliTool.cpp @@ -47,7 +47,7 @@ void IntelliTool::onMouseMoved(int x, int y){ void IntelliTool::onWheelScrolled(int value){ //if needed for future general tasks implement in here - Area->DummyGui->setToolWidth(value+Toolsettings->getLineWidth()); + Area->DummyGui->setToolWidth(value + Toolsettings->getLineWidth()); } bool IntelliTool::createToolLayer(){ diff --git a/src/Tool/IntelliToolPolygon.cpp b/src/Tool/IntelliToolPolygon.cpp index 4325ac1..9b21fe9 100644 --- a/src/Tool/IntelliToolPolygon.cpp +++ b/src/Tool/IntelliToolPolygon.cpp @@ -10,9 +10,9 @@ IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* c isDrawing = false; isInside = false; this->isSettingPolygon = isSettingPolygon; - if(isSettingPolygon){ - Toolsettings->setLineWidth(5); - } + if(isSettingPolygon) { + Toolsettings->setLineWidth(5); + } this->ActiveType = Tooltype::POLYGON; } @@ -124,18 +124,18 @@ void IntelliToolPolygon::onMouseRightReleased(int x, int y){ } void IntelliToolPolygon::onWheelScrolled(int value){ - if(!isSettingPolygon){ - IntelliTool::onWheelScrolled(value); - if(!isDrawing) { - Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value); - } - } + if(!isSettingPolygon) { + IntelliTool::onWheelScrolled(value); + if(!isDrawing) { + Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value); + } + } } void IntelliToolPolygon::onMouseMoved(int x, int y){ - if(!isSettingPolygon){ - IntelliTool::onMouseMoved(x,y); - } + if(!isSettingPolygon) { + IntelliTool::onMouseMoved(x,y); + } } bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){ diff --git a/src/main.cpp b/src/main.cpp index 9eec82f..30adab2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,7 +8,7 @@ int main(int argc, char*argv[]){ QApplication app(argc, argv); // Create and open the main window - IntelliPhotoGui window; + IntelliPhotoGui window; window.show(); return app.exec();