1 | /* $Id: UINativeWizardPage.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UINativeWizardPage class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_wizards_UINativeWizardPage_h
|
---|
29 | #define FEQT_INCLUDED_SRC_wizards_UINativeWizardPage_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "QIWithRetranslateUI.h"
|
---|
36 | #include "UILibraryDefs.h"
|
---|
37 |
|
---|
38 | /* Forward declarations: */
|
---|
39 | class UINativeWizard;
|
---|
40 |
|
---|
41 | /** QWidget extension with advanced functionality emulating QWizardPage behavior. */
|
---|
42 | class SHARED_LIBRARY_STUFF UINativeWizardPage : public QIWithRetranslateUI<QWidget>
|
---|
43 | {
|
---|
44 | Q_OBJECT;
|
---|
45 |
|
---|
46 | signals:
|
---|
47 |
|
---|
48 | /** Notifies about page validity changes. */
|
---|
49 | void completeChanged();
|
---|
50 |
|
---|
51 | public:
|
---|
52 |
|
---|
53 | /** Constructs wizard page. */
|
---|
54 | UINativeWizardPage();
|
---|
55 |
|
---|
56 | /** Redirects the translation call to actual handler. */
|
---|
57 | void retranslate() { retranslateUi(); }
|
---|
58 |
|
---|
59 | /** Defines page @a strTitle. */
|
---|
60 | void setTitle(const QString &strTitle);
|
---|
61 | /** Returns page title. */
|
---|
62 | QString title() const;
|
---|
63 |
|
---|
64 | /** Handles the page initialization. */
|
---|
65 | virtual void initializePage() {}
|
---|
66 | /** Tests the page for completeness, enables the Next button if Ok.
|
---|
67 | * @returns whether all conditions to go to next page are satisfied. */
|
---|
68 | virtual bool isComplete() const { return true; }
|
---|
69 | /** Tests the page for validity, tranfers to the Next page is Ok.
|
---|
70 | * @returns whether page state to go to next page is bearable. */
|
---|
71 | virtual bool validatePage() { return true; }
|
---|
72 |
|
---|
73 | protected:
|
---|
74 |
|
---|
75 | /** Returns wizard this page belongs to. */
|
---|
76 | UINativeWizard *wizard() const;
|
---|
77 |
|
---|
78 | template<typename T>
|
---|
79 | T *wizardWindow() const
|
---|
80 | {
|
---|
81 | return parentWidget() && parentWidget()->window()
|
---|
82 | ? qobject_cast<T*>(parentWidget()->window())
|
---|
83 | : 0;
|
---|
84 | }
|
---|
85 |
|
---|
86 |
|
---|
87 | /** Holds the page title. */
|
---|
88 | QString m_strTitle;
|
---|
89 | };
|
---|
90 |
|
---|
91 |
|
---|
92 | #endif /* !FEQT_INCLUDED_SRC_wizards_UINativeWizardPage_h */
|
---|