127 lines
3.9 KiB
C++
127 lines
3.9 KiB
C++
#include "LaunchPage.h"
|
|
#include "ui_LaunchPage.h"
|
|
#include <Pages/P00_PublicPage.h>
|
|
#include <GlobalDefinitions/Variable.h>
|
|
#include <FileOperation/ConfigFiles.h>
|
|
#if CONFIG_EN_SUB_THREAD //是否开启子进程
|
|
#include <Threads/SubThread.h>
|
|
SubThread LP_ST;
|
|
#endif
|
|
LaunchPage::LaunchPage(QWidget *parent)
|
|
: QWidget(parent)
|
|
, ui(new Ui::LaunchPage)
|
|
{
|
|
ui->setupUi(this);
|
|
setWindowFlag(Qt::FramelessWindowHint); // 设置窗口无边框,设置后窗口无法移动
|
|
setAttribute(Qt::WA_TranslucentBackground, true);
|
|
TrayIconInit();
|
|
WinInit();
|
|
#if CONFIG_EN_SUB_THREAD //是否开启子进程
|
|
LP_ST.start();
|
|
#endif
|
|
}
|
|
|
|
LaunchPage::~LaunchPage()
|
|
{
|
|
#if CONFIG_EN_SUB_THREAD //是否开启子进程
|
|
LP_ST.KillThread();
|
|
#endif
|
|
delete ui;
|
|
}
|
|
void LaunchPage::TrayIconInit()
|
|
{
|
|
//托盘初始化
|
|
QIcon icon = QIcon("logo.png");
|
|
trayIcon = new QSystemTrayIcon(this);
|
|
trayIcon->setIcon(icon);
|
|
trayIcon->setToolTip("郑煤机-掘锚一体机");
|
|
trayIcon->show(); //必须调用,否则托盘图标不显示
|
|
|
|
//创建菜单项动作(以下动作只对windows有效)
|
|
minimizeAction = new QAction("隐藏", this);
|
|
connect(minimizeAction, SIGNAL(triggered()), this, SLOT(
|
|
hide()
|
|
)); //绑定信号槽
|
|
|
|
restoreAction = new QAction("还原", this);
|
|
connect(restoreAction, SIGNAL(triggered()), this, SLOT(
|
|
showNormal()
|
|
));
|
|
|
|
|
|
quitAction = new QAction("退出", this);
|
|
connect(quitAction, &QAction::triggered, this, [this]() {
|
|
// 退出应用程序
|
|
qApp->quit();
|
|
});
|
|
|
|
|
|
//创建托盘菜单(必须先创建动作,后添加菜单项,还可以加入菜单项图标美化)
|
|
trayIconMenu = new QMenu(this);
|
|
trayIconMenu->addAction(minimizeAction);
|
|
trayIconMenu->addAction(restoreAction);
|
|
trayIconMenu->addSeparator();
|
|
trayIconMenu->addAction(quitAction);
|
|
trayIcon->setContextMenu(trayIconMenu);
|
|
|
|
|
|
// connect(trayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
|
// this,SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
|
|
|
|
}
|
|
void LaunchPage::WinInit(){
|
|
|
|
|
|
|
|
|
|
|
|
qDebug()<<"正在出初始化!";
|
|
P00_PublicPage* PubPage = new P00_PublicPage();
|
|
qDebug()<<"PubPage"<<PubPage;
|
|
this->hide();
|
|
PubPage->show();
|
|
|
|
QList<QStringList> FileData = ConfigFiles().ReadFile_Csv("./ProgramConfig/UI_报警内容文本_配置.csv");
|
|
for (int row = 1; row < FileData.size()-1; ++row)
|
|
{
|
|
bool ok1,ok2;
|
|
uint8_t Dev = FileData.at(row)[0].toUInt(&ok1, 16);
|
|
uint8_t Index = FileData.at(row)[1].toUInt(&ok2, 16);
|
|
//qDebug()<<Dev<<Index;
|
|
AlarmText[Dev][Index].TextColor = FileData.at(row)[2];
|
|
AlarmText[Dev][Index].AlarmText = FileData.at(row)[3] + "->" + FileData.at(row)[4];
|
|
AlarmText[Dev][Index].Troubleshoot = FileData.at(row)[5];
|
|
}
|
|
|
|
gPageName["P01"] = "主预览";
|
|
gPageName["P02"] = "屏蔽条件";
|
|
gPageName["P301"] = "油泵设备";
|
|
gPageName["P401"] = "截割设备";
|
|
gPageName["P501"] = "装载设备";
|
|
gPageName["P601"] = "运输设备";
|
|
gPageName["P07"] = "备用设备";
|
|
gPageName["P08"] = "故障记录";
|
|
gPageName["P09"] = "遥控测试";
|
|
gPageName["P10"] = "自动智能";
|
|
gPageName["P11"] = "绝缘检测";
|
|
gPageName["P12.00"] = "网络拓扑";
|
|
gPageName["P12.01"] = "硬件IO 1";
|
|
gPageName["P12.02"] = "硬件IO 2";
|
|
gPageName["P12.03"] = "硬件IO 3";
|
|
gPageName["P12.04"] = "硬件IO 4";
|
|
gPageName["P12.05"] = "硬件IO 3";
|
|
gPageName["P12.06"] = "操作箱 1";
|
|
gPageName["P12.07"] = "操作箱 2";
|
|
gPageName["P12.08"] = "操作箱 3";
|
|
gPageName["P12.09"] = "操作箱 4";
|
|
gPageName["P13"] = "本地控制";
|
|
gPageName["P14"] = "随机图册";
|
|
gPageName["P15"] = "参数设置";
|
|
gPageName["P16"] = "系统设置";
|
|
|
|
gPageIndexStr = "P01";
|
|
|
|
// 创建实例(建议全局唯一)
|
|
ttsManager = new TTSManager(this);
|
|
}
|