main.cpp 1.1 KB

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