@@ -1,36 +1,37 | |||||
1 | # use glob syntax. |
|
1 | # use glob syntax. | |
2 | syntax: glob |
|
2 | syntax: glob | |
3 |
|
3 | |||
4 | moc_* |
|
4 | moc_* | |
5 | Makefil* |
|
5 | Makefil* | |
6 | qrc_* |
|
6 | qrc_* | |
7 | *.qm |
|
7 | *.qm | |
8 | *.tex |
|
8 | *.tex | |
9 | *.html |
|
9 | *.html | |
10 | *log* |
|
10 | *log* | |
11 | *.dot |
|
11 | *.dot | |
12 | *.css |
|
12 | *.css | |
13 | *.md5 |
|
13 | *.md5 | |
14 | *.eps |
|
14 | *.eps | |
15 |
|
15 | |||
16 | *.toc |
|
16 | *.toc | |
17 | *.map |
|
17 | *.map | |
18 | *.sty |
|
18 | *.sty | |
19 | *.3 |
|
19 | *.3 | |
20 | *.js |
|
20 | *.js | |
21 | *.aux |
|
21 | *.aux | |
22 | *.idx |
|
22 | *.idx | |
23 | *.orig |
|
23 | *.orig | |
24 | *.o |
|
24 | *.o | |
25 | *.dll |
|
25 | *.dll | |
26 | *.a |
|
26 | *.a | |
27 | *.bin |
|
27 | *.bin | |
28 | *~ |
|
28 | *~ | |
29 | *.pro.user |
|
29 | *.pro.user | |
30 | src/PythonQt/tests/PythonQtTest |
|
30 | src/PythonQt/tests/PythonQtTest | |
31 | src/PythonQt/generator/pythonqt_generator |
|
31 | src/PythonQt/generator/pythonqt_generator | |
32 | src/plugins/common/.preprocessed.tmp |
|
32 | src/plugins/common/.preprocessed.tmp | |
33 | *.exe |
|
33 | *.exe | |
34 | src/common/.preprocessed.tmp |
|
34 | src/common/.preprocessed.tmp | |
|
35 | */.cccc/* | |||
35 | syntax: regexp |
|
36 | syntax: regexp | |
36 | bin/* |
|
37 | bin/* |
@@ -1,1 +1,1 | |||||
1 | e3a98a04d9ec8685bf222f8d687a614a71927549 src/SocExplorerEngine/PeripheralWidget |
|
1 | 2c82d72694590cbc2aebb946667f11f60ea89afe src/SocExplorerEngine/PeripheralWidget |
@@ -1,27 +1,27 | |||||
1 |
|
1 | |||
2 | QT += core gui xml svg network |
|
2 | QT += core gui xml svg network | |
3 | contains(QT_MAJOR_VERSION, 5) { |
|
3 | contains(QT_MAJOR_VERSION, 5) { | |
4 | QT += widgets |
|
4 | QT += widgets | |
5 | QT += printsupport |
|
5 | QT += printsupport | |
6 | } |
|
6 | } | |
7 | CONFIG(debug, debug|release) { |
|
7 | CONFIG(debug, debug|release) { | |
8 | DEBUG_EXT = _d |
|
8 | DEBUG_EXT = _d | |
9 | } else { |
|
9 | } else { | |
10 | DEBUG_EXT = |
|
10 | DEBUG_EXT = | |
11 | } |
|
11 | } | |
12 |
|
12 | |||
13 | SOCEXPLORER_SDK_BUILD="SOCEXPLORER_SDK_BUILD" |
|
13 | SOCEXPLORER_SDK_BUILD="SOCEXPLORER_SDK_BUILD" | |
14 | DEFINES += SOCEXPLORER_SDK_BUILD |
|
14 | DEFINES += SOCEXPLORER_SDK_BUILD | |
15 |
|
15 | |||
16 | MOC_DIR = moc |
|
16 | MOC_DIR = moc | |
17 | RCC_DIR = resources |
|
17 | RCC_DIR = resources | |
18 | OBJECTS_DIR = obj |
|
18 | OBJECTS_DIR = obj | |
19 |
|
19 | |||
20 | win32:DESTDIR = $${SOCEXPLORER_ROOT}/bin/win32/ |
|
20 | win32:DESTDIR = $${SOCEXPLORER_ROOT}/bin/win32/ | |
21 | unix:DESTDIR = $${SOCEXPLORER_ROOT}/bin/linux/ |
|
21 | unix:DESTDIR = $${SOCEXPLORER_ROOT}/bin/linux/ | |
22 |
|
22 | |||
23 |
|
23 | |||
24 | metrics_cccc.target = metrics_cccc |
|
24 | metrics_cccc.target = metrics_cccc | |
25 |
metrics_cccc.commands = cccc $ |
|
25 | metrics_cccc.commands = cccc $(SOURCES) $(HEADERS) | |
26 |
|
26 | |||
27 | QMAKE_EXTRA_TARGETS += metrics_cccc |
|
27 | QMAKE_EXTRA_TARGETS += metrics_cccc |
@@ -1,72 +1,72 | |||||
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, |
|
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 | #ifndef PYTHONCONSOLE_H |
|
22 | #ifndef PYTHONCONSOLE_H | |
23 | #define PYTHONCONSOLE_H |
|
23 | #define PYTHONCONSOLE_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QDockWidget> |
|
26 | #include <QDockWidget> | |
27 | #include <QHBoxLayout> |
|
27 | #include <QHBoxLayout> | |
28 | #include <QtGui/QDragEnterEvent> |
|
28 | #include <QtGui/QDragEnterEvent> | |
29 | #include <QtGui/QDragLeaveEvent> |
|
29 | #include <QtGui/QDragLeaveEvent> | |
30 | #include <QtGui/QDragMoveEvent> |
|
30 | #include <QtGui/QDragMoveEvent> | |
31 | #include <QtGui/QDropEvent> |
|
31 | #include <QtGui/QDropEvent> | |
32 | #include <QtCore/QMimeData> |
|
32 | #include <QtCore/QMimeData> | |
33 | #include <QtCore/QUrl> |
|
33 | #include <QtCore/QUrl> | |
34 | #include <QtCore/QList> |
|
34 | #include <QtCore/QList> | |
35 | #include "PythonQt.h" |
|
35 | #include "PythonQt.h" | |
36 | #include "PythonQt_QtAll.h" |
|
36 | #include "PythonQt_QtAll.h" | |
37 | #include <gui/PythonQtScriptingConsole.h> |
|
37 | #include <gui/PythonQtScriptingConsole.h> | |
38 | #include "../plugins/socexplorerplugin.h" |
|
38 | #include "../plugins/socexplorerplugin.h" | |
39 | #include "pythonqtscriptingconsoledandd.h" |
|
39 | #include "pythonqtscriptingconsoledandd.h" | |
40 | #include <QMainWindow> |
|
40 | #include <QMainWindow> | |
41 | #include "../proxy/socexplorerproxy.h" |
|
41 | #include "../proxy/socexplorerproxy.h" | |
42 |
class |
|
42 | class SocExplorerMainWindow; | |
43 | class PythonConsole : public QWidget |
|
43 | class PythonConsole : public QWidget | |
44 | { |
|
44 | { | |
45 | Q_OBJECT |
|
45 | Q_OBJECT | |
46 | public: |
|
46 | public: | |
47 | explicit PythonConsole(socexplorerproxy* proxy,QWidget *parent = 0); |
|
47 | explicit PythonConsole(socexplorerproxy* proxy,QWidget *parent = 0); | |
48 |
|
48 | |||
49 | signals: |
|
49 | signals: | |
50 | void rootDriverDelete(); |
|
50 | void rootDriverDelete(); | |
51 | public slots: |
|
51 | public slots: | |
52 | void setBussDriver(socexplorerplugin* driver); |
|
52 | void setBussDriver(socexplorerplugin* driver); | |
53 | void removeBussDriver(); |
|
53 | void removeBussDriver(); | |
54 | void removeDriver(const QString& instanceName); |
|
54 | void removeDriver(const QString& instanceName); | |
55 | void pyConsoleRunFiles(const QStringList&); |
|
55 | void pyConsoleRunFiles(const QStringList&); | |
56 | void pyConsoleRunFile(const QString& fileName); |
|
56 | void pyConsoleRunFile(const QString& fileName); | |
57 | void registerObject(QObject* object,const QString& instanceName); |
|
57 | void registerObject(QObject* object,const QString& instanceName); | |
58 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
58 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); | |
59 | void addObject(const QString& name, QObject* object); |
|
59 | void addObject(const QString& name, QObject* object); | |
60 | protected: |
|
60 | protected: | |
61 | QSize sizeHint(); |
|
61 | QSize sizeHint(); | |
62 |
|
62 | |||
63 | private: |
|
63 | private: | |
64 | QHBoxLayout* mainlayout; |
|
64 | QHBoxLayout* mainlayout; | |
65 | socexplorerplugin* bussdriver; |
|
65 | socexplorerplugin* bussdriver; | |
66 | PythonQtScriptingConsoleDandD* console; |
|
66 | PythonQtScriptingConsoleDandD* console; | |
67 | PythonQtObjectPtr* mainContext; |
|
67 | PythonQtObjectPtr* mainContext; | |
68 | socexplorerproxy* proxy; |
|
68 | socexplorerproxy* proxy; | |
69 | //LPMONMainWindow* mainwin; |
|
69 | //LPMONMainWindow* mainwin; | |
70 | }; |
|
70 | }; | |
71 |
|
71 | |||
72 | #endif // PYTHONCONSOLE_H |
|
72 | #endif // PYTHONCONSOLE_H |
@@ -1,54 +1,54 | |||||
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, |
|
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 | #ifndef PYTHONQTSCRIPTINGCONSOLEDANDD_H |
|
22 | #ifndef PYTHONQTSCRIPTINGCONSOLEDANDD_H | |
23 | #define PYTHONQTSCRIPTINGCONSOLEDANDD_H |
|
23 | #define PYTHONQTSCRIPTINGCONSOLEDANDD_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 "../plugins/socexplorerplugin.h" |
|
27 | #include "../plugins/socexplorerplugin.h" | |
28 | #include <QtGui/QDragEnterEvent> |
|
28 | #include <QtGui/QDragEnterEvent> | |
29 | #include <QtGui/QDragLeaveEvent> |
|
29 | #include <QtGui/QDragLeaveEvent> | |
30 | #include <QtGui/QDragMoveEvent> |
|
30 | #include <QtGui/QDragMoveEvent> | |
31 | #include <QtGui/QDropEvent> |
|
31 | #include <QtGui/QDropEvent> | |
32 | #include <QtCore/QMimeData> |
|
32 | #include <QtCore/QMimeData> | |
33 | #include <QtCore/QUrl> |
|
33 | #include <QtCore/QUrl> | |
34 | #include <QtCore/QList> |
|
34 | #include <QtCore/QList> | |
35 | #include "NicePyConsole/NicePyConsole.h" |
|
35 | #include "NicePyConsole/NicePyConsole.h" | |
36 |
|
36 | |||
37 | class PythonQtScriptingConsoleDandD : public NicePyConsole |
|
37 | class PythonQtScriptingConsoleDandD : public NicePyConsole | |
38 | { |
|
38 | { | |
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 | public: |
|
40 | public: | |
41 | PythonQtScriptingConsoleDandD(QWidget* parent, const PythonQtObjectPtr& context, Qt::WindowFlags i = 0); |
|
41 | PythonQtScriptingConsoleDandD(QWidget* parent, const PythonQtObjectPtr& context, Qt::WindowFlags i = 0); | |
42 |
|
42 | |||
43 | //void pyConsoleRunFiles(const QStringList&); |
|
43 | //void pyConsoleRunFiles(const QStringList&); | |
44 | signals: |
|
44 | signals: | |
45 | void pyConsoleRunFiles(const QStringList&); |
|
45 | void pyConsoleRunFiles(const QStringList&); | |
46 | protected: |
|
46 | protected: | |
47 | void dropEvent(QDropEvent * event); |
|
47 | void dropEvent(QDropEvent * event); | |
48 | void dragMoveEvent(QDragMoveEvent *e); |
|
48 | void dragMoveEvent(QDragMoveEvent *e); | |
49 | void dragEnterEvent(QDragEnterEvent *e); |
|
49 | void dragEnterEvent(QDragEnterEvent *e); | |
50 | private: |
|
50 | private: | |
51 |
|
51 | |||
52 | }; |
|
52 | }; | |
53 |
|
53 | |||
54 | #endif // PYTHONQTSCRIPTINGCONSOLEDANDD_H |
|
54 | #endif // PYTHONQTSCRIPTINGCONSOLEDANDD_H |
@@ -1,92 +1,92 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 "registerdata.h" |
|
22 | #include "registerdata.h" | |
23 |
|
23 | |||
24 |
|
24 | |||
25 |
|
25 | |||
26 |
|
26 | |||
27 |
|
27 | |||
28 | ucSystemOnChip::ucSystemOnChip(QObject *parent) |
|
28 | ucSystemOnChip::ucSystemOnChip(QObject *parent) | |
29 | :QObject(parent),QList<ucPeripheral*>() |
|
29 | :QObject(parent),QList<ucPeripheral*>() | |
30 | { |
|
30 | { | |
31 |
|
31 | |||
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 |
|
34 | |||
35 | ucPeripheral::ucPeripheral(QObject *parent) |
|
35 | ucPeripheral::ucPeripheral(QObject *parent) | |
36 | :QObject(parent),QList<ucRegister*>() |
|
36 | :QObject(parent),QList<ucRegister*>() | |
37 | { |
|
37 | { | |
38 |
|
38 | |||
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 |
|
41 | |||
42 |
|
42 | |||
43 | ucRegister::ucRegister(QObject *parent) |
|
43 | ucRegister::ucRegister(QObject *parent) | |
44 | :QObject(parent) |
|
44 | :QObject(parent) | |
45 | { |
|
45 | { | |
46 |
|
46 | |||
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | quint32 ucRegister::value() |
|
49 | quint32 ucRegister::value() | |
50 | { |
|
50 | { | |
51 | return this->p_value; |
|
51 | return this->p_value; | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | void ucRegister::setName(const QString &name) |
|
54 | void ucRegister::setName(const QString &name) | |
55 | { |
|
55 | { | |
56 | this->p_name = name; |
|
56 | this->p_name = name; | |
57 | emit nameChanged(this->p_name); |
|
57 | emit nameChanged(this->p_name); | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | void ucRegister::setValue(quint32 value) |
|
60 | void ucRegister::setValue(quint32 value) | |
61 | { |
|
61 | { | |
62 | this->p_value = value; |
|
62 | this->p_value = value; | |
63 | emit valueChanged(this->p_value); |
|
63 | emit valueChanged(this->p_value); | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | void ucRegister::setOffset(qint64 offset) |
|
66 | void ucRegister::setOffset(qint64 offset) | |
67 | { |
|
67 | { | |
68 | this->p_addressOffset = offset; |
|
68 | this->p_addressOffset = offset; | |
69 | emit offsetChanged(this->p_addressOffset); |
|
69 | emit offsetChanged(this->p_addressOffset); | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | void ucSystemOnChip::setName(const QString &name) |
|
72 | void ucSystemOnChip::setName(const QString &name) | |
73 | { |
|
73 | { | |
74 | this->p_name = name; |
|
74 | this->p_name = name; | |
75 | emit nameChanged(this->p_name); |
|
75 | emit nameChanged(this->p_name); | |
76 | } |
|
76 | } | |
77 |
|
77 | |||
78 |
|
78 | |||
79 |
|
79 | |||
80 |
|
80 | |||
81 |
|
81 | |||
82 |
|
82 | |||
83 |
|
83 | |||
84 |
|
84 | |||
85 |
|
85 | |||
86 |
|
86 | |||
87 |
|
87 | |||
88 |
|
88 | |||
89 |
|
89 | |||
90 |
|
90 | |||
91 |
|
91 | |||
92 |
|
92 |
@@ -1,107 +1,107 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 | #ifndef REGISTERDATA_H |
|
22 | #ifndef REGISTERDATA_H | |
23 | #define REGISTERDATA_H |
|
23 | #define REGISTERDATA_H | |
24 | #include <QString> |
|
24 | #include <QString> | |
25 | #include <QList> |
|
25 | #include <QList> | |
26 | #include <QObject> |
|
26 | #include <QObject> | |
27 |
|
27 | |||
28 | //class ucBitfield: public QObject |
|
28 | //class ucBitfield: public QObject | |
29 | //{ |
|
29 | //{ | |
30 | // Q_OBJECT |
|
30 | // Q_OBJECT | |
31 | //public: |
|
31 | //public: | |
32 | // explicit ucBitfield(QObject* parent =0); |
|
32 | // explicit ucBitfield(QObject* parent =0); | |
33 | // explicit ucBitfield(const QString& name,int offset,const QString& description,QObject* parent =0); |
|
33 | // explicit ucBitfield(const QString& name,int offset,const QString& description,QObject* parent =0); | |
34 | // QString name(); |
|
34 | // QString name(); | |
35 | // int offset(); |
|
35 | // int offset(); | |
36 | // QString description(); |
|
36 | // QString description(); | |
37 | //public slots: |
|
37 | //public slots: | |
38 | // void setName(const QString& name); |
|
38 | // void setName(const QString& name); | |
39 | // void setOffset(int offset); |
|
39 | // void setOffset(int offset); | |
40 | // void setDescription(const QString& description); |
|
40 | // void setDescription(const QString& description); | |
41 |
|
41 | |||
42 | //signals: |
|
42 | //signals: | |
43 | // void nameChanged(const QString& name); |
|
43 | // void nameChanged(const QString& name); | |
44 | // void offsetChanged(int offset); |
|
44 | // void offsetChanged(int offset); | |
45 | // void descriptionChanged(const QString& description); |
|
45 | // void descriptionChanged(const QString& description); | |
46 | //private: |
|
46 | //private: | |
47 |
|
47 | |||
48 | // QString p_name; |
|
48 | // QString p_name; | |
49 | // int p_offset; |
|
49 | // int p_offset; | |
50 | // QString p_description; |
|
50 | // QString p_description; | |
51 | //}; |
|
51 | //}; | |
52 |
|
52 | |||
53 | class ucRegister :public QObject |
|
53 | class ucRegister :public QObject | |
54 | { |
|
54 | { | |
55 | Q_OBJECT |
|
55 | Q_OBJECT | |
56 | public: |
|
56 | public: | |
57 | ucRegister(QObject* parent=0); |
|
57 | ucRegister(QObject* parent=0); | |
58 | quint32 value(); |
|
58 | quint32 value(); | |
59 | public slots: |
|
59 | public slots: | |
60 | void setName(const QString& name); |
|
60 | void setName(const QString& name); | |
61 | void setValue(quint32 value); |
|
61 | void setValue(quint32 value); | |
62 | void setOffset(qint64 offset); |
|
62 | void setOffset(qint64 offset); | |
63 | signals: |
|
63 | signals: | |
64 | void nameChanged(const QString& name); |
|
64 | void nameChanged(const QString& name); | |
65 | void offsetChanged(qint64 offset); |
|
65 | void offsetChanged(qint64 offset); | |
66 | void valueChanged(quint32 value); |
|
66 | void valueChanged(quint32 value); | |
67 | private: |
|
67 | private: | |
68 | QString p_name; |
|
68 | QString p_name; | |
69 | qint64 p_addressOffset; |
|
69 | qint64 p_addressOffset; | |
70 | quint32 p_value; |
|
70 | quint32 p_value; | |
71 | }; |
|
71 | }; | |
72 |
|
72 | |||
73 | class ucPeripheral: public QObject,public QList<ucRegister*> |
|
73 | class ucPeripheral: public QObject,public QList<ucRegister*> | |
74 | { |
|
74 | { | |
75 | Q_OBJECT |
|
75 | Q_OBJECT | |
76 | public: |
|
76 | public: | |
77 | ucPeripheral(QObject* parent=0); |
|
77 | ucPeripheral(QObject* parent=0); | |
78 | private: |
|
78 | private: | |
79 | QString p_name; |
|
79 | QString p_name; | |
80 | qint64 p_baseAddress; |
|
80 | qint64 p_baseAddress; | |
81 | }; |
|
81 | }; | |
82 |
|
82 | |||
83 |
|
83 | |||
84 |
|
84 | |||
85 | class ucSystemOnChip : public QObject,public QList<ucPeripheral*> |
|
85 | class ucSystemOnChip : public QObject,public QList<ucPeripheral*> | |
86 | { |
|
86 | { | |
87 | Q_OBJECT |
|
87 | Q_OBJECT | |
88 | public: |
|
88 | public: | |
89 | ucSystemOnChip(QObject* parent=0); |
|
89 | ucSystemOnChip(QObject* parent=0); | |
90 | public slots: |
|
90 | public slots: | |
91 | void setName(const QString& name); |
|
91 | void setName(const QString& name); | |
92 | signals: |
|
92 | signals: | |
93 | void nameChanged(const QString& name); |
|
93 | void nameChanged(const QString& name); | |
94 | private: |
|
94 | private: | |
95 | QString p_name; |
|
95 | QString p_name; | |
96 | }; |
|
96 | }; | |
97 |
|
97 | |||
98 |
|
98 | |||
99 |
|
99 | |||
100 | #endif // REGISTERDATA_H |
|
100 | #endif // REGISTERDATA_H | |
101 |
|
101 | |||
102 |
|
102 | |||
103 |
|
103 | |||
104 |
|
104 | |||
105 |
|
105 | |||
106 |
|
106 | |||
107 |
|
107 |
@@ -1,99 +1,99 | |||||
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) 2014, |
|
3 | -- Copyright (C) 2014, 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 |
|
22 | |||
23 | #include "socclk.h" |
|
23 | #include "socclk.h" | |
24 |
|
24 | |||
25 |
|
25 | |||
26 |
|
26 | |||
27 | SOCclk::SOCclk(const QString &name, qint64 value, qint64 divisor, qint64 multiplier) |
|
27 | SOCclk::SOCclk(const QString &name, qint64 value, qint64 divisor, qint64 multiplier) | |
28 | { |
|
28 | { | |
29 | this->p_Name = name; |
|
29 | this->p_Name = name; | |
30 | this->p_Value = value; |
|
30 | this->p_Value = value; | |
31 | this->p_parentClk = NULL; |
|
31 | this->p_parentClk = NULL; | |
32 | this->p_Multiplier= multiplier; |
|
32 | this->p_Multiplier= multiplier; | |
33 | this->p_Divisor = divisor; |
|
33 | this->p_Divisor = divisor; | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | void SOCclk::appendChild(SOCclk *child) |
|
36 | void SOCclk::appendChild(SOCclk *child) | |
37 | { |
|
37 | { | |
38 | this->p_childrenClk.append(child); |
|
38 | this->p_childrenClk.append(child); | |
39 | child->setParentClk(this); |
|
39 | child->setParentClk(this); | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | void SOCclk::setParentClk(SOCclk *parent) |
|
42 | void SOCclk::setParentClk(SOCclk *parent) | |
43 | { |
|
43 | { | |
44 | p_parentClk = parent; |
|
44 | p_parentClk = parent; | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 | SOCclk *SOCclk::getClk(const QString &name) |
|
47 | SOCclk *SOCclk::getClk(const QString &name) | |
48 | { |
|
48 | { | |
49 | SOCclk* clk=NULL; |
|
49 | SOCclk* clk=NULL; | |
50 | if(this->p_Name==name)return this; |
|
50 | if(this->p_Name==name)return this; | |
51 | for(int i=0;i<=p_childrenClk.count();i++) |
|
51 | for(int i=0;i<=p_childrenClk.count();i++) | |
52 | { |
|
52 | { | |
53 | clk =p_childrenClk.at(i)->getClk(name); |
|
53 | clk =p_childrenClk.at(i)->getClk(name); | |
54 | if(clk!=NULL)break; |
|
54 | if(clk!=NULL)break; | |
55 | } |
|
55 | } | |
56 | return clk; |
|
56 | return clk; | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | qint64 SOCclk::Value() |
|
59 | qint64 SOCclk::Value() | |
60 | { |
|
60 | { | |
61 | if(p_parentClk==NULL) |
|
61 | if(p_parentClk==NULL) | |
62 | return p_Value; |
|
62 | return p_Value; | |
63 | return p_parentClk->Value()*p_Multiplier/p_Divisor; |
|
63 | return p_parentClk->Value()*p_Multiplier/p_Divisor; | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | void SOCclk::setValue(qint64 value) |
|
66 | void SOCclk::setValue(qint64 value) | |
67 | { |
|
67 | { | |
68 | this->p_Value = value; |
|
68 | this->p_Value = value; | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | qint64 SOCclk::Divisor() |
|
71 | qint64 SOCclk::Divisor() | |
72 | { |
|
72 | { | |
73 | return p_Divisor; |
|
73 | return p_Divisor; | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | void SOCclk::setDivisor(qint64 divisor) |
|
76 | void SOCclk::setDivisor(qint64 divisor) | |
77 | { |
|
77 | { | |
78 | p_Divisor = divisor; |
|
78 | p_Divisor = divisor; | |
79 | } |
|
79 | } | |
80 |
|
80 | |||
81 | qint64 SOCclk::Multiplier() |
|
81 | qint64 SOCclk::Multiplier() | |
82 | { |
|
82 | { | |
83 | return p_Multiplier; |
|
83 | return p_Multiplier; | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 | void SOCclk::setMultiplier(qint64 multiplier) |
|
86 | void SOCclk::setMultiplier(qint64 multiplier) | |
87 | { |
|
87 | { | |
88 | p_Multiplier = multiplier; |
|
88 | p_Multiplier = multiplier; | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | QString SOCclk::Name() |
|
91 | QString SOCclk::Name() | |
92 | { |
|
92 | { | |
93 | return p_Name; |
|
93 | return p_Name; | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
96 | void SOCclk::setName(const QString &name) |
|
96 | void SOCclk::setName(const QString &name) | |
97 | { |
|
97 | { | |
98 | this->p_Name = name; |
|
98 | this->p_Name = name; | |
99 | } |
|
99 | } |
@@ -1,55 +1,55 | |||||
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) 2014, |
|
3 | -- Copyright (C) 2014, 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 |
|
22 | |||
23 | #ifndef SOCCLK_H |
|
23 | #ifndef SOCCLK_H | |
24 | #define SOCCLK_H |
|
24 | #define SOCCLK_H | |
25 | #include <QString> |
|
25 | #include <QString> | |
26 | #include <QList> |
|
26 | #include <QList> | |
27 | #include <socexplorer.h> |
|
27 | #include <socexplorer.h> | |
28 |
|
28 | |||
29 | class SOCEXPLORER_EXPORT SOCclk |
|
29 | class SOCEXPLORER_EXPORT SOCclk | |
30 | { |
|
30 | { | |
31 | public: |
|
31 | public: | |
32 | SOCclk(const QString& name, qint64 value, qint64 divisor, qint64 multiplier); |
|
32 | SOCclk(const QString& name, qint64 value, qint64 divisor, qint64 multiplier); | |
33 | void appendChild(SOCclk* child); |
|
33 | void appendChild(SOCclk* child); | |
34 | void setParentClk(SOCclk* parent); |
|
34 | void setParentClk(SOCclk* parent); | |
35 | SOCclk* getClk(const QString& name); |
|
35 | SOCclk* getClk(const QString& name); | |
36 |
|
36 | |||
37 | qint64 Value(); |
|
37 | qint64 Value(); | |
38 | void setValue(qint64 value); |
|
38 | void setValue(qint64 value); | |
39 | qint64 Divisor(); |
|
39 | qint64 Divisor(); | |
40 | void setDivisor(qint64 divisor); |
|
40 | void setDivisor(qint64 divisor); | |
41 | qint64 Multiplier(); |
|
41 | qint64 Multiplier(); | |
42 | void setMultiplier(qint64 multiplier); |
|
42 | void setMultiplier(qint64 multiplier); | |
43 | QString Name(); |
|
43 | QString Name(); | |
44 | void setName(const QString& name); |
|
44 | void setName(const QString& name); | |
45 | private: |
|
45 | private: | |
46 | qint64 p_Value; |
|
46 | qint64 p_Value; | |
47 | QString p_Name; |
|
47 | QString p_Name; | |
48 | qint64 p_Divisor; |
|
48 | qint64 p_Divisor; | |
49 | qint64 p_Multiplier; |
|
49 | qint64 p_Multiplier; | |
50 | QList<SOCclk*> p_childrenClk; |
|
50 | QList<SOCclk*> p_childrenClk; | |
51 | SOCclk* p_parentClk; |
|
51 | SOCclk* p_parentClk; | |
52 | }; |
|
52 | }; | |
53 |
|
53 | |||
54 |
|
54 | |||
55 | #endif // SOCCLK_H |
|
55 | #endif // SOCCLK_H |
@@ -1,43 +1,43 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 "socexplorerenumdevice.h" |
|
22 | #include "socexplorerenumdevice.h" | |
23 |
|
23 | |||
24 | socExplorerEnumDevice::socExplorerEnumDevice(SOCModel* soc, int VID, int PID, qint32 baseAddress, const QString &name, QObject *parent) |
|
24 | socExplorerEnumDevice::socExplorerEnumDevice(SOCModel* soc, int VID, int PID, qint32 baseAddress, const QString &name, QObject *parent) | |
25 | :QObject(parent) |
|
25 | :QObject(parent) | |
26 | { |
|
26 | { | |
27 | _VID=VID; |
|
27 | _VID=VID; | |
28 | _PID=PID; |
|
28 | _PID=PID; | |
29 | _baseAddress=baseAddress; |
|
29 | _baseAddress=baseAddress; | |
30 | _devName=new QString(name); |
|
30 | _devName=new QString(name); | |
31 | _visible=true; |
|
31 | _visible=true; | |
32 | _SOC = soc; |
|
32 | _SOC = soc; | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | void socExplorerEnumDevice::writeReg(qint32 address, qint32 value) |
|
35 | void socExplorerEnumDevice::writeReg(qint32 address, qint32 value) | |
36 | { |
|
36 | { | |
37 | _SOC->writeReg(address,value); |
|
37 | _SOC->writeReg(address,value); | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | qint32 socExplorerEnumDevice::readReg(qint32 address) |
|
40 | qint32 socExplorerEnumDevice::readReg(qint32 address) | |
41 | { |
|
41 | { | |
42 | return _SOC->readReg(address); |
|
42 | return _SOC->readReg(address); | |
43 | } |
|
43 | } |
@@ -1,56 +1,56 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 | #ifndef SOCEXPLORERENUMDEVICE_H |
|
22 | #ifndef SOCEXPLORERENUMDEVICE_H | |
23 | #define SOCEXPLORERENUMDEVICE_H |
|
23 | #define SOCEXPLORERENUMDEVICE_H | |
24 |
|
24 | |||
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 | #include <stdint.h> |
|
26 | #include <stdint.h> | |
27 | #include <socexplorerplugin.h> |
|
27 | #include <socexplorerplugin.h> | |
28 | #include <socmodel.h> |
|
28 | #include <socmodel.h> | |
29 |
|
29 | |||
30 | class SOCEXPLORER_EXPORT socExplorerEnumDevice : public QObject |
|
30 | class SOCEXPLORER_EXPORT socExplorerEnumDevice : public QObject | |
31 | { |
|
31 | { | |
32 | Q_OBJECT |
|
32 | Q_OBJECT | |
33 | public: |
|
33 | public: | |
34 | explicit socExplorerEnumDevice(SOCModel* soc,int VID,int PID,qint32 baseAddress,const QString& name,QObject *parent = 0); |
|
34 | explicit socExplorerEnumDevice(SOCModel* soc,int VID,int PID,qint32 baseAddress,const QString& name,QObject *parent = 0); | |
35 | qint32 baseAddress(){return _baseAddress;} |
|
35 | qint32 baseAddress(){return _baseAddress;} | |
36 | int VID(){return _VID;} |
|
36 | int VID(){return _VID;} | |
37 | int PID(){return _PID;} |
|
37 | int PID(){return _PID;} | |
38 | QString name(){return *_devName;} |
|
38 | QString name(){return *_devName;} | |
39 | bool visible(){return _visible;} |
|
39 | bool visible(){return _visible;} | |
40 | void setVisible(bool visible){_visible=visible;} |
|
40 | void setVisible(bool visible){_visible=visible;} | |
41 | signals: |
|
41 | signals: | |
42 |
|
42 | |||
43 | public slots: |
|
43 | public slots: | |
44 | void writeReg(qint32 address,qint32 value); |
|
44 | void writeReg(qint32 address,qint32 value); | |
45 | qint32 readReg(qint32 address); |
|
45 | qint32 readReg(qint32 address); | |
46 | private: |
|
46 | private: | |
47 | bool _visible; |
|
47 | bool _visible; | |
48 | qint32 _baseAddress; |
|
48 | qint32 _baseAddress; | |
49 | int _VID; |
|
49 | int _VID; | |
50 | int _PID; |
|
50 | int _PID; | |
51 | QString* _devName; |
|
51 | QString* _devName; | |
52 | SOCModel* _SOC; |
|
52 | SOCModel* _SOC; | |
53 |
|
53 | |||
54 | }; |
|
54 | }; | |
55 |
|
55 | |||
56 | #endif // SOCEXPLORERENUMDEVICE_H |
|
56 | #endif // SOCEXPLORERENUMDEVICE_H |
@@ -1,99 +1,99 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 "socmodel.h" |
|
22 | #include "socmodel.h" | |
23 | #include <socexplorerenumdevice.h> |
|
23 | #include <socexplorerenumdevice.h> | |
24 |
|
24 | |||
25 |
|
25 | |||
26 | SOCModel::SOCModel(socexplorerplugin *rootDev, QObject *parent): |
|
26 | SOCModel::SOCModel(socexplorerplugin *rootDev, QObject *parent): | |
27 | QObject(parent) |
|
27 | QObject(parent) | |
28 | { |
|
28 | { | |
29 | p_rootDev = rootDev; |
|
29 | p_rootDev = rootDev; | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | qint32 SOCModel::getEnumDeviceBaseAddress(int VID, int PID, int count) |
|
32 | qint32 SOCModel::getEnumDeviceBaseAddress(int VID, int PID, int count) | |
33 | { |
|
33 | { | |
34 | for(int i=0;i<p_enumeratedDevices.count();i++) |
|
34 | for(int i=0;i<p_enumeratedDevices.count();i++) | |
35 | { |
|
35 | { | |
36 | if((p_enumeratedDevices.at(i)->VID()==VID) && (p_enumeratedDevices.at(i)->PID()==PID)) |
|
36 | if((p_enumeratedDevices.at(i)->VID()==VID) && (p_enumeratedDevices.at(i)->PID()==PID)) | |
37 | { |
|
37 | { | |
38 | if(count==0) |
|
38 | if(count==0) | |
39 | { |
|
39 | { | |
40 | return p_enumeratedDevices.at(i)->baseAddress(); |
|
40 | return p_enumeratedDevices.at(i)->baseAddress(); | |
41 | } |
|
41 | } | |
42 | count--; |
|
42 | count--; | |
43 | } |
|
43 | } | |
44 | } |
|
44 | } | |
45 | return -1; |
|
45 | return -1; | |
46 | } |
|
46 | } | |
47 |
|
47 | |||
48 | socExplorerEnumDevice *SOCModel::addEnumDevice( int VID, int PID, qint32 baseAddress, const QString &name) |
|
48 | socExplorerEnumDevice *SOCModel::addEnumDevice( int VID, int PID, qint32 baseAddress, const QString &name) | |
49 | { |
|
49 | { | |
50 | if(enumDeviceExists(baseAddress)) |
|
50 | if(enumDeviceExists(baseAddress)) | |
51 | return getEnumDevice(baseAddress); |
|
51 | return getEnumDevice(baseAddress); | |
52 | socExplorerEnumDevice* device= new socExplorerEnumDevice(this,VID,PID,baseAddress,name); |
|
52 | socExplorerEnumDevice* device= new socExplorerEnumDevice(this,VID,PID,baseAddress,name); | |
53 | p_enumeratedDevices.append(device); |
|
53 | p_enumeratedDevices.append(device); | |
54 | return device; |
|
54 | return device; | |
55 | } |
|
55 | } | |
56 |
|
56 | |||
57 | int SOCModel::addEnumDevice(socExplorerEnumDevice *device) |
|
57 | int SOCModel::addEnumDevice(socExplorerEnumDevice *device) | |
58 | { |
|
58 | { | |
59 | if(enumDeviceExists(device->baseAddress())) |
|
59 | if(enumDeviceExists(device->baseAddress())) | |
60 | return 0; |
|
60 | return 0; | |
61 | p_enumeratedDevices.append(device); |
|
61 | p_enumeratedDevices.append(device); | |
62 | return 1; |
|
62 | return 1; | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 |
|
65 | |||
66 |
|
66 | |||
67 | bool SOCModel::enumDeviceExists(qint32 baseAddress) |
|
67 | bool SOCModel::enumDeviceExists(qint32 baseAddress) | |
68 | { |
|
68 | { | |
69 | for(int i=0;i<p_enumeratedDevices.count();i++) |
|
69 | for(int i=0;i<p_enumeratedDevices.count();i++) | |
70 | { |
|
70 | { | |
71 | if(p_enumeratedDevices.at(i)->baseAddress()==baseAddress) |
|
71 | if(p_enumeratedDevices.at(i)->baseAddress()==baseAddress) | |
72 | return true; |
|
72 | return true; | |
73 | } |
|
73 | } | |
74 | return false; |
|
74 | return false; | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | socExplorerEnumDevice *SOCModel::getEnumDevice(qint32 baseAddress) |
|
77 | socExplorerEnumDevice *SOCModel::getEnumDevice(qint32 baseAddress) | |
78 | { |
|
78 | { | |
79 | for(int i=0;i<p_enumeratedDevices.count();i++) |
|
79 | for(int i=0;i<p_enumeratedDevices.count();i++) | |
80 | { |
|
80 | { | |
81 | if(p_enumeratedDevices.at(i)->baseAddress()==baseAddress) |
|
81 | if(p_enumeratedDevices.at(i)->baseAddress()==baseAddress) | |
82 | return p_enumeratedDevices.at(i); |
|
82 | return p_enumeratedDevices.at(i); | |
83 | } |
|
83 | } | |
84 | return NULL; |
|
84 | return NULL; | |
85 | } |
|
85 | } | |
86 |
|
86 | |||
87 |
|
87 | |||
88 | void SOCModel::writeReg(qint32 address, qint32 value) |
|
88 | void SOCModel::writeReg(qint32 address, qint32 value) | |
89 | { |
|
89 | { | |
90 | uint valueInt=value,addressInt=address; |
|
90 | uint valueInt=value,addressInt=address; | |
91 | p_rootDev->Write(&valueInt,1,addressInt); |
|
91 | p_rootDev->Write(&valueInt,1,addressInt); | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 | qint32 SOCModel::readReg(qint32 address) |
|
94 | qint32 SOCModel::readReg(qint32 address) | |
95 | { |
|
95 | { | |
96 | uint valueInt=0,addressInt=address; |
|
96 | uint valueInt=0,addressInt=address; | |
97 | p_rootDev->Read(&valueInt,1,addressInt); |
|
97 | p_rootDev->Read(&valueInt,1,addressInt); | |
98 | return (qint32)valueInt; |
|
98 | return (qint32)valueInt; | |
99 | } |
|
99 | } |
@@ -1,115 +1,115 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 |
|
22 | |||
23 | #ifndef REGISTERSMODEL_H |
|
23 | #ifndef REGISTERSMODEL_H | |
24 | #define REGISTERSMODEL_H |
|
24 | #define REGISTERSMODEL_H | |
25 | #include <QString> |
|
25 | #include <QString> | |
26 | #include <QList> |
|
26 | #include <QList> | |
27 | #include <QObject> |
|
27 | #include <QObject> | |
28 | #include <QDomDocument> |
|
28 | #include <QDomDocument> | |
29 | #include <QDomElement> |
|
29 | #include <QDomElement> | |
30 | #include "registerdata.h" |
|
30 | #include "registerdata.h" | |
31 | #include <socclk.h> |
|
31 | #include <socclk.h> | |
32 | #include <socexplorerplugin.h> |
|
32 | #include <socexplorerplugin.h> | |
33 | //#include <socexplorerenumdevice.h> |
|
33 | //#include <socexplorerenumdevice.h> | |
34 | class socExplorerEnumDevice; |
|
34 | class socExplorerEnumDevice; | |
35 |
|
35 | |||
36 | class registerBitFieldModel |
|
36 | class registerBitFieldModel | |
37 | { |
|
37 | { | |
38 | public: |
|
38 | public: | |
39 | registerBitFieldModel(const QString& name,const QString& description, |
|
39 | registerBitFieldModel(const QString& name,const QString& description, | |
40 | int size, int offset, bool rw) |
|
40 | int size, int offset, bool rw) | |
41 | { |
|
41 | { | |
42 | this->name = name; |
|
42 | this->name = name; | |
43 | this->description = description; |
|
43 | this->description = description; | |
44 | this->size = size; |
|
44 | this->size = size; | |
45 | this->offset = offset; |
|
45 | this->offset = offset; | |
46 | this->rw = rw; |
|
46 | this->rw = rw; | |
47 | } |
|
47 | } | |
48 | QString name; |
|
48 | QString name; | |
49 | QString description; |
|
49 | QString description; | |
50 | int size; |
|
50 | int size; | |
51 | int offset; |
|
51 | int offset; | |
52 | bool rw; |
|
52 | bool rw; | |
53 | }; |
|
53 | }; | |
54 |
|
54 | |||
55 | class registerModel |
|
55 | class registerModel | |
56 | { |
|
56 | { | |
57 | public: |
|
57 | public: | |
58 | registerModel(const QString& name,qint32 offset) |
|
58 | registerModel(const QString& name,qint32 offset) | |
59 | { |
|
59 | { | |
60 | this->name = name; |
|
60 | this->name = name; | |
61 | this->offset = offset; |
|
61 | this->offset = offset; | |
62 | } |
|
62 | } | |
63 | QString name; |
|
63 | QString name; | |
64 | qint32 offset; |
|
64 | qint32 offset; | |
65 | QList<registerBitFieldModel> bitfields; |
|
65 | QList<registerBitFieldModel> bitfields; | |
66 | }; |
|
66 | }; | |
67 |
|
67 | |||
68 | class peripheralModel |
|
68 | class peripheralModel | |
69 | { |
|
69 | { | |
70 | public: |
|
70 | public: | |
71 | peripheralModel(const QString& name) |
|
71 | peripheralModel(const QString& name) | |
72 | { |
|
72 | { | |
73 | this->name = name; |
|
73 | this->name = name; | |
74 | } |
|
74 | } | |
75 | QString name; |
|
75 | QString name; | |
76 | QList<registerModel> registers; |
|
76 | QList<registerModel> registers; | |
77 | }; |
|
77 | }; | |
78 |
|
78 | |||
79 |
|
79 | |||
80 | class SOCEXPLORER_EXPORT SOCModel :public QObject |
|
80 | class SOCEXPLORER_EXPORT SOCModel :public QObject | |
81 | { |
|
81 | { | |
82 | Q_OBJECT |
|
82 | Q_OBJECT | |
83 | public: |
|
83 | public: | |
84 | SOCModel(socexplorerplugin* rootDev,QObject* parent=0); |
|
84 | SOCModel(socexplorerplugin* rootDev,QObject* parent=0); | |
85 | // qint32 getRegValue(qint32 baseAddress); |
|
85 | // qint32 getRegValue(qint32 baseAddress); | |
86 | bool isRootDev(socexplorerplugin* rootDev) |
|
86 | bool isRootDev(socexplorerplugin* rootDev) | |
87 | { |
|
87 | { | |
88 | return rootDev==p_rootDev; |
|
88 | return rootDev==p_rootDev; | |
89 | } |
|
89 | } | |
90 | bool enumDeviceExists(qint32 baseAddress); |
|
90 | bool enumDeviceExists(qint32 baseAddress); | |
91 | socExplorerEnumDevice *getEnumDevice(qint32 baseAddress); |
|
91 | socExplorerEnumDevice *getEnumDevice(qint32 baseAddress); | |
92 | public slots: |
|
92 | public slots: | |
93 | //void setRegValue(qint32 baseAddress,qint32 value); |
|
93 | //void setRegValue(qint32 baseAddress,qint32 value); | |
94 | qint32 getEnumDeviceBaseAddress(int VID,int PID,int count=0); |
|
94 | qint32 getEnumDeviceBaseAddress(int VID,int PID,int count=0); | |
95 | socExplorerEnumDevice* addEnumDevice(int VID, int PID, qint32 baseAddress, const QString& name); |
|
95 | socExplorerEnumDevice* addEnumDevice(int VID, int PID, qint32 baseAddress, const QString& name); | |
96 | int addEnumDevice(socExplorerEnumDevice* device); |
|
96 | int addEnumDevice(socExplorerEnumDevice* device); | |
97 | void writeReg(qint32 address,qint32 value); |
|
97 | void writeReg(qint32 address,qint32 value); | |
98 | qint32 readReg(qint32 address); |
|
98 | qint32 readReg(qint32 address); | |
99 | private: |
|
99 | private: | |
100 | socexplorerplugin* p_rootDev; |
|
100 | socexplorerplugin* p_rootDev; | |
101 | QList<socExplorerEnumDevice*> p_enumeratedDevices; |
|
101 | QList<socExplorerEnumDevice*> p_enumeratedDevices; | |
102 | QList<SOCclk*> clktree; |
|
102 | QList<SOCclk*> clktree; | |
103 | }; |
|
103 | }; | |
104 |
|
104 | |||
105 |
|
105 | |||
106 |
|
106 | |||
107 |
|
107 | |||
108 | #endif // REGISTERSMODEL_H |
|
108 | #endif // REGISTERSMODEL_H | |
109 |
|
109 | |||
110 |
|
110 | |||
111 |
|
111 | |||
112 |
|
112 | |||
113 |
|
113 | |||
114 |
|
114 | |||
115 |
|
115 |
@@ -1,127 +1,127 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 "XMLdata.h" |
|
22 | #include "XMLdata.h" | |
23 |
|
23 | |||
24 | xmlDataBitfield::xmlDataBitfield(QObject *parent) |
|
24 | xmlDataBitfield::xmlDataBitfield(QObject *parent) | |
25 | :QObject(parent) |
|
25 | :QObject(parent) | |
26 | { |
|
26 | { | |
27 |
|
27 | |||
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | xmlDataBitfield::xmlDataBitfield(const QString& name,int offset,const QString& description,QObject* parent) |
|
30 | xmlDataBitfield::xmlDataBitfield(const QString& name,int offset,const QString& description,QObject* parent) | |
31 | { |
|
31 | { | |
32 | Q_UNUSED(name) |
|
32 | Q_UNUSED(name) | |
33 | Q_UNUSED(offset) |
|
33 | Q_UNUSED(offset) | |
34 | Q_UNUSED(offset) |
|
34 | Q_UNUSED(offset) | |
35 | Q_UNUSED(description) |
|
35 | Q_UNUSED(description) | |
36 | Q_UNUSED(parent) |
|
36 | Q_UNUSED(parent) | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | QString xmlDataBitfield::name() |
|
39 | QString xmlDataBitfield::name() | |
40 | { |
|
40 | { | |
41 | return this->p_name; |
|
41 | return this->p_name; | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | int xmlDataBitfield::offset() |
|
44 | int xmlDataBitfield::offset() | |
45 | { |
|
45 | { | |
46 | return this->p_offset; |
|
46 | return this->p_offset; | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | QString xmlDataBitfield::description() |
|
49 | QString xmlDataBitfield::description() | |
50 | { |
|
50 | { | |
51 | return this->p_description; |
|
51 | return this->p_description; | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 |
|
54 | |||
55 | void xmlDataBitfield::setName(const QString &name) |
|
55 | void xmlDataBitfield::setName(const QString &name) | |
56 | { |
|
56 | { | |
57 | this->p_name = name; |
|
57 | this->p_name = name; | |
58 | emit nameChanged(this->p_name); |
|
58 | emit nameChanged(this->p_name); | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | void xmlDataBitfield::setOffset(int offset) |
|
61 | void xmlDataBitfield::setOffset(int offset) | |
62 | { |
|
62 | { | |
63 | this->p_offset = offset; |
|
63 | this->p_offset = offset; | |
64 | emit offsetChanged(this->p_offset); |
|
64 | emit offsetChanged(this->p_offset); | |
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 | void xmlDataBitfield::setDescription(const QString &description) |
|
67 | void xmlDataBitfield::setDescription(const QString &description) | |
68 | { |
|
68 | { | |
69 | this->p_description = description; |
|
69 | this->p_description = description; | |
70 | emit descriptionChanged(this->p_description); |
|
70 | emit descriptionChanged(this->p_description); | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | xmlDataRegister::xmlDataRegister(QObject *parent) |
|
73 | xmlDataRegister::xmlDataRegister(QObject *parent) | |
74 | :QObject(parent),QList<xmlDataBitfield*>() |
|
74 | :QObject(parent),QList<xmlDataBitfield*>() | |
75 | { |
|
75 | { | |
76 |
|
76 | |||
77 | } |
|
77 | } | |
78 |
|
78 | |||
79 | void xmlDataRegister::setName(const QString &name) |
|
79 | void xmlDataRegister::setName(const QString &name) | |
80 | { |
|
80 | { | |
81 | this->p_name = name; |
|
81 | this->p_name = name; | |
82 | emit nameChanged(this->p_name); |
|
82 | emit nameChanged(this->p_name); | |
83 | } |
|
83 | } | |
84 |
|
84 | |||
85 | void xmlDataRegister::setValue(quint32 value) |
|
85 | void xmlDataRegister::setValue(quint32 value) | |
86 | { |
|
86 | { | |
87 | this->p_value = value; |
|
87 | this->p_value = value; | |
88 | emit valueChanged(this->p_value); |
|
88 | emit valueChanged(this->p_value); | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | void xmlDataRegister::setOffset(qint64 offset) |
|
91 | void xmlDataRegister::setOffset(qint64 offset) | |
92 | { |
|
92 | { | |
93 | this->p_addressOffset = offset; |
|
93 | this->p_addressOffset = offset; | |
94 | emit offsetChanged(this->p_addressOffset); |
|
94 | emit offsetChanged(this->p_addressOffset); | |
95 | } |
|
95 | } | |
96 |
|
96 | |||
97 | xmlDataPeripheral::xmlDataPeripheral(QObject *parent) |
|
97 | xmlDataPeripheral::xmlDataPeripheral(QObject *parent) | |
98 | :QObject(parent), QList<xmlDataRegister*>() |
|
98 | :QObject(parent), QList<xmlDataRegister*>() | |
99 | { |
|
99 | { | |
100 |
|
100 | |||
101 | } |
|
101 | } | |
102 |
|
102 | |||
103 | xmlDataSystemOnChip::xmlDataSystemOnChip(QObject *parent) |
|
103 | xmlDataSystemOnChip::xmlDataSystemOnChip(QObject *parent) | |
104 | :QObject(parent),QList<xmlDataRegister*>() |
|
104 | :QObject(parent),QList<xmlDataRegister*>() | |
105 | { |
|
105 | { | |
106 |
|
106 | |||
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | void xmlDataSystemOnChip::setName(const QString &name) |
|
109 | void xmlDataSystemOnChip::setName(const QString &name) | |
110 | { |
|
110 | { | |
111 | this->p_name = name; |
|
111 | this->p_name = name; | |
112 | emit nameChanged(this->p_name); |
|
112 | emit nameChanged(this->p_name); | |
113 | } |
|
113 | } | |
114 |
|
114 | |||
115 |
|
115 | |||
116 |
|
116 | |||
117 |
|
117 | |||
118 |
|
118 | |||
119 |
|
119 | |||
120 |
|
120 | |||
121 |
|
121 | |||
122 |
|
122 | |||
123 |
|
123 | |||
124 |
|
124 | |||
125 |
|
125 | |||
126 |
|
126 | |||
127 |
|
127 |
@@ -1,108 +1,108 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 | #ifndef XMLDATA_H |
|
22 | #ifndef XMLDATA_H | |
23 | #define XMLDATA_H |
|
23 | #define XMLDATA_H | |
24 | #include <QString> |
|
24 | #include <QString> | |
25 | #include <QList> |
|
25 | #include <QList> | |
26 | #include <QObject> |
|
26 | #include <QObject> | |
27 |
|
27 | |||
28 | class xmlDataBitfield: public QObject |
|
28 | class xmlDataBitfield: public QObject | |
29 | { |
|
29 | { | |
30 | Q_OBJECT |
|
30 | Q_OBJECT | |
31 | public: |
|
31 | public: | |
32 | explicit xmlDataBitfield(QObject* parent =0); |
|
32 | explicit xmlDataBitfield(QObject* parent =0); | |
33 | explicit xmlDataBitfield(const QString& name,int offset,const QString& description,QObject* parent =0); |
|
33 | explicit xmlDataBitfield(const QString& name,int offset,const QString& description,QObject* parent =0); | |
34 | QString name(); |
|
34 | QString name(); | |
35 | int offset(); |
|
35 | int offset(); | |
36 | QString description(); |
|
36 | QString description(); | |
37 | public slots: |
|
37 | public slots: | |
38 | void setName(const QString& name); |
|
38 | void setName(const QString& name); | |
39 | void setOffset(int offset); |
|
39 | void setOffset(int offset); | |
40 | void setDescription(const QString& description); |
|
40 | void setDescription(const QString& description); | |
41 |
|
41 | |||
42 | signals: |
|
42 | signals: | |
43 | void nameChanged(const QString& name); |
|
43 | void nameChanged(const QString& name); | |
44 | void offsetChanged(int offset); |
|
44 | void offsetChanged(int offset); | |
45 | void descriptionChanged(const QString& description); |
|
45 | void descriptionChanged(const QString& description); | |
46 | private: |
|
46 | private: | |
47 |
|
47 | |||
48 | QString p_name; |
|
48 | QString p_name; | |
49 | int p_offset; |
|
49 | int p_offset; | |
50 | QString p_description; |
|
50 | QString p_description; | |
51 | }; |
|
51 | }; | |
52 |
|
52 | |||
53 |
|
53 | |||
54 |
|
54 | |||
55 | class xmlDataRegister : public QObject, public QList<xmlDataBitfield*> |
|
55 | class xmlDataRegister : public QObject, public QList<xmlDataBitfield*> | |
56 | { |
|
56 | { | |
57 | Q_OBJECT |
|
57 | Q_OBJECT | |
58 | public: |
|
58 | public: | |
59 | xmlDataRegister(QObject* parent=0); |
|
59 | xmlDataRegister(QObject* parent=0); | |
60 | quint32 value(); |
|
60 | quint32 value(); | |
61 | public slots: |
|
61 | public slots: | |
62 | void setName(const QString& name); |
|
62 | void setName(const QString& name); | |
63 | void setValue(quint32 value); |
|
63 | void setValue(quint32 value); | |
64 | void setOffset(qint64 offset); |
|
64 | void setOffset(qint64 offset); | |
65 | signals: |
|
65 | signals: | |
66 | void nameChanged(const QString& name); |
|
66 | void nameChanged(const QString& name); | |
67 | void offsetChanged(qint64 offset); |
|
67 | void offsetChanged(qint64 offset); | |
68 | void valueChanged(quint32 value); |
|
68 | void valueChanged(quint32 value); | |
69 | private: |
|
69 | private: | |
70 | QString p_name; |
|
70 | QString p_name; | |
71 | qint64 p_addressOffset; |
|
71 | qint64 p_addressOffset; | |
72 | quint32 p_value; |
|
72 | quint32 p_value; | |
73 | }; |
|
73 | }; | |
74 |
|
74 | |||
75 | class xmlDataPeripheral:public QObject, public QList<xmlDataRegister*> |
|
75 | class xmlDataPeripheral:public QObject, public QList<xmlDataRegister*> | |
76 | { |
|
76 | { | |
77 | Q_OBJECT |
|
77 | Q_OBJECT | |
78 | public: |
|
78 | public: | |
79 | xmlDataPeripheral(QObject* parent=0); |
|
79 | xmlDataPeripheral(QObject* parent=0); | |
80 | private: |
|
80 | private: | |
81 | QString p_name; |
|
81 | QString p_name; | |
82 | qint64 p_baseAddress; |
|
82 | qint64 p_baseAddress; | |
83 | }; |
|
83 | }; | |
84 |
|
84 | |||
85 |
|
85 | |||
86 |
|
86 | |||
87 | class xmlDataSystemOnChip : public QObject, public QList<xmlDataRegister*> |
|
87 | class xmlDataSystemOnChip : public QObject, public QList<xmlDataRegister*> | |
88 | { |
|
88 | { | |
89 | Q_OBJECT |
|
89 | Q_OBJECT | |
90 | public: |
|
90 | public: | |
91 | xmlDataSystemOnChip(QObject* parent=0); |
|
91 | xmlDataSystemOnChip(QObject* parent=0); | |
92 | public slots: |
|
92 | public slots: | |
93 | void setName(const QString& name); |
|
93 | void setName(const QString& name); | |
94 | signals: |
|
94 | signals: | |
95 | void nameChanged(const QString& name); |
|
95 | void nameChanged(const QString& name); | |
96 | private: |
|
96 | private: | |
97 | QString p_name; |
|
97 | QString p_name; | |
98 | }; |
|
98 | }; | |
99 |
|
99 | |||
100 |
|
100 | |||
101 | #endif // XMLDATA_H |
|
101 | #endif // XMLDATA_H | |
102 |
|
102 | |||
103 |
|
103 | |||
104 |
|
104 | |||
105 |
|
105 | |||
106 |
|
106 | |||
107 |
|
107 | |||
108 |
|
108 |
@@ -1,167 +1,167 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 "XMLmodel.h" |
|
22 | #include "XMLmodel.h" | |
23 | #include <socexplorerengine.h> |
|
23 | #include <socexplorerengine.h> | |
24 | #include <QFile> |
|
24 | #include <QFile> | |
25 | #include <QDebug> |
|
25 | #include <QDebug> | |
26 |
|
26 | |||
27 | socExplorerXmlModel::socExplorerXmlModel(QObject *parent) |
|
27 | socExplorerXmlModel::socExplorerXmlModel(QObject *parent) | |
28 | :QObject(parent) |
|
28 | :QObject(parent) | |
29 | { |
|
29 | { | |
30 | p_driver = new XMLDriver; |
|
30 | p_driver = new XMLDriver; | |
31 | p_driver->scanXmlFiles(); |
|
31 | p_driver->scanXmlFiles(); | |
32 | this->updateSOClist(); |
|
32 | this->updateSOClist(); | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | int socExplorerXmlModel::checkXmlFile(const QString &fileName) |
|
35 | int socExplorerXmlModel::checkXmlFile(const QString &fileName) | |
36 | { |
|
36 | { | |
37 | return p_driver->checkXmlFile(fileName); |
|
37 | return p_driver->checkXmlFile(fileName); | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | int socExplorerXmlModel::createXmlFile(const QString &fileName) |
|
40 | int socExplorerXmlModel::createXmlFile(const QString &fileName) | |
41 | { |
|
41 | { | |
42 | return p_driver->createXmlFile(fileName); |
|
42 | return p_driver->createXmlFile(fileName); | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | QList<xmlfile *> socExplorerXmlModel::getFileList(const QString &tagNameFilter) |
|
45 | QList<xmlfile *> socExplorerXmlModel::getFileList(const QString &tagNameFilter) | |
46 | { |
|
46 | { | |
47 | return p_driver->getFileList(tagNameFilter); |
|
47 | return p_driver->getFileList(tagNameFilter); | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | QList<QDomNodeList> socExplorerXmlModel::getAllNodes(const QString &tagName) |
|
50 | QList<QDomNodeList> socExplorerXmlModel::getAllNodes(const QString &tagName) | |
51 | { |
|
51 | { | |
52 | return p_driver->getAllNodes(tagName); |
|
52 | return p_driver->getAllNodes(tagName); | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | QStringList socExplorerXmlModel::getPeripheralRegList(const QString &peripheralName) |
|
55 | QStringList socExplorerXmlModel::getPeripheralRegList(const QString &peripheralName) | |
56 | { |
|
56 | { | |
57 | QStringList result; |
|
57 | QStringList result; | |
58 | QList<QDomNodeList> nodeList = p_driver->getAllNodes("peripheral"); |
|
58 | QList<QDomNodeList> nodeList = p_driver->getAllNodes("peripheral"); | |
59 | for(int i=0;i<nodeList.count();i++) |
|
59 | for(int i=0;i<nodeList.count();i++) | |
60 | { |
|
60 | { | |
61 | for(int l=0;l<nodeList.at(i).count();l++) |
|
61 | for(int l=0;l<nodeList.at(i).count();l++) | |
62 | { |
|
62 | { | |
63 | if(peripheralName==nodeList.at(i).at(l).toElement().attribute("name","name")) |
|
63 | if(peripheralName==nodeList.at(i).at(l).toElement().attribute("name","name")) | |
64 | { |
|
64 | { | |
65 | QDomNodeList registers=nodeList.at(i).at(l).toElement().elementsByTagName("register"); |
|
65 | QDomNodeList registers=nodeList.at(i).at(l).toElement().elementsByTagName("register"); | |
66 | for(int m=0;m<registers.count();m++) |
|
66 | for(int m=0;m<registers.count();m++) | |
67 | { |
|
67 | { | |
68 | result.append(registers.at(m).toElement().attribute("name","No name")); |
|
68 | result.append(registers.at(m).toElement().attribute("name","No name")); | |
69 | } |
|
69 | } | |
70 | } |
|
70 | } | |
71 | } |
|
71 | } | |
72 | } |
|
72 | } | |
73 | return result; |
|
73 | return result; | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | peripheralModel socExplorerXmlModel::getPeripheral(const QString &peripheralName) |
|
76 | peripheralModel socExplorerXmlModel::getPeripheral(const QString &peripheralName) | |
77 | { |
|
77 | { | |
78 | peripheralModel result= peripheralModel(peripheralName); |
|
78 | peripheralModel result= peripheralModel(peripheralName); | |
79 | QList<QDomNodeList> nodeList = p_driver->getAllNodes("peripheral"); |
|
79 | QList<QDomNodeList> nodeList = p_driver->getAllNodes("peripheral"); | |
80 | QDomNodeList filteredPeriph; |
|
80 | QDomNodeList filteredPeriph; | |
81 | for(int i=0;i<nodeList.count();i++) |
|
81 | for(int i=0;i<nodeList.count();i++) | |
82 | { |
|
82 | { | |
83 | for(int l=0;l<nodeList.at(i).count();l++) |
|
83 | for(int l=0;l<nodeList.at(i).count();l++) | |
84 | { |
|
84 | { | |
85 | if(peripheralName==nodeList.at(i).at(l).toElement().attribute("name","name")) |
|
85 | if(peripheralName==nodeList.at(i).at(l).toElement().attribute("name","name")) | |
86 | { |
|
86 | { | |
87 | filteredPeriph = nodeList.at(i).at(l).toElement().elementsByTagName("register"); |
|
87 | filteredPeriph = nodeList.at(i).at(l).toElement().elementsByTagName("register"); | |
88 | p_getRegs(&result,&filteredPeriph); |
|
88 | p_getRegs(&result,&filteredPeriph); | |
89 | } |
|
89 | } | |
90 | } |
|
90 | } | |
91 | } |
|
91 | } | |
92 | return result; |
|
92 | return result; | |
93 | } |
|
93 | } | |
94 |
|
94 | |||
95 |
|
95 | |||
96 |
|
96 | |||
97 | void socExplorerXmlModel::updateSOClist() |
|
97 | void socExplorerXmlModel::updateSOClist() | |
98 | { |
|
98 | { | |
99 | QString socName; |
|
99 | QString socName; | |
100 | this->clearSocList(); |
|
100 | this->clearSocList(); | |
101 | QList<QDomNodeList> nodeList = p_driver->getAllNodes("soc"); |
|
101 | QList<QDomNodeList> nodeList = p_driver->getAllNodes("soc"); | |
102 | for(int i=0;i<nodeList.count();i++) |
|
102 | for(int i=0;i<nodeList.count();i++) | |
103 | { |
|
103 | { | |
104 | for(int l=0;l<nodeList.at(i).count();l++) |
|
104 | for(int l=0;l<nodeList.at(i).count();l++) | |
105 | { |
|
105 | { | |
106 | socName = nodeList.at(i).at(l).toElement().attribute("name","name"); |
|
106 | socName = nodeList.at(i).at(l).toElement().attribute("name","name"); | |
107 | qDebug()<<"Found SOC " + socName; |
|
107 | qDebug()<<"Found SOC " + socName; | |
108 | } |
|
108 | } | |
109 | } |
|
109 | } | |
110 | } |
|
110 | } | |
111 |
|
111 | |||
112 | void socExplorerXmlModel::registerXmlFile(const QString &fileName) |
|
112 | void socExplorerXmlModel::registerXmlFile(const QString &fileName) | |
113 | { |
|
113 | { | |
114 | p_driver->registerXmlFile(fileName); |
|
114 | p_driver->registerXmlFile(fileName); | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | void socExplorerXmlModel::scanXmlFiles() |
|
117 | void socExplorerXmlModel::scanXmlFiles() | |
118 | { |
|
118 | { | |
119 | p_driver->scanXmlFiles(); |
|
119 | p_driver->scanXmlFiles(); | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | void socExplorerXmlModel::p_getRegs(peripheralModel *periph, QDomNodeList *nodes) |
|
122 | void socExplorerXmlModel::p_getRegs(peripheralModel *periph, QDomNodeList *nodes) | |
123 | { |
|
123 | { | |
124 | QString name; |
|
124 | QString name; | |
125 | QString description; |
|
125 | QString description; | |
126 | int size=0; |
|
126 | int size=0; | |
127 | int offset=0; |
|
127 | int offset=0; | |
128 | bool rw; |
|
128 | bool rw; | |
129 | for(int i=0;i<nodes->count();i++) |
|
129 | for(int i=0;i<nodes->count();i++) | |
130 | { |
|
130 | { | |
131 | periph->registers.append(registerModel(nodes->at(i).toElement().attribute("name","No name"),nodes->at(i).toElement().attribute("addOffset",QString::number(i*4)).toInt())); |
|
131 | periph->registers.append(registerModel(nodes->at(i).toElement().attribute("name","No name"),nodes->at(i).toElement().attribute("addOffset",QString::number(i*4)).toInt())); | |
132 | QDomNodeList bitfields=nodes->at(i).toElement().elementsByTagName("bitField"); |
|
132 | QDomNodeList bitfields=nodes->at(i).toElement().elementsByTagName("bitField"); | |
133 | for(int l=0;l<bitfields.count();l++) |
|
133 | for(int l=0;l<bitfields.count();l++) | |
134 | { |
|
134 | { | |
135 | name = bitfields.at(l).toElement().attribute("name","No name"); |
|
135 | name = bitfields.at(l).toElement().attribute("name","No name"); | |
136 | description = bitfields.at(l).toElement().attribute("desc",""); |
|
136 | description = bitfields.at(l).toElement().attribute("desc",""); | |
137 | offset = bitfields.at(l).toElement().attribute("offset",QString("%1").arg(offset+size)).toInt(); |
|
137 | offset = bitfields.at(l).toElement().attribute("offset",QString("%1").arg(offset+size)).toInt(); | |
138 | size = bitfields.at(l).toElement().attribute("size","1").toInt(); |
|
138 | size = bitfields.at(l).toElement().attribute("size","1").toInt(); | |
139 | rw = bitfields.at(l).toElement().attribute("mode","1").toInt()==3; |
|
139 | rw = bitfields.at(l).toElement().attribute("mode","1").toInt()==3; | |
140 | periph->registers.last().bitfields.append(registerBitFieldModel(name,description,size,offset,rw)); |
|
140 | periph->registers.last().bitfields.append(registerBitFieldModel(name,description,size,offset,rw)); | |
141 | } |
|
141 | } | |
142 | size = 0; |
|
142 | size = 0; | |
143 | offset = 0; |
|
143 | offset = 0; | |
144 | } |
|
144 | } | |
145 | } |
|
145 | } | |
146 |
|
146 | |||
147 | void socExplorerXmlModel::clearSocList() |
|
147 | void socExplorerXmlModel::clearSocList() | |
148 | { |
|
148 | { | |
149 | xmlDataSystemOnChip* tmp; |
|
149 | xmlDataSystemOnChip* tmp; | |
150 | for(int i=0;i<this->p_SocList.length();i++) |
|
150 | for(int i=0;i<this->p_SocList.length();i++) | |
151 | { |
|
151 | { | |
152 | tmp = this->p_SocList.last(); |
|
152 | tmp = this->p_SocList.last(); | |
153 | this->p_SocList.removeLast(); |
|
153 | this->p_SocList.removeLast(); | |
154 | delete tmp; |
|
154 | delete tmp; | |
155 | } |
|
155 | } | |
156 | } |
|
156 | } | |
157 |
|
157 | |||
158 |
|
158 | |||
159 |
|
159 | |||
160 |
|
160 | |||
161 |
|
161 | |||
162 |
|
162 | |||
163 |
|
163 | |||
164 |
|
164 | |||
165 |
|
165 | |||
166 |
|
166 | |||
167 |
|
167 |
@@ -1,73 +1,73 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 | #ifndef XMLMODEL_H |
|
22 | #ifndef XMLMODEL_H | |
23 | #define XMLMODEL_H |
|
23 | #define XMLMODEL_H | |
24 | #include <QString> |
|
24 | #include <QString> | |
25 | #include <QList> |
|
25 | #include <QList> | |
26 | #include <QObject> |
|
26 | #include <QObject> | |
27 | #include "XMLdata.h" |
|
27 | #include "XMLdata.h" | |
28 | #include "socexplorerxmlfile.h" |
|
28 | #include "socexplorerxmlfile.h" | |
29 | #include "xmldriver.h" |
|
29 | #include "xmldriver.h" | |
30 | #include <socmodel.h> |
|
30 | #include <socmodel.h> | |
31 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
31 | #if defined(SOCEXPLORER_SDK_BUILD) | |
32 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
32 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT | |
33 | #else |
|
33 | #else | |
34 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
34 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT | |
35 | #endif |
|
35 | #endif | |
36 |
|
36 | |||
37 | class SOCEXPLORER_SDK_EXPORT socExplorerXmlModel: public QObject |
|
37 | class SOCEXPLORER_SDK_EXPORT socExplorerXmlModel: public QObject | |
38 | { |
|
38 | { | |
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 | public: |
|
40 | public: | |
41 | socExplorerXmlModel(QObject* parent=0); |
|
41 | socExplorerXmlModel(QObject* parent=0); | |
42 | //! Check that the given file is a readable Xml file. |
|
42 | //! Check that the given file is a readable Xml file. | |
43 | int checkXmlFile(const QString& fileName); |
|
43 | int checkXmlFile(const QString& fileName); | |
44 | int createXmlFile(const QString& fileName); |
|
44 | int createXmlFile(const QString& fileName); | |
45 | //! Return the list of all xml nodes with the given tag name in cached Xml files. |
|
45 | //! Return the list of all xml nodes with the given tag name in cached Xml files. | |
46 | QList<xmlfile*> getFileList(const QString& tagNameFilter); |
|
46 | QList<xmlfile*> getFileList(const QString& tagNameFilter); | |
47 | QList<QDomNodeList> getAllNodes(const QString& tagName); |
|
47 | QList<QDomNodeList> getAllNodes(const QString& tagName); | |
48 | QStringList getPeripheralRegList(const QString& peripheralName); |
|
48 | QStringList getPeripheralRegList(const QString& peripheralName); | |
49 | peripheralModel getPeripheral(const QString& peripheralName); |
|
49 | peripheralModel getPeripheral(const QString& peripheralName); | |
50 | public slots: |
|
50 | public slots: | |
51 | void updateSOClist(); |
|
51 | void updateSOClist(); | |
52 | void registerXmlFile(const QString &fileName); |
|
52 | void registerXmlFile(const QString &fileName); | |
53 | //! Reload all xmlFiles. |
|
53 | //! Reload all xmlFiles. | |
54 | void scanXmlFiles(); |
|
54 | void scanXmlFiles(); | |
55 | signals: |
|
55 | signals: | |
56 |
|
56 | |||
57 | private: |
|
57 | private: | |
58 | void p_getRegs(peripheralModel *periph, QDomNodeList *nodes); |
|
58 | void p_getRegs(peripheralModel *periph, QDomNodeList *nodes); | |
59 | QList<xmlDataSystemOnChip*> p_SocList; |
|
59 | QList<xmlDataSystemOnChip*> p_SocList; | |
60 | void clearSocList(); |
|
60 | void clearSocList(); | |
61 | XMLDriver* p_driver; |
|
61 | XMLDriver* p_driver; | |
62 | }; |
|
62 | }; | |
63 |
|
63 | |||
64 |
|
64 | |||
65 |
|
65 | |||
66 | #endif // XMLMODEL_H |
|
66 | #endif // XMLMODEL_H | |
67 |
|
67 | |||
68 |
|
68 | |||
69 |
|
69 | |||
70 |
|
70 | |||
71 |
|
71 | |||
72 |
|
72 | |||
73 |
|
73 |
@@ -1,224 +1,231 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 "socexplorerengine.h" |
|
22 | #include "socexplorerengine.h" | |
23 | #include <proxy/socexplorerproxy.h> |
|
23 | #include <proxy/socexplorerproxy.h> | |
24 |
|
24 | |||
25 | SocExplorerEngine* SocExplorerEngine::_self = NULL; |
|
25 | SocExplorerEngine* SocExplorerEngine::_self = NULL; | |
26 | socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL; |
|
26 | socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL; | |
27 | QMainWindow* SocExplorerEngine::mainWindow=NULL; |
|
27 | QMainWindow* SocExplorerEngine::mainWindow=NULL; | |
28 | QList<SOCModel*>* SocExplorerEngine::SOCs=NULL; |
|
28 | QList<SOCModel*>* SocExplorerEngine::SOCs=NULL; | |
29 | int SocExplorerEngine::loglvl=1; |
|
29 | int SocExplorerEngine::loglvl=1; | |
30 |
|
30 | |||
31 | SocExplorerEngine::SocExplorerEngine(QObject *parent) : |
|
31 | SocExplorerEngine::SocExplorerEngine(QObject *parent) : | |
32 | QObject(parent) |
|
32 | QObject(parent) | |
33 | { |
|
33 | { | |
34 | if(SOCs==NULL) |
|
34 | if(SOCs==NULL) | |
35 | { |
|
35 | { | |
36 | SOCs = new QList<SOCModel*>; |
|
36 | SOCs = new QList<SOCModel*>; | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 |
|
41 | |||
42 | void SocExplorerEngine::init() |
|
42 | void SocExplorerEngine::init() | |
43 | { |
|
43 | { | |
44 | QDir dir; |
|
44 | QDir dir; | |
45 | if(!_self) |
|
45 | if(!_self) | |
46 | { |
|
46 | { | |
47 | _self= new SocExplorerEngine; |
|
47 | _self= new SocExplorerEngine; | |
48 | } |
|
48 | } | |
49 | if(!dir.exists(configFolder())) |
|
49 | if(!dir.exists(configFolder())) | |
50 | dir.mkdir(configFolder()); |
|
50 | dir.mkdir(configFolder()); | |
51 | p_xmlmodel = new socExplorerXmlModel(_self); |
|
51 | p_xmlmodel = new socExplorerXmlModel(_self); | |
52 | p_xmlmodel->updateSOClist(); |
|
52 | p_xmlmodel->updateSOClist(); | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | QString SocExplorerEngine::configFolder() |
|
55 | QString SocExplorerEngine::configFolder() | |
56 | { |
|
56 | { | |
57 | return QString(SOCEXPLORER_CONFIG_PATH); |
|
57 | return QString(SOCEXPLORER_CONFIG_PATH); | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | SOCModel *SocExplorerEngine::plugin2Soc(socexplorerplugin *plugin) |
|
60 | SOCModel *SocExplorerEngine::plugin2Soc(socexplorerplugin *plugin) | |
61 | { |
|
61 | { | |
62 | if(!_self) |
|
62 | if(!_self) | |
63 | init(); |
|
63 | init(); | |
64 | if(plugin) |
|
64 | if(plugin) | |
65 | { |
|
65 | { | |
66 | while (plugin->parent!=NULL) { |
|
66 | while (plugin->parent!=NULL) { | |
67 | plugin = plugin->parent; |
|
67 | plugin = plugin->parent; | |
68 | } |
|
68 | } | |
69 | for(int i=0;i<SOCs->count();i++) |
|
69 | for(int i=0;i<SOCs->count();i++) | |
70 | { |
|
70 | { | |
71 | if(SOCs->at(i)->isRootDev(plugin)) |
|
71 | if(SOCs->at(i)->isRootDev(plugin)) | |
72 | return SOCs->at(i); |
|
72 | return SOCs->at(i); | |
73 | } |
|
73 | } | |
74 | //no soc found so create a new one |
|
74 | //no soc found so create a new one | |
75 | SOCModel* soc=new SOCModel(plugin); |
|
75 | SOCModel* soc=new SOCModel(plugin); | |
76 | SOCs->append(soc); |
|
76 | SOCs->append(soc); | |
77 | return soc; |
|
77 | return soc; | |
78 | } |
|
78 | } | |
79 | return NULL; |
|
79 | return NULL; | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 |
|
82 | |||
83 | int SocExplorerEngine::addEnumDevice(socexplorerplugin* rootPlugin,int VID, int PID, qint32 baseAddress, const QString &name) |
|
83 | int SocExplorerEngine::addEnumDevice(socexplorerplugin* rootPlugin,int VID, int PID, qint32 baseAddress, const QString &name) | |
84 | { |
|
84 | { | |
85 | if(!_self) |
|
85 | if(!_self) | |
86 | init(); |
|
86 | init(); | |
87 | SOCModel* soc = plugin2Soc(rootPlugin); |
|
87 | SOCModel* soc = plugin2Soc(rootPlugin); | |
88 | if(soc && !soc->enumDeviceExists(baseAddress)) |
|
88 | if(soc && !soc->enumDeviceExists(baseAddress)) | |
89 | { |
|
89 | { | |
90 | emit _self->enumDeviceAdded(soc->addEnumDevice(VID,PID,baseAddress,name)); |
|
90 | emit _self->enumDeviceAdded(soc->addEnumDevice(VID,PID,baseAddress,name)); | |
91 | return 1; |
|
91 | return 1; | |
92 | } |
|
92 | } | |
93 | return 0; |
|
93 | return 0; | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
96 | QList<SOCModel *> *SocExplorerEngine::getSOCs() |
|
96 | QList<SOCModel *> *SocExplorerEngine::getSOCs() | |
97 | { |
|
97 | { | |
98 | if(!_self) |
|
98 | if(!_self) | |
99 | init(); |
|
99 | init(); | |
100 | return SOCs; |
|
100 | return SOCs; | |
101 | } |
|
101 | } | |
102 |
|
102 | |||
103 | qint32 SocExplorerEngine::getEnumDeviceBaseAddress(const QString& rootPlugin,int VID, int PID, int count) |
|
103 | qint32 SocExplorerEngine::getEnumDeviceBaseAddress(const QString& rootPlugin,int VID, int PID, int count) | |
104 | { |
|
104 | { | |
105 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); |
|
105 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); | |
106 | if(plugin==NULL)return -1; |
|
106 | if(plugin==NULL)return -1; | |
107 | SOCModel* soc = plugin2Soc(plugin); |
|
107 | SOCModel* soc = plugin2Soc(plugin); | |
108 | if(soc==NULL) |
|
108 | if(soc==NULL) | |
109 | return -1; |
|
109 | return -1; | |
110 | return soc->getEnumDeviceBaseAddress(VID,PID,count); |
|
110 | return soc->getEnumDeviceBaseAddress(VID,PID,count); | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | qint32 SocExplorerEngine::getEnumDeviceBaseAddress(socexplorerplugin *plugin, int VID, int PID, int count) |
|
113 | qint32 SocExplorerEngine::getEnumDeviceBaseAddress(socexplorerplugin *plugin, int VID, int PID, int count) | |
114 | { |
|
114 | { | |
115 | if(plugin==NULL)return -1; |
|
115 | if(plugin==NULL)return -1; | |
116 | SOCModel* soc = plugin2Soc(plugin); |
|
116 | SOCModel* soc = plugin2Soc(plugin); | |
117 | if(soc==NULL) |
|
117 | if(soc==NULL) | |
118 | return -1; |
|
118 | return -1; | |
119 | return soc->getEnumDeviceBaseAddress(VID,PID,count); |
|
119 | return soc->getEnumDeviceBaseAddress(VID,PID,count); | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | int SocExplorerEngine::addEnumDevice(const QString &rootPlugin, int VID, int PID, qint32 baseAddress, const QString &name) |
|
122 | int SocExplorerEngine::addEnumDevice(const QString &rootPlugin, int VID, int PID, qint32 baseAddress, const QString &name) | |
123 | { |
|
123 | { | |
124 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); |
|
124 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); | |
125 | if(plugin==NULL)return -1; |
|
125 | if(plugin==NULL)return -1; | |
126 | SOCModel* soc = plugin2Soc(plugin); |
|
126 | SOCModel* soc = plugin2Soc(plugin); | |
127 | if(soc==NULL) |
|
127 | if(soc==NULL) | |
128 | return -1; |
|
128 | return -1; | |
129 | soc->addEnumDevice(VID,PID,baseAddress,name); |
|
129 | soc->addEnumDevice(VID,PID,baseAddress,name); | |
130 | return 1; |
|
130 | return 1; | |
131 | } |
|
131 | } | |
132 |
|
132 | |||
133 |
|
133 | |||
134 | QString SocExplorerEngine::getDevName(int VID, int PID) |
|
134 | QString SocExplorerEngine::getDevName(int VID, int PID) | |
135 | { |
|
135 | { | |
136 | QList<QDomNodeList> list=p_xmlmodel->getAllNodes("peripheral"); |
|
136 | QList<QDomNodeList> list=p_xmlmodel->getAllNodes("peripheral"); | |
137 | for(int i=0;i<list.count();i++) |
|
137 | for(int i=0;i<list.count();i++) | |
138 | { |
|
138 | { | |
139 | QDomNodeList nodes=list.at(i); |
|
139 | QDomNodeList nodes=list.at(i); | |
140 | for(int l=0;l<nodes.count();l++) |
|
140 | for(int l=0;l<nodes.count();l++) | |
141 | { |
|
141 | { | |
142 | QDomElement node=nodes.at(l).toElement(); |
|
142 | QDomElement node=nodes.at(l).toElement(); | |
143 | int nodeVID=node.attribute("vid","0").toInt(); |
|
143 | int nodeVID=node.attribute("vid","0").toInt(); | |
144 | int nodePID=node.attribute("pid","0").toInt(); |
|
144 | int nodePID=node.attribute("pid","0").toInt(); | |
145 | if((nodeVID==VID)&&(nodePID==PID)) |
|
145 | if((nodeVID==VID)&&(nodePID==PID)) | |
146 | { |
|
146 | { | |
147 | return node.attribute("name","Unknow device"); |
|
147 | return node.attribute("name","Unknow device"); | |
148 | } |
|
148 | } | |
149 | } |
|
149 | } | |
150 | } |
|
150 | } | |
151 | return QString("Unknow device"); |
|
151 | return QString("Unknow device"); | |
152 | } |
|
152 | } | |
153 |
|
153 | |||
154 | QString SocExplorerEngine::SocExplorerVersion(){return QString(SOCEXPLORER_VERSION);} |
|
154 | QString SocExplorerEngine::SocExplorerVersion(){return QString(SOCEXPLORER_VERSION);} | |
155 |
|
155 | |||
156 | QString SocExplorerEngine::SocExplorerChangeset(){return QString(SOCEXPLORER_CHAGESET).split(" ").at(0);} |
|
156 | QString SocExplorerEngine::SocExplorerChangeset(){return QString(SOCEXPLORER_CHAGESET).split(" ").at(0);} | |
157 |
|
157 | |||
158 | QString SocExplorerEngine::SocExplorerBranch(){return QString(SOCEXPLORER_BRANCH);} |
|
158 | QString SocExplorerEngine::SocExplorerBranch(){return QString(SOCEXPLORER_BRANCH);} | |
159 |
|
159 | |||
160 | socExplorerXmlModel *SocExplorerEngine::xmlModel() |
|
160 | socExplorerXmlModel *SocExplorerEngine::xmlModel() | |
161 | { |
|
161 | { | |
162 | if(!_self) |
|
162 | if(!_self) | |
163 | init(); |
|
163 | init(); | |
164 | return p_xmlmodel; |
|
164 | return p_xmlmodel; | |
165 | } |
|
165 | } | |
166 |
|
166 | |||
167 | void SocExplorerEngine::setMainWindow(QMainWindow *Mainwindow) |
|
167 | void SocExplorerEngine::setMainWindow(QMainWindow *Mainwindow) | |
168 | { |
|
168 | { | |
169 | if(!_self) |
|
169 | if(!_self) | |
170 | init(); |
|
170 | init(); | |
171 | mainWindow=Mainwindow; |
|
171 | mainWindow=Mainwindow; | |
172 | } |
|
172 | } | |
173 |
|
173 | |||
174 | QProgressBar *SocExplorerEngine::getProgressBar(const QString& format, int max) |
|
174 | QProgressBar *SocExplorerEngine::getProgressBar(const QString& format, int max) | |
175 | { |
|
175 | { | |
176 | if(!_self) |
|
176 | if(!_self) | |
177 | init(); |
|
177 | init(); | |
178 | QProgressBar* progressBar; |
|
178 | QProgressBar* progressBar; | |
179 | if(mainWindow!=NULL) |
|
179 | if(mainWindow!=NULL) | |
180 | { |
|
180 | { | |
181 | progressBar = new QProgressBar(mainWindow); |
|
181 | progressBar = new QProgressBar(mainWindow); | |
182 | mainWindow->statusBar()->addWidget(progressBar); |
|
182 | mainWindow->statusBar()->addWidget(progressBar); | |
183 | } |
|
183 | } | |
184 | else |
|
184 | else | |
185 | { |
|
185 | { | |
186 | progressBar = new QProgressBar(); |
|
186 | progressBar = new QProgressBar(); | |
187 | } |
|
187 | } | |
188 | progressBar->setMaximum(max); |
|
188 | progressBar->setMaximum(max); | |
189 | progressBar->setFormat(format); |
|
189 | progressBar->setFormat(format); | |
190 | return progressBar; |
|
190 | return progressBar; | |
191 | } |
|
191 | } | |
192 |
|
192 | |||
193 | void SocExplorerEngine::deleteProgressBar(QProgressBar *progressBar) |
|
193 | void SocExplorerEngine::deleteProgressBar(QProgressBar *progressBar) | |
194 | { |
|
194 | { | |
195 | if(mainWindow!=NULL) |
|
195 | if(mainWindow!=NULL) | |
196 | { |
|
196 | { | |
197 | mainWindow->statusBar()->removeWidget(progressBar); |
|
197 | mainWindow->statusBar()->removeWidget(progressBar); | |
198 | } |
|
198 | } | |
199 | delete progressBar; |
|
199 | delete progressBar; | |
200 | } |
|
200 | } | |
201 |
|
201 | |||
202 | void SocExplorerEngine::addSOC(socexplorerplugin *rootPlugin) |
|
202 | void SocExplorerEngine::addSOC(socexplorerplugin *rootPlugin) | |
203 | { |
|
203 | { | |
204 | plugin2Soc(rootPlugin); |
|
204 | plugin2Soc(rootPlugin); | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 | void SocExplorerEngine::removeSOC(socexplorerplugin *rootPlugin) |
|
207 | void SocExplorerEngine::removeSOC(socexplorerplugin *rootPlugin) | |
208 | { |
|
208 | { | |
209 | SOCModel* soc=plugin2Soc(rootPlugin); |
|
209 | SOCModel* soc=plugin2Soc(rootPlugin); | |
210 | SOCs->removeAll(soc); |
|
210 | SOCs->removeAll(soc); | |
211 | delete soc; |
|
211 | delete soc; | |
212 | } |
|
212 | } | |
213 |
|
213 | |||
214 | void SocExplorerEngine::message(socexplorerplugin *sender, const QString &message, int debugLevel) |
|
214 | void SocExplorerEngine::message(socexplorerplugin *sender, const QString &message, int debugLevel) | |
215 | { |
|
215 | { | |
216 | // TODO add multi output message manager IE also log in files |
|
216 | // TODO add multi output message manager IE also log in files | |
217 | if(!_self) |
|
217 | if(!_self) | |
218 | init(); |
|
218 | init(); | |
219 | if(loglvl>=debugLevel) |
|
219 | if(loglvl>=debugLevel) | |
220 | qDebug()<< QTime::currentTime().toString()+" " + sender->instanceName()+":"+message; |
|
220 | qDebug()<< QTime::currentTime().toString()+" " + sender->instanceName()+":"+message; | |
221 | } |
|
221 | } | |
222 |
|
222 | |||
|
223 | void SocExplorerEngine::setLogLevel(int level) | |||
|
224 | { | |||
|
225 | if(!_self) | |||
|
226 | init(); | |||
|
227 | loglvl = level; | |||
|
228 | } | |||
223 |
|
229 | |||
224 |
|
230 | |||
|
231 |
@@ -1,108 +1,109 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 | #ifndef SOCEXPLORERENGINE_H |
|
22 | #ifndef SOCEXPLORERENGINE_H | |
23 | #define SOCEXPLORERENGINE_H |
|
23 | #define SOCEXPLORERENGINE_H | |
24 |
|
24 | |||
25 | #include <stdint.h> |
|
25 | #include <stdint.h> | |
26 | #include <QObject> |
|
26 | #include <QObject> | |
27 | #include <QtWidgets> |
|
27 | #include <QtWidgets> | |
28 | #include <QStringList> |
|
28 | #include <QStringList> | |
29 | #include <QDomDocument> |
|
29 | #include <QDomDocument> | |
30 | #include <QDomElement> |
|
30 | #include <QDomElement> | |
31 | #include <QDomNodeList> |
|
31 | #include <QDomNodeList> | |
32 | #include <QFile> |
|
32 | #include <QFile> | |
33 | #include <QTextStream> |
|
33 | #include <QTextStream> | |
34 | #include <QDir> |
|
34 | #include <QDir> | |
35 | #include <QApplication> |
|
35 | #include <QApplication> | |
36 | #include <QtCore/qglobal.h> |
|
36 | #include <QtCore/qglobal.h> | |
37 | #include <QFileDialog> |
|
37 | #include <QFileDialog> | |
38 | #include <socexplorerxmlfile.h> |
|
38 | #include <socexplorerxmlfile.h> | |
39 | #include <socexplorerenumdevice.h> |
|
39 | #include <socexplorerenumdevice.h> | |
40 | #include <XMLmodel.h> |
|
40 | #include <XMLmodel.h> | |
41 | #include <peripheralwidget.h> |
|
41 | #include <peripheralwidget.h> | |
42 | #include <registerwidget.h> |
|
42 | #include <registerwidget.h> | |
43 | #include <socmodel.h> |
|
43 | #include <socmodel.h> | |
44 |
|
44 | |||
45 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
45 | #if defined(SOCEXPLORER_SDK_BUILD) | |
46 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
46 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT | |
47 | #else |
|
47 | #else | |
48 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
48 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT | |
49 | #endif |
|
49 | #endif | |
50 |
|
50 | |||
51 |
|
51 | |||
52 |
|
52 | |||
53 | //! SocExplorerEngine is a pure static class which aims to provide services for both SocExplorer software and plugins. |
|
53 | //! SocExplorerEngine is a pure static class which aims to provide services for both SocExplorer software and plugins. | |
54 |
|
54 | |||
55 | class SOCEXPLORER_SDK_EXPORT SocExplorerEngine : public QObject |
|
55 | class SOCEXPLORER_SDK_EXPORT SocExplorerEngine : public QObject | |
56 | { |
|
56 | { | |
57 | Q_OBJECT |
|
57 | Q_OBJECT | |
58 | private: |
|
58 | private: | |
59 | static SocExplorerEngine* _self; |
|
59 | static SocExplorerEngine* _self; | |
60 | SocExplorerEngine(QObject *parent = 0); |
|
60 | SocExplorerEngine(QObject *parent = 0); | |
61 | static void init(); |
|
61 | static void init(); | |
62 |
|
62 | |||
63 | public: |
|
63 | public: | |
64 | static SocExplorerEngine* self(){ if(!_self){_self= new SocExplorerEngine;}return _self;} |
|
64 | static SocExplorerEngine* self(){ if(!_self){_self= new SocExplorerEngine;}return _self;} | |
65 | //! Return the configuration folder path, OS dependant. |
|
65 | //! Return the configuration folder path, OS dependant. | |
66 | SOCEXPLORER_SDK_EXPORT static QString configFolder(); |
|
66 | SOCEXPLORER_SDK_EXPORT static QString configFolder(); | |
67 | //! Return the default plugin folder path, OS dependant. |
|
67 | //! Return the default plugin folder path, OS dependant. | |
68 | static QString pluginFolder(){return QString(SOCEXPLORER_PLUGINS_INSTALL_PATH);} |
|
68 | static QString pluginFolder(){return QString(SOCEXPLORER_PLUGINS_INSTALL_PATH);} | |
69 |
|
69 | |||
70 | static int addEnumDevice(socexplorerplugin* rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); |
|
70 | static int addEnumDevice(socexplorerplugin* rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); | |
71 | static QList<SOCModel*>* getSOCs(); |
|
71 | static QList<SOCModel*>* getSOCs(); | |
72 | static QString getDevName(int VID, int PID); |
|
72 | static QString getDevName(int VID, int PID); | |
73 | static QString SocExplorerVersion(); |
|
73 | static QString SocExplorerVersion(); | |
74 | static QString SocExplorerChangeset(); |
|
74 | static QString SocExplorerChangeset(); | |
75 | static QString SocExplorerBranch(); |
|
75 | static QString SocExplorerBranch(); | |
76 | static socExplorerXmlModel* xmlModel(); |
|
76 | static socExplorerXmlModel* xmlModel(); | |
77 | static void setMainWindow(QMainWindow* Mainwindow); |
|
77 | static void setMainWindow(QMainWindow* Mainwindow); | |
78 | static QProgressBar* getProgressBar(const QString &format, int max); |
|
78 | static QProgressBar* getProgressBar(const QString &format, int max); | |
79 | static void deleteProgressBar(QProgressBar* progressBar); |
|
79 | static void deleteProgressBar(QProgressBar* progressBar); | |
80 | static void addSOC(socexplorerplugin* rootPlugin); |
|
80 | static void addSOC(socexplorerplugin* rootPlugin); | |
81 | static void removeSOC(socexplorerplugin* rootPlugin); |
|
81 | static void removeSOC(socexplorerplugin* rootPlugin); | |
82 | static void message(socexplorerplugin* sender,const QString& message,int debugLevel=0); |
|
82 | static void message(socexplorerplugin* sender,const QString& message,int debugLevel=0); | |
|
83 | static void setLogLevel(int level); | |||
83 | signals: |
|
84 | signals: | |
84 | void enumDeviceAdded(socExplorerEnumDevice* device); |
|
85 | void enumDeviceAdded(socExplorerEnumDevice* device); | |
85 | public slots: |
|
86 | public slots: | |
86 | QString getSocExplorerVersion(){return SocExplorerEngine::SocExplorerVersion();} |
|
87 | QString getSocExplorerVersion(){return SocExplorerEngine::SocExplorerVersion();} | |
87 | QString getSocExplorerChangeset(){return SocExplorerEngine::SocExplorerChangeset();} |
|
88 | QString getSocExplorerChangeset(){return SocExplorerEngine::SocExplorerChangeset();} | |
88 | QString getSocExplorerBranch(){return SocExplorerEngine::SocExplorerBranch();} |
|
89 | QString getSocExplorerBranch(){return SocExplorerEngine::SocExplorerBranch();} | |
89 | qint32 getEnumDeviceBaseAddress(const QString& rootPlugin,int VID,int PID,int count=0); |
|
90 | qint32 getEnumDeviceBaseAddress(const QString& rootPlugin,int VID,int PID,int count=0); | |
90 | qint32 getEnumDeviceBaseAddress(socexplorerplugin* plugin,int VID,int PID,int count=0); |
|
91 | qint32 getEnumDeviceBaseAddress(socexplorerplugin* plugin,int VID,int PID,int count=0); | |
91 | int addEnumDevice(const QString& rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); |
|
92 | int addEnumDevice(const QString& rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); | |
92 |
|
93 | |||
93 | private: |
|
94 | private: | |
94 | static SOCModel* plugin2Soc(socexplorerplugin* plugin); |
|
95 | static SOCModel* plugin2Soc(socexplorerplugin* plugin); | |
95 | static socExplorerXmlModel* p_xmlmodel; |
|
96 | static socExplorerXmlModel* p_xmlmodel; | |
96 | static QMainWindow* mainWindow; |
|
97 | static QMainWindow* mainWindow; | |
97 | static QList<SOCModel*>* SOCs; |
|
98 | static QList<SOCModel*>* SOCs; | |
98 | static int loglvl; |
|
99 | static int loglvl; | |
99 | }; |
|
100 | }; | |
100 |
|
101 | |||
101 | #endif // SOCEXPLORERENGINE_H |
|
102 | #endif // SOCEXPLORERENGINE_H | |
102 |
|
103 | |||
103 |
|
104 | |||
104 |
|
105 | |||
105 |
|
106 | |||
106 |
|
107 | |||
107 |
|
108 | |||
108 |
|
109 |
@@ -1,77 +1,77 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 "socexplorerxmlfile.h" |
|
22 | #include "socexplorerxmlfile.h" | |
23 | #include <QFile> |
|
23 | #include <QFile> | |
24 | #include <QTextStream> |
|
24 | #include <QTextStream> | |
25 |
|
25 | |||
26 | xmlfile::xmlfile(const QString& fileName) |
|
26 | xmlfile::xmlfile(const QString& fileName) | |
27 | { |
|
27 | { | |
28 | this->m_fileName = fileName; |
|
28 | this->m_fileName = fileName; | |
29 | this->m_document=new QDomDocument(); |
|
29 | this->m_document=new QDomDocument(); | |
30 | QFile file( fileName ); |
|
30 | QFile file( fileName ); | |
31 | if( !file.open( QIODevice::ReadOnly ) ) |
|
31 | if( !file.open( QIODevice::ReadOnly ) ) | |
32 | return; |
|
32 | return; | |
33 | this->m_document->setContent(&file); |
|
33 | this->m_document->setContent(&file); | |
34 | file.close(); |
|
34 | file.close(); | |
35 | this->m_rootElement = this->m_document->documentElement(); |
|
35 | this->m_rootElement = this->m_document->documentElement(); | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | void xmlfile::save() |
|
38 | void xmlfile::save() | |
39 | { |
|
39 | { | |
40 | QFile file( this->m_fileName ); |
|
40 | QFile file( this->m_fileName ); | |
41 | if( !file.open( QIODevice::WriteOnly ) ) |
|
41 | if( !file.open( QIODevice::WriteOnly ) ) | |
42 | return; |
|
42 | return; | |
43 | QTextStream ts( &file ); |
|
43 | QTextStream ts( &file ); | |
44 | ts << this->m_document->toString(); |
|
44 | ts << this->m_document->toString(); | |
45 | file.close(); |
|
45 | file.close(); | |
46 | this->reload(); |
|
46 | this->reload(); | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | void xmlfile::reload() |
|
49 | void xmlfile::reload() | |
50 | { |
|
50 | { | |
51 | QFile file( this->m_fileName ); |
|
51 | QFile file( this->m_fileName ); | |
52 | if( !file.open( QIODevice::ReadOnly ) ) |
|
52 | if( !file.open( QIODevice::ReadOnly ) ) | |
53 | return; |
|
53 | return; | |
54 | this->m_document->setContent(&file); |
|
54 | this->m_document->setContent(&file); | |
55 | file.close(); |
|
55 | file.close(); | |
56 | this->m_rootElement = this->m_document->documentElement(); |
|
56 | this->m_rootElement = this->m_document->documentElement(); | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | void xmlfile::addElement(QDomElement* parentElement, const QString& tagName) |
|
59 | void xmlfile::addElement(QDomElement* parentElement, const QString& tagName) | |
60 | { |
|
60 | { | |
61 | if(m_document) |
|
61 | if(m_document) | |
62 | { |
|
62 | { | |
63 | QDomElement element=this->m_document->createElement(tagName); |
|
63 | QDomElement element=this->m_document->createElement(tagName); | |
64 | parentElement->appendChild(element); |
|
64 | parentElement->appendChild(element); | |
65 | //emit this->elementAdded(element); |
|
65 | //emit this->elementAdded(element); | |
66 | } |
|
66 | } | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | void xmlfile::removeElement(QDomElement *parentElement, QDomElement *element) |
|
69 | void xmlfile::removeElement(QDomElement *parentElement, QDomElement *element) | |
70 | { |
|
70 | { | |
71 | Q_UNUSED(parentElement) |
|
71 | Q_UNUSED(parentElement) | |
72 | Q_UNUSED(element) |
|
72 | Q_UNUSED(element) | |
73 | if(m_document) |
|
73 | if(m_document) | |
74 | { |
|
74 | { | |
75 |
|
75 | |||
76 | } |
|
76 | } | |
77 | } |
|
77 | } |
@@ -1,64 +1,64 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 | #ifndef XMLFILE_H |
|
22 | #ifndef XMLFILE_H | |
23 | #define XMLFILE_H |
|
23 | #define XMLFILE_H | |
24 |
|
24 | |||
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 | #include <QDomDocument> |
|
26 | #include <QDomDocument> | |
27 | #include <QDomElement> |
|
27 | #include <QDomElement> | |
28 | #include <QString> |
|
28 | #include <QString> | |
29 |
|
29 | |||
30 | ///////////////////////////////////////////////////////////////////////////////// |
|
30 | ///////////////////////////////////////////////////////////////////////////////// | |
31 | ///////////////////////////////////////////////////////////////////////////////// |
|
31 | ///////////////////////////////////////////////////////////////////////////////// | |
32 | //! Stores a cached Xml file and expose synchronization functions (Slots). |
|
32 | //! Stores a cached Xml file and expose synchronization functions (Slots). | |
33 | class xmlfile : public QObject |
|
33 | class xmlfile : public QObject | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | public: |
|
36 | public: | |
37 | xmlfile(const QString& fileName); |
|
37 | xmlfile(const QString& fileName); | |
38 | //! Return the root xml element of the current file. |
|
38 | //! Return the root xml element of the current file. | |
39 | QDomElement* getRootElement(){return &m_rootElement;} |
|
39 | QDomElement* getRootElement(){return &m_rootElement;} | |
40 | //! Return the current file name. |
|
40 | //! Return the current file name. | |
41 | QString fileName(){return this->m_fileName;} |
|
41 | QString fileName(){return this->m_fileName;} | |
42 | //! Return the root xml element tag name of the current file. |
|
42 | //! Return the root xml element tag name of the current file. | |
43 | QString rootTagName() |
|
43 | QString rootTagName() | |
44 | { |
|
44 | { | |
45 | if(!this->m_rootElement.isNull()) |
|
45 | if(!this->m_rootElement.isNull()) | |
46 | return this->m_rootElement.tagName(); |
|
46 | return this->m_rootElement.tagName(); | |
47 | else |
|
47 | else | |
48 | return QString(""); |
|
48 | return QString(""); | |
49 | } |
|
49 | } | |
50 | public slots: |
|
50 | public slots: | |
51 | void save(); |
|
51 | void save(); | |
52 | void reload(); |
|
52 | void reload(); | |
53 | void addElement(QDomElement* parentElement, const QString& tagName); |
|
53 | void addElement(QDomElement* parentElement, const QString& tagName); | |
54 | void removeElement(QDomElement* parentElement, QDomElement* element); |
|
54 | void removeElement(QDomElement* parentElement, QDomElement* element); | |
55 | private: |
|
55 | private: | |
56 | QString m_fileName; |
|
56 | QString m_fileName; | |
57 | QDomDocument* m_document; |
|
57 | QDomDocument* m_document; | |
58 | QDomElement m_rootElement; |
|
58 | QDomElement m_rootElement; | |
59 | }; |
|
59 | }; | |
60 | ///////////////////////////////////////////////////////////////////////////////// |
|
60 | ///////////////////////////////////////////////////////////////////////////////// | |
61 | ///////////////////////////////////////////////////////////////////////////////// |
|
61 | ///////////////////////////////////////////////////////////////////////////////// | |
62 |
|
62 | |||
63 |
|
63 | |||
64 | #endif // XMLFILE_H |
|
64 | #endif // XMLFILE_H |
@@ -1,213 +1,213 | |||||
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, |
|
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 "plugininfoswdgt.h" |
|
22 | #include "plugininfoswdgt.h" | |
23 | #include "pluginloader.h" |
|
23 | #include "pluginloader.h" | |
24 | #include <QDir> |
|
24 | #include <QDir> | |
25 | #include <QTextDocument> |
|
25 | #include <QTextDocument> | |
26 | #include <QTextCursor> |
|
26 | #include <QTextCursor> | |
27 | #include <QTextFragment> |
|
27 | #include <QTextFragment> | |
28 | #include <QTextDocumentFragment> |
|
28 | #include <QTextDocumentFragment> | |
29 | #include <QTextBlock> |
|
29 | #include <QTextBlock> | |
30 | #include <QTextCharFormat> |
|
30 | #include <QTextCharFormat> | |
31 | #include <QTextTable> |
|
31 | #include <QTextTable> | |
32 | #include <QApplication> |
|
32 | #include <QApplication> | |
33 |
|
33 | |||
34 |
|
34 | |||
35 |
|
35 | |||
36 | pluginInfosWdgt::pluginInfosWdgt(QWidget *parent) : |
|
36 | pluginInfosWdgt::pluginInfosWdgt(QWidget *parent) : | |
37 | QWidget(parent) |
|
37 | QWidget(parent) | |
38 | { |
|
38 | { | |
39 | this->mailLayout = new QVBoxLayout; |
|
39 | this->mailLayout = new QVBoxLayout; | |
40 | this->textInfos = new QTextBrowser; |
|
40 | this->textInfos = new QTextBrowser; | |
41 | this->textInfos->setReadOnly(true); |
|
41 | this->textInfos->setReadOnly(true); | |
42 | this->mailLayout->addWidget(this->textInfos); |
|
42 | this->mailLayout->addWidget(this->textInfos); | |
43 | this->setLayout(this->mailLayout); |
|
43 | this->setLayout(this->mailLayout); | |
44 | this->textInfos->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
|
44 | this->textInfos->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 |
|
47 | |||
48 | void pluginInfosWdgt::updateInfos(const QStringList &items) |
|
48 | void pluginInfosWdgt::updateInfos(const QStringList &items) | |
49 | { |
|
49 | { | |
50 | this->textInfos->clear(); |
|
50 | this->textInfos->clear(); | |
51 | QTextCursor cursor(this->textInfos->document()); |
|
51 | QTextCursor cursor(this->textInfos->document()); | |
52 | //QTextTable* table; |
|
52 | //QTextTable* table; | |
53 | int i=0; |
|
53 | int i=0; | |
54 | cursor.atStart(); |
|
54 | cursor.atStart(); | |
55 | cursor.insertText("Plugins:\n"); |
|
55 | cursor.insertText("Plugins:\n"); | |
56 | for(i=0;i<items.count();i++) |
|
56 | for(i=0;i<items.count();i++) | |
57 | { |
|
57 | { | |
58 | cursor.insertText(pluginloader::getlibDir(items.at(i))+"\n"); |
|
58 | cursor.insertText(pluginloader::getlibDir(items.at(i))+"\n"); | |
59 | } |
|
59 | } | |
60 | cursor.insertText("\n\n"); |
|
60 | cursor.insertText("\n\n"); | |
61 | //table = cursor.insertTable(7,items.count()+1); |
|
61 | //table = cursor.insertTable(7,items.count()+1); | |
62 | cursor.insertTable(7,items.count()+1); |
|
62 | cursor.insertTable(7,items.count()+1); | |
63 | cursor.insertText(tr("Plugin name")); |
|
63 | cursor.insertText(tr("Plugin name")); | |
64 | for(i=0;i<items.count();i++) |
|
64 | for(i=0;i<items.count();i++) | |
65 | { |
|
65 | { | |
66 | cursor.movePosition(cursor.NextCell); |
|
66 | cursor.movePosition(cursor.NextCell); | |
67 | cursor.insertText(pluginloader::getlibName(items.at(i))); |
|
67 | cursor.insertText(pluginloader::getlibName(items.at(i))); | |
68 | } |
|
68 | } | |
69 | cursor.movePosition(cursor.NextRow); |
|
69 | cursor.movePosition(cursor.NextRow); | |
70 | cursor.insertText(tr("Root")); |
|
70 | cursor.insertText(tr("Root")); | |
71 | for(i=0;i<items.count();i++) |
|
71 | for(i=0;i<items.count();i++) | |
72 | { |
|
72 | { | |
73 | cursor.movePosition(cursor.NextCell); |
|
73 | cursor.movePosition(cursor.NextCell); | |
74 | if(pluginloader::libcanberoot(items.at(i))) |
|
74 | if(pluginloader::libcanberoot(items.at(i))) | |
75 | { |
|
75 | { | |
76 | cursor.insertText("Yes"); |
|
76 | cursor.insertText("Yes"); | |
77 | } |
|
77 | } | |
78 | else |
|
78 | else | |
79 | { |
|
79 | { | |
80 | cursor.insertText("No"); |
|
80 | cursor.insertText("No"); | |
81 | } |
|
81 | } | |
82 | } |
|
82 | } | |
83 | cursor.movePosition(cursor.NextRow); |
|
83 | cursor.movePosition(cursor.NextRow); | |
84 | cursor.insertText(tr("Child")); |
|
84 | cursor.insertText(tr("Child")); | |
85 | for(i=0;i<items.count();i++) |
|
85 | for(i=0;i<items.count();i++) | |
86 | { |
|
86 | { | |
87 | cursor.movePosition(cursor.NextCell); |
|
87 | cursor.movePosition(cursor.NextCell); | |
88 | if(pluginloader::libcanbechild(items.at(i))) |
|
88 | if(pluginloader::libcanbechild(items.at(i))) | |
89 | { |
|
89 | { | |
90 | cursor.insertText("Yes"); |
|
90 | cursor.insertText("Yes"); | |
91 | } |
|
91 | } | |
92 | else |
|
92 | else | |
93 | { |
|
93 | { | |
94 | cursor.insertText("No"); |
|
94 | cursor.insertText("No"); | |
95 | } |
|
95 | } | |
96 | } |
|
96 | } | |
97 | cursor.movePosition(cursor.NextRow); |
|
97 | cursor.movePosition(cursor.NextRow); | |
98 | cursor.insertText(tr("VID")); |
|
98 | cursor.insertText(tr("VID")); | |
99 | for(i=0;i<items.count();i++) |
|
99 | for(i=0;i<items.count();i++) | |
100 | { |
|
100 | { | |
101 | cursor.movePosition(cursor.NextCell); |
|
101 | cursor.movePosition(cursor.NextCell); | |
102 | cursor.insertText(pluginloader::getlibVIDstr(items.at(i))); |
|
102 | cursor.insertText(pluginloader::getlibVIDstr(items.at(i))); | |
103 | } |
|
103 | } | |
104 | cursor.movePosition(cursor.NextRow); |
|
104 | cursor.movePosition(cursor.NextRow); | |
105 | cursor.insertText(tr("PID")); |
|
105 | cursor.insertText(tr("PID")); | |
106 | for(i=0;i<items.count();i++) |
|
106 | for(i=0;i<items.count();i++) | |
107 | { |
|
107 | { | |
108 | cursor.movePosition(cursor.NextCell); |
|
108 | cursor.movePosition(cursor.NextCell); | |
109 | cursor.insertText(pluginloader::getlibPIDstr(items.at(i))); |
|
109 | cursor.insertText(pluginloader::getlibPIDstr(items.at(i))); | |
110 | } |
|
110 | } | |
111 | cursor.movePosition(cursor.NextRow); |
|
111 | cursor.movePosition(cursor.NextRow); | |
112 | cursor.insertText(tr("Version")); |
|
112 | cursor.insertText(tr("Version")); | |
113 | for(i=0;i<items.count();i++) |
|
113 | for(i=0;i<items.count();i++) | |
114 | { |
|
114 | { | |
115 | cursor.movePosition(cursor.NextCell); |
|
115 | cursor.movePosition(cursor.NextCell); | |
116 | cursor.insertText(pluginloader::getlibVersion(items.at(i))); |
|
116 | cursor.insertText(pluginloader::getlibVersion(items.at(i))); | |
117 | } |
|
117 | } | |
118 | cursor.movePosition(cursor.NextRow); |
|
118 | cursor.movePosition(cursor.NextRow); | |
119 | cursor.insertText(tr("author")); |
|
119 | cursor.insertText(tr("author")); | |
120 | for(i=0;i<items.count();i++) |
|
120 | for(i=0;i<items.count();i++) | |
121 | { |
|
121 | { | |
122 | cursor.movePosition(cursor.NextCell); |
|
122 | cursor.movePosition(cursor.NextCell); | |
123 | cursor.insertText(pluginloader::getlibAuthor(items.at(i))); |
|
123 | cursor.insertText(pluginloader::getlibAuthor(items.at(i))); | |
124 | } |
|
124 | } | |
125 | cursor.movePosition(cursor.NextBlock); |
|
125 | cursor.movePosition(cursor.NextBlock); | |
126 |
|
126 | |||
127 | for(i=0;i<items.count();i++) |
|
127 | for(i=0;i<items.count();i++) | |
128 | { |
|
128 | { | |
129 | cursor.insertText("\n\n"); |
|
129 | cursor.insertText("\n\n"); | |
130 | cursor.insertText(pluginloader::getlibName(items.at(i))+" Description:\n"); |
|
130 | cursor.insertText(pluginloader::getlibName(items.at(i))+" Description:\n"); | |
131 | cursor.insertText(pluginloader::getlibDescription(items.at(i))); |
|
131 | cursor.insertText(pluginloader::getlibDescription(items.at(i))); | |
132 | } |
|
132 | } | |
133 |
|
133 | |||
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 |
|
136 | |||
137 | void pluginInfosWdgt::updateInfos(const QString pluginPath) |
|
137 | void pluginInfosWdgt::updateInfos(const QString pluginPath) | |
138 | { |
|
138 | { | |
139 | this->textInfos->clear(); |
|
139 | this->textInfos->clear(); | |
140 | QTextCursor cursor(this->textInfos->document()); |
|
140 | QTextCursor cursor(this->textInfos->document()); | |
141 | QTextCharFormat formatHeader(cursor.charFormat()); |
|
141 | QTextCharFormat formatHeader(cursor.charFormat()); | |
142 | QTextCharFormat formatContent(cursor.charFormat()); |
|
142 | QTextCharFormat formatContent(cursor.charFormat()); | |
143 | //QTextTable* table; |
|
143 | //QTextTable* table; | |
144 | formatHeader.setFontWeight(QFont::Bold); |
|
144 | formatHeader.setFontWeight(QFont::Bold); | |
145 | formatHeader.setForeground(QBrush(Qt::red)); |
|
145 | formatHeader.setForeground(QBrush(Qt::red)); | |
146 | formatContent.setForeground(Qt::black); |
|
146 | formatContent.setForeground(Qt::black); | |
147 | cursor.atStart(); |
|
147 | cursor.atStart(); | |
148 | if(pluginloader::checklibrary(pluginPath)==1) |
|
148 | if(pluginloader::checklibrary(pluginPath)==1) | |
149 | { |
|
149 | { | |
150 | cursor.setBlockCharFormat(formatHeader); |
|
150 | cursor.setBlockCharFormat(formatHeader); | |
151 | cursor.insertText(tr("plugin name:")); |
|
151 | cursor.insertText(tr("plugin name:")); | |
152 | //cursor.insertBlock(); |
|
152 | //cursor.insertBlock(); | |
153 | cursor.setBlockCharFormat(formatContent); |
|
153 | cursor.setBlockCharFormat(formatContent); | |
154 | //table = cursor.insertTable(1,1); |
|
154 | //table = cursor.insertTable(1,1); | |
155 | cursor.insertTable(1,1); |
|
155 | cursor.insertTable(1,1); | |
156 | cursor.insertText(pluginloader::getlibName(pluginPath)); |
|
156 | cursor.insertText(pluginloader::getlibName(pluginPath)); | |
157 | //table->cellAt( (pluginloader::getlibName(pluginPath)); |
|
157 | //table->cellAt( (pluginloader::getlibName(pluginPath)); | |
158 | //this->textInfos->append(pluginloader::getlibName(pluginPath)); |
|
158 | //this->textInfos->append(pluginloader::getlibName(pluginPath)); | |
159 | //this->textInfos->append("================================"); |
|
159 | //this->textInfos->append("================================"); | |
160 | if(pluginloader::libcanberoot(pluginPath)) |
|
160 | if(pluginloader::libcanberoot(pluginPath)) | |
161 | { |
|
161 | { | |
162 | this->textInfos->append(tr("This plugin can be used as root driver.")); |
|
162 | this->textInfos->append(tr("This plugin can be used as root driver.")); | |
163 | } |
|
163 | } | |
164 | else |
|
164 | else | |
165 | { |
|
165 | { | |
166 | this->textInfos->append(tr("This plugin can't' be used as root driver, so it need to be connected to an other plugin.")); |
|
166 | this->textInfos->append(tr("This plugin can't' be used as root driver, so it need to be connected to an other plugin.")); | |
167 | } |
|
167 | } | |
168 | this->textInfos->append("================================"); |
|
168 | this->textInfos->append("================================"); | |
169 | if(pluginloader::libcanbechild(pluginPath)) |
|
169 | if(pluginloader::libcanbechild(pluginPath)) | |
170 | { |
|
170 | { | |
171 | this->textInfos->append(tr("This plugin can be used as child driver.")); |
|
171 | this->textInfos->append(tr("This plugin can be used as child driver.")); | |
172 | } |
|
172 | } | |
173 | else |
|
173 | else | |
174 | { |
|
174 | { | |
175 | this->textInfos->append(tr("This plugin can't' be used as child driver.")); |
|
175 | this->textInfos->append(tr("This plugin can't' be used as child driver.")); | |
176 | } |
|
176 | } | |
177 | this->textInfos->append("================================"); |
|
177 | this->textInfos->append("================================"); | |
178 | this->textInfos->append(tr("plugin VID:")); |
|
178 | this->textInfos->append(tr("plugin VID:")); | |
179 | this->textInfos->append(pluginloader::getlibVIDstr(pluginPath)); |
|
179 | this->textInfos->append(pluginloader::getlibVIDstr(pluginPath)); | |
180 | this->textInfos->append("================================"); |
|
180 | this->textInfos->append("================================"); | |
181 | this->textInfos->append(tr("plugin PID:")); |
|
181 | this->textInfos->append(tr("plugin PID:")); | |
182 | this->textInfos->append(pluginloader::getlibPIDstr(pluginPath)); |
|
182 | this->textInfos->append(pluginloader::getlibPIDstr(pluginPath)); | |
183 | this->textInfos->append("================================"); |
|
183 | this->textInfos->append("================================"); | |
184 | this->textInfos->append(tr("plugin Version:")); |
|
184 | this->textInfos->append(tr("plugin Version:")); | |
185 | this->textInfos->append(pluginloader::getlibVersion(pluginPath)); |
|
185 | this->textInfos->append(pluginloader::getlibVersion(pluginPath)); | |
186 | this->textInfos->append("================================"); |
|
186 | this->textInfos->append("================================"); | |
187 | this->textInfos->append(tr("plugin Author:")); |
|
187 | this->textInfos->append(tr("plugin Author:")); | |
188 | this->textInfos->append(pluginloader::getlibAuthor(pluginPath)); |
|
188 | this->textInfos->append(pluginloader::getlibAuthor(pluginPath)); | |
189 | this->textInfos->append("================================"); |
|
189 | this->textInfos->append("================================"); | |
190 | this->textInfos->append(tr("plugin Description:")); |
|
190 | this->textInfos->append(tr("plugin Description:")); | |
191 | this->textInfos->append(pluginloader::getlibDescription(pluginPath)); |
|
191 | this->textInfos->append(pluginloader::getlibDescription(pluginPath)); | |
192 | } |
|
192 | } | |
193 | else |
|
193 | else | |
194 | { |
|
194 | { | |
195 | this->textInfos->setText(tr("This is not a valid plugin.")); |
|
195 | this->textInfos->setText(tr("This is not a valid plugin.")); | |
196 | } |
|
196 | } | |
197 | } |
|
197 | } | |
198 |
|
198 | |||
199 |
|
199 | |||
200 |
|
200 | |||
201 |
|
201 | |||
202 |
|
202 | |||
203 |
|
203 | |||
204 |
|
204 | |||
205 |
|
205 | |||
206 |
|
206 | |||
207 |
|
207 | |||
208 |
|
208 | |||
209 |
|
209 | |||
210 |
|
210 | |||
211 |
|
211 | |||
212 |
|
212 | |||
213 |
|
213 |
@@ -1,49 +1,49 | |||||
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, |
|
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 | #ifndef PLUGININFOSWDGT_H |
|
22 | #ifndef PLUGININFOSWDGT_H | |
23 | #define PLUGININFOSWDGT_H |
|
23 | #define PLUGININFOSWDGT_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QVBoxLayout> |
|
26 | #include <QVBoxLayout> | |
27 | #include <QTextEdit> |
|
27 | #include <QTextEdit> | |
28 | #include <QString> |
|
28 | #include <QString> | |
29 | #include <QTextBrowser> |
|
29 | #include <QTextBrowser> | |
30 |
|
30 | |||
31 | class pluginInfosWdgt : public QWidget |
|
31 | class pluginInfosWdgt : public QWidget | |
32 | { |
|
32 | { | |
33 | Q_OBJECT |
|
33 | Q_OBJECT | |
34 | public: |
|
34 | public: | |
35 | explicit pluginInfosWdgt(QWidget *parent = 0); |
|
35 | explicit pluginInfosWdgt(QWidget *parent = 0); | |
36 |
|
36 | |||
37 |
|
37 | |||
38 |
|
38 | |||
39 | public slots: |
|
39 | public slots: | |
40 | void updateInfos(const QString pluginPath); |
|
40 | void updateInfos(const QString pluginPath); | |
41 | void updateInfos(const QStringList& items); |
|
41 | void updateInfos(const QStringList& items); | |
42 |
|
42 | |||
43 | private: |
|
43 | private: | |
44 | QVBoxLayout* mailLayout; |
|
44 | QVBoxLayout* mailLayout; | |
45 | QTextBrowser* textInfos; |
|
45 | QTextBrowser* textInfos; | |
46 |
|
46 | |||
47 | }; |
|
47 | }; | |
48 |
|
48 | |||
49 | #endif // PLUGININFOSWDGT_H |
|
49 | #endif // PLUGININFOSWDGT_H |
@@ -1,117 +1,117 | |||||
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, |
|
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 "pluginlist.h" |
|
22 | #include "pluginlist.h" | |
23 | #include "pluginloader.h" |
|
23 | #include "pluginloader.h" | |
24 | #include <QDir> |
|
24 | #include <QDir> | |
25 | #include <QFile> |
|
25 | #include <QFile> | |
26 | #include <QFileInfoList> |
|
26 | #include <QFileInfoList> | |
27 | #include <QString> |
|
27 | #include <QString> | |
28 | #include <QStringList> |
|
28 | #include <QStringList> | |
29 | #include <QApplication> |
|
29 | #include <QApplication> | |
30 | #include <QLabel> |
|
30 | #include <QLabel> | |
31 | #include <QPixmap> |
|
31 | #include <QPixmap> | |
32 | #include "qsvgicon.h" |
|
32 | #include "qsvgicon.h" | |
33 | #include <QWidget> |
|
33 | #include <QWidget> | |
34 | #include <QDrag> |
|
34 | #include <QDrag> | |
35 |
|
35 | |||
36 | PluginList::PluginList(QWidget *parent):QListWidget(parent) |
|
36 | PluginList::PluginList(QWidget *parent):QListWidget(parent) | |
37 | { |
|
37 | { | |
38 | this->setAcceptDrops(true); |
|
38 | this->setAcceptDrops(true); | |
39 | this->setDragEnabled(true); |
|
39 | this->setDragEnabled(true); | |
40 | this->setSelectionMode(QAbstractItemView::ExtendedSelection); |
|
40 | this->setSelectionMode(QAbstractItemView::ExtendedSelection); | |
41 | connect(this,SIGNAL(itemSelectionChanged()),this,SLOT(updateSelection())); |
|
41 | connect(this,SIGNAL(itemSelectionChanged()),this,SLOT(updateSelection())); | |
42 | this->showCacheAction = new QAction(tr("View cache content"),this); |
|
42 | this->showCacheAction = new QAction(tr("View cache content"),this); | |
43 | this->addAction(this->showCacheAction); |
|
43 | this->addAction(this->showCacheAction); | |
44 | connect(this->showCacheAction,SIGNAL(triggered()),this,SLOT(showCache())); |
|
44 | connect(this->showCacheAction,SIGNAL(triggered()),this,SLOT(showCache())); | |
45 | this->setContextMenuPolicy(Qt::ActionsContextMenu); |
|
45 | this->setContextMenuPolicy(Qt::ActionsContextMenu); | |
46 |
|
46 | |||
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 |
|
49 | |||
50 | void PluginList::refreshPluginList() |
|
50 | void PluginList::refreshPluginList() | |
51 | { |
|
51 | { | |
52 | this->clear(); |
|
52 | this->clear(); | |
53 | QList<PluginsCacheItem*> plugins = pluginloader::listAvailiables(true); |
|
53 | QList<PluginsCacheItem*> plugins = pluginloader::listAvailiables(true); | |
54 | for (int i = 0; i < plugins.count(); ++i) |
|
54 | for (int i = 0; i < plugins.count(); ++i) | |
55 | { |
|
55 | { | |
56 | PluginListItem *newItem = new PluginListItem(QString(plugins.at(i)->getpluginName()),plugins.at(i)->getpath()+"/"+plugins.at(i)->getfileName()); |
|
56 | PluginListItem *newItem = new PluginListItem(QString(plugins.at(i)->getpluginName()),plugins.at(i)->getpath()+"/"+plugins.at(i)->getfileName()); | |
57 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); |
|
57 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); | |
58 | this->addItem((QListWidgetItem*)newItem); |
|
58 | this->addItem((QListWidgetItem*)newItem); | |
59 | } |
|
59 | } | |
60 | } |
|
60 | } | |
61 |
|
61 | |||
62 | void PluginList::dragEnterEvent(QDragEnterEvent *event) |
|
62 | void PluginList::dragEnterEvent(QDragEnterEvent *event) | |
63 | { |
|
63 | { | |
64 | this->clearSelection(); |
|
64 | this->clearSelection(); | |
65 | this->itemAt(dragStartPosition)->setSelected(true); |
|
65 | this->itemAt(dragStartPosition)->setSelected(true); | |
66 | event->acceptProposedAction(); |
|
66 | event->acceptProposedAction(); | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | void PluginList::dragMoveEvent(QDragMoveEvent *e) |
|
69 | void PluginList::dragMoveEvent(QDragMoveEvent *e) | |
70 | { |
|
70 | { | |
71 | e->accept(); |
|
71 | e->accept(); | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | void PluginList::mousePressEvent(QMouseEvent *event) |
|
74 | void PluginList::mousePressEvent(QMouseEvent *event) | |
75 | { |
|
75 | { | |
76 | if (event->button() == Qt::LeftButton) |
|
76 | if (event->button() == Qt::LeftButton) | |
77 | { |
|
77 | { | |
78 | dragStartPosition = event->pos(); |
|
78 | dragStartPosition = event->pos(); | |
79 | } |
|
79 | } | |
80 | QListWidget::mousePressEvent(event); |
|
80 | QListWidget::mousePressEvent(event); | |
81 | } |
|
81 | } | |
82 |
|
82 | |||
83 | void PluginList::mouseMoveEvent(QMouseEvent *event) |
|
83 | void PluginList::mouseMoveEvent(QMouseEvent *event) | |
84 | { |
|
84 | { | |
85 | if (!(event->buttons() & Qt::LeftButton)) |
|
85 | if (!(event->buttons() & Qt::LeftButton)) | |
86 | return; |
|
86 | return; | |
87 | if ((event->pos() - dragStartPosition).manhattanLength()< QApplication::startDragDistance()) |
|
87 | if ((event->pos() - dragStartPosition).manhattanLength()< QApplication::startDragDistance()) | |
88 | return; |
|
88 | return; | |
89 | if(this->selectedItems().count()==0) |
|
89 | if(this->selectedItems().count()==0) | |
90 | return; |
|
90 | return; | |
91 | QDrag *drag = new QDrag(this); |
|
91 | QDrag *drag = new QDrag(this); | |
92 | QMimeData *mimeData = new QMimeData; |
|
92 | QMimeData *mimeData = new QMimeData; | |
93 | drag->setHotSpot(event->pos() - rect().topLeft()); |
|
93 | drag->setHotSpot(event->pos() - rect().topLeft()); | |
94 | mimeData->setData("socexplorer/pluginName",QByteArray(((PluginListItem*)this->selectedItems().first())->fullPath->toLatin1())); |
|
94 | mimeData->setData("socexplorer/pluginName",QByteArray(((PluginListItem*)this->selectedItems().first())->fullPath->toLatin1())); | |
95 | mimeData->setText(((PluginListItem*)this->selectedItems().first())->fullPath->toLatin1()); |
|
95 | mimeData->setText(((PluginListItem*)this->selectedItems().first())->fullPath->toLatin1()); | |
96 | drag->setMimeData(mimeData); |
|
96 | drag->setMimeData(mimeData); | |
97 | drag->exec(Qt::MoveAction); |
|
97 | drag->exec(Qt::MoveAction); | |
98 | } |
|
98 | } | |
99 |
|
99 | |||
100 |
|
100 | |||
101 |
|
101 | |||
102 | void PluginList::dropEvent(QDropEvent *event) |
|
102 | void PluginList::dropEvent(QDropEvent *event) | |
103 | { |
|
103 | { | |
104 | Q_UNUSED(event) |
|
104 | Q_UNUSED(event) | |
105 | } |
|
105 | } | |
106 |
|
106 | |||
107 |
|
107 | |||
108 |
|
108 | |||
109 | void PluginList::updateSelection() |
|
109 | void PluginList::updateSelection() | |
110 | { |
|
110 | { | |
111 | QStringList _items; |
|
111 | QStringList _items; | |
112 | for(int i=0;i<this->selectedItems().count();i++) |
|
112 | for(int i=0;i<this->selectedItems().count();i++) | |
113 | { |
|
113 | { | |
114 | _items << *((PluginListItem*)(this->selectedItems().at(i)))->fullPath; |
|
114 | _items << *((PluginListItem*)(this->selectedItems().at(i)))->fullPath; | |
115 | } |
|
115 | } | |
116 | emit this->itemSelectionChanged(_items); |
|
116 | emit this->itemSelectionChanged(_items); | |
117 | } |
|
117 | } |
@@ -1,78 +1,78 | |||||
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, |
|
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 | #ifndef PLUGINLIST_H |
|
22 | #ifndef PLUGINLIST_H | |
23 | #define PLUGINLIST_H |
|
23 | #define PLUGINLIST_H | |
24 | #include <QTableWidget> |
|
24 | #include <QTableWidget> | |
25 | #include <QListWidget> |
|
25 | #include <QListWidget> | |
26 | #include <QtGui/QDragEnterEvent> |
|
26 | #include <QtGui/QDragEnterEvent> | |
27 | #include <QtGui/QDragLeaveEvent> |
|
27 | #include <QtGui/QDragLeaveEvent> | |
28 | #include <QtGui/QDragMoveEvent> |
|
28 | #include <QtGui/QDragMoveEvent> | |
29 | #include <QtGui/QDropEvent> |
|
29 | #include <QtGui/QDropEvent> | |
30 | #include <QtCore/QMimeData> |
|
30 | #include <QtCore/QMimeData> | |
31 | #include <QtCore/QUrl> |
|
31 | #include <QtCore/QUrl> | |
32 | #include <QtCore/QList> |
|
32 | #include <QtCore/QList> | |
33 | #include <QPoint> |
|
33 | #include <QPoint> | |
34 | #include <QStringList> |
|
34 | #include <QStringList> | |
35 | #include <QMenu> |
|
35 | #include <QMenu> | |
36 | #include <QAction> |
|
36 | #include <QAction> | |
37 | #include <pluginloader.h> |
|
37 | #include <pluginloader.h> | |
38 |
|
38 | |||
39 | class PluginListItem: public QListWidgetItem |
|
39 | class PluginListItem: public QListWidgetItem | |
40 | { |
|
40 | { | |
41 | public: |
|
41 | public: | |
42 | explicit PluginListItem( const QString & Name,const QString & FullPath, QListWidget * parent = 0, int type = Type ) |
|
42 | explicit PluginListItem( const QString & Name,const QString & FullPath, QListWidget * parent = 0, int type = Type ) | |
43 | :QListWidgetItem(Name,parent,type) |
|
43 | :QListWidgetItem(Name,parent,type) | |
44 | { |
|
44 | { | |
45 | this->fullPath = new QString(FullPath); |
|
45 | this->fullPath = new QString(FullPath); | |
46 | } |
|
46 | } | |
47 | QString* fullPath; |
|
47 | QString* fullPath; | |
48 | }; |
|
48 | }; | |
49 |
|
49 | |||
50 |
|
50 | |||
51 | class PluginList: public QListWidget |
|
51 | class PluginList: public QListWidget | |
52 | { |
|
52 | { | |
53 | Q_OBJECT |
|
53 | Q_OBJECT | |
54 | public: |
|
54 | public: | |
55 | explicit PluginList(QWidget * parent = 0); |
|
55 | explicit PluginList(QWidget * parent = 0); | |
56 |
|
56 | |||
57 | protected: |
|
57 | protected: | |
58 | void dragEnterEvent(QDragEnterEvent *event); |
|
58 | void dragEnterEvent(QDragEnterEvent *event); | |
59 | void dragMoveEvent(QDragMoveEvent *e); |
|
59 | void dragMoveEvent(QDragMoveEvent *e); | |
60 | void dropEvent(QDropEvent *event); |
|
60 | void dropEvent(QDropEvent *event); | |
61 | void mousePressEvent(QMouseEvent *event); |
|
61 | void mousePressEvent(QMouseEvent *event); | |
62 | void mouseMoveEvent(QMouseEvent *e); |
|
62 | void mouseMoveEvent(QMouseEvent *e); | |
63 |
|
63 | |||
64 | public slots: |
|
64 | public slots: | |
65 | void refreshPluginList(); |
|
65 | void refreshPluginList(); | |
66 | private slots: |
|
66 | private slots: | |
67 | void updateSelection(); |
|
67 | void updateSelection(); | |
68 | void showCache(){pluginloader::showCache();} |
|
68 | void showCache(){pluginloader::showCache();} | |
69 | signals: |
|
69 | signals: | |
70 | void itemSelectionChanged(const QStringList& items); |
|
70 | void itemSelectionChanged(const QStringList& items); | |
71 |
|
71 | |||
72 |
|
72 | |||
73 | private: |
|
73 | private: | |
74 | QAction* showCacheAction; |
|
74 | QAction* showCacheAction; | |
75 | QPoint dragStartPosition; |
|
75 | QPoint dragStartPosition; | |
76 | }; |
|
76 | }; | |
77 |
|
77 | |||
78 | #endif // PLUGINLIST_H |
|
78 | #endif // PLUGINLIST_H |
@@ -1,142 +1,142 | |||||
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, |
|
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 "pluginmanagerWDGT.h" |
|
22 | #include "pluginmanagerWDGT.h" | |
23 | #include "pluginloader.h" |
|
23 | #include "pluginloader.h" | |
24 | #include <QFileDialog> |
|
24 | #include <QFileDialog> | |
25 | #include <unistd.h> |
|
25 | #include <unistd.h> | |
26 | #include <qsvgicon.h> |
|
26 | #include <qsvgicon.h> | |
27 | #include <socexplorerengine.h> |
|
27 | #include <socexplorerengine.h> | |
28 |
|
28 | |||
29 | #define mkbutton(button,text,image)button = new QPushButton();\ |
|
29 | #define mkbutton(button,text,image)button = new QPushButton();\ | |
30 | button->setIcon(QSvgIcon(image));\ |
|
30 | button->setIcon(QSvgIcon(image));\ | |
31 | button->setIconSize(QSize(16,16));\ |
|
31 | button->setIconSize(QSize(16,16));\ | |
32 | button->setToolTip(text) |
|
32 | button->setToolTip(text) | |
33 |
|
33 | |||
34 |
|
34 | |||
35 |
|
35 | |||
36 | pluginmanagerWDGT::pluginmanagerWDGT(QWidget *parent) : |
|
36 | pluginmanagerWDGT::pluginmanagerWDGT(QWidget *parent) : | |
37 | QSplitter(parent) |
|
37 | QSplitter(parent) | |
38 | { |
|
38 | { | |
39 | this->setWindowTitle("Plugin Manager"); |
|
39 | this->setWindowTitle("Plugin Manager"); | |
40 | this->setOrientation(Qt::Vertical); |
|
40 | this->setOrientation(Qt::Vertical); | |
41 | this->pluginListWidgetContainer = new QWidget(); |
|
41 | this->pluginListWidgetContainer = new QWidget(); | |
42 | this->mainlayoutSpliter = new QSplitter; |
|
42 | this->mainlayoutSpliter = new QSplitter; | |
43 | this->pluginListLayout = new QVBoxLayout(); |
|
43 | this->pluginListLayout = new QVBoxLayout(); | |
44 | this->mainlayoutSpliter->setOrientation(Qt::Vertical); |
|
44 | this->mainlayoutSpliter->setOrientation(Qt::Vertical); | |
45 | this->treeview = new plugintree(); |
|
45 | this->treeview = new plugintree(); | |
46 | this->pluginTable = new PluginList; |
|
46 | this->pluginTable = new PluginList; | |
47 | this->ButtonsLayout = new QHBoxLayout(); |
|
47 | this->ButtonsLayout = new QHBoxLayout(); | |
48 | this->ButtonsLayout->addStretch(); |
|
48 | this->ButtonsLayout->addStretch(); | |
49 | this->pluginListLayout->addLayout(this->ButtonsLayout); |
|
49 | this->pluginListLayout->addLayout(this->ButtonsLayout); | |
50 | this->addWidget(this->treeview); |
|
50 | this->addWidget(this->treeview); | |
51 | this->pluginListWidgetContainer->setLayout(this->pluginListLayout); |
|
51 | this->pluginListWidgetContainer->setLayout(this->pluginListLayout); | |
52 | this->addWidget(this->pluginListWidgetContainer); |
|
52 | this->addWidget(this->pluginListWidgetContainer); | |
53 | this->pluginListLayout->addWidget(this->pluginTable); |
|
53 | this->pluginListLayout->addWidget(this->pluginTable); | |
54 | this->pluginInfos = new pluginInfosWdgt; |
|
54 | this->pluginInfos = new pluginInfosWdgt; | |
55 |
|
55 | |||
56 | mkbutton(this->addPluginBt,tr("add plugin"),":/images/open.svg"); |
|
56 | mkbutton(this->addPluginBt,tr("add plugin"),":/images/open.svg"); | |
57 | mkbutton(this->removePluginBt,tr("remove plugin(s)"),":/images/trash.svg"); |
|
57 | mkbutton(this->removePluginBt,tr("remove plugin(s)"),":/images/trash.svg"); | |
58 | mkbutton(this->refreshPluginListBt,tr("Refresh Plugin(s) list"),":/images/refresh.svg"); |
|
58 | mkbutton(this->refreshPluginListBt,tr("Refresh Plugin(s) list"),":/images/refresh.svg"); | |
59 |
|
59 | |||
60 | this->ButtonsLayout->addWidget(this->addPluginBt); |
|
60 | this->ButtonsLayout->addWidget(this->addPluginBt); | |
61 | this->ButtonsLayout->addWidget(this->refreshPluginListBt); |
|
61 | this->ButtonsLayout->addWidget(this->refreshPluginListBt); | |
62 | this->ButtonsLayout->addWidget(this->removePluginBt); |
|
62 | this->ButtonsLayout->addWidget(this->removePluginBt); | |
63 |
|
63 | |||
64 | this->addWidget(this->pluginInfos); |
|
64 | this->addWidget(this->pluginInfos); | |
65 |
|
65 | |||
66 | connect(this->treeview,SIGNAL(geteplugintree()),this,SIGNAL(geteplugintree())); |
|
66 | connect(this->treeview,SIGNAL(geteplugintree()),this,SIGNAL(geteplugintree())); | |
67 | connect(this,SIGNAL(treeChanged(QList<socexplorerplugin*>)),this->treeview,SLOT(treeChanged(QList<socexplorerplugin*>))); |
|
67 | connect(this,SIGNAL(treeChanged(QList<socexplorerplugin*>)),this->treeview,SLOT(treeChanged(QList<socexplorerplugin*>))); | |
68 | connect(this->pluginTable,SIGNAL(currentRowChanged(int)),this,SLOT(libselected(int))); |
|
68 | connect(this->pluginTable,SIGNAL(currentRowChanged(int)),this,SLOT(libselected(int))); | |
69 | connect(this->pluginTable,SIGNAL(itemSelectionChanged(QStringList)),this->pluginInfos,SLOT(updateInfos(QStringList))); |
|
69 | connect(this->pluginTable,SIGNAL(itemSelectionChanged(QStringList)),this->pluginInfos,SLOT(updateInfos(QStringList))); | |
70 | connect(this->addPluginBt,SIGNAL(clicked()),this,SLOT(addPlugin())); |
|
70 | connect(this->addPluginBt,SIGNAL(clicked()),this,SLOT(addPlugin())); | |
71 | connect(this->removePluginBt,SIGNAL(clicked()),this,SLOT(removePlugin())); |
|
71 | connect(this->removePluginBt,SIGNAL(clicked()),this,SLOT(removePlugin())); | |
72 | connect(this->pluginTable,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(loadplugin(QListWidgetItem*))); |
|
72 | connect(this->pluginTable,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(loadplugin(QListWidgetItem*))); | |
73 | connect(this->refreshPluginListBt,SIGNAL(clicked()),this->pluginTable,SLOT(refreshPluginList())); |
|
73 | connect(this->refreshPluginListBt,SIGNAL(clicked()),this->pluginTable,SLOT(refreshPluginList())); | |
74 | connect(this->treeview,SIGNAL(loadSysDriver(QString)),this,SIGNAL(loadSysDrviver(QString))); |
|
74 | connect(this->treeview,SIGNAL(loadSysDriver(QString)),this,SIGNAL(loadSysDrviver(QString))); | |
75 | connect(this->treeview,SIGNAL(loadSysDriverToParent(QString,QString)),this,SIGNAL(loadSysDriverToParent(QString,QString))); |
|
75 | connect(this->treeview,SIGNAL(loadSysDriverToParent(QString,QString)),this,SIGNAL(loadSysDriverToParent(QString,QString))); | |
76 | connect(this->treeview,SIGNAL(changeSysDriverInstName(QString,QString)),this,SIGNAL(changeSysDriverInstName(QString,QString))); |
|
76 | connect(this->treeview,SIGNAL(changeSysDriverInstName(QString,QString)),this,SIGNAL(changeSysDriverInstName(QString,QString))); | |
77 | connect(this->treeview,SIGNAL(closeSysDriver(QString)),this,SIGNAL(closeSysDriver(QString))); |
|
77 | connect(this->treeview,SIGNAL(closeSysDriver(QString)),this,SIGNAL(closeSysDriver(QString))); | |
78 | connect(this->treeview,SIGNAL(pluginselected(QString)),this,SIGNAL(pluginselected(QString))); |
|
78 | connect(this->treeview,SIGNAL(pluginselected(QString)),this,SIGNAL(pluginselected(QString))); | |
79 | this->rootLoadable = false; |
|
79 | this->rootLoadable = false; | |
80 | this->childLoadable = false; |
|
80 | this->childLoadable = false; | |
81 | this->pluginTable->refreshPluginList(); |
|
81 | this->pluginTable->refreshPluginList(); | |
82 | this->pluginTable->refreshPluginList(); |
|
82 | this->pluginTable->refreshPluginList(); | |
83 | } |
|
83 | } | |
84 |
|
84 | |||
85 |
|
85 | |||
86 | void pluginmanagerWDGT::setRootLoadable(bool flag) |
|
86 | void pluginmanagerWDGT::setRootLoadable(bool flag) | |
87 | { |
|
87 | { | |
88 | this->rootLoadable = flag; |
|
88 | this->rootLoadable = flag; | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 |
|
91 | |||
92 | void pluginmanagerWDGT::setChildLoadable(bool flag) |
|
92 | void pluginmanagerWDGT::setChildLoadable(bool flag) | |
93 | { |
|
93 | { | |
94 | this->childLoadable = flag; |
|
94 | this->childLoadable = flag; | |
95 | } |
|
95 | } | |
96 |
|
96 | |||
97 |
|
97 | |||
98 |
|
98 | |||
99 |
|
99 | |||
100 | void pluginmanagerWDGT::addPlugin() |
|
100 | void pluginmanagerWDGT::addPlugin() | |
101 | { |
|
101 | { | |
102 | QString fileName = QFileDialog::getOpenFileName(this,tr("Open Plugin"), QDir::homePath(), tr("Plugin Files Files (*.dll *.so *.so.*)")); |
|
102 | QString fileName = QFileDialog::getOpenFileName(this,tr("Open Plugin"), QDir::homePath(), tr("Plugin Files Files (*.dll *.so *.so.*)")); | |
103 | if(pluginloader::checklibrary(fileName)) |
|
103 | if(pluginloader::checklibrary(fileName)) | |
104 | { |
|
104 | { | |
105 | QFile::copy(fileName,QString(SocExplorerEngine::pluginFolder())+"/"+ fileName.section('/',-1)); |
|
105 | QFile::copy(fileName,QString(SocExplorerEngine::pluginFolder())+"/"+ fileName.section('/',-1)); | |
106 | } |
|
106 | } | |
107 | this->pluginTable->refreshPluginList(); |
|
107 | this->pluginTable->refreshPluginList(); | |
108 | } |
|
108 | } | |
109 |
|
109 | |||
110 |
|
110 | |||
111 | void pluginmanagerWDGT::removePlugin() |
|
111 | void pluginmanagerWDGT::removePlugin() | |
112 | { |
|
112 | { | |
113 | for(int i=0;i<this->pluginTable->selectedItems().count();i++) |
|
113 | for(int i=0;i<this->pluginTable->selectedItems().count();i++) | |
114 | { |
|
114 | { | |
115 | QListWidgetItem* item = this->pluginTable->selectedItems().at(i); |
|
115 | QListWidgetItem* item = this->pluginTable->selectedItems().at(i); | |
116 | if(item!=NULL) |
|
116 | if(item!=NULL) | |
117 | { |
|
117 | { | |
118 | QFile::remove(QString(SocExplorerEngine::pluginFolder())+"/"+item->text()); |
|
118 | QFile::remove(QString(SocExplorerEngine::pluginFolder())+"/"+item->text()); | |
119 | } |
|
119 | } | |
120 | } |
|
120 | } | |
121 | this->pluginTable->refreshPluginList(); |
|
121 | this->pluginTable->refreshPluginList(); | |
122 | } |
|
122 | } | |
123 |
|
123 | |||
124 |
|
124 | |||
125 |
|
125 | |||
126 | void pluginmanagerWDGT::loadplugin() |
|
126 | void pluginmanagerWDGT::loadplugin() | |
127 | { |
|
127 | { | |
128 | for(int i=0;i<this->pluginTable->selectedItems().count();i++) |
|
128 | for(int i=0;i<this->pluginTable->selectedItems().count();i++) | |
129 | { |
|
129 | { | |
130 | QListWidgetItem* item = this->pluginTable->selectedItems().at(i); |
|
130 | QListWidgetItem* item = this->pluginTable->selectedItems().at(i); | |
131 | if(item!=NULL) |
|
131 | if(item!=NULL) | |
132 | { |
|
132 | { | |
133 | QString plugin = QString(SocExplorerEngine::pluginFolder())+"/"+item->text(); |
|
133 | QString plugin = QString(SocExplorerEngine::pluginFolder())+"/"+item->text(); | |
134 | emit this->loadSysDrviver(plugin); |
|
134 | emit this->loadSysDrviver(plugin); | |
135 | } |
|
135 | } | |
136 | } |
|
136 | } | |
137 | this->pluginTable->refreshPluginList(); |
|
137 | this->pluginTable->refreshPluginList(); | |
138 | } |
|
138 | } | |
139 |
|
139 | |||
140 |
|
140 | |||
141 |
|
141 | |||
142 |
|
142 |
@@ -1,94 +1,94 | |||||
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, |
|
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 | #ifndef PLUGINMANAGERWDGT_H |
|
22 | #ifndef PLUGINMANAGERWDGT_H | |
23 | #define PLUGINMANAGERWDGT_H |
|
23 | #define PLUGINMANAGERWDGT_H | |
24 |
|
24 | |||
25 | #include <QApplication> |
|
25 | #include <QApplication> | |
26 | #include <QWidget> |
|
26 | #include <QWidget> | |
27 | #include <QDockWidget> |
|
27 | #include <QDockWidget> | |
28 | #include <QVBoxLayout> |
|
28 | #include <QVBoxLayout> | |
29 | #include <QHBoxLayout> |
|
29 | #include <QHBoxLayout> | |
30 | #include <QTableWidget> |
|
30 | #include <QTableWidget> | |
31 | #include <QDir> |
|
31 | #include <QDir> | |
32 | #include <QStringList> |
|
32 | #include <QStringList> | |
33 | #include <QFileInfoList> |
|
33 | #include <QFileInfoList> | |
34 | #include <QFileInfo> |
|
34 | #include <QFileInfo> | |
35 | #include <QTextEdit> |
|
35 | #include <QTextEdit> | |
36 | #include <QPushButton> |
|
36 | #include <QPushButton> | |
37 | #include <QSplitter> |
|
37 | #include <QSplitter> | |
38 | #include "plugininfoswdgt.h" |
|
38 | #include "plugininfoswdgt.h" | |
39 | #include "pluginlist.h" |
|
39 | #include "pluginlist.h" | |
40 | #include <socexplorerplugin.h> |
|
40 | #include <socexplorerplugin.h> | |
41 | #include <QList> |
|
41 | #include <QList> | |
42 | #include "plugintree.h" |
|
42 | #include "plugintree.h" | |
43 |
|
43 | |||
44 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
44 | #if defined(SOCEXPLORER_SDK_BUILD) | |
45 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
45 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT | |
46 | #else |
|
46 | #else | |
47 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
47 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT | |
48 | #endif |
|
48 | #endif | |
49 |
|
49 | |||
50 | class pluginmanagerWDGT : public QSplitter |
|
50 | class pluginmanagerWDGT : public QSplitter | |
51 | { |
|
51 | { | |
52 | Q_OBJECT |
|
52 | Q_OBJECT | |
53 | public: |
|
53 | public: | |
54 | SOCEXPLORER_SDK_EXPORT explicit pluginmanagerWDGT(QWidget *parent = 0); |
|
54 | SOCEXPLORER_SDK_EXPORT explicit pluginmanagerWDGT(QWidget *parent = 0); | |
55 | SOCEXPLORER_SDK_EXPORT void setRootLoadable(bool flag); |
|
55 | SOCEXPLORER_SDK_EXPORT void setRootLoadable(bool flag); | |
56 | SOCEXPLORER_SDK_EXPORT void setChildLoadable(bool flag); |
|
56 | SOCEXPLORER_SDK_EXPORT void setChildLoadable(bool flag); | |
57 |
|
57 | |||
58 | signals: |
|
58 | signals: | |
59 | void updatepluginInfo(const QString libname); |
|
59 | void updatepluginInfo(const QString libname); | |
60 | void loadSysDrviver(const QString name); |
|
60 | void loadSysDrviver(const QString name); | |
61 | void loadSysDriverToParent(const QString name, const QString instanceName); |
|
61 | void loadSysDriverToParent(const QString name, const QString instanceName); | |
62 | void geteplugintree(void); |
|
62 | void geteplugintree(void); | |
63 | void treeChanged(const QList<socexplorerplugin*>& drivers); |
|
63 | void treeChanged(const QList<socexplorerplugin*>& drivers); | |
64 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
64 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); | |
65 | void closeSysDriver(const QString instanceName); |
|
65 | void closeSysDriver(const QString instanceName); | |
66 | void pluginselected(const QString& instanceName); |
|
66 | void pluginselected(const QString& instanceName); | |
67 |
|
67 | |||
68 | public slots: |
|
68 | public slots: | |
69 | //void libselected(int row); |
|
69 | //void libselected(int row); | |
70 | void addPlugin(); |
|
70 | void addPlugin(); | |
71 | void removePlugin(); |
|
71 | void removePlugin(); | |
72 | void loadplugin(); |
|
72 | void loadplugin(); | |
73 | //void loadplugin(QListWidgetItem*); |
|
73 | //void loadplugin(QListWidgetItem*); | |
74 |
|
74 | |||
75 | private: |
|
75 | private: | |
76 |
|
76 | |||
77 | bool rootLoadable; |
|
77 | bool rootLoadable; | |
78 | bool childLoadable; |
|
78 | bool childLoadable; | |
79 | QWidget* pluginListWidgetContainer; |
|
79 | QWidget* pluginListWidgetContainer; | |
80 | QVBoxLayout* pluginListLayout; |
|
80 | QVBoxLayout* pluginListLayout; | |
81 | QHBoxLayout* ButtonsLayout; |
|
81 | QHBoxLayout* ButtonsLayout; | |
82 | QSplitter* mainlayoutSpliter; |
|
82 | QSplitter* mainlayoutSpliter; | |
83 | PluginList* pluginTable; |
|
83 | PluginList* pluginTable; | |
84 | pluginInfosWdgt* pluginInfos; |
|
84 | pluginInfosWdgt* pluginInfos; | |
85 | plugintree* treeview; |
|
85 | plugintree* treeview; | |
86 | QPushButton* addPluginBt; |
|
86 | QPushButton* addPluginBt; | |
87 | QPushButton* removePluginBt; |
|
87 | QPushButton* removePluginBt; | |
88 | QPushButton* loadPluginBt; |
|
88 | QPushButton* loadPluginBt; | |
89 | QPushButton* refreshPluginListBt; |
|
89 | QPushButton* refreshPluginListBt; | |
90 |
|
90 | |||
91 |
|
91 | |||
92 | }; |
|
92 | }; | |
93 |
|
93 | |||
94 | #endif // PLUGINMANAGERWDGT_H |
|
94 | #endif // PLUGINMANAGERWDGT_H |
@@ -1,73 +1,73 | |||||
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, |
|
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 | #ifndef PLUGINTREE_H |
|
22 | #ifndef PLUGINTREE_H | |
23 | #define PLUGINTREE_H |
|
23 | #define PLUGINTREE_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QTreeWidget> |
|
26 | #include <QTreeWidget> | |
27 | #include <socexplorerplugin.h> |
|
27 | #include <socexplorerplugin.h> | |
28 | #include <QList> |
|
28 | #include <QList> | |
29 | #include <QtGui/QDragEnterEvent> |
|
29 | #include <QtGui/QDragEnterEvent> | |
30 | #include <QtGui/QDragLeaveEvent> |
|
30 | #include <QtGui/QDragLeaveEvent> | |
31 | #include <QtGui/QDragMoveEvent> |
|
31 | #include <QtGui/QDragMoveEvent> | |
32 | #include <QtGui/QDropEvent> |
|
32 | #include <QtGui/QDropEvent> | |
33 | #include <QtCore/QMimeData> |
|
33 | #include <QtCore/QMimeData> | |
34 | #include <QtCore/QUrl> |
|
34 | #include <QtCore/QUrl> | |
35 | #include <QtCore/QList> |
|
35 | #include <QtCore/QList> | |
36 | #include <QPoint> |
|
36 | #include <QPoint> | |
37 | #include <QLabel> |
|
37 | #include <QLabel> | |
38 |
|
38 | |||
39 | class plugintree : public QTreeWidget |
|
39 | class plugintree : public QTreeWidget | |
40 | { |
|
40 | { | |
41 | Q_OBJECT |
|
41 | Q_OBJECT | |
42 | public: |
|
42 | public: | |
43 | explicit plugintree(QWidget *parent = 0); |
|
43 | explicit plugintree(QWidget *parent = 0); | |
44 |
|
44 | |||
45 | protected: |
|
45 | protected: | |
46 | void dragEnterEvent(QDragEnterEvent *event); |
|
46 | void dragEnterEvent(QDragEnterEvent *event); | |
47 | void dragMoveEvent(QDragMoveEvent *event); |
|
47 | void dragMoveEvent(QDragMoveEvent *event); | |
48 | void dropEvent(QDropEvent *event); |
|
48 | void dropEvent(QDropEvent *event); | |
49 | void mousePressEvent(QMouseEvent *event); |
|
49 | void mousePressEvent(QMouseEvent *event); | |
50 | void mouseDoubleClickEvent(QMouseEvent *event); |
|
50 | void mouseDoubleClickEvent(QMouseEvent *event); | |
51 | void keyPressEvent(QKeyEvent *event); |
|
51 | void keyPressEvent(QKeyEvent *event); | |
52 |
|
52 | |||
53 | signals: |
|
53 | signals: | |
54 | void geteplugintree(void); |
|
54 | void geteplugintree(void); | |
55 | void pluginselected(const QString& Name); |
|
55 | void pluginselected(const QString& Name); | |
56 | void loadSysDriverToParent(const QString name, const QString instanceName); |
|
56 | void loadSysDriverToParent(const QString name, const QString instanceName); | |
57 | void loadSysDriver(const QString name); |
|
57 | void loadSysDriver(const QString name); | |
58 | void closeSysDriver(const QString instanceName); |
|
58 | void closeSysDriver(const QString instanceName); | |
59 | void changeSysDriverInstName(const QString instanceName); |
|
59 | void changeSysDriverInstName(const QString instanceName); | |
60 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
60 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); | |
61 | public slots: |
|
61 | public slots: | |
62 | void treeChanged(const QList<socexplorerplugin*>& drivers); |
|
62 | void treeChanged(const QList<socexplorerplugin*>& drivers); | |
63 | void pluginselectedslt( QTreeWidgetItem * item, int column); |
|
63 | void pluginselectedslt( QTreeWidgetItem * item, int column); | |
64 | void itemSelectionChangedslt(); |
|
64 | void itemSelectionChangedslt(); | |
65 |
|
65 | |||
66 | private: |
|
66 | private: | |
67 | void addplugin(socexplorerplugin* driver,QTreeWidgetItem* item); |
|
67 | void addplugin(socexplorerplugin* driver,QTreeWidgetItem* item); | |
68 | QTreeWidgetItem* editeditem; |
|
68 | QTreeWidgetItem* editeditem; | |
69 | QString* editeditemprev; |
|
69 | QString* editeditemprev; | |
70 | bool editingItem; |
|
70 | bool editingItem; | |
71 | }; |
|
71 | }; | |
72 |
|
72 | |||
73 | #endif // PLUGINTREE_H |
|
73 | #endif // PLUGINTREE_H |
@@ -1,90 +1,90 | |||||
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, |
|
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 | #ifndef PLUGINLOADER_H |
|
22 | #ifndef PLUGINLOADER_H | |
23 | #define PLUGINLOADER_H |
|
23 | #define PLUGINLOADER_H | |
24 |
|
24 | |||
25 | #include <QString> |
|
25 | #include <QString> | |
26 | #include <QLibrary> |
|
26 | #include <QLibrary> | |
27 | #include <QObject> |
|
27 | #include <QObject> | |
28 | #include <QStringList> |
|
28 | #include <QStringList> | |
29 | #include <socexplorerplugininterface.h> |
|
29 | #include <socexplorerplugininterface.h> | |
30 | #include <socexplorerplugin.h> |
|
30 | #include <socexplorerplugin.h> | |
31 | #include <pluginscache.h> |
|
31 | #include <pluginscache.h> | |
32 | /* |
|
32 | /* | |
33 | Debug |
|
33 | Debug | |
34 | */ |
|
34 | */ | |
35 | #include <stdio.h> |
|
35 | #include <stdio.h> | |
36 |
|
36 | |||
37 | #define loadlib(filename) QLibrary* lib = new QLibrary((fileName));\ |
|
37 | #define loadlib(filename) QLibrary* lib = new QLibrary((fileName));\ | |
38 | lib->load();\ |
|
38 | lib->load();\ | |
39 | if(!lib->isLoaded())\ |
|
39 | if(!lib->isLoaded())\ | |
40 | {\ |
|
40 | {\ | |
41 | return 0;\ |
|
41 | return 0;\ | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 |
|
44 | |||
45 | class pluginloader |
|
45 | class pluginloader | |
46 | { |
|
46 | { | |
47 |
|
47 | |||
48 | private: |
|
48 | private: | |
49 | static pluginloader* _self; |
|
49 | static pluginloader* _self; | |
50 | static PluginsCache* _cache; |
|
50 | static PluginsCache* _cache; | |
51 | static QStringList* _folderList; |
|
51 | static QStringList* _folderList; | |
52 | ~pluginloader(); |
|
52 | ~pluginloader(); | |
53 | pluginloader(); |
|
53 | pluginloader(); | |
54 | public: |
|
54 | public: | |
55 |
|
55 | |||
56 | static void init(); |
|
56 | static void init(); | |
57 | static pluginloader* self(); |
|
57 | static pluginloader* self(); | |
58 |
|
58 | |||
59 | static int checklibrary(const QString fileName); |
|
59 | static int checklibrary(const QString fileName); | |
60 | static bool isvalid(QString Name); |
|
60 | static bool isvalid(QString Name); | |
61 | static socexplorerplugin* newsocexplorerplugin(const QString Name); |
|
61 | static socexplorerplugin* newsocexplorerplugin(const QString Name); | |
62 | static QString getlibTypeStr(QString Name); |
|
62 | static QString getlibTypeStr(QString Name); | |
63 | static pluginT getlibType(QString Name); |
|
63 | static pluginT getlibType(QString Name); | |
64 | static QString getlibVersion(const QString Name); |
|
64 | static QString getlibVersion(const QString Name); | |
65 | static QString getlibPIDstr(const QString Name); |
|
65 | static QString getlibPIDstr(const QString Name); | |
66 | static QString getlibVIDstr(const QString Name); |
|
66 | static QString getlibVIDstr(const QString Name); | |
67 | static int getlibPID(const QString Name); |
|
67 | static int getlibPID(const QString Name); | |
68 | static int getlibVID(const QString Name); |
|
68 | static int getlibVID(const QString Name); | |
69 | static int libcanbechild(const QString Name); |
|
69 | static int libcanbechild(const QString Name); | |
70 | static int libcanberoot(const QString Name); |
|
70 | static int libcanberoot(const QString Name); | |
71 | static QString getlibAuthor(const QString Name); |
|
71 | static QString getlibAuthor(const QString Name); | |
72 | static QString getlibName(const QString Name); |
|
72 | static QString getlibName(const QString Name); | |
73 | static QString getlibDescription(const QString Name); |
|
73 | static QString getlibDescription(const QString Name); | |
74 | static QString getlibDir(const QString Name); |
|
74 | static QString getlibDir(const QString Name); | |
75 | static QString findlib(QString name); |
|
75 | static QString findlib(QString name); | |
76 | static QList<PluginsCacheItem *> listAvailiables(bool rescan=true); |
|
76 | static QList<PluginsCacheItem *> listAvailiables(bool rescan=true); | |
77 | static void scanFolders(); |
|
77 | static void scanFolders(); | |
78 | static void showCache(){_cache->show();} |
|
78 | static void showCache(){_cache->show();} | |
79 | private: |
|
79 | private: | |
80 | int p_checklibraryQlib(const QString fileName); |
|
80 | int p_checklibraryQlib(const QString fileName); | |
81 | int p_checklibraryCustom(const QString fileName); |
|
81 | int p_checklibraryCustom(const QString fileName); | |
82 | socexplorerplugin* p_newsocexplorerpluginQlib(const QString Name); |
|
82 | socexplorerplugin* p_newsocexplorerpluginQlib(const QString Name); | |
83 | socexplorerplugin* p_newsocexplorerpluginCustom(const QString Name); |
|
83 | socexplorerplugin* p_newsocexplorerpluginCustom(const QString Name); | |
84 | static QStringList readFoldersList(const QStringList confFiles); |
|
84 | static QStringList readFoldersList(const QStringList confFiles); | |
85 | static QString* _cacheLookup(const QString Name); |
|
85 | static QString* _cacheLookup(const QString Name); | |
86 | static QString _getlibName(const QString fileName); |
|
86 | static QString _getlibName(const QString fileName); | |
87 | static int _getlibPID(const QString fileName); |
|
87 | static int _getlibPID(const QString fileName); | |
88 | static int _getlibVID(const QString fileName); |
|
88 | static int _getlibVID(const QString fileName); | |
89 | }; |
|
89 | }; | |
90 | #endif |
|
90 | #endif |
@@ -1,73 +1,73 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 | #ifndef PLUGINSCACHE_H |
|
22 | #ifndef PLUGINSCACHE_H | |
23 | #define PLUGINSCACHE_H |
|
23 | #define PLUGINSCACHE_H | |
24 |
|
24 | |||
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 | #include <QString> |
|
26 | #include <QString> | |
27 | #include <QList> |
|
27 | #include <QList> | |
28 | //#include <QtXml> |
|
28 | //#include <QtXml> | |
29 | #include <QTableWidget> |
|
29 | #include <QTableWidget> | |
30 |
|
30 | |||
31 | class PluginsCacheItem |
|
31 | class PluginsCacheItem | |
32 | { |
|
32 | { | |
33 | public: |
|
33 | public: | |
34 | PluginsCacheItem(const QString& fileName,const QString& path,const QString& pluginName,int VID,int PID); |
|
34 | PluginsCacheItem(const QString& fileName,const QString& path,const QString& pluginName,int VID,int PID); | |
35 | ~PluginsCacheItem(){delete fileName;delete path;delete pluginName;} |
|
35 | ~PluginsCacheItem(){delete fileName;delete path;delete pluginName;} | |
36 | bool compare(PluginsCacheItem* item); |
|
36 | bool compare(PluginsCacheItem* item); | |
37 | bool comparePluginName(const QString& pluginName); |
|
37 | bool comparePluginName(const QString& pluginName); | |
38 | bool comparefileName(const QString& fileName); |
|
38 | bool comparefileName(const QString& fileName); | |
39 | bool comparefilePath(const QString& filePath); |
|
39 | bool comparefilePath(const QString& filePath); | |
40 | bool compareIDs(int VID,int PID); |
|
40 | bool compareIDs(int VID,int PID); | |
41 | QString getpath(){return QString(*path);} |
|
41 | QString getpath(){return QString(*path);} | |
42 | QString getfileName(){return QString(*fileName);} |
|
42 | QString getfileName(){return QString(*fileName);} | |
43 | QString getpluginName(){return QString(*pluginName);} |
|
43 | QString getpluginName(){return QString(*pluginName);} | |
44 | int getVID(){return this->VID;} |
|
44 | int getVID(){return this->VID;} | |
45 | int getPID(){return this->PID;} |
|
45 | int getPID(){return this->PID;} | |
46 | private: |
|
46 | private: | |
47 | QString* fileName; |
|
47 | QString* fileName; | |
48 | QString* path; |
|
48 | QString* path; | |
49 | QString* pluginName; |
|
49 | QString* pluginName; | |
50 | int VID; |
|
50 | int VID; | |
51 | int PID; |
|
51 | int PID; | |
52 | }; |
|
52 | }; | |
53 |
|
53 | |||
54 | class PluginsCache : public QObject |
|
54 | class PluginsCache : public QObject | |
55 | { |
|
55 | { | |
56 | Q_OBJECT |
|
56 | Q_OBJECT | |
57 | public: |
|
57 | public: | |
58 | explicit PluginsCache(QObject *parent = 0); |
|
58 | explicit PluginsCache(QObject *parent = 0); | |
59 | void append(const QString& fileName,const QString& path,const QString& pluginName,int VID,int PID); |
|
59 | void append(const QString& fileName,const QString& path,const QString& pluginName,int VID,int PID); | |
60 | QString first(const QString& pluginName); |
|
60 | QString first(const QString& pluginName); | |
61 | QString first(int VID,int PID); |
|
61 | QString first(int VID,int PID); | |
62 | QStringList findDriver(int VID,int PID); |
|
62 | QStringList findDriver(int VID,int PID); | |
63 | QList<PluginsCacheItem*> listDrivers(); |
|
63 | QList<PluginsCacheItem*> listDrivers(); | |
64 | void flush(); |
|
64 | void flush(); | |
65 | public slots: |
|
65 | public slots: | |
66 | void show(); |
|
66 | void show(); | |
67 | private: |
|
67 | private: | |
68 | QList<PluginsCacheItem*>* items; |
|
68 | QList<PluginsCacheItem*>* items; | |
69 | QTableWidget* __view; |
|
69 | QTableWidget* __view; | |
70 |
|
70 | |||
71 | }; |
|
71 | }; | |
72 |
|
72 | |||
73 | #endif // PLUGINSCACHE_H |
|
73 | #endif // PLUGINSCACHE_H |
@@ -1,58 +1,58 | |||||
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, |
|
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 | #ifndef GENERICPYSYSDRIVER_H |
|
22 | #ifndef GENERICPYSYSDRIVER_H | |
23 | #define GENERICPYSYSDRIVER_H |
|
23 | #define GENERICPYSYSDRIVER_H | |
24 | #include <QObject> |
|
24 | #include <QObject> | |
25 | #include <QVariant> |
|
25 | #include <QVariant> | |
26 | #include <QVariantList> |
|
26 | #include <QVariantList> | |
27 | #include <malloc.h> |
|
27 | #include <malloc.h> | |
28 | #include <QFile> |
|
28 | #include <QFile> | |
29 | #include <stdint.h> |
|
29 | #include <stdint.h> | |
30 | #include <QTextStream> |
|
30 | #include <QTextStream> | |
31 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
31 | #if defined(SOCEXPLORER_SDK_BUILD) | |
32 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
32 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT | |
33 | #else |
|
33 | #else | |
34 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
34 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT | |
35 | #endif |
|
35 | #endif | |
36 | class socexplorerplugin; |
|
36 | class socexplorerplugin; | |
37 |
|
37 | |||
38 | class SOCEXPLORER_SDK_EXPORT genericPySysdriver : public QObject |
|
38 | class SOCEXPLORER_SDK_EXPORT genericPySysdriver : public QObject | |
39 | { |
|
39 | { | |
40 | Q_OBJECT |
|
40 | Q_OBJECT | |
41 |
|
41 | |||
42 | public: |
|
42 | public: | |
43 |
|
43 | |||
44 | explicit genericPySysdriver(socexplorerplugin* plugin,QObject* parent=0); |
|
44 | explicit genericPySysdriver(socexplorerplugin* plugin,QObject* parent=0); | |
45 | signals: |
|
45 | signals: | |
46 | public slots: |
|
46 | public slots: | |
47 | QVariantList Read(unsigned int address,unsigned int count); |
|
47 | QVariantList Read(unsigned int address,unsigned int count); | |
48 | void Write(unsigned int address,QList<QVariant> dataList); |
|
48 | void Write(unsigned int address,QList<QVariant> dataList); | |
49 | bool dumpMemory(unsigned int address,unsigned int count,QString file); |
|
49 | bool dumpMemory(unsigned int address,unsigned int count,QString file); | |
50 | bool memSet(unsigned int address,int value, unsigned int count); |
|
50 | bool memSet(unsigned int address,int value, unsigned int count); | |
51 | bool loadbin(unsigned int address,QString file); |
|
51 | bool loadbin(unsigned int address,QString file); | |
52 | QString instance(); |
|
52 | QString instance(); | |
53 | private: |
|
53 | private: | |
54 | socexplorerplugin* plugin; |
|
54 | socexplorerplugin* plugin; | |
55 |
|
55 | |||
56 | }; |
|
56 | }; | |
57 |
|
57 | |||
58 | #endif // GENERICPYSYSDRIVER_H |
|
58 | #endif // GENERICPYSYSDRIVER_H |
@@ -1,91 +1,91 | |||||
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) 2014, |
|
3 | -- Copyright (C) 2014, 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 |
|
22 | |||
23 | #include <socexplorerplugin.h> |
|
23 | #include <socexplorerplugin.h> | |
24 |
|
24 | |||
25 |
|
25 | |||
26 | int socexplorerplugin::isConnected(){return this->Connected;} |
|
26 | int socexplorerplugin::isConnected(){return this->Connected;} | |
27 |
|
27 | |||
28 | QString socexplorerplugin::baseName(){return *_Name;} |
|
28 | QString socexplorerplugin::baseName(){return *_Name;} | |
29 |
|
29 | |||
30 | int socexplorerplugin::baseAddress(){return this->BaseAddress;} |
|
30 | int socexplorerplugin::baseAddress(){return this->BaseAddress;} | |
31 |
|
31 | |||
32 | void socexplorerplugin::setBaseAddress(unsigned int baseAddress){this->BaseAddress = baseAddress;} |
|
32 | void socexplorerplugin::setBaseAddress(unsigned int baseAddress){this->BaseAddress = baseAddress;} | |
33 |
|
33 | |||
34 | QString socexplorerplugin::instanceName() |
|
34 | QString socexplorerplugin::instanceName() | |
35 | { |
|
35 | { | |
36 | return this->_instanceName; |
|
36 | return this->_instanceName; | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | int socexplorerplugin::registermenu(QMenu *menu) |
|
39 | int socexplorerplugin::registermenu(QMenu *menu) | |
40 | { |
|
40 | { | |
41 | this->menu = menu->addMenu(this->_instanceName); |
|
41 | this->menu = menu->addMenu(this->_instanceName); | |
42 | this->closeAction = this->menu->addAction(tr("Close plugin")); |
|
42 | this->closeAction = this->menu->addAction(tr("Close plugin")); | |
43 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); |
|
43 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); | |
44 | this->ChildsMenu = this->menu->addMenu(QString("Childs")); |
|
44 | this->ChildsMenu = this->menu->addMenu(QString("Childs")); | |
45 | for(int i=0;i<this->childs.count();i++) |
|
45 | for(int i=0;i<this->childs.count();i++) | |
46 | { |
|
46 | { | |
47 | this->childs.at(i)->registermenu(this->ChildsMenu); |
|
47 | this->childs.at(i)->registermenu(this->ChildsMenu); | |
48 | } |
|
48 | } | |
49 | if(this->pyObject!=NULL)emit this->registerObject((QObject*)this->pyObject,this->instanceName()); |
|
49 | if(this->pyObject!=NULL)emit this->registerObject((QObject*)this->pyObject,this->instanceName()); | |
50 | return 0; |
|
50 | return 0; | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 | void socexplorerplugin::postInstantiationTrigger() |
|
53 | void socexplorerplugin::postInstantiationTrigger() | |
54 | { |
|
54 | { | |
55 | return; |
|
55 | return; | |
56 | } |
|
56 | } | |
57 |
|
57 | |||
58 | unsigned int socexplorerplugin::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
58 | unsigned int socexplorerplugin::Write(unsigned int *Value, unsigned int count, unsigned int address) | |
59 | { |
|
59 | { | |
60 | if(parent!=NULL) |
|
60 | if(parent!=NULL) | |
61 | { |
|
61 | { | |
62 | return parent->Write(Value,count,address); |
|
62 | return parent->Write(Value,count,address); | |
63 | } |
|
63 | } | |
64 | return 0; |
|
64 | return 0; | |
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 | unsigned int socexplorerplugin::Read(unsigned int *Value, unsigned int count, unsigned int address) |
|
67 | unsigned int socexplorerplugin::Read(unsigned int *Value, unsigned int count, unsigned int address) | |
68 | { |
|
68 | { | |
69 | if(parent!=NULL) |
|
69 | if(parent!=NULL) | |
70 | { |
|
70 | { | |
71 | return parent->Read(Value,count,address); |
|
71 | return parent->Read(Value,count,address); | |
72 | } |
|
72 | } | |
73 | return 0; |
|
73 | return 0; | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | void socexplorerplugin::closeMe(){emit this->closePlugin(this);} |
|
76 | void socexplorerplugin::closeMe(){emit this->closePlugin(this);} | |
77 |
|
77 | |||
78 | void socexplorerplugin::activate(bool flag){this->setEnabled(flag);emit this->activateSig(flag);} |
|
78 | void socexplorerplugin::activate(bool flag){this->setEnabled(flag);emit this->activateSig(flag);} | |
79 |
|
79 | |||
80 | void socexplorerplugin::setInstanceName(const QString &newName) |
|
80 | void socexplorerplugin::setInstanceName(const QString &newName) | |
81 | { |
|
81 | { | |
82 | this->_instanceName = newName; |
|
82 | this->_instanceName = newName; | |
83 | if(this->menu) |
|
83 | if(this->menu) | |
84 | this->menu->setTitle(this->_instanceName); |
|
84 | this->menu->setTitle(this->_instanceName); | |
85 | this->setWindowTitle(newName); |
|
85 | this->setWindowTitle(newName); | |
86 | } |
|
86 | } | |
87 |
|
87 | |||
88 | void socexplorerplugin::makeGenericPyWrapper() |
|
88 | void socexplorerplugin::makeGenericPyWrapper() | |
89 | { |
|
89 | { | |
90 | this->pyObject = new genericPySysdriver(this); |
|
90 | this->pyObject = new genericPySysdriver(this); | |
91 | } |
|
91 | } |
@@ -1,180 +1,180 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | ███████╗ ██████╗ ██████╗ ███████╗██╗ ██╗██████╗ ██╗ ██████╗ ██████╗ ███████╗██████╗ |
|
2 | ███████╗ ██████╗ ██████╗ ███████╗██╗ ██╗██████╗ ██╗ ██████╗ ██████╗ ███████╗██████╗ | |
3 | ██╔════╝██╔═══██╗██╔════╝ ██╔════╝╚██╗██╔╝██╔══██╗██║ ██╔═══██╗██╔══██╗██╔════╝██╔══██╗ |
|
3 | ██╔════╝██╔═══██╗██╔════╝ ██╔════╝╚██╗██╔╝██╔══██╗██║ ██╔═══██╗██╔══██╗██╔════╝██╔══██╗ | |
4 | ███████╗██║ ██║██║ █████╗ ╚███╔╝ ██████╔╝██║ ██║ ██║██████╔╝█████╗ ██████╔╝ |
|
4 | ███████╗██║ ██║██║ █████╗ ╚███╔╝ ██████╔╝██║ ██║ ██║██████╔╝█████╗ ██████╔╝ | |
5 | ╚════██║██║ ██║██║ ██╔══╝ ██╔██╗ ██╔═══╝ ██║ ██║ ██║██╔══██╗██╔══╝ ██╔══██╗ |
|
5 | ╚════██║██║ ██║██║ ██╔══╝ ██╔██╗ ██╔═══╝ ██║ ██║ ██║██╔══██╗██╔══╝ ██╔══██╗ | |
6 | ███████║╚██████╔╝╚██████╗ ███████╗██╔╝ ██╗██║ ███████╗╚██████╔╝██║ ██║███████╗██║ ██║ |
|
6 | ███████║╚██████╔╝╚██████╗ ███████╗██╔╝ ██╗██║ ███████╗╚██████╔╝██║ ██║███████╗██║ ██║ | |
7 | ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ |
|
7 | ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ | |
8 |
|
8 | |||
9 | -- This file is a part of the SOC Explorer Software |
|
9 | -- This file is a part of the SOC Explorer Software | |
10 |
-- Copyright (C) 2011, |
|
10 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS | |
11 | -- |
|
11 | -- | |
12 | -- This program is free software; you can redistribute it and/or modify |
|
12 | -- This program is free software; you can redistribute it and/or modify | |
13 | -- it under the terms of the GNU General Public License as published by |
|
13 | -- it under the terms of the GNU General Public License as published by | |
14 | -- the Free Software Foundation; either version 2 of the License, or |
|
14 | -- the Free Software Foundation; either version 2 of the License, or | |
15 | -- (at your option) any later version. |
|
15 | -- (at your option) any later version. | |
16 | -- |
|
16 | -- | |
17 | -- This program is distributed in the hope that it will be useful, |
|
17 | -- This program is distributed in the hope that it will be useful, | |
18 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | -- GNU General Public License for more details. |
|
20 | -- GNU General Public License for more details. | |
21 | -- |
|
21 | -- | |
22 | -- You should have received a copy of the GNU General Public License |
|
22 | -- You should have received a copy of the GNU General Public License | |
23 | -- along with this program; if not, write to the Free Software |
|
23 | -- along with this program; if not, write to the Free Software | |
24 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
24 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 | -------------------------------------------------------------------------------*/ |
|
25 | -------------------------------------------------------------------------------*/ | |
26 | /*-- Author : Alexis Jeandet |
|
26 | /*-- Author : Alexis Jeandet | |
27 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
27 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |
28 | ----------------------------------------------------------------------------*/ |
|
28 | ----------------------------------------------------------------------------*/ | |
29 | #ifndef SOCEXPLORERPLUGIN_H |
|
29 | #ifndef SOCEXPLORERPLUGIN_H | |
30 | #define SOCEXPLORERPLUGIN_H |
|
30 | #define SOCEXPLORERPLUGIN_H | |
31 | #include <QWidget> |
|
31 | #include <QWidget> | |
32 | #include <QAction> |
|
32 | #include <QAction> | |
33 | #include <QDockWidget> |
|
33 | #include <QDockWidget> | |
34 | #include <QMainWindow> |
|
34 | #include <QMainWindow> | |
35 | #include <QList> |
|
35 | #include <QList> | |
36 | #include <QMenu> |
|
36 | #include <QMenu> | |
37 | #include <socexplorer.h> |
|
37 | #include <socexplorer.h> | |
38 | #include <QObject> |
|
38 | #include <QObject> | |
39 | #include <QVariant> |
|
39 | #include <QVariant> | |
40 | #include <QVariantList> |
|
40 | #include <QVariantList> | |
41 | #include <malloc.h> |
|
41 | #include <malloc.h> | |
42 | #include <QFile> |
|
42 | #include <QFile> | |
43 | #include <stdint.h> |
|
43 | #include <stdint.h> | |
44 | #include <QTextStream> |
|
44 | #include <QTextStream> | |
45 | #include <genericPySysdriver.h> |
|
45 | #include <genericPySysdriver.h> | |
46 | #ifndef driver_Name |
|
46 | #ifndef driver_Name | |
47 | #define driver_Name "Plugin" |
|
47 | #define driver_Name "Plugin" | |
48 | #endif |
|
48 | #endif | |
49 | #ifndef driver_Author |
|
49 | #ifndef driver_Author | |
50 | #define driver_Author "No Author" |
|
50 | #define driver_Author "No Author" | |
51 | #endif |
|
51 | #endif | |
52 | #ifndef driver_Version |
|
52 | #ifndef driver_Version | |
53 | #define driver_Version "0.0.0" |
|
53 | #define driver_Version "0.0.0" | |
54 | #endif |
|
54 | #endif | |
55 | #ifndef driver_Description |
|
55 | #ifndef driver_Description | |
56 | #define driver_Description "No description." |
|
56 | #define driver_Description "No description." | |
57 | #endif |
|
57 | #endif | |
58 | #ifndef driver_can_be_root |
|
58 | #ifndef driver_can_be_root | |
59 | #define driver_can_be_root 0 |
|
59 | #define driver_can_be_root 0 | |
60 | #endif |
|
60 | #endif | |
61 | #ifndef driver_can_be_child |
|
61 | #ifndef driver_can_be_child | |
62 | #define driver_can_be_child 0 |
|
62 | #define driver_can_be_child 0 | |
63 | #endif |
|
63 | #endif | |
64 | #ifndef driver_VID |
|
64 | #ifndef driver_VID | |
65 | #define driver_VID 0 |
|
65 | #define driver_VID 0 | |
66 | #endif |
|
66 | #endif | |
67 | #ifndef driver_PID |
|
67 | #ifndef driver_PID | |
68 | #define driver_PID 0 |
|
68 | #define driver_PID 0 | |
69 | #endif |
|
69 | #endif | |
70 |
|
70 | |||
71 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
71 | #if defined(SOCEXPLORER_SDK_BUILD) | |
72 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
72 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT | |
73 | #else |
|
73 | #else | |
74 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
74 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT | |
75 | #endif |
|
75 | #endif | |
76 |
|
76 | |||
77 | class genericPySysdriver; |
|
77 | class genericPySysdriver; | |
78 |
|
78 | |||
79 | //! socexplorerplugin is the base class for any SocExplorer plugin, it gives a standard interface to communicate |
|
79 | //! socexplorerplugin is the base class for any SocExplorer plugin, it gives a standard interface to communicate | |
80 | //! between each plugins and to interact with SocExplorer software. |
|
80 | //! between each plugins and to interact with SocExplorer software. | |
81 |
|
81 | |||
82 | class SOCEXPLORER_SDK_EXPORT socexplorerplugin : public QDockWidget |
|
82 | class SOCEXPLORER_SDK_EXPORT socexplorerplugin : public QDockWidget | |
83 | { |
|
83 | { | |
84 | Q_OBJECT |
|
84 | Q_OBJECT | |
85 | public: |
|
85 | public: | |
86 | //! Default plugin constructor, any plugin should call this constructor. This constructor creates a |
|
86 | //! Default plugin constructor, any plugin should call this constructor. This constructor creates a | |
87 | //! default python wrapper instance. If you want to connect your own python wrapper, you have to clear |
|
87 | //! default python wrapper instance. If you want to connect your own python wrapper, you have to clear | |
88 | //! createPyObject option and instanciate your own genericPySysdriver derivated object. |
|
88 | //! createPyObject option and instanciate your own genericPySysdriver derivated object. | |
89 | socexplorerplugin(QWidget *parent = 0,bool createPyObject=true):QDockWidget(parent) |
|
89 | socexplorerplugin(QWidget *parent = 0,bool createPyObject=true):QDockWidget(parent) | |
90 | { |
|
90 | { | |
91 | closeAction=NULL; |
|
91 | closeAction=NULL; | |
92 | menu=NULL; |
|
92 | menu=NULL; | |
93 | ChildsMenu=NULL; |
|
93 | ChildsMenu=NULL; | |
94 | this->Connected = false; |
|
94 | this->Connected = false; | |
95 | this->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetVerticalTitleBar); |
|
95 | this->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetVerticalTitleBar); | |
96 | _Name = new QString(driver_Name); |
|
96 | _Name = new QString(driver_Name); | |
97 | _Author = new QString(driver_Author); |
|
97 | _Author = new QString(driver_Author); | |
98 | _Version = new QString(driver_Version); |
|
98 | _Version = new QString(driver_Version); | |
99 | _Description = new QString(driver_Description); |
|
99 | _Description = new QString(driver_Description); | |
100 | _canBeChild = driver_can_be_child; |
|
100 | _canBeChild = driver_can_be_child; | |
101 | _canBeRoot = driver_can_be_root; |
|
101 | _canBeRoot = driver_can_be_root; | |
102 | _VID = driver_VID; |
|
102 | _VID = driver_VID; | |
103 | _PID = driver_PID; |
|
103 | _PID = driver_PID; | |
104 | if(createPyObject) |
|
104 | if(createPyObject) | |
105 | { |
|
105 | { | |
106 | this->makeGenericPyWrapper(); |
|
106 | this->makeGenericPyWrapper(); | |
107 | } |
|
107 | } | |
108 | } |
|
108 | } | |
109 | //! Tells if the plugin is connected, it is used to enable or disable all childrens interfaces. |
|
109 | //! Tells if the plugin is connected, it is used to enable or disable all childrens interfaces. | |
110 | virtual int isConnected(); |
|
110 | virtual int isConnected(); | |
111 | //! Gives the associated Vendor IDentifier, usefull to automatically associate plugins with found |
|
111 | //! Gives the associated Vendor IDentifier, usefull to automatically associate plugins with found | |
112 | //! hardware while board enumeration. |
|
112 | //! hardware while board enumeration. | |
113 | virtual int VID(){return _PID;} |
|
113 | virtual int VID(){return _PID;} | |
114 | //! Gives the associated Product IDentifier, usefull to automatically associate plugins with found |
|
114 | //! Gives the associated Product IDentifier, usefull to automatically associate plugins with found | |
115 | //! hardware while board enumeration. |
|
115 | //! hardware while board enumeration. | |
116 | virtual int PID(){return _VID;} |
|
116 | virtual int PID(){return _VID;} | |
117 | //! Gives the plugin's base name, usefull to automatically generate instance name. |
|
117 | //! Gives the plugin's base name, usefull to automatically generate instance name. | |
118 | virtual QString baseName(); |
|
118 | virtual QString baseName(); | |
119 | //! Gives the base address of the current instance, for example if your plugin is supposed to drive |
|
119 | //! Gives the base address of the current instance, for example if your plugin is supposed to drive | |
120 | //! an UART it will correspond to the address of it's first register. This address have at least to |
|
120 | //! an UART it will correspond to the address of it's first register. This address have at least to | |
121 | //! be set by SocExplorer and it can be user accessible if you want. |
|
121 | //! be set by SocExplorer and it can be user accessible if you want. | |
122 | virtual int baseAddress(); |
|
122 | virtual int baseAddress(); | |
123 | //! Sets the base address of the current instance, for example if your plugin is supposed to drive |
|
123 | //! Sets the base address of the current instance, for example if your plugin is supposed to drive | |
124 | //! an UART it will correspond to the address of it's first register. This address have at least to |
|
124 | //! an UART it will correspond to the address of it's first register. This address have at least to | |
125 | //! be set by lppSocExplorer and it can be user accessible if you want. |
|
125 | //! be set by lppSocExplorer and it can be user accessible if you want. | |
126 | virtual void setBaseAddress(unsigned int baseAddress); |
|
126 | virtual void setBaseAddress(unsigned int baseAddress); | |
127 |
|
127 | |||
128 | genericPySysdriver* getPyObjectWrapper(){return this->pyObject;} |
|
128 | genericPySysdriver* getPyObjectWrapper(){return this->pyObject;} | |
129 | QList<socexplorerplugin*> childs; |
|
129 | QList<socexplorerplugin*> childs; | |
130 | socexplorerplugin* parent; |
|
130 | socexplorerplugin* parent; | |
131 | QAction* closeAction; |
|
131 | QAction* closeAction; | |
132 | QString instanceName(); |
|
132 | QString instanceName(); | |
133 | QMenu* menu; |
|
133 | QMenu* menu; | |
134 | QMenu* ChildsMenu; |
|
134 | QMenu* ChildsMenu; | |
135 |
|
135 | |||
136 | signals: |
|
136 | signals: | |
137 | //! Signal emited each time the plugin is about to be closed. |
|
137 | //! Signal emited each time the plugin is about to be closed. | |
138 | void closePlugin(socexplorerplugin* driver); |
|
138 | void closePlugin(socexplorerplugin* driver); | |
139 | void activateSig(bool flag); |
|
139 | void activateSig(bool flag); | |
140 | void registerObject(QObject* object,const QString& instanceName); |
|
140 | void registerObject(QObject* object,const QString& instanceName); | |
141 |
|
141 | |||
142 | public slots: |
|
142 | public slots: | |
143 | virtual int registermenu(QMenu* menu); |
|
143 | virtual int registermenu(QMenu* menu); | |
144 | virtual void postInstantiationTrigger(); |
|
144 | virtual void postInstantiationTrigger(); | |
145 | //! Write slot this is the way your children plugins ask you for writing data. |
|
145 | //! Write slot this is the way your children plugins ask you for writing data. | |
146 | //! If your plugin is supposed to have childern drivers you should implement this methode. |
|
146 | //! If your plugin is supposed to have childern drivers you should implement this methode. | |
147 | //! By default this methode forward the write request to the parent plugin. |
|
147 | //! By default this methode forward the write request to the parent plugin. | |
148 | //! \param Value Pointer the data buffer. |
|
148 | //! \param Value Pointer the data buffer. | |
149 | //! \param count Number of 32 bits words you should to write. |
|
149 | //! \param count Number of 32 bits words you should to write. | |
150 | //! \param address Address from where you should to start to write. |
|
150 | //! \param address Address from where you should to start to write. | |
151 | //! \return Quantity of 32 bits words writtens. |
|
151 | //! \return Quantity of 32 bits words writtens. | |
152 | virtual unsigned int Write(unsigned int* Value, unsigned int count,unsigned int address); |
|
152 | virtual unsigned int Write(unsigned int* Value, unsigned int count,unsigned int address); | |
153 | //! Read slot this is the way your children plugins ask you for reading data. |
|
153 | //! Read slot this is the way your children plugins ask you for reading data. | |
154 | //! If your plugin is supposed to have childern drivers you should implement this methode. |
|
154 | //! If your plugin is supposed to have childern drivers you should implement this methode. | |
155 | //! By default this methode forward the write request to the parent plugin. |
|
155 | //! By default this methode forward the write request to the parent plugin. | |
156 | //! \param Value Pointer the data buffer. |
|
156 | //! \param Value Pointer the data buffer. | |
157 | //! \param count Number of 32 bits words you should to read. |
|
157 | //! \param count Number of 32 bits words you should to read. | |
158 | //! \param address Address from where you should to start to read. |
|
158 | //! \param address Address from where you should to start to read. | |
159 | //! \return Quantity of 32 bits words read. |
|
159 | //! \return Quantity of 32 bits words read. | |
160 | virtual unsigned int Read(unsigned int* Value, unsigned int count,unsigned int address); |
|
160 | virtual unsigned int Read(unsigned int* Value, unsigned int count,unsigned int address); | |
161 | virtual void closeMe(); |
|
161 | virtual void closeMe(); | |
162 | virtual void activate(bool flag); |
|
162 | virtual void activate(bool flag); | |
163 | virtual void setInstanceName(const QString& newName); |
|
163 | virtual void setInstanceName(const QString& newName); | |
164 | protected: |
|
164 | protected: | |
165 | void makeGenericPyWrapper(); |
|
165 | void makeGenericPyWrapper(); | |
166 | int BaseAddress; |
|
166 | int BaseAddress; | |
167 | bool Connected; |
|
167 | bool Connected; | |
168 | genericPySysdriver* pyObject; |
|
168 | genericPySysdriver* pyObject; | |
169 | QString* _Name; |
|
169 | QString* _Name; | |
170 | QString* _Author; |
|
170 | QString* _Author; | |
171 | QString* _Version; |
|
171 | QString* _Version; | |
172 | QString* _Description; |
|
172 | QString* _Description; | |
173 | QString _instanceName; |
|
173 | QString _instanceName; | |
174 | int _canBeChild; |
|
174 | int _canBeChild; | |
175 | int _canBeRoot; |
|
175 | int _canBeRoot; | |
176 | int _VID; |
|
176 | int _VID; | |
177 | int _PID; |
|
177 | int _PID; | |
178 | }; |
|
178 | }; | |
179 |
|
179 | |||
180 | #endif // SOCEXPLORERPLUGIN_H |
|
180 | #endif // SOCEXPLORERPLUGIN_H |
@@ -1,74 +1,74 | |||||
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, |
|
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 "socexplorerplugininterface.h" |
|
22 | #include "socexplorerplugininterface.h" | |
23 | #include <QString> |
|
23 | #include <QString> | |
24 | #ifdef PLUGINHEADER |
|
24 | #ifdef PLUGINHEADER | |
25 | #include PLUGINHEADER |
|
25 | #include PLUGINHEADER | |
26 | #else |
|
26 | #else | |
27 | #include <plugindefs.h> |
|
27 | #include <plugindefs.h> | |
28 | #endif |
|
28 | #endif | |
29 |
|
29 | |||
30 | void* socexplorerpluginCreateObject() |
|
30 | void* socexplorerpluginCreateObject() | |
31 | { |
|
31 | { | |
32 | return (void*) new PLUGIN(); |
|
32 | return (void*) new PLUGIN(); | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | int socexplorerplugincanberoot() |
|
35 | int socexplorerplugincanberoot() | |
36 | { |
|
36 | { | |
37 | return driver_can_be_root; |
|
37 | return driver_can_be_root; | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | int socexplorerplugincanbechild() |
|
40 | int socexplorerplugincanbechild() | |
41 | { |
|
41 | { | |
42 | return driver_can_be_child; |
|
42 | return driver_can_be_child; | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | int socexplorerpluginpid() |
|
45 | int socexplorerpluginpid() | |
46 | { |
|
46 | { | |
47 | return driver_PID; |
|
47 | return driver_PID; | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | int socexplorerpluginvid() |
|
50 | int socexplorerpluginvid() | |
51 | { |
|
51 | { | |
52 | return driver_VID; |
|
52 | return driver_VID; | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | pluginT socexplorerpluginType() |
|
55 | pluginT socexplorerpluginType() | |
56 | { |
|
56 | { | |
57 | return PerifDriverT; |
|
57 | return PerifDriverT; | |
58 | } |
|
58 | } | |
59 | QString socexplorerpluginName() |
|
59 | QString socexplorerpluginName() | |
60 | { |
|
60 | { | |
61 | return QString(driver_Name); |
|
61 | return QString(driver_Name); | |
62 | } |
|
62 | } | |
63 | QString socexplorerpluginVersion() |
|
63 | QString socexplorerpluginVersion() | |
64 | { |
|
64 | { | |
65 | return QString(driver_Version); |
|
65 | return QString(driver_Version); | |
66 | } |
|
66 | } | |
67 | QString socexplorerpluginAuthor() |
|
67 | QString socexplorerpluginAuthor() | |
68 | { |
|
68 | { | |
69 | return QString(driver_Author); |
|
69 | return QString(driver_Author); | |
70 | } |
|
70 | } | |
71 | QString socexplorerpluginDescription() |
|
71 | QString socexplorerpluginDescription() | |
72 | { |
|
72 | { | |
73 | return QString(driver_Description); |
|
73 | return QString(driver_Description); | |
74 | } |
|
74 | } |
@@ -1,74 +1,74 | |||||
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, |
|
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 | #ifndef SOCEXPLORERPLUGININTERFACE_H |
|
22 | #ifndef SOCEXPLORERPLUGININTERFACE_H | |
23 | #define SOCEXPLORERPLUGININTERFACE_H |
|
23 | #define SOCEXPLORERPLUGININTERFACE_H | |
24 |
|
24 | |||
25 | #include "socexplorerplugininterface_global.h" |
|
25 | #include "socexplorerplugininterface_global.h" | |
26 | #include <QString> |
|
26 | #include <QString> | |
27 | #include <QtGlobal> |
|
27 | #include <QtGlobal> | |
28 |
|
28 | |||
29 | #define ComDriverT 1 |
|
29 | #define ComDriverT 1 | |
30 | #define PerifDriverT 2 |
|
30 | #define PerifDriverT 2 | |
31 | typedef int pluginT; |
|
31 | typedef int pluginT; | |
32 |
|
32 | |||
33 | typedef void* (*socexplorerpluginCreateObjectT)(); |
|
33 | typedef void* (*socexplorerpluginCreateObjectT)(); | |
34 | typedef pluginT (*socexplorerpluginTypeT)(); |
|
34 | typedef pluginT (*socexplorerpluginTypeT)(); | |
35 | typedef int (*socexplorerpluginpidT)(); |
|
35 | typedef int (*socexplorerpluginpidT)(); | |
36 | typedef int (*socexplorerpluginvidT)(); |
|
36 | typedef int (*socexplorerpluginvidT)(); | |
37 | typedef int (*socexplorerplugincanberootT)(); |
|
37 | typedef int (*socexplorerplugincanberootT)(); | |
38 | typedef int (*socexplorerplugincanbechildT)(); |
|
38 | typedef int (*socexplorerplugincanbechildT)(); | |
39 | typedef QString (*socexplorerpluginNameT)(); |
|
39 | typedef QString (*socexplorerpluginNameT)(); | |
40 | typedef QString (*socexplorerpluginVersionT)(); |
|
40 | typedef QString (*socexplorerpluginVersionT)(); | |
41 | typedef QString (*socexplorerpluginAuthorT)(); |
|
41 | typedef QString (*socexplorerpluginAuthorT)(); | |
42 | typedef QString (*socexplorerpluginDescriptionT)(); |
|
42 | typedef QString (*socexplorerpluginDescriptionT)(); | |
43 |
|
43 | |||
44 | extern "C" |
|
44 | extern "C" | |
45 | { |
|
45 | { | |
46 | #ifndef QT_ENSURE_STACK_ALIGNED_FOR_SSE |
|
46 | #ifndef QT_ENSURE_STACK_ALIGNED_FOR_SSE | |
47 | #define QT_ENSURE_STACK_ALIGNED_FOR_SSE |
|
47 | #define QT_ENSURE_STACK_ALIGNED_FOR_SSE | |
48 | #endif |
|
48 | #endif | |
49 | //! \header This the C interface socexplorer uses to load dynamically any plugin, a C interface is the |
|
49 | //! \header This the C interface socexplorer uses to load dynamically any plugin, a C interface is the | |
50 | //! easyest way to manually resolve functions in a dynamic library. |
|
50 | //! easyest way to manually resolve functions in a dynamic library. | |
51 |
|
51 | |||
52 | //! \fn socexplorerpluginCreateObject Plugin constructor. |
|
52 | //! \fn socexplorerpluginCreateObject Plugin constructor. | |
53 | LIBSOCEXPLORERPLUGIN_EXPORT void* socexplorerpluginCreateObject()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
53 | LIBSOCEXPLORERPLUGIN_EXPORT void* socexplorerpluginCreateObject()QT_ENSURE_STACK_ALIGNED_FOR_SSE; | |
54 | //! \fn socexplorerpluginpid Plugin's PID. |
|
54 | //! \fn socexplorerpluginpid Plugin's PID. | |
55 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerpluginpid()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
55 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerpluginpid()QT_ENSURE_STACK_ALIGNED_FOR_SSE; | |
56 | //! \fn socexplorerpluginvid Plugin's VID. |
|
56 | //! \fn socexplorerpluginvid Plugin's VID. | |
57 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerpluginvid()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
57 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerpluginvid()QT_ENSURE_STACK_ALIGNED_FOR_SSE; | |
58 | //! \fn socexplorerplugincanberoot Tells if the plugin can be a root plugin. |
|
58 | //! \fn socexplorerplugincanberoot Tells if the plugin can be a root plugin. | |
59 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerplugincanberoot()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
59 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerplugincanberoot()QT_ENSURE_STACK_ALIGNED_FOR_SSE; | |
60 | //! \fn socexplorerplugincanberoot Tells if the plugin can be a child plugin. |
|
60 | //! \fn socexplorerplugincanberoot Tells if the plugin can be a child plugin. | |
61 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerplugincanbechild()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
61 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerplugincanbechild()QT_ENSURE_STACK_ALIGNED_FOR_SSE; | |
62 | //! \fn socexplorerpluginType Gives the plugin's type, not used yet. |
|
62 | //! \fn socexplorerpluginType Gives the plugin's type, not used yet. | |
63 | LIBSOCEXPLORERPLUGIN_EXPORT pluginT socexplorerpluginType()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
63 | LIBSOCEXPLORERPLUGIN_EXPORT pluginT socexplorerpluginType()QT_ENSURE_STACK_ALIGNED_FOR_SSE; | |
64 | //! \fn socexplorerpluginVersion Gives the plugin's version. |
|
64 | //! \fn socexplorerpluginVersion Gives the plugin's version. | |
65 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginVersion()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
65 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginVersion()QT_ENSURE_STACK_ALIGNED_FOR_SSE; | |
66 | //! \fn socexplorerpluginName Gives the plugin's name. |
|
66 | //! \fn socexplorerpluginName Gives the plugin's name. | |
67 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginName()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
67 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginName()QT_ENSURE_STACK_ALIGNED_FOR_SSE; | |
68 | //! \fn socexplorerpluginAuthor Gives the plugin's author. |
|
68 | //! \fn socexplorerpluginAuthor Gives the plugin's author. | |
69 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginAuthor()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
69 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginAuthor()QT_ENSURE_STACK_ALIGNED_FOR_SSE; | |
70 | //! \fn socexplorerpluginDescription Gives the plugin's description. |
|
70 | //! \fn socexplorerpluginDescription Gives the plugin's description. | |
71 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginDescription()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
71 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginDescription()QT_ENSURE_STACK_ALIGNED_FOR_SSE; | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | #endif // SOCEXPLORERPLUGININTERFACE_H |
|
74 | #endif // SOCEXPLORERPLUGININTERFACE_H |
@@ -1,33 +1,33 | |||||
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, |
|
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 | #ifndef SOCEXPLORERPLUGIN_GLOBAL_H |
|
22 | #ifndef SOCEXPLORERPLUGIN_GLOBAL_H | |
23 | #define SOCEXPLORERPLUGIN_GLOBAL_H |
|
23 | #define SOCEXPLORERPLUGIN_GLOBAL_H | |
24 |
|
24 | |||
25 | #include <QtCore/qglobal.h> |
|
25 | #include <QtCore/qglobal.h> | |
26 |
|
26 | |||
27 | #if defined(SOCEXPLORERPLUGIN_LIBRARY) |
|
27 | #if defined(SOCEXPLORERPLUGIN_LIBRARY) | |
28 | # define LIBSOCEXPLORERPLUGIN_EXPORT Q_DECL_EXPORT |
|
28 | # define LIBSOCEXPLORERPLUGIN_EXPORT Q_DECL_EXPORT | |
29 | #else |
|
29 | #else | |
30 | # define LIBSOCEXPLORERPLUGIN_EXPORT Q_DECL_IMPORT |
|
30 | # define LIBSOCEXPLORERPLUGIN_EXPORT Q_DECL_IMPORT | |
31 | #endif |
|
31 | #endif | |
32 |
|
32 | |||
33 | #endif // SOCEXPLORERPLUGIN_GLOBAL_H |
|
33 | #endif // SOCEXPLORERPLUGIN_GLOBAL_H |
@@ -1,380 +1,380 | |||||
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, |
|
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 "socexplorerproxy.h" |
|
22 | #include "socexplorerproxy.h" | |
23 | #include <pluginmanagerWDGT.h> |
|
23 | #include <pluginmanagerWDGT.h> | |
24 | #include <socexplorerengine.h> |
|
24 | #include <socexplorerengine.h> | |
25 | #include <pluginloader.h> |
|
25 | #include <pluginloader.h> | |
26 | #include <socexplorerplugin.h> |
|
26 | #include <socexplorerplugin.h> | |
27 |
|
27 | |||
28 | socexplorerproxy* socexplorerproxy::_self=NULL; |
|
28 | socexplorerproxy* socexplorerproxy::_self=NULL; | |
29 | QMainWindow* socexplorerproxy::mainWindow=NULL; |
|
29 | QMainWindow* socexplorerproxy::mainWindow=NULL; | |
30 | QList<socexplorerplugin*>* socexplorerproxy::drivers=NULL; |
|
30 | QList<socexplorerplugin*>* socexplorerproxy::drivers=NULL; | |
31 | QList<socexplorerplugin*>* socexplorerproxy::linearDriverList=NULL; |
|
31 | QList<socexplorerplugin*>* socexplorerproxy::linearDriverList=NULL; | |
32 | socexplorerplugin* socexplorerproxy::root=NULL; |
|
32 | socexplorerplugin* socexplorerproxy::root=NULL; | |
33 | socexplorerplugin* socexplorerproxy::parent=NULL; |
|
33 | socexplorerplugin* socexplorerproxy::parent=NULL; | |
34 | PluginsCache* socexplorerproxy::cache=NULL; |
|
34 | PluginsCache* socexplorerproxy::cache=NULL; | |
35 |
|
35 | |||
36 | socexplorerproxy::socexplorerproxy(QObject *parent) : |
|
36 | socexplorerproxy::socexplorerproxy(QObject *parent) : | |
37 | QObject(parent) |
|
37 | QObject(parent) | |
38 | { |
|
38 | { | |
39 | cache = new PluginsCache; |
|
39 | cache = new PluginsCache; | |
40 | drivers = new QList<socexplorerplugin*>; |
|
40 | drivers = new QList<socexplorerplugin*>; | |
41 | linearDriverList=new QList<socexplorerplugin*>; |
|
41 | linearDriverList=new QList<socexplorerplugin*>; | |
42 | root = NULL; |
|
42 | root = NULL; | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 |
|
45 | |||
46 | socexplorerproxy::socexplorerproxy(QMainWindow *Mainwindow, QObject *parent): |
|
46 | socexplorerproxy::socexplorerproxy(QMainWindow *Mainwindow, QObject *parent): | |
47 | QObject(parent) |
|
47 | QObject(parent) | |
48 | { |
|
48 | { | |
49 | mainWindow = Mainwindow; |
|
49 | mainWindow = Mainwindow; | |
50 | cache = new PluginsCache; |
|
50 | cache = new PluginsCache; | |
51 | drivers = new QList<socexplorerplugin*>; |
|
51 | drivers = new QList<socexplorerplugin*>; | |
52 | linearDriverList=new QList<socexplorerplugin*>; |
|
52 | linearDriverList=new QList<socexplorerplugin*>; | |
53 | root = NULL; |
|
53 | root = NULL; | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 |
|
56 | |||
57 | void socexplorerproxy::init() |
|
57 | void socexplorerproxy::init() | |
58 | { |
|
58 | { | |
59 | if(!_self) |
|
59 | if(!_self) | |
60 | { |
|
60 | { | |
61 | _self = new socexplorerproxy(); |
|
61 | _self = new socexplorerproxy(); | |
62 | mainWindow = NULL; |
|
62 | mainWindow = NULL; | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 | void socexplorerproxy::setMainWindow(QMainWindow *Mainwindow) |
|
67 | void socexplorerproxy::setMainWindow(QMainWindow *Mainwindow) | |
68 | { |
|
68 | { | |
69 | if(!_self)init(); |
|
69 | if(!_self)init(); | |
70 | mainWindow=Mainwindow; |
|
70 | mainWindow=Mainwindow; | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | void socexplorerproxy::loadSysDriver(const QString name) |
|
73 | void socexplorerproxy::loadSysDriver(const QString name) | |
74 | { |
|
74 | { | |
75 | if(!_self)init(); |
|
75 | if(!_self)init(); | |
76 | if(pluginloader::libcanberoot(name)) |
|
76 | if(pluginloader::libcanberoot(name)) | |
77 | { |
|
77 | { | |
78 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); |
|
78 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); | |
79 | QString driverName = _self->getinstanceName(driver->baseName()); |
|
79 | QString driverName = _self->getinstanceName(driver->baseName()); | |
80 | loadSysDriver(driver,driverName); |
|
80 | loadSysDriver(driver,driverName); | |
81 | } |
|
81 | } | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | void socexplorerproxy::loadSysDriver(const QString name, const QString instanceName) |
|
84 | void socexplorerproxy::loadSysDriver(const QString name, const QString instanceName) | |
85 | { |
|
85 | { | |
86 | if(!_self)init(); |
|
86 | if(!_self)init(); | |
87 | if(pluginloader::libcanberoot(name) && !_self->instanceExists(instanceName)) |
|
87 | if(pluginloader::libcanberoot(name) && !_self->instanceExists(instanceName)) | |
88 | { |
|
88 | { | |
89 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); |
|
89 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); | |
90 | loadSysDriver(driver,instanceName); |
|
90 | loadSysDriver(driver,instanceName); | |
91 | } |
|
91 | } | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 |
|
94 | |||
95 | void socexplorerproxy::loadSysDriver(socexplorerplugin *driver, const QString instanceName) |
|
95 | void socexplorerproxy::loadSysDriver(socexplorerplugin *driver, const QString instanceName) | |
96 | { |
|
96 | { | |
97 | if(!_self)init(); |
|
97 | if(!_self)init(); | |
98 | driver->setInstanceName(instanceName); |
|
98 | driver->setInstanceName(instanceName); | |
99 | driver->parent = NULL; |
|
99 | driver->parent = NULL; | |
100 | drivers->append(driver); |
|
100 | drivers->append(driver); | |
101 | linearDriverList->append(driver); |
|
101 | linearDriverList->append(driver); | |
102 | connectChildToProxy(driver); |
|
102 | connectChildToProxy(driver); | |
103 | emit _self->addPluginGUI(driver); |
|
103 | emit _self->addPluginGUI(driver); | |
104 | emit _self->clearMenu(); |
|
104 | emit _self->clearMenu(); | |
105 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
105 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); | |
106 | SocExplorerEngine::addSOC(driver); |
|
106 | SocExplorerEngine::addSOC(driver); | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | void socexplorerproxy::loadChildSysDriver(socexplorerplugin *parent, const QString child) |
|
109 | void socexplorerproxy::loadChildSysDriver(socexplorerplugin *parent, const QString child) | |
110 | { |
|
110 | { | |
111 | if(!_self)init(); |
|
111 | if(!_self)init(); | |
112 | if(pluginloader::libcanbechild(child)) |
|
112 | if(pluginloader::libcanbechild(child)) | |
113 | { |
|
113 | { | |
114 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(child); |
|
114 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(child); | |
115 | QString driverName = _self->getinstanceName(driver->baseName()); |
|
115 | QString driverName = _self->getinstanceName(driver->baseName()); | |
116 | bool ok=true; |
|
116 | bool ok=true; | |
117 | if(ok) |
|
117 | if(ok) | |
118 | { |
|
118 | { | |
119 | if(parent!=NULL)_self->loadSysDriverToParent(driver,parent,driverName); |
|
119 | if(parent!=NULL)_self->loadSysDriverToParent(driver,parent,driverName); | |
120 | } |
|
120 | } | |
121 | } |
|
121 | } | |
122 | } |
|
122 | } | |
123 |
|
123 | |||
124 | void socexplorerproxy::loadSysDriverToParent(const QString name,const QString ParentInst) |
|
124 | void socexplorerproxy::loadSysDriverToParent(const QString name,const QString ParentInst) | |
125 | { |
|
125 | { | |
126 | if(!_self)init(); |
|
126 | if(!_self)init(); | |
127 | if(pluginloader::libcanbechild(name)) |
|
127 | if(pluginloader::libcanbechild(name)) | |
128 | { |
|
128 | { | |
129 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); |
|
129 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); | |
130 | QString driverName = _self->getinstanceName(driver->baseName()); |
|
130 | QString driverName = _self->getinstanceName(driver->baseName()); | |
131 | bool ok=true; |
|
131 | bool ok=true; | |
132 | if(ok) |
|
132 | if(ok) | |
133 | { |
|
133 | { | |
134 | socexplorerplugin* parent=_self->getSysDriver(ParentInst); |
|
134 | socexplorerplugin* parent=_self->getSysDriver(ParentInst); | |
135 | if(parent!=NULL)loadSysDriverToParent(driver,parent,driverName); |
|
135 | if(parent!=NULL)loadSysDriverToParent(driver,parent,driverName); | |
136 | } |
|
136 | } | |
137 | } |
|
137 | } | |
138 | } |
|
138 | } | |
139 |
|
139 | |||
140 |
|
140 | |||
141 | void socexplorerproxy::loadSysDriverToParent(const QString name,const QString instanceName,const QString ParentInst) |
|
141 | void socexplorerproxy::loadSysDriverToParent(const QString name,const QString instanceName,const QString ParentInst) | |
142 | { |
|
142 | { | |
143 | if(!_self)init(); |
|
143 | if(!_self)init(); | |
144 | if(pluginloader::libcanbechild(name) && !_self->instanceExists(instanceName)) |
|
144 | if(pluginloader::libcanbechild(name) && !_self->instanceExists(instanceName)) | |
145 | { |
|
145 | { | |
146 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); |
|
146 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); | |
147 | bool ok=true; |
|
147 | bool ok=true; | |
148 | if(ok) |
|
148 | if(ok) | |
149 | { |
|
149 | { | |
150 | socexplorerplugin* parent=_self->getSysDriver(ParentInst); |
|
150 | socexplorerplugin* parent=_self->getSysDriver(ParentInst); | |
151 | if(parent!=NULL)loadSysDriverToParent(driver,parent,instanceName); |
|
151 | if(parent!=NULL)loadSysDriverToParent(driver,parent,instanceName); | |
152 | } |
|
152 | } | |
153 | } |
|
153 | } | |
154 | } |
|
154 | } | |
155 |
|
155 | |||
156 | void socexplorerproxy::loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName) |
|
156 | void socexplorerproxy::loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName) | |
157 | { |
|
157 | { | |
158 | if(!_self)init(); |
|
158 | if(!_self)init(); | |
159 | linearDriverList->append(driver); |
|
159 | linearDriverList->append(driver); | |
160 | driver->parent = parent; |
|
160 | driver->parent = parent; | |
161 | driver->setInstanceName(instanceName); |
|
161 | driver->setInstanceName(instanceName); | |
162 | parent->childs.append(driver); |
|
162 | parent->childs.append(driver); | |
163 | connectChildToProxy(driver); |
|
163 | connectChildToProxy(driver); | |
164 | connectChildToParent(parent,driver); |
|
164 | connectChildToParent(parent,driver); | |
165 | emit _self->clearMenu(); |
|
165 | emit _self->clearMenu(); | |
166 | emit _self->addPluginGUI(driver); |
|
166 | emit _self->addPluginGUI(driver); | |
167 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
167 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); | |
168 | driver->postInstantiationTrigger(); |
|
168 | driver->postInstantiationTrigger(); | |
169 | } |
|
169 | } | |
170 |
|
170 | |||
171 |
|
171 | |||
172 | void socexplorerproxy::changeSysDriverInstName(const QString instanceName) |
|
172 | void socexplorerproxy::changeSysDriverInstName(const QString instanceName) | |
173 | { |
|
173 | { | |
174 | Q_UNUSED(instanceName) |
|
174 | Q_UNUSED(instanceName) | |
175 | } |
|
175 | } | |
176 |
|
176 | |||
177 | void socexplorerproxy::changeSysDriverInstName(const QString newinstanceName, const QString previnstanceName) |
|
177 | void socexplorerproxy::changeSysDriverInstName(const QString newinstanceName, const QString previnstanceName) | |
178 | { |
|
178 | { | |
179 | if(!_self)init(); |
|
179 | if(!_self)init(); | |
180 | socexplorerplugin*temp=_self->getSysDriver(previnstanceName); |
|
180 | socexplorerplugin*temp=_self->getSysDriver(previnstanceName); | |
181 | if(temp!=NULL) |
|
181 | if(temp!=NULL) | |
182 | { |
|
182 | { | |
183 | if(NULL!=_self->getSysDriver(newinstanceName)) |
|
183 | if(NULL!=_self->getSysDriver(newinstanceName)) | |
184 | { |
|
184 | { | |
185 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
185 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); | |
186 | return; |
|
186 | return; | |
187 | } |
|
187 | } | |
188 | temp->setInstanceName(newinstanceName); |
|
188 | temp->setInstanceName(newinstanceName); | |
189 | } |
|
189 | } | |
190 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
190 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); | |
191 | } |
|
191 | } | |
192 |
|
192 | |||
193 | //void socexplorerproxy::loadChild(socexplorerplugin *parent) |
|
193 | //void socexplorerproxy::loadChild(socexplorerplugin *parent) | |
194 | //{ |
|
194 | //{ | |
195 | // if(!_self)init(); |
|
195 | // if(!_self)init(); | |
196 | // parent = parent; |
|
196 | // parent = parent; | |
197 | // pluginmanagerWDGT* pluginmanager0 = new pluginmanagerWDGT; |
|
197 | // pluginmanagerWDGT* pluginmanager0 = new pluginmanagerWDGT; | |
198 | // pluginmanager0->setChildLoadable(true); |
|
198 | // pluginmanager0->setChildLoadable(true); | |
199 | // pluginmanager0->connect(pluginmanager0,SIGNAL(loadSysDrviver(QString)),_self,SLOT(loadSysDriverToParent(QString))); |
|
199 | // pluginmanager0->connect(pluginmanager0,SIGNAL(loadSysDrviver(QString)),_self,SLOT(loadSysDriverToParent(QString))); | |
200 | // pluginmanager0->show(); |
|
200 | // pluginmanager0->show(); | |
201 | //} |
|
201 | //} | |
202 |
|
202 | |||
203 |
|
203 | |||
204 | void socexplorerproxy::connectChildToParent(socexplorerplugin *parent, socexplorerplugin *child) |
|
204 | void socexplorerproxy::connectChildToParent(socexplorerplugin *parent, socexplorerplugin *child) | |
205 | { |
|
205 | { | |
206 | if(!_self)init(); |
|
206 | if(!_self)init(); | |
207 | connect(parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool))); |
|
207 | connect(parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool))); | |
208 | child->activate(parent->isConnected()); |
|
208 | child->activate(parent->isConnected()); | |
209 | } |
|
209 | } | |
210 |
|
210 | |||
211 | void socexplorerproxy::disconnectChildToParent(socexplorerplugin *child) |
|
211 | void socexplorerproxy::disconnectChildToParent(socexplorerplugin *child) | |
212 | { |
|
212 | { | |
213 | if(!_self)init(); |
|
213 | if(!_self)init(); | |
214 | disconnect(child->parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool))); |
|
214 | disconnect(child->parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool))); | |
215 | } |
|
215 | } | |
216 |
|
216 | |||
217 |
|
217 | |||
218 | void socexplorerproxy::connectChildToProxy(socexplorerplugin *child) |
|
218 | void socexplorerproxy::connectChildToProxy(socexplorerplugin *child) | |
219 | { |
|
219 | { | |
220 | if(!_self)init(); |
|
220 | if(!_self)init(); | |
221 | connect(child,SIGNAL(registerObject(QObject*,QString)),_self,SIGNAL(registerObject(QObject*,QString))); |
|
221 | connect(child,SIGNAL(registerObject(QObject*,QString)),_self,SIGNAL(registerObject(QObject*,QString))); | |
222 | connect(child,SIGNAL(closePlugin(socexplorerplugin*)),_self,SLOT(closeSysDriver(socexplorerplugin*))); |
|
222 | connect(child,SIGNAL(closePlugin(socexplorerplugin*)),_self,SLOT(closeSysDriver(socexplorerplugin*))); | |
223 | } |
|
223 | } | |
224 |
|
224 | |||
225 | void socexplorerproxy::disconnectChildToProxy(socexplorerplugin *child) |
|
225 | void socexplorerproxy::disconnectChildToProxy(socexplorerplugin *child) | |
226 | { |
|
226 | { | |
227 | if(!_self)init(); |
|
227 | if(!_self)init(); | |
228 | disconnect(child,SIGNAL(registerObject(QObject*,QString)),_self,SIGNAL(registerObject(QObject*,QString))); |
|
228 | disconnect(child,SIGNAL(registerObject(QObject*,QString)),_self,SIGNAL(registerObject(QObject*,QString))); | |
229 | disconnect(child,SIGNAL(closePlugin(socexplorerplugin*)),_self,SLOT(closeSysDriverFromDriver(socexplorerplugin*))); |
|
229 | disconnect(child,SIGNAL(closePlugin(socexplorerplugin*)),_self,SLOT(closeSysDriverFromDriver(socexplorerplugin*))); | |
230 | } |
|
230 | } | |
231 |
|
231 | |||
232 | QString socexplorerproxy::getinstanceName(const QString& baseName) |
|
232 | QString socexplorerproxy::getinstanceName(const QString& baseName) | |
233 | { |
|
233 | { | |
234 | if(!_self)init(); |
|
234 | if(!_self)init(); | |
235 | int i=0; |
|
235 | int i=0; | |
236 | QString name; |
|
236 | QString name; | |
237 | bool validName = false; |
|
237 | bool validName = false; | |
238 | while(!validName) |
|
238 | while(!validName) | |
239 | { |
|
239 | { | |
240 | name.clear(); |
|
240 | name.clear(); | |
241 | name.append(baseName+QString::number(i)); |
|
241 | name.append(baseName+QString::number(i)); | |
242 | validName = instanceNameIsValid(name); |
|
242 | validName = instanceNameIsValid(name); | |
243 | i++; |
|
243 | i++; | |
244 | } |
|
244 | } | |
245 | return name; |
|
245 | return name; | |
246 | } |
|
246 | } | |
247 |
|
247 | |||
248 | void socexplorerproxy::changeSysDriverInstName(socexplorerplugin* driver) |
|
248 | void socexplorerproxy::changeSysDriverInstName(socexplorerplugin* driver) | |
249 | { |
|
249 | { | |
250 | if(!_self)init(); |
|
250 | if(!_self)init(); | |
251 | QString prevName(driver->instanceName()); |
|
251 | QString prevName(driver->instanceName()); | |
252 | } |
|
252 | } | |
253 |
|
253 | |||
254 | bool socexplorerproxy::instanceNameIsValid(const QString& instanceName) |
|
254 | bool socexplorerproxy::instanceNameIsValid(const QString& instanceName) | |
255 | { |
|
255 | { | |
256 | if(!_self)init(); |
|
256 | if(!_self)init(); | |
257 | for(int k=0;k<linearDriverList->count();k++) |
|
257 | for(int k=0;k<linearDriverList->count();k++) | |
258 | { |
|
258 | { | |
259 | if(!linearDriverList->at(k)->instanceName().compare(instanceName)) |
|
259 | if(!linearDriverList->at(k)->instanceName().compare(instanceName)) | |
260 | return false; |
|
260 | return false; | |
261 | } |
|
261 | } | |
262 | return true; |
|
262 | return true; | |
263 | } |
|
263 | } | |
264 |
|
264 | |||
265 | socexplorerplugin *socexplorerproxy::findPlugin(const QString &instanceName) |
|
265 | socexplorerplugin *socexplorerproxy::findPlugin(const QString &instanceName) | |
266 | { |
|
266 | { | |
267 | if(!_self)init(); |
|
267 | if(!_self)init(); | |
268 | for(int k=0;k<linearDriverList->count();k++) |
|
268 | for(int k=0;k<linearDriverList->count();k++) | |
269 | { |
|
269 | { | |
270 | if(linearDriverList->at(k)->instanceName().compare(instanceName)) |
|
270 | if(linearDriverList->at(k)->instanceName().compare(instanceName)) | |
271 | return linearDriverList->at(k); |
|
271 | return linearDriverList->at(k); | |
272 | } |
|
272 | } | |
273 | return NULL; |
|
273 | return NULL; | |
274 | } |
|
274 | } | |
275 |
|
275 | |||
276 | bool socexplorerproxy::instanceExists(const QString &instanceName) |
|
276 | bool socexplorerproxy::instanceExists(const QString &instanceName) | |
277 | { |
|
277 | { | |
278 | return !socexplorerproxy::instanceNameIsValid(instanceName); |
|
278 | return !socexplorerproxy::instanceNameIsValid(instanceName); | |
279 | } |
|
279 | } | |
280 |
|
280 | |||
281 | void socexplorerproxy::close() |
|
281 | void socexplorerproxy::close() | |
282 | { |
|
282 | { | |
283 | if(!_self)init(); |
|
283 | if(!_self)init(); | |
284 | socexplorerplugin* tmpPtr; |
|
284 | socexplorerplugin* tmpPtr; | |
285 | while(drivers->count()>0) |
|
285 | while(drivers->count()>0) | |
286 | { |
|
286 | { | |
287 | tmpPtr = drivers->last(); |
|
287 | tmpPtr = drivers->last(); | |
288 | drivers->removeLast(); |
|
288 | drivers->removeLast(); | |
289 | _self->closeSysDriver(tmpPtr); |
|
289 | _self->closeSysDriver(tmpPtr); | |
290 | } |
|
290 | } | |
291 | if(root!=NULL) |
|
291 | if(root!=NULL) | |
292 | { |
|
292 | { | |
293 | _self->closeSysDriver(root); |
|
293 | _self->closeSysDriver(root); | |
294 | } |
|
294 | } | |
295 |
|
295 | |||
296 | } |
|
296 | } | |
297 |
|
297 | |||
298 | socexplorerplugin* socexplorerproxy::getSysDriver(const QString instanceName) |
|
298 | socexplorerplugin* socexplorerproxy::getSysDriver(const QString instanceName) | |
299 | { |
|
299 | { | |
300 | if(!_self)init(); |
|
300 | if(!_self)init(); | |
301 | for(int i=0;i<linearDriverList->count();i++) |
|
301 | for(int i=0;i<linearDriverList->count();i++) | |
302 | { |
|
302 | { | |
303 | if(!linearDriverList->at(i)->instanceName().compare(instanceName)) |
|
303 | if(!linearDriverList->at(i)->instanceName().compare(instanceName)) | |
304 | return linearDriverList->at(i); |
|
304 | return linearDriverList->at(i); | |
305 | } |
|
305 | } | |
306 | return NULL; |
|
306 | return NULL; | |
307 | } |
|
307 | } | |
308 |
|
308 | |||
309 |
|
309 | |||
310 | void socexplorerproxy::closeSysDriver(const QString instanceName) |
|
310 | void socexplorerproxy::closeSysDriver(const QString instanceName) | |
311 | { |
|
311 | { | |
312 | if(!_self)init(); |
|
312 | if(!_self)init(); | |
313 | closeSysDriver(getSysDriver(instanceName),false); |
|
313 | closeSysDriver(getSysDriver(instanceName),false); | |
314 | } |
|
314 | } | |
315 |
|
315 | |||
316 | void socexplorerproxy::closeSysDriver(socexplorerplugin *driver, bool recursive) |
|
316 | void socexplorerproxy::closeSysDriver(socexplorerplugin *driver, bool recursive) | |
317 | { |
|
317 | { | |
318 | if(!_self)init(); |
|
318 | if(!_self)init(); | |
319 | if(driver!=NULL) |
|
319 | if(driver!=NULL) | |
320 | { |
|
320 | { | |
321 | emit _self->removePluginGUI(driver); |
|
321 | emit _self->removePluginGUI(driver); | |
322 | if(driver->parent==NULL)SocExplorerEngine::removeSOC(driver); |
|
322 | if(driver->parent==NULL)SocExplorerEngine::removeSOC(driver); | |
323 | while(driver->childs.count()!=0)closeSysDriver(driver->childs.first()); |
|
323 | while(driver->childs.count()!=0)closeSysDriver(driver->childs.first()); | |
324 | linearDriverList->removeOne(driver); |
|
324 | linearDriverList->removeOne(driver); | |
325 | if(driver->parent!= NULL) |
|
325 | if(driver->parent!= NULL) | |
326 | { |
|
326 | { | |
327 | driver->parent->childs.removeOne(driver); //Have parent so it's a child |
|
327 | driver->parent->childs.removeOne(driver); //Have parent so it's a child | |
328 | disconnectChildToParent(driver); |
|
328 | disconnectChildToParent(driver); | |
329 | disconnectChildToProxy(driver); |
|
329 | disconnectChildToProxy(driver); | |
330 | delete driver; |
|
330 | delete driver; | |
331 | } |
|
331 | } | |
332 | else |
|
332 | else | |
333 | { |
|
333 | { | |
334 | drivers->removeOne(driver); |
|
334 | drivers->removeOne(driver); | |
335 | disconnectChildToProxy(driver); |
|
335 | disconnectChildToProxy(driver); | |
336 | delete driver; |
|
336 | delete driver; | |
337 | } |
|
337 | } | |
338 | if(!recursive) |
|
338 | if(!recursive) | |
339 | { |
|
339 | { | |
340 | emit _self->clearMenu(); |
|
340 | emit _self->clearMenu(); | |
341 | emit _self->registermenu(mainWindow); |
|
341 | emit _self->registermenu(mainWindow); | |
342 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
342 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); | |
343 | } |
|
343 | } | |
344 | } |
|
344 | } | |
345 |
|
345 | |||
346 | } |
|
346 | } | |
347 |
|
347 | |||
348 | void socexplorerproxy::geteplugintree() |
|
348 | void socexplorerproxy::geteplugintree() | |
349 | { |
|
349 | { | |
350 | if(!_self)init(); |
|
350 | if(!_self)init(); | |
351 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
351 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); | |
352 | } |
|
352 | } | |
353 |
|
353 | |||
354 | void socexplorerproxy::closeSysDriverFromDriver(socexplorerplugin *driver) |
|
354 | void socexplorerproxy::closeSysDriverFromDriver(socexplorerplugin *driver) | |
355 | { |
|
355 | { | |
356 | if(!_self)init(); |
|
356 | if(!_self)init(); | |
357 | emit _self->closeSysDriverSig(driver); |
|
357 | emit _self->closeSysDriverSig(driver); | |
358 | } |
|
358 | } | |
359 |
|
359 | |||
360 | void socexplorerproxy::updateText() |
|
360 | void socexplorerproxy::updateText() | |
361 | { |
|
361 | { | |
362 | if(!_self)init(); |
|
362 | if(!_self)init(); | |
363 | emit _self->clearMenu(); |
|
363 | emit _self->clearMenu(); | |
364 | emit _self->registermenu(mainWindow); |
|
364 | emit _self->registermenu(mainWindow); | |
365 | } |
|
365 | } | |
366 |
|
366 | |||
367 |
|
367 | |||
368 |
|
368 | |||
369 |
|
369 | |||
370 |
|
370 | |||
371 | void socexplorerproxy::makeMenu(QMenu* menu) |
|
371 | void socexplorerproxy::makeMenu(QMenu* menu) | |
372 | { |
|
372 | { | |
373 | if(!_self)init(); |
|
373 | if(!_self)init(); | |
374 | for(int i=0;i<drivers->count();i++) |
|
374 | for(int i=0;i<drivers->count();i++) | |
375 | { |
|
375 | { | |
376 | drivers->at(i)->registermenu(menu); |
|
376 | drivers->at(i)->registermenu(menu); | |
377 | } |
|
377 | } | |
378 | } |
|
378 | } | |
379 |
|
379 | |||
380 |
|
380 |
@@ -1,103 +1,103 | |||||
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, |
|
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 | #ifndef SOCEXPLORERPROXY_H |
|
22 | #ifndef SOCEXPLORERPROXY_H | |
23 | #define SOCEXPLORERPROXY_H |
|
23 | #define SOCEXPLORERPROXY_H | |
24 |
|
24 | |||
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 | #include <QString> |
|
26 | #include <QString> | |
27 | #include <QList> |
|
27 | #include <QList> | |
28 | #include "pluginscache.h" |
|
28 | #include "pluginscache.h" | |
29 | #include <socexplorerplugin.h> |
|
29 | #include <socexplorerplugin.h> | |
30 | #include <socexplorerplugininterface.h> |
|
30 | #include <socexplorerplugininterface.h> | |
31 | #include <QInputDialog> |
|
31 | #include <QInputDialog> | |
32 | #include <QtGlobal> |
|
32 | #include <QtGlobal> | |
33 |
|
33 | |||
34 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
34 | #if defined(SOCEXPLORER_SDK_BUILD) | |
35 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
35 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT | |
36 | #else |
|
36 | #else | |
37 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
37 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT | |
38 | #endif |
|
38 | #endif | |
39 |
|
39 | |||
40 | class SOCEXPLORER_SDK_EXPORT socexplorerproxy : public QObject |
|
40 | class SOCEXPLORER_SDK_EXPORT socexplorerproxy : public QObject | |
41 | { |
|
41 | { | |
42 | Q_OBJECT |
|
42 | Q_OBJECT | |
43 | private: |
|
43 | private: | |
44 | socexplorerproxy(QObject *parent = 0); |
|
44 | socexplorerproxy(QObject *parent = 0); | |
45 | socexplorerproxy(QMainWindow* Mainwindow,QObject *parent = 0); |
|
45 | socexplorerproxy(QMainWindow* Mainwindow,QObject *parent = 0); | |
46 | static socexplorerproxy* _self; |
|
46 | static socexplorerproxy* _self; | |
47 | public: |
|
47 | public: | |
48 | static socexplorerproxy* self(){if(!_self)init(); return _self;} |
|
48 | static socexplorerproxy* self(){if(!_self)init(); return _self;} | |
49 | static void init(); |
|
49 | static void init(); | |
50 | static void setMainWindow(QMainWindow* Mainwindow); |
|
50 | static void setMainWindow(QMainWindow* Mainwindow); | |
51 | static void connectChildToParent(socexplorerplugin* parent, socexplorerplugin* child); |
|
51 | static void connectChildToParent(socexplorerplugin* parent, socexplorerplugin* child); | |
52 | static void connectChildToProxy(socexplorerplugin* child); |
|
52 | static void connectChildToProxy(socexplorerplugin* child); | |
53 | static void disconnectChildToParent(socexplorerplugin* child); |
|
53 | static void disconnectChildToParent(socexplorerplugin* child); | |
54 | static void disconnectChildToProxy(socexplorerplugin* child); |
|
54 | static void disconnectChildToProxy(socexplorerplugin* child); | |
55 | static bool instanceNameIsValid(const QString& instanceName); |
|
55 | static bool instanceNameIsValid(const QString& instanceName); | |
56 | static socexplorerplugin* findPlugin(const QString &instanceName); |
|
56 | static socexplorerplugin* findPlugin(const QString &instanceName); | |
57 |
|
57 | |||
58 | QT_ENSURE_STACK_ALIGNED_FOR_SSE static void loadChildSysDriver(socexplorerplugin* parent,const QString child); |
|
58 | QT_ENSURE_STACK_ALIGNED_FOR_SSE static void loadChildSysDriver(socexplorerplugin* parent,const QString child); | |
59 |
|
59 | |||
60 | signals: |
|
60 | signals: | |
61 | void addPluginGUI(QDockWidget* plugin); |
|
61 | void addPluginGUI(QDockWidget* plugin); | |
62 | void removePluginGUI(QDockWidget* plugin); |
|
62 | void removePluginGUI(QDockWidget* plugin); | |
63 | int registermenu(QMainWindow* menuHolder); |
|
63 | int registermenu(QMainWindow* menuHolder); | |
64 | void clearMenu(); |
|
64 | void clearMenu(); | |
65 | QStringList findDrivers(int VID,int PID); |
|
65 | QStringList findDrivers(int VID,int PID); | |
66 | void rootDriverAdded(socexplorerplugin* driver); |
|
66 | void rootDriverAdded(socexplorerplugin* driver); | |
67 | void rootDriverRemoved(); |
|
67 | void rootDriverRemoved(); | |
68 | void closeSysDriverSig(socexplorerplugin* driver); |
|
68 | void closeSysDriverSig(socexplorerplugin* driver); | |
69 | void registerObject(QObject* object,const QString& instanceName); |
|
69 | void registerObject(QObject* object,const QString& instanceName); | |
70 | void treeChanged(const QList<socexplorerplugin*>& drivers); |
|
70 | void treeChanged(const QList<socexplorerplugin*>& drivers); | |
71 |
|
71 | |||
72 | public slots: |
|
72 | public slots: | |
73 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name); |
|
73 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name); | |
74 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name,const QString instanceName); |
|
74 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name,const QString instanceName); | |
75 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(socexplorerplugin* driver,const QString instanceName); |
|
75 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(socexplorerplugin* driver,const QString instanceName); | |
76 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString ParentInst); |
|
76 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString ParentInst); | |
77 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString instanceName,const QString ParentInst); |
|
77 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString instanceName,const QString ParentInst); | |
78 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName); |
|
78 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName); | |
79 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString instanceName); |
|
79 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString instanceName); | |
80 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
80 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); | |
81 | // QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadChild(socexplorerplugin* parent); |
|
81 | // QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadChild(socexplorerplugin* parent); | |
82 | void updateText(); |
|
82 | void updateText(); | |
83 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void closeSysDriverFromDriver(socexplorerplugin* driver); |
|
83 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void closeSysDriverFromDriver(socexplorerplugin* driver); | |
84 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void closeSysDriver(socexplorerplugin* driver,bool recursive=false); |
|
84 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void closeSysDriver(socexplorerplugin* driver,bool recursive=false); | |
85 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void closeSysDriver(const QString instanceName); |
|
85 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void closeSysDriver(const QString instanceName); | |
86 | void makeMenu(QMenu* menu); |
|
86 | void makeMenu(QMenu* menu); | |
87 | void close(); |
|
87 | void close(); | |
88 | QString getinstanceName(const QString& baseName); |
|
88 | QString getinstanceName(const QString& baseName); | |
89 | void geteplugintree(); |
|
89 | void geteplugintree(); | |
90 | QT_ENSURE_STACK_ALIGNED_FOR_SSE socexplorerplugin* getSysDriver(const QString instanceName); |
|
90 | QT_ENSURE_STACK_ALIGNED_FOR_SSE socexplorerplugin* getSysDriver(const QString instanceName); | |
91 | bool instanceExists(const QString& instanceName); |
|
91 | bool instanceExists(const QString& instanceName); | |
92 | private: |
|
92 | private: | |
93 |
|
93 | |||
94 | static void changeSysDriverInstName(socexplorerplugin* driver); |
|
94 | static void changeSysDriverInstName(socexplorerplugin* driver); | |
95 | static QMainWindow* mainWindow; |
|
95 | static QMainWindow* mainWindow; | |
96 | static QList<socexplorerplugin*>* drivers; |
|
96 | static QList<socexplorerplugin*>* drivers; | |
97 | static QList<socexplorerplugin*>* linearDriverList; |
|
97 | static QList<socexplorerplugin*>* linearDriverList; | |
98 | static socexplorerplugin* root; |
|
98 | static socexplorerplugin* root; | |
99 | static socexplorerplugin* parent; |
|
99 | static socexplorerplugin* parent; | |
100 | static PluginsCache* cache; |
|
100 | static PluginsCache* cache; | |
101 | }; |
|
101 | }; | |
102 |
|
102 | |||
103 | #endif // SOCEXPLORERPROXY_H |
|
103 | #endif // SOCEXPLORERPROXY_H |
@@ -1,49 +1,49 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 "aboutsocexplorer.h" |
|
22 | #include "aboutsocexplorer.h" | |
23 |
|
23 | |||
24 | #include <socexplorerengine.h> |
|
24 | #include <socexplorerengine.h> | |
25 |
|
25 | |||
26 | aboutsocexplorer::aboutsocexplorer(QWidget *parent) : |
|
26 | aboutsocexplorer::aboutsocexplorer(QWidget *parent) : | |
27 | QTextBrowser(parent) |
|
27 | QTextBrowser(parent) | |
28 | { |
|
28 | { | |
29 | this->setReadOnly(true); |
|
29 | this->setReadOnly(true); | |
30 | QString code; |
|
30 | QString code; | |
31 | QFile file; |
|
31 | QFile file; | |
32 | code.clear(); |
|
32 | code.clear(); | |
33 | file.setFileName(":/about/about.html"); |
|
33 | file.setFileName(":/about/about.html"); | |
34 | this->setAcceptRichText(true); |
|
34 | this->setAcceptRichText(true); | |
35 | file.open(QIODevice::ReadOnly); |
|
35 | file.open(QIODevice::ReadOnly); | |
36 | QTextStream filestrm(&file); |
|
36 | QTextStream filestrm(&file); | |
37 | while(!filestrm.atEnd())code.append(filestrm.readLine().replace("$VERSION$",SocExplorerEngine::SocExplorerVersion()).replace("$Branch$",SocExplorerEngine::SocExplorerBranch()).replace("$Changeset$",SocExplorerEngine::SocExplorerChangeset())+"\n"); |
|
37 | while(!filestrm.atEnd())code.append(filestrm.readLine().replace("$VERSION$",SocExplorerEngine::SocExplorerVersion()).replace("$Branch$",SocExplorerEngine::SocExplorerBranch()).replace("$Changeset$",SocExplorerEngine::SocExplorerChangeset())+"\n"); | |
38 | this->setHtml(code); |
|
38 | this->setHtml(code); | |
39 | file.close(); |
|
39 | file.close(); | |
40 | this->setMinimumSize(400,400); |
|
40 | this->setMinimumSize(400,400); | |
41 | connect(this,SIGNAL(anchorClicked(QUrl)),this,SLOT(anchorClicked_slt(QUrl))); |
|
41 | connect(this,SIGNAL(anchorClicked(QUrl)),this,SLOT(anchorClicked_slt(QUrl))); | |
42 | this->setOpenLinks(false); |
|
42 | this->setOpenLinks(false); | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 |
|
45 | |||
46 | void aboutsocexplorer::anchorClicked_slt(const QUrl & url) |
|
46 | void aboutsocexplorer::anchorClicked_slt(const QUrl & url) | |
47 | { |
|
47 | { | |
48 | QDesktopServices::openUrl(url); |
|
48 | QDesktopServices::openUrl(url); | |
49 | } |
|
49 | } |
@@ -1,46 +1,46 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 | #ifndef ABOUTSOCEXPLORER_H |
|
22 | #ifndef ABOUTSOCEXPLORER_H | |
23 | #define ABOUTSOCEXPLORER_H |
|
23 | #define ABOUTSOCEXPLORER_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QTextBrowser> |
|
26 | #include <QTextBrowser> | |
27 | #include <QFile> |
|
27 | #include <QFile> | |
28 | #include <QTextStream> |
|
28 | #include <QTextStream> | |
29 | #include <QDesktopServices> |
|
29 | #include <QDesktopServices> | |
30 | #include <QUrl> |
|
30 | #include <QUrl> | |
31 |
|
31 | |||
32 | class aboutsocexplorer : public QTextBrowser |
|
32 | class aboutsocexplorer : public QTextBrowser | |
33 | { |
|
33 | { | |
34 | Q_OBJECT |
|
34 | Q_OBJECT | |
35 | public: |
|
35 | public: | |
36 | explicit aboutsocexplorer(QWidget *parent = 0); |
|
36 | explicit aboutsocexplorer(QWidget *parent = 0); | |
37 |
|
37 | |||
38 | signals: |
|
38 | signals: | |
39 |
|
39 | |||
40 | public slots: |
|
40 | public slots: | |
41 | void anchorClicked_slt(const QUrl &); |
|
41 | void anchorClicked_slt(const QUrl &); | |
42 | private: |
|
42 | private: | |
43 |
|
43 | |||
44 | }; |
|
44 | }; | |
45 |
|
45 | |||
46 | #endif // ABOUTSOCEXPLORER_H |
|
46 | #endif // ABOUTSOCEXPLORER_H |
@@ -1,63 +1,63 | |||||
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) 2014, |
|
3 | -- Copyright (C) 2014, 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 "abstractexecfile.h" |
|
22 | #include "abstractexecfile.h" | |
23 |
|
23 | |||
24 | abstractExecFile::abstractExecFile(QObject *parent) : |
|
24 | abstractExecFile::abstractExecFile(QObject *parent) : | |
25 | QObject(parent) |
|
25 | QObject(parent) | |
26 | { |
|
26 | { | |
27 | } |
|
27 | } | |
28 |
|
28 | |||
29 | abstractExecFile::abstractExecFile(const QString &File, QObject *parent) |
|
29 | abstractExecFile::abstractExecFile(const QString &File, QObject *parent) | |
30 | { |
|
30 | { | |
31 |
|
31 | |||
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | bool abstractExecFile::openFile(const QString &File) |
|
34 | bool abstractExecFile::openFile(const QString &File) | |
35 | { |
|
35 | { | |
36 |
|
36 | |||
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | bool abstractExecFile::isopened() |
|
39 | bool abstractExecFile::isopened() | |
40 | { |
|
40 | { | |
41 |
|
41 | |||
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | int abstractExecFile::setFilename(const QString &name) |
|
44 | int abstractExecFile::setFilename(const QString &name) | |
45 | { |
|
45 | { | |
46 |
|
46 | |||
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | int abstractExecFile::closeFile() |
|
49 | int abstractExecFile::closeFile() | |
50 | { |
|
50 | { | |
51 |
|
51 | |||
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | QList<codeFragment> abstractExecFile::getFragments() |
|
54 | QList<codeFragment> abstractExecFile::getFragments() | |
55 | { |
|
55 | { | |
56 |
|
56 | |||
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 |
|
59 | |||
60 | codeFragment::codeFragment() |
|
60 | codeFragment::codeFragment() | |
61 | { |
|
61 | { | |
62 |
|
62 | |||
63 | } |
|
63 | } |
@@ -1,53 +1,53 | |||||
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) 2014, |
|
3 | -- Copyright (C) 2014, 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 ABSTRACTEXECFILE_H |
|
22 | #ifndef ABSTRACTEXECFILE_H | |
23 | #define ABSTRACTEXECFILE_H |
|
23 | #define ABSTRACTEXECFILE_H | |
24 |
|
24 | |||
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 |
|
26 | |||
27 | class codeFragment |
|
27 | class codeFragment | |
28 | { |
|
28 | { | |
29 | public: |
|
29 | public: | |
30 | codeFragment(); |
|
30 | codeFragment(); | |
31 | char* data; |
|
31 | char* data; | |
32 | quint32 size; |
|
32 | quint32 size; | |
33 | quint32 address; |
|
33 | quint32 address; | |
34 | }; |
|
34 | }; | |
35 |
|
35 | |||
36 | class abstractExecFile : public QObject |
|
36 | class abstractExecFile : public QObject | |
37 | { |
|
37 | { | |
38 | Q_OBJECT |
|
38 | Q_OBJECT | |
39 | public: |
|
39 | public: | |
40 | abstractExecFile(QObject *parent = 0); |
|
40 | abstractExecFile(QObject *parent = 0); | |
41 | abstractExecFile(const QString& File,QObject *parent = 0); |
|
41 | abstractExecFile(const QString& File,QObject *parent = 0); | |
42 | virtual bool openFile(const QString& File); |
|
42 | virtual bool openFile(const QString& File); | |
43 | virtual bool isopened(); |
|
43 | virtual bool isopened(); | |
44 | virtual int setFilename(const QString& name); |
|
44 | virtual int setFilename(const QString& name); | |
45 | virtual int closeFile(); |
|
45 | virtual int closeFile(); | |
46 | virtual QList<codeFragment> getFragments(); |
|
46 | virtual QList<codeFragment> getFragments(); | |
47 | signals: |
|
47 | signals: | |
48 |
|
48 | |||
49 | public slots: |
|
49 | public slots: | |
50 |
|
50 | |||
51 | }; |
|
51 | }; | |
52 |
|
52 | |||
53 | #endif // ABSTRACTEXECFILE_H |
|
53 | #endif // ABSTRACTEXECFILE_H |
@@ -1,32 +1,32 | |||||
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) 2014, |
|
3 | -- Copyright (C) 2014, 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 "elffile.h" |
|
22 | #include "elffile.h" | |
23 |
|
23 | |||
24 | ElfFile::ElfFile(QObject *parent) : |
|
24 | ElfFile::ElfFile(QObject *parent) : | |
25 | abstractExecFile(parent) |
|
25 | abstractExecFile(parent) | |
26 | { |
|
26 | { | |
27 | } |
|
27 | } | |
28 |
|
28 | |||
29 | ElfFile::ElfFile(const QString &File, QObject *parent) |
|
29 | ElfFile::ElfFile(const QString &File, QObject *parent) | |
30 | { |
|
30 | { | |
31 |
|
31 | |||
32 | } |
|
32 | } |
@@ -1,39 +1,39 | |||||
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) 2014, |
|
3 | -- Copyright (C) 2014, 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 <abstractexecfile.h> |
|
22 | #include <abstractexecfile.h> | |
23 | #ifndef ELFFILE_H |
|
23 | #ifndef ELFFILE_H | |
24 | #define ELFFILE_H |
|
24 | #define ELFFILE_H | |
25 |
|
25 | |||
26 | class ElfFile : public abstractExecFile |
|
26 | class ElfFile : public abstractExecFile | |
27 | { |
|
27 | { | |
28 | Q_OBJECT |
|
28 | Q_OBJECT | |
29 | public: |
|
29 | public: | |
30 | ElfFile(QObject *parent = 0); |
|
30 | ElfFile(QObject *parent = 0); | |
31 | ElfFile(const QString& File,QObject *parent = 0); |
|
31 | ElfFile(const QString& File,QObject *parent = 0); | |
32 |
|
32 | |||
33 | signals: |
|
33 | signals: | |
34 |
|
34 | |||
35 | public slots: |
|
35 | public slots: | |
36 |
|
36 | |||
37 | }; |
|
37 | }; | |
38 |
|
38 | |||
39 | #endif // ELFFILE_H |
|
39 | #endif // ELFFILE_H |
@@ -1,164 +1,164 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 3 of the License, or |
|
7 | -- the Free Software Foundation; either version 3 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 |
|
22 | |||
23 | #include "elfinfowdgt.h" |
|
23 | #include "elfinfowdgt.h" | |
24 |
|
24 | |||
25 | elfInfoWdgt::elfInfoWdgt(QWidget *parent) : |
|
25 | elfInfoWdgt::elfInfoWdgt(QWidget *parent) : | |
26 | QWidget(parent) |
|
26 | QWidget(parent) | |
27 | { |
|
27 | { | |
28 | this->mainLayout = new QVBoxLayout; |
|
28 | this->mainLayout = new QVBoxLayout; | |
29 | this->ElfArchitecture= new QLabel; |
|
29 | this->ElfArchitecture= new QLabel; | |
30 | this->ElfType = new QLabel; |
|
30 | this->ElfType = new QLabel; | |
31 | this->ElfVersion = new QLabel; |
|
31 | this->ElfVersion = new QLabel; | |
32 | this->splitter = new QSplitter; |
|
32 | this->splitter = new QSplitter; | |
33 | this->hexViewer = new QHexEdit; |
|
33 | this->hexViewer = new QHexEdit; | |
34 | this->elfInfoWdgtLay = new QWidget; |
|
34 | this->elfInfoWdgtLay = new QWidget; | |
35 | this->elfInfoWdgtLayout = new QVBoxLayout; |
|
35 | this->elfInfoWdgtLayout = new QVBoxLayout; | |
36 | this->segmentsListTableWdgt = new QTableWidget; |
|
36 | this->segmentsListTableWdgt = new QTableWidget; | |
37 | this->segmentsListTableWdgt->setColumnCount(7); |
|
37 | this->segmentsListTableWdgt->setColumnCount(7); | |
38 | this->segmentsListTableWdgt->setHorizontalHeaderLabels(QStringList()<<"Type"<<"Offset"<<"Vaddr"<<"Paddr"<<"File Size"<<"Mem Size"<<"Flags"); |
|
38 | this->segmentsListTableWdgt->setHorizontalHeaderLabels(QStringList()<<"Type"<<"Offset"<<"Vaddr"<<"Paddr"<<"File Size"<<"Mem Size"<<"Flags"); | |
39 | this->sectionsListTableWdgt = new QTableWidget; |
|
39 | this->sectionsListTableWdgt = new QTableWidget; | |
40 | this->sectionsListTableWdgt->setColumnCount(2); |
|
40 | this->sectionsListTableWdgt->setColumnCount(2); | |
41 | this->sectionsListTableWdgt->setHorizontalHeaderLabels(QStringList()<<"Name"<<"Type"); |
|
41 | this->sectionsListTableWdgt->setHorizontalHeaderLabels(QStringList()<<"Name"<<"Type"); | |
42 | this->ElfArchitecture->setText(QString("Architecture: ")); |
|
42 | this->ElfArchitecture->setText(QString("Architecture: ")); | |
43 | this->ElfType->setText(QString("Type: ")); |
|
43 | this->ElfType->setText(QString("Type: ")); | |
44 | this->ElfVersion->setText(QString("Version: ")); |
|
44 | this->ElfVersion->setText(QString("Version: ")); | |
45 | this->elfInfoWdgtLayout->addWidget(this->ElfArchitecture); |
|
45 | this->elfInfoWdgtLayout->addWidget(this->ElfArchitecture); | |
46 | this->elfInfoWdgtLayout->addWidget(this->ElfType); |
|
46 | this->elfInfoWdgtLayout->addWidget(this->ElfType); | |
47 | this->elfInfoWdgtLayout->addWidget(this->ElfVersion); |
|
47 | this->elfInfoWdgtLayout->addWidget(this->ElfVersion); | |
48 | this->elfInfoWdgtLayout->addWidget(this->segmentsListTableWdgt); |
|
48 | this->elfInfoWdgtLayout->addWidget(this->segmentsListTableWdgt); | |
49 | this->elfInfoWdgtLayout->addWidget(this->sectionsListTableWdgt); |
|
49 | this->elfInfoWdgtLayout->addWidget(this->sectionsListTableWdgt); | |
50 | this->splitter->addWidget(this->hexViewer); |
|
50 | this->splitter->addWidget(this->hexViewer); | |
51 | this->splitter->addWidget(this->elfInfoWdgtLay); |
|
51 | this->splitter->addWidget(this->elfInfoWdgtLay); | |
52 | this->elfInfoWdgtLay->setLayout(this->elfInfoWdgtLayout); |
|
52 | this->elfInfoWdgtLay->setLayout(this->elfInfoWdgtLayout); | |
53 | this->mainLayout->addWidget(this->splitter); |
|
53 | this->mainLayout->addWidget(this->splitter); | |
54 | this->setLayout(this->mainLayout); |
|
54 | this->setLayout(this->mainLayout); | |
55 | connect(this->segmentsListTableWdgt,SIGNAL(cellActivated(int,int)),this,SLOT(cellActivated(int,int))); |
|
55 | connect(this->segmentsListTableWdgt,SIGNAL(cellActivated(int,int)),this,SLOT(cellActivated(int,int))); | |
56 | connect(this->sectionsListTableWdgt,SIGNAL(cellActivated(int,int)),this,SLOT(cellActivated(int,int))); |
|
56 | connect(this->sectionsListTableWdgt,SIGNAL(cellActivated(int,int)),this,SLOT(cellActivated(int,int))); | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 |
|
59 | |||
60 | void elfInfoWdgt::updateInfo(elfparser *parser) |
|
60 | void elfInfoWdgt::updateInfo(elfparser *parser) | |
61 | { |
|
61 | { | |
62 | if(parser!=NULL) |
|
62 | if(parser!=NULL) | |
63 | { |
|
63 | { | |
64 | this->ElfArchitecture->setText(QString("Architecture: ")+parser->getArchitecture()); |
|
64 | this->ElfArchitecture->setText(QString("Architecture: ")+parser->getArchitecture()); | |
65 | this->ElfType->setText(QString("Type: ")+parser->getType()); |
|
65 | this->ElfType->setText(QString("Type: ")+parser->getType()); | |
66 | this->ElfVersion->setText(QString("Version: 0x")+QString::number(parser->getVersion(),16)); |
|
66 | this->ElfVersion->setText(QString("Version: 0x")+QString::number(parser->getVersion(),16)); | |
67 | this->updateSectionsTable(parser); |
|
67 | this->updateSectionsTable(parser); | |
68 | this->updateSegmentsTable(parser); |
|
68 | this->updateSegmentsTable(parser); | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | void elfInfoWdgt::cellActivated(int row, int column) |
|
73 | void elfInfoWdgt::cellActivated(int row, int column) | |
74 | { |
|
74 | { | |
75 | char* buff=NULL; |
|
75 | char* buff=NULL; | |
76 | this->parser->getSectionData(row,&buff); |
|
76 | this->parser->getSectionData(row,&buff); | |
77 | this->hexViewer->setData(QByteArray(buff,this->parser->getSectionDatasz(row))); |
|
77 | this->hexViewer->setData(QByteArray(buff,this->parser->getSectionDatasz(row))); | |
78 | } |
|
78 | } | |
79 |
|
79 | |||
80 |
|
80 | |||
81 | void elfInfoWdgt::updateSectionsTable(elfparser* parser) |
|
81 | void elfInfoWdgt::updateSectionsTable(elfparser* parser) | |
82 | { |
|
82 | { | |
83 | if(parser!=NULL) |
|
83 | if(parser!=NULL) | |
84 | { |
|
84 | { | |
85 | this->parser = parser; |
|
85 | this->parser = parser; | |
86 | QTableWidgetItem *item; |
|
86 | QTableWidgetItem *item; | |
87 | for(int i=0 ;i<this->sectionsListTableWdgt->rowCount();i++) |
|
87 | for(int i=0 ;i<this->sectionsListTableWdgt->rowCount();i++) | |
88 | { |
|
88 | { | |
89 | for(int l=0;l<this->sectionsListTableWdgt->columnCount();l++) |
|
89 | for(int l=0;l<this->sectionsListTableWdgt->columnCount();l++) | |
90 | { |
|
90 | { | |
91 | item = this->sectionsListTableWdgt->item(i,l); |
|
91 | item = this->sectionsListTableWdgt->item(i,l); | |
92 | delete item; |
|
92 | delete item; | |
93 | } |
|
93 | } | |
94 | } |
|
94 | } | |
95 | this->sectionsListTableWdgt->setRowCount(parser->getSectioncount()); |
|
95 | this->sectionsListTableWdgt->setRowCount(parser->getSectioncount()); | |
96 | for(int i=0;i<parser->getSectioncount();i++) |
|
96 | for(int i=0;i<parser->getSectioncount();i++) | |
97 | { |
|
97 | { | |
98 | item = new QTableWidgetItem(parser->getSectionName(i)); |
|
98 | item = new QTableWidgetItem(parser->getSectionName(i)); | |
99 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
99 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); | |
100 | this->sectionsListTableWdgt->setItem(i,0,item); |
|
100 | this->sectionsListTableWdgt->setItem(i,0,item); | |
101 | item = new QTableWidgetItem(parser->getSectionType(i)); |
|
101 | item = new QTableWidgetItem(parser->getSectionType(i)); | |
102 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
102 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); | |
103 | this->sectionsListTableWdgt->setItem(i,1,item); |
|
103 | this->sectionsListTableWdgt->setItem(i,1,item); | |
104 | } |
|
104 | } | |
105 | this->sectionsListTableWdgt->resizeColumnsToContents(); |
|
105 | this->sectionsListTableWdgt->resizeColumnsToContents(); | |
106 | this->sectionsListTableWdgt->resizeRowsToContents(); |
|
106 | this->sectionsListTableWdgt->resizeRowsToContents(); | |
107 | } |
|
107 | } | |
108 | } |
|
108 | } | |
109 |
|
109 | |||
110 |
|
110 | |||
111 | void elfInfoWdgt::updateSegmentsTable(elfparser* parser) |
|
111 | void elfInfoWdgt::updateSegmentsTable(elfparser* parser) | |
112 | { |
|
112 | { | |
113 | if(parser!=NULL) |
|
113 | if(parser!=NULL) | |
114 | { |
|
114 | { | |
115 | this->parser = parser; |
|
115 | this->parser = parser; | |
116 | QTableWidgetItem *item; |
|
116 | QTableWidgetItem *item; | |
117 | for(int i=0 ;i<this->segmentsListTableWdgt->rowCount();i++) |
|
117 | for(int i=0 ;i<this->segmentsListTableWdgt->rowCount();i++) | |
118 | { |
|
118 | { | |
119 | for(int l=0;l<this->segmentsListTableWdgt->columnCount();l++) |
|
119 | for(int l=0;l<this->segmentsListTableWdgt->columnCount();l++) | |
120 | { |
|
120 | { | |
121 | item = this->segmentsListTableWdgt->item(i,l); |
|
121 | item = this->segmentsListTableWdgt->item(i,l); | |
122 | delete item; |
|
122 | delete item; | |
123 | } |
|
123 | } | |
124 | } |
|
124 | } | |
125 | this->segmentsListTableWdgt->setRowCount(parser->getSegmentcount()); |
|
125 | this->segmentsListTableWdgt->setRowCount(parser->getSegmentcount()); | |
126 | for(int i=0;i<parser->getSegmentcount();i++) |
|
126 | for(int i=0;i<parser->getSegmentcount();i++) | |
127 | { |
|
127 | { | |
128 | item = new QTableWidgetItem(parser->getSegmentType(i)); |
|
128 | item = new QTableWidgetItem(parser->getSegmentType(i)); | |
129 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
129 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); | |
130 | this->segmentsListTableWdgt->setItem(i,0,item); |
|
130 | this->segmentsListTableWdgt->setItem(i,0,item); | |
131 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentOffset(i),16)); |
|
131 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentOffset(i),16)); | |
132 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
132 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); | |
133 | this->segmentsListTableWdgt->setItem(i,1,item); |
|
133 | this->segmentsListTableWdgt->setItem(i,1,item); | |
134 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentVaddr(i),16)); |
|
134 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentVaddr(i),16)); | |
135 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
135 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); | |
136 | this->segmentsListTableWdgt->setItem(i,2,item); |
|
136 | this->segmentsListTableWdgt->setItem(i,2,item); | |
137 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentPaddr(i),16)); |
|
137 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentPaddr(i),16)); | |
138 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
138 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); | |
139 | this->segmentsListTableWdgt->setItem(i,3,item); |
|
139 | this->segmentsListTableWdgt->setItem(i,3,item); | |
140 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentFilesz(i),16)); |
|
140 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentFilesz(i),16)); | |
141 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
141 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); | |
142 | this->segmentsListTableWdgt->setItem(i,4,item); |
|
142 | this->segmentsListTableWdgt->setItem(i,4,item); | |
143 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentMemsz(i),16)); |
|
143 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentMemsz(i),16)); | |
144 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
144 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); | |
145 | this->segmentsListTableWdgt->setItem(i,5,item); |
|
145 | this->segmentsListTableWdgt->setItem(i,5,item); | |
146 | item = new QTableWidgetItem(parser->getSegmentFlags(i)); |
|
146 | item = new QTableWidgetItem(parser->getSegmentFlags(i)); | |
147 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
147 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); | |
148 | this->segmentsListTableWdgt->setItem(i,6,item); |
|
148 | this->segmentsListTableWdgt->setItem(i,6,item); | |
149 | } |
|
149 | } | |
150 | this->segmentsListTableWdgt->resizeColumnsToContents(); |
|
150 | this->segmentsListTableWdgt->resizeColumnsToContents(); | |
151 | this->segmentsListTableWdgt->resizeRowsToContents(); |
|
151 | this->segmentsListTableWdgt->resizeRowsToContents(); | |
152 | } |
|
152 | } | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 |
|
155 | |||
156 |
|
156 | |||
157 |
|
157 | |||
158 |
|
158 | |||
159 |
|
159 | |||
160 |
|
160 | |||
161 |
|
161 | |||
162 |
|
162 | |||
163 |
|
163 | |||
164 |
|
164 |
@@ -1,64 +1,64 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 3 of the License, or |
|
7 | -- the Free Software Foundation; either version 3 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 | #ifndef ELFINFOWDGT_H |
|
22 | #ifndef ELFINFOWDGT_H | |
23 | #define ELFINFOWDGT_H |
|
23 | #define ELFINFOWDGT_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include "elfparser.h" |
|
26 | #include "elfparser.h" | |
27 | #include <QVBoxLayout> |
|
27 | #include <QVBoxLayout> | |
28 | #include <QHBoxLayout> |
|
28 | #include <QHBoxLayout> | |
29 | #include <QLabel> |
|
29 | #include <QLabel> | |
30 | #include <QTextEdit> |
|
30 | #include <QTextEdit> | |
31 | #include <QTableWidget> |
|
31 | #include <QTableWidget> | |
32 | #include <qhexedit.h> |
|
32 | #include <qhexedit.h> | |
33 | #include <QSplitter> |
|
33 | #include <QSplitter> | |
34 |
|
34 | |||
35 | class elfInfoWdgt : public QWidget |
|
35 | class elfInfoWdgt : public QWidget | |
36 | { |
|
36 | { | |
37 | Q_OBJECT |
|
37 | Q_OBJECT | |
38 | public: |
|
38 | public: | |
39 | explicit elfInfoWdgt(QWidget *parent = 0); |
|
39 | explicit elfInfoWdgt(QWidget *parent = 0); | |
40 |
|
40 | |||
41 | signals: |
|
41 | signals: | |
42 |
|
42 | |||
43 |
|
43 | |||
44 | public slots: |
|
44 | public slots: | |
45 | void updateInfo(elfparser* parser); |
|
45 | void updateInfo(elfparser* parser); | |
46 | void cellActivated ( int row, int column ); |
|
46 | void cellActivated ( int row, int column ); | |
47 |
|
47 | |||
48 | private: |
|
48 | private: | |
49 | void updateSectionsTable(elfparser* parser); |
|
49 | void updateSectionsTable(elfparser* parser); | |
50 | void updateSegmentsTable(elfparser* parser); |
|
50 | void updateSegmentsTable(elfparser* parser); | |
51 | QVBoxLayout* mainLayout; |
|
51 | QVBoxLayout* mainLayout; | |
52 | QLabel* ElfArchitecture; |
|
52 | QLabel* ElfArchitecture; | |
53 | QLabel* ElfType; |
|
53 | QLabel* ElfType; | |
54 | QLabel* ElfVersion; |
|
54 | QLabel* ElfVersion; | |
55 | QTableWidget* segmentsListTableWdgt,*sectionsListTableWdgt; |
|
55 | QTableWidget* segmentsListTableWdgt,*sectionsListTableWdgt; | |
56 | QHexEdit* hexViewer; |
|
56 | QHexEdit* hexViewer; | |
57 | QSplitter* splitter; |
|
57 | QSplitter* splitter; | |
58 | QWidget* elfInfoWdgtLay; |
|
58 | QWidget* elfInfoWdgtLay; | |
59 | QVBoxLayout* elfInfoWdgtLayout; |
|
59 | QVBoxLayout* elfInfoWdgtLayout; | |
60 | elfparser* parser; |
|
60 | elfparser* parser; | |
61 |
|
61 | |||
62 | }; |
|
62 | }; | |
63 |
|
63 | |||
64 | #endif // ELFINFOWDGT_H |
|
64 | #endif // ELFINFOWDGT_H |
@@ -1,701 +1,701 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 3 of the License, or |
|
7 | -- the Free Software Foundation; either version 3 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 "elfparser.h" |
|
22 | #include "elfparser.h" | |
23 | #include <sys/types.h> |
|
23 | #include <sys/types.h> | |
24 | #include <sys/stat.h> |
|
24 | #include <sys/stat.h> | |
25 | #include <fcntl.h> |
|
25 | #include <fcntl.h> | |
26 | #include <unistd.h> |
|
26 | #include <unistd.h> | |
27 |
|
27 | |||
28 | void elfresolveMachine(Elf64_Half e_machine,char* MachineName) |
|
28 | void elfresolveMachine(Elf64_Half e_machine,char* MachineName) | |
29 | { |
|
29 | { | |
30 |
|
30 | |||
31 | //Update from with bash script don't write it by yourself! |
|
31 | //Update from with bash script don't write it by yourself! | |
32 | switch(e_machine) |
|
32 | switch(e_machine) | |
33 | { |
|
33 | { | |
34 | case EM_NONE : |
|
34 | case EM_NONE : | |
35 | strcpy(MachineName,"No machine"); |
|
35 | strcpy(MachineName,"No machine"); | |
36 | break; |
|
36 | break; | |
37 | case EM_M32 : |
|
37 | case EM_M32 : | |
38 | strcpy(MachineName,"AT&T WE 32100"); |
|
38 | strcpy(MachineName,"AT&T WE 32100"); | |
39 | break; |
|
39 | break; | |
40 | case EM_SPARC : |
|
40 | case EM_SPARC : | |
41 | strcpy(MachineName,"SUN SPARC"); |
|
41 | strcpy(MachineName,"SUN SPARC"); | |
42 | break; |
|
42 | break; | |
43 | case EM_386 : |
|
43 | case EM_386 : | |
44 | strcpy(MachineName,"Intel 80386"); |
|
44 | strcpy(MachineName,"Intel 80386"); | |
45 | break; |
|
45 | break; | |
46 | case EM_68K : |
|
46 | case EM_68K : | |
47 | strcpy(MachineName,"Motorola m68k family"); |
|
47 | strcpy(MachineName,"Motorola m68k family"); | |
48 | break; |
|
48 | break; | |
49 | case EM_88K : |
|
49 | case EM_88K : | |
50 | strcpy(MachineName,"Motorola m88k family"); |
|
50 | strcpy(MachineName,"Motorola m88k family"); | |
51 | break; |
|
51 | break; | |
52 | case EM_860 : |
|
52 | case EM_860 : | |
53 | strcpy(MachineName,"Intel 80860"); |
|
53 | strcpy(MachineName,"Intel 80860"); | |
54 | break; |
|
54 | break; | |
55 | case EM_MIPS : |
|
55 | case EM_MIPS : | |
56 | strcpy(MachineName,"MIPS R3000 big-endian"); |
|
56 | strcpy(MachineName,"MIPS R3000 big-endian"); | |
57 | break; |
|
57 | break; | |
58 | case EM_S370 : |
|
58 | case EM_S370 : | |
59 | strcpy(MachineName,"IBM System\/370"); |
|
59 | strcpy(MachineName,"IBM System\/370"); | |
60 | break; |
|
60 | break; | |
61 | case EM_MIPS_RS3_LE : |
|
61 | case EM_MIPS_RS3_LE : | |
62 | strcpy(MachineName,"MIPS R3000 little-endian"); |
|
62 | strcpy(MachineName,"MIPS R3000 little-endian"); | |
63 | break; |
|
63 | break; | |
64 | case EM_PARISC : |
|
64 | case EM_PARISC : | |
65 | strcpy(MachineName,"HPPA"); |
|
65 | strcpy(MachineName,"HPPA"); | |
66 | break; |
|
66 | break; | |
67 | case EM_VPP500 : |
|
67 | case EM_VPP500 : | |
68 | strcpy(MachineName,"Fujitsu VPP500"); |
|
68 | strcpy(MachineName,"Fujitsu VPP500"); | |
69 | break; |
|
69 | break; | |
70 | case EM_SPARC32PLUS : |
|
70 | case EM_SPARC32PLUS : | |
71 | strcpy(MachineName,"Sun's \"v8plus\""); |
|
71 | strcpy(MachineName,"Sun's \"v8plus\""); | |
72 | break; |
|
72 | break; | |
73 | case EM_960 : |
|
73 | case EM_960 : | |
74 | strcpy(MachineName,"Intel 80960"); |
|
74 | strcpy(MachineName,"Intel 80960"); | |
75 | break; |
|
75 | break; | |
76 | case EM_PPC : |
|
76 | case EM_PPC : | |
77 | strcpy(MachineName,"PowerPC"); |
|
77 | strcpy(MachineName,"PowerPC"); | |
78 | break; |
|
78 | break; | |
79 | case EM_PPC64 : |
|
79 | case EM_PPC64 : | |
80 | strcpy(MachineName,"PowerPC 64-bit"); |
|
80 | strcpy(MachineName,"PowerPC 64-bit"); | |
81 | break; |
|
81 | break; | |
82 | case EM_S390 : |
|
82 | case EM_S390 : | |
83 | strcpy(MachineName,"IBM S390"); |
|
83 | strcpy(MachineName,"IBM S390"); | |
84 | break; |
|
84 | break; | |
85 | case EM_V800 : |
|
85 | case EM_V800 : | |
86 | strcpy(MachineName,"NEC V800 series"); |
|
86 | strcpy(MachineName,"NEC V800 series"); | |
87 | break; |
|
87 | break; | |
88 | case EM_FR20 : |
|
88 | case EM_FR20 : | |
89 | strcpy(MachineName,"Fujitsu FR20"); |
|
89 | strcpy(MachineName,"Fujitsu FR20"); | |
90 | break; |
|
90 | break; | |
91 | case EM_RH32 : |
|
91 | case EM_RH32 : | |
92 | strcpy(MachineName,"TRW RH-32"); |
|
92 | strcpy(MachineName,"TRW RH-32"); | |
93 | break; |
|
93 | break; | |
94 | case EM_RCE : |
|
94 | case EM_RCE : | |
95 | strcpy(MachineName,"Motorola RCE"); |
|
95 | strcpy(MachineName,"Motorola RCE"); | |
96 | break; |
|
96 | break; | |
97 | case EM_ARM : |
|
97 | case EM_ARM : | |
98 | strcpy(MachineName,"ARM"); |
|
98 | strcpy(MachineName,"ARM"); | |
99 | break; |
|
99 | break; | |
100 | case EM_SH : |
|
100 | case EM_SH : | |
101 | strcpy(MachineName,"Hitachi SH"); |
|
101 | strcpy(MachineName,"Hitachi SH"); | |
102 | break; |
|
102 | break; | |
103 | case EM_SPARCV9 : |
|
103 | case EM_SPARCV9 : | |
104 | strcpy(MachineName,"SPARC v9 64-bit"); |
|
104 | strcpy(MachineName,"SPARC v9 64-bit"); | |
105 | break; |
|
105 | break; | |
106 | case EM_TRICORE : |
|
106 | case EM_TRICORE : | |
107 | strcpy(MachineName,"Siemens Tricore"); |
|
107 | strcpy(MachineName,"Siemens Tricore"); | |
108 | break; |
|
108 | break; | |
109 | case EM_ARC : |
|
109 | case EM_ARC : | |
110 | strcpy(MachineName,"Argonaut RISC Core"); |
|
110 | strcpy(MachineName,"Argonaut RISC Core"); | |
111 | break; |
|
111 | break; | |
112 | case EM_H8_300 : |
|
112 | case EM_H8_300 : | |
113 | strcpy(MachineName,"Hitachi H8\/300"); |
|
113 | strcpy(MachineName,"Hitachi H8\/300"); | |
114 | break; |
|
114 | break; | |
115 | case EM_H8_300H : |
|
115 | case EM_H8_300H : | |
116 | strcpy(MachineName,"Hitachi H8\/300H"); |
|
116 | strcpy(MachineName,"Hitachi H8\/300H"); | |
117 | break; |
|
117 | break; | |
118 | case EM_H8S : |
|
118 | case EM_H8S : | |
119 | strcpy(MachineName,"Hitachi H8S"); |
|
119 | strcpy(MachineName,"Hitachi H8S"); | |
120 | break; |
|
120 | break; | |
121 | case EM_H8_500 : |
|
121 | case EM_H8_500 : | |
122 | strcpy(MachineName,"Hitachi H8\/500"); |
|
122 | strcpy(MachineName,"Hitachi H8\/500"); | |
123 | break; |
|
123 | break; | |
124 | case EM_IA_64 : |
|
124 | case EM_IA_64 : | |
125 | strcpy(MachineName,"Intel Merced"); |
|
125 | strcpy(MachineName,"Intel Merced"); | |
126 | break; |
|
126 | break; | |
127 | case EM_MIPS_X : |
|
127 | case EM_MIPS_X : | |
128 | strcpy(MachineName,"Stanford MIPS-X"); |
|
128 | strcpy(MachineName,"Stanford MIPS-X"); | |
129 | break; |
|
129 | break; | |
130 | case EM_COLDFIRE : |
|
130 | case EM_COLDFIRE : | |
131 | strcpy(MachineName,"Motorola Coldfire"); |
|
131 | strcpy(MachineName,"Motorola Coldfire"); | |
132 | break; |
|
132 | break; | |
133 | case EM_68HC12 : |
|
133 | case EM_68HC12 : | |
134 | strcpy(MachineName,"Motorola M68HC12"); |
|
134 | strcpy(MachineName,"Motorola M68HC12"); | |
135 | break; |
|
135 | break; | |
136 | case EM_MMA : |
|
136 | case EM_MMA : | |
137 | strcpy(MachineName,"Fujitsu MMA Multimedia Accelerator"); |
|
137 | strcpy(MachineName,"Fujitsu MMA Multimedia Accelerator"); | |
138 | break; |
|
138 | break; | |
139 | case EM_PCP : |
|
139 | case EM_PCP : | |
140 | strcpy(MachineName,"Siemens PCP"); |
|
140 | strcpy(MachineName,"Siemens PCP"); | |
141 | break; |
|
141 | break; | |
142 | case EM_NCPU : |
|
142 | case EM_NCPU : | |
143 | strcpy(MachineName,"Sony nCPU embeeded RISC"); |
|
143 | strcpy(MachineName,"Sony nCPU embeeded RISC"); | |
144 | break; |
|
144 | break; | |
145 | case EM_NDR1 : |
|
145 | case EM_NDR1 : | |
146 | strcpy(MachineName,"Denso NDR1 microprocessor"); |
|
146 | strcpy(MachineName,"Denso NDR1 microprocessor"); | |
147 | break; |
|
147 | break; | |
148 | case EM_STARCORE : |
|
148 | case EM_STARCORE : | |
149 | strcpy(MachineName,"Motorola Start*Core processor"); |
|
149 | strcpy(MachineName,"Motorola Start*Core processor"); | |
150 | break; |
|
150 | break; | |
151 | case EM_ME16 : |
|
151 | case EM_ME16 : | |
152 | strcpy(MachineName,"Toyota ME16 processor"); |
|
152 | strcpy(MachineName,"Toyota ME16 processor"); | |
153 | break; |
|
153 | break; | |
154 | case EM_ST100 : |
|
154 | case EM_ST100 : | |
155 | strcpy(MachineName,"STMicroelectronic ST100 processor"); |
|
155 | strcpy(MachineName,"STMicroelectronic ST100 processor"); | |
156 | break; |
|
156 | break; | |
157 | case EM_TINYJ : |
|
157 | case EM_TINYJ : | |
158 | strcpy(MachineName,"Advanced Logic Corp. Tinyj emb.fam"); |
|
158 | strcpy(MachineName,"Advanced Logic Corp. Tinyj emb.fam"); | |
159 | break; |
|
159 | break; | |
160 | case EM_X86_64 : |
|
160 | case EM_X86_64 : | |
161 | strcpy(MachineName,"AMD x86-64 architecture"); |
|
161 | strcpy(MachineName,"AMD x86-64 architecture"); | |
162 | break; |
|
162 | break; | |
163 | case EM_PDSP : |
|
163 | case EM_PDSP : | |
164 | strcpy(MachineName,"Sony DSP Processor"); |
|
164 | strcpy(MachineName,"Sony DSP Processor"); | |
165 | break; |
|
165 | break; | |
166 | case EM_FX66 : |
|
166 | case EM_FX66 : | |
167 | strcpy(MachineName,"Siemens FX66 microcontroller"); |
|
167 | strcpy(MachineName,"Siemens FX66 microcontroller"); | |
168 | break; |
|
168 | break; | |
169 | case EM_ST9PLUS : |
|
169 | case EM_ST9PLUS : | |
170 | strcpy(MachineName,"STMicroelectronics ST9+ 8\/16 mc"); |
|
170 | strcpy(MachineName,"STMicroelectronics ST9+ 8\/16 mc"); | |
171 | break; |
|
171 | break; | |
172 | case EM_ST7 : |
|
172 | case EM_ST7 : | |
173 | strcpy(MachineName,"STmicroelectronics ST7 8 bit mc"); |
|
173 | strcpy(MachineName,"STmicroelectronics ST7 8 bit mc"); | |
174 | break; |
|
174 | break; | |
175 | case EM_68HC16 : |
|
175 | case EM_68HC16 : | |
176 | strcpy(MachineName,"Motorola MC68HC16 microcontroller"); |
|
176 | strcpy(MachineName,"Motorola MC68HC16 microcontroller"); | |
177 | break; |
|
177 | break; | |
178 | case EM_68HC11 : |
|
178 | case EM_68HC11 : | |
179 | strcpy(MachineName,"Motorola MC68HC11 microcontroller"); |
|
179 | strcpy(MachineName,"Motorola MC68HC11 microcontroller"); | |
180 | break; |
|
180 | break; | |
181 | case EM_68HC08 : |
|
181 | case EM_68HC08 : | |
182 | strcpy(MachineName,"Motorola MC68HC08 microcontroller"); |
|
182 | strcpy(MachineName,"Motorola MC68HC08 microcontroller"); | |
183 | break; |
|
183 | break; | |
184 | case EM_68HC05 : |
|
184 | case EM_68HC05 : | |
185 | strcpy(MachineName,"Motorola MC68HC05 microcontroller"); |
|
185 | strcpy(MachineName,"Motorola MC68HC05 microcontroller"); | |
186 | break; |
|
186 | break; | |
187 | case EM_SVX : |
|
187 | case EM_SVX : | |
188 | strcpy(MachineName,"Silicon Graphics SVx"); |
|
188 | strcpy(MachineName,"Silicon Graphics SVx"); | |
189 | break; |
|
189 | break; | |
190 | case EM_ST19 : |
|
190 | case EM_ST19 : | |
191 | strcpy(MachineName,"STMicroelectronics ST19 8 bit mc"); |
|
191 | strcpy(MachineName,"STMicroelectronics ST19 8 bit mc"); | |
192 | break; |
|
192 | break; | |
193 | case EM_VAX : |
|
193 | case EM_VAX : | |
194 | strcpy(MachineName,"Digital VAX"); |
|
194 | strcpy(MachineName,"Digital VAX"); | |
195 | break; |
|
195 | break; | |
196 | case EM_CRIS : |
|
196 | case EM_CRIS : | |
197 | strcpy(MachineName,"Axis Communications 32-bit embedded processor"); |
|
197 | strcpy(MachineName,"Axis Communications 32-bit embedded processor"); | |
198 | break; |
|
198 | break; | |
199 | case EM_JAVELIN : |
|
199 | case EM_JAVELIN : | |
200 | strcpy(MachineName,"Infineon Technologies 32-bit embedded processor"); |
|
200 | strcpy(MachineName,"Infineon Technologies 32-bit embedded processor"); | |
201 | break; |
|
201 | break; | |
202 | case EM_FIREPATH : |
|
202 | case EM_FIREPATH : | |
203 | strcpy(MachineName,"Element 14 64-bit DSP Processor"); |
|
203 | strcpy(MachineName,"Element 14 64-bit DSP Processor"); | |
204 | break; |
|
204 | break; | |
205 | case EM_ZSP : |
|
205 | case EM_ZSP : | |
206 | strcpy(MachineName,"LSI Logic 16-bit DSP Processor"); |
|
206 | strcpy(MachineName,"LSI Logic 16-bit DSP Processor"); | |
207 | break; |
|
207 | break; | |
208 | case EM_MMIX : |
|
208 | case EM_MMIX : | |
209 | strcpy(MachineName,"Donald Knuth's educational 64-bit processor"); |
|
209 | strcpy(MachineName,"Donald Knuth's educational 64-bit processor"); | |
210 | break; |
|
210 | break; | |
211 | case EM_HUANY : |
|
211 | case EM_HUANY : | |
212 | strcpy(MachineName,"Harvard University machine-independent object files"); |
|
212 | strcpy(MachineName,"Harvard University machine-independent object files"); | |
213 | break; |
|
213 | break; | |
214 | case EM_PRISM : |
|
214 | case EM_PRISM : | |
215 | strcpy(MachineName,"SiTera Prism"); |
|
215 | strcpy(MachineName,"SiTera Prism"); | |
216 | break; |
|
216 | break; | |
217 | case EM_AVR : |
|
217 | case EM_AVR : | |
218 | strcpy(MachineName,"Atmel AVR 8-bit microcontroller"); |
|
218 | strcpy(MachineName,"Atmel AVR 8-bit microcontroller"); | |
219 | break; |
|
219 | break; | |
220 | case EM_FR30 : |
|
220 | case EM_FR30 : | |
221 | strcpy(MachineName,"Fujitsu FR30"); |
|
221 | strcpy(MachineName,"Fujitsu FR30"); | |
222 | break; |
|
222 | break; | |
223 | case EM_D10V : |
|
223 | case EM_D10V : | |
224 | strcpy(MachineName,"Mitsubishi D10V"); |
|
224 | strcpy(MachineName,"Mitsubishi D10V"); | |
225 | break; |
|
225 | break; | |
226 | case EM_D30V : |
|
226 | case EM_D30V : | |
227 | strcpy(MachineName,"Mitsubishi D30V"); |
|
227 | strcpy(MachineName,"Mitsubishi D30V"); | |
228 | break; |
|
228 | break; | |
229 | case EM_V850 : |
|
229 | case EM_V850 : | |
230 | strcpy(MachineName,"NEC v850"); |
|
230 | strcpy(MachineName,"NEC v850"); | |
231 | break; |
|
231 | break; | |
232 | case EM_M32R : |
|
232 | case EM_M32R : | |
233 | strcpy(MachineName,"Mitsubishi M32R"); |
|
233 | strcpy(MachineName,"Mitsubishi M32R"); | |
234 | break; |
|
234 | break; | |
235 | case EM_MN10300 : |
|
235 | case EM_MN10300 : | |
236 | strcpy(MachineName,"Matsushita MN10300"); |
|
236 | strcpy(MachineName,"Matsushita MN10300"); | |
237 | break; |
|
237 | break; | |
238 | case EM_MN10200 : |
|
238 | case EM_MN10200 : | |
239 | strcpy(MachineName,"Matsushita MN10200"); |
|
239 | strcpy(MachineName,"Matsushita MN10200"); | |
240 | break; |
|
240 | break; | |
241 | case EM_PJ : |
|
241 | case EM_PJ : | |
242 | strcpy(MachineName,"picoJava"); |
|
242 | strcpy(MachineName,"picoJava"); | |
243 | break; |
|
243 | break; | |
244 | case EM_OPENRISC : |
|
244 | case EM_OPENRISC : | |
245 | strcpy(MachineName,"OpenRISC 32-bit embedded processor"); |
|
245 | strcpy(MachineName,"OpenRISC 32-bit embedded processor"); | |
246 | break; |
|
246 | break; | |
247 | case EM_ARC_A5 : |
|
247 | case EM_ARC_A5 : | |
248 | strcpy(MachineName,"ARC Cores Tangent-A5"); |
|
248 | strcpy(MachineName,"ARC Cores Tangent-A5"); | |
249 | break; |
|
249 | break; | |
250 | case EM_XTENSA : |
|
250 | case EM_XTENSA : | |
251 | strcpy(MachineName,"Tensilica Xtensa Architecture"); |
|
251 | strcpy(MachineName,"Tensilica Xtensa Architecture"); | |
252 | break; |
|
252 | break; | |
253 | default: |
|
253 | default: | |
254 | strcpy(MachineName,"Unknow Machine"); |
|
254 | strcpy(MachineName,"Unknow Machine"); | |
255 | break; |
|
255 | break; | |
256 | } |
|
256 | } | |
257 |
|
257 | |||
258 | } |
|
258 | } | |
259 |
|
259 | |||
260 |
|
260 | |||
261 | elfparser::elfparser() |
|
261 | elfparser::elfparser() | |
262 | { |
|
262 | { | |
263 | this->opened = false; |
|
263 | this->opened = false; | |
264 | this->type_elf = false; |
|
264 | this->type_elf = false; | |
265 | this->elfFile = NULL; |
|
265 | this->elfFile = NULL; | |
266 | this->e = NULL; |
|
266 | this->e = NULL; | |
267 | } |
|
267 | } | |
268 |
|
268 | |||
269 |
|
269 | |||
270 | int elfparser::setFilename(const QString &name) |
|
270 | int elfparser::setFilename(const QString &name) | |
271 | { |
|
271 | { | |
272 | this->closeFile(); |
|
272 | this->closeFile(); | |
273 | if(elf_version(EV_CURRENT)==EV_NONE)return 0; |
|
273 | if(elf_version(EV_CURRENT)==EV_NONE)return 0; | |
274 | #ifdef _ELF_WINDOWS_ |
|
274 | #ifdef _ELF_WINDOWS_ | |
275 | this->elfFile = open(name.toStdString().c_str(),O_RDONLY|O_BINARY ,0); |
|
275 | this->elfFile = open(name.toStdString().c_str(),O_RDONLY|O_BINARY ,0); | |
276 | #else |
|
276 | #else | |
277 | this->elfFile = open(name.toStdString().c_str(),O_RDONLY ,0); |
|
277 | this->elfFile = open(name.toStdString().c_str(),O_RDONLY ,0); | |
278 | #endif |
|
278 | #endif | |
279 | if(this->elfFile==NULL)return 0; |
|
279 | if(this->elfFile==NULL)return 0; | |
280 | this->e = elf_begin(this->elfFile,ELF_C_READ,NULL); |
|
280 | this->e = elf_begin(this->elfFile,ELF_C_READ,NULL); | |
281 | if(this->e==NULL)return 0; |
|
281 | if(this->e==NULL)return 0; | |
282 | this->ek = elf_kind(this->e); |
|
282 | this->ek = elf_kind(this->e); | |
283 | gelf_getehdr (this->e, &this->ehdr ); |
|
283 | gelf_getehdr (this->e, &this->ehdr ); | |
284 | elf_getshdrstrndx (this->e, &this->shstrndx); |
|
284 | elf_getshdrstrndx (this->e, &this->shstrndx); | |
285 | this->updateSegments(); |
|
285 | this->updateSegments(); | |
286 | this->updateSections(); |
|
286 | this->updateSections(); | |
287 | return 1; |
|
287 | return 1; | |
288 | } |
|
288 | } | |
289 |
|
289 | |||
290 |
|
290 | |||
291 | int elfparser::closeFile() |
|
291 | int elfparser::closeFile() | |
292 | { |
|
292 | { | |
293 | if(this->elfFile!=NULL) |
|
293 | if(this->elfFile!=NULL) | |
294 | { |
|
294 | { | |
295 | if(this->e!=NULL) |
|
295 | if(this->e!=NULL) | |
296 | { |
|
296 | { | |
297 | elf_end(this->e); |
|
297 | elf_end(this->e); | |
298 | this->e = NULL; |
|
298 | this->e = NULL; | |
299 | } |
|
299 | } | |
300 | close(this->elfFile); |
|
300 | close(this->elfFile); | |
301 | this->elfFile = NULL; |
|
301 | this->elfFile = NULL; | |
302 | } |
|
302 | } | |
303 | return 0; |
|
303 | return 0; | |
304 | } |
|
304 | } | |
305 |
|
305 | |||
306 |
|
306 | |||
307 | bool elfparser::isopened() |
|
307 | bool elfparser::isopened() | |
308 | { |
|
308 | { | |
309 | return this->opened; |
|
309 | return this->opened; | |
310 | } |
|
310 | } | |
311 |
|
311 | |||
312 |
|
312 | |||
313 | bool elfparser::iself() |
|
313 | bool elfparser::iself() | |
314 | { |
|
314 | { | |
315 | return this->type_elf; |
|
315 | return this->type_elf; | |
316 | } |
|
316 | } | |
317 |
|
317 | |||
318 |
|
318 | |||
319 | QString elfparser::getArchitecture() |
|
319 | QString elfparser::getArchitecture() | |
320 | { |
|
320 | { | |
321 | QString arch(""); |
|
321 | QString arch(""); | |
322 | char archName[256]=""; |
|
322 | char archName[256]=""; | |
323 | if(this->e!=NULL) |
|
323 | if(this->e!=NULL) | |
324 | { |
|
324 | { | |
325 | elfresolveMachine(this->ehdr.e_machine,archName); |
|
325 | elfresolveMachine(this->ehdr.e_machine,archName); | |
326 | arch = archName; |
|
326 | arch = archName; | |
327 | } |
|
327 | } | |
328 | return arch; |
|
328 | return arch; | |
329 | } |
|
329 | } | |
330 |
|
330 | |||
331 |
|
331 | |||
332 | QString elfparser::getType() |
|
332 | QString elfparser::getType() | |
333 | { |
|
333 | { | |
334 | QString kind(""); |
|
334 | QString kind(""); | |
335 | if(this->e!=NULL) |
|
335 | if(this->e!=NULL) | |
336 | { |
|
336 | { | |
337 | switch(this->ek) |
|
337 | switch(this->ek) | |
338 | { |
|
338 | { | |
339 | case ELF_K_AR: |
|
339 | case ELF_K_AR: | |
340 | kind = "Archive"; |
|
340 | kind = "Archive"; | |
341 | break; |
|
341 | break; | |
342 | case ELF_K_ELF: |
|
342 | case ELF_K_ELF: | |
343 | kind = "Elf"; |
|
343 | kind = "Elf"; | |
344 | break; |
|
344 | break; | |
345 | case ELF_K_COFF: |
|
345 | case ELF_K_COFF: | |
346 | kind = "COFF"; |
|
346 | kind = "COFF"; | |
347 | break; |
|
347 | break; | |
348 | case ELF_K_NUM: |
|
348 | case ELF_K_NUM: | |
349 | kind = "NUM"; |
|
349 | kind = "NUM"; | |
350 | break; |
|
350 | break; | |
351 | case ELF_K_NONE: |
|
351 | case ELF_K_NONE: | |
352 | kind = "Data"; |
|
352 | kind = "Data"; | |
353 | break; |
|
353 | break; | |
354 | default: |
|
354 | default: | |
355 | kind = "Unknow"; |
|
355 | kind = "Unknow"; | |
356 | break; |
|
356 | break; | |
357 | } |
|
357 | } | |
358 | } |
|
358 | } | |
359 | return kind; |
|
359 | return kind; | |
360 | } |
|
360 | } | |
361 |
|
361 | |||
362 |
|
362 | |||
363 | int32_t elfparser::getVersion() |
|
363 | int32_t elfparser::getVersion() | |
364 | { |
|
364 | { | |
365 | if(this->e!=NULL) |
|
365 | if(this->e!=NULL) | |
366 | { |
|
366 | { | |
367 | return this->ehdr.e_version; |
|
367 | return this->ehdr.e_version; | |
368 | } |
|
368 | } | |
369 | } |
|
369 | } | |
370 |
|
370 | |||
371 |
|
371 | |||
372 | int elfparser::getSectioncount() |
|
372 | int elfparser::getSectioncount() | |
373 | { |
|
373 | { | |
374 | return (int)this->SectionCount; |
|
374 | return (int)this->SectionCount; | |
375 | } |
|
375 | } | |
376 |
|
376 | |||
377 |
|
377 | |||
378 | int elfparser::getSegmentcount() |
|
378 | int elfparser::getSegmentcount() | |
379 | { |
|
379 | { | |
380 | return (int)this->SegmentCount; |
|
380 | return (int)this->SegmentCount; | |
381 | } |
|
381 | } | |
382 |
|
382 | |||
383 |
|
383 | |||
384 | QString elfparser::getSegmentType(int index) |
|
384 | QString elfparser::getSegmentType(int index) | |
385 | { |
|
385 | { | |
386 | QString type(""); |
|
386 | QString type(""); | |
387 | if(this->e!=NULL) |
|
387 | if(this->e!=NULL) | |
388 | { |
|
388 | { | |
389 | if(index < this->Segments.count()) |
|
389 | if(index < this->Segments.count()) | |
390 | { |
|
390 | { | |
391 | switch(this->Segments.at(index)->p_type) |
|
391 | switch(this->Segments.at(index)->p_type) | |
392 | { |
|
392 | { | |
393 | case PT_NULL: |
|
393 | case PT_NULL: | |
394 | type = "Program header table entry unused"; |
|
394 | type = "Program header table entry unused"; | |
395 | break; |
|
395 | break; | |
396 | case PT_LOAD: |
|
396 | case PT_LOAD: | |
397 | type = "Loadable program segment"; |
|
397 | type = "Loadable program segment"; | |
398 | break; |
|
398 | break; | |
399 | case PT_DYNAMIC : |
|
399 | case PT_DYNAMIC : | |
400 | type = "Dynamic linking information"; |
|
400 | type = "Dynamic linking information"; | |
401 | break; |
|
401 | break; | |
402 | case PT_INTERP: |
|
402 | case PT_INTERP: | |
403 | type ="Program interpreter"; |
|
403 | type ="Program interpreter"; | |
404 | break; |
|
404 | break; | |
405 | case PT_NOTE: |
|
405 | case PT_NOTE: | |
406 | type = "Auxiliary information"; |
|
406 | type = "Auxiliary information"; | |
407 | break; |
|
407 | break; | |
408 | case PT_SHLIB: |
|
408 | case PT_SHLIB: | |
409 | type = "Reserved"; |
|
409 | type = "Reserved"; | |
410 | break; |
|
410 | break; | |
411 | case PT_PHDR: |
|
411 | case PT_PHDR: | |
412 | type = "Entry for header table itself"; |
|
412 | type = "Entry for header table itself"; | |
413 | break; |
|
413 | break; | |
414 | case PT_TLS: |
|
414 | case PT_TLS: | |
415 | type = "Thread-local storage segment"; |
|
415 | type = "Thread-local storage segment"; | |
416 | break; |
|
416 | break; | |
417 | case PT_NUM: |
|
417 | case PT_NUM: | |
418 | type = "Number of defined types"; |
|
418 | type = "Number of defined types"; | |
419 | break; |
|
419 | break; | |
420 | case PT_LOOS: |
|
420 | case PT_LOOS: | |
421 | type = "Start of OS-specific"; |
|
421 | type = "Start of OS-specific"; | |
422 | break; |
|
422 | break; | |
423 | case PT_SUNWSTACK: |
|
423 | case PT_SUNWSTACK: | |
424 | type = "Stack segment"; |
|
424 | type = "Stack segment"; | |
425 | break; |
|
425 | break; | |
426 | case PT_LOPROC: |
|
426 | case PT_LOPROC: | |
427 | type = "Start of processor-specific"; |
|
427 | type = "Start of processor-specific"; | |
428 | break; |
|
428 | break; | |
429 | case PT_HIPROC: |
|
429 | case PT_HIPROC: | |
430 | type = "End of processor-specific"; |
|
430 | type = "End of processor-specific"; | |
431 | break; |
|
431 | break; | |
432 | default: |
|
432 | default: | |
433 | type = "Unknow Section Type"; |
|
433 | type = "Unknow Section Type"; | |
434 | break; |
|
434 | break; | |
435 | } |
|
435 | } | |
436 | } |
|
436 | } | |
437 | } |
|
437 | } | |
438 |
|
438 | |||
439 | return type; |
|
439 | return type; | |
440 | } |
|
440 | } | |
441 |
|
441 | |||
442 |
|
442 | |||
443 | int64_t elfparser::getSegmentOffset(int index) |
|
443 | int64_t elfparser::getSegmentOffset(int index) | |
444 | { |
|
444 | { | |
445 | int64_t Offset; |
|
445 | int64_t Offset; | |
446 | if(this->e!=NULL) |
|
446 | if(this->e!=NULL) | |
447 | { |
|
447 | { | |
448 | if(index < this->Segments.count()) |
|
448 | if(index < this->Segments.count()) | |
449 | { |
|
449 | { | |
450 | Offset = (int64_t)this->Segments.at(index)->p_offset; |
|
450 | Offset = (int64_t)this->Segments.at(index)->p_offset; | |
451 | } |
|
451 | } | |
452 | } |
|
452 | } | |
453 | return Offset; |
|
453 | return Offset; | |
454 | } |
|
454 | } | |
455 |
|
455 | |||
456 |
|
456 | |||
457 | int64_t elfparser::getSegmentVaddr(int index) |
|
457 | int64_t elfparser::getSegmentVaddr(int index) | |
458 | { |
|
458 | { | |
459 | int64_t Vaddr = 0; |
|
459 | int64_t Vaddr = 0; | |
460 | if(this->e!=NULL) |
|
460 | if(this->e!=NULL) | |
461 | { |
|
461 | { | |
462 | if(index < this->Segments.count()) |
|
462 | if(index < this->Segments.count()) | |
463 | { |
|
463 | { | |
464 | Vaddr = (int64_t)this->Segments.at(index)->p_vaddr; |
|
464 | Vaddr = (int64_t)this->Segments.at(index)->p_vaddr; | |
465 | } |
|
465 | } | |
466 | } |
|
466 | } | |
467 | return Vaddr; |
|
467 | return Vaddr; | |
468 | } |
|
468 | } | |
469 |
|
469 | |||
470 |
|
470 | |||
471 | int64_t elfparser::getSegmentPaddr(int index) |
|
471 | int64_t elfparser::getSegmentPaddr(int index) | |
472 | { |
|
472 | { | |
473 | int64_t Paddr=0; |
|
473 | int64_t Paddr=0; | |
474 | if(this->e!=NULL) |
|
474 | if(this->e!=NULL) | |
475 | { |
|
475 | { | |
476 | if(index < this->Segments.count()) |
|
476 | if(index < this->Segments.count()) | |
477 | { |
|
477 | { | |
478 | Paddr = (int64_t)this->Segments.at(index)->p_paddr; |
|
478 | Paddr = (int64_t)this->Segments.at(index)->p_paddr; | |
479 | } |
|
479 | } | |
480 | } |
|
480 | } | |
481 | return Paddr; |
|
481 | return Paddr; | |
482 | } |
|
482 | } | |
483 |
|
483 | |||
484 | int64_t elfparser::getSectionPaddr(int index) |
|
484 | int64_t elfparser::getSectionPaddr(int index) | |
485 | { |
|
485 | { | |
486 | int64_t Paddr=0; |
|
486 | int64_t Paddr=0; | |
487 | if(this->e!=NULL) |
|
487 | if(this->e!=NULL) | |
488 | { |
|
488 | { | |
489 | if(index < this->sections.count()) |
|
489 | if(index < this->sections.count()) | |
490 | { |
|
490 | { | |
491 | Paddr = (int64_t)this->sections.at(index)->section_header->sh_addr; |
|
491 | Paddr = (int64_t)this->sections.at(index)->section_header->sh_addr; | |
492 | } |
|
492 | } | |
493 | } |
|
493 | } | |
494 | return Paddr; |
|
494 | return Paddr; | |
495 | } |
|
495 | } | |
496 |
|
496 | |||
497 |
|
497 | |||
498 | int64_t elfparser::getSegmentFilesz(int index) |
|
498 | int64_t elfparser::getSegmentFilesz(int index) | |
499 | { |
|
499 | { | |
500 | int64_t FileSz=0; |
|
500 | int64_t FileSz=0; | |
501 | if(this->e!=NULL) |
|
501 | if(this->e!=NULL) | |
502 | { |
|
502 | { | |
503 | if(index < this->Segments.count()) |
|
503 | if(index < this->Segments.count()) | |
504 | { |
|
504 | { | |
505 | FileSz = (int64_t)this->Segments.at(index)->p_filesz; |
|
505 | FileSz = (int64_t)this->Segments.at(index)->p_filesz; | |
506 | } |
|
506 | } | |
507 | } |
|
507 | } | |
508 | return FileSz; |
|
508 | return FileSz; | |
509 | } |
|
509 | } | |
510 |
|
510 | |||
511 | int64_t elfparser::getSectionDatasz(int index) |
|
511 | int64_t elfparser::getSectionDatasz(int index) | |
512 | { |
|
512 | { | |
513 | int64_t DataSz=0; |
|
513 | int64_t DataSz=0; | |
514 | if(this->e!=NULL) |
|
514 | if(this->e!=NULL) | |
515 | { |
|
515 | { | |
516 | if(index < this->sections.count()) |
|
516 | if(index < this->sections.count()) | |
517 | { |
|
517 | { | |
518 | DataSz = (int64_t)this->sections.at(index)->data->d_size; |
|
518 | DataSz = (int64_t)this->sections.at(index)->data->d_size; | |
519 | } |
|
519 | } | |
520 | } |
|
520 | } | |
521 | return DataSz; |
|
521 | return DataSz; | |
522 | } |
|
522 | } | |
523 |
|
523 | |||
524 | bool elfparser::getSectionData(int index, char **buffer) |
|
524 | bool elfparser::getSectionData(int index, char **buffer) | |
525 | { |
|
525 | { | |
526 | if(this->e!=NULL) |
|
526 | if(this->e!=NULL) | |
527 | { |
|
527 | { | |
528 | if(index < this->sections.count()) |
|
528 | if(index < this->sections.count()) | |
529 | { |
|
529 | { | |
530 | *buffer = (char *)this->sections.at(index)->data->d_buf; |
|
530 | *buffer = (char *)this->sections.at(index)->data->d_buf; | |
531 | return true; |
|
531 | return true; | |
532 | } |
|
532 | } | |
533 | } |
|
533 | } | |
534 | return false; |
|
534 | return false; | |
535 | } |
|
535 | } | |
536 |
|
536 | |||
537 |
|
537 | |||
538 | int64_t elfparser::getSegmentMemsz(int index) |
|
538 | int64_t elfparser::getSegmentMemsz(int index) | |
539 | { |
|
539 | { | |
540 | int64_t MemSz=0; |
|
540 | int64_t MemSz=0; | |
541 | if(this->e!=NULL) |
|
541 | if(this->e!=NULL) | |
542 | { |
|
542 | { | |
543 | if(index < this->Segments.count()) |
|
543 | if(index < this->Segments.count()) | |
544 | { |
|
544 | { | |
545 | MemSz = (int64_t)this->Segments.at(index)->p_memsz; |
|
545 | MemSz = (int64_t)this->Segments.at(index)->p_memsz; | |
546 | } |
|
546 | } | |
547 | } |
|
547 | } | |
548 | return MemSz; |
|
548 | return MemSz; | |
549 | } |
|
549 | } | |
550 |
|
550 | |||
551 | int64_t elfparser::getSectionMemsz(int index) |
|
551 | int64_t elfparser::getSectionMemsz(int index) | |
552 | { |
|
552 | { | |
553 | int64_t MemSz=0; |
|
553 | int64_t MemSz=0; | |
554 | if(this->e!=NULL) |
|
554 | if(this->e!=NULL) | |
555 | { |
|
555 | { | |
556 | if(index < this->sections.count()) |
|
556 | if(index < this->sections.count()) | |
557 | { |
|
557 | { | |
558 | MemSz = (int64_t)this->sections.at(index)->section_header->sh_size; |
|
558 | MemSz = (int64_t)this->sections.at(index)->section_header->sh_size; | |
559 | } |
|
559 | } | |
560 | } |
|
560 | } | |
561 | return MemSz; |
|
561 | return MemSz; | |
562 | } |
|
562 | } | |
563 |
|
563 | |||
564 |
|
564 | |||
565 | QString elfparser::getSegmentFlags(int index) |
|
565 | QString elfparser::getSegmentFlags(int index) | |
566 | { |
|
566 | { | |
567 | QString flags(""); |
|
567 | QString flags(""); | |
568 | if(this->e!=NULL) |
|
568 | if(this->e!=NULL) | |
569 | { |
|
569 | { | |
570 | if(index < this->Segments.count()) |
|
570 | if(index < this->Segments.count()) | |
571 | { |
|
571 | { | |
572 | if((this->Segments.at(index)->p_flags&PF_X) == PF_X)flags+="x"; |
|
572 | if((this->Segments.at(index)->p_flags&PF_X) == PF_X)flags+="x"; | |
573 | if((this->Segments.at(index)->p_flags&PF_W) == PF_W)flags+="w"; |
|
573 | if((this->Segments.at(index)->p_flags&PF_W) == PF_W)flags+="w"; | |
574 | if((this->Segments.at(index)->p_flags&PF_R) == PF_R)flags+="r"; |
|
574 | if((this->Segments.at(index)->p_flags&PF_R) == PF_R)flags+="r"; | |
575 | if((this->Segments.at(index)->p_flags&PF_MASKOS) == PF_MASKOS)flags+=" OS-specific"; |
|
575 | if((this->Segments.at(index)->p_flags&PF_MASKOS) == PF_MASKOS)flags+=" OS-specific"; | |
576 | if((this->Segments.at(index)->p_flags&PF_MASKPROC) == PF_MASKPROC)flags+=" Processor-specific"; |
|
576 | if((this->Segments.at(index)->p_flags&PF_MASKPROC) == PF_MASKPROC)flags+=" Processor-specific"; | |
577 | } |
|
577 | } | |
578 | } |
|
578 | } | |
579 | return flags; |
|
579 | return flags; | |
580 | } |
|
580 | } | |
581 |
|
581 | |||
582 |
|
582 | |||
583 | QString elfparser::getSectionName(int index) |
|
583 | QString elfparser::getSectionName(int index) | |
584 | { |
|
584 | { | |
585 | char* nameChr = elf_strptr(this->e , this->shstrndx , this->sections.at(index)->section_header->sh_name); |
|
585 | char* nameChr = elf_strptr(this->e , this->shstrndx , this->sections.at(index)->section_header->sh_name); | |
586 | return QString(nameChr); |
|
586 | return QString(nameChr); | |
587 | } |
|
587 | } | |
588 |
|
588 | |||
589 |
|
589 | |||
590 | void elfparser::updateSections() |
|
590 | void elfparser::updateSections() | |
591 | { |
|
591 | { | |
592 | for(int i=0;i<this->sections.count();i++) |
|
592 | for(int i=0;i<this->sections.count();i++) | |
593 | { |
|
593 | { | |
594 | delete this->sections.at(i); |
|
594 | delete this->sections.at(i); | |
595 | } |
|
595 | } | |
596 | this->sections.clear(); |
|
596 | this->sections.clear(); | |
597 | this->scn = elf_nextscn (this->e , NULL ); |
|
597 | this->scn = elf_nextscn (this->e , NULL ); | |
598 | this->SectionCount = 0; |
|
598 | this->SectionCount = 0; | |
599 | while( this->scn != NULL ) |
|
599 | while( this->scn != NULL ) | |
600 | { |
|
600 | { | |
601 | GElf_Shdr* shdr = (GElf_Shdr*)malloc(sizeof(GElf_Shdr)); |
|
601 | GElf_Shdr* shdr = (GElf_Shdr*)malloc(sizeof(GElf_Shdr)); | |
602 | gelf_getshdr ( this->scn , shdr ); |
|
602 | gelf_getshdr ( this->scn , shdr ); | |
603 | Elf_Data* data = elf_getdata(this->scn, NULL); |
|
603 | Elf_Data* data = elf_getdata(this->scn, NULL); | |
604 | this->sections.append(new Elf_Section(data,shdr)); |
|
604 | this->sections.append(new Elf_Section(data,shdr)); | |
605 | this->SectionCount+=1; |
|
605 | this->SectionCount+=1; | |
606 | this->scn = elf_nextscn(e , scn); |
|
606 | this->scn = elf_nextscn(e , scn); | |
607 | } |
|
607 | } | |
608 | } |
|
608 | } | |
609 |
|
609 | |||
610 |
|
610 | |||
611 | void elfparser::updateSegments() |
|
611 | void elfparser::updateSegments() | |
612 | { |
|
612 | { | |
613 | elf_getphdrnum (this->e , &this->SegmentCount); |
|
613 | elf_getphdrnum (this->e , &this->SegmentCount); | |
614 | for(int i=0;i<this->Segments.count();i++) |
|
614 | for(int i=0;i<this->Segments.count();i++) | |
615 | { |
|
615 | { | |
616 | free(this->Segments.at(i)); |
|
616 | free(this->Segments.at(i)); | |
617 | } |
|
617 | } | |
618 | this->Segments.clear(); |
|
618 | this->Segments.clear(); | |
619 | for(int i=0;i<this->SegmentCount;i++) |
|
619 | for(int i=0;i<this->SegmentCount;i++) | |
620 | { |
|
620 | { | |
621 | GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); |
|
621 | GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); | |
622 | gelf_getphdr (this->e , i , header ); |
|
622 | gelf_getphdr (this->e , i , header ); | |
623 | this->Segments.append(header); |
|
623 | this->Segments.append(header); | |
624 | } |
|
624 | } | |
625 | } |
|
625 | } | |
626 |
|
626 | |||
627 |
|
627 | |||
628 |
|
628 | |||
629 |
|
629 | |||
630 |
|
630 | |||
631 | QString elfparser::getSectionType(int index) |
|
631 | QString elfparser::getSectionType(int index) | |
632 | { |
|
632 | { | |
633 | QString type(""); |
|
633 | QString type(""); | |
634 | if(this->e!=NULL) |
|
634 | if(this->e!=NULL) | |
635 | { |
|
635 | { | |
636 | if(index < this->Segments.count()) |
|
636 | if(index < this->Segments.count()) | |
637 | { |
|
637 | { | |
638 | switch(this->Segments.at(index)->p_type) |
|
638 | switch(this->Segments.at(index)->p_type) | |
639 | { |
|
639 | { | |
640 | case SHT_NULL : type = "Section header table entry unused"; break; |
|
640 | case SHT_NULL : type = "Section header table entry unused"; break; | |
641 | case SHT_PROGBITS : type = "Program data"; break; |
|
641 | case SHT_PROGBITS : type = "Program data"; break; | |
642 | case SHT_SYMTAB : type = "Symbol table"; break; |
|
642 | case SHT_SYMTAB : type = "Symbol table"; break; | |
643 | case SHT_STRTAB : type = "String table"; break; |
|
643 | case SHT_STRTAB : type = "String table"; break; | |
644 | case SHT_RELA : type = "Relocation entries with addends"; break; |
|
644 | case SHT_RELA : type = "Relocation entries with addends"; break; | |
645 | case SHT_HASH : type = "Symbol hash table"; break; |
|
645 | case SHT_HASH : type = "Symbol hash table"; break; | |
646 | case SHT_DYNAMIC : type = "Dynamic linking information"; break; |
|
646 | case SHT_DYNAMIC : type = "Dynamic linking information"; break; | |
647 | case SHT_NOTE : type = "Notes"; break; |
|
647 | case SHT_NOTE : type = "Notes"; break; | |
648 | case SHT_NOBITS :type = "Program space with no data (bss)"; break; |
|
648 | case SHT_NOBITS :type = "Program space with no data (bss)"; break; | |
649 | case SHT_REL :type = "Relocation entries, no addends"; break; |
|
649 | case SHT_REL :type = "Relocation entries, no addends"; break; | |
650 | case SHT_SHLIB : type = "Reserved"; break; |
|
650 | case SHT_SHLIB : type = "Reserved"; break; | |
651 | case SHT_DYNSYM : type = "Dynamic linker symbol table"; break; |
|
651 | case SHT_DYNSYM : type = "Dynamic linker symbol table"; break; | |
652 | case SHT_INIT_ARRAY : type = "Array of constructors"; break; |
|
652 | case SHT_INIT_ARRAY : type = "Array of constructors"; break; | |
653 | case SHT_FINI_ARRAY : type = "Array of destructors"; break; |
|
653 | case SHT_FINI_ARRAY : type = "Array of destructors"; break; | |
654 | case SHT_PREINIT_ARRAY : type = "Array of pre-constructors"; break; |
|
654 | case SHT_PREINIT_ARRAY : type = "Array of pre-constructors"; break; | |
655 | case SHT_GROUP : type = "Section group"; break; |
|
655 | case SHT_GROUP : type = "Section group"; break; | |
656 | case SHT_SYMTAB_SHNDX : type = "Extended section indeces"; break; |
|
656 | case SHT_SYMTAB_SHNDX : type = "Extended section indeces"; break; | |
657 | case SHT_NUM : type = "Number of defined types. "; break; |
|
657 | case SHT_NUM : type = "Number of defined types. "; break; | |
658 | case SHT_LOOS : type = "Start OS-specific. "; break; |
|
658 | case SHT_LOOS : type = "Start OS-specific. "; break; | |
659 | case SHT_LOSUNW : type = "Sun-specific low bound. "; break; |
|
659 | case SHT_LOSUNW : type = "Sun-specific low bound. "; break; | |
660 | case SHT_SUNW_COMDAT : type = " "; break; |
|
660 | case SHT_SUNW_COMDAT : type = " "; break; | |
661 | case SHT_SUNW_syminfo : type = " "; break; |
|
661 | case SHT_SUNW_syminfo : type = " "; break; | |
662 | case SHT_GNU_verdef : type = "Version definition section. "; break; |
|
662 | case SHT_GNU_verdef : type = "Version definition section. "; break; | |
663 | case SHT_GNU_verneed : type = "Version needs section. "; break; |
|
663 | case SHT_GNU_verneed : type = "Version needs section. "; break; | |
664 | case SHT_GNU_versym : type = "Version symbol table. "; break; |
|
664 | case SHT_GNU_versym : type = "Version symbol table. "; break; | |
665 | case SHT_LOPROC : type = "Start of processor-specific"; break; |
|
665 | case SHT_LOPROC : type = "Start of processor-specific"; break; | |
666 | case SHT_HIPROC : type = "End of processor-specific"; break; |
|
666 | case SHT_HIPROC : type = "End of processor-specific"; break; | |
667 | case SHT_HIUSER : type = "End of application-specific"; break; |
|
667 | case SHT_HIUSER : type = "End of application-specific"; break; | |
668 | } |
|
668 | } | |
669 | } |
|
669 | } | |
670 | } |
|
670 | } | |
671 | return type; |
|
671 | return type; | |
672 | } |
|
672 | } | |
673 |
|
673 | |||
674 | bool elfparser::isElf(const QString &File) |
|
674 | bool elfparser::isElf(const QString &File) | |
675 | { |
|
675 | { | |
676 | int file =0; |
|
676 | int file =0; | |
677 | #ifdef _ELF_WINDOWS_ |
|
677 | #ifdef _ELF_WINDOWS_ | |
678 | file = open(File.toStdString().c_str(),O_RDONLY|O_BINARY ,0); |
|
678 | file = open(File.toStdString().c_str(),O_RDONLY|O_BINARY ,0); | |
679 | #else |
|
679 | #else | |
680 | file = open(File.toStdString().c_str(),O_RDONLY ,0); |
|
680 | file = open(File.toStdString().c_str(),O_RDONLY ,0); | |
681 | #endif |
|
681 | #endif | |
682 | char Magic[4]; |
|
682 | char Magic[4]; | |
683 | if(file!=-1) |
|
683 | if(file!=-1) | |
684 | { |
|
684 | { | |
685 | read(file,Magic,4); |
|
685 | read(file,Magic,4); | |
686 | close(file); |
|
686 | close(file); | |
687 | if(Magic[0]==0x7f && Magic[1]==0x45 && Magic[2]==0x4c && Magic[3]==0x46) |
|
687 | if(Magic[0]==0x7f && Magic[1]==0x45 && Magic[2]==0x4c && Magic[3]==0x46) | |
688 | { |
|
688 | { | |
689 | return true; |
|
689 | return true; | |
690 | } |
|
690 | } | |
691 | } |
|
691 | } | |
692 | return false; |
|
692 | return false; | |
693 | } |
|
693 | } | |
694 |
|
694 | |||
695 |
|
695 | |||
696 |
|
696 | |||
697 |
|
697 | |||
698 |
|
698 | |||
699 |
|
699 | |||
700 |
|
700 | |||
701 |
|
701 |
@@ -1,98 +1,98 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 3 of the License, or |
|
7 | -- the Free Software Foundation; either version 3 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 | #ifndef ELFPARSER_H |
|
22 | #ifndef ELFPARSER_H | |
23 | #define ELFPARSER_H |
|
23 | #define ELFPARSER_H | |
24 | #include <libelf.h> |
|
24 | #include <libelf.h> | |
25 | #include <gelf.h> |
|
25 | #include <gelf.h> | |
26 | #include <QString> |
|
26 | #include <QString> | |
27 | #include <stdio.h> |
|
27 | #include <stdio.h> | |
28 | #include <QList> |
|
28 | #include <QList> | |
29 | #include <stdint.h> |
|
29 | #include <stdint.h> | |
30 |
|
30 | |||
31 | class Elf_Section |
|
31 | class Elf_Section | |
32 | { |
|
32 | { | |
33 | public: |
|
33 | public: | |
34 | Elf_Section(){} |
|
34 | Elf_Section(){} | |
35 | Elf_Section(Elf_Data* data,GElf_Shdr* section_header) |
|
35 | Elf_Section(Elf_Data* data,GElf_Shdr* section_header) | |
36 | { |
|
36 | { | |
37 | this->data = data; |
|
37 | this->data = data; | |
38 | this->section_header = section_header; |
|
38 | this->section_header = section_header; | |
39 | } |
|
39 | } | |
40 | Elf_Data* data; |
|
40 | Elf_Data* data; | |
41 | GElf_Shdr* section_header; |
|
41 | GElf_Shdr* section_header; | |
42 | }; |
|
42 | }; | |
43 |
|
43 | |||
44 | class elfparser |
|
44 | class elfparser | |
45 | { |
|
45 | { | |
46 | public: |
|
46 | public: | |
47 | elfparser(); |
|
47 | elfparser(); | |
48 | bool iself(); |
|
48 | bool iself(); | |
49 | bool isopened(); |
|
49 | bool isopened(); | |
50 | int setFilename(const QString& name); |
|
50 | int setFilename(const QString& name); | |
51 | int closeFile(); |
|
51 | int closeFile(); | |
52 | QString getArchitecture(); |
|
52 | QString getArchitecture(); | |
53 | QString getType(); |
|
53 | QString getType(); | |
54 | int32_t getVersion(); |
|
54 | int32_t getVersion(); | |
55 | int getSectioncount(); |
|
55 | int getSectioncount(); | |
56 | int getSegmentcount(); |
|
56 | int getSegmentcount(); | |
57 | QString getSegmentType(int index); |
|
57 | QString getSegmentType(int index); | |
58 | int64_t getSegmentOffset(int index); |
|
58 | int64_t getSegmentOffset(int index); | |
59 | int64_t getSegmentVaddr(int index); |
|
59 | int64_t getSegmentVaddr(int index); | |
60 | int64_t getSegmentPaddr(int index); |
|
60 | int64_t getSegmentPaddr(int index); | |
61 | int64_t getSectionPaddr(int index); |
|
61 | int64_t getSectionPaddr(int index); | |
62 | int64_t getSegmentFilesz(int index); |
|
62 | int64_t getSegmentFilesz(int index); | |
63 | int64_t getSectionDatasz(int index); |
|
63 | int64_t getSectionDatasz(int index); | |
64 | bool getSectionData(int index, char **buffer); |
|
64 | bool getSectionData(int index, char **buffer); | |
65 | int64_t getSegmentMemsz(int index); |
|
65 | int64_t getSegmentMemsz(int index); | |
66 | int64_t getSectionMemsz(int index); |
|
66 | int64_t getSectionMemsz(int index); | |
67 | QString getSegmentFlags(int index); |
|
67 | QString getSegmentFlags(int index); | |
68 | QString getSectionName(int index); |
|
68 | QString getSectionName(int index); | |
69 | QString getSectionType(int index); |
|
69 | QString getSectionType(int index); | |
70 | static bool isElf(const QString& File); |
|
70 | static bool isElf(const QString& File); | |
71 |
|
71 | |||
72 | private: |
|
72 | private: | |
73 | void updateSections(); |
|
73 | void updateSections(); | |
74 | void updateSegments(); |
|
74 | void updateSegments(); | |
75 | int elfFile; |
|
75 | int elfFile; | |
76 | bool opened; |
|
76 | bool opened; | |
77 | bool type_elf; |
|
77 | bool type_elf; | |
78 | Elf* e; |
|
78 | Elf* e; | |
79 | Elf_Kind ek; |
|
79 | Elf_Kind ek; | |
80 | GElf_Ehdr ehdr; |
|
80 | GElf_Ehdr ehdr; | |
81 | Elf_Scn * scn; |
|
81 | Elf_Scn * scn; | |
82 | Elf_Data * data; |
|
82 | Elf_Data * data; | |
83 | size_t SectionCount,SegmentCount, shstrndx; |
|
83 | size_t SectionCount,SegmentCount, shstrndx; | |
84 | QList<GElf_Phdr*> Segments; |
|
84 | QList<GElf_Phdr*> Segments; | |
85 | //QList<GElf_Shdr*> Sections; |
|
85 | //QList<GElf_Shdr*> Sections; | |
86 | QList<Elf_Section*> sections; |
|
86 | QList<Elf_Section*> sections; | |
87 |
|
87 | |||
88 | }; |
|
88 | }; | |
89 |
|
89 | |||
90 | #endif // ELFPARSER_H |
|
90 | #endif // ELFPARSER_H | |
91 |
|
91 | |||
92 |
|
92 | |||
93 |
|
93 | |||
94 |
|
94 | |||
95 |
|
95 | |||
96 |
|
96 | |||
97 |
|
97 | |||
98 |
|
98 |
@@ -1,59 +1,59 | |||||
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, |
|
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 | #ifndef MEMSIZEWDGT_H |
|
22 | #ifndef MEMSIZEWDGT_H | |
23 | #define MEMSIZEWDGT_H |
|
23 | #define MEMSIZEWDGT_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QLineEdit> |
|
26 | #include <QLineEdit> | |
27 | #include <QComboBox> |
|
27 | #include <QComboBox> | |
28 | #include <QHBoxLayout> |
|
28 | #include <QHBoxLayout> | |
29 |
|
29 | |||
30 | class MemSizeWdgt : public QWidget |
|
30 | class MemSizeWdgt : public QWidget | |
31 | { |
|
31 | { | |
32 | Q_OBJECT |
|
32 | Q_OBJECT | |
33 | public: |
|
33 | public: | |
34 | explicit MemSizeWdgt(QWidget *parent = 0); |
|
34 | explicit MemSizeWdgt(QWidget *parent = 0); | |
35 | MemSizeWdgt(int defaultSize,QWidget *parent = 0); |
|
35 | MemSizeWdgt(int defaultSize,QWidget *parent = 0); | |
36 | int getsize(); |
|
36 | int getsize(); | |
37 | void setMaximum(unsigned int max); |
|
37 | void setMaximum(unsigned int max); | |
38 | void updateSizeValue(); |
|
38 | void updateSizeValue(); | |
39 | void show(); |
|
39 | void show(); | |
40 |
|
40 | |||
41 | signals: |
|
41 | signals: | |
42 |
|
42 | |||
43 | public slots: |
|
43 | public slots: | |
44 | void setSizeValue(int size); |
|
44 | void setSizeValue(int size); | |
45 |
|
45 | |||
46 | private slots: |
|
46 | private slots: | |
47 | void setSizeValue(); |
|
47 | void setSizeValue(); | |
48 | void setSizeValue(QString size); |
|
48 | void setSizeValue(QString size); | |
49 |
|
49 | |||
50 | private: |
|
50 | private: | |
51 | QHBoxLayout* mainLayout; |
|
51 | QHBoxLayout* mainLayout; | |
52 | QLineEdit* sizeValue; |
|
52 | QLineEdit* sizeValue; | |
53 | QComboBox* sizeUnit; |
|
53 | QComboBox* sizeUnit; | |
54 | unsigned int maximum; |
|
54 | unsigned int maximum; | |
55 |
|
55 | |||
56 |
|
56 | |||
57 | }; |
|
57 | }; | |
58 |
|
58 | |||
59 | #endif // MEMSIZEWDGT_H |
|
59 | #endif // MEMSIZEWDGT_H |
@@ -1,55 +1,55 | |||||
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, |
|
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 | #ifndef QHEXSPINBOX_H |
|
22 | #ifndef QHEXSPINBOX_H | |
23 | #define QHEXSPINBOX_H |
|
23 | #define QHEXSPINBOX_H | |
24 |
|
24 | |||
25 | #include <QSpinBox> |
|
25 | #include <QSpinBox> | |
26 | #include <QWidget> |
|
26 | #include <QWidget> | |
27 | #include <QString> |
|
27 | #include <QString> | |
28 | #include <QValidator> |
|
28 | #include <QValidator> | |
29 |
|
29 | |||
30 | class QHexSpinBox : public QSpinBox |
|
30 | class QHexSpinBox : public QSpinBox | |
31 | { |
|
31 | { | |
32 | Q_OBJECT |
|
32 | Q_OBJECT | |
33 | public: |
|
33 | public: | |
34 | explicit QHexSpinBox(QWidget *parent = 0); |
|
34 | explicit QHexSpinBox(QWidget *parent = 0); | |
35 | QString textFromValue ( int value ) const; |
|
35 | QString textFromValue ( int value ) const; | |
36 | int valueFromText ( const QString & text ) const ; |
|
36 | int valueFromText ( const QString & text ) const ; | |
37 | QValidator::State validate(QString &input, int &pos) const |
|
37 | QValidator::State validate(QString &input, int &pos) const | |
38 | { |
|
38 | { | |
39 | Q_UNUSED(pos) |
|
39 | Q_UNUSED(pos) | |
40 | bool ok; |
|
40 | bool ok; | |
41 | input.toUInt( &ok, 16 ); |
|
41 | input.toUInt( &ok, 16 ); | |
42 | if(ok) |
|
42 | if(ok) | |
43 | return QValidator::Acceptable; |
|
43 | return QValidator::Acceptable; | |
44 | else |
|
44 | else | |
45 | return QValidator::Invalid; |
|
45 | return QValidator::Invalid; | |
46 | } |
|
46 | } | |
47 | void show(); |
|
47 | void show(); | |
48 | signals: |
|
48 | signals: | |
49 |
|
49 | |||
50 | public slots: |
|
50 | public slots: | |
51 |
|
51 | |||
52 | }; |
|
52 | }; | |
53 |
|
53 | |||
54 |
|
54 | |||
55 | #endif // QHEXSPINBOX_H |
|
55 | #endif // QHEXSPINBOX_H |
@@ -1,119 +1,119 | |||||
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) 2014, |
|
3 | -- Copyright (C) 2014, 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 : Paul Leroy |
|
19 | /*-- Author : Paul Leroy | |
20 | -- Mail : paul.leroy@lpp.polytechnique.fr |
|
20 | -- Mail : paul.leroy@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "qipdialogbox.h" |
|
22 | #include "qipdialogbox.h" | |
23 | #include <QSpinBox> |
|
23 | #include <QSpinBox> | |
24 | #include <QHBoxLayout> |
|
24 | #include <QHBoxLayout> | |
25 | #include <QVBoxLayout> |
|
25 | #include <QVBoxLayout> | |
26 | #include <QLabel> |
|
26 | #include <QLabel> | |
27 | #include <QString> |
|
27 | #include <QString> | |
28 | #include <QLocale> |
|
28 | #include <QLocale> | |
29 |
|
29 | |||
30 | QIPDialogBox::QIPDialogBox(QWidget *parent) : |
|
30 | QIPDialogBox::QIPDialogBox(QWidget *parent) : | |
31 | QWidget(parent) |
|
31 | QWidget(parent) | |
32 | { |
|
32 | { | |
33 | QHBoxLayout *addressLayout = new QHBoxLayout; |
|
33 | QHBoxLayout *addressLayout = new QHBoxLayout; | |
34 | QVBoxLayout *mainLayout = new QVBoxLayout; |
|
34 | QVBoxLayout *mainLayout = new QVBoxLayout; | |
35 | addressPart1 = new QSpinBox; |
|
35 | addressPart1 = new QSpinBox; | |
36 | addressPart2 = new QSpinBox; |
|
36 | addressPart2 = new QSpinBox; | |
37 | addressPart3 = new QSpinBox; |
|
37 | addressPart3 = new QSpinBox; | |
38 | addressPart4 = new QSpinBox; |
|
38 | addressPart4 = new QSpinBox; | |
39 |
|
39 | |||
40 | addressPart1->setRange(0, 255); |
|
40 | addressPart1->setRange(0, 255); | |
41 | addressPart1->setValue(129); |
|
41 | addressPart1->setValue(129); | |
42 | addressPart1->setButtonSymbols(QAbstractSpinBox::NoButtons); |
|
42 | addressPart1->setButtonSymbols(QAbstractSpinBox::NoButtons); | |
43 |
|
43 | |||
44 | addressPart2->setRange(0, 255); |
|
44 | addressPart2->setRange(0, 255); | |
45 | addressPart2->setValue(104); |
|
45 | addressPart2->setValue(104); | |
46 | addressPart2->setButtonSymbols(QAbstractSpinBox::NoButtons); |
|
46 | addressPart2->setButtonSymbols(QAbstractSpinBox::NoButtons); | |
47 |
|
47 | |||
48 | addressPart3->setRange(0, 255); |
|
48 | addressPart3->setRange(0, 255); | |
49 | addressPart3->setValue(27); |
|
49 | addressPart3->setValue(27); | |
50 | addressPart3->setButtonSymbols(QAbstractSpinBox::NoButtons); |
|
50 | addressPart3->setButtonSymbols(QAbstractSpinBox::NoButtons); | |
51 |
|
51 | |||
52 | addressPart4->setRange(0, 255); |
|
52 | addressPart4->setRange(0, 255); | |
53 | addressPart4->setValue(113); |
|
53 | addressPart4->setValue(113); | |
54 | addressPart4->setButtonSymbols(QAbstractSpinBox::NoButtons); |
|
54 | addressPart4->setButtonSymbols(QAbstractSpinBox::NoButtons); | |
55 |
|
55 | |||
56 | valueChanged(); |
|
56 | valueChanged(); | |
57 |
|
57 | |||
58 | connect(addressPart1, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); |
|
58 | connect(addressPart1, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); | |
59 | connect(addressPart2, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); |
|
59 | connect(addressPart2, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); | |
60 | connect(addressPart3, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); |
|
60 | connect(addressPart3, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); | |
61 | connect(addressPart4, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); |
|
61 | connect(addressPart4, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); | |
62 |
|
62 | |||
63 | addressLayout->addWidget(addressPart1); |
|
63 | addressLayout->addWidget(addressPart1); | |
64 | addressLayout->addWidget(addressPart2); |
|
64 | addressLayout->addWidget(addressPart2); | |
65 | addressLayout->addWidget(addressPart3); |
|
65 | addressLayout->addWidget(addressPart3); | |
66 | addressLayout->addWidget(addressPart4); |
|
66 | addressLayout->addWidget(addressPart4); | |
67 | mainLayout->addLayout(addressLayout); |
|
67 | mainLayout->addLayout(addressLayout); | |
68 | //mainLayout->addWidget(labelGRESBIP); |
|
68 | //mainLayout->addWidget(labelGRESBIP); | |
69 |
|
69 | |||
70 | setLayout(mainLayout); |
|
70 | setLayout(mainLayout); | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | void QIPDialogBox::valueChanged() // SLOT |
|
73 | void QIPDialogBox::valueChanged() // SLOT | |
74 | { |
|
74 | { | |
75 | gresbIP = addressPart1->cleanText(); |
|
75 | gresbIP = addressPart1->cleanText(); | |
76 | gresbIP.append("."); |
|
76 | gresbIP.append("."); | |
77 | gresbIP.append(addressPart2->cleanText()); |
|
77 | gresbIP.append(addressPart2->cleanText()); | |
78 | gresbIP.append("."); |
|
78 | gresbIP.append("."); | |
79 | gresbIP.append(addressPart3->cleanText()); |
|
79 | gresbIP.append(addressPart3->cleanText()); | |
80 | gresbIP.append("."); |
|
80 | gresbIP.append("."); | |
81 | gresbIP.append(addressPart4->cleanText()); |
|
81 | gresbIP.append(addressPart4->cleanText()); | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | QString QIPDialogBox::getIP() |
|
84 | QString QIPDialogBox::getIP() | |
85 | { |
|
85 | { | |
86 | return(gresbIP); |
|
86 | return(gresbIP); | |
87 | } |
|
87 | } | |
88 |
|
88 | |||
89 | void QIPDialogBox::setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4) |
|
89 | void QIPDialogBox::setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4) | |
90 | { |
|
90 | { | |
91 | addressPart1->setValue(address1); |
|
91 | addressPart1->setValue(address1); | |
92 | addressPart2->setValue(address2); |
|
92 | addressPart2->setValue(address2); | |
93 | addressPart3->setValue(address3); |
|
93 | addressPart3->setValue(address3); | |
94 | addressPart4->setValue(address4); |
|
94 | addressPart4->setValue(address4); | |
95 | addressPart1->repaint(); |
|
95 | addressPart1->repaint(); | |
96 | addressPart2->repaint(); |
|
96 | addressPart2->repaint(); | |
97 | addressPart3->repaint(); |
|
97 | addressPart3->repaint(); | |
98 | addressPart4->repaint(); |
|
98 | addressPart4->repaint(); | |
99 | } |
|
99 | } | |
100 |
|
100 | |||
101 | unsigned char QIPDialogBox::get_addressPart1() |
|
101 | unsigned char QIPDialogBox::get_addressPart1() | |
102 | { |
|
102 | { | |
103 | return (unsigned char) addressPart1->value(); |
|
103 | return (unsigned char) addressPart1->value(); | |
104 | } |
|
104 | } | |
105 |
|
105 | |||
106 | unsigned char QIPDialogBox::get_addressPart2() |
|
106 | unsigned char QIPDialogBox::get_addressPart2() | |
107 | { |
|
107 | { | |
108 | return (unsigned char) addressPart2->value(); |
|
108 | return (unsigned char) addressPart2->value(); | |
109 | } |
|
109 | } | |
110 |
|
110 | |||
111 | unsigned char QIPDialogBox::get_addressPart3() |
|
111 | unsigned char QIPDialogBox::get_addressPart3() | |
112 | { |
|
112 | { | |
113 | return (unsigned char) addressPart3->value(); |
|
113 | return (unsigned char) addressPart3->value(); | |
114 | } |
|
114 | } | |
115 |
|
115 | |||
116 | unsigned char QIPDialogBox::get_addressPart4() |
|
116 | unsigned char QIPDialogBox::get_addressPart4() | |
117 | { |
|
117 | { | |
118 | return (unsigned char) addressPart4->value(); |
|
118 | return (unsigned char) addressPart4->value(); | |
119 | } |
|
119 | } |
@@ -1,55 +1,55 | |||||
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) 2014, |
|
3 | -- Copyright (C) 2014, 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 : Paul Leroy |
|
19 | /*-- Author : Paul Leroy | |
20 | -- Mail : paul.leroy@lpp.polytechnique.fr |
|
20 | -- Mail : paul.leroy@lpp.polytechnique.fr | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef WIDGETADDRESS_H |
|
22 | #ifndef WIDGETADDRESS_H | |
23 | #define WIDGETADDRESS_H |
|
23 | #define WIDGETADDRESS_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QSpinBox> |
|
26 | #include <QSpinBox> | |
27 | #include <QString> |
|
27 | #include <QString> | |
28 | #include <QLabel> |
|
28 | #include <QLabel> | |
29 |
|
29 | |||
30 | class QIPDialogBox : public QWidget |
|
30 | class QIPDialogBox : public QWidget | |
31 | { |
|
31 | { | |
32 | Q_OBJECT |
|
32 | Q_OBJECT | |
33 | public: |
|
33 | public: | |
34 | explicit QIPDialogBox(QWidget *parent = 0); |
|
34 | explicit QIPDialogBox(QWidget *parent = 0); | |
35 | void setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4); |
|
35 | void setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4); | |
36 |
|
36 | |||
37 | signals: |
|
37 | signals: | |
38 |
|
38 | |||
39 | public slots: |
|
39 | public slots: | |
40 | void valueChanged(); |
|
40 | void valueChanged(); | |
41 | QString getIP(); |
|
41 | QString getIP(); | |
42 | unsigned char get_addressPart1(); |
|
42 | unsigned char get_addressPart1(); | |
43 | unsigned char get_addressPart2(); |
|
43 | unsigned char get_addressPart2(); | |
44 | unsigned char get_addressPart3(); |
|
44 | unsigned char get_addressPart3(); | |
45 | unsigned char get_addressPart4(); |
|
45 | unsigned char get_addressPart4(); | |
46 |
|
46 | |||
47 | private: |
|
47 | private: | |
48 | QSpinBox *addressPart1; |
|
48 | QSpinBox *addressPart1; | |
49 | QSpinBox *addressPart2; |
|
49 | QSpinBox *addressPart2; | |
50 | QSpinBox *addressPart3; |
|
50 | QSpinBox *addressPart3; | |
51 | QSpinBox *addressPart4; |
|
51 | QSpinBox *addressPart4; | |
52 | QString gresbIP; |
|
52 | QString gresbIP; | |
53 | }; |
|
53 | }; | |
54 |
|
54 | |||
55 | #endif // WIDGETADDRESS_H |
|
55 | #endif // WIDGETADDRESS_H |
@@ -1,38 +1,38 | |||||
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, |
|
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 | #ifndef QSVGICON_H |
|
22 | #ifndef QSVGICON_H | |
23 | #define QSVGICON_H |
|
23 | #define QSVGICON_H | |
24 |
|
24 | |||
25 | #include <QIcon> |
|
25 | #include <QIcon> | |
26 | #include <QSvgRenderer> |
|
26 | #include <QSvgRenderer> | |
27 | #include <QImage> |
|
27 | #include <QImage> | |
28 | #include <QPainter> |
|
28 | #include <QPainter> | |
29 |
|
29 | |||
30 | class QSvgIcon : public QIcon |
|
30 | class QSvgIcon : public QIcon | |
31 | { |
|
31 | { | |
32 | public: |
|
32 | public: | |
33 | QSvgIcon(); |
|
33 | QSvgIcon(); | |
34 | QSvgIcon(const QString& fileName); |
|
34 | QSvgIcon(const QString& fileName); | |
35 | void addFile ( const QString & fileName, const QSize & size = QSize(), Mode mode = Normal, State state = Off ); |
|
35 | void addFile ( const QString & fileName, const QSize & size = QSize(), Mode mode = Normal, State state = Off ); | |
36 | }; |
|
36 | }; | |
37 |
|
37 | |||
38 | #endif // QSVGICON_H |
|
38 | #endif // QSVGICON_H |
@@ -1,50 +1,50 | |||||
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, |
|
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 | #ifndef DOCKABLEPLUGINMANAGER_H |
|
22 | #ifndef DOCKABLEPLUGINMANAGER_H | |
23 | #define DOCKABLEPLUGINMANAGER_H |
|
23 | #define DOCKABLEPLUGINMANAGER_H | |
24 |
|
24 | |||
25 | #include <QDockWidget> |
|
25 | #include <QDockWidget> | |
26 | #include "pluginmanagerWDGT.h" |
|
26 | #include "pluginmanagerWDGT.h" | |
27 |
|
27 | |||
28 | class dockablePluginManager : public QDockWidget |
|
28 | class dockablePluginManager : public QDockWidget | |
29 | { |
|
29 | { | |
30 | Q_OBJECT |
|
30 | Q_OBJECT | |
31 | public: |
|
31 | public: | |
32 | explicit dockablePluginManager(QWidget *parent = 0); |
|
32 | explicit dockablePluginManager(QWidget *parent = 0); | |
33 | void setRootLoadable(bool flag); |
|
33 | void setRootLoadable(bool flag); | |
34 |
|
34 | |||
35 | signals: |
|
35 | signals: | |
36 | void loadSysDrviver(const QString name); |
|
36 | void loadSysDrviver(const QString name); | |
37 | void loadSysDriverToParent(const QString name, const QString instanceName); |
|
37 | void loadSysDriverToParent(const QString name, const QString instanceName); | |
38 | void geteplugintree(void); |
|
38 | void geteplugintree(void); | |
39 | void treeChanged(const QList<socexplorerplugin*>& drivers); |
|
39 | void treeChanged(const QList<socexplorerplugin*>& drivers); | |
40 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
40 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); | |
41 | void closeSysDriver(const QString instanceName); |
|
41 | void closeSysDriver(const QString instanceName); | |
42 | void pluginselected(const QString& instanceName); |
|
42 | void pluginselected(const QString& instanceName); | |
43 | public slots: |
|
43 | public slots: | |
44 |
|
44 | |||
45 | private: |
|
45 | private: | |
46 | pluginmanagerWDGT* managerGui; |
|
46 | pluginmanagerWDGT* managerGui; | |
47 |
|
47 | |||
48 | }; |
|
48 | }; | |
49 |
|
49 | |||
50 | #endif // DOCKABLEPLUGINMANAGER_H |
|
50 | #endif // DOCKABLEPLUGINMANAGER_H |
@@ -1,61 +1,69 | |||||
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, |
|
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 |
|
32 | |||
33 |
|
33 | |||
34 | int main(int argc, char *argv[]) |
|
34 | int main(int argc, char *argv[]) | |
35 | { |
|
35 | { | |
36 | // Q_INIT_RESOURCE(socexplorer); |
|
36 | // Q_INIT_RESOURCE(socexplorer); | |
37 | #ifdef Q_OS_LINUX |
|
37 | #ifdef Q_OS_LINUX | |
38 | // QApplication::setGraphicsSystem("raster"); |
|
38 | // QApplication::setGraphicsSystem("raster"); | |
39 | #endif |
|
39 | #endif | |
40 | QApplication a(argc, argv); |
|
40 | QApplication a(argc, argv); | |
41 | QString scriptToEval; |
|
41 | QString scriptToEval; | |
42 | QStringList args= a.arguments(); |
|
42 | QStringList args= a.arguments(); | |
43 | for(int i=0;i<args.count()-1;i++) |
|
43 | for(int i=0;i<args.count()-1;i++) | |
44 | { |
|
44 | { | |
45 |
if((args.at(i).compare(" |
|
45 | if((args.at(i).compare("-e")==0) || (args.at(i).compare("--execute")==0)) | |
46 | { |
|
46 | { | |
47 | scriptToEval = args.at(i+1); |
|
47 | scriptToEval = args.at(i+1); | |
48 | if(!QFile::exists(scriptToEval)) |
|
48 | if(!QFile::exists(scriptToEval)) | |
49 | { |
|
49 | { | |
50 | scriptToEval.clear(); |
|
50 | scriptToEval.clear(); | |
51 | } |
|
51 | } | |
52 | else |
|
52 | else | |
53 | qDebug() << "Will execute" << scriptToEval; |
|
53 | qDebug() << "Will execute" << scriptToEval; | |
54 | break; |
|
54 | break; | |
55 | } |
|
55 | } | |
|
56 | if((args.at(i).compare("-d")==0) || (args.at(i).compare("--debug-level")==0)) | |||
|
57 | { | |||
|
58 | bool success; | |||
|
59 | int lvl; | |||
|
60 | lvl = args.at(i+1).toInt(&success,10); | |||
|
61 | if(success) | |||
|
62 | SocExplorerEngine::setLogLevel(lvl); | |||
|
63 | } | |||
56 | } |
|
64 | } | |
57 |
|
65 | |||
58 |
|
|
66 | SocExplorerMainWindow w(scriptToEval); | |
59 | w.show(); |
|
67 | w.show(); | |
60 | return a.exec(); |
|
68 | return a.exec(); | |
61 | } |
|
69 | } |
@@ -1,238 +1,238 | |||||
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, |
|
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 "mainwindow.h" |
|
22 | #include "mainwindow.h" | |
23 | #include <QDockWidget> |
|
23 | #include <QDockWidget> | |
24 |
|
24 | |||
25 |
|
|
25 | SocExplorerMainWindow::SocExplorerMainWindow(QString ScriptToEval, QWidget *parent) | |
26 | : QMainWindow(parent) |
|
26 | : QMainWindow(parent) | |
27 | { |
|
27 | { | |
28 | QCoreApplication::setApplicationName("SocExplorer"); |
|
28 | QCoreApplication::setApplicationName("SocExplorer"); | |
29 | QCoreApplication::setOrganizationName("LPP"); |
|
29 | QCoreApplication::setOrganizationName("LPP"); | |
30 | QCoreApplication::setOrganizationDomain("lpp.fr"); |
|
30 | QCoreApplication::setOrganizationDomain("lpp.fr"); | |
31 | this->makeObjects(ScriptToEval); |
|
31 | this->makeObjects(ScriptToEval); | |
32 | this->makeLayout(); |
|
32 | this->makeLayout(); | |
33 | this->makeMenu(); |
|
33 | this->makeMenu(); | |
34 | this->makeConnections(); |
|
34 | this->makeConnections(); | |
35 | this->setWindowIcon(QIcon(tr(":/images/logolppcutted.png"))); |
|
35 | this->setWindowIcon(QIcon(tr(":/images/logolppcutted.png"))); | |
36 | this->setAcceptDrops(true); |
|
36 | this->setAcceptDrops(true); | |
37 | this->pluginManager->setRootLoadable(true); |
|
37 | this->pluginManager->setRootLoadable(true); | |
38 | this->PythonConsoleInst->pyConsoleRunFile(ScriptToEval); |
|
38 | this->PythonConsoleInst->pyConsoleRunFile(ScriptToEval); | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 |
|
41 | |||
42 |
void |
|
42 | void SocExplorerMainWindow::makeObjects(QString ScriptToEval) | |
43 | { |
|
43 | { | |
44 | Q_UNUSED(ScriptToEval) |
|
44 | Q_UNUSED(ScriptToEval) | |
45 | this->p_pluginGUIlist = new QList<QDockWidget*>(); |
|
45 | this->p_pluginGUIlist = new QList<QDockWidget*>(); | |
46 | pluginsDockContainer = new QMainWindow; |
|
46 | pluginsDockContainer = new QMainWindow; | |
47 | pluginsDockContainer->setWindowFlags(Qt::Widget); |
|
47 | pluginsDockContainer->setWindowFlags(Qt::Widget); | |
48 | pluginsDockContainer->setDockNestingEnabled(true); |
|
48 | pluginsDockContainer->setDockNestingEnabled(true); | |
49 | this->mainWidget = new QSplitter(Qt::Vertical); |
|
49 | this->mainWidget = new QSplitter(Qt::Vertical); | |
50 | this->appTranslator = new QTranslator; |
|
50 | this->appTranslator = new QTranslator; | |
51 | this->Quit = new QAction(tr("&Quit"),this); |
|
51 | this->Quit = new QAction(tr("&Quit"),this); | |
52 | this->Quit->setShortcut(tr("CTRL+Q")); |
|
52 | this->Quit->setShortcut(tr("CTRL+Q")); | |
53 | this->ManagePlugins = new QAction(tr("&Manage Plugins"),this); |
|
53 | this->ManagePlugins = new QAction(tr("&Manage Plugins"),this); | |
54 | this->ManagePlugins->setShortcut(tr("CTRL+P")); |
|
54 | this->ManagePlugins->setShortcut(tr("CTRL+P")); | |
55 | this->regsManager = new QAction(tr("&Manage registers"),this); |
|
55 | this->regsManager = new QAction(tr("&Manage registers"),this); | |
56 | this->exploreRegs = new QAction(tr("&Explore registers"),this); |
|
56 | this->exploreRegs = new QAction(tr("&Explore registers"),this); | |
57 | this->help = new QAction(tr("&Help"),this); |
|
57 | this->help = new QAction(tr("&Help"),this); | |
58 | this->help->setShortcut(tr("CTRL+H")); |
|
58 | this->help->setShortcut(tr("CTRL+H")); | |
59 | this->about = new QAction(tr("&About"),this); |
|
59 | this->about = new QAction(tr("&About"),this); | |
60 | socexplorerproxy::setMainWindow(this); |
|
60 | socexplorerproxy::setMainWindow(this); | |
61 | SocExplorerEngine::setMainWindow(this); |
|
61 | SocExplorerEngine::setMainWindow(this); | |
62 | SocExplorerEngine::xmlModel()->scanXmlFiles(); |
|
62 | SocExplorerEngine::xmlModel()->scanXmlFiles(); | |
63 | this->regExplorer = new regsExplorer(); |
|
63 | this->regExplorer = new regsExplorer(); | |
64 | this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
64 | this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas); | |
65 | this->addPluginInterface(this->regExplorer); |
|
65 | this->addPluginInterface(this->regExplorer); | |
66 | this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self()); |
|
66 | this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self()); | |
67 | this->PythonConsoleInst->addObject("SocExplorerEngine",SocExplorerEngine::self()); |
|
67 | this->PythonConsoleInst->addObject("SocExplorerEngine",SocExplorerEngine::self()); | |
68 | this->pluginManager = new dockablePluginManager(); |
|
68 | this->pluginManager = new dockablePluginManager(); | |
69 | this->toolpane = new toolBar; |
|
69 | this->toolpane = new toolBar; | |
70 | this->p_about = new aboutsocexplorer(); |
|
70 | this->p_about = new aboutsocexplorer(); | |
71 |
|
71 | |||
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 |
void |
|
74 | void SocExplorerMainWindow::makeLayout() | |
75 | { |
|
75 | { | |
76 | this->mainWidget->addWidget(pluginsDockContainer); |
|
76 | this->mainWidget->addWidget(pluginsDockContainer); | |
77 | this->mainWidget->addWidget(this->PythonConsoleInst); |
|
77 | this->mainWidget->addWidget(this->PythonConsoleInst); | |
78 | this->toolpane->setAllowedAreas(Qt::RightDockWidgetArea|Qt::LeftDockWidgetArea); |
|
78 | this->toolpane->setAllowedAreas(Qt::RightDockWidgetArea|Qt::LeftDockWidgetArea); | |
79 | this->addDockWidget(Qt::LeftDockWidgetArea,this->toolpane); |
|
79 | this->addDockWidget(Qt::LeftDockWidgetArea,this->toolpane); | |
80 | this->toolpane->addTool(this->pluginManager); |
|
80 | this->toolpane->addTool(this->pluginManager); | |
81 | this->setCentralWidget(this->mainWidget); |
|
81 | this->setCentralWidget(this->mainWidget); | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 |
|
84 | |||
85 |
void |
|
85 | void SocExplorerMainWindow::makeConnections() | |
86 | { |
|
86 | { | |
87 | connect(socexplorerproxy::self(),SIGNAL(clearMenu()),this,SLOT(clearMenu())); |
|
87 | connect(socexplorerproxy::self(),SIGNAL(clearMenu()),this,SLOT(clearMenu())); | |
88 | connect(this,SIGNAL(translateSig()),socexplorerproxy::self(),SLOT(updateText())); |
|
88 | connect(this,SIGNAL(translateSig()),socexplorerproxy::self(),SLOT(updateText())); | |
89 | connect(socexplorerproxy::self(),SIGNAL(addPluginGUI(QDockWidget*)),this,SLOT(addPluginInterface(QDockWidget*))); |
|
89 | connect(socexplorerproxy::self(),SIGNAL(addPluginGUI(QDockWidget*)),this,SLOT(addPluginInterface(QDockWidget*))); | |
90 | connect(socexplorerproxy::self(),SIGNAL(removePluginGUI(QDockWidget*)),this,SLOT(removePluginInterface(QDockWidget*))); |
|
90 | connect(socexplorerproxy::self(),SIGNAL(removePluginGUI(QDockWidget*)),this,SLOT(removePluginInterface(QDockWidget*))); | |
91 | connect(this->ManagePlugins,SIGNAL(triggered()),this,SLOT(launchPluginManager())); |
|
91 | connect(this->ManagePlugins,SIGNAL(triggered()),this,SLOT(launchPluginManager())); | |
92 | connect(this->Quit,SIGNAL(triggered()),qApp,SLOT(quit())); |
|
92 | connect(this->Quit,SIGNAL(triggered()),qApp,SLOT(quit())); | |
93 | connect(this,SIGNAL(registerObject(QObject*,QString)),this->PythonConsoleInst,SLOT(registerObject(QObject*,QString))); |
|
93 | connect(this,SIGNAL(registerObject(QObject*,QString)),this->PythonConsoleInst,SLOT(registerObject(QObject*,QString))); | |
94 | connect(socexplorerproxy::self(),SIGNAL(registerObject(QObject*,QString)),this,SIGNAL(registerObject(QObject*,QString))); |
|
94 | connect(socexplorerproxy::self(),SIGNAL(registerObject(QObject*,QString)),this,SIGNAL(registerObject(QObject*,QString))); | |
95 | connect(this->pluginManager,SIGNAL(geteplugintree()),socexplorerproxy::self(),SLOT(geteplugintree())); |
|
95 | connect(this->pluginManager,SIGNAL(geteplugintree()),socexplorerproxy::self(),SLOT(geteplugintree())); | |
96 | connect(socexplorerproxy::self(),SIGNAL(treeChanged(QList<socexplorerplugin*>)),this->pluginManager,SIGNAL(treeChanged(QList<socexplorerplugin*>))); |
|
96 | connect(socexplorerproxy::self(),SIGNAL(treeChanged(QList<socexplorerplugin*>)),this->pluginManager,SIGNAL(treeChanged(QList<socexplorerplugin*>))); | |
97 | connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),socexplorerproxy::self(),SLOT(changeSysDriverInstName(QString,QString))); |
|
97 | connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),socexplorerproxy::self(),SLOT(changeSysDriverInstName(QString,QString))); | |
98 | connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),this->PythonConsoleInst,SLOT(changeSysDriverInstName(QString,QString))); |
|
98 | connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),this->PythonConsoleInst,SLOT(changeSysDriverInstName(QString,QString))); | |
99 | connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),socexplorerproxy::self(),SLOT(closeSysDriver(QString))); |
|
99 | connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),socexplorerproxy::self(),SLOT(closeSysDriver(QString))); | |
100 | connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),this->PythonConsoleInst,SLOT(removeDriver(QString))); |
|
100 | connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),this->PythonConsoleInst,SLOT(removeDriver(QString))); | |
101 | connect(this->pluginManager,SIGNAL(pluginselected(QString)),this,SLOT(pluginselected(QString))); |
|
101 | connect(this->pluginManager,SIGNAL(pluginselected(QString)),this,SLOT(pluginselected(QString))); | |
102 | connect(this->about,SIGNAL(triggered()),this,SLOT(showAboutBox())); |
|
102 | connect(this->about,SIGNAL(triggered()),this,SLOT(showAboutBox())); | |
103 | connect(this->exploreRegs,SIGNAL(triggered()),this->regExplorer,SLOT(show())); |
|
103 | connect(this->exploreRegs,SIGNAL(triggered()),this->regExplorer,SLOT(show())); | |
104 |
|
104 | |||
105 | this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString))); |
|
105 | this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString))); | |
106 | this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDriverToParent(QString,QString)),socexplorerproxy::self(),SLOT(loadSysDriverToParent(QString,QString))); |
|
106 | this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDriverToParent(QString,QString)),socexplorerproxy::self(),SLOT(loadSysDriverToParent(QString,QString))); | |
107 |
|
107 | |||
108 | } |
|
108 | } | |
109 |
|
109 | |||
110 |
|
110 | |||
111 |
void |
|
111 | void SocExplorerMainWindow::launchPluginManager() | |
112 | { |
|
112 | { | |
113 |
|
113 | |||
114 | if(this->pluginManager->isHidden()) |
|
114 | if(this->pluginManager->isHidden()) | |
115 | { |
|
115 | { | |
116 | this->pluginManager->setHidden(false); |
|
116 | this->pluginManager->setHidden(false); | |
117 | } |
|
117 | } | |
118 |
|
118 | |||
119 | } |
|
119 | } | |
120 |
|
120 | |||
121 |
|
121 | |||
122 |
void |
|
122 | void SocExplorerMainWindow::addPluginInterface(QDockWidget *plugin) | |
123 | { |
|
123 | { | |
124 | plugin->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
124 | plugin->setAllowedAreas(Qt::AllDockWidgetAreas); | |
125 | this->pluginsDockContainer->addDockWidget(Qt::TopDockWidgetArea,plugin); |
|
125 | this->pluginsDockContainer->addDockWidget(Qt::TopDockWidgetArea,plugin); | |
126 | if(p_pluginGUIlist->count()!=0) |
|
126 | if(p_pluginGUIlist->count()!=0) | |
127 | this->pluginsDockContainer->tabifyDockWidget(p_pluginGUIlist->last(),plugin); |
|
127 | this->pluginsDockContainer->tabifyDockWidget(p_pluginGUIlist->last(),plugin); | |
128 | p_pluginGUIlist->append(plugin); |
|
128 | p_pluginGUIlist->append(plugin); | |
129 |
|
129 | |||
130 | } |
|
130 | } | |
131 |
|
131 | |||
132 |
void |
|
132 | void SocExplorerMainWindow::removePluginInterface(QDockWidget *plugin) | |
133 | { |
|
133 | { | |
134 | p_pluginGUIlist->removeOne(plugin); |
|
134 | p_pluginGUIlist->removeOne(plugin); | |
135 | this->pluginsDockContainer->removeDockWidget(plugin); |
|
135 | this->pluginsDockContainer->removeDockWidget(plugin); | |
136 | } |
|
136 | } | |
137 |
|
137 | |||
138 |
|
138 | |||
139 |
void |
|
139 | void SocExplorerMainWindow::clearMenu() | |
140 | { |
|
140 | { | |
141 | this->menuBar()->clear(); |
|
141 | this->menuBar()->clear(); | |
142 | this->makeMenu(); |
|
142 | this->makeMenu(); | |
143 | } |
|
143 | } | |
144 |
|
144 | |||
145 |
|
145 | |||
146 |
void |
|
146 | void SocExplorerMainWindow::makeMenu() | |
147 | { |
|
147 | { | |
148 | this->FileMenu = menuBar()->addMenu(tr("&File")); |
|
148 | this->FileMenu = menuBar()->addMenu(tr("&File")); | |
149 | this->PluginsMenu = menuBar()->addMenu(tr("&Plugins")); |
|
149 | this->PluginsMenu = menuBar()->addMenu(tr("&Plugins")); | |
150 | this->ToolsMenu = menuBar()->addMenu(tr("&Tools")); |
|
150 | this->ToolsMenu = menuBar()->addMenu(tr("&Tools")); | |
151 | this->ToolsMenu->addAction(this->exploreRegs); |
|
151 | this->ToolsMenu->addAction(this->exploreRegs); | |
152 | this->FileMenu->addAction(this->Quit); |
|
152 | this->FileMenu->addAction(this->Quit); | |
153 | socexplorerproxy::self()->makeMenu(this->PluginsMenu); |
|
153 | socexplorerproxy::self()->makeMenu(this->PluginsMenu); | |
154 | this->PluginsMenu->addAction(this->ManagePlugins); |
|
154 | this->PluginsMenu->addAction(this->ManagePlugins); | |
155 |
|
155 | |||
156 | this->helpMenu = menuBar()->addMenu(tr("Help")); |
|
156 | this->helpMenu = menuBar()->addMenu(tr("Help")); | |
157 | this->helpMenu->addAction(this->help); |
|
157 | this->helpMenu->addAction(this->help); | |
158 | this->helpMenu->addAction(this->about); |
|
158 | this->helpMenu->addAction(this->about); | |
159 |
|
159 | |||
160 | } |
|
160 | } | |
161 |
|
161 | |||
162 |
|
162 | |||
163 |
|
|
163 | SocExplorerMainWindow::~SocExplorerMainWindow() | |
164 | { |
|
164 | { | |
165 | delete this->p_about; |
|
165 | delete this->p_about; | |
166 | delete this->p_pluginGUIlist; |
|
166 | delete this->p_pluginGUIlist; | |
167 | } |
|
167 | } | |
168 |
|
168 | |||
169 |
|
169 | |||
170 |
void |
|
170 | void SocExplorerMainWindow::setLangage(QAction *action) | |
171 | { |
|
171 | { | |
172 | QString local = action->data().toString(); |
|
172 | QString local = action->data().toString(); | |
173 | QString qmPath = QDir(QString("translations")).absolutePath(); |
|
173 | QString qmPath = QDir(QString("translations")).absolutePath(); | |
174 | appTranslator->load(qmPath+"/socexplorer_"+local+".qm"); |
|
174 | appTranslator->load(qmPath+"/socexplorer_"+local+".qm"); | |
175 | qApp->installTranslator(appTranslator); |
|
175 | qApp->installTranslator(appTranslator); | |
176 | emit this->translateSig(); |
|
176 | emit this->translateSig(); | |
177 | } |
|
177 | } | |
178 |
|
178 | |||
179 |
|
179 | |||
180 |
void |
|
180 | void SocExplorerMainWindow::createLangMenu() | |
181 | { |
|
181 | { | |
182 | this->langMenu = menuBar()->addMenu(tr("&Langue")); |
|
182 | this->langMenu = menuBar()->addMenu(tr("&Langue")); | |
183 | this->langActionGrp = new QActionGroup(this); |
|
183 | this->langActionGrp = new QActionGroup(this); | |
184 | connect(this->langActionGrp,SIGNAL(triggered(QAction*)),this,SLOT(setLangage(QAction*))); |
|
184 | connect(this->langActionGrp,SIGNAL(triggered(QAction*)),this,SLOT(setLangage(QAction*))); | |
185 | QDir* qmDir = new QDir(QString("translations")); |
|
185 | QDir* qmDir = new QDir(QString("translations")); | |
186 | QStringList LangFiles = qmDir->entryList(QStringList("socexplorer_*.qm")); |
|
186 | QStringList LangFiles = qmDir->entryList(QStringList("socexplorer_*.qm")); | |
187 | for(int i=0;i<LangFiles.size();++i) |
|
187 | for(int i=0;i<LangFiles.size();++i) | |
188 | { |
|
188 | { | |
189 | QString Local = LangFiles[i]; |
|
189 | QString Local = LangFiles[i]; | |
190 | Local.remove(0,Local.indexOf('_')+1); |
|
190 | Local.remove(0,Local.indexOf('_')+1); | |
191 | Local.chop(3); |
|
191 | Local.chop(3); | |
192 | QTranslator translator; |
|
192 | QTranslator translator; | |
193 | translator.load(LangFiles[i],qmDir->absolutePath()); |
|
193 | translator.load(LangFiles[i],qmDir->absolutePath()); | |
194 | QString langage = translator.translate("MainWindow","English"); |
|
194 | QString langage = translator.translate("MainWindow","English"); | |
195 | QAction *action = new QAction(tr("&%1 %2").arg(i+1).arg(langage),this); |
|
195 | QAction *action = new QAction(tr("&%1 %2").arg(i+1).arg(langage),this); | |
196 | action->setCheckable(true); |
|
196 | action->setCheckable(true); | |
197 | action->setData(Local); |
|
197 | action->setData(Local); | |
198 | langMenu->addAction(action); |
|
198 | langMenu->addAction(action); | |
199 | langActionGrp->addAction(action); |
|
199 | langActionGrp->addAction(action); | |
200 | if(langage==tr("English")) |
|
200 | if(langage==tr("English")) | |
201 | action->setChecked(true); |
|
201 | action->setChecked(true); | |
202 | } |
|
202 | } | |
203 | } |
|
203 | } | |
204 |
|
204 | |||
205 |
|
205 | |||
206 |
void |
|
206 | void SocExplorerMainWindow::updateText() | |
207 | { |
|
207 | { | |
208 | emit this->translateSig(); |
|
208 | emit this->translateSig(); | |
209 | } |
|
209 | } | |
210 |
|
210 | |||
211 |
|
211 | |||
212 |
|
212 | |||
213 |
void |
|
213 | void SocExplorerMainWindow::showAboutBox() | |
214 | { |
|
214 | { | |
215 | p_about->show(); |
|
215 | p_about->show(); | |
216 | } |
|
216 | } | |
217 |
|
217 | |||
218 |
void |
|
218 | void SocExplorerMainWindow::pluginselected(const QString &instanceName) | |
219 | { |
|
219 | { | |
220 | socexplorerplugin* drv=socexplorerproxy::self()->getSysDriver(instanceName); |
|
220 | socexplorerplugin* drv=socexplorerproxy::self()->getSysDriver(instanceName); | |
221 | if(drv) |
|
221 | if(drv) | |
222 | drv->raise(); |
|
222 | drv->raise(); | |
223 | } |
|
223 | } | |
224 |
|
224 | |||
225 |
|
225 | |||
226 |
|
226 | |||
227 |
void |
|
227 | void SocExplorerMainWindow::closeEvent(QCloseEvent *event) | |
228 | { |
|
228 | { | |
229 | socexplorerproxy::self()->close(); |
|
229 | socexplorerproxy::self()->close(); | |
230 | qApp->closeAllWindows(); |
|
230 | qApp->closeAllWindows(); | |
231 | event->accept(); |
|
231 | event->accept(); | |
232 | } |
|
232 | } | |
233 |
|
233 | |||
234 |
|
234 | |||
235 |
|
235 | |||
236 |
|
236 | |||
237 |
|
237 | |||
238 |
|
238 |
@@ -1,86 +1,86 | |||||
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, |
|
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 | #ifndef MAINWINDOW_H |
|
22 | #ifndef MAINWINDOW_H | |
23 | #define MAINWINDOW_H |
|
23 | #define MAINWINDOW_H | |
24 |
|
24 | |||
25 | #include <QMainWindow> |
|
25 | #include <QMainWindow> | |
26 | #include <QApplication> |
|
26 | #include <QApplication> | |
27 | #include <QVBoxLayout> |
|
27 | #include <QVBoxLayout> | |
28 | #include <QIcon> |
|
28 | #include <QIcon> | |
29 | #include <QMenuBar> |
|
29 | #include <QMenuBar> | |
30 | #include <QMenu> |
|
30 | #include <QMenu> | |
31 | #include <QAction> |
|
31 | #include <QAction> | |
32 | #include <QDockWidget> |
|
32 | #include <QDockWidget> | |
33 | #include <QTranslator> |
|
33 | #include <QTranslator> | |
34 | #include <QSplitter> |
|
34 | #include <QSplitter> | |
35 | #include "dockablepluginmanager.h" |
|
35 | #include "dockablepluginmanager.h" | |
36 | #include <socexplorerproxy.h> |
|
36 | #include <socexplorerproxy.h> | |
37 | #include "PyWdgt/pythonconsole.h" |
|
37 | #include "PyWdgt/pythonconsole.h" | |
38 | #include "aboutsocexplorer.h" |
|
38 | #include "aboutsocexplorer.h" | |
39 | #include "toolbar.h" |
|
39 | #include "toolbar.h" | |
40 | #include "regsExplorer/regsexplorer.h" |
|
40 | #include "regsExplorer/regsexplorer.h" | |
41 |
|
41 | |||
42 |
class |
|
42 | class SocExplorerMainWindow : public QMainWindow | |
43 | { |
|
43 | { | |
44 | Q_OBJECT |
|
44 | Q_OBJECT | |
45 |
|
45 | |||
46 | public: |
|
46 | public: | |
47 |
|
|
47 | SocExplorerMainWindow(QString ScriptToEval,QWidget *parent = 0); | |
48 |
~ |
|
48 | ~SocExplorerMainWindow(); | |
49 | QAction* Quit,*LoadPlugin,*ManagePlugins,*help,*regsManager,*exploreRegs,*about,*translateAction; |
|
49 | QAction* Quit,*LoadPlugin,*ManagePlugins,*help,*regsManager,*exploreRegs,*about,*translateAction; | |
50 | QActionGroup*langActionGrp; |
|
50 | QActionGroup*langActionGrp; | |
51 | QMenu* FileMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu; |
|
51 | QMenu* FileMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu; | |
52 | QTranslator* appTranslator; |
|
52 | QTranslator* appTranslator; | |
53 | void createLangMenu(); |
|
53 | void createLangMenu(); | |
54 | void closeEvent(QCloseEvent *event); |
|
54 | void closeEvent(QCloseEvent *event); | |
55 | toolBar* toolpane; |
|
55 | toolBar* toolpane; | |
56 |
|
56 | |||
57 |
|
57 | |||
58 | public slots: |
|
58 | public slots: | |
59 | void launchPluginManager(); |
|
59 | void launchPluginManager(); | |
60 | void addPluginInterface(QDockWidget* plugin); |
|
60 | void addPluginInterface(QDockWidget* plugin); | |
61 | void removePluginInterface(QDockWidget* plugin); |
|
61 | void removePluginInterface(QDockWidget* plugin); | |
62 | void clearMenu(); |
|
62 | void clearMenu(); | |
63 | void updateText(); |
|
63 | void updateText(); | |
64 | void setLangage(QAction* action); |
|
64 | void setLangage(QAction* action); | |
65 | void showAboutBox(); |
|
65 | void showAboutBox(); | |
66 | void pluginselected(const QString& instanceName); |
|
66 | void pluginselected(const QString& instanceName); | |
67 |
|
67 | |||
68 | signals: |
|
68 | signals: | |
69 | void translateSig(); |
|
69 | void translateSig(); | |
70 | void registerObject(QObject* object,const QString& instanceName); |
|
70 | void registerObject(QObject* object,const QString& instanceName); | |
71 |
|
71 | |||
72 | private: |
|
72 | private: | |
73 | void makeObjects(QString ScriptToEval); |
|
73 | void makeObjects(QString ScriptToEval); | |
74 | void makeLayout(); |
|
74 | void makeLayout(); | |
75 | void makeConnections(); |
|
75 | void makeConnections(); | |
76 | void makeMenu(); |
|
76 | void makeMenu(); | |
77 | QMainWindow* pluginsDockContainer; |
|
77 | QMainWindow* pluginsDockContainer; | |
78 | QSplitter* mainWidget; |
|
78 | QSplitter* mainWidget; | |
79 | PythonConsole* PythonConsoleInst; |
|
79 | PythonConsole* PythonConsoleInst; | |
80 | dockablePluginManager* pluginManager; |
|
80 | dockablePluginManager* pluginManager; | |
81 | regsExplorer* regExplorer; |
|
81 | regsExplorer* regExplorer; | |
82 | aboutsocexplorer* p_about; |
|
82 | aboutsocexplorer* p_about; | |
83 | QList<QDockWidget*>* p_pluginGUIlist; |
|
83 | QList<QDockWidget*>* p_pluginGUIlist; | |
84 | }; |
|
84 | }; | |
85 |
|
85 | |||
86 | #endif // MAINWINDOW_H |
|
86 | #endif // MAINWINDOW_H |
@@ -1,55 +1,55 | |||||
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, |
|
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 | #ifndef REGSEXPLORER_H |
|
22 | #ifndef REGSEXPLORER_H | |
23 | #define REGSEXPLORER_H |
|
23 | #define REGSEXPLORER_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QTabWidget> |
|
26 | #include <QTabWidget> | |
27 | #include <QDockWidget> |
|
27 | #include <QDockWidget> | |
28 | #include "regsexplorercfg.h" |
|
28 | #include "regsexplorercfg.h" | |
29 | #include "regsviewer.h" |
|
29 | #include "regsviewer.h" | |
30 | #include <QGridLayout> |
|
30 | #include <QGridLayout> | |
31 | #include <socexplorerengine.h> |
|
31 | #include <socexplorerengine.h> | |
32 | #include <peripheralwidget.h> |
|
32 | #include <peripheralwidget.h> | |
33 | #include <socregsviewer.h> |
|
33 | #include <socregsviewer.h> | |
34 |
|
34 | |||
35 | class regsExplorer : public QDockWidget |
|
35 | class regsExplorer : public QDockWidget | |
36 | { |
|
36 | { | |
37 | Q_OBJECT |
|
37 | Q_OBJECT | |
38 | public: |
|
38 | public: | |
39 | explicit regsExplorer(QWidget *parent = 0); |
|
39 | explicit regsExplorer(QWidget *parent = 0); | |
40 |
|
40 | |||
41 | signals: |
|
41 | signals: | |
42 |
|
42 | |||
43 | public slots: |
|
43 | public slots: | |
44 |
|
44 | |||
45 | void addDev(socExplorerEnumDevice* device); |
|
45 | void addDev(socExplorerEnumDevice* device); | |
46 |
|
46 | |||
47 | private: |
|
47 | private: | |
48 | QTabWidget* mainWidget; |
|
48 | QTabWidget* mainWidget; | |
49 | regsExplorerCfg* cfg; |
|
49 | regsExplorerCfg* cfg; | |
50 | socRegsViewer* socViewer; |
|
50 | socRegsViewer* socViewer; | |
51 |
|
51 | |||
52 |
|
52 | |||
53 | }; |
|
53 | }; | |
54 |
|
54 | |||
55 | #endif // REGSEXPLORER_H |
|
55 | #endif // REGSEXPLORER_H |
@@ -1,40 +1,40 | |||||
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, |
|
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 | #ifndef REGSVIEWER_H |
|
22 | #ifndef REGSVIEWER_H | |
23 | #define REGSVIEWER_H |
|
23 | #define REGSVIEWER_H | |
24 |
|
24 | |||
25 | #include <QWidget> |
|
25 | #include <QWidget> | |
26 | #include <QScrollArea> |
|
26 | #include <QScrollArea> | |
27 |
|
27 | |||
28 | class regsViewer : public QScrollArea |
|
28 | class regsViewer : public QScrollArea | |
29 | { |
|
29 | { | |
30 | Q_OBJECT |
|
30 | Q_OBJECT | |
31 | public: |
|
31 | public: | |
32 | explicit regsViewer(QWidget *parent = 0); |
|
32 | explicit regsViewer(QWidget *parent = 0); | |
33 |
|
33 | |||
34 | signals: |
|
34 | signals: | |
35 |
|
35 | |||
36 | public slots: |
|
36 | public slots: | |
37 |
|
37 | |||
38 | }; |
|
38 | }; | |
39 |
|
39 | |||
40 | #endif // REGSVIEWER_H |
|
40 | #endif // REGSVIEWER_H |
@@ -1,57 +1,57 | |||||
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) 2013, |
|
3 | -- Copyright (C) 2013, 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 | #ifndef SOCEXPLORER_H |
|
22 | #ifndef SOCEXPLORER_H | |
23 | #define SOCEXPLORER_H |
|
23 | #define SOCEXPLORER_H | |
24 |
|
24 | |||
25 | #ifdef WIN32 |
|
25 | #ifdef WIN32 | |
26 | #ifdef SOCEXPLORER_EXPORTS |
|
26 | #ifdef SOCEXPLORER_EXPORTS | |
27 | #define SOCEXPLORER_EXPORT __declspec(dllexport) |
|
27 | #define SOCEXPLORER_EXPORT __declspec(dllexport) | |
28 | #else |
|
28 | #else | |
29 | #define SOCEXPLORER_EXPORT __declspec(dllimport) |
|
29 | #define SOCEXPLORER_EXPORT __declspec(dllimport) | |
30 | #endif |
|
30 | #endif | |
31 | #else |
|
31 | #else | |
32 | #define SOCEXPLORER_EXPORT |
|
32 | #define SOCEXPLORER_EXPORT | |
33 | #endif |
|
33 | #endif | |
34 |
|
34 | |||
35 | #ifdef WIN32 |
|
35 | #ifdef WIN32 | |
36 | #include <stdlib.h> |
|
36 | #include <stdlib.h> | |
37 | #define socexplorerBswap32(X) _byteswap_ulong(X) |
|
37 | #define socexplorerBswap32(X) _byteswap_ulong(X) | |
38 | #else |
|
38 | #else | |
39 | #ifdef UNIX |
|
39 | #ifdef UNIX | |
40 | #include <byteswap.h> |
|
40 | #include <byteswap.h> | |
41 | #define socexplorerBswap32(X) bswap_32(X) |
|
41 | #define socexplorerBswap32(X) bswap_32(X) | |
42 | #endif |
|
42 | #endif | |
43 | #endif |
|
43 | #endif | |
44 |
|
44 | |||
45 |
|
45 | |||
46 | #ifdef WIN32 |
|
46 | #ifdef WIN32 | |
47 | #define SOCEXPLORER_PLUGINS_INSTALL_PATH qApp->applicationDirPath()+"/plugins" |
|
47 | #define SOCEXPLORER_PLUGINS_INSTALL_PATH qApp->applicationDirPath()+"/plugins" | |
48 | #define SOCEXPLORER_CONFIG_PATH qApp->applicationDirPath()+"/config" |
|
48 | #define SOCEXPLORER_CONFIG_PATH qApp->applicationDirPath()+"/config" | |
49 | #define PYMODULES qApp->applicationDirPath()+"/python" |
|
49 | #define PYMODULES qApp->applicationDirPath()+"/python" | |
50 | #else |
|
50 | #else | |
51 | #ifdef UNIX |
|
51 | #ifdef UNIX | |
52 | #define SOCEXPLORER_PLUGINS_INSTALL_PATH QDir::homePath()+"/.SocExplorer/plugins" |
|
52 | #define SOCEXPLORER_PLUGINS_INSTALL_PATH QDir::homePath()+"/.SocExplorer/plugins" | |
53 | #define SOCEXPLORER_CONFIG_PATH QDir::homePath()+"/.SocExplorer/config" |
|
53 | #define SOCEXPLORER_CONFIG_PATH QDir::homePath()+"/.SocExplorer/config" | |
54 | #define PYMODULES "/etc/SocExplorer/python" |
|
54 | #define PYMODULES "/etc/SocExplorer/python" | |
55 | #endif |
|
55 | #endif | |
56 | #endif |
|
56 | #endif | |
57 | #endif // SOCEXPLORER_H |
|
57 | #endif // SOCEXPLORER_H |
@@ -1,43 +1,43 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 | #ifndef TOOLBAR_H |
|
22 | #ifndef TOOLBAR_H | |
23 | #define TOOLBAR_H |
|
23 | #define TOOLBAR_H | |
24 |
|
24 | |||
25 | #include <QDockWidget> |
|
25 | #include <QDockWidget> | |
26 | #include "toolbarcontainer.h" |
|
26 | #include "toolbarcontainer.h" | |
27 | class toolBar : public QDockWidget |
|
27 | class toolBar : public QDockWidget | |
28 | { |
|
28 | { | |
29 | Q_OBJECT |
|
29 | Q_OBJECT | |
30 | public: |
|
30 | public: | |
31 | explicit toolBar(QWidget *parent = 0); |
|
31 | explicit toolBar(QWidget *parent = 0); | |
32 |
|
32 | |||
33 | signals: |
|
33 | signals: | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | public slots: |
|
36 | public slots: | |
37 | void addTool(QDockWidget* widget); |
|
37 | void addTool(QDockWidget* widget); | |
38 | private: |
|
38 | private: | |
39 | toolBarContainer* toolsContainer; |
|
39 | toolBarContainer* toolsContainer; | |
40 |
|
40 | |||
41 | }; |
|
41 | }; | |
42 |
|
42 | |||
43 | #endif // TOOLBAR_H |
|
43 | #endif // TOOLBAR_H |
@@ -1,39 +1,39 | |||||
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) 2012, |
|
3 | -- Copyright (C) 2012, 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 | #ifndef TOOLBARCONTAINER_H |
|
22 | #ifndef TOOLBARCONTAINER_H | |
23 | #define TOOLBARCONTAINER_H |
|
23 | #define TOOLBARCONTAINER_H | |
24 |
|
24 | |||
25 | #include <QMainWindow> |
|
25 | #include <QMainWindow> | |
26 |
|
26 | |||
27 | class toolBarContainer : public QMainWindow |
|
27 | class toolBarContainer : public QMainWindow | |
28 | { |
|
28 | { | |
29 | Q_OBJECT |
|
29 | Q_OBJECT | |
30 | public: |
|
30 | public: | |
31 | explicit toolBarContainer(QWidget *parent = 0); |
|
31 | explicit toolBarContainer(QWidget *parent = 0); | |
32 |
|
32 | |||
33 | signals: |
|
33 | signals: | |
34 |
|
34 | |||
35 | public slots: |
|
35 | public slots: | |
36 |
|
36 | |||
37 | }; |
|
37 | }; | |
38 |
|
38 | |||
39 | #endif // TOOLBARCONTAINER_H |
|
39 | #endif // TOOLBARCONTAINER_H |
General Comments 0
You need to be logged in to leave comments.
Login now