STILL MISSING: check whether there is a next/previous medium and only then show/enable buttons
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
#ifndef MUSICMODEL_H
|
|
#define MUSICMODEL_H
|
|
|
|
#include <QObject>
|
|
|
|
#include <models/NavigationItemModel.h>
|
|
#include <VLCQtCore/MediaList.h>
|
|
|
|
class MusicModel : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QObject* pCurrentItem READ getCurrentItem NOTIFY currentItemChanged)
|
|
//Q_PROPERTY(QObject* pHasNext READ hasNext NOTIFY hasNextChanged)
|
|
//Q_PROPERTY(QObject* pHasPrevious READ hasPrevious NOTIFY hasPreviousChanged)
|
|
|
|
signals:
|
|
void navigateTo(NavigationItemModel *item);
|
|
void currentItemChanged();
|
|
void play();
|
|
void pause();
|
|
void stop();
|
|
void previous();
|
|
void next();
|
|
|
|
public:
|
|
MusicModel(VlcInstance* instance, QObject *parent = Q_NULLPTR);
|
|
~MusicModel();
|
|
|
|
void init(NavigationItemModel* item);
|
|
|
|
Q_INVOKABLE void navigateBack();
|
|
Q_INVOKABLE void playPause();
|
|
Q_INVOKABLE void stopMusic();
|
|
Q_INVOKABLE void playNext();
|
|
Q_INVOKABLE void playPrevious();
|
|
|
|
NavigationItemModel *getCurrentItem();
|
|
|
|
VlcMediaList *getMedia();
|
|
|
|
bool isPlaying();
|
|
|
|
private:
|
|
bool mIsPlaying = false;
|
|
NavigationItemModel* mCurrentItem = Q_NULLPTR;
|
|
VlcMediaList* mMedia = Q_NULLPTR;
|
|
VlcInstance* mVlc;
|
|
};
|
|
|
|
#endif // MUSICMODEL_H
|