Changeset 47478 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 30, 2013 2:54:39 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r47265 r47478 57 57 template<> bool canConvert<StorageSlot>(); 58 58 template<> bool canConvert<RuntimeMenuType>(); 59 template<> bool canConvert<UIVisualStateType>(); 59 60 template<> bool canConvert<DetailsElementType>(); 60 61 template<> bool canConvert<GlobalSettingsPageType>(); … … 91 92 template<> QString toInternalString(const RuntimeMenuType &runtimeMenuType); 92 93 template<> RuntimeMenuType fromInternalString<RuntimeMenuType>(const QString &strRuntimeMenuType); 94 template<> QString toInternalString(const UIVisualStateType &visualStateType); 95 template<> UIVisualStateType fromInternalString<UIVisualStateType>(const QString &strVisualStateType); 93 96 template<> QString toString(const DetailsElementType &detailsElementType); 94 97 template<> DetailsElementType fromString<DetailsElementType>(const QString &strDetailsElementType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r46898 r47478 33 33 template<> bool canConvert<StorageSlot>() { return true; } 34 34 template<> bool canConvert<RuntimeMenuType>() { return true; } 35 template<> bool canConvert<UIVisualStateType>() { return true; } 35 36 template<> bool canConvert<DetailsElementType>() { return true; } 36 37 template<> bool canConvert<GlobalSettingsPageType>() { return true; } … … 305 306 /* Corresponding type for known words: */ 306 307 return values.at(keys.indexOf(QRegExp(strRuntimeMenuType, Qt::CaseInsensitive))); 308 } 309 310 /* QString <= UIVisualStateType: */ 311 template<> QString toInternalString(const UIVisualStateType &visualStateType) 312 { 313 QString strResult; 314 switch (visualStateType) 315 { 316 case UIVisualStateType_Normal: strResult = "Normal"; break; 317 case UIVisualStateType_Fullscreen: strResult = "Fullscreen"; break; 318 case UIVisualStateType_Seamless: strResult = "Seamless"; break; 319 case UIVisualStateType_Scale: strResult = "Scale"; break; 320 case UIVisualStateType_All: strResult = "All"; break; 321 default: 322 { 323 AssertMsgFailed(("No text for visual state type=%d", visualStateType)); 324 break; 325 } 326 } 327 return strResult; 328 } 329 330 /* UIVisualStateType <= QString: */ 331 template<> UIVisualStateType fromInternalString<UIVisualStateType>(const QString &strVisualStateType) 332 { 333 /* Here we have some fancy stuff allowing us 334 * to search through the keys using 'case-insensitive' rule: */ 335 QStringList keys; QList<UIVisualStateType> values; 336 keys << "Normal"; values << UIVisualStateType_Normal; 337 keys << "Fullscreen"; values << UIVisualStateType_Fullscreen; 338 keys << "Seamless"; values << UIVisualStateType_Seamless; 339 keys << "Scale"; values << UIVisualStateType_Scale; 340 keys << "All"; values << UIVisualStateType_All; 341 /* Invalid type for unknown words: */ 342 if (!keys.contains(strVisualStateType, Qt::CaseInsensitive)) 343 return UIVisualStateType_Invalid; 344 /* Corresponding type for known words: */ 345 return values.at(keys.indexOf(QRegExp(strVisualStateType, Qt::CaseInsensitive))); 307 346 } 308 347 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
r46797 r47478 53 53 /* Machine-window definitions: */ 54 54 const char* UIDefs::GUI_RestrictedRuntimeMenus = "GUI/RestrictedRuntimeMenus"; 55 const char* UIDefs::GUI_RestrictedVisualStates = "GUI/RestrictedVisualStates"; 55 56 const char* UIDefs::GUI_Input_MachineShortcuts = "GUI/Input/MachineShortcuts"; 56 57 const char* UIDefs::GUI_LastNormalWindowPosition = "GUI/LastNormalWindowPosition"; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
r46898 r47478 125 125 /* Machine-window declarations: */ 126 126 extern const char* GUI_RestrictedRuntimeMenus; 127 extern const char* GUI_RestrictedVisualStates; 127 128 extern const char* GUI_Input_MachineShortcuts; 128 129 extern const char* GUI_LastNormalWindowPosition; … … 240 241 }; 241 242 243 /* Runtime UI visual-state types: */ 244 enum UIVisualStateType 245 { 246 UIVisualStateType_Invalid = 0, 247 UIVisualStateType_Normal = RT_BIT(0), 248 UIVisualStateType_Fullscreen = RT_BIT(1), 249 UIVisualStateType_Seamless = RT_BIT(2), 250 UIVisualStateType_Scale = RT_BIT(3), 251 UIVisualStateType_All = 0xFF 252 }; 253 242 254 /* Details element type: */ 243 255 enum DetailsElementType -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r47401 r47478 3779 3779 if (value != RuntimeMenuType_Invalid) 3780 3780 result = static_cast<RuntimeMenuType>(result | value); 3781 } 3782 /* Return result: */ 3783 return result; 3784 } 3785 3786 /* static */ 3787 UIVisualStateType VBoxGlobal::restrictedVisualStateTypes(CMachine &machine) 3788 { 3789 /* Prepare result: */ 3790 UIVisualStateType result = UIVisualStateType_Invalid; 3791 /* Load restricted visual-state-types: */ 3792 QString strList(machine.GetExtraData(GUI_RestrictedVisualStates)); 3793 QStringList list = strList.split(','); 3794 /* Convert list into appropriate values: */ 3795 foreach (const QString &strValue, list) 3796 { 3797 UIVisualStateType value = gpConverter->fromInternalString<UIVisualStateType>(strValue); 3798 if (value != UIVisualStateType_Invalid) 3799 result = static_cast<UIVisualStateType>(result | value); 3781 3800 } 3782 3801 /* Return result: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r46831 r47478 375 375 static bool shouldWeAllowSnapshotOperations(CMachine &machine, bool fIncludingSanityCheck = true); 376 376 static RuntimeMenuType restrictedRuntimeMenuTypes(CMachine &machine); 377 static UIVisualStateType restrictedVisualStateTypes(CMachine &machine); 377 378 static QList<IndicatorType> restrictedStatusBarIndicators(CMachine &machine); 378 379 static QList<MachineCloseAction> restrictedMachineCloseActions(CMachine &machine); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
r44529 r47478 25 25 26 26 /* GUI includes: */ 27 #include "UI MachineDefs.h"27 #include "UIDefs.h" 28 28 #ifdef Q_WS_MAC 29 29 # include <CoreFoundation/CFBase.h> -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r45377 r47478 370 370 , m_pSession(0) 371 371 , m_pVisualState(0) 372 , m_allowedVisualStateTypes(UIVisualStateType_Invalid) 372 373 { 373 374 /* Store self pointer: */ … … 505 506 /* Load machine settings: */ 506 507 CMachine machine = uisession()->session().GetMachine(); 508 UIVisualStateType restrictedVisualStateTypes = VBoxGlobal::restrictedVisualStateTypes(machine); 509 m_allowedVisualStateTypes = static_cast<UIVisualStateType>(UIVisualStateType_All ^ restrictedVisualStateTypes); 507 510 508 511 /* Load extra-data settings: */ … … 520 523 /* Test 'scale' flag: */ 521 524 QString strScaleSettings = machine.GetExtraData(GUI_Scale); 522 if (strScaleSettings == "on" )525 if (strScaleSettings == "on" && isVisualStateAllowedScale()) 523 526 { 524 527 fIsSomeExtendedModeChosen = true; … … 532 535 /* Test 'seamless' flag: */ 533 536 QString strSeamlessSettings = machine.GetExtraData(GUI_Seamless); 534 if (strSeamlessSettings == "on" )537 if (strSeamlessSettings == "on" && isVisualStateAllowedSeamless()) 535 538 { 536 539 fIsSomeExtendedModeChosen = true; … … 545 548 /* Test 'fullscreen' flag: */ 546 549 QString strFullscreenSettings = machine.GetExtraData(GUI_Fullscreen); 547 if (strFullscreenSettings == "on" )550 if (strFullscreenSettings == "on" && isVisualStateAllowedFullscreen()) 548 551 { 549 552 fIsSomeExtendedModeChosen = true; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r45377 r47478 23 23 #include <QObject> 24 24 25 /* GUI includes: */ 25 /* GUI includes: */ 26 #include "UIDefs.h" 26 27 #include "UIMachineDefs.h" 27 28 … … 50 51 UISession *uisession() const { return m_pSession; } 51 52 53 /* API: Visual-state stuff: */ 54 bool isVisualStateAllowedFullscreen() const { return m_allowedVisualStateTypes & UIVisualStateType_Fullscreen; } 55 bool isVisualStateAllowedSeamless() const { return m_allowedVisualStateTypes & UIVisualStateType_Seamless; } 56 bool isVisualStateAllowedScale() const { return m_allowedVisualStateTypes & UIVisualStateType_Scale; } 57 52 58 private slots: 53 59 … … 75 81 UISession *m_pSession; 76 82 UIVisualState *m_pVisualState; 83 UIVisualStateType m_allowedVisualStateTypes; 77 84 78 85 /* Friend classes: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineDefs.h
r46795 r47478 22 22 /* Global includes */ 23 23 #include <iprt/cdefs.h> 24 25 /* Machine states enum: */26 enum UIVisualStateType27 {28 UIVisualStateType_Normal,29 UIVisualStateType_Fullscreen,30 UIVisualStateType_Seamless,31 UIVisualStateType_Scale32 };33 24 34 25 /* Machine elements enum: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r47396 r47478 448 448 /* Update action states: */ 449 449 gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setEnabled(uisession()->isGuestSupportsGraphics()); 450 gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)->setEnabled(uisession()->is GuestSupportsSeamless());450 gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)->setEnabled(uisession()->isVisualStateAllowedSeamless() && uisession()->isGuestSupportsSeamless()); 451 451 } 452 452 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r47103 r47478 21 21 22 22 /* GUI includes: */ 23 #include "UI MachineDefs.h"23 #include "UIDefs.h" 24 24 #include <QIWithRetranslateUI.h> 25 25 #ifdef VBOX_WITH_DEBUGGER_GUI -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r46847 r47478 34 34 #include "UINetworkManager.h" 35 35 #include "VBoxGlobal.h" 36 #include "UISession.h" 36 37 37 38 /* COM includes: */ … … 99 100 }; 100 101 101 UIMachineMenuBar::UIMachineMenuBar( const CMachine &machine)102 UIMachineMenuBar::UIMachineMenuBar(UISession *pSession, const CMachine &machine) 102 103 /* On the Mac we add some items only the first time, cause otherwise they 103 104 * will be merged more than once to the application menu by Qt. */ 104 : m_machine(machine) 105 : m_pSession(pSession) 106 , m_machine(machine) 105 107 { 106 108 } … … 226 228 227 229 /* View submenu: */ 228 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen)); 229 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)); 230 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Scale)); 231 pMenu->addSeparator(); 230 bool fIsAllowedFullscreen = uisession()->isVisualStateAllowedFullscreen(); 231 bool fIsAllowedSeamless = uisession()->isVisualStateAllowedSeamless(); 232 bool fIsAllowedScale = uisession()->isVisualStateAllowedScale(); 233 gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen)->setEnabled(fIsAllowedFullscreen); 234 if (fIsAllowedFullscreen) 235 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen)); 236 gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)->setEnabled(fIsAllowedSeamless); 237 if (fIsAllowedSeamless) 238 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)); 239 gActionPool->action(UIActionIndexRuntime_Toggle_Scale)->setEnabled(fIsAllowedScale); 240 if (fIsAllowedScale) 241 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Scale)); 242 if (fIsAllowedFullscreen || fIsAllowedSeamless || fIsAllowedScale) 243 pMenu->addSeparator(); 232 244 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)); 233 245 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.h
r46847 r47478 33 33 class QMenu; 34 34 class QMenuBar; 35 class UISession; 35 36 36 37 class UIMachineMenuBar … … 38 39 public: 39 40 40 UIMachineMenuBar( const CMachine &machine);41 UIMachineMenuBar(UISession *pSession, const CMachine &machine); 41 42 42 43 QMenu* createMenu(RuntimeMenuType fOptions = RuntimeMenuType_All); … … 54 55 void prepareMenuHelp(QMenu *pMenu); 55 56 57 /* Helper: UI session stuff: */ 58 UISession* uisession() const { return m_pSession; } 59 60 /* Variables: */ 61 UISession *m_pSession; 56 62 CMachine m_machine; 57 63 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
r44909 r47478 25 25 /* GUI includes: */ 26 26 #include "QIWithRetranslateUI.h" 27 #include "UI MachineDefs.h"27 #include "UIDefs.h" 28 28 29 29 /* COM includes: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h
r47396 r47478 27 27 28 28 /* GUI includes: */ 29 #include "UI MachineDefs.h"29 #include "UIDefs.h" 30 30 31 31 /* Forward declarations: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r47401 r47478 457 457 } 458 458 459 bool UISession::isVisualStateAllowedFullscreen() const 460 { 461 return m_pMachine->isVisualStateAllowedFullscreen(); 462 } 463 464 bool UISession::isVisualStateAllowedSeamless() const 465 { 466 return m_pMachine->isVisualStateAllowedSeamless(); 467 } 468 469 bool UISession::isVisualStateAllowedScale() const 470 { 471 return m_pMachine->isVisualStateAllowedScale(); 472 } 473 459 474 bool UISession::setPause(bool fOn) 460 475 { … … 904 919 void UISession::prepareMenuPool() 905 920 { 906 m_pMenuPool = new UIMachineMenuBar( session().GetMachine());921 m_pMenuPool = new UIMachineMenuBar(this, session().GetMachine()); 907 922 } 908 923 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r47396 r47478 103 103 QCursor cursor() const { return m_cursor; } 104 104 105 /* API: Visual-state stuff: */ 106 bool isVisualStateAllowedFullscreen() const; 107 bool isVisualStateAllowedSeamless() const; 108 bool isVisualStateAllowedScale() const; 109 105 110 bool isSaved() const { return machineState() == KMachineState_Saved; } 106 111 bool isTurnedOff() const { return machineState() == KMachineState_PoweredOff || -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r46797 r47478 29 29 #include "UIMachineLogicFullscreen.h" 30 30 #include "UIMachineWindowFullscreen.h" 31 #include "UIMachineDefs.h" 31 32 #include "UIMiniToolBar.h" 32 33 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r46797 r47478 31 31 #include "UIMachineViewSeamless.h" 32 32 #ifndef Q_WS_MAC 33 # include "UIMachineDefs.h" 33 34 # include "UIMiniToolBar.h" 34 35 #endif /* !Q_WS_MAC */
Note:
See TracChangeset
for help on using the changeset viewer.