Commit c53d3b17 authored by Clement CHAVANCE's avatar Clement CHAVANCE Committed by Vincent Carrubba
Browse files

removed the method that assigned an int to a settings object.

For now, there will be only one map for the settings
parent 89d7c059
......@@ -21,6 +21,7 @@
*****************************************************************************/
#include <QHash>
#include <QDomElement>
#include "SettingsManager.h"
......@@ -30,8 +31,8 @@ int SettingsManager::createNewSettings()
return this->m_settings.size() - 1;
}
SettingsManager::SettingsManager( QObject* parent )
: QObject( parent )
SettingsManager::SettingsManager( QObject* parent )
: QObject( parent )
{
}
......@@ -39,12 +40,6 @@ SettingsManager::~SettingsManager()
{
}
void SettingsManager::saveSettings( QDomDocument& xmlfile, int index )
void SettingsManager::saveSettings( QDomDocument& xmlfile, QDomElement& root )
{
Q_UNUSED( xmlfile )
SettingsContainer* settings = m_settings[index];
settings->lock.lockForRead();
//SAVE SETTINGS TO DomDocument
settings->lock.unlock();
}
......@@ -33,31 +33,26 @@
#include "QSingleton.hpp"
struct SettingsContainer
{
QReadWriteLock lock;
QHash<QString, QVariant> settings;
};
class SettingsManager : public QObject, public QSingleton<SettingsManager>
{
//Q_OBJECT
//
Q_OBJECT
friend class QSingleton<SettingsManager>;
public:
int createNewSettings();
void setValues( QHash<QString, QVariant>, int index );
void setValue( const QString& key, QVariant& value, int index );
void setValues( QHash<QString, QVariant> );
void setValue( const QString& key, QVariant& value );
QVariant& getValue( const QString& key );
private:
SettingsManager( QObject* parent = 0 );
~SettingsManager();
QVector<SettingsContainer*> m_settings;
QHash<QString, QVariant> m_data;
QReadWriteLock m_lock;
public slots:
void saveSettings( QDomDocument& xmlfile, int index );
void saveSettings( QDomDocument& xmlfile, QDomElement& root );
};
......
......@@ -38,7 +38,7 @@
Settings::Settings( QWidget* parent, Qt::WindowFlags f )
: QDialog( parent, f ),
: QDialog( parent, f ),
m_currentWidget( NULL )
{
m_panel = new Panel( this );
......@@ -50,7 +50,6 @@ Settings::Settings( QWidget* parent, Qt::WindowFlags f )
SIGNAL( widgetSwitched( int ) ),
m_stackedWidgets,
SLOT( setCurrentIndex( int ) ));
m_settingsNumber = SettingsManager::getInstance()->createNewSettings();
}
Settings::~Settings()
......
......@@ -65,8 +65,6 @@ class Settings : public QDialog
QDialogButtonBox* m_buttons;
bool m_saved;
int m_settingsNumber;
public slots:
void switchWidget( int widget );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment