@@ -1,36 +1,37 | |||
|
1 | 1 | # use glob syntax. |
|
2 | 2 | syntax: glob |
|
3 | 3 | |
|
4 | 4 | moc_* |
|
5 | 5 | Makefil* |
|
6 | 6 | qrc_* |
|
7 | 7 | *.qm |
|
8 | 8 | *.tex |
|
9 | 9 | *.html |
|
10 | 10 | *log* |
|
11 | 11 | *.dot |
|
12 | 12 | *.css |
|
13 | 13 | *.md5 |
|
14 | 14 | *.eps |
|
15 | 15 | |
|
16 | 16 | *.toc |
|
17 | 17 | *.map |
|
18 | 18 | *.sty |
|
19 | 19 | *.3 |
|
20 | 20 | *.js |
|
21 | 21 | *.aux |
|
22 | 22 | *.idx |
|
23 | 23 | *.orig |
|
24 | 24 | *.o |
|
25 | 25 | *.dll |
|
26 | 26 | *.a |
|
27 | 27 | *.bin |
|
28 | 28 | *~ |
|
29 | 29 | *.pro.user |
|
30 | 30 | src/PythonQt/tests/PythonQtTest |
|
31 | 31 | src/PythonQt/generator/pythonqt_generator |
|
32 | 32 | src/plugins/common/.preprocessed.tmp |
|
33 | 33 | *.exe |
|
34 | 34 | src/common/.preprocessed.tmp |
|
35 | */.cccc/* | |
|
35 | 36 | syntax: regexp |
|
36 | 37 | bin/* |
@@ -1,1 +1,1 | |||
|
1 | e3a98a04d9ec8685bf222f8d687a614a71927549 src/SocExplorerEngine/PeripheralWidget | |
|
1 | 2c82d72694590cbc2aebb946667f11f60ea89afe src/SocExplorerEngine/PeripheralWidget |
@@ -1,27 +1,27 | |||
|
1 | 1 | |
|
2 | 2 | QT += core gui xml svg network |
|
3 | 3 | contains(QT_MAJOR_VERSION, 5) { |
|
4 | 4 | QT += widgets |
|
5 | 5 | QT += printsupport |
|
6 | 6 | } |
|
7 | 7 | CONFIG(debug, debug|release) { |
|
8 | 8 | DEBUG_EXT = _d |
|
9 | 9 | } else { |
|
10 | 10 | DEBUG_EXT = |
|
11 | 11 | } |
|
12 | 12 | |
|
13 | 13 | SOCEXPLORER_SDK_BUILD="SOCEXPLORER_SDK_BUILD" |
|
14 | 14 | DEFINES += SOCEXPLORER_SDK_BUILD |
|
15 | 15 | |
|
16 | 16 | MOC_DIR = moc |
|
17 | 17 | RCC_DIR = resources |
|
18 | 18 | OBJECTS_DIR = obj |
|
19 | 19 | |
|
20 | 20 | win32:DESTDIR = $${SOCEXPLORER_ROOT}/bin/win32/ |
|
21 | 21 | unix:DESTDIR = $${SOCEXPLORER_ROOT}/bin/linux/ |
|
22 | 22 | |
|
23 | 23 | |
|
24 | 24 | metrics_cccc.target = metrics_cccc |
|
25 |
metrics_cccc.commands = cccc $ |
|
|
25 | metrics_cccc.commands = cccc $(SOURCES) $(HEADERS) | |
|
26 | 26 | |
|
27 | 27 | QMAKE_EXTRA_TARGETS += metrics_cccc |
@@ -1,72 +1,72 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef PYTHONCONSOLE_H |
|
23 | 23 | #define PYTHONCONSOLE_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | 26 | #include <QDockWidget> |
|
27 | 27 | #include <QHBoxLayout> |
|
28 | 28 | #include <QtGui/QDragEnterEvent> |
|
29 | 29 | #include <QtGui/QDragLeaveEvent> |
|
30 | 30 | #include <QtGui/QDragMoveEvent> |
|
31 | 31 | #include <QtGui/QDropEvent> |
|
32 | 32 | #include <QtCore/QMimeData> |
|
33 | 33 | #include <QtCore/QUrl> |
|
34 | 34 | #include <QtCore/QList> |
|
35 | 35 | #include "PythonQt.h" |
|
36 | 36 | #include "PythonQt_QtAll.h" |
|
37 | 37 | #include <gui/PythonQtScriptingConsole.h> |
|
38 | 38 | #include "../plugins/socexplorerplugin.h" |
|
39 | 39 | #include "pythonqtscriptingconsoledandd.h" |
|
40 | 40 | #include <QMainWindow> |
|
41 | 41 | #include "../proxy/socexplorerproxy.h" |
|
42 |
class |
|
|
42 | class SocExplorerMainWindow; | |
|
43 | 43 | class PythonConsole : public QWidget |
|
44 | 44 | { |
|
45 | 45 | Q_OBJECT |
|
46 | 46 | public: |
|
47 | 47 | explicit PythonConsole(socexplorerproxy* proxy,QWidget *parent = 0); |
|
48 | 48 | |
|
49 | 49 | signals: |
|
50 | 50 | void rootDriverDelete(); |
|
51 | 51 | public slots: |
|
52 | 52 | void setBussDriver(socexplorerplugin* driver); |
|
53 | 53 | void removeBussDriver(); |
|
54 | 54 | void removeDriver(const QString& instanceName); |
|
55 | 55 | void pyConsoleRunFiles(const QStringList&); |
|
56 | 56 | void pyConsoleRunFile(const QString& fileName); |
|
57 | 57 | void registerObject(QObject* object,const QString& instanceName); |
|
58 | 58 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
59 | 59 | void addObject(const QString& name, QObject* object); |
|
60 | 60 | protected: |
|
61 | 61 | QSize sizeHint(); |
|
62 | 62 | |
|
63 | 63 | private: |
|
64 | 64 | QHBoxLayout* mainlayout; |
|
65 | 65 | socexplorerplugin* bussdriver; |
|
66 | 66 | PythonQtScriptingConsoleDandD* console; |
|
67 | 67 | PythonQtObjectPtr* mainContext; |
|
68 | 68 | socexplorerproxy* proxy; |
|
69 | 69 | //LPMONMainWindow* mainwin; |
|
70 | 70 | }; |
|
71 | 71 | |
|
72 | 72 | #endif // PYTHONCONSOLE_H |
@@ -1,54 +1,54 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef PYTHONQTSCRIPTINGCONSOLEDANDD_H |
|
23 | 23 | #define PYTHONQTSCRIPTINGCONSOLEDANDD_H |
|
24 | 24 | #include "PythonQt.h" |
|
25 | 25 | #include "PythonQt_QtAll.h" |
|
26 | 26 | #include "gui/PythonQtScriptingConsole.h" |
|
27 | 27 | #include "../plugins/socexplorerplugin.h" |
|
28 | 28 | #include <QtGui/QDragEnterEvent> |
|
29 | 29 | #include <QtGui/QDragLeaveEvent> |
|
30 | 30 | #include <QtGui/QDragMoveEvent> |
|
31 | 31 | #include <QtGui/QDropEvent> |
|
32 | 32 | #include <QtCore/QMimeData> |
|
33 | 33 | #include <QtCore/QUrl> |
|
34 | 34 | #include <QtCore/QList> |
|
35 | 35 | #include "NicePyConsole/NicePyConsole.h" |
|
36 | 36 | |
|
37 | 37 | class PythonQtScriptingConsoleDandD : public NicePyConsole |
|
38 | 38 | { |
|
39 | 39 | Q_OBJECT |
|
40 | 40 | public: |
|
41 | 41 | PythonQtScriptingConsoleDandD(QWidget* parent, const PythonQtObjectPtr& context, Qt::WindowFlags i = 0); |
|
42 | 42 | |
|
43 | 43 | //void pyConsoleRunFiles(const QStringList&); |
|
44 | 44 | signals: |
|
45 | 45 | void pyConsoleRunFiles(const QStringList&); |
|
46 | 46 | protected: |
|
47 | 47 | void dropEvent(QDropEvent * event); |
|
48 | 48 | void dragMoveEvent(QDragMoveEvent *e); |
|
49 | 49 | void dragEnterEvent(QDragEnterEvent *e); |
|
50 | 50 | private: |
|
51 | 51 | |
|
52 | 52 | }; |
|
53 | 53 | |
|
54 | 54 | #endif // PYTHONQTSCRIPTINGCONSOLEDANDD_H |
@@ -1,92 +1,92 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "registerdata.h" |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | |
|
27 | 27 | |
|
28 | 28 | ucSystemOnChip::ucSystemOnChip(QObject *parent) |
|
29 | 29 | :QObject(parent),QList<ucPeripheral*>() |
|
30 | 30 | { |
|
31 | 31 | |
|
32 | 32 | } |
|
33 | 33 | |
|
34 | 34 | |
|
35 | 35 | ucPeripheral::ucPeripheral(QObject *parent) |
|
36 | 36 | :QObject(parent),QList<ucRegister*>() |
|
37 | 37 | { |
|
38 | 38 | |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | 41 | |
|
42 | 42 | |
|
43 | 43 | ucRegister::ucRegister(QObject *parent) |
|
44 | 44 | :QObject(parent) |
|
45 | 45 | { |
|
46 | 46 | |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | quint32 ucRegister::value() |
|
50 | 50 | { |
|
51 | 51 | return this->p_value; |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | void ucRegister::setName(const QString &name) |
|
55 | 55 | { |
|
56 | 56 | this->p_name = name; |
|
57 | 57 | emit nameChanged(this->p_name); |
|
58 | 58 | } |
|
59 | 59 | |
|
60 | 60 | void ucRegister::setValue(quint32 value) |
|
61 | 61 | { |
|
62 | 62 | this->p_value = value; |
|
63 | 63 | emit valueChanged(this->p_value); |
|
64 | 64 | } |
|
65 | 65 | |
|
66 | 66 | void ucRegister::setOffset(qint64 offset) |
|
67 | 67 | { |
|
68 | 68 | this->p_addressOffset = offset; |
|
69 | 69 | emit offsetChanged(this->p_addressOffset); |
|
70 | 70 | } |
|
71 | 71 | |
|
72 | 72 | void ucSystemOnChip::setName(const QString &name) |
|
73 | 73 | { |
|
74 | 74 | this->p_name = name; |
|
75 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef REGISTERDATA_H |
|
23 | 23 | #define REGISTERDATA_H |
|
24 | 24 | #include <QString> |
|
25 | 25 | #include <QList> |
|
26 | 26 | #include <QObject> |
|
27 | 27 | |
|
28 | 28 | //class ucBitfield: public QObject |
|
29 | 29 | //{ |
|
30 | 30 | // Q_OBJECT |
|
31 | 31 | //public: |
|
32 | 32 | // explicit ucBitfield(QObject* parent =0); |
|
33 | 33 | // explicit ucBitfield(const QString& name,int offset,const QString& description,QObject* parent =0); |
|
34 | 34 | // QString name(); |
|
35 | 35 | // int offset(); |
|
36 | 36 | // QString description(); |
|
37 | 37 | //public slots: |
|
38 | 38 | // void setName(const QString& name); |
|
39 | 39 | // void setOffset(int offset); |
|
40 | 40 | // void setDescription(const QString& description); |
|
41 | 41 | |
|
42 | 42 | //signals: |
|
43 | 43 | // void nameChanged(const QString& name); |
|
44 | 44 | // void offsetChanged(int offset); |
|
45 | 45 | // void descriptionChanged(const QString& description); |
|
46 | 46 | //private: |
|
47 | 47 | |
|
48 | 48 | // QString p_name; |
|
49 | 49 | // int p_offset; |
|
50 | 50 | // QString p_description; |
|
51 | 51 | //}; |
|
52 | 52 | |
|
53 | 53 | class ucRegister :public QObject |
|
54 | 54 | { |
|
55 | 55 | Q_OBJECT |
|
56 | 56 | public: |
|
57 | 57 | ucRegister(QObject* parent=0); |
|
58 | 58 | quint32 value(); |
|
59 | 59 | public slots: |
|
60 | 60 | void setName(const QString& name); |
|
61 | 61 | void setValue(quint32 value); |
|
62 | 62 | void setOffset(qint64 offset); |
|
63 | 63 | signals: |
|
64 | 64 | void nameChanged(const QString& name); |
|
65 | 65 | void offsetChanged(qint64 offset); |
|
66 | 66 | void valueChanged(quint32 value); |
|
67 | 67 | private: |
|
68 | 68 | QString p_name; |
|
69 | 69 | qint64 p_addressOffset; |
|
70 | 70 | quint32 p_value; |
|
71 | 71 | }; |
|
72 | 72 | |
|
73 | 73 | class ucPeripheral: public QObject,public QList<ucRegister*> |
|
74 | 74 | { |
|
75 | 75 | Q_OBJECT |
|
76 | 76 | public: |
|
77 | 77 | ucPeripheral(QObject* parent=0); |
|
78 | 78 | private: |
|
79 | 79 | QString p_name; |
|
80 | 80 | qint64 p_baseAddress; |
|
81 | 81 | }; |
|
82 | 82 | |
|
83 | 83 | |
|
84 | 84 | |
|
85 | 85 | class ucSystemOnChip : public QObject,public QList<ucPeripheral*> |
|
86 | 86 | { |
|
87 | 87 | Q_OBJECT |
|
88 | 88 | public: |
|
89 | 89 | ucSystemOnChip(QObject* parent=0); |
|
90 | 90 | public slots: |
|
91 | 91 | void setName(const QString& name); |
|
92 | 92 | signals: |
|
93 | 93 | void nameChanged(const QString& name); |
|
94 | 94 | private: |
|
95 | 95 | QString p_name; |
|
96 | 96 | }; |
|
97 | 97 | |
|
98 | 98 | |
|
99 | 99 | |
|
100 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | |
|
23 | 23 | #include "socclk.h" |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | |
|
27 | 27 | SOCclk::SOCclk(const QString &name, qint64 value, qint64 divisor, qint64 multiplier) |
|
28 | 28 | { |
|
29 | 29 | this->p_Name = name; |
|
30 | 30 | this->p_Value = value; |
|
31 | 31 | this->p_parentClk = NULL; |
|
32 | 32 | this->p_Multiplier= multiplier; |
|
33 | 33 | this->p_Divisor = divisor; |
|
34 | 34 | } |
|
35 | 35 | |
|
36 | 36 | void SOCclk::appendChild(SOCclk *child) |
|
37 | 37 | { |
|
38 | 38 | this->p_childrenClk.append(child); |
|
39 | 39 | child->setParentClk(this); |
|
40 | 40 | } |
|
41 | 41 | |
|
42 | 42 | void SOCclk::setParentClk(SOCclk *parent) |
|
43 | 43 | { |
|
44 | 44 | p_parentClk = parent; |
|
45 | 45 | } |
|
46 | 46 | |
|
47 | 47 | SOCclk *SOCclk::getClk(const QString &name) |
|
48 | 48 | { |
|
49 | 49 | SOCclk* clk=NULL; |
|
50 | 50 | if(this->p_Name==name)return this; |
|
51 | 51 | for(int i=0;i<=p_childrenClk.count();i++) |
|
52 | 52 | { |
|
53 | 53 | clk =p_childrenClk.at(i)->getClk(name); |
|
54 | 54 | if(clk!=NULL)break; |
|
55 | 55 | } |
|
56 | 56 | return clk; |
|
57 | 57 | } |
|
58 | 58 | |
|
59 | 59 | qint64 SOCclk::Value() |
|
60 | 60 | { |
|
61 | 61 | if(p_parentClk==NULL) |
|
62 | 62 | return p_Value; |
|
63 | 63 | return p_parentClk->Value()*p_Multiplier/p_Divisor; |
|
64 | 64 | } |
|
65 | 65 | |
|
66 | 66 | void SOCclk::setValue(qint64 value) |
|
67 | 67 | { |
|
68 | 68 | this->p_Value = value; |
|
69 | 69 | } |
|
70 | 70 | |
|
71 | 71 | qint64 SOCclk::Divisor() |
|
72 | 72 | { |
|
73 | 73 | return p_Divisor; |
|
74 | 74 | } |
|
75 | 75 | |
|
76 | 76 | void SOCclk::setDivisor(qint64 divisor) |
|
77 | 77 | { |
|
78 | 78 | p_Divisor = divisor; |
|
79 | 79 | } |
|
80 | 80 | |
|
81 | 81 | qint64 SOCclk::Multiplier() |
|
82 | 82 | { |
|
83 | 83 | return p_Multiplier; |
|
84 | 84 | } |
|
85 | 85 | |
|
86 | 86 | void SOCclk::setMultiplier(qint64 multiplier) |
|
87 | 87 | { |
|
88 | 88 | p_Multiplier = multiplier; |
|
89 | 89 | } |
|
90 | 90 | |
|
91 | 91 | QString SOCclk::Name() |
|
92 | 92 | { |
|
93 | 93 | return p_Name; |
|
94 | 94 | } |
|
95 | 95 | |
|
96 | 96 | void SOCclk::setName(const QString &name) |
|
97 | 97 | { |
|
98 | 98 | this->p_Name = name; |
|
99 | 99 | } |
@@ -1,55 +1,55 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | |
|
23 | 23 | #ifndef SOCCLK_H |
|
24 | 24 | #define SOCCLK_H |
|
25 | 25 | #include <QString> |
|
26 | 26 | #include <QList> |
|
27 | 27 | #include <socexplorer.h> |
|
28 | 28 | |
|
29 | 29 | class SOCEXPLORER_EXPORT SOCclk |
|
30 | 30 | { |
|
31 | 31 | public: |
|
32 | 32 | SOCclk(const QString& name, qint64 value, qint64 divisor, qint64 multiplier); |
|
33 | 33 | void appendChild(SOCclk* child); |
|
34 | 34 | void setParentClk(SOCclk* parent); |
|
35 | 35 | SOCclk* getClk(const QString& name); |
|
36 | 36 | |
|
37 | 37 | qint64 Value(); |
|
38 | 38 | void setValue(qint64 value); |
|
39 | 39 | qint64 Divisor(); |
|
40 | 40 | void setDivisor(qint64 divisor); |
|
41 | 41 | qint64 Multiplier(); |
|
42 | 42 | void setMultiplier(qint64 multiplier); |
|
43 | 43 | QString Name(); |
|
44 | 44 | void setName(const QString& name); |
|
45 | 45 | private: |
|
46 | 46 | qint64 p_Value; |
|
47 | 47 | QString p_Name; |
|
48 | 48 | qint64 p_Divisor; |
|
49 | 49 | qint64 p_Multiplier; |
|
50 | 50 | QList<SOCclk*> p_childrenClk; |
|
51 | 51 | SOCclk* p_parentClk; |
|
52 | 52 | }; |
|
53 | 53 | |
|
54 | 54 | |
|
55 | 55 | #endif // SOCCLK_H |
@@ -1,43 +1,43 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "socexplorerenumdevice.h" |
|
23 | 23 | |
|
24 | 24 | socExplorerEnumDevice::socExplorerEnumDevice(SOCModel* soc, int VID, int PID, qint32 baseAddress, const QString &name, QObject *parent) |
|
25 | 25 | :QObject(parent) |
|
26 | 26 | { |
|
27 | 27 | _VID=VID; |
|
28 | 28 | _PID=PID; |
|
29 | 29 | _baseAddress=baseAddress; |
|
30 | 30 | _devName=new QString(name); |
|
31 | 31 | _visible=true; |
|
32 | 32 | _SOC = soc; |
|
33 | 33 | } |
|
34 | 34 | |
|
35 | 35 | void socExplorerEnumDevice::writeReg(qint32 address, qint32 value) |
|
36 | 36 | { |
|
37 | 37 | _SOC->writeReg(address,value); |
|
38 | 38 | } |
|
39 | 39 | |
|
40 | 40 | qint32 socExplorerEnumDevice::readReg(qint32 address) |
|
41 | 41 | { |
|
42 | 42 | return _SOC->readReg(address); |
|
43 | 43 | } |
@@ -1,56 +1,56 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef SOCEXPLORERENUMDEVICE_H |
|
23 | 23 | #define SOCEXPLORERENUMDEVICE_H |
|
24 | 24 | |
|
25 | 25 | #include <QObject> |
|
26 | 26 | #include <stdint.h> |
|
27 | 27 | #include <socexplorerplugin.h> |
|
28 | 28 | #include <socmodel.h> |
|
29 | 29 | |
|
30 | 30 | class SOCEXPLORER_EXPORT socExplorerEnumDevice : public QObject |
|
31 | 31 | { |
|
32 | 32 | Q_OBJECT |
|
33 | 33 | public: |
|
34 | 34 | explicit socExplorerEnumDevice(SOCModel* soc,int VID,int PID,qint32 baseAddress,const QString& name,QObject *parent = 0); |
|
35 | 35 | qint32 baseAddress(){return _baseAddress;} |
|
36 | 36 | int VID(){return _VID;} |
|
37 | 37 | int PID(){return _PID;} |
|
38 | 38 | QString name(){return *_devName;} |
|
39 | 39 | bool visible(){return _visible;} |
|
40 | 40 | void setVisible(bool visible){_visible=visible;} |
|
41 | 41 | signals: |
|
42 | 42 | |
|
43 | 43 | public slots: |
|
44 | 44 | void writeReg(qint32 address,qint32 value); |
|
45 | 45 | qint32 readReg(qint32 address); |
|
46 | 46 | private: |
|
47 | 47 | bool _visible; |
|
48 | 48 | qint32 _baseAddress; |
|
49 | 49 | int _VID; |
|
50 | 50 | int _PID; |
|
51 | 51 | QString* _devName; |
|
52 | 52 | SOCModel* _SOC; |
|
53 | 53 | |
|
54 | 54 | }; |
|
55 | 55 | |
|
56 | 56 | #endif // SOCEXPLORERENUMDEVICE_H |
@@ -1,99 +1,99 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "socmodel.h" |
|
23 | 23 | #include <socexplorerenumdevice.h> |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | SOCModel::SOCModel(socexplorerplugin *rootDev, QObject *parent): |
|
27 | 27 | QObject(parent) |
|
28 | 28 | { |
|
29 | 29 | p_rootDev = rootDev; |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | 32 | qint32 SOCModel::getEnumDeviceBaseAddress(int VID, int PID, int count) |
|
33 | 33 | { |
|
34 | 34 | for(int i=0;i<p_enumeratedDevices.count();i++) |
|
35 | 35 | { |
|
36 | 36 | if((p_enumeratedDevices.at(i)->VID()==VID) && (p_enumeratedDevices.at(i)->PID()==PID)) |
|
37 | 37 | { |
|
38 | 38 | if(count==0) |
|
39 | 39 | { |
|
40 | 40 | return p_enumeratedDevices.at(i)->baseAddress(); |
|
41 | 41 | } |
|
42 | 42 | count--; |
|
43 | 43 | } |
|
44 | 44 | } |
|
45 | 45 | return -1; |
|
46 | 46 | } |
|
47 | 47 | |
|
48 | 48 | socExplorerEnumDevice *SOCModel::addEnumDevice( int VID, int PID, qint32 baseAddress, const QString &name) |
|
49 | 49 | { |
|
50 | 50 | if(enumDeviceExists(baseAddress)) |
|
51 | 51 | return getEnumDevice(baseAddress); |
|
52 | 52 | socExplorerEnumDevice* device= new socExplorerEnumDevice(this,VID,PID,baseAddress,name); |
|
53 | 53 | p_enumeratedDevices.append(device); |
|
54 | 54 | return device; |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | 57 | int SOCModel::addEnumDevice(socExplorerEnumDevice *device) |
|
58 | 58 | { |
|
59 | 59 | if(enumDeviceExists(device->baseAddress())) |
|
60 | 60 | return 0; |
|
61 | 61 | p_enumeratedDevices.append(device); |
|
62 | 62 | return 1; |
|
63 | 63 | } |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 | |
|
67 | 67 | bool SOCModel::enumDeviceExists(qint32 baseAddress) |
|
68 | 68 | { |
|
69 | 69 | for(int i=0;i<p_enumeratedDevices.count();i++) |
|
70 | 70 | { |
|
71 | 71 | if(p_enumeratedDevices.at(i)->baseAddress()==baseAddress) |
|
72 | 72 | return true; |
|
73 | 73 | } |
|
74 | 74 | return false; |
|
75 | 75 | } |
|
76 | 76 | |
|
77 | 77 | socExplorerEnumDevice *SOCModel::getEnumDevice(qint32 baseAddress) |
|
78 | 78 | { |
|
79 | 79 | for(int i=0;i<p_enumeratedDevices.count();i++) |
|
80 | 80 | { |
|
81 | 81 | if(p_enumeratedDevices.at(i)->baseAddress()==baseAddress) |
|
82 | 82 | return p_enumeratedDevices.at(i); |
|
83 | 83 | } |
|
84 | 84 | return NULL; |
|
85 | 85 | } |
|
86 | 86 | |
|
87 | 87 | |
|
88 | 88 | void SOCModel::writeReg(qint32 address, qint32 value) |
|
89 | 89 | { |
|
90 | 90 | uint valueInt=value,addressInt=address; |
|
91 | 91 | p_rootDev->Write(&valueInt,1,addressInt); |
|
92 | 92 | } |
|
93 | 93 | |
|
94 | 94 | qint32 SOCModel::readReg(qint32 address) |
|
95 | 95 | { |
|
96 | 96 | uint valueInt=0,addressInt=address; |
|
97 | 97 | p_rootDev->Read(&valueInt,1,addressInt); |
|
98 | 98 | return (qint32)valueInt; |
|
99 | 99 | } |
@@ -1,115 +1,115 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | |
|
23 | 23 | #ifndef REGISTERSMODEL_H |
|
24 | 24 | #define REGISTERSMODEL_H |
|
25 | 25 | #include <QString> |
|
26 | 26 | #include <QList> |
|
27 | 27 | #include <QObject> |
|
28 | 28 | #include <QDomDocument> |
|
29 | 29 | #include <QDomElement> |
|
30 | 30 | #include "registerdata.h" |
|
31 | 31 | #include <socclk.h> |
|
32 | 32 | #include <socexplorerplugin.h> |
|
33 | 33 | //#include <socexplorerenumdevice.h> |
|
34 | 34 | class socExplorerEnumDevice; |
|
35 | 35 | |
|
36 | 36 | class registerBitFieldModel |
|
37 | 37 | { |
|
38 | 38 | public: |
|
39 | 39 | registerBitFieldModel(const QString& name,const QString& description, |
|
40 | 40 | int size, int offset, bool rw) |
|
41 | 41 | { |
|
42 | 42 | this->name = name; |
|
43 | 43 | this->description = description; |
|
44 | 44 | this->size = size; |
|
45 | 45 | this->offset = offset; |
|
46 | 46 | this->rw = rw; |
|
47 | 47 | } |
|
48 | 48 | QString name; |
|
49 | 49 | QString description; |
|
50 | 50 | int size; |
|
51 | 51 | int offset; |
|
52 | 52 | bool rw; |
|
53 | 53 | }; |
|
54 | 54 | |
|
55 | 55 | class registerModel |
|
56 | 56 | { |
|
57 | 57 | public: |
|
58 | 58 | registerModel(const QString& name,qint32 offset) |
|
59 | 59 | { |
|
60 | 60 | this->name = name; |
|
61 | 61 | this->offset = offset; |
|
62 | 62 | } |
|
63 | 63 | QString name; |
|
64 | 64 | qint32 offset; |
|
65 | 65 | QList<registerBitFieldModel> bitfields; |
|
66 | 66 | }; |
|
67 | 67 | |
|
68 | 68 | class peripheralModel |
|
69 | 69 | { |
|
70 | 70 | public: |
|
71 | 71 | peripheralModel(const QString& name) |
|
72 | 72 | { |
|
73 | 73 | this->name = name; |
|
74 | 74 | } |
|
75 | 75 | QString name; |
|
76 | 76 | QList<registerModel> registers; |
|
77 | 77 | }; |
|
78 | 78 | |
|
79 | 79 | |
|
80 | 80 | class SOCEXPLORER_EXPORT SOCModel :public QObject |
|
81 | 81 | { |
|
82 | 82 | Q_OBJECT |
|
83 | 83 | public: |
|
84 | 84 | SOCModel(socexplorerplugin* rootDev,QObject* parent=0); |
|
85 | 85 | // qint32 getRegValue(qint32 baseAddress); |
|
86 | 86 | bool isRootDev(socexplorerplugin* rootDev) |
|
87 | 87 | { |
|
88 | 88 | return rootDev==p_rootDev; |
|
89 | 89 | } |
|
90 | 90 | bool enumDeviceExists(qint32 baseAddress); |
|
91 | 91 | socExplorerEnumDevice *getEnumDevice(qint32 baseAddress); |
|
92 | 92 | public slots: |
|
93 | 93 | //void setRegValue(qint32 baseAddress,qint32 value); |
|
94 | 94 | qint32 getEnumDeviceBaseAddress(int VID,int PID,int count=0); |
|
95 | 95 | socExplorerEnumDevice* addEnumDevice(int VID, int PID, qint32 baseAddress, const QString& name); |
|
96 | 96 | int addEnumDevice(socExplorerEnumDevice* device); |
|
97 | 97 | void writeReg(qint32 address,qint32 value); |
|
98 | 98 | qint32 readReg(qint32 address); |
|
99 | 99 | private: |
|
100 | 100 | socexplorerplugin* p_rootDev; |
|
101 | 101 | QList<socExplorerEnumDevice*> p_enumeratedDevices; |
|
102 | 102 | QList<SOCclk*> clktree; |
|
103 | 103 | }; |
|
104 | 104 | |
|
105 | 105 | |
|
106 | 106 | |
|
107 | 107 | |
|
108 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "XMLdata.h" |
|
23 | 23 | |
|
24 | 24 | xmlDataBitfield::xmlDataBitfield(QObject *parent) |
|
25 | 25 | :QObject(parent) |
|
26 | 26 | { |
|
27 | 27 | |
|
28 | 28 | } |
|
29 | 29 | |
|
30 | 30 | xmlDataBitfield::xmlDataBitfield(const QString& name,int offset,const QString& description,QObject* parent) |
|
31 | 31 | { |
|
32 | 32 | Q_UNUSED(name) |
|
33 | 33 | Q_UNUSED(offset) |
|
34 | 34 | Q_UNUSED(offset) |
|
35 | 35 | Q_UNUSED(description) |
|
36 | 36 | Q_UNUSED(parent) |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | QString xmlDataBitfield::name() |
|
40 | 40 | { |
|
41 | 41 | return this->p_name; |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | int xmlDataBitfield::offset() |
|
45 | 45 | { |
|
46 | 46 | return this->p_offset; |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | QString xmlDataBitfield::description() |
|
50 | 50 | { |
|
51 | 51 | return this->p_description; |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | |
|
55 | 55 | void xmlDataBitfield::setName(const QString &name) |
|
56 | 56 | { |
|
57 | 57 | this->p_name = name; |
|
58 | 58 | emit nameChanged(this->p_name); |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | 61 | void xmlDataBitfield::setOffset(int offset) |
|
62 | 62 | { |
|
63 | 63 | this->p_offset = offset; |
|
64 | 64 | emit offsetChanged(this->p_offset); |
|
65 | 65 | } |
|
66 | 66 | |
|
67 | 67 | void xmlDataBitfield::setDescription(const QString &description) |
|
68 | 68 | { |
|
69 | 69 | this->p_description = description; |
|
70 | 70 | emit descriptionChanged(this->p_description); |
|
71 | 71 | } |
|
72 | 72 | |
|
73 | 73 | xmlDataRegister::xmlDataRegister(QObject *parent) |
|
74 | 74 | :QObject(parent),QList<xmlDataBitfield*>() |
|
75 | 75 | { |
|
76 | 76 | |
|
77 | 77 | } |
|
78 | 78 | |
|
79 | 79 | void xmlDataRegister::setName(const QString &name) |
|
80 | 80 | { |
|
81 | 81 | this->p_name = name; |
|
82 | 82 | emit nameChanged(this->p_name); |
|
83 | 83 | } |
|
84 | 84 | |
|
85 | 85 | void xmlDataRegister::setValue(quint32 value) |
|
86 | 86 | { |
|
87 | 87 | this->p_value = value; |
|
88 | 88 | emit valueChanged(this->p_value); |
|
89 | 89 | } |
|
90 | 90 | |
|
91 | 91 | void xmlDataRegister::setOffset(qint64 offset) |
|
92 | 92 | { |
|
93 | 93 | this->p_addressOffset = offset; |
|
94 | 94 | emit offsetChanged(this->p_addressOffset); |
|
95 | 95 | } |
|
96 | 96 | |
|
97 | 97 | xmlDataPeripheral::xmlDataPeripheral(QObject *parent) |
|
98 | 98 | :QObject(parent), QList<xmlDataRegister*>() |
|
99 | 99 | { |
|
100 | 100 | |
|
101 | 101 | } |
|
102 | 102 | |
|
103 | 103 | xmlDataSystemOnChip::xmlDataSystemOnChip(QObject *parent) |
|
104 | 104 | :QObject(parent),QList<xmlDataRegister*>() |
|
105 | 105 | { |
|
106 | 106 | |
|
107 | 107 | } |
|
108 | 108 | |
|
109 | 109 | void xmlDataSystemOnChip::setName(const QString &name) |
|
110 | 110 | { |
|
111 | 111 | this->p_name = name; |
|
112 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef XMLDATA_H |
|
23 | 23 | #define XMLDATA_H |
|
24 | 24 | #include <QString> |
|
25 | 25 | #include <QList> |
|
26 | 26 | #include <QObject> |
|
27 | 27 | |
|
28 | 28 | class xmlDataBitfield: public QObject |
|
29 | 29 | { |
|
30 | 30 | Q_OBJECT |
|
31 | 31 | public: |
|
32 | 32 | explicit xmlDataBitfield(QObject* parent =0); |
|
33 | 33 | explicit xmlDataBitfield(const QString& name,int offset,const QString& description,QObject* parent =0); |
|
34 | 34 | QString name(); |
|
35 | 35 | int offset(); |
|
36 | 36 | QString description(); |
|
37 | 37 | public slots: |
|
38 | 38 | void setName(const QString& name); |
|
39 | 39 | void setOffset(int offset); |
|
40 | 40 | void setDescription(const QString& description); |
|
41 | 41 | |
|
42 | 42 | signals: |
|
43 | 43 | void nameChanged(const QString& name); |
|
44 | 44 | void offsetChanged(int offset); |
|
45 | 45 | void descriptionChanged(const QString& description); |
|
46 | 46 | private: |
|
47 | 47 | |
|
48 | 48 | QString p_name; |
|
49 | 49 | int p_offset; |
|
50 | 50 | QString p_description; |
|
51 | 51 | }; |
|
52 | 52 | |
|
53 | 53 | |
|
54 | 54 | |
|
55 | 55 | class xmlDataRegister : public QObject, public QList<xmlDataBitfield*> |
|
56 | 56 | { |
|
57 | 57 | Q_OBJECT |
|
58 | 58 | public: |
|
59 | 59 | xmlDataRegister(QObject* parent=0); |
|
60 | 60 | quint32 value(); |
|
61 | 61 | public slots: |
|
62 | 62 | void setName(const QString& name); |
|
63 | 63 | void setValue(quint32 value); |
|
64 | 64 | void setOffset(qint64 offset); |
|
65 | 65 | signals: |
|
66 | 66 | void nameChanged(const QString& name); |
|
67 | 67 | void offsetChanged(qint64 offset); |
|
68 | 68 | void valueChanged(quint32 value); |
|
69 | 69 | private: |
|
70 | 70 | QString p_name; |
|
71 | 71 | qint64 p_addressOffset; |
|
72 | 72 | quint32 p_value; |
|
73 | 73 | }; |
|
74 | 74 | |
|
75 | 75 | class xmlDataPeripheral:public QObject, public QList<xmlDataRegister*> |
|
76 | 76 | { |
|
77 | 77 | Q_OBJECT |
|
78 | 78 | public: |
|
79 | 79 | xmlDataPeripheral(QObject* parent=0); |
|
80 | 80 | private: |
|
81 | 81 | QString p_name; |
|
82 | 82 | qint64 p_baseAddress; |
|
83 | 83 | }; |
|
84 | 84 | |
|
85 | 85 | |
|
86 | 86 | |
|
87 | 87 | class xmlDataSystemOnChip : public QObject, public QList<xmlDataRegister*> |
|
88 | 88 | { |
|
89 | 89 | Q_OBJECT |
|
90 | 90 | public: |
|
91 | 91 | xmlDataSystemOnChip(QObject* parent=0); |
|
92 | 92 | public slots: |
|
93 | 93 | void setName(const QString& name); |
|
94 | 94 | signals: |
|
95 | 95 | void nameChanged(const QString& name); |
|
96 | 96 | private: |
|
97 | 97 | QString p_name; |
|
98 | 98 | }; |
|
99 | 99 | |
|
100 | 100 | |
|
101 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "XMLmodel.h" |
|
23 | 23 | #include <socexplorerengine.h> |
|
24 | 24 | #include <QFile> |
|
25 | 25 | #include <QDebug> |
|
26 | 26 | |
|
27 | 27 | socExplorerXmlModel::socExplorerXmlModel(QObject *parent) |
|
28 | 28 | :QObject(parent) |
|
29 | 29 | { |
|
30 | 30 | p_driver = new XMLDriver; |
|
31 | 31 | p_driver->scanXmlFiles(); |
|
32 | 32 | this->updateSOClist(); |
|
33 | 33 | } |
|
34 | 34 | |
|
35 | 35 | int socExplorerXmlModel::checkXmlFile(const QString &fileName) |
|
36 | 36 | { |
|
37 | 37 | return p_driver->checkXmlFile(fileName); |
|
38 | 38 | } |
|
39 | 39 | |
|
40 | 40 | int socExplorerXmlModel::createXmlFile(const QString &fileName) |
|
41 | 41 | { |
|
42 | 42 | return p_driver->createXmlFile(fileName); |
|
43 | 43 | } |
|
44 | 44 | |
|
45 | 45 | QList<xmlfile *> socExplorerXmlModel::getFileList(const QString &tagNameFilter) |
|
46 | 46 | { |
|
47 | 47 | return p_driver->getFileList(tagNameFilter); |
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | QList<QDomNodeList> socExplorerXmlModel::getAllNodes(const QString &tagName) |
|
51 | 51 | { |
|
52 | 52 | return p_driver->getAllNodes(tagName); |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | 55 | QStringList socExplorerXmlModel::getPeripheralRegList(const QString &peripheralName) |
|
56 | 56 | { |
|
57 | 57 | QStringList result; |
|
58 | 58 | QList<QDomNodeList> nodeList = p_driver->getAllNodes("peripheral"); |
|
59 | 59 | for(int i=0;i<nodeList.count();i++) |
|
60 | 60 | { |
|
61 | 61 | for(int l=0;l<nodeList.at(i).count();l++) |
|
62 | 62 | { |
|
63 | 63 | if(peripheralName==nodeList.at(i).at(l).toElement().attribute("name","name")) |
|
64 | 64 | { |
|
65 | 65 | QDomNodeList registers=nodeList.at(i).at(l).toElement().elementsByTagName("register"); |
|
66 | 66 | for(int m=0;m<registers.count();m++) |
|
67 | 67 | { |
|
68 | 68 | result.append(registers.at(m).toElement().attribute("name","No name")); |
|
69 | 69 | } |
|
70 | 70 | } |
|
71 | 71 | } |
|
72 | 72 | } |
|
73 | 73 | return result; |
|
74 | 74 | } |
|
75 | 75 | |
|
76 | 76 | peripheralModel socExplorerXmlModel::getPeripheral(const QString &peripheralName) |
|
77 | 77 | { |
|
78 | 78 | peripheralModel result= peripheralModel(peripheralName); |
|
79 | 79 | QList<QDomNodeList> nodeList = p_driver->getAllNodes("peripheral"); |
|
80 | 80 | QDomNodeList filteredPeriph; |
|
81 | 81 | for(int i=0;i<nodeList.count();i++) |
|
82 | 82 | { |
|
83 | 83 | for(int l=0;l<nodeList.at(i).count();l++) |
|
84 | 84 | { |
|
85 | 85 | if(peripheralName==nodeList.at(i).at(l).toElement().attribute("name","name")) |
|
86 | 86 | { |
|
87 | 87 | filteredPeriph = nodeList.at(i).at(l).toElement().elementsByTagName("register"); |
|
88 | 88 | p_getRegs(&result,&filteredPeriph); |
|
89 | 89 | } |
|
90 | 90 | } |
|
91 | 91 | } |
|
92 | 92 | return result; |
|
93 | 93 | } |
|
94 | 94 | |
|
95 | 95 | |
|
96 | 96 | |
|
97 | 97 | void socExplorerXmlModel::updateSOClist() |
|
98 | 98 | { |
|
99 | 99 | QString socName; |
|
100 | 100 | this->clearSocList(); |
|
101 | 101 | QList<QDomNodeList> nodeList = p_driver->getAllNodes("soc"); |
|
102 | 102 | for(int i=0;i<nodeList.count();i++) |
|
103 | 103 | { |
|
104 | 104 | for(int l=0;l<nodeList.at(i).count();l++) |
|
105 | 105 | { |
|
106 | 106 | socName = nodeList.at(i).at(l).toElement().attribute("name","name"); |
|
107 | 107 | qDebug()<<"Found SOC " + socName; |
|
108 | 108 | } |
|
109 | 109 | } |
|
110 | 110 | } |
|
111 | 111 | |
|
112 | 112 | void socExplorerXmlModel::registerXmlFile(const QString &fileName) |
|
113 | 113 | { |
|
114 | 114 | p_driver->registerXmlFile(fileName); |
|
115 | 115 | } |
|
116 | 116 | |
|
117 | 117 | void socExplorerXmlModel::scanXmlFiles() |
|
118 | 118 | { |
|
119 | 119 | p_driver->scanXmlFiles(); |
|
120 | 120 | } |
|
121 | 121 | |
|
122 | 122 | void socExplorerXmlModel::p_getRegs(peripheralModel *periph, QDomNodeList *nodes) |
|
123 | 123 | { |
|
124 | 124 | QString name; |
|
125 | 125 | QString description; |
|
126 | 126 | int size=0; |
|
127 | 127 | int offset=0; |
|
128 | 128 | bool rw; |
|
129 | 129 | for(int i=0;i<nodes->count();i++) |
|
130 | 130 | { |
|
131 | 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 | 132 | QDomNodeList bitfields=nodes->at(i).toElement().elementsByTagName("bitField"); |
|
133 | 133 | for(int l=0;l<bitfields.count();l++) |
|
134 | 134 | { |
|
135 | 135 | name = bitfields.at(l).toElement().attribute("name","No name"); |
|
136 | 136 | description = bitfields.at(l).toElement().attribute("desc",""); |
|
137 | 137 | offset = bitfields.at(l).toElement().attribute("offset",QString("%1").arg(offset+size)).toInt(); |
|
138 | 138 | size = bitfields.at(l).toElement().attribute("size","1").toInt(); |
|
139 | 139 | rw = bitfields.at(l).toElement().attribute("mode","1").toInt()==3; |
|
140 | 140 | periph->registers.last().bitfields.append(registerBitFieldModel(name,description,size,offset,rw)); |
|
141 | 141 | } |
|
142 | 142 | size = 0; |
|
143 | 143 | offset = 0; |
|
144 | 144 | } |
|
145 | 145 | } |
|
146 | 146 | |
|
147 | 147 | void socExplorerXmlModel::clearSocList() |
|
148 | 148 | { |
|
149 | 149 | xmlDataSystemOnChip* tmp; |
|
150 | 150 | for(int i=0;i<this->p_SocList.length();i++) |
|
151 | 151 | { |
|
152 | 152 | tmp = this->p_SocList.last(); |
|
153 | 153 | this->p_SocList.removeLast(); |
|
154 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef XMLMODEL_H |
|
23 | 23 | #define XMLMODEL_H |
|
24 | 24 | #include <QString> |
|
25 | 25 | #include <QList> |
|
26 | 26 | #include <QObject> |
|
27 | 27 | #include "XMLdata.h" |
|
28 | 28 | #include "socexplorerxmlfile.h" |
|
29 | 29 | #include "xmldriver.h" |
|
30 | 30 | #include <socmodel.h> |
|
31 | 31 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
32 | 32 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
33 | 33 | #else |
|
34 | 34 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
35 | 35 | #endif |
|
36 | 36 | |
|
37 | 37 | class SOCEXPLORER_SDK_EXPORT socExplorerXmlModel: public QObject |
|
38 | 38 | { |
|
39 | 39 | Q_OBJECT |
|
40 | 40 | public: |
|
41 | 41 | socExplorerXmlModel(QObject* parent=0); |
|
42 | 42 | //! Check that the given file is a readable Xml file. |
|
43 | 43 | int checkXmlFile(const QString& fileName); |
|
44 | 44 | int createXmlFile(const QString& fileName); |
|
45 | 45 | //! Return the list of all xml nodes with the given tag name in cached Xml files. |
|
46 | 46 | QList<xmlfile*> getFileList(const QString& tagNameFilter); |
|
47 | 47 | QList<QDomNodeList> getAllNodes(const QString& tagName); |
|
48 | 48 | QStringList getPeripheralRegList(const QString& peripheralName); |
|
49 | 49 | peripheralModel getPeripheral(const QString& peripheralName); |
|
50 | 50 | public slots: |
|
51 | 51 | void updateSOClist(); |
|
52 | 52 | void registerXmlFile(const QString &fileName); |
|
53 | 53 | //! Reload all xmlFiles. |
|
54 | 54 | void scanXmlFiles(); |
|
55 | 55 | signals: |
|
56 | 56 | |
|
57 | 57 | private: |
|
58 | 58 | void p_getRegs(peripheralModel *periph, QDomNodeList *nodes); |
|
59 | 59 | QList<xmlDataSystemOnChip*> p_SocList; |
|
60 | 60 | void clearSocList(); |
|
61 | 61 | XMLDriver* p_driver; |
|
62 | 62 | }; |
|
63 | 63 | |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "socexplorerengine.h" |
|
23 | 23 | #include <proxy/socexplorerproxy.h> |
|
24 | 24 | |
|
25 | 25 | SocExplorerEngine* SocExplorerEngine::_self = NULL; |
|
26 | 26 | socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL; |
|
27 | 27 | QMainWindow* SocExplorerEngine::mainWindow=NULL; |
|
28 | 28 | QList<SOCModel*>* SocExplorerEngine::SOCs=NULL; |
|
29 | 29 | int SocExplorerEngine::loglvl=1; |
|
30 | 30 | |
|
31 | 31 | SocExplorerEngine::SocExplorerEngine(QObject *parent) : |
|
32 | 32 | QObject(parent) |
|
33 | 33 | { |
|
34 | 34 | if(SOCs==NULL) |
|
35 | 35 | { |
|
36 | 36 | SOCs = new QList<SOCModel*>; |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | 41 | |
|
42 | 42 | void SocExplorerEngine::init() |
|
43 | 43 | { |
|
44 | 44 | QDir dir; |
|
45 | 45 | if(!_self) |
|
46 | 46 | { |
|
47 | 47 | _self= new SocExplorerEngine; |
|
48 | 48 | } |
|
49 | 49 | if(!dir.exists(configFolder())) |
|
50 | 50 | dir.mkdir(configFolder()); |
|
51 | 51 | p_xmlmodel = new socExplorerXmlModel(_self); |
|
52 | 52 | p_xmlmodel->updateSOClist(); |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | 55 | QString SocExplorerEngine::configFolder() |
|
56 | 56 | { |
|
57 | 57 | return QString(SOCEXPLORER_CONFIG_PATH); |
|
58 | 58 | } |
|
59 | 59 | |
|
60 | 60 | SOCModel *SocExplorerEngine::plugin2Soc(socexplorerplugin *plugin) |
|
61 | 61 | { |
|
62 | 62 | if(!_self) |
|
63 | 63 | init(); |
|
64 | 64 | if(plugin) |
|
65 | 65 | { |
|
66 | 66 | while (plugin->parent!=NULL) { |
|
67 | 67 | plugin = plugin->parent; |
|
68 | 68 | } |
|
69 | 69 | for(int i=0;i<SOCs->count();i++) |
|
70 | 70 | { |
|
71 | 71 | if(SOCs->at(i)->isRootDev(plugin)) |
|
72 | 72 | return SOCs->at(i); |
|
73 | 73 | } |
|
74 | 74 | //no soc found so create a new one |
|
75 | 75 | SOCModel* soc=new SOCModel(plugin); |
|
76 | 76 | SOCs->append(soc); |
|
77 | 77 | return soc; |
|
78 | 78 | } |
|
79 | 79 | return NULL; |
|
80 | 80 | } |
|
81 | 81 | |
|
82 | 82 | |
|
83 | 83 | int SocExplorerEngine::addEnumDevice(socexplorerplugin* rootPlugin,int VID, int PID, qint32 baseAddress, const QString &name) |
|
84 | 84 | { |
|
85 | 85 | if(!_self) |
|
86 | 86 | init(); |
|
87 | 87 | SOCModel* soc = plugin2Soc(rootPlugin); |
|
88 | 88 | if(soc && !soc->enumDeviceExists(baseAddress)) |
|
89 | 89 | { |
|
90 | 90 | emit _self->enumDeviceAdded(soc->addEnumDevice(VID,PID,baseAddress,name)); |
|
91 | 91 | return 1; |
|
92 | 92 | } |
|
93 | 93 | return 0; |
|
94 | 94 | } |
|
95 | 95 | |
|
96 | 96 | QList<SOCModel *> *SocExplorerEngine::getSOCs() |
|
97 | 97 | { |
|
98 | 98 | if(!_self) |
|
99 | 99 | init(); |
|
100 | 100 | return SOCs; |
|
101 | 101 | } |
|
102 | 102 | |
|
103 | 103 | qint32 SocExplorerEngine::getEnumDeviceBaseAddress(const QString& rootPlugin,int VID, int PID, int count) |
|
104 | 104 | { |
|
105 | 105 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); |
|
106 | 106 | if(plugin==NULL)return -1; |
|
107 | 107 | SOCModel* soc = plugin2Soc(plugin); |
|
108 | 108 | if(soc==NULL) |
|
109 | 109 | return -1; |
|
110 | 110 | return soc->getEnumDeviceBaseAddress(VID,PID,count); |
|
111 | 111 | } |
|
112 | 112 | |
|
113 | 113 | qint32 SocExplorerEngine::getEnumDeviceBaseAddress(socexplorerplugin *plugin, int VID, int PID, int count) |
|
114 | 114 | { |
|
115 | 115 | if(plugin==NULL)return -1; |
|
116 | 116 | SOCModel* soc = plugin2Soc(plugin); |
|
117 | 117 | if(soc==NULL) |
|
118 | 118 | return -1; |
|
119 | 119 | return soc->getEnumDeviceBaseAddress(VID,PID,count); |
|
120 | 120 | } |
|
121 | 121 | |
|
122 | 122 | int SocExplorerEngine::addEnumDevice(const QString &rootPlugin, int VID, int PID, qint32 baseAddress, const QString &name) |
|
123 | 123 | { |
|
124 | 124 | socexplorerplugin* plugin = socexplorerproxy::findPlugin(rootPlugin); |
|
125 | 125 | if(plugin==NULL)return -1; |
|
126 | 126 | SOCModel* soc = plugin2Soc(plugin); |
|
127 | 127 | if(soc==NULL) |
|
128 | 128 | return -1; |
|
129 | 129 | soc->addEnumDevice(VID,PID,baseAddress,name); |
|
130 | 130 | return 1; |
|
131 | 131 | } |
|
132 | 132 | |
|
133 | 133 | |
|
134 | 134 | QString SocExplorerEngine::getDevName(int VID, int PID) |
|
135 | 135 | { |
|
136 | 136 | QList<QDomNodeList> list=p_xmlmodel->getAllNodes("peripheral"); |
|
137 | 137 | for(int i=0;i<list.count();i++) |
|
138 | 138 | { |
|
139 | 139 | QDomNodeList nodes=list.at(i); |
|
140 | 140 | for(int l=0;l<nodes.count();l++) |
|
141 | 141 | { |
|
142 | 142 | QDomElement node=nodes.at(l).toElement(); |
|
143 | 143 | int nodeVID=node.attribute("vid","0").toInt(); |
|
144 | 144 | int nodePID=node.attribute("pid","0").toInt(); |
|
145 | 145 | if((nodeVID==VID)&&(nodePID==PID)) |
|
146 | 146 | { |
|
147 | 147 | return node.attribute("name","Unknow device"); |
|
148 | 148 | } |
|
149 | 149 | } |
|
150 | 150 | } |
|
151 | 151 | return QString("Unknow device"); |
|
152 | 152 | } |
|
153 | 153 | |
|
154 | 154 | QString SocExplorerEngine::SocExplorerVersion(){return QString(SOCEXPLORER_VERSION);} |
|
155 | 155 | |
|
156 | 156 | QString SocExplorerEngine::SocExplorerChangeset(){return QString(SOCEXPLORER_CHAGESET).split(" ").at(0);} |
|
157 | 157 | |
|
158 | 158 | QString SocExplorerEngine::SocExplorerBranch(){return QString(SOCEXPLORER_BRANCH);} |
|
159 | 159 | |
|
160 | 160 | socExplorerXmlModel *SocExplorerEngine::xmlModel() |
|
161 | 161 | { |
|
162 | 162 | if(!_self) |
|
163 | 163 | init(); |
|
164 | 164 | return p_xmlmodel; |
|
165 | 165 | } |
|
166 | 166 | |
|
167 | 167 | void SocExplorerEngine::setMainWindow(QMainWindow *Mainwindow) |
|
168 | 168 | { |
|
169 | 169 | if(!_self) |
|
170 | 170 | init(); |
|
171 | 171 | mainWindow=Mainwindow; |
|
172 | 172 | } |
|
173 | 173 | |
|
174 | 174 | QProgressBar *SocExplorerEngine::getProgressBar(const QString& format, int max) |
|
175 | 175 | { |
|
176 | 176 | if(!_self) |
|
177 | 177 | init(); |
|
178 | 178 | QProgressBar* progressBar; |
|
179 | 179 | if(mainWindow!=NULL) |
|
180 | 180 | { |
|
181 | 181 | progressBar = new QProgressBar(mainWindow); |
|
182 | 182 | mainWindow->statusBar()->addWidget(progressBar); |
|
183 | 183 | } |
|
184 | 184 | else |
|
185 | 185 | { |
|
186 | 186 | progressBar = new QProgressBar(); |
|
187 | 187 | } |
|
188 | 188 | progressBar->setMaximum(max); |
|
189 | 189 | progressBar->setFormat(format); |
|
190 | 190 | return progressBar; |
|
191 | 191 | } |
|
192 | 192 | |
|
193 | 193 | void SocExplorerEngine::deleteProgressBar(QProgressBar *progressBar) |
|
194 | 194 | { |
|
195 | 195 | if(mainWindow!=NULL) |
|
196 | 196 | { |
|
197 | 197 | mainWindow->statusBar()->removeWidget(progressBar); |
|
198 | 198 | } |
|
199 | 199 | delete progressBar; |
|
200 | 200 | } |
|
201 | 201 | |
|
202 | 202 | void SocExplorerEngine::addSOC(socexplorerplugin *rootPlugin) |
|
203 | 203 | { |
|
204 | 204 | plugin2Soc(rootPlugin); |
|
205 | 205 | } |
|
206 | 206 | |
|
207 | 207 | void SocExplorerEngine::removeSOC(socexplorerplugin *rootPlugin) |
|
208 | 208 | { |
|
209 | 209 | SOCModel* soc=plugin2Soc(rootPlugin); |
|
210 | 210 | SOCs->removeAll(soc); |
|
211 | 211 | delete soc; |
|
212 | 212 | } |
|
213 | 213 | |
|
214 | 214 | void SocExplorerEngine::message(socexplorerplugin *sender, const QString &message, int debugLevel) |
|
215 | 215 | { |
|
216 | 216 | // TODO add multi output message manager IE also log in files |
|
217 | 217 | if(!_self) |
|
218 | 218 | init(); |
|
219 | 219 | if(loglvl>=debugLevel) |
|
220 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef SOCEXPLORERENGINE_H |
|
23 | 23 | #define SOCEXPLORERENGINE_H |
|
24 | 24 | |
|
25 | 25 | #include <stdint.h> |
|
26 | 26 | #include <QObject> |
|
27 | 27 | #include <QtWidgets> |
|
28 | 28 | #include <QStringList> |
|
29 | 29 | #include <QDomDocument> |
|
30 | 30 | #include <QDomElement> |
|
31 | 31 | #include <QDomNodeList> |
|
32 | 32 | #include <QFile> |
|
33 | 33 | #include <QTextStream> |
|
34 | 34 | #include <QDir> |
|
35 | 35 | #include <QApplication> |
|
36 | 36 | #include <QtCore/qglobal.h> |
|
37 | 37 | #include <QFileDialog> |
|
38 | 38 | #include <socexplorerxmlfile.h> |
|
39 | 39 | #include <socexplorerenumdevice.h> |
|
40 | 40 | #include <XMLmodel.h> |
|
41 | 41 | #include <peripheralwidget.h> |
|
42 | 42 | #include <registerwidget.h> |
|
43 | 43 | #include <socmodel.h> |
|
44 | 44 | |
|
45 | 45 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
46 | 46 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
47 | 47 | #else |
|
48 | 48 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
49 | 49 | #endif |
|
50 | 50 | |
|
51 | 51 | |
|
52 | 52 | |
|
53 | 53 | //! SocExplorerEngine is a pure static class which aims to provide services for both SocExplorer software and plugins. |
|
54 | 54 | |
|
55 | 55 | class SOCEXPLORER_SDK_EXPORT SocExplorerEngine : public QObject |
|
56 | 56 | { |
|
57 | 57 | Q_OBJECT |
|
58 | 58 | private: |
|
59 | 59 | static SocExplorerEngine* _self; |
|
60 | 60 | SocExplorerEngine(QObject *parent = 0); |
|
61 | 61 | static void init(); |
|
62 | 62 | |
|
63 | 63 | public: |
|
64 | 64 | static SocExplorerEngine* self(){ if(!_self){_self= new SocExplorerEngine;}return _self;} |
|
65 | 65 | //! Return the configuration folder path, OS dependant. |
|
66 | 66 | SOCEXPLORER_SDK_EXPORT static QString configFolder(); |
|
67 | 67 | //! Return the default plugin folder path, OS dependant. |
|
68 | 68 | static QString pluginFolder(){return QString(SOCEXPLORER_PLUGINS_INSTALL_PATH);} |
|
69 | 69 | |
|
70 | 70 | static int addEnumDevice(socexplorerplugin* rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); |
|
71 | 71 | static QList<SOCModel*>* getSOCs(); |
|
72 | 72 | static QString getDevName(int VID, int PID); |
|
73 | 73 | static QString SocExplorerVersion(); |
|
74 | 74 | static QString SocExplorerChangeset(); |
|
75 | 75 | static QString SocExplorerBranch(); |
|
76 | 76 | static socExplorerXmlModel* xmlModel(); |
|
77 | 77 | static void setMainWindow(QMainWindow* Mainwindow); |
|
78 | 78 | static QProgressBar* getProgressBar(const QString &format, int max); |
|
79 | 79 | static void deleteProgressBar(QProgressBar* progressBar); |
|
80 | 80 | static void addSOC(socexplorerplugin* rootPlugin); |
|
81 | 81 | static void removeSOC(socexplorerplugin* rootPlugin); |
|
82 | 82 | static void message(socexplorerplugin* sender,const QString& message,int debugLevel=0); |
|
83 | static void setLogLevel(int level); | |
|
83 | 84 | signals: |
|
84 | 85 | void enumDeviceAdded(socExplorerEnumDevice* device); |
|
85 | 86 | public slots: |
|
86 | 87 | QString getSocExplorerVersion(){return SocExplorerEngine::SocExplorerVersion();} |
|
87 | 88 | QString getSocExplorerChangeset(){return SocExplorerEngine::SocExplorerChangeset();} |
|
88 | 89 | QString getSocExplorerBranch(){return SocExplorerEngine::SocExplorerBranch();} |
|
89 | 90 | qint32 getEnumDeviceBaseAddress(const QString& rootPlugin,int VID,int PID,int count=0); |
|
90 | 91 | qint32 getEnumDeviceBaseAddress(socexplorerplugin* plugin,int VID,int PID,int count=0); |
|
91 | 92 | int addEnumDevice(const QString& rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); |
|
92 | 93 | |
|
93 | 94 | private: |
|
94 | 95 | static SOCModel* plugin2Soc(socexplorerplugin* plugin); |
|
95 | 96 | static socExplorerXmlModel* p_xmlmodel; |
|
96 | 97 | static QMainWindow* mainWindow; |
|
97 | 98 | static QList<SOCModel*>* SOCs; |
|
98 | 99 | static int loglvl; |
|
99 | 100 | }; |
|
100 | 101 | |
|
101 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "socexplorerxmlfile.h" |
|
23 | 23 | #include <QFile> |
|
24 | 24 | #include <QTextStream> |
|
25 | 25 | |
|
26 | 26 | xmlfile::xmlfile(const QString& fileName) |
|
27 | 27 | { |
|
28 | 28 | this->m_fileName = fileName; |
|
29 | 29 | this->m_document=new QDomDocument(); |
|
30 | 30 | QFile file( fileName ); |
|
31 | 31 | if( !file.open( QIODevice::ReadOnly ) ) |
|
32 | 32 | return; |
|
33 | 33 | this->m_document->setContent(&file); |
|
34 | 34 | file.close(); |
|
35 | 35 | this->m_rootElement = this->m_document->documentElement(); |
|
36 | 36 | } |
|
37 | 37 | |
|
38 | 38 | void xmlfile::save() |
|
39 | 39 | { |
|
40 | 40 | QFile file( this->m_fileName ); |
|
41 | 41 | if( !file.open( QIODevice::WriteOnly ) ) |
|
42 | 42 | return; |
|
43 | 43 | QTextStream ts( &file ); |
|
44 | 44 | ts << this->m_document->toString(); |
|
45 | 45 | file.close(); |
|
46 | 46 | this->reload(); |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | void xmlfile::reload() |
|
50 | 50 | { |
|
51 | 51 | QFile file( this->m_fileName ); |
|
52 | 52 | if( !file.open( QIODevice::ReadOnly ) ) |
|
53 | 53 | return; |
|
54 | 54 | this->m_document->setContent(&file); |
|
55 | 55 | file.close(); |
|
56 | 56 | this->m_rootElement = this->m_document->documentElement(); |
|
57 | 57 | } |
|
58 | 58 | |
|
59 | 59 | void xmlfile::addElement(QDomElement* parentElement, const QString& tagName) |
|
60 | 60 | { |
|
61 | 61 | if(m_document) |
|
62 | 62 | { |
|
63 | 63 | QDomElement element=this->m_document->createElement(tagName); |
|
64 | 64 | parentElement->appendChild(element); |
|
65 | 65 | //emit this->elementAdded(element); |
|
66 | 66 | } |
|
67 | 67 | } |
|
68 | 68 | |
|
69 | 69 | void xmlfile::removeElement(QDomElement *parentElement, QDomElement *element) |
|
70 | 70 | { |
|
71 | 71 | Q_UNUSED(parentElement) |
|
72 | 72 | Q_UNUSED(element) |
|
73 | 73 | if(m_document) |
|
74 | 74 | { |
|
75 | 75 | |
|
76 | 76 | } |
|
77 | 77 | } |
@@ -1,64 +1,64 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef XMLFILE_H |
|
23 | 23 | #define XMLFILE_H |
|
24 | 24 | |
|
25 | 25 | #include <QObject> |
|
26 | 26 | #include <QDomDocument> |
|
27 | 27 | #include <QDomElement> |
|
28 | 28 | #include <QString> |
|
29 | 29 | |
|
30 | 30 | ///////////////////////////////////////////////////////////////////////////////// |
|
31 | 31 | ///////////////////////////////////////////////////////////////////////////////// |
|
32 | 32 | //! Stores a cached Xml file and expose synchronization functions (Slots). |
|
33 | 33 | class xmlfile : public QObject |
|
34 | 34 | { |
|
35 | 35 | Q_OBJECT |
|
36 | 36 | public: |
|
37 | 37 | xmlfile(const QString& fileName); |
|
38 | 38 | //! Return the root xml element of the current file. |
|
39 | 39 | QDomElement* getRootElement(){return &m_rootElement;} |
|
40 | 40 | //! Return the current file name. |
|
41 | 41 | QString fileName(){return this->m_fileName;} |
|
42 | 42 | //! Return the root xml element tag name of the current file. |
|
43 | 43 | QString rootTagName() |
|
44 | 44 | { |
|
45 | 45 | if(!this->m_rootElement.isNull()) |
|
46 | 46 | return this->m_rootElement.tagName(); |
|
47 | 47 | else |
|
48 | 48 | return QString(""); |
|
49 | 49 | } |
|
50 | 50 | public slots: |
|
51 | 51 | void save(); |
|
52 | 52 | void reload(); |
|
53 | 53 | void addElement(QDomElement* parentElement, const QString& tagName); |
|
54 | 54 | void removeElement(QDomElement* parentElement, QDomElement* element); |
|
55 | 55 | private: |
|
56 | 56 | QString m_fileName; |
|
57 | 57 | QDomDocument* m_document; |
|
58 | 58 | QDomElement m_rootElement; |
|
59 | 59 | }; |
|
60 | 60 | ///////////////////////////////////////////////////////////////////////////////// |
|
61 | 61 | ///////////////////////////////////////////////////////////////////////////////// |
|
62 | 62 | |
|
63 | 63 | |
|
64 | 64 | #endif // XMLFILE_H |
@@ -1,213 +1,213 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "plugininfoswdgt.h" |
|
23 | 23 | #include "pluginloader.h" |
|
24 | 24 | #include <QDir> |
|
25 | 25 | #include <QTextDocument> |
|
26 | 26 | #include <QTextCursor> |
|
27 | 27 | #include <QTextFragment> |
|
28 | 28 | #include <QTextDocumentFragment> |
|
29 | 29 | #include <QTextBlock> |
|
30 | 30 | #include <QTextCharFormat> |
|
31 | 31 | #include <QTextTable> |
|
32 | 32 | #include <QApplication> |
|
33 | 33 | |
|
34 | 34 | |
|
35 | 35 | |
|
36 | 36 | pluginInfosWdgt::pluginInfosWdgt(QWidget *parent) : |
|
37 | 37 | QWidget(parent) |
|
38 | 38 | { |
|
39 | 39 | this->mailLayout = new QVBoxLayout; |
|
40 | 40 | this->textInfos = new QTextBrowser; |
|
41 | 41 | this->textInfos->setReadOnly(true); |
|
42 | 42 | this->mailLayout->addWidget(this->textInfos); |
|
43 | 43 | this->setLayout(this->mailLayout); |
|
44 | 44 | this->textInfos->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
|
45 | 45 | } |
|
46 | 46 | |
|
47 | 47 | |
|
48 | 48 | void pluginInfosWdgt::updateInfos(const QStringList &items) |
|
49 | 49 | { |
|
50 | 50 | this->textInfos->clear(); |
|
51 | 51 | QTextCursor cursor(this->textInfos->document()); |
|
52 | 52 | //QTextTable* table; |
|
53 | 53 | int i=0; |
|
54 | 54 | cursor.atStart(); |
|
55 | 55 | cursor.insertText("Plugins:\n"); |
|
56 | 56 | for(i=0;i<items.count();i++) |
|
57 | 57 | { |
|
58 | 58 | cursor.insertText(pluginloader::getlibDir(items.at(i))+"\n"); |
|
59 | 59 | } |
|
60 | 60 | cursor.insertText("\n\n"); |
|
61 | 61 | //table = cursor.insertTable(7,items.count()+1); |
|
62 | 62 | cursor.insertTable(7,items.count()+1); |
|
63 | 63 | cursor.insertText(tr("Plugin name")); |
|
64 | 64 | for(i=0;i<items.count();i++) |
|
65 | 65 | { |
|
66 | 66 | cursor.movePosition(cursor.NextCell); |
|
67 | 67 | cursor.insertText(pluginloader::getlibName(items.at(i))); |
|
68 | 68 | } |
|
69 | 69 | cursor.movePosition(cursor.NextRow); |
|
70 | 70 | cursor.insertText(tr("Root")); |
|
71 | 71 | for(i=0;i<items.count();i++) |
|
72 | 72 | { |
|
73 | 73 | cursor.movePosition(cursor.NextCell); |
|
74 | 74 | if(pluginloader::libcanberoot(items.at(i))) |
|
75 | 75 | { |
|
76 | 76 | cursor.insertText("Yes"); |
|
77 | 77 | } |
|
78 | 78 | else |
|
79 | 79 | { |
|
80 | 80 | cursor.insertText("No"); |
|
81 | 81 | } |
|
82 | 82 | } |
|
83 | 83 | cursor.movePosition(cursor.NextRow); |
|
84 | 84 | cursor.insertText(tr("Child")); |
|
85 | 85 | for(i=0;i<items.count();i++) |
|
86 | 86 | { |
|
87 | 87 | cursor.movePosition(cursor.NextCell); |
|
88 | 88 | if(pluginloader::libcanbechild(items.at(i))) |
|
89 | 89 | { |
|
90 | 90 | cursor.insertText("Yes"); |
|
91 | 91 | } |
|
92 | 92 | else |
|
93 | 93 | { |
|
94 | 94 | cursor.insertText("No"); |
|
95 | 95 | } |
|
96 | 96 | } |
|
97 | 97 | cursor.movePosition(cursor.NextRow); |
|
98 | 98 | cursor.insertText(tr("VID")); |
|
99 | 99 | for(i=0;i<items.count();i++) |
|
100 | 100 | { |
|
101 | 101 | cursor.movePosition(cursor.NextCell); |
|
102 | 102 | cursor.insertText(pluginloader::getlibVIDstr(items.at(i))); |
|
103 | 103 | } |
|
104 | 104 | cursor.movePosition(cursor.NextRow); |
|
105 | 105 | cursor.insertText(tr("PID")); |
|
106 | 106 | for(i=0;i<items.count();i++) |
|
107 | 107 | { |
|
108 | 108 | cursor.movePosition(cursor.NextCell); |
|
109 | 109 | cursor.insertText(pluginloader::getlibPIDstr(items.at(i))); |
|
110 | 110 | } |
|
111 | 111 | cursor.movePosition(cursor.NextRow); |
|
112 | 112 | cursor.insertText(tr("Version")); |
|
113 | 113 | for(i=0;i<items.count();i++) |
|
114 | 114 | { |
|
115 | 115 | cursor.movePosition(cursor.NextCell); |
|
116 | 116 | cursor.insertText(pluginloader::getlibVersion(items.at(i))); |
|
117 | 117 | } |
|
118 | 118 | cursor.movePosition(cursor.NextRow); |
|
119 | 119 | cursor.insertText(tr("author")); |
|
120 | 120 | for(i=0;i<items.count();i++) |
|
121 | 121 | { |
|
122 | 122 | cursor.movePosition(cursor.NextCell); |
|
123 | 123 | cursor.insertText(pluginloader::getlibAuthor(items.at(i))); |
|
124 | 124 | } |
|
125 | 125 | cursor.movePosition(cursor.NextBlock); |
|
126 | 126 | |
|
127 | 127 | for(i=0;i<items.count();i++) |
|
128 | 128 | { |
|
129 | 129 | cursor.insertText("\n\n"); |
|
130 | 130 | cursor.insertText(pluginloader::getlibName(items.at(i))+" Description:\n"); |
|
131 | 131 | cursor.insertText(pluginloader::getlibDescription(items.at(i))); |
|
132 | 132 | } |
|
133 | 133 | |
|
134 | 134 | } |
|
135 | 135 | |
|
136 | 136 | |
|
137 | 137 | void pluginInfosWdgt::updateInfos(const QString pluginPath) |
|
138 | 138 | { |
|
139 | 139 | this->textInfos->clear(); |
|
140 | 140 | QTextCursor cursor(this->textInfos->document()); |
|
141 | 141 | QTextCharFormat formatHeader(cursor.charFormat()); |
|
142 | 142 | QTextCharFormat formatContent(cursor.charFormat()); |
|
143 | 143 | //QTextTable* table; |
|
144 | 144 | formatHeader.setFontWeight(QFont::Bold); |
|
145 | 145 | formatHeader.setForeground(QBrush(Qt::red)); |
|
146 | 146 | formatContent.setForeground(Qt::black); |
|
147 | 147 | cursor.atStart(); |
|
148 | 148 | if(pluginloader::checklibrary(pluginPath)==1) |
|
149 | 149 | { |
|
150 | 150 | cursor.setBlockCharFormat(formatHeader); |
|
151 | 151 | cursor.insertText(tr("plugin name:")); |
|
152 | 152 | //cursor.insertBlock(); |
|
153 | 153 | cursor.setBlockCharFormat(formatContent); |
|
154 | 154 | //table = cursor.insertTable(1,1); |
|
155 | 155 | cursor.insertTable(1,1); |
|
156 | 156 | cursor.insertText(pluginloader::getlibName(pluginPath)); |
|
157 | 157 | //table->cellAt( (pluginloader::getlibName(pluginPath)); |
|
158 | 158 | //this->textInfos->append(pluginloader::getlibName(pluginPath)); |
|
159 | 159 | //this->textInfos->append("================================"); |
|
160 | 160 | if(pluginloader::libcanberoot(pluginPath)) |
|
161 | 161 | { |
|
162 | 162 | this->textInfos->append(tr("This plugin can be used as root driver.")); |
|
163 | 163 | } |
|
164 | 164 | else |
|
165 | 165 | { |
|
166 | 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 | 168 | this->textInfos->append("================================"); |
|
169 | 169 | if(pluginloader::libcanbechild(pluginPath)) |
|
170 | 170 | { |
|
171 | 171 | this->textInfos->append(tr("This plugin can be used as child driver.")); |
|
172 | 172 | } |
|
173 | 173 | else |
|
174 | 174 | { |
|
175 | 175 | this->textInfos->append(tr("This plugin can't' be used as child driver.")); |
|
176 | 176 | } |
|
177 | 177 | this->textInfos->append("================================"); |
|
178 | 178 | this->textInfos->append(tr("plugin VID:")); |
|
179 | 179 | this->textInfos->append(pluginloader::getlibVIDstr(pluginPath)); |
|
180 | 180 | this->textInfos->append("================================"); |
|
181 | 181 | this->textInfos->append(tr("plugin PID:")); |
|
182 | 182 | this->textInfos->append(pluginloader::getlibPIDstr(pluginPath)); |
|
183 | 183 | this->textInfos->append("================================"); |
|
184 | 184 | this->textInfos->append(tr("plugin Version:")); |
|
185 | 185 | this->textInfos->append(pluginloader::getlibVersion(pluginPath)); |
|
186 | 186 | this->textInfos->append("================================"); |
|
187 | 187 | this->textInfos->append(tr("plugin Author:")); |
|
188 | 188 | this->textInfos->append(pluginloader::getlibAuthor(pluginPath)); |
|
189 | 189 | this->textInfos->append("================================"); |
|
190 | 190 | this->textInfos->append(tr("plugin Description:")); |
|
191 | 191 | this->textInfos->append(pluginloader::getlibDescription(pluginPath)); |
|
192 | 192 | } |
|
193 | 193 | else |
|
194 | 194 | { |
|
195 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef PLUGININFOSWDGT_H |
|
23 | 23 | #define PLUGININFOSWDGT_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | 26 | #include <QVBoxLayout> |
|
27 | 27 | #include <QTextEdit> |
|
28 | 28 | #include <QString> |
|
29 | 29 | #include <QTextBrowser> |
|
30 | 30 | |
|
31 | 31 | class pluginInfosWdgt : public QWidget |
|
32 | 32 | { |
|
33 | 33 | Q_OBJECT |
|
34 | 34 | public: |
|
35 | 35 | explicit pluginInfosWdgt(QWidget *parent = 0); |
|
36 | 36 | |
|
37 | 37 | |
|
38 | 38 | |
|
39 | 39 | public slots: |
|
40 | 40 | void updateInfos(const QString pluginPath); |
|
41 | 41 | void updateInfos(const QStringList& items); |
|
42 | 42 | |
|
43 | 43 | private: |
|
44 | 44 | QVBoxLayout* mailLayout; |
|
45 | 45 | QTextBrowser* textInfos; |
|
46 | 46 | |
|
47 | 47 | }; |
|
48 | 48 | |
|
49 | 49 | #endif // PLUGININFOSWDGT_H |
@@ -1,117 +1,117 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "pluginlist.h" |
|
23 | 23 | #include "pluginloader.h" |
|
24 | 24 | #include <QDir> |
|
25 | 25 | #include <QFile> |
|
26 | 26 | #include <QFileInfoList> |
|
27 | 27 | #include <QString> |
|
28 | 28 | #include <QStringList> |
|
29 | 29 | #include <QApplication> |
|
30 | 30 | #include <QLabel> |
|
31 | 31 | #include <QPixmap> |
|
32 | 32 | #include "qsvgicon.h" |
|
33 | 33 | #include <QWidget> |
|
34 | 34 | #include <QDrag> |
|
35 | 35 | |
|
36 | 36 | PluginList::PluginList(QWidget *parent):QListWidget(parent) |
|
37 | 37 | { |
|
38 | 38 | this->setAcceptDrops(true); |
|
39 | 39 | this->setDragEnabled(true); |
|
40 | 40 | this->setSelectionMode(QAbstractItemView::ExtendedSelection); |
|
41 | 41 | connect(this,SIGNAL(itemSelectionChanged()),this,SLOT(updateSelection())); |
|
42 | 42 | this->showCacheAction = new QAction(tr("View cache content"),this); |
|
43 | 43 | this->addAction(this->showCacheAction); |
|
44 | 44 | connect(this->showCacheAction,SIGNAL(triggered()),this,SLOT(showCache())); |
|
45 | 45 | this->setContextMenuPolicy(Qt::ActionsContextMenu); |
|
46 | 46 | |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | |
|
50 | 50 | void PluginList::refreshPluginList() |
|
51 | 51 | { |
|
52 | 52 | this->clear(); |
|
53 | 53 | QList<PluginsCacheItem*> plugins = pluginloader::listAvailiables(true); |
|
54 | 54 | for (int i = 0; i < plugins.count(); ++i) |
|
55 | 55 | { |
|
56 | 56 | PluginListItem *newItem = new PluginListItem(QString(plugins.at(i)->getpluginName()),plugins.at(i)->getpath()+"/"+plugins.at(i)->getfileName()); |
|
57 | 57 | newItem->setFlags(newItem->flags() &~ Qt::ItemIsEditable); |
|
58 | 58 | this->addItem((QListWidgetItem*)newItem); |
|
59 | 59 | } |
|
60 | 60 | } |
|
61 | 61 | |
|
62 | 62 | void PluginList::dragEnterEvent(QDragEnterEvent *event) |
|
63 | 63 | { |
|
64 | 64 | this->clearSelection(); |
|
65 | 65 | this->itemAt(dragStartPosition)->setSelected(true); |
|
66 | 66 | event->acceptProposedAction(); |
|
67 | 67 | } |
|
68 | 68 | |
|
69 | 69 | void PluginList::dragMoveEvent(QDragMoveEvent *e) |
|
70 | 70 | { |
|
71 | 71 | e->accept(); |
|
72 | 72 | } |
|
73 | 73 | |
|
74 | 74 | void PluginList::mousePressEvent(QMouseEvent *event) |
|
75 | 75 | { |
|
76 | 76 | if (event->button() == Qt::LeftButton) |
|
77 | 77 | { |
|
78 | 78 | dragStartPosition = event->pos(); |
|
79 | 79 | } |
|
80 | 80 | QListWidget::mousePressEvent(event); |
|
81 | 81 | } |
|
82 | 82 | |
|
83 | 83 | void PluginList::mouseMoveEvent(QMouseEvent *event) |
|
84 | 84 | { |
|
85 | 85 | if (!(event->buttons() & Qt::LeftButton)) |
|
86 | 86 | return; |
|
87 | 87 | if ((event->pos() - dragStartPosition).manhattanLength()< QApplication::startDragDistance()) |
|
88 | 88 | return; |
|
89 | 89 | if(this->selectedItems().count()==0) |
|
90 | 90 | return; |
|
91 | 91 | QDrag *drag = new QDrag(this); |
|
92 | 92 | QMimeData *mimeData = new QMimeData; |
|
93 | 93 | drag->setHotSpot(event->pos() - rect().topLeft()); |
|
94 | 94 | mimeData->setData("socexplorer/pluginName",QByteArray(((PluginListItem*)this->selectedItems().first())->fullPath->toLatin1())); |
|
95 | 95 | mimeData->setText(((PluginListItem*)this->selectedItems().first())->fullPath->toLatin1()); |
|
96 | 96 | drag->setMimeData(mimeData); |
|
97 | 97 | drag->exec(Qt::MoveAction); |
|
98 | 98 | } |
|
99 | 99 | |
|
100 | 100 | |
|
101 | 101 | |
|
102 | 102 | void PluginList::dropEvent(QDropEvent *event) |
|
103 | 103 | { |
|
104 | 104 | Q_UNUSED(event) |
|
105 | 105 | } |
|
106 | 106 | |
|
107 | 107 | |
|
108 | 108 | |
|
109 | 109 | void PluginList::updateSelection() |
|
110 | 110 | { |
|
111 | 111 | QStringList _items; |
|
112 | 112 | for(int i=0;i<this->selectedItems().count();i++) |
|
113 | 113 | { |
|
114 | 114 | _items << *((PluginListItem*)(this->selectedItems().at(i)))->fullPath; |
|
115 | 115 | } |
|
116 | 116 | emit this->itemSelectionChanged(_items); |
|
117 | 117 | } |
@@ -1,78 +1,78 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef PLUGINLIST_H |
|
23 | 23 | #define PLUGINLIST_H |
|
24 | 24 | #include <QTableWidget> |
|
25 | 25 | #include <QListWidget> |
|
26 | 26 | #include <QtGui/QDragEnterEvent> |
|
27 | 27 | #include <QtGui/QDragLeaveEvent> |
|
28 | 28 | #include <QtGui/QDragMoveEvent> |
|
29 | 29 | #include <QtGui/QDropEvent> |
|
30 | 30 | #include <QtCore/QMimeData> |
|
31 | 31 | #include <QtCore/QUrl> |
|
32 | 32 | #include <QtCore/QList> |
|
33 | 33 | #include <QPoint> |
|
34 | 34 | #include <QStringList> |
|
35 | 35 | #include <QMenu> |
|
36 | 36 | #include <QAction> |
|
37 | 37 | #include <pluginloader.h> |
|
38 | 38 | |
|
39 | 39 | class PluginListItem: public QListWidgetItem |
|
40 | 40 | { |
|
41 | 41 | public: |
|
42 | 42 | explicit PluginListItem( const QString & Name,const QString & FullPath, QListWidget * parent = 0, int type = Type ) |
|
43 | 43 | :QListWidgetItem(Name,parent,type) |
|
44 | 44 | { |
|
45 | 45 | this->fullPath = new QString(FullPath); |
|
46 | 46 | } |
|
47 | 47 | QString* fullPath; |
|
48 | 48 | }; |
|
49 | 49 | |
|
50 | 50 | |
|
51 | 51 | class PluginList: public QListWidget |
|
52 | 52 | { |
|
53 | 53 | Q_OBJECT |
|
54 | 54 | public: |
|
55 | 55 | explicit PluginList(QWidget * parent = 0); |
|
56 | 56 | |
|
57 | 57 | protected: |
|
58 | 58 | void dragEnterEvent(QDragEnterEvent *event); |
|
59 | 59 | void dragMoveEvent(QDragMoveEvent *e); |
|
60 | 60 | void dropEvent(QDropEvent *event); |
|
61 | 61 | void mousePressEvent(QMouseEvent *event); |
|
62 | 62 | void mouseMoveEvent(QMouseEvent *e); |
|
63 | 63 | |
|
64 | 64 | public slots: |
|
65 | 65 | void refreshPluginList(); |
|
66 | 66 | private slots: |
|
67 | 67 | void updateSelection(); |
|
68 | 68 | void showCache(){pluginloader::showCache();} |
|
69 | 69 | signals: |
|
70 | 70 | void itemSelectionChanged(const QStringList& items); |
|
71 | 71 | |
|
72 | 72 | |
|
73 | 73 | private: |
|
74 | 74 | QAction* showCacheAction; |
|
75 | 75 | QPoint dragStartPosition; |
|
76 | 76 | }; |
|
77 | 77 | |
|
78 | 78 | #endif // PLUGINLIST_H |
@@ -1,142 +1,142 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "pluginmanagerWDGT.h" |
|
23 | 23 | #include "pluginloader.h" |
|
24 | 24 | #include <QFileDialog> |
|
25 | 25 | #include <unistd.h> |
|
26 | 26 | #include <qsvgicon.h> |
|
27 | 27 | #include <socexplorerengine.h> |
|
28 | 28 | |
|
29 | 29 | #define mkbutton(button,text,image)button = new QPushButton();\ |
|
30 | 30 | button->setIcon(QSvgIcon(image));\ |
|
31 | 31 | button->setIconSize(QSize(16,16));\ |
|
32 | 32 | button->setToolTip(text) |
|
33 | 33 | |
|
34 | 34 | |
|
35 | 35 | |
|
36 | 36 | pluginmanagerWDGT::pluginmanagerWDGT(QWidget *parent) : |
|
37 | 37 | QSplitter(parent) |
|
38 | 38 | { |
|
39 | 39 | this->setWindowTitle("Plugin Manager"); |
|
40 | 40 | this->setOrientation(Qt::Vertical); |
|
41 | 41 | this->pluginListWidgetContainer = new QWidget(); |
|
42 | 42 | this->mainlayoutSpliter = new QSplitter; |
|
43 | 43 | this->pluginListLayout = new QVBoxLayout(); |
|
44 | 44 | this->mainlayoutSpliter->setOrientation(Qt::Vertical); |
|
45 | 45 | this->treeview = new plugintree(); |
|
46 | 46 | this->pluginTable = new PluginList; |
|
47 | 47 | this->ButtonsLayout = new QHBoxLayout(); |
|
48 | 48 | this->ButtonsLayout->addStretch(); |
|
49 | 49 | this->pluginListLayout->addLayout(this->ButtonsLayout); |
|
50 | 50 | this->addWidget(this->treeview); |
|
51 | 51 | this->pluginListWidgetContainer->setLayout(this->pluginListLayout); |
|
52 | 52 | this->addWidget(this->pluginListWidgetContainer); |
|
53 | 53 | this->pluginListLayout->addWidget(this->pluginTable); |
|
54 | 54 | this->pluginInfos = new pluginInfosWdgt; |
|
55 | 55 | |
|
56 | 56 | mkbutton(this->addPluginBt,tr("add plugin"),":/images/open.svg"); |
|
57 | 57 | mkbutton(this->removePluginBt,tr("remove plugin(s)"),":/images/trash.svg"); |
|
58 | 58 | mkbutton(this->refreshPluginListBt,tr("Refresh Plugin(s) list"),":/images/refresh.svg"); |
|
59 | 59 | |
|
60 | 60 | this->ButtonsLayout->addWidget(this->addPluginBt); |
|
61 | 61 | this->ButtonsLayout->addWidget(this->refreshPluginListBt); |
|
62 | 62 | this->ButtonsLayout->addWidget(this->removePluginBt); |
|
63 | 63 | |
|
64 | 64 | this->addWidget(this->pluginInfos); |
|
65 | 65 | |
|
66 | 66 | connect(this->treeview,SIGNAL(geteplugintree()),this,SIGNAL(geteplugintree())); |
|
67 | 67 | connect(this,SIGNAL(treeChanged(QList<socexplorerplugin*>)),this->treeview,SLOT(treeChanged(QList<socexplorerplugin*>))); |
|
68 | 68 | connect(this->pluginTable,SIGNAL(currentRowChanged(int)),this,SLOT(libselected(int))); |
|
69 | 69 | connect(this->pluginTable,SIGNAL(itemSelectionChanged(QStringList)),this->pluginInfos,SLOT(updateInfos(QStringList))); |
|
70 | 70 | connect(this->addPluginBt,SIGNAL(clicked()),this,SLOT(addPlugin())); |
|
71 | 71 | connect(this->removePluginBt,SIGNAL(clicked()),this,SLOT(removePlugin())); |
|
72 | 72 | connect(this->pluginTable,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(loadplugin(QListWidgetItem*))); |
|
73 | 73 | connect(this->refreshPluginListBt,SIGNAL(clicked()),this->pluginTable,SLOT(refreshPluginList())); |
|
74 | 74 | connect(this->treeview,SIGNAL(loadSysDriver(QString)),this,SIGNAL(loadSysDrviver(QString))); |
|
75 | 75 | connect(this->treeview,SIGNAL(loadSysDriverToParent(QString,QString)),this,SIGNAL(loadSysDriverToParent(QString,QString))); |
|
76 | 76 | connect(this->treeview,SIGNAL(changeSysDriverInstName(QString,QString)),this,SIGNAL(changeSysDriverInstName(QString,QString))); |
|
77 | 77 | connect(this->treeview,SIGNAL(closeSysDriver(QString)),this,SIGNAL(closeSysDriver(QString))); |
|
78 | 78 | connect(this->treeview,SIGNAL(pluginselected(QString)),this,SIGNAL(pluginselected(QString))); |
|
79 | 79 | this->rootLoadable = false; |
|
80 | 80 | this->childLoadable = false; |
|
81 | 81 | this->pluginTable->refreshPluginList(); |
|
82 | 82 | this->pluginTable->refreshPluginList(); |
|
83 | 83 | } |
|
84 | 84 | |
|
85 | 85 | |
|
86 | 86 | void pluginmanagerWDGT::setRootLoadable(bool flag) |
|
87 | 87 | { |
|
88 | 88 | this->rootLoadable = flag; |
|
89 | 89 | } |
|
90 | 90 | |
|
91 | 91 | |
|
92 | 92 | void pluginmanagerWDGT::setChildLoadable(bool flag) |
|
93 | 93 | { |
|
94 | 94 | this->childLoadable = flag; |
|
95 | 95 | } |
|
96 | 96 | |
|
97 | 97 | |
|
98 | 98 | |
|
99 | 99 | |
|
100 | 100 | void pluginmanagerWDGT::addPlugin() |
|
101 | 101 | { |
|
102 | 102 | QString fileName = QFileDialog::getOpenFileName(this,tr("Open Plugin"), QDir::homePath(), tr("Plugin Files Files (*.dll *.so *.so.*)")); |
|
103 | 103 | if(pluginloader::checklibrary(fileName)) |
|
104 | 104 | { |
|
105 | 105 | QFile::copy(fileName,QString(SocExplorerEngine::pluginFolder())+"/"+ fileName.section('/',-1)); |
|
106 | 106 | } |
|
107 | 107 | this->pluginTable->refreshPluginList(); |
|
108 | 108 | } |
|
109 | 109 | |
|
110 | 110 | |
|
111 | 111 | void pluginmanagerWDGT::removePlugin() |
|
112 | 112 | { |
|
113 | 113 | for(int i=0;i<this->pluginTable->selectedItems().count();i++) |
|
114 | 114 | { |
|
115 | 115 | QListWidgetItem* item = this->pluginTable->selectedItems().at(i); |
|
116 | 116 | if(item!=NULL) |
|
117 | 117 | { |
|
118 | 118 | QFile::remove(QString(SocExplorerEngine::pluginFolder())+"/"+item->text()); |
|
119 | 119 | } |
|
120 | 120 | } |
|
121 | 121 | this->pluginTable->refreshPluginList(); |
|
122 | 122 | } |
|
123 | 123 | |
|
124 | 124 | |
|
125 | 125 | |
|
126 | 126 | void pluginmanagerWDGT::loadplugin() |
|
127 | 127 | { |
|
128 | 128 | for(int i=0;i<this->pluginTable->selectedItems().count();i++) |
|
129 | 129 | { |
|
130 | 130 | QListWidgetItem* item = this->pluginTable->selectedItems().at(i); |
|
131 | 131 | if(item!=NULL) |
|
132 | 132 | { |
|
133 | 133 | QString plugin = QString(SocExplorerEngine::pluginFolder())+"/"+item->text(); |
|
134 | 134 | emit this->loadSysDrviver(plugin); |
|
135 | 135 | } |
|
136 | 136 | } |
|
137 | 137 | this->pluginTable->refreshPluginList(); |
|
138 | 138 | } |
|
139 | 139 | |
|
140 | 140 | |
|
141 | 141 | |
|
142 | 142 |
@@ -1,94 +1,94 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef PLUGINMANAGERWDGT_H |
|
23 | 23 | #define PLUGINMANAGERWDGT_H |
|
24 | 24 | |
|
25 | 25 | #include <QApplication> |
|
26 | 26 | #include <QWidget> |
|
27 | 27 | #include <QDockWidget> |
|
28 | 28 | #include <QVBoxLayout> |
|
29 | 29 | #include <QHBoxLayout> |
|
30 | 30 | #include <QTableWidget> |
|
31 | 31 | #include <QDir> |
|
32 | 32 | #include <QStringList> |
|
33 | 33 | #include <QFileInfoList> |
|
34 | 34 | #include <QFileInfo> |
|
35 | 35 | #include <QTextEdit> |
|
36 | 36 | #include <QPushButton> |
|
37 | 37 | #include <QSplitter> |
|
38 | 38 | #include "plugininfoswdgt.h" |
|
39 | 39 | #include "pluginlist.h" |
|
40 | 40 | #include <socexplorerplugin.h> |
|
41 | 41 | #include <QList> |
|
42 | 42 | #include "plugintree.h" |
|
43 | 43 | |
|
44 | 44 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
45 | 45 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
46 | 46 | #else |
|
47 | 47 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
48 | 48 | #endif |
|
49 | 49 | |
|
50 | 50 | class pluginmanagerWDGT : public QSplitter |
|
51 | 51 | { |
|
52 | 52 | Q_OBJECT |
|
53 | 53 | public: |
|
54 | 54 | SOCEXPLORER_SDK_EXPORT explicit pluginmanagerWDGT(QWidget *parent = 0); |
|
55 | 55 | SOCEXPLORER_SDK_EXPORT void setRootLoadable(bool flag); |
|
56 | 56 | SOCEXPLORER_SDK_EXPORT void setChildLoadable(bool flag); |
|
57 | 57 | |
|
58 | 58 | signals: |
|
59 | 59 | void updatepluginInfo(const QString libname); |
|
60 | 60 | void loadSysDrviver(const QString name); |
|
61 | 61 | void loadSysDriverToParent(const QString name, const QString instanceName); |
|
62 | 62 | void geteplugintree(void); |
|
63 | 63 | void treeChanged(const QList<socexplorerplugin*>& drivers); |
|
64 | 64 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
65 | 65 | void closeSysDriver(const QString instanceName); |
|
66 | 66 | void pluginselected(const QString& instanceName); |
|
67 | 67 | |
|
68 | 68 | public slots: |
|
69 | 69 | //void libselected(int row); |
|
70 | 70 | void addPlugin(); |
|
71 | 71 | void removePlugin(); |
|
72 | 72 | void loadplugin(); |
|
73 | 73 | //void loadplugin(QListWidgetItem*); |
|
74 | 74 | |
|
75 | 75 | private: |
|
76 | 76 | |
|
77 | 77 | bool rootLoadable; |
|
78 | 78 | bool childLoadable; |
|
79 | 79 | QWidget* pluginListWidgetContainer; |
|
80 | 80 | QVBoxLayout* pluginListLayout; |
|
81 | 81 | QHBoxLayout* ButtonsLayout; |
|
82 | 82 | QSplitter* mainlayoutSpliter; |
|
83 | 83 | PluginList* pluginTable; |
|
84 | 84 | pluginInfosWdgt* pluginInfos; |
|
85 | 85 | plugintree* treeview; |
|
86 | 86 | QPushButton* addPluginBt; |
|
87 | 87 | QPushButton* removePluginBt; |
|
88 | 88 | QPushButton* loadPluginBt; |
|
89 | 89 | QPushButton* refreshPluginListBt; |
|
90 | 90 | |
|
91 | 91 | |
|
92 | 92 | }; |
|
93 | 93 | |
|
94 | 94 | #endif // PLUGINMANAGERWDGT_H |
@@ -1,73 +1,73 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef PLUGINTREE_H |
|
23 | 23 | #define PLUGINTREE_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | 26 | #include <QTreeWidget> |
|
27 | 27 | #include <socexplorerplugin.h> |
|
28 | 28 | #include <QList> |
|
29 | 29 | #include <QtGui/QDragEnterEvent> |
|
30 | 30 | #include <QtGui/QDragLeaveEvent> |
|
31 | 31 | #include <QtGui/QDragMoveEvent> |
|
32 | 32 | #include <QtGui/QDropEvent> |
|
33 | 33 | #include <QtCore/QMimeData> |
|
34 | 34 | #include <QtCore/QUrl> |
|
35 | 35 | #include <QtCore/QList> |
|
36 | 36 | #include <QPoint> |
|
37 | 37 | #include <QLabel> |
|
38 | 38 | |
|
39 | 39 | class plugintree : public QTreeWidget |
|
40 | 40 | { |
|
41 | 41 | Q_OBJECT |
|
42 | 42 | public: |
|
43 | 43 | explicit plugintree(QWidget *parent = 0); |
|
44 | 44 | |
|
45 | 45 | protected: |
|
46 | 46 | void dragEnterEvent(QDragEnterEvent *event); |
|
47 | 47 | void dragMoveEvent(QDragMoveEvent *event); |
|
48 | 48 | void dropEvent(QDropEvent *event); |
|
49 | 49 | void mousePressEvent(QMouseEvent *event); |
|
50 | 50 | void mouseDoubleClickEvent(QMouseEvent *event); |
|
51 | 51 | void keyPressEvent(QKeyEvent *event); |
|
52 | 52 | |
|
53 | 53 | signals: |
|
54 | 54 | void geteplugintree(void); |
|
55 | 55 | void pluginselected(const QString& Name); |
|
56 | 56 | void loadSysDriverToParent(const QString name, const QString instanceName); |
|
57 | 57 | void loadSysDriver(const QString name); |
|
58 | 58 | void closeSysDriver(const QString instanceName); |
|
59 | 59 | void changeSysDriverInstName(const QString instanceName); |
|
60 | 60 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
61 | 61 | public slots: |
|
62 | 62 | void treeChanged(const QList<socexplorerplugin*>& drivers); |
|
63 | 63 | void pluginselectedslt( QTreeWidgetItem * item, int column); |
|
64 | 64 | void itemSelectionChangedslt(); |
|
65 | 65 | |
|
66 | 66 | private: |
|
67 | 67 | void addplugin(socexplorerplugin* driver,QTreeWidgetItem* item); |
|
68 | 68 | QTreeWidgetItem* editeditem; |
|
69 | 69 | QString* editeditemprev; |
|
70 | 70 | bool editingItem; |
|
71 | 71 | }; |
|
72 | 72 | |
|
73 | 73 | #endif // PLUGINTREE_H |
@@ -1,90 +1,90 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef PLUGINLOADER_H |
|
23 | 23 | #define PLUGINLOADER_H |
|
24 | 24 | |
|
25 | 25 | #include <QString> |
|
26 | 26 | #include <QLibrary> |
|
27 | 27 | #include <QObject> |
|
28 | 28 | #include <QStringList> |
|
29 | 29 | #include <socexplorerplugininterface.h> |
|
30 | 30 | #include <socexplorerplugin.h> |
|
31 | 31 | #include <pluginscache.h> |
|
32 | 32 | /* |
|
33 | 33 | Debug |
|
34 | 34 | */ |
|
35 | 35 | #include <stdio.h> |
|
36 | 36 | |
|
37 | 37 | #define loadlib(filename) QLibrary* lib = new QLibrary((fileName));\ |
|
38 | 38 | lib->load();\ |
|
39 | 39 | if(!lib->isLoaded())\ |
|
40 | 40 | {\ |
|
41 | 41 | return 0;\ |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | |
|
45 | 45 | class pluginloader |
|
46 | 46 | { |
|
47 | 47 | |
|
48 | 48 | private: |
|
49 | 49 | static pluginloader* _self; |
|
50 | 50 | static PluginsCache* _cache; |
|
51 | 51 | static QStringList* _folderList; |
|
52 | 52 | ~pluginloader(); |
|
53 | 53 | pluginloader(); |
|
54 | 54 | public: |
|
55 | 55 | |
|
56 | 56 | static void init(); |
|
57 | 57 | static pluginloader* self(); |
|
58 | 58 | |
|
59 | 59 | static int checklibrary(const QString fileName); |
|
60 | 60 | static bool isvalid(QString Name); |
|
61 | 61 | static socexplorerplugin* newsocexplorerplugin(const QString Name); |
|
62 | 62 | static QString getlibTypeStr(QString Name); |
|
63 | 63 | static pluginT getlibType(QString Name); |
|
64 | 64 | static QString getlibVersion(const QString Name); |
|
65 | 65 | static QString getlibPIDstr(const QString Name); |
|
66 | 66 | static QString getlibVIDstr(const QString Name); |
|
67 | 67 | static int getlibPID(const QString Name); |
|
68 | 68 | static int getlibVID(const QString Name); |
|
69 | 69 | static int libcanbechild(const QString Name); |
|
70 | 70 | static int libcanberoot(const QString Name); |
|
71 | 71 | static QString getlibAuthor(const QString Name); |
|
72 | 72 | static QString getlibName(const QString Name); |
|
73 | 73 | static QString getlibDescription(const QString Name); |
|
74 | 74 | static QString getlibDir(const QString Name); |
|
75 | 75 | static QString findlib(QString name); |
|
76 | 76 | static QList<PluginsCacheItem *> listAvailiables(bool rescan=true); |
|
77 | 77 | static void scanFolders(); |
|
78 | 78 | static void showCache(){_cache->show();} |
|
79 | 79 | private: |
|
80 | 80 | int p_checklibraryQlib(const QString fileName); |
|
81 | 81 | int p_checklibraryCustom(const QString fileName); |
|
82 | 82 | socexplorerplugin* p_newsocexplorerpluginQlib(const QString Name); |
|
83 | 83 | socexplorerplugin* p_newsocexplorerpluginCustom(const QString Name); |
|
84 | 84 | static QStringList readFoldersList(const QStringList confFiles); |
|
85 | 85 | static QString* _cacheLookup(const QString Name); |
|
86 | 86 | static QString _getlibName(const QString fileName); |
|
87 | 87 | static int _getlibPID(const QString fileName); |
|
88 | 88 | static int _getlibVID(const QString fileName); |
|
89 | 89 | }; |
|
90 | 90 | #endif |
@@ -1,73 +1,73 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef PLUGINSCACHE_H |
|
23 | 23 | #define PLUGINSCACHE_H |
|
24 | 24 | |
|
25 | 25 | #include <QObject> |
|
26 | 26 | #include <QString> |
|
27 | 27 | #include <QList> |
|
28 | 28 | //#include <QtXml> |
|
29 | 29 | #include <QTableWidget> |
|
30 | 30 | |
|
31 | 31 | class PluginsCacheItem |
|
32 | 32 | { |
|
33 | 33 | public: |
|
34 | 34 | PluginsCacheItem(const QString& fileName,const QString& path,const QString& pluginName,int VID,int PID); |
|
35 | 35 | ~PluginsCacheItem(){delete fileName;delete path;delete pluginName;} |
|
36 | 36 | bool compare(PluginsCacheItem* item); |
|
37 | 37 | bool comparePluginName(const QString& pluginName); |
|
38 | 38 | bool comparefileName(const QString& fileName); |
|
39 | 39 | bool comparefilePath(const QString& filePath); |
|
40 | 40 | bool compareIDs(int VID,int PID); |
|
41 | 41 | QString getpath(){return QString(*path);} |
|
42 | 42 | QString getfileName(){return QString(*fileName);} |
|
43 | 43 | QString getpluginName(){return QString(*pluginName);} |
|
44 | 44 | int getVID(){return this->VID;} |
|
45 | 45 | int getPID(){return this->PID;} |
|
46 | 46 | private: |
|
47 | 47 | QString* fileName; |
|
48 | 48 | QString* path; |
|
49 | 49 | QString* pluginName; |
|
50 | 50 | int VID; |
|
51 | 51 | int PID; |
|
52 | 52 | }; |
|
53 | 53 | |
|
54 | 54 | class PluginsCache : public QObject |
|
55 | 55 | { |
|
56 | 56 | Q_OBJECT |
|
57 | 57 | public: |
|
58 | 58 | explicit PluginsCache(QObject *parent = 0); |
|
59 | 59 | void append(const QString& fileName,const QString& path,const QString& pluginName,int VID,int PID); |
|
60 | 60 | QString first(const QString& pluginName); |
|
61 | 61 | QString first(int VID,int PID); |
|
62 | 62 | QStringList findDriver(int VID,int PID); |
|
63 | 63 | QList<PluginsCacheItem*> listDrivers(); |
|
64 | 64 | void flush(); |
|
65 | 65 | public slots: |
|
66 | 66 | void show(); |
|
67 | 67 | private: |
|
68 | 68 | QList<PluginsCacheItem*>* items; |
|
69 | 69 | QTableWidget* __view; |
|
70 | 70 | |
|
71 | 71 | }; |
|
72 | 72 | |
|
73 | 73 | #endif // PLUGINSCACHE_H |
@@ -1,58 +1,58 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef GENERICPYSYSDRIVER_H |
|
23 | 23 | #define GENERICPYSYSDRIVER_H |
|
24 | 24 | #include <QObject> |
|
25 | 25 | #include <QVariant> |
|
26 | 26 | #include <QVariantList> |
|
27 | 27 | #include <malloc.h> |
|
28 | 28 | #include <QFile> |
|
29 | 29 | #include <stdint.h> |
|
30 | 30 | #include <QTextStream> |
|
31 | 31 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
32 | 32 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
33 | 33 | #else |
|
34 | 34 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
35 | 35 | #endif |
|
36 | 36 | class socexplorerplugin; |
|
37 | 37 | |
|
38 | 38 | class SOCEXPLORER_SDK_EXPORT genericPySysdriver : public QObject |
|
39 | 39 | { |
|
40 | 40 | Q_OBJECT |
|
41 | 41 | |
|
42 | 42 | public: |
|
43 | 43 | |
|
44 | 44 | explicit genericPySysdriver(socexplorerplugin* plugin,QObject* parent=0); |
|
45 | 45 | signals: |
|
46 | 46 | public slots: |
|
47 | 47 | QVariantList Read(unsigned int address,unsigned int count); |
|
48 | 48 | void Write(unsigned int address,QList<QVariant> dataList); |
|
49 | 49 | bool dumpMemory(unsigned int address,unsigned int count,QString file); |
|
50 | 50 | bool memSet(unsigned int address,int value, unsigned int count); |
|
51 | 51 | bool loadbin(unsigned int address,QString file); |
|
52 | 52 | QString instance(); |
|
53 | 53 | private: |
|
54 | 54 | socexplorerplugin* plugin; |
|
55 | 55 | |
|
56 | 56 | }; |
|
57 | 57 | |
|
58 | 58 | #endif // GENERICPYSYSDRIVER_H |
@@ -1,91 +1,91 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | |
|
23 | 23 | #include <socexplorerplugin.h> |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | int socexplorerplugin::isConnected(){return this->Connected;} |
|
27 | 27 | |
|
28 | 28 | QString socexplorerplugin::baseName(){return *_Name;} |
|
29 | 29 | |
|
30 | 30 | int socexplorerplugin::baseAddress(){return this->BaseAddress;} |
|
31 | 31 | |
|
32 | 32 | void socexplorerplugin::setBaseAddress(unsigned int baseAddress){this->BaseAddress = baseAddress;} |
|
33 | 33 | |
|
34 | 34 | QString socexplorerplugin::instanceName() |
|
35 | 35 | { |
|
36 | 36 | return this->_instanceName; |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | int socexplorerplugin::registermenu(QMenu *menu) |
|
40 | 40 | { |
|
41 | 41 | this->menu = menu->addMenu(this->_instanceName); |
|
42 | 42 | this->closeAction = this->menu->addAction(tr("Close plugin")); |
|
43 | 43 | QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe())); |
|
44 | 44 | this->ChildsMenu = this->menu->addMenu(QString("Childs")); |
|
45 | 45 | for(int i=0;i<this->childs.count();i++) |
|
46 | 46 | { |
|
47 | 47 | this->childs.at(i)->registermenu(this->ChildsMenu); |
|
48 | 48 | } |
|
49 | 49 | if(this->pyObject!=NULL)emit this->registerObject((QObject*)this->pyObject,this->instanceName()); |
|
50 | 50 | return 0; |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | 53 | void socexplorerplugin::postInstantiationTrigger() |
|
54 | 54 | { |
|
55 | 55 | return; |
|
56 | 56 | } |
|
57 | 57 | |
|
58 | 58 | unsigned int socexplorerplugin::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
59 | 59 | { |
|
60 | 60 | if(parent!=NULL) |
|
61 | 61 | { |
|
62 | 62 | return parent->Write(Value,count,address); |
|
63 | 63 | } |
|
64 | 64 | return 0; |
|
65 | 65 | } |
|
66 | 66 | |
|
67 | 67 | unsigned int socexplorerplugin::Read(unsigned int *Value, unsigned int count, unsigned int address) |
|
68 | 68 | { |
|
69 | 69 | if(parent!=NULL) |
|
70 | 70 | { |
|
71 | 71 | return parent->Read(Value,count,address); |
|
72 | 72 | } |
|
73 | 73 | return 0; |
|
74 | 74 | } |
|
75 | 75 | |
|
76 | 76 | void socexplorerplugin::closeMe(){emit this->closePlugin(this);} |
|
77 | 77 | |
|
78 | 78 | void socexplorerplugin::activate(bool flag){this->setEnabled(flag);emit this->activateSig(flag);} |
|
79 | 79 | |
|
80 | 80 | void socexplorerplugin::setInstanceName(const QString &newName) |
|
81 | 81 | { |
|
82 | 82 | this->_instanceName = newName; |
|
83 | 83 | if(this->menu) |
|
84 | 84 | this->menu->setTitle(this->_instanceName); |
|
85 | 85 | this->setWindowTitle(newName); |
|
86 | 86 | } |
|
87 | 87 | |
|
88 | 88 | void socexplorerplugin::makeGenericPyWrapper() |
|
89 | 89 | { |
|
90 | 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 | 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 | 12 | -- This program is free software; you can redistribute it and/or modify |
|
13 | 13 | -- it under the terms of the GNU General Public License as published by |
|
14 | 14 | -- the Free Software Foundation; either version 2 of the License, or |
|
15 | 15 | -- (at your option) any later version. |
|
16 | 16 | -- |
|
17 | 17 | -- This program is distributed in the hope that it will be useful, |
|
18 | 18 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | 19 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | 20 | -- GNU General Public License for more details. |
|
21 | 21 | -- |
|
22 | 22 | -- You should have received a copy of the GNU General Public License |
|
23 | 23 | -- along with this program; if not, write to the Free Software |
|
24 | 24 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
25 | 25 | -------------------------------------------------------------------------------*/ |
|
26 | 26 | /*-- Author : Alexis Jeandet |
|
27 | 27 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
28 | 28 | ----------------------------------------------------------------------------*/ |
|
29 | 29 | #ifndef SOCEXPLORERPLUGIN_H |
|
30 | 30 | #define SOCEXPLORERPLUGIN_H |
|
31 | 31 | #include <QWidget> |
|
32 | 32 | #include <QAction> |
|
33 | 33 | #include <QDockWidget> |
|
34 | 34 | #include <QMainWindow> |
|
35 | 35 | #include <QList> |
|
36 | 36 | #include <QMenu> |
|
37 | 37 | #include <socexplorer.h> |
|
38 | 38 | #include <QObject> |
|
39 | 39 | #include <QVariant> |
|
40 | 40 | #include <QVariantList> |
|
41 | 41 | #include <malloc.h> |
|
42 | 42 | #include <QFile> |
|
43 | 43 | #include <stdint.h> |
|
44 | 44 | #include <QTextStream> |
|
45 | 45 | #include <genericPySysdriver.h> |
|
46 | 46 | #ifndef driver_Name |
|
47 | 47 | #define driver_Name "Plugin" |
|
48 | 48 | #endif |
|
49 | 49 | #ifndef driver_Author |
|
50 | 50 | #define driver_Author "No Author" |
|
51 | 51 | #endif |
|
52 | 52 | #ifndef driver_Version |
|
53 | 53 | #define driver_Version "0.0.0" |
|
54 | 54 | #endif |
|
55 | 55 | #ifndef driver_Description |
|
56 | 56 | #define driver_Description "No description." |
|
57 | 57 | #endif |
|
58 | 58 | #ifndef driver_can_be_root |
|
59 | 59 | #define driver_can_be_root 0 |
|
60 | 60 | #endif |
|
61 | 61 | #ifndef driver_can_be_child |
|
62 | 62 | #define driver_can_be_child 0 |
|
63 | 63 | #endif |
|
64 | 64 | #ifndef driver_VID |
|
65 | 65 | #define driver_VID 0 |
|
66 | 66 | #endif |
|
67 | 67 | #ifndef driver_PID |
|
68 | 68 | #define driver_PID 0 |
|
69 | 69 | #endif |
|
70 | 70 | |
|
71 | 71 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
72 | 72 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
73 | 73 | #else |
|
74 | 74 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
75 | 75 | #endif |
|
76 | 76 | |
|
77 | 77 | class genericPySysdriver; |
|
78 | 78 | |
|
79 | 79 | //! socexplorerplugin is the base class for any SocExplorer plugin, it gives a standard interface to communicate |
|
80 | 80 | //! between each plugins and to interact with SocExplorer software. |
|
81 | 81 | |
|
82 | 82 | class SOCEXPLORER_SDK_EXPORT socexplorerplugin : public QDockWidget |
|
83 | 83 | { |
|
84 | 84 | Q_OBJECT |
|
85 | 85 | public: |
|
86 | 86 | //! Default plugin constructor, any plugin should call this constructor. This constructor creates a |
|
87 | 87 | //! default python wrapper instance. If you want to connect your own python wrapper, you have to clear |
|
88 | 88 | //! createPyObject option and instanciate your own genericPySysdriver derivated object. |
|
89 | 89 | socexplorerplugin(QWidget *parent = 0,bool createPyObject=true):QDockWidget(parent) |
|
90 | 90 | { |
|
91 | 91 | closeAction=NULL; |
|
92 | 92 | menu=NULL; |
|
93 | 93 | ChildsMenu=NULL; |
|
94 | 94 | this->Connected = false; |
|
95 | 95 | this->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetVerticalTitleBar); |
|
96 | 96 | _Name = new QString(driver_Name); |
|
97 | 97 | _Author = new QString(driver_Author); |
|
98 | 98 | _Version = new QString(driver_Version); |
|
99 | 99 | _Description = new QString(driver_Description); |
|
100 | 100 | _canBeChild = driver_can_be_child; |
|
101 | 101 | _canBeRoot = driver_can_be_root; |
|
102 | 102 | _VID = driver_VID; |
|
103 | 103 | _PID = driver_PID; |
|
104 | 104 | if(createPyObject) |
|
105 | 105 | { |
|
106 | 106 | this->makeGenericPyWrapper(); |
|
107 | 107 | } |
|
108 | 108 | } |
|
109 | 109 | //! Tells if the plugin is connected, it is used to enable or disable all childrens interfaces. |
|
110 | 110 | virtual int isConnected(); |
|
111 | 111 | //! Gives the associated Vendor IDentifier, usefull to automatically associate plugins with found |
|
112 | 112 | //! hardware while board enumeration. |
|
113 | 113 | virtual int VID(){return _PID;} |
|
114 | 114 | //! Gives the associated Product IDentifier, usefull to automatically associate plugins with found |
|
115 | 115 | //! hardware while board enumeration. |
|
116 | 116 | virtual int PID(){return _VID;} |
|
117 | 117 | //! Gives the plugin's base name, usefull to automatically generate instance name. |
|
118 | 118 | virtual QString baseName(); |
|
119 | 119 | //! Gives the base address of the current instance, for example if your plugin is supposed to drive |
|
120 | 120 | //! an UART it will correspond to the address of it's first register. This address have at least to |
|
121 | 121 | //! be set by SocExplorer and it can be user accessible if you want. |
|
122 | 122 | virtual int baseAddress(); |
|
123 | 123 | //! Sets the base address of the current instance, for example if your plugin is supposed to drive |
|
124 | 124 | //! an UART it will correspond to the address of it's first register. This address have at least to |
|
125 | 125 | //! be set by lppSocExplorer and it can be user accessible if you want. |
|
126 | 126 | virtual void setBaseAddress(unsigned int baseAddress); |
|
127 | 127 | |
|
128 | 128 | genericPySysdriver* getPyObjectWrapper(){return this->pyObject;} |
|
129 | 129 | QList<socexplorerplugin*> childs; |
|
130 | 130 | socexplorerplugin* parent; |
|
131 | 131 | QAction* closeAction; |
|
132 | 132 | QString instanceName(); |
|
133 | 133 | QMenu* menu; |
|
134 | 134 | QMenu* ChildsMenu; |
|
135 | 135 | |
|
136 | 136 | signals: |
|
137 | 137 | //! Signal emited each time the plugin is about to be closed. |
|
138 | 138 | void closePlugin(socexplorerplugin* driver); |
|
139 | 139 | void activateSig(bool flag); |
|
140 | 140 | void registerObject(QObject* object,const QString& instanceName); |
|
141 | 141 | |
|
142 | 142 | public slots: |
|
143 | 143 | virtual int registermenu(QMenu* menu); |
|
144 | 144 | virtual void postInstantiationTrigger(); |
|
145 | 145 | //! Write slot this is the way your children plugins ask you for writing data. |
|
146 | 146 | //! If your plugin is supposed to have childern drivers you should implement this methode. |
|
147 | 147 | //! By default this methode forward the write request to the parent plugin. |
|
148 | 148 | //! \param Value Pointer the data buffer. |
|
149 | 149 | //! \param count Number of 32 bits words you should to write. |
|
150 | 150 | //! \param address Address from where you should to start to write. |
|
151 | 151 | //! \return Quantity of 32 bits words writtens. |
|
152 | 152 | virtual unsigned int Write(unsigned int* Value, unsigned int count,unsigned int address); |
|
153 | 153 | //! Read slot this is the way your children plugins ask you for reading data. |
|
154 | 154 | //! If your plugin is supposed to have childern drivers you should implement this methode. |
|
155 | 155 | //! By default this methode forward the write request to the parent plugin. |
|
156 | 156 | //! \param Value Pointer the data buffer. |
|
157 | 157 | //! \param count Number of 32 bits words you should to read. |
|
158 | 158 | //! \param address Address from where you should to start to read. |
|
159 | 159 | //! \return Quantity of 32 bits words read. |
|
160 | 160 | virtual unsigned int Read(unsigned int* Value, unsigned int count,unsigned int address); |
|
161 | 161 | virtual void closeMe(); |
|
162 | 162 | virtual void activate(bool flag); |
|
163 | 163 | virtual void setInstanceName(const QString& newName); |
|
164 | 164 | protected: |
|
165 | 165 | void makeGenericPyWrapper(); |
|
166 | 166 | int BaseAddress; |
|
167 | 167 | bool Connected; |
|
168 | 168 | genericPySysdriver* pyObject; |
|
169 | 169 | QString* _Name; |
|
170 | 170 | QString* _Author; |
|
171 | 171 | QString* _Version; |
|
172 | 172 | QString* _Description; |
|
173 | 173 | QString _instanceName; |
|
174 | 174 | int _canBeChild; |
|
175 | 175 | int _canBeRoot; |
|
176 | 176 | int _VID; |
|
177 | 177 | int _PID; |
|
178 | 178 | }; |
|
179 | 179 | |
|
180 | 180 | #endif // SOCEXPLORERPLUGIN_H |
@@ -1,74 +1,74 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "socexplorerplugininterface.h" |
|
23 | 23 | #include <QString> |
|
24 | 24 | #ifdef PLUGINHEADER |
|
25 | 25 | #include PLUGINHEADER |
|
26 | 26 | #else |
|
27 | 27 | #include <plugindefs.h> |
|
28 | 28 | #endif |
|
29 | 29 | |
|
30 | 30 | void* socexplorerpluginCreateObject() |
|
31 | 31 | { |
|
32 | 32 | return (void*) new PLUGIN(); |
|
33 | 33 | } |
|
34 | 34 | |
|
35 | 35 | int socexplorerplugincanberoot() |
|
36 | 36 | { |
|
37 | 37 | return driver_can_be_root; |
|
38 | 38 | } |
|
39 | 39 | |
|
40 | 40 | int socexplorerplugincanbechild() |
|
41 | 41 | { |
|
42 | 42 | return driver_can_be_child; |
|
43 | 43 | } |
|
44 | 44 | |
|
45 | 45 | int socexplorerpluginpid() |
|
46 | 46 | { |
|
47 | 47 | return driver_PID; |
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | int socexplorerpluginvid() |
|
51 | 51 | { |
|
52 | 52 | return driver_VID; |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | 55 | pluginT socexplorerpluginType() |
|
56 | 56 | { |
|
57 | 57 | return PerifDriverT; |
|
58 | 58 | } |
|
59 | 59 | QString socexplorerpluginName() |
|
60 | 60 | { |
|
61 | 61 | return QString(driver_Name); |
|
62 | 62 | } |
|
63 | 63 | QString socexplorerpluginVersion() |
|
64 | 64 | { |
|
65 | 65 | return QString(driver_Version); |
|
66 | 66 | } |
|
67 | 67 | QString socexplorerpluginAuthor() |
|
68 | 68 | { |
|
69 | 69 | return QString(driver_Author); |
|
70 | 70 | } |
|
71 | 71 | QString socexplorerpluginDescription() |
|
72 | 72 | { |
|
73 | 73 | return QString(driver_Description); |
|
74 | 74 | } |
@@ -1,74 +1,74 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef SOCEXPLORERPLUGININTERFACE_H |
|
23 | 23 | #define SOCEXPLORERPLUGININTERFACE_H |
|
24 | 24 | |
|
25 | 25 | #include "socexplorerplugininterface_global.h" |
|
26 | 26 | #include <QString> |
|
27 | 27 | #include <QtGlobal> |
|
28 | 28 | |
|
29 | 29 | #define ComDriverT 1 |
|
30 | 30 | #define PerifDriverT 2 |
|
31 | 31 | typedef int pluginT; |
|
32 | 32 | |
|
33 | 33 | typedef void* (*socexplorerpluginCreateObjectT)(); |
|
34 | 34 | typedef pluginT (*socexplorerpluginTypeT)(); |
|
35 | 35 | typedef int (*socexplorerpluginpidT)(); |
|
36 | 36 | typedef int (*socexplorerpluginvidT)(); |
|
37 | 37 | typedef int (*socexplorerplugincanberootT)(); |
|
38 | 38 | typedef int (*socexplorerplugincanbechildT)(); |
|
39 | 39 | typedef QString (*socexplorerpluginNameT)(); |
|
40 | 40 | typedef QString (*socexplorerpluginVersionT)(); |
|
41 | 41 | typedef QString (*socexplorerpluginAuthorT)(); |
|
42 | 42 | typedef QString (*socexplorerpluginDescriptionT)(); |
|
43 | 43 | |
|
44 | 44 | extern "C" |
|
45 | 45 | { |
|
46 | 46 | #ifndef QT_ENSURE_STACK_ALIGNED_FOR_SSE |
|
47 | 47 | #define QT_ENSURE_STACK_ALIGNED_FOR_SSE |
|
48 | 48 | #endif |
|
49 | 49 | //! \header This the C interface socexplorer uses to load dynamically any plugin, a C interface is the |
|
50 | 50 | //! easyest way to manually resolve functions in a dynamic library. |
|
51 | 51 | |
|
52 | 52 | //! \fn socexplorerpluginCreateObject Plugin constructor. |
|
53 | 53 | LIBSOCEXPLORERPLUGIN_EXPORT void* socexplorerpluginCreateObject()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
54 | 54 | //! \fn socexplorerpluginpid Plugin's PID. |
|
55 | 55 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerpluginpid()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
56 | 56 | //! \fn socexplorerpluginvid Plugin's VID. |
|
57 | 57 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerpluginvid()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
58 | 58 | //! \fn socexplorerplugincanberoot Tells if the plugin can be a root plugin. |
|
59 | 59 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerplugincanberoot()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
60 | 60 | //! \fn socexplorerplugincanberoot Tells if the plugin can be a child plugin. |
|
61 | 61 | LIBSOCEXPLORERPLUGIN_EXPORT int socexplorerplugincanbechild()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
62 | 62 | //! \fn socexplorerpluginType Gives the plugin's type, not used yet. |
|
63 | 63 | LIBSOCEXPLORERPLUGIN_EXPORT pluginT socexplorerpluginType()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
64 | 64 | //! \fn socexplorerpluginVersion Gives the plugin's version. |
|
65 | 65 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginVersion()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
66 | 66 | //! \fn socexplorerpluginName Gives the plugin's name. |
|
67 | 67 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginName()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
68 | 68 | //! \fn socexplorerpluginAuthor Gives the plugin's author. |
|
69 | 69 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginAuthor()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
70 | 70 | //! \fn socexplorerpluginDescription Gives the plugin's description. |
|
71 | 71 | LIBSOCEXPLORERPLUGIN_EXPORT QString socexplorerpluginDescription()QT_ENSURE_STACK_ALIGNED_FOR_SSE; |
|
72 | 72 | } |
|
73 | 73 | |
|
74 | 74 | #endif // SOCEXPLORERPLUGININTERFACE_H |
@@ -1,33 +1,33 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef SOCEXPLORERPLUGIN_GLOBAL_H |
|
23 | 23 | #define SOCEXPLORERPLUGIN_GLOBAL_H |
|
24 | 24 | |
|
25 | 25 | #include <QtCore/qglobal.h> |
|
26 | 26 | |
|
27 | 27 | #if defined(SOCEXPLORERPLUGIN_LIBRARY) |
|
28 | 28 | # define LIBSOCEXPLORERPLUGIN_EXPORT Q_DECL_EXPORT |
|
29 | 29 | #else |
|
30 | 30 | # define LIBSOCEXPLORERPLUGIN_EXPORT Q_DECL_IMPORT |
|
31 | 31 | #endif |
|
32 | 32 | |
|
33 | 33 | #endif // SOCEXPLORERPLUGIN_GLOBAL_H |
@@ -1,380 +1,380 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "socexplorerproxy.h" |
|
23 | 23 | #include <pluginmanagerWDGT.h> |
|
24 | 24 | #include <socexplorerengine.h> |
|
25 | 25 | #include <pluginloader.h> |
|
26 | 26 | #include <socexplorerplugin.h> |
|
27 | 27 | |
|
28 | 28 | socexplorerproxy* socexplorerproxy::_self=NULL; |
|
29 | 29 | QMainWindow* socexplorerproxy::mainWindow=NULL; |
|
30 | 30 | QList<socexplorerplugin*>* socexplorerproxy::drivers=NULL; |
|
31 | 31 | QList<socexplorerplugin*>* socexplorerproxy::linearDriverList=NULL; |
|
32 | 32 | socexplorerplugin* socexplorerproxy::root=NULL; |
|
33 | 33 | socexplorerplugin* socexplorerproxy::parent=NULL; |
|
34 | 34 | PluginsCache* socexplorerproxy::cache=NULL; |
|
35 | 35 | |
|
36 | 36 | socexplorerproxy::socexplorerproxy(QObject *parent) : |
|
37 | 37 | QObject(parent) |
|
38 | 38 | { |
|
39 | 39 | cache = new PluginsCache; |
|
40 | 40 | drivers = new QList<socexplorerplugin*>; |
|
41 | 41 | linearDriverList=new QList<socexplorerplugin*>; |
|
42 | 42 | root = NULL; |
|
43 | 43 | } |
|
44 | 44 | |
|
45 | 45 | |
|
46 | 46 | socexplorerproxy::socexplorerproxy(QMainWindow *Mainwindow, QObject *parent): |
|
47 | 47 | QObject(parent) |
|
48 | 48 | { |
|
49 | 49 | mainWindow = Mainwindow; |
|
50 | 50 | cache = new PluginsCache; |
|
51 | 51 | drivers = new QList<socexplorerplugin*>; |
|
52 | 52 | linearDriverList=new QList<socexplorerplugin*>; |
|
53 | 53 | root = NULL; |
|
54 | 54 | } |
|
55 | 55 | |
|
56 | 56 | |
|
57 | 57 | void socexplorerproxy::init() |
|
58 | 58 | { |
|
59 | 59 | if(!_self) |
|
60 | 60 | { |
|
61 | 61 | _self = new socexplorerproxy(); |
|
62 | 62 | mainWindow = NULL; |
|
63 | 63 | } |
|
64 | 64 | |
|
65 | 65 | } |
|
66 | 66 | |
|
67 | 67 | void socexplorerproxy::setMainWindow(QMainWindow *Mainwindow) |
|
68 | 68 | { |
|
69 | 69 | if(!_self)init(); |
|
70 | 70 | mainWindow=Mainwindow; |
|
71 | 71 | } |
|
72 | 72 | |
|
73 | 73 | void socexplorerproxy::loadSysDriver(const QString name) |
|
74 | 74 | { |
|
75 | 75 | if(!_self)init(); |
|
76 | 76 | if(pluginloader::libcanberoot(name)) |
|
77 | 77 | { |
|
78 | 78 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); |
|
79 | 79 | QString driverName = _self->getinstanceName(driver->baseName()); |
|
80 | 80 | loadSysDriver(driver,driverName); |
|
81 | 81 | } |
|
82 | 82 | } |
|
83 | 83 | |
|
84 | 84 | void socexplorerproxy::loadSysDriver(const QString name, const QString instanceName) |
|
85 | 85 | { |
|
86 | 86 | if(!_self)init(); |
|
87 | 87 | if(pluginloader::libcanberoot(name) && !_self->instanceExists(instanceName)) |
|
88 | 88 | { |
|
89 | 89 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); |
|
90 | 90 | loadSysDriver(driver,instanceName); |
|
91 | 91 | } |
|
92 | 92 | } |
|
93 | 93 | |
|
94 | 94 | |
|
95 | 95 | void socexplorerproxy::loadSysDriver(socexplorerplugin *driver, const QString instanceName) |
|
96 | 96 | { |
|
97 | 97 | if(!_self)init(); |
|
98 | 98 | driver->setInstanceName(instanceName); |
|
99 | 99 | driver->parent = NULL; |
|
100 | 100 | drivers->append(driver); |
|
101 | 101 | linearDriverList->append(driver); |
|
102 | 102 | connectChildToProxy(driver); |
|
103 | 103 | emit _self->addPluginGUI(driver); |
|
104 | 104 | emit _self->clearMenu(); |
|
105 | 105 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
106 | 106 | SocExplorerEngine::addSOC(driver); |
|
107 | 107 | } |
|
108 | 108 | |
|
109 | 109 | void socexplorerproxy::loadChildSysDriver(socexplorerplugin *parent, const QString child) |
|
110 | 110 | { |
|
111 | 111 | if(!_self)init(); |
|
112 | 112 | if(pluginloader::libcanbechild(child)) |
|
113 | 113 | { |
|
114 | 114 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(child); |
|
115 | 115 | QString driverName = _self->getinstanceName(driver->baseName()); |
|
116 | 116 | bool ok=true; |
|
117 | 117 | if(ok) |
|
118 | 118 | { |
|
119 | 119 | if(parent!=NULL)_self->loadSysDriverToParent(driver,parent,driverName); |
|
120 | 120 | } |
|
121 | 121 | } |
|
122 | 122 | } |
|
123 | 123 | |
|
124 | 124 | void socexplorerproxy::loadSysDriverToParent(const QString name,const QString ParentInst) |
|
125 | 125 | { |
|
126 | 126 | if(!_self)init(); |
|
127 | 127 | if(pluginloader::libcanbechild(name)) |
|
128 | 128 | { |
|
129 | 129 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); |
|
130 | 130 | QString driverName = _self->getinstanceName(driver->baseName()); |
|
131 | 131 | bool ok=true; |
|
132 | 132 | if(ok) |
|
133 | 133 | { |
|
134 | 134 | socexplorerplugin* parent=_self->getSysDriver(ParentInst); |
|
135 | 135 | if(parent!=NULL)loadSysDriverToParent(driver,parent,driverName); |
|
136 | 136 | } |
|
137 | 137 | } |
|
138 | 138 | } |
|
139 | 139 | |
|
140 | 140 | |
|
141 | 141 | void socexplorerproxy::loadSysDriverToParent(const QString name,const QString instanceName,const QString ParentInst) |
|
142 | 142 | { |
|
143 | 143 | if(!_self)init(); |
|
144 | 144 | if(pluginloader::libcanbechild(name) && !_self->instanceExists(instanceName)) |
|
145 | 145 | { |
|
146 | 146 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); |
|
147 | 147 | bool ok=true; |
|
148 | 148 | if(ok) |
|
149 | 149 | { |
|
150 | 150 | socexplorerplugin* parent=_self->getSysDriver(ParentInst); |
|
151 | 151 | if(parent!=NULL)loadSysDriverToParent(driver,parent,instanceName); |
|
152 | 152 | } |
|
153 | 153 | } |
|
154 | 154 | } |
|
155 | 155 | |
|
156 | 156 | void socexplorerproxy::loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName) |
|
157 | 157 | { |
|
158 | 158 | if(!_self)init(); |
|
159 | 159 | linearDriverList->append(driver); |
|
160 | 160 | driver->parent = parent; |
|
161 | 161 | driver->setInstanceName(instanceName); |
|
162 | 162 | parent->childs.append(driver); |
|
163 | 163 | connectChildToProxy(driver); |
|
164 | 164 | connectChildToParent(parent,driver); |
|
165 | 165 | emit _self->clearMenu(); |
|
166 | 166 | emit _self->addPluginGUI(driver); |
|
167 | 167 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
168 | 168 | driver->postInstantiationTrigger(); |
|
169 | 169 | } |
|
170 | 170 | |
|
171 | 171 | |
|
172 | 172 | void socexplorerproxy::changeSysDriverInstName(const QString instanceName) |
|
173 | 173 | { |
|
174 | 174 | Q_UNUSED(instanceName) |
|
175 | 175 | } |
|
176 | 176 | |
|
177 | 177 | void socexplorerproxy::changeSysDriverInstName(const QString newinstanceName, const QString previnstanceName) |
|
178 | 178 | { |
|
179 | 179 | if(!_self)init(); |
|
180 | 180 | socexplorerplugin*temp=_self->getSysDriver(previnstanceName); |
|
181 | 181 | if(temp!=NULL) |
|
182 | 182 | { |
|
183 | 183 | if(NULL!=_self->getSysDriver(newinstanceName)) |
|
184 | 184 | { |
|
185 | 185 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
186 | 186 | return; |
|
187 | 187 | } |
|
188 | 188 | temp->setInstanceName(newinstanceName); |
|
189 | 189 | } |
|
190 | 190 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
191 | 191 | } |
|
192 | 192 | |
|
193 | 193 | //void socexplorerproxy::loadChild(socexplorerplugin *parent) |
|
194 | 194 | //{ |
|
195 | 195 | // if(!_self)init(); |
|
196 | 196 | // parent = parent; |
|
197 | 197 | // pluginmanagerWDGT* pluginmanager0 = new pluginmanagerWDGT; |
|
198 | 198 | // pluginmanager0->setChildLoadable(true); |
|
199 | 199 | // pluginmanager0->connect(pluginmanager0,SIGNAL(loadSysDrviver(QString)),_self,SLOT(loadSysDriverToParent(QString))); |
|
200 | 200 | // pluginmanager0->show(); |
|
201 | 201 | //} |
|
202 | 202 | |
|
203 | 203 | |
|
204 | 204 | void socexplorerproxy::connectChildToParent(socexplorerplugin *parent, socexplorerplugin *child) |
|
205 | 205 | { |
|
206 | 206 | if(!_self)init(); |
|
207 | 207 | connect(parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool))); |
|
208 | 208 | child->activate(parent->isConnected()); |
|
209 | 209 | } |
|
210 | 210 | |
|
211 | 211 | void socexplorerproxy::disconnectChildToParent(socexplorerplugin *child) |
|
212 | 212 | { |
|
213 | 213 | if(!_self)init(); |
|
214 | 214 | disconnect(child->parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool))); |
|
215 | 215 | } |
|
216 | 216 | |
|
217 | 217 | |
|
218 | 218 | void socexplorerproxy::connectChildToProxy(socexplorerplugin *child) |
|
219 | 219 | { |
|
220 | 220 | if(!_self)init(); |
|
221 | 221 | connect(child,SIGNAL(registerObject(QObject*,QString)),_self,SIGNAL(registerObject(QObject*,QString))); |
|
222 | 222 | connect(child,SIGNAL(closePlugin(socexplorerplugin*)),_self,SLOT(closeSysDriver(socexplorerplugin*))); |
|
223 | 223 | } |
|
224 | 224 | |
|
225 | 225 | void socexplorerproxy::disconnectChildToProxy(socexplorerplugin *child) |
|
226 | 226 | { |
|
227 | 227 | if(!_self)init(); |
|
228 | 228 | disconnect(child,SIGNAL(registerObject(QObject*,QString)),_self,SIGNAL(registerObject(QObject*,QString))); |
|
229 | 229 | disconnect(child,SIGNAL(closePlugin(socexplorerplugin*)),_self,SLOT(closeSysDriverFromDriver(socexplorerplugin*))); |
|
230 | 230 | } |
|
231 | 231 | |
|
232 | 232 | QString socexplorerproxy::getinstanceName(const QString& baseName) |
|
233 | 233 | { |
|
234 | 234 | if(!_self)init(); |
|
235 | 235 | int i=0; |
|
236 | 236 | QString name; |
|
237 | 237 | bool validName = false; |
|
238 | 238 | while(!validName) |
|
239 | 239 | { |
|
240 | 240 | name.clear(); |
|
241 | 241 | name.append(baseName+QString::number(i)); |
|
242 | 242 | validName = instanceNameIsValid(name); |
|
243 | 243 | i++; |
|
244 | 244 | } |
|
245 | 245 | return name; |
|
246 | 246 | } |
|
247 | 247 | |
|
248 | 248 | void socexplorerproxy::changeSysDriverInstName(socexplorerplugin* driver) |
|
249 | 249 | { |
|
250 | 250 | if(!_self)init(); |
|
251 | 251 | QString prevName(driver->instanceName()); |
|
252 | 252 | } |
|
253 | 253 | |
|
254 | 254 | bool socexplorerproxy::instanceNameIsValid(const QString& instanceName) |
|
255 | 255 | { |
|
256 | 256 | if(!_self)init(); |
|
257 | 257 | for(int k=0;k<linearDriverList->count();k++) |
|
258 | 258 | { |
|
259 | 259 | if(!linearDriverList->at(k)->instanceName().compare(instanceName)) |
|
260 | 260 | return false; |
|
261 | 261 | } |
|
262 | 262 | return true; |
|
263 | 263 | } |
|
264 | 264 | |
|
265 | 265 | socexplorerplugin *socexplorerproxy::findPlugin(const QString &instanceName) |
|
266 | 266 | { |
|
267 | 267 | if(!_self)init(); |
|
268 | 268 | for(int k=0;k<linearDriverList->count();k++) |
|
269 | 269 | { |
|
270 | 270 | if(linearDriverList->at(k)->instanceName().compare(instanceName)) |
|
271 | 271 | return linearDriverList->at(k); |
|
272 | 272 | } |
|
273 | 273 | return NULL; |
|
274 | 274 | } |
|
275 | 275 | |
|
276 | 276 | bool socexplorerproxy::instanceExists(const QString &instanceName) |
|
277 | 277 | { |
|
278 | 278 | return !socexplorerproxy::instanceNameIsValid(instanceName); |
|
279 | 279 | } |
|
280 | 280 | |
|
281 | 281 | void socexplorerproxy::close() |
|
282 | 282 | { |
|
283 | 283 | if(!_self)init(); |
|
284 | 284 | socexplorerplugin* tmpPtr; |
|
285 | 285 | while(drivers->count()>0) |
|
286 | 286 | { |
|
287 | 287 | tmpPtr = drivers->last(); |
|
288 | 288 | drivers->removeLast(); |
|
289 | 289 | _self->closeSysDriver(tmpPtr); |
|
290 | 290 | } |
|
291 | 291 | if(root!=NULL) |
|
292 | 292 | { |
|
293 | 293 | _self->closeSysDriver(root); |
|
294 | 294 | } |
|
295 | 295 | |
|
296 | 296 | } |
|
297 | 297 | |
|
298 | 298 | socexplorerplugin* socexplorerproxy::getSysDriver(const QString instanceName) |
|
299 | 299 | { |
|
300 | 300 | if(!_self)init(); |
|
301 | 301 | for(int i=0;i<linearDriverList->count();i++) |
|
302 | 302 | { |
|
303 | 303 | if(!linearDriverList->at(i)->instanceName().compare(instanceName)) |
|
304 | 304 | return linearDriverList->at(i); |
|
305 | 305 | } |
|
306 | 306 | return NULL; |
|
307 | 307 | } |
|
308 | 308 | |
|
309 | 309 | |
|
310 | 310 | void socexplorerproxy::closeSysDriver(const QString instanceName) |
|
311 | 311 | { |
|
312 | 312 | if(!_self)init(); |
|
313 | 313 | closeSysDriver(getSysDriver(instanceName),false); |
|
314 | 314 | } |
|
315 | 315 | |
|
316 | 316 | void socexplorerproxy::closeSysDriver(socexplorerplugin *driver, bool recursive) |
|
317 | 317 | { |
|
318 | 318 | if(!_self)init(); |
|
319 | 319 | if(driver!=NULL) |
|
320 | 320 | { |
|
321 | 321 | emit _self->removePluginGUI(driver); |
|
322 | 322 | if(driver->parent==NULL)SocExplorerEngine::removeSOC(driver); |
|
323 | 323 | while(driver->childs.count()!=0)closeSysDriver(driver->childs.first()); |
|
324 | 324 | linearDriverList->removeOne(driver); |
|
325 | 325 | if(driver->parent!= NULL) |
|
326 | 326 | { |
|
327 | 327 | driver->parent->childs.removeOne(driver); //Have parent so it's a child |
|
328 | 328 | disconnectChildToParent(driver); |
|
329 | 329 | disconnectChildToProxy(driver); |
|
330 | 330 | delete driver; |
|
331 | 331 | } |
|
332 | 332 | else |
|
333 | 333 | { |
|
334 | 334 | drivers->removeOne(driver); |
|
335 | 335 | disconnectChildToProxy(driver); |
|
336 | 336 | delete driver; |
|
337 | 337 | } |
|
338 | 338 | if(!recursive) |
|
339 | 339 | { |
|
340 | 340 | emit _self->clearMenu(); |
|
341 | 341 | emit _self->registermenu(mainWindow); |
|
342 | 342 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
343 | 343 | } |
|
344 | 344 | } |
|
345 | 345 | |
|
346 | 346 | } |
|
347 | 347 | |
|
348 | 348 | void socexplorerproxy::geteplugintree() |
|
349 | 349 | { |
|
350 | 350 | if(!_self)init(); |
|
351 | 351 | emit _self->treeChanged(QList<socexplorerplugin*>(*drivers)); |
|
352 | 352 | } |
|
353 | 353 | |
|
354 | 354 | void socexplorerproxy::closeSysDriverFromDriver(socexplorerplugin *driver) |
|
355 | 355 | { |
|
356 | 356 | if(!_self)init(); |
|
357 | 357 | emit _self->closeSysDriverSig(driver); |
|
358 | 358 | } |
|
359 | 359 | |
|
360 | 360 | void socexplorerproxy::updateText() |
|
361 | 361 | { |
|
362 | 362 | if(!_self)init(); |
|
363 | 363 | emit _self->clearMenu(); |
|
364 | 364 | emit _self->registermenu(mainWindow); |
|
365 | 365 | } |
|
366 | 366 | |
|
367 | 367 | |
|
368 | 368 | |
|
369 | 369 | |
|
370 | 370 | |
|
371 | 371 | void socexplorerproxy::makeMenu(QMenu* menu) |
|
372 | 372 | { |
|
373 | 373 | if(!_self)init(); |
|
374 | 374 | for(int i=0;i<drivers->count();i++) |
|
375 | 375 | { |
|
376 | 376 | drivers->at(i)->registermenu(menu); |
|
377 | 377 | } |
|
378 | 378 | } |
|
379 | 379 | |
|
380 | 380 |
@@ -1,103 +1,103 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef SOCEXPLORERPROXY_H |
|
23 | 23 | #define SOCEXPLORERPROXY_H |
|
24 | 24 | |
|
25 | 25 | #include <QObject> |
|
26 | 26 | #include <QString> |
|
27 | 27 | #include <QList> |
|
28 | 28 | #include "pluginscache.h" |
|
29 | 29 | #include <socexplorerplugin.h> |
|
30 | 30 | #include <socexplorerplugininterface.h> |
|
31 | 31 | #include <QInputDialog> |
|
32 | 32 | #include <QtGlobal> |
|
33 | 33 | |
|
34 | 34 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
35 | 35 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
36 | 36 | #else |
|
37 | 37 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_IMPORT |
|
38 | 38 | #endif |
|
39 | 39 | |
|
40 | 40 | class SOCEXPLORER_SDK_EXPORT socexplorerproxy : public QObject |
|
41 | 41 | { |
|
42 | 42 | Q_OBJECT |
|
43 | 43 | private: |
|
44 | 44 | socexplorerproxy(QObject *parent = 0); |
|
45 | 45 | socexplorerproxy(QMainWindow* Mainwindow,QObject *parent = 0); |
|
46 | 46 | static socexplorerproxy* _self; |
|
47 | 47 | public: |
|
48 | 48 | static socexplorerproxy* self(){if(!_self)init(); return _self;} |
|
49 | 49 | static void init(); |
|
50 | 50 | static void setMainWindow(QMainWindow* Mainwindow); |
|
51 | 51 | static void connectChildToParent(socexplorerplugin* parent, socexplorerplugin* child); |
|
52 | 52 | static void connectChildToProxy(socexplorerplugin* child); |
|
53 | 53 | static void disconnectChildToParent(socexplorerplugin* child); |
|
54 | 54 | static void disconnectChildToProxy(socexplorerplugin* child); |
|
55 | 55 | static bool instanceNameIsValid(const QString& instanceName); |
|
56 | 56 | static socexplorerplugin* findPlugin(const QString &instanceName); |
|
57 | 57 | |
|
58 | 58 | QT_ENSURE_STACK_ALIGNED_FOR_SSE static void loadChildSysDriver(socexplorerplugin* parent,const QString child); |
|
59 | 59 | |
|
60 | 60 | signals: |
|
61 | 61 | void addPluginGUI(QDockWidget* plugin); |
|
62 | 62 | void removePluginGUI(QDockWidget* plugin); |
|
63 | 63 | int registermenu(QMainWindow* menuHolder); |
|
64 | 64 | void clearMenu(); |
|
65 | 65 | QStringList findDrivers(int VID,int PID); |
|
66 | 66 | void rootDriverAdded(socexplorerplugin* driver); |
|
67 | 67 | void rootDriverRemoved(); |
|
68 | 68 | void closeSysDriverSig(socexplorerplugin* driver); |
|
69 | 69 | void registerObject(QObject* object,const QString& instanceName); |
|
70 | 70 | void treeChanged(const QList<socexplorerplugin*>& drivers); |
|
71 | 71 | |
|
72 | 72 | public slots: |
|
73 | 73 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name); |
|
74 | 74 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name,const QString instanceName); |
|
75 | 75 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(socexplorerplugin* driver,const QString instanceName); |
|
76 | 76 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString ParentInst); |
|
77 | 77 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString instanceName,const QString ParentInst); |
|
78 | 78 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName); |
|
79 | 79 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString instanceName); |
|
80 | 80 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
81 | 81 | // QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadChild(socexplorerplugin* parent); |
|
82 | 82 | void updateText(); |
|
83 | 83 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void closeSysDriverFromDriver(socexplorerplugin* driver); |
|
84 | 84 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void closeSysDriver(socexplorerplugin* driver,bool recursive=false); |
|
85 | 85 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void closeSysDriver(const QString instanceName); |
|
86 | 86 | void makeMenu(QMenu* menu); |
|
87 | 87 | void close(); |
|
88 | 88 | QString getinstanceName(const QString& baseName); |
|
89 | 89 | void geteplugintree(); |
|
90 | 90 | QT_ENSURE_STACK_ALIGNED_FOR_SSE socexplorerplugin* getSysDriver(const QString instanceName); |
|
91 | 91 | bool instanceExists(const QString& instanceName); |
|
92 | 92 | private: |
|
93 | 93 | |
|
94 | 94 | static void changeSysDriverInstName(socexplorerplugin* driver); |
|
95 | 95 | static QMainWindow* mainWindow; |
|
96 | 96 | static QList<socexplorerplugin*>* drivers; |
|
97 | 97 | static QList<socexplorerplugin*>* linearDriverList; |
|
98 | 98 | static socexplorerplugin* root; |
|
99 | 99 | static socexplorerplugin* parent; |
|
100 | 100 | static PluginsCache* cache; |
|
101 | 101 | }; |
|
102 | 102 | |
|
103 | 103 | #endif // SOCEXPLORERPROXY_H |
@@ -1,49 +1,49 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "aboutsocexplorer.h" |
|
23 | 23 | |
|
24 | 24 | #include <socexplorerengine.h> |
|
25 | 25 | |
|
26 | 26 | aboutsocexplorer::aboutsocexplorer(QWidget *parent) : |
|
27 | 27 | QTextBrowser(parent) |
|
28 | 28 | { |
|
29 | 29 | this->setReadOnly(true); |
|
30 | 30 | QString code; |
|
31 | 31 | QFile file; |
|
32 | 32 | code.clear(); |
|
33 | 33 | file.setFileName(":/about/about.html"); |
|
34 | 34 | this->setAcceptRichText(true); |
|
35 | 35 | file.open(QIODevice::ReadOnly); |
|
36 | 36 | QTextStream filestrm(&file); |
|
37 | 37 | while(!filestrm.atEnd())code.append(filestrm.readLine().replace("$VERSION$",SocExplorerEngine::SocExplorerVersion()).replace("$Branch$",SocExplorerEngine::SocExplorerBranch()).replace("$Changeset$",SocExplorerEngine::SocExplorerChangeset())+"\n"); |
|
38 | 38 | this->setHtml(code); |
|
39 | 39 | file.close(); |
|
40 | 40 | this->setMinimumSize(400,400); |
|
41 | 41 | connect(this,SIGNAL(anchorClicked(QUrl)),this,SLOT(anchorClicked_slt(QUrl))); |
|
42 | 42 | this->setOpenLinks(false); |
|
43 | 43 | } |
|
44 | 44 | |
|
45 | 45 | |
|
46 | 46 | void aboutsocexplorer::anchorClicked_slt(const QUrl & url) |
|
47 | 47 | { |
|
48 | 48 | QDesktopServices::openUrl(url); |
|
49 | 49 | } |
@@ -1,46 +1,46 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef ABOUTSOCEXPLORER_H |
|
23 | 23 | #define ABOUTSOCEXPLORER_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | 26 | #include <QTextBrowser> |
|
27 | 27 | #include <QFile> |
|
28 | 28 | #include <QTextStream> |
|
29 | 29 | #include <QDesktopServices> |
|
30 | 30 | #include <QUrl> |
|
31 | 31 | |
|
32 | 32 | class aboutsocexplorer : public QTextBrowser |
|
33 | 33 | { |
|
34 | 34 | Q_OBJECT |
|
35 | 35 | public: |
|
36 | 36 | explicit aboutsocexplorer(QWidget *parent = 0); |
|
37 | 37 | |
|
38 | 38 | signals: |
|
39 | 39 | |
|
40 | 40 | public slots: |
|
41 | 41 | void anchorClicked_slt(const QUrl &); |
|
42 | 42 | private: |
|
43 | 43 | |
|
44 | 44 | }; |
|
45 | 45 | |
|
46 | 46 | #endif // ABOUTSOCEXPLORER_H |
@@ -1,63 +1,63 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "abstractexecfile.h" |
|
23 | 23 | |
|
24 | 24 | abstractExecFile::abstractExecFile(QObject *parent) : |
|
25 | 25 | QObject(parent) |
|
26 | 26 | { |
|
27 | 27 | } |
|
28 | 28 | |
|
29 | 29 | abstractExecFile::abstractExecFile(const QString &File, QObject *parent) |
|
30 | 30 | { |
|
31 | 31 | |
|
32 | 32 | } |
|
33 | 33 | |
|
34 | 34 | bool abstractExecFile::openFile(const QString &File) |
|
35 | 35 | { |
|
36 | 36 | |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | bool abstractExecFile::isopened() |
|
40 | 40 | { |
|
41 | 41 | |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | int abstractExecFile::setFilename(const QString &name) |
|
45 | 45 | { |
|
46 | 46 | |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | int abstractExecFile::closeFile() |
|
50 | 50 | { |
|
51 | 51 | |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | QList<codeFragment> abstractExecFile::getFragments() |
|
55 | 55 | { |
|
56 | 56 | |
|
57 | 57 | } |
|
58 | 58 | |
|
59 | 59 | |
|
60 | 60 | codeFragment::codeFragment() |
|
61 | 61 | { |
|
62 | 62 | |
|
63 | 63 | } |
@@ -1,53 +1,53 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef ABSTRACTEXECFILE_H |
|
23 | 23 | #define ABSTRACTEXECFILE_H |
|
24 | 24 | |
|
25 | 25 | #include <QObject> |
|
26 | 26 | |
|
27 | 27 | class codeFragment |
|
28 | 28 | { |
|
29 | 29 | public: |
|
30 | 30 | codeFragment(); |
|
31 | 31 | char* data; |
|
32 | 32 | quint32 size; |
|
33 | 33 | quint32 address; |
|
34 | 34 | }; |
|
35 | 35 | |
|
36 | 36 | class abstractExecFile : public QObject |
|
37 | 37 | { |
|
38 | 38 | Q_OBJECT |
|
39 | 39 | public: |
|
40 | 40 | abstractExecFile(QObject *parent = 0); |
|
41 | 41 | abstractExecFile(const QString& File,QObject *parent = 0); |
|
42 | 42 | virtual bool openFile(const QString& File); |
|
43 | 43 | virtual bool isopened(); |
|
44 | 44 | virtual int setFilename(const QString& name); |
|
45 | 45 | virtual int closeFile(); |
|
46 | 46 | virtual QList<codeFragment> getFragments(); |
|
47 | 47 | signals: |
|
48 | 48 | |
|
49 | 49 | public slots: |
|
50 | 50 | |
|
51 | 51 | }; |
|
52 | 52 | |
|
53 | 53 | #endif // ABSTRACTEXECFILE_H |
@@ -1,32 +1,32 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "elffile.h" |
|
23 | 23 | |
|
24 | 24 | ElfFile::ElfFile(QObject *parent) : |
|
25 | 25 | abstractExecFile(parent) |
|
26 | 26 | { |
|
27 | 27 | } |
|
28 | 28 | |
|
29 | 29 | ElfFile::ElfFile(const QString &File, QObject *parent) |
|
30 | 30 | { |
|
31 | 31 | |
|
32 | 32 | } |
@@ -1,39 +1,39 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include <abstractexecfile.h> |
|
23 | 23 | #ifndef ELFFILE_H |
|
24 | 24 | #define ELFFILE_H |
|
25 | 25 | |
|
26 | 26 | class ElfFile : public abstractExecFile |
|
27 | 27 | { |
|
28 | 28 | Q_OBJECT |
|
29 | 29 | public: |
|
30 | 30 | ElfFile(QObject *parent = 0); |
|
31 | 31 | ElfFile(const QString& File,QObject *parent = 0); |
|
32 | 32 | |
|
33 | 33 | signals: |
|
34 | 34 | |
|
35 | 35 | public slots: |
|
36 | 36 | |
|
37 | 37 | }; |
|
38 | 38 | |
|
39 | 39 | #endif // ELFFILE_H |
@@ -1,164 +1,164 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | |
|
23 | 23 | #include "elfinfowdgt.h" |
|
24 | 24 | |
|
25 | 25 | elfInfoWdgt::elfInfoWdgt(QWidget *parent) : |
|
26 | 26 | QWidget(parent) |
|
27 | 27 | { |
|
28 | 28 | this->mainLayout = new QVBoxLayout; |
|
29 | 29 | this->ElfArchitecture= new QLabel; |
|
30 | 30 | this->ElfType = new QLabel; |
|
31 | 31 | this->ElfVersion = new QLabel; |
|
32 | 32 | this->splitter = new QSplitter; |
|
33 | 33 | this->hexViewer = new QHexEdit; |
|
34 | 34 | this->elfInfoWdgtLay = new QWidget; |
|
35 | 35 | this->elfInfoWdgtLayout = new QVBoxLayout; |
|
36 | 36 | this->segmentsListTableWdgt = new QTableWidget; |
|
37 | 37 | this->segmentsListTableWdgt->setColumnCount(7); |
|
38 | 38 | this->segmentsListTableWdgt->setHorizontalHeaderLabels(QStringList()<<"Type"<<"Offset"<<"Vaddr"<<"Paddr"<<"File Size"<<"Mem Size"<<"Flags"); |
|
39 | 39 | this->sectionsListTableWdgt = new QTableWidget; |
|
40 | 40 | this->sectionsListTableWdgt->setColumnCount(2); |
|
41 | 41 | this->sectionsListTableWdgt->setHorizontalHeaderLabels(QStringList()<<"Name"<<"Type"); |
|
42 | 42 | this->ElfArchitecture->setText(QString("Architecture: ")); |
|
43 | 43 | this->ElfType->setText(QString("Type: ")); |
|
44 | 44 | this->ElfVersion->setText(QString("Version: ")); |
|
45 | 45 | this->elfInfoWdgtLayout->addWidget(this->ElfArchitecture); |
|
46 | 46 | this->elfInfoWdgtLayout->addWidget(this->ElfType); |
|
47 | 47 | this->elfInfoWdgtLayout->addWidget(this->ElfVersion); |
|
48 | 48 | this->elfInfoWdgtLayout->addWidget(this->segmentsListTableWdgt); |
|
49 | 49 | this->elfInfoWdgtLayout->addWidget(this->sectionsListTableWdgt); |
|
50 | 50 | this->splitter->addWidget(this->hexViewer); |
|
51 | 51 | this->splitter->addWidget(this->elfInfoWdgtLay); |
|
52 | 52 | this->elfInfoWdgtLay->setLayout(this->elfInfoWdgtLayout); |
|
53 | 53 | this->mainLayout->addWidget(this->splitter); |
|
54 | 54 | this->setLayout(this->mainLayout); |
|
55 | 55 | connect(this->segmentsListTableWdgt,SIGNAL(cellActivated(int,int)),this,SLOT(cellActivated(int,int))); |
|
56 | 56 | connect(this->sectionsListTableWdgt,SIGNAL(cellActivated(int,int)),this,SLOT(cellActivated(int,int))); |
|
57 | 57 | } |
|
58 | 58 | |
|
59 | 59 | |
|
60 | 60 | void elfInfoWdgt::updateInfo(elfparser *parser) |
|
61 | 61 | { |
|
62 | 62 | if(parser!=NULL) |
|
63 | 63 | { |
|
64 | 64 | this->ElfArchitecture->setText(QString("Architecture: ")+parser->getArchitecture()); |
|
65 | 65 | this->ElfType->setText(QString("Type: ")+parser->getType()); |
|
66 | 66 | this->ElfVersion->setText(QString("Version: 0x")+QString::number(parser->getVersion(),16)); |
|
67 | 67 | this->updateSectionsTable(parser); |
|
68 | 68 | this->updateSegmentsTable(parser); |
|
69 | 69 | } |
|
70 | 70 | |
|
71 | 71 | } |
|
72 | 72 | |
|
73 | 73 | void elfInfoWdgt::cellActivated(int row, int column) |
|
74 | 74 | { |
|
75 | 75 | char* buff=NULL; |
|
76 | 76 | this->parser->getSectionData(row,&buff); |
|
77 | 77 | this->hexViewer->setData(QByteArray(buff,this->parser->getSectionDatasz(row))); |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | |
|
81 | 81 | void elfInfoWdgt::updateSectionsTable(elfparser* parser) |
|
82 | 82 | { |
|
83 | 83 | if(parser!=NULL) |
|
84 | 84 | { |
|
85 | 85 | this->parser = parser; |
|
86 | 86 | QTableWidgetItem *item; |
|
87 | 87 | for(int i=0 ;i<this->sectionsListTableWdgt->rowCount();i++) |
|
88 | 88 | { |
|
89 | 89 | for(int l=0;l<this->sectionsListTableWdgt->columnCount();l++) |
|
90 | 90 | { |
|
91 | 91 | item = this->sectionsListTableWdgt->item(i,l); |
|
92 | 92 | delete item; |
|
93 | 93 | } |
|
94 | 94 | } |
|
95 | 95 | this->sectionsListTableWdgt->setRowCount(parser->getSectioncount()); |
|
96 | 96 | for(int i=0;i<parser->getSectioncount();i++) |
|
97 | 97 | { |
|
98 | 98 | item = new QTableWidgetItem(parser->getSectionName(i)); |
|
99 | 99 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
100 | 100 | this->sectionsListTableWdgt->setItem(i,0,item); |
|
101 | 101 | item = new QTableWidgetItem(parser->getSectionType(i)); |
|
102 | 102 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
103 | 103 | this->sectionsListTableWdgt->setItem(i,1,item); |
|
104 | 104 | } |
|
105 | 105 | this->sectionsListTableWdgt->resizeColumnsToContents(); |
|
106 | 106 | this->sectionsListTableWdgt->resizeRowsToContents(); |
|
107 | 107 | } |
|
108 | 108 | } |
|
109 | 109 | |
|
110 | 110 | |
|
111 | 111 | void elfInfoWdgt::updateSegmentsTable(elfparser* parser) |
|
112 | 112 | { |
|
113 | 113 | if(parser!=NULL) |
|
114 | 114 | { |
|
115 | 115 | this->parser = parser; |
|
116 | 116 | QTableWidgetItem *item; |
|
117 | 117 | for(int i=0 ;i<this->segmentsListTableWdgt->rowCount();i++) |
|
118 | 118 | { |
|
119 | 119 | for(int l=0;l<this->segmentsListTableWdgt->columnCount();l++) |
|
120 | 120 | { |
|
121 | 121 | item = this->segmentsListTableWdgt->item(i,l); |
|
122 | 122 | delete item; |
|
123 | 123 | } |
|
124 | 124 | } |
|
125 | 125 | this->segmentsListTableWdgt->setRowCount(parser->getSegmentcount()); |
|
126 | 126 | for(int i=0;i<parser->getSegmentcount();i++) |
|
127 | 127 | { |
|
128 | 128 | item = new QTableWidgetItem(parser->getSegmentType(i)); |
|
129 | 129 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
130 | 130 | this->segmentsListTableWdgt->setItem(i,0,item); |
|
131 | 131 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentOffset(i),16)); |
|
132 | 132 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
133 | 133 | this->segmentsListTableWdgt->setItem(i,1,item); |
|
134 | 134 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentVaddr(i),16)); |
|
135 | 135 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
136 | 136 | this->segmentsListTableWdgt->setItem(i,2,item); |
|
137 | 137 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentPaddr(i),16)); |
|
138 | 138 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
139 | 139 | this->segmentsListTableWdgt->setItem(i,3,item); |
|
140 | 140 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentFilesz(i),16)); |
|
141 | 141 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
142 | 142 | this->segmentsListTableWdgt->setItem(i,4,item); |
|
143 | 143 | item = new QTableWidgetItem("0x"+QString::number(parser->getSegmentMemsz(i),16)); |
|
144 | 144 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
145 | 145 | this->segmentsListTableWdgt->setItem(i,5,item); |
|
146 | 146 | item = new QTableWidgetItem(parser->getSegmentFlags(i)); |
|
147 | 147 | item->setFlags(item->flags() &~ Qt::ItemIsEditable); |
|
148 | 148 | this->segmentsListTableWdgt->setItem(i,6,item); |
|
149 | 149 | } |
|
150 | 150 | this->segmentsListTableWdgt->resizeColumnsToContents(); |
|
151 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef ELFINFOWDGT_H |
|
23 | 23 | #define ELFINFOWDGT_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | 26 | #include "elfparser.h" |
|
27 | 27 | #include <QVBoxLayout> |
|
28 | 28 | #include <QHBoxLayout> |
|
29 | 29 | #include <QLabel> |
|
30 | 30 | #include <QTextEdit> |
|
31 | 31 | #include <QTableWidget> |
|
32 | 32 | #include <qhexedit.h> |
|
33 | 33 | #include <QSplitter> |
|
34 | 34 | |
|
35 | 35 | class elfInfoWdgt : public QWidget |
|
36 | 36 | { |
|
37 | 37 | Q_OBJECT |
|
38 | 38 | public: |
|
39 | 39 | explicit elfInfoWdgt(QWidget *parent = 0); |
|
40 | 40 | |
|
41 | 41 | signals: |
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | public slots: |
|
45 | 45 | void updateInfo(elfparser* parser); |
|
46 | 46 | void cellActivated ( int row, int column ); |
|
47 | 47 | |
|
48 | 48 | private: |
|
49 | 49 | void updateSectionsTable(elfparser* parser); |
|
50 | 50 | void updateSegmentsTable(elfparser* parser); |
|
51 | 51 | QVBoxLayout* mainLayout; |
|
52 | 52 | QLabel* ElfArchitecture; |
|
53 | 53 | QLabel* ElfType; |
|
54 | 54 | QLabel* ElfVersion; |
|
55 | 55 | QTableWidget* segmentsListTableWdgt,*sectionsListTableWdgt; |
|
56 | 56 | QHexEdit* hexViewer; |
|
57 | 57 | QSplitter* splitter; |
|
58 | 58 | QWidget* elfInfoWdgtLay; |
|
59 | 59 | QVBoxLayout* elfInfoWdgtLayout; |
|
60 | 60 | elfparser* parser; |
|
61 | 61 | |
|
62 | 62 | }; |
|
63 | 63 | |
|
64 | 64 | #endif // ELFINFOWDGT_H |
@@ -1,701 +1,701 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "elfparser.h" |
|
23 | 23 | #include <sys/types.h> |
|
24 | 24 | #include <sys/stat.h> |
|
25 | 25 | #include <fcntl.h> |
|
26 | 26 | #include <unistd.h> |
|
27 | 27 | |
|
28 | 28 | void elfresolveMachine(Elf64_Half e_machine,char* MachineName) |
|
29 | 29 | { |
|
30 | 30 | |
|
31 | 31 | //Update from with bash script don't write it by yourself! |
|
32 | 32 | switch(e_machine) |
|
33 | 33 | { |
|
34 | 34 | case EM_NONE : |
|
35 | 35 | strcpy(MachineName,"No machine"); |
|
36 | 36 | break; |
|
37 | 37 | case EM_M32 : |
|
38 | 38 | strcpy(MachineName,"AT&T WE 32100"); |
|
39 | 39 | break; |
|
40 | 40 | case EM_SPARC : |
|
41 | 41 | strcpy(MachineName,"SUN SPARC"); |
|
42 | 42 | break; |
|
43 | 43 | case EM_386 : |
|
44 | 44 | strcpy(MachineName,"Intel 80386"); |
|
45 | 45 | break; |
|
46 | 46 | case EM_68K : |
|
47 | 47 | strcpy(MachineName,"Motorola m68k family"); |
|
48 | 48 | break; |
|
49 | 49 | case EM_88K : |
|
50 | 50 | strcpy(MachineName,"Motorola m88k family"); |
|
51 | 51 | break; |
|
52 | 52 | case EM_860 : |
|
53 | 53 | strcpy(MachineName,"Intel 80860"); |
|
54 | 54 | break; |
|
55 | 55 | case EM_MIPS : |
|
56 | 56 | strcpy(MachineName,"MIPS R3000 big-endian"); |
|
57 | 57 | break; |
|
58 | 58 | case EM_S370 : |
|
59 | 59 | strcpy(MachineName,"IBM System\/370"); |
|
60 | 60 | break; |
|
61 | 61 | case EM_MIPS_RS3_LE : |
|
62 | 62 | strcpy(MachineName,"MIPS R3000 little-endian"); |
|
63 | 63 | break; |
|
64 | 64 | case EM_PARISC : |
|
65 | 65 | strcpy(MachineName,"HPPA"); |
|
66 | 66 | break; |
|
67 | 67 | case EM_VPP500 : |
|
68 | 68 | strcpy(MachineName,"Fujitsu VPP500"); |
|
69 | 69 | break; |
|
70 | 70 | case EM_SPARC32PLUS : |
|
71 | 71 | strcpy(MachineName,"Sun's \"v8plus\""); |
|
72 | 72 | break; |
|
73 | 73 | case EM_960 : |
|
74 | 74 | strcpy(MachineName,"Intel 80960"); |
|
75 | 75 | break; |
|
76 | 76 | case EM_PPC : |
|
77 | 77 | strcpy(MachineName,"PowerPC"); |
|
78 | 78 | break; |
|
79 | 79 | case EM_PPC64 : |
|
80 | 80 | strcpy(MachineName,"PowerPC 64-bit"); |
|
81 | 81 | break; |
|
82 | 82 | case EM_S390 : |
|
83 | 83 | strcpy(MachineName,"IBM S390"); |
|
84 | 84 | break; |
|
85 | 85 | case EM_V800 : |
|
86 | 86 | strcpy(MachineName,"NEC V800 series"); |
|
87 | 87 | break; |
|
88 | 88 | case EM_FR20 : |
|
89 | 89 | strcpy(MachineName,"Fujitsu FR20"); |
|
90 | 90 | break; |
|
91 | 91 | case EM_RH32 : |
|
92 | 92 | strcpy(MachineName,"TRW RH-32"); |
|
93 | 93 | break; |
|
94 | 94 | case EM_RCE : |
|
95 | 95 | strcpy(MachineName,"Motorola RCE"); |
|
96 | 96 | break; |
|
97 | 97 | case EM_ARM : |
|
98 | 98 | strcpy(MachineName,"ARM"); |
|
99 | 99 | break; |
|
100 | 100 | case EM_SH : |
|
101 | 101 | strcpy(MachineName,"Hitachi SH"); |
|
102 | 102 | break; |
|
103 | 103 | case EM_SPARCV9 : |
|
104 | 104 | strcpy(MachineName,"SPARC v9 64-bit"); |
|
105 | 105 | break; |
|
106 | 106 | case EM_TRICORE : |
|
107 | 107 | strcpy(MachineName,"Siemens Tricore"); |
|
108 | 108 | break; |
|
109 | 109 | case EM_ARC : |
|
110 | 110 | strcpy(MachineName,"Argonaut RISC Core"); |
|
111 | 111 | break; |
|
112 | 112 | case EM_H8_300 : |
|
113 | 113 | strcpy(MachineName,"Hitachi H8\/300"); |
|
114 | 114 | break; |
|
115 | 115 | case EM_H8_300H : |
|
116 | 116 | strcpy(MachineName,"Hitachi H8\/300H"); |
|
117 | 117 | break; |
|
118 | 118 | case EM_H8S : |
|
119 | 119 | strcpy(MachineName,"Hitachi H8S"); |
|
120 | 120 | break; |
|
121 | 121 | case EM_H8_500 : |
|
122 | 122 | strcpy(MachineName,"Hitachi H8\/500"); |
|
123 | 123 | break; |
|
124 | 124 | case EM_IA_64 : |
|
125 | 125 | strcpy(MachineName,"Intel Merced"); |
|
126 | 126 | break; |
|
127 | 127 | case EM_MIPS_X : |
|
128 | 128 | strcpy(MachineName,"Stanford MIPS-X"); |
|
129 | 129 | break; |
|
130 | 130 | case EM_COLDFIRE : |
|
131 | 131 | strcpy(MachineName,"Motorola Coldfire"); |
|
132 | 132 | break; |
|
133 | 133 | case EM_68HC12 : |
|
134 | 134 | strcpy(MachineName,"Motorola M68HC12"); |
|
135 | 135 | break; |
|
136 | 136 | case EM_MMA : |
|
137 | 137 | strcpy(MachineName,"Fujitsu MMA Multimedia Accelerator"); |
|
138 | 138 | break; |
|
139 | 139 | case EM_PCP : |
|
140 | 140 | strcpy(MachineName,"Siemens PCP"); |
|
141 | 141 | break; |
|
142 | 142 | case EM_NCPU : |
|
143 | 143 | strcpy(MachineName,"Sony nCPU embeeded RISC"); |
|
144 | 144 | break; |
|
145 | 145 | case EM_NDR1 : |
|
146 | 146 | strcpy(MachineName,"Denso NDR1 microprocessor"); |
|
147 | 147 | break; |
|
148 | 148 | case EM_STARCORE : |
|
149 | 149 | strcpy(MachineName,"Motorola Start*Core processor"); |
|
150 | 150 | break; |
|
151 | 151 | case EM_ME16 : |
|
152 | 152 | strcpy(MachineName,"Toyota ME16 processor"); |
|
153 | 153 | break; |
|
154 | 154 | case EM_ST100 : |
|
155 | 155 | strcpy(MachineName,"STMicroelectronic ST100 processor"); |
|
156 | 156 | break; |
|
157 | 157 | case EM_TINYJ : |
|
158 | 158 | strcpy(MachineName,"Advanced Logic Corp. Tinyj emb.fam"); |
|
159 | 159 | break; |
|
160 | 160 | case EM_X86_64 : |
|
161 | 161 | strcpy(MachineName,"AMD x86-64 architecture"); |
|
162 | 162 | break; |
|
163 | 163 | case EM_PDSP : |
|
164 | 164 | strcpy(MachineName,"Sony DSP Processor"); |
|
165 | 165 | break; |
|
166 | 166 | case EM_FX66 : |
|
167 | 167 | strcpy(MachineName,"Siemens FX66 microcontroller"); |
|
168 | 168 | break; |
|
169 | 169 | case EM_ST9PLUS : |
|
170 | 170 | strcpy(MachineName,"STMicroelectronics ST9+ 8\/16 mc"); |
|
171 | 171 | break; |
|
172 | 172 | case EM_ST7 : |
|
173 | 173 | strcpy(MachineName,"STmicroelectronics ST7 8 bit mc"); |
|
174 | 174 | break; |
|
175 | 175 | case EM_68HC16 : |
|
176 | 176 | strcpy(MachineName,"Motorola MC68HC16 microcontroller"); |
|
177 | 177 | break; |
|
178 | 178 | case EM_68HC11 : |
|
179 | 179 | strcpy(MachineName,"Motorola MC68HC11 microcontroller"); |
|
180 | 180 | break; |
|
181 | 181 | case EM_68HC08 : |
|
182 | 182 | strcpy(MachineName,"Motorola MC68HC08 microcontroller"); |
|
183 | 183 | break; |
|
184 | 184 | case EM_68HC05 : |
|
185 | 185 | strcpy(MachineName,"Motorola MC68HC05 microcontroller"); |
|
186 | 186 | break; |
|
187 | 187 | case EM_SVX : |
|
188 | 188 | strcpy(MachineName,"Silicon Graphics SVx"); |
|
189 | 189 | break; |
|
190 | 190 | case EM_ST19 : |
|
191 | 191 | strcpy(MachineName,"STMicroelectronics ST19 8 bit mc"); |
|
192 | 192 | break; |
|
193 | 193 | case EM_VAX : |
|
194 | 194 | strcpy(MachineName,"Digital VAX"); |
|
195 | 195 | break; |
|
196 | 196 | case EM_CRIS : |
|
197 | 197 | strcpy(MachineName,"Axis Communications 32-bit embedded processor"); |
|
198 | 198 | break; |
|
199 | 199 | case EM_JAVELIN : |
|
200 | 200 | strcpy(MachineName,"Infineon Technologies 32-bit embedded processor"); |
|
201 | 201 | break; |
|
202 | 202 | case EM_FIREPATH : |
|
203 | 203 | strcpy(MachineName,"Element 14 64-bit DSP Processor"); |
|
204 | 204 | break; |
|
205 | 205 | case EM_ZSP : |
|
206 | 206 | strcpy(MachineName,"LSI Logic 16-bit DSP Processor"); |
|
207 | 207 | break; |
|
208 | 208 | case EM_MMIX : |
|
209 | 209 | strcpy(MachineName,"Donald Knuth's educational 64-bit processor"); |
|
210 | 210 | break; |
|
211 | 211 | case EM_HUANY : |
|
212 | 212 | strcpy(MachineName,"Harvard University machine-independent object files"); |
|
213 | 213 | break; |
|
214 | 214 | case EM_PRISM : |
|
215 | 215 | strcpy(MachineName,"SiTera Prism"); |
|
216 | 216 | break; |
|
217 | 217 | case EM_AVR : |
|
218 | 218 | strcpy(MachineName,"Atmel AVR 8-bit microcontroller"); |
|
219 | 219 | break; |
|
220 | 220 | case EM_FR30 : |
|
221 | 221 | strcpy(MachineName,"Fujitsu FR30"); |
|
222 | 222 | break; |
|
223 | 223 | case EM_D10V : |
|
224 | 224 | strcpy(MachineName,"Mitsubishi D10V"); |
|
225 | 225 | break; |
|
226 | 226 | case EM_D30V : |
|
227 | 227 | strcpy(MachineName,"Mitsubishi D30V"); |
|
228 | 228 | break; |
|
229 | 229 | case EM_V850 : |
|
230 | 230 | strcpy(MachineName,"NEC v850"); |
|
231 | 231 | break; |
|
232 | 232 | case EM_M32R : |
|
233 | 233 | strcpy(MachineName,"Mitsubishi M32R"); |
|
234 | 234 | break; |
|
235 | 235 | case EM_MN10300 : |
|
236 | 236 | strcpy(MachineName,"Matsushita MN10300"); |
|
237 | 237 | break; |
|
238 | 238 | case EM_MN10200 : |
|
239 | 239 | strcpy(MachineName,"Matsushita MN10200"); |
|
240 | 240 | break; |
|
241 | 241 | case EM_PJ : |
|
242 | 242 | strcpy(MachineName,"picoJava"); |
|
243 | 243 | break; |
|
244 | 244 | case EM_OPENRISC : |
|
245 | 245 | strcpy(MachineName,"OpenRISC 32-bit embedded processor"); |
|
246 | 246 | break; |
|
247 | 247 | case EM_ARC_A5 : |
|
248 | 248 | strcpy(MachineName,"ARC Cores Tangent-A5"); |
|
249 | 249 | break; |
|
250 | 250 | case EM_XTENSA : |
|
251 | 251 | strcpy(MachineName,"Tensilica Xtensa Architecture"); |
|
252 | 252 | break; |
|
253 | 253 | default: |
|
254 | 254 | strcpy(MachineName,"Unknow Machine"); |
|
255 | 255 | break; |
|
256 | 256 | } |
|
257 | 257 | |
|
258 | 258 | } |
|
259 | 259 | |
|
260 | 260 | |
|
261 | 261 | elfparser::elfparser() |
|
262 | 262 | { |
|
263 | 263 | this->opened = false; |
|
264 | 264 | this->type_elf = false; |
|
265 | 265 | this->elfFile = NULL; |
|
266 | 266 | this->e = NULL; |
|
267 | 267 | } |
|
268 | 268 | |
|
269 | 269 | |
|
270 | 270 | int elfparser::setFilename(const QString &name) |
|
271 | 271 | { |
|
272 | 272 | this->closeFile(); |
|
273 | 273 | if(elf_version(EV_CURRENT)==EV_NONE)return 0; |
|
274 | 274 | #ifdef _ELF_WINDOWS_ |
|
275 | 275 | this->elfFile = open(name.toStdString().c_str(),O_RDONLY|O_BINARY ,0); |
|
276 | 276 | #else |
|
277 | 277 | this->elfFile = open(name.toStdString().c_str(),O_RDONLY ,0); |
|
278 | 278 | #endif |
|
279 | 279 | if(this->elfFile==NULL)return 0; |
|
280 | 280 | this->e = elf_begin(this->elfFile,ELF_C_READ,NULL); |
|
281 | 281 | if(this->e==NULL)return 0; |
|
282 | 282 | this->ek = elf_kind(this->e); |
|
283 | 283 | gelf_getehdr (this->e, &this->ehdr ); |
|
284 | 284 | elf_getshdrstrndx (this->e, &this->shstrndx); |
|
285 | 285 | this->updateSegments(); |
|
286 | 286 | this->updateSections(); |
|
287 | 287 | return 1; |
|
288 | 288 | } |
|
289 | 289 | |
|
290 | 290 | |
|
291 | 291 | int elfparser::closeFile() |
|
292 | 292 | { |
|
293 | 293 | if(this->elfFile!=NULL) |
|
294 | 294 | { |
|
295 | 295 | if(this->e!=NULL) |
|
296 | 296 | { |
|
297 | 297 | elf_end(this->e); |
|
298 | 298 | this->e = NULL; |
|
299 | 299 | } |
|
300 | 300 | close(this->elfFile); |
|
301 | 301 | this->elfFile = NULL; |
|
302 | 302 | } |
|
303 | 303 | return 0; |
|
304 | 304 | } |
|
305 | 305 | |
|
306 | 306 | |
|
307 | 307 | bool elfparser::isopened() |
|
308 | 308 | { |
|
309 | 309 | return this->opened; |
|
310 | 310 | } |
|
311 | 311 | |
|
312 | 312 | |
|
313 | 313 | bool elfparser::iself() |
|
314 | 314 | { |
|
315 | 315 | return this->type_elf; |
|
316 | 316 | } |
|
317 | 317 | |
|
318 | 318 | |
|
319 | 319 | QString elfparser::getArchitecture() |
|
320 | 320 | { |
|
321 | 321 | QString arch(""); |
|
322 | 322 | char archName[256]=""; |
|
323 | 323 | if(this->e!=NULL) |
|
324 | 324 | { |
|
325 | 325 | elfresolveMachine(this->ehdr.e_machine,archName); |
|
326 | 326 | arch = archName; |
|
327 | 327 | } |
|
328 | 328 | return arch; |
|
329 | 329 | } |
|
330 | 330 | |
|
331 | 331 | |
|
332 | 332 | QString elfparser::getType() |
|
333 | 333 | { |
|
334 | 334 | QString kind(""); |
|
335 | 335 | if(this->e!=NULL) |
|
336 | 336 | { |
|
337 | 337 | switch(this->ek) |
|
338 | 338 | { |
|
339 | 339 | case ELF_K_AR: |
|
340 | 340 | kind = "Archive"; |
|
341 | 341 | break; |
|
342 | 342 | case ELF_K_ELF: |
|
343 | 343 | kind = "Elf"; |
|
344 | 344 | break; |
|
345 | 345 | case ELF_K_COFF: |
|
346 | 346 | kind = "COFF"; |
|
347 | 347 | break; |
|
348 | 348 | case ELF_K_NUM: |
|
349 | 349 | kind = "NUM"; |
|
350 | 350 | break; |
|
351 | 351 | case ELF_K_NONE: |
|
352 | 352 | kind = "Data"; |
|
353 | 353 | break; |
|
354 | 354 | default: |
|
355 | 355 | kind = "Unknow"; |
|
356 | 356 | break; |
|
357 | 357 | } |
|
358 | 358 | } |
|
359 | 359 | return kind; |
|
360 | 360 | } |
|
361 | 361 | |
|
362 | 362 | |
|
363 | 363 | int32_t elfparser::getVersion() |
|
364 | 364 | { |
|
365 | 365 | if(this->e!=NULL) |
|
366 | 366 | { |
|
367 | 367 | return this->ehdr.e_version; |
|
368 | 368 | } |
|
369 | 369 | } |
|
370 | 370 | |
|
371 | 371 | |
|
372 | 372 | int elfparser::getSectioncount() |
|
373 | 373 | { |
|
374 | 374 | return (int)this->SectionCount; |
|
375 | 375 | } |
|
376 | 376 | |
|
377 | 377 | |
|
378 | 378 | int elfparser::getSegmentcount() |
|
379 | 379 | { |
|
380 | 380 | return (int)this->SegmentCount; |
|
381 | 381 | } |
|
382 | 382 | |
|
383 | 383 | |
|
384 | 384 | QString elfparser::getSegmentType(int index) |
|
385 | 385 | { |
|
386 | 386 | QString type(""); |
|
387 | 387 | if(this->e!=NULL) |
|
388 | 388 | { |
|
389 | 389 | if(index < this->Segments.count()) |
|
390 | 390 | { |
|
391 | 391 | switch(this->Segments.at(index)->p_type) |
|
392 | 392 | { |
|
393 | 393 | case PT_NULL: |
|
394 | 394 | type = "Program header table entry unused"; |
|
395 | 395 | break; |
|
396 | 396 | case PT_LOAD: |
|
397 | 397 | type = "Loadable program segment"; |
|
398 | 398 | break; |
|
399 | 399 | case PT_DYNAMIC : |
|
400 | 400 | type = "Dynamic linking information"; |
|
401 | 401 | break; |
|
402 | 402 | case PT_INTERP: |
|
403 | 403 | type ="Program interpreter"; |
|
404 | 404 | break; |
|
405 | 405 | case PT_NOTE: |
|
406 | 406 | type = "Auxiliary information"; |
|
407 | 407 | break; |
|
408 | 408 | case PT_SHLIB: |
|
409 | 409 | type = "Reserved"; |
|
410 | 410 | break; |
|
411 | 411 | case PT_PHDR: |
|
412 | 412 | type = "Entry for header table itself"; |
|
413 | 413 | break; |
|
414 | 414 | case PT_TLS: |
|
415 | 415 | type = "Thread-local storage segment"; |
|
416 | 416 | break; |
|
417 | 417 | case PT_NUM: |
|
418 | 418 | type = "Number of defined types"; |
|
419 | 419 | break; |
|
420 | 420 | case PT_LOOS: |
|
421 | 421 | type = "Start of OS-specific"; |
|
422 | 422 | break; |
|
423 | 423 | case PT_SUNWSTACK: |
|
424 | 424 | type = "Stack segment"; |
|
425 | 425 | break; |
|
426 | 426 | case PT_LOPROC: |
|
427 | 427 | type = "Start of processor-specific"; |
|
428 | 428 | break; |
|
429 | 429 | case PT_HIPROC: |
|
430 | 430 | type = "End of processor-specific"; |
|
431 | 431 | break; |
|
432 | 432 | default: |
|
433 | 433 | type = "Unknow Section Type"; |
|
434 | 434 | break; |
|
435 | 435 | } |
|
436 | 436 | } |
|
437 | 437 | } |
|
438 | 438 | |
|
439 | 439 | return type; |
|
440 | 440 | } |
|
441 | 441 | |
|
442 | 442 | |
|
443 | 443 | int64_t elfparser::getSegmentOffset(int index) |
|
444 | 444 | { |
|
445 | 445 | int64_t Offset; |
|
446 | 446 | if(this->e!=NULL) |
|
447 | 447 | { |
|
448 | 448 | if(index < this->Segments.count()) |
|
449 | 449 | { |
|
450 | 450 | Offset = (int64_t)this->Segments.at(index)->p_offset; |
|
451 | 451 | } |
|
452 | 452 | } |
|
453 | 453 | return Offset; |
|
454 | 454 | } |
|
455 | 455 | |
|
456 | 456 | |
|
457 | 457 | int64_t elfparser::getSegmentVaddr(int index) |
|
458 | 458 | { |
|
459 | 459 | int64_t Vaddr = 0; |
|
460 | 460 | if(this->e!=NULL) |
|
461 | 461 | { |
|
462 | 462 | if(index < this->Segments.count()) |
|
463 | 463 | { |
|
464 | 464 | Vaddr = (int64_t)this->Segments.at(index)->p_vaddr; |
|
465 | 465 | } |
|
466 | 466 | } |
|
467 | 467 | return Vaddr; |
|
468 | 468 | } |
|
469 | 469 | |
|
470 | 470 | |
|
471 | 471 | int64_t elfparser::getSegmentPaddr(int index) |
|
472 | 472 | { |
|
473 | 473 | int64_t Paddr=0; |
|
474 | 474 | if(this->e!=NULL) |
|
475 | 475 | { |
|
476 | 476 | if(index < this->Segments.count()) |
|
477 | 477 | { |
|
478 | 478 | Paddr = (int64_t)this->Segments.at(index)->p_paddr; |
|
479 | 479 | } |
|
480 | 480 | } |
|
481 | 481 | return Paddr; |
|
482 | 482 | } |
|
483 | 483 | |
|
484 | 484 | int64_t elfparser::getSectionPaddr(int index) |
|
485 | 485 | { |
|
486 | 486 | int64_t Paddr=0; |
|
487 | 487 | if(this->e!=NULL) |
|
488 | 488 | { |
|
489 | 489 | if(index < this->sections.count()) |
|
490 | 490 | { |
|
491 | 491 | Paddr = (int64_t)this->sections.at(index)->section_header->sh_addr; |
|
492 | 492 | } |
|
493 | 493 | } |
|
494 | 494 | return Paddr; |
|
495 | 495 | } |
|
496 | 496 | |
|
497 | 497 | |
|
498 | 498 | int64_t elfparser::getSegmentFilesz(int index) |
|
499 | 499 | { |
|
500 | 500 | int64_t FileSz=0; |
|
501 | 501 | if(this->e!=NULL) |
|
502 | 502 | { |
|
503 | 503 | if(index < this->Segments.count()) |
|
504 | 504 | { |
|
505 | 505 | FileSz = (int64_t)this->Segments.at(index)->p_filesz; |
|
506 | 506 | } |
|
507 | 507 | } |
|
508 | 508 | return FileSz; |
|
509 | 509 | } |
|
510 | 510 | |
|
511 | 511 | int64_t elfparser::getSectionDatasz(int index) |
|
512 | 512 | { |
|
513 | 513 | int64_t DataSz=0; |
|
514 | 514 | if(this->e!=NULL) |
|
515 | 515 | { |
|
516 | 516 | if(index < this->sections.count()) |
|
517 | 517 | { |
|
518 | 518 | DataSz = (int64_t)this->sections.at(index)->data->d_size; |
|
519 | 519 | } |
|
520 | 520 | } |
|
521 | 521 | return DataSz; |
|
522 | 522 | } |
|
523 | 523 | |
|
524 | 524 | bool elfparser::getSectionData(int index, char **buffer) |
|
525 | 525 | { |
|
526 | 526 | if(this->e!=NULL) |
|
527 | 527 | { |
|
528 | 528 | if(index < this->sections.count()) |
|
529 | 529 | { |
|
530 | 530 | *buffer = (char *)this->sections.at(index)->data->d_buf; |
|
531 | 531 | return true; |
|
532 | 532 | } |
|
533 | 533 | } |
|
534 | 534 | return false; |
|
535 | 535 | } |
|
536 | 536 | |
|
537 | 537 | |
|
538 | 538 | int64_t elfparser::getSegmentMemsz(int index) |
|
539 | 539 | { |
|
540 | 540 | int64_t MemSz=0; |
|
541 | 541 | if(this->e!=NULL) |
|
542 | 542 | { |
|
543 | 543 | if(index < this->Segments.count()) |
|
544 | 544 | { |
|
545 | 545 | MemSz = (int64_t)this->Segments.at(index)->p_memsz; |
|
546 | 546 | } |
|
547 | 547 | } |
|
548 | 548 | return MemSz; |
|
549 | 549 | } |
|
550 | 550 | |
|
551 | 551 | int64_t elfparser::getSectionMemsz(int index) |
|
552 | 552 | { |
|
553 | 553 | int64_t MemSz=0; |
|
554 | 554 | if(this->e!=NULL) |
|
555 | 555 | { |
|
556 | 556 | if(index < this->sections.count()) |
|
557 | 557 | { |
|
558 | 558 | MemSz = (int64_t)this->sections.at(index)->section_header->sh_size; |
|
559 | 559 | } |
|
560 | 560 | } |
|
561 | 561 | return MemSz; |
|
562 | 562 | } |
|
563 | 563 | |
|
564 | 564 | |
|
565 | 565 | QString elfparser::getSegmentFlags(int index) |
|
566 | 566 | { |
|
567 | 567 | QString flags(""); |
|
568 | 568 | if(this->e!=NULL) |
|
569 | 569 | { |
|
570 | 570 | if(index < this->Segments.count()) |
|
571 | 571 | { |
|
572 | 572 | if((this->Segments.at(index)->p_flags&PF_X) == PF_X)flags+="x"; |
|
573 | 573 | if((this->Segments.at(index)->p_flags&PF_W) == PF_W)flags+="w"; |
|
574 | 574 | if((this->Segments.at(index)->p_flags&PF_R) == PF_R)flags+="r"; |
|
575 | 575 | if((this->Segments.at(index)->p_flags&PF_MASKOS) == PF_MASKOS)flags+=" OS-specific"; |
|
576 | 576 | if((this->Segments.at(index)->p_flags&PF_MASKPROC) == PF_MASKPROC)flags+=" Processor-specific"; |
|
577 | 577 | } |
|
578 | 578 | } |
|
579 | 579 | return flags; |
|
580 | 580 | } |
|
581 | 581 | |
|
582 | 582 | |
|
583 | 583 | QString elfparser::getSectionName(int index) |
|
584 | 584 | { |
|
585 | 585 | char* nameChr = elf_strptr(this->e , this->shstrndx , this->sections.at(index)->section_header->sh_name); |
|
586 | 586 | return QString(nameChr); |
|
587 | 587 | } |
|
588 | 588 | |
|
589 | 589 | |
|
590 | 590 | void elfparser::updateSections() |
|
591 | 591 | { |
|
592 | 592 | for(int i=0;i<this->sections.count();i++) |
|
593 | 593 | { |
|
594 | 594 | delete this->sections.at(i); |
|
595 | 595 | } |
|
596 | 596 | this->sections.clear(); |
|
597 | 597 | this->scn = elf_nextscn (this->e , NULL ); |
|
598 | 598 | this->SectionCount = 0; |
|
599 | 599 | while( this->scn != NULL ) |
|
600 | 600 | { |
|
601 | 601 | GElf_Shdr* shdr = (GElf_Shdr*)malloc(sizeof(GElf_Shdr)); |
|
602 | 602 | gelf_getshdr ( this->scn , shdr ); |
|
603 | 603 | Elf_Data* data = elf_getdata(this->scn, NULL); |
|
604 | 604 | this->sections.append(new Elf_Section(data,shdr)); |
|
605 | 605 | this->SectionCount+=1; |
|
606 | 606 | this->scn = elf_nextscn(e , scn); |
|
607 | 607 | } |
|
608 | 608 | } |
|
609 | 609 | |
|
610 | 610 | |
|
611 | 611 | void elfparser::updateSegments() |
|
612 | 612 | { |
|
613 | 613 | elf_getphdrnum (this->e , &this->SegmentCount); |
|
614 | 614 | for(int i=0;i<this->Segments.count();i++) |
|
615 | 615 | { |
|
616 | 616 | free(this->Segments.at(i)); |
|
617 | 617 | } |
|
618 | 618 | this->Segments.clear(); |
|
619 | 619 | for(int i=0;i<this->SegmentCount;i++) |
|
620 | 620 | { |
|
621 | 621 | GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); |
|
622 | 622 | gelf_getphdr (this->e , i , header ); |
|
623 | 623 | this->Segments.append(header); |
|
624 | 624 | } |
|
625 | 625 | } |
|
626 | 626 | |
|
627 | 627 | |
|
628 | 628 | |
|
629 | 629 | |
|
630 | 630 | |
|
631 | 631 | QString elfparser::getSectionType(int index) |
|
632 | 632 | { |
|
633 | 633 | QString type(""); |
|
634 | 634 | if(this->e!=NULL) |
|
635 | 635 | { |
|
636 | 636 | if(index < this->Segments.count()) |
|
637 | 637 | { |
|
638 | 638 | switch(this->Segments.at(index)->p_type) |
|
639 | 639 | { |
|
640 | 640 | case SHT_NULL : type = "Section header table entry unused"; break; |
|
641 | 641 | case SHT_PROGBITS : type = "Program data"; break; |
|
642 | 642 | case SHT_SYMTAB : type = "Symbol table"; break; |
|
643 | 643 | case SHT_STRTAB : type = "String table"; break; |
|
644 | 644 | case SHT_RELA : type = "Relocation entries with addends"; break; |
|
645 | 645 | case SHT_HASH : type = "Symbol hash table"; break; |
|
646 | 646 | case SHT_DYNAMIC : type = "Dynamic linking information"; break; |
|
647 | 647 | case SHT_NOTE : type = "Notes"; break; |
|
648 | 648 | case SHT_NOBITS :type = "Program space with no data (bss)"; break; |
|
649 | 649 | case SHT_REL :type = "Relocation entries, no addends"; break; |
|
650 | 650 | case SHT_SHLIB : type = "Reserved"; break; |
|
651 | 651 | case SHT_DYNSYM : type = "Dynamic linker symbol table"; break; |
|
652 | 652 | case SHT_INIT_ARRAY : type = "Array of constructors"; break; |
|
653 | 653 | case SHT_FINI_ARRAY : type = "Array of destructors"; break; |
|
654 | 654 | case SHT_PREINIT_ARRAY : type = "Array of pre-constructors"; break; |
|
655 | 655 | case SHT_GROUP : type = "Section group"; break; |
|
656 | 656 | case SHT_SYMTAB_SHNDX : type = "Extended section indeces"; break; |
|
657 | 657 | case SHT_NUM : type = "Number of defined types. "; break; |
|
658 | 658 | case SHT_LOOS : type = "Start OS-specific. "; break; |
|
659 | 659 | case SHT_LOSUNW : type = "Sun-specific low bound. "; break; |
|
660 | 660 | case SHT_SUNW_COMDAT : type = " "; break; |
|
661 | 661 | case SHT_SUNW_syminfo : type = " "; break; |
|
662 | 662 | case SHT_GNU_verdef : type = "Version definition section. "; break; |
|
663 | 663 | case SHT_GNU_verneed : type = "Version needs section. "; break; |
|
664 | 664 | case SHT_GNU_versym : type = "Version symbol table. "; break; |
|
665 | 665 | case SHT_LOPROC : type = "Start of processor-specific"; break; |
|
666 | 666 | case SHT_HIPROC : type = "End of processor-specific"; break; |
|
667 | 667 | case SHT_HIUSER : type = "End of application-specific"; break; |
|
668 | 668 | } |
|
669 | 669 | } |
|
670 | 670 | } |
|
671 | 671 | return type; |
|
672 | 672 | } |
|
673 | 673 | |
|
674 | 674 | bool elfparser::isElf(const QString &File) |
|
675 | 675 | { |
|
676 | 676 | int file =0; |
|
677 | 677 | #ifdef _ELF_WINDOWS_ |
|
678 | 678 | file = open(File.toStdString().c_str(),O_RDONLY|O_BINARY ,0); |
|
679 | 679 | #else |
|
680 | 680 | file = open(File.toStdString().c_str(),O_RDONLY ,0); |
|
681 | 681 | #endif |
|
682 | 682 | char Magic[4]; |
|
683 | 683 | if(file!=-1) |
|
684 | 684 | { |
|
685 | 685 | read(file,Magic,4); |
|
686 | 686 | close(file); |
|
687 | 687 | if(Magic[0]==0x7f && Magic[1]==0x45 && Magic[2]==0x4c && Magic[3]==0x46) |
|
688 | 688 | { |
|
689 | 689 | return true; |
|
690 | 690 | } |
|
691 | 691 | } |
|
692 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef ELFPARSER_H |
|
23 | 23 | #define ELFPARSER_H |
|
24 | 24 | #include <libelf.h> |
|
25 | 25 | #include <gelf.h> |
|
26 | 26 | #include <QString> |
|
27 | 27 | #include <stdio.h> |
|
28 | 28 | #include <QList> |
|
29 | 29 | #include <stdint.h> |
|
30 | 30 | |
|
31 | 31 | class Elf_Section |
|
32 | 32 | { |
|
33 | 33 | public: |
|
34 | 34 | Elf_Section(){} |
|
35 | 35 | Elf_Section(Elf_Data* data,GElf_Shdr* section_header) |
|
36 | 36 | { |
|
37 | 37 | this->data = data; |
|
38 | 38 | this->section_header = section_header; |
|
39 | 39 | } |
|
40 | 40 | Elf_Data* data; |
|
41 | 41 | GElf_Shdr* section_header; |
|
42 | 42 | }; |
|
43 | 43 | |
|
44 | 44 | class elfparser |
|
45 | 45 | { |
|
46 | 46 | public: |
|
47 | 47 | elfparser(); |
|
48 | 48 | bool iself(); |
|
49 | 49 | bool isopened(); |
|
50 | 50 | int setFilename(const QString& name); |
|
51 | 51 | int closeFile(); |
|
52 | 52 | QString getArchitecture(); |
|
53 | 53 | QString getType(); |
|
54 | 54 | int32_t getVersion(); |
|
55 | 55 | int getSectioncount(); |
|
56 | 56 | int getSegmentcount(); |
|
57 | 57 | QString getSegmentType(int index); |
|
58 | 58 | int64_t getSegmentOffset(int index); |
|
59 | 59 | int64_t getSegmentVaddr(int index); |
|
60 | 60 | int64_t getSegmentPaddr(int index); |
|
61 | 61 | int64_t getSectionPaddr(int index); |
|
62 | 62 | int64_t getSegmentFilesz(int index); |
|
63 | 63 | int64_t getSectionDatasz(int index); |
|
64 | 64 | bool getSectionData(int index, char **buffer); |
|
65 | 65 | int64_t getSegmentMemsz(int index); |
|
66 | 66 | int64_t getSectionMemsz(int index); |
|
67 | 67 | QString getSegmentFlags(int index); |
|
68 | 68 | QString getSectionName(int index); |
|
69 | 69 | QString getSectionType(int index); |
|
70 | 70 | static bool isElf(const QString& File); |
|
71 | 71 | |
|
72 | 72 | private: |
|
73 | 73 | void updateSections(); |
|
74 | 74 | void updateSegments(); |
|
75 | 75 | int elfFile; |
|
76 | 76 | bool opened; |
|
77 | 77 | bool type_elf; |
|
78 | 78 | Elf* e; |
|
79 | 79 | Elf_Kind ek; |
|
80 | 80 | GElf_Ehdr ehdr; |
|
81 | 81 | Elf_Scn * scn; |
|
82 | 82 | Elf_Data * data; |
|
83 | 83 | size_t SectionCount,SegmentCount, shstrndx; |
|
84 | 84 | QList<GElf_Phdr*> Segments; |
|
85 | 85 | //QList<GElf_Shdr*> Sections; |
|
86 | 86 | QList<Elf_Section*> sections; |
|
87 | 87 | |
|
88 | 88 | }; |
|
89 | 89 | |
|
90 | 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 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef MEMSIZEWDGT_H |
|
23 | 23 | #define MEMSIZEWDGT_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | 26 | #include <QLineEdit> |
|
27 | 27 | #include <QComboBox> |
|
28 | 28 | #include <QHBoxLayout> |
|
29 | 29 | |
|
30 | 30 | class MemSizeWdgt : public QWidget |
|
31 | 31 | { |
|
32 | 32 | Q_OBJECT |
|
33 | 33 | public: |
|
34 | 34 | explicit MemSizeWdgt(QWidget *parent = 0); |
|
35 | 35 | MemSizeWdgt(int defaultSize,QWidget *parent = 0); |
|
36 | 36 | int getsize(); |
|
37 | 37 | void setMaximum(unsigned int max); |
|
38 | 38 | void updateSizeValue(); |
|
39 | 39 | void show(); |
|
40 | 40 | |
|
41 | 41 | signals: |
|
42 | 42 | |
|
43 | 43 | public slots: |
|
44 | 44 | void setSizeValue(int size); |
|
45 | 45 | |
|
46 | 46 | private slots: |
|
47 | 47 | void setSizeValue(); |
|
48 | 48 | void setSizeValue(QString size); |
|
49 | 49 | |
|
50 | 50 | private: |
|
51 | 51 | QHBoxLayout* mainLayout; |
|
52 | 52 | QLineEdit* sizeValue; |
|
53 | 53 | QComboBox* sizeUnit; |
|
54 | 54 | unsigned int maximum; |
|
55 | 55 | |
|
56 | 56 | |
|
57 | 57 | }; |
|
58 | 58 | |
|
59 | 59 | #endif // MEMSIZEWDGT_H |
@@ -1,55 +1,55 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef QHEXSPINBOX_H |
|
23 | 23 | #define QHEXSPINBOX_H |
|
24 | 24 | |
|
25 | 25 | #include <QSpinBox> |
|
26 | 26 | #include <QWidget> |
|
27 | 27 | #include <QString> |
|
28 | 28 | #include <QValidator> |
|
29 | 29 | |
|
30 | 30 | class QHexSpinBox : public QSpinBox |
|
31 | 31 | { |
|
32 | 32 | Q_OBJECT |
|
33 | 33 | public: |
|
34 | 34 | explicit QHexSpinBox(QWidget *parent = 0); |
|
35 | 35 | QString textFromValue ( int value ) const; |
|
36 | 36 | int valueFromText ( const QString & text ) const ; |
|
37 | 37 | QValidator::State validate(QString &input, int &pos) const |
|
38 | 38 | { |
|
39 | 39 | Q_UNUSED(pos) |
|
40 | 40 | bool ok; |
|
41 | 41 | input.toUInt( &ok, 16 ); |
|
42 | 42 | if(ok) |
|
43 | 43 | return QValidator::Acceptable; |
|
44 | 44 | else |
|
45 | 45 | return QValidator::Invalid; |
|
46 | 46 | } |
|
47 | 47 | void show(); |
|
48 | 48 | signals: |
|
49 | 49 | |
|
50 | 50 | public slots: |
|
51 | 51 | |
|
52 | 52 | }; |
|
53 | 53 | |
|
54 | 54 | |
|
55 | 55 | #endif // QHEXSPINBOX_H |
@@ -1,119 +1,119 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Paul Leroy |
|
20 | 20 | -- Mail : paul.leroy@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "qipdialogbox.h" |
|
23 | 23 | #include <QSpinBox> |
|
24 | 24 | #include <QHBoxLayout> |
|
25 | 25 | #include <QVBoxLayout> |
|
26 | 26 | #include <QLabel> |
|
27 | 27 | #include <QString> |
|
28 | 28 | #include <QLocale> |
|
29 | 29 | |
|
30 | 30 | QIPDialogBox::QIPDialogBox(QWidget *parent) : |
|
31 | 31 | QWidget(parent) |
|
32 | 32 | { |
|
33 | 33 | QHBoxLayout *addressLayout = new QHBoxLayout; |
|
34 | 34 | QVBoxLayout *mainLayout = new QVBoxLayout; |
|
35 | 35 | addressPart1 = new QSpinBox; |
|
36 | 36 | addressPart2 = new QSpinBox; |
|
37 | 37 | addressPart3 = new QSpinBox; |
|
38 | 38 | addressPart4 = new QSpinBox; |
|
39 | 39 | |
|
40 | 40 | addressPart1->setRange(0, 255); |
|
41 | 41 | addressPart1->setValue(129); |
|
42 | 42 | addressPart1->setButtonSymbols(QAbstractSpinBox::NoButtons); |
|
43 | 43 | |
|
44 | 44 | addressPart2->setRange(0, 255); |
|
45 | 45 | addressPart2->setValue(104); |
|
46 | 46 | addressPart2->setButtonSymbols(QAbstractSpinBox::NoButtons); |
|
47 | 47 | |
|
48 | 48 | addressPart3->setRange(0, 255); |
|
49 | 49 | addressPart3->setValue(27); |
|
50 | 50 | addressPart3->setButtonSymbols(QAbstractSpinBox::NoButtons); |
|
51 | 51 | |
|
52 | 52 | addressPart4->setRange(0, 255); |
|
53 | 53 | addressPart4->setValue(113); |
|
54 | 54 | addressPart4->setButtonSymbols(QAbstractSpinBox::NoButtons); |
|
55 | 55 | |
|
56 | 56 | valueChanged(); |
|
57 | 57 | |
|
58 | 58 | connect(addressPart1, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); |
|
59 | 59 | connect(addressPart2, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); |
|
60 | 60 | connect(addressPart3, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); |
|
61 | 61 | connect(addressPart4, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); |
|
62 | 62 | |
|
63 | 63 | addressLayout->addWidget(addressPart1); |
|
64 | 64 | addressLayout->addWidget(addressPart2); |
|
65 | 65 | addressLayout->addWidget(addressPart3); |
|
66 | 66 | addressLayout->addWidget(addressPart4); |
|
67 | 67 | mainLayout->addLayout(addressLayout); |
|
68 | 68 | //mainLayout->addWidget(labelGRESBIP); |
|
69 | 69 | |
|
70 | 70 | setLayout(mainLayout); |
|
71 | 71 | } |
|
72 | 72 | |
|
73 | 73 | void QIPDialogBox::valueChanged() // SLOT |
|
74 | 74 | { |
|
75 | 75 | gresbIP = addressPart1->cleanText(); |
|
76 | 76 | gresbIP.append("."); |
|
77 | 77 | gresbIP.append(addressPart2->cleanText()); |
|
78 | 78 | gresbIP.append("."); |
|
79 | 79 | gresbIP.append(addressPart3->cleanText()); |
|
80 | 80 | gresbIP.append("."); |
|
81 | 81 | gresbIP.append(addressPart4->cleanText()); |
|
82 | 82 | } |
|
83 | 83 | |
|
84 | 84 | QString QIPDialogBox::getIP() |
|
85 | 85 | { |
|
86 | 86 | return(gresbIP); |
|
87 | 87 | } |
|
88 | 88 | |
|
89 | 89 | void QIPDialogBox::setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4) |
|
90 | 90 | { |
|
91 | 91 | addressPart1->setValue(address1); |
|
92 | 92 | addressPart2->setValue(address2); |
|
93 | 93 | addressPart3->setValue(address3); |
|
94 | 94 | addressPart4->setValue(address4); |
|
95 | 95 | addressPart1->repaint(); |
|
96 | 96 | addressPart2->repaint(); |
|
97 | 97 | addressPart3->repaint(); |
|
98 | 98 | addressPart4->repaint(); |
|
99 | 99 | } |
|
100 | 100 | |
|
101 | 101 | unsigned char QIPDialogBox::get_addressPart1() |
|
102 | 102 | { |
|
103 | 103 | return (unsigned char) addressPart1->value(); |
|
104 | 104 | } |
|
105 | 105 | |
|
106 | 106 | unsigned char QIPDialogBox::get_addressPart2() |
|
107 | 107 | { |
|
108 | 108 | return (unsigned char) addressPart2->value(); |
|
109 | 109 | } |
|
110 | 110 | |
|
111 | 111 | unsigned char QIPDialogBox::get_addressPart3() |
|
112 | 112 | { |
|
113 | 113 | return (unsigned char) addressPart3->value(); |
|
114 | 114 | } |
|
115 | 115 | |
|
116 | 116 | unsigned char QIPDialogBox::get_addressPart4() |
|
117 | 117 | { |
|
118 | 118 | return (unsigned char) addressPart4->value(); |
|
119 | 119 | } |
@@ -1,55 +1,55 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Paul Leroy |
|
20 | 20 | -- Mail : paul.leroy@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef WIDGETADDRESS_H |
|
23 | 23 | #define WIDGETADDRESS_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | 26 | #include <QSpinBox> |
|
27 | 27 | #include <QString> |
|
28 | 28 | #include <QLabel> |
|
29 | 29 | |
|
30 | 30 | class QIPDialogBox : public QWidget |
|
31 | 31 | { |
|
32 | 32 | Q_OBJECT |
|
33 | 33 | public: |
|
34 | 34 | explicit QIPDialogBox(QWidget *parent = 0); |
|
35 | 35 | void setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4); |
|
36 | 36 | |
|
37 | 37 | signals: |
|
38 | 38 | |
|
39 | 39 | public slots: |
|
40 | 40 | void valueChanged(); |
|
41 | 41 | QString getIP(); |
|
42 | 42 | unsigned char get_addressPart1(); |
|
43 | 43 | unsigned char get_addressPart2(); |
|
44 | 44 | unsigned char get_addressPart3(); |
|
45 | 45 | unsigned char get_addressPart4(); |
|
46 | 46 | |
|
47 | 47 | private: |
|
48 | 48 | QSpinBox *addressPart1; |
|
49 | 49 | QSpinBox *addressPart2; |
|
50 | 50 | QSpinBox *addressPart3; |
|
51 | 51 | QSpinBox *addressPart4; |
|
52 | 52 | QString gresbIP; |
|
53 | 53 | }; |
|
54 | 54 | |
|
55 | 55 | #endif // WIDGETADDRESS_H |
@@ -1,38 +1,38 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef QSVGICON_H |
|
23 | 23 | #define QSVGICON_H |
|
24 | 24 | |
|
25 | 25 | #include <QIcon> |
|
26 | 26 | #include <QSvgRenderer> |
|
27 | 27 | #include <QImage> |
|
28 | 28 | #include <QPainter> |
|
29 | 29 | |
|
30 | 30 | class QSvgIcon : public QIcon |
|
31 | 31 | { |
|
32 | 32 | public: |
|
33 | 33 | QSvgIcon(); |
|
34 | 34 | QSvgIcon(const QString& fileName); |
|
35 | 35 | void addFile ( const QString & fileName, const QSize & size = QSize(), Mode mode = Normal, State state = Off ); |
|
36 | 36 | }; |
|
37 | 37 | |
|
38 | 38 | #endif // QSVGICON_H |
@@ -1,50 +1,50 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef DOCKABLEPLUGINMANAGER_H |
|
23 | 23 | #define DOCKABLEPLUGINMANAGER_H |
|
24 | 24 | |
|
25 | 25 | #include <QDockWidget> |
|
26 | 26 | #include "pluginmanagerWDGT.h" |
|
27 | 27 | |
|
28 | 28 | class dockablePluginManager : public QDockWidget |
|
29 | 29 | { |
|
30 | 30 | Q_OBJECT |
|
31 | 31 | public: |
|
32 | 32 | explicit dockablePluginManager(QWidget *parent = 0); |
|
33 | 33 | void setRootLoadable(bool flag); |
|
34 | 34 | |
|
35 | 35 | signals: |
|
36 | 36 | void loadSysDrviver(const QString name); |
|
37 | 37 | void loadSysDriverToParent(const QString name, const QString instanceName); |
|
38 | 38 | void geteplugintree(void); |
|
39 | 39 | void treeChanged(const QList<socexplorerplugin*>& drivers); |
|
40 | 40 | void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
41 | 41 | void closeSysDriver(const QString instanceName); |
|
42 | 42 | void pluginselected(const QString& instanceName); |
|
43 | 43 | public slots: |
|
44 | 44 | |
|
45 | 45 | private: |
|
46 | 46 | pluginmanagerWDGT* managerGui; |
|
47 | 47 | |
|
48 | 48 | }; |
|
49 | 49 | |
|
50 | 50 | #endif // DOCKABLEPLUGINMANAGER_H |
@@ -1,61 +1,69 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include <QApplication> |
|
23 | 23 | #include "mainwindow.h" |
|
24 | 24 | #include <PythonQt.h> |
|
25 | 25 | #include <PythonQt_QtAll.h> |
|
26 | 26 | #include <gui/PythonQtScriptingConsole.h> |
|
27 | 27 | #include <socexplorerplugin.h> |
|
28 | 28 | #include <QStyle> |
|
29 | 29 | #include <QStyleFactory> |
|
30 | 30 | #include <QStringList> |
|
31 | 31 | #include <QFile> |
|
32 | 32 | |
|
33 | 33 | |
|
34 | 34 | int main(int argc, char *argv[]) |
|
35 | 35 | { |
|
36 | 36 | // Q_INIT_RESOURCE(socexplorer); |
|
37 | 37 | #ifdef Q_OS_LINUX |
|
38 | 38 | // QApplication::setGraphicsSystem("raster"); |
|
39 | 39 | #endif |
|
40 | 40 | QApplication a(argc, argv); |
|
41 | 41 | QString scriptToEval; |
|
42 | 42 | QStringList args= a.arguments(); |
|
43 | 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 | 47 | scriptToEval = args.at(i+1); |
|
48 | 48 | if(!QFile::exists(scriptToEval)) |
|
49 | 49 | { |
|
50 | 50 | scriptToEval.clear(); |
|
51 | 51 | } |
|
52 | 52 | else |
|
53 | 53 | qDebug() << "Will execute" << scriptToEval; |
|
54 | 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 | 67 | w.show(); |
|
60 | 68 | return a.exec(); |
|
61 | 69 | } |
@@ -1,238 +1,238 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "mainwindow.h" |
|
23 | 23 | #include <QDockWidget> |
|
24 | 24 | |
|
25 |
|
|
|
25 | SocExplorerMainWindow::SocExplorerMainWindow(QString ScriptToEval, QWidget *parent) | |
|
26 | 26 | : QMainWindow(parent) |
|
27 | 27 | { |
|
28 | 28 | QCoreApplication::setApplicationName("SocExplorer"); |
|
29 | 29 | QCoreApplication::setOrganizationName("LPP"); |
|
30 | 30 | QCoreApplication::setOrganizationDomain("lpp.fr"); |
|
31 | 31 | this->makeObjects(ScriptToEval); |
|
32 | 32 | this->makeLayout(); |
|
33 | 33 | this->makeMenu(); |
|
34 | 34 | this->makeConnections(); |
|
35 | 35 | this->setWindowIcon(QIcon(tr(":/images/logolppcutted.png"))); |
|
36 | 36 | this->setAcceptDrops(true); |
|
37 | 37 | this->pluginManager->setRootLoadable(true); |
|
38 | 38 | this->PythonConsoleInst->pyConsoleRunFile(ScriptToEval); |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | 41 | |
|
42 |
void |
|
|
42 | void SocExplorerMainWindow::makeObjects(QString ScriptToEval) | |
|
43 | 43 | { |
|
44 | 44 | Q_UNUSED(ScriptToEval) |
|
45 | 45 | this->p_pluginGUIlist = new QList<QDockWidget*>(); |
|
46 | 46 | pluginsDockContainer = new QMainWindow; |
|
47 | 47 | pluginsDockContainer->setWindowFlags(Qt::Widget); |
|
48 | 48 | pluginsDockContainer->setDockNestingEnabled(true); |
|
49 | 49 | this->mainWidget = new QSplitter(Qt::Vertical); |
|
50 | 50 | this->appTranslator = new QTranslator; |
|
51 | 51 | this->Quit = new QAction(tr("&Quit"),this); |
|
52 | 52 | this->Quit->setShortcut(tr("CTRL+Q")); |
|
53 | 53 | this->ManagePlugins = new QAction(tr("&Manage Plugins"),this); |
|
54 | 54 | this->ManagePlugins->setShortcut(tr("CTRL+P")); |
|
55 | 55 | this->regsManager = new QAction(tr("&Manage registers"),this); |
|
56 | 56 | this->exploreRegs = new QAction(tr("&Explore registers"),this); |
|
57 | 57 | this->help = new QAction(tr("&Help"),this); |
|
58 | 58 | this->help->setShortcut(tr("CTRL+H")); |
|
59 | 59 | this->about = new QAction(tr("&About"),this); |
|
60 | 60 | socexplorerproxy::setMainWindow(this); |
|
61 | 61 | SocExplorerEngine::setMainWindow(this); |
|
62 | 62 | SocExplorerEngine::xmlModel()->scanXmlFiles(); |
|
63 | 63 | this->regExplorer = new regsExplorer(); |
|
64 | 64 | this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
65 | 65 | this->addPluginInterface(this->regExplorer); |
|
66 | 66 | this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self()); |
|
67 | 67 | this->PythonConsoleInst->addObject("SocExplorerEngine",SocExplorerEngine::self()); |
|
68 | 68 | this->pluginManager = new dockablePluginManager(); |
|
69 | 69 | this->toolpane = new toolBar; |
|
70 | 70 | this->p_about = new aboutsocexplorer(); |
|
71 | 71 | |
|
72 | 72 | } |
|
73 | 73 | |
|
74 |
void |
|
|
74 | void SocExplorerMainWindow::makeLayout() | |
|
75 | 75 | { |
|
76 | 76 | this->mainWidget->addWidget(pluginsDockContainer); |
|
77 | 77 | this->mainWidget->addWidget(this->PythonConsoleInst); |
|
78 | 78 | this->toolpane->setAllowedAreas(Qt::RightDockWidgetArea|Qt::LeftDockWidgetArea); |
|
79 | 79 | this->addDockWidget(Qt::LeftDockWidgetArea,this->toolpane); |
|
80 | 80 | this->toolpane->addTool(this->pluginManager); |
|
81 | 81 | this->setCentralWidget(this->mainWidget); |
|
82 | 82 | } |
|
83 | 83 | |
|
84 | 84 | |
|
85 |
void |
|
|
85 | void SocExplorerMainWindow::makeConnections() | |
|
86 | 86 | { |
|
87 | 87 | connect(socexplorerproxy::self(),SIGNAL(clearMenu()),this,SLOT(clearMenu())); |
|
88 | 88 | connect(this,SIGNAL(translateSig()),socexplorerproxy::self(),SLOT(updateText())); |
|
89 | 89 | connect(socexplorerproxy::self(),SIGNAL(addPluginGUI(QDockWidget*)),this,SLOT(addPluginInterface(QDockWidget*))); |
|
90 | 90 | connect(socexplorerproxy::self(),SIGNAL(removePluginGUI(QDockWidget*)),this,SLOT(removePluginInterface(QDockWidget*))); |
|
91 | 91 | connect(this->ManagePlugins,SIGNAL(triggered()),this,SLOT(launchPluginManager())); |
|
92 | 92 | connect(this->Quit,SIGNAL(triggered()),qApp,SLOT(quit())); |
|
93 | 93 | connect(this,SIGNAL(registerObject(QObject*,QString)),this->PythonConsoleInst,SLOT(registerObject(QObject*,QString))); |
|
94 | 94 | connect(socexplorerproxy::self(),SIGNAL(registerObject(QObject*,QString)),this,SIGNAL(registerObject(QObject*,QString))); |
|
95 | 95 | connect(this->pluginManager,SIGNAL(geteplugintree()),socexplorerproxy::self(),SLOT(geteplugintree())); |
|
96 | 96 | connect(socexplorerproxy::self(),SIGNAL(treeChanged(QList<socexplorerplugin*>)),this->pluginManager,SIGNAL(treeChanged(QList<socexplorerplugin*>))); |
|
97 | 97 | connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),socexplorerproxy::self(),SLOT(changeSysDriverInstName(QString,QString))); |
|
98 | 98 | connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),this->PythonConsoleInst,SLOT(changeSysDriverInstName(QString,QString))); |
|
99 | 99 | connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),socexplorerproxy::self(),SLOT(closeSysDriver(QString))); |
|
100 | 100 | connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),this->PythonConsoleInst,SLOT(removeDriver(QString))); |
|
101 | 101 | connect(this->pluginManager,SIGNAL(pluginselected(QString)),this,SLOT(pluginselected(QString))); |
|
102 | 102 | connect(this->about,SIGNAL(triggered()),this,SLOT(showAboutBox())); |
|
103 | 103 | connect(this->exploreRegs,SIGNAL(triggered()),this->regExplorer,SLOT(show())); |
|
104 | 104 | |
|
105 | 105 | this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString))); |
|
106 | 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 | 114 | if(this->pluginManager->isHidden()) |
|
115 | 115 | { |
|
116 | 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 | 124 | plugin->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
125 | 125 | this->pluginsDockContainer->addDockWidget(Qt::TopDockWidgetArea,plugin); |
|
126 | 126 | if(p_pluginGUIlist->count()!=0) |
|
127 | 127 | this->pluginsDockContainer->tabifyDockWidget(p_pluginGUIlist->last(),plugin); |
|
128 | 128 | p_pluginGUIlist->append(plugin); |
|
129 | 129 | |
|
130 | 130 | } |
|
131 | 131 | |
|
132 |
void |
|
|
132 | void SocExplorerMainWindow::removePluginInterface(QDockWidget *plugin) | |
|
133 | 133 | { |
|
134 | 134 | p_pluginGUIlist->removeOne(plugin); |
|
135 | 135 | this->pluginsDockContainer->removeDockWidget(plugin); |
|
136 | 136 | } |
|
137 | 137 | |
|
138 | 138 | |
|
139 |
void |
|
|
139 | void SocExplorerMainWindow::clearMenu() | |
|
140 | 140 | { |
|
141 | 141 | this->menuBar()->clear(); |
|
142 | 142 | this->makeMenu(); |
|
143 | 143 | } |
|
144 | 144 | |
|
145 | 145 | |
|
146 |
void |
|
|
146 | void SocExplorerMainWindow::makeMenu() | |
|
147 | 147 | { |
|
148 | 148 | this->FileMenu = menuBar()->addMenu(tr("&File")); |
|
149 | 149 | this->PluginsMenu = menuBar()->addMenu(tr("&Plugins")); |
|
150 | 150 | this->ToolsMenu = menuBar()->addMenu(tr("&Tools")); |
|
151 | 151 | this->ToolsMenu->addAction(this->exploreRegs); |
|
152 | 152 | this->FileMenu->addAction(this->Quit); |
|
153 | 153 | socexplorerproxy::self()->makeMenu(this->PluginsMenu); |
|
154 | 154 | this->PluginsMenu->addAction(this->ManagePlugins); |
|
155 | 155 | |
|
156 | 156 | this->helpMenu = menuBar()->addMenu(tr("Help")); |
|
157 | 157 | this->helpMenu->addAction(this->help); |
|
158 | 158 | this->helpMenu->addAction(this->about); |
|
159 | 159 | |
|
160 | 160 | } |
|
161 | 161 | |
|
162 | 162 | |
|
163 |
|
|
|
163 | SocExplorerMainWindow::~SocExplorerMainWindow() | |
|
164 | 164 | { |
|
165 | 165 | delete this->p_about; |
|
166 | 166 | delete this->p_pluginGUIlist; |
|
167 | 167 | } |
|
168 | 168 | |
|
169 | 169 | |
|
170 |
void |
|
|
170 | void SocExplorerMainWindow::setLangage(QAction *action) | |
|
171 | 171 | { |
|
172 | 172 | QString local = action->data().toString(); |
|
173 | 173 | QString qmPath = QDir(QString("translations")).absolutePath(); |
|
174 | 174 | appTranslator->load(qmPath+"/socexplorer_"+local+".qm"); |
|
175 | 175 | qApp->installTranslator(appTranslator); |
|
176 | 176 | emit this->translateSig(); |
|
177 | 177 | } |
|
178 | 178 | |
|
179 | 179 | |
|
180 |
void |
|
|
180 | void SocExplorerMainWindow::createLangMenu() | |
|
181 | 181 | { |
|
182 | 182 | this->langMenu = menuBar()->addMenu(tr("&Langue")); |
|
183 | 183 | this->langActionGrp = new QActionGroup(this); |
|
184 | 184 | connect(this->langActionGrp,SIGNAL(triggered(QAction*)),this,SLOT(setLangage(QAction*))); |
|
185 | 185 | QDir* qmDir = new QDir(QString("translations")); |
|
186 | 186 | QStringList LangFiles = qmDir->entryList(QStringList("socexplorer_*.qm")); |
|
187 | 187 | for(int i=0;i<LangFiles.size();++i) |
|
188 | 188 | { |
|
189 | 189 | QString Local = LangFiles[i]; |
|
190 | 190 | Local.remove(0,Local.indexOf('_')+1); |
|
191 | 191 | Local.chop(3); |
|
192 | 192 | QTranslator translator; |
|
193 | 193 | translator.load(LangFiles[i],qmDir->absolutePath()); |
|
194 | 194 | QString langage = translator.translate("MainWindow","English"); |
|
195 | 195 | QAction *action = new QAction(tr("&%1 %2").arg(i+1).arg(langage),this); |
|
196 | 196 | action->setCheckable(true); |
|
197 | 197 | action->setData(Local); |
|
198 | 198 | langMenu->addAction(action); |
|
199 | 199 | langActionGrp->addAction(action); |
|
200 | 200 | if(langage==tr("English")) |
|
201 | 201 | action->setChecked(true); |
|
202 | 202 | } |
|
203 | 203 | } |
|
204 | 204 | |
|
205 | 205 | |
|
206 |
void |
|
|
206 | void SocExplorerMainWindow::updateText() | |
|
207 | 207 | { |
|
208 | 208 | emit this->translateSig(); |
|
209 | 209 | } |
|
210 | 210 | |
|
211 | 211 | |
|
212 | 212 | |
|
213 |
void |
|
|
213 | void SocExplorerMainWindow::showAboutBox() | |
|
214 | 214 | { |
|
215 | 215 | p_about->show(); |
|
216 | 216 | } |
|
217 | 217 | |
|
218 |
void |
|
|
218 | void SocExplorerMainWindow::pluginselected(const QString &instanceName) | |
|
219 | 219 | { |
|
220 | 220 | socexplorerplugin* drv=socexplorerproxy::self()->getSysDriver(instanceName); |
|
221 | 221 | if(drv) |
|
222 | 222 | drv->raise(); |
|
223 | 223 | } |
|
224 | 224 | |
|
225 | 225 | |
|
226 | 226 | |
|
227 |
void |
|
|
227 | void SocExplorerMainWindow::closeEvent(QCloseEvent *event) | |
|
228 | 228 | { |
|
229 | 229 | socexplorerproxy::self()->close(); |
|
230 | 230 | qApp->closeAllWindows(); |
|
231 | 231 | event->accept(); |
|
232 | 232 | } |
|
233 | 233 | |
|
234 | 234 | |
|
235 | 235 | |
|
236 | 236 | |
|
237 | 237 | |
|
238 | 238 |
@@ -1,86 +1,86 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef MAINWINDOW_H |
|
23 | 23 | #define MAINWINDOW_H |
|
24 | 24 | |
|
25 | 25 | #include <QMainWindow> |
|
26 | 26 | #include <QApplication> |
|
27 | 27 | #include <QVBoxLayout> |
|
28 | 28 | #include <QIcon> |
|
29 | 29 | #include <QMenuBar> |
|
30 | 30 | #include <QMenu> |
|
31 | 31 | #include <QAction> |
|
32 | 32 | #include <QDockWidget> |
|
33 | 33 | #include <QTranslator> |
|
34 | 34 | #include <QSplitter> |
|
35 | 35 | #include "dockablepluginmanager.h" |
|
36 | 36 | #include <socexplorerproxy.h> |
|
37 | 37 | #include "PyWdgt/pythonconsole.h" |
|
38 | 38 | #include "aboutsocexplorer.h" |
|
39 | 39 | #include "toolbar.h" |
|
40 | 40 | #include "regsExplorer/regsexplorer.h" |
|
41 | 41 | |
|
42 |
class |
|
|
42 | class SocExplorerMainWindow : public QMainWindow | |
|
43 | 43 | { |
|
44 | 44 | Q_OBJECT |
|
45 | 45 | |
|
46 | 46 | public: |
|
47 |
|
|
|
48 |
~ |
|
|
47 | SocExplorerMainWindow(QString ScriptToEval,QWidget *parent = 0); | |
|
48 | ~SocExplorerMainWindow(); | |
|
49 | 49 | QAction* Quit,*LoadPlugin,*ManagePlugins,*help,*regsManager,*exploreRegs,*about,*translateAction; |
|
50 | 50 | QActionGroup*langActionGrp; |
|
51 | 51 | QMenu* FileMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu; |
|
52 | 52 | QTranslator* appTranslator; |
|
53 | 53 | void createLangMenu(); |
|
54 | 54 | void closeEvent(QCloseEvent *event); |
|
55 | 55 | toolBar* toolpane; |
|
56 | 56 | |
|
57 | 57 | |
|
58 | 58 | public slots: |
|
59 | 59 | void launchPluginManager(); |
|
60 | 60 | void addPluginInterface(QDockWidget* plugin); |
|
61 | 61 | void removePluginInterface(QDockWidget* plugin); |
|
62 | 62 | void clearMenu(); |
|
63 | 63 | void updateText(); |
|
64 | 64 | void setLangage(QAction* action); |
|
65 | 65 | void showAboutBox(); |
|
66 | 66 | void pluginselected(const QString& instanceName); |
|
67 | 67 | |
|
68 | 68 | signals: |
|
69 | 69 | void translateSig(); |
|
70 | 70 | void registerObject(QObject* object,const QString& instanceName); |
|
71 | 71 | |
|
72 | 72 | private: |
|
73 | 73 | void makeObjects(QString ScriptToEval); |
|
74 | 74 | void makeLayout(); |
|
75 | 75 | void makeConnections(); |
|
76 | 76 | void makeMenu(); |
|
77 | 77 | QMainWindow* pluginsDockContainer; |
|
78 | 78 | QSplitter* mainWidget; |
|
79 | 79 | PythonConsole* PythonConsoleInst; |
|
80 | 80 | dockablePluginManager* pluginManager; |
|
81 | 81 | regsExplorer* regExplorer; |
|
82 | 82 | aboutsocexplorer* p_about; |
|
83 | 83 | QList<QDockWidget*>* p_pluginGUIlist; |
|
84 | 84 | }; |
|
85 | 85 | |
|
86 | 86 | #endif // MAINWINDOW_H |
@@ -1,55 +1,55 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef REGSEXPLORER_H |
|
23 | 23 | #define REGSEXPLORER_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | 26 | #include <QTabWidget> |
|
27 | 27 | #include <QDockWidget> |
|
28 | 28 | #include "regsexplorercfg.h" |
|
29 | 29 | #include "regsviewer.h" |
|
30 | 30 | #include <QGridLayout> |
|
31 | 31 | #include <socexplorerengine.h> |
|
32 | 32 | #include <peripheralwidget.h> |
|
33 | 33 | #include <socregsviewer.h> |
|
34 | 34 | |
|
35 | 35 | class regsExplorer : public QDockWidget |
|
36 | 36 | { |
|
37 | 37 | Q_OBJECT |
|
38 | 38 | public: |
|
39 | 39 | explicit regsExplorer(QWidget *parent = 0); |
|
40 | 40 | |
|
41 | 41 | signals: |
|
42 | 42 | |
|
43 | 43 | public slots: |
|
44 | 44 | |
|
45 | 45 | void addDev(socExplorerEnumDevice* device); |
|
46 | 46 | |
|
47 | 47 | private: |
|
48 | 48 | QTabWidget* mainWidget; |
|
49 | 49 | regsExplorerCfg* cfg; |
|
50 | 50 | socRegsViewer* socViewer; |
|
51 | 51 | |
|
52 | 52 | |
|
53 | 53 | }; |
|
54 | 54 | |
|
55 | 55 | #endif // REGSEXPLORER_H |
@@ -1,40 +1,40 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef REGSVIEWER_H |
|
23 | 23 | #define REGSVIEWER_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | 26 | #include <QScrollArea> |
|
27 | 27 | |
|
28 | 28 | class regsViewer : public QScrollArea |
|
29 | 29 | { |
|
30 | 30 | Q_OBJECT |
|
31 | 31 | public: |
|
32 | 32 | explicit regsViewer(QWidget *parent = 0); |
|
33 | 33 | |
|
34 | 34 | signals: |
|
35 | 35 | |
|
36 | 36 | public slots: |
|
37 | 37 | |
|
38 | 38 | }; |
|
39 | 39 | |
|
40 | 40 | #endif // REGSVIEWER_H |
@@ -1,57 +1,57 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef SOCEXPLORER_H |
|
23 | 23 | #define SOCEXPLORER_H |
|
24 | 24 | |
|
25 | 25 | #ifdef WIN32 |
|
26 | 26 | #ifdef SOCEXPLORER_EXPORTS |
|
27 | 27 | #define SOCEXPLORER_EXPORT __declspec(dllexport) |
|
28 | 28 | #else |
|
29 | 29 | #define SOCEXPLORER_EXPORT __declspec(dllimport) |
|
30 | 30 | #endif |
|
31 | 31 | #else |
|
32 | 32 | #define SOCEXPLORER_EXPORT |
|
33 | 33 | #endif |
|
34 | 34 | |
|
35 | 35 | #ifdef WIN32 |
|
36 | 36 | #include <stdlib.h> |
|
37 | 37 | #define socexplorerBswap32(X) _byteswap_ulong(X) |
|
38 | 38 | #else |
|
39 | 39 | #ifdef UNIX |
|
40 | 40 | #include <byteswap.h> |
|
41 | 41 | #define socexplorerBswap32(X) bswap_32(X) |
|
42 | 42 | #endif |
|
43 | 43 | #endif |
|
44 | 44 | |
|
45 | 45 | |
|
46 | 46 | #ifdef WIN32 |
|
47 | 47 | #define SOCEXPLORER_PLUGINS_INSTALL_PATH qApp->applicationDirPath()+"/plugins" |
|
48 | 48 | #define SOCEXPLORER_CONFIG_PATH qApp->applicationDirPath()+"/config" |
|
49 | 49 | #define PYMODULES qApp->applicationDirPath()+"/python" |
|
50 | 50 | #else |
|
51 | 51 | #ifdef UNIX |
|
52 | 52 | #define SOCEXPLORER_PLUGINS_INSTALL_PATH QDir::homePath()+"/.SocExplorer/plugins" |
|
53 | 53 | #define SOCEXPLORER_CONFIG_PATH QDir::homePath()+"/.SocExplorer/config" |
|
54 | 54 | #define PYMODULES "/etc/SocExplorer/python" |
|
55 | 55 | #endif |
|
56 | 56 | #endif |
|
57 | 57 | #endif // SOCEXPLORER_H |
@@ -1,43 +1,43 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef TOOLBAR_H |
|
23 | 23 | #define TOOLBAR_H |
|
24 | 24 | |
|
25 | 25 | #include <QDockWidget> |
|
26 | 26 | #include "toolbarcontainer.h" |
|
27 | 27 | class toolBar : public QDockWidget |
|
28 | 28 | { |
|
29 | 29 | Q_OBJECT |
|
30 | 30 | public: |
|
31 | 31 | explicit toolBar(QWidget *parent = 0); |
|
32 | 32 | |
|
33 | 33 | signals: |
|
34 | 34 | |
|
35 | 35 | |
|
36 | 36 | public slots: |
|
37 | 37 | void addTool(QDockWidget* widget); |
|
38 | 38 | private: |
|
39 | 39 | toolBarContainer* toolsContainer; |
|
40 | 40 | |
|
41 | 41 | }; |
|
42 | 42 | |
|
43 | 43 | #endif // TOOLBAR_H |
@@ -1,39 +1,39 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 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 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef TOOLBARCONTAINER_H |
|
23 | 23 | #define TOOLBARCONTAINER_H |
|
24 | 24 | |
|
25 | 25 | #include <QMainWindow> |
|
26 | 26 | |
|
27 | 27 | class toolBarContainer : public QMainWindow |
|
28 | 28 | { |
|
29 | 29 | Q_OBJECT |
|
30 | 30 | public: |
|
31 | 31 | explicit toolBarContainer(QWidget *parent = 0); |
|
32 | 32 | |
|
33 | 33 | signals: |
|
34 | 34 | |
|
35 | 35 | public slots: |
|
36 | 36 | |
|
37 | 37 | }; |
|
38 | 38 | |
|
39 | 39 | #endif // TOOLBARCONTAINER_H |
General Comments 0
You need to be logged in to leave comments.
Login now