- Timestamp:
- Nov 19, 2008 4:03:59 PM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSelectorWnd.h
r14296 r14355 149 149 #ifdef VBOX_GUI_WITH_SYSTRAY 150 150 QAction *mTrayShowWindowAction; 151 QAction *mTrayExitAction;152 151 #endif 153 152 -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMListView.h
r14296 r14355 33 33 class VBoxSelectorWnd; 34 34 35 class VBoxVMItem : public QObject 36 { 37 Q_OBJECT; 38 39 public: 40 41 enum Action 42 { 43 Config = 0, 44 Delete, 45 Start, 46 Discard, 47 Pause, 48 Refresh, 49 ShowLogs 50 }; 51 52 public: 53 54 VBoxVMItem (const CMachine &aMachine, VBoxSelectorWnd *pParent); 35 class VBoxVMItem 36 { 37 public: 38 39 VBoxVMItem (const CMachine &aMachine); 55 40 virtual ~VBoxVMItem(); 56 41 … … 70 55 71 56 bool accessible() const { return mAccessible; } 72 bool running() const { return (sessionState() != KSessionState_Closed); }73 57 const CVirtualBoxErrorInfo &accessError() const { return mAccessError; } 74 58 KMachineState state() const { return mState; } … … 83 67 84 68 /* Private member vars */ 85 VBoxSelectorWnd *mParent;86 69 CMachine mMachine; 87 70 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp
r14296 r14355 570 570 mTrayShowWindowAction->setText (tr ("Sun xVM VirtualBox")); 571 571 572 mTrayExitAction = new QAction (this);573 Assert (mTrayExitAction);574 mTrayExitAction->setMenuRole (QAction::QuitRole);575 mTrayExitAction->setIcon (VBoxGlobal::iconSet (":/exit_16px.png"));576 577 572 if (QSystemTrayIcon::isSystemTrayAvailable()) 578 573 { … … 903 898 AssertMsgReturnVoid (item, ("Item must be always selected here")); 904 899 905 /* We always get here when mVMListView emits the activated() signal, 906 * so we must explicitly check if the action is enabled or not. */ 907 if (aUuid.isNull()) /* If Uuid is NULL, this function is called from the mVMListView activated() signal. */ 908 { 909 if (!vmStartAction->isEnabled()) 910 return; 911 } 900 /* Are we called from the mVMListView's activated() signal? */ 901 if (aUuid.isNull()) 902 { 903 /* We always get here when mVMListView emits the activated() signal, 904 * so we must explicitly check if the action is enabled or not. */ 905 if (!vmStartAction->isEnabled()) 906 return; 907 } 912 908 913 909 #if defined (VBOX_GUI_SEPARATE_VM_PROCESS) … … 1074 1070 for (CMachineVector::ConstIterator m = vec.begin(); 1075 1071 m != vec.end(); ++ m) 1076 mVMModel->addItem (new VBoxVMItem (*m , this));1072 mVMModel->addItem (new VBoxVMItem (*m)); 1077 1073 mVMModel->sort(); 1078 1074 1079 1075 vmListViewCurrentChanged(); 1076 1080 1077 #ifdef VBOX_GUI_WITH_SYSTRAY 1081 1078 mTrayIcon->refresh(); … … 1332 1329 1333 1330 KMachineState state = item->state(); 1334 bool bRunning = item->running();1335 bool bModifyEnabled = !bRunning && state != KMachineState_Saved;1331 bool running = item->sessionState() != KSessionState_Closed; 1332 bool modifyEnabled = !running && state != KMachineState_Saved; 1336 1333 1337 1334 if (aRefreshDetails) … … 1339 1336 vmDetailsView->setDetailsText ( 1340 1337 vboxGlobal().detailsReport (m, false /* isNewVM */, 1341 bModifyEnabled /* withLinks */));1338 modifyEnabled /* withLinks */)); 1342 1339 } 1343 1340 if (aRefreshSnapshots) … … 1367 1364 1368 1365 /* enable/disable modify actions */ 1369 vmConfigAction->setEnabled ( bModifyEnabled);1370 vmDeleteAction->setEnabled ( bModifyEnabled);1371 vmDiscardAction->setEnabled (state == KMachineState_Saved && ! bRunning);1366 vmConfigAction->setEnabled (modifyEnabled); 1367 vmDeleteAction->setEnabled (modifyEnabled); 1368 vmDiscardAction->setEnabled (state == KMachineState_Saved && !running); 1372 1369 vmPauseAction->setEnabled (state == KMachineState_Running || 1373 1370 state == KMachineState_Paused); … … 1388 1385 tr ("Start the selected virtual machine")); 1389 1386 1390 vmStartAction->setEnabled (! bRunning);1387 vmStartAction->setEnabled (!running); 1391 1388 } 1392 1389 … … 1554 1551 if (!m.isNull()) 1555 1552 { 1556 mVMModel->addItem (new VBoxVMItem (m , this));1553 mVMModel->addItem (new VBoxVMItem (m)); 1557 1554 mVMModel->sort(); 1558 1555 /* Make sure the description, ... pages are properly updated. … … 1686 1683 if (pItem && pItem->accessible()) 1687 1684 { 1685 /* look at vmListViewCurrentChanged() */ 1688 1686 CMachine m = pItem->machine(); 1689 1687 KMachineState s = pItem->state(); 1690 bool bRunning = pItem-> running();1688 bool bRunning = pItem->sessionState() != KSessionState_Closed; 1691 1689 bool bModifyEnabled = !bRunning && s != KMachineState_Saved; 1692 1690 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMListView.cpp
r14296 r14355 135 135 #endif 136 136 137 VBoxVMItem::VBoxVMItem (const CMachine &aMachine , VBoxSelectorWnd *pParent)138 : m Parent (pParent), mMachine (aMachine)137 VBoxVMItem::VBoxVMItem (const CMachine &aMachine) 138 : mMachine (aMachine) 139 139 { 140 140 recache(); … … 201 201 { 202 202 QString name = mMachine.GetName(); 203 setObjectName (name); 203 204 204 CSnapshot snp = mMachine.GetCurrentSnapshot(); 205 205 mSnapshotName = snp.isNull() ? QString::null : snp.GetName();
Note:
See TracChangeset
for help on using the changeset viewer.