Changeset 45691 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 24, 2013 9:58:00 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 85235
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
r45659 r45691 22 22 #include "UIPopupStack.h" 23 23 #include "QIMessageBox.h" 24 #include "VBoxGlobal.h" 24 25 25 26 /* Other VBox includes: */ … … 67 68 const QString &strMessage, const QString &strDetails, 68 69 int iButton1 /*= 0*/, int iButton2 /*= 0*/, 69 const QString &strButtonText1 /* = QString() */, 70 const QString &strButtonText2 /* = QString() */) 70 const QString &strButtonText1 /*= QString()*/, 71 const QString &strButtonText2 /*= QString()*/, 72 bool fProposeAutoConfirmation /*= false*/) 71 73 { 72 74 showPopupPane(pParent, strId, 73 75 strMessage, strDetails, 74 76 iButton1, iButton2, 75 strButtonText1, strButtonText2); 77 strButtonText1, strButtonText2, 78 fProposeAutoConfirmation); 76 79 } 77 80 78 81 void UIPopupCenter::error(QWidget *pParent, const QString &strId, 79 const QString &strMessage, const QString &strDetails) 82 const QString &strMessage, const QString &strDetails, 83 bool fProposeAutoConfirmation /*= false*/) 80 84 { 81 85 message(pParent, strId, 82 86 strMessage, strDetails, 83 AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape); 87 AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape /* 1st button */, 88 0 /* 2nd button */, 89 QString() /* 1st button text */, 90 QString() /* 2nd button text */, 91 fProposeAutoConfirmation); 84 92 } 85 93 86 94 void UIPopupCenter::alert(QWidget *pParent, const QString &strId, 87 const QString &strMessage) 95 const QString &strMessage, 96 bool fProposeAutoConfirmation /*= false*/) 88 97 { 89 98 error(pParent, strId, 90 strMessage, QString()); 99 strMessage, QString(), 100 fProposeAutoConfirmation); 91 101 } 92 102 … … 95 105 int iButton1 /*= 0*/, int iButton2 /*= 0*/, 96 106 const QString &strButtonText1 /*= QString()*/, 97 const QString &strButtonText2 /*= QString()*/) 107 const QString &strButtonText2 /*= QString()*/, 108 bool fProposeAutoConfirmation /*= false*/) 98 109 { 99 110 message(pParent, strId, 100 111 strMessage, QString(), 101 112 iButton1, iButton2, 102 strButtonText1, strButtonText2); 113 strButtonText1, strButtonText2, 114 fProposeAutoConfirmation); 103 115 } 104 116 … … 106 118 const QString &strMessage, 107 119 const QString &strOkButtonText /*= QString()*/, 108 const QString &strCancelButtonText /*= QString()*/) 120 const QString &strCancelButtonText /*= QString()*/, 121 bool fProposeAutoConfirmation /*= false*/) 109 122 { 110 123 question(pParent, strId, … … 113 126 AlertButton_Cancel | AlertButtonOption_Escape, 114 127 strOkButtonText, 115 strCancelButtonText); 128 strCancelButtonText, 129 fProposeAutoConfirmation); 116 130 } 117 131 118 132 void UIPopupCenter::showPopupPane(QWidget *pParent, const QString &strPopupPaneID, 119 const QString &strMessage, const QString &strDetails, 120 int iButton1, int iButton2, 121 const QString &strButtonText1, const QString &strButtonText2) 122 { 133 const QString &strMessage, const QString &strDetails, 134 int iButton1, int iButton2, 135 const QString &strButtonText1, const QString &strButtonText2, 136 bool fProposeAutoConfirmation) 137 { 138 /* Make sure at least one button is valid: */ 139 if (iButton1 == 0 && iButton2 == 0) 140 iButton1 = AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape; 141 142 /* Check if popup-pane was auto-confirmed before: */ 143 if (fProposeAutoConfirmation) 144 { 145 QStringList confirmedPopupList = vboxGlobal().virtualBox().GetExtraData(GUI_SuppressMessages).split(','); 146 if (confirmedPopupList.contains(strPopupPaneID)) 147 { 148 int iResultCode = AlertOption_AutoConfirmed; 149 if (iButton1 & AlertButtonOption_Default) 150 iResultCode |= (iButton1 & AlertButtonMask); 151 else if (iButton2 & AlertButtonOption_Default) 152 iResultCode |= (iButton2 & AlertButtonMask); 153 emit sigPopupPaneDone(strPopupPaneID, iResultCode); 154 return; 155 } 156 } 157 123 158 /* Make sure parent is always set! */ 124 159 AssertMsg(pParent, ("Parent is NULL!")); 125 160 if (!pParent) 126 161 return; 162 127 163 /* Looking for the corresponding popup-stack: */ 128 164 QString strPopupStackID = pParent->metaObject()->className(); … … 140 176 pPopupStack = m_stacks[strPopupStackID] = new UIPopupStack(pParent); 141 177 /* Attach popup-stack connections: */ 142 connect(pPopupStack, SIGNAL(sigPopupPaneDone(QString, int)), this, S IGNAL(sigPopupPaneDone(QString, int)));178 connect(pPopupStack, SIGNAL(sigPopupPaneDone(QString, int)), this, SLOT(sltPopupPaneDone(QString, int))); 143 179 connect(pPopupStack, SIGNAL(sigRemove()), this, SLOT(sltRemovePopupStack())); 144 } 145 /* Show popup-stack: */ 146 pPopupStack->show(); 147 148 /* Make sure at least one button is valid: */ 149 if (iButton1 == 0 && iButton2 == 0) 150 iButton1 = AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape; 180 /* Show popup-stack: */ 181 pPopupStack->show(); 182 } 183 151 184 /* Compose button description map: */ 152 185 QMap<int, QString> buttonDescriptions; … … 156 189 buttonDescriptions[iButton2] = strButtonText2; 157 190 /* Update corresponding popup-pane: */ 158 pPopupStack->updatePopupPane(strPopupPaneID, strMessage, strDetails, buttonDescriptions); 191 pPopupStack->updatePopupPane(strPopupPaneID, strMessage, strDetails, buttonDescriptions, fProposeAutoConfirmation); 192 } 193 194 void UIPopupCenter::sltPopupPaneDone(QString strPopupPaneID, int iResultCode) 195 { 196 /* Was the result auto-confirmated? */ 197 if (iResultCode & AlertOption_AutoConfirmed) 198 { 199 /* Remember auto-confirmation fact: */ 200 QStringList confirmedPopupList = vboxGlobal().virtualBox().GetExtraData(GUI_SuppressMessages).split(','); 201 confirmedPopupList << strPopupPaneID; 202 vboxGlobal().virtualBox().SetExtraData(GUI_SuppressMessages, confirmedPopupList.join(",")); 203 } 204 205 /* Notify listeners: */ 206 emit sigPopupPaneDone(strPopupPaneID, iResultCode); 159 207 } 160 208 … … 195 243 "<p><b>Note</b>: Some applications may behave incorrectly in mouse pointer integration mode. " 196 244 "You can always disable it for the current session (and enable it again) " 197 "by selecting the corresponding action from the menu bar.</p>")); 245 "by selecting the corresponding action from the menu bar.</p>"), 246 true); 198 247 } 199 248 else … … 202 251 tr("<p>The Virtual Machine reports that the guest OS does not support <b>mouse pointer integration</b> " 203 252 "in the current video mode. You need to capture the mouse (by clicking over the VM display " 204 "or pressing the host key) in order to use the mouse inside the guest OS.</p>")); 205 } 206 } 207 253 "or pressing the host key) in order to use the mouse inside the guest OS.</p>"), 254 true); 255 } 256 } 257 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h
r45659 r45691 36 36 signals: 37 37 38 /* Notifier: Popup-pane donestuff: */39 void sigPopupPaneDone(QString str ID, int iButtonCode);38 /* Notifier: Popup-pane stuff: */ 39 void sigPopupPaneDone(QString strPopupPaneID, int iResultCode); 40 40 41 41 public: … … 52 52 int iButton1 = 0, int iButton2 = 0, 53 53 const QString &strButtonText1 = QString(), 54 const QString &strButtonText2 = QString()); 54 const QString &strButtonText2 = QString(), 55 bool fProposeAutoConfirmation = false); 55 56 56 57 /* API: Wrapper to 'message' function. 57 58 * Provides single OK button: */ 58 59 void error(QWidget *pParent, const QString &strId, 59 const QString &strMessage, const QString &strDetails); 60 const QString &strMessage, const QString &strDetails, 61 bool fProposeAutoConfirmation = false); 60 62 61 63 /* API: Wrapper to 'error' function. 62 64 * Omits details: */ 63 65 void alert(QWidget *pParent, const QString &strId, 64 const QString &strMessage); 66 const QString &strMessage, 67 bool fProposeAutoConfirmation = false); 65 68 66 69 /* API: Wrapper to 'message' function. … … 71 74 int iButton1 = 0, int iButton2 = 0, 72 75 const QString &strButtonText1 = QString(), 73 const QString &strButtonText2 = QString()); 76 const QString &strButtonText2 = QString(), 77 bool fProposeAutoConfirmation = false); 74 78 75 79 /* API: Wrapper to 'question' function, … … 78 82 const QString &strMessage, 79 83 const QString &strOkButtonText = QString(), 80 const QString &strCancelButtonText = QString()); 84 const QString &strCancelButtonText = QString(), 85 bool fProposeAutoConfirmation = false); 81 86 82 87 /* API: Runtime UI stuff: */ … … 84 89 85 90 private slots: 91 92 /* Handler: Popup-pane stuff: */ 93 void sltPopupPaneDone(QString strPopupPaneID, int iResultCode); 86 94 87 95 /* Handler: Popup-stack stuff: */ … … 98 106 const QString &strMessage, const QString &strDetails, 99 107 int iButton1, int iButton2, 100 const QString &strButtonText1, const QString &strButtonText2); 108 const QString &strButtonText1, const QString &strButtonText2, 109 bool fProposeAutoConfirmation); 101 110 102 111 /* Variable: Popup-stack stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.cpp
r45663 r45691 22 22 #include <QVBoxLayout> 23 23 #include <QLabel> 24 #include <QCheckBox> 24 25 #include <QKeyEvent> 25 26 #include <QPainter> … … 29 30 30 31 /* GUI includes: */ 32 #include "QIWithRetranslateUI.h" 31 33 #include "UIPopupPane.h" 32 34 #include "UIIconPool.h" … … 114 116 115 117 /* Popup-pane text-pane prototype class: */ 116 class UIPopupPaneTextPane : public Q Widget118 class UIPopupPaneTextPane : public QIWithRetranslateUI<QWidget> 117 119 { 118 120 Q_OBJECT; … … 138 140 void setText(const QString &strText); 139 141 140 /* API: Set desired width: */142 /* API: Desired-width stuff: */ 141 143 void setDesiredWidth(int iDesiredWidth); 144 145 /* API: Auto-confirmation stuff: */ 146 void setProposeAutoConfirmation(bool fPropose); 147 bool autoConfirmationProposed() const; 148 bool isAutoConfirmed() const; 142 149 143 150 /* API: Size-hint stuff: */ 144 151 QSize minimumSizeHint() const; 145 152 void setMinimumSizeHint(const QSize &minimumSizeHint); 153 void layoutContent(); 146 154 147 155 private slots: … … 150 158 void sltFocusEnter(); 151 159 void sltFocusLeave(); 152 160 153 161 private: 154 162 155 /* Helpers s: Prepare stuff: */163 /* Helpers: Prepare stuff: */ 156 164 void prepare(); 157 165 void prepareContent(); 166 167 /* Helper: Translate stuff: */ 168 void retranslateUi(); 158 169 159 170 /* Helper: Size-hint stuff: */ … … 162 173 void updateSizeHint(); 163 174 164 /* Variables: Label stuff: */165 QLabel *m_pLabel;166 int m_iDesiredWidth;167 168 175 /* Variables: Size-hint stuff: */ 176 const int m_iLayoutMargin; 177 const int m_iLayoutSpacing; 178 QSize m_labelSizeHint; 179 QSize m_checkBoxSizeHint; 169 180 QSize m_collapsedSizeHint; 170 181 QSize m_expandedSizeHint; 171 182 QSize m_minimumSizeHint; 183 184 /* Variables: Widget stuff: */ 185 QLabel *m_pLabel; 186 int m_iDesiredLabelWidth; 187 QCheckBox *m_pAutoConfirmCheckBox; 188 bool m_fProposeAutoConfirmation; 172 189 173 190 /* Variables: Animation stuff: */ … … 227 244 UIPopupPane::UIPopupPane(QWidget *pParent, 228 245 const QString &strMessage, const QString &strDetails, 229 const QMap<int, QString> &buttonDescriptions) 246 const QMap<int, QString> &buttonDescriptions, 247 bool fProposeAutoConfirmation) 230 248 : QWidget(pParent) 231 249 , m_iLayoutMargin(10), m_iLayoutSpacing(5) 232 , m_strMessage(strMessage), m_strDetails(strDetails), m_buttonDescriptions(buttonDescriptions) 250 , m_strMessage(strMessage), m_strDetails(strDetails) 251 , m_fProposeAutoConfirmation(fProposeAutoConfirmation) 252 , m_buttonDescriptions(buttonDescriptions) 233 253 , m_fHovered(false) 234 254 , m_iDefaultOpacity(128) … … 261 281 /* Fetch new details: */ 262 282 m_strDetails = strDetails; 283 } 284 285 void UIPopupPane::setProposeAutoConfirmation(bool fPropose) 286 { 287 /* Make sure something changed: */ 288 if (m_fProposeAutoConfirmation == fPropose) 289 return; 290 291 /* Fetch new auto-confirmation proposal: */ 292 m_fProposeAutoConfirmation = fPropose; 293 m_pTextPane->setProposeAutoConfirmation(m_fProposeAutoConfirmation); 263 294 } 264 295 … … 336 367 m_pTextPane->resize(iTextPaneWidth, 337 368 iTextPaneHeight); 369 m_pTextPane->layoutContent(); 338 370 /* Button-box: */ 339 371 m_pButtonPane->move(m_iLayoutMargin + iTextPaneWidth + m_iLayoutSpacing, … … 370 402 m_pTextPane->installEventFilter(this); 371 403 m_pTextPane->setText(m_strMessage); 404 m_pTextPane->setProposeAutoConfirmation(m_fProposeAutoConfirmation); 372 405 } 373 406 /* Create button-box: */ … … 474 507 } 475 508 476 void UIPopupPane::done(int i ButtonCode)509 void UIPopupPane::done(int iResultCode) 477 510 { 478 511 /* Close the window: */ 479 512 close(); 480 513 514 /* Was the popup auto-confirmed? */ 515 if (m_pTextPane->isAutoConfirmed()) 516 iResultCode |= AlertOption_AutoConfirmed; 517 481 518 /* Notify listeners: */ 482 emit sigDone(i ButtonCode);519 emit sigDone(iResultCode); 483 520 } 484 521 485 522 486 523 UIPopupPaneTextPane::UIPopupPaneTextPane(QWidget *pParent /*= 0*/) 487 : QWidget(pParent) 524 : QIWithRetranslateUI<QWidget>(pParent) 525 , m_iLayoutMargin(0) 526 , m_iLayoutSpacing(10) 488 527 , m_pLabel(0) 489 , m_iDesiredWidth(-1) 528 , m_iDesiredLabelWidth(-1) 529 , m_pAutoConfirmCheckBox(0) 530 , m_fProposeAutoConfirmation(false) 490 531 , m_fFocused(false) 491 532 , m_pAnimation(0) … … 500 541 if (m_pLabel->text() == strText) 501 542 return; 502 /* Update the pane for new text: */543 /* Update the pane for the new text: */ 503 544 m_pLabel->setText(strText); 504 545 updateSizeHint(); … … 508 549 { 509 550 /* Make sure the desired-width is changed: */ 510 if (m_iDesired Width == iDesiredWidth)511 return; 512 /* Update the pane for new desired-width: */513 m_iDesired Width = iDesiredWidth;551 if (m_iDesiredLabelWidth == iDesiredWidth) 552 return; 553 /* Update the pane for the new desired-width: */ 554 m_iDesiredLabelWidth = iDesiredWidth; 514 555 updateSizeHint(); 515 556 } 516 557 558 void UIPopupPaneTextPane::setProposeAutoConfirmation(bool fPropose) 559 { 560 /* Make sure the auto-confirmation-proposal is changed: */ 561 if (m_fProposeAutoConfirmation == fPropose) 562 return; 563 /* Update the pane for the new auto-confirmation-proposal: */ 564 m_fProposeAutoConfirmation = fPropose; 565 updateSizeHint(); 566 } 567 568 bool UIPopupPaneTextPane::autoConfirmationProposed() const 569 { 570 return m_fProposeAutoConfirmation; 571 } 572 573 bool UIPopupPaneTextPane::isAutoConfirmed() const 574 { 575 return autoConfirmationProposed() && 576 m_pAutoConfirmCheckBox && 577 m_pAutoConfirmCheckBox->isChecked(); 578 } 579 517 580 QSize UIPopupPaneTextPane::minimumSizeHint() const 518 581 { 519 582 /* Check if desired-width set: */ 520 if (m_iDesired Width >= 0)521 /* Return dependent size-hint: */583 if (m_iDesiredLabelWidth >= 0) 584 /* Dependent size-hint: */ 522 585 return m_minimumSizeHint; 523 /* Return golden-rule minimumsize-hint by default: */524 return m_pLabel->minimumSizeHint();586 /* Golden-rule size-hint by default: */ 587 return QWidget::minimumSizeHint(); 525 588 } 526 589 … … 536 599 } 537 600 601 void UIPopupPaneTextPane::layoutContent() 602 { 603 /* Variables: */ 604 const int iWidth = width(); 605 const int iHeight = height(); 606 const int iLabelWidth = m_labelSizeHint.width(); 607 const int iLabelHeight = m_labelSizeHint.height(); 608 /* Label: */ 609 m_pLabel->move(m_iLayoutMargin, m_iLayoutMargin); 610 m_pLabel->resize(qMin(iWidth, iLabelWidth), qMin(iHeight, iLabelHeight)); 611 612 /* Check-box: */ 613 if (m_fProposeAutoConfirmation) 614 { 615 /* Variables: */ 616 const int iCheckBoxWidth = m_checkBoxSizeHint.width(); 617 const int iCheckBoxHeight = m_checkBoxSizeHint.height(); 618 const int iCheckBoxY = m_iLayoutMargin + iLabelHeight + m_iLayoutSpacing; 619 /* Layout check-box: */ 620 if (iHeight - m_iLayoutMargin - iCheckBoxHeight - iCheckBoxY >= 0) 621 { 622 m_pAutoConfirmCheckBox->move(m_iLayoutMargin, iCheckBoxY); 623 m_pAutoConfirmCheckBox->resize(iCheckBoxWidth, iCheckBoxHeight); 624 if (m_pAutoConfirmCheckBox->isHidden()) 625 m_pAutoConfirmCheckBox->show(); 626 } 627 else if (!m_pAutoConfirmCheckBox->isHidden()) 628 m_pAutoConfirmCheckBox->hide(); 629 } 630 else if (!m_pAutoConfirmCheckBox->isHidden()) 631 m_pAutoConfirmCheckBox->hide(); 632 } 633 538 634 void UIPopupPaneTextPane::sltFocusEnter() 539 635 { 636 /* Ignore if already focused: */ 637 if (m_fFocused) 638 return; 639 640 /* Update focus state: */ 641 m_fFocused = true; 642 643 /* Notify listeners: */ 644 emit sigFocusEnter(); 645 } 646 647 void UIPopupPaneTextPane::sltFocusLeave() 648 { 649 /* Ignore if already unfocused: */ 540 650 if (!m_fFocused) 541 { 542 m_fFocused = true; 543 emit sigFocusEnter(); 544 } 545 } 546 547 void UIPopupPaneTextPane::sltFocusLeave() 548 { 549 if (m_fFocused) 550 { 551 m_fFocused = false; 552 emit sigFocusLeave(); 553 } 651 return; 652 653 /* Update focus state: */ 654 m_fFocused = false; 655 656 /* Notify listeners: */ 657 emit sigFocusLeave(); 554 658 } 555 659 … … 565 669 void UIPopupPaneTextPane::prepareContent() 566 670 { 567 /* Create main layout: */ 568 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 569 { 570 /* Prepare layout: */ 571 pMainLayout->setContentsMargins(0, 0, 0, 0); 572 pMainLayout->setSpacing(0); 573 /* Create label: */ 574 m_pLabel = new QLabel; 671 /* Create label: */ 672 m_pLabel = new QLabel(this); 673 { 674 /* Prepare label: */ 675 QFont currentFont = m_pLabel->font(); 676 #ifdef Q_WS_MAC 677 currentFont.setPointSize(currentFont.pointSize() - 2); 678 #else /* Q_WS_MAC */ 679 currentFont.setPointSize(currentFont.pointSize() - 1); 680 #endif /* !Q_WS_MAC */ 681 m_pLabel->setFont(currentFont); 682 m_pLabel->setWordWrap(true); 683 } 684 /* Create check-box: */ 685 m_pAutoConfirmCheckBox = new QCheckBox(this); 686 { 687 /* Prepare check-box: */ 688 QFont currentFont = m_pAutoConfirmCheckBox->font(); 689 #ifdef Q_WS_MAC 690 currentFont.setPointSize(currentFont.pointSize() - 2); 691 #else /* Q_WS_MAC */ 692 currentFont.setPointSize(currentFont.pointSize() - 1); 693 #endif /* !Q_WS_MAC */ 694 m_pAutoConfirmCheckBox->setFont(currentFont); 695 } 696 /* Translate UI finally: */ 697 retranslateUi(); 698 } 699 700 void UIPopupPaneTextPane::retranslateUi() 701 { 702 /* Translate auto-confirm check-box: */ 703 m_pAutoConfirmCheckBox->setText(QApplication::translate("UIMessageCenter", "Do not show this message again")); 704 } 705 706 void UIPopupPaneTextPane::updateSizeHint() 707 { 708 /* Recalculate collapsed size-hint: */ 709 { 710 /* Collapsed size-hint contains only one-text-line label: */ 711 QFontMetrics fm(m_pLabel->font(), m_pLabel); 712 m_collapsedSizeHint = QSize(m_iDesiredLabelWidth, fm.height()); 713 } 714 715 /* Recalculate expanded size-hint: */ 716 { 717 /* Recalculate label size-hint: */ 718 m_labelSizeHint = QSize(m_iDesiredLabelWidth, m_pLabel->heightForWidth(m_iDesiredLabelWidth)); 719 /* Recalculate check-box size-hint: */ 720 m_checkBoxSizeHint = m_fProposeAutoConfirmation ? m_pAutoConfirmCheckBox->sizeHint() : QSize(); 721 /* Expanded size-hint contains full-size label: */ 722 m_expandedSizeHint = m_labelSizeHint; 723 /* Expanded size-hint can contain check-box: */ 724 if (m_checkBoxSizeHint.isValid()) 575 725 { 576 /* Add into layout: */ 577 pMainLayout->addWidget(m_pLabel); 578 /* Prepare label: */ 579 QFont currentFont = m_pLabel->font(); 580 #ifdef Q_WS_MAC 581 currentFont.setPointSize(currentFont.pointSize() - 2); 582 #else /* Q_WS_MAC */ 583 currentFont.setPointSize(currentFont.pointSize() - 1); 584 #endif /* !Q_WS_MAC */ 585 m_pLabel->setFont(currentFont); 586 m_pLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); 587 m_pLabel->setWordWrap(true); 726 m_expandedSizeHint.setWidth(qMax(m_expandedSizeHint.width(), m_checkBoxSizeHint.width())); 727 m_expandedSizeHint.setHeight(m_expandedSizeHint.height() + m_iLayoutSpacing + m_checkBoxSizeHint.height()); 588 728 } 589 729 } 590 } 591 592 void UIPopupPaneTextPane::updateSizeHint() 593 { 594 /* Recalculate size-hints: */ 595 QFontMetrics fm(m_pLabel->font(), m_pLabel); 596 m_collapsedSizeHint = QSize(m_iDesiredWidth, fm.height()); 597 m_expandedSizeHint = QSize(m_iDesiredWidth, m_pLabel->heightForWidth(m_iDesiredWidth)); 730 731 /* Update current size-hint: */ 598 732 m_minimumSizeHint = m_fFocused ? m_expandedSizeHint : m_collapsedSizeHint; 599 /* Reinstall animation: */ 733 734 /* And reinstall size-hint animation: */ 600 735 delete m_pAnimation; 601 736 m_pAnimation = UIAnimationFramework::installPropertyAnimation(this, "minimumSizeHint", "collapsedSizeHint", "expandedSizeHint", -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h
r45662 r45691 71 71 72 72 /* Notifier: Complete stuff: */ 73 void sigDone(int i ButtonCode) const;73 void sigDone(int iResultCode) const; 74 74 75 75 public: … … 78 78 UIPopupPane(QWidget *pParent, 79 79 const QString &strMessage, const QString &strDetails, 80 const QMap<int, QString> &buttonDescriptions); 80 const QMap<int, QString> &buttonDescriptions, 81 bool fProposeAutoConfirmation); 81 82 82 83 /* API: Text stuff: */ 83 84 void setMessage(const QString &strMessage); 84 85 void setDetails(const QString &strDetails); 86 87 /* API: Auto-confirmation stuff: */ 88 void setProposeAutoConfirmation(bool fPropose); 85 89 86 90 /* API: Layout stuff: */ … … 109 113 110 114 /* Helper: Complete stuff: */ 111 void done(int i ButtonCode);115 void done(int iResultCode); 112 116 113 117 /* Property: Hover stuff: */ … … 122 126 /* Variables: Text stuff: */ 123 127 QString m_strMessage, m_strDetails; 128 129 /* Variables: Auto-confirmation stuff: */ 130 bool m_fProposeAutoConfirmation; 124 131 125 132 /* Variables: Button stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp
r45662 r45691 42 42 void UIPopupStack::updatePopupPane(const QString &strPopupPaneID, 43 43 const QString &strMessage, const QString &strDetails, 44 const QMap<int, QString> &buttonDescriptions) 44 const QMap<int, QString> &buttonDescriptions, 45 bool fProposeAutoConfirmation) 45 46 { 46 47 /* Looking for the corresponding popup-pane: */ … … 51 52 /* Get existing one: */ 52 53 pPopupPane = m_panes[strPopupPaneID]; 53 /* And update message and details: */54 /* Update message and details: */ 54 55 pPopupPane->setMessage(strMessage); 55 56 pPopupPane->setDetails(strDetails); … … 61 62 pPopupPane = m_panes[strPopupPaneID] = new UIPopupPane(this, 62 63 strMessage, strDetails, 63 buttonDescriptions); 64 buttonDescriptions, 65 fProposeAutoConfirmation); 64 66 /* Attach popup-pane connection: */ 65 67 connect(pPopupPane, SIGNAL(sigSizeHintChanged()), this, SLOT(sltAdjustGeometry())); … … 90 92 } 91 93 92 void UIPopupStack::sltPopupPaneDone(int i ButtonCode)94 void UIPopupStack::sltPopupPaneDone(int iResultCode) 93 95 { 94 96 /* Make sure the sender is the popup-pane: */ … … 109 111 110 112 /* Notify listeners about popup-pane: */ 111 emit sigPopupPaneDone(strPopupPaneID, i ButtonCode);113 emit sigPopupPaneDone(strPopupPaneID, iResultCode); 112 114 113 115 /* Cleanup the popup-pane: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.h
r45662 r45691 35 35 36 36 /* Notifier: Popup-pane stuff: */ 37 void sigPopupPaneDone(QString strID, int i ButtonCode);37 void sigPopupPaneDone(QString strID, int iResultCode); 38 38 39 39 /* Notifier: Popup-stack stuff: */ … … 48 48 void updatePopupPane(const QString &strPopupPaneID, 49 49 const QString &strMessage, const QString &strDetails, 50 const QMap<int, QString> &buttonDescriptions); 50 const QMap<int, QString> &buttonDescriptions, 51 bool fProposeAutoConfirmation); 51 52 52 53 private slots:
Note:
See TracChangeset
for help on using the changeset viewer.