diff --git a/lib/README b/lib/README new file mode 100644 index 0000000..2e9d043 --- /dev/null +++ b/lib/README @@ -0,0 +1,3 @@ +Contains a copy of some of Esperanzas src/lib/ directory + +Will perhaps someday become a seperate lib diff --git a/lib/TODO b/lib/TODO deleted file mode 100644 index c3aca4c..0000000 --- a/lib/TODO +++ /dev/null @@ -1,4 +0,0 @@ -Contains a copy of some of Esperanzas src/lib/ directory -Will have to be removed as soon as those files become a seperate lib - -Redo XSettings with something better diff --git a/lib/lib.pro b/lib/lib.pro index 9e78fc2..99aee24 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -8,6 +8,7 @@ OBJECTS_DIR = .obj SOURCES += xclient.cpp \ xclientcache.cpp \ xconfig.cpp \ + xplayback.cpp \ xcollection.cpp \ playlistmodel.cpp \ xmmsqt4.cpp @@ -16,7 +17,9 @@ SOURCES += xclient.cpp \ HEADERS += xclient.h \ xclientcache.h \ xconfig.h \ + xplayback.h \ xcollection.h \ + xcollection_p.h \ playlistmodel.h \ xmmsqt4.h \ debug.h diff --git a/lib/playlistmodel.cpp b/lib/playlistmodel.cpp index 90b25bb..3df76bf 100644 --- a/lib/playlistmodel.cpp +++ b/lib/playlistmodel.cpp @@ -26,6 +26,8 @@ #include #include "playlistmodel.h" +#include "xclient.h" +#include "xclientcache.h" PlaylistModel::PlaylistModel (QObject *parent, XClient *client, const QString &name) : QAbstractItemModel (parent) { diff --git a/lib/playlistmodel.h b/lib/playlistmodel.h index 1bfbf17..6f3b1cc 100644 --- a/lib/playlistmodel.h +++ b/lib/playlistmodel.h @@ -20,13 +20,13 @@ #include +class XClient; + #include #include #include #include -#include "xclient.h" - /** * @class PlaylistModel playlistmodel.h * @brief A model that represents a playlist on the server diff --git a/lib/xclient.cpp b/lib/xclient.cpp index 554786b..6ff0765 100644 --- a/lib/xclient.cpp +++ b/lib/xclient.cpp @@ -24,7 +24,10 @@ #include #include "xclient.h" +#include "xclientcache.h" +#include "xplayback.h" #include "xcollection.h" +#include "xconfig.h" #include "xmmsqt4.h" #include "debug.h" @@ -53,6 +56,7 @@ XClient::qToStd (const QString &str) return std::string (str.toUtf8 ().data ()); } +/* QDir XClient::esperanza_dir () { @@ -68,13 +72,15 @@ XClient::esperanza_dir () } return QDir (); } +*/ XClient::XClient (QObject *parent, const std::string &name) : QObject (parent), m_sync (name + "-sync") { m_client = NULL; m_isconnected = false; - m_cache = new XClientCache (this, this); + m_cache = new XClientCache (this); m_config = new XConfig (this); + m_playback = new XPlayback (this); m_collection = new XCollection (this); m_name = name; } diff --git a/lib/xclient.h b/lib/xclient.h index 9d41273..9ef784f 100644 --- a/lib/xclient.h +++ b/lib/xclient.h @@ -20,32 +20,16 @@ #include -class XClient; - #include #include #include -#include -#include - -#include "xclientcache.h" -#include "xconfig.h" +class QWidget; +class XClientCache; class XConfig; +class XPlayback; class XCollection; -/* -class XSettings : public QObject -{ - Q_OBJECT - public: - XSettings (QObject *); - void change_settings (); - - signals: - void settingsChanged (); -}; -*/ class XClient : public QObject { Q_OBJECT @@ -53,7 +37,8 @@ class XClient : public QObject { XClient (QObject *, const std::string &); void disconnect (); - bool connect (const char *path = NULL, const bool &sync = false, QWidget* parent = NULL); + bool connect (const char *path = NULL, const bool &sync = false, + QWidget* parent = NULL); static void propDictToQHash (const std::string &key, const Xmms::Dict::Variant &value, const std::string &source, @@ -74,6 +59,10 @@ class XClient : public QObject { return m_config; }; + XPlayback *xplayback () const { + return m_playback; + } + XCollection *xcollection () const { return m_collection; } @@ -89,7 +78,7 @@ class XClient : public QObject { return m_isconnected; }; - static QDir esperanza_dir (); +// static QDir esperanza_dir (); void setDisconnectCallback (const Xmms::DisconnectCallback::slot_type &slot) { m_client->setDisconnectCallback (slot); } const Xmms::Collection* collection () { if (m_client && m_client->isConnected ()) return &m_client->collection; else return NULL; } const Xmms::Playlist* playlist () { if (m_client && m_client->isConnected ()) return &m_client->playlist; else return NULL; } @@ -111,6 +100,7 @@ class XClient : public QObject { // Xmms::Client *m_client; XClientCache *m_cache; XConfig *m_config; + XPlayback *m_playback; XCollection *m_collection; bool m_isconnected; diff --git a/lib/xclientcache.cpp b/lib/xclientcache.cpp index 653074b..3966a75 100644 --- a/lib/xclientcache.cpp +++ b/lib/xclientcache.cpp @@ -16,6 +16,7 @@ #include "xclientcache.h" +#include "xclient.h" #include #include @@ -26,10 +27,11 @@ #include #include -XClientCache::XClientCache (QObject *parent, XClient *client) : QObject (parent) +XClientCache::XClientCache (XClient *client) : QObject (client) { QSettings s; - connect (client, SIGNAL (gotConnection (XClient *)), this, SLOT (got_connection (XClient *))); + connect (client, SIGNAL (gotConnection (XClient *)), + this, SLOT (got_connection (XClient *))); QPixmapCache::setCacheLimit (s.value ("core/pixmapcache").toInt ()); } @@ -37,10 +39,13 @@ void XClientCache::got_connection (XClient *client) { m_client = client; - client->playback ()->signalPlaytime () (Xmms::bind (&XClientCache::handle_playtime, this)); - client->playback ()->getPlaytime () (Xmms::bind (&XClientCache::handle_playtime, this)); + client->playback ()->signalPlaytime () ( + Xmms::bind (&XClientCache::handle_playtime, this)); + client->playback ()->getPlaytime () ( + Xmms::bind (&XClientCache::handle_playtime, this)); - client->medialib ()->broadcastEntryChanged () (Xmms::bind (&XClientCache::handle_mlib_entry_changed, this)); + client->medialib ()->broadcastEntryChanged () ( + Xmms::bind (&XClientCache::handle_mlib_entry_changed, this)); } bool @@ -129,7 +134,7 @@ XClientCache::get_pixmap (uint32_t id) if (!QPixmapCache::find (hash, p)) { m_client->bindata ()->retrieve (hash.toStdString ()) ( - boost::bind (&XClientCache::handle_bindata, this, _1, hash)); + boost::bind (&XClientCache::handle_bindata, this, _1, hash)); QPixmapCache::insert (hash, QPixmap ()); m_icon_map[hash].append (id); } @@ -143,8 +148,10 @@ QHash XClientCache::get_info (uint32_t id) { if (!m_info.contains (id)) { - m_client->medialib ()->getInfo (id) (Xmms::bind (&XClientCache::handle_medialib_info, this), - boost::bind (&XClientCache::handle_medialib_info_error, this, _1, id)); + m_client->medialib ()->getInfo (id) ( + Xmms::bind (&XClientCache::handle_medialib_info, this), + boost::bind (&XClientCache::handle_medialib_info_error, + this, _1, id)); m_info[id] = QHash (); } diff --git a/lib/xclientcache.h b/lib/xclientcache.h index 9df7fa9..73e74b6 100644 --- a/lib/xclientcache.h +++ b/lib/xclientcache.h @@ -18,23 +18,31 @@ #ifndef __XCLIENTCACHE_H__ #define __XCLIENTCACHE_H__ -class XClientCache; +// for Xmms::bin definition +#include "xmmsclient/xmmsclient++/result.h" -#include "xclient.h" +class XClient; +namespace Xmms { + class Dict; + class PropDict; +} +// class XClientCache; + +// #include "xclient.h" #include -#include -#include #include #include #include -#include +class QIcon; +class QPixmap; +//#include class XClientCache : public QObject { Q_OBJECT public: - XClientCache (QObject *, XClient *); + XClientCache (XClient *); QHash get_info (uint32_t id); QIcon get_icon (uint32_t id); diff --git a/lib/xcollection.cpp b/lib/xcollection.cpp index a4bdf93..edb0805 100644 --- a/lib/xcollection.cpp +++ b/lib/xcollection.cpp @@ -13,43 +13,28 @@ * GNU General Public License for more details. */ +#include + #include "xcollection.h" +#include "xcollection_p.h" +#include "xclient.h" #include #include +#include #include +#include -XCollection::XCollection (XClient * client) : QObject ( client) +/* + * Private implemention to hide from collection.h + */ + +XCollection::Private::Private (XCollection *collection) : QObject (collection) { - m_client = client; - - connect (client, SIGNAL (gotConnection (XClient *)), - this, SLOT (on_connect (XClient *))); - - if (client->isConnected ()) { - on_connect (client); - } -} - -void -XCollection::on_connect (XClient *client) -{ - client->collection ()->broadcastCollectionChanged () - (Xmms::bind (&XCollection::on_collection_modified, this)); - - client->collection ()->list ("Playlists") - (Xmms::bind (&XCollection::handle_playlists_list, this)); - - client->playlist ()->currentActive () - (Xmms::bind (&XCollection::handle_active_pls_changed, this)); - client->playlist ()->broadcastLoaded () - (Xmms::bind (&XCollection::handle_active_pls_changed, this)); - - m_client = client; } bool -XCollection::on_collection_modified (const Xmms::Dict &value) +XCollection::Private::on_collection_modified (const Xmms::Dict &value) { QString newname = QString (); QHash tmp = XClient::convert_dict (value); @@ -99,6 +84,48 @@ XCollection::on_collection_modified (const Xmms::Dict &value) return true; } + + +/* + * The XCollection class + */ +XCollection::XCollection (XClient * client) : QObject ( client) +{ + m_client = client; + d = new XCollection::Private (this); + + connect (client, SIGNAL (gotConnection (XClient *)), + this, SLOT (on_connect (XClient *))); + + // emit signals from private implementation as our own + connect (d, SIGNAL (collectionModified(QString, QString, int, QString)), + this, SIGNAL (collectionModified(QString, QString, int, QString))); + connect (d, SIGNAL (activePlaylistChanged (QString, QString)), + this, SIGNAL (activePlaylistChanged (QString, QString))); + + + if (client->isConnected ()) { + on_connect (client); + } +} + +void +XCollection::on_connect (XClient *client) +{ + client->collection ()->broadcastCollectionChanged () + (Xmms::bind (&XCollection::Private::on_collection_modified, d)); + + client->collection ()->list ("Playlists") + (Xmms::bind (&XCollection::Private::handle_playlists_list, d)); + + client->playlist ()->currentActive () + (Xmms::bind (&XCollection::Private::handle_active_pls_changed, d)); + client->playlist ()->broadcastLoaded () + (Xmms::bind (&XCollection::Private::handle_active_pls_changed, d)); + + m_client = client; +} + bool XCollection::remove (QString name, QString ns) { if (!m_client->isConnected ()) return false; @@ -111,9 +138,15 @@ XCollection::remove (QString name, QString ns) { /* * idList (Playlist) stuff */ +QString +XCollection::activePlaylist () +{ + return d->m_activePlaylist; +} + bool -XCollection::handle_playlists_list (const Xmms::List< std::string > &list) +XCollection::Private::handle_playlists_list (const Xmms::List< std::string > &list) { m_playlists.clear (); @@ -130,7 +163,7 @@ QStringList XCollection::list (QString ns) { // FIXME: use the ns parameter. // We will need to handle querying the serverside playlists bettter... - return m_playlists; + return d->m_playlists; } @@ -145,7 +178,7 @@ XCollection::setActivePlaylist (QString name) { } bool -XCollection::handle_active_pls_changed (const std::string &name) { +XCollection::Private::handle_active_pls_changed (const std::string &name) { QString tmp = m_activePlaylist; m_activePlaylist = XClient::stdToQ (name); @@ -173,7 +206,7 @@ XCollection::playlistAddUrl (QUrl url, QString plsname) } if (plsname == "") { - plsname = m_activePlaylist; + plsname = d->m_activePlaylist; } m_client->playlist ()->addUrl (url.toString ().toStdString (), diff --git a/lib/xcollection.h b/lib/xcollection.h index f978a83..e610d82 100644 --- a/lib/xcollection.h +++ b/lib/xcollection.h @@ -13,14 +13,14 @@ * GNU General Public License for more details. */ -#ifndef __XCollection_H__ -#define __XCollection_H__ +#ifndef __XCOLLECTION_H__ +#define __XCOLLECTION_H__ -#include "xclient.h" +class XClient; #include -class QString; class QStringList; +class QString; class QUrl; class XCollection : public QObject @@ -32,9 +32,10 @@ class XCollection : public QObject QStringList list (QString ns = "Playlists"); bool remove (QString name, QString ns); + // idlist specific bool setActivePlaylist (QString name); - QString activePlaylist () {return m_activePlaylist;} + QString activePlaylist (); bool addIdlist (QString name); bool playlistAddUrl (QUrl url, QString plsname = ""); @@ -48,14 +49,10 @@ class XCollection : public QObject void on_connect (XClient *); private: - bool on_collection_modified (const Xmms::Dict &value); - bool handle_playlists_list (const Xmms::List< std::string > &list); - bool handle_active_pls_changed (const std::string &name); + class Private; + Private* d; XClient *m_client; - QStringList m_playlists; - - QString m_activePlaylist; }; #endif diff --git a/lib/xcollection_p.h b/lib/xcollection_p.h new file mode 100644 index 0000000..f1e6939 --- /dev/null +++ b/lib/xcollection_p.h @@ -0,0 +1,51 @@ +/** + * This file is a part of Promoe + * + * Copyright (C) 2008 Thomas Frauendorfer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +// these headers are placed in here, so that the moc files are created and +// that these Objects can emit signals + +#ifndef __XCOLLECTION_P_H__ +#define __XCOLLECTION_P_H__ + +#include + +#include "xcollection.h" + +#include +#include +#include + +class XCollection::Private : public QObject { + Q_OBJECT + + public: + Private (XCollection *collection); + + bool on_collection_modified (const Xmms::Dict &value); + bool handle_playlists_list (const Xmms::List< std::string > &list); + bool handle_active_pls_changed (const std::string &name); + + QStringList m_playlists; + QString m_activePlaylist; + + signals: + void collectionModified (QString collection, QString ns, int type, + QString newname); + + void activePlaylistChanged (QString newActive, QString oldActive); +}; + +#endif diff --git a/lib/xconfig.cpp b/lib/xconfig.cpp index 47ff5c0..6ee57cd 100644 --- a/lib/xconfig.cpp +++ b/lib/xconfig.cpp @@ -17,8 +17,10 @@ #include #include "xconfig.h" +#include "xclient.h" #include +#include XConfig::XConfig (XClient *parent) : QObject (parent) { diff --git a/lib/xconfig.h b/lib/xconfig.h index a8cdaab..592eed8 100644 --- a/lib/xconfig.h +++ b/lib/xconfig.h @@ -14,10 +14,13 @@ * GNU General Public License for more details. */ -#ifndef __XConfig__ -#define __XConfig__ +#ifndef __XConfig_H__ +#define __XConfig_H__ -#include "xclient.h" +class XClient; +namespace Xmms { + class Dict; +} #include #include diff --git a/lib/xplayback.cpp b/lib/xplayback.cpp new file mode 100644 index 0000000..719be10 --- /dev/null +++ b/lib/xplayback.cpp @@ -0,0 +1,88 @@ +/** + * This file is a part of Promoe, an XMMS2 Client. + * + * Copyright (C) 2008 Thomas Frauendorfer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include + +#include "xplayback.h" +#include "xclient.h" + +#include +#include + +XPlayback::XPlayback (XClient *client) +{ + m_client = client; +} + +void +XPlayback::play () +{ + if (!m_client->isConnected ()) return; + + m_client->playback ()->start (); +} + +void +XPlayback::pause () +{ + if (!m_client->isConnected ()) return; + + m_client->playback ()->pause (); +} + +void +XPlayback::stop () +{ + if (!m_client->isConnected ()) return; + + m_client->playback ()->stop (); +} + +void +XPlayback::prev () +{ + if (!m_client->isConnected ()) return; + + m_client->playlist ()->setNextRel (-1); + m_client->playback ()->tickle (); +} + +void +XPlayback::next () +{ + if (!m_client->isConnected ()) return; + + m_client->playlist ()->setNextRel (1); + m_client->playback ()->tickle (); +} + + +void +XPlayback::seekMs (uint milliseconds) +{ + if (!m_client->isConnected ()) return; + + m_client->playback ()->seekMs (milliseconds); +} + +void +XPlayback::seekMsRel (int milliseconds) +{ + if (!m_client->isConnected ()) return; + + m_client->playback ()->seekMsRel (milliseconds); +} + diff --git a/lib/xplayback.h b/lib/xplayback.h new file mode 100644 index 0000000..605c8cb --- /dev/null +++ b/lib/xplayback.h @@ -0,0 +1,49 @@ +/** + * This file is a part of Promoe, an XMMS2 Client. + * + * Copyright (C) 2008 Thomas Frauendorfer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __XPLAYBACK_H__ +#define __XPLAYBACK_H__ + +class XClient; + +#include + +/** + * @class XPlayback + * @brief Thin wrapper around Xmms::Playback providing QT Signals and Slots + * + */ +class XPlayback : public QObject { + Q_OBJECT + + public: + XPlayback (XClient *); + + public slots: + void play (); + void pause (); + void stop (); + void prev (); + void next (); + + void seekMs (uint milliseconds); + void seekMsRel (int milliseconds); + + private: + XClient *m_client; +}; + +#endif diff --git a/src/BrowseDialog.h b/src/BrowseDialog.h index 6f4fa12..cc4f6a1 100644 --- a/src/BrowseDialog.h +++ b/src/BrowseDialog.h @@ -16,17 +16,15 @@ #ifndef __BROWSEDIALOG_H__ #define __BROWSEDIALOG_H__ -#include "BrowseModel.h" +class BrowseModel; #include -#include -#include -#include -#include -#include -#include -#include -#include +class QTreeView; +class QComboBox; +class QLineEdit; +class QItemSelectionModel; +class QModelIndex; +class QString; class BrowseDialog : public QDialog { diff --git a/src/BrowseModel.cpp b/src/BrowseModel.cpp index ff8ed60..59c9491 100644 --- a/src/BrowseModel.cpp +++ b/src/BrowseModel.cpp @@ -20,7 +20,7 @@ #include #include #include - +#include bool BrowseModelItem::itemCompare (BrowseModelItem *s1, BrowseModelItem *s2) diff --git a/src/BrowseModel.h b/src/BrowseModel.h index abab703..a4a5df0 100644 --- a/src/BrowseModel.h +++ b/src/BrowseModel.h @@ -20,9 +20,9 @@ #include #include -#include #include #include +class QStyle; class BrowseModelItem { diff --git a/src/Display.cpp b/src/Display.cpp index 0f4049e..f396176 100644 --- a/src/Display.cpp +++ b/src/Display.cpp @@ -17,11 +17,14 @@ #include "mainwindow.h" #include "Display.h" +#include "Skin.h" #include "TitleBar.h" #include "FileDialog.h" +#include + SkinDisplay::SkinDisplay (QWidget *parent) : QWidget(parent) { Skin *skin = Skin::getInstance (); diff --git a/src/Display.h b/src/Display.h index cfe5534..759738b 100644 --- a/src/Display.h +++ b/src/Display.h @@ -16,16 +16,12 @@ #ifndef __SKINDISPLAY_H__ #define __SKINDISPLAY_H__ -#include - -#include -#include #include -#include -#include -#include +class QEvent; +class QMouseEvent; +class QPaintEvent; -#include "Skin.h" +class Skin; class SkinDisplay : public QWidget { diff --git a/src/PixWidget.cpp b/src/PixWidget.cpp index f8c74e4..ba56eca 100644 --- a/src/PixWidget.cpp +++ b/src/PixWidget.cpp @@ -16,6 +16,9 @@ #include "Skin.h" #include "PixWidget.h" +#include +#include + PixWidget::PixWidget (QWidget *parent) : QWidget (parent) { Skin *skin = Skin::getInstance(); diff --git a/src/PixWidget.h b/src/PixWidget.h index 3e2dca8..9789ffb 100644 --- a/src/PixWidget.h +++ b/src/PixWidget.h @@ -16,11 +16,8 @@ #ifndef __PIXWIDGET_H__ #define __PIXWIDGET_H__ -#include - -#include -#include #include +class QPixmap; class Skin; diff --git a/src/PosBar.cpp b/src/PosBar.cpp index 4463813..b88515e 100644 --- a/src/PosBar.cpp +++ b/src/PosBar.cpp @@ -14,6 +14,7 @@ */ #include "XMMSHandler.h" +#include "xplayback.h" #include "mainwindow.h" @@ -173,7 +174,7 @@ PosBar::setPos (uint p) void PosBar::requestPos (float value) { - XMMSHandler::getInstance ().setPlaytime (m_max * value); + XMMSHandler::getInstance ().xplayback ()->seekMs (m_max * value); } void diff --git a/src/TextBar.cpp b/src/TextBar.cpp index 6d4d121..5c0c772 100644 --- a/src/TextBar.cpp +++ b/src/TextBar.cpp @@ -48,7 +48,7 @@ TextScroller::TextScroller (QWidget *parent, uint w, m_x2_off = 0; m_fontsize = s.value ("fontsize").toInt (); m_ttf = s.value ("ttf").toBool (); - m_text = "Promoe 0.1"; + m_text = "Promoe " PROMOE_VERSION; m_scroll = s.value ("scroll").toBool (); s.endGroup (); diff --git a/src/TimeDisplay.cpp b/src/TimeDisplay.cpp index b678cde..cd26a02 100644 --- a/src/TimeDisplay.cpp +++ b/src/TimeDisplay.cpp @@ -19,6 +19,7 @@ #include "maindisplay.h" #include "TimeDisplay.h" #include "NumberDisplay.h" +#include "Skin.h" #include diff --git a/src/TitleBar.cpp b/src/TitleBar.cpp index 1d1499a..4e5bdf4 100644 --- a/src/TitleBar.cpp +++ b/src/TitleBar.cpp @@ -23,6 +23,7 @@ #include "settingsdialog.h" #include "Button.h" #include "BrowseDialog.h" +#include "Skin.h" #include diff --git a/src/TitleBar.h b/src/TitleBar.h index 244b844..87b21ab 100644 --- a/src/TitleBar.h +++ b/src/TitleBar.h @@ -21,6 +21,7 @@ class TitleBar; #include "PixWidget.h" class Button; +class Skin; class TitleBar : public PixWidget { diff --git a/src/VolumeSlider.h b/src/VolumeSlider.h index 4360dd5..77a2b8b 100644 --- a/src/VolumeSlider.h +++ b/src/VolumeSlider.h @@ -22,7 +22,7 @@ class Button; #include "Button.h" #include "PixWidget.h" -#include "Skin.h" +class Skin; class SliderButton : public Button { diff --git a/src/XMMSHandler.cpp b/src/XMMSHandler.cpp index 2cf5191..55b1e7f 100644 --- a/src/XMMSHandler.cpp +++ b/src/XMMSHandler.cpp @@ -25,9 +25,6 @@ #include #include -#include -#include -#include XMMSHandler &XMMSHandler::getInstance () { @@ -64,15 +61,22 @@ XMMSHandler::connect_handler (const char *ipcpath, const bool &sync, QWidget *pa connect(ipcpath, sync, parent); using Xmms::bind; - m_client->medialib.broadcastEntryChanged () (bind (&XMMSHandler::medialib_entry_changed, this)); + m_client->medialib.broadcastEntryChanged () ( + bind (&XMMSHandler::medialib_entry_changed, this)); - m_client->playback.currentID () (bind (&XMMSHandler::playback_current_id, this)); - m_client->playback.broadcastCurrentID () (bind (&XMMSHandler::playback_current_id, this)); + m_client->playback.currentID () ( + bind (&XMMSHandler::playback_current_id, this)); + m_client->playback.broadcastCurrentID () ( + bind (&XMMSHandler::playback_current_id, this)); - m_client->playback.getStatus () (bind (&XMMSHandler::playback_status, this)); - m_client->playback.broadcastStatus () (bind (&XMMSHandler::playback_status, this)); - m_client->playback.broadcastVolumeChanged () (bind (&XMMSHandler::volume_changed, this)); + m_client->playback.getStatus () ( + bind (&XMMSHandler::playback_status, this)); + m_client->playback.broadcastStatus () ( + bind (&XMMSHandler::playback_status, this)); + + m_client->playback.broadcastVolumeChanged () ( + bind (&XMMSHandler::volume_changed, this)); return true; } @@ -98,30 +102,14 @@ XMMSHandler::playlistAddURL (const QString &s) { m_client->playlist.addUrl (s.toAscii ().constData ()) (); } -void -XMMSHandler::playlistRemove (uint pos) -{ - m_client->playlist.removeEntry (pos) (); -} - -void -XMMSHandler::playlistMove (uint pos, uint newpos) -{ - m_client->playlist.moveEntry (pos, newpos) (); -} void XMMSHandler::requestMediainfo (uint id) { - m_client->medialib.getInfo (id) (Xmms::bind (&XMMSHandler::medialib_info, this)); + m_client->medialib.getInfo (id) ( + Xmms::bind (&XMMSHandler::medialib_info, this)); } -/* -void -XMMSHandler::requestPlaylistList () -{ -// m_client->playlist.listEntries () (Xmms::bind (&XMMSHandler::playlist_list, this)); -} -*/ + void XMMSHandler::requestTrackChange (int pos) { @@ -129,13 +117,6 @@ XMMSHandler::requestTrackChange (int pos) m_client->playback.tickle () (); } -bool -XMMSHandler::playlist_list (const Xmms::List< unsigned int > &playlist) -{ - emit playlistList (playlist); - return false; -} - bool XMMSHandler::playback_status (const Xmms::Playback::Status &status) { @@ -146,21 +127,15 @@ XMMSHandler::playback_status (const Xmms::Playback::Status &status) bool XMMSHandler::playback_current_id (const unsigned int &id) { - m_currentid = id; + m_currentid = id; - if (id > 0) { - requestMediainfo (id); - } + if (id > 0) { + requestMediainfo (id); + } - emit currentID(id); - return true; + return true; } -void -XMMSHandler::setPlaytime (uint pos) -{ - m_client->playback.seekMs (pos) (); -} void XMMSHandler::DictToQHash (const std::string &key, @@ -221,13 +196,6 @@ XMMSHandler::medialib_select (XMMSResultDictList *res) } */ -bool -XMMSHandler::playlist_changed (const Xmms::Dict &list) -{ - emit playlistChanged (list); - return true; -} - bool XMMSHandler::medialib_info (const Xmms::PropDict &propdict) { @@ -310,31 +278,3 @@ void XMMSHandler::playlistClear () { m_client->playlist.clear () (); } - -void XMMSHandler::play () -{ - m_client->playback.start () (); -} - -void XMMSHandler::stop () -{ - m_client->playback.stop () (); -} - -void XMMSHandler::pause () -{ - m_client->playback.pause () (); -} - -void XMMSHandler::next () -{ - m_client->playlist.setNextRel (1) (); - m_client->playback.tickle () (); -} - -void XMMSHandler::prev () -{ - m_client->playlist.setNextRel (-1) (); - m_client->playback.tickle () (); -} - diff --git a/src/XMMSHandler.h b/src/XMMSHandler.h index 39d4f51..45efe56 100644 --- a/src/XMMSHandler.h +++ b/src/XMMSHandler.h @@ -23,7 +23,6 @@ #include #include -#include class PlaylistModel; @@ -37,20 +36,15 @@ class XMMSHandler : public XClient { bool connect_handler (const char *ipcpath = NULL, const bool &sync = false, QWidget *parent = NULL); - bool playlist_list (const Xmms::List< unsigned int > &playlist); bool playback_current_id (const unsigned int &id); bool medialib_info (const Xmms::PropDict &propdict); bool medialib_entry_changed (const unsigned int &id); bool playback_status (const Xmms::Playback::Status &status); bool volume_changed (const Xmms::Dict &levels); - bool playlist_changed (const Xmms::Dict &list); void requestMediainfo (uint id); -// void requestPlaylistList (); void requestTrackChange (int pos); void playlistAddURL (const QString& url); - void playlistRemove (uint pos); - void playlistMove (uint pos, uint newpos); /* void medialib_select (XMMSResultDictList *res); @@ -73,24 +67,14 @@ class XMMSHandler : public XClient { PlaylistModel *getPlaylistModel () {return m_playlist_model; } public slots: - void setPlaytime (uint pos); - void playlistClear (); - void play (); - void stop (); - void pause (); - void next (); - void prev (); void volumeSet (uint volume); signals: void settingsSaved (); void playbackStatusChanged (Xmms::Playback::Status status); - void playtimeChanged (uint time); void mediainfoChanged (uint, const Xmms::PropDict &); void currentSong (const Xmms::PropDict &); - void playlistList (const Xmms::List< unsigned int > &); - void currentID (uint); void playlistChanged (const Xmms::Dict &); /* void medialibResponse (uint, const QList > &); @@ -98,8 +82,6 @@ class XMMSHandler : public XClient { void getVolume (uint); private: - QTimer m_playtime_timer; - void DictToQHash (const std::string &key, const Xmms::Dict::Variant &value, QHash &hash); diff --git a/src/dialogs/urlopen.cpp b/src/dialogs/urlopen.cpp index 492096a..2952411 100644 --- a/src/dialogs/urlopen.cpp +++ b/src/dialogs/urlopen.cpp @@ -14,10 +14,6 @@ * GNU General Public License for more details. */ -// FIXME: because somewhere something with the includes is wrons, this line -// is needed -#include "XMMSHandler.h" - #include #include "urlopen.h" diff --git a/src/equalizer/equalizerwidget.cpp b/src/equalizer/equalizerwidget.cpp index 8aef95e..158dad3 100644 --- a/src/equalizer/equalizerwidget.cpp +++ b/src/equalizer/equalizerwidget.cpp @@ -20,6 +20,7 @@ #include "mainwindow.h" #include "Button.h" +#include "Skin.h" #include "VolumeSlider.h" diff --git a/src/mainwindow/maindisplay.cpp b/src/mainwindow/maindisplay.cpp index b34cde7..4394fc4 100644 --- a/src/mainwindow/maindisplay.cpp +++ b/src/mainwindow/maindisplay.cpp @@ -15,6 +15,9 @@ #include #include "XMMSHandler.h" +#include "xclientcache.h" +#include "xplayback.h" + #include "maindisplay.h" #include "mainwindow.h" @@ -259,28 +262,28 @@ MainDisplay::toggleTime (void) void MainDisplay::SetupPushButtons (void) { - XMMSHandler &xmmsh = XMMSHandler::getInstance (); + XMMSHandler &client = XMMSHandler::getInstance (); /* Normal buttons */ m_prev = new Button (this, Skin::BTN_PREV_0, Skin::BTN_PREV_1); m_prev->move(16, 88); - connect (m_prev, SIGNAL(clicked()), &xmmsh, SLOT(prev())); + connect (m_prev, SIGNAL(clicked()), client.xplayback (), SLOT(prev ())); m_play = new Button (this, Skin::BTN_PLAY_0, Skin::BTN_PLAY_1); m_play->move(39, 88); - connect (m_play, SIGNAL(clicked()), &xmmsh, SLOT(play())); + connect (m_play, SIGNAL(clicked()), client.xplayback (), SLOT(play ())); m_pause = new Button (this, Skin::BTN_PAUSE_0, Skin::BTN_PAUSE_1); m_pause->move(62, 88); - connect (m_pause, SIGNAL(clicked()), &xmmsh, SLOT(pause())); + connect (m_pause, SIGNAL(clicked()), client.xplayback (), SLOT(pause ())); m_stop = new Button (this, Skin::BTN_STOP_0, Skin::BTN_STOP_1); m_stop->move(85, 88); - connect (m_stop, SIGNAL(clicked()), &xmmsh, SLOT(stop())); + connect (m_stop, SIGNAL(clicked()), client.xplayback (), SLOT(stop ())); m_next = new Button (this, Skin::BTN_NEXT_0, Skin::BTN_NEXT_1); m_next->move(108, 88); - connect (m_next, SIGNAL(clicked()), &xmmsh, SLOT(next())); + connect (m_next, SIGNAL(clicked()), client.xplayback (), SLOT(next ())); m_eject = new Button (this, Skin::BTN_EJECT_0, Skin::BTN_EJECT_1); m_eject->move(136, 89); diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 8b49bdb..fa83e02 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -26,6 +26,7 @@ #include "shadeddisplay.h" #include "equalizerwindow.h" #include "Button.h" +#include "Skin.h" #include #include diff --git a/src/mainwindow/shadeddisplay.cpp b/src/mainwindow/shadeddisplay.cpp index 850a49e..2dd48c8 100644 --- a/src/mainwindow/shadeddisplay.cpp +++ b/src/mainwindow/shadeddisplay.cpp @@ -15,6 +15,8 @@ #include #include "XMMSHandler.h" +#include "xclientcache.h" +#include "xplayback.h" #include "shadeddisplay.h" #include "TitleBar.h" @@ -25,7 +27,7 @@ ShadedDisplay::ShadedDisplay (QWidget *parent) : SkinDisplay (parent) { - XMMSHandler &xmmsh = XMMSHandler::getInstance (); + XMMSHandler &client = XMMSHandler::getInstance (); setMinimumSize (275, 14); setMaximumSize (275, 14); @@ -47,38 +49,38 @@ ShadedDisplay::ShadedDisplay (QWidget *parent) : SkinDisplay (parent) m_prev = new Button (this); m_prev->move(169, 4); m_prev->resize (8, 7); - connect (m_prev, SIGNAL(clicked()), &xmmsh, SLOT(prev())); + connect (m_prev, SIGNAL(clicked()), client.xplayback (), SLOT(prev ())); m_play = new Button (this); m_play->move(177, 4); m_play->resize (10, 7); - connect (m_play, SIGNAL(clicked()), &xmmsh, SLOT(play())); + connect (m_play, SIGNAL(clicked()), client.xplayback (), SLOT(play ())); m_pause = new Button (this); m_pause->move(187, 4); m_pause->resize (10, 7); - connect (m_pause, SIGNAL(clicked()), &xmmsh, SLOT(pause())); + connect (m_pause, SIGNAL(clicked()), client.xplayback (), SLOT(pause ())); m_stop = new Button (this); m_stop->move(197, 4); m_stop->resize (9, 7); - connect (m_stop, SIGNAL(clicked()), &xmmsh, SLOT(stop())); + connect (m_stop, SIGNAL(clicked()), client.xplayback (), SLOT(stop ())); m_next = new Button (this); m_next->move(206, 4); m_next->resize (8, 7); - connect (m_next, SIGNAL(clicked()), &xmmsh, SLOT(next())); + connect (m_next, SIGNAL(clicked()), client.xplayback (), SLOT(next ())); m_eject = new Button (this); m_eject->move(216, 4); m_eject->resize (9, 7); connect (m_eject, SIGNAL(clicked()), this, SLOT(fileOpen())); - connect (&xmmsh, SIGNAL(playbackStatusChanged(Xmms::Playback::Status)), + connect (&client, SIGNAL(playbackStatusChanged(Xmms::Playback::Status)), this, SLOT(setStatus(Xmms::Playback::Status))); - connect (xmmsh.cache (), SIGNAL (playtime (uint32_t)), + connect (client.cache (), SIGNAL (playtime (uint32_t)), this, SLOT ( setPlaytime(uint32_t))); - connect (&xmmsh, SIGNAL(currentSong (const Xmms::PropDict &)), + connect (&client, SIGNAL(currentSong (const Xmms::PropDict &)), this, SLOT(setMediainfo (const Xmms::PropDict &))); } diff --git a/src/playlist/playlistmenu.cpp b/src/playlist/playlistmenu.cpp index aaa8726..346af68 100644 --- a/src/playlist/playlistmenu.cpp +++ b/src/playlist/playlistmenu.cpp @@ -14,6 +14,7 @@ */ #include "playlistmenu.h" +#include "Skin.h" #include #include diff --git a/src/playlist/playlistmenu.h b/src/playlist/playlistmenu.h index 56bda44..30d5748 100644 --- a/src/playlist/playlistmenu.h +++ b/src/playlist/playlistmenu.h @@ -19,16 +19,13 @@ class PlaylistMenu; #include "XMMSHandler.h" -#include "Skin.h" #include "PixWidget.h" - -/* -#include -#include -*/ - +#include "Skin.h" class PlaylistMenu; +#include +class QWidget; + class PlaylistMenuBar : public PixWidget { Q_OBJECT public: diff --git a/src/playlist/playlistshade.cpp b/src/playlist/playlistshade.cpp index 19cebb5..ae5bead 100644 --- a/src/playlist/playlistshade.cpp +++ b/src/playlist/playlistshade.cpp @@ -40,7 +40,7 @@ PlaylistShade::PlaylistShade (QWidget *parent) : QWidget (parent) connect (&xmmsh, SIGNAL(settingsSaved ()), this, SLOT(settingsSaved ())); - m_text = "Promoe 0.1 - A very neat XMMS2 client"; + m_text = "Promoe " PROMOE_VERSION " - A very neat XMMS2 client"; } void diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index fa3eb82..4a9c244 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -17,10 +17,12 @@ // FIXME should not need those two #include #include "XMMSHandler.h" +#include "xplayback.h" #include "playlistview.h" #include "playlistmodel.h" #include "playlistwidget.h" +#include "Skin.h" #include #include @@ -272,6 +274,6 @@ PlaylistView::mouseDoubleClickEvent (QMouseEvent *event) xmmsh.requestTrackChange (index.row()); if (m_status == XMMS_PLAYBACK_STATUS_STOP || m_status == XMMS_PLAYBACK_STATUS_PAUSE) { - xmmsh.play (); + xmmsh.xplayback ()->play (); } } diff --git a/src/playlist/playlistview.h b/src/playlist/playlistview.h index 10cbd6a..6a884c2 100644 --- a/src/playlist/playlistview.h +++ b/src/playlist/playlistview.h @@ -19,11 +19,12 @@ //include "Playlist.h" #include -#include "Skin.h" +class Skin; + #include #include #include -#include +class QWidget; class PlaylistDelegate : public QAbstractItemDelegate { Q_OBJECT