| 1 | /***************************************************************************** |
| 2 | ** QNapi |
| 3 | ** Copyright (C) 2008-2017 Piotr KrzemiĆski <[email protected]> |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or modify |
| 6 | ** it under the terms of the GNU General Public License as published by |
| 7 | ** the Free Software Foundation; either version 2 of the License, or |
| 8 | ** (at your option) any later version. |
| 9 | ** |
| 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 12 | ** |
| 13 | *****************************************************************************/ |
| 14 | |
| 15 | #ifndef __QNAPIAPP__H__ |
| 16 | #define __QNAPIAPP__H__ |
| 17 | |
| 18 | #include "engines/subtitledownloadenginesregistry.h" |
| 19 | |
| 20 | #include "qnapiopendialog.h" |
| 21 | |
| 22 | #include "forms/frmabout.h" |
| 23 | #include "forms/frmconvert.h" |
| 24 | #include "forms/frmoptions.h" |
| 25 | #include "forms/frmprogress.h" |
| 26 | #include "forms/frmscan.h" |
| 27 | #include "forms/frmsummary.h" |
| 28 | |
| 29 | #include "qcumber/qsingleapplication.h" |
| 30 | |
| 31 | #include <QAction> |
| 32 | #include <QApplication> |
| 33 | #include <QDateTime> |
| 34 | #include <QDesktopServices> |
| 35 | #include <QEvent> |
| 36 | #include <QFileOpenEvent> |
| 37 | #include <QMenu> |
| 38 | #include <QSharedPointer> |
| 39 | #include <QString> |
| 40 | #include <QSystemTrayIcon> |
| 41 | |
| 42 | class QNapiApp : public QSingleApplication { |
| 43 | Q_OBJECT |
| 44 | public: |
| 45 | QNapiApp(int &argc, char **argv, bool useGui, const QString &appName); |
| 46 | ~QNapiApp(); |
| 47 | |
| 48 | void createTrayIcon(); |
| 49 | void showTrayMessage(QString title, QString msg); |
| 50 | |
| 51 | frmProgress *progress(); |
| 52 | |
| 53 | public slots: |
| 54 | |
| 55 | bool showOpenDialog(QString engine = ""); |
| 56 | bool showScanDialog(QString init_dir = ""); |
| 57 | void showConvertDialog(); |
| 58 | void showCreateAccount(const QString &engineName) const; |
| 59 | void showOSUploadDialog() const; |
| 60 | void showSettings(); |
| 61 | void showAbout(); |
| 62 | void tryQuit(); |
| 63 | |
| 64 | signals: |
| 65 | void downloadFile(const QString &fileName); |
| 66 | |
| 67 | private: |
| 68 | bool event(QEvent *ev); |
| 69 | |
| 70 | QSystemTrayIcon *trayIcon; |
| 71 | QMenu *trayIconMenu, *napiSubMenu, *osSubMenu, *napisy24SubMenu; |
| 72 | QAction *getAction, *scanAction, *convertAction, *napiGetAction, |
| 73 | *napiCreateUserAction, *osGetAction, *osAddAction, *osCreateUserAction, |
| 74 | *napisy24GetAction, *napisy24CreateUserAction, *settingsAction, |
| 75 | *aboutAction, *quitAction; |
| 76 | |
| 77 | QNapiOpenDialog *openDialog; |
| 78 | |
| 79 | frmProgress *f_progress; |
| 80 | frmOptions *f_options; |
| 81 | frmAbout *f_about; |
| 82 | frmScan *f_scan; |
| 83 | frmConvert *f_convert; |
| 84 | |
| 85 | QDateTime creationDT; |
| 86 | |
| 87 | QSharedPointer<const SubtitleDownloadEnginesRegistry> enginesRegistry; |
| 88 | |
| 89 | private slots: |
| 90 | |
| 91 | void trayIconActivated(QSystemTrayIcon::ActivationReason reason); |
| 92 | }; |
| 93 | |
| 94 | #endif |