aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorMeshCollider <dobsonsa68@gmail.com>2017-09-06 10:50:05 +1200
committerMeshCollider <dobsonsa68@gmail.com>2017-09-06 10:50:05 +1200
commitc8d38abd65d920ec28c68020bf910cfa79216bd5 (patch)
tree038bea2ec81626f8cdd8d0b1b35194f7578552c3 /src/qt
parent3b69a08c53c2ef738f32c270fdacf1e4ed5a4c97 (diff)
Refactor tipUpdate as per style guide
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/modaloverlay.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp
index 4f357e297d..e32a0bdda8 100644
--- a/src/qt/modaloverlay.cpp
+++ b/src/qt/modaloverlay.cpp
@@ -82,30 +82,28 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
blockProcessTime.push_front(qMakePair(currentDate.toMSecsSinceEpoch(), nVerificationProgress));
// show progress speed if we have more then one sample
- if (blockProcessTime.size() >= 2)
- {
- double progressStart = blockProcessTime[0].second;
+ if (blockProcessTime.size() >= 2) {
double progressDelta = 0;
double progressPerHour = 0;
qint64 timeDelta = 0;
qint64 remainingMSecs = 0;
double remainingProgress = 1.0 - nVerificationProgress;
- for (int i = 1; i < blockProcessTime.size(); i++)
- {
+ for (int i = 1; i < blockProcessTime.size(); i++) {
QPair<qint64, double> sample = blockProcessTime[i];
// take first sample after 500 seconds or last available one
if (sample.first < (currentDate.toMSecsSinceEpoch() - 500 * 1000) || i == blockProcessTime.size() - 1) {
- progressDelta = progressStart-sample.second;
+ progressDelta = blockProcessTime[0].second - sample.second;
timeDelta = blockProcessTime[0].first - sample.first;
- progressPerHour = progressDelta/(double)timeDelta*1000*3600;
+ progressPerHour = progressDelta / (double) timeDelta * 1000 * 3600;
remainingMSecs = (progressDelta > 0) ? remainingProgress / progressDelta * timeDelta : -1;
break;
}
}
// show progress increase per hour
- ui->progressIncreasePerH->setText(QString::number(progressPerHour*100, 'f', 2)+"%");
+ ui->progressIncreasePerH->setText(QString::number(progressPerHour * 100, 'f', 2)+"%");
+ // show expected remaining time
if(remainingMSecs >= 0) {
ui->expectedTimeLeft->setText(GUIUtil::formatNiceTimeOffset(remainingMSecs / 1000.0));
} else {
@@ -113,8 +111,9 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
}
static const int MAX_SAMPLES = 5000;
- if (blockProcessTime.count() > MAX_SAMPLES)
- blockProcessTime.remove(MAX_SAMPLES, blockProcessTime.count()-MAX_SAMPLES);
+ if (blockProcessTime.count() > MAX_SAMPLES) {
+ blockProcessTime.remove(MAX_SAMPLES, blockProcessTime.count() - MAX_SAMPLES);
+ }
}
// show the last block date
@@ -172,4 +171,4 @@ void ModalOverlay::closeClicked()
{
showHide(true);
userClosed = true;
-} \ No newline at end of file
+}