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