[ref]暂时先回退下同步711的,跟fes的提交区分开下
This commit is contained in:
parent
31e08c60c4
commit
cb3d1ca061
@ -63,6 +63,3 @@ LIBS += -L$$SRC_ROOT_PATH/../$$ISCS6000_OS$$DIR_DEBUG_RELEASE/
|
||||
QMAKE_RPATHLINKDIR += $$PWD/../../platform/$$ISCS6000_OS$$DIR_DEBUG_RELEASE/
|
||||
QMAKE_RPATHLINKDIR += $$SRC_ROOT_PATH/../$$ISCS6000_OS$$DIR_DEBUG_RELEASE/
|
||||
|
||||
TR_EXCLUDE += $$SRC_ROOT_PATH/3rd/* \
|
||||
$$PWD/../../platform/src/3rd/*
|
||||
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
TEMPLATE=subdirs
|
||||
CONFIG += ordered
|
||||
SUBDIRS+= \
|
||||
# fileSync \
|
||||
NavigationApi \
|
||||
NavigationTool \
|
||||
IconActTool
|
||||
TEMPLATE=subdirs
|
||||
CONFIG += ordered
|
||||
SUBDIRS+= fileSync NavigationApi NavigationTool IconActTool
|
||||
|
||||
@ -1,238 +1,238 @@
|
||||
#include "CFileOpt.h"
|
||||
#include "public/pub_logger_api/logger.h"
|
||||
#include "public/pub_utility_api/FileUtil.h"
|
||||
#include <QFile>
|
||||
#include <QDomDocument>
|
||||
#include <QDomElement>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QTextStream>
|
||||
|
||||
CFileOpt::CFileOpt()
|
||||
{
|
||||
std::string currentPath = iot_public::CFileUtil::getCurModuleDir();
|
||||
readColorCofig(QString::fromStdString(currentPath) + "/../../data/model/colorConfig.xml", m_strategyMap);
|
||||
readIconDefaultStrategy(QString::fromStdString(currentPath) + "/../../data/model/toolbox.xml", m_iconDefaultStrategyMap);
|
||||
}
|
||||
|
||||
QString CFileOpt::getDefaultStrategy(const QString &icon)
|
||||
{
|
||||
QString strategy = m_iconDefaultStrategyMap.value(icon);
|
||||
if(!strategy.isEmpty())
|
||||
{
|
||||
return getStrategyDesc(strategy);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QMap<QVariant, QString> CFileOpt::getStrategyMap()
|
||||
{
|
||||
return m_strategyMap;
|
||||
}
|
||||
|
||||
QString CFileOpt::getStrategyDesc(const QVariant &key)
|
||||
{
|
||||
return m_strategyMap.value(key);
|
||||
}
|
||||
|
||||
void CFileOpt::readColorCofig(const QString &path, QMap<QVariant, QString> &map)
|
||||
{
|
||||
QFile file(path);
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
LOGERROR("CFileOpt::readColorCofig cannot open file, path: %s", path.toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QDomDocument document;
|
||||
bool ret = document.setContent(&file);
|
||||
file.close();
|
||||
if(!ret)
|
||||
{
|
||||
LOGERROR("CFileOpt::readColorCofig error");
|
||||
return;
|
||||
}
|
||||
QDomElement root = document.documentElement();
|
||||
QDomNodeList nodeList = root.childNodes();
|
||||
QString name;
|
||||
QString desc;
|
||||
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
||||
QDomElement node = nodeList.at(nIndex).toElement();
|
||||
name = node.tagName();
|
||||
desc = node.attribute("description");
|
||||
if(desc.isEmpty())
|
||||
{
|
||||
map.insert(name, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
map.insert(name, name+":"+desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CFileOpt::readIconAction(const QString &path, QList<ST_ICONACT> &list)
|
||||
{
|
||||
QFile file(path);
|
||||
QByteArray readJson;
|
||||
if(file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
readJson = file.readAll();
|
||||
file.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGERROR("CFileOpt::readIconAction cannot open file, path: %s", path.toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QJsonParseError readError;
|
||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||
if(readError.error != QJsonParseError::NoError)
|
||||
{
|
||||
LOGERROR("CFileOpt:readIconAction error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QJsonObject root = readJsonResponse.object();
|
||||
QJsonObject::const_iterator rootIter = root.constBegin();
|
||||
ST_ICONACT st_icon;
|
||||
QString strategy;
|
||||
for(; rootIter != root.constEnd(); rootIter++)
|
||||
{
|
||||
QJsonObject item = rootIter.value().toObject();
|
||||
st_icon.name = rootIter.key();
|
||||
st_icon.action = item.value("Action").toInt();
|
||||
st_icon.panel = item.value("Panel").toString();
|
||||
st_icon.simulate = item.value("Simulate").toInt();
|
||||
strategy = m_iconDefaultStrategyMap.value(st_icon.name);
|
||||
if(!strategy.isEmpty())
|
||||
{
|
||||
st_icon.strategy = getStrategyDesc(strategy);
|
||||
}
|
||||
else
|
||||
{
|
||||
st_icon.strategy = QString();
|
||||
}
|
||||
list.append(st_icon);
|
||||
}
|
||||
}
|
||||
|
||||
bool CFileOpt::saveIconAction(const QString &path, const QList<ST_ICONACT> &list)
|
||||
{
|
||||
QFile file(path);
|
||||
if(!file.open(QIODevice::WriteOnly))
|
||||
{
|
||||
LOGERROR("CFileOpt::saveIconAction cannot open file, path: %s", path.toStdString().c_str());
|
||||
return false;
|
||||
}
|
||||
QJsonDocument doc;
|
||||
QJsonObject obj;
|
||||
foreach (ST_ICONACT st_icon, list) {
|
||||
QJsonObject temp;
|
||||
temp.insert("Action", st_icon.action);
|
||||
temp.insert("Panel", st_icon.panel);
|
||||
temp.insert("Simulate", st_icon.simulate);
|
||||
obj.insert(st_icon.name, temp);
|
||||
}
|
||||
doc.setObject(obj);
|
||||
if(-1 == file.write(doc.toJson()))
|
||||
{
|
||||
LOGERROR("CFileOpt::saveIconAction write false, path: %s", path.toStdString().c_str());
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CFileOpt::readIconDefaultStrategy(const QString &path, QMap<QString, QString> &map)
|
||||
{
|
||||
QFile file(path);
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QDomDocument document;
|
||||
bool ret = document.setContent(&file);
|
||||
file.close();
|
||||
if(!ret)
|
||||
{
|
||||
LOGERROR("CFileOpt::readToolbox error");
|
||||
return;
|
||||
}
|
||||
QDomElement root = document.documentElement();
|
||||
makeIconDefaultStrategy(root, map);
|
||||
}
|
||||
|
||||
bool CFileOpt::saveIconDefaultStrategy(const QString &path, const QMap<QString, QString> &map)
|
||||
{
|
||||
QFile file(path);
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
||||
return false;
|
||||
}
|
||||
QDomDocument document;
|
||||
bool ret = document.setContent(&file);
|
||||
file.close();
|
||||
if(!ret)
|
||||
{
|
||||
LOGERROR("CFileOpt::readToolbox error");
|
||||
return false;
|
||||
}
|
||||
QDomElement root = document.documentElement();
|
||||
replaceIconDefaultStretegy(root, map);
|
||||
if(!file.open(QIODevice::WriteOnly))
|
||||
{
|
||||
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
||||
return false;
|
||||
}
|
||||
QTextStream content(&file);
|
||||
document.save(content, 1);
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CFileOpt::makeIconDefaultStrategy(QDomElement element, QMap<QString, QString> &map)
|
||||
{
|
||||
QString strategy;
|
||||
QDomNodeList nodeList = element.childNodes();
|
||||
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
||||
QDomElement node = nodeList.at(nIndex).toElement();
|
||||
strategy = node.attribute("strategy");
|
||||
if(!strategy.isEmpty())
|
||||
{
|
||||
map.insert(node.tagName(), strategy);
|
||||
}
|
||||
makeIconDefaultStrategy(node, map);
|
||||
}
|
||||
}
|
||||
|
||||
void CFileOpt::replaceIconDefaultStretegy(QDomElement &element, const QMap<QString, QString> &map)
|
||||
{
|
||||
QString strategy;
|
||||
QString newStrategy;
|
||||
QDomNodeList nodeList = element.childNodes();
|
||||
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
||||
QDomNode oldNode = nodeList.at(nIndex);
|
||||
QDomElement node = nodeList.at(nIndex).toElement();
|
||||
strategy = node.attribute("strategy");
|
||||
QMap<QString,QString>::const_iterator iter = map.find(node.tagName());
|
||||
if(iter == map.constEnd())
|
||||
{
|
||||
replaceIconDefaultStretegy(node, map);
|
||||
continue;
|
||||
}
|
||||
newStrategy = map[node.tagName()];
|
||||
if(strategy != newStrategy)
|
||||
{
|
||||
node.setAttribute("strategy", newStrategy);
|
||||
if(newStrategy.isEmpty())
|
||||
{
|
||||
node.removeAttribute("strategy");
|
||||
}
|
||||
element.replaceChild(node, oldNode);
|
||||
}
|
||||
replaceIconDefaultStretegy(node, map);
|
||||
}
|
||||
}
|
||||
#include "CFileOpt.h"
|
||||
#include "public/pub_logger_api/logger.h"
|
||||
#include "public/pub_utility_api/FileUtil.h"
|
||||
#include <QFile>
|
||||
#include <QDomDocument>
|
||||
#include <QDomElement>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QTextStream>
|
||||
|
||||
CFileOpt::CFileOpt()
|
||||
{
|
||||
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
||||
readColorCofig(QString::fromStdString(currentPath) + "/../../data/model/colorConfig.xml", m_strategyMap);
|
||||
readIconDefaultStrategy(QString::fromStdString(currentPath) + "/../../data/model/toolbox.xml", m_iconDefaultStrategyMap);
|
||||
}
|
||||
|
||||
QString CFileOpt::getDefaultStrategy(const QString &icon)
|
||||
{
|
||||
QString strategy = m_iconDefaultStrategyMap.value(icon);
|
||||
if(!strategy.isEmpty())
|
||||
{
|
||||
return getStrategyDesc(strategy);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QMap<QVariant, QString> CFileOpt::getStrategyMap()
|
||||
{
|
||||
return m_strategyMap;
|
||||
}
|
||||
|
||||
QString CFileOpt::getStrategyDesc(const QVariant &key)
|
||||
{
|
||||
return m_strategyMap.value(key);
|
||||
}
|
||||
|
||||
void CFileOpt::readColorCofig(const QString &path, QMap<QVariant, QString> &map)
|
||||
{
|
||||
QFile file(path);
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
LOGERROR("CFileOpt::readColorCofig cannot open file, path: %s", path.toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QDomDocument document;
|
||||
bool ret = document.setContent(&file);
|
||||
file.close();
|
||||
if(!ret)
|
||||
{
|
||||
LOGERROR("CFileOpt::readColorCofig error");
|
||||
return;
|
||||
}
|
||||
QDomElement root = document.documentElement();
|
||||
QDomNodeList nodeList = root.childNodes();
|
||||
QString name;
|
||||
QString desc;
|
||||
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
||||
QDomElement node = nodeList.at(nIndex).toElement();
|
||||
name = node.tagName();
|
||||
desc = node.attribute("description");
|
||||
if(desc.isEmpty())
|
||||
{
|
||||
map.insert(name, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
map.insert(name, name+":"+desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CFileOpt::readIconAction(const QString &path, QList<ST_ICONACT> &list)
|
||||
{
|
||||
QFile file(path);
|
||||
QByteArray readJson;
|
||||
if(file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
readJson = file.readAll();
|
||||
file.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGERROR("CFileOpt::readIconAction cannot open file, path: %s", path.toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QJsonParseError readError;
|
||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||
if(readError.error != QJsonParseError::NoError)
|
||||
{
|
||||
LOGERROR("CFileOpt:readIconAction error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QJsonObject root = readJsonResponse.object();
|
||||
QJsonObject::const_iterator rootIter = root.constBegin();
|
||||
ST_ICONACT st_icon;
|
||||
QString strategy;
|
||||
for(; rootIter != root.constEnd(); rootIter++)
|
||||
{
|
||||
QJsonObject item = rootIter.value().toObject();
|
||||
st_icon.name = rootIter.key();
|
||||
st_icon.action = item.value("Action").toInt();
|
||||
st_icon.panel = item.value("Panel").toString();
|
||||
st_icon.simulate = item.value("Simulate").toInt();
|
||||
strategy = m_iconDefaultStrategyMap.value(st_icon.name);
|
||||
if(!strategy.isEmpty())
|
||||
{
|
||||
st_icon.strategy = getStrategyDesc(strategy);
|
||||
}
|
||||
else
|
||||
{
|
||||
st_icon.strategy = QString();
|
||||
}
|
||||
list.append(st_icon);
|
||||
}
|
||||
}
|
||||
|
||||
bool CFileOpt::saveIconAction(const QString &path, const QList<ST_ICONACT> &list)
|
||||
{
|
||||
QFile file(path);
|
||||
if(!file.open(QIODevice::WriteOnly))
|
||||
{
|
||||
LOGERROR("CFileOpt::saveIconAction cannot open file, path: %s", path.toStdString().c_str());
|
||||
return false;
|
||||
}
|
||||
QJsonDocument doc;
|
||||
QJsonObject obj;
|
||||
foreach (ST_ICONACT st_icon, list) {
|
||||
QJsonObject temp;
|
||||
temp.insert("Action", st_icon.action);
|
||||
temp.insert("Panel", st_icon.panel);
|
||||
temp.insert("Simulate", st_icon.simulate);
|
||||
obj.insert(st_icon.name, temp);
|
||||
}
|
||||
doc.setObject(obj);
|
||||
if(-1 == file.write(doc.toJson()))
|
||||
{
|
||||
LOGERROR("CFileOpt::saveIconAction write false, path: %s", path.toStdString().c_str());
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CFileOpt::readIconDefaultStrategy(const QString &path, QMap<QString, QString> &map)
|
||||
{
|
||||
QFile file(path);
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QDomDocument document;
|
||||
bool ret = document.setContent(&file);
|
||||
file.close();
|
||||
if(!ret)
|
||||
{
|
||||
LOGERROR("CFileOpt::readToolbox error");
|
||||
return;
|
||||
}
|
||||
QDomElement root = document.documentElement();
|
||||
makeIconDefaultStrategy(root, map);
|
||||
}
|
||||
|
||||
bool CFileOpt::saveIconDefaultStrategy(const QString &path, const QMap<QString, QString> &map)
|
||||
{
|
||||
QFile file(path);
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
||||
return false;
|
||||
}
|
||||
QDomDocument document;
|
||||
bool ret = document.setContent(&file);
|
||||
file.close();
|
||||
if(!ret)
|
||||
{
|
||||
LOGERROR("CFileOpt::readToolbox error");
|
||||
return false;
|
||||
}
|
||||
QDomElement root = document.documentElement();
|
||||
replaceIconDefaultStretegy(root, map);
|
||||
if(!file.open(QIODevice::WriteOnly))
|
||||
{
|
||||
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
||||
return false;
|
||||
}
|
||||
QTextStream content(&file);
|
||||
document.save(content, 1);
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CFileOpt::makeIconDefaultStrategy(QDomElement element, QMap<QString, QString> &map)
|
||||
{
|
||||
QString strategy;
|
||||
QDomNodeList nodeList = element.childNodes();
|
||||
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
||||
QDomElement node = nodeList.at(nIndex).toElement();
|
||||
strategy = node.attribute("strategy");
|
||||
if(!strategy.isEmpty())
|
||||
{
|
||||
map.insert(node.tagName(), strategy);
|
||||
}
|
||||
makeIconDefaultStrategy(node, map);
|
||||
}
|
||||
}
|
||||
|
||||
void CFileOpt::replaceIconDefaultStretegy(QDomElement &element, const QMap<QString, QString> &map)
|
||||
{
|
||||
QString strategy;
|
||||
QString newStrategy;
|
||||
QDomNodeList nodeList = element.childNodes();
|
||||
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
||||
QDomNode oldNode = nodeList.at(nIndex);
|
||||
QDomElement node = nodeList.at(nIndex).toElement();
|
||||
strategy = node.attribute("strategy");
|
||||
QMap<QString,QString>::const_iterator iter = map.find(node.tagName());
|
||||
if(iter == map.constEnd())
|
||||
{
|
||||
replaceIconDefaultStretegy(node, map);
|
||||
continue;
|
||||
}
|
||||
newStrategy = map[node.tagName()];
|
||||
if(strategy != newStrategy)
|
||||
{
|
||||
node.setAttribute("strategy", newStrategy);
|
||||
if(newStrategy.isEmpty())
|
||||
{
|
||||
node.removeAttribute("strategy");
|
||||
}
|
||||
element.replaceChild(node, oldNode);
|
||||
}
|
||||
replaceIconDefaultStretegy(node, map);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,35 +1,35 @@
|
||||
#ifndef CFILEOPT_H
|
||||
#define CFILEOPT_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
#include "CIconActPublic.h"
|
||||
|
||||
class QDomElement;
|
||||
class CFileOpt
|
||||
{
|
||||
public:
|
||||
CFileOpt();
|
||||
|
||||
QString getDefaultStrategy(const QString& icon);
|
||||
QMap<QVariant, QString> getStrategyMap();
|
||||
QString getStrategyDesc(const QVariant &key);
|
||||
|
||||
void readColorCofig(const QString &path, QMap<QVariant, QString> &map);
|
||||
|
||||
void readIconAction(const QString &path, QList<ST_ICONACT> &list);
|
||||
bool saveIconAction(const QString &path, const QList<ST_ICONACT> &list);
|
||||
|
||||
void readIconDefaultStrategy(const QString &path, QMap<QString, QString> &map);
|
||||
bool saveIconDefaultStrategy(const QString &path, const QMap<QString, QString> &map);
|
||||
|
||||
private:
|
||||
void makeIconDefaultStrategy(QDomElement element, QMap<QString, QString> &map);
|
||||
void replaceIconDefaultStretegy(QDomElement &element, const QMap<QString, QString> &map);
|
||||
|
||||
private:
|
||||
QMap<QString, QString> m_iconDefaultStrategyMap;
|
||||
QMap<QVariant, QString> m_strategyMap;
|
||||
};
|
||||
|
||||
#endif // CFILEOPT_H
|
||||
#ifndef CFILEOPT_H
|
||||
#define CFILEOPT_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
#include "CIconActPublic.h"
|
||||
|
||||
class QDomElement;
|
||||
class CFileOpt
|
||||
{
|
||||
public:
|
||||
CFileOpt();
|
||||
|
||||
QString getDefaultStrategy(const QString& icon);
|
||||
QMap<QVariant, QString> getStrategyMap();
|
||||
QString getStrategyDesc(const QVariant &key);
|
||||
|
||||
void readColorCofig(const QString &path, QMap<QVariant, QString> &map);
|
||||
|
||||
void readIconAction(const QString &path, QList<ST_ICONACT> &list);
|
||||
bool saveIconAction(const QString &path, const QList<ST_ICONACT> &list);
|
||||
|
||||
void readIconDefaultStrategy(const QString &path, QMap<QString, QString> &map);
|
||||
bool saveIconDefaultStrategy(const QString &path, const QMap<QString, QString> &map);
|
||||
|
||||
private:
|
||||
void makeIconDefaultStrategy(QDomElement element, QMap<QString, QString> &map);
|
||||
void replaceIconDefaultStretegy(QDomElement &element, const QMap<QString, QString> &map);
|
||||
|
||||
private:
|
||||
QMap<QString, QString> m_iconDefaultStrategyMap;
|
||||
QMap<QVariant, QString> m_strategyMap;
|
||||
};
|
||||
|
||||
#endif // CFILEOPT_H
|
||||
|
||||
@ -1,193 +1,189 @@
|
||||
#include "CIconActDialog.h"
|
||||
#include "ui_CIconActDialog.h"
|
||||
#include "public/pub_utility_api/FileUtil.h"
|
||||
#include "CTableModel.h"
|
||||
#include "CTableDelegate.h"
|
||||
#include "CFileOpt.h"
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
CIconActDialog::CIconActDialog(QWidget *parent) :
|
||||
CustomUiDialog(parent),
|
||||
ui(new Ui::CIconActDialog),
|
||||
m_pTableModel(Q_NULLPTR),
|
||||
m_pFileOpt(Q_NULLPTR)
|
||||
{
|
||||
setWindowTitle(tr("图元动作"));
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
initialize();
|
||||
|
||||
CustomUiDialog::setAutoLayout(true);
|
||||
}
|
||||
|
||||
CIconActDialog::~CIconActDialog()
|
||||
{
|
||||
if(m_pFileOpt)
|
||||
{
|
||||
delete m_pFileOpt;
|
||||
}
|
||||
m_pFileOpt = Q_NULLPTR;
|
||||
|
||||
if(m_pTableModel)
|
||||
{
|
||||
delete m_pTableModel;
|
||||
}
|
||||
m_pTableModel = Q_NULLPTR;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QMap<QVariant, QString> CIconActDialog::getActMap()
|
||||
{
|
||||
return m_actMap;
|
||||
}
|
||||
|
||||
QString CIconActDialog::getActDesc(const QVariant &Act)
|
||||
{
|
||||
return m_actMap.value(Act, QString());
|
||||
}
|
||||
|
||||
QMap<QVariant, QString> CIconActDialog::getSimMap()
|
||||
{
|
||||
return m_simMap;
|
||||
}
|
||||
|
||||
QString CIconActDialog::getSimDesc(const QVariant &Sim)
|
||||
{
|
||||
return m_simMap.value(Sim, QString());
|
||||
}
|
||||
|
||||
QMap<QVariant, QString> CIconActDialog::getStrategyMap()
|
||||
{
|
||||
if(m_pFileOpt)
|
||||
{
|
||||
return m_pFileOpt->getStrategyMap();
|
||||
}
|
||||
return QMap<QVariant, QString>();
|
||||
}
|
||||
|
||||
void CIconActDialog::onAddBtnClicked()
|
||||
{
|
||||
CTableDelegate * delegate = dynamic_cast<CTableDelegate *>(ui->m_tableView->itemDelegateForColumn(0));
|
||||
if(!delegate)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QDir dir(delegate->getFilePath());
|
||||
QStringList fileList = QFileDialog::getOpenFileNames(this, tr("选择文件"), dir.path(), "*.ilx");
|
||||
if(fileList.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList existFile;
|
||||
m_pTableModel->getExistIcon(existFile);
|
||||
QString name;
|
||||
QList<ST_ICONACT> appendList;
|
||||
for(int nIndex(0); nIndex<fileList.length(); nIndex++)
|
||||
{
|
||||
name = dir.relativeFilePath(fileList[nIndex]).remove(-4, 4);
|
||||
if(existFile.contains(name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ST_ICONACT st_icon;
|
||||
st_icon.name = name;
|
||||
st_icon.strategy = m_pFileOpt->getDefaultStrategy(name);
|
||||
appendList.append(st_icon);
|
||||
}
|
||||
m_pTableModel->addRows(appendList);
|
||||
}
|
||||
|
||||
void CIconActDialog::onDelBtnClicked()
|
||||
{
|
||||
QModelIndexList indexList = ui->m_tableView->selectionModel()->selectedRows();
|
||||
m_pTableModel->removeRows(indexList);
|
||||
}
|
||||
|
||||
void CIconActDialog::onConfimClicked()
|
||||
{
|
||||
const QList<ST_ICONACT>& dataList = m_pTableModel->getDataList();
|
||||
bool ret = m_pFileOpt->saveIconAction(m_strActionFile, dataList);
|
||||
if(!ret)
|
||||
{
|
||||
QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
QMap<QString, QString> map;
|
||||
foreach (ST_ICONACT st_icon, dataList) {
|
||||
map[st_icon.name] = st_icon.strategy.section(":",0,0);
|
||||
}
|
||||
m_pFileOpt->saveIconDefaultStrategy(m_strToolBoxFile, map);
|
||||
if(!ret)
|
||||
{
|
||||
QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
accept();
|
||||
}
|
||||
|
||||
void CIconActDialog::onCancelClicked()
|
||||
{
|
||||
reject();
|
||||
}
|
||||
|
||||
void CIconActDialog::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(ui->m_addBtn->toolTip(), this, &CIconActDialog::onAddBtnClicked);
|
||||
menu.addAction(ui->m_delBtn->toolTip(), this, &CIconActDialog::onDelBtnClicked);
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
|
||||
void CIconActDialog::initialize()
|
||||
{
|
||||
m_pFileOpt = new CFileOpt();
|
||||
m_pTableModel = new CTableModel(this);
|
||||
ui->m_tableView->setModel(m_pTableModel);
|
||||
ui->m_tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->m_tableView->horizontalHeader()->setStretchLastSection(true);
|
||||
ui->m_tableView->setColumnWidth(CTableModel::NAME,180);
|
||||
ui->m_tableView->setColumnWidth(CTableModel::ACTION,100);
|
||||
ui->m_tableView->setColumnWidth(CTableModel::PANEL,200);
|
||||
ui->m_tableView->setColumnWidth(CTableModel::STRATEGY,150);
|
||||
|
||||
m_actMap.insert(ACT_LEFT_CLICK, tr("左键单击"));
|
||||
m_actMap.insert(ACT_LEFT_DOUCLICK, tr("左键双击"));
|
||||
m_simMap.insert(SIM_FORBID, tr("禁止"));
|
||||
m_simMap.insert(SIM_ALLOW, tr("允许"));
|
||||
std::string currentPath = iot_public::CFileUtil::getCurModuleDir();
|
||||
CTableDelegate * iconDelegate = new CTableDelegate(this, CTableDelegate::IconFile);
|
||||
iconDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/icon/");
|
||||
CTableDelegate * actnDelegate = new CTableDelegate(this, CTableDelegate::ComboBox);
|
||||
actnDelegate->setComboMap(getActMap());
|
||||
CTableDelegate * paneDelegate = new CTableDelegate(this, CTableDelegate::PicFile);
|
||||
paneDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/pic/");
|
||||
CTableDelegate * straDelegate = new CTableDelegate(this, CTableDelegate::ComboBox, true);
|
||||
straDelegate->setComboMap(getStrategyMap());
|
||||
CTableDelegate * simuDelegate = new CTableDelegate(this, CTableDelegate::ComboBox);
|
||||
simuDelegate->setComboMap(getSimMap());
|
||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::NAME, iconDelegate);
|
||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::ACTION, actnDelegate);
|
||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::PANEL, paneDelegate);
|
||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::STRATEGY, straDelegate);
|
||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::SIMULATE, simuDelegate);
|
||||
|
||||
QList<ST_ICONACT> stList;
|
||||
m_strActionFile = QString::fromStdString(currentPath) + "../../data/model/iconAction.json";
|
||||
m_strToolBoxFile = QString::fromStdString(currentPath) + "../../data/model/toolbox.xml";
|
||||
m_pFileOpt->readIconAction(m_strActionFile, stList);
|
||||
m_pTableModel->updateData(stList);
|
||||
|
||||
connect(ui->m_addBtn, &QPushButton::clicked, this, &CIconActDialog::onAddBtnClicked);
|
||||
connect(ui->m_delBtn, &QPushButton::clicked, this, &CIconActDialog::onDelBtnClicked);
|
||||
connect(ui->m_confirmBtn, &QPushButton::clicked, this, &CIconActDialog::onConfimClicked);
|
||||
connect(ui->m_cancelBtn,&QPushButton::clicked, this, &CIconActDialog::onCancelClicked);
|
||||
}
|
||||
#include "CIconActDialog.h"
|
||||
#include "ui_CIconActDialog.h"
|
||||
#include "public/pub_utility_api/FileUtil.h"
|
||||
#include "CTableModel.h"
|
||||
#include "CTableDelegate.h"
|
||||
#include "CFileOpt.h"
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
CIconActDialog::CIconActDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CIconActDialog),
|
||||
m_pTableModel(Q_NULLPTR),
|
||||
m_pFileOpt(Q_NULLPTR)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
CIconActDialog::~CIconActDialog()
|
||||
{
|
||||
if(m_pFileOpt)
|
||||
{
|
||||
delete m_pFileOpt;
|
||||
}
|
||||
m_pFileOpt = Q_NULLPTR;
|
||||
|
||||
if(m_pTableModel)
|
||||
{
|
||||
delete m_pTableModel;
|
||||
}
|
||||
m_pTableModel = Q_NULLPTR;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QMap<QVariant, QString> CIconActDialog::getActMap()
|
||||
{
|
||||
return m_actMap;
|
||||
}
|
||||
|
||||
QString CIconActDialog::getActDesc(const QVariant &Act)
|
||||
{
|
||||
return m_actMap.value(Act, QString());
|
||||
}
|
||||
|
||||
QMap<QVariant, QString> CIconActDialog::getSimMap()
|
||||
{
|
||||
return m_simMap;
|
||||
}
|
||||
|
||||
QString CIconActDialog::getSimDesc(const QVariant &Sim)
|
||||
{
|
||||
return m_simMap.value(Sim, QString());
|
||||
}
|
||||
|
||||
QMap<QVariant, QString> CIconActDialog::getStrategyMap()
|
||||
{
|
||||
if(m_pFileOpt)
|
||||
{
|
||||
return m_pFileOpt->getStrategyMap();
|
||||
}
|
||||
return QMap<QVariant, QString>();
|
||||
}
|
||||
|
||||
void CIconActDialog::onAddBtnClicked()
|
||||
{
|
||||
CTableDelegate * delegate = dynamic_cast<CTableDelegate *>(ui->m_tableView->itemDelegateForColumn(0));
|
||||
if(!delegate)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QDir dir(delegate->getFilePath());
|
||||
QStringList fileList = QFileDialog::getOpenFileNames(this, tr("选择文件"), dir.path(), "*.ilx");
|
||||
if(fileList.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList existFile;
|
||||
m_pTableModel->getExistIcon(existFile);
|
||||
QString name;
|
||||
QList<ST_ICONACT> appendList;
|
||||
for(int nIndex(0); nIndex<fileList.length(); nIndex++)
|
||||
{
|
||||
name = dir.relativeFilePath(fileList[nIndex]).remove(-4, 4);
|
||||
if(existFile.contains(name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ST_ICONACT st_icon;
|
||||
st_icon.name = name;
|
||||
st_icon.strategy = m_pFileOpt->getDefaultStrategy(name);
|
||||
appendList.append(st_icon);
|
||||
}
|
||||
m_pTableModel->addRows(appendList);
|
||||
}
|
||||
|
||||
void CIconActDialog::onDelBtnClicked()
|
||||
{
|
||||
QModelIndexList indexList = ui->m_tableView->selectionModel()->selectedRows();
|
||||
m_pTableModel->removeRows(indexList);
|
||||
}
|
||||
|
||||
void CIconActDialog::onConfimClicked()
|
||||
{
|
||||
const QList<ST_ICONACT>& dataList = m_pTableModel->getDataList();
|
||||
bool ret = m_pFileOpt->saveIconAction(m_strActionFile, dataList);
|
||||
if(!ret)
|
||||
{
|
||||
QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
QMap<QString, QString> map;
|
||||
foreach (ST_ICONACT st_icon, dataList) {
|
||||
map[st_icon.name] = st_icon.strategy.section(":",0,0);
|
||||
}
|
||||
m_pFileOpt->saveIconDefaultStrategy(m_strToolBoxFile, map);
|
||||
if(!ret)
|
||||
{
|
||||
QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
accept();
|
||||
}
|
||||
|
||||
void CIconActDialog::onCancelClicked()
|
||||
{
|
||||
reject();
|
||||
}
|
||||
|
||||
void CIconActDialog::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(ui->m_addBtn->toolTip(), this, &CIconActDialog::onAddBtnClicked);
|
||||
menu.addAction(ui->m_delBtn->toolTip(), this, &CIconActDialog::onDelBtnClicked);
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
|
||||
void CIconActDialog::initialize()
|
||||
{
|
||||
m_pFileOpt = new CFileOpt();
|
||||
m_pTableModel = new CTableModel(this);
|
||||
ui->m_tableView->setModel(m_pTableModel);
|
||||
ui->m_tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->m_tableView->horizontalHeader()->setStretchLastSection(true);
|
||||
ui->m_tableView->setColumnWidth(CTableModel::NAME,180);
|
||||
ui->m_tableView->setColumnWidth(CTableModel::ACTION,100);
|
||||
ui->m_tableView->setColumnWidth(CTableModel::PANEL,200);
|
||||
ui->m_tableView->setColumnWidth(CTableModel::STRATEGY,150);
|
||||
|
||||
m_actMap.insert(ACT_LEFT_CLICK, tr("左键单击"));
|
||||
m_actMap.insert(ACT_LEFT_DOUCLICK, tr("左键双击"));
|
||||
m_simMap.insert(SIM_FORBID, tr("禁止"));
|
||||
m_simMap.insert(SIM_ALLOW, tr("允许"));
|
||||
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
||||
CTableDelegate * iconDelegate = new CTableDelegate(this, CTableDelegate::IconFile);
|
||||
iconDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/icon/");
|
||||
CTableDelegate * actnDelegate = new CTableDelegate(this, CTableDelegate::ComboBox);
|
||||
actnDelegate->setComboMap(getActMap());
|
||||
CTableDelegate * paneDelegate = new CTableDelegate(this, CTableDelegate::PicFile);
|
||||
paneDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/pic/");
|
||||
CTableDelegate * straDelegate = new CTableDelegate(this, CTableDelegate::ComboBox, true);
|
||||
straDelegate->setComboMap(getStrategyMap());
|
||||
CTableDelegate * simuDelegate = new CTableDelegate(this, CTableDelegate::ComboBox);
|
||||
simuDelegate->setComboMap(getSimMap());
|
||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::NAME, iconDelegate);
|
||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::ACTION, actnDelegate);
|
||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::PANEL, paneDelegate);
|
||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::STRATEGY, straDelegate);
|
||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::SIMULATE, simuDelegate);
|
||||
|
||||
QList<ST_ICONACT> stList;
|
||||
m_strActionFile = QString::fromStdString(currentPath) + "../../data/model/iconAction.json";
|
||||
m_strToolBoxFile = QString::fromStdString(currentPath) + "../../data/model/toolbox.xml";
|
||||
m_pFileOpt->readIconAction(m_strActionFile, stList);
|
||||
m_pTableModel->updateData(stList);
|
||||
|
||||
connect(ui->m_addBtn, &QPushButton::clicked, this, &CIconActDialog::onAddBtnClicked);
|
||||
connect(ui->m_delBtn, &QPushButton::clicked, this, &CIconActDialog::onDelBtnClicked);
|
||||
connect(ui->m_confirmBtn, &QPushButton::clicked, this, &CIconActDialog::onConfimClicked);
|
||||
connect(ui->m_cancelBtn,&QPushButton::clicked, this, &CIconActDialog::onCancelClicked);
|
||||
}
|
||||
|
||||
@ -1,49 +1,49 @@
|
||||
#ifndef CICONACTDIALOG_H
|
||||
#define CICONACTDIALOG_H
|
||||
|
||||
#include <QMap>
|
||||
#include "pub_widget/CustomDialog.h"
|
||||
|
||||
namespace Ui {
|
||||
class CIconActDialog;
|
||||
}
|
||||
|
||||
class CTableModel;
|
||||
class CFileOpt;
|
||||
class CIconActDialog : public CustomUiDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CIconActDialog(QWidget *parent = 0);
|
||||
~CIconActDialog();
|
||||
|
||||
QMap<QVariant, QString> getActMap();
|
||||
QString getActDesc(const QVariant& Act);
|
||||
QMap<QVariant, QString> getSimMap();
|
||||
QString getSimDesc(const QVariant& Sim);
|
||||
QMap<QVariant, QString> getStrategyMap();
|
||||
|
||||
private slots:
|
||||
void onAddBtnClicked();
|
||||
void onDelBtnClicked();
|
||||
void onConfimClicked();
|
||||
void onCancelClicked();
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
|
||||
private:
|
||||
Ui::CIconActDialog *ui;
|
||||
CTableModel * m_pTableModel;
|
||||
CFileOpt * m_pFileOpt;
|
||||
QMap<QVariant, QString> m_actMap;
|
||||
QMap<QVariant, QString> m_simMap;
|
||||
QString m_strActionFile;
|
||||
QString m_strToolBoxFile;
|
||||
};
|
||||
|
||||
#endif // CICONACTDIALOG_H
|
||||
#ifndef CICONACTDIALOG_H
|
||||
#define CICONACTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
|
||||
namespace Ui {
|
||||
class CIconActDialog;
|
||||
}
|
||||
|
||||
class CTableModel;
|
||||
class CFileOpt;
|
||||
class CIconActDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CIconActDialog(QWidget *parent = 0);
|
||||
~CIconActDialog();
|
||||
|
||||
QMap<QVariant, QString> getActMap();
|
||||
QString getActDesc(const QVariant& Act);
|
||||
QMap<QVariant, QString> getSimMap();
|
||||
QString getSimDesc(const QVariant& Sim);
|
||||
QMap<QVariant, QString> getStrategyMap();
|
||||
|
||||
private slots:
|
||||
void onAddBtnClicked();
|
||||
void onDelBtnClicked();
|
||||
void onConfimClicked();
|
||||
void onCancelClicked();
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
|
||||
private:
|
||||
Ui::CIconActDialog *ui;
|
||||
CTableModel * m_pTableModel;
|
||||
CFileOpt * m_pFileOpt;
|
||||
QMap<QVariant, QString> m_actMap;
|
||||
QMap<QVariant, QString> m_simMap;
|
||||
QString m_strActionFile;
|
||||
QString m_strToolBoxFile;
|
||||
};
|
||||
|
||||
#endif // CICONACTDIALOG_H
|
||||
|
||||
@ -1,166 +1,166 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CIconActDialog</class>
|
||||
<widget class="QDialog" name="CIconActDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>781</width>
|
||||
<height>491</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>图元动作</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTableView" name="m_tableView"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_addBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_delBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>删除</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>236</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_confirmBtn">
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_cancelBtn">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>235</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CIconActDialog</class>
|
||||
<widget class="QDialog" name="CIconActDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>781</width>
|
||||
<height>491</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>图元动作</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTableView" name="m_tableView"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_addBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_delBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>删除</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>236</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_confirmBtn">
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_cancelBtn">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>235</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,34 +1,34 @@
|
||||
#ifndef CICONACTPUBLIC_H
|
||||
#define CICONACTPUBLIC_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct ST_ICONACT
|
||||
{
|
||||
QString name;
|
||||
int action;
|
||||
QString panel;
|
||||
QString strategy;
|
||||
int simulate;
|
||||
|
||||
ST_ICONACT(){
|
||||
action = 0;
|
||||
simulate = 0;
|
||||
}
|
||||
};
|
||||
|
||||
//< 触发动作
|
||||
enum EN_ACTION
|
||||
{
|
||||
ACT_LEFT_CLICK = 0,
|
||||
ACT_LEFT_DOUCLICK
|
||||
};
|
||||
|
||||
//< 模拟操作
|
||||
enum EN_SIMULATE
|
||||
{
|
||||
SIM_FORBID = 0,
|
||||
SIM_ALLOW
|
||||
};
|
||||
|
||||
#endif // CICONACTPUBLIC_H
|
||||
#ifndef CICONACTPUBLIC_H
|
||||
#define CICONACTPUBLIC_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct ST_ICONACT
|
||||
{
|
||||
QString name;
|
||||
int action;
|
||||
QString panel;
|
||||
QString strategy;
|
||||
int simulate;
|
||||
|
||||
ST_ICONACT(){
|
||||
action = 0;
|
||||
simulate = 0;
|
||||
}
|
||||
};
|
||||
|
||||
//< 触发动作
|
||||
enum EN_ACTION
|
||||
{
|
||||
ACT_LEFT_CLICK = 0,
|
||||
ACT_LEFT_DOUCLICK
|
||||
};
|
||||
|
||||
//< 模拟操作
|
||||
enum EN_SIMULATE
|
||||
{
|
||||
SIM_FORBID = 0,
|
||||
SIM_ALLOW
|
||||
};
|
||||
|
||||
#endif // CICONACTPUBLIC_H
|
||||
|
||||
@ -1,97 +1,97 @@
|
||||
#include "CLineEditWithBt.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QToolButton>
|
||||
#include <QLineEdit>
|
||||
#include <QDir>
|
||||
|
||||
CLineEditWithBt::CLineEditWithBt(QWidget *parent, const QString &filePath, Option option)
|
||||
:QWidget(parent),m_filePath(filePath),m_option(option)
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
m_edit = new QLineEdit(this);
|
||||
m_edit->installEventFilter(this);
|
||||
m_button = new QToolButton(this);
|
||||
m_button->setText("...");
|
||||
m_button->setFixedSize(21,20);
|
||||
layout->addWidget(m_edit);
|
||||
layout->addWidget(m_button);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
this->setLayout(layout);
|
||||
|
||||
connect(m_button, SIGNAL(clicked()), this, SLOT(getFilePath()));
|
||||
}
|
||||
|
||||
CLineEditWithBt::~CLineEditWithBt()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString CLineEditWithBt::text()
|
||||
{
|
||||
return m_edit->text();
|
||||
}
|
||||
|
||||
void CLineEditWithBt::setText(const QString &text)
|
||||
{
|
||||
m_edit->setText(text);
|
||||
}
|
||||
|
||||
void CLineEditWithBt::getFilePath()
|
||||
{
|
||||
QFileDialog *dialog = new QFileDialog(this, tr("选择文件"), m_filePath+text());
|
||||
dialog->setOption(QFileDialog::DontUseNativeDialog);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dialog, SIGNAL(fileSelected(QString)), this, SLOT(setFilePath(QString)));
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void CLineEditWithBt::setFilePath(const QString &name)
|
||||
{
|
||||
if(name != QString())
|
||||
{
|
||||
QDir dir;
|
||||
switch (m_option) {
|
||||
case GetFile:
|
||||
{
|
||||
dir.cd(m_filePath);
|
||||
break;
|
||||
}
|
||||
case GetPath:
|
||||
{
|
||||
dir.cd(QCoreApplication::applicationDirPath());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QString text = dir.relativeFilePath(name);
|
||||
if(text.right(4) == ".exe")
|
||||
{
|
||||
text.remove(-4, 4);
|
||||
}
|
||||
setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
bool CLineEditWithBt::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if(watched == m_edit)
|
||||
{
|
||||
if (event->type() == QEvent::FocusOut)
|
||||
{
|
||||
this->setFocus();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
#include "CLineEditWithBt.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QToolButton>
|
||||
#include <QLineEdit>
|
||||
#include <QDir>
|
||||
|
||||
CLineEditWithBt::CLineEditWithBt(QWidget *parent, const QString &filePath, Option option)
|
||||
:QWidget(parent),m_filePath(filePath),m_option(option)
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
m_edit = new QLineEdit(this);
|
||||
m_edit->installEventFilter(this);
|
||||
m_button = new QToolButton(this);
|
||||
m_button->setText("...");
|
||||
m_button->setFixedSize(21,20);
|
||||
layout->addWidget(m_edit);
|
||||
layout->addWidget(m_button);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
this->setLayout(layout);
|
||||
|
||||
connect(m_button, SIGNAL(clicked()), this, SLOT(getFilePath()));
|
||||
}
|
||||
|
||||
CLineEditWithBt::~CLineEditWithBt()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString CLineEditWithBt::text()
|
||||
{
|
||||
return m_edit->text();
|
||||
}
|
||||
|
||||
void CLineEditWithBt::setText(const QString &text)
|
||||
{
|
||||
m_edit->setText(text);
|
||||
}
|
||||
|
||||
void CLineEditWithBt::getFilePath()
|
||||
{
|
||||
QFileDialog *dialog = new QFileDialog(this, tr("选择文件"), m_filePath+text());
|
||||
dialog->setOption(QFileDialog::DontUseNativeDialog);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dialog, SIGNAL(fileSelected(QString)), this, SLOT(setFilePath(QString)));
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void CLineEditWithBt::setFilePath(const QString &name)
|
||||
{
|
||||
if(name != QString())
|
||||
{
|
||||
QDir dir;
|
||||
switch (m_option) {
|
||||
case GetFile:
|
||||
{
|
||||
dir.cd(m_filePath);
|
||||
break;
|
||||
}
|
||||
case GetPath:
|
||||
{
|
||||
dir.cd(QCoreApplication::applicationDirPath());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QString text = dir.relativeFilePath(name);
|
||||
if(text.right(4) == ".exe")
|
||||
{
|
||||
text.remove(-4, 4);
|
||||
}
|
||||
setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
bool CLineEditWithBt::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if(watched == m_edit)
|
||||
{
|
||||
if (event->type() == QEvent::FocusOut)
|
||||
{
|
||||
this->setFocus();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
@ -1,37 +1,37 @@
|
||||
#ifndef CLINEEDITWITHBT_H
|
||||
#define CLINEEDITWITHBT_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLineEdit;
|
||||
class QToolButton;
|
||||
class CLineEditWithBt : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Option{
|
||||
GetFile = 0,
|
||||
GetPath = 1
|
||||
};
|
||||
|
||||
CLineEditWithBt(QWidget *parent = 0, const QString& filePath = "", Option option = GetFile);
|
||||
~CLineEditWithBt();
|
||||
|
||||
void setText(const QString& text);
|
||||
QString text();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private slots:
|
||||
void getFilePath();
|
||||
void setFilePath(const QString& name);
|
||||
|
||||
private:
|
||||
QString m_filePath;
|
||||
Option m_option;
|
||||
QLineEdit *m_edit;
|
||||
QToolButton *m_button;
|
||||
};
|
||||
|
||||
#endif // CLINEEDITWITHBT_H
|
||||
#ifndef CLINEEDITWITHBT_H
|
||||
#define CLINEEDITWITHBT_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLineEdit;
|
||||
class QToolButton;
|
||||
class CLineEditWithBt : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Option{
|
||||
GetFile = 0,
|
||||
GetPath = 1
|
||||
};
|
||||
|
||||
CLineEditWithBt(QWidget *parent = 0, const QString& filePath = "", Option option = GetFile);
|
||||
~CLineEditWithBt();
|
||||
|
||||
void setText(const QString& text);
|
||||
QString text();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private slots:
|
||||
void getFilePath();
|
||||
void setFilePath(const QString& name);
|
||||
|
||||
private:
|
||||
QString m_filePath;
|
||||
Option m_option;
|
||||
QLineEdit *m_edit;
|
||||
QToolButton *m_button;
|
||||
};
|
||||
|
||||
#endif // CLINEEDITWITHBT_H
|
||||
|
||||
@ -1,126 +1,126 @@
|
||||
#include "CTableDelegate.h"
|
||||
#include "CLineEditWithBt.h"
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
|
||||
CTableDelegate::CTableDelegate(QObject *parent, DelegateWidget type, bool editable)
|
||||
: QStyledItemDelegate(parent),
|
||||
m_type(type),
|
||||
m_editable(editable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CTableDelegate::~CTableDelegate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CTableDelegate::setComboMap(const QMap<QVariant, QString> &map)
|
||||
{
|
||||
m_mapComboBox = map;
|
||||
}
|
||||
|
||||
void CTableDelegate::setFilePath(const QString &path)
|
||||
{
|
||||
m_strFilePath = path;
|
||||
}
|
||||
|
||||
QString CTableDelegate::getFilePath()
|
||||
{
|
||||
return m_strFilePath;
|
||||
}
|
||||
|
||||
QWidget *CTableDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
switch(m_type){
|
||||
case ReadOnly:
|
||||
return NULL;
|
||||
case LineEdit:
|
||||
return new QLineEdit(parent);
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *box= new QComboBox(parent);
|
||||
box->setEditable(m_editable);
|
||||
QMap<QVariant, QString>::const_iterator iter
|
||||
= m_mapComboBox.constBegin();
|
||||
for(; iter != m_mapComboBox.constEnd(); iter ++)
|
||||
{
|
||||
box->addItem(iter.value(), iter.key());
|
||||
}
|
||||
return box;
|
||||
}
|
||||
case PicFile:
|
||||
case IconFile:
|
||||
{
|
||||
return new CLineEditWithBt(parent, m_strFilePath);
|
||||
}
|
||||
default:
|
||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTableDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||
{
|
||||
switch(m_type){
|
||||
case LineEdit:
|
||||
{
|
||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||
break;
|
||||
}
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||
comb->setCurrentIndex(comb->findText(index.data(Qt::DisplayRole).toString()));
|
||||
break;
|
||||
}
|
||||
case PicFile:
|
||||
case IconFile:
|
||||
{
|
||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QStyledItemDelegate::setEditorData(editor, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTableDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||
{
|
||||
switch (m_type) {
|
||||
case LineEdit:
|
||||
{
|
||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||
break;
|
||||
}
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||
if(model->data(index, Qt::DisplayRole) != comb->currentText())
|
||||
{
|
||||
model->setData(index, comb->currentText(), Qt::DisplayRole);
|
||||
model->setData(index, comb->currentData(), Qt::UserRole);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PicFile:
|
||||
case IconFile:
|
||||
{
|
||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||
model->setData(index, edit->text(), Qt::UserRole);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTableDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
#include "CTableDelegate.h"
|
||||
#include "CLineEditWithBt.h"
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
|
||||
CTableDelegate::CTableDelegate(QObject *parent, DelegateWidget type, bool editable)
|
||||
: QStyledItemDelegate(parent),
|
||||
m_type(type),
|
||||
m_editable(editable)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CTableDelegate::~CTableDelegate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CTableDelegate::setComboMap(const QMap<QVariant, QString> &map)
|
||||
{
|
||||
m_mapComboBox = map;
|
||||
}
|
||||
|
||||
void CTableDelegate::setFilePath(const QString &path)
|
||||
{
|
||||
m_strFilePath = path;
|
||||
}
|
||||
|
||||
QString CTableDelegate::getFilePath()
|
||||
{
|
||||
return m_strFilePath;
|
||||
}
|
||||
|
||||
QWidget *CTableDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
switch(m_type){
|
||||
case ReadOnly:
|
||||
return NULL;
|
||||
case LineEdit:
|
||||
return new QLineEdit(parent);
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *box= new QComboBox(parent);
|
||||
box->setEditable(m_editable);
|
||||
QMap<QVariant, QString>::const_iterator iter
|
||||
= m_mapComboBox.constBegin();
|
||||
for(; iter != m_mapComboBox.constEnd(); iter ++)
|
||||
{
|
||||
box->addItem(iter.value(), iter.key());
|
||||
}
|
||||
return box;
|
||||
}
|
||||
case PicFile:
|
||||
case IconFile:
|
||||
{
|
||||
return new CLineEditWithBt(parent, m_strFilePath);
|
||||
}
|
||||
default:
|
||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTableDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||
{
|
||||
switch(m_type){
|
||||
case LineEdit:
|
||||
{
|
||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||
break;
|
||||
}
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||
comb->setCurrentIndex(comb->findText(index.data(Qt::DisplayRole).toString()));
|
||||
break;
|
||||
}
|
||||
case PicFile:
|
||||
case IconFile:
|
||||
{
|
||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QStyledItemDelegate::setEditorData(editor, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTableDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||
{
|
||||
switch (m_type) {
|
||||
case LineEdit:
|
||||
{
|
||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||
break;
|
||||
}
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||
if(model->data(index, Qt::DisplayRole) != comb->currentText())
|
||||
{
|
||||
model->setData(index, comb->currentText(), Qt::DisplayRole);
|
||||
model->setData(index, comb->currentData(), Qt::UserRole);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PicFile:
|
||||
case IconFile:
|
||||
{
|
||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||
model->setData(index, edit->text(), Qt::UserRole);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTableDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
|
||||
@ -1,55 +1,55 @@
|
||||
#ifndef CTREEITEMDELEGATE_H
|
||||
#define CTREEITEMDELEGATE_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
class CTableDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum DelegateWidget{
|
||||
ReadOnly = 0,
|
||||
LineEdit = 1,
|
||||
ComboBox = 2,
|
||||
PicFile = 3,
|
||||
IconFile = 4
|
||||
};
|
||||
|
||||
CTableDelegate(QObject *parent = 0, DelegateWidget type = LineEdit, bool editable = false);
|
||||
~CTableDelegate();
|
||||
|
||||
/**
|
||||
* @brief setComboMap DelegateWidget::ComboBox 有效
|
||||
* @param map
|
||||
*/
|
||||
void setComboMap(const QMap<QVariant, QString> &map);
|
||||
|
||||
/**
|
||||
* @brief setFilePath DelegateWidget::PicFile/IconFile 有效
|
||||
* @param path
|
||||
*/
|
||||
void setFilePath(const QString &path);
|
||||
|
||||
QString getFilePath();
|
||||
|
||||
QWidget *createEditor(QWidget *parent,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
void setModelData(QWidget *editor,
|
||||
QAbstractItemModel *model,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
void updateEditorGeometry(QWidget *editor,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
DelegateWidget m_type;
|
||||
bool m_editable;
|
||||
QMap<QVariant, QString> m_mapComboBox;
|
||||
QString m_strFilePath;
|
||||
};
|
||||
|
||||
#endif // CTREEITEMDELEGATE_H
|
||||
#ifndef CTREEITEMDELEGATE_H
|
||||
#define CTREEITEMDELEGATE_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
class CTableDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum DelegateWidget{
|
||||
ReadOnly = 0,
|
||||
LineEdit = 1,
|
||||
ComboBox = 2,
|
||||
PicFile = 3,
|
||||
IconFile = 4
|
||||
};
|
||||
|
||||
CTableDelegate(QObject *parent = 0, DelegateWidget type = LineEdit, bool editable = false);
|
||||
~CTableDelegate();
|
||||
|
||||
/**
|
||||
* @brief setComboMap DelegateWidget::ComboBox 有效
|
||||
* @param map
|
||||
*/
|
||||
void setComboMap(const QMap<QVariant, QString> &map);
|
||||
|
||||
/**
|
||||
* @brief setFilePath DelegateWidget::PicFile/IconFile 有效
|
||||
* @param path
|
||||
*/
|
||||
void setFilePath(const QString &path);
|
||||
|
||||
QString getFilePath();
|
||||
|
||||
QWidget *createEditor(QWidget *parent,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
void setModelData(QWidget *editor,
|
||||
QAbstractItemModel *model,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
void updateEditorGeometry(QWidget *editor,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
DelegateWidget m_type;
|
||||
bool m_editable;
|
||||
QMap<QVariant, QString> m_mapComboBox;
|
||||
QString m_strFilePath;
|
||||
};
|
||||
|
||||
#endif // CTREEITEMDELEGATE_H
|
||||
|
||||
@ -1,182 +1,182 @@
|
||||
#include "CTableModel.h"
|
||||
#include "CIconActDialog.h"
|
||||
|
||||
CTableModel::CTableModel(QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
{
|
||||
m_parent = dynamic_cast<CIconActDialog *>(parent);
|
||||
m_headerList << tr("图元名称") << tr("触发动作") << tr("控制面板") << tr("默认着色策略") << tr("模拟操作");
|
||||
}
|
||||
|
||||
const QList<ST_ICONACT> &CTableModel::getDataList()
|
||||
{
|
||||
return m_dataList;
|
||||
}
|
||||
|
||||
void CTableModel::updateData(QList<ST_ICONACT> &dataList)
|
||||
{
|
||||
beginResetModel();
|
||||
m_dataList.swap(dataList);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void CTableModel::addRows(const QList<ST_ICONACT> &dataList)
|
||||
{
|
||||
if(dataList.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
beginInsertRows(QModelIndex(), rowCount(), rowCount() + dataList.length()-1);
|
||||
m_dataList.append(dataList);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void CTableModel::removeRows(const QModelIndexList &rowIndexList)
|
||||
{
|
||||
beginResetModel();
|
||||
for(int nIndex(rowIndexList.length()-1); nIndex>=0; nIndex--){
|
||||
m_dataList.removeAt(rowIndexList[nIndex].row());
|
||||
}
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void CTableModel::getExistIcon(QStringList &nameList)
|
||||
{
|
||||
foreach (ST_ICONACT st_icon, m_dataList) {
|
||||
nameList.append(st_icon.name);
|
||||
}
|
||||
}
|
||||
|
||||
QVariant CTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if(Qt::DisplayRole == role)
|
||||
{
|
||||
if(Qt::Horizontal == orientation)
|
||||
{
|
||||
return m_headerList.at(section);
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
int CTableModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if(parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_dataList.length();
|
||||
}
|
||||
|
||||
int CTableModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
if(parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_headerList.length();
|
||||
}
|
||||
|
||||
QVariant CTableModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if(Qt::TextAlignmentRole == role)
|
||||
{
|
||||
return Qt::AlignCenter;
|
||||
}
|
||||
\
|
||||
if(Qt::DisplayRole != role)
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
switch(index.column()){
|
||||
case NAME:
|
||||
{
|
||||
return m_dataList.at(index.row()).name;
|
||||
break;
|
||||
}
|
||||
case ACTION:
|
||||
{
|
||||
return m_parent->getActDesc( m_dataList.at(index.row()).action );
|
||||
break;
|
||||
}
|
||||
case PANEL:
|
||||
{
|
||||
return m_dataList.at(index.row()).panel;
|
||||
break;
|
||||
}
|
||||
case STRATEGY:
|
||||
{
|
||||
return m_dataList.at(index.row()).strategy;
|
||||
break;
|
||||
}
|
||||
case SIMULATE:
|
||||
{
|
||||
return m_parent->getSimDesc( m_dataList.at(index.row()).simulate );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool CTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if(!index.isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(Qt::DisplayRole == role)
|
||||
{
|
||||
switch(index.column()){
|
||||
case NAME:
|
||||
{
|
||||
m_dataList[index.row()].name = value.toString();
|
||||
break;
|
||||
}
|
||||
case PANEL:
|
||||
{
|
||||
m_dataList[index.row()].panel = value.toString();
|
||||
break;
|
||||
}
|
||||
case STRATEGY:
|
||||
{
|
||||
m_dataList[index.row()].strategy = value.toString();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(Qt::UserRole == role)
|
||||
{
|
||||
switch(index.column()){
|
||||
case ACTION:
|
||||
{
|
||||
m_dataList[index.row()].action = value.toInt();
|
||||
break;
|
||||
}
|
||||
case SIMULATE:
|
||||
{
|
||||
m_dataList[index.row()].simulate = value.toInt();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Qt::ItemFlags CTableModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return Qt::NoItemFlags;
|
||||
}
|
||||
|
||||
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
|
||||
}
|
||||
#include "CTableModel.h"
|
||||
#include "CIconActDialog.h"
|
||||
|
||||
CTableModel::CTableModel(QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
{
|
||||
m_parent = dynamic_cast<CIconActDialog *>(parent);
|
||||
m_headerList << tr("图元名称") << tr("触发动作") << tr("控制面板") << tr("默认着色策略") << tr("模拟操作");
|
||||
}
|
||||
|
||||
const QList<ST_ICONACT> &CTableModel::getDataList()
|
||||
{
|
||||
return m_dataList;
|
||||
}
|
||||
|
||||
void CTableModel::updateData(QList<ST_ICONACT> &dataList)
|
||||
{
|
||||
beginResetModel();
|
||||
m_dataList.swap(dataList);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void CTableModel::addRows(const QList<ST_ICONACT> &dataList)
|
||||
{
|
||||
if(dataList.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
beginInsertRows(QModelIndex(), rowCount(), rowCount() + dataList.length()-1);
|
||||
m_dataList.append(dataList);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void CTableModel::removeRows(const QModelIndexList &rowIndexList)
|
||||
{
|
||||
beginResetModel();
|
||||
for(int nIndex(rowIndexList.length()-1); nIndex>=0; nIndex--){
|
||||
m_dataList.removeAt(rowIndexList[nIndex].row());
|
||||
}
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void CTableModel::getExistIcon(QStringList &nameList)
|
||||
{
|
||||
foreach (ST_ICONACT st_icon, m_dataList) {
|
||||
nameList.append(st_icon.name);
|
||||
}
|
||||
}
|
||||
|
||||
QVariant CTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if(Qt::DisplayRole == role)
|
||||
{
|
||||
if(Qt::Horizontal == orientation)
|
||||
{
|
||||
return m_headerList.at(section);
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
int CTableModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if(parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_dataList.length();
|
||||
}
|
||||
|
||||
int CTableModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
if(parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_headerList.length();
|
||||
}
|
||||
|
||||
QVariant CTableModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if(Qt::TextAlignmentRole == role)
|
||||
{
|
||||
return Qt::AlignCenter;
|
||||
}
|
||||
\
|
||||
if(Qt::DisplayRole != role)
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
switch(index.column()){
|
||||
case NAME:
|
||||
{
|
||||
return m_dataList.at(index.row()).name;
|
||||
break;
|
||||
}
|
||||
case ACTION:
|
||||
{
|
||||
return m_parent->getActDesc( m_dataList.at(index.row()).action );
|
||||
break;
|
||||
}
|
||||
case PANEL:
|
||||
{
|
||||
return m_dataList.at(index.row()).panel;
|
||||
break;
|
||||
}
|
||||
case STRATEGY:
|
||||
{
|
||||
return m_dataList.at(index.row()).strategy;
|
||||
break;
|
||||
}
|
||||
case SIMULATE:
|
||||
{
|
||||
return m_parent->getSimDesc( m_dataList.at(index.row()).simulate );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool CTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if(!index.isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(Qt::DisplayRole == role)
|
||||
{
|
||||
switch(index.column()){
|
||||
case NAME:
|
||||
{
|
||||
m_dataList[index.row()].name = value.toString();
|
||||
break;
|
||||
}
|
||||
case PANEL:
|
||||
{
|
||||
m_dataList[index.row()].panel = value.toString();
|
||||
break;
|
||||
}
|
||||
case STRATEGY:
|
||||
{
|
||||
m_dataList[index.row()].strategy = value.toString();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(Qt::UserRole == role)
|
||||
{
|
||||
switch(index.column()){
|
||||
case ACTION:
|
||||
{
|
||||
m_dataList[index.row()].action = value.toInt();
|
||||
break;
|
||||
}
|
||||
case SIMULATE:
|
||||
{
|
||||
m_dataList[index.row()].simulate = value.toInt();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Qt::ItemFlags CTableModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return Qt::NoItemFlags;
|
||||
}
|
||||
|
||||
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
|
||||
}
|
||||
|
||||
@ -1,50 +1,50 @@
|
||||
#ifndef CTABLEMODEL_H
|
||||
#define CTABLEMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QTableView>
|
||||
#include "CIconActPublic.h"
|
||||
|
||||
class CIconActDialog;
|
||||
class CTableModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum ColumnField
|
||||
{
|
||||
NAME = 0,
|
||||
ACTION,
|
||||
PANEL,
|
||||
STRATEGY,
|
||||
SIMULATE
|
||||
};
|
||||
|
||||
CTableModel(QObject *parent = Q_NULLPTR);
|
||||
|
||||
const QList<ST_ICONACT>& getDataList();
|
||||
|
||||
void updateData(QList<ST_ICONACT> &dataList);
|
||||
|
||||
void addRows(const QList<ST_ICONACT> &dataList);
|
||||
|
||||
void removeRows(const QModelIndexList &rowIndexList);
|
||||
|
||||
void getExistIcon(QStringList &nameList);
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
QStringList m_headerList;
|
||||
QList<ST_ICONACT> m_dataList;
|
||||
CIconActDialog * m_parent;
|
||||
};
|
||||
|
||||
#endif // CTABLEMODEL_H
|
||||
#ifndef CTABLEMODEL_H
|
||||
#define CTABLEMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QTableView>
|
||||
#include "CIconActPublic.h"
|
||||
|
||||
class CIconActDialog;
|
||||
class CTableModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum ColumnField
|
||||
{
|
||||
NAME = 0,
|
||||
ACTION,
|
||||
PANEL,
|
||||
STRATEGY,
|
||||
SIMULATE
|
||||
};
|
||||
|
||||
CTableModel(QObject *parent = Q_NULLPTR);
|
||||
|
||||
const QList<ST_ICONACT>& getDataList();
|
||||
|
||||
void updateData(QList<ST_ICONACT> &dataList);
|
||||
|
||||
void addRows(const QList<ST_ICONACT> &dataList);
|
||||
|
||||
void removeRows(const QModelIndexList &rowIndexList);
|
||||
|
||||
void getExistIcon(QStringList &nameList);
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
QStringList m_headerList;
|
||||
QList<ST_ICONACT> m_dataList;
|
||||
CIconActDialog * m_parent;
|
||||
};
|
||||
|
||||
#endif // CTABLEMODEL_H
|
||||
|
||||
@ -1,57 +1,56 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2021-08-27T08:57:32
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui xml
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = IconActTool
|
||||
TEMPLATE = app
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
CIconActDialog.cpp \
|
||||
CTableModel.cpp \
|
||||
CLineEditWithBt.cpp \
|
||||
CTableDelegate.cpp \
|
||||
CFileOpt.cpp
|
||||
|
||||
HEADERS += \
|
||||
CIconActDialog.h \
|
||||
CTableModel.h \
|
||||
CIconActPublic.h \
|
||||
CLineEditWithBt.h \
|
||||
CTableDelegate.h \
|
||||
CFileOpt.h
|
||||
|
||||
FORMS += \
|
||||
CIconActDialog.ui
|
||||
|
||||
LIBS += \
|
||||
-lpub_utility_api \
|
||||
-llog4cplus \
|
||||
-lpub_logger_api \
|
||||
-lpub_widget
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2021-08-27T08:57:32
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui xml
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = IconActTool
|
||||
TEMPLATE = app
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
CIconActDialog.cpp \
|
||||
CTableModel.cpp \
|
||||
CLineEditWithBt.cpp \
|
||||
CTableDelegate.cpp \
|
||||
CFileOpt.cpp
|
||||
|
||||
HEADERS += \
|
||||
CIconActDialog.h \
|
||||
CTableModel.h \
|
||||
CIconActPublic.h \
|
||||
CLineEditWithBt.h \
|
||||
CTableDelegate.h \
|
||||
CFileOpt.h
|
||||
|
||||
FORMS += \
|
||||
CIconActDialog.ui
|
||||
|
||||
LIBS += \
|
||||
-lpub_utility_api \
|
||||
-llog4cplus \
|
||||
-lpub_logger_api
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
|
||||
|
||||
@ -1,48 +1,19 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
#include "common/QtAppGlobalSet.h"
|
||||
#include "CIconActDialog.h"
|
||||
#include "pub_utility_api/FileStyle.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
iot_common::doQtAppGlobalSet();
|
||||
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
|
||||
QApplication a(argc, argv);
|
||||
|
||||
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("IconActTool.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);
|
||||
}
|
||||
|
||||
// qApp->setFont(QFont("Microsoft YaHei",10));
|
||||
|
||||
CIconActDialog w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
#include "common/QtAppGlobalSet.h"
|
||||
#include "CIconActDialog.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
kbd_common::doQtAppGlobalSet();
|
||||
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
|
||||
QApplication a(argc, argv);
|
||||
CIconActDialog w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
@ -1,307 +1,307 @@
|
||||
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
||||
#include "public/pub_utility_api/FileUtil.h"
|
||||
#include "public/pub_logger_api/logger.h"
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
|
||||
CJsonOpt::CJsonOpt()
|
||||
{
|
||||
std::string currentPath = iot_public::CFileUtil::getCurModuleDir();
|
||||
QDir dir(QString::fromStdString(currentPath));
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
dir.cd("data");
|
||||
dir.cd("model");
|
||||
|
||||
m_strButtonFile = dir.filePath("ButtonGroupWidget.json");
|
||||
m_strNavFile = dir.filePath("NavigationWidget.json");
|
||||
readBtnJson(m_strButtonFile);
|
||||
readNavJson(m_strNavFile);
|
||||
onFirst();
|
||||
}
|
||||
|
||||
QString &CJsonOpt::getSeparatorPath()
|
||||
{
|
||||
return m_strSeparator;
|
||||
}
|
||||
|
||||
QMap<QString, ST_NODE> &CJsonOpt::getButtonMap()
|
||||
{
|
||||
return m_mapButton;
|
||||
}
|
||||
|
||||
ST_NODE CJsonOpt::getStButton(const QString &key)
|
||||
{
|
||||
return m_mapButton.value(key);
|
||||
}
|
||||
|
||||
QMap<int, QList<QPair<int, ST_NODE> > > &CJsonOpt::getNavMap()
|
||||
{
|
||||
return m_mapNav;
|
||||
}
|
||||
|
||||
bool CJsonOpt::saveJson(const QMap<QString, ST_NODE> &btMap,
|
||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap)
|
||||
{
|
||||
bool success = false;
|
||||
success = saveButtonJson(btMap);
|
||||
if(!success)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
success = saveNavJson(navMap);
|
||||
if(!success)
|
||||
{
|
||||
saveButtonJson(m_mapButton);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CJsonOpt::saveButtonJson(const QMap<QString, ST_NODE> &map)
|
||||
{
|
||||
QFile file(m_strButtonFile);
|
||||
if(!file.exists())
|
||||
{
|
||||
file.setFileName(m_strButtonFile);
|
||||
}
|
||||
if(!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
file.resize(0);
|
||||
|
||||
QJsonObject root;
|
||||
root.insert("separator", m_strSeparator);
|
||||
QMap<QString, ST_NODE>::const_iterator iter = map.constBegin();
|
||||
for(; iter != map.constEnd(); iter++)
|
||||
{
|
||||
QJsonObject button;
|
||||
button.insert("name", iter.value().name);
|
||||
button.insert("used", iter.value().used);
|
||||
button.insert("opt", iter.value().type);
|
||||
button.insert("icon", iter.value().icon);
|
||||
button.insert("web" , iter.value().web);
|
||||
button.insert("data", iter.value().data);
|
||||
button.insert("webData", iter.value().webData);
|
||||
root.insert(iter.key(), button);
|
||||
}
|
||||
QJsonDocument doc;
|
||||
doc.setObject(root);
|
||||
if(-1 == file.write(doc.toJson()))
|
||||
{
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CJsonOpt::saveNavJson(const QMap<int, QList<QPair<int, ST_NODE> > > &map)
|
||||
{
|
||||
QFile file(m_strNavFile);
|
||||
if(!file.exists())
|
||||
{
|
||||
file.setFileName(m_strNavFile);
|
||||
}
|
||||
if(!file.open(QIODevice::ReadWrite))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
QByteArray readJson = file.readAll();
|
||||
file.resize(0);
|
||||
QJsonParseError readError;
|
||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||
if(readError.error != QJsonParseError::NoError)
|
||||
{
|
||||
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||
return false;
|
||||
}
|
||||
QJsonObject root;
|
||||
QJsonObject configure = readJsonResponse.object().value("configure").toObject();
|
||||
root.insert("configure", configure);
|
||||
root.insert("items", getSaveItems(map, -1));
|
||||
QJsonDocument doc;
|
||||
doc.setObject(root);
|
||||
if(-1 == file.write(doc.toJson()))
|
||||
{
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CJsonOpt::readBtnJson(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
QByteArray readJson;
|
||||
if(file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
readJson = file.readAll();
|
||||
file.close();
|
||||
}
|
||||
QJsonParseError readError;
|
||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||
if(readError.error != QJsonParseError::NoError)
|
||||
{
|
||||
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QJsonObject root = readJsonResponse.object();
|
||||
QJsonObject::const_iterator rootIter = root.constBegin();
|
||||
for(; rootIter != root.constEnd(); rootIter++)
|
||||
{
|
||||
if(rootIter.key() == "separator")
|
||||
{
|
||||
m_strSeparator = rootIter.value().toString();
|
||||
continue;
|
||||
}
|
||||
QJsonObject item = rootIter.value().toObject();
|
||||
ST_NODE st_Node;
|
||||
makeStButton(st_Node, item);
|
||||
m_mapButton.insert(rootIter.key(), st_Node);
|
||||
}
|
||||
}
|
||||
|
||||
void CJsonOpt::readNavJson(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
QByteArray readJson;
|
||||
if(file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
readJson = file.readAll();
|
||||
file.close();
|
||||
}
|
||||
QJsonParseError readError;
|
||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||
if(readError.error != QJsonParseError::NoError)
|
||||
{
|
||||
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QJsonObject root = readJsonResponse.object();
|
||||
if(root.contains("items"))
|
||||
{
|
||||
QJsonArray itemArray = root.value("items").toArray();
|
||||
int nItemNumber = 0;
|
||||
for(int nIndex(0); nIndex< itemArray.size(); nIndex++)
|
||||
{
|
||||
ST_NODE st_Node_Top;
|
||||
QJsonObject topLevelObject = itemArray[nIndex].toObject();
|
||||
makeStButton(st_Node_Top, topLevelObject);
|
||||
QPair<int, ST_NODE> topMap;
|
||||
int nTopNumber = nItemNumber;
|
||||
topMap.first = nItemNumber++;
|
||||
topMap.second = st_Node_Top;
|
||||
|
||||
QJsonArray childArray = topLevelObject.value("items").toArray();
|
||||
for(int nChildIndex(0); nChildIndex< childArray.size(); nChildIndex++)
|
||||
{
|
||||
ST_NODE st_Node_Child;
|
||||
QJsonObject childLevelObject = childArray[nChildIndex].toObject();
|
||||
makeStButton(st_Node_Child, childLevelObject);
|
||||
QPair<int, ST_NODE> childMap;
|
||||
int nChildNumber = nItemNumber;
|
||||
childMap.first = nItemNumber++;
|
||||
childMap.second = st_Node_Child;
|
||||
|
||||
QJsonArray leafArray = childLevelObject.value("items").toArray();
|
||||
for(int nLeafIndex(0); nLeafIndex< leafArray.size(); nLeafIndex++)
|
||||
{
|
||||
ST_NODE st_Node_Leaf;
|
||||
QJsonObject leafLevelObject = leafArray[nLeafIndex].toObject();
|
||||
makeStButton(st_Node_Leaf, leafLevelObject);
|
||||
QPair<int, ST_NODE> leafMap;
|
||||
leafMap.first = nItemNumber++;
|
||||
leafMap.second = st_Node_Leaf;
|
||||
m_mapNav[nChildNumber].append(leafMap);
|
||||
}
|
||||
m_mapNav[nTopNumber].append(childMap);
|
||||
}
|
||||
m_mapNav[-1].append(topMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QJsonArray CJsonOpt::getSaveItems(const QMap<int, QList<QPair<int, ST_NODE> > > &map, int key)
|
||||
{
|
||||
QJsonArray root;
|
||||
QList<QPair<int, ST_NODE>> rootList = map.value(key);
|
||||
for(int n=0; n<rootList.length(); n++){
|
||||
QJsonObject object;
|
||||
object.insert("data", rootList[n].second.data);
|
||||
object.insert("icon", rootList[n].second.icon);
|
||||
object.insert("name", rootList[n].second.name);
|
||||
object.insert("used", rootList[n].second.used);
|
||||
object.insert("opt", rootList[n].second.type);
|
||||
object.insert("web" , rootList[n].second.web);
|
||||
object.insert("webType", rootList[n].second.webType);
|
||||
object.insert("url", rootList[n].second.url);
|
||||
object.insert("items", getSaveItems(map, rootList[n].first));
|
||||
root.append(object);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
void CJsonOpt::makeStButton(ST_NODE &st_Node, const QJsonObject &object)
|
||||
{
|
||||
if(!object.value("name").isUndefined())
|
||||
{
|
||||
st_Node.name = object.value("name").toString();
|
||||
}
|
||||
if(!object.value("icon").isUndefined())
|
||||
{
|
||||
st_Node.icon = object.value("icon").toString();
|
||||
}
|
||||
if(!object.value("data").isUndefined())
|
||||
{
|
||||
st_Node.data = object.value("data").toString();
|
||||
}
|
||||
if(!object.value("opt").isUndefined())
|
||||
{
|
||||
st_Node.type = object.value("opt").toInt();
|
||||
}
|
||||
if(!object.value("used").isUndefined())
|
||||
{
|
||||
st_Node.used = object.value("used").toInt();
|
||||
}
|
||||
if(!object.value("web").isUndefined())
|
||||
{
|
||||
st_Node.web = object.value("web").toInt();
|
||||
}
|
||||
if(!object.value("webData").isUndefined())
|
||||
{
|
||||
st_Node.webData = object.value("webData").toString();
|
||||
}
|
||||
if(!object.value("webType").isUndefined())
|
||||
{
|
||||
st_Node.webType = object.value("webType").toString();
|
||||
}
|
||||
if(!object.value("url").isUndefined())
|
||||
{
|
||||
st_Node.url = object.value("url").toString();
|
||||
}
|
||||
}
|
||||
|
||||
void CJsonOpt::onFirst()
|
||||
{
|
||||
if(!m_mapButton.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
QStringList navList;
|
||||
for(int nIndex(0); nIndex<m_mapNav.value(-1).length(); nIndex++)
|
||||
{
|
||||
navList.append("1");
|
||||
}
|
||||
ST_NODE st_node;
|
||||
st_node.name = QObject::tr("自定义项目");
|
||||
st_node.type = SWITCH_NAV;
|
||||
st_node.data = navList.join(",");
|
||||
m_mapButton.insert("m_button1", st_node);
|
||||
}
|
||||
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
||||
#include "public/pub_utility_api/FileUtil.h"
|
||||
#include "public/pub_logger_api/logger.h"
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
|
||||
CJsonOpt::CJsonOpt()
|
||||
{
|
||||
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
||||
QDir dir(QString::fromStdString(currentPath));
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
dir.cd("data");
|
||||
dir.cd("model");
|
||||
|
||||
m_strButtonFile = dir.filePath("ButtonGroupWidget.json");
|
||||
m_strNavFile = dir.filePath("NavigationWidget.json");
|
||||
readBtnJson(m_strButtonFile);
|
||||
readNavJson(m_strNavFile);
|
||||
onFirst();
|
||||
}
|
||||
|
||||
QString &CJsonOpt::getSeparatorPath()
|
||||
{
|
||||
return m_strSeparator;
|
||||
}
|
||||
|
||||
QMap<QString, ST_NODE> &CJsonOpt::getButtonMap()
|
||||
{
|
||||
return m_mapButton;
|
||||
}
|
||||
|
||||
ST_NODE CJsonOpt::getStButton(const QString &key)
|
||||
{
|
||||
return m_mapButton.value(key);
|
||||
}
|
||||
|
||||
QMap<int, QList<QPair<int, ST_NODE> > > &CJsonOpt::getNavMap()
|
||||
{
|
||||
return m_mapNav;
|
||||
}
|
||||
|
||||
bool CJsonOpt::saveJson(const QMap<QString, ST_NODE> &btMap,
|
||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap)
|
||||
{
|
||||
bool success = false;
|
||||
success = saveButtonJson(btMap);
|
||||
if(!success)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
success = saveNavJson(navMap);
|
||||
if(!success)
|
||||
{
|
||||
saveButtonJson(m_mapButton);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CJsonOpt::saveButtonJson(const QMap<QString, ST_NODE> &map)
|
||||
{
|
||||
QFile file(m_strButtonFile);
|
||||
if(!file.exists())
|
||||
{
|
||||
file.setFileName(m_strButtonFile);
|
||||
}
|
||||
if(!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
file.resize(0);
|
||||
|
||||
QJsonObject root;
|
||||
root.insert("separator", m_strSeparator);
|
||||
QMap<QString, ST_NODE>::const_iterator iter = map.constBegin();
|
||||
for(; iter != map.constEnd(); iter++)
|
||||
{
|
||||
QJsonObject button;
|
||||
button.insert("name", iter.value().name);
|
||||
button.insert("used", iter.value().used);
|
||||
button.insert("opt", iter.value().type);
|
||||
button.insert("icon", iter.value().icon);
|
||||
button.insert("web" , iter.value().web);
|
||||
button.insert("data", iter.value().data);
|
||||
button.insert("webData", iter.value().webData);
|
||||
root.insert(iter.key(), button);
|
||||
}
|
||||
QJsonDocument doc;
|
||||
doc.setObject(root);
|
||||
if(-1 == file.write(doc.toJson()))
|
||||
{
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CJsonOpt::saveNavJson(const QMap<int, QList<QPair<int, ST_NODE> > > &map)
|
||||
{
|
||||
QFile file(m_strNavFile);
|
||||
if(!file.exists())
|
||||
{
|
||||
file.setFileName(m_strNavFile);
|
||||
}
|
||||
if(!file.open(QIODevice::ReadWrite))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
QByteArray readJson = file.readAll();
|
||||
file.resize(0);
|
||||
QJsonParseError readError;
|
||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||
if(readError.error != QJsonParseError::NoError)
|
||||
{
|
||||
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||
return false;
|
||||
}
|
||||
QJsonObject root;
|
||||
QJsonObject configure = readJsonResponse.object().value("configure").toObject();
|
||||
root.insert("configure", configure);
|
||||
root.insert("items", getSaveItems(map, -1));
|
||||
QJsonDocument doc;
|
||||
doc.setObject(root);
|
||||
if(-1 == file.write(doc.toJson()))
|
||||
{
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CJsonOpt::readBtnJson(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
QByteArray readJson;
|
||||
if(file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
readJson = file.readAll();
|
||||
file.close();
|
||||
}
|
||||
QJsonParseError readError;
|
||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||
if(readError.error != QJsonParseError::NoError)
|
||||
{
|
||||
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QJsonObject root = readJsonResponse.object();
|
||||
QJsonObject::const_iterator rootIter = root.constBegin();
|
||||
for(; rootIter != root.constEnd(); rootIter++)
|
||||
{
|
||||
if(rootIter.key() == "separator")
|
||||
{
|
||||
m_strSeparator = rootIter.value().toString();
|
||||
continue;
|
||||
}
|
||||
QJsonObject item = rootIter.value().toObject();
|
||||
ST_NODE st_Node;
|
||||
makeStButton(st_Node, item);
|
||||
m_mapButton.insert(rootIter.key(), st_Node);
|
||||
}
|
||||
}
|
||||
|
||||
void CJsonOpt::readNavJson(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
QByteArray readJson;
|
||||
if(file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
readJson = file.readAll();
|
||||
file.close();
|
||||
}
|
||||
QJsonParseError readError;
|
||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||
if(readError.error != QJsonParseError::NoError)
|
||||
{
|
||||
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
QJsonObject root = readJsonResponse.object();
|
||||
if(root.contains("items"))
|
||||
{
|
||||
QJsonArray itemArray = root.value("items").toArray();
|
||||
int nItemNumber = 0;
|
||||
for(int nIndex(0); nIndex< itemArray.size(); nIndex++)
|
||||
{
|
||||
ST_NODE st_Node_Top;
|
||||
QJsonObject topLevelObject = itemArray[nIndex].toObject();
|
||||
makeStButton(st_Node_Top, topLevelObject);
|
||||
QPair<int, ST_NODE> topMap;
|
||||
int nTopNumber = nItemNumber;
|
||||
topMap.first = nItemNumber++;
|
||||
topMap.second = st_Node_Top;
|
||||
|
||||
QJsonArray childArray = topLevelObject.value("items").toArray();
|
||||
for(int nChildIndex(0); nChildIndex< childArray.size(); nChildIndex++)
|
||||
{
|
||||
ST_NODE st_Node_Child;
|
||||
QJsonObject childLevelObject = childArray[nChildIndex].toObject();
|
||||
makeStButton(st_Node_Child, childLevelObject);
|
||||
QPair<int, ST_NODE> childMap;
|
||||
int nChildNumber = nItemNumber;
|
||||
childMap.first = nItemNumber++;
|
||||
childMap.second = st_Node_Child;
|
||||
|
||||
QJsonArray leafArray = childLevelObject.value("items").toArray();
|
||||
for(int nLeafIndex(0); nLeafIndex< leafArray.size(); nLeafIndex++)
|
||||
{
|
||||
ST_NODE st_Node_Leaf;
|
||||
QJsonObject leafLevelObject = leafArray[nLeafIndex].toObject();
|
||||
makeStButton(st_Node_Leaf, leafLevelObject);
|
||||
QPair<int, ST_NODE> leafMap;
|
||||
leafMap.first = nItemNumber++;
|
||||
leafMap.second = st_Node_Leaf;
|
||||
m_mapNav[nChildNumber].append(leafMap);
|
||||
}
|
||||
m_mapNav[nTopNumber].append(childMap);
|
||||
}
|
||||
m_mapNav[-1].append(topMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QJsonArray CJsonOpt::getSaveItems(const QMap<int, QList<QPair<int, ST_NODE> > > &map, int key)
|
||||
{
|
||||
QJsonArray root;
|
||||
QList<QPair<int, ST_NODE>> rootList = map.value(key);
|
||||
for(int n=0; n<rootList.length(); n++){
|
||||
QJsonObject object;
|
||||
object.insert("data", rootList[n].second.data);
|
||||
object.insert("icon", rootList[n].second.icon);
|
||||
object.insert("name", rootList[n].second.name);
|
||||
object.insert("used", rootList[n].second.used);
|
||||
object.insert("opt", rootList[n].second.type);
|
||||
object.insert("web" , rootList[n].second.web);
|
||||
object.insert("webType", rootList[n].second.webType);
|
||||
object.insert("url", rootList[n].second.url);
|
||||
object.insert("items", getSaveItems(map, rootList[n].first));
|
||||
root.append(object);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
void CJsonOpt::makeStButton(ST_NODE &st_Node, const QJsonObject &object)
|
||||
{
|
||||
if(!object.value("name").isUndefined())
|
||||
{
|
||||
st_Node.name = object.value("name").toString();
|
||||
}
|
||||
if(!object.value("icon").isUndefined())
|
||||
{
|
||||
st_Node.icon = object.value("icon").toString();
|
||||
}
|
||||
if(!object.value("data").isUndefined())
|
||||
{
|
||||
st_Node.data = object.value("data").toString();
|
||||
}
|
||||
if(!object.value("opt").isUndefined())
|
||||
{
|
||||
st_Node.type = object.value("opt").toInt();
|
||||
}
|
||||
if(!object.value("used").isUndefined())
|
||||
{
|
||||
st_Node.used = object.value("used").toInt();
|
||||
}
|
||||
if(!object.value("web").isUndefined())
|
||||
{
|
||||
st_Node.web = object.value("web").toInt();
|
||||
}
|
||||
if(!object.value("webData").isUndefined())
|
||||
{
|
||||
st_Node.webData = object.value("webData").toString();
|
||||
}
|
||||
if(!object.value("webType").isUndefined())
|
||||
{
|
||||
st_Node.webType = object.value("webType").toString();
|
||||
}
|
||||
if(!object.value("url").isUndefined())
|
||||
{
|
||||
st_Node.url = object.value("url").toString();
|
||||
}
|
||||
}
|
||||
|
||||
void CJsonOpt::onFirst()
|
||||
{
|
||||
if(!m_mapButton.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
QStringList navList;
|
||||
for(int nIndex(0); nIndex<m_mapNav.value(-1).length(); nIndex++)
|
||||
{
|
||||
navList.append("1");
|
||||
}
|
||||
ST_NODE st_node;
|
||||
st_node.name = QObject::tr("自定义项目");
|
||||
st_node.type = SWITCH_NAV;
|
||||
st_node.data = navList.join(",");
|
||||
m_mapButton.insert("m_button1", st_node);
|
||||
}
|
||||
|
||||
@ -1,45 +1,45 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2021-04-08T17:00:16
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = NavigationApi
|
||||
TEMPLATE = lib
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
DEFINES += NAVIGATION_API_EXPORT
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
SOURCES += \
|
||||
CJsonOpt.cpp
|
||||
|
||||
HEADERS += \
|
||||
../../../include/gui/GraphTool/NavigationApi/CJsonOpt.h \
|
||||
../../../include/gui/GraphTool/NavigationApi/NavigationApiExport.h
|
||||
|
||||
LIBS += \
|
||||
-llog4cplus \
|
||||
-lpub_logger_api \
|
||||
-lpub_utility_api \
|
||||
-lmodel_excel
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2021-04-08T17:00:16
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = NavigationApi
|
||||
TEMPLATE = lib
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
DEFINES += NAVIGATION_API_EXPORT
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
SOURCES += \
|
||||
CJsonOpt.cpp
|
||||
|
||||
HEADERS += \
|
||||
../../../include/gui/GraphTool/NavigationApi/CJsonOpt.h \
|
||||
../../../include/gui/GraphTool/NavigationApi/NavigationApiExport.h
|
||||
|
||||
LIBS += \
|
||||
-llog4cplus \
|
||||
-lpub_logger_api \
|
||||
-lpub_utility_api \
|
||||
-lmodel_excel
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
|
||||
@ -1,97 +1,97 @@
|
||||
#include "CLineEditWithBt.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QToolButton>
|
||||
#include <QLineEdit>
|
||||
#include <QDir>
|
||||
|
||||
CLineEditWithBt::CLineEditWithBt(QWidget *parent, const QString &filePath, Option option)
|
||||
:QWidget(parent),m_filePath(filePath),m_option(option)
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
m_edit = new QLineEdit(this);
|
||||
m_edit->installEventFilter(this);
|
||||
m_button = new QToolButton(this);
|
||||
m_button->setText("...");
|
||||
m_button->setFixedSize(21,20);
|
||||
layout->addWidget(m_edit);
|
||||
layout->addWidget(m_button);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
this->setLayout(layout);
|
||||
|
||||
connect(m_button, SIGNAL(clicked()), this, SLOT(getFilePath()));
|
||||
}
|
||||
|
||||
CLineEditWithBt::~CLineEditWithBt()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString CLineEditWithBt::text()
|
||||
{
|
||||
return m_edit->text();
|
||||
}
|
||||
|
||||
void CLineEditWithBt::setText(const QString &text)
|
||||
{
|
||||
m_edit->setText(text);
|
||||
}
|
||||
|
||||
void CLineEditWithBt::getFilePath()
|
||||
{
|
||||
QFileDialog *dialog = new QFileDialog(this, tr("选择文件"), m_filePath);
|
||||
dialog->setOption(QFileDialog::DontUseNativeDialog);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dialog, SIGNAL(fileSelected(QString)), this, SLOT(setFilePath(QString)));
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void CLineEditWithBt::setFilePath(const QString &name)
|
||||
{
|
||||
if(name != QString())
|
||||
{
|
||||
QDir dir;
|
||||
switch (m_option) {
|
||||
case GetFile:
|
||||
{
|
||||
dir.cd(m_filePath);
|
||||
break;
|
||||
}
|
||||
case GetPath:
|
||||
{
|
||||
dir.cd(QCoreApplication::applicationDirPath());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QString text = dir.relativeFilePath(name);
|
||||
if(text.right(4) == ".exe")
|
||||
{
|
||||
text.remove(-4, 4);
|
||||
}
|
||||
setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
bool CLineEditWithBt::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if(watched == m_edit)
|
||||
{
|
||||
if (event->type() == QEvent::FocusOut)
|
||||
{
|
||||
this->setFocus();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
#include "CLineEditWithBt.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QToolButton>
|
||||
#include <QLineEdit>
|
||||
#include <QDir>
|
||||
|
||||
CLineEditWithBt::CLineEditWithBt(QWidget *parent, const QString &filePath, Option option)
|
||||
:QWidget(parent),m_filePath(filePath),m_option(option)
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
m_edit = new QLineEdit(this);
|
||||
m_edit->installEventFilter(this);
|
||||
m_button = new QToolButton(this);
|
||||
m_button->setText("...");
|
||||
m_button->setFixedSize(21,20);
|
||||
layout->addWidget(m_edit);
|
||||
layout->addWidget(m_button);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
this->setLayout(layout);
|
||||
|
||||
connect(m_button, SIGNAL(clicked()), this, SLOT(getFilePath()));
|
||||
}
|
||||
|
||||
CLineEditWithBt::~CLineEditWithBt()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString CLineEditWithBt::text()
|
||||
{
|
||||
return m_edit->text();
|
||||
}
|
||||
|
||||
void CLineEditWithBt::setText(const QString &text)
|
||||
{
|
||||
m_edit->setText(text);
|
||||
}
|
||||
|
||||
void CLineEditWithBt::getFilePath()
|
||||
{
|
||||
QFileDialog *dialog = new QFileDialog(this, tr("选择文件"), m_filePath);
|
||||
dialog->setOption(QFileDialog::DontUseNativeDialog);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dialog, SIGNAL(fileSelected(QString)), this, SLOT(setFilePath(QString)));
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void CLineEditWithBt::setFilePath(const QString &name)
|
||||
{
|
||||
if(name != QString())
|
||||
{
|
||||
QDir dir;
|
||||
switch (m_option) {
|
||||
case GetFile:
|
||||
{
|
||||
dir.cd(m_filePath);
|
||||
break;
|
||||
}
|
||||
case GetPath:
|
||||
{
|
||||
dir.cd(QCoreApplication::applicationDirPath());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QString text = dir.relativeFilePath(name);
|
||||
if(text.right(4) == ".exe")
|
||||
{
|
||||
text.remove(-4, 4);
|
||||
}
|
||||
setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
bool CLineEditWithBt::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if(watched == m_edit)
|
||||
{
|
||||
if (event->type() == QEvent::FocusOut)
|
||||
{
|
||||
this->setFocus();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
@ -1,37 +1,37 @@
|
||||
#ifndef CLINEEDITWITHBT_H
|
||||
#define CLINEEDITWITHBT_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLineEdit;
|
||||
class QToolButton;
|
||||
class CLineEditWithBt : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Option{
|
||||
GetFile = 0,
|
||||
GetPath = 1
|
||||
};
|
||||
|
||||
CLineEditWithBt(QWidget *parent = 0, const QString& filePath = "", Option option = GetFile);
|
||||
~CLineEditWithBt();
|
||||
|
||||
void setText(const QString& text);
|
||||
QString text();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private slots:
|
||||
void getFilePath();
|
||||
void setFilePath(const QString& name);
|
||||
|
||||
private:
|
||||
QString m_filePath;
|
||||
Option m_option;
|
||||
QLineEdit *m_edit;
|
||||
QToolButton *m_button;
|
||||
};
|
||||
|
||||
#endif // CLINEEDITWITHBT_H
|
||||
#ifndef CLINEEDITWITHBT_H
|
||||
#define CLINEEDITWITHBT_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLineEdit;
|
||||
class QToolButton;
|
||||
class CLineEditWithBt : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Option{
|
||||
GetFile = 0,
|
||||
GetPath = 1
|
||||
};
|
||||
|
||||
CLineEditWithBt(QWidget *parent = 0, const QString& filePath = "", Option option = GetFile);
|
||||
~CLineEditWithBt();
|
||||
|
||||
void setText(const QString& text);
|
||||
QString text();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private slots:
|
||||
void getFilePath();
|
||||
void setFilePath(const QString& name);
|
||||
|
||||
private:
|
||||
QString m_filePath;
|
||||
Option m_option;
|
||||
QLineEdit *m_edit;
|
||||
QToolButton *m_button;
|
||||
};
|
||||
|
||||
#endif // CLINEEDITWITHBT_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,83 +1,83 @@
|
||||
#ifndef CNAVIGATIONDIALOG_H
|
||||
#define CNAVIGATIONDIALOG_H
|
||||
|
||||
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
||||
#include "model_excel/xlsx/xlsxdocument.h"
|
||||
#include "pub_widget/CustomMainWindow.h"
|
||||
|
||||
namespace Ui {
|
||||
class CNavigationDialog;
|
||||
}
|
||||
|
||||
extern const int Item_Role; //< 节点数-仅导入使用
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class CNavigationDialog : public CustomUiMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CNavigationDialog(QWidget *parent = 0);
|
||||
~CNavigationDialog();
|
||||
|
||||
public slots:
|
||||
void setColumnWidth(int col, int width);
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
void setTextAlignment(QTreeWidgetItem *item);
|
||||
void makeTree(const QMap<QString, ST_NODE> &btMap,
|
||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||
void addChildLevelItem(QTreeWidgetItem *item, const QPair<int, ST_NODE> &node,
|
||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||
QTreeWidgetItem* getAddLevelItem(const ST_NODE& st_node);
|
||||
void getSaveMap(QMap<QString, ST_NODE> &btMap,
|
||||
QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||
void getSaveNavMap(QTreeWidgetItem *item, int key, int &count,
|
||||
QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||
void getSaveStNode(QTreeWidgetItem *item,
|
||||
ST_NODE &st_node);
|
||||
void addChildItemByImport(const QList<int> &parents, QTreeWidgetItem *item);
|
||||
QString checkTreeValid();
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void slotItemChanged(QTreeWidgetItem *item, int column);
|
||||
void onAddClicked();
|
||||
void onUpAddClicked();
|
||||
void onDeleteClicked();
|
||||
void onClearClicked();
|
||||
void onMoveUpClicked();
|
||||
void onMoveDownClicked();
|
||||
void onConfirmClicked();
|
||||
void onCancelClicked();
|
||||
void onExport();
|
||||
void onImport();
|
||||
|
||||
private:
|
||||
int findValue(const QMap<QString,int> &map, const QString &key);
|
||||
QString getEnableStr(const int &value);
|
||||
QString getTypeStr(const int &value);
|
||||
int getEnable(const QString &value);
|
||||
int getType(const QString &value);
|
||||
QMap<int, QString> makePathMap();
|
||||
QString hexTo26(int number);
|
||||
void xlsxWrite(QXlsx::Document &xlsx, int &row,
|
||||
const QString &topName,
|
||||
const QString &firName,
|
||||
const QString &secName,
|
||||
const QString &thirdName,
|
||||
const ST_NODE &st_node);
|
||||
|
||||
private:
|
||||
Ui::CNavigationDialog *ui;
|
||||
CJsonOpt *m_pJsonOpt;
|
||||
int m_itemIndex;
|
||||
QString m_strFileHomePath;
|
||||
QMap<int, QString> m_mapEnable;
|
||||
QMap<int, QString> m_mapType;
|
||||
};
|
||||
|
||||
#endif // CNAVIGATIONDIALOG_H
|
||||
#ifndef CNAVIGATIONDIALOG_H
|
||||
#define CNAVIGATIONDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
||||
#include "model_excel/xlsx/xlsxdocument.h"
|
||||
|
||||
namespace Ui {
|
||||
class CNavigationDialog;
|
||||
}
|
||||
|
||||
extern const int Item_Role; //< 节点数-仅导入使用
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class CNavigationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CNavigationDialog(QWidget *parent = 0);
|
||||
~CNavigationDialog();
|
||||
|
||||
public slots:
|
||||
void setColumnWidth(int col, int width);
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
void setTextAlignment(QTreeWidgetItem *item);
|
||||
void makeTree(const QMap<QString, ST_NODE> &btMap,
|
||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||
void addChildLevelItem(QTreeWidgetItem *item, const QPair<int, ST_NODE> &node,
|
||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||
QTreeWidgetItem* getAddLevelItem(const ST_NODE& st_node);
|
||||
void getSaveMap(QMap<QString, ST_NODE> &btMap,
|
||||
QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||
void getSaveNavMap(QTreeWidgetItem *item, int key, int &count,
|
||||
QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||
void getSaveStNode(QTreeWidgetItem *item,
|
||||
ST_NODE &st_node);
|
||||
void addChildItemByImport(const QList<int> &parents, QTreeWidgetItem *item);
|
||||
QString checkTreeValid();
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void slotItemChanged(QTreeWidgetItem *item, int column);
|
||||
void onAddClicked();
|
||||
void onUpAddClicked();
|
||||
void onDeleteClicked();
|
||||
void onClearClicked();
|
||||
void onMoveUpClicked();
|
||||
void onMoveDownClicked();
|
||||
void onConfirmClicked();
|
||||
void onCancelClicked();
|
||||
void onExport();
|
||||
void onImport();
|
||||
|
||||
private:
|
||||
int findValue(const QMap<QString,int> &map, const QString &key);
|
||||
QString getEnableStr(const int &value);
|
||||
QString getTypeStr(const int &value);
|
||||
int getEnable(const QString &value);
|
||||
int getType(const QString &value);
|
||||
QMap<int, QString> makePathMap();
|
||||
QString hexTo26(int number);
|
||||
void xlsxWrite(QXlsx::Document &xlsx, int &row,
|
||||
const QString &topName,
|
||||
const QString &firName,
|
||||
const QString &secName,
|
||||
const QString &thirdName,
|
||||
const ST_NODE &st_node);
|
||||
|
||||
private:
|
||||
Ui::CNavigationDialog *ui;
|
||||
CJsonOpt *m_pJsonOpt;
|
||||
int m_itemIndex;
|
||||
QString m_strFileHomePath;
|
||||
QMap<int, QString> m_mapEnable;
|
||||
QMap<int, QString> m_mapType;
|
||||
};
|
||||
|
||||
#endif // CNAVIGATIONDIALOG_H
|
||||
|
||||
@ -1,269 +1,279 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CNavigationDialog</class>
|
||||
<widget class="QMainWindow" name="CNavigationDialog">
|
||||
<widget class="QDialog" name="CNavigationDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
<width>1087</width>
|
||||
<height>673</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>导航栏配置工具</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_add">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>添加节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_upAdd">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>添加子节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∟</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_delete">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>删除节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_clear">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>清空节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>×</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_moveUp">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>上移节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>↑</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_moveDown">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>下移节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>↓</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>484</width>
|
||||
<height>17</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_import">
|
||||
<property name="text">
|
||||
<string>导入</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_export">
|
||||
<property name="text">
|
||||
<string>导出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="CTreeWidget" name="m_treeWidget">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_add">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_confirm">
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_cancel">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>添加节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_upAdd">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>添加子节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>∟</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_delete">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>删除节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_clear">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>清空节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>×</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_moveUp">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>上移节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>↑</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_moveDown">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>下移节点</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>↓</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>484</width>
|
||||
<height>17</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_import">
|
||||
<property name="text">
|
||||
<string>导入</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_export">
|
||||
<property name="text">
|
||||
<string>导出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="CTreeWidget" name="m_treeWidget">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_confirm">
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_cancel">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
||||
@ -1,145 +1,145 @@
|
||||
#include "CTreeItemDelegate.h"
|
||||
#include "CLineEditWithBt.h"
|
||||
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
|
||||
CTreeItemDelegate::CTreeItemDelegate(QObject *parent, DelegateWidget type)
|
||||
: QStyledItemDelegate(parent),
|
||||
m_type(type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CTreeItemDelegate::~CTreeItemDelegate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CTreeItemDelegate::setComboMap(const QMap<int, QString> &map)
|
||||
{
|
||||
m_mapComboBox = map;
|
||||
}
|
||||
|
||||
void CTreeItemDelegate::setFilePath(const QString &path)
|
||||
{
|
||||
m_strFilePath = path;
|
||||
}
|
||||
|
||||
QWidget *CTreeItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
switch(m_type){
|
||||
case ReadOnly:
|
||||
return NULL;
|
||||
case LineEdit:
|
||||
return new QLineEdit(parent);
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *box= new QComboBox(parent);
|
||||
QMap<int, QString>::const_iterator iter
|
||||
= m_mapComboBox.constBegin();
|
||||
for(; iter != m_mapComboBox.constEnd(); iter ++)
|
||||
{
|
||||
if(iter.value() == tr("切换导航") && index.parent() != QModelIndex())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(iter.value() == tr("加载网页") && index.parent() == QModelIndex())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
box->addItem(iter.value(), iter.key());
|
||||
}
|
||||
return box;
|
||||
}
|
||||
case PicFile:
|
||||
{
|
||||
const QAbstractItemModel *model = index.model();
|
||||
if(model)
|
||||
{
|
||||
//< tr("操作")
|
||||
int type = model->index(index.row(), 2, index.parent()).data(Qt::UserRole).toInt();
|
||||
QString path = m_mapComboBox.value(type, "");
|
||||
if(path.isEmpty())
|
||||
{
|
||||
return new CLineEditWithBt(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CLineEditWithBt(parent, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
case IconFile:
|
||||
{
|
||||
return new CLineEditWithBt(parent, m_strFilePath);
|
||||
}
|
||||
default:
|
||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTreeItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||
{
|
||||
switch(m_type){
|
||||
case LineEdit:
|
||||
{
|
||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||
break;
|
||||
}
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||
comb->setCurrentIndex(comb->findText(index.data(Qt::DisplayRole).toString()));
|
||||
break;
|
||||
}
|
||||
case PicFile:
|
||||
case IconFile:
|
||||
{
|
||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QStyledItemDelegate::setEditorData(editor, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTreeItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||
{
|
||||
switch (m_type) {
|
||||
case LineEdit:
|
||||
{
|
||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||
break;
|
||||
}
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||
if(model->data(index, Qt::DisplayRole) != comb->currentText())
|
||||
{
|
||||
model->setData(index, comb->currentText(), Qt::DisplayRole);
|
||||
model->setData(index, comb->currentData().toInt(), Qt::UserRole);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PicFile:
|
||||
case IconFile:
|
||||
{
|
||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||
model->setData(index, edit->text(), Qt::UserRole);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTreeItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
#include "CTreeItemDelegate.h"
|
||||
#include "CLineEditWithBt.h"
|
||||
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
|
||||
CTreeItemDelegate::CTreeItemDelegate(QObject *parent, DelegateWidget type)
|
||||
: QStyledItemDelegate(parent),
|
||||
m_type(type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CTreeItemDelegate::~CTreeItemDelegate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CTreeItemDelegate::setComboMap(const QMap<int, QString> &map)
|
||||
{
|
||||
m_mapComboBox = map;
|
||||
}
|
||||
|
||||
void CTreeItemDelegate::setFilePath(const QString &path)
|
||||
{
|
||||
m_strFilePath = path;
|
||||
}
|
||||
|
||||
QWidget *CTreeItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
switch(m_type){
|
||||
case ReadOnly:
|
||||
return NULL;
|
||||
case LineEdit:
|
||||
return new QLineEdit(parent);
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *box= new QComboBox(parent);
|
||||
QMap<int, QString>::const_iterator iter
|
||||
= m_mapComboBox.constBegin();
|
||||
for(; iter != m_mapComboBox.constEnd(); iter ++)
|
||||
{
|
||||
if(iter.value() == tr("切换导航") && index.parent() != QModelIndex())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(iter.value() == tr("加载网页") && index.parent() == QModelIndex())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
box->addItem(iter.value(), iter.key());
|
||||
}
|
||||
return box;
|
||||
}
|
||||
case PicFile:
|
||||
{
|
||||
const QAbstractItemModel *model = index.model();
|
||||
if(model)
|
||||
{
|
||||
//< tr("操作")
|
||||
int type = model->index(index.row(), 2, index.parent()).data(Qt::UserRole).toInt();
|
||||
QString path = m_mapComboBox.value(type, "");
|
||||
if(path.isEmpty())
|
||||
{
|
||||
return new CLineEditWithBt(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CLineEditWithBt(parent, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
case IconFile:
|
||||
{
|
||||
return new CLineEditWithBt(parent, m_strFilePath);
|
||||
}
|
||||
default:
|
||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTreeItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||
{
|
||||
switch(m_type){
|
||||
case LineEdit:
|
||||
{
|
||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||
break;
|
||||
}
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||
comb->setCurrentIndex(comb->findText(index.data(Qt::DisplayRole).toString()));
|
||||
break;
|
||||
}
|
||||
case PicFile:
|
||||
case IconFile:
|
||||
{
|
||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QStyledItemDelegate::setEditorData(editor, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTreeItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||
{
|
||||
switch (m_type) {
|
||||
case LineEdit:
|
||||
{
|
||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||
break;
|
||||
}
|
||||
case ComboBox:
|
||||
{
|
||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||
if(model->data(index, Qt::DisplayRole) != comb->currentText())
|
||||
{
|
||||
model->setData(index, comb->currentText(), Qt::DisplayRole);
|
||||
model->setData(index, comb->currentData().toInt(), Qt::UserRole);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PicFile:
|
||||
case IconFile:
|
||||
{
|
||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||
model->setData(index, edit->text(), Qt::UserRole);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTreeItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
|
||||
@ -1,52 +1,52 @@
|
||||
#ifndef CTREEITEMDELEGATE_H
|
||||
#define CTREEITEMDELEGATE_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
class CTreeItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum DelegateWidget{
|
||||
ReadOnly = 0,
|
||||
LineEdit = 1,
|
||||
ComboBox = 2,
|
||||
PicFile = 3,
|
||||
IconFile = 4
|
||||
};
|
||||
|
||||
CTreeItemDelegate(QObject *parent = 0, DelegateWidget type = LineEdit);
|
||||
~CTreeItemDelegate();
|
||||
|
||||
/**
|
||||
* @brief setComboMap DelegateWidget::ComboBox/PicFile/IconFile 有效
|
||||
* @param map
|
||||
*/
|
||||
void setComboMap(const QMap<int, QString> &map);
|
||||
|
||||
/**
|
||||
* @brief setFilePath DelegateWidget::IconFile 有效
|
||||
* @param path
|
||||
*/
|
||||
void setFilePath(const QString &path);
|
||||
|
||||
QWidget *createEditor(QWidget *parent,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
void setModelData(QWidget *editor,
|
||||
QAbstractItemModel *model,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
void updateEditorGeometry(QWidget *editor,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
DelegateWidget m_type;
|
||||
QMap<int, QString> m_mapComboBox;
|
||||
QString m_strFilePath;
|
||||
};
|
||||
|
||||
#endif // CTREEITEMDELEGATE_H
|
||||
#ifndef CTREEITEMDELEGATE_H
|
||||
#define CTREEITEMDELEGATE_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
class CTreeItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum DelegateWidget{
|
||||
ReadOnly = 0,
|
||||
LineEdit = 1,
|
||||
ComboBox = 2,
|
||||
PicFile = 3,
|
||||
IconFile = 4
|
||||
};
|
||||
|
||||
CTreeItemDelegate(QObject *parent = 0, DelegateWidget type = LineEdit);
|
||||
~CTreeItemDelegate();
|
||||
|
||||
/**
|
||||
* @brief setComboMap DelegateWidget::ComboBox/PicFile/IconFile 有效
|
||||
* @param map
|
||||
*/
|
||||
void setComboMap(const QMap<int, QString> &map);
|
||||
|
||||
/**
|
||||
* @brief setFilePath DelegateWidget::IconFile 有效
|
||||
* @param path
|
||||
*/
|
||||
void setFilePath(const QString &path);
|
||||
|
||||
QWidget *createEditor(QWidget *parent,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
void setModelData(QWidget *editor,
|
||||
QAbstractItemModel *model,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
void updateEditorGeometry(QWidget *editor,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
DelegateWidget m_type;
|
||||
QMap<int, QString> m_mapComboBox;
|
||||
QString m_strFilePath;
|
||||
};
|
||||
|
||||
#endif // CTREEITEMDELEGATE_H
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
#include "CTreeWidget.h"
|
||||
#include <QMouseEvent>
|
||||
|
||||
CTreeWidget::CTreeWidget(QWidget *parent)
|
||||
: QTreeWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CTreeWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
QTreeWidget::mousePressEvent(event);
|
||||
QModelIndex modelIndex = indexAt(event->pos());
|
||||
if(!modelIndex.isValid())
|
||||
{
|
||||
setCurrentIndex(QModelIndex());
|
||||
}
|
||||
}
|
||||
#include "CTreeWidget.h"
|
||||
#include <QMouseEvent>
|
||||
|
||||
CTreeWidget::CTreeWidget(QWidget *parent)
|
||||
: QTreeWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CTreeWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
QTreeWidget::mousePressEvent(event);
|
||||
QModelIndex modelIndex = indexAt(event->pos());
|
||||
if(!modelIndex.isValid())
|
||||
{
|
||||
setCurrentIndex(QModelIndex());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
#ifndef CTREEWIDGET_H
|
||||
#define CTREEWIDGET_H
|
||||
|
||||
#include <QTreeWidget>
|
||||
|
||||
class CTreeWidget : public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CTreeWidget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
};
|
||||
|
||||
#endif // CTREEWIDGET_H
|
||||
#ifndef CTREEWIDGET_H
|
||||
#define CTREEWIDGET_H
|
||||
|
||||
#include <QTreeWidget>
|
||||
|
||||
class CTreeWidget : public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CTreeWidget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
};
|
||||
|
||||
#endif // CTREEWIDGET_H
|
||||
|
||||
@ -1,56 +1,55 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2021-04-08T17:00:16
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = NavigationTool
|
||||
TEMPLATE = app
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
CNavigationDialog.cpp \
|
||||
CTreeItemDelegate.cpp \
|
||||
CLineEditWithBt.cpp \
|
||||
CTreeWidget.cpp
|
||||
|
||||
HEADERS += \
|
||||
CNavigationDialog.h \
|
||||
CTreeItemDelegate.h \
|
||||
CLineEditWithBt.h \
|
||||
../../../include/gui/GraphTool/NavigationApi/CJsonOpt.h \
|
||||
CTreeWidget.h
|
||||
|
||||
FORMS += \
|
||||
CNavigationDialog.ui
|
||||
|
||||
LIBS += \
|
||||
-llog4cplus \
|
||||
-lpub_logger_api \
|
||||
-lpub_utility_api \
|
||||
-lmodel_excel \
|
||||
-lNavigationApi \
|
||||
-lpub_widget
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2021-04-08T17:00:16
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = NavigationTool
|
||||
TEMPLATE = app
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
CNavigationDialog.cpp \
|
||||
CTreeItemDelegate.cpp \
|
||||
CLineEditWithBt.cpp \
|
||||
CTreeWidget.cpp
|
||||
|
||||
HEADERS += \
|
||||
CNavigationDialog.h \
|
||||
CTreeItemDelegate.h \
|
||||
CLineEditWithBt.h \
|
||||
../../../include/gui/GraphTool/NavigationApi/CJsonOpt.h \
|
||||
CTreeWidget.h
|
||||
|
||||
FORMS += \
|
||||
CNavigationDialog.ui
|
||||
|
||||
LIBS += \
|
||||
-llog4cplus \
|
||||
-lpub_logger_api \
|
||||
-lpub_utility_api \
|
||||
-lmodel_excel \
|
||||
-lNavigationApi
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
|
||||
@ -1,43 +1,15 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "common/QtAppGlobalSet.h"
|
||||
#include "CNavigationDialog.h"
|
||||
#include "pub_utility_api/FileStyle.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
iot_common::doQtAppGlobalSet();
|
||||
|
||||
QApplication a(argc, argv);
|
||||
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("NavigationTool.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);
|
||||
}
|
||||
|
||||
// qApp->setFont(QFont("Microsoft YaHei",10));
|
||||
|
||||
CNavigationDialog w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
#include <QApplication>
|
||||
#include "common/QtAppGlobalSet.h"
|
||||
#include "CNavigationDialog.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
kbd_common::doQtAppGlobalSet();
|
||||
|
||||
QApplication a(argc, argv);
|
||||
CNavigationDialog w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
@ -1,334 +1,334 @@
|
||||
#include "CConfirmDialog.h"
|
||||
#include "ui_CConfirmDialog.h"
|
||||
|
||||
CConfirmDialog::CConfirmDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CConfirmDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags()&~Qt::WindowContextHelpButtonHint);
|
||||
initTable();
|
||||
}
|
||||
|
||||
CConfirmDialog::~CConfirmDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CConfirmDialog::setNameMap(const QMap<QString, QString> &nameMap)
|
||||
{
|
||||
m_nameMap = nameMap;
|
||||
initTableData();
|
||||
}
|
||||
|
||||
void CConfirmDialog::setRootPath(const QString &path)
|
||||
{
|
||||
m_strRoot = path;
|
||||
}
|
||||
|
||||
void CConfirmDialog::getAllPath(QStringList& path)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it = m_nameMap.begin();
|
||||
for(;it!=m_nameMap.end();++it)
|
||||
{
|
||||
#ifdef WIN32
|
||||
path.append(m_strRoot + "\\" + it.key());
|
||||
#else
|
||||
path.append(m_strRoot + "/" + it.key());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getMessage()
|
||||
{
|
||||
return ui->m_msgEdit->toPlainText();
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrByState(enFirstColums state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case FIRST_NO_CHANGED:
|
||||
{
|
||||
ret = tr("无修改");
|
||||
break;
|
||||
}
|
||||
case FIRST_ADD:
|
||||
{
|
||||
ret = tr("添加");
|
||||
break;
|
||||
}
|
||||
case FIRST_CONFLICTED:
|
||||
{
|
||||
ret = tr("冲突");
|
||||
break;
|
||||
}
|
||||
case FIRST_DELETED:
|
||||
{
|
||||
ret = tr("删除");
|
||||
break;
|
||||
}
|
||||
case FIRST_IGNORED:
|
||||
{
|
||||
ret = tr("忽略");
|
||||
break;
|
||||
}
|
||||
case FIRST_MODIFIED:
|
||||
{
|
||||
ret = tr("修改");
|
||||
break;
|
||||
}
|
||||
case FIRST_REPLACED:
|
||||
{
|
||||
ret = tr("替换");
|
||||
break;
|
||||
}
|
||||
case FIRST_EXTERNALS_DEFINE:
|
||||
{
|
||||
ret = tr("未纳入版本控制的目录,被外部引用的目录所创建");
|
||||
break;
|
||||
}
|
||||
case FIRST_NOT_VERSION_CONTROL:
|
||||
{
|
||||
ret = tr("未纳入版本控制");
|
||||
break;
|
||||
}
|
||||
case FIRST_MISS:
|
||||
{
|
||||
ret = tr("遗失");
|
||||
break;
|
||||
}
|
||||
case FIRST_OBSTRUCTED:
|
||||
{
|
||||
ret = tr("重名");
|
||||
break;
|
||||
}
|
||||
case FIRST_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrBySecond(enSecondColumn state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case SECOND_NO_CHANGED:
|
||||
{
|
||||
ret = tr("无修改");
|
||||
break;
|
||||
}
|
||||
case SECOND_CONFLICTED:
|
||||
{
|
||||
ret = tr("冲突");
|
||||
break;
|
||||
}
|
||||
case SECOND_MODIFIED:
|
||||
{
|
||||
ret = tr("改变");
|
||||
break;
|
||||
}
|
||||
case SECOND_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrByThird(enThirdColumns state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case THIRD_NOT_LOCKED:
|
||||
{
|
||||
ret = tr("未锁定");
|
||||
break;
|
||||
}
|
||||
case THIRD_LOCKED:
|
||||
{
|
||||
ret = tr("锁定");
|
||||
break;
|
||||
}
|
||||
case THIRD_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrByFourth(enFourthColumn state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case FOURTH_NOT_HISTORY:
|
||||
{
|
||||
ret = tr("没有历史");
|
||||
break;
|
||||
}
|
||||
case FOURTH_CONTAIN_HISTORY:
|
||||
{
|
||||
ret = tr("包含历史");
|
||||
break;
|
||||
}
|
||||
case FOURTH_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrByFifth(enFifthColumn state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case FIFTH_NORMAL:
|
||||
{
|
||||
ret = tr("正常");
|
||||
break;
|
||||
}
|
||||
case FIFTH_SWICTCH:
|
||||
{
|
||||
ret = tr("以切换");
|
||||
break;
|
||||
}
|
||||
case FIFTH_EXTERNAL_REFER_CREATE:
|
||||
{
|
||||
ret = tr("被外部引用创建的文件");
|
||||
break;
|
||||
}
|
||||
case FIFTH_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrBySixth(enSixthColumn state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case SIXTH_NOT_LOCKED:
|
||||
{
|
||||
ret = tr("没有被锁定标记");
|
||||
break;
|
||||
}
|
||||
case SIXTH_LOCKED:
|
||||
{
|
||||
ret = tr("存在锁定标记");
|
||||
break;
|
||||
}
|
||||
case SIXTH_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrBySeventh(enSeventhColumn state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case SEVENTH_NORMAL:
|
||||
{
|
||||
ret = tr("正常");
|
||||
break;
|
||||
}
|
||||
case SEVENTH_TREE_CONFFLICT:
|
||||
{
|
||||
ret = tr("树冲突");
|
||||
break;
|
||||
}
|
||||
case SEVENTH_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CConfirmDialog::initTable()
|
||||
{
|
||||
ui->m_table->setColumnCount(2);
|
||||
ui->m_table->setHorizontalHeaderLabels(QStringList() << tr("名称") << tr("状态"));
|
||||
ui->m_table->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
|
||||
ui->m_table->horizontalHeader()->setStretchLastSection(true);
|
||||
ui->m_table->verticalHeader()->hide();
|
||||
ui->m_table->setColumnWidth(0,200);
|
||||
ui->m_table->setEditTriggers(0);
|
||||
ui->m_table->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
}
|
||||
|
||||
void CConfirmDialog::initTableData()
|
||||
{
|
||||
int rowCount = m_nameMap.size();
|
||||
ui->m_table->setRowCount(rowCount);
|
||||
QMap<QString, QString>::const_iterator it = m_nameMap.begin();
|
||||
for(int row=0;it!=m_nameMap.end();++it,++row)
|
||||
{
|
||||
QTableWidgetItem *name = new QTableWidgetItem(it.key());
|
||||
QTableWidgetItem *state = new QTableWidgetItem(it.value());
|
||||
ui->m_table->setItem(row, 0, name);
|
||||
ui->m_table->setItem(row, 1, state);
|
||||
ui->m_table->item(row,0)->setData(5,it.value());
|
||||
ui->m_table->item(row,0)->setCheckState(Qt::Checked);
|
||||
}
|
||||
connect(ui->m_table,SIGNAL(cellChanged(int,int)),this,SLOT(slot_cellChange(int,int)));
|
||||
}
|
||||
|
||||
void CConfirmDialog::slot_cellChange(int row, int column)
|
||||
{
|
||||
if(ui->m_table->item(row,column)->checkState() == Qt::Checked)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it = m_nameMap.find(ui->m_table->item(row,0)->text());
|
||||
if(it == m_nameMap.end())
|
||||
{
|
||||
m_nameMap.insert(ui->m_table->item(row,0)->text(), ui->m_table->item(row,1)->text());
|
||||
}
|
||||
}
|
||||
else if(ui->m_table->item(row,column)->checkState() == Qt::Unchecked)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it = m_nameMap.find(ui->m_table->item(row,0)->text());
|
||||
if(it != m_nameMap.end())
|
||||
{
|
||||
m_nameMap.remove(ui->m_table->item(row,0)->text());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CConfirmDialog::on_m_confirmBtn_clicked()
|
||||
{
|
||||
accept();
|
||||
}
|
||||
|
||||
void CConfirmDialog::on_m_cancelBtn_clicked()
|
||||
{
|
||||
reject();
|
||||
}
|
||||
#include "CConfirmDialog.h"
|
||||
#include "ui_CConfirmDialog.h"
|
||||
|
||||
CConfirmDialog::CConfirmDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CConfirmDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags()&~Qt::WindowContextHelpButtonHint);
|
||||
initTable();
|
||||
}
|
||||
|
||||
CConfirmDialog::~CConfirmDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CConfirmDialog::setNameMap(const QMap<QString, QString> &nameMap)
|
||||
{
|
||||
m_nameMap = nameMap;
|
||||
initTableData();
|
||||
}
|
||||
|
||||
void CConfirmDialog::setRootPath(const QString &path)
|
||||
{
|
||||
m_strRoot = path;
|
||||
}
|
||||
|
||||
void CConfirmDialog::getAllPath(QStringList& path)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it = m_nameMap.begin();
|
||||
for(;it!=m_nameMap.end();++it)
|
||||
{
|
||||
#ifdef WIN32
|
||||
path.append(m_strRoot + "\\" + it.key());
|
||||
#else
|
||||
path.append(m_strRoot + "/" + it.key());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getMessage()
|
||||
{
|
||||
return ui->m_msgEdit->toPlainText();
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrByState(enFirstColums state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case FIRST_NO_CHANGED:
|
||||
{
|
||||
ret = tr("无修改");
|
||||
break;
|
||||
}
|
||||
case FIRST_ADD:
|
||||
{
|
||||
ret = tr("添加");
|
||||
break;
|
||||
}
|
||||
case FIRST_CONFLICTED:
|
||||
{
|
||||
ret = tr("冲突");
|
||||
break;
|
||||
}
|
||||
case FIRST_DELETED:
|
||||
{
|
||||
ret = tr("删除");
|
||||
break;
|
||||
}
|
||||
case FIRST_IGNORED:
|
||||
{
|
||||
ret = tr("忽略");
|
||||
break;
|
||||
}
|
||||
case FIRST_MODIFIED:
|
||||
{
|
||||
ret = tr("修改");
|
||||
break;
|
||||
}
|
||||
case FIRST_REPLACED:
|
||||
{
|
||||
ret = tr("替换");
|
||||
break;
|
||||
}
|
||||
case FIRST_EXTERNALS_DEFINE:
|
||||
{
|
||||
ret = tr("未纳入版本控制的目录,被外部引用的目录所创建");
|
||||
break;
|
||||
}
|
||||
case FIRST_NOT_VERSION_CONTROL:
|
||||
{
|
||||
ret = tr("未纳入版本控制");
|
||||
break;
|
||||
}
|
||||
case FIRST_MISS:
|
||||
{
|
||||
ret = tr("遗失");
|
||||
break;
|
||||
}
|
||||
case FIRST_OBSTRUCTED:
|
||||
{
|
||||
ret = tr("重名");
|
||||
break;
|
||||
}
|
||||
case FIRST_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrBySecond(enSecondColumn state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case SECOND_NO_CHANGED:
|
||||
{
|
||||
ret = tr("无修改");
|
||||
break;
|
||||
}
|
||||
case SECOND_CONFLICTED:
|
||||
{
|
||||
ret = tr("冲突");
|
||||
break;
|
||||
}
|
||||
case SECOND_MODIFIED:
|
||||
{
|
||||
ret = tr("改变");
|
||||
break;
|
||||
}
|
||||
case SECOND_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrByThird(enThirdColumns state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case THIRD_NOT_LOCKED:
|
||||
{
|
||||
ret = tr("未锁定");
|
||||
break;
|
||||
}
|
||||
case THIRD_LOCKED:
|
||||
{
|
||||
ret = tr("锁定");
|
||||
break;
|
||||
}
|
||||
case THIRD_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrByFourth(enFourthColumn state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case FOURTH_NOT_HISTORY:
|
||||
{
|
||||
ret = tr("没有历史");
|
||||
break;
|
||||
}
|
||||
case FOURTH_CONTAIN_HISTORY:
|
||||
{
|
||||
ret = tr("包含历史");
|
||||
break;
|
||||
}
|
||||
case FOURTH_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrByFifth(enFifthColumn state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case FIFTH_NORMAL:
|
||||
{
|
||||
ret = tr("正常");
|
||||
break;
|
||||
}
|
||||
case FIFTH_SWICTCH:
|
||||
{
|
||||
ret = tr("以切换");
|
||||
break;
|
||||
}
|
||||
case FIFTH_EXTERNAL_REFER_CREATE:
|
||||
{
|
||||
ret = tr("被外部引用创建的文件");
|
||||
break;
|
||||
}
|
||||
case FIFTH_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrBySixth(enSixthColumn state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case SIXTH_NOT_LOCKED:
|
||||
{
|
||||
ret = tr("没有被锁定标记");
|
||||
break;
|
||||
}
|
||||
case SIXTH_LOCKED:
|
||||
{
|
||||
ret = tr("存在锁定标记");
|
||||
break;
|
||||
}
|
||||
case SIXTH_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString CConfirmDialog::getStrBySeventh(enSeventhColumn state)
|
||||
{
|
||||
QString ret;
|
||||
switch (state) {
|
||||
case SEVENTH_NORMAL:
|
||||
{
|
||||
ret = tr("正常");
|
||||
break;
|
||||
}
|
||||
case SEVENTH_TREE_CONFFLICT:
|
||||
{
|
||||
ret = tr("树冲突");
|
||||
break;
|
||||
}
|
||||
case SEVENTH_ILLEGAL:
|
||||
{
|
||||
ret = tr("自定义非法状态");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CConfirmDialog::initTable()
|
||||
{
|
||||
ui->m_table->setColumnCount(2);
|
||||
ui->m_table->setHorizontalHeaderLabels(QStringList() << tr("名称") << tr("状态"));
|
||||
ui->m_table->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
|
||||
ui->m_table->horizontalHeader()->setStretchLastSection(true);
|
||||
ui->m_table->verticalHeader()->hide();
|
||||
ui->m_table->setColumnWidth(0,200);
|
||||
ui->m_table->setEditTriggers(0);
|
||||
ui->m_table->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
}
|
||||
|
||||
void CConfirmDialog::initTableData()
|
||||
{
|
||||
int rowCount = m_nameMap.size();
|
||||
ui->m_table->setRowCount(rowCount);
|
||||
QMap<QString, QString>::const_iterator it = m_nameMap.begin();
|
||||
for(int row=0;it!=m_nameMap.end();++it,++row)
|
||||
{
|
||||
QTableWidgetItem *name = new QTableWidgetItem(it.key());
|
||||
QTableWidgetItem *state = new QTableWidgetItem(it.value());
|
||||
ui->m_table->setItem(row, 0, name);
|
||||
ui->m_table->setItem(row, 1, state);
|
||||
ui->m_table->item(row,0)->setData(5,it.value());
|
||||
ui->m_table->item(row,0)->setCheckState(Qt::Checked);
|
||||
}
|
||||
connect(ui->m_table,SIGNAL(cellChanged(int,int)),this,SLOT(slot_cellChange(int,int)));
|
||||
}
|
||||
|
||||
void CConfirmDialog::slot_cellChange(int row, int column)
|
||||
{
|
||||
if(ui->m_table->item(row,column)->checkState() == Qt::Checked)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it = m_nameMap.find(ui->m_table->item(row,0)->text());
|
||||
if(it == m_nameMap.end())
|
||||
{
|
||||
m_nameMap.insert(ui->m_table->item(row,0)->text(), ui->m_table->item(row,1)->text());
|
||||
}
|
||||
}
|
||||
else if(ui->m_table->item(row,column)->checkState() == Qt::Unchecked)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it = m_nameMap.find(ui->m_table->item(row,0)->text());
|
||||
if(it != m_nameMap.end())
|
||||
{
|
||||
m_nameMap.remove(ui->m_table->item(row,0)->text());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CConfirmDialog::on_m_confirmBtn_clicked()
|
||||
{
|
||||
accept();
|
||||
}
|
||||
|
||||
void CConfirmDialog::on_m_cancelBtn_clicked()
|
||||
{
|
||||
reject();
|
||||
}
|
||||
|
||||
@ -1,48 +1,48 @@
|
||||
#ifndef CCONFIRMDIALOG_H
|
||||
#define CCONFIRMDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
#include "../../include/sys/sys_svn_file_sync_api/CSysFileSyncApi.h"
|
||||
|
||||
namespace Ui {
|
||||
class CConfirmDialog;
|
||||
}
|
||||
|
||||
using namespace iot_sys;
|
||||
class CConfirmDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CConfirmDialog(QWidget *parent = 0);
|
||||
~CConfirmDialog();
|
||||
|
||||
void setNameMap(const QMap<QString, QString> &nameMap);
|
||||
void setRootPath(const QString& path);
|
||||
void getAllPath(QStringList &path);
|
||||
QString getMessage();
|
||||
static QString getStrByState(enFirstColums state);
|
||||
static QString getStrBySecond(enSecondColumn state);
|
||||
static QString getStrByThird(enThirdColumns state);
|
||||
static QString getStrByFourth(enFourthColumn state);
|
||||
static QString getStrByFifth(enFifthColumn state);
|
||||
static QString getStrBySixth(enSixthColumn state);
|
||||
static QString getStrBySeventh(enSeventhColumn state);
|
||||
|
||||
private slots:
|
||||
void slot_cellChange(int row, int column);
|
||||
void on_m_confirmBtn_clicked();
|
||||
void on_m_cancelBtn_clicked();
|
||||
|
||||
private:
|
||||
void initTable();
|
||||
void initTableData();
|
||||
|
||||
private:
|
||||
Ui::CConfirmDialog *ui;
|
||||
QMap<QString,QString> m_nameMap;
|
||||
QString m_strRoot;
|
||||
};
|
||||
|
||||
#endif // CCONFIRMDIALOG_H
|
||||
#ifndef CCONFIRMDIALOG_H
|
||||
#define CCONFIRMDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
#include "../../include/sys/sys_svn_file_sync_api/CSysFileSyncApi.h"
|
||||
|
||||
namespace Ui {
|
||||
class CConfirmDialog;
|
||||
}
|
||||
|
||||
using namespace kbd_sys;
|
||||
class CConfirmDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CConfirmDialog(QWidget *parent = 0);
|
||||
~CConfirmDialog();
|
||||
|
||||
void setNameMap(const QMap<QString, QString> &nameMap);
|
||||
void setRootPath(const QString& path);
|
||||
void getAllPath(QStringList &path);
|
||||
QString getMessage();
|
||||
static QString getStrByState(enFirstColums state);
|
||||
static QString getStrBySecond(enSecondColumn state);
|
||||
static QString getStrByThird(enThirdColumns state);
|
||||
static QString getStrByFourth(enFourthColumn state);
|
||||
static QString getStrByFifth(enFifthColumn state);
|
||||
static QString getStrBySixth(enSixthColumn state);
|
||||
static QString getStrBySeventh(enSeventhColumn state);
|
||||
|
||||
private slots:
|
||||
void slot_cellChange(int row, int column);
|
||||
void on_m_confirmBtn_clicked();
|
||||
void on_m_cancelBtn_clicked();
|
||||
|
||||
private:
|
||||
void initTable();
|
||||
void initTableData();
|
||||
|
||||
private:
|
||||
Ui::CConfirmDialog *ui;
|
||||
QMap<QString,QString> m_nameMap;
|
||||
QString m_strRoot;
|
||||
};
|
||||
|
||||
#endif // CCONFIRMDIALOG_H
|
||||
|
||||
@ -1,163 +1,163 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CConfirmDialog</class>
|
||||
<widget class="QDialog" name="CConfirmDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>379</width>
|
||||
<height>370</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>提交</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4" rowstretch="1,0,0">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>日志信息:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextEdit" name="m_msgEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="m_table"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>331</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_confirmBtn">
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="m_cancelBtn">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CConfirmDialog</class>
|
||||
<widget class="QDialog" name="CConfirmDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>379</width>
|
||||
<height>370</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>提交</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4" rowstretch="1,0,0">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>日志信息:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextEdit" name="m_msgEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="m_table"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>331</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_confirmBtn">
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="m_cancelBtn">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,85 +1,85 @@
|
||||
#ifndef CFILESYNCDIALOG_H
|
||||
#define CFILESYNCDIALOG_H
|
||||
|
||||
#include "../../include/sys/sys_svn_file_sync_api/CSysFileSyncApi.h"
|
||||
#include <QDialog>
|
||||
#include <QFileInfoList>
|
||||
#include <QDateTime>
|
||||
#include <QMenu>
|
||||
|
||||
namespace Ui {
|
||||
class CFileSyncDialog;
|
||||
}
|
||||
|
||||
enum enOptAction
|
||||
{
|
||||
ACTION_DEFAULT,
|
||||
ACTION_ADD,
|
||||
ACTION_DELETE,
|
||||
ACTION_COMMIT
|
||||
};
|
||||
|
||||
struct stSelectedPath
|
||||
{
|
||||
bool isAllSelect;
|
||||
enOptAction action;
|
||||
QStringList path;
|
||||
};
|
||||
|
||||
using namespace iot_sys;
|
||||
class CFileSyncDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CFileSyncDialog(QDialog *parent = 0);
|
||||
~CFileSyncDialog();
|
||||
|
||||
void getFileNameByPath(const QStringList &path, QStringList& name);
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief webPublish web发布
|
||||
* @param pathList 全路径文件夹
|
||||
* @param isSuccess 是否成功
|
||||
* @param errStr 错误信息,无错为空字符串
|
||||
*/
|
||||
void webPublish(const QStringList& pathList, bool &isSuccess, QString& errStr);
|
||||
|
||||
private slots:
|
||||
void slot_add();
|
||||
void slot_commit();
|
||||
void slot_delete();
|
||||
void slot_allCommit();
|
||||
void on_m_filePathComb_editTextChanged(const QString &arg1);
|
||||
void on_m_selectFileBtn_clicked(); //选择路径
|
||||
void on_m_reloadBtn_clicked(); //重新加载文件
|
||||
void on_m_fileTextTable_customContextMenuRequested(const QPoint &pos);
|
||||
|
||||
private:
|
||||
void initFileTable();
|
||||
void initMenu();
|
||||
void initComb();
|
||||
|
||||
void getFileInfos(const QString &path, QFileInfoList &list); //获取路径下的所有文件信息
|
||||
void getSvnFile(const QString &path, QMap<QString, stFileStatus> &name, QString &error);
|
||||
QString getTimeStr(const QDateTime& time);
|
||||
void updatFileTable(QFileInfoList &list, const QMap<QString, stFileStatus> &svnMap);
|
||||
void fileFilter(QFileInfoList &list, const QMap<QString, stFileStatus> &svnMap);
|
||||
QString getStatusStr(const stFileStatus& st);
|
||||
|
||||
QString getIconByState(enFirstColums status);
|
||||
|
||||
void getSelectsPath(stSelectedPath& stPath); //合并所有选择的文件路径
|
||||
bool checkIsNeedAppend(int row, enOptAction action);
|
||||
void commit(const QStringList &path);
|
||||
void getCommitMap(const QStringList& name, QMap<QString, QString> &map);
|
||||
|
||||
private:
|
||||
Ui::CFileSyncDialog *ui;
|
||||
QMenu *m_menu;
|
||||
CSysFileSyncApi *m_ptrSysFileSync;
|
||||
QStringList m_FileTypeList;
|
||||
};
|
||||
|
||||
#endif // CFILESYNCDIALOG_H
|
||||
#ifndef CFILESYNCDIALOG_H
|
||||
#define CFILESYNCDIALOG_H
|
||||
|
||||
#include "../../include/sys/sys_svn_file_sync_api/CSysFileSyncApi.h"
|
||||
#include <QDialog>
|
||||
#include <QFileInfoList>
|
||||
#include <QDateTime>
|
||||
#include <QMenu>
|
||||
|
||||
namespace Ui {
|
||||
class CFileSyncDialog;
|
||||
}
|
||||
|
||||
enum enOptAction
|
||||
{
|
||||
ACTION_DEFAULT,
|
||||
ACTION_ADD,
|
||||
ACTION_DELETE,
|
||||
ACTION_COMMIT
|
||||
};
|
||||
|
||||
struct stSelectedPath
|
||||
{
|
||||
bool isAllSelect;
|
||||
enOptAction action;
|
||||
QStringList path;
|
||||
};
|
||||
|
||||
using namespace kbd_sys;
|
||||
class CFileSyncDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CFileSyncDialog(QDialog *parent = 0);
|
||||
~CFileSyncDialog();
|
||||
|
||||
void getFileNameByPath(const QStringList &path, QStringList& name);
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief webPublish web发布
|
||||
* @param pathList 全路径文件夹
|
||||
* @param isSuccess 是否成功
|
||||
* @param errStr 错误信息,无错为空字符串
|
||||
*/
|
||||
void webPublish(const QStringList& pathList, bool &isSuccess, QString& errStr);
|
||||
|
||||
private slots:
|
||||
void slot_add();
|
||||
void slot_commit();
|
||||
void slot_delete();
|
||||
void slot_allCommit();
|
||||
void on_m_filePathComb_editTextChanged(const QString &arg1);
|
||||
void on_m_selectFileBtn_clicked(); //选择路径
|
||||
void on_m_reloadBtn_clicked(); //重新加载文件
|
||||
void on_m_fileTextTable_customContextMenuRequested(const QPoint &pos);
|
||||
|
||||
private:
|
||||
void initFileTable();
|
||||
void initMenu();
|
||||
void initComb();
|
||||
|
||||
void getFileInfos(const QString &path, QFileInfoList &list); //获取路径下的所有文件信息
|
||||
void getSvnFile(const QString &path, QMap<QString, stFileStatus> &name, QString &error);
|
||||
QString getTimeStr(const QDateTime& time);
|
||||
void updatFileTable(QFileInfoList &list, const QMap<QString, stFileStatus> &svnMap);
|
||||
void fileFilter(QFileInfoList &list, const QMap<QString, stFileStatus> &svnMap);
|
||||
QString getStatusStr(const stFileStatus& st);
|
||||
|
||||
QString getIconByState(enFirstColums status);
|
||||
|
||||
void getSelectsPath(stSelectedPath& stPath); //合并所有选择的文件路径
|
||||
bool checkIsNeedAppend(int row, enOptAction action);
|
||||
void commit(const QStringList &path);
|
||||
void getCommitMap(const QStringList& name, QMap<QString, QString> &map);
|
||||
|
||||
private:
|
||||
Ui::CFileSyncDialog *ui;
|
||||
QMenu *m_menu;
|
||||
CSysFileSyncApi *m_ptrSysFileSync;
|
||||
QStringList m_FileTypeList;
|
||||
};
|
||||
|
||||
#endif // CFILESYNCDIALOG_H
|
||||
|
||||
@ -1,121 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CFileSyncDialog</class>
|
||||
<widget class="QDialog" name="CFileSyncDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>497</width>
|
||||
<height>325</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>文件同步</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="m_filePathComb">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_selectFileBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resource.qrc">
|
||||
<normaloff>:/icon/open.png</normaloff>:/icon/open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="m_reloadBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resource.qrc">
|
||||
<normaloff>:/icon/reload.png</normaloff>:/icon/reload.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QTableWidget" name="m_fileTextTable">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="m_actionCommit">
|
||||
<property name="text">
|
||||
<string>提交</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionDelete">
|
||||
<property name="text">
|
||||
<string>删除</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionAdd">
|
||||
<property name="text">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionAllCommit">
|
||||
<property name="text">
|
||||
<string>提交</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resource.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CFileSyncDialog</class>
|
||||
<widget class="QDialog" name="CFileSyncDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>497</width>
|
||||
<height>325</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>文件同步</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="m_filePathComb">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_selectFileBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resource.qrc">
|
||||
<normaloff>:/icon/open.png</normaloff>:/icon/open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="m_reloadBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resource.qrc">
|
||||
<normaloff>:/icon/reload.png</normaloff>:/icon/reload.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QTableWidget" name="m_fileTextTable">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="m_actionCommit">
|
||||
<property name="text">
|
||||
<string>提交</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionDelete">
|
||||
<property name="text">
|
||||
<string>删除</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionAdd">
|
||||
<property name="text">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionAllCommit">
|
||||
<property name="text">
|
||||
<string>提交</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resource.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,58 +1,58 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2019-04-25T14:51:57
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = fileSync
|
||||
TEMPLATE = app
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
DEFAULTCODEC = utf-8
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
CConfirmDialog.cpp \
|
||||
CFileSyncDialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
CConfirmDialog.h \
|
||||
CFileSyncDialog.h
|
||||
|
||||
FORMS += \
|
||||
CFileSyncDialog.ui \
|
||||
CConfirmDialog.ui
|
||||
|
||||
|
||||
RESOURCES += \
|
||||
resource.qrc
|
||||
|
||||
win32{
|
||||
DEFINES += DLL_OUT
|
||||
}
|
||||
|
||||
LIBS += \
|
||||
-lsys_svn_file_sync_api \
|
||||
-lpub_utility_api
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2019-04-25T14:51:57
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = fileSync
|
||||
TEMPLATE = app
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
DEFAULTCODEC = utf-8
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
CConfirmDialog.cpp \
|
||||
CFileSyncDialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
CConfirmDialog.h \
|
||||
CFileSyncDialog.h
|
||||
|
||||
FORMS += \
|
||||
CFileSyncDialog.ui \
|
||||
CConfirmDialog.ui
|
||||
|
||||
|
||||
RESOURCES += \
|
||||
resource.qrc
|
||||
|
||||
win32{
|
||||
DEFINES += DLL_OUT
|
||||
}
|
||||
|
||||
LIBS += \
|
||||
-lsys_svn_file_sync_api \
|
||||
-lpub_utility_api
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
|
||||
|
||||
@ -1,260 +1,260 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en_US">
|
||||
<context>
|
||||
<name>CConfirmDialog</name>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.ui" line="14"/>
|
||||
<source>提交</source>
|
||||
<translation>Commit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.ui" line="56"/>
|
||||
<source>日志信息:</source>
|
||||
<translation>Log Infomation :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.ui" line="145"/>
|
||||
<source>确认</source>
|
||||
<translation>Confirm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.ui" line="152"/>
|
||||
<source>取消</source>
|
||||
<translation>Cancel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="54"/>
|
||||
<location filename="CConfirmDialog.cpp" line="124"/>
|
||||
<source>无修改</source>
|
||||
<translation>Normal</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="59"/>
|
||||
<source>添加</source>
|
||||
<translation>Add</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="64"/>
|
||||
<location filename="CConfirmDialog.cpp" line="129"/>
|
||||
<source>冲突</source>
|
||||
<translation>Conflict</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="69"/>
|
||||
<source>删除</source>
|
||||
<translation>Delete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="74"/>
|
||||
<source>忽略</source>
|
||||
<translation>Ignore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="79"/>
|
||||
<source>修改</source>
|
||||
<translation>Modified</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="84"/>
|
||||
<source>替换</source>
|
||||
<translation>Replace</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="89"/>
|
||||
<source>未纳入版本控制的目录,被外部引用的目录所创建</source>
|
||||
<translation>Externals-Define</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="94"/>
|
||||
<source>未纳入版本控制</source>
|
||||
<translation>Non-Versioned</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="99"/>
|
||||
<source>遗失</source>
|
||||
<translation>Missing</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="104"/>
|
||||
<source>重名</source>
|
||||
<translation>Same Name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="109"/>
|
||||
<location filename="CConfirmDialog.cpp" line="139"/>
|
||||
<location filename="CConfirmDialog.cpp" line="164"/>
|
||||
<location filename="CConfirmDialog.cpp" line="189"/>
|
||||
<location filename="CConfirmDialog.cpp" line="219"/>
|
||||
<location filename="CConfirmDialog.cpp" line="244"/>
|
||||
<location filename="CConfirmDialog.cpp" line="269"/>
|
||||
<source>自定义非法状态</source>
|
||||
<translation>Illegal</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="134"/>
|
||||
<source>改变</source>
|
||||
<translation>Modified</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="154"/>
|
||||
<source>未锁定</source>
|
||||
<translation>Not-Locked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="159"/>
|
||||
<source>锁定</source>
|
||||
<translation>Locked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="179"/>
|
||||
<source>没有历史</source>
|
||||
<translation>Not-History</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="184"/>
|
||||
<source>包含历史</source>
|
||||
<translation>Contain-History</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="204"/>
|
||||
<location filename="CConfirmDialog.cpp" line="259"/>
|
||||
<source>正常</source>
|
||||
<translation>Normal</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="209"/>
|
||||
<source>以切换</source>
|
||||
<translation>Switch</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="214"/>
|
||||
<source>被外部引用创建的文件</source>
|
||||
<translation>External Refer Created</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="234"/>
|
||||
<source>没有被锁定标记</source>
|
||||
<translation>Not-Locked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="239"/>
|
||||
<source>存在锁定标记</source>
|
||||
<translation>Locked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="264"/>
|
||||
<source>树冲突</source>
|
||||
<translation>Tree Conflict</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="281"/>
|
||||
<source>名称</source>
|
||||
<translation>Name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="281"/>
|
||||
<source>状态</source>
|
||||
<translation>State</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CFileSyncDialog</name>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.ui" line="14"/>
|
||||
<source>文件同步</source>
|
||||
<translation>FileSync</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.ui" line="101"/>
|
||||
<location filename="CFileSyncDialog.ui" line="116"/>
|
||||
<source>提交</source>
|
||||
<translation>Commit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.ui" line="106"/>
|
||||
<source>删除</source>
|
||||
<translation>Delete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.ui" line="111"/>
|
||||
<source>添加</source>
|
||||
<translation>Add</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="116"/>
|
||||
<location filename="CFileSyncDialog.cpp" line="131"/>
|
||||
<location filename="CFileSyncDialog.cpp" line="162"/>
|
||||
<location filename="CFileSyncDialog.cpp" line="177"/>
|
||||
<location filename="CFileSyncDialog.cpp" line="521"/>
|
||||
<location filename="CFileSyncDialog.cpp" line="538"/>
|
||||
<source>提示</source>
|
||||
<translation>Prompt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="116"/>
|
||||
<source>无需添加</source>
|
||||
<translation>Don't need to add</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="125"/>
|
||||
<source>确认添加</source>
|
||||
<translation>Add Confirm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="131"/>
|
||||
<source>添加失败: </source>
|
||||
<translation>Add Failure: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="162"/>
|
||||
<source>无需删除</source>
|
||||
<translation>Don't need to delete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="171"/>
|
||||
<source>确认删除</source>
|
||||
<translation>Delete Confirm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="177"/>
|
||||
<source>删除失败: </source>
|
||||
<translation>Delete Failure: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="209"/>
|
||||
<source>选择文件</source>
|
||||
<translation>Select File</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="249"/>
|
||||
<source>名称</source>
|
||||
<translation>Name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="249"/>
|
||||
<source>修改日期</source>
|
||||
<translation>Modification Date</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="249"/>
|
||||
<source>状态</source>
|
||||
<translation>State</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="383"/>
|
||||
<source> (异常) </source>
|
||||
<translation> (abnormal) </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="521"/>
|
||||
<source>无需提交</source>
|
||||
<translation>Don't need to commit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="538"/>
|
||||
<source>提交失败: </source>
|
||||
<translation>Commit Failure: </translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en_US">
|
||||
<context>
|
||||
<name>CConfirmDialog</name>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.ui" line="14"/>
|
||||
<source>提交</source>
|
||||
<translation>Commit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.ui" line="56"/>
|
||||
<source>日志信息:</source>
|
||||
<translation>Log Infomation :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.ui" line="145"/>
|
||||
<source>确认</source>
|
||||
<translation>Confirm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.ui" line="152"/>
|
||||
<source>取消</source>
|
||||
<translation>Cancel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="54"/>
|
||||
<location filename="CConfirmDialog.cpp" line="124"/>
|
||||
<source>无修改</source>
|
||||
<translation>Normal</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="59"/>
|
||||
<source>添加</source>
|
||||
<translation>Add</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="64"/>
|
||||
<location filename="CConfirmDialog.cpp" line="129"/>
|
||||
<source>冲突</source>
|
||||
<translation>Conflict</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="69"/>
|
||||
<source>删除</source>
|
||||
<translation>Delete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="74"/>
|
||||
<source>忽略</source>
|
||||
<translation>Ignore</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="79"/>
|
||||
<source>修改</source>
|
||||
<translation>Modified</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="84"/>
|
||||
<source>替换</source>
|
||||
<translation>Replace</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="89"/>
|
||||
<source>未纳入版本控制的目录,被外部引用的目录所创建</source>
|
||||
<translation>Externals-Define</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="94"/>
|
||||
<source>未纳入版本控制</source>
|
||||
<translation>Non-Versioned</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="99"/>
|
||||
<source>遗失</source>
|
||||
<translation>Missing</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="104"/>
|
||||
<source>重名</source>
|
||||
<translation>Same Name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="109"/>
|
||||
<location filename="CConfirmDialog.cpp" line="139"/>
|
||||
<location filename="CConfirmDialog.cpp" line="164"/>
|
||||
<location filename="CConfirmDialog.cpp" line="189"/>
|
||||
<location filename="CConfirmDialog.cpp" line="219"/>
|
||||
<location filename="CConfirmDialog.cpp" line="244"/>
|
||||
<location filename="CConfirmDialog.cpp" line="269"/>
|
||||
<source>自定义非法状态</source>
|
||||
<translation>Illegal</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="134"/>
|
||||
<source>改变</source>
|
||||
<translation>Modified</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="154"/>
|
||||
<source>未锁定</source>
|
||||
<translation>Not-Locked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="159"/>
|
||||
<source>锁定</source>
|
||||
<translation>Locked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="179"/>
|
||||
<source>没有历史</source>
|
||||
<translation>Not-History</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="184"/>
|
||||
<source>包含历史</source>
|
||||
<translation>Contain-History</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="204"/>
|
||||
<location filename="CConfirmDialog.cpp" line="259"/>
|
||||
<source>正常</source>
|
||||
<translation>Normal</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="209"/>
|
||||
<source>以切换</source>
|
||||
<translation>Switch</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="214"/>
|
||||
<source>被外部引用创建的文件</source>
|
||||
<translation>External Refer Created</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="234"/>
|
||||
<source>没有被锁定标记</source>
|
||||
<translation>Not-Locked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="239"/>
|
||||
<source>存在锁定标记</source>
|
||||
<translation>Locked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="264"/>
|
||||
<source>树冲突</source>
|
||||
<translation>Tree Conflict</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="281"/>
|
||||
<source>名称</source>
|
||||
<translation>Name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CConfirmDialog.cpp" line="281"/>
|
||||
<source>状态</source>
|
||||
<translation>State</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CFileSyncDialog</name>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.ui" line="14"/>
|
||||
<source>文件同步</source>
|
||||
<translation>FileSync</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.ui" line="101"/>
|
||||
<location filename="CFileSyncDialog.ui" line="116"/>
|
||||
<source>提交</source>
|
||||
<translation>Commit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.ui" line="106"/>
|
||||
<source>删除</source>
|
||||
<translation>Delete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.ui" line="111"/>
|
||||
<source>添加</source>
|
||||
<translation>Add</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="116"/>
|
||||
<location filename="CFileSyncDialog.cpp" line="131"/>
|
||||
<location filename="CFileSyncDialog.cpp" line="162"/>
|
||||
<location filename="CFileSyncDialog.cpp" line="177"/>
|
||||
<location filename="CFileSyncDialog.cpp" line="521"/>
|
||||
<location filename="CFileSyncDialog.cpp" line="538"/>
|
||||
<source>提示</source>
|
||||
<translation>Prompt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="116"/>
|
||||
<source>无需添加</source>
|
||||
<translation>Don't need to add</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="125"/>
|
||||
<source>确认添加</source>
|
||||
<translation>Add Confirm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="131"/>
|
||||
<source>添加失败: </source>
|
||||
<translation>Add Failure: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="162"/>
|
||||
<source>无需删除</source>
|
||||
<translation>Don't need to delete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="171"/>
|
||||
<source>确认删除</source>
|
||||
<translation>Delete Confirm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="177"/>
|
||||
<source>删除失败: </source>
|
||||
<translation>Delete Failure: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="209"/>
|
||||
<source>选择文件</source>
|
||||
<translation>Select File</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="249"/>
|
||||
<source>名称</source>
|
||||
<translation>Name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="249"/>
|
||||
<source>修改日期</source>
|
||||
<translation>Modification Date</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="249"/>
|
||||
<source>状态</source>
|
||||
<translation>State</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="383"/>
|
||||
<source> (异常) </source>
|
||||
<translation> (abnormal) </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="521"/>
|
||||
<source>无需提交</source>
|
||||
<translation>Don't need to commit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CFileSyncDialog.cpp" line="538"/>
|
||||
<source>提交失败: </source>
|
||||
<translation>Commit Failure: </translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "common/QtAppGlobalSet.h"
|
||||
#include "CFileSyncDialog.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
iot_common::doQtAppGlobalSet();
|
||||
|
||||
QApplication a(argc, argv);
|
||||
CFileSyncDialog w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
#include <QApplication>
|
||||
#include "common/QtAppGlobalSet.h"
|
||||
#include "CFileSyncDialog.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
kbd_common::doQtAppGlobalSet();
|
||||
|
||||
QApplication a(argc, argv);
|
||||
CFileSyncDialog w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>icon/AddedIcon.ico</file>
|
||||
<file>icon/ConflictIcon.ico</file>
|
||||
<file>icon/DeletedIcon.ico</file>
|
||||
<file>icon/IgnoredIcon.ico</file>
|
||||
<file>icon/LockedIcon.ico</file>
|
||||
<file>icon/ModifiedIcon.ico</file>
|
||||
<file>icon/NormalIcon.ico</file>
|
||||
<file>icon/ReadOnlyIcon.ico</file>
|
||||
<file>icon/UnversionedIcon.ico</file>
|
||||
<file>icon/open.png</file>
|
||||
<file>icon/reload.png</file>
|
||||
<file>fileSync_en.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>icon/AddedIcon.ico</file>
|
||||
<file>icon/ConflictIcon.ico</file>
|
||||
<file>icon/DeletedIcon.ico</file>
|
||||
<file>icon/IgnoredIcon.ico</file>
|
||||
<file>icon/LockedIcon.ico</file>
|
||||
<file>icon/ModifiedIcon.ico</file>
|
||||
<file>icon/NormalIcon.ico</file>
|
||||
<file>icon/ReadOnlyIcon.ico</file>
|
||||
<file>icon/UnversionedIcon.ico</file>
|
||||
<file>icon/open.png</file>
|
||||
<file>icon/reload.png</file>
|
||||
<file>fileSync_en.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
|
||||
#各子工程按书写顺序编译,清注意各子工程的依赖关系,被依赖的库应写在前面。
|
||||
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
SUBDIRS += \
|
||||
GraphTool \
|
||||
plugin
|
||||
|
||||
TRANSLATIONS += \
|
||||
product_en.ts\
|
||||
product_fr.ts
|
||||
|
||||
#各子工程按书写顺序编译,清注意各子工程的依赖关系,被依赖的库应写在前面。
|
||||
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
SUBDIRS += \
|
||||
GraphTool \
|
||||
plugin
|
||||
|
||||
|
||||
@ -1,84 +1,84 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2019-11-05T10:04:14
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui charts sql
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = AlarmAnalyzeWidget
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
CAlarmStatistics.cpp \
|
||||
CAlarmModel.cpp \
|
||||
CAlarmCompare.cpp \
|
||||
CProcessDialog.cpp \
|
||||
CCompareQueryThread.cpp \
|
||||
CommonFunction.cpp \
|
||||
CStatisticsQueryThread.cpp \
|
||||
CWaveListDialog.cpp \
|
||||
CAlarmStatisticsPluginWidget.cpp \
|
||||
CAlarmReport.cpp \
|
||||
CTableWidget.cpp
|
||||
|
||||
HEADERS += \
|
||||
CAlarmStatistics.h \
|
||||
CAlarmModel.h \
|
||||
SAlarmInfo.h \
|
||||
SAlarmList.h \
|
||||
CAlarmLevelComboBox.h \
|
||||
SAlarmLevel.h \
|
||||
CAlarmCompare.h \
|
||||
CProcessDialog.h \
|
||||
CCompareQueryThread.h \
|
||||
CommonDefine.h \
|
||||
CommonFunction.h \
|
||||
CStatisticsQueryThread.h \
|
||||
SDeviceGroup.h \
|
||||
SLocation.h \
|
||||
CWaveListDialog.h \
|
||||
CAlarmStatisticsPluginWidget.h \
|
||||
CAlarmReport.h \
|
||||
CTableWidget.h
|
||||
|
||||
FORMS += \
|
||||
CAlarmStatistics.ui \
|
||||
CAlarmCompare.ui \
|
||||
CProcessDialog.ui \
|
||||
CWaveListDialog.ui \
|
||||
CAlarmReport.ui
|
||||
|
||||
LIBS += -llog4cplus \
|
||||
-lpub_logger_api \
|
||||
-ldb_base_api \
|
||||
-ldb_api_ex \
|
||||
-lboost_system \
|
||||
-lboost_thread \
|
||||
-ldb_sysinfo_api \
|
||||
-lpub_utility_api \
|
||||
-lmodel_excel \
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2019-11-05T10:04:14
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui charts sql
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = AlarmAnalyzeWidget
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
CAlarmStatistics.cpp \
|
||||
CAlarmModel.cpp \
|
||||
CAlarmCompare.cpp \
|
||||
CProcessDialog.cpp \
|
||||
CCompareQueryThread.cpp \
|
||||
CommonFunction.cpp \
|
||||
CStatisticsQueryThread.cpp \
|
||||
CWaveListDialog.cpp \
|
||||
CAlarmStatisticsPluginWidget.cpp \
|
||||
CAlarmReport.cpp \
|
||||
CTableWidget.cpp
|
||||
|
||||
HEADERS += \
|
||||
CAlarmStatistics.h \
|
||||
CAlarmModel.h \
|
||||
SAlarmInfo.h \
|
||||
SAlarmList.h \
|
||||
CAlarmLevelComboBox.h \
|
||||
SAlarmLevel.h \
|
||||
CAlarmCompare.h \
|
||||
CProcessDialog.h \
|
||||
CCompareQueryThread.h \
|
||||
CommonDefine.h \
|
||||
CommonFunction.h \
|
||||
CStatisticsQueryThread.h \
|
||||
SDeviceGroup.h \
|
||||
SLocation.h \
|
||||
CWaveListDialog.h \
|
||||
CAlarmStatisticsPluginWidget.h \
|
||||
CAlarmReport.h \
|
||||
CTableWidget.h
|
||||
|
||||
FORMS += \
|
||||
CAlarmStatistics.ui \
|
||||
CAlarmCompare.ui \
|
||||
CProcessDialog.ui \
|
||||
CWaveListDialog.ui \
|
||||
CAlarmReport.ui
|
||||
|
||||
LIBS += -llog4cplus \
|
||||
-lpub_logger_api \
|
||||
-ldb_base_api \
|
||||
-ldb_api_ex \
|
||||
-lboost_system \
|
||||
-lboost_thread \
|
||||
-ldb_sysinfo_api \
|
||||
-lpub_utility_api \
|
||||
-lmodel_excel \
|
||||
|
||||
COMMON_PRI=$$PWD/../../../common.pri
|
||||
exists($$COMMON_PRI) {
|
||||
include($$COMMON_PRI)
|
||||
}else {
|
||||
error("FATAL error: can not find common.pri")
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,101 +1,101 @@
|
||||
#ifndef CALARMCOMPARE_H
|
||||
#define CALARMCOMPARE_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMenuBar>
|
||||
#include <QToolBar>
|
||||
#include <QStatusBar>
|
||||
#include <QPointF>
|
||||
#include <QLabel>
|
||||
#include <QList>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QSqlQuery>
|
||||
#include <QMessageBox>
|
||||
#include <QCalendarWidget>
|
||||
#include <QMap>
|
||||
#include <QListWidget>
|
||||
#include <QColor>
|
||||
#include <QTableView>
|
||||
#include <QStringList>
|
||||
#include <QtCharts/QChart>
|
||||
#include <QtCharts/QChartView>
|
||||
#include <QtCharts/QStackedBarSeries>
|
||||
#include <QtCharts/QBarSet>
|
||||
#include <QtCharts/QLegend>
|
||||
#include <QtCharts/QBarCategoryAxis>
|
||||
#include <QtCharts/QBarSeries>
|
||||
#include "CAlarmModel.h"
|
||||
#include "CAlarmLevelComboBox.h"
|
||||
#include "SAlarmLevel.h"
|
||||
#include "CProcessDialog.h"
|
||||
#include "CCompareQueryThread.h"
|
||||
#include "CommonDefine.h"
|
||||
#include "CommonFunction.h"
|
||||
|
||||
QT_CHARTS_USE_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class CAlarmCompare;
|
||||
}
|
||||
|
||||
class CAlarmCompare : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor chartBackground READ chartBackground WRITE setChartBackground)
|
||||
Q_PROPERTY(QColor chartLabelColor READ chartLabelColor WRITE setChartLabelColor)
|
||||
Q_PROPERTY(QColor chartLineColor READ chartLineColor WRITE setChartLineColor)
|
||||
public:
|
||||
explicit CAlarmCompare(QWidget *parent = 0);
|
||||
~CAlarmCompare();
|
||||
|
||||
void setHiddenOptColumn(bool hide);
|
||||
public:
|
||||
void initVariate();
|
||||
void initUi();
|
||||
void initBar();
|
||||
void resetUi();
|
||||
void showBar();
|
||||
void initLevelChoose();
|
||||
void setCurrentLocationIndex( int nIndex );
|
||||
|
||||
QColor chartBackground();
|
||||
void setChartBackground(const QColor& color);
|
||||
|
||||
QColor chartLabelColor();
|
||||
void setChartLabelColor(const QColor& color);
|
||||
|
||||
QColor chartLineColor();
|
||||
void setChartLineColor(const QColor& color);
|
||||
|
||||
public slots:
|
||||
void slotQueryEnd();
|
||||
void slotCheckBoxStateChanged( int );
|
||||
void slotPushButtonQueryClicked( bool bChecked = false );
|
||||
void slotBarMouseMoveHovered( bool bStatus, int nIndex, QBarSet* pBarset );
|
||||
void slotBarClicked( int nIndex, QBarSet* pBarset );
|
||||
|
||||
protected:
|
||||
void resizeEvent( QResizeEvent* pEvent );
|
||||
void paintEvent( QPaintEvent * pEvent);
|
||||
|
||||
private:
|
||||
Ui::CAlarmCompare *ui;
|
||||
QChart *m_pChart;// 柱状图
|
||||
QLabel* m_pLabelValue;// 鼠标移动到柱状图上显示的提示窗口
|
||||
bool m_bAfterMsgBox;// 是否是在弹出告警条数过多之后第一次进入显示提示窗口的函数
|
||||
QList<QList<QBarSet*> > m_listBarSet;
|
||||
CAlarmLevelComboBox* m_pAlarmLevelComboBox;// 告警级别选择的下拉框
|
||||
QList<QCheckBox*> m_listAlarmLevelCheckBox;// 柱状图告警等级选择的复选框集合
|
||||
CProcessDialog* m_pProcessDialog;// 等待窗口
|
||||
CCompareQueryThread* m_pQueryThread;// 查询线程
|
||||
int m_nCurrentLocationIndex;// 当前站序号,0表示全部站,其余表示第几个
|
||||
QList<QCheckBox*> m_listCheckBoxLocation;// stackwidget page0 站列表
|
||||
QList<QCheckBox*> m_listCheckBoxDeviceGroup;// stackwidget page1 设备组列表
|
||||
|
||||
QColor m_chartBackground;
|
||||
QColor m_chartLabelColor;
|
||||
QColor m_chartLineColor;
|
||||
};
|
||||
|
||||
#endif // CALARMCOMPARE_H
|
||||
#ifndef CALARMCOMPARE_H
|
||||
#define CALARMCOMPARE_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMenuBar>
|
||||
#include <QToolBar>
|
||||
#include <QStatusBar>
|
||||
#include <QPointF>
|
||||
#include <QLabel>
|
||||
#include <QList>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QSqlQuery>
|
||||
#include <QMessageBox>
|
||||
#include <QCalendarWidget>
|
||||
#include <QMap>
|
||||
#include <QListWidget>
|
||||
#include <QColor>
|
||||
#include <QTableView>
|
||||
#include <QStringList>
|
||||
#include <QtCharts/QChart>
|
||||
#include <QtCharts/QChartView>
|
||||
#include <QtCharts/QStackedBarSeries>
|
||||
#include <QtCharts/QBarSet>
|
||||
#include <QtCharts/QLegend>
|
||||
#include <QtCharts/QBarCategoryAxis>
|
||||
#include <QtCharts/QBarSeries>
|
||||
#include "CAlarmModel.h"
|
||||
#include "CAlarmLevelComboBox.h"
|
||||
#include "SAlarmLevel.h"
|
||||
#include "CProcessDialog.h"
|
||||
#include "CCompareQueryThread.h"
|
||||
#include "CommonDefine.h"
|
||||
#include "CommonFunction.h"
|
||||
|
||||
QT_CHARTS_USE_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class CAlarmCompare;
|
||||
}
|
||||
|
||||
class CAlarmCompare : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor chartBackground READ chartBackground WRITE setChartBackground)
|
||||
Q_PROPERTY(QColor chartLabelColor READ chartLabelColor WRITE setChartLabelColor)
|
||||
Q_PROPERTY(QColor chartLineColor READ chartLineColor WRITE setChartLineColor)
|
||||
public:
|
||||
explicit CAlarmCompare(QWidget *parent = 0);
|
||||
~CAlarmCompare();
|
||||
|
||||
void setHiddenOptColumn(bool hide);
|
||||
public:
|
||||
void initVariate();
|
||||
void initUi();
|
||||
void initBar();
|
||||
void resetUi();
|
||||
void showBar();
|
||||
void initLevelChoose();
|
||||
void setCurrentLocationIndex( int nIndex );
|
||||
|
||||
QColor chartBackground();
|
||||
void setChartBackground(const QColor& color);
|
||||
|
||||
QColor chartLabelColor();
|
||||
void setChartLabelColor(const QColor& color);
|
||||
|
||||
QColor chartLineColor();
|
||||
void setChartLineColor(const QColor& color);
|
||||
|
||||
public slots:
|
||||
void slotQueryEnd();
|
||||
void slotCheckBoxStateChanged( int );
|
||||
void slotPushButtonQueryClicked( bool bChecked = false );
|
||||
void slotBarMouseMoveHovered( bool bStatus, int nIndex, QBarSet* pBarset );
|
||||
void slotBarClicked( int nIndex, QBarSet* pBarset );
|
||||
|
||||
protected:
|
||||
void resizeEvent( QResizeEvent* pEvent );
|
||||
void paintEvent( QPaintEvent * pEvent);
|
||||
|
||||
private:
|
||||
Ui::CAlarmCompare *ui;
|
||||
QChart *m_pChart;// 柱状图
|
||||
QLabel* m_pLabelValue;// 鼠标移动到柱状图上显示的提示窗口
|
||||
bool m_bAfterMsgBox;// 是否是在弹出告警条数过多之后第一次进入显示提示窗口的函数
|
||||
QList<QList<QBarSet*> > m_listBarSet;
|
||||
CAlarmLevelComboBox* m_pAlarmLevelComboBox;// 告警级别选择的下拉框
|
||||
QList<QCheckBox*> m_listAlarmLevelCheckBox;// 柱状图告警等级选择的复选框集合
|
||||
CProcessDialog* m_pProcessDialog;// 等待窗口
|
||||
CCompareQueryThread* m_pQueryThread;// 查询线程
|
||||
int m_nCurrentLocationIndex;// 当前站序号,0表示全部站,其余表示第几个
|
||||
QList<QCheckBox*> m_listCheckBoxLocation;// stackwidget page0 站列表
|
||||
QList<QCheckBox*> m_listCheckBoxDeviceGroup;// stackwidget page1 设备组列表
|
||||
|
||||
QColor m_chartBackground;
|
||||
QColor m_chartLabelColor;
|
||||
QColor m_chartLineColor;
|
||||
};
|
||||
|
||||
#endif // CALARMCOMPARE_H
|
||||
|
||||
@ -1,450 +1,450 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAlarmCompare</class>
|
||||
<widget class="QWidget" name="CAlarmCompare">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1080</width>
|
||||
<height>654</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>告警等级</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_level">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 统计类型</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_day">
|
||||
<property name="text">
|
||||
<string>日</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_month">
|
||||
<property name="text">
|
||||
<string>月</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 时间段</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit_start">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>yyyy-MM-dd</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit_end">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>yyyy-MM-dd</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_keyWord">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>告警内容关键字</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_query">
|
||||
<property name="text">
|
||||
<string>查询</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_location">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="tabSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="widget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string/>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame_bar">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame_alarm">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CTableView" name="tableView_alarm">
|
||||
<property name="toolTip">
|
||||
<string>11</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>22</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>33</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CTableView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>CTableWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAlarmCompare</class>
|
||||
<widget class="QWidget" name="CAlarmCompare">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1080</width>
|
||||
<height>654</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>告警等级</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_level">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 统计类型</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_day">
|
||||
<property name="text">
|
||||
<string>日</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_month">
|
||||
<property name="text">
|
||||
<string>月</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 时间段</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit_start">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>yyyy-MM-dd</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit_end">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>yyyy-MM-dd</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_keyWord">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>告警内容关键字</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_query">
|
||||
<property name="text">
|
||||
<string>查询</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_location">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="tabSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="widget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string/>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame_bar">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame_alarm">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CTableView" name="tableView_alarm">
|
||||
<property name="toolTip">
|
||||
<string>11</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>22</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>33</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CTableView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>CTableWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
@ -1,80 +1,80 @@
|
||||
#ifndef CALARMLEVELCOMBOBOX_H
|
||||
#define CALARMLEVELCOMBOBOX_H
|
||||
|
||||
#include <QVariant>
|
||||
#include <QListWidget>
|
||||
#include <QComboBox>
|
||||
#include <QAbstractItemView>
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
#include <QDebug>
|
||||
#include "SAlarmLevel.h"
|
||||
|
||||
class CAlarmLevelComboBox : public QListWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CAlarmLevelComboBox( QComboBox* pComboBox )
|
||||
{
|
||||
setViewMode( QListWidget::ListMode );
|
||||
setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
QLineEdit *pLineEdit = new QLineEdit;
|
||||
pLineEdit->setReadOnly( true );
|
||||
m_pCombobox = pComboBox;
|
||||
m_pCombobox->setLineEdit( pLineEdit );
|
||||
m_pCombobox->setModel( model() );
|
||||
m_pCombobox->setView( this );
|
||||
m_pCombobox->setEditable( true );
|
||||
}
|
||||
|
||||
public:
|
||||
void init( QList<SAlarmLevel*> listAlarmLevel )
|
||||
{
|
||||
for ( int i=0; i<listAlarmLevel.count(); i++ )
|
||||
{
|
||||
m_listData.append( listAlarmLevel.at(i)->nId );
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsUserCheckable |Qt::ItemIsEnabled);
|
||||
insertItem( model()->rowCount(), item );
|
||||
QCheckBox* pCheckBox = new QCheckBox( listAlarmLevel.at(i)->sName );
|
||||
setItemWidget( item, pCheckBox );
|
||||
m_listCheckBox.append( pCheckBox );
|
||||
pCheckBox->setChecked( false );
|
||||
connect( pCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSelectItem(int)) );
|
||||
pCheckBox->setChecked( true );
|
||||
}
|
||||
connect( m_pCombobox, SIGNAL(activated(int)), this, SLOT(setSelectItem(int)) );
|
||||
}
|
||||
void getSelectData( QList<int>& data )
|
||||
{
|
||||
for( int i=0; i<m_listCheckBox.size(); i++)
|
||||
{
|
||||
if( m_listCheckBox.at(i)->isChecked() )
|
||||
data.append( m_listData.at(i) );
|
||||
}
|
||||
}
|
||||
|
||||
private slots:
|
||||
//QCheckBox复选消息处理
|
||||
void setSelectItem( int )
|
||||
{
|
||||
QString sName;
|
||||
for( int i=0; i<m_listCheckBox.size(); i++)
|
||||
{
|
||||
if( m_listCheckBox.at(i)->isChecked() )
|
||||
{
|
||||
sName += m_listCheckBox.at(i)->text();
|
||||
sName += ",";
|
||||
}
|
||||
}
|
||||
m_pCombobox->setEditText( sName );
|
||||
}
|
||||
|
||||
private:
|
||||
QComboBox* m_pCombobox;
|
||||
QList<QCheckBox*> m_listCheckBox;
|
||||
QList<int> m_listData;
|
||||
};
|
||||
|
||||
#endif // CALARMLEVELCOMBOBOX_H
|
||||
#ifndef CALARMLEVELCOMBOBOX_H
|
||||
#define CALARMLEVELCOMBOBOX_H
|
||||
|
||||
#include <QVariant>
|
||||
#include <QListWidget>
|
||||
#include <QComboBox>
|
||||
#include <QAbstractItemView>
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
#include <QDebug>
|
||||
#include "SAlarmLevel.h"
|
||||
|
||||
class CAlarmLevelComboBox : public QListWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CAlarmLevelComboBox( QComboBox* pComboBox )
|
||||
{
|
||||
setViewMode( QListWidget::ListMode );
|
||||
setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
QLineEdit *pLineEdit = new QLineEdit;
|
||||
pLineEdit->setReadOnly( true );
|
||||
m_pCombobox = pComboBox;
|
||||
m_pCombobox->setLineEdit( pLineEdit );
|
||||
m_pCombobox->setModel( model() );
|
||||
m_pCombobox->setView( this );
|
||||
m_pCombobox->setEditable( true );
|
||||
}
|
||||
|
||||
public:
|
||||
void init( QList<SAlarmLevel*> listAlarmLevel )
|
||||
{
|
||||
for ( int i=0; i<listAlarmLevel.count(); i++ )
|
||||
{
|
||||
m_listData.append( listAlarmLevel.at(i)->nId );
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsUserCheckable |Qt::ItemIsEnabled);
|
||||
insertItem( model()->rowCount(), item );
|
||||
QCheckBox* pCheckBox = new QCheckBox( listAlarmLevel.at(i)->sName );
|
||||
setItemWidget( item, pCheckBox );
|
||||
m_listCheckBox.append( pCheckBox );
|
||||
pCheckBox->setChecked( false );
|
||||
connect( pCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSelectItem(int)) );
|
||||
pCheckBox->setChecked( true );
|
||||
}
|
||||
connect( m_pCombobox, SIGNAL(activated(int)), this, SLOT(setSelectItem(int)) );
|
||||
}
|
||||
void getSelectData( QList<int>& data )
|
||||
{
|
||||
for( int i=0; i<m_listCheckBox.size(); i++)
|
||||
{
|
||||
if( m_listCheckBox.at(i)->isChecked() )
|
||||
data.append( m_listData.at(i) );
|
||||
}
|
||||
}
|
||||
|
||||
private slots:
|
||||
//QCheckBox复选消息处理
|
||||
void setSelectItem( int )
|
||||
{
|
||||
QString sName;
|
||||
for( int i=0; i<m_listCheckBox.size(); i++)
|
||||
{
|
||||
if( m_listCheckBox.at(i)->isChecked() )
|
||||
{
|
||||
sName += m_listCheckBox.at(i)->text();
|
||||
sName += ",";
|
||||
}
|
||||
}
|
||||
m_pCombobox->setEditText( sName );
|
||||
}
|
||||
|
||||
private:
|
||||
QComboBox* m_pCombobox;
|
||||
QList<QCheckBox*> m_listCheckBox;
|
||||
QList<int> m_listData;
|
||||
};
|
||||
|
||||
#endif // CALARMLEVELCOMBOBOX_H
|
||||
|
||||
@ -1,128 +1,128 @@
|
||||
#include "CAlarmModel.h"
|
||||
|
||||
CAlarmModel::CAlarmModel()
|
||||
{
|
||||
m_listHeadText << tr("时间")
|
||||
<< tr("优先级")
|
||||
<< tr("所属位置")
|
||||
<< tr("告警内容")
|
||||
<< tr("操作");
|
||||
}
|
||||
|
||||
CAlarmModel::~CAlarmModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CAlarmModel::setHiddenOptColumn(bool hide)
|
||||
{
|
||||
if(hide)
|
||||
{
|
||||
m_listHeadText.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_listHeadText.push_back(tr("操作"));
|
||||
}
|
||||
}
|
||||
|
||||
QVariant CAlarmModel::headerData( int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
|
||||
{
|
||||
return m_listHeadText.at(section);
|
||||
}
|
||||
return QAbstractTableModel::headerData(section,orientation,role);
|
||||
}
|
||||
|
||||
Qt::ItemFlags CAlarmModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
|
||||
}
|
||||
|
||||
int CAlarmModel::rowCount( const QModelIndex& ) const
|
||||
{
|
||||
return m_listAlarm.count();
|
||||
}
|
||||
|
||||
int CAlarmModel::columnCount( const QModelIndex& ) const
|
||||
{
|
||||
return m_listHeadText.count();
|
||||
}
|
||||
|
||||
QVariant CAlarmModel::data( const QModelIndex &index, int role ) const
|
||||
{
|
||||
if ( !index.isValid() )//没有索引返回无效数据,不要直接返回0
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if ( role == Qt::TextAlignmentRole )
|
||||
{
|
||||
return int(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
}
|
||||
else if ( role == Qt::DisplayRole || role == Qt::EditRole )
|
||||
{
|
||||
QVariant oVal;
|
||||
switch ( index.column() )
|
||||
{
|
||||
case 0:
|
||||
oVal = m_listAlarm.at(index.row())->sTime;
|
||||
break;
|
||||
case 1:
|
||||
oVal = m_listAlarm.at(index.row())->sLevel;
|
||||
break;
|
||||
case 2:
|
||||
oVal = m_listAlarm.at(index.row())->sLocation;
|
||||
break;
|
||||
case 3:
|
||||
oVal = m_listAlarm.at(index.row())->sContent;
|
||||
break;
|
||||
case 4:
|
||||
if ( m_listAlarm.at(index.row())->sKeyIdTag.startsWith("analog") )
|
||||
oVal = tr("趋势");
|
||||
else if ( m_listAlarm.at(index.row())->sKeyIdTag.startsWith("digital") )
|
||||
oVal = tr("录波");
|
||||
}
|
||||
return oVal;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CAlarmModel.h"
|
||||
|
||||
CAlarmModel::CAlarmModel()
|
||||
{
|
||||
m_listHeadText << tr("时间")
|
||||
<< tr("优先级")
|
||||
<< tr("所属位置")
|
||||
<< tr("告警内容")
|
||||
<< tr("操作");
|
||||
}
|
||||
|
||||
CAlarmModel::~CAlarmModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CAlarmModel::setHiddenOptColumn(bool hide)
|
||||
{
|
||||
if(hide)
|
||||
{
|
||||
m_listHeadText.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_listHeadText.push_back(tr("操作"));
|
||||
}
|
||||
}
|
||||
|
||||
QVariant CAlarmModel::headerData( int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
|
||||
{
|
||||
return m_listHeadText.at(section);
|
||||
}
|
||||
return QAbstractTableModel::headerData(section,orientation,role);
|
||||
}
|
||||
|
||||
Qt::ItemFlags CAlarmModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
|
||||
}
|
||||
|
||||
int CAlarmModel::rowCount( const QModelIndex& ) const
|
||||
{
|
||||
return m_listAlarm.count();
|
||||
}
|
||||
|
||||
int CAlarmModel::columnCount( const QModelIndex& ) const
|
||||
{
|
||||
return m_listHeadText.count();
|
||||
}
|
||||
|
||||
QVariant CAlarmModel::data( const QModelIndex &index, int role ) const
|
||||
{
|
||||
if ( !index.isValid() )//没有索引返回无效数据,不要直接返回0
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if ( role == Qt::TextAlignmentRole )
|
||||
{
|
||||
return int(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
}
|
||||
else if ( role == Qt::DisplayRole || role == Qt::EditRole )
|
||||
{
|
||||
QVariant oVal;
|
||||
switch ( index.column() )
|
||||
{
|
||||
case 0:
|
||||
oVal = m_listAlarm.at(index.row())->sTime;
|
||||
break;
|
||||
case 1:
|
||||
oVal = m_listAlarm.at(index.row())->sLevel;
|
||||
break;
|
||||
case 2:
|
||||
oVal = m_listAlarm.at(index.row())->sLocation;
|
||||
break;
|
||||
case 3:
|
||||
oVal = m_listAlarm.at(index.row())->sContent;
|
||||
break;
|
||||
case 4:
|
||||
if ( m_listAlarm.at(index.row())->sKeyIdTag.startsWith("analog") )
|
||||
oVal = tr("趋势");
|
||||
else if ( m_listAlarm.at(index.row())->sKeyIdTag.startsWith("digital") )
|
||||
oVal = tr("录波");
|
||||
}
|
||||
return oVal;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,41 +1,41 @@
|
||||
#ifndef CALARMMODEL_H
|
||||
#define CALARMMODEL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QItemDelegate>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include "SAlarmInfo.h"
|
||||
#include "SAlarmList.h"
|
||||
|
||||
class CAlarmModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CAlarmModel();
|
||||
~CAlarmModel();
|
||||
|
||||
void setHiddenOptColumn(bool hide);
|
||||
public:
|
||||
void beginReset(){ this->beginResetModel(); }
|
||||
void endReset(){ this->endResetModel(); }
|
||||
void setAlarmList( QList<SAlarmInfo*>& listAlarm ) { m_listAlarm = listAlarm; }
|
||||
void clearAlarmList(){ m_listAlarm.clear(); }
|
||||
|
||||
public:
|
||||
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
int rowCount( const QModelIndex &parent = QModelIndex() ) const;
|
||||
int columnCount( const QModelIndex &parent = QModelIndex() ) const;
|
||||
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
|
||||
|
||||
public:
|
||||
QStringList m_listHeadText;
|
||||
QList<SAlarmInfo*> m_listAlarm;
|
||||
};
|
||||
|
||||
#endif // CALARMMODEL_H
|
||||
#ifndef CALARMMODEL_H
|
||||
#define CALARMMODEL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QItemDelegate>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include "SAlarmInfo.h"
|
||||
#include "SAlarmList.h"
|
||||
|
||||
class CAlarmModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CAlarmModel();
|
||||
~CAlarmModel();
|
||||
|
||||
void setHiddenOptColumn(bool hide);
|
||||
public:
|
||||
void beginReset(){ this->beginResetModel(); }
|
||||
void endReset(){ this->endResetModel(); }
|
||||
void setAlarmList( QList<SAlarmInfo*>& listAlarm ) { m_listAlarm = listAlarm; }
|
||||
void clearAlarmList(){ m_listAlarm.clear(); }
|
||||
|
||||
public:
|
||||
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
int rowCount( const QModelIndex &parent = QModelIndex() ) const;
|
||||
int columnCount( const QModelIndex &parent = QModelIndex() ) const;
|
||||
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
|
||||
|
||||
public:
|
||||
QStringList m_listHeadText;
|
||||
QList<SAlarmInfo*> m_listAlarm;
|
||||
};
|
||||
|
||||
#endif // CALARMMODEL_H
|
||||
|
||||
@ -1,183 +1,183 @@
|
||||
#include "CAlarmReport.h"
|
||||
#include "ui_CAlarmReport.h"
|
||||
#include "CommonFunction.h"
|
||||
|
||||
CAlarmReport::CAlarmReport(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CAlarmReport)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
this->setWindowFlags( ( this->windowFlags() & ~Qt::WindowMinimizeButtonHint ) | Qt::WindowStaysOnTopHint | Qt::Dialog );
|
||||
this->setWindowTitle( "分析报告" );
|
||||
ui->splitter->setStretchFactor( 0, 0 );
|
||||
ui->splitter->setStretchFactor( 1, 1 );
|
||||
ui->tableWidget->horizontalHeader()->setStretchLastSection( true );
|
||||
ui->tableWidget->setEditTriggers( QAbstractItemView::NoEditTriggers );
|
||||
ui->tableWidget->setSelectionBehavior( QAbstractItemView::SelectRows );
|
||||
ui->textEdit->setText( "报告内容: " );
|
||||
ui->textEdit->setEnabled( false );
|
||||
|
||||
connect( ui->pushButton_export, SIGNAL(clicked(bool)), this, SLOT(slotPushButtonExportClicked(bool)) );
|
||||
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
CAlarmReport::~CAlarmReport()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CAlarmReport::loadConfig()
|
||||
{
|
||||
QString sFileName = "alarm_statistics.ini";
|
||||
if ( !QFile::exists(sFileName) )
|
||||
{
|
||||
m_nNormalAlarmCount = 1000;
|
||||
m_nSmartAlarmCount = 1000;
|
||||
QSettings oSettings( sFileName, QSettings::IniFormat, 0 );
|
||||
oSettings.setValue( "AlarmReport/NormalAlarm", m_nNormalAlarmCount );
|
||||
oSettings.setValue( "AlarmReport/SmartAlarm", m_nSmartAlarmCount );
|
||||
}
|
||||
else
|
||||
{
|
||||
QSettings oSettings( sFileName, QSettings::IniFormat, 0 );
|
||||
m_nNormalAlarmCount = oSettings.value( "AlarmReport/NormalAlarm", 1000 ).toInt();
|
||||
m_nSmartAlarmCount = oSettings.value( "AlarmReport/SmartAlarm", 1000 ).toInt();
|
||||
}
|
||||
}
|
||||
|
||||
void CAlarmReport::initData( QTableWidget* pTableWidget )
|
||||
{
|
||||
if ( pTableWidget == NULL )
|
||||
return;
|
||||
|
||||
ui->tableWidget->clear();
|
||||
ui->tableWidget->setRowCount(0);
|
||||
|
||||
int nRowCount = pTableWidget->rowCount();
|
||||
int nColCount = pTableWidget->horizontalHeader()->count();
|
||||
QStringList listHeader;
|
||||
for ( int i=0; i<nColCount; i++ )
|
||||
listHeader << pTableWidget->horizontalHeaderItem(i)->text();
|
||||
ui->tableWidget->setColumnCount( nColCount );
|
||||
ui->tableWidget->setHorizontalHeaderLabels( listHeader );
|
||||
|
||||
int nIndex = 1;
|
||||
for ( int i=0; i<nRowCount; i++ )
|
||||
{
|
||||
ui->tableWidget->insertRow( i );
|
||||
for ( int l=0; l<nColCount; l++ )
|
||||
{
|
||||
QTableWidgetItem* pItem = new QTableWidgetItem( pTableWidget->item(i,l)->text() );
|
||||
pItem->setTextAlignment( Qt::AlignCenter );
|
||||
ui->tableWidget->setItem( i, l, pItem );
|
||||
|
||||
// 将记录写入右侧文本框
|
||||
if ( l == 1 )
|
||||
{
|
||||
QStringList listCount = pTableWidget->item(i,l)->text().split("/");
|
||||
if ( listCount.count() == 2 )
|
||||
{
|
||||
if ( listCount.at(0).toInt() >= m_nNormalAlarmCount )
|
||||
{
|
||||
QString sText = ui->textEdit->toHtml();
|
||||
sText = sText + QString("%1:%2,普通告警偏高; \n").arg(nIndex++).arg(pTableWidget->item(i,0)->text());
|
||||
ui->textEdit->setText( sText );
|
||||
}
|
||||
if ( listCount.at(1).toInt() >= m_nSmartAlarmCount )
|
||||
{
|
||||
QString sText = ui->textEdit->toHtml();
|
||||
sText = sText + QString("%1:%2,智能告警偏高; \n").arg(nIndex++).arg(pTableWidget->item(i,0)->text());
|
||||
ui->textEdit->setText( sText );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAlarmReport::slotPushButtonExportClicked( bool )
|
||||
{
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
|
||||
QString sPath = QFileDialog::getExistingDirectory(this, tr("选择导出目录"),
|
||||
dir.absolutePath(),
|
||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
|
||||
if ( sPath == "" )
|
||||
return;
|
||||
|
||||
QString sExcelFileName = QString("告警分析报告.xlsx");
|
||||
QXlsx::Document xlsx;
|
||||
xlsx.addSheet( "sheet1" );
|
||||
|
||||
// 宽度
|
||||
xlsx.setColumnWidth( 1, 20 );
|
||||
xlsx.setColumnWidth( 2, 20 );
|
||||
xlsx.setColumnWidth( 3, 50 );
|
||||
|
||||
// 写横向表头
|
||||
xlsx.write( 1, 1, "名称" );
|
||||
xlsx.write( 1, 2, "告警数/智能告警数" );
|
||||
|
||||
// 写内容
|
||||
int nRowCount = ui->tableWidget->rowCount();
|
||||
int nColCount = ui->tableWidget->horizontalHeader()->count();
|
||||
for ( int i=0; i<nRowCount; i++ )
|
||||
{
|
||||
for ( int l=0; l<nColCount; l++ )
|
||||
{
|
||||
xlsx.write( i+2, l+1, ui->tableWidget->item(i,l)->text() );
|
||||
}
|
||||
}
|
||||
|
||||
// 写报告内容
|
||||
QStringList listReport = ui->textEdit->toPlainText().split(" ");
|
||||
for ( int i=0; i<listReport.count(); i++ )
|
||||
xlsx.write( i+1, 3, listReport.at(i) );
|
||||
|
||||
// 保存到文件
|
||||
xlsx.saveAs( sPath+"/"+sExcelFileName );
|
||||
|
||||
// 提示导出路径
|
||||
showMsg( QMessageBox::Information, "提示", "导出完成\n文件为:"+sPath+"/"+sExcelFileName);
|
||||
}
|
||||
|
||||
void CAlarmReport::paintEvent(QPaintEvent *pEvent)
|
||||
{
|
||||
//< 用于qss设置背景图片
|
||||
Q_UNUSED(pEvent)
|
||||
|
||||
QStyleOption op;
|
||||
op.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &op, &p, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "CAlarmReport.h"
|
||||
#include "ui_CAlarmReport.h"
|
||||
#include "CommonFunction.h"
|
||||
|
||||
CAlarmReport::CAlarmReport(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CAlarmReport)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
this->setWindowFlags( ( this->windowFlags() & ~Qt::WindowMinimizeButtonHint ) | Qt::WindowStaysOnTopHint | Qt::Dialog );
|
||||
this->setWindowTitle( "分析报告" );
|
||||
ui->splitter->setStretchFactor( 0, 0 );
|
||||
ui->splitter->setStretchFactor( 1, 1 );
|
||||
ui->tableWidget->horizontalHeader()->setStretchLastSection( true );
|
||||
ui->tableWidget->setEditTriggers( QAbstractItemView::NoEditTriggers );
|
||||
ui->tableWidget->setSelectionBehavior( QAbstractItemView::SelectRows );
|
||||
ui->textEdit->setText( "报告内容: " );
|
||||
ui->textEdit->setEnabled( false );
|
||||
|
||||
connect( ui->pushButton_export, SIGNAL(clicked(bool)), this, SLOT(slotPushButtonExportClicked(bool)) );
|
||||
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
CAlarmReport::~CAlarmReport()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CAlarmReport::loadConfig()
|
||||
{
|
||||
QString sFileName = "alarm_statistics.ini";
|
||||
if ( !QFile::exists(sFileName) )
|
||||
{
|
||||
m_nNormalAlarmCount = 1000;
|
||||
m_nSmartAlarmCount = 1000;
|
||||
QSettings oSettings( sFileName, QSettings::IniFormat, 0 );
|
||||
oSettings.setValue( "AlarmReport/NormalAlarm", m_nNormalAlarmCount );
|
||||
oSettings.setValue( "AlarmReport/SmartAlarm", m_nSmartAlarmCount );
|
||||
}
|
||||
else
|
||||
{
|
||||
QSettings oSettings( sFileName, QSettings::IniFormat, 0 );
|
||||
m_nNormalAlarmCount = oSettings.value( "AlarmReport/NormalAlarm", 1000 ).toInt();
|
||||
m_nSmartAlarmCount = oSettings.value( "AlarmReport/SmartAlarm", 1000 ).toInt();
|
||||
}
|
||||
}
|
||||
|
||||
void CAlarmReport::initData( QTableWidget* pTableWidget )
|
||||
{
|
||||
if ( pTableWidget == NULL )
|
||||
return;
|
||||
|
||||
ui->tableWidget->clear();
|
||||
ui->tableWidget->setRowCount(0);
|
||||
|
||||
int nRowCount = pTableWidget->rowCount();
|
||||
int nColCount = pTableWidget->horizontalHeader()->count();
|
||||
QStringList listHeader;
|
||||
for ( int i=0; i<nColCount; i++ )
|
||||
listHeader << pTableWidget->horizontalHeaderItem(i)->text();
|
||||
ui->tableWidget->setColumnCount( nColCount );
|
||||
ui->tableWidget->setHorizontalHeaderLabels( listHeader );
|
||||
|
||||
int nIndex = 1;
|
||||
for ( int i=0; i<nRowCount; i++ )
|
||||
{
|
||||
ui->tableWidget->insertRow( i );
|
||||
for ( int l=0; l<nColCount; l++ )
|
||||
{
|
||||
QTableWidgetItem* pItem = new QTableWidgetItem( pTableWidget->item(i,l)->text() );
|
||||
pItem->setTextAlignment( Qt::AlignCenter );
|
||||
ui->tableWidget->setItem( i, l, pItem );
|
||||
|
||||
// 将记录写入右侧文本框
|
||||
if ( l == 1 )
|
||||
{
|
||||
QStringList listCount = pTableWidget->item(i,l)->text().split("/");
|
||||
if ( listCount.count() == 2 )
|
||||
{
|
||||
if ( listCount.at(0).toInt() >= m_nNormalAlarmCount )
|
||||
{
|
||||
QString sText = ui->textEdit->toHtml();
|
||||
sText = sText + QString("%1:%2,普通告警偏高; \n").arg(nIndex++).arg(pTableWidget->item(i,0)->text());
|
||||
ui->textEdit->setText( sText );
|
||||
}
|
||||
if ( listCount.at(1).toInt() >= m_nSmartAlarmCount )
|
||||
{
|
||||
QString sText = ui->textEdit->toHtml();
|
||||
sText = sText + QString("%1:%2,智能告警偏高; \n").arg(nIndex++).arg(pTableWidget->item(i,0)->text());
|
||||
ui->textEdit->setText( sText );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAlarmReport::slotPushButtonExportClicked( bool )
|
||||
{
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
|
||||
QString sPath = QFileDialog::getExistingDirectory(this, tr("选择导出目录"),
|
||||
dir.absolutePath(),
|
||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
|
||||
if ( sPath == "" )
|
||||
return;
|
||||
|
||||
QString sExcelFileName = QString("告警分析报告.xlsx");
|
||||
QXlsx::Document xlsx;
|
||||
xlsx.addSheet( "sheet1" );
|
||||
|
||||
// 宽度
|
||||
xlsx.setColumnWidth( 1, 20 );
|
||||
xlsx.setColumnWidth( 2, 20 );
|
||||
xlsx.setColumnWidth( 3, 50 );
|
||||
|
||||
// 写横向表头
|
||||
xlsx.write( 1, 1, "名称" );
|
||||
xlsx.write( 1, 2, "告警数/智能告警数" );
|
||||
|
||||
// 写内容
|
||||
int nRowCount = ui->tableWidget->rowCount();
|
||||
int nColCount = ui->tableWidget->horizontalHeader()->count();
|
||||
for ( int i=0; i<nRowCount; i++ )
|
||||
{
|
||||
for ( int l=0; l<nColCount; l++ )
|
||||
{
|
||||
xlsx.write( i+2, l+1, ui->tableWidget->item(i,l)->text() );
|
||||
}
|
||||
}
|
||||
|
||||
// 写报告内容
|
||||
QStringList listReport = ui->textEdit->toPlainText().split(" ");
|
||||
for ( int i=0; i<listReport.count(); i++ )
|
||||
xlsx.write( i+1, 3, listReport.at(i) );
|
||||
|
||||
// 保存到文件
|
||||
xlsx.saveAs( sPath+"/"+sExcelFileName );
|
||||
|
||||
// 提示导出路径
|
||||
showMsg( QMessageBox::Information, "提示", "导出完成\n文件为:"+sPath+"/"+sExcelFileName);
|
||||
}
|
||||
|
||||
void CAlarmReport::paintEvent(QPaintEvent *pEvent)
|
||||
{
|
||||
//< 用于qss设置背景图片
|
||||
Q_UNUSED(pEvent)
|
||||
|
||||
QStyleOption op;
|
||||
op.init(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &op, &p, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,45 +1,45 @@
|
||||
#ifndef CALARMREPORT_H
|
||||
#define CALARMREPORT_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTableWidget>
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QPainter>
|
||||
#include "model_excel/xlsx/xlsxdocument.h"
|
||||
|
||||
namespace Ui {
|
||||
class CAlarmReport;
|
||||
}
|
||||
|
||||
class CAlarmReport : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CAlarmReport(QWidget *parent = 0);
|
||||
~CAlarmReport();
|
||||
|
||||
public:
|
||||
void initData( QTableWidget* pTableWidget );
|
||||
void loadConfig();
|
||||
|
||||
public slots:
|
||||
void slotPushButtonExportClicked( bool bChecked );
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *pEvent);
|
||||
|
||||
private:
|
||||
Ui::CAlarmReport *ui;
|
||||
int m_nNormalAlarmCount; // 普通告警条数,从配置中获取,大于此条数则认为异常
|
||||
int m_nSmartAlarmCount; // 智能告警条数,从配置中获取,大于此条数则认为异常
|
||||
};
|
||||
|
||||
#endif // CALARMREPORT_H
|
||||
#ifndef CALARMREPORT_H
|
||||
#define CALARMREPORT_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTableWidget>
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QPainter>
|
||||
#include "model_excel/xlsx/xlsxdocument.h"
|
||||
|
||||
namespace Ui {
|
||||
class CAlarmReport;
|
||||
}
|
||||
|
||||
class CAlarmReport : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CAlarmReport(QWidget *parent = 0);
|
||||
~CAlarmReport();
|
||||
|
||||
public:
|
||||
void initData( QTableWidget* pTableWidget );
|
||||
void loadConfig();
|
||||
|
||||
public slots:
|
||||
void slotPushButtonExportClicked( bool bChecked );
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *pEvent);
|
||||
|
||||
private:
|
||||
Ui::CAlarmReport *ui;
|
||||
int m_nNormalAlarmCount; // 普通告警条数,从配置中获取,大于此条数则认为异常
|
||||
int m_nSmartAlarmCount; // 智能告警条数,从配置中获取,大于此条数则认为异常
|
||||
};
|
||||
|
||||
#endif // CALARMREPORT_H
|
||||
|
||||
@ -1,73 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAlarmReport</class>
|
||||
<widget class="QWidget" name="CAlarmReport">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>762</width>
|
||||
<height>431</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="CTableWidget" name="tableWidget"/>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_export">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>导出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CTableWidget</class>
|
||||
<extends>QTableWidget</extends>
|
||||
<header>CTableWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAlarmReport</class>
|
||||
<widget class="QWidget" name="CAlarmReport">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>762</width>
|
||||
<height>431</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="CTableWidget" name="tableWidget"/>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_export">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>导出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CTableWidget</class>
|
||||
<extends>QTableWidget</extends>
|
||||
<header>CTableWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,119 +1,119 @@
|
||||
#ifndef CALARMSTATISTICS_H
|
||||
#define CALARMSTATISTICS_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMenuBar>
|
||||
#include <QToolBar>
|
||||
#include <QStatusBar>
|
||||
#include <QPointF>
|
||||
#include <QLabel>
|
||||
#include <QList>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QSqlQuery>
|
||||
#include <QMessageBox>
|
||||
#include <QCalendarWidget>
|
||||
#include <QMap>
|
||||
#include <QListWidget>
|
||||
#include <QColor>
|
||||
#include <QTableView>
|
||||
#include <QtCharts/QChart>
|
||||
#include <QtCharts/QChartView>
|
||||
#include <QtCharts/QStackedBarSeries>
|
||||
#include <QtCharts/QBarSet>
|
||||
#include <QtCharts/QLegend>
|
||||
#include <QtCharts/QBarCategoryAxis>
|
||||
#include <QtCharts/QBarSeries>
|
||||
#include "CAlarmModel.h"
|
||||
#include "CAlarmLevelComboBox.h"
|
||||
#include "SAlarmLevel.h"
|
||||
#include "CProcessDialog.h"
|
||||
#include "CStatisticsQueryThread.h"
|
||||
#include "CAlarmCompare.h"
|
||||
#include "CWaveListDialog.h"
|
||||
#include "CAlarmStatisticsPluginWidget.h"
|
||||
#include "CAlarmReport.h"
|
||||
|
||||
QT_CHARTS_USE_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class CAlarmStatistics;
|
||||
}
|
||||
|
||||
class CAlarmStatistics : public CAlarmStatisticsPluginWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor chartBackground READ chartBackground WRITE setChartBackground)
|
||||
Q_PROPERTY(QColor chartLabelColor READ chartLabelColor WRITE setChartLabelColor)
|
||||
Q_PROPERTY(QColor chartLineColor READ chartLineColor WRITE setChartLineColor)
|
||||
public:
|
||||
explicit CAlarmStatistics(QWidget *parent = 0, bool editMode = true);
|
||||
~CAlarmStatistics();
|
||||
|
||||
public:
|
||||
void initialize( int nMode );
|
||||
void initVariate();
|
||||
void initUi();
|
||||
void initBar();
|
||||
void initLevelChoose();
|
||||
void loadData();
|
||||
void resetUi();
|
||||
void resetBar();
|
||||
void showBar();
|
||||
|
||||
QColor chartBackground();
|
||||
void setChartBackground(const QColor& color);
|
||||
|
||||
QColor chartLabelColor();
|
||||
void setChartLabelColor(const QColor& color);
|
||||
|
||||
QColor chartLineColor();
|
||||
void setChartLineColor(const QColor& color);
|
||||
|
||||
public slots:
|
||||
void slotBarMouseMoveHovered( bool bStatus, int nIndex, QBarSet* pBarset );
|
||||
void slotBarClicked( int nIndex, QBarSet* pBarset );
|
||||
void slotCheckBoxStateChanged( int );
|
||||
void slotQueryEnd();
|
||||
void slotPushButtonQueryClicked( bool bChecked = false );
|
||||
void slotPushButtonCompareClicked( bool bChecked = false );
|
||||
void slotTableViewAlarmClicked( const QModelIndex& index );
|
||||
void slotPushButtonReportClicked( bool bCheaked = false );
|
||||
void slotTableWidgetLocationCellClicked( int nRow, int nColumn );
|
||||
void slotSetHiddenReport(bool hide);
|
||||
void slotSetHiddenOptColumn(bool hide);
|
||||
|
||||
signals:
|
||||
void signalShowYCHistoryData( QString sYCTagName, qint64 nDateTimeMs );
|
||||
|
||||
protected:
|
||||
void resizeEvent( QResizeEvent* pEvent );
|
||||
|
||||
private:
|
||||
bool m_bEditMode;// 是否编辑态
|
||||
bool m_bAfterMsgBox;// 是否是在弹出告警条数过多之后第一次进入显示提示窗口的函数
|
||||
|
||||
int m_nLastRow;
|
||||
|
||||
Ui::CAlarmStatistics *ui;
|
||||
CStatisticsQueryThread* m_pQueryThread;// 查询数据线程
|
||||
QChart *m_pChart;// 柱状图
|
||||
QLabel* m_pLabelValue;// 鼠标移动到柱状图上显示的提示窗口
|
||||
QList<QBarSet*> m_listBarSetNormal;
|
||||
QList<QBarSet*> m_listBarSetSmart;
|
||||
CAlarmLevelComboBox* m_pAlarmLevelComboBox;// 告警级别选择的下拉框
|
||||
QList<QCheckBox*> m_listAlarmLevelCheckBox;// 柱状图告警等级选择的复选框集合
|
||||
CProcessDialog* m_pProcessDialog;// 等待窗口
|
||||
CAlarmCompare* m_pAlarmCompare;// 告警比对窗口
|
||||
CAlarmReport* m_pAlarmReport;// 告警比对窗口
|
||||
CWaveListDialog* m_pWageListDialog;// 录波文件列表框
|
||||
|
||||
QStackedBarSeries* m_pBarSeriesNormal;
|
||||
QStackedBarSeries* m_pBarSeriesSmart;
|
||||
|
||||
QColor m_chartBackground;
|
||||
QColor m_chartLabelColor;
|
||||
QColor m_chartLineColor;
|
||||
};
|
||||
|
||||
#endif // CALARMSTATISTICS_H
|
||||
#ifndef CALARMSTATISTICS_H
|
||||
#define CALARMSTATISTICS_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMenuBar>
|
||||
#include <QToolBar>
|
||||
#include <QStatusBar>
|
||||
#include <QPointF>
|
||||
#include <QLabel>
|
||||
#include <QList>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QSqlQuery>
|
||||
#include <QMessageBox>
|
||||
#include <QCalendarWidget>
|
||||
#include <QMap>
|
||||
#include <QListWidget>
|
||||
#include <QColor>
|
||||
#include <QTableView>
|
||||
#include <QtCharts/QChart>
|
||||
#include <QtCharts/QChartView>
|
||||
#include <QtCharts/QStackedBarSeries>
|
||||
#include <QtCharts/QBarSet>
|
||||
#include <QtCharts/QLegend>
|
||||
#include <QtCharts/QBarCategoryAxis>
|
||||
#include <QtCharts/QBarSeries>
|
||||
#include "CAlarmModel.h"
|
||||
#include "CAlarmLevelComboBox.h"
|
||||
#include "SAlarmLevel.h"
|
||||
#include "CProcessDialog.h"
|
||||
#include "CStatisticsQueryThread.h"
|
||||
#include "CAlarmCompare.h"
|
||||
#include "CWaveListDialog.h"
|
||||
#include "CAlarmStatisticsPluginWidget.h"
|
||||
#include "CAlarmReport.h"
|
||||
|
||||
QT_CHARTS_USE_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class CAlarmStatistics;
|
||||
}
|
||||
|
||||
class CAlarmStatistics : public CAlarmStatisticsPluginWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor chartBackground READ chartBackground WRITE setChartBackground)
|
||||
Q_PROPERTY(QColor chartLabelColor READ chartLabelColor WRITE setChartLabelColor)
|
||||
Q_PROPERTY(QColor chartLineColor READ chartLineColor WRITE setChartLineColor)
|
||||
public:
|
||||
explicit CAlarmStatistics(QWidget *parent = 0, bool editMode = true);
|
||||
~CAlarmStatistics();
|
||||
|
||||
public:
|
||||
void initialize( int nMode );
|
||||
void initVariate();
|
||||
void initUi();
|
||||
void initBar();
|
||||
void initLevelChoose();
|
||||
void loadData();
|
||||
void resetUi();
|
||||
void resetBar();
|
||||
void showBar();
|
||||
|
||||
QColor chartBackground();
|
||||
void setChartBackground(const QColor& color);
|
||||
|
||||
QColor chartLabelColor();
|
||||
void setChartLabelColor(const QColor& color);
|
||||
|
||||
QColor chartLineColor();
|
||||
void setChartLineColor(const QColor& color);
|
||||
|
||||
public slots:
|
||||
void slotBarMouseMoveHovered( bool bStatus, int nIndex, QBarSet* pBarset );
|
||||
void slotBarClicked( int nIndex, QBarSet* pBarset );
|
||||
void slotCheckBoxStateChanged( int );
|
||||
void slotQueryEnd();
|
||||
void slotPushButtonQueryClicked( bool bChecked = false );
|
||||
void slotPushButtonCompareClicked( bool bChecked = false );
|
||||
void slotTableViewAlarmClicked( const QModelIndex& index );
|
||||
void slotPushButtonReportClicked( bool bCheaked = false );
|
||||
void slotTableWidgetLocationCellClicked( int nRow, int nColumn );
|
||||
void slotSetHiddenReport(bool hide);
|
||||
void slotSetHiddenOptColumn(bool hide);
|
||||
|
||||
signals:
|
||||
void signalShowYCHistoryData( QString sYCTagName, qint64 nDateTimeMs );
|
||||
|
||||
protected:
|
||||
void resizeEvent( QResizeEvent* pEvent );
|
||||
|
||||
private:
|
||||
bool m_bEditMode;// 是否编辑态
|
||||
bool m_bAfterMsgBox;// 是否是在弹出告警条数过多之后第一次进入显示提示窗口的函数
|
||||
|
||||
int m_nLastRow;
|
||||
|
||||
Ui::CAlarmStatistics *ui;
|
||||
CStatisticsQueryThread* m_pQueryThread;// 查询数据线程
|
||||
QChart *m_pChart;// 柱状图
|
||||
QLabel* m_pLabelValue;// 鼠标移动到柱状图上显示的提示窗口
|
||||
QList<QBarSet*> m_listBarSetNormal;
|
||||
QList<QBarSet*> m_listBarSetSmart;
|
||||
CAlarmLevelComboBox* m_pAlarmLevelComboBox;// 告警级别选择的下拉框
|
||||
QList<QCheckBox*> m_listAlarmLevelCheckBox;// 柱状图告警等级选择的复选框集合
|
||||
CProcessDialog* m_pProcessDialog;// 等待窗口
|
||||
CAlarmCompare* m_pAlarmCompare;// 告警比对窗口
|
||||
CAlarmReport* m_pAlarmReport;// 告警比对窗口
|
||||
CWaveListDialog* m_pWageListDialog;// 录波文件列表框
|
||||
|
||||
QStackedBarSeries* m_pBarSeriesNormal;
|
||||
QStackedBarSeries* m_pBarSeriesSmart;
|
||||
|
||||
QColor m_chartBackground;
|
||||
QColor m_chartLabelColor;
|
||||
QColor m_chartLineColor;
|
||||
};
|
||||
|
||||
#endif // CALARMSTATISTICS_H
|
||||
|
||||
@ -1,451 +1,451 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAlarmStatistics</class>
|
||||
<widget class="QWidget" name="CAlarmStatistics">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>989</width>
|
||||
<height>641</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>CAlarmStatistics</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>位置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_location">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 告警等级</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_level">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 时间段</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit_start">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>yyyy-MM-dd</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit_end">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>yyyy-MM-dd</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_keyWord">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>告警内容关键字</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_query">
|
||||
<property name="text">
|
||||
<string>查询</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="CTableWidget" name="tableWidget_location"/>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame_bar">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alarm_normal">
|
||||
<property name="text">
|
||||
<string>普通告警</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alarm_smart">
|
||||
<property name="text">
|
||||
<string>智能告警</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame_alarm">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_compare">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>告警比对</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_report">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>分析报告</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CTableView" name="tableView_alarm">
|
||||
<property name="statusTip">
|
||||
<string>22</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>33</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CTableWidget</class>
|
||||
<extends>QTableWidget</extends>
|
||||
<header>CTableWidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>CTableView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>CTableWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAlarmStatistics</class>
|
||||
<widget class="QWidget" name="CAlarmStatistics">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>989</width>
|
||||
<height>641</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>CAlarmStatistics</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>位置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_location">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 告警等级</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_level">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 时间段</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit_start">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>yyyy-MM-dd</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit_end">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string>yyyy-MM-dd</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_keyWord">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>告警内容关键字</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_query">
|
||||
<property name="text">
|
||||
<string>查询</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="CTableWidget" name="tableWidget_location"/>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame_bar">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alarm_normal">
|
||||
<property name="text">
|
||||
<string>普通告警</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_alarm_smart">
|
||||
<property name="text">
|
||||
<string>智能告警</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame_alarm">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_compare">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>告警比对</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_report">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>分析报告</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CTableView" name="tableView_alarm">
|
||||
<property name="statusTip">
|
||||
<string>22</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>33</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CTableWidget</class>
|
||||
<extends>QTableWidget</extends>
|
||||
<header>CTableWidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>CTableView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>CTableWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
#include <QWidget>
|
||||
#include "CAlarmStatisticsPluginWidget.h"
|
||||
#include "CAlarmStatistics.h"
|
||||
|
||||
CAlarmStatisticsPluginWidget::CAlarmStatisticsPluginWidget(QWidget *parent): QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CAlarmStatisticsPluginWidget::~CAlarmStatisticsPluginWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CAlarmStatisticsPluginWidget::createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec)
|
||||
{
|
||||
Q_UNUSED(ptrVec)
|
||||
CAlarmStatistics *pWidget = new CAlarmStatistics(parent, editMode);
|
||||
//pWidget->initialize((int)E_Alarm_Dock);
|
||||
*widget = (QWidget *)pWidget;
|
||||
*alarmWidget = (IPluginWidget *)pWidget;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CAlarmStatisticsPluginWidget::release()
|
||||
{
|
||||
|
||||
}
|
||||
#include <QWidget>
|
||||
#include "CAlarmStatisticsPluginWidget.h"
|
||||
#include "CAlarmStatistics.h"
|
||||
|
||||
CAlarmStatisticsPluginWidget::CAlarmStatisticsPluginWidget(QWidget *parent): QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CAlarmStatisticsPluginWidget::~CAlarmStatisticsPluginWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CAlarmStatisticsPluginWidget::createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec)
|
||||
{
|
||||
Q_UNUSED(ptrVec)
|
||||
CAlarmStatistics *pWidget = new CAlarmStatistics(parent, editMode);
|
||||
//pWidget->initialize((int)E_Alarm_Dock);
|
||||
*widget = (QWidget *)pWidget;
|
||||
*alarmWidget = (IPluginWidget *)pWidget;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CAlarmStatisticsPluginWidget::release()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -1,29 +1,29 @@
|
||||
#ifndef CALARMSTATISTICSPLUGINWIDGET_H
|
||||
#define CALARMSTATISTICSPLUGINWIDGET_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include "GraphShape/CPluginWidget.h" //< ISCS6000_HOME/platform/src/include/gui/GraphShape
|
||||
|
||||
class CAlarmStatisticsPluginWidget : public QWidget, public CPluginWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID)
|
||||
Q_INTERFACES(CPluginWidgetInterface)
|
||||
|
||||
public:
|
||||
CAlarmStatisticsPluginWidget(QWidget *parent = 0);
|
||||
~CAlarmStatisticsPluginWidget();
|
||||
|
||||
bool createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec);
|
||||
void release();
|
||||
};
|
||||
|
||||
#endif //CALARMSTATISTICSPLUGINWIDGET_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CALARMSTATISTICSPLUGINWIDGET_H
|
||||
#define CALARMSTATISTICSPLUGINWIDGET_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include "GraphShape/CPluginWidget.h" //< ISCS6000_HOME/platform/src/include/gui/GraphShape
|
||||
|
||||
class CAlarmStatisticsPluginWidget : public QWidget, public CPluginWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
||||
Q_INTERFACES(CPluginWidgetInterface)
|
||||
|
||||
public:
|
||||
CAlarmStatisticsPluginWidget(QWidget *parent = 0);
|
||||
~CAlarmStatisticsPluginWidget();
|
||||
|
||||
bool createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec);
|
||||
void release();
|
||||
};
|
||||
|
||||
#endif //CALARMSTATISTICSPLUGINWIDGET_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,267 +1,267 @@
|
||||
#include "CCompareQueryThread.h"
|
||||
|
||||
using namespace iot_public;
|
||||
using namespace iot_dbms;
|
||||
|
||||
CCompareQueryThread::CCompareQueryThread()
|
||||
{
|
||||
initVariate();
|
||||
loadData();
|
||||
clear();
|
||||
}
|
||||
|
||||
CCompareQueryThread::~CCompareQueryThread()
|
||||
{
|
||||
delete m_pDb;
|
||||
m_pDb = NULL;
|
||||
|
||||
delete m_pAlarmModel;
|
||||
m_pAlarmModel = NULL;
|
||||
|
||||
qDeleteAll( m_listAlarmLevel );
|
||||
m_listAlarmLevel.clear();
|
||||
}
|
||||
|
||||
void CCompareQueryThread::setHiddenOptColumn(bool hide)
|
||||
{
|
||||
if(m_pAlarmModel)
|
||||
{
|
||||
m_pAlarmModel->setHiddenOptColumn(hide);
|
||||
}
|
||||
}
|
||||
|
||||
void CCompareQueryThread::initVariate()
|
||||
{
|
||||
m_pAlarmModel = new CAlarmModel();
|
||||
|
||||
m_listAlarmLevelColor.push_back( QColor(255,0,0) );
|
||||
m_listAlarmLevelColor.push_back( QColor(255,116,20) );
|
||||
m_listAlarmLevelColor.push_back( QColor(187,226,66) );
|
||||
m_listAlarmLevelColor.push_back( QColor(144,230,189) );
|
||||
m_listAlarmLevelColor.push_back( QColor(244,228,151) );
|
||||
|
||||
m_nLastId = -1;
|
||||
m_nLastIndex = -1;
|
||||
}
|
||||
|
||||
void CCompareQueryThread::loadData()
|
||||
{
|
||||
m_pDb = new CDbApi(DB_CONN_MODEL_READ);
|
||||
if ( m_pDb->open() )
|
||||
{
|
||||
LOGINFO("initialize and open database success!");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGERROR("initialize or open database failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
LOGINFO("DatabaseName: [%s]", m_pDb->getCurrentDbPara().getDatabaseName().toStdString().c_str());
|
||||
LOGINFO("HostName: [%s]", m_pDb->getCurrentDbPara().getHostName().toStdString().c_str());
|
||||
LOGINFO("UserName: [%s]", m_pDb->getCurrentDbPara().getUserName().toStdString().c_str());
|
||||
|
||||
// 查询位置信息
|
||||
QSqlQuery query;
|
||||
QString sSql = "select LOCATION_ID,DESCRIPTION from sys_model_location_info order by LOCATION_NO";
|
||||
m_pDb->execute(sSql, query);
|
||||
while( query.next() )
|
||||
{
|
||||
SLocation* pLocation = new SLocation;
|
||||
pLocation->nId = query.value(0).toInt();
|
||||
pLocation->sName = query.value(1).toString();
|
||||
m_listLocation << pLocation;
|
||||
}
|
||||
query.clear();
|
||||
|
||||
// 查询设备组信息
|
||||
for ( int i=0; i<m_listLocation.count(); i++ )
|
||||
{
|
||||
sSql = QString("select TAG_NAME,DESCRIPTION from dev_group where LOCATION_ID=%1")
|
||||
.arg( m_listLocation.at(i)->nId );
|
||||
m_pDb->execute(sSql, query);
|
||||
while( query.next() )
|
||||
{
|
||||
SDeviceGroup* pDeviceGroup = new SDeviceGroup;
|
||||
pDeviceGroup->sTagName = query.value(0).toString();
|
||||
pDeviceGroup->sName = query.value(1).toString();
|
||||
m_listLocation[i]->listDeviceGroup << pDeviceGroup;
|
||||
}
|
||||
query.clear();
|
||||
}
|
||||
|
||||
// 查询告警等级信息
|
||||
sSql = "select PRIORITY_ID,PRIORITY_ORDER,PRIORITY_NAME from alarm_level_define order by PRIORITY_ORDER";
|
||||
m_pDb->execute(sSql, query);
|
||||
while( query.next() )
|
||||
{
|
||||
SAlarmLevel* pAlarmLevel = new SAlarmLevel;
|
||||
pAlarmLevel->nId = query.value(0).toInt();
|
||||
pAlarmLevel->nPriority = query.value(1).toInt();
|
||||
pAlarmLevel->sName = query.value(2).toString();
|
||||
m_listAlarmLevel.append( pAlarmLevel );
|
||||
}
|
||||
query.clear();
|
||||
}
|
||||
|
||||
void CCompareQueryThread::clear()
|
||||
{
|
||||
m_bCancel = false;
|
||||
m_nCurrentLocationIndex = 0;
|
||||
m_nStartMs = 0;
|
||||
m_nEndMs = 0;
|
||||
m_sSelectedLevel = "";
|
||||
|
||||
// 清空告警显示
|
||||
m_pAlarmModel->beginReset();
|
||||
m_pAlarmModel->clearAlarmList();
|
||||
m_pAlarmModel->endReset();
|
||||
|
||||
// 清空告警详细信息
|
||||
for ( int i=0; i<m_listAlarm.count(); i++ )
|
||||
qDeleteAll( m_listAlarm.at(i) );
|
||||
m_listAlarm.clear();
|
||||
|
||||
// 清空时间点
|
||||
m_listTimePoint.clear();
|
||||
|
||||
// 清空设备选择框
|
||||
m_listCheckBox.clear();
|
||||
}
|
||||
|
||||
void CCompareQueryThread::calcTimePoint()
|
||||
{
|
||||
qint64 nStart = m_nStartMs;
|
||||
qint64 nEnd = m_nEndMs;
|
||||
qint64 nOneDayMs = 24ll*60*60*1000;
|
||||
if ( m_eDateType == EN_DateType_Day )
|
||||
{
|
||||
while ( nStart < nEnd )
|
||||
{
|
||||
m_listTimePoint << nStart;
|
||||
nStart = nStart + nOneDayMs;
|
||||
}
|
||||
m_listTimePoint << nEnd;
|
||||
}
|
||||
else if ( m_eDateType == EN_DateType_Month )
|
||||
{
|
||||
while ( nStart < nEnd )
|
||||
{
|
||||
m_listTimePoint << nStart;
|
||||
nStart = nStart + nOneDayMs;
|
||||
while ( QDateTime::fromMSecsSinceEpoch(nStart).date().day() != 1 )
|
||||
nStart = nStart + nOneDayMs;
|
||||
}
|
||||
m_listTimePoint << nEnd;
|
||||
}
|
||||
}
|
||||
|
||||
void CCompareQueryThread::run()
|
||||
{
|
||||
// 根据选择的统计类型计算时间点
|
||||
calcTimePoint();
|
||||
|
||||
// 计算所有选择的站或者设备组
|
||||
for ( int i=0; i<m_listCheckBox.count(); i++ )
|
||||
{
|
||||
if ( m_bCancel )
|
||||
break;
|
||||
|
||||
QCheckBox* pCheckBox = m_listCheckBox.at(i);
|
||||
QList<SAlarmList*> tmpListAlarm;
|
||||
for ( int l=0; l<m_listTimePoint.count()-1; l++ )
|
||||
{
|
||||
if ( m_bCancel )
|
||||
break;
|
||||
|
||||
SAlarmList* pAlarmList = new SAlarmList;
|
||||
while ( pAlarmList->listLevelCount.count() < m_listAlarmLevel.count() )
|
||||
pAlarmList->listLevelCount.append(0);
|
||||
tmpListAlarm.append( pAlarmList );
|
||||
if ( m_eDateType == EN_DateType_Day )
|
||||
pAlarmList->sName = QDateTime::fromMSecsSinceEpoch(m_listTimePoint.at(l)).toString("yyyy-MM-dd");
|
||||
else if ( m_eDateType == EN_DateType_Month )
|
||||
pAlarmList->sName = QDateTime::fromMSecsSinceEpoch(m_listTimePoint.at(l)).toString("yyyy-MM");
|
||||
|
||||
QSqlQuery query;
|
||||
QString sSql = "";
|
||||
if ( m_nCurrentLocationIndex == 0 )
|
||||
{
|
||||
pAlarmList->nId = pCheckBox->property("id").toInt();
|
||||
sSql = QString("select TIME_STAMP,PRIORITY,CONTENT from %1 \
|
||||
where TIME_STAMP between %2 and %3 and LOCATION_ID=%4 and PRIORITY in(%5) \
|
||||
order by TIME_STAMP")
|
||||
.arg(CN_NORMALALARMTABLE).arg(m_listTimePoint.at(l))
|
||||
.arg(m_listTimePoint.at(l+1)).arg(pAlarmList->nId).arg(m_sSelectedLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
pAlarmList->sTagName = pCheckBox->property("id").toString();
|
||||
sSql = QString("select TIME_STAMP,PRIORITY,CONTENT from %1 \
|
||||
where TIME_STAMP between %2 and %3 and DEV_GROUP_TAG='%4' and PRIORITY in(%5) \
|
||||
order by TIME_STAMP")
|
||||
.arg(CN_NORMALALARMTABLE).arg(m_listTimePoint.at(l))
|
||||
.arg(m_listTimePoint.at(l+1)).arg(pAlarmList->sTagName).arg(m_sSelectedLevel);
|
||||
}
|
||||
m_pDb->execute(sSql, query);
|
||||
while( query.next() )
|
||||
{
|
||||
if ( m_bCancel )
|
||||
break;
|
||||
|
||||
// 有关键字
|
||||
if ( m_sKeyWord != "" )
|
||||
{
|
||||
if ( !query.value(2).toString().contains(m_sKeyWord) )
|
||||
continue;
|
||||
}
|
||||
|
||||
SAlarmLevel* pAlarmLevel = NULL;
|
||||
int nLevelIndex = getAlarmLevelIndexById( query.value(1).toInt(), pAlarmLevel );
|
||||
if ( nLevelIndex < 0 )
|
||||
continue;
|
||||
|
||||
pAlarmList->listLevelCount[nLevelIndex]++;
|
||||
if ( pAlarmList->listAlarmInfo.count() >= CN_ALARMINFO_MAXROW )
|
||||
continue;
|
||||
|
||||
SAlarmInfo* pAlarmInfo = new SAlarmInfo;
|
||||
pAlarmInfo->sTime = QDateTime::fromMSecsSinceEpoch(query.value(0).toULongLong()).toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
pAlarmInfo->sLevel = pAlarmLevel->sName;
|
||||
pAlarmInfo->sLocation = pCheckBox->text();
|
||||
pAlarmInfo->sContent = query.value(2).toString();
|
||||
pAlarmList->listAlarmInfo.append( pAlarmInfo );
|
||||
}
|
||||
signalQueryPercent( l*100/(m_listTimePoint.count()-1)/m_listCheckBox.count()
|
||||
+ i*100/m_listCheckBox.count() );
|
||||
query.clear();
|
||||
}
|
||||
m_listAlarm << tmpListAlarm;
|
||||
}
|
||||
|
||||
// 发送查询完成信号
|
||||
signalQueryEnd();
|
||||
}
|
||||
|
||||
int CCompareQueryThread::getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel )
|
||||
{
|
||||
if ( m_nLastId == nId && m_nLastIndex >= 0 )
|
||||
{
|
||||
pAlarmLevel = m_listAlarmLevel.at(m_nLastIndex);
|
||||
return m_nLastIndex;
|
||||
}
|
||||
|
||||
m_nLastId = nId;
|
||||
for ( int i=0; i<m_listAlarmLevel.count(); i++ )
|
||||
{
|
||||
if ( m_listAlarmLevel.at(i)->nId == nId )
|
||||
{
|
||||
m_nLastIndex = i;
|
||||
pAlarmLevel = m_listAlarmLevel.at(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return m_nLastIndex;
|
||||
}
|
||||
|
||||
|
||||
#include "CCompareQueryThread.h"
|
||||
|
||||
using namespace kbd_public;
|
||||
using namespace kbd_dbms;
|
||||
|
||||
CCompareQueryThread::CCompareQueryThread()
|
||||
{
|
||||
initVariate();
|
||||
loadData();
|
||||
clear();
|
||||
}
|
||||
|
||||
CCompareQueryThread::~CCompareQueryThread()
|
||||
{
|
||||
delete m_pDb;
|
||||
m_pDb = NULL;
|
||||
|
||||
delete m_pAlarmModel;
|
||||
m_pAlarmModel = NULL;
|
||||
|
||||
qDeleteAll( m_listAlarmLevel );
|
||||
m_listAlarmLevel.clear();
|
||||
}
|
||||
|
||||
void CCompareQueryThread::setHiddenOptColumn(bool hide)
|
||||
{
|
||||
if(m_pAlarmModel)
|
||||
{
|
||||
m_pAlarmModel->setHiddenOptColumn(hide);
|
||||
}
|
||||
}
|
||||
|
||||
void CCompareQueryThread::initVariate()
|
||||
{
|
||||
m_pAlarmModel = new CAlarmModel();
|
||||
|
||||
m_listAlarmLevelColor.push_back( QColor(255,0,0) );
|
||||
m_listAlarmLevelColor.push_back( QColor(255,116,20) );
|
||||
m_listAlarmLevelColor.push_back( QColor(187,226,66) );
|
||||
m_listAlarmLevelColor.push_back( QColor(144,230,189) );
|
||||
m_listAlarmLevelColor.push_back( QColor(244,228,151) );
|
||||
|
||||
m_nLastId = -1;
|
||||
m_nLastIndex = -1;
|
||||
}
|
||||
|
||||
void CCompareQueryThread::loadData()
|
||||
{
|
||||
m_pDb = new CDbApi(DB_CONN_MODEL_READ);
|
||||
if ( m_pDb->open() )
|
||||
{
|
||||
LOGINFO("initialize and open database success!");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGERROR("initialize or open database failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
LOGINFO("DatabaseName: [%s]", m_pDb->getCurrentDbPara().getDatabaseName().toStdString().c_str());
|
||||
LOGINFO("HostName: [%s]", m_pDb->getCurrentDbPara().getHostName().toStdString().c_str());
|
||||
LOGINFO("UserName: [%s]", m_pDb->getCurrentDbPara().getUserName().toStdString().c_str());
|
||||
|
||||
// 查询位置信息
|
||||
QSqlQuery query;
|
||||
QString sSql = "select LOCATION_ID,DESCRIPTION from sys_model_location_info order by LOCATION_NO";
|
||||
m_pDb->execute(sSql, query);
|
||||
while( query.next() )
|
||||
{
|
||||
SLocation* pLocation = new SLocation;
|
||||
pLocation->nId = query.value(0).toInt();
|
||||
pLocation->sName = query.value(1).toString();
|
||||
m_listLocation << pLocation;
|
||||
}
|
||||
query.clear();
|
||||
|
||||
// 查询设备组信息
|
||||
for ( int i=0; i<m_listLocation.count(); i++ )
|
||||
{
|
||||
sSql = QString("select TAG_NAME,DESCRIPTION from dev_group where LOCATION_ID=%1")
|
||||
.arg( m_listLocation.at(i)->nId );
|
||||
m_pDb->execute(sSql, query);
|
||||
while( query.next() )
|
||||
{
|
||||
SDeviceGroup* pDeviceGroup = new SDeviceGroup;
|
||||
pDeviceGroup->sTagName = query.value(0).toString();
|
||||
pDeviceGroup->sName = query.value(1).toString();
|
||||
m_listLocation[i]->listDeviceGroup << pDeviceGroup;
|
||||
}
|
||||
query.clear();
|
||||
}
|
||||
|
||||
// 查询告警等级信息
|
||||
sSql = "select PRIORITY_ID,PRIORITY_ORDER,PRIORITY_NAME from alarm_level_define order by PRIORITY_ORDER";
|
||||
m_pDb->execute(sSql, query);
|
||||
while( query.next() )
|
||||
{
|
||||
SAlarmLevel* pAlarmLevel = new SAlarmLevel;
|
||||
pAlarmLevel->nId = query.value(0).toInt();
|
||||
pAlarmLevel->nPriority = query.value(1).toInt();
|
||||
pAlarmLevel->sName = query.value(2).toString();
|
||||
m_listAlarmLevel.append( pAlarmLevel );
|
||||
}
|
||||
query.clear();
|
||||
}
|
||||
|
||||
void CCompareQueryThread::clear()
|
||||
{
|
||||
m_bCancel = false;
|
||||
m_nCurrentLocationIndex = 0;
|
||||
m_nStartMs = 0;
|
||||
m_nEndMs = 0;
|
||||
m_sSelectedLevel = "";
|
||||
|
||||
// 清空告警显示
|
||||
m_pAlarmModel->beginReset();
|
||||
m_pAlarmModel->clearAlarmList();
|
||||
m_pAlarmModel->endReset();
|
||||
|
||||
// 清空告警详细信息
|
||||
for ( int i=0; i<m_listAlarm.count(); i++ )
|
||||
qDeleteAll( m_listAlarm.at(i) );
|
||||
m_listAlarm.clear();
|
||||
|
||||
// 清空时间点
|
||||
m_listTimePoint.clear();
|
||||
|
||||
// 清空设备选择框
|
||||
m_listCheckBox.clear();
|
||||
}
|
||||
|
||||
void CCompareQueryThread::calcTimePoint()
|
||||
{
|
||||
qint64 nStart = m_nStartMs;
|
||||
qint64 nEnd = m_nEndMs;
|
||||
qint64 nOneDayMs = 24ll*60*60*1000;
|
||||
if ( m_eDateType == EN_DateType_Day )
|
||||
{
|
||||
while ( nStart < nEnd )
|
||||
{
|
||||
m_listTimePoint << nStart;
|
||||
nStart = nStart + nOneDayMs;
|
||||
}
|
||||
m_listTimePoint << nEnd;
|
||||
}
|
||||
else if ( m_eDateType == EN_DateType_Month )
|
||||
{
|
||||
while ( nStart < nEnd )
|
||||
{
|
||||
m_listTimePoint << nStart;
|
||||
nStart = nStart + nOneDayMs;
|
||||
while ( QDateTime::fromMSecsSinceEpoch(nStart).date().day() != 1 )
|
||||
nStart = nStart + nOneDayMs;
|
||||
}
|
||||
m_listTimePoint << nEnd;
|
||||
}
|
||||
}
|
||||
|
||||
void CCompareQueryThread::run()
|
||||
{
|
||||
// 根据选择的统计类型计算时间点
|
||||
calcTimePoint();
|
||||
|
||||
// 计算所有选择的站或者设备组
|
||||
for ( int i=0; i<m_listCheckBox.count(); i++ )
|
||||
{
|
||||
if ( m_bCancel )
|
||||
break;
|
||||
|
||||
QCheckBox* pCheckBox = m_listCheckBox.at(i);
|
||||
QList<SAlarmList*> tmpListAlarm;
|
||||
for ( int l=0; l<m_listTimePoint.count()-1; l++ )
|
||||
{
|
||||
if ( m_bCancel )
|
||||
break;
|
||||
|
||||
SAlarmList* pAlarmList = new SAlarmList;
|
||||
while ( pAlarmList->listLevelCount.count() < m_listAlarmLevel.count() )
|
||||
pAlarmList->listLevelCount.append(0);
|
||||
tmpListAlarm.append( pAlarmList );
|
||||
if ( m_eDateType == EN_DateType_Day )
|
||||
pAlarmList->sName = QDateTime::fromMSecsSinceEpoch(m_listTimePoint.at(l)).toString("yyyy-MM-dd");
|
||||
else if ( m_eDateType == EN_DateType_Month )
|
||||
pAlarmList->sName = QDateTime::fromMSecsSinceEpoch(m_listTimePoint.at(l)).toString("yyyy-MM");
|
||||
|
||||
QSqlQuery query;
|
||||
QString sSql = "";
|
||||
if ( m_nCurrentLocationIndex == 0 )
|
||||
{
|
||||
pAlarmList->nId = pCheckBox->property("id").toInt();
|
||||
sSql = QString("select TIME_STAMP,PRIORITY,CONTENT from %1 \
|
||||
where TIME_STAMP between %2 and %3 and LOCATION_ID=%4 and PRIORITY in(%5) \
|
||||
order by TIME_STAMP")
|
||||
.arg(CN_NORMALALARMTABLE).arg(m_listTimePoint.at(l))
|
||||
.arg(m_listTimePoint.at(l+1)).arg(pAlarmList->nId).arg(m_sSelectedLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
pAlarmList->sTagName = pCheckBox->property("id").toString();
|
||||
sSql = QString("select TIME_STAMP,PRIORITY,CONTENT from %1 \
|
||||
where TIME_STAMP between %2 and %3 and DEV_GROUP_TAG='%4' and PRIORITY in(%5) \
|
||||
order by TIME_STAMP")
|
||||
.arg(CN_NORMALALARMTABLE).arg(m_listTimePoint.at(l))
|
||||
.arg(m_listTimePoint.at(l+1)).arg(pAlarmList->sTagName).arg(m_sSelectedLevel);
|
||||
}
|
||||
m_pDb->execute(sSql, query);
|
||||
while( query.next() )
|
||||
{
|
||||
if ( m_bCancel )
|
||||
break;
|
||||
|
||||
// 有关键字
|
||||
if ( m_sKeyWord != "" )
|
||||
{
|
||||
if ( !query.value(2).toString().contains(m_sKeyWord) )
|
||||
continue;
|
||||
}
|
||||
|
||||
SAlarmLevel* pAlarmLevel = NULL;
|
||||
int nLevelIndex = getAlarmLevelIndexById( query.value(1).toInt(), pAlarmLevel );
|
||||
if ( nLevelIndex < 0 )
|
||||
continue;
|
||||
|
||||
pAlarmList->listLevelCount[nLevelIndex]++;
|
||||
if ( pAlarmList->listAlarmInfo.count() >= CN_ALARMINFO_MAXROW )
|
||||
continue;
|
||||
|
||||
SAlarmInfo* pAlarmInfo = new SAlarmInfo;
|
||||
pAlarmInfo->sTime = QDateTime::fromMSecsSinceEpoch(query.value(0).toULongLong()).toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
pAlarmInfo->sLevel = pAlarmLevel->sName;
|
||||
pAlarmInfo->sLocation = pCheckBox->text();
|
||||
pAlarmInfo->sContent = query.value(2).toString();
|
||||
pAlarmList->listAlarmInfo.append( pAlarmInfo );
|
||||
}
|
||||
signalQueryPercent( l*100/(m_listTimePoint.count()-1)/m_listCheckBox.count()
|
||||
+ i*100/m_listCheckBox.count() );
|
||||
query.clear();
|
||||
}
|
||||
m_listAlarm << tmpListAlarm;
|
||||
}
|
||||
|
||||
// 发送查询完成信号
|
||||
signalQueryEnd();
|
||||
}
|
||||
|
||||
int CCompareQueryThread::getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel )
|
||||
{
|
||||
if ( m_nLastId == nId && m_nLastIndex >= 0 )
|
||||
{
|
||||
pAlarmLevel = m_listAlarmLevel.at(m_nLastIndex);
|
||||
return m_nLastIndex;
|
||||
}
|
||||
|
||||
m_nLastId = nId;
|
||||
for ( int i=0; i<m_listAlarmLevel.count(); i++ )
|
||||
{
|
||||
if ( m_listAlarmLevel.at(i)->nId == nId )
|
||||
{
|
||||
m_nLastIndex = i;
|
||||
pAlarmLevel = m_listAlarmLevel.at(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return m_nLastIndex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,70 +1,70 @@
|
||||
#ifndef CCOMPAREQUERYTHREAD_H
|
||||
#define CCOMPAREQUERYTHREAD_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QList>
|
||||
#include <QGroupBox>
|
||||
#include <QCheckBox>
|
||||
#include "CommonDefine.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include "db_sysinfo_api/CDbSysInfo.h"
|
||||
#include "db_api_ex/CDbApi.h"
|
||||
#include "CAlarmModel.h"
|
||||
#include "SAlarmLevel.h"
|
||||
#include "SLocation.h"
|
||||
|
||||
class CCompareQueryThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum EN_DateType
|
||||
{
|
||||
EN_DateType_Day = 0,
|
||||
EN_DateType_Month = 1
|
||||
};
|
||||
|
||||
public:
|
||||
CCompareQueryThread();
|
||||
~CCompareQueryThread();
|
||||
|
||||
void setHiddenOptColumn(bool hide);
|
||||
signals:
|
||||
void signalQueryPercent( int nPercent );// 查询完成百分比
|
||||
void signalQueryEnd();// 查询结束
|
||||
|
||||
public slots:
|
||||
void slotCancel(){ m_bCancel = true; }
|
||||
|
||||
public:
|
||||
void initVariate();
|
||||
void loadData();
|
||||
void run();
|
||||
void clear();
|
||||
void calcTimePoint();
|
||||
int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel );
|
||||
|
||||
public:
|
||||
iot_dbms::CDbApi* m_pDb; // 数据库接口
|
||||
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
|
||||
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
|
||||
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表
|
||||
QList<QList<SAlarmList*> > m_listAlarm;// 第一层是设备集合,第二次是时间集合
|
||||
|
||||
int m_nCurrentLocationIndex;// 当前站序号,0表示全部站
|
||||
qint64 m_nStartMs;// 开始时间 ms
|
||||
qint64 m_nEndMs;// 结束时间 ms
|
||||
QString m_sSelectedLevel;// 已选择的告警等级
|
||||
bool m_bCancel;// 是否取消
|
||||
|
||||
QList<SLocation*> m_listLocation;// 位置信息列表
|
||||
QList<QCheckBox*> m_listCheckBox;// 选择列表(站或者设备组)
|
||||
EN_DateType m_eDateType;// 查询日期类型
|
||||
QList<qint64> m_listTimePoint;// 根据开始时间、结束时间、查询类型计算的时间点
|
||||
QString m_sKeyWord;// 查询关键字
|
||||
int m_nLastId;
|
||||
int m_nLastIndex;
|
||||
};
|
||||
|
||||
#endif // CCOMPAREQUERYTHREAD_H
|
||||
#ifndef CCOMPAREQUERYTHREAD_H
|
||||
#define CCOMPAREQUERYTHREAD_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QList>
|
||||
#include <QGroupBox>
|
||||
#include <QCheckBox>
|
||||
#include "CommonDefine.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include "db_sysinfo_api/CDbSysInfo.h"
|
||||
#include "db_api_ex/CDbApi.h"
|
||||
#include "CAlarmModel.h"
|
||||
#include "SAlarmLevel.h"
|
||||
#include "SLocation.h"
|
||||
|
||||
class CCompareQueryThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum EN_DateType
|
||||
{
|
||||
EN_DateType_Day = 0,
|
||||
EN_DateType_Month = 1
|
||||
};
|
||||
|
||||
public:
|
||||
CCompareQueryThread();
|
||||
~CCompareQueryThread();
|
||||
|
||||
void setHiddenOptColumn(bool hide);
|
||||
signals:
|
||||
void signalQueryPercent( int nPercent );// 查询完成百分比
|
||||
void signalQueryEnd();// 查询结束
|
||||
|
||||
public slots:
|
||||
void slotCancel(){ m_bCancel = true; }
|
||||
|
||||
public:
|
||||
void initVariate();
|
||||
void loadData();
|
||||
void run();
|
||||
void clear();
|
||||
void calcTimePoint();
|
||||
int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel );
|
||||
|
||||
public:
|
||||
kbd_dbms::CDbApi* m_pDb; // 数据库接口
|
||||
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
|
||||
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
|
||||
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表
|
||||
QList<QList<SAlarmList*> > m_listAlarm;// 第一层是设备集合,第二次是时间集合
|
||||
|
||||
int m_nCurrentLocationIndex;// 当前站序号,0表示全部站
|
||||
qint64 m_nStartMs;// 开始时间 ms
|
||||
qint64 m_nEndMs;// 结束时间 ms
|
||||
QString m_sSelectedLevel;// 已选择的告警等级
|
||||
bool m_bCancel;// 是否取消
|
||||
|
||||
QList<SLocation*> m_listLocation;// 位置信息列表
|
||||
QList<QCheckBox*> m_listCheckBox;// 选择列表(站或者设备组)
|
||||
EN_DateType m_eDateType;// 查询日期类型
|
||||
QList<qint64> m_listTimePoint;// 根据开始时间、结束时间、查询类型计算的时间点
|
||||
QString m_sKeyWord;// 查询关键字
|
||||
int m_nLastId;
|
||||
int m_nLastIndex;
|
||||
};
|
||||
|
||||
#endif // CCOMPAREQUERYTHREAD_H
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
#include "CProcessDialog.h"
|
||||
#include "ui_CProcessDialog.h"
|
||||
#include <QDebug>
|
||||
|
||||
CProcessDialog::CProcessDialog(QDialog *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CProcessDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags()|Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
|
||||
connect( ui->pb_cancel, SIGNAL(clicked(bool)), this, SLOT(slotPbcancelClicked(bool)), Qt::DirectConnection );
|
||||
}
|
||||
|
||||
CProcessDialog::~CProcessDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CProcessDialog::slotPbcancelClicked( bool )
|
||||
{
|
||||
signalCancel();
|
||||
}
|
||||
|
||||
void CProcessDialog::slotSetValue( int nValue )
|
||||
{
|
||||
ui->progressBar->setValue( nValue );
|
||||
}
|
||||
|
||||
void CProcessDialog::reset()
|
||||
{
|
||||
ui->progressBar->setValue( 0 );
|
||||
}
|
||||
#include "CProcessDialog.h"
|
||||
#include "ui_CProcessDialog.h"
|
||||
#include <QDebug>
|
||||
|
||||
CProcessDialog::CProcessDialog(QDialog *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CProcessDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags()|Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
|
||||
connect( ui->pb_cancel, SIGNAL(clicked(bool)), this, SLOT(slotPbcancelClicked(bool)), Qt::DirectConnection );
|
||||
}
|
||||
|
||||
CProcessDialog::~CProcessDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CProcessDialog::slotPbcancelClicked( bool )
|
||||
{
|
||||
signalCancel();
|
||||
}
|
||||
|
||||
void CProcessDialog::slotSetValue( int nValue )
|
||||
{
|
||||
ui->progressBar->setValue( nValue );
|
||||
}
|
||||
|
||||
void CProcessDialog::reset()
|
||||
{
|
||||
ui->progressBar->setValue( 0 );
|
||||
}
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
#ifndef CPROCESSDIALOG_H
|
||||
#define CPROCESSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class CProcessDialog;
|
||||
}
|
||||
|
||||
class CProcessDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CProcessDialog(QDialog *parent = 0);
|
||||
~CProcessDialog();
|
||||
|
||||
signals:
|
||||
void signalCancel();
|
||||
|
||||
public slots:
|
||||
void slotPbcancelClicked( bool bChecked );
|
||||
void slotSetValue( int nValue );
|
||||
|
||||
public:
|
||||
void reset();
|
||||
|
||||
private:
|
||||
Ui::CProcessDialog *ui;
|
||||
};
|
||||
|
||||
#endif // CPROCESSDIALOG_H
|
||||
#ifndef CPROCESSDIALOG_H
|
||||
#define CPROCESSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class CProcessDialog;
|
||||
}
|
||||
|
||||
class CProcessDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CProcessDialog(QDialog *parent = 0);
|
||||
~CProcessDialog();
|
||||
|
||||
signals:
|
||||
void signalCancel();
|
||||
|
||||
public slots:
|
||||
void slotPbcancelClicked( bool bChecked );
|
||||
void slotSetValue( int nValue );
|
||||
|
||||
public:
|
||||
void reset();
|
||||
|
||||
private:
|
||||
Ui::CProcessDialog *ui;
|
||||
};
|
||||
|
||||
#endif // CPROCESSDIALOG_H
|
||||
|
||||
@ -1,71 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CProcessDialog</class>
|
||||
<widget class="QWidget" name="CProcessDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_cancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CProcessDialog</class>
|
||||
<widget class="QWidget" name="CProcessDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_cancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,57 +1,57 @@
|
||||
#ifndef CSTATISTICSQUERYTHREAD_H
|
||||
#define CSTATISTICSQUERYTHREAD_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QList>
|
||||
#include "CommonDefine.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include "db_sysinfo_api/CDbSysInfo.h"
|
||||
#include "db_api_ex/CDbApi.h"
|
||||
#include "CAlarmModel.h"
|
||||
#include "SAlarmLevel.h"
|
||||
#include "SLocation.h"
|
||||
|
||||
class CStatisticsQueryThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CStatisticsQueryThread();
|
||||
~CStatisticsQueryThread();
|
||||
|
||||
void setHiddenOptColumn(bool hide);
|
||||
signals:
|
||||
void signalQueryPercent( int nPercent );// 查询完成百分比
|
||||
void signalQueryEnd();// 查询结束
|
||||
|
||||
public slots:
|
||||
void slotCancel(){ m_bCancel = true; }
|
||||
|
||||
public:
|
||||
void initVariate();
|
||||
void loadData();
|
||||
void run();
|
||||
void clear();
|
||||
int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel );
|
||||
void getWavePath( QString sAppTagName, QString& sPath, QString& sErrorMsg );
|
||||
|
||||
public:
|
||||
iot_dbms::CDbApi* m_pDb; // 数据库接口
|
||||
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
|
||||
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
|
||||
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表
|
||||
QList<SAlarmList*> m_listAlarmNormal; // 所有站或者一个站的所有设备组的普通告警列表
|
||||
QList<SAlarmList*> m_listAlarmSmart; // 所有站或者一个站的所有设备组的智能告警列表
|
||||
QList<SLocation*> m_listLocation; // 位置信息列表
|
||||
int m_nCurrentLocationIndex;
|
||||
qint64 m_nStartMs;
|
||||
qint64 m_nEndMs;
|
||||
QString m_sSelectedLevel;
|
||||
bool m_bCancel;
|
||||
QString m_sKeyWord;// 查询关键字
|
||||
int m_nLastId;
|
||||
int m_nLastIndex;
|
||||
};
|
||||
|
||||
#endif // CSTATISTICSQUERYTHREAD_H
|
||||
#ifndef CSTATISTICSQUERYTHREAD_H
|
||||
#define CSTATISTICSQUERYTHREAD_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QList>
|
||||
#include "CommonDefine.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include "db_sysinfo_api/CDbSysInfo.h"
|
||||
#include "db_api_ex/CDbApi.h"
|
||||
#include "CAlarmModel.h"
|
||||
#include "SAlarmLevel.h"
|
||||
#include "SLocation.h"
|
||||
|
||||
class CStatisticsQueryThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CStatisticsQueryThread();
|
||||
~CStatisticsQueryThread();
|
||||
|
||||
void setHiddenOptColumn(bool hide);
|
||||
signals:
|
||||
void signalQueryPercent( int nPercent );// 查询完成百分比
|
||||
void signalQueryEnd();// 查询结束
|
||||
|
||||
public slots:
|
||||
void slotCancel(){ m_bCancel = true; }
|
||||
|
||||
public:
|
||||
void initVariate();
|
||||
void loadData();
|
||||
void run();
|
||||
void clear();
|
||||
int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel );
|
||||
void getWavePath( QString sAppTagName, QString& sPath, QString& sErrorMsg );
|
||||
|
||||
public:
|
||||
kbd_dbms::CDbApi* m_pDb; // 数据库接口
|
||||
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
|
||||
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
|
||||
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表
|
||||
QList<SAlarmList*> m_listAlarmNormal; // 所有站或者一个站的所有设备组的普通告警列表
|
||||
QList<SAlarmList*> m_listAlarmSmart; // 所有站或者一个站的所有设备组的智能告警列表
|
||||
QList<SLocation*> m_listLocation; // 位置信息列表
|
||||
int m_nCurrentLocationIndex;
|
||||
qint64 m_nStartMs;
|
||||
qint64 m_nEndMs;
|
||||
QString m_sSelectedLevel;
|
||||
bool m_bCancel;
|
||||
QString m_sKeyWord;// 查询关键字
|
||||
int m_nLastId;
|
||||
int m_nLastIndex;
|
||||
};
|
||||
|
||||
#endif // CSTATISTICSQUERYTHREAD_H
|
||||
|
||||
@ -1,62 +1,62 @@
|
||||
#include "CTableWidget.h"
|
||||
#include <QHeaderView>
|
||||
|
||||
CTableWidget::CTableWidget(QWidget *parent)
|
||||
: QTableWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CTableWidget::tableColumnWidth()
|
||||
{
|
||||
return m_nTableColWidth;
|
||||
}
|
||||
|
||||
void CTableWidget::setTableColumnWidth(const int &nWidth)
|
||||
{
|
||||
m_nTableColWidth = nWidth;
|
||||
|
||||
horizontalHeader()->setDefaultSectionSize(m_nTableColWidth);
|
||||
}
|
||||
|
||||
int CTableWidget::tableRowHeight()
|
||||
{
|
||||
return m_nTableRowHeight;
|
||||
}
|
||||
|
||||
void CTableWidget::setTableRowHeight(const int &nHeight)
|
||||
{
|
||||
m_nTableRowHeight = nHeight;
|
||||
|
||||
verticalHeader()->setDefaultSectionSize(m_nTableRowHeight);
|
||||
}
|
||||
|
||||
CTableView::CTableView(QWidget *parent)
|
||||
: QTableView(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CTableView::tableColumnWidth()
|
||||
{
|
||||
return m_nTableColWidth;
|
||||
}
|
||||
|
||||
void CTableView::setTableColumnWidth(const int &nWidth)
|
||||
{
|
||||
m_nTableColWidth = nWidth;
|
||||
|
||||
horizontalHeader()->setDefaultSectionSize(m_nTableColWidth);
|
||||
}
|
||||
|
||||
int CTableView::tableRowHeight()
|
||||
{
|
||||
return m_nTableRowHeight;
|
||||
}
|
||||
|
||||
void CTableView::setTableRowHeight(const int &nHeight)
|
||||
{
|
||||
m_nTableRowHeight = nHeight;
|
||||
|
||||
verticalHeader()->setDefaultSectionSize(m_nTableRowHeight);
|
||||
}
|
||||
#include "CTableWidget.h"
|
||||
#include <QHeaderView>
|
||||
|
||||
CTableWidget::CTableWidget(QWidget *parent)
|
||||
: QTableWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CTableWidget::tableColumnWidth()
|
||||
{
|
||||
return m_nTableColWidth;
|
||||
}
|
||||
|
||||
void CTableWidget::setTableColumnWidth(const int &nWidth)
|
||||
{
|
||||
m_nTableColWidth = nWidth;
|
||||
|
||||
horizontalHeader()->setDefaultSectionSize(m_nTableColWidth);
|
||||
}
|
||||
|
||||
int CTableWidget::tableRowHeight()
|
||||
{
|
||||
return m_nTableRowHeight;
|
||||
}
|
||||
|
||||
void CTableWidget::setTableRowHeight(const int &nHeight)
|
||||
{
|
||||
m_nTableRowHeight = nHeight;
|
||||
|
||||
verticalHeader()->setDefaultSectionSize(m_nTableRowHeight);
|
||||
}
|
||||
|
||||
CTableView::CTableView(QWidget *parent)
|
||||
: QTableView(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CTableView::tableColumnWidth()
|
||||
{
|
||||
return m_nTableColWidth;
|
||||
}
|
||||
|
||||
void CTableView::setTableColumnWidth(const int &nWidth)
|
||||
{
|
||||
m_nTableColWidth = nWidth;
|
||||
|
||||
horizontalHeader()->setDefaultSectionSize(m_nTableColWidth);
|
||||
}
|
||||
|
||||
int CTableView::tableRowHeight()
|
||||
{
|
||||
return m_nTableRowHeight;
|
||||
}
|
||||
|
||||
void CTableView::setTableRowHeight(const int &nHeight)
|
||||
{
|
||||
m_nTableRowHeight = nHeight;
|
||||
|
||||
verticalHeader()->setDefaultSectionSize(m_nTableRowHeight);
|
||||
}
|
||||
|
||||
@ -1,46 +1,46 @@
|
||||
#ifndef CTABLEWIDGET_H
|
||||
#define CTABLEWIDGET_H
|
||||
|
||||
#include <QTableWidget>
|
||||
|
||||
class CTableWidget : public QTableWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int tableColumnWidth READ tableColumnWidth WRITE setTableColumnWidth)
|
||||
Q_PROPERTY(int tableRowHeight READ tableRowHeight WRITE setTableRowHeight)
|
||||
|
||||
public:
|
||||
CTableWidget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
int tableColumnWidth();
|
||||
void setTableColumnWidth(const int &nWidth);
|
||||
|
||||
int tableRowHeight();
|
||||
void setTableRowHeight(const int &nHeight);
|
||||
|
||||
private:
|
||||
int m_nTableColWidth;
|
||||
int m_nTableRowHeight;
|
||||
};
|
||||
|
||||
class CTableView : public QTableView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int tableColumnWidth READ tableColumnWidth WRITE setTableColumnWidth)
|
||||
Q_PROPERTY(int tableRowHeight READ tableRowHeight WRITE setTableRowHeight)
|
||||
|
||||
public:
|
||||
CTableView(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
int tableColumnWidth();
|
||||
void setTableColumnWidth(const int &nWidth);
|
||||
|
||||
int tableRowHeight();
|
||||
void setTableRowHeight(const int &nHeight);
|
||||
|
||||
private:
|
||||
int m_nTableColWidth;
|
||||
int m_nTableRowHeight;
|
||||
};
|
||||
|
||||
#endif // CTABLEWIDGET_H
|
||||
#ifndef CTABLEWIDGET_H
|
||||
#define CTABLEWIDGET_H
|
||||
|
||||
#include <QTableWidget>
|
||||
|
||||
class CTableWidget : public QTableWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int tableColumnWidth READ tableColumnWidth WRITE setTableColumnWidth)
|
||||
Q_PROPERTY(int tableRowHeight READ tableRowHeight WRITE setTableRowHeight)
|
||||
|
||||
public:
|
||||
CTableWidget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
int tableColumnWidth();
|
||||
void setTableColumnWidth(const int &nWidth);
|
||||
|
||||
int tableRowHeight();
|
||||
void setTableRowHeight(const int &nHeight);
|
||||
|
||||
private:
|
||||
int m_nTableColWidth;
|
||||
int m_nTableRowHeight;
|
||||
};
|
||||
|
||||
class CTableView : public QTableView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int tableColumnWidth READ tableColumnWidth WRITE setTableColumnWidth)
|
||||
Q_PROPERTY(int tableRowHeight READ tableRowHeight WRITE setTableRowHeight)
|
||||
|
||||
public:
|
||||
CTableView(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
int tableColumnWidth();
|
||||
void setTableColumnWidth(const int &nWidth);
|
||||
|
||||
int tableRowHeight();
|
||||
void setTableRowHeight(const int &nHeight);
|
||||
|
||||
private:
|
||||
int m_nTableColWidth;
|
||||
int m_nTableRowHeight;
|
||||
};
|
||||
|
||||
#endif // CTABLEWIDGET_H
|
||||
|
||||
@ -1,49 +1,49 @@
|
||||
#include <QProcess>
|
||||
#include "CWaveListDialog.h"
|
||||
#include "ui_CWaveListDialog.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include "pub_utility_api/FileUtil.h"
|
||||
|
||||
CWaveListDialog::CWaveListDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CWaveListDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle( "录波列表" );
|
||||
|
||||
connect( ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotShowWave(QListWidgetItem*)) );
|
||||
}
|
||||
|
||||
CWaveListDialog::~CWaveListDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CWaveListDialog::clear()
|
||||
{
|
||||
m_sPath = "";
|
||||
ui->listWidget->clear();
|
||||
}
|
||||
|
||||
void CWaveListDialog::addFileNameList( QString sPath, QStringList listName )
|
||||
{
|
||||
m_sPath = sPath;
|
||||
ui->listWidget->addItems( listName );
|
||||
}
|
||||
|
||||
void CWaveListDialog::slotShowWave( QListWidgetItem* pItem )
|
||||
{
|
||||
const std::string strPath = std::move(iot_public::CFileUtil::getPathOfBinFile(
|
||||
std::string("WaveAnalyze") + iot_public::CFileUtil::getProcSuffix()));
|
||||
if(strPath.empty())
|
||||
{
|
||||
LOGERROR("未找到可执行文件WaveAnalyze");
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList listArgument;
|
||||
listArgument << m_sPath+"/"+pItem->text();
|
||||
|
||||
QProcess::startDetached( strPath.c_str(), listArgument );
|
||||
}
|
||||
|
||||
#include <QProcess>
|
||||
#include "CWaveListDialog.h"
|
||||
#include "ui_CWaveListDialog.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include "pub_utility_api/FileUtil.h"
|
||||
|
||||
CWaveListDialog::CWaveListDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CWaveListDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle( "录波列表" );
|
||||
|
||||
connect( ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotShowWave(QListWidgetItem*)) );
|
||||
}
|
||||
|
||||
CWaveListDialog::~CWaveListDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CWaveListDialog::clear()
|
||||
{
|
||||
m_sPath = "";
|
||||
ui->listWidget->clear();
|
||||
}
|
||||
|
||||
void CWaveListDialog::addFileNameList( QString sPath, QStringList listName )
|
||||
{
|
||||
m_sPath = sPath;
|
||||
ui->listWidget->addItems( listName );
|
||||
}
|
||||
|
||||
void CWaveListDialog::slotShowWave( QListWidgetItem* pItem )
|
||||
{
|
||||
const std::string strPath = std::move(kbd_public::CFileUtil::getPathOfBinFile(
|
||||
std::string("WaveAnalyze") + kbd_public::CFileUtil::getProcSuffix()));
|
||||
if(strPath.empty())
|
||||
{
|
||||
LOGERROR("未找到可执行文件WaveAnalyze");
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList listArgument;
|
||||
listArgument << m_sPath+"/"+pItem->text();
|
||||
|
||||
QProcess::startDetached( strPath.c_str(), listArgument );
|
||||
}
|
||||
|
||||
|
||||
@ -1,31 +1,31 @@
|
||||
#ifndef CWAVELISTDIALOG_H
|
||||
#define CWAVELISTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
namespace Ui {
|
||||
class CWaveListDialog;
|
||||
}
|
||||
|
||||
class CWaveListDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CWaveListDialog(QWidget *parent = 0);
|
||||
~CWaveListDialog();
|
||||
|
||||
public:
|
||||
void clear();
|
||||
void addFileNameList( QString sPath, QStringList listName );
|
||||
|
||||
public slots:
|
||||
void slotShowWave( QListWidgetItem* pItem );
|
||||
|
||||
private:
|
||||
Ui::CWaveListDialog *ui;
|
||||
QString m_sPath;
|
||||
};
|
||||
|
||||
#endif // CWAVELISTDIALOG_H
|
||||
#ifndef CWAVELISTDIALOG_H
|
||||
#define CWAVELISTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
namespace Ui {
|
||||
class CWaveListDialog;
|
||||
}
|
||||
|
||||
class CWaveListDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CWaveListDialog(QWidget *parent = 0);
|
||||
~CWaveListDialog();
|
||||
|
||||
public:
|
||||
void clear();
|
||||
void addFileNameList( QString sPath, QStringList listName );
|
||||
|
||||
public slots:
|
||||
void slotShowWave( QListWidgetItem* pItem );
|
||||
|
||||
private:
|
||||
Ui::CWaveListDialog *ui;
|
||||
QString m_sPath;
|
||||
};
|
||||
|
||||
#endif // CWAVELISTDIALOG_H
|
||||
|
||||
@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CWaveListDialog</class>
|
||||
<widget class="QDialog" name="CWaveListDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CWaveListDialog</class>
|
||||
<widget class="QDialog" name="CWaveListDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#ifndef COMMONDEFINE_H
|
||||
#define COMMONDEFINE_H
|
||||
|
||||
#define CN_MAXBARSERIES 5 // 最多柱状图组数
|
||||
#define CN_ALARMINFO_MAXROW 5000 // 告警信息窗最多显示的条数
|
||||
#define CN_DAYSOFSINGLEQUERY 1 // 单次查询的天数
|
||||
#define CN_MAXBARCOUNT 3 // 告警比对站(或设备组)最多个数
|
||||
#define CN_NORMALALARMTABLE "his_event" // 普通告警的表名
|
||||
#define CN_SMARTALARMTABLE "his_intelli_alm" // 智能告警的表名
|
||||
|
||||
#endif // COMMONDEFINE_H
|
||||
#ifndef COMMONDEFINE_H
|
||||
#define COMMONDEFINE_H
|
||||
|
||||
#define CN_MAXBARSERIES 5 // 最多柱状图组数
|
||||
#define CN_ALARMINFO_MAXROW 5000 // 告警信息窗最多显示的条数
|
||||
#define CN_DAYSOFSINGLEQUERY 1 // 单次查询的天数
|
||||
#define CN_MAXBARCOUNT 3 // 告警比对站(或设备组)最多个数
|
||||
#define CN_NORMALALARMTABLE "his_event" // 普通告警的表名
|
||||
#define CN_SMARTALARMTABLE "his_intelli_alm" // 智能告警的表名
|
||||
|
||||
#endif // COMMONDEFINE_H
|
||||
|
||||
@ -1,39 +1,39 @@
|
||||
#include "CommonFunction.h"
|
||||
|
||||
void resizeColumnsToContents(QTableView* pView , int scaleColumn)
|
||||
{
|
||||
if ( pView == NULL || pView->model() == NULL )
|
||||
return;
|
||||
|
||||
int nColWidth = pView->width();
|
||||
if ( nColWidth <= 200 )
|
||||
return;
|
||||
|
||||
pView->resizeColumnsToContents();
|
||||
|
||||
float fRatio = 1.0f;
|
||||
int nCurrentColWidth = 0;
|
||||
int nColCount = pView->model()->columnCount();
|
||||
for ( int i=0; i<nColCount; i++ )
|
||||
nCurrentColWidth += pView->columnWidth( i );
|
||||
fRatio = float(nColWidth-20)/nCurrentColWidth;
|
||||
if(fRatio > 1.0)
|
||||
{
|
||||
for ( int i=0; i<nColCount; i++ )
|
||||
pView->setColumnWidth( i, pView->columnWidth(i)*fRatio );
|
||||
}
|
||||
else
|
||||
{
|
||||
int nOffset = nColWidth - nCurrentColWidth - 25;
|
||||
if(nColCount > scaleColumn)
|
||||
pView->setColumnWidth( scaleColumn, pView->columnWidth(scaleColumn)+nOffset);
|
||||
}
|
||||
}
|
||||
|
||||
void showMsg( QMessageBox::Icon icon, QString sTitle, QString sText )
|
||||
{
|
||||
QMessageBox* pMsgBox = new QMessageBox(icon,sTitle,sText);
|
||||
pMsgBox->setWindowFlags( ( pMsgBox->windowFlags() & ~Qt::WindowMinimizeButtonHint ) | Qt::WindowStaysOnTopHint | Qt::Dialog );
|
||||
pMsgBox->exec();
|
||||
delete pMsgBox;
|
||||
}
|
||||
#include "CommonFunction.h"
|
||||
|
||||
void resizeColumnsToContents(QTableView* pView , int scaleColumn)
|
||||
{
|
||||
if ( pView == NULL || pView->model() == NULL )
|
||||
return;
|
||||
|
||||
int nColWidth = pView->width();
|
||||
if ( nColWidth <= 200 )
|
||||
return;
|
||||
|
||||
pView->resizeColumnsToContents();
|
||||
|
||||
float fRatio = 1.0f;
|
||||
int nCurrentColWidth = 0;
|
||||
int nColCount = pView->model()->columnCount();
|
||||
for ( int i=0; i<nColCount; i++ )
|
||||
nCurrentColWidth += pView->columnWidth( i );
|
||||
fRatio = float(nColWidth-20)/nCurrentColWidth;
|
||||
if(fRatio > 1.0)
|
||||
{
|
||||
for ( int i=0; i<nColCount; i++ )
|
||||
pView->setColumnWidth( i, pView->columnWidth(i)*fRatio );
|
||||
}
|
||||
else
|
||||
{
|
||||
int nOffset = nColWidth - nCurrentColWidth - 25;
|
||||
if(nColCount > scaleColumn)
|
||||
pView->setColumnWidth( scaleColumn, pView->columnWidth(scaleColumn)+nOffset);
|
||||
}
|
||||
}
|
||||
|
||||
void showMsg( QMessageBox::Icon icon, QString sTitle, QString sText )
|
||||
{
|
||||
QMessageBox* pMsgBox = new QMessageBox(icon,sTitle,sText);
|
||||
pMsgBox->setWindowFlags( ( pMsgBox->windowFlags() & ~Qt::WindowMinimizeButtonHint ) | Qt::WindowStaysOnTopHint | Qt::Dialog );
|
||||
pMsgBox->exec();
|
||||
delete pMsgBox;
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
#ifndef COMMONFUNCTION_H
|
||||
#define COMMONFUNCTION_H
|
||||
|
||||
#include <QTableView>
|
||||
#include <QMessageBox>
|
||||
|
||||
void resizeColumnsToContents( QTableView* pView, int scaleColumn = 3 );
|
||||
void showMsg( QMessageBox::Icon icon, QString sTitle, QString sText );
|
||||
|
||||
#endif // COMMONFUNCTION_H
|
||||
#ifndef COMMONFUNCTION_H
|
||||
#define COMMONFUNCTION_H
|
||||
|
||||
#include <QTableView>
|
||||
#include <QMessageBox>
|
||||
|
||||
void resizeColumnsToContents( QTableView* pView, int scaleColumn = 3 );
|
||||
void showMsg( QMessageBox::Icon icon, QString sTitle, QString sText );
|
||||
|
||||
#endif // COMMONFUNCTION_H
|
||||
|
||||
@ -1,23 +1,23 @@
|
||||
#ifndef SALARMINFO_H
|
||||
#define SALARMINFO_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct SAlarmInfo
|
||||
{
|
||||
QString sTime; // 时间, 示例: 2019-01-02 09:12:44.267
|
||||
QString sLevel; // 级别,示例: 一级
|
||||
QString sLocation; // 位置,示例:清湖北站
|
||||
QString sContent; // 内容,示例:302间隔信息 C相电压 230.00kV 越上上限
|
||||
QString sKeyIdTag; // key_id_tag
|
||||
SAlarmInfo()
|
||||
{
|
||||
sTime = "";
|
||||
sLevel = "";
|
||||
sLocation = "";
|
||||
sContent = "";
|
||||
sKeyIdTag = "";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SALARMINFO_H
|
||||
#ifndef SALARMINFO_H
|
||||
#define SALARMINFO_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct SAlarmInfo
|
||||
{
|
||||
QString sTime; // 时间, 示例: 2019-01-02 09:12:44.267
|
||||
QString sLevel; // 级别,示例: 一级
|
||||
QString sLocation; // 位置,示例:清湖北站
|
||||
QString sContent; // 内容,示例:302间隔信息 C相电压 230.00kV 越上上限
|
||||
QString sKeyIdTag; // key_id_tag
|
||||
SAlarmInfo()
|
||||
{
|
||||
sTime = "";
|
||||
sLevel = "";
|
||||
sLocation = "";
|
||||
sContent = "";
|
||||
sKeyIdTag = "";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SALARMINFO_H
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
#ifndef SALARMLEVEL_H
|
||||
#define SALARMLEVEL_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct SAlarmLevel
|
||||
{
|
||||
int nId; // id
|
||||
int nPriority; // 级别
|
||||
QString sName; // 名称
|
||||
public:
|
||||
SAlarmLevel()
|
||||
{
|
||||
nId = 0;
|
||||
nPriority = 0;
|
||||
sName = "";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SALARMLEVEL_H
|
||||
#ifndef SALARMLEVEL_H
|
||||
#define SALARMLEVEL_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct SAlarmLevel
|
||||
{
|
||||
int nId; // id
|
||||
int nPriority; // 级别
|
||||
QString sName; // 名称
|
||||
public:
|
||||
SAlarmLevel()
|
||||
{
|
||||
nId = 0;
|
||||
nPriority = 0;
|
||||
sName = "";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SALARMLEVEL_H
|
||||
|
||||
@ -1,37 +1,37 @@
|
||||
#ifndef SALARMLIST_H
|
||||
#define SALARMLIST_H
|
||||
|
||||
#include <QList>
|
||||
#include "SAlarmInfo.h"
|
||||
|
||||
struct SAlarmList
|
||||
{
|
||||
int nId;// 站id
|
||||
QString sName;// 站或者设备组名称
|
||||
QString sTagName; // 设备组tag
|
||||
QList<int> listLevelCount;//每级告警个数,下标表示优先级的顺序,不是优先级的值,也不是优先级的id
|
||||
QList<SAlarmInfo*> listAlarmInfo;//不分等级,前CN_ALARMINFO_MAXROW个
|
||||
SAlarmList()
|
||||
{
|
||||
nId = 0;
|
||||
sName = "";
|
||||
sTagName = "";
|
||||
listLevelCount.clear();
|
||||
listAlarmInfo.clear();
|
||||
}
|
||||
~SAlarmList()
|
||||
{
|
||||
listLevelCount.clear();
|
||||
qDeleteAll( listAlarmInfo );
|
||||
listAlarmInfo.clear();
|
||||
}
|
||||
int getAllLevelAlarmCount()// 获取所有告警的数目(所有等级)
|
||||
{
|
||||
int nCount = 0;
|
||||
for ( int i=0; i<listLevelCount.count(); i++ )
|
||||
nCount += listLevelCount.at(i);
|
||||
return nCount;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SALARMLIST_H
|
||||
#ifndef SALARMLIST_H
|
||||
#define SALARMLIST_H
|
||||
|
||||
#include <QList>
|
||||
#include "SAlarmInfo.h"
|
||||
|
||||
struct SAlarmList
|
||||
{
|
||||
int nId;// 站id
|
||||
QString sName;// 站或者设备组名称
|
||||
QString sTagName; // 设备组tag
|
||||
QList<int> listLevelCount;//每级告警个数,下标表示优先级的顺序,不是优先级的值,也不是优先级的id
|
||||
QList<SAlarmInfo*> listAlarmInfo;//不分等级,前CN_ALARMINFO_MAXROW个
|
||||
SAlarmList()
|
||||
{
|
||||
nId = 0;
|
||||
sName = "";
|
||||
sTagName = "";
|
||||
listLevelCount.clear();
|
||||
listAlarmInfo.clear();
|
||||
}
|
||||
~SAlarmList()
|
||||
{
|
||||
listLevelCount.clear();
|
||||
qDeleteAll( listAlarmInfo );
|
||||
listAlarmInfo.clear();
|
||||
}
|
||||
int getAllLevelAlarmCount()// 获取所有告警的数目(所有等级)
|
||||
{
|
||||
int nCount = 0;
|
||||
for ( int i=0; i<listLevelCount.count(); i++ )
|
||||
nCount += listLevelCount.at(i);
|
||||
return nCount;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SALARMLIST_H
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
#ifndef SDEVICEGROUP_H
|
||||
#define SDEVICEGROUP_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct SDeviceGroup
|
||||
{
|
||||
QString sTagName;
|
||||
QString sName;
|
||||
SDeviceGroup()
|
||||
{
|
||||
sTagName = "";
|
||||
sName = "";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SDEVICEGROUP_H
|
||||
#ifndef SDEVICEGROUP_H
|
||||
#define SDEVICEGROUP_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct SDeviceGroup
|
||||
{
|
||||
QString sTagName;
|
||||
QString sName;
|
||||
SDeviceGroup()
|
||||
{
|
||||
sTagName = "";
|
||||
sName = "";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SDEVICEGROUP_H
|
||||
|
||||
@ -1,27 +1,27 @@
|
||||
#ifndef SLOCATION_H
|
||||
#define SLOCATION_H
|
||||
|
||||
#include <QList>
|
||||
#include "SDeviceGroup.h"
|
||||
|
||||
struct SLocation
|
||||
{
|
||||
int nId;
|
||||
QString sName;
|
||||
QString sTagName;
|
||||
QList<SDeviceGroup*> listDeviceGroup;
|
||||
SLocation()
|
||||
{
|
||||
nId = 0;
|
||||
sName = "";
|
||||
sTagName = "";
|
||||
}
|
||||
~SLocation()
|
||||
{
|
||||
qDeleteAll( listDeviceGroup );
|
||||
listDeviceGroup.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // SLOCATION_H
|
||||
#ifndef SLOCATION_H
|
||||
#define SLOCATION_H
|
||||
|
||||
#include <QList>
|
||||
#include "SDeviceGroup.h"
|
||||
|
||||
struct SLocation
|
||||
{
|
||||
int nId;
|
||||
QString sName;
|
||||
QString sTagName;
|
||||
QList<SDeviceGroup*> listDeviceGroup;
|
||||
SLocation()
|
||||
{
|
||||
nId = 0;
|
||||
sName = "";
|
||||
sTagName = "";
|
||||
}
|
||||
~SLocation()
|
||||
{
|
||||
qDeleteAll( listDeviceGroup );
|
||||
listDeviceGroup.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // SLOCATION_H
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
#include "CAlarmStatistics.h"
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include "pub_logger_api/logger.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
iot_public::StartLogSystem( "BASE", "alarm_statistics" );
|
||||
|
||||
CAlarmStatistics w( 0, false );
|
||||
w.show();
|
||||
int nRet = a.exec();
|
||||
|
||||
iot_public::StopLogSystem();
|
||||
return nRet;
|
||||
}
|
||||
#include "CAlarmStatistics.h"
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include "pub_logger_api/logger.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
kbd_public::StartLogSystem( "BASE", "alarm_statistics" );
|
||||
|
||||
CAlarmStatistics w( 0, false );
|
||||
w.show();
|
||||
int nRet = a.exec();
|
||||
|
||||
kbd_public::StopLogSystem();
|
||||
return nRet;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/resource"/>
|
||||
<qresource prefix="/">
|
||||
<file>resource/combobox-drop-down.png</file>
|
||||
<file>resource/icon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
<RCC>
|
||||
<qresource prefix="/resource"/>
|
||||
<qresource prefix="/">
|
||||
<file>resource/combobox-drop-down.png</file>
|
||||
<file>resource/icon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,94 +1,94 @@
|
||||
#ifndef ADDOBJALARMDIALOG_H
|
||||
#define ADDOBJALARMDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "db_api_ex/CDbApi.h"
|
||||
#include <QCheckBox>
|
||||
#include "AlarmCalcInfo.h"
|
||||
#include "AlarmManageCommon.h"
|
||||
#include "AlarmCalcParaTableModel.h"
|
||||
#include "AlarmCalcParaTableDelegate.h"
|
||||
|
||||
namespace Ui {
|
||||
class AddObjAlarmDialog;
|
||||
}
|
||||
|
||||
class AddObjAlarmDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AddObjAlarmDialog(QList<ST_DEV_INFO> devList,QWidget *parent = 0);
|
||||
~AddObjAlarmDialog();
|
||||
|
||||
signals:
|
||||
void sigChangePara(QList<AlarmCalcInfoPtr>);
|
||||
|
||||
void sigClearPara();
|
||||
|
||||
public slots:
|
||||
void slotViewUpdate();
|
||||
|
||||
void slotSelectPoint(AlarmCalcInfoPtr info);
|
||||
private:
|
||||
void initLayout();
|
||||
|
||||
void initMember();
|
||||
|
||||
void initData();
|
||||
|
||||
void initConnect();
|
||||
|
||||
void initView();
|
||||
|
||||
bool checkIfAdd();
|
||||
|
||||
void hideDiText();
|
||||
|
||||
void saveAi();
|
||||
|
||||
void saveDi();
|
||||
|
||||
QString getOneTagName();
|
||||
|
||||
int getDevType();
|
||||
|
||||
int getLoctionId();
|
||||
|
||||
bool execute(const QString &sql);
|
||||
|
||||
private slots:
|
||||
void pointTypeChange(int index);
|
||||
|
||||
void alarmLevelChange(int index);
|
||||
|
||||
void funcChange(int index);
|
||||
|
||||
void addObj();
|
||||
|
||||
private:
|
||||
Ui::AddObjAlarmDialog *ui;
|
||||
|
||||
iot_dbms::CDbApi *m_pWriteDb;
|
||||
|
||||
QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作
|
||||
|
||||
QMap<int,QString > m_alarmActionMap; //告警动作
|
||||
QMap<int,int> m_alarmLevelActionMap; //等级--动作
|
||||
QMap<int,QString> m_alarmLevelMap; //等级--等级描述
|
||||
|
||||
QMap<int,int> m_alarmLevelIndexMap;
|
||||
|
||||
QMap<QString,QString> m_funcMap; //计算公式
|
||||
|
||||
QMap<QString,QList<AlarmCalcInfoPtr> > m_calcInfoMap; //计算公式参数
|
||||
|
||||
QList<ST_DEV_INFO> m_devList;
|
||||
|
||||
QList<QString> m_diTextList;
|
||||
AlarmCalcParaTableModel *m_model;
|
||||
AlarmCalcParaTableDelegate *m_delegate;
|
||||
|
||||
};
|
||||
|
||||
#endif // ADDOBJALARMDIALOG_H
|
||||
#ifndef ADDOBJALARMDIALOG_H
|
||||
#define ADDOBJALARMDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "db_api_ex/CDbApi.h"
|
||||
#include <QCheckBox>
|
||||
#include "AlarmCalcInfo.h"
|
||||
#include "AlarmManageCommon.h"
|
||||
#include "AlarmCalcParaTableModel.h"
|
||||
#include "AlarmCalcParaTableDelegate.h"
|
||||
|
||||
namespace Ui {
|
||||
class AddObjAlarmDialog;
|
||||
}
|
||||
|
||||
class AddObjAlarmDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AddObjAlarmDialog(QList<ST_DEV_INFO> devList,QWidget *parent = 0);
|
||||
~AddObjAlarmDialog();
|
||||
|
||||
signals:
|
||||
void sigChangePara(QList<AlarmCalcInfoPtr>);
|
||||
|
||||
void sigClearPara();
|
||||
|
||||
public slots:
|
||||
void slotViewUpdate();
|
||||
|
||||
void slotSelectPoint(AlarmCalcInfoPtr info);
|
||||
private:
|
||||
void initLayout();
|
||||
|
||||
void initMember();
|
||||
|
||||
void initData();
|
||||
|
||||
void initConnect();
|
||||
|
||||
void initView();
|
||||
|
||||
bool checkIfAdd();
|
||||
|
||||
void hideDiText();
|
||||
|
||||
void saveAi();
|
||||
|
||||
void saveDi();
|
||||
|
||||
QString getOneTagName();
|
||||
|
||||
int getDevType();
|
||||
|
||||
int getLoctionId();
|
||||
|
||||
bool execute(const QString &sql);
|
||||
|
||||
private slots:
|
||||
void pointTypeChange(int index);
|
||||
|
||||
void alarmLevelChange(int index);
|
||||
|
||||
void funcChange(int index);
|
||||
|
||||
void addObj();
|
||||
|
||||
private:
|
||||
Ui::AddObjAlarmDialog *ui;
|
||||
|
||||
kbd_dbms::CDbApi *m_pWriteDb;
|
||||
|
||||
QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作
|
||||
|
||||
QMap<int,QString > m_alarmActionMap; //告警动作
|
||||
QMap<int,int> m_alarmLevelActionMap; //等级--动作
|
||||
QMap<int,QString> m_alarmLevelMap; //等级--等级描述
|
||||
|
||||
QMap<int,int> m_alarmLevelIndexMap;
|
||||
|
||||
QMap<QString,QString> m_funcMap; //计算公式
|
||||
|
||||
QMap<QString,QList<AlarmCalcInfoPtr> > m_calcInfoMap; //计算公式参数
|
||||
|
||||
QList<ST_DEV_INFO> m_devList;
|
||||
|
||||
QList<QString> m_diTextList;
|
||||
AlarmCalcParaTableModel *m_model;
|
||||
AlarmCalcParaTableDelegate *m_delegate;
|
||||
|
||||
};
|
||||
|
||||
#endif // ADDOBJALARMDIALOG_H
|
||||
|
||||
@ -1,335 +1,335 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddObjAlarmDialog</class>
|
||||
<widget class="QDialog" name="AddObjAlarmDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>655</width>
|
||||
<height>554</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>655</width>
|
||||
<height>554</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>655</width>
|
||||
<height>554</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>设备</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>自定义告警名称</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>类型</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbObjType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>告警等级定义</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>告警点计算函数</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>88</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>告警规则</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>越上限值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-100000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100000000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>越下限值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-100000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>数字量文本:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QTableView" name="tableView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddObjAlarmDialog</class>
|
||||
<widget class="QDialog" name="AddObjAlarmDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>655</width>
|
||||
<height>554</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>655</width>
|
||||
<height>554</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>655</width>
|
||||
<height>554</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>设备</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>自定义告警名称</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>类型</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbObjType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>告警等级定义</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>告警点计算函数</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>88</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>告警规则</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>越上限值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-100000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100000000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>越下限值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-100000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>100000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>数字量文本:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QTableView" name="tableView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#include "AlarmCalcInfo.h"
|
||||
|
||||
AlarmCalcInfo::AlarmCalcInfo()
|
||||
{
|
||||
m_nId = -1; //第几个
|
||||
m_strTip = QString();
|
||||
m_tag = QString();
|
||||
m_desc = QString(); //可空
|
||||
}
|
||||
#include "AlarmCalcInfo.h"
|
||||
|
||||
AlarmCalcInfo::AlarmCalcInfo()
|
||||
{
|
||||
m_nId = -1; //第几个
|
||||
m_strTip = QString();
|
||||
m_tag = QString();
|
||||
m_desc = QString(); //可空
|
||||
}
|
||||
|
||||
@ -1,23 +1,23 @@
|
||||
#ifndef ALARMCALCINFO_H
|
||||
#define ALARMCALCINFO_H
|
||||
|
||||
#include <QSharedPointer>
|
||||
|
||||
class AlarmCalcInfo;
|
||||
typedef QSharedPointer<AlarmCalcInfo> AlarmCalcInfoPtr;
|
||||
|
||||
class AlarmCalcInfo
|
||||
{
|
||||
public:
|
||||
AlarmCalcInfo();
|
||||
|
||||
int m_nId; //第几个
|
||||
QString m_strTip;
|
||||
QString m_tag;
|
||||
QString m_desc; //可空
|
||||
|
||||
};
|
||||
Q_DECLARE_METATYPE(AlarmCalcInfo)
|
||||
Q_DECLARE_METATYPE(AlarmCalcInfoPtr)
|
||||
|
||||
#endif // ALARMCALCINFO_H
|
||||
#ifndef ALARMCALCINFO_H
|
||||
#define ALARMCALCINFO_H
|
||||
|
||||
#include <QSharedPointer>
|
||||
|
||||
class AlarmCalcInfo;
|
||||
typedef QSharedPointer<AlarmCalcInfo> AlarmCalcInfoPtr;
|
||||
|
||||
class AlarmCalcInfo
|
||||
{
|
||||
public:
|
||||
AlarmCalcInfo();
|
||||
|
||||
int m_nId; //第几个
|
||||
QString m_strTip;
|
||||
QString m_tag;
|
||||
QString m_desc; //可空
|
||||
|
||||
};
|
||||
Q_DECLARE_METATYPE(AlarmCalcInfo)
|
||||
Q_DECLARE_METATYPE(AlarmCalcInfoPtr)
|
||||
|
||||
#endif // ALARMCALCINFO_H
|
||||
|
||||
@ -1,74 +1,74 @@
|
||||
#include "AlarmCalcParaTableDelegate.h"
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include "AlarmCalcInfo.h"
|
||||
#include <QStyleOptionButton>
|
||||
#include "public/pub_logger_api/logger.h"
|
||||
|
||||
AlarmCalcParaTableDelegate::AlarmCalcParaTableDelegate(AlarmCalcParaTableModel *model, QObject *parent)
|
||||
:m_pModel(model),
|
||||
QStyledItemDelegate(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AlarmCalcParaTableDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
AlarmCalcInfoPtr info = m_pModel->getCalcParaInfo(index);
|
||||
if(info == NULL)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
QStyleOptionButton buttonOption;
|
||||
buttonOption.state |= QStyle::State_Enabled;
|
||||
buttonOption.state |= QStyle::State_On;
|
||||
buttonOption.features = QStyleOptionButton::Flat;
|
||||
// bool hover = index.model()->data(index, Qt::UserRole).toBool();
|
||||
// if(hover)
|
||||
// {
|
||||
// buttonOption.state |= QStyle::State_On;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// buttonOption.state |= QStyle::State_Off;
|
||||
// }
|
||||
|
||||
buttonOption.rect = option.rect;
|
||||
buttonOption.rect.adjust(option.rect.width()/2-32,2,-(option.rect.width()/2-32),-2);
|
||||
buttonOption.text = "···";
|
||||
painter->save();
|
||||
|
||||
if(option.state & QStyle::State_Selected){
|
||||
painter->fillRect(option.rect,option.palette.highlight());
|
||||
}
|
||||
painter->restore();
|
||||
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButton, &buttonOption, painter);
|
||||
}
|
||||
|
||||
bool AlarmCalcParaTableDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
|
||||
{
|
||||
Q_UNUSED(model);
|
||||
AlarmCalcInfoPtr info = m_pModel->getCalcParaInfo(index);
|
||||
if(event->type() == QEvent::MouseButtonRelease){
|
||||
|
||||
QMouseEvent *e = (QMouseEvent*)event;
|
||||
|
||||
if((e != NULL && e->button() == Qt::LeftButton && e->type() == QMouseEvent::MouseButtonRelease))
|
||||
{
|
||||
|
||||
QStyleOptionButton buttonOption;
|
||||
buttonOption.rect = option.rect;
|
||||
buttonOption.rect.adjust(option.rect.width()/2-32,2,-(option.rect.width()/2-32),-2);
|
||||
QRect rect = buttonOption.rect;
|
||||
|
||||
if(rect.contains(e->pos()))
|
||||
{
|
||||
LOGDEBUG("选点---------------------------------111111-----------------");
|
||||
emit sigselectPoint(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#include "AlarmCalcParaTableDelegate.h"
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include "AlarmCalcInfo.h"
|
||||
#include <QStyleOptionButton>
|
||||
#include "public/pub_logger_api/logger.h"
|
||||
|
||||
AlarmCalcParaTableDelegate::AlarmCalcParaTableDelegate(AlarmCalcParaTableModel *model, QObject *parent)
|
||||
:m_pModel(model),
|
||||
QStyledItemDelegate(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AlarmCalcParaTableDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
AlarmCalcInfoPtr info = m_pModel->getCalcParaInfo(index);
|
||||
if(info == NULL)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
QStyleOptionButton buttonOption;
|
||||
buttonOption.state |= QStyle::State_Enabled;
|
||||
buttonOption.state |= QStyle::State_On;
|
||||
buttonOption.features = QStyleOptionButton::Flat;
|
||||
// bool hover = index.model()->data(index, Qt::UserRole).toBool();
|
||||
// if(hover)
|
||||
// {
|
||||
// buttonOption.state |= QStyle::State_On;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// buttonOption.state |= QStyle::State_Off;
|
||||
// }
|
||||
|
||||
buttonOption.rect = option.rect;
|
||||
buttonOption.rect.adjust(option.rect.width()/2-32,2,-(option.rect.width()/2-32),-2);
|
||||
buttonOption.text = "···";
|
||||
painter->save();
|
||||
|
||||
if(option.state & QStyle::State_Selected){
|
||||
painter->fillRect(option.rect,option.palette.highlight());
|
||||
}
|
||||
painter->restore();
|
||||
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButton, &buttonOption, painter);
|
||||
}
|
||||
|
||||
bool AlarmCalcParaTableDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
|
||||
{
|
||||
Q_UNUSED(model);
|
||||
AlarmCalcInfoPtr info = m_pModel->getCalcParaInfo(index);
|
||||
if(event->type() == QEvent::MouseButtonRelease){
|
||||
|
||||
QMouseEvent *e = (QMouseEvent*)event;
|
||||
|
||||
if((e != NULL && e->button() == Qt::LeftButton && e->type() == QMouseEvent::MouseButtonRelease))
|
||||
{
|
||||
|
||||
QStyleOptionButton buttonOption;
|
||||
buttonOption.rect = option.rect;
|
||||
buttonOption.rect.adjust(option.rect.width()/2-32,2,-(option.rect.width()/2-32),-2);
|
||||
QRect rect = buttonOption.rect;
|
||||
|
||||
if(rect.contains(e->pos()))
|
||||
{
|
||||
LOGDEBUG("选点---------------------------------111111-----------------");
|
||||
emit sigselectPoint(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
#ifndef ALARMCALCPARATABLEDELEGATE_H
|
||||
#define ALARMCALCPARATABLEDELEGATE_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <AlarmCalcParaTableModel.h>
|
||||
|
||||
|
||||
class AlarmCalcParaTableDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AlarmCalcParaTableDelegate(AlarmCalcParaTableModel *model, QObject *parent = 0);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
bool editorEvent(QEvent *event, QAbstractItemModel *model,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &index) Q_DECL_OVERRIDE;
|
||||
|
||||
signals:
|
||||
void sigViewUpdate();
|
||||
|
||||
void sigselectPoint(AlarmCalcInfoPtr info);
|
||||
|
||||
private:
|
||||
AlarmCalcParaTableModel * m_pModel;
|
||||
};
|
||||
|
||||
#endif // ALARMCALCPARATABLEDELEGATE_H
|
||||
#ifndef ALARMCALCPARATABLEDELEGATE_H
|
||||
#define ALARMCALCPARATABLEDELEGATE_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <AlarmCalcParaTableModel.h>
|
||||
|
||||
|
||||
class AlarmCalcParaTableDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AlarmCalcParaTableDelegate(AlarmCalcParaTableModel *model, QObject *parent = 0);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
bool editorEvent(QEvent *event, QAbstractItemModel *model,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &index) Q_DECL_OVERRIDE;
|
||||
|
||||
signals:
|
||||
void sigViewUpdate();
|
||||
|
||||
void sigselectPoint(AlarmCalcInfoPtr info);
|
||||
|
||||
private:
|
||||
AlarmCalcParaTableModel * m_pModel;
|
||||
};
|
||||
|
||||
#endif // ALARMCALCPARATABLEDELEGATE_H
|
||||
|
||||
@ -1,122 +1,122 @@
|
||||
#include "AlarmCalcParaTableModel.h"
|
||||
|
||||
AlarmCalcParaTableModel::AlarmCalcParaTableModel(QObject *parent,QTableView *view)
|
||||
: m_view(view),
|
||||
QAbstractTableModel(parent)
|
||||
{
|
||||
m_header <<tr("参数名称")<<tr("参数标签")<<tr("操作");
|
||||
}
|
||||
|
||||
QVariant AlarmCalcParaTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
|
||||
{
|
||||
return m_header.at(section);
|
||||
}
|
||||
return QAbstractTableModel::headerData(section,orientation,role);
|
||||
}
|
||||
|
||||
int AlarmCalcParaTableModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_list.count();
|
||||
}
|
||||
|
||||
int AlarmCalcParaTableModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_header.size();
|
||||
}
|
||||
|
||||
QVariant AlarmCalcParaTableModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if(role == Qt::TextAlignmentRole)
|
||||
{
|
||||
return QVariant(Qt::AlignCenter);
|
||||
}else if(role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
{
|
||||
switch (index.column()) {
|
||||
case 0:
|
||||
return m_list.at(index.row())->m_strTip;
|
||||
break;
|
||||
case 1:
|
||||
return m_list.at(index.row())->m_tag;
|
||||
break;
|
||||
case 2:
|
||||
return QVariant();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool AlarmCalcParaTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if ( role == Qt::EditRole )
|
||||
{
|
||||
int nCol = index.column();
|
||||
if ( value.toString() == "" )
|
||||
return false;
|
||||
switch ( nCol )
|
||||
{
|
||||
case 1:
|
||||
if ( m_list.at(index.row())->m_tag != value.toString() )
|
||||
{
|
||||
m_list.at(index.row())->m_tag = value.toString();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags AlarmCalcParaTableModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return Qt::NoItemFlags;
|
||||
}
|
||||
if(index.column() == 1)
|
||||
{
|
||||
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
|
||||
}else
|
||||
{
|
||||
return QAbstractTableModel::flags(index);
|
||||
}
|
||||
}
|
||||
|
||||
AlarmCalcInfoPtr AlarmCalcParaTableModel::getCalcParaInfo(const QModelIndex &index)
|
||||
{
|
||||
if(m_list.count()>index.row())
|
||||
{
|
||||
return m_list.value(index.row());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void AlarmCalcParaTableModel::slotChangePara(QList<AlarmCalcInfoPtr> paraList)
|
||||
{
|
||||
beginResetModel();
|
||||
m_list.clear();
|
||||
m_list = paraList;
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void AlarmCalcParaTableModel::slotClearPara()
|
||||
{
|
||||
beginResetModel();
|
||||
m_list.clear();
|
||||
endResetModel();
|
||||
}
|
||||
#include "AlarmCalcParaTableModel.h"
|
||||
|
||||
AlarmCalcParaTableModel::AlarmCalcParaTableModel(QObject *parent,QTableView *view)
|
||||
: m_view(view),
|
||||
QAbstractTableModel(parent)
|
||||
{
|
||||
m_header <<tr("参数名称")<<tr("参数标签")<<tr("操作");
|
||||
}
|
||||
|
||||
QVariant AlarmCalcParaTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
|
||||
{
|
||||
return m_header.at(section);
|
||||
}
|
||||
return QAbstractTableModel::headerData(section,orientation,role);
|
||||
}
|
||||
|
||||
int AlarmCalcParaTableModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_list.count();
|
||||
}
|
||||
|
||||
int AlarmCalcParaTableModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_header.size();
|
||||
}
|
||||
|
||||
QVariant AlarmCalcParaTableModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if(role == Qt::TextAlignmentRole)
|
||||
{
|
||||
return QVariant(Qt::AlignCenter);
|
||||
}else if(role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
{
|
||||
switch (index.column()) {
|
||||
case 0:
|
||||
return m_list.at(index.row())->m_strTip;
|
||||
break;
|
||||
case 1:
|
||||
return m_list.at(index.row())->m_tag;
|
||||
break;
|
||||
case 2:
|
||||
return QVariant();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool AlarmCalcParaTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if ( role == Qt::EditRole )
|
||||
{
|
||||
int nCol = index.column();
|
||||
if ( value.toString() == "" )
|
||||
return false;
|
||||
switch ( nCol )
|
||||
{
|
||||
case 1:
|
||||
if ( m_list.at(index.row())->m_tag != value.toString() )
|
||||
{
|
||||
m_list.at(index.row())->m_tag = value.toString();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags AlarmCalcParaTableModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return Qt::NoItemFlags;
|
||||
}
|
||||
if(index.column() == 1)
|
||||
{
|
||||
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
|
||||
}else
|
||||
{
|
||||
return QAbstractTableModel::flags(index);
|
||||
}
|
||||
}
|
||||
|
||||
AlarmCalcInfoPtr AlarmCalcParaTableModel::getCalcParaInfo(const QModelIndex &index)
|
||||
{
|
||||
if(m_list.count()>index.row())
|
||||
{
|
||||
return m_list.value(index.row());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void AlarmCalcParaTableModel::slotChangePara(QList<AlarmCalcInfoPtr> paraList)
|
||||
{
|
||||
beginResetModel();
|
||||
m_list.clear();
|
||||
m_list = paraList;
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void AlarmCalcParaTableModel::slotClearPara()
|
||||
{
|
||||
beginResetModel();
|
||||
m_list.clear();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
@ -1,38 +1,38 @@
|
||||
#ifndef ALARMCALCPARATABLEMODEL_H
|
||||
#define ALARMCALCPARATABLEMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include "AlarmCalcInfo.h"
|
||||
#include <QTableView>
|
||||
|
||||
class AlarmCalcParaTableModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlarmCalcParaTableModel(QObject *parent = nullptr,QTableView *view = Q_NULLPTR);
|
||||
|
||||
// Header:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
// Basic functionality:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
|
||||
AlarmCalcInfoPtr getCalcParaInfo(const QModelIndex &index);
|
||||
public slots:
|
||||
void slotChangePara(QList<AlarmCalcInfoPtr> paraList);
|
||||
|
||||
void slotClearPara();
|
||||
private:
|
||||
QTableView *m_view;
|
||||
QStringList m_header;
|
||||
QList<AlarmCalcInfoPtr> m_list;
|
||||
};
|
||||
|
||||
#endif // ALARMCALCPARATABLEMODEL_H
|
||||
#ifndef ALARMCALCPARATABLEMODEL_H
|
||||
#define ALARMCALCPARATABLEMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include "AlarmCalcInfo.h"
|
||||
#include <QTableView>
|
||||
|
||||
class AlarmCalcParaTableModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlarmCalcParaTableModel(QObject *parent = nullptr,QTableView *view = Q_NULLPTR);
|
||||
|
||||
// Header:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
// Basic functionality:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
|
||||
AlarmCalcInfoPtr getCalcParaInfo(const QModelIndex &index);
|
||||
public slots:
|
||||
void slotChangePara(QList<AlarmCalcInfoPtr> paraList);
|
||||
|
||||
void slotClearPara();
|
||||
private:
|
||||
QTableView *m_view;
|
||||
QStringList m_header;
|
||||
QList<AlarmCalcInfoPtr> m_list;
|
||||
};
|
||||
|
||||
#endif // ALARMCALCPARATABLEMODEL_H
|
||||
|
||||
@ -1,233 +1,233 @@
|
||||
#include "AlarmDevTreeModel.h"
|
||||
#include "AlarmDevTreeView.h"
|
||||
#include "QTreeWidgetItem"
|
||||
#include <QTreeView>
|
||||
#include "AlarmMng.h"
|
||||
|
||||
AlarmDevTreeModel::AlarmDevTreeModel(QObject *parent,QTreeView *view)
|
||||
: QAbstractItemModel(parent),
|
||||
m_pView(view),
|
||||
m_isLink(false),
|
||||
m_root(Q_NULLPTR)
|
||||
{
|
||||
m_root = new QTreeWidgetItem();
|
||||
m_devTypeMap = AlarmMng::instance()->getDevType();
|
||||
init();
|
||||
}
|
||||
|
||||
AlarmDevTreeModel::~AlarmDevTreeModel()
|
||||
{
|
||||
if(Q_NULLPTR != m_root)
|
||||
{
|
||||
delete m_root;
|
||||
}
|
||||
m_root = Q_NULLPTR;
|
||||
}
|
||||
|
||||
QVariant AlarmDevTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
Q_UNUSED(section)
|
||||
Q_UNUSED(role)
|
||||
if(role == Qt::DisplayRole)
|
||||
{
|
||||
if(orientation == Qt::Horizontal)
|
||||
{
|
||||
return QVariant(tr("位置/设备组"));
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QModelIndex AlarmDevTreeModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
if(!hasIndex(row, column, parent) || Q_NULLPTR == m_root)
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QTreeWidgetItem * parentItem;
|
||||
if(!parent.isValid())
|
||||
{
|
||||
parentItem = m_root;
|
||||
}
|
||||
else
|
||||
{
|
||||
parentItem = static_cast<QTreeWidgetItem*>(parent.internalPointer());
|
||||
}
|
||||
|
||||
if(parentItem)
|
||||
{
|
||||
QTreeWidgetItem *childItem = parentItem->child(row);
|
||||
if(childItem)
|
||||
{
|
||||
return createIndex(row,0,childItem);
|
||||
}
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QModelIndex AlarmDevTreeModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QTreeWidgetItem *childItem = static_cast<QTreeWidgetItem*>(index.internalPointer());
|
||||
if (!childItem)
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QTreeWidgetItem *parentItem = childItem->parent();
|
||||
|
||||
if (parentItem == m_root)
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
int row = parentItem->parent()->indexOfChild(parentItem);
|
||||
return createIndex(row, 0, parentItem);
|
||||
}
|
||||
|
||||
int AlarmDevTreeModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if(!parent.isValid())
|
||||
{
|
||||
if (NULL != m_root)
|
||||
{
|
||||
return m_root->childCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QTreeWidgetItem * parentItem = static_cast<QTreeWidgetItem*>(parent.internalPointer());
|
||||
return parentItem->childCount();
|
||||
}
|
||||
}
|
||||
|
||||
int AlarmDevTreeModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
return 1;
|
||||
}
|
||||
|
||||
QVariant AlarmDevTreeModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
QTreeWidgetItem * item = static_cast<QTreeWidgetItem*>(index.internalPointer());
|
||||
if(item)
|
||||
{
|
||||
return item->data(index.column(), role);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Qt::ItemFlags AlarmDevTreeModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return Qt::NoItemFlags;
|
||||
}
|
||||
if(index.column()==0)
|
||||
{
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
|
||||
void AlarmDevTreeModel::setFilter(QString text)
|
||||
{
|
||||
m_fltText = text.toStdString();
|
||||
updateDevTreeNodeStatus();
|
||||
m_pView->viewport()->update();
|
||||
}
|
||||
|
||||
void AlarmDevTreeModel::init()
|
||||
{
|
||||
beginResetModel();
|
||||
QList<int> locList = AlarmMng::instance()->getLocOrder();
|
||||
foreach (const int loc, locList) {
|
||||
QString locdesc = AlarmMng::instance()->getLocDescById(loc);
|
||||
QList<QString> devgList = AlarmMng::instance()->getDevGroupInfo(loc);
|
||||
if(devgList.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QTreeWidgetItem * locItem = new QTreeWidgetItem(m_root, QStringList() << locdesc);
|
||||
locItem->setData(0, Qt::UserRole, loc);
|
||||
locItem->setData(0, Qt::UserRole+1,LOCATION_TYPE);
|
||||
locItem->setData(0, Qt::UserRole+2,locdesc);
|
||||
for(int index(0);index<devgList.count();index++)
|
||||
{
|
||||
QString devgdesc = AlarmMng::instance()->getDevgDescByTag(devgList.at(index));
|
||||
QTreeWidgetItem * devgItem = new QTreeWidgetItem(locItem, QStringList() << devgdesc);
|
||||
devgItem->setData(0, Qt::UserRole, devgList.at(index));
|
||||
devgItem->setData(0, Qt::UserRole+1,DEV_GROUP_TYPE);
|
||||
devgItem->setData(0, Qt::UserRole+2,devgdesc);
|
||||
}
|
||||
}
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void AlarmDevTreeModel::updateDevTreeNodeStatus()
|
||||
{
|
||||
if(!m_root)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
if(m_fltText.empty())
|
||||
{
|
||||
for(int nIndex(0); nIndex<rowCount(); nIndex++)
|
||||
{
|
||||
setAllChildShow(index(nIndex, 0));
|
||||
}
|
||||
return ;
|
||||
}
|
||||
for(int locIndex(0);locIndex<rowCount();locIndex++)
|
||||
{
|
||||
QModelIndex locModelIndex = index(locIndex,0);
|
||||
std::string strLoc = data(locModelIndex, Qt::UserRole+2).toString().toStdString();
|
||||
if(strLoc.find(m_fltText, 0) == -1)
|
||||
{
|
||||
bool isShow = false;
|
||||
for(int devgIndex(0);devgIndex<rowCount(locModelIndex);devgIndex++)
|
||||
{
|
||||
QModelIndex devgModelIndex = index(devgIndex, 0, locModelIndex);
|
||||
std::string stdDevgDesc = data(devgModelIndex, Qt::UserRole+2).toString().toStdString();
|
||||
if(stdDevgDesc.find(m_fltText, 0) != -1)
|
||||
{
|
||||
m_pView->setRowHidden(devgIndex,locModelIndex,false);
|
||||
isShow = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pView->setRowHidden(devgIndex,locModelIndex,true);
|
||||
}
|
||||
}
|
||||
m_pView->setRowHidden(locIndex, parent(locModelIndex), !isShow);
|
||||
}
|
||||
else
|
||||
{
|
||||
setAllChildShow(locModelIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AlarmDevTreeModel::setAllChildShow(const QModelIndex &parent)
|
||||
{
|
||||
m_pView->setRowHidden(parent.row(), parent.parent(), false);
|
||||
int childCount = rowCount(parent);
|
||||
for(int nIndex(0); nIndex < childCount; nIndex++)
|
||||
{
|
||||
m_pView->setRowHidden(nIndex, parent, false);
|
||||
setAllChildShow(index(nIndex, 0, parent));
|
||||
}
|
||||
}
|
||||
#include "AlarmDevTreeModel.h"
|
||||
#include "AlarmDevTreeView.h"
|
||||
#include "QTreeWidgetItem"
|
||||
#include <QTreeView>
|
||||
#include "AlarmMng.h"
|
||||
|
||||
AlarmDevTreeModel::AlarmDevTreeModel(QObject *parent,QTreeView *view)
|
||||
: QAbstractItemModel(parent),
|
||||
m_pView(view),
|
||||
m_isLink(false),
|
||||
m_root(Q_NULLPTR)
|
||||
{
|
||||
m_root = new QTreeWidgetItem();
|
||||
m_devTypeMap = AlarmMng::instance()->getDevType();
|
||||
init();
|
||||
}
|
||||
|
||||
AlarmDevTreeModel::~AlarmDevTreeModel()
|
||||
{
|
||||
if(Q_NULLPTR != m_root)
|
||||
{
|
||||
delete m_root;
|
||||
}
|
||||
m_root = Q_NULLPTR;
|
||||
}
|
||||
|
||||
QVariant AlarmDevTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
Q_UNUSED(section)
|
||||
Q_UNUSED(role)
|
||||
if(role == Qt::DisplayRole)
|
||||
{
|
||||
if(orientation == Qt::Horizontal)
|
||||
{
|
||||
return QVariant(tr("位置/设备组"));
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QModelIndex AlarmDevTreeModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
if(!hasIndex(row, column, parent) || Q_NULLPTR == m_root)
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QTreeWidgetItem * parentItem;
|
||||
if(!parent.isValid())
|
||||
{
|
||||
parentItem = m_root;
|
||||
}
|
||||
else
|
||||
{
|
||||
parentItem = static_cast<QTreeWidgetItem*>(parent.internalPointer());
|
||||
}
|
||||
|
||||
if(parentItem)
|
||||
{
|
||||
QTreeWidgetItem *childItem = parentItem->child(row);
|
||||
if(childItem)
|
||||
{
|
||||
return createIndex(row,0,childItem);
|
||||
}
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QModelIndex AlarmDevTreeModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QTreeWidgetItem *childItem = static_cast<QTreeWidgetItem*>(index.internalPointer());
|
||||
if (!childItem)
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QTreeWidgetItem *parentItem = childItem->parent();
|
||||
|
||||
if (parentItem == m_root)
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
int row = parentItem->parent()->indexOfChild(parentItem);
|
||||
return createIndex(row, 0, parentItem);
|
||||
}
|
||||
|
||||
int AlarmDevTreeModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if(!parent.isValid())
|
||||
{
|
||||
if (NULL != m_root)
|
||||
{
|
||||
return m_root->childCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QTreeWidgetItem * parentItem = static_cast<QTreeWidgetItem*>(parent.internalPointer());
|
||||
return parentItem->childCount();
|
||||
}
|
||||
}
|
||||
|
||||
int AlarmDevTreeModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
return 1;
|
||||
}
|
||||
|
||||
QVariant AlarmDevTreeModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
QTreeWidgetItem * item = static_cast<QTreeWidgetItem*>(index.internalPointer());
|
||||
if(item)
|
||||
{
|
||||
return item->data(index.column(), role);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Qt::ItemFlags AlarmDevTreeModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return Qt::NoItemFlags;
|
||||
}
|
||||
if(index.column()==0)
|
||||
{
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
|
||||
void AlarmDevTreeModel::setFilter(QString text)
|
||||
{
|
||||
m_fltText = text.toStdString();
|
||||
updateDevTreeNodeStatus();
|
||||
m_pView->viewport()->update();
|
||||
}
|
||||
|
||||
void AlarmDevTreeModel::init()
|
||||
{
|
||||
beginResetModel();
|
||||
QList<int> locList = AlarmMng::instance()->getLocOrder();
|
||||
foreach (const int loc, locList) {
|
||||
QString locdesc = AlarmMng::instance()->getLocDescById(loc);
|
||||
QList<QString> devgList = AlarmMng::instance()->getDevGroupInfo(loc);
|
||||
if(devgList.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QTreeWidgetItem * locItem = new QTreeWidgetItem(m_root, QStringList() << locdesc);
|
||||
locItem->setData(0, Qt::UserRole, loc);
|
||||
locItem->setData(0, Qt::UserRole+1,LOCATION_TYPE);
|
||||
locItem->setData(0, Qt::UserRole+2,locdesc);
|
||||
for(int index(0);index<devgList.count();index++)
|
||||
{
|
||||
QString devgdesc = AlarmMng::instance()->getDevgDescByTag(devgList.at(index));
|
||||
QTreeWidgetItem * devgItem = new QTreeWidgetItem(locItem, QStringList() << devgdesc);
|
||||
devgItem->setData(0, Qt::UserRole, devgList.at(index));
|
||||
devgItem->setData(0, Qt::UserRole+1,DEV_GROUP_TYPE);
|
||||
devgItem->setData(0, Qt::UserRole+2,devgdesc);
|
||||
}
|
||||
}
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void AlarmDevTreeModel::updateDevTreeNodeStatus()
|
||||
{
|
||||
if(!m_root)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
if(m_fltText.empty())
|
||||
{
|
||||
for(int nIndex(0); nIndex<rowCount(); nIndex++)
|
||||
{
|
||||
setAllChildShow(index(nIndex, 0));
|
||||
}
|
||||
return ;
|
||||
}
|
||||
for(int locIndex(0);locIndex<rowCount();locIndex++)
|
||||
{
|
||||
QModelIndex locModelIndex = index(locIndex,0);
|
||||
std::string strLoc = data(locModelIndex, Qt::UserRole+2).toString().toStdString();
|
||||
if(strLoc.find(m_fltText, 0) == -1)
|
||||
{
|
||||
bool isShow = false;
|
||||
for(int devgIndex(0);devgIndex<rowCount(locModelIndex);devgIndex++)
|
||||
{
|
||||
QModelIndex devgModelIndex = index(devgIndex, 0, locModelIndex);
|
||||
std::string stdDevgDesc = data(devgModelIndex, Qt::UserRole+2).toString().toStdString();
|
||||
if(stdDevgDesc.find(m_fltText, 0) != -1)
|
||||
{
|
||||
m_pView->setRowHidden(devgIndex,locModelIndex,false);
|
||||
isShow = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pView->setRowHidden(devgIndex,locModelIndex,true);
|
||||
}
|
||||
}
|
||||
m_pView->setRowHidden(locIndex, parent(locModelIndex), !isShow);
|
||||
}
|
||||
else
|
||||
{
|
||||
setAllChildShow(locModelIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AlarmDevTreeModel::setAllChildShow(const QModelIndex &parent)
|
||||
{
|
||||
m_pView->setRowHidden(parent.row(), parent.parent(), false);
|
||||
int childCount = rowCount(parent);
|
||||
for(int nIndex(0); nIndex < childCount; nIndex++)
|
||||
{
|
||||
m_pView->setRowHidden(nIndex, parent, false);
|
||||
setAllChildShow(index(nIndex, 0, parent));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,73 +1,73 @@
|
||||
#ifndef ALARMDEVTREEMODEL_H
|
||||
#define ALARMDEVTREEMODEL_H
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
class AlarmDevTreeView;
|
||||
class QTreeWidgetItem;
|
||||
class QTreeView;
|
||||
|
||||
|
||||
enum EN_ALARM_DEV_TREE_NODE
|
||||
{
|
||||
ROOT_TYPE = 0,
|
||||
LOCATION_TYPE,
|
||||
DEV_GROUP_TYPE,
|
||||
DEV_TYPE
|
||||
};
|
||||
|
||||
class AlarmDevTreeModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlarmDevTreeModel(QObject *parent = Q_NULLPTR, QTreeView *view = Q_NULLPTR);
|
||||
~AlarmDevTreeModel();
|
||||
// Header:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
// Basic functionality:
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
void setFilter(QString text);
|
||||
|
||||
signals:
|
||||
void itemCheckStateChanged(QStringList tagList,bool checked);
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
void setChildCheck(QTreeWidgetItem *item);
|
||||
|
||||
void setParentCheck(QTreeWidgetItem *item);
|
||||
|
||||
void updateDevTreeNodeStatus();
|
||||
|
||||
void setAllChildShow(const QModelIndex &parent);
|
||||
|
||||
private:
|
||||
QTreeView *m_pView;
|
||||
|
||||
QStringList m_header;
|
||||
|
||||
QTreeWidgetItem *m_root;
|
||||
|
||||
bool m_isLink;
|
||||
|
||||
std::string m_fltText;
|
||||
|
||||
QMap<QString,QString> m_devTypeMap;
|
||||
};
|
||||
|
||||
#endif // ALARMDEVTREEMODEL_H
|
||||
#ifndef ALARMDEVTREEMODEL_H
|
||||
#define ALARMDEVTREEMODEL_H
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
class AlarmDevTreeView;
|
||||
class QTreeWidgetItem;
|
||||
class QTreeView;
|
||||
|
||||
|
||||
enum EN_ALARM_DEV_TREE_NODE
|
||||
{
|
||||
ROOT_TYPE = 0,
|
||||
LOCATION_TYPE,
|
||||
DEV_GROUP_TYPE,
|
||||
DEV_TYPE
|
||||
};
|
||||
|
||||
class AlarmDevTreeModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlarmDevTreeModel(QObject *parent = Q_NULLPTR, QTreeView *view = Q_NULLPTR);
|
||||
~AlarmDevTreeModel();
|
||||
// Header:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
// Basic functionality:
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
void setFilter(QString text);
|
||||
|
||||
signals:
|
||||
void itemCheckStateChanged(QStringList tagList,bool checked);
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
void setChildCheck(QTreeWidgetItem *item);
|
||||
|
||||
void setParentCheck(QTreeWidgetItem *item);
|
||||
|
||||
void updateDevTreeNodeStatus();
|
||||
|
||||
void setAllChildShow(const QModelIndex &parent);
|
||||
|
||||
private:
|
||||
QTreeView *m_pView;
|
||||
|
||||
QStringList m_header;
|
||||
|
||||
QTreeWidgetItem *m_root;
|
||||
|
||||
bool m_isLink;
|
||||
|
||||
std::string m_fltText;
|
||||
|
||||
QMap<QString,QString> m_devTypeMap;
|
||||
};
|
||||
|
||||
#endif // ALARMDEVTREEMODEL_H
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "AlarmDevTreeView.h"
|
||||
|
||||
AlarmDevTreeView::AlarmDevTreeView(QWidget *parent)
|
||||
:QTreeView(parent)
|
||||
{
|
||||
|
||||
}
|
||||
#include "AlarmDevTreeView.h"
|
||||
|
||||
AlarmDevTreeView::AlarmDevTreeView(QWidget *parent)
|
||||
:QTreeView(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
#ifndef ALARMDEVTREEVIEW_H
|
||||
#define ALARMDEVTREEVIEW_H
|
||||
|
||||
#include <QTreeView>
|
||||
|
||||
class AlarmDevTreeView : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AlarmDevTreeView(QWidget *parent = Q_NULLPTR);
|
||||
};
|
||||
|
||||
#endif // ALARMDEVTREEVIEW_H
|
||||
#ifndef ALARMDEVTREEVIEW_H
|
||||
#define ALARMDEVTREEVIEW_H
|
||||
|
||||
#include <QTreeView>
|
||||
|
||||
class AlarmDevTreeView : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AlarmDevTreeView(QWidget *parent = Q_NULLPTR);
|
||||
};
|
||||
|
||||
#endif // ALARMDEVTREEVIEW_H
|
||||
|
||||
@ -1,75 +1,75 @@
|
||||
#ifndef ALARMMANAGECOMMON_H
|
||||
#define ALARMMANAGECOMMON_H
|
||||
#include<QString>
|
||||
|
||||
enum EN_POINT_TYPE_INDEX
|
||||
{
|
||||
EN_POINT_AI_INDEX =0,
|
||||
EN_POINT_DI_INDEX =1
|
||||
};
|
||||
|
||||
struct ST_OBJ_INFO
|
||||
{
|
||||
bool bIsObj;
|
||||
int iPriority;
|
||||
QString strPushPic;
|
||||
QString strVoice;
|
||||
ST_OBJ_INFO()
|
||||
{
|
||||
bIsObj = false;
|
||||
iPriority = 0;
|
||||
strPushPic =QString();
|
||||
strVoice = QString();
|
||||
}
|
||||
};
|
||||
|
||||
struct ST_LIMIT_INFO
|
||||
{
|
||||
bool bIsLimit;
|
||||
int iLevel; // 0,1,2
|
||||
double dLimitUp1;
|
||||
double dLimitDown1;
|
||||
double dLimitUp2;
|
||||
double dLimitDown2;
|
||||
ST_LIMIT_INFO()
|
||||
{
|
||||
bIsLimit =false;
|
||||
iLevel =0;
|
||||
dLimitUp1 = 0.0;
|
||||
dLimitDown1 = 0.0;
|
||||
dLimitUp2 = 0.0;
|
||||
dLimitDown2 = 0.0;
|
||||
}
|
||||
};
|
||||
struct ST_USER_DEF
|
||||
{
|
||||
int iId;
|
||||
QString strName;
|
||||
QString strAlias;
|
||||
QString strDesc;
|
||||
ST_USER_DEF() {
|
||||
|
||||
iId = -1;
|
||||
strName = QString();
|
||||
strAlias= QString();
|
||||
strDesc = QString();
|
||||
}
|
||||
};
|
||||
|
||||
struct ST_DEV_INFO
|
||||
{
|
||||
QString strDev;
|
||||
QString strDevDesc;
|
||||
int nLocId;
|
||||
int nSubId;
|
||||
int nDevType;
|
||||
ST_DEV_INFO()
|
||||
{
|
||||
strDev = QString();
|
||||
strDevDesc = QString();
|
||||
nLocId = -1;
|
||||
nSubId = -1;
|
||||
nDevType = -1;
|
||||
}
|
||||
};
|
||||
#endif // ALARMMANAGECOMMON_H
|
||||
#ifndef ALARMMANAGECOMMON_H
|
||||
#define ALARMMANAGECOMMON_H
|
||||
#include<QString>
|
||||
|
||||
enum EN_POINT_TYPE_INDEX
|
||||
{
|
||||
EN_POINT_AI_INDEX =0,
|
||||
EN_POINT_DI_INDEX =1
|
||||
};
|
||||
|
||||
struct ST_OBJ_INFO
|
||||
{
|
||||
bool bIsObj;
|
||||
int iPriority;
|
||||
QString strPushPic;
|
||||
QString strVoice;
|
||||
ST_OBJ_INFO()
|
||||
{
|
||||
bIsObj = false;
|
||||
iPriority = 0;
|
||||
strPushPic =QString();
|
||||
strVoice = QString();
|
||||
}
|
||||
};
|
||||
|
||||
struct ST_LIMIT_INFO
|
||||
{
|
||||
bool bIsLimit;
|
||||
int iLevel; // 0,1,2
|
||||
double dLimitUp1;
|
||||
double dLimitDown1;
|
||||
double dLimitUp2;
|
||||
double dLimitDown2;
|
||||
ST_LIMIT_INFO()
|
||||
{
|
||||
bIsLimit =false;
|
||||
iLevel =0;
|
||||
dLimitUp1 = 0.0;
|
||||
dLimitDown1 = 0.0;
|
||||
dLimitUp2 = 0.0;
|
||||
dLimitDown2 = 0.0;
|
||||
}
|
||||
};
|
||||
struct ST_USER_DEF
|
||||
{
|
||||
int iId;
|
||||
QString strName;
|
||||
QString strAlias;
|
||||
QString strDesc;
|
||||
ST_USER_DEF() {
|
||||
|
||||
iId = -1;
|
||||
strName = QString();
|
||||
strAlias= QString();
|
||||
strDesc = QString();
|
||||
}
|
||||
};
|
||||
|
||||
struct ST_DEV_INFO
|
||||
{
|
||||
QString strDev;
|
||||
QString strDevDesc;
|
||||
int nLocId;
|
||||
int nSubId;
|
||||
int nDevType;
|
||||
ST_DEV_INFO()
|
||||
{
|
||||
strDev = QString();
|
||||
strDevDesc = QString();
|
||||
nLocId = -1;
|
||||
nSubId = -1;
|
||||
nDevType = -1;
|
||||
}
|
||||
};
|
||||
#endif // ALARMMANAGECOMMON_H
|
||||
|
||||
@ -1,84 +1,84 @@
|
||||
#include "AlarmManageForm.h"
|
||||
#include "ui_AlarmManageForm.h"
|
||||
|
||||
#include "AlarmManageWidget.h"
|
||||
#include <QGridLayout>
|
||||
#include "net_msg_bus_api/MsgBusApi.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include "pub_utility_api/FileStyle.h"
|
||||
|
||||
AlarmManageForm::AlarmManageForm(QWidget *parent,bool edit) :
|
||||
QWidget(parent),
|
||||
m_bEdit(edit),
|
||||
m_alarmWidget(Q_NULLPTR),
|
||||
ui(new Ui::AlarmManageForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QString qss = QString();
|
||||
|
||||
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile1.readAll());
|
||||
//setStyleSheet(qss);
|
||||
qssfile1.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "public.qss 无法打开!";
|
||||
}
|
||||
|
||||
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("alarmmng.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile2.readAll());
|
||||
//setStyleSheet(qss);
|
||||
qssfile2.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "alarmmng.qss 无法打开!";
|
||||
}
|
||||
if(!qss.isEmpty())
|
||||
{
|
||||
setStyleSheet(qss);
|
||||
}
|
||||
initLayout();
|
||||
initMember();
|
||||
}
|
||||
|
||||
AlarmManageForm::~AlarmManageForm()
|
||||
{
|
||||
if(m_alarmWidget)
|
||||
{
|
||||
delete m_alarmWidget;
|
||||
m_alarmWidget = NULL;
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AlarmManageForm::initLayout()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AlarmManageForm::initMember()
|
||||
{
|
||||
if(m_alarmWidget == NULL)
|
||||
{
|
||||
m_alarmWidget = new AlarmManageWidget(this,m_bEdit);
|
||||
addWidget();
|
||||
}
|
||||
}
|
||||
|
||||
void AlarmManageForm::addWidget()
|
||||
{
|
||||
QGridLayout *gridLayout = new QGridLayout(ui->widget);
|
||||
gridLayout->setSpacing(6);
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
gridLayout->addWidget(m_alarmWidget, 0, 0, 1, 1);
|
||||
}
|
||||
#include "AlarmManageForm.h"
|
||||
#include "ui_AlarmManageForm.h"
|
||||
|
||||
#include "AlarmManageWidget.h"
|
||||
#include <QGridLayout>
|
||||
#include "net_msg_bus_api/MsgBusApi.h"
|
||||
#include "pub_logger_api/logger.h"
|
||||
#include "pub_utility_api/FileStyle.h"
|
||||
|
||||
AlarmManageForm::AlarmManageForm(QWidget *parent,bool edit) :
|
||||
QWidget(parent),
|
||||
m_bEdit(edit),
|
||||
m_alarmWidget(Q_NULLPTR),
|
||||
ui(new Ui::AlarmManageForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QString qss = QString();
|
||||
|
||||
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||
qssfile1.open(QFile::ReadOnly);
|
||||
if (qssfile1.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile1.readAll());
|
||||
//setStyleSheet(qss);
|
||||
qssfile1.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "public.qss 无法打开!";
|
||||
}
|
||||
|
||||
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarmmng.qss") ;
|
||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||
qssfile2.open(QFile::ReadOnly);
|
||||
if (qssfile2.isOpen())
|
||||
{
|
||||
qss += QLatin1String(qssfile2.readAll());
|
||||
//setStyleSheet(qss);
|
||||
qssfile2.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "alarmmng.qss 无法打开!";
|
||||
}
|
||||
if(!qss.isEmpty())
|
||||
{
|
||||
setStyleSheet(qss);
|
||||
}
|
||||
initLayout();
|
||||
initMember();
|
||||
}
|
||||
|
||||
AlarmManageForm::~AlarmManageForm()
|
||||
{
|
||||
if(m_alarmWidget)
|
||||
{
|
||||
delete m_alarmWidget;
|
||||
m_alarmWidget = NULL;
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AlarmManageForm::initLayout()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AlarmManageForm::initMember()
|
||||
{
|
||||
if(m_alarmWidget == NULL)
|
||||
{
|
||||
m_alarmWidget = new AlarmManageWidget(this,m_bEdit);
|
||||
addWidget();
|
||||
}
|
||||
}
|
||||
|
||||
void AlarmManageForm::addWidget()
|
||||
{
|
||||
QGridLayout *gridLayout = new QGridLayout(ui->widget);
|
||||
gridLayout->setSpacing(6);
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
gridLayout->addWidget(m_alarmWidget, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
#ifndef ALARMMANAGEFORM_H
|
||||
#define ALARMMANAGEFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class AlarmManageForm;
|
||||
}
|
||||
|
||||
class AlarmManageForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlarmManageForm(QWidget *parent = 0, bool edit = false);
|
||||
~AlarmManageForm();
|
||||
|
||||
void initLayout();
|
||||
|
||||
void initMember();
|
||||
|
||||
private:
|
||||
void addWidget();
|
||||
private:
|
||||
Ui::AlarmManageForm *ui;
|
||||
|
||||
QWidget *m_alarmWidget;
|
||||
|
||||
bool m_bEdit;
|
||||
};
|
||||
|
||||
#endif // ALARMMANAGEFORM_H
|
||||
#ifndef ALARMMANAGEFORM_H
|
||||
#define ALARMMANAGEFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class AlarmManageForm;
|
||||
}
|
||||
|
||||
class AlarmManageForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlarmManageForm(QWidget *parent = 0, bool edit = false);
|
||||
~AlarmManageForm();
|
||||
|
||||
void initLayout();
|
||||
|
||||
void initMember();
|
||||
|
||||
private:
|
||||
void addWidget();
|
||||
private:
|
||||
Ui::AlarmManageForm *ui;
|
||||
|
||||
QWidget *m_alarmWidget;
|
||||
|
||||
bool m_bEdit;
|
||||
};
|
||||
|
||||
#endif // ALARMMANAGEFORM_H
|
||||
|
||||
@ -1,36 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AlarmManageForm</class>
|
||||
<widget class="QWidget" name="AlarmManageForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1157</width>
|
||||
<height>610</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="widget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AlarmManageForm</class>
|
||||
<widget class="QWidget" name="AlarmManageForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1157</width>
|
||||
<height>610</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="widget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
#include "AlarmManagePluginWidget.h"
|
||||
#include "AlarmManageForm.h"
|
||||
AlarmManagePluginWidget::AlarmManagePluginWidget(QObject *parent): QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AlarmManagePluginWidget::~AlarmManagePluginWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool AlarmManagePluginWidget::createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec)
|
||||
{
|
||||
Q_UNUSED(ptrVec)
|
||||
AlarmManageForm *pWidget = new AlarmManageForm(parent, editMode);
|
||||
*widget = (QWidget *)pWidget;
|
||||
*alarmWidget = (IPluginWidget *)pWidget;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AlarmManagePluginWidget::release()
|
||||
{
|
||||
|
||||
}
|
||||
#include "AlarmManagePluginWidget.h"
|
||||
#include "AlarmManageForm.h"
|
||||
AlarmManagePluginWidget::AlarmManagePluginWidget(QObject *parent): QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AlarmManagePluginWidget::~AlarmManagePluginWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool AlarmManagePluginWidget::createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec)
|
||||
{
|
||||
Q_UNUSED(ptrVec)
|
||||
AlarmManageForm *pWidget = new AlarmManageForm(parent, editMode);
|
||||
*widget = (QWidget *)pWidget;
|
||||
*alarmWidget = (IPluginWidget *)pWidget;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AlarmManagePluginWidget::release()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
#ifndef ALARMMANAGEPLUGINWIDGET_H
|
||||
#define ALARMMANAGEPLUGINWIDGET_H
|
||||
|
||||
#include <QObject>
|
||||
#include "GraphShape/CPluginWidget.h" //< ISCS6000_HOME/platform/src/include/gui/GraphShape
|
||||
|
||||
|
||||
class AlarmManagePluginWidget : public QObject, public CPluginWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID HMI_WidgetPlugin_IID)
|
||||
Q_INTERFACES(CPluginWidgetInterface)
|
||||
|
||||
public:
|
||||
AlarmManagePluginWidget(QObject *parent = 0);
|
||||
~AlarmManagePluginWidget();
|
||||
|
||||
bool createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec);
|
||||
void release();
|
||||
};
|
||||
|
||||
#endif // ALARMMANAGEPLUGINWIDGET_H
|
||||
#ifndef ALARMMANAGEPLUGINWIDGET_H
|
||||
#define ALARMMANAGEPLUGINWIDGET_H
|
||||
|
||||
#include <QObject>
|
||||
#include "GraphShape/CPluginWidget.h" //< ISCS6000_HOME/platform/src/include/gui/GraphShape
|
||||
|
||||
|
||||
class AlarmManagePluginWidget : public QObject, public CPluginWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
||||
Q_INTERFACES(CPluginWidgetInterface)
|
||||
|
||||
public:
|
||||
AlarmManagePluginWidget(QObject *parent = 0);
|
||||
~AlarmManagePluginWidget();
|
||||
|
||||
bool createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec);
|
||||
void release();
|
||||
};
|
||||
|
||||
#endif // ALARMMANAGEPLUGINWIDGET_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,146 +1,146 @@
|
||||
#ifndef ALARMMANAGEWIDGET_H
|
||||
#define ALARMMANAGEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMap>
|
||||
#include <QPushButton>
|
||||
#include "PointInfo.h"
|
||||
#include "db_api_ex/CDbApi.h"
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class AlarmDevTreeView;
|
||||
class AlarmDevTreeModel;
|
||||
class QThread;
|
||||
class AlarmPointTableModel;
|
||||
class QCheckBox;
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class AlarmManageWidget;
|
||||
}
|
||||
|
||||
class AlarmManageWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlarmManageWidget(QWidget *parent = 0, bool editMode = false);
|
||||
~AlarmManageWidget();
|
||||
|
||||
signals:
|
||||
void sigSelectPoint(const QString &devg,const int index,const QString &filter = "");
|
||||
|
||||
void sigClearPointTable();
|
||||
private:
|
||||
void initLayout();
|
||||
|
||||
void initMember();
|
||||
|
||||
void initModel();
|
||||
|
||||
void initData();
|
||||
|
||||
bool initCurUser();
|
||||
|
||||
void initConnect();
|
||||
|
||||
void setEnableProperty(bool enable);
|
||||
|
||||
void setEnableDesc(bool enable);
|
||||
|
||||
void setEnableObjAlarm(bool enable);
|
||||
|
||||
void setEnableLimitAlarm(bool enable);
|
||||
|
||||
void saveAi();
|
||||
|
||||
void saveDi();
|
||||
|
||||
void showShieldProperty();
|
||||
|
||||
void initView();
|
||||
|
||||
void initProperty();
|
||||
|
||||
void initHide();
|
||||
|
||||
void reLoadData(const QString &filter ="");
|
||||
|
||||
void deleteAi();
|
||||
|
||||
void deleteDi();
|
||||
|
||||
private slots:
|
||||
void filter();
|
||||
|
||||
void alarmActionCheckChange(int index);
|
||||
|
||||
void ifLimitChange(const QString & );
|
||||
|
||||
void ifObjChange(const QString &);
|
||||
|
||||
void getPushPicPath();
|
||||
|
||||
void getVoicePath();
|
||||
|
||||
void showAiAlarmProperty(const QModelIndex &cur);
|
||||
|
||||
void showDiAlarmProperty(const QModelIndex &cur);
|
||||
|
||||
void showAiProperty();
|
||||
|
||||
void showDiProperty();
|
||||
|
||||
void checkClick(const QModelIndex &index);
|
||||
|
||||
void ifLimitLevelChange(const QString &);
|
||||
|
||||
void save();
|
||||
|
||||
bool checkAiIfSave();
|
||||
|
||||
void addObjAlarm();
|
||||
|
||||
void updateStack(int index);
|
||||
|
||||
void filterPoint();
|
||||
|
||||
void sigOrMul(int checked);
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
|
||||
private:
|
||||
Ui::AlarmManageWidget *ui;
|
||||
|
||||
QThread *m_pThread;
|
||||
|
||||
AlarmDevTreeModel *m_pDevTreeModel;
|
||||
AlarmPointTableModel * m_pAiPointTableModel;
|
||||
AlarmPointTableModel * m_pDiPointTableModel;
|
||||
QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作
|
||||
|
||||
QMap<int,QString > m_alarmActionMap; //告警动作
|
||||
QMap<int,int> m_alarmLevelActionMap; //等级--动作
|
||||
QMap<int,QString> m_alarmLevelMap; //等级--等级描述
|
||||
|
||||
QMap<int,int> m_alarmLevelIndexMap;
|
||||
|
||||
iot_dbms::CDbApi *m_pReadDb;
|
||||
iot_dbms::CDbApi *m_pWriteDb;
|
||||
|
||||
int m_userId;
|
||||
int m_usergId;
|
||||
|
||||
QString m_hostName;
|
||||
|
||||
QString m_devgName;
|
||||
|
||||
bool m_bIsEditMode;
|
||||
QString m_strMediaPath;
|
||||
|
||||
QButtonGroup *m_buttonGroup;
|
||||
int m_curStackIndex;
|
||||
};
|
||||
|
||||
#endif // ALARMMANAGEWIDGET_H
|
||||
#ifndef ALARMMANAGEWIDGET_H
|
||||
#define ALARMMANAGEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMap>
|
||||
#include <QPushButton>
|
||||
#include "PointInfo.h"
|
||||
#include "db_api_ex/CDbApi.h"
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class AlarmDevTreeView;
|
||||
class AlarmDevTreeModel;
|
||||
class QThread;
|
||||
class AlarmPointTableModel;
|
||||
class QCheckBox;
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class AlarmManageWidget;
|
||||
}
|
||||
|
||||
class AlarmManageWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlarmManageWidget(QWidget *parent = 0, bool editMode = false);
|
||||
~AlarmManageWidget();
|
||||
|
||||
signals:
|
||||
void sigSelectPoint(const QString &devg,const int index,const QString &filter = "");
|
||||
|
||||
void sigClearPointTable();
|
||||
private:
|
||||
void initLayout();
|
||||
|
||||
void initMember();
|
||||
|
||||
void initModel();
|
||||
|
||||
void initData();
|
||||
|
||||
bool initCurUser();
|
||||
|
||||
void initConnect();
|
||||
|
||||
void setEnableProperty(bool enable);
|
||||
|
||||
void setEnableDesc(bool enable);
|
||||
|
||||
void setEnableObjAlarm(bool enable);
|
||||
|
||||
void setEnableLimitAlarm(bool enable);
|
||||
|
||||
void saveAi();
|
||||
|
||||
void saveDi();
|
||||
|
||||
void showShieldProperty();
|
||||
|
||||
void initView();
|
||||
|
||||
void initProperty();
|
||||
|
||||
void initHide();
|
||||
|
||||
void reLoadData(const QString &filter ="");
|
||||
|
||||
void deleteAi();
|
||||
|
||||
void deleteDi();
|
||||
|
||||
private slots:
|
||||
void filter();
|
||||
|
||||
void alarmActionCheckChange(int index);
|
||||
|
||||
void ifLimitChange(const QString & );
|
||||
|
||||
void ifObjChange(const QString &);
|
||||
|
||||
void getPushPicPath();
|
||||
|
||||
void getVoicePath();
|
||||
|
||||
void showAiAlarmProperty(const QModelIndex &cur);
|
||||
|
||||
void showDiAlarmProperty(const QModelIndex &cur);
|
||||
|
||||
void showAiProperty();
|
||||
|
||||
void showDiProperty();
|
||||
|
||||
void checkClick(const QModelIndex &index);
|
||||
|
||||
void ifLimitLevelChange(const QString &);
|
||||
|
||||
void save();
|
||||
|
||||
bool checkAiIfSave();
|
||||
|
||||
void addObjAlarm();
|
||||
|
||||
void updateStack(int index);
|
||||
|
||||
void filterPoint();
|
||||
|
||||
void sigOrMul(int checked);
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
|
||||
private:
|
||||
Ui::AlarmManageWidget *ui;
|
||||
|
||||
QThread *m_pThread;
|
||||
|
||||
AlarmDevTreeModel *m_pDevTreeModel;
|
||||
AlarmPointTableModel * m_pAiPointTableModel;
|
||||
AlarmPointTableModel * m_pDiPointTableModel;
|
||||
QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作
|
||||
|
||||
QMap<int,QString > m_alarmActionMap; //告警动作
|
||||
QMap<int,int> m_alarmLevelActionMap; //等级--动作
|
||||
QMap<int,QString> m_alarmLevelMap; //等级--等级描述
|
||||
|
||||
QMap<int,int> m_alarmLevelIndexMap;
|
||||
|
||||
kbd_dbms::CDbApi *m_pReadDb;
|
||||
kbd_dbms::CDbApi *m_pWriteDb;
|
||||
|
||||
int m_userId;
|
||||
int m_usergId;
|
||||
|
||||
QString m_hostName;
|
||||
|
||||
QString m_devgName;
|
||||
|
||||
bool m_bIsEditMode;
|
||||
QString m_strMediaPath;
|
||||
|
||||
QButtonGroup *m_buttonGroup;
|
||||
int m_curStackIndex;
|
||||
};
|
||||
|
||||
#endif // ALARMMANAGEWIDGET_H
|
||||
|
||||
@ -1,91 +1,91 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2020-09-01T08:48:38
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui sql
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = AlarmManageWidget
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += plugin
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
INCLUDEPATH += $$PWD/../../../../../platform/src/include/tools/model_table \
|
||||
$$PWD/../../../../../platform/src/include/tools/model_excel/xlsx
|
||||
|
||||
SOURCES += \
|
||||
AlarmManageWidget.cpp \
|
||||
AlarmDevTreeView.cpp \
|
||||
AlarmDevTreeModel.cpp \
|
||||
AlarmPointTableView.cpp \
|
||||
AlarmPointTableModel.cpp \
|
||||
PointInfo.cpp \
|
||||
AlarmMng.cpp \
|
||||
AlarmManageForm.cpp \
|
||||
AlarmManagePluginWidget.cpp \
|
||||
AddObjAlarmDialog.cpp \
|
||||
#main.cpp \
|
||||
AlarmCalcInfo.cpp \
|
||||
AlarmCalcParaTableDelegate.cpp \
|
||||
AlarmCalcParaTableModel.cpp \
|
||||
AlarmUuidBase64.cpp
|
||||
|
||||
HEADERS += \
|
||||
AlarmManageWidget.h \
|
||||
AlarmDevTreeView.h \
|
||||
AlarmDevTreeModel.h \
|
||||
AlarmPointTableView.h \
|
||||
AlarmPointTableModel.h \
|
||||
PointInfo.h \
|
||||
AlarmMng.h \
|
||||
AlarmManageCommon.h \
|
||||
AlarmManageForm.h \
|
||||
AlarmManagePluginWidget.h \
|
||||
AddObjAlarmDialog.h \
|
||||
AlarmCalcInfo.h \
|
||||
AlarmCalcParaTableDelegate.h \
|
||||
AlarmCalcParaTableModel.h \
|
||||
AlarmUuidBase64.h
|
||||
|
||||
FORMS += \
|
||||
AlarmManageWidget.ui \
|
||||
AlarmManageForm.ui \
|
||||
AddObjAlarmDialog.ui
|
||||
|
||||
|
||||
LIBS += -lboost_system -lboost_chrono
|
||||
LIBS += -llog4cplus -lpub_logger_api
|
||||
LIBS += -lpub_utility_api -lpub_sysinfo_api
|
||||
LIBS += -ldb_base_api -ldb_api_ex -lrdb_api -lrdb_net_api -ltsdb_api
|
||||
LIBS += -lperm_mng_api -ldp_chg_data_api
|
||||
LIBS += -lnet_msg_bus_api
|
||||
|
||||
LIBS += -lmodel_table
|
||||
|
||||
win32-msvc* {
|
||||
LIBS += -lbcrypt
|
||||
}
|
||||
|
||||
LIBS += -lboost_system -lboost_chrono -lboost_program_options
|
||||
LIBS += -lboost_filesystem
|
||||
|
||||
exists($$PWD/../../../common.pri) {
|
||||
include($$PWD/../../../common.pri)
|
||||
}else {
|
||||
error("FATAL error: connot find common.pri")
|
||||
}
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2020-09-01T08:48:38
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui sql
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = AlarmManageWidget
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += plugin
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
INCLUDEPATH += $$PWD/../../../../../platform/src/include/tools/model_table \
|
||||
$$PWD/../../../../../platform/src/include/tools/model_excel/xlsx
|
||||
|
||||
SOURCES += \
|
||||
AlarmManageWidget.cpp \
|
||||
AlarmDevTreeView.cpp \
|
||||
AlarmDevTreeModel.cpp \
|
||||
AlarmPointTableView.cpp \
|
||||
AlarmPointTableModel.cpp \
|
||||
PointInfo.cpp \
|
||||
AlarmMng.cpp \
|
||||
AlarmManageForm.cpp \
|
||||
AlarmManagePluginWidget.cpp \
|
||||
AddObjAlarmDialog.cpp \
|
||||
#main.cpp \
|
||||
AlarmCalcInfo.cpp \
|
||||
AlarmCalcParaTableDelegate.cpp \
|
||||
AlarmCalcParaTableModel.cpp \
|
||||
AlarmUuidBase64.cpp
|
||||
|
||||
HEADERS += \
|
||||
AlarmManageWidget.h \
|
||||
AlarmDevTreeView.h \
|
||||
AlarmDevTreeModel.h \
|
||||
AlarmPointTableView.h \
|
||||
AlarmPointTableModel.h \
|
||||
PointInfo.h \
|
||||
AlarmMng.h \
|
||||
AlarmManageCommon.h \
|
||||
AlarmManageForm.h \
|
||||
AlarmManagePluginWidget.h \
|
||||
AddObjAlarmDialog.h \
|
||||
AlarmCalcInfo.h \
|
||||
AlarmCalcParaTableDelegate.h \
|
||||
AlarmCalcParaTableModel.h \
|
||||
AlarmUuidBase64.h
|
||||
|
||||
FORMS += \
|
||||
AlarmManageWidget.ui \
|
||||
AlarmManageForm.ui \
|
||||
AddObjAlarmDialog.ui
|
||||
|
||||
|
||||
LIBS += -lboost_system -lboost_chrono
|
||||
LIBS += -llog4cplus -lpub_logger_api
|
||||
LIBS += -lpub_utility_api -lpub_sysinfo_api
|
||||
LIBS += -ldb_base_api -ldb_api_ex -lrdb_api -lrdb_net_api -ltsdb_api
|
||||
LIBS += -lperm_mng_api -ldp_chg_data_api
|
||||
LIBS += -lnet_msg_bus_api
|
||||
|
||||
LIBS += -lmodel_table
|
||||
|
||||
win32-msvc* {
|
||||
LIBS += -lbcrypt
|
||||
}
|
||||
|
||||
LIBS += -lboost_system -lboost_chrono -lboost_program_options
|
||||
LIBS += -lboost_filesystem
|
||||
|
||||
exists($$PWD/../../../common.pri) {
|
||||
include($$PWD/../../../common.pri)
|
||||
}else {
|
||||
error("FATAL error: connot find common.pri")
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user