##// END OF EJS Templates
Better proxy support Wip....
Better proxy support Wip. Started centralised settings engine with GUI. Added QLopGUI engine to interact with QLop main window.

File last commit:

r15:b90d69939be9 default
r15:b90d69939be9 default
Show More
qlopsettings.cpp
98 lines | 2.8 KiB | text/x-c | CppLexer
/ src / Core / qlopsettings.cpp
Better proxy support Wip....
r15 /*------------------------------------------------------------------------------
-- This file is a part of the QLop Software
-- Copyright (C) 2015, 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@member.fsf.org
----------------------------------------------------------------------------*/
#include "qlopsettings.h"
#include <QtWidgets>
#include <QAction>
#include <qlopgui.h>
QLopSettings* QLopSettings::_self=NULL;
QDockWidget* QLopSettings::m_gui=NULL;
QSettings* QLopSettings::m_settings=NULL;
QLopSettingsDialog* QLopSettings::m_configDialog=NULL;
#define INIT() \
if(Q_UNLIKELY(_self==NULL))\
{\
init();\
}
QLopSettings::QLopSettings(bool noGUI,QObject *parent) : QLopService(parent)
{
m_serviceName="QLopSettings";
m_settings = new QSettings();
m_noGui=noGUI;
m_configDialog = new QLopSettingsDialog();
QAction* trigerGUI = new QAction(tr("Settings"),this);
connect(trigerGUI,SIGNAL(triggered()),this,SLOT(popConfigDialog()));
QLopGUI::addSettingsAction(trigerGUI);
}
QLopSettings::~QLopSettings()
{
delete m_configDialog;
delete m_settings;
}
QDockWidget *QLopSettings::getGUI()
{
if(!m_noGui && (m_gui==NULL))
{
// m_gui=new QLopDataBaseViewer();
// m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
}
return m_gui;
}
void QLopSettings::init(bool noGUI, QObject *parent)
{
_self=new QLopSettings(noGUI,parent);
}
const QString &QLopSettings::serviceName()
{
INIT();
return m_serviceName;
}
QLopSettings *QLopSettings::self()
{
INIT();
return _self;
}
void QLopSettings::popConfigDialog(QWidget *selectedConfigEntry)
{
INIT();
m_configDialog->popConfigDialog(selectedConfigEntry);
}
void QLopSettings::popConfigDialog()
{
m_configDialog->popConfigDialog(NULL);
}
bool QLopSettings::registerConfigEntry(QWidget *configEntry, QIcon icon, QString text)
{
INIT();
return m_configDialog->registerConfigEntry(configEntry, icon, text);
}