File indexing completed on 2025-01-19 05:06:22

0001 /*
0002     SPDX-FileCopyrightText: 2010 Daniel Nicoletti <dantti12@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef GENERIC_PAGE_H
0008 #define GENERIC_PAGE_H
0009 
0010 #include <QHash>
0011 #include <QVariant>
0012 #include <QWidget>
0013 
0014 #define ADDING_PRINTER QLatin1String("add-new-printer")
0015 #define PPD_NAME QLatin1String("ppd-name")
0016 #define FILENAME QLatin1String("filename")
0017 
0018 class GenericPage : public QWidget
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit GenericPage(QWidget *parent = nullptr);
0023     virtual bool canProceed() const
0024     {
0025         return true;
0026     }
0027     virtual bool isValid() const
0028     {
0029         return true;
0030     }
0031     virtual bool isWorking() const
0032     {
0033         return m_working;
0034     }
0035     virtual void setValues(const QVariantMap &args);
0036     virtual QVariantMap values() const;
0037 
0038     virtual bool finishClicked()
0039     {
0040         return false;
0041     }
0042 
0043 signals:
0044     void allowProceed(bool allow);
0045     void proceed();
0046     void startWorking();
0047     void stopWorking();
0048 
0049 protected slots:
0050     void working();
0051     void notWorking();
0052 
0053 protected:
0054     QVariantMap m_args;
0055     int m_working;
0056 };
0057 
0058 #endif