- Timestamp:
- Feb 11, 2008 5:11:29 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r6784 r6904 415 415 #endif 416 416 417 CSession openSession (const QUuid &id );417 CSession openSession (const QUuid &id, bool aExisting = false); 418 418 419 419 bool startMachine (const QUuid &id); -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h
r5999 r6904 26 26 #include <qapplication.h> 27 27 #include <qmainwindow.h> 28 #include <qlistbox.h> 28 29 #include <qgroupbox.h> 29 30 #include <qaction.h> … … 67 68 void vmStart(); 68 69 void vmDiscard(); 70 void vmPause (bool); 69 71 void vmRefresh(); 70 72 void vmShowLogs(); … … 74 76 bool aSnapshots, 75 77 bool aDescription); 78 79 void showContextMenu (QListBoxItem *, const QPoint &); 76 80 77 81 protected: … … 105 109 private: 106 110 111 /* context menu */ 112 QPopupMenu *mVmMenu; 113 107 114 /* actions */ 108 115 QAction *fileDiskMgrAction; … … 114 121 QAction *vmStartAction; 115 122 QAction *vmDiscardAction; 123 QAction *vmPauseAction; 116 124 QAction *vmRefreshAction; 117 125 QAction *vmShowLogsAction; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r6851 r6904 1828 1828 * it is no more necessary. 1829 1829 */ 1830 CSession VBoxGlobal::openSession (const QUuid &id )1830 CSession VBoxGlobal::openSession (const QUuid &id, bool aExisting) 1831 1831 { 1832 1832 CSession session; … … 1838 1838 } 1839 1839 1840 mVBox.OpenSession (session, id); 1840 aExisting ? mVBox.OpenExistingSession (session, id) : 1841 mVBox.OpenSession (session, id); 1841 1842 if (!mVBox.isOk()) 1842 1843 { -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r5999 r6904 418 418 "vm_discard.png", "discard_16px.png", 419 419 "vm_discard_dis.png", "discard_dis_16px.png")); 420 vmPauseAction = new QAction (this, "vmPauseAction"); 421 vmPauseAction->setToggleAction (true); 422 vmPauseAction->setIconSet (VBoxGlobal::iconSet ( 423 "pause_16px.png", "pause_16px.png")); 420 424 vmRefreshAction = new QAction (this, "vmRefreshAction"); 421 425 vmRefreshAction->setIconSet (VBoxGlobal::iconSet ( … … 511 515 menuBar()->insertItem( QString::null, fileMenu, 1); 512 516 513 QPopupMenu *vmMenu = new QPopupMenu (this, "vmMenu"); 514 vmNewAction->addTo (vmMenu); 515 vmConfigAction->addTo (vmMenu); 516 vmDeleteAction->addTo (vmMenu); 517 vmMenu->insertSeparator(); 518 vmStartAction->addTo (vmMenu); 519 vmDiscardAction->addTo (vmMenu); 520 vmMenu->insertSeparator(); 521 vmRefreshAction->addTo (vmMenu); 522 vmMenu->insertSeparator(); 523 vmShowLogsAction->addTo (vmMenu); 524 525 menuBar()->insertItem (QString::null, vmMenu, 2); 517 mVmMenu = new QPopupMenu (this, "mVmMenu"); 518 vmNewAction->addTo (mVmMenu); 519 vmConfigAction->addTo (mVmMenu); 520 vmDeleteAction->addTo (mVmMenu); 521 mVmMenu->insertSeparator(); 522 vmStartAction->addTo (mVmMenu); 523 vmDiscardAction->addTo (mVmMenu); 524 mVmMenu->insertSeparator(); 525 vmPauseAction->addTo (mVmMenu); 526 mVmMenu->insertSeparator(); 527 vmRefreshAction->addTo (mVmMenu); 528 mVmMenu->insertSeparator(); 529 vmShowLogsAction->addTo (mVmMenu); 530 531 menuBar()->insertItem (QString::null, mVmMenu, 2); 526 532 527 533 QPopupMenu *helpMenu = new QPopupMenu( this, "helpMenu" ); … … 596 602 connect (vmStartAction, SIGNAL (activated()), this, SLOT (vmStart())); 597 603 connect (vmDiscardAction, SIGNAL (activated()), this, SLOT (vmDiscard())); 604 connect (vmPauseAction, SIGNAL (toggled (bool)), this, SLOT (vmPause (bool))); 598 605 connect (vmRefreshAction, SIGNAL (activated()), this, SLOT (vmRefresh())); 599 606 connect (vmShowLogsAction, SIGNAL (activated()), this, SLOT (vmShowLogs())); … … 616 623 connect (vmListBox, SIGNAL (selected (QListBoxItem *)), 617 624 this, SLOT (vmStart())); 625 connect (vmListBox, SIGNAL (contextMenuRequested (QListBoxItem *, const QPoint &)), 626 this, SLOT (showContextMenu (QListBoxItem *, const QPoint &))); 618 627 619 628 connect (vmDetailsView, SIGNAL (linkClicked (const QString &)), … … 662 671 QString curVMId = item ? 663 672 QString (static_cast<VBoxVMListBoxItem*> (item)->id()) : 664 673 QString::null; 665 674 vbox.SetExtraData (VBoxDefs::GUI_LastVMSelected, curVMId); 666 675 } … … 960 969 } 961 970 971 void VBoxSelectorWnd::vmPause (bool aPause) 972 { 973 VBoxVMListBoxItem *item = (VBoxVMListBoxItem *) vmListBox->selectedItem(); 974 975 AssertMsgReturn (item, ("Item must be always selected here"), (void) 0); 976 977 CSession session = vboxGlobal().openSession (item->id(), true); 978 if (session.isNull()) 979 return; 980 981 CConsole console = session.GetConsole(); 982 if (console.isNull()) 983 return; 984 985 if (aPause) 986 console.Pause(); 987 else 988 console.Resume(); 989 990 bool ok = console.isOk(); 991 if (!ok) 992 { 993 if (aPause) 994 vboxProblem().cannotPauseMachine (console); 995 else 996 vboxProblem().cannotResumeMachine (console); 997 } 998 999 session.Close(); 1000 } 1001 962 1002 void VBoxSelectorWnd::vmRefresh() 963 1003 { … … 993 1033 if (item && item->id() == aID) 994 1034 vmListBoxCurrentChanged (aDetails, aSnapshots, aDescription); 1035 } 1036 1037 void VBoxSelectorWnd::showContextMenu (QListBoxItem *aItem, const QPoint &aPoint) 1038 { 1039 if (aItem) 1040 mVmMenu->exec (aPoint); 995 1041 } 996 1042 … … 1210 1256 vmDeleteAction->setEnabled (modifyEnabled); 1211 1257 vmDiscardAction->setEnabled (state == CEnums::Saved && !running); 1258 vmPauseAction->setEnabled (state == CEnums::Running || 1259 state == CEnums::Paused); 1212 1260 1213 1261 /* change the Start button text accordingly */ … … 1229 1277 1230 1278 vmStartAction->setEnabled (!running); 1279 } 1280 1281 /* change the Pause/Resume button text accordingly */ 1282 if (state == CEnums::Paused) 1283 { 1284 vmPauseAction->setMenuText (tr ("R&esume")); 1285 vmPauseAction->setText (tr ("Resume")); 1286 vmPauseAction->setAccel (tr ("Ctrl+P")); 1287 vmPauseAction->setStatusTip ( 1288 tr ("Resume the execution of the virtual machine")); 1289 vmPauseAction->blockSignals (true); 1290 vmPauseAction->setOn (true); 1291 vmPauseAction->blockSignals (false); 1292 } 1293 else 1294 { 1295 vmPauseAction->setMenuText (tr ("&Pause")); 1296 vmPauseAction->setText (tr ("Pause")); 1297 vmPauseAction->setAccel (tr ("Ctrl+P")); 1298 vmPauseAction->setStatusTip ( 1299 tr ("Suspend the execution of the virtual machine")); 1300 vmPauseAction->blockSignals (true); 1301 vmPauseAction->setOn (false); 1302 vmPauseAction->blockSignals (false); 1231 1303 } 1232 1304 … … 1286 1358 vmDeleteAction->setEnabled (item != NULL); 1287 1359 vmDiscardAction->setEnabled (false); 1360 vmPauseAction->setEnabled (false); 1288 1361 1289 1362 /* change the Start button text accordingly */
Note:
See TracChangeset
for help on using the changeset viewer.