VirtualBox

Changeset 60834 in vbox for trunk/src


Ignore:
Timestamp:
May 4, 2016 2:39:00 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: ​​​​​​​​​bugref:6769: Rework/cleanup for VM properties editor (part 07): Allow to edit VM location under given condition.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp

    r60832 r60834  
    2929/* GUI includes: */
    3030# include "UINameAndSystemEditor.h"
     31# include "UIFilePathSelector.h"
     32
     33/* COM includes: */
     34# include "CSystemProperties.h"
    3135
    3236#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    3943
    4044
    41 UINameAndSystemEditor::UINameAndSystemEditor(QWidget *pParent)
     45UINameAndSystemEditor::UINameAndSystemEditor(QWidget *pParent, bool fChooseLocation /* = false */)
    4246    : QIWithRetranslateUI<QWidget>(pParent)
     47    , m_fChooseLocation(fChooseLocation)
    4348    , m_fSupportsHWVirtEx(false)
    4449    , m_fSupportsLongMode(false)
     
    4853    , m_pIconType(0)
    4954    , m_pEditorName(0)
     55    , m_pEditorLocation(0)
    5056    , m_pComboFamily(0)
    5157    , m_pComboType(0)
     
    95101        }
    96102
    97         /* Create VM name editor: */
    98         m_pEditorName = new QLineEdit;
    99         AssertPtrReturnVoid(m_pEditorName);
    100         {
    101             /* Configure VM name editor: */
    102             m_pEditorName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    103             m_pLabelName->setBuddy(m_pEditorName);
    104             /* Add VM name editor into main-layout: */
    105             pMainLayout->addWidget(m_pEditorName, 0, 1, 1, 2);
     103        if (!m_fChooseLocation)
     104        {
     105            /* Create VM name editor: */
     106            m_pEditorName = new QLineEdit;
     107            AssertPtrReturnVoid(m_pEditorName);
     108            {
     109                /* Configure VM name editor: */
     110                m_pEditorName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
     111                m_pLabelName->setBuddy(m_pEditorName);
     112                /* Add VM name editor into main-layout: */
     113                pMainLayout->addWidget(m_pEditorName, 0, 1, 1, 2);
     114            }
     115        }
     116        else
     117        {
     118            /* Create VM location editor: */
     119            m_pEditorLocation = new UIFilePathSelector;
     120            AssertPtrReturnVoid(m_pEditorLocation);
     121            {
     122                /* Configure advanced VM name editor: */
     123                m_pEditorLocation->setResetEnabled(false);
     124                m_pEditorLocation->setMode(UIFilePathSelector::Mode_File_Save);
     125                m_pEditorLocation->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
     126                m_pEditorLocation->setHomeDir(vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder());
     127                m_pLabelName->setBuddy(m_pEditorLocation);
     128                /* Add advanced VM name editor into main-layout: */
     129                pMainLayout->addWidget(m_pEditorLocation, 0, 1, 1, 2);
     130            }
    106131        }
    107132
     
    196221{
    197222    /* Prepare connections: */
    198     connect(m_pEditorName, SIGNAL(textChanged(const QString &)), this, SIGNAL(sigNameChanged(const QString &)));
     223    if (!m_fChooseLocation)
     224        connect(m_pEditorName, SIGNAL(textChanged(const QString &)), this, SIGNAL(sigNameChanged(const QString &)));
     225    else
     226        connect(m_pEditorLocation, SIGNAL(pathChanged(const QString &)), this, SIGNAL(sigNameChanged(const QString &)));
    199227    connect(m_pComboFamily, SIGNAL(currentIndexChanged(int)), this, SLOT(sltFamilyChanged(int)));
    200228    connect(m_pComboType, SIGNAL(currentIndexChanged(int)), this, SLOT(sltTypeChanged(int)));
     
    203231QString UINameAndSystemEditor::name() const
    204232{
    205     return m_pEditorName->text();
     233    if (!m_fChooseLocation)
     234        return m_pEditorName->text();
     235    else
     236        return m_pEditorLocation->path();
    206237}
    207238
    208239void UINameAndSystemEditor::setName(const QString &strName)
    209240{
    210     m_pEditorName->setText(strName);
     241    if (!m_fChooseLocation)
     242        m_pEditorName->setText(strName);
     243    else
     244        m_pEditorLocation->setPath(strName);
    211245}
    212246
     
    240274    m_pLabelFamily->setText(tr("&Type:"));
    241275    m_pLabelType->setText(tr("&Version:"));
    242     m_pEditorName->setWhatsThis(tr("Holds the name of the virtual machine."));
     276    if (!m_fChooseLocation)
     277        m_pEditorName->setWhatsThis(tr("Holds the name of the virtual machine."));
     278    else
     279        m_pEditorLocation->setWhatsThis(tr("Holds the location of the virtual machine."));
    243280    m_pComboFamily->setWhatsThis(tr("Selects the operating system family that "
    244281                                    "you plan to install into this virtual machine."));
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h

    r60832 r60834  
    3030class QLineEdit;
    3131class QComboBox;
     32class UIFilePathSelector;
    3233
    3334/** QWidget extension providing complex editor for basic VM parameters. */
     
    4849public:
    4950
    50     /** Constructs VM parameters editor on the basis of passed @a pParent. */
    51     UINameAndSystemEditor(QWidget *pParent);
     51    /** Constructs VM parameters editor on the basis of passed @a pParent.
     52      * @param fChooseFullPath determine whether we should propose to choose location. */
     53    UINameAndSystemEditor(QWidget *pParent, bool fChooseLocation = false);
    5254
    5355    /** Returns the VM name editor. */
     
    9799    /** Holds the currently chosen OS type IDs on per-family basis. */
    98100    QMap<QString, QString>  m_currentIds;
     101    /** Holds whether we should propose to choose a full path. */
     102    bool                    m_fChooseLocation;
    99103    /** Holds whether host supports hardware virtualization. */
    100104    bool                    m_fSupportsHWVirtEx;
     
    112116    /** Holds the VM name editor instance. */
    113117    QLineEdit              *m_pEditorName;
     118    /** Holds the VM location editor instance. */
     119    UIFilePathSelector     *m_pEditorLocation;
    114120    /** Holds the VM OS family combo instance. */
    115121    QComboBox              *m_pComboFamily;
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