renamed XSettings to XConfig.
This commit is contained in:
parent
ac44b4efc6
commit
ba27687590
15 changed files with 60 additions and 64 deletions
|
@ -7,14 +7,14 @@ OBJECTS_DIR = .obj
|
|||
|
||||
SOURCES += xclient.cpp \
|
||||
xclientcache.cpp \
|
||||
xsettings.cpp \
|
||||
xconfig.cpp \
|
||||
playlistmodel.cpp \
|
||||
xmmsqt4.cpp
|
||||
|
||||
|
||||
HEADERS += xclient.h \
|
||||
xclientcache.h \
|
||||
xsettings.h \
|
||||
xconfig.h \
|
||||
playlistmodel.h \
|
||||
xmmsqt4.h \
|
||||
debug.h
|
||||
|
|
|
@ -73,7 +73,7 @@ XClient::XClient (QObject *parent, const std::string &name) : QObject (parent),
|
|||
m_client = NULL;
|
||||
m_isconnected = false;
|
||||
m_cache = new XClientCache (this, this);
|
||||
m_settings = new XSettings (this, this);
|
||||
m_config = new XConfig (this, this);
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,9 @@ class XClient;
|
|||
#include <QWidget>
|
||||
|
||||
#include "xclientcache.h"
|
||||
#include "xsettings.h"
|
||||
#include "xconfig.h"
|
||||
|
||||
class XConfig;
|
||||
|
||||
/*
|
||||
class XSettings : public QObject
|
||||
|
@ -67,8 +69,8 @@ class XClient : public QObject {
|
|||
return m_cache;
|
||||
};
|
||||
|
||||
XSettings *settings () const {
|
||||
return m_settings;
|
||||
XConfig *xconfig () const {
|
||||
return m_config;
|
||||
};
|
||||
|
||||
const Xmms::Client *sync () const {
|
||||
|
@ -103,7 +105,7 @@ class XClient : public QObject {
|
|||
std::string m_name;
|
||||
// Xmms::Client *m_client;
|
||||
XClientCache *m_cache;
|
||||
XSettings *m_settings;
|
||||
XConfig *m_config;
|
||||
bool m_isconnected;
|
||||
|
||||
Xmms::Client m_sync;
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
|
||||
#include "xsettings.h"
|
||||
#include "xconfig.h"
|
||||
|
||||
#include <QList>
|
||||
|
||||
XSettings::XSettings (QObject *parent, XClient *client) : QObject (parent)
|
||||
XConfig::XConfig (QObject *parent, XClient *client) : QObject (parent)
|
||||
{
|
||||
m_ready = false;
|
||||
|
||||
|
@ -36,10 +36,10 @@ XSettings::XSettings (QObject *parent, XClient *client) : QObject (parent)
|
|||
}
|
||||
|
||||
QString
|
||||
XSettings::value_get (QString key)
|
||||
XConfig::value_get (QString key)
|
||||
{
|
||||
/* if XSettings is ready, the local cache should be in sync with the
|
||||
* serverside settings, otherwise the cache is empty */
|
||||
/* if XConfig is ready, the local cache should be in sync with the
|
||||
* serverside configuration, otherwise the cache is empty */
|
||||
if (!m_ready) {
|
||||
return QString ();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ XSettings::value_get (QString key)
|
|||
}
|
||||
|
||||
bool
|
||||
XSettings::value_set (QString key, QString val)
|
||||
XConfig::value_set (QString key, QString val)
|
||||
{
|
||||
/* Only send change request to server here
|
||||
* update of local cache will be done through handle_config_value_changed
|
||||
|
@ -65,7 +65,7 @@ XSettings::value_set (QString key, QString val)
|
|||
}
|
||||
|
||||
bool
|
||||
XSettings::value_register (QString key, QString defval)
|
||||
XConfig::value_register (QString key, QString defval)
|
||||
{
|
||||
if (!m_client->isConnected ()) {
|
||||
return false;
|
||||
|
@ -77,19 +77,19 @@ XSettings::value_register (QString key, QString defval)
|
|||
}
|
||||
|
||||
void
|
||||
XSettings::on_connect (XClient *client)
|
||||
XConfig::on_connect (XClient *client)
|
||||
{
|
||||
client->config ()->valueList ()
|
||||
(Xmms::bind (&XSettings::handle_config_value, this));
|
||||
(Xmms::bind (&XConfig::handle_config_value, this));
|
||||
|
||||
client->config ()->broadcastValueChanged ()
|
||||
(Xmms::bind (&XSettings::handle_config_value_changed, this));
|
||||
(Xmms::bind (&XConfig::handle_config_value_changed, this));
|
||||
|
||||
m_client = client;
|
||||
}
|
||||
|
||||
void
|
||||
XSettings::on_disconnect (XClient *client)
|
||||
XConfig::on_disconnect (XClient *client)
|
||||
{
|
||||
/* We don't emit any signals here, as every class must be able to
|
||||
* react on the configChanged signal, which will be fired for every
|
||||
|
@ -100,7 +100,7 @@ XSettings::on_disconnect (XClient *client)
|
|||
}
|
||||
|
||||
bool
|
||||
XSettings::handle_config_value (const Xmms::Dict &value)
|
||||
XConfig::handle_config_value (const Xmms::Dict &value)
|
||||
{
|
||||
bool ok = handle_config_value_changed (value);
|
||||
if (ok) {
|
||||
|
@ -110,7 +110,7 @@ XSettings::handle_config_value (const Xmms::Dict &value)
|
|||
}
|
||||
|
||||
bool
|
||||
XSettings::handle_config_value_changed (const Xmms::Dict &value)
|
||||
XConfig::handle_config_value_changed (const Xmms::Dict &value)
|
||||
{
|
||||
QHash <QString, QVariant> tmp = XClient::convert_dict(value);
|
||||
|
|
@ -14,10 +14,8 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __XSETTINGS__
|
||||
#define __XSETTINGS__
|
||||
|
||||
class XSettings;
|
||||
#ifndef __XConfig__
|
||||
#define __XConfig__
|
||||
|
||||
#include "xclient.h"
|
||||
|
||||
|
@ -25,11 +23,11 @@ class XSettings;
|
|||
#include <QHash>
|
||||
#include <QString>
|
||||
|
||||
class XSettings : public QObject
|
||||
class XConfig : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
XSettings (QObject *parent, XClient *client);
|
||||
XConfig (QObject *parent, XClient *client);
|
||||
|
||||
QString value_get (QString key);
|
||||
bool value_set (QString key, QString value);
|
Loading…
Add table
Add a link
Reference in a new issue