|
@@ -88,11 +88,12 @@ void MainWindow::init_ui()
|
|
|
pMainLayout->setSpacing(0);
|
|
pMainLayout->setSpacing(0);
|
|
|
pMainLayout->setContentsMargins(0, 0, 0, 0);
|
|
pMainLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
|
|
- reload();
|
|
|
|
|
- setCurrentCanvas();
|
|
|
|
|
|
|
+ if(reload()) {
|
|
|
|
|
+ setCurrentCanvas();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void MainWindow::reload()
|
|
|
|
|
|
|
+bool MainWindow::reload()
|
|
|
{
|
|
{
|
|
|
ProjectManager &projectMgr = AppContext::instance().projectManager();
|
|
ProjectManager &projectMgr = AppContext::instance().projectManager();
|
|
|
QString fileName = QString("%1/%2").arg(QDir::currentPath(), "conf/monitor.xml");
|
|
QString fileName = QString("%1/%2").arg(QDir::currentPath(), "conf/monitor.xml");
|
|
@@ -101,7 +102,7 @@ void MainWindow::reload()
|
|
|
LOG_INFO("open monitor config xml success: {}, canvas count: {}", fileName.toUtf8().data(), projectMgr.canvasCount());
|
|
LOG_INFO("open monitor config xml success: {}, canvas count: {}", fileName.toUtf8().data(), projectMgr.canvasCount());
|
|
|
} else {
|
|
} else {
|
|
|
LOG_ERROR("open monitor config xml failed: {}", fileName.toUtf8().data());
|
|
LOG_ERROR("open monitor config xml failed: {}", fileName.toUtf8().data());
|
|
|
- return;
|
|
|
|
|
|
|
+ return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
LOG_INFO("start reload monitor configure");
|
|
LOG_INFO("start reload monitor configure");
|
|
@@ -114,6 +115,7 @@ void MainWindow::reload()
|
|
|
m_pStackedWidget->insertWidget(i, pCanvas);
|
|
m_pStackedWidget->insertWidget(i, pCanvas);
|
|
|
}
|
|
}
|
|
|
LOG_INFO("reload monitor configure complete");
|
|
LOG_INFO("reload monitor configure complete");
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::clear()
|
|
void MainWindow::clear()
|
|
@@ -166,6 +168,8 @@ void MainWindow::setCurrentCanvas(bool isNewComfigure)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
m_pStackedWidget->setCurrentIndex(index);
|
|
m_pStackedWidget->setCurrentIndex(index);
|
|
|
|
|
+ ProjectManager &projectMgr = AppContext::instance().projectManager();
|
|
|
|
|
+ projectMgr.setCurrentCanvasIndex(index);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::onUpdateScreen(const QJsonObject &obj)
|
|
void MainWindow::onUpdateScreen(const QJsonObject &obj)
|
|
@@ -261,6 +265,7 @@ void MainWindow::onPageSwitdh(int state)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
m_pStackedWidget->setCurrentIndex(nextIndex);
|
|
m_pStackedWidget->setCurrentIndex(nextIndex);
|
|
|
|
|
+ projectMgr.setCurrentCanvasIndex(nextIndex);
|
|
|
|
|
|
|
|
QSettings settings("storage/conf/settings.ini", QSettings::IniFormat);
|
|
QSettings settings("storage/conf/settings.ini", QSettings::IniFormat);
|
|
|
settings.setIniCodec("UTF-8");
|
|
settings.setIniCodec("UTF-8");
|
|
@@ -311,9 +316,9 @@ void MainWindow::onConfigureUpdate(const QString &filename)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- reload();
|
|
|
|
|
-
|
|
|
|
|
- setCurrentCanvas(true);
|
|
|
|
|
|
|
+ if(reload()) {
|
|
|
|
|
+ setCurrentCanvas(true);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
LOG_INFO("update: default canvas index is {}", m_pStackedWidget->currentIndex());
|
|
LOG_INFO("update: default canvas index is {}", m_pStackedWidget->currentIndex());
|
|
|
QSettings settings("storage/conf/settings.ini", QSettings::IniFormat);
|
|
QSettings settings("storage/conf/settings.ini", QSettings::IniFormat);
|
|
@@ -327,12 +332,26 @@ void MainWindow::onReloadCanvas()
|
|
|
{
|
|
{
|
|
|
// reloadCanvas();
|
|
// reloadCanvas();
|
|
|
clear();
|
|
clear();
|
|
|
- reload();
|
|
|
|
|
- setCurrentCanvas();
|
|
|
|
|
|
|
+ if(reload()) {
|
|
|
|
|
+ setCurrentCanvas();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::onReport()
|
|
void MainWindow::onReport()
|
|
|
{
|
|
{
|
|
|
|
|
+ ProjectManager &projectMgr = AppContext::instance().projectManager();
|
|
|
QJsonObject obj = AppContext::instance().sysState().sysStateInfo();
|
|
QJsonObject obj = AppContext::instance().sysState().sysStateInfo();
|
|
|
|
|
+ obj.insert("curcanvas", projectMgr.currentCanvasIndex());
|
|
|
|
|
+ obj.insert("canvascount", projectMgr.canvasCount());
|
|
|
|
|
+ obj.insert("parametercount", 0);
|
|
|
|
|
+
|
|
|
|
|
+ if(projectMgr.canvasCount() > 0) {
|
|
|
|
|
+ QWidget *pWidget = m_pStackedWidget->currentWidget();
|
|
|
|
|
+ Canvas *pCanvas = static_cast<Canvas *>(pWidget);
|
|
|
|
|
+ if(pCanvas) {
|
|
|
|
|
+ obj["parametercount"] = pCanvas->parameterCount();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
m_broadcast.write(obj);
|
|
m_broadcast.write(obj);
|
|
|
}
|
|
}
|