Save more state on exit
This commit is contained in:
4 files changed
+38
-10
No files matched your search
@@ -21,6 +21,7 @@ class AppState : public QObject {
|
||||
Q_PROPERTY(int windowY READ windowY WRITE setWindowY NOTIFY windowYChanged)
|
||||
Q_PROPERTY(QVariantList libraryBooks READ libraryBooks NOTIFY libraryBooksChanged)
|
||||
Q_PROPERTY(QString lastPage READ lastPage WRITE setLastPage NOTIFY lastPageChanged)
|
||||
Q_PROPERTY(bool sidebarOpen READ sidebarOpen WRITE setSidebarOpen NOTIFY sidebarOpenChanged)
|
||||
|
||||
public:
|
||||
explicit AppState(QObject *parent = nullptr);
|
||||
@@ -63,6 +64,9 @@ public:
|
||||
QString lastPage() const;
|
||||
void setLastPage(const QString &page);
|
||||
|
||||
bool sidebarOpen() const;
|
||||
void setSidebarOpen(bool open);
|
||||
|
||||
Q_INVOKABLE void addOrUpdateLibraryBook(const QString &filePath, const QString &title, const QString &author, double progress);
|
||||
Q_INVOKABLE void removeLibraryBook(const QString &filePath);
|
||||
Q_INVOKABLE QVariantList libraryBooks() const;
|
||||
@@ -84,6 +88,7 @@ signals:
|
||||
void windowYChanged();
|
||||
void libraryBooksChanged();
|
||||
void lastPageChanged();
|
||||
void sidebarOpenChanged();
|
||||
|
||||
private:
|
||||
void loadLibraryBooks();
|
||||
@@ -100,6 +105,7 @@ private:
|
||||
int m_windowY = -1;
|
||||
QVariantList m_libraryBooks;
|
||||
QString m_lastPage = QStringLiteral("starter");
|
||||
bool m_sidebarOpen = false;
|
||||
};
|
||||
|
||||
#endif // APPSTATE_H
|
||||
Reference in new issue
Block a user