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); connect(ipcpath, sync, parent);
using Xmms::bind;
// m_client->playback.broadcastVolumeChanged () (
// bind (&XMMSHandler::volume_changed, this));
return true; return true;
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -23,20 +23,8 @@
#include "titlebar.h" #include "titlebar.h"
#include "FileDialog.h" #include "FileDialog.h"
#include <QPainter>
SkinDisplay::SkinDisplay (QWidget *parent) : QWidget(parent) 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); dynamic_cast<TitleBar *>(m_tbar)->setActive(false);
} }
void
SkinDisplay::paintEvent (QPaintEvent *event)
{
QPainter(paint);
paint.begin(this);
paint.eraseRect(rect());
paint.end();
}
void void
SkinDisplay::fileOpen (void) SkinDisplay::fileOpen (void)
{ {

View file

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

View file

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

View file

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