add linguist for facetick.
This commit is contained in:
66
Linguist/setUi/settingUIProjectSet.cpp
Normal file
66
Linguist/setUi/settingUIProjectSet.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
#include <QTime>
|
||||
#include <UiTools.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include "settingUIProjectSet.h"
|
||||
#include "settingUi.h"
|
||||
|
||||
const int settingUIProjectSet::BtnQty = settingUi::PAGE_DEV_TEST - settingUi::PAGE_INFO;
|
||||
const int settingUIProjectSet::FristPageIndex = settingUi::PAGE_INFO;
|
||||
|
||||
settingUIProjectSet::settingUIProjectSet(QWidget *parent) : MyWidgetWithSubStyleColor(parent)
|
||||
{
|
||||
qDebug() << "settingUIProjectSet()";
|
||||
//setStyleSheet(" background:rgb(240, 242, 245);");//border-width:0;border-style:outset;
|
||||
//setFixedWidth(UiConfig::GetInstance()->getUiWidth());
|
||||
|
||||
const int btnWidth = ( UiConfig::GetInstance()->getUiWidth() - 4 * nSpace ) / 3;
|
||||
const QSize btnSize(btnWidth, btnWidth);
|
||||
const QString btnsName[BtnQty] = {":/res/image/ProjectSetCheckInfo.png",
|
||||
":/res/image/ProjectSetDevMng.png",
|
||||
":/res/image/ProjectSetFaceMng.png",
|
||||
":/res/image/ProjectSetAccMng.png",
|
||||
":/res/image/ProjectSetReco.png",
|
||||
":/res/image/ProjectSetSysMng.png",
|
||||
":/res/image/ProjectSetFastCfg.png",
|
||||
":/res/image/ProjectSetNetwork.png"
|
||||
};
|
||||
QGridLayout* pLayout = new QGridLayout();
|
||||
m_pPushBtns = new QPushButton[BtnQty];
|
||||
int col = 0;
|
||||
|
||||
for(int i = 0; i < BtnQty; i ++){
|
||||
m_pPushBtns[i].setParent(this);
|
||||
settingUi* setUi = dynamic_cast<settingUi*>(parent);
|
||||
if(setUi){
|
||||
setPushButton(&m_pPushBtns[i], (*setUi)[static_cast<unsigned>(FristPageIndex + i)], btnsName[i], btnSize);
|
||||
pLayout->addWidget(&m_pPushBtns[i], i / 3, col++);
|
||||
if(3 == col){
|
||||
col = 0;
|
||||
}
|
||||
connect(&m_pPushBtns[i], SIGNAL(clicked()), this, SLOT(slotBtnClicked()));
|
||||
}
|
||||
else {
|
||||
qDebug() << "oooop!";
|
||||
}
|
||||
}
|
||||
pLayout->setSpacing(nSpace);
|
||||
pLayout->setMargin(0);
|
||||
|
||||
QLabel *pEmpty = new QLabel(this);
|
||||
QVBoxLayout* _VLayout = new QVBoxLayout();
|
||||
_VLayout->addLayout(pLayout,3);
|
||||
_VLayout->addWidget(pEmpty, 1);
|
||||
_VLayout->setMargin(nSpace);
|
||||
setLayout(_VLayout);
|
||||
}
|
||||
|
||||
void settingUIProjectSet::slotBtnClicked()
|
||||
{
|
||||
for(int i = 0; i <= BtnQty; i ++){
|
||||
if(sender() == &m_pPushBtns[i]){
|
||||
emit pageSetSignal(i + FristPageIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
31
Linguist/setUi/settingUIProjectSet.h
Normal file
31
Linguist/setUi/settingUIProjectSet.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef SETTINGUIPROJECTSET_H
|
||||
#define SETTINGUIPROJECTSET_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "UiTools.h"
|
||||
#include "UiConfig.h"
|
||||
|
||||
class settingUIProjectSet : public MyWidgetWithSubStyleColor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static constexpr int itemHeight = UiConfig::SETTING_PAGE_ITEM_HEIGHT;
|
||||
static constexpr int nSpace = UiConfig::SETTING_PAGE_WIDGET_TO_FRAME;
|
||||
|
||||
public:
|
||||
explicit settingUIProjectSet(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void pageSetSignal(int nIndex, const QString = "");
|
||||
|
||||
public slots:
|
||||
void slotBtnClicked();
|
||||
|
||||
private:
|
||||
static const int BtnQty;
|
||||
static const int FristPageIndex;
|
||||
QPushButton *m_pPushBtns;
|
||||
};
|
||||
|
||||
#endif // SETTINGUIPROJECTSET_H
|
577
Linguist/setUi/settingUi.cpp
Normal file
577
Linguist/setUi/settingUi.cpp
Normal file
@ -0,0 +1,577 @@
|
||||
#include "settingUi.h"
|
||||
#include <QDebug>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPalette>
|
||||
#include <QPainter>
|
||||
#include <QGridLayout>
|
||||
#include <QTimer>
|
||||
#include <QBitmap>
|
||||
|
||||
#include "UiTools.h"
|
||||
#include "UiConfig.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
settingUiTop::settingUiTop(QWidget *parent) : MyWidgetWithMainStyleColor(parent)
|
||||
{
|
||||
qDebug() << "settingUiTop()";
|
||||
|
||||
QPalette palette(this->palette());
|
||||
palette.setColor(QPalette::WindowText,Qt::black);
|
||||
|
||||
m_label_ip = new QLabel(this);
|
||||
//m_label_ip->setText("IP:192.168.10.106");
|
||||
//m_label_ip->setMinimumSize(60, 30);
|
||||
m_label_ip->setPalette(palette);
|
||||
//IP项去掉,需求不要求
|
||||
m_label_ip->hide();
|
||||
|
||||
m_label_time = new QLabel(this);
|
||||
// m_label_time->setText("10:12");
|
||||
m_label_time->setPalette(palette);
|
||||
_timerUpdate = new TimerUpdate(m_label_time, this);
|
||||
|
||||
m_btn_back = new QPushButton(this);
|
||||
setButtonBackImage(m_btn_back, ":res/image/ProjectSet_return.png", 20, 40);
|
||||
m_btn_back->setFixedWidth(UiConfig::GetInstance()->getUiWidth() / 10);
|
||||
//m_btn_back->setStyleSheet("QPushButton:focus{outline: none;}");
|
||||
m_btn_back->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
m_label_pageMsg = new QLabel(this);
|
||||
m_label_pageMsg->setText("this is page title");
|
||||
m_label_pageMsg->setPalette(palette);
|
||||
m_label_pageMsg->setAlignment(Qt::AlignCenter);
|
||||
m_label_pageMsg->setMinimumWidth(UiConfig::GetInstance()->getUiWidth() / 3);
|
||||
QFont ft;
|
||||
ft.setPointSize(UiConfig::GetInstance()->getGlobalFontSize());
|
||||
m_label_pageMsg->setFont(ft);
|
||||
|
||||
m_btn_rightSide = new QPushButton(this);
|
||||
m_btn_rightSide->setFocusPolicy(Qt::NoFocus);
|
||||
m_btn_rightSide->setStyleSheet("color:blue;"
|
||||
"background-color: transparent;"
|
||||
"border:none;");
|
||||
m_btn_rightSide->hide();
|
||||
|
||||
QHBoxLayout* hbLayout_top = new QHBoxLayout();
|
||||
hbLayout_top->addWidget(m_label_ip, 1, Qt::AlignLeft);
|
||||
hbLayout_top->addWidget(m_label_time, 1, Qt::AlignRight);
|
||||
|
||||
QHBoxLayout* hbLayoutMid = new QHBoxLayout();
|
||||
hbLayoutMid->addWidget(m_btn_back, 1, Qt::AlignLeft);
|
||||
//hbLayoutMid->addWidget(m_label_pageMsg, 100, Qt::AlignCenter);
|
||||
hbLayoutMid->addWidget(m_btn_rightSide, 1, Qt::AlignRight);
|
||||
|
||||
QVBoxLayout* vbLayout = new QVBoxLayout();
|
||||
vbLayout->addLayout(hbLayout_top);
|
||||
vbLayout->addLayout(hbLayoutMid);
|
||||
vbLayout->setContentsMargins(20, 10, 0, 10);
|
||||
setLayout(vbLayout);
|
||||
|
||||
//setStyleSheet("border-bottom: 3px solid #DFDDEB;");
|
||||
connect(m_btn_back, SIGNAL(clicked(bool)), this, SIGNAL(signalReturnBtnClicked()));
|
||||
connect(m_btn_rightSide, SIGNAL(clicked(bool)), this, SIGNAL(signalRightSideBtnClicked()));
|
||||
}
|
||||
|
||||
settingUiTop::~settingUiTop()
|
||||
{
|
||||
qDebug() << "~settingUiTop()";
|
||||
if(nullptr != _timerUpdate){
|
||||
delete _timerUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiTop::update_Ip(const QString& str)
|
||||
{
|
||||
if(m_label_ip){
|
||||
m_label_ip->setText(str);
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiTop::setRightSideBtn(bool isShow, const QString btnName)
|
||||
{
|
||||
m_btn_rightSide->setText(btnName);
|
||||
m_btn_rightSide->setVisible(isShow);
|
||||
}
|
||||
|
||||
void settingUiTop::slotShowPageMsg(const QString& msg)
|
||||
{
|
||||
//qDebug() << "slotShowPageMsg:" << msg;
|
||||
m_label_pageMsg->setText(msg);
|
||||
m_label_pageMsg->move((UiConfig::GetInstance()->getUiWidth() - m_label_pageMsg->width()) / 2,
|
||||
static_cast<int>(UiConfig::GetInstance()->getUiHeight() * 0.05));
|
||||
}
|
||||
|
||||
void settingUi::showPage(int nIndex, const QString& title)
|
||||
{
|
||||
qDebug() << "showPage:" << nIndex;
|
||||
if( (PAGE_PROJECT > nIndex ) || ( nIndex >= PAGE_MAX ) )
|
||||
{
|
||||
qDebug()<<"page index error : " << nIndex;
|
||||
return;
|
||||
}
|
||||
if(m_stack_setPage->currentIndex() == nIndex){
|
||||
qDebug() << "same setting page!";
|
||||
return;
|
||||
}
|
||||
|
||||
//控制条右侧按钮存在与否
|
||||
if(m_map_rightBtnName.contains(nIndex))
|
||||
{
|
||||
m_ctlBar->setRightSideBtn(true, m_map_rightBtnName[nIndex]);
|
||||
}else
|
||||
{
|
||||
m_ctlBar->setRightSideBtn(false);
|
||||
}
|
||||
|
||||
bool needReset = nIndex > m_stack_setPage->currentIndex();
|
||||
if(nIndex == PAGE_DEV_MNG || nIndex == PAGE_DEV_MNG_BT_SPK || nIndex == PAGE_DEV_MNG_BT_LOCK || nIndex == PAGE_FACE_MNG)
|
||||
{//设备管理页面和蓝牙页面,回退时也reset
|
||||
needReset = true;
|
||||
}
|
||||
//qDebug() << "needReset:" << needReset << "nIndex:" << nIndex;
|
||||
|
||||
m_stack_setPage->setCurrentIndex(nIndex);
|
||||
QCoreApplication::processEvents();
|
||||
m_onIndexPage = (PAGE_PROJECT == nIndex);
|
||||
emit signalShowPageMsg(title);
|
||||
if(needReset){
|
||||
switch(nIndex){
|
||||
case PAGE_INFO:
|
||||
m_infoPage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG:
|
||||
m_devMngPage->reset();
|
||||
break;
|
||||
case PAGE_FACE_MNG:
|
||||
m_faceMngPage->reset();
|
||||
break;
|
||||
case PAGE_ACCESS_MNG:
|
||||
m_accMngPage->reset();
|
||||
break;
|
||||
case PAGE_RECO:
|
||||
m_recoSetPage->reset();
|
||||
break;
|
||||
case PAGE_SYS_MNG:
|
||||
m_sysMngPage->reset();
|
||||
break;
|
||||
case PAGE_FAST_CFG_WIRE_NET:
|
||||
m_fastCfgWireNet->reset();
|
||||
break;
|
||||
case PAGE_DEV_TEST:
|
||||
m_devTestPage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_TIME:
|
||||
m_devMngTimePage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_NETWORK:
|
||||
m_devMngNetworkPage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_NET_WIRE:
|
||||
m_devMngNetWirePage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_NET_WIFI:
|
||||
m_devMngNetWifiPage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_NET_WIFI_ACC_POINT:
|
||||
m_devMngNetWifiAccPointPage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_NET_4G:
|
||||
m_devMngNet4GPage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_BT:
|
||||
m_devMngBtPage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_BT_SPK:
|
||||
m_devMngBtSpkPage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_BT_SPK_ACC_POINT:
|
||||
m_devMngBtSpkAccPointPage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_BT_LOCK:
|
||||
m_devMngBtLockPage->reset();
|
||||
break;
|
||||
case PAGE_DEV_MNG_BT_LOCK_ACC_POINT:
|
||||
m_devMngBtLockAccPointPage->reset();
|
||||
break;
|
||||
case PAGE_FACE_MNG_FACE:
|
||||
m_faceMngFacePage->reset();
|
||||
break;
|
||||
case PAGE_FACE_MNG_ACCESS_RECORD:
|
||||
m_faceMngAccRedPage->reset();
|
||||
break;
|
||||
case PAGE_FACE_MNG_ADD_PERSON:
|
||||
m_addPersonPage->reset();
|
||||
break;
|
||||
case PAGE_FACE_MNG_MODIFY_PERSON:
|
||||
m_modifyPersonPage->reset();
|
||||
break;
|
||||
case PAGE_FACE_MNG_SNAP_FACE:
|
||||
m_snapFacePage->reset();
|
||||
break;
|
||||
case PAGE_FAST_CFG_PARK:
|
||||
m_fastCfgPark->reset();
|
||||
case PAGE_FAST_CFG_QRCODE:
|
||||
m_fastCfgQrcode->reset();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
qDebug() << "showPage end";
|
||||
}
|
||||
|
||||
void settingUi::slotShowPage(int nIndex, const QString title)
|
||||
{
|
||||
//qDebug() << "push index:" << m_stack_setPage->currentIndex() << "nIndex:" << nIndex;
|
||||
m_pageIndex.push(m_stack_setPage->currentIndex());
|
||||
showPage(nIndex, "" != title ? title : SetPageName[nIndex]);
|
||||
|
||||
keyboard::close();
|
||||
}
|
||||
|
||||
void settingUi::slotReturnClicked()
|
||||
{
|
||||
if(m_syncFlag){
|
||||
qDebug() << "slotReturnClicked return immediately";
|
||||
return;
|
||||
}
|
||||
m_syncFlag = true;
|
||||
|
||||
if(m_stack_setPage->currentIndex() == PAGE_FACE_MNG_ADD_PERSON ||
|
||||
m_stack_setPage->currentIndex() == PAGE_FACE_MNG_MODIFY_PERSON){
|
||||
m_backstageIf->stopIdentyState(false, true);
|
||||
}
|
||||
else if(m_stack_setPage->currentIndex() == PAGE_FAST_CFG_QRCODE){
|
||||
UiConfig::GetInstance()->setFastCfgStatus(false);
|
||||
}
|
||||
|
||||
if(m_onIndexPage){
|
||||
emit signalShowRecoPage();
|
||||
}
|
||||
else if(m_stack_setPage->currentIndex() == PAGE_DEV_TEST){
|
||||
m_stack_setPage->setCurrentIndex(PAGE_PROJECT);
|
||||
emit signalShowRecoPage();
|
||||
UiConfig::GetInstance()->setDevTestStatus(false);
|
||||
}
|
||||
else{
|
||||
if(m_pageIndex.size()){
|
||||
int pageIndex = m_pageIndex.pop();
|
||||
//qDebug() << "pop index:" << pageIndex;
|
||||
showPage(pageIndex, SetPageName[pageIndex]);
|
||||
}
|
||||
}
|
||||
keyboard::close();
|
||||
m_syncFlag = false;
|
||||
}
|
||||
|
||||
void settingUi::slotRightSideBtnClicked()
|
||||
{
|
||||
int index = m_stack_setPage->currentIndex();
|
||||
qDebug() << __PRETTY_FUNCTION__ << "currentIndex=" << index;
|
||||
switch (index) {
|
||||
case PAGE_FACE_MNG_FACE:
|
||||
m_faceMngFacePage->clickBtn_addPerson();
|
||||
break;
|
||||
case PAGE_FACE_MNG_MODIFY_PERSON:
|
||||
m_modifyPersonPage->savePersonInfo();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
settingUi::settingUi(QWidget *parent) : WidgetWithBackstageInterface(parent), m_syncFlag(false)
|
||||
{
|
||||
qDebug() << "settingUi()";
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::Background, Qt::transparent);
|
||||
setPalette(pal);
|
||||
|
||||
m_ctlBar = new settingUiTop(this);
|
||||
m_stack_setPage = new QStackedWidget(this);
|
||||
|
||||
m_pProjectSetPage = new settingUIProjectSet(this);
|
||||
int pageIndex = 1;
|
||||
m_infoPage = new settingUiInfo(pageIndex++, this);
|
||||
m_devMngPage = new settingUiDevMng(pageIndex++, this);
|
||||
m_faceMngPage = new settingUiFaceMng(pageIndex++, this);
|
||||
m_accMngPage = new settingUiAccMng(pageIndex++, this);
|
||||
m_recoSetPage = new settingUiRecoSet(pageIndex++, this);
|
||||
m_sysMngPage = new settingUiSysMng(pageIndex++, this);
|
||||
m_fastCfgWireNet = new settingUiFastCfgWireNet(pageIndex++, this);
|
||||
connect(m_fastCfgWireNet, SIGNAL(signalJumpPage(int)), this, SLOT(slotJumpPage(int)));
|
||||
|
||||
m_devMngNetworkPage = new settingUiDevMngNetwork(pageIndex++, m_devMngPage);
|
||||
connect(m_devMngNetworkPage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
m_devTestPage = new settingUiDevTest(pageIndex++, this);
|
||||
|
||||
//subPage
|
||||
m_devMngTimePage = new settingUiDevMngTime(pageIndex++, m_devMngPage);
|
||||
connect(m_devMngPage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
|
||||
m_devMngNetWirePage = new settingUiDevMngNetWire(pageIndex++, m_devMngNetworkPage);
|
||||
m_devMngNetWifiPage = new settingUiDevMngNetWifi(pageIndex++, m_devMngNetworkPage);
|
||||
m_devMngNetWifiAccPointPage = new settingUiDevMngNetWifiAccPoint(pageIndex++, m_devMngNetWifiPage);
|
||||
connect(m_devMngNetWifiPage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
connect(m_devMngNetWifiAccPointPage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
connect(m_devMngNetWifiAccPointPage, SIGNAL(signalReturn()), this, SLOT(slotReturnClicked()));
|
||||
connect(m_devMngNetWifiAccPointPage, SIGNAL(signalUpdateConnectionStatus(QString, bool)), m_devMngNetWifiPage,
|
||||
SLOT(slotUpdateConnectionStatus(QString, bool)));
|
||||
|
||||
m_devMngNet4GPage = new settingUiDevMngNet4G(pageIndex++, m_devMngNetworkPage);
|
||||
|
||||
m_devMngBtPage = new settingUiDevMngBt(pageIndex++, m_devMngPage);
|
||||
connect(m_devMngBtPage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
|
||||
m_devMngBtSpkPage = new settingUiDevMngBtSpk(pageIndex++, m_devMngPage);
|
||||
m_devMngBtSpkAccPointPage = new settingUiDevMngBtSpkAccPoint(pageIndex++, m_devMngBtSpkPage);
|
||||
connect(m_devMngBtSpkPage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
connect(m_devMngBtSpkPage, SIGNAL(signalClickSet(BluetoothDev_t)), m_devMngBtSpkAccPointPage, SLOT(setAccPointInfo(BluetoothDev_t)));
|
||||
connect(m_devMngBtSpkAccPointPage, SIGNAL(signalReturn()), this, SLOT(slotReturnClicked()));
|
||||
|
||||
m_devMngBtLockPage = new settingUiDevMngBtLock(pageIndex++, m_devMngPage);
|
||||
connect(m_devMngBtLockPage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
m_devMngBtLockAccPointPage = new settingUiDevMngBtLockAccPoint(pageIndex++, m_devMngBtLockPage);
|
||||
connect(m_devMngBtLockPage, SIGNAL(signalCurrentLock(const QString&)), m_devMngBtLockAccPointPage, SLOT(slotCurrentLock(const QString&)));
|
||||
connect(m_devMngBtLockAccPointPage, SIGNAL(signalUpdataTitle(const QString)), m_ctlBar, SLOT(slotShowPageMsg(const QString)));
|
||||
connect(m_devMngBtLockAccPointPage, SIGNAL(signalRefresh()), m_devMngBtLockPage, SLOT(slotRefresh()));
|
||||
connect(m_devMngBtLockAccPointPage, SIGNAL(signalRefresh()), this, SLOT(slotReturnClicked()));
|
||||
|
||||
m_map_rightBtnName[pageIndex] = QString(tr("添加人员"));
|
||||
m_faceMngFacePage = new FaceDbPage(pageIndex++, m_faceMngPage);
|
||||
m_faceMngAccRedPage = new AccessRecordPage(pageIndex++, m_faceMngPage);
|
||||
connect(m_faceMngPage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
connect(m_faceMngFacePage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
connect(m_devTestPage, SIGNAL(signalShowSettingUi()), parent, SLOT(slotShowSettingUi()));
|
||||
|
||||
m_addPersonPage = new AddPersonPage(pageIndex++, m_faceMngFacePage);
|
||||
m_map_rightBtnName[pageIndex] = QString(tr("保存"));
|
||||
m_modifyPersonPage = new ModifyPersonPage(pageIndex++, m_faceMngFacePage);
|
||||
m_snapFacePage = new SnapFacePage(pageIndex++, m_faceMngFacePage);
|
||||
connect(m_addPersonPage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
connect(m_modifyPersonPage, SIGNAL(signalShowPage(int, const QString)), this, SLOT(slotShowPage(int, const QString)));
|
||||
connect(m_faceMngFacePage, SIGNAL(signalPersonInfo(stQueryPersonInfo &)), m_modifyPersonPage, SLOT(slotSetPersonInfo(stQueryPersonInfo &)));
|
||||
connect(m_addPersonPage, SIGNAL(signalChangePersonDB()), m_faceMngFacePage, SLOT(slot_freshPage()));
|
||||
connect(m_modifyPersonPage, SIGNAL(signalChangePersonDB()), m_faceMngFacePage, SLOT(slot_freshPage()));
|
||||
connect(m_addPersonPage, SIGNAL(signalReturn()), this, SLOT(slotReturnClicked()));
|
||||
connect(m_modifyPersonPage, SIGNAL(signalReturn()), this, SLOT(slotReturnClicked()));
|
||||
connect(parent, SIGNAL(signalIcCardResult(const QString&)), m_addPersonPage, SLOT(slotIcCardResult(const QString&)));
|
||||
connect(parent, SIGNAL(signalIcCardResult(const QString&)), m_modifyPersonPage, SLOT(slotIcCardResult(const QString&)));
|
||||
connect(m_snapFacePage, SIGNAL(signalReturn()), this, SLOT(slotReturnClicked()));
|
||||
connect(m_snapFacePage, SIGNAL(signalSnapFace(std::string &, std::string &)), m_addPersonPage, SLOT(slotSnapFace(std::string &, std::string &)));
|
||||
|
||||
m_fastCfgPark = new settingUiFastCfgPark(pageIndex++, this);
|
||||
connect(m_fastCfgPark, SIGNAL(signalJumpPage(int)), this, SLOT(slotJumpPage(int)));
|
||||
m_fastCfgQrcode = new SettingUiQrcode(pageIndex++, this);
|
||||
connect(parent, SIGNAL(signalCenterMsg(const int, const QString&)), m_fastCfgQrcode, SLOT(slotCenterMsg(const int, const QString&)));
|
||||
connect(m_fastCfgQrcode, SIGNAL(signalExitSettingUi()), this, SLOT(slotExitSettingUi()));
|
||||
connect(parent, SIGNAL(signalQrcodeFastCfgResult(bool)), m_fastCfgQrcode, SLOT(slotQrcodeFastCfgResult(bool)));
|
||||
|
||||
m_shadowPage = nullptr;
|
||||
if(!UiConfig::GetInstance()->isRkDevice()){
|
||||
m_shadowPage = new PureColorPage(0, 128);
|
||||
}
|
||||
|
||||
#if 0 //rk test
|
||||
m_la = new QLabel();
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::Background, QColor(128, 128, 128, 128));
|
||||
m_la->setPalette(pal);
|
||||
m_la->resize(400, 680);
|
||||
m_la->setPixmap(QPixmap(":/res/image/msg_box_bg_green.png"));
|
||||
#endif
|
||||
|
||||
//add需要根据枚举定义顺序增加
|
||||
m_stack_setPage->addWidget(m_pProjectSetPage);
|
||||
m_stack_setPage->addWidget(m_infoPage);
|
||||
m_stack_setPage->addWidget(m_devMngPage);
|
||||
m_stack_setPage->addWidget(m_faceMngPage);
|
||||
m_stack_setPage->addWidget(m_accMngPage);
|
||||
m_stack_setPage->addWidget(m_recoSetPage);
|
||||
m_stack_setPage->addWidget(m_sysMngPage);
|
||||
m_stack_setPage->addWidget(m_fastCfgWireNet);
|
||||
m_stack_setPage->addWidget(m_devMngNetworkPage);
|
||||
|
||||
m_stack_setPage->addWidget(m_devTestPage);
|
||||
|
||||
m_stack_setPage->addWidget(m_devMngTimePage);
|
||||
m_stack_setPage->addWidget(m_devMngNetWirePage);
|
||||
m_stack_setPage->addWidget(m_devMngNetWifiPage);
|
||||
m_stack_setPage->addWidget(m_devMngNetWifiAccPointPage);
|
||||
m_stack_setPage->addWidget(m_devMngNet4GPage);
|
||||
m_stack_setPage->addWidget(m_devMngBtPage);
|
||||
m_stack_setPage->addWidget(m_devMngBtSpkPage);
|
||||
m_stack_setPage->addWidget(m_devMngBtSpkAccPointPage);
|
||||
m_stack_setPage->addWidget(m_devMngBtLockPage);
|
||||
m_stack_setPage->addWidget(m_devMngBtLockAccPointPage);
|
||||
|
||||
m_stack_setPage->addWidget(m_faceMngFacePage);
|
||||
m_stack_setPage->addWidget(m_faceMngAccRedPage);
|
||||
|
||||
m_stack_setPage->addWidget(m_addPersonPage);
|
||||
m_stack_setPage->addWidget(m_modifyPersonPage);
|
||||
m_stack_setPage->addWidget(m_snapFacePage);
|
||||
|
||||
m_stack_setPage->addWidget(m_fastCfgPark);
|
||||
m_stack_setPage->addWidget(m_fastCfgQrcode);
|
||||
|
||||
m_stack_setPage->setCurrentIndex(PAGE_PROJECT);
|
||||
|
||||
m_onIndexPage = true;
|
||||
|
||||
QVBoxLayout* vbLayout = new QVBoxLayout();
|
||||
vbLayout->addWidget(m_ctlBar, 1);
|
||||
vbLayout->addWidget(m_stack_setPage, 99);
|
||||
vbLayout->setSpacing(0);
|
||||
vbLayout->setMargin(0);
|
||||
setLayout(vbLayout);
|
||||
|
||||
connect(m_ctlBar, SIGNAL(signalReturnBtnClicked()), this, SLOT(slotReturnClicked()));
|
||||
connect(this, SIGNAL(signalShowPageMsg(QString)), m_ctlBar, SLOT(slotShowPageMsg(QString)));
|
||||
connect(m_ctlBar, SIGNAL(signalRightSideBtnClicked()), this, SLOT(slotRightSideBtnClicked()));
|
||||
|
||||
connect(m_pProjectSetPage, SIGNAL(pageSetSignal(int, const QString)), this, SLOT(slotShowPage(int, const QString)) );
|
||||
|
||||
connect(parent, SIGNAL(signalDevTestMesAddrAndProdNoText(const QString&)), m_devTestPage, SLOT(slotDevTestMesAddrAndProdNoText(const QString&)));
|
||||
connect(parent, SIGNAL(signalDevTestPcbSeqText(const QString&)), m_devTestPage, SLOT(slotDevTestPcbSeqText(const QString&)));
|
||||
connect(parent, SIGNAL(signalDevTestConfigInfo(const QString&)), m_devTestPage, SLOT(slotDevTestConfigInfo(const QString&)));
|
||||
qDebug() << "setting ui created!";
|
||||
}
|
||||
|
||||
settingUi::~settingUi()
|
||||
{
|
||||
qDebug() << "~settingUi()";
|
||||
}
|
||||
|
||||
void settingUi::setBackstageUiinterface(BackstageInterfaceForUi* interface)
|
||||
{
|
||||
m_backstageIf = interface;
|
||||
m_infoPage->setBackstageUiinterface(interface);qDebug() << "infoPage reset";
|
||||
m_devMngPage->setBackstageUiinterface(interface);qDebug() << "devMngPage reset";
|
||||
m_faceMngPage->setBackstageUiinterface(interface);
|
||||
m_accMngPage->setBackstageUiinterface(interface);
|
||||
m_recoSetPage->setBackstageUiinterface(interface);
|
||||
m_sysMngPage->setBackstageUiinterface(interface);
|
||||
m_fastCfgWireNet->setBackstageUiinterface(interface);
|
||||
m_devTestPage->setBackstageUiinterface(interface);
|
||||
|
||||
m_devMngTimePage->setBackstageUiinterface(interface);
|
||||
m_devMngNetworkPage->setBackstageUiinterface(interface);
|
||||
m_devMngNetWirePage->setBackstageUiinterface(interface);
|
||||
m_devMngNetWifiPage->setBackstageUiinterface(interface);
|
||||
m_devMngNetWifiAccPointPage->setBackstageUiinterface(interface);
|
||||
m_devMngNet4GPage->setBackstageUiinterface(interface);
|
||||
m_devMngBtPage->setBackstageUiinterface(interface);
|
||||
m_devMngBtSpkPage->setBackstageUiinterface(interface);
|
||||
m_devMngBtSpkAccPointPage->setBackstageUiinterface(interface);
|
||||
m_devMngBtLockPage->setBackstageUiinterface(interface);
|
||||
m_devMngBtLockAccPointPage->setBackstageUiinterface(interface);
|
||||
|
||||
m_faceMngFacePage->setBackstageUiinterface(interface);
|
||||
m_faceMngAccRedPage->setBackstageUiinterface(interface);
|
||||
|
||||
m_addPersonPage->setBackstageUiinterface(interface);
|
||||
m_modifyPersonPage->setBackstageUiinterface(interface);
|
||||
m_snapFacePage->setBackstageUiinterface(interface);
|
||||
|
||||
m_fastCfgPark->setBackstageUiinterface(interface);
|
||||
m_fastCfgQrcode->setBackstageUiinterface(interface);
|
||||
reset();
|
||||
}
|
||||
|
||||
void settingUi::slotShowAddFacePage()
|
||||
{
|
||||
//slotShowPage(PAGE_IMAGE);
|
||||
}
|
||||
|
||||
void settingUi::slotRestoreFactory()
|
||||
{
|
||||
if(m_backstageIf){
|
||||
m_backstageIf->recoveryFactorySetting();
|
||||
}
|
||||
}
|
||||
|
||||
void settingUi::slotShowShadowPage(bool show)
|
||||
{
|
||||
if(show){
|
||||
if(m_shadowPage){
|
||||
m_shadowPage->show();
|
||||
}
|
||||
//m_la->show();
|
||||
}
|
||||
else {
|
||||
if(m_shadowPage){
|
||||
m_shadowPage->hide();
|
||||
}
|
||||
//m_la->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void settingUi::slotShowDevTestPage()
|
||||
{
|
||||
showPage(PAGE_DEV_TEST, SetPageName[PAGE_DEV_TEST]);
|
||||
}
|
||||
|
||||
void settingUi::slotJumpPage(int pageIndex)
|
||||
{
|
||||
const QObject* send = sender();
|
||||
if(send == m_fastCfgWireNet){
|
||||
qDebug() << "fastCfgWireNet:" << pageIndex;
|
||||
m_pageIndex.push(m_stack_setPage->currentIndex());
|
||||
const int index = pageIndex + settingUiFastCfgPark::m_pageIndex;
|
||||
showPage(index, SetPageName[index]);
|
||||
}
|
||||
else if(send == m_fastCfgPark){
|
||||
qDebug() << "m_fastCfgPark:" << pageIndex;
|
||||
m_pageIndex.push(m_stack_setPage->currentIndex());
|
||||
const int index = pageIndex + SettingUiQrcode::m_pageIndex;
|
||||
showPage(index, SetPageName[index]);
|
||||
UiConfig::GetInstance()->setFastCfgStatus(true);
|
||||
}
|
||||
}
|
||||
|
||||
void settingUi::slotExitSettingUi()
|
||||
{
|
||||
m_stack_setPage->setCurrentWidget(m_pProjectSetPage);
|
||||
m_pageIndex.clear();
|
||||
m_syncFlag = false;
|
||||
emit signalShowRecoPage();
|
||||
UiConfig::GetInstance()->setFastCfgStatus(false);
|
||||
}
|
||||
|
||||
void settingUi::update_IpBar()
|
||||
{
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
const int nSize = 128;
|
||||
char buf[nSize] = "";
|
||||
int type;
|
||||
m_backstageIf->getIP(buf, nSize, type);
|
||||
QString ipStr = buf;
|
||||
m_ctlBar->update_Ip(ipStr);
|
||||
}
|
||||
|
||||
QString settingUi::operator [] (unsigned index) const
|
||||
{
|
||||
QString ret;
|
||||
if(index < (unsigned)SetPageName.size()){
|
||||
ret = SetPageName[index];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void settingUi::showDevTestPage()
|
||||
{
|
||||
showPage(PAGE_DEV_TEST, SetPageName[PAGE_DEV_TEST]);
|
||||
}
|
||||
#endif
|
||||
|
||||
void settingUi::reset()
|
||||
{
|
||||
qDebug() << "settingUi::reset()";
|
||||
update_IpBar();
|
||||
emit signalShowPageMsg(SetPageName[PAGE_PROJECT]);
|
||||
}
|
201
Linguist/setUi/settingUi.h
Normal file
201
Linguist/setUi/settingUi.h
Normal file
@ -0,0 +1,201 @@
|
||||
#ifndef SETTINGUI_H
|
||||
#define SETTINGUI_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QStackedWidget>
|
||||
#include <QString>
|
||||
#include <QDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QStack>
|
||||
|
||||
#include "UiTools.h"
|
||||
#include "LineEditWithKeyboard.h"
|
||||
#include "BackstageInterfaceForUi.h"
|
||||
#include "UiConfig.h"
|
||||
|
||||
#include "settingUIProjectSet.h"
|
||||
#include "settingUiInfo.h"
|
||||
#include "settingUiDevMng.h"
|
||||
#include "settingUiFaceMng.h"
|
||||
#include "settingUiAccMng.h"
|
||||
#include "settingUiRecoSet.h"
|
||||
#include "settingUiSysMng.h"
|
||||
#include "settingUiDevTest.h"
|
||||
#include "settingUiFastCfg.h"
|
||||
|
||||
|
||||
class settingUiTop : public MyWidgetWithMainStyleColor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit settingUiTop(QWidget *parent = nullptr);
|
||||
~settingUiTop();
|
||||
|
||||
void update_Ip(const QString& str);
|
||||
void setRightSideBtn(bool isShow, const QString btnName = "");
|
||||
signals:
|
||||
void signalReturnBtnClicked();
|
||||
void signalRightSideBtnClicked();
|
||||
|
||||
public slots:
|
||||
void slotShowPageMsg(const QString&);
|
||||
|
||||
private:
|
||||
QLabel* m_label_ip;
|
||||
QLabel* m_label_time;
|
||||
QPushButton* m_btn_back;
|
||||
QLabel* m_label_pageMsg;
|
||||
QPushButton* m_btn_rightSide;
|
||||
|
||||
TimerUpdate* _timerUpdate;
|
||||
};
|
||||
|
||||
class settingUi : public WidgetWithBackstageInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum enPageIndex {
|
||||
PAGE_PROJECT = 0,
|
||||
|
||||
PAGE_INFO,
|
||||
PAGE_DEV_MNG,
|
||||
PAGE_FACE_MNG,
|
||||
PAGE_ACCESS_MNG,
|
||||
PAGE_RECO,
|
||||
PAGE_SYS_MNG,
|
||||
PAGE_FAST_CFG_WIRE_NET,
|
||||
PAGE_DEV_MNG_NETWORK,
|
||||
|
||||
PAGE_DEV_TEST, //hidden page
|
||||
|
||||
//subPage
|
||||
PAGE_DEV_MNG_TIME,
|
||||
PAGE_DEV_MNG_NET_WIRE,
|
||||
PAGE_DEV_MNG_NET_WIFI,
|
||||
PAGE_DEV_MNG_NET_WIFI_ACC_POINT,
|
||||
PAGE_DEV_MNG_NET_4G,
|
||||
PAGE_DEV_MNG_BT,
|
||||
PAGE_DEV_MNG_BT_SPK,
|
||||
PAGE_DEV_MNG_BT_SPK_ACC_POINT,
|
||||
PAGE_DEV_MNG_BT_LOCK,
|
||||
PAGE_DEV_MNG_BT_LOCK_ACC_POINT,
|
||||
|
||||
PAGE_FACE_MNG_FACE,
|
||||
PAGE_FACE_MNG_ACCESS_RECORD,
|
||||
PAGE_FACE_MNG_ADD_PERSON,
|
||||
PAGE_FACE_MNG_MODIFY_PERSON,
|
||||
PAGE_FACE_MNG_SNAP_FACE,
|
||||
|
||||
PAGE_FAST_CFG_PARK,
|
||||
PAGE_FAST_CFG_QRCODE,
|
||||
|
||||
PAGE_MAX
|
||||
};
|
||||
|
||||
public:
|
||||
settingUi(QWidget *parent = nullptr);
|
||||
~settingUi();
|
||||
void reset();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void update_IpBar();
|
||||
QString operator [] (unsigned index) const;
|
||||
//void showDevTestPage();
|
||||
|
||||
signals:
|
||||
void signalShowRecoPage();
|
||||
void signalShowPageMsg(const QString&);
|
||||
void signalSetRecoUiForeheadWidgetVisable(const bool);
|
||||
void signalChangeRecoUiMode(); //底下的页面开关二维码模式信号
|
||||
void signalUpdateRecoUiIpDisplay(const bool); //增加识别界面ip显示开关,更新信号
|
||||
|
||||
public slots:
|
||||
void slotShowPage(int, const QString title);
|
||||
void slotReturnClicked();
|
||||
void slotRightSideBtnClicked();//m_ctlBar 右侧按钮按下
|
||||
void slotShowAddFacePage();
|
||||
void slotRestoreFactory();
|
||||
void slotShowShadowPage(bool show);
|
||||
void slotShowDevTestPage();
|
||||
void slotJumpPage(int pageIndex);
|
||||
void slotExitSettingUi();
|
||||
|
||||
private:
|
||||
const QVector<QString> SetPageName = {tr("操作"),
|
||||
tr("信息查看"),
|
||||
tr("设备管理"),
|
||||
tr("人脸管理"),
|
||||
tr("门禁管理"),
|
||||
tr("识别设置"),
|
||||
tr("系统管理"),
|
||||
tr("快速配置"),
|
||||
tr("网络设置"),
|
||||
tr("设备检测"),
|
||||
tr("时间设置"),
|
||||
tr("有线网络"),
|
||||
tr("无线网络"),
|
||||
tr("无线网络接入"),
|
||||
tr("4G网络"),
|
||||
tr("蓝牙"),
|
||||
tr("蓝牙音箱"),
|
||||
tr("已配对蓝牙设置"),
|
||||
tr("蓝牙门锁"),
|
||||
tr("蓝牙门锁操作"),
|
||||
tr("人脸库"),
|
||||
tr("通行记录"),
|
||||
tr("添加人员"),
|
||||
tr("编辑人员"),
|
||||
tr("拍照"),
|
||||
tr("设备信息"),
|
||||
tr("")};
|
||||
|
||||
QMap<int, QString> m_map_rightBtnName;
|
||||
settingUiTop* m_ctlBar;
|
||||
QStackedWidget* m_stack_setPage;
|
||||
|
||||
settingUIProjectSet* m_pProjectSetPage;
|
||||
settingUiInfo* m_infoPage;
|
||||
settingUiDevMng* m_devMngPage;
|
||||
settingUiFaceMng* m_faceMngPage;
|
||||
settingUiAccMng* m_accMngPage;
|
||||
settingUiRecoSet* m_recoSetPage;
|
||||
settingUiSysMng* m_sysMngPage;
|
||||
settingUiFastCfgWireNet* m_fastCfgWireNet;
|
||||
|
||||
settingUiDevTest* m_devTestPage;
|
||||
|
||||
settingUiDevMngTime* m_devMngTimePage;
|
||||
settingUiDevMngNetwork* m_devMngNetworkPage;
|
||||
settingUiDevMngNetWire* m_devMngNetWirePage;
|
||||
settingUiDevMngNetWifi* m_devMngNetWifiPage;
|
||||
settingUiDevMngNetWifiAccPoint* m_devMngNetWifiAccPointPage;
|
||||
settingUiDevMngNet4G* m_devMngNet4GPage;
|
||||
settingUiDevMngBt* m_devMngBtPage;
|
||||
settingUiDevMngBtSpk* m_devMngBtSpkPage;
|
||||
settingUiDevMngBtSpkAccPoint* m_devMngBtSpkAccPointPage;
|
||||
settingUiDevMngBtLock* m_devMngBtLockPage;
|
||||
settingUiDevMngBtLockAccPoint* m_devMngBtLockAccPointPage;
|
||||
|
||||
FaceDbPage* m_faceMngFacePage;
|
||||
AccessRecordPage* m_faceMngAccRedPage;
|
||||
AddPersonPage *m_addPersonPage;
|
||||
ModifyPersonPage *m_modifyPersonPage;
|
||||
SnapFacePage *m_snapFacePage;
|
||||
|
||||
settingUiFastCfgPark* m_fastCfgPark;
|
||||
SettingUiQrcode* m_fastCfgQrcode;
|
||||
|
||||
PureColorPage *m_shadowPage;
|
||||
|
||||
//是否在设置索引页面,是的话返回便退出设置页面
|
||||
bool m_onIndexPage;
|
||||
QStack<int> m_pageIndex;
|
||||
bool m_syncFlag;
|
||||
|
||||
void showPage(int nIndex, const QString& title);
|
||||
};
|
||||
|
||||
|
||||
#endif // SETTINGUI_H
|
355
Linguist/setUi/settingUiAccMng.cpp
Normal file
355
Linguist/setUi/settingUiAccMng.cpp
Normal file
@ -0,0 +1,355 @@
|
||||
#include "settingUiAccMng.h"
|
||||
#include <QDebug>
|
||||
#include "UiConfig.h"
|
||||
|
||||
|
||||
int settingUiAccMng::m_pageIndex = 0;
|
||||
settingUiAccMng::settingUiAccMng(int pageIndex, QWidget *parent)
|
||||
: SettingUiPage(QVector<SettingUiPage::SetOpn>{
|
||||
SetOpn(tr("开锁延迟(秒)"), "x", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("开锁时间(秒)"), "x", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("开锁信号"), "xxxxx", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("反向通行"), "xxxxx", static_cast<myListWidget::enProperty>(myListWidget::enPropertySwitch| myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("RS485"), "xx", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("RS485协议1设备地址(0-255)"), "xx", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("静电测试范围"), "xx", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("GPIO4接口"), "xx", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("GPIO5接口"), "xx", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("门超时报警(秒)"), "xx", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("防拆报警"), "", myListWidget::enPropertySwitch),
|
||||
SetOpn(tr("防拆报警信号"), "xx", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyIndent1)),
|
||||
}, parent)
|
||||
{
|
||||
m_pageIndex = pageIndex;
|
||||
qDebug() << "settingUiAccMng()";
|
||||
}
|
||||
|
||||
settingUiAccMng::~settingUiAccMng()
|
||||
{
|
||||
qDebug() << "~settingUiAccMng()";
|
||||
}
|
||||
|
||||
void settingUiAccMng::setBackstageUiinterface(BackstageInterfaceForUi* interface)
|
||||
{
|
||||
m_backstageIf = interface;
|
||||
reset();
|
||||
}
|
||||
|
||||
void settingUiAccMng::reset()
|
||||
{
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < config.size(); i ++){
|
||||
QListWidgetItem* pItem = m_listWidget->item(i);
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(pItem));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
QString str;
|
||||
switch(i){
|
||||
case enAccOpenDelay:
|
||||
str = QString::number(m_backstageIf->getUnlockDelay());
|
||||
break;
|
||||
case enAccOpenTime:
|
||||
str = QString::number(m_backstageIf->getUnlockTime());
|
||||
break;
|
||||
case enAccOpenSig:
|
||||
str = OpenSig[m_backstageIf->getUnlockSig()];
|
||||
break;
|
||||
#if 0
|
||||
case enAccAlmSig:
|
||||
str = AlarmSig[m_backstageIf->getWarningSig()];
|
||||
break;
|
||||
#endif
|
||||
case enAccRs485:
|
||||
str = Rs485Cfg[m_backstageIf->getRs485Cfg()];
|
||||
break;
|
||||
case enAccRs485Prot1Addr:
|
||||
str = (m_backstageIf->getRs485Prot1Addr() >= 0 ? QString::number(m_backstageIf->getRs485Prot1Addr()) : tr("(未设置)"));
|
||||
break;
|
||||
case enAccGPIO4:
|
||||
str = GPIOCfg[m_backstageIf->getGpio4Cfg()];
|
||||
break;
|
||||
case enAccGPIO5:
|
||||
str = GPIOCfg[m_backstageIf->getGpio5Cfg()];
|
||||
break;
|
||||
case enAccDoorCloseOvertime:
|
||||
str = QString::number(m_backstageIf->getDoorCloseOvertime());
|
||||
break;
|
||||
case enAccAntiDemolitionSw:
|
||||
wdt->updateIcon(m_backstageIf->getAntiDemolitionSw() ? ":/res/image/on.png" : ":/res/image/off.png");
|
||||
break;
|
||||
case enAccAntiDemolitionOutput:
|
||||
str = AntiDemolitionOutput[m_backstageIf->getAntiDemolitionOutput()];
|
||||
break;
|
||||
case enAccRs485ReverseAccessSw: {
|
||||
wdt->updateIcon(m_backstageIf->getReverseAccessSw() ? ":/res/image/on.png" : ":/res/image/off.png");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
wdt->updateLabel(str);
|
||||
}
|
||||
|
||||
controlListWidgetItemShow(m_backstageIf->getRs485Cfg() == 1, enAccRs485Prot1Addr); //协议1显示设置
|
||||
controlListWidgetItemShow(m_backstageIf->getRs485Cfg() == 3, enAccRs485Prot3Cfg); //协议3显示设置
|
||||
controlListWidgetItemShow(m_backstageIf->getAntiDemolitionSw(), enAccAntiDemolitionOutput);
|
||||
controlListWidgetItemShow(m_backstageIf->getGpio4Cfg() == 1 || m_backstageIf->getGpio5Cfg() == 1, enAccDoorCloseOvertime);
|
||||
controlListWidgetItemShow(m_backstageIf->getUnlockSig() == UnlockSigRs485, enAccRs485ReverseAccessSw);
|
||||
}
|
||||
|
||||
void settingUiAccMng::slotItemClicked(QListWidgetItem* item)
|
||||
{
|
||||
if(nullptr == m_backstageIf){
|
||||
#ifndef DEBUG_MODE
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
int row = m_listWidget->currentRow();
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
switch(row){
|
||||
case enAccOpenDelay:
|
||||
case enAccOpenTime:
|
||||
case enAccRs485Prot1Addr:
|
||||
case enAccDoorCloseOvertime:
|
||||
{
|
||||
int currentValue = 10;
|
||||
int min = 0;
|
||||
int max = 100;
|
||||
QString tip;
|
||||
|
||||
if(enAccOpenDelay == row){
|
||||
currentValue = m_backstageIf->getUnlockDelay();
|
||||
min = 0;
|
||||
max = 10;
|
||||
}else if(enAccOpenTime == row){
|
||||
currentValue = m_backstageIf->getUnlockTime();
|
||||
min = 1;
|
||||
max = 10;
|
||||
}else if(enAccRs485Prot1Addr == row){
|
||||
currentValue = 0;//m_backstageIf->getRs485Prot1Addr();
|
||||
min = 0;
|
||||
max = 255;
|
||||
}else if(enAccDoorCloseOvertime == row){
|
||||
currentValue = m_backstageIf->getDoorCloseOvertime();
|
||||
min = 1;
|
||||
max = 300;
|
||||
}
|
||||
|
||||
SliderDialog dlg(currentValue, min, max, tip, parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
int valueSet = dlg.getValueSet();
|
||||
if(enAccOpenDelay == row){
|
||||
m_backstageIf->setUnlockDelay(valueSet);
|
||||
}else if(enAccOpenTime == row){
|
||||
m_backstageIf->setUnlockTime(valueSet);
|
||||
}else if(enAccRs485Prot1Addr == row){
|
||||
m_backstageIf->setRs485Prot1Addr(valueSet);
|
||||
}else if(enAccDoorCloseOvertime == row){
|
||||
m_backstageIf->setDoorCloseOvertime(valueSet);
|
||||
}
|
||||
wdt->updateLabel(QString::number(valueSet));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case enAccOpenSig:
|
||||
//case enAccAlmSig:
|
||||
case enAccRs485:
|
||||
case enAccGPIO4:
|
||||
case enAccGPIO5:
|
||||
case enAccAntiDemolitionOutput:{
|
||||
int choosed = 0;
|
||||
|
||||
QVector<QString> options;
|
||||
if(enAccOpenSig == row){
|
||||
options = OpenSig;
|
||||
if(UiConfig::GetInstance()->isFuncNotSupport(FuncWg42)){
|
||||
options.remove(4);
|
||||
}
|
||||
choosed = static_cast<int>(m_backstageIf->getUnlockSig());
|
||||
}
|
||||
#if 0
|
||||
else if(enAccAlmSig == row){
|
||||
options = AlarmSig;
|
||||
choosed = static_cast<int>(m_backstageIf->getWarningSig());
|
||||
}
|
||||
#endif
|
||||
else if(enAccRs485 == row){
|
||||
options = Rs485Cfg;
|
||||
choosed = static_cast<int>(m_backstageIf->getRs485Cfg());
|
||||
}else if(enAccGPIO4 == row){
|
||||
options = GPIOCfg;
|
||||
choosed = static_cast<int>(m_backstageIf->getGpio4Cfg());
|
||||
}else if(enAccGPIO5 == row){
|
||||
options = GPIOCfg;
|
||||
choosed = static_cast<int>(m_backstageIf->getGpio5Cfg());
|
||||
}else if(enAccAntiDemolitionOutput == row){
|
||||
options = AntiDemolitionOutput;
|
||||
choosed = static_cast<int>(m_backstageIf->getAntiDemolitionOutput());
|
||||
}
|
||||
|
||||
RadioBtnChooseDialog dlg(options, parent()->parent(), choosed);
|
||||
if(dlg.exec() == QDialog::Accepted){
|
||||
int newChoosed = dlg.getChoosedIndex();
|
||||
if(newChoosed != choosed){
|
||||
if(enAccOpenSig == row){
|
||||
if(1 == newChoosed &&
|
||||
(1 == m_backstageIf->getAntiDemolitionOutput()) ){//1 == m_backstageIf->getWarningSig() ||
|
||||
InfoDialog(tr("本地继电器已使用"), parent()->parent()).exec();
|
||||
}else {
|
||||
m_backstageIf->setUnlockSig(static_cast<enUnlockSignal>(newChoosed));
|
||||
wdt->updateLabel(options[newChoosed]);
|
||||
controlListWidgetItemShow(m_backstageIf->getUnlockSig() == UnlockSigRs485, enAccRs485ReverseAccessSw);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else if(enAccAlmSig == row){
|
||||
if(1 == newChoosed &&
|
||||
(1 == m_backstageIf->getUnlockSig() || 1 == m_backstageIf->getAntiDemolitionOutput()) ){
|
||||
InfoDialog(tr("本地继电器已使用"), parent()->parent()).exec();
|
||||
}else{
|
||||
m_backstageIf->setWarningSig(newChoosed);
|
||||
wdt->updateLabel(options[newChoosed]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if(enAccRs485 == row){
|
||||
m_backstageIf->setRs485Cfg(newChoosed);
|
||||
wdt->updateLabel(options[newChoosed]);
|
||||
QListWidgetItem* pItem = m_listWidget->item(enAccRs485Prot1Addr);
|
||||
myListWidget* swWidget = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(pItem));
|
||||
if(swWidget){
|
||||
swWidget->updateLabel((m_backstageIf->getRs485Prot1Addr() >= 0 ? QString::number(m_backstageIf->getRs485Prot1Addr()) : tr("(未设置)")));
|
||||
}
|
||||
|
||||
controlListWidgetItemShow(1 == newChoosed, enAccRs485Prot1Addr); //协议1显示地址
|
||||
controlListWidgetItemShow(3 == newChoosed, enAccRs485Prot3Cfg);
|
||||
if(1 == newChoosed){
|
||||
InfoDialog(tr("请注意设置RS485协议1设备地址"), parent()->parent()).exec();
|
||||
}
|
||||
}else if(enAccGPIO4 == row){
|
||||
if(0 != newChoosed && m_backstageIf->getAntiDemolitionSw() && 2 == m_backstageIf->getAntiDemolitionOutput()){
|
||||
InfoDialog(tr("GPIO4已设置为防拆报警输出,请重新设置!"), parent()->parent()).exec();
|
||||
}else if(1 == newChoosed && 1 == m_backstageIf->getGpio5Cfg()){
|
||||
InfoDialog(tr("GPIO5已设置为门磁,请重新设置!"), parent()->parent()).exec();
|
||||
}else if(2 == newChoosed && 2 == m_backstageIf->getGpio5Cfg()){
|
||||
InfoDialog(tr("GPIO5已设置为消防信号,请重新设置!"), parent()->parent()).exec();
|
||||
}else{
|
||||
m_backstageIf->setGpio4Cfg(newChoosed);
|
||||
wdt->updateLabel(options[newChoosed]);
|
||||
controlListWidgetItemShow(1 == m_backstageIf->getGpio4Cfg() || 1 == m_backstageIf->getGpio5Cfg(), enAccDoorCloseOvertime);
|
||||
}
|
||||
}else if(enAccGPIO5 == row){
|
||||
if(0 != newChoosed && m_backstageIf->getAntiDemolitionSw() && 3 == m_backstageIf->getAntiDemolitionOutput()){
|
||||
InfoDialog(tr("GPIO5已设置为防拆报警输出,请重新设置!"), parent()->parent()).exec();
|
||||
}else if(1 == newChoosed && 1 == m_backstageIf->getGpio4Cfg()){
|
||||
InfoDialog(tr("GPIO4已设置为门磁,请重新设置!"), parent()->parent()).exec();
|
||||
}else if(2 == newChoosed && 2 == m_backstageIf->getGpio4Cfg()){
|
||||
InfoDialog(tr("GPIO4已设置为消防信号,请重新设置!"), parent()->parent()).exec();
|
||||
}else{
|
||||
m_backstageIf->setGpio5Cfg(newChoosed);
|
||||
wdt->updateLabel(options[newChoosed]);
|
||||
controlListWidgetItemShow(1 == m_backstageIf->getGpio4Cfg() || 1 == m_backstageIf->getGpio5Cfg(), enAccDoorCloseOvertime);
|
||||
}
|
||||
}else if(enAccAntiDemolitionOutput == row){
|
||||
if(1 == newChoosed && 1 == m_backstageIf->getUnlockSig()){//1 == m_backstageIf->getWarningSig() ||
|
||||
InfoDialog(tr("本地继电器已被使用,请重新设置!"), parent()->parent()).exec();
|
||||
}else if(2 == newChoosed && 0 != m_backstageIf->getGpio4Cfg()){
|
||||
InfoDialog(tr("GPIO4已设置为信号输入,请重新设置!"), parent()->parent()).exec();
|
||||
}else if(3 == newChoosed && 0 != m_backstageIf->getGpio5Cfg()){
|
||||
InfoDialog(tr("GPIO5已设置为信号输入,请重新设置!"), parent()->parent()).exec();
|
||||
}else {
|
||||
m_backstageIf->setAntiDemolitionOutput(newChoosed);
|
||||
wdt->updateLabel(options[newChoosed]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case enAccRs485Prot1Addr:
|
||||
{
|
||||
if(0 == m_backstageIf->getRs485Prot1Addr()){
|
||||
bool settingFailed = true;
|
||||
do{
|
||||
LineEditInputDialog dlg(config[enAccRs485Prot1Addr].m_sOpn, parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted){
|
||||
const QString strInput = dlg.getRow(0);
|
||||
do{
|
||||
bool isDigi = false;
|
||||
int input = strInput.toInt(&isDigi);
|
||||
if(!isDigi){
|
||||
break;
|
||||
}
|
||||
if(0 == m_backstageIf->setRs485Prot1Addr(input)){
|
||||
wdt->updateLabel(strInput);
|
||||
settingFailed = false;
|
||||
}
|
||||
}while(0);
|
||||
}
|
||||
else {
|
||||
settingFailed = false;
|
||||
}
|
||||
if(settingFailed){
|
||||
InfoDialog(tr("设置有误,请重新输入!"), parent()->parent()).exec();
|
||||
}
|
||||
}while(settingFailed);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case enAccRs485Prot3Cfg:
|
||||
{
|
||||
const QStringList titles{tr("手部"), tr("脚部")};
|
||||
const QVector<QStringList> sels{{"100KΩ-10MΩ", "750KΩ-10MΩ", "750KΩ-35MΩ", tr("不检测")},
|
||||
{"100KΩ-35MΩ", "750KΩ-100MΩ", "750KΩ-1000MΩ", tr("不检测")}};
|
||||
ComSelectDialog dlg(titles, sels, parent()->parent());
|
||||
int handCfg = 0;
|
||||
int feetCfg = 0;
|
||||
m_backstageIf->getRs485Prot3Cfg(handCfg, feetCfg);
|
||||
dlg.setRow(0, handCfg);
|
||||
dlg.setRow(1, feetCfg);
|
||||
if(dlg.exec() == QDialog::Accepted){
|
||||
m_backstageIf->setRs485Prot3Cfg(dlg.getRow(0), dlg.getRow(1));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case enAccAntiDemolitionSw:
|
||||
{
|
||||
bool setting_value = false;
|
||||
if(enAccAntiDemolitionSw == row){
|
||||
setting_value = static_cast<bool>(m_backstageIf->getAntiDemolitionSw());
|
||||
}
|
||||
|
||||
setting_value = static_cast<bool>(!setting_value);
|
||||
wdt->updateIcon(setting_value ? ":/res/image/on.png" : ":/res/image/off.png");
|
||||
|
||||
if(enAccAntiDemolitionSw == row){
|
||||
controlListWidgetItemShow(setting_value, enAccAntiDemolitionOutput);
|
||||
m_backstageIf->setAntiDemolitionSw(setting_value);
|
||||
if(!setting_value){
|
||||
m_backstageIf->setAntiDemolitionOutput(0);//防止在配置输出信号项功能时与防拆输出冲突
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case enAccRs485ReverseAccessSw: {
|
||||
bool setting_value = m_backstageIf->getReverseAccessSw();
|
||||
setting_value = !setting_value;
|
||||
wdt->updateIcon(setting_value ? ":/res/image/on.png" : ":/res/image/off.png");
|
||||
m_backstageIf->setReverseAccessSw(setting_value);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
76
Linguist/setUi/settingUiAccMng.h
Normal file
76
Linguist/setUi/settingUiAccMng.h
Normal file
@ -0,0 +1,76 @@
|
||||
#ifndef SETTINGUIACCMNG_H
|
||||
#define SETTINGUIACCMNG_H
|
||||
|
||||
#include <QListWidget>
|
||||
#include "UiTools.h"
|
||||
|
||||
class settingUiAccMng : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
enAccOpenDelay,
|
||||
enAccOpenTime,
|
||||
enAccOpenSig,
|
||||
enAccRs485ReverseAccessSw, // RS485反向通行
|
||||
//enAccAlmSig,
|
||||
enAccRs485,
|
||||
enAccRs485Prot1Addr,
|
||||
enAccRs485Prot3Cfg,
|
||||
enAccGPIO4,
|
||||
enAccGPIO5,
|
||||
enAccDoorCloseOvertime,
|
||||
enAccAntiDemolitionSw,
|
||||
enAccAntiDemolitionOutput,
|
||||
}enAcc;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiAccMng(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiAccMng();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem* item);
|
||||
|
||||
private:
|
||||
const QVector<QString> OpenSig{
|
||||
tr("禁用"),
|
||||
tr("本地继电器"),
|
||||
tr("韦根26"),
|
||||
tr("韦根34"),
|
||||
tr("韦根42"),
|
||||
tr("RS485")
|
||||
};
|
||||
|
||||
const QVector<QString> AlarmSig{
|
||||
tr("禁用"),
|
||||
tr("本地继电器")
|
||||
};
|
||||
|
||||
const QVector<QString> Rs485Cfg{
|
||||
tr("禁用"),
|
||||
tr("协议1"),
|
||||
tr("协议2"),
|
||||
tr("协议3")
|
||||
};
|
||||
|
||||
const QVector<QString> GPIOCfg{
|
||||
tr("禁用"),
|
||||
tr("门磁"),
|
||||
tr("消防信号")
|
||||
};
|
||||
|
||||
const QVector<QString> AntiDemolitionOutput{
|
||||
tr("无"),
|
||||
tr("本地继电器"),
|
||||
tr("GPIO4"),
|
||||
tr("GPIO5")
|
||||
};
|
||||
};
|
||||
|
||||
#endif // SETTINGUIACCMNG_H
|
2897
Linguist/setUi/settingUiDevMng.cpp
Normal file
2897
Linguist/setUi/settingUiDevMng.cpp
Normal file
File diff suppressed because it is too large
Load Diff
470
Linguist/setUi/settingUiDevMng.h
Normal file
470
Linguist/setUi/settingUiDevMng.h
Normal file
@ -0,0 +1,470 @@
|
||||
#ifndef SETTINGUIDEVMNG_H
|
||||
#define SETTINGUIDEVMNG_H
|
||||
|
||||
#include <QListWidget>
|
||||
#include "UiTools.h"
|
||||
|
||||
class settingUiDevMng : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_SHOW_IP,
|
||||
DEV_MNG_SHOW_ID_VER,
|
||||
DEV_MNG_SET_VOLUMN,
|
||||
DEV_MNG_SET_BRIGHTNESS,
|
||||
DEV_MNG_SCREENSAVER,
|
||||
DEV_MNG_SCREENOFF,
|
||||
DEV_MNG_SET_TIME,
|
||||
//DEV_MNG_SET_NETWORK,
|
||||
DEV_MNG_BLUETOOTH,
|
||||
DEV_MNG_OPEN_DYNAMICFEATURE,//动态底库
|
||||
DEV_MNG_PASSWORD,
|
||||
DEV_MNG_DEV_SETTING_DISABLE
|
||||
}DEV_MNG_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMng(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiDevMng();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
class settingUiDevMngTime : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_TIME_NTP_SW,
|
||||
DEV_MNG_TIME_NTP_SERVER,
|
||||
DEV_MNG_TIME_NTP_INTERVAL,
|
||||
DEV_MNG_TIME_NTP_TIME_ZONE,
|
||||
DEV_MNG_TIME_MANUAL
|
||||
}DEV_MNG_TIME_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngTime(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiDevMngTime();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
void slotShowProcessing();
|
||||
|
||||
private:
|
||||
|
||||
const QVector<QString> TimeZone = {tr("UTC-11太平洋/中途岛"),
|
||||
tr("UTC-9:30太平洋/马克萨斯"),
|
||||
tr("UTC-9美国/安克雷奇"),
|
||||
tr("UTC-8美国/道森"),
|
||||
tr("UTC-7美国/博伊西"),
|
||||
tr("UTC-6美国/巴伊亚州_班德拉斯"),
|
||||
tr("UTC-5美国/多伦多"),
|
||||
tr("UTC-4美国/安圭拉"),
|
||||
tr("UTC-3:30美国/圣约翰斯"),
|
||||
tr("UTC-3美国/阿拉瓜那"),
|
||||
tr("UTC-2美国/诺罗尼亚"),
|
||||
tr("UTC-1美国/斯科比斯松"),
|
||||
tr("UTC+0欧洲/里斯本/伦敦"),
|
||||
tr("UTC+1欧洲/阿姆斯特丹"),
|
||||
tr("UTC+2亚洲/大马士革"),
|
||||
tr("UTC+3亚洲/科威特"),
|
||||
tr("UTC+3:30亚洲/德黑兰"),
|
||||
tr("UTC+4印度/毛里求斯"),
|
||||
tr("UTC+4:30亚洲/喀布尔"),
|
||||
tr("UTC+5印度/马尔代夫"),
|
||||
tr("UTC+5:30亚洲/科伦坡"),
|
||||
tr("UTC+5:45亚洲/加德满都"),
|
||||
tr("UTC+6印度/查戈斯"),
|
||||
tr("UTC+6:30亚洲/仰光"),
|
||||
tr("UTC+7亚洲/曼谷"),
|
||||
tr("UTC+8亚洲/北京/台北"),
|
||||
tr("UTC+8:45澳大利亚/尤克拉"),
|
||||
tr("UTC+9亚洲/首尔/东京"),
|
||||
tr("UTC+9:30澳大利亚/达尔文"),
|
||||
tr("UTC+10澳大利亚/墨尔本"),
|
||||
tr("UTC+10:30澳大利亚/领主豪"),
|
||||
tr("UTC+11太平洋/瓜达尔卡纳尔岛"),
|
||||
tr("UTC+12太平洋/奥克兰"),
|
||||
tr("UTC+12:45太平洋/查塔姆"),
|
||||
tr("UTC+13太平洋/阿皮亚"),
|
||||
tr("UTC+14太平洋/基里蒂马蒂)")
|
||||
};
|
||||
|
||||
const QVector<QString> TimeZoneSet = {"Pacific/Midway",
|
||||
"Pacific/Marquesas",
|
||||
"America/Anchorage",
|
||||
"America/Dawson",
|
||||
"America/Boise",
|
||||
"America/Bahia_Banderas",
|
||||
"America/Toronto",
|
||||
"America/Anguilla",
|
||||
"America/St_Johns",
|
||||
"America/Araguaina",
|
||||
"America/Noronha",
|
||||
"America/Scoresbysund",
|
||||
"right/Europe/London",
|
||||
"right/Europe/Amsterdam",
|
||||
"Asia/Damascus",
|
||||
"Asia/Kuwait",
|
||||
"Asia/Tehran",
|
||||
"Indian/Mauritius",
|
||||
"Asia/Kabul",
|
||||
"Indian/Maldives",
|
||||
"Asia/Colombo",
|
||||
"Asia/Kathmandu",
|
||||
"Indian/Chagos",
|
||||
"Asia/Rangoon",
|
||||
"Asia/Bangkok",
|
||||
"Asia/Shanghai",
|
||||
"Australia/Eucla",
|
||||
"Asia/Tokyo",
|
||||
"Australia/Darwin",
|
||||
"Australia/Melbourne",
|
||||
"Australia/Lord_Howe",
|
||||
"Pacific/Guadalcanal",
|
||||
"Pacific/Auckland",
|
||||
"Pacific/Chatham",
|
||||
"Pacific/Apia",
|
||||
"Pacific/Kiritimati"};
|
||||
|
||||
MsgDialog* m_msgDlg;
|
||||
void ntpTimeCorrect();
|
||||
};
|
||||
|
||||
class settingUiDevMngNetwork : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_NETWORK_WIRE,
|
||||
DEV_MNG_NETWORK_WIFI,
|
||||
DEV_MNG_NETWORK_4G
|
||||
}DEV_MNG_WIRE_NET_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngNetwork(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiDevMngNetwork();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
class settingUiDevMngNetWire : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_NET_WIRE_SW,
|
||||
DEV_MNG_NET_WIRE_DHCP,
|
||||
DEV_MNG_NET_WIRE_MAN_CFG,
|
||||
DEV_MNG_NET_WIRE_IP,
|
||||
DEV_MNG_NET_WIRE_MASK,
|
||||
DEV_MNG_NET_WIRE_GW,
|
||||
DEV_MNG_NET_WIRE_DNS
|
||||
}DEV_MNG_WIRE_NET_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngNetWire(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiDevMngNetWire();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
|
||||
private:
|
||||
bool setStaticNetworkPara(const stNetWire& curNetCfg);
|
||||
};
|
||||
|
||||
class settingUiDevMngNetWifi : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_NET_WIFI_SW,
|
||||
DEV_MNG_NET_AP_SW,
|
||||
DEV_MNG_NET_WIFI_ASSIGN,
|
||||
DEV_MNG_NET_WIFI_SEARCH,
|
||||
DEV_MNG_NET_AP_PWD,
|
||||
|
||||
DEV_MNG_NET_BUTT
|
||||
}DEV_MNG_NET_WIFI_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngNetWifi(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiDevMngNetWifi();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
void slotUpdateConnectionStatus(QString ssid, bool connected);
|
||||
|
||||
private:
|
||||
void clearSsidList();
|
||||
void wifiSearch();
|
||||
const int m_ssidPosIndex = DEV_MNG_NET_BUTT;
|
||||
};
|
||||
|
||||
class settingUiDevMngNetWifiAccPoint : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_NET_WIFI_AP_CONNECT,
|
||||
DEV_MNG_NET_WIFI_AP_FORGET,
|
||||
DEV_MNG_NET_WIFI_AP_DHCP,
|
||||
DEV_MNG_NET_WIFI_AP_MAN_CFG,
|
||||
DEV_MNG_NET_WIFI_AP_IP,
|
||||
DEV_MNG_NET_WIFI_AP_MASK,
|
||||
DEV_MNG_NET_WIFI_AP_GW,
|
||||
DEV_MNG_NET_WIFI_AP_DNS
|
||||
}DEV_MNG_NET_WIFI_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngNetWifiAccPoint(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiDevMngNetWifiAccPoint();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
void signalUpdateConnectionStatus(QString ssid, bool connected);
|
||||
void signalReturn();
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
|
||||
private:
|
||||
bool setStaticNetworkPara(const stNetWifi& curNetCfg);
|
||||
};
|
||||
|
||||
class settingUiDevMngNet4G : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_NET_4G_SW,
|
||||
DEV_MNG_NET_4G_PROVIDER,
|
||||
DEV_MNG_NET_4G_REBOOT
|
||||
}DEV_MNG_NET_WIFI_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngNet4G(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiDevMngNet4G();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
|
||||
private:
|
||||
const QVector<QString> net4GProvider{
|
||||
tr("未插卡"),tr("中国移动"),tr("中国电信"),tr("中国联通"),tr("4G启动中...")
|
||||
};
|
||||
};
|
||||
|
||||
class settingUiDevMngBt : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_BT_ENABLE,
|
||||
DEV_MNG_BT_SPK,
|
||||
DEV_MNG_BT_LOCK
|
||||
}DEV_MNG_BT_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngBt(int pageIndex, QWidget *parent = nullptr);
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class settingUiDevMngBtSpk : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
//DEV_MNG_BULETOOTH_ENABLE,
|
||||
DEV_MNG_BULETOOTH_DEVNAME,
|
||||
DEV_MNG_BULETOOTH_HISTORY_DEV,
|
||||
DEV_MNG_BULETOOTH_AVAILABLE_DEV,
|
||||
}DEV_MNG_BULETOOTH_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngBtSpk(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiDevMngBtSpk();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
private:
|
||||
void clearPaireItem();
|
||||
void clearAvailItem();
|
||||
|
||||
void addPairedItem(BluetoothDev_t &btDev);
|
||||
void addPairedItem(BtListWidget *pBtListWidget);
|
||||
void addPairedItem(list<BluetoothDev_t> &btDevList);
|
||||
|
||||
void addAvailItem(BluetoothDev_t &btDev);
|
||||
void addAvailItem(BtListWidget *pBtListWidget);
|
||||
void addAvailItem(list<BluetoothDev_t> &btDevList);
|
||||
|
||||
int deletePairedItem(int row);
|
||||
int deleteAvaidItem(int row);
|
||||
void resetPaireItem(list<BluetoothDev_t> &btDevList);
|
||||
void resetAvailItem(list<BluetoothDev_t> &btDevList);
|
||||
signals:
|
||||
void signalClickSet(BluetoothDev_t btDevInfo);
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
void slotBtDevSet(BluetoothDev_t btDevInfo);
|
||||
|
||||
private:
|
||||
int m_pairedItemCnt = 0;
|
||||
int m_availdItemCnt = 0;
|
||||
#if 1
|
||||
string m_btDevName;
|
||||
bool m_btIsEnable;
|
||||
//list<BluetoothDev_t> m_btPairedList;
|
||||
//list<BluetoothDev_t> m_btAvailList;
|
||||
#endif
|
||||
};
|
||||
|
||||
class settingUiDevMngBtSpkAccPoint : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_BULETOOTH_ACCPOINTE_RENAME,
|
||||
DEV_MNG_BULETOOTH_ACCPOINTE_CANCLE
|
||||
}DEV_MNG_BULETOOTH_ACCPOINTE_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngBtSpkAccPoint(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiDevMngBtSpkAccPoint();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
void signalReturn();
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
void setAccPointInfo(const BluetoothDev_t &rBlueDev);
|
||||
private:
|
||||
BluetoothDev_t m_btDev;
|
||||
};
|
||||
|
||||
class settingUiDevMngBtLock : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_BT_LOCK_ENABLE,
|
||||
DEV_MNG_BT_LOCK_ADD,
|
||||
DEV_MNG_BT_LOCK_BUTT
|
||||
}DEV_MNG_BT_LOCK_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngBtLock(int pageIndex, QWidget *parent = nullptr);
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
void signalCurrentLock(const QString& lock);
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
void slotRefresh();
|
||||
|
||||
private:
|
||||
void clearBtLockList();
|
||||
void addBtLock(const QString& position);
|
||||
void showBtLockList(const BtDoorLock& cfg);
|
||||
};
|
||||
|
||||
class settingUiDevMngBtLockAccPoint : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
DEV_MNG_BT_LOCK_INFO,
|
||||
DEV_MNG_BT_LOCK_BATTERY,
|
||||
DEV_MNG_BT_LOCK_DELETE,
|
||||
DEV_MNG_BT_LOCK_BUTT
|
||||
}DEV_MNG_BT_LOCK_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevMngBtLockAccPoint(int pageIndex, QWidget *parent = nullptr);
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
void signalUpdataTitle(const QString& title);
|
||||
void signalRefresh();
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
void slotCurrentLock(const QString& lock);
|
||||
|
||||
private:
|
||||
int m_manufacturer;
|
||||
QString m_position;
|
||||
QString m_mac;
|
||||
|
||||
void getRemainingBatPwr();
|
||||
};
|
||||
|
||||
|
||||
#endif // SETTINGUIDEVMNG_H
|
695
Linguist/setUi/settingUiDevTest.cpp
Normal file
695
Linguist/setUi/settingUiDevTest.cpp
Normal file
@ -0,0 +1,695 @@
|
||||
#include "settingUiDevTest.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <functional>
|
||||
#include <QDebug>
|
||||
#include "rw_zlog.h"
|
||||
#include "common_utils.h"
|
||||
#include "dev_version.h"
|
||||
|
||||
int settingUiDevTest::m_pageIndex = 0;
|
||||
settingUiDevTest::settingUiDevTest(int pageIndex, QWidget *parent) : MyWidgetWithMainStyleColor(parent)
|
||||
{
|
||||
m_pageIndex = pageIndex;
|
||||
|
||||
QVBoxLayout* vlayAuto = new QVBoxLayout();
|
||||
m_gbAuto = new QGroupBox("自动检测", this);
|
||||
m_gbAuto->setLayout(vlayAuto);
|
||||
|
||||
m_btnTest = new QPushButton("立即检测", this);
|
||||
m_btnTest->setFixedSize(UiConfig::GetInstance()->getUiWidth() / 8, UiConfig::GetInstance()->getUiWidth() / 12);
|
||||
m_btnTest->setFlat(true);
|
||||
connect(m_btnTest, &QPushButton::clicked, this, &settingUiDevTest::slotBtnClicked);
|
||||
//m_btnTest->setStyleSheet("background-color:rgb(24, 144, 255);border-radius:50px;focus{padding:-1;}");
|
||||
m_btnTest->setStyleSheet("QPushButton {"
|
||||
"border: 0px;"
|
||||
"border-radius:10px;"
|
||||
"background-color:rgb(24, 144, 255);"
|
||||
"focus{outline: none;}"
|
||||
"}"
|
||||
"QPushButton:hover { "
|
||||
"background-color:rgb(24, 144, 255);"
|
||||
"}"
|
||||
"QPushButton:pressed {"
|
||||
"background-color:rgb(222, 222, 222);"
|
||||
"}");
|
||||
vlayAuto->addWidget(m_btnTest, 1, Qt::AlignCenter);
|
||||
|
||||
QGridLayout* glayAutoTestItems = new QGridLayout();
|
||||
glayAutoTestItems->setMargin(0);
|
||||
//glayAutoTestItems->setColumnStretch(0, 98);
|
||||
//glayAutoTestItems->setColumnStretch(1, 1);
|
||||
//glayAutoTestItems->setColumnStretch(1, 98);
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
QLabel* testOpn = new QLabel("检测项", this);
|
||||
glayAutoTestItems->addWidget(testOpn, row, col++, Qt::AlignCenter);
|
||||
QLabel* testStatus = new QLabel("结果", this);
|
||||
glayAutoTestItems->addWidget(testStatus, row, col++, Qt::AlignRight);
|
||||
QLabel* operation = new QLabel("操作", this);
|
||||
glayAutoTestItems->addWidget(operation, row, col++, Qt::AlignRight);
|
||||
row++;
|
||||
col = 0;
|
||||
const QString style = "QPushButton {"
|
||||
"border: 0px;"
|
||||
"border-radius:4px;"
|
||||
"background-color:rgb(6, 119, 194);"
|
||||
"focus{outline: none;}"
|
||||
"}"
|
||||
"QPushButton:hover { "
|
||||
"background-color:rgb(6, 119, 194);"
|
||||
"}"
|
||||
"QPushButton:pressed {"
|
||||
"background-color:rgb(222, 222, 222);"
|
||||
"}";
|
||||
for(const auto& testItem : m_autoTest){
|
||||
QLabel* itemName = new QLabel(testItem, this);
|
||||
itemName->adjustSize();
|
||||
m_labelsAutoTestItem.push_back(itemName);
|
||||
glayAutoTestItems->addWidget(itemName, row, col++, Qt::AlignCenter);
|
||||
QLabel* testRes = new QLabel(this);
|
||||
m_labelsAutoTestRes.push_back(testRes);
|
||||
glayAutoTestItems->addWidget(testRes, row, col++);
|
||||
QPushButton* retest = new QPushButton("复测", this);
|
||||
connect(retest, &QPushButton::clicked, this, &settingUiDevTest::slotBtnClicked);
|
||||
retest->setStyleSheet(style);
|
||||
m_btnsAutoTestRetest.push_back(retest);
|
||||
glayAutoTestItems->addWidget(retest, row, col++, Qt::AlignCenter);
|
||||
row++;
|
||||
col = 0;
|
||||
}
|
||||
vlayAuto->addLayout(glayAutoTestItems);
|
||||
vlayAuto->addStretch(5);
|
||||
|
||||
|
||||
QVBoxLayout* vlayMal = new QVBoxLayout();
|
||||
m_gbMal = new QGroupBox("人工检测", this);
|
||||
m_gbMal->setLayout(vlayMal);
|
||||
row = 0;
|
||||
col = 0;
|
||||
QGridLayout* glayMalTestItems = new QGridLayout();
|
||||
glayMalTestItems->setSpacing(5);
|
||||
for(const auto& testItem : m_malTest){
|
||||
QLabel* itemName = new QLabel(testItem, this);
|
||||
m_labelsMalTestItem.push_back(itemName);
|
||||
glayMalTestItems->addWidget(itemName, row, col++, 1, 2);
|
||||
QLabel* testRes = new QLabel(this);
|
||||
m_labelsMalTestRes.push_back(testRes);
|
||||
glayMalTestItems->addWidget(testRes, row, col++, Qt::AlignRight);
|
||||
QPushButton* retest = new QPushButton("检测", this);
|
||||
connect(retest, &QPushButton::clicked, this, &settingUiDevTest::slotBtnClicked);
|
||||
retest->setStyleSheet(style);
|
||||
m_btnsMalTest.push_back(retest);
|
||||
glayMalTestItems->addWidget(retest, row, col++, Qt::AlignRight);
|
||||
row++;
|
||||
col = 0;
|
||||
}
|
||||
vlayMal->addLayout(glayMalTestItems);
|
||||
|
||||
QLabel* labelNtp = new QLabel("NTP", this);
|
||||
glayMalTestItems->addWidget(labelNtp, row, col++);
|
||||
|
||||
col++;//放到第三列
|
||||
m_btnNtp = new QPushButton("校时", this);
|
||||
m_btnNtp->setStyleSheet(style);
|
||||
connect(m_btnNtp, &QPushButton::clicked, this, &settingUiDevTest::slotBtnClicked);
|
||||
glayMalTestItems->addWidget(m_btnNtp, row, col++);
|
||||
row++;
|
||||
col = 0;
|
||||
|
||||
|
||||
QVBoxLayout* vlayAgeing = new QVBoxLayout();
|
||||
QGroupBox* m_gbAgeing = new QGroupBox("老化", this);
|
||||
m_gbAgeing->setLayout(vlayAgeing);
|
||||
|
||||
QHBoxLayout* hlayAgeing = new QHBoxLayout();
|
||||
QLabel* labelAgeing = new QLabel("老化(小时)", this);
|
||||
hlayAgeing->addWidget(labelAgeing);
|
||||
m_editAgeing = new LineEditWithKeyboard(this);
|
||||
m_editAgeing->setStyleSheet("QLineEdit {border : 1px solid blue;}");
|
||||
hlayAgeing->addWidget(m_editAgeing);
|
||||
m_btnAgeing = new QPushButton("开始", this);
|
||||
connect(m_btnAgeing, &QPushButton::clicked, this, &settingUiDevTest::slotBtnClicked);
|
||||
m_btnAgeing->setStyleSheet(style);
|
||||
hlayAgeing->addWidget(m_btnAgeing);
|
||||
vlayAgeing->addLayout(hlayAgeing);
|
||||
|
||||
QLabel* labelAgeingTip = new QLabel(this);
|
||||
labelAgeingTip->setWordWrap(true);
|
||||
labelAgeingTip->setText(QString("<font color = #000000 >%1</font>").arg("提示::") + "<br>" +
|
||||
QString("<font color = #000000 >%1</font>").arg("1.开始老化后,满足老化时间,手动关掉老""化开关,恢复出厂设置,才可退出老化模式;") + "<br>" +
|
||||
QString("<font color = #000000 >%1</font>").arg("2.老化时间时断电,之后再次上电,重新开始计时进行老化;") + "<br>" +
|
||||
QString("<font color = #FF0000 >%1</font>").arg("3.老化测试结束后,功能测试完成,需恢复出厂设置") );
|
||||
vlayAgeing->addWidget(labelAgeingTip, 1, Qt::AlignLeft);
|
||||
|
||||
|
||||
QVBoxLayout* vlayDev = new QVBoxLayout();
|
||||
m_gbDev = new QGroupBox("MAC烧录", this);
|
||||
m_gbDev->setLayout(vlayDev);
|
||||
|
||||
QLabel* labelSoftVer = new QLabel("软件版本", this);
|
||||
vlayDev->addWidget(labelSoftVer, 1, Qt::AlignLeft);
|
||||
m_editSoftVer = new QLineEdit(this);
|
||||
m_editSoftVer->setMinimumWidth(UiConfig::GetInstance()->getUiWidth() / 3);
|
||||
m_editSoftVer->setReadOnly(true);
|
||||
m_editSoftVer->setStyleSheet("QLineEdit {border : 1px solid blue;}");
|
||||
vlayDev->addWidget(m_editSoftVer, 1, Qt::AlignLeft);
|
||||
|
||||
QLabel* labelDevCfg = new QLabel("设备配置信息", this);
|
||||
vlayDev->addWidget(labelDevCfg, 1, Qt::AlignLeft);
|
||||
m_editDevCfg = new QLineEdit(this);
|
||||
m_editDevCfg->setMinimumWidth(UiConfig::GetInstance()->getUiWidth() / 3);
|
||||
m_editDevCfg->setReadOnly(true);
|
||||
m_editDevCfg->setStyleSheet("QLineEdit {border : 1px solid blue;}");
|
||||
vlayDev->addWidget(m_editDevCfg, 1, Qt::AlignLeft);
|
||||
|
||||
QLabel* labelMes = new QLabel("MES服务器地址及工单信息", this);
|
||||
vlayDev->addWidget(labelMes, 1, Qt::AlignLeft);
|
||||
m_editMesAddrAndProdNo = new QLineEdit(this);
|
||||
m_editMesAddrAndProdNo->setMinimumWidth(UiConfig::GetInstance()->getUiWidth() / 3);
|
||||
m_editMesAddrAndProdNo->setReadOnly(true);
|
||||
m_editMesAddrAndProdNo->setStyleSheet("QLineEdit {border : 1px solid blue;}");
|
||||
vlayDev->addWidget(m_editMesAddrAndProdNo, 1, Qt::AlignLeft);
|
||||
|
||||
QLabel* labelDevCode = new QLabel("设备条码", this);
|
||||
vlayDev->addWidget(labelDevCode, 1, Qt::AlignLeft);
|
||||
m_editPcbSeq = new QLineEdit(this);
|
||||
m_editPcbSeq->setMinimumWidth(UiConfig::GetInstance()->getUiWidth() / 3);
|
||||
m_editPcbSeq->setReadOnly(true);
|
||||
m_editPcbSeq->setStyleSheet("QLineEdit {border : 1px solid blue;}");
|
||||
vlayDev->addWidget(m_editPcbSeq, 1, Qt::AlignLeft);
|
||||
|
||||
QLabel* labelMac = new QLabel("MAC", this);
|
||||
vlayDev->addWidget(labelMac, 1, Qt::AlignLeft);
|
||||
m_editMac = new QLineEdit(this);
|
||||
m_editMac->setMinimumWidth(UiConfig::GetInstance()->getUiWidth() / 3);
|
||||
m_editMac->setReadOnly(true);
|
||||
m_editMac->setStyleSheet("QLineEdit {border : 1px solid blue;}");
|
||||
vlayDev->addWidget(m_editMac, 1, Qt::AlignLeft);
|
||||
|
||||
vlayDev->setSpacing(5);
|
||||
|
||||
QVBoxLayout* vlayOperation = new QVBoxLayout();
|
||||
QGroupBox* m_gbOperation = new QGroupBox("操作", this);
|
||||
m_gbOperation->setLayout(vlayOperation);
|
||||
|
||||
|
||||
m_btnReboot = new QPushButton("手动重启", this);
|
||||
connect(m_btnReboot, &QPushButton::clicked, this, &settingUiDevTest::slotBtnClicked);
|
||||
m_btnReboot->setStyleSheet(style);
|
||||
vlayOperation->addWidget(m_btnReboot, 1, Qt::AlignCenter);
|
||||
|
||||
m_btnRecover = new QPushButton("恢复出厂设置", this);
|
||||
connect(m_btnRecover, &QPushButton::clicked, this, &settingUiDevTest::slotBtnClicked);
|
||||
m_btnRecover->setStyleSheet(style);
|
||||
vlayOperation->addWidget(m_btnRecover, 1, Qt::AlignCenter);
|
||||
|
||||
QVBoxLayout* vlayLeft = new QVBoxLayout();
|
||||
vlayLeft->addWidget(m_gbAuto, 1, Qt::AlignTop);
|
||||
vlayLeft->addWidget(m_gbDev, 1, Qt::AlignTop);
|
||||
vlayLeft->addStretch(5);
|
||||
|
||||
QVBoxLayout* vlayRight = new QVBoxLayout();
|
||||
vlayRight->addWidget(m_gbMal, 1, Qt::AlignTop);
|
||||
vlayRight->addWidget(m_gbAgeing, 1, Qt::AlignTop);
|
||||
vlayRight->addWidget(m_gbOperation, 1, Qt::AlignTop);
|
||||
vlayRight->addStretch(5);
|
||||
|
||||
QHBoxLayout* hlay = new QHBoxLayout();
|
||||
hlay->addLayout(vlayLeft);
|
||||
hlay->addLayout(vlayRight);
|
||||
|
||||
setLayout(hlay);
|
||||
setStyleSheet(QString("font-size:%1px;background-color:rgb(200, 200, 200);"
|
||||
"border-radius:8px;padding:2px 4px;focus{outline: none;}")
|
||||
.arg(QString::number(FONT_SIZE[UiConfig::GetInstance()->getScreenConfigIndex()])));
|
||||
|
||||
m_timer = new QTimer(this);
|
||||
connect(m_timer, &QTimer::timeout, [this]{delete m_colorScreen;
|
||||
if(m_colorIndex >= color.size()){
|
||||
m_colorIndex = 0;
|
||||
m_timer->stop();
|
||||
showSelectionWin(enMalTestLcd);
|
||||
return;
|
||||
}
|
||||
m_colorScreen = new PureColorPage(color[m_colorIndex++]);
|
||||
m_colorScreen->show();});
|
||||
}
|
||||
|
||||
void settingUiDevTest::reset()
|
||||
{
|
||||
m_backstageIf->stopIdentyState(true, false);
|
||||
|
||||
//const int btnSize = m_btnsMalTest.at(0)->width();
|
||||
const int btnSize = UiConfig::GetInstance()->getUiWidth() / 15;
|
||||
m_btnNtp->setFixedSize(btnSize, btnSize);
|
||||
m_btnAgeing->setFixedSize(btnSize, btnSize);
|
||||
for(int i=0; i<m_btnsAutoTestRetest.size(); i++){
|
||||
m_btnsAutoTestRetest.at(i)->setFixedSize(btnSize, btnSize);
|
||||
}
|
||||
for(int i=0; i<m_btnsMalTest.size(); i++){
|
||||
m_btnsMalTest.at(i)->setFixedSize(btnSize, btnSize);
|
||||
}
|
||||
|
||||
std::string mac;
|
||||
if(m_backstageIf->getKeyDataMac(mac) > 0){
|
||||
m_editMac->setText(mac.c_str());
|
||||
}
|
||||
std::string hours;
|
||||
if(m_backstageIf->isAgeing(hours)){
|
||||
m_editAgeing->setText(hours.c_str());
|
||||
m_btnAgeing->setText("结束");
|
||||
//m_gbAuto->setEnabled(false);
|
||||
//m_gbDev->setEnabled(false);
|
||||
m_btnTest->setEnabled(false);
|
||||
for(int i=0; i<m_btnsAutoTestRetest.size(); i++){
|
||||
m_btnsAutoTestRetest.at(i)->setEnabled(false);
|
||||
}
|
||||
for(int i=0; i<m_btnsMalTest.size(); i++){
|
||||
m_btnsMalTest.at(i)->setEnabled(false);
|
||||
}
|
||||
m_btnNtp->setEnabled(false);
|
||||
m_btnRecover->setEnabled(false);
|
||||
m_btnReboot->setEnabled(false);
|
||||
}
|
||||
else{
|
||||
m_editAgeing->setText("8");
|
||||
m_btnAgeing->setText("开始");
|
||||
//m_gbAuto->setEnabled(true);
|
||||
//m_gbDev->setEnabled(true);
|
||||
m_btnTest->setEnabled(true);
|
||||
for(int i=0; i<m_btnsAutoTestRetest.size(); i++){
|
||||
m_btnsAutoTestRetest.at(i)->setEnabled(true);
|
||||
}
|
||||
for(int i=0; i<m_labelsMalTestItem.size(); i++){
|
||||
m_btnsMalTest.at(i)->setEnabled(true);
|
||||
}
|
||||
m_btnNtp->setEnabled(true);
|
||||
m_btnRecover->setEnabled(true);
|
||||
m_btnReboot->setEnabled(true);
|
||||
}
|
||||
for(auto& item : m_labelsAutoTestRes){
|
||||
item->clear();
|
||||
}
|
||||
|
||||
const int iBufSize = 64;
|
||||
char buf[iBufSize] = {'\0'};
|
||||
if(0 == m_backstageIf->getAppVersion(buf, iBufSize)){
|
||||
m_editSoftVer->setText(buf);
|
||||
buf[strlen("FG_B0xx")] = '\0';
|
||||
if(!QString(buf).contains("B045")){
|
||||
m_labelsAutoTestItem.at(enAutoTestSerial1)->hide();
|
||||
m_labelsAutoTestRes.at(enAutoTestSerial1)->hide();
|
||||
m_btnsAutoTestRetest.at(enAutoTestSerial1)->hide();
|
||||
}
|
||||
}
|
||||
//if(0 == m_backstageIf->getHardwareConfig(buf, iBufSize)){
|
||||
std::string hardware;
|
||||
if(m_backstageIf->getKeyDataHardware(hardware) > 0){
|
||||
refreshUiByHardwareConfig(hardware.c_str());
|
||||
}
|
||||
|
||||
emit signalShowSettingUi();
|
||||
}
|
||||
|
||||
void settingUiDevTest::slotDevTestMesAddrAndProdNoText(const QString& text)
|
||||
{
|
||||
m_editMesAddrAndProdNo->setText(text);
|
||||
if(!m_editPcbSeq->text().isEmpty()){
|
||||
QTimer::singleShot(100, this, [this]{
|
||||
std::string mac;
|
||||
if(0 == m_backstageIf->getMacFromMes(m_editMesAddrAndProdNo->text().toStdString().c_str(),
|
||||
m_editPcbSeq->text().toStdString().c_str(), mac)){
|
||||
m_editMac->setText(mac.c_str());
|
||||
}
|
||||
else{
|
||||
InfoDialog("获取mac地址失败,请重试!").exec();
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiDevTest::slotDevTestPcbSeqText(const QString& text)
|
||||
{
|
||||
m_editPcbSeq->setText(text);
|
||||
if(!m_editMesAddrAndProdNo->text().isEmpty()){
|
||||
QTimer::singleShot(100, this, [this]{
|
||||
std::string mac;
|
||||
if(0 == m_backstageIf->getMacFromMes(m_editMesAddrAndProdNo->text().toStdString().c_str(),
|
||||
m_editPcbSeq->text().toStdString().c_str(), mac)){
|
||||
m_editMac->setText(mac.c_str());
|
||||
}
|
||||
else{
|
||||
InfoDialog("获取mac地址失败,请重试!").exec();
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiDevTest::slotDevTestConfigInfo(const QString& text)
|
||||
{
|
||||
if(text.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
std::string hardware;
|
||||
if(m_backstageIf->getKeyDataHardware(hardware) < 0){
|
||||
return;
|
||||
}
|
||||
|
||||
do{
|
||||
if(hardware.length() && hardware != text.toStdString()){
|
||||
QString que{"设备已有配置信息:"};
|
||||
que += hardware.c_str();
|
||||
que += "\n";
|
||||
que += "是否更新为:";
|
||||
que += text;
|
||||
|
||||
QuestionDialog dlg(que, nullptr, "是的");
|
||||
if(QDialog::Rejected == dlg.exec()){
|
||||
break;
|
||||
}
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
if(hardware == text.toStdString()){
|
||||
break;
|
||||
}
|
||||
|
||||
m_backstageIf->setKeyDataHardwareAndUpdataFunction(text.toStdString());
|
||||
refreshUiByHardwareConfig(text);
|
||||
}while(0);
|
||||
}
|
||||
|
||||
|
||||
void settingUiDevTest::slotClosed()
|
||||
{
|
||||
//m_draw->hide();
|
||||
showSelectionWin(enMalTestTp);
|
||||
}
|
||||
|
||||
|
||||
void settingUiDevTest::slotBtnClicked()
|
||||
{
|
||||
int index = 0;
|
||||
const QVector<std::function<bool()>>funcsAuto{std::bind(&BackstageInterfaceForUi::isWiegandIoTestOk, m_backstageIf),
|
||||
std::bind(&BackstageInterfaceForUi::isRelayAndGpioTestOk, m_backstageIf),
|
||||
std::bind(&BackstageInterfaceForUi::isRs485TestOk, m_backstageIf),
|
||||
std::bind(&BackstageInterfaceForUi::isWifiTestOk, m_backstageIf),
|
||||
std::bind(&BackstageInterfaceForUi::isRtcTestOk, m_backstageIf),
|
||||
//std::bind(&BackstageInterfaceForUi::isWireEthTestOk, m_backstageIf),
|
||||
//std::bind(&BackstageInterfaceForUi::is4gTestOk, m_backstageIf),
|
||||
std::bind(&BackstageInterfaceForUi::isReaderUnderScreenTestOk, m_backstageIf),
|
||||
std::bind(&BackstageInterfaceForUi::isSerial1TestOk, m_backstageIf)
|
||||
//std::bind(&BackstageInterfaceForUi::isIdModuleInfoUploaded, m_backstageIf)
|
||||
};
|
||||
const QVector<std::function<void()>>funcsMal{std::bind([this]{m_colorScreen = new PureColorPage(color[m_colorIndex++]);
|
||||
m_colorScreen->show();m_timer->start(2000);}),
|
||||
std::bind(&settingUiDevTest::doMicrophoneTest, this),
|
||||
std::bind([this]{m_backstageIf->speakerTest();
|
||||
showSelectionWin(enMalTestSpeaker);}),
|
||||
std::bind([this]{if(!m_draw){
|
||||
m_draw = new DrawPage(UiConfig::GetInstance()->getUiWidth(),
|
||||
UiConfig::GetInstance()->getUiHeight());
|
||||
connect(m_draw, SIGNAL(signalClosed()), this, SLOT(slotClosed()));
|
||||
m_draw->show();}else{m_draw->show();}}),
|
||||
std::bind([this]{static_cast<QWidget*>(this->parent()->parent())->hide();
|
||||
QTimer::singleShot(100,this,[this]{
|
||||
m_backstageIf->irCamTest();
|
||||
static_cast<QWidget*>(this->parent()->parent())->show();
|
||||
showSelectionWin(enMalTestIrCam);});}),
|
||||
std::bind([this]{static_cast<QWidget*>(this->parent()->parent())->hide();
|
||||
QTimer::singleShot(100,this,[this]{
|
||||
m_backstageIf->irLedTest();
|
||||
static_cast<QWidget*>(this->parent()->parent())->show();
|
||||
showSelectionWin(enMalTestIrLed);});})
|
||||
};
|
||||
const int size = m_btnsAutoTestRetest.at(0)->height() * 0.6;
|
||||
QPixmap pmOk(":/res/image/ok_small.png");
|
||||
pmOk = pmOk.scaled(size, size);
|
||||
QPixmap pmFailed(":/res/image/fail2_large.png");
|
||||
pmFailed = pmFailed.scaled(size, size);
|
||||
|
||||
const QObject* send = sender();
|
||||
if (send == m_btnTest) {
|
||||
int testItemNum = 0;
|
||||
for(auto& item : m_labelsAutoTestRes){
|
||||
if(!item->isHidden()){
|
||||
item->clear();
|
||||
testItemNum++;
|
||||
}
|
||||
}
|
||||
ProgressWidget pw("自动检测中...");
|
||||
pw.setFixedSize(UiConfig::GetInstance()->getUiWidth() / 2, UiConfig::GetInstance()->getUiHeight() / 6);
|
||||
pw.move((UiConfig::GetInstance()->getUiWidth() - pw.width()) / 2, (UiConfig::GetInstance()->getUiHeight() - pw.height()) / 2);
|
||||
pw.show();
|
||||
int curTestItem = 1;
|
||||
for(auto& item : m_labelsAutoTestRes){
|
||||
if(!item->isHidden()){
|
||||
pw.setMsg(curTestItem++, testItemNum);
|
||||
QCoreApplication::processEvents();
|
||||
m_labelsAutoTestRes[index]->setPixmap(funcsAuto.at(index)() ? pmOk : pmFailed);
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
else if (send == m_btnNtp) {
|
||||
int ret = 0;
|
||||
{
|
||||
m_backstageIf->setNtpServerSw(true);
|
||||
|
||||
#if 0 //测试代码
|
||||
QString testText("192.168.100.250/B045220509-40");
|
||||
std::string ip = getMesSeverIpFromText(testText);
|
||||
LOGI("expect 1 %d", utils::isValidIp(ip));
|
||||
QString testText1("");
|
||||
ip = getMesSeverIpFromText(testText1);
|
||||
LOGI("expect 0 %d", utils::isValidIp(ip));
|
||||
QString testText2("abc");
|
||||
ip = getMesSeverIpFromText(testText2);
|
||||
LOGI("expect 0 %d", utils::isValidIp(ip));
|
||||
#endif
|
||||
std::string mesServerIp = getMesSeverIpFromText(m_editMesAddrAndProdNo->text());
|
||||
#if 0 //工装ntp校时不依赖mes server ip
|
||||
if(!utils::isValidIp(mesServerIp))
|
||||
{
|
||||
InfoDialog("MES服务器地址无效,请重新扫码").exec();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
ProgressWidget pw("NTP校时中...");
|
||||
pw.setFixedSize(UiConfig::GetInstance()->getUiWidth() / 2, UiConfig::GetInstance()->getUiHeight() / 6);
|
||||
pw.move((UiConfig::GetInstance()->getUiWidth() - pw.width()) / 2, (UiConfig::GetInstance()->getUiHeight() - pw.height()) / 2);
|
||||
pw.show();
|
||||
#else
|
||||
MsgDialog msgdlg("NTP校时中...");
|
||||
msgdlg.show();
|
||||
#endif
|
||||
QCoreApplication::processEvents();
|
||||
ret = m_backstageIf->ntpTimeCorrectForDevTest(mesServerIp);
|
||||
}
|
||||
InfoDialog(0 == ret ? "NTP校时成功" : "NTP校时失败,请检查网络!").exec();
|
||||
}
|
||||
else if (send == m_btnAgeing) {
|
||||
if(m_btnAgeing->text() == "开始"){
|
||||
unsigned hours = m_editAgeing->text().toUInt();
|
||||
if(hours > 0){
|
||||
m_backstageIf->ageingTest(hours);
|
||||
m_btnAgeing->setText("结束");
|
||||
m_btnTest->setEnabled(false);
|
||||
for(int i=0; i<m_btnsAutoTestRetest .size(); i++){
|
||||
m_btnsAutoTestRetest.at(i)->setEnabled(false);
|
||||
}
|
||||
for(int i=0; i<m_btnsMalTest.size(); i++){
|
||||
m_btnsMalTest.at(i)->setEnabled(false);
|
||||
}
|
||||
m_btnNtp->setEnabled(false);
|
||||
m_btnRecover->setEnabled(false);
|
||||
m_btnReboot->setEnabled(false);
|
||||
}
|
||||
}
|
||||
else if(m_btnAgeing->text() == "结束"){
|
||||
m_backstageIf->ageingTest(0);
|
||||
m_btnAgeing->setText("开始");
|
||||
m_btnTest->setEnabled(true);
|
||||
for(int i=0; i<m_btnsAutoTestRetest .size(); i++){
|
||||
m_btnsAutoTestRetest.at(i)->setEnabled(true);
|
||||
}
|
||||
for(int i=0; i<m_labelsMalTestItem.size(); i++){
|
||||
m_btnsMalTest.at(i)->setEnabled(true);
|
||||
}
|
||||
m_btnNtp->setEnabled(true);
|
||||
m_btnRecover->setEnabled(true);
|
||||
m_btnReboot->setEnabled(true);
|
||||
//在工装界面结束老化,会恢复人脸识别,需要重新停止识别,并且延迟一段时间停止保证在恢复之后执行
|
||||
QTimer::singleShot(200, this, [this]{m_backstageIf->stopIdentyState(true, false);});
|
||||
}
|
||||
}
|
||||
else if (send == m_btnRecover || send == m_btnReboot) {
|
||||
QString que;
|
||||
QString btnText;
|
||||
if(send == m_btnReboot){
|
||||
que = tr("您确定重新启动FaceTick吗?");
|
||||
btnText = tr("重新启动");
|
||||
}
|
||||
else if(send == m_btnRecover){
|
||||
que = tr("您确定恢复出厂设置吗?");
|
||||
btnText = tr("恢复");
|
||||
}
|
||||
QuestionDialog dlg(que, nullptr, btnText);
|
||||
if(QDialog::Accepted == dlg.exec()){
|
||||
if(send == m_btnRecover){
|
||||
qDebug() << "recoveryFactorySetting";
|
||||
m_backstageIf->recoveryFactorySetting();
|
||||
}
|
||||
PureColorPage* black = new PureColorPage(0);
|
||||
black->show();
|
||||
QTimer::singleShot(1000, this, [this]{qDebug() << "devReboot";m_backstageIf->devReboot();});
|
||||
}
|
||||
}
|
||||
else {
|
||||
index = 0;
|
||||
for(auto& btn : m_btnsAutoTestRetest){
|
||||
if(send == btn){
|
||||
m_labelsAutoTestRes[index]->clear();
|
||||
MsgDialog msgdlg("检测中...");
|
||||
msgdlg.show();
|
||||
QCoreApplication::processEvents();
|
||||
m_labelsAutoTestRes[index]->setPixmap(funcsAuto.at(index)() ? pmOk : pmFailed);
|
||||
return;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
for(auto& btn : m_btnsMalTest){
|
||||
if(send == btn){
|
||||
btn->setEnabled(false);
|
||||
//InfoDialog(QString("通过要求:\n") + m_malTestTips.at(index)).exec();
|
||||
QCoreApplication::processEvents();
|
||||
funcsMal.at(index)();
|
||||
btn->setEnabled(true);
|
||||
return;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiDevTest::showSelectionWin(int testIndex) {
|
||||
const int size = m_btnsMalTest.at(0)->height() * 0.6;
|
||||
QPixmap pmOk(":/res/image/ok_small.png");
|
||||
pmOk = pmOk.scaled(size, size);
|
||||
QPixmap pmFailed(":/res/image/fail2_large.png");
|
||||
pmFailed = pmFailed.scaled(size, size);
|
||||
SelectionDialog dlg(m_malTestTips.at(testIndex), "不通过", "通过");
|
||||
|
||||
auto manufacturer = DevVersion::getInstance()->getManu();
|
||||
if (testIndex == enMalTestAuidoSwitch) {
|
||||
m_labelsMalTestRes.at(enMalTestSpeaker)->setPixmap(dlg.selecion() == 1 ? pmOk : pmFailed);
|
||||
} else if (testIndex == enMalTestSpeaker &&
|
||||
(manufacturer == Manu_E::ManuRWRk1109V05)) { // V05以上 板载喇叭测试成功后,再测试外部音频输出
|
||||
if (dlg.selecion() == 1) {
|
||||
doAuidoSwitchTest();
|
||||
} else {
|
||||
m_labelsMalTestRes.at(testIndex)->setPixmap(pmFailed);
|
||||
}
|
||||
} else {
|
||||
|
||||
m_labelsMalTestRes.at(testIndex)->setPixmap(dlg.selecion() == 1 ? pmOk : pmFailed);
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiDevTest::doMicrophoneTest() {
|
||||
m_backstageIf->microphoneTest(true);
|
||||
SelectionDialog dlg("录音中,请面对设备屏幕70CM说话", "", "录音结束并播放录音");
|
||||
if (dlg.selecion() == 1) {
|
||||
m_backstageIf->microphoneTest(false);
|
||||
showSelectionWin(enMalTestMicrophone);
|
||||
} else {
|
||||
const int size = m_btnsMalTest.at(0)->height() * 0.6;
|
||||
QPixmap pmFailed(":/res/image/fail2_large.png");
|
||||
pmFailed = pmFailed.scaled(size, size);
|
||||
m_labelsMalTestRes.at(enMalTestSpeaker)->setPixmap(pmFailed);
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiDevTest::doAuidoSwitchTest() {
|
||||
SelectionDialog dlg("请接入外部音响,并将开关拨至正确位置", "", "已完成");
|
||||
if (dlg.selecion() == 1) {
|
||||
m_backstageIf->audioSwitchTest();
|
||||
showSelectionWin(enMalTestAuidoSwitch);
|
||||
} else {
|
||||
const int size = m_btnsMalTest.at(0)->height() * 0.6;
|
||||
QPixmap pmFailed(":/res/image/fail2_large.png");
|
||||
pmFailed = pmFailed.scaled(size, size);
|
||||
m_labelsMalTestRes.at(enMalTestSpeaker)->setPixmap(pmFailed);
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiDevTest::refreshUiByHardwareConfig(const QString& hardware)
|
||||
{
|
||||
m_editDevCfg->setText(hardware);
|
||||
|
||||
//HW300102 0 1 C1 1 01H
|
||||
bool hasReaderUnderScreen = (hardware[8] == '2');
|
||||
if(hasReaderUnderScreen){//注意测试项索引
|
||||
m_labelsAutoTestItem.at(enAutoTestReaderUnderScreen)->show();
|
||||
m_labelsAutoTestRes.at(enAutoTestReaderUnderScreen)->show();
|
||||
m_btnsAutoTestRetest.at(enAutoTestReaderUnderScreen)->show();
|
||||
}
|
||||
else{
|
||||
m_labelsAutoTestItem.at(enAutoTestReaderUnderScreen)->hide();
|
||||
m_labelsAutoTestRes.at(enAutoTestReaderUnderScreen)->hide();
|
||||
m_btnsAutoTestRetest.at(enAutoTestReaderUnderScreen)->hide();
|
||||
}
|
||||
bool hasWifi = (hardware[9] == '2');
|
||||
if(hasWifi){//注意测试项索引
|
||||
m_labelsAutoTestItem.at(enAutoTestWifi)->show();
|
||||
m_labelsAutoTestRes.at(enAutoTestWifi)->show();
|
||||
m_btnsAutoTestRetest.at(enAutoTestWifi)->show();
|
||||
}
|
||||
else{
|
||||
m_labelsAutoTestItem.at(enAutoTestWifi)->hide();
|
||||
m_labelsAutoTestRes.at(enAutoTestWifi)->hide();
|
||||
m_btnsAutoTestRetest.at(enAutoTestWifi)->hide();
|
||||
}
|
||||
bool hasTp = (hardware[12] == '1');
|
||||
if(hasTp){//注意测试项索引
|
||||
m_labelsMalTestItem.at(enMalTestTp)->show();
|
||||
m_labelsMalTestRes.at(enMalTestTp)->show();
|
||||
m_btnsMalTest.at(enMalTestTp)->show();
|
||||
}
|
||||
else{
|
||||
m_labelsMalTestItem.at(enMalTestTp)->hide();
|
||||
m_labelsMalTestRes.at(enMalTestTp)->hide();
|
||||
m_btnsMalTest.at(enMalTestTp)->hide();
|
||||
}
|
||||
|
||||
auto manufacturer = DevVersion::getInstance()->getManu();
|
||||
if (manufacturer == Manu_E::ManuRWRk1109V05) {
|
||||
m_malTest[enMalTestSpeaker] = "喇叭/音频输出";
|
||||
} else {
|
||||
m_malTest[enMalTestSpeaker] = "喇叭";
|
||||
}
|
||||
m_labelsMalTestItem.at(enMalTestSpeaker)->setText(m_malTest.at(enMalTestSpeaker));
|
||||
}
|
||||
|
||||
std::string settingUiDevTest::getMesSeverIpFromText(const QString& text)
|
||||
{
|
||||
//text 例"192.168.100.250:8080/B045220509-40" "192.168.100.250/B045220509-40"
|
||||
|
||||
QString mesServerIp("");
|
||||
if(!text.isEmpty())
|
||||
{
|
||||
QStringList list = text.split("/");
|
||||
QStringList strList = list[0].split(":");
|
||||
mesServerIp = strList[0];
|
||||
}
|
||||
LOGI("mesServerIp %s", mesServerIp.toStdString().c_str());
|
||||
//qDebug()<<"mesServerIp "<<mesServerIp;
|
||||
return mesServerIp.toStdString();
|
||||
}
|
||||
|
103
Linguist/setUi/settingUiDevTest.h
Normal file
103
Linguist/setUi/settingUiDevTest.h
Normal file
@ -0,0 +1,103 @@
|
||||
#ifndef SETTINGUIDEVTEST_H
|
||||
#define SETTINGUIDEVTEST_H
|
||||
|
||||
#include "UiTools.h"
|
||||
#include "UiConfig.h"
|
||||
#include <QTimer>
|
||||
#include <QGroupBox>
|
||||
|
||||
|
||||
class settingUiDevTest : public MyWidgetWithMainStyleColor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum{
|
||||
enAutoTestWg,
|
||||
enAutoTestRelayAndGpio,
|
||||
enAutoTestRs485,
|
||||
enAutoTestWifi,
|
||||
enAutoTestRtc,
|
||||
enAutoTestReaderUnderScreen,
|
||||
enAutoTestSerial1,
|
||||
//enAutoTestIdModuleInfoUpload
|
||||
};
|
||||
enum{
|
||||
enMalTestLcd,
|
||||
enMalTestMicrophone, // 麦克风测试
|
||||
enMalTestSpeaker,
|
||||
enMalTestTp,
|
||||
enMalTestIrCam,
|
||||
enMalTestIrLed,
|
||||
enMalTestAuidoSwitch, // 测试外部 韦根输出、音频输出 GPIO切换功能
|
||||
};
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiDevTest(int pageIndex, QWidget *parent = nullptr);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
void signalShowSettingUi();
|
||||
|
||||
public slots:
|
||||
void slotBtnClicked();
|
||||
void slotDevTestMesAddrAndProdNoText(const QString& text);
|
||||
void slotDevTestPcbSeqText(const QString& text);
|
||||
void slotDevTestConfigInfo(const QString& text);
|
||||
void slotClosed();
|
||||
|
||||
protected:
|
||||
void doAuidoSwitchTest();
|
||||
void doMicrophoneTest();
|
||||
|
||||
private:
|
||||
const QStringList m_autoTest = {"韦根输入输出", "继电器和GPIO", "RS485", "WIFI", "实时时钟", "屏下刷卡", "板载uart3"};//, "NFC模块上报ID", "有线网络", "4G模块"
|
||||
QStringList m_malTest = {"显示屏", "麦克风", "喇叭", "触摸屏", "红外镜头", "红外补光灯"};
|
||||
const QStringList m_malTestTips = {"屏幕显示白色、黑色、灰色、\n红色、绿色、蓝色,屏幕无条纹,\n无坏点,无闪烁,无色差",
|
||||
"播放内容完整,声音清晰,无噪音",
|
||||
"喇叭播放测试语音,声音清晰、无噪音",
|
||||
"触摸屏画线无异常",
|
||||
"红外镜头成像清晰",
|
||||
"红外镜头画面有明暗交替变化",
|
||||
"外部喇叭播放测试语音,声音清晰、无噪音",
|
||||
};
|
||||
const int FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY] = {30, 35, 35, 23, 23};
|
||||
const QVector<unsigned> color{0xFFFFFF, 0, 0xDDDDDD, 0xFF0000, 0xFF00, 0xFF};
|
||||
|
||||
QGroupBox* m_gbAuto;
|
||||
QPushButton* m_btnTest;
|
||||
QVector<QLabel*> m_labelsAutoTestItem;
|
||||
QVector<QLabel*> m_labelsAutoTestRes;
|
||||
QVector<QPushButton*> m_btnsAutoTestRetest;
|
||||
|
||||
|
||||
QGroupBox* m_gbMal;
|
||||
QVector<QLabel*> m_labelsMalTestItem;
|
||||
QVector<QLabel*> m_labelsMalTestRes;
|
||||
QVector<QPushButton*> m_btnsMalTest;
|
||||
|
||||
QPushButton* m_btnNtp;
|
||||
|
||||
QPushButton* m_btnAgeing;
|
||||
LineEditWithKeyboard* m_editAgeing;
|
||||
|
||||
QPushButton* m_btnRecover;
|
||||
|
||||
QGroupBox* m_gbDev;
|
||||
QLineEdit* m_editSoftVer;
|
||||
QLineEdit* m_editDevCfg;
|
||||
QLineEdit* m_editMesAddrAndProdNo;
|
||||
QLineEdit* m_editPcbSeq;
|
||||
QLineEdit* m_editMac;
|
||||
QPushButton* m_btnReboot;
|
||||
|
||||
QTimer* m_timer = nullptr;
|
||||
PureColorPage* m_colorScreen = nullptr;
|
||||
int m_colorIndex = 0;
|
||||
DrawPage* m_draw = nullptr;
|
||||
|
||||
void showSelectionWin(int testIndex);
|
||||
void refreshUiByHardwareConfig(const QString& hardware);
|
||||
std::string getMesSeverIpFromText(const QString& text);
|
||||
};
|
||||
|
||||
#endif // SETTINGUIDEVTEST_H
|
984
Linguist/setUi/settingUiFaceMng.cpp
Normal file
984
Linguist/setUi/settingUiFaceMng.cpp
Normal file
@ -0,0 +1,984 @@
|
||||
#include "settingUiFaceMng.h"
|
||||
#include <QDebug>
|
||||
#include "UiConfig.h"
|
||||
#include <QButtonGroup>
|
||||
#include "recoUiRecognize.h"
|
||||
int settingUiFaceMng::m_pageIndex = 0;
|
||||
settingUiFaceMng::settingUiFaceMng(int pageIndex, QWidget *parent)
|
||||
: SettingUiPage(QVector<SettingUiPage::SetOpn>{
|
||||
SetOpn(tr("人脸库(人)"), "xxxxx", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("通行记录(条)"), "xxxxxx", myListWidget::enPropertyMoreArrow)
|
||||
}, parent)
|
||||
{
|
||||
m_pageIndex = pageIndex;
|
||||
qDebug() << "settingUiFaceMng()";
|
||||
}
|
||||
|
||||
settingUiFaceMng::~settingUiFaceMng()
|
||||
{
|
||||
qDebug() << "~settingUiFaceMng()";
|
||||
}
|
||||
|
||||
void settingUiFaceMng::setBackstageUiinterface(BackstageInterfaceForUi* interface)
|
||||
{
|
||||
m_backstageIf = interface;
|
||||
reset();
|
||||
}
|
||||
|
||||
void settingUiFaceMng::reset()
|
||||
{
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < config.size(); i ++)
|
||||
{
|
||||
QListWidgetItem* pItem = m_listWidget->item(i);
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(pItem));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
QString str;
|
||||
switch(i)
|
||||
{
|
||||
case enFaceDb:
|
||||
str = QString::number(m_backstageIf->getRegisterNum());
|
||||
break;
|
||||
case enAccessRecord:
|
||||
str = QString::number(m_backstageIf->getAccessRecordQty());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
wdt->updateLabel(str);
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiFaceMng::slotItemClicked(QListWidgetItem* item)
|
||||
{
|
||||
int row = m_listWidget->currentRow();
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
switch(row){
|
||||
case enFaceDb:
|
||||
emit signalShowPage(FaceDbPage::m_pageIndex);
|
||||
break;
|
||||
case enAccessRecord:
|
||||
emit signalShowPage(AccessRecordPage::m_pageIndex);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int FaceDbPage::m_pageIndex = 0;
|
||||
FaceDbPage::FaceDbPage(int pageIndex, QWidget *parent) : PersonMsgUiPage(parent)
|
||||
{
|
||||
qDebug() << "FaceDbPage";
|
||||
m_pageIndex = pageIndex;
|
||||
QLabel* label = new QLabel(tr("未搜索到相关人员"), m_stackWgt);
|
||||
label->setAlignment(Qt::AlignHCenter);
|
||||
m_stackWgt->addWidget(label);
|
||||
}
|
||||
|
||||
void FaceDbPage::reset()
|
||||
{
|
||||
slotTextChanged("");
|
||||
m_editSearch[enSearchOpnName]->clear();
|
||||
}
|
||||
|
||||
void FaceDbPage::clickBtn_addPerson()
|
||||
{
|
||||
emit signalShowPage(AddPersonPage::m_pageIndex);
|
||||
}
|
||||
|
||||
void FaceDbPage::slotTextChanged(const QString& text)
|
||||
{
|
||||
int searchOpnIndex = 0;
|
||||
if(sender() == m_editSearch[enSearchOpnName]){
|
||||
searchOpnIndex = static_cast<int>(enSearchOpnName);
|
||||
qDebug() << "FaceDbPage text change:" << text;
|
||||
m_sSearchName = text;
|
||||
}
|
||||
else if(sender() == m_editSearch[enSearchOpnTime]){
|
||||
searchOpnIndex = static_cast<int>(enSearchOpnTime);
|
||||
m_sSearchtime = text;
|
||||
}
|
||||
|
||||
qDebug() << "m_sSearchName:" << m_sSearchName;
|
||||
|
||||
if(m_backstageIf){
|
||||
unsigned personQty = m_backstageIf->queryPerson(m_sSearchName.toStdString().c_str());
|
||||
//qDebug() << "queryPerson ret:" << personQty;
|
||||
if(personQty){
|
||||
showFaceMsg(0);
|
||||
m_stackWgt->setCurrentIndex(0);
|
||||
setPageControlBarHide(personQty <= m_itemQty, 1, static_cast<int>(!!(personQty % m_itemQty) + (personQty / m_itemQty)), 1);
|
||||
}
|
||||
else {
|
||||
m_stackWgt->setCurrentIndex(1);
|
||||
setPageControlBarHide(true);
|
||||
}
|
||||
}
|
||||
if("" != text){
|
||||
m_btnClearSearch[searchOpnIndex]->show();
|
||||
m_labelTip[searchOpnIndex]->hide();
|
||||
}
|
||||
else {
|
||||
m_btnClearSearch[searchOpnIndex]->hide();
|
||||
m_labelTip[searchOpnIndex]->show();
|
||||
}
|
||||
}
|
||||
|
||||
void FaceDbPage::showFaceMsg(int pageIndex)
|
||||
{
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
stQueryPersonInfo person[m_itemQty];
|
||||
#if 0
|
||||
for(unsigned j=0; j<m_itemQty; j++){
|
||||
person[j].name[0] = '\0';
|
||||
person[j].imgPath[0] = '\0';
|
||||
strcpy(person[j].expTime, tr("有效期:").toStdString().c_str());
|
||||
strcpy(person[j].regTime, tr("注册时间:").toStdString().c_str());
|
||||
}
|
||||
#endif
|
||||
m_lastPageIndex = pageIndex;
|
||||
unsigned personReadQty = m_backstageIf->queryPerson(m_sSearchName.toStdString().c_str(), pageIndex, person, static_cast<int>(m_itemQty));
|
||||
QVector<PersonMsgUiPage::MsgSet> msgs;
|
||||
if(personReadQty){
|
||||
for(unsigned i=0; i<personReadQty; i++){
|
||||
if(i < 5)
|
||||
{
|
||||
m_person[i] = person[i];
|
||||
}
|
||||
|
||||
const QVector<PersonMsgUiPage::MsgOpn> opns{{person[i].name.c_str(), PersonMsgUiPage::MsgOpnProp::enPropertyBold},
|
||||
{QString(person[i].expTime.c_str()).lastIndexOf("3000") >= 0 ? tr("有效期:永久有效") : QString(person[i].expTime.c_str()),
|
||||
PersonMsgUiPage::MsgOpnProp::enPropertyGreyWord},
|
||||
{person[i].regTime.c_str(), PersonMsgUiPage::MsgOpnProp::enPropertyGreyWord}};
|
||||
msgs.append(PersonMsgUiPage::MsgSet(person[i].imgPath.c_str(), opns));
|
||||
}
|
||||
#if 0
|
||||
if(personReadQty < m_itemQty){
|
||||
msgs.append(PersonMsgUiPage::MsgSet("", QVector<PersonMsgUiPage::MsgOpn>()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
showMsg(msgs);
|
||||
}
|
||||
|
||||
void FaceDbPage::slotBtnClicked()
|
||||
{
|
||||
PersonMsgUiPage::slotBtnClicked();
|
||||
showFaceMsg(m_toPageNum - 1);
|
||||
}
|
||||
|
||||
void FaceDbPage::slotSliderReleased()
|
||||
{
|
||||
PersonMsgUiPage::slotSliderReleased();
|
||||
showFaceMsg(m_toPageNum - 1);
|
||||
}
|
||||
|
||||
void FaceDbPage::slotItemClicked(QListWidgetItem *item)
|
||||
{
|
||||
int row = m_listWidget->currentRow();
|
||||
qDebug() << __PRETTY_FUNCTION__ << " row=" << row;
|
||||
|
||||
if(row < 5)
|
||||
{
|
||||
emit signalPersonInfo(m_person[row]);
|
||||
emit signalShowPage(ModifyPersonPage::m_pageIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void FaceDbPage::slot_freshPage()
|
||||
{
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
//数据库更新,刷新最后一次的页面
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned personQty = m_backstageIf->queryPerson(m_sSearchName.toStdString().c_str());
|
||||
//qDebug() << "queryPerson ret:" << personQty;
|
||||
if(personQty){
|
||||
int maxPageNum = !!(personQty % m_itemQty) + (personQty / m_itemQty);
|
||||
int showPageIndex = m_lastPageIndex < maxPageNum ? m_lastPageIndex : (maxPageNum-1);
|
||||
showFaceMsg(showPageIndex);
|
||||
m_stackWgt->setCurrentIndex(0);
|
||||
setPageControlBarHide(personQty <= m_itemQty, 1, maxPageNum, showPageIndex+1);
|
||||
}
|
||||
else {
|
||||
m_stackWgt->setCurrentIndex(1);
|
||||
setPageControlBarHide(true);
|
||||
}
|
||||
}
|
||||
|
||||
int AccessRecordPage::m_pageIndex = 0;
|
||||
AccessRecordPage::AccessRecordPage(int pageIndex, QWidget *parent) : PersonMsgUiPage(parent)
|
||||
{
|
||||
qDebug() << "AccessRecordPage";
|
||||
m_pageIndex = pageIndex;
|
||||
QLabel* label = new QLabel(tr("未搜索到相关通行记录"), m_stackWgt);
|
||||
label->setAlignment(Qt::AlignHCenter);
|
||||
m_stackWgt->addWidget(label);
|
||||
showMoreSearchOpn();
|
||||
}
|
||||
|
||||
void AccessRecordPage::slotTextChanged(const QString& text)
|
||||
{
|
||||
int searchOpnIndex = 0;
|
||||
if(sender() == m_editSearch[enSearchOpnName]){
|
||||
searchOpnIndex = static_cast<int>(enSearchOpnName);
|
||||
qDebug() << "AccessRecordPage name text change:" << text;
|
||||
m_sSearchName = text;
|
||||
}
|
||||
else if(sender() == m_editSearch[enSearchOpnTime]){
|
||||
searchOpnIndex = static_cast<int>(enSearchOpnTime);
|
||||
qDebug() << "AccessRecordPage time text change:" << text;
|
||||
m_sSearchtime = text;
|
||||
}
|
||||
|
||||
if(m_backstageIf){
|
||||
unsigned recordQty = m_backstageIf->queryAccessRecord("" != m_sSearchName.toStdString() ? m_sSearchName.toStdString().c_str() : nullptr,
|
||||
"" != m_sSearchtime.toStdString() ? m_sSearchtime.toStdString().c_str() : nullptr);
|
||||
//qDebug() << "recordQty ret:" << recordQty;
|
||||
if(recordQty){
|
||||
showAccessRecordMsg(0);
|
||||
m_stackWgt->setCurrentIndex(0);
|
||||
setPageControlBarHide(recordQty <= m_itemQty, 1, static_cast<int>(!!(recordQty % m_itemQty) + (recordQty / m_itemQty)), 1);
|
||||
}
|
||||
else {
|
||||
m_stackWgt->setCurrentIndex(1);
|
||||
setPageControlBarHide(true);
|
||||
}
|
||||
}
|
||||
if("" != text){
|
||||
m_btnClearSearch[searchOpnIndex]->show();
|
||||
m_labelTip[searchOpnIndex]->hide();
|
||||
}
|
||||
else {
|
||||
m_btnClearSearch[searchOpnIndex]->hide();
|
||||
m_labelTip[searchOpnIndex]->show();
|
||||
}
|
||||
}
|
||||
|
||||
void AccessRecordPage::showAccessRecordMsg(int pageIndex)
|
||||
{
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
stQueryAccRedInfo record[m_itemQty];
|
||||
for(unsigned j=0; j<m_itemQty; j++){
|
||||
record[j].name[0] = '\0';
|
||||
record[j].imgPath[0] = '\0';
|
||||
strcpy(record[j].accessTime, tr("通行时间:").toStdString().c_str());
|
||||
}
|
||||
qDebug() << "name:" << m_sSearchName << ", time:" << m_sSearchtime << ", page index:" << pageIndex;
|
||||
unsigned recordQty = m_backstageIf->queryAccessRecord("" != m_sSearchName.toStdString() ? m_sSearchName.toStdString().c_str() : nullptr,
|
||||
"" != m_sSearchtime.toStdString() ? m_sSearchtime.toStdString().c_str() : nullptr,
|
||||
pageIndex, record, static_cast<int>(m_itemQty));
|
||||
QVector<PersonMsgUiPage::MsgSet> msgs;
|
||||
for(unsigned i=0; i<recordQty; i++){
|
||||
const QVector<PersonMsgUiPage::MsgOpn> opns{
|
||||
{record[i].name, PersonMsgUiPage::MsgOpnProp::enPropertyBold},
|
||||
{record[i].accessTime, PersonMsgUiPage::MsgOpnProp::enPropertyGreyWord},
|
||||
{record[i].allowPass ? tr("通过") : tr("不通过"),
|
||||
record[i].allowPass ? PersonMsgUiPage::MsgOpnProp::enPropertyGreenWord : PersonMsgUiPage::MsgOpnProp::enPropertyRedWord}
|
||||
};
|
||||
msgs.append(PersonMsgUiPage::MsgSet(record[i].imgPath, opns));
|
||||
}
|
||||
#if 0
|
||||
if(recordQty < m_itemQty){
|
||||
msgs.append(PersonMsgUiPage::MsgSet("", QVector<PersonMsgUiPage::MsgOpn>()));
|
||||
}
|
||||
#endif
|
||||
showMsg(msgs);
|
||||
}
|
||||
|
||||
void AccessRecordPage::slotBtnClicked()
|
||||
{
|
||||
PersonMsgUiPage::slotBtnClicked();
|
||||
if(sender() == m_btnPrePage || sender() == m_btnNextPage){
|
||||
qDebug() << "slotBtnClicked : page num" << m_toPageNum;
|
||||
showAccessRecordMsg(m_toPageNum - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void AccessRecordPage::slotSliderReleased()
|
||||
{
|
||||
PersonMsgUiPage::slotSliderReleased();
|
||||
qDebug() << "slotSliderReleased : page num" << m_toPageNum;
|
||||
showAccessRecordMsg(m_toPageNum - 1);
|
||||
}
|
||||
|
||||
void AccessRecordPage::reset()
|
||||
{
|
||||
m_sSearchtime = "";
|
||||
slotTextChanged("");
|
||||
m_editSearch[enSearchOpnName]->clear();
|
||||
m_editSearch[enSearchOpnTime]->clear();
|
||||
}
|
||||
|
||||
RegisterPersonPage::RegisterPersonPage(QWidget *parent) : MyWidgetWithMainStyleColor(parent)
|
||||
{
|
||||
m_listWidget = new QListWidget(this);
|
||||
m_listWidget->setFrameStyle(QFrame::NoFrame);
|
||||
m_listWidget->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
m_listWidget->setFocusPolicy(Qt::NoFocus);
|
||||
m_listWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
m_listWidget->setSpacing(0);
|
||||
m_listWidget->setStyleSheet("QListWidget{border-width:0;border-style:outset; background:rgb(255, 255, 255);border-top: 1px solid #DFDDEB;}"
|
||||
"QListWidget::item{border-bottom: 1px solid #DFDDEB;}"
|
||||
"QListWidget::Item:hover{background:transparent;}"
|
||||
"QListWidget::item:selected{background:transparent; }");
|
||||
m_listWidget->setFixedSize(UiConfig::GetInstance()->getUiWidth(), static_cast<int>(UiConfig::GetInstance()->getUiHeight() / 0.6));
|
||||
connect(m_listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotItemClicked(QListWidgetItem*)));
|
||||
|
||||
//图片
|
||||
m_picWidget = new QWidget(this);
|
||||
m_picLabel = new QLabel(m_picWidget);
|
||||
m_picLabel->setFixedSize(static_cast<int>(UiConfig::GetInstance()->getUiWidth() / 4), static_cast<int>(UiConfig::GetInstance()->getUiHeight() / 10));
|
||||
//m_picLabel->setStyleSheet("background-color: white;");
|
||||
QLabel *label_pic = new QLabel("*人脸图片", m_picWidget);
|
||||
QHBoxLayout* picWidgetLayout = new QHBoxLayout();
|
||||
//QSpacerItem* hSpace1 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
picWidgetLayout->addWidget(label_pic);
|
||||
picWidgetLayout->addWidget(m_picLabel, 0, Qt::AlignRight);
|
||||
m_picWidget->setLayout(picWidgetLayout);
|
||||
//QPixmap faceImg(":/res/image/add.png");
|
||||
QPixmap faceImg(":/res/image/add.jpg");
|
||||
m_picLabel->setPixmap(ScalePixmap2Label(faceImg, *m_picLabel));
|
||||
//m_picLabel->setFixedSize(104, 105);
|
||||
//m_picLabel->setPixmap(faceImg);
|
||||
//m_picLabel->setPixmap(ScalePixmap(faceImg, QSize(m_picLabel->width()-1, m_picLabel->height()-1)));
|
||||
|
||||
//授权期限选择
|
||||
m_deadlineChoiceWidget = new QWidget(this);
|
||||
m_deadlineBtnGrp = new QButtonGroup(m_deadlineChoiceWidget);
|
||||
QLabel *label_choice = new QLabel("*授权", m_deadlineChoiceWidget);
|
||||
|
||||
m_durableBtn = new QRadioButton(m_deadlineChoiceWidget);
|
||||
m_durableBtn->setText(tr("永久授权"));
|
||||
m_durableBtn->setStyleSheet(QString("QRadioButton::indicator { width: %1px; height: %2px; }")
|
||||
.arg(UiConfig::GetInstance()->getUiHeight() / 30)
|
||||
.arg(UiConfig::GetInstance()->getUiHeight() / 30));
|
||||
m_durableBtn->setStyleSheet("QRadioButton::indicator:unchecked{image: url(:/res/image/select_1.png);}"
|
||||
"QRadioButton::indicator:checked{image: url(:/res/image/select_2.png);}");
|
||||
m_durableBtn->setFocusPolicy(Qt::NoFocus);
|
||||
m_nondurableBtn = new QRadioButton(m_deadlineChoiceWidget);
|
||||
m_nondurableBtn->setText(tr("非永久授权"));
|
||||
m_nondurableBtn->setStyleSheet(QString("QRadioButton::indicator { width: %1px; height: %2px; }")
|
||||
.arg(UiConfig::GetInstance()->getUiHeight() / 30)
|
||||
.arg(UiConfig::GetInstance()->getUiHeight() / 30));
|
||||
m_nondurableBtn->setStyleSheet("QRadioButton::indicator:unchecked{image: url(:/res/image/select_1.png);}"
|
||||
"QRadioButton::indicator:checked{image: url(:/res/image/select_2.png);}");
|
||||
m_nondurableBtn->setFocusPolicy(Qt::NoFocus);
|
||||
m_deadlineBtnGrp->addButton(m_durableBtn, 0);
|
||||
m_deadlineBtnGrp->addButton(m_nondurableBtn, 1);
|
||||
m_durableBtn->setChecked(true);
|
||||
QHBoxLayout* deadlineChoiceLayout = new QHBoxLayout();
|
||||
deadlineChoiceLayout->addWidget(label_choice);
|
||||
deadlineChoiceLayout->addWidget(m_durableBtn);
|
||||
deadlineChoiceLayout->addWidget(m_nondurableBtn);
|
||||
m_deadlineChoiceWidget->setLayout(deadlineChoiceLayout);
|
||||
connect(m_deadlineBtnGrp, SIGNAL(buttonClicked(int)), this, SLOT(slotDeadlineBtnClicked(int)));
|
||||
|
||||
m_nameWidget = new myListWidget(myListWidget::SetOpnCfg(tr("*姓名"), "", myListWidget::enPropertyMoreArrow));
|
||||
m_deadlineWidget = new myListWidget(myListWidget::SetOpnCfg(tr("*授权截至日期"), "", myListWidget::enPropertyMoreArrow));
|
||||
m_jobNumWidget = new myListWidget(myListWidget::SetOpnCfg(tr("工号"), "", myListWidget::enPropertyMoreArrow));
|
||||
m_phoneNumWidget = new myListWidget(myListWidget::SetOpnCfg(tr("手机号"), "", myListWidget::enPropertyMoreArrow));
|
||||
m_idCardWidget = new myListWidget(myListWidget::SetOpnCfg(tr("身份证号"), "", myListWidget::enPropertyMoreArrow));
|
||||
m_icCardWidget = new myListWidget(myListWidget::SetOpnCfg(tr("IC卡/NFC"), "", myListWidget::enPropertyMoreArrow));
|
||||
|
||||
QListWidgetItem* pItem;
|
||||
pItem = new QListWidgetItem(m_listWidget);
|
||||
pItem->setSizeHint(QSize(UiConfig::GetInstance()->getUiHeight() / 8, UiConfig::GetInstance()->getUiHeight() / 8));
|
||||
m_listWidget->setItemWidget(pItem, m_picWidget);
|
||||
|
||||
pItem = new QListWidgetItem(m_listWidget);
|
||||
pItem->setSizeHint(QSize(UiConfig::GetInstance()->getUiHeight() / 12, UiConfig::GetInstance()->getUiHeight() / 12));
|
||||
m_listWidget->setItemWidget(pItem, m_nameWidget);
|
||||
|
||||
pItem = new QListWidgetItem(m_listWidget);
|
||||
pItem->setSizeHint(QSize(UiConfig::GetInstance()->getUiHeight() / 12, UiConfig::GetInstance()->getUiHeight() / 12));
|
||||
m_listWidget->setItemWidget(pItem, m_deadlineChoiceWidget);
|
||||
|
||||
pItem = new QListWidgetItem(m_listWidget);
|
||||
pItem->setSizeHint(QSize(UiConfig::GetInstance()->getUiHeight() / 12, UiConfig::GetInstance()->getUiHeight() / 12));
|
||||
m_listWidget->setItemWidget(pItem, m_deadlineWidget);
|
||||
|
||||
pItem = new QListWidgetItem(m_listWidget);
|
||||
pItem->setSizeHint(QSize(UiConfig::GetInstance()->getUiHeight() / 12, UiConfig::GetInstance()->getUiHeight() / 12));
|
||||
m_listWidget->setItemWidget(pItem, m_jobNumWidget);
|
||||
|
||||
pItem = new QListWidgetItem(m_listWidget);
|
||||
pItem->setSizeHint(QSize(UiConfig::GetInstance()->getUiHeight() / 12, UiConfig::GetInstance()->getUiHeight() / 12));
|
||||
m_listWidget->setItemWidget(pItem, m_phoneNumWidget);
|
||||
|
||||
pItem = new QListWidgetItem(m_listWidget);
|
||||
pItem->setSizeHint(QSize(UiConfig::GetInstance()->getUiHeight() / 12, UiConfig::GetInstance()->getUiHeight() / 12));
|
||||
m_listWidget->setItemWidget(pItem, m_idCardWidget);
|
||||
pItem = new QListWidgetItem(m_listWidget);
|
||||
pItem->setSizeHint(QSize(UiConfig::GetInstance()->getUiHeight() / 12, UiConfig::GetInstance()->getUiHeight() / 12));
|
||||
m_listWidget->setItemWidget(pItem, m_icCardWidget);
|
||||
|
||||
m_bottomBtn = new QPushButton(this);
|
||||
m_bottomBtn->setFocusPolicy(Qt::NoFocus);
|
||||
m_bottomBtn->setMinimumSize(UiConfig::GetInstance()->getUiWidth() / 3, UiConfig::GetInstance()->getUiHeight() / 15);
|
||||
//m_bottomBtn->setMinimumWidth(UiConfig::GetInstance()->getUiWidth() / 3);
|
||||
m_bottomBtn->setStyleSheet("color:white;"
|
||||
"background-color: blue;"
|
||||
"border:none;"
|
||||
"border-radius: 3px");
|
||||
|
||||
QLabel *tip = new QLabel(this);
|
||||
tip->setText("<p style='line-height:100%;'><font size='+0' color=blue>可以刷卡写入IC卡</font></p>");
|
||||
QHBoxLayout* hbLayout = new QHBoxLayout();
|
||||
QSpacerItem* hSpace1 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
QSpacerItem* hSpace2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
hbLayout->addItem(hSpace1);
|
||||
hbLayout->addWidget(m_bottomBtn);
|
||||
hbLayout->addItem(hSpace2);
|
||||
|
||||
QVBoxLayout* vbLayout = new QVBoxLayout();
|
||||
vbLayout->addWidget(m_listWidget, 0, Qt::AlignCenter);
|
||||
vbLayout->addWidget(tip);
|
||||
vbLayout->addLayout(hbLayout, 1);
|
||||
vbLayout->setSpacing(20);
|
||||
vbLayout->setMargin(10);
|
||||
setLayout(vbLayout);
|
||||
|
||||
m_listWidget->setItemHidden(m_listWidget->item(PERSON_ITEM_DEADLINE), true);
|
||||
}
|
||||
|
||||
void RegisterPersonPage::slotSetPersonInfo(stQueryPersonInfo &personInfo)
|
||||
{
|
||||
m_personInfo = personInfo;
|
||||
m_snapFeature.clear();
|
||||
m_snapPicPath.clear();
|
||||
refreshUi();
|
||||
}
|
||||
|
||||
void RegisterPersonPage::slotSnapFace(string &feature, string &picPath)
|
||||
{
|
||||
m_snapFeature = feature;
|
||||
m_snapPicPath = picPath;
|
||||
|
||||
m_picLabel->clear();
|
||||
QPixmap faceImg(m_snapPicPath.c_str());
|
||||
m_picLabel->setPixmap(ScalePixmap2Label(faceImg, *m_picLabel));
|
||||
}
|
||||
|
||||
void RegisterPersonPage::slotIcCardResult(const QString &icCard)
|
||||
{
|
||||
m_icCardWidget->updateLabel(icCard);
|
||||
}
|
||||
|
||||
void RegisterPersonPage::clearPersonInfo()
|
||||
{
|
||||
m_personInfo.clear();
|
||||
m_snapFeature.clear();
|
||||
m_snapPicPath.clear();
|
||||
refreshUi();
|
||||
}
|
||||
|
||||
void RegisterPersonPage::refreshUi()
|
||||
{
|
||||
m_picLabel->clear();
|
||||
if(m_personInfo.imgPath.empty())
|
||||
{
|
||||
//QPixmap faceImg(":/res/image/add.png");
|
||||
QPixmap faceImg(":/res/image/add.jpg");
|
||||
m_picLabel->setPixmap(ScalePixmap2Label(faceImg, *m_picLabel));
|
||||
}else
|
||||
{
|
||||
QPixmap faceImg(m_personInfo.imgPath.c_str());
|
||||
m_picLabel->setPixmap(ScalePixmap2Label(faceImg, *m_picLabel));
|
||||
}
|
||||
|
||||
bool isDurable = (m_personInfo.expTime.empty() ||
|
||||
QString(m_personInfo.expTime.c_str()).lastIndexOf("3000") >= 0) ? true : false;
|
||||
isDurable ? m_durableBtn->setChecked(true) : m_nondurableBtn->setChecked(true);
|
||||
m_listWidget->setItemHidden(m_listWidget->item(PERSON_ITEM_DEADLINE), isDurable);
|
||||
m_deadlineWidget->updateLabel(isDurable ? "" : m_personInfo.expTime.c_str());
|
||||
|
||||
m_nameWidget->updateLabel(m_personInfo.name.c_str());
|
||||
m_jobNumWidget->updateLabel(m_personInfo.jobNum.c_str());
|
||||
m_phoneNumWidget->updateLabel(m_personInfo.phoneNum.c_str());
|
||||
m_idCardWidget->updateLabel(m_personInfo.idNum.c_str());
|
||||
m_icCardWidget->updateLabel(m_personInfo.icNum.c_str());
|
||||
}
|
||||
|
||||
#if 0
|
||||
void RegisterPersonPage::setInfo(dbspace::rwFeatInfo *pFeatInfo, dbspace::rwPersonInfo *pPersonInfo)
|
||||
{
|
||||
#if 0
|
||||
m_featInfo.clear();
|
||||
m_personInfo.clear();
|
||||
if(pFeatInfo != nullptr)
|
||||
{
|
||||
m_featInfo = *pFeatInfo;
|
||||
}
|
||||
if(pFeatInfo != nullptr)
|
||||
{
|
||||
m_personInfo = *pPersonInfo;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void RegisterPersonPage::slotItemClicked(QListWidgetItem *item)
|
||||
{
|
||||
int row = m_listWidget->currentRow();
|
||||
//dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
//QWidget* pItemWidget = m_listWidget->itemWidget(item);
|
||||
qDebug() << __PRETTY_FUNCTION__ << "row=" << row;
|
||||
|
||||
switch (row) {
|
||||
#if 0
|
||||
case PERSON_ITEM_PIC:
|
||||
//turn to snap photo page
|
||||
emit signalShowPage(SnapFacePage::m_pageIndex);
|
||||
break;
|
||||
#endif
|
||||
case PERSON_ITEM_NAME:
|
||||
{
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
LineEditInputDialog dlg(wdt->getOpnLabelString(), parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString setStr = dlg.getRow(0);
|
||||
#if 0
|
||||
if(setStr.isEmpty())
|
||||
{
|
||||
InfoDialog(tr("设置有误,请重新输入!"), parent()->parent()).exec();
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
wdt->updateLabel(setStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case PERSON_ITEM_DEADLINE_CHOICE:
|
||||
break;
|
||||
#endif
|
||||
case PERSON_ITEM_DEADLINE:
|
||||
{
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
//QDateTime::fromString(wdt->getLabelString(), "yyyy-MM-dd hh:mm");
|
||||
//DateTimeDialog dateTimeDlg(QDateTime::currentDateTime(), parent()->parent());
|
||||
DateTimeDialog dateTimeDlg(wdt->getLabelString().isEmpty() ? QDateTime::currentDateTime() : QDateTime::fromString(wdt->getLabelString(), "yyyy-MM-dd hh:mm"), parent()->parent());
|
||||
if(dateTimeDlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
wdt->updateLabel(dateTimeDlg.getValueSet().toString("yyyy-MM-dd hh:mm"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PERSON_ITEM_JOB_NUM:
|
||||
{
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
LineEditInputDialog dlg(wdt->getOpnLabelString(), parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString setStr = dlg.getRow(0);
|
||||
#if 0
|
||||
if(setStr.isEmpty())
|
||||
{
|
||||
InfoDialog(tr("设置有误,请重新输入!"), parent()->parent()).exec();
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
wdt->updateLabel(setStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PERSON_ITEM_PHONE_NUM:
|
||||
{
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
LineEditInputDialog dlg(wdt->getOpnLabelString(), parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString setStr = dlg.getRow(0);
|
||||
#if 0
|
||||
if(setStr.isEmpty())
|
||||
{
|
||||
InfoDialog(tr("设置有误,请重新输入!"), parent()->parent()).exec();
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
wdt->updateLabel(setStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PERSON_ITEM_ID_CARD:
|
||||
{
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
LineEditInputDialog dlg(wdt->getOpnLabelString(), parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString setStr = dlg.getRow(0);
|
||||
#if 0
|
||||
if(setStr.isEmpty())
|
||||
{
|
||||
InfoDialog(tr("设置有误,请重新输入!"), parent()->parent()).exec();
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
wdt->updateLabel(setStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PERSON_ITEM_IC_CARD:
|
||||
{
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
LineEditInputDialog dlg(wdt->getOpnLabelString(), parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString setStr = dlg.getRow(0);
|
||||
#if 0
|
||||
if(setStr.isEmpty())
|
||||
{
|
||||
InfoDialog(tr("设置有误,请重新输入!"), parent()->parent()).exec();
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
wdt->updateLabel(setStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RegisterPersonPage::slotDeadlineBtnClicked(int id)
|
||||
{
|
||||
qDebug() << __PRETTY_FUNCTION__ << "id=" << id;
|
||||
if(id == 0)
|
||||
{
|
||||
m_listWidget->setItemHidden(m_listWidget->item(PERSON_ITEM_DEADLINE), true);
|
||||
}else if(id == 1)
|
||||
{
|
||||
m_listWidget->setItemHidden(m_listWidget->item(PERSON_ITEM_DEADLINE), false);
|
||||
}
|
||||
}
|
||||
|
||||
int AddPersonPage::m_pageIndex = 0;
|
||||
AddPersonPage::AddPersonPage(int pageIndex, QWidget *parent) : RegisterPersonPage(parent)
|
||||
{
|
||||
qDebug() << "AddPersonPage";
|
||||
m_pageIndex = pageIndex;
|
||||
m_bottomBtn->setText(tr("确认添加"));
|
||||
connect(m_bottomBtn, SIGNAL(clicked(bool)), this, SLOT(slotAddPerson()));
|
||||
}
|
||||
|
||||
void AddPersonPage::reset()
|
||||
{
|
||||
clearPersonInfo();
|
||||
m_backstageIf->startIdentyState(false, true);
|
||||
}
|
||||
|
||||
void AddPersonPage::slotItemClicked(QListWidgetItem *item)
|
||||
{
|
||||
int row = m_listWidget->currentRow();
|
||||
//dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
//QWidget* pItemWidget = m_listWidget->itemWidget(item);
|
||||
qDebug() << __PRETTY_FUNCTION__ << "row=" << row;
|
||||
|
||||
switch (row) {
|
||||
case PERSON_ITEM_PIC:
|
||||
//turn to snap photo page
|
||||
emit signalShowPage(SnapFacePage::m_pageIndex);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
RegisterPersonPage::slotItemClicked(item);
|
||||
}
|
||||
|
||||
void AddPersonPage::slotAddPerson()
|
||||
{
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
|
||||
QString showText = tr("确定新增人员?");
|
||||
QuestionDialog dlg(showText, parent()->parent(), tr("确定"));
|
||||
if(QDialog::Accepted != dlg.exec()){
|
||||
return;
|
||||
}
|
||||
|
||||
stQueryPersonInfo personInfo;
|
||||
//personInfo.personId = m_personInfo.personId;
|
||||
personInfo.name = m_nameWidget->getLabelString().toStdString();
|
||||
personInfo.expTime = m_durableBtn->isChecked() ? std::string("3000-12-31 00:00") : m_deadlineWidget->getLabelString().toStdString();;
|
||||
personInfo.idNum = m_idCardWidget->getLabelString().toStdString();
|
||||
personInfo.icNum = m_icCardWidget->getLabelString().toStdString();
|
||||
personInfo.jobNum = m_jobNumWidget->getLabelString().toStdString();
|
||||
personInfo.phoneNum = m_phoneNumWidget->getLabelString().toStdString();
|
||||
|
||||
personInfo.imgPath = m_snapPicPath;
|
||||
personInfo.feature = m_snapFeature;
|
||||
|
||||
if(personInfo.name.empty() || personInfo.expTime.empty() ||
|
||||
personInfo.imgPath.empty() || personInfo.feature.empty())
|
||||
{
|
||||
InfoDialog(tr("请补全*信息!"), parent()->parent()).exec();
|
||||
return;
|
||||
}
|
||||
|
||||
int ret = m_backstageIf->addPerson(personInfo);
|
||||
if(ret == 0)
|
||||
{
|
||||
emit signalChangePersonDB();
|
||||
emit signalReturn();
|
||||
}else
|
||||
{
|
||||
qDebug() << __PRETTY_FUNCTION__ << "addPerson err:" << ret;
|
||||
if(ret == -99)
|
||||
{
|
||||
InfoDialog(tr("注册失败,已达到最大注册人数!"), parent()->parent()).exec();
|
||||
}else if(ret == -6)
|
||||
{
|
||||
InfoDialog(tr("IC卡号重复!"), parent()->parent()).exec();
|
||||
}else if(ret == -5)
|
||||
{
|
||||
InfoDialog(tr("注册人员失败,请重新抓拍!"), parent()->parent()).exec();
|
||||
}else if (ret == -7)
|
||||
{
|
||||
InfoDialog(tr("身份证号已存在!"), parent()->parent()).exec();
|
||||
}else
|
||||
{
|
||||
InfoDialog(tr("注册人员失败!"), parent()->parent()).exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ModifyPersonPage::m_pageIndex = 0;
|
||||
ModifyPersonPage::ModifyPersonPage(int pageIndex, QWidget *parent) : RegisterPersonPage(parent)
|
||||
{
|
||||
qDebug() << "ModifyPersonPage";
|
||||
m_pageIndex = pageIndex;
|
||||
m_bottomBtn->setText(tr("删除人员"));
|
||||
connect(m_bottomBtn, SIGNAL(clicked(bool)), this, SLOT(slotDelPerson()));
|
||||
}
|
||||
|
||||
void ModifyPersonPage::reset()
|
||||
{
|
||||
m_backstageIf->startIdentyState(false, true);
|
||||
}
|
||||
|
||||
void ModifyPersonPage::savePersonInfo()
|
||||
{
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
|
||||
QString showText = tr("确定更改人员信息?");
|
||||
QuestionDialog dlg(showText, parent()->parent(), tr("确定"));
|
||||
if(QDialog::Accepted != dlg.exec()){
|
||||
return;
|
||||
}
|
||||
|
||||
stQueryPersonInfo personInfo;
|
||||
personInfo.personId = m_personInfo.personId;
|
||||
personInfo.name = m_nameWidget->getLabelString().toStdString();
|
||||
personInfo.expTime = m_durableBtn->isChecked() ? std::string("3000-12-31 00:00") : m_deadlineWidget->getLabelString().toStdString();;
|
||||
personInfo.idNum = m_idCardWidget->getLabelString().toStdString();
|
||||
personInfo.icNum = m_icCardWidget->getLabelString().toStdString();
|
||||
personInfo.jobNum = m_jobNumWidget->getLabelString().toStdString();
|
||||
personInfo.phoneNum = m_phoneNumWidget->getLabelString().toStdString();
|
||||
|
||||
if(personInfo.name.empty() || personInfo.expTime.empty())
|
||||
{
|
||||
InfoDialog(tr("请补全*信息!"), parent()->parent()).exec();
|
||||
return;
|
||||
}
|
||||
|
||||
int ret = m_backstageIf->modifyPerson(personInfo);
|
||||
if(ret == 0)
|
||||
{
|
||||
emit signalChangePersonDB();
|
||||
emit signalReturn();
|
||||
}else
|
||||
{
|
||||
qDebug() << __PRETTY_FUNCTION__ << "modifyPerson err:" << ret;
|
||||
if(ret == -2)
|
||||
{
|
||||
InfoDialog(tr("无效的姓名!"), parent()->parent()).exec();
|
||||
}else if(ret == -3)
|
||||
{
|
||||
InfoDialog(tr("IC卡号重复!"), parent()->parent()).exec();
|
||||
}else if(ret == -6)
|
||||
{
|
||||
InfoDialog(tr("身份证号已存在!"), parent()->parent()).exec();
|
||||
}else
|
||||
{
|
||||
InfoDialog(tr("更改人员信息失败,人员或已被删除!"), parent()->parent()).exec();
|
||||
emit signalChangePersonDB();
|
||||
//emit signalReturn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModifyPersonPage::slotDelPerson()
|
||||
{
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
|
||||
QString showText = tr("确定删除改人员?");
|
||||
QuestionDialog dlg(showText, parent()->parent(), tr("确定"));
|
||||
if(QDialog::Accepted != dlg.exec()){
|
||||
return;
|
||||
}
|
||||
|
||||
m_backstageIf->delPerson(m_personInfo.personId);
|
||||
emit signalChangePersonDB();
|
||||
emit signalReturn();
|
||||
}
|
||||
|
||||
const QString SnapFacePage::BG_RES_FILE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY] = {
|
||||
":/res/image/face-small.png",
|
||||
":/res/image/jinggong-face-middle.png",
|
||||
":/res/image/face_720_1280.png",
|
||||
":/res/image/jinggong-face-middle.png",
|
||||
":/res/image/face_720_1280.png"
|
||||
};
|
||||
|
||||
int SnapFacePage::m_pageIndex = 0;
|
||||
SnapFacePage::SnapFacePage(int pageIndex, QWidget *parent) : WidgetWithBackstageInterface(parent)
|
||||
{
|
||||
qDebug() << "SnapFacePage";
|
||||
m_pageIndex = pageIndex;
|
||||
|
||||
m_btn_snap = new QPushButton(this);
|
||||
m_btn_snap->setFocusPolicy(Qt::NoFocus);
|
||||
int radius_w = (UiConfig::GetInstance()->getUiWidth() * 0.2) / 2;
|
||||
int radius_h = (UiConfig::GetInstance()->getUiHeight() * 0.1) / 2;
|
||||
int radius = min(radius_w, radius_h);
|
||||
m_btn_snap->setFixedSize(radius*2, radius*2);
|
||||
m_btn_snap->setStyleSheet(QString("background-color: white;"
|
||||
"border-radius: %1px;").arg(radius));
|
||||
m_btn_snap->setText(tr("拍照"));
|
||||
connect(m_btn_snap, SIGNAL(clicked(bool)), this, SLOT(slotSnapBtnClicked()));
|
||||
#if 0
|
||||
m_btn_snap->move((UiConfig::GetInstance()->getUiWidth() - m_btn_snap->width()) / 2,
|
||||
UiConfig::GetInstance()->getUiHeight()*0.95 - m_btn_snap->height() );
|
||||
#endif
|
||||
|
||||
QHBoxLayout* hbLayout = new QHBoxLayout();
|
||||
QSpacerItem* hSpace1 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
QSpacerItem* hSpace2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
hbLayout->addItem(hSpace1);
|
||||
hbLayout->addWidget(m_btn_snap);
|
||||
hbLayout->addItem(hSpace2);
|
||||
|
||||
QSpacerItem* vSpace1 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
QVBoxLayout* vbLayout = new QVBoxLayout();
|
||||
vbLayout->addItem(vSpace1);
|
||||
vbLayout->addLayout(hbLayout);
|
||||
//vbLayout->setSpacing(20);
|
||||
//vbLayout->setMargin(10);
|
||||
setLayout(vbLayout);
|
||||
|
||||
setAutoFillBackground(true);
|
||||
//setStyleSheet("background-color: transparent;");
|
||||
#if 0
|
||||
resize(UiConfig::GetInstance()->getUiWidth(), UiConfig::GetInstance()->getUiHeight());
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::Background, QColor(0x00,0xff,0x00,0x00));
|
||||
setPalette(pal);
|
||||
//QPalette palette(this->palette());
|
||||
//palette.setColor(QPalette::WindowText,Qt::black);
|
||||
#endif
|
||||
#if 1
|
||||
resize(UiConfig::GetInstance()->getUiWidth(), UiConfig::GetInstance()->getUiHeight());
|
||||
QPalette palette(this->palette());
|
||||
palette.setColor(QPalette::WindowText,Qt::white);
|
||||
//palette.setBrush(QPalette::Window,QBrush(QPixmap(CenterMsgWidget::BG_RES_FILE[UiConfig::GetInstance()->getScreenConfigIndex()])));
|
||||
palette.setBrush(QPalette::Window,QBrush(QPixmap(BG_RES_FILE[UiConfig::GetInstance()->getScreenConfigIndex()])));
|
||||
setPalette(palette);
|
||||
#endif
|
||||
//setWindowOpacity(1);
|
||||
//setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
}
|
||||
|
||||
void SnapFacePage::reset()
|
||||
{
|
||||
//vo显示设置
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
|
||||
m_backstageIf->recoUiTypeSwitch(0, 0, UiConfig::GetInstance()->getUiWidth(), UiConfig::GetInstance()->getUiHeight());
|
||||
}
|
||||
|
||||
void SnapFacePage::slotSnapBtnClicked()
|
||||
{
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
MsgDialog msgdlg(tr("抓拍人脸中,请稍候..."), parent()->parent());
|
||||
msgdlg.show();
|
||||
QCoreApplication::processEvents();//处理qt事件,刷新ui
|
||||
#endif
|
||||
std::string feature;
|
||||
std::string savePath("/tmp/test.jpg");
|
||||
int ret = m_backstageIf->snapFace(feature, savePath);
|
||||
qDebug() << __PRETTY_FUNCTION__ << "ret=" << ret;
|
||||
if(ret !=0)
|
||||
{
|
||||
InfoDialog(tr("抓拍人脸失败,请重拍!"), parent()->parent()).exec();
|
||||
}else
|
||||
{
|
||||
emit signalSnapFace(feature, savePath);
|
||||
emit signalReturn();
|
||||
}
|
||||
}
|
183
Linguist/setUi/settingUiFaceMng.h
Normal file
183
Linguist/setUi/settingUiFaceMng.h
Normal file
@ -0,0 +1,183 @@
|
||||
#ifndef SETTINGUIFACEMNG_H
|
||||
#define SETTINGUIFACEMNG_H
|
||||
|
||||
#include <QListWidget>
|
||||
#include "UiTools.h"
|
||||
#include "UiConfig.h"
|
||||
|
||||
class settingUiFaceMng : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
enFaceDb,
|
||||
enAccessRecord
|
||||
}enFaceMng;
|
||||
|
||||
static int m_pageIndex;
|
||||
explicit settingUiFaceMng(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiFaceMng();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem* item);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
class FaceDbPage : public PersonMsgUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static int m_pageIndex;
|
||||
explicit FaceDbPage(int pageIndex, QWidget *parent = nullptr);
|
||||
void reset();
|
||||
void clickBtn_addPerson();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
signals:
|
||||
void signalShowPage(int, const QString title = "");
|
||||
void signalPersonInfo(stQueryPersonInfo &personInfo);
|
||||
protected slots:
|
||||
void slotTextChanged(const QString& text);
|
||||
virtual void slotBtnClicked();
|
||||
virtual void slotSliderReleased();
|
||||
virtual void slotItemClicked(QListWidgetItem *item);
|
||||
void slot_freshPage();
|
||||
private:
|
||||
void showFaceMsg(int pageIndex);
|
||||
|
||||
private:
|
||||
stQueryPersonInfo m_person[5];
|
||||
int m_lastPageIndex = 0;
|
||||
};
|
||||
|
||||
class AccessRecordPage : public PersonMsgUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static int m_pageIndex;
|
||||
explicit AccessRecordPage(int pageIndex, QWidget *parent = nullptr);
|
||||
void reset();
|
||||
|
||||
protected:
|
||||
protected slots:
|
||||
void slotTextChanged(const QString& text);
|
||||
virtual void slotBtnClicked();
|
||||
virtual void slotSliderReleased();
|
||||
|
||||
private:
|
||||
void showAccessRecordMsg(int pageIndex);
|
||||
};
|
||||
|
||||
class RegisterPersonPage : public MyWidgetWithMainStyleColor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
PERSON_ITEM_PIC = 0,
|
||||
PERSON_ITEM_NAME,
|
||||
PERSON_ITEM_DEADLINE_CHOICE,
|
||||
PERSON_ITEM_DEADLINE,
|
||||
PERSON_ITEM_JOB_NUM,
|
||||
PERSON_ITEM_PHONE_NUM,
|
||||
PERSON_ITEM_ID_CARD,
|
||||
PERSON_ITEM_IC_CARD,
|
||||
}PERSON_ITEM_E;
|
||||
//static int m_pageIndex;
|
||||
explicit RegisterPersonPage(QWidget *parent = nullptr);
|
||||
//virtual void reset();
|
||||
|
||||
void clearPersonInfo();
|
||||
void refreshUi();
|
||||
signals:
|
||||
void signalShowPage(int, const QString title = "");
|
||||
void signalReturn();
|
||||
void signalChangePersonDB();
|
||||
|
||||
protected slots:
|
||||
virtual void slotItemClicked(QListWidgetItem *item);
|
||||
void slotDeadlineBtnClicked(int id);
|
||||
void slotSetPersonInfo(stQueryPersonInfo &personInfo);
|
||||
void slotSnapFace(std::string &feature, std::string &picPath);
|
||||
void slotIcCardResult(const QString& icCard);
|
||||
|
||||
protected:
|
||||
QListWidget *m_listWidget;
|
||||
QWidget *m_picWidget;
|
||||
QLabel *m_picLabel;
|
||||
|
||||
QWidget *m_deadlineChoiceWidget;
|
||||
QButtonGroup *m_deadlineBtnGrp;
|
||||
QRadioButton *m_durableBtn;
|
||||
QRadioButton *m_nondurableBtn;
|
||||
|
||||
myListWidget *m_nameWidget;
|
||||
myListWidget *m_deadlineWidget;
|
||||
myListWidget *m_jobNumWidget;
|
||||
myListWidget *m_phoneNumWidget;
|
||||
myListWidget *m_idCardWidget;
|
||||
myListWidget *m_icCardWidget;
|
||||
QPushButton *m_bottomBtn;
|
||||
//bool m_isPicChange = false;
|
||||
//bool m_isPersonInfoChange = false;
|
||||
stQueryPersonInfo m_personInfo;
|
||||
std::string m_snapFeature;
|
||||
std::string m_snapPicPath;
|
||||
//dbspace::rwFeatInfo m_featInfo;
|
||||
//dbspace::rwPersonInfo m_personInfo;
|
||||
};
|
||||
|
||||
class AddPersonPage : public RegisterPersonPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static int m_pageIndex;
|
||||
explicit AddPersonPage(int pageIndex, QWidget *parent = nullptr);
|
||||
void reset();
|
||||
|
||||
public slots:
|
||||
virtual void slotItemClicked(QListWidgetItem *item);
|
||||
void slotAddPerson();
|
||||
};
|
||||
|
||||
class ModifyPersonPage : public RegisterPersonPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static int m_pageIndex;
|
||||
explicit ModifyPersonPage(int pageIndex, QWidget *parent = nullptr);
|
||||
void reset();
|
||||
void savePersonInfo();
|
||||
public slots:
|
||||
void slotDelPerson();
|
||||
};
|
||||
|
||||
class SnapFacePage : public WidgetWithBackstageInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static const QString BG_RES_FILE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
|
||||
static int m_pageIndex;
|
||||
explicit SnapFacePage(int pageIndex, QWidget *parent = nullptr);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
void signalReturn();
|
||||
void signalSnapFace(std::string &feature, std::string &picPath);
|
||||
public slots:
|
||||
void slotSnapBtnClicked();
|
||||
|
||||
private:
|
||||
QPushButton *m_btn_snap;
|
||||
};
|
||||
|
||||
#endif // SETTINGUIFACEMNG_H
|
343
Linguist/setUi/settingUiFastCfg.cpp
Normal file
343
Linguist/setUi/settingUiFastCfg.cpp
Normal file
@ -0,0 +1,343 @@
|
||||
#include "settingUiFastCfg.h"
|
||||
#include "UiConfig.h"
|
||||
#include <QDebug>
|
||||
|
||||
const int NEXT_BTN_FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY] = {28, 42, 42, 16, 16};
|
||||
|
||||
int settingUiFastCfgWireNet::m_pageIndex = 0;
|
||||
settingUiFastCfgWireNet::settingUiFastCfgWireNet(int pageIndex, QWidget *parent) : MyWidgetWithMainStyleColor(parent)
|
||||
{
|
||||
m_pageIndex = pageIndex;
|
||||
|
||||
QFont ft;
|
||||
ft.setPointSize(NEXT_BTN_FONT_SIZE[UiConfig::GetInstance()->getScreenConfigIndex()]);
|
||||
//QLabel* title = new QLabel(tr("有线网络配置"), this);
|
||||
//title->setFont(ft);
|
||||
|
||||
m_wireNet = new settingUiDevMngNetWire(0, this);
|
||||
m_wireNet->setFixedSize(UiConfig::GetInstance()->getUiWidth(), static_cast<int>(UiConfig::GetInstance()->getUiHeight() * 0.7));
|
||||
|
||||
m_btnNext = new QPushButton(tr("下一步"), this);
|
||||
m_btnNext->setFixedSize(UiConfig::GetInstance()->getUiWidth() / 3,
|
||||
UiConfig::GetInstance()->getUiWidth() / 6);
|
||||
m_btnNext->setFont(ft);
|
||||
m_btnNext->setStyleSheet("QPushButton {"
|
||||
"border: 0px;"
|
||||
"border-radius:10px;"
|
||||
"background-color:rgb(24, 144, 255);"
|
||||
"focus{outline: none;}"
|
||||
"}"
|
||||
"QPushButton:hover { "
|
||||
"background-color:rgb(24, 144, 255);"
|
||||
"}"
|
||||
"QPushButton:pressed {"
|
||||
"background-color:rgb(222, 222, 222);"
|
||||
"}");
|
||||
connect(m_btnNext, SIGNAL(clicked()), this, SLOT(slotBtnClicked()));
|
||||
|
||||
QVBoxLayout* bLay = new QVBoxLayout();
|
||||
//bLay->addWidget(title, 1, Qt::AlignCenter | Qt::AlignTop);
|
||||
bLay->addWidget(m_wireNet, 1, Qt::AlignCenter | Qt::AlignTop);
|
||||
bLay->addStretch(1);
|
||||
bLay->addWidget(m_btnNext, 1, Qt::AlignCenter | Qt::AlignTop);
|
||||
bLay->addStretch(1);
|
||||
bLay->setMargin(0);
|
||||
bLay->setSpacing(0);
|
||||
setLayout(bLay);
|
||||
}
|
||||
|
||||
void settingUiFastCfgWireNet::setBackstageUiinterface(BackstageInterfaceForUi* interface)
|
||||
{
|
||||
m_backstageIf = interface;
|
||||
m_wireNet->setBackstageUiinterface(interface);
|
||||
}
|
||||
|
||||
void settingUiFastCfgWireNet::reset()
|
||||
{
|
||||
m_wireNet->reset();
|
||||
}
|
||||
|
||||
void settingUiFastCfgWireNet::slotBtnClicked()
|
||||
{
|
||||
emit signalJumpPage(0); //need page enum
|
||||
}
|
||||
|
||||
|
||||
|
||||
int settingUiPark::m_pageIndex = 0;
|
||||
settingUiPark::settingUiPark(QWidget *parent)
|
||||
: SettingUiPage(QVector<SettingUiPage::SetOpn>{
|
||||
SetOpn(tr("设备位置"), "(设备具体安装位置)", myListWidget::enPropertyMoreArrow)
|
||||
}, parent)
|
||||
{
|
||||
}
|
||||
|
||||
void settingUiPark::reset()
|
||||
{
|
||||
qDebug() << "reset";
|
||||
for(int i = 0; i < config.size(); i ++)
|
||||
{
|
||||
QListWidgetItem* pItem = m_listWidget->item(i);
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(pItem));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
QString str;
|
||||
const int iBufSize = 128;
|
||||
char buf[iBufSize] = {'\0'};
|
||||
switch(i)
|
||||
{
|
||||
case FAST_CFG_DEV_POSI:
|
||||
{
|
||||
std::string posiStr;
|
||||
m_backstageIf->getDevPosi(posiStr);
|
||||
str = (posiStr.empty() ? tr("(未设置)") : posiStr.c_str());
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case FAST_CFG_PARK_INFO:
|
||||
{
|
||||
std::string infoStr;
|
||||
m_backstageIf->getParkInfo(infoStr);
|
||||
str = (infoStr.empty() ? tr("(未设置)") : infoStr.c_str());
|
||||
}
|
||||
break;
|
||||
|
||||
case FAST_CFG_SERVER:
|
||||
if(0 == m_backstageIf->getServerAddr(buf, iBufSize)){
|
||||
str = buf;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
wdt->updateLabel(str);
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiPark::slotItemClicked(QListWidgetItem* item)
|
||||
{
|
||||
const int row = m_listWidget->currentRow();
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
switch(row){
|
||||
//case FAST_CFG_PARK_INFO:
|
||||
case FAST_CFG_DEV_POSI:
|
||||
{
|
||||
bool settingFailed = true;
|
||||
do{
|
||||
LineEditInputDialog dlg(config.at(row).m_sOpn, parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted){
|
||||
const QString strInput = dlg.getRow(0);
|
||||
do{
|
||||
#if 0
|
||||
if(row == FAST_CFG_PARK_INFO){
|
||||
if(0 == strInput.length()){
|
||||
InfoDialog(tr("园区信息不能为空"), parent()->parent()).exec();
|
||||
break;
|
||||
}
|
||||
else if(strInput.length() > 32){
|
||||
InfoDialog(tr("园区信息不能超过32个字符"), parent()->parent()).exec();
|
||||
break;
|
||||
}
|
||||
if(0 == m_backstageIf->setParkInfo(strInput.toStdString())){
|
||||
wdt->updateLabel(strInput);
|
||||
settingFailed = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if(row == FAST_CFG_DEV_POSI){
|
||||
if(strInput.length() > 32){
|
||||
InfoDialog(tr("设备位置不能超过32个字符"), parent()->parent()).exec();
|
||||
break;
|
||||
}
|
||||
if(0 == m_backstageIf->setDevPosi(strInput.toStdString())){
|
||||
wdt->updateLabel(strInput.isEmpty() ? tr("(未设置)") : strInput);
|
||||
settingFailed = false;
|
||||
}
|
||||
}
|
||||
}while(0);
|
||||
}
|
||||
else {
|
||||
settingFailed = false;
|
||||
}
|
||||
}while(settingFailed);
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case FAST_CFG_SERVER:
|
||||
{
|
||||
bool settingFailed = true;
|
||||
do{
|
||||
QList<QString> strs;
|
||||
if(FAST_CFG_SERVER == row){
|
||||
strs << tr("服务器地址:") << tr("端口:");
|
||||
}
|
||||
LineEditInputDialog dlg(strs, parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString str;
|
||||
do{
|
||||
if(FAST_CFG_SERVER == row){
|
||||
if("" != dlg.getRow(0) && "" != dlg.getRow(1)){
|
||||
bool isDigi = false;
|
||||
int valueSet = dlg.getRow(1).toInt(&isDigi);
|
||||
if( (!isDigi) || (valueSet < 0 || valueSet > 65535)){
|
||||
break;
|
||||
}
|
||||
if(m_backstageIf){
|
||||
str = dlg.getRow(0) + ":" + dlg.getRow(1);
|
||||
m_backstageIf->setServerAddr(const_cast<char*>(str.toStdString().c_str()));
|
||||
wdt->updateLabel(str);
|
||||
settingFailed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}while(0);
|
||||
}
|
||||
else {
|
||||
settingFailed = false;
|
||||
}
|
||||
if(settingFailed)
|
||||
{
|
||||
InfoDialog(tr("设置有误,请重新输入!"), parent()->parent()).exec();
|
||||
}
|
||||
}while(settingFailed);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int settingUiFastCfgPark::m_pageIndex = 0;
|
||||
settingUiFastCfgPark::settingUiFastCfgPark(int pageIndex, QWidget *parent) : MyWidgetWithMainStyleColor(parent)
|
||||
{
|
||||
m_pageIndex = pageIndex;
|
||||
|
||||
QFont ft;
|
||||
ft.setPointSize(NEXT_BTN_FONT_SIZE[UiConfig::GetInstance()->getScreenConfigIndex()]);
|
||||
|
||||
m_park = new settingUiPark(this);
|
||||
m_park->setFixedSize(UiConfig::GetInstance()->getUiWidth(), static_cast<int>(UiConfig::GetInstance()->getUiHeight() * 0.7));
|
||||
|
||||
m_btnNext = new QPushButton(tr("下一步"), this);
|
||||
m_btnNext->setFixedSize(UiConfig::GetInstance()->getUiWidth() / 3,
|
||||
UiConfig::GetInstance()->getUiWidth() / 6);
|
||||
m_btnNext->setFont(ft);
|
||||
m_btnNext->setStyleSheet("QPushButton {"
|
||||
"border: 0px;"
|
||||
"border-radius:10px;"
|
||||
"background-color:rgb(24, 144, 255);"
|
||||
"focus{outline: none;}"
|
||||
"}"
|
||||
"QPushButton:hover { "
|
||||
"background-color:rgb(24, 144, 255);"
|
||||
"}"
|
||||
"QPushButton:pressed {"
|
||||
"background-color:rgb(222, 222, 222);"
|
||||
"}");
|
||||
connect(m_btnNext, SIGNAL(clicked()), this, SLOT(slotBtnClicked()));
|
||||
|
||||
QVBoxLayout* bLay = new QVBoxLayout();
|
||||
//bLay->addWidget(title, 1, Qt::AlignCenter | Qt::AlignTop);
|
||||
bLay->addWidget(m_park, 1, Qt::AlignCenter | Qt::AlignTop);
|
||||
bLay->addStretch(1);
|
||||
bLay->addWidget(m_btnNext, 1, Qt::AlignCenter | Qt::AlignTop);
|
||||
bLay->addStretch(1);
|
||||
bLay->setMargin(0);
|
||||
bLay->setSpacing(0);
|
||||
setLayout(bLay);
|
||||
}
|
||||
|
||||
void settingUiFastCfgPark::setBackstageUiinterface(BackstageInterfaceForUi* interface)
|
||||
{
|
||||
m_backstageIf = interface;
|
||||
m_park->setBackstageUiinterface(interface);
|
||||
}
|
||||
|
||||
void settingUiFastCfgPark::reset()
|
||||
{
|
||||
m_park->reset();
|
||||
}
|
||||
|
||||
void settingUiFastCfgPark::slotBtnClicked()
|
||||
{
|
||||
emit signalJumpPage(0); //need page enum
|
||||
}
|
||||
|
||||
const int SettingUiQrcode::TIP_FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY] = {24, 38, 38, 14, 14};
|
||||
const QString SettingUiQrcode::BG_RES_FILE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY] = {
|
||||
":/res/image/qrcode_middle.png",
|
||||
":/res/image/qrcode_large.png",
|
||||
":/res/image/qrcode_middle.png",
|
||||
":/res/image/qrcode_large.png",
|
||||
":/res/image/qrcode_middle.png"
|
||||
};
|
||||
|
||||
int SettingUiQrcode::m_pageIndex = 0;
|
||||
SettingUiQrcode::SettingUiQrcode(int pageIndex, QWidget *parent) : WidgetWithBackstageInterface(parent)
|
||||
{
|
||||
m_pageIndex = pageIndex;
|
||||
|
||||
resize(UiConfig::GetInstance()->getUiWidth(), UiConfig::GetInstance()->getUiHeight());
|
||||
setAutoFillBackground(true);
|
||||
QPalette palette(this->palette());
|
||||
palette.setColor(QPalette::WindowText,Qt::white);
|
||||
palette.setBrush(QPalette::Window,QBrush(QPixmap(BG_RES_FILE[UiConfig::GetInstance()->getScreenConfigIndex()])));
|
||||
setPalette(palette);
|
||||
|
||||
QLabel* tip = new QLabel(tr("请将配置二维码对准扫码框"), this);
|
||||
QFont ft;
|
||||
ft.setPointSize(TIP_FONT_SIZE[UiConfig::GetInstance()->getScreenConfigIndex()]);
|
||||
tip->setFont(ft);
|
||||
QVBoxLayout* bLay = new QVBoxLayout();
|
||||
bLay->addWidget(tip, 1, Qt::AlignHCenter);
|
||||
bLay->addStretch(9);
|
||||
setLayout(bLay);
|
||||
|
||||
m_widget_cMsg = new CenterMsgWidget(this);
|
||||
m_widget_cMsg->move((UiConfig::GetInstance()->getUiWidth() - CenterMsgWidget::WIDGET_WIDTH[UiConfig::GetInstance()->getScreenConfigIndex()]) / 2,
|
||||
static_cast<int>(UiConfig::GetInstance()->getUiHeight() * 0.2));
|
||||
m_widget_cMsg->hide();
|
||||
}
|
||||
|
||||
void SettingUiQrcode::reset()
|
||||
{
|
||||
qDebug() << __PRETTY_FUNCTION__;
|
||||
//vo显示设置
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
|
||||
m_backstageIf->recoUiTypeSwitch(0, 0, UiConfig::GetInstance()->getUiWidth(), UiConfig::GetInstance()->getUiHeight());
|
||||
}
|
||||
|
||||
void SettingUiQrcode::slotCenterMsg(const int nPage, const QString& msg)
|
||||
{
|
||||
m_widget_cMsg->showMsg(msg, nPage);
|
||||
if(UiConfig::GetInstance()->isRkDevice()){
|
||||
update();
|
||||
}
|
||||
//qDebug() << "slotCenterMsg:" << msg;
|
||||
//if(!msg.isEmpty()){
|
||||
//QTimer::singleShot(10000, this, [this]{qDebug() << "SettingUiQrcode slotQrcodeCfgSuccessed";emit signalExitSettingUi();});
|
||||
//}
|
||||
}
|
||||
|
||||
void SettingUiQrcode::slotQrcodeFastCfgResult(bool isSuccessed)
|
||||
{
|
||||
qDebug() << "slotQrcodeFastCfgResult:" << isSuccessed;
|
||||
if(isSuccessed){
|
||||
QTimer::singleShot(10000, this, [this]{qDebug() << "SettingUiQrcode slotQrcodeCfgSuccessed";emit signalExitSettingUi();});
|
||||
}
|
||||
}
|
||||
|
||||
|
91
Linguist/setUi/settingUiFastCfg.h
Normal file
91
Linguist/setUi/settingUiFastCfg.h
Normal file
@ -0,0 +1,91 @@
|
||||
#ifndef SETTINGUIFASTCFG_H
|
||||
#define SETTINGUIFASTCFG_H
|
||||
|
||||
#include "settingUiDevMng.h"
|
||||
#include "recoUiRecognize.h"
|
||||
|
||||
|
||||
|
||||
class settingUiFastCfgWireNet : public MyWidgetWithMainStyleColor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static int m_pageIndex;
|
||||
explicit settingUiFastCfgWireNet(int pageIndex, QWidget *parent = nullptr);
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
void signalJumpPage(int pageIndex);
|
||||
|
||||
public slots:
|
||||
void slotBtnClicked();
|
||||
|
||||
private:
|
||||
settingUiDevMngNetWire* m_wireNet;
|
||||
QPushButton* m_btnNext;
|
||||
};
|
||||
|
||||
class settingUiPark : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum{
|
||||
FAST_CFG_DEV_POSI
|
||||
#if 0
|
||||
FAST_CFG_PARK_INFO,
|
||||
FAST_CFG_SERVER
|
||||
#endif
|
||||
};
|
||||
static int m_pageIndex;
|
||||
explicit settingUiPark(QWidget *parent = nullptr);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
};
|
||||
|
||||
class settingUiFastCfgPark : public MyWidgetWithMainStyleColor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static int m_pageIndex;
|
||||
explicit settingUiFastCfgPark(int pageIndex, QWidget *parent = nullptr);
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
void signalJumpPage(int pageIndex);
|
||||
|
||||
public slots:
|
||||
void slotBtnClicked();
|
||||
|
||||
private:
|
||||
settingUiPark* m_park;
|
||||
QPushButton* m_btnNext;
|
||||
};
|
||||
|
||||
class SettingUiQrcode : public WidgetWithBackstageInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static int m_pageIndex;
|
||||
static const int TIP_FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
|
||||
static const QString BG_RES_FILE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
|
||||
explicit SettingUiQrcode(int pageIndex, QWidget *parent = nullptr);
|
||||
void reset();
|
||||
signals:
|
||||
void signalExitSettingUi();
|
||||
|
||||
public slots:
|
||||
void slotCenterMsg(const int nPage, const QString& msg);
|
||||
void slotQrcodeFastCfgResult(bool isSuccessed);
|
||||
|
||||
private:
|
||||
CenterMsgWidget* m_widget_cMsg;
|
||||
};
|
||||
|
||||
|
||||
#endif // SETTINGUIFASTCFG_H
|
120
Linguist/setUi/settingUiInfo.cpp
Normal file
120
Linguist/setUi/settingUiInfo.cpp
Normal file
@ -0,0 +1,120 @@
|
||||
#include "settingUiInfo.h"
|
||||
#include <QDebug>
|
||||
#include "UiConfig.h"
|
||||
|
||||
|
||||
int settingUiInfo::m_pageIndex = 0;
|
||||
settingUiInfo::settingUiInfo(int pageIndex, QWidget *parent)
|
||||
: SettingUiPage(QVector<SettingUiPage::SetOpn>{
|
||||
SetOpn(tr("设备编码"), "FTxxxxxxxxxxxx"),
|
||||
SetOpn(tr("软件版本"), "FG_B020_V100R001Bxxx"),
|
||||
SetOpn(tr("硬件配置"), "HWxxxxxxxxxxxxxx"),
|
||||
SetOpn(tr("MAC地址"), "xx:xx:xx:xx:xx"),
|
||||
SetOpn(tr("设备IP"), "xxx.xxx.xxx.xxx"),
|
||||
SetOpn(tr("屏下NFC ID"), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
|
||||
SetOpn(tr("拓展NFC ID"), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
|
||||
SetOpn(tr("总容量(GB)"), "xx"),
|
||||
SetOpn(tr("可用容量(GB)"), "x"),
|
||||
SetOpn(tr("注册人数"), "xxxxx"),
|
||||
SetOpn(tr("未上传通行记录"), "xxxxxx")
|
||||
}, parent)
|
||||
{
|
||||
m_pageIndex = pageIndex;
|
||||
qDebug() << "settingUiInfo()";
|
||||
}
|
||||
|
||||
settingUiInfo::~settingUiInfo()
|
||||
{
|
||||
qDebug() << "~settingUiInfo()";
|
||||
}
|
||||
|
||||
void settingUiInfo::setBackstageUiinterface(BackstageInterfaceForUi* interface)
|
||||
{
|
||||
m_backstageIf = interface;
|
||||
reset();
|
||||
}
|
||||
|
||||
void settingUiInfo::reset()
|
||||
{
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < config.size(); i ++)
|
||||
{
|
||||
QListWidgetItem* pItem = m_listWidget->item(i);
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(pItem));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
QString str;
|
||||
const int iBufSize = 64;
|
||||
char buf[iBufSize] = {'\0'};
|
||||
switch(i)
|
||||
{
|
||||
case INFO_CHECK_DEV_ID:qDebug() << "INFO_CHECK_DEV_ID";
|
||||
if(0 == m_backstageIf->getDeviceId(buf, iBufSize)){
|
||||
str = QString(buf);
|
||||
}
|
||||
break;
|
||||
case INFO_CHECK_SOFT_VERSION:qDebug() << "INFO_CHECK_SOFT_VERSION";
|
||||
if(0 == m_backstageIf->getAppVersion(buf, iBufSize)){
|
||||
str = QString(buf);
|
||||
}
|
||||
break;
|
||||
case INFO_CHECK_HARD_VERSION:qDebug() << "INFO_CHECK_HARD_VERSION";
|
||||
if(0 == m_backstageIf->getHardwareConfig(buf, iBufSize)){
|
||||
str = QString(buf);
|
||||
}
|
||||
break;
|
||||
case INFO_CHECK_MAC:qDebug() << "INFO_CHECK_MAC";
|
||||
if(0 == m_backstageIf->getEthMac(buf, iBufSize)){
|
||||
str = QString(buf);
|
||||
}
|
||||
break;
|
||||
case INFO_CHECK_IP:qDebug() << "INFO_CHECK_IP";
|
||||
{
|
||||
int type = 0;
|
||||
if(0 == m_backstageIf->getIP(buf, iBufSize, type)){
|
||||
str = QString(buf);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case INFO_UNDER_SCREEN_NFC_MODULE_ID:qDebug() << "INFO_UNDER_SCREEN_NFC_MODULE_ID";
|
||||
str = QString::fromStdString(m_backstageIf->getUnderScreenNfcModuleId());
|
||||
break;
|
||||
|
||||
case INFO_EXTEND_NFC_MODULE_ID:qDebug() << "INFO_EXTEND_NFC_MODULE_ID";
|
||||
str = QString::fromStdString(m_backstageIf->getExtendNfcModuleId());
|
||||
break;
|
||||
case INFO_CHECK_SPACE_TOTAL:qDebug() << "INFO_CHECK_SPACE_TOTAL";
|
||||
{
|
||||
float free = 0;
|
||||
int total = 0;
|
||||
if(0 == m_backstageIf->getStorSpace(total, free)){
|
||||
str = QString::number(total);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case INFO_CHECK_SPACE_FREE:qDebug() << "INFO_CHECK_SPACE_FREE";
|
||||
{
|
||||
float free = 0;
|
||||
int total = 0;
|
||||
if(0 == m_backstageIf->getStorSpace(total, free)){
|
||||
str.setNum(free, 'f', 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case INFO_CHECK_PERSON_REG:qDebug() << "INFO_CHECK_PERSON_REG";
|
||||
str = QString::number(m_backstageIf->getRegisterNum());
|
||||
break;
|
||||
case INFO_CHECK_NOT_UP_ACC_RED_QTY:qDebug() << "INFO_CHECK_NOT_UP_ACC_RED_QTY";
|
||||
str = QString::number(m_backstageIf->getAccessRecordNotUpload());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
wdt->updateLabel(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
42
Linguist/setUi/settingUiInfo.h
Normal file
42
Linguist/setUi/settingUiInfo.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef SETTINGUIINFO_H
|
||||
#define SETTINGUIINFO_H
|
||||
|
||||
#include <QListWidget>
|
||||
#include "UiTools.h"
|
||||
|
||||
class settingUiInfo : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
INFO_CHECK_DEV_ID,
|
||||
INFO_CHECK_SOFT_VERSION,
|
||||
INFO_CHECK_HARD_VERSION,
|
||||
INFO_CHECK_MAC,
|
||||
INFO_CHECK_IP,
|
||||
INFO_UNDER_SCREEN_NFC_MODULE_ID,
|
||||
INFO_EXTEND_NFC_MODULE_ID,
|
||||
INFO_CHECK_SPACE_TOTAL,
|
||||
INFO_CHECK_SPACE_FREE,
|
||||
INFO_CHECK_PERSON_REG,
|
||||
INFO_CHECK_NOT_UP_ACC_RED_QTY
|
||||
}INFO_CHECK_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiInfo(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiInfo();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem* item){Q_UNUSED(item);}
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // SETTINGUIINFO_H
|
296
Linguist/setUi/settingUiRecoSet.cpp
Normal file
296
Linguist/setUi/settingUiRecoSet.cpp
Normal file
@ -0,0 +1,296 @@
|
||||
#include "settingUiRecoSet.h"
|
||||
#include <QDebug>
|
||||
#include "UiConfig.h"
|
||||
|
||||
|
||||
int settingUiRecoSet::m_pageIndex = 0;
|
||||
settingUiRecoSet::settingUiRecoSet(int pageIndex, QWidget *parent)
|
||||
: SettingUiPage(QVector<SettingUiPage::SetOpn>{
|
||||
SetOpn(tr("身份核验"), "", myListWidget::enPropertySwitch),
|
||||
SetOpn(tr("活体检测"), "", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("人脸识别阈值"), "xx", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("人脸识别自定义阈值(0-100):"), "xx", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("居民二代身份证"), "", static_cast<myListWidget::enProperty>(myListWidget::enPropertySwitch | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("口罩检测"), "", myListWidget::enPropertySwitch),
|
||||
SetOpn(tr("未戴口罩禁止通行"), "", static_cast<myListWidget::enProperty>(myListWidget::enPropertySwitch | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("健康码核验"), "", myListWidget::enPropertySwitch),
|
||||
SetOpn(tr("允许无人脸核验"), "", static_cast<myListWidget::enProperty>(myListWidget::enPropertySwitch | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("允许陌生人通行"), "", static_cast<myListWidget::enProperty>(myListWidget::enPropertySwitch | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("核验通行条件"), "", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyIndent1))
|
||||
}, parent)
|
||||
{
|
||||
m_pageIndex = pageIndex;
|
||||
qDebug() << "settingUiRecoSet()";
|
||||
}
|
||||
|
||||
settingUiRecoSet::~settingUiRecoSet()
|
||||
{
|
||||
qDebug() << "~settingUiRecoSet()";
|
||||
}
|
||||
|
||||
void settingUiRecoSet::setBackstageUiinterface(BackstageInterfaceForUi* interface)
|
||||
{
|
||||
m_backstageIf = interface;
|
||||
reset();
|
||||
}
|
||||
|
||||
void settingUiRecoSet::reset()
|
||||
{
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < config.size(); i ++)
|
||||
{
|
||||
QListWidgetItem* pItem = m_listWidget->item(i);
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(pItem));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
QString str;
|
||||
switch(i)
|
||||
{
|
||||
case enRecoIdeSw:
|
||||
case enRecoMaskSw:
|
||||
case enRecoNoMaskNoPassSw:
|
||||
case enRecoLiveSw:
|
||||
case enRecoIDFaceVerify:
|
||||
case enHealthCodeSw:
|
||||
case enHealthCodeNoFaceRequiredSw:
|
||||
case enHealthCodeAllowStrangerSw:
|
||||
{
|
||||
bool switch_option = false;
|
||||
if(enRecoIdeSw == i){
|
||||
switch_option = m_backstageIf->getIdentificationSw();
|
||||
}else if(enRecoMaskSw == i){
|
||||
switch_option = m_backstageIf->getMaskCheckSwitch();
|
||||
}else if(enRecoNoMaskNoPassSw == i){
|
||||
switch_option = m_backstageIf->getNoMaskNoPassSwitch();
|
||||
}else if(enRecoLiveSw == i){
|
||||
switch_option = m_backstageIf->getLivingBodySw();
|
||||
}else if(enRecoIDFaceVerify == i){
|
||||
switch_option = m_backstageIf->getIDFaceVerifySw();
|
||||
}else if(enHealthCodeSw == i){
|
||||
switch_option = m_backstageIf->getHealthCodeSw();
|
||||
}else if(enHealthCodeNoFaceRequiredSw == i){
|
||||
switch_option = m_backstageIf->getHealthCodeNoFaceRequired();
|
||||
}else if(enHealthCodeAllowStrangerSw == i){
|
||||
switch_option = m_backstageIf->getHealthCodeAllowStranger();
|
||||
}
|
||||
wdt->updateIcon(switch_option ? ":/res/image/on.png" : ":/res/image/off.png");
|
||||
}
|
||||
break;
|
||||
|
||||
case enRecoIdeThreCustom:
|
||||
str = QString::number(m_backstageIf->getCustomSimilarity());
|
||||
break;
|
||||
case enRecoIdeThre:
|
||||
{
|
||||
enSimilarityTh opt = m_backstageIf->getSimilarityTh();
|
||||
str = RecoSimThre[static_cast<int>(opt)];
|
||||
}
|
||||
break;
|
||||
// case enRecoLiveThre:
|
||||
// str = LivingThre[static_cast<int>(m_backstageIf->getLivingBodyTh())];
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
wdt->updateLabel(str);
|
||||
}
|
||||
controlListWidgetItemShow(m_backstageIf->getIdentificationSw(), enRecoLiveSw);
|
||||
//controlListWidgetItemShow(m_backstageIf->getIdentificationSw(), enRecoLiveThre);
|
||||
controlListWidgetItemShow(m_backstageIf->getIdentificationSw(), enRecoIdeThre);
|
||||
controlListWidgetItemShow(m_backstageIf->getIdentificationSw() ? SimilarityThCustom == m_backstageIf->getSimilarityTh() : false, enRecoIdeThreCustom);
|
||||
controlListWidgetItemShow(m_backstageIf->getIdentificationSw(), enRecoIDFaceVerify);
|
||||
controlListWidgetItemShow(m_backstageIf->getMaskCheckSwitch(), enRecoNoMaskNoPassSw);
|
||||
controlListWidgetItemShow(m_backstageIf->getHealthCodeSw(), enHealthCodeNoFaceRequiredSw);
|
||||
controlListWidgetItemShow(m_backstageIf->getHealthCodeSw(), enHealthCodeAllowStrangerSw);
|
||||
controlListWidgetItemShow(m_backstageIf->getHealthCodeSw(), enHealthCodePassCfg);
|
||||
}
|
||||
|
||||
void settingUiRecoSet::slotItemClicked(QListWidgetItem* item)
|
||||
{
|
||||
int row = m_listWidget->currentRow();
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
switch(row){
|
||||
case enRecoIdeSw:
|
||||
case enRecoMaskSw:
|
||||
case enRecoNoMaskNoPassSw:
|
||||
case enRecoLiveSw:
|
||||
case enRecoIDFaceVerify:
|
||||
case enHealthCodeSw:
|
||||
case enHealthCodeNoFaceRequiredSw:
|
||||
case enHealthCodeAllowStrangerSw:
|
||||
{
|
||||
bool setting_value = false;
|
||||
|
||||
if(enRecoIdeSw == row){
|
||||
setting_value = static_cast<bool>(m_backstageIf->getIdentificationSw());
|
||||
}
|
||||
else if(enRecoMaskSw == row){
|
||||
setting_value = static_cast<bool>(m_backstageIf->getMaskCheckSwitch());
|
||||
}
|
||||
else if(enRecoNoMaskNoPassSw == row){
|
||||
setting_value = static_cast<bool>(m_backstageIf->getNoMaskNoPassSwitch());
|
||||
}
|
||||
else if(enRecoLiveSw == row){
|
||||
setting_value = static_cast<bool>(m_backstageIf->getLivingBodySw());
|
||||
}
|
||||
else if(enRecoIDFaceVerify == row){
|
||||
setting_value = static_cast<bool>(m_backstageIf->getIDFaceVerifySw());
|
||||
}
|
||||
else if(enHealthCodeSw == row){
|
||||
setting_value = m_backstageIf->getHealthCodeSw();
|
||||
}
|
||||
else if(enHealthCodeNoFaceRequiredSw == row){
|
||||
setting_value = m_backstageIf->getHealthCodeNoFaceRequired();
|
||||
}
|
||||
else if(enHealthCodeAllowStrangerSw == row){
|
||||
setting_value = m_backstageIf->getHealthCodeAllowStranger();
|
||||
}
|
||||
|
||||
setting_value = static_cast<bool>(!setting_value);
|
||||
wdt->updateIcon(setting_value ? ":/res/image/on.png" : ":/res/image/off.png");
|
||||
|
||||
if(enRecoIdeSw == row){
|
||||
m_backstageIf->setIdentificationSw(setting_value);
|
||||
controlListWidgetItemShow(setting_value, enRecoLiveSw);
|
||||
//controlListWidgetItemShow(setting_value, enRecoLiveThre);
|
||||
controlListWidgetItemShow(setting_value, enRecoIdeThre);
|
||||
controlListWidgetItemShow(setting_value, enRecoIDFaceVerify);
|
||||
controlListWidgetItemShow(setting_value ? SimilarityThCustom == m_backstageIf->getSimilarityTh() : false, enRecoIdeThreCustom);
|
||||
}
|
||||
else if(enRecoMaskSw == row){
|
||||
m_backstageIf->setMaskCheckSwitch(setting_value);
|
||||
controlListWidgetItemShow(setting_value, enRecoNoMaskNoPassSw);
|
||||
}
|
||||
else if(enRecoNoMaskNoPassSw == row){
|
||||
m_backstageIf->setNoMaskNoPassSwitch(setting_value);
|
||||
}
|
||||
else if(enRecoLiveSw == row){
|
||||
m_backstageIf->setLivingBodySw(setting_value);
|
||||
}
|
||||
else if(enRecoIDFaceVerify == row){
|
||||
m_backstageIf->setIDFaceVerifySw(setting_value);
|
||||
}
|
||||
else if(enHealthCodeSw == row){
|
||||
m_backstageIf->setHealthCodeSw(setting_value);
|
||||
controlListWidgetItemShow(setting_value, enHealthCodeNoFaceRequiredSw);
|
||||
controlListWidgetItemShow(setting_value, enHealthCodeAllowStrangerSw);
|
||||
controlListWidgetItemShow(setting_value, enHealthCodePassCfg);
|
||||
if(setting_value){
|
||||
myListWidget* wdg = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(m_listWidget->item(enRecoIdeSw)));
|
||||
if(wdg){wdg->updateIcon(":/res/image/on.png");}
|
||||
wdg = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(m_listWidget->item(enRecoIDFaceVerify)));
|
||||
if(wdg){wdg->updateIcon(":/res/image/on.png");}
|
||||
}
|
||||
}
|
||||
else if(enHealthCodeNoFaceRequiredSw == row){
|
||||
m_backstageIf->setHealthCodeNoFaceRequired(setting_value);
|
||||
}
|
||||
else if(enHealthCodeAllowStrangerSw == row){
|
||||
m_backstageIf->setHealthCodeAllowStranger(setting_value);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case enRecoIdeThreCustom:
|
||||
{
|
||||
int currentValue = 10;
|
||||
int min = 0;
|
||||
int max = 100;
|
||||
QString tip("this is a line of prompt text");
|
||||
#ifndef DEBUG_MODE
|
||||
if(enRecoIdeThreCustom == row){
|
||||
currentValue = m_backstageIf->getCustomSimilarity();
|
||||
min = 0;
|
||||
max = 100;
|
||||
tip.clear();
|
||||
}
|
||||
#endif
|
||||
SliderDialog dlg(currentValue, min, max, tip, parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString str("valueSet");
|
||||
int valueSet = dlg.getValueSet();
|
||||
#ifndef DEBUG_MODE
|
||||
if(enRecoIdeThreCustom == row){
|
||||
m_backstageIf->setCustomSimilarity(valueSet);
|
||||
str = QString::number(valueSet);
|
||||
}
|
||||
#endif
|
||||
wdt->updateLabel(str);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case enRecoIdeThre:
|
||||
{
|
||||
int choosed = 0;
|
||||
QVector<QString>& options = const_cast<QVector<QString>&>(RecoSimThre);
|
||||
if(enRecoIdeThre == row){
|
||||
choosed = static_cast<int>(m_backstageIf->getSimilarityTh());
|
||||
}
|
||||
#if 0
|
||||
else if(enRecoLiveThre == row){
|
||||
options = LivingThre;
|
||||
choosed = static_cast<int>(m_backstageIf->getLivingBodyTh());
|
||||
}
|
||||
#endif
|
||||
RadioBtnChooseDialog dlg(options, parent()->parent(), choosed);
|
||||
if(dlg.exec() == QDialog::Accepted){
|
||||
int newChoosed = dlg.getChoosedIndex();
|
||||
if(newChoosed != choosed){
|
||||
if(enRecoIdeThre == row){
|
||||
m_backstageIf->setSimilarityTh(static_cast<enSimilarityTh>(newChoosed));
|
||||
if(SimilarityThCustom == static_cast<enSimilarityTh>(newChoosed)){
|
||||
//重新获取当前的阈值显示到条目上,因为当前是从别的档位切换过来的,阈值已经改变,设计的问题:只保存一个当前阈值,没有单独保存自定义的阈值
|
||||
QListWidgetItem* pItem = m_listWidget->item(enRecoIdeThreCustom);
|
||||
myListWidget* swWidget = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(pItem));
|
||||
if(swWidget != nullptr){
|
||||
swWidget->updateLabel(QString::number(m_backstageIf->getCustomSimilarity()));
|
||||
}
|
||||
controlListWidgetItemShow(true, enRecoIdeThreCustom);
|
||||
}
|
||||
else{
|
||||
controlListWidgetItemShow(false, enRecoIdeThreCustom);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else if(enRecoLiveThre == row){
|
||||
m_backstageIf->setLivingBodyTh(static_cast<enLivingBodyTh>(newChoosed));
|
||||
}
|
||||
#endif
|
||||
wdt->updateLabel(options[newChoosed]);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case enHealthCodePassCfg:
|
||||
{
|
||||
const QStringList titles{"健康码色", "核酸检测", "行程信息", "疫苗"};
|
||||
const QVector<QStringList> sels{{"无限制", "仅绿码可通行", "绿码、黄码可通行", "绿码、黄码、红码可通行"},
|
||||
{"无限制", "限24小时内阴性", "限48小时内阴性", "限72小时内阴性", "限阴性"},
|
||||
{"无限制", "限14天内未到过中高风险地区"},
|
||||
{"无限制", "限至少打了第1针", "限至少打了第2针", "限至少打了第3针"} };
|
||||
ComSelectDialog dlg(titles, sels, parent()->parent());
|
||||
int codeColorCfg;
|
||||
int c19tCfg;
|
||||
int tripCfg;
|
||||
int abtCfg;
|
||||
m_backstageIf->getHealthCodePassCfg(codeColorCfg, c19tCfg, tripCfg, abtCfg);
|
||||
dlg.setRow(0, codeColorCfg);
|
||||
dlg.setRow(1, c19tCfg);
|
||||
dlg.setRow(2, tripCfg);
|
||||
dlg.setRow(3, abtCfg);
|
||||
if(dlg.exec() == QDialog::Accepted){
|
||||
m_backstageIf->setHealthCodePassCfg(dlg.getRow(0), dlg.getRow(1), dlg.getRow(2), dlg.getRow(3));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
56
Linguist/setUi/settingUiRecoSet.h
Normal file
56
Linguist/setUi/settingUiRecoSet.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef SETTINGUIRECOSET_H
|
||||
#define SETTINGUIRECOSET_H
|
||||
|
||||
#include <QListWidget>
|
||||
#include "UiTools.h"
|
||||
|
||||
class settingUiRecoSet : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
enRecoIdeSw,
|
||||
enRecoLiveSw,
|
||||
//enRecoLiveThre,
|
||||
enRecoIdeThre,
|
||||
enRecoIdeThreCustom,
|
||||
enRecoIDFaceVerify,
|
||||
enRecoMaskSw,
|
||||
enRecoNoMaskNoPassSw,
|
||||
enHealthCodeSw,
|
||||
enHealthCodeNoFaceRequiredSw,
|
||||
enHealthCodeAllowStrangerSw,
|
||||
enHealthCodePassCfg,
|
||||
}enRecoSet;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiRecoSet(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiRecoSet();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
|
||||
protected slots:
|
||||
void slotItemClicked(QListWidgetItem* item);
|
||||
|
||||
private:
|
||||
|
||||
const QVector<QString> RecoSimThre = {
|
||||
tr("宽松"),
|
||||
tr("一般"),
|
||||
tr("适中"),
|
||||
tr("严格"),
|
||||
tr("极严格"),
|
||||
tr("自定义")
|
||||
};
|
||||
|
||||
const QVector<QString> LivingThre = {
|
||||
tr("宽松"),
|
||||
tr("一般"),
|
||||
tr("严格")
|
||||
};
|
||||
};
|
||||
#endif // SETTINGUIRECOSET_H
|
308
Linguist/setUi/settingUiSysMng.cpp
Normal file
308
Linguist/setUi/settingUiSysMng.cpp
Normal file
@ -0,0 +1,308 @@
|
||||
#include <QDebug>
|
||||
#include "settingUiSysMng.h"
|
||||
#include "UiConfig.h"
|
||||
|
||||
|
||||
int settingUiSysMng::m_pageIndex = 0;
|
||||
settingUiSysMng::settingUiSysMng(int pageIndex, QWidget *parent)
|
||||
: SettingUiPage(QVector<SettingUiPage::SetOpn>{
|
||||
SetOpn(tr("设备语言"), "xxxxx", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("数据加密"), "", myListWidget::enPropertySwitch),
|
||||
SetOpn(tr("自动重启"), "", myListWidget::enPropertySwitch),
|
||||
SetOpn(tr("自动重启时间"), "xx:xx", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("自动重启间隔(天)"), "xx", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyIndent1)),
|
||||
SetOpn(tr("手动重启"), "", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("服务器"), "xxxxxxxxxxxx:xxxx", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("数据清空"), "", myListWidget::enPropertyMoreArrow),
|
||||
SetOpn(tr("恢复出厂设置"), "", static_cast<myListWidget::enProperty>(myListWidget::enPropertyMoreArrow | myListWidget::enPropertyRedWord))
|
||||
}, parent)
|
||||
{
|
||||
m_pageIndex = pageIndex;
|
||||
qDebug() << "settingUiSysMng()";
|
||||
}
|
||||
|
||||
settingUiSysMng::~settingUiSysMng()
|
||||
{
|
||||
qDebug() << "~settingUiSysMng()";
|
||||
}
|
||||
|
||||
void settingUiSysMng::setBackstageUiinterface(BackstageInterfaceForUi *interface)
|
||||
{
|
||||
m_backstageIf = interface;
|
||||
reset();
|
||||
}
|
||||
|
||||
void settingUiSysMng::reset()
|
||||
{
|
||||
if(nullptr == m_backstageIf){
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < config.size(); i ++)
|
||||
{
|
||||
QListWidgetItem* pItem = m_listWidget->item(i);
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(pItem));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
QString str;
|
||||
const int iBufSize = 64;
|
||||
char buf[iBufSize] = {'\0'};
|
||||
switch(i)
|
||||
{
|
||||
case SYS_MNG_LANGUAGE:
|
||||
{
|
||||
int lang = static_cast<int>(m_backstageIf->getLanguage());
|
||||
if(lang >= 0 && lang < Language.size()){
|
||||
str = Language[lang];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SYS_MNG_AUTO_REBOOT:
|
||||
{
|
||||
bool switch_option = false;
|
||||
if(SYS_MNG_AUTO_REBOOT == i){
|
||||
switch_option = m_backstageIf->getAutoRebootSw();
|
||||
}
|
||||
wdt->updateIcon(switch_option ? ":/res/image/on.png" : ":/res/image/off.png");
|
||||
}
|
||||
break;
|
||||
case SYS_MNG_AUTO_REBOOT_TIME:
|
||||
if(0 == m_backstageIf->getAutoRebootTime(buf, iBufSize)){
|
||||
str = QString(buf);
|
||||
}
|
||||
break;
|
||||
case SYS_MNG_AUTO_REBOOT_INTERVAL:
|
||||
str = QString::number(m_backstageIf->getAutoRebootInterval());
|
||||
break;
|
||||
case SYS_MNG_SERVER_ADDR:
|
||||
if(0 == m_backstageIf->getServerAddr(buf, iBufSize)){
|
||||
str = QString(buf);
|
||||
}
|
||||
break;
|
||||
case SYS_MNG_DATA_ENCRYPT:qDebug() << "SYS_MNG_DATA_ENCRYPT";
|
||||
{
|
||||
bool switch_option = m_backstageIf->getDataEncryptSw();
|
||||
wdt->updateIcon(switch_option ? ":/res/image/on.png" : ":/res/image/off.png");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
wdt->updateLabel(str);
|
||||
}
|
||||
controlListWidgetItemShow(m_backstageIf->getAutoRebootSw(), SYS_MNG_AUTO_REBOOT_TIME);
|
||||
controlListWidgetItemShow(m_backstageIf->getAutoRebootSw(), SYS_MNG_AUTO_REBOOT_INTERVAL);
|
||||
controlListWidgetItemShow(!UiConfig::GetInstance()->isFuncNotSupport(FuncDataEncrypt), SYS_MNG_DATA_ENCRYPT);
|
||||
}
|
||||
|
||||
void settingUiSysMng::slotItemClicked(QListWidgetItem* item)
|
||||
{
|
||||
if(nullptr == m_backstageIf){
|
||||
#ifndef DEBUG_MODE
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
int row = m_listWidget->currentRow();
|
||||
myListWidget* wdt = dynamic_cast<myListWidget*>(m_listWidget->itemWidget(item));
|
||||
if(wdt == nullptr){
|
||||
return;
|
||||
}
|
||||
switch(row){
|
||||
case SYS_MNG_LANGUAGE:
|
||||
{
|
||||
int choosed = 0;
|
||||
const QVector<QString>& opts = Language;
|
||||
if(SYS_MNG_LANGUAGE == row){
|
||||
#ifndef DEBUG_MODE
|
||||
choosed = static_cast<int>(m_backstageIf->getLanguage());
|
||||
#endif
|
||||
}
|
||||
|
||||
RadioBtnChooseDialog dlg(opts, parent()->parent(), choosed, &LanguageSup, "");
|
||||
if(QDialog::Accepted == dlg.exec())
|
||||
{
|
||||
int newChoosed = dlg.getChoosedIndex();
|
||||
qDebug() << "newChoosed:" << newChoosed;
|
||||
if(newChoosed != choosed){
|
||||
QuestionDialog queDlg(tr("您需要重新启动设备以设置并切换语言"), parent()->parent(), tr("重新启动"));
|
||||
if(QDialog::Accepted == queDlg.exec()){
|
||||
#ifndef DEBUG_MODE
|
||||
m_backstageIf->setLanguage(newChoosed);
|
||||
PureColorPage* black = new PureColorPage(0);
|
||||
black->show();
|
||||
QTimer::singleShot(1000, this, SLOT(slotSysReboot()));
|
||||
//m_backstageIf->devReboot();
|
||||
#endif
|
||||
wdt->updateLabel(opts[newChoosed]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SYS_MNG_DATA_ENCRYPT:
|
||||
{
|
||||
bool setting_value = !(m_backstageIf->getDataEncryptSw());
|
||||
QuestionDialog queDlg(setting_value ? tr("您确定要开启数据加密吗?若确定设备将重启!") : tr("您确定要关闭数据加密吗?若确定设备将重启!"), parent()->parent());
|
||||
if(QDialog::Accepted == queDlg.exec()){
|
||||
wdt->updateIcon(setting_value ? ":/res/image/on.png" : ":/res/image/off.png");
|
||||
m_backstageIf->setDataEncryptSw(setting_value);
|
||||
QTimer::singleShot(1000, this, SLOT(slotSysReboot()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SYS_MNG_AUTO_REBOOT:
|
||||
{
|
||||
bool setting_value = false;
|
||||
#ifndef DEBUG_MODE
|
||||
if(SYS_MNG_AUTO_REBOOT == row){
|
||||
setting_value = static_cast<bool>(m_backstageIf->getAutoRebootSw());
|
||||
}
|
||||
#endif
|
||||
setting_value = static_cast<bool>(!setting_value);
|
||||
wdt->updateIcon(setting_value ? ":/res/image/on.png" : ":/res/image/off.png");
|
||||
#ifndef DEBUG_MODE
|
||||
if(SYS_MNG_AUTO_REBOOT == row){
|
||||
m_backstageIf->setAutoRebootSw(setting_value);
|
||||
controlListWidgetItemShow(setting_value, SYS_MNG_AUTO_REBOOT_TIME);
|
||||
controlListWidgetItemShow(setting_value, SYS_MNG_AUTO_REBOOT_INTERVAL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case SYS_MNG_AUTO_REBOOT_TIME:
|
||||
{
|
||||
const int iBufSize = 64;
|
||||
char buf[iBufSize] = {'\0'};
|
||||
if(0 == m_backstageIf->getAutoRebootTime(buf, iBufSize)){
|
||||
QDateTime dateTime(QDateTime::currentDateTime());
|
||||
dateTime.setTime(QTime().fromString(QString(buf), "hh:mm"));
|
||||
DateTimeDialog timeDlg(dateTime, parent()->parent(), false);
|
||||
if(timeDlg.exec() == QDialog::Accepted){
|
||||
m_backstageIf->setAutoRebootTime(timeDlg.getValueSet().toString("hh:mm").toStdString().c_str());
|
||||
wdt->updateLabel(timeDlg.getValueSet().toString("hh:mm"));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SYS_MNG_AUTO_REBOOT_INTERVAL:
|
||||
{
|
||||
int currentValue = 10;
|
||||
int min = 0;
|
||||
int max = 100;
|
||||
QString tip("this is a line of prompt text");
|
||||
#ifndef DEBUG_MODE
|
||||
if(SYS_MNG_AUTO_REBOOT_INTERVAL == row){
|
||||
currentValue = m_backstageIf->getAutoRebootInterval();
|
||||
min = 1;
|
||||
max = 100;
|
||||
tip.clear();
|
||||
}
|
||||
#endif
|
||||
SliderDialog dlg(currentValue, min, max, tip, parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString str("valueSet");
|
||||
int valueSet = dlg.getValueSet();
|
||||
#ifndef DEBUG_MODE
|
||||
if(SYS_MNG_AUTO_REBOOT_INTERVAL == row){
|
||||
m_backstageIf->setAutoRebootInterval(valueSet);
|
||||
str = QString::number(valueSet);
|
||||
}
|
||||
#endif
|
||||
wdt->updateLabel(str);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SYS_MNG_SERVER_ADDR:
|
||||
{
|
||||
bool settingFailed = true;
|
||||
do{
|
||||
QStringList strs;
|
||||
if(SYS_MNG_SERVER_ADDR == row){
|
||||
strs << tr("服务器地址:") << tr("端口:");
|
||||
}
|
||||
LineEditInputDialog dlg(strs, parent()->parent());
|
||||
if(dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString str;
|
||||
do{
|
||||
if(SYS_MNG_SERVER_ADDR == row){
|
||||
if("" != dlg.getRow(0) && "" != dlg.getRow(1)){
|
||||
bool isDigi = false;
|
||||
int valueSet = dlg.getRow(1).toInt(&isDigi);
|
||||
if( (!isDigi) || (valueSet < 0 || valueSet > 65535)){
|
||||
break;
|
||||
}
|
||||
if(m_backstageIf){
|
||||
str = dlg.getRow(0) + ":" + dlg.getRow(1);
|
||||
m_backstageIf->setServerAddr(const_cast<char*>(str.toStdString().c_str()));
|
||||
wdt->updateLabel(str);
|
||||
settingFailed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}while(0);
|
||||
}
|
||||
else {
|
||||
settingFailed = false;
|
||||
}
|
||||
if(settingFailed)
|
||||
{
|
||||
InfoDialog(tr("设置有误,请重新输入!"), parent()->parent()).exec();
|
||||
}
|
||||
}while(settingFailed);
|
||||
}
|
||||
break;
|
||||
|
||||
case SYS_MNG_MAN_REBOOT:
|
||||
case SYS_MNG_CLEAR_DATA:
|
||||
case SYS_MNG_RESTORE:
|
||||
{
|
||||
QString que;
|
||||
QString btnText;
|
||||
if(SYS_MNG_MAN_REBOOT == row){
|
||||
que = tr("您确定重新启动FaceTick吗?");
|
||||
btnText = tr("重新启动");
|
||||
}
|
||||
else if(SYS_MNG_CLEAR_DATA == row){
|
||||
que = tr("您确定清空数据吗?");
|
||||
btnText = tr("清空数据");
|
||||
}
|
||||
else if(SYS_MNG_RESTORE == row){
|
||||
que = tr("您确定恢复出厂设置吗?");
|
||||
btnText = tr("恢复");
|
||||
}
|
||||
QuestionDialog dlg(que, parent()->parent(), btnText);
|
||||
if(QDialog::Accepted == dlg.exec()){
|
||||
#ifndef DEBUG_MODE
|
||||
if(SYS_MNG_MAN_REBOOT == row){
|
||||
PureColorPage* black = new PureColorPage(0);
|
||||
black->show();
|
||||
QTimer::singleShot(1000, this, SLOT(slotSysReboot()));
|
||||
//m_backstageIf->devReboot();
|
||||
}
|
||||
else if(SYS_MNG_CLEAR_DATA == row){
|
||||
m_backstageIf->cleanData();
|
||||
}
|
||||
else if(SYS_MNG_RESTORE == row){
|
||||
m_backstageIf->recoveryFactorySetting();
|
||||
//create a black page before sys reboot
|
||||
PureColorPage* black = new PureColorPage(0);
|
||||
black->show();
|
||||
QTimer::singleShot(1000, this, SLOT(slotSysReboot()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void settingUiSysMng::slotSysReboot()
|
||||
{
|
||||
m_backstageIf->devReboot();
|
||||
}
|
55
Linguist/setUi/settingUiSysMng.h
Normal file
55
Linguist/setUi/settingUiSysMng.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef SETTINGUISYSMNG_H
|
||||
#define SETTINGUISYSMNG_H
|
||||
|
||||
#include <QListWidget>
|
||||
#include "UiTools.h"
|
||||
#include "UiConfig.h"
|
||||
|
||||
class settingUiSysMng : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
SYS_MNG_LANGUAGE,
|
||||
SYS_MNG_DATA_ENCRYPT,
|
||||
SYS_MNG_AUTO_REBOOT,
|
||||
SYS_MNG_AUTO_REBOOT_TIME,
|
||||
SYS_MNG_AUTO_REBOOT_INTERVAL,
|
||||
SYS_MNG_MAN_REBOOT,
|
||||
SYS_MNG_SERVER_ADDR,
|
||||
SYS_MNG_CLEAR_DATA,
|
||||
SYS_MNG_RESTORE
|
||||
}SYS_MNG_E;
|
||||
|
||||
static int m_pageIndex;
|
||||
|
||||
explicit settingUiSysMng(int pageIndex, QWidget *parent = nullptr);
|
||||
~settingUiSysMng();
|
||||
void setBackstageUiinterface(BackstageInterfaceForUi *interface);
|
||||
void reset();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
void slotSysReboot();
|
||||
|
||||
private:
|
||||
//简 繁 英 日 韩 西班牙 泰 葡萄牙 意大利 希伯来 法 德 土耳其 匈牙利
|
||||
const QVector<QString> Language{"简体中文", "繁體中文", "English", "日本語", "한국어.",
|
||||
"Español", "ภาษาไทย", "Português", "Italiano", "היברית",
|
||||
"Français", "Deutsch", "Türkçe", "Magyar"};
|
||||
#ifdef __HIMIX200__
|
||||
const QVector<bool> LanguageSup = {true, true, true, true, true,
|
||||
true, true, true, true, true,
|
||||
true, true, true, true};
|
||||
#else
|
||||
const QVector<bool> LanguageSup = {true, true, true, true, true,
|
||||
false, false, false, true, false,
|
||||
false, false, false, false};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif // SETTINGUISYSMNG_H
|
Reference in New Issue
Block a user