##// END OF EJS Templates
Some cleaning.
jeandet -
r10:536aeec6c7cb default
parent child
Show More
@@ -1,1 +1,1
1 b05d3dada0406dd7c1700d5d53719a901d214281 src/SocExplorerEngine/PeripheralWidget
1 e3a98a04d9ec8685bf222f8d687a614a71927549 src/SocExplorerEngine/PeripheralWidget
@@ -217,7 +217,7 void SocExplorerEngine::message(socexplo
217 if(!_self)
217 if(!_self)
218 init();
218 init();
219 if(loglvl>=debugLevel)
219 if(loglvl>=debugLevel)
220 qDebug()<< QTime::currentTime().toString()+" " + sender->instanceName+":"+message;
220 qDebug()<< QTime::currentTime().toString()+" " + sender->instanceName()+":"+message;
221 }
221 }
222
222
223
223
@@ -75,6 +75,7 pluginmanagerWDGT::pluginmanagerWDGT(QWi
75 connect(this->treeview,SIGNAL(loadSysDriverToParent(QString,QString)),this,SIGNAL(loadSysDriverToParent(QString,QString)));
75 connect(this->treeview,SIGNAL(loadSysDriverToParent(QString,QString)),this,SIGNAL(loadSysDriverToParent(QString,QString)));
76 connect(this->treeview,SIGNAL(changeSysDriverInstName(QString,QString)),this,SIGNAL(changeSysDriverInstName(QString,QString)));
76 connect(this->treeview,SIGNAL(changeSysDriverInstName(QString,QString)),this,SIGNAL(changeSysDriverInstName(QString,QString)));
77 connect(this->treeview,SIGNAL(closeSysDriver(QString)),this,SIGNAL(closeSysDriver(QString)));
77 connect(this->treeview,SIGNAL(closeSysDriver(QString)),this,SIGNAL(closeSysDriver(QString)));
78 connect(this->treeview,SIGNAL(pluginselected(QString)),this,SIGNAL(pluginselected(QString)));
78 this->rootLoadable = false;
79 this->rootLoadable = false;
79 this->childLoadable = false;
80 this->childLoadable = false;
80 this->pluginTable->refreshPluginList();
81 this->pluginTable->refreshPluginList();
@@ -63,6 +63,8 signals:
63 void treeChanged(const QList<socexplorerplugin*>& drivers);
63 void treeChanged(const QList<socexplorerplugin*>& drivers);
64 void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName);
64 void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName);
65 void closeSysDriver(const QString instanceName);
65 void closeSysDriver(const QString instanceName);
66 void pluginselected(const QString& instanceName);
67
66 public slots:
68 public slots:
67 //void libselected(int row);
69 //void libselected(int row);
68 void addPlugin();
70 void addPlugin();
@@ -13,6 +13,7 plugintree::plugintree(QWidget *parent)
13 this->setAcceptDrops(true);
13 this->setAcceptDrops(true);
14 this->setDragDropMode(QAbstractItemView::DropOnly);
14 this->setDragDropMode(QAbstractItemView::DropOnly);
15 connect(this,SIGNAL(itemChanged(QTreeWidgetItem*,int)),this,SLOT(pluginselectedslt(QTreeWidgetItem*,int)));
15 connect(this,SIGNAL(itemChanged(QTreeWidgetItem*,int)),this,SLOT(pluginselectedslt(QTreeWidgetItem*,int)));
16 connect(this,SIGNAL(itemSelectionChanged()),this,SLOT(itemSelectionChangedslt()));
16 this->setHeaderLabels(QStringList()<<"Loaded plugins");
17 this->setHeaderLabels(QStringList()<<"Loaded plugins");
17 emit this->geteplugintree();
18 emit this->geteplugintree();
18 }
19 }
@@ -24,6 +25,14 void plugintree::pluginselectedslt(QTree
24 emit this->pluginselected(item->text(0));
25 emit this->pluginselected(item->text(0));
25 }
26 }
26
27
28 void plugintree::itemSelectionChangedslt()
29 {
30 if(this->selectedItems().count()==1)
31 {
32 emit this->pluginselected(this->selectedItems().first()->text(0));
33 }
34 }
35
27 void plugintree::treeChanged(const QList<socexplorerplugin*>& drivers)
36 void plugintree::treeChanged(const QList<socexplorerplugin*>& drivers)
28 {
37 {
29 this->clear();
38 this->clear();
@@ -31,7 +40,7 void plugintree::treeChanged(const QList
31 {
40 {
32 QTreeWidgetItem* currentItem=new QTreeWidgetItem;
41 QTreeWidgetItem* currentItem=new QTreeWidgetItem;
33 currentItem->setIcon(0,QSvgIcon(":/images/server.svg"));
42 currentItem->setIcon(0,QSvgIcon(":/images/server.svg"));
34 currentItem->setText(0,drivers.at(i)->instanceName);
43 currentItem->setText(0,drivers.at(i)->instanceName());
35 this->addTopLevelItem(currentItem);
44 this->addTopLevelItem(currentItem);
36 if(drivers.at(i)->childs.count()!=0)
45 if(drivers.at(i)->childs.count()!=0)
37 {
46 {
@@ -48,7 +57,7 void plugintree::addplugin(socexplorerpl
48 {
57 {
49 QTreeWidgetItem* currentItem=new QTreeWidgetItem;
58 QTreeWidgetItem* currentItem=new QTreeWidgetItem;
50 currentItem->setIcon(0,QSvgIcon(":/images/server.svg"));
59 currentItem->setIcon(0,QSvgIcon(":/images/server.svg"));
51 currentItem->setText(0,driver->childs.at(i)->instanceName);
60 currentItem->setText(0,driver->childs.at(i)->instanceName());
52 item->addChild(currentItem);
61 item->addChild(currentItem);
53 if(driver->childs.at(i)->childs.count()!=0)
62 if(driver->childs.at(i)->childs.count()!=0)
54 {
63 {
@@ -61,7 +61,7 signals:
61 public slots:
61 public slots:
62 void treeChanged(const QList<socexplorerplugin*>& drivers);
62 void treeChanged(const QList<socexplorerplugin*>& drivers);
63 void pluginselectedslt( QTreeWidgetItem * item, int column);
63 void pluginselectedslt( QTreeWidgetItem * item, int column);
64
64 void itemSelectionChangedslt();
65
65
66 private:
66 private:
67 void addplugin(socexplorerplugin* driver,QTreeWidgetItem* item);
67 void addplugin(socexplorerplugin* driver,QTreeWidgetItem* item);
@@ -98,6 +98,6 bool genericPySysdriver::loadbin(unsigne
98
98
99 QString genericPySysdriver::instance()
99 QString genericPySysdriver::instance()
100 {
100 {
101 return plugin->instanceName;
101 return plugin->instanceName();
102 }
102 }
103
103
@@ -31,9 +31,14 int socexplorerplugin::baseAddress(){ret
31
31
32 void socexplorerplugin::setBaseAddress(unsigned int baseAddress){this->BaseAddress = baseAddress;}
32 void socexplorerplugin::setBaseAddress(unsigned int baseAddress){this->BaseAddress = baseAddress;}
33
33
34 QString socexplorerplugin::instanceName()
35 {
36 return this->_instanceName;
37 }
38
34 int socexplorerplugin::registermenu(QMenu *menu)
39 int socexplorerplugin::registermenu(QMenu *menu)
35 {
40 {
36 this->menu = menu->addMenu(this->instanceName);
41 this->menu = menu->addMenu(this->_instanceName);
37 this->closeAction = this->menu->addAction(tr("Close plugin"));
42 this->closeAction = this->menu->addAction(tr("Close plugin"));
38 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
43 QObject::connect(this->closeAction,SIGNAL(triggered()),this,SLOT(closeMe()));
39 this->ChildsMenu = this->menu->addMenu(QString("Childs"));
44 this->ChildsMenu = this->menu->addMenu(QString("Childs"));
@@ -41,7 +46,7 int socexplorerplugin::registermenu(QMen
41 {
46 {
42 this->childs.at(i)->registermenu(this->ChildsMenu);
47 this->childs.at(i)->registermenu(this->ChildsMenu);
43 }
48 }
44 if(this->pyObject!=NULL)emit this->registerObject((QObject*)this->pyObject,this->instanceName);
49 if(this->pyObject!=NULL)emit this->registerObject((QObject*)this->pyObject,this->instanceName());
45 return 0;
50 return 0;
46 }
51 }
47
52
@@ -74,8 +79,10 void socexplorerplugin::activate(bool fl
74
79
75 void socexplorerplugin::setInstanceName(const QString &newName)
80 void socexplorerplugin::setInstanceName(const QString &newName)
76 {
81 {
77 this->instanceName = newName;
82 this->_instanceName = newName;
78 this->menu->setTitle(this->instanceName);
83 if(this->menu)
84 this->menu->setTitle(this->_instanceName);
85 this->setWindowTitle(newName);
79 }
86 }
80
87
81 void socexplorerplugin::makeGenericPyWrapper()
88 void socexplorerplugin::makeGenericPyWrapper()
@@ -86,8 +86,11 public:
86 //! Default plugin constructor, any plugin should call this constructor. This constructor creates a
86 //! Default plugin constructor, any plugin should call this constructor. This constructor creates a
87 //! default python wrapper instance. If you want to connect your own python wrapper, you have to clear
87 //! default python wrapper instance. If you want to connect your own python wrapper, you have to clear
88 //! createPyObject option and instanciate your own genericPySysdriver derivated object.
88 //! createPyObject option and instanciate your own genericPySysdriver derivated object.
89 socexplorerplugin(QWidget *parent = 0,bool createPyObject=true)
89 socexplorerplugin(QWidget *parent = 0,bool createPyObject=true):QDockWidget(parent)
90 {
90 {
91 closeAction=NULL;
92 menu=NULL;
93 ChildsMenu=NULL;
91 this->Connected = false;
94 this->Connected = false;
92 this->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetVerticalTitleBar);
95 this->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetVerticalTitleBar);
93 _Name = new QString(driver_Name);
96 _Name = new QString(driver_Name);
@@ -126,7 +129,7 public:
126 QList<socexplorerplugin*> childs;
129 QList<socexplorerplugin*> childs;
127 socexplorerplugin* parent;
130 socexplorerplugin* parent;
128 QAction* closeAction;
131 QAction* closeAction;
129 QString instanceName;
132 QString instanceName();
130 QMenu* menu;
133 QMenu* menu;
131 QMenu* ChildsMenu;
134 QMenu* ChildsMenu;
132
135
@@ -167,6 +170,7 protected:
167 QString* _Author;
170 QString* _Author;
168 QString* _Version;
171 QString* _Version;
169 QString* _Description;
172 QString* _Description;
173 QString _instanceName;
170 int _canBeChild;
174 int _canBeChild;
171 int _canBeRoot;
175 int _canBeRoot;
172 int _VID;
176 int _VID;
@@ -95,7 +95,7 void socexplorerproxy::loadSysDriver(con
95 void socexplorerproxy::loadSysDriver(socexplorerplugin *driver, const QString instanceName)
95 void socexplorerproxy::loadSysDriver(socexplorerplugin *driver, const QString instanceName)
96 {
96 {
97 if(!_self)init();
97 if(!_self)init();
98 driver->instanceName.append(instanceName);
98 driver->setInstanceName(instanceName);
99 driver->parent = NULL;
99 driver->parent = NULL;
100 drivers->append(driver);
100 drivers->append(driver);
101 linearDriverList->append(driver);
101 linearDriverList->append(driver);
@@ -158,7 +158,7 void socexplorerproxy::loadSysDriverToPa
158 if(!_self)init();
158 if(!_self)init();
159 linearDriverList->append(driver);
159 linearDriverList->append(driver);
160 driver->parent = parent;
160 driver->parent = parent;
161 driver->instanceName.append(instanceName);
161 driver->setInstanceName(instanceName);
162 parent->childs.append(driver);
162 parent->childs.append(driver);
163 connectChildToProxy(driver);
163 connectChildToProxy(driver);
164 connectChildToParent(parent,driver);
164 connectChildToParent(parent,driver);
@@ -204,18 +204,14 void socexplorerproxy::loadChild(socexpl
204 void socexplorerproxy::connectChildToParent(socexplorerplugin *parent, socexplorerplugin *child)
204 void socexplorerproxy::connectChildToParent(socexplorerplugin *parent, socexplorerplugin *child)
205 {
205 {
206 if(!_self)init();
206 if(!_self)init();
207 //connect(child,SIGNAL(WriteSig(uint*,uint,uint)),parent,SLOT(Write(uint*,uint,uint)));
207 connect(parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool)));
208 //connect(child,SIGNAL(ReadSig(uint*,uint,uint)),parent,SLOT(Read(uint*,uint,uint)));
209 connect(parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool)));//,Qt::DirectConnection);
210 child->activate(parent->isConnected());
208 child->activate(parent->isConnected());
211 }
209 }
212
210
213 void socexplorerproxy::disconnectChildToParent(socexplorerplugin *child)
211 void socexplorerproxy::disconnectChildToParent(socexplorerplugin *child)
214 {
212 {
215 if(!_self)init();
213 if(!_self)init();
216 //disconnect(child,SIGNAL(WriteSig(uint*,uint,uint)),child->parent,SLOT(Write(uint*,uint,uint)));
214 disconnect(child->parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool)));
217 // disconnect(child,SIGNAL(ReadSig(uint*,uint,uint)),child->parent,SLOT(Read(uint*,uint,uint)));
218 disconnect(child->parent,SIGNAL(activateSig(bool)),child,SLOT(activate(bool)));//,Qt::DirectConnection);
219 }
215 }
220
216
221
217
@@ -252,7 +248,7 QString socexplorerproxy::getinstanceNam
252 void socexplorerproxy::changeSysDriverInstName(socexplorerplugin* driver)
248 void socexplorerproxy::changeSysDriverInstName(socexplorerplugin* driver)
253 {
249 {
254 if(!_self)init();
250 if(!_self)init();
255 QString prevName(driver->instanceName);
251 QString prevName(driver->instanceName());
256 }
252 }
257
253
258 bool socexplorerproxy::instanceNameIsValid(const QString& instanceName)
254 bool socexplorerproxy::instanceNameIsValid(const QString& instanceName)
@@ -260,7 +256,7 bool socexplorerproxy::instanceNameIsVal
260 if(!_self)init();
256 if(!_self)init();
261 for(int k=0;k<linearDriverList->count();k++)
257 for(int k=0;k<linearDriverList->count();k++)
262 {
258 {
263 if(!linearDriverList->at(k)->instanceName.compare(instanceName))
259 if(!linearDriverList->at(k)->instanceName().compare(instanceName))
264 return false;
260 return false;
265 }
261 }
266 return true;
262 return true;
@@ -271,7 +267,7 socexplorerplugin *socexplorerproxy::fin
271 if(!_self)init();
267 if(!_self)init();
272 for(int k=0;k<linearDriverList->count();k++)
268 for(int k=0;k<linearDriverList->count();k++)
273 {
269 {
274 if(linearDriverList->at(k)->instanceName.compare(instanceName))
270 if(linearDriverList->at(k)->instanceName().compare(instanceName))
275 return linearDriverList->at(k);
271 return linearDriverList->at(k);
276 }
272 }
277 return NULL;
273 return NULL;
@@ -304,7 +300,7 socexplorerplugin* socexplorerproxy::get
304 if(!_self)init();
300 if(!_self)init();
305 for(int i=0;i<linearDriverList->count();i++)
301 for(int i=0;i<linearDriverList->count();i++)
306 {
302 {
307 if(!linearDriverList->at(i)->instanceName.compare(instanceName))
303 if(!linearDriverList->at(i)->instanceName().compare(instanceName))
308 return linearDriverList->at(i);
304 return linearDriverList->at(i);
309 }
305 }
310 return NULL;
306 return NULL;
@@ -10,6 +10,7 dockablePluginManager::dockablePluginMan
10 connect(this,SIGNAL(treeChanged(QList<socexplorerplugin*>)),this->managerGui,SIGNAL(treeChanged(QList<socexplorerplugin*>)));
10 connect(this,SIGNAL(treeChanged(QList<socexplorerplugin*>)),this->managerGui,SIGNAL(treeChanged(QList<socexplorerplugin*>)));
11 connect(this->managerGui,SIGNAL(changeSysDriverInstName(QString,QString)),this,SIGNAL(changeSysDriverInstName(QString,QString)));
11 connect(this->managerGui,SIGNAL(changeSysDriverInstName(QString,QString)),this,SIGNAL(changeSysDriverInstName(QString,QString)));
12 connect(this->managerGui,SIGNAL(closeSysDriver(QString)),this,SIGNAL(closeSysDriver(QString)));
12 connect(this->managerGui,SIGNAL(closeSysDriver(QString)),this,SIGNAL(closeSysDriver(QString)));
13 connect(this->managerGui,SIGNAL(pluginselected(QString)),this,SIGNAL(pluginselected(QString)));
13 this->setWidget(this->managerGui);
14 this->setWidget(this->managerGui);
14 this->setWindowTitle(this->managerGui->windowTitle());
15 this->setWindowTitle(this->managerGui->windowTitle());
15 }
16 }
@@ -39,6 +39,7 signals:
39 void treeChanged(const QList<socexplorerplugin*>& drivers);
39 void treeChanged(const QList<socexplorerplugin*>& drivers);
40 void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName);
40 void changeSysDriverInstName(const QString newinstanceName,const QString previnstanceName);
41 void closeSysDriver(const QString instanceName);
41 void closeSysDriver(const QString instanceName);
42 void pluginselected(const QString& instanceName);
42 public slots:
43 public slots:
43
44
44 private:
45 private:
@@ -36,9 +36,9 LPMONMainWindow::LPMONMainWindow(QString
36 this->setAcceptDrops(true);
36 this->setAcceptDrops(true);
37 this->pluginManager->setRootLoadable(true);
37 this->pluginManager->setRootLoadable(true);
38 this->PythonConsoleInst->pyConsoleRunFile(ScriptToEval);
38 this->PythonConsoleInst->pyConsoleRunFile(ScriptToEval);
39 QProgressBar* test = SocExplorerEngine::getProgressBar("test",10);
39 // QProgressBar* test = SocExplorerEngine::getProgressBar("test",10);
40 statusBar()->setFixedHeight(statusBar()->height());
40 // statusBar()->setFixedHeight(statusBar()->height());
41 SocExplorerEngine::deleteProgressBar(test);
41 // SocExplorerEngine::deleteProgressBar(test);
42 }
42 }
43
43
44
44
@@ -64,7 +64,8 void LPMONMainWindow::makeObjects(QStrin
64 SocExplorerEngine::xmlModel()->scanXmlFiles();
64 SocExplorerEngine::xmlModel()->scanXmlFiles();
65 this->regExplorer = new regsExplorer();
65 this->regExplorer = new regsExplorer();
66 this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas);
66 this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas);
67 this->pluginsDockContainer->addDockWidget(Qt::TopDockWidgetArea,this->regExplorer);
67 // this->pluginsDockContainer->addDockWidget(Qt::TopDockWidgetArea,this->regExplorer);
68 this->addPluginInterface(this->regExplorer);
68 this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self());
69 this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self());
69 this->PythonConsoleInst->addObject("SocExplorerEngine",SocExplorerEngine::self());
70 this->PythonConsoleInst->addObject("SocExplorerEngine",SocExplorerEngine::self());
70 this->pluginManager = new dockablePluginManager();
71 this->pluginManager = new dockablePluginManager();
@@ -98,8 +99,10 void LPMONMainWindow::makeConnections()
98 connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),this->PythonConsoleInst,SLOT(changeSysDriverInstName(QString,QString)));
99 connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),this->PythonConsoleInst,SLOT(changeSysDriverInstName(QString,QString)));
99 connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),socexplorerproxy::self(),SLOT(closeSysDriver(QString)));
100 connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),socexplorerproxy::self(),SLOT(closeSysDriver(QString)));
100 connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),this->PythonConsoleInst,SLOT(removeDriver(QString)));
101 connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),this->PythonConsoleInst,SLOT(removeDriver(QString)));
102 connect(this->pluginManager,SIGNAL(pluginselected(QString)),this,SLOT(pluginselected(QString)));
101 connect(this->about,SIGNAL(triggered()),this,SLOT(showAboutBox()));
103 connect(this->about,SIGNAL(triggered()),this,SLOT(showAboutBox()));
102 connect(this->exploreRegs,SIGNAL(triggered()),this->regExplorer,SLOT(show()));
104 connect(this->exploreRegs,SIGNAL(triggered()),this->regExplorer,SLOT(show()));
105
103 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString)));
106 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString)));
104 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDriverToParent(QString,QString)),socexplorerproxy::self(),SLOT(loadSysDriverToParent(QString,QString)));
107 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDriverToParent(QString,QString)),socexplorerproxy::self(),SLOT(loadSysDriverToParent(QString,QString)));
105
108
@@ -207,6 +210,14 void LPMONMainWindow::showAboutBox()
207 p_about->show();
210 p_about->show();
208 }
211 }
209
212
213 void LPMONMainWindow::pluginselected(const QString &instanceName)
214 {
215 socexplorerplugin* drv=socexplorerproxy::self()->getSysDriver(instanceName);
216 // if(drv)
217 // drv->activate(true);
218 // TODO add plugin widget auto focus
219 }
220
210
221
211
222
212 void LPMONMainWindow::closeEvent(QCloseEvent *event)
223 void LPMONMainWindow::closeEvent(QCloseEvent *event)
@@ -62,7 +62,7 public slots:
62 void updateText();
62 void updateText();
63 void setLangage(QAction* action);
63 void setLangage(QAction* action);
64 void showAboutBox();
64 void showAboutBox();
65
65 void pluginselected(const QString& instanceName);
66
66
67 signals:
67 signals:
68 void translateSig();
68 void translateSig();
General Comments 0
You need to be logged in to leave comments. Login now