Changeset 8369 in vbox for trunk/src/VBox
- Timestamp:
- Apr 24, 2008 4:11:40 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/QIMessageBox.h
r8170 r8369 6 6 7 7 /* 8 * Copyright (C) 2006-200 7Sun Microsystems, Inc.8 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 #define __QIMessageBox_h__ 25 25 26 #include "QIDialog.h" 27 26 28 /* Qt includes */ 27 #include <QDialog>28 29 #include <QMessageBox> 29 30 #include <QCheckBox> … … 34 35 class QPushButton; 35 36 class QSpacerItem; 37 class QDialogButtonBox; 36 38 37 class QIMessageBox : public Q Dialog39 class QIMessageBox : public QIDialog 38 40 { 39 41 Q_OBJECT … … 64 66 QIMessageBox (const QString &aCaption, const QString &aText, 65 67 Icon aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0, 66 QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE, 67 Qt::WFlags aFlags = Qt::WStyle_DialogBorder); 68 QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE); 68 69 69 70 QString buttonText (int aButton) const; … … 108 109 QTextEdit *mDetailsText; 109 110 QSpacerItem *mSpacer; 111 QDialogButtonBox *mButtonBox; 110 112 }; 111 113 -
trunk/src/VBox/Frontends/VirtualBox4/src/QIMessageBox.cpp
r8170 r8369 6 6 7 7 /* 8 * Copyright (C) 2006-200 7Sun Microsystems, Inc.8 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 31 31 #include <QPushButton> 32 32 #include <QLabel> 33 #include <QDialogButtonBox> 33 34 34 35 /** @class QIMessageBox … … 40 41 41 42 /** 42 * This constructor is equivalent to43 * QMessageBox::QMessageBox (const QString &, const QString &, Icon,44 * int, int, int, QWidget *, const char *, bool, WFlags).45 43 * See QMessageBox for details. 46 44 */ 47 45 QIMessageBox::QIMessageBox (const QString &aCaption, const QString &aText, 48 46 Icon aIcon, int aButton0, int aButton1, int aButton2, 49 QWidget *aParent, const char *aName, bool aModal, 50 Qt::WFlags aFlags) 51 : QDialog (aParent, aName, aModal, 52 aFlags | Qt::WStyle_Customize | Qt::WStyle_NormalBorder | 53 Qt::WStyle_Title | Qt::WStyle_SysMenu) 47 QWidget *aParent, const char *aName, bool aModal) 48 : QIDialog (aParent, 49 Qt::Window | Qt::Sheet | 50 Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint) 54 51 { 55 52 setWindowTitle (aCaption); 53 /* Necessary to later find some of the message boxes */ 54 setObjectName (aName); 55 setModal (aModal); 56 56 57 57 mButton0 = aButton0; … … 123 123 layout->addItem (mSpacer); 124 124 125 QHBoxLayout *buttonsHLayout = new QHBoxLayout();126 buttonsHLayout->setSpacing (5);127 layout->add Layout (buttonsHLayout);125 mButtonBox = new QDialogButtonBox; 126 mButtonBox->setCenterButtons (true); 127 layout->addWidget (mButtonBox); 128 128 129 129 mButtonEsc = 0; … … 131 131 mButton0PB = createButton (aButton0); 132 132 if (mButton0PB) 133 {134 buttonsHLayout->addWidget (mButton0PB);135 133 connect (mButton0PB, SIGNAL (clicked()), SLOT (done0())); 136 }137 134 mButton1PB = createButton (aButton1); 138 135 if (mButton1PB) 139 {140 buttonsHLayout->addWidget (mButton1PB);141 136 connect (mButton1PB, SIGNAL (clicked()), SLOT (done1())); 142 }143 137 mButton2PB = createButton (aButton2); 144 138 if (mButton2PB) 145 {146 buttonsHLayout->addWidget (mButton2PB);147 139 connect (mButton2PB, SIGNAL (clicked()), SLOT (done2())); 148 }149 150 buttonsHLayout->setAlignment (Qt::AlignHCenter);151 140 152 141 /* this call is a must -- it initializes mFlagCB and mSpacer */ 153 142 setDetailsShown (false); 143 144 /* Set fixed size */ 145 setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed); 154 146 } 155 147 … … 241 233 242 234 QString text; 235 QDialogButtonBox::ButtonRole role; 243 236 switch (aButton & ButtonMask) 244 237 { 245 case Ok: text = tr ("OK"); break;246 case Yes: text = tr ("Yes"); break;247 case No: text = tr ("No"); break;248 case Cancel: text = tr ("Cancel"); break;249 case Ignore: text = tr ("Ignore"); break;238 case Ok: text = tr ("OK"); role = QDialogButtonBox::AcceptRole; break; 239 case Yes: text = tr ("Yes"); role = QDialogButtonBox::YesRole; break; 240 case No: text = tr ("No"); role = QDialogButtonBox::NoRole; break; 241 case Cancel: text = tr ("Cancel"); role = QDialogButtonBox::RejectRole; break; 242 case Ignore: text = tr ("Ignore"); role = QDialogButtonBox::AcceptRole; break; 250 243 default: 251 244 AssertMsgFailed (("Type %d is not implemented", aButton)); … … 253 246 } 254 247 255 QPushButton *b = new QPushButton (text);248 QPushButton *b = mButtonBox->addButton (text, role); 256 249 257 250 if (aButton & Default)
Note:
See TracChangeset
for help on using the changeset viewer.