renamed XSettings to XConfig.

This commit is contained in:
Thomas Frauendorfer 2008-02-05 08:22:29 +01:00
parent ac44b4efc6
commit ba27687590
15 changed files with 60 additions and 64 deletions

View file

@ -28,7 +28,7 @@ N: Tobias Rundström
E: tru@xmms.org E: tru@xmms.org
W: http://tobi.nu/ W: http://tobi.nu/
P: 1024D/EA0C5340 E203 6001 264C 71CE DBFD 7A95 102A 11D0 EA0C 5340 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 N: Daniel Svensson
E: daniel@nittionio.nu E: daniel@nittionio.nu

2
README
View file

@ -14,6 +14,6 @@ Compiling:
5) ???? 5) ????
6) profit 6) profit
Bugs: Known bugs:
Tons of them. Tons of them.

10
TODO
View file

@ -1,9 +1,9 @@
Todo: Todo:
* Config + Mainwindow
* ServerConfig + Balancebackgrounds are wrong
* ApplicationConfig + enable repeat button
* Balance + enable random play (will have to wait for a randomplay service client)
* Playlist * Playlist
+ Make displayed Information configurable + Make displayed Information configurable
+ Add scrollbuttons to slider + Add scrollbuttons to slider
@ -23,5 +23,3 @@ Todo:
* Textbox * Textbox
* redraw text in textbox when switching skin. * redraw text in textbox when switching skin.
* figure out something smart on osx. * figure out something smart on osx.
* xclient:
* connect disconnected callback, so that it emits 'disconnected ()'

View file

@ -7,14 +7,14 @@ OBJECTS_DIR = .obj
SOURCES += xclient.cpp \ SOURCES += xclient.cpp \
xclientcache.cpp \ xclientcache.cpp \
xsettings.cpp \ xconfig.cpp \
playlistmodel.cpp \ playlistmodel.cpp \
xmmsqt4.cpp xmmsqt4.cpp
HEADERS += xclient.h \ HEADERS += xclient.h \
xclientcache.h \ xclientcache.h \
xsettings.h \ xconfig.h \
playlistmodel.h \ playlistmodel.h \
xmmsqt4.h \ xmmsqt4.h \
debug.h debug.h

View file

@ -73,7 +73,7 @@ XClient::XClient (QObject *parent, const std::string &name) : QObject (parent),
m_client = NULL; m_client = NULL;
m_isconnected = false; m_isconnected = false;
m_cache = new XClientCache (this, this); m_cache = new XClientCache (this, this);
m_settings = new XSettings (this, this); m_config = new XConfig (this, this);
m_name = name; m_name = name;
} }

View file

@ -29,7 +29,9 @@ class XClient;
#include <QWidget> #include <QWidget>
#include "xclientcache.h" #include "xclientcache.h"
#include "xsettings.h" #include "xconfig.h"
class XConfig;
/* /*
class XSettings : public QObject class XSettings : public QObject
@ -67,8 +69,8 @@ class XClient : public QObject {
return m_cache; return m_cache;
}; };
XSettings *settings () const { XConfig *xconfig () const {
return m_settings; return m_config;
}; };
const Xmms::Client *sync () const { const Xmms::Client *sync () const {
@ -103,7 +105,7 @@ class XClient : public QObject {
std::string m_name; std::string m_name;
// Xmms::Client *m_client; // Xmms::Client *m_client;
XClientCache *m_cache; XClientCache *m_cache;
XSettings *m_settings; XConfig *m_config;
bool m_isconnected; bool m_isconnected;
Xmms::Client m_sync; Xmms::Client m_sync;

View file

@ -16,11 +16,11 @@
#include <xmmsclient/xmmsclient++.h> #include <xmmsclient/xmmsclient++.h>
#include "xsettings.h" #include "xconfig.h"
#include <QList> #include <QList>
XSettings::XSettings (QObject *parent, XClient *client) : QObject (parent) XConfig::XConfig (QObject *parent, XClient *client) : QObject (parent)
{ {
m_ready = false; m_ready = false;
@ -36,10 +36,10 @@ XSettings::XSettings (QObject *parent, XClient *client) : QObject (parent)
} }
QString QString
XSettings::value_get (QString key) XConfig::value_get (QString key)
{ {
/* if XSettings is ready, the local cache should be in sync with the /* if XConfig is ready, the local cache should be in sync with the
* serverside settings, otherwise the cache is empty */ * serverside configuration, otherwise the cache is empty */
if (!m_ready) { if (!m_ready) {
return QString (); return QString ();
} }
@ -47,7 +47,7 @@ XSettings::value_get (QString key)
} }
bool bool
XSettings::value_set (QString key, QString val) XConfig::value_set (QString key, QString val)
{ {
/* Only send change request to server here /* Only send change request to server here
* update of local cache will be done through handle_config_value_changed * update of local cache will be done through handle_config_value_changed
@ -65,7 +65,7 @@ XSettings::value_set (QString key, QString val)
} }
bool bool
XSettings::value_register (QString key, QString defval) XConfig::value_register (QString key, QString defval)
{ {
if (!m_client->isConnected ()) { if (!m_client->isConnected ()) {
return false; return false;
@ -77,19 +77,19 @@ XSettings::value_register (QString key, QString defval)
} }
void void
XSettings::on_connect (XClient *client) XConfig::on_connect (XClient *client)
{ {
client->config ()->valueList () client->config ()->valueList ()
(Xmms::bind (&XSettings::handle_config_value, this)); (Xmms::bind (&XConfig::handle_config_value, this));
client->config ()->broadcastValueChanged () client->config ()->broadcastValueChanged ()
(Xmms::bind (&XSettings::handle_config_value_changed, this)); (Xmms::bind (&XConfig::handle_config_value_changed, this));
m_client = client; m_client = client;
} }
void 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 /* 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 * react on the configChanged signal, which will be fired for every
@ -100,7 +100,7 @@ XSettings::on_disconnect (XClient *client)
} }
bool bool
XSettings::handle_config_value (const Xmms::Dict &value) XConfig::handle_config_value (const Xmms::Dict &value)
{ {
bool ok = handle_config_value_changed (value); bool ok = handle_config_value_changed (value);
if (ok) { if (ok) {
@ -110,7 +110,7 @@ XSettings::handle_config_value (const Xmms::Dict &value)
} }
bool 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); QHash <QString, QVariant> tmp = XClient::convert_dict(value);

View file

@ -14,10 +14,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef __XSETTINGS__ #ifndef __XConfig__
#define __XSETTINGS__ #define __XConfig__
class XSettings;
#include "xclient.h" #include "xclient.h"
@ -25,11 +23,11 @@ class XSettings;
#include <QHash> #include <QHash>
#include <QString> #include <QString>
class XSettings : public QObject class XConfig : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
XSettings (QObject *parent, XClient *client); XConfig (QObject *parent, XClient *client);
QString value_get (QString key); QString value_get (QString key);
bool value_set (QString key, QString value); bool value_set (QString key, QString value);

View file

@ -74,6 +74,7 @@ SkinDisplay::paintEvent (QPaintEvent *event)
paint.end(); paint.end();
} }
void void
SkinDisplay::fileOpen (void) SkinDisplay::fileOpen (void)
{ {

View file

@ -179,6 +179,7 @@ XMMSHandler::DictToQHash (const std::string &key,
} }
} }
/*
void void
XMMSHandler::PropDictToQHash (const std::string &key, XMMSHandler::PropDictToQHash (const std::string &key,
const Xmms::Dict::Variant &value, const Xmms::Dict::Variant &value,
@ -196,7 +197,7 @@ XMMSHandler::PropDictToQHash (const std::string &key,
QString::fromUtf8 (boost::get< std::string > (value).c_str())); QString::fromUtf8 (boost::get< std::string > (value).c_str()));
} }
} }
*/
/* /*
uint uint
XMMSHandler::medialibQuery (QString q) XMMSHandler::medialibQuery (QString q)

View file

@ -103,10 +103,10 @@ class XMMSHandler : public XClient {
void DictToQHash (const std::string &key, void DictToQHash (const std::string &key,
const Xmms::Dict::Variant &value, const Xmms::Dict::Variant &value,
QHash<QString, QString> &hash); QHash<QString, QString> &hash);
void PropDictToQHash (const std::string &key, // void PropDictToQHash (const std::string &key,
const Xmms::Dict::Variant &value, // const Xmms::Dict::Variant &value,
const std::string &source, // const std::string &source,
QHash<QString, QString> &hash); // QHash<QString, QString> &hash);
bool volume_get (const Xmms::Dict &levels); bool volume_get (const Xmms::Dict &levels);
bool volume_error (const std::string &error); bool volume_error (const std::string &error);

View file

@ -14,7 +14,7 @@
*/ */
#include "XMMSHandler.h" #include "XMMSHandler.h"
#include "xsettings.h" #include "xconfig.h"
#include "equalizerwidget.h" #include "equalizerwidget.h"
@ -49,7 +49,7 @@ EqualizerWidget::EqualizerWidget (QWidget *parent) : QWidget (parent)
{ {
Skin *skin = Skin::getInstance (); Skin *skin = Skin::getInstance ();
XMMSHandler &client = XMMSHandler::getInstance (); XMMSHandler &client = XMMSHandler::getInstance ();
m_xsettings = client.settings (); m_xconfig = client.xconfig ();
connect (skin, SIGNAL(skinChanged(Skin *)), connect (skin, SIGNAL(skinChanged(Skin *)),
this, SLOT(setPixmaps(Skin *))); this, SLOT(setPixmaps(Skin *)));
@ -93,25 +93,25 @@ EqualizerWidget::EqualizerWidget (QWidget *parent) : QWidget (parent)
this, SLOT (updateServerBands (int, int))); this, SLOT (updateServerBands (int, int)));
} }
connect (m_xsettings, SIGNAL (configChanged (QString, QString)), connect (m_xconfig, SIGNAL (configChanged (QString, QString)),
this, SLOT (serverConfigChanged (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 // receive configChanged signals for values that really change
// so we must request the existing values manually // so we must request the existing values manually
if (m_xsettings->isReady()) { if (m_xconfig->isReady()) {
QString key; QString key;
QString value; QString value;
// set enabled checkbox // set enabled checkbox
key = QString ("equalizer.enabled"); key = QString ("equalizer.enabled");
value = m_xsettings->value_get (key); value = m_xconfig->value_get (key);
serverConfigChanged (key, value); serverConfigChanged (key, value);
// set preamp // set preamp
// Set band-sliders // Set band-sliders
for (int i=0; i < 10; i++) { for (int i=0; i < 10; i++) {
key = QString ("equalizer.legacy%1").arg(i); key = QString ("equalizer.legacy%1").arg(i);
value = m_xsettings->value_get (key); value = m_xconfig->value_get (key);
serverConfigChanged (key, value); serverConfigChanged (key, value);
} }
} }
@ -185,22 +185,22 @@ EqualizerWidget::serverConfigChanged (QString key, QString value)
void void
EqualizerWidget::setEqualizerEnabled (bool enabled) { EqualizerWidget::setEqualizerEnabled (bool enabled) {
if (enabled) { if (enabled) {
m_xsettings->value_set ("equalizer.enabled", "1"); m_xconfig->value_set ("equalizer.enabled", "1");
m_xsettings->value_set ("equalizer.use_legacy", "1"); m_xconfig->value_set ("equalizer.use_legacy", "1");
} else { } else {
m_xsettings->value_set ("equalizer.enabled", "0"); m_xconfig->value_set ("equalizer.enabled", "0");
} }
} }
void void
EqualizerWidget::updateServerPreamp (int value) EqualizerWidget::updateServerPreamp (int value)
{ {
m_xsettings->value_set ("equalizer.preamp", QString::number (value)); m_xconfig->value_set ("equalizer.preamp", QString::number (value));
} }
void void
EqualizerWidget::updateServerBands (int value, int id) EqualizerWidget::updateServerBands (int value, int id)
{ {
QString key = QString ("equalizer.legacy%1").arg (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));
} }

View file

@ -23,7 +23,7 @@ class QPixmap;
class QPaintEvent; class QPaintEvent;
#include "VolumeSlider.h" #include "VolumeSlider.h"
class XSettings; class XConfig;
class Skin; class Skin;
class Button; class Button;
class ToggleButton; class ToggleButton;
@ -66,7 +66,7 @@ class EqualizerWidget : public QWidget
void updateServerBands (int value, int id); void updateServerBands (int value, int id);
private: private:
XSettings *m_xsettings; XConfig *m_xconfig;
QPixmap m_pixmap; QPixmap m_pixmap;
QPixmap m_graph; QPixmap m_graph;
ToggleButton *m_enable; ToggleButton *m_enable;

View file

@ -180,17 +180,17 @@ PlaylistWidget::PlaylistWidget (QWidget *parent) : QWidget (parent)
m_view = new PlaylistView (this); m_view = new PlaylistView (this);
m_view->move (10, 20); 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 // TODO: creation of Playlistmodel should be done elsewhere
m_view->setModel (XMMSHandler::getInstance().getPlaylistModel()); m_view->setModel (XMMSHandler::getInstance().getPlaylistModel());
//m_list = new PlaylistList (m_view);
/* /*
* This is a hack to make PlaylistScrollBar work with PlaylistView. * This is a hack to make PlaylistScrollBar work with PlaylistView.
* It is necessery because of limitations and at least one Bug in the * It is necessery because of limitations and at least one Bug in the
* QT library (as of Version 4.3) * QT library (as of Version 4.3)
* TODO: This might break in a future Qt version. Try to find a better solution * 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_scrollBar = new PlaylistScrollBar (this);
m_view->setVerticalScrollBar (m_scrollBar); m_view->setVerticalScrollBar (m_scrollBar);
@ -208,7 +208,7 @@ PlaylistWidget::PlaylistWidget (QWidget *parent) : QWidget (parent)
addButtons (); addButtons ();
setMinimumSize (275, 116); setMinimumSize (275, 116);
resize (275, 300); // resize (275, 300);
} }
void void
@ -246,7 +246,6 @@ PlaylistWidget::addButtons (void)
Skin::PLS_DEL_FIL_1); Skin::PLS_DEL_FIL_1);
connect (b, SIGNAL (activated ()), connect (b, SIGNAL (activated ()),
m_view, SLOT (removeSelected ())); m_view, SLOT (removeSelected ()));
// connect (b, SIGNAL(activated ()), m_list, SLOT (deleteFiles ()));
/* Selection menu */ /* Selection menu */
m_sel = new PlaylistMenu (this, Skin::PLS_SEL, m_sel = new PlaylistMenu (this, Skin::PLS_SEL,
@ -370,7 +369,8 @@ void
PlaylistWidget::setPixmaps (Skin *skin) PlaylistWidget::setPixmaps (Skin *skin)
{ {
setActive (m_active); setActive (m_active);
resize (size().width(), size().height());
update ();
} }
void void

View file

@ -19,23 +19,19 @@
#include "XMMSHandler.h" #include "XMMSHandler.h"
#include <QMainWindow>
#include <QFont>
#include <QScrollBar> #include <QScrollBar>
#include <QSizeGrip> #include <QSizeGrip>
class MainWindow;
class PlaylistWidget; class PlaylistWidget;
class PlaylistScroller; class PlaylistScroller;
#include "Button.h" #include "Button.h"
class Skin; class Skin;
//class PlaylistList;
class PlaylistView; class PlaylistView;
class PlaylistShade;
class PlaylistMenu; class PlaylistMenu;
class PlaylistSizeGrip : public QSizeGrip { class PlaylistSizeGrip : public QSizeGrip {
Q_OBJECT Q_OBJECT