Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
Replace deprecated QTime::start(), QTime::elapsed() by using QElapsed…
Browse files Browse the repository at this point in the history
…Timer
  • Loading branch information
uhle committed Jun 12, 2020
1 parent 67d1d3c commit 3b49d61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions 3rdparty/solid-lite/backends/hal/halfstabhandling.cpp
Expand Up @@ -25,7 +25,7 @@
#include <QObject>
#include <QProcess>
#include <QTextStream>
#include <QTime>
#include <QElapsedTimer>

#include <solid-lite/soliddefs_p.h>

Expand Down Expand Up @@ -73,13 +73,13 @@ bool _k_isNetworkFileSystem(const QString &fstype, const QString &devName)
void _k_updateMountPointsCache()
{
static bool firstCall = true;
static QTime elapsedTime;
static QElapsedTimer elapsedTimer;

if (firstCall) {
firstCall = false;
elapsedTime.start();
} else if (elapsedTime.elapsed()>10000) {
elapsedTime.restart();
elapsedTimer.start();
} else if (elapsedTimer.elapsed()>10000) {
elapsedTimer.restart();
} else {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions widgets/nowplayingwidget.cpp
Expand Up @@ -345,7 +345,7 @@ void NowPlayingWidget::startTimer()
timer->setInterval(1000);
connect(timer, SIGNAL(timeout()), this, SLOT(updatePos()));
}
startTime.restart();
elapsedTimer.start();
lastVal=value();
timer->start();
pollCount=0;
Expand All @@ -362,7 +362,7 @@ void NowPlayingWidget::stopTimer()
void NowPlayingWidget::setValue(int v)
{
if (qAbs(v-slider->value())>1 || MPDState_Playing!=MPDStatus::self()->state()) {
startTime.restart();
elapsedTimer.start();
lastVal=v;
slider->setValue(v);
updateTimes();
Expand Down Expand Up @@ -418,7 +418,7 @@ void NowPlayingWidget::updateTimes()

void NowPlayingWidget::updatePos()
{
quint16 elapsed=(startTime.elapsed()/1000.0)+0.5;
quint16 elapsed=(elapsedTimer.elapsed()/1000.0)+0.5;
slider->setValue(lastVal+elapsed);
MPDStatus::self()->setGuessedElapsed(lastVal+elapsed);
if (++pollCount>=constPollMpd) {
Expand Down
4 changes: 2 additions & 2 deletions widgets/nowplayingwidget.h
Expand Up @@ -25,7 +25,7 @@
#define NOWPLAYING_WIDGET_H

#include <QWidget>
#include <QTime>
#include <QElapsedTimer>
#include <QSlider>
#include "support/squeezedtextlabel.h"

Expand Down Expand Up @@ -101,7 +101,7 @@ private Q_SLOTS:
PosSlider *slider;
RatingWidget *ratingWidget;
QTimer *timer;
QTime startTime;
QElapsedTimer elapsedTimer;
QString currentSongFile;
int lastVal;
int pollCount;
Expand Down

0 comments on commit 3b49d61

Please sign in to comment.