Changeset 67246 in vbox
- Timestamp:
- Jun 2, 2017 3:16:34 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 115941
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotDetailsWidget.cpp
r67218 r67246 28 28 # include <QPushButton> 29 29 # include <QScrollArea> 30 # include <QStackedLayout> 30 31 # include <QTabWidget> 31 32 # include <QTextEdit> … … 297 298 UISnapshotDetailsWidget::UISnapshotDetailsWidget(QWidget *pParent /* = 0 */) 298 299 : QIWithRetranslateUI<QWidget>(pParent) 300 , m_pStackedLayout(0) 301 , m_pEmptyWidget(0) 302 , m_pEmptyWidgetLabel(0) 299 303 , m_pTabWidget(0) 300 304 , m_pLayoutOptions(0) … … 360 364 { 361 365 /* Translate labels: */ 366 m_pEmptyWidgetLabel->setText("<p>You have the <b>Current State</b> item selected.<br>" 367 "Press <b>Take</b> button if you wish to take a new snapshot.</p>"); 362 368 m_pTabWidget->setTabText(0, tr("&Attributes")); 363 369 m_pTabWidget->setTabText(1, tr("D&etails")); … … 410 416 void UISnapshotDetailsWidget::prepare() 411 417 { 412 /* Create layout: */ 413 new QVBoxLayout(this); 414 AssertPtrReturnVoid(layout()); 415 { 416 /* Configure layout: */ 417 layout()->setContentsMargins(0, 0, 0, 0); 418 418 /* Create stacked layout: */ 419 m_pStackedLayout = new QStackedLayout(this); 420 AssertPtrReturnVoid(m_pStackedLayout); 421 { 422 /* Prepare empty-widget: */ 423 prepareEmptyWidget(); 419 424 /* Prepare tab-widget: */ 420 425 prepareTabWidget(); 426 } 427 } 428 429 void UISnapshotDetailsWidget::prepareEmptyWidget() 430 { 431 /* Create empty-widget: */ 432 m_pEmptyWidget = new QWidget; 433 AssertPtrReturnVoid(m_pEmptyWidget); 434 { 435 /* Create empty-widget layout: */ 436 new QVBoxLayout(m_pEmptyWidget); 437 AssertPtrReturnVoid(m_pEmptyWidget->layout()); 438 { 439 /* Create empty-widget label: */ 440 m_pEmptyWidgetLabel = new QLabel; 441 { 442 /* Configure label: */ 443 QFont font = m_pEmptyWidgetLabel->font(); 444 font.setPointSize(font.pointSize() * 1.5); 445 m_pEmptyWidgetLabel->setAlignment(Qt::AlignCenter); 446 m_pEmptyWidgetLabel->setFont(font); 447 448 /* Add into layout: */ 449 m_pEmptyWidget->layout()->addWidget(m_pEmptyWidgetLabel); 450 } 451 } 452 453 /* Add into layout: */ 454 m_pStackedLayout->addWidget(m_pEmptyWidget); 421 455 } 422 456 } … … 434 468 435 469 /* Add into layout: */ 436 layout()->addWidget(m_pTabWidget);470 m_pStackedLayout->addWidget(m_pTabWidget); 437 471 } 438 472 } … … 455 489 m_pLabelTaken->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 456 490 457 /* Add to layout: */491 /* Add into layout: */ 458 492 m_pLayoutOptions->addWidget(m_pLabelTaken, 0, 0); 459 493 } … … 467 501 m_pLabelTakenText->setSizePolicy(policy); 468 502 469 /* Add to layout: */503 /* Add into layout: */ 470 504 m_pLayoutOptions->addWidget(m_pLabelTakenText, 0, 1); 471 505 } … … 478 512 m_pLabelName->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 479 513 480 /* Add to layout: */514 /* Add into layout: */ 481 515 m_pLayoutOptions->addWidget(m_pLabelName, 1, 0); 482 516 } … … 493 527 this, &UISnapshotDetailsWidget::sltHandleNameChange); 494 528 495 /* Add to layout: */529 /* Add into layout: */ 496 530 m_pLayoutOptions->addWidget(m_pEditorName, 1, 1); 497 531 } … … 512 546 m_pLabelThumbnail->setPalette(pal); 513 547 514 /* Add to layout: */548 /* Add into layout: */ 515 549 m_pLayoutOptions->addWidget(m_pLabelThumbnail, 0, 2, 2, 1); 516 550 } … … 523 557 m_pLabelDescription->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignTop); 524 558 525 /* Add to layout: */559 /* Add into layout: */ 526 560 m_pLayoutOptions->addWidget(m_pLabelDescription, 2, 0); 527 561 } … … 540 574 this, &UISnapshotDetailsWidget::sltHandleDescriptionChange); 541 575 542 /* Add to layout: */576 /* Add into layout: */ 543 577 m_pLayoutOptions->addWidget(m_pBrowserDescription, 2, 1, 1, 2); 544 578 } … … 603 637 QVariant(gpConverter->toIcon(enmType).pixmap(iconSize))); 604 638 605 /* Add to layout: */639 /* Add into layout: */ 606 640 m_pLayoutDetails->addWidget(m_pBrowserDetails); 607 641 } … … 622 656 if (m_comSnapshot.isNotNull()) 623 657 { 658 /* Choose the tab-widget as current one: */ 659 m_pStackedLayout->setCurrentWidget(m_pTabWidget); 660 624 661 /* Calculate snapshot timestamp info: */ 625 662 QDateTime timestamp; … … 681 718 else 682 719 { 720 /* Choose the empty-widget as current one: */ 721 m_pStackedLayout->setCurrentWidget(m_pEmptyWidget); 722 683 723 /* Clear snapshot timestamp info: */ 684 724 m_pLabelTakenText->clear(); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotDetailsWidget.h
r67173 r67246 32 32 class QLabel; 33 33 class QLineEdit; 34 class QStackedLayout; 34 35 class QTabWidget; 35 36 class QTextEdit; 36 37 class QVBoxLayout; 38 class QWidget; 37 39 38 40 … … 108 110 /** Prepares all. */ 109 111 void prepare(); 112 /** Prepares empty-widget. */ 113 void prepareEmptyWidget(); 110 114 /** Prepares tab-widget. */ 111 115 void prepareTabWidget(); … … 133 137 /** Holds the cached screenshot. */ 134 138 QPixmap m_pixmapScreenshot; 139 140 /** Holds the stacked layout instance. */ 141 QStackedLayout *m_pStackedLayout; 142 143 /** Holds the empty-widget instance. */ 144 QWidget *m_pEmptyWidget; 145 /** Holds the empty-widget label instance. */ 146 QLabel *m_pEmptyWidgetLabel; 135 147 136 148 /** Holds the tab-widget instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp
r67162 r67246 800 800 ); 801 801 m_pActionShowSnapshotDetails->setEnabled( 802 m_pCurrentSnapshotItem 803 && pSnapshotItem 804 && !pSnapshotItem->isCurrentStateItem() 802 pSnapshotItem 805 803 ); 806 804 m_pActionCommitSnapshotDetails->setEnabled( … … 814 812 815 813 /* If there is a proper snasphot item: */ 816 if ( m_pCurrentSnapshotItem 817 && pSnapshotItem 818 && !pSnapshotItem->isCurrentStateItem()) 814 if (pSnapshotItem) 819 815 { 820 816 /* Update details-widget if it's visible: */ 821 817 if (m_pDetailsWidget->isVisible()) 822 818 m_pDetailsWidget->setData(*pSnapshotItem, pSnapshotItem->snapshot()); 823 }824 else825 {826 /* Clear details-widget if it's visible: */827 if (m_pDetailsWidget->isVisible())828 m_pDetailsWidget->clearData();829 /* Toggle details button off and hide the widget: */830 m_pActionShowSnapshotDetails->setChecked(false);831 sltToggleSnapshotDetailsVisibility(false);832 819 } 833 820 } … … 914 901 915 902 /* If this is a snapshot item: */ 916 if ( m_pCurrentSnapshotItem 917 && pSnapshotItem 918 && !pSnapshotItem->isCurrentStateItem()) 903 if (pSnapshotItem) 919 904 { 920 905 /* Handle Ctrl+DoubleClick: */
Note:
See TracChangeset
for help on using the changeset viewer.