From 455341d626f02b79e5cb12aaf0121e4c0778b939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Czcw=E2=80=9D?= Date: Thu, 8 Jun 2023 15:52:26 +0800 Subject: [PATCH] =?UTF-8?q?0608=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MonitorUI/MonitorUI.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/MonitorUI/MonitorUI.h b/MonitorUI/MonitorUI.h index 570b408..923e778 100644 --- a/MonitorUI/MonitorUI.h +++ b/MonitorUI/MonitorUI.h @@ -153,6 +153,21 @@ public: }); timer->start(5000); + interruptedButton->setCheckable(true); + normalButton->setCheckable(true); + standbyButton->setCheckable(true); + hutdownButton->setCheckable(true); + failureButton->setCheckable(true); + runButton->setCheckable(true); + + connect(interruptedButton, &QPushButton::clicked, this, [=](){this->addTag();}); + connect(normalButton, &QPushButton::clicked, this, [=](){this->addTag();}); + connect(standbyButton, &QPushButton::clicked, this, [=](){this->addTag();}); + connect(hutdownButton, &QPushButton::clicked, this, [=](){this->addTag();}); + connect(failureButton, &QPushButton::clicked, this, [=](){this->addTag();}); + connect(runButton, &QPushButton::clicked, this, [=](){this->addTag();}); + + // connect(exchangeButton, &QPushButton::clicked, this, [=](){this->exchangeClicked();}); } // setupUi @@ -210,6 +225,9 @@ public: int index = 0; QList tags; for (auto it = allFans.begin(); it != allFans.end(); ++it) { + if(!shouldDisplay(it->second.fanCode)){ + continue; + } if (index == 6){ tagList.append(tags); tags.clear(); @@ -217,6 +235,7 @@ public: count++; } MonitorTag *newTag = new MonitorTag(it->second, state); + connect(newTag->stateBox, QOverload::of(&QComboBox::currentIndexChanged), [this](int index) {addTag();}); monitorLayout->addWidget(newTag, count, index); tags.append(newTag); index++; @@ -255,6 +274,29 @@ public: runButton->setText(QString("启动 ") + QString::number(fans.runFans.size())); } + bool shouldDisplay(QString FanCode){ + vector displayList; + if (interruptedButton->isChecked()){displayList.insert(displayList.end(), fans.interruptedFans.begin(), fans.interruptedFans.end());} + if (normalButton->isChecked()){displayList.insert(displayList.end(), fans.normalFans.begin(), fans.normalFans.end());} + if (standbyButton->isChecked()){displayList.insert(displayList.end(), fans.standbyFans.begin(), fans.standbyFans.end());} + if (hutdownButton->isChecked()){displayList.insert(displayList.end(), fans.hutdownFans.begin(), fans.hutdownFans.end());} + if (failureButton->isChecked()){displayList.insert(displayList.end(), fans.failureFans.begin(), fans.failureFans.end());} + if (runButton->isChecked()){displayList.insert(displayList.end(), fans.runFans.begin(), fans.runFans.end());} + if (!interruptedButton->isChecked() + && !normalButton->isChecked() + && !standbyButton->isChecked() + && !hutdownButton->isChecked() + && !failureButton->isChecked() + && !runButton->isChecked()){ + return true; + } + if (std::find(displayList.begin(), displayList.end(), FanCode) != displayList.end()) { + return true; + }else{ + return false; + } + } + MonitorWidget() { setupUi(this);