2016-10-10 13:29:41 -04:00
|
|
|
#ifndef ICON_H
|
|
|
|
#define ICON_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2016-10-16 17:04:21 -04:00
|
|
|
#include <QToolButton>
|
2016-10-10 13:29:41 -04:00
|
|
|
#include <QMediaPlayer>
|
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QSvgRenderer>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QPaintEvent>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QDesktopWidget>
|
2016-10-23 21:26:58 -04:00
|
|
|
#include <QSlider>
|
2016-10-10 13:29:41 -04:00
|
|
|
|
2016-10-16 17:04:21 -04:00
|
|
|
class Icon : public QToolButton
|
2016-10-10 13:29:41 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum IconType
|
|
|
|
{
|
|
|
|
PAUSE_PLAY,
|
2016-10-16 17:04:21 -04:00
|
|
|
MENU,
|
2016-10-23 21:26:58 -04:00
|
|
|
OPEN,
|
|
|
|
STOP,
|
|
|
|
PREV,
|
|
|
|
NEXT,
|
|
|
|
VOL_UP,
|
|
|
|
VOL_DOWN,
|
|
|
|
RESTORE
|
2016-10-10 13:29:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
Icon(IconType t, QWidget *parent = 0);
|
|
|
|
|
2016-10-23 21:26:58 -04:00
|
|
|
void setSlider(QSlider *slider);
|
|
|
|
|
2016-10-10 13:29:41 -04:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void stateChanged(QMediaPlayer::State state);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
IconType type;
|
|
|
|
QMediaPlayer::State playerState;
|
|
|
|
QString svgFile;
|
2016-10-23 21:26:58 -04:00
|
|
|
QSlider *volSlider;
|
2016-10-10 13:29:41 -04:00
|
|
|
|
|
|
|
void paintEvent(QPaintEvent *);
|
|
|
|
void loadImg(const QString &path);
|
|
|
|
|
2016-10-16 17:04:21 -04:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void buttonClicked();
|
|
|
|
|
2016-10-10 13:29:41 -04:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void pause();
|
|
|
|
void play();
|
|
|
|
void settings();
|
|
|
|
void open();
|
2016-10-23 21:26:58 -04:00
|
|
|
void next();
|
|
|
|
void prev();
|
|
|
|
void stop();
|
|
|
|
void restore();
|
2016-10-10 13:29:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ICON_H
|