Changeset 98675 in vbox
- Timestamp:
- Feb 21, 2023 3:12:32 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155975
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98674 r98675 349 349 { 350 350 return uisession()->setPause(fPause); 351 } 352 353 bool UIMachine::acquireSnapshotCount(ulong &uCount) 354 { 355 return uisession()->acquireSnapshotCount(uCount); 356 } 357 358 bool UIMachine::acquireCurrentSnapshotName(QString &strName) 359 { 360 return uisession()->acquireCurrentSnapshotName(strName); 351 361 } 352 362 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98674 r98675 246 246 /** @} */ 247 247 248 /** @name Snapshot stuff. 249 ** @{ */ 250 /** Acquires snapshot count. */ 251 bool acquireSnapshotCount(ulong &uCount); 252 /** Acquires current snapshot name. */ 253 bool acquireCurrentSnapshotName(QString &strName); 254 /** @} */ 255 248 256 /** @name Host-screen stuff. 249 257 ** @{ */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r98669 r98675 1794 1794 1795 1795 LogRel(("GUI: User requested to power VM off.\n")); 1796 ulong uSnapshotCount = 0; 1797 uimachine()->acquireSnapshotCount(uSnapshotCount); 1796 1798 const bool fDiscardStateOnPowerOff = gEDataManager->discardStateOnPowerOff(uiCommon().managedVMUuid()); 1797 uimachine()->powerOff( machine().GetSnapshotCount()> 0 && fDiscardStateOnPowerOff);1799 uimachine()->powerOff(uSnapshotCount > 0 && fDiscardStateOnPowerOff); 1798 1800 } 1799 1801 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r98669 r98675 272 272 273 273 /* Append snapshot name: */ 274 if (machine().GetSnapshotCount() > 0) 275 { 276 const CSnapshot comSnapshot = machine().GetCurrentSnapshot(); 277 strMachineName += " (" + comSnapshot.GetName() + ")"; 274 ulong uSnapshotCount = 0; 275 uimachine()->acquireSnapshotCount(uSnapshotCount); 276 if (uSnapshotCount > 0) 277 { 278 QString strCurrentSnapshotName; 279 uimachine()->acquireCurrentSnapshotName(strCurrentSnapshotName); 280 strMachineName += " (" + strCurrentSnapshotName + ")"; 278 281 } 279 282 … … 423 426 bool fInACPIMode = false; 424 427 uimachine()->acquireWhetherGuestEnteredACPIMode(fInACPIMode); 425 QPointer<UIVMCloseDialog> pCloseDlg = new UIVMCloseDialog(pParentDlg, machine(),428 QPointer<UIVMCloseDialog> pCloseDlg = new UIVMCloseDialog(pParentDlg, uimachine(), 426 429 fInACPIMode, 427 430 restrictedCloseActions); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98674 r98675 295 295 else 296 296 UINotificationMessage::cannotResumeMachine(comConsole); 297 } 298 return fSuccess; 299 } 300 301 bool UISession::acquireSnapshotCount(ulong &uCount) 302 { 303 CMachine comMachine = machine(); 304 const ULONG uSnapshotCount = comMachine.GetSnapshotCount(); 305 const bool fSuccess = comMachine.isOk(); 306 if (!fSuccess) 307 UINotificationMessage::cannotAcquireMachineParameter(comMachine); 308 else 309 uCount = uSnapshotCount; 310 return fSuccess; 311 } 312 313 bool UISession::acquireCurrentSnapshotName(QString &strName) 314 { 315 CMachine comMachine = machine(); 316 CSnapshot comSnapshot = comMachine.GetCurrentSnapshot(); 317 bool fSuccess = comMachine.isOk(); 318 if (!fSuccess) 319 UINotificationMessage::cannotAcquireMachineParameter(comMachine); 320 { 321 const QString strSnapshotName = comSnapshot.GetName(); 322 fSuccess = comSnapshot.isOk(); 323 if (!fSuccess) 324 UINotificationMessage::cannotAcquireSnapshotParameter(comSnapshot); 325 else 326 strName = strSnapshotName; 297 327 } 298 328 return fSuccess; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98674 r98675 243 243 /** @} */ 244 244 245 /** @name Snapshot stuff. 246 ** @{ */ 247 /** Acquires snapshot count. */ 248 bool acquireSnapshotCount(ulong &uCount); 249 /** Acquires current snapshot name. */ 250 bool acquireCurrentSnapshotName(QString &strName); 251 /** @} */ 252 245 253 /** @name Keyboard stuff. 246 254 ** @{ */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp
r98524 r98675 38 38 39 39 /* GUI includes: */ 40 #include "QIDialogButtonBox.h" 41 #include "UICommon.h" 42 #include "UIConverter.h" 43 #include "UIExtraDataManager.h" 40 44 #include "UIIconPool.h" 45 #include "UIMachine.h" 46 #include "UIMessageCenter.h" 41 47 #include "UIVMCloseDialog.h" 42 #include "UIExtraDataManager.h" 43 #include "UIMessageCenter.h" 44 #include "UIConverter.h" 45 #include "UICommon.h" 46 #include "QIDialogButtonBox.h" 47 48 /* COM includes: */ 49 #include "CMachine.h" 50 #include "CSession.h" 51 #include "CConsole.h" 52 #include "CSnapshot.h" 53 54 55 UIVMCloseDialog::UIVMCloseDialog(QWidget *pParent, CMachine &comMachine, 48 49 50 UIVMCloseDialog::UIVMCloseDialog(QWidget *pParent, UIMachine *pMachine, 56 51 bool fIsACPIEnabled, MachineCloseAction restictedCloseActions) 57 52 : QIWithRetranslateUI<QIDialog>(pParent) 58 , m_ comMachine(comMachine)53 , m_pMachine(pMachine) 59 54 , m_fIsACPIEnabled(fIsACPIEnabled) 60 55 , m_restictedCloseActions(restictedCloseActions) … … 543 538 { 544 539 /* Get actual machine-state: */ 545 KMachineState machineState = m_comMachine.GetState(); 540 KMachineState enmActualState = KMachineState_Null; 541 m_pMachine->acquireLiveMachineState(enmActualState); 546 542 547 543 /* Check which close-actions are resticted: */ … … 555 551 setButtonVisibleDetach(fIsDetachAllowed); 556 552 /* Make 'Detach' button enabled/disabled depending on machine-state: */ 557 setButtonEnabledDetach( machineState != KMachineState_Stuck);553 setButtonEnabledDetach(enmActualState != KMachineState_Stuck); 558 554 559 555 /* Make 'Save state' button visible/hidden depending on restriction: */ 560 556 setButtonVisibleSave(fIsStateSavingAllowed); 561 557 /* Make 'Save state' button enabled/disabled depending on machine-state: */ 562 setButtonEnabledSave( machineState != KMachineState_Stuck);558 setButtonEnabledSave(enmActualState != KMachineState_Stuck); 563 559 564 560 /* Make 'Shutdown' button visible/hidden depending on restriction: */ 565 561 setButtonVisibleShutdown(fIsACPIShutdownAllowed); 566 562 /* Make 'Shutdown' button enabled/disabled depending on console and machine-state: */ 567 setButtonEnabledShutdown(m_fIsACPIEnabled && machineState != KMachineState_Stuck);563 setButtonEnabledShutdown(m_fIsACPIEnabled && enmActualState != KMachineState_Stuck); 568 564 569 565 /* Make 'Power off' button visible/hidden depending on restriction: */ 570 566 setButtonVisiblePowerOff(fIsPowerOffAllowed); 571 567 /* Make the Restore Snapshot checkbox visible/hidden depending on snapshot count & restrictions: */ 572 setCheckBoxVisibleDiscard(fIsPowerOffAndRestoreAllowed && m_comMachine.GetSnapshotCount() > 0); 568 ulong uSnapshotCount = 0; 569 m_pMachine->acquireSnapshotCount(uSnapshotCount); 570 setCheckBoxVisibleDiscard(fIsPowerOffAndRestoreAllowed && uSnapshotCount > 0); 573 571 /* Assign Restore Snapshot checkbox text: */ 574 if (!m_comMachine.GetCurrentSnapshot().isNull()) 575 m_strDiscardCheckBoxText = m_comMachine.GetCurrentSnapshot().GetName(); 572 if (uSnapshotCount > 0) 573 { 574 QString strCurrentSnapshotName; 575 m_pMachine->acquireCurrentSnapshotName(strCurrentSnapshotName); 576 m_strDiscardCheckBoxText = strCurrentSnapshotName; 577 } 576 578 577 579 /* Check which radio-button should be initially chosen: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h
r98524 r98675 47 47 class QRadioButton; 48 48 class QVBoxLayout; 49 class CMachine;49 class UIMachine; 50 50 51 51 /** QIDialog extension to handle Runtime UI close-event. */ … … 57 57 58 58 /** Constructs close dialog passing @a pParent to the base-class. 59 * @param comMachine Brings the machinedialog created for.59 * @param pMachine Brings the machine UI dialog created for. 60 60 * @param fIsACPIEnabled Brings whether ACPI is enabled. 61 61 * @param restictedCloseActions Brings a set of restricted actions. */ 62 UIVMCloseDialog(QWidget *pParent, CMachine &comMachine,62 UIVMCloseDialog(QWidget *pParent, UIMachine *pMachine, 63 63 bool fIsACPIEnabled, MachineCloseAction restictedCloseActions); 64 64 … … 137 137 void updatePixmaps(); 138 138 139 /** Holds the live machinereference. */140 CMachine &m_comMachine;139 /** Holds the machine UI reference. */ 140 UIMachine *m_pMachine; 141 141 /** Holds whether ACPI is enabled. */ 142 142 bool m_fIsACPIEnabled; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r98452 r98675 566 566 /* Get snapshot(s): */ 567 567 QString strSnapshotName; 568 if (machine().GetSnapshotCount() > 0) 568 ulong uSnapshotCount = 0; 569 uimachine()->acquireSnapshotCount(uSnapshotCount); 570 if (uSnapshotCount > 0) 569 571 { 570 CSnapshot snapshot = machine().GetCurrentSnapshot(); 571 strSnapshotName = " (" + snapshot.GetName() + ")"; 572 QString strCurrentSnapshotName; 573 uimachine()->acquireCurrentSnapshotName(strCurrentSnapshotName); 574 strSnapshotName = " (" + strCurrentSnapshotName + ")"; 572 575 } 573 576 /* Update mini-toolbar text: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r98419 r98675 311 311 /* Get snapshot(s): */ 312 312 QString strSnapshotName; 313 if (machine().GetSnapshotCount() > 0) 313 ulong uSnapshotCount = 0; 314 uimachine()->acquireSnapshotCount(uSnapshotCount); 315 if (uSnapshotCount > 0) 314 316 { 315 CSnapshot snapshot = machine().GetCurrentSnapshot(); 316 strSnapshotName = " (" + snapshot.GetName() + ")"; 317 QString strCurrentSnapshotName; 318 uimachine()->acquireCurrentSnapshotName(strCurrentSnapshotName); 319 strSnapshotName = " (" + strCurrentSnapshotName + ")"; 317 320 } 318 321 /* Update mini-toolbar text: */
Note:
See TracChangeset
for help on using the changeset viewer.