Changeset 45605 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 18, 2013 1:09:08 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 85102
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc
r41461 r45605 243 243 <file alias="restore_16px.png">images/restore_16px.png</file> 244 244 <file alias="close_16px.png">images/close_16px.png</file> 245 <file alias="ok_16px.png">images/ok_16px.png</file> 246 <file alias="cancel_16px.png">images/cancel_16px.png</file> 245 247 </qresource> 246 248 </RCC> -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
r45586 r45605 158 158 if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0) 159 159 iButton1 = AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape; 160 /* Compose button description map: */ 161 QMap<int, QString> buttonDescriptions; 162 if (iButton1 != 0 && !buttonDescriptions.contains(iButton1)) 163 buttonDescriptions[iButton1] = strButtonText1; 164 if (iButton2 != 0 && !buttonDescriptions.contains(iButton2)) 165 buttonDescriptions[iButton2] = strButtonText2; 166 if (iButton3 != 0 && !buttonDescriptions.contains(iButton3)) 167 buttonDescriptions[iButton3] = strButtonText3; 160 168 /* Create popup-pane and insert it into our map: */ 161 169 QWidget *pPopupBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown()); 162 pPopupPane = new UIPopupPane(pPopupBoxParent, strId, 163 strMessage, strDetails, 164 iButton1, iButton2, iButton3, 165 strButtonText1, strButtonText2, strButtonText3); 170 pPopupPane = new UIPopupPane(pPopupBoxParent, strId, strMessage, strDetails, buttonDescriptions); 166 171 m_popups.insert(strId, pPopupPane); 167 172 /* Attach popup-pane connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.cpp
r45592 r45605 19 19 20 20 /* Qt includes: */ 21 #include <QHBoxLayout> 21 22 #include <QVBoxLayout> 22 23 #include <QLabel> 23 24 #include <QPushButton> 24 25 #include <QEvent> 26 #include <QKeyEvent> 25 27 #include <QMainWindow> 26 28 #include <QStatusBar> … … 32 34 /* GUI includes: */ 33 35 #include "UIPopupPane.h" 34 #include "QIDialogButtonBox.h" 36 #include "UIIconPool.h" 37 #include "QIToolButton.h" 35 38 36 39 /* Other VBox includes: */ … … 129 132 public: 130 133 131 /* Constructor /destructor: */134 /* Constructor: */ 132 135 UIPopupPaneFrame(QWidget *pParent = 0); 133 ~UIPopupPaneFrame();134 136 135 137 private: 136 138 137 /* Helper s: Prepare/cleanupstuff: */139 /* Helper: Prepare stuff: */ 138 140 void prepare(); 139 void cleanup(); 140 141 /* Handlers: Event stuff: */ 141 142 /* Handler: Event stuff: */ 142 143 void paintEvent(QPaintEvent *pEvent); 143 144 … … 170 171 public: 171 172 172 /* Constructor /destructor: */173 /* Constructor: */ 173 174 UIPopupPaneTextPane(QWidget *pParent = 0); 174 ~UIPopupPaneTextPane();175 175 176 176 /* API: Text stuff: */ … … 192 192 private: 193 193 194 /* Helpers : Prepare/cleanupstuff: */194 /* Helperss: Prepare stuff: */ 195 195 void prepare(); 196 void cleanup();197 198 /* Helper: Content stuff: */199 196 void prepareContent(); 200 197 … … 219 216 220 217 218 /* Popup-pane button-pane prototype class: */ 219 class UIPopupPaneButtonPane : public QWidget 220 { 221 Q_OBJECT; 222 223 signals: 224 225 /* Notifier: Button stuff: */ 226 void sigButtonClicked(int iButtonID); 227 228 public: 229 230 /* Constructor: */ 231 UIPopupPaneButtonPane(QWidget *pParent = 0); 232 233 /* API: Button stuff: */ 234 void setButtons(const QMap<int, QString> &buttonDescriptions); 235 236 private slots: 237 238 /* Handler: Button stuff: */ 239 void sltButtonClicked(); 240 241 private: 242 243 /* Helpers: Prepare/cleanup stuff: */ 244 void prepare(); 245 void prepareLayouts(); 246 void prepareButtons(); 247 void cleanupButtons(); 248 249 /* Handler: Event stuff: */ 250 void keyPressEvent(QKeyEvent *pEvent); 251 252 /* Static helpers: Button stuff: */ 253 static QIToolButton* addButton(int iButtonID, const QString &strToolTip); 254 static QString defaultToolTip(int iButtonID); 255 static QIcon defaultIcon(int iButtonID); 256 257 /* Widgets: */ 258 QHBoxLayout *m_pButtonLayout; 259 QMap<int, QString> m_buttonDescriptions; 260 QMap<int, QIToolButton*> m_buttons; 261 int m_iDefaultButton; 262 int m_iEscapeButton; 263 }; 264 265 221 266 UIPopupPane::UIPopupPane(QWidget *pParent, const QString &strId, 222 267 const QString &strMessage, const QString &strDetails, 223 int iButton1, int iButton2, int iButton3, 224 const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3) 268 const QMap<int, QString> &buttonDescriptions) 225 269 : QWidget(pParent) 226 270 , m_fPolished(false) … … 228 272 , m_iMainLayoutMargin(2), m_iMainFrameLayoutMargin(10), m_iMainFrameLayoutSpacing(5) 229 273 , m_iParentStatusBarHeight(parentStatusBarHeight(pParent)) 230 , m_strMessage(strMessage), m_strDetails(strDetails) 231 , m_iButton1(iButton1), m_iButton2(iButton2), m_iButton3(iButton3) 232 , m_strButtonText1(strButtonText1), m_strButtonText2(strButtonText2), m_strButtonText3(strButtonText3) 233 , m_iButtonEsc(0) 234 , m_fHovered(false) 235 , m_fFocused(false) 236 , m_pMainFrame(0), m_pTextPane(0), m_pButtonBox(0) 237 , m_pButton1(0), m_pButton2(0), m_pButton3(0) 274 , m_strMessage(strMessage), m_strDetails(strDetails), m_buttonDescriptions(buttonDescriptions) 275 , m_fHovered(false) , m_fFocused(false) 276 , m_pMainFrame(0), m_pTextPane(0), m_pButtonPane(0) 238 277 { 239 278 /* Prepare: */ 240 279 prepare(); 241 }242 243 UIPopupPane::~UIPopupPane()244 {245 /* Cleanup: */246 cleanup();247 280 } 248 281 … … 266 299 /* Fetch new details: */ 267 300 m_strDetails = strDetails; 301 } 302 303 void UIPopupPane::sltButtonClicked(int iButtonID) 304 { 305 done(iButtonID & AlertButtonMask); 268 306 } 269 307 … … 295 333 } 296 334 297 void UIPopupPane::cleanup() 298 { 335 void UIPopupPane::prepareContent() 336 { 337 /* Prepare this: */ 338 installEventFilter(this); 339 /* Create main-frame: */ 340 m_pMainFrame = new UIPopupPaneFrame(this); 341 { 342 /* Prepare frame: */ 343 m_pMainFrame->installEventFilter(this); 344 m_pMainFrame->setFocusPolicy(Qt::StrongFocus); 345 /* Create message-label: */ 346 m_pTextPane = new UIPopupPaneTextPane(m_pMainFrame); 347 { 348 /* Prepare label: */ 349 connect(m_pTextPane, SIGNAL(sigSizeChanged()), 350 this, SLOT(sltAdjustGeomerty())); 351 m_pTextPane->installEventFilter(this); 352 m_pTextPane->setFocusPolicy(Qt::StrongFocus); 353 m_pTextPane->setText(m_strMessage); 354 } 355 /* Create button-box: */ 356 m_pButtonPane = new UIPopupPaneButtonPane(m_pMainFrame); 357 { 358 /* Prepare button-box: */ 359 connect(m_pButtonPane, SIGNAL(sigButtonClicked(int)), 360 this, SLOT(sltButtonClicked(int))); 361 m_pButtonPane->installEventFilter(this); 362 m_pButtonPane->setButtons(m_buttonDescriptions); 363 m_pButtonPane->setFocusPolicy(Qt::StrongFocus); 364 m_pMainFrame->setFocusProxy(m_pButtonPane); 365 m_pTextPane->setFocusProxy(m_pButtonPane); 366 } 367 } 299 368 } 300 369 … … 349 418 case QEvent::FocusOut: 350 419 { 351 if (m_fFocused && (pWatched == m_pButton1 || 352 pWatched == m_pButton2 || 353 pWatched == m_pButton3)) 420 if (m_fFocused) 354 421 { 355 422 m_fFocused = false; … … 385 452 } 386 453 387 void UIPopupPane::keyPressEvent(QKeyEvent *pEvent)388 {389 /* Preprocess Escape key: */390 if (pEvent->key() == Qt::Key_Escape && m_iButtonEsc)391 {392 done(m_iButtonEsc);393 return;394 }395 /* Handle all the other keys: */396 QWidget::keyPressEvent(pEvent);397 }398 399 454 int UIPopupPane::minimumWidthHint() const 400 455 { … … 411 466 iMinimumWidthHint += m_pTextPane->width(); 412 467 iMinimumWidthHint += m_iMainFrameLayoutSpacing; 413 iMinimumWidthHint += m_pButton Box->minimumSizeHint().width();468 iMinimumWidthHint += m_pButtonPane->minimumSizeHint().width(); 414 469 } 415 470 } … … 432 487 /* Take into account widgets: */ 433 488 const int iTextPaneHeight = m_pTextPane->height(); 434 const int iButtonBoxHeight = m_pButton Box->minimumSizeHint().height();489 const int iButtonBoxHeight = m_pButtonPane->minimumSizeHint().height(); 435 490 iMinimumHeightHint += qMax(iTextPaneHeight, iButtonBoxHeight); 436 491 } … … 456 511 m_pTextPane->setDesiredWidth(iWidth - 2 * m_iMainLayoutMargin 457 512 - 2 * m_iMainFrameLayoutMargin 458 - m_pButton Box->minimumSizeHint().width());513 - m_pButtonPane->minimumSizeHint().width()); 459 514 } 460 515 … … 481 536 const int iTextPaneWidth = m_pTextPane->width(); 482 537 const int iTextPaneHeight = m_pTextPane->height(); 483 const QSize buttonBoxMinimumSizeHint = m_pButton Box->minimumSizeHint();538 const QSize buttonBoxMinimumSizeHint = m_pButtonPane->minimumSizeHint(); 484 539 const int iButtonBoxWidth = buttonBoxMinimumSizeHint.width(); 485 540 const int iButtonBoxHeight = buttonBoxMinimumSizeHint.height(); … … 493 548 m_pTextPane->resize(iTextPaneWidth, iTextPaneHeight); 494 549 /* Button-box: */ 495 m_pButton Box->move(m_iMainFrameLayoutMargin + iTextPaneWidth + m_iMainFrameLayoutSpacing,496 m_iMainFrameLayoutMargin);497 m_pButton Box->resize(iButtonBoxWidth,498 iMainFrameHeight - 2 * m_iMainFrameLayoutMargin);550 m_pButtonPane->move(m_iMainFrameLayoutMargin + iTextPaneWidth + m_iMainFrameLayoutSpacing, 551 m_iMainFrameLayoutMargin); 552 m_pButtonPane->resize(iButtonBoxWidth, 553 iMainFrameHeight - 2 * m_iMainFrameLayoutMargin); 499 554 } 500 }501 }502 503 void UIPopupPane::prepareContent()504 {505 /* Prepare this: */506 installEventFilter(this);507 /* Create main-frame: */508 m_pMainFrame = new UIPopupPaneFrame(this);509 {510 /* Prepare frame: */511 m_pMainFrame->installEventFilter(this);512 m_pMainFrame->setFocusPolicy(Qt::StrongFocus);513 /* Create message-label: */514 m_pTextPane = new UIPopupPaneTextPane(m_pMainFrame);515 {516 /* Prepare label: */517 connect(m_pTextPane, SIGNAL(sigSizeChanged()),518 this, SLOT(sltAdjustGeomerty()));519 m_pTextPane->installEventFilter(this);520 m_pTextPane->setFocusPolicy(Qt::StrongFocus);521 m_pTextPane->setText(m_strMessage);522 }523 /* Create button-box: */524 m_pButtonBox = new QIDialogButtonBox(m_pMainFrame);525 {526 /* Prepare button-box: */527 m_pButtonBox->installEventFilter(this);528 m_pButtonBox->setOrientation(Qt::Vertical);529 prepareButtons();530 }531 }532 }533 534 void UIPopupPane::prepareButtons()535 {536 /* Prepare descriptions: */537 QList<int> descriptions;538 descriptions << m_iButton1 << m_iButton2 << m_iButton3;539 540 /* Choose 'escape' button: */541 foreach (int iButton, descriptions)542 if (iButton & AlertButtonOption_Escape)543 {544 m_iButtonEsc = iButton & AlertButtonMask;545 break;546 }547 548 /* Create buttons: */549 QList<QPushButton*> buttons = createButtons(m_pButtonBox, descriptions);550 551 /* Install focus-proxy into the 'default' button: */552 foreach (QPushButton *pButton, buttons)553 if (pButton && pButton->isDefault())554 {555 m_pMainFrame->setFocusProxy(pButton);556 m_pTextPane->setFocusProxy(pButton);557 break;558 }559 560 /* Prepare button 1: */561 m_pButton1 = buttons[0];562 if (m_pButton1)563 {564 m_pButton1->installEventFilter(this);565 connect(m_pButton1, SIGNAL(clicked()), SLOT(done1()));566 if (!m_strButtonText1.isEmpty())567 m_pButton1->setText(m_strButtonText1);568 }569 /* Prepare button 2: */570 m_pButton2 = buttons[1];571 if (m_pButton2)572 {573 m_pButton2->installEventFilter(this);574 connect(m_pButton2, SIGNAL(clicked()), SLOT(done2()));575 if (!m_strButtonText2.isEmpty())576 m_pButton1->setText(m_strButtonText2);577 }578 /* Prepare button 3: */579 m_pButton3 = buttons[2];580 if (m_pButton3)581 {582 m_pButton3->installEventFilter(this);583 connect(m_pButton3, SIGNAL(clicked()), SLOT(done3()));584 if (!m_strButtonText3.isEmpty())585 m_pButton1->setText(m_strButtonText3);586 555 } 587 556 } … … 607 576 } 608 577 609 /* static */610 QList<QPushButton*> UIPopupPane::createButtons(QIDialogButtonBox *pButtonBox, const QList<int> descriptions)611 {612 /* Create button according descriptions: */613 QList<QPushButton*> buttons;614 foreach (int iButton, descriptions)615 buttons << createButton(pButtonBox, iButton);616 /* Return buttons: */617 return buttons;618 }619 620 /* static */621 QPushButton* UIPopupPane::createButton(QIDialogButtonBox *pButtonBox, int iButton)622 {623 /* Null for AlertButton_NoButton: */624 if (iButton == 0)625 return 0;626 627 /* Prepare button text & role: */628 QString strText;629 QDialogButtonBox::ButtonRole role;630 switch (iButton & AlertButtonMask)631 {632 case AlertButton_Ok: strText = QIMessageBox::tr("OK"); role = QDialogButtonBox::AcceptRole; break;633 case AlertButton_Cancel: strText = QIMessageBox::tr("Cancel"); role = QDialogButtonBox::RejectRole; break;634 case AlertButton_Choice1: strText = QIMessageBox::tr("Yes"); role = QDialogButtonBox::YesRole; break;635 case AlertButton_Choice2: strText = QIMessageBox::tr("No"); role = QDialogButtonBox::NoRole; break;636 default: return 0;637 }638 639 /* Create push-button: */640 QPushButton *pButton = pButtonBox->addButton(strText, role);641 642 /* Configure button: */643 pButton->setFocusPolicy(Qt::StrongFocus);644 645 /* Configure 'default' button: */646 if (iButton & AlertButtonOption_Default)647 pButton->setDefault(true);648 649 /* Return button: */650 return pButton;651 }652 653 578 654 579 UIPopupPaneFrame::UIPopupPaneFrame(QWidget *pParent /*= 0*/) … … 661 586 /* Prepare: */ 662 587 prepare(); 663 }664 665 UIPopupPaneFrame::~UIPopupPaneFrame()666 {667 /* Cleanup: */668 cleanup();669 588 } 670 589 … … 680 599 m_iDefaultOpacity, m_iHoveredOpacity, m_iHoverAnimationDuration, 681 600 SIGNAL(sigHoverEnter()), SIGNAL(sigHoverLeave())); 682 }683 684 void UIPopupPaneFrame::cleanup()685 {686 601 } 687 602 … … 732 647 } 733 648 734 UIPopupPaneTextPane::~UIPopupPaneTextPane()735 {736 /* Cleanup: */737 cleanup();738 }739 740 649 void UIPopupPaneTextPane::setText(const QString &strText) 741 650 { … … 803 712 /* Prepare content: */ 804 713 prepareContent(); 805 }806 807 void UIPopupPaneTextPane::cleanup()808 {809 714 } 810 715 … … 854 759 } 855 760 761 762 UIPopupPaneButtonPane::UIPopupPaneButtonPane(QWidget *pParent /*= 0*/) 763 : QWidget(pParent) 764 , m_iDefaultButton(0) 765 , m_iEscapeButton(0) 766 { 767 /* Prepare: */ 768 prepare(); 769 } 770 771 void UIPopupPaneButtonPane::setButtons(const QMap<int, QString> &buttonDescriptions) 772 { 773 /* Make sure something changed: */ 774 if (m_buttonDescriptions == buttonDescriptions) 775 return; 776 777 /* Assign new button-descriptions: */ 778 m_buttonDescriptions = buttonDescriptions; 779 /* Recreate buttons: */ 780 cleanupButtons(); 781 prepareButtons(); 782 } 783 784 void UIPopupPaneButtonPane::sltButtonClicked() 785 { 786 /* Make sure the slot is called by the button: */ 787 QIToolButton *pButton = qobject_cast<QIToolButton*>(sender()); 788 if (!pButton) 789 return; 790 791 /* Make sure we still have that button: */ 792 int iButtonID = m_buttons.key(pButton, 0); 793 if (!iButtonID) 794 return; 795 796 /* Notify listeners button was clicked: */ 797 emit sigButtonClicked(iButtonID); 798 } 799 800 void UIPopupPaneButtonPane::prepare() 801 { 802 /* Prepare layouts: */ 803 prepareLayouts(); 804 } 805 806 void UIPopupPaneButtonPane::prepareLayouts() 807 { 808 /* Create layouts: */ 809 m_pButtonLayout = new QHBoxLayout; 810 m_pButtonLayout->setContentsMargins(0, 0, 0, 0); 811 m_pButtonLayout->setSpacing(0); 812 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 813 pMainLayout->setContentsMargins(0, 0, 0, 0); 814 pMainLayout->setSpacing(0); 815 pMainLayout->addLayout(m_pButtonLayout); 816 pMainLayout->addStretch(); 817 } 818 819 void UIPopupPaneButtonPane::prepareButtons() 820 { 821 /* Add all the buttons: */ 822 const QList<int> &buttonsIDs = m_buttonDescriptions.keys(); 823 foreach (int iButtonID, buttonsIDs) 824 if (QIToolButton *pButton = addButton(iButtonID, m_buttonDescriptions[iButtonID])) 825 { 826 m_pButtonLayout->addWidget(pButton); 827 m_buttons[iButtonID] = pButton; 828 connect(pButton, SIGNAL(clicked(bool)), this, SLOT(sltButtonClicked())); 829 if (pButton->property("default").toBool()) 830 m_iDefaultButton = iButtonID; 831 if (pButton->property("escape").toBool()) 832 m_iEscapeButton = iButtonID; 833 } 834 } 835 836 void UIPopupPaneButtonPane::cleanupButtons() 837 { 838 /* Remove all the buttons: */ 839 const QList<int> &buttonsIDs = m_buttons.keys(); 840 foreach (int iButtonID, buttonsIDs) 841 { 842 delete m_buttons[iButtonID]; 843 m_buttons.remove(iButtonID); 844 } 845 } 846 847 void UIPopupPaneButtonPane::keyPressEvent(QKeyEvent *pEvent) 848 { 849 /* Depending on pressed key: */ 850 switch (pEvent->key()) 851 { 852 case Qt::Key_Enter: 853 case Qt::Key_Return: 854 { 855 if (m_iDefaultButton) 856 { 857 pEvent->accept(); 858 emit sigButtonClicked(m_iDefaultButton); 859 return; 860 } 861 break; 862 } 863 case Qt::Key_Escape: 864 { 865 if (m_iEscapeButton) 866 { 867 pEvent->accept(); 868 emit sigButtonClicked(m_iEscapeButton); 869 return; 870 } 871 break; 872 } 873 default: 874 break; 875 } 876 /* Call to base-class: */ 877 QWidget::keyPressEvent(pEvent); 878 } 879 880 /* static */ 881 QIToolButton* UIPopupPaneButtonPane::addButton(int iButtonID, const QString &strToolTip) 882 { 883 /* Create button: */ 884 QIToolButton *pButton = new QIToolButton; 885 pButton->setToolTip(strToolTip.isEmpty() ? defaultToolTip(iButtonID) : strToolTip); 886 pButton->setIcon(defaultIcon(iButtonID)); 887 888 /* Sign the 'default' button: */ 889 if (iButtonID & AlertButtonOption_Default) 890 pButton->setProperty("default", true); 891 /* Sign the 'escape' button: */ 892 if (iButtonID & AlertButtonOption_Escape) 893 pButton->setProperty("escape", true); 894 895 /* Return button: */ 896 return pButton; 897 } 898 899 /* static */ 900 QString UIPopupPaneButtonPane::defaultToolTip(int iButtonID) 901 { 902 QString strToolTip; 903 switch (iButtonID & AlertButtonMask) 904 { 905 case AlertButton_Ok: strToolTip = QIMessageBox::tr("OK"); break; 906 case AlertButton_Cancel: strToolTip = QIMessageBox::tr("Cancel"); break; 907 case AlertButton_Choice1: strToolTip = QIMessageBox::tr("Yes"); break; 908 case AlertButton_Choice2: strToolTip = QIMessageBox::tr("No"); break; 909 default: strToolTip = QString(); break; 910 } 911 return strToolTip; 912 } 913 914 /* static */ 915 QIcon UIPopupPaneButtonPane::defaultIcon(int iButtonID) 916 { 917 QIcon icon; 918 switch (iButtonID & AlertButtonMask) 919 { 920 case AlertButton_Ok: icon = UIIconPool::iconSet(":/ok_16px.png"); break; 921 case AlertButton_Cancel: icon = UIIconPool::iconSet(":/cancel_16px.png"); break; 922 case AlertButton_Choice1: break; 923 case AlertButton_Choice2: break; 924 default: break; 925 } 926 return icon; 927 } 928 856 929 #include "UIPopupPane.moc" 857 930 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h
r45592 r45605 22 22 /* Qt includes: */ 23 23 #include <QWidget> 24 #include <QMap> 24 25 25 26 /* GUI includes: */ … … 30 31 class QLabel; 31 32 class QPushButton; 32 class QIDialogButtonBox;33 33 class UIPopupPane; 34 34 class UIPopupPaneFrame; 35 35 class UIPopupPaneTextPane; 36 class UIPopupPaneButtonPane; 36 37 37 38 /* UIAnimationFramework namespace: */ … … 68 69 public: 69 70 70 /* Constructor /destructor: */71 /* Constructor: */ 71 72 UIPopupPane(QWidget *pParent, const QString &strId, 72 73 const QString &strMessage, const QString &strDetails, 73 int iButton1, int iButton2, int iButton3, 74 const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3); 75 ~UIPopupPane(); 74 const QMap<int, QString> &buttonDescriptions); 76 75 77 76 /* API: Id stuff: */ … … 84 83 private slots: 85 84 86 /* Handlers: Done slot variants for every button: */ 87 void done1() { done(m_iButton1 & AlertButtonMask); } 88 void done2() { done(m_iButton2 & AlertButtonMask); } 89 void done3() { done(m_iButton3 & AlertButtonMask); } 85 /* Handler: Button stuff: */ 86 void sltButtonClicked(int iButtonID); 90 87 91 88 /* Handler: Layout stuff: */ … … 94 91 private: 95 92 96 /* Helpers: Prepare /cleanupstuff: */93 /* Helpers: Prepare stuff: */ 97 94 void prepare(); 98 void cleanup();95 void prepareContent(); 99 96 100 97 /* Handler: Event-filter stuff: */ … … 104 101 virtual void showEvent(QShowEvent *pEvent); 105 102 virtual void polishEvent(QShowEvent *pEvent); 106 virtual void keyPressEvent(QKeyEvent *pEvent);107 103 108 104 /* Helper: Layout stuff: */ … … 113 109 void updateLayout(); 114 110 115 /* Helpers: Prepare stuff: */116 void prepareContent();117 void prepareButtons();118 119 111 /* Helper: Complete stuff: */ 120 112 void done(int iButtonCode); … … 122 114 /* Static helpers: Prepare stuff: */ 123 115 static int parentStatusBarHeight(QWidget *pParent); 124 static QList<QPushButton*> createButtons(QIDialogButtonBox *pButtonBox, const QList<int> description);125 static QPushButton* createButton(QIDialogButtonBox *pButtonBox, int iButton);126 116 127 117 /* Variables: */ … … 139 129 140 130 /* Variables: Button stuff: */ 141 int m_iButton1, m_iButton2, m_iButton3; 142 QString m_strButtonText1, m_strButtonText2, m_strButtonText3; 143 int m_iButtonEsc; 131 QMap<int, QString> m_buttonDescriptions; 144 132 145 133 /* Variables: Animation stuff: */ … … 150 138 UIPopupPaneFrame *m_pMainFrame; 151 139 UIPopupPaneTextPane *m_pTextPane; 152 QIDialogButtonBox *m_pButtonBox; 153 QPushButton *m_pButton1, *m_pButton2, *m_pButton3; 140 UIPopupPaneButtonPane *m_pButtonPane; 154 141 }; 155 142
Note:
See TracChangeset
for help on using the changeset viewer.