remove some now unused code from XMMSHandler and clean up headers

This commit is contained in:
Thomas Frauendorfer 2008-02-11 19:28:07 +01:00
parent ced09fc049
commit f10cd0465a
41 changed files with 407 additions and 242 deletions

3
lib/README Normal file
View file

@ -0,0 +1,3 @@
Contains a copy of some of Esperanzas src/lib/ directory
Will perhaps someday become a seperate lib

View file

@ -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

View file

@ -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

View file

@ -26,6 +26,8 @@
#include <QFileInfo>
#include "playlistmodel.h"
#include "xclient.h"
#include "xclientcache.h"
PlaylistModel::PlaylistModel (QObject *parent, XClient *client, const QString &name) : QAbstractItemModel (parent)
{

View file

@ -20,13 +20,13 @@
#include <xmmsclient/xmmsclient++.h>
class XClient;
#include <QAbstractTableModel>
#include <QVariant>
#include <QHash>
#include <QIcon>
#include "xclient.h"
/**
* @class PlaylistModel playlistmodel.h
* @brief A model that represents a playlist on the server

View file

@ -24,7 +24,10 @@
#include <QSettings>
#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;
}

View file

@ -20,32 +20,16 @@
#include <xmmsclient/xmmsclient++.h>
class XClient;
#include <QObject>
#include <QHash>
#include <QVariant>
#include <QDir>
#include <QWidget>
#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;

View file

@ -16,6 +16,7 @@
#include "xclientcache.h"
#include "xclient.h"
#include <QObject>
#include <QIcon>
@ -26,10 +27,11 @@
#include <QPixmapCache>
#include <QSettings>
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<QString, QVariant>
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<QString, QVariant> ();
}

View file

@ -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 <QObject>
#include <QIcon>
#include <QPixmap>
#include <QHash>
#include <QList>
#include <QVariant>
#include <QPixmapCache>
class QIcon;
class QPixmap;
//#include <QPixmapCache>
class XClientCache : public QObject
{
Q_OBJECT
public:
XClientCache (QObject *, XClient *);
XClientCache (XClient *);
QHash<QString, QVariant> get_info (uint32_t id);
QIcon get_icon (uint32_t id);

View file

@ -13,43 +13,28 @@
* GNU General Public License for more details.
*/
#include <xmmsclient/xmmsclient++.h>
#include "xcollection.h"
#include "xcollection_p.h"
#include "xclient.h"
#include <QHash>
#include <QString>
#include <QStringList>
#include <QUrl>
#include <QVariant>
XCollection::XCollection (XClient * client) : QObject ( client)
/*
* Private implemention to hide <xmmsclient/xmmsclient++> 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<QString, QVariant> 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 (),

View file

@ -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 <QObject>
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

51
lib/xcollection_p.h Normal file
View file

@ -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 <xmmsclient/xmmsclient++.h>
#include "xcollection.h"
#include <QObject>
#include <QStringList>
#include <QString>
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

View file

@ -17,8 +17,10 @@
#include <xmmsclient/xmmsclient++.h>
#include "xconfig.h"
#include "xclient.h"
#include <QList>
#include <QVariant>
XConfig::XConfig (XClient *parent) : QObject (parent)
{

View file

@ -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 <QObject>
#include <QHash>

88
lib/xplayback.cpp Normal file
View file

@ -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 <xmmsclient/xmmsclient++.h>
#include "xplayback.h"
#include "xclient.h"
#include <xmmsclient/xmmsclient++/playback.h>
#include <xmmsclient/xmmsclient++/playlist.h>
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);
}

49
lib/xplayback.h Normal file
View file

@ -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 <QObject>
/**
* @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

View file

@ -16,17 +16,15 @@
#ifndef __BROWSEDIALOG_H__
#define __BROWSEDIALOG_H__
#include "BrowseModel.h"
class BrowseModel;
#include <QDialog>
#include <QTreeView>
#include <QListView>
#include <QGridLayout>
#include <QPushButton>
#include <QLabel>
#include <QComboBox>
#include <QLineEdit>
#include <QItemSelectionModel>
class QTreeView;
class QComboBox;
class QLineEdit;
class QItemSelectionModel;
class QModelIndex;
class QString;
class BrowseDialog : public QDialog
{

View file

@ -20,7 +20,7 @@
#include <QString>
#include <QIcon>
#include <QWidget>
#include <QStyle>
bool
BrowseModelItem::itemCompare (BrowseModelItem *s1, BrowseModelItem *s2)

View file

@ -20,9 +20,9 @@
#include <QHash>
#include <QString>
#include <QStyle>
#include <QStringList>
#include <QAbstractTableModel>
class QStyle;
class BrowseModelItem
{

View file

@ -17,11 +17,14 @@
#include "mainwindow.h"
#include "Display.h"
#include "Skin.h"
#include "TitleBar.h"
#include "FileDialog.h"
#include <QMouseEvent>
SkinDisplay::SkinDisplay (QWidget *parent) : QWidget(parent)
{
Skin *skin = Skin::getInstance ();

View file

@ -16,16 +16,12 @@
#ifndef __SKINDISPLAY_H__
#define __SKINDISPLAY_H__
#include <iostream>
#include <QPixmap>
#include <QPainter>
#include <QWidget>
#include <QHash>
#include <QMouseEvent>
#include <QPaintEvent>
class QEvent;
class QMouseEvent;
class QPaintEvent;
#include "Skin.h"
class Skin;
class SkinDisplay : public QWidget
{

View file

@ -16,6 +16,9 @@
#include "Skin.h"
#include "PixWidget.h"
#include <QPainter>
#include <QPixmap>
PixWidget::PixWidget (QWidget *parent) : QWidget (parent)
{
Skin *skin = Skin::getInstance();

View file

@ -16,11 +16,8 @@
#ifndef __PIXWIDGET_H__
#define __PIXWIDGET_H__
#include <iostream>
#include <QPixmap>
#include <QPainter>
#include <QWidget>
class QPixmap;
class Skin;

View file

@ -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

View file

@ -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 ();

View file

@ -19,6 +19,7 @@
#include "maindisplay.h"
#include "TimeDisplay.h"
#include "NumberDisplay.h"
#include "Skin.h"
#include <QPen>

View file

@ -23,6 +23,7 @@
#include "settingsdialog.h"
#include "Button.h"
#include "BrowseDialog.h"
#include "Skin.h"
#include <QMenu>

View file

@ -21,6 +21,7 @@ class TitleBar;
#include "PixWidget.h"
class Button;
class Skin;
class TitleBar : public PixWidget
{

View file

@ -22,7 +22,7 @@ class Button;
#include "Button.h"
#include "PixWidget.h"
#include "Skin.h"
class Skin;
class SliderButton : public Button
{

View file

@ -25,9 +25,6 @@
#include <QErrorMessage>
#include <QHash>
#include <QFile>
#include <QFileDialog>
#include <QDir>
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 () ();
}

View file

@ -23,7 +23,6 @@
#include <QObject>
#include <QHash>
#include <QTimer>
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<QHash<QString, QString> > &);
@ -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<QString, QString> &hash);

View file

@ -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 <QUrl>
#include "urlopen.h"

View file

@ -20,6 +20,7 @@
#include "mainwindow.h"
#include "Button.h"
#include "Skin.h"
#include "VolumeSlider.h"

View file

@ -15,6 +15,9 @@
#include <xmmsclient/xmmsclient++.h>
#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);

View file

@ -26,6 +26,7 @@
#include "shadeddisplay.h"
#include "equalizerwindow.h"
#include "Button.h"
#include "Skin.h"
#include <QSettings>
#include <QIcon>

View file

@ -15,6 +15,8 @@
#include <xmmsclient/xmmsclient++.h>
#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 &)));
}

View file

@ -14,6 +14,7 @@
*/
#include "playlistmenu.h"
#include "Skin.h"
#include <QMouseEvent>
#include <QWidget>

View file

@ -19,16 +19,13 @@
class PlaylistMenu;
#include "XMMSHandler.h"
#include "Skin.h"
#include "PixWidget.h"
/*
#include <QWidget>
#include <QPixmap>
*/
#include "Skin.h"
class PlaylistMenu;
#include <QObject>
class QWidget;
class PlaylistMenuBar : public PixWidget {
Q_OBJECT
public:

View file

@ -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

View file

@ -17,10 +17,12 @@
// FIXME should not need those two
#include <xmmsclient/xmmsclient++.h>
#include "XMMSHandler.h"
#include "xplayback.h"
#include "playlistview.h"
#include "playlistmodel.h"
#include "playlistwidget.h"
#include "Skin.h"
#include <QColor>
#include <QMenu>
@ -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 ();
}
}

View file

@ -19,11 +19,12 @@
//include "Playlist.h"
#include <xmmsclient/xmmsclient++.h>
#include "Skin.h"
class Skin;
#include <QObject>
#include <QAbstractItemDelegate>
#include <QListView>
#include <QWidget>
class QWidget;
class PlaylistDelegate : public QAbstractItemDelegate {
Q_OBJECT