old render cleanup part 3
This commit is contained in:
45 files changed
+1057
-1135
No files matched your search
+9
-23
@@ -20,9 +20,6 @@
|
||||
#include "backend/ReadingModel.h"
|
||||
#include "backend/NativeFileDialogService.h"
|
||||
#include "backend/book/Book.h"
|
||||
#include "backend/formats/comic/CbzReader.h"
|
||||
#include "backend/formats/comic/CbrReader.h"
|
||||
#include "backend/formats/comic/FolderReader.h"
|
||||
#include "backend/state/BookPositionStore.h"
|
||||
#include "backend/state/ReadingPreferences.h"
|
||||
#include "backend/state/UiState.h"
|
||||
@@ -102,26 +99,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
// The format table: one row declares everything a format needs.
|
||||
FormatRegistry formatRegistry({
|
||||
{QStringLiteral("cbz"), false, QStringLiteral("cbz"),
|
||||
[] { return std::make_unique<CbzReader>(); },
|
||||
[] { return std::make_unique<ZipByteSource>(); }},
|
||||
{QStringLiteral("cbr"), false, QStringLiteral("cbr"),
|
||||
[] { return std::make_unique<CbrReader>(); },
|
||||
[] { return std::make_unique<RarByteSource>(); }},
|
||||
{{}, /*matchesDirectory=*/true, QStringLiteral("dir"),
|
||||
[] { return std::make_unique<FolderReader>(); },
|
||||
[] { return std::make_unique<DirByteSource>(); }},
|
||||
FormatSpec::comic(QStringLiteral("cbz"), false, QStringLiteral("cbz"),
|
||||
[] { return std::make_unique<ZipByteSource>(); }),
|
||||
FormatSpec::comic(QStringLiteral("cbr"), false, QStringLiteral("cbr"),
|
||||
[] { return std::make_unique<RarByteSource>(); }),
|
||||
FormatSpec::comic({}, /*matchesDirectory=*/true, QStringLiteral("dir"),
|
||||
[] { return std::make_unique<DirByteSource>(); }),
|
||||
});
|
||||
|
||||
HistoryModel historyModel(formatRegistry);
|
||||
for (const QVariantMap &entry : appState.loadArray(QStringLiteral("history"))) {
|
||||
const QString fp = entry.value(QStringLiteral("filePath")).toString();
|
||||
if (fp.isEmpty()) continue;
|
||||
double progress = entry.value(QStringLiteral("progress"), 0.0).toDouble();
|
||||
progress = qBound(0.0, progress, 1.0);
|
||||
const QString lo = entry.value(QStringLiteral("lastOpened")).toString();
|
||||
historyModel.addOrUpdateBook(fp, progress, lo);
|
||||
}
|
||||
historyModel.load(appState);
|
||||
|
||||
// Command-line override: treat first argument as the file to open on startup
|
||||
if (const QStringList args = QCoreApplication::arguments(); args.size() > 1) {
|
||||
@@ -141,7 +128,7 @@ int main(int argc, char *argv[])
|
||||
IFileDialogService *fileDialogService = new NativeFileDialogService(nullptr);
|
||||
#endif
|
||||
|
||||
Book book(*fileDialogService, bookPositions, formatRegistry);
|
||||
Book book(*fileDialogService, formatRegistry);
|
||||
ReadingModel readingModel(bookPositions);
|
||||
|
||||
// --- QML engine ---
|
||||
@@ -164,8 +151,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// All cross-class signal wiring lives in the coordinator.
|
||||
AppCoordinator coordinator(book, readingModel, historyModel, uiState,
|
||||
readingPreferences, appState, settings,
|
||||
formatRegistry, engine);
|
||||
readingPreferences, appState, settings);
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/Asteria/Main.qml"));
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
|
||||
|
||||
Reference in new issue
Block a user