Changeset 76008 in vbox
- Timestamp:
- Dec 6, 2018 10:03:50 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp
r76006 r76008 3851 3851 { 3852 3852 AssertPtrReturnVoid(pMenu); 3853 /* Prepare new contents: */ 3853 3854 /* Prepare content: */ 3854 3855 const QList<QSize> sizes = QList<QSize>() 3855 3856 << QSize(640, 480) … … 3877 3878 QAction *pToggleAction = pMenu->addAction(QApplication::translate("UIActionPool", "Enable", "Virtual Screen"), 3878 3879 this, SLOT(sltHandleActionTriggerViewScreenToggle())); 3879 AssertPtrReturnVoid(pToggleAction);3880 if (pToggleAction) 3880 3881 { 3881 3882 /* Configure 'toggle' action: */ … … 3891 3892 /* Create exclusive 'resize' action-group: */ 3892 3893 QActionGroup *pActionGroup = new QActionGroup(pMenu); 3893 AssertPtrReturnVoid(pActionGroup);3894 if (pActionGroup) 3894 3895 { 3895 3896 /* Configure exclusive 'resize' action-group: */ 3896 3897 pActionGroup->setExclusive(true); 3898 3897 3899 /* For every available size: */ 3898 3900 foreach (const QSize &size, sizes) … … 3901 3903 QAction *pAction = pActionGroup->addAction(QApplication::translate("UIActionPool", "Resize to %1x%2", "Virtual Screen") 3902 3904 .arg(size.width()).arg(size.height())); 3903 AssertPtrReturnVoid(pAction);3905 if (pAction) 3904 3906 { 3905 3907 /* Configure exclusive 'resize' action: */ … … 3908 3910 pAction->setProperty("Requested Size", size); 3909 3911 pAction->setCheckable(true); 3910 if ( screenSize.width() == size.width() &&3911 screenSize.height() == size.height())3912 if ( screenSize.width() == size.width() 3913 && screenSize.height() == size.height()) 3912 3914 pAction->setChecked(true); 3913 3915 } 3914 3916 } 3917 3915 3918 /* Insert group actions into menu: */ 3916 3919 pMenu->addActions(pActionGroup->actions()); 3917 3920 /* Install listener for exclusive action-group: */ 3918 connect(pActionGroup, SIGNAL(triggered(QAction*)),3919 this, SLOT(sltHandleActionTriggerViewScreenResize(QAction*)));3921 connect(pActionGroup, &QActionGroup::triggered, 3922 this, &UIActionPoolRuntime::sltHandleActionTriggerViewScreenResize); 3920 3923 } 3921 3924 } … … 3924 3927 { 3925 3928 AssertPtrReturnVoid(pMenu); 3926 /* Get corresponding screen index and size: */ 3929 3930 /* Get corresponding screen index: */ 3927 3931 const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt(); 3928 3932 3929 /* Create exclusive action-group: */3933 /* Create exclusive 'remap' action-group: */ 3930 3934 QActionGroup *pActionGroup = new QActionGroup(pMenu); 3931 AssertPtrReturnVoid(pActionGroup);3932 { 3933 /* Configure exclusive action-group: */3935 if (pActionGroup) 3936 { 3937 /* Configure exclusive 'remap' action-group: */ 3934 3938 pActionGroup->setExclusive(true); 3939 3940 /* For every host-screen index: */ 3935 3941 for (int iHostScreenIndex = 0; iHostScreenIndex < m_cHostScreens; ++iHostScreenIndex) 3936 3942 { 3937 QAction *pAction = pActionGroup->addAction(QApplication::translate("UIMultiScreenLayout",3938 "Use Host Screen %1")3943 /* Create exclusive 'remap' action: */ 3944 QAction *pAction = pActionGroup->addAction(QApplication::translate("UIMultiScreenLayout", "Use Host Screen %1") 3939 3945 .arg(iHostScreenIndex + 1)); 3940 AssertPtrReturnVoid(pAction);3946 if (pAction) 3941 3947 { 3948 /* Configure exclusive 'remap' action: */ 3942 3949 pAction->setCheckable(true); 3943 3950 pAction->setProperty("Guest Screen Index", iGuestScreenIndex); 3944 3951 pAction->setProperty("Host Screen Index", iHostScreenIndex); 3945 if ( m_mapHostScreenForGuestScreen.contains(iGuestScreenIndex) &&3946 m_mapHostScreenForGuestScreen.value(iGuestScreenIndex) == iHostScreenIndex)3952 if ( m_mapHostScreenForGuestScreen.contains(iGuestScreenIndex) 3953 && m_mapHostScreenForGuestScreen.value(iGuestScreenIndex) == iHostScreenIndex) 3947 3954 pAction->setChecked(true); 3948 3955 } 3949 3956 } 3957 3950 3958 /* Insert group actions into menu: */ 3951 3959 pMenu->addActions(pActionGroup->actions()); 3952 3960 /* Install listener for exclusive action-group: */ 3953 connect(pActionGroup, SIGNAL(triggered(QAction*)),3954 this, SLOT(sltHandleActionTriggerViewScreenRemap(QAction*)));3961 connect(pActionGroup, &QActionGroup::triggered, 3962 this, &UIActionPoolRuntime::sltHandleActionTriggerViewScreenRemap); 3955 3963 } 3956 3964 } … … 3960 3968 AssertPtrReturnVoid(pMenu); 3961 3969 3962 /* Create exclusive 'scale-factor' action-group: */ 3970 /* Get corresponding screen index and scale-factor: */ 3971 const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt(); 3972 const double dCurrentScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid(), iGuestScreenIndex); 3973 3974 /* Create exclusive 'rescale' action-group: */ 3963 3975 QActionGroup *pActionGroup = new QActionGroup(pMenu); 3964 AssertPtrReturnVoid(pActionGroup);3965 { 3966 /* Configure exclusive ' scale-factor' action-group: */3976 if (pActionGroup) 3977 { 3978 /* Configure exclusive 'rescale' action-group: */ 3967 3979 pActionGroup->setExclusive(true); 3968 3969 /* Get current scale-factor: */3970 const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt();3971 const double dCurrentScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid(), iGuestScreenIndex);3972 3980 3973 3981 /* Get device-pixel-ratio: */ … … 3985 3993 do 3986 3994 { 3987 /* Create exclusive ' scale-factor' action: */3995 /* Create exclusive 'rescale' action: */ 3988 3996 QAction *pAction = pActionGroup->addAction(QString()); 3989 AssertPtrReturnVoid(pAction);3997 if (pAction) 3990 3998 { 3991 3999 pAction->setProperty("Guest Screen Index", iGuestScreenIndex); … … 4033 4041 pMenu->addActions(pActionGroup->actions()); 4034 4042 /* Install listener for exclusive action-group: */ 4035 connect(pActionGroup, SIGNAL(triggered(QAction*)),4036 this, SLOT(sltHandleActionTriggerViewScaleFactor(QAction*)));4043 connect(pActionGroup, &QActionGroup::triggered, 4044 this, &UIActionPoolRuntime::sltHandleActionTriggerViewRescale); 4037 4045 } 4038 4046 }
Note:
See TracChangeset
for help on using the changeset viewer.

