main.cpp 1.5 KB

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