File indexing completed on 2024-05-12 16:44:17

0001 /*
0002     SPDX-FileCopyrightText: 2006 Thomas Baumagrt <ipwizard@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef WIZARDPAGE_H
0008 #define WIZARDPAGE_H
0009 
0010 #include "wizardpage_p.h"
0011 
0012 // ----------------------------------------------------------------------------
0013 // QT Includes
0014 
0015 // ----------------------------------------------------------------------------
0016 // KDE Includes
0017 
0018 // ----------------------------------------------------------------------------
0019 // Project Includes
0020 
0021 #include "kmymoneywizardpage.h"
0022 
0023 class KMyMoneyWizard;
0024 
0025 /**
0026  * The general base class for wizard pages
0027  *
0028  * @author Thomas Baumgart
0029  */
0030 
0031 template <class T>
0032 class WizardPage : public KMyMoneyWizardPage
0033 {
0034 public:
0035     WizardPage(uint step, QWidget* widget, T* parent) :
0036         KMyMoneyWizardPage(*new WizardPagePrivate<T>(widget), step, widget)
0037     {
0038         d_func()->m_wizard = parent;
0039         d_func()->m_wizardBase = parent;
0040     }
0041 
0042     ~WizardPage() override
0043     {
0044     }
0045 
0046     virtual KMyMoneyWizard* wizard() const override
0047     {
0048         return d_func()->m_wizardBase;
0049     }
0050 
0051 protected:
0052     using KMyMoneyWizardPage::d_ptr;
0053     inline WizardPagePrivate<T>* d_func() {
0054         return reinterpret_cast<WizardPagePrivate<T> *>(qGetPtrHelper(d_ptr));
0055     }
0056     inline const WizardPagePrivate<T>* d_func() const {
0057         return reinterpret_cast<const WizardPagePrivate<T> *>(qGetPtrHelper(d_ptr));
0058     }
0059     friend class WizardPagePrivate<T>;
0060     WizardPage(WizardPagePrivate<T> &dd, uint step, QWidget* widget, T* parent) :
0061         KMyMoneyWizardPage(dd, step, widget)
0062     {
0063         d_func()->m_wizard = parent;
0064         d_func()->m_wizardBase = parent;
0065     }
0066 };
0067 
0068 #endif