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