Commit f3176353 authored by stef lep's avatar stef lep Committed by Nate Graham
Browse files

display saved position on slider

parent 5f509193
......@@ -89,6 +89,8 @@ QVariantMap ManageAudioPlayer::persistentState() const
persistentStateValue[QStringLiteral("isPlaying")] = mPlayingState;
persistentStateValue[QStringLiteral("playerPosition")] = mPlayerPosition;
persistentStateValue[QStringLiteral("playerDuration")] = mAudioDuration;
if (mCurrentTrack.isValid()) {
persistentStateValue[QStringLiteral("audioPlayerCurrentTitle")] = mCurrentTrack.data(mTitleRole);
persistentStateValue[QStringLiteral("audioPlayerCurrentArtistName")] = mCurrentTrack.data(mArtistNameRole);
......@@ -580,9 +582,13 @@ void ManageAudioPlayer::restorePreviousState()
auto playerPosition = mPersistentState.find(QStringLiteral("playerPosition"));
if (playerPosition != mPersistentState.end()) {
mPlayerPosition = playerPosition->toLongLong();
setPlayerPosition(playerPosition->toLongLong());
Q_EMIT seek(mPlayerPosition);
}
auto playerDuration = mPersistentState.find(QStringLiteral("playerDuration"));
if (playerDuration != mPersistentState.end()) {
setAudioDuration(playerDuration->toInt());
}
mPersistentState.clear();
}
......
......@@ -191,12 +191,12 @@ ApplicationWindow {
ratingVisible: false
playerControl.duration: ElisaApplication.audioPlayer.duration
playerControl.duration: ElisaApplication.audioControl.audioDuration
playerControl.seekable: ElisaApplication.audioPlayer.seekable
playerControl.volume: persistentSettings.playControlItemVolume
playerControl.muted: persistentSettings.playControlItemMuted
playerControl.position: ElisaApplication.audioPlayer.position
playerControl.position: ElisaApplication.audioControl.playerPosition
playerControl.skipBackwardEnabled: ElisaApplication.playerControl.skipBackwardControlEnabled
playerControl.skipForwardEnabled: ElisaApplication.playerControl.skipForwardControlEnabled
playerControl.playEnabled: ElisaApplication.playerControl.playControlEnabled
......
......@@ -366,6 +366,12 @@ FocusScope {
}
}
onDurationChanged:
{
musicProgress.to = musicWidget.duration
musicProgress.value = Qt.binding(function() { return musicWidget.position })
}
onIsMaximizedChanged:
{
if (musicWidget.isMaximized) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment