OTHER: Some cleanups

This commit is contained in:
Thomas Frauendorfer 2008-10-20 03:48:34 +02:00
parent 54cb2086ee
commit 1fe1c8f9be
9 changed files with 31 additions and 44 deletions

View file

@ -60,10 +60,6 @@ XMMSHandler::connect_handler (const char *ipcpath, const bool &sync, QWidget *pa
connect(ipcpath, sync, parent);
using Xmms::bind;
// m_client->playback.broadcastVolumeChanged () (
// bind (&XMMSHandler::volume_changed, this));
return true;
}

View file

@ -41,17 +41,20 @@
#include <QDebug>
#include <QMessageBox>
MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
MainDisplay::MainDisplay (MainWindow *parent) : SkinDisplay(parent)
{
XMMSHandler &client = XMMSHandler::getInstance ();
m_xconfig = client.xconfig ();
Skin* skin = Skin::getInstance ();
connect (skin, SIGNAL (skinChanged (Skin *)),
this, SLOT (setPixmaps(Skin *)));
m_tbar = new TitleBar(this, false);
m_tbar->move(0, 0);
m_tbar->resize(275, 14);
m_mw = dynamic_cast<MainWindow *>(parent);
m_mw = parent;
SetupPushButtons ();
SetupToggleButtons ();
@ -123,6 +126,14 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
setupServerConfig ();
}
void
MainDisplay::paintEvent (QPaintEvent *event)
{
QPainter p(this);
p.eraseRect (rect ());
}
void
MainDisplay::setPixmaps (Skin *skin)
{

View file

@ -36,6 +36,7 @@ class MainDisplay;
typedef QHash<QString, QVariant> QVariantHash;
class QPaintEvent;
class PixmapButton;
class PixmapNumberDisplay;
class PixmapSlider;
@ -53,7 +54,7 @@ class MainDisplay : public SkinDisplay
{
Q_OBJECT
public:
MainDisplay (QWidget *parent);
MainDisplay (MainWindow *parent);
~MainDisplay () {}
TextScroller *m_text;
@ -72,6 +73,7 @@ class MainDisplay : public SkinDisplay
void displayTime (int time);
public slots:
void paintEvent (QPaintEvent *event);
void setPixmaps(Skin *skin);
void setStatus (Xmms::Playback::Status status);
void setPlaytime (uint32_t time);

View file

@ -29,17 +29,23 @@
ShadedDisplay::ShadedDisplay (QWidget *parent) : SkinDisplay (parent)
{
Skin *skin = Skin::getInstance ();
connect (skin, SIGNAL (skinChanged (Skin *)),
this, SLOT (setPixmaps(Skin *)));
XMMSHandler &client = XMMSHandler::getInstance ();
setFixedSize (275, 14);
m_mw = qobject_cast<MainWindow *>(parent);
m_tbar = new TitleBar(this, true);
m_tbar->move (0, 0);
m_time = new SmallTimeDisplay (this);
m_time->move (130, 4);
MainWindow *mw = dynamic_cast<MainWindow *>(parent);
connect (m_time, SIGNAL(clicked()), mw, SLOT(toggleTime()));
connect (m_time, SIGNAL(clicked()), m_mw, SLOT(toggleTime()));
m_title = new TextScroller (this, 39, 7, "shaded");
m_title->move (79, 4);
@ -123,7 +129,7 @@ void
ShadedDisplay::setPlaytime (uint32_t time)
{
int32_t showtime;
if (dynamic_cast<MainWindow *>(m_mw)->isTimemodeReverse()) {
if (m_mw->isTimemodeReverse()) {
showtime = (time/1000 - m_duration/1000);
} else {
showtime = time/1000;

View file

@ -54,6 +54,8 @@ class ShadedDisplay : public SkinDisplay
PixmapButton *m_next;
PixmapButton *m_eject;
MainWindow *m_mw;
public slots:
void setStatus (Xmms::Playback::Status status);
void setPlaytime (uint32_t time);

View file

@ -23,20 +23,8 @@
#include "titlebar.h"
#include "FileDialog.h"
#include <QPainter>
SkinDisplay::SkinDisplay (QWidget *parent) : QWidget(parent)
{
Skin *skin = Skin::getInstance ();
m_mw = parent;
connect (skin, SIGNAL (skinChanged (Skin *)),
this, SLOT (setPixmaps (Skin *)));
}
void
SkinDisplay::setPixmaps (Skin *skin)
{
}
@ -52,17 +40,6 @@ SkinDisplay::leaveEvent (QEvent *event)
dynamic_cast<TitleBar *>(m_tbar)->setActive(false);
}
void
SkinDisplay::paintEvent (QPaintEvent *event)
{
QPainter(paint);
paint.begin(this);
paint.eraseRect(rect());
paint.end();
}
void
SkinDisplay::fileOpen (void)
{

View file

@ -18,7 +18,6 @@
#include <QWidget>
class QEvent;
class QPaintEvent;
class Skin;
@ -27,18 +26,14 @@ class SkinDisplay : public QWidget
Q_OBJECT
public:
SkinDisplay (QWidget *parent);
QWidget *getMW () const { return m_mw; }
public slots:
virtual void setPixmaps(Skin *skin);
void fileOpen (void);
protected:
void paintEvent (QPaintEvent *event);
void enterEvent (QEvent *event);
void leaveEvent (QEvent *event);
QWidget *m_mw;
QWidget *m_tbar;
};

View file

@ -29,7 +29,6 @@ TextScroller::TextScroller (QWidget *parent, uint w,
uint h, const QString &name) :
QWidget (parent)
{
//XMMSHandler *xmmsh = XMMSHandler::getInstance ();
Skin *skin = Skin::getInstance ();
connect (skin, SIGNAL (skinChanged (Skin *)),
@ -112,7 +111,7 @@ TextScroller::addOffset ()
m_x2_off = 0;
}
repaint ();
update ();
m_timer->start (40);
}

View file

@ -57,8 +57,7 @@ PlaylistControls::PlaylistControls (QWidget *parent) : QWidget (parent)
connect (button, SIGNAL (clicked ()), this, SIGNAL (eject ()));
m_timedisplay = new SmallTimeDisplay (this);
m_timedisplay->move (69, 23);
// m_timedisplay->hide ();
m_timedisplay->move (68, 23);
connect (m_timedisplay, SIGNAL (clicked ()),
this, SIGNAL (toggleTime ()));
connect (this, SIGNAL (setDisplayTime (int)),