VirtualBox

Changeset 84889 in vbox for trunk


Ignore:
Timestamp:
Jun 22, 2020 7:33:39 AM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515. Adding fields for user name/password.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r84886 r84889  
    681681        src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.h \
    682682        src/wizards/newvm/UIWizardNewVM.h \
     683        src/wizards/newvm/UIWizardNewVMPageBasicInstallSetup.h \
    683684        src/wizards/newvm/UIWizardNewVMPageBasicUnattended.h \
    684685        src/wizards/newvm/UIWizardNewVMPageBasicNameType.h \
     
    11411142        src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.cpp \
    11421143        src/wizards/newvm/UIWizardNewVM.cpp \
     1144        src/wizards/newvm/UIWizardNewVMPageBasicInstallSetup.cpp \
    11431145        src/wizards/newvm/UIWizardNewVMPageBasicUnattended.cpp \
    11441146        src/wizards/newvm/UIWizardNewVMPageBasicNameType.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r84887 r84889  
    2424#include "UIWizardNewVMPageBasicDisk.h"
    2525#include "UIWizardNewVMPageExpert.h"
     26#include "UIWizardNewVMPageBasicInstallSetup.h"
    2627#include "UIMessageCenter.h"
    2728#include "UIMedium.h"
     
    7374            setPage(PageHardware, new UIWizardNewVMPageBasicHardware);
    7475            setPage(PageDisk, new UIWizardNewVMPageBasicDisk);
     76            setPage(PageInstallSetup, new UIWizardNewVMPageBasicInstallSetup);
    7577            break;
    7678        }
     
    381383            break;
    382384        case PageNameType:
    383             return PageHardware;
     385            if (!isUnattendedInstallEnabled())
     386                return PageHardware;
     387            else
     388                return PageInstallSetup;
    384389            break;
    385390        case PageHardware:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r84887 r84889  
    4343        PageHardware,
    4444        PageDisk,
     45        PageInstallSetup,
    4546        PageMax
    4647    };
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicHardware.h

    r84886 r84889  
    2626
    2727/* Forward declarations: */
    28 class UIBaseMemorySlider;
    2928class UIBaseMemoryEditor;
    3029class UIVirtualCPUEditor;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicInstallSetup.cpp

    r84886 r84889  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardNewVMPageBasicHardware class implementation.
     3 * VBox Qt GUI - UIWizardNewVMPageBasicInstallSetup class implementation.
    44 */
    55
     
    2222#include <QSpacerItem>
    2323#include <QLabel>
     24#include <QLineEdit>
    2425#include <QSpinBox>
    2526
     
    3031#include "UICommon.h"
    3132#include "UIVirtualCPUEditor.h"
    32 #include "UIWizardNewVMPageBasicHardware.h"
     33#include "UIWizardNewVMPageBasicInstallSetup.h"
    3334#include "UIWizardNewVM.h"
    3435
    3536
    36 UIWizardNewVMPageHardware::UIWizardNewVMPageHardware()
    37     : m_pBaseMemoryEditor(0)
    38     , m_pVirtualCPUEditor(0)
     37UIUserNamePasswordEditor::UIUserNamePasswordEditor(QWidget *pParent /*  = 0 */)
     38    : QIWithRetranslateUI<QWidget>(pParent)
     39    , m_pUserNameField(0)
     40    , m_pPasswordField(0)
     41    , m_pPasswordRepeatField(0)
     42    , m_pUserNameFieldLabel(0)
     43    , m_pPasswordFieldLabel(0)
     44    , m_pPasswordRepeatFieldLabel(0)
     45{
     46    prepare();
     47}
     48
     49void UIUserNamePasswordEditor::retranslateUi()
     50{
     51    if (m_pUserNameFieldLabel)
     52    {
     53        m_pUserNameFieldLabel->setText(UIWizardNewVM::tr("User Name:"));
     54        m_pUserNameFieldLabel->setToolTip(UIWizardNewVM::tr("Type the user name which will be used in attended install:"));
     55
     56    }
     57    if (m_pPasswordFieldLabel)
     58    {
     59        m_pPasswordFieldLabel->setText(UIWizardNewVM::tr("Password:"));
     60        m_pPasswordFieldLabel->setToolTip(UIWizardNewVM::tr("Type the password for the user name"));
     61
     62    }
     63    if (m_pPasswordRepeatFieldLabel)
     64    {
     65        m_pPasswordRepeatFieldLabel->setText(UIWizardNewVM::tr("Repeat Password:"));
     66        m_pPasswordRepeatFieldLabel->setToolTip(UIWizardNewVM::tr("Retype the password:"));
     67    }
     68}
     69
     70void UIUserNamePasswordEditor::addField(QLabel *&pLabel, QLineEdit *&pLineEdit, QGridLayout *pLayout, bool fIsPasswordField /* = false */)
     71{
     72    static int iRow = 0;
     73    if (!pLayout || pLabel || pLineEdit)
     74        return;
     75    pLabel = new QLabel;
     76    if (!pLabel)
     77        return;
     78    pLayout->addWidget(pLabel, iRow, 0, 1, 1, Qt::AlignRight);
     79
     80    pLineEdit = new QLineEdit;
     81    if (!pLineEdit)
     82        return;
     83    pLayout->addWidget(pLineEdit, iRow, 1, 1, 1);
     84
     85    pLabel->setBuddy(pLineEdit);
     86    if (fIsPasswordField)
     87        pLineEdit->setEchoMode(QLineEdit::Password);
     88    ++iRow;
     89    return;
     90}
     91
     92void UIUserNamePasswordEditor::prepare()
     93{
     94    QGridLayout *pMainLayout = new QGridLayout;
     95    if (!pMainLayout)
     96        return;
     97    setLayout(pMainLayout);
     98
     99    addField(m_pUserNameFieldLabel, m_pUserNameField, pMainLayout);
     100    addField(m_pPasswordFieldLabel, m_pPasswordField, pMainLayout, true);
     101    addField(m_pPasswordRepeatFieldLabel, m_pPasswordRepeatField, pMainLayout, true);
     102    retranslateUi();
     103}
     104
     105UIWizardNewVMPageInstallSetup::UIWizardNewVMPageInstallSetup()
     106    : m_pUserNamePasswordEditor(0)
    39107{
    40108}
    41109
    42 int UIWizardNewVMPageHardware::baseMemory() const
    43 {
    44     if (!m_pBaseMemoryEditor)
    45         return 0;
    46     return m_pBaseMemoryEditor->value();
    47 }
    48 
    49 int UIWizardNewVMPageHardware::VCPUCount() const
    50 {
    51     if (!m_pVirtualCPUEditor)
    52         return 1;
    53     return m_pVirtualCPUEditor->value();
    54 }
    55 
    56 UIWizardNewVMPageBasicHardware::UIWizardNewVMPageBasicHardware()
     110UIWizardNewVMPageBasicInstallSetup::UIWizardNewVMPageBasicInstallSetup()
    57111    : m_pLabel(0)
    58112{
     
    63117        QGridLayout *pMemoryLayout = new QGridLayout;
    64118        {
    65             m_pBaseMemoryEditor = new UIBaseMemoryEditor(this, true);
    66             m_pVirtualCPUEditor = new UIVirtualCPUEditor(this, true);
    67             pMemoryLayout->addWidget(m_pBaseMemoryEditor, 0, 0, 1, 4);
    68             pMemoryLayout->addWidget(m_pVirtualCPUEditor, 1, 0, 1, 4);
     119            m_pUserNamePasswordEditor = new UIUserNamePasswordEditor;
     120            pMemoryLayout->addWidget(m_pUserNamePasswordEditor, 0, 0);
    69121        }
    70122        if (m_pLabel)
     
    80132}
    81133
    82 void UIWizardNewVMPageBasicHardware::retranslateUi()
     134void UIWizardNewVMPageBasicInstallSetup::retranslateUi()
    83135{
    84136    /* Translate page: */
    85     setTitle(UIWizardNewVM::tr("Virtual Machine Settings"));
     137    setTitle(UIWizardNewVM::tr("User Name/Password and Time Zone Selection"));
    86138
    87139    /* Translate widgets: */
    88140    if (m_pLabel)
    89         m_pLabel->setText(UIWizardNewVM::tr("<p>You can modify the virtual machine's hardware.</p>"));
     141        m_pLabel->setText(UIWizardNewVM::tr("<p>Here you can specify the user name/password and time zone. "
     142                                            "The values you enter here will be used during the unattended install.</p>"));
     143
    90144}
    91145
    92 void UIWizardNewVMPageBasicHardware::initializePage()
     146void UIWizardNewVMPageBasicInstallSetup::initializePage()
    93147{
    94148    /* Translate page: */
     
    96150
    97151    /* Get recommended 'ram' field value: */
    98     CGuestOSType type = field("type").value<CGuestOSType>();
    99     m_pBaseMemoryEditor->setValue(type.GetRecommendedRAM());
    100     m_pVirtualCPUEditor->setValue(1);
     152    // CGuestOSType type = field("type").value<CGuestOSType>();
     153    // m_pBaseMemoryEditor->setValue(type.GetRecommendedRAM());
     154    // m_pVirtualCPUEditor->setValue(1);
    101155
    102     /* 'Ram' field should have focus initially: */
    103     m_pBaseMemoryEditor->setFocus();
     156    // /* 'Ram' field should have focus initially: */
     157    // m_pBaseMemoryEditor->setFocus();
    104158}
    105159
    106 bool UIWizardNewVMPageBasicHardware::isComplete() const
     160bool UIWizardNewVMPageBasicInstallSetup::isComplete() const
    107161{
    108162    return UIWizardPage::isComplete();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicInstallSetup.h

    r84886 r84889  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardNewVMPageBasicHardware class declaration.
     3 * VBox Qt GUI - UIWizardNewVMPageBasicInstallSetup class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicHardware_h
    19 #define FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicHardware_h
     18#ifndef FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicInstallSetup_h
     19#define FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicInstallSetup_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
    2222#endif
    2323
     24/* Qt includes: */
     25#include <QWidget>
     26
    2427/* Local includes: */
     28#include "QIWithRetranslateUI.h"
    2529#include "UIWizardPage.h"
    2630
    2731/* Forward declarations: */
    28 class UIBaseMemorySlider;
    29 class UIBaseMemoryEditor;
    30 class UIVirtualCPUEditor;
     32class QGridLayout;
     33class QLabel;
     34class QLineEdit;
    3135class QSpinBox;
    32 class QLabel;
    3336class QIRichTextLabel;
    3437
     38class UIUserNamePasswordEditor : public QIWithRetranslateUI<QWidget>
     39{
     40
     41    Q_OBJECT;
     42
     43public:
     44
     45    UIUserNamePasswordEditor(QWidget *pParent = 0);
     46
     47protected:
     48
     49    void retranslateUi();
     50
     51private:
     52
     53    void prepare();
     54    void addField(QLabel *&pLabel, QLineEdit *&pLineEdit, QGridLayout *pLayout, bool fIsPasswordField = false);
     55
     56    QLineEdit *m_pUserNameField;
     57    QLineEdit *m_pPasswordField;
     58    QLineEdit *m_pPasswordRepeatField;
     59
     60    QLabel *m_pUserNameFieldLabel;
     61    QLabel *m_pPasswordFieldLabel;
     62    QLabel *m_pPasswordRepeatFieldLabel;
     63
     64};
     65
    3566/* 2nd page of the New Virtual Machine wizard (base part): */
    36 class UIWizardNewVMPageHardware : public UIWizardPageBase
     67class UIWizardNewVMPageInstallSetup : public UIWizardPageBase
    3768{
    3869protected:
    3970
    4071    /* Constructor: */
    41     UIWizardNewVMPageHardware();
     72    UIWizardNewVMPageInstallSetup();
    4273
    43     int baseMemory() const;
    44     int VCPUCount() const;
    4574
    4675    /* Widgets: */
    47     UIBaseMemoryEditor *m_pBaseMemoryEditor;
    48     UIVirtualCPUEditor *m_pVirtualCPUEditor;
     76    UIUserNamePasswordEditor *m_pUserNamePasswordEditor;
    4977};
    5078
    5179/* 2nd page of the New Virtual Machine wizard (basic extension): */
    52 class UIWizardNewVMPageBasicHardware : public UIWizardPage, public UIWizardNewVMPageHardware
     80class UIWizardNewVMPageBasicInstallSetup : public UIWizardPage, public UIWizardNewVMPageInstallSetup
    5381{
    5482    Q_OBJECT;
    55     Q_PROPERTY(int baseMemory READ baseMemory);
    56     Q_PROPERTY(int VCPUCount READ VCPUCount);
    5783
    5884public:
    5985
    6086    /* Constructor: */
    61     UIWizardNewVMPageBasicHardware();
     87    UIWizardNewVMPageBasicInstallSetup();
    6288
    6389private slots:
     
    78104};
    79105
    80 #endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicHardware_h */
     106#endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicInstallSetup_h */
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