0814更新

main
“zcw” 2 years ago
parent 5d17fd45c2
commit 2f4b591421

@ -9,10 +9,20 @@
#include <QtWidgets/QListView>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
#include <QStandardItemModel>
#include <QDebug>
#include <QTimer>
#include <QAbstractItemView>
#include <QIcon>
#include <QModelIndex>
#include "../HTTPClient/client.h"
#include "../MonitorUI/MonitorUI.h"
#include "tools.h"
QT_BEGIN_NAMESPACE
class Ui_ClearanceAnalyticWidget:public QWidget
class ClearanceAnalyticWidget:public QWidget
{
public:
QHBoxLayout *horizontalLayout;
@ -23,6 +33,11 @@ public:
QVBoxLayout *verticalLayout;
QLabel *infoLabel;
QLabel *trendLabel;
QStandardItemModel *deviceModel;
QTimer* timer;
MonitorWidget* monitor;
int curId;
void setupUi(QWidget *ClearanceAnalyticWidget)
{
@ -38,9 +53,13 @@ public:
horizontalLayout = new QHBoxLayout(ClearanceAnalyticWidget);
horizontalLayout->setSpacing(0);
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
horizontalLayout->setContentsMargins(20, 20, 20, 20);
deviceList = new QListView(ClearanceAnalyticWidget);
deviceList->setObjectName(QString::fromUtf8("deviceList"));
deviceModel = new QStandardItemModel();
deviceList->setModel(deviceModel);
deviceList->setEditTriggers(QAbstractItemView::NoEditTriggers);
horizontalLayout->addWidget(deviceList);
@ -79,16 +98,94 @@ public:
retranslateUi(ClearanceAnalyticWidget);
QMetaObject::connectSlotsByName(ClearanceAnalyticWidget);
addDevice();
QModelIndex index = deviceList->model()->index(0, 0); // 获取第2行的索引
deviceList->setCurrentIndex(index);
timer = new QTimer();
QObject::connect(timer, &QTimer::timeout, [&]() {
// 计时器超时时更新标签
addDevice();
httpClient.getHeadroomList(curId);
addHearoomFeature(curId);
});
timer->start(3000);
connect(deviceList, &QListView::doubleClicked, [&](const QModelIndex& index) {
if (index.isValid()) {
QString fanCode = index.data().toString();
curId = fans.allFans[fanCode].fanId;
httpClient.getHeadroomList(curId);
addHearoomFeature(curId);
}
});
} // setupUi
void retranslateUi(QWidget *ClearanceAnalyticWidget)
{
ClearanceAnalyticWidget->setWindowTitle(QCoreApplication::translate("ClearanceAnalyticWidget", "Form", nullptr));
infoLabel->setText(QCoreApplication::translate("ClearanceAnalyticWidget", "\345\256\236\346\227\266\344\277\241\346\201\257", nullptr));
// infoLabel->setText(QCoreApplication::translate("ClearanceAnalyticWidget", "\345\256\236\346\227\266\344\277\241\346\201\257", nullptr));
trendLabel->setText(QCoreApplication::translate("ClearanceAnalyticWidget", "\345\233\276\350\241\250\344\277\241\346\201\257", nullptr));
} // retranslateUi
Ui_ClearanceAnalyticWidget()
void addDevice(){
// httpClient.getFanList();
map allFans = fans.states;
if (!monitor->isInitState()){
if (monitor->displayList.size() > deviceModel->rowCount()){
for (int i = 0; i <= allFans.size() - deviceModel->rowCount() + 1; i++) {
QStandardItem* emptyItem = new QStandardItem("");
deviceModel->appendRow(emptyItem);
}
}else if (monitor->displayList.size() < deviceModel->rowCount()){
for (int i = 0; i <= deviceModel->rowCount() - allFans.size() + 2; i++) {
deviceModel->removeRow(0);
}
}
}else{
if (allFans.size() > deviceModel->rowCount()){
for (int i = 0; i <= allFans.size() - deviceModel->rowCount() + 1; i++) {
QStandardItem* emptyItem = new QStandardItem("");
deviceModel->appendRow(emptyItem);
}
}else if (allFans.size() < deviceModel->rowCount()){
for (int i = 0; i <= deviceModel->rowCount() - allFans.size() + 2; i++) {
deviceModel->removeRow(0);
}
}
}
int count = 0;
for (auto it = allFans.begin(); it != allFans.end(); ++it) {
if (monitor->shouldDisplay(it->first)){
QStandardItem* item = deviceModel->item(count);
// 修改QStandardItem对象的文本和图标
item->setText(it->first);
item->setIcon(getDevIcon(it->second));
count++;
}
}
}
void addHearoomFeature(int fanId){
vector headrooms = fans.idMaps[fanId].headrooms;
QString text;
for (auto it = headrooms.begin(); it != headrooms.end(); ++it) {
if (it->featureValue != 0){
text += it->featureName + " : " + QString::number(it->featureValue) + "\n";
// qDebug() << it->featureName;
}else{
text += it->featureName + " : " + QString("数据为空") + "\n";
}
}
infoLabel->setText(text);
}
ClearanceAnalyticWidget(MonitorWidget* monitor) : monitor(monitor)
{
setupUi(this);
}
@ -96,9 +193,7 @@ public:
};
namespace Ui {
class ClearanceAnalyticWidget: public Ui_ClearanceAnalyticWidget {};
} // namespace Ui
QT_END_NAMESPACE

@ -14,21 +14,33 @@
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QListWidget>
#include <QtWidgets/QListView>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
#include <QStandardItemModel>
#include <QDebug>
#include <QTimer>
#include <QAbstractItemView>
#include <QIcon>
#include <QModelIndex>
#include <QListWidgetItem>
#include "../HTTPClient/client.h"
#include "../MonitorUI/MonitorUI.h"
#include "FlangeItem.h"
#include "tools.h"
QT_BEGIN_NAMESPACE
class Ui_FlangeAnalyticWidget:public QWidget
class FlangeAnalyticWidget:public QWidget
{
public:
QHBoxLayout *horizontalLayout;
QListView *deviceList;
QWidget *displayWidget;
QGridLayout *gridLayout;
QListView *flangeList;
QListWidget *flangeList;
QSpacerItem *verticalSpacer;
QSpacerItem *horizontalSpacer;
QWidget *infoWidget;
@ -37,6 +49,14 @@ public:
QLabel *flangePiclabel;
QLabel *infoLabel;
QLabel *trendLabel;
QStandardItemModel *deviceModel;
QTimer* timer;
QWidget *flangeWidget;
QVBoxLayout *veticalLayout;
MonitorWidget* monitor;
int curId;
void setupUi(QWidget *FlangeAnalyticWidget)
{
@ -47,93 +67,136 @@ public:
horizontalLayout->setSpacing(0);
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
horizontalLayout->setContentsMargins(20, 20, 20, 20);
deviceList = new QListView(FlangeAnalyticWidget);
deviceList->setObjectName(QString::fromUtf8("deviceList"));
deviceModel = new QStandardItemModel();
deviceList->setModel(deviceModel);
deviceList->setEditTriggers(QAbstractItemView::NoEditTriggers);
horizontalLayout->addWidget(deviceList);
displayWidget = new QWidget(FlangeAnalyticWidget);
displayWidget->setObjectName(QString::fromUtf8("displayWidget"));
gridLayout = new QGridLayout(displayWidget);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
gridLayout->setContentsMargins(20, 0, 0, 0);
flangeList = new QListView(displayWidget);
flangeList = new QListWidget (FlangeAnalyticWidget);
flangeList->setObjectName(QString::fromUtf8("flangeList"));
flangeList->setEditTriggers(QAbstractItemView::NoEditTriggers);
gridLayout->addWidget(flangeList, 0, 0, 1, 1);
verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
gridLayout->addItem(verticalSpacer, 1, 0, 1, 1);
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
gridLayout->addItem(horizontalSpacer, 0, 1, 1, 1);
flangeWidget = new QWidget (FlangeAnalyticWidget);
infoLabel = new QLabel (flangeWidget);
infoLabel->setAlignment(Qt::AlignCenter);
infoLabel->setObjectName("infoLabel");
gridLayout->setRowStretch(0, 1);
gridLayout->setRowStretch(1, 2);
gridLayout->setColumnStretch(0, 1);
gridLayout->setColumnStretch(1, 2);
veticalLayout = new QVBoxLayout(flangeWidget);
veticalLayout->addWidget(infoLabel);
veticalLayout->addWidget(flangeList);
horizontalLayout->addWidget(displayWidget);
horizontalLayout->addWidget(flangeWidget);
infoWidget = new QWidget(FlangeAnalyticWidget);
infoWidget->setObjectName(QString::fromUtf8("infoWidget"));
verticalLayout = new QVBoxLayout(infoWidget);
verticalLayout->setSpacing(0);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
horizontalLayout_2 = new QHBoxLayout();
horizontalLayout_2->setSpacing(0);
horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
flangePiclabel = new QLabel(infoWidget);
flangePiclabel->setObjectName(QString::fromUtf8("flangePiclabel"));
horizontalLayout->setStretch(0, 1);
horizontalLayout->setStretch(1, 5);
horizontalLayout_2->addWidget(flangePiclabel);
infoLabel = new QLabel(infoWidget);
infoLabel->setObjectName(QString::fromUtf8("infoLabel"));
horizontalLayout_2->addWidget(infoLabel);
QMetaObject::connectSlotsByName(FlangeAnalyticWidget);
addDevice();
addFlanges(deviceModel->data(deviceModel->index(0, 0)).toString());
QModelIndex index = deviceList->model()->index(0, 0); // 获取第2行的索引
deviceList->setCurrentIndex(index);
timer = new QTimer();
QObject::connect(timer, &QTimer::timeout, [&]() {
// 计时器超时时更新标签
addDevice();
QModelIndex currentIndex = deviceList->currentIndex();
QString fanCode = currentIndex.data().toString();
addFlanges(fanCode);
});
timer->start(3000);
connect(deviceList, &QListView::doubleClicked, [&](const QModelIndex& index) {
if (index.isValid()) {
QString fanCode = index.data().toString();
curId = fans.allFans[fanCode].fanId;
addFlanges(fanCode);
}
});
verticalLayout->addLayout(horizontalLayout_2);
} // setupUi
trendLabel = new QLabel(infoWidget);
trendLabel->setObjectName(QString::fromUtf8("trendLabel"));
verticalLayout->addWidget(trendLabel);
void addDevice(){
// httpClient.getFanList();
map allFans = fans.states;
if (!monitor->isInitState()){
if (monitor->displayList.size() > deviceModel->rowCount()){
for (int i = 0; i <= allFans.size() - deviceModel->rowCount() + 1; i++) {
QStandardItem* emptyItem = new QStandardItem("");
deviceModel->appendRow(emptyItem);
}
}else if (monitor->displayList.size() < deviceModel->rowCount()){
for (int i = 0; i <= deviceModel->rowCount() - allFans.size() + 2; i++) {
deviceModel->removeRow(0);
}
}
}else{
if (allFans.size() > deviceModel->rowCount()){
for (int i = 0; i <= allFans.size() - deviceModel->rowCount() + 1; i++) {
QStandardItem* emptyItem = new QStandardItem("");
deviceModel->appendRow(emptyItem);
}
}else if (allFans.size() < deviceModel->rowCount()){
for (int i = 0; i <= deviceModel->rowCount() - allFans.size() + 2; i++) {
deviceModel->removeRow(0);
}
}
}
horizontalLayout->addWidget(infoWidget);
int count = 0;
for (auto it = allFans.begin(); it != allFans.end(); ++it) {
if (monitor->shouldDisplay(it->first)){
QStandardItem* item = deviceModel->item(count);
horizontalLayout->setStretch(0, 5);
horizontalLayout->setStretch(1, 10);
horizontalLayout->setStretch(2, 5);
// 修改QStandardItem对象的文本和图标
item->setText(it->first);
item->setIcon(getDevIcon(it->second));
count++;
}
}
}
retranslateUi(FlangeAnalyticWidget);
void addFlanges(QString fanCode){
int fanId = fans.allFans[fanCode].fanId;
httpClient.getFlangeList(fanId);
map flanges = fans.idMaps[fans.allFans[fanCode].fanId].flanges;
flangeList->clear();
int normalCount = 0;
int errorCount = 0;
for (auto flange = flanges.begin(); flange != flanges.end(); ++flange){
FlangeItem *item = new FlangeItem(flange->second);
QListWidgetItem* listItem = new QListWidgetItem();
listItem->setSizeHint(QSize(200,120));
flangeList->addItem(listItem);
flangeList->setItemWidget(listItem, item);
if (flange->second.flangeState == QString("正常")){
normalCount++;
}else if (flange->second.flangeState == QString("故障")){
errorCount++;
}
}
infoLabel->setText(QString("总览 (正常: %1/%2 报警: %3/%4)")
.arg(normalCount).arg(flanges.size()).arg(errorCount).arg(flanges.size()));
}
QMetaObject::connectSlotsByName(FlangeAnalyticWidget);
} // setupUi
void addFeatures(QString flangeId){
map flanges = fans.idMaps[curId].flanges;
void retranslateUi(QWidget *FlangeAnalyticWidget)
{
FlangeAnalyticWidget->setWindowTitle(QCoreApplication::translate("FlangeAnalyticWidget", "Form", nullptr));
flangePiclabel->setText(QCoreApplication::translate("FlangeAnalyticWidget", "\346\230\276\347\244\272\346\263\225\345\205\260", nullptr));
infoLabel->setText(QCoreApplication::translate("FlangeAnalyticWidget", "\345\256\236\346\227\266\344\277\241\346\201\257\347\233\221\346\265\213", nullptr));
trendLabel->setText(QCoreApplication::translate("FlangeAnalyticWidget", "\345\233\276\350\241\250\344\277\241\346\201\257", nullptr));
} // retranslateUi
}
Ui_FlangeAnalyticWidget()
{
FlangeAnalyticWidget(MonitorWidget* monitor) : monitor(monitor){
setupUi(this);
}
};
namespace Ui {
class FlangeAnalyticWidget: public Ui_FlangeAnalyticWidget {};
} // namespace Ui
QT_END_NAMESPACE

@ -0,0 +1,184 @@
#ifndef FLANGEITEMBJXPGW_H
#define FLANGEITEMBJXPGW_H
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QWidget>
#include "../HTTPClient/client.h"
#include "tools.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
class FlangeItem:public QWidget
{
public:
QHBoxLayout *horizontalLayout_2;
QLabel *flangePic;
QHBoxLayout *horizontalLayout;
QLabel *state1;
QLabel *state2;
QLabel *state3;
QLabel *state4;
QLabel *state5;
QLabel *state6;
QLabel *state7;
QLabel *state8;
QLabel *state9;
QLabel *state10;
QLabel *state11;
QLabel *state12;
QPushButton *pushButton;
FlangeClass flange;
void setupUi(QWidget *FlangeItem)
{
if (FlangeItem->objectName().isEmpty())
FlangeItem->setObjectName(QString::fromUtf8("FlangeItem"));
FlangeItem->resize(960, 500);
horizontalLayout_2 = new QHBoxLayout(FlangeItem);
horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
flangePic = new QLabel(FlangeItem);
flangePic->setObjectName(QString::fromUtf8("flangePic"));
flangePic->setScaledContents(true);
horizontalLayout_2->addWidget(flangePic);
horizontalLayout = new QHBoxLayout();
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
state1 = new QLabel(FlangeItem);
state1->setObjectName(QString::fromUtf8("state1"));
state1->setScaledContents(true);
horizontalLayout->addWidget(state1);
state2 = new QLabel(FlangeItem);
state2->setObjectName(QString::fromUtf8("state2"));
state2->setScaledContents(true);
horizontalLayout->addWidget(state2);
state3 = new QLabel(FlangeItem);
state3->setObjectName(QString::fromUtf8("state3"));
state3->setScaledContents(true);
horizontalLayout->addWidget(state3);
state4 = new QLabel(FlangeItem);
state4->setObjectName(QString::fromUtf8("state4"));
state4->setScaledContents(true);
horizontalLayout->addWidget(state4);
state5 = new QLabel(FlangeItem);
state5->setObjectName(QString::fromUtf8("state5"));
state5->setScaledContents(true);
horizontalLayout->addWidget(state5);
state6 = new QLabel(FlangeItem);
state6->setObjectName(QString::fromUtf8("state6"));
state6->setScaledContents(true);
horizontalLayout->addWidget(state6);
state7 = new QLabel(FlangeItem);
state7->setObjectName(QString::fromUtf8("state7"));
state7->setScaledContents(true);
horizontalLayout->addWidget(state7);
state8 = new QLabel(FlangeItem);
state8->setObjectName(QString::fromUtf8("state8"));
state8->setScaledContents(true);
horizontalLayout->addWidget(state8);
state9 = new QLabel(FlangeItem);
state9->setObjectName(QString::fromUtf8("state9"));
state9->setScaledContents(true);
horizontalLayout->addWidget(state9);
state10 = new QLabel(FlangeItem);
state10->setObjectName(QString::fromUtf8("state10"));
state10->setScaledContents(true);
horizontalLayout->addWidget(state10);
state11 = new QLabel(FlangeItem);
state11->setObjectName(QString::fromUtf8("state11"));
state11->setScaledContents(true);
horizontalLayout->addWidget(state11);
state12 = new QLabel(FlangeItem);
state12->setObjectName(QString::fromUtf8("state12"));
state12->setScaledContents(true);
horizontalLayout->addWidget(state12);
horizontalLayout->setSpacing(3);
horizontalLayout_2->addLayout(horizontalLayout);
pushButton = new QPushButton(FlangeItem);
pushButton->setObjectName(QString::fromUtf8("pushButton"));
horizontalLayout_2->addWidget(pushButton);
horizontalLayout_2->setStretch(0, 1);
horizontalLayout_2->setStretch(1, 10);
horizontalLayout_2->setStretch(2, 1);
retranslateUi(FlangeItem);
QMetaObject::connectSlotsByName(FlangeItem);
setIcon();
} // setupUi
void retranslateUi(QWidget *FlangeItem)
{
FlangeItem->setWindowTitle(QCoreApplication::translate("FlangeItem", "Form", nullptr));
pushButton->setText(QCoreApplication::translate("FlangeItem", "\346\232\202\347\225\231", nullptr));
} // retranslateUi
void setIcon()
{
if (flange.flangeState == QString("故障")){
QPixmap pixmap(":/Static/flangeError.png");
flangePic->setPixmap(pixmap);
}else if (flange.flangeState == QString("正常")){
QPixmap pixmap(":/Static/flangeNromal.png");
flangePic->setPixmap(pixmap);
}
QPixmap normalPix(":/Static/normal.png");
QPixmap errorPixmap(":/Static/error.png");
state1->setPixmap(normalPix);
state2->setPixmap(normalPix);
state3->setPixmap(normalPix);
state4->setPixmap(normalPix);
state5->setPixmap(normalPix);
state6->setPixmap(normalPix);
state7->setPixmap(normalPix);
state8->setPixmap(normalPix);
state9->setPixmap(normalPix);
state10->setPixmap(normalPix);
state11->setPixmap(normalPix);
state12->setPixmap(normalPix);
}
FlangeItem(FlangeClass flange) : flange(flange){
setupUi(this);
}
};
QT_END_NAMESPACE
#endif // FLANGEITEMBJXPGW_H

@ -17,10 +17,20 @@
#include <QtWidgets/QListView>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
#include <QStandardItemModel>
#include <QDebug>
#include <QTimer>
#include <QAbstractItemView>
#include <QIcon>
#include <QModelIndex>
#include "../HTTPClient/client.h"
#include "../MonitorUI/MonitorUI.h"
#include "tools.h"
QT_BEGIN_NAMESPACE
class Ui_GyroscopeAnalyticWidget:public QWidget
class GyroscopeAnalyticWidget:public QWidget
{
public:
QHBoxLayout *horizontalLayout;
@ -31,6 +41,11 @@ public:
QVBoxLayout *verticalLayout;
QLabel *infoLabel;
QLabel *trendLabel;
QStandardItemModel *deviceModel;
QTimer* timer;
int curId;
MonitorWidget* monitor;
void setupUi(QWidget *GyroscopeAnalyticWidget)
{
@ -40,8 +55,12 @@ public:
horizontalLayout->setSpacing(0);
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
horizontalLayout->setContentsMargins(20, 20, 20, 20);
deviceList = new QListView(GyroscopeAnalyticWidget);
deviceList->setObjectName(QString::fromUtf8("deviceList"));
deviceModel = new QStandardItemModel();
deviceList->setModel(deviceModel);
deviceList->setEditTriggers(QAbstractItemView::NoEditTriggers);
horizontalLayout->addWidget(deviceList);
@ -80,25 +99,90 @@ public:
retranslateUi(GyroscopeAnalyticWidget);
QMetaObject::connectSlotsByName(GyroscopeAnalyticWidget);
addDevice();
QModelIndex index = deviceList->model()->index(0, 0); // 获取第2行的索引
deviceList->setCurrentIndex(index);
timer = new QTimer();
QObject::connect(timer, &QTimer::timeout, [&]() {
// 计时器超时时更新标签
addDevice();
httpClient.getGyroList(curId);
addGyroFeature(curId);
});
timer->start(3000);
connect(deviceList, &QListView::doubleClicked, [&](const QModelIndex& index) {
if (index.isValid()) {
QString fanCode = index.data().toString();
curId = fans.allFans[fanCode].fanId;
httpClient.getGyroList(curId);
addGyroFeature(curId);
}
});
} // setupUi
void retranslateUi(QWidget *GyroscopeAnalyticWidget)
{
GyroscopeAnalyticWidget->setWindowTitle(QCoreApplication::translate("GyroscopeAnalyticWidget", "Form", nullptr));
infoLabel->setText(QCoreApplication::translate("GyroscopeAnalyticWidget", "\345\256\236\346\227\266\344\277\241\346\201\257", nullptr));
trendLabel->setText(QCoreApplication::translate("GyroscopeAnalyticWidget", "\345\233\276\350\241\250\344\277\241\346\201\257", nullptr));
} // retranslateUi
Ui_GyroscopeAnalyticWidget()
void addDevice(){
// httpClient.getFanList();
map allFans = fans.states;
if (!monitor->isInitState()){
if (monitor->displayList.size() > deviceModel->rowCount()){
for (int i = 0; i <= allFans.size() - deviceModel->rowCount() + 1; i++) {
QStandardItem* emptyItem = new QStandardItem("");
deviceModel->appendRow(emptyItem);
}
}else if (monitor->displayList.size() < deviceModel->rowCount()){
for (int i = 0; i <= deviceModel->rowCount() - allFans.size() + 2; i++) {
deviceModel->removeRow(0);
}
}
}else{
if (allFans.size() > deviceModel->rowCount()){
for (int i = 0; i <= allFans.size() - deviceModel->rowCount() + 1; i++) {
QStandardItem* emptyItem = new QStandardItem("");
deviceModel->appendRow(emptyItem);
}
}else if (allFans.size() < deviceModel->rowCount()){
for (int i = 0; i <= deviceModel->rowCount() - allFans.size() + 2; i++) {
deviceModel->removeRow(0);
}
}
}
int count = 0;
for (auto it = allFans.begin(); it != allFans.end(); ++it) {
if (monitor->shouldDisplay(it->first)){
QStandardItem* item = deviceModel->item(count);
// 修改QStandardItem对象的文本和图标
item->setText(it->first);
item->setIcon(getDevIcon(it->second));
count++;
}
}
}
void addGyroFeature(int fanId){
vector gyros = fans.idMaps[fanId].gyros;
QString text;
for (auto it = gyros.begin(); it != gyros.end(); ++it) {
text += it->featureName + " : " + QString::number(it->featureValue) + "\n";
// qDebug() << it->featureName;
}
infoLabel->setText(text);
}
GyroscopeAnalyticWidget(MonitorWidget* monitor) : monitor(monitor)
{
setupUi(this);
}
};
namespace Ui {
class GyroscopeAnalyticWidget: public Ui_GyroscopeAnalyticWidget {};
} // namespace Ui
QT_END_NAMESPACE

@ -0,0 +1,26 @@
#ifndef TOOLS_H
#define TOOLS_H
#include <QIcon>
#include <QString>
QIcon getDevIcon(QString states){
if (states == QString("正常运行")){
return QIcon(":/Static/fanNormal.png");
}else if (states == QString("通讯中断")){
return QIcon(":/Static/fanfanInterrupted.png");
}else if (states == QString("待机等风")){
return QIcon(":/Static/fanStandby.png");
}else if (states == QString("停机维护")){
return QIcon(":/Static/fanHutdown.png");
}else if (states == QString("故障停机")){
return QIcon(":/Static/fanError.png");
}else if (states == QString("启动")){
return QIcon(":/Static/fanRun.png");
}else{
return QIcon(":/Static/fanNormal.png");
}
}
#endif // TOOLS_H

@ -10,7 +10,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#
set(OPENSSL_ROOT_DIR "D:/openssl/OpenSSL-Win64")
set(OPENSSL_ROOT_DIR "F:/OpenSSL-Win64")
set(OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/include")
set(OPENSSL_LIB_DIR "${OPENSSL_ROOT_DIR}/lib")
find_package(OpenSSL REQUIRED)
@ -33,6 +33,8 @@ set(PROJECT_SOURCES
./AnalyticUI/FlangeAnalyticUI.h
./AnalyticUI/ClearanceAnalyticUI.h
./AnalyticUI/GyroscopeAnalyticUI.h
./AnalyticUI/tools.h
./AnalyticUI/FlangeItem.h
./HTTPClient/client.h
./HTTPClient/client.cpp
./LoginUI/Login.h

@ -2,7 +2,6 @@
<qresource prefix="/">
<file>Static/close.png</file>
<file>Static/min.png</file>
<file>Static/DamQSS.Qss</file>
<file>Static/fanNormal.png</file>
<file>Static/fanError.png</file>
<file>Static/fanHutdown.png</file>
@ -19,5 +18,8 @@
<file>Static/down.png</file>
<file>Static/background.png</file>
<file>Static/scrollBar.png</file>
<file>Static/error.png</file>
<file>Static/normal.png</file>
<file>Static/DamQSS.Qss</file>
</qresource>
</RCC>

@ -39,6 +39,7 @@ bool isInLists(QString element) {
header = {{"GroupId", "dam"}};
loginIndex = "/services/application/api/fan_app/login";
fanListIndex = "/services/application/api/fan_app/fanList";
flangeIndex = "/services/application/api/fan_app/flangeList";
headroomDetailIndex = "/services/application/api/fan_app/headroomDetail";
gyroDetailIndex = "/services/application/api/fan_app/gyroDetail";
featureHistoryIndex = "/services/application/api/fan_app/featureHistory";
@ -50,7 +51,9 @@ bool isInLists(QString element) {
json resJson = json::parse(res->body);
for (const auto& data : resJson["data"]) {
FanClass fan;
//cout << data["fanId"];
fan.fanCode = QString::fromStdString(data["fanCode"]);
fan.fanId = data["fanId"];
if (data["functions"]["gyro"]["features"][0]["featureValue"].is_number()) {
fan.angle = data["functions"]["gyro"]["features"][0]["featureValue"].get<double>();
}
@ -61,6 +64,8 @@ bool isInLists(QString element) {
fan.flangeState = QString::fromStdString(data["functions"]["gyro"]["state"]);
fan.headroomState = QString::fromStdString(data["functions"]["headRoom"]["state"]);
fans.allFans[fan.fanCode] = fan;
fans.idMaps[fan.fanId] = fan;
if (isInLists(fan.fanCode)){
return;
}
@ -81,41 +86,58 @@ bool isInLists(QString element) {
}
}
}
}
QString HTTPClient::getFlangeList(int fanId) {
void HTTPClient::getFlangeList(int fanId) {
json bodyJson = {{"fanId",fanId}};
std::string body = bodyJson.dump();
if (auto res = client.Post(headroomDetailIndex, header, body, "application/json")) {
fans.idMaps[fanId].flanges.clear();
if (auto res = client.Post(flangeIndex, header, body, "application/json")) {
json resJson = json::parse(res->body);
QString body = QString::fromStdString(res->body);
return body;
// qDebug() << body;
for (const auto& data : resJson["data"]) {
FlangeClass flange;
flange.flangeId = QString::fromStdString(data["flangeId"].dump());
flange.flangeState = QString::fromStdString(data["flangeState"]);
for (const auto& feature : data["features"]){
flange.features[QString::fromStdString(feature["featureName"].dump())] = QString::fromStdString(feature["featureValue"].dump());
}
else {
return QString("error");
fans.idMaps[fanId].flanges[flange.flangeId] = flange;
}
}
}
QString HTTPClient::getHeadroomList(int fanId) {
void HTTPClient::getHeadroomList(int fanId) {
json bodyJson = { {"fanId",fanId} };
std::string body = bodyJson.dump();
if (auto res = client.Post(headroomDetailIndex, header, body, "application/json")) {
QString body = QString::fromStdString(res->body);
return body;
json resJson = json::parse(res->body);
fans.idMaps[fanId].headrooms.clear();
for (const auto& data : resJson["data"][0]["features"]) {
HeadroomClass headroom;
headroom.featureName = QString::fromStdString(data["featureName"]);
if (data["featureValue"].is_number()){
headroom.featureValue = data["featureValue"].get<double>();
}
fans.idMaps[fanId].headrooms.push_back(headroom);
}
else {
return QString("error");
}
}
QString HTTPClient::getGyroList(int fanId) {
void HTTPClient::getGyroList(int fanId) {
json bodyJson = { {"fanId",fanId} };
std::string body = bodyJson.dump();
if (auto res = client.Post(gyroDetailIndex, header, body, "application/json")) {
QString body = QString::fromStdString(res->body);
return body;
json resJson = json::parse(res->body);
fans.idMaps[fanId].gyros.clear();
for (const auto& data : resJson["data"][0]["features"]) {
GyroClass gyro;
gyro.featureName = QString::fromStdString(data["featureName"]);
gyro.featureValue = data["featureValue"].get<double>();
fans.idMaps[fanId].gyros.push_back(gyro);
}
else {
return QString("error");
}
}
@ -131,3 +153,8 @@ bool isInLists(QString element) {
//int main(){
// httpClient.getFanList();
// httpClient.getFlangeList(1055);
// return 0;
//}

@ -10,11 +10,44 @@
#include <iostream>
#include <httplib.h>
#include <QString>
#include <QMenu>
using namespace std;
void delNameFromList(QString element);
class FlangeClass // 法兰类
{
public:
int errorCode;
QString flangeId;
QString errorInfo;
QString fanCode;
QString flangeState;
std::map<QString, QString> features;
};
class HeadroomClass // 净空类
{
public:
int errorCode;
int flangeId;
QString errorInfo;
QString fanCode;
QString featureName;
double featureValue = 0;
};
class GyroClass // 陀螺仪类
{
public:
int errorCode;
int flangeId;
QString errorInfo;
QString fanCode;
QString featureName;
double featureValue;
};
class FanClass // 风机类
{
public:
@ -27,13 +60,19 @@ public:
QString flangeState;
QString headroomState;
QString gyroState;
std::map<QString, FlangeClass> flanges;
std::vector<GyroClass> gyros;
std::vector<HeadroomClass> headrooms;
};
class FanManage // 所有风机管理类
{
public:
std::map<QString, FanClass> allFans; // 所有风机
std::map<int, FanClass> idMaps; // 根据ID获取风机
std::map<QString, QString> states; // 风机状态
std::vector<QString> interruptedFans; // 通讯中断
std::vector<QString> standbyFans; // 待机等风
@ -54,14 +93,15 @@ private:
string headroomDetailIndex;
string gyroDetailIndex;
string featureHistoryIndex;
string flangeIndex;
public:
httplib::Client client;
HTTPClient();
void getFanList();
QString getFlangeList(int fanId);
QString getHeadroomList(int fanId);
QString getGyroList(int fanId);
void getFlangeList(int fanId);
void getHeadroomList(int fanId);
void getGyroList(int fanId);
QString getHistoryList(int fanId);
};

@ -1,5 +1,5 @@
#include "MainWindow.h"

@ -1,4 +1,4 @@
#include <QtCore/QVariant>
#include <QtCore/QVariant>
#include <QtGui/QIcon>
#include <QtWidgets/QApplication>
#include <QtWidgets/QHBoxLayout>
@ -8,11 +8,13 @@
#include <QtWidgets/QStackedWidget>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
#include <QtWidgets/QSplitter>
#include "./MonitorUI/MonitorUI.h"
#include "./AnalyticUI/ClearanceAnalyticUI.h"
#include "./AnalyticUI/FlangeAnalyticUI.h"
#include "./AnalyticUI/GyroscopeAnalyticUI.h"
#pragma execution_character_set("utf-8")
@ -32,10 +34,10 @@ public:
QPushButton *clearanceButton;
QPushButton *gyroscopeButton;
QStackedWidget *stackedWidget;
MonitorWidget *monitorPage;
Ui::ClearanceAnalyticWidget *clearancePage;
Ui::FlangeAnalyticWidget *flangePage;
Ui::GyroscopeAnalyticWidget *gyroscopePage;
MonitorWidget* monitorPage;
ClearanceAnalyticWidget *clearancePage;
FlangeAnalyticWidget* flangePage;
GyroscopeAnalyticWidget *gyroscopePage;
@ -57,7 +59,7 @@ public:
horizontalLayout = new QHBoxLayout(titleWidget);
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
horizontalLayout->setContentsMargins(0, 0, 10, 20);
horizontalLayout->setSpacing(10);
horizontalLayout->setSpacing(5);
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
horizontalLayout->addItem(horizontalSpacer);
@ -83,33 +85,36 @@ public:
tabLayout = new QHBoxLayout();
tabLayout->setObjectName(QString::fromUtf8("tabLayout"));
tabLayout->setSpacing(15);
tabLayout->setContentsMargins(20, 0, 20, 0);
tabLayout->setContentsMargins(20, 0, 20, 20);
tabLayout->addStretch();
monitorButton = new QPushButton(centralwidget);
monitorButton->setObjectName(QString::fromUtf8("monitorButton"));
tabLayout->addWidget(monitorButton);
flangeButton = new QPushButton(centralwidget);
flangeButton->setObjectName(QString::fromUtf8("flangeButton"));
tabLayout->addStretch();
tabLayout->addWidget(flangeButton);
clearanceButton = new QPushButton(centralwidget);
clearanceButton->setObjectName(QString::fromUtf8("clearanceButton"));
tabLayout->addStretch();
tabLayout->addWidget(clearanceButton);
gyroscopeButton = new QPushButton(centralwidget);
gyroscopeButton->setObjectName(QString::fromUtf8("gyroscopeButton"));
tabLayout->addStretch();
tabLayout->addWidget(gyroscopeButton);
tabLayout->addStretch();
verticalLayout->addLayout(tabLayout);
stackedWidget = new QStackedWidget(centralwidget);
stackedWidget->setObjectName(QString::fromUtf8("stackedWidget"));
@ -118,31 +123,43 @@ public:
monitorPage->setObjectName(QString::fromUtf8("monitorPage"));
stackedWidget->addWidget(monitorPage);
flangePage = new Ui::FlangeAnalyticWidget();
flangePage = new FlangeAnalyticWidget(monitorPage);
flangePage->setObjectName(QString::fromUtf8("flangePage"));
stackedWidget->addWidget(flangePage);
clearancePage = new Ui::ClearanceAnalyticWidget();
clearancePage = new ClearanceAnalyticWidget(monitorPage);
clearancePage->setObjectName(QString::fromUtf8("clearancePage"));
stackedWidget->addWidget(clearancePage);
gyroscopePage = new Ui::GyroscopeAnalyticWidget();
gyroscopePage = new GyroscopeAnalyticWidget(monitorPage);
gyroscopePage->setObjectName(QString::fromUtf8("gyroscopePage"));
stackedWidget->addWidget(gyroscopePage);
verticalLayout->addWidget(stackedWidget);
verticalLayout->addLayout(tabLayout);
verticalLayout->setStretch(0, 2);
verticalLayout->setStretch(1, 3);
verticalLayout->setStretch(2, 40);
verticalLayout->setStretch(1, 40);
verticalLayout->setStretch(2, 3);
tabLayout->setStretch(0, 1);
tabLayout->setStretch(1, 1);
tabLayout->setStretch(2, 3);
tabLayout->setStretch(3, 1);
tabLayout->setStretch(4, 3);
tabLayout->setStretch(5, 1);
tabLayout->setStretch(6, 3);
tabLayout->setStretch(7, 1);
tabLayout->setStretch(8, 1);
tabLayout->setSpacing(5);
MainWindow->setCentralWidget(centralwidget);
setButtonMes();
// 设置按钮点击跳转窗口
// ???e?????????????
connect(closeButton, &QPushButton::clicked, MainWindow, &QMainWindow::close);
// 设置无边框窗口
// ??????????
MainWindow->setWindowFlags(Qt::FramelessWindowHint);
QMetaObject::connectSlotsByName(MainWindow);
@ -151,16 +168,20 @@ public:
void setButtonMes()
{
monitorButton->setText(u8"监 控 总 览");
flangeButton->setText(u8"法 兰 分 析");
clearanceButton->setText(u8"净 空 分 析");
gyroscopeButton->setText(u8"陀 螺 仪 监 测");
monitorButton->setText(QString("监控总览"));
flangeButton->setText(QString("法兰分析"));
clearanceButton->setText(QString("净空区域"));
gyroscopeButton->setText(QString("陀螺仪监测"));
connect(monitorButton, &QPushButton::clicked, this, [=](){this->stackedWidget->setCurrentIndex(0); });
connect(flangeButton, &QPushButton::clicked, this, [=](){this->stackedWidget->setCurrentIndex(1); });
connect(clearanceButton, &QPushButton::clicked, this, [=](){this->stackedWidget->setCurrentIndex(2); });
connect(gyroscopeButton, &QPushButton::clicked, this, [=](){this->stackedWidget->setCurrentIndex(3); });
// connect(flangeButton, &QPushButton::clicked, this, [=](){this->flangePage->addDevice(); });
// connect(clearanceButton, &QPushButton::clicked, this, [=](){this->clearancePage->addDevice(); });
// connect(gyroscopeButton, &QPushButton::clicked, this, [=](){this->gyroscopePage->addDevice(); });
connect(monitorButton, &QPushButton::clicked, this, [=](){this->clearButton();});
connect(flangeButton, &QPushButton::clicked, this, [=](){this->clearButton();});
connect(clearanceButton, &QPushButton::clicked, this, [=](){this->clearButton();});

@ -199,37 +199,37 @@ public:
pixmap = pixmap.scaled(100, 100, Qt::KeepAspectRatio);
pictureLabel->setPixmap(pixmap);
pictureLabel_2->setPixmap(pixmap);
this->setStyleSheet("QWidget#MonitorTag{background-color: #374065;border-radius: 5px;border: 3px solid;border-color: #1AFA29;}");
this->setStyleSheet("QWidget#MonitorTag{background-color: rgba(55, 64, 101, 60%);border-radius: 5px;border: 3px solid;border-color: #1AFA29;}");
}else if (fans.states[fan.fanCode] == QString("通讯中断")){
QPixmap pixmap(":/Static/fanfanInterrupted.png");
pixmap = pixmap.scaled(100, 100, Qt::KeepAspectRatio);
pictureLabel->setPixmap(pixmap);
pictureLabel_2->setPixmap(pixmap);
this->setStyleSheet("QWidget#MonitorTag{background-color: #374065;border-radius: 5px;border: 3px solid;border-color: white;}");
this->setStyleSheet("QWidget#MonitorTag{background-color: rgba(55, 64, 101, 60%);border-radius: 5px;border: 3px solid;border-color: white;}");
}else if (fans.states[fan.fanCode] == QString("待机等风")){
QPixmap pixmap(":/Static/fanStandby.png");
pixmap = pixmap.scaled(100, 100, Qt::KeepAspectRatio);
pictureLabel->setPixmap(pixmap);
pictureLabel_2->setPixmap(pixmap);
this->setStyleSheet("QWidget#MonitorTag{background-color: #374065;border-radius: 5px;border: 3px solid;border-color: #F4EA2A;}");
this->setStyleSheet("QWidget#MonitorTag{background-color: rgba(55, 64, 101, 60%);border-radius: 5px;border: 3px solid;border-color: #F4EA2A;}");
}else if (fans.states[fan.fanCode] == QString("停机维护")){
QPixmap pixmap(":/Static/fanHutdown.png");
pixmap = pixmap.scaled(100, 100, Qt::KeepAspectRatio);
pictureLabel->setPixmap(pixmap);
pictureLabel_2->setPixmap(pixmap);
this->setStyleSheet("QWidget#MonitorTag{background-color: #374065;border-radius: 5px;border: 3px solid;border-color: #C0397C;}");
this->setStyleSheet("QWidget#MonitorTag{background-color: rgba(55, 64, 101, 60%);border-radius: 5px;border: 3px solid;border-color: #C0397C;}");
}else if (fans.states[fan.fanCode] == QString("故障停机")){
QPixmap pixmap(":/Static/fanError.png");
pixmap = pixmap.scaled(100, 100, Qt::KeepAspectRatio);
pictureLabel->setPixmap(pixmap);
pictureLabel_2->setPixmap(pixmap);
this->setStyleSheet("QWidget#MonitorTag{background-color: #374065;border-radius: 5px;border: 3px solid;border-color: #d81e06;}");
this->setStyleSheet("QWidget#MonitorTag{background-color: rgba(55, 64, 101, 60%);border-radius: 5px;border: 3px solid;border-color: #d81e06;}");
}else if (fans.states[fan.fanCode] == QString("启动")){
QPixmap pixmap(":/Static/fanRun.png");
pixmap = pixmap.scaled(100, 100, Qt::KeepAspectRatio);
pictureLabel->setPixmap(pixmap);
pictureLabel_2->setPixmap(pixmap);
this->setStyleSheet("QWidget#MonitorTag{background-color: #374065;border-radius: 5px;border: 3px solid;border-color: #0caba2;}");
this->setStyleSheet("QWidget#MonitorTag{background-color: rgba(55, 64, 101, 60%);border-radius: 5px;border: 3px solid;border-color: #0caba2;}");
}

@ -38,10 +38,12 @@ public:
QPushButton *failureButton;
QPushButton *runButton;
QWidget *fillWidget;
int state;
int state;
QTimer *viewTimer;
QTimer *dataTimer;
QList<QList<MonitorTag*>> tagList;
QTimer *timer;
vector<QString> displayList;
void setupUi(QWidget *MonitorWidget)
{
@ -91,7 +93,7 @@ public:
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
verticalLayout->addWidget(scrollArea);
filterlLayout = new QHBoxLayout();
filterlLayout->setObjectName(QString::fromUtf8("filterlLayout"));
@ -132,9 +134,10 @@ public:
filterlLayout->addWidget(runButton);
filterlLayout->setContentsMargins(30, 10, 30, 30);
filterlLayout->setSpacing(50);
filterlLayout->setSpacing(150);
verticalLayout->addLayout(filterlLayout);
verticalLayout->addWidget(scrollArea);
verticalLayout->setStretch(0, 2);
verticalLayout->setStretch(1, 30);
@ -145,13 +148,22 @@ public:
QMetaObject::connectSlotsByName(MonitorWidget);
retranslateUi(MonitorWidget);
updateData();
addTag();
timer = new QTimer(MonitorWidget);
QObject::connect(timer, &QTimer::timeout, [&]() {
viewTimer = new QTimer(MonitorWidget);
QObject::connect(viewTimer, &QTimer::timeout, [&]() {
// 计时器超时时更新标签
addTag();
});
timer->start(5000);
viewTimer->start(2500);
dataTimer = new QTimer(MonitorWidget);
QObject::connect(dataTimer, &QTimer::timeout, [&]() {
// 计时器超时时更新数据
updateData();
});
dataTimer->start(2000);
interruptedButton->setCheckable(true);
normalButton->setCheckable(true);
@ -160,12 +172,12 @@ public:
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(interruptedButton, &QPushButton::clicked, this, [=](){this->updateDisplay();});
connect(normalButton, &QPushButton::clicked, this, [=](){this->updateDisplay();});
connect(standbyButton, &QPushButton::clicked, this, [=](){this->updateDisplay();});
connect(hutdownButton, &QPushButton::clicked, this, [=](){this->updateDisplay();});
connect(failureButton, &QPushButton::clicked, this, [=](){this->updateDisplay();});
connect(runButton, &QPushButton::clicked, this, [=](){this->updateDisplay();});
// connect(exchangeButton, &QPushButton::clicked, this, [=](){this->exchangeClicked();});
@ -210,7 +222,6 @@ public:
void addTag()
{
httpClient.getFanList();
map allFans = fans.allFans;
// 获取与 clicked() 信号相关的接收器数量
@ -265,23 +276,31 @@ public:
}
void updateData(){
httpClient.getFanList();
}
void setButtonMes(){
interruptedButton->setText(QString("通讯中断 ") + QString::number(fans.interruptedFans.size()));
normalButton->setText(QString("正常运行 ") + QString::number(fans.normalFans.size()));
standbyButton->setText(QString("待机等风 ") + QString::number(fans.standbyFans.size()));
hutdownButton->setText(QString("停机维护 ") + QString::number(fans.hutdownFans.size()));
failureButton->setText(QString("故障停机 ") + QString::number(fans.interruptedFans.size()));
runButton->setText(QString("启动 ") + QString::number(fans.runFans.size()));
interruptedButton->setText(QString("通讯中断 %1/%2").arg(fans.interruptedFans.size()).arg(fans.allFans.size()));
normalButton->setText(QString("正常运行 %1/%2").arg(fans.normalFans.size()).arg(fans.allFans.size()));
standbyButton->setText(QString("待机等风 %1/%2").arg(fans.standbyFans.size()).arg(fans.allFans.size()));
hutdownButton->setText(QString("停机维护 %1/%2").arg(fans.hutdownFans.size()).arg(fans.allFans.size()));
failureButton->setText(QString("故障停机 %1/%2").arg(fans.interruptedFans.size()).arg(fans.allFans.size()));
runButton->setText(QString("启动 %1/%2").arg(fans.runFans.size()).arg(fans.allFans.size()));
}
bool shouldDisplay(QString FanCode){
vector<QString> 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(isInitState()){
return true;
}
if (std::find(displayList.begin(), displayList.end(), FanCode) != displayList.end()) {
return true;
}else{
return false;
}
}
bool isInitState(){
if (!interruptedButton->isChecked()
&& !normalButton->isChecked()
&& !standbyButton->isChecked()
@ -289,14 +308,22 @@ public:
&& !failureButton->isChecked()
&& !runButton->isChecked()){
return true;
}
if (std::find(displayList.begin(), displayList.end(), FanCode) != displayList.end()) {
return true;
}else{
return false;
}
}
void updateDisplay(){
displayList.clear();
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());}
addTag();
}
MonitorWidget()
{
setupUi(this);

@ -7,7 +7,7 @@ QMainWindow#MainWindow{
QWidget#MonitorTag{
background-color: #374065;
background-color: #1D82D2;
border-radius: 5px;
border: 3px solid;
border-color: #1E6C92;
@ -45,6 +45,11 @@ QLabel#nameLabel{
}
QLabel#infoLabel{
font-size: 23px;
}
QComboBox{
font-family: Microsoft YaHei;
@ -74,10 +79,10 @@ QPushButton#ClearanceButton, QPushButton#FlangeButton, QPushButton#GyroscopeButt
QPushButton#monitorButton, QPushButton#flangeButton, QPushButton#clearanceButton, QPushButton#gyroscopeButton{
color: white;
background-color: rgba(16,68,105, 80%);
border-radius: 5px;
border: 3px solid;
border-color: #115C8E;
background-color: rgba(16,68,105, 0%);
/*border-radius: 5px;*/
/*border: 3px solid;*/
/*border-color: #115C8E;*/
height: 30px;
font-family: Microsoft YaHei;
font-weight: bold;
@ -88,11 +93,12 @@ QPushButton#monitorButton, QPushButton#flangeButton, QPushButton#clearanceButton
QPushButton#monitorButton:checked, QPushButton#flangeButton:checked, QPushButton#clearanceButton:checked, QPushButton#gyroscopeButton:checked{
color: white;
background-color: rgba(16,68,105, 80%);;
border-radius: 5px;
border: 3px solid;
border-color: #ffffff;
background-color: rgba(16,68,105, 0%);
border-radius: 0px;
border-bottom: 3px solid;
border-color: #1D82D2;
height: 30px;
width: 50px;
font-family: Microsoft YaHei;
font-weight: bold;
font-size: 20px;
@ -101,7 +107,7 @@ QPushButton#monitorButton:checked, QPushButton#flangeButton:checked, QPushButton
QPushButton#normalButton, QPushButton#standbyButton, QPushButton#hutdownButton, QPushButton#failureButton, QPushButton#runButton, QPushButton#interruptedButton{
background-color: rgba(16,68,105, 80%);
background-color: rgba(16,68,105, 0%);
color: white;
height: 35px;
border: none;
@ -138,6 +144,8 @@ QListView#deviceList, QListView#flangeList{
color: white;
border-radius: 10px;
border-color: #175E88;
font-family: Microsoft YaHei;
font-size: 20px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

@ -1,8 +1,9 @@

#include "MainWindow.h"
#include "./LoginUI/Login.h"
#include <QApplication>
#include <QFile>
#include <QDebug>
int main(int argc, char *argv[])
@ -12,6 +13,7 @@ int main(int argc, char *argv[])
QFile styleFile(":/Static/DamQSS.Qss");
styleFile.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(styleFile.readAll());
qDebug() << styleSheet;
app.setStyleSheet(styleSheet);
MainWindow w;

Loading…
Cancel
Save