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.
This commit is contained in:
parent
8807e630f1
commit
8cf4f132ff
10 changed files with 442 additions and 19 deletions
|
@ -1,4 +1,3 @@
|
||||||
#include <xmmsclient/xmmsclient++.h>
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
#ifdef HAVE_SERVERBROWSER
|
#ifdef HAVE_SERVERBROWSER
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
#include "PlaylistList.h"
|
#include "PlaylistList.h"
|
||||||
#include "Playlist.h"
|
#include "Playlist.h"
|
||||||
|
|
||||||
#include <QPaintEvent>
|
|
||||||
#include <QDrag>
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QStyleOptionHeader>
|
#include <QStyleOptionHeader>
|
||||||
|
#include <QPaintEvent>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QCursor>
|
||||||
|
#include <QDrag>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
PlaylistItem::PlaylistItem (PlaylistList *pl, uint id)
|
PlaylistItem::PlaylistItem (PlaylistList *pl, uint id)
|
||||||
{
|
{
|
||||||
|
@ -286,13 +288,45 @@ PlaylistList::generatePixmap (int i)
|
||||||
return p;
|
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
|
void
|
||||||
PlaylistList::mousePressEvent (QMouseEvent *event)
|
PlaylistList::mousePressEvent (QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (m_items->count() < 1) {
|
if (m_items->count() < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = ((event->pos().y()+m_offset) / getFontH());
|
int i = ((event->pos().y()+m_offset) / getFontH());
|
||||||
|
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
|
@ -333,6 +367,8 @@ PlaylistList::mousePressEvent (QMouseEvent *event)
|
||||||
|
|
||||||
m_dragstart = event->pos ();
|
m_dragstart = event->pos ();
|
||||||
}
|
}
|
||||||
|
} else if (event->button () == Qt::RightButton) {
|
||||||
|
showMenu ();
|
||||||
}
|
}
|
||||||
|
|
||||||
update ();
|
update ();
|
||||||
|
@ -423,6 +459,8 @@ PlaylistList::dropEvent (QDropEvent *event)
|
||||||
m_selected->append (m_drag_id);
|
m_selected->append (m_drag_id);
|
||||||
|
|
||||||
event->acceptProposedAction ();
|
event->acceptProposedAction ();
|
||||||
|
}
|
||||||
|
/*
|
||||||
} else if (event->mimeData()->hasFormat("application/mlib.album")) {
|
} else if (event->mimeData()->hasFormat("application/mlib.album")) {
|
||||||
const QMimeData *md = event->mimeData ();
|
const QMimeData *md = event->mimeData ();
|
||||||
QByteArray encodedData = md->data("application/mlib.album");
|
QByteArray encodedData = md->data("application/mlib.album");
|
||||||
|
@ -479,6 +517,7 @@ PlaylistList::dropEvent (QDropEvent *event)
|
||||||
|
|
||||||
event->acceptProposedAction ();
|
event->acceptProposedAction ();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
m_bar = -2;
|
m_bar = -2;
|
||||||
update ();
|
update ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ class PlaylistList : public QWidget {
|
||||||
void sizeChanged (QSize);
|
void sizeChanged (QSize);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void showMenu (void);
|
||||||
void paintEvent (QPaintEvent *event);
|
void paintEvent (QPaintEvent *event);
|
||||||
void mousePressEvent (QMouseEvent *event);
|
void mousePressEvent (QMouseEvent *event);
|
||||||
void mouseMoveEvent (QMouseEvent *event);
|
void mouseMoveEvent (QMouseEvent *event);
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
#include "TitleBar.h"
|
#include "TitleBar.h"
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
#include "SkinChooser.h"
|
#include "SkinChooser.h"
|
||||||
|
/*
|
||||||
#include "Medialib.h"
|
#include "Medialib.h"
|
||||||
|
*/
|
||||||
#include "SettingsWindow.h"
|
#include "SettingsWindow.h"
|
||||||
#include "Button.h"
|
#include "Button.h"
|
||||||
|
|
||||||
|
@ -43,7 +45,9 @@ TitleBar::showMenu (void)
|
||||||
|
|
||||||
a = new QAction (tr ("Medialib browser"), this);
|
a = new QAction (tr ("Medialib browser"), this);
|
||||||
a->setShortcut (tr ("Alt+M"));
|
a->setShortcut (tr ("Alt+M"));
|
||||||
|
/*
|
||||||
connect (a, SIGNAL (triggered ()), this, SLOT (showMlib ()));
|
connect (a, SIGNAL (triggered ()), this, SLOT (showMlib ()));
|
||||||
|
*/
|
||||||
qm.addAction (a);
|
qm.addAction (a);
|
||||||
qm.addSeparator ();
|
qm.addSeparator ();
|
||||||
a = new QAction (tr ("Theme settings"), this);
|
a = new QAction (tr ("Theme settings"), this);
|
||||||
|
@ -70,8 +74,10 @@ TitleBar::showMenu (void)
|
||||||
void
|
void
|
||||||
TitleBar::showMlib ()
|
TitleBar::showMlib ()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
MedialibWindow *mw = new MedialibWindow (window ());
|
MedialibWindow *mw = new MedialibWindow (window ());
|
||||||
mw->show ();
|
mw->show ();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include <xmmsclient/xmmsclient++.h>
|
#include "xmmsclient_promoe.h"
|
||||||
|
|
||||||
#include "XmmsQT4.h"
|
#include "XmmsQT4.h"
|
||||||
#include "XMMSHandler.h"
|
#include "XMMSHandler.h"
|
||||||
|
@ -242,12 +242,13 @@ XMMSHandler::PropDictToQHash (XMMSResultDict *res)
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
uint
|
uint
|
||||||
XMMSHandler::medialibQuery (QString q)
|
XMMSHandler::medialibQuery (QString q)
|
||||||
{
|
{
|
||||||
XMMSResultDictList *r = m_xmmsc->medialib_select (q.toUtf8 ());
|
XMMSResultDictList *r = m_xmmsc->medialib_select (q.toUtf8 ());
|
||||||
r->connect (sigc::mem_fun (this, &XMMSHandler::medialib_select));
|
r->connect (sigc::mem_fun (this, &XMMSHandler::medialib_select));
|
||||||
return r->getCID ();
|
m_mlibqs->append (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -262,6 +263,7 @@ XMMSHandler::medialib_select (XMMSResultDictList *res)
|
||||||
|
|
||||||
emit medialibResponse (res->getCID (), l);
|
emit medialibResponse (res->getCID (), l);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
XMMSHandler::playlist_changed (XMMSResultDict *res)
|
XMMSHandler::playlist_changed (XMMSResultDict *res)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef __XMMS_HANDLER_H__
|
#ifndef __XMMS_HANDLER_H__
|
||||||
#define __XMMS_HANDLER_H__
|
#define __XMMS_HANDLER_H__
|
||||||
|
|
||||||
#include <xmmsclient/xmmsclient++.h>
|
#include "xmmsclient_promoe.h"
|
||||||
|
|
||||||
#include "XmmsQT4.h"
|
#include "XmmsQT4.h"
|
||||||
|
|
||||||
|
@ -34,8 +34,10 @@ class XMMSHandler : public QObject, public sigc::trackable {
|
||||||
void playlistAddURL (QString);
|
void playlistAddURL (QString);
|
||||||
void playlistRemove (uint pos) { delete m_xmmsc->playlist_remove (pos); }
|
void playlistRemove (uint pos) { delete m_xmmsc->playlist_remove (pos); }
|
||||||
void playlistMove (uint pos, uint newpos) { delete m_xmmsc->playlist_move (pos, newpos); }
|
void playlistMove (uint pos, uint newpos) { delete m_xmmsc->playlist_move (pos, newpos); }
|
||||||
|
/*
|
||||||
uint medialibQuery (QString);
|
uint medialibQuery (QString);
|
||||||
void medialibQueryAdd (QString q) { delete m_xmmsc->medialib_add_to_playlist (q.toUtf8 ()); }
|
void medialibQueryAdd (QString q) { delete m_xmmsc->medialib_add_to_playlist (q.toUtf8 ()); }
|
||||||
|
*/
|
||||||
void volumeGet (void);
|
void volumeGet (void);
|
||||||
void volumeSet (uint volume);
|
void volumeSet (uint volume);
|
||||||
|
|
||||||
|
@ -69,7 +71,9 @@ class XMMSHandler : public QObject, public sigc::trackable {
|
||||||
void playlistList (const QList<uint> &);
|
void playlistList (const QList<uint> &);
|
||||||
void currentID (uint);
|
void currentID (uint);
|
||||||
void playlistChanged (const QHash<QString, QString> &);
|
void playlistChanged (const QHash<QString, QString> &);
|
||||||
|
/*
|
||||||
void medialibResponse (uint, const QList<QHash<QString, QString> > &);
|
void medialibResponse (uint, const QList<QHash<QString, QString> > &);
|
||||||
|
*/
|
||||||
void getVolume (uint);
|
void getVolume (uint);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
19
promoe.pro
19
promoe.pro
|
@ -19,14 +19,11 @@ SOURCES += XmmsQT4.cpp \
|
||||||
PlaylistList.cpp \
|
PlaylistList.cpp \
|
||||||
SkinChooser.cpp \
|
SkinChooser.cpp \
|
||||||
PlaylistShade.cpp \
|
PlaylistShade.cpp \
|
||||||
Medialib.cpp \
|
|
||||||
qtmd5.cpp \
|
qtmd5.cpp \
|
||||||
SettingsWindow.cpp \
|
SettingsWindow.cpp \
|
||||||
MediaArtistList.cpp \
|
|
||||||
MediaAlbumList.cpp \
|
|
||||||
MediaSongList.cpp \
|
|
||||||
PlaylistMenu.cpp \
|
PlaylistMenu.cpp \
|
||||||
VolumeSlider.cpp
|
VolumeSlider.cpp \
|
||||||
|
xmmsclient_promoe.cpp
|
||||||
|
|
||||||
HEADERS += XmmsQT4.h \
|
HEADERS += XmmsQT4.h \
|
||||||
PixWidget.h \
|
PixWidget.h \
|
||||||
|
@ -38,7 +35,7 @@ HEADERS += XmmsQT4.h \
|
||||||
Button.h \
|
Button.h \
|
||||||
TextBar.h \
|
TextBar.h \
|
||||||
NumberDisplay.h \
|
NumberDisplay.h \
|
||||||
TimeDisplay.h \
|
TimeDisplay.h \
|
||||||
XMMSHandler.h \
|
XMMSHandler.h \
|
||||||
SmallNumberDisplay.h \
|
SmallNumberDisplay.h \
|
||||||
StereoMono.h \
|
StereoMono.h \
|
||||||
|
@ -49,14 +46,12 @@ HEADERS += XmmsQT4.h \
|
||||||
PlaylistList.h \
|
PlaylistList.h \
|
||||||
SkinChooser.h \
|
SkinChooser.h \
|
||||||
PlaylistShade.h \
|
PlaylistShade.h \
|
||||||
Medialib.h \
|
|
||||||
qtmd5.h \
|
qtmd5.h \
|
||||||
SettingsWindow.h \
|
SettingsWindow.h \
|
||||||
MediaArtistList.h \
|
|
||||||
MediaAlbumList.h \
|
|
||||||
MediaSongList.h \
|
|
||||||
PlaylistMenu.h \
|
PlaylistMenu.h \
|
||||||
VolumeSlider.h
|
VolumeSlider.h \
|
||||||
|
xmmsclient_promoe.h \
|
||||||
|
xmmsclient_methods.h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +67,7 @@ CONFIG += link_pkgconfig
|
||||||
;QMAKE_CXXFLAGS += -g
|
;QMAKE_CXXFLAGS += -g
|
||||||
;CONFIG += debug warn_on
|
;CONFIG += debug warn_on
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
|
||||||
PKGCONFIG += xmms2-client xmms2-client-cpp sigc++-2.0
|
PKGCONFIG += xmms2-client sigc++-2.0
|
||||||
|
|
||||||
;CONFIG += avahi
|
;CONFIG += avahi
|
||||||
|
|
||||||
|
|
66
xmmsclient_methods.h
Normal file
66
xmmsclient_methods.h
Normal file
|
@ -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<uint> *playlist_list (void) { return new XMMSResultValueList<uint> (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<uint> *playlist_current_pos (void) { return new XMMSResultValue<uint> (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<uint> *broadcast_playlist_current_pos (void) { return new XMMSResultValue<uint> (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<uint> *playback_current_id (void) { return new XMMSResultValue<uint> (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<uint> *playback_playtime (void) { return new XMMSResultValue<uint> (xmmsc_playback_playtime (m_xmmsc)); }
|
||||||
|
XMMSResultValue<uint> *playback_status (void) { return new XMMSResultValue<uint> (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<uint> *broadcast_playback_status (void) { return new XMMSResultValue<uint> (xmmsc_broadcast_playback_status (m_xmmsc)); }
|
||||||
|
XMMSResultValue<uint> *broadcast_playback_current_id (void) { return new XMMSResultValue<uint> (xmmsc_broadcast_playback_current_id (m_xmmsc)); }
|
||||||
|
XMMSResultValue<uint> *signal_playback_playtime (void) { return new XMMSResultValue<uint> (xmmsc_signal_playback_playtime (m_xmmsc)); }
|
||||||
|
XMMSResult *configval_set (char * x,char * y) { return new XMMSResult (xmmsc_configval_set (m_xmmsc, x, y)); }
|
||||||
|
XMMSResultValueList<char*> *configval_list (void) { return new XMMSResultValueList<char*> (xmmsc_configval_list (m_xmmsc)); }
|
||||||
|
XMMSResultValue<char*> *configval_get (char * x) { return new XMMSResultValue<char*> (xmmsc_configval_get (m_xmmsc, x)); }
|
||||||
|
XMMSResult *configval_register (char * x,char * y) { return new XMMSResult (xmmsc_configval_register (m_xmmsc, x, y)); }
|
||||||
|
XMMSResultValue<char*> *broadcast_configval_changed (void) { return new XMMSResultValue<char*> (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<char*> *medialib_playlists_list (void) { return new XMMSResultValueList<char*> (xmmsc_medialib_playlists_list (m_xmmsc)); }
|
||||||
|
XMMSResultValueList<uint> *medialib_playlist_list (const char * x) { return new XMMSResultValueList<uint> (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<uint> *broadcast_medialib_entry_changed (void) { return new XMMSResultValue<uint> (xmmsc_broadcast_medialib_entry_changed (m_xmmsc)); }
|
||||||
|
XMMSResult *broadcast_medialib_playlist_loaded (void) { return new XMMSResult (xmmsc_broadcast_medialib_playlist_loaded (m_xmmsc)); }
|
||||||
|
#endif
|
112
xmmsclient_promoe.cpp
Normal file
112
xmmsclient_promoe.cpp
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
#include <xmmsclient/xmmsclient.h>
|
||||||
|
#include <sigc++/sigc++.h>
|
||||||
|
|
||||||
|
#include "xmmsclient_promoe.h"
|
||||||
|
|
||||||
|
static
|
||||||
|
void generic_handler (xmmsc_result_t *res, void *userdata)
|
||||||
|
{
|
||||||
|
XMMSResult* r = static_cast<XMMSResult*>(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<void, XMMSResult*>& 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<const char *> *i (static_cast<list<const char*>*>(udata));
|
||||||
|
i->push_front (static_cast<const char*>(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
list<const char *>
|
||||||
|
XMMSResultDict::getDictKeys (void)
|
||||||
|
{
|
||||||
|
list<const char *> i;
|
||||||
|
|
||||||
|
xmmsc_result_dict_foreach (m_res, dict_foreach, static_cast<void*>(&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<const char *> *i (static_cast<list<const char*>*>(udata));
|
||||||
|
i->push_front (static_cast<const char*>(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
list<const char *>
|
||||||
|
XMMSResultDict::getPropDictKeys (void)
|
||||||
|
{
|
||||||
|
list<const char *> i;
|
||||||
|
|
||||||
|
xmmsc_result_propdict_foreach (m_res, propdict_foreach, static_cast<void*>(&i));
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
XMMSResult::~XMMSResult ()
|
||||||
|
{
|
||||||
|
xmmsc_result_unref (m_res);
|
||||||
|
}
|
199
xmmsclient_promoe.h
Normal file
199
xmmsclient_promoe.h
Normal file
|
@ -0,0 +1,199 @@
|
||||||
|
#ifndef __XMMSCLIENTPP_H
|
||||||
|
#define __XMMSCLIENTPP_H
|
||||||
|
|
||||||
|
#include <sigc++/sigc++.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <xmmsclient/xmmsclient.h>
|
||||||
|
|
||||||
|
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<void, XMMSResult*>& slot_);
|
||||||
|
void emit (void) { m_signal.emit(this); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
xmmsc_result_t *m_res;
|
||||||
|
|
||||||
|
bool m_inited;
|
||||||
|
sigc::signal<void, XMMSResult*> 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<void, XMMSResultDict*>& slot_) {
|
||||||
|
XMMSResult::connect(sigc::retype(slot_));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list<const char*> getPropDictKeys ();
|
||||||
|
std::list<const char*> 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 T>
|
||||||
|
class XMMSResultValue : public XMMSResult
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XMMSResultValue (xmmsc_result_t* res) : XMMSResult(res) { }
|
||||||
|
XMMSResultValue (const XMMSResultValue<T> &src) : XMMSResult(src) { }
|
||||||
|
virtual ~XMMSResultValue () { }
|
||||||
|
|
||||||
|
void connect (const sigc::slot<void, XMMSResultValue<T>*>& slot_) = 0;
|
||||||
|
bool getValue (T *var) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class XMMSResultValue<int> : public XMMSResult
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XMMSResultValue (xmmsc_result_t* res) : XMMSResult(res) { }
|
||||||
|
XMMSResultValue (const XMMSResultValue<int> &src) : XMMSResult(src) { }
|
||||||
|
virtual ~XMMSResultValue () { }
|
||||||
|
|
||||||
|
void connect (const sigc::slot<void, XMMSResultValue<int>*>& slot_) {
|
||||||
|
XMMSResult::connect(sigc::retype(slot_));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getValue (int *var) { return xmmsc_result_get_int (m_res, var); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class XMMSResultValue<uint> : public XMMSResult
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XMMSResultValue (xmmsc_result_t* res) : XMMSResult(res) { }
|
||||||
|
XMMSResultValue (const XMMSResultValue<uint> &src) : XMMSResult(src) { }
|
||||||
|
virtual ~XMMSResultValue () { }
|
||||||
|
|
||||||
|
void connect (const sigc::slot<void, XMMSResultValue<uint>*>& slot_) {
|
||||||
|
XMMSResult::connect(sigc::retype(slot_));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getValue (uint *var) { return xmmsc_result_get_uint (m_res, var); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class XMMSResultValue<char*> : public XMMSResult
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XMMSResultValue (xmmsc_result_t* res) : XMMSResult(res) { }
|
||||||
|
XMMSResultValue (const XMMSResultValue<char*> &src) : XMMSResult(src) { }
|
||||||
|
virtual ~XMMSResultValue () { }
|
||||||
|
|
||||||
|
void connect (const sigc::slot<void, XMMSResultValue<char*>*>& slot_) {
|
||||||
|
XMMSResult::connect(sigc::retype(slot_));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getValue (char **var) { return xmmsc_result_get_string (m_res, var); }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class XMMSResultValueList : public XMMSResultList, public XMMSResultValue<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XMMSResultValueList (xmmsc_result_t* res)
|
||||||
|
: XMMSResultList(res), XMMSResultValue<T>(res) { }
|
||||||
|
XMMSResultValueList (const XMMSResultValueList<T> &src)
|
||||||
|
: XMMSResultList(src), XMMSResultValue<T>(src) { }
|
||||||
|
virtual ~XMMSResultValueList() { }
|
||||||
|
|
||||||
|
void connect (const sigc::slot<void, XMMSResultValueList<T>*>& 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<void, XMMSResultDictList*>& 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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue