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 ...@@ -89,6 +89,8 @@ QVariantMap ManageAudioPlayer::persistentState() const
persistentStateValue[QStringLiteral("isPlaying")] = mPlayingState; persistentStateValue[QStringLiteral("isPlaying")] = mPlayingState;
persistentStateValue[QStringLiteral("playerPosition")] = mPlayerPosition; persistentStateValue[QStringLiteral("playerPosition")] = mPlayerPosition;
persistentStateValue[QStringLiteral("playerDuration")] = mAudioDuration;
if (mCurrentTrack.isValid()) { if (mCurrentTrack.isValid()) {
persistentStateValue[QStringLiteral("audioPlayerCurrentTitle")] = mCurrentTrack.data(mTitleRole); persistentStateValue[QStringLiteral("audioPlayerCurrentTitle")] = mCurrentTrack.data(mTitleRole);
persistentStateValue[QStringLiteral("audioPlayerCurrentArtistName")] = mCurrentTrack.data(mArtistNameRole); persistentStateValue[QStringLiteral("audioPlayerCurrentArtistName")] = mCurrentTrack.data(mArtistNameRole);
...@@ -580,9 +582,13 @@ void ManageAudioPlayer::restorePreviousState() ...@@ -580,9 +582,13 @@ void ManageAudioPlayer::restorePreviousState()
auto playerPosition = mPersistentState.find(QStringLiteral("playerPosition")); auto playerPosition = mPersistentState.find(QStringLiteral("playerPosition"));
if (playerPosition != mPersistentState.end()) { if (playerPosition != mPersistentState.end()) {
mPlayerPosition = playerPosition->toLongLong(); setPlayerPosition(playerPosition->toLongLong());
Q_EMIT seek(mPlayerPosition); Q_EMIT seek(mPlayerPosition);
} }
auto playerDuration = mPersistentState.find(QStringLiteral("playerDuration"));
if (playerDuration != mPersistentState.end()) {
setAudioDuration(playerDuration->toInt());
}
mPersistentState.clear(); mPersistentState.clear();
} }
......
...@@ -191,12 +191,12 @@ ApplicationWindow { ...@@ -191,12 +191,12 @@ ApplicationWindow {
ratingVisible: false ratingVisible: false
playerControl.duration: ElisaApplication.audioPlayer.duration playerControl.duration: ElisaApplication.audioControl.audioDuration
playerControl.seekable: ElisaApplication.audioPlayer.seekable playerControl.seekable: ElisaApplication.audioPlayer.seekable
playerControl.volume: persistentSettings.playControlItemVolume playerControl.volume: persistentSettings.playControlItemVolume
playerControl.muted: persistentSettings.playControlItemMuted playerControl.muted: persistentSettings.playControlItemMuted
playerControl.position: ElisaApplication.audioPlayer.position playerControl.position: ElisaApplication.audioControl.playerPosition
playerControl.skipBackwardEnabled: ElisaApplication.playerControl.skipBackwardControlEnabled playerControl.skipBackwardEnabled: ElisaApplication.playerControl.skipBackwardControlEnabled
playerControl.skipForwardEnabled: ElisaApplication.playerControl.skipForwardControlEnabled playerControl.skipForwardEnabled: ElisaApplication.playerControl.skipForwardControlEnabled
playerControl.playEnabled: ElisaApplication.playerControl.playControlEnabled playerControl.playEnabled: ElisaApplication.playerControl.playControlEnabled
......
...@@ -366,6 +366,12 @@ FocusScope { ...@@ -366,6 +366,12 @@ FocusScope {
} }
} }
onDurationChanged:
{
musicProgress.to = musicWidget.duration
musicProgress.value = Qt.binding(function() { return musicWidget.position })
}
onIsMaximizedChanged: onIsMaximizedChanged:
{ {
if (musicWidget.isMaximized) { 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