Changeset 76005 in vbox
- Timestamp:
- Dec 6, 2018 9:11:44 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp
r75479 r76005 3244 3244 if (fAllowToShowActionResize) 3245 3245 { 3246 updateMenuView Screen(pMenu);3246 updateMenuViewResize(pMenu); 3247 3247 fSeparator = true; 3248 3248 } … … 3258 3258 if (fAllowToShowActionRemap && (m_cHostScreens > 1 || m_cGuestScreens > 1)) 3259 3259 { 3260 updateMenuView Multiscreen(pMenu);3260 updateMenuViewRemap(pMenu); 3261 3261 fSeparator = true; 3262 3262 } … … 3272 3272 if (fAllowToShowActionRescale) 3273 3273 { 3274 updateMenuView ScaleFactor(pMenu);3274 updateMenuViewRescale(pMenu); 3275 3275 fSeparator = true; 3276 3276 } … … 3848 3848 } 3849 3849 3850 void UIActionPoolRuntime::updateMenuViewScaleFactor(QMenu *pMenu) 3850 void UIActionPoolRuntime::updateMenuViewResize(QMenu *pMenu) 3851 { 3852 AssertPtrReturnVoid(pMenu); 3853 /* Prepare new contents: */ 3854 const QList<QSize> sizes = QList<QSize>() 3855 << QSize(640, 480) 3856 << QSize(800, 600) 3857 << QSize(1024, 768) 3858 << QSize(1152, 864) 3859 << QSize(1280, 720) 3860 << QSize(1280, 800) 3861 << QSize(1366, 768) 3862 << QSize(1440, 900) 3863 << QSize(1600, 900) 3864 << QSize(1680, 1050) 3865 << QSize(1920, 1080) 3866 << QSize(1920, 1200); 3867 3868 /* Get corresponding screen index and frame-buffer size: */ 3869 const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt(); 3870 const QSize screenSize = m_mapGuestScreenSize.value(iGuestScreenIndex); 3871 const bool fScreenEnabled = m_mapGuestScreenIsVisible.value(iGuestScreenIndex); 3872 3873 /* For non-primary screens: */ 3874 if (iGuestScreenIndex > 0) 3875 { 3876 /* Create 'toggle' action: */ 3877 QAction *pToggleAction = pMenu->addAction(QApplication::translate("UIActionPool", "Enable", "Virtual Screen"), 3878 this, SLOT(sltHandleActionTriggerViewScreenToggle())); 3879 AssertPtrReturnVoid(pToggleAction); 3880 { 3881 /* Configure 'toggle' action: */ 3882 pToggleAction->setEnabled(m_fGuestSupportsGraphics); 3883 pToggleAction->setProperty("Guest Screen Index", iGuestScreenIndex); 3884 pToggleAction->setCheckable(true); 3885 pToggleAction->setChecked(fScreenEnabled); 3886 /* Add separator: */ 3887 pMenu->addSeparator(); 3888 } 3889 } 3890 3891 /* Create exclusive 'resize' action-group: */ 3892 QActionGroup *pActionGroup = new QActionGroup(pMenu); 3893 AssertPtrReturnVoid(pActionGroup); 3894 { 3895 /* Configure exclusive 'resize' action-group: */ 3896 pActionGroup->setExclusive(true); 3897 /* For every available size: */ 3898 foreach (const QSize &size, sizes) 3899 { 3900 /* Create exclusive 'resize' action: */ 3901 QAction *pAction = pActionGroup->addAction(QApplication::translate("UIActionPool", "Resize to %1x%2", "Virtual Screen") 3902 .arg(size.width()).arg(size.height())); 3903 AssertPtrReturnVoid(pAction); 3904 { 3905 /* Configure exclusive 'resize' action: */ 3906 pAction->setEnabled(m_fGuestSupportsGraphics && fScreenEnabled); 3907 pAction->setProperty("Guest Screen Index", iGuestScreenIndex); 3908 pAction->setProperty("Requested Size", size); 3909 pAction->setCheckable(true); 3910 if (screenSize.width() == size.width() && 3911 screenSize.height() == size.height()) 3912 pAction->setChecked(true); 3913 } 3914 } 3915 /* Insert group actions into menu: */ 3916 pMenu->addActions(pActionGroup->actions()); 3917 /* Install listener for exclusive action-group: */ 3918 connect(pActionGroup, SIGNAL(triggered(QAction*)), 3919 this, SLOT(sltHandleActionTriggerViewScreenResize(QAction*))); 3920 } 3921 } 3922 3923 void UIActionPoolRuntime::updateMenuViewRemap(QMenu *pMenu) 3924 { 3925 AssertPtrReturnVoid(pMenu); 3926 /* Get corresponding screen index and size: */ 3927 const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt(); 3928 3929 /* Create exclusive action-group: */ 3930 QActionGroup *pActionGroup = new QActionGroup(pMenu); 3931 AssertPtrReturnVoid(pActionGroup); 3932 { 3933 /* Configure exclusive action-group: */ 3934 pActionGroup->setExclusive(true); 3935 for (int iHostScreenIndex = 0; iHostScreenIndex < m_cHostScreens; ++iHostScreenIndex) 3936 { 3937 QAction *pAction = pActionGroup->addAction(QApplication::translate("UIMultiScreenLayout", 3938 "Use Host Screen %1") 3939 .arg(iHostScreenIndex + 1)); 3940 AssertPtrReturnVoid(pAction); 3941 { 3942 pAction->setCheckable(true); 3943 pAction->setProperty("Guest Screen Index", iGuestScreenIndex); 3944 pAction->setProperty("Host Screen Index", iHostScreenIndex); 3945 if (m_mapHostScreenForGuestScreen.contains(iGuestScreenIndex) && 3946 m_mapHostScreenForGuestScreen.value(iGuestScreenIndex) == iHostScreenIndex) 3947 pAction->setChecked(true); 3948 } 3949 } 3950 /* Insert group actions into menu: */ 3951 pMenu->addActions(pActionGroup->actions()); 3952 /* Install listener for exclusive action-group: */ 3953 connect(pActionGroup, SIGNAL(triggered(QAction*)), 3954 this, SLOT(sltHandleActionTriggerViewScreenRemap(QAction*))); 3955 } 3956 } 3957 3958 void UIActionPoolRuntime::updateMenuViewRescale(QMenu *pMenu) 3851 3959 { 3852 3960 AssertPtrReturnVoid(pMenu); … … 3930 4038 } 3931 4039 3932 void UIActionPoolRuntime::updateMenuViewScreen(QMenu *pMenu)3933 {3934 AssertPtrReturnVoid(pMenu);3935 /* Prepare new contents: */3936 const QList<QSize> sizes = QList<QSize>()3937 << QSize(640, 480)3938 << QSize(800, 600)3939 << QSize(1024, 768)3940 << QSize(1152, 864)3941 << QSize(1280, 720)3942 << QSize(1280, 800)3943 << QSize(1366, 768)3944 << QSize(1440, 900)3945 << QSize(1600, 900)3946 << QSize(1680, 1050)3947 << QSize(1920, 1080)3948 << QSize(1920, 1200);3949 3950 /* Get corresponding screen index and frame-buffer size: */3951 const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt();3952 const QSize screenSize = m_mapGuestScreenSize.value(iGuestScreenIndex);3953 const bool fScreenEnabled = m_mapGuestScreenIsVisible.value(iGuestScreenIndex);3954 3955 /* For non-primary screens: */3956 if (iGuestScreenIndex > 0)3957 {3958 /* Create 'toggle' action: */3959 QAction *pToggleAction = pMenu->addAction(QApplication::translate("UIActionPool", "Enable", "Virtual Screen"),3960 this, SLOT(sltHandleActionTriggerViewScreenToggle()));3961 AssertPtrReturnVoid(pToggleAction);3962 {3963 /* Configure 'toggle' action: */3964 pToggleAction->setEnabled(m_fGuestSupportsGraphics);3965 pToggleAction->setProperty("Guest Screen Index", iGuestScreenIndex);3966 pToggleAction->setCheckable(true);3967 pToggleAction->setChecked(fScreenEnabled);3968 /* Add separator: */3969 pMenu->addSeparator();3970 }3971 }3972 3973 /* Create exclusive 'resize' action-group: */3974 QActionGroup *pActionGroup = new QActionGroup(pMenu);3975 AssertPtrReturnVoid(pActionGroup);3976 {3977 /* Configure exclusive 'resize' action-group: */3978 pActionGroup->setExclusive(true);3979 /* For every available size: */3980 foreach (const QSize &size, sizes)3981 {3982 /* Create exclusive 'resize' action: */3983 QAction *pAction = pActionGroup->addAction(QApplication::translate("UIActionPool", "Resize to %1x%2", "Virtual Screen")3984 .arg(size.width()).arg(size.height()));3985 AssertPtrReturnVoid(pAction);3986 {3987 /* Configure exclusive 'resize' action: */3988 pAction->setEnabled(m_fGuestSupportsGraphics && fScreenEnabled);3989 pAction->setProperty("Guest Screen Index", iGuestScreenIndex);3990 pAction->setProperty("Requested Size", size);3991 pAction->setCheckable(true);3992 if (screenSize.width() == size.width() &&3993 screenSize.height() == size.height())3994 pAction->setChecked(true);3995 }3996 }3997 /* Insert group actions into menu: */3998 pMenu->addActions(pActionGroup->actions());3999 /* Install listener for exclusive action-group: */4000 connect(pActionGroup, SIGNAL(triggered(QAction*)),4001 this, SLOT(sltHandleActionTriggerViewScreenResize(QAction*)));4002 }4003 }4004 4005 void UIActionPoolRuntime::updateMenuViewMultiscreen(QMenu *pMenu)4006 {4007 AssertPtrReturnVoid(pMenu);4008 /* Get corresponding screen index and size: */4009 const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt();4010 4011 /* Create exclusive action-group: */4012 QActionGroup *pActionGroup = new QActionGroup(pMenu);4013 AssertPtrReturnVoid(pActionGroup);4014 {4015 /* Configure exclusive action-group: */4016 pActionGroup->setExclusive(true);4017 for (int iHostScreenIndex = 0; iHostScreenIndex < m_cHostScreens; ++iHostScreenIndex)4018 {4019 QAction *pAction = pActionGroup->addAction(QApplication::translate("UIMultiScreenLayout",4020 "Use Host Screen %1")4021 .arg(iHostScreenIndex + 1));4022 AssertPtrReturnVoid(pAction);4023 {4024 pAction->setCheckable(true);4025 pAction->setProperty("Guest Screen Index", iGuestScreenIndex);4026 pAction->setProperty("Host Screen Index", iHostScreenIndex);4027 if (m_mapHostScreenForGuestScreen.contains(iGuestScreenIndex) &&4028 m_mapHostScreenForGuestScreen.value(iGuestScreenIndex) == iHostScreenIndex)4029 pAction->setChecked(true);4030 }4031 }4032 /* Insert group actions into menu: */4033 pMenu->addActions(pActionGroup->actions());4034 /* Install listener for exclusive action-group: */4035 connect(pActionGroup, SIGNAL(triggered(QAction*)),4036 this, SLOT(sltHandleActionTriggerViewScreenRemap(QAction*)));4037 }4038 }4039 4040 4040 void UIActionPoolRuntime::updateMenuInput() 4041 4041 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.h
r75339 r76005 246 246 /** Updates 'View' : 'Status Bar' menu. */ 247 247 void updateMenuViewStatusBar(); 248 /** Updates 'View' : ' Scale Factor' menu. */249 void updateMenuView ScaleFactor(QMenu *pMenu);250 /** Updates 'View' : 'Virtual Screen #' @a pMenu (Normal, Scale). */251 void updateMenuView Screen(QMenu *pMenu);252 /** Updates 'View' : 'Virtual Screen #' @a pMenu (Fullscreen, Seamless). */253 void updateMenuView Multiscreen(QMenu *pMenu);248 /** Updates 'View' : 'Virtual Screen #' @a pMenu with "Resize to <Width> x <Height>" actions. */ 249 void updateMenuViewResize(QMenu *pMenu); 250 /** Updates 'View' : 'Virtual Screen #' @a pMenu with "Use Host Screen <Number>" actions. */ 251 void updateMenuViewRemap(QMenu *pMenu); 252 /** Updates 'View' : 'Virtual Screen #' @a pMenu with "Scale to <Scale>" actions. */ 253 void updateMenuViewRescale(QMenu *pMenu); 254 254 /** Updates 'Input' menu. */ 255 255 void updateMenuInput();
Note:
See TracChangeset
for help on using the changeset viewer.