Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master resolve warnings #1132

Merged
merged 4 commits into from Dec 9, 2018

Conversation

Projects
None yet
3 participants
@davidlamhauge
Copy link
Contributor

davidlamhauge commented Nov 24, 2018

This PR resolves most of the warnings in the app-directory.
Casts are changed from C to C++ style and '0' and 'NULL' is changed to 'nullptr'.
They are cast to the type the compiler would cast them to in the first place.
Only in colorslider.h, I changed two member variables from 'float' to 'qreal'. This solved many warnings in itself.

@scribblemaniac
Copy link
Member

scribblemaniac left a comment

I had made a couple of suggestions for further improvement, but everything here looks good to me.

ui->GreenspinBox->value()* 2.55,
ui->BluespinBox->value()* 2.55,
ui->AlphaspinBox->value()* 2.55);
static_cast<int>(ui->GreenspinBox->value()* 2.55),

This comment has been minimized.

Copy link
@scribblemaniac

scribblemaniac Nov 29, 2018

Member

No extra spacing on these three lines. They should all line up with the first argument.

This comment has been minimized.

Copy link
@davidlamhauge

davidlamhauge Nov 29, 2018

Author Contributor

Done

@@ -1265,7 +1265,7 @@ void MainWindow2::bindActionWithSetting(QAction* action, SETTING setting)
void MainWindow2::updateZoomLabel()
{
float zoom = mEditor->view()->scaling() * 100.f;
statusBar()->showMessage(QString("Zoom: %0%1").arg(zoom, 0, 'f', 1).arg("%"));
statusBar()->showMessage(QString("Zoom: %0%1").arg(static_cast<double>(zoom), 0, 'f', 1).arg("%"));

This comment has been minimized.

Copy link
@scribblemaniac

scribblemaniac Nov 29, 2018

Member

Could probably just make zoom double here with 100.0 instead of 100.f

This comment has been minimized.

Copy link
@davidlamhauge

davidlamhauge Nov 29, 2018

Author Contributor

I tried but mEditor->view()->scaling is a float, so it just gave a new warning.

This comment has been minimized.

Copy link
@scribblemaniac

scribblemaniac Nov 29, 2018

Member

Ah okay, nevermind then.

@@ -96,15 +96,15 @@ void SpinSlider::setValue(qreal v)
int value2 = 0;
if (mGrowthType == LINEAR)
{
value2 = std::round(mSlider->maximum() * (v - mMin) / (mMax - mMin));
value2 = static_cast<int>(std::round(mSlider->maximum() * (v - mMin) / (mMax - mMin)));

This comment has been minimized.

Copy link
@scribblemaniac

scribblemaniac Nov 29, 2018

Member

For this and the following two lines like it, we can just change the std::round to a qRound which returns int. Some of the other static_cast<int>s could be changed to qRounds as well if it makes sense btw.

This comment has been minimized.

Copy link
@davidlamhauge

davidlamhauge Nov 29, 2018

Author Contributor

Done.
I forgot this one, so I'll push changes when Travis check is finished.

@chchwy chchwy added this to the 0.6.3 milestone Dec 4, 2018

@chchwy chchwy merged commit 0571727 into pencil2d:master Dec 9, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.