1 | /* $Id: UIWizard.h 76581 2019-01-01 06:24:57Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWizard class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef FEQT_INCLUDED_SRC_wizards_UIWizard_h
|
---|
19 | #define FEQT_INCLUDED_SRC_wizards_UIWizard_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QPointer>
|
---|
26 | #include <QWizard>
|
---|
27 |
|
---|
28 | /* GUI includes: */
|
---|
29 | #include "QIWithRetranslateUI.h"
|
---|
30 | #include "UIExtraDataDefs.h"
|
---|
31 | #include "UILibraryDefs.h"
|
---|
32 |
|
---|
33 | /* Forward declarations: */
|
---|
34 | class QShowEvent;
|
---|
35 | class QString;
|
---|
36 | class QWidget;
|
---|
37 | class UIWizardPage;
|
---|
38 |
|
---|
39 | /** QWizard extension with advanced functionality. */
|
---|
40 | class SHARED_LIBRARY_STUFF UIWizard : public QIWithRetranslateUI<QWizard>
|
---|
41 | {
|
---|
42 | Q_OBJECT;
|
---|
43 |
|
---|
44 | public:
|
---|
45 |
|
---|
46 | /** Returns wizard mode. */
|
---|
47 | WizardMode mode() const { return m_enmMode; }
|
---|
48 |
|
---|
49 | /** Prepare all. */
|
---|
50 | virtual void prepare();
|
---|
51 |
|
---|
52 | protected:
|
---|
53 |
|
---|
54 | /** Constructs wizard passing @a pParent to the base-class.
|
---|
55 | * @param enmType Brings the wizard type.
|
---|
56 | * @param enmMode Brings the wizard mode. */
|
---|
57 | UIWizard(QWidget *pParent, WizardType enmType, WizardMode enmMode = WizardMode_Auto);
|
---|
58 |
|
---|
59 | /** Handles translation event. */
|
---|
60 | virtual void retranslateUi() /* override */;
|
---|
61 |
|
---|
62 | /** Handles show @a pEvent. */
|
---|
63 | virtual void showEvent(QShowEvent *pEvent) /* override */;
|
---|
64 |
|
---|
65 | /** Assigns @a pPage as a wizard page with certain @a iId. */
|
---|
66 | void setPage(int iId, UIWizardPage *pPage);
|
---|
67 | /** Removes all the pages. */
|
---|
68 | void cleanup();
|
---|
69 |
|
---|
70 | /** Resizes wizard to golden ratio. */
|
---|
71 | void resizeToGoldenRatio();
|
---|
72 |
|
---|
73 | #ifndef VBOX_WS_MAC
|
---|
74 | /** Assigns @a strWaterMark. */
|
---|
75 | void assignWatermark(const QString &strWaterMark);
|
---|
76 | #else
|
---|
77 | /** Assigns @a strBackground. */
|
---|
78 | void assignBackground(const QString &strBackground);
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | protected slots:
|
---|
82 |
|
---|
83 | /** Handles current-page change to page with @a iId. */
|
---|
84 | virtual void sltCurrentIdChanged(int iId);
|
---|
85 | /** Handles custome-button click for button with @a iId. */
|
---|
86 | virtual void sltCustomButtonClicked(int iId);
|
---|
87 |
|
---|
88 | private:
|
---|
89 |
|
---|
90 | /** Performs pages translation. */
|
---|
91 | void retranslatePages();
|
---|
92 |
|
---|
93 | /** Configures certain @a pPage. */
|
---|
94 | void configurePage(UIWizardPage *pPage);
|
---|
95 |
|
---|
96 | /** Resizes wizard according certain @a iLabelWidth. */
|
---|
97 | void resizeAccordingLabelWidth(int iLabelWidth);
|
---|
98 |
|
---|
99 | /** Returns ratio corresponding to current wizard type. */
|
---|
100 | double ratio() const;
|
---|
101 |
|
---|
102 | #ifndef VBOX_WS_MAC
|
---|
103 | /** Returns proposed watermark height. */
|
---|
104 | int proposedWatermarkHeight();
|
---|
105 | /** Assigns cached watermark. */
|
---|
106 | void assignWatermarkHelper();
|
---|
107 | #endif
|
---|
108 |
|
---|
109 | /** Holds the wizard type. */
|
---|
110 | WizardType m_enmType;
|
---|
111 | /** Holds the wizard mode. */
|
---|
112 | WizardMode m_enmMode;
|
---|
113 | #ifndef VBOX_WS_MAC
|
---|
114 | /** Holds the watermark name. */
|
---|
115 | QString m_strWatermarkName;
|
---|
116 | #endif
|
---|
117 | };
|
---|
118 |
|
---|
119 | /** Wizard interface safe-pointer. */
|
---|
120 | typedef QPointer<UIWizard> UISafePointerWizard;
|
---|
121 |
|
---|
122 | #endif /* !FEQT_INCLUDED_SRC_wizards_UIWizard_h */
|
---|