OTHER: get rid of XMMSHandler and update classes using it
This commit is contained in:
parent
786b745d55
commit
982660510a
33 changed files with 145 additions and 266 deletions
|
@ -30,6 +30,7 @@
|
|||
#include "xconfig.h"
|
||||
#include "xmmsqt4.h"
|
||||
#include "debug.h"
|
||||
#include "playlistmodel.h"
|
||||
|
||||
#include "sourcepref.h"
|
||||
|
||||
|
@ -71,6 +72,7 @@ XClient::XClient (QObject *parent, const std::string &name) : QObject (parent),
|
|||
m_config = new XConfig (this);
|
||||
m_playback = new XPlayback (this);
|
||||
m_collection = new XCollection (this);
|
||||
m_active_playlist = new PlaylistModel(this, this, "_active");
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ class XClientCache;
|
|||
class XConfig;
|
||||
class XPlayback;
|
||||
class XCollection;
|
||||
class PlaylistModel;
|
||||
|
||||
#define SOURCEPREF_HACK
|
||||
|
||||
|
@ -72,6 +73,10 @@ class XClient : public QObject {
|
|||
return m_collection;
|
||||
}
|
||||
|
||||
PlaylistModel *active_playlist () const {
|
||||
return m_active_playlist;
|
||||
}
|
||||
|
||||
const Xmms::Client *sync () const {
|
||||
return &m_sync;
|
||||
};
|
||||
|
@ -93,6 +98,9 @@ class XClient : public QObject {
|
|||
const Xmms::Config* config () { if (m_client && m_client->isConnected ()) return &m_client->config; else return NULL; }
|
||||
const Xmms::Stats* stats () { if (m_client && m_client->isConnected ()) return &m_client->stats; else return NULL; }
|
||||
|
||||
// TODO: remove as soon as it's no longer neede
|
||||
Xmms::Client *getClient () {return m_client;}
|
||||
|
||||
signals:
|
||||
void gotConnection (XClient *);
|
||||
void disconnected (XClient *);
|
||||
|
@ -111,7 +119,8 @@ class XClient : public QObject {
|
|||
XConfig *m_config;
|
||||
XPlayback *m_playback;
|
||||
XCollection *m_collection;
|
||||
bool m_isconnected;
|
||||
PlaylistModel *m_active_playlist;
|
||||
bool m_isconnected;
|
||||
|
||||
Xmms::Client m_sync;
|
||||
};
|
||||
|
|
|
@ -210,6 +210,19 @@ XCollection::addIdlist (QString name) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
XCollection::playlistAddUrl (QString url, QString plsname)
|
||||
{
|
||||
if (plsname == "") {
|
||||
plsname = d->m_activePlaylist;
|
||||
}
|
||||
|
||||
m_client->playlist ()->addUrl (url.toStdString (),
|
||||
plsname.toStdString ());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
XCollection::playlistAddUrl (QUrl url, QString plsname)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ class XCollection : public QObject
|
|||
// idlist spesific
|
||||
bool setActivePlaylist (QString name);
|
||||
bool addIdlist (QString name);
|
||||
bool playlistAddUrl (QString url, QString plsname = "");
|
||||
bool playlistAddUrl (QUrl url, QString plsname = "");
|
||||
bool playlistClear (QString name = "");
|
||||
bool addPlsFile (QUrl url);
|
||||
|
|
|
@ -49,6 +49,8 @@ class XPlayback : public QObject {
|
|||
|
||||
void seekMs (uint milliseconds);
|
||||
void seekMsRel (int milliseconds);
|
||||
// Helper to directly connect sliders to this class
|
||||
void seekMs (int milliseconds) {seekMs ((uint) milliseconds);};
|
||||
|
||||
void setVolume (int new_volume);
|
||||
void setBalance (int new_balance);
|
||||
|
|
|
@ -13,9 +13,12 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include "BrowseModel.h"
|
||||
#include "BrowseDialog.h"
|
||||
#include "xclient.h"
|
||||
#include "xcollection.h"
|
||||
|
||||
#include "application.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QSettings>
|
||||
|
@ -169,12 +172,12 @@ BrowseDialog::navigateToPrevious ()
|
|||
void
|
||||
BrowseDialog::setPath (const QModelIndex &index)
|
||||
{
|
||||
XMMSHandler &handler = XMMSHandler::getInstance ();
|
||||
XClient *client = App->client ();
|
||||
BrowseModelItem *item = m_model->itemByIndex (index);
|
||||
if (item->isDir ()) {
|
||||
m_model->setPath (index);
|
||||
} else {
|
||||
handler.playlistAddURL (item->data("path"));
|
||||
client->xcollection ()->playlistAddUrl (item->data("path"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include "xclient.h"
|
||||
#include "BrowseModel.h"
|
||||
|
||||
#include "application.h"
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QString>
|
||||
#include <QIcon>
|
||||
|
@ -36,7 +38,7 @@ BrowseModel::BrowseModel (QWidget *parent) : QAbstractTableModel ()
|
|||
{
|
||||
m_columns.append ("Name");
|
||||
m_style = parent->style ();
|
||||
m_client = XMMSHandler::getInstance ().getClient ();
|
||||
m_client = App->client ()->getClient ();
|
||||
m_filter_dot = true;
|
||||
//list_root ();
|
||||
}
|
||||
|
|
|
@ -63,9 +63,9 @@ ServerBrowserList::connectServer (QListWidgetItem *it)
|
|||
{
|
||||
ServerBrowserWindow *sw = dynamic_cast<ServerBrowserWindow*> (window ());
|
||||
|
||||
XMMSHandler *xmmsh = XMMSHandler::getInstance ();
|
||||
XClient *client = App->client ();
|
||||
ServerItem *item = dynamic_cast<ServerItem*> (it);
|
||||
if (xmmsh->connect (item->path ().toAscii())) {
|
||||
if (client->connect (item->path ().toAscii())) {
|
||||
sw->close ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#ifndef __SERVER_BROWSER_H__
|
||||
#define __SERVER_BROWSER_H__
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include "xclient.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QListWidget>
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
/**
|
||||
* This file is a part of Promoe, an XMMS2 Client.
|
||||
*
|
||||
* Copyright (C) 2005-2008 XMMS2 Team
|
||||
*
|
||||
* 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; version 2 of the License.
|
||||
*
|
||||
* 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 "xmmsqt4.h"
|
||||
#include "XMMSHandler.h"
|
||||
#include "playlistmodel.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <QErrorMessage>
|
||||
#include <QHash>
|
||||
|
||||
XMMSHandler &XMMSHandler::getInstance ()
|
||||
{
|
||||
static XMMSHandler singleton(NULL, "Promoe_Main");
|
||||
return singleton;
|
||||
}
|
||||
|
||||
XMMSHandler::XMMSHandler (QObject *parent, const std::string &name) : XClient (parent, name)
|
||||
{
|
||||
connect_handler();
|
||||
}
|
||||
|
||||
bool
|
||||
XMMSHandler::connect_handler (const char *ipcpath, const bool &sync, QWidget *parent)
|
||||
{
|
||||
//TODO must be moved elsewere later
|
||||
m_playlist_model = new PlaylistModel(NULL, this, "_active");
|
||||
|
||||
connect(ipcpath, sync, parent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
XMMSHandler::playlistAddURL (const QString &s)
|
||||
{
|
||||
m_client->playlist.addUrl (s.toAscii ().constData ()) ();
|
||||
}
|
||||
|
||||
void
|
||||
XMMSHandler::DictToQHash (const std::string &key,
|
||||
const Xmms::Dict::Variant &value,
|
||||
QHash<QString, QString> &hash)
|
||||
{
|
||||
if (value.type () == typeid (int32_t)) {
|
||||
hash.insert (QString::fromLatin1 (key.c_str ()),
|
||||
QString::number (boost::get< int32_t > (value)));
|
||||
} else if (value.type () == typeid (uint32_t)) {
|
||||
hash.insert (QString::fromLatin1 (key.c_str ()),
|
||||
QString::number (boost::get< uint32_t > (value)));
|
||||
} else if (value.type () == typeid (std::string)) {
|
||||
hash.insert (QString::fromLatin1 (key.c_str ()),
|
||||
QString::fromUtf8 (boost::get< std::string > (value).c_str ()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/**
|
||||
* This file is a part of Promoe, an XMMS2 Client.
|
||||
*
|
||||
* Copyright (C) 2005-2008 XMMS2 Team
|
||||
*
|
||||
* 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; version 2 of the License.
|
||||
*
|
||||
* 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 __XMMS_HANDLER_H__
|
||||
#define __XMMS_HANDLER_H__
|
||||
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
|
||||
#include "xclient.h"
|
||||
#include "xmmsqt4.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QHash>
|
||||
|
||||
class PlaylistModel;
|
||||
|
||||
class XMMSHandler : public XClient {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static XMMSHandler &getInstance ();
|
||||
|
||||
XMMSHandler (QObject *parent, const std::string &name);
|
||||
~XMMSHandler () {};
|
||||
|
||||
bool connect_handler (const char *ipcpath = NULL, const bool &sync = false, QWidget *parent = NULL);
|
||||
|
||||
void playlistAddURL (const QString& url);
|
||||
|
||||
/*
|
||||
void medialib_select (XMMSResultDictList *res);
|
||||
*/
|
||||
/*
|
||||
uint medialibQuery (QString);
|
||||
void medialibQueryAdd (QString q) { delete m_xmmsc->medialib_add_to_playlist (q.toUtf8 ()); }
|
||||
*/
|
||||
|
||||
Xmms::Client *getClient () { return m_client; }
|
||||
|
||||
PlaylistModel *getPlaylistModel () {return m_playlist_model; }
|
||||
|
||||
private:
|
||||
void DictToQHash (const std::string &key,
|
||||
const Xmms::Dict::Variant &value,
|
||||
QHash<QString, QString> &hash);
|
||||
PlaylistModel *m_playlist_model;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include "xclient.h"
|
||||
|
||||
#include "application.h"
|
||||
|
||||
|
@ -35,12 +35,11 @@ Application::Application (int &argc, char **argv) : QApplication (argc, argv)
|
|||
setOrganizationDomain("xmms.org");
|
||||
setApplicationName("Promoe");
|
||||
|
||||
//TODO: Change to XClient sometime later
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
m_xmms2_client = new XClient (this, "Promoe");
|
||||
|
||||
connect (this, SIGNAL (aboutToQuit ()),
|
||||
this, SLOT (cleanupHandler ()));
|
||||
connect (&client, SIGNAL(disconnected(XClient *)),
|
||||
connect (m_xmms2_client, SIGNAL(disconnected(XClient *)),
|
||||
this, SLOT(handleDisconnected ()));
|
||||
|
||||
QSettings settings;
|
||||
|
@ -65,6 +64,8 @@ Application::Application (int &argc, char **argv) : QApplication (argc, argv)
|
|||
mw->getEQ ()->setVisible (settings.value ("equalizer/visible", false).toBool ());
|
||||
mw->getPL ()->setVisible (settings.value ("playlist/visible", false).toBool ());
|
||||
|
||||
m_xmms2_client->connect ();
|
||||
|
||||
#ifdef HAVE_SERVERBROWSER
|
||||
ServerBrowserWindow *browser = new ServerBrowserWindow (mw);
|
||||
browser->show ();
|
||||
|
@ -82,7 +83,7 @@ Application::cleanupHandler ()
|
|||
s.setValue("MainWindow/timemodereverse",m_timemode_reverse);
|
||||
|
||||
if (s.value ("promoe/quitonclose", false).toBool ())
|
||||
XMMSHandler::getInstance ().shutdownServer ();
|
||||
m_xmms2_client->shutdownServer ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include <QApplication>
|
||||
|
||||
class XClient;
|
||||
|
||||
class Application;
|
||||
#if defined(qApp)
|
||||
#undef qApp
|
||||
|
@ -32,11 +34,15 @@ class Application : public QApplication
|
|||
public:
|
||||
Application (int &argc, char **argv);
|
||||
|
||||
XClient *client () const {return m_xmms2_client;}
|
||||
|
||||
public slots:
|
||||
void cleanupHandler ();
|
||||
void handleDisconnected ();
|
||||
|
||||
private:
|
||||
XClient *m_xmms2_client;
|
||||
|
||||
// TODO: Search some better place for those methods
|
||||
public:
|
||||
bool isTimemodeReverse(void) {return m_timemode_reverse;}
|
||||
|
|
|
@ -14,9 +14,8 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
// FIXME: because somewhere something with the includes is wrong, this line
|
||||
// is needed
|
||||
#include "XMMSHandler.h"
|
||||
// Needed for XMMS_COLLECTION_CHANGED_* defines
|
||||
#include <xmmsc/xmmsc_idnumbers.h>
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
|
|
|
@ -13,11 +13,12 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include "xclient.h"
|
||||
#include "xconfig.h"
|
||||
|
||||
#include "equalizerwidget.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "mainwindow.h"
|
||||
#include "pixmapbutton.h"
|
||||
#include "pixmapslider.h"
|
||||
|
@ -52,8 +53,8 @@ EqualizerSlider::on_self_slider_moved (int value)
|
|||
EqualizerWidget::EqualizerWidget (QWidget *parent) : QWidget (parent)
|
||||
{
|
||||
Skin *skin = Skin::getInstance ();
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
m_xconfig = client.xconfig ();
|
||||
const XClient *client = App->client ();
|
||||
m_xconfig = client->xconfig ();
|
||||
|
||||
connect (skin, SIGNAL(skinChanged(Skin *)),
|
||||
this, SLOT(setPixmaps(Skin *)));
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
|
||||
#include "equalizerwindow.h"
|
||||
|
||||
#include "QWidget"
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
#include "XMMSHandler.h"
|
||||
#include "xclient.h"
|
||||
#include "xclientcache.h"
|
||||
#include "xplayback.h"
|
||||
#include "xconfig.h"
|
||||
|
@ -43,8 +42,8 @@
|
|||
|
||||
MainDisplay::MainDisplay (MainWindow *parent) : SkinDisplay(parent)
|
||||
{
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
m_xconfig = client.xconfig ();
|
||||
const XClient *client = App->client ();
|
||||
m_xconfig = client->xconfig ();
|
||||
Skin* skin = Skin::getInstance ();
|
||||
|
||||
connect (skin, SIGNAL (skinChanged (Skin *)),
|
||||
|
@ -56,7 +55,7 @@ MainDisplay::MainDisplay (MainWindow *parent) : SkinDisplay(parent)
|
|||
|
||||
m_mw = parent;
|
||||
|
||||
SetupPushButtons ();
|
||||
SetupPushButtons (client);
|
||||
SetupToggleButtons ();
|
||||
|
||||
m_text = new TextScroller (this, 154, 12, "main");
|
||||
|
@ -90,6 +89,8 @@ MainDisplay::MainDisplay (MainWindow *parent) : SkinDisplay(parent)
|
|||
Skin::POSBAR_BTN_0,
|
||||
Skin::POSBAR_BTN_1);
|
||||
m_posbar->move (skin->getPos (Skin::SLIDER_POSBAR_BGS));
|
||||
connect (m_posbar, SIGNAL (sliderMoved (int)),
|
||||
client->xplayback (), SLOT (seekMs (int)));
|
||||
|
||||
m_playstatus = new PlayStatus (this);
|
||||
m_playstatus->move (24, 28);
|
||||
|
@ -100,10 +101,10 @@ MainDisplay::MainDisplay (MainWindow *parent) : SkinDisplay(parent)
|
|||
m_vslider->setSliderOffset (QPoint (0, 1));
|
||||
m_vslider->resize (skin->getSize (Skin::SLIDER_VOLUMEBAR_BGS));
|
||||
m_vslider->move (skin->getPos (Skin::SLIDER_VOLUMEBAR_BGS));
|
||||
connect (client.xplayback (), SIGNAL (volumeChanged (int)),
|
||||
connect (client->xplayback (), SIGNAL (volumeChanged (int)),
|
||||
m_vslider, SLOT (setValue (int)));
|
||||
connect (m_vslider, SIGNAL (sliderMoved (int)),
|
||||
client.xplayback (), SLOT (setVolume (int)));
|
||||
client->xplayback (), SLOT (setVolume (int)));
|
||||
|
||||
m_bslider = new PixmapSlider (this);
|
||||
m_bslider->setMinimum (-MAX_BALANCE);
|
||||
|
@ -111,16 +112,16 @@ MainDisplay::MainDisplay (MainWindow *parent) : SkinDisplay(parent)
|
|||
m_bslider->setSliderOffset (QPoint (0, 1));
|
||||
m_bslider->resize (skin->getSize (Skin::SLIDER_BALANCEBAR_BGS));
|
||||
m_bslider->move (skin->getPos (Skin::SLIDER_BALANCEBAR_BGS));
|
||||
connect (client.xplayback (), SIGNAL (balanceChanged (int)),
|
||||
connect (client->xplayback (), SIGNAL (balanceChanged (int)),
|
||||
m_bslider, SLOT (setValue (int)));
|
||||
connect (m_bslider, SIGNAL (sliderMoved (int)),
|
||||
client.xplayback (), SLOT (setBalance (int)));
|
||||
client->xplayback (), SLOT (setBalance (int)));
|
||||
|
||||
connect (client.cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||
connect (client->cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||
this, SLOT (setMediainfo (const QVariantHash)));
|
||||
connect (client.xplayback (), SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||
connect (client->xplayback (), SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||
this, SLOT(setStatus(Xmms::Playback::Status)));
|
||||
connect (client.cache () , SIGNAL (playtime (uint32_t)),
|
||||
connect (client->cache () , SIGNAL (playtime (uint32_t)),
|
||||
this, SLOT (setPlaytime (uint32_t)));
|
||||
|
||||
setupServerConfig ();
|
||||
|
@ -183,6 +184,9 @@ MainDisplay::setStatus (Xmms::Playback::Status status)
|
|||
m_posbar->setValue (0);
|
||||
m_posbar->hide ();
|
||||
m_stereo->setStereoMono (false, false);
|
||||
|
||||
//FIXME: workaround, fix by hiding timedisplay in playlist
|
||||
emit displayTime (0);
|
||||
} else if (status == Xmms::Playback::PLAYING) {
|
||||
m_time->show ();
|
||||
m_kbps->show ();
|
||||
|
@ -204,7 +208,6 @@ MainDisplay::setPlaytime (uint32_t time)
|
|||
showtime = time/1000;
|
||||
}
|
||||
emit displayTime (showtime);
|
||||
// m_time->setTime (showtime);
|
||||
|
||||
// update slider
|
||||
m_posbar->setValue (time);
|
||||
|
@ -292,37 +295,36 @@ MainDisplay::SetupToggleButtons (void)
|
|||
}
|
||||
|
||||
void
|
||||
MainDisplay::SetupPushButtons (void)
|
||||
MainDisplay::SetupPushButtons (const XClient* client)
|
||||
{
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
Skin *skin = Skin::getInstance ();
|
||||
|
||||
/* Normal buttons */
|
||||
m_prev = new PixmapButton (this);
|
||||
m_prev->resize (skin->getSize (Skin::BUTTON_MW_PREV));
|
||||
m_prev->move (skin->getPos (Skin::BUTTON_MW_PREV));
|
||||
connect (m_prev, SIGNAL(clicked()), client.xplayback (), SLOT(prev ()));
|
||||
connect (m_prev, SIGNAL(clicked()), client->xplayback (), SLOT(prev ()));
|
||||
|
||||
m_play = new PixmapButton (this);
|
||||
m_play->resize (skin->getSize (Skin::BUTTON_MW_PLAY));
|
||||
m_play->move (skin->getPos (Skin::BUTTON_MW_PLAY));
|
||||
connect (m_play, SIGNAL(clicked()), client.xplayback (), SLOT(play ()));
|
||||
connect (m_play, SIGNAL(clicked()), client->xplayback (), SLOT(play ()));
|
||||
|
||||
m_pause = new PixmapButton (this);
|
||||
m_pause->resize (skin->getSize (Skin::BUTTON_MW_PAUSE));
|
||||
m_pause->move (skin->getPos (Skin::BUTTON_MW_PAUSE));
|
||||
connect (m_pause, SIGNAL(clicked()),
|
||||
client.xplayback (), SLOT(toggle_pause ()));
|
||||
client->xplayback (), SLOT(toggle_pause ()));
|
||||
|
||||
m_stop = new PixmapButton (this);
|
||||
m_stop->resize (skin->getSize (Skin::BUTTON_MW_STOP));
|
||||
m_stop->move (skin->getPos (Skin::BUTTON_MW_STOP));
|
||||
connect (m_stop, SIGNAL(clicked()), client.xplayback (), SLOT(stop ()));
|
||||
connect (m_stop, SIGNAL(clicked()), client->xplayback (), SLOT(stop ()));
|
||||
|
||||
m_next = new PixmapButton (this);
|
||||
m_next->resize (skin->getSize (Skin::BUTTON_MW_NEXT));
|
||||
m_next->move (skin->getPos (Skin::BUTTON_MW_NEXT));
|
||||
connect (m_next, SIGNAL(clicked()), client.xplayback (), SLOT(next ()));
|
||||
connect (m_next, SIGNAL(clicked()), client->xplayback (), SLOT(next ()));
|
||||
|
||||
m_eject = new PixmapButton (this);
|
||||
m_eject->resize (skin->getSize (Skin::BUTTON_MW_EJECT));
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
class MainDisplay;
|
||||
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
#include "XMMSHandler.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
|
@ -49,6 +46,7 @@ class PlayStatus;
|
|||
class MainWindow;
|
||||
class ClutterBar;
|
||||
class XConfig;
|
||||
class XClient;
|
||||
|
||||
class MainDisplay : public SkinDisplay
|
||||
{
|
||||
|
@ -85,7 +83,7 @@ class MainDisplay : public SkinDisplay
|
|||
void setRepeatAllEnabled (bool enabled);
|
||||
|
||||
protected:
|
||||
void SetupPushButtons (void);
|
||||
void SetupPushButtons (const XClient *);
|
||||
void SetupToggleButtons (void);
|
||||
|
||||
PixmapButton *m_prev;
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
// TODO: Try to get includes right without this
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
@ -21,6 +22,7 @@
|
|||
#include "ServerBrowser.h"
|
||||
#endif
|
||||
|
||||
#include "application.h"
|
||||
#include "playlistwindow.h"
|
||||
#include "maindisplay.h"
|
||||
#include "shadeddisplay.h"
|
||||
|
|
|
@ -13,14 +13,11 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
|
||||
#include "playstatus.h"
|
||||
#include "Skin.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
PlayStatus::PlayStatus (QWidget *parent) : QWidget (parent)
|
||||
{
|
||||
Skin* skin = Skin::getInstance ();
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <xmmsclient/xmmsclient++.h>
|
||||
#include <QWidget>
|
||||
|
||||
class QPaintEvent;
|
||||
|
||||
class Skin;
|
||||
|
||||
class PlayStatus : public QWidget
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include "xplayback.h"
|
||||
|
||||
#include "posbar.h"
|
||||
#include "Skin.h"
|
||||
|
||||
|
@ -37,18 +34,9 @@ PosBar::PosBar (QWidget *parent, uint bg, uint bnormal, uint bpressed)
|
|||
setMinimum (0);
|
||||
setMaximum (0);
|
||||
|
||||
connect (this, SIGNAL (sliderMoved (int)),
|
||||
this, SLOT (seekMs (int)));
|
||||
|
||||
hide ();
|
||||
}
|
||||
|
||||
void
|
||||
PosBar::seekMs (int value)
|
||||
{
|
||||
XMMSHandler::getInstance ().xplayback ()->seekMs (value);
|
||||
}
|
||||
|
||||
void
|
||||
PosBar::setPixmaps (Skin *skin)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@ class PosBar : public PixmapSlider
|
|||
|
||||
public slots:
|
||||
void setPixmaps (Skin *skin);
|
||||
void seekMs (int);
|
||||
|
||||
private:
|
||||
uint m_slider_normal;
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
#include "XMMSHandler.h"
|
||||
#include "xclient.h"
|
||||
#include "xclientcache.h"
|
||||
#include "xplayback.h"
|
||||
|
||||
|
@ -35,7 +34,7 @@ ShadedDisplay::ShadedDisplay (QWidget *parent) : SkinDisplay (parent)
|
|||
connect (skin, SIGNAL (skinChanged (Skin *)),
|
||||
this, SLOT (setPixmaps(Skin *)));
|
||||
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
const XClient *client = App->client ();
|
||||
|
||||
setFixedSize (275, 14);
|
||||
|
||||
|
@ -54,39 +53,39 @@ ShadedDisplay::ShadedDisplay (QWidget *parent) : SkinDisplay (parent)
|
|||
m_prev = new PixmapButton (this);
|
||||
m_prev->move(169, 4);
|
||||
m_prev->resize (8, 7);
|
||||
connect (m_prev, SIGNAL(clicked()), client.xplayback (), SLOT(prev ()));
|
||||
connect (m_prev, SIGNAL(clicked()), client->xplayback (), SLOT(prev ()));
|
||||
|
||||
m_play = new PixmapButton (this);
|
||||
m_play->move(177, 4);
|
||||
m_play->resize (10, 7);
|
||||
connect (m_play, SIGNAL(clicked()), client.xplayback (), SLOT(play ()));
|
||||
connect (m_play, SIGNAL(clicked()), client->xplayback (), SLOT(play ()));
|
||||
|
||||
m_pause = new PixmapButton (this);
|
||||
m_pause->move(187, 4);
|
||||
m_pause->resize (10, 7);
|
||||
connect (m_pause, SIGNAL(clicked()),
|
||||
client.xplayback (), SLOT(toggle_pause ()));
|
||||
client->xplayback (), SLOT(toggle_pause ()));
|
||||
|
||||
m_stop = new PixmapButton (this);
|
||||
m_stop->move(197, 4);
|
||||
m_stop->resize (9, 7);
|
||||
connect (m_stop, SIGNAL(clicked()), client.xplayback (), SLOT(stop ()));
|
||||
connect (m_stop, SIGNAL(clicked()), client->xplayback (), SLOT(stop ()));
|
||||
|
||||
m_next = new PixmapButton (this);
|
||||
m_next->move(206, 4);
|
||||
m_next->resize (8, 7);
|
||||
connect (m_next, SIGNAL(clicked()), client.xplayback (), SLOT(next ()));
|
||||
connect (m_next, SIGNAL(clicked()), client->xplayback (), SLOT(next ()));
|
||||
|
||||
m_eject = new PixmapButton (this);
|
||||
m_eject->move(216, 4);
|
||||
m_eject->resize (9, 7);
|
||||
connect (m_eject, SIGNAL(clicked()), this, SLOT(fileOpen()));
|
||||
|
||||
connect (client.xplayback (), SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||
connect (client->xplayback (), SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||
this, SLOT(setStatus(Xmms::Playback::Status)));
|
||||
connect (client.cache (), SIGNAL (playtime (uint32_t)),
|
||||
connect (client->cache (), SIGNAL (playtime (uint32_t)),
|
||||
this, SLOT ( setPlaytime(uint32_t)));
|
||||
connect (client.cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||
connect (client->cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||
this, SLOT (setMediainfo (QVariantHash)));
|
||||
}
|
||||
|
||||
|
@ -121,8 +120,7 @@ void
|
|||
ShadedDisplay::setStatus (Xmms::Playback::Status status)
|
||||
{
|
||||
if (status == Xmms::Playback::STOPPED) {
|
||||
//m_number->setNumber (0, 2);
|
||||
//nm_number2->setNumber (0, 2);
|
||||
m_time->setTime (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,10 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include "xclient.h"
|
||||
#include "xcollection.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "mainwindow.h"
|
||||
#include "skindisplay.h"
|
||||
#include "Skin.h"
|
||||
|
@ -48,13 +49,13 @@ SkinDisplay::fileOpen (void)
|
|||
|
||||
files = fd.getFiles ();
|
||||
|
||||
XMMSHandler &xmmsh = XMMSHandler::getInstance();
|
||||
if (files.count() > 0) {
|
||||
xmmsh.xcollection ()->playlistClear ();
|
||||
}
|
||||
const XClient *client = App->client ();
|
||||
// if (files.count() > 0) {
|
||||
// xmmsh.xcollection ()->playlistClear ();
|
||||
// }
|
||||
|
||||
for (int i = 0; i < files.count(); i++) {
|
||||
xmmsh.playlistAddURL ("file://" + files.value(i));
|
||||
client->xcollection ()->playlistAddUrl ("file://" + files.value(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "titlebar.h"
|
||||
#include "skindisplay.h"
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
#include "xclient.h"
|
||||
#include "xclientcache.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "playlistshade.h"
|
||||
#include "playlistwindow.h"
|
||||
#include "pixmapbutton.h"
|
||||
#include "Skin.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QPainter>
|
||||
|
@ -29,7 +29,7 @@
|
|||
PlaylistShade::PlaylistShade (PlaylistWindow *parent) : QWidget (parent)
|
||||
{
|
||||
QSettings s;
|
||||
XMMSHandler &xmmsh = XMMSHandler::getInstance ();
|
||||
const XClient *client = App->client ();
|
||||
|
||||
if (!s.contains ("playlist/shadedsize"))
|
||||
s.setValue ("playlist/shadedsize", 8);
|
||||
|
@ -47,7 +47,7 @@ PlaylistShade::PlaylistShade (PlaylistWindow *parent) : QWidget (parent)
|
|||
connect (m_unshadebtn, SIGNAL (clicked ()),
|
||||
parent, SLOT (switchDisplay ()));
|
||||
|
||||
connect (xmmsh.cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||
connect (client->cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||
this, SLOT (setMediainfo (QVariantHash)));
|
||||
|
||||
connect (App, SIGNAL(settingsChanged ()),
|
||||
|
|
|
@ -16,15 +16,14 @@
|
|||
#ifndef __PLAYLISTSHADE_H__
|
||||
#define __PLAYLISTSHADE_H__
|
||||
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
#include "Skin.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHash>
|
||||
#include <QVariant>
|
||||
|
||||
typedef QHash<QString, QVariant> QVariantHash;
|
||||
|
||||
class Skin;
|
||||
|
||||
class QResizeEvent;
|
||||
class PixmapButton;
|
||||
class PlaylistWindow;
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
// FIXME should not need those two
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
#include "XMMSHandler.h"
|
||||
#include "xclient.h"
|
||||
#include "xplayback.h"
|
||||
|
||||
#include "application.h"
|
||||
|
@ -136,12 +134,12 @@ PlaylistView::PlaylistView (QWidget *parent) : QListView (parent)
|
|||
m_font = NULL;
|
||||
m_fontmetrics = NULL;
|
||||
|
||||
XMMSHandler &xmmsh = XMMSHandler::getInstance ();
|
||||
const XClient *client = App->client ();
|
||||
|
||||
connect (App, SIGNAL (settingsChanged ()),
|
||||
this, SLOT (settingsChanged ()));
|
||||
|
||||
connect (xmmsh.xplayback (), SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||
connect (client->xplayback (), SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||
this, SLOT(handleStatus(Xmms::Playback::Status)));
|
||||
}
|
||||
|
||||
|
@ -278,18 +276,18 @@ PlaylistView::mouseDoubleClickEvent (QMouseEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
XMMSHandler &xmmsh = XMMSHandler::getInstance ();
|
||||
xmmsh.xplayback ()->setPos (index.row());
|
||||
const XClient *client = App->client ();
|
||||
client->xplayback ()->setPos (index.row());
|
||||
if (m_status == XMMS_PLAYBACK_STATUS_STOP ||
|
||||
m_status == XMMS_PLAYBACK_STATUS_PAUSE) {
|
||||
xmmsh.xplayback ()->play ();
|
||||
client->xplayback ()->play ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistView::showEntryInfo (void)
|
||||
{
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
const XClient *client = App->client ();
|
||||
QModelIndex current = selectionModel ()->currentIndex ();
|
||||
if (current.isValid ()) {
|
||||
uint32_t id = model ()->data (current, PlaylistModel::MedialibIdRole)
|
||||
|
@ -297,7 +295,7 @@ PlaylistView::showEntryInfo (void)
|
|||
// If no infodialog exists, create one, else set the selected Item as
|
||||
// displayed item
|
||||
if (!m_entry_info) {
|
||||
m_entry_info = new EntryInfo (this, client.cache (), id);
|
||||
m_entry_info = new EntryInfo (this, client->cache (), id);
|
||||
} else {
|
||||
m_entry_info->raise ();
|
||||
m_entry_info->setId (id);
|
||||
|
|
|
@ -13,7 +13,10 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include "xclient.h"
|
||||
#include "playlistmodel.h"
|
||||
#include "xcollection.h"
|
||||
#include "xplayback.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "mainwindow.h"
|
||||
|
@ -23,10 +26,6 @@
|
|||
#include "playlistview.h"
|
||||
#include "playlistcontrols.h"
|
||||
|
||||
#include "playlistmodel.h"
|
||||
#include "xcollection.h"
|
||||
#include "xplayback.h"
|
||||
|
||||
#include "pixmapbutton.h"
|
||||
#include "playlistshade.h"
|
||||
#include "playlistmenu.h"
|
||||
|
@ -196,7 +195,7 @@ PlaylistWidget::PlaylistWidget (PlaylistWindow *parent) : QWidget (parent)
|
|||
m_view->move (10, 20);
|
||||
// m_view->resize (size().width()-30, size().height()-20-38);
|
||||
// TODO: creation of Playlistmodel should be done elsewhere
|
||||
m_view->setModel (XMMSHandler::getInstance().getPlaylistModel());
|
||||
m_view->setModel (App->client ()->active_playlist ());
|
||||
|
||||
/*
|
||||
* This is a hack to make PlaylistScrollBar work with PlaylistView.
|
||||
|
@ -219,20 +218,20 @@ PlaylistWidget::PlaylistWidget (PlaylistWindow *parent) : QWidget (parent)
|
|||
|
||||
addButtons ();
|
||||
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
const XClient *client = App->client ();
|
||||
|
||||
m_controls = new PlaylistControls (this);
|
||||
// connect buttons
|
||||
connect (m_controls, SIGNAL (prev ()),
|
||||
client.xplayback (), SLOT (prev ()));
|
||||
client->xplayback (), SLOT (prev ()));
|
||||
connect (m_controls, SIGNAL (play ()),
|
||||
client.xplayback (), SLOT (play ()));
|
||||
client->xplayback (), SLOT (play ()));
|
||||
connect (m_controls, SIGNAL (pause ()),
|
||||
client.xplayback (), SLOT (pause ()));
|
||||
client->xplayback (), SLOT (pause ()));
|
||||
connect (m_controls, SIGNAL (stop ()),
|
||||
client.xplayback (), SLOT (stop ()));
|
||||
client->xplayback (), SLOT (stop ()));
|
||||
connect (m_controls, SIGNAL (next ()),
|
||||
client.xplayback (), SLOT (next ()));
|
||||
client->xplayback (), SLOT (next ()));
|
||||
// TODO: eject
|
||||
connect (m_controls, SIGNAL (toggleTime ()),
|
||||
App, SLOT (toggleTime()));
|
||||
|
@ -269,7 +268,7 @@ PlaylistWidget::addButtons ()
|
|||
b = new PlaylistMenuButton (m_del, Skin::PLS_DEL_ALL_0,
|
||||
Skin::PLS_DEL_ALL_1);
|
||||
connect (b, SIGNAL (activated ()),
|
||||
XMMSHandler::getInstance().xcollection (),
|
||||
App->client ()->xcollection (),
|
||||
SLOT (playlistClear ()));
|
||||
b = new PlaylistMenuButton (m_del, Skin::PLS_DEL_CRP_0,
|
||||
Skin::PLS_DEL_CRP_1);
|
||||
|
@ -324,8 +323,8 @@ PlaylistWidget::addButtons ()
|
|||
void
|
||||
PlaylistWidget::menuAddUrl ()
|
||||
{
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
UrlOpen *tmp = new UrlOpen (this, client.xcollection ());
|
||||
const XClient *client = App->client ();
|
||||
UrlOpen *tmp = new UrlOpen (this, client->xcollection ());
|
||||
tmp->show ();
|
||||
}
|
||||
|
||||
|
@ -343,7 +342,7 @@ PlaylistWidget::diveDir (const QString &dir)
|
|||
diveDir (fileInfo.filePath ());
|
||||
} else {
|
||||
QString fname = fileInfo.filePath();
|
||||
XMMSHandler::getInstance ().playlistAddURL ("file://" + fname);
|
||||
App->client ()->xcollection ()->playlistAddUrl ("file://" + fname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -374,7 +373,7 @@ PlaylistWidget::menuAddFile ()
|
|||
BrowseDialog bd (window ());
|
||||
files = bd.getFiles ();
|
||||
for (int i = 0; i < files.count(); i++) {
|
||||
XMMSHandler::getInstance ().playlistAddURL (files.value (i));
|
||||
App->client ()->xcollection ()->playlistAddUrl (files.value (i));
|
||||
}
|
||||
} else {
|
||||
FileDialog fd (this, "playlist_add_files");
|
||||
|
@ -382,7 +381,7 @@ PlaylistWidget::menuAddFile ()
|
|||
files = fd.getFiles ();
|
||||
|
||||
for (int i = 0; i < files.count(); i++) {
|
||||
XMMSHandler::getInstance ().playlistAddURL ("file://" + files.value(i));
|
||||
App->client ()->xcollection ()->playlistAddUrl ("file://" + files.value(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,9 +396,9 @@ PlaylistWidget::menuAddPls ()
|
|||
files = fd.getFiles ();
|
||||
|
||||
if (files.count () > 0) {
|
||||
XMMSHandler::getInstance ().xcollection ()->playlistClear ();
|
||||
App->client ()->xcollection ()->playlistClear ();
|
||||
QString file = files[0];
|
||||
XMMSHandler::getInstance ().xcollection ()->addPlsFile (QUrl (file));
|
||||
App->client ()->xcollection ()->addPlsFile (QUrl (file));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -590,8 +589,8 @@ PlaylistWidget::paintEvent (QPaintEvent *event)
|
|||
void
|
||||
PlaylistWidget::openPlaylistChooser ()
|
||||
{
|
||||
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||
PlaylistChooser *tmp = new PlaylistChooser (this, client.xcollection ());
|
||||
const XClient *client = App->client ();
|
||||
PlaylistChooser *tmp = new PlaylistChooser (this, client->xcollection ());
|
||||
tmp->show ();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#ifndef __PLAYLISTWIDGET_H__
|
||||
#define __PLAYLISTWIDGET_H__
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
|
||||
#include <QScrollBar>
|
||||
#include <QSizeGrip>
|
||||
#include <QWidget>
|
||||
|
@ -35,7 +33,7 @@ class PixmapButton;
|
|||
|
||||
class PlaylistSizeGrip : public QSizeGrip {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
PlaylistSizeGrip (QWidget *parent) : QSizeGrip (parent) {}
|
||||
~PlaylistSizeGrip () {}
|
||||
|
|
|
@ -13,13 +13,12 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
|
||||
#include "playlistwindow.h"
|
||||
|
||||
#include <QMoveEvent>
|
||||
#include <QResizeEvent>
|
||||
#include <QPoint>
|
||||
#include <QIcon>
|
||||
|
||||
#include "playlistwidget.h"
|
||||
#include "playlistshade.h"
|
||||
|
|
|
@ -7,7 +7,6 @@ include($$PWD/dialogs/dialogs.pri)
|
|||
HEADERS += application.h \
|
||||
Skin.h \
|
||||
timedisplay.h \
|
||||
XMMSHandler.h \
|
||||
SkinChooser.h \
|
||||
settingsdialog.h \
|
||||
basewindow.h \
|
||||
|
@ -18,7 +17,6 @@ HEADERS += application.h \
|
|||
SOURCES += application.cpp \
|
||||
timedisplay.cpp \
|
||||
Skin.cpp \
|
||||
XMMSHandler.cpp \
|
||||
SkinChooser.cpp \
|
||||
settingsdialog.cpp \
|
||||
basewindow.cpp \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue