Improve format and error handling
This commit is contained in:
23 files changed
+138
-49
No files matched your search
+10
-2
@@ -16,7 +16,10 @@
|
||||
#include "backend/LibraryModel.h"
|
||||
#include "backend/ReadingModel.h"
|
||||
#include "backend/NativeFileDialogService.h"
|
||||
#include "backend/ReaderFactory.h"
|
||||
#include "backend/book/Book.h"
|
||||
#include "backend/formats/TxtReader.h"
|
||||
#include "backend/formats/EpubReader.h"
|
||||
#include "backend/state/BookPositionStore.h"
|
||||
#include "backend/state/ReadingPreferences.h"
|
||||
#include "backend/state/UiState.h"
|
||||
@@ -94,7 +97,12 @@ int main(int argc, char *argv[])
|
||||
UiState uiState(appState);
|
||||
BookPositionStore bookPositions(appState);
|
||||
|
||||
LibraryModel libraryModel;
|
||||
ReaderFactory readerFactory({
|
||||
[] { return std::make_unique<TxtReader>(); },
|
||||
[] { return std::make_unique<EpubReader>(); },
|
||||
});
|
||||
|
||||
LibraryModel libraryModel(readerFactory);
|
||||
for (const QVariantMap &entry : appState.loadArray(QStringLiteral("library"))) {
|
||||
const QString fp = entry.value(QStringLiteral("filePath")).toString();
|
||||
if (fp.isEmpty()) continue;
|
||||
@@ -122,7 +130,7 @@ int main(int argc, char *argv[])
|
||||
IFileDialogService *fileDialogService = new NativeFileDialogService(nullptr);
|
||||
#endif
|
||||
|
||||
Book book(*fileDialogService, bookPositions);
|
||||
Book book(*fileDialogService, bookPositions, readerFactory);
|
||||
ReadingModel readingModel(bookPositions);
|
||||
|
||||
// --- QML engine ---
|
||||
|
||||
Reference in new issue
Block a user