Try to make the Slider class a bit more generic.

Use the new slider in volume, balance and equalizer.
This commit is contained in:
Daniel Svensson 2006-08-19 02:11:18 +02:00
parent 0c233da62a
commit c2f1f3b185
10 changed files with 354 additions and 340 deletions

View file

@ -1,67 +1,77 @@
#ifndef __VOLUMESLIDER_H__
#define __VOLUMESLIDER_H__
#include "PixWidget.h"
class VolumeSlider;
class Slider;
class MainDisplay;
class Button;
class VolButton : public PixWidget
#include "Button.h"
class SliderButton : public Button
{
Q_OBJECT
public:
VolButton (QWidget *, uint, uint);
~VolButton ();
SliderButton (QWidget *parent, uint normal, uint pressed, bool dir);
void mouseMoveEvent (QMouseEvent *);
void mousePressEvent (QMouseEvent *);
void mouseReleaseEvent (QMouseEvent *);
void setPos (uint);
public slots:
void setPixmaps (Skin *skin);
void setVolume (uint volume_base100);
//void setValue (uint volume_base100);
private:
void changePixmap (bool pressed);
void drawPixmaps();
VolumeSlider *m_volslider;
Skin *m_skin;
QPixmap m_volbtn;
uint m_normal;
uint m_pressed;
Slider *m_slider;
bool m_vertical;
int m_diff;
bool m_moving;
};
class VolumeSlider : public PixWidget
class Slider : public PixWidget
{
Q_OBJECT
public:
VolumeSlider (QWidget *parent);
~VolumeSlider ();
Slider (QWidget *parent, uint min, uint max, uint on, uint off, int, int);
void paintEvent (QPaintEvent *event);
void mouseMoveEvent (QMouseEvent *);
void mousePressEvent (QMouseEvent *);
void mouseReleaseEvent (QMouseEvent *);
uint getVolume (void) { return m_volume_base100; };
public slots:
void setPixmaps (Skin *skin);
void setVolume (uint volume_base100);
void setPos (int value, bool tell);
void setValue (int value);
signals:
void valueChanged (int val);
private:
void drawPixmaps ();
void updatePos (QMouseEvent *event);
void changePixmap ();
QPixmap m_volslider;
VolButton *m_volbtn;
QPixmap m_pixmap_slider;
SliderButton *m_button;
Skin *m_skin;
int m_volume;
uint m_value_index;
int m_value;
int m_position;
uint m_volume_base100;
bool m_hasvolbtn;
uint m_name_min;
uint m_name_max;
uint m_name_on;
uint m_name_off;
int m_min;
int m_max;
bool m_vertical;
};
#endif