@@ -82,39 +82,38 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
82
82
blockProcessTime.push_front (qMakePair (currentDate.toMSecsSinceEpoch (), nVerificationProgress));
83
83
84
84
// show progress speed if we have more then one sample
85
- if (blockProcessTime.size () >= 2 )
86
- {
87
- double progressStart = blockProcessTime[0 ].second ;
85
+ if (blockProcessTime.size () >= 2 ) {
88
86
double progressDelta = 0 ;
89
87
double progressPerHour = 0 ;
90
88
qint64 timeDelta = 0 ;
91
89
qint64 remainingMSecs = 0 ;
92
90
double remainingProgress = 1.0 - nVerificationProgress;
93
- for (int i = 1 ; i < blockProcessTime.size (); i++)
94
- {
91
+ for (int i = 1 ; i < blockProcessTime.size (); i++) {
95
92
QPair<qint64, double > sample = blockProcessTime[i];
96
93
97
94
// take first sample after 500 seconds or last available one
98
95
if (sample.first < (currentDate.toMSecsSinceEpoch () - 500 * 1000 ) || i == blockProcessTime.size () - 1 ) {
99
- progressDelta = progressStart- sample.second ;
96
+ progressDelta = blockProcessTime[ 0 ]. second - sample.second ;
100
97
timeDelta = blockProcessTime[0 ].first - sample.first ;
101
- progressPerHour = progressDelta/ (double )timeDelta* 1000 * 3600 ;
98
+ progressPerHour = progressDelta / (double ) timeDelta * 1000 * 3600 ;
102
99
remainingMSecs = (progressDelta > 0 ) ? remainingProgress / progressDelta * timeDelta : -1 ;
103
100
break ;
104
101
}
105
102
}
106
103
// show progress increase per hour
107
- ui->progressIncreasePerH ->setText (QString::number (progressPerHour* 100 , ' f' , 2 )+" %" );
104
+ ui->progressIncreasePerH ->setText (QString::number (progressPerHour * 100 , ' f' , 2 )+" %" );
108
105
106
+ // show expected remaining time
109
107
if (remainingMSecs >= 0 ) {
110
108
ui->expectedTimeLeft ->setText (GUIUtil::formatNiceTimeOffset (remainingMSecs / 1000.0 ));
111
109
} else {
112
110
ui->expectedTimeLeft ->setText (QObject::tr (" unknown" ));
113
111
}
114
112
115
113
static const int MAX_SAMPLES = 5000 ;
116
- if (blockProcessTime.count () > MAX_SAMPLES)
117
- blockProcessTime.remove (MAX_SAMPLES, blockProcessTime.count ()-MAX_SAMPLES);
114
+ if (blockProcessTime.count () > MAX_SAMPLES) {
115
+ blockProcessTime.remove (MAX_SAMPLES, blockProcessTime.count () - MAX_SAMPLES);
116
+ }
118
117
}
119
118
120
119
// show the last block date
@@ -172,4 +171,4 @@ void ModalOverlay::closeClicked()
172
171
{
173
172
showHide (true );
174
173
userClosed = true ;
175
- }
174
+ }
0 commit comments