diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,4 +1,4 @@ 1cb664ab4bb3c531d706b1948a378ed9810c0dda src/SocExplorerEngine/PeripheralWidget 1f143e4ae72a0bb4832b546eb76eb50e94049b80 src/common/genericBinaryFiles -2dce25b198558be573f56c1cf337aa95ddd666d6 src/common/lppserial +2b353bf8243cbfb3db44e196f33bd164c11c9949 src/common/lppserial 923afde9cc96bb419cf898560d080ec96991aeca src/common/qhexedit diff --git a/src/SocExplorerEngine/SocExplorerEngine.pro b/src/SocExplorerEngine/SocExplorerEngine.pro --- a/src/SocExplorerEngine/SocExplorerEngine.pro +++ b/src/SocExplorerEngine/SocExplorerEngine.pro @@ -67,7 +67,11 @@ header.files = engine/socexplorerengine. PeripheralWidget/src/registerwidget.h \ PeripheralWidget/src/socregsviewer.h \ PeripheralWidget/src/socregsviewernew.h \ - memtester/memtester.h + memtester/memtester.h \ + engine/socexplorersettings.h \ + engine/socexplorersettingsdialog.h \ + engine/socexplorergui.h\ + engine/socexplorerconfigkeys.h @@ -125,7 +129,11 @@ HEADERS += \ PySocExplorerEngine.h \ memtester/memtester.h\ PeripheralWidget/src/socregsviewernew.h \ - PeripheralWidget/src/collapsableperipheralwidget.h + PeripheralWidget/src/collapsableperipheralwidget.h \ + engine/socexplorersettings.h \ + engine/socexplorersettingsdialog.h \ + engine/socexplorergui.h \ + engine/socexplorerconfigkeys.h @@ -155,7 +163,10 @@ SOURCES += \ plugins/socexplorerplugin.cpp \ memtester/memtester.cpp \ PeripheralWidget/src/socregsviewernew.cpp \ - PeripheralWidget/src/collapsableperipheralwidget.cpp + PeripheralWidget/src/collapsableperipheralwidget.cpp \ + engine/socexplorersettings.cpp \ + engine/socexplorersettingsdialog.cpp \ + engine/socexplorergui.cpp OTHER_FILES += \ @@ -167,7 +178,8 @@ OTHER_FILES += \ FORMS += \ PeripheralWidget/src/socregsviewernew.ui \ - PeripheralWidget/src/collapsableperipheralwidget.ui + PeripheralWidget/src/collapsableperipheralwidget.ui \ + engine/socexplorersettingsdialog.ui RESOURCES += \ diff --git a/src/SocExplorerEngine/engine/socexplorerconfigkeys.h b/src/SocExplorerEngine/engine/socexplorerconfigkeys.h new file mode 100644 --- /dev/null +++ b/src/SocExplorerEngine/engine/socexplorerconfigkeys.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2012, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@lpp.polytechnique.fr +----------------------------------------------------------------------------*/ +#ifndef SOCEXPLORERCONFIGKEYS +#define SOCEXPLORERCONFIGKEYS + +#define SOCEXPLORERENGINE_SETTINGS_SCOPE "SocExplorerEngine" +#define SOCEXPLORERENGINE_SETTINGS_PLUGINS_LOOKUP_PATH "plugins-lookup-path" +#define SOCEXPLORERENGINE_SETTINGS_SOC_REGS_LOOKUP_PATH "soc-registers-lookup-path" + +#define SOCEXPLORERGLOBAL_SETTINGS_SCOPE "GLOBAL" +#define SOCEXPLORERGLOBAL_SETTINGS_SESSIONS_SCOPE "SESSIONS" +#define SOCEXPLORERGLOBAL_SETTINGS_SESSIONS_NAME "NAME" + +#endif // SOCEXPLORERCONFIGKEYS + diff --git a/src/SocExplorerEngine/engine/socexplorerengine.cpp b/src/SocExplorerEngine/engine/socexplorerengine.cpp --- a/src/SocExplorerEngine/engine/socexplorerengine.cpp +++ b/src/SocExplorerEngine/engine/socexplorerengine.cpp @@ -21,13 +21,18 @@ ----------------------------------------------------------------------------*/ #include "socexplorerengine.h" #include +#include +#include +#include SocExplorerEngine* SocExplorerEngine::_self = NULL; socExplorerXmlModel* SocExplorerEngine::p_xmlmodel=NULL; QMainWindow* SocExplorerEngine::mainWindow=NULL; QList* SocExplorerEngine::SOCs=NULL; +QSettings* SocExplorerEngine::m_settings=NULL; int SocExplorerEngine::loglvl=1; + SocExplorerEngine::SocExplorerEngine(QObject *parent) : QObject(parent) { @@ -35,7 +40,9 @@ SocExplorerEngine::SocExplorerEngine(QOb { SOCs = new QList; } - + m_settings = new QSettings(); + SocExplorerCoreSettingsGUI* cfggui=new SocExplorerCoreSettingsGUI(); + SocExplorerSettings::registerConfigEntry(cfggui,QIcon(":/images/config.svg"),"SocExplorer Core"); } @@ -88,6 +95,14 @@ QStringList SocExplorerEngine::pluginFol } } } + QStringList localCfg = SocExplorerSettings::value(SOCEXPLORERENGINE_SETTINGS_SCOPE,SOCEXPLORERENGINE_SETTINGS_PLUGINS_LOOKUP_PATH).toString().split(";"); + QString dir; + foreach (dir, localCfg) + { + QDir plugDir(dir); + if(plugDir.exists()) + folders.append(dir); + } return folders; } diff --git a/src/SocExplorerEngine/engine/socexplorerengine.h b/src/SocExplorerEngine/engine/socexplorerengine.h --- a/src/SocExplorerEngine/engine/socexplorerengine.h +++ b/src/SocExplorerEngine/engine/socexplorerengine.h @@ -42,6 +42,7 @@ #include #include #include +#include #if defined(SOCEXPLORER_SDK_BUILD) # define SOCEXPLORER_SDK_EXPORT Q_DECL_EXPORT @@ -83,6 +84,7 @@ class SOCEXPLORER_SDK_EXPORT SocExplorer Q_OBJECT private: static SocExplorerEngine* _self; + static QSettings* m_settings; SocExplorerEngine(QObject *parent = 0); static void init(); diff --git a/src/SocExplorerEngine/engine/socexplorergui.cpp b/src/SocExplorerEngine/engine/socexplorergui.cpp new file mode 100644 --- /dev/null +++ b/src/SocExplorerEngine/engine/socexplorergui.cpp @@ -0,0 +1,93 @@ +#include "socexplorergui.h" + +SocExplorerGUI* SocExplorerGUI::_self=NULL; +QMenuBar* SocExplorerGUI::m_mainMenuBar=NULL; +QMenu* SocExplorerGUI::m_fileMenu=NULL; +QMenu* SocExplorerGUI::m_SettingsMenu=NULL; +QList* SocExplorerGUI::m_queuedSettingActions=NULL; +QList* SocExplorerGUI::m_queuedFileMenuActions=NULL; + +#define INIT() \ + if(Q_UNLIKELY(_self==NULL))\ + {\ + init();\ + } + +SocExplorerGUI::SocExplorerGUI(QObject *parent) : QObject(parent) +{ + m_queuedFileMenuActions = new QList(); + m_queuedSettingActions = new QList(); +} + +void SocExplorerGUI::init() +{ + _self=new SocExplorerGUI(); +} + +void SocExplorerGUI::registerMenuBar(QMenuBar *menuBar, QMenu *fileMenu, QMenu *SettingsMenu) +{ + INIT(); + m_mainMenuBar = menuBar; + if(m_mainMenuBar) + { + if(fileMenu==NULL) + m_fileMenu = m_mainMenuBar->addMenu(tr("File")); + else + m_fileMenu = fileMenu; + if(SettingsMenu==NULL) + m_SettingsMenu = m_mainMenuBar->addMenu(tr("Settings")); + else + m_SettingsMenu = SettingsMenu; + } + + QAction* action; + foreach (action, *m_queuedSettingActions) + { + m_SettingsMenu->addAction(action); + } + foreach (action, *m_queuedFileMenuActions) + { + m_fileMenu->addAction(action); + } +} + +QMenu *SocExplorerGUI::addMenu(const QString &title) +{ + INIT(); + if(m_mainMenuBar) + { + return m_mainMenuBar->addMenu(title); + } + return NULL; +} + +bool SocExplorerGUI::addFileAction(QAction *action) +{ + INIT(); + if(m_fileMenu) + { + m_fileMenu->addAction(action); + return true; + } + else + { + m_queuedFileMenuActions->append(action); + } + return false; +} + +bool SocExplorerGUI::addSettingsAction(QAction *action) +{ + INIT(); + if(m_SettingsMenu) + { + m_SettingsMenu->addAction(action); + return true; + } + else + { + m_queuedSettingActions->append(action); + } + return false; +} + diff --git a/src/SocExplorerEngine/engine/socexplorergui.h b/src/SocExplorerEngine/engine/socexplorergui.h new file mode 100644 --- /dev/null +++ b/src/SocExplorerEngine/engine/socexplorergui.h @@ -0,0 +1,32 @@ +#ifndef SOCEXPLORERGUI_H +#define SOCEXPLORERGUI_H + +#include +#include +#include +#include +#include + +class SocExplorerGUI : public QObject +{ + Q_OBJECT + static SocExplorerGUI* _self; + static QMenuBar* m_mainMenuBar; + static QMenu* m_fileMenu; + static QMenu* m_SettingsMenu; + static QList* m_queuedSettingActions; + static QList* m_queuedFileMenuActions; + SocExplorerGUI(QObject *parent = 0); + static void init(); +public: + static SocExplorerGUI* self(){ if(!_self){_self= new SocExplorerGUI;}return _self;} + static void registerMenuBar(QMenuBar* menuBar, QMenu* fileMenu=NULL, QMenu* SettingsMenu=NULL); + static QMenu* addMenu(const QString & title); + static bool addFileAction(QAction * action); + static bool addSettingsAction(QAction * action); +signals: + +public slots: +}; + +#endif // SOCEXPLORERGUI_H diff --git a/src/SocExplorerEngine/engine/socexplorersettings.cpp b/src/SocExplorerEngine/engine/socexplorersettings.cpp new file mode 100644 --- /dev/null +++ b/src/SocExplorerEngine/engine/socexplorersettings.cpp @@ -0,0 +1,205 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2012, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@lpp.polytechnique.fr +----------------------------------------------------------------------------*/ +#include "socexplorersettings.h" + +SocExplorerSettings* SocExplorerSettings::_self=NULL; +QSettings* SocExplorerSettings::m_settings=NULL; +QSettings* SocExplorerSettings::m_sessionSettings=NULL; +SocExplorerSettingsDialog* SocExplorerSettings::m_configDialog = NULL; +#include +#include +#include +#include +#include + +#define INIT() \ + if(Q_UNLIKELY(_self==NULL))\ +{\ + init();\ + } + + +SocExplorerSettings::SocExplorerSettings(QObject *parent) : QObject(parent) +{ + m_settings = new QSettings(); + m_configDialog = new SocExplorerSettingsDialog(); + QAction* trigerGUI = new QAction(tr("Settings"),this); + connect(trigerGUI,SIGNAL(triggered()),this,SLOT(popConfigDialog())); + SocExplorerGUI::addSettingsAction(trigerGUI); +} + +SocExplorerSettings::~SocExplorerSettings() +{ + if(m_settings) + { + m_settings->sync(); + delete m_settings; + } + if(m_sessionSettings) + { + m_sessionSettings->sync(); + delete m_sessionSettings; + } +} + +void SocExplorerSettings::init() +{ + if(!_self) + { + _self= new SocExplorerSettings(); + } +} + +void SocExplorerSettings::setValue(QObject *object, const QString &key, const QVariant &value, SettingScope Sscope) +{ + INIT(); + setValue(object->metaObject()->className(),key,value,Sscope); +} + +QVariant SocExplorerSettings::value(QObject *object, const QString &key, const QVariant &defaultValue, SettingScope Sscope) +{ + INIT(); + return value(object->metaObject()->className(),key,defaultValue,Sscope); +} + +void SocExplorerSettings::setValue(const QString scope, const QString &key, const QVariant &value, SettingScope Sscope) +{ + INIT(); + switch (Sscope) + { + case SystemWide: + if(m_settings) + m_settings->setValue(scope+"/"+key,value); + break; + case Session: + if(m_sessionSettings) + m_sessionSettings->setValue(scope+"/"+key,value); + break; + default: + break; + } +} + +QVariant SocExplorerSettings::value(const QString scope, const QString &key, const QVariant &defaultValue, SettingScope Sscope) +{ + INIT(); + switch (Sscope) + { + case SystemWide: + if(m_settings) + return m_settings->value(scope+"/"+key,defaultValue); + break; + case Session: + if(m_sessionSettings) + return m_sessionSettings->value(scope+"/"+key,defaultValue); + break; + default: + break; + } + return defaultValue; +} + +QList > SocExplorerSettings::arrays(const QString &prefix, QStringList keys, SocExplorerSettings::SettingScope Sscope) +{ + INIT(); + QList > defaultValue; + switch (Sscope) + { + case SystemWide: + if(m_settings) + return arrays(prefix,keys,m_settings); + break; + case Session: + if(m_sessionSettings) + return arrays(prefix,keys,m_sessionSettings); + break; + default: + break; + } + return defaultValue; +} + +void SocExplorerSettings::sync() +{ + INIT(); + if(m_settings) + { + m_settings->sync(); + } + if(m_sessionSettings) + { + m_sessionSettings->sync(); + } +} + +bool SocExplorerSettings::registerConfigEntry(SocExplorerSettingsItem *configEntry, QIcon icon, QString text) +{ + INIT(); + return m_configDialog->registerConfigEntry(configEntry,icon,text); +} + +bool SocExplorerSettings::loadSession(const QString &session) +{ + INIT(); + QFileInfo sessionInfo(m_settings->fileName()); + QString fullpath=sessionInfo.absoluteDir().absolutePath() +"/"+session+".conf"; + if(m_sessionSettings) + { + delete m_sessionSettings; + m_sessionSettings = NULL; + } + m_sessionSettings = new QSettings(fullpath,QSettings::NativeFormat,self()); + qDebug()<< m_sessionSettings->fileName(); + if(m_sessionSettings->status()==QSettings::NoError) + { + return true; + } + delete m_sessionSettings; + m_sessionSettings = NULL; + return false; +} + +void SocExplorerSettings::popConfigDialog() +{ + m_configDialog->popConfigDialog(NULL); +} + +QList > SocExplorerSettings::arrays(const QString &prefix, QStringList keys, QSettings *settings) +{ + QList > result; + if(settings) + { + int size = settings->beginReadArray(prefix); + for (int i = 0; i < size; ++i) + { + result.append(QList()); + settings->setArrayIndex(i); + for(int l=0;lvalue(keys.at(i))); + } + } + settings->endArray(); + } + return result; +} + diff --git a/src/SocExplorerEngine/engine/socexplorersettings.h b/src/SocExplorerEngine/engine/socexplorersettings.h new file mode 100644 --- /dev/null +++ b/src/SocExplorerEngine/engine/socexplorersettings.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2012, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@lpp.polytechnique.fr +----------------------------------------------------------------------------*/ +#ifndef SOCEXPLORERSETTINGS_H +#define SOCEXPLORERSETTINGS_H + +#include +#include +#include +#include + +class SocExplorerSettings : public QObject +{ + Q_OBJECT +private: + static SocExplorerSettings* _self; + static QSettings* m_settings; + static QSettings* m_sessionSettings; + static SocExplorerSettingsDialog* m_configDialog; + SocExplorerSettings(QObject *parent = 0); + ~SocExplorerSettings(); +public: + enum SettingScope { + SystemWide = 0, + Session + }; + static void init(); + static SocExplorerSettings* self(){ if(!_self){_self= new SocExplorerSettings;}return _self;} + static void setValue(QObject* object,const QString & key, const QVariant & value,SettingScope Sscope =SystemWide); + static QVariant value(QObject* object, const QString & key, const QVariant & defaultValue = QVariant(),SettingScope Sscope=SystemWide); + static void setValue(const QString scope,const QString & key, const QVariant & value,SettingScope Sscope= SystemWide); + static QVariant value(const QString scope, const QString & key, const QVariant & defaultValue = QVariant(),SettingScope Sscope =SystemWide); + static QList > arrays(const QString & prefix, QStringList keys,SettingScope Sscope =SystemWide); + static void sync(); + static bool registerConfigEntry(SocExplorerSettingsItem* configEntry,QIcon icon, QString text); + //! Loads the given session, or sreate it if doesn't exists. + //! \param session Session name. + //! \return true if success or false if fails to create session config file. + static bool loadSession(const QString& session); +signals: + +public slots: + void popConfigDialog(); +private: + static QList > arrays(const QString & prefix, QStringList keys,QSettings* settings); +}; + +#endif // SOCEXPLORERSETTINGS_H diff --git a/src/SocExplorerEngine/engine/socexplorersettingsdialog.cpp b/src/SocExplorerEngine/engine/socexplorersettingsdialog.cpp new file mode 100644 --- /dev/null +++ b/src/SocExplorerEngine/engine/socexplorersettingsdialog.cpp @@ -0,0 +1,69 @@ +#include "socexplorersettingsdialog.h" +#include "ui_socexplorersettingsdialog.h" + +SocExplorerSettingsDialog::SocExplorerSettingsDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::SocExplorerSettingsDialog) +{ + ui->setupUi(this); + connect(ui->contentsWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*))); + ui->contentsWidget->setViewMode(QListView::IconMode); + ui->contentsWidget->setIconSize(QSize(96, 84)); + ui->contentsWidget->setMovement(QListView::Static); + ui->contentsWidget->setSpacing(12); +} + +SocExplorerSettingsDialog::~SocExplorerSettingsDialog() +{ + delete ui; +} + +void SocExplorerSettingsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous) +{ + if (!current) + current = previous; + ui->pagesWidget->setCurrentIndex(ui->contentsWidget->row(current)); +} + +bool SocExplorerSettingsDialog::registerConfigEntry(SocExplorerSettingsItem *configEntry, QIcon icon, QString text) +{ + if(configEntry!=NULL) + { + ui->pagesWidget->addWidget(configEntry); + QListWidgetItem *configButton = new QListWidgetItem(ui->contentsWidget); + configButton->setIcon(icon); + configButton->setText(text); + configButton->setTextAlignment(Qt::AlignHCenter); + configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + connect(this,SIGNAL(accepted()),configEntry,SLOT(accept())); + return true; + } + return false; +} + +void SocExplorerSettingsDialog::popConfigDialog(SocExplorerSettingsItem *selectedConfigEntry) +{ + if(selectedConfigEntry!=NULL) + { + for(int i=0;ipagesWidget->count();i++) + { + if(ui->pagesWidget->widget(i)==selectedConfigEntry) + { + ui->pagesWidget->setCurrentIndex(i); + } + } + } + this->show(); +} + +void SocExplorerSettingsDialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/SocExplorerEngine/engine/socexplorersettingsdialog.h b/src/SocExplorerEngine/engine/socexplorersettingsdialog.h new file mode 100644 --- /dev/null +++ b/src/SocExplorerEngine/engine/socexplorersettingsdialog.h @@ -0,0 +1,41 @@ +#ifndef SOCEXPLORERSETTINGSDIALOG_H +#define SOCEXPLORERSETTINGSDIALOG_H + +#include + +namespace Ui { +class SocExplorerSettingsDialog; +} +#include + +class SocExplorerSettingsItem : public QWidget +{ + Q_OBJECT +public: + SocExplorerSettingsItem(QWidget *parent = 0):QWidget(parent) {} + ~SocExplorerSettingsItem() {} +public slots: + virtual void accept()=0; +}; + +class SocExplorerSettingsDialog : public QDialog +{ + Q_OBJECT + +public: + explicit SocExplorerSettingsDialog(QWidget *parent = 0); + ~SocExplorerSettingsDialog(); + +public slots: + void changePage(QListWidgetItem *current, QListWidgetItem *previous); + bool registerConfigEntry(SocExplorerSettingsItem* configEntry, QIcon icon, QString text); + void popConfigDialog(SocExplorerSettingsItem* selectedConfigEntry=0); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::SocExplorerSettingsDialog *ui; +}; + +#endif // SOCEXPLORERSETTINGSDIALOG_H diff --git a/src/SocExplorerEngine/engine/socexplorersettingsdialog.ui b/src/SocExplorerEngine/engine/socexplorersettingsdialog.ui new file mode 100644 --- /dev/null +++ b/src/SocExplorerEngine/engine/socexplorersettingsdialog.ui @@ -0,0 +1,102 @@ + + + SocExplorerSettingsDialog + + + + 0 + 0 + 555 + 329 + + + + Dialog + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + SocExplorerSettingsDialog + accept() + + + 277 + 304 + + + 277 + 164 + + + + + buttonBox + rejected() + SocExplorerSettingsDialog + reject() + + + 277 + 304 + + + 277 + 164 + + + + + diff --git a/src/common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer0.cpp b/src/common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer0.cpp --- a/src/common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer0.cpp +++ b/src/common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer0.cpp @@ -368,6 +368,11 @@ int PythonQtWrapper_ElfFile::getSymbolC return ( theWrappedObject->getSymbolCount()); } +int PythonQtWrapper_ElfFile::getSymbolIndex(ElfFile* theWrappedObject, const QString& name) +{ + return ( theWrappedObject->getSymbolIndex(name)); +} + QString PythonQtWrapper_ElfFile::getSymbolLinkType(ElfFile* theWrappedObject, int index) { return ( theWrappedObject->getSymbolLinkType(index)); diff --git a/src/common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer0.h b/src/common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer0.h --- a/src/common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer0.h +++ b/src/common/pythonQtOut/generated_cpp/PySocExplorer/PySocExplorer0.h @@ -121,6 +121,7 @@ void delete_ElfFile(ElfFile* obj) { dele qint64 getSegmentVaddr(ElfFile* theWrappedObject, int index); quint64 getSymbolAddress(ElfFile* theWrappedObject, int index); int getSymbolCount(ElfFile* theWrappedObject); + int getSymbolIndex(ElfFile* theWrappedObject, const QString& name); QString getSymbolLinkType(ElfFile* theWrappedObject, int index); QString getSymbolName(ElfFile* theWrappedObject, int index); int getSymbolSectionIndex(ElfFile* theWrappedObject, int index); diff --git a/src/main.cpp b/src/main.cpp --- a/src/main.cpp +++ b/src/main.cpp @@ -29,61 +29,85 @@ #include #include #include +#include +#include -void usage(); + +QCommandLineOption executeOption = QCommandLineOption ( + QStringList() << "e" << "execute", + QCoreApplication::translate("main", "Execute given script