OTHER: get rid of XMMSHandler and update classes using it

This commit is contained in:
Thomas Frauendorfer 2008-11-04 19:50:28 +01:00
parent 786b745d55
commit 982660510a
33 changed files with 145 additions and 266 deletions

View file

@ -30,6 +30,7 @@
#include "xconfig.h"
#include "xmmsqt4.h"
#include "debug.h"
#include "playlistmodel.h"
#include "sourcepref.h"
@ -71,6 +72,7 @@ XClient::XClient (QObject *parent, const std::string &name) : QObject (parent),
m_config = new XConfig (this);
m_playback = new XPlayback (this);
m_collection = new XCollection (this);
m_active_playlist = new PlaylistModel(this, this, "_active");
m_name = name;
}

View file

@ -30,6 +30,7 @@ class XClientCache;
class XConfig;
class XPlayback;
class XCollection;
class PlaylistModel;
#define SOURCEPREF_HACK
@ -72,6 +73,10 @@ class XClient : public QObject {
return m_collection;
}
PlaylistModel *active_playlist () const {
return m_active_playlist;
}
const Xmms::Client *sync () const {
return &m_sync;
};
@ -93,6 +98,9 @@ class XClient : public QObject {
const Xmms::Config* config () { if (m_client && m_client->isConnected ()) return &m_client->config; else return NULL; }
const Xmms::Stats* stats () { if (m_client && m_client->isConnected ()) return &m_client->stats; else return NULL; }
// TODO: remove as soon as it's no longer neede
Xmms::Client *getClient () {return m_client;}
signals:
void gotConnection (XClient *);
void disconnected (XClient *);
@ -111,7 +119,8 @@ class XClient : public QObject {
XConfig *m_config;
XPlayback *m_playback;
XCollection *m_collection;
bool m_isconnected;
PlaylistModel *m_active_playlist;
bool m_isconnected;
Xmms::Client m_sync;
};

View file

@ -210,6 +210,19 @@ XCollection::addIdlist (QString name) {
return true;
}
bool
XCollection::playlistAddUrl (QString url, QString plsname)
{
if (plsname == "") {
plsname = d->m_activePlaylist;
}
m_client->playlist ()->addUrl (url.toStdString (),
plsname.toStdString ());
return true;
}
bool
XCollection::playlistAddUrl (QUrl url, QString plsname)
{

View file

@ -40,6 +40,7 @@ class XCollection : public QObject
// idlist spesific
bool setActivePlaylist (QString name);
bool addIdlist (QString name);
bool playlistAddUrl (QString url, QString plsname = "");
bool playlistAddUrl (QUrl url, QString plsname = "");
bool playlistClear (QString name = "");
bool addPlsFile (QUrl url);

View file

@ -49,6 +49,8 @@ class XPlayback : public QObject {
void seekMs (uint milliseconds);
void seekMsRel (int milliseconds);
// Helper to directly connect sliders to this class
void seekMs (int milliseconds) {seekMs ((uint) milliseconds);};
void setVolume (int new_volume);
void setBalance (int new_balance);