VirtualBox

Changeset 106079 in vbox


Ignore:
Timestamp:
Sep 18, 2024 12:17:40 PM (2 months ago)
Author:
vboxsync
Message:

FE/Qt: ​bugref:10765. Moving product key line edit next to other two to make layout simpler.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIHostnameDomainNameEditor.cpp

    r106061 r106079  
    4141#include "UIHostnameDomainNameEditor.h"
    4242#include "UITranslationEventListener.h"
     43#include "UIWizardNewVM.h"
    4344
    4445/* Other VBox includes: */
     
    5051    , m_pHostnameLineEdit(0)
    5152    , m_pDomainNameLineEdit(0)
     53    , m_pProductKeyLineEdit(0)
    5254    , m_pHostnameLabel(0)
    5355    , m_pDomainNameLabel(0)
     56    , m_pProductKeyLabel(0)
    5457    , m_pMainLayout(0)
    5558{
     
    110113}
    111114
    112 int UIHostnameDomainNameEditor::firstColumnWidth() const
    113 {
    114     int iWidth = 0;
    115     if (m_pHostnameLabel)
    116         iWidth = qMax(iWidth, m_pHostnameLabel->minimumSizeHint().width());
    117     if (m_pDomainNameLabel)
    118         iWidth = qMax(iWidth, m_pDomainNameLabel->minimumSizeHint().width());
    119     return iWidth;
    120 }
    121 
    122 void UIHostnameDomainNameEditor::setFirstColumnWidth(int iWidth)
    123 {
    124     if (m_pMainLayout)
    125         m_pMainLayout->setColumnMinimumWidth(0, iWidth);
    126 }
    127 
    128115void UIHostnameDomainNameEditor::sltRetranslateUI()
    129116{
     
    136123    if (m_pDomainNameLineEdit)
    137124        m_pDomainNameLineEdit->setToolTip(tr("Holds the domain name."));
     125    if (m_pProductKeyLabel)
     126        m_pProductKeyLabel->setText(UIWizardNewVM::tr("&Product Key:"));
     127    if (m_pProductKeyLineEdit)
     128        m_pProductKeyLineEdit->setToolTip(UIWizardNewVM::tr("Holds the product key."));
    138129}
    139130
     
    167158    setLayout(m_pMainLayout);
    168159    int iRow = 0;
     160
     161
     162
     163    addLineEdit(iRow, m_pProductKeyLabel, m_pProductKeyLineEdit, m_pMainLayout);
    169164    addLineEdit(iRow, m_pHostnameLabel, m_pHostnameLineEdit, m_pMainLayout);
    170165    addLineEdit(iRow, m_pDomainNameLabel, m_pDomainNameLineEdit, m_pMainLayout);
     166
     167    if (m_pProductKeyLineEdit)
     168    {
     169        m_pProductKeyLineEdit->setInputMask(">NNNNN-NNNNN-NNNNN-NNNNN-NNNNN;#");
     170        m_pProductKeyLineEdit->setMinimumWidth(fontMetrics().horizontalAdvance("NNNNN-NNNNN-NNNNN-NNNNN-NNNNN"));
     171    }
    171172
    172173    /* Host name and domain should be strings of minimum length of 2 and composed of alpha numerics, '-', and '.'
     
    179180    connect(m_pDomainNameLineEdit, &QILineEdit::textChanged,
    180181            this, &UIHostnameDomainNameEditor::sltDomainChanged);
     182    connect(m_pProductKeyLineEdit, &QILineEdit::textChanged,
     183            this, &UIHostnameDomainNameEditor::sigProductKeyChanged);
    181184
    182185    sltRetranslateUI();
     
    202205    emit sigHostnameDomainNameChanged(hostnameDomainName(), isComplete());
    203206}
     207
     208void UIHostnameDomainNameEditor::disableEnableProductKeyWidgets(bool fEnabled)
     209{
     210    if (m_pProductKeyLabel)
     211        m_pProductKeyLabel->setEnabled(fEnabled);
     212    if (m_pProductKeyLineEdit)
     213        m_pProductKeyLineEdit->setEnabled(fEnabled);
     214}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIHostnameDomainNameEditor.h

    r106061 r106079  
    5050
    5151    void sigHostnameDomainNameChanged(const QString &strHostNameDomain, bool fIsComplete);
     52    void sigProductKeyChanged(const QString &strProductKey);
    5253
    5354public:
     
    6667    void mark();
    6768
    68     int firstColumnWidth() const;
    69     void setFirstColumnWidth(int iWidth);
     69    void disableEnableProductKeyWidgets(bool fEnabled);
    7070
    7171private slots:
     
    8282    QILineEdit *m_pHostnameLineEdit;
    8383    QILineEdit *m_pDomainNameLineEdit;
     84    QILineEdit *m_pProductKeyLineEdit;
    8485
    8586    QLabel *m_pHostnameLabel;
    8687    QLabel *m_pDomainNameLabel;
     88    QLabel *m_pProductKeyLabel;
    8789    QGridLayout *m_pMainLayout;
    8890};
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.cpp

    r106061 r106079  
    225225UIAdditionalUnattendedOptions::UIAdditionalUnattendedOptions(QWidget *pParent /* = 0 */)
    226226    : QGroupBox(pParent)
    227     , m_pProductKeyLabel(0)
    228     , m_pProductKeyLineEdit(0)
    229227    , m_pHostnameDomainNameEditor(0)
    230228    , m_pStartHeadlessCheckBox(0)
     
    238236    m_pMainLayout->setColumnStretch(0, 0);
    239237    m_pMainLayout->setColumnStretch(1, 1);
    240     m_pProductKeyLabel = new QLabel;
    241     if (m_pProductKeyLabel)
    242     {
    243         m_pProductKeyLabel->setAlignment(Qt::AlignRight);
    244         m_pProductKeyLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    245         m_pMainLayout->addWidget(m_pProductKeyLabel, 0, 0);
    246     }
    247     m_pProductKeyLineEdit = new QILineEdit;
    248     if (m_pProductKeyLineEdit)
    249     {
    250         m_pProductKeyLineEdit->setInputMask(">NNNNN-NNNNN-NNNNN-NNNNN-NNNNN;#");
    251         if (m_pProductKeyLabel)
    252             m_pProductKeyLabel->setBuddy(m_pProductKeyLineEdit);
    253         m_pMainLayout->addWidget(m_pProductKeyLineEdit, 0, 1, 1, 2);
    254     }
    255238
    256239    m_pHostnameDomainNameEditor = new UIHostnameDomainNameEditor;
     
    263246
    264247    if (m_pHostnameDomainNameEditor)
     248    {
    265249        connect(m_pHostnameDomainNameEditor, &UIHostnameDomainNameEditor::sigHostnameDomainNameChanged,
    266250                this, &UIAdditionalUnattendedOptions::sigHostnameDomainNameChanged);
    267     if (m_pProductKeyLineEdit)
    268         connect(m_pProductKeyLineEdit, &QILineEdit::textChanged,
     251        connect(m_pHostnameDomainNameEditor, &UIHostnameDomainNameEditor::sigProductKeyChanged,
    269252                this, &UIAdditionalUnattendedOptions::sigProductKeyChanged);
     253    }
    270254    if (m_pStartHeadlessCheckBox)
    271255        connect(m_pStartHeadlessCheckBox, &QCheckBox::toggled,
     
    280264{
    281265    setTitle(UIWizardNewVM::tr("Additional Options"));
    282 
    283     if (m_pProductKeyLabel)
    284         m_pProductKeyLabel->setText(UIWizardNewVM::tr("&Product Key:"));
    285266
    286267    if (m_pStartHeadlessCheckBox)
     
    290271                                                               "unattended guest OS installation of newly created virtual machine."));
    291272    }
    292 
    293     int iMaxWidth = 0;
    294     if (m_pProductKeyLabel)
    295         iMaxWidth = qMax(m_pProductKeyLabel->minimumSizeHint().width(), iMaxWidth);
    296     if (m_pHostnameDomainNameEditor)
    297         iMaxWidth = qMax(m_pHostnameDomainNameEditor->firstColumnWidth(), iMaxWidth);
    298     if (iMaxWidth > 0)
    299     {
    300         m_pMainLayout->setColumnMinimumWidth(0, iMaxWidth);
    301         m_pHostnameDomainNameEditor->setFirstColumnWidth(iMaxWidth);
    302     }
    303     if (m_pProductKeyLineEdit)
    304         m_pProductKeyLineEdit->setToolTip(UIWizardNewVM::tr("Holds the product key."));
    305273}
    306274
     
    359327void UIAdditionalUnattendedOptions::disableEnableProductKeyWidgets(bool fEnabled)
    360328{
    361     if (m_pProductKeyLabel)
    362         m_pProductKeyLabel->setEnabled(fEnabled);
    363     if (m_pProductKeyLineEdit)
    364         m_pProductKeyLineEdit->setEnabled(fEnabled);
     329    if (m_pHostnameDomainNameEditor)
     330        m_pHostnameDomainNameEditor->disableEnableProductKeyWidgets(fEnabled);
    365331}
    366332
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h

    r105742 r106079  
    124124
    125125    void sigHostnameDomainNameChanged(const QString &strHostnameDomainName, bool fIsComplete);
    126     void sigProductKeyChanged(const QString &strHostnameDomainName);
     126    void sigProductKeyChanged(const QString &strProductKey);
    127127    void sigStartHeadlessChanged(bool fChecked);
    128128
     
    152152    void prepare();
    153153
    154     QLabel *m_pProductKeyLabel;
    155     QILineEdit *m_pProductKeyLineEdit;
     154
     155
    156156    UIHostnameDomainNameEditor *m_pHostnameDomainNameEditor;
    157157    QCheckBox *m_pStartHeadlessCheckBox;
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