Explorar el Código

test open monitor config xml

xuqiang hace 5 meses
padre
commit
c23acd0e59
Se han modificado 3 ficheros con 20 adiciones y 0 borrados
  1. 3 0
      include/appcontext.h
  2. 5 0
      src/appcontext.cpp
  3. 12 0
      src/main.cpp

+ 3 - 0
include/appcontext.h

@@ -3,6 +3,7 @@
 
 #include <QObject>
 #include "pluginmanager.h"
+#include "projectmanager.h"
 
 class AppContext : public QObject
 {
@@ -14,9 +15,11 @@ class AppContext : public QObject
 public:
     static AppContext &instance();
     const PluginManager &pluginManager();
+    ProjectManager &projectManager();
 
 private:
     PluginManager m_pluginMgr;
+    ProjectManager m_projectMgr;
 
 };
 

+ 5 - 0
src/appcontext.cpp

@@ -24,3 +24,8 @@ const PluginManager &AppContext::pluginManager()
     return m_pluginMgr;
 }
 
+ProjectManager &AppContext::projectManager()
+{
+    return m_projectMgr;
+}
+

+ 12 - 0
src/main.cpp

@@ -1,4 +1,5 @@
 #include <QApplication>
+#include <QDir>
 #include "mainwindow.h"
 #include "logger.h"
 #include "appcontext.h"
@@ -16,6 +17,17 @@ int main(int argc, char *argv[])
     Logger::setup();
 
     AppContext &appCtx = AppContext::instance();
+    ProjectManager &projectMgr = appCtx.projectManager();
+    QString fileName = QString("%1/%2").arg(QDir::currentPath(), "conf/monitor.xml");
+    bool result = projectMgr.openProject(fileName);
+    if(result)
+    {
+        LOG_INFO("open monitor config xml success: {}, canvas count: {}", fileName.toUtf8().data(), projectMgr.canvasCount());
+    }
+    else
+    {
+        LOG_ERROR("open monitor config xml failed: {}", fileName.toUtf8().data());
+    }
     
     MainWindow w;
     w.resize(SCREEN_WIDTH, SCREEN_HEIGHT);