@@ -1,4 +1,4 | |||
|
1 | 1 | 1cb664ab4bb3c531d706b1948a378ed9810c0dda src/SocExplorerEngine/PeripheralWidget |
|
2 | 2 | 1f143e4ae72a0bb4832b546eb76eb50e94049b80 src/common/genericBinaryFiles |
|
3 | 2dce25b198558be573f56c1cf337aa95ddd666d6 src/common/lppserial | |
|
3 | 2b353bf8243cbfb3db44e196f33bd164c11c9949 src/common/lppserial | |
|
4 | 4 | 923afde9cc96bb419cf898560d080ec96991aeca src/common/qhexedit |
@@ -430,6 +430,23 generic is set to 2. Reset value: ‘0’."/> | |||
|
430 | 430 | <bitField name="DATA" size="32" mode="1" desc=""/> |
|
431 | 431 | </register> |
|
432 | 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 | 450 | </soc> |
|
434 | 451 | |
|
435 | 452 |
@@ -15,7 +15,6 void PythonQt_init_PySocExplorerEngine(P | |||
|
15 | 15 | PythonConsole::PythonConsole(socexplorerproxy *proxy, QWidget *parent) : |
|
16 | 16 | QWidget(parent) |
|
17 | 17 | { |
|
18 | //PythonQt::init(); | |
|
19 | 18 | PythonQt::init(PythonQt::RedirectStdOut); |
|
20 | 19 | PythonQt_QtAll::init(); |
|
21 | 20 | this->proxy = proxy; |
@@ -25,7 +24,6 PythonConsole::PythonConsole(socexplorer | |||
|
25 | 24 | this->console = new PythonQtScriptingConsoleDandD(NULL, PythonQt::self()->getMainModule()); |
|
26 | 25 | this->mainlayout->addWidget(this->console); |
|
27 | 26 | this->setWindowTitle(tr("Python Scripting Console")); |
|
28 | this->bussdriver = 0; | |
|
29 | 27 | this->setAcceptDrops(true); |
|
30 | 28 | this->setLayout(this->mainlayout); |
|
31 | 29 | connect(this->console,SIGNAL(pyConsoleRunFiles(QStringList)),this,SLOT(pyConsoleRunFiles(QStringList))); |
@@ -45,13 +43,6 void PythonConsole::removeVariable(const | |||
|
45 | 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 | 46 | void PythonConsole::registerObject(QObject* object,const QString& instanceName) |
|
56 | 47 | { |
|
57 | 48 | this->mainContext->addObject(instanceName,object); |
@@ -72,13 +63,6 void PythonConsole::removeDriver(const Q | |||
|
72 | 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 | 67 | void PythonConsole::pyConsoleRunFiles(const QStringList & pathList) |
|
84 | 68 | { |
@@ -49,8 +49,6 public: | |||
|
49 | 49 | signals: |
|
50 | 50 | void rootDriverDelete(); |
|
51 | 51 | public slots: |
|
52 | void setBussDriver(socexplorerplugin* driver); | |
|
53 | void removeBussDriver(); | |
|
54 | 52 | void removeDriver(const QString& instanceName); |
|
55 | 53 | void pyConsoleRunFiles(const QStringList&); |
|
56 | 54 | void pyConsoleRunFile(const QString& fileName); |
@@ -63,11 +61,9 protected: | |||
|
63 | 61 | |
|
64 | 62 | private: |
|
65 | 63 | QHBoxLayout* mainlayout; |
|
66 | socexplorerplugin* bussdriver; | |
|
67 | 64 | PythonQtScriptingConsoleDandD* console; |
|
68 | 65 | PythonQtObjectPtr* mainContext; |
|
69 | 66 | socexplorerproxy* proxy; |
|
70 | //LPMONMainWindow* mainwin; | |
|
71 | 67 | }; |
|
72 | 68 | |
|
73 | 69 | #endif // PYTHONCONSOLE_H |
@@ -67,7 +67,11 header.files = engine/socexplorerengine. | |||
|
67 | 67 | PeripheralWidget/src/registerwidget.h \ |
|
68 | 68 | PeripheralWidget/src/socregsviewer.h \ |
|
69 | 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 | 129 | PySocExplorerEngine.h \ |
|
126 | 130 | memtester/memtester.h\ |
|
127 | 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 | 163 | plugins/socexplorerplugin.cpp \ |
|
156 | 164 | memtester/memtester.cpp \ |
|
157 | 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 | 172 | OTHER_FILES += \ |
@@ -167,7 +178,8 OTHER_FILES += \ | |||
|
167 | 178 | |
|
168 | 179 | FORMS += \ |
|
169 | 180 | PeripheralWidget/src/socregsviewernew.ui \ |
|
170 | PeripheralWidget/src/collapsableperipheralwidget.ui | |
|
181 | PeripheralWidget/src/collapsableperipheralwidget.ui \ | |
|
182 | engine/socexplorersettingsdialog.ui | |
|
171 | 183 | |
|
172 | 184 | |
|
173 | 185 | RESOURCES += \ |
@@ -21,13 +21,18 | |||
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "socexplorerengine.h" |
|
23 | 23 | #include <proxy/socexplorerproxy.h> |
|
24 | #include <socexplorersettings.h> | |
|
25 | #include <socexplorercoresettingsgui.h> | |
|
26 | #include <socexplorerconfigkeys.h> | |
|
24 | 27 | |
|
25 | 28 | SocExplorerEngine* SocExplorerEngine::_self = NULL; |
|
26 | 29 | socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL; |
|
27 | 30 | QMainWindow* SocExplorerEngine::mainWindow=NULL; |
|
28 | 31 | QList<SOCModel*>* SocExplorerEngine::SOCs=NULL; |
|
32 | QSettings* SocExplorerEngine::m_settings=NULL; | |
|
29 | 33 | int SocExplorerEngine::loglvl=1; |
|
30 | 34 | |
|
35 | ||
|
31 | 36 | SocExplorerEngine::SocExplorerEngine(QObject *parent) : |
|
32 | 37 | QObject(parent) |
|
33 | 38 | { |
@@ -35,7 +40,9 SocExplorerEngine::SocExplorerEngine(QOb | |||
|
35 | 40 | { |
|
36 | 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 | 106 | return folders; |
|
92 | 107 | } |
|
93 | 108 | |
@@ -274,13 +289,29 void SocExplorerEngine::removeSOC(socexp | |||
|
274 | 289 | delete soc; |
|
275 | 290 | } |
|
276 | 291 | |
|
292 | ||
|
277 | 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 | 309 | // TODO add multi output message manager IE also log in files |
|
310 | static QTextStream SocExplorerEngineStdout(stdout); | |
|
280 | 311 | if(!_self) |
|
281 | 312 | init(); |
|
282 | 313 | if(loglvl>=debugLevel) |
|
283 |
|
|
|
314 | SocExplorerEngineStdout << QTime::currentTime().toString()+" " + sender+":"+message << endl; | |
|
284 | 315 | } |
|
285 | 316 | |
|
286 | 317 | void SocExplorerEngine::setLogLevel(int level) |
@@ -42,6 +42,7 | |||
|
42 | 42 | #include <registerwidget.h> |
|
43 | 43 | #include <socmodel.h> |
|
44 | 44 | #include <memtester.h> |
|
45 | #include <QSettings> | |
|
45 | 46 | |
|
46 | 47 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
47 | 48 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
@@ -83,6 +84,7 class SOCEXPLORER_SDK_EXPORT SocExplorer | |||
|
83 | 84 | Q_OBJECT |
|
84 | 85 | private: |
|
85 | 86 | static SocExplorerEngine* _self; |
|
87 | static QSettings* m_settings; | |
|
86 | 88 | SocExplorerEngine(QObject *parent = 0); |
|
87 | 89 | static void init(); |
|
88 | 90 | |
@@ -107,6 +109,8 public: | |||
|
107 | 109 | static void addSOC(socexplorerplugin* rootPlugin); |
|
108 | 110 | static void removeSOC(socexplorerplugin* rootPlugin); |
|
109 | 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 | 114 | static void setLogLevel(int level); |
|
111 | 115 | static bool isSocLitleEndian(socexplorerplugin* plugin); |
|
112 | 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 | 66 | void pluginselected(const QString& instanceName); |
|
67 | 67 | |
|
68 | 68 | public slots: |
|
69 | //void libselected(int row); | |
|
70 | void addPlugin(); | |
|
71 | void removePlugin(); | |
|
72 | void loadplugin(); | |
|
73 | //void loadplugin(QListWidgetItem*); | |
|
69 | ||
|
74 | 70 | |
|
75 | 71 | private: |
|
76 | 72 |
@@ -13,6 +13,8 | |||
|
13 | 13 | #ifdef SOCEXPLORER_CUSTOM_PLUGIN_LOADER |
|
14 | 14 | #include "unix/unixpluginloader.h" |
|
15 | 15 | #endif |
|
16 | #include <socexplorerengine.h> | |
|
17 | #include <socexplorersettings.h> | |
|
16 | 18 | |
|
17 | 19 | pluginloader* pluginloader::_self = NULL; |
|
18 | 20 | PluginsCache* pluginloader::_cache = NULL; |
@@ -27,38 +29,6 pluginloader::pluginloader() | |||
|
27 | 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 | 32 | void pluginloader::scanFolders() |
|
63 | 33 | { |
|
64 | 34 | QDir dir; |
@@ -74,6 +44,7 void pluginloader::scanFolders() | |||
|
74 | 44 | for (int i = 0; i < list.size(); ++i) |
|
75 | 45 | { |
|
76 | 46 | QFileInfo fileInfo = list.at(i); |
|
47 | SocExplorerEngine::message("pluginloader::scanFolders","Checking "+ fileInfo.filePath(),3); | |
|
77 | 48 | if(checklibrary(fileInfo.filePath())!=0) |
|
78 | 49 | { |
|
79 | 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 | 61 | lib->load(); |
|
91 | 62 | if(!lib->isLoaded()) |
|
92 | 63 | { |
|
93 | qDebug()<<lib->errorString(); | |
|
64 | SocExplorerEngine::message("pluginloader::p_checklibraryQlib",lib->errorString(),3); | |
|
94 | 65 | lib->~QLibrary(); |
|
95 | 66 | lib = new QLibrary(fileName); |
|
96 | 67 | lib->load(); |
@@ -81,7 +81,6 private: | |||
|
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 | static QStringList readFoldersList(const QStringList confFiles); | |
|
85 | 84 | static QString* _cacheLookup(const QString Name); |
|
86 | 85 | static QString _getlibName(const QString fileName); |
|
87 | 86 | static int _getlibPID(const QString fileName); |
@@ -1,5 +1,6 | |||
|
1 | 1 | #include "pluginscache.h" |
|
2 | 2 | #include <QDebug> |
|
3 | #include <socexplorerengine.h> | |
|
3 | 4 | |
|
4 | 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 | 58 | if(this->items->at(i)->compare(item)) |
|
58 | 59 | { |
|
59 |
|
|
|
60 | SocExplorerEngine::message("PluginsCache",fileName + " already in the cache",3); | |
|
60 | 61 | delete item; |
|
61 | 62 | return; |
|
62 | 63 | } |
|
63 | 64 | } |
|
64 | qDebug()<< fileName << "added to cache"; | |
|
65 | SocExplorerEngine::message("PluginsCache",fileName + " added to cache",3); | |
|
65 | 66 | this->items->append(item); |
|
66 | 67 | } |
|
67 | 68 |
@@ -1,15 +1,16 | |||
|
1 | 1 | #include "unixpluginloader.h" |
|
2 | 2 | #include <stdio.h> |
|
3 | 3 | #include <QDebug> |
|
4 | #include <socexplorerengine.h> | |
|
4 | 5 | |
|
5 | 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 | 9 | dlHandle = dlopen(libPath.toStdString().c_str(),RTLD_LAZY|RTLD_GLOBAL); |
|
9 | 10 | if(dlHandle==NULL) |
|
10 | qDebug() << "Failed"<< dlerror(); | |
|
11 | SocExplorerEngine::message("unixPluginLoader::unixPluginLoader",QString("Failed ") + dlerror(),3); | |
|
11 | 12 | else |
|
12 | qDebug() << "Success"; | |
|
13 | SocExplorerEngine::message("unixPluginLoader::unixPluginLoader","Success " ,3); | |
|
13 | 14 | this->libPath = libPath; |
|
14 | 15 | } |
|
15 | 16 | |
@@ -17,12 +18,12 void *unixPluginLoader::resolve(const QS | |||
|
17 | 18 | { |
|
18 | 19 | if(dlHandle!=NULL) |
|
19 | 20 | { |
|
20 |
|
|
|
21 | SocExplorerEngine::message("unixPluginLoader::resolve","try to resolve "+symbol+" in "+libPath ,3); | |
|
21 | 22 | void* sym = dlsym (dlHandle, symbol.toStdString().c_str()); |
|
22 | 23 | if(sym==NULL) |
|
23 | qDebug() << "Failed"<< dlerror(); | |
|
24 | SocExplorerEngine::message("unixPluginLoader::resolve",QString("Failed")+ dlerror() ,3); | |
|
24 | 25 | else |
|
25 | qDebug() << "Success"; | |
|
26 | SocExplorerEngine::message("unixPluginLoader::resolve","Success",3); | |
|
26 | 27 | return sym; |
|
27 | 28 | } |
|
28 | 29 | return NULL; |
@@ -33,6 +34,6 void unixPluginLoader::close() | |||
|
33 | 34 | if(dlHandle!=NULL) |
|
34 | 35 | { |
|
35 | 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 | 108 | if(this->menu) |
|
109 | 109 | this->menu->setTitle(this->_instanceName); |
|
110 | 110 | this->setWindowTitle(newName); |
|
111 | this->setObjectName(newName); | |
|
111 | 112 | } |
|
112 | 113 | |
|
113 | 114 | bool socexplorerplugin::dumpMemory(unsigned int address, unsigned int count, QString file) |
@@ -261,4 +262,3 bool socexplorerplugin::dumpMemory(unsig | |||
|
261 | 262 | return false; |
|
262 | 263 | } |
|
263 | 264 | |
|
264 |
@@ -85,6 +85,7 public: | |||
|
85 | 85 | //! Default plugin constructor, any plugin should call this constructor. |
|
86 | 86 | socexplorerplugin(QWidget *parent = 0,bool createPyObject=true):QDockWidget(parent) |
|
87 | 87 | { |
|
88 | Q_UNUSED(createPyObject) | |
|
88 | 89 | closeAction=NULL; |
|
89 | 90 | menu=NULL; |
|
90 | 91 | ChildsMenu=NULL; |
@@ -156,10 +157,10 public slots: | |||
|
156 | 157 | virtual void setInstanceName(const QString& newName); |
|
157 | 158 | |
|
158 | 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 | 161 | virtual bool memSet(unsigned int address,int value, unsigned int count); |
|
160 | 162 | virtual bool loadbin(unsigned int address,QString file); |
|
161 | 163 | virtual bool loadfile(abstractBinFile* file); |
|
162 | virtual bool dumpMemory(unsigned int address,unsigned int count,QString file,const QString& format); | |
|
163 | 164 | QVariantList Read(unsigned int address, unsigned int count); |
|
164 | 165 | void Write(unsigned int address, QList<QVariant> dataList); |
|
165 | 166 | socexplorerplugin* parentPlugin(){return this->parent;} |
@@ -32,6 +32,7 QList<socexplorerplugin*>* socexplorerpr | |||
|
32 | 32 | socexplorerplugin* socexplorerproxy::root=NULL; |
|
33 | 33 | socexplorerplugin* socexplorerproxy::parent=NULL; |
|
34 | 34 | PluginsCache* socexplorerproxy::cache=NULL; |
|
35 | QStringList* socexplorerproxy::linearDriverPathList=NULL; | |
|
35 | 36 | |
|
36 | 37 | socexplorerproxy::socexplorerproxy(QObject *parent) : |
|
37 | 38 | QObject(parent) |
@@ -39,6 +40,7 socexplorerproxy::socexplorerproxy(QObje | |||
|
39 | 40 | cache = new PluginsCache; |
|
40 | 41 | drivers = new QList<socexplorerplugin*>; |
|
41 | 42 | linearDriverList=new QList<socexplorerplugin*>; |
|
43 | linearDriverPathList=new QStringList; | |
|
42 | 44 | root = NULL; |
|
43 | 45 | } |
|
44 | 46 | |
@@ -50,6 +52,7 socexplorerproxy::socexplorerproxy(QMain | |||
|
50 | 52 | cache = new PluginsCache; |
|
51 | 53 | drivers = new QList<socexplorerplugin*>; |
|
52 | 54 | linearDriverList=new QList<socexplorerplugin*>; |
|
55 | linearDriverPathList=new QStringList; | |
|
53 | 56 | root = NULL; |
|
54 | 57 | } |
|
55 | 58 | |
@@ -77,7 +80,7 void socexplorerproxy::loadSysDriver(con | |||
|
77 | 80 | { |
|
78 | 81 | socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name); |
|
79 | 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 | 90 | if(pluginloader::libcanberoot(name) && !_self->instanceExists(instanceName)) |
|
88 | 91 | { |
|
89 | 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 | 100 | if(!_self)init(); |
|
98 | 101 | driver->setInstanceName(instanceName); |
|
99 | 102 | driver->parent = NULL; |
|
100 | 103 | drivers->append(driver); |
|
101 | 104 | linearDriverList->append(driver); |
|
105 | if(path.isEmpty()) | |
|
106 | linearDriverPathList->append(driver->baseName()); | |
|
107 | else | |
|
108 | linearDriverPathList->append(path); | |
|
102 | 109 | connectChildToProxy(driver); |
|
103 | 110 | emit _self->addPluginGUI(driver); |
|
104 | 111 | emit _self->clearMenu(); |
@@ -117,7 +124,7 void socexplorerproxy::loadChildSysDrive | |||
|
117 | 124 | bool ok=true; |
|
118 | 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 | 140 | if(ok) |
|
134 | 141 | { |
|
135 | 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 | 156 | if(ok) |
|
150 | 157 | { |
|
151 | 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 | 166 | if(!_self)init(); |
|
160 | 167 | linearDriverList->append(driver); |
|
168 | if(path.isEmpty()) | |
|
169 | linearDriverPathList->append(driver->baseName()); | |
|
170 | else | |
|
171 | linearDriverPathList->append(path); | |
|
161 | 172 | driver->parent = parent; |
|
162 | 173 | driver->setInstanceName(instanceName); |
|
163 | 174 | parent->childs.append(driver); |
@@ -264,6 +275,57 socexplorerplugin *socexplorerproxy::fin | |||
|
264 | 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 | 329 | bool socexplorerproxy::instanceExists(const QString &instanceName) |
|
268 | 330 | { |
|
269 | 331 | return !socexplorerproxy::instanceNameIsValid(instanceName); |
@@ -312,6 +374,7 void socexplorerproxy::closeSysDriver(so | |||
|
312 | 374 | emit _self->removePluginGUI(driver); |
|
313 | 375 | if(driver->parent==NULL)SocExplorerEngine::removeSOC(driver); |
|
314 | 376 | while(driver->childs.count()!=0)closeSysDriver(driver->childs.first()); |
|
377 | linearDriverPathList->removeAt(linearDriverList->indexOf(driver)); | |
|
315 | 378 | linearDriverList->removeOne(driver); |
|
316 | 379 | if(driver->parent!= NULL) |
|
317 | 380 | { |
@@ -54,6 +54,8 public: | |||
|
54 | 54 | static void disconnectChildToProxy(socexplorerplugin* child); |
|
55 | 55 | static bool instanceNameIsValid(const QString& instanceName); |
|
56 | 56 | static socexplorerplugin* findPlugin(const QString &instanceName); |
|
57 | static QStringList getPluginsList(); | |
|
58 | static bool loadPluginsList( QStringList plugins); | |
|
57 | 59 | |
|
58 | 60 | QT_ENSURE_STACK_ALIGNED_FOR_SSE static void loadChildSysDriver(socexplorerplugin* parent,const QString child); |
|
59 | 61 | |
@@ -72,10 +74,10 signals: | |||
|
72 | 74 | public slots: |
|
73 | 75 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriver(const QString name); |
|
74 | 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 | 78 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadSysDriverToParent(const QString name,const QString ParentInst); |
|
77 | 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 | 81 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString instanceName); |
|
80 | 82 | QT_ENSURE_STACK_ALIGNED_FOR_SSE void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName); |
|
81 | 83 | // QT_ENSURE_STACK_ALIGNED_FOR_SSE void loadChild(socexplorerplugin* parent); |
@@ -95,6 +97,7 private: | |||
|
95 | 97 | static QMainWindow* mainWindow; |
|
96 | 98 | static QList<socexplorerplugin*>* drivers; |
|
97 | 99 | static QList<socexplorerplugin*>* linearDriverList; |
|
100 | static QStringList* linearDriverPathList; | |
|
98 | 101 | static socexplorerplugin* root; |
|
99 | 102 | static socexplorerplugin* parent; |
|
100 | 103 | static PluginsCache* cache; |
@@ -368,6 +368,11 int PythonQtWrapper_ElfFile::getSymbolC | |||
|
368 | 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 | 376 | QString PythonQtWrapper_ElfFile::getSymbolLinkType(ElfFile* theWrappedObject, int index) |
|
372 | 377 | { |
|
373 | 378 | return ( theWrappedObject->getSymbolLinkType(index)); |
@@ -121,6 +121,7 void delete_ElfFile(ElfFile* obj) { dele | |||
|
121 | 121 | qint64 getSegmentVaddr(ElfFile* theWrappedObject, int index); |
|
122 | 122 | quint64 getSymbolAddress(ElfFile* theWrappedObject, int index); |
|
123 | 123 | int getSymbolCount(ElfFile* theWrappedObject); |
|
124 | int getSymbolIndex(ElfFile* theWrappedObject, const QString& name); | |
|
124 | 125 | QString getSymbolLinkType(ElfFile* theWrappedObject, int index); |
|
125 | 126 | QString getSymbolName(ElfFile* theWrappedObject, int index); |
|
126 | 127 | int getSymbolSectionIndex(ElfFile* theWrappedObject, int index); |
@@ -29,49 +29,93 | |||
|
29 | 29 | #include <QStyleFactory> |
|
30 | 30 | #include <QStringList> |
|
31 | 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 | 64 | int main(int argc, char *argv[]) |
|
36 | 65 | { |
|
37 | 66 | QApplication a(argc, argv); |
|
38 | 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 | 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))) | |
|
44 | { | |
|
45 | scriptToEval = args.at(i+1); | |
|
83 | scriptToEval = parser.value(executeOption); | |
|
46 | 84 |
|
|
47 | 85 |
|
|
48 | 86 |
|
|
49 | 87 |
|
|
88 | } | |
|
50 | 89 |
|
|
51 | qDebug() << "Will execute" << scriptToEval; | |
|
52 | break; | |
|
90 | { | |
|
91 | QStringList posArgs = parser.positionalArguments(); | |
|
92 | if(posArgs.count()) | |
|
93 | { | |
|
94 | scriptToEval = posArgs.first(); | |
|
95 | if(!QFile::exists(scriptToEval)) | |
|
96 | { | |
|
97 | scriptToEval.clear(); | |
|
53 | 98 | } |
|
54 | if(((args.at(i).compare("-d")==0) || (args.at(i).compare("--debug-level")==0)) && (i<(args.count()-1))) | |
|
99 | } | |
|
100 | } | |
|
101 | if(parser.isSet(debugLevelOption)) | |
|
55 | 102 |
|
|
56 | 103 |
|
|
57 | 104 |
|
|
58 |
|
|
|
105 | lvl = parser.value(debugLevelOption).toInt(&success,10); | |
|
59 | 106 |
|
|
60 | 107 |
|
|
61 | 108 |
|
|
62 | 109 |
|
|
63 | 110 |
|
|
64 | if((args.at(i).compare("--no-gui")==0)) | |
|
111 | if(parser.isSet(noGUIOption)) | |
|
65 | 112 |
|
|
66 | 113 |
|
|
67 | 114 |
|
|
68 | 115 |
|
|
69 | } | |
|
70 | ||
|
71 | 116 | SocExplorerMainWindow w(scriptToEval); |
|
72 | 117 | if(!noGUI) |
|
73 | 118 |
|
|
74 | ||
|
75 | 119 | w.show(); |
|
76 | 120 |
|
|
77 | 121 | else |
@@ -80,10 +124,3 int main(int argc, char *argv[]) | |||
|
80 | 124 |
|
|
81 | 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 | 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 | 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 |
@@ -21,6 +21,8 | |||
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "mainwindow.h" |
|
23 | 23 | #include <QDockWidget> |
|
24 | #include <socexplorersettings.h> | |
|
25 | #include <socexplorerconfigkeys.h> | |
|
24 | 26 | |
|
25 | 27 | SocExplorerMainWindow::SocExplorerMainWindow(QString ScriptToEval, QWidget *parent) |
|
26 | 28 | : QMainWindow(parent) |
@@ -31,6 +33,7 SocExplorerMainWindow::SocExplorerMainWi | |||
|
31 | 33 | this->makeObjects(ScriptToEval); |
|
32 | 34 | this->makeLayout(); |
|
33 | 35 | this->makeMenu(); |
|
36 | SocExplorerSettings::init(); | |
|
34 | 37 | this->makeConnections(); |
|
35 | 38 | this->setWindowIcon(QIcon(":/images/icon.png")); |
|
36 | 39 | this->setAcceptDrops(true); |
@@ -50,8 +53,11 void SocExplorerMainWindow::makeObjects( | |||
|
50 | 53 | Q_UNUSED(ScriptToEval) |
|
51 | 54 | this->p_pluginGUIlist = new QList<QDockWidget*>(); |
|
52 | 55 | pluginsDockContainer = new QMainWindow; |
|
56 | pluginsDockContainer->setObjectName("pluginsDockContainer"); | |
|
53 | 57 | pluginsDockContainer->setWindowFlags(Qt::Widget); |
|
54 | 58 | pluginsDockContainer->setDockNestingEnabled(true); |
|
59 | this->sessionsActions = new QActionGroup(this); | |
|
60 | this->sessionManagerAction =new QAction(tr("&Session manager"),this); | |
|
55 | 61 | this->mainWidget = new QSplitter(Qt::Vertical); |
|
56 | 62 | this->appTranslator = new QTranslator; |
|
57 | 63 | this->Quit = new QAction(tr("&Quit"),this); |
@@ -63,16 +69,19 void SocExplorerMainWindow::makeObjects( | |||
|
63 | 69 | this->help = new QAction(tr("&Help"),this); |
|
64 | 70 | this->help->setShortcut(tr("CTRL+H")); |
|
65 | 71 | this->about = new QAction(tr("&About"),this); |
|
72 | this->p_SessionManagerDialog = new SessionManagerDialog(); | |
|
66 | 73 | socexplorerproxy::setMainWindow(this); |
|
67 | 74 | SocExplorerEngine::setMainWindow(this); |
|
68 | 75 | SocExplorerEngine::xmlModel()->scanXmlFiles(); |
|
69 | 76 | this->regExplorer = new RegsExplorer(); |
|
70 | 77 | this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
78 | this->regExplorer->setObjectName("regExplorer"); | |
|
71 | 79 | this->addPluginInterface(this->regExplorer); |
|
72 | 80 | this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self()); |
|
73 | 81 | this->PythonConsoleInst->addObject("SocExplorerEngine",SocExplorerEngine::self()); |
|
74 | 82 | this->pluginManager = new dockablePluginManager(); |
|
75 | 83 | this->toolpane = new toolBar; |
|
84 | this->toolpane->setObjectName("toolpane"); | |
|
76 | 85 | this->p_about = new aboutsocexplorer(); |
|
77 | 86 | } |
|
78 | 87 | |
@@ -107,6 +116,13 void SocExplorerMainWindow::makeConnecti | |||
|
107 | 116 | connect(this->about,SIGNAL(triggered()),this,SLOT(showAboutBox())); |
|
108 | 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 | 126 | this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString))); |
|
111 | 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 | 132 | void SocExplorerMainWindow::launchPluginManager() |
|
117 | 133 | { |
|
118 | ||
|
119 | 134 | if(this->pluginManager->isHidden()) |
|
120 | 135 | { |
|
121 | 136 | this->pluginManager->setHidden(false); |
|
122 | 137 | } |
|
123 | ||
|
124 | 138 | } |
|
125 | 139 | |
|
126 | 140 | |
@@ -150,6 +164,11 void SocExplorerMainWindow::clearMenu() | |||
|
150 | 164 | void SocExplorerMainWindow::makeMenu() |
|
151 | 165 | { |
|
152 | 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 | 172 | this->PluginsMenu = menuBar()->addMenu(tr("&Plugins")); |
|
154 | 173 | this->ToolsMenu = menuBar()->addMenu(tr("&Tools")); |
|
155 | 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 | 234 | SocExplorerMainWindow::~SocExplorerMainWindow() |
|
168 | 235 | { |
|
236 | ||
|
169 | 237 | } |
|
170 | 238 | |
|
171 | 239 | |
@@ -224,10 +292,69 void SocExplorerMainWindow::pluginselect | |||
|
224 | 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 | 355 | void SocExplorerMainWindow::closeEvent(QCloseEvent *event) |
|
230 | 356 | { |
|
357 | saveCurrentSession(); | |
|
231 | 358 | socexplorerproxy::self()->close(); |
|
232 | 359 | qApp->closeAllWindows(); |
|
233 | 360 | event->accept(); |
@@ -38,17 +38,21 | |||
|
38 | 38 | #include "aboutsocexplorer.h" |
|
39 | 39 | #include "toolbar.h" |
|
40 | 40 | #include "regsExplorer/regsexplorer.h" |
|
41 | #include "socexplorergui.h" | |
|
42 | #include "sessionmanagerdialog.h" | |
|
41 | 43 | |
|
42 | 44 | class SocExplorerMainWindow : public QMainWindow |
|
43 | 45 | { |
|
44 | 46 | Q_OBJECT |
|
45 | 47 | |
|
48 | ||
|
46 | 49 | public: |
|
47 | 50 | SocExplorerMainWindow(QString ScriptToEval,QWidget *parent = 0); |
|
48 | 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 | 54 | QActionGroup*langActionGrp; |
|
51 | QMenu* FileMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu; | |
|
55 | QMenu* FileMenu,*SettingsMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu,*SessionsMenu; | |
|
52 | 56 | QTranslator* appTranslator; |
|
53 | 57 | void createLangMenu(); |
|
54 | 58 | void closeEvent(QCloseEvent *event); |
@@ -64,7 +68,12 public slots: | |||
|
64 | 68 | void setLangage(QAction* action); |
|
65 | 69 | void showAboutBox(); |
|
66 | 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 | 77 | signals: |
|
69 | 78 | void translateSig(); |
|
70 | 79 | void registerObject(QObject* object,const QString& instanceName); |
@@ -74,6 +83,10 private: | |||
|
74 | 83 | void makeLayout(); |
|
75 | 84 | void makeConnections(); |
|
76 | 85 | void makeMenu(); |
|
86 | void loadSessions(); | |
|
87 | void savePlugins(); | |
|
88 | void saveCurrentSession(); | |
|
89 | void loadCurrentSession(); | |
|
77 | 90 | QMainWindow* pluginsDockContainer; |
|
78 | 91 | QSplitter* mainWidget; |
|
79 | 92 | PythonConsole* PythonConsoleInst; |
@@ -81,6 +94,9 private: | |||
|
81 | 94 | RegsExplorer* regExplorer; |
|
82 | 95 | aboutsocexplorer* p_about; |
|
83 | 96 | QList<QDockWidget*>* p_pluginGUIlist; |
|
97 | QStringList p_Sessions; | |
|
98 | QString p_currentSession; | |
|
99 | SessionManagerDialog* p_SessionManagerDialog; | |
|
84 | 100 | }; |
|
85 | 101 | |
|
86 | 102 | #endif // MAINWINDOW_H |
@@ -73,7 +73,9 SOURCES += main.cpp\ | |||
|
73 | 73 | toolbar.cpp \ |
|
74 | 74 | toolbarcontainer.cpp \ |
|
75 | 75 | aboutsocexplorer.cpp \ |
|
76 | regsExplorer/regsexplorer.cpp | |
|
76 | regsExplorer/regsexplorer.cpp \ | |
|
77 | socexplorercoresettingsgui.cpp \ | |
|
78 | sessionmanagerdialog.cpp | |
|
77 | 79 | |
|
78 | 80 | HEADERS += mainwindow.h \ |
|
79 | 81 | PyWdgt/pythonconsole.h \ |
@@ -84,7 +86,9 HEADERS += mainwindow.h \ | |||
|
84 | 86 | socexplorer.h \ |
|
85 | 87 | SocExplorerEngine/plugins/socexplorerplugin.h \ |
|
86 | 88 | aboutsocexplorer.h \ |
|
87 | regsExplorer/regsexplorer.h | |
|
89 | regsExplorer/regsexplorer.h \ | |
|
90 | socexplorercoresettingsgui.h \ | |
|
91 | sessionmanagerdialog.h | |
|
88 | 92 | |
|
89 | 93 | |
|
90 | 94 | include ( NicePyConsole/NicePyConsole.pri) |
@@ -101,7 +105,9 TRANSLATIONS = ../translations/socexplor | |||
|
101 | 105 | ../translations/socexplorer_en.ts |
|
102 | 106 | |
|
103 | 107 | FORMS += \ |
|
104 | regsExplorer/regsexplorernew.ui | |
|
108 | regsExplorer/regsexplorernew.ui \ | |
|
109 | socexplorercoresettingsgui.ui \ | |
|
110 | sessionmanagerdialog.ui | |
|
105 | 111 | |
|
106 | 112 | DISTFILES += \ |
|
107 | 113 | ../doc/PythonExamples/LEON3_LOAD.py \ |
General Comments 0
You need to be logged in to leave comments.
Login now