##// END OF EJS Templates
Working on session manager.
Jeandet Alexis -
r92:a9916b2ad4f6 default
parent child
Show More
@@ -0,0 +1,14
1 #include "sessionmanagerdialog.h"
2 #include "ui_sessionmanagerdialog.h"
3
4 SessionManagerDialog::SessionManagerDialog(QWidget *parent) :
5 QDialog(parent),
6 ui(new Ui::SessionManagerDialog)
7 {
8 ui->setupUi(this);
9 }
10
11 SessionManagerDialog::~SessionManagerDialog()
12 {
13 delete ui;
14 }
@@ -0,0 +1,22
1 #ifndef SESSIONMANAGERDIALOG_H
2 #define SESSIONMANAGERDIALOG_H
3
4 #include <QDialog>
5
6 namespace Ui {
7 class SessionManagerDialog;
8 }
9
10 class SessionManagerDialog : public QDialog
11 {
12 Q_OBJECT
13
14 public:
15 explicit SessionManagerDialog(QWidget *parent = 0);
16 ~SessionManagerDialog();
17
18 private:
19 Ui::SessionManagerDialog *ui;
20 };
21
22 #endif // SESSIONMANAGERDIALOG_H
@@ -0,0 +1,121
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
3 <class>SessionManagerDialog</class>
4 <widget class="QDialog" name="SessionManagerDialog">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>553</width>
10 <height>275</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Dialog</string>
15 </property>
16 <layout class="QGridLayout" name="gridLayout">
17 <item row="0" column="0">
18 <widget class="QListWidget" name="listWidget"/>
19 </item>
20 <item row="0" column="1">
21 <widget class="QWidget" name="widget" native="true">
22 <layout class="QVBoxLayout" name="verticalLayout">
23 <item>
24 <widget class="QPushButton" name="NewQPB">
25 <property name="text">
26 <string>New</string>
27 </property>
28 </widget>
29 </item>
30 <item>
31 <widget class="QPushButton" name="RenameQPB">
32 <property name="text">
33 <string>Rename</string>
34 </property>
35 </widget>
36 </item>
37 <item>
38 <widget class="QPushButton" name="CloneQPB">
39 <property name="text">
40 <string>Clone</string>
41 </property>
42 </widget>
43 </item>
44 <item>
45 <widget class="QPushButton" name="DeleteQPB">
46 <property name="text">
47 <string>Delete</string>
48 </property>
49 </widget>
50 </item>
51 <item>
52 <widget class="QPushButton" name="SwitchToQPB">
53 <property name="text">
54 <string>Switch to</string>
55 </property>
56 </widget>
57 </item>
58 <item>
59 <spacer name="verticalSpacer">
60 <property name="orientation">
61 <enum>Qt::Vertical</enum>
62 </property>
63 <property name="sizeHint" stdset="0">
64 <size>
65 <width>20</width>
66 <height>40</height>
67 </size>
68 </property>
69 </spacer>
70 </item>
71 </layout>
72 </widget>
73 </item>
74 <item row="1" column="0" colspan="2">
75 <widget class="QDialogButtonBox" name="buttonBox">
76 <property name="orientation">
77 <enum>Qt::Horizontal</enum>
78 </property>
79 <property name="standardButtons">
80 <set>QDialogButtonBox::Close</set>
81 </property>
82 </widget>
83 </item>
84 </layout>
85 </widget>
86 <resources/>
87 <connections>
88 <connection>
89 <sender>buttonBox</sender>
90 <signal>accepted()</signal>
91 <receiver>SessionManagerDialog</receiver>
92 <slot>accept()</slot>
93 <hints>
94 <hint type="sourcelabel">
95 <x>248</x>
96 <y>254</y>
97 </hint>
98 <hint type="destinationlabel">
99 <x>157</x>
100 <y>274</y>
101 </hint>
102 </hints>
103 </connection>
104 <connection>
105 <sender>buttonBox</sender>
106 <signal>rejected()</signal>
107 <receiver>SessionManagerDialog</receiver>
108 <slot>reject()</slot>
109 <hints>
110 <hint type="sourcelabel">
111 <x>316</x>
112 <y>260</y>
113 </hint>
114 <hint type="destinationlabel">
115 <x>286</x>
116 <y>274</y>
117 </hint>
118 </hints>
119 </connection>
120 </connections>
121 </ui>
@@ -1,264 +1,268
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011-2015, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011-2015, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "mainwindow.h"
22 #include "mainwindow.h"
23 #include <QDockWidget>
23 #include <QDockWidget>
24 #include <socexplorersettings.h>
24 #include <socexplorersettings.h>
25 #include <socexplorerconfigkeys.h>
25 #include <socexplorerconfigkeys.h>
26
26
27 SocExplorerMainWindow::SocExplorerMainWindow(QString ScriptToEval, QWidget *parent)
27 SocExplorerMainWindow::SocExplorerMainWindow(QString ScriptToEval, QWidget *parent)
28 : QMainWindow(parent)
28 : QMainWindow(parent)
29 {
29 {
30 QCoreApplication::setApplicationName("SocExplorer");
30 QCoreApplication::setApplicationName("SocExplorer");
31 QCoreApplication::setOrganizationName("LPP");
31 QCoreApplication::setOrganizationName("LPP");
32 QCoreApplication::setOrganizationDomain("lpp.fr");
32 QCoreApplication::setOrganizationDomain("lpp.fr");
33 this->makeObjects(ScriptToEval);
33 this->makeObjects(ScriptToEval);
34 this->makeLayout();
34 this->makeLayout();
35 this->makeMenu();
35 this->makeMenu();
36 SocExplorerSettings::init();
36 SocExplorerSettings::init();
37 SocExplorerSettings::loadSession("Session1");
37 SocExplorerSettings::loadSession("Session1");
38 this->makeConnections();
38 this->makeConnections();
39 this->setWindowIcon(QIcon(":/images/icon.png"));
39 this->setWindowIcon(QIcon(":/images/icon.png"));
40 this->setAcceptDrops(true);
40 this->setAcceptDrops(true);
41 this->pluginManager->setRootLoadable(true);
41 this->pluginManager->setRootLoadable(true);
42 this->PythonConsoleInst->pyConsoleRunFile(ScriptToEval);
42 this->PythonConsoleInst->pyConsoleRunFile(ScriptToEval);
43 QFile file(":/styles/SocExplorer.css");
43 QFile file(":/styles/SocExplorer.css");
44 if(file.open(QIODevice::ReadOnly | QIODevice::Text))
44 if(file.open(QIODevice::ReadOnly | QIODevice::Text))
45 {
45 {
46 qApp->setStyleSheet(file.readAll());
46 qApp->setStyleSheet(file.readAll());
47 file.close();
47 file.close();
48 }
48 }
49 }
49 }
50
50
51
51
52 void SocExplorerMainWindow::makeObjects(QString ScriptToEval)
52 void SocExplorerMainWindow::makeObjects(QString ScriptToEval)
53 {
53 {
54 Q_UNUSED(ScriptToEval)
54 Q_UNUSED(ScriptToEval)
55 this->p_pluginGUIlist = new QList<QDockWidget*>();
55 this->p_pluginGUIlist = new QList<QDockWidget*>();
56 pluginsDockContainer = new QMainWindow;
56 pluginsDockContainer = new QMainWindow;
57 pluginsDockContainer->setWindowFlags(Qt::Widget);
57 pluginsDockContainer->setWindowFlags(Qt::Widget);
58 pluginsDockContainer->setDockNestingEnabled(true);
58 pluginsDockContainer->setDockNestingEnabled(true);
59 this->mainWidget = new QSplitter(Qt::Vertical);
59 this->mainWidget = new QSplitter(Qt::Vertical);
60 this->appTranslator = new QTranslator;
60 this->appTranslator = new QTranslator;
61 this->Quit = new QAction(tr("&Quit"),this);
61 this->Quit = new QAction(tr("&Quit"),this);
62 this->Quit->setShortcut(tr("CTRL+Q"));
62 this->Quit->setShortcut(tr("CTRL+Q"));
63 this->ManagePlugins = new QAction(tr("&Manage Plugins"),this);
63 this->ManagePlugins = new QAction(tr("&Manage Plugins"),this);
64 this->ManagePlugins->setShortcut(tr("CTRL+P"));
64 this->ManagePlugins->setShortcut(tr("CTRL+P"));
65 this->regsManager = new QAction(tr("&Manage registers"),this);
65 this->regsManager = new QAction(tr("&Manage registers"),this);
66 this->exploreRegs = new QAction(tr("&Explore registers"),this);
66 this->exploreRegs = new QAction(tr("&Explore registers"),this);
67 this->help = new QAction(tr("&Help"),this);
67 this->help = new QAction(tr("&Help"),this);
68 this->help->setShortcut(tr("CTRL+H"));
68 this->help->setShortcut(tr("CTRL+H"));
69 this->about = new QAction(tr("&About"),this);
69 this->about = new QAction(tr("&About"),this);
70 this->p_SessionManagerDialog = new SessionManagerDialog();
70 socexplorerproxy::setMainWindow(this);
71 socexplorerproxy::setMainWindow(this);
71 SocExplorerEngine::setMainWindow(this);
72 SocExplorerEngine::setMainWindow(this);
72 SocExplorerEngine::xmlModel()->scanXmlFiles();
73 SocExplorerEngine::xmlModel()->scanXmlFiles();
73 this->regExplorer = new RegsExplorer();
74 this->regExplorer = new RegsExplorer();
74 this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas);
75 this->regExplorer->setAllowedAreas(Qt::AllDockWidgetAreas);
75 this->addPluginInterface(this->regExplorer);
76 this->addPluginInterface(this->regExplorer);
76 this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self());
77 this->PythonConsoleInst = new PythonConsole(socexplorerproxy::self());
77 this->PythonConsoleInst->addObject("SocExplorerEngine",SocExplorerEngine::self());
78 this->PythonConsoleInst->addObject("SocExplorerEngine",SocExplorerEngine::self());
78 this->pluginManager = new dockablePluginManager();
79 this->pluginManager = new dockablePluginManager();
79 this->toolpane = new toolBar;
80 this->toolpane = new toolBar;
80 this->p_about = new aboutsocexplorer();
81 this->p_about = new aboutsocexplorer();
81 }
82 }
82
83
83 void SocExplorerMainWindow::makeLayout()
84 void SocExplorerMainWindow::makeLayout()
84 {
85 {
85 this->mainWidget->addWidget(pluginsDockContainer);
86 this->mainWidget->addWidget(pluginsDockContainer);
86 this->mainWidget->addWidget(this->PythonConsoleInst);
87 this->mainWidget->addWidget(this->PythonConsoleInst);
87 this->toolpane->setAllowedAreas(Qt::RightDockWidgetArea|Qt::LeftDockWidgetArea);
88 this->toolpane->setAllowedAreas(Qt::RightDockWidgetArea|Qt::LeftDockWidgetArea);
88 this->addDockWidget(Qt::LeftDockWidgetArea,this->toolpane);
89 this->addDockWidget(Qt::LeftDockWidgetArea,this->toolpane);
89 this->toolpane->addTool(this->pluginManager);
90 this->toolpane->addTool(this->pluginManager);
90 this->setCentralWidget(this->mainWidget);
91 this->setCentralWidget(this->mainWidget);
91 }
92 }
92
93
93
94
94 void SocExplorerMainWindow::makeConnections()
95 void SocExplorerMainWindow::makeConnections()
95 {
96 {
96 connect(socexplorerproxy::self(),SIGNAL(clearMenu()),this,SLOT(clearMenu()));
97 connect(socexplorerproxy::self(),SIGNAL(clearMenu()),this,SLOT(clearMenu()));
97 connect(this,SIGNAL(translateSig()),socexplorerproxy::self(),SLOT(updateText()));
98 connect(this,SIGNAL(translateSig()),socexplorerproxy::self(),SLOT(updateText()));
98 connect(socexplorerproxy::self(),SIGNAL(addPluginGUI(QDockWidget*)),this,SLOT(addPluginInterface(QDockWidget*)));
99 connect(socexplorerproxy::self(),SIGNAL(addPluginGUI(QDockWidget*)),this,SLOT(addPluginInterface(QDockWidget*)));
99 connect(socexplorerproxy::self(),SIGNAL(removePluginGUI(QDockWidget*)),this,SLOT(removePluginInterface(QDockWidget*)));
100 connect(socexplorerproxy::self(),SIGNAL(removePluginGUI(QDockWidget*)),this,SLOT(removePluginInterface(QDockWidget*)));
100 connect(this->ManagePlugins,SIGNAL(triggered()),this,SLOT(launchPluginManager()));
101 connect(this->ManagePlugins,SIGNAL(triggered()),this,SLOT(launchPluginManager()));
101 connect(this->Quit,SIGNAL(triggered()),qApp,SLOT(quit()));
102 connect(this->Quit,SIGNAL(triggered()),qApp,SLOT(quit()));
102 connect(this,SIGNAL(registerObject(QObject*,QString)),this->PythonConsoleInst,SLOT(registerObject(QObject*,QString)));
103 connect(this,SIGNAL(registerObject(QObject*,QString)),this->PythonConsoleInst,SLOT(registerObject(QObject*,QString)));
103 connect(socexplorerproxy::self(),SIGNAL(registerObject(QObject*,QString)),this,SIGNAL(registerObject(QObject*,QString)));
104 connect(socexplorerproxy::self(),SIGNAL(registerObject(QObject*,QString)),this,SIGNAL(registerObject(QObject*,QString)));
104 connect(this->pluginManager,SIGNAL(geteplugintree()),socexplorerproxy::self(),SLOT(geteplugintree()));
105 connect(this->pluginManager,SIGNAL(geteplugintree()),socexplorerproxy::self(),SLOT(geteplugintree()));
105 connect(socexplorerproxy::self(),SIGNAL(treeChanged(QList<socexplorerplugin*>)),this->pluginManager,SIGNAL(treeChanged(QList<socexplorerplugin*>)));
106 connect(socexplorerproxy::self(),SIGNAL(treeChanged(QList<socexplorerplugin*>)),this->pluginManager,SIGNAL(treeChanged(QList<socexplorerplugin*>)));
106 connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),socexplorerproxy::self(),SLOT(changeSysDriverInstName(QString,QString)));
107 connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),socexplorerproxy::self(),SLOT(changeSysDriverInstName(QString,QString)));
107 connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),this->PythonConsoleInst,SLOT(changeSysDriverInstName(QString,QString)));
108 connect(this->pluginManager,SIGNAL(changeSysDriverInstName(QString,QString)),this->PythonConsoleInst,SLOT(changeSysDriverInstName(QString,QString)));
108 connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),socexplorerproxy::self(),SLOT(closeSysDriver(QString)));
109 connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),socexplorerproxy::self(),SLOT(closeSysDriver(QString)));
109 connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),this->PythonConsoleInst,SLOT(removeDriver(QString)));
110 connect(this->pluginManager,SIGNAL(closeSysDriver(QString)),this->PythonConsoleInst,SLOT(removeDriver(QString)));
110 connect(this->pluginManager,SIGNAL(pluginselected(QString)),this,SLOT(pluginselected(QString)));
111 connect(this->pluginManager,SIGNAL(pluginselected(QString)),this,SLOT(pluginselected(QString)));
111 connect(this->about,SIGNAL(triggered()),this,SLOT(showAboutBox()));
112 connect(this->about,SIGNAL(triggered()),this,SLOT(showAboutBox()));
112 connect(this->exploreRegs,SIGNAL(triggered()),this->regExplorer,SLOT(show()));
113 connect(this->exploreRegs,SIGNAL(triggered()),this->regExplorer,SLOT(show()));
113
114
115 connect(this->sessionManagerAction, SIGNAL(triggered(bool)),this->p_SessionManagerDialog,SLOT(show()));
116
114 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString)));
117 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDrviver(QString)),socexplorerproxy::self(),SLOT(loadSysDriver(QString)));
115 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDriverToParent(QString,QString)),socexplorerproxy::self(),SLOT(loadSysDriverToParent(QString,QString)));
118 this->pluginManager->connect(this->pluginManager,SIGNAL(loadSysDriverToParent(QString,QString)),socexplorerproxy::self(),SLOT(loadSysDriverToParent(QString,QString)));
116
119
117 }
120 }
118
121
119
122
120 void SocExplorerMainWindow::launchPluginManager()
123 void SocExplorerMainWindow::launchPluginManager()
121 {
124 {
122
125
123 if(this->pluginManager->isHidden())
126 if(this->pluginManager->isHidden())
124 {
127 {
125 this->pluginManager->setHidden(false);
128 this->pluginManager->setHidden(false);
126 }
129 }
127
130
128 }
131 }
129
132
130
133
131 void SocExplorerMainWindow::addPluginInterface(QDockWidget *plugin)
134 void SocExplorerMainWindow::addPluginInterface(QDockWidget *plugin)
132 {
135 {
133 plugin->setAllowedAreas(Qt::AllDockWidgetAreas);
136 plugin->setAllowedAreas(Qt::AllDockWidgetAreas);
134 this->pluginsDockContainer->addDockWidget(Qt::TopDockWidgetArea,plugin);
137 this->pluginsDockContainer->addDockWidget(Qt::TopDockWidgetArea,plugin);
135 if(p_pluginGUIlist->count()!=0)
138 if(p_pluginGUIlist->count()!=0)
136 this->pluginsDockContainer->tabifyDockWidget(p_pluginGUIlist->last(),plugin);
139 this->pluginsDockContainer->tabifyDockWidget(p_pluginGUIlist->last(),plugin);
137 p_pluginGUIlist->append(plugin);
140 p_pluginGUIlist->append(plugin);
138 }
141 }
139
142
140 void SocExplorerMainWindow::removePluginInterface(QDockWidget *plugin)
143 void SocExplorerMainWindow::removePluginInterface(QDockWidget *plugin)
141 {
144 {
142 p_pluginGUIlist->removeOne(plugin);
145 p_pluginGUIlist->removeOne(plugin);
143 this->pluginsDockContainer->removeDockWidget(plugin);
146 this->pluginsDockContainer->removeDockWidget(plugin);
144 }
147 }
145
148
146
149
147 void SocExplorerMainWindow::clearMenu()
150 void SocExplorerMainWindow::clearMenu()
148 {
151 {
149 this->menuBar()->clear();
152 this->menuBar()->clear();
150 this->makeMenu();
153 this->makeMenu();
151 }
154 }
152
155
153
156
154 void SocExplorerMainWindow::makeMenu()
157 void SocExplorerMainWindow::makeMenu()
155 {
158 {
156 this->FileMenu = menuBar()->addMenu(tr("&File"));
159 this->FileMenu = menuBar()->addMenu(tr("&File"));
157 this->SessionsMenu = this->FileMenu->addMenu(tr("&Sessions"));
160 this->SessionsMenu = this->FileMenu->addMenu(tr("&Sessions"));
161 this->sessionManagerAction = this->FileMenu->addAction(tr("&Session manager..."));
158 this->SettingsMenu = menuBar()->addMenu(tr("&Settings"));
162 this->SettingsMenu = menuBar()->addMenu(tr("&Settings"));
159 SocExplorerGUI::registerMenuBar(menuBar(),this->FileMenu,this->SettingsMenu);
163 SocExplorerGUI::registerMenuBar(menuBar(),this->FileMenu,this->SettingsMenu);
160 this->PluginsMenu = menuBar()->addMenu(tr("&Plugins"));
164 this->PluginsMenu = menuBar()->addMenu(tr("&Plugins"));
161 this->ToolsMenu = menuBar()->addMenu(tr("&Tools"));
165 this->ToolsMenu = menuBar()->addMenu(tr("&Tools"));
162 this->ToolsMenu->addAction(this->exploreRegs);
166 this->ToolsMenu->addAction(this->exploreRegs);
163 this->FileMenu->addAction(this->Quit);
167 this->FileMenu->addAction(this->Quit);
164 socexplorerproxy::self()->makeMenu(this->PluginsMenu);
168 socexplorerproxy::self()->makeMenu(this->PluginsMenu);
165 this->PluginsMenu->addAction(this->ManagePlugins);
169 this->PluginsMenu->addAction(this->ManagePlugins);
166
170
167 this->helpMenu = menuBar()->addMenu(tr("Help"));
171 this->helpMenu = menuBar()->addMenu(tr("Help"));
168 this->helpMenu->addAction(this->help);
172 this->helpMenu->addAction(this->help);
169 this->helpMenu->addAction(this->about);
173 this->helpMenu->addAction(this->about);
170
174
171 }
175 }
172
176
173 void SocExplorerMainWindow::loadSessions()
177 void SocExplorerMainWindow::loadSessions()
174 {
178 {
175 // QStringList sessions = SocExplorerSettings::value();
179 // QStringList sessions = SocExplorerSettings::value();
176 QList<QList<QVariant> > sessions = SocExplorerSettings::arrays(SOCEXPLORERGLOBAL_SETTINGS_SESSIONS_SCOPE,QStringList()<<SOCEXPLORERGLOBAL_SETTINGS_SESSIONS_NAME);
180 QList<QList<QVariant> > sessions = SocExplorerSettings::arrays(SOCEXPLORERGLOBAL_SETTINGS_SESSIONS_SCOPE,QStringList()<<SOCEXPLORERGLOBAL_SETTINGS_SESSIONS_NAME);
177 p_Sessions.clear();
181 p_Sessions.clear();
178 for(int i=0;i<sessions.count();i++)
182 for(int i=0;i<sessions.count();i++)
179 {
183 {
180 if(sessions.at(i).count()>=1)
184 if(sessions.at(i).count()>=1)
181 {
185 {
182 p_Sessions.append(sessions.at(i).at(0).toString());
186 p_Sessions.append(sessions.at(i).at(0).toString());
183 }
187 }
184 }
188 }
185
189
186 }
190 }
187
191
188
192
189 SocExplorerMainWindow::~SocExplorerMainWindow()
193 SocExplorerMainWindow::~SocExplorerMainWindow()
190 {
194 {
191 SocExplorerSettings::setValue("GLOBAL","LastModified",QDate::currentDate().toString(),SocExplorerSettings::Session);
195 SocExplorerSettings::setValue("GLOBAL","LastModified",QDate::currentDate().toString(),SocExplorerSettings::Session);
192 SocExplorerSettings::sync();
196 SocExplorerSettings::sync();
193 }
197 }
194
198
195
199
196 void SocExplorerMainWindow::setLangage(QAction *action)
200 void SocExplorerMainWindow::setLangage(QAction *action)
197 {
201 {
198 QString local = action->data().toString();
202 QString local = action->data().toString();
199 QString qmPath = QDir(QString("translations")).absolutePath();
203 QString qmPath = QDir(QString("translations")).absolutePath();
200 appTranslator->load(qmPath+"/socexplorer_"+local+".qm");
204 appTranslator->load(qmPath+"/socexplorer_"+local+".qm");
201 qApp->installTranslator(appTranslator);
205 qApp->installTranslator(appTranslator);
202 emit this->translateSig();
206 emit this->translateSig();
203 }
207 }
204
208
205
209
206 void SocExplorerMainWindow::createLangMenu()
210 void SocExplorerMainWindow::createLangMenu()
207 {
211 {
208 this->langMenu = menuBar()->addMenu(tr("&Langue"));
212 this->langMenu = menuBar()->addMenu(tr("&Langue"));
209 this->langActionGrp = new QActionGroup(this);
213 this->langActionGrp = new QActionGroup(this);
210 connect(this->langActionGrp,SIGNAL(triggered(QAction*)),this,SLOT(setLangage(QAction*)));
214 connect(this->langActionGrp,SIGNAL(triggered(QAction*)),this,SLOT(setLangage(QAction*)));
211 QDir* qmDir = new QDir(QString("translations"));
215 QDir* qmDir = new QDir(QString("translations"));
212 QStringList LangFiles = qmDir->entryList(QStringList("socexplorer_*.qm"));
216 QStringList LangFiles = qmDir->entryList(QStringList("socexplorer_*.qm"));
213 for(int i=0;i<LangFiles.size();++i)
217 for(int i=0;i<LangFiles.size();++i)
214 {
218 {
215 QString Local = LangFiles[i];
219 QString Local = LangFiles[i];
216 Local.remove(0,Local.indexOf('_')+1);
220 Local.remove(0,Local.indexOf('_')+1);
217 Local.chop(3);
221 Local.chop(3);
218 QTranslator translator;
222 QTranslator translator;
219 translator.load(LangFiles[i],qmDir->absolutePath());
223 translator.load(LangFiles[i],qmDir->absolutePath());
220 QString langage = translator.translate("MainWindow","English");
224 QString langage = translator.translate("MainWindow","English");
221 QAction *action = new QAction(tr("&%1 %2").arg(i+1).arg(langage),this);
225 QAction *action = new QAction(tr("&%1 %2").arg(i+1).arg(langage),this);
222 action->setCheckable(true);
226 action->setCheckable(true);
223 action->setData(Local);
227 action->setData(Local);
224 langMenu->addAction(action);
228 langMenu->addAction(action);
225 langActionGrp->addAction(action);
229 langActionGrp->addAction(action);
226 if(langage==tr("English"))
230 if(langage==tr("English"))
227 action->setChecked(true);
231 action->setChecked(true);
228 }
232 }
229 }
233 }
230
234
231
235
232 void SocExplorerMainWindow::updateText()
236 void SocExplorerMainWindow::updateText()
233 {
237 {
234 emit this->translateSig();
238 emit this->translateSig();
235 }
239 }
236
240
237
241
238
242
239 void SocExplorerMainWindow::showAboutBox()
243 void SocExplorerMainWindow::showAboutBox()
240 {
244 {
241 p_about->show();
245 p_about->show();
242 }
246 }
243
247
244 void SocExplorerMainWindow::pluginselected(const QString &instanceName)
248 void SocExplorerMainWindow::pluginselected(const QString &instanceName)
245 {
249 {
246 socexplorerplugin* drv=socexplorerproxy::self()->getSysDriver(instanceName);
250 socexplorerplugin* drv=socexplorerproxy::self()->getSysDriver(instanceName);
247 if(drv)
251 if(drv)
248 drv->raise();
252 drv->raise();
249 }
253 }
250
254
251
255
252
256
253 void SocExplorerMainWindow::closeEvent(QCloseEvent *event)
257 void SocExplorerMainWindow::closeEvent(QCloseEvent *event)
254 {
258 {
255 socexplorerproxy::self()->close();
259 socexplorerproxy::self()->close();
256 qApp->closeAllWindows();
260 qApp->closeAllWindows();
257 event->accept();
261 event->accept();
258 }
262 }
259
263
260
264
261
265
262
266
263
267
264
268
@@ -1,89 +1,91
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
3 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #ifndef MAINWINDOW_H
22 #ifndef MAINWINDOW_H
23 #define MAINWINDOW_H
23 #define MAINWINDOW_H
24
24
25 #include <QMainWindow>
25 #include <QMainWindow>
26 #include <QApplication>
26 #include <QApplication>
27 #include <QVBoxLayout>
27 #include <QVBoxLayout>
28 #include <QIcon>
28 #include <QIcon>
29 #include <QMenuBar>
29 #include <QMenuBar>
30 #include <QMenu>
30 #include <QMenu>
31 #include <QAction>
31 #include <QAction>
32 #include <QDockWidget>
32 #include <QDockWidget>
33 #include <QTranslator>
33 #include <QTranslator>
34 #include <QSplitter>
34 #include <QSplitter>
35 #include "dockablepluginmanager.h"
35 #include "dockablepluginmanager.h"
36 #include <socexplorerproxy.h>
36 #include <socexplorerproxy.h>
37 #include "PyWdgt/pythonconsole.h"
37 #include "PyWdgt/pythonconsole.h"
38 #include "aboutsocexplorer.h"
38 #include "aboutsocexplorer.h"
39 #include "toolbar.h"
39 #include "toolbar.h"
40 #include "regsExplorer/regsexplorer.h"
40 #include "regsExplorer/regsexplorer.h"
41 #include "socexplorergui.h"
41 #include "socexplorergui.h"
42 #include "sessionmanagerdialog.h"
42
43
43 class SocExplorerMainWindow : public QMainWindow
44 class SocExplorerMainWindow : public QMainWindow
44 {
45 {
45 Q_OBJECT
46 Q_OBJECT
46
47
47 public:
48 public:
48 SocExplorerMainWindow(QString ScriptToEval,QWidget *parent = 0);
49 SocExplorerMainWindow(QString ScriptToEval,QWidget *parent = 0);
49 ~SocExplorerMainWindow();
50 ~SocExplorerMainWindow();
50 QAction* Quit,*LoadPlugin,*ManagePlugins,*help,*regsManager,*exploreRegs,*about,*translateAction;
51 QAction* Quit,*LoadPlugin,*ManagePlugins,*help,*regsManager,*exploreRegs,*about,*translateAction,*sessionManagerAction;
51 QActionGroup*langActionGrp;
52 QActionGroup*langActionGrp;
52 QMenu* FileMenu,*SettingsMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu,*SessionsMenu;
53 QMenu* FileMenu,*SettingsMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu,*SessionsMenu;
53 QTranslator* appTranslator;
54 QTranslator* appTranslator;
54 void createLangMenu();
55 void createLangMenu();
55 void closeEvent(QCloseEvent *event);
56 void closeEvent(QCloseEvent *event);
56 toolBar* toolpane;
57 toolBar* toolpane;
57
58
58
59
59 public slots:
60 public slots:
60 void launchPluginManager();
61 void launchPluginManager();
61 void addPluginInterface(QDockWidget* plugin);
62 void addPluginInterface(QDockWidget* plugin);
62 void removePluginInterface(QDockWidget* plugin);
63 void removePluginInterface(QDockWidget* plugin);
63 void clearMenu();
64 void clearMenu();
64 void updateText();
65 void updateText();
65 void setLangage(QAction* action);
66 void setLangage(QAction* action);
66 void showAboutBox();
67 void showAboutBox();
67 void pluginselected(const QString& instanceName);
68 void pluginselected(const QString& instanceName);
68
69
69 signals:
70 signals:
70 void translateSig();
71 void translateSig();
71 void registerObject(QObject* object,const QString& instanceName);
72 void registerObject(QObject* object,const QString& instanceName);
72
73
73 private:
74 private:
74 void makeObjects(QString ScriptToEval);
75 void makeObjects(QString ScriptToEval);
75 void makeLayout();
76 void makeLayout();
76 void makeConnections();
77 void makeConnections();
77 void makeMenu();
78 void makeMenu();
78 void loadSessions();
79 void loadSessions();
79 QMainWindow* pluginsDockContainer;
80 QMainWindow* pluginsDockContainer;
80 QSplitter* mainWidget;
81 QSplitter* mainWidget;
81 PythonConsole* PythonConsoleInst;
82 PythonConsole* PythonConsoleInst;
82 dockablePluginManager* pluginManager;
83 dockablePluginManager* pluginManager;
83 RegsExplorer* regExplorer;
84 RegsExplorer* regExplorer;
84 aboutsocexplorer* p_about;
85 aboutsocexplorer* p_about;
85 QList<QDockWidget*>* p_pluginGUIlist;
86 QList<QDockWidget*>* p_pluginGUIlist;
86 QStringList p_Sessions;
87 QStringList p_Sessions;
88 SessionManagerDialog* p_SessionManagerDialog;
87 };
89 };
88
90
89 #endif // MAINWINDOW_H
91 #endif // MAINWINDOW_H
@@ -1,126 +1,129
1 #-------------------------------------------------
1 #-------------------------------------------------
2 #
2 #
3 # Project created by QtCreator 2011-09-19T22:52:10
3 # Project created by QtCreator 2011-09-19T22:52:10
4 #
4 #
5 #-------------------------------------------------
5 #-------------------------------------------------
6 SOCEXPLORER_ROOT = $${PWD}/..
6 SOCEXPLORER_ROOT = $${PWD}/..
7 include(../build_cfg/socexplorer.pri)
7 include(../build_cfg/socexplorer.pri)
8
8
9 TARGET = socexplorer$${DEBUG_EXT}
9 TARGET = socexplorer$${DEBUG_EXT}
10 TEMPLATE = app
10 TEMPLATE = app
11 CONFIG += pythonqt
11 CONFIG += pythonqt
12
12
13
13
14 QMAKE_LFLAGS_RELEASE += --enable-auto-import -mstackrealign
14 QMAKE_LFLAGS_RELEASE += --enable-auto-import -mstackrealign
15 QMAKE_LFLAGS_DEBUG += --enable-auto-import -mstackrealign
15 QMAKE_LFLAGS_DEBUG += --enable-auto-import -mstackrealign
16
16
17 include ( common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer.pri )
17 include ( common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer.pri )
18 include ( SocExplorerEngine/pythonQtOut/generated_cpp/PySocExplorerEngine/PySocExplorerEngine.pri )
18 include ( SocExplorerEngine/pythonQtOut/generated_cpp/PySocExplorerEngine/PySocExplorerEngine.pri )
19 include ( SocExplorerEngine/plugins/socexplorerplugin.prf )
19 include ( SocExplorerEngine/plugins/socexplorerplugin.prf )
20
20
21 INCLUDEPATH+=$${PWD} \
21 INCLUDEPATH+=$${PWD} \
22 $${PWD}/common \
22 $${PWD}/common \
23 $${PWD}/common/qhexedit \
23 $${PWD}/common/qhexedit \
24 $${PWD}/common/QCustomPlot \
24 $${PWD}/common/QCustomPlot \
25 $${PWD}/common/genericBinaryFiles \
25 $${PWD}/common/genericBinaryFiles \
26 $${PWD}/common/genericBinaryFiles/elf \
26 $${PWD}/common/genericBinaryFiles/elf \
27 $${PWD}/common/genericBinaryFiles/srec \
27 $${PWD}/common/genericBinaryFiles/srec \
28 $${PWD}/common/genericBinaryFiles/BinFile \
28 $${PWD}/common/genericBinaryFiles/BinFile \
29 SocExplorerEngine/engine \
29 SocExplorerEngine/engine \
30 SocExplorerEngine/pluginloader \
30 SocExplorerEngine/pluginloader \
31 SocExplorerEngine/pluginsInterface \
31 SocExplorerEngine/pluginsInterface \
32 SocExplorerEngine/proxy \
32 SocExplorerEngine/proxy \
33 SocExplorerEngine/pluginManagerWdgt \
33 SocExplorerEngine/pluginManagerWdgt \
34 SocExplorerEngine/plugins \
34 SocExplorerEngine/plugins \
35 SocExplorerEngine/RegisterMVS \
35 SocExplorerEngine/RegisterMVS \
36 SocExplorerEngine/XmlEngine \
36 SocExplorerEngine/XmlEngine \
37 SocExplorerEngine/SOC \
37 SocExplorerEngine/SOC \
38 SocExplorerEngine/PeripheralWidget/src \
38 SocExplorerEngine/PeripheralWidget/src \
39 SocExplorerEngine/memtester
39 SocExplorerEngine/memtester
40
40
41 win32:INCLUDEPATH+= \
41 win32:INCLUDEPATH+= \
42 $${PWD}/common/genericBinaryFiles/elf/libelfWin32/include \
42 $${PWD}/common/genericBinaryFiles/elf/libelfWin32/include \
43 $${PWD}/common/genericBinaryFiles/elf/libelfWin32/include/libelf \
43 $${PWD}/common/genericBinaryFiles/elf/libelfWin32/include/libelf \
44
44
45
45
46 RC_FILE = ../win32cfg/socexplorer.rc
46 RC_FILE = ../win32cfg/socexplorer.rc
47
47
48
48
49 unix:LIBS+=-L$${SOCEXPLORER_ROOT}/bin/linux -lsocexplorercommon$${DEBUG_EXT} -L$${SOCEXPLORER_ROOT}/bin/linux -lsocexplorerengine$${DEBUG_EXT}
49 unix:LIBS+=-L$${SOCEXPLORER_ROOT}/bin/linux -lsocexplorercommon$${DEBUG_EXT} -L$${SOCEXPLORER_ROOT}/bin/linux -lsocexplorerengine$${DEBUG_EXT}
50
50
51 win32-g++:LIBS += $${SOCEXPLORER_ROOT}/bin/win32/socexplorercommon$${DEBUG_EXT}.dll $${SOCEXPLORER_ROOT}/bin/win32/socexplorerengine$${DEBUG_EXT}.dll
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 unix{
54 unix{
55 translation.files = $${SOCEXPLORER_ROOT}/translations/socexplorer_fr.qm \
55 translation.files = $${SOCEXPLORER_ROOT}/translations/socexplorer_fr.qm \
56 $${SOCEXPLORER_ROOT}/translations/socexplorer_en.qm
56 $${SOCEXPLORER_ROOT}/translations/socexplorer_en.qm
57 translation.path = $${SOCEXPLORER_TRANSLATION_INSTALL_PATH}
57 translation.path = $${SOCEXPLORER_TRANSLATION_INSTALL_PATH}
58 target.path = /usr/bin
58 target.path = /usr/bin
59 INSTALLS += translation target
59 INSTALLS += translation target
60 }
60 }
61
61
62 header.path = $$[QT_INSTALL_HEADERS]/SocExplorer/common
62 header.path = $$[QT_INSTALL_HEADERS]/SocExplorer/common
63 header.files = \
63 header.files = \
64 socexplorer.h
64 socexplorer.h
65 INSTALLS += header
65 INSTALLS += header
66
66
67
67
68 SOURCES += main.cpp\
68 SOURCES += main.cpp\
69 mainwindow.cpp \
69 mainwindow.cpp \
70 PyWdgt/pythonconsole.cpp \
70 PyWdgt/pythonconsole.cpp \
71 PyWdgt/pythonqtscriptingconsoledandd.cpp \
71 PyWdgt/pythonqtscriptingconsoledandd.cpp \
72 dockablepluginmanager.cpp \
72 dockablepluginmanager.cpp \
73 toolbar.cpp \
73 toolbar.cpp \
74 toolbarcontainer.cpp \
74 toolbarcontainer.cpp \
75 aboutsocexplorer.cpp \
75 aboutsocexplorer.cpp \
76 regsExplorer/regsexplorer.cpp \
76 regsExplorer/regsexplorer.cpp \
77 socexplorercoresettingsgui.cpp
77 socexplorercoresettingsgui.cpp \
78 sessionmanagerdialog.cpp
78
79
79 HEADERS += mainwindow.h \
80 HEADERS += mainwindow.h \
80 PyWdgt/pythonconsole.h \
81 PyWdgt/pythonconsole.h \
81 PyWdgt/pythonqtscriptingconsoledandd.h \
82 PyWdgt/pythonqtscriptingconsoledandd.h \
82 dockablepluginmanager.h \
83 dockablepluginmanager.h \
83 toolbar.h \
84 toolbar.h \
84 toolbarcontainer.h \
85 toolbarcontainer.h \
85 socexplorer.h \
86 socexplorer.h \
86 SocExplorerEngine/plugins/socexplorerplugin.h \
87 SocExplorerEngine/plugins/socexplorerplugin.h \
87 aboutsocexplorer.h \
88 aboutsocexplorer.h \
88 regsExplorer/regsexplorer.h \
89 regsExplorer/regsexplorer.h \
89 socexplorercoresettingsgui.h
90 socexplorercoresettingsgui.h \
91 sessionmanagerdialog.h
90
92
91
93
92 include ( NicePyConsole/NicePyConsole.pri)
94 include ( NicePyConsole/NicePyConsole.pri)
93
95
94 win32{
96 win32{
95 RESOURCES = ../ressources/SocExplorer.qrc
97 RESOURCES = ../ressources/SocExplorer.qrc
96 }
98 }
97
99
98 unix{
100 unix{
99 RESOURCES = ../ressources/SocExplorer.qrc
101 RESOURCES = ../ressources/SocExplorer.qrc
100 }
102 }
101
103
102 TRANSLATIONS = ../translations/socexplorer_fr.ts \
104 TRANSLATIONS = ../translations/socexplorer_fr.ts \
103 ../translations/socexplorer_en.ts
105 ../translations/socexplorer_en.ts
104
106
105 FORMS += \
107 FORMS += \
106 regsExplorer/regsexplorernew.ui \
108 regsExplorer/regsexplorernew.ui \
107 socexplorercoresettingsgui.ui
109 socexplorercoresettingsgui.ui \
110 sessionmanagerdialog.ui
108
111
109 DISTFILES += \
112 DISTFILES += \
110 ../doc/PythonExamples/LEON3_LOAD.py \
113 ../doc/PythonExamples/LEON3_LOAD.py \
111 ../doc/PythonExamples/PythonPlugin.py \
114 ../doc/PythonExamples/PythonPlugin.py \
112 ../doc/PythonExamples/simpledemo1.py \
115 ../doc/PythonExamples/simpledemo1.py \
113 ../doc/PythonExamples/SocExplorerPlot.py \
116 ../doc/PythonExamples/SocExplorerPlot.py \
114 ../doc/PythonExamples/SocExplorerPlot2.py \
117 ../doc/PythonExamples/SocExplorerPlot2.py \
115 ../doc/PythonExamples/SocExplorerPlot3.py \
118 ../doc/PythonExamples/SocExplorerPlot3.py \
116 ../doc/PythonExamples/tcpterminaldemo.py \
119 ../doc/PythonExamples/tcpterminaldemo.py \
117 ../doc/PythonExamples/tcpterminaldemo2.py
120 ../doc/PythonExamples/tcpterminaldemo2.py
118
121
119
122
120
123
121
124
122
125
123
126
124
127
125
128
126
129
General Comments 0
You need to be logged in to leave comments. Login now