2026-08-17 00:05:20 +03:00
|
|
|
#include <QGuiApplication>
|
|
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
|
#include <QQmlContext>
|
|
|
|
|
#include <QCommandLineParser>
|
|
|
|
|
|
|
|
|
|
#include "app/VaultManager.h"
|
2026-08-17 01:02:05 +03:00
|
|
|
#include "app/WindowController.h"
|
2026-08-17 00:43:33 +03:00
|
|
|
#include "core/SettingsStore.h"
|
|
|
|
|
#include "git/GitManager.h"
|
|
|
|
|
#include "sync/SyncManager.h"
|
2026-08-17 00:05:20 +03:00
|
|
|
|
|
|
|
|
#include <cmark-gfm.h>
|
|
|
|
|
#include <git2.h>
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
|
app.setApplicationName("Flora");
|
|
|
|
|
app.setOrganizationName("Flora");
|
|
|
|
|
app.setApplicationVersion("0.0.1");
|
|
|
|
|
|
|
|
|
|
QCommandLineParser parser;
|
|
|
|
|
parser.setApplicationDescription("Минималистичный markdown-заметочник с git-историей");
|
|
|
|
|
parser.addHelpOption();
|
|
|
|
|
parser.addVersionOption();
|
|
|
|
|
parser.process(app);
|
|
|
|
|
|
|
|
|
|
// Версии библиотек — быстрая проверка, что зависимости подключены и слинкованы.
|
|
|
|
|
int gitMajor = 0, gitMinor = 0, gitRev = 0;
|
|
|
|
|
git_libgit2_version(&gitMajor, &gitMinor, &gitRev);
|
|
|
|
|
qInfo("Flora %s | cmark-gfm %s | libgit2 %d.%d.%d",
|
|
|
|
|
qPrintable(app.applicationVersion()),
|
|
|
|
|
cmark_version_string(),
|
|
|
|
|
gitMajor, gitMinor, gitRev);
|
|
|
|
|
|
2026-08-17 00:43:33 +03:00
|
|
|
SettingsStore settingsStore;
|
|
|
|
|
GitManager gitManager;
|
|
|
|
|
SyncManager syncManager;
|
|
|
|
|
VaultManager vaultManager(&settingsStore, &gitManager);
|
2026-08-17 00:05:20 +03:00
|
|
|
|
|
|
|
|
QQmlApplicationEngine engine;
|
2026-08-17 00:43:33 +03:00
|
|
|
engine.rootContext()->setContextProperty("settingsStore", &settingsStore);
|
|
|
|
|
engine.rootContext()->setContextProperty("gitManager", &gitManager);
|
|
|
|
|
engine.rootContext()->setContextProperty("syncManager", &syncManager);
|
2026-08-17 00:05:20 +03:00
|
|
|
engine.rootContext()->setContextProperty("vaultManager", &vaultManager);
|
2026-08-17 01:02:05 +03:00
|
|
|
|
|
|
|
|
WindowController windowController(
|
|
|
|
|
&engine, QStringLiteral("qrc:/qt/qml/Flora/qml/MainWindow.qml"));
|
|
|
|
|
engine.rootContext()->setContextProperty("windowController", &windowController);
|
|
|
|
|
|
|
|
|
|
// Основное окно = последнее (основное) хранилище. Если хранилищ нет —
|
|
|
|
|
// откроется мастер первого запуска.
|
|
|
|
|
windowController.openWindow(settingsStore.currentVault());
|
2026-08-17 00:05:20 +03:00
|
|
|
|
|
|
|
|
if (engine.rootObjects().isEmpty())
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
|
}
|