[general] "poor programming style" fix
[libxmms2client-qt.git] / medialib.h
blob2014775f9436dabf1929524f9f80336d9ff4a58d
1 //
2 // C++ Interface: medialib
3 //
4 // Author: Oliver Groß <z.o.gross@gmx.de>, (C) 2008
5 //
6 // Copyright: See COPYING file that comes with this distribution
7 //
8 #ifndef XMMSQT_MEDIALIB_H
9 #define XMMSQT_MEDIALIB_H
11 #include <QObject>
12 #include <QHash>
13 #include <xmmsclient/xmmsclient.h>
15 namespace XmmsQt {
16 class QClient;
17 class QPlaylist;
19 struct MediaInfo {
20 quint16 tracknr;
21 QString title;
22 QString artist;
23 QString album;
24 QString genre;
25 //QString comment;
26 QString url;
27 quint32 channels;
28 quint32 sampleRate;
29 quint32 sampleFormat;
30 quint32 duration;
33 typedef QHash<quint32, MediaInfo *> QMediaInfoHash;
34 typedef QHash<QString, QPlaylist *> QPlaylistHash;
36 class QMedialib : public QObject {
37 Q_OBJECT
38 private:
39 xmmsc_connection_t * m_Connection;
40 QMediaInfoHash m_CachedMedia;
41 QPlaylistHash m_Playlists;
42 QPlaylist * m_ActivePlaylist;
44 static void recievedMediaInfoCallback(xmmsc_result_t * result, void * instance);
45 static void updatedMediaInfoCallback(xmmsc_result_t * result, void * instance);
47 static void playlistChangedCallback(xmmsc_result_t * result, void * instance);
48 static void activePlaylistCallback(xmmsc_result_t * result, void * instance);
49 static void currentPosCallback(xmmsc_result_t * result, void * instance);
50 static void collectionChangedCallback(xmmsc_result_t * result, void * instance);
51 static void fillPlaylists(xmmsc_result_t *, void * instance);
52 public slots:
53 void setActivePlaylist(QString name);
54 private slots:
55 void setConnection(xmmsc_connection_t * connection);
56 //void setActivePlaylist(QPlaylist * playlist);
57 public:
58 QMedialib(QClient * parent);
59 ~QMedialib();
61 const QMediaInfoHash & media() { return m_CachedMedia; }
62 const QPlaylistHash & playlists() { return m_Playlists; }
63 QPlaylist * activePlaylist() const { return m_ActivePlaylist; };
65 void clearMediaInfo();
66 void removeMediaInfo(quint32 id);
67 void requestMediaInfo(quint32 id);
68 bool checkMediaInfo(quint32 id);
69 //void resetPlaylists();
70 signals:
71 void mediaInfoReady(quint32 id);
72 void activePlaylistChanged();
73 void collectionAdded(QString name);
74 void collectionRemoved(QString name);
75 void collectionUpdated(QString name);
76 void collectionRenamed(QString oldName, QString newName);
77 void playlistsReseted();
81 #endif