1 | /* $Id: UIWizardPage.cpp 79567 2019-07-06 12:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIWizardPage class implementation.
|
---|
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 | /* Qt includes: */
|
---|
19 | #include <QAbstractButton>
|
---|
20 |
|
---|
21 | /* GUI includes: */
|
---|
22 | #include "UICommon.h"
|
---|
23 | #include "UIWizard.h"
|
---|
24 | #include "UIWizardPage.h"
|
---|
25 |
|
---|
26 |
|
---|
27 | /*********************************************************************************************************************************
|
---|
28 | * Class UIWizardPageBase implementation. *
|
---|
29 | *********************************************************************************************************************************/
|
---|
30 |
|
---|
31 | UIWizard *UIWizardPageBase::wizardImp() const
|
---|
32 | {
|
---|
33 | /* Should be reimplemented in sub-class to enable access to wizard! */
|
---|
34 | AssertMsgFailed(("UIWizardPageBase::wizardImp() should be reimplemented!"));
|
---|
35 | return 0;
|
---|
36 | }
|
---|
37 |
|
---|
38 | UIWizardPage *UIWizardPageBase::thisImp()
|
---|
39 | {
|
---|
40 | /* Should be reimplemented in sub-class to enable access to wizard page! */
|
---|
41 | AssertMsgFailed(("UIWizardPageBase::thisImp() should be reimplemented!"));
|
---|
42 | return 0;
|
---|
43 | }
|
---|
44 |
|
---|
45 | QVariant UIWizardPageBase::fieldImp(const QString &) const
|
---|
46 | {
|
---|
47 | /* Should be reimplemented in sub-class to enable access to wizard field! */
|
---|
48 | AssertMsgFailed(("UIWizardPageBase::fieldImp(const QString &) should be reimplemented!"));
|
---|
49 | return QVariant();
|
---|
50 | }
|
---|
51 |
|
---|
52 |
|
---|
53 | /*********************************************************************************************************************************
|
---|
54 | * Class UIWizardPage implementation. *
|
---|
55 | *********************************************************************************************************************************/
|
---|
56 |
|
---|
57 | UIWizardPage::UIWizardPage()
|
---|
58 | : m_fReady(false)
|
---|
59 | {
|
---|
60 | }
|
---|
61 |
|
---|
62 | void UIWizardPage::markReady()
|
---|
63 | {
|
---|
64 | m_fReady = true;
|
---|
65 | QWizardPage::setTitle(m_strTitle);
|
---|
66 | }
|
---|
67 |
|
---|
68 | void UIWizardPage::setTitle(const QString &strTitle)
|
---|
69 | {
|
---|
70 | m_strTitle = strTitle;
|
---|
71 | if (m_fReady)
|
---|
72 | QWizardPage::setTitle(m_strTitle);
|
---|
73 | }
|
---|
74 |
|
---|
75 | UIWizard *UIWizardPage::wizard() const
|
---|
76 | {
|
---|
77 | return qobject_cast<UIWizard*>(QWizardPage::wizard());
|
---|
78 | }
|
---|
79 |
|
---|
80 | void UIWizardPage::startProcessing()
|
---|
81 | {
|
---|
82 | if (isFinalPage())
|
---|
83 | wizard()->button(QWizard::FinishButton)->setEnabled(false);
|
---|
84 | }
|
---|
85 |
|
---|
86 | void UIWizardPage::endProcessing()
|
---|
87 | {
|
---|
88 | if (isFinalPage())
|
---|
89 | wizard()->button(QWizard::FinishButton)->setEnabled(true);
|
---|
90 | }
|
---|