@@ -1,122 +1,126 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SocExplorer Software |
|
2 | -- This file is a part of the SocExplorer Software | |
3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2011, 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@lpp.polytechnique.fr |
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include <QApplication> |
|
22 | #include <QApplication> | |
23 | #include "mainwindow.h" |
|
23 | #include "mainwindow.h" | |
24 | #include <PythonQt.h> |
|
24 | #include <PythonQt.h> | |
25 | #include <PythonQt_QtAll.h> |
|
25 | #include <PythonQt_QtAll.h> | |
26 | #include <gui/PythonQtScriptingConsole.h> |
|
26 | #include <gui/PythonQtScriptingConsole.h> | |
27 | #include <socexplorerplugin.h> |
|
27 | #include <socexplorerplugin.h> | |
28 | #include <QStyle> |
|
28 | #include <QStyle> | |
29 | #include <QStyleFactory> |
|
29 | #include <QStyleFactory> | |
30 | #include <QStringList> |
|
30 | #include <QStringList> | |
31 | #include <QFile> |
|
31 | #include <QFile> | |
32 | #include <QCommandLineOption> |
|
32 | #include <QCommandLineOption> | |
33 | #include <QCommandLineParser> |
|
33 | #include <QCommandLineParser> | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | QCommandLineOption executeOption = QCommandLineOption ( |
|
36 | QCommandLineOption executeOption = QCommandLineOption ( | |
37 | QStringList() << "e" << "execute", |
|
37 | QStringList() << "e" << "execute", | |
38 | QCoreApplication::translate("main", "Execute given script <script>."), |
|
38 | QCoreApplication::translate("main", "Execute given script <script>."), | |
39 | QCoreApplication::translate("main", "script")); |
|
39 | QCoreApplication::translate("main", "script")); | |
40 |
|
40 | |||
41 | QCommandLineOption debugLevelOption = QCommandLineOption ( |
|
41 | QCommandLineOption debugLevelOption = QCommandLineOption ( | |
42 | QStringList() << "d" << "debug-level", |
|
42 | QStringList() << "d" << "debug-level", | |
43 | QCoreApplication::translate("main", "Sets debug level to <level>, higher the level is more verbose the application will be."), |
|
43 | QCoreApplication::translate("main", "Sets debug level to <level>, higher the level is more verbose the application will be."), | |
44 | QCoreApplication::translate("main", "level"), |
|
44 | QCoreApplication::translate("main", "level"), | |
45 | "1"); |
|
45 | "1"); | |
46 |
|
46 | |||
47 | QCommandLineOption noGUIOption = QCommandLineOption ( |
|
47 | QCommandLineOption noGUIOption = QCommandLineOption ( | |
48 | QStringList() << "n" << "no-gui", |
|
48 | QStringList() << "n" << "no-gui", | |
49 | QCoreApplication::translate("main", "Starts SocExplorer in batch mode[not fully implemented yet!].")); |
|
49 | QCoreApplication::translate("main", "Starts SocExplorer in batch mode[not fully implemented yet!].")); | |
50 |
|
50 | |||
51 | const char* socexplorerDesc="\ |
|
51 | const char* socexplorerDesc="\ | |
52 | SocExplorer is an open source generic System On Chip testing software/framework.\ |
|
52 | SocExplorer is an open source generic System On Chip testing software/framework.\ | |
53 | We write this software for the development and the validation of our instrument,\ |
|
53 | We write this software for the development and the validation of our instrument,\ | |
54 | the Low Frequency Receiver(LFR) for the Solar Orbiter mission. This instrument is\ |
|
54 | the Low Frequency Receiver(LFR) for the Solar Orbiter mission. This instrument is\ | |
55 | based on an actel FPGA hosting a LEON3FT processor and some peripherals. To make\ |
|
55 | based on an actel FPGA hosting a LEON3FT processor and some peripherals. To make\ | |
56 | it more collaborative, we use a plugin based system, the main executable is SocExplorer\ |
|
56 | it more collaborative, we use a plugin based system, the main executable is SocExplorer\ | |
57 | then all the functionality are provided by plugins. Like this everybody can provide\ |
|
57 | then all the functionality are provided by plugins. Like this everybody can provide\ | |
58 | his set of plugins to handle a new SOC or just a new peripheral. SocExplorer uses\ |
|
58 | his set of plugins to handle a new SOC or just a new peripheral. SocExplorer uses\ | |
59 | PythonQt to allow user to automate some tasks such as loading some plugins, configuring\ |
|
59 | PythonQt to allow user to automate some tasks such as loading some plugins, configuring\ | |
60 | them and talking with his device. SocExplorer is provided under the terms of the GNU\ |
|
60 | them and talking with his device. SocExplorer is provided under the terms of the GNU\ | |
61 | General Public License as published by the Free Software Foundation; either version 2\ |
|
61 | General Public License as published by the Free Software Foundation; either version 2\ | |
62 | of the License, or (at your option) any later version."; |
|
62 | of the License, or (at your option) any later version."; | |
63 |
|
63 | |||
64 | int main(int argc, char *argv[]) |
|
64 | int main(int argc, char *argv[]) | |
65 | { |
|
65 | { | |
66 | QApplication a(argc, argv); |
|
66 | QApplication a(argc, argv); | |
67 | QString scriptToEval; |
|
67 | QString scriptToEval; | |
68 | QApplication::setOrganizationName("LPP"); |
|
68 | QApplication::setOrganizationName("LPP"); | |
69 | QApplication::setOrganizationDomain("lpp.fr"); |
|
69 | QApplication::setOrganizationDomain("lpp.fr"); | |
70 | QApplication::setApplicationName("SocExplorer"); |
|
70 | QApplication::setApplicationName("SocExplorer"); | |
71 | QCommandLineParser parser; |
|
71 | QCommandLineParser parser; | |
72 | parser.setApplicationDescription(socexplorerDesc); |
|
72 | parser.setApplicationDescription(socexplorerDesc); | |
73 | parser.addHelpOption(); |
|
73 | parser.addHelpOption(); | |
74 | parser.addVersionOption(); |
|
74 | parser.addVersionOption(); | |
75 | bool noGUI=false; |
|
75 | bool noGUI=false; | |
76 | parser.addPositionalArgument("file", QCoreApplication::translate("main", "The Python file to execute.")); |
|
76 | parser.addPositionalArgument("file", QCoreApplication::translate("main", "The Python file to execute.")); | |
77 | parser.addOption(executeOption); |
|
77 | parser.addOption(executeOption); | |
78 | parser.addOption(debugLevelOption); |
|
78 | parser.addOption(debugLevelOption); | |
79 | parser.addOption(noGUIOption); |
|
79 | parser.addOption(noGUIOption); | |
80 | parser.process(a); |
|
80 | parser.process(a); | |
81 | if(parser.isSet(executeOption)) |
|
81 | if(parser.isSet(executeOption)) | |
82 | { |
|
82 | { | |
83 | scriptToEval = parser.value(executeOption); |
|
83 | scriptToEval = parser.value(executeOption); | |
84 | if(!QFile::exists(scriptToEval)) |
|
84 | if(!QFile::exists(scriptToEval)) | |
85 | { |
|
85 | { | |
86 | scriptToEval.clear(); |
|
86 | scriptToEval.clear(); | |
87 | } |
|
87 | } | |
88 | } |
|
88 | } | |
89 | else |
|
89 | else | |
90 | { |
|
90 | { | |
91 |
|
|
91 | QStringList posArgs = parser.positionalArguments(); | |
|
92 | if(posArgs.count()) | |||
|
93 | { | |||
|
94 | scriptToEval = posArgs.first(); | |||
92 | if(!QFile::exists(scriptToEval)) |
|
95 | if(!QFile::exists(scriptToEval)) | |
93 | { |
|
96 | { | |
94 | scriptToEval.clear(); |
|
97 | scriptToEval.clear(); | |
95 | } |
|
98 | } | |
96 | } |
|
99 | } | |
|
100 | } | |||
97 | if(parser.isSet(debugLevelOption)) |
|
101 | if(parser.isSet(debugLevelOption)) | |
98 | { |
|
102 | { | |
99 | bool success; |
|
103 | bool success; | |
100 | int lvl; |
|
104 | int lvl; | |
101 | lvl = parser.value(debugLevelOption).toInt(&success,10); |
|
105 | lvl = parser.value(debugLevelOption).toInt(&success,10); | |
102 | if(success) |
|
106 | if(success) | |
103 | { |
|
107 | { | |
104 | SocExplorerEngine::setLogLevel(lvl); |
|
108 | SocExplorerEngine::setLogLevel(lvl); | |
105 | } |
|
109 | } | |
106 | } |
|
110 | } | |
107 | if(parser.isSet(noGUIOption)) |
|
111 | if(parser.isSet(noGUIOption)) | |
108 | { |
|
112 | { | |
109 | noGUI = true; |
|
113 | noGUI = true; | |
110 | qDebug() << "CLI mode"; |
|
114 | qDebug() << "CLI mode"; | |
111 | } |
|
115 | } | |
112 | SocExplorerMainWindow w(scriptToEval); |
|
116 | SocExplorerMainWindow w(scriptToEval); | |
113 | if(!noGUI) |
|
117 | if(!noGUI) | |
114 | { |
|
118 | { | |
115 | w.show(); |
|
119 | w.show(); | |
116 | } |
|
120 | } | |
117 | else |
|
121 | else | |
118 | { |
|
122 | { | |
119 |
|
123 | |||
120 | } |
|
124 | } | |
121 | return a.exec(); |
|
125 | return a.exec(); | |
122 | } |
|
126 | } |
General Comments 0
You need to be logged in to leave comments.
Login now