renamed XSettings to XConfig.
This commit is contained in:
parent
ac44b4efc6
commit
ba27687590
15 changed files with 60 additions and 64 deletions
2
AUTHORS
2
AUTHORS
|
@ -28,7 +28,7 @@ N: Tobias Rundström
|
|||
E: tru@xmms.org
|
||||
W: http://tobi.nu/
|
||||
P: 1024D/EA0C5340 E203 6001 264C 71CE DBFD 7A95 102A 11D0 EA0C 5340
|
||||
D: Main developer and coordinator.
|
||||
D: Previous main developer and coordinator.
|
||||
|
||||
N: Daniel Svensson
|
||||
E: daniel@nittionio.nu
|
||||
|
|
2
README
2
README
|
@ -14,6 +14,6 @@ Compiling:
|
|||
5) ????
|
||||
6) profit
|
||||
|
||||
Bugs:
|
||||
Known bugs:
|
||||
Tons of them.
|
||||
|
||||
|
|
10
TODO
10
TODO
|
@ -1,9 +1,9 @@
|
|||
Todo:
|
||||
|
||||
* Config
|
||||
* ServerConfig
|
||||
* ApplicationConfig
|
||||
* Balance
|
||||
+ Mainwindow
|
||||
+ Balancebackgrounds are wrong
|
||||
+ enable repeat button
|
||||
+ enable random play (will have to wait for a randomplay service client)
|
||||
* Playlist
|
||||
+ Make displayed Information configurable
|
||||
+ Add scrollbuttons to slider
|
||||
|
@ -23,5 +23,3 @@ Todo:
|
|||
* Textbox
|
||||
* redraw text in textbox when switching skin.
|
||||
* figure out something smart on osx.
|
||||
* xclient:
|
||||
* connect disconnected callback, so that it emits 'disconnected ()'
|
||||
|
|
|
@ -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);
|
|
@ -74,6 +74,7 @@ SkinDisplay::paintEvent (QPaintEvent *event)
|
|||
paint.end();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SkinDisplay::fileOpen (void)
|
||||
{
|
||||
|
|
|
@ -179,6 +179,7 @@ XMMSHandler::DictToQHash (const std::string &key,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
XMMSHandler::PropDictToQHash (const std::string &key,
|
||||
const Xmms::Dict::Variant &value,
|
||||
|
@ -196,7 +197,7 @@ XMMSHandler::PropDictToQHash (const std::string &key,
|
|||
QString::fromUtf8 (boost::get< std::string > (value).c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
uint
|
||||
XMMSHandler::medialibQuery (QString q)
|
||||
|
|
|
@ -103,10 +103,10 @@ class XMMSHandler : public XClient {
|
|||
void DictToQHash (const std::string &key,
|
||||
const Xmms::Dict::Variant &value,
|
||||
QHash<QString, QString> &hash);
|
||||
void PropDictToQHash (const std::string &key,
|
||||
const Xmms::Dict::Variant &value,
|
||||
const std::string &source,
|
||||
QHash<QString, QString> &hash);
|
||||
// void PropDictToQHash (const std::string &key,
|
||||
// const Xmms::Dict::Variant &value,
|
||||
// const std::string &source,
|
||||
// QHash<QString, QString> &hash);
|
||||
|
||||
bool volume_get (const Xmms::Dict &levels);
|
||||
bool volume_error (const std::string &error);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include "xsettings.h"
|
||||
#include "xconfig.h"
|
||||
|
||||
#include "equalizerwidget.h"
|
||||
|
||||
|
@ -49,7 +49,7 @@ EqualizerWidget::EqualizerWidget (QWidget *parent) : QWidget (parent)
|
|||
{
|
||||
Skin *skin = Skin::getInstance ();
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
m_xsettings = client.settings ();
|
||||
m_xconfig = client.xconfig ();
|
||||
|
||||
connect (skin, SIGNAL(skinChanged(Skin *)),
|
||||
this, SLOT(setPixmaps(Skin *)));
|
||||
|
@ -93,25 +93,25 @@ EqualizerWidget::EqualizerWidget (QWidget *parent) : QWidget (parent)
|
|||
this, SLOT (updateServerBands (int, int)));
|
||||
}
|
||||
|
||||
connect (m_xsettings, SIGNAL (configChanged (QString, QString)),
|
||||
connect (m_xconfig, SIGNAL (configChanged (QString, QString)),
|
||||
this, SLOT (serverConfigChanged (QString, QString)));
|
||||
|
||||
// if the settings from the server were already loaded, we will only
|
||||
// if the config from the server were already loaded, we will only
|
||||
// receive configChanged signals for values that really change
|
||||
// so we must request the existing values manually
|
||||
if (m_xsettings->isReady()) {
|
||||
if (m_xconfig->isReady()) {
|
||||
QString key;
|
||||
QString value;
|
||||
// set enabled checkbox
|
||||
key = QString ("equalizer.enabled");
|
||||
value = m_xsettings->value_get (key);
|
||||
value = m_xconfig->value_get (key);
|
||||
serverConfigChanged (key, value);
|
||||
// set preamp
|
||||
|
||||
// Set band-sliders
|
||||
for (int i=0; i < 10; i++) {
|
||||
key = QString ("equalizer.legacy%1").arg(i);
|
||||
value = m_xsettings->value_get (key);
|
||||
value = m_xconfig->value_get (key);
|
||||
serverConfigChanged (key, value);
|
||||
}
|
||||
}
|
||||
|
@ -185,22 +185,22 @@ EqualizerWidget::serverConfigChanged (QString key, QString value)
|
|||
void
|
||||
EqualizerWidget::setEqualizerEnabled (bool enabled) {
|
||||
if (enabled) {
|
||||
m_xsettings->value_set ("equalizer.enabled", "1");
|
||||
m_xsettings->value_set ("equalizer.use_legacy", "1");
|
||||
m_xconfig->value_set ("equalizer.enabled", "1");
|
||||
m_xconfig->value_set ("equalizer.use_legacy", "1");
|
||||
} else {
|
||||
m_xsettings->value_set ("equalizer.enabled", "0");
|
||||
m_xconfig->value_set ("equalizer.enabled", "0");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EqualizerWidget::updateServerPreamp (int value)
|
||||
{
|
||||
m_xsettings->value_set ("equalizer.preamp", QString::number (value));
|
||||
m_xconfig->value_set ("equalizer.preamp", QString::number (value));
|
||||
}
|
||||
|
||||
void
|
||||
EqualizerWidget::updateServerBands (int value, int id)
|
||||
{
|
||||
QString key = QString ("equalizer.legacy%1").arg (id);
|
||||
m_xsettings->value_set (key, QString::number (value));
|
||||
m_xconfig->value_set (key, QString::number (value));
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class QPixmap;
|
|||
class QPaintEvent;
|
||||
|
||||
#include "VolumeSlider.h"
|
||||
class XSettings;
|
||||
class XConfig;
|
||||
class Skin;
|
||||
class Button;
|
||||
class ToggleButton;
|
||||
|
@ -66,7 +66,7 @@ class EqualizerWidget : public QWidget
|
|||
void updateServerBands (int value, int id);
|
||||
|
||||
private:
|
||||
XSettings *m_xsettings;
|
||||
XConfig *m_xconfig;
|
||||
QPixmap m_pixmap;
|
||||
QPixmap m_graph;
|
||||
ToggleButton *m_enable;
|
||||
|
|
|
@ -180,17 +180,17 @@ PlaylistWidget::PlaylistWidget (QWidget *parent) : QWidget (parent)
|
|||
|
||||
m_view = new PlaylistView (this);
|
||||
m_view->move (10, 20);
|
||||
m_view->resize (size().width()-30, size().height()-20-38);
|
||||
// m_view->resize (size().width()-30, size().height()-20-38);
|
||||
// TODO: creation of Playlistmodel should be done elsewhere
|
||||
m_view->setModel (XMMSHandler::getInstance().getPlaylistModel());
|
||||
|
||||
//m_list = new PlaylistList (m_view);
|
||||
|
||||
/*
|
||||
* This is a hack to make PlaylistScrollBar work with PlaylistView.
|
||||
* It is necessery because of limitations and at least one Bug in the
|
||||
* QT library (as of Version 4.3)
|
||||
* TODO: This might break in a future Qt version. Try to find a better solution
|
||||
* FIXME: scrollbar is only visible if playlist was closed on startup or
|
||||
* after resizing the playlist
|
||||
*/
|
||||
m_scrollBar = new PlaylistScrollBar (this);
|
||||
m_view->setVerticalScrollBar (m_scrollBar);
|
||||
|
@ -208,7 +208,7 @@ PlaylistWidget::PlaylistWidget (QWidget *parent) : QWidget (parent)
|
|||
addButtons ();
|
||||
|
||||
setMinimumSize (275, 116);
|
||||
resize (275, 300);
|
||||
// resize (275, 300);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -246,7 +246,6 @@ PlaylistWidget::addButtons (void)
|
|||
Skin::PLS_DEL_FIL_1);
|
||||
connect (b, SIGNAL (activated ()),
|
||||
m_view, SLOT (removeSelected ()));
|
||||
// connect (b, SIGNAL(activated ()), m_list, SLOT (deleteFiles ()));
|
||||
|
||||
/* Selection menu */
|
||||
m_sel = new PlaylistMenu (this, Skin::PLS_SEL,
|
||||
|
@ -370,7 +369,8 @@ void
|
|||
PlaylistWidget::setPixmaps (Skin *skin)
|
||||
{
|
||||
setActive (m_active);
|
||||
resize (size().width(), size().height());
|
||||
|
||||
update ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -19,23 +19,19 @@
|
|||
|
||||
#include "XMMSHandler.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QFont>
|
||||
#include <QScrollBar>
|
||||
#include <QSizeGrip>
|
||||
|
||||
class MainWindow;
|
||||
class PlaylistWidget;
|
||||
class PlaylistScroller;
|
||||
|
||||
#include "Button.h"
|
||||
|
||||
class Skin;
|
||||
//class PlaylistList;
|
||||
class PlaylistView;
|
||||
class PlaylistShade;
|
||||
class PlaylistMenu;
|
||||
|
||||
|
||||
class PlaylistSizeGrip : public QSizeGrip {
|
||||
Q_OBJECT
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue