Time display reverse
both minus and numberdisplays clickable skin minus now visible drawing minus-line (skins without minus) in correct color. stop now contains minus as well.
This commit is contained in:
parent
73e283cc48
commit
beeaeb95b1
10 changed files with 170 additions and 17 deletions
|
|
@ -22,11 +22,8 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
|||
m_text = new TextScroller (this, 154, 15, "main");
|
||||
m_text->move (109, 23);
|
||||
|
||||
m_number = new NumberDisplay (this, 33, 11);
|
||||
m_number->move (37, 26);
|
||||
|
||||
m_number2 = new NumberDisplay (this, 24, 0);
|
||||
m_number2->move (78, 26);
|
||||
m_time = new TimeDisplay(this, 0);
|
||||
connect (m_time, SIGNAL(clicked()), this, SLOT(toggleTime()));
|
||||
|
||||
m_kbps = new SmallNumberDisplay (this, 15);
|
||||
m_kbps->move (111, 43);
|
||||
|
|
@ -76,8 +73,7 @@ void
|
|||
MainDisplay::setStatus (uint status)
|
||||
{
|
||||
if (status == XMMS_PLAYBACK_STATUS_STOP) {
|
||||
m_number->setNumber (0, 0);
|
||||
m_number2->setNumber (0, 0);
|
||||
m_time->setTime(0);
|
||||
m_slider->setPos (0);
|
||||
m_slider->hideBar (true);
|
||||
}
|
||||
|
|
@ -86,13 +82,14 @@ MainDisplay::setStatus (uint status)
|
|||
void
|
||||
MainDisplay::setPlaytime (uint time)
|
||||
{
|
||||
uint sec, min;
|
||||
|
||||
sec = (time / 1000) % 60;
|
||||
min = (time / 1000) / 60;
|
||||
|
||||
m_number->setNumber (min / 10, min % 10);
|
||||
m_number2->setNumber (sec / 10, sec % 10);
|
||||
uint showtime;
|
||||
if (m_mw->isTimemodeReverse()) {
|
||||
uint maxtime = m_slider->getMax();
|
||||
showtime = -(maxtime - time);
|
||||
} else {
|
||||
showtime = time;
|
||||
}
|
||||
m_time->setTime (showtime);
|
||||
|
||||
// update slider
|
||||
m_slider->setPos (time);
|
||||
|
|
@ -151,6 +148,11 @@ MainDisplay::togglePL (void)
|
|||
{
|
||||
m_mw->togglePL(false);
|
||||
}
|
||||
void
|
||||
MainDisplay::toggleTime (void)
|
||||
{
|
||||
m_mw->setTimemodeReverse (!m_mw->isTimemodeReverse());
|
||||
}
|
||||
|
||||
void
|
||||
MainDisplay::SetupPushButtons (void)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class MainDisplay;
|
|||
#include "Button.h"
|
||||
#include "TextBar.h"
|
||||
#include "NumberDisplay.h"
|
||||
#include "TimeDisplay.h"
|
||||
#include "SmallNumberDisplay.h"
|
||||
#include "StereoMono.h"
|
||||
#include "Slider.h"
|
||||
|
|
@ -35,8 +36,7 @@ class MainDisplay : public SkinDisplay
|
|||
ToggleButton *GetPls() {return m_pls;};
|
||||
|
||||
TextScroller *m_text;
|
||||
NumberDisplay *m_number;
|
||||
NumberDisplay *m_number2;
|
||||
TimeDisplay *m_time;
|
||||
|
||||
SmallNumberDisplay *m_kbps;
|
||||
SmallNumberDisplay *m_khz;
|
||||
|
|
@ -46,6 +46,7 @@ class MainDisplay : public SkinDisplay
|
|||
VolumeSlider *m_vslider;
|
||||
|
||||
PlayStatus *m_playstatus;
|
||||
MainWindow *getMW(void) { return m_mw; }
|
||||
|
||||
public slots:
|
||||
void setPixmaps(Skin *skin);
|
||||
|
|
@ -53,6 +54,7 @@ class MainDisplay : public SkinDisplay
|
|||
void setPlaytime (uint time);
|
||||
void setMediainfo (const QHash<QString,QString> &);
|
||||
void togglePL(void);
|
||||
void toggleTime(void);
|
||||
|
||||
protected:
|
||||
void SetupPushButtons (void);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ class MainWindow : public QMainWindow
|
|||
void raisePL (void) { m_playlistwin->raise (); }
|
||||
void moveEvent (QMoveEvent *event);
|
||||
void togglePL (bool UpdateButton);
|
||||
bool isTimemodeReverse(void) { QSettings s; return s.value("MainWindow/timemodereverse").toBool(); }
|
||||
void setTimemodeReverse(bool b) { QSettings s; return s.setValue("MainWindow/timemodereverse",b); }
|
||||
|
||||
public slots:
|
||||
void switchDisplay ();
|
||||
|
|
|
|||
|
|
@ -46,3 +46,13 @@ NumberDisplay::setNumber (uint n1, uint n2)
|
|||
NumberDisplay::~NumberDisplay ()
|
||||
{
|
||||
}
|
||||
void
|
||||
NumberDisplay::mousePressEvent (QMouseEvent *event)
|
||||
{
|
||||
}
|
||||
void
|
||||
NumberDisplay::mouseReleaseEvent (QMouseEvent *event)
|
||||
{
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,12 @@ class NumberDisplay : public PixWidget
|
|||
|
||||
public slots:
|
||||
void setPixmaps (Skin *skin);
|
||||
signals:
|
||||
void clicked(void);
|
||||
|
||||
protected:
|
||||
void mousePressEvent (QMouseEvent *event);
|
||||
void mouseReleaseEvent (QMouseEvent *event);
|
||||
int m_w;
|
||||
int m_startpx;
|
||||
|
||||
|
|
|
|||
1
Skin.h
1
Skin.h
|
|
@ -24,6 +24,7 @@ class Skin : public QWidget
|
|||
const QPixmap getBal (uint p) const { return m_balance[p]; }
|
||||
const QPixmap getLetter (uint c) const { return m_letterMap[c]; }
|
||||
const QPixmap getNumber (uint c) const { return m_numbers[c]; }
|
||||
uint getNumberSize () { return m_numbers.size(); }
|
||||
const QByteArray getPLeditValue (QByteArray c) const { return m_pledit_txt[c]; }
|
||||
const bool getVolBtn(void) const { return m_volbtn; }
|
||||
const bool getBalBtn(void) const { return m_balbtn; }
|
||||
|
|
|
|||
1
Slider.h
1
Slider.h
|
|
@ -38,6 +38,7 @@ class Slider : public PixWidget
|
|||
void requestPos (float value);
|
||||
|
||||
void setMax (uint max) { m_max = max; }
|
||||
uint getMax () { return m_max; }
|
||||
void hideBar (bool b);
|
||||
bool getVertical () { return m_vertical; }
|
||||
|
||||
|
|
|
|||
99
TimeDisplay.cpp
Normal file
99
TimeDisplay.cpp
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
#include "MainDisplay.h"
|
||||
#include "TimeDisplay.h"
|
||||
#include "NumberDisplay.h"
|
||||
|
||||
#include <QPen>
|
||||
|
||||
TimeDisplay::TimeDisplay (QWidget *parent, int time) : PixWidget (parent)
|
||||
{
|
||||
uint w = 12;//+78;
|
||||
|
||||
m_w = w;
|
||||
|
||||
m_pixmap = QPixmap (m_w, 13);
|
||||
|
||||
setMinimumSize (m_w, 13);
|
||||
setMaximumSize (m_w, 13);
|
||||
move (37, 26);
|
||||
|
||||
//FIXME: let this be the parent
|
||||
/* XXX: colon disappear, how make transparent?
|
||||
m_number_min = new NumberDisplay (this, 24, 0);
|
||||
m_number_min->move (10, 0);
|
||||
m_number_sec = new NumberDisplay (this, 24, 0);
|
||||
m_number_sec->move (78-37, 0);
|
||||
*/
|
||||
|
||||
m_number_min = new NumberDisplay (parent, 24, 0);
|
||||
m_number_min->move (37+10, 26);
|
||||
m_number_sec = new NumberDisplay (parent, 24, 0);
|
||||
m_number_sec->move (78, 26);
|
||||
|
||||
connect (m_number_min, SIGNAL(clicked()), parent, SLOT(toggleTime()));
|
||||
connect (m_number_sec, SIGNAL(clicked()), parent, SLOT(toggleTime()));
|
||||
}
|
||||
void TimeDisplay::setPixmaps (Skin *skin)
|
||||
{
|
||||
drawMinus();
|
||||
m_number_min->setPixmaps (skin);
|
||||
m_number_sec->setPixmaps (skin);
|
||||
}
|
||||
TimeDisplay::~TimeDisplay ()
|
||||
{
|
||||
}
|
||||
void TimeDisplay::setTime (int time)
|
||||
{
|
||||
if (m_time == time) return;
|
||||
m_time = time;
|
||||
|
||||
uint showtime = abs(time);
|
||||
uint sec, min;
|
||||
|
||||
sec = (showtime / 1000) % 60;
|
||||
min = (showtime / 1000) / 60;
|
||||
|
||||
m_number_min->setNumber (min / 10, min % 10);
|
||||
m_number_sec->setNumber (sec / 10, sec % 10);
|
||||
|
||||
drawMinus ();
|
||||
}
|
||||
void
|
||||
TimeDisplay::drawMinus ()
|
||||
{
|
||||
Skin *skin = Skin::getInstance ();
|
||||
|
||||
// Draw background
|
||||
QBrush b (Qt::TexturePattern);
|
||||
b.setTexture (skin->getNumber (10));
|
||||
|
||||
QPainter paint;
|
||||
paint.begin (&m_pixmap);
|
||||
paint.fillRect (m_pixmap.rect (), b);
|
||||
MainDisplay *md = dynamic_cast<MainDisplay *>(parent());
|
||||
|
||||
if (md->getMW()->isTimemodeReverse()) {// draw a minus sign
|
||||
if (skin->getNumberSize() < 12) { // Skin hasn't got any, draw a line in correct color.
|
||||
QByteArray a = skin->getPLeditValue("normal");
|
||||
QColor c;
|
||||
c.setNamedColor(a);
|
||||
QPen pen(c);
|
||||
paint.setPen(pen);
|
||||
paint.drawLine (3,6,8,6);
|
||||
} else {
|
||||
paint.drawPixmap (0, 0, skin->getNumber (11));
|
||||
}
|
||||
}
|
||||
paint.end();
|
||||
|
||||
update ();
|
||||
}
|
||||
void
|
||||
TimeDisplay::mousePressEvent (QMouseEvent *event)
|
||||
{
|
||||
}
|
||||
void
|
||||
TimeDisplay::mouseReleaseEvent (QMouseEvent *event)
|
||||
{
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
30
TimeDisplay.h
Normal file
30
TimeDisplay.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef __TIMEDISPLAY_H__
|
||||
#define __TIMEDISPLAY_H__
|
||||
|
||||
#include "PixWidget.h"
|
||||
#include "NumberDisplay.h"
|
||||
|
||||
class TimeDisplay : public PixWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimeDisplay (QWidget *parent, int time);
|
||||
~TimeDisplay ();
|
||||
void setTime (int);
|
||||
public slots:
|
||||
void setPixmaps (Skin *skin);
|
||||
signals:
|
||||
void clicked(void);
|
||||
|
||||
protected:
|
||||
void mousePressEvent (QMouseEvent *event);
|
||||
void mouseReleaseEvent (QMouseEvent *event);
|
||||
void drawMinus();
|
||||
int m_time;
|
||||
NumberDisplay *m_number_min;
|
||||
NumberDisplay *m_number_sec;
|
||||
|
||||
uint m_w;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -8,6 +8,7 @@ SOURCES += XmmsQT4.cpp \
|
|||
Button.cpp \
|
||||
TextBar.cpp \
|
||||
NumberDisplay.cpp \
|
||||
TimeDisplay.cpp \
|
||||
XMMSHandler.cpp \
|
||||
SmallNumberDisplay.cpp \
|
||||
StereoMono.cpp \
|
||||
|
|
@ -37,6 +38,7 @@ HEADERS += XmmsQT4.h \
|
|||
Button.h \
|
||||
TextBar.h \
|
||||
NumberDisplay.h \
|
||||
TimeDisplay.h \
|
||||
XMMSHandler.h \
|
||||
SmallNumberDisplay.h \
|
||||
StereoMono.h \
|
||||
|
|
@ -68,7 +70,7 @@ QMAKE_LFLAGS += -L$$[QT_INSTALL_PLUGINS]/imageformats
|
|||
CONFIG += link_pkgconfig
|
||||
|
||||
;QMAKE_CXXFLAGS += -g
|
||||
CONFIG += debug warn_on
|
||||
;CONFIG += debug warn_on
|
||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
|
||||
PKGCONFIG += xmms2-client xmms2-client-cpp sigc++-2.0
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue