##// END OF EJS Templates
Moved xml soc description in /usr/share/SocExplorer.
Jeandet Alexis -
r66:a991e131f5a8 default
parent child
Show More
@@ -1,88 +1,89
1 1 #-------------------------------------------------
2 2 #
3 3 # Project created by QtCreator 2011-09-19T22:52:10
4 4 #
5 5 #-------------------------------------------------
6 6
7 7 TEMPLATE = subdirs
8 8 CONFIG += ordered release
9 9
10 10 SUBDIRS = \
11 11 src/common \
12 12 src/SocExplorerEngine \
13 13 src \
14 14 src/SocExplorer_TCP_Terminal
15 15
16 16
17 17 socexplorercfg.path = $$[QT_INSTALL_PREFIX]/mkspecs/features
18 18 socexplorercfg.files = \
19 19 src/SocExplorerEngine/plugins/socexplorerplugin.prf
20 20
21 21
22 22 unix{
23 23 SocExplorer.path = /usr/share/applications/
24 24 SocExplorer.files = unixcfg/SocExplorer.desktop
25 25 PluginConfPath.path = /etc/SocExplorer/plugin.conf.d/
26 26 PluginConfPath.files = unixcfg/plugins.conf
27 icon.path = /usr/share/SocExplorer
28 icon.files = ressources/images/Indiana_Jones_cappello.png
27 share.path = /usr/share/SocExplorer
28 share.files = ressources/images/Indiana_Jones_cappello.png \
29 ressources/Grlib.xml
29 30 Wizard.path = /usr/share/qtcreator/templates/wizards/SocExplorerPlugin
30 31 Wizard.files = Qt_Creator_Wizard/SocExplorerPlugin/logo-lpp-cutted.png \
31 32 Qt_Creator_Wizard/SocExplorerPlugin/plugin.cpp \
32 33 Qt_Creator_Wizard/SocExplorerPlugin/plugin.h \
33 34 Qt_Creator_Wizard/SocExplorerPlugin/project.pro \
34 35 Qt_Creator_Wizard/SocExplorerPlugin/wizard.xml
35 INSTALLS+=Wizard SocExplorer icon PluginConfPath
36 INSTALLS+=Wizard SocExplorer share PluginConfPath
36 37 }
37 38 INSTALLS+=socexplorercfg
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
52 53
53 54
54 55
55 56
56 57
57 58
58 59
59 60
60 61
61 62
62 63
63 64
64 65
65 66
66 67
67 68
68 69
69 70
70 71
71 72
72 73
73 74
74 75
75 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
@@ -1,105 +1,105
1 1 #include "xmldriver.h"
2 2 #include <socexplorerengine.h>
3 3 #include <QFile>
4 4 #include <QDebug>
5 5
6 6 XMLDriver::XMLDriver(QObject *parent) :
7 7 QObject(parent)
8 8 {
9 9 this->xmlFiles = new QList<xmlfile*>();
10 10 this->scanXmlFiles();
11 11 }
12 12
13 13 int XMLDriver::checkXmlFile(const QString &fileName)
14 14 {
15 15 QDomDocument document;
16 16 QFile file( fileName );
17 17 if( !file.open( QIODevice::ReadOnly ) )
18 18 return 0;
19 19 document.setContent(&file);
20 20 if(document.isNull())
21 21 return 0;
22 22 file.close();
23 23 return 1;
24 24 }
25 25
26 26 int XMLDriver::createXmlFile(const QString &fileName)
27 27 {
28 28 QDomDocument* xmlDoc=new QDomDocument();
29 29 QDomProcessingInstruction header = xmlDoc->createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"utf-8\"" );
30 30 xmlDoc->appendChild( header );
31 31 QDomElement rootnode= xmlDoc->createElement("socExplorerXml");
32 32 rootnode.setAttribute("name",fileName);
33 33 xmlDoc->appendChild(rootnode);
34 34 QFile file( fileName );
35 35 if(!file.exists())
36 36 {
37 37 if( !file.open( QIODevice::WriteOnly ) )
38 38 return 0;
39 39 QTextStream ts( &file );
40 40 ts << xmlDoc->toString();
41 41 file.close();
42 42 return 1;
43 43 }
44 44 return 0;
45 45 }
46 46
47 47 QList<xmlfile *> XMLDriver::getFileList(const QString &tagNameFilter)
48 48 {
49 49 QList<xmlfile*> list;
50 50 for(int i=0;i<xmlFiles->count();i++)
51 51 {
52 52 if(xmlFiles->at(i)->rootTagName()==tagNameFilter)
53 53 {
54 54 list.append(xmlFiles->at(i));
55 55 }
56 56 }
57 57 return list;
58 58 }
59 59
60 60 QList<QDomNodeList> XMLDriver::getAllNodes(const QString &tagName)
61 61 {
62 62 QList<QDomNodeList> list;
63 63 for(int i=0;i<xmlFiles->count();i++)
64 64 {
65 65 QDomNodeList nodes=xmlFiles->at(i)->getRootElement()->elementsByTagName(tagName);
66 66 if(!nodes.isEmpty())
67 67 {
68 68 list.append(nodes);
69 69 }
70 70 }
71 71 return list;
72 72 }
73 73
74 74 void XMLDriver::registerXmlFile(const QString &fileName)
75 75 {
76 76 for(int i=0;i<xmlFiles->count();i++)
77 77 {
78 78 if(xmlFiles->at(i)->fileName()==fileName)
79 79 {
80 80 return;
81 81 }
82 82 }
83 83 xmlFiles->append(new xmlfile(fileName));
84 84 }
85 85
86 86 void XMLDriver::scanXmlFiles()
87 87 {
88 QDir configDir(SocExplorerEngine::configFolder());
89 QFileInfoList list = configDir.entryInfoList();
88 QDir shareDir(SocExplorerEngine::sharePath());
89 QFileInfoList list = shareDir.entryInfoList();
90 90 for (int i = 0; i < list.size(); ++i)
91 91 {
92 92 QFileInfo fileInfo = list.at(i);
93 93 if(fileInfo.isFile())
94 94 {
95 95 if(fileInfo.fileName().contains(".xml") && !fileInfo.fileName().contains(".xml~"))
96 96 {
97 97 qDebug()<<"Found " + fileInfo.fileName();
98 98 if(checkXmlFile(fileInfo.absoluteFilePath()))
99 99 {
100 100 registerXmlFile(fileInfo.absoluteFilePath());
101 101 }
102 102 }
103 103 }
104 104 }
105 105 }
@@ -1,137 +1,138
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 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 class SOCEXPLORER_SDK_EXPORT SocExplorerAutoProgressBar
53 53 {
54 54 public:
55 55 SocExplorerAutoProgressBar(QProgressBar* progressBar=NULL)
56 56 {
57 57 this->p_progressbar=progressBar;
58 58 }
59 59 ~SocExplorerAutoProgressBar()
60 60 {
61 61 if(p_progressbar)
62 62 {
63 63 delete p_progressbar;
64 64 }
65 65 }
66 66 void setProgressBar(QProgressBar* progressBar)
67 67 {
68 68 this->p_progressbar=progressBar;
69 69 }
70 70 void setValue(int value)
71 71 {
72 72 p_progressbar->setValue(value);
73 73 }
74 74 private:
75 75 QProgressBar* p_progressbar;
76 76 };
77 77
78 78 //! SocExplorerEngine is a pure static class which aims to provide services for both SocExplorer software and plugins.
79 79
80 80 class SOCEXPLORER_SDK_EXPORT SocExplorerEngine : public QObject
81 81 {
82 82 Q_OBJECT
83 83 private:
84 84 static SocExplorerEngine* _self;
85 85 SocExplorerEngine(QObject *parent = 0);
86 86 static void init();
87 87
88 88 public:
89 89 static SocExplorerEngine* self(){ if(!_self){_self= new SocExplorerEngine;}return _self;}
90 90 //! Return the configuration folder path, OS dependant.
91 91 SOCEXPLORER_SDK_EXPORT static QString configFolder();
92 92 //! Return the default plugin folder path, OS dependant.
93 93 //static QString pluginFolder(){return QString(SOCEXPLORER_PLUGINS_INSTALL_PATH);}
94 94 static QStringList pluginFolders();
95 95 static QString configPath(){return QString(SOCEXPLORER_CONFIG_PATH);}
96 static QString sharePath(){return QString(SOCEXPLORER_SHARE_PATH);}
96 97 static int addEnumDevice(socexplorerplugin* rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name);
97 98 static QList<SOCModel*>* getSOCs();
98 99 static QString getDevName(int VID, int PID);
99 100 static QString SocExplorerVersion();
100 101 static QString SocExplorerChangeset();
101 102 static QString SocExplorerBranch();
102 103 static socExplorerXmlModel* xmlModel();
103 104 static void setMainWindow(QMainWindow* Mainwindow);
104 105 static QProgressBar* getProgressBar(const QString &format, int max);
105 106 static void deleteProgressBar(QProgressBar* progressBar);
106 107 static void addSOC(socexplorerplugin* rootPlugin);
107 108 static void removeSOC(socexplorerplugin* rootPlugin);
108 109 static void message(socexplorerplugin* sender,const QString& message,int debugLevel=0);
109 110 static void setLogLevel(int level);
110 111 signals:
111 112 void enumDeviceAdded(socExplorerEnumDevice* device);
112 113 public slots:
113 114 QString getSocExplorerVersion(){return SocExplorerEngine::SocExplorerVersion();}
114 115 QString getSocExplorerChangeset(){return SocExplorerEngine::SocExplorerChangeset();}
115 116 QString getSocExplorerBranch(){return SocExplorerEngine::SocExplorerBranch();}
116 117 qint32 getEnumDeviceBaseAddress(const QString& rootPlugin,int VID,int PID,int count=0);
117 118 qint32 getEnumDeviceBaseAddress(socexplorerplugin* plugin,int VID,int PID,int count=0);
118 119 qint32 getEnumDeviceCount(socexplorerplugin* plugin,int VID,int PID);
119 120 qint32 getEnumDeviceCount(const QString& rootPlugin,int VID,int PID);
120 121 int addEnumDevice(const QString& rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name);
121 122
122 123 private:
123 124 static SOCModel* plugin2Soc(socexplorerplugin* plugin);
124 125 static socExplorerXmlModel* p_xmlmodel;
125 126 static QMainWindow* mainWindow;
126 127 static QList<SOCModel*>* SOCs;
127 128 static int loglvl;
128 129 };
129 130
130 131 #endif // SOCEXPLORERENGINE_H
131 132
132 133
133 134
134 135
135 136
136 137
137 138
@@ -1,71 +1,72
1 1
2 2
3 3 win32 {
4 4 DEFINES += WIN32
5 5 DEFINES += WINTRANSLATIONPATH
6 6 DEFINES += SOCEXPLORER_TRANSLATION_PATH="\"\\\"./translations"\\\"\"
7 7 SOCEXPLORER_TRANSLATION_INSTALL_PATH = translations
8 8 SOCEXPLORER_INSTALL_PATH =
9 9 SOCEXPLORER_PLUGINS_INSTALL_PATH = $$SOCEXPLORER_PLUGIN_PATH
10 10 }
11 11
12 12 unix {
13 13 DEFINES += UNIX
14 14 DEFINES += UNIXTRANSLATIONPATH
15 15 DEFINES += SOCEXPLORER_TRANSLATION_PATH="\"\\\"/etc/SocExplorer/translations"\\\"\"
16 16 SOCEXPLORER_TRANSLATION_INSTALL_PATH = /etc/SocExplorer/translations
17 17 SOCEXPLORER_INSTALL_PATH = /usr/local/SocExplorer
18 18 SOCEXPLORER_PLUGINS_INSTALL_PATH = $$[QT_INSTALL_LIBS]"/SocExplorer/plugins"
19 19 DEFINES += SOCEXPLORER_CONFIG_PATH="\"\\\"/etc/SocExplorer"\\\"\"
20 DEFINES += SOCEXPLORER_SHARE_PATH="\"\\\"/usr/share/SocExplorer"\\\"\"
20 21 SOCEXPLORER_CONFIG_PATH=/etc/SocExplorer
21 22 }
22 23
23 24 isEmpty( SOCEXPLORER_SDK_BUILD ){
24 25 message( "building a plugin" )
25 26 QT += core gui xml
26 27 contains(QT_MAJOR_VERSION, 5) {
27 28 QT += widgets
28 29 }
29 30 CONFIG += pythonqt
30 31 TEMPLATE = lib
31 32 win32:CONFIG += dll
32 33 win32:CONFIG -= static
33 34 OBJECTS_DIR = obj
34 35 MOC_DIR = moc
35 36 DESTDIR = bin
36 37 # CONFIG(debug, debug|release) {
37 38 # DEBUG_EXT = _d
38 39 # } else {
39 40 # DEBUG_EXT =
40 41 # }
41 42 unix{
42 43 target.path = $${SOCEXPLORER_PLUGINS_INSTALL_PATH}
43 44 INSTALLS += target
44 45 LIBS+= -lsocexplorerengine$${DEBUG_EXT} -lsocexplorercommon$${DEBUG_EXT}
45 46 }
46 47 win32{
47 48 INCLUDEPATH += $$[QT_INSTALL_HEADERS]/SocExplorer/common/libelf
48 49 LIBS+=$$[QT_INSTALL_LIBS]/socexplorerengine$${DEBUG_EXT}.dll $$[QT_INSTALL_LIBS]/socexplorercommon$${DEBUG_EXT}.dll
49 50 }
50 51 DEFINES += SOCEXPLORER_LIBRARY
51 52
52 53 SOURCES += \
53 54 $$[QT_INSTALL_HEADERS]/SocExplorer/pluginsInterface/socexplorerplugininterface.cpp
54 55
55 56 HEADERS += \
56 57 $$[QT_INSTALL_HEADERS]/SocExplorer/genericPySysdriver.h \
57 58 $$[QT_INSTALL_HEADERS]/SocExplorer/socexplorerplugin.h
58 59
59 60 INCLUDEPATH += $$[QT_INSTALL_HEADERS]/SocExplorer/common \
60 61 $$[QT_INSTALL_HEADERS]/SocExplorer \
61 62 $$[QT_INSTALL_HEADERS]/SocExplorer/pluginsInterface
62 63
63 64
64 65 }else{
65 66 message( "building SocExplorer" )
66 67 HEADERS += \
67 68 $$[QT_INSTALL_HEADERS]/SocExplorer/genericPySysdriver.h \
68 69 $$[QT_INSTALL_HEADERS]/SocExplorer/socexplorerplugin.h
69 70 }
70 71
71 72
@@ -1,137 +1,138
1 1 #-------------------------------------------------
2 2 #
3 3 # Project created by QtCreator 2011-09-19T22:52:10
4 4 #
5 5 #-------------------------------------------------
6 6 SOCEXPLORER_ROOT = $${PWD}/..
7 7 include(../build_cfg/socexplorer.pri)
8 8
9 9 TARGET = socexplorer$${DEBUG_EXT}
10 10 TEMPLATE = app
11 11 CONFIG += pythonqt
12 12
13 13
14 14 QMAKE_LFLAGS_RELEASE += --enable-auto-import -mstackrealign
15 15 QMAKE_LFLAGS_DEBUG += --enable-auto-import -mstackrealign
16 16
17 17 include ( common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer.pri )
18 18 include ( SocExplorerEngine/pythonQtOut/generated_cpp/PySocExplorerEngine/PySocExplorerEngine.pri )
19 19 include ( SocExplorerEngine/plugins/socexplorerplugin.prf )
20 20
21 21 INCLUDEPATH+=$${PWD} \
22 22 $${PWD}/common \
23 23 $${PWD}/common/qhexedit \
24 24 $${PWD}/common/QCustomPlot \
25 25 $${PWD}/common/genericBinaryFiles \
26 26 $${PWD}/common/genericBinaryFiles/elf \
27 27 $${PWD}/common/genericBinaryFiles/srec \
28 28 $${PWD}/common/genericBinaryFiles/BinFile \
29 29 SocExplorerEngine/engine \
30 30 SocExplorerEngine/pluginloader \
31 31 SocExplorerEngine/pluginsInterface \
32 32 SocExplorerEngine/proxy \
33 33 SocExplorerEngine/pluginManagerWdgt \
34 34 SocExplorerEngine/plugins \
35 35 SocExplorerEngine/RegisterMVS \
36 36 SocExplorerEngine/XmlEngine \
37 37 SocExplorerEngine/SOC \
38 38 SocExplorerEngine/PeripheralWidget/src
39 39
40 40 win32:INCLUDEPATH+= \
41 41 $${PWD}/common/genericBinaryFiles/elf/libelfWin32/include \
42 42 $${PWD}/common/genericBinaryFiles/elf/libelfWin32/include/libelf \
43 43
44 44
45 45 RC_FILE = ../win32cfg/socexplorer.rc
46 46
47 47
48 48 unix:LIBS+=-L$${SOCEXPLORER_ROOT}/bin/linux -lsocexplorercommon$${DEBUG_EXT} -L$${SOCEXPLORER_ROOT}/bin/linux -lsocexplorerengine$${DEBUG_EXT}
49 49
50 50 win32-g++:LIBS += $${SOCEXPLORER_ROOT}/bin/win32/socexplorercommon$${DEBUG_EXT}.dll $${SOCEXPLORER_ROOT}/bin/win32/socexplorerengine$${DEBUG_EXT}.dll
51 51
52 52
53 53 unix{
54 54 translation.files = $${SOCEXPLORER_ROOT}/translations/socexplorer_fr.qm \
55 55 $${SOCEXPLORER_ROOT}/translations/socexplorer_en.qm
56 56 translation.path = $${SOCEXPLORER_TRANSLATION_INSTALL_PATH}
57 57 target.path = /usr/bin
58 58 INSTALLS += translation target
59 59 }
60 60
61 61 header.path = $$[QT_INSTALL_HEADERS]/SocExplorer/common
62 62 header.files = \
63 63 socexplorer.h
64 64 INSTALLS += header
65 65
66 66
67 67 SOURCES += main.cpp\
68 68 mainwindow.cpp \
69 69 PyWdgt/pythonconsole.cpp \
70 70 PyWdgt/pythonqtscriptingconsoledandd.cpp \
71 71 dockablepluginmanager.cpp \
72 72 toolbar.cpp \
73 73 toolbarcontainer.cpp \
74 74 regsExplorer/regsexplorer.cpp \
75 75 regsExplorer/regsviewer.cpp \
76 76 regsExplorer/regsexplorercfg.cpp \
77 77 aboutsocexplorer.cpp
78 78
79 79 # regWidget/xmltagtextedit.cpp \
80 80 # regWidget/xmltaglabeledit.cpp \
81 81 # regWidget/xmlelementslistwidget.cpp \
82 82 # regWidget/xmlelementslistview.cpp \
83 83 # regWidget/regpropeditor.cpp \
84 84 # regWidget/registerwdgt.cpp \
85 85 # regWidget/registereditor.cpp \
86 86 # regWidget/registercel.cpp \
87 87 # regWidget/periphpropeditor.cpp \
88 88 # regWidget/peripherialregs.cpp \
89 89 # regWidget/bitfieldpropeditor.cpp \
90 90 # regWidget/bitfield.cpp
91 91
92 92
93 93 HEADERS += mainwindow.h \
94 94 PyWdgt/pythonconsole.h \
95 95 PyWdgt/pythonqtscriptingconsoledandd.h \
96 96 dockablepluginmanager.h \
97 97 toolbar.h \
98 98 toolbarcontainer.h \
99 99 regsExplorer/regsexplorer.h \
100 100 regsExplorer/regsviewer.h \
101 101 regsExplorer/regsexplorercfg.h \
102 102 socexplorer.h \
103 103 SocExplorerEngine/plugins/socexplorerplugin.h \
104 104 aboutsocexplorer.h
105 105 # regWidget/xmltagtextedit.h \
106 106 # regWidget/xmltaglabeledit.h \
107 107 # regWidget/xmlelementslistwidget.h \
108 108 # regWidget/xmlelementslistview.h \
109 109 # regWidget/regpropeditor.h \
110 110 # regWidget/registerwdgt.h \
111 111 # regWidget/registereditor.h \
112 112 # regWidget/registercel.h \
113 113 # regWidget/periphpropeditor.h \
114 114 # regWidget/peripherialregs.h \
115 115 # regWidget/bitfieldpropeditor.h \
116 116 # regWidget/bitfield.h
117 117
118 118
119 119 include ( NicePyConsole/NicePyConsole.pri)
120 120
121 121 win32{
122 122 RESOURCES = ../ressources/SocExplorer.qrc
123 123 }
124 124
125 125 unix{
126 126 RESOURCES = ../ressources/SocExplorer.qrc
127 127 }
128 128
129 129 TRANSLATIONS = ../translations/socexplorer_fr.ts \
130 130 ../translations/socexplorer_en.ts
131 131
132 132
133 133
134 134
135 135
136 136
137 137
138
General Comments 0
You need to be logged in to leave comments. Login now