File indexing completed on 2024-12-22 05:15:48

0001 /*
0002     SPDX-FileCopyrightText: 2011 Craig Drummond <craig@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #pragma once
0007 
0008 #include "Misc.h"
0009 #include <QDialog>
0010 #include <QFont>
0011 #include <QList>
0012 #include <QThread>
0013 
0014 class QLabel;
0015 class QProgressBar;
0016 class QPrinter;
0017 
0018 namespace KFI
0019 {
0020 class CActionLabel;
0021 
0022 class CPrintThread : public QThread
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     CPrintThread(QPrinter *printer, const QList<Misc::TFont> &items, int size, QObject *parent);
0028     ~CPrintThread() override;
0029 
0030     void run() override;
0031 
0032 Q_SIGNALS:
0033 
0034     void progress(int p, const QString &f);
0035 
0036 public Q_SLOTS:
0037 
0038     void cancel();
0039 
0040 private:
0041     QPrinter *m_printer;
0042     QList<Misc::TFont> m_items;
0043     int m_size;
0044     bool m_cancelled;
0045 };
0046 
0047 class CPrinter : public QDialog
0048 {
0049     Q_OBJECT
0050 
0051 public:
0052     explicit CPrinter(QWidget *parent);
0053     ~CPrinter() override;
0054 
0055     void print(const QList<Misc::TFont> &items, int size);
0056 
0057 Q_SIGNALS:
0058 
0059     void cancelled();
0060 
0061 public Q_SLOTS:
0062 
0063     void progress(int p, const QString &label);
0064     void slotCancelClicked();
0065 
0066 private:
0067     void closeEvent(QCloseEvent *e) override;
0068 
0069 private:
0070     QLabel *m_statusLabel;
0071     QProgressBar *m_progress;
0072     CActionLabel *m_actionLabel;
0073 };
0074 
0075 }