[ref]同步711

This commit is contained in:
shi_jq 2025-03-13 15:07:31 +08:00
parent 6ce9a4aa71
commit 6177da452c
12 changed files with 152 additions and 94 deletions

View File

@ -3,15 +3,20 @@
#include "QMessageBox" #include "QMessageBox"
#include <QDebug> #include <QDebug>
#include "dbms/db_sysinfo_api/CDbSysInfo.h" #include "dbms/db_sysinfo_api/CDbSysInfo.h"
#include "pub_widget/MessageBox.h"
QString CCheckUser::m_userName =""; QString CCheckUser::m_userName ="";
CCheckUser::CCheckUser(QWidget *parent) : CCheckUser::CCheckUser(QWidget *parent) :
m_ptrPermMngApi(NULL), m_ptrPermMngApi(NULL),
QDialog(parent), CustomUiDialog(parent),
m_pReadDb(Q_NULLPTR), m_pReadDb(Q_NULLPTR),
ui(new Ui::CCheckUser) ui(new Ui::CCheckUser)
{ {
ui->setupUi(this); ui->setupUi(this);
init(); init();
setResizeable(false);
CustomUiDialog::setAutoLayout(true);
} }
CCheckUser::~CCheckUser() CCheckUser::~CCheckUser()
@ -63,8 +68,8 @@ void CCheckUser::initVariable()
void CCheckUser::initVeiw() void CCheckUser::initVeiw()
{ {
ui->lineEdit_password->setEchoMode(QLineEdit::EchoMode::Password); ui->lineEdit_password->setEchoMode(QLineEdit::EchoMode::Password);
this->setFixedSize(204,150); // this->setFixedSize(204,150);
this->setWindowTitle(tr("")); this->setWindowTitle(tr(""));
} }
void CCheckUser::initSignalSlot() void CCheckUser::initSignalSlot()
@ -100,8 +105,7 @@ void CCheckUser::slot_check()
m_userName = userName; m_userName = userName;
if(m_ptrPermMngApi->SysLogin(userName.toStdString(), password.toStdString(), usergId, 12*60*60, "hmi") != 0) if(m_ptrPermMngApi->SysLogin(userName.toStdString(), password.toStdString(), usergId, 12*60*60, "hmi") != 0)
{ {
QMessageBox::about(this,"提示","登陆失败!"); N_MessageBox::about(this,"提示","登陆失败!");
reject();
return; return;
} }
accept(); accept();

View File

@ -1,14 +1,15 @@
#ifndef CCHECKUSER_H #ifndef CCHECKUSER_H
#define CCHECKUSER_H #define CCHECKUSER_H
#include <QDialog>
#include "perm_mng_api/PermMngApi.h" #include "perm_mng_api/PermMngApi.h"
#include "db_api_ex/CDbApi.h" #include "db_api_ex/CDbApi.h"
#include "pub_widget/CustomDialog.h"
namespace Ui { namespace Ui {
class CCheckUser; class CCheckUser;
} }
class CCheckUser : public QDialog class CCheckUser : public CustomUiDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -13,70 +13,64 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<widget class="QWidget" name="layoutWidget"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="geometry"> <item>
<rect> <layout class="QVBoxLayout" name="verticalLayout">
<x>10</x> <item>
<y>10</y> <layout class="QGridLayout" name="gridLayout">
<width>180</width> <item row="0" column="0">
<height>136</height> <widget class="QLabel" name="label">
</rect> <property name="text">
</property> <string>用户名</string>
<layout class="QVBoxLayout" name="verticalLayout"> </property>
<item> </widget>
<layout class="QGridLayout" name="gridLayout"> </item>
<item row="0" column="0"> <item row="2" column="1">
<widget class="QLabel" name="label"> <widget class="QComboBox" name="comboBox_userg"/>
<property name="text"> </item>
<string>用户名</string> <item row="3" column="0">
</property> <widget class="QLabel" name="label_2">
</widget> <property name="text">
</item> <string>密码</string>
<item row="2" column="1"> </property>
<widget class="QComboBox" name="comboBox_userg"/> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="1">
<widget class="QLabel" name="label_2"> <widget class="QLineEdit" name="lineEdit_password"/>
<property name="text"> </item>
<string>密码</string> <item row="2" column="0">
</property> <widget class="QLabel" name="label_3">
</widget> <property name="text">
</item> <string>用户组</string>
<item row="3" column="1"> </property>
<widget class="QLineEdit" name="lineEdit_password"/> </widget>
</item> </item>
<item row="2" column="0"> <item row="0" column="1">
<widget class="QLabel" name="label_3"> <widget class="QComboBox" name="comboBox_user"/>
<property name="text"> </item>
<string>用户组</string> </layout>
</property> </item>
</widget> <item>
</item> <layout class="QHBoxLayout" name="horizontalLayout">
<item row="0" column="1"> <item>
<widget class="QComboBox" name="comboBox_user"/> <widget class="QPushButton" name="pushButton_ckeck">
</item> <property name="text">
</layout> <string>验证</string>
</item> </property>
<item> </widget>
<layout class="QHBoxLayout" name="horizontalLayout"> </item>
<item> <item>
<widget class="QPushButton" name="pushButton_ckeck"> <widget class="QPushButton" name="pushButton_cancel">
<property name="text"> <property name="text">
<string>验证</string> <string>取消</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> </layout>
<widget class="QPushButton" name="pushButton_cancel"> </item>
<property name="text"> </layout>
<string>取消</string> </item>
</property> </layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -5,7 +5,18 @@
#include "dbms/db_sysinfo_api/CDbSysInfo.h" #include "dbms/db_sysinfo_api/CDbSysInfo.h"
#include "perm_mng_api/PermMngApi.h" #include "perm_mng_api/PermMngApi.h"
//< 屏蔽xml_parser编译告警
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#endif
#include "boost/property_tree/xml_parser.hpp" #include "boost/property_tree/xml_parser.hpp"
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "boost/typeof/typeof.hpp" #include "boost/typeof/typeof.hpp"
#include "boost/filesystem.hpp" #include "boost/filesystem.hpp"
#include "Common.h" #include "Common.h"

View File

@ -4,15 +4,19 @@
#include "public/pub_sysinfo_api/SysInfoApi.h" #include "public/pub_sysinfo_api/SysInfoApi.h"
CEventFilterDialog::CEventFilterDialog(QWidget *parent) : CEventFilterDialog::CEventFilterDialog(QWidget *parent) :
QDialog(parent), CustomUiDialog(parent),
ui(new Ui::CEventFilterDialog), ui(new Ui::CEventFilterDialog),
m_rtdbAccess(Q_NULLPTR) m_rtdbAccess(Q_NULLPTR)
{ {
setWindowTitle(tr("过滤条件"));
ui->setupUi(this); ui->setupUi(this);
setObjectName("event_dialog"); setObjectName("event_dialog");
ui->subSystem->setView(new QListView()); ui->subSystem->setView(new QListView());
ui->deviceType->setView(new QListView()); ui->deviceType->setView(new QListView());
initialize(); initialize();
setAutoLayout(true);
} }
CEventFilterDialog::~CEventFilterDialog() CEventFilterDialog::~CEventFilterDialog()

View File

@ -1,15 +1,15 @@
#ifndef CEVENTFILTERDIALOG_H #ifndef CEVENTFILTERDIALOG_H
#define CEVENTFILTERDIALOG_H #define CEVENTFILTERDIALOG_H
#include <QDialog>
#include <QDateTime> #include <QDateTime>
#include "dbms/rdb_api/CRdbAccess.h" #include "dbms/rdb_api/CRdbAccess.h"
#include "pub_widget/CustomDialog.h"
namespace Ui { namespace Ui {
class CEventFilterDialog; class CEventFilterDialog;
} }
class CEventFilterDialog : public QDialog class CEventFilterDialog : public CustomUiDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -26,6 +26,9 @@
<string>过滤</string> <string>过滤</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_13"> <layout class="QGridLayout" name="gridLayout_13">
<property name="topMargin">
<number>10</number>
</property>
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0"> <item row="0" column="0">

View File

@ -21,10 +21,12 @@
using namespace iot_public; using namespace iot_public;
CEventForm::CEventForm(QWidget *parent) : CEventForm::CEventForm(QWidget *parent) :
QWidget(parent), CustomUiDialog(parent),
m_pHistoryModel(NULL), m_pHistoryModel(NULL),
ui(new Ui::CEventForm) ui(new Ui::CEventForm)
{ {
setWindowTitle(tr("事件管理工具"));
qRegisterMetaType<CEventMsgInfo>("CEventMsgInfo"); qRegisterMetaType<CEventMsgInfo>("CEventMsgInfo");
qRegisterMetaType<EventMsgPtr>("EventMsgPtr"); qRegisterMetaType<EventMsgPtr>("EventMsgPtr");
qRegisterMetaType<uint64>("uint64"); qRegisterMetaType<uint64>("uint64");
@ -47,8 +49,11 @@ CEventForm::CEventForm(QWidget *parent) :
m_pListWidget2 = new CMyListWidget(this); m_pListWidget2 = new CMyListWidget(this);
m_pListWidget3 = new CMyListWidget(this); m_pListWidget3 = new CMyListWidget(this);
m_pLineEdit1 = new QLineEdit(this); m_pLineEdit1 = new QLineEdit(this);
m_pLineEdit1->setObjectName("priority");
m_pLineEdit2 = new QLineEdit(this); m_pLineEdit2 = new QLineEdit(this);
m_pLineEdit2->setObjectName("location");
m_pLineEdit3 = new QLineEdit(this); m_pLineEdit3 = new QLineEdit(this);
m_pLineEdit3->setObjectName("event_status");
initFilter(); initFilter();
slotUpdateModel(); slotUpdateModel();
ui->eventView->setColumnWidth(0, 250); ui->eventView->setColumnWidth(0, 250);
@ -88,6 +93,8 @@ CEventForm::CEventForm(QWidget *parent) :
connect(m_influxdbThread, &QThread::finished, m_influxdbOpt, &QObject::deleteLater, Qt::QueuedConnection); connect(m_influxdbThread, &QThread::finished, m_influxdbOpt, &QObject::deleteLater, Qt::QueuedConnection);
connect(this, &CEventForm::delInfluxdbOneEvent, m_influxdbOpt, &CInfluxdbOpt::delInfluxdbOneEvent, Qt::QueuedConnection); connect(this, &CEventForm::delInfluxdbOneEvent, m_influxdbOpt, &CInfluxdbOpt::delInfluxdbOneEvent, Qt::QueuedConnection);
m_influxdbThread->start(); m_influxdbThread->start();
setAutoLayout(true);
} }
CEventForm::~CEventForm() CEventForm::~CEventForm()
@ -108,7 +115,7 @@ void CEventForm::initilize()
{ {
//< lingdaoyaoqiu //< lingdaoyaoqiu
{ {
QSettings columFlags2("KBD_HIS_EVENT_DEL", "eventHis config"); QSettings columFlags2("IOT_HIS_EVENT_DEL", "eventHis config");
if(!columFlags2.contains(QString("eventHis/colum_0"))) if(!columFlags2.contains(QString("eventHis/colum_0")))
{ {
columFlags2.setValue(QString("eventHis/colum_0"), false); //< 时间 columFlags2.setValue(QString("eventHis/colum_0"), false); //< 时间
@ -145,6 +152,7 @@ void CEventForm::initFilter()
m_strText1 = tr("请选择优先级"); m_strText1 = tr("请选择优先级");
m_pLineEdit1->setText(tr("请选择优先级")); m_pLineEdit1->setText(tr("请选择优先级"));
m_pLineEdit1->setReadOnly(true); m_pLineEdit1->setReadOnly(true);
connect(m_pLineEdit1, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged1(const QString &))); connect(m_pLineEdit1, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged1(const QString &)));
for(QMap<int, QString>::iterator it2 = location.begin();it2 != location.end();++it2) for(QMap<int, QString>::iterator it2 = location.begin();it2 != location.end();++it2)
{ {
@ -336,7 +344,7 @@ void CEventForm::slotUpdateModel()
connect(m_pHistoryModel, &CEventHistoryModel::sigHISRecordOutOfRangeTips, this, &CEventForm::slotHISRecordOutOfRangeTips); connect(m_pHistoryModel, &CEventHistoryModel::sigHISRecordOutOfRangeTips, this, &CEventForm::slotHISRecordOutOfRangeTips);
} }
ui->eventView->setModel(m_pHistoryModel); ui->eventView->setModel(m_pHistoryModel);
QSettings columFlags2("KBD_HIS_EVENT_DEL", "eventHis config"); QSettings columFlags2("IOT_HIS_EVENT_DEL", "eventHis config");
for(int nColumnIndex(0); nColumnIndex < m_pHistoryModel->columnCount(); nColumnIndex++) for(int nColumnIndex(0); nColumnIndex < m_pHistoryModel->columnCount(); nColumnIndex++)
{ {
bool visible = columFlags2.value(QString("eventHis/colum_%1").arg(nColumnIndex)).toBool(); bool visible = columFlags2.value(QString("eventHis/colum_%1").arg(nColumnIndex)).toBool();
@ -684,7 +692,7 @@ void CEventForm::contextMenuEvent(QContextMenuEvent *event)
action->setChecked(!ui->eventView->isColumnHidden(nColumnIndex)); action->setChecked(!ui->eventView->isColumnHidden(nColumnIndex));
connect(action, &QAction::triggered, [=](){ connect(action, &QAction::triggered, [=](){
ui->eventView->setColumnHidden(nColumnIndex, !action->isChecked()); ui->eventView->setColumnHidden(nColumnIndex, !action->isChecked());
QSettings columFlags2("KBD_HIS_EVENT_DEL", "eventHis config"); QSettings columFlags2("IOT_HIS_EVENT_DEL", "eventHis config");
columFlags2.setValue(QString("eventHis/colum_%1").arg(nColumnIndex), !action->isChecked()); columFlags2.setValue(QString("eventHis/colum_%1").arg(nColumnIndex), !action->isChecked());
}); });
} }

View File

@ -10,6 +10,8 @@
#include <QThread> #include <QThread>
#include "CInfluxdbOpt.h" #include "CInfluxdbOpt.h"
#include "common/DataType.h" #include "common/DataType.h"
#include "pub_widget/CustomDialog.h"
namespace Ui { namespace Ui {
class CEventForm; class CEventForm;
} }
@ -21,7 +23,7 @@ class QAbstractTableModel;
typedef QList<QModelIndex> QModelIndexList; typedef QList<QModelIndex> QModelIndexList;
class CEventForm : public QWidget class CEventForm : public CustomUiDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -15,16 +15,16 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>10</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>10</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>0</number> <number>10</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>10</number>
</property> </property>
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@ -32,7 +32,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
@ -80,13 +80,13 @@
<widget class="QComboBox" name="comboBox_3"> <widget class="QComboBox" name="comboBox_3">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>120</width> <width>150</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>120</width> <width>180</width>
<height>26</height> <height>26</height>
</size> </size>
</property> </property>
@ -173,13 +173,13 @@
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>40</width> <width>50</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>40</width> <width>50</width>
<height>26</height> <height>26</height>
</size> </size>
</property> </property>
@ -192,13 +192,13 @@
<widget class="QComboBox" name="comboBox"> <widget class="QComboBox" name="comboBox">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>100</width> <width>150</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>100</width> <width>150</width>
<height>26</height> <height>26</height>
</size> </size>
</property> </property>
@ -208,13 +208,13 @@
<widget class="QComboBox" name="comboBox_2"> <widget class="QComboBox" name="comboBox_2">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>100</width> <width>150</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>100</width> <width>200</width>
<height>26</height> <height>26</height>
</size> </size>
</property> </property>
@ -249,7 +249,7 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>170</width> <width>250</width>
<height>26</height> <height>26</height>
</size> </size>
</property> </property>

View File

@ -42,7 +42,7 @@ FORMS += \
RESOURCES += \ RESOURCES += \
resource.qrc resource.qrc
LIBS += -llog4cplus -lboost_system -lboost_chrono -lpub_utility_api -lrdb_api -ldb_base_api -ldb_api_ex -lperm_mng_api -lpub_sysinfo_api -ltsdb_api -ldb_his_query_api LIBS += -llog4cplus -lboost_system -lboost_chrono -lpub_utility_api -lrdb_api -ldb_base_api -ldb_api_ex -lperm_mng_api -lpub_sysinfo_api -ltsdb_api -ldb_his_query_api -lpub_widget
include($$PWD/../../idl_files/idl_files.pri) include($$PWD/../../idl_files/idl_files.pri)

View File

@ -5,12 +5,43 @@
#include "CEventForm.h" #include "CEventForm.h"
#include "CDbOpt.h" #include "CDbOpt.h"
#include "CCheckUser.h" #include "CCheckUser.h"
#include "pub_utility_api/FileStyle.h"
void loadStyle()
{
QString qss = QString();
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss","zh","light");
QFile qssfile1(QString::fromStdString(strFullPath));
qssfile1.open(QFile::ReadOnly);
if (qssfile1.isOpen())
{
qss += QLatin1String(qssfile1.readAll());
qssfile1.close();
}
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("his_event_del.qss","zh","light");
QFile qssfile2(QString::fromStdString(strFullPath));
qssfile2.open(QFile::ReadOnly);
if (qssfile2.isOpen())
{
qss += QLatin1String(qssfile2.readAll());
qssfile2.close();
}
if (!qss.isEmpty())
{
qApp->setStyleSheet(qss);
}
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
iot_common::doQtAppGlobalSet(); iot_common::doQtAppGlobalSet();
QApplication app(argc, argv); QApplication app(argc, argv);
loadStyle();
CCheckUser objCheckUser; CCheckUser objCheckUser;
if(objCheckUser.exec()) if(objCheckUser.exec())
{ {