VirtualBox

Changeset 88101 in vbox


Ignore:
Timestamp:
Mar 12, 2021 1:26:56 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9950. Adding a file selector to name/type editor.

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

Legend:

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

    r87736 r88101  
    4242                                             bool fChooseName /* = true */,
    4343                                             bool fChoosePath /* = false */,
    44                                              bool fChooseType /* = true */)
     44                                             bool fChooseType /* = true */,
     45                                             bool fChooseISOFile /* = false */)
    4546    : QIWithRetranslateUI<QWidget>(pParent)
    4647    , m_fChooseName(fChooseName)
    4748    , m_fChoosePath(fChoosePath)
     49    , m_fChooseISOFile(fChooseISOFile)
    4850    , m_fChooseType(fChooseType)
    4951    , m_fSupportsHWVirtEx(false)
     
    5254    , m_pNameLabel(0)
    5355    , m_pPathLabel(0)
     56    , m_pISOFileSelectorLabel(0)
    5457    , m_pLabelFamily(0)
    5558    , m_pLabelType(0)
     
    5760    , m_pNameLineEdit(0)
    5861    , m_pPathSelector(0)
     62    , m_pISOFileSelector(0)
    5963    , m_pComboFamily(0)
    6064    , m_pComboType(0)
     
    99103}
    100104
     105void UINameAndSystemEditor::setFileSelectorDialogFilters(const QString &strFilters)
     106{
     107    if (m_pISOFileSelector)
     108        m_pISOFileSelector->setFileDialogFilters(strFilters);
     109}
     110
    101111void UINameAndSystemEditor::setName(const QString &strName)
    102112{
     
    266276    if (m_pPathLabel)
    267277        m_pPathLabel->setText(tr("Folder:"));
     278    if (m_pISOFileSelectorLabel)
     279        m_pISOFileSelectorLabel->setText(tr("Installation ISO:"));
    268280    if (m_pLabelFamily)
    269281        m_pLabelFamily->setText(tr("&Type:"));
     
    452464        }
    453465
     466        if (m_fChooseISOFile)
     467        {
     468            m_pISOFileSelectorLabel = new QLabel(this);
     469            m_pMainLayout->addWidget(m_pISOFileSelectorLabel, iRow, 0);
     470
     471            m_pISOFileSelector = new UIFilePathSelector(this);
     472            if (m_pISOFileSelector)
     473            {
     474                m_pISOFileSelector->setResetEnabled(false);
     475                m_pISOFileSelector->setMode(UIFilePathSelector::Mode_File_Open);
     476                m_pISOFileSelector->setFileDialogFilters("*.iso *.ISO");
     477                m_pISOFileSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
     478                m_pISOFileSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));
     479                m_pISOFileSelectorLabel->setBuddy(m_pISOFileSelector);
     480                m_pMainLayout->addWidget(m_pISOFileSelector, iRow, 1, 1, 2);
     481            }
     482            ++iRow;
     483        }
     484
    454485        if (m_fChooseType)
    455486        {
     
    460491                m_pLabelFamily->setAlignment(Qt::AlignRight);
    461492                m_pLabelFamily->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    462 
    463493                /* Add into layout: */
    464494                m_pMainLayout->addWidget(m_pLabelFamily, iRow, 0);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h

    r86089 r88101  
    7070
    7171    /** Constructs VM parameters editor passing @a pParent to the base-class.
    72      * @param  fChooseName  Controls whether we should propose to choose name.
    73      * @param  fChoosePath  Controls whether we should propose to choose path.
    74      * @param  fChooseType  Controls whether we should propose to choose type. */
     72     * @param  fChooseName    Controls whether we should propose to choose name.
     73     * @param  fChoosePath    Controls whether we should propose to choose path.
     74     * @param  fChooseType    Controls whether we should propose to choose type.
     75     * @param  fChooseISOFile Controls whether we should have a ISO file selector. */
    7576    UINameAndSystemEditor(QWidget *pParent,
    7677                          bool fChooseName = true,
    7778                          bool fChoosePath = false,
    78                           bool fChooseType = true);
     79                          bool fChooseType = true,
     80                          bool fChooseISOFile = false);
    7981
    8082    /** Defines minimum layout @a iIndent. */
     
    8789    /** Defines whether VM OS type stuff is @a fEnabled. */
    8890    void setOSTypeStuffEnabled(bool fEnabled);
     91
     92    void setFileSelectorDialogFilters(const QString &strFilters);
    8993
    9094    /** Defines the VM @a strName. */
     
    162166    /** Holds whether we should propose to choose a path. */
    163167    bool  m_fChoosePath;
     168    /** Holds whether we should propose a file selector. */
     169    bool  m_fChooseISOFile;
    164170    /** Holds whether we should propose to choose a type. */
    165171    bool  m_fChooseType;
     
    176182    /** Holds the VM path label instance. */
    177183    QLabel *m_pPathLabel;
     184    QLabel *m_pISOFileSelectorLabel;
    178185    /** Holds the VM OS family label instance. */
    179186    QLabel *m_pLabelFamily;
     
    187194    /** Holds the VM path editor instance. */
    188195    UIFilePathSelector *m_pPathSelector;
     196    /** Holds the ISO file selector instance. */
     197    UIFilePathSelector    *m_pISOFileSelector;
    189198    /** Holds the VM OS family combo instance. */
    190199    QComboBox          *m_pComboFamily;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r88068 r88101  
    239239                                                       true /* fChooseName? */,
    240240                                                       true /* fChoosePath? */,
    241                                                        true /* fChooseType? */);
     241                                                       true /* fChooseType? */,
     242                                                       true /* fChooseISOFile? */);
    242243    return m_pNameAndSystemEditor;
    243244}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r88065 r88101  
    8181    QString ISOFilePath() const;
    8282    bool determineOSType(const QString &strISOPath);
    83     bool isISOFileSelectorComplete() const;
    8483    void setTypeByISODetectedOSType(const QString &strDetectedOSType);
    8584    /** Return false if ISO path is not empty but points to an missing or unreadable file. */
    8685    bool checkISOFile() const;
    87 
    8886
    8987    /** @name Widgets
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