Changeset 67863 in vbox for trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp
- Timestamp:
- Jul 7, 2017 5:40:58 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 116819
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp
r67810 r67863 32 32 # include "QITabWidget.h" 33 33 # include "UIConverter.h" 34 # include "UIFilePathSelector.h" 34 35 # include "UIIconPool.h" 35 36 # include "UIMediumDetailsWidget.h" … … 44 45 , m_newData(UIDataMedium()) 45 46 , m_pTabWidget(0) 46 , m_pLabelType(0) 47 , m_pComboBoxType(0) 48 , m_pErrorPaneType(0) 47 , m_pLabelType(0), m_pComboBoxType(0), m_pErrorPaneType(0) 48 , m_pLabelLocation(0), m_pSelectorLocation(0), m_pErrorPaneLocation(0) 49 49 , m_pButtonBox(0) 50 50 , m_pLayoutDetails(0) … … 81 81 /* Translate 'Options' tab content. */ 82 82 83 /* Translate type label: */ 84 m_pLabelType->setText(tr("&Type")); 85 86 /* Translate type field: */ 83 /* Translate labels: */ 84 m_pLabelType->setText(tr("&Type:")); 85 m_pLabelLocation->setText(tr("&Location:")); 86 87 /* Translate fields: */ 87 88 m_pComboBoxType->setToolTip(tr("Holds the type of this medium.")); 88 89 for (int i = 0; i < m_pComboBoxType->count(); ++i) 89 90 m_pComboBoxType->setItemText(i, gpConverter->toString(m_pComboBoxType->itemData(i).value<KMediumType>())); 91 m_pSelectorLocation->setToolTip(tr("Holds the location of this medium.")); 90 92 91 93 /* Translate button-box: */ … … 114 116 m_newData.m_options.m_enmType = m_pComboBoxType->itemData(iIndex).value<KMediumType>(); 115 117 revalidate(m_pErrorPaneType); 118 updateButtonStates(); 119 } 120 121 void UIMediumDetailsWidget::sltLocationPathChanged(const QString &strPath) 122 { 123 m_newData.m_options.m_strLocation = strPath; 124 revalidate(m_pErrorPaneLocation); 116 125 updateButtonStates(); 117 126 } … … 238 247 } 239 248 249 /* Create location label: */ 250 m_pLabelLocation = new QLabel; 251 AssertPtrReturnVoid(m_pLabelLocation); 252 { 253 /* Configure label: */ 254 m_pLabelLocation->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 255 /* Add into layout: */ 256 pLayoutOptions->addWidget(m_pLabelLocation, 1, 0); 257 } 258 /* Create location layout: */ 259 QHBoxLayout *pLayoutLocation = new QHBoxLayout; 260 AssertPtrReturnVoid(pLayoutLocation); 261 { 262 /* Configure layout: */ 263 pLayoutLocation->setContentsMargins(0, 0, 0, 0); 264 /* Create location editor: */ 265 m_pSelectorLocation = new UIFilePathSelector; 266 AssertPtrReturnVoid(m_pSelectorLocation); 267 { 268 /* Configure editor: */ 269 m_pLabelLocation->setBuddy(m_pSelectorLocation); 270 m_pSelectorLocation->setResetEnabled(false); 271 m_pSelectorLocation->setMode(UIFilePathSelector::Mode_File_Save); 272 m_pSelectorLocation->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 273 connect(m_pSelectorLocation, &UIFilePathSelector::pathChanged, 274 this, &UIMediumDetailsWidget::sltLocationPathChanged); 275 276 /* Add into layout: */ 277 pLayoutLocation->addWidget(m_pSelectorLocation); 278 } 279 /* Create location error pane: */ 280 m_pErrorPaneLocation = new QLabel; 281 AssertPtrReturnVoid(m_pErrorPaneLocation); 282 { 283 /* Configure label: */ 284 m_pErrorPaneLocation->setAlignment(Qt::AlignCenter); 285 m_pErrorPaneLocation->setPixmap(UIIconPool::iconSet(":/status_error_16px.png") 286 .pixmap(QSize(iIconMetric, iIconMetric))); 287 /* Add into layout: */ 288 pLayoutLocation->addWidget(m_pErrorPaneLocation); 289 } 290 /* Add into layout: */ 291 pLayoutOptions->addLayout(pLayoutLocation, 1, 1); 292 } 293 240 294 /* Create stretch: */ 241 295 QSpacerItem *pSpacer2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); … … 243 297 { 244 298 /* Add into layout: */ 245 pLayoutOptions->addItem(pSpacer2, 1, 0, 1, 2);299 pLayoutOptions->addItem(pSpacer2, 2, 0, 1, 2); 246 300 } 247 301 … … 380 434 m_pComboBoxType->setCurrentIndex(i); 381 435 sltTypeIndexChanged(m_pComboBoxType->currentIndex()); 436 437 /* Load location: */ 438 m_pSelectorLocation->setPath(m_newData.m_options.m_strLocation); 439 sltLocationPathChanged(m_pSelectorLocation->path()); 382 440 } 383 441 … … 408 466 m_pErrorPaneType->setVisible(fError); 409 467 } 468 if (!pWidget || pWidget == m_pErrorPaneLocation) 469 { 470 /* Always valid for now: */ 471 const bool fError = false; 472 m_pErrorPaneLocation->setVisible(fError); 473 } 410 474 411 475 /* Retranslate validation: */ … … 417 481 /* Translate 'Interface' tab content: */ 418 482 // if (!pWidget || pWidget == m_pErrorPaneType) 419 // m_pErrorPaneType->setToolTip(tr("Cannot directly change from type <b>%1</b> to type <b>%2</b>.") 420 // .arg(m_oldData.m_enmType).arg(m_newData.m_enmType)); 483 // m_pErrorPaneType->setToolTip(tr("Cannot change from type <b>%1</b> to <b>%2</b>.") 484 // .arg(m_oldData.m_options.m_enmType).arg(m_newData.m_options.m_enmType)); 485 // if (!pWidget || pWidget == m_pErrorPaneLocation) 486 // m_pErrorPaneLocation->setToolTip(tr("Cannot change medium location from <b>%1</b> to <b>%2</b>.") 487 // .arg(m_oldData.m_options.m_strLocation).arg(m_newData.m_options.m_strLocation)); 421 488 } 422 489
Note:
See TracChangeset
for help on using the changeset viewer.