VirtualBox

Changeset 74872 in vbox


Ignore:
Timestamp:
Oct 16, 2018 5:26:25 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9255. Add per monitor scale factor setting to global display settings

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r74871 r74872  
    39863986}
    39873987
    3988 double UIExtraDataManager::scaleFactor(const QString &strID, const int uScreenIndex)
    3989 {
    3990     /* Get corresponding extra-data: */
    3991     const QStringList data = extraDataStringList(GUI_ScaleFactor, strID);
     3988double UIExtraDataManager::scaleFactor(const int uScreenIndex, const QString &strID /* = GlobalID */)
     3989{
     3990    /* Get corresponding extra-data for this machine: */
     3991    QStringList data = extraDataStringList(GUI_ScaleFactor, strID);
     3992
     3993    /* If that fails check the global scale factor: */
     3994    if (data.size() == 0)
     3995        data = extraDataStringList(GUI_ScaleFactor, GlobalID);
    39923996
    39933997    /* 1.0 is default scale factor: */
     
    40074011}
    40084012
    4009 QList<double> UIExtraDataManager::scaleFactors(const QString &strID)
    4010 {
     4013QList<double> UIExtraDataManager::scaleFactors(const QString &strID /* = GlobalID */)
     4014{
     4015    /* Look for the scale factor for this machine first: */
     4016    QStringList data = extraDataStringList(GUI_ScaleFactor, strID);
     4017
     4018    /* then looks for the global scale factors: */
     4019    if (data.size() == 0)
     4020        data = extraDataStringList(GUI_ScaleFactor, GlobalID);
     4021
    40114022    QList<double> scaleFactorList;
    4012     const QStringList data = extraDataStringList(GUI_ScaleFactor, strID);
     4023    /* 1.0 is default scale factor: */
     4024    if (data.size() == 0)
     4025    {
     4026        scaleFactorList.append(1.0);
     4027        return scaleFactorList;
     4028    }
     4029
    40134030    bool fOk = false;
    40144031    double scaleFactor;
     
    40234040}
    40244041
    4025 void UIExtraDataManager::setScaleFactor(double dScaleFactor, const QString &strID, const int uScreenIndex)
     4042void UIExtraDataManager::setScaleFactor(double dScaleFactor, const int uScreenIndex, const QString &strID /* = GlobalID */)
    40264043{
    40274044    QStringList data = extraDataStringList(GUI_ScaleFactor, strID);
     
    40404057}
    40414058
    4042 void UIExtraDataManager::setScaleFactors(const QList<double> &scaleFactors, const QString &strID)
     4059void UIExtraDataManager::setScaleFactors(const QList<double> &scaleFactors, const QString &strID /* = GlobalID */)
    40434060{
    40444061    QStringList data;
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r74871 r74872  
    605605
    606606        /** Returns the scale-factor. */
    607         double scaleFactor(const QString &strID, const int uScreenIndex);
    608         QList<double> scaleFactors(const QString &strID);
     607        double scaleFactor(const int uScreenIndex, const QString &strID = GlobalID);
     608        QList<double> scaleFactors(const QString &strID = GlobalID);
    609609        /** Defines the @a dScaleFactor. */
    610         void setScaleFactor(double dScaleFactor, const QString &strID, const int uScreenIndex);
    611         void setScaleFactors(const QList<double> &scaleFactors, const QString &strID);
     610        void setScaleFactor(double dScaleFactor, const int uScreenIndex, const QString &strID = GlobalID);
     611        void setScaleFactors(const QList<double> &scaleFactors, const QString &strID = GlobalID);
    612612
    613613        /** Returns the scaling optimization type. */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp

    r74722 r74872  
    31573157    /* Change scale-factor directly: */
    31583158    const double dScaleFactor = pAction->property("Requested Scale Factor").toDouble();
    3159     gEDataManager->setScaleFactor(dScaleFactor, vboxGlobal().managedVMUuid(), 0);
     3159    gEDataManager->setScaleFactor(dScaleFactor, 0, vboxGlobal().managedVMUuid());
    31603160}
    31613161
     
    37833783
    37843784        /* Get current scale-factor: */
    3785         const double dCurrentScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid(), 0);
     3785        const double dCurrentScaleFactor = gEDataManager->scaleFactor(0, vboxGlobal().managedVMUuid());
    37863786
    37873787        /* Get device-pixel-ratio: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r74722 r74872  
    248248{
    249249    /* Acquire selected scale-factor: */
    250     double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid(), m_uScreenId);
     250    double dScaleFactor = gEDataManager->scaleFactor(m_uScreenId, vboxGlobal().managedVMUuid());
    251251
    252252    /* Take the device-pixel-ratio into account: */
     
    508508
    509509    /* Acquire selected scale-factor: */
    510     double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid(), m_uScreenId);
     510    double dScaleFactor = gEDataManager->scaleFactor(m_uScreenId, vboxGlobal().managedVMUuid());
    511511
    512512    /* Take the device-pixel-ratio into account: */
     
    702702
    703703        /* Acquire selected scale-factor: */
    704         double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid(), m_uScreenId);
     704        double dScaleFactor = gEDataManager->scaleFactor(m_uScreenId, vboxGlobal().managedVMUuid());
    705705
    706706        /* Take the device-pixel-ratio into account: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp

    r71027 r74872  
    2121
    2222/* GUI includes: */
     23# include "UIDesktopWidgetWatchdog.h"
    2324# include "UIExtraDataManager.h"
    2425# include "UIGlobalSettingsDisplay.h"
     
    4546               && (m_maxGuestResolution == other.m_maxGuestResolution)
    4647               && (m_fActivateHoveredMachineWindow == other.m_fActivateHoveredMachineWindow)
     48               && (m_scaleFactors == other.m_scaleFactors)
    4749               ;
    4850    }
     
    5961    /** Holds whether we should automatically activate machine window under the mouse cursor. */
    6062    bool m_fActivateHoveredMachineWindow;
     63    /** Holds the guest screen scale-factor. */
     64    QList<double> m_scaleFactors;
    6165};
    6266
     
    9195        oldDisplayData.m_maxGuestResolution = gEDataManager->maxGuestResolutionForPolicyFixed();
    9296    oldDisplayData.m_fActivateHoveredMachineWindow = gEDataManager->activateHoveredMachineWindow();
     97    oldDisplayData.m_scaleFactors = gEDataManager->scaleFactors();
    9398
    9499    /* Cache old display data: */
     
    112117    }
    113118    m_pCheckBoxActivateOnMouseHover->setChecked(oldDisplayData.m_fActivateHoveredMachineWindow);
     119    m_pScaleFactorEditor->setScaleFactors(oldDisplayData.m_scaleFactors);
     120    m_pScaleFactorEditor->setMonitorCount(gpDesktop->screenCount());
    114121}
    115122
     
    124131        newDisplayData.m_maxGuestResolution = QSize(m_pResolutionWidthSpin->value(), m_pResolutionHeightSpin->value());
    125132    newDisplayData.m_fActivateHoveredMachineWindow = m_pCheckBoxActivateOnMouseHover->isChecked();
     133    newDisplayData.m_scaleFactors = m_pScaleFactorEditor->scaleFactors();
    126134
    127135    /* Cache new display data: */
     
    258266        if (fSuccess && newDisplayData.m_fActivateHoveredMachineWindow != oldDisplayData.m_fActivateHoveredMachineWindow)
    259267            gEDataManager->setActivateHoveredMachineWindow(newDisplayData.m_fActivateHoveredMachineWindow);
     268        /* Save guest-screen scale-factor: */
     269        if (fSuccess && newDisplayData.m_scaleFactors != oldDisplayData.m_scaleFactors)
     270            gEDataManager->setScaleFactors(newDisplayData.m_scaleFactors);
    260271    }
    261272    /* Return result: */
    262273    return fSuccess;
    263274}
    264 
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.ui

    r71027 r74872  
    120120    </widget>
    121121   </item>
    122    <item row="4" column="0" colspan="2">
     122   <item row="4" column="0">
     123     <widget class="QLabel" name="m_pLabelGuestScreenScaleFactorEditor">
     124       <property name="text">
     125         <string>Scale Factor:</string>
     126       </property>
     127       <property name="alignment">
     128         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
     129       </property>
     130     </widget>
     131   </item>
     132   <item row="4" column="1" rowspan="2" colspan="2">
     133     <layout class="QGridLayout" name="m_pLayoutGuestScreenScaleFactorEditor">
     134       <property name="spacing">
     135         <number>0</number>
     136       </property>
     137       <item row="0" column="0" rowspan="2" colspan="3">
     138         <widget class="UIScaleFactorEditor" name="m_pScaleFactorEditor">
     139           <property name="sizePolicy">
     140             <sizepolicy hsizetype="Expanding" >
     141               <horstretch>0</horstretch>
     142               <verstretch>0</verstretch>
     143             </sizepolicy>
     144           </property>
     145           <property name="whatsThis">
     146             <string>Controls the guest screen scale factor.</string>
     147           </property>
     148         </widget>
     149       </item>
     150     </layout>
     151   </item>
     152   <item row="6" column="0" colspan="2">
    123153    <spacer>
    124154     <property name="orientation">
     
    135165  </layout>
    136166 </widget>
     167 <customwidgets>
     168   <customwidget>
     169     <class>UIScaleFactorEditor</class>
     170     <extends>QWidget</extends>
     171     <header>UIScaleFactorEditor.h</header>
     172   </customwidget>
     173 </customwidgets>
    137174 <resources/>
    138175 <connections/>
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui

    r74722 r74872  
    156156           </widget>
    157157          </item>
    158           <item row="4" column="1" rowspan="1" colspan="2">
     158          <item row="4" column="1" rowspan="2" colspan="2">
    159159           <layout class="QGridLayout" name="m_pLayoutGuestScreenScaleFactorEditor">
    160160            <property name="spacing">
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