lena_pi/LenaPi/models/MusicModel.h
Anika Raemer 6eabd3cb75 disable previous and next button
if there is no corresponding media; set play/pause symbol via model
property instead of via qml.
2018-12-05 21:10:37 +01:00

62 lines
1.5 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(bool pHasNext READ hasNext NOTIFY hasNextChanged)
Q_PROPERTY(bool pHasPrevious READ hasPrevious NOTIFY hasPreviousChanged)
Q_PROPERTY(bool pIsPlaying READ isPlaying NOTIFY isPlayingChanged)
signals:
void navigateTo(NavigationItemModel *item);
void currentItemChanged();
void play();
void pause();
void stop();
void previous();
void next();
void hasPreviousChanged();
void hasNextChanged();
void isPlayingChanged();
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();
bool hasNext();
bool hasPrevious();
public slots:
void onNextMediaSet(VlcMedia* media);
private:
bool mIsPlaying = false;
bool mHasNext = false;
bool mHasPrevious = false;
NavigationItemModel* mCurrentItem = Q_NULLPTR;
VlcMediaList* mMedia = Q_NULLPTR;
VlcInstance* mVlc;
};
#endif // MUSICMODEL_H