VirtualBox

Changeset 69115 in vbox for trunk


Ignore:
Timestamp:
Oct 17, 2017 4:52:43 PM (7 years ago)
Author:
vboxsync
Message:

Reverting r118414 as it's a bit too early.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp

    r69113 r69115  
    2626# include <QSlider>
    2727# include <QStackedLayout>
    28 # include <QStyle>
    2928# include <QTextEdit>
    3029# include <QVBoxLayout>
     
    3231/* GUI includes: */
    3332# include "QIDialogButtonBox.h"
    34 # include "QIFileDialog.h"
    3533# include "QILabel.h"
    3634# include "QILineEdit.h"
    3735# include "QITabWidget.h"
    38 # include "QIToolButton.h"
    3936# include "UIConverter.h"
     37# include "UIFilePathSelector.h"
    4038# include "UIIconPool.h"
    4139# include "UIMediumDetailsWidget.h"
     
    5654    , m_pTabWidget(0)
    5755    , m_pLabelType(0), m_pComboBoxType(0), m_pErrorPaneType(0)
    58     , m_pLabelLocation(0), m_pEditorLocation(0), m_pButtonLocation(0), m_pErrorPaneLocation(0)
     56    , m_pLabelLocation(0), m_pSelectorLocation(0), m_pErrorPaneLocation(0)
    5957    , m_pLabelDescription(0), m_pEditorDescription(0), m_pErrorPaneDescription(0)
    6058    , m_pLabelSize(0), m_pEditorSize(0), m_pErrorPaneSize(0)
     
    104102    for (int i = 0; i < m_pComboBoxType->count(); ++i)
    105103        m_pComboBoxType->setItemText(i, gpConverter->toString(m_pComboBoxType->itemData(i).value<KMediumType>()));
    106     m_pEditorLocation->setToolTip(tr("Holds the location of this medium."));
    107     m_pButtonLocation->setToolTip(tr("Choose Medium Location"));
     104    m_pSelectorLocation->setToolTip(tr("Holds the location of this medium."));
    108105    m_pEditorDescription->setToolTip(tr("Holds the description of this medium."));
    109106    m_pEditorSize->setToolTip(tr("Holds the size of this medium."));
     
    142139    revalidate(m_pErrorPaneLocation);
    143140    updateButtonStates();
    144 }
    145 
    146 void UIMediumDetailsWidget::sltChooseLocationPath()
    147 {
    148     /* Open file-save dialog to choose location for current medium: */
    149     const QString strFileName = QIFileDialog::getSaveFileName(m_pEditorLocation->text(),
    150                                                               tr("Current extension (*.%1)")
    151                                                                  .arg(QFileInfo(m_oldData.m_options.m_strLocation).suffix()),
    152                                                               this,
    153                                                               tr("Choose the location of this medium"),
    154                                                               0, true, true);
    155     if (!strFileName.isNull())
    156         m_pEditorLocation->setText(QDir::toNativeSeparators(strFileName));
    157141}
    158142
     
    324308
    325309                /* Create location editor: */
    326                 m_pEditorLocation = new QLineEdit;
    327                 AssertPtrReturnVoid(m_pEditorLocation);
     310                m_pSelectorLocation = new UIFilePathSelector;
     311                AssertPtrReturnVoid(m_pSelectorLocation);
    328312                {
    329313                    /* Configure editor: */
    330                     m_pLabelLocation->setBuddy(m_pEditorLocation);
    331                     m_pEditorLocation->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    332                     connect(m_pEditorLocation, &QLineEdit::textChanged,
     314                    m_pLabelLocation->setBuddy(m_pSelectorLocation);
     315                    m_pSelectorLocation->setResetEnabled(false);
     316                    m_pSelectorLocation->setMode(UIFilePathSelector::Mode_File_Save);
     317                    m_pSelectorLocation->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
     318                    connect(m_pSelectorLocation, &UIFilePathSelector::pathChanged,
    333319                            this, &UIMediumDetailsWidget::sltLocationPathChanged);
    334320
    335321                    /* Add into layout: */
    336                     pLayoutLocation->addWidget(m_pEditorLocation);
    337                 }
    338 
    339                 /* Create location button: */
    340                 m_pButtonLocation = new QIToolButton;
    341                 AssertPtrReturnVoid(m_pButtonLocation);
    342                 {
    343                     /* Configure editor: */
    344                     const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
    345                     m_pButtonLocation->setIconSize(QSize(iIconMetric, iIconMetric));
    346                     m_pButtonLocation->setIcon(UIIconPool::iconSet(":/select_file_16px.png"));
    347                     m_pButtonLocation->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    348                     connect(m_pButtonLocation, &QIToolButton::clicked,
    349                             this, &UIMediumDetailsWidget::sltChooseLocationPath);
    350 
    351                     /* Add into layout: */
    352                     pLayoutLocation->addWidget(m_pButtonLocation);
     322                    pLayoutLocation->addWidget(m_pSelectorLocation);
    353323                }
    354324
     
    631601    /* Load location: */
    632602    m_pLabelLocation->setEnabled(m_newData.m_fValid);
    633     m_pEditorLocation->setEnabled(m_newData.m_fValid);
    634     m_pEditorLocation->setText(m_newData.m_options.m_strLocation);
     603    m_pSelectorLocation->setEnabled(m_newData.m_fValid);
     604    m_pSelectorLocation->setPath(m_newData.m_options.m_strLocation);
     605    sltLocationPathChanged(m_pSelectorLocation->path());
    635606
    636607    /* Load description: */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h

    r69113 r69115  
    3434class QComboBox;
    3535class QLabel;
    36 class QLineEdit;
    3736class QStackedLayout;
    3837class QTextEdit;
     
    4039class QILabel;
    4140class QITabWidget;
    42 class QIToolButton;
     41class UIFilePathSelector;
    4342class UIMediumSizeEditor;
    4443
     
    208207        /** Handles location change. */
    209208        void sltLocationPathChanged(const QString &strPath);
    210         /** Handles request to choose location. */
    211         void sltChooseLocationPath();
    212209        /** Handles description text change. */
    213210        void sltDescriptionTextChanged();
     
    289286
    290287        /** Holds the location label. */
    291         QLabel       *m_pLabelLocation;
    292         /** Holds the location editor. */
    293         QLineEdit    *m_pEditorLocation;
    294         /** Holds the location button. */
    295         QIToolButton *m_pButtonLocation;
     288        QLabel             *m_pLabelLocation;
     289        /** Holds the location selector. */
     290        UIFilePathSelector *m_pSelectorLocation;
    296291        /** Holds the location error pane. */
    297         QLabel       *m_pErrorPaneLocation;
     292        QLabel             *m_pErrorPaneLocation;
    298293
    299294        /** Holds the description label. */
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