Changeset 36122 in vbox
- Timestamp:
- Mar 1, 2011 3:36:22 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp
r35516 r36122 37 37 #include <QTimer> 38 38 #include <QVBoxLayout> 39 40 #define VBOX_SECOND 141 #define VBOX_MINUTE VBOX_SECOND * 6042 #define VBOX_HOUR VBOX_MINUTE * 6043 #define VBOX_DAY VBOX_HOUR * 2444 39 45 40 const char *UIProgressDialog::m_spcszOpDescTpl = "%1 ... (%2/%3)"; … … 221 216 /* First ETA */ 222 217 long newTime = m_progress.GetTimeRemaining(); 223 QDateTime time; 224 time.setTime_t(newTime); 225 QDateTime refTime; 226 refTime.setTime_t(0); 227 228 int days = refTime.daysTo(time); 229 int hours = time.addDays(-days).time().hour(); 230 int minutes = time.addDays(-days).time().minute(); 231 int seconds = time.addDays(-days).time().second(); 218 long seconds; 219 long minutes; 220 long hours; 221 long days; 222 223 seconds = newTime < 0 ? 0 : newTime; 224 minutes = seconds / 60; 225 seconds -= minutes * 60; 226 hours = minutes / 60; 227 minutes -= hours * 60; 228 days = hours / 24; 229 hours -= days * 24; 232 230 233 231 QString strDays = VBoxGlobal::daysToString(days); … … 239 237 QString strOneComp = tr("%1 remaining", "You may wish to translate this more like \"Time remaining: %1\""); 240 238 241 if (newTime > VBOX_DAY * 2 + VBOX_HOUR)239 if (days > 1 && hours > 0) 242 240 m_pEtaLbl->setText(strTwoComp.arg(strDays).arg(strHours)); 243 else if (newTime > VBOX_DAY * 2 + VBOX_MINUTE * 5) 241 else if (days > 1) 242 m_pEtaLbl->setText(strOneComp.arg(strDays)); 243 else if (days > 0 && hours > 0) 244 m_pEtaLbl->setText(strTwoComp.arg(strDays).arg(strHours)); 245 else if (days > 0 && minutes > 5) 244 246 m_pEtaLbl->setText(strTwoComp.arg(strDays).arg(strMinutes)); 245 else if ( newTime > VBOX_DAY * 2)247 else if (days > 0) 246 248 m_pEtaLbl->setText(strOneComp.arg(strDays)); 247 else if (newTime > VBOX_DAY + VBOX_HOUR) 248 m_pEtaLbl->setText(strTwoComp.arg(strDays).arg(strHours)); 249 else if (newTime > VBOX_DAY + VBOX_MINUTE * 5) 250 m_pEtaLbl->setText(strTwoComp.arg(strDays).arg(strMinutes)); 251 else if (newTime > VBOX_HOUR * 23 + VBOX_MINUTE * 55) 252 m_pEtaLbl->setText(strOneComp.arg(strDays)); 253 else if (newTime >= VBOX_HOUR * 2) 249 else if (hours > 2) 250 m_pEtaLbl->setText(strTwoComp.arg(strHours)); 251 else if (hours > 0 && minutes > 0) 254 252 m_pEtaLbl->setText(strTwoComp.arg(strHours).arg(strMinutes)); 255 else if (newTime > VBOX_HOUR + VBOX_MINUTE * 5) 256 m_pEtaLbl->setText(strTwoComp.arg(strHours).arg(strMinutes)); 257 else if (newTime > VBOX_MINUTE * 55) 253 else if (hours > 0) 258 254 m_pEtaLbl->setText(strOneComp.arg(strHours)); 259 else if ( newTime > VBOX_MINUTE *2)255 else if (minutes > 2) 260 256 m_pEtaLbl->setText(strOneComp.arg(strMinutes)); 261 else if ( newTime > VBOX_MINUTE + VBOX_SECOND *5)257 else if (minutes > 0 && seconds > 5) 262 258 m_pEtaLbl->setText(strTwoComp.arg(strMinutes).arg(strSeconds)); 263 else if ( newTime > VBOX_SECOND * 55)259 else if (minutes > 0) 264 260 m_pEtaLbl->setText(strOneComp.arg(strMinutes)); 265 else if ( newTime > VBOX_SECOND *5)261 else if (seconds > 5) 266 262 m_pEtaLbl->setText(strOneComp.arg(strSeconds)); 267 else if ( newTime >=0)263 else if (seconds > 0) 268 264 m_pEtaLbl->setText(tr("A few seconds remaining")); 269 265 else
Note:
See TracChangeset
for help on using the changeset viewer.