Changeset 31240 in vbox
- Timestamp:
- Jul 30, 2010 12:07:44 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
r31008 r31240 1252 1252 if (m_pVMItem) 1253 1253 { 1254 bool saved = m_pVMItem-> state() == KMachineState_Saved;1254 bool saved = m_pVMItem->machineState() == KMachineState_Saved; 1255 1255 bool busy = m_pVMItem->sessionState() != KSessionState_Unlocked; 1256 1256 m_pEditBtn->setEnabled(!saved && !busy); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.cpp
r30868 r31240 149 149 //////////////////////////////////////////////////////////////////////////////// 150 150 151 QString UIVMItem::machineStateName() const 152 { 153 return m_fAccessible ? vboxGlobal().toString(m_machineState) : 154 QApplication::translate("UIVMListView", "Inaccessible"); 155 } 156 151 157 QString UIVMItem::sessionStateName() const 152 158 { 153 return m_fAccessible ? vboxGlobal().toString(m_s tate) :159 return m_fAccessible ? vboxGlobal().toString(m_sessionState) : 154 160 QApplication::translate("UIVMListView", "Inaccessible"); 155 161 } … … 174 180 "VM tooltip (name, last state change, session state)") 175 181 .arg(toolTip) 176 .arg(vboxGlobal().toString(m_ state))182 .arg(vboxGlobal().toString(m_machineState)) 177 183 .arg(dateTime) 178 184 .arg(vboxGlobal().toString(m_sessionState)); … … 208 214 m_strName = name; 209 215 210 m_ state = m_machine.GetState();216 m_machineState = m_machine.GetState(); 211 217 m_lastStateChange.setTime_t(m_machine.GetLastStateChange() / 1000); 212 218 m_sessionState = m_machine.GetSessionState(); … … 214 220 m_cSnaphot = m_machine.GetSnapshotCount(); 215 221 216 if ( m_ state == KMachineState_PoweredOff217 || m_ state == KMachineState_Saved218 || m_ state == KMachineState_Teleported219 || m_ state == KMachineState_Aborted222 if ( m_machineState == KMachineState_PoweredOff 223 || m_machineState == KMachineState_Saved 224 || m_machineState == KMachineState_Teleported 225 || m_machineState == KMachineState_Aborted 220 226 ) 221 227 { … … 246 252 needsResort = name != m_strName; 247 253 m_strName = name; 248 m_ state = KMachineState_Null;254 m_machineState = KMachineState_Null; 249 255 m_sessionState = KSessionState_Null; 250 256 m_lastStateChange = QDateTime::currentDateTime(); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.h
r30868 r31240 40 40 QString id() const { return m_strId; } 41 41 42 QString machineStateName() const; 43 QIcon machineStateIcon() const { return m_fAccessible ? vboxGlobal().toIcon(m_machineState) : QPixmap(":/state_aborted_16px.png"); } 44 42 45 QString sessionStateName() const; 43 QIcon sessionStateIcon() const { return m_fAccessible ? vboxGlobal().toIcon(m_state) : QPixmap(":/state_aborted_16px.png"); }44 46 45 47 QString snapshotName() const { return m_strSnapshotName; } … … 50 52 bool accessible() const { return m_fAccessible; } 51 53 const CVirtualBoxErrorInfo &accessError() const { return m_accessError; } 52 KMachineState state() const { return m_state; }54 KMachineState machineState() const { return m_machineState; } 53 55 KSessionState sessionState() const { return m_sessionState; } 54 56 … … 72 74 QString m_strName; 73 75 QString m_strSnapshotName; 74 KMachineState m_state;75 76 QDateTime m_lastStateChange; 77 KMachineState m_machineState; 76 78 KSessionState m_sessionState; 77 79 QString m_strOSTypeId; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMListView.cpp
r31008 r31240 187 187 .arg(item->name()) 188 188 .arg(item->snapshotName()) 189 .arg(item-> sessionStateName());189 .arg(item->machineStateName()); 190 190 break; 191 191 } … … 201 201 break; 202 202 } 203 case SessionStateDisplayRole:204 { 205 v = m_VMItemList.at(aIndex.row())-> sessionStateName();206 break; 207 } 208 case SessionStateDecorationRole:209 { 210 v = m_VMItemList.at(aIndex.row())-> sessionStateIcon();211 break; 212 } 213 case SessionStateFontRole:203 case MachineStateDisplayRole: 204 { 205 v = m_VMItemList.at(aIndex.row())->machineStateName(); 206 break; 207 } 208 case MachineStateDecorationRole: 209 { 210 v = m_VMItemList.at(aIndex.row())->machineStateIcon(); 211 break; 212 } 213 case MachineStateFontRole: 214 214 { 215 215 QFont f = qApp->font(); … … 218 218 f.setItalic(true); 219 219 v = f; 220 break; 221 } 222 case SessionStateDisplayRole: 223 { 224 v = m_VMItemList.at(aIndex.row())->sessionStateName(); 220 225 break; 221 226 } … … 394 399 QRect vmNameRT = rect(aOption, aIndex, Qt::DisplayRole); 395 400 QRect shotRT = rect(aOption, aIndex, UIVMItemModel::SnapShotDisplayRole); 396 QRect stateIconRT = rect(aOption, aIndex, UIVMItemModel:: SessionStateDecorationRole);397 QRect stateRT = rect(aOption, aIndex, UIVMItemModel:: SessionStateDisplayRole);401 QRect stateIconRT = rect(aOption, aIndex, UIVMItemModel::MachineStateDecorationRole); 402 QRect stateRT = rect(aOption, aIndex, UIVMItemModel::MachineStateDisplayRole); 398 403 /* Calculate the position for every item */ 399 404 calcLayout(aIndex, &osTypeRT, &vmNameRT, &shotRT, &stateIconRT, &stateRT); … … 409 414 /* Generate the key used in the pixmap cache. Needs to be composed with all 410 415 * values which might be changed. */ 411 QString key = QString("vbox:%1:%2:%3:%4:%5:%6 ")416 QString key = QString("vbox:%1:%2:%3:%4:%5:%6:%7") 412 417 .arg(index.data(Qt::DisplayRole).toString()) 413 418 .arg(index.data(UIVMItemModel::OSTypeIdRole).toString()) 414 419 .arg(index.data(UIVMItemModel::SnapShotDisplayRole).toString()) 420 .arg(index.data(UIVMItemModel::MachineStateDisplayRole).toString()) 415 421 .arg(index.data(UIVMItemModel::SessionStateDisplayRole).toString()) 416 422 .arg(option.state) … … 468 474 const QFont shotFont = index.data(UIVMItemModel::SnapShotFontRole).value<QFont>(); 469 475 470 const QString state = index.data(UIVMItemModel:: SessionStateDisplayRole).toString();471 const QFont stateFont = index.data(UIVMItemModel:: SessionStateFontRole).value<QFont>();472 const QPixmap stateIcon = index.data(UIVMItemModel:: SessionStateDecorationRole).value<QIcon>().pixmap(QSize(16, 16), iconMode(option.state), iconState(option.state));476 const QString state = index.data(UIVMItemModel::MachineStateDisplayRole).toString(); 477 const QFont stateFont = index.data(UIVMItemModel::MachineStateFontRole).value<QFont>(); 478 const QPixmap stateIcon = index.data(UIVMItemModel::MachineStateDecorationRole).value<QIcon>().pixmap(QSize(16, 16), iconMode(option.state), iconState(option.state)); 473 479 474 480 /* Get the sizes for all items */ … … 476 482 QRect vmNameRT = rect(option, index, Qt::DisplayRole); 477 483 QRect shotRT = rect(option, index, UIVMItemModel::SnapShotDisplayRole); 478 QRect stateIconRT = rect(option, index, UIVMItemModel:: SessionStateDecorationRole);479 QRect stateRT = rect(option, index, UIVMItemModel:: SessionStateDisplayRole);484 QRect stateIconRT = rect(option, index, UIVMItemModel::MachineStateDecorationRole); 485 QRect stateRT = rect(option, index, UIVMItemModel::MachineStateDisplayRole); 480 486 481 487 /* Calculate the positions for all items */ … … 595 601 break; 596 602 } 597 case UIVMItemModel:: SessionStateDisplayRole:603 case UIVMItemModel::MachineStateDisplayRole: 598 604 { 599 QString text = aIndex.data(UIVMItemModel:: SessionStateDisplayRole).toString();600 QFontMetrics fm(fontMetric(aIndex, UIVMItemModel:: SessionStateFontRole));605 QString text = aIndex.data(UIVMItemModel::MachineStateDisplayRole).toString(); 606 QFontMetrics fm(fontMetric(aIndex, UIVMItemModel::MachineStateFontRole)); 601 607 return QRect(QPoint(0, 0), fm.size(0, text)); 602 608 break; 603 609 } 604 case UIVMItemModel:: SessionStateDecorationRole:610 case UIVMItemModel::MachineStateDecorationRole: 605 611 { 606 QIcon icon = aIndex.data(UIVMItemModel:: SessionStateDecorationRole).value<QIcon>();612 QIcon icon = aIndex.data(UIVMItemModel::MachineStateDecorationRole).value<QIcon>(); 607 613 return QRect(QPoint(0, 0), icon.actualSize(QSize(16, 16), iconMode(aOption.state), iconState(aOption.state))); 608 614 break; … … 617 623 { 618 624 const int nameSpaceWidth = fontMetric(aIndex, Qt::FontRole).width(' '); 619 const int stateSpaceWidth = fontMetric(aIndex, UIVMItemModel:: SessionStateFontRole).width(' ');625 const int stateSpaceWidth = fontMetric(aIndex, UIVMItemModel::MachineStateFontRole).width(' '); 620 626 /* Really basic layout managment. 621 627 * First layout as usual */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMListView.h
r30868 r31240 35 35 enum { SnapShotDisplayRole = Qt::UserRole, 36 36 SnapShotFontRole, 37 MachineStateDisplayRole, 38 MachineStateDecorationRole, 39 MachineStateFontRole, 37 40 SessionStateDisplayRole, 38 SessionStateDecorationRole,39 SessionStateFontRole,40 41 OSTypeIdRole, 41 42 UIVMItemPtrRole }; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp
r31220 r31240 724 724 } 725 725 726 AssertMsg ( item-> state() == KMachineState_PoweredOff727 || item-> state() == KMachineState_Saved728 || item-> state() == KMachineState_Teleported729 || item-> state() == KMachineState_Aborted730 , ("Machine must be PoweredOff/Saved/Aborted (%d)", item-> state()));726 AssertMsg ( item->machineState() == KMachineState_PoweredOff 727 || item->machineState() == KMachineState_Saved 728 || item->machineState() == KMachineState_Teleported 729 || item->machineState() == KMachineState_Aborted 730 , ("Machine must be PoweredOff/Saved/Aborted (%d)", item->machineState())); 731 731 732 732 QString id = item->id(); … … 1190 1190 CMachine m = item->machine(); 1191 1191 1192 KMachineState state = item-> state();1192 KMachineState state = item->machineState(); 1193 1193 bool running = item->sessionState() != KSessionState_Unlocked; 1194 1194 bool modifyEnabled = !running && state != KMachineState_Saved;
Note:
See TracChangeset
for help on using the changeset viewer.