1 | /* |
---|
2 | |
---|
3 | Copyright 2012-2013 Adam Reichold |
---|
4 | |
---|
5 | This file is part of qpdfview. |
---|
6 | |
---|
7 | qpdfview is free software: you can redistribute it and/or modify |
---|
8 | it under the terms of the GNU General Public License as published by |
---|
9 | the Free Software Foundation, either version 2 of the License, or |
---|
10 | (at your option) any later version. |
---|
11 | |
---|
12 | qpdfview is distributed in the hope that it will be useful, |
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | GNU General Public License for more details. |
---|
16 | |
---|
17 | You should have received a copy of the GNU General Public License |
---|
18 | along with qpdfview. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef PLUGINHANDLER_H |
---|
23 | #define PLUGINHANDLER_H |
---|
24 | |
---|
25 | #include <QObject> |
---|
26 | #include <QMap> |
---|
27 | |
---|
28 | class QString; |
---|
29 | class QWidget; |
---|
30 | |
---|
31 | namespace qpdfview |
---|
32 | { |
---|
33 | |
---|
34 | namespace Model |
---|
35 | { |
---|
36 | class Document; |
---|
37 | } |
---|
38 | |
---|
39 | class SettingsWidget; |
---|
40 | class Plugin; |
---|
41 | |
---|
42 | class PluginHandler : public QObject |
---|
43 | { |
---|
44 | Q_OBJECT |
---|
45 | |
---|
46 | public: |
---|
47 | static PluginHandler* instance(); |
---|
48 | ~PluginHandler(); |
---|
49 | |
---|
50 | enum FileType |
---|
51 | { |
---|
52 | Unknown = 0, |
---|
53 | PDF = 1, |
---|
54 | PS = 2, |
---|
55 | DjVu = 3, |
---|
56 | Image = 4 |
---|
57 | }; |
---|
58 | |
---|
59 | static QString fileTypeName(FileType fileType); |
---|
60 | |
---|
61 | static QStringList openFilter(); |
---|
62 | |
---|
63 | Model::Document* loadDocument(const QString& filePath); |
---|
64 | |
---|
65 | SettingsWidget* createSettingsWidget(FileType fileType, QWidget* parent = 0); |
---|
66 | |
---|
67 | private: |
---|
68 | Q_DISABLE_COPY(PluginHandler) |
---|
69 | |
---|
70 | static PluginHandler* s_instance; |
---|
71 | PluginHandler(QObject* parent = 0); |
---|
72 | |
---|
73 | QMap< FileType, Plugin* > m_plugins; |
---|
74 | |
---|
75 | QMultiMap< FileType, QString > m_objectNames; |
---|
76 | QMultiMap< FileType, QString > m_fileNames; |
---|
77 | |
---|
78 | bool loadPlugin(FileType fileType); |
---|
79 | |
---|
80 | }; |
---|
81 | |
---|
82 | } // qpdfview |
---|
83 | |
---|
84 | #endif // PLUGINHANDLER_H |
---|