diff options
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstalls5l.cpp | 19 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstalls5l.h | 4 |
2 files changed, 12 insertions, 11 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp b/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp index 2442970655..ef1ab1077c 100644 --- a/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp | |||
@@ -115,7 +115,7 @@ void BootloaderInstallS5l::installStageMkdfu(void) | |||
115 | LOG_INFO() << "preparing installStageWaitForEject"; | 115 | LOG_INFO() << "preparing installStageWaitForEject"; |
116 | emit logItem(tr("Ejecting iPod..."), LOGINFO); | 116 | emit logItem(tr("Ejecting iPod..."), LOGINFO); |
117 | setProgress(10); | 117 | setProgress(10); |
118 | scanTimer = QTime(); | 118 | scanTimer.invalidate(); |
119 | installStageWaitForEject(); | 119 | installStageWaitForEject(); |
120 | } | 120 | } |
121 | 121 | ||
@@ -125,7 +125,7 @@ void BootloaderInstallS5l::installStageWaitForEject(void) | |||
125 | if (!updateProgress()) | 125 | if (!updateProgress()) |
126 | return; /* aborted */ | 126 | return; /* aborted */ |
127 | 127 | ||
128 | if (scanTimer.isNull() || (scanTimer.elapsed() > 3000)) { | 128 | if (!scanTimer.isValid() || (scanTimer.elapsed() > 3000)) { |
129 | scanSuccess = Utils::ejectDevice(mntpoint); | 129 | scanSuccess = Utils::ejectDevice(mntpoint); |
130 | if (!scanSuccess) { | 130 | if (!scanSuccess) { |
131 | scanSuccess = !Utils::mountpoints( | 131 | scanSuccess = !Utils::mountpoints( |
@@ -149,7 +149,7 @@ void BootloaderInstallS5l::installStageWaitForEject(void) | |||
149 | 149 | ||
150 | LOG_INFO() << "preparing installStageWaitForProcs"; | 150 | LOG_INFO() << "preparing installStageWaitForProcs"; |
151 | setProgress(40, 18); | 151 | setProgress(40, 18); |
152 | scanTimer = QTime(); | 152 | scanTimer.invalidate(); |
153 | installStageWaitForProcs(); | 153 | installStageWaitForProcs(); |
154 | } | 154 | } |
155 | 155 | ||
@@ -159,7 +159,7 @@ void BootloaderInstallS5l::installStageWaitForProcs(void) | |||
159 | if (!updateProgress()) | 159 | if (!updateProgress()) |
160 | return; /* aborted */ | 160 | return; /* aborted */ |
161 | 161 | ||
162 | if (scanTimer.isNull() || (scanTimer.elapsed() > 1000)) { | 162 | if (!scanTimer.isValid() || (scanTimer.elapsed() > 1000)) { |
163 | scanSuccess = Utils::findRunningProcess(QStringList("iTunes")).isEmpty(); | 163 | scanSuccess = Utils::findRunningProcess(QStringList("iTunes")).isEmpty(); |
164 | scanTimer.start(); | 164 | scanTimer.start(); |
165 | } | 165 | } |
@@ -217,7 +217,7 @@ void BootloaderInstallS5l::installStageWaitForSpindown(void) | |||
217 | " about 12 seconds a new action will require\n" | 217 | " about 12 seconds a new action will require\n" |
218 | " you to release the buttons, DO IT QUICKLY,\n" | 218 | " you to release the buttons, DO IT QUICKLY,\n" |
219 | " otherwise the process could fail."), LOGWARNING); | 219 | " otherwise the process could fail."), LOGWARNING); |
220 | scanTimer = QTime(); | 220 | scanTimer.invalidate(); |
221 | installStageWaitForDfu(); | 221 | installStageWaitForDfu(); |
222 | } | 222 | } |
223 | 223 | ||
@@ -227,7 +227,7 @@ void BootloaderInstallS5l::installStageWaitForDfu(void) | |||
227 | if (!updateProgress()) | 227 | if (!updateProgress()) |
228 | return; /* aborted */ | 228 | return; /* aborted */ |
229 | 229 | ||
230 | if (scanTimer.isNull() || (scanTimer.elapsed() > 2000)) { | 230 | if (!scanTimer.isValid() || (scanTimer.elapsed() > 2000)) { |
231 | scanSuccess = System::listUsbIds().contains(0x05ac1223); | 231 | scanSuccess = System::listUsbIds().contains(0x05ac1223); |
232 | scanTimer.start(); | 232 | scanTimer.start(); |
233 | } | 233 | } |
@@ -298,7 +298,7 @@ void BootloaderInstallS5l::installStageSendDfu(void) | |||
298 | LOG_INFO() << "preparing installStageWaitForRemount"; | 298 | LOG_INFO() << "preparing installStageWaitForRemount"; |
299 | emit logItem(tr("Restarting iPod, waiting for remount..."), LOGINFO); | 299 | emit logItem(tr("Restarting iPod, waiting for remount..."), LOGINFO); |
300 | setProgress(99, 45); | 300 | setProgress(99, 45); |
301 | scanTimer = QTime(); | 301 | scanTimer.invalidate(); |
302 | installStageWaitForRemount(); | 302 | installStageWaitForRemount(); |
303 | } | 303 | } |
304 | 304 | ||
@@ -308,7 +308,7 @@ void BootloaderInstallS5l::installStageWaitForRemount(void) | |||
308 | if (!updateProgress()) | 308 | if (!updateProgress()) |
309 | return; /* aborted */ | 309 | return; /* aborted */ |
310 | 310 | ||
311 | if (scanTimer.isNull() || (scanTimer.elapsed() > 5000)) { | 311 | if (!scanTimer.isValid() || (scanTimer.elapsed() > 5000)) { |
312 | scanSuccess = Utils::mountpoints( | 312 | scanSuccess = Utils::mountpoints( |
313 | Utils::MountpointsSupported).contains(mntpoint); | 313 | Utils::MountpointsSupported).contains(mntpoint); |
314 | scanTimer.start(); | 314 | scanTimer.start(); |
@@ -381,7 +381,8 @@ bool BootloaderInstallS5l::updateProgress(void) | |||
381 | { | 381 | { |
382 | if (progressTimeout) { | 382 | if (progressTimeout) { |
383 | progCurrent = qMin(progTarget, progOrigin + | 383 | progCurrent = qMin(progTarget, progOrigin + |
384 | progressTimer.elapsed()*(progTarget-progOrigin)/progressTimeout); | 384 | static_cast<int>(progressTimer.elapsed()) |
385 | * (progTarget - progOrigin) / progressTimeout); | ||
385 | } | 386 | } |
386 | else { | 387 | else { |
387 | progCurrent = progTarget; | 388 | progCurrent = progTarget; |
diff --git a/rbutil/rbutilqt/base/bootloaderinstalls5l.h b/rbutil/rbutilqt/base/bootloaderinstalls5l.h index a59e5d378b..e2a44a031f 100644 --- a/rbutil/rbutilqt/base/bootloaderinstalls5l.h +++ b/rbutil/rbutilqt/base/bootloaderinstalls5l.h | |||
@@ -55,10 +55,10 @@ class BootloaderInstallS5l : public BootloaderInstallBase | |||
55 | QList<int> suspendedPids; | 55 | QList<int> suspendedPids; |
56 | bool aborted; | 56 | bool aborted; |
57 | bool abortDetected(void); | 57 | bool abortDetected(void); |
58 | QTime scanTimer; | 58 | QElapsedTimer scanTimer; |
59 | bool scanSuccess; | 59 | bool scanSuccess; |
60 | // progress | 60 | // progress |
61 | QTime progressTimer; | 61 | QElapsedTimer progressTimer; |
62 | int progressTimeout; | 62 | int progressTimeout; |
63 | int progCurrent; | 63 | int progCurrent; |
64 | int progOrigin; | 64 | int progOrigin; |