VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/QIMessageBox.h@ 21194

Last change on this file since 21194 was 18071, checked in by vboxsync, 16 years ago

FE/Qt4: 3627: Shorten error dialogs. Added support for chained-messages.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VirtualBox Qt extensions: QIMessageBox class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22
23#ifndef __QIMessageBox_h__
24#define __QIMessageBox_h__
25
26/* VBox includes */
27#include "QIDialog.h"
28
29/* Qt includes */
30#include <QCheckBox>
31#include <QMessageBox>
32#include <QTextEdit>
33
34/* VBox forwards */
35class QIArrowSplitter;
36class QIDialogButtonBox;
37class QILabel;
38
39/* Qt forwards */
40class QCloseEvent;
41class QLabel;
42class QPushButton;
43class QSpacerItem;
44
45/** @class QIMessageBox
46 *
47 * The QIMessageBox class is a message box similar to QMessageBox.
48 * It partly implements the QMessageBox interface and adds some enhanced
49 * functionality.
50 */
51class QIMessageBox : public QIDialog
52{
53 Q_OBJECT;
54
55public:
56
57 // for compatibility with QMessageBox
58 enum Icon
59 {
60 NoIcon = QMessageBox::NoIcon,
61 Information = QMessageBox::Information,
62 Warning = QMessageBox::Warning,
63 Critical = QMessageBox::Critical,
64 Question = QMessageBox::Question,
65 GuruMeditation,
66 };
67
68 enum
69 {
70 NoButton = 0, Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5,
71 Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9,
72 ButtonMask = 0xFF,
73
74 Default = 0x100, Escape = 0x200,
75 FlagMask = 0x300
76 };
77
78 QIMessageBox (const QString &aCaption, const QString &aText,
79 Icon aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0,
80 QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE);
81
82 QString buttonText (int aButton) const;
83 void setButtonText (int aButton, const QString &aText);
84
85 QString flagText() const { return mFlagCB->isVisible() ? mFlagCB->text() : QString::null; }
86 void setFlagText (const QString &aText);
87
88 bool isFlagChecked() const { return mFlagCB->isChecked(); }
89 void setFlagChecked (bool aChecked) { mFlagCB->setChecked (aChecked); }
90
91 QString detailsText () const { return mDetailsText->toHtml(); }
92 void setDetailsText (const QString &aText);
93
94 QPixmap standardPixmap (QIMessageBox::Icon aIcon);
95
96private:
97
98 QPushButton *createButton (int aButton);
99
100 void closeEvent (QCloseEvent *e);
101 void showEvent (QShowEvent *e);
102
103 void refreshDetails();
104 void setDetailsShown (bool aShown);
105
106private slots:
107
108 void detailsBack();
109 void detailsNext();
110
111 void done0() { mWasDone = true; done (mButton0 & ButtonMask); }
112 void done1() { mWasDone = true; done (mButton1 & ButtonMask); }
113 void done2() { mWasDone = true; done (mButton2 & ButtonMask); }
114
115 void reject();
116
117private:
118
119 int mButton0, mButton1, mButton2, mButtonEsc;
120 QLabel *mIconLabel;
121 QILabel *mTextLabel;
122 QPushButton *mButton0PB, *mButton1PB, *mButton2PB;
123 QCheckBox *mFlagCB, *mFlagCB_Main, *mFlagCB_Details;
124 QWidget *mDetailsVBox;
125 QIArrowSplitter *mDetailsSplitter;
126 QTextEdit *mDetailsText;
127 QSpacerItem *mSpacer;
128 QIDialogButtonBox *mButtonBox;
129 QString mText;
130 QList < QPair <QString, QString> > mDetailsList;
131 int mDetailsIndex;
132 bool mWasDone : 1;
133 bool mWasPolished : 1;
134};
135
136#endif
137
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette