1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt4 GUI ("VirtualBox"):
|
---|
4 | * QIAbstractWizard 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 __QIAbstractWizard_h__
|
---|
24 | #define __QIAbstractWizard_h__
|
---|
25 |
|
---|
26 | /* Qt includes */
|
---|
27 | #include <QTextEdit>
|
---|
28 | #include <QLabel>
|
---|
29 | #include <QDialog>
|
---|
30 |
|
---|
31 | class QStackedWidget;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * QTextEdit reimplementation used as summary viewer in different wizards:
|
---|
35 | * 1. Enforces parent layout to ignore viewer if there is no text.
|
---|
36 | * 2. Updates sizeHint() & geometry after setting new text for getting
|
---|
37 | * more compact layout.
|
---|
38 | * 3. Tries to take into account horizontal scrollbar if present to avoid
|
---|
39 | * vertical scrollbar appearing.
|
---|
40 | * 4. Makes the paper color similar to the background color.
|
---|
41 | */
|
---|
42 | class QITextEdit : public QTextEdit
|
---|
43 | {
|
---|
44 | Q_OBJECT;
|
---|
45 |
|
---|
46 | public:
|
---|
47 |
|
---|
48 | QITextEdit (QWidget *aParent);
|
---|
49 |
|
---|
50 | QSize sizeHint() const;
|
---|
51 | QSize minimumSizeHint() const;
|
---|
52 | void updateSizeHint();
|
---|
53 |
|
---|
54 | public slots:
|
---|
55 |
|
---|
56 | void setText (const QString &aText);
|
---|
57 |
|
---|
58 | private:
|
---|
59 |
|
---|
60 | QSize mOwnSizeHint;
|
---|
61 | };
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * QLabel reimplementation used as text viewers in different wizards:
|
---|
65 | * 1. Updates sizeHint() on request to feat some minimum width
|
---|
66 | * for getting more compact layout.
|
---|
67 | * 2. Tries to take into account horizontal scrollbar if present to avoid
|
---|
68 | * vertical scrollbar appearing.
|
---|
69 | *
|
---|
70 | * --> uses now global QILabel
|
---|
71 | */
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * QDialog reimplementation used as abstract interface in different wizards:
|
---|
75 | * 1. Performs most of initializations for inherited wizards including
|
---|
76 | * next, back, cancel, finish buttons, icons and text labels.
|
---|
77 | * 2. Handles show event common for all wizards.
|
---|
78 | */
|
---|
79 | class QIAbstractWizard : public QDialog
|
---|
80 | {
|
---|
81 | Q_OBJECT;
|
---|
82 |
|
---|
83 | public:
|
---|
84 |
|
---|
85 | QIAbstractWizard (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
|
---|
86 |
|
---|
87 | protected:
|
---|
88 |
|
---|
89 | void initializeWizardHdr();
|
---|
90 | void initializeWizardFtr();
|
---|
91 |
|
---|
92 | QPushButton* nextButton (QWidget *aOfPage = 0);
|
---|
93 | QPushButton* backButton (QWidget *aOfPage = 0);
|
---|
94 | QPushButton* cancelButton (QWidget *aOfPage = 0);
|
---|
95 | QPushButton* finishButton();
|
---|
96 |
|
---|
97 | void showEvent (QShowEvent *aEvent);
|
---|
98 |
|
---|
99 | protected slots:
|
---|
100 |
|
---|
101 | virtual void showNextPage();
|
---|
102 | virtual void showBackPage();
|
---|
103 | virtual void onPageShow() = 0;
|
---|
104 |
|
---|
105 | private:
|
---|
106 |
|
---|
107 | int nextButtonIndex (QPushButton *aNextButton);
|
---|
108 | int backButtonIndex (QPushButton *aBackButton);
|
---|
109 | QPushButton* getButton (QWidget *aOfPage, const QString &aRegExp);
|
---|
110 |
|
---|
111 | QStackedWidget *mStackedWidget;
|
---|
112 | QList<QPushButton*> mNextButtons;
|
---|
113 | QList<QPushButton*> mBackButtons;
|
---|
114 | QList<QPushButton*> mCancelButtons;
|
---|
115 | QPushButton *mFinishButton;
|
---|
116 | };
|
---|
117 |
|
---|
118 | #endif // __QIAbstractWizard_h__
|
---|
119 |
|
---|