|
@@ -11,10 +11,11 @@
|
|
|
#include <QDateTime>
|
|
#include <QDateTime>
|
|
|
#include <time.h>
|
|
#include <time.h>
|
|
|
|
|
|
|
|
-MainWindow::MainWindow(QWidget *parent)
|
|
|
|
|
|
|
+MainWindow::MainWindow(const int &frequency, QWidget *parent)
|
|
|
: QMainWindow(parent)
|
|
: QMainWindow(parent)
|
|
|
, m_pStackedWidget(nullptr)
|
|
, m_pStackedWidget(nullptr)
|
|
|
, m_pErrStrLabel(nullptr)
|
|
, m_pErrStrLabel(nullptr)
|
|
|
|
|
+ , m_frequency(frequency)
|
|
|
{
|
|
{
|
|
|
setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
|
|
setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
|
|
|
init_ui();
|
|
init_ui();
|
|
@@ -29,8 +30,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
connect(&httpServer, &HttpServer::monitorConfigureUpdate, this, &MainWindow::onConfigureUpdate);
|
|
connect(&httpServer, &HttpServer::monitorConfigureUpdate, this, &MainWindow::onConfigureUpdate);
|
|
|
connect(&httpServer, &HttpServer::reloadCanvas, this, &MainWindow::onReloadCanvas);
|
|
connect(&httpServer, &HttpServer::reloadCanvas, this, &MainWindow::onReloadCanvas);
|
|
|
|
|
|
|
|
- DataFifo &dataFifo = AppContext::instance().dataFifo();
|
|
|
|
|
- connect(&dataFifo, &DataFifo::updateScreen, this, &MainWindow::onUpdateScreen);
|
|
|
|
|
|
|
+ // DataFifo &dataFifo = AppContext::instance().dataFifo();
|
|
|
|
|
+ // connect(&dataFifo, &DataFifo::updateScreen, this, &MainWindow::onUpdateScreen);
|
|
|
|
|
|
|
|
connect(&m_timer, &QTimer::timeout, this, [this](){
|
|
connect(&m_timer, &QTimer::timeout, this, [this](){
|
|
|
DataFifo &dataFifo = AppContext::instance().dataFifo();
|
|
DataFifo &dataFifo = AppContext::instance().dataFifo();
|
|
@@ -62,6 +63,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
m_timer.start(1000);
|
|
m_timer.start(1000);
|
|
|
|
|
+
|
|
|
|
|
+ connect(&m_updateScreenTimer, &QTimer::timeout, this, &MainWindow::onUpdateScreen);
|
|
|
|
|
+ m_updateScreenTimer.start(1000 / m_frequency);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
MainWindow::~MainWindow()
|
|
@@ -159,12 +163,16 @@ void MainWindow::setCurrentCanvas(bool isNewComfigure)
|
|
|
m_pStackedWidget->setCurrentIndex(index);
|
|
m_pStackedWidget->setCurrentIndex(index);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void MainWindow::onUpdateScreen(const QJsonObject &obj)
|
|
|
|
|
|
|
+void MainWindow::onUpdateScreen()
|
|
|
{
|
|
{
|
|
|
// QElapsedTimer timer;
|
|
// QElapsedTimer timer;
|
|
|
// timer.start(); // 开始计时
|
|
// timer.start(); // 开始计时
|
|
|
|
|
+ LOG_INFO("update screen");
|
|
|
|
|
|
|
|
ProjectManager &projectMgr = AppContext::instance().projectManager();
|
|
ProjectManager &projectMgr = AppContext::instance().projectManager();
|
|
|
|
|
+ DataDict &dataDict = AppContext::instance().dataDict();
|
|
|
|
|
+ const QJsonObject obj = dataDict.data();
|
|
|
|
|
+
|
|
|
int canvasCount = projectMgr.canvasCount();
|
|
int canvasCount = projectMgr.canvasCount();
|
|
|
QString timestamp = obj["timestamp"].toString();
|
|
QString timestamp = obj["timestamp"].toString();
|
|
|
LOG_DEBUG("timestamp {}", timestamp.toStdString());
|
|
LOG_DEBUG("timestamp {}", timestamp.toStdString());
|