Changeset 54774 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 16, 2015 10:29:40 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp
r52730 r54774 207 207 /* Age: [date time|%1d ago|%1h ago|%1min ago|%1sec ago] */ 208 208 SnapshotAgeFormat ageFormat; 209 if (mTimestamp.daysTo (QDateTime::currentDateTime()) > 30) 210 { 211 age = VBoxSnapshotsWgt::tr (" (%1)").arg (mTimestamp.toString (Qt::LocalDate)); 209 QDateTime now = QDateTime::currentDateTime(); 210 QDateTime then = mTimestamp; 211 if (then > now) 212 then = now; /* can happen if the host time is wrong */ 213 if (then.daysTo (now) > 30) 214 { 215 age = VBoxSnapshotsWgt::tr (" (%1)").arg (then.toString (Qt::LocalDate)); 212 216 ageFormat = AgeMax; 213 217 } 214 else if ( mTimestamp.secsTo (QDateTime::currentDateTime()) > 60 * 60 * 24)215 { 216 age = VBoxSnapshotsWgt::tr (" (%1 ago)").arg(VBoxGlobal::daysToString( mTimestamp.secsTo (QDateTime::currentDateTime()) / 60 / 60 / 24));218 else if (then.secsTo (now) > 60 * 60 * 24) 219 { 220 age = VBoxSnapshotsWgt::tr (" (%1 ago)").arg(VBoxGlobal::daysToString(then.secsTo (now) / 60 / 60 / 24)); 217 221 ageFormat = AgeInDays; 218 222 } 219 else if ( mTimestamp.secsTo (QDateTime::currentDateTime()) > 60 * 60)220 { 221 age = VBoxSnapshotsWgt::tr (" (%1 ago)").arg(VBoxGlobal::hoursToString( mTimestamp.secsTo (QDateTime::currentDateTime()) / 60 / 60));223 else if (then.secsTo (now) > 60 * 60) 224 { 225 age = VBoxSnapshotsWgt::tr (" (%1 ago)").arg(VBoxGlobal::hoursToString(then.secsTo (now) / 60 / 60)); 222 226 ageFormat = AgeInHours; 223 227 } 224 else if ( mTimestamp.secsTo (QDateTime::currentDateTime()) > 60)225 { 226 age = VBoxSnapshotsWgt::tr (" (%1 ago)").arg(VBoxGlobal::minutesToString( mTimestamp.secsTo (QDateTime::currentDateTime()) / 60));228 else if (then.secsTo (now) > 60) 229 { 230 age = VBoxSnapshotsWgt::tr (" (%1 ago)").arg(VBoxGlobal::minutesToString(then.secsTo (now) / 60)); 227 231 ageFormat = AgeInMinutes; 228 232 } 229 233 else 230 234 { 231 age = VBoxSnapshotsWgt::tr (" (%1 ago)").arg(VBoxGlobal::secondsToString( mTimestamp.secsTo (QDateTime::currentDateTime())));235 age = VBoxSnapshotsWgt::tr (" (%1 ago)").arg(VBoxGlobal::secondsToString(then.secsTo (now))); 232 236 ageFormat = AgeInSeconds; 233 237 }
Note:
See TracChangeset
for help on using the changeset viewer.