##// END OF EJS Templates
New register explorer WIP.
jeandet -
r78:9b311fda2412 default
parent child
Show More
@@ -1,4 +1,4
1 2c82d72694590cbc2aebb946667f11f60ea89afe src/SocExplorerEngine/PeripheralWidget
1 9790824220ca06014e65a5c13aa4ed37f89d7593 src/SocExplorerEngine/PeripheralWidget
2 2 cc958c79ba0939809a70e63b8bac798930160243 src/common/genericBinaryFiles
3 3 2dce25b198558be573f56c1cf337aa95ddd666d6 src/common/lppserial
4 4 923afde9cc96bb419cf898560d080ec96991aeca src/common/qhexedit
@@ -1,12 +1,16
1 1 QGroupBox {
2 2 border: 1px solid gray;
3 3 border-radius: 9px;
4 4 margin-top: 0.5em;
5 5 }
6 6
7 7 QGroupBox::title {
8 8 subcontrol-origin: margin;
9 9 left: 10px;
10 10 padding: 0 3px 0 3px;
11 11 }
12 12
13 QWidget#CollapsablePeripheralWidget {
14 border: 1px solid gray;
15 border-radius: 9px;
16 }
@@ -1,166 +1,177
1 1 SOCEXPLORER_ROOT = \"$${PWD}/../..\"
2 2
3 3 include($${PWD}/../../build_cfg/socexplorer.pri)
4 4
5 5 TARGET = socexplorerengine$${DEBUG_EXT}
6 6 TEMPLATE = lib
7 7
8 8 #more verbose plugin loader to debug plugin loading issues such as dependencies issues
9 9 SOCEXPLORER_PLUGIN_LOADER="custom"
10 10
11 11 SOCEXPLORER_CHAGESETNUM=$$system(hg id)
12 12 isEmpty(SOCEXPLORER_CHAGESETNUM){
13 13 SOCEXPLORER_CHAGESETNUM=2c7201cecc87+
14 14 }
15 15 SOCEXPLORER_CHAGESETNUMSTR = '\\"$${SOCEXPLORER_CHAGESETNUM}\\"'
16 16 SOCEXPLORER_BRANCH=$$system(hg branch)
17 17 isEmpty(SOCEXPLORER_BRANCH){
18 18 SOCEXPLORER_BRANCH=default
19 19 }
20 20 SOCEXPLORER_BRANCHSTR = '\\"$${SOCEXPLORER_BRANCH}\\"'
21 21
22 22 DEFINES += SOCEXPLORER_VERSION="\"\\\"0.5.0"\\\"\"
23 23 DEFINES += SOCEXPLORER_CHAGESET=\"$${SOCEXPLORER_CHAGESETNUMSTR}\"
24 24 DEFINES += SOCEXPLORER_BRANCH=\"$${SOCEXPLORER_BRANCHSTR}\"
25 25
26 26
27 27 message("Building SOCEXPLORER changeset $${SOCEXPLORER_CHAGESETNUM}")
28 28
29 29 DEFINES += SOCEXPLORER_EXPORTS
30 30
31 31 include ( plugins/socexplorerplugin.prf )
32 32 include ( PeripheralWidget/PeripheralWidget.pri)
33 33
34 34 win32:CONFIG += dll
35 35 win32:CONFIG -= static
36 36 win32:LIBS+=-L$${SOCEXPLORER_ROOT}/bin/win32 -lsocexplorercommon$${DEBUG_EXT}
37 37
38 38 contains(SOCEXPLORER_PLUGIN_LOADER,"custom")
39 39 {
40 40 unix:LIBS+= -ldl
41 41 unix:DEFINES += SOCEXPLORER_CUSTOM_PLUGIN_LOADER
42 42 unix:HEADERS += \
43 43 pluginloader/unix/unixpluginloader.h
44 44 unix:SOURCES += \
45 45 pluginloader/unix/unixpluginloader.cpp
46 46 }
47 47
48 48 target.path = $$[QT_INSTALL_LIBS]
49 49 isEmpty(target.path) {
50 50 error(can\'t get QT_INSTALL_LIBS)
51 51 }
52 52
53 53 header.path = $$[QT_INSTALL_HEADERS]/SocExplorer
54 54 header.files = engine/socexplorerengine.h \
55 55 pluginloader/pluginscache.h \
56 56 plugins/socexplorerplugin.h \
57 57 proxy/socexplorerproxy.h \
58 58 engine/socexplorerxmlfile.h \
59 59 SOC/socexplorerenumdevice.h \
60 60 plugins/genericPySysdriver.h \
61 61 XmlEngine/XMLmodel.h \
62 62 XmlEngine/XMLdata.h \
63 63 XmlEngine/xmldriver.h \
64 64 SOC/socmodel.h \
65 65 SOC/registerdata.h \
66 66 SOC/socclk.h \
67 67 PeripheralWidget/src/peripheralwidget.h \
68 68 PeripheralWidget/src/registerwidget.h \
69 69 PeripheralWidget/src/socregsviewer.h \
70 PeripheralWidget/src/socregsviewernew.h \
70 71 memtester/memtester.h
71 72
72 73
73 74
74 75 isEmpty(header.path) {
75 76 error(can\'t get QT_INSTALL_HEADERS)
76 77 }
77 78
78 79 pluginif.files = pluginsInterface/*.h \
79 80 pluginsInterface/*.cpp
80 81
81 82 pluginif.path = $$[QT_INSTALL_HEADERS]/SocExplorer/pluginsInterface
82 83
83 84
84 85 INSTALLS += target header pluginif
85 86
86 87 INCLUDEPATH += engine \
87 88 pluginloader \
88 89 pluginsInterface \
89 90 proxy \
90 91 plugins \
91 92 pluginManagerWdgt \
92 93 ../common \
93 94 ../common/genericBinaryFiles \
94 95 ../ \
95 96 RegisterMVS \
96 97 XmlEngine \
97 98 SOC \
98 99 PeripheralWidget/src \
99 100 memtester
100 101
101 102
102 103 HEADERS += \
103 104 pluginloader/pluginscache.h \
104 105 pluginloader/pluginloader.h \
105 106 plugins/genericPySysdriver.h \
106 107 pluginManagerWdgt/plugintree.h \
107 108 pluginManagerWdgt/pluginmanagerWDGT.h \
108 109 pluginManagerWdgt/pluginlist.h \
109 110 pluginManagerWdgt/plugininfoswdgt.h \
110 111 XmlEngine/XMLmodel.h \
111 112 XmlEngine/XMLdata.h \
112 113 SOC/socmodel.h \
113 114 SOC/registerdata.h \
114 115 XmlEngine/xmldriver.h \
115 116 PeripheralWidget/src/peripheralwidget.h \
116 117 PeripheralWidget/src/registerwidget.h \
117 118 PeripheralWidget/src/socregsviewer.h \
118 119 SOC/socclk.h \
119 120 engine/socexplorerengine.h \
120 121 engine/socexplorerxmlfile.h \
121 122 plugins/socexplorerplugin.h \
122 123 pluginsInterface/socexplorerplugininterface.h \
123 124 pluginsInterface/socexplorerplugininterface_global.h \
124 125 proxy/socexplorerproxy.h \
125 126 SOC/socexplorerenumdevice.h \
126 127 PySocExplorerEngine.h \
127 memtester/memtester.h
128 memtester/memtester.h\
129 PeripheralWidget/src/socregsviewernew.h \
130 PeripheralWidget/src/collapsableperipheralwidget.h
128 131
129 132
130 133
131 134
132 135
133 136
134 137 SOURCES += \
135 138 pluginloader/pluginscache.cpp \
136 139 pluginloader/pluginloader.cpp \
137 140 pluginManagerWdgt/plugintree.cpp \
138 141 pluginManagerWdgt/pluginmanagerWDGT.cpp \
139 142 pluginManagerWdgt/pluginlist.cpp \
140 143 pluginManagerWdgt/plugininfoswdgt.cpp \
141 144 XmlEngine/XMLmodel.cpp \
142 145 XmlEngine/XMLdata.cpp \
143 146 SOC/socmodel.cpp \
144 147 SOC/registerdata.cpp \
145 148 XmlEngine/xmldriver.cpp \
146 149 PeripheralWidget/src/peripheralwidget.cpp \
147 150 PeripheralWidget/src/registerwidget.cpp \
148 151 PeripheralWidget/src/socregsviewer.cpp \
149 152 SOC/socclk.cpp \
150 153 plugins/genericPySysdriver.cpp \
151 154 engine/socexplorerengine.cpp \
152 155 engine/socexplorerxmlfile.cpp \
153 156 proxy/socexplorerproxy.cpp \
154 157 SOC/socexplorerenumdevice.cpp \
155 158 plugins/socexplorerplugin.cpp \
156 memtester/memtester.cpp
159 memtester/memtester.cpp \
160 PeripheralWidget/src/socregsviewernew.cpp \
161 PeripheralWidget/src/collapsableperipheralwidget.cpp
157 162
158 163
159 164 OTHER_FILES += \
160 165 plugins/socexplorerplugin.cpp \
161 166 pluginsInterface/socexplorerplugininterface.cpp \
162 167 plugins/socexplorerplugin.prf \
163 168 pythongenerator.sh \
164 169 pythonQtgeneratorCfg.txt
165 170
171 FORMS += \
172 PeripheralWidget/src/socregsviewernew.ui \
173 PeripheralWidget/src/collapsableperipheralwidget.ui
166 174
175
176 RESOURCES += \
177 PeripheralWidget/ressources/peripheralwidget.qrc
@@ -1,370 +1,371
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #include "socexplorerproxy.h"
23 23 #include <pluginmanagerWDGT.h>
24 24 #include <socexplorerengine.h>
25 25 #include <pluginloader.h>
26 26 #include <socexplorerplugin.h>
27 27
28 28 socexplorerproxy* socexplorerproxy::_self=NULL;
29 29 QMainWindow* socexplorerproxy::mainWindow=NULL;
30 30 QList<socexplorerplugin*>* socexplorerproxy::drivers=NULL;
31 31 QList<socexplorerplugin*>* socexplorerproxy::linearDriverList=NULL;
32 32 socexplorerplugin* socexplorerproxy::root=NULL;
33 33 socexplorerplugin* socexplorerproxy::parent=NULL;
34 34 PluginsCache* socexplorerproxy::cache=NULL;
35 35
36 36 socexplorerproxy::socexplorerproxy(QObject *parent) :
37 37 QObject(parent)
38 38 {
39 39 cache = new PluginsCache;
40 40 drivers = new QList<socexplorerplugin*>;
41 41 linearDriverList=new QList<socexplorerplugin*>;
42 42 root = NULL;
43 43 }
44 44
45 45
46 46 socexplorerproxy::socexplorerproxy(QMainWindow *Mainwindow, QObject *parent):
47 47 QObject(parent)
48 48 {
49 49 mainWindow = Mainwindow;
50 50 cache = new PluginsCache;
51 51 drivers = new QList<socexplorerplugin*>;
52 52 linearDriverList=new QList<socexplorerplugin*>;
53 53 root = NULL;
54 54 }
55 55
56 56
57 57 void socexplorerproxy::init()
58 58 {
59 59 if(!_self)
60 60 {
61 61 _self = new socexplorerproxy();
62 62 mainWindow = NULL;
63 63 }
64 64
65 65 }
66 66
67 67 void socexplorerproxy::setMainWindow(QMainWindow *Mainwindow)
68 68 {
69 69 if(!_self)init();
70 70 mainWindow=Mainwindow;
71 71 }
72 72
73 73 void socexplorerproxy::loadSysDriver(const QString name)
74 74 {
75 75 if(!_self)init();
76 76 if(pluginloader::libcanberoot(name))
77 77 {
78 78 socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name);
79 79 QString driverName = _self->getinstanceName(driver->baseName());
80 80 loadSysDriver(driver,driverName);
81 81 }
82 82 }
83 83
84 84 void socexplorerproxy::loadSysDriver(const QString name, const QString instanceName)
85 85 {
86 86 if(!_self)init();
87 87 if(pluginloader::libcanberoot(name) && !_self->instanceExists(instanceName))
88 88 {
89 89 socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name);
90 90 loadSysDriver(driver,instanceName);
91 91 }
92 92 }
93 93
94 94
95 95 void socexplorerproxy::loadSysDriver(socexplorerplugin *driver, const QString instanceName)
96 96 {
97 97 if(!_self)init();
98 98 driver->setInstanceName(instanceName);
99 99 driver->parent = NULL;
100 100 drivers->append(driver);
101 101 linearDriverList->append(driver);
102 102 connectChildToProxy(driver);
103 103 emit _self->addPluginGUI(driver);
104 104 emit _self->clearMenu();
105 105 emit _self->treeChanged(QList<socexplorerplugin*>(*drivers));
106 106 SocExplorerEngine::addSOC(driver);
107 driver->postInstantiationTrigger();
107 108 }
108 109
109 110 void socexplorerproxy::loadChildSysDriver(socexplorerplugin *parent, const QString child)
110 111 {
111 112 if(!_self)init();
112 113 if(pluginloader::libcanbechild(child))
113 114 {
114 115 socexplorerplugin* driver = pluginloader::newsocexplorerplugin(child);
115 116 QString driverName = _self->getinstanceName(driver->baseName());
116 117 bool ok=true;
117 118 if(ok)
118 119 {
119 120 if(parent!=NULL)_self->loadSysDriverToParent(driver,parent,driverName);
120 121 }
121 122 }
122 123 }
123 124
124 125 void socexplorerproxy::loadSysDriverToParent(const QString name,const QString ParentInst)
125 126 {
126 127 if(!_self)init();
127 128 if(pluginloader::libcanbechild(name))
128 129 {
129 130 socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name);
130 131 QString driverName = _self->getinstanceName(driver->baseName());
131 132 bool ok=true;
132 133 if(ok)
133 134 {
134 135 socexplorerplugin* parent=_self->getSysDriver(ParentInst);
135 136 if(parent!=NULL)loadSysDriverToParent(driver,parent,driverName);
136 137 }
137 138 }
138 139 }
139 140
140 141
141 142 void socexplorerproxy::loadSysDriverToParent(const QString name,const QString instanceName,const QString ParentInst)
142 143 {
143 144 if(!_self)init();
144 145 if(pluginloader::libcanbechild(name) && !_self->instanceExists(instanceName))
145 146 {
146 147 socexplorerplugin* driver = pluginloader::newsocexplorerplugin(name);
147 148 bool ok=true;
148 149 if(ok)
149 150 {
150 151 socexplorerplugin* parent=_self->getSysDriver(ParentInst);
151 152 if(parent!=NULL)loadSysDriverToParent(driver,parent,instanceName);
152 153 }
153 154 }
154 155 }
155 156
156 157 void socexplorerproxy::loadSysDriverToParent(socexplorerplugin *driver,socexplorerplugin *parent, const QString instanceName)
157 158 {
158 159 if(!_self)init();
159 160 linearDriverList->append(driver);
160 161 driver->parent = parent;
161 162 driver->setInstanceName(instanceName);
162 163 parent->childs.append(driver);
163 164 connectChildToProxy(driver);
164 165 connectChildToParent(parent,driver);
165 166 emit _self->clearMenu();
166 167 emit _self->addPluginGUI(driver);
167 168 emit _self->treeChanged(QList<socexplorerplugin*>(*drivers));
168 169 driver->postInstantiationTrigger();
169 170 }
170 171
171 172
172 173 void socexplorerproxy::changeSysDriverInstName(const QString instanceName)
173 174 {
174 175 Q_UNUSED(instanceName)
175 176 }
176 177
177 178 void socexplorerproxy::changeSysDriverInstName(const QString newinstanceName, const QString previnstanceName)
178 179 {
179 180 if(!_self)init();
180 181 socexplorerplugin*temp=_self->getSysDriver(previnstanceName);
181 182 if(temp!=NULL)
182 183 {
183 184 if(NULL!=_self->getSysDriver(newinstanceName))
184 185 {
185 186 emit _self->treeChanged(QList<socexplorerplugin*>(*drivers));
186 187 return;
187 188 }
188 189 temp->setInstanceName(newinstanceName);
189 190 }
190 191 emit _self->treeChanged(QList<socexplorerplugin*>(*drivers));
191 192 }
192 193
193 194
194 195 void socexplorerproxy::connectChildToParent(socexplorerplugin *parent, socexplorerplugin *child)
195 196 {
196 197 if(!_self)init();
197 198 connect(parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool)));
198 199 child->activate(parent->isConnected());
199 200 }
200 201
201 202 void socexplorerproxy::disconnectChildToParent(socexplorerplugin *child)
202 203 {
203 204 if(!_self)init();
204 205 disconnect(child->parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool)));
205 206 }
206 207
207 208
208 209 void socexplorerproxy::connectChildToProxy(socexplorerplugin *child)
209 210 {
210 211 if(!_self)init();
211 212 connect(child,SIGNAL(registerObject(QObject*,QString)),_self,SIGNAL(registerObject(QObject*,QString)));
212 213 connect(child,SIGNAL(closePlugin(socexplorerplugin*)),_self,SLOT(closeSysDriver(socexplorerplugin*)));
213 214 }
214 215
215 216 void socexplorerproxy::disconnectChildToProxy(socexplorerplugin *child)
216 217 {
217 218 if(!_self)init();
218 219 disconnect(child,SIGNAL(registerObject(QObject*,QString)),_self,SIGNAL(registerObject(QObject*,QString)));
219 220 disconnect(child,SIGNAL(closePlugin(socexplorerplugin*)),_self,SLOT(closeSysDriverFromDriver(socexplorerplugin*)));
220 221 }
221 222
222 223 QString socexplorerproxy::getinstanceName(const QString& baseName)
223 224 {
224 225 if(!_self)init();
225 226 int i=0;
226 227 QString name;
227 228 bool validName = false;
228 229 while(!validName)
229 230 {
230 231 name.clear();
231 232 name.append(baseName+QString::number(i));
232 233 validName = instanceNameIsValid(name);
233 234 i++;
234 235 }
235 236 return name;
236 237 }
237 238
238 239 void socexplorerproxy::changeSysDriverInstName(socexplorerplugin* driver)
239 240 {
240 241 if(!_self)init();
241 242 QString prevName(driver->instanceName());
242 243 }
243 244
244 245 bool socexplorerproxy::instanceNameIsValid(const QString& instanceName)
245 246 {
246 247 if(!_self)init();
247 248 for(int k=0;k<linearDriverList->count();k++)
248 249 {
249 250 if(!linearDriverList->at(k)->instanceName().compare(instanceName))
250 251 return false;
251 252 }
252 253 return true;
253 254 }
254 255
255 256 socexplorerplugin *socexplorerproxy::findPlugin(const QString &instanceName)
256 257 {
257 258 if(!_self)init();
258 259 for(int k=0;k<linearDriverList->count();k++)
259 260 {
260 261 if(!linearDriverList->at(k)->instanceName().compare(instanceName))
261 262 return linearDriverList->at(k);
262 263 }
263 264 return NULL;
264 265 }
265 266
266 267 bool socexplorerproxy::instanceExists(const QString &instanceName)
267 268 {
268 269 return !socexplorerproxy::instanceNameIsValid(instanceName);
269 270 }
270 271
271 272 void socexplorerproxy::close()
272 273 {
273 274 if(!_self)init();
274 275 socexplorerplugin* tmpPtr;
275 276 while(drivers->count()>0)
276 277 {
277 278 tmpPtr = drivers->last();
278 279 drivers->removeLast();
279 280 _self->closeSysDriver(tmpPtr);
280 281 }
281 282 if(root!=NULL)
282 283 {
283 284 _self->closeSysDriver(root);
284 285 }
285 286
286 287 }
287 288
288 289 socexplorerplugin* socexplorerproxy::getSysDriver(const QString instanceName)
289 290 {
290 291 if(!_self)init();
291 292 for(int i=0;i<linearDriverList->count();i++)
292 293 {
293 294 if(!linearDriverList->at(i)->instanceName().compare(instanceName))
294 295 return linearDriverList->at(i);
295 296 }
296 297 return NULL;
297 298 }
298 299
299 300
300 301 void socexplorerproxy::closeSysDriver(const QString instanceName)
301 302 {
302 303 if(!_self)init();
303 304 closeSysDriver(getSysDriver(instanceName),false);
304 305 }
305 306
306 307 void socexplorerproxy::closeSysDriver(socexplorerplugin *driver, bool recursive)
307 308 {
308 309 if(!_self)init();
309 310 if(driver!=NULL)
310 311 {
311 312 emit _self->removePluginGUI(driver);
312 313 if(driver->parent==NULL)SocExplorerEngine::removeSOC(driver);
313 314 while(driver->childs.count()!=0)closeSysDriver(driver->childs.first());
314 315 linearDriverList->removeOne(driver);
315 316 if(driver->parent!= NULL)
316 317 {
317 318 driver->parent->childs.removeOne(driver); //Have parent so it's a child
318 319 disconnectChildToParent(driver);
319 320 disconnectChildToProxy(driver);
320 321 delete driver;
321 322 }
322 323 else
323 324 {
324 325 drivers->removeOne(driver);
325 326 disconnectChildToProxy(driver);
326 327 delete driver;
327 328 }
328 329 if(!recursive)
329 330 {
330 331 emit _self->clearMenu();
331 332 emit _self->registermenu(mainWindow);
332 333 emit _self->treeChanged(QList<socexplorerplugin*>(*drivers));
333 334 }
334 335 }
335 336
336 337 }
337 338
338 339 void socexplorerproxy::geteplugintree()
339 340 {
340 341 if(!_self)init();
341 342 emit _self->treeChanged(QList<socexplorerplugin*>(*drivers));
342 343 }
343 344
344 345 void socexplorerproxy::closeSysDriverFromDriver(socexplorerplugin *driver)
345 346 {
346 347 if(!_self)init();
347 348 emit _self->closeSysDriverSig(driver);
348 349 }
349 350
350 351 void socexplorerproxy::updateText()
351 352 {
352 353 if(!_self)init();
353 354 emit _self->clearMenu();
354 355 emit _self->registermenu(mainWindow);
355 356 }
356 357
357 358
358 359
359 360
360 361
361 362 void socexplorerproxy::makeMenu(QMenu* menu)
362 363 {
363 364 if(!_self)init();
364 365 for(int i=0;i<drivers->count();i++)
365 366 {
366 367 drivers->at(i)->registermenu(menu);
367 368 }
368 369 }
369 370
370 371
@@ -1,49 +1,50
1 1 #include "regsexplorer.h"
2 2 #include "socmodel.h"
3 3
4 4 regsExplorer::regsExplorer(QWidget *parent) :
5 5 QDockWidget(parent)
6 6 {
7 7 mainWidget = new QTabWidget;
8 8 cfg = new regsExplorerCfg;
9 socViewer = new socRegsViewer(tr("No soc Detected"),this);
9 socViewer = new SocRegsViewerNew(tr("No soc Detected"),this);
10 10 this->setWidget(this->mainWidget);
11 11 this->mainWidget->addTab(this->cfg,"Config");
12 12 this->mainWidget->addTab(this->socViewer,"View");
13 13 this->setWindowTitle(tr("Regs Explorer"));
14 14 connect(SocExplorerEngine::self(),SIGNAL(enumDeviceAdded(socExplorerEnumDevice*)),this,SLOT(addDev(socExplorerEnumDevice*)));
15 15 }
16 16
17 17
18 18 void regsExplorer::addDev(socExplorerEnumDevice *device)
19 19 {
20 peripheralWidget* peripheral=new peripheralWidget(device->name(),device->baseAddress(),this);
20 delegate.device = device;
21 peripheralWidget* peripheral=new peripheralWidget(device->name(),device->baseAddress(),&delegate,this);
21 22 this->socViewer->addPeripheral(peripheral);
22 23 peripheralModel periphM=SocExplorerEngine::xmlModel()->getPeripheral(device->name());
23 24 int startIndex,stopIndex;
24 25 QString desc;
25 26 QString name;
26 27 bool rw;
27 28 for(int i=0;i<periphM.registers.count();i++)
28 29 {
29 30 peripheral->addRegister(periphM.registers.at(i).name,device->baseAddress() + periphM.registers.at(i).offset);
30 31 for(int j=0;j<periphM.registers.at(i).bitfields.count();j++)
31 32 {
32 33 startIndex = periphM.registers.at(i).bitfields.at(j).offset;
33 34 stopIndex = periphM.registers.at(i).bitfields.at(j).offset+periphM.registers.at(i).bitfields.at(j).size-1;
34 35 desc = periphM.registers.at(i).bitfields.at(j).description;
35 36 rw = periphM.registers.at(i).bitfields.at(j).rw;
36 37 name = periphM.registers.at(i).bitfields.at(j).name;
37 38 peripheral->registerAt(i)->setBitFieldAttribute(startIndex,stopIndex,name,desc,rw);
38 39 }
39 40 }
40 connect(peripheral,SIGNAL(readRegSig(qint32)),device,SLOT(readReg(qint32)));
41 connect(peripheral,SIGNAL(writeRegSig(qint32,qint32)),device,SLOT(writeReg(qint32,qint32)));
42 QCheckBox* chkbx = this->cfg->addDev(device);
43 chkbx->setChecked(true);
44 connect(chkbx,SIGNAL(toggled(bool)),peripheral,SLOT(setVisible(bool)));
41 // connect(peripheral,SIGNAL(readRegSig(qint32)),device,SLOT(readReg(qint32)));
42 // connect(peripheral,SIGNAL(writeRegSig(qint32,qint32)),device,SLOT(writeReg(qint32,qint32)));
43 // QCheckBox* chkbx = this->cfg->addDev(device);
44 // chkbx->setChecked(true);
45 // connect(chkbx,SIGNAL(toggled(bool)),peripheral,SLOT(setVisible(bool)));
45 46 }
46 47
47 48
48 49
49 50
@@ -1,55 +1,66
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef REGSEXPLORER_H
23 23 #define REGSEXPLORER_H
24 24
25 25 #include <QWidget>
26 26 #include <QTabWidget>
27 27 #include <QDockWidget>
28 28 #include "regsexplorercfg.h"
29 29 #include "regsviewer.h"
30 30 #include <QGridLayout>
31 31 #include <socexplorerengine.h>
32 32 #include <peripheralwidget.h>
33 33 #include <socregsviewer.h>
34 #include <socregsviewernew.h>
35
36
34 37
35 38 class regsExplorer : public QDockWidget
36 39 {
37 40 Q_OBJECT
41 class regExplorerReadWriteDelegate: public peripheralWidget::readWriteProxy
42 {
43 public:
44 regExplorerReadWriteDelegate() {}
45 void writeReg(qint32 address,qint32 value){if(device)device->writeReg(address,value);}
46 qint32 readReg(qint32 address){if(device)return device->readReg(address);}
47 socExplorerEnumDevice* device;
48 };
38 49 public:
39 50 explicit regsExplorer(QWidget *parent = 0);
40 51
41 52 signals:
42 53
43 54 public slots:
44 55
45 56 void addDev(socExplorerEnumDevice* device);
46 57
47 58 private:
48 59 QTabWidget* mainWidget;
49 60 regsExplorerCfg* cfg;
50 socRegsViewer* socViewer;
51
52
61 // socRegsViewer* socViewer;
62 SocRegsViewerNew* socViewer;
63 regExplorerReadWriteDelegate delegate;
53 64 };
54 65
55 66 #endif // REGSEXPLORER_H
@@ -1,113 +1,114
1 1 #-------------------------------------------------
2 2 #
3 3 # Project created by QtCreator 2011-09-19T22:52:10
4 4 #
5 5 #-------------------------------------------------
6 6 SOCEXPLORER_ROOT = $${PWD}/..
7 7 include(../build_cfg/socexplorer.pri)
8 8
9 9 TARGET = socexplorer$${DEBUG_EXT}
10 10 TEMPLATE = app
11 11 CONFIG += pythonqt
12 12
13 13
14 14 QMAKE_LFLAGS_RELEASE += --enable-auto-import -mstackrealign
15 15 QMAKE_LFLAGS_DEBUG += --enable-auto-import -mstackrealign
16 16
17 17 include ( common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer.pri )
18 18 include ( SocExplorerEngine/pythonQtOut/generated_cpp/PySocExplorerEngine/PySocExplorerEngine.pri )
19 19 include ( SocExplorerEngine/plugins/socexplorerplugin.prf )
20 20
21 21 INCLUDEPATH+=$${PWD} \
22 22 $${PWD}/common \
23 23 $${PWD}/common/qhexedit \
24 24 $${PWD}/common/QCustomPlot \
25 25 $${PWD}/common/genericBinaryFiles \
26 26 $${PWD}/common/genericBinaryFiles/elf \
27 27 $${PWD}/common/genericBinaryFiles/srec \
28 28 $${PWD}/common/genericBinaryFiles/BinFile \
29 29 SocExplorerEngine/engine \
30 30 SocExplorerEngine/pluginloader \
31 31 SocExplorerEngine/pluginsInterface \
32 32 SocExplorerEngine/proxy \
33 33 SocExplorerEngine/pluginManagerWdgt \
34 34 SocExplorerEngine/plugins \
35 35 SocExplorerEngine/RegisterMVS \
36 36 SocExplorerEngine/XmlEngine \
37 37 SocExplorerEngine/SOC \
38 38 SocExplorerEngine/PeripheralWidget/src \
39 39 SocExplorerEngine/memtester
40 40
41 41 win32:INCLUDEPATH+= \
42 42 $${PWD}/common/genericBinaryFiles/elf/libelfWin32/include \
43 43 $${PWD}/common/genericBinaryFiles/elf/libelfWin32/include/libelf \
44 44
45 45
46 46 RC_FILE = ../win32cfg/socexplorer.rc
47 47
48 48
49 49 unix:LIBS+=-L$${SOCEXPLORER_ROOT}/bin/linux -lsocexplorercommon$${DEBUG_EXT} -L$${SOCEXPLORER_ROOT}/bin/linux -lsocexplorerengine$${DEBUG_EXT}
50 50
51 51 win32-g++:LIBS += $${SOCEXPLORER_ROOT}/bin/win32/socexplorercommon$${DEBUG_EXT}.dll $${SOCEXPLORER_ROOT}/bin/win32/socexplorerengine$${DEBUG_EXT}.dll
52 52
53 53
54 54 unix{
55 55 translation.files = $${SOCEXPLORER_ROOT}/translations/socexplorer_fr.qm \
56 56 $${SOCEXPLORER_ROOT}/translations/socexplorer_en.qm
57 57 translation.path = $${SOCEXPLORER_TRANSLATION_INSTALL_PATH}
58 58 target.path = /usr/bin
59 59 INSTALLS += translation target
60 60 }
61 61
62 62 header.path = $$[QT_INSTALL_HEADERS]/SocExplorer/common
63 63 header.files = \
64 64 socexplorer.h
65 65 INSTALLS += header
66 66
67 67
68 68 SOURCES += main.cpp\
69 69 mainwindow.cpp \
70 70 PyWdgt/pythonconsole.cpp \
71 71 PyWdgt/pythonqtscriptingconsoledandd.cpp \
72 72 dockablepluginmanager.cpp \
73 73 toolbar.cpp \
74 74 toolbarcontainer.cpp \
75 75 regsExplorer/regsexplorer.cpp \
76 76 regsExplorer/regsviewer.cpp \
77 77 regsExplorer/regsexplorercfg.cpp \
78 78 aboutsocexplorer.cpp
79 79
80 80 HEADERS += mainwindow.h \
81 81 PyWdgt/pythonconsole.h \
82 82 PyWdgt/pythonqtscriptingconsoledandd.h \
83 83 dockablepluginmanager.h \
84 84 toolbar.h \
85 85 toolbarcontainer.h \
86 86 regsExplorer/regsexplorer.h \
87 87 regsExplorer/regsviewer.h \
88 88 regsExplorer/regsexplorercfg.h \
89 89 socexplorer.h \
90 90 SocExplorerEngine/plugins/socexplorerplugin.h \
91 91 aboutsocexplorer.h
92 92
93 93
94 94 include ( NicePyConsole/NicePyConsole.pri)
95 95
96 96 win32{
97 97 RESOURCES = ../ressources/SocExplorer.qrc
98 98 }
99 99
100 100 unix{
101 101 RESOURCES = ../ressources/SocExplorer.qrc
102 102 }
103 103
104 104 TRANSLATIONS = ../translations/socexplorer_fr.ts \
105 105 ../translations/socexplorer_en.ts
106 106
107 107
108 108
109 109
110 110
111 111
112 112
113 113
114
General Comments 0
You need to be logged in to leave comments. Login now