From 8cf4f132ff4d36e5eb0f6305f38f98dbaef9389b Mon Sep 17 00:00:00 2001 From: Tobias Rundstrom Date: Mon, 20 Mar 2006 22:46:39 -0400 Subject: [PATCH] Make promoe work with DrDolittle. This moves the c++ wrapper into promoe so we don't depend on a patched version of xmms2 anymore. You should be able to run this with a drdolittle out of the box. I also disabled the medialib browser for future enabling. --- MainWindow.cpp | 1 - PlaylistList.cpp | 45 +++++++++- PlaylistList.h | 1 + TitleBar.cpp | 6 ++ XMMSHandler.cpp | 6 +- XMMSHandler.h | 6 +- promoe.pro | 19 ++-- xmmsclient_methods.h | 66 ++++++++++++++ xmmsclient_promoe.cpp | 112 ++++++++++++++++++++++++ xmmsclient_promoe.h | 199 ++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 442 insertions(+), 19 deletions(-) create mode 100644 xmmsclient_methods.h create mode 100644 xmmsclient_promoe.cpp create mode 100644 xmmsclient_promoe.h diff --git a/MainWindow.cpp b/MainWindow.cpp index 12d5899..068ee9a 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -1,4 +1,3 @@ -#include #include "MainWindow.h" #ifdef HAVE_SERVERBROWSER diff --git a/PlaylistList.cpp b/PlaylistList.cpp index c426cfa..52e1f7e 100644 --- a/PlaylistList.cpp +++ b/PlaylistList.cpp @@ -3,10 +3,12 @@ #include "PlaylistList.h" #include "Playlist.h" -#include -#include -#include #include +#include +#include +#include +#include +#include PlaylistItem::PlaylistItem (PlaylistList *pl, uint id) { @@ -286,13 +288,45 @@ PlaylistList::generatePixmap (int i) return p; } +void +PlaylistList::showMenu (void) +{ + QMenu qm(this); + + QAction *a; + + a = new QAction (tr ("Show file info"), this); + a->setShortcut (tr ("Ctrl+Enter")); + /* + connect (a, SIGNAL (triggered ()), this, SLOT (showMlib ())); + */ + qm.addAction (a); + qm.addSeparator (); + + a = new QAction (tr ("Add file"), this); + a->setShortcut (tr ("Ctrl+F")); + qm.addAction (a); + + a = new QAction (tr ("Remove selected"), this); + qm.addAction (a); + + qm.addSeparator (); + + a = new QAction (tr ("Medialib browser"), this); + qm.addAction (a); + + qm.exec (QCursor::pos ()); +} + void PlaylistList::mousePressEvent (QMouseEvent *event) { if (m_items->count() < 1) { return; } + int i = ((event->pos().y()+m_offset) / getFontH()); + if (i < 0) { i = 0; } @@ -333,6 +367,8 @@ PlaylistList::mousePressEvent (QMouseEvent *event) m_dragstart = event->pos (); } + } else if (event->button () == Qt::RightButton) { + showMenu (); } update (); @@ -423,6 +459,8 @@ PlaylistList::dropEvent (QDropEvent *event) m_selected->append (m_drag_id); event->acceptProposedAction (); + } + /* } else if (event->mimeData()->hasFormat("application/mlib.album")) { const QMimeData *md = event->mimeData (); QByteArray encodedData = md->data("application/mlib.album"); @@ -479,6 +517,7 @@ PlaylistList::dropEvent (QDropEvent *event) event->acceptProposedAction (); } + */ m_bar = -2; update (); } diff --git a/PlaylistList.h b/PlaylistList.h index 1206e05..bb6921e 100644 --- a/PlaylistList.h +++ b/PlaylistList.h @@ -37,6 +37,7 @@ class PlaylistList : public QWidget { void sizeChanged (QSize); private: + void showMenu (void); void paintEvent (QPaintEvent *event); void mousePressEvent (QMouseEvent *event); void mouseMoveEvent (QMouseEvent *event); diff --git a/TitleBar.cpp b/TitleBar.cpp index 88b0daa..c65f33d 100644 --- a/TitleBar.cpp +++ b/TitleBar.cpp @@ -2,7 +2,9 @@ #include "TitleBar.h" #include "Display.h" #include "SkinChooser.h" +/* #include "Medialib.h" +*/ #include "SettingsWindow.h" #include "Button.h" @@ -43,7 +45,9 @@ TitleBar::showMenu (void) a = new QAction (tr ("Medialib browser"), this); a->setShortcut (tr ("Alt+M")); + /* connect (a, SIGNAL (triggered ()), this, SLOT (showMlib ())); + */ qm.addAction (a); qm.addSeparator (); a = new QAction (tr ("Theme settings"), this); @@ -70,8 +74,10 @@ TitleBar::showMenu (void) void TitleBar::showMlib () { + /* MedialibWindow *mw = new MedialibWindow (window ()); mw->show (); + */ } void diff --git a/XMMSHandler.cpp b/XMMSHandler.cpp index fbf3d16..2d05018 100644 --- a/XMMSHandler.cpp +++ b/XMMSHandler.cpp @@ -1,4 +1,4 @@ -#include +#include "xmmsclient_promoe.h" #include "XmmsQT4.h" #include "XMMSHandler.h" @@ -242,12 +242,13 @@ XMMSHandler::PropDictToQHash (XMMSResultDict *res) return h; } +/* uint XMMSHandler::medialibQuery (QString q) { XMMSResultDictList *r = m_xmmsc->medialib_select (q.toUtf8 ()); r->connect (sigc::mem_fun (this, &XMMSHandler::medialib_select)); - return r->getCID (); + m_mlibqs->append (r); } void @@ -262,6 +263,7 @@ XMMSHandler::medialib_select (XMMSResultDictList *res) emit medialibResponse (res->getCID (), l); } +*/ void XMMSHandler::playlist_changed (XMMSResultDict *res) diff --git a/XMMSHandler.h b/XMMSHandler.h index 64c4e9d..b8237d8 100644 --- a/XMMSHandler.h +++ b/XMMSHandler.h @@ -1,7 +1,7 @@ #ifndef __XMMS_HANDLER_H__ #define __XMMS_HANDLER_H__ -#include +#include "xmmsclient_promoe.h" #include "XmmsQT4.h" @@ -34,8 +34,10 @@ class XMMSHandler : public QObject, public sigc::trackable { void playlistAddURL (QString); void playlistRemove (uint pos) { delete m_xmmsc->playlist_remove (pos); } void playlistMove (uint pos, uint newpos) { delete m_xmmsc->playlist_move (pos, newpos); } + /* uint medialibQuery (QString); void medialibQueryAdd (QString q) { delete m_xmmsc->medialib_add_to_playlist (q.toUtf8 ()); } + */ void volumeGet (void); void volumeSet (uint volume); @@ -69,7 +71,9 @@ class XMMSHandler : public QObject, public sigc::trackable { void playlistList (const QList &); void currentID (uint); void playlistChanged (const QHash &); + /* void medialibResponse (uint, const QList > &); + */ void getVolume (uint); private: diff --git a/promoe.pro b/promoe.pro index 88276eb..67be70a 100644 --- a/promoe.pro +++ b/promoe.pro @@ -19,14 +19,11 @@ SOURCES += XmmsQT4.cpp \ PlaylistList.cpp \ SkinChooser.cpp \ PlaylistShade.cpp \ - Medialib.cpp \ qtmd5.cpp \ SettingsWindow.cpp \ - MediaArtistList.cpp \ - MediaAlbumList.cpp \ - MediaSongList.cpp \ PlaylistMenu.cpp \ - VolumeSlider.cpp + VolumeSlider.cpp \ + xmmsclient_promoe.cpp HEADERS += XmmsQT4.h \ PixWidget.h \ @@ -38,7 +35,7 @@ HEADERS += XmmsQT4.h \ Button.h \ TextBar.h \ NumberDisplay.h \ - TimeDisplay.h \ + TimeDisplay.h \ XMMSHandler.h \ SmallNumberDisplay.h \ StereoMono.h \ @@ -49,14 +46,12 @@ HEADERS += XmmsQT4.h \ PlaylistList.h \ SkinChooser.h \ PlaylistShade.h \ - Medialib.h \ qtmd5.h \ SettingsWindow.h \ - MediaArtistList.h \ - MediaAlbumList.h \ - MediaSongList.h \ PlaylistMenu.h \ - VolumeSlider.h + VolumeSlider.h \ + xmmsclient_promoe.h \ + xmmsclient_methods.h @@ -72,7 +67,7 @@ CONFIG += link_pkgconfig ;QMAKE_CXXFLAGS += -g ;CONFIG += debug warn_on QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter -PKGCONFIG += xmms2-client xmms2-client-cpp sigc++-2.0 +PKGCONFIG += xmms2-client sigc++-2.0 ;CONFIG += avahi diff --git a/xmmsclient_methods.h b/xmmsclient_methods.h new file mode 100644 index 0000000..56e6efe --- /dev/null +++ b/xmmsclient_methods.h @@ -0,0 +1,66 @@ +#ifndef XMMSCLIENTPP_METHODS_H +#define XMMSCLIENTPP_METHODS_H +XMMSResult *quit (void) { return new XMMSResult (xmmsc_quit (m_xmmsc)); } +XMMSResult *plugin_list (uint32_t x) { return new XMMSResult (xmmsc_plugin_list (m_xmmsc, x)); } +XMMSResult *main_stats (void) { return new XMMSResult (xmmsc_main_stats (m_xmmsc)); } +XMMSResult *broadcast_quit (void) { return new XMMSResult (xmmsc_broadcast_quit (m_xmmsc)); } +XMMSResult *playlist_shuffle (void) { return new XMMSResult (xmmsc_playlist_shuffle (m_xmmsc)); } +XMMSResult *playlist_add (const char * x) { return new XMMSResult (xmmsc_playlist_add (m_xmmsc, x)); } +XMMSResult *playlist_add_id (uint32_t x) { return new XMMSResult (xmmsc_playlist_add_id (m_xmmsc, x)); } +XMMSResult *playlist_remove (uint32_t x) { return new XMMSResult (xmmsc_playlist_remove (m_xmmsc, x)); } +XMMSResult *playlist_clear (void) { return new XMMSResult (xmmsc_playlist_clear (m_xmmsc)); } +XMMSResultValueList *playlist_list (void) { return new XMMSResultValueList (xmmsc_playlist_list (m_xmmsc)); } +XMMSResult *playlist_sort (char* x) { return new XMMSResult (xmmsc_playlist_sort (m_xmmsc, x)); } +XMMSResult *playlist_set_next (uint32_t x) { return new XMMSResult (xmmsc_playlist_set_next (m_xmmsc, x)); } +XMMSResult *playlist_set_next_rel (int32_t x) { return new XMMSResult (xmmsc_playlist_set_next_rel (m_xmmsc, x)); } +XMMSResult *playlist_move (uint32_t x,uint32_t y) { return new XMMSResult (xmmsc_playlist_move (m_xmmsc, x, y)); } +XMMSResultValue *playlist_current_pos (void) { return new XMMSResultValue (xmmsc_playlist_current_pos (m_xmmsc)); } +XMMSResult *playlist_insert (int x,char * y) { return new XMMSResult (xmmsc_playlist_insert (m_xmmsc, x, y)); } +XMMSResult *playlist_insert_id (int x,uint32_t y) { return new XMMSResult (xmmsc_playlist_insert_id (m_xmmsc, x, y)); } +XMMSResultDict *broadcast_playlist_changed (void) { return new XMMSResultDict (xmmsc_broadcast_playlist_changed (m_xmmsc)); } +XMMSResultValue *broadcast_playlist_current_pos (void) { return new XMMSResultValue (xmmsc_broadcast_playlist_current_pos (m_xmmsc)); } +XMMSResult *playback_stop (void) { return new XMMSResult (xmmsc_playback_stop (m_xmmsc)); } +XMMSResult *playback_tickle (void) { return new XMMSResult (xmmsc_playback_tickle (m_xmmsc)); } +XMMSResult *playback_start (void) { return new XMMSResult (xmmsc_playback_start (m_xmmsc)); } +XMMSResult *playback_pause (void) { return new XMMSResult (xmmsc_playback_pause (m_xmmsc)); } +XMMSResultValue *playback_current_id (void) { return new XMMSResultValue (xmmsc_playback_current_id (m_xmmsc)); } +XMMSResult *playback_seek_ms (uint32_t x) { return new XMMSResult (xmmsc_playback_seek_ms (m_xmmsc, x)); } +XMMSResult *playback_seek_ms_rel (int x) { return new XMMSResult (xmmsc_playback_seek_ms_rel (m_xmmsc, x)); } +XMMSResult *playback_seek_samples (uint32_t x) { return new XMMSResult (xmmsc_playback_seek_samples (m_xmmsc, x)); } +XMMSResult *playback_seek_samples_rel (int x) { return new XMMSResult (xmmsc_playback_seek_samples_rel (m_xmmsc, x)); } +XMMSResultValue *playback_playtime (void) { return new XMMSResultValue (xmmsc_playback_playtime (m_xmmsc)); } +XMMSResultValue *playback_status (void) { return new XMMSResultValue (xmmsc_playback_status (m_xmmsc)); } +XMMSResult *playback_volume_set (const char * x,uint32_t y) { return new XMMSResult (xmmsc_playback_volume_set (m_xmmsc, x, y)); } +XMMSResultDict *playback_volume_get (void) { return new XMMSResultDict (xmmsc_playback_volume_get (m_xmmsc)); } +XMMSResult *broadcast_playback_volume_changed (void) { return new XMMSResult (xmmsc_broadcast_playback_volume_changed (m_xmmsc)); } +XMMSResultValue *broadcast_playback_status (void) { return new XMMSResultValue (xmmsc_broadcast_playback_status (m_xmmsc)); } +XMMSResultValue *broadcast_playback_current_id (void) { return new XMMSResultValue (xmmsc_broadcast_playback_current_id (m_xmmsc)); } +XMMSResultValue *signal_playback_playtime (void) { return new XMMSResultValue (xmmsc_signal_playback_playtime (m_xmmsc)); } +XMMSResult *configval_set (char * x,char * y) { return new XMMSResult (xmmsc_configval_set (m_xmmsc, x, y)); } +XMMSResultValueList *configval_list (void) { return new XMMSResultValueList (xmmsc_configval_list (m_xmmsc)); } +XMMSResultValue *configval_get (char * x) { return new XMMSResultValue (xmmsc_configval_get (m_xmmsc, x)); } +XMMSResult *configval_register (char * x,char * y) { return new XMMSResult (xmmsc_configval_register (m_xmmsc, x, y)); } +XMMSResultValue *broadcast_configval_changed (void) { return new XMMSResultValue (xmmsc_broadcast_configval_changed (m_xmmsc)); } +XMMSResult *broadcast_mediainfo_reader_status (void) { return new XMMSResult (xmmsc_broadcast_mediainfo_reader_status (m_xmmsc)); } +XMMSResult *signal_visualisation_data (void) { return new XMMSResult (xmmsc_signal_visualisation_data (m_xmmsc)); } +XMMSResult *signal_mediainfo_reader_unindexed (void) { return new XMMSResult (xmmsc_signal_mediainfo_reader_unindexed (m_xmmsc)); } +XMMSResultDictList *medialib_select (const char * x) { return new XMMSResultDictList (xmmsc_medialib_select (m_xmmsc, x)); } +XMMSResult *medialib_playlist_save_current (const char * x) { return new XMMSResult (xmmsc_medialib_playlist_save_current (m_xmmsc, x)); } +XMMSResult *medialib_playlist_load (const char * x) { return new XMMSResult (xmmsc_medialib_playlist_load (m_xmmsc, x)); } +XMMSResult *medialib_add_entry (const char * x) { return new XMMSResult (xmmsc_medialib_add_entry (m_xmmsc, x)); } +XMMSResultDict *medialib_get_info (uint32_t x) { return new XMMSResultDict (xmmsc_medialib_get_info (m_xmmsc, x)); } +XMMSResult *medialib_add_to_playlist (const char * x) { return new XMMSResult (xmmsc_medialib_add_to_playlist (m_xmmsc, x)); } +XMMSResultValueList *medialib_playlists_list (void) { return new XMMSResultValueList (xmmsc_medialib_playlists_list (m_xmmsc)); } +XMMSResultValueList *medialib_playlist_list (const char * x) { return new XMMSResultValueList (xmmsc_medialib_playlist_list (m_xmmsc, x)); } +XMMSResult *medialib_playlist_import (const char * x,const char * y) { return new XMMSResult (xmmsc_medialib_playlist_import (m_xmmsc, x, y)); } +XMMSResult *medialib_playlist_export (const char * x,const char * y) { return new XMMSResult (xmmsc_medialib_playlist_export (m_xmmsc, x, y)); } +XMMSResult *medialib_playlist_remove (const char * x) { return new XMMSResult (xmmsc_medialib_playlist_remove (m_xmmsc, x)); } +XMMSResult *medialib_path_import (const char * x) { return new XMMSResult (xmmsc_medialib_path_import (m_xmmsc, x)); } +XMMSResult *medialib_rehash (uint32_t x) { return new XMMSResult (xmmsc_medialib_rehash (m_xmmsc, x)); } +XMMSResult *medialib_get_id (const char * x) { return new XMMSResult (xmmsc_medialib_get_id (m_xmmsc, x)); } +XMMSResult *medialib_remove_entry (int32_t x) { return new XMMSResult (xmmsc_medialib_remove_entry (m_xmmsc, x)); } +XMMSResult *medialib_entry_property_set (uint32_t x,char * y,char * z) { return new XMMSResult (xmmsc_medialib_entry_property_set (m_xmmsc, x, y, z)); } +XMMSResult *medialib_entry_property_set_with_source (uint32_t x,char * y,char * z,char * w) { return new XMMSResult (xmmsc_medialib_entry_property_set_with_source (m_xmmsc, x, y, z, w)); } +XMMSResultValue *broadcast_medialib_entry_changed (void) { return new XMMSResultValue (xmmsc_broadcast_medialib_entry_changed (m_xmmsc)); } +XMMSResult *broadcast_medialib_playlist_loaded (void) { return new XMMSResult (xmmsc_broadcast_medialib_playlist_loaded (m_xmmsc)); } +#endif diff --git a/xmmsclient_promoe.cpp b/xmmsclient_promoe.cpp new file mode 100644 index 0000000..89b1778 --- /dev/null +++ b/xmmsclient_promoe.cpp @@ -0,0 +1,112 @@ +#include +#include + +#include "xmmsclient_promoe.h" + +static +void generic_handler (xmmsc_result_t *res, void *userdata) +{ + XMMSResult* r = static_cast(userdata); + if (!r) { + cout << "********* FATAL ERROR ***********" << endl; + cout << "The generic handler was called without a result!" << endl; + return; + } + r->emit (); +} + +XMMSClient::XMMSClient (const char *name) +{ + m_xmmsc = xmmsc_init (name); +} + +bool +XMMSClient::connect (const char *path) +{ + if (!xmmsc_connect (m_xmmsc, path)) { + return false; + } + + return true; +} + +XMMSClient::~XMMSClient () +{ + xmmsc_unref (m_xmmsc); +} + +XMMSResult::XMMSResult (xmmsc_result_t *res) + : m_res(res), m_inited(false), m_signal() +{ +} + +XMMSResult::XMMSResult (const XMMSResult &src) + : m_res(src.m_res) +{ +} + +void +XMMSResult::restart (void) +{ + xmmsc_result_t *nres; + nres = xmmsc_result_restart (m_res); + xmmsc_result_unref (m_res); + xmmsc_result_unref (nres); + m_res = nres; +} + +void +XMMSResult::connect (const sigc::slot& slot_) +{ + if (!m_inited) { + xmmsc_result_notifier_set (m_res, &generic_handler, this); + m_inited = true; + } + m_signal.connect (slot_); +} + +static void +dict_foreach (const void *key, + xmmsc_result_value_type_t type, + const void *value, + void *udata) +{ + list *i (static_cast*>(udata)); + i->push_front (static_cast(key)); +} + +list +XMMSResultDict::getDictKeys (void) +{ + list i; + + xmmsc_result_dict_foreach (m_res, dict_foreach, static_cast(&i)); + + return i; +} + +static void +propdict_foreach (const void *key, + xmmsc_result_value_type_t type, + const void *value, + const char *source, + void *udata) +{ + list *i (static_cast*>(udata)); + i->push_front (static_cast(key)); +} + +list +XMMSResultDict::getPropDictKeys (void) +{ + list i; + + xmmsc_result_propdict_foreach (m_res, propdict_foreach, static_cast(&i)); + + return i; +} + +XMMSResult::~XMMSResult () +{ + xmmsc_result_unref (m_res); +} diff --git a/xmmsclient_promoe.h b/xmmsclient_promoe.h new file mode 100644 index 0000000..703cf76 --- /dev/null +++ b/xmmsclient_promoe.h @@ -0,0 +1,199 @@ +#ifndef __XMMSCLIENTPP_H +#define __XMMSCLIENTPP_H + +#include +#include +#include + +using namespace std; + + +class XMMSResult +{ + public: + XMMSResult (xmmsc_result_t*); + XMMSResult (const XMMSResult &); + virtual ~XMMSResult (); + + uint getClass (void) { return xmmsc_result_get_class (m_res); } + uint getType (void) { return xmmsc_result_get_type (m_res); } + void restart (void); + + /* error */ + bool isError (void) { return xmmsc_result_iserror (m_res); } + const char *getError (void) { return xmmsc_result_get_error (m_res); } + + /* wait for this resultset */ + void wait (void) const { xmmsc_result_wait (m_res); } + + void connect (const sigc::slot& slot_); + void emit (void) { m_signal.emit(this); } + + protected: + xmmsc_result_t *m_res; + + bool m_inited; + sigc::signal m_signal; +}; + + +class XMMSResultList +{ + public: + XMMSResultList (xmmsc_result_t* res) : m_list_res(res) { } + XMMSResultList (const XMMSResultList &src) : m_list_res(src.m_list_res) { } + virtual ~XMMSResultList () { } + + bool listValid (void) { return xmmsc_result_list_valid (m_list_res); } + bool listNext (void) { return xmmsc_result_list_next (m_list_res); } + bool listFirst (void) { return xmmsc_result_list_first (m_list_res); } + + bool isList (void) { return xmmsc_result_is_list (m_list_res); } + + private: + xmmsc_result_t *m_list_res; +}; + + +class XMMSResultDict : public XMMSResult +{ + public: + XMMSResultDict (xmmsc_result_t* res) : XMMSResult(res) { } + XMMSResultDict (const XMMSResultDict &src) : XMMSResult(src) { } + virtual ~XMMSResultDict () { } + + void connect (const sigc::slot& slot_) { + XMMSResult::connect(sigc::retype(slot_)); + } + + std::list getPropDictKeys (); + std::list getDictKeys (); + + uint getDictValueType (const char *key) { + return xmmsc_result_get_dict_entry_type (m_res, key); + } + + int entryFormat (char *target, int len, const char *format) { + return xmmsc_entry_format (target, len, format, m_res); + } + + bool getValue (const char* key, int *var) { + return xmmsc_result_get_dict_entry_int32 (m_res, key, var); + } + bool getValue (const char* key, uint *var) { + return xmmsc_result_get_dict_entry_uint32 (m_res, key, var); + } + bool getValue (const char* key, char **var) { + return xmmsc_result_get_dict_entry_str (m_res, key, var); + } +}; + + +template +class XMMSResultValue : public XMMSResult +{ + public: + XMMSResultValue (xmmsc_result_t* res) : XMMSResult(res) { } + XMMSResultValue (const XMMSResultValue &src) : XMMSResult(src) { } + virtual ~XMMSResultValue () { } + + void connect (const sigc::slot*>& slot_) = 0; + bool getValue (T *var) = 0; +}; + +template <> +class XMMSResultValue : public XMMSResult +{ + public: + XMMSResultValue (xmmsc_result_t* res) : XMMSResult(res) { } + XMMSResultValue (const XMMSResultValue &src) : XMMSResult(src) { } + virtual ~XMMSResultValue () { } + + void connect (const sigc::slot*>& slot_) { + XMMSResult::connect(sigc::retype(slot_)); + } + + bool getValue (int *var) { return xmmsc_result_get_int (m_res, var); } +}; + +template <> +class XMMSResultValue : public XMMSResult +{ + public: + XMMSResultValue (xmmsc_result_t* res) : XMMSResult(res) { } + XMMSResultValue (const XMMSResultValue &src) : XMMSResult(src) { } + virtual ~XMMSResultValue () { } + + void connect (const sigc::slot*>& slot_) { + XMMSResult::connect(sigc::retype(slot_)); + } + + bool getValue (uint *var) { return xmmsc_result_get_uint (m_res, var); } +}; + +template <> +class XMMSResultValue : public XMMSResult +{ + public: + XMMSResultValue (xmmsc_result_t* res) : XMMSResult(res) { } + XMMSResultValue (const XMMSResultValue &src) : XMMSResult(src) { } + virtual ~XMMSResultValue () { } + + void connect (const sigc::slot*>& slot_) { + XMMSResult::connect(sigc::retype(slot_)); + } + + bool getValue (char **var) { return xmmsc_result_get_string (m_res, var); } +}; + + +template +class XMMSResultValueList : public XMMSResultList, public XMMSResultValue +{ + public: + XMMSResultValueList (xmmsc_result_t* res) + : XMMSResultList(res), XMMSResultValue(res) { } + XMMSResultValueList (const XMMSResultValueList &src) + : XMMSResultList(src), XMMSResultValue(src) { } + virtual ~XMMSResultValueList() { } + + void connect (const sigc::slot*>& slot_) { + XMMSResult::connect(sigc::retype(slot_)); + } +}; + + +class XMMSResultDictList : public XMMSResultList, public XMMSResultDict +{ + public: + XMMSResultDictList (xmmsc_result_t* res) + : XMMSResultList(res), XMMSResultDict(res) { } + XMMSResultDictList (const XMMSResultDictList &src) + : XMMSResultList(src), XMMSResultDict(src) { } + virtual ~XMMSResultDictList() { } + + void connect (const sigc::slot& slot_) { + XMMSResult::connect(sigc::retype(slot_)); + } +}; + + + +class XMMSClient +{ + public: + XMMSClient (const char *name); + ~XMMSClient (); + + bool connect (const char *path); + + xmmsc_connection_t *getConn(void) { return m_xmmsc; } + +#include "xmmsclient_methods.h" + + private: + xmmsc_connection_t *m_xmmsc; +}; + +#endif +