added progress bar to show position in track
still todo: styling, positioning, output of current time and length
This commit is contained in:
parent
6eabd3cb75
commit
b013b69e8d
4 changed files with 63 additions and 6 deletions
|
|
@ -64,6 +64,8 @@ void MusicModel::stopMusic()
|
|||
mIsPlaying = false;
|
||||
mHasNext = false;
|
||||
mHasPrevious = false;
|
||||
mCurrentMediaItemProgress = 0.0;
|
||||
emit progressChanged();
|
||||
emit hasNextChanged();
|
||||
emit hasPreviousChanged();
|
||||
emit isPlayingChanged();
|
||||
|
|
@ -114,6 +116,11 @@ bool MusicModel::hasPrevious()
|
|||
return mHasPrevious;
|
||||
}
|
||||
|
||||
double MusicModel::getProgress()
|
||||
{
|
||||
return mCurrentMediaItemProgress;
|
||||
}
|
||||
|
||||
void MusicModel::onNextMediaSet(VlcMedia *media)
|
||||
{
|
||||
mHasNext = true;
|
||||
|
|
@ -127,3 +134,14 @@ void MusicModel::onNextMediaSet(VlcMedia *media)
|
|||
emit hasPreviousChanged();
|
||||
emit hasNextChanged();
|
||||
}
|
||||
|
||||
void MusicModel::onTimeChanged(int time)
|
||||
{
|
||||
mCurrentMediaItemProgress = (double) time / mCurrentMediaItemLength;
|
||||
emit progressChanged();
|
||||
}
|
||||
|
||||
void MusicModel::onLengthChanged(int length)
|
||||
{
|
||||
mCurrentMediaItemLength= length;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue