75 lines
1.7 KiB
C++
75 lines
1.7 KiB
C++
#ifndef DLGVISCOSITYSETTING_H
|
|
#define DLGVISCOSITYSETTING_H
|
|
|
|
#include "SysPara.h"
|
|
|
|
#include <QDialog>
|
|
#include <QTimer>
|
|
|
|
/**
|
|
功能简单,不分层实现功能
|
|
在此界面设置告警阈值和关回收槽阈值
|
|
定时器连续5次检测报警,就发出对应信号
|
|
*/
|
|
|
|
namespace Ui {
|
|
class DlgViscositySetting;
|
|
}
|
|
|
|
class DlgViscositySetting : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DlgViscositySetting(QWidget *parent = 0);
|
|
~DlgViscositySetting();
|
|
|
|
void bindSysPara(SysPara *sysPara);
|
|
|
|
int getAlertValue();
|
|
int getCloseValue();
|
|
private slots:
|
|
void on_checkBtn_clicked();
|
|
|
|
private:
|
|
Ui::DlgViscositySetting *ui;
|
|
SysPara* sysPara = nullptr;
|
|
// 公共配置目录与文件名
|
|
const QString kConfDir = QStringLiteral("/home/plg/conf/");
|
|
const QString kConfFile = QStringLiteral("software_ui.ini");
|
|
// ini 中的分组与键名
|
|
const QString kGroupViscosity = QStringLiteral("Viscosity");
|
|
const QString kKeyAlertThreshold = QStringLiteral("alertThreshold");
|
|
const QString kKeyCloseThreshold = QStringLiteral("closeThreshold");
|
|
|
|
QTimer* timer = nullptr;
|
|
int visSetting = 0;
|
|
int visCurr = 0;
|
|
int closeV = 0;
|
|
int alertV = 0;
|
|
|
|
private:
|
|
void init();
|
|
void initTimer();
|
|
void loadConfig(); // 从 ini 读取
|
|
void saveConfig(); // 写入 ini
|
|
|
|
short checkClose(int visCurr, int visSetting);
|
|
short checkAlert(int visCurr, int visSetting);
|
|
private slots:
|
|
void onTimeOut();
|
|
|
|
void on_closeBtn_clicked();
|
|
|
|
void on_sb_alert_editingFinished();
|
|
|
|
void on_sb_close_editingFinished();
|
|
|
|
signals:
|
|
// true:比设定值高 false:比设定值低
|
|
void sig_alert(bool);
|
|
void sig_close(bool);
|
|
};
|
|
|
|
#endif // DLGVISCOSITYSETTING_H
|