mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 13:45:10 -05:00
rbutil: Use QElapsedTimer for measuring time.
The timing functions in QTime are deprecated and have been removed for Qt6. Use QElapsedTimer, which is the replacement for this. Change-Id: Ib262753fe99aff83f1952337eb64cd44439cafdd
This commit is contained in:
parent
2fe046c380
commit
d7bbf8a477
2 changed files with 12 additions and 11 deletions
|
|
@ -115,7 +115,7 @@ void BootloaderInstallS5l::installStageMkdfu(void)
|
||||||
LOG_INFO() << "preparing installStageWaitForEject";
|
LOG_INFO() << "preparing installStageWaitForEject";
|
||||||
emit logItem(tr("Ejecting iPod..."), LOGINFO);
|
emit logItem(tr("Ejecting iPod..."), LOGINFO);
|
||||||
setProgress(10);
|
setProgress(10);
|
||||||
scanTimer = QTime();
|
scanTimer.invalidate();
|
||||||
installStageWaitForEject();
|
installStageWaitForEject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ void BootloaderInstallS5l::installStageWaitForEject(void)
|
||||||
if (!updateProgress())
|
if (!updateProgress())
|
||||||
return; /* aborted */
|
return; /* aborted */
|
||||||
|
|
||||||
if (scanTimer.isNull() || (scanTimer.elapsed() > 3000)) {
|
if (!scanTimer.isValid() || (scanTimer.elapsed() > 3000)) {
|
||||||
scanSuccess = Utils::ejectDevice(mntpoint);
|
scanSuccess = Utils::ejectDevice(mntpoint);
|
||||||
if (!scanSuccess) {
|
if (!scanSuccess) {
|
||||||
scanSuccess = !Utils::mountpoints(
|
scanSuccess = !Utils::mountpoints(
|
||||||
|
|
@ -149,7 +149,7 @@ void BootloaderInstallS5l::installStageWaitForEject(void)
|
||||||
|
|
||||||
LOG_INFO() << "preparing installStageWaitForProcs";
|
LOG_INFO() << "preparing installStageWaitForProcs";
|
||||||
setProgress(40, 18);
|
setProgress(40, 18);
|
||||||
scanTimer = QTime();
|
scanTimer.invalidate();
|
||||||
installStageWaitForProcs();
|
installStageWaitForProcs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -159,7 +159,7 @@ void BootloaderInstallS5l::installStageWaitForProcs(void)
|
||||||
if (!updateProgress())
|
if (!updateProgress())
|
||||||
return; /* aborted */
|
return; /* aborted */
|
||||||
|
|
||||||
if (scanTimer.isNull() || (scanTimer.elapsed() > 1000)) {
|
if (!scanTimer.isValid() || (scanTimer.elapsed() > 1000)) {
|
||||||
scanSuccess = Utils::findRunningProcess(QStringList("iTunes")).isEmpty();
|
scanSuccess = Utils::findRunningProcess(QStringList("iTunes")).isEmpty();
|
||||||
scanTimer.start();
|
scanTimer.start();
|
||||||
}
|
}
|
||||||
|
|
@ -217,7 +217,7 @@ void BootloaderInstallS5l::installStageWaitForSpindown(void)
|
||||||
" about 12 seconds a new action will require\n"
|
" about 12 seconds a new action will require\n"
|
||||||
" you to release the buttons, DO IT QUICKLY,\n"
|
" you to release the buttons, DO IT QUICKLY,\n"
|
||||||
" otherwise the process could fail."), LOGWARNING);
|
" otherwise the process could fail."), LOGWARNING);
|
||||||
scanTimer = QTime();
|
scanTimer.invalidate();
|
||||||
installStageWaitForDfu();
|
installStageWaitForDfu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ void BootloaderInstallS5l::installStageWaitForDfu(void)
|
||||||
if (!updateProgress())
|
if (!updateProgress())
|
||||||
return; /* aborted */
|
return; /* aborted */
|
||||||
|
|
||||||
if (scanTimer.isNull() || (scanTimer.elapsed() > 2000)) {
|
if (!scanTimer.isValid() || (scanTimer.elapsed() > 2000)) {
|
||||||
scanSuccess = System::listUsbIds().contains(0x05ac1223);
|
scanSuccess = System::listUsbIds().contains(0x05ac1223);
|
||||||
scanTimer.start();
|
scanTimer.start();
|
||||||
}
|
}
|
||||||
|
|
@ -298,7 +298,7 @@ void BootloaderInstallS5l::installStageSendDfu(void)
|
||||||
LOG_INFO() << "preparing installStageWaitForRemount";
|
LOG_INFO() << "preparing installStageWaitForRemount";
|
||||||
emit logItem(tr("Restarting iPod, waiting for remount..."), LOGINFO);
|
emit logItem(tr("Restarting iPod, waiting for remount..."), LOGINFO);
|
||||||
setProgress(99, 45);
|
setProgress(99, 45);
|
||||||
scanTimer = QTime();
|
scanTimer.invalidate();
|
||||||
installStageWaitForRemount();
|
installStageWaitForRemount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,7 +308,7 @@ void BootloaderInstallS5l::installStageWaitForRemount(void)
|
||||||
if (!updateProgress())
|
if (!updateProgress())
|
||||||
return; /* aborted */
|
return; /* aborted */
|
||||||
|
|
||||||
if (scanTimer.isNull() || (scanTimer.elapsed() > 5000)) {
|
if (!scanTimer.isValid() || (scanTimer.elapsed() > 5000)) {
|
||||||
scanSuccess = Utils::mountpoints(
|
scanSuccess = Utils::mountpoints(
|
||||||
Utils::MountpointsSupported).contains(mntpoint);
|
Utils::MountpointsSupported).contains(mntpoint);
|
||||||
scanTimer.start();
|
scanTimer.start();
|
||||||
|
|
@ -381,7 +381,8 @@ bool BootloaderInstallS5l::updateProgress(void)
|
||||||
{
|
{
|
||||||
if (progressTimeout) {
|
if (progressTimeout) {
|
||||||
progCurrent = qMin(progTarget, progOrigin +
|
progCurrent = qMin(progTarget, progOrigin +
|
||||||
progressTimer.elapsed()*(progTarget-progOrigin)/progressTimeout);
|
static_cast<int>(progressTimer.elapsed())
|
||||||
|
* (progTarget - progOrigin) / progressTimeout);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
progCurrent = progTarget;
|
progCurrent = progTarget;
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,10 @@ class BootloaderInstallS5l : public BootloaderInstallBase
|
||||||
QList<int> suspendedPids;
|
QList<int> suspendedPids;
|
||||||
bool aborted;
|
bool aborted;
|
||||||
bool abortDetected(void);
|
bool abortDetected(void);
|
||||||
QTime scanTimer;
|
QElapsedTimer scanTimer;
|
||||||
bool scanSuccess;
|
bool scanSuccess;
|
||||||
// progress
|
// progress
|
||||||
QTime progressTimer;
|
QElapsedTimer progressTimer;
|
||||||
int progressTimeout;
|
int progressTimeout;
|
||||||
int progCurrent;
|
int progCurrent;
|
||||||
int progOrigin;
|
int progOrigin;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue