main.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include <QApplication>
  2. #include <QQmlEngine>
  3. #include <QQuickView>
  4. #include <QQmlContext>
  5. #include <QFontDatabase>
  6. #include <githandler.h>
  7. #include <gitrepository.h>
  8. #include <repositorymodel.h>
  9. #include <gitbranch.h>
  10. #include <commitmodel.h>
  11. #include <graphpoint.h>
  12. #include <commitgraph.h>
  13. #include <gittag.h>
  14. #include <gitdiff.h>
  15. #include <QDebug>
  16. int main(int argc, char *argv[])
  17. {
  18. QApplication app(argc, argv);
  19. QFontDatabase::addApplicationFont(":/fonts/Inconsolata.otf");
  20. QQuickView view;
  21. qmlRegisterUncreatableType<CommitModel>("org.semlanik.nicegit", 1, 0, "CommitModel", "Owned only by GitHandler");
  22. qmlRegisterUncreatableType<CommitGraph>("org.semlanik.nicegit", 1, 0, "CommitGraph", "Owned only by GitHandler");
  23. qmlRegisterUncreatableType<GraphPoint>("org.semlanik.nicegit", 1, 0, "GraphPoint", "Owned only by GitHandler");
  24. qmlRegisterUncreatableType<RepositoryModel>("org.semlanik.nicegit", 1, 0, "RepositoryModel", "Owned only by GitHandler");
  25. qmlRegisterUncreatableType<GitRepository>("org.semlanik.nicegit", 1, 0, "GitRepository", "Owned only by GitHandler");
  26. qmlRegisterUncreatableType<GitBranch>("org.semlanik.nicegit", 1, 0, "GitBranch", "Owned only by GitHandler");
  27. qmlRegisterUncreatableType<GitHandler>("org.semlanik.nicegit", 1, 0, "GitHandler", "Global for qml");
  28. qmlRegisterUncreatableType<GitTag>("org.semlanik.nicegit", 1, 0, "GitTag", "Global for qml");
  29. qmlRegisterUncreatableType<GitDiff>("org.semlanik.nicegit", 1, 0, "GitDiff", "Global for qml");
  30. qmlRegisterUncreatableType<GitCommit>("org.semlanik.nicegit", 1, 0, "GitCommit", "Global for qml");
  31. GitHandler handler;
  32. handler.open("/home/semlanik/Projects/HCAT/hmi_hcat/demo/default/HCAT/");
  33. view.rootContext()->setContextProperty("_handler", &handler);
  34. view.setSource(QUrl("qrc:/qml/MainView.qml"));
  35. view.setResizeMode(QQuickView::SizeRootObjectToView);
  36. view.showMaximized();
  37. return app.exec();
  38. }