Singletonify XMMSHandler and kick out everything not XMMSisch from the class.

A class that needs to talk to xmms2 now calls XMMSHandler::getInstance()
and all communication is handled by signals'n'slots.
This commit is contained in:
Daniel Svensson 2006-02-26 19:16:43 +01:00
parent 56dd4cf3ee
commit 787a5c7b5b
10 changed files with 150 additions and 85 deletions

View file

@ -3,9 +3,6 @@
#include <xmmsclient/xmmsclient++.h>
class XMMSHandler;
#include "MainWindow.h"
#include "XmmsQT4.h"
#include <QObject>
@ -13,7 +10,8 @@ class XMMSHandler;
class XMMSHandler : public QObject, public sigc::trackable {
Q_OBJECT
public:
XMMSHandler (MainWindow *mw);
static XMMSHandler *getInstance (void);
XMMSHandler (void);
~XMMSHandler ();
void playback_playtime (XMMSResultValue<uint> *res);
void playback_current_id (XMMSResultValue<uint> *res);
@ -38,11 +36,16 @@ class XMMSHandler : public QObject, public sigc::trackable {
delete m_xmmsc->playback_tickle ();
}
signals:
void playbackStatusChanged (uint status);
void playtimeChanged (uint time);
void mediainfoChanged (QString str, int bitrate, int samplerate,
int channels, int duration);
private:
MainWindow *m_mw;
XmmsQT4 *m_qt4;
XMMSClient *m_xmmsc;
static XMMSHandler *singleton;
};
#endif