| 1 | /* |
| 2 | * File: PrinterDialog.h |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: May 10, 2014 |
| 6 | * |
| 7 | * Copyright (c) 2009-2013 Jacob Dekel |
| 8 | * $Id$ |
| 9 | * |
| 10 | * This object handles the Hercules Studio printer dialog |
| 11 | * |
| 12 | * This program is free software: you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation, either version 3 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU 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 <http://www.gnu.org/licenses/>. |
| 24 | * |
| 25 | */ |
| 26 | #ifndef PRINTERDIALOG_H |
| 27 | #define PRINTERDIALOG_H |
| 28 | |
| 29 | #include "IpValidator.h" |
| 30 | #include "HerculesStudio.h" |
| 31 | |
| 32 | #include <QDialog> |
| 33 | #include <QSystemTrayIcon> |
| 34 | |
| 35 | class mMovie; |
| 36 | class QSystemTrayIcon; |
| 37 | |
| 38 | namespace Ui { |
| 39 | class PrinterDialog; |
| 40 | } |
| 41 | |
| 42 | mk_shared_ptr(PrinterController) |
| 43 | mk_shared_ptr(PdfPrinter) |
| 44 | mk_shared_ptr(PrinterItem) |
| 45 | |
| 46 | |
| 47 | class PrinterDialog : public IpValidator |
| 48 | { |
| 49 | Q_OBJECT |
| 50 | |
| 51 | public: |
| 52 | explicit PrinterDialog(QWidget *parent = 0, const QString& item=QString()); |
| 53 | ~PrinterDialog(); |
| 54 | |
| 55 | void stop(); |
| 56 | bool isConnected(); |
| 57 | |
| 58 | private: |
| 59 | void populate(QString printerName); |
| 60 | bool save(bool quiet); |
| 61 | void closeEvent(QCloseEvent * event); |
| 62 | void systrayHint(); |
| 63 | void setProtected(bool protect); |
| 64 | bool testDirectory(QString dirName); |
| 65 | |
| 66 | Ui::PrinterDialog *ui; |
| 67 | QSystemTrayIcon * mSystemTrayIcon; |
| 68 | PrinterItemPtr mPrinterItem; |
| 69 | PrinterControllerPtr mController; |
| 70 | PdfPrinterPtr mPrinter; |
| 71 | bool mListening; |
| 72 | bool mSystrayHintEjected; |
| 73 | QSharedPointer<QMovie> mMovie; |
| 74 | |
| 75 | |
| 76 | private slots: |
| 77 | void dirClicked(); |
| 78 | void deleteClicked(); |
| 79 | void adjustPrinter(QString name); |
| 80 | void printerNameChanged(QString name); |
| 81 | void cancelClicked(); |
| 82 | void connectClicked(); |
| 83 | void connected(); |
| 84 | void waiting(); |
| 85 | void stoppedWaiting(); |
| 86 | void hideRestore(); |
| 87 | void systrayClick(QSystemTrayIcon::ActivationReason); |
| 88 | }; |
| 89 | |
| 90 | #endif // PRINTERDIALOG_H |