Some cleanups, file moves and changes in PlayStatus
This commit is contained in:
parent
a5e35d986e
commit
3f8ba378ad
10 changed files with 55 additions and 33 deletions
|
@ -134,6 +134,8 @@ MainDisplay::setPixmaps (Skin *skin)
|
||||||
void
|
void
|
||||||
MainDisplay::setStatus (Xmms::Playback::Status status)
|
MainDisplay::setStatus (Xmms::Playback::Status status)
|
||||||
{
|
{
|
||||||
|
m_playstatus->setStatus (status);
|
||||||
|
|
||||||
if (status == Xmms::Playback::STOPPED) {
|
if (status == Xmms::Playback::STOPPED) {
|
||||||
m_time->setTime(0);
|
m_time->setTime(0);
|
||||||
m_posbar->setValue (0);
|
m_posbar->setValue (0);
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
HEADERS += clutterbar.h \
|
HEADERS += clutterbar.h \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
maindisplay.h \
|
maindisplay.h \
|
||||||
|
playstatus.h \
|
||||||
|
posbar.h \
|
||||||
shadeddisplay.h \
|
shadeddisplay.h \
|
||||||
stereomono.h
|
stereomono.h
|
||||||
|
|
||||||
SOURCES += clutterbar.cpp \
|
SOURCES += clutterbar.cpp \
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
maindisplay.cpp \
|
maindisplay.cpp \
|
||||||
|
playstatus.cpp \
|
||||||
|
posbar.cpp \
|
||||||
shadeddisplay.cpp \
|
shadeddisplay.cpp \
|
||||||
stereomono.cpp
|
stereomono.cpp
|
||||||
|
|
||||||
|
|
|
@ -14,19 +14,22 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xmmsclient/xmmsclient++.h>
|
#include <xmmsclient/xmmsclient++.h>
|
||||||
|
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPaintEvent>
|
||||||
|
|
||||||
#include "PlayStatus.h"
|
#include "PlayStatus.h"
|
||||||
#include "Skin.h"
|
#include "Skin.h"
|
||||||
|
|
||||||
PlayStatus::PlayStatus (QWidget *parent) : PixWidget (parent)
|
PlayStatus::PlayStatus (QWidget *parent) : QWidget (parent)
|
||||||
{
|
{
|
||||||
setMinimumSize(11, 9);
|
Skin* skin = Skin::getInstance ();
|
||||||
setMaximumSize(11, 9);
|
connect (skin, SIGNAL (skinChanged (Skin *)),
|
||||||
|
this, SLOT (setPixmaps (Skin *)));
|
||||||
|
|
||||||
|
setFixedSize(11, 9);
|
||||||
|
|
||||||
m_status = Xmms::Playback::STOPPED;
|
m_status = Xmms::Playback::STOPPED;
|
||||||
|
|
||||||
connect (&XMMSHandler::getInstance (),
|
|
||||||
SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
|
||||||
this, SLOT(setStatus(Xmms::Playback::Status)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -36,21 +39,39 @@ PlayStatus::setPixmaps (Skin *skin)
|
||||||
m_pixmap_pause = skin->getItem (Skin::PIC_PAUSE);
|
m_pixmap_pause = skin->getItem (Skin::PIC_PAUSE);
|
||||||
m_pixmap_stop = skin->getItem (Skin::PIC_STOP);
|
m_pixmap_stop = skin->getItem (Skin::PIC_STOP);
|
||||||
|
|
||||||
setStatus (m_status);
|
update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PlayStatus::setStatus (Xmms::Playback::Status status)
|
PlayStatus::setStatus (Xmms::Playback::Status status)
|
||||||
{
|
{
|
||||||
using Xmms::Playback;
|
m_status = status;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
update ();
|
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 ();
|
||||||
|
}
|
||||||
|
|
|
@ -17,10 +17,11 @@
|
||||||
#define __PLAYSTATUS_H__
|
#define __PLAYSTATUS_H__
|
||||||
|
|
||||||
#include <xmmsclient/xmmsclient++.h>
|
#include <xmmsclient/xmmsclient++.h>
|
||||||
#include "XMMSHandler.h"
|
#include <QWidget>
|
||||||
#include "PixWidget.h"
|
|
||||||
|
|
||||||
class PlayStatus : public PixWidget
|
class Skin;
|
||||||
|
|
||||||
|
class PlayStatus : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -32,6 +33,9 @@ class PlayStatus : public PixWidget
|
||||||
void setPixmaps (Skin *skin);
|
void setPixmaps (Skin *skin);
|
||||||
void setStatus (Xmms::Playback::Status status);
|
void setStatus (Xmms::Playback::Status status);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void paintEvent (QPaintEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Xmms::Playback::Status m_status;
|
Xmms::Playback::Status m_status;
|
||||||
|
|
|
@ -28,8 +28,7 @@ PlaylistMenuButton::PlaylistMenuButton (PlaylistMenu *menu,
|
||||||
m_pixid2 = pix2;
|
m_pixid2 = pix2;
|
||||||
menu->addButton (this);
|
menu->addButton (this);
|
||||||
m_menu = menu;
|
m_menu = menu;
|
||||||
setMinimumSize (22, 18);
|
setFixedSize (22, 18);
|
||||||
setMaximumSize (22, 18);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaylistMenuButton::~PlaylistMenuButton ()
|
PlaylistMenuButton::~PlaylistMenuButton ()
|
||||||
|
@ -62,8 +61,7 @@ PlaylistMenuButton::setPixmaps (Skin *skin)
|
||||||
PlaylistMenu::PlaylistMenu (QWidget *parent, uint pix,
|
PlaylistMenu::PlaylistMenu (QWidget *parent, uint pix,
|
||||||
uint decoration) : PixWidget (parent)
|
uint decoration) : PixWidget (parent)
|
||||||
{
|
{
|
||||||
setMinimumSize (25, 18);
|
setFixedSize (25, 18);
|
||||||
setMaximumSize (25, 18);
|
|
||||||
|
|
||||||
m_expanded = new QWidget (parent);
|
m_expanded = new QWidget (parent);
|
||||||
m_expanded->hide ();
|
m_expanded->hide ();
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
PlaylistWindow::PlaylistWindow (QWidget *parent) : BaseWindow (parent)
|
PlaylistWindow::PlaylistWindow (QWidget *parent) : BaseWindow (parent)
|
||||||
{
|
{
|
||||||
QSettings s;
|
QSettings s;
|
||||||
m_mw = dynamic_cast<MainWindow *>(parent);
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
setWindowIcon (QIcon (":icon.png"));
|
setWindowIcon (QIcon (":icon.png"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,7 +82,7 @@ PlaylistWindow::showEvent (QShowEvent *event)
|
||||||
{
|
{
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.setValue ("playlist/visible", true);
|
s.setValue ("playlist/visible", true);
|
||||||
m_mw->attachWidgets ();
|
mw ()->attachWidgets ();
|
||||||
|
|
||||||
emit visibilityChanged (true);
|
emit visibilityChanged (true);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +129,7 @@ PlaylistWindow::resizeEvent (QResizeEvent *event)
|
||||||
if (s.value("playlist/shaded").toBool ()) {
|
if (s.value("playlist/shaded").toBool ()) {
|
||||||
s.setValue ("playlist/size", size ());
|
s.setValue ("playlist/size", size ());
|
||||||
}
|
}
|
||||||
m_mw->attachWidgets ();
|
mw ()->attachWidgets ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -61,8 +61,6 @@ class PlaylistWindow : public BaseWindow {
|
||||||
|
|
||||||
Button *m_shadebtn;
|
Button *m_shadebtn;
|
||||||
Button *m_closebtn;
|
Button *m_closebtn;
|
||||||
MainWindow *m_mw;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __PLAYLISTWINDOW_H__
|
#endif // __PLAYLISTWINDOW_H__
|
||||||
|
|
|
@ -14,8 +14,6 @@ HEADERS += PixWidget.h \
|
||||||
TimeDisplay.h \
|
TimeDisplay.h \
|
||||||
XMMSHandler.h \
|
XMMSHandler.h \
|
||||||
SmallNumberDisplay.h \
|
SmallNumberDisplay.h \
|
||||||
PosBar.h \
|
|
||||||
PlayStatus.h \
|
|
||||||
SkinChooser.h \
|
SkinChooser.h \
|
||||||
settingsdialog.h \
|
settingsdialog.h \
|
||||||
basewindow.h \
|
basewindow.h \
|
||||||
|
@ -35,8 +33,6 @@ SOURCES += main.cpp \
|
||||||
TimeDisplay.cpp \
|
TimeDisplay.cpp \
|
||||||
XMMSHandler.cpp \
|
XMMSHandler.cpp \
|
||||||
SmallNumberDisplay.cpp \
|
SmallNumberDisplay.cpp \
|
||||||
PosBar.cpp \
|
|
||||||
PlayStatus.cpp \
|
|
||||||
SkinChooser.cpp \
|
SkinChooser.cpp \
|
||||||
settingsdialog.cpp \
|
settingsdialog.cpp \
|
||||||
basewindow.cpp \
|
basewindow.cpp \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue