VirtualBox

Changeset 94148 in vbox


Ignore:
Timestamp:
Mar 9, 2022 12:33:50 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: VM settings: Reworking Interface page to increase page accessibility.

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

Legend:

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

    r94039 r94148  
    12421242    {
    12431243        /* Prepare editor: */
    1244         UIVisualStateEditor *pEditor = new UIVisualStateEditor(pPopup, true /* with label */);
     1244        UIVisualStateEditor *pEditor = new UIVisualStateEditor(pPopup);
    12451245        if (pEditor)
    12461246        {
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVisualStateEditor.cpp

    r94062 r94148  
    2929
    3030
    31 UIVisualStateEditor::UIVisualStateEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */)
     31UIVisualStateEditor::UIVisualStateEditor(QWidget *pParent /* = 0 */)
    3232    : QIWithRetranslateUI<QWidget>(pParent)
    33     , m_fWithLabel(fWithLabel)
    3433    , m_enmValue(UIVisualStateType_Invalid)
     34    , m_pLayout(0)
    3535    , m_pLabel(0)
    3636    , m_pCombo(0)
     
    6868}
    6969
     70int UIVisualStateEditor::minimumLabelHorizontalHint() const
     71{
     72    return m_pLabel->minimumSizeHint().width();
     73}
     74
     75void UIVisualStateEditor::setMinimumLayoutIndent(int iIndent)
     76{
     77    if (m_pLayout)
     78        m_pLayout->setColumnMinimumWidth(0, iIndent);
     79}
     80
    7081void UIVisualStateEditor::retranslateUi()
    7182{
     
    93104{
    94105    /* Create main layout: */
    95     QGridLayout *pMainLayout = new QGridLayout(this);
    96     if (pMainLayout)
     106    m_pLayout = new QGridLayout(this);
     107    if (m_pLayout)
    97108    {
    98         pMainLayout->setContentsMargins(0, 0, 0, 0);
    99         int iRow = 0;
     109        m_pLayout->setContentsMargins(0, 0, 0, 0);
    100110
    101111        /* Create label: */
    102         if (m_fWithLabel)
    103             m_pLabel = new QLabel(this);
     112        m_pLabel = new QLabel(this);
    104113        if (m_pLabel)
    105             pMainLayout->addWidget(m_pLabel, 0, iRow++, 1, 1);
     114        {
     115            m_pLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     116            m_pLayout->addWidget(m_pLabel, 0, 0);
     117        }
    106118
    107119        /* Create combo layout: */
     
    126138
    127139            /* Add combo-layout into main-layout: */
    128             pMainLayout->addLayout(pComboLayout, 0, iRow++, 1, 1);
     140            m_pLayout->addLayout(pComboLayout, 0, 1);
    129141        }
    130142    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVisualStateEditor.h

    r94062 r94148  
    3333/* Forward declarations: */
    3434class QComboBox;
     35class QGridLayout;
    3536class QLabel;
    3637
     
    4748public:
    4849
    49     /** Constructs visual state editor passing @a pParent to the base-class.
    50       * @param  fWithLabel  Brings whether we should add label ourselves. */
    51     UIVisualStateEditor(QWidget *pParent = 0, bool fWithLabel = false);
     50    /** Constructs visual state editor passing @a pParent to the base-class. */
     51    UIVisualStateEditor(QWidget *pParent = 0);
    5252
    5353    /** Defines editor @a uMachineId. */
     
    6161    /** Returns the vector of supported values. */
    6262    QVector<UIVisualStateType> supportedValues() const { return m_supportedValues; }
     63
     64    /** Returns minimum layout hint. */
     65    int minimumLabelHorizontalHint() const;
     66    /** Defines minimum layout @a iIndent. */
     67    void setMinimumLayoutIndent(int iIndent);
    6368
    6469protected:
     
    8287    QUuid  m_uMachineId;
    8388
    84     /** Holds whether descriptive label should be created. */
    85     bool  m_fWithLabel;
    86 
    8789    /** Holds the value to be selected. */
    8890    UIVisualStateType  m_enmValue;
     
    9193    QVector<UIVisualStateType>  m_supportedValues;
    9294
     95    /** Holds the main layout instance. */
     96    QGridLayout *m_pLayout;
    9397    /** Holds the label instance. */
    94     QLabel    *m_pLabel;
     98    QLabel      *m_pLabel;
    9599    /** Holds the combo instance. */
    96     QComboBox *m_pCombo;
     100    QComboBox   *m_pCombo;
    97101};
    98102
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp

    r94062 r94148  
    144144    , m_pActionPool(0)
    145145    , m_pCache(0)
     146    , m_pLayout(0)
    146147    , m_pEditorMenuBar(0)
    147     , m_pLabelVisualState(0)
    148148    , m_pEditorVisualState(0)
    149149    , m_pLabelMiniToolBar(0)
     
    152152    , m_pEditorStatusBar(0)
    153153{
    154     /* Prepare: */
    155154    prepare();
    156155}
     
    158157UIMachineSettingsInterface::~UIMachineSettingsInterface()
    159158{
    160     /* Cleanup: */
    161159    cleanup();
    162160}
     
    300298{
    301299    m_pEditorMenuBar->setToolTip(tr("Allows to modify VM menu-bar contents."));
    302     m_pLabelVisualState->setText(tr("&Visual State:"));
    303300    m_pLabelMiniToolBar->setText(tr("Mini ToolBar:"));
     301    m_pCheckBoxShowMiniToolBar->setText(tr("Show in &Full-screen/Seamless"));
    304302    m_pCheckBoxShowMiniToolBar->setToolTip(tr("When checked, show the Mini ToolBar in full-screen and seamless modes."));
    305     m_pCheckBoxShowMiniToolBar->setText(tr("Show in &Full-screen/Seamless"));
     303    m_pCheckBoxMiniToolBarAlignment->setText(tr("Show at &Top of Screen"));
    306304    m_pCheckBoxMiniToolBarAlignment->setToolTip(tr("When checked, show the Mini ToolBar at the top of the screen, rather than in "
    307305                                                   "its default position at the bottom of the screen."));
    308     m_pCheckBoxMiniToolBarAlignment->setText(tr("Show at &Top of Screen"));
    309306    m_pEditorStatusBar->setToolTip(tr("Allows to modify VM status-bar contents."));
     307
     308    /* These editors have own labels, but we want them to be properly layouted according to each other: */
     309    int iMinimumLayoutHint = 0;
     310    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorVisualState->minimumLabelHorizontalHint());
     311    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelMiniToolBar->minimumSizeHint().width());
     312    m_pEditorVisualState->setMinimumLayoutIndent(iMinimumLayoutHint);
     313    m_pLayout->setColumnMinimumWidth(0, iMinimumLayoutHint);
    310314}
    311315
     
    346350{
    347351    /* Prepare main layout: */
    348     QGridLayout *pLayoutMain = new QGridLayout(this);
    349     if (pLayoutMain)
    350     {
    351         pLayoutMain->setColumnStretch(1, 1);
    352         pLayoutMain->setRowStretch(4, 1);
     352    m_pLayout = new QGridLayout(this);
     353    if (m_pLayout)
     354    {
     355        m_pLayout->setColumnStretch(1, 1);
     356        m_pLayout->setRowStretch(4, 1);
    353357
    354358        /* Prepare menu-bar editor: */
     
    359363            m_pEditorMenuBar->setMachineID(m_uMachineId);
    360364
    361             pLayoutMain->addWidget(m_pEditorMenuBar, 0, 0, 1, 3);
     365            m_pLayout->addWidget(m_pEditorMenuBar, 0, 0, 1, 3);
    362366        }
    363367
    364         /* Prepare visual-state label: */
    365         m_pLabelVisualState = new QLabel(this);
    366         if (m_pLabelVisualState)
    367         {
    368             m_pLabelVisualState->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    369             pLayoutMain->addWidget(m_pLabelVisualState, 1, 0);
    370         }
    371368        /* Prepare visual-state editor: */
    372369        m_pEditorVisualState = new UIVisualStateEditor(this);
    373370        if (m_pEditorVisualState)
    374         {
    375             if (m_pLabelVisualState)
    376                 m_pLabelVisualState->setBuddy(m_pEditorVisualState);
    377             pLayoutMain->addWidget(m_pEditorVisualState, 1, 1);
    378         }
     371            m_pLayout->addWidget(m_pEditorVisualState, 1, 0, 1, 3);
    379372
    380373        /* Prepare mini-toolbar label: */
     
    383376        {
    384377            m_pLabelMiniToolBar->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    385             pLayoutMain->addWidget(m_pLabelMiniToolBar, 2, 0);
     378            m_pLayout->addWidget(m_pLabelMiniToolBar, 2, 0);
    386379        }
    387380        /* Prepare 'show mini-toolbar' check-box: */
    388381        m_pCheckBoxShowMiniToolBar = new QCheckBox(this);
    389382        if (m_pCheckBoxShowMiniToolBar)
    390             pLayoutMain->addWidget(m_pCheckBoxShowMiniToolBar, 2, 1);
     383            m_pLayout->addWidget(m_pCheckBoxShowMiniToolBar, 2, 1);
    391384        /* Prepare 'mini-toolbar alignment' check-box: */
    392385        m_pCheckBoxMiniToolBarAlignment = new QCheckBox(this);
    393386        if (m_pCheckBoxMiniToolBarAlignment)
    394             pLayoutMain->addWidget(m_pCheckBoxMiniToolBarAlignment, 3, 1);
     387            m_pLayout->addWidget(m_pCheckBoxMiniToolBarAlignment, 3, 1);
    395388
    396389        /* Prepare status-bar editor: */
     
    399392        {
    400393            m_pEditorStatusBar->setMachineID(m_uMachineId);
    401             pLayoutMain->addWidget(m_pEditorStatusBar, 5, 0, 1, 3);
     394            m_pLayout->addWidget(m_pEditorStatusBar, 5, 0, 1, 3);
    402395        }
    403396    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h

    r93990 r94148  
    2727/* Forward declarations: */
    2828class QCheckBox;
     29class QGridLayout;
    2930class QLabel;
    3031class UIActionPool;
     
    104105    /** @name Widgets
    105106     * @{ */
     107        /** Holds the main layout instance. */
     108        QGridLayout             *m_pLayout;
    106109        /** Holds the menu-bar editor instance. */
    107110        UIMenuBarEditorWidget   *m_pEditorMenuBar;
    108         /** Holds the visual state label instance. */
    109         QLabel                  *m_pLabelVisualState;
    110         /** Holds the visual state label instance. */
     111        /** Holds the visual state editor instance. */
    111112        UIVisualStateEditor     *m_pEditorVisualState;
    112113        /** Holds the mini-toolbar label instance. */
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