@@ -0,0 +1,7 | |||
|
1 | #include "DemoPlugin.hpp" | |
|
2 | #include <iostream> | |
|
3 | ||
|
4 | void DemoPlugin::initialize() | |
|
5 | { | |
|
6 | std::cout << "Loading DemoPlugin \\o/" << std::endl; | |
|
7 | } |
@@ -0,0 +1,19 | |||
|
1 | #ifndef SCIQLOP_DEMOPLUGIN_H | |
|
2 | #define SCIQLOP_DEMOPLUGIN_H | |
|
3 | ||
|
4 | #include <IPlugin.h> | |
|
5 | #include <QtPlugin> | |
|
6 | ||
|
7 | #define PLUGIN_JSON_FILE_PATH "DemoPlugin.json" | |
|
8 | ||
|
9 | ||
|
10 | class DemoPlugin : public QObject, public IPlugin { | |
|
11 | Q_OBJECT | |
|
12 | Q_INTERFACES(IPlugin) | |
|
13 | Q_PLUGIN_METADATA(IID "sciqlop.plugin.IPlugin" FILE PLUGIN_JSON_FILE_PATH) | |
|
14 | public: | |
|
15 | /// @sa IPlugin::initialize() | |
|
16 | void initialize() final; | |
|
17 | }; | |
|
18 | ||
|
19 | #endif // SCIQLOP_DEMOPLUGIN_H |
@@ -0,0 +1,25 | |||
|
1 | demoplugin_moc_headers = [ | |
|
2 | 'DemoPlugin.hpp' | |
|
3 | ] | |
|
4 | ||
|
5 | demoplugin_sources = [ | |
|
6 | 'DemoPlugin.cpp' | |
|
7 | ] | |
|
8 | ||
|
9 | ||
|
10 | demoplugin_moc_files = qt5.preprocess( | |
|
11 | moc_headers: demoplugin_moc_headers, | |
|
12 | dependencies: sciqlop_core, | |
|
13 | include_directories: core_inc, | |
|
14 | moc_extra_arguments : ['-DQT_PLUGIN', '-DQT_STATICPLUGIN'] | |
|
15 | ) | |
|
16 | ||
|
17 | demo_plugin = static_library('demo_plugin', | |
|
18 | 'DemoPlugin.cpp', | |
|
19 | demoplugin_moc_files, | |
|
20 | extra_files: 'DemoPlugin.hpp', | |
|
21 | dependencies : [sciqlop_core], | |
|
22 | cpp_args : ['-DQT_PLUGIN', '-DQT_STATICPLUGIN'] | |
|
23 | ) | |
|
24 | ||
|
25 | demo_plugin_dep = declare_dependency(link_with: demo_plugin, include_directories: '.') |
@@ -1,120 +1,115 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SciQLop Software |
|
3 | 3 | -- Copyright (C) 2017, 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 | #ifndef SCIQLOP_MAINWINDOW_H |
|
23 | 23 | #define SCIQLOP_MAINWINDOW_H |
|
24 | 24 | |
|
25 | 25 | #include <PluginManager/PluginManager.h> |
|
26 | 26 | #include <QDir> |
|
27 | 27 | #include <QLoggingCategory> |
|
28 | 28 | #include <QMainWindow> |
|
29 | 29 | #include <QProgressBar> |
|
30 | 30 | #include <QProgressDialog> |
|
31 | 31 | #include <QThread> |
|
32 | 32 | #include <QVBoxLayout> |
|
33 | 33 | #include <QWidget> |
|
34 | 34 | #include <QtPlugin> |
|
35 | 35 | #include <SqpApplication.h> |
|
36 | 36 | |
|
37 | 37 | #include <Common/spimpl.h> |
|
38 | 38 | |
|
39 | 39 | #include <memory> |
|
40 | 40 | |
|
41 | 41 | namespace Ui |
|
42 | 42 | { |
|
43 | 43 | class MainWindow; |
|
44 | 44 | } // namespace Ui |
|
45 | 45 | |
|
46 | 46 | |
|
47 | 47 | class MainWindow : public QMainWindow |
|
48 | 48 | { |
|
49 | 49 | Q_OBJECT |
|
50 | 50 | |
|
51 | 51 | public: |
|
52 | 52 | explicit MainWindow(QWidget* parent = nullptr); |
|
53 | 53 | virtual ~MainWindow() override; |
|
54 | 54 | public slots: |
|
55 | 55 | |
|
56 | 56 | protected: |
|
57 | 57 | void changeEvent(QEvent* e) override; |
|
58 | 58 | void closeEvent(QCloseEvent* event) override; |
|
59 | 59 | |
|
60 | 60 | void keyPressEvent(QKeyEvent* event) override; |
|
61 | 61 | |
|
62 | 62 | private: |
|
63 | 63 | std::unique_ptr<Ui::MainWindow> m_Ui; |
|
64 | 64 | // QWidget *m_progressWidget; |
|
65 | 65 | // QVBoxLayout *m_progressLayout; |
|
66 | 66 | // QList<QLopService*> m_qlopServices; |
|
67 | 67 | class MainWindowPrivate; |
|
68 | 68 | spimpl::unique_impl_ptr<MainWindowPrivate> impl; |
|
69 | 69 | }; |
|
70 | 70 | |
|
71 | 71 | inline void init_resources() |
|
72 | 72 | { |
|
73 | #ifdef QT_STATICPLUGIN | |
|
74 | #ifndef SQP_NO_PLUGINS | |
|
75 | Q_IMPORT_PLUGIN(PythonProviders) | |
|
76 | Q_INIT_RESOURCE(python_providers); | |
|
77 | #endif | |
|
78 | #endif | |
|
73 | Q_IMPORT_PLUGIN(DemoPlugin); | |
|
79 | 74 | Q_INIT_RESOURCE(sqpguiresources); |
|
80 | 75 | SqpApplication::setOrganizationName("LPP"); |
|
81 | 76 | SqpApplication::setOrganizationDomain("lpp.fr"); |
|
82 | 77 | SqpApplication::setApplicationName("SciQLop"); |
|
83 | 78 | |
|
84 | 79 | QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); |
|
85 | 80 | } |
|
86 | 81 | |
|
87 | 82 | inline void load_plugins(const SqpApplication& a) |
|
88 | 83 | { |
|
89 | 84 | // Loads plugins |
|
90 | 85 | auto pluginDir = QDir { a.applicationDirPath() }; |
|
91 | 86 | auto pluginLookupPath = { |
|
92 | 87 | #if _WIN32 || _WIN64 |
|
93 | 88 | a.applicationDirPath() + "/SciQLop" |
|
94 | 89 | #else |
|
95 | 90 | a.applicationDirPath() + "/../lib64/SciQLop", |
|
96 | 91 | a.applicationDirPath() + "/../lib64/sciqlop", |
|
97 | 92 | a.applicationDirPath() + "/../lib/SciQLop", |
|
98 | 93 | a.applicationDirPath() + "/../lib/sciqlop", |
|
99 | 94 | #endif |
|
100 | 95 | }; |
|
101 | 96 | |
|
102 | 97 | #if _WIN32 || _WIN64 |
|
103 | 98 | pluginDir.mkdir(PLUGIN_DIRECTORY_NAME); |
|
104 | 99 | pluginDir.cd(PLUGIN_DIRECTORY_NAME); |
|
105 | 100 | #endif |
|
106 | 101 | |
|
107 | 102 | PluginManager pluginManager {}; |
|
108 | 103 | |
|
109 | 104 | for (auto&& path : pluginLookupPath) |
|
110 | 105 | { |
|
111 | 106 | QDir directory { path }; |
|
112 | 107 | if (directory.exists()) |
|
113 | 108 | { |
|
114 | 109 | pluginManager.loadPlugins(directory); |
|
115 | 110 | } |
|
116 | 111 | } |
|
117 | 112 | pluginManager.loadStaticPlugins(); |
|
118 | 113 | } |
|
119 | 114 | |
|
120 | 115 | #endif // SCIQLOP_MAINWINDOW_H |
@@ -1,66 +1,50 | |||
|
1 | 1 | |
|
2 | 2 | app_moc_headers = [ |
|
3 | 3 | 'include/MainWindow.h', |
|
4 | 4 | 'include/toolbar.h' |
|
5 | 5 | ] |
|
6 | 6 | |
|
7 | 7 | app_ui_files = [ |
|
8 | 8 | 'ui/MainWindow.ui' |
|
9 | 9 | ] |
|
10 | 10 | |
|
11 | 11 | app_qresources = ['resources/qlopapp.qrc'] |
|
12 | 12 | |
|
13 | 13 | app_moc_files = qt5.preprocess(moc_headers : app_moc_headers, |
|
14 | 14 | ui_files : app_ui_files, |
|
15 | 15 | qresources : app_qresources) |
|
16 | 16 | |
|
17 | 17 | app_sources = [ |
|
18 | 18 | 'src/Main.cpp', |
|
19 | 19 | 'src/MainWindow.cpp', |
|
20 | 20 | 'src/toolbar.cpp' |
|
21 | 21 | ] |
|
22 | 22 | |
|
23 | 23 | app_inc = include_directories(['include']) |
|
24 | 24 | |
|
25 | 25 | if host_machine.system()=='windows' or build_machine.system()=='windows' |
|
26 | 26 | winmod = import('windows') |
|
27 | 27 | rc = winmod.compile_resources('resources/qlopapp.rc') |
|
28 | 28 | else |
|
29 | 29 | rc = [] |
|
30 | 30 | endif |
|
31 | 31 | |
|
32 | app_libs = [] | |
|
33 | cpp_args = [] | |
|
34 | if 'static' == get_option('default_library') | |
|
35 | app_libs = [sciqlop_python_providers] | |
|
36 | cpp_args += ['-DQT_STATICPLUGIN'] | |
|
37 | endif | |
|
32 | cpp_args = ['-DQT_STATICPLUGIN'] | |
|
38 | 33 | |
|
39 | #sciqlop_app = executable('sciqlop', | |
|
40 | # app_sources, | |
|
41 | # app_moc_files, | |
|
42 | # rc, | |
|
43 | # include_directories : [ app_inc], | |
|
44 | # link_with: app_libs, | |
|
45 | # cpp_args: cpp_args, | |
|
46 | # dependencies : [sciqlop_gui, sciqlop_core], | |
|
47 | # install : true | |
|
48 | # ) | |
|
49 | 34 | |
|
50 | 35 | sciqlop_app_lib = library('sciqlop', |
|
51 | 36 | app_sources, |
|
52 | 37 | app_moc_files, |
|
53 | 38 | rc, |
|
54 | 39 | include_directories : [ app_inc], |
|
55 | link_with: app_libs, | |
|
56 | 40 | cpp_args: cpp_args, |
|
57 | dependencies : [sciqlop_gui, sciqlop_core], | |
|
41 | dependencies : [sciqlop_gui, sciqlop_core, demo_plugin_dep], | |
|
58 | 42 | install : true |
|
59 | 43 | ) |
|
60 | 44 | |
|
61 | 45 | sciqlop_app_dep = declare_dependency(link_with : sciqlop_app_lib, |
|
62 | 46 | include_directories : app_inc, |
|
63 | 47 | dependencies : [sciqlop_gui, sciqlop_core]) |
|
64 | 48 | |
|
65 | 49 | |
|
66 | 50 | subdir('PySide2-bindings') |
General Comments 0
You need to be logged in to leave comments.
Login now