#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static TooltipViewModel* ttmodel = nullptr; int main(int argc, char *argv[]) { QApplication app(argc, argv); QFontDatabase::addApplicationFont(":/fonts/Inconsolata.otf"); QQuickView view; qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "GitOid", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "CommitModel", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "CommitGraph", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "GraphPoint", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "RepositoryModel", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "GitRepository", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "GitBranch", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "GitHandler", "Global for qml"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "GitTag", "Global for qml"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "GitDiff", "Global for qml"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "GitCommit", "Global for qml"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "GraphListModel", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "BranchListModel", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "TagListModel", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "GitConsole", "Owned only by GitHandler"); qmlRegisterUncreatableType("org.semlanik.cutegit", 1, 0, "DiffModel", "Owned only by GitHandler"); qmlRegisterSingletonType("org.semlanik.cutegit", 1, 0,"TooltipViewModel", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject* { Q_UNUSED(engine) Q_UNUSED(scriptEngine) if(!ttmodel) { ttmodel = new TooltipViewModel; } return ttmodel; }); GitHandler handler; view.rootContext()->setContextProperty("_handler", &handler); view.setSource(QUrl("qrc:/qml/MainView.qml")); view.setResizeMode(QQuickView::SizeRootObjectToView); view.showMaximized(); return app.exec(); }