connected stop, previous and next button;
STILL MISSING: check whether there is a next/previous medium and only then show/enable buttons
This commit is contained in:
parent
d6c806d41d
commit
61b8734b62
4 changed files with 33 additions and 4 deletions
|
|
@ -62,7 +62,7 @@ Item{
|
||||||
// visible: model.pHasPrevious
|
// visible: model.pHasPrevious
|
||||||
|
|
||||||
onClicked:{
|
onClicked:{
|
||||||
//musicModel.playPrevious();
|
musicModel.playPrevious();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoundButton{
|
RoundButton{
|
||||||
|
|
@ -87,8 +87,8 @@ Item{
|
||||||
imageSource: "qrc:/icon_stop"
|
imageSource: "qrc:/icon_stop"
|
||||||
|
|
||||||
onClicked:{
|
onClicked:{
|
||||||
//musicModel.stop();
|
musicModel.stopMusic();
|
||||||
//playPause.imageSource = "qrc:/icon_play"
|
playPause.imageSource = "qrc:/icon_play"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoundButton{
|
RoundButton{
|
||||||
|
|
@ -101,7 +101,7 @@ Item{
|
||||||
// visible: model.pHasNext
|
// visible: model.pHasNext
|
||||||
|
|
||||||
onClicked:{
|
onClicked:{
|
||||||
//musicModel.playNext();
|
musicModel.playNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ MusicController::MusicController(QObject *parent) : QObject(parent)
|
||||||
|
|
||||||
connect(mModel, &MusicModel::navigateTo, this, &MusicController::navigateTo);
|
connect(mModel, &MusicModel::navigateTo, this, &MusicController::navigateTo);
|
||||||
connect(mModel, &MusicModel::play, mPlayer, &VlcMediaListPlayer::play);
|
connect(mModel, &MusicModel::play, mPlayer, &VlcMediaListPlayer::play);
|
||||||
|
connect(mModel, &MusicModel::stop, mPlayer, &VlcMediaListPlayer::stop);
|
||||||
|
connect(mModel, &MusicModel::previous, mPlayer, &VlcMediaListPlayer::previous);
|
||||||
|
connect(mModel, &MusicModel::next, mPlayer, &VlcMediaListPlayer::next);
|
||||||
connect(mModel, &MusicModel::pause, mPlayer->mediaPlayer(), &VlcMediaPlayer::pause);
|
connect(mModel, &MusicModel::pause, mPlayer->mediaPlayer(), &VlcMediaPlayer::pause);
|
||||||
connect(mModel, &MusicModel::navigateTo, [this](NavigationItemModel*){
|
connect(mModel, &MusicModel::navigateTo, [this](NavigationItemModel*){
|
||||||
if(mModel->isPlaying()) mModel->playPause();
|
if(mModel->isPlaying()) mModel->playPause();
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,24 @@ void MusicModel::playPause()
|
||||||
emit pause();
|
emit pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MusicModel::stopMusic()
|
||||||
|
{
|
||||||
|
if(mIsPlaying){
|
||||||
|
mIsPlaying = false;
|
||||||
|
emit stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MusicModel::playNext()
|
||||||
|
{
|
||||||
|
emit next();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MusicModel::playPrevious()
|
||||||
|
{
|
||||||
|
emit previous();
|
||||||
|
}
|
||||||
|
|
||||||
NavigationItemModel *MusicModel::getCurrentItem()
|
NavigationItemModel *MusicModel::getCurrentItem()
|
||||||
{
|
{
|
||||||
return mCurrentItem;
|
return mCurrentItem;
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,17 @@ class MusicModel : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY(QObject* pCurrentItem READ getCurrentItem NOTIFY currentItemChanged)
|
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:
|
signals:
|
||||||
void navigateTo(NavigationItemModel *item);
|
void navigateTo(NavigationItemModel *item);
|
||||||
void currentItemChanged();
|
void currentItemChanged();
|
||||||
void play();
|
void play();
|
||||||
void pause();
|
void pause();
|
||||||
|
void stop();
|
||||||
|
void previous();
|
||||||
|
void next();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MusicModel(VlcInstance* instance, QObject *parent = Q_NULLPTR);
|
MusicModel(VlcInstance* instance, QObject *parent = Q_NULLPTR);
|
||||||
|
|
@ -26,6 +31,9 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void navigateBack();
|
Q_INVOKABLE void navigateBack();
|
||||||
Q_INVOKABLE void playPause();
|
Q_INVOKABLE void playPause();
|
||||||
|
Q_INVOKABLE void stopMusic();
|
||||||
|
Q_INVOKABLE void playNext();
|
||||||
|
Q_INVOKABLE void playPrevious();
|
||||||
|
|
||||||
NavigationItemModel *getCurrentItem();
|
NavigationItemModel *getCurrentItem();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue