Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
f8518822
Commit
f8518822
authored
Sep 24, 2009
by
Clement CHAVANCE
Browse files
added class SettingsManager
this class will handle all the settings of the project
parent
4e4725c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Configuration/SettingsManager.cpp
0 → 100644
View file @
f8518822
/*****************************************************************************
* SettingsManager.cpp * : Backend settings manager
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Clement CHAVANCE <kinder@vlmc.org>
*
* 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include
<QHash>
#include
"SettingsManager.h"
int
SettingsManager
::
createNewSettings
()
{
this
->
m_settings
.
append
(
new
SettingsContainer
());
return
this
->
m_settings
.
size
()
-
1
;
}
SettingsManager
::
SettingsManager
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
SettingsManager
::~
SettingsManager
()
{
}
void
SettingsManager
::
saveSettings
(
QDomDocument
&
xmlfile
,
int
index
)
{
SettingsContainer
*
settings
=
m_settings
[
index
];
settings
->
lock
.
lockForRead
();
//SAVE SETTINGS TO DomDocument
settings
->
lock
.
unlock
();
}
src/Configuration/SettingsManager.h
0 → 100644
View file @
f8518822
/*****************************************************************************
* SettingsManager.h: Backend settings manager
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Clement CHAVANCE <kinder@vlmc.org>
*
* 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef SETTINGSMANAGER_H
#define SETTINGSMANAGER_H
#include
<QObject>
#include
<QVector>
#include
<QHash>
#include
<QReadWriteLock>
#include
<QString>
#include
<QVariant>
#include
<QDomDocument>
#include
"QSingleton.hpp"
struct
SettingsContainer
{
QReadWriteLock
lock
;
QHash
<
QString
,
QVariant
>
settings
;
};
class
SettingsManager
:
public
QObject
,
public
QSingleton
<
SettingsManager
>
{
//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
);
QVariant
&
getValue
(
const
QString
&
key
);
private:
SettingsManager
(
QObject
*
parent
=
0
);
~
SettingsManager
();
QVector
<
SettingsContainer
*>
m_settings
;
public
slots
:
void
saveSettings
(
QDomDocument
&
xmlfile
,
int
index
);
};
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment