Changeset 46726 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 21, 2013 2:32:44 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
r46686 r46726 47 47 const char* UIDefs::GUI_HideFromManager = "GUI/HideFromManager"; 48 48 const char* UIDefs::GUI_PreventReconfiguration = "GUI/PreventReconfiguration"; 49 const char* UIDefs::GUI_PreventSnapshotOperations = "GUI/PreventSnapshotOperations"; 49 50 const char* UIDefs::GUI_HideDetails = "GUI/HideDetails"; 50 51 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
r46708 r46726 119 119 extern const char* GUI_HideFromManager; 120 120 extern const char* GUI_PreventReconfiguration; 121 extern const char* GUI_PreventSnapshotOperations; 121 122 extern const char* GUI_HideDetails; 122 123 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r46708 r46726 3721 3721 /* 'true' if guest-screen auto-mounting approved by the extra-data: */ 3722 3722 return isApprovedByExtraData(machine, GUI_AutomountGuestScreens); 3723 } 3724 3725 /* static */ 3726 bool VBoxGlobal::shouldWeAllowSnapshotOperations(CMachine &machine, 3727 bool fIncludingSanityCheck /*= true*/) 3728 { 3729 if (fIncludingSanityCheck) 3730 { 3731 /* 'false' for null machines, 3732 * we can't operate snapshot in that case: */ 3733 if (machine.isNull()) 3734 return false; 3735 3736 /* 'false' for inaccessible machines, 3737 * we can't operate snapshot in that case: */ 3738 if (!machine.GetAccessible()) 3739 return false; 3740 } 3741 3742 /* 'true' if snapshot operations are not restricted by the extra-data: */ 3743 return !isApprovedByExtraData(machine, GUI_PreventSnapshotOperations); 3723 3744 } 3724 3745 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r46708 r46726 383 383 bool fIncludingMachineGeneralCheck = false); 384 384 static bool shouldWeAutoMountGuestScreens(CMachine &machine, bool fIncludingSanityCheck = true); 385 static bool shouldWeAllowSnapshotOperations(CMachine &machine, bool fIncludingSanityCheck = true); 385 386 static QList<IndicatorType> restrictedStatusBarIndicators(CMachine &machine); 386 387 static QList<MachineCloseAction> restrictedMachineCloseActions(CMachine &machine); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r46626 r46726 33 33 #include "UIImageTools.h" 34 34 #include "UINetworkManager.h" 35 #include "VBoxGlobal.h" 35 36 36 37 /* COM includes: */ … … 98 99 }; 99 100 100 UIMachineMenuBar::UIMachineMenuBar( )101 UIMachineMenuBar::UIMachineMenuBar(const CMachine &machine) 101 102 /* On the Mac we add some items only the first time, cause otherwise they 102 103 * will be merged more than once to the application menu by Qt. */ 103 104 : m_fIsFirstTime(true) 105 , m_machine(machine) 104 106 { 105 107 } … … 195 197 /* Machine submenu: */ 196 198 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog)); 197 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot)); 199 if (vboxGlobal().shouldWeAllowSnapshotOperations(m_machine)) 200 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot)); 201 else 202 gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot)->setEnabled(false); 198 203 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot)); 199 204 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog)); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.h
r44529 r46726 26 26 #include <QList> 27 27 28 /* COM includes: */ 29 #include "COMEnums.h" 30 #include "CMachine.h" 31 28 32 /* Global forwards */ 29 33 class QMenu; … … 33 37 { 34 38 public: 35 UIMachineMenuBar(); 39 40 UIMachineMenuBar(const CMachine &machine); 36 41 37 42 QMenu* createMenu(UIMainMenuType fOptions = UIMainMenuType_All); … … 50 55 51 56 bool m_fIsFirstTime; 57 CMachine m_machine; 52 58 }; 53 59 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r46626 r46726 893 893 void UISession::prepareMenuPool() 894 894 { 895 m_pMenuPool = new UIMachineMenuBar ;895 m_pMenuPool = new UIMachineMenuBar(session().GetMachine()); 896 896 } 897 897 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp
r45432 r46726 340 340 , mTakeSnapshotAction (new QAction (mCurStateActionGroup)) 341 341 , mCloneSnapshotAction(new QAction(mCurStateActionGroup)) 342 , m_fShapshotOperationsAllowed(false) 342 343 { 343 344 /* Apply UI decorations */ … … 438 439 mMachineId = QString::null; 439 440 mSessionState = KSessionState_Null; 441 m_fShapshotOperationsAllowed = false; 440 442 } 441 443 else … … 443 445 mMachineId = aMachine.GetId(); 444 446 mSessionState = aMachine.GetSessionState(); 447 m_fShapshotOperationsAllowed = vboxGlobal().shouldWeAllowSnapshotOperations(mMachine); 445 448 } 446 449 … … 509 512 510 513 /* Enable/disable deleting snapshot */ 511 mDeleteSnapshotAction->setEnabled ( canTakeDeleteSnapshot512 && mCurSnapshotItem && item && !item->isCurrentStateItem());514 mDeleteSnapshotAction->setEnabled (m_fShapshotOperationsAllowed && 515 canTakeDeleteSnapshot && mCurSnapshotItem && item && !item->isCurrentStateItem()); 513 516 514 517 /* Enable/disable the details action regardless of the session state */ … … 516 519 517 520 /* Enable/disable taking snapshots */ 518 mTakeSnapshotAction->setEnabled ( ( canTakeDeleteSnapshot519 && mCurSnapshotItem && item && item->isCurrentStateItem())520 || (item && !mCurSnapshotItem));521 mTakeSnapshotAction->setEnabled (m_fShapshotOperationsAllowed && 522 ((canTakeDeleteSnapshot && mCurSnapshotItem && item && item->isCurrentStateItem()) || 523 (item && !mCurSnapshotItem))); 521 524 522 525 /* Enable/disable cloning snapshots */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.h
r44528 r46726 109 109 110 110 QTimer mAgeUpdateTimer; 111 112 bool m_fShapshotOperationsAllowed; 111 113 }; 112 114
Note:
See TracChangeset
for help on using the changeset viewer.