a bit of refactor
This commit is contained in:
19 files changed
+546
-232
No files matched your search
@@ -11,6 +11,13 @@
|
||||
#include "backend/BookController.h"
|
||||
#include "backend/ReadingModel.h"
|
||||
#include "backend/AppState.h"
|
||||
#include "backend/QDocumentChunkMeasurer.h"
|
||||
#include "backend/NativeFileDialogService.h"
|
||||
|
||||
#ifdef HAS_QT_DBUS
|
||||
#include <QDBusConnection>
|
||||
#include "backend/PortalFileDialogService.h"
|
||||
#endif
|
||||
|
||||
void myMessageHandler(const QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
@@ -71,7 +78,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
QQuickStyle::setStyle(QStringLiteral("Basic"));
|
||||
|
||||
QDocumentChunkMeasurer chunkMeasurer(16, 160.0);
|
||||
|
||||
ReadingModel readingModel;
|
||||
readingModel.setChunkMeasurer(&chunkMeasurer);
|
||||
|
||||
BookController bookController;
|
||||
bookController.setReadingModel(&readingModel);
|
||||
@@ -80,6 +90,18 @@ int main(int argc, char *argv[])
|
||||
appState.restore();
|
||||
bookController.setAppState(&appState);
|
||||
|
||||
#ifdef HAS_QT_DBUS
|
||||
IFileDialogService *fileDialogService;
|
||||
if (QDBusConnection::sessionBus().isConnected()) {
|
||||
fileDialogService = new PortalFileDialogService(&bookController);
|
||||
} else {
|
||||
fileDialogService = new NativeFileDialogService(&bookController);
|
||||
}
|
||||
#else
|
||||
IFileDialogService *fileDialogService = new NativeFileDialogService(&bookController);
|
||||
#endif
|
||||
bookController.setFileDialogService(fileDialogService);
|
||||
|
||||
if (const QStringList args = QCoreApplication::arguments(); args.size() > 1) {
|
||||
const QString& filePath = args.at(1);
|
||||
if (QFileInfo::exists(filePath))
|
||||
|
||||
Reference in new issue
Block a user