VirtualBox

Ignore:
Timestamp:
Dec 19, 2016 3:16:10 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6769: Back out changes which extracted a custom VM directory out of the VM name (changing behavior, effectively banning VM names like "OS/2")

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r63567 r64965  
    106106        if (!m_strGroup.isEmpty())
    107107            groups << m_strGroup;
    108         m_machine = vbox.CreateMachine(field("machineFilePath").toString(),
    109                                        field("machineBaseName").toString(),
     108        m_machine = vbox.CreateMachine(QString() /* no file-path for now */,
     109                                       field("name").toString(),
    110110                                       groups, strTypeId, QString());
    111111        if (!vbox.isOk())
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r64656 r64965  
    3131# include "UIMessageCenter.h"
    3232# include "UINameAndSystemEditor.h"
    33 # include "UIFilePathSelector.h"
    3433# include "QIRichTextLabel.h"
    3534
     
    205204}
    206205
    207 void UIWizardNewVMPage1::adjustToolTip(const QString &strNewName /* = QString() */)
    208 {
    209     /* Compose tool-tip: */
    210     QString strToolTip;
    211     /* If name is empty: */
    212     if (strNewName.isEmpty())
    213     {
    214         /* We are just reseting the tool-tip to default: */
    215         strToolTip = UIWizardNewVM::tr("<p><nobr>Holds the name or full path to the virtual "
    216                                        "machine folder you are about to create.</nobr></p>");
    217     }
    218     /* If name is NOT empty: */
    219     else
    220     {
    221         /* Compose the machine file-path, acquire the machine folder from it: */
    222         const QString strMachineFilePath = composeMachineFilePath(strNewName);
    223         const QString strMachineFolder = QDir::toNativeSeparators(QFileInfo(strMachineFilePath).absolutePath());
    224         /* And compose the location-editor tool-tip accordingly: */
    225         strToolTip = UIWizardNewVM::tr("<p><nobr>You are about to create the virtual machine in the "
    226                                        "following folder:</nobr><br><nobr><b>%1</b></nobr></p>")
    227                                        .arg(strMachineFolder);
    228     }
    229     /* Assign tool-tip: */
    230     m_pNameAndSystemEditor->locationEditor()->setToolTip(strToolTip);
    231 }
    232 
    233206bool UIWizardNewVMPage1::machineFolderCreated()
    234207{
     
    245218    }
    246219
    247     /* Compose machine file-path, parse it to folder and base-name: */
    248     const QString strMachineFilePath = composeMachineFilePath(m_pNameAndSystemEditor->name());
    249     const QString strMachineFolder = QDir::toNativeSeparators(QFileInfo(strMachineFilePath).absolutePath());
    250     const QString strMachineBaseName = QFileInfo(strMachineFilePath).completeBaseName();
     220    /* Get VBox: */
     221    CVirtualBox vbox = vboxGlobal().virtualBox();
     222    /* Get default machine folder: */
     223    const QString strDefaultMachineFolder = vbox.GetSystemProperties().GetDefaultMachineFolder();
     224    /* Compose machine filename: */
     225    const QString strMachineFilePath = vbox.ComposeMachineFilename(m_pNameAndSystemEditor->name(),
     226                                                                   m_strGroup,
     227                                                                   QString(),
     228                                                                   strDefaultMachineFolder);
     229    /* Compose machine folder/basename: */
     230    const QFileInfo fileInfo(strMachineFilePath);
     231    const QString strMachineFolder = fileInfo.absolutePath();
     232    const QString strMachineBaseName = fileInfo.completeBaseName();
    251233
    252234    /* Make sure that folder doesn't exists: */
     
    268250    m_strMachineFolder = strMachineFolder;
    269251    m_strMachineBaseName = strMachineBaseName;
    270     m_strMachineFilePath = strMachineFilePath;
    271252    return true;
    272253}
     
    286267}
    287268
    288 QString UIWizardNewVMPage1::composeMachineFilePath(const QString &strUserMachineLocation)
    289 {
    290     /* Get VBox: */
    291     CVirtualBox vbox = vboxGlobal().virtualBox();
    292     /* Get default machine folder: */
    293     const QString strDefaultMachineFolder = vbox.GetSystemProperties().GetDefaultMachineFolder();
    294     /* Fetch user's machine location: */
    295     const QString strUserMachineFolder = QFileInfo(strUserMachineLocation).absolutePath();
    296     const QString strUserMachineBaseName = QFileInfo(strUserMachineLocation).fileName();
    297     const bool fUseDefaultPath = strUserMachineLocation == strUserMachineBaseName;
    298     /* Compose machine filename: */
    299     return vbox.ComposeMachineFilename(strUserMachineBaseName,
    300                                        fUseDefaultPath ? m_strGroup : QString() /* no group in that case */,
    301                                        QString(),
    302                                        fUseDefaultPath ? strDefaultMachineFolder : strUserMachineFolder);
    303 }
    304 
    305269UIWizardNewVMPageBasic1::UIWizardNewVMPageBasic1(const QString &strGroup)
    306270    : UIWizardNewVMPage1(strGroup)
     
    310274    {
    311275        m_pLabel = new QIRichTextLabel(this);
    312         m_pNameAndSystemEditor = new UINameAndSystemEditor(this, true);
     276        m_pNameAndSystemEditor = new UINameAndSystemEditor(this);
    313277        pMainLayout->addWidget(m_pLabel);
    314278        pMainLayout->addWidget(m_pNameAndSystemEditor);
     
    318282    /* Setup connections: */
    319283    connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString &)), this, SLOT(sltNameChanged(const QString &)));
    320     connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString &)), this, SLOT(sltAdjustToolTip(const QString &)));
    321284    connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(sltOsTypeChanged()));
    322285
     
    326289    registerField("machineFolder", this, "machineFolder");
    327290    registerField("machineBaseName", this, "machineBaseName");
    328     registerField("machineFilePath", this, "machineFilePath");
    329 
    330     /* Initialize tool-tip: */
    331     adjustToolTip();
    332291}
    333292
     
    336295    /* Call to base-class: */
    337296    onNameChanged(strNewName);
    338 }
    339 
    340 void UIWizardNewVMPageBasic1::sltAdjustToolTip(const QString &strNewName)
    341 {
    342     /* Call to base-class: */
    343     adjustToolTip(strNewName);
    344297}
    345298
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r62493 r64965  
    3838    void onOsTypeChanged();
    3939
    40     /** Adjusts tool-tip according to @a strNewName. */
    41     void adjustToolTip(const QString &strNewName = QString());
    42 
    4340    /* Helping stuff: */
    4441    bool machineFolderCreated();
    4542    bool createMachineFolder();
    4643    bool cleanupMachineFolder();
    47 
    48     /** Composes and returns machine file-path on the basis of passed @a strUserMachineLocation. */
    49     QString composeMachineFilePath(const QString &strUserMachineLocation);
    5044
    5145    /** Returns the machine folder value. */
     
    5953    void setMachineBaseName(const QString &strMachineBaseName) { m_strMachineBaseName = strMachineBaseName; }
    6054
    61     /** Returns the machine file-path value. */
    62     QString machineFilePath() const { return m_strMachineFilePath; }
    63     /** Defines the @a strMachineFilePath value. */
    64     void setMachineFilePath(const QString &strMachineFilePath) { m_strMachineFilePath = strMachineFilePath; }
    65 
    6655    /** Holds the machine folder value. */
    6756    QString m_strMachineFolder;
    6857    /** Holds the machine base-name value. */
    6958    QString m_strMachineBaseName;
    70     /** Holds the machine file-path value. */
    71     QString m_strMachineFilePath;
    7259
    7360    /* Widgets: */
     
    8673    Q_PROPERTY(QString machineFolder READ machineFolder WRITE setMachineFolder);
    8774    Q_PROPERTY(QString machineBaseName READ machineBaseName WRITE setMachineBaseName);
    88     Q_PROPERTY(QString machineFilePath READ machineFilePath WRITE setMachineFilePath);
    8975
    9076public:
     
    10389    void sltNameChanged(const QString &strNewText);
    10490    void sltOsTypeChanged();
    105 
    106     /** Adjusts tool-tip according to @a strNewName. */
    107     void sltAdjustToolTip(const QString &strNewName);
    10891
    10992private:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r62493 r64965  
    5757            QHBoxLayout *pNameAndSystemCntLayout = new QHBoxLayout(m_pNameAndSystemCnt);
    5858            {
    59                 m_pNameAndSystemEditor = new UINameAndSystemEditor(m_pNameAndSystemCnt, true);
     59                m_pNameAndSystemEditor = new UINameAndSystemEditor(m_pNameAndSystemCnt);
    6060                pNameAndSystemCntLayout->addWidget(m_pNameAndSystemEditor);
    6161            }
     
    139139    /* Setup connections: */
    140140    connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString &)), this, SLOT(sltNameChanged(const QString &)));
    141     connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString &)), this, SLOT(sltAdjustToolTip(const QString &)));
    142141    connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(sltOsTypeChanged()));
    143142    connect(m_pRamSlider, SIGNAL(valueChanged(int)), this, SLOT(sltRamSliderValueChanged()));
     
    156155    registerField("machineFolder", this, "machineFolder");
    157156    registerField("machineBaseName", this, "machineBaseName");
    158     registerField("machineFilePath", this, "machineFilePath");
    159157    registerField("ram", m_pRamSlider, "value", SIGNAL(valueChanged(int)));
    160158    registerField("virtualDisk", this, "virtualDisk");
    161159    registerField("virtualDiskId", this, "virtualDiskId");
    162160    registerField("virtualDiskLocation", this, "virtualDiskLocation");
    163 
    164     /* Initialize tool-tip: */
    165     adjustToolTip();
    166161}
    167162
     
    178173    /* Broadcast complete-change: */
    179174    emit completeChanged();
    180 }
    181 
    182 void UIWizardNewVMPageExpert::sltAdjustToolTip(const QString &strNewName)
    183 {
    184     /* Call to base-class: */
    185     adjustToolTip(strNewName);
    186175}
    187176
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r62493 r64965  
    3636    Q_PROPERTY(QString machineFolder READ machineFolder WRITE setMachineFolder);
    3737    Q_PROPERTY(QString machineBaseName READ machineBaseName WRITE setMachineBaseName);
    38     Q_PROPERTY(QString machineFilePath READ machineFilePath WRITE setMachineFilePath);
    3938    Q_PROPERTY(CMedium virtualDisk READ virtualDisk WRITE setVirtualDisk);
    4039    Q_PROPERTY(QString virtualDiskId READ virtualDiskId WRITE setVirtualDiskId);
     
    6564    void sltGetWithFileOpenDialog();
    6665
    67     /** Adjusts tool-tip according to @a strNewName. */
    68     void sltAdjustToolTip(const QString &strNewName);
    69 
    7066private:
    7167
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