Changeset 86977 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 25, 2020 3:18:10 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r86541 r86977 122 122 #endif 123 123 template<> SHARED_LIBRARY_STUFF bool canConvert<InformationElementType>(); 124 template<> SHARED_LIBRARY_STUFF bool canConvert<Max GuestResolutionPolicy>();124 template<> SHARED_LIBRARY_STUFF bool canConvert<MaximumGuestScreenSizePolicy>(); 125 125 template<> SHARED_LIBRARY_STUFF bool canConvert<UIMediumFormat>(); 126 126 template<> SHARED_LIBRARY_STUFF bool canConvert<UISettingsDefs::RecordingMode>(); … … 262 262 template<> SHARED_LIBRARY_STUFF InformationElementType fromInternalString<InformationElementType>(const QString &strInformationElementType); 263 263 template<> SHARED_LIBRARY_STUFF QIcon toIcon(const InformationElementType &informationElementType); 264 template<> SHARED_LIBRARY_STUFF QString toInternalString(const Max GuestResolutionPolicy &enmMaxGuestResolutionPolicy);265 template<> SHARED_LIBRARY_STUFF Max GuestResolutionPolicy fromInternalString<MaxGuestResolutionPolicy>(const QString &strMaxGuestResolutionPolicy);264 template<> SHARED_LIBRARY_STUFF QString toInternalString(const MaximumGuestScreenSizePolicy &enmMaximumGuestScreenSizePolicy); 265 template<> SHARED_LIBRARY_STUFF MaximumGuestScreenSizePolicy fromInternalString<MaximumGuestScreenSizePolicy>(const QString &strMaximumGuestScreenSizePolicy); 266 266 template<> SHARED_LIBRARY_STUFF QString toString(const UIMediumFormat &enmUIMediumFormat); 267 267 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIMediumFormat &enmUIMediumFormat); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r86541 r86977 76 76 #endif 77 77 template<> bool canConvert<InformationElementType>() { return true; } 78 template<> bool canConvert<Max GuestResolutionPolicy>() { return true; }78 template<> bool canConvert<MaximumGuestScreenSizePolicy>() { return true; } 79 79 template<> bool canConvert<UIMediumFormat>() { return true; } 80 80 template<> bool canConvert<UISettingsDefs::RecordingMode>() { return true; } … … 2457 2457 } 2458 2458 2459 /* QString <= Max GuestResolutionPolicy: */2460 template<> QString toInternalString(const Max GuestResolutionPolicy &enmMaxGuestResolutionPolicy)2461 { 2462 QString strResult; 2463 switch (enmMax GuestResolutionPolicy)2464 { 2465 case Max GuestResolutionPolicy_Automatic: strResult = ""; break;2466 case Max GuestResolutionPolicy_Any: strResult = "any"; break;2467 default: 2468 { 2469 AssertMsgFailed(("No text for max guest resolution policy=%d", enmMax GuestResolutionPolicy));2470 break; 2471 } 2472 } 2473 return strResult; 2474 } 2475 2476 /* Max GuestResolutionPolicy <= QString: */2477 template<> Max GuestResolutionPolicy fromInternalString<MaxGuestResolutionPolicy>(const QString &strMaxGuestResolutionPolicy)2478 { 2479 /* Here we have some fancy stuff allowing us 2480 * to search through the keys using 'case-insensitive' rule: */ 2481 QStringList keys; QList<Max GuestResolutionPolicy> values;2482 keys << "auto"; values << Max GuestResolutionPolicy_Automatic;2459 /* QString <= MaximumGuestScreenSizePolicy: */ 2460 template<> QString toInternalString(const MaximumGuestScreenSizePolicy &enmMaximumGuestScreenSizePolicy) 2461 { 2462 QString strResult; 2463 switch (enmMaximumGuestScreenSizePolicy) 2464 { 2465 case MaximumGuestScreenSizePolicy_Automatic: strResult = ""; break; 2466 case MaximumGuestScreenSizePolicy_Any: strResult = "any"; break; 2467 default: 2468 { 2469 AssertMsgFailed(("No text for max guest resolution policy=%d", enmMaximumGuestScreenSizePolicy)); 2470 break; 2471 } 2472 } 2473 return strResult; 2474 } 2475 2476 /* MaximumGuestScreenSizePolicy <= QString: */ 2477 template<> MaximumGuestScreenSizePolicy fromInternalString<MaximumGuestScreenSizePolicy>(const QString &strMaximumGuestScreenSizePolicy) 2478 { 2479 /* Here we have some fancy stuff allowing us 2480 * to search through the keys using 'case-insensitive' rule: */ 2481 QStringList keys; QList<MaximumGuestScreenSizePolicy> values; 2482 keys << "auto"; values << MaximumGuestScreenSizePolicy_Automatic; 2483 2483 /* Auto type for empty value: */ 2484 if (strMax GuestResolutionPolicy.isEmpty())2485 return Max GuestResolutionPolicy_Automatic;2484 if (strMaximumGuestScreenSizePolicy.isEmpty()) 2485 return MaximumGuestScreenSizePolicy_Automatic; 2486 2486 /* Fixed type for value which can be parsed: */ 2487 if (QRegularExpression("[1-9]\\d*,[1-9]\\d*").match(strMax GuestResolutionPolicy).hasMatch())2488 return Max GuestResolutionPolicy_Fixed;2487 if (QRegularExpression("[1-9]\\d*,[1-9]\\d*").match(strMaximumGuestScreenSizePolicy).hasMatch()) 2488 return MaximumGuestScreenSizePolicy_Fixed; 2489 2489 /* Any type for unknown words: */ 2490 if (!keys.contains(strMax GuestResolutionPolicy, Qt::CaseInsensitive))2491 return Max GuestResolutionPolicy_Any;2492 /* Corresponding type for known words: */ 2493 return values.at(keys.indexOf(QRegExp(strMax GuestResolutionPolicy, Qt::CaseInsensitive)));2490 if (!keys.contains(strMaximumGuestScreenSizePolicy, Qt::CaseInsensitive)) 2491 return MaximumGuestScreenSizePolicy_Any; 2492 /* Corresponding type for known words: */ 2493 return values.at(keys.indexOf(QRegExp(strMaximumGuestScreenSizePolicy, Qt::CaseInsensitive))); 2494 2494 } 2495 2495 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r86958 r86977 1059 1059 1060 1060 1061 /** Runtime UI: Maximum guest-screen resolutionpolicy types.1062 * @note This policy determines which guest-screen resolutions we wish to1063 * handle. We also accept anything smaller than the current resolution. */1064 enum Max GuestResolutionPolicy1061 /** Runtime UI: Maximum guest-screen size policy types. 1062 * @note This policy determines which guest-screen sizes we wish to 1063 * handle. We also accept anything smaller than the current size. */ 1064 enum MaximumGuestScreenSizePolicy 1065 1065 { 1066 1066 /** Anything at all. */ 1067 Max GuestResolutionPolicy_Any,1067 MaximumGuestScreenSizePolicy_Any, 1068 1068 /** Anything up to a fixed size. */ 1069 Max GuestResolutionPolicy_Fixed,1069 MaximumGuestScreenSizePolicy_Fixed, 1070 1070 /** Anything up to host-screen available space. */ 1071 MaxGuestResolutionPolicy_Automatic 1072 }; 1071 MaximumGuestScreenSizePolicy_Automatic 1072 }; 1073 1073 1074 1074 1075 /** Manager UI: VM resource Monitor Column types. -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r86958 r86977 2431 2431 } 2432 2432 2433 Max GuestResolutionPolicy UIExtraDataManager::maxGuestResolutionPolicy()2433 MaximumGuestScreenSizePolicy UIExtraDataManager::maxGuestResolutionPolicy() 2434 2434 { 2435 2435 /* Return maximum guest-screen resolution policy: */ 2436 return gpConverter->fromInternalString<Max GuestResolutionPolicy>(extraDataString(GUI_MaxGuestResolution));2437 } 2438 2439 void UIExtraDataManager::setMaxGuestScreenResolution(Max GuestResolutionPolicy enmPolicy, const QSize resolution /* = QSize() */)2436 return gpConverter->fromInternalString<MaximumGuestScreenSizePolicy>(extraDataString(GUI_MaxGuestResolution)); 2437 } 2438 2439 void UIExtraDataManager::setMaxGuestScreenResolution(MaximumGuestScreenSizePolicy enmPolicy, const QSize resolution /* = QSize() */) 2440 2440 { 2441 2441 /* If policy is 'Fixed' => call the wrapper: */ 2442 if (enmPolicy == Max GuestResolutionPolicy_Fixed)2442 if (enmPolicy == MaximumGuestScreenSizePolicy_Fixed) 2443 2443 setMaxGuestResolutionForPolicyFixed(resolution); 2444 2444 /* Otherwise => just store the value: */ … … 2451 2451 /* Acquire maximum guest-screen resolution policy: */ 2452 2452 const QString strPolicy = extraDataString(GUI_MaxGuestResolution); 2453 const Max GuestResolutionPolicy enmPolicy = gpConverter->fromInternalString<MaxGuestResolutionPolicy>(strPolicy);2453 const MaximumGuestScreenSizePolicy enmPolicy = gpConverter->fromInternalString<MaximumGuestScreenSizePolicy>(strPolicy); 2454 2454 2455 2455 /* Make sure maximum guest-screen resolution policy is really Fixed: */ 2456 if (enmPolicy != Max GuestResolutionPolicy_Fixed)2456 if (enmPolicy != MaximumGuestScreenSizePolicy_Fixed) 2457 2457 return QSize(); 2458 2458 … … 2474 2474 /* If resolution is 'empty' => call the wrapper: */ 2475 2475 if (resolution.isEmpty()) 2476 setMaxGuestScreenResolution(Max GuestResolutionPolicy_Automatic);2476 setMaxGuestScreenResolution(MaximumGuestScreenSizePolicy_Automatic); 2477 2477 /* Otherwise => just store the value: */ 2478 2478 else -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r86958 r86977 226 226 * @{ */ 227 227 /** Returns maximum guest-screen resolution policy. */ 228 Max GuestResolutionPolicy maxGuestResolutionPolicy();228 MaximumGuestScreenSizePolicy maxGuestResolutionPolicy(); 229 229 /** Defines maximum guest-screen resolution @a enmPolicy or @a resolution itself for Fixed policy. */ 230 void setMaxGuestScreenResolution(Max GuestResolutionPolicy enmPolicy, const QSize resolution = QSize());230 void setMaxGuestScreenResolution(MaximumGuestScreenSizePolicy enmPolicy, const QSize resolution = QSize()); 231 231 /** Returns maximum guest-screen resolution for fixed policy. */ 232 232 QSize maxGuestResolutionForPolicyFixed(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r86046 r86977 639 639 , m_previousState(KMachineState_Null) 640 640 , m_iHostScreenNumber(0) 641 , m_ maxGuestSizePolicy(MaxGuestResolutionPolicy_Automatic)641 , m_enmMaximumGuestScreenSizePolicy(MaximumGuestScreenSizePolicy_Automatic) 642 642 , m_u64MaxGuestSize(0) 643 643 #ifdef VBOX_WITH_DRAG_AND_DROP_GH … … 654 654 /* Remember the maximum guest size policy for 655 655 * telling the guest about video modes we like: */ 656 m_ maxGuestSizePolicy = gEDataManager->maxGuestResolutionPolicy();657 if (m_ maxGuestSizePolicy == MaxGuestResolutionPolicy_Fixed)656 m_enmMaximumGuestScreenSizePolicy = gEDataManager->maxGuestResolutionPolicy(); 657 if (m_enmMaximumGuestScreenSizePolicy == MaximumGuestScreenSizePolicy_Fixed) 658 658 m_fixedMaxGuestSize = gEDataManager->maxGuestResolutionForPolicyFixed(); 659 659 } … … 980 980 { 981 981 QSize maxSize; 982 switch (m_ maxGuestSizePolicy)983 { 984 case Max GuestResolutionPolicy_Fixed:982 switch (m_enmMaximumGuestScreenSizePolicy) 983 { 984 case MaximumGuestScreenSizePolicy_Fixed: 985 985 maxSize = m_fixedMaxGuestSize; 986 986 break; 987 case Max GuestResolutionPolicy_Automatic:987 case MaximumGuestScreenSizePolicy_Automatic: 988 988 maxSize = calculateMaxGuestSize().expandedTo(minimumSizeHint); 989 989 break; 990 case Max GuestResolutionPolicy_Any:990 case MaximumGuestScreenSizePolicy_Any: 991 991 /* (0, 0) means any of course. */ 992 992 maxSize = QSize(0, 0); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r84790 r86977 350 350 int m_iHostScreenNumber; 351 351 352 /** The policy for calculating the maximum guest resolution which we wish 353 * to handle. */ 354 MaxGuestResolutionPolicy m_maxGuestSizePolicy; 352 /** Holds the maximum guest screen size policy. */ 353 MaximumGuestScreenSizePolicy m_enmMaximumGuestScreenSizePolicy; 355 354 /** The maximum guest size for fixed size policy. */ 356 355 QSize m_fixedMaxGuestSize; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp
r86020 r86977 36 36 /** Constructs data. */ 37 37 UIDataSettingsGlobalDisplay() 38 : m_enmMax GuestResolution(MaxGuestResolutionPolicy_Automatic)39 , m_max GuestResolution(QSize())38 : m_enmMaximumGuestScreenSizePolicy(MaximumGuestScreenSizePolicy_Automatic) 39 , m_maximumGuestScreenSize(QSize()) 40 40 , m_fActivateHoveredMachineWindow(false) 41 41 {} … … 45 45 { 46 46 return true 47 && (m_enmMax GuestResolution == other.m_enmMaxGuestResolution)48 && (m_max GuestResolution == other.m_maxGuestResolution)47 && (m_enmMaximumGuestScreenSizePolicy == other.m_enmMaximumGuestScreenSizePolicy) 48 && (m_maximumGuestScreenSize == other.m_maximumGuestScreenSize) 49 49 && (m_fActivateHoveredMachineWindow == other.m_fActivateHoveredMachineWindow) 50 50 && (m_scaleFactors == other.m_scaleFactors) … … 57 57 bool operator!=(const UIDataSettingsGlobalDisplay &other) const { return !equal(other); } 58 58 59 /** Holds the maximum guest-screen resolutionpolicy. */60 Max GuestResolutionPolicy m_enmMaxGuestResolution;61 /** Holds the maximum guest-screen resolution. */62 QSize m_max GuestResolution;59 /** Holds the maximum guest-screen size policy. */ 60 MaximumGuestScreenSizePolicy m_enmMaximumGuestScreenSizePolicy; 61 /** Holds the maximum guest-screen size. */ 62 QSize m_maximumGuestScreenSize; 63 63 /** Holds whether we should automatically activate machine window under the mouse cursor. */ 64 64 bool m_fActivateHoveredMachineWindow; … … 103 103 104 104 /* Gather old display data: */ 105 oldDisplayData.m_enmMax GuestResolution= gEDataManager->maxGuestResolutionPolicy();106 if (oldDisplayData.m_enmMax GuestResolution == MaxGuestResolutionPolicy_Fixed)107 oldDisplayData.m_max GuestResolution= gEDataManager->maxGuestResolutionForPolicyFixed();105 oldDisplayData.m_enmMaximumGuestScreenSizePolicy = gEDataManager->maxGuestResolutionPolicy(); 106 if (oldDisplayData.m_enmMaximumGuestScreenSizePolicy == MaximumGuestScreenSizePolicy_Fixed) 107 oldDisplayData.m_maximumGuestScreenSize = gEDataManager->maxGuestResolutionForPolicyFixed(); 108 108 oldDisplayData.m_fActivateHoveredMachineWindow = gEDataManager->activateHoveredMachineWindow(); 109 109 oldDisplayData.m_scaleFactors = gEDataManager->scaleFactors(UIExtraDataManager::GlobalID); … … 122 122 123 123 /* Load old display data from the cache: */ 124 m_pComboMaxGuestScreenSize->setCurrentIndex(m_pComboMaxGuestScreenSize->findData((int)oldDisplayData.m_enmMax GuestResolution));125 if (oldDisplayData.m_enmMax GuestResolution == MaxGuestResolutionPolicy_Fixed)124 m_pComboMaxGuestScreenSize->setCurrentIndex(m_pComboMaxGuestScreenSize->findData((int)oldDisplayData.m_enmMaximumGuestScreenSizePolicy)); 125 if (oldDisplayData.m_enmMaximumGuestScreenSizePolicy == MaximumGuestScreenSizePolicy_Fixed) 126 126 { 127 m_pSpinboxMaxGuestScreenWidth->setValue(oldDisplayData.m_max GuestResolution.width());128 m_pSpinboxMaxGuestScreenHeight->setValue(oldDisplayData.m_max GuestResolution.height());127 m_pSpinboxMaxGuestScreenWidth->setValue(oldDisplayData.m_maximumGuestScreenSize.width()); 128 m_pSpinboxMaxGuestScreenHeight->setValue(oldDisplayData.m_maximumGuestScreenSize.height()); 129 129 } 130 130 m_pCheckBoxActivateOnMouseHover->setChecked(oldDisplayData.m_fActivateHoveredMachineWindow); … … 139 139 140 140 /* Gather new display data: */ 141 newDisplayData.m_enmMax GuestResolution = (MaxGuestResolutionPolicy)m_pComboMaxGuestScreenSize->itemData(m_pComboMaxGuestScreenSize->currentIndex()).toInt();142 if (newDisplayData.m_enmMax GuestResolution == MaxGuestResolutionPolicy_Fixed)143 newDisplayData.m_max GuestResolution= QSize(m_pSpinboxMaxGuestScreenWidth->value(), m_pSpinboxMaxGuestScreenHeight->value());141 newDisplayData.m_enmMaximumGuestScreenSizePolicy = (MaximumGuestScreenSizePolicy)m_pComboMaxGuestScreenSize->itemData(m_pComboMaxGuestScreenSize->currentIndex()).toInt(); 142 if (newDisplayData.m_enmMaximumGuestScreenSizePolicy == MaximumGuestScreenSizePolicy_Fixed) 143 newDisplayData.m_maximumGuestScreenSize = QSize(m_pSpinboxMaxGuestScreenWidth->value(), m_pSpinboxMaxGuestScreenHeight->value()); 144 144 newDisplayData.m_fActivateHoveredMachineWindow = m_pCheckBoxActivateOnMouseHover->isChecked(); 145 145 newDisplayData.m_scaleFactors = m_pEditorScaleFactor->scaleFactors(); … … 180 180 void UIGlobalSettingsDisplay::sltHandleMaximumGuestScreenSizePolicyChange() 181 181 { 182 /* Get current resolution-combo tool-tip data: */182 /* Get current size-combo tool-tip data: */ 183 183 const QString strCurrentComboItemTip = m_pComboMaxGuestScreenSize->itemData(m_pComboMaxGuestScreenSize->currentIndex(), Qt::ToolTipRole).toString(); 184 184 m_pComboMaxGuestScreenSize->setWhatsThis(strCurrentComboItemTip); 185 185 186 /* Get current resolution-combo item data: */187 const Max GuestResolutionPolicy enmPolicy = (MaxGuestResolutionPolicy)m_pComboMaxGuestScreenSize->itemData(m_pComboMaxGuestScreenSize->currentIndex()).toInt();186 /* Get current size-combo item data: */ 187 const MaximumGuestScreenSizePolicy enmPolicy = (MaximumGuestScreenSizePolicy)m_pComboMaxGuestScreenSize->itemData(m_pComboMaxGuestScreenSize->currentIndex()).toInt(); 188 188 /* Should be combo-level widgets enabled? */ 189 const bool fComboLevelWidgetsEnabled = enmPolicy == Max GuestResolutionPolicy_Fixed;189 const bool fComboLevelWidgetsEnabled = enmPolicy == MaximumGuestScreenSizePolicy_Fixed; 190 190 /* Enable/disable combo-level widgets: */ 191 191 m_pLabelMaxGuestScreenWidth->setEnabled(fComboLevelWidgetsEnabled); … … 327 327 /* Create corresponding items: */ 328 328 m_pComboMaxGuestScreenSize->addItem(tr("Automatic", "Maximum Guest Screen Size"), 329 QVariant((int)Max GuestResolutionPolicy_Automatic));329 QVariant((int)MaximumGuestScreenSizePolicy_Automatic)); 330 330 m_pComboMaxGuestScreenSize->setItemData(m_pComboMaxGuestScreenSize->count() - 1, 331 331 tr("Suggest a reasonable maximum screen size to the guest. " … … 333 333 Qt::ToolTipRole); 334 334 m_pComboMaxGuestScreenSize->addItem(tr("None", "Maximum Guest Screen Size"), 335 QVariant((int)Max GuestResolutionPolicy_Any));335 QVariant((int)MaximumGuestScreenSizePolicy_Any)); 336 336 m_pComboMaxGuestScreenSize->setItemData(m_pComboMaxGuestScreenSize->count() - 1, 337 337 tr("Do not attempt to limit the size of the guest screen."), 338 338 Qt::ToolTipRole); 339 339 m_pComboMaxGuestScreenSize->addItem(tr("Hint", "Maximum Guest Screen Size"), 340 QVariant((int)Max GuestResolutionPolicy_Fixed));340 QVariant((int)MaximumGuestScreenSizePolicy_Fixed)); 341 341 m_pComboMaxGuestScreenSize->setItemData(m_pComboMaxGuestScreenSize->count() - 1, 342 342 tr("Suggest a maximum screen size to the guest. " … … 363 363 /* Save maximum guest resolution policy and/or value: */ 364 364 if ( fSuccess 365 && ( newDisplayData.m_enmMax GuestResolution != oldDisplayData.m_enmMaxGuestResolution366 || newDisplayData.m_max GuestResolution != oldDisplayData.m_maxGuestResolution))367 gEDataManager->setMaxGuestScreenResolution(newDisplayData.m_enmMax GuestResolution, newDisplayData.m_maxGuestResolution);365 && ( newDisplayData.m_enmMaximumGuestScreenSizePolicy != oldDisplayData.m_enmMaximumGuestScreenSizePolicy 366 || newDisplayData.m_maximumGuestScreenSize != oldDisplayData.m_maximumGuestScreenSize)) 367 gEDataManager->setMaxGuestScreenResolution(newDisplayData.m_enmMaximumGuestScreenSizePolicy, newDisplayData.m_maximumGuestScreenSize); 368 368 /* Save whether hovered machine-window should be activated automatically: */ 369 369 if (fSuccess && newDisplayData.m_fActivateHoveredMachineWindow != oldDisplayData.m_fActivateHoveredMachineWindow)
Note:
See TracChangeset
for help on using the changeset viewer.