VirtualBox

Ignore:
Timestamp:
Jul 12, 2011 1:25:38 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72801
Message:

FE/Qt4: add option to let the user decide if the MACs should be reinitialized

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm
Files:
3 edited

Legend:

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

    r37849 r37899  
    6969}
    7070
    71 bool UICloneVMWizard::createClone(const QString &strName, KCloneMode mode)
     71bool UICloneVMWizard::createClone(const QString &strName, KCloneMode mode, bool fReinitMACs)
    7272{
    7373    CVirtualBox vbox = vboxGlobal().virtualBox();
     
    8282    }
    8383
    84     /* NAT network adapters should keep there MAC address to prevent any
    85      * reactivation. For the other modes they should be regenerated to prevent
    86      * address conflicts in the network. */
     84    /* Add the keep all MACs option to the import settings when requested. */
    8785    QVector<KCloneOptions> options;
    88     options.append(KCloneOptions_KeepNATMACs);
     86    if (!fReinitMACs)
     87        options.append(KCloneOptions_KeepAllMACs);
    8988
    9089    /* Start cloning. */
     
    124123
    125124    registerField("cloneName", this, "cloneName");
     125    registerField("reinitMACs", this, "reinitMACs");
    126126
    127127    connect(m_pNameEditor, SIGNAL(textChanged(const QString &)), this, SLOT(sltNameEditorTextChanged(const QString &)));
     
    136136{
    137137    m_pNameEditor->setText(strName);
     138}
     139
     140bool UICloneVMWizardPage1::isReinitMACsChecked() const
     141{
     142    return mReinitMACsCheckBox->isChecked();
    138143}
    139144
     
    172177        startProcessing();
    173178        /* Try to create the clone: */
    174         bool fResult = static_cast<UICloneVMWizard*>(wizard())->createClone(cloneName(), KCloneMode_MachineState);
     179        bool fResult = static_cast<UICloneVMWizard*>(wizard())->createClone(cloneName(), KCloneMode_MachineState, isReinitMACsChecked());
    175180        /* Finish performing long-time operation: */
    176181        endProcessing();
     
    234239    /* Try to create the clone: */
    235240    QString strName = field("cloneName").toString();
    236     bool fResult = static_cast<UICloneVMWizard*>(wizard())->createClone(strName, cloneMode());
     241    bool fReinitMACs = field("reinitMACs").toBool();
     242    bool fResult = static_cast<UICloneVMWizard*>(wizard())->createClone(strName, cloneMode(), fReinitMACs);
    237243    /* Finish performing long-time operation: */
    238244    endProcessing();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UICloneVMWizard.h

    r37468 r37899  
    3838    UICloneVMWizard(QWidget *pParent, CMachine machine, bool fShowChildsOption = true);
    3939
    40     bool createClone(const QString &strName, KCloneMode mode);
     40    bool createClone(const QString &strName, KCloneMode mode, bool fReinitMACs);
    4141
    4242private:
     
    7171    Q_OBJECT;
    7272    Q_PROPERTY(QString cloneName READ cloneName WRITE setCloneName);
     73    Q_PROPERTY(bool reinitMACs READ isReinitMACsChecked);
    7374
    7475public:
     
    7980    QString cloneName() const;
    8081    void setCloneName(const QString &strName);
     82
     83    bool isReinitMACsChecked() const;
    8184
    8285protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UICloneVMWizardPage1.ui

    r37468 r37899  
    5555   </item>
    5656   <item>
     57    <widget class="QCheckBox" name="mReinitMACsCheckBox">
     58     <property name="toolTip">
     59      <string>When checked a new unique MAC address will assigned to all configured network cards.</string>
     60     </property>
     61     <property name="text">
     62      <string>&amp;Reinitialize the MAC address of all network cards</string>
     63     </property>
     64    </widget>
     65   </item>
     66   <item>
    5767    <spacer name="verticalSpacer">
    5868     <property name="orientation">
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette