VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizardPage.h

Last change on this file was 103957, checked in by vboxsync, 2 months ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in wizard page class hierarchy.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/* $Id: UINativeWizardPage.h 103957 2024-03-20 13:41:59Z 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/* Qt includes: */
35#include <QWidget>
36
37/* GUI includes: */
38#include "UILibraryDefs.h"
39
40/* Forward declarations: */
41class UINativeWizard;
42
43/** QWidget extension with advanced functionality emulating QWizardPage behavior. */
44class SHARED_LIBRARY_STUFF UINativeWizardPage : public QWidget
45{
46 Q_OBJECT;
47
48signals:
49
50 /** Notifies about page validity changes. */
51 void completeChanged();
52
53public:
54
55 /** Constructs wizard page. */
56 UINativeWizardPage();
57
58 /** Redirects the translation call to actual handler. */
59 void retranslate() { sltRetranslateUI(); }
60
61 /** Defines page @a strTitle. */
62 void setTitle(const QString &strTitle);
63 /** Returns page title. */
64 QString title() const;
65
66 /** Handles the page initialization. */
67 virtual void initializePage() {}
68 /** Tests the page for completeness, enables the Next button if Ok.
69 * @returns whether all conditions to go to next page are satisfied. */
70 virtual bool isComplete() const { return true; }
71 /** Tests the page for validity, tranfers to the Next page is Ok.
72 * @returns whether page state to go to next page is bearable. */
73 virtual bool validatePage() { return true; }
74
75protected slots:
76
77 virtual void sltRetranslateUI() = 0;
78
79protected:
80
81 /** Returns wizard this page belongs to. */
82 UINativeWizard *wizard() const;
83
84 template<typename T>
85 T *wizardWindow() const
86 {
87 return parentWidget() && parentWidget()->window()
88 ? qobject_cast<T*>(parentWidget()->window())
89 : 0;
90 }
91
92
93 /** Holds the page title. */
94 QString m_strTitle;
95};
96
97
98#endif /* !FEQT_INCLUDED_SRC_wizards_UINativeWizardPage_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use