VirtualBox

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.

File:
1 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);
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