Renamed Slider class to PosBar.
This commit is contained in:
parent
d114edf75f
commit
0c233da62a
5 changed files with 38 additions and 38 deletions
|
@ -10,7 +10,7 @@
|
||||||
#include "TimeDisplay.h"
|
#include "TimeDisplay.h"
|
||||||
#include "SmallNumberDisplay.h"
|
#include "SmallNumberDisplay.h"
|
||||||
#include "StereoMono.h"
|
#include "StereoMono.h"
|
||||||
#include "Slider.h"
|
#include "PosBar.h"
|
||||||
#include "PlayStatus.h"
|
#include "PlayStatus.h"
|
||||||
#include "VolumeSlider.h"
|
#include "VolumeSlider.h"
|
||||||
#include "Playlist.h"
|
#include "Playlist.h"
|
||||||
|
@ -51,10 +51,10 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
||||||
m_clutterbar = new ClutterBar (this);
|
m_clutterbar = new ClutterBar (this);
|
||||||
m_clutterbar->move (10, 22);
|
m_clutterbar->move (10, 22);
|
||||||
|
|
||||||
m_slider = new Slider (this, Skin::POSBAR,
|
m_posbar = new PosBar (this, Skin::POSBAR,
|
||||||
Skin::POSBAR_BTN_0,
|
Skin::POSBAR_BTN_0,
|
||||||
Skin::POSBAR_BTN_1);
|
Skin::POSBAR_BTN_1);
|
||||||
m_slider->move (16, 72);
|
m_posbar->move (16, 72);
|
||||||
|
|
||||||
m_playstatus = new PlayStatus (this);
|
m_playstatus = new PlayStatus (this);
|
||||||
m_playstatus->move (24, 28);
|
m_playstatus->move (24, 28);
|
||||||
|
@ -105,8 +105,8 @@ MainDisplay::setStatus (Xmms::Playback::Status status)
|
||||||
{
|
{
|
||||||
if (status == Xmms::Playback::STOPPED) {
|
if (status == Xmms::Playback::STOPPED) {
|
||||||
m_time->setTime(0);
|
m_time->setTime(0);
|
||||||
m_slider->setPos (0);
|
m_posbar->setPos (0);
|
||||||
m_slider->hideBar (true);
|
m_posbar->hideBar (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ MainDisplay::setPlaytime (uint time)
|
||||||
{
|
{
|
||||||
uint showtime;
|
uint showtime;
|
||||||
if (m_mw->isTimemodeReverse()) {
|
if (m_mw->isTimemodeReverse()) {
|
||||||
uint maxtime = m_slider->getMax();
|
uint maxtime = m_posbar->getMax();
|
||||||
showtime = -(maxtime - time);
|
showtime = -(maxtime - time);
|
||||||
} else {
|
} else {
|
||||||
showtime = time;
|
showtime = time;
|
||||||
|
@ -123,7 +123,7 @@ MainDisplay::setPlaytime (uint time)
|
||||||
m_time->setTime (showtime);
|
m_time->setTime (showtime);
|
||||||
|
|
||||||
// update slider
|
// update slider
|
||||||
m_slider->setPos (time);
|
m_posbar->setPos (time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -166,10 +166,10 @@ MainDisplay::setMediainfo (const Xmms::PropDict &info)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.contains ("duration")) {
|
if (info.contains ("duration")) {
|
||||||
m_slider->setMax (info.get<int32_t> ("duration"));
|
m_posbar->setMax (info.get<int32_t> ("duration"));
|
||||||
m_slider->hideBar (false);
|
m_posbar->hideBar (false);
|
||||||
} else {
|
} else {
|
||||||
m_slider->hideBar (true);
|
m_posbar->hideBar (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class TextScroller;
|
||||||
class TimeDisplay;
|
class TimeDisplay;
|
||||||
class SmallNumberDisplay;
|
class SmallNumberDisplay;
|
||||||
class StereoMono;
|
class StereoMono;
|
||||||
class Slider;
|
class PosBar;
|
||||||
class VolumeSlider;
|
class VolumeSlider;
|
||||||
class PlayStatus;
|
class PlayStatus;
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
@ -58,7 +58,7 @@ class MainDisplay : public SkinDisplay
|
||||||
SmallNumberDisplay *m_khz;
|
SmallNumberDisplay *m_khz;
|
||||||
|
|
||||||
StereoMono *m_stereo;
|
StereoMono *m_stereo;
|
||||||
Slider *m_slider;
|
PosBar *m_posbar;
|
||||||
VolumeSlider *m_vslider;
|
VolumeSlider *m_vslider;
|
||||||
|
|
||||||
PlayStatus *m_playstatus;
|
PlayStatus *m_playstatus;
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
#include "Slider.h"
|
#include "PosBar.h"
|
||||||
#include "Skin.h"
|
#include "Skin.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
BarButton::BarButton (QWidget *parent, uint normal, uint pressed) : Button (parent, normal, pressed)
|
PosButton::PosButton (QWidget *parent, uint normal, uint pressed) : Button (parent, normal, pressed)
|
||||||
{
|
{
|
||||||
m_slider = dynamic_cast<Slider *>(parent);
|
m_slider = dynamic_cast<PosBar *>(parent);
|
||||||
setMinimumSize (29, 10);
|
setMinimumSize (29, 10);
|
||||||
setMaximumSize (29, 10);
|
setMaximumSize (29, 10);
|
||||||
m_moving = false;
|
m_moving = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BarButton::setPos (uint pos)
|
PosButton::setPos (uint pos)
|
||||||
{
|
{
|
||||||
m_pos = pos;
|
m_pos = pos;
|
||||||
if (!m_moving) {
|
if (!m_moving) {
|
||||||
|
@ -24,13 +24,13 @@ BarButton::setPos (uint pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint
|
uint
|
||||||
BarButton::getPos (void)
|
PosButton::getPos (void)
|
||||||
{
|
{
|
||||||
return m_pos;
|
return m_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BarButton::mousePressEvent (QMouseEvent *event)
|
PosButton::mousePressEvent (QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QPoint p (event->pos ());
|
QPoint p (event->pos ());
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ BarButton::mousePressEvent (QMouseEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BarButton::mouseReleaseEvent (QMouseEvent *event)
|
PosButton::mouseReleaseEvent (QMouseEvent *event)
|
||||||
{
|
{
|
||||||
m_moving = false;
|
m_moving = false;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ BarButton::mouseReleaseEvent (QMouseEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BarButton::mouseMoveEvent (QMouseEvent *event)
|
PosButton::mouseMoveEvent (QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QPoint p (event->pos ());
|
QPoint p (event->pos ());
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ BarButton::mouseMoveEvent (QMouseEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Slider::Slider (QWidget *parent, uint bg, uint bnormal, uint bpressed, bool vertical) : PixWidget (parent)
|
PosBar::PosBar (QWidget *parent, uint bg, uint bnormal, uint bpressed, bool vertical) : PixWidget (parent)
|
||||||
{
|
{
|
||||||
m_bg = bg;
|
m_bg = bg;
|
||||||
m_vertical = vertical;
|
m_vertical = vertical;
|
||||||
|
@ -87,7 +87,7 @@ Slider::Slider (QWidget *parent, uint bg, uint bnormal, uint bpressed, bool vert
|
||||||
|
|
||||||
m_max = 0;
|
m_max = 0;
|
||||||
|
|
||||||
m_button = new BarButton (this, bnormal, bpressed);
|
m_button = new PosButton (this, bnormal, bpressed);
|
||||||
m_button->move (0, 0);
|
m_button->move (0, 0);
|
||||||
|
|
||||||
if (m_vertical) {
|
if (m_vertical) {
|
||||||
|
@ -101,7 +101,7 @@ Slider::Slider (QWidget *parent, uint bg, uint bnormal, uint bpressed, bool vert
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Slider::setSize (uint x, uint y)
|
PosBar::setSize (uint x, uint y)
|
||||||
{
|
{
|
||||||
setMinimumSize (x, y);
|
setMinimumSize (x, y);
|
||||||
setMaximumSize (x, y);
|
setMaximumSize (x, y);
|
||||||
|
@ -115,7 +115,7 @@ Slider::setSize (uint x, uint y)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint
|
uint
|
||||||
Slider::getPos (void)
|
PosBar::getPos (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_vertical) {
|
if (m_vertical) {
|
||||||
|
@ -126,7 +126,7 @@ Slider::getPos (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Slider::hideBar (bool b)
|
PosBar::hideBar (bool b)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (b) {
|
if (b) {
|
||||||
|
@ -139,7 +139,7 @@ Slider::hideBar (bool b)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Slider::setPos (uint p)
|
PosBar::setPos (uint p)
|
||||||
{
|
{
|
||||||
if (!m_max) {
|
if (!m_max) {
|
||||||
return;
|
return;
|
||||||
|
@ -153,13 +153,13 @@ Slider::setPos (uint p)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Slider::requestPos (float value)
|
PosBar::requestPos (float value)
|
||||||
{
|
{
|
||||||
XMMSHandler::getInstance ().setPlaytime (m_max * value);
|
XMMSHandler::getInstance ().setPlaytime (m_max * value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Slider::setPixmaps (Skin *skin)
|
PosBar::setPixmaps (Skin *skin)
|
||||||
{
|
{
|
||||||
m_pixmap = skin->getItem (m_bg);
|
m_pixmap = skin->getItem (m_bg);
|
||||||
}
|
}
|
|
@ -4,12 +4,12 @@
|
||||||
#include "PixWidget.h"
|
#include "PixWidget.h"
|
||||||
#include "Button.h"
|
#include "Button.h"
|
||||||
|
|
||||||
class Slider;
|
class PosBar;
|
||||||
|
|
||||||
class BarButton : public Button
|
class PosButton : public Button
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BarButton (QWidget *, uint, uint);
|
PosButton (QWidget *, uint, uint);
|
||||||
|
|
||||||
void mouseMoveEvent (QMouseEvent *);
|
void mouseMoveEvent (QMouseEvent *);
|
||||||
void mousePressEvent (QMouseEvent *);
|
void mousePressEvent (QMouseEvent *);
|
||||||
|
@ -19,18 +19,18 @@ class BarButton : public Button
|
||||||
uint getPos (void);
|
uint getPos (void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Slider *m_slider;
|
PosBar *m_slider;
|
||||||
bool m_moving;
|
bool m_moving;
|
||||||
uint m_pos;
|
uint m_pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Slider : public PixWidget
|
class PosBar : public PixWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Slider (QWidget *parent, uint bg, uint bnormal, uint bpressed, bool vertical=true);
|
PosBar (QWidget *parent, uint bg, uint bnormal, uint bpressed, bool vertical=true);
|
||||||
~Slider () { }
|
~PosBar () { }
|
||||||
|
|
||||||
void setSize (uint, uint);
|
void setSize (uint, uint);
|
||||||
uint getPos (void);
|
uint getPos (void);
|
||||||
|
@ -50,7 +50,7 @@ class Slider : public PixWidget
|
||||||
int m_bg;
|
int m_bg;
|
||||||
uint m_max;
|
uint m_max;
|
||||||
uint m_pix;
|
uint m_pix;
|
||||||
BarButton *m_button;
|
PosButton *m_button;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@ SOURCES += XmmsQT4.cpp \
|
||||||
XMMSSocket.cpp \
|
XMMSSocket.cpp \
|
||||||
SmallNumberDisplay.cpp \
|
SmallNumberDisplay.cpp \
|
||||||
StereoMono.cpp \
|
StereoMono.cpp \
|
||||||
Slider.cpp \
|
PosBar.cpp \
|
||||||
PlayStatus.cpp \
|
PlayStatus.cpp \
|
||||||
ShadedDisplay.cpp \
|
ShadedDisplay.cpp \
|
||||||
Playlist.cpp \
|
Playlist.cpp \
|
||||||
|
@ -47,7 +47,7 @@ HEADERS += XmmsQT4.h \
|
||||||
XMMSSocket.h \
|
XMMSSocket.h \
|
||||||
SmallNumberDisplay.h \
|
SmallNumberDisplay.h \
|
||||||
StereoMono.h \
|
StereoMono.h \
|
||||||
Slider.h \
|
PosBar.h \
|
||||||
PlayStatus.h \
|
PlayStatus.h \
|
||||||
ShadedDisplay.h \
|
ShadedDisplay.h \
|
||||||
Playlist.h \
|
Playlist.h \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue