@@ -1,91 +1,93 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
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 |
|
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 |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "MainWindow.h" |
|
22 | #include "MainWindow.h" | |
23 | #include <QProcessEnvironment> |
|
23 | #include <QProcessEnvironment> | |
24 | #include <QThread> |
|
24 | #include <QThread> | |
25 | #include <SqpApplication.h> |
|
25 | #include <SqpApplication.h> | |
26 | #include <qglobal.h> |
|
26 | #include <qglobal.h> | |
27 |
|
27 | |||
28 | #include <PluginManager/PluginManager.h> |
|
28 | #include <PluginManager/PluginManager.h> | |
29 | #include <QDir> |
|
29 | #include <QDir> | |
30 | #include <QtPlugin> |
|
30 | #include <QtPlugin> | |
31 |
|
31 | |||
32 | #include <QLoggingCategory> |
|
32 | #include <QLoggingCategory> | |
33 |
|
33 | |||
34 | Q_LOGGING_CATEGORY(LOG_Main, "Main") |
|
34 | Q_LOGGING_CATEGORY(LOG_Main, "Main") | |
35 |
|
35 | |||
36 | namespace { |
|
36 | namespace { | |
37 |
|
37 | |||
38 | const auto PLUGIN_DIRECTORY_NAME = QStringLiteral("plugins"); |
|
38 | const auto PLUGIN_DIRECTORY_NAME = QStringLiteral("plugins"); | |
39 |
|
39 | |||
40 |
|
40 | |||
41 | } // namespace |
|
41 | } // namespace | |
42 |
|
42 | |||
43 | int main(int argc, char *argv[]) |
|
43 | int main(int argc, char *argv[]) | |
44 | { |
|
44 | { | |
45 | #ifdef QT_STATICPLUGIN |
|
45 | #ifdef QT_STATICPLUGIN | |
46 | Q_IMPORT_PLUGIN(MockPlugin) |
|
46 | Q_IMPORT_PLUGIN(MockPlugin) | |
47 | Q_IMPORT_PLUGIN(AmdaPlugin) |
|
47 | Q_IMPORT_PLUGIN(AmdaPlugin) | |
48 | Q_INIT_RESOURCE(amdaresources); |
|
48 | Q_INIT_RESOURCE(amdaresources); | |
49 | #endif |
|
49 | #endif | |
50 | Q_INIT_RESOURCE(sqpguiresources); |
|
50 | Q_INIT_RESOURCE(sqpguiresources); | |
51 |
|
51 | |||
52 | SqpApplication::setOrganizationName("LPP"); |
|
52 | SqpApplication::setOrganizationName("LPP"); | |
53 | SqpApplication::setOrganizationDomain("lpp.fr"); |
|
53 | SqpApplication::setOrganizationDomain("lpp.fr"); | |
54 | SqpApplication::setApplicationName("SciQLop"); |
|
54 | SqpApplication::setApplicationName("SciQLop"); | |
55 |
|
55 | |||
|
56 | QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); | |||
|
57 | ||||
56 | SqpApplication a{argc, argv}; |
|
58 | SqpApplication a{argc, argv}; | |
57 |
|
59 | |||
58 | MainWindow w; |
|
60 | MainWindow w; | |
59 | w.show(); |
|
61 | w.show(); | |
60 |
|
62 | |||
61 | // Loads plugins |
|
63 | // Loads plugins | |
62 | auto pluginDir = QDir{a.applicationDirPath()}; |
|
64 | auto pluginDir = QDir{a.applicationDirPath()}; | |
63 | auto pluginLookupPath = { |
|
65 | auto pluginLookupPath = { | |
64 | a.applicationDirPath(), |
|
66 | a.applicationDirPath(), | |
65 | a.applicationDirPath() + "/" + PLUGIN_DIRECTORY_NAME, |
|
67 | a.applicationDirPath() + "/" + PLUGIN_DIRECTORY_NAME, | |
66 | a.applicationDirPath() + "/../lib64/SciQlop", |
|
68 | a.applicationDirPath() + "/../lib64/SciQlop", | |
67 | a.applicationDirPath() + "/../lib64/sciqlop", |
|
69 | a.applicationDirPath() + "/../lib64/sciqlop", | |
68 | a.applicationDirPath() + "/../lib/SciQlop", |
|
70 | a.applicationDirPath() + "/../lib/SciQlop", | |
69 | a.applicationDirPath() + "/../lib/sciqlop", |
|
71 | a.applicationDirPath() + "/../lib/sciqlop", | |
70 | a.applicationDirPath() + "/../plugins", |
|
72 | a.applicationDirPath() + "/../plugins", | |
71 | }; |
|
73 | }; | |
72 |
|
74 | |||
73 | #if _WIN32 || _WIN64 |
|
75 | #if _WIN32 || _WIN64 | |
74 | pluginDir.mkdir(PLUGIN_DIRECTORY_NAME); |
|
76 | pluginDir.mkdir(PLUGIN_DIRECTORY_NAME); | |
75 | pluginDir.cd(PLUGIN_DIRECTORY_NAME); |
|
77 | pluginDir.cd(PLUGIN_DIRECTORY_NAME); | |
76 | #endif |
|
78 | #endif | |
77 |
|
79 | |||
78 | PluginManager pluginManager{}; |
|
80 | PluginManager pluginManager{}; | |
79 |
|
81 | |||
80 | for (auto &&path : pluginLookupPath) { |
|
82 | for (auto &&path : pluginLookupPath) { | |
81 | QDir directory{path}; |
|
83 | QDir directory{path}; | |
82 | if (directory.exists()) { |
|
84 | if (directory.exists()) { | |
83 | qCDebug(LOG_Main()) |
|
85 | qCDebug(LOG_Main()) | |
84 | << QObject::tr("Plugin directory: %1").arg(directory.absolutePath()); |
|
86 | << QObject::tr("Plugin directory: %1").arg(directory.absolutePath()); | |
85 | pluginManager.loadPlugins(directory); |
|
87 | pluginManager.loadPlugins(directory); | |
86 | } |
|
88 | } | |
87 | } |
|
89 | } | |
88 | pluginManager.loadStaticPlugins(); |
|
90 | pluginManager.loadStaticPlugins(); | |
89 |
|
91 | |||
90 | return a.exec(); |
|
92 | return a.exec(); | |
91 | } |
|
93 | } |
General Comments 0
You need to be logged in to leave comments.
Login now