##// END OF EJS Templates
Pre-0.7 partially back-ported.
Alexis Jeandet -
r106:7598f3bdb8ba 0.6
parent child
Show More
@@ -1,4 +1,4
1 1cb664ab4bb3c531d706b1948a378ed9810c0dda src/SocExplorerEngine/PeripheralWidget
1 1cb664ab4bb3c531d706b1948a378ed9810c0dda src/SocExplorerEngine/PeripheralWidget
2 1f143e4ae72a0bb4832b546eb76eb50e94049b80 src/common/genericBinaryFiles
2 1f143e4ae72a0bb4832b546eb76eb50e94049b80 src/common/genericBinaryFiles
3 2dce25b198558be573f56c1cf337aa95ddd666d6 src/common/lppserial
3 2b353bf8243cbfb3db44e196f33bd164c11c9949 src/common/lppserial
4 923afde9cc96bb419cf898560d080ec96991aeca src/common/qhexedit
4 923afde9cc96bb419cf898560d080ec96991aeca src/common/qhexedit
@@ -430,6 +430,23 generic is set to 2. Reset value: ‘0’."/>
430 <bitField name="DATA" size="32" mode="1" desc=""/>
430 <bitField name="DATA" size="32" mode="1" desc=""/>
431 </register>
431 </register>
432 </peripheral>
432 </peripheral>
433 <peripheral vid="1" name="SDCTRL" pid="9">
434 <register name="configuration" addOffset="0">
435 <bitField size="1" name="Refresh" offset="31" mode="3" desc="SDRAM refresh. If set, the SDRAM refresh will be enabled."/>
436 <bitField size="1" name="tRP" offset="30" mode="3" desc="SDRAM tRP timing. tRP will be equal to 2 or 3 system clocks (0/1). When mobile SDRAM support is enabled, this bit also represent the MSB in the tRFC timing."/>
437 <bitField name="tRFC" size="3" offset="27" mode="3" desc="SDRAM tRFC timing. tRFC will be equal to 3 + field-value system clocks. When mobile SDRAM support is enabled, this field is extended with the bit 30."/>
438 <bitField name="tCD" size="1" offset="26" mode="3" desc="SDRAM CAS delay. Selects 2 or 3 cycle CAS delay (0/1). When changed, a LOAD-COMMAND-REGISTER command must be issued at the same time. Also sets RAS/CAS delay (tRCD)."/>
439 <bitField name="SDRAM bank size" offset="23" size="3" mode="3" desc="SDRAM banks size. Defines the decoded memory size for each SDRAM chip select: “000”= 4 Mbyte, “001”= 8 Mbyte, “010”= 16 Mbyte .... “111”= 512 Mbyte."/>
440 <bitField name="SDRAM col. size" offset="21" size="2" mode="3" desc="SDRAM column size. “00”=256, “01”=512, “10”=1024, “11”=2048 except when bit[25:23]= ̆111 ̆then ̆11 ̆=4096"/>
441 <bitField name="SDRAM command" offset="18" size="3" mode="3" desc="SDRAM command. Writing a non-zero value will generate an SDRAM command: “010”=PRE-CHARGE, “100”=AUTO-REFRESH, “110”=LOAD-COMMAND-REGISTER, “111”=LOAD-EXTENDED-COMMAND-REGISTER. The field is reset after command has been executed."/>
442 <bitField name="Page-Burst" offset="17" size="1" mode="3" desc="1 = pageburst is used for read operations, 0 = line burst of length 8 is used for read operations. (Only available when VHDL generic pageburst i set to 2)"/>
443 <bitField name="MS" offset="16" size="1" mode="3" desc="Mobile SDR support enabled. ‘1’ = Enabled, ‘0’ = Disabled (read-only)"/>
444 <bitField name="D64" offset="15" size="1" mode="3" desc="64-bit data bus (D64) - Reads ‘1’ if memory controller is configured for 64-bit data bus, otherwise‘0’. Read-only."/>
445 <bitField name="SDRAM refresh load value" offset="0" size="15" mode="3" desc="The period between each AUTO-REFRESH command - Calculated as follows: tREFRESH = ((reload value) + 1) / SYSCLK"/>
446 </register>
447 <register name="Power-Saving configuration" addOffset="4">
448 </register>
449 </peripheral>
433 </soc>
450 </soc>
434
451
435
452
@@ -15,7 +15,6 void PythonQt_init_PySocExplorerEngine(P
15 PythonConsole::PythonConsole(socexplorerproxy *proxy, QWidget *parent) :
15 PythonConsole::PythonConsole(socexplorerproxy *proxy, QWidget *parent) :
16 QWidget(parent)
16 QWidget(parent)
17 {
17 {
18 //PythonQt::init();
19 PythonQt::init(PythonQt::RedirectStdOut);
18 PythonQt::init(PythonQt::RedirectStdOut);
20 PythonQt_QtAll::init();
19 PythonQt_QtAll::init();
21 this->proxy = proxy;
20 this->proxy = proxy;
@@ -25,7 +24,6 PythonConsole::PythonConsole(socexplorer
25 this->console = new PythonQtScriptingConsoleDandD(NULL, PythonQt::self()->getMainModule());
24 this->console = new PythonQtScriptingConsoleDandD(NULL, PythonQt::self()->getMainModule());
26 this->mainlayout->addWidget(this->console);
25 this->mainlayout->addWidget(this->console);
27 this->setWindowTitle(tr("Python Scripting Console"));
26 this->setWindowTitle(tr("Python Scripting Console"));
28 this->bussdriver = 0;
29 this->setAcceptDrops(true);
27 this->setAcceptDrops(true);
30 this->setLayout(this->mainlayout);
28 this->setLayout(this->mainlayout);
31 connect(this->console,SIGNAL(pyConsoleRunFiles(QStringList)),this,SLOT(pyConsoleRunFiles(QStringList)));
29 connect(this->console,SIGNAL(pyConsoleRunFiles(QStringList)),this,SLOT(pyConsoleRunFiles(QStringList)));
@@ -45,13 +43,6 void PythonConsole::removeVariable(const
45 this->mainContext->removeVariable(name);
43 this->mainContext->removeVariable(name);
46 }
44 }
47
45
48
49 void PythonConsole::setBussDriver(socexplorerplugin *driver)
50 {
51 this->bussdriver = driver;
52 this->mainContext->addObject("buss", this->bussdriver);
53 }
54
55 void PythonConsole::registerObject(QObject* object,const QString& instanceName)
46 void PythonConsole::registerObject(QObject* object,const QString& instanceName)
56 {
47 {
57 this->mainContext->addObject(instanceName,object);
48 this->mainContext->addObject(instanceName,object);
@@ -72,13 +63,6 void PythonConsole::removeDriver(const Q
72 this->mainContext->removeVariable(instanceName);
63 this->mainContext->removeVariable(instanceName);
73 }
64 }
74
65
75 void PythonConsole::removeBussDriver()
76 {
77 this->bussdriver = 0;
78 this->mainContext->removeVariable("buss");
79 emit this->rootDriverDelete();
80 }
81
82
66
83 void PythonConsole::pyConsoleRunFiles(const QStringList & pathList)
67 void PythonConsole::pyConsoleRunFiles(const QStringList & pathList)
84 {
68 {
@@ -49,8 +49,6 public:
49 signals:
49 signals:
50 void rootDriverDelete();
50 void rootDriverDelete();
51 public slots:
51 public slots:
52 void setBussDriver(socexplorerplugin* driver);
53 void removeBussDriver();
54 void removeDriver(const QString& instanceName);
52 void removeDriver(const QString& instanceName);
55 void pyConsoleRunFiles(const QStringList&);
53 void pyConsoleRunFiles(const QStringList&);
56 void pyConsoleRunFile(const QString& fileName);
54 void pyConsoleRunFile(const QString& fileName);
@@ -63,11 +61,9 protected:
63
61
64 private:
62 private:
65 QHBoxLayout* mainlayout;
63 QHBoxLayout* mainlayout;
66 socexplorerplugin* bussdriver;
67 PythonQtScriptingConsoleDandD* console;
64 PythonQtScriptingConsoleDandD* console;
68 PythonQtObjectPtr* mainContext;
65 PythonQtObjectPtr* mainContext;
69 socexplorerproxy* proxy;
66 socexplorerproxy* proxy;
70 //LPMONMainWindow* mainwin;
71 };
67 };
72
68
73 #endif // PYTHONCONSOLE_H
69 #endif // PYTHONCONSOLE_H
@@ -67,7 +67,11 header.files = engine/socexplorerengine.
67 PeripheralWidget/src/registerwidget.h \
67 PeripheralWidget/src/registerwidget.h \
68 PeripheralWidget/src/socregsviewer.h \
68 PeripheralWidget/src/socregsviewer.h \
69 PeripheralWidget/src/socregsviewernew.h \
69 PeripheralWidget/src/socregsviewernew.h \
70 memtester/memtester.h
70 memtester/memtester.h \
71 engine/socexplorersettings.h \
72 engine/socexplorersettingsdialog.h \
73 engine/socexplorergui.h\
74 engine/socexplorerconfigkeys.h
71
75
72
76
73
77
@@ -125,7 +129,11 HEADERS += \
125 PySocExplorerEngine.h \
129 PySocExplorerEngine.h \
126 memtester/memtester.h\
130 memtester/memtester.h\
127 PeripheralWidget/src/socregsviewernew.h \
131 PeripheralWidget/src/socregsviewernew.h \
128 PeripheralWidget/src/collapsableperipheralwidget.h
132 PeripheralWidget/src/collapsableperipheralwidget.h \
133 engine/socexplorersettings.h \
134 engine/socexplorersettingsdialog.h \
135 engine/socexplorergui.h \
136 engine/socexplorerconfigkeys.h
129
137
130
138
131
139
@@ -155,7 +163,10 SOURCES += \
155 plugins/socexplorerplugin.cpp \
163 plugins/socexplorerplugin.cpp \
156 memtester/memtester.cpp \
164 memtester/memtester.cpp \
157 PeripheralWidget/src/socregsviewernew.cpp \
165 PeripheralWidget/src/socregsviewernew.cpp \
158 PeripheralWidget/src/collapsableperipheralwidget.cpp
166 PeripheralWidget/src/collapsableperipheralwidget.cpp \
167 engine/socexplorersettings.cpp \
168 engine/socexplorersettingsdialog.cpp \
169 engine/socexplorergui.cpp
159
170
160
171
161 OTHER_FILES += \
172 OTHER_FILES += \
@@ -167,7 +178,8 OTHER_FILES += \
167
178
168 FORMS += \
179 FORMS += \
169 PeripheralWidget/src/socregsviewernew.ui \
180 PeripheralWidget/src/socregsviewernew.ui \
170 PeripheralWidget/src/collapsableperipheralwidget.ui
181 PeripheralWidget/src/collapsableperipheralwidget.ui \
182 engine/socexplorersettingsdialog.ui
171
183
172
184
173 RESOURCES += \
185 RESOURCES += \
@@ -21,13 +21,18
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "socexplorerengine.h"
22 #include "socexplorerengine.h"
23 #include <proxy/socexplorerproxy.h>
23 #include <proxy/socexplorerproxy.h>
24 #include <socexplorersettings.h>
25 #include <socexplorercoresettingsgui.h>
26 #include <socexplorerconfigkeys.h>
24
27
25 SocExplorerEngine* SocExplorerEngine::_self = NULL;
28 SocExplorerEngine* SocExplorerEngine::_self = NULL;
26 socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL;
29 socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL;
27 QMainWindow* SocExplorerEngine::mainWindow=NULL;
30 QMainWindow* SocExplorerEngine::mainWindow=NULL;
28 QList<SOCModel*>* SocExplorerEngine::SOCs=NULL;
31 QList<SOCModel*>* SocExplorerEngine::SOCs=NULL;
32 QSettings* SocExplorerEngine::m_settings=NULL;
29 int SocExplorerEngine::loglvl=1;
33 int SocExplorerEngine::loglvl=1;
30
34
35
31 SocExplorerEngine::SocExplorerEngine(QObject *parent) :
36 SocExplorerEngine::SocExplorerEngine(QObject *parent) :
32 QObject(parent)
37 QObject(parent)
33 {
38 {
@@ -35,7 +40,9 SocExplorerEngine::SocExplorerEngine(QOb
35 {
40 {
36 SOCs = new QList<SOCModel*>;
41 SOCs = new QList<SOCModel*>;
37 }
42 }
38
43 m_settings = new QSettings();
44 SocExplorerCoreSettingsGUI* cfggui=new SocExplorerCoreSettingsGUI();
45 SocExplorerSettings::registerConfigEntry(cfggui,QIcon(":/images/config.svg"),"SocExplorer Core");
39 }
46 }
40
47
41
48
@@ -88,6 +95,14 QStringList SocExplorerEngine::pluginFol
88 }
95 }
89 }
96 }
90 }
97 }
98 QStringList localCfg = SocExplorerSettings::value(SOCEXPLORERENGINE_SETTINGS_SCOPE,SOCEXPLORERENGINE_SETTINGS_PLUGINS_LOOKUP_PATH).toString().split(";");
99 QString dir;
100 foreach (dir, localCfg)
101 {
102 QDir plugDir(dir);
103 if(plugDir.exists())
104 folders.append(dir);
105 }
91 return folders;
106 return folders;
92 }
107 }
93
108
@@ -274,13 +289,29 void SocExplorerEngine::removeSOC(socexp
274 delete soc;
289 delete soc;
275 }
290 }
276
291
292
277 void SocExplorerEngine::message(socexplorerplugin *sender, const QString &message, int debugLevel)
293 void SocExplorerEngine::message(socexplorerplugin *sender, const QString &message, int debugLevel)
278 {
294 {
295 if(!_self)
296 init();
297 SocExplorerEngine::message(sender->instanceName(),message,debugLevel);
298 }
299
300 void SocExplorerEngine::message(QObject *sender, const QString &message, int debugLevel)
301 {
302 if(!_self)
303 init();
304 SocExplorerEngine::message(sender->objectName(),message,debugLevel);
305 }
306
307 void SocExplorerEngine::message(const QString &sender, const QString &message, int debugLevel)
308 {
279 // TODO add multi output message manager IE also log in files
309 // TODO add multi output message manager IE also log in files
310 static QTextStream SocExplorerEngineStdout(stdout);
280 if(!_self)
311 if(!_self)
281 init();
312 init();
282 if(loglvl>=debugLevel)
313 if(loglvl>=debugLevel)
283 qDebug()<< QTime::currentTime().toString()+" " + sender->instanceName()+":"+message;
314 SocExplorerEngineStdout << QTime::currentTime().toString()+" " + sender+":"+message << endl;
284 }
315 }
285
316
286 void SocExplorerEngine::setLogLevel(int level)
317 void SocExplorerEngine::setLogLevel(int level)
@@ -42,6 +42,7
42 #include <registerwidget.h>
42 #include <registerwidget.h>
43 #include <socmodel.h>
43 #include <socmodel.h>
44 #include <memtester.h>
44 #include <memtester.h>
45 #include <QSettings>
45
46
46 #if defined(SOCEXPLORER_SDK_BUILD)
47 #if defined(SOCEXPLORER_SDK_BUILD)
47 # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT
48 # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT
@@ -83,6 +84,7 class SOCEXPLORER_SDK_EXPORT SocExplorer
83 Q_OBJECT
84 Q_OBJECT
84 private:
85 private:
85 static SocExplorerEngine* _self;
86 static SocExplorerEngine* _self;
87 static QSettings* m_settings;
86 SocExplorerEngine(QObject *parent = 0);
88 SocExplorerEngine(QObject *parent = 0);
87 static void init();
89 static void init();
88
90
@@ -107,6 +109,8 public:
107 static void addSOC(socexplorerplugin* rootPlugin);
109 static void addSOC(socexplorerplugin* rootPlugin);
108 static void removeSOC(socexplorerplugin* rootPlugin);
110 static void removeSOC(socexplorerplugin* rootPlugin);
109 static void message(socexplorerplugin* sender,const QString& message,int debugLevel=0);
111 static void message(socexplorerplugin* sender,const QString& message,int debugLevel=0);
112 static void message(QObject* sender,const QString& message,int debugLevel=0);
113 static void message(const QString& sender,const QString& message,int debugLevel=0);
110 static void setLogLevel(int level);
114 static void setLogLevel(int level);
111 static bool isSocLitleEndian(socexplorerplugin* plugin);
115 static bool isSocLitleEndian(socexplorerplugin* plugin);
112 signals:
116 signals:
@@ -97,47 +97,3 void pluginmanagerWDGT::setChildLoadable
97
97
98
98
99
99
100 void pluginmanagerWDGT::addPlugin()
101 {
102 // /!\ TODO update it remove maximum operation from widget
103 // QString fileName = QFileDialog::getOpenFileName(this,tr("Open Plugin"), QDir::homePath(), tr("Plugin Files Files (*.dll *.so *.so.*)"));
104 // if(pluginloader::checklibrary(fileName))
105 // {
106 // QFile::copy(fileName,QString(SocExplorerEngine::pluginFolder())+"/"+ fileName.section('/',-1));
107 // }
108 // this->pluginTable->refreshPluginList();
109 }
110
111
112 void pluginmanagerWDGT::removePlugin()
113 {
114 // for(int i=0;i<this->pluginTable->selectedItems().count();i++)
115 // {
116 // QListWidgetItem* item = this->pluginTable->selectedItems().at(i);
117 // if(item!=NULL)
118 // {
119 // QFile::remove(QString(SocExplorerEngine::pluginFolder())+"/"+item->text());
120 // }
121 // }
122 // this->pluginTable->refreshPluginList();
123 }
124
125
126
127 void pluginmanagerWDGT::loadplugin()
128 {
129 // for(int i=0;i<this->pluginTable->selectedItems().count();i++)
130 // {
131 // QListWidgetItem* item = this->pluginTable->selectedItems().at(i);
132 // if(item!=NULL)
133 // {
134 // QString plugin = QString(SocExplorerEngine::pluginFolder())+"/"+item->text();
135 // emit this->loadSysDrviver(plugin);
136 // }
137 // }
138 // this->pluginTable->refreshPluginList();
139 }
140
141
142
143
@@ -66,11 +66,7 signals:
66 void pluginselected(const QString& instanceName);
66 void pluginselected(const QString& instanceName);
67
67
68 public slots:
68 public slots:
69 //void libselected(int row);
69
70 void addPlugin();
71 void removePlugin();
72 void loadplugin();
73 //void loadplugin(QListWidgetItem*);
74
70
75 private:
71 private:
76
72
@@ -13,6 +13,8
13 #ifdef SOCEXPLORER_CUSTOM_PLUGIN_LOADER
13 #ifdef SOCEXPLORER_CUSTOM_PLUGIN_LOADER
14 #include "unix/unixpluginloader.h"
14 #include "unix/unixpluginloader.h"
15 #endif
15 #endif
16 #include <socexplorerengine.h>
17 #include <socexplorersettings.h>
16
18
17 pluginloader* pluginloader::_self = NULL;
19 pluginloader* pluginloader::_self = NULL;
18 PluginsCache* pluginloader::_cache = NULL;
20 PluginsCache* pluginloader::_cache = NULL;
@@ -27,38 +29,6 pluginloader::pluginloader()
27 scanFolders();
29 scanFolders();
28 }
30 }
29
31
30
31 QStringList pluginloader::readFoldersList(const QStringList confFiles)
32 {
33 QDir testDir;
34 QStringList folders;
35 QFile confFile;
36 for(int i=0;i<confFiles.count();i++)
37 {
38 confFile.setFileName(confFiles.at(i));
39 if(confFile.exists())
40 {
41 if (confFile.open(QIODevice::ReadOnly | QIODevice::Text))
42 {
43 QTextStream in(&confFile);
44 QString line = in.readLine();
45 while (!line.isNull())
46 {
47 testDir.setPath(line);
48 if(testDir.exists())
49 {
50 if(!folders.contains(line))
51 folders << line;
52 }
53 line = in.readLine();
54 }
55 }
56 }
57 }
58 return folders;
59 }
60
61
62 void pluginloader::scanFolders()
32 void pluginloader::scanFolders()
63 {
33 {
64 QDir dir;
34 QDir dir;
@@ -74,6 +44,7 void pluginloader::scanFolders()
74 for (int i = 0; i < list.size(); ++i)
44 for (int i = 0; i < list.size(); ++i)
75 {
45 {
76 QFileInfo fileInfo = list.at(i);
46 QFileInfo fileInfo = list.at(i);
47 SocExplorerEngine::message("pluginloader::scanFolders","Checking "+ fileInfo.filePath(),3);
77 if(checklibrary(fileInfo.filePath())!=0)
48 if(checklibrary(fileInfo.filePath())!=0)
78 {
49 {
79 _cache->append(fileInfo.fileName(),fileInfo.path(),_getlibName(fileInfo.filePath()),_getlibPID(fileInfo.filePath()),_getlibPID(fileInfo.filePath()));
50 _cache->append(fileInfo.fileName(),fileInfo.path(),_getlibName(fileInfo.filePath()),_getlibPID(fileInfo.filePath()),_getlibPID(fileInfo.filePath()));
@@ -90,7 +61,7 int pluginloader::p_checklibraryQlib(con
90 lib->load();
61 lib->load();
91 if(!lib->isLoaded())
62 if(!lib->isLoaded())
92 {
63 {
93 qDebug()<<lib->errorString();
64 SocExplorerEngine::message("pluginloader::p_checklibraryQlib",lib->errorString(),3);
94 lib->~QLibrary();
65 lib->~QLibrary();
95 lib = new QLibrary(fileName);
66 lib = new QLibrary(fileName);
96 lib->load();
67 lib->load();
@@ -81,7 +81,6 private:
81 int p_checklibraryCustom(const QString fileName);
81 int p_checklibraryCustom(const QString fileName);
82 socexplorerplugin* p_newsocexplorerpluginQlib(const QString Name);
82 socexplorerplugin* p_newsocexplorerpluginQlib(const QString Name);
83 socexplorerplugin* p_newsocexplorerpluginCustom(const QString Name);
83 socexplorerplugin* p_newsocexplorerpluginCustom(const QString Name);
84 static QStringList readFoldersList(const QStringList confFiles);
85 static QString* _cacheLookup(const QString Name);
84 static QString* _cacheLookup(const QString Name);
86 static QString _getlibName(const QString fileName);
85 static QString _getlibName(const QString fileName);
87 static int _getlibPID(const QString fileName);
86 static int _getlibPID(const QString fileName);
@@ -1,5 +1,6
1 #include "pluginscache.h"
1 #include "pluginscache.h"
2 #include <QDebug>
2 #include <QDebug>
3 #include <socexplorerengine.h>
3
4
4 PluginsCacheItem::PluginsCacheItem(const QString &fileName, const QString &path, const QString &pluginName, int VID, int PID)
5 PluginsCacheItem::PluginsCacheItem(const QString &fileName, const QString &path, const QString &pluginName, int VID, int PID)
5 {
6 {
@@ -56,12 +57,12 void PluginsCache::append(const QString
56 {
57 {
57 if(this->items->at(i)->compare(item))
58 if(this->items->at(i)->compare(item))
58 {
59 {
59 qDebug()<< fileName << "already in the cache";
60 SocExplorerEngine::message("PluginsCache",fileName + " already in the cache",3);
60 delete item;
61 delete item;
61 return;
62 return;
62 }
63 }
63 }
64 }
64 qDebug()<< fileName << "added to cache";
65 SocExplorerEngine::message("PluginsCache",fileName + " added to cache",3);
65 this->items->append(item);
66 this->items->append(item);
66 }
67 }
67
68
@@ -1,15 +1,16
1 #include "unixpluginloader.h"
1 #include "unixpluginloader.h"
2 #include <stdio.h>
2 #include <stdio.h>
3 #include <QDebug>
3 #include <QDebug>
4 #include <socexplorerengine.h>
4
5
5 unixPluginLoader::unixPluginLoader(const QString &libPath)
6 unixPluginLoader::unixPluginLoader(const QString &libPath)
6 {
7 {
7 qDebug()<<"try to open "+libPath;
8 SocExplorerEngine::message("unixPluginLoader::unixPluginLoader","try to open "+libPath,3);
8 dlHandle = dlopen(libPath.toStdString().c_str(),RTLD_LAZY|RTLD_GLOBAL);
9 dlHandle = dlopen(libPath.toStdString().c_str(),RTLD_LAZY|RTLD_GLOBAL);
9 if(dlHandle==NULL)
10 if(dlHandle==NULL)
10 qDebug() << "Failed"<< dlerror();
11 SocExplorerEngine::message("unixPluginLoader::unixPluginLoader",QString("Failed ") + dlerror(),3);
11 else
12 else
12 qDebug() << "Success";
13 SocExplorerEngine::message("unixPluginLoader::unixPluginLoader","Success " ,3);
13 this->libPath = libPath;
14 this->libPath = libPath;
14 }
15 }
15
16
@@ -17,12 +18,12 void *unixPluginLoader::resolve(const QS
17 {
18 {
18 if(dlHandle!=NULL)
19 if(dlHandle!=NULL)
19 {
20 {
20 qDebug()<<"try to resolve "+symbol+" in "+libPath;
21 SocExplorerEngine::message("unixPluginLoader::resolve","try to resolve "+symbol+" in "+libPath ,3);
21 void* sym = dlsym (dlHandle, symbol.toStdString().c_str());
22 void* sym = dlsym (dlHandle, symbol.toStdString().c_str());
22 if(sym==NULL)
23 if(sym==NULL)
23 qDebug() << "Failed"<< dlerror();
24 SocExplorerEngine::message("unixPluginLoader::resolve",QString("Failed")+ dlerror() ,3);
24 else
25 else
25 qDebug() << "Success";
26 SocExplorerEngine::message("unixPluginLoader::resolve","Success",3);
26 return sym;
27 return sym;
27 }
28 }
28 return NULL;
29 return NULL;
@@ -33,6 +34,6 void unixPluginLoader::close()
33 if(dlHandle!=NULL)
34 if(dlHandle!=NULL)
34 {
35 {
35 dlclose(dlHandle);
36 dlclose(dlHandle);
36 qDebug() << dlerror();
37 SocExplorerEngine::message("unixPluginLoader::close",dlerror(),3);
37 }
38 }
38 }
39 }
@@ -108,6 +108,7 void socexplorerplugin::setInstanceName(
108 if(this->menu)
108 if(this->menu)
109 this->menu->setTitle(this->_instanceName);
109 this->menu->setTitle(this->_instanceName);
110 this->setWindowTitle(newName);
110 this->setWindowTitle(newName);
111 this->setObjectName(newName);
111 }
112 }
112
113
113 bool socexplorerplugin::dumpMemory(unsigned int address, unsigned int count, QString file)
114 bool socexplorerplugin::dumpMemory(unsigned int address, unsigned int count, QString file)
@@ -261,4 +262,3 bool socexplorerplugin::dumpMemory(unsig
261 return false;
262 return false;
262 }
263 }
263
264
264
@@ -85,6 +85,7 public:
85 //! Default plugin constructor, any plugin should call this constructor.
85 //! Default plugin constructor, any plugin should call this constructor.
86 socexplorerplugin(QWidget *parent = 0,bool createPyObject=true):QDockWidget(parent)
86 socexplorerplugin(QWidget *parent = 0,bool createPyObject=true):QDockWidget(parent)
87 {
87 {
88 Q_UNUSED(createPyObject)
88 closeAction=NULL;
89 closeAction=NULL;
89 menu=NULL;
90 menu=NULL;
90 ChildsMenu=NULL;
91 ChildsMenu=NULL;
@@ -156,10 +157,10 public slots:
156 virtual void setInstanceName(const QString& newName);
157 virtual void setInstanceName(const QString& newName);
157
158
158 virtual bool dumpMemory(unsigned int address,unsigned int count,QString file);
159 virtual bool dumpMemory(unsigned int address,unsigned int count,QString file);
160 virtual bool dumpMemory(unsigned int address,unsigned int count,QString file,const QString& format);
159 virtual bool memSet(unsigned int address,int value, unsigned int count);
161 virtual bool memSet(unsigned int address,int value, unsigned int count);
160 virtual bool loadbin(unsigned int address,QString file);
162 virtual bool loadbin(unsigned int address,QString file);
161 virtual bool loadfile(abstractBinFile* file);
163 virtual bool loadfile(abstractBinFile* file);
162 virtual bool dumpMemory(unsigned int address,unsigned int count,QString file,const QString& format);
163 QVariantList Read(unsigned int address, unsigned int count);
164 QVariantList Read(unsigned int address, unsigned int count);
164 void Write(unsigned int address, QList<QVariant> dataList);
165 void Write(unsigned int address, QList<QVariant> dataList);
165 socexplorerplugin* parentPlugin(){return this->parent;}
166 socexplorerplugin* parentPlugin(){return this->parent;}
@@ -32,6 +32,7 QList<socexplorerplugin*>* socexplorerpr
32 socexplorerplugin* socexplorerproxy::root=NULL;
32 socexplorerplugin* socexplorerproxy::root=NULL;
33 socexplorerplugin* socexplorerproxy::parent=NULL;
33 socexplorerplugin* socexplorerproxy::parent=NULL;
34 PluginsCache* socexplorerproxy::cache=NULL;
34 PluginsCache* socexplorerproxy::cache=NULL;
35 QStringList* socexplorerproxy::linearDriverPathList=NULL;
35
36
36 socexplorerproxy::socexplorerproxy(QObject *parent) :
37 socexplorerproxy::socexplorerproxy(QObject *parent) :
37 QObject(parent)
38 QObject(parent)
@@ -39,6 +40,7 socexplorerproxy::socexplorerproxy(QObje
39 cache = new PluginsCache;
40 cache = new PluginsCache;
40 drivers = new QList<socexplorerplugin*>;
41 drivers = new QList<socexplorerplugin*>;
41 linearDriverList=new QList<socexplorerplugin*>;
42 linearDriverList=new QList<socexplorerplugin*>;
43 linearDriverPathList=new QStringList;
42 root = NULL;
44 root = NULL;
43 }
45 }
44
46
@@ -50,6 +52,7 socexplorerproxy::socexplorerproxy(QMain
50 cache = new PluginsCache;
52 cache = new PluginsCache;
51 drivers = new QList<socexplorerplugin*>;
53 drivers = new QList<socexplorerplugin*>;
52 linearDriverList=new QList<socexplorerplugin*>;
54 linearDriverList=new QList<socexplorerplugin*>;
55 linearDriverPathList=new QStringList;
53 root = NULL;
56 root = NULL;
54 }
57 }
55
58
@@ -77,7 +80,7 void socexplorerproxy::loadSysDriver(con
77 {
80 {
78 socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name);
81 socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name);
79 QString driverName = _self->getinstanceName(driver->baseName());
82 QString driverName = _self->getinstanceName(driver->baseName());
80 loadSysDriver(driver,driverName);
83 loadSysDriver(driver,driverName,name);
81 }
84 }
82 }
85 }
83
86
@@ -87,18 +90,22 void socexplorerproxy::loadSysDriver(con
87 if(pluginloader::libcanberoot(name) && !_self->instanceExists(instanceName))
90 if(pluginloader::libcanberoot(name) && !_self->instanceExists(instanceName))
88 {
91 {
89 socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name);
92 socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name);
90 loadSysDriver(driver,instanceName);
93 loadSysDriver(driver,instanceName,name);
91 }
94 }
92 }
95 }
93
96
94
97
95 void socexplorerproxy::loadSysDriver(socexplorerplugin *driver, const QString instanceName)
98 void socexplorerproxy::loadSysDriver(socexplorerplugin *driver, const QString instanceName, const QString path)
96 {
99 {
97 if(!_self)init();
100 if(!_self)init();
98 driver->setInstanceName(instanceName);
101 driver->setInstanceName(instanceName);
99 driver->parent = NULL;
102 driver->parent = NULL;
100 drivers->append(driver);
103 drivers->append(driver);
101 linearDriverList->append(driver);
104 linearDriverList->append(driver);
105 if(path.isEmpty())
106 linearDriverPathList->append(driver->baseName());
107 else
108 linearDriverPathList->append(path);
102 connectChildToProxy(driver);
109 connectChildToProxy(driver);
103 emit _self->addPluginGUI(driver);
110 emit _self->addPluginGUI(driver);
104 emit _self->clearMenu();
111 emit _self->clearMenu();
@@ -117,7 +124,7 void socexplorerproxy::loadChildSysDrive
117 bool ok=true;
124 bool ok=true;
118 if(ok)
125 if(ok)
119 {
126 {
120 if(parent!=NULL)_self->loadSysDriverToParent(driver,parent,driverName);
127 if(parent!=NULL)_self->loadSysDriverToParent(driver,parent,driverName,child);
121 }
128 }
122 }
129 }
123 }
130 }
@@ -133,7 +140,7 void socexplorerproxy::loadSysDriverToPa
133 if(ok)
140 if(ok)
134 {
141 {
135 socexplorerplugin* parent=_self->getSysDriver(ParentInst);
142 socexplorerplugin* parent=_self->getSysDriver(ParentInst);
136 if(parent!=NULL)loadSysDriverToParent(driver,parent,driverName);
143 if(parent!=NULL)loadSysDriverToParent(driver,parent,driverName,name);
137 }
144 }
138 }
145 }
139 }
146 }
@@ -149,15 +156,19 void socexplorerproxy::loadSysDriverToPa
149 if(ok)
156 if(ok)
150 {
157 {
151 socexplorerplugin* parent=_self->getSysDriver(ParentInst);
158 socexplorerplugin* parent=_self->getSysDriver(ParentInst);
152 if(parent!=NULL)loadSysDriverToParent(driver,parent,instanceName);
159 if(parent!=NULL)loadSysDriverToParent(driver,parent,instanceName,name);
153 }
160 }
154 }
161 }
155 }
162 }
156
163
157 void socexplorerproxy::loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName)
164 void socexplorerproxy::loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName,const QString path)
158 {
165 {
159 if(!_self)init();
166 if(!_self)init();
160 linearDriverList->append(driver);
167 linearDriverList->append(driver);
168 if(path.isEmpty())
169 linearDriverPathList->append(driver->baseName());
170 else
171 linearDriverPathList->append(path);
161 driver->parent = parent;
172 driver->parent = parent;
162 driver->setInstanceName(instanceName);
173 driver->setInstanceName(instanceName);
163 parent->childs.append(driver);
174 parent->childs.append(driver);
@@ -264,6 +275,57 socexplorerplugin *socexplorerproxy::fin
264 return NULL;
275 return NULL;
265 }
276 }
266
277
278 QStringList socexplorerproxy::getPluginsList()
279 {
280 if(!_self)init();
281 QStringList result;
282 socexplorerplugin* plugin;
283 for(int i=0; i<linearDriverList->count();i++)
284 {
285 QString parent="";
286 plugin=linearDriverList->at(i);
287 if(plugin->parent)parent=plugin->parent->instanceName();
288 result.append(linearDriverList->at(i)->instanceName()+":"+parent+":"+linearDriverPathList->at(i));
289 }
290 return result;
291 }
292
293 bool socexplorerproxy::loadPluginsList(QStringList plugins)
294 {
295 if(!_self)init();
296 QString plugin;
297 int lastLoadedPlugins=-1;
298 QStringList loadedPlugins;
299 while(plugins.count() && lastLoadedPlugins!=loadedPlugins.count())
300 {
301 lastLoadedPlugins=loadedPlugins.count();
302 for (int i = 0; i < plugins.count(); i++)
303 {
304 plugin=plugins[i];
305 QStringList args=plugin.split(':',QString::KeepEmptyParts);
306 if(args.count()==3)
307 {
308 if(args[1].isEmpty())
309 {
310 _self->loadSysDriver(args[2],args[0]);
311 loadedPlugins.append(args[0]);
312 plugins.removeAt(i);
313 }
314 else if(loadedPlugins.contains(args[1]))
315 {
316 _self->loadSysDriverToParent(args[2],args[0],args[1]);
317 loadedPlugins.append(args[0]);
318 plugins.removeAt(i);
319 }
320 }
321 else
322 {
323 plugins.removeAt(i);
324 }
325 }
326 }
327 }
328
267 bool socexplorerproxy::instanceExists(const QString &instanceName)
329 bool socexplorerproxy::instanceExists(const QString &instanceName)
268 {
330 {
269 return !socexplorerproxy::instanceNameIsValid(instanceName);
331 return !socexplorerproxy::instanceNameIsValid(instanceName);
@@ -312,6 +374,7 void socexplorerproxy::closeSysDriver(so
312 emit _self->removePluginGUI(driver);
374 emit _self->removePluginGUI(driver);
313 if(driver->parent==NULL)SocExplorerEngine::removeSOC(driver);
375 if(driver->parent==NULL)SocExplorerEngine::removeSOC(driver);
314 while(driver->childs.count()!=0)closeSysDriver(driver->childs.first());
376 while(driver->childs.count()!=0)closeSysDriver(driver->childs.first());
377 linearDriverPathList->removeAt(linearDriverList->indexOf(driver));
315 linearDriverList->removeOne(driver);
378 linearDriverList->removeOne(driver);
316 if(driver->parent!= NULL)
379 if(driver->parent!= NULL)
317 {
380 {
@@ -54,6 +54,8 public:
54 static void disconnectChildToProxy(socexplorerplugin* child);
54 static void disconnectChildToProxy(socexplorerplugin* child);
55 static bool instanceNameIsValid(const QString& instanceName);
55 static bool instanceNameIsValid(const QString& instanceName);
56 static socexplorerplugin* findPlugin(const QString &instanceName);
56 static socexplorerplugin* findPlugin(const QString &instanceName);
57 static QStringList getPluginsList();
58 static bool loadPluginsList( QStringList plugins);
57
59
58 QT_ENSURE_STACK_ALIGNED_FOR_SSE static void loadChildSysDriver(socexplorerplugin* parent,const QString child);
60 QT_ENSURE_STACK_ALIGNED_FOR_SSE static void loadChildSysDriver(socexplorerplugin* parent,const QString child);
59
61
@@ -72,10 +74,10 signals:
72 public slots:
74 public slots:
73 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name);
75 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name);
74 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name,const QString instanceName);
76 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name,const QString instanceName);
75 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(socexplorerplugin* driver,const QString instanceName);
77 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(socexplorerplugin* driver,const QString instanceName,const QString path="");
76 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString ParentInst);
78 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString ParentInst);
77 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString instanceName,const QString ParentInst);
79 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString instanceName,const QString ParentInst);
78 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName);
80 QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName,const QString path="");
79 QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString instanceName);
81 QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString instanceName);
80 QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName);
82 QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName);
81 // QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadChild(socexplorerplugin* parent);
83 // QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadChild(socexplorerplugin* parent);
@@ -95,6 +97,7 private:
95 static QMainWindow* mainWindow;
97 static QMainWindow* mainWindow;
96 static QList<socexplorerplugin*>* drivers;
98 static QList<socexplorerplugin*>* drivers;
97 static QList<socexplorerplugin*>* linearDriverList;
99 static QList<socexplorerplugin*>* linearDriverList;
100 static QStringList* linearDriverPathList;
98 static socexplorerplugin* root;
101 static socexplorerplugin* root;
99 static socexplorerplugin* parent;
102 static socexplorerplugin* parent;
100 static PluginsCache* cache;
103 static PluginsCache* cache;
@@ -368,6 +368,11 int PythonQtWrapper_ElfFile::getSymbolC
368 return ( theWrappedObject->getSymbolCount());
368 return ( theWrappedObject->getSymbolCount());
369 }
369 }
370
370
371 int PythonQtWrapper_ElfFile::getSymbolIndex(ElfFile* theWrappedObject, const QString& name)
372 {
373 return ( theWrappedObject->getSymbolIndex(name));
374 }
375
371 QString PythonQtWrapper_ElfFile::getSymbolLinkType(ElfFile* theWrappedObject, int index)
376 QString PythonQtWrapper_ElfFile::getSymbolLinkType(ElfFile* theWrappedObject, int index)
372 {
377 {
373 return ( theWrappedObject->getSymbolLinkType(index));
378 return ( theWrappedObject->getSymbolLinkType(index));
@@ -121,6 +121,7 void delete_ElfFile(ElfFile* obj) { dele
121 qint64 getSegmentVaddr(ElfFile* theWrappedObject, int index);
121 qint64 getSegmentVaddr(ElfFile* theWrappedObject, int index);
122 quint64 getSymbolAddress(ElfFile* theWrappedObject, int index);
122 quint64 getSymbolAddress(ElfFile* theWrappedObject, int index);
123 int getSymbolCount(ElfFile* theWrappedObject);
123 int getSymbolCount(ElfFile* theWrappedObject);
124 int getSymbolIndex(ElfFile* theWrappedObject, const QString& name);
124 QString getSymbolLinkType(ElfFile* theWrappedObject, int index);
125 QString getSymbolLinkType(ElfFile* theWrappedObject, int index);
125 QString getSymbolName(ElfFile* theWrappedObject, int index);
126 QString getSymbolName(ElfFile* theWrappedObject, int index);
126 int getSymbolSectionIndex(ElfFile* theWrappedObject, int index);
127 int getSymbolSectionIndex(ElfFile* theWrappedObject, int index);
@@ -29,61 +29,98
29 #include <QStyleFactory>
29 #include <QStyleFactory>
30 #include <QStringList>
30 #include <QStringList>
31 #include <QFile>
31 #include <QFile>
32 #include <QCommandLineOption>
33 #include <QCommandLineParser>
32
34
33 void usage();
35
36 QCommandLineOption executeOption = QCommandLineOption (
37 QStringList() << "e" << "execute",
38 QCoreApplication::translate("main", "Execute given script <script>."),
39 QCoreApplication::translate("main", "script"));
40
41 QCommandLineOption debugLevelOption = QCommandLineOption (
42 QStringList() << "d" << "debug-level",
43 QCoreApplication::translate("main", "Sets debug level to <level>, higher the level is more verbose the application will be."),
44 QCoreApplication::translate("main", "level"),
45 "1");
46
47 QCommandLineOption noGUIOption = QCommandLineOption (
48 QStringList() << "n" << "no-gui",
49 QCoreApplication::translate("main", "Starts SocExplorer in batch mode[not fully implemented yet!]."));
50
51 const char* socexplorerDesc="\
52 SocExplorer is an open source generic System On Chip testing software/framework.\
53 We write this software for the development and the validation of our instrument,\
54 the Low Frequency Receiver(LFR) for the Solar Orbiter mission. This instrument is\
55 based on an actel FPGA hosting a LEON3FT processor and some peripherals. To make\
56 it more collaborative, we use a plugin based system, the main executable is SocExplorer\
57 then all the functionality are provided by plugins. Like this everybody can provide\
58 his set of plugins to handle a new SOC or just a new peripheral. SocExplorer uses\
59 PythonQt to allow user to automate some tasks such as loading some plugins, configuring\
60 them and talking with his device. SocExplorer is provided under the terms of the GNU\
61 General Public License as published by the Free Software Foundation; either version 2\
62 of the License, or (at your option) any later version.";
34
63
35 int main(int argc, char *argv[])
64 int main(int argc, char *argv[])
36 {
65 {
37 QApplication a(argc, argv);
66 QApplication a(argc, argv);
38 QString scriptToEval;
67 QString scriptToEval;
39 QStringList args= a.arguments();
68 QApplication::setOrganizationName("LPP");
69 QApplication::setOrganizationDomain("lpp.fr");
70 QApplication::setApplicationName("SocExplorer");
71 QCommandLineParser parser;
72 parser.setApplicationDescription(socexplorerDesc);
73 parser.addHelpOption();
74 parser.addVersionOption();
40 bool noGUI=false;
75 bool noGUI=false;
41 for(int i=0;i<=args.count()-1;i++)
76 parser.addPositionalArgument("file", QCoreApplication::translate("main", "The Python file to execute."));
77 parser.addOption(executeOption);
78 parser.addOption(debugLevelOption);
79 parser.addOption(noGUIOption);
80 parser.process(a);
81 if(parser.isSet(executeOption))
42 {
82 {
43 if(((args.at(i).compare("-e")==0) || (args.at(i).compare("--execute")==0)) && (i<(args.count()-1)))
83 scriptToEval = parser.value(executeOption);
84 if(!QFile::exists(scriptToEval))
44 {
85 {
45 scriptToEval = args.at(i+1);
86 scriptToEval.clear();
87 }
88 }
89 else
90 {
91 QStringList posArgs = parser.positionalArguments();
92 if(posArgs.count())
93 {
94 scriptToEval = posArgs.first();
46 if(!QFile::exists(scriptToEval))
95 if(!QFile::exists(scriptToEval))
47 {
96 {
48 scriptToEval.clear();
97 scriptToEval.clear();
49 }
98 }
50 else
51 qDebug() << "Will execute" << scriptToEval;
52 break;
53 }
99 }
54 if(((args.at(i).compare("-d")==0) || (args.at(i).compare("--debug-level")==0)) && (i<(args.count()-1)))
100 }
101 if(parser.isSet(debugLevelOption))
102 {
103 bool success;
104 int lvl;
105 lvl = parser.value(debugLevelOption).toInt(&success,10);
106 if(success)
55 {
107 {
56 bool success;
108 SocExplorerEngine::setLogLevel(lvl);
57 int lvl;
58 lvl = args.at(i+1).toInt(&success,10);
59 if(success)
60 {
61 SocExplorerEngine::setLogLevel(lvl);
62 }
63 }
64 if((args.at(i).compare("--no-gui")==0))
65 {
66 noGUI = true;
67 qDebug() << "CLI mode";
68 }
109 }
69 }
110 }
70
111 if(parser.isSet(noGUIOption))
112 {
113 noGUI = true;
114 qDebug() << "CLI mode";
115 }
71 SocExplorerMainWindow w(scriptToEval);
116 SocExplorerMainWindow w(scriptToEval);
72 if(!noGUI)
117 if(!noGUI)
73 {
118 {
74
75 w.show();
119 w.show();
76 }
120 }
77 else
121 else
78 {
122 {
79
123
80 }
124 }
81 return a.exec();
125 return a.exec();
82 }
126 }
83
84
85 void usage()
86 {
87 // TODO respect usual Linux Cli interface, socexplore [OPTION]...FILES...
88 // TODO write an usage helper.
89 }
@@ -1,6 +1,6
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011-2015, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
@@ -21,6 +21,8
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "mainwindow.h"
22 #include "mainwindow.h"
23 #include <QDockWidget>
23 #include <QDockWidget>
24 #include <socexplorersettings.h>
25 #include <socexplorerconfigkeys.h>
24
26
25 SocExplorerMainWindow::SocExplorerMainWindow(QString ScriptToEval, QWidget *parent)
27 SocExplorerMainWindow::SocExplorerMainWindow(QString ScriptToEval, QWidget *parent)
26 : QMainWindow(parent)
28 : QMainWindow(parent)
@@ -31,6 +33,7 SocExplorerMainWindow::SocExplorerMainWi
31 this->makeObjects(ScriptToEval);
33 this->makeObjects(ScriptToEval);
32 this->makeLayout();
34 this->makeLayout();
33 this->makeMenu();
35 this->makeMenu();
36 SocExplorerSettings::init();
34 this->makeConnections();
37 this->makeConnections();
35 this->setWindowIcon(QIcon(":/images/icon.png"));
38 this->setWindowIcon(QIcon(":/images/icon.png"));
36 this->setAcceptDrops(true);
39 this->setAcceptDrops(true);
@@ -50,8 +53,11 void SocExplorerMainWindow::makeObjects(
50 Q_UNUSED(ScriptToEval)
53 Q_UNUSED(ScriptToEval)
51 this->p_pluginGUIlist = new QList<QDockWidget*>();
54 this->p_pluginGUIlist = new QList<QDockWidget*>();
52 pluginsDockContainer = new QMainWindow;
55 pluginsDockContainer = new QMainWindow;
56 pluginsDockContainer->setObjectName("pluginsDockContainer");
53 pluginsDockContainer->setWindowFlags(Qt::Widget);
57 pluginsDockContainer->setWindowFlags(Qt::Widget);
54 pluginsDockContainer->setDockNestingEnabled(true);
58 pluginsDockContainer->setDockNestingEnabled(true);
59 this->sessionsActions = new QActionGroup(this);
60 this->sessionManagerAction =new QAction(tr("&Session manager"),this);
55 this->mainWidget = new QSplitter(Qt::Vertical);
61 this->mainWidget = new QSplitter(Qt::Vertical);
56 this->appTranslator = new QTranslator;
62 this->appTranslator = new QTranslator;
57 this->Quit = new QAction(tr("&Quit"),this);
63 this->Quit = new QAction(tr("&Quit"),this);
@@ -63,16 +69,19 void SocExplorerMainWindow::makeObjects(
63 this->help = new QAction(tr("&Help"),this);
69 this->help = new QAction(tr("&Help"),this);
64 this->help->setShortcut(tr("CTRL+H"));
70 this->help->setShortcut(tr("CTRL+H"));
65 this->about = new QAction(tr("&About"),this);
71 this->about = new QAction(tr("&About"),this);
72 this->p_SessionManagerDialog = new SessionManagerDialog();
66 socexplorerproxy::setMainWindow(this);
73 socexplorerproxy::setMainWindow(this);
67 SocExplorerEngine::setMainWindow(this);
74 SocExplorerEngine::setMainWindow(this);
68 SocExplorerEngine::xmlModel()->scanXmlFiles();
75 SocExplorerEngine::xmlModel()->scanXmlFiles();
69 this->regExplorer = new RegsExplorer();
76 this->regExplorer = new RegsExplorer();
70 this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas);
77 this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas);
78 this->regExplorer->setObjectName("regExplorer");
71 this->addPluginInterface(this->regExplorer);
79 this->addPluginInterface(this->regExplorer);
72 this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self());
80 this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self());
73 this->PythonConsoleInst->addObject("SocExplorerEngine",SocExplorerEngine::self());
81 this->PythonConsoleInst->addObject("SocExplorerEngine",SocExplorerEngine::self());
74 this->pluginManager = new dockablePluginManager();
82 this->pluginManager = new dockablePluginManager();
75 this->toolpane = new toolBar;
83 this->toolpane = new toolBar;
84 this->toolpane->setObjectName("toolpane");
76 this->p_about = new aboutsocexplorer();
85 this->p_about = new aboutsocexplorer();
77 }
86 }
78
87
@@ -107,6 +116,13 void SocExplorerMainWindow::makeConnecti
107 connect(this->about,SIGNAL(triggered()),this,SLOT(showAboutBox()));
116 connect(this->about,SIGNAL(triggered()),this,SLOT(showAboutBox()));
108 connect(this->exploreRegs,SIGNAL(triggered()),this->regExplorer,SLOT(show()));
117 connect(this->exploreRegs,SIGNAL(triggered()),this->regExplorer,SLOT(show()));
109
118
119 connect(this->sessionManagerAction, SIGNAL(triggered(bool)),this,SLOT(showSessionManager(bool)));
120 connect(this->p_SessionManagerDialog, SIGNAL(switchSession(QString)),this,SLOT(setActiveSession(QString)));
121 connect(this->p_SessionManagerDialog, SIGNAL(sessionRenamed(QString,QString)),this,SLOT(renameSession(QString,QString)));
122 connect(this->p_SessionManagerDialog, SIGNAL(sessionAdded(QString)),this,SLOT(addSession(QString)));
123 connect(this->p_SessionManagerDialog, SIGNAL(sessionRemoved(QString)),this,SLOT(removeSession(QString)));
124 connect(this->sessionsActions,SIGNAL(triggered(QAction*)),this,SLOT(setActiveSession(QAction*)));
125
110 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString)));
126 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString)));
111 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDriverToParent(QString,QString)),socexplorerproxy::self(),SLOT(loadSysDriverToParent(QString,QString)));
127 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDriverToParent(QString,QString)),socexplorerproxy::self(),SLOT(loadSysDriverToParent(QString,QString)));
112
128
@@ -115,12 +131,10 void SocExplorerMainWindow::makeConnecti
115
131
116 void SocExplorerMainWindow::launchPluginManager()
132 void SocExplorerMainWindow::launchPluginManager()
117 {
133 {
118
119 if(this->pluginManager->isHidden())
134 if(this->pluginManager->isHidden())
120 {
135 {
121 this->pluginManager->setHidden(false);
136 this->pluginManager->setHidden(false);
122 }
137 }
123
124 }
138 }
125
139
126
140
@@ -150,6 +164,11 void SocExplorerMainWindow::clearMenu()
150 void SocExplorerMainWindow::makeMenu()
164 void SocExplorerMainWindow::makeMenu()
151 {
165 {
152 this->FileMenu = menuBar()->addMenu(tr("&File"));
166 this->FileMenu = menuBar()->addMenu(tr("&File"));
167 this->SessionsMenu = this->FileMenu->addMenu(tr("&Sessions"));
168 this->loadSessions();
169 this->FileMenu->addAction(this->sessionManagerAction);
170 this->SettingsMenu = menuBar()->addMenu(tr("&Settings"));
171 SocExplorerGUI::registerMenuBar(menuBar(),this->FileMenu,this->SettingsMenu);
153 this->PluginsMenu = menuBar()->addMenu(tr("&Plugins"));
172 this->PluginsMenu = menuBar()->addMenu(tr("&Plugins"));
154 this->ToolsMenu = menuBar()->addMenu(tr("&Tools"));
173 this->ToolsMenu = menuBar()->addMenu(tr("&Tools"));
155 this->ToolsMenu->addAction(this->exploreRegs);
174 this->ToolsMenu->addAction(this->exploreRegs);
@@ -163,9 +182,58 void SocExplorerMainWindow::makeMenu()
163
182
164 }
183 }
165
184
185 void SocExplorerMainWindow::loadSessions()
186 {
187 p_Sessions=this->p_SessionManagerDialog->getSessionsList();
188 QAction* sact;
189 QString stext;
190 QList<QAction*> sessions=sessionsActions->actions();
191 foreach (sact, sessions)
192 {
193 sessionsActions->removeAction(sact);
194 SessionsMenu->removeAction(sact);
195 delete sact;
196 }
197 foreach (stext, p_Sessions)
198 {
199 addSession(stext);
200 }
201 }
202
203 void SocExplorerMainWindow::savePlugins()
204 {
205
206 }
207
208 void SocExplorerMainWindow::saveCurrentSession()
209 {
210 if(p_currentSession.isEmpty())
211 {
212 SocExplorerSettings::loadSession("default");
213 }
214 SocExplorerSettings::setValue("GLOBAL","LastModified",QDate::currentDate().toString(),SocExplorerSettings::Session);
215 SocExplorerSettings::setValue(this,"DOCK_LOCATIONS",this->saveState(0),SocExplorerSettings::Session);
216 SocExplorerSettings::setValue(this,"PLUGINS_DOCK_LOCATIONS",this->pluginsDockContainer->saveState(0),SocExplorerSettings::Session);
217 SocExplorerSettings::setValue(this,"MAIN_WINDOW_GEOMETRY",this->saveGeometry(),SocExplorerSettings::Session);
218 QStringList plugins = socexplorerproxy::getPluginsList();
219 SocExplorerSettings::setValue(this,"LOADED_PLUGINS",QVariant(plugins),SocExplorerSettings::Session);
220 SocExplorerSettings::sync();
221 }
222
223 void SocExplorerMainWindow::loadCurrentSession()
224 {
225
226 QStringList plugins = SocExplorerSettings::value(this,"LOADED_PLUGINS",QVariant(),SocExplorerSettings::Session).toStringList();
227 socexplorerproxy::loadPluginsList(plugins);
228 this->restoreGeometry(SocExplorerSettings::value(this,"MAIN_WINDOW_GEOMETRY",QVariant(),SocExplorerSettings::Session).toByteArray());
229 this->restoreState(SocExplorerSettings::value(this,"DOCK_LOCATIONS",QVariant(),SocExplorerSettings::Session).toByteArray());
230 this->pluginsDockContainer->restoreState(SocExplorerSettings::value(this,"PLUGINS_DOCK_LOCATIONS",QVariant(),SocExplorerSettings::Session).toByteArray());
231 }
232
166
233
167 SocExplorerMainWindow::~SocExplorerMainWindow()
234 SocExplorerMainWindow::~SocExplorerMainWindow()
168 {
235 {
236
169 }
237 }
170
238
171
239
@@ -224,10 +292,69 void SocExplorerMainWindow::pluginselect
224 drv->raise();
292 drv->raise();
225 }
293 }
226
294
295 void SocExplorerMainWindow::setActiveSession(const QString &session)
296 {
297 if(!(p_currentSession.isNull() && session=="default"))
298 saveCurrentSession();
299 socexplorerproxy::self()->close();
300 this->p_currentSession = session;
301 SocExplorerSettings::loadSession(session);
302 loadCurrentSession();
303
304 }
305
306 void SocExplorerMainWindow::setActiveSession(QAction *session)
307 {
308 this->setActiveSession(session->text());
309 }
310
311 void SocExplorerMainWindow::showSessionManager(bool)
312 {
313 this->p_SessionManagerDialog->show();
314 }
315
316 void SocExplorerMainWindow::renameSession(const QString &oldName, const QString &newName)
317 {
318 for(int i=0;i<sessionsActions->actions().count();i++)
319 {
320 if(Q_UNLIKELY(sessionsActions->actions().at(i)->text()==oldName))
321 {
322 sessionsActions->actions().at(i)->setText(newName);
323 }
324 }
325 }
326
327 void SocExplorerMainWindow::addSession(const QString &newSession)
328 {
329 QAction* sact = new QAction(newSession,this);
330 sact->setCheckable(true);
331 sact->setData(newSession);
332 if(Q_UNLIKELY(p_currentSession==newSession))
333 sact->setChecked(true);
334 sessionsActions->addAction(sact);
335 SessionsMenu->addAction(sact);
336 }
337
338 void SocExplorerMainWindow::removeSession(const QString &session)
339 {
340 QAction* sact;
341 foreach (sact, sessionsActions->actions())
342 {
343 if(Q_UNLIKELY(sact->text()==session))
344 {
345 sessionsActions->removeAction(sact);
346 SessionsMenu->removeAction(sact);
347 delete sact;
348 }
349 }
350 }
351
352
227
353
228
354
229 void SocExplorerMainWindow::closeEvent(QCloseEvent *event)
355 void SocExplorerMainWindow::closeEvent(QCloseEvent *event)
230 {
356 {
357 saveCurrentSession();
231 socexplorerproxy::self()->close();
358 socexplorerproxy::self()->close();
232 qApp->closeAllWindows();
359 qApp->closeAllWindows();
233 event->accept();
360 event->accept();
@@ -38,17 +38,21
38 #include "aboutsocexplorer.h"
38 #include "aboutsocexplorer.h"
39 #include "toolbar.h"
39 #include "toolbar.h"
40 #include "regsExplorer/regsexplorer.h"
40 #include "regsExplorer/regsexplorer.h"
41 #include "socexplorergui.h"
42 #include "sessionmanagerdialog.h"
41
43
42 class SocExplorerMainWindow : public QMainWindow
44 class SocExplorerMainWindow : public QMainWindow
43 {
45 {
44 Q_OBJECT
46 Q_OBJECT
45
47
48
46 public:
49 public:
47 SocExplorerMainWindow(QString ScriptToEval,QWidget *parent = 0);
50 SocExplorerMainWindow(QString ScriptToEval,QWidget *parent = 0);
48 ~SocExplorerMainWindow();
51 ~SocExplorerMainWindow();
49 QAction* Quit,*LoadPlugin,*ManagePlugins,*help,*regsManager,*exploreRegs,*about,*translateAction;
52 QAction* Quit,*LoadPlugin,*ManagePlugins,*help,*regsManager,*exploreRegs,*about,*translateAction,*sessionManagerAction;
53 QActionGroup*sessionsActions;
50 QActionGroup*langActionGrp;
54 QActionGroup*langActionGrp;
51 QMenu* FileMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu;
55 QMenu* FileMenu,*SettingsMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu,*SessionsMenu;
52 QTranslator* appTranslator;
56 QTranslator* appTranslator;
53 void createLangMenu();
57 void createLangMenu();
54 void closeEvent(QCloseEvent *event);
58 void closeEvent(QCloseEvent *event);
@@ -64,7 +68,12 public slots:
64 void setLangage(QAction* action);
68 void setLangage(QAction* action);
65 void showAboutBox();
69 void showAboutBox();
66 void pluginselected(const QString& instanceName);
70 void pluginselected(const QString& instanceName);
67
71 void setActiveSession(const QString & session);
72 void setActiveSession(QAction* session);
73 void showSessionManager(bool);
74 void renameSession(const QString& oldName,const QString& newName);
75 void addSession(const QString& newSession);
76 void removeSession(const QString& session);
68 signals:
77 signals:
69 void translateSig();
78 void translateSig();
70 void registerObject(QObject* object,const QString& instanceName);
79 void registerObject(QObject* object,const QString& instanceName);
@@ -74,6 +83,10 private:
74 void makeLayout();
83 void makeLayout();
75 void makeConnections();
84 void makeConnections();
76 void makeMenu();
85 void makeMenu();
86 void loadSessions();
87 void savePlugins();
88 void saveCurrentSession();
89 void loadCurrentSession();
77 QMainWindow* pluginsDockContainer;
90 QMainWindow* pluginsDockContainer;
78 QSplitter* mainWidget;
91 QSplitter* mainWidget;
79 PythonConsole* PythonConsoleInst;
92 PythonConsole* PythonConsoleInst;
@@ -81,6 +94,9 private:
81 RegsExplorer* regExplorer;
94 RegsExplorer* regExplorer;
82 aboutsocexplorer* p_about;
95 aboutsocexplorer* p_about;
83 QList<QDockWidget*>* p_pluginGUIlist;
96 QList<QDockWidget*>* p_pluginGUIlist;
97 QStringList p_Sessions;
98 QString p_currentSession;
99 SessionManagerDialog* p_SessionManagerDialog;
84 };
100 };
85
101
86 #endif // MAINWINDOW_H
102 #endif // MAINWINDOW_H
@@ -73,7 +73,9 SOURCES += main.cpp\
73 toolbar.cpp \
73 toolbar.cpp \
74 toolbarcontainer.cpp \
74 toolbarcontainer.cpp \
75 aboutsocexplorer.cpp \
75 aboutsocexplorer.cpp \
76 regsExplorer/regsexplorer.cpp
76 regsExplorer/regsexplorer.cpp \
77 socexplorercoresettingsgui.cpp \
78 sessionmanagerdialog.cpp
77
79
78 HEADERS += mainwindow.h \
80 HEADERS += mainwindow.h \
79 PyWdgt/pythonconsole.h \
81 PyWdgt/pythonconsole.h \
@@ -84,7 +86,9 HEADERS += mainwindow.h \
84 socexplorer.h \
86 socexplorer.h \
85 SocExplorerEngine/plugins/socexplorerplugin.h \
87 SocExplorerEngine/plugins/socexplorerplugin.h \
86 aboutsocexplorer.h \
88 aboutsocexplorer.h \
87 regsExplorer/regsexplorer.h
89 regsExplorer/regsexplorer.h \
90 socexplorercoresettingsgui.h \
91 sessionmanagerdialog.h
88
92
89
93
90 include ( NicePyConsole/NicePyConsole.pri)
94 include ( NicePyConsole/NicePyConsole.pri)
@@ -101,7 +105,9 TRANSLATIONS = ../translations/socexplor
101 ../translations/socexplorer_en.ts
105 ../translations/socexplorer_en.ts
102
106
103 FORMS += \
107 FORMS += \
104 regsExplorer/regsexplorernew.ui
108 regsExplorer/regsexplorernew.ui \
109 socexplorercoresettingsgui.ui \
110 sessionmanagerdialog.ui
105
111
106 DISTFILES += \
112 DISTFILES += \
107 ../doc/PythonExamples/LEON3_LOAD.py \
113 ../doc/PythonExamples/LEON3_LOAD.py \
@@ -8,7 +8,7 GenericName=Soc Explorer
8
8
9 Comment=Software to monitor and explore Soc devices.
9 Comment=Software to monitor and explore Soc devices.
10
10
11 Exec=socexplorer -e %U
11 Exec=socexplorer %U
12 Icon=/usr/share/SocExplorer/icon.png
12 Icon=/usr/share/SocExplorer/icon.png
13 Terminal=false
13 Terminal=false
14
14
General Comments 0
You need to be logged in to leave comments. Login now