Added a PixmapSlider class and changed Slider to inherit from it.
PixmapSlider is a subclass of QAbstractSlider. It is independent of Skin.cpp. Slider is now only a wrapper to update the QPixmaps on a skin change. removed a workaround from equalizerwidget, that was necessary for the previous implementation. 2-3 one line fixes I don't remember
This commit is contained in:
parent
88b8ab8683
commit
6e7e2c2184
10 changed files with 311 additions and 280 deletions
69
src/widgets/pixmapslider.h
Normal file
69
src/widgets/pixmapslider.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* This file is a part of Promoe, an XMMS2 CLient
|
||||
*
|
||||
* Copyright (C) 2008 Thomas Frauendorfer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __PIXMAPSLIDER_H__
|
||||
#define __PIXMAPSLIDER_H__
|
||||
|
||||
#include <QAbstractSlider>
|
||||
#include <QList>
|
||||
|
||||
class QWidget;
|
||||
class QPixmap;
|
||||
class QPaintEvent;
|
||||
class QMouseEvent;
|
||||
|
||||
typedef QList<QPixmap> QPixmapList;
|
||||
|
||||
class PixmapSlider : public QAbstractSlider
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PixmapSlider (QWidget *parent);
|
||||
~PixmapSlider () {}
|
||||
|
||||
void setValue (int val);
|
||||
|
||||
void setBackground (const QPixmap &);
|
||||
void setBackground (const QPixmapList &);
|
||||
QPixmapList backgrounds () const { return m_backgrounds; }
|
||||
|
||||
void setSliders (QPixmap normal, QPixmap pressed = QPixmap ());
|
||||
QPixmap normalSlider () const { return m_normal; }
|
||||
QPixmap pressedSlider () const { return m_pressed; }
|
||||
|
||||
protected slots:
|
||||
void paintEvent (QPaintEvent *event);
|
||||
|
||||
void mouseMoveEvent (QMouseEvent *);
|
||||
void mousePressEvent (QMouseEvent *);
|
||||
void mouseReleaseEvent (QMouseEvent *);
|
||||
|
||||
protected:
|
||||
int sliderMovePosition (QMouseEvent *);
|
||||
|
||||
int sliderPositionFromValue ();
|
||||
int sliderValueFromPosition (int pos);
|
||||
int backgroundIndex ();
|
||||
|
||||
private:
|
||||
QPixmapList m_backgrounds;
|
||||
QPixmap m_normal;
|
||||
QPixmap m_pressed;
|
||||
|
||||
int m_background_index;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue