@@ -118,6 +118,9 void SocExplorerMainWindow::makeConnecti | |||||
118 |
|
118 | |||
119 | connect(this->sessionManagerAction, SIGNAL(triggered(bool)),this,SLOT(showSessionManager(bool))); |
|
119 | connect(this->sessionManagerAction, SIGNAL(triggered(bool)),this,SLOT(showSessionManager(bool))); | |
120 | connect(this->p_SessionManagerDialog, SIGNAL(switchSession(QString)),this,SLOT(setActiveSession(QString))); |
|
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))); | |||
121 | connect(this->sessionsActions,SIGNAL(triggered(QAction*)),this,SLOT(setActiveSession(QAction*))); |
|
124 | connect(this->sessionsActions,SIGNAL(triggered(QAction*)),this,SLOT(setActiveSession(QAction*))); | |
122 |
|
125 | |||
123 | this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString))); |
|
126 | this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString))); | |
@@ -193,13 +196,7 void SocExplorerMainWindow::loadSessions | |||||
193 | } |
|
196 | } | |
194 | foreach (stext, p_Sessions) |
|
197 | foreach (stext, p_Sessions) | |
195 | { |
|
198 | { | |
196 |
|
|
199 | addSession(stext); | |
197 | sact->setCheckable(true); |
|
|||
198 | sact->setData(stext); |
|
|||
199 | if(p_currentSession==stext) |
|
|||
200 | sact->setChecked(true); |
|
|||
201 | sessionsActions->addAction(sact); |
|
|||
202 | SessionsMenu->addAction(sact); |
|
|||
203 | } |
|
200 | } | |
204 | } |
|
201 | } | |
205 |
|
202 | |||
@@ -316,11 +313,42 void SocExplorerMainWindow::showSessionM | |||||
316 | this->p_SessionManagerDialog->show(); |
|
313 | this->p_SessionManagerDialog->show(); | |
317 | } |
|
314 | } | |
318 |
|
315 | |||
319 | //TODO handle rename |
|
316 | void SocExplorerMainWindow::renameSession(const QString &oldName, const QString &newName) | |
320 | void SocExplorerMainWindow::sessionListChanged() |
|
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) | |||
321 | { |
|
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 | } | |||
322 |
|
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; | |||
323 | } |
|
348 | } | |
|
349 | } | |||
|
350 | } | |||
|
351 | ||||
324 |
|
352 | |||
325 |
|
353 | |||
326 |
|
354 |
@@ -71,7 +71,9 public slots: | |||||
71 | void setActiveSession(const QString & session); |
|
71 | void setActiveSession(const QString & session); | |
72 | void setActiveSession(QAction* session); |
|
72 | void setActiveSession(QAction* session); | |
73 | void showSessionManager(bool); |
|
73 | void showSessionManager(bool); | |
74 | void sessionListChanged(); |
|
74 | void renameSession(const QString& oldName,const QString& newName); | |
|
75 | void addSession(const QString& newSession); | |||
|
76 | void removeSession(const QString& session); | |||
75 | signals: |
|
77 | signals: | |
76 | void translateSig(); |
|
78 | void translateSig(); | |
77 | void registerObject(QObject* object,const QString& instanceName); |
|
79 | void registerObject(QObject* object,const QString& instanceName); |
@@ -100,6 +100,7 void SessionManagerDialog::newSession(QS | |||||
100 | { |
|
100 | { | |
101 | this->ui->listWidget->addItem(session); |
|
101 | this->ui->listWidget->addItem(session); | |
102 | updateSessionList(); |
|
102 | updateSessionList(); | |
|
103 | emit sessionAdded(session); | |||
103 | } |
|
104 | } | |
104 | } |
|
105 | } | |
105 |
|
106 | |||
@@ -127,7 +128,8 void SessionManagerDialog::renameSession | |||||
127 | if (ok && !text.isEmpty()) |
|
128 | if (ok && !text.isEmpty()) | |
128 | { |
|
129 | { | |
129 | item->setText(text); |
|
130 | item->setText(text); | |
130 |
SocExplorerSettings::renameSession(text |
|
131 | SocExplorerSettings::renameSession(OldText,text); | |
|
132 | emit sessionRenamed(OldText,text); | |||
131 | updateSessionList(); |
|
133 | updateSessionList(); | |
132 | emit sessionListChanged(); |
|
134 | emit sessionListChanged(); | |
133 | } |
|
135 | } | |
@@ -142,6 +144,7 void SessionManagerDialog::deleteSession | |||||
142 | { |
|
144 | { | |
143 | this->ui->listWidget->removeItemWidget(item); |
|
145 | this->ui->listWidget->removeItemWidget(item); | |
144 | SocExplorerSettings::deleteSession(item->text()); |
|
146 | SocExplorerSettings::deleteSession(item->text()); | |
|
147 | emit sessionRemoved(item->text()); | |||
145 | delete item; |
|
148 | delete item; | |
146 | updateSessionList(); |
|
149 | updateSessionList(); | |
147 | } |
|
150 | } |
@@ -49,7 +49,9 private slots: | |||||
49 | signals: |
|
49 | signals: | |
50 | void switchSession(QString session); |
|
50 | void switchSession(QString session); | |
51 | void sessionListChanged(); |
|
51 | void sessionListChanged(); | |
52 |
|
52 | void sessionRenamed(const QString& oldName,const QString& newName); | ||
|
53 | void sessionRemoved(const QString& session); | |||
|
54 | void sessionAdded(const QString& newSession); | |||
53 | private: |
|
55 | private: | |
54 | void updateSessionList(); |
|
56 | void updateSessionList(); | |
55 | Ui::SessionManagerDialog *ui; |
|
57 | Ui::SessionManagerDialog *ui; |
General Comments 0
You need to be logged in to leave comments.
Login now