@@ -0,0 +1,34 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the SocExplorer Software | |||
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
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 | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
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 | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
|
22 | #ifndef SOCEXPLORERCONFIGKEYS | |||
|
23 | #define SOCEXPLORERCONFIGKEYS | |||
|
24 | ||||
|
25 | #define SOCEXPLORERENGINE_SETTINGS_SCOPE "SocExplorerEngine" | |||
|
26 | #define SOCEXPLORERENGINE_SETTINGS_PLUGINS_LOOKUP_PATH "plugins-lookup-path" | |||
|
27 | #define SOCEXPLORERENGINE_SETTINGS_SOC_REGS_LOOKUP_PATH "soc-registers-lookup-path" | |||
|
28 | ||||
|
29 | #define SOCEXPLORERGLOBAL_SETTINGS_SCOPE "GLOBAL" | |||
|
30 | #define SOCEXPLORERGLOBAL_SETTINGS_SESSIONS_SCOPE "SESSIONS" | |||
|
31 | #define SOCEXPLORERGLOBAL_SETTINGS_SESSIONS_NAME "NAME" | |||
|
32 | ||||
|
33 | #endif // SOCEXPLORERCONFIGKEYS | |||
|
34 |
@@ -0,0 +1,93 | |||||
|
1 | #include "socexplorergui.h" | |||
|
2 | ||||
|
3 | SocExplorerGUI* SocExplorerGUI::_self=NULL; | |||
|
4 | QMenuBar* SocExplorerGUI::m_mainMenuBar=NULL; | |||
|
5 | QMenu* SocExplorerGUI::m_fileMenu=NULL; | |||
|
6 | QMenu* SocExplorerGUI::m_SettingsMenu=NULL; | |||
|
7 | QList<QAction*>* SocExplorerGUI::m_queuedSettingActions=NULL; | |||
|
8 | QList<QAction*>* SocExplorerGUI::m_queuedFileMenuActions=NULL; | |||
|
9 | ||||
|
10 | #define INIT() \ | |||
|
11 | if(Q_UNLIKELY(_self==NULL))\ | |||
|
12 | {\ | |||
|
13 | init();\ | |||
|
14 | } | |||
|
15 | ||||
|
16 | SocExplorerGUI::SocExplorerGUI(QObject *parent) : QObject(parent) | |||
|
17 | { | |||
|
18 | m_queuedFileMenuActions = new QList<QAction*>(); | |||
|
19 | m_queuedSettingActions = new QList<QAction*>(); | |||
|
20 | } | |||
|
21 | ||||
|
22 | void SocExplorerGUI::init() | |||
|
23 | { | |||
|
24 | _self=new SocExplorerGUI(); | |||
|
25 | } | |||
|
26 | ||||
|
27 | void SocExplorerGUI::registerMenuBar(QMenuBar *menuBar, QMenu *fileMenu, QMenu *SettingsMenu) | |||
|
28 | { | |||
|
29 | INIT(); | |||
|
30 | m_mainMenuBar = menuBar; | |||
|
31 | if(m_mainMenuBar) | |||
|
32 | { | |||
|
33 | if(fileMenu==NULL) | |||
|
34 | m_fileMenu = m_mainMenuBar->addMenu(tr("File")); | |||
|
35 | else | |||
|
36 | m_fileMenu = fileMenu; | |||
|
37 | if(SettingsMenu==NULL) | |||
|
38 | m_SettingsMenu = m_mainMenuBar->addMenu(tr("Settings")); | |||
|
39 | else | |||
|
40 | m_SettingsMenu = SettingsMenu; | |||
|
41 | } | |||
|
42 | ||||
|
43 | QAction* action; | |||
|
44 | foreach (action, *m_queuedSettingActions) | |||
|
45 | { | |||
|
46 | m_SettingsMenu->addAction(action); | |||
|
47 | } | |||
|
48 | foreach (action, *m_queuedFileMenuActions) | |||
|
49 | { | |||
|
50 | m_fileMenu->addAction(action); | |||
|
51 | } | |||
|
52 | } | |||
|
53 | ||||
|
54 | QMenu *SocExplorerGUI::addMenu(const QString &title) | |||
|
55 | { | |||
|
56 | INIT(); | |||
|
57 | if(m_mainMenuBar) | |||
|
58 | { | |||
|
59 | return m_mainMenuBar->addMenu(title); | |||
|
60 | } | |||
|
61 | return NULL; | |||
|
62 | } | |||
|
63 | ||||
|
64 | bool SocExplorerGUI::addFileAction(QAction *action) | |||
|
65 | { | |||
|
66 | INIT(); | |||
|
67 | if(m_fileMenu) | |||
|
68 | { | |||
|
69 | m_fileMenu->addAction(action); | |||
|
70 | return true; | |||
|
71 | } | |||
|
72 | else | |||
|
73 | { | |||
|
74 | m_queuedFileMenuActions->append(action); | |||
|
75 | } | |||
|
76 | return false; | |||
|
77 | } | |||
|
78 | ||||
|
79 | bool SocExplorerGUI::addSettingsAction(QAction *action) | |||
|
80 | { | |||
|
81 | INIT(); | |||
|
82 | if(m_SettingsMenu) | |||
|
83 | { | |||
|
84 | m_SettingsMenu->addAction(action); | |||
|
85 | return true; | |||
|
86 | } | |||
|
87 | else | |||
|
88 | { | |||
|
89 | m_queuedSettingActions->append(action); | |||
|
90 | } | |||
|
91 | return false; | |||
|
92 | } | |||
|
93 |
@@ -0,0 +1,32 | |||||
|
1 | #ifndef SOCEXPLORERGUI_H | |||
|
2 | #define SOCEXPLORERGUI_H | |||
|
3 | ||||
|
4 | #include <QObject> | |||
|
5 | #include <QWidget> | |||
|
6 | #include <QMenu> | |||
|
7 | #include <QMenuBar> | |||
|
8 | #include <QAction> | |||
|
9 | ||||
|
10 | class SocExplorerGUI : public QObject | |||
|
11 | { | |||
|
12 | Q_OBJECT | |||
|
13 | static SocExplorerGUI* _self; | |||
|
14 | static QMenuBar* m_mainMenuBar; | |||
|
15 | static QMenu* m_fileMenu; | |||
|
16 | static QMenu* m_SettingsMenu; | |||
|
17 | static QList<QAction*>* m_queuedSettingActions; | |||
|
18 | static QList<QAction*>* m_queuedFileMenuActions; | |||
|
19 | SocExplorerGUI(QObject *parent = 0); | |||
|
20 | static void init(); | |||
|
21 | public: | |||
|
22 | static SocExplorerGUI* self(){ if(!_self){_self= new SocExplorerGUI;}return _self;} | |||
|
23 | static void registerMenuBar(QMenuBar* menuBar, QMenu* fileMenu=NULL, QMenu* SettingsMenu=NULL); | |||
|
24 | static QMenu* addMenu(const QString & title); | |||
|
25 | static bool addFileAction(QAction * action); | |||
|
26 | static bool addSettingsAction(QAction * action); | |||
|
27 | signals: | |||
|
28 | ||||
|
29 | public slots: | |||
|
30 | }; | |||
|
31 | ||||
|
32 | #endif // SOCEXPLORERGUI_H |
@@ -0,0 +1,205 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the SocExplorer Software | |||
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
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 | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
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 | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
|
22 | #include "socexplorersettings.h" | |||
|
23 | ||||
|
24 | SocExplorerSettings* SocExplorerSettings::_self=NULL; | |||
|
25 | QSettings* SocExplorerSettings::m_settings=NULL; | |||
|
26 | QSettings* SocExplorerSettings::m_sessionSettings=NULL; | |||
|
27 | SocExplorerSettingsDialog* SocExplorerSettings::m_configDialog = NULL; | |||
|
28 | #include <socexplorergui.h> | |||
|
29 | #include <QFile> | |||
|
30 | #include <QFileInfo> | |||
|
31 | #include <QDir> | |||
|
32 | #include <QDebug> | |||
|
33 | ||||
|
34 | #define INIT() \ | |||
|
35 | if(Q_UNLIKELY(_self==NULL))\ | |||
|
36 | {\ | |||
|
37 | init();\ | |||
|
38 | } | |||
|
39 | ||||
|
40 | ||||
|
41 | SocExplorerSettings::SocExplorerSettings(QObject *parent) : QObject(parent) | |||
|
42 | { | |||
|
43 | m_settings = new QSettings(); | |||
|
44 | m_configDialog = new SocExplorerSettingsDialog(); | |||
|
45 | QAction* trigerGUI = new QAction(tr("Settings"),this); | |||
|
46 | connect(trigerGUI,SIGNAL(triggered()),this,SLOT(popConfigDialog())); | |||
|
47 | SocExplorerGUI::addSettingsAction(trigerGUI); | |||
|
48 | } | |||
|
49 | ||||
|
50 | SocExplorerSettings::~SocExplorerSettings() | |||
|
51 | { | |||
|
52 | if(m_settings) | |||
|
53 | { | |||
|
54 | m_settings->sync(); | |||
|
55 | delete m_settings; | |||
|
56 | } | |||
|
57 | if(m_sessionSettings) | |||
|
58 | { | |||
|
59 | m_sessionSettings->sync(); | |||
|
60 | delete m_sessionSettings; | |||
|
61 | } | |||
|
62 | } | |||
|
63 | ||||
|
64 | void SocExplorerSettings::init() | |||
|
65 | { | |||
|
66 | if(!_self) | |||
|
67 | { | |||
|
68 | _self= new SocExplorerSettings(); | |||
|
69 | } | |||
|
70 | } | |||
|
71 | ||||
|
72 | void SocExplorerSettings::setValue(QObject *object, const QString &key, const QVariant &value, SettingScope Sscope) | |||
|
73 | { | |||
|
74 | INIT(); | |||
|
75 | setValue(object->metaObject()->className(),key,value,Sscope); | |||
|
76 | } | |||
|
77 | ||||
|
78 | QVariant SocExplorerSettings::value(QObject *object, const QString &key, const QVariant &defaultValue, SettingScope Sscope) | |||
|
79 | { | |||
|
80 | INIT(); | |||
|
81 | return value(object->metaObject()->className(),key,defaultValue,Sscope); | |||
|
82 | } | |||
|
83 | ||||
|
84 | void SocExplorerSettings::setValue(const QString scope, const QString &key, const QVariant &value, SettingScope Sscope) | |||
|
85 | { | |||
|
86 | INIT(); | |||
|
87 | switch (Sscope) | |||
|
88 | { | |||
|
89 | case SystemWide: | |||
|
90 | if(m_settings) | |||
|
91 | m_settings->setValue(scope+"/"+key,value); | |||
|
92 | break; | |||
|
93 | case Session: | |||
|
94 | if(m_sessionSettings) | |||
|
95 | m_sessionSettings->setValue(scope+"/"+key,value); | |||
|
96 | break; | |||
|
97 | default: | |||
|
98 | break; | |||
|
99 | } | |||
|
100 | } | |||
|
101 | ||||
|
102 | QVariant SocExplorerSettings::value(const QString scope, const QString &key, const QVariant &defaultValue, SettingScope Sscope) | |||
|
103 | { | |||
|
104 | INIT(); | |||
|
105 | switch (Sscope) | |||
|
106 | { | |||
|
107 | case SystemWide: | |||
|
108 | if(m_settings) | |||
|
109 | return m_settings->value(scope+"/"+key,defaultValue); | |||
|
110 | break; | |||
|
111 | case Session: | |||
|
112 | if(m_sessionSettings) | |||
|
113 | return m_sessionSettings->value(scope+"/"+key,defaultValue); | |||
|
114 | break; | |||
|
115 | default: | |||
|
116 | break; | |||
|
117 | } | |||
|
118 | return defaultValue; | |||
|
119 | } | |||
|
120 | ||||
|
121 | QList<QList<QVariant> > SocExplorerSettings::arrays(const QString &prefix, QStringList keys, SocExplorerSettings::SettingScope Sscope) | |||
|
122 | { | |||
|
123 | INIT(); | |||
|
124 | QList<QList<QVariant> > defaultValue; | |||
|
125 | switch (Sscope) | |||
|
126 | { | |||
|
127 | case SystemWide: | |||
|
128 | if(m_settings) | |||
|
129 | return arrays(prefix,keys,m_settings); | |||
|
130 | break; | |||
|
131 | case Session: | |||
|
132 | if(m_sessionSettings) | |||
|
133 | return arrays(prefix,keys,m_sessionSettings); | |||
|
134 | break; | |||
|
135 | default: | |||
|
136 | break; | |||
|
137 | } | |||
|
138 | return defaultValue; | |||
|
139 | } | |||
|
140 | ||||
|
141 | void SocExplorerSettings::sync() | |||
|
142 | { | |||
|
143 | INIT(); | |||
|
144 | if(m_settings) | |||
|
145 | { | |||
|
146 | m_settings->sync(); | |||
|
147 | } | |||
|
148 | if(m_sessionSettings) | |||
|
149 | { | |||
|
150 | m_sessionSettings->sync(); | |||
|
151 | } | |||
|
152 | } | |||
|
153 | ||||
|
154 | bool SocExplorerSettings::registerConfigEntry(SocExplorerSettingsItem *configEntry, QIcon icon, QString text) | |||
|
155 | { | |||
|
156 | INIT(); | |||
|
157 | return m_configDialog->registerConfigEntry(configEntry,icon,text); | |||
|
158 | } | |||
|
159 | ||||
|
160 | bool SocExplorerSettings::loadSession(const QString &session) | |||
|
161 | { | |||
|
162 | INIT(); | |||
|
163 | QFileInfo sessionInfo(m_settings->fileName()); | |||
|
164 | QString fullpath=sessionInfo.absoluteDir().absolutePath() +"/"+session+".conf"; | |||
|
165 | if(m_sessionSettings) | |||
|
166 | { | |||
|
167 | delete m_sessionSettings; | |||
|
168 | m_sessionSettings = NULL; | |||
|
169 | } | |||
|
170 | m_sessionSettings = new QSettings(fullpath,QSettings::NativeFormat,self()); | |||
|
171 | qDebug()<< m_sessionSettings->fileName(); | |||
|
172 | if(m_sessionSettings->status()==QSettings::NoError) | |||
|
173 | { | |||
|
174 | return true; | |||
|
175 | } | |||
|
176 | delete m_sessionSettings; | |||
|
177 | m_sessionSettings = NULL; | |||
|
178 | return false; | |||
|
179 | } | |||
|
180 | ||||
|
181 | void SocExplorerSettings::popConfigDialog() | |||
|
182 | { | |||
|
183 | m_configDialog->popConfigDialog(NULL); | |||
|
184 | } | |||
|
185 | ||||
|
186 | QList<QList<QVariant> > SocExplorerSettings::arrays(const QString &prefix, QStringList keys, QSettings *settings) | |||
|
187 | { | |||
|
188 | QList<QList<QVariant> > result; | |||
|
189 | if(settings) | |||
|
190 | { | |||
|
191 | int size = settings->beginReadArray(prefix); | |||
|
192 | for (int i = 0; i < size; ++i) | |||
|
193 | { | |||
|
194 | result.append(QList<QVariant>()); | |||
|
195 | settings->setArrayIndex(i); | |||
|
196 | for(int l=0;l<keys.count();l++) | |||
|
197 | { | |||
|
198 | result[i].append(settings->value(keys.at(i))); | |||
|
199 | } | |||
|
200 | } | |||
|
201 | settings->endArray(); | |||
|
202 | } | |||
|
203 | return result; | |||
|
204 | } | |||
|
205 |
@@ -0,0 +1,66 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the SocExplorer Software | |||
|
3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
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 | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
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 | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
|
22 | #ifndef SOCEXPLORERSETTINGS_H | |||
|
23 | #define SOCEXPLORERSETTINGS_H | |||
|
24 | ||||
|
25 | #include <QObject> | |||
|
26 | #include <QWidget> | |||
|
27 | #include <QSettings> | |||
|
28 | #include <socexplorersettingsdialog.h> | |||
|
29 | ||||
|
30 | class SocExplorerSettings : public QObject | |||
|
31 | { | |||
|
32 | Q_OBJECT | |||
|
33 | private: | |||
|
34 | static SocExplorerSettings* _self; | |||
|
35 | static QSettings* m_settings; | |||
|
36 | static QSettings* m_sessionSettings; | |||
|
37 | static SocExplorerSettingsDialog* m_configDialog; | |||
|
38 | SocExplorerSettings(QObject *parent = 0); | |||
|
39 | ~SocExplorerSettings(); | |||
|
40 | public: | |||
|
41 | enum SettingScope { | |||
|
42 | SystemWide = 0, | |||
|
43 | Session | |||
|
44 | }; | |||
|
45 | static void init(); | |||
|
46 | static SocExplorerSettings* self(){ if(!_self){_self= new SocExplorerSettings;}return _self;} | |||
|
47 | static void setValue(QObject* object,const QString & key, const QVariant & value,SettingScope Sscope =SystemWide); | |||
|
48 | static QVariant value(QObject* object, const QString & key, const QVariant & defaultValue = QVariant(),SettingScope Sscope=SystemWide); | |||
|
49 | static void setValue(const QString scope,const QString & key, const QVariant & value,SettingScope Sscope= SystemWide); | |||
|
50 | static QVariant value(const QString scope, const QString & key, const QVariant & defaultValue = QVariant(),SettingScope Sscope =SystemWide); | |||
|
51 | static QList<QList<QVariant> > arrays(const QString & prefix, QStringList keys,SettingScope Sscope =SystemWide); | |||
|
52 | static void sync(); | |||
|
53 | static bool registerConfigEntry(SocExplorerSettingsItem* configEntry,QIcon icon, QString text); | |||
|
54 | //! Loads the given session, or sreate it if doesn't exists. | |||
|
55 | //! \param session Session name. | |||
|
56 | //! \return true if success or false if fails to create session config file. | |||
|
57 | static bool loadSession(const QString& session); | |||
|
58 | signals: | |||
|
59 | ||||
|
60 | public slots: | |||
|
61 | void popConfigDialog(); | |||
|
62 | private: | |||
|
63 | static QList<QList<QVariant> > arrays(const QString & prefix, QStringList keys,QSettings* settings); | |||
|
64 | }; | |||
|
65 | ||||
|
66 | #endif // SOCEXPLORERSETTINGS_H |
@@ -0,0 +1,69 | |||||
|
1 | #include "socexplorersettingsdialog.h" | |||
|
2 | #include "ui_socexplorersettingsdialog.h" | |||
|
3 | ||||
|
4 | SocExplorerSettingsDialog::SocExplorerSettingsDialog(QWidget *parent) : | |||
|
5 | QDialog(parent), | |||
|
6 | ui(new Ui::SocExplorerSettingsDialog) | |||
|
7 | { | |||
|
8 | ui->setupUi(this); | |||
|
9 | connect(ui->contentsWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*))); | |||
|
10 | ui->contentsWidget->setViewMode(QListView::IconMode); | |||
|
11 | ui->contentsWidget->setIconSize(QSize(96, 84)); | |||
|
12 | ui->contentsWidget->setMovement(QListView::Static); | |||
|
13 | ui->contentsWidget->setSpacing(12); | |||
|
14 | } | |||
|
15 | ||||
|
16 | SocExplorerSettingsDialog::~SocExplorerSettingsDialog() | |||
|
17 | { | |||
|
18 | delete ui; | |||
|
19 | } | |||
|
20 | ||||
|
21 | void SocExplorerSettingsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous) | |||
|
22 | { | |||
|
23 | if (!current) | |||
|
24 | current = previous; | |||
|
25 | ui->pagesWidget->setCurrentIndex(ui->contentsWidget->row(current)); | |||
|
26 | } | |||
|
27 | ||||
|
28 | bool SocExplorerSettingsDialog::registerConfigEntry(SocExplorerSettingsItem *configEntry, QIcon icon, QString text) | |||
|
29 | { | |||
|
30 | if(configEntry!=NULL) | |||
|
31 | { | |||
|
32 | ui->pagesWidget->addWidget(configEntry); | |||
|
33 | QListWidgetItem *configButton = new QListWidgetItem(ui->contentsWidget); | |||
|
34 | configButton->setIcon(icon); | |||
|
35 | configButton->setText(text); | |||
|
36 | configButton->setTextAlignment(Qt::AlignHCenter); | |||
|
37 | configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); | |||
|
38 | connect(this,SIGNAL(accepted()),configEntry,SLOT(accept())); | |||
|
39 | return true; | |||
|
40 | } | |||
|
41 | return false; | |||
|
42 | } | |||
|
43 | ||||
|
44 | void SocExplorerSettingsDialog::popConfigDialog(SocExplorerSettingsItem *selectedConfigEntry) | |||
|
45 | { | |||
|
46 | if(selectedConfigEntry!=NULL) | |||
|
47 | { | |||
|
48 | for(int i=0;i<ui->pagesWidget->count();i++) | |||
|
49 | { | |||
|
50 | if(ui->pagesWidget->widget(i)==selectedConfigEntry) | |||
|
51 | { | |||
|
52 | ui->pagesWidget->setCurrentIndex(i); | |||
|
53 | } | |||
|
54 | } | |||
|
55 | } | |||
|
56 | this->show(); | |||
|
57 | } | |||
|
58 | ||||
|
59 | void SocExplorerSettingsDialog::changeEvent(QEvent *e) | |||
|
60 | { | |||
|
61 | QDialog::changeEvent(e); | |||
|
62 | switch (e->type()) { | |||
|
63 | case QEvent::LanguageChange: | |||
|
64 | ui->retranslateUi(this); | |||
|
65 | break; | |||
|
66 | default: | |||
|
67 | break; | |||
|
68 | } | |||
|
69 | } |
@@ -0,0 +1,41 | |||||
|
1 | #ifndef SOCEXPLORERSETTINGSDIALOG_H | |||
|
2 | #define SOCEXPLORERSETTINGSDIALOG_H | |||
|
3 | ||||
|
4 | #include <QDialog> | |||
|
5 | ||||
|
6 | namespace Ui { | |||
|
7 | class SocExplorerSettingsDialog; | |||
|
8 | } | |||
|
9 | #include <QListWidgetItem> | |||
|
10 | ||||
|
11 | class SocExplorerSettingsItem : public QWidget | |||
|
12 | { | |||
|
13 | Q_OBJECT | |||
|
14 | public: | |||
|
15 | SocExplorerSettingsItem(QWidget *parent = 0):QWidget(parent) {} | |||
|
16 | ~SocExplorerSettingsItem() {} | |||
|
17 | public slots: | |||
|
18 | virtual void accept()=0; | |||
|
19 | }; | |||
|
20 | ||||
|
21 | class SocExplorerSettingsDialog : public QDialog | |||
|
22 | { | |||
|
23 | Q_OBJECT | |||
|
24 | ||||
|
25 | public: | |||
|
26 | explicit SocExplorerSettingsDialog(QWidget *parent = 0); | |||
|
27 | ~SocExplorerSettingsDialog(); | |||
|
28 | ||||
|
29 | public slots: | |||
|
30 | void changePage(QListWidgetItem *current, QListWidgetItem *previous); | |||
|
31 | bool registerConfigEntry(SocExplorerSettingsItem* configEntry, QIcon icon, QString text); | |||
|
32 | void popConfigDialog(SocExplorerSettingsItem* selectedConfigEntry=0); | |||
|
33 | ||||
|
34 | protected: | |||
|
35 | void changeEvent(QEvent *e); | |||
|
36 | ||||
|
37 | private: | |||
|
38 | Ui::SocExplorerSettingsDialog *ui; | |||
|
39 | }; | |||
|
40 | ||||
|
41 | #endif // SOCEXPLORERSETTINGSDIALOG_H |
@@ -0,0 +1,102 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |||
|
2 | <ui version="4.0"> | |||
|
3 | <class>SocExplorerSettingsDialog</class> | |||
|
4 | <widget class="QDialog" name="SocExplorerSettingsDialog"> | |||
|
5 | <property name="geometry"> | |||
|
6 | <rect> | |||
|
7 | <x>0</x> | |||
|
8 | <y>0</y> | |||
|
9 | <width>555</width> | |||
|
10 | <height>329</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="1"> | |||
|
18 | <widget class="QListWidget" name="contentsWidget"> | |||
|
19 | <property name="sizePolicy"> | |||
|
20 | <sizepolicy hsizetype="Maximum" vsizetype="Expanding"> | |||
|
21 | <horstretch>0</horstretch> | |||
|
22 | <verstretch>0</verstretch> | |||
|
23 | </sizepolicy> | |||
|
24 | </property> | |||
|
25 | <property name="minimumSize"> | |||
|
26 | <size> | |||
|
27 | <width>100</width> | |||
|
28 | <height>0</height> | |||
|
29 | </size> | |||
|
30 | </property> | |||
|
31 | <property name="maximumSize"> | |||
|
32 | <size> | |||
|
33 | <width>16777215</width> | |||
|
34 | <height>16777215</height> | |||
|
35 | </size> | |||
|
36 | </property> | |||
|
37 | </widget> | |||
|
38 | </item> | |||
|
39 | <item row="0" column="2"> | |||
|
40 | <widget class="QStackedWidget" name="pagesWidget"> | |||
|
41 | <property name="sizePolicy"> | |||
|
42 | <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> | |||
|
43 | <horstretch>0</horstretch> | |||
|
44 | <verstretch>0</verstretch> | |||
|
45 | </sizepolicy> | |||
|
46 | </property> | |||
|
47 | <property name="minimumSize"> | |||
|
48 | <size> | |||
|
49 | <width>100</width> | |||
|
50 | <height>0</height> | |||
|
51 | </size> | |||
|
52 | </property> | |||
|
53 | </widget> | |||
|
54 | </item> | |||
|
55 | <item row="2" column="1" colspan="2"> | |||
|
56 | <widget class="QDialogButtonBox" name="buttonBox"> | |||
|
57 | <property name="orientation"> | |||
|
58 | <enum>Qt::Horizontal</enum> | |||
|
59 | </property> | |||
|
60 | <property name="standardButtons"> | |||
|
61 | <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | |||
|
62 | </property> | |||
|
63 | </widget> | |||
|
64 | </item> | |||
|
65 | </layout> | |||
|
66 | </widget> | |||
|
67 | <resources/> | |||
|
68 | <connections> | |||
|
69 | <connection> | |||
|
70 | <sender>buttonBox</sender> | |||
|
71 | <signal>accepted()</signal> | |||
|
72 | <receiver>SocExplorerSettingsDialog</receiver> | |||
|
73 | <slot>accept()</slot> | |||
|
74 | <hints> | |||
|
75 | <hint type="sourcelabel"> | |||
|
76 | <x>277</x> | |||
|
77 | <y>304</y> | |||
|
78 | </hint> | |||
|
79 | <hint type="destinationlabel"> | |||
|
80 | <x>277</x> | |||
|
81 | <y>164</y> | |||
|
82 | </hint> | |||
|
83 | </hints> | |||
|
84 | </connection> | |||
|
85 | <connection> | |||
|
86 | <sender>buttonBox</sender> | |||
|
87 | <signal>rejected()</signal> | |||
|
88 | <receiver>SocExplorerSettingsDialog</receiver> | |||
|
89 | <slot>reject()</slot> | |||
|
90 | <hints> | |||
|
91 | <hint type="sourcelabel"> | |||
|
92 | <x>277</x> | |||
|
93 | <y>304</y> | |||
|
94 | </hint> | |||
|
95 | <hint type="destinationlabel"> | |||
|
96 | <x>277</x> | |||
|
97 | <y>164</y> | |||
|
98 | </hint> | |||
|
99 | </hints> | |||
|
100 | </connection> | |||
|
101 | </connections> | |||
|
102 | </ui> |
@@ -0,0 +1,37 | |||||
|
1 | #include "socexplorercoresettingsgui.h" | |||
|
2 | #include "ui_socexplorercoresettingsgui.h" | |||
|
3 | #include <socexplorersettings.h> | |||
|
4 | #include <socexplorerengine.h> | |||
|
5 | #include <socexplorerconfigkeys.h> | |||
|
6 | ||||
|
7 | SocExplorerCoreSettingsGUI::SocExplorerCoreSettingsGUI(QWidget *parent) : | |||
|
8 | SocExplorerSettingsItem(parent), | |||
|
9 | ui(new Ui::SocExplorerCoreSettingsGUI) | |||
|
10 | { | |||
|
11 | ui->setupUi(this); | |||
|
12 | this->ui->PluginsLookupPath->setText(SocExplorerSettings::value(SOCEXPLORERENGINE_SETTINGS_SCOPE,SOCEXPLORERENGINE_SETTINGS_PLUGINS_LOOKUP_PATH,"").toString()); | |||
|
13 | this->ui->SOCregsLookupPath->setText(SocExplorerSettings::value(SOCEXPLORERENGINE_SETTINGS_SCOPE,SOCEXPLORERENGINE_SETTINGS_SOC_REGS_LOOKUP_PATH,"").toString()); | |||
|
14 | } | |||
|
15 | ||||
|
16 | SocExplorerCoreSettingsGUI::~SocExplorerCoreSettingsGUI() | |||
|
17 | { | |||
|
18 | delete ui; | |||
|
19 | } | |||
|
20 | ||||
|
21 | void SocExplorerCoreSettingsGUI::changeEvent(QEvent *e) | |||
|
22 | { | |||
|
23 | QWidget::changeEvent(e); | |||
|
24 | switch (e->type()) { | |||
|
25 | case QEvent::LanguageChange: | |||
|
26 | ui->retranslateUi(this); | |||
|
27 | break; | |||
|
28 | default: | |||
|
29 | break; | |||
|
30 | } | |||
|
31 | } | |||
|
32 | ||||
|
33 | void SocExplorerCoreSettingsGUI::accept() | |||
|
34 | { | |||
|
35 | SocExplorerSettings::setValue(SOCEXPLORERENGINE_SETTINGS_SCOPE,SOCEXPLORERENGINE_SETTINGS_PLUGINS_LOOKUP_PATH,this->ui->PluginsLookupPath->text()); | |||
|
36 | SocExplorerSettings::setValue(SOCEXPLORERENGINE_SETTINGS_SCOPE,SOCEXPLORERENGINE_SETTINGS_SOC_REGS_LOOKUP_PATH,this->ui->SOCregsLookupPath->text()); | |||
|
37 | } |
@@ -0,0 +1,27 | |||||
|
1 | #ifndef SOCEXPLORERCORESETTINGSGUI_H | |||
|
2 | #define SOCEXPLORERCORESETTINGSGUI_H | |||
|
3 | ||||
|
4 | #include <QWidget> | |||
|
5 | #include <socexplorersettingsdialog.h> | |||
|
6 | ||||
|
7 | namespace Ui { | |||
|
8 | class SocExplorerCoreSettingsGUI; | |||
|
9 | } | |||
|
10 | ||||
|
11 | class SocExplorerCoreSettingsGUI : public SocExplorerSettingsItem | |||
|
12 | { | |||
|
13 | Q_OBJECT | |||
|
14 | ||||
|
15 | public: | |||
|
16 | explicit SocExplorerCoreSettingsGUI(QWidget *parent = 0); | |||
|
17 | ~SocExplorerCoreSettingsGUI(); | |||
|
18 | ||||
|
19 | protected: | |||
|
20 | void changeEvent(QEvent *e); | |||
|
21 | public slots: | |||
|
22 | void accept(); | |||
|
23 | private: | |||
|
24 | Ui::SocExplorerCoreSettingsGUI *ui; | |||
|
25 | }; | |||
|
26 | ||||
|
27 | #endif // SOCEXPLORERCORESETTINGSGUI_H |
@@ -0,0 +1,80 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |||
|
2 | <ui version="4.0"> | |||
|
3 | <class>SocExplorerCoreSettingsGUI</class> | |||
|
4 | <widget class="QWidget" name="SocExplorerCoreSettingsGUI"> | |||
|
5 | <property name="geometry"> | |||
|
6 | <rect> | |||
|
7 | <x>0</x> | |||
|
8 | <y>0</y> | |||
|
9 | <width>573</width> | |||
|
10 | <height>274</height> | |||
|
11 | </rect> | |||
|
12 | </property> | |||
|
13 | <property name="windowTitle"> | |||
|
14 | <string>Form</string> | |||
|
15 | </property> | |||
|
16 | <layout class="QVBoxLayout" name="verticalLayout"> | |||
|
17 | <item> | |||
|
18 | <widget class="QGroupBox" name="groupBox"> | |||
|
19 | <property name="title"> | |||
|
20 | <string>Plugins</string> | |||
|
21 | </property> | |||
|
22 | <layout class="QFormLayout" name="formLayout"> | |||
|
23 | <item row="0" column="0"> | |||
|
24 | <widget class="QLabel" name="label"> | |||
|
25 | <property name="text"> | |||
|
26 | <string>Lookup path</string> | |||
|
27 | </property> | |||
|
28 | </widget> | |||
|
29 | </item> | |||
|
30 | <item row="0" column="1"> | |||
|
31 | <widget class="QLineEdit" name="PluginsLookupPath"> | |||
|
32 | <property name="toolTip"> | |||
|
33 | <string><html><head/><body><p><span style=" font-weight:600;">Semicolon </span>separated list of path.</p></body></html></string> | |||
|
34 | </property> | |||
|
35 | </widget> | |||
|
36 | </item> | |||
|
37 | </layout> | |||
|
38 | </widget> | |||
|
39 | </item> | |||
|
40 | <item> | |||
|
41 | <widget class="QGroupBox" name="groupBox_2"> | |||
|
42 | <property name="title"> | |||
|
43 | <string>SOC registers description</string> | |||
|
44 | </property> | |||
|
45 | <layout class="QFormLayout" name="formLayout_2"> | |||
|
46 | <item row="0" column="0"> | |||
|
47 | <widget class="QLabel" name="label_2"> | |||
|
48 | <property name="text"> | |||
|
49 | <string>Lookup path</string> | |||
|
50 | </property> | |||
|
51 | </widget> | |||
|
52 | </item> | |||
|
53 | <item row="0" column="1"> | |||
|
54 | <widget class="QLineEdit" name="SOCregsLookupPath"> | |||
|
55 | <property name="toolTip"> | |||
|
56 | <string><html><head/><body><p><span style=" font-weight:600;">Semicolon </span>separated list of path.</p></body></html></string> | |||
|
57 | </property> | |||
|
58 | </widget> | |||
|
59 | </item> | |||
|
60 | </layout> | |||
|
61 | </widget> | |||
|
62 | </item> | |||
|
63 | <item> | |||
|
64 | <spacer name="verticalSpacer"> | |||
|
65 | <property name="orientation"> | |||
|
66 | <enum>Qt::Vertical</enum> | |||
|
67 | </property> | |||
|
68 | <property name="sizeHint" stdset="0"> | |||
|
69 | <size> | |||
|
70 | <width>20</width> | |||
|
71 | <height>40</height> | |||
|
72 | </size> | |||
|
73 | </property> | |||
|
74 | </spacer> | |||
|
75 | </item> | |||
|
76 | </layout> | |||
|
77 | </widget> | |||
|
78 | <resources/> | |||
|
79 | <connections/> | |||
|
80 | </ui> |
@@ -1,4 +1,4 | |||||
1 | 1cb664ab4bb3c531d706b1948a378ed9810c0dda src/SocExplorerEngine/PeripheralWidget |
|
1 | 1cb664ab4bb3c531d706b1948a378ed9810c0dda src/SocExplorerEngine/PeripheralWidget | |
2 | 1f143e4ae72a0bb4832b546eb76eb50e94049b80 src/common/genericBinaryFiles |
|
2 | 1f143e4ae72a0bb4832b546eb76eb50e94049b80 src/common/genericBinaryFiles | |
3 | 2dce25b198558be573f56c1cf337aa95ddd666d6 src/common/lppserial |
|
3 | 2b353bf8243cbfb3db44e196f33bd164c11c9949 src/common/lppserial | |
4 | 923afde9cc96bb419cf898560d080ec96991aeca src/common/qhexedit |
|
4 | 923afde9cc96bb419cf898560d080ec96991aeca src/common/qhexedit |
@@ -67,7 +67,11 header.files = engine/socexplorerengine. | |||||
67 | PeripheralWidget/src/registerwidget.h \ |
|
67 | PeripheralWidget/src/registerwidget.h \ | |
68 | PeripheralWidget/src/socregsviewer.h \ |
|
68 | PeripheralWidget/src/socregsviewer.h \ | |
69 | PeripheralWidget/src/socregsviewernew.h \ |
|
69 | PeripheralWidget/src/socregsviewernew.h \ | |
70 | memtester/memtester.h |
|
70 | memtester/memtester.h \ | |
|
71 | engine/socexplorersettings.h \ | |||
|
72 | engine/socexplorersettingsdialog.h \ | |||
|
73 | engine/socexplorergui.h\ | |||
|
74 | engine/socexplorerconfigkeys.h | |||
71 |
|
75 | |||
72 |
|
76 | |||
73 |
|
77 | |||
@@ -125,7 +129,11 HEADERS += \ | |||||
125 | PySocExplorerEngine.h \ |
|
129 | PySocExplorerEngine.h \ | |
126 | memtester/memtester.h\ |
|
130 | memtester/memtester.h\ | |
127 | PeripheralWidget/src/socregsviewernew.h \ |
|
131 | PeripheralWidget/src/socregsviewernew.h \ | |
128 | PeripheralWidget/src/collapsableperipheralwidget.h |
|
132 | PeripheralWidget/src/collapsableperipheralwidget.h \ | |
|
133 | engine/socexplorersettings.h \ | |||
|
134 | engine/socexplorersettingsdialog.h \ | |||
|
135 | engine/socexplorergui.h \ | |||
|
136 | engine/socexplorerconfigkeys.h | |||
129 |
|
137 | |||
130 |
|
138 | |||
131 |
|
139 | |||
@@ -155,7 +163,10 SOURCES += \ | |||||
155 | plugins/socexplorerplugin.cpp \ |
|
163 | plugins/socexplorerplugin.cpp \ | |
156 | memtester/memtester.cpp \ |
|
164 | memtester/memtester.cpp \ | |
157 | PeripheralWidget/src/socregsviewernew.cpp \ |
|
165 | PeripheralWidget/src/socregsviewernew.cpp \ | |
158 | PeripheralWidget/src/collapsableperipheralwidget.cpp |
|
166 | PeripheralWidget/src/collapsableperipheralwidget.cpp \ | |
|
167 | engine/socexplorersettings.cpp \ | |||
|
168 | engine/socexplorersettingsdialog.cpp \ | |||
|
169 | engine/socexplorergui.cpp | |||
159 |
|
170 | |||
160 |
|
171 | |||
161 | OTHER_FILES += \ |
|
172 | OTHER_FILES += \ | |
@@ -167,7 +178,8 OTHER_FILES += \ | |||||
167 |
|
178 | |||
168 | FORMS += \ |
|
179 | FORMS += \ | |
169 | PeripheralWidget/src/socregsviewernew.ui \ |
|
180 | PeripheralWidget/src/socregsviewernew.ui \ | |
170 | PeripheralWidget/src/collapsableperipheralwidget.ui |
|
181 | PeripheralWidget/src/collapsableperipheralwidget.ui \ | |
|
182 | engine/socexplorersettingsdialog.ui | |||
171 |
|
183 | |||
172 |
|
184 | |||
173 | RESOURCES += \ |
|
185 | RESOURCES += \ |
@@ -21,13 +21,18 | |||||
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "socexplorerengine.h" |
|
22 | #include "socexplorerengine.h" | |
23 | #include <proxy/socexplorerproxy.h> |
|
23 | #include <proxy/socexplorerproxy.h> | |
|
24 | #include <socexplorersettings.h> | |||
|
25 | #include <socexplorercoresettingsgui.h> | |||
|
26 | #include <socexplorerconfigkeys.h> | |||
24 |
|
27 | |||
25 | SocExplorerEngine* SocExplorerEngine::_self = NULL; |
|
28 | SocExplorerEngine* SocExplorerEngine::_self = NULL; | |
26 | socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL; |
|
29 | socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL; | |
27 | QMainWindow* SocExplorerEngine::mainWindow=NULL; |
|
30 | QMainWindow* SocExplorerEngine::mainWindow=NULL; | |
28 | QList<SOCModel*>* SocExplorerEngine::SOCs=NULL; |
|
31 | QList<SOCModel*>* SocExplorerEngine::SOCs=NULL; | |
|
32 | QSettings* SocExplorerEngine::m_settings=NULL; | |||
29 | int SocExplorerEngine::loglvl=1; |
|
33 | int SocExplorerEngine::loglvl=1; | |
30 |
|
34 | |||
|
35 | ||||
31 | SocExplorerEngine::SocExplorerEngine(QObject *parent) : |
|
36 | SocExplorerEngine::SocExplorerEngine(QObject *parent) : | |
32 | QObject(parent) |
|
37 | QObject(parent) | |
33 | { |
|
38 | { | |
@@ -35,7 +40,9 SocExplorerEngine::SocExplorerEngine(QOb | |||||
35 | { |
|
40 | { | |
36 | SOCs = new QList<SOCModel*>; |
|
41 | SOCs = new QList<SOCModel*>; | |
37 | } |
|
42 | } | |
38 |
|
43 | m_settings = new QSettings(); | ||
|
44 | SocExplorerCoreSettingsGUI* cfggui=new SocExplorerCoreSettingsGUI(); | |||
|
45 | SocExplorerSettings::registerConfigEntry(cfggui,QIcon(":/images/config.svg"),"SocExplorer Core"); | |||
39 | } |
|
46 | } | |
40 |
|
47 | |||
41 |
|
48 | |||
@@ -88,6 +95,14 QStringList SocExplorerEngine::pluginFol | |||||
88 | } |
|
95 | } | |
89 | } |
|
96 | } | |
90 | } |
|
97 | } | |
|
98 | QStringList localCfg = SocExplorerSettings::value(SOCEXPLORERENGINE_SETTINGS_SCOPE,SOCEXPLORERENGINE_SETTINGS_PLUGINS_LOOKUP_PATH).toString().split(";"); | |||
|
99 | QString dir; | |||
|
100 | foreach (dir, localCfg) | |||
|
101 | { | |||
|
102 | QDir plugDir(dir); | |||
|
103 | if(plugDir.exists()) | |||
|
104 | folders.append(dir); | |||
|
105 | } | |||
91 | return folders; |
|
106 | return folders; | |
92 | } |
|
107 | } | |
93 |
|
108 |
@@ -42,6 +42,7 | |||||
42 | #include <registerwidget.h> |
|
42 | #include <registerwidget.h> | |
43 | #include <socmodel.h> |
|
43 | #include <socmodel.h> | |
44 | #include <memtester.h> |
|
44 | #include <memtester.h> | |
|
45 | #include <QSettings> | |||
45 |
|
46 | |||
46 | #if defined(SOCEXPLORER_SDK_BUILD) |
|
47 | #if defined(SOCEXPLORER_SDK_BUILD) | |
47 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT |
|
48 | # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT | |
@@ -83,6 +84,7 class SOCEXPLORER_SDK_EXPORT SocExplorer | |||||
83 | Q_OBJECT |
|
84 | Q_OBJECT | |
84 | private: |
|
85 | private: | |
85 | static SocExplorerEngine* _self; |
|
86 | static SocExplorerEngine* _self; | |
|
87 | static QSettings* m_settings; | |||
86 | SocExplorerEngine(QObject *parent = 0); |
|
88 | SocExplorerEngine(QObject *parent = 0); | |
87 | static void init(); |
|
89 | static void init(); | |
88 |
|
90 |
@@ -368,6 +368,11 int PythonQtWrapper_ElfFile::getSymbolC | |||||
368 | return ( theWrappedObject->getSymbolCount()); |
|
368 | return ( theWrappedObject->getSymbolCount()); | |
369 | } |
|
369 | } | |
370 |
|
370 | |||
|
371 | int PythonQtWrapper_ElfFile::getSymbolIndex(ElfFile* theWrappedObject, const QString& name) | |||
|
372 | { | |||
|
373 | return ( theWrappedObject->getSymbolIndex(name)); | |||
|
374 | } | |||
|
375 | ||||
371 | QString PythonQtWrapper_ElfFile::getSymbolLinkType(ElfFile* theWrappedObject, int index) |
|
376 | QString PythonQtWrapper_ElfFile::getSymbolLinkType(ElfFile* theWrappedObject, int index) | |
372 | { |
|
377 | { | |
373 | return ( theWrappedObject->getSymbolLinkType(index)); |
|
378 | return ( theWrappedObject->getSymbolLinkType(index)); |
@@ -121,6 +121,7 void delete_ElfFile(ElfFile* obj) { dele | |||||
121 | qint64 getSegmentVaddr(ElfFile* theWrappedObject, int index); |
|
121 | qint64 getSegmentVaddr(ElfFile* theWrappedObject, int index); | |
122 | quint64 getSymbolAddress(ElfFile* theWrappedObject, int index); |
|
122 | quint64 getSymbolAddress(ElfFile* theWrappedObject, int index); | |
123 | int getSymbolCount(ElfFile* theWrappedObject); |
|
123 | int getSymbolCount(ElfFile* theWrappedObject); | |
|
124 | int getSymbolIndex(ElfFile* theWrappedObject, const QString& name); | |||
124 | QString getSymbolLinkType(ElfFile* theWrappedObject, int index); |
|
125 | QString getSymbolLinkType(ElfFile* theWrappedObject, int index); | |
125 | QString getSymbolName(ElfFile* theWrappedObject, int index); |
|
126 | QString getSymbolName(ElfFile* theWrappedObject, int index); | |
126 | int getSymbolSectionIndex(ElfFile* theWrappedObject, int index); |
|
127 | int getSymbolSectionIndex(ElfFile* theWrappedObject, int index); |
@@ -29,61 +29,85 | |||||
29 | #include <QStyleFactory> |
|
29 | #include <QStyleFactory> | |
30 | #include <QStringList> |
|
30 | #include <QStringList> | |
31 | #include <QFile> |
|
31 | #include <QFile> | |
|
32 | #include <QCommandLineOption> | |||
|
33 | #include <QCommandLineParser> | |||
32 |
|
34 | |||
33 | void usage(); |
|
35 | ||
|
36 | QCommandLineOption executeOption = QCommandLineOption ( | |||
|
37 | QStringList() << "e" << "execute", | |||
|
38 | QCoreApplication::translate("main", "Execute given script <script>."), | |||
|
39 | QCoreApplication::translate("main", "script")); | |||
|
40 | ||||
|
41 | QCommandLineOption debugLevelOption = QCommandLineOption ( | |||
|
42 | QStringList() << "d" << "debug-level", | |||
|
43 | QCoreApplication::translate("main", "Execute given script <script>."), | |||
|
44 | QCoreApplication::translate("main", "script"), | |||
|
45 | "1"); | |||
|
46 | ||||
|
47 | QCommandLineOption noGUIOption = QCommandLineOption ( | |||
|
48 | QStringList() << "n" << "no-gui", | |||
|
49 | QCoreApplication::translate("main", "Starts SocExplorer in batch mode.")); | |||
|
50 | ||||
|
51 | const char* socexplorerDesc="\ | |||
|
52 | SocExplorer is an open source generic System On Chip testing software/framework.\ | |||
|
53 | We write this software for the development and the validation of our instrument,\ | |||
|
54 | the Low Frequency Receiver(LFR) for the Solar Orbiter mission. This instrument is\ | |||
|
55 | based on an actel FPGA hosting a LEON3FT processor and some peripherals. To make\ | |||
|
56 | it more collaborative, we use a plugin based system, the main executable is SocExplorer\ | |||
|
57 | then all the functionality are provided by plugins. Like this everybody can provide\ | |||
|
58 | his set of plugins to handle a new SOC or just a new peripheral. SocExplorer uses\ | |||
|
59 | PythonQt to allow user to automate some tasks such as loading some plugins, configuring\ | |||
|
60 | them and talking with his device. SocExplorer is provided under the terms of the GNU\ | |||
|
61 | General Public License as published by the Free Software Foundation; either version 2\ | |||
|
62 | of the License, or (at your option) any later version."; | |||
34 |
|
63 | |||
35 | int main(int argc, char *argv[]) |
|
64 | int main(int argc, char *argv[]) | |
36 | { |
|
65 | { | |
37 | QApplication a(argc, argv); |
|
66 | QApplication a(argc, argv); | |
38 | QString scriptToEval; |
|
67 | QString scriptToEval; | |
39 | QStringList args= a.arguments(); |
|
68 | QApplication::setOrganizationName("LPP"); | |
|
69 | QApplication::setOrganizationDomain("lpp.fr"); | |||
|
70 | QApplication::setApplicationName("SocExplorer"); | |||
|
71 | QCommandLineParser parser; | |||
|
72 | parser.setApplicationDescription(socexplorerDesc); | |||
|
73 | parser.addHelpOption(); | |||
|
74 | parser.addVersionOption(); | |||
40 | bool noGUI=false; |
|
75 | bool noGUI=false; | |
41 | for(int i=0;i<=args.count()-1;i++) |
|
76 | parser.addOption(executeOption); | |
|
77 | parser.addOption(debugLevelOption); | |||
|
78 | parser.addOption(noGUIOption); | |||
|
79 | parser.process(a); | |||
|
80 | if(parser.isSet(executeOption)) | |||
42 | { |
|
81 | { | |
43 | if(((args.at(i).compare("-e")==0) || (args.at(i).compare("--execute")==0)) && (i<(args.count()-1))) |
|
82 | scriptToEval = parser.value(executeOption); | |
|
83 | if(!QFile::exists(scriptToEval)) | |||
44 | { |
|
84 | { | |
45 |
scriptToEval |
|
85 | scriptToEval.clear(); | |
46 | if(!QFile::exists(scriptToEval)) |
|
|||
47 | { |
|
|||
48 | scriptToEval.clear(); |
|
|||
49 | } |
|
|||
50 | else |
|
|||
51 | qDebug() << "Will execute" << scriptToEval; |
|
|||
52 | break; |
|
|||
53 | } |
|
|||
54 | if(((args.at(i).compare("-d")==0) || (args.at(i).compare("--debug-level")==0)) && (i<(args.count()-1))) |
|
|||
55 | { |
|
|||
56 | bool success; |
|
|||
57 | int lvl; |
|
|||
58 | lvl = args.at(i+1).toInt(&success,10); |
|
|||
59 | if(success) |
|
|||
60 | { |
|
|||
61 | SocExplorerEngine::setLogLevel(lvl); |
|
|||
62 | } |
|
|||
63 | } |
|
|||
64 | if((args.at(i).compare("--no-gui")==0)) |
|
|||
65 | { |
|
|||
66 | noGUI = true; |
|
|||
67 | qDebug() << "CLI mode"; |
|
|||
68 | } |
|
86 | } | |
69 | } |
|
87 | } | |
70 |
|
88 | if(parser.isSet(debugLevelOption)) | ||
|
89 | { | |||
|
90 | bool success; | |||
|
91 | int lvl; | |||
|
92 | lvl = parser.value(debugLevelOption).toInt(&success,10); | |||
|
93 | if(success) | |||
|
94 | { | |||
|
95 | SocExplorerEngine::setLogLevel(lvl); | |||
|
96 | } | |||
|
97 | } | |||
|
98 | if(parser.isSet(noGUIOption)) | |||
|
99 | { | |||
|
100 | noGUI = true; | |||
|
101 | qDebug() << "CLI mode"; | |||
|
102 | } | |||
71 | SocExplorerMainWindow w(scriptToEval); |
|
103 | SocExplorerMainWindow w(scriptToEval); | |
72 | if(!noGUI) |
|
104 | if(!noGUI) | |
73 |
|
|
105 | { | |
74 |
|
||||
75 | w.show(); |
|
106 | w.show(); | |
76 |
|
|
107 | } | |
77 | else |
|
108 | else | |
78 |
|
|
109 | { | |
79 |
|
110 | |||
80 |
|
|
111 | } | |
81 | return a.exec(); |
|
112 | return a.exec(); | |
82 | } |
|
113 | } | |
83 |
|
||||
84 |
|
||||
85 | void usage() |
|
|||
86 | { |
|
|||
87 | // TODO respect usual Linux Cli interface, socexplore [OPTION]...FILES... |
|
|||
88 | // TODO write an usage helper. |
|
|||
89 | } |
|
@@ -1,6 +1,6 | |||||
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-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 | |
@@ -21,6 +21,8 | |||||
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "mainwindow.h" |
|
22 | #include "mainwindow.h" | |
23 | #include <QDockWidget> |
|
23 | #include <QDockWidget> | |
|
24 | #include <socexplorersettings.h> | |||
|
25 | #include <socexplorerconfigkeys.h> | |||
24 |
|
26 | |||
25 | SocExplorerMainWindow::SocExplorerMainWindow(QString ScriptToEval, QWidget *parent) |
|
27 | SocExplorerMainWindow::SocExplorerMainWindow(QString ScriptToEval, QWidget *parent) | |
26 | : QMainWindow(parent) |
|
28 | : QMainWindow(parent) | |
@@ -31,6 +33,8 SocExplorerMainWindow::SocExplorerMainWi | |||||
31 | this->makeObjects(ScriptToEval); |
|
33 | this->makeObjects(ScriptToEval); | |
32 | this->makeLayout(); |
|
34 | this->makeLayout(); | |
33 | this->makeMenu(); |
|
35 | this->makeMenu(); | |
|
36 | SocExplorerSettings::init(); | |||
|
37 | SocExplorerSettings::loadSession("Session1"); | |||
34 | this->makeConnections(); |
|
38 | this->makeConnections(); | |
35 | this->setWindowIcon(QIcon(":/images/icon.png")); |
|
39 | this->setWindowIcon(QIcon(":/images/icon.png")); | |
36 | this->setAcceptDrops(true); |
|
40 | this->setAcceptDrops(true); | |
@@ -150,6 +154,9 void SocExplorerMainWindow::clearMenu() | |||||
150 | void SocExplorerMainWindow::makeMenu() |
|
154 | void SocExplorerMainWindow::makeMenu() | |
151 | { |
|
155 | { | |
152 | this->FileMenu = menuBar()->addMenu(tr("&File")); |
|
156 | this->FileMenu = menuBar()->addMenu(tr("&File")); | |
|
157 | this->SessionsMenu = this->FileMenu->addMenu(tr("&Sessions")); | |||
|
158 | this->SettingsMenu = menuBar()->addMenu(tr("&Settings")); | |||
|
159 | SocExplorerGUI::registerMenuBar(menuBar(),this->FileMenu,this->SettingsMenu); | |||
153 | this->PluginsMenu = menuBar()->addMenu(tr("&Plugins")); |
|
160 | this->PluginsMenu = menuBar()->addMenu(tr("&Plugins")); | |
154 | this->ToolsMenu = menuBar()->addMenu(tr("&Tools")); |
|
161 | this->ToolsMenu = menuBar()->addMenu(tr("&Tools")); | |
155 | this->ToolsMenu->addAction(this->exploreRegs); |
|
162 | this->ToolsMenu->addAction(this->exploreRegs); | |
@@ -163,9 +170,26 void SocExplorerMainWindow::makeMenu() | |||||
163 |
|
170 | |||
164 | } |
|
171 | } | |
165 |
|
172 | |||
|
173 | void SocExplorerMainWindow::loadSessions() | |||
|
174 | { | |||
|
175 | // QStringList sessions = SocExplorerSettings::value(); | |||
|
176 | QList<QList<QVariant> > sessions = SocExplorerSettings::arrays(SOCEXPLORERGLOBAL_SETTINGS_SESSIONS_SCOPE,QStringList()<<SOCEXPLORERGLOBAL_SETTINGS_SESSIONS_NAME); | |||
|
177 | p_Sessions.clear(); | |||
|
178 | for(int i=0;i<sessions.count();i++) | |||
|
179 | { | |||
|
180 | if(sessions.at(i).count()>=1) | |||
|
181 | { | |||
|
182 | p_Sessions.append(sessions.at(i).at(0).toString()); | |||
|
183 | } | |||
|
184 | } | |||
|
185 | ||||
|
186 | } | |||
|
187 | ||||
166 |
|
188 | |||
167 | SocExplorerMainWindow::~SocExplorerMainWindow() |
|
189 | SocExplorerMainWindow::~SocExplorerMainWindow() | |
168 | { |
|
190 | { | |
|
191 | SocExplorerSettings::setValue("GLOBAL","LastModified",QDate::currentDate().toString(),SocExplorerSettings::Session); | |||
|
192 | SocExplorerSettings::sync(); | |||
169 | } |
|
193 | } | |
170 |
|
194 | |||
171 |
|
195 |
@@ -38,6 +38,7 | |||||
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 |
|
42 | |||
42 | class SocExplorerMainWindow : public QMainWindow |
|
43 | class SocExplorerMainWindow : public QMainWindow | |
43 | { |
|
44 | { | |
@@ -48,7 +49,7 public: | |||||
48 | ~SocExplorerMainWindow(); |
|
49 | ~SocExplorerMainWindow(); | |
49 | QAction* Quit,*LoadPlugin,*ManagePlugins,*help,*regsManager,*exploreRegs,*about,*translateAction; |
|
50 | QAction* Quit,*LoadPlugin,*ManagePlugins,*help,*regsManager,*exploreRegs,*about,*translateAction; | |
50 | QActionGroup*langActionGrp; |
|
51 | QActionGroup*langActionGrp; | |
51 | QMenu* FileMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu; |
|
52 | QMenu* FileMenu,*SettingsMenu,*PluginsMenu,*ToolsMenu,*langMenu,*helpMenu,*SessionsMenu; | |
52 | QTranslator* appTranslator; |
|
53 | QTranslator* appTranslator; | |
53 | void createLangMenu(); |
|
54 | void createLangMenu(); | |
54 | void closeEvent(QCloseEvent *event); |
|
55 | void closeEvent(QCloseEvent *event); | |
@@ -74,6 +75,7 private: | |||||
74 | void makeLayout(); |
|
75 | void makeLayout(); | |
75 | void makeConnections(); |
|
76 | void makeConnections(); | |
76 | void makeMenu(); |
|
77 | void makeMenu(); | |
|
78 | void loadSessions(); | |||
77 | QMainWindow* pluginsDockContainer; |
|
79 | QMainWindow* pluginsDockContainer; | |
78 | QSplitter* mainWidget; |
|
80 | QSplitter* mainWidget; | |
79 | PythonConsole* PythonConsoleInst; |
|
81 | PythonConsole* PythonConsoleInst; | |
@@ -81,6 +83,7 private: | |||||
81 | RegsExplorer* regExplorer; |
|
83 | RegsExplorer* regExplorer; | |
82 | aboutsocexplorer* p_about; |
|
84 | aboutsocexplorer* p_about; | |
83 | QList<QDockWidget*>* p_pluginGUIlist; |
|
85 | QList<QDockWidget*>* p_pluginGUIlist; | |
|
86 | QStringList p_Sessions; | |||
84 | }; |
|
87 | }; | |
85 |
|
88 | |||
86 | #endif // MAINWINDOW_H |
|
89 | #endif // MAINWINDOW_H |
@@ -73,7 +73,8 SOURCES += main.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 |
|
78 | |||
78 | HEADERS += mainwindow.h \ |
|
79 | HEADERS += mainwindow.h \ | |
79 | PyWdgt/pythonconsole.h \ |
|
80 | PyWdgt/pythonconsole.h \ | |
@@ -84,7 +85,8 HEADERS += mainwindow.h \ | |||||
84 | socexplorer.h \ |
|
85 | socexplorer.h \ | |
85 | SocExplorerEngine/plugins/socexplorerplugin.h \ |
|
86 | SocExplorerEngine/plugins/socexplorerplugin.h \ | |
86 | aboutsocexplorer.h \ |
|
87 | aboutsocexplorer.h \ | |
87 | regsExplorer/regsexplorer.h |
|
88 | regsExplorer/regsexplorer.h \ | |
|
89 | socexplorercoresettingsgui.h | |||
88 |
|
90 | |||
89 |
|
91 | |||
90 | include ( NicePyConsole/NicePyConsole.pri) |
|
92 | include ( NicePyConsole/NicePyConsole.pri) | |
@@ -101,7 +103,8 TRANSLATIONS = ../translations/socexplor | |||||
101 | ../translations/socexplorer_en.ts |
|
103 | ../translations/socexplorer_en.ts | |
102 |
|
104 | |||
103 | FORMS += \ |
|
105 | FORMS += \ | |
104 | regsExplorer/regsexplorernew.ui |
|
106 | regsExplorer/regsexplorernew.ui \ | |
|
107 | socexplorercoresettingsgui.ui | |||
105 |
|
108 | |||
106 | DISTFILES += \ |
|
109 | DISTFILES += \ | |
107 | ../doc/PythonExamples/LEON3_LOAD.py \ |
|
110 | ../doc/PythonExamples/LEON3_LOAD.py \ |
General Comments 0
You need to be logged in to leave comments.
Login now