Changeset 67986 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 17, 2017 11:10:18 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 116995
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp
r67985 r67986 55 55 , m_pLabelType(0), m_pComboBoxType(0), m_pErrorPaneType(0) 56 56 , m_pLabelLocation(0), m_pSelectorLocation(0), m_pErrorPaneLocation(0) 57 , m_pLabelDescription(0), m_pEditorDescription(0), m_pErrorPaneDescription(0) 57 58 , m_pLabelSize(0), m_pEditorSize(0), m_pErrorPaneSize(0) 58 , m_pLabelDescription(0), m_pEditorDescription(0), m_pErrorPaneDescription(0)59 59 , m_pButtonBox(0) 60 60 , m_pLayoutDetails(0) … … 94 94 m_pLabelType->setText(tr("&Type:")); 95 95 m_pLabelLocation->setText(tr("&Location:")); 96 m_pLabelDescription->setText(tr("&Description:")); 96 97 m_pLabelSize->setText(tr("&Size:")); 97 m_pLabelDescription->setText(tr("&Description:"));98 98 99 99 /* Translate fields: */ … … 102 102 m_pComboBoxType->setItemText(i, gpConverter->toString(m_pComboBoxType->itemData(i).value<KMediumType>())); 103 103 m_pSelectorLocation->setToolTip(tr("Holds the location of this medium.")); 104 m_pEditorDescription->setToolTip(tr("Holds the description of this medium.")); 104 105 m_pEditorSize->setToolTip(tr("Holds the size of this medium.")); 105 m_pEditorDescription->setToolTip(tr("Holds the description of this medium."));106 106 107 107 /* Translate button-box: */ … … 140 140 } 141 141 142 void UIMediumDetailsWidget::sltDescriptionTextChanged() 143 { 144 m_newData.m_options.m_strDescription = m_pEditorDescription->toPlainText(); 145 revalidate(m_pErrorPaneDescription); 146 updateButtonStates(); 147 } 148 142 149 void UIMediumDetailsWidget::sltSizeValueChanged(qulonglong uSize) 143 150 { 144 151 m_newData.m_options.m_uLogicalSize = uSize; 145 152 revalidate(m_pErrorPaneSize); 146 updateButtonStates();147 }148 149 void UIMediumDetailsWidget::sltDescriptionTextChanged()150 {151 m_newData.m_options.m_strDescription = m_pEditorDescription->toPlainText();152 revalidate(m_pErrorPaneDescription);153 153 updateButtonStates(); 154 154 } … … 334 334 } 335 335 336 /* Create size label: */337 m_pLabelSize = new QLabel;338 AssertPtrReturnVoid(m_pLabelSize);339 {340 /* Configure label: */341 m_pLabelSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);342 343 /* Add into layout: */344 pLayoutOptions->addWidget(m_pLabelSize, 2, 0);345 }346 347 /* Create size layout: */348 QGridLayout *pLayoutSize = new QGridLayout;349 AssertPtrReturnVoid(pLayoutSize);350 {351 /* Configure layout: */352 pLayoutSize->setContentsMargins(0, 0, 0, 0);353 354 /* Create size editor: */355 m_pEditorSize = new UIMediumSizeEditor;356 AssertPtrReturnVoid(m_pEditorSize);357 {358 /* Configure editor: */359 m_pLabelSize->setBuddy(m_pEditorSize);360 m_pEditorSize->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);361 connect(m_pEditorSize, &UIMediumSizeEditor::sigSizeChanged,362 this, &UIMediumDetailsWidget::sltSizeValueChanged);363 364 /* Add into layout: */365 pLayoutSize->addWidget(m_pEditorSize, 0, 0, 2, 1);366 }367 368 /* Create size error pane: */369 m_pErrorPaneSize = new QLabel;370 AssertPtrReturnVoid(m_pErrorPaneSize);371 {372 /* Configure label: */373 m_pErrorPaneSize->setAlignment(Qt::AlignCenter);374 m_pErrorPaneSize->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);375 m_pErrorPaneSize->setPixmap(UIIconPool::iconSet(":/status_error_16px.png")376 .pixmap(QSize(iIconMetric, iIconMetric)));377 378 /* Add into layout: */379 pLayoutSize->addWidget(m_pErrorPaneSize, 0, 1, Qt::AlignCenter);380 }381 382 /* Add into layout: */383 pLayoutOptions->addLayout(pLayoutSize, 2, 1, 2, 1);384 }385 386 336 /* Create description label: */ 387 337 m_pLabelDescription = new QLabel; … … 392 342 393 343 /* Add into layout: */ 394 pLayoutOptions->addWidget(m_pLabelDescription, 4, 0);344 pLayoutOptions->addWidget(m_pLabelDescription, 2, 0); 395 345 } 396 346 … … 436 386 437 387 /* Add into layout: */ 438 pLayoutOptions->addLayout(pLayoutDescription, 4, 1, 2, 1); 388 pLayoutOptions->addLayout(pLayoutDescription, 2, 1, 2, 1); 389 } 390 391 /* Create size label: */ 392 m_pLabelSize = new QLabel; 393 AssertPtrReturnVoid(m_pLabelSize); 394 { 395 /* Configure label: */ 396 m_pLabelSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 397 398 /* Add into layout: */ 399 pLayoutOptions->addWidget(m_pLabelSize, 4, 0); 400 } 401 402 /* Create size layout: */ 403 QGridLayout *pLayoutSize = new QGridLayout; 404 AssertPtrReturnVoid(pLayoutSize); 405 { 406 /* Configure layout: */ 407 pLayoutSize->setContentsMargins(0, 0, 0, 0); 408 409 /* Create size editor: */ 410 m_pEditorSize = new UIMediumSizeEditor; 411 AssertPtrReturnVoid(m_pEditorSize); 412 { 413 /* Configure editor: */ 414 m_pLabelSize->setBuddy(m_pEditorSize); 415 m_pEditorSize->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 416 connect(m_pEditorSize, &UIMediumSizeEditor::sigSizeChanged, 417 this, &UIMediumDetailsWidget::sltSizeValueChanged); 418 419 /* Add into layout: */ 420 pLayoutSize->addWidget(m_pEditorSize, 0, 0, 2, 1); 421 } 422 423 /* Create size error pane: */ 424 m_pErrorPaneSize = new QLabel; 425 AssertPtrReturnVoid(m_pErrorPaneSize); 426 { 427 /* Configure label: */ 428 m_pErrorPaneSize->setAlignment(Qt::AlignCenter); 429 m_pErrorPaneSize->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 430 m_pErrorPaneSize->setPixmap(UIIconPool::iconSet(":/status_error_16px.png") 431 .pixmap(QSize(iIconMetric, iIconMetric))); 432 433 /* Add into layout: */ 434 pLayoutSize->addWidget(m_pErrorPaneSize, 0, 1, Qt::AlignCenter); 435 } 436 437 /* Add into layout: */ 438 pLayoutOptions->addLayout(pLayoutSize, 4, 1, 2, 1); 439 439 } 440 440 … … 590 590 sltLocationPathChanged(m_pSelectorLocation->path()); 591 591 592 /* Load description: */ 593 m_pLabelDescription->setEnabled(m_newData.m_fValid); 594 m_pEditorDescription->setEnabled(m_newData.m_fValid); 595 m_pEditorDescription->setPlainText(m_newData.m_options.m_strDescription); 596 592 597 /* Load size: */ 593 598 const bool fEnableResize = m_newData.m_fValid … … 598 603 m_pEditorSize->setMediumSize(m_newData.m_options.m_uLogicalSize); 599 604 sltSizeValueChanged(m_pEditorSize->mediumSize()); 600 601 /* Load description: */602 m_pLabelDescription->setEnabled(m_newData.m_fValid);603 m_pEditorDescription->setEnabled(m_newData.m_fValid);604 m_pEditorDescription->setPlainText(m_newData.m_options.m_strDescription);605 605 } 606 606 … … 637 637 m_pErrorPaneLocation->setVisible(fError); 638 638 } 639 if (!pWidget || pWidget == m_pErrorPaneDescription) 640 { 641 /* Always valid for now: */ 642 const bool fError = false; 643 m_pErrorPaneDescription->setVisible(fError); 644 } 639 645 if (!pWidget || pWidget == m_pErrorPaneSize) 640 646 { … … 642 648 const bool fError = false; 643 649 m_pErrorPaneSize->setVisible(fError); 644 }645 if (!pWidget || pWidget == m_pErrorPaneDescription)646 {647 /* Always valid for now: */648 const bool fError = false;649 m_pErrorPaneDescription->setVisible(fError);650 650 } 651 651 … … 663 663 // m_pErrorPaneLocation->setToolTip(tr("Cannot change medium location from <b>%1</b> to <b>%2</b>.") 664 664 // .arg(m_oldData.m_options.m_strLocation).arg(m_newData.m_options.m_strLocation)); 665 // if (!pWidget || pWidget == m_pErrorPaneDescription) 666 // m_pErrorPaneDescription->setToolTip(tr("Cannot change medium description from <b>%1</b> to <b>%2</b>.") 667 // .arg(m_oldData.m_options.m_strDescription).arg(m_newData.m_options.m_strDescription)); 665 668 // if (!pWidget || pWidget == m_pErrorPaneSize) 666 669 // m_pErrorPaneSize->setToolTip(tr("Cannot change medium size from <b>%1</b> to <b>%2</b>.") 667 670 // .arg(m_oldData.m_options.m_uLogicalSize).arg(m_newData.m_options.m_uLogicalSize)); 668 // if (!pWidget || pWidget == m_pErrorPaneDescription)669 // m_pErrorPaneDescription->setToolTip(tr("Cannot change medium description from <b>%1</b> to <b>%2</b>.")670 // .arg(m_oldData.m_options.m_strDescription).arg(m_newData.m_options.m_strDescription));671 671 } 672 672 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h
r67969 r67986 50 50 : m_enmType(KMediumType_Normal) 51 51 , m_strLocation(QString()) 52 , m_strDescription(QString()) 52 53 , m_uLogicalSize(0) 53 , m_strDescription(QString())54 54 {} 55 55 … … 60 60 && (m_enmType == other.m_enmType) 61 61 && (m_strLocation == other.m_strLocation) 62 && (m_strDescription == other.m_strDescription) 62 63 && (m_uLogicalSize == other.m_uLogicalSize) 63 && (m_strDescription == other.m_strDescription)64 64 ; 65 65 } … … 74 74 /** Holds the location. */ 75 75 QString m_strLocation; 76 /** Holds the description. */ 77 QString m_strDescription; 76 78 /** Holds the logical size. */ 77 79 qulonglong m_uLogicalSize; 78 /** Holds the description. */79 QString m_strDescription;80 80 }; 81 81 … … 205 205 /** Handles location change. */ 206 206 void sltLocationPathChanged(const QString &strPath); 207 /** Handles description text change. */ 208 void sltDescriptionTextChanged(); 207 209 /** Handles size editor change. */ 208 210 void sltSizeValueChanged(qulonglong uSize); 209 /** Handles description text change. */210 void sltDescriptionTextChanged();211 211 212 212 /** Handles button-box button click. */ … … 290 290 QLabel *m_pErrorPaneLocation; 291 291 292 /** Holds the description label. */ 293 QLabel *m_pLabelDescription; 294 /** Holds the description editor. */ 295 QTextEdit *m_pEditorDescription; 296 /** Holds the description error pane. */ 297 QLabel *m_pErrorPaneDescription; 298 292 299 /** Holds the size label. */ 293 300 QLabel *m_pLabelSize; … … 297 304 QLabel *m_pErrorPaneSize; 298 305 299 /** Holds the description label. */300 QLabel *m_pLabelDescription;301 /** Holds the description editor. */302 QTextEdit *m_pEditorDescription;303 /** Holds the description error pane. */304 QLabel *m_pErrorPaneDescription;305 306 306 /** Holds the button-box instance. */ 307 307 QIDialogButtonBox *m_pButtonBox;
Note:
See TracChangeset
for help on using the changeset viewer.