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