main.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include <QApplication>
  2. #include <QDir>
  3. #include "mainwindow.h"
  4. #include "logger.h"
  5. #include "appcontext.h"
  6. #include "version.h"
  7. #define SCREEN_WIDTH 1280
  8. #define SCREEN_HEIGHT 720
  9. int main(int argc, char *argv[])
  10. {
  11. #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  12. QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
  13. #endif
  14. QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
  15. QApplication app(argc, argv);
  16. #ifdef NDEBUG
  17. Logger::setup(Logger::INFO);
  18. #else
  19. Logger::setup(Logger::TRACE);
  20. #endif
  21. LOG_INFO("PROJECT_NAME: {}", PROJECT_NAME);
  22. LOG_INFO("PROJECT_VERSION: {}", PROJECT_VERSION);
  23. LOG_INFO("PROJECT_GIT_HASH: {}", PROJECT_GIT_HASH);
  24. LOG_INFO("PROJECT_GIT_BRANCH: {}", PROJECT_GIT_BRANCH);
  25. LOG_INFO("PROJECT_BUILD_TIME: {}", PROJECT_BUILD_TIME);
  26. AppContext &appCtx = AppContext::instance();
  27. ProjectManager &projectMgr = appCtx.projectManager();
  28. QString fileName = QString("%1/%2").arg(QDir::currentPath(), "conf/monitor.xml");
  29. bool result = projectMgr.openProject(fileName);
  30. if(result)
  31. {
  32. LOG_INFO("open monitor config xml success: {}, canvas count: {}", fileName.toUtf8().data(), projectMgr.canvasCount());
  33. }
  34. else
  35. {
  36. LOG_ERROR("open monitor config xml failed: {}", fileName.toUtf8().data());
  37. }
  38. MainWindow w;
  39. w.resize(SCREEN_WIDTH, SCREEN_HEIGHT);
  40. w.showFullScreen();
  41. int ret = app.exec();
  42. return ret;
  43. }