Changeset 24791 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 19, 2009 2:36:21 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.cpp
r24789 r24791 82 82 { 83 83 case Qt::DisplayRole: 84 return mIsCurrentState ? QTreeWidgetItem::data (aColumn, aRole) : 85 QVariant (QString ("%1%2").arg (QTreeWidgetItem::data (aColumn, aRole).toString()).arg (mAge)); 84 return mIsCurrentState ? QTreeWidgetItem::data (aColumn, aRole) : QVariant (QString ("%1%2") 85 .arg (QTreeWidgetItem::data (aColumn, Qt::DisplayRole).toString()) 86 .arg (QTreeWidgetItem::data (aColumn, Qt::UserRole).toString())); 86 87 default: 87 88 break; … … 175 176 SnapshotAgeFormat updateAge() 176 177 { 177 QString oldAge (mAge);178 QString age; 178 179 179 180 /* Age: [date time|%1d ago|%1h ago|%1min ago|%1sec ago] */ … … 181 182 if (mTimestamp.daysTo (QDateTime::currentDateTime()) > 30) 182 183 { 183 mAge = VBoxSnapshotsWgt::tr (" (%1)").arg (mTimestamp.toString (Qt::LocalDate));184 age = VBoxSnapshotsWgt::tr (" (%1)").arg (mTimestamp.toString (Qt::LocalDate)); 184 185 ageFormat = AgeMax; 185 186 } 186 187 else if (mTimestamp.secsTo (QDateTime::currentDateTime()) > 60 * 60 * 24) 187 188 { 188 mAge = VBoxSnapshotsWgt::tr (" (%n day(s) ago)", "", mTimestamp.secsTo (QDateTime::currentDateTime()) / 60 / 60 / 24);189 age = VBoxSnapshotsWgt::tr (" (%n day(s) ago)", "", mTimestamp.secsTo (QDateTime::currentDateTime()) / 60 / 60 / 24); 189 190 ageFormat = AgeInDays; 190 191 } 191 192 else if (mTimestamp.secsTo (QDateTime::currentDateTime()) > 60 * 60) 192 193 { 193 mAge = VBoxSnapshotsWgt::tr (" (%n hour(s) ago)", "", mTimestamp.secsTo (QDateTime::currentDateTime()) / 60 / 60);194 age = VBoxSnapshotsWgt::tr (" (%n hour(s) ago)", "", mTimestamp.secsTo (QDateTime::currentDateTime()) / 60 / 60); 194 195 ageFormat = AgeInHours; 195 196 } 196 197 else if (mTimestamp.secsTo (QDateTime::currentDateTime()) > 60) 197 198 { 198 mAge = VBoxSnapshotsWgt::tr (" (%n minute(s) ago)", "", mTimestamp.secsTo (QDateTime::currentDateTime()) / 60);199 age = VBoxSnapshotsWgt::tr (" (%n minute(s) ago)", "", mTimestamp.secsTo (QDateTime::currentDateTime()) / 60); 199 200 ageFormat = AgeInMinutes; 200 201 } 201 202 else 202 203 { 203 mAge = VBoxSnapshotsWgt::tr (" (%n second(s) ago)", "", mTimestamp.secsTo (QDateTime::currentDateTime()));204 age = VBoxSnapshotsWgt::tr (" (%n second(s) ago)", "", mTimestamp.secsTo (QDateTime::currentDateTime())); 204 205 ageFormat = AgeInSeconds; 205 206 } 206 207 207 #if 0 208 if (mAge != oldAge) 209 emitDataChanged(); 210 #endif 208 /* Update data */ 209 setData (0, Qt::UserRole, age); 211 210 212 211 return ageFormat; … … 278 277 QString mDesc; 279 278 QDateTime mTimestamp; 280 QString mAge;281 279 282 280 bool mCurStateModified;
Note:
See TracChangeset
for help on using the changeset viewer.