You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
8.3 KiB
C

2 years ago
#include <QtCore/QVariant>
2 years ago
#include <QtGui/QIcon>
#include <QtWidgets/QApplication>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QStackedWidget>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
2 years ago
#include <QtWidgets/QSplitter>
2 years ago
2 years ago
#include "./MonitorUI/MonitorUI.h"
#include "./AnalyticUI/ClearanceAnalyticUI.h"
#include "./AnalyticUI/FlangeAnalyticUI.h"
#include "./AnalyticUI/GyroscopeAnalyticUI.h"
2 years ago
#pragma execution_character_set("utf-8")
2 years ago
2 years ago
class MainWindow:public QMainWindow
{
public:
QWidget *centralwidget;
QVBoxLayout *verticalLayout;
QWidget *titleWidget;
QHBoxLayout *horizontalLayout;
QSpacerItem *horizontalSpacer;
QPushButton *minButton;
QPushButton *closeButton;
QHBoxLayout *tabLayout;
QPushButton *monitorButton;
QPushButton *flangeButton;
QPushButton *clearanceButton;
QPushButton *gyroscopeButton;
QStackedWidget *stackedWidget;
2 years ago
MonitorWidget* monitorPage;
ClearanceAnalyticWidget *clearancePage;
FlangeAnalyticWidget* flangePage;
GyroscopeAnalyticWidget *gyroscopePage;
2 years ago
QTimer *curTimer;
2 years ago
2 years ago
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->resize(1920, 1080);
centralwidget = new QWidget(MainWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
verticalLayout = new QVBoxLayout(centralwidget);
verticalLayout->setSpacing(0);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
titleWidget = new QWidget(centralwidget);
titleWidget->setObjectName(QString::fromUtf8("titleWidget"));
horizontalLayout = new QHBoxLayout(titleWidget);
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
2 years ago
horizontalLayout->setContentsMargins(0, 0, 10, 20);
2 years ago
horizontalLayout->setSpacing(5);
2 years ago
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
horizontalLayout->addItem(horizontalSpacer);
minButton = new QPushButton(titleWidget);
minButton->setObjectName(QString::fromUtf8("minButton"));
QIcon icon;
icon.addFile(QString::fromUtf8(":/Static/min.png"), QSize(), QIcon::Normal, QIcon::On);
minButton->setIcon(icon);
horizontalLayout->addWidget(minButton);
closeButton = new QPushButton(titleWidget);
closeButton->setObjectName(QString::fromUtf8("closeButton"));
QIcon icon1;
icon1.addFile(QString::fromUtf8(":/Static/close.png"), QSize(), QIcon::Normal, QIcon::On);
closeButton->setIcon(icon1);
horizontalLayout->addWidget(closeButton);
verticalLayout->addWidget(titleWidget);
tabLayout = new QHBoxLayout();
tabLayout->setObjectName(QString::fromUtf8("tabLayout"));
2 years ago
tabLayout->setContentsMargins(20, 0, 20, 20);
tabLayout->addStretch();
2 years ago
2 years ago
monitorButton = new QPushButton(centralwidget);
monitorButton->setObjectName(QString::fromUtf8("monitorButton"));
tabLayout->addWidget(monitorButton);
flangeButton = new QPushButton(centralwidget);
flangeButton->setObjectName(QString::fromUtf8("flangeButton"));
2 years ago
tabLayout->addStretch();
2 years ago
tabLayout->addWidget(flangeButton);
clearanceButton = new QPushButton(centralwidget);
clearanceButton->setObjectName(QString::fromUtf8("clearanceButton"));
2 years ago
tabLayout->addStretch();
2 years ago
tabLayout->addWidget(clearanceButton);
gyroscopeButton = new QPushButton(centralwidget);
gyroscopeButton->setObjectName(QString::fromUtf8("gyroscopeButton"));
2 years ago
tabLayout->addStretch();
2 years ago
tabLayout->addWidget(gyroscopeButton);
2 years ago
tabLayout->addStretch();
2 years ago
stackedWidget = new QStackedWidget(centralwidget);
stackedWidget->setObjectName(QString::fromUtf8("stackedWidget"));
2 years ago
monitorPage = new MonitorWidget();
2 years ago
monitorPage->setObjectName(QString::fromUtf8("monitorPage"));
stackedWidget->addWidget(monitorPage);
2 years ago
flangePage = new FlangeAnalyticWidget(monitorPage);
2 years ago
flangePage->setObjectName(QString::fromUtf8("flangePage"));
stackedWidget->addWidget(flangePage);
2 years ago
clearancePage = new ClearanceAnalyticWidget(monitorPage);
2 years ago
clearancePage->setObjectName(QString::fromUtf8("clearancePage"));
stackedWidget->addWidget(clearancePage);
2 years ago
gyroscopePage = new GyroscopeAnalyticWidget(monitorPage);
2 years ago
gyroscopePage->setObjectName(QString::fromUtf8("gyroscopePage"));
stackedWidget->addWidget(gyroscopePage);
verticalLayout->addWidget(stackedWidget);
2 years ago
verticalLayout->addLayout(tabLayout);
2 years ago
verticalLayout->setStretch(0, 2);
2 years ago
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);
2 years ago
MainWindow->setCentralWidget(centralwidget);
2 years ago
setButtonMes();
2 years ago
2 years ago
// ???e?????????????
2 years ago
2 years ago
connect(closeButton, &QPushButton::clicked, MainWindow, &QMainWindow::close);
2 years ago
// ??????????
2 years ago
MainWindow->setWindowFlags(Qt::FramelessWindowHint);
2 years ago
curTimer = monitorPage->viewTimer;
2 years ago
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
2 years ago
void setButtonMes()
2 years ago
{
2 years ago
monitorButton->setText(QString("监控总览"));
flangeButton->setText(QString("法兰分析"));
clearanceButton->setText(QString("净空区域"));
gyroscopeButton->setText(QString("陀螺仪监测"));
2 years ago
2 years ago
connect(monitorButton, &QPushButton::clicked, this, [=](){curTimer->stop(); curTimer = monitorPage->viewTimer; curTimer->start(2500); this->stackedWidget->setCurrentIndex(0); });
connect(flangeButton, &QPushButton::clicked, this, [=](){curTimer->stop(); curTimer = flangePage->timer; curTimer->start(2500); this->stackedWidget->setCurrentIndex(1); });
connect(clearanceButton, &QPushButton::clicked, this, [=](){curTimer->stop(); curTimer = clearancePage->timer; curTimer->start(2500); this->stackedWidget->setCurrentIndex(2); });
connect(gyroscopeButton, &QPushButton::clicked, this, [=](){curTimer->stop(); curTimer = gyroscopePage->timer; curTimer->start(2500); this->stackedWidget->setCurrentIndex(3); });
2 years ago
2 years ago
// connect(flangeButton, &QPushButton::clicked, this, [=](){this->flangePage->addDevice(); });
// connect(clearanceButton, &QPushButton::clicked, this, [=](){this->clearancePage->addDevice(); });
// connect(gyroscopeButton, &QPushButton::clicked, this, [=](){this->gyroscopePage->addDevice(); });
2 years ago
connect(monitorButton, &QPushButton::clicked, this, [=](){this->clearButton();});
connect(flangeButton, &QPushButton::clicked, this, [=](){this->clearButton();});
connect(clearanceButton, &QPushButton::clicked, this, [=](){this->clearButton();});
connect(gyroscopeButton, &QPushButton::clicked, this, [=](){this->clearButton();});
connect(monitorButton, &QPushButton::clicked, this, [=](){monitorButton->setChecked(true);});
connect(flangeButton, &QPushButton::clicked, this, [=](){flangeButton->setChecked(true);});
connect(clearanceButton, &QPushButton::clicked, this, [=](){clearanceButton->setChecked(true);});
connect(gyroscopeButton, &QPushButton::clicked, this, [=](){gyroscopeButton->setChecked(true);});
monitorButton->setCheckable(true);
flangeButton->setCheckable(true);
clearanceButton->setCheckable(true);
gyroscopeButton->setCheckable(true);
monitorButton->setChecked(true);
2 years ago
} // retranslateUi
2 years ago
void clearButton(){
monitorButton->setChecked(false);
flangeButton->setChecked(false);
clearanceButton->setChecked(false);
gyroscopeButton->setChecked(false);
}
2 years ago
MainWindow(){
this->setupUi(this);
}
2 years ago
};
2 years ago