Changeset 53406 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 27, 2014 2:49:33 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r53086 r53406 578 578 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings: strResult = "StatusBarSettings"; break; 579 579 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar: strResult = "ToggleStatusBar"; break; 580 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor: strResult = "ScaleFactor"; break; 580 581 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize: strResult = "Resize"; break; 581 582 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen: strResult = "Multiscreen"; break; … … 607 608 keys << "StatusBarSettings"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings; 608 609 keys << "ToggleStatusBar"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar; 610 keys << "ScaleFactor"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor; 609 611 keys << "Resize"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize; 610 612 keys << "Multiscreen"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r53372 r53406 382 382 RuntimeMenuViewActionType_StatusBarSettings = RT_BIT(9), 383 383 RuntimeMenuViewActionType_ToggleStatusBar = RT_BIT(10), 384 RuntimeMenuViewActionType_Resize = RT_BIT(11), 385 RuntimeMenuViewActionType_Multiscreen = RT_BIT(12), 384 RuntimeMenuViewActionType_ScaleFactor = RT_BIT(11), 385 RuntimeMenuViewActionType_Resize = RT_BIT(12), 386 RuntimeMenuViewActionType_Multiscreen = RT_BIT(13), 386 387 RuntimeMenuViewActionType_All = 0xFFFF 387 388 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
r53320 r53406 814 814 }; 815 815 816 class UIActionMenuScaleFactor : public UIActionMenu 817 { 818 Q_OBJECT; 819 820 public: 821 822 UIActionMenuScaleFactor(UIActionPool *pParent) 823 : UIActionMenu(pParent) {} 824 825 protected: 826 827 /** Returns action extra-data ID. */ 828 virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor; } 829 /** Returns action extra-data key. */ 830 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor); } 831 /** Returns whether action is allowed. */ 832 virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor); } 833 834 void retranslateUi() 835 { 836 setName(QApplication::translate("UIActionPool", "S&cale Factor")); 837 } 838 }; 839 816 840 class UIActionMenuInput : public UIActionMenu 817 841 { … … 1893 1917 /* Update configuration: */ 1894 1918 updateConfiguration(); 1919 } 1920 1921 void UIActionPoolRuntime::sltHandleActionTriggerViewScaleFactor(QAction *pAction) 1922 { 1923 /* Make sure sender is valid: */ 1924 AssertPtrReturnVoid(pAction); 1925 1926 /* Change scale-factor directly: */ 1927 const double dScaleFactor = pAction->property("Requested Scale Factor").toDouble(); 1928 gEDataManager->setScaleFactor(dScaleFactor, vboxGlobal().managedVMUuid()); 1895 1929 } 1896 1930 … … 1986 2020 m_pool[UIActionIndexRT_M_View_M_StatusBar_S_Settings] = new UIActionSimpleShowStatusBarSettingsWindow(this); 1987 2021 m_pool[UIActionIndexRT_M_View_M_StatusBar_T_Visibility] = new UIActionToggleStatusBar(this); 2022 m_pool[UIActionIndexRT_M_View_M_ScaleFactor] = new UIActionMenuScaleFactor(this); 1988 2023 1989 2024 /* 'Input' actions: */ … … 2042 2077 m_menuUpdateHandlers[UIActionIndexRT_M_View_M_MenuBar].ptfr = &UIActionPoolRuntime::updateMenuViewMenuBar; 2043 2078 m_menuUpdateHandlers[UIActionIndexRT_M_View_M_StatusBar].ptfr = &UIActionPoolRuntime::updateMenuViewStatusBar; 2079 m_menuUpdateHandlers[UIActionIndexRT_M_View_M_ScaleFactor].ptfr = &UIActionPoolRuntime::updateMenuViewScaleFactor; 2044 2080 m_menuUpdateHandlers[UIActionIndexRT_M_Input].ptfr = &UIActionPoolRuntime::updateMenuInput; 2045 2081 m_menuUpdateHandlers[UIActionIndexRT_M_Input_M_Keyboard].ptfr = &UIActionPoolRuntime::updateMenuInputKeyboard; … … 2322 2358 } 2323 2359 2360 /* 'Scale Factor' submenu: */ 2361 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_ScaleFactor)) || fSeparator; 2362 updateMenuViewScaleFactor(); 2363 2324 2364 /* Do we have to show resize or multiscreen menu? */ 2325 2365 const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize); … … 2379 2419 } 2380 2420 2421 /* 'Scale Factor' submenu: */ 2422 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_ScaleFactor)) || fSeparator; 2423 updateMenuViewScaleFactor(); 2424 2381 2425 /* Do we have to show resize menu? */ 2382 2426 const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize); … … 2429 2473 /* Mark menu as valid: */ 2430 2474 m_invalidations.remove(UIActionIndexRT_M_View_M_StatusBar); 2475 } 2476 2477 void UIActionPoolRuntime::updateMenuViewScaleFactor() 2478 { 2479 /* Get corresponding menu: */ 2480 UIMenu *pMenu = action(UIActionIndexRT_M_View_M_ScaleFactor)->menu(); 2481 AssertPtrReturnVoid(pMenu); 2482 /* Clear contents: */ 2483 pMenu->clear(); 2484 2485 /* Get corresponding scale-factor: */ 2486 const double dCurrentScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid()); 2487 2488 /* Prepare new contents: */ 2489 const QList<double> factors = QList<double>() 2490 << 1.0 2491 << 1.1 2492 << 1.25 2493 << 1.5 2494 << 1.75 2495 << 2.0; 2496 2497 /* Create exclusive 'scale-factor' action-group: */ 2498 QActionGroup *pActionGroup = new QActionGroup(pMenu); 2499 AssertPtrReturnVoid(pActionGroup); 2500 { 2501 /* Configure exclusive 'scale-factor' action-group: */ 2502 pActionGroup->setExclusive(true); 2503 /* For every available scale-factor: */ 2504 foreach (const double &dScaleFactor, factors) 2505 { 2506 /* Create exclusive 'scale-factor' action: */ 2507 QAction *pAction = pActionGroup->addAction(tr("%1%", "scale-factor") 2508 .arg(dScaleFactor * 100)); 2509 AssertPtrReturnVoid(pAction); 2510 { 2511 /* Configure exclusive 'scale-factor' action: */ 2512 pAction->setProperty("Requested Scale Factor", dScaleFactor); 2513 pAction->setCheckable(true); 2514 if (dScaleFactor == dCurrentScaleFactor) 2515 pAction->setChecked(true); 2516 } 2517 } 2518 /* Insert group actions into menu: */ 2519 pMenu->addActions(pActionGroup->actions()); 2520 /* Install listener for exclusive action-group: */ 2521 connect(pActionGroup, SIGNAL(triggered(QAction*)), 2522 this, SLOT(sltHandleActionTriggerViewScaleFactor(QAction*))); 2523 } 2431 2524 } 2432 2525 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
r53320 r53406 68 68 UIActionIndexRT_M_View_M_StatusBar_S_Settings, 69 69 UIActionIndexRT_M_View_M_StatusBar_T_Visibility, 70 UIActionIndexRT_M_View_M_ScaleFactor, 70 71 71 72 /* 'Input' menu actions: */ … … 183 184 void sltHandleConfigurationChange(const QString &strMachineID); 184 185 186 /** Handles 'View' : 'Scale Factor' menu : @a pAction trigger. */ 187 void sltHandleActionTriggerViewScaleFactor(QAction *pAction); 188 185 189 /** Prepare 'View' : 'Virtual Screen #' menu routine (Normal, Scale). */ 186 190 void sltPrepareMenuViewScreen(); … … 227 231 /** Update 'View' : 'Status Bar' menu routine. */ 228 232 void updateMenuViewStatusBar(); 233 /** Update 'View' : 'Scale Factor' menu routine. */ 234 void updateMenuViewScaleFactor(); 229 235 /** Update 'View' : 'Virtual Screen #' @a pMenu routine (Normal, Scale). */ 230 236 void updateMenuViewScreen(QMenu *pMenu); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r53062 r53406 898 898 m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)); 899 899 m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_S_AdjustWindow)); 900 m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_ScaleFactor)); 900 901 m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_S_TypeCAD)); 901 902 #ifdef Q_WS_X11 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
r53321 r53406 483 483 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_StatusBar)); 484 484 pMenu->addSeparator(); 485 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_ScaleFactor)); 485 486 prepareNamedAction(pMenu, tr("Virtual Screen Resize"), 486 487 UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize,
Note:
See TracChangeset
for help on using the changeset viewer.