Uncrustified Commits and Updated Errors

This commit is contained in:
2020-01-15 14:48:50 +01:00
parent 1f0b856079
commit cf3c542250
6 changed files with 205 additions and 214 deletions

View File

@@ -1,6 +1,3 @@
src/GUI/IntelliPhotoGui.cpp:83:15: style: Variable 'layer' is assigned a value that is never used. [unreadVariable]
int layer = paintingArea->addLayer(width,height,0,0);
^
src/IntelliHelper/IntelliColorPicker.cpp:4:3: performance: Variable 'firstColor' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList] src/IntelliHelper/IntelliColorPicker.cpp:4:3: performance: Variable 'firstColor' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
firstColor = {255,0,0,255}; firstColor = {255,0,0,255};
^ ^
@@ -10,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] src/IntelliHelper/IntelliTriangulation.cpp:116:63: style: Parameter 'triangles' can be declared with const [constParameter]
bool IntelliTriangulation::isInPolygon(std::vector<Triangle> &triangles, QPoint &point){ bool IntelliTriangulation::isInPolygon(std::vector<Triangle> &triangles, QPoint &point){
^ ^
src/Layer/PaintingArea.cpp:335:22: style: Redundant condition: If 'activeLayer > 0', the comparison 'activeLayer != -1' is always true. [redundantCondition] src/Layer/PaintingArea.cpp:334:28: style: Redundant condition: If 'activeLayer > 0', the comparison 'activeLayer != -1' is always true. [redundantCondition]
if(activeLayer!=-1 && activeLayer>0) { if(activeLayer!=-1 && activeLayer>0) {
^ ^
src/Tool/IntelliTool.cpp:4:14: warning: Member variable 'IntelliTool::ActiveType' is not initialized in the constructor. [uninitMemberVar] src/Tool/IntelliTool.cpp:4:14: warning: Member variable 'IntelliTool::ActiveType' is not initialized in the constructor. [uninitMemberVar]
@@ -22,34 +19,31 @@ IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, In
src/Tool/IntelliTool.cpp:4:14: warning: Member variable 'IntelliTool::Canvas' is not initialized in the constructor. [uninitMemberVar] src/Tool/IntelliTool.cpp:4:14: warning: Member variable 'IntelliTool::Canvas' is not initialized in the constructor. [uninitMemberVar]
IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){ IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){
^ ^
src/Tool/IntelliToolCircle.cpp:43:9: style: Local variable 'yMin' shadows outer variable [shadowVariable] src/Tool/IntelliToolCircle.cpp:42:9: style: Local variable 'yMin' shadows outer variable [shadowVariable]
int yMin = static_cast<int>(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2))); int yMin = static_cast<int>(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
^ ^
src/Tool/IntelliToolCircle.cpp:19:7: note: Shadowed declaration src/Tool/IntelliToolCircle.cpp:18:7: note: Shadowed declaration
int yMin, yMax, xMin, xMax;
^
src/Tool/IntelliToolCircle.cpp:42:9: note: Shadow variable
int yMin = static_cast<int>(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
^
src/Tool/IntelliToolCircle.cpp:43:9: style: Local variable 'yMax' shadows outer variable [shadowVariable]
int yMax = static_cast<int>(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
^
src/Tool/IntelliToolCircle.cpp:18:13: note: Shadowed declaration
int yMin, yMax, xMin, xMax; int yMin, yMax, xMin, xMax;
^ ^
src/Tool/IntelliToolCircle.cpp:43:9: note: Shadow variable src/Tool/IntelliToolCircle.cpp:43:9: note: Shadow variable
int yMin = static_cast<int>(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
^
src/Tool/IntelliToolCircle.cpp:44:9: style: Local variable 'yMax' shadows outer variable [shadowVariable]
int yMax = static_cast<int>(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2))); int yMax = static_cast<int>(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
^ ^
src/Tool/IntelliToolCircle.cpp:19:13: note: Shadowed declaration
int yMin, yMax, xMin, xMax;
^
src/Tool/IntelliToolCircle.cpp:44:9: note: Shadow variable
int yMax = static_cast<int>(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
^
src/Tool/IntelliToolCircle.cpp:16:13: style: Variable 'outer' is assigned a value that is never used. [unreadVariable]
int outer = radius+20;
^
src/Tool/IntelliToolLine.cpp:51:13: style: Variable 'c' is assigned a value that is never used. [unreadVariable] src/Tool/IntelliToolLine.cpp:51:13: style: Variable 'c' is assigned a value that is never used. [unreadVariable]
int c = lineStartingPoint.y()-lineStartingPoint.x()*m; int c = lineStartingPoint.y()-lineStartingPoint.x()*m;
^ ^
src/Tool/IntelliToolPolygon.h:25:6: warning: The class 'IntelliToolPolygon' defines member variable with name 'isDrawing' also defined in its parent class 'IntelliTool'. [duplInheritedMember] src/Tool/IntelliToolPolygon.h:25:6: warning: The class 'IntelliToolPolygon' defines member variable with name 'isDrawing' also defined in its parent class 'IntelliTool'. [duplInheritedMember]
bool isDrawing; bool isDrawing;
^ ^
src/Tool/IntelliTool.h:68:6: note: Parent variable 'IntelliTool::isDrawing' src/Tool/IntelliTool.h:69:6: note: Parent variable 'IntelliTool::isDrawing'
bool isDrawing = false; bool isDrawing = false;
^ ^
src/Tool/IntelliToolPolygon.h:25:6: note: Derived variable 'IntelliToolPolygon::isDrawing' src/Tool/IntelliToolPolygon.h:25:6: note: Derived variable 'IntelliToolPolygon::isDrawing'
@@ -58,34 +52,31 @@ bool isDrawing;
src/GUI/IntelliPhotoGui.cpp:23:0: style: The function 'closeEvent' is never used. [unusedFunction] src/GUI/IntelliPhotoGui.cpp:23:0: style: The function 'closeEvent' is never used. [unusedFunction]
^ ^
src/Layer/PaintingArea.cpp:271:0: style: The function 'mouseMoveEvent' is never used. [unusedFunction] src/Layer/PaintingArea.cpp:261:0: style: The function 'mouseMoveEvent' is never used. [unusedFunction]
^ ^
src/Layer/PaintingArea.cpp:255:0: style: The function 'mousePressEvent' is never used. [unusedFunction] src/Layer/PaintingArea.cpp:242:0: style: The function 'mousePressEvent' is never used. [unusedFunction]
^ ^
src/Layer/PaintingArea.cpp:281:0: style: The function 'mouseReleaseEvent' is never used. [unusedFunction] src/Layer/PaintingArea.cpp:274:0: style: The function 'mouseReleaseEvent' is never used. [unusedFunction]
^ ^
src/Layer/PaintingArea.cpp:307:0: style: The function 'paintEvent' is never used. [unusedFunction] src/Layer/PaintingArea.cpp:304:0: style: The function 'paintEvent' is never used. [unusedFunction]
^ ^
src/Layer/PaintingArea.cpp:318:0: style: The function 'resizeEvent' is never used. [unusedFunction] src/Layer/PaintingArea.cpp:315:0: style: The function 'resizeEvent' is never used. [unusedFunction]
^ ^
src/Layer/PaintingArea.cpp:323:0: style: The function 'resizeLayer' is never used. [unusedFunction] src/Layer/PaintingArea.cpp:320:0: style: The function 'resizeLayer' is never used. [unusedFunction]
^ ^
src/Layer/PaintingArea.cpp:175:0: style: The function 'slotActivateLayer' is never used. [unusedFunction] src/Layer/PaintingArea.cpp:168:0: style: The function 'slotActivateLayer' is never used. [unusedFunction]
^ ^
src/GUI/IntelliPhotoGui.cpp:157:0: style: The function 'slotClearActiveLayer' is never used. [unusedFunction] src/Layer/PaintingArea.cpp:88:0: style: The function 'slotDeleteActiveLayer' is never used. [unusedFunction]
^ ^
src/Layer/PaintingArea.cpp:83: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:294: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] nofile:0:0: information: Cppcheck cannot find all the include files (use --check-config for details) [missingInclude]

View File

@@ -27,7 +27,7 @@ IntelliImage* IntelliShapedImage::getDeepCopy(){
} }
void IntelliShapedImage::calculateVisiblity(){ void IntelliShapedImage::calculateVisiblity(){
if(polygonData.size()<2){ if(polygonData.size()<2) {
return; return;
} }
if(fastRenderering) { if(fastRenderering) {
@@ -94,7 +94,7 @@ void IntelliShapedImage::setPolygon(const std::vector<QPoint>& polygonData){
this->polygonData.push_back(QPoint(element.x(), element.y())); this->polygonData.push_back(QPoint(element.x(), element.y()));
} }
triangles = IntelliTriangulation::calculateTriangles(polygonData); triangles = IntelliTriangulation::calculateTriangles(polygonData);
if(fastRenderering){ if(fastRenderering) {
imageData = imageData.convertToFormat(QImage::Format_ARGB32); imageData = imageData.convertToFormat(QImage::Format_ARGB32);
} }
for(int y = 0; y<imageData.height(); y++) { for(int y = 0; y<imageData.height(); y++) {
@@ -104,7 +104,7 @@ void IntelliShapedImage::setPolygon(const std::vector<QPoint>& polygonData){
imageData.setPixelColor(x,y,clr); imageData.setPixelColor(x,y,clr);
} }
} }
if(fastRenderering){ if(fastRenderering) {
imageData = imageData.convertToFormat(QImage::Format_Indexed8); imageData = imageData.convertToFormat(QImage::Format_Indexed8);
} }
} }

View File

@@ -71,7 +71,7 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff
void PaintingArea::deleteLayer(int idx, bool isTool){ void PaintingArea::deleteLayer(int idx, bool isTool){
if(!isTool){ if(!isTool) {
updateTools(); updateTools();
} }
if(idx<static_cast<int>(layerBundle.size())) { if(idx<static_cast<int>(layerBundle.size())) {
@@ -106,7 +106,7 @@ void PaintingArea::setLayerAlpha(int idx, int alpha){
} }
void PaintingArea::setPolygon(int idx){ void PaintingArea::setPolygon(int idx){
if(idx>=0&&idx<static_cast<int>(layerBundle.size())) { if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
if(layerBundle[static_cast<size_t>(idx)].image->getTypeOfImage()==IntelliImage::ImageType::SHAPEDIMAGE){ if(layerBundle[static_cast<size_t>(idx)].image->getTypeOfImage()==IntelliImage::ImageType::SHAPEDIMAGE) {
delete this->Tool; delete this->Tool;
this->Tool = new IntelliToolPolygon(this,&colorPicker,&Toolsettings, true); this->Tool = new IntelliToolPolygon(this,&colorPicker,&Toolsettings, true);
isSettingPolygon = true; isSettingPolygon = true;
@@ -419,7 +419,7 @@ QImage PaintingArea::getImageDataOfActiveLayer(){
} }
else{ else{
returnImage = layerBundle[static_cast<size_t>(activeLayer)].image->getImageData(); returnImage = layerBundle[static_cast<size_t>(activeLayer)].image->getImageData();
if(renderSettings.isFastRenderering()){ if(renderSettings.isFastRenderering()) {
returnImage = returnImage.convertToFormat(QImage::Format_ARGB32); returnImage = returnImage.convertToFormat(QImage::Format_ARGB32);
} }
} }
@@ -428,12 +428,12 @@ QImage PaintingArea::getImageDataOfActiveLayer(){
void PaintingArea::updateTools(){ void PaintingArea::updateTools(){
if(Tool!=nullptr) { if(Tool!=nullptr) {
if(Tool->getIsDrawing()){ if(Tool->getIsDrawing()) {
IntelliTool* temp = copyActiveTool(); IntelliTool* temp = copyActiveTool();
delete this->Tool; delete this->Tool;
this->Tool = temp; this->Tool = temp;
} }
if(isSettingPolygon){ if(isSettingPolygon) {
delete this->Tool; delete this->Tool;
this->Tool = nullptr; this->Tool = nullptr;
isSettingPolygon = false; isSettingPolygon = false;

View File

@@ -81,7 +81,7 @@ void IntelliTool::mergeToolLayer(){
} }
} }
activeLayer->image->setImageData(updatedImage); activeLayer->image->setImageData(updatedImage);
if(Canvas->image->getPolygonData().size() > 0){ if(Canvas->image->getPolygonData().size() > 0) {
activeLayer->image->setPolygon(Canvas->image->getPolygonData()); activeLayer->image->setPolygon(Canvas->image->getPolygonData());
} }
Area->DummyGui->UpdateGui(); Area->DummyGui->UpdateGui();

View File

@@ -21,7 +21,7 @@ IntelliToolPolygon::~IntelliToolPolygon(){
void IntelliToolPolygon::onMouseLeftPressed(int x, int y){ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) { if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
if(Area->getPolygonDataOfRealLayer().size()>2){ if(Area->getPolygonDataOfRealLayer().size()>2) {
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer()); std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer());
QPoint Point(x,y); QPoint Point(x,y);
isInside = IntelliTriangulation::isInPolygon(Triangles,Point); isInside = IntelliTriangulation::isInPolygon(Triangles,Point);
@@ -29,7 +29,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
else{ else{
isInside = true; isInside = true;
} }
if(isSettingPolygon){ if(isSettingPolygon) {
isInside = true; isInside = true;
} }
} }
@@ -45,7 +45,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
QPointList.push_back(drawingPoint); QPointList.push_back(drawingPoint);
this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth()); this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
if(!isSettingPolygon){ if(!isSettingPolygon) {
this->Canvas->image->calculateVisiblity(); this->Canvas->image->calculateVisiblity();
} }
} }
@@ -53,7 +53,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
if(QPointList.size() > 2) { if(QPointList.size() > 2) {
isPointNearStart = true; isPointNearStart = true;
this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth()); this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
if(!isSettingPolygon){ if(!isSettingPolygon) {
this->Canvas->image->calculateVisiblity(); this->Canvas->image->calculateVisiblity();
} }
} }
@@ -69,7 +69,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
QPoint drawingPoint(x,y); QPoint drawingPoint(x,y);
QPointList.push_back(drawingPoint); QPointList.push_back(drawingPoint);
this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth()); this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
if(!isSettingPolygon){ if(!isSettingPolygon) {
this->Canvas->image->calculateVisiblity(); this->Canvas->image->calculateVisiblity();
} }
} }
@@ -88,7 +88,7 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
isInside = false; isInside = false;
isPointNearStart = false; isPointNearStart = false;
isDrawing = false; isDrawing = false;
if(!isSettingPolygon){ if(!isSettingPolygon) {
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList); std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
QPoint Point; QPoint Point;
QColor colorTwo(colorPicker->getSecondColor()); QColor colorTwo(colorPicker->getSecondColor());