VirtualBox

Changeset 86977 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 25, 2020 3:18:10 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9827: Renaming guest resolution to guest screen size.

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  
    122122#endif
    123123template<> SHARED_LIBRARY_STUFF bool canConvert<InformationElementType>();
    124 template<> SHARED_LIBRARY_STUFF bool canConvert<MaxGuestResolutionPolicy>();
     124template<> SHARED_LIBRARY_STUFF bool canConvert<MaximumGuestScreenSizePolicy>();
    125125template<> SHARED_LIBRARY_STUFF bool canConvert<UIMediumFormat>();
    126126template<> SHARED_LIBRARY_STUFF bool canConvert<UISettingsDefs::RecordingMode>();
     
    262262template<> SHARED_LIBRARY_STUFF InformationElementType fromInternalString<InformationElementType>(const QString &strInformationElementType);
    263263template<> SHARED_LIBRARY_STUFF QIcon toIcon(const InformationElementType &informationElementType);
    264 template<> SHARED_LIBRARY_STUFF QString toInternalString(const MaxGuestResolutionPolicy &enmMaxGuestResolutionPolicy);
    265 template<> SHARED_LIBRARY_STUFF MaxGuestResolutionPolicy fromInternalString<MaxGuestResolutionPolicy>(const QString &strMaxGuestResolutionPolicy);
     264template<> SHARED_LIBRARY_STUFF QString toInternalString(const MaximumGuestScreenSizePolicy &enmMaximumGuestScreenSizePolicy);
     265template<> SHARED_LIBRARY_STUFF MaximumGuestScreenSizePolicy fromInternalString<MaximumGuestScreenSizePolicy>(const QString &strMaximumGuestScreenSizePolicy);
    266266template<> SHARED_LIBRARY_STUFF QString toString(const UIMediumFormat &enmUIMediumFormat);
    267267template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIMediumFormat &enmUIMediumFormat);
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r86541 r86977  
    7676#endif
    7777template<> bool canConvert<InformationElementType>() { return true; }
    78 template<> bool canConvert<MaxGuestResolutionPolicy>() { return true; }
     78template<> bool canConvert<MaximumGuestScreenSizePolicy>() { return true; }
    7979template<> bool canConvert<UIMediumFormat>() { return true; }
    8080template<> bool canConvert<UISettingsDefs::RecordingMode>() { return true; }
     
    24572457}
    24582458
    2459 /* QString <= MaxGuestResolutionPolicy: */
    2460 template<> QString toInternalString(const MaxGuestResolutionPolicy &enmMaxGuestResolutionPolicy)
    2461 {
    2462     QString strResult;
    2463     switch (enmMaxGuestResolutionPolicy)
    2464     {
    2465         case MaxGuestResolutionPolicy_Automatic: strResult = ""; break;
    2466         case MaxGuestResolutionPolicy_Any:       strResult = "any"; break;
    2467         default:
    2468         {
    2469             AssertMsgFailed(("No text for max guest resolution policy=%d", enmMaxGuestResolutionPolicy));
    2470             break;
    2471         }
    2472     }
    2473     return strResult;
    2474 }
    2475 
    2476 /* MaxGuestResolutionPolicy <= QString: */
    2477 template<> MaxGuestResolutionPolicy 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<MaxGuestResolutionPolicy> values;
    2482     keys << "auto";   values << MaxGuestResolutionPolicy_Automatic;
     2459/* QString <= MaximumGuestScreenSizePolicy: */
     2460template<> 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: */
     2477template<> 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;
    24832483    /* Auto type for empty value: */
    2484     if (strMaxGuestResolutionPolicy.isEmpty())
    2485         return MaxGuestResolutionPolicy_Automatic;
     2484    if (strMaximumGuestScreenSizePolicy.isEmpty())
     2485        return MaximumGuestScreenSizePolicy_Automatic;
    24862486    /* Fixed type for value which can be parsed: */
    2487     if (QRegularExpression("[1-9]\\d*,[1-9]\\d*").match(strMaxGuestResolutionPolicy).hasMatch())
    2488         return MaxGuestResolutionPolicy_Fixed;
     2487    if (QRegularExpression("[1-9]\\d*,[1-9]\\d*").match(strMaximumGuestScreenSizePolicy).hasMatch())
     2488        return MaximumGuestScreenSizePolicy_Fixed;
    24892489    /* Any type for unknown words: */
    2490     if (!keys.contains(strMaxGuestResolutionPolicy, Qt::CaseInsensitive))
    2491         return MaxGuestResolutionPolicy_Any;
    2492     /* Corresponding type for known words: */
    2493     return values.at(keys.indexOf(QRegExp(strMaxGuestResolutionPolicy, 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)));
    24942494}
    24952495
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r86958 r86977  
    10591059
    10601060
    1061 /** Runtime UI: Maximum guest-screen resolution policy types.
    1062   * @note This policy determines which guest-screen resolutions we wish to
    1063   *       handle. We also accept anything smaller than the current resolution. */
    1064 enum MaxGuestResolutionPolicy
     1061/** 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. */
     1064enum MaximumGuestScreenSizePolicy
    10651065{
    10661066    /** Anything at all. */
    1067     MaxGuestResolutionPolicy_Any,
     1067    MaximumGuestScreenSizePolicy_Any,
    10681068    /** Anything up to a fixed size. */
    1069     MaxGuestResolutionPolicy_Fixed,
     1069    MaximumGuestScreenSizePolicy_Fixed,
    10701070    /** Anything up to host-screen available space. */
    1071     MaxGuestResolutionPolicy_Automatic
    1072 };
     1071    MaximumGuestScreenSizePolicy_Automatic
     1072};
     1073
    10731074
    10741075/** Manager UI: VM resource Monitor Column types.
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r86958 r86977  
    24312431}
    24322432
    2433 MaxGuestResolutionPolicy UIExtraDataManager::maxGuestResolutionPolicy()
     2433MaximumGuestScreenSizePolicy UIExtraDataManager::maxGuestResolutionPolicy()
    24342434{
    24352435    /* Return maximum guest-screen resolution policy: */
    2436     return gpConverter->fromInternalString<MaxGuestResolutionPolicy>(extraDataString(GUI_MaxGuestResolution));
    2437 }
    2438 
    2439 void UIExtraDataManager::setMaxGuestScreenResolution(MaxGuestResolutionPolicy enmPolicy, const QSize resolution /* = QSize() */)
     2436    return gpConverter->fromInternalString<MaximumGuestScreenSizePolicy>(extraDataString(GUI_MaxGuestResolution));
     2437}
     2438
     2439void UIExtraDataManager::setMaxGuestScreenResolution(MaximumGuestScreenSizePolicy enmPolicy, const QSize resolution /* = QSize() */)
    24402440{
    24412441    /* If policy is 'Fixed' => call the wrapper: */
    2442     if (enmPolicy == MaxGuestResolutionPolicy_Fixed)
     2442    if (enmPolicy == MaximumGuestScreenSizePolicy_Fixed)
    24432443        setMaxGuestResolutionForPolicyFixed(resolution);
    24442444    /* Otherwise => just store the value: */
     
    24512451    /* Acquire maximum guest-screen resolution policy: */
    24522452    const QString strPolicy = extraDataString(GUI_MaxGuestResolution);
    2453     const MaxGuestResolutionPolicy enmPolicy = gpConverter->fromInternalString<MaxGuestResolutionPolicy>(strPolicy);
     2453    const MaximumGuestScreenSizePolicy enmPolicy = gpConverter->fromInternalString<MaximumGuestScreenSizePolicy>(strPolicy);
    24542454
    24552455    /* Make sure maximum guest-screen resolution policy is really Fixed: */
    2456     if (enmPolicy != MaxGuestResolutionPolicy_Fixed)
     2456    if (enmPolicy != MaximumGuestScreenSizePolicy_Fixed)
    24572457        return QSize();
    24582458
     
    24742474    /* If resolution is 'empty' => call the wrapper: */
    24752475    if (resolution.isEmpty())
    2476         setMaxGuestScreenResolution(MaxGuestResolutionPolicy_Automatic);
     2476        setMaxGuestScreenResolution(MaximumGuestScreenSizePolicy_Automatic);
    24772477    /* Otherwise => just store the value: */
    24782478    else
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r86958 r86977  
    226226      * @{ */
    227227        /** Returns maximum guest-screen resolution policy. */
    228         MaxGuestResolutionPolicy maxGuestResolutionPolicy();
     228        MaximumGuestScreenSizePolicy maxGuestResolutionPolicy();
    229229        /** Defines maximum guest-screen resolution @a enmPolicy or @a resolution itself for Fixed policy. */
    230         void setMaxGuestScreenResolution(MaxGuestResolutionPolicy enmPolicy, const QSize resolution = QSize());
     230        void setMaxGuestScreenResolution(MaximumGuestScreenSizePolicy enmPolicy, const QSize resolution = QSize());
    231231        /** Returns maximum guest-screen resolution for fixed policy. */
    232232        QSize maxGuestResolutionForPolicyFixed();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r86046 r86977  
    639639    , m_previousState(KMachineState_Null)
    640640    , m_iHostScreenNumber(0)
    641     , m_maxGuestSizePolicy(MaxGuestResolutionPolicy_Automatic)
     641    , m_enmMaximumGuestScreenSizePolicy(MaximumGuestScreenSizePolicy_Automatic)
    642642    , m_u64MaxGuestSize(0)
    643643#ifdef VBOX_WITH_DRAG_AND_DROP_GH
     
    654654        /* Remember the maximum guest size policy for
    655655         * 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)
    658658            m_fixedMaxGuestSize = gEDataManager->maxGuestResolutionForPolicyFixed();
    659659    }
     
    980980{
    981981    QSize maxSize;
    982     switch (m_maxGuestSizePolicy)
    983     {
    984         case MaxGuestResolutionPolicy_Fixed:
     982    switch (m_enmMaximumGuestScreenSizePolicy)
     983    {
     984        case MaximumGuestScreenSizePolicy_Fixed:
    985985            maxSize = m_fixedMaxGuestSize;
    986986            break;
    987         case MaxGuestResolutionPolicy_Automatic:
     987        case MaximumGuestScreenSizePolicy_Automatic:
    988988            maxSize = calculateMaxGuestSize().expandedTo(minimumSizeHint);
    989989            break;
    990         case MaxGuestResolutionPolicy_Any:
     990        case MaximumGuestScreenSizePolicy_Any:
    991991            /* (0, 0) means any of course. */
    992992            maxSize = QSize(0, 0);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r84790 r86977  
    350350    int m_iHostScreenNumber;
    351351
    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;
    355354    /** The maximum guest size for fixed size policy. */
    356355    QSize m_fixedMaxGuestSize;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp

    r86020 r86977  
    3636    /** Constructs data. */
    3737    UIDataSettingsGlobalDisplay()
    38         : m_enmMaxGuestResolution(MaxGuestResolutionPolicy_Automatic)
    39         , m_maxGuestResolution(QSize())
     38        : m_enmMaximumGuestScreenSizePolicy(MaximumGuestScreenSizePolicy_Automatic)
     39        , m_maximumGuestScreenSize(QSize())
    4040        , m_fActivateHoveredMachineWindow(false)
    4141    {}
     
    4545    {
    4646        return true
    47                && (m_enmMaxGuestResolution == other.m_enmMaxGuestResolution)
    48                && (m_maxGuestResolution == other.m_maxGuestResolution)
     47               && (m_enmMaximumGuestScreenSizePolicy == other.m_enmMaximumGuestScreenSizePolicy)
     48               && (m_maximumGuestScreenSize == other.m_maximumGuestScreenSize)
    4949               && (m_fActivateHoveredMachineWindow == other.m_fActivateHoveredMachineWindow)
    5050               && (m_scaleFactors == other.m_scaleFactors)
     
    5757    bool operator!=(const UIDataSettingsGlobalDisplay &other) const { return !equal(other); }
    5858
    59     /** Holds the maximum guest-screen resolution policy. */
    60     MaxGuestResolutionPolicy m_enmMaxGuestResolution;
    61     /** Holds the maximum guest-screen resolution. */
    62     QSize m_maxGuestResolution;
     59    /** Holds the maximum guest-screen size policy. */
     60    MaximumGuestScreenSizePolicy m_enmMaximumGuestScreenSizePolicy;
     61    /** Holds the maximum guest-screen size. */
     62    QSize m_maximumGuestScreenSize;
    6363    /** Holds whether we should automatically activate machine window under the mouse cursor. */
    6464    bool m_fActivateHoveredMachineWindow;
     
    103103
    104104    /* Gather old display data: */
    105     oldDisplayData.m_enmMaxGuestResolution = gEDataManager->maxGuestResolutionPolicy();
    106     if (oldDisplayData.m_enmMaxGuestResolution == MaxGuestResolutionPolicy_Fixed)
    107         oldDisplayData.m_maxGuestResolution = gEDataManager->maxGuestResolutionForPolicyFixed();
     105    oldDisplayData.m_enmMaximumGuestScreenSizePolicy = gEDataManager->maxGuestResolutionPolicy();
     106    if (oldDisplayData.m_enmMaximumGuestScreenSizePolicy == MaximumGuestScreenSizePolicy_Fixed)
     107        oldDisplayData.m_maximumGuestScreenSize = gEDataManager->maxGuestResolutionForPolicyFixed();
    108108    oldDisplayData.m_fActivateHoveredMachineWindow = gEDataManager->activateHoveredMachineWindow();
    109109    oldDisplayData.m_scaleFactors = gEDataManager->scaleFactors(UIExtraDataManager::GlobalID);
     
    122122
    123123    /* Load old display data from the cache: */
    124     m_pComboMaxGuestScreenSize->setCurrentIndex(m_pComboMaxGuestScreenSize->findData((int)oldDisplayData.m_enmMaxGuestResolution));
    125     if (oldDisplayData.m_enmMaxGuestResolution == MaxGuestResolutionPolicy_Fixed)
     124    m_pComboMaxGuestScreenSize->setCurrentIndex(m_pComboMaxGuestScreenSize->findData((int)oldDisplayData.m_enmMaximumGuestScreenSizePolicy));
     125    if (oldDisplayData.m_enmMaximumGuestScreenSizePolicy == MaximumGuestScreenSizePolicy_Fixed)
    126126    {
    127         m_pSpinboxMaxGuestScreenWidth->setValue(oldDisplayData.m_maxGuestResolution.width());
    128         m_pSpinboxMaxGuestScreenHeight->setValue(oldDisplayData.m_maxGuestResolution.height());
     127        m_pSpinboxMaxGuestScreenWidth->setValue(oldDisplayData.m_maximumGuestScreenSize.width());
     128        m_pSpinboxMaxGuestScreenHeight->setValue(oldDisplayData.m_maximumGuestScreenSize.height());
    129129    }
    130130    m_pCheckBoxActivateOnMouseHover->setChecked(oldDisplayData.m_fActivateHoveredMachineWindow);
     
    139139
    140140    /* Gather new display data: */
    141     newDisplayData.m_enmMaxGuestResolution = (MaxGuestResolutionPolicy)m_pComboMaxGuestScreenSize->itemData(m_pComboMaxGuestScreenSize->currentIndex()).toInt();
    142     if (newDisplayData.m_enmMaxGuestResolution == MaxGuestResolutionPolicy_Fixed)
    143         newDisplayData.m_maxGuestResolution = 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());
    144144    newDisplayData.m_fActivateHoveredMachineWindow = m_pCheckBoxActivateOnMouseHover->isChecked();
    145145    newDisplayData.m_scaleFactors = m_pEditorScaleFactor->scaleFactors();
     
    180180void UIGlobalSettingsDisplay::sltHandleMaximumGuestScreenSizePolicyChange()
    181181{
    182     /* Get current resolution-combo tool-tip data: */
     182    /* Get current size-combo tool-tip data: */
    183183    const QString strCurrentComboItemTip = m_pComboMaxGuestScreenSize->itemData(m_pComboMaxGuestScreenSize->currentIndex(), Qt::ToolTipRole).toString();
    184184    m_pComboMaxGuestScreenSize->setWhatsThis(strCurrentComboItemTip);
    185185
    186     /* Get current resolution-combo item data: */
    187     const MaxGuestResolutionPolicy 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();
    188188    /* Should be combo-level widgets enabled? */
    189     const bool fComboLevelWidgetsEnabled = enmPolicy == MaxGuestResolutionPolicy_Fixed;
     189    const bool fComboLevelWidgetsEnabled = enmPolicy == MaximumGuestScreenSizePolicy_Fixed;
    190190    /* Enable/disable combo-level widgets: */
    191191    m_pLabelMaxGuestScreenWidth->setEnabled(fComboLevelWidgetsEnabled);
     
    327327    /* Create corresponding items: */
    328328    m_pComboMaxGuestScreenSize->addItem(tr("Automatic", "Maximum Guest Screen Size"),
    329                                    QVariant((int)MaxGuestResolutionPolicy_Automatic));
     329                                   QVariant((int)MaximumGuestScreenSizePolicy_Automatic));
    330330    m_pComboMaxGuestScreenSize->setItemData(m_pComboMaxGuestScreenSize->count() - 1,
    331331                                       tr("Suggest a reasonable maximum screen size to the guest. "
     
    333333                                       Qt::ToolTipRole);
    334334    m_pComboMaxGuestScreenSize->addItem(tr("None", "Maximum Guest Screen Size"),
    335                                    QVariant((int)MaxGuestResolutionPolicy_Any));
     335                                   QVariant((int)MaximumGuestScreenSizePolicy_Any));
    336336    m_pComboMaxGuestScreenSize->setItemData(m_pComboMaxGuestScreenSize->count() - 1,
    337337                                       tr("Do not attempt to limit the size of the guest screen."),
    338338                                       Qt::ToolTipRole);
    339339    m_pComboMaxGuestScreenSize->addItem(tr("Hint", "Maximum Guest Screen Size"),
    340                                    QVariant((int)MaxGuestResolutionPolicy_Fixed));
     340                                   QVariant((int)MaximumGuestScreenSizePolicy_Fixed));
    341341    m_pComboMaxGuestScreenSize->setItemData(m_pComboMaxGuestScreenSize->count() - 1,
    342342                                       tr("Suggest a maximum screen size to the guest. "
     
    363363        /* Save maximum guest resolution policy and/or value: */
    364364        if (   fSuccess
    365             && (   newDisplayData.m_enmMaxGuestResolution != oldDisplayData.m_enmMaxGuestResolution
    366                 || newDisplayData.m_maxGuestResolution != oldDisplayData.m_maxGuestResolution))
    367             gEDataManager->setMaxGuestScreenResolution(newDisplayData.m_enmMaxGuestResolution, 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);
    368368        /* Save whether hovered machine-window should be activated automatically: */
    369369        if (fSuccess && newDisplayData.m_fActivateHoveredMachineWindow != oldDisplayData.m_fActivateHoveredMachineWindow)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette