Added PlayStatus widget.
This commit is contained in:
parent
a50e7afd4a
commit
46a0fd1b29
8 changed files with 86 additions and 6 deletions
|
@ -40,6 +40,9 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
|||
Skin::POSBAR_BTN_1);
|
||||
m_slider->move (16, 72);
|
||||
|
||||
m_playstatus = new PlayStatus (this);
|
||||
m_playstatus->move (24, 28);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -22,6 +22,7 @@ class MainDisplay;
|
|||
#include "SmallNumberDisplay.h"
|
||||
#include "StereoMono.h"
|
||||
#include "Slider.h"
|
||||
#include "PlayStatus.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -42,6 +43,8 @@ class MainDisplay : public SkinDisplay
|
|||
StereoMono *m_stereo;
|
||||
Slider *m_slider;
|
||||
|
||||
PlayStatus *m_playstatus;
|
||||
|
||||
public slots:
|
||||
void setPixmaps(Skin *skin);
|
||||
protected:
|
||||
|
|
35
PlayStatus.cpp
Normal file
35
PlayStatus.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include "PlayStatus.h"
|
||||
|
||||
PlayStatus::PlayStatus (QWidget *parent) : PixWidget (parent)
|
||||
{
|
||||
setMinimumSize(11, 9);
|
||||
setMaximumSize(11, 9);
|
||||
|
||||
m_status = XMMS_PLAYBACK_STATUS_STOP;
|
||||
}
|
||||
|
||||
void
|
||||
PlayStatus::setPixmaps (Skin *skin)
|
||||
{
|
||||
m_pixmap_play = skin->getItem (Skin::PIC_PLAY);
|
||||
m_pixmap_pause = skin->getItem (Skin::PIC_PAUSE);
|
||||
m_pixmap_stop = skin->getItem (Skin::PIC_STOP);
|
||||
|
||||
setStatus (m_status);
|
||||
}
|
||||
|
||||
void
|
||||
PlayStatus::setStatus (int status)
|
||||
{
|
||||
|
||||
if (status == XMMS_PLAYBACK_STATUS_STOP) {
|
||||
m_pixmap = m_pixmap_stop;
|
||||
} else if (status == XMMS_PLAYBACK_STATUS_PLAY) {
|
||||
m_pixmap = m_pixmap_play;
|
||||
} else if (status == XMMS_PLAYBACK_STATUS_PAUSE) {
|
||||
m_pixmap = m_pixmap_pause;
|
||||
}
|
||||
|
||||
update ();
|
||||
}
|
||||
|
27
PlayStatus.h
Normal file
27
PlayStatus.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef __PLAYSTATUS_H__
|
||||
#define __PLAYSTATUS_H__
|
||||
|
||||
#include <xmmsclient/xmmsclient.h>
|
||||
#include "PixWidget.h"
|
||||
|
||||
class PlayStatus : public PixWidget
|
||||
{
|
||||
public:
|
||||
PlayStatus (QWidget *parent);
|
||||
~PlayStatus () { }
|
||||
|
||||
void setStatus (int);
|
||||
|
||||
public slots:
|
||||
void setPixmaps (Skin *skin);
|
||||
|
||||
private:
|
||||
int m_status;
|
||||
|
||||
QPixmap m_pixmap_stop;
|
||||
QPixmap m_pixmap_play;
|
||||
QPixmap m_pixmap_pause;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -110,7 +110,7 @@ void
|
|||
TextScroller::drawQtFont (const QString &text)
|
||||
{
|
||||
QFont font(m_skin->getPLeditValue ("font"));
|
||||
font.setPointSize (6);
|
||||
font.setPixelSize (9);
|
||||
|
||||
QFontMetrics fM(font);
|
||||
QRect rect = fM.boundingRect (text);
|
||||
|
|
|
@ -25,6 +25,17 @@ XMMSHandler::XMMSHandler (MainWindow *mw) : sigc::trackable ()
|
|||
|
||||
r = m_xmmsc->broadcast_playback_current_id ();
|
||||
r->connect (sigc::mem_fun (this, &XMMSHandler::playback_current_id));
|
||||
|
||||
r = m_xmmsc->broadcast_playback_status ();
|
||||
r->connect (sigc::mem_fun (this, &XMMSHandler::playback_status));
|
||||
}
|
||||
|
||||
void
|
||||
XMMSHandler::playback_status (XMMSResult *res)
|
||||
{
|
||||
uint i;
|
||||
res->getValue (&i);
|
||||
m_mw->getMD ()->m_playstatus->setStatus (i);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -18,6 +18,7 @@ class XMMSHandler : public QObject, public sigc::trackable {
|
|||
void playback_playtime (XMMSResult *res);
|
||||
void playback_current_id (XMMSResult *res);
|
||||
void medialib_info (XMMSResult *res);
|
||||
void playback_status (XMMSResult *res);
|
||||
|
||||
const XMMSClient *getXMMS () { return m_xmmsc; }
|
||||
|
||||
|
|
10
promoe.pro
10
promoe.pro
|
@ -11,7 +11,8 @@ SOURCES += XmmsQT4.cpp \
|
|||
XMMSHandler.cpp \
|
||||
SmallNumberDisplay.cpp \
|
||||
StereoMono.cpp \
|
||||
Slider.cpp
|
||||
Slider.cpp \
|
||||
PlayStatus.cpp
|
||||
|
||||
HEADERS += XmmsQT4.h \
|
||||
PixWidget.h \
|
||||
|
@ -26,9 +27,8 @@ HEADERS += XmmsQT4.h \
|
|||
XMMSHandler.h \
|
||||
SmallNumberDisplay.h \
|
||||
StereoMono.h \
|
||||
Slider.h
|
||||
Slider.h \
|
||||
PlayStatus.h
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
CONFIG += debug
|
||||
QMAKE_CFLAGS_WARN_OFF += -Wno-unused-parameter
|
||||
PKGCONFIG += xmms2-client-cpp sigc++-2.0
|
||||
PKGCONFIG += xmms2-client xmms2-client-cpp sigc++-2.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue