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.
75 lines
1.1 KiB
C++
75 lines
1.1 KiB
C++
#ifndef CONF_H
|
|
#define CONF_H
|
|
|
|
#include <QObject>
|
|
#include <QWidgetAction>
|
|
#include <QMenu>
|
|
#include <QSlider>
|
|
#include <QWidget>
|
|
#include <QHBoxLayout>
|
|
#include <QLabel>
|
|
#include <QCheckBox>
|
|
#include <QFile>
|
|
#include <QDir>
|
|
#include <QApplication>
|
|
|
|
#include "idm.h"
|
|
|
|
class MenuItem : public QWidgetAction
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
|
|
QString str;
|
|
QWidget *wid;
|
|
|
|
QWidget *createWidget(QWidget *parent);
|
|
|
|
public:
|
|
|
|
MenuItem(const QString &label, QWidget *widget, QObject *parent = 0);
|
|
};
|
|
|
|
class Conf : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
|
|
enum DataType
|
|
{
|
|
LAST_PATH = 1,
|
|
NEXT_FILE,
|
|
VOLUME
|
|
};
|
|
|
|
QString lastPath;
|
|
bool nextFileState;
|
|
int volumeValue;
|
|
|
|
void sync();
|
|
QString confPath();
|
|
|
|
public slots:
|
|
|
|
void setLastPath(const QString &path);
|
|
void setNextFile(bool state);
|
|
void setVolume(int value);
|
|
|
|
public:
|
|
|
|
QString getLastPath();
|
|
bool nextFile();
|
|
void populateOptionsMenu(QMenu *menu, QWidget *parent);
|
|
int getVolume();
|
|
|
|
Conf(QObject *parent = 0);
|
|
|
|
signals:
|
|
|
|
void volume(int);
|
|
};
|
|
|
|
#endif // CONF_H
|