Some cleanups, file moves and changes in PlayStatus

This commit is contained in:
Thomas Frauendorfer 2008-03-22 02:54:19 +01:00
parent a5e35d986e
commit 3f8ba378ad
10 changed files with 55 additions and 33 deletions

View file

@ -134,6 +134,8 @@ MainDisplay::setPixmaps (Skin *skin)
void
MainDisplay::setStatus (Xmms::Playback::Status status)
{
m_playstatus->setStatus (status);
if (status == Xmms::Playback::STOPPED) {
m_time->setTime(0);
m_posbar->setValue (0);

View file

@ -1,12 +1,16 @@
HEADERS += clutterbar.h \
mainwindow.h \
maindisplay.h \
playstatus.h \
posbar.h \
shadeddisplay.h \
stereomono.h
SOURCES += clutterbar.cpp \
mainwindow.cpp \
maindisplay.cpp \
playstatus.cpp \
posbar.cpp \
shadeddisplay.cpp \
stereomono.cpp

View file

@ -14,19 +14,22 @@
*/
#include <xmmsclient/xmmsclient++.h>
#include <QPainter>
#include <QPaintEvent>
#include "PlayStatus.h"
#include "Skin.h"
PlayStatus::PlayStatus (QWidget *parent) : PixWidget (parent)
PlayStatus::PlayStatus (QWidget *parent) : QWidget (parent)
{
setMinimumSize(11, 9);
setMaximumSize(11, 9);
Skin* skin = Skin::getInstance ();
connect (skin, SIGNAL (skinChanged (Skin *)),
this, SLOT (setPixmaps (Skin *)));
setFixedSize(11, 9);
m_status = Xmms::Playback::STOPPED;
connect (&XMMSHandler::getInstance (),
SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
this, SLOT(setStatus(Xmms::Playback::Status)));
}
void
@ -36,21 +39,39 @@ PlayStatus::setPixmaps (Skin *skin)
m_pixmap_pause = skin->getItem (Skin::PIC_PAUSE);
m_pixmap_stop = skin->getItem (Skin::PIC_STOP);
setStatus (m_status);
update ();
}
void
PlayStatus::setStatus (Xmms::Playback::Status status)
{
using Xmms::Playback;
if (status == Playback::STOPPED) {
m_pixmap = m_pixmap_stop;
} else if (status == Playback::PLAYING) {
m_pixmap = m_pixmap_play;
} else if (status == Playback::PAUSED) {
m_pixmap = m_pixmap_pause;
}
m_status = status;
update ();
}
void
PlayStatus::paintEvent (QPaintEvent *event)
{
QPixmap pixmap;
using Xmms::Playback;
switch (m_status) {
case Playback::STOPPED:
pixmap = m_pixmap_stop;
break;
case Playback::PLAYING:
pixmap = m_pixmap_play;
break;
case Playback::PAUSED:
pixmap = m_pixmap_pause;
break;
default:
qWarning ("Unhandled playback status in PlayStatus");
break;
}
QPainter p;
p.begin (this);
p.drawPixmap (rect (), pixmap, pixmap.rect ());
p.end ();
}

View file

@ -17,10 +17,11 @@
#define __PLAYSTATUS_H__
#include <xmmsclient/xmmsclient++.h>
#include "XMMSHandler.h"
#include "PixWidget.h"
#include <QWidget>
class PlayStatus : public PixWidget
class Skin;
class PlayStatus : public QWidget
{
Q_OBJECT
public:
@ -32,6 +33,9 @@ class PlayStatus : public PixWidget
void setPixmaps (Skin *skin);
void setStatus (Xmms::Playback::Status status);
protected slots:
void paintEvent (QPaintEvent *event);
private:
Xmms::Playback::Status m_status;

View file

@ -28,8 +28,7 @@ PlaylistMenuButton::PlaylistMenuButton (PlaylistMenu *menu,
m_pixid2 = pix2;
menu->addButton (this);
m_menu = menu;
setMinimumSize (22, 18);
setMaximumSize (22, 18);
setFixedSize (22, 18);
}
PlaylistMenuButton::~PlaylistMenuButton ()
@ -62,8 +61,7 @@ PlaylistMenuButton::setPixmaps (Skin *skin)
PlaylistMenu::PlaylistMenu (QWidget *parent, uint pix,
uint decoration) : PixWidget (parent)
{
setMinimumSize (25, 18);
setMaximumSize (25, 18);
setFixedSize (25, 18);
m_expanded = new QWidget (parent);
m_expanded->hide ();

View file

@ -30,7 +30,6 @@
PlaylistWindow::PlaylistWindow (QWidget *parent) : BaseWindow (parent)
{
QSettings s;
m_mw = dynamic_cast<MainWindow *>(parent);
#ifndef _WIN32
setWindowIcon (QIcon (":icon.png"));
#endif
@ -83,7 +82,7 @@ PlaylistWindow::showEvent (QShowEvent *event)
{
QSettings s;
s.setValue ("playlist/visible", true);
m_mw->attachWidgets ();
mw ()->attachWidgets ();
emit visibilityChanged (true);
}
@ -130,7 +129,7 @@ PlaylistWindow::resizeEvent (QResizeEvent *event)
if (s.value("playlist/shaded").toBool ()) {
s.setValue ("playlist/size", size ());
}
m_mw->attachWidgets ();
mw ()->attachWidgets ();
}
void

View file

@ -61,8 +61,6 @@ class PlaylistWindow : public BaseWindow {
Button *m_shadebtn;
Button *m_closebtn;
MainWindow *m_mw;
};
#endif // __PLAYLISTWINDOW_H__

View file

@ -14,8 +14,6 @@ HEADERS += PixWidget.h \
TimeDisplay.h \
XMMSHandler.h \
SmallNumberDisplay.h \
PosBar.h \
PlayStatus.h \
SkinChooser.h \
settingsdialog.h \
basewindow.h \
@ -35,8 +33,6 @@ SOURCES += main.cpp \
TimeDisplay.cpp \
XMMSHandler.cpp \
SmallNumberDisplay.cpp \
PosBar.cpp \
PlayStatus.cpp \
SkinChooser.cpp \
settingsdialog.cpp \
basewindow.cpp \