Make app restore last playing item

This commit is contained in:
Bart De Vries 2021-04-10 09:36:55 +02:00
parent 218b86807e
commit e1b374e375
3 changed files with 3 additions and 2 deletions

View File

@ -24,7 +24,7 @@ public:
Feed* getFeed(QString const feedurl) const;
Entry* getEntry(int const feed_index, int const entry_index) const;
Entry* getEntry(const Feed* feed, int const entry_index) const;
Entry* getEntry(const QString id) const;
Q_INVOKABLE Entry* getEntry(const QString id) const;
int feedCount() const;
int entryCount(const int feed_index) const;
int entryCount(const Feed* feed) const;

View File

@ -67,6 +67,7 @@ int main(int argc, char *argv[])
engine->setObjectOwnership(SettingsManager::self(), QQmlEngine::CppOwnership);
return SettingsManager::self();
});
qRegisterMetaType<Entry*>("const Entry*"); // "hack" to make qml understand Entry*
QQmlApplicationEngine engine;
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));

View File

@ -82,7 +82,7 @@ Kirigami.ApplicationWindow {
Audio {
id: audio
property var entry
property var entry: SettingsManager.lastPlayingEntry !== "none" ? DataManager.getEntry(SettingsManager.lastPlayingEntry) : undefined
property bool playerOpen: false
onEntryChanged: SettingsManager.lastPlayingEntry = entry.id