73a8c03fa1
and added some options to the menu that changes the behaviour of the app. such as turning on/off the auto playing of files and the directory and volume control. this is all kept persistent using an IDM formated file in the app's config directory. still having issues with it not calculating the durations properly but i now know why. it's because QMediaPlayer can't calculate the durations of VBR files (variable bit- rate) properly. other than that, everything seems to be working perfectly. i'll add more feasures such as a next/previous file button and a stop button.
57 lines
854 B
C++
57 lines
854 B
C++
#ifndef ICON_H
|
|
#define ICON_H
|
|
|
|
#include <QWidget>
|
|
#include <QToolButton>
|
|
#include <QMediaPlayer>
|
|
#include <QMouseEvent>
|
|
#include <QSvgRenderer>
|
|
#include <QPixmap>
|
|
#include <QPainter>
|
|
#include <QPaintEvent>
|
|
#include <QApplication>
|
|
#include <QRect>
|
|
#include <QDesktopWidget>
|
|
|
|
class Icon : public QToolButton
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum IconType
|
|
{
|
|
PAUSE_PLAY,
|
|
MENU,
|
|
OPEN
|
|
};
|
|
|
|
Icon(IconType t, QWidget *parent = 0);
|
|
|
|
public slots:
|
|
|
|
void stateChanged(QMediaPlayer::State state);
|
|
|
|
private:
|
|
|
|
IconType type;
|
|
QMediaPlayer::State playerState;
|
|
QString svgFile;
|
|
|
|
void paintEvent(QPaintEvent *);
|
|
void loadImg(const QString &path);
|
|
|
|
private slots:
|
|
|
|
void buttonClicked();
|
|
|
|
signals:
|
|
|
|
void pause();
|
|
void play();
|
|
void settings();
|
|
void open();
|
|
};
|
|
|
|
#endif // ICON_H
|