restore opened file and position
This commit is contained in:
12 files changed
+491
-11
No files matched your search
@@ -21,6 +21,7 @@ int main(int argc, char *argv[])
|
||||
bookController.setReadingModel(&readingModel);
|
||||
|
||||
AppState appState;
|
||||
appState.restore();
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
@@ -34,5 +35,13 @@ int main(int argc, char *argv[])
|
||||
Qt::QueuedConnection);
|
||||
engine.load(url);
|
||||
|
||||
QObject::connect(&app, &QCoreApplication::aboutToQuit, [&]() {
|
||||
if (bookController.hasBook()) {
|
||||
appState.setLastFilePath(bookController.currentFilePath());
|
||||
appState.setLastChapter(readingModel.currentChapter());
|
||||
}
|
||||
appState.save();
|
||||
});
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
Reference in new issue
Block a user