Added clutterbar.
This commit is contained in:
parent
4f3395baae
commit
da993036aa
5 changed files with 109 additions and 1 deletions
62
ClutterBar.cpp
Normal file
62
ClutterBar.cpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
#include "ClutterBar.h"
|
||||
#include "Skin.h"
|
||||
|
||||
ClutterBar::ClutterBar (QWidget *parent) : PixWidget (parent)
|
||||
{
|
||||
}
|
||||
|
||||
ClutterBar::~ClutterBar ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ClutterBar::setPixmaps(Skin *skin)
|
||||
{
|
||||
m_clutter_on = skin->getItem(Skin::CLUTTER_ON);
|
||||
m_clutter_off = skin->getItem(Skin::CLUTTER_OFF);
|
||||
|
||||
m_clutter_o = skin->getItem(Skin::CLUTTER_O);
|
||||
m_clutter_a = skin->getItem(Skin::CLUTTER_A);
|
||||
m_clutter_i = skin->getItem(Skin::CLUTTER_I);
|
||||
m_clutter_d = skin->getItem(Skin::CLUTTER_D);
|
||||
m_clutter_v = skin->getItem(Skin::CLUTTER_V);
|
||||
|
||||
m_pixmap = m_clutter_on;
|
||||
|
||||
setMinimumSize (m_clutter_on.size ());
|
||||
setMaximumSize (m_clutter_on.size ());
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
ClutterBar::mousePressEvent (QMouseEvent *event)
|
||||
{
|
||||
int y = event->pos().y();
|
||||
|
||||
if (y > 2 && y < 11) {
|
||||
m_pixmap = m_clutter_o;
|
||||
} else if (y > 10 && y < 19) {
|
||||
m_pixmap = m_clutter_a;
|
||||
} else if (y > 18 && y < 27) {
|
||||
m_pixmap = m_clutter_i;
|
||||
} else if (y > 26 && y < 35) {
|
||||
m_pixmap = m_clutter_d;
|
||||
} else if (y > 34 && y < 43) {
|
||||
m_pixmap = m_clutter_v;
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
ClutterBar::mouseReleaseEvent (QMouseEvent *event)
|
||||
{
|
||||
m_pixmap = m_clutter_on;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
36
ClutterBar.h
Normal file
36
ClutterBar.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#ifndef __CLUTTERBAR_H__
|
||||
#define __CLUTTERBAR_H__
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include "PixWidget.h"
|
||||
|
||||
class ClutterBar : public PixWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ClutterBar (QWidget *parent);
|
||||
~ClutterBar ();
|
||||
|
||||
public slots:
|
||||
void setPixmaps(Skin *skin);
|
||||
|
||||
protected:
|
||||
void mousePressEvent (QMouseEvent *event);
|
||||
void mouseReleaseEvent (QMouseEvent *event);
|
||||
|
||||
QPixmap m_clutter_off;
|
||||
QPixmap m_clutter_on;
|
||||
|
||||
QPixmap m_clutter_o;
|
||||
QPixmap m_clutter_a;
|
||||
QPixmap m_clutter_i;
|
||||
QPixmap m_clutter_d;
|
||||
QPixmap m_clutter_v;
|
||||
|
||||
bool enabled;
|
||||
|
||||
int m_ypos;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -14,6 +14,7 @@
|
|||
#include "PlayStatus.h"
|
||||
#include "VolumeSlider.h"
|
||||
#include "Playlist.h"
|
||||
#include "ClutterBar.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QSettings>
|
||||
|
@ -47,6 +48,9 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
|||
m_stereo->move (212, 41);
|
||||
m_stereo->setStereoMono (0, 0);
|
||||
|
||||
m_clutterbar = new ClutterBar (this);
|
||||
m_clutterbar->move (10, 22);
|
||||
|
||||
m_slider = new Slider (this, Skin::POSBAR,
|
||||
Skin::POSBAR_BTN_0,
|
||||
Skin::POSBAR_BTN_1);
|
||||
|
|
|
@ -40,6 +40,7 @@ class Slider;
|
|||
class VolumeSlider;
|
||||
class PlayStatus;
|
||||
class MainWindow;
|
||||
class ClutterBar;
|
||||
|
||||
class MainDisplay : public SkinDisplay
|
||||
{
|
||||
|
@ -90,6 +91,8 @@ class MainDisplay : public SkinDisplay
|
|||
|
||||
MainWindow *m_mw;
|
||||
|
||||
ClutterBar *m_clutterbar;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,9 @@ SOURCES += XmmsQT4.cpp \
|
|||
qtmd5.cpp \
|
||||
SettingsWindow.cpp \
|
||||
PlaylistMenu.cpp \
|
||||
VolumeSlider.cpp
|
||||
VolumeSlider.cpp \
|
||||
ClutterBar.cpp \
|
||||
|
||||
|
||||
HEADERS += XmmsQT4.h \
|
||||
PixWidget.h \
|
||||
|
@ -49,6 +51,7 @@ HEADERS += XmmsQT4.h \
|
|||
SettingsWindow.h \
|
||||
PlaylistMenu.h \
|
||||
VolumeSlider.h \
|
||||
ClutterBar.h \
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue