Skip to content

Commit c6b5473

Browse files
authored
Merge pull request #6 from Larpon/fix/more-old-style-cast-warnings
WIP: Fix old-style cast warnings
2 parents 5fe451a + 2d16822 commit c6b5473

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/gui/TimeLineWidget.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void TimeLineWidget::setPlayBackActivity(bool aIsActive)
4343
{
4444
if (aIsActive)
4545
{
46-
mTimer.setInterval((int)getOneFrameTime());
46+
mTimer.setInterval(static_cast<int>(getOneFrameTime()));
4747
mTimer.start();
4848
mElapsed.start();
4949
mBeginFrame = currentFrame();
@@ -140,41 +140,41 @@ void TimeLineWidget::onPlayBackUpdated()
140140
{
141141
const double oneFrameTime = getOneFrameTime();
142142
const core::Frame curFrame = currentFrame();
143-
double nextFrame = curFrame.getDecimal() + 1.0;
143+
double nextFrame = static_cast<double>(curFrame.getDecimal()) + 1.0;
144144

145145
if (mDoesLoop && nextFrame > mInner->maxFrame())
146146
{
147147
nextFrame = 0.0;
148148
mBeginFrame.set(0);
149149
mElapsed.restart();
150-
mTimer.setInterval((int)oneFrameTime);
150+
mTimer.setInterval(static_cast<int>(oneFrameTime));
151151
}
152152
else
153153
{
154154
if (mLastFrame == curFrame)
155155
{
156156
const int elapsedTime = mElapsed.elapsed();
157157
const double elapsedFrame = elapsedTime / oneFrameTime;
158-
nextFrame = mBeginFrame.getDecimal() + elapsedFrame;
158+
nextFrame = static_cast<double>(mBeginFrame.getDecimal()) + elapsedFrame;
159159

160-
const double nextUpdateTime = oneFrameTime * ((int)elapsedFrame + 1);
160+
const double nextUpdateTime = oneFrameTime * (static_cast<int>(elapsedFrame) + 1);
161161
const double intervalTime = nextUpdateTime - elapsedTime;
162-
mTimer.setInterval(std::max((int)intervalTime, 1));
162+
mTimer.setInterval(std::max(static_cast<int>(intervalTime), 1));
163163
}
164164
else
165165
{
166166
mBeginFrame = curFrame;
167167
mElapsed.restart();
168-
mTimer.setInterval((int)oneFrameTime);
168+
mTimer.setInterval(static_cast<int>(oneFrameTime));
169169
}
170170
}
171171

172172
#if 0
173173
setFrame(core::Frame::fromDecimal(nextFrame));
174174
mLastFrame = core::Frame::fromDecimal(nextFrame);
175175
#else
176-
setFrame(core::Frame((int)nextFrame));
177-
mLastFrame = core::Frame((int)nextFrame);
176+
setFrame(core::Frame(static_cast<int>(nextFrame)));
177+
mLastFrame = core::Frame(static_cast<int>(nextFrame));
178178
#endif
179179
}
180180
}
@@ -230,8 +230,8 @@ void TimeLineWidget::wheelEvent(QWheelEvent* aEvent)
230230
mInner->updateWheel(aEvent);
231231

232232
const QRect rectNext = mInner->rect();
233-
const double scale = (double)rectNext.width() / rectPrev.width();
234-
viewTrans.setX(cursor.x() + scale * (viewTrans.x() - cursor.x()));
233+
const double scale = static_cast<double>(rectNext.width() / rectPrev.width());
234+
viewTrans.setX(static_cast<int>(cursor.x() + scale * (viewTrans.x() - cursor.x())));
235235
setScrollBarValue(viewTrans);
236236
updateCamera();
237237
}

0 commit comments

Comments
 (0)