VirtualBox

Ignore:
Timestamp:
Mar 23, 2022 7:06:51 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt/Ds: bugref:6899: Machine settings: Display page accessibility improvements for Screen tab, part 1.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp

    r94148 r94341  
    996996    {
    997997        /* Prepare editor: */
    998         UIVideoMemoryEditor *pEditor = new UIVideoMemoryEditor(pPopup, true /* with label */);
     998        UIVideoMemoryEditor *pEditor = new UIVideoMemoryEditor(pPopup);
    999999        if (pEditor)
    10001000        {
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVideoMemoryEditor.cpp

    r93115 r94341  
    3232
    3333
    34 UIVideoMemoryEditor::UIVideoMemoryEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */)
     34UIVideoMemoryEditor::UIVideoMemoryEditor(QWidget *pParent /* = 0 */)
    3535    : QIWithRetranslateUI<QWidget>(pParent)
    36     , m_fWithLabel(fWithLabel)
    3736    , m_comGuestOSType(CGuestOSType())
    3837    , m_cGuestScreenCount(1)
     
    4645    , m_iMaxVRAMVisible(0)
    4746    , m_iInitialVRAM(0)
     47    , m_pLayout(0)
    4848    , m_pLabelMemory(0)
    4949    , m_pSlider(0)
     
    136136#endif /* VBOX_WITH_3D_ACCELERATION */
    137137
     138int UIVideoMemoryEditor::minimumLabelHorizontalHint() const
     139{
     140    return m_pLabelMemory->minimumSizeHint().width();
     141}
     142
     143void UIVideoMemoryEditor::setMinimumLayoutIndent(int iIndent)
     144{
     145    if (m_pLayout)
     146        m_pLayout->setColumnMinimumWidth(0, iIndent);
     147}
     148
    138149void UIVideoMemoryEditor::retranslateUi()
    139150{
    140151    if (m_pLabelMemory)
    141152        m_pLabelMemory->setText(tr("Video &Memory:"));
     153
     154    if (m_pSlider)
     155        m_pSlider->setToolTip(tr("Holds the amount of video memory provided to the virtual machine."));
     156    if (m_pSpinBox)
     157        m_pSpinBox->setToolTip(tr("Holds the amount of video memory provided to the virtual machine."));
     158
    142159    if (m_pLabelMemoryMin)
     160    {
    143161        m_pLabelMemoryMin->setText(tr("%1 MB").arg(m_iMinVRAM));
     162        m_pLabelMemoryMin->setToolTip(tr("Minimum possible video memory size."));
     163    }
    144164    if (m_pLabelMemoryMax)
     165    {
    145166        m_pLabelMemoryMax->setText(tr("%1 MB").arg(m_iMaxVRAMVisible));
     167        m_pLabelMemoryMax->setToolTip(tr("Maximum possible video memory size."));
     168    }
     169
    146170    if (m_pSpinBox)
    147171        m_pSpinBox->setSuffix(QString(" %1").arg(tr("MB")));
     
    185209
    186210    /* Create main layout: */
    187     QGridLayout *pMainLayout = new QGridLayout(this);
    188     if (pMainLayout)
    189     {
    190         pMainLayout->setContentsMargins(0, 0, 0, 0);
    191         int iRow = 0;
     211    m_pLayout = new QGridLayout(this);
     212    if (m_pLayout)
     213    {
     214        m_pLayout->setContentsMargins(0, 0, 0, 0);
    192215
    193216        /* Create memory label: */
    194         if (m_fWithLabel)
    195             m_pLabelMemory = new QLabel(this);
     217        m_pLabelMemory = new QLabel(this);
    196218        if (m_pLabelMemory)
    197             pMainLayout->addWidget(m_pLabelMemory, 0, iRow++, 1, 1);
     219        {
     220            m_pLabelMemory->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     221            m_pLayout->addWidget(m_pLabelMemory, 0, 0);
     222        }
    198223
    199224        /* Create slider layout: */
     
    244269
    245270            /* Add slider layout to main layout: */
    246             pMainLayout->addLayout(pSliderLayout, 0, iRow++, 2, 1);
     271            m_pLayout->addLayout(pSliderLayout, 0, 1, 2, 1);
    247272        }
    248273
     
    258283            connect(m_pSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
    259284                    this, &UIVideoMemoryEditor::sltHandleSpinBoxChange);
    260             pMainLayout->addWidget(m_pSpinBox, 0, iRow++, 1, 1);
     285            m_pLayout->addWidget(m_pSpinBox, 0, 2);
    261286        }
    262287    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVideoMemoryEditor.h

    r93990 r94341  
    3434
    3535/* Forward declarations: */
     36class QGridLayout;
    3637class QLabel;
    3738class QSpinBox;
     
    5051public:
    5152
    52     /** Constructs video-memory editor passing @a pParent to the base-class.
    53       * @param  fWithLabel  Brings whether we should add label ourselves. */
    54     UIVideoMemoryEditor(QWidget *pParent = 0, bool fWithLabel = false);
     53    /** Constructs video-memory editor passing @a pParent to the base-class. */
     54    UIVideoMemoryEditor(QWidget *pParent = 0);
    5555
    5656    /** Defines editor @a iValue. */
     
    7474    void set3DAccelerationEnabled(bool fEnabled);
    7575#endif
     76
     77    /** Returns minimum layout hint. */
     78    int minimumLabelHorizontalHint() const;
     79    /** Defines minimum layout @a iIndent. */
     80    void setMinimumLayoutIndent(int iIndent);
    7681
    7782protected:
     
    101106    static int calculatePageStep(int iMax);
    102107
    103     /** Holds whether descriptive label should be created. */
    104     bool  m_fWithLabel;
    105 
    106108    /** Holds the guest OS type ID. */
    107109    CGuestOSType             m_comGuestOSType;
     
    128130    int  m_iInitialVRAM;
    129131
     132    /** Holds the main layout instance. */
     133    QGridLayout      *m_pLayout;
    130134    /** Holds the memory label instance. */
    131135    QLabel           *m_pLabelMemory;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r94333 r94341  
    303303    , m_pTabWidget(0)
    304304    , m_pTabScreen(0)
    305     , m_pLabelVideoMemorySize(0)
     305    , m_pLayoutScreen(0)
    306306    , m_pEditorVideoMemorySize(0)
    307307    , m_pLabelMonitorCount(0)
     
    778778void UIMachineSettingsDisplay::retranslateUi()
    779779{
    780     m_pLabelVideoMemorySize->setText(tr("Video &Memory:"));
    781     m_pEditorVideoMemorySize->setToolTip(tr("Controls the amount of video memory provided to the virtual machine."));
    782780    m_pLabelMonitorCount->setText(tr("Mo&nitor Count:"));
    783781    m_pSliderMonitorCount->setToolTip(tr("Controls the amount of virtual monitors provided to the virtual machine."));
     
    865863    m_pComboRecordingMode->setItemText(2, gpConverter->toString(UISettingsDefs::RecordingMode_AudioOnly));
    866864
     865    /* These editors have own labels, but we want them to be properly layouted according to each other: */
     866    int iMinimumLayoutHint = 0;
     867    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorVideoMemorySize->minimumLabelHorizontalHint());
     868    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelMonitorCount->minimumSizeHint().width());
     869    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelScaleFactor->minimumSizeHint().width());
     870    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelGraphicsController->minimumSizeHint().width());
     871    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelAcceleration->minimumSizeHint().width());
     872    m_pEditorVideoMemorySize->setMinimumLayoutIndent(iMinimumLayoutHint);
     873    m_pLayoutScreen->setColumnMinimumWidth(0, iMinimumLayoutHint);
     874
    867875    updateRecordingFileSizeHint();
    868876}
     
    874882
    875883    /* Polish 'Screen' availability: */
    876     m_pLabelVideoMemorySize->setEnabled(isMachineOffline());
    877884    m_pEditorVideoMemorySize->setEnabled(isMachineOffline());
    878885    m_pLabelMonitorCount->setEnabled(isMachineOffline());
     
    10981105    {
    10991106        /* Prepare 'Screen' tab layout: */
    1100         QGridLayout *pLayoutScreen = new QGridLayout(m_pTabScreen);
    1101         if (pLayoutScreen)
     1107        m_pLayoutScreen = new QGridLayout(m_pTabScreen);
     1108        if (m_pLayoutScreen)
    11021109        {
    1103             pLayoutScreen->setRowStretch(8, 1);
    1104 
    1105             /* Prepare video memory label: */
    1106             m_pLabelVideoMemorySize = new QLabel(m_pTabScreen);
    1107             if (m_pLabelVideoMemorySize)
    1108             {
    1109                 m_pLabelVideoMemorySize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    1110                 pLayoutScreen->addWidget(m_pLabelVideoMemorySize, 0, 0);
    1111             }
     1110            m_pLayoutScreen->setRowStretch(8, 1);
     1111
    11121112            /* Prepare video memory editor: */
    11131113            m_pEditorVideoMemorySize = new UIVideoMemoryEditor(m_pTabScreen);
    11141114            if (m_pEditorVideoMemorySize)
    1115             {
    1116                 if (m_pLabelVideoMemorySize)
    1117                     m_pLabelVideoMemorySize->setBuddy(m_pEditorVideoMemorySize->focusProxy());
    1118                 pLayoutScreen->addWidget(m_pEditorVideoMemorySize, 0, 1, 2, 2);
    1119             }
     1115                m_pLayoutScreen->addWidget(m_pEditorVideoMemorySize, 0, 0, 1, 3);
    11201116
    11211117            /* Prepare monitor count label: */
     
    11241120            {
    11251121                m_pLabelMonitorCount->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    1126                 pLayoutScreen->addWidget(m_pLabelMonitorCount, 2, 0);
     1122                m_pLayoutScreen->addWidget(m_pLabelMonitorCount, 1, 0);
    11271123            }
    11281124            /* Prepare monitor count layout: */
     
    11701166                }
    11711167
    1172                 pLayoutScreen->addLayout(pLayoutMonitorCount, 2, 1, 2, 1);
     1168                m_pLayoutScreen->addLayout(pLayoutMonitorCount, 1, 1, 2, 1);
    11731169            }
    11741170            /* Prepare monitor count spinbox: */
     
    11811177                m_pSpinboxMonitorCount->setMaximum(comProperties.GetMaxGuestMonitors());
    11821178
    1183                 pLayoutScreen->addWidget(m_pSpinboxMonitorCount, 2, 2);
     1179                m_pLayoutScreen->addWidget(m_pSpinboxMonitorCount, 1, 2);
    11841180            }
    11851181
     
    11891185            {
    11901186                m_pLabelScaleFactor->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    1191                 pLayoutScreen->addWidget(m_pLabelScaleFactor, 4, 0);
     1187                m_pLayoutScreen->addWidget(m_pLabelScaleFactor, 3, 0);
    11921188            }
    11931189            /* Prepare scale factor editor: */
     
    11971193                if (m_pLabelScaleFactor)
    11981194                    m_pLabelScaleFactor->setBuddy(m_pEditorScaleFactor->focusProxy());
    1199                 pLayoutScreen->addWidget(m_pEditorScaleFactor, 4, 1, 2, 2);
     1195                m_pLayoutScreen->addWidget(m_pEditorScaleFactor, 3, 1, 2, 2);
    12001196            }
    12011197
     
    12051201            {
    12061202                m_pLabelGraphicsController->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    1207                 pLayoutScreen->addWidget(m_pLabelGraphicsController, 6, 0);
     1203                m_pLayoutScreen->addWidget(m_pLabelGraphicsController, 5, 0);
    12081204            }
    12091205            /* Prepare graphics controller editor: */
     
    12131209                if (m_pLabelGraphicsController)
    12141210                    m_pLabelGraphicsController->setBuddy(m_pEditorGraphicsController);
    1215                 pLayoutScreen->addWidget(m_pEditorGraphicsController, 6, 1, 1, 2);
     1211                m_pLayoutScreen->addWidget(m_pEditorGraphicsController, 5, 1, 1, 2);
    12161212            }
    12171213
     
    12211217            {
    12221218                m_pLabelAcceleration->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    1223                 pLayoutScreen->addWidget(m_pLabelAcceleration, 7, 0);
     1219                m_pLayoutScreen->addWidget(m_pLabelAcceleration, 6, 0);
    12241220            }
    12251221            /* Prepare 3D checkbox: */
    12261222            m_pCheckbox3D = new QCheckBox(m_pTabScreen);
    12271223            if (m_pCheckbox3D)
    1228                 pLayoutScreen->addWidget(m_pCheckbox3D, 7, 1);
     1224                m_pLayoutScreen->addWidget(m_pCheckbox3D, 6, 1);
    12291225        }
    12301226
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r94333 r94341  
    199199        /** Holds the 'Screen' tab instance. */
    200200        QWidget                    *m_pTabScreen;
    201         /** Holds the video memory size label instance. */
    202         QLabel                     *m_pLabelVideoMemorySize;
     201        /** Holds the 'Screen' layout instance. */
     202        QGridLayout                *m_pLayoutScreen;
    203203        /** Holds the video memory size editor instance. */
    204204        UIVideoMemoryEditor        *m_pEditorVideoMemorySize;
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