VirtualBox

Changeset 90696 in vbox


Ignore:
Timestamp:
Aug 16, 2021 1:30:36 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996. Working on the expert mode of the clone vm wizard.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp

    r90674 r90696  
    5959bool UIWizardCloneVM::isCloneModePageVisible() const
    6060{
     61    /* If we did not create the clone mode page return false: */
    6162    if (m_iCloneModePageIndex == -1)
    6263        return false;
     
    252253    {
    253254        case WizardMode_Basic:
    254         case WizardMode_Expert:
    255255        {
    256256            addPage(new UIWizardCloneVMPageBasic1(m_strCloneName, strDefaultMachineFolder, m_strGroup));
     
    260260            break;
    261261        }
    262 
    263         {
    264     //         setPage(PageExpert, new UIWizardCloneVMPageExpert(m_machine.GetName(),
    265     //                                                           strDefaultMachineFolder,
    266     //                                                           m_snapshot.isNull(),
    267     //                                                           m_snapshot.isNull() ? false : m_snapshot.GetChildrenCount() > 0,
    268     //                                                           m_strGroup));
     262        case WizardMode_Expert:
     263        {
     264            addPage(new UIWizardCloneVMPageExpert(m_machine.GetName(),
     265                                                  strDefaultMachineFolder,
     266                                                  m_snapshot.isNull(),
     267                                                  m_snapshot.isNull() ? false : m_snapshot.GetChildrenCount() > 0,
     268                                                  m_strGroup));
    269269            break;
    270270        }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp

    r90669 r90696  
    107107    {
    108108        m_pNamePathEditor->setFlat(true);
     109        m_pNamePathEditor->setLayoutContentsMargins(0, 0, 0, 0);
    109110        pMainLayout->addWidget(m_pNamePathEditor);
    110111        connect(m_pNamePathEditor, &UICloneVMNamePathEditor::sigCloneNameChanged,
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp

    r90607 r90696  
    3535
    3636
    37 UIWizardCloneVMPageExpert::UIWizardCloneVMPageExpert(const QString &/*strOriginalName*/, const QString &/*strDefaultPath*/,
     37UIWizardCloneVMPageExpert::UIWizardCloneVMPageExpert(const QString &strOriginalName, const QString &strDefaultPath,
    3838                                                     bool /*fAdditionalInfo*/, bool fShowChildsOption, const QString &/*strGroup*/)
    39     : m_fShowChildsOption(fShowChildsOption)
     39    : m_pMainLayout(0)
     40    , m_pNamePathGroupBox(0)
     41    , m_pCloneTypeGroupBox(0)
     42    , m_pCloneModeGroupBox(0)
     43    , m_pAdditionalOptionsroupBox(0)
    4044{
    41     /* Create widgets: */
    42     // QGridLayout *pMainLayout = new QGridLayout(this);
    43     // {
    44     //     m_pNameCnt = new QGroupBox(this);
    45     //     {
    46     //         QGridLayout *pNameCntLayout = new QGridLayout(m_pNameCnt);
    47     //         {
    48     //             //pNameCntLayout->setContentsMargins(0, 0, 0, 0);
    49     //             m_pNameLabel = new QLabel;
    50     //             if (m_pNameLabel)
    51     //             {
    52     //                 m_pNameLabel->setAlignment(Qt::AlignRight);
    53     //                 m_pNameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    54     //                 pNameCntLayout->addWidget(m_pNameLabel, 0, 0, 1, 1);
    55 
    56     //             }
    57     //             m_pNameLineEdit = new QILineEdit(m_pNameCnt);
    58     //             if (m_pNameLineEdit)
    59     //             {
    60     //                 m_pNameLineEdit->setText(UIWizardCloneVM::tr("%1 Clone").arg(m_strOriginalName));
    61     //                 pNameCntLayout->addWidget(m_pNameLineEdit, 0, 1, 1, 1);
    62     //             }
    63 
    64     //             m_pPathLabel = new QLabel(this);
    65     //             if (m_pPathLabel)
    66     //             {
    67     //                 m_pPathLabel->setAlignment(Qt::AlignRight);
    68     //                 m_pPathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    69     //                 pNameCntLayout->addWidget(m_pPathLabel, 1, 0, 1, 1);
    70     //             }
    71 
    72     //             m_pPathSelector = new UIFilePathSelector(this);
    73     //             if (m_pPathSelector)
    74     //             {
    75     //                 pNameCntLayout->addWidget(m_pPathSelector, 1, 1, 1, 1);
    76     //                 m_pPathSelector->setPath(m_strDefaultPath);
    77     //             }
    78     //         }
    79     //     }
    80     //     /* Prepare clone-type options container: */
    81     //     m_pCloneTypeCnt = new QGroupBox(this);
    82     //     if (m_pCloneTypeCnt)
    83     //     {
    84     //         /* Prepare clone-type options button-group: */
    85     //         m_pButtonGroup = new QButtonGroup(m_pCloneTypeCnt);
    86     //         if (m_pButtonGroup)
    87     //         {
    88     //             /* Prepare clone-type options layout: */
    89     //             QVBoxLayout *pCloneTypeCntLayout = new QVBoxLayout(m_pCloneTypeCnt);
    90     //             {
    91     //                 /* Prepare full clone option radio-button: */
    92     //                 m_pFullCloneRadio = new QRadioButton(m_pCloneTypeCnt);
    93     //                 if (m_pFullCloneRadio)
    94     //                 {
    95     //                     m_pFullCloneRadio->setChecked(true);
    96     //                     m_pButtonGroup->addButton(m_pFullCloneRadio);
    97     //                     pCloneTypeCntLayout->addWidget(m_pFullCloneRadio);
    98     //                 }
    99 
    100     //                 /* Load currently supported clone options: */
    101     //                 CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
    102     //                 const QVector<KCloneOptions> supportedOptions = comProperties.GetSupportedCloneOptions();
    103     //                 /* Check whether we support linked clone option at all: */
    104     //                 const bool fSupportedLinkedClone = supportedOptions.contains(KCloneOptions_Link);
    105 
    106     //                 /* Prepare linked clone option radio-button: */
    107     //                 if (fSupportedLinkedClone)
    108     //                 {
    109     //                     m_pLinkedCloneRadio = new QRadioButton(m_pCloneTypeCnt);
    110     //                     if (m_pLinkedCloneRadio)
    111     //                     {
    112     //                         m_pButtonGroup->addButton(m_pLinkedCloneRadio);
    113     //                         pCloneTypeCntLayout->addWidget(m_pLinkedCloneRadio);
    114     //                     }
    115     //                 }
    116     //             }
    117     //         }
    118     //     }
    119     //     m_pCloneModeCnt = new QGroupBox(this);
    120     //     {
    121     //         QVBoxLayout *pCloneModeCntLayout = new QVBoxLayout(m_pCloneModeCnt);
    122     //         {
    123     //             m_pMachineRadio = new QRadioButton(m_pCloneModeCnt);
    124     //             {
    125     //                 m_pMachineRadio->setChecked(true);
    126     //             }
    127     //             m_pMachineAndChildsRadio = new QRadioButton(m_pCloneModeCnt);
    128     //             {
    129     //                 if (!m_fShowChildsOption)
    130     //                    m_pMachineAndChildsRadio->hide();
    131     //             }
    132     //             m_pAllRadio = new QRadioButton(m_pCloneModeCnt);
    133     //             pCloneModeCntLayout->addWidget(m_pMachineRadio);
    134     //             pCloneModeCntLayout->addWidget(m_pMachineAndChildsRadio);
    135     //             pCloneModeCntLayout->addWidget(m_pAllRadio);
    136     //         }
    137     //     }
    138     //     m_pCloneOptionsCnt = new QGroupBox(this);
    139     //     if (m_pCloneOptionsCnt)
    140     //     {
    141     //         m_pCloneOptionsLayout = new QGridLayout(m_pCloneOptionsCnt);
    142     //         /* Create MAC policy combo-box: */
    143     //         m_pMACComboBox = new QComboBox;
    144     //         if (m_pMACComboBox)
    145     //         {
    146     //             /* Add into layout: */
    147     //             m_pCloneOptionsLayout->addWidget(m_pMACComboBox, 0, 1, 1, 1);
    148     //         }
    149 
    150     //         /* Create format combo-box label: */
    151     //         m_pMACComboBoxLabel = new QLabel;
    152     //         if (m_pMACComboBoxLabel)
    153     //         {
    154     //             m_pMACComboBoxLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
    155     //             m_pMACComboBoxLabel->setBuddy(m_pMACComboBox);
    156     //             /* Add into layout: */
    157     //             m_pCloneOptionsLayout->addWidget(m_pMACComboBoxLabel, 0, 0, 1, 1);
    158     //         }
    159 
    160     //         /* Load currently supported clone options: */
    161     //         CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
    162     //         const QVector<KCloneOptions> supportedOptions = comProperties.GetSupportedCloneOptions();
    163     //         /* Check whether we support additional clone options at all: */
    164     //         int iVerticalPosition = 3;
    165     //         const bool fSupportedKeepDiskNames = supportedOptions.contains(KCloneOptions_KeepDiskNames);
    166     //         const bool fSupportedKeepHWUUIDs = supportedOptions.contains(KCloneOptions_KeepHwUUIDs);
    167     //         if (fSupportedKeepDiskNames)
    168     //         {
    169     //             m_pKeepDiskNamesCheckBox = new QCheckBox;
    170     //             if (m_pKeepDiskNamesCheckBox)
    171     //                 m_pCloneOptionsLayout->addWidget(m_pKeepDiskNamesCheckBox, iVerticalPosition++, 1, 1, 1);
    172     //         }
    173     //         if (fSupportedKeepHWUUIDs)
    174     //         {
    175     //             m_pKeepHWUUIDsCheckBox = new QCheckBox;
    176     //             if (m_pKeepHWUUIDsCheckBox)
    177     //                 m_pCloneOptionsLayout->addWidget(m_pKeepHWUUIDsCheckBox, iVerticalPosition++, 1, 1, 1);
    178     //         }
    179     //     }
    180 
    181     //     pMainLayout->addWidget(m_pNameCnt, 0, 0, 1, 2);
    182     //     pMainLayout->addWidget(m_pCloneTypeCnt, 1, 0, Qt::AlignTop);
    183     //     pMainLayout->addWidget(m_pCloneModeCnt, 1, 1, Qt::AlignTop);
    184     //     pMainLayout->addWidget(m_pCloneOptionsCnt, 2, 0, 1, 2, Qt::AlignTop);
    185     //     pMainLayout->setRowStretch(3, 1);
    186     // }
    187 
    188     // /* Setup connections: */
    189     // connect(m_pNameLineEdit, &QILineEdit::textChanged,
    190     //         this, &UIWizardCloneVMPageExpert::completeChanged);
    191     // connect(m_pPathSelector, &UIFilePathSelector::pathChanged,
    192     //         this, &UIWizardCloneVMPageExpert::completeChanged);
    193     // connect(m_pNameLineEdit, &QILineEdit::textChanged,
    194     //         this, &UIWizardCloneVMPageExpert::sltNameChanged);
    195     // connect(m_pPathSelector, &UIFilePathSelector::pathChanged,
    196     //         this, &UIWizardCloneVMPageExpert::sltPathChanged);
    197     // connect(m_pButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*, bool)>(&QButtonGroup::buttonToggled),
    198     //         this, &UIWizardCloneVMPageExpert::sltButtonToggled);
    199 
    200     // /* Register classes: */
    201     // qRegisterMetaType<KCloneMode>();
    202 
    203     // /* Populate MAC address policies: */
    204     // populateMACAddressClonePolicies();
    205 
    206     /* Register fields: */
    207     // registerField("cloneName", this, "cloneName");
    208     // registerField("cloneFilePath", this, "cloneFilePath");
    209     // registerField("linkedClone", this, "linkedClone");
    210     // registerField("cloneMode", this, "cloneMode");
    211     // registerField("macAddressClonePolicy", this, "macAddressClonePolicy");
    212     // registerField("keepDiskNames", this, "keepDiskNames");
    213     // registerField("keepHWUUIDs", this, "keepHWUUIDs");
    214 
    215     //composeCloneFilePath();
     45    prepare(strOriginalName, strDefaultPath, fShowChildsOption);
    21646}
    21747
    218 //void UIWizardCloneVMPageExpert::sltButtonToggled(QAbstractButton */*pButton*/, bool /*fChecked*/)
    219 //{
    220     // if (m_pLinkedCloneRadio && pButton == m_pLinkedCloneRadio && fChecked)
    221     // {
    222     //     m_pCloneModeCnt->setEnabled(false);
    223     //     m_pMachineRadio->setChecked(true);
    224     // }
    225     // else
    226     // {
    227     //     m_pCloneModeCnt->setEnabled(true);
    228     // }
    229 //}
     48void UIWizardCloneVMPageExpert::prepare(const QString &strOriginalName, const QString &strDefaultPath, bool fShowChildsOption)
     49{
     50    m_pMainLayout = new QGridLayout(this);
     51    AssertReturnVoid(m_pMainLayout);
     52    m_pNamePathGroupBox = new UICloneVMNamePathEditor(strOriginalName, strDefaultPath);
     53    if (m_pNamePathGroupBox)
     54        m_pMainLayout->addWidget(m_pNamePathGroupBox, 0, 0, 3, 2);
     55
     56    m_pCloneTypeGroupBox = new UICloneVMCloneTypeGroupBox;
     57    if (m_pCloneTypeGroupBox)
     58        m_pMainLayout->addWidget(m_pCloneTypeGroupBox, 3, 0, 2, 1);
     59
     60    m_pCloneModeGroupBox = new UICloneVMCloneModeGroupBox(fShowChildsOption);
     61    if (m_pCloneModeGroupBox)
     62        m_pMainLayout->addWidget(m_pCloneModeGroupBox, 3, 1, 2, 1);
     63
     64    m_pAdditionalOptionsroupBox = new UICloneVMAdditionalOptionsEditor;
     65    if (m_pAdditionalOptionsroupBox)
     66        m_pMainLayout->addWidget(m_pAdditionalOptionsroupBox, 5, 0, 2, 2);
     67    retranslateUi();
     68}
    23069
    23170void UIWizardCloneVMPageExpert::retranslateUi()
    23271{
    233     // /* Translate widgets: */
    234     // m_pNameCnt->setTitle(UIWizardCloneVM::tr("New machine &name and path"));
    235     // m_pCloneTypeCnt->setTitle(UIWizardCloneVM::tr("Clone type"));
    236     // m_pFullCloneRadio->setText(UIWizardCloneVM::tr("&Full Clone"));
    237     // if (m_pLinkedCloneRadio)
    238     //     m_pLinkedCloneRadio->setText(UIWizardCloneVM::tr("&Linked Clone"));
    239     // m_pCloneModeCnt->setTitle(UIWizardCloneVM::tr("Snapshots"));
    240     // m_pMachineRadio->setText(UIWizardCloneVM::tr("Current &machine state"));
    241     // m_pMachineAndChildsRadio->setText(UIWizardCloneVM::tr("Current &snapshot tree branch"));
    242     // m_pAllRadio->setText(UIWizardCloneVM::tr("&Everything"));
    243     // m_pNameLabel->setText(UIWizardCloneVM::tr("Name:"));
    244     // m_pPathLabel->setText(UIWizardCloneVM::tr("Path:"));
    245     // m_pCloneOptionsCnt->setTitle(UIWizardCloneVM::tr("Additional options"));
    246 
    247     // /* Translate MAC address policy combo-box: */
    248     // m_pMACComboBoxLabel->setText(UIWizardCloneVM::tr("MAC Address &Policy:"));
    249     // for (int i = 0; i < m_pMACComboBox->count(); ++i)
    250     // {
    251     //     const MACAddressClonePolicy enmPolicy = m_pMACComboBox->itemData(i).value<MACAddressClonePolicy>();
    252     //     switch (enmPolicy)
    253     //     {
    254     //         case MACAddressClonePolicy_KeepAllMACs:
    255     //         {
    256     //             m_pMACComboBox->setItemText(i, UIWizardCloneVM::tr("Include all network adapter MAC addresses"));
    257     //             m_pMACComboBox->setItemData(i, UIWizardCloneVM::tr("Include all network adapter MAC addresses during cloning."), Qt::ToolTipRole);
    258     //             break;
    259     //         }
    260     //         case MACAddressClonePolicy_KeepNATMACs:
    261     //         {
    262     //             m_pMACComboBox->setItemText(i, UIWizardCloneVM::tr("Include only NAT network adapter MAC addresses"));
    263     //             m_pMACComboBox->setItemData(i, UIWizardCloneVM::tr("Include only NAT network adapter MAC addresses during cloning."), Qt::ToolTipRole);
    264     //             break;
    265     //         }
    266     //         case MACAddressClonePolicy_StripAllMACs:
    267     //         {
    268     //             m_pMACComboBox->setItemText(i, UIWizardCloneVM::tr("Generate new MAC addresses for all network adapters"));
    269     //             m_pMACComboBox->setItemData(i, UIWizardCloneVM::tr("Generate new MAC addresses for all network adapters during cloning."), Qt::ToolTipRole);
    270     //             break;
    271     //         }
    272     //         default:
    273     //             break;
    274     //     }
    275     // }
    276 
    277     // if (m_pKeepDiskNamesCheckBox)
    278     // {
    279     //     m_pKeepDiskNamesCheckBox->setToolTip(UIWizardCloneVM::tr("Don't change the disk names during cloning."));
    280     //     m_pKeepDiskNamesCheckBox->setText(UIWizardCloneVM::tr("Keep &Disk Names"));
    281     // }
    282     // if (m_pKeepHWUUIDsCheckBox)
    283     // {
    284     //     m_pKeepHWUUIDsCheckBox->setToolTip(UIWizardCloneVM::tr("Don't change hardware UUIDs during cloning."));
    285     //     m_pKeepHWUUIDsCheckBox->setText(UIWizardCloneVM::tr("Keep &Hardware UUIDs"));
    286     // }
     72    /* Translate widgets: */
     73    if (m_pNamePathGroupBox)
     74        m_pNamePathGroupBox->setTitle(UIWizardCloneVM::tr("New machine &name and path"));
     75    if (m_pCloneTypeGroupBox)
     76        m_pCloneTypeGroupBox->setTitle(UIWizardCloneVM::tr("Clone type"));
     77    if (m_pCloneModeGroupBox)
     78        m_pCloneModeGroupBox->setTitle(UIWizardCloneVM::tr("Snapshots"));
     79    if (m_pAdditionalOptionsroupBox)
     80        m_pAdditionalOptionsroupBox->setTitle(UIWizardCloneVM::tr("Additional options"));
    28781}
    28882
    28983void UIWizardCloneVMPageExpert::initializePage()
    29084{
    291     /* Translate page: */
    29285    retranslateUi();
    29386}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.h

    r90607 r90696  
    2828class QGroupBox;
    2929class QGridLayout;
     30class UICloneVMAdditionalOptionsEditor;
     31class UICloneVMCloneModeGroupBox;
     32class UICloneVMCloneTypeGroupBox;
     33class UICloneVMNamePathEditor;
     34
    3035
    3136/* Expert page of the Clone Virtual Machine wizard: */
     
    6166    /* Prepare stuff: */
    6267    void initializePage();
     68    void prepare(const QString &strOriginalName, const QString &strDefaultPath, bool fShowChildsOption);
    6369
    6470    /* Validation stuff: */
     
    6672    bool validatePage();
    6773
    68     /* Widgets: */
    69     QGroupBox   *m_pNameCnt;
    70     QGroupBox   *m_pCloneTypeCnt;
    71     QGroupBox   *m_pCloneModeCnt;
    72     QGroupBox   *m_pCloneOptionsCnt;
    73     QGridLayout *m_pCloneOptionsLayout;
    74 
    75     bool m_fShowChildsOption;
     74    QGridLayout *m_pMainLayout;
     75    UICloneVMNamePathEditor *m_pNamePathGroupBox;
     76    UICloneVMCloneTypeGroupBox *m_pCloneTypeGroupBox;
     77    UICloneVMCloneModeGroupBox *m_pCloneModeGroupBox;
     78    UICloneVMAdditionalOptionsEditor *m_pAdditionalOptionsroupBox;
    7679};
    7780
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardCloneVMEditors.cpp

    r90669 r90696  
    108108}
    109109
     110void UICloneVMNamePathEditor::setLayoutContentsMargins(int iLeft, int iTop, int iRight, int iBottom)
     111{
     112    if (m_pContainerLayout)
     113        m_pContainerLayout->setContentsMargins(iLeft, iTop, iRight, iBottom);
     114}
     115
    110116void UICloneVMNamePathEditor::prepare()
    111117{
    112118    m_pContainerLayout = new QGridLayout(this);
    113     m_pContainerLayout->setContentsMargins(0, 0, 0, 0);
     119
    114120
    115121    m_pNameLabel = new QLabel;
     
    177183}
    178184
     185void UICloneVMAdditionalOptionsEditor::setLayoutContentsMargins(int iLeft, int iTop, int iRight, int iBottom)
     186{
     187    if (m_pContainerLayout)
     188        m_pContainerLayout->setContentsMargins(iLeft, iTop, iRight, iBottom);
     189}
     190
    179191void UICloneVMAdditionalOptionsEditor::setFirstColumnWidth(int iWidth)
    180192{
     
    222234{
    223235    m_pContainerLayout = new QGridLayout(this);
    224     m_pContainerLayout->setContentsMargins(0, 0, 0, 0);
    225236
    226237    m_pMACComboBoxLabel = new QLabel;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardCloneVMEditors.h

    r90669 r90696  
    2323
    2424/* Qt includes: */
    25 // #include <QIcon>
    2625#include <QGroupBox>
    2726
     
    3433
    3534/* Forward declarations: */
    36 // class CMediumFormat;
    3735class QAbstractButton;
    3836class QButtonGroup;
     
    4240class QLabel;
    4341class QRadioButton;
    44 // class QVBoxLayout;
    45 // class QIRichTextLabel;
    4642class QILineEdit;
    47 // class QIToolButton;
    4843class UIFilePathSelector;
    49 // class UIHostnameDomainNameEditor;
    50 // class UIPasswordLineEdit;
    51 // class UIUserNamePasswordEditor;
    52 // class UIMediumSizeEditor;
    53 
    54 /* Other VBox includes: */
    55 // #include "COMEnums.h"
    56 // #include "CMediumFormat.h"
    5744
    5845/** MAC address policies. */
     
    8269    int firstColumnWidth() const;
    8370
     71    void setLayoutContentsMargins(int iLeft, int iTop, int iRight, int iBottom);
     72
    8473    QString cloneName() const;
    8574    void setCloneName(const QString &strName);
     
    8978
    9079    bool isComplete();
    91 
    9280
    9381private:
     
    122110
    123111    bool isComplete();
     112
     113    void setLayoutContentsMargins(int iLeft, int iTop, int iRight, int iBottom);
    124114
    125115    MACAddressClonePolicy macAddressClonePolicy() const;
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