VirtualBox

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

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

FE/Qt4: 3627: Shorten error dialogs. First approved variant done.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 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 <QMessageBox>
31#include <QCheckBox>
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;
44class QToolButton;
45class QVBoxLayout;
46
47/** @class QIArrowSplitter
48 *
49 * The QIArrowSplitter class is a folding widget placeholder.
50 * It is declared here until moved into separate file in case
51 * of it will be used somewhere except problem-reporter dialog.
52 */
53class QIArrowSplitter : public QWidget
54{
55 Q_OBJECT;
56
57public:
58
59 QIArrowSplitter (QWidget *aParent = 0);
60
61 void addWidget (const QString &aName, QWidget *aWidget);
62
63public slots:
64
65 void toggleWidget();
66
67private:
68
69 QVBoxLayout *mMainLayout;
70 QList <QToolButton*> mButtonsList;
71 QList <QWidget*> mWidgetsList;
72};
73
74/** @class QIMessageBox
75 *
76 * The QIMessageBox class is a message box similar to QMessageBox.
77 * It partly implements the QMessageBox interface and adds some enhanced
78 * functionality.
79 */
80class QIMessageBox : public QIDialog
81{
82 Q_OBJECT;
83
84public:
85
86 // for compatibility with QMessageBox
87 enum Icon
88 {
89 NoIcon = QMessageBox::NoIcon,
90 Information = QMessageBox::Information,
91 Warning = QMessageBox::Warning,
92 Critical = QMessageBox::Critical,
93 Question = QMessageBox::Question,
94 GuruMeditation,
95 };
96
97 enum
98 {
99 NoButton = 0, Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5,
100 Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9,
101 ButtonMask = 0xFF,
102
103 Default = 0x100, Escape = 0x200,
104 FlagMask = 0x300
105 };
106
107 QIMessageBox (const QString &aCaption, const QString &aText,
108 Icon aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0,
109 QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE);
110
111 QString buttonText (int aButton) const;
112 void setButtonText (int aButton, const QString &aText);
113
114 QString flagText() const { return mFlagCB->isVisible() ? mFlagCB->text() : QString::null; }
115 void setFlagText (const QString &aText);
116
117 bool isFlagChecked() const { return mFlagCB->isChecked(); }
118 void setFlagChecked (bool aChecked) { mFlagCB->setChecked (aChecked); }
119
120 QString detailsText () const { return mDetailsText->toHtml(); }
121 void setDetailsText (const QString &aText);
122
123 bool isDetailsShown() const { return mDetailsVBox->isVisible(); }
124 void setDetailsShown (bool aShown);
125
126 QPixmap standardPixmap (QIMessageBox::Icon aIcon);
127
128private:
129
130 QPushButton *createButton (int aButton);
131
132 void closeEvent (QCloseEvent *e);
133 void showEvent (QShowEvent *e);
134
135private slots:
136
137 void done0() { mWasDone = true; done (mButton0 & ButtonMask); }
138 void done1() { mWasDone = true; done (mButton1 & ButtonMask); }
139 void done2() { mWasDone = true; done (mButton2 & ButtonMask); }
140
141 void reject();
142
143private:
144
145 int mButton0, mButton1, mButton2, mButtonEsc;
146 QLabel *mIconLabel;
147 QILabel *mTextLabel;
148 QPushButton *mButton0PB, *mButton1PB, *mButton2PB;
149 QCheckBox *mFlagCB, *mFlagCB_Main, *mFlagCB_Details;
150 QWidget *mDetailsVBox;
151 QIArrowSplitter *mDetailsSplitter;
152 QTextEdit *mDetailsText;
153 QSpacerItem *mSpacer;
154 QIDialogButtonBox *mButtonBox;
155 bool mWasDone : 1;
156 bool mWasPolished : 1;
157};
158
159#endif
160
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