mirror of https://github.com/KDE/kasts.git
Restore last playing track on startup
This commit is contained in:
parent
f5c20a92e2
commit
7e39d83f90
|
@ -6,12 +6,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "audiomanager.h"
|
#include "audiomanager.h"
|
||||||
#include "powermanagementinterface.h"
|
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QAudio>
|
#include <QAudio>
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
|
|
||||||
|
#include "powermanagementinterface.h"
|
||||||
|
#include "datamanager.h"
|
||||||
|
#include "settingsmanager.h"
|
||||||
|
|
||||||
class AudioManagerPrivate
|
class AudioManagerPrivate
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -43,6 +46,12 @@ AudioManager::AudioManager(QObject *parent) : QObject(parent), d(std::make_uniqu
|
||||||
connect(&d->m_player, &QMediaPlayer::positionChanged, this, &AudioManager::positionChanged);
|
connect(&d->m_player, &QMediaPlayer::positionChanged, this, &AudioManager::positionChanged);
|
||||||
connect(&d->m_player, &QMediaPlayer::positionChanged, this, &AudioManager::savePlayPosition);
|
connect(&d->m_player, &QMediaPlayer::positionChanged, this, &AudioManager::savePlayPosition);
|
||||||
connect(&d->m_player, &QMediaPlayer::seekableChanged, this, &AudioManager::seekableChanged);
|
connect(&d->m_player, &QMediaPlayer::seekableChanged, this, &AudioManager::seekableChanged);
|
||||||
|
|
||||||
|
// Check if an entry was playing when the program was shut down and restore it
|
||||||
|
if (SettingsManager::self()->lastPlayingEntry() != QStringLiteral("none"))
|
||||||
|
setEntry(DataManager::instance().getEntry(SettingsManager::self()->lastPlayingEntry()));
|
||||||
|
//SettingsManager.lastPlayingEntry !== "none" ? DataManager.getEntry(SettingsManager.lastPlayingEntry) : undefined
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioManager::~AudioManager()
|
AudioManager::~AudioManager()
|
||||||
|
|
Loading…
Reference in New Issue