VirtualBox

Ignore:
Timestamp:
Jan 14, 2021 1:35:18 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515. Some indentation fixes.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIUserNamePasswordEditor.cpp

    r85150 r87249  
    217217    if (!pLabel)
    218218        return;
    219     pLayout->addWidget(pLabel, iRow, 0, 1, 1, Qt::AlignRight);
     219    pLabel->setAlignment(Qt::AlignRight);
     220    pLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
     221
     222    pLayout->addWidget(pLabel, iRow, 0, 1, 1);
     223
    220224
    221225    pLineEdit = new T;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r86979 r87249  
    1818/* Qt includes: */
    1919#include <QAbstractButton>
     20#include <QLayout>
    2021
    2122/* GUI includes: */
     
    563564    return getStringFieldValue("guestOSFamiyId").contains("windows", Qt::CaseInsensitive);
    564565}
     566
     567void UIWizardNewVM::increaseLayoutLeftMargin(QLayout *pLayout, float mult /* = 2 */)
     568{
     569    if (!pLayout)
     570        return;
     571    QMargins margins = pLayout->contentsMargins();
     572    pLayout->setContentsMargins(mult * margins.left(),
     573                                margins.top(),
     574                                margins.right(),
     575                                margins.bottom());
     576}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r85150 r87249  
    8484    bool isUnattendedInstallEnabled() const;
    8585    bool isGuestOSTypeWindows() const;
     86    /** Increases the amoun of the left marign of @p pLayout. */
     87    static void increaseLayoutLeftMargin(QLayout *pLayout, float mult = 2);
    8688
    8789protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r87244 r87249  
    286286}
    287287
    288 QWidget *UIWizardNewVMPage1::createNameOSTypeWidgets(WizardMode mode, bool fCreateLabels /* = true */)
    289 {
    290     Q_UNUSED(mode);
     288QWidget *UIWizardNewVMPage1::createNameOSTypeWidgets(bool fIncreaseLeftIndent, bool fCreateLabels /* = true */)
     289{
     290    Q_UNUSED(fIncreaseLeftIndent);
    291291    QWidget *pContainer = new QWidget;
    292292    QGridLayout *pLayout = new QGridLayout(pContainer);
     293    if (fIncreaseLeftIndent)
     294        UIWizardNewVM::increaseLayoutLeftMargin(pLayout);
     295
    293296    int iRow = 0;
    294297    if (fCreateLabels)
     
    520523{
    521524    QVBoxLayout *pPageLayout = new QVBoxLayout(this);
    522     pPageLayout->addWidget(createNameOSTypeWidgets(WizardMode_Basic, false));
     525    pPageLayout->addWidget(createNameOSTypeWidgets(/* fIncreaseLeftIndent */ false, /* fCreateLabels */false));
    523526    pPageLayout->addStretch();
    524527
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r87244 r87249  
    7878    void composeMachineFilePath();
    7979
    80     QWidget *createNameOSTypeWidgets(WizardMode mode, bool fCreateLabels = true);
     80    QWidget *createNameOSTypeWidgets(bool fIncreaseLeftIndent, bool fCreateLabels = true);
    8181    int createNameOSTypeWidgets(QGridLayout *pLayout, bool fCreateLabels = true);
    8282    void setTypeByISODetectedOSType(const QString &strDetectedOSType);
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp

    r85173 r87249  
    118118}
    119119
    120 QWidget *UIWizardNewVMPage2::createUserNameHostNameWidgets()
     120QWidget *UIWizardNewVMPage2::createUserNameHostNameWidgets(bool fIncreaseLeftIndent)
    121121{
    122122    QWidget *pContainer = new QWidget;
    123123    QGridLayout *pGridLayout = new QGridLayout(pContainer);
    124     pGridLayout->setContentsMargins(0, 0, 0, 0);
     124
     125    if (fIncreaseLeftIndent)
     126        UIWizardNewVM::increaseLayoutLeftMargin(pGridLayout);
    125127
    126128    m_pUserNamePasswordEditor = new UIUserNamePasswordEditor;
    127     pGridLayout->addWidget(m_pUserNamePasswordEditor, 0, 0, 3, 4);
     129    pGridLayout->addWidget(m_pUserNamePasswordEditor, 0, 0, 1, 4);
     130
    128131    m_pHostnameLabel = new QLabel;
     132    m_pHostnameLabel->setAlignment(Qt::AlignRight);
     133    m_pHostnameLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
     134
    129135    m_pHostnameLineEdit = new QLineEdit;
    130     pGridLayout->addWidget(m_pHostnameLabel, 3, 0, 1, 1, Qt::AlignRight);
    131     pGridLayout->addWidget(m_pHostnameLineEdit, 3, 1, 1, 3);
     136
     137    pGridLayout->addWidget(m_pHostnameLabel,    1, 0, 1, 1);
     138    pGridLayout->addWidget(m_pHostnameLineEdit, 1, 1, 1, 3);
     139
    132140    return pContainer;
    133141}
    134142
    135 QWidget *UIWizardNewVMPage2::createGAInstallWidgets()
     143QWidget *UIWizardNewVMPage2::createGAInstallWidgets(bool fIncreaseLeftIndent)
    136144{
    137145    QWidget *pContainer = new QWidget;
    138146    QGridLayout *pContainerLayout = new QGridLayout(pContainer);
    139     pContainerLayout->setContentsMargins(0, 0, 0, 0);
     147    if (fIncreaseLeftIndent)
     148        UIWizardNewVM::increaseLayoutLeftMargin(pContainerLayout);
    140149
    141150    m_pInstallGACheckBox = new QCheckBox;
     
    160169}
    161170
    162 QWidget *UIWizardNewVMPage2::createProductKeyWidgets()
     171QWidget *UIWizardNewVMPage2::createProductKeyWidgets(bool fIncreaseLeftIndent)
    163172{
    164173    QWidget *pContainer = new QWidget;
    165174    QGridLayout *pGridLayout = new QGridLayout(pContainer);
    166     pGridLayout->setContentsMargins(0, 0, 0, 0);
     175    if (fIncreaseLeftIndent)
     176        UIWizardNewVM::increaseLayoutLeftMargin(pGridLayout);
    167177
    168178    m_pProductKeyLabel = new QLabel;
     179    m_pProductKeyLabel->setAlignment(Qt::AlignRight);
     180
     181    m_pProductKeyLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
     182
    169183    m_pProductKeyLineEdit = new QLineEdit;
    170184    m_pProductKeyLineEdit->setInputMask(">NNNNN-NNNNN-NNNNN-NNNNN-NNNNN;#");
    171     pGridLayout->addWidget(m_pProductKeyLabel, 0, 0, 1, 1, Qt::AlignRight);
     185    pGridLayout->addWidget(m_pProductKeyLabel, 0, 0, 1, 1);
    172186    pGridLayout->addWidget(m_pProductKeyLineEdit, 0, 1, 1, 3);
    173187    return pContainer;
     
    226240    }
    227241
    228     m_pToolBox->insertItem(ToolBoxItems_UserNameHostname, createUserNameHostNameWidgets(), QString());
    229     m_pToolBox->insertItem(ToolBoxItems_GAInstall, createGAInstallWidgets(), QString());
    230     m_pToolBox->insertItem(ToolBoxItems_ProductKey, createProductKeyWidgets(), QString());
    231     m_pToolBox->setStyleSheet("QToolBox::tab:selected { font: bold; }");
     242    m_pToolBox->insertItem(ToolBoxItems_UserNameHostname, createUserNameHostNameWidgets(/* fIncreaseLeftIndent */ true), QString());
     243    m_pToolBox->insertItem(ToolBoxItems_GAInstall, createGAInstallWidgets(/* fIncreaseLeftIndent */ true), QString());
     244    m_pToolBox->insertItem(ToolBoxItems_ProductKey, createProductKeyWidgets(/* fIncreaseLeftIndent */ true), QString());
    232245
    233246    registerField("userName", this, "userName");
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.h

    r85168 r87249  
    6767    };
    6868
    69     QWidget *createUserNameHostNameWidgets();
    70     QWidget *createGAInstallWidgets();
    71     QWidget *createProductKeyWidgets();
     69    QWidget *createUserNameHostNameWidgets(bool fIncreaseLeftIndent);
     70    QWidget *createGAInstallWidgets(bool fIncreaseLeftIndent);
     71    QWidget *createProductKeyWidgets(bool fIncreaseLeftIndent);
    7272
    7373    bool checkGAISOFile() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp

    r85637 r87249  
    164164}
    165165
    166 QWidget *UIWizardNewVMPage3::createDiskWidgets()
     166QWidget *UIWizardNewVMPage3::createDiskWidgets(bool fIncreaseLeftIndent)
    167167{
    168168    QWidget *pDiskContainer = new QWidget;
    169169    QGridLayout *pDiskLayout = new QGridLayout(pDiskContainer);
    170     pDiskLayout->setContentsMargins(0, 0, 0, 0);
     170    if (fIncreaseLeftIndent)
     171        UIWizardNewVM::increaseLayoutLeftMargin(pDiskLayout);
     172
    171173
    172174    m_pDiskSkip = new QRadioButton;
     
    195197}
    196198
    197 QWidget *UIWizardNewVMPage3::createHardwareWidgets()
     199QWidget *UIWizardNewVMPage3::createHardwareWidgets(bool fIncreaseLeftIndent)
    198200{
    199201    QWidget *pHardwareContainer = new QWidget;
    200202    QGridLayout *pHardwareLayout = new QGridLayout(pHardwareContainer);
    201     pHardwareLayout->setContentsMargins(0, 0, 0, 0);
     203    if (fIncreaseLeftIndent)
     204        UIWizardNewVM::increaseLayoutLeftMargin(pHardwareLayout);
    202205    m_pBaseMemoryEditor = new UIBaseMemoryEditor(0, true);
    203206    m_pVirtualCPUEditor = new UIVirtualCPUEditor(0, true);
     
    230233    pMainLayout->addWidget(m_pToolBox);
    231234
    232     m_pToolBox->insertItem(ToolBoxItems_Disk, createDiskWidgets(), QString());
    233     m_pToolBox->insertItem(ToolBoxItems_Hardware, createHardwareWidgets(), QString());
     235    m_pToolBox->insertItem(ToolBoxItems_Disk, createDiskWidgets(/* fIncreaseLeftIndent */ true), QString());
     236    m_pToolBox->insertItem(ToolBoxItems_Hardware, createHardwareWidgets(/* fIncreaseLeftIndent */ true), QString());
    234237    m_pToolBox->setStyleSheet("QToolBox::tab:selected { font: bold; }");
    235238
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.h

    r85168 r87249  
    7777    /** @} */
    7878
    79     QWidget *createDiskWidgets();
    80     QWidget *createHardwareWidgets();
     79    QWidget *createDiskWidgets(bool fIncreaseLeftIndent);
     80    QWidget *createHardwareWidgets(bool fIncreaseLeftIndent);
    8181
    8282    /** Helpers. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87244 r87249  
    5050    {
    5151        m_pToolBox = new QToolBox;
    52 
    53         m_pToolBox->insertItem(ExpertToolboxItems_NameAndOSType, createNameOSTypeWidgets(WizardMode_Expert, false), "");
    54         m_pToolBox->insertItem(ExpertToolboxItems_Disk, createDiskWidgets(), "");
    55         m_pToolBox->insertItem(ExpertToolboxItems_Hardware, createHardwareWidgets(), "");
    56         m_pToolBox->insertItem(ExpertToolboxItems_UsernameHostname, createUserNameHostNameWidgets(), "");
    57         m_pToolBox->insertItem(ExpertToolboxItems_GAInstall, createGAInstallWidgets(), "");
    58         m_pToolBox->insertItem(ExpertToolboxItems_ProductKey, createProductKeyWidgets(), "");
     52        m_pToolBox->insertItem(ExpertToolboxItems_NameAndOSType, createNameOSTypeWidgets(/* fIncreaseLeftIndent */ true,
     53                                                                                         /* fCreateLabels */ false), "");
     54        m_pToolBox->insertItem(ExpertToolboxItems_Disk, createDiskWidgets(/* fIncreaseLeftIndent */ true), "");
     55        m_pToolBox->insertItem(ExpertToolboxItems_Hardware, createHardwareWidgets(/* fIncreaseLeftIndent */ true), "");
     56        m_pToolBox->insertItem(ExpertToolboxItems_UsernameHostname, createUserNameHostNameWidgets(/* fIncreaseLeftIndent */ true), "");
     57        m_pToolBox->insertItem(ExpertToolboxItems_GAInstall, createGAInstallWidgets(/* fIncreaseLeftIndent */ true), "");
     58        m_pToolBox->insertItem(ExpertToolboxItems_ProductKey, createProductKeyWidgets(/* fIncreaseLeftIndent */ true), "");
    5959        pMainLayout->addWidget(m_pToolBox);
     60
    6061        pMainLayout->addStretch();
    6162        updateVirtualDiskSource();
    6263    }
     64
    6365
    6466    createConnections();
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