vbox的更動 69131 路徑 trunk/src/VBox
- 時間撮記:
- 2017-10-18 上午10:09:36 (7 年 以前)
- 位置:
- trunk/src/VBox/Frontends/VirtualBox/src/medium
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp
r69115 r69131 26 26 # include <QSlider> 27 27 # include <QStackedLayout> 28 # include <QStyle> 28 29 # include <QTextEdit> 29 30 # include <QVBoxLayout> … … 31 32 /* GUI includes: */ 32 33 # include "QIDialogButtonBox.h" 34 # include "QIFileDialog.h" 33 35 # include "QILabel.h" 34 36 # include "QILineEdit.h" 35 37 # include "QITabWidget.h" 38 # include "QIToolButton.h" 36 39 # include "UIConverter.h" 37 # include "UIFilePathSelector.h"38 40 # include "UIIconPool.h" 39 41 # include "UIMediumDetailsWidget.h" … … 54 56 , m_pTabWidget(0) 55 57 , m_pLabelType(0), m_pComboBoxType(0), m_pErrorPaneType(0) 56 , m_pLabelLocation(0), m_p SelectorLocation(0), m_pErrorPaneLocation(0)58 , m_pLabelLocation(0), m_pEditorLocation(0), m_pButtonLocation(0), m_pErrorPaneLocation(0) 57 59 , m_pLabelDescription(0), m_pEditorDescription(0), m_pErrorPaneDescription(0) 58 60 , m_pLabelSize(0), m_pEditorSize(0), m_pErrorPaneSize(0) … … 102 104 for (int i = 0; i < m_pComboBoxType->count(); ++i) 103 105 m_pComboBoxType->setItemText(i, gpConverter->toString(m_pComboBoxType->itemData(i).value<KMediumType>())); 104 m_pSelectorLocation->setToolTip(tr("Holds the location of this medium.")); 106 m_pEditorLocation->setToolTip(tr("Holds the location of this medium.")); 107 m_pButtonLocation->setToolTip(tr("Choose Medium Location")); 105 108 m_pEditorDescription->setToolTip(tr("Holds the description of this medium.")); 106 109 m_pEditorSize->setToolTip(tr("Holds the size of this medium.")); … … 139 142 revalidate(m_pErrorPaneLocation); 140 143 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 QApplication::translate("UIMediumManager", "Current extension (*.%1)") 151 .arg(QFileInfo(m_oldData.m_options.m_strLocation).suffix()), 152 this, 153 QApplication::translate("UIMediumManager", "Choose the location of this medium"), 154 0, true, true); 155 if (!strFileName.isNull()) 156 m_pEditorLocation->setText(QDir::toNativeSeparators(strFileName)); 141 157 } 142 158 … … 308 324 309 325 /* Create location editor: */ 310 m_p SelectorLocation = new UIFilePathSelector;311 AssertPtrReturnVoid(m_p SelectorLocation);326 m_pEditorLocation = new QLineEdit; 327 AssertPtrReturnVoid(m_pEditorLocation); 312 328 { 313 329 /* Configure editor: */ 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, 330 m_pLabelLocation->setBuddy(m_pEditorLocation); 331 m_pEditorLocation->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 332 connect(m_pEditorLocation, &QLineEdit::textChanged, 319 333 this, &UIMediumDetailsWidget::sltLocationPathChanged); 320 334 321 335 /* Add into layout: */ 322 pLayoutLocation->addWidget(m_pSelectorLocation); 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); 323 353 } 324 354 … … 601 631 /* Load location: */ 602 632 m_pLabelLocation->setEnabled(m_newData.m_fValid); 603 m_pSelectorLocation->setEnabled(m_newData.m_fValid); 604 m_pSelectorLocation->setPath(m_newData.m_options.m_strLocation); 605 sltLocationPathChanged(m_pSelectorLocation->path()); 633 m_pEditorLocation->setEnabled(m_newData.m_fValid); 634 m_pEditorLocation->setText(m_newData.m_options.m_strLocation); 606 635 607 636 /* Load description: */ … … 654 683 { 655 684 /* Always valid for now: */ 656 const bool fError = false;685 const bool fError = m_newData.m_options.m_strLocation.isEmpty(); 657 686 m_pErrorPaneLocation->setVisible(fError); 658 687 if (fError) … … 686 715 // m_pErrorPaneType->setToolTip(tr("Cannot change from type <b>%1</b> to <b>%2</b>.") 687 716 // .arg(m_oldData.m_options.m_enmType).arg(m_newData.m_options.m_enmType)); 688 // if (!pWidget || pWidget == m_pErrorPaneLocation) 689 // m_pErrorPaneLocation->setToolTip(tr("Cannot change medium location from <b>%1</b> to <b>%2</b>.") 690 // .arg(m_oldData.m_options.m_strLocation).arg(m_newData.m_options.m_strLocation)); 717 if (!pWidget || pWidget == m_pErrorPaneLocation) 718 m_pErrorPaneLocation->setToolTip(tr("Location can not be empty.")); 691 719 // if (!pWidget || pWidget == m_pErrorPaneDescription) 692 720 // m_pErrorPaneDescription->setToolTip(tr("Cannot change medium description from <b>%1</b> to <b>%2</b>.") -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h
r69115 r69131 34 34 class QComboBox; 35 35 class QLabel; 36 class QLineEdit; 36 37 class QStackedLayout; 37 38 class QTextEdit; … … 39 40 class QILabel; 40 41 class QITabWidget; 41 class UIFilePathSelector;42 class QIToolButton; 42 43 class UIMediumSizeEditor; 43 44 … … 207 208 /** Handles location change. */ 208 209 void sltLocationPathChanged(const QString &strPath); 210 /** Handles request to choose location. */ 211 void sltChooseLocationPath(); 209 212 /** Handles description text change. */ 210 213 void sltDescriptionTextChanged(); … … 286 289 287 290 /** Holds the location label. */ 288 QLabel *m_pLabelLocation; 289 /** Holds the location selector. */ 290 UIFilePathSelector *m_pSelectorLocation; 291 QLabel *m_pLabelLocation; 292 /** Holds the location editor. */ 293 QLineEdit *m_pEditorLocation; 294 /** Holds the location button. */ 295 QIToolButton *m_pButtonLocation; 291 296 /** Holds the location error pane. */ 292 QLabel 297 QLabel *m_pErrorPaneLocation; 293 298 294 299 /** Holds the description label. */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器