- Timestamp:
- Oct 17, 2017 4:52:43 PM (7 years ago)
- 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 26 26 # include <QSlider> 27 27 # include <QStackedLayout> 28 # include <QStyle>29 28 # include <QTextEdit> 30 29 # include <QVBoxLayout> … … 32 31 /* GUI includes: */ 33 32 # include "QIDialogButtonBox.h" 34 # include "QIFileDialog.h"35 33 # include "QILabel.h" 36 34 # include "QILineEdit.h" 37 35 # include "QITabWidget.h" 38 # include "QIToolButton.h"39 36 # include "UIConverter.h" 37 # include "UIFilePathSelector.h" 40 38 # include "UIIconPool.h" 41 39 # include "UIMediumDetailsWidget.h" … … 56 54 , m_pTabWidget(0) 57 55 , m_pLabelType(0), m_pComboBoxType(0), m_pErrorPaneType(0) 58 , m_pLabelLocation(0), m_p EditorLocation(0), m_pButtonLocation(0), m_pErrorPaneLocation(0)56 , m_pLabelLocation(0), m_pSelectorLocation(0), m_pErrorPaneLocation(0) 59 57 , m_pLabelDescription(0), m_pEditorDescription(0), m_pErrorPaneDescription(0) 60 58 , m_pLabelSize(0), m_pEditorSize(0), m_pErrorPaneSize(0) … … 104 102 for (int i = 0; i < m_pComboBoxType->count(); ++i) 105 103 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.")); 108 105 m_pEditorDescription->setToolTip(tr("Holds the description of this medium.")); 109 106 m_pEditorSize->setToolTip(tr("Holds the size of this medium.")); … … 142 139 revalidate(m_pErrorPaneLocation); 143 140 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));157 141 } 158 142 … … 324 308 325 309 /* Create location editor: */ 326 m_p EditorLocation = new QLineEdit;327 AssertPtrReturnVoid(m_p EditorLocation);310 m_pSelectorLocation = new UIFilePathSelector; 311 AssertPtrReturnVoid(m_pSelectorLocation); 328 312 { 329 313 /* 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, 333 319 this, &UIMediumDetailsWidget::sltLocationPathChanged); 334 320 335 321 /* 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); 353 323 } 354 324 … … 631 601 /* Load location: */ 632 602 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()); 635 606 636 607 /* Load description: */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h
r69113 r69115 34 34 class QComboBox; 35 35 class QLabel; 36 class QLineEdit;37 36 class QStackedLayout; 38 37 class QTextEdit; … … 40 39 class QILabel; 41 40 class QITabWidget; 42 class QIToolButton;41 class UIFilePathSelector; 43 42 class UIMediumSizeEditor; 44 43 … … 208 207 /** Handles location change. */ 209 208 void sltLocationPathChanged(const QString &strPath); 210 /** Handles request to choose location. */211 void sltChooseLocationPath();212 209 /** Handles description text change. */ 213 210 void sltDescriptionTextChanged(); … … 289 286 290 287 /** 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; 296 291 /** Holds the location error pane. */ 297 QLabel *m_pErrorPaneLocation;292 QLabel *m_pErrorPaneLocation; 298 293 299 294 /** Holds the description label. */
Note:
See TracChangeset
for help on using the changeset viewer.