[ref]dos2unix cflf->lf
This commit is contained in:
parent
cb3d1ca061
commit
5b3eaaf1b4
@ -1,3 +1,3 @@
|
|||||||
TEMPLATE=subdirs
|
TEMPLATE=subdirs
|
||||||
CONFIG += ordered
|
CONFIG += ordered
|
||||||
SUBDIRS+= fileSync NavigationApi NavigationTool IconActTool
|
SUBDIRS+= fileSync NavigationApi NavigationTool IconActTool
|
||||||
|
|||||||
@ -1,238 +1,238 @@
|
|||||||
#include "CFileOpt.h"
|
#include "CFileOpt.h"
|
||||||
#include "public/pub_logger_api/logger.h"
|
#include "public/pub_logger_api/logger.h"
|
||||||
#include "public/pub_utility_api/FileUtil.h"
|
#include "public/pub_utility_api/FileUtil.h"
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
CFileOpt::CFileOpt()
|
CFileOpt::CFileOpt()
|
||||||
{
|
{
|
||||||
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
||||||
readColorCofig(QString::fromStdString(currentPath) + "/../../data/model/colorConfig.xml", m_strategyMap);
|
readColorCofig(QString::fromStdString(currentPath) + "/../../data/model/colorConfig.xml", m_strategyMap);
|
||||||
readIconDefaultStrategy(QString::fromStdString(currentPath) + "/../../data/model/toolbox.xml", m_iconDefaultStrategyMap);
|
readIconDefaultStrategy(QString::fromStdString(currentPath) + "/../../data/model/toolbox.xml", m_iconDefaultStrategyMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CFileOpt::getDefaultStrategy(const QString &icon)
|
QString CFileOpt::getDefaultStrategy(const QString &icon)
|
||||||
{
|
{
|
||||||
QString strategy = m_iconDefaultStrategyMap.value(icon);
|
QString strategy = m_iconDefaultStrategyMap.value(icon);
|
||||||
if(!strategy.isEmpty())
|
if(!strategy.isEmpty())
|
||||||
{
|
{
|
||||||
return getStrategyDesc(strategy);
|
return getStrategyDesc(strategy);
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QVariant, QString> CFileOpt::getStrategyMap()
|
QMap<QVariant, QString> CFileOpt::getStrategyMap()
|
||||||
{
|
{
|
||||||
return m_strategyMap;
|
return m_strategyMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CFileOpt::getStrategyDesc(const QVariant &key)
|
QString CFileOpt::getStrategyDesc(const QVariant &key)
|
||||||
{
|
{
|
||||||
return m_strategyMap.value(key);
|
return m_strategyMap.value(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFileOpt::readColorCofig(const QString &path, QMap<QVariant, QString> &map)
|
void CFileOpt::readColorCofig(const QString &path, QMap<QVariant, QString> &map)
|
||||||
{
|
{
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if(!file.open(QIODevice::ReadOnly))
|
if(!file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt::readColorCofig cannot open file, path: %s", path.toStdString().c_str());
|
LOGERROR("CFileOpt::readColorCofig cannot open file, path: %s", path.toStdString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QDomDocument document;
|
QDomDocument document;
|
||||||
bool ret = document.setContent(&file);
|
bool ret = document.setContent(&file);
|
||||||
file.close();
|
file.close();
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt::readColorCofig error");
|
LOGERROR("CFileOpt::readColorCofig error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QDomElement root = document.documentElement();
|
QDomElement root = document.documentElement();
|
||||||
QDomNodeList nodeList = root.childNodes();
|
QDomNodeList nodeList = root.childNodes();
|
||||||
QString name;
|
QString name;
|
||||||
QString desc;
|
QString desc;
|
||||||
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
||||||
QDomElement node = nodeList.at(nIndex).toElement();
|
QDomElement node = nodeList.at(nIndex).toElement();
|
||||||
name = node.tagName();
|
name = node.tagName();
|
||||||
desc = node.attribute("description");
|
desc = node.attribute("description");
|
||||||
if(desc.isEmpty())
|
if(desc.isEmpty())
|
||||||
{
|
{
|
||||||
map.insert(name, name);
|
map.insert(name, name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
map.insert(name, name+":"+desc);
|
map.insert(name, name+":"+desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFileOpt::readIconAction(const QString &path, QList<ST_ICONACT> &list)
|
void CFileOpt::readIconAction(const QString &path, QList<ST_ICONACT> &list)
|
||||||
{
|
{
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
QByteArray readJson;
|
QByteArray readJson;
|
||||||
if(file.open(QIODevice::ReadOnly))
|
if(file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
readJson = file.readAll();
|
readJson = file.readAll();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt::readIconAction cannot open file, path: %s", path.toStdString().c_str());
|
LOGERROR("CFileOpt::readIconAction cannot open file, path: %s", path.toStdString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QJsonParseError readError;
|
QJsonParseError readError;
|
||||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||||
if(readError.error != QJsonParseError::NoError)
|
if(readError.error != QJsonParseError::NoError)
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt:readIconAction error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
LOGERROR("CFileOpt:readIconAction error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QJsonObject root = readJsonResponse.object();
|
QJsonObject root = readJsonResponse.object();
|
||||||
QJsonObject::const_iterator rootIter = root.constBegin();
|
QJsonObject::const_iterator rootIter = root.constBegin();
|
||||||
ST_ICONACT st_icon;
|
ST_ICONACT st_icon;
|
||||||
QString strategy;
|
QString strategy;
|
||||||
for(; rootIter != root.constEnd(); rootIter++)
|
for(; rootIter != root.constEnd(); rootIter++)
|
||||||
{
|
{
|
||||||
QJsonObject item = rootIter.value().toObject();
|
QJsonObject item = rootIter.value().toObject();
|
||||||
st_icon.name = rootIter.key();
|
st_icon.name = rootIter.key();
|
||||||
st_icon.action = item.value("Action").toInt();
|
st_icon.action = item.value("Action").toInt();
|
||||||
st_icon.panel = item.value("Panel").toString();
|
st_icon.panel = item.value("Panel").toString();
|
||||||
st_icon.simulate = item.value("Simulate").toInt();
|
st_icon.simulate = item.value("Simulate").toInt();
|
||||||
strategy = m_iconDefaultStrategyMap.value(st_icon.name);
|
strategy = m_iconDefaultStrategyMap.value(st_icon.name);
|
||||||
if(!strategy.isEmpty())
|
if(!strategy.isEmpty())
|
||||||
{
|
{
|
||||||
st_icon.strategy = getStrategyDesc(strategy);
|
st_icon.strategy = getStrategyDesc(strategy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
st_icon.strategy = QString();
|
st_icon.strategy = QString();
|
||||||
}
|
}
|
||||||
list.append(st_icon);
|
list.append(st_icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFileOpt::saveIconAction(const QString &path, const QList<ST_ICONACT> &list)
|
bool CFileOpt::saveIconAction(const QString &path, const QList<ST_ICONACT> &list)
|
||||||
{
|
{
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if(!file.open(QIODevice::WriteOnly))
|
if(!file.open(QIODevice::WriteOnly))
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt::saveIconAction cannot open file, path: %s", path.toStdString().c_str());
|
LOGERROR("CFileOpt::saveIconAction cannot open file, path: %s", path.toStdString().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QJsonDocument doc;
|
QJsonDocument doc;
|
||||||
QJsonObject obj;
|
QJsonObject obj;
|
||||||
foreach (ST_ICONACT st_icon, list) {
|
foreach (ST_ICONACT st_icon, list) {
|
||||||
QJsonObject temp;
|
QJsonObject temp;
|
||||||
temp.insert("Action", st_icon.action);
|
temp.insert("Action", st_icon.action);
|
||||||
temp.insert("Panel", st_icon.panel);
|
temp.insert("Panel", st_icon.panel);
|
||||||
temp.insert("Simulate", st_icon.simulate);
|
temp.insert("Simulate", st_icon.simulate);
|
||||||
obj.insert(st_icon.name, temp);
|
obj.insert(st_icon.name, temp);
|
||||||
}
|
}
|
||||||
doc.setObject(obj);
|
doc.setObject(obj);
|
||||||
if(-1 == file.write(doc.toJson()))
|
if(-1 == file.write(doc.toJson()))
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt::saveIconAction write false, path: %s", path.toStdString().c_str());
|
LOGERROR("CFileOpt::saveIconAction write false, path: %s", path.toStdString().c_str());
|
||||||
file.close();
|
file.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFileOpt::readIconDefaultStrategy(const QString &path, QMap<QString, QString> &map)
|
void CFileOpt::readIconDefaultStrategy(const QString &path, QMap<QString, QString> &map)
|
||||||
{
|
{
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if(!file.open(QIODevice::ReadOnly))
|
if(!file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QDomDocument document;
|
QDomDocument document;
|
||||||
bool ret = document.setContent(&file);
|
bool ret = document.setContent(&file);
|
||||||
file.close();
|
file.close();
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt::readToolbox error");
|
LOGERROR("CFileOpt::readToolbox error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QDomElement root = document.documentElement();
|
QDomElement root = document.documentElement();
|
||||||
makeIconDefaultStrategy(root, map);
|
makeIconDefaultStrategy(root, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFileOpt::saveIconDefaultStrategy(const QString &path, const QMap<QString, QString> &map)
|
bool CFileOpt::saveIconDefaultStrategy(const QString &path, const QMap<QString, QString> &map)
|
||||||
{
|
{
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if(!file.open(QIODevice::ReadOnly))
|
if(!file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QDomDocument document;
|
QDomDocument document;
|
||||||
bool ret = document.setContent(&file);
|
bool ret = document.setContent(&file);
|
||||||
file.close();
|
file.close();
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt::readToolbox error");
|
LOGERROR("CFileOpt::readToolbox error");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QDomElement root = document.documentElement();
|
QDomElement root = document.documentElement();
|
||||||
replaceIconDefaultStretegy(root, map);
|
replaceIconDefaultStretegy(root, map);
|
||||||
if(!file.open(QIODevice::WriteOnly))
|
if(!file.open(QIODevice::WriteOnly))
|
||||||
{
|
{
|
||||||
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
LOGERROR("CFileOpt::readToolbox cannot open file, path: %s", path.toStdString().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QTextStream content(&file);
|
QTextStream content(&file);
|
||||||
document.save(content, 1);
|
document.save(content, 1);
|
||||||
file.close();
|
file.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFileOpt::makeIconDefaultStrategy(QDomElement element, QMap<QString, QString> &map)
|
void CFileOpt::makeIconDefaultStrategy(QDomElement element, QMap<QString, QString> &map)
|
||||||
{
|
{
|
||||||
QString strategy;
|
QString strategy;
|
||||||
QDomNodeList nodeList = element.childNodes();
|
QDomNodeList nodeList = element.childNodes();
|
||||||
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
||||||
QDomElement node = nodeList.at(nIndex).toElement();
|
QDomElement node = nodeList.at(nIndex).toElement();
|
||||||
strategy = node.attribute("strategy");
|
strategy = node.attribute("strategy");
|
||||||
if(!strategy.isEmpty())
|
if(!strategy.isEmpty())
|
||||||
{
|
{
|
||||||
map.insert(node.tagName(), strategy);
|
map.insert(node.tagName(), strategy);
|
||||||
}
|
}
|
||||||
makeIconDefaultStrategy(node, map);
|
makeIconDefaultStrategy(node, map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFileOpt::replaceIconDefaultStretegy(QDomElement &element, const QMap<QString, QString> &map)
|
void CFileOpt::replaceIconDefaultStretegy(QDomElement &element, const QMap<QString, QString> &map)
|
||||||
{
|
{
|
||||||
QString strategy;
|
QString strategy;
|
||||||
QString newStrategy;
|
QString newStrategy;
|
||||||
QDomNodeList nodeList = element.childNodes();
|
QDomNodeList nodeList = element.childNodes();
|
||||||
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
for(int nIndex(0); nIndex<nodeList.size(); nIndex++) {
|
||||||
QDomNode oldNode = nodeList.at(nIndex);
|
QDomNode oldNode = nodeList.at(nIndex);
|
||||||
QDomElement node = nodeList.at(nIndex).toElement();
|
QDomElement node = nodeList.at(nIndex).toElement();
|
||||||
strategy = node.attribute("strategy");
|
strategy = node.attribute("strategy");
|
||||||
QMap<QString,QString>::const_iterator iter = map.find(node.tagName());
|
QMap<QString,QString>::const_iterator iter = map.find(node.tagName());
|
||||||
if(iter == map.constEnd())
|
if(iter == map.constEnd())
|
||||||
{
|
{
|
||||||
replaceIconDefaultStretegy(node, map);
|
replaceIconDefaultStretegy(node, map);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
newStrategy = map[node.tagName()];
|
newStrategy = map[node.tagName()];
|
||||||
if(strategy != newStrategy)
|
if(strategy != newStrategy)
|
||||||
{
|
{
|
||||||
node.setAttribute("strategy", newStrategy);
|
node.setAttribute("strategy", newStrategy);
|
||||||
if(newStrategy.isEmpty())
|
if(newStrategy.isEmpty())
|
||||||
{
|
{
|
||||||
node.removeAttribute("strategy");
|
node.removeAttribute("strategy");
|
||||||
}
|
}
|
||||||
element.replaceChild(node, oldNode);
|
element.replaceChild(node, oldNode);
|
||||||
}
|
}
|
||||||
replaceIconDefaultStretegy(node, map);
|
replaceIconDefaultStretegy(node, map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,35 +1,35 @@
|
|||||||
#ifndef CFILEOPT_H
|
#ifndef CFILEOPT_H
|
||||||
#define CFILEOPT_H
|
#define CFILEOPT_H
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include "CIconActPublic.h"
|
#include "CIconActPublic.h"
|
||||||
|
|
||||||
class QDomElement;
|
class QDomElement;
|
||||||
class CFileOpt
|
class CFileOpt
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CFileOpt();
|
CFileOpt();
|
||||||
|
|
||||||
QString getDefaultStrategy(const QString& icon);
|
QString getDefaultStrategy(const QString& icon);
|
||||||
QMap<QVariant, QString> getStrategyMap();
|
QMap<QVariant, QString> getStrategyMap();
|
||||||
QString getStrategyDesc(const QVariant &key);
|
QString getStrategyDesc(const QVariant &key);
|
||||||
|
|
||||||
void readColorCofig(const QString &path, QMap<QVariant, QString> &map);
|
void readColorCofig(const QString &path, QMap<QVariant, QString> &map);
|
||||||
|
|
||||||
void readIconAction(const QString &path, QList<ST_ICONACT> &list);
|
void readIconAction(const QString &path, QList<ST_ICONACT> &list);
|
||||||
bool saveIconAction(const QString &path, const QList<ST_ICONACT> &list);
|
bool saveIconAction(const QString &path, const QList<ST_ICONACT> &list);
|
||||||
|
|
||||||
void readIconDefaultStrategy(const QString &path, QMap<QString, QString> &map);
|
void readIconDefaultStrategy(const QString &path, QMap<QString, QString> &map);
|
||||||
bool saveIconDefaultStrategy(const QString &path, const QMap<QString, QString> &map);
|
bool saveIconDefaultStrategy(const QString &path, const QMap<QString, QString> &map);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void makeIconDefaultStrategy(QDomElement element, QMap<QString, QString> &map);
|
void makeIconDefaultStrategy(QDomElement element, QMap<QString, QString> &map);
|
||||||
void replaceIconDefaultStretegy(QDomElement &element, const QMap<QString, QString> &map);
|
void replaceIconDefaultStretegy(QDomElement &element, const QMap<QString, QString> &map);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, QString> m_iconDefaultStrategyMap;
|
QMap<QString, QString> m_iconDefaultStrategyMap;
|
||||||
QMap<QVariant, QString> m_strategyMap;
|
QMap<QVariant, QString> m_strategyMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CFILEOPT_H
|
#endif // CFILEOPT_H
|
||||||
|
|||||||
@ -1,189 +1,189 @@
|
|||||||
#include "CIconActDialog.h"
|
#include "CIconActDialog.h"
|
||||||
#include "ui_CIconActDialog.h"
|
#include "ui_CIconActDialog.h"
|
||||||
#include "public/pub_utility_api/FileUtil.h"
|
#include "public/pub_utility_api/FileUtil.h"
|
||||||
#include "CTableModel.h"
|
#include "CTableModel.h"
|
||||||
#include "CTableDelegate.h"
|
#include "CTableDelegate.h"
|
||||||
#include "CFileOpt.h"
|
#include "CFileOpt.h"
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
CIconActDialog::CIconActDialog(QWidget *parent) :
|
CIconActDialog::CIconActDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::CIconActDialog),
|
ui(new Ui::CIconActDialog),
|
||||||
m_pTableModel(Q_NULLPTR),
|
m_pTableModel(Q_NULLPTR),
|
||||||
m_pFileOpt(Q_NULLPTR)
|
m_pFileOpt(Q_NULLPTR)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
CIconActDialog::~CIconActDialog()
|
CIconActDialog::~CIconActDialog()
|
||||||
{
|
{
|
||||||
if(m_pFileOpt)
|
if(m_pFileOpt)
|
||||||
{
|
{
|
||||||
delete m_pFileOpt;
|
delete m_pFileOpt;
|
||||||
}
|
}
|
||||||
m_pFileOpt = Q_NULLPTR;
|
m_pFileOpt = Q_NULLPTR;
|
||||||
|
|
||||||
if(m_pTableModel)
|
if(m_pTableModel)
|
||||||
{
|
{
|
||||||
delete m_pTableModel;
|
delete m_pTableModel;
|
||||||
}
|
}
|
||||||
m_pTableModel = Q_NULLPTR;
|
m_pTableModel = Q_NULLPTR;
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QVariant, QString> CIconActDialog::getActMap()
|
QMap<QVariant, QString> CIconActDialog::getActMap()
|
||||||
{
|
{
|
||||||
return m_actMap;
|
return m_actMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CIconActDialog::getActDesc(const QVariant &Act)
|
QString CIconActDialog::getActDesc(const QVariant &Act)
|
||||||
{
|
{
|
||||||
return m_actMap.value(Act, QString());
|
return m_actMap.value(Act, QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QVariant, QString> CIconActDialog::getSimMap()
|
QMap<QVariant, QString> CIconActDialog::getSimMap()
|
||||||
{
|
{
|
||||||
return m_simMap;
|
return m_simMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CIconActDialog::getSimDesc(const QVariant &Sim)
|
QString CIconActDialog::getSimDesc(const QVariant &Sim)
|
||||||
{
|
{
|
||||||
return m_simMap.value(Sim, QString());
|
return m_simMap.value(Sim, QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QVariant, QString> CIconActDialog::getStrategyMap()
|
QMap<QVariant, QString> CIconActDialog::getStrategyMap()
|
||||||
{
|
{
|
||||||
if(m_pFileOpt)
|
if(m_pFileOpt)
|
||||||
{
|
{
|
||||||
return m_pFileOpt->getStrategyMap();
|
return m_pFileOpt->getStrategyMap();
|
||||||
}
|
}
|
||||||
return QMap<QVariant, QString>();
|
return QMap<QVariant, QString>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIconActDialog::onAddBtnClicked()
|
void CIconActDialog::onAddBtnClicked()
|
||||||
{
|
{
|
||||||
CTableDelegate * delegate = dynamic_cast<CTableDelegate *>(ui->m_tableView->itemDelegateForColumn(0));
|
CTableDelegate * delegate = dynamic_cast<CTableDelegate *>(ui->m_tableView->itemDelegateForColumn(0));
|
||||||
if(!delegate)
|
if(!delegate)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir dir(delegate->getFilePath());
|
QDir dir(delegate->getFilePath());
|
||||||
QStringList fileList = QFileDialog::getOpenFileNames(this, tr("选择文件"), dir.path(), "*.ilx");
|
QStringList fileList = QFileDialog::getOpenFileNames(this, tr("选择文件"), dir.path(), "*.ilx");
|
||||||
if(fileList.isEmpty())
|
if(fileList.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList existFile;
|
QStringList existFile;
|
||||||
m_pTableModel->getExistIcon(existFile);
|
m_pTableModel->getExistIcon(existFile);
|
||||||
QString name;
|
QString name;
|
||||||
QList<ST_ICONACT> appendList;
|
QList<ST_ICONACT> appendList;
|
||||||
for(int nIndex(0); nIndex<fileList.length(); nIndex++)
|
for(int nIndex(0); nIndex<fileList.length(); nIndex++)
|
||||||
{
|
{
|
||||||
name = dir.relativeFilePath(fileList[nIndex]).remove(-4, 4);
|
name = dir.relativeFilePath(fileList[nIndex]).remove(-4, 4);
|
||||||
if(existFile.contains(name))
|
if(existFile.contains(name))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ST_ICONACT st_icon;
|
ST_ICONACT st_icon;
|
||||||
st_icon.name = name;
|
st_icon.name = name;
|
||||||
st_icon.strategy = m_pFileOpt->getDefaultStrategy(name);
|
st_icon.strategy = m_pFileOpt->getDefaultStrategy(name);
|
||||||
appendList.append(st_icon);
|
appendList.append(st_icon);
|
||||||
}
|
}
|
||||||
m_pTableModel->addRows(appendList);
|
m_pTableModel->addRows(appendList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIconActDialog::onDelBtnClicked()
|
void CIconActDialog::onDelBtnClicked()
|
||||||
{
|
{
|
||||||
QModelIndexList indexList = ui->m_tableView->selectionModel()->selectedRows();
|
QModelIndexList indexList = ui->m_tableView->selectionModel()->selectedRows();
|
||||||
m_pTableModel->removeRows(indexList);
|
m_pTableModel->removeRows(indexList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIconActDialog::onConfimClicked()
|
void CIconActDialog::onConfimClicked()
|
||||||
{
|
{
|
||||||
const QList<ST_ICONACT>& dataList = m_pTableModel->getDataList();
|
const QList<ST_ICONACT>& dataList = m_pTableModel->getDataList();
|
||||||
bool ret = m_pFileOpt->saveIconAction(m_strActionFile, dataList);
|
bool ret = m_pFileOpt->saveIconAction(m_strActionFile, dataList);
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
{
|
||||||
QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok);
|
QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QString> map;
|
QMap<QString, QString> map;
|
||||||
foreach (ST_ICONACT st_icon, dataList) {
|
foreach (ST_ICONACT st_icon, dataList) {
|
||||||
map[st_icon.name] = st_icon.strategy.section(":",0,0);
|
map[st_icon.name] = st_icon.strategy.section(":",0,0);
|
||||||
}
|
}
|
||||||
m_pFileOpt->saveIconDefaultStrategy(m_strToolBoxFile, map);
|
m_pFileOpt->saveIconDefaultStrategy(m_strToolBoxFile, map);
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
{
|
||||||
QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok);
|
QMessageBox::information(this, tr("提示"), tr("保存失败!"), QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIconActDialog::onCancelClicked()
|
void CIconActDialog::onCancelClicked()
|
||||||
{
|
{
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIconActDialog::contextMenuEvent(QContextMenuEvent *event)
|
void CIconActDialog::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
menu.addAction(ui->m_addBtn->toolTip(), this, &CIconActDialog::onAddBtnClicked);
|
menu.addAction(ui->m_addBtn->toolTip(), this, &CIconActDialog::onAddBtnClicked);
|
||||||
menu.addAction(ui->m_delBtn->toolTip(), this, &CIconActDialog::onDelBtnClicked);
|
menu.addAction(ui->m_delBtn->toolTip(), this, &CIconActDialog::onDelBtnClicked);
|
||||||
menu.exec(event->globalPos());
|
menu.exec(event->globalPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIconActDialog::initialize()
|
void CIconActDialog::initialize()
|
||||||
{
|
{
|
||||||
m_pFileOpt = new CFileOpt();
|
m_pFileOpt = new CFileOpt();
|
||||||
m_pTableModel = new CTableModel(this);
|
m_pTableModel = new CTableModel(this);
|
||||||
ui->m_tableView->setModel(m_pTableModel);
|
ui->m_tableView->setModel(m_pTableModel);
|
||||||
ui->m_tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
ui->m_tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
ui->m_tableView->horizontalHeader()->setStretchLastSection(true);
|
ui->m_tableView->horizontalHeader()->setStretchLastSection(true);
|
||||||
ui->m_tableView->setColumnWidth(CTableModel::NAME,180);
|
ui->m_tableView->setColumnWidth(CTableModel::NAME,180);
|
||||||
ui->m_tableView->setColumnWidth(CTableModel::ACTION,100);
|
ui->m_tableView->setColumnWidth(CTableModel::ACTION,100);
|
||||||
ui->m_tableView->setColumnWidth(CTableModel::PANEL,200);
|
ui->m_tableView->setColumnWidth(CTableModel::PANEL,200);
|
||||||
ui->m_tableView->setColumnWidth(CTableModel::STRATEGY,150);
|
ui->m_tableView->setColumnWidth(CTableModel::STRATEGY,150);
|
||||||
|
|
||||||
m_actMap.insert(ACT_LEFT_CLICK, tr("左键单击"));
|
m_actMap.insert(ACT_LEFT_CLICK, tr("左键单击"));
|
||||||
m_actMap.insert(ACT_LEFT_DOUCLICK, tr("左键双击"));
|
m_actMap.insert(ACT_LEFT_DOUCLICK, tr("左键双击"));
|
||||||
m_simMap.insert(SIM_FORBID, tr("禁止"));
|
m_simMap.insert(SIM_FORBID, tr("禁止"));
|
||||||
m_simMap.insert(SIM_ALLOW, tr("允许"));
|
m_simMap.insert(SIM_ALLOW, tr("允许"));
|
||||||
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
||||||
CTableDelegate * iconDelegate = new CTableDelegate(this, CTableDelegate::IconFile);
|
CTableDelegate * iconDelegate = new CTableDelegate(this, CTableDelegate::IconFile);
|
||||||
iconDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/icon/");
|
iconDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/icon/");
|
||||||
CTableDelegate * actnDelegate = new CTableDelegate(this, CTableDelegate::ComboBox);
|
CTableDelegate * actnDelegate = new CTableDelegate(this, CTableDelegate::ComboBox);
|
||||||
actnDelegate->setComboMap(getActMap());
|
actnDelegate->setComboMap(getActMap());
|
||||||
CTableDelegate * paneDelegate = new CTableDelegate(this, CTableDelegate::PicFile);
|
CTableDelegate * paneDelegate = new CTableDelegate(this, CTableDelegate::PicFile);
|
||||||
paneDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/pic/");
|
paneDelegate->setFilePath(QString::fromStdString(currentPath) + "/../../data/pic/");
|
||||||
CTableDelegate * straDelegate = new CTableDelegate(this, CTableDelegate::ComboBox, true);
|
CTableDelegate * straDelegate = new CTableDelegate(this, CTableDelegate::ComboBox, true);
|
||||||
straDelegate->setComboMap(getStrategyMap());
|
straDelegate->setComboMap(getStrategyMap());
|
||||||
CTableDelegate * simuDelegate = new CTableDelegate(this, CTableDelegate::ComboBox);
|
CTableDelegate * simuDelegate = new CTableDelegate(this, CTableDelegate::ComboBox);
|
||||||
simuDelegate->setComboMap(getSimMap());
|
simuDelegate->setComboMap(getSimMap());
|
||||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::NAME, iconDelegate);
|
ui->m_tableView->setItemDelegateForColumn(CTableModel::NAME, iconDelegate);
|
||||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::ACTION, actnDelegate);
|
ui->m_tableView->setItemDelegateForColumn(CTableModel::ACTION, actnDelegate);
|
||||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::PANEL, paneDelegate);
|
ui->m_tableView->setItemDelegateForColumn(CTableModel::PANEL, paneDelegate);
|
||||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::STRATEGY, straDelegate);
|
ui->m_tableView->setItemDelegateForColumn(CTableModel::STRATEGY, straDelegate);
|
||||||
ui->m_tableView->setItemDelegateForColumn(CTableModel::SIMULATE, simuDelegate);
|
ui->m_tableView->setItemDelegateForColumn(CTableModel::SIMULATE, simuDelegate);
|
||||||
|
|
||||||
QList<ST_ICONACT> stList;
|
QList<ST_ICONACT> stList;
|
||||||
m_strActionFile = QString::fromStdString(currentPath) + "../../data/model/iconAction.json";
|
m_strActionFile = QString::fromStdString(currentPath) + "../../data/model/iconAction.json";
|
||||||
m_strToolBoxFile = QString::fromStdString(currentPath) + "../../data/model/toolbox.xml";
|
m_strToolBoxFile = QString::fromStdString(currentPath) + "../../data/model/toolbox.xml";
|
||||||
m_pFileOpt->readIconAction(m_strActionFile, stList);
|
m_pFileOpt->readIconAction(m_strActionFile, stList);
|
||||||
m_pTableModel->updateData(stList);
|
m_pTableModel->updateData(stList);
|
||||||
|
|
||||||
connect(ui->m_addBtn, &QPushButton::clicked, this, &CIconActDialog::onAddBtnClicked);
|
connect(ui->m_addBtn, &QPushButton::clicked, this, &CIconActDialog::onAddBtnClicked);
|
||||||
connect(ui->m_delBtn, &QPushButton::clicked, this, &CIconActDialog::onDelBtnClicked);
|
connect(ui->m_delBtn, &QPushButton::clicked, this, &CIconActDialog::onDelBtnClicked);
|
||||||
connect(ui->m_confirmBtn, &QPushButton::clicked, this, &CIconActDialog::onConfimClicked);
|
connect(ui->m_confirmBtn, &QPushButton::clicked, this, &CIconActDialog::onConfimClicked);
|
||||||
connect(ui->m_cancelBtn,&QPushButton::clicked, this, &CIconActDialog::onCancelClicked);
|
connect(ui->m_cancelBtn,&QPushButton::clicked, this, &CIconActDialog::onCancelClicked);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,49 +1,49 @@
|
|||||||
#ifndef CICONACTDIALOG_H
|
#ifndef CICONACTDIALOG_H
|
||||||
#define CICONACTDIALOG_H
|
#define CICONACTDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CIconActDialog;
|
class CIconActDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CTableModel;
|
class CTableModel;
|
||||||
class CFileOpt;
|
class CFileOpt;
|
||||||
class CIconActDialog : public QDialog
|
class CIconActDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CIconActDialog(QWidget *parent = 0);
|
explicit CIconActDialog(QWidget *parent = 0);
|
||||||
~CIconActDialog();
|
~CIconActDialog();
|
||||||
|
|
||||||
QMap<QVariant, QString> getActMap();
|
QMap<QVariant, QString> getActMap();
|
||||||
QString getActDesc(const QVariant& Act);
|
QString getActDesc(const QVariant& Act);
|
||||||
QMap<QVariant, QString> getSimMap();
|
QMap<QVariant, QString> getSimMap();
|
||||||
QString getSimDesc(const QVariant& Sim);
|
QString getSimDesc(const QVariant& Sim);
|
||||||
QMap<QVariant, QString> getStrategyMap();
|
QMap<QVariant, QString> getStrategyMap();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onAddBtnClicked();
|
void onAddBtnClicked();
|
||||||
void onDelBtnClicked();
|
void onDelBtnClicked();
|
||||||
void onConfimClicked();
|
void onConfimClicked();
|
||||||
void onCancelClicked();
|
void onCancelClicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QContextMenuEvent *event);
|
void contextMenuEvent(QContextMenuEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CIconActDialog *ui;
|
Ui::CIconActDialog *ui;
|
||||||
CTableModel * m_pTableModel;
|
CTableModel * m_pTableModel;
|
||||||
CFileOpt * m_pFileOpt;
|
CFileOpt * m_pFileOpt;
|
||||||
QMap<QVariant, QString> m_actMap;
|
QMap<QVariant, QString> m_actMap;
|
||||||
QMap<QVariant, QString> m_simMap;
|
QMap<QVariant, QString> m_simMap;
|
||||||
QString m_strActionFile;
|
QString m_strActionFile;
|
||||||
QString m_strToolBoxFile;
|
QString m_strToolBoxFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CICONACTDIALOG_H
|
#endif // CICONACTDIALOG_H
|
||||||
|
|||||||
@ -1,166 +1,166 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CIconActDialog</class>
|
<class>CIconActDialog</class>
|
||||||
<widget class="QDialog" name="CIconActDialog">
|
<widget class="QDialog" name="CIconActDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>781</width>
|
<width>781</width>
|
||||||
<height>491</height>
|
<height>491</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>图元动作</string>
|
<string>图元动作</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" colspan="3">
|
<item row="0" column="0" colspan="3">
|
||||||
<widget class="QFrame" name="frame">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QTableView" name="m_tableView"/>
|
<widget class="QTableView" name="m_tableView"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_addBtn">
|
<widget class="QPushButton" name="m_addBtn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>25</width>
|
<width>25</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>25</width>
|
<width>25</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>添加</string>
|
<string>添加</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>+</string>
|
<string>+</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_delBtn">
|
<widget class="QPushButton" name="m_delBtn">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>25</width>
|
<width>25</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>25</width>
|
<width>25</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>删除</string>
|
<string>删除</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>-</string>
|
<string>-</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>236</width>
|
<width>236</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_confirmBtn">
|
<widget class="QPushButton" name="m_confirmBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>确认</string>
|
<string>确认</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_cancelBtn">
|
<widget class="QPushButton" name="m_cancelBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>取消</string>
|
<string>取消</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>235</width>
|
<width>235</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -1,34 +1,34 @@
|
|||||||
#ifndef CICONACTPUBLIC_H
|
#ifndef CICONACTPUBLIC_H
|
||||||
#define CICONACTPUBLIC_H
|
#define CICONACTPUBLIC_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
struct ST_ICONACT
|
struct ST_ICONACT
|
||||||
{
|
{
|
||||||
QString name;
|
QString name;
|
||||||
int action;
|
int action;
|
||||||
QString panel;
|
QString panel;
|
||||||
QString strategy;
|
QString strategy;
|
||||||
int simulate;
|
int simulate;
|
||||||
|
|
||||||
ST_ICONACT(){
|
ST_ICONACT(){
|
||||||
action = 0;
|
action = 0;
|
||||||
simulate = 0;
|
simulate = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//< 触发动作
|
//< 触发动作
|
||||||
enum EN_ACTION
|
enum EN_ACTION
|
||||||
{
|
{
|
||||||
ACT_LEFT_CLICK = 0,
|
ACT_LEFT_CLICK = 0,
|
||||||
ACT_LEFT_DOUCLICK
|
ACT_LEFT_DOUCLICK
|
||||||
};
|
};
|
||||||
|
|
||||||
//< 模拟操作
|
//< 模拟操作
|
||||||
enum EN_SIMULATE
|
enum EN_SIMULATE
|
||||||
{
|
{
|
||||||
SIM_FORBID = 0,
|
SIM_FORBID = 0,
|
||||||
SIM_ALLOW
|
SIM_ALLOW
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CICONACTPUBLIC_H
|
#endif // CICONACTPUBLIC_H
|
||||||
|
|||||||
@ -1,97 +1,97 @@
|
|||||||
#include "CLineEditWithBt.h"
|
#include "CLineEditWithBt.h"
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
CLineEditWithBt::CLineEditWithBt(QWidget *parent, const QString &filePath, Option option)
|
CLineEditWithBt::CLineEditWithBt(QWidget *parent, const QString &filePath, Option option)
|
||||||
:QWidget(parent),m_filePath(filePath),m_option(option)
|
:QWidget(parent),m_filePath(filePath),m_option(option)
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||||
m_edit = new QLineEdit(this);
|
m_edit = new QLineEdit(this);
|
||||||
m_edit->installEventFilter(this);
|
m_edit->installEventFilter(this);
|
||||||
m_button = new QToolButton(this);
|
m_button = new QToolButton(this);
|
||||||
m_button->setText("...");
|
m_button->setText("...");
|
||||||
m_button->setFixedSize(21,20);
|
m_button->setFixedSize(21,20);
|
||||||
layout->addWidget(m_edit);
|
layout->addWidget(m_edit);
|
||||||
layout->addWidget(m_button);
|
layout->addWidget(m_button);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
this->setLayout(layout);
|
this->setLayout(layout);
|
||||||
|
|
||||||
connect(m_button, SIGNAL(clicked()), this, SLOT(getFilePath()));
|
connect(m_button, SIGNAL(clicked()), this, SLOT(getFilePath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CLineEditWithBt::~CLineEditWithBt()
|
CLineEditWithBt::~CLineEditWithBt()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CLineEditWithBt::text()
|
QString CLineEditWithBt::text()
|
||||||
{
|
{
|
||||||
return m_edit->text();
|
return m_edit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLineEditWithBt::setText(const QString &text)
|
void CLineEditWithBt::setText(const QString &text)
|
||||||
{
|
{
|
||||||
m_edit->setText(text);
|
m_edit->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLineEditWithBt::getFilePath()
|
void CLineEditWithBt::getFilePath()
|
||||||
{
|
{
|
||||||
QFileDialog *dialog = new QFileDialog(this, tr("选择文件"), m_filePath+text());
|
QFileDialog *dialog = new QFileDialog(this, tr("选择文件"), m_filePath+text());
|
||||||
dialog->setOption(QFileDialog::DontUseNativeDialog);
|
dialog->setOption(QFileDialog::DontUseNativeDialog);
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dialog, SIGNAL(fileSelected(QString)), this, SLOT(setFilePath(QString)));
|
connect(dialog, SIGNAL(fileSelected(QString)), this, SLOT(setFilePath(QString)));
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLineEditWithBt::setFilePath(const QString &name)
|
void CLineEditWithBt::setFilePath(const QString &name)
|
||||||
{
|
{
|
||||||
if(name != QString())
|
if(name != QString())
|
||||||
{
|
{
|
||||||
QDir dir;
|
QDir dir;
|
||||||
switch (m_option) {
|
switch (m_option) {
|
||||||
case GetFile:
|
case GetFile:
|
||||||
{
|
{
|
||||||
dir.cd(m_filePath);
|
dir.cd(m_filePath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GetPath:
|
case GetPath:
|
||||||
{
|
{
|
||||||
dir.cd(QCoreApplication::applicationDirPath());
|
dir.cd(QCoreApplication::applicationDirPath());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString text = dir.relativeFilePath(name);
|
QString text = dir.relativeFilePath(name);
|
||||||
if(text.right(4) == ".exe")
|
if(text.right(4) == ".exe")
|
||||||
{
|
{
|
||||||
text.remove(-4, 4);
|
text.remove(-4, 4);
|
||||||
}
|
}
|
||||||
setText(text);
|
setText(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLineEditWithBt::eventFilter(QObject *watched, QEvent *event)
|
bool CLineEditWithBt::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if(watched == m_edit)
|
if(watched == m_edit)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::FocusOut)
|
if (event->type() == QEvent::FocusOut)
|
||||||
{
|
{
|
||||||
this->setFocus();
|
this->setFocus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QWidget::eventFilter(watched, event);
|
return QWidget::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,37 +1,37 @@
|
|||||||
#ifndef CLINEEDITWITHBT_H
|
#ifndef CLINEEDITWITHBT_H
|
||||||
#define CLINEEDITWITHBT_H
|
#define CLINEEDITWITHBT_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
class CLineEditWithBt : public QWidget
|
class CLineEditWithBt : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum Option{
|
enum Option{
|
||||||
GetFile = 0,
|
GetFile = 0,
|
||||||
GetPath = 1
|
GetPath = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
CLineEditWithBt(QWidget *parent = 0, const QString& filePath = "", Option option = GetFile);
|
CLineEditWithBt(QWidget *parent = 0, const QString& filePath = "", Option option = GetFile);
|
||||||
~CLineEditWithBt();
|
~CLineEditWithBt();
|
||||||
|
|
||||||
void setText(const QString& text);
|
void setText(const QString& text);
|
||||||
QString text();
|
QString text();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void getFilePath();
|
void getFilePath();
|
||||||
void setFilePath(const QString& name);
|
void setFilePath(const QString& name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_filePath;
|
QString m_filePath;
|
||||||
Option m_option;
|
Option m_option;
|
||||||
QLineEdit *m_edit;
|
QLineEdit *m_edit;
|
||||||
QToolButton *m_button;
|
QToolButton *m_button;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLINEEDITWITHBT_H
|
#endif // CLINEEDITWITHBT_H
|
||||||
|
|||||||
@ -1,126 +1,126 @@
|
|||||||
#include "CTableDelegate.h"
|
#include "CTableDelegate.h"
|
||||||
#include "CLineEditWithBt.h"
|
#include "CLineEditWithBt.h"
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
CTableDelegate::CTableDelegate(QObject *parent, DelegateWidget type, bool editable)
|
CTableDelegate::CTableDelegate(QObject *parent, DelegateWidget type, bool editable)
|
||||||
: QStyledItemDelegate(parent),
|
: QStyledItemDelegate(parent),
|
||||||
m_type(type),
|
m_type(type),
|
||||||
m_editable(editable)
|
m_editable(editable)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CTableDelegate::~CTableDelegate()
|
CTableDelegate::~CTableDelegate()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableDelegate::setComboMap(const QMap<QVariant, QString> &map)
|
void CTableDelegate::setComboMap(const QMap<QVariant, QString> &map)
|
||||||
{
|
{
|
||||||
m_mapComboBox = map;
|
m_mapComboBox = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableDelegate::setFilePath(const QString &path)
|
void CTableDelegate::setFilePath(const QString &path)
|
||||||
{
|
{
|
||||||
m_strFilePath = path;
|
m_strFilePath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CTableDelegate::getFilePath()
|
QString CTableDelegate::getFilePath()
|
||||||
{
|
{
|
||||||
return m_strFilePath;
|
return m_strFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *CTableDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QWidget *CTableDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
switch(m_type){
|
switch(m_type){
|
||||||
case ReadOnly:
|
case ReadOnly:
|
||||||
return NULL;
|
return NULL;
|
||||||
case LineEdit:
|
case LineEdit:
|
||||||
return new QLineEdit(parent);
|
return new QLineEdit(parent);
|
||||||
case ComboBox:
|
case ComboBox:
|
||||||
{
|
{
|
||||||
QComboBox *box= new QComboBox(parent);
|
QComboBox *box= new QComboBox(parent);
|
||||||
box->setEditable(m_editable);
|
box->setEditable(m_editable);
|
||||||
QMap<QVariant, QString>::const_iterator iter
|
QMap<QVariant, QString>::const_iterator iter
|
||||||
= m_mapComboBox.constBegin();
|
= m_mapComboBox.constBegin();
|
||||||
for(; iter != m_mapComboBox.constEnd(); iter ++)
|
for(; iter != m_mapComboBox.constEnd(); iter ++)
|
||||||
{
|
{
|
||||||
box->addItem(iter.value(), iter.key());
|
box->addItem(iter.value(), iter.key());
|
||||||
}
|
}
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
case PicFile:
|
case PicFile:
|
||||||
case IconFile:
|
case IconFile:
|
||||||
{
|
{
|
||||||
return new CLineEditWithBt(parent, m_strFilePath);
|
return new CLineEditWithBt(parent, m_strFilePath);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
void CTableDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
switch(m_type){
|
switch(m_type){
|
||||||
case LineEdit:
|
case LineEdit:
|
||||||
{
|
{
|
||||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ComboBox:
|
case ComboBox:
|
||||||
{
|
{
|
||||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||||
comb->setCurrentIndex(comb->findText(index.data(Qt::DisplayRole).toString()));
|
comb->setCurrentIndex(comb->findText(index.data(Qt::DisplayRole).toString()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PicFile:
|
case PicFile:
|
||||||
case IconFile:
|
case IconFile:
|
||||||
{
|
{
|
||||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
QStyledItemDelegate::setEditorData(editor, index);
|
QStyledItemDelegate::setEditorData(editor, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
void CTableDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case LineEdit:
|
case LineEdit:
|
||||||
{
|
{
|
||||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ComboBox:
|
case ComboBox:
|
||||||
{
|
{
|
||||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||||
if(model->data(index, Qt::DisplayRole) != comb->currentText())
|
if(model->data(index, Qt::DisplayRole) != comb->currentText())
|
||||||
{
|
{
|
||||||
model->setData(index, comb->currentText(), Qt::DisplayRole);
|
model->setData(index, comb->currentText(), Qt::DisplayRole);
|
||||||
model->setData(index, comb->currentData(), Qt::UserRole);
|
model->setData(index, comb->currentData(), Qt::UserRole);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PicFile:
|
case PicFile:
|
||||||
case IconFile:
|
case IconFile:
|
||||||
{
|
{
|
||||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||||
model->setData(index, edit->text(), Qt::UserRole);
|
model->setData(index, edit->text(), Qt::UserRole);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
QStyledItemDelegate::setModelData(editor, model, index);
|
QStyledItemDelegate::setModelData(editor, model, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void CTableDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(index)
|
Q_UNUSED(index)
|
||||||
editor->setGeometry(option.rect);
|
editor->setGeometry(option.rect);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,55 +1,55 @@
|
|||||||
#ifndef CTREEITEMDELEGATE_H
|
#ifndef CTREEITEMDELEGATE_H
|
||||||
#define CTREEITEMDELEGATE_H
|
#define CTREEITEMDELEGATE_H
|
||||||
|
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
class CTableDelegate : public QStyledItemDelegate
|
class CTableDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum DelegateWidget{
|
enum DelegateWidget{
|
||||||
ReadOnly = 0,
|
ReadOnly = 0,
|
||||||
LineEdit = 1,
|
LineEdit = 1,
|
||||||
ComboBox = 2,
|
ComboBox = 2,
|
||||||
PicFile = 3,
|
PicFile = 3,
|
||||||
IconFile = 4
|
IconFile = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
CTableDelegate(QObject *parent = 0, DelegateWidget type = LineEdit, bool editable = false);
|
CTableDelegate(QObject *parent = 0, DelegateWidget type = LineEdit, bool editable = false);
|
||||||
~CTableDelegate();
|
~CTableDelegate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setComboMap DelegateWidget::ComboBox 有效
|
* @brief setComboMap DelegateWidget::ComboBox 有效
|
||||||
* @param map
|
* @param map
|
||||||
*/
|
*/
|
||||||
void setComboMap(const QMap<QVariant, QString> &map);
|
void setComboMap(const QMap<QVariant, QString> &map);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setFilePath DelegateWidget::PicFile/IconFile 有效
|
* @brief setFilePath DelegateWidget::PicFile/IconFile 有效
|
||||||
* @param path
|
* @param path
|
||||||
*/
|
*/
|
||||||
void setFilePath(const QString &path);
|
void setFilePath(const QString &path);
|
||||||
|
|
||||||
QString getFilePath();
|
QString getFilePath();
|
||||||
|
|
||||||
QWidget *createEditor(QWidget *parent,
|
QWidget *createEditor(QWidget *parent,
|
||||||
const QStyleOptionViewItem &option,
|
const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
void setModelData(QWidget *editor,
|
void setModelData(QWidget *editor,
|
||||||
QAbstractItemModel *model,
|
QAbstractItemModel *model,
|
||||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void updateEditorGeometry(QWidget *editor,
|
void updateEditorGeometry(QWidget *editor,
|
||||||
const QStyleOptionViewItem &option,
|
const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DelegateWidget m_type;
|
DelegateWidget m_type;
|
||||||
bool m_editable;
|
bool m_editable;
|
||||||
QMap<QVariant, QString> m_mapComboBox;
|
QMap<QVariant, QString> m_mapComboBox;
|
||||||
QString m_strFilePath;
|
QString m_strFilePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CTREEITEMDELEGATE_H
|
#endif // CTREEITEMDELEGATE_H
|
||||||
|
|||||||
@ -1,182 +1,182 @@
|
|||||||
#include "CTableModel.h"
|
#include "CTableModel.h"
|
||||||
#include "CIconActDialog.h"
|
#include "CIconActDialog.h"
|
||||||
|
|
||||||
CTableModel::CTableModel(QObject *parent)
|
CTableModel::CTableModel(QObject *parent)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
{
|
{
|
||||||
m_parent = dynamic_cast<CIconActDialog *>(parent);
|
m_parent = dynamic_cast<CIconActDialog *>(parent);
|
||||||
m_headerList << tr("图元名称") << tr("触发动作") << tr("控制面板") << tr("默认着色策略") << tr("模拟操作");
|
m_headerList << tr("图元名称") << tr("触发动作") << tr("控制面板") << tr("默认着色策略") << tr("模拟操作");
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<ST_ICONACT> &CTableModel::getDataList()
|
const QList<ST_ICONACT> &CTableModel::getDataList()
|
||||||
{
|
{
|
||||||
return m_dataList;
|
return m_dataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableModel::updateData(QList<ST_ICONACT> &dataList)
|
void CTableModel::updateData(QList<ST_ICONACT> &dataList)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_dataList.swap(dataList);
|
m_dataList.swap(dataList);
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableModel::addRows(const QList<ST_ICONACT> &dataList)
|
void CTableModel::addRows(const QList<ST_ICONACT> &dataList)
|
||||||
{
|
{
|
||||||
if(dataList.isEmpty())
|
if(dataList.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
beginInsertRows(QModelIndex(), rowCount(), rowCount() + dataList.length()-1);
|
beginInsertRows(QModelIndex(), rowCount(), rowCount() + dataList.length()-1);
|
||||||
m_dataList.append(dataList);
|
m_dataList.append(dataList);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableModel::removeRows(const QModelIndexList &rowIndexList)
|
void CTableModel::removeRows(const QModelIndexList &rowIndexList)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
for(int nIndex(rowIndexList.length()-1); nIndex>=0; nIndex--){
|
for(int nIndex(rowIndexList.length()-1); nIndex>=0; nIndex--){
|
||||||
m_dataList.removeAt(rowIndexList[nIndex].row());
|
m_dataList.removeAt(rowIndexList[nIndex].row());
|
||||||
}
|
}
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableModel::getExistIcon(QStringList &nameList)
|
void CTableModel::getExistIcon(QStringList &nameList)
|
||||||
{
|
{
|
||||||
foreach (ST_ICONACT st_icon, m_dataList) {
|
foreach (ST_ICONACT st_icon, m_dataList) {
|
||||||
nameList.append(st_icon.name);
|
nameList.append(st_icon.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant CTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
if(Qt::DisplayRole == role)
|
if(Qt::DisplayRole == role)
|
||||||
{
|
{
|
||||||
if(Qt::Horizontal == orientation)
|
if(Qt::Horizontal == orientation)
|
||||||
{
|
{
|
||||||
return m_headerList.at(section);
|
return m_headerList.at(section);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTableModel::rowCount(const QModelIndex &parent) const
|
int CTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if(parent.isValid())
|
if(parent.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return m_dataList.length();
|
return m_dataList.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTableModel::columnCount(const QModelIndex &parent) const
|
int CTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if(parent.isValid())
|
if(parent.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return m_headerList.length();
|
return m_headerList.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CTableModel::data(const QModelIndex &index, int role) const
|
QVariant CTableModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if(!index.isValid())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if(Qt::TextAlignmentRole == role)
|
if(Qt::TextAlignmentRole == role)
|
||||||
{
|
{
|
||||||
return Qt::AlignCenter;
|
return Qt::AlignCenter;
|
||||||
}
|
}
|
||||||
\
|
\
|
||||||
if(Qt::DisplayRole != role)
|
if(Qt::DisplayRole != role)
|
||||||
{
|
{
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(index.column()){
|
switch(index.column()){
|
||||||
case NAME:
|
case NAME:
|
||||||
{
|
{
|
||||||
return m_dataList.at(index.row()).name;
|
return m_dataList.at(index.row()).name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION:
|
case ACTION:
|
||||||
{
|
{
|
||||||
return m_parent->getActDesc( m_dataList.at(index.row()).action );
|
return m_parent->getActDesc( m_dataList.at(index.row()).action );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PANEL:
|
case PANEL:
|
||||||
{
|
{
|
||||||
return m_dataList.at(index.row()).panel;
|
return m_dataList.at(index.row()).panel;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STRATEGY:
|
case STRATEGY:
|
||||||
{
|
{
|
||||||
return m_dataList.at(index.row()).strategy;
|
return m_dataList.at(index.row()).strategy;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIMULATE:
|
case SIMULATE:
|
||||||
{
|
{
|
||||||
return m_parent->getSimDesc( m_dataList.at(index.row()).simulate );
|
return m_parent->getSimDesc( m_dataList.at(index.row()).simulate );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
bool CTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if(!index.isValid())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(Qt::DisplayRole == role)
|
if(Qt::DisplayRole == role)
|
||||||
{
|
{
|
||||||
switch(index.column()){
|
switch(index.column()){
|
||||||
case NAME:
|
case NAME:
|
||||||
{
|
{
|
||||||
m_dataList[index.row()].name = value.toString();
|
m_dataList[index.row()].name = value.toString();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PANEL:
|
case PANEL:
|
||||||
{
|
{
|
||||||
m_dataList[index.row()].panel = value.toString();
|
m_dataList[index.row()].panel = value.toString();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STRATEGY:
|
case STRATEGY:
|
||||||
{
|
{
|
||||||
m_dataList[index.row()].strategy = value.toString();
|
m_dataList[index.row()].strategy = value.toString();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Qt::UserRole == role)
|
if(Qt::UserRole == role)
|
||||||
{
|
{
|
||||||
switch(index.column()){
|
switch(index.column()){
|
||||||
case ACTION:
|
case ACTION:
|
||||||
{
|
{
|
||||||
m_dataList[index.row()].action = value.toInt();
|
m_dataList[index.row()].action = value.toInt();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIMULATE:
|
case SIMULATE:
|
||||||
{
|
{
|
||||||
m_dataList[index.row()].simulate = value.toInt();
|
m_dataList[index.row()].simulate = value.toInt();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags CTableModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags CTableModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
{
|
{
|
||||||
return Qt::NoItemFlags;
|
return Qt::NoItemFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
|
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,50 +1,50 @@
|
|||||||
#ifndef CTABLEMODEL_H
|
#ifndef CTABLEMODEL_H
|
||||||
#define CTABLEMODEL_H
|
#define CTABLEMODEL_H
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include "CIconActPublic.h"
|
#include "CIconActPublic.h"
|
||||||
|
|
||||||
class CIconActDialog;
|
class CIconActDialog;
|
||||||
class CTableModel : public QAbstractTableModel
|
class CTableModel : public QAbstractTableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum ColumnField
|
enum ColumnField
|
||||||
{
|
{
|
||||||
NAME = 0,
|
NAME = 0,
|
||||||
ACTION,
|
ACTION,
|
||||||
PANEL,
|
PANEL,
|
||||||
STRATEGY,
|
STRATEGY,
|
||||||
SIMULATE
|
SIMULATE
|
||||||
};
|
};
|
||||||
|
|
||||||
CTableModel(QObject *parent = Q_NULLPTR);
|
CTableModel(QObject *parent = Q_NULLPTR);
|
||||||
|
|
||||||
const QList<ST_ICONACT>& getDataList();
|
const QList<ST_ICONACT>& getDataList();
|
||||||
|
|
||||||
void updateData(QList<ST_ICONACT> &dataList);
|
void updateData(QList<ST_ICONACT> &dataList);
|
||||||
|
|
||||||
void addRows(const QList<ST_ICONACT> &dataList);
|
void addRows(const QList<ST_ICONACT> &dataList);
|
||||||
|
|
||||||
void removeRows(const QModelIndexList &rowIndexList);
|
void removeRows(const QModelIndexList &rowIndexList);
|
||||||
|
|
||||||
void getExistIcon(QStringList &nameList);
|
void getExistIcon(QStringList &nameList);
|
||||||
|
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(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;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||||
|
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList m_headerList;
|
QStringList m_headerList;
|
||||||
QList<ST_ICONACT> m_dataList;
|
QList<ST_ICONACT> m_dataList;
|
||||||
CIconActDialog * m_parent;
|
CIconActDialog * m_parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CTABLEMODEL_H
|
#endif // CTABLEMODEL_H
|
||||||
|
|||||||
@ -1,56 +1,56 @@
|
|||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#
|
#
|
||||||
# Project created by QtCreator 2021-08-27T08:57:32
|
# Project created by QtCreator 2021-08-27T08:57:32
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui xml
|
QT += core gui xml
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = IconActTool
|
TARGET = IconActTool
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
# depend on your compiler). Please consult the documentation of the
|
# depend on your compiler). Please consult the documentation of the
|
||||||
# deprecated API in order to know how to port your code away from it.
|
# deprecated API in order to know how to port your code away from it.
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
# You can also make your code fail to compile if you use deprecated APIs.
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
# In order to do so, uncomment the following line.
|
# 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.
|
# 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
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
CIconActDialog.cpp \
|
CIconActDialog.cpp \
|
||||||
CTableModel.cpp \
|
CTableModel.cpp \
|
||||||
CLineEditWithBt.cpp \
|
CLineEditWithBt.cpp \
|
||||||
CTableDelegate.cpp \
|
CTableDelegate.cpp \
|
||||||
CFileOpt.cpp
|
CFileOpt.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
CIconActDialog.h \
|
CIconActDialog.h \
|
||||||
CTableModel.h \
|
CTableModel.h \
|
||||||
CIconActPublic.h \
|
CIconActPublic.h \
|
||||||
CLineEditWithBt.h \
|
CLineEditWithBt.h \
|
||||||
CTableDelegate.h \
|
CTableDelegate.h \
|
||||||
CFileOpt.h
|
CFileOpt.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
CIconActDialog.ui
|
CIconActDialog.ui
|
||||||
|
|
||||||
LIBS += \
|
LIBS += \
|
||||||
-lpub_utility_api \
|
-lpub_utility_api \
|
||||||
-llog4cplus \
|
-llog4cplus \
|
||||||
-lpub_logger_api
|
-lpub_logger_api
|
||||||
|
|
||||||
COMMON_PRI=$$PWD/../../../common.pri
|
COMMON_PRI=$$PWD/../../../common.pri
|
||||||
exists($$COMMON_PRI) {
|
exists($$COMMON_PRI) {
|
||||||
include($$COMMON_PRI)
|
include($$COMMON_PRI)
|
||||||
}else {
|
}else {
|
||||||
error("FATAL error: can not find common.pri")
|
error("FATAL error: can not find common.pri")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include "common/QtAppGlobalSet.h"
|
#include "common/QtAppGlobalSet.h"
|
||||||
#include "CIconActDialog.h"
|
#include "CIconActDialog.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
kbd_common::doQtAppGlobalSet();
|
kbd_common::doQtAppGlobalSet();
|
||||||
|
|
||||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||||
QTextCodec::setCodecForLocale(codec);
|
QTextCodec::setCodecForLocale(codec);
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
CIconActDialog w;
|
CIconActDialog w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,307 +1,307 @@
|
|||||||
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
||||||
#include "public/pub_utility_api/FileUtil.h"
|
#include "public/pub_utility_api/FileUtil.h"
|
||||||
#include "public/pub_logger_api/logger.h"
|
#include "public/pub_logger_api/logger.h"
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
CJsonOpt::CJsonOpt()
|
CJsonOpt::CJsonOpt()
|
||||||
{
|
{
|
||||||
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
std::string currentPath = kbd_public::CFileUtil::getCurModuleDir();
|
||||||
QDir dir(QString::fromStdString(currentPath));
|
QDir dir(QString::fromStdString(currentPath));
|
||||||
dir.cdUp();
|
dir.cdUp();
|
||||||
dir.cdUp();
|
dir.cdUp();
|
||||||
dir.cd("data");
|
dir.cd("data");
|
||||||
dir.cd("model");
|
dir.cd("model");
|
||||||
|
|
||||||
m_strButtonFile = dir.filePath("ButtonGroupWidget.json");
|
m_strButtonFile = dir.filePath("ButtonGroupWidget.json");
|
||||||
m_strNavFile = dir.filePath("NavigationWidget.json");
|
m_strNavFile = dir.filePath("NavigationWidget.json");
|
||||||
readBtnJson(m_strButtonFile);
|
readBtnJson(m_strButtonFile);
|
||||||
readNavJson(m_strNavFile);
|
readNavJson(m_strNavFile);
|
||||||
onFirst();
|
onFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString &CJsonOpt::getSeparatorPath()
|
QString &CJsonOpt::getSeparatorPath()
|
||||||
{
|
{
|
||||||
return m_strSeparator;
|
return m_strSeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, ST_NODE> &CJsonOpt::getButtonMap()
|
QMap<QString, ST_NODE> &CJsonOpt::getButtonMap()
|
||||||
{
|
{
|
||||||
return m_mapButton;
|
return m_mapButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
ST_NODE CJsonOpt::getStButton(const QString &key)
|
ST_NODE CJsonOpt::getStButton(const QString &key)
|
||||||
{
|
{
|
||||||
return m_mapButton.value(key);
|
return m_mapButton.value(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<int, QList<QPair<int, ST_NODE> > > &CJsonOpt::getNavMap()
|
QMap<int, QList<QPair<int, ST_NODE> > > &CJsonOpt::getNavMap()
|
||||||
{
|
{
|
||||||
return m_mapNav;
|
return m_mapNav;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CJsonOpt::saveJson(const QMap<QString, ST_NODE> &btMap,
|
bool CJsonOpt::saveJson(const QMap<QString, ST_NODE> &btMap,
|
||||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap)
|
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
success = saveButtonJson(btMap);
|
success = saveButtonJson(btMap);
|
||||||
if(!success)
|
if(!success)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
success = saveNavJson(navMap);
|
success = saveNavJson(navMap);
|
||||||
if(!success)
|
if(!success)
|
||||||
{
|
{
|
||||||
saveButtonJson(m_mapButton);
|
saveButtonJson(m_mapButton);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CJsonOpt::saveButtonJson(const QMap<QString, ST_NODE> &map)
|
bool CJsonOpt::saveButtonJson(const QMap<QString, ST_NODE> &map)
|
||||||
{
|
{
|
||||||
QFile file(m_strButtonFile);
|
QFile file(m_strButtonFile);
|
||||||
if(!file.exists())
|
if(!file.exists())
|
||||||
{
|
{
|
||||||
file.setFileName(m_strButtonFile);
|
file.setFileName(m_strButtonFile);
|
||||||
}
|
}
|
||||||
if(!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
if(!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file.resize(0);
|
file.resize(0);
|
||||||
|
|
||||||
QJsonObject root;
|
QJsonObject root;
|
||||||
root.insert("separator", m_strSeparator);
|
root.insert("separator", m_strSeparator);
|
||||||
QMap<QString, ST_NODE>::const_iterator iter = map.constBegin();
|
QMap<QString, ST_NODE>::const_iterator iter = map.constBegin();
|
||||||
for(; iter != map.constEnd(); iter++)
|
for(; iter != map.constEnd(); iter++)
|
||||||
{
|
{
|
||||||
QJsonObject button;
|
QJsonObject button;
|
||||||
button.insert("name", iter.value().name);
|
button.insert("name", iter.value().name);
|
||||||
button.insert("used", iter.value().used);
|
button.insert("used", iter.value().used);
|
||||||
button.insert("opt", iter.value().type);
|
button.insert("opt", iter.value().type);
|
||||||
button.insert("icon", iter.value().icon);
|
button.insert("icon", iter.value().icon);
|
||||||
button.insert("web" , iter.value().web);
|
button.insert("web" , iter.value().web);
|
||||||
button.insert("data", iter.value().data);
|
button.insert("data", iter.value().data);
|
||||||
button.insert("webData", iter.value().webData);
|
button.insert("webData", iter.value().webData);
|
||||||
root.insert(iter.key(), button);
|
root.insert(iter.key(), button);
|
||||||
}
|
}
|
||||||
QJsonDocument doc;
|
QJsonDocument doc;
|
||||||
doc.setObject(root);
|
doc.setObject(root);
|
||||||
if(-1 == file.write(doc.toJson()))
|
if(-1 == file.write(doc.toJson()))
|
||||||
{
|
{
|
||||||
file.close();
|
file.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CJsonOpt::saveNavJson(const QMap<int, QList<QPair<int, ST_NODE> > > &map)
|
bool CJsonOpt::saveNavJson(const QMap<int, QList<QPair<int, ST_NODE> > > &map)
|
||||||
{
|
{
|
||||||
QFile file(m_strNavFile);
|
QFile file(m_strNavFile);
|
||||||
if(!file.exists())
|
if(!file.exists())
|
||||||
{
|
{
|
||||||
file.setFileName(m_strNavFile);
|
file.setFileName(m_strNavFile);
|
||||||
}
|
}
|
||||||
if(!file.open(QIODevice::ReadWrite))
|
if(!file.open(QIODevice::ReadWrite))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QByteArray readJson = file.readAll();
|
QByteArray readJson = file.readAll();
|
||||||
file.resize(0);
|
file.resize(0);
|
||||||
QJsonParseError readError;
|
QJsonParseError readError;
|
||||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||||
if(readError.error != QJsonParseError::NoError)
|
if(readError.error != QJsonParseError::NoError)
|
||||||
{
|
{
|
||||||
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QJsonObject root;
|
QJsonObject root;
|
||||||
QJsonObject configure = readJsonResponse.object().value("configure").toObject();
|
QJsonObject configure = readJsonResponse.object().value("configure").toObject();
|
||||||
root.insert("configure", configure);
|
root.insert("configure", configure);
|
||||||
root.insert("items", getSaveItems(map, -1));
|
root.insert("items", getSaveItems(map, -1));
|
||||||
QJsonDocument doc;
|
QJsonDocument doc;
|
||||||
doc.setObject(root);
|
doc.setObject(root);
|
||||||
if(-1 == file.write(doc.toJson()))
|
if(-1 == file.write(doc.toJson()))
|
||||||
{
|
{
|
||||||
file.close();
|
file.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CJsonOpt::readBtnJson(const QString &path)
|
void CJsonOpt::readBtnJson(const QString &path)
|
||||||
{
|
{
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
QByteArray readJson;
|
QByteArray readJson;
|
||||||
if(file.open(QIODevice::ReadOnly))
|
if(file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
readJson = file.readAll();
|
readJson = file.readAll();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
QJsonParseError readError;
|
QJsonParseError readError;
|
||||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||||
if(readError.error != QJsonParseError::NoError)
|
if(readError.error != QJsonParseError::NoError)
|
||||||
{
|
{
|
||||||
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QJsonObject root = readJsonResponse.object();
|
QJsonObject root = readJsonResponse.object();
|
||||||
QJsonObject::const_iterator rootIter = root.constBegin();
|
QJsonObject::const_iterator rootIter = root.constBegin();
|
||||||
for(; rootIter != root.constEnd(); rootIter++)
|
for(; rootIter != root.constEnd(); rootIter++)
|
||||||
{
|
{
|
||||||
if(rootIter.key() == "separator")
|
if(rootIter.key() == "separator")
|
||||||
{
|
{
|
||||||
m_strSeparator = rootIter.value().toString();
|
m_strSeparator = rootIter.value().toString();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QJsonObject item = rootIter.value().toObject();
|
QJsonObject item = rootIter.value().toObject();
|
||||||
ST_NODE st_Node;
|
ST_NODE st_Node;
|
||||||
makeStButton(st_Node, item);
|
makeStButton(st_Node, item);
|
||||||
m_mapButton.insert(rootIter.key(), st_Node);
|
m_mapButton.insert(rootIter.key(), st_Node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CJsonOpt::readNavJson(const QString &path)
|
void CJsonOpt::readNavJson(const QString &path)
|
||||||
{
|
{
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
QByteArray readJson;
|
QByteArray readJson;
|
||||||
if(file.open(QIODevice::ReadOnly))
|
if(file.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
readJson = file.readAll();
|
readJson = file.readAll();
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
QJsonParseError readError;
|
QJsonParseError readError;
|
||||||
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
QJsonDocument readJsonResponse = QJsonDocument::fromJson(readJson, &readError);
|
||||||
if(readError.error != QJsonParseError::NoError)
|
if(readError.error != QJsonParseError::NoError)
|
||||||
{
|
{
|
||||||
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
LOGERROR("CJsonReader error: %d, string: %s", readError.error, readError.errorString().toStdString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QJsonObject root = readJsonResponse.object();
|
QJsonObject root = readJsonResponse.object();
|
||||||
if(root.contains("items"))
|
if(root.contains("items"))
|
||||||
{
|
{
|
||||||
QJsonArray itemArray = root.value("items").toArray();
|
QJsonArray itemArray = root.value("items").toArray();
|
||||||
int nItemNumber = 0;
|
int nItemNumber = 0;
|
||||||
for(int nIndex(0); nIndex< itemArray.size(); nIndex++)
|
for(int nIndex(0); nIndex< itemArray.size(); nIndex++)
|
||||||
{
|
{
|
||||||
ST_NODE st_Node_Top;
|
ST_NODE st_Node_Top;
|
||||||
QJsonObject topLevelObject = itemArray[nIndex].toObject();
|
QJsonObject topLevelObject = itemArray[nIndex].toObject();
|
||||||
makeStButton(st_Node_Top, topLevelObject);
|
makeStButton(st_Node_Top, topLevelObject);
|
||||||
QPair<int, ST_NODE> topMap;
|
QPair<int, ST_NODE> topMap;
|
||||||
int nTopNumber = nItemNumber;
|
int nTopNumber = nItemNumber;
|
||||||
topMap.first = nItemNumber++;
|
topMap.first = nItemNumber++;
|
||||||
topMap.second = st_Node_Top;
|
topMap.second = st_Node_Top;
|
||||||
|
|
||||||
QJsonArray childArray = topLevelObject.value("items").toArray();
|
QJsonArray childArray = topLevelObject.value("items").toArray();
|
||||||
for(int nChildIndex(0); nChildIndex< childArray.size(); nChildIndex++)
|
for(int nChildIndex(0); nChildIndex< childArray.size(); nChildIndex++)
|
||||||
{
|
{
|
||||||
ST_NODE st_Node_Child;
|
ST_NODE st_Node_Child;
|
||||||
QJsonObject childLevelObject = childArray[nChildIndex].toObject();
|
QJsonObject childLevelObject = childArray[nChildIndex].toObject();
|
||||||
makeStButton(st_Node_Child, childLevelObject);
|
makeStButton(st_Node_Child, childLevelObject);
|
||||||
QPair<int, ST_NODE> childMap;
|
QPair<int, ST_NODE> childMap;
|
||||||
int nChildNumber = nItemNumber;
|
int nChildNumber = nItemNumber;
|
||||||
childMap.first = nItemNumber++;
|
childMap.first = nItemNumber++;
|
||||||
childMap.second = st_Node_Child;
|
childMap.second = st_Node_Child;
|
||||||
|
|
||||||
QJsonArray leafArray = childLevelObject.value("items").toArray();
|
QJsonArray leafArray = childLevelObject.value("items").toArray();
|
||||||
for(int nLeafIndex(0); nLeafIndex< leafArray.size(); nLeafIndex++)
|
for(int nLeafIndex(0); nLeafIndex< leafArray.size(); nLeafIndex++)
|
||||||
{
|
{
|
||||||
ST_NODE st_Node_Leaf;
|
ST_NODE st_Node_Leaf;
|
||||||
QJsonObject leafLevelObject = leafArray[nLeafIndex].toObject();
|
QJsonObject leafLevelObject = leafArray[nLeafIndex].toObject();
|
||||||
makeStButton(st_Node_Leaf, leafLevelObject);
|
makeStButton(st_Node_Leaf, leafLevelObject);
|
||||||
QPair<int, ST_NODE> leafMap;
|
QPair<int, ST_NODE> leafMap;
|
||||||
leafMap.first = nItemNumber++;
|
leafMap.first = nItemNumber++;
|
||||||
leafMap.second = st_Node_Leaf;
|
leafMap.second = st_Node_Leaf;
|
||||||
m_mapNav[nChildNumber].append(leafMap);
|
m_mapNav[nChildNumber].append(leafMap);
|
||||||
}
|
}
|
||||||
m_mapNav[nTopNumber].append(childMap);
|
m_mapNav[nTopNumber].append(childMap);
|
||||||
}
|
}
|
||||||
m_mapNav[-1].append(topMap);
|
m_mapNav[-1].append(topMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonArray CJsonOpt::getSaveItems(const QMap<int, QList<QPair<int, ST_NODE> > > &map, int key)
|
QJsonArray CJsonOpt::getSaveItems(const QMap<int, QList<QPair<int, ST_NODE> > > &map, int key)
|
||||||
{
|
{
|
||||||
QJsonArray root;
|
QJsonArray root;
|
||||||
QList<QPair<int, ST_NODE>> rootList = map.value(key);
|
QList<QPair<int, ST_NODE>> rootList = map.value(key);
|
||||||
for(int n=0; n<rootList.length(); n++){
|
for(int n=0; n<rootList.length(); n++){
|
||||||
QJsonObject object;
|
QJsonObject object;
|
||||||
object.insert("data", rootList[n].second.data);
|
object.insert("data", rootList[n].second.data);
|
||||||
object.insert("icon", rootList[n].second.icon);
|
object.insert("icon", rootList[n].second.icon);
|
||||||
object.insert("name", rootList[n].second.name);
|
object.insert("name", rootList[n].second.name);
|
||||||
object.insert("used", rootList[n].second.used);
|
object.insert("used", rootList[n].second.used);
|
||||||
object.insert("opt", rootList[n].second.type);
|
object.insert("opt", rootList[n].second.type);
|
||||||
object.insert("web" , rootList[n].second.web);
|
object.insert("web" , rootList[n].second.web);
|
||||||
object.insert("webType", rootList[n].second.webType);
|
object.insert("webType", rootList[n].second.webType);
|
||||||
object.insert("url", rootList[n].second.url);
|
object.insert("url", rootList[n].second.url);
|
||||||
object.insert("items", getSaveItems(map, rootList[n].first));
|
object.insert("items", getSaveItems(map, rootList[n].first));
|
||||||
root.append(object);
|
root.append(object);
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CJsonOpt::makeStButton(ST_NODE &st_Node, const QJsonObject &object)
|
void CJsonOpt::makeStButton(ST_NODE &st_Node, const QJsonObject &object)
|
||||||
{
|
{
|
||||||
if(!object.value("name").isUndefined())
|
if(!object.value("name").isUndefined())
|
||||||
{
|
{
|
||||||
st_Node.name = object.value("name").toString();
|
st_Node.name = object.value("name").toString();
|
||||||
}
|
}
|
||||||
if(!object.value("icon").isUndefined())
|
if(!object.value("icon").isUndefined())
|
||||||
{
|
{
|
||||||
st_Node.icon = object.value("icon").toString();
|
st_Node.icon = object.value("icon").toString();
|
||||||
}
|
}
|
||||||
if(!object.value("data").isUndefined())
|
if(!object.value("data").isUndefined())
|
||||||
{
|
{
|
||||||
st_Node.data = object.value("data").toString();
|
st_Node.data = object.value("data").toString();
|
||||||
}
|
}
|
||||||
if(!object.value("opt").isUndefined())
|
if(!object.value("opt").isUndefined())
|
||||||
{
|
{
|
||||||
st_Node.type = object.value("opt").toInt();
|
st_Node.type = object.value("opt").toInt();
|
||||||
}
|
}
|
||||||
if(!object.value("used").isUndefined())
|
if(!object.value("used").isUndefined())
|
||||||
{
|
{
|
||||||
st_Node.used = object.value("used").toInt();
|
st_Node.used = object.value("used").toInt();
|
||||||
}
|
}
|
||||||
if(!object.value("web").isUndefined())
|
if(!object.value("web").isUndefined())
|
||||||
{
|
{
|
||||||
st_Node.web = object.value("web").toInt();
|
st_Node.web = object.value("web").toInt();
|
||||||
}
|
}
|
||||||
if(!object.value("webData").isUndefined())
|
if(!object.value("webData").isUndefined())
|
||||||
{
|
{
|
||||||
st_Node.webData = object.value("webData").toString();
|
st_Node.webData = object.value("webData").toString();
|
||||||
}
|
}
|
||||||
if(!object.value("webType").isUndefined())
|
if(!object.value("webType").isUndefined())
|
||||||
{
|
{
|
||||||
st_Node.webType = object.value("webType").toString();
|
st_Node.webType = object.value("webType").toString();
|
||||||
}
|
}
|
||||||
if(!object.value("url").isUndefined())
|
if(!object.value("url").isUndefined())
|
||||||
{
|
{
|
||||||
st_Node.url = object.value("url").toString();
|
st_Node.url = object.value("url").toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CJsonOpt::onFirst()
|
void CJsonOpt::onFirst()
|
||||||
{
|
{
|
||||||
if(!m_mapButton.isEmpty())
|
if(!m_mapButton.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList navList;
|
QStringList navList;
|
||||||
for(int nIndex(0); nIndex<m_mapNav.value(-1).length(); nIndex++)
|
for(int nIndex(0); nIndex<m_mapNav.value(-1).length(); nIndex++)
|
||||||
{
|
{
|
||||||
navList.append("1");
|
navList.append("1");
|
||||||
}
|
}
|
||||||
ST_NODE st_node;
|
ST_NODE st_node;
|
||||||
st_node.name = QObject::tr("自定义项目");
|
st_node.name = QObject::tr("自定义项目");
|
||||||
st_node.type = SWITCH_NAV;
|
st_node.type = SWITCH_NAV;
|
||||||
st_node.data = navList.join(",");
|
st_node.data = navList.join(",");
|
||||||
m_mapButton.insert("m_button1", st_node);
|
m_mapButton.insert("m_button1", st_node);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,45 +1,45 @@
|
|||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#
|
#
|
||||||
# Project created by QtCreator 2021-04-08T17:00:16
|
# Project created by QtCreator 2021-04-08T17:00:16
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui
|
QT += core gui
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = NavigationApi
|
TARGET = NavigationApi
|
||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
# depend on your compiler). Please consult the documentation of the
|
# depend on your compiler). Please consult the documentation of the
|
||||||
# deprecated API in order to know how to port your code away from it.
|
# deprecated API in order to know how to port your code away from it.
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
DEFINES += NAVIGATION_API_EXPORT
|
DEFINES += NAVIGATION_API_EXPORT
|
||||||
|
|
||||||
# You can also make your code fail to compile if you use deprecated APIs.
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
# In order to do so, uncomment the following line.
|
# 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.
|
# 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
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
CJsonOpt.cpp
|
CJsonOpt.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
../../../include/gui/GraphTool/NavigationApi/CJsonOpt.h \
|
../../../include/gui/GraphTool/NavigationApi/CJsonOpt.h \
|
||||||
../../../include/gui/GraphTool/NavigationApi/NavigationApiExport.h
|
../../../include/gui/GraphTool/NavigationApi/NavigationApiExport.h
|
||||||
|
|
||||||
LIBS += \
|
LIBS += \
|
||||||
-llog4cplus \
|
-llog4cplus \
|
||||||
-lpub_logger_api \
|
-lpub_logger_api \
|
||||||
-lpub_utility_api \
|
-lpub_utility_api \
|
||||||
-lmodel_excel
|
-lmodel_excel
|
||||||
|
|
||||||
COMMON_PRI=$$PWD/../../../common.pri
|
COMMON_PRI=$$PWD/../../../common.pri
|
||||||
exists($$COMMON_PRI) {
|
exists($$COMMON_PRI) {
|
||||||
include($$COMMON_PRI)
|
include($$COMMON_PRI)
|
||||||
}else {
|
}else {
|
||||||
error("FATAL error: can not find common.pri")
|
error("FATAL error: can not find common.pri")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,97 +1,97 @@
|
|||||||
#include "CLineEditWithBt.h"
|
#include "CLineEditWithBt.h"
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
CLineEditWithBt::CLineEditWithBt(QWidget *parent, const QString &filePath, Option option)
|
CLineEditWithBt::CLineEditWithBt(QWidget *parent, const QString &filePath, Option option)
|
||||||
:QWidget(parent),m_filePath(filePath),m_option(option)
|
:QWidget(parent),m_filePath(filePath),m_option(option)
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||||
m_edit = new QLineEdit(this);
|
m_edit = new QLineEdit(this);
|
||||||
m_edit->installEventFilter(this);
|
m_edit->installEventFilter(this);
|
||||||
m_button = new QToolButton(this);
|
m_button = new QToolButton(this);
|
||||||
m_button->setText("...");
|
m_button->setText("...");
|
||||||
m_button->setFixedSize(21,20);
|
m_button->setFixedSize(21,20);
|
||||||
layout->addWidget(m_edit);
|
layout->addWidget(m_edit);
|
||||||
layout->addWidget(m_button);
|
layout->addWidget(m_button);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
this->setLayout(layout);
|
this->setLayout(layout);
|
||||||
|
|
||||||
connect(m_button, SIGNAL(clicked()), this, SLOT(getFilePath()));
|
connect(m_button, SIGNAL(clicked()), this, SLOT(getFilePath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CLineEditWithBt::~CLineEditWithBt()
|
CLineEditWithBt::~CLineEditWithBt()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CLineEditWithBt::text()
|
QString CLineEditWithBt::text()
|
||||||
{
|
{
|
||||||
return m_edit->text();
|
return m_edit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLineEditWithBt::setText(const QString &text)
|
void CLineEditWithBt::setText(const QString &text)
|
||||||
{
|
{
|
||||||
m_edit->setText(text);
|
m_edit->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLineEditWithBt::getFilePath()
|
void CLineEditWithBt::getFilePath()
|
||||||
{
|
{
|
||||||
QFileDialog *dialog = new QFileDialog(this, tr("选择文件"), m_filePath);
|
QFileDialog *dialog = new QFileDialog(this, tr("选择文件"), m_filePath);
|
||||||
dialog->setOption(QFileDialog::DontUseNativeDialog);
|
dialog->setOption(QFileDialog::DontUseNativeDialog);
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(dialog, SIGNAL(fileSelected(QString)), this, SLOT(setFilePath(QString)));
|
connect(dialog, SIGNAL(fileSelected(QString)), this, SLOT(setFilePath(QString)));
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLineEditWithBt::setFilePath(const QString &name)
|
void CLineEditWithBt::setFilePath(const QString &name)
|
||||||
{
|
{
|
||||||
if(name != QString())
|
if(name != QString())
|
||||||
{
|
{
|
||||||
QDir dir;
|
QDir dir;
|
||||||
switch (m_option) {
|
switch (m_option) {
|
||||||
case GetFile:
|
case GetFile:
|
||||||
{
|
{
|
||||||
dir.cd(m_filePath);
|
dir.cd(m_filePath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GetPath:
|
case GetPath:
|
||||||
{
|
{
|
||||||
dir.cd(QCoreApplication::applicationDirPath());
|
dir.cd(QCoreApplication::applicationDirPath());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString text = dir.relativeFilePath(name);
|
QString text = dir.relativeFilePath(name);
|
||||||
if(text.right(4) == ".exe")
|
if(text.right(4) == ".exe")
|
||||||
{
|
{
|
||||||
text.remove(-4, 4);
|
text.remove(-4, 4);
|
||||||
}
|
}
|
||||||
setText(text);
|
setText(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLineEditWithBt::eventFilter(QObject *watched, QEvent *event)
|
bool CLineEditWithBt::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if(watched == m_edit)
|
if(watched == m_edit)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::FocusOut)
|
if (event->type() == QEvent::FocusOut)
|
||||||
{
|
{
|
||||||
this->setFocus();
|
this->setFocus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QWidget::eventFilter(watched, event);
|
return QWidget::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,37 +1,37 @@
|
|||||||
#ifndef CLINEEDITWITHBT_H
|
#ifndef CLINEEDITWITHBT_H
|
||||||
#define CLINEEDITWITHBT_H
|
#define CLINEEDITWITHBT_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
class CLineEditWithBt : public QWidget
|
class CLineEditWithBt : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum Option{
|
enum Option{
|
||||||
GetFile = 0,
|
GetFile = 0,
|
||||||
GetPath = 1
|
GetPath = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
CLineEditWithBt(QWidget *parent = 0, const QString& filePath = "", Option option = GetFile);
|
CLineEditWithBt(QWidget *parent = 0, const QString& filePath = "", Option option = GetFile);
|
||||||
~CLineEditWithBt();
|
~CLineEditWithBt();
|
||||||
|
|
||||||
void setText(const QString& text);
|
void setText(const QString& text);
|
||||||
QString text();
|
QString text();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void getFilePath();
|
void getFilePath();
|
||||||
void setFilePath(const QString& name);
|
void setFilePath(const QString& name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_filePath;
|
QString m_filePath;
|
||||||
Option m_option;
|
Option m_option;
|
||||||
QLineEdit *m_edit;
|
QLineEdit *m_edit;
|
||||||
QToolButton *m_button;
|
QToolButton *m_button;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLINEEDITWITHBT_H
|
#endif // CLINEEDITWITHBT_H
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,83 +1,83 @@
|
|||||||
#ifndef CNAVIGATIONDIALOG_H
|
#ifndef CNAVIGATIONDIALOG_H
|
||||||
#define CNAVIGATIONDIALOG_H
|
#define CNAVIGATIONDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
||||||
#include "model_excel/xlsx/xlsxdocument.h"
|
#include "model_excel/xlsx/xlsxdocument.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CNavigationDialog;
|
class CNavigationDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const int Item_Role; //< 节点数-仅导入使用
|
extern const int Item_Role; //< 节点数-仅导入使用
|
||||||
|
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
class CNavigationDialog : public QDialog
|
class CNavigationDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CNavigationDialog(QWidget *parent = 0);
|
explicit CNavigationDialog(QWidget *parent = 0);
|
||||||
~CNavigationDialog();
|
~CNavigationDialog();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setColumnWidth(int col, int width);
|
void setColumnWidth(int col, int width);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initialize();
|
void initialize();
|
||||||
void setTextAlignment(QTreeWidgetItem *item);
|
void setTextAlignment(QTreeWidgetItem *item);
|
||||||
void makeTree(const QMap<QString, ST_NODE> &btMap,
|
void makeTree(const QMap<QString, ST_NODE> &btMap,
|
||||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||||
void addChildLevelItem(QTreeWidgetItem *item, const QPair<int, ST_NODE> &node,
|
void addChildLevelItem(QTreeWidgetItem *item, const QPair<int, ST_NODE> &node,
|
||||||
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
const QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||||
QTreeWidgetItem* getAddLevelItem(const ST_NODE& st_node);
|
QTreeWidgetItem* getAddLevelItem(const ST_NODE& st_node);
|
||||||
void getSaveMap(QMap<QString, ST_NODE> &btMap,
|
void getSaveMap(QMap<QString, ST_NODE> &btMap,
|
||||||
QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||||
void getSaveNavMap(QTreeWidgetItem *item, int key, int &count,
|
void getSaveNavMap(QTreeWidgetItem *item, int key, int &count,
|
||||||
QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
QMap<int, QList<QPair<int, ST_NODE> > > &navMap);
|
||||||
void getSaveStNode(QTreeWidgetItem *item,
|
void getSaveStNode(QTreeWidgetItem *item,
|
||||||
ST_NODE &st_node);
|
ST_NODE &st_node);
|
||||||
void addChildItemByImport(const QList<int> &parents, QTreeWidgetItem *item);
|
void addChildItemByImport(const QList<int> &parents, QTreeWidgetItem *item);
|
||||||
QString checkTreeValid();
|
QString checkTreeValid();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotItemChanged(QTreeWidgetItem *item, int column);
|
void slotItemChanged(QTreeWidgetItem *item, int column);
|
||||||
void onAddClicked();
|
void onAddClicked();
|
||||||
void onUpAddClicked();
|
void onUpAddClicked();
|
||||||
void onDeleteClicked();
|
void onDeleteClicked();
|
||||||
void onClearClicked();
|
void onClearClicked();
|
||||||
void onMoveUpClicked();
|
void onMoveUpClicked();
|
||||||
void onMoveDownClicked();
|
void onMoveDownClicked();
|
||||||
void onConfirmClicked();
|
void onConfirmClicked();
|
||||||
void onCancelClicked();
|
void onCancelClicked();
|
||||||
void onExport();
|
void onExport();
|
||||||
void onImport();
|
void onImport();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int findValue(const QMap<QString,int> &map, const QString &key);
|
int findValue(const QMap<QString,int> &map, const QString &key);
|
||||||
QString getEnableStr(const int &value);
|
QString getEnableStr(const int &value);
|
||||||
QString getTypeStr(const int &value);
|
QString getTypeStr(const int &value);
|
||||||
int getEnable(const QString &value);
|
int getEnable(const QString &value);
|
||||||
int getType(const QString &value);
|
int getType(const QString &value);
|
||||||
QMap<int, QString> makePathMap();
|
QMap<int, QString> makePathMap();
|
||||||
QString hexTo26(int number);
|
QString hexTo26(int number);
|
||||||
void xlsxWrite(QXlsx::Document &xlsx, int &row,
|
void xlsxWrite(QXlsx::Document &xlsx, int &row,
|
||||||
const QString &topName,
|
const QString &topName,
|
||||||
const QString &firName,
|
const QString &firName,
|
||||||
const QString &secName,
|
const QString &secName,
|
||||||
const QString &thirdName,
|
const QString &thirdName,
|
||||||
const ST_NODE &st_node);
|
const ST_NODE &st_node);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CNavigationDialog *ui;
|
Ui::CNavigationDialog *ui;
|
||||||
CJsonOpt *m_pJsonOpt;
|
CJsonOpt *m_pJsonOpt;
|
||||||
int m_itemIndex;
|
int m_itemIndex;
|
||||||
QString m_strFileHomePath;
|
QString m_strFileHomePath;
|
||||||
QMap<int, QString> m_mapEnable;
|
QMap<int, QString> m_mapEnable;
|
||||||
QMap<int, QString> m_mapType;
|
QMap<int, QString> m_mapType;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CNAVIGATIONDIALOG_H
|
#endif // CNAVIGATIONDIALOG_H
|
||||||
|
|||||||
@ -1,288 +1,288 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CNavigationDialog</class>
|
<class>CNavigationDialog</class>
|
||||||
<widget class="QDialog" name="CNavigationDialog">
|
<widget class="QDialog" name="CNavigationDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1087</width>
|
<width>1087</width>
|
||||||
<height>673</height>
|
<height>673</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>导航栏配置工具</string>
|
<string>导航栏配置工具</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QFrame" name="frame">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Plain</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_add">
|
<widget class="QPushButton" name="m_add">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>添加节点</string>
|
<string>添加节点</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>+</string>
|
<string>+</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_upAdd">
|
<widget class="QPushButton" name="m_upAdd">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>添加子节点</string>
|
<string>添加子节点</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>∟</string>
|
<string>∟</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_delete">
|
<widget class="QPushButton" name="m_delete">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>删除节点</string>
|
<string>删除节点</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>-</string>
|
<string>-</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_clear">
|
<widget class="QPushButton" name="m_clear">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>清空节点</string>
|
<string>清空节点</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>×</string>
|
<string>×</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_moveUp">
|
<widget class="QPushButton" name="m_moveUp">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>上移节点</string>
|
<string>上移节点</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>↑</string>
|
<string>↑</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_moveDown">
|
<widget class="QPushButton" name="m_moveDown">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>21</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>下移节点</string>
|
<string>下移节点</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>↓</string>
|
<string>↓</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>484</width>
|
<width>484</width>
|
||||||
<height>17</height>
|
<height>17</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_import">
|
<widget class="QPushButton" name="m_import">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>导入</string>
|
<string>导入</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_export">
|
<widget class="QPushButton" name="m_export">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>导出</string>
|
<string>导出</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="3">
|
<item row="1" column="0" colspan="3">
|
||||||
<widget class="CTreeWidget" name="m_treeWidget">
|
<widget class="CTreeWidget" name="m_treeWidget">
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">1</string>
|
<string notr="true">1</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="3">
|
<item row="2" column="0" colspan="3">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_confirm">
|
<widget class="QPushButton" name="m_confirm">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>确认</string>
|
<string>确认</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_cancel">
|
<widget class="QPushButton" name="m_cancel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>取消</string>
|
<string>取消</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>CTreeWidget</class>
|
<class>CTreeWidget</class>
|
||||||
<extends>QTreeWidget</extends>
|
<extends>QTreeWidget</extends>
|
||||||
<header>CTreeWidget.h</header>
|
<header>CTreeWidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -1,145 +1,145 @@
|
|||||||
#include "CTreeItemDelegate.h"
|
#include "CTreeItemDelegate.h"
|
||||||
#include "CLineEditWithBt.h"
|
#include "CLineEditWithBt.h"
|
||||||
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
#include "gui/GraphTool/NavigationApi/CJsonOpt.h"
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
CTreeItemDelegate::CTreeItemDelegate(QObject *parent, DelegateWidget type)
|
CTreeItemDelegate::CTreeItemDelegate(QObject *parent, DelegateWidget type)
|
||||||
: QStyledItemDelegate(parent),
|
: QStyledItemDelegate(parent),
|
||||||
m_type(type)
|
m_type(type)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CTreeItemDelegate::~CTreeItemDelegate()
|
CTreeItemDelegate::~CTreeItemDelegate()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTreeItemDelegate::setComboMap(const QMap<int, QString> &map)
|
void CTreeItemDelegate::setComboMap(const QMap<int, QString> &map)
|
||||||
{
|
{
|
||||||
m_mapComboBox = map;
|
m_mapComboBox = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTreeItemDelegate::setFilePath(const QString &path)
|
void CTreeItemDelegate::setFilePath(const QString &path)
|
||||||
{
|
{
|
||||||
m_strFilePath = path;
|
m_strFilePath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *CTreeItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QWidget *CTreeItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
switch(m_type){
|
switch(m_type){
|
||||||
case ReadOnly:
|
case ReadOnly:
|
||||||
return NULL;
|
return NULL;
|
||||||
case LineEdit:
|
case LineEdit:
|
||||||
return new QLineEdit(parent);
|
return new QLineEdit(parent);
|
||||||
case ComboBox:
|
case ComboBox:
|
||||||
{
|
{
|
||||||
QComboBox *box= new QComboBox(parent);
|
QComboBox *box= new QComboBox(parent);
|
||||||
QMap<int, QString>::const_iterator iter
|
QMap<int, QString>::const_iterator iter
|
||||||
= m_mapComboBox.constBegin();
|
= m_mapComboBox.constBegin();
|
||||||
for(; iter != m_mapComboBox.constEnd(); iter ++)
|
for(; iter != m_mapComboBox.constEnd(); iter ++)
|
||||||
{
|
{
|
||||||
if(iter.value() == tr("切换导航") && index.parent() != QModelIndex())
|
if(iter.value() == tr("切换导航") && index.parent() != QModelIndex())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(iter.value() == tr("加载网页") && index.parent() == QModelIndex())
|
if(iter.value() == tr("加载网页") && index.parent() == QModelIndex())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
box->addItem(iter.value(), iter.key());
|
box->addItem(iter.value(), iter.key());
|
||||||
}
|
}
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
case PicFile:
|
case PicFile:
|
||||||
{
|
{
|
||||||
const QAbstractItemModel *model = index.model();
|
const QAbstractItemModel *model = index.model();
|
||||||
if(model)
|
if(model)
|
||||||
{
|
{
|
||||||
//< tr("操作")
|
//< tr("操作")
|
||||||
int type = model->index(index.row(), 2, index.parent()).data(Qt::UserRole).toInt();
|
int type = model->index(index.row(), 2, index.parent()).data(Qt::UserRole).toInt();
|
||||||
QString path = m_mapComboBox.value(type, "");
|
QString path = m_mapComboBox.value(type, "");
|
||||||
if(path.isEmpty())
|
if(path.isEmpty())
|
||||||
{
|
{
|
||||||
return new CLineEditWithBt(parent);
|
return new CLineEditWithBt(parent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new CLineEditWithBt(parent, path);
|
return new CLineEditWithBt(parent, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case IconFile:
|
case IconFile:
|
||||||
{
|
{
|
||||||
return new CLineEditWithBt(parent, m_strFilePath);
|
return new CLineEditWithBt(parent, m_strFilePath);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTreeItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
void CTreeItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
switch(m_type){
|
switch(m_type){
|
||||||
case LineEdit:
|
case LineEdit:
|
||||||
{
|
{
|
||||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ComboBox:
|
case ComboBox:
|
||||||
{
|
{
|
||||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||||
comb->setCurrentIndex(comb->findText(index.data(Qt::DisplayRole).toString()));
|
comb->setCurrentIndex(comb->findText(index.data(Qt::DisplayRole).toString()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PicFile:
|
case PicFile:
|
||||||
case IconFile:
|
case IconFile:
|
||||||
{
|
{
|
||||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||||
edit->setText(index.data(Qt::DisplayRole).toString());
|
edit->setText(index.data(Qt::DisplayRole).toString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
QStyledItemDelegate::setEditorData(editor, index);
|
QStyledItemDelegate::setEditorData(editor, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTreeItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
void CTreeItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case LineEdit:
|
case LineEdit:
|
||||||
{
|
{
|
||||||
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
QLineEdit *edit = static_cast<QLineEdit*>(editor);
|
||||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ComboBox:
|
case ComboBox:
|
||||||
{
|
{
|
||||||
QComboBox *comb = static_cast<QComboBox*>(editor);
|
QComboBox *comb = static_cast<QComboBox*>(editor);
|
||||||
if(model->data(index, Qt::DisplayRole) != comb->currentText())
|
if(model->data(index, Qt::DisplayRole) != comb->currentText())
|
||||||
{
|
{
|
||||||
model->setData(index, comb->currentText(), Qt::DisplayRole);
|
model->setData(index, comb->currentText(), Qt::DisplayRole);
|
||||||
model->setData(index, comb->currentData().toInt(), Qt::UserRole);
|
model->setData(index, comb->currentData().toInt(), Qt::UserRole);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PicFile:
|
case PicFile:
|
||||||
case IconFile:
|
case IconFile:
|
||||||
{
|
{
|
||||||
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
CLineEditWithBt *edit = static_cast<CLineEditWithBt*>(editor);
|
||||||
model->setData(index, edit->text(), Qt::DisplayRole);
|
model->setData(index, edit->text(), Qt::DisplayRole);
|
||||||
model->setData(index, edit->text(), Qt::UserRole);
|
model->setData(index, edit->text(), Qt::UserRole);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
QStyledItemDelegate::setModelData(editor, model, index);
|
QStyledItemDelegate::setModelData(editor, model, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTreeItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void CTreeItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(index)
|
Q_UNUSED(index)
|
||||||
editor->setGeometry(option.rect);
|
editor->setGeometry(option.rect);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,52 +1,52 @@
|
|||||||
#ifndef CTREEITEMDELEGATE_H
|
#ifndef CTREEITEMDELEGATE_H
|
||||||
#define CTREEITEMDELEGATE_H
|
#define CTREEITEMDELEGATE_H
|
||||||
|
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
class CTreeItemDelegate : public QStyledItemDelegate
|
class CTreeItemDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum DelegateWidget{
|
enum DelegateWidget{
|
||||||
ReadOnly = 0,
|
ReadOnly = 0,
|
||||||
LineEdit = 1,
|
LineEdit = 1,
|
||||||
ComboBox = 2,
|
ComboBox = 2,
|
||||||
PicFile = 3,
|
PicFile = 3,
|
||||||
IconFile = 4
|
IconFile = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
CTreeItemDelegate(QObject *parent = 0, DelegateWidget type = LineEdit);
|
CTreeItemDelegate(QObject *parent = 0, DelegateWidget type = LineEdit);
|
||||||
~CTreeItemDelegate();
|
~CTreeItemDelegate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setComboMap DelegateWidget::ComboBox/PicFile/IconFile 有效
|
* @brief setComboMap DelegateWidget::ComboBox/PicFile/IconFile 有效
|
||||||
* @param map
|
* @param map
|
||||||
*/
|
*/
|
||||||
void setComboMap(const QMap<int, QString> &map);
|
void setComboMap(const QMap<int, QString> &map);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setFilePath DelegateWidget::IconFile 有效
|
* @brief setFilePath DelegateWidget::IconFile 有效
|
||||||
* @param path
|
* @param path
|
||||||
*/
|
*/
|
||||||
void setFilePath(const QString &path);
|
void setFilePath(const QString &path);
|
||||||
|
|
||||||
QWidget *createEditor(QWidget *parent,
|
QWidget *createEditor(QWidget *parent,
|
||||||
const QStyleOptionViewItem &option,
|
const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
void setModelData(QWidget *editor,
|
void setModelData(QWidget *editor,
|
||||||
QAbstractItemModel *model,
|
QAbstractItemModel *model,
|
||||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void updateEditorGeometry(QWidget *editor,
|
void updateEditorGeometry(QWidget *editor,
|
||||||
const QStyleOptionViewItem &option,
|
const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DelegateWidget m_type;
|
DelegateWidget m_type;
|
||||||
QMap<int, QString> m_mapComboBox;
|
QMap<int, QString> m_mapComboBox;
|
||||||
QString m_strFilePath;
|
QString m_strFilePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CTREEITEMDELEGATE_H
|
#endif // CTREEITEMDELEGATE_H
|
||||||
|
|||||||
@ -1,18 +1,18 @@
|
|||||||
#include "CTreeWidget.h"
|
#include "CTreeWidget.h"
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
CTreeWidget::CTreeWidget(QWidget *parent)
|
CTreeWidget::CTreeWidget(QWidget *parent)
|
||||||
: QTreeWidget(parent)
|
: QTreeWidget(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTreeWidget::mousePressEvent(QMouseEvent *event)
|
void CTreeWidget::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QTreeWidget::mousePressEvent(event);
|
QTreeWidget::mousePressEvent(event);
|
||||||
QModelIndex modelIndex = indexAt(event->pos());
|
QModelIndex modelIndex = indexAt(event->pos());
|
||||||
if(!modelIndex.isValid())
|
if(!modelIndex.isValid())
|
||||||
{
|
{
|
||||||
setCurrentIndex(QModelIndex());
|
setCurrentIndex(QModelIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
#ifndef CTREEWIDGET_H
|
#ifndef CTREEWIDGET_H
|
||||||
#define CTREEWIDGET_H
|
#define CTREEWIDGET_H
|
||||||
|
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
|
|
||||||
class CTreeWidget : public QTreeWidget
|
class CTreeWidget : public QTreeWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CTreeWidget(QWidget *parent = Q_NULLPTR);
|
CTreeWidget(QWidget *parent = Q_NULLPTR);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CTREEWIDGET_H
|
#endif // CTREEWIDGET_H
|
||||||
|
|||||||
@ -1,55 +1,55 @@
|
|||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#
|
#
|
||||||
# Project created by QtCreator 2021-04-08T17:00:16
|
# Project created by QtCreator 2021-04-08T17:00:16
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui
|
QT += core gui
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = NavigationTool
|
TARGET = NavigationTool
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
# depend on your compiler). Please consult the documentation of the
|
# depend on your compiler). Please consult the documentation of the
|
||||||
# deprecated API in order to know how to port your code away from it.
|
# deprecated API in order to know how to port your code away from it.
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
# You can also make your code fail to compile if you use deprecated APIs.
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
# In order to do so, uncomment the following line.
|
# 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.
|
# 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
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
CNavigationDialog.cpp \
|
CNavigationDialog.cpp \
|
||||||
CTreeItemDelegate.cpp \
|
CTreeItemDelegate.cpp \
|
||||||
CLineEditWithBt.cpp \
|
CLineEditWithBt.cpp \
|
||||||
CTreeWidget.cpp
|
CTreeWidget.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
CNavigationDialog.h \
|
CNavigationDialog.h \
|
||||||
CTreeItemDelegate.h \
|
CTreeItemDelegate.h \
|
||||||
CLineEditWithBt.h \
|
CLineEditWithBt.h \
|
||||||
../../../include/gui/GraphTool/NavigationApi/CJsonOpt.h \
|
../../../include/gui/GraphTool/NavigationApi/CJsonOpt.h \
|
||||||
CTreeWidget.h
|
CTreeWidget.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
CNavigationDialog.ui
|
CNavigationDialog.ui
|
||||||
|
|
||||||
LIBS += \
|
LIBS += \
|
||||||
-llog4cplus \
|
-llog4cplus \
|
||||||
-lpub_logger_api \
|
-lpub_logger_api \
|
||||||
-lpub_utility_api \
|
-lpub_utility_api \
|
||||||
-lmodel_excel \
|
-lmodel_excel \
|
||||||
-lNavigationApi
|
-lNavigationApi
|
||||||
|
|
||||||
COMMON_PRI=$$PWD/../../../common.pri
|
COMMON_PRI=$$PWD/../../../common.pri
|
||||||
exists($$COMMON_PRI) {
|
exists($$COMMON_PRI) {
|
||||||
include($$COMMON_PRI)
|
include($$COMMON_PRI)
|
||||||
}else {
|
}else {
|
||||||
error("FATAL error: can not find common.pri")
|
error("FATAL error: can not find common.pri")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include "common/QtAppGlobalSet.h"
|
#include "common/QtAppGlobalSet.h"
|
||||||
#include "CNavigationDialog.h"
|
#include "CNavigationDialog.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
kbd_common::doQtAppGlobalSet();
|
kbd_common::doQtAppGlobalSet();
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
CNavigationDialog w;
|
CNavigationDialog w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,334 +1,334 @@
|
|||||||
#include "CConfirmDialog.h"
|
#include "CConfirmDialog.h"
|
||||||
#include "ui_CConfirmDialog.h"
|
#include "ui_CConfirmDialog.h"
|
||||||
|
|
||||||
CConfirmDialog::CConfirmDialog(QWidget *parent) :
|
CConfirmDialog::CConfirmDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::CConfirmDialog)
|
ui(new Ui::CConfirmDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags()&~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags()&~Qt::WindowContextHelpButtonHint);
|
||||||
initTable();
|
initTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfirmDialog::~CConfirmDialog()
|
CConfirmDialog::~CConfirmDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfirmDialog::setNameMap(const QMap<QString, QString> &nameMap)
|
void CConfirmDialog::setNameMap(const QMap<QString, QString> &nameMap)
|
||||||
{
|
{
|
||||||
m_nameMap = nameMap;
|
m_nameMap = nameMap;
|
||||||
initTableData();
|
initTableData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfirmDialog::setRootPath(const QString &path)
|
void CConfirmDialog::setRootPath(const QString &path)
|
||||||
{
|
{
|
||||||
m_strRoot = path;
|
m_strRoot = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfirmDialog::getAllPath(QStringList& path)
|
void CConfirmDialog::getAllPath(QStringList& path)
|
||||||
{
|
{
|
||||||
QMap<QString, QString>::const_iterator it = m_nameMap.begin();
|
QMap<QString, QString>::const_iterator it = m_nameMap.begin();
|
||||||
for(;it!=m_nameMap.end();++it)
|
for(;it!=m_nameMap.end();++it)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
path.append(m_strRoot + "\\" + it.key());
|
path.append(m_strRoot + "\\" + it.key());
|
||||||
#else
|
#else
|
||||||
path.append(m_strRoot + "/" + it.key());
|
path.append(m_strRoot + "/" + it.key());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CConfirmDialog::getMessage()
|
QString CConfirmDialog::getMessage()
|
||||||
{
|
{
|
||||||
return ui->m_msgEdit->toPlainText();
|
return ui->m_msgEdit->toPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CConfirmDialog::getStrByState(enFirstColums state)
|
QString CConfirmDialog::getStrByState(enFirstColums state)
|
||||||
{
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case FIRST_NO_CHANGED:
|
case FIRST_NO_CHANGED:
|
||||||
{
|
{
|
||||||
ret = tr("无修改");
|
ret = tr("无修改");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_ADD:
|
case FIRST_ADD:
|
||||||
{
|
{
|
||||||
ret = tr("添加");
|
ret = tr("添加");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_CONFLICTED:
|
case FIRST_CONFLICTED:
|
||||||
{
|
{
|
||||||
ret = tr("冲突");
|
ret = tr("冲突");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_DELETED:
|
case FIRST_DELETED:
|
||||||
{
|
{
|
||||||
ret = tr("删除");
|
ret = tr("删除");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_IGNORED:
|
case FIRST_IGNORED:
|
||||||
{
|
{
|
||||||
ret = tr("忽略");
|
ret = tr("忽略");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_MODIFIED:
|
case FIRST_MODIFIED:
|
||||||
{
|
{
|
||||||
ret = tr("修改");
|
ret = tr("修改");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_REPLACED:
|
case FIRST_REPLACED:
|
||||||
{
|
{
|
||||||
ret = tr("替换");
|
ret = tr("替换");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_EXTERNALS_DEFINE:
|
case FIRST_EXTERNALS_DEFINE:
|
||||||
{
|
{
|
||||||
ret = tr("未纳入版本控制的目录,被外部引用的目录所创建");
|
ret = tr("未纳入版本控制的目录,被外部引用的目录所创建");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_NOT_VERSION_CONTROL:
|
case FIRST_NOT_VERSION_CONTROL:
|
||||||
{
|
{
|
||||||
ret = tr("未纳入版本控制");
|
ret = tr("未纳入版本控制");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_MISS:
|
case FIRST_MISS:
|
||||||
{
|
{
|
||||||
ret = tr("遗失");
|
ret = tr("遗失");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_OBSTRUCTED:
|
case FIRST_OBSTRUCTED:
|
||||||
{
|
{
|
||||||
ret = tr("重名");
|
ret = tr("重名");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIRST_ILLEGAL:
|
case FIRST_ILLEGAL:
|
||||||
{
|
{
|
||||||
ret = tr("自定义非法状态");
|
ret = tr("自定义非法状态");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CConfirmDialog::getStrBySecond(enSecondColumn state)
|
QString CConfirmDialog::getStrBySecond(enSecondColumn state)
|
||||||
{
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case SECOND_NO_CHANGED:
|
case SECOND_NO_CHANGED:
|
||||||
{
|
{
|
||||||
ret = tr("无修改");
|
ret = tr("无修改");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SECOND_CONFLICTED:
|
case SECOND_CONFLICTED:
|
||||||
{
|
{
|
||||||
ret = tr("冲突");
|
ret = tr("冲突");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SECOND_MODIFIED:
|
case SECOND_MODIFIED:
|
||||||
{
|
{
|
||||||
ret = tr("改变");
|
ret = tr("改变");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SECOND_ILLEGAL:
|
case SECOND_ILLEGAL:
|
||||||
{
|
{
|
||||||
ret = tr("自定义非法状态");
|
ret = tr("自定义非法状态");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CConfirmDialog::getStrByThird(enThirdColumns state)
|
QString CConfirmDialog::getStrByThird(enThirdColumns state)
|
||||||
{
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case THIRD_NOT_LOCKED:
|
case THIRD_NOT_LOCKED:
|
||||||
{
|
{
|
||||||
ret = tr("未锁定");
|
ret = tr("未锁定");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case THIRD_LOCKED:
|
case THIRD_LOCKED:
|
||||||
{
|
{
|
||||||
ret = tr("锁定");
|
ret = tr("锁定");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case THIRD_ILLEGAL:
|
case THIRD_ILLEGAL:
|
||||||
{
|
{
|
||||||
ret = tr("自定义非法状态");
|
ret = tr("自定义非法状态");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CConfirmDialog::getStrByFourth(enFourthColumn state)
|
QString CConfirmDialog::getStrByFourth(enFourthColumn state)
|
||||||
{
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case FOURTH_NOT_HISTORY:
|
case FOURTH_NOT_HISTORY:
|
||||||
{
|
{
|
||||||
ret = tr("没有历史");
|
ret = tr("没有历史");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FOURTH_CONTAIN_HISTORY:
|
case FOURTH_CONTAIN_HISTORY:
|
||||||
{
|
{
|
||||||
ret = tr("包含历史");
|
ret = tr("包含历史");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FOURTH_ILLEGAL:
|
case FOURTH_ILLEGAL:
|
||||||
{
|
{
|
||||||
ret = tr("自定义非法状态");
|
ret = tr("自定义非法状态");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CConfirmDialog::getStrByFifth(enFifthColumn state)
|
QString CConfirmDialog::getStrByFifth(enFifthColumn state)
|
||||||
{
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case FIFTH_NORMAL:
|
case FIFTH_NORMAL:
|
||||||
{
|
{
|
||||||
ret = tr("正常");
|
ret = tr("正常");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIFTH_SWICTCH:
|
case FIFTH_SWICTCH:
|
||||||
{
|
{
|
||||||
ret = tr("以切换");
|
ret = tr("以切换");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIFTH_EXTERNAL_REFER_CREATE:
|
case FIFTH_EXTERNAL_REFER_CREATE:
|
||||||
{
|
{
|
||||||
ret = tr("被外部引用创建的文件");
|
ret = tr("被外部引用创建的文件");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIFTH_ILLEGAL:
|
case FIFTH_ILLEGAL:
|
||||||
{
|
{
|
||||||
ret = tr("自定义非法状态");
|
ret = tr("自定义非法状态");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CConfirmDialog::getStrBySixth(enSixthColumn state)
|
QString CConfirmDialog::getStrBySixth(enSixthColumn state)
|
||||||
{
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case SIXTH_NOT_LOCKED:
|
case SIXTH_NOT_LOCKED:
|
||||||
{
|
{
|
||||||
ret = tr("没有被锁定标记");
|
ret = tr("没有被锁定标记");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIXTH_LOCKED:
|
case SIXTH_LOCKED:
|
||||||
{
|
{
|
||||||
ret = tr("存在锁定标记");
|
ret = tr("存在锁定标记");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIXTH_ILLEGAL:
|
case SIXTH_ILLEGAL:
|
||||||
{
|
{
|
||||||
ret = tr("自定义非法状态");
|
ret = tr("自定义非法状态");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CConfirmDialog::getStrBySeventh(enSeventhColumn state)
|
QString CConfirmDialog::getStrBySeventh(enSeventhColumn state)
|
||||||
{
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case SEVENTH_NORMAL:
|
case SEVENTH_NORMAL:
|
||||||
{
|
{
|
||||||
ret = tr("正常");
|
ret = tr("正常");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SEVENTH_TREE_CONFFLICT:
|
case SEVENTH_TREE_CONFFLICT:
|
||||||
{
|
{
|
||||||
ret = tr("树冲突");
|
ret = tr("树冲突");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SEVENTH_ILLEGAL:
|
case SEVENTH_ILLEGAL:
|
||||||
{
|
{
|
||||||
ret = tr("自定义非法状态");
|
ret = tr("自定义非法状态");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfirmDialog::initTable()
|
void CConfirmDialog::initTable()
|
||||||
{
|
{
|
||||||
ui->m_table->setColumnCount(2);
|
ui->m_table->setColumnCount(2);
|
||||||
ui->m_table->setHorizontalHeaderLabels(QStringList() << tr("名称") << tr("状态"));
|
ui->m_table->setHorizontalHeaderLabels(QStringList() << tr("名称") << tr("状态"));
|
||||||
ui->m_table->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
|
ui->m_table->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
|
||||||
ui->m_table->horizontalHeader()->setStretchLastSection(true);
|
ui->m_table->horizontalHeader()->setStretchLastSection(true);
|
||||||
ui->m_table->verticalHeader()->hide();
|
ui->m_table->verticalHeader()->hide();
|
||||||
ui->m_table->setColumnWidth(0,200);
|
ui->m_table->setColumnWidth(0,200);
|
||||||
ui->m_table->setEditTriggers(0);
|
ui->m_table->setEditTriggers(0);
|
||||||
ui->m_table->setSelectionBehavior(QAbstractItemView::SelectRows);
|
ui->m_table->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfirmDialog::initTableData()
|
void CConfirmDialog::initTableData()
|
||||||
{
|
{
|
||||||
int rowCount = m_nameMap.size();
|
int rowCount = m_nameMap.size();
|
||||||
ui->m_table->setRowCount(rowCount);
|
ui->m_table->setRowCount(rowCount);
|
||||||
QMap<QString, QString>::const_iterator it = m_nameMap.begin();
|
QMap<QString, QString>::const_iterator it = m_nameMap.begin();
|
||||||
for(int row=0;it!=m_nameMap.end();++it,++row)
|
for(int row=0;it!=m_nameMap.end();++it,++row)
|
||||||
{
|
{
|
||||||
QTableWidgetItem *name = new QTableWidgetItem(it.key());
|
QTableWidgetItem *name = new QTableWidgetItem(it.key());
|
||||||
QTableWidgetItem *state = new QTableWidgetItem(it.value());
|
QTableWidgetItem *state = new QTableWidgetItem(it.value());
|
||||||
ui->m_table->setItem(row, 0, name);
|
ui->m_table->setItem(row, 0, name);
|
||||||
ui->m_table->setItem(row, 1, state);
|
ui->m_table->setItem(row, 1, state);
|
||||||
ui->m_table->item(row,0)->setData(5,it.value());
|
ui->m_table->item(row,0)->setData(5,it.value());
|
||||||
ui->m_table->item(row,0)->setCheckState(Qt::Checked);
|
ui->m_table->item(row,0)->setCheckState(Qt::Checked);
|
||||||
}
|
}
|
||||||
connect(ui->m_table,SIGNAL(cellChanged(int,int)),this,SLOT(slot_cellChange(int,int)));
|
connect(ui->m_table,SIGNAL(cellChanged(int,int)),this,SLOT(slot_cellChange(int,int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfirmDialog::slot_cellChange(int row, int column)
|
void CConfirmDialog::slot_cellChange(int row, int column)
|
||||||
{
|
{
|
||||||
if(ui->m_table->item(row,column)->checkState() == Qt::Checked)
|
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());
|
QMap<QString, QString>::const_iterator it = m_nameMap.find(ui->m_table->item(row,0)->text());
|
||||||
if(it == m_nameMap.end())
|
if(it == m_nameMap.end())
|
||||||
{
|
{
|
||||||
m_nameMap.insert(ui->m_table->item(row,0)->text(), ui->m_table->item(row,1)->text());
|
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)
|
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());
|
QMap<QString, QString>::const_iterator it = m_nameMap.find(ui->m_table->item(row,0)->text());
|
||||||
if(it != m_nameMap.end())
|
if(it != m_nameMap.end())
|
||||||
{
|
{
|
||||||
m_nameMap.remove(ui->m_table->item(row,0)->text());
|
m_nameMap.remove(ui->m_table->item(row,0)->text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfirmDialog::on_m_confirmBtn_clicked()
|
void CConfirmDialog::on_m_confirmBtn_clicked()
|
||||||
{
|
{
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfirmDialog::on_m_cancelBtn_clicked()
|
void CConfirmDialog::on_m_cancelBtn_clicked()
|
||||||
{
|
{
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,48 +1,48 @@
|
|||||||
#ifndef CCONFIRMDIALOG_H
|
#ifndef CCONFIRMDIALOG_H
|
||||||
#define CCONFIRMDIALOG_H
|
#define CCONFIRMDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include "../../include/sys/sys_svn_file_sync_api/CSysFileSyncApi.h"
|
#include "../../include/sys/sys_svn_file_sync_api/CSysFileSyncApi.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CConfirmDialog;
|
class CConfirmDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace kbd_sys;
|
using namespace kbd_sys;
|
||||||
class CConfirmDialog : public QDialog
|
class CConfirmDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CConfirmDialog(QWidget *parent = 0);
|
explicit CConfirmDialog(QWidget *parent = 0);
|
||||||
~CConfirmDialog();
|
~CConfirmDialog();
|
||||||
|
|
||||||
void setNameMap(const QMap<QString, QString> &nameMap);
|
void setNameMap(const QMap<QString, QString> &nameMap);
|
||||||
void setRootPath(const QString& path);
|
void setRootPath(const QString& path);
|
||||||
void getAllPath(QStringList &path);
|
void getAllPath(QStringList &path);
|
||||||
QString getMessage();
|
QString getMessage();
|
||||||
static QString getStrByState(enFirstColums state);
|
static QString getStrByState(enFirstColums state);
|
||||||
static QString getStrBySecond(enSecondColumn state);
|
static QString getStrBySecond(enSecondColumn state);
|
||||||
static QString getStrByThird(enThirdColumns state);
|
static QString getStrByThird(enThirdColumns state);
|
||||||
static QString getStrByFourth(enFourthColumn state);
|
static QString getStrByFourth(enFourthColumn state);
|
||||||
static QString getStrByFifth(enFifthColumn state);
|
static QString getStrByFifth(enFifthColumn state);
|
||||||
static QString getStrBySixth(enSixthColumn state);
|
static QString getStrBySixth(enSixthColumn state);
|
||||||
static QString getStrBySeventh(enSeventhColumn state);
|
static QString getStrBySeventh(enSeventhColumn state);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slot_cellChange(int row, int column);
|
void slot_cellChange(int row, int column);
|
||||||
void on_m_confirmBtn_clicked();
|
void on_m_confirmBtn_clicked();
|
||||||
void on_m_cancelBtn_clicked();
|
void on_m_cancelBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initTable();
|
void initTable();
|
||||||
void initTableData();
|
void initTableData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CConfirmDialog *ui;
|
Ui::CConfirmDialog *ui;
|
||||||
QMap<QString,QString> m_nameMap;
|
QMap<QString,QString> m_nameMap;
|
||||||
QString m_strRoot;
|
QString m_strRoot;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CCONFIRMDIALOG_H
|
#endif // CCONFIRMDIALOG_H
|
||||||
|
|||||||
@ -1,163 +1,163 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CConfirmDialog</class>
|
<class>CConfirmDialog</class>
|
||||||
<widget class="QDialog" name="CConfirmDialog">
|
<widget class="QDialog" name="CConfirmDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>379</width>
|
<width>379</width>
|
||||||
<height>370</height>
|
<height>370</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>提交</string>
|
<string>提交</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4" rowstretch="1,0,0">
|
<layout class="QGridLayout" name="gridLayout_4" rowstretch="1,0,0">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QFrame" name="frame">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>日志信息:</string>
|
<string>日志信息:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QTextEdit" name="m_msgEdit"/>
|
<widget class="QTextEdit" name="m_msgEdit"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QFrame" name="frame_2">
|
<widget class="QFrame" name="frame_2">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTableWidget" name="m_table"/>
|
<widget class="QTableWidget" name="m_table"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QFrame" name="frame_3">
|
<widget class="QFrame" name="frame_3">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>331</width>
|
<width>331</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QPushButton" name="m_confirmBtn">
|
<widget class="QPushButton" name="m_confirmBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>确认</string>
|
<string>确认</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QPushButton" name="m_cancelBtn">
|
<widget class="QPushButton" name="m_cancelBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>取消</string>
|
<string>取消</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,85 +1,85 @@
|
|||||||
#ifndef CFILESYNCDIALOG_H
|
#ifndef CFILESYNCDIALOG_H
|
||||||
#define CFILESYNCDIALOG_H
|
#define CFILESYNCDIALOG_H
|
||||||
|
|
||||||
#include "../../include/sys/sys_svn_file_sync_api/CSysFileSyncApi.h"
|
#include "../../include/sys/sys_svn_file_sync_api/CSysFileSyncApi.h"
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QFileInfoList>
|
#include <QFileInfoList>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CFileSyncDialog;
|
class CFileSyncDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum enOptAction
|
enum enOptAction
|
||||||
{
|
{
|
||||||
ACTION_DEFAULT,
|
ACTION_DEFAULT,
|
||||||
ACTION_ADD,
|
ACTION_ADD,
|
||||||
ACTION_DELETE,
|
ACTION_DELETE,
|
||||||
ACTION_COMMIT
|
ACTION_COMMIT
|
||||||
};
|
};
|
||||||
|
|
||||||
struct stSelectedPath
|
struct stSelectedPath
|
||||||
{
|
{
|
||||||
bool isAllSelect;
|
bool isAllSelect;
|
||||||
enOptAction action;
|
enOptAction action;
|
||||||
QStringList path;
|
QStringList path;
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace kbd_sys;
|
using namespace kbd_sys;
|
||||||
class CFileSyncDialog : public QDialog
|
class CFileSyncDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CFileSyncDialog(QDialog *parent = 0);
|
explicit CFileSyncDialog(QDialog *parent = 0);
|
||||||
~CFileSyncDialog();
|
~CFileSyncDialog();
|
||||||
|
|
||||||
void getFileNameByPath(const QStringList &path, QStringList& name);
|
void getFileNameByPath(const QStringList &path, QStringList& name);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
* @brief webPublish web发布
|
* @brief webPublish web发布
|
||||||
* @param pathList 全路径文件夹
|
* @param pathList 全路径文件夹
|
||||||
* @param isSuccess 是否成功
|
* @param isSuccess 是否成功
|
||||||
* @param errStr 错误信息,无错为空字符串
|
* @param errStr 错误信息,无错为空字符串
|
||||||
*/
|
*/
|
||||||
void webPublish(const QStringList& pathList, bool &isSuccess, QString& errStr);
|
void webPublish(const QStringList& pathList, bool &isSuccess, QString& errStr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slot_add();
|
void slot_add();
|
||||||
void slot_commit();
|
void slot_commit();
|
||||||
void slot_delete();
|
void slot_delete();
|
||||||
void slot_allCommit();
|
void slot_allCommit();
|
||||||
void on_m_filePathComb_editTextChanged(const QString &arg1);
|
void on_m_filePathComb_editTextChanged(const QString &arg1);
|
||||||
void on_m_selectFileBtn_clicked(); //选择路径
|
void on_m_selectFileBtn_clicked(); //选择路径
|
||||||
void on_m_reloadBtn_clicked(); //重新加载文件
|
void on_m_reloadBtn_clicked(); //重新加载文件
|
||||||
void on_m_fileTextTable_customContextMenuRequested(const QPoint &pos);
|
void on_m_fileTextTable_customContextMenuRequested(const QPoint &pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initFileTable();
|
void initFileTable();
|
||||||
void initMenu();
|
void initMenu();
|
||||||
void initComb();
|
void initComb();
|
||||||
|
|
||||||
void getFileInfos(const QString &path, QFileInfoList &list); //获取路径下的所有文件信息
|
void getFileInfos(const QString &path, QFileInfoList &list); //获取路径下的所有文件信息
|
||||||
void getSvnFile(const QString &path, QMap<QString, stFileStatus> &name, QString &error);
|
void getSvnFile(const QString &path, QMap<QString, stFileStatus> &name, QString &error);
|
||||||
QString getTimeStr(const QDateTime& time);
|
QString getTimeStr(const QDateTime& time);
|
||||||
void updatFileTable(QFileInfoList &list, const QMap<QString, stFileStatus> &svnMap);
|
void updatFileTable(QFileInfoList &list, const QMap<QString, stFileStatus> &svnMap);
|
||||||
void fileFilter(QFileInfoList &list, const QMap<QString, stFileStatus> &svnMap);
|
void fileFilter(QFileInfoList &list, const QMap<QString, stFileStatus> &svnMap);
|
||||||
QString getStatusStr(const stFileStatus& st);
|
QString getStatusStr(const stFileStatus& st);
|
||||||
|
|
||||||
QString getIconByState(enFirstColums status);
|
QString getIconByState(enFirstColums status);
|
||||||
|
|
||||||
void getSelectsPath(stSelectedPath& stPath); //合并所有选择的文件路径
|
void getSelectsPath(stSelectedPath& stPath); //合并所有选择的文件路径
|
||||||
bool checkIsNeedAppend(int row, enOptAction action);
|
bool checkIsNeedAppend(int row, enOptAction action);
|
||||||
void commit(const QStringList &path);
|
void commit(const QStringList &path);
|
||||||
void getCommitMap(const QStringList& name, QMap<QString, QString> &map);
|
void getCommitMap(const QStringList& name, QMap<QString, QString> &map);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CFileSyncDialog *ui;
|
Ui::CFileSyncDialog *ui;
|
||||||
QMenu *m_menu;
|
QMenu *m_menu;
|
||||||
CSysFileSyncApi *m_ptrSysFileSync;
|
CSysFileSyncApi *m_ptrSysFileSync;
|
||||||
QStringList m_FileTypeList;
|
QStringList m_FileTypeList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CFILESYNCDIALOG_H
|
#endif // CFILESYNCDIALOG_H
|
||||||
|
|||||||
@ -1,121 +1,121 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CFileSyncDialog</class>
|
<class>CFileSyncDialog</class>
|
||||||
<widget class="QDialog" name="CFileSyncDialog">
|
<widget class="QDialog" name="CFileSyncDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>497</width>
|
<width>497</width>
|
||||||
<height>325</height>
|
<height>325</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>文件同步</string>
|
<string>文件同步</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QComboBox" name="m_filePathComb">
|
<widget class="QComboBox" name="m_filePathComb">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QPushButton" name="m_selectFileBtn">
|
<widget class="QPushButton" name="m_selectFileBtn">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>30</width>
|
<width>30</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>30</width>
|
<width>30</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resource.qrc">
|
<iconset resource="resource.qrc">
|
||||||
<normaloff>:/icon/open.png</normaloff>:/icon/open.png</iconset>
|
<normaloff>:/icon/open.png</normaloff>:/icon/open.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QPushButton" name="m_reloadBtn">
|
<widget class="QPushButton" name="m_reloadBtn">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>30</width>
|
<width>30</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>30</width>
|
<width>30</width>
|
||||||
<height>30</height>
|
<height>30</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resource.qrc">
|
<iconset resource="resource.qrc">
|
||||||
<normaloff>:/icon/reload.png</normaloff>:/icon/reload.png</iconset>
|
<normaloff>:/icon/reload.png</normaloff>:/icon/reload.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="3">
|
<item row="1" column="0" colspan="3">
|
||||||
<widget class="QTableWidget" name="m_fileTextTable">
|
<widget class="QTableWidget" name="m_fileTextTable">
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="showGrid">
|
<property name="showGrid">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
<action name="m_actionCommit">
|
<action name="m_actionCommit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>提交</string>
|
<string>提交</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionDelete">
|
<action name="m_actionDelete">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>删除</string>
|
<string>删除</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionAdd">
|
<action name="m_actionAdd">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>添加</string>
|
<string>添加</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionAllCommit">
|
<action name="m_actionAllCommit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>提交</string>
|
<string>提交</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="resource.qrc"/>
|
<include location="resource.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -1,58 +1,58 @@
|
|||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#
|
#
|
||||||
# Project created by QtCreator 2019-04-25T14:51:57
|
# Project created by QtCreator 2019-04-25T14:51:57
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui
|
QT += core gui
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = fileSync
|
TARGET = fileSync
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
# depend on your compiler). Please consult the documentation of the
|
# depend on your compiler). Please consult the documentation of the
|
||||||
# deprecated API in order to know how to port your code away from it.
|
# deprecated API in order to know how to port your code away from it.
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
# You can also make your code fail to compile if you use deprecated APIs.
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
# In order to do so, uncomment the following line.
|
# 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.
|
# 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
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
DEFAULTCODEC = utf-8
|
DEFAULTCODEC = utf-8
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
CConfirmDialog.cpp \
|
CConfirmDialog.cpp \
|
||||||
CFileSyncDialog.cpp
|
CFileSyncDialog.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
CConfirmDialog.h \
|
CConfirmDialog.h \
|
||||||
CFileSyncDialog.h
|
CFileSyncDialog.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
CFileSyncDialog.ui \
|
CFileSyncDialog.ui \
|
||||||
CConfirmDialog.ui
|
CConfirmDialog.ui
|
||||||
|
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resource.qrc
|
resource.qrc
|
||||||
|
|
||||||
win32{
|
win32{
|
||||||
DEFINES += DLL_OUT
|
DEFINES += DLL_OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBS += \
|
LIBS += \
|
||||||
-lsys_svn_file_sync_api \
|
-lsys_svn_file_sync_api \
|
||||||
-lpub_utility_api
|
-lpub_utility_api
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
COMMON_PRI=$$PWD/../../../common.pri
|
COMMON_PRI=$$PWD/../../../common.pri
|
||||||
exists($$COMMON_PRI) {
|
exists($$COMMON_PRI) {
|
||||||
include($$COMMON_PRI)
|
include($$COMMON_PRI)
|
||||||
}else {
|
}else {
|
||||||
error("FATAL error: can not find common.pri")
|
error("FATAL error: can not find common.pri")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,260 +1,260 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!DOCTYPE TS>
|
<!DOCTYPE TS>
|
||||||
<TS version="2.1" language="en_US">
|
<TS version="2.1" language="en_US">
|
||||||
<context>
|
<context>
|
||||||
<name>CConfirmDialog</name>
|
<name>CConfirmDialog</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.ui" line="14"/>
|
<location filename="CConfirmDialog.ui" line="14"/>
|
||||||
<source>提交</source>
|
<source>提交</source>
|
||||||
<translation>Commit</translation>
|
<translation>Commit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.ui" line="56"/>
|
<location filename="CConfirmDialog.ui" line="56"/>
|
||||||
<source>日志信息:</source>
|
<source>日志信息:</source>
|
||||||
<translation>Log Infomation :</translation>
|
<translation>Log Infomation :</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.ui" line="145"/>
|
<location filename="CConfirmDialog.ui" line="145"/>
|
||||||
<source>确认</source>
|
<source>确认</source>
|
||||||
<translation>Confirm</translation>
|
<translation>Confirm</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.ui" line="152"/>
|
<location filename="CConfirmDialog.ui" line="152"/>
|
||||||
<source>取消</source>
|
<source>取消</source>
|
||||||
<translation>Cancel</translation>
|
<translation>Cancel</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="54"/>
|
<location filename="CConfirmDialog.cpp" line="54"/>
|
||||||
<location filename="CConfirmDialog.cpp" line="124"/>
|
<location filename="CConfirmDialog.cpp" line="124"/>
|
||||||
<source>无修改</source>
|
<source>无修改</source>
|
||||||
<translation>Normal</translation>
|
<translation>Normal</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="59"/>
|
<location filename="CConfirmDialog.cpp" line="59"/>
|
||||||
<source>添加</source>
|
<source>添加</source>
|
||||||
<translation>Add</translation>
|
<translation>Add</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="64"/>
|
<location filename="CConfirmDialog.cpp" line="64"/>
|
||||||
<location filename="CConfirmDialog.cpp" line="129"/>
|
<location filename="CConfirmDialog.cpp" line="129"/>
|
||||||
<source>冲突</source>
|
<source>冲突</source>
|
||||||
<translation>Conflict</translation>
|
<translation>Conflict</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="69"/>
|
<location filename="CConfirmDialog.cpp" line="69"/>
|
||||||
<source>删除</source>
|
<source>删除</source>
|
||||||
<translation>Delete</translation>
|
<translation>Delete</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="74"/>
|
<location filename="CConfirmDialog.cpp" line="74"/>
|
||||||
<source>忽略</source>
|
<source>忽略</source>
|
||||||
<translation>Ignore</translation>
|
<translation>Ignore</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="79"/>
|
<location filename="CConfirmDialog.cpp" line="79"/>
|
||||||
<source>修改</source>
|
<source>修改</source>
|
||||||
<translation>Modified</translation>
|
<translation>Modified</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="84"/>
|
<location filename="CConfirmDialog.cpp" line="84"/>
|
||||||
<source>替换</source>
|
<source>替换</source>
|
||||||
<translation>Replace</translation>
|
<translation>Replace</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="89"/>
|
<location filename="CConfirmDialog.cpp" line="89"/>
|
||||||
<source>未纳入版本控制的目录,被外部引用的目录所创建</source>
|
<source>未纳入版本控制的目录,被外部引用的目录所创建</source>
|
||||||
<translation>Externals-Define</translation>
|
<translation>Externals-Define</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="94"/>
|
<location filename="CConfirmDialog.cpp" line="94"/>
|
||||||
<source>未纳入版本控制</source>
|
<source>未纳入版本控制</source>
|
||||||
<translation>Non-Versioned</translation>
|
<translation>Non-Versioned</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="99"/>
|
<location filename="CConfirmDialog.cpp" line="99"/>
|
||||||
<source>遗失</source>
|
<source>遗失</source>
|
||||||
<translation>Missing</translation>
|
<translation>Missing</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="104"/>
|
<location filename="CConfirmDialog.cpp" line="104"/>
|
||||||
<source>重名</source>
|
<source>重名</source>
|
||||||
<translation>Same Name</translation>
|
<translation>Same Name</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="109"/>
|
<location filename="CConfirmDialog.cpp" line="109"/>
|
||||||
<location filename="CConfirmDialog.cpp" line="139"/>
|
<location filename="CConfirmDialog.cpp" line="139"/>
|
||||||
<location filename="CConfirmDialog.cpp" line="164"/>
|
<location filename="CConfirmDialog.cpp" line="164"/>
|
||||||
<location filename="CConfirmDialog.cpp" line="189"/>
|
<location filename="CConfirmDialog.cpp" line="189"/>
|
||||||
<location filename="CConfirmDialog.cpp" line="219"/>
|
<location filename="CConfirmDialog.cpp" line="219"/>
|
||||||
<location filename="CConfirmDialog.cpp" line="244"/>
|
<location filename="CConfirmDialog.cpp" line="244"/>
|
||||||
<location filename="CConfirmDialog.cpp" line="269"/>
|
<location filename="CConfirmDialog.cpp" line="269"/>
|
||||||
<source>自定义非法状态</source>
|
<source>自定义非法状态</source>
|
||||||
<translation>Illegal</translation>
|
<translation>Illegal</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="134"/>
|
<location filename="CConfirmDialog.cpp" line="134"/>
|
||||||
<source>改变</source>
|
<source>改变</source>
|
||||||
<translation>Modified</translation>
|
<translation>Modified</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="154"/>
|
<location filename="CConfirmDialog.cpp" line="154"/>
|
||||||
<source>未锁定</source>
|
<source>未锁定</source>
|
||||||
<translation>Not-Locked</translation>
|
<translation>Not-Locked</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="159"/>
|
<location filename="CConfirmDialog.cpp" line="159"/>
|
||||||
<source>锁定</source>
|
<source>锁定</source>
|
||||||
<translation>Locked</translation>
|
<translation>Locked</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="179"/>
|
<location filename="CConfirmDialog.cpp" line="179"/>
|
||||||
<source>没有历史</source>
|
<source>没有历史</source>
|
||||||
<translation>Not-History</translation>
|
<translation>Not-History</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="184"/>
|
<location filename="CConfirmDialog.cpp" line="184"/>
|
||||||
<source>包含历史</source>
|
<source>包含历史</source>
|
||||||
<translation>Contain-History</translation>
|
<translation>Contain-History</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="204"/>
|
<location filename="CConfirmDialog.cpp" line="204"/>
|
||||||
<location filename="CConfirmDialog.cpp" line="259"/>
|
<location filename="CConfirmDialog.cpp" line="259"/>
|
||||||
<source>正常</source>
|
<source>正常</source>
|
||||||
<translation>Normal</translation>
|
<translation>Normal</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="209"/>
|
<location filename="CConfirmDialog.cpp" line="209"/>
|
||||||
<source>以切换</source>
|
<source>以切换</source>
|
||||||
<translation>Switch</translation>
|
<translation>Switch</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="214"/>
|
<location filename="CConfirmDialog.cpp" line="214"/>
|
||||||
<source>被外部引用创建的文件</source>
|
<source>被外部引用创建的文件</source>
|
||||||
<translation>External Refer Created</translation>
|
<translation>External Refer Created</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="234"/>
|
<location filename="CConfirmDialog.cpp" line="234"/>
|
||||||
<source>没有被锁定标记</source>
|
<source>没有被锁定标记</source>
|
||||||
<translation>Not-Locked</translation>
|
<translation>Not-Locked</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="239"/>
|
<location filename="CConfirmDialog.cpp" line="239"/>
|
||||||
<source>存在锁定标记</source>
|
<source>存在锁定标记</source>
|
||||||
<translation>Locked</translation>
|
<translation>Locked</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="264"/>
|
<location filename="CConfirmDialog.cpp" line="264"/>
|
||||||
<source>树冲突</source>
|
<source>树冲突</source>
|
||||||
<translation>Tree Conflict</translation>
|
<translation>Tree Conflict</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="281"/>
|
<location filename="CConfirmDialog.cpp" line="281"/>
|
||||||
<source>名称</source>
|
<source>名称</source>
|
||||||
<translation>Name</translation>
|
<translation>Name</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CConfirmDialog.cpp" line="281"/>
|
<location filename="CConfirmDialog.cpp" line="281"/>
|
||||||
<source>状态</source>
|
<source>状态</source>
|
||||||
<translation>State</translation>
|
<translation>State</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CFileSyncDialog</name>
|
<name>CFileSyncDialog</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.ui" line="14"/>
|
<location filename="CFileSyncDialog.ui" line="14"/>
|
||||||
<source>文件同步</source>
|
<source>文件同步</source>
|
||||||
<translation>FileSync</translation>
|
<translation>FileSync</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.ui" line="101"/>
|
<location filename="CFileSyncDialog.ui" line="101"/>
|
||||||
<location filename="CFileSyncDialog.ui" line="116"/>
|
<location filename="CFileSyncDialog.ui" line="116"/>
|
||||||
<source>提交</source>
|
<source>提交</source>
|
||||||
<translation>Commit</translation>
|
<translation>Commit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.ui" line="106"/>
|
<location filename="CFileSyncDialog.ui" line="106"/>
|
||||||
<source>删除</source>
|
<source>删除</source>
|
||||||
<translation>Delete</translation>
|
<translation>Delete</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.ui" line="111"/>
|
<location filename="CFileSyncDialog.ui" line="111"/>
|
||||||
<source>添加</source>
|
<source>添加</source>
|
||||||
<translation>Add</translation>
|
<translation>Add</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="116"/>
|
<location filename="CFileSyncDialog.cpp" line="116"/>
|
||||||
<location filename="CFileSyncDialog.cpp" line="131"/>
|
<location filename="CFileSyncDialog.cpp" line="131"/>
|
||||||
<location filename="CFileSyncDialog.cpp" line="162"/>
|
<location filename="CFileSyncDialog.cpp" line="162"/>
|
||||||
<location filename="CFileSyncDialog.cpp" line="177"/>
|
<location filename="CFileSyncDialog.cpp" line="177"/>
|
||||||
<location filename="CFileSyncDialog.cpp" line="521"/>
|
<location filename="CFileSyncDialog.cpp" line="521"/>
|
||||||
<location filename="CFileSyncDialog.cpp" line="538"/>
|
<location filename="CFileSyncDialog.cpp" line="538"/>
|
||||||
<source>提示</source>
|
<source>提示</source>
|
||||||
<translation>Prompt</translation>
|
<translation>Prompt</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="116"/>
|
<location filename="CFileSyncDialog.cpp" line="116"/>
|
||||||
<source>无需添加</source>
|
<source>无需添加</source>
|
||||||
<translation>Don't need to add</translation>
|
<translation>Don't need to add</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="125"/>
|
<location filename="CFileSyncDialog.cpp" line="125"/>
|
||||||
<source>确认添加</source>
|
<source>确认添加</source>
|
||||||
<translation>Add Confirm</translation>
|
<translation>Add Confirm</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="131"/>
|
<location filename="CFileSyncDialog.cpp" line="131"/>
|
||||||
<source>添加失败: </source>
|
<source>添加失败: </source>
|
||||||
<translation>Add Failure: </translation>
|
<translation>Add Failure: </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="162"/>
|
<location filename="CFileSyncDialog.cpp" line="162"/>
|
||||||
<source>无需删除</source>
|
<source>无需删除</source>
|
||||||
<translation>Don't need to delete</translation>
|
<translation>Don't need to delete</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="171"/>
|
<location filename="CFileSyncDialog.cpp" line="171"/>
|
||||||
<source>确认删除</source>
|
<source>确认删除</source>
|
||||||
<translation>Delete Confirm</translation>
|
<translation>Delete Confirm</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="177"/>
|
<location filename="CFileSyncDialog.cpp" line="177"/>
|
||||||
<source>删除失败: </source>
|
<source>删除失败: </source>
|
||||||
<translation>Delete Failure: </translation>
|
<translation>Delete Failure: </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="209"/>
|
<location filename="CFileSyncDialog.cpp" line="209"/>
|
||||||
<source>选择文件</source>
|
<source>选择文件</source>
|
||||||
<translation>Select File</translation>
|
<translation>Select File</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="249"/>
|
<location filename="CFileSyncDialog.cpp" line="249"/>
|
||||||
<source>名称</source>
|
<source>名称</source>
|
||||||
<translation>Name</translation>
|
<translation>Name</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="249"/>
|
<location filename="CFileSyncDialog.cpp" line="249"/>
|
||||||
<source>修改日期</source>
|
<source>修改日期</source>
|
||||||
<translation>Modification Date</translation>
|
<translation>Modification Date</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="249"/>
|
<location filename="CFileSyncDialog.cpp" line="249"/>
|
||||||
<source>状态</source>
|
<source>状态</source>
|
||||||
<translation>State</translation>
|
<translation>State</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="383"/>
|
<location filename="CFileSyncDialog.cpp" line="383"/>
|
||||||
<source> (异常) </source>
|
<source> (异常) </source>
|
||||||
<translation> (abnormal) </translation>
|
<translation> (abnormal) </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="521"/>
|
<location filename="CFileSyncDialog.cpp" line="521"/>
|
||||||
<source>无需提交</source>
|
<source>无需提交</source>
|
||||||
<translation>Don't need to commit</translation>
|
<translation>Don't need to commit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="CFileSyncDialog.cpp" line="538"/>
|
<location filename="CFileSyncDialog.cpp" line="538"/>
|
||||||
<source>提交失败: </source>
|
<source>提交失败: </source>
|
||||||
<translation>Commit Failure: </translation>
|
<translation>Commit Failure: </translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include "common/QtAppGlobalSet.h"
|
#include "common/QtAppGlobalSet.h"
|
||||||
#include "CFileSyncDialog.h"
|
#include "CFileSyncDialog.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
kbd_common::doQtAppGlobalSet();
|
kbd_common::doQtAppGlobalSet();
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
CFileSyncDialog w;
|
CFileSyncDialog w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>icon/AddedIcon.ico</file>
|
<file>icon/AddedIcon.ico</file>
|
||||||
<file>icon/ConflictIcon.ico</file>
|
<file>icon/ConflictIcon.ico</file>
|
||||||
<file>icon/DeletedIcon.ico</file>
|
<file>icon/DeletedIcon.ico</file>
|
||||||
<file>icon/IgnoredIcon.ico</file>
|
<file>icon/IgnoredIcon.ico</file>
|
||||||
<file>icon/LockedIcon.ico</file>
|
<file>icon/LockedIcon.ico</file>
|
||||||
<file>icon/ModifiedIcon.ico</file>
|
<file>icon/ModifiedIcon.ico</file>
|
||||||
<file>icon/NormalIcon.ico</file>
|
<file>icon/NormalIcon.ico</file>
|
||||||
<file>icon/ReadOnlyIcon.ico</file>
|
<file>icon/ReadOnlyIcon.ico</file>
|
||||||
<file>icon/UnversionedIcon.ico</file>
|
<file>icon/UnversionedIcon.ico</file>
|
||||||
<file>icon/open.png</file>
|
<file>icon/open.png</file>
|
||||||
<file>icon/reload.png</file>
|
<file>icon/reload.png</file>
|
||||||
<file>fileSync_en.qm</file>
|
<file>fileSync_en.qm</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
#各子工程按书写顺序编译,清注意各子工程的依赖关系,被依赖的库应写在前面。
|
#各子工程按书写顺序编译,清注意各子工程的依赖关系,被依赖的库应写在前面。
|
||||||
|
|
||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
CONFIG += ordered
|
CONFIG += ordered
|
||||||
|
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
GraphTool \
|
GraphTool \
|
||||||
plugin
|
plugin
|
||||||
|
|
||||||
|
|||||||
@ -1,84 +1,84 @@
|
|||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#
|
#
|
||||||
# Project created by QtCreator 2019-11-05T10:04:14
|
# Project created by QtCreator 2019-11-05T10:04:14
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui charts sql
|
QT += core gui charts sql
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = AlarmAnalyzeWidget
|
TARGET = AlarmAnalyzeWidget
|
||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
CONFIG += plugin
|
CONFIG += plugin
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
# depend on your compiler). Please consult the documentation of the
|
# depend on your compiler). Please consult the documentation of the
|
||||||
# deprecated API in order to know how to port your code away from it.
|
# deprecated API in order to know how to port your code away from it.
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
# You can also make your code fail to compile if you use deprecated APIs.
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
# In order to do so, uncomment the following line.
|
# 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.
|
# 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
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
CAlarmStatistics.cpp \
|
CAlarmStatistics.cpp \
|
||||||
CAlarmModel.cpp \
|
CAlarmModel.cpp \
|
||||||
CAlarmCompare.cpp \
|
CAlarmCompare.cpp \
|
||||||
CProcessDialog.cpp \
|
CProcessDialog.cpp \
|
||||||
CCompareQueryThread.cpp \
|
CCompareQueryThread.cpp \
|
||||||
CommonFunction.cpp \
|
CommonFunction.cpp \
|
||||||
CStatisticsQueryThread.cpp \
|
CStatisticsQueryThread.cpp \
|
||||||
CWaveListDialog.cpp \
|
CWaveListDialog.cpp \
|
||||||
CAlarmStatisticsPluginWidget.cpp \
|
CAlarmStatisticsPluginWidget.cpp \
|
||||||
CAlarmReport.cpp \
|
CAlarmReport.cpp \
|
||||||
CTableWidget.cpp
|
CTableWidget.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
CAlarmStatistics.h \
|
CAlarmStatistics.h \
|
||||||
CAlarmModel.h \
|
CAlarmModel.h \
|
||||||
SAlarmInfo.h \
|
SAlarmInfo.h \
|
||||||
SAlarmList.h \
|
SAlarmList.h \
|
||||||
CAlarmLevelComboBox.h \
|
CAlarmLevelComboBox.h \
|
||||||
SAlarmLevel.h \
|
SAlarmLevel.h \
|
||||||
CAlarmCompare.h \
|
CAlarmCompare.h \
|
||||||
CProcessDialog.h \
|
CProcessDialog.h \
|
||||||
CCompareQueryThread.h \
|
CCompareQueryThread.h \
|
||||||
CommonDefine.h \
|
CommonDefine.h \
|
||||||
CommonFunction.h \
|
CommonFunction.h \
|
||||||
CStatisticsQueryThread.h \
|
CStatisticsQueryThread.h \
|
||||||
SDeviceGroup.h \
|
SDeviceGroup.h \
|
||||||
SLocation.h \
|
SLocation.h \
|
||||||
CWaveListDialog.h \
|
CWaveListDialog.h \
|
||||||
CAlarmStatisticsPluginWidget.h \
|
CAlarmStatisticsPluginWidget.h \
|
||||||
CAlarmReport.h \
|
CAlarmReport.h \
|
||||||
CTableWidget.h
|
CTableWidget.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
CAlarmStatistics.ui \
|
CAlarmStatistics.ui \
|
||||||
CAlarmCompare.ui \
|
CAlarmCompare.ui \
|
||||||
CProcessDialog.ui \
|
CProcessDialog.ui \
|
||||||
CWaveListDialog.ui \
|
CWaveListDialog.ui \
|
||||||
CAlarmReport.ui
|
CAlarmReport.ui
|
||||||
|
|
||||||
LIBS += -llog4cplus \
|
LIBS += -llog4cplus \
|
||||||
-lpub_logger_api \
|
-lpub_logger_api \
|
||||||
-ldb_base_api \
|
-ldb_base_api \
|
||||||
-ldb_api_ex \
|
-ldb_api_ex \
|
||||||
-lboost_system \
|
-lboost_system \
|
||||||
-lboost_thread \
|
-lboost_thread \
|
||||||
-ldb_sysinfo_api \
|
-ldb_sysinfo_api \
|
||||||
-lpub_utility_api \
|
-lpub_utility_api \
|
||||||
-lmodel_excel \
|
-lmodel_excel \
|
||||||
|
|
||||||
COMMON_PRI=$$PWD/../../../common.pri
|
COMMON_PRI=$$PWD/../../../common.pri
|
||||||
exists($$COMMON_PRI) {
|
exists($$COMMON_PRI) {
|
||||||
include($$COMMON_PRI)
|
include($$COMMON_PRI)
|
||||||
}else {
|
}else {
|
||||||
error("FATAL error: can not find common.pri")
|
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
|
#ifndef CALARMCOMPARE_H
|
||||||
#define CALARMCOMPARE_H
|
#define CALARMCOMPARE_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QCalendarWidget>
|
#include <QCalendarWidget>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QtCharts/QChart>
|
#include <QtCharts/QChart>
|
||||||
#include <QtCharts/QChartView>
|
#include <QtCharts/QChartView>
|
||||||
#include <QtCharts/QStackedBarSeries>
|
#include <QtCharts/QStackedBarSeries>
|
||||||
#include <QtCharts/QBarSet>
|
#include <QtCharts/QBarSet>
|
||||||
#include <QtCharts/QLegend>
|
#include <QtCharts/QLegend>
|
||||||
#include <QtCharts/QBarCategoryAxis>
|
#include <QtCharts/QBarCategoryAxis>
|
||||||
#include <QtCharts/QBarSeries>
|
#include <QtCharts/QBarSeries>
|
||||||
#include "CAlarmModel.h"
|
#include "CAlarmModel.h"
|
||||||
#include "CAlarmLevelComboBox.h"
|
#include "CAlarmLevelComboBox.h"
|
||||||
#include "SAlarmLevel.h"
|
#include "SAlarmLevel.h"
|
||||||
#include "CProcessDialog.h"
|
#include "CProcessDialog.h"
|
||||||
#include "CCompareQueryThread.h"
|
#include "CCompareQueryThread.h"
|
||||||
#include "CommonDefine.h"
|
#include "CommonDefine.h"
|
||||||
#include "CommonFunction.h"
|
#include "CommonFunction.h"
|
||||||
|
|
||||||
QT_CHARTS_USE_NAMESPACE
|
QT_CHARTS_USE_NAMESPACE
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CAlarmCompare;
|
class CAlarmCompare;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CAlarmCompare : public QWidget
|
class CAlarmCompare : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QColor chartBackground READ chartBackground WRITE setChartBackground)
|
Q_PROPERTY(QColor chartBackground READ chartBackground WRITE setChartBackground)
|
||||||
Q_PROPERTY(QColor chartLabelColor READ chartLabelColor WRITE setChartLabelColor)
|
Q_PROPERTY(QColor chartLabelColor READ chartLabelColor WRITE setChartLabelColor)
|
||||||
Q_PROPERTY(QColor chartLineColor READ chartLineColor WRITE setChartLineColor)
|
Q_PROPERTY(QColor chartLineColor READ chartLineColor WRITE setChartLineColor)
|
||||||
public:
|
public:
|
||||||
explicit CAlarmCompare(QWidget *parent = 0);
|
explicit CAlarmCompare(QWidget *parent = 0);
|
||||||
~CAlarmCompare();
|
~CAlarmCompare();
|
||||||
|
|
||||||
void setHiddenOptColumn(bool hide);
|
void setHiddenOptColumn(bool hide);
|
||||||
public:
|
public:
|
||||||
void initVariate();
|
void initVariate();
|
||||||
void initUi();
|
void initUi();
|
||||||
void initBar();
|
void initBar();
|
||||||
void resetUi();
|
void resetUi();
|
||||||
void showBar();
|
void showBar();
|
||||||
void initLevelChoose();
|
void initLevelChoose();
|
||||||
void setCurrentLocationIndex( int nIndex );
|
void setCurrentLocationIndex( int nIndex );
|
||||||
|
|
||||||
QColor chartBackground();
|
QColor chartBackground();
|
||||||
void setChartBackground(const QColor& color);
|
void setChartBackground(const QColor& color);
|
||||||
|
|
||||||
QColor chartLabelColor();
|
QColor chartLabelColor();
|
||||||
void setChartLabelColor(const QColor& color);
|
void setChartLabelColor(const QColor& color);
|
||||||
|
|
||||||
QColor chartLineColor();
|
QColor chartLineColor();
|
||||||
void setChartLineColor(const QColor& color);
|
void setChartLineColor(const QColor& color);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotQueryEnd();
|
void slotQueryEnd();
|
||||||
void slotCheckBoxStateChanged( int );
|
void slotCheckBoxStateChanged( int );
|
||||||
void slotPushButtonQueryClicked( bool bChecked = false );
|
void slotPushButtonQueryClicked( bool bChecked = false );
|
||||||
void slotBarMouseMoveHovered( bool bStatus, int nIndex, QBarSet* pBarset );
|
void slotBarMouseMoveHovered( bool bStatus, int nIndex, QBarSet* pBarset );
|
||||||
void slotBarClicked( int nIndex, QBarSet* pBarset );
|
void slotBarClicked( int nIndex, QBarSet* pBarset );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent( QResizeEvent* pEvent );
|
void resizeEvent( QResizeEvent* pEvent );
|
||||||
void paintEvent( QPaintEvent * pEvent);
|
void paintEvent( QPaintEvent * pEvent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CAlarmCompare *ui;
|
Ui::CAlarmCompare *ui;
|
||||||
QChart *m_pChart;// 柱状图
|
QChart *m_pChart;// 柱状图
|
||||||
QLabel* m_pLabelValue;// 鼠标移动到柱状图上显示的提示窗口
|
QLabel* m_pLabelValue;// 鼠标移动到柱状图上显示的提示窗口
|
||||||
bool m_bAfterMsgBox;// 是否是在弹出告警条数过多之后第一次进入显示提示窗口的函数
|
bool m_bAfterMsgBox;// 是否是在弹出告警条数过多之后第一次进入显示提示窗口的函数
|
||||||
QList<QList<QBarSet*> > m_listBarSet;
|
QList<QList<QBarSet*> > m_listBarSet;
|
||||||
CAlarmLevelComboBox* m_pAlarmLevelComboBox;// 告警级别选择的下拉框
|
CAlarmLevelComboBox* m_pAlarmLevelComboBox;// 告警级别选择的下拉框
|
||||||
QList<QCheckBox*> m_listAlarmLevelCheckBox;// 柱状图告警等级选择的复选框集合
|
QList<QCheckBox*> m_listAlarmLevelCheckBox;// 柱状图告警等级选择的复选框集合
|
||||||
CProcessDialog* m_pProcessDialog;// 等待窗口
|
CProcessDialog* m_pProcessDialog;// 等待窗口
|
||||||
CCompareQueryThread* m_pQueryThread;// 查询线程
|
CCompareQueryThread* m_pQueryThread;// 查询线程
|
||||||
int m_nCurrentLocationIndex;// 当前站序号,0表示全部站,其余表示第几个
|
int m_nCurrentLocationIndex;// 当前站序号,0表示全部站,其余表示第几个
|
||||||
QList<QCheckBox*> m_listCheckBoxLocation;// stackwidget page0 站列表
|
QList<QCheckBox*> m_listCheckBoxLocation;// stackwidget page0 站列表
|
||||||
QList<QCheckBox*> m_listCheckBoxDeviceGroup;// stackwidget page1 设备组列表
|
QList<QCheckBox*> m_listCheckBoxDeviceGroup;// stackwidget page1 设备组列表
|
||||||
|
|
||||||
QColor m_chartBackground;
|
QColor m_chartBackground;
|
||||||
QColor m_chartLabelColor;
|
QColor m_chartLabelColor;
|
||||||
QColor m_chartLineColor;
|
QColor m_chartLineColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CALARMCOMPARE_H
|
#endif // CALARMCOMPARE_H
|
||||||
|
|||||||
@ -1,450 +1,450 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CAlarmCompare</class>
|
<class>CAlarmCompare</class>
|
||||||
<widget class="QWidget" name="CAlarmCompare">
|
<widget class="QWidget" name="CAlarmCompare">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1080</width>
|
<width>1080</width>
|
||||||
<height>654</height>
|
<height>654</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>告警等级</string>
|
<string>告警等级</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_level">
|
<widget class="QComboBox" name="comboBox_level">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string> 统计类型</string>
|
<string> 统计类型</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rb_day">
|
<widget class="QRadioButton" name="rb_day">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>日</string>
|
<string>日</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<attribute name="buttonGroup">
|
||||||
<string notr="true">buttonGroup</string>
|
<string notr="true">buttonGroup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rb_month">
|
<widget class="QRadioButton" name="rb_month">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>月</string>
|
<string>月</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<attribute name="buttonGroup">
|
||||||
<string notr="true">buttonGroup</string>
|
<string notr="true">buttonGroup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string> 时间段</string>
|
<string> 时间段</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDateEdit" name="dateEdit_start">
|
<widget class="QDateEdit" name="dateEdit_start">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="displayFormat">
|
<property name="displayFormat">
|
||||||
<string>yyyy-MM-dd</string>
|
<string>yyyy-MM-dd</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="calendarPopup">
|
<property name="calendarPopup">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>-</string>
|
<string>-</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDateEdit" name="dateEdit_end">
|
<widget class="QDateEdit" name="dateEdit_end">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="displayFormat">
|
<property name="displayFormat">
|
||||||
<string>yyyy-MM-dd</string>
|
<string>yyyy-MM-dd</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="calendarPopup">
|
<property name="calendarPopup">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_keyWord">
|
<widget class="QLineEdit" name="lineEdit_keyWord">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="inputMask">
|
<property name="inputMask">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>告警内容关键字</string>
|
<string>告警内容关键字</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pb_query">
|
<widget class="QPushButton" name="pb_query">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>查询</string>
|
<string>查询</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter_2">
|
<widget class="QSplitter" name="splitter_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="frame_location">
|
<widget class="QFrame" name="frame_location">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_2">
|
<widget class="QWidget" name="page_2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolBox" name="toolBox">
|
<widget class="QToolBox" name="toolBox">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="tabSpacing">
|
<property name="tabSpacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="widget">
|
<widget class="QWidget" name="widget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>98</width>
|
<width>98</width>
|
||||||
<height>28</height>
|
<height>28</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
<string/>
|
<string/>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QSplitter" name="splitter">
|
<widget class="QSplitter" name="splitter">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QFrame" name="frame_bar">
|
<widget class="QFrame" name="frame_bar">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::Box</enum>
|
<enum>QFrame::Box</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QFrame" name="frame_alarm">
|
<widget class="QFrame" name="frame_alarm">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_name">
|
<widget class="QLabel" name="label_name">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="CTableView" name="tableView_alarm">
|
<widget class="CTableView" name="tableView_alarm">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>11</string>
|
<string>11</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="statusTip">
|
<property name="statusTip">
|
||||||
<string>22</string>
|
<string>22</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string>33</string>
|
<string>33</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>CTableView</class>
|
<class>CTableView</class>
|
||||||
<extends>QTableView</extends>
|
<extends>QTableView</extends>
|
||||||
<header>CTableWidget.h</header>
|
<header>CTableWidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
<buttongroup name="buttonGroup"/>
|
<buttongroup name="buttonGroup"/>
|
||||||
</buttongroups>
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -1,80 +1,80 @@
|
|||||||
#ifndef CALARMLEVELCOMBOBOX_H
|
#ifndef CALARMLEVELCOMBOBOX_H
|
||||||
#define CALARMLEVELCOMBOBOX_H
|
#define CALARMLEVELCOMBOBOX_H
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QAbstractItemView>
|
#include <QAbstractItemView>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "SAlarmLevel.h"
|
#include "SAlarmLevel.h"
|
||||||
|
|
||||||
class CAlarmLevelComboBox : public QListWidget
|
class CAlarmLevelComboBox : public QListWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAlarmLevelComboBox( QComboBox* pComboBox )
|
CAlarmLevelComboBox( QComboBox* pComboBox )
|
||||||
{
|
{
|
||||||
setViewMode( QListWidget::ListMode );
|
setViewMode( QListWidget::ListMode );
|
||||||
setSelectionMode( QAbstractItemView::SingleSelection );
|
setSelectionMode( QAbstractItemView::SingleSelection );
|
||||||
QLineEdit *pLineEdit = new QLineEdit;
|
QLineEdit *pLineEdit = new QLineEdit;
|
||||||
pLineEdit->setReadOnly( true );
|
pLineEdit->setReadOnly( true );
|
||||||
m_pCombobox = pComboBox;
|
m_pCombobox = pComboBox;
|
||||||
m_pCombobox->setLineEdit( pLineEdit );
|
m_pCombobox->setLineEdit( pLineEdit );
|
||||||
m_pCombobox->setModel( model() );
|
m_pCombobox->setModel( model() );
|
||||||
m_pCombobox->setView( this );
|
m_pCombobox->setView( this );
|
||||||
m_pCombobox->setEditable( true );
|
m_pCombobox->setEditable( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void init( QList<SAlarmLevel*> listAlarmLevel )
|
void init( QList<SAlarmLevel*> listAlarmLevel )
|
||||||
{
|
{
|
||||||
for ( int i=0; i<listAlarmLevel.count(); i++ )
|
for ( int i=0; i<listAlarmLevel.count(); i++ )
|
||||||
{
|
{
|
||||||
m_listData.append( listAlarmLevel.at(i)->nId );
|
m_listData.append( listAlarmLevel.at(i)->nId );
|
||||||
QListWidgetItem *item = new QListWidgetItem();
|
QListWidgetItem *item = new QListWidgetItem();
|
||||||
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsUserCheckable |Qt::ItemIsEnabled);
|
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsUserCheckable |Qt::ItemIsEnabled);
|
||||||
insertItem( model()->rowCount(), item );
|
insertItem( model()->rowCount(), item );
|
||||||
QCheckBox* pCheckBox = new QCheckBox( listAlarmLevel.at(i)->sName );
|
QCheckBox* pCheckBox = new QCheckBox( listAlarmLevel.at(i)->sName );
|
||||||
setItemWidget( item, pCheckBox );
|
setItemWidget( item, pCheckBox );
|
||||||
m_listCheckBox.append( pCheckBox );
|
m_listCheckBox.append( pCheckBox );
|
||||||
pCheckBox->setChecked( false );
|
pCheckBox->setChecked( false );
|
||||||
connect( pCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSelectItem(int)) );
|
connect( pCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setSelectItem(int)) );
|
||||||
pCheckBox->setChecked( true );
|
pCheckBox->setChecked( true );
|
||||||
}
|
}
|
||||||
connect( m_pCombobox, SIGNAL(activated(int)), this, SLOT(setSelectItem(int)) );
|
connect( m_pCombobox, SIGNAL(activated(int)), this, SLOT(setSelectItem(int)) );
|
||||||
}
|
}
|
||||||
void getSelectData( QList<int>& data )
|
void getSelectData( QList<int>& data )
|
||||||
{
|
{
|
||||||
for( int i=0; i<m_listCheckBox.size(); i++)
|
for( int i=0; i<m_listCheckBox.size(); i++)
|
||||||
{
|
{
|
||||||
if( m_listCheckBox.at(i)->isChecked() )
|
if( m_listCheckBox.at(i)->isChecked() )
|
||||||
data.append( m_listData.at(i) );
|
data.append( m_listData.at(i) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//QCheckBox复选消息处理
|
//QCheckBox复选消息处理
|
||||||
void setSelectItem( int )
|
void setSelectItem( int )
|
||||||
{
|
{
|
||||||
QString sName;
|
QString sName;
|
||||||
for( int i=0; i<m_listCheckBox.size(); i++)
|
for( int i=0; i<m_listCheckBox.size(); i++)
|
||||||
{
|
{
|
||||||
if( m_listCheckBox.at(i)->isChecked() )
|
if( m_listCheckBox.at(i)->isChecked() )
|
||||||
{
|
{
|
||||||
sName += m_listCheckBox.at(i)->text();
|
sName += m_listCheckBox.at(i)->text();
|
||||||
sName += ",";
|
sName += ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_pCombobox->setEditText( sName );
|
m_pCombobox->setEditText( sName );
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QComboBox* m_pCombobox;
|
QComboBox* m_pCombobox;
|
||||||
QList<QCheckBox*> m_listCheckBox;
|
QList<QCheckBox*> m_listCheckBox;
|
||||||
QList<int> m_listData;
|
QList<int> m_listData;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CALARMLEVELCOMBOBOX_H
|
#endif // CALARMLEVELCOMBOBOX_H
|
||||||
|
|||||||
@ -1,128 +1,128 @@
|
|||||||
#include "CAlarmModel.h"
|
#include "CAlarmModel.h"
|
||||||
|
|
||||||
CAlarmModel::CAlarmModel()
|
CAlarmModel::CAlarmModel()
|
||||||
{
|
{
|
||||||
m_listHeadText << tr("时间")
|
m_listHeadText << tr("时间")
|
||||||
<< tr("优先级")
|
<< tr("优先级")
|
||||||
<< tr("所属位置")
|
<< tr("所属位置")
|
||||||
<< tr("告警内容")
|
<< tr("告警内容")
|
||||||
<< tr("操作");
|
<< tr("操作");
|
||||||
}
|
}
|
||||||
|
|
||||||
CAlarmModel::~CAlarmModel()
|
CAlarmModel::~CAlarmModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAlarmModel::setHiddenOptColumn(bool hide)
|
void CAlarmModel::setHiddenOptColumn(bool hide)
|
||||||
{
|
{
|
||||||
if(hide)
|
if(hide)
|
||||||
{
|
{
|
||||||
m_listHeadText.pop_back();
|
m_listHeadText.pop_back();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_listHeadText.push_back(tr("操作"));
|
m_listHeadText.push_back(tr("操作"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CAlarmModel::headerData( int section, Qt::Orientation orientation, int role) const
|
QVariant CAlarmModel::headerData( int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
|
if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
|
||||||
{
|
{
|
||||||
return m_listHeadText.at(section);
|
return m_listHeadText.at(section);
|
||||||
}
|
}
|
||||||
return QAbstractTableModel::headerData(section,orientation,role);
|
return QAbstractTableModel::headerData(section,orientation,role);
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags CAlarmModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags CAlarmModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
|
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAlarmModel::rowCount( const QModelIndex& ) const
|
int CAlarmModel::rowCount( const QModelIndex& ) const
|
||||||
{
|
{
|
||||||
return m_listAlarm.count();
|
return m_listAlarm.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAlarmModel::columnCount( const QModelIndex& ) const
|
int CAlarmModel::columnCount( const QModelIndex& ) const
|
||||||
{
|
{
|
||||||
return m_listHeadText.count();
|
return m_listHeadText.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CAlarmModel::data( const QModelIndex &index, int role ) const
|
QVariant CAlarmModel::data( const QModelIndex &index, int role ) const
|
||||||
{
|
{
|
||||||
if ( !index.isValid() )//没有索引返回无效数据,不要直接返回0
|
if ( !index.isValid() )//没有索引返回无效数据,不要直接返回0
|
||||||
{
|
{
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( role == Qt::TextAlignmentRole )
|
if ( role == Qt::TextAlignmentRole )
|
||||||
{
|
{
|
||||||
return int(Qt::AlignHCenter | Qt::AlignVCenter);
|
return int(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
else if ( role == Qt::DisplayRole || role == Qt::EditRole )
|
else if ( role == Qt::DisplayRole || role == Qt::EditRole )
|
||||||
{
|
{
|
||||||
QVariant oVal;
|
QVariant oVal;
|
||||||
switch ( index.column() )
|
switch ( index.column() )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
oVal = m_listAlarm.at(index.row())->sTime;
|
oVal = m_listAlarm.at(index.row())->sTime;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
oVal = m_listAlarm.at(index.row())->sLevel;
|
oVal = m_listAlarm.at(index.row())->sLevel;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
oVal = m_listAlarm.at(index.row())->sLocation;
|
oVal = m_listAlarm.at(index.row())->sLocation;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
oVal = m_listAlarm.at(index.row())->sContent;
|
oVal = m_listAlarm.at(index.row())->sContent;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if ( m_listAlarm.at(index.row())->sKeyIdTag.startsWith("analog") )
|
if ( m_listAlarm.at(index.row())->sKeyIdTag.startsWith("analog") )
|
||||||
oVal = tr("趋势");
|
oVal = tr("趋势");
|
||||||
else if ( m_listAlarm.at(index.row())->sKeyIdTag.startsWith("digital") )
|
else if ( m_listAlarm.at(index.row())->sKeyIdTag.startsWith("digital") )
|
||||||
oVal = tr("录波");
|
oVal = tr("录波");
|
||||||
}
|
}
|
||||||
return oVal;
|
return oVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,41 +1,41 @@
|
|||||||
#ifndef CALARMMODEL_H
|
#ifndef CALARMMODEL_H
|
||||||
#define CALARMMODEL_H
|
#define CALARMMODEL_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QItemDelegate>
|
#include <QItemDelegate>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include "SAlarmInfo.h"
|
#include "SAlarmInfo.h"
|
||||||
#include "SAlarmList.h"
|
#include "SAlarmList.h"
|
||||||
|
|
||||||
class CAlarmModel : public QAbstractTableModel
|
class CAlarmModel : public QAbstractTableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAlarmModel();
|
CAlarmModel();
|
||||||
~CAlarmModel();
|
~CAlarmModel();
|
||||||
|
|
||||||
void setHiddenOptColumn(bool hide);
|
void setHiddenOptColumn(bool hide);
|
||||||
public:
|
public:
|
||||||
void beginReset(){ this->beginResetModel(); }
|
void beginReset(){ this->beginResetModel(); }
|
||||||
void endReset(){ this->endResetModel(); }
|
void endReset(){ this->endResetModel(); }
|
||||||
void setAlarmList( QList<SAlarmInfo*>& listAlarm ) { m_listAlarm = listAlarm; }
|
void setAlarmList( QList<SAlarmInfo*>& listAlarm ) { m_listAlarm = listAlarm; }
|
||||||
void clearAlarmList(){ m_listAlarm.clear(); }
|
void clearAlarmList(){ m_listAlarm.clear(); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
int rowCount( const QModelIndex &parent = QModelIndex() ) const;
|
int rowCount( const QModelIndex &parent = QModelIndex() ) const;
|
||||||
int columnCount( const QModelIndex &parent = QModelIndex() ) const;
|
int columnCount( const QModelIndex &parent = QModelIndex() ) const;
|
||||||
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
|
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QStringList m_listHeadText;
|
QStringList m_listHeadText;
|
||||||
QList<SAlarmInfo*> m_listAlarm;
|
QList<SAlarmInfo*> m_listAlarm;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CALARMMODEL_H
|
#endif // CALARMMODEL_H
|
||||||
|
|||||||
@ -1,183 +1,183 @@
|
|||||||
#include "CAlarmReport.h"
|
#include "CAlarmReport.h"
|
||||||
#include "ui_CAlarmReport.h"
|
#include "ui_CAlarmReport.h"
|
||||||
#include "CommonFunction.h"
|
#include "CommonFunction.h"
|
||||||
|
|
||||||
CAlarmReport::CAlarmReport(QWidget *parent) :
|
CAlarmReport::CAlarmReport(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::CAlarmReport)
|
ui(new Ui::CAlarmReport)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
this->setWindowFlags( ( this->windowFlags() & ~Qt::WindowMinimizeButtonHint ) | Qt::WindowStaysOnTopHint | Qt::Dialog );
|
this->setWindowFlags( ( this->windowFlags() & ~Qt::WindowMinimizeButtonHint ) | Qt::WindowStaysOnTopHint | Qt::Dialog );
|
||||||
this->setWindowTitle( "分析报告" );
|
this->setWindowTitle( "分析报告" );
|
||||||
ui->splitter->setStretchFactor( 0, 0 );
|
ui->splitter->setStretchFactor( 0, 0 );
|
||||||
ui->splitter->setStretchFactor( 1, 1 );
|
ui->splitter->setStretchFactor( 1, 1 );
|
||||||
ui->tableWidget->horizontalHeader()->setStretchLastSection( true );
|
ui->tableWidget->horizontalHeader()->setStretchLastSection( true );
|
||||||
ui->tableWidget->setEditTriggers( QAbstractItemView::NoEditTriggers );
|
ui->tableWidget->setEditTriggers( QAbstractItemView::NoEditTriggers );
|
||||||
ui->tableWidget->setSelectionBehavior( QAbstractItemView::SelectRows );
|
ui->tableWidget->setSelectionBehavior( QAbstractItemView::SelectRows );
|
||||||
ui->textEdit->setText( "报告内容: " );
|
ui->textEdit->setText( "报告内容: " );
|
||||||
ui->textEdit->setEnabled( false );
|
ui->textEdit->setEnabled( false );
|
||||||
|
|
||||||
connect( ui->pushButton_export, SIGNAL(clicked(bool)), this, SLOT(slotPushButtonExportClicked(bool)) );
|
connect( ui->pushButton_export, SIGNAL(clicked(bool)), this, SLOT(slotPushButtonExportClicked(bool)) );
|
||||||
|
|
||||||
loadConfig();
|
loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAlarmReport::~CAlarmReport()
|
CAlarmReport::~CAlarmReport()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAlarmReport::loadConfig()
|
void CAlarmReport::loadConfig()
|
||||||
{
|
{
|
||||||
QString sFileName = "alarm_statistics.ini";
|
QString sFileName = "alarm_statistics.ini";
|
||||||
if ( !QFile::exists(sFileName) )
|
if ( !QFile::exists(sFileName) )
|
||||||
{
|
{
|
||||||
m_nNormalAlarmCount = 1000;
|
m_nNormalAlarmCount = 1000;
|
||||||
m_nSmartAlarmCount = 1000;
|
m_nSmartAlarmCount = 1000;
|
||||||
QSettings oSettings( sFileName, QSettings::IniFormat, 0 );
|
QSettings oSettings( sFileName, QSettings::IniFormat, 0 );
|
||||||
oSettings.setValue( "AlarmReport/NormalAlarm", m_nNormalAlarmCount );
|
oSettings.setValue( "AlarmReport/NormalAlarm", m_nNormalAlarmCount );
|
||||||
oSettings.setValue( "AlarmReport/SmartAlarm", m_nSmartAlarmCount );
|
oSettings.setValue( "AlarmReport/SmartAlarm", m_nSmartAlarmCount );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QSettings oSettings( sFileName, QSettings::IniFormat, 0 );
|
QSettings oSettings( sFileName, QSettings::IniFormat, 0 );
|
||||||
m_nNormalAlarmCount = oSettings.value( "AlarmReport/NormalAlarm", 1000 ).toInt();
|
m_nNormalAlarmCount = oSettings.value( "AlarmReport/NormalAlarm", 1000 ).toInt();
|
||||||
m_nSmartAlarmCount = oSettings.value( "AlarmReport/SmartAlarm", 1000 ).toInt();
|
m_nSmartAlarmCount = oSettings.value( "AlarmReport/SmartAlarm", 1000 ).toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAlarmReport::initData( QTableWidget* pTableWidget )
|
void CAlarmReport::initData( QTableWidget* pTableWidget )
|
||||||
{
|
{
|
||||||
if ( pTableWidget == NULL )
|
if ( pTableWidget == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ui->tableWidget->clear();
|
ui->tableWidget->clear();
|
||||||
ui->tableWidget->setRowCount(0);
|
ui->tableWidget->setRowCount(0);
|
||||||
|
|
||||||
int nRowCount = pTableWidget->rowCount();
|
int nRowCount = pTableWidget->rowCount();
|
||||||
int nColCount = pTableWidget->horizontalHeader()->count();
|
int nColCount = pTableWidget->horizontalHeader()->count();
|
||||||
QStringList listHeader;
|
QStringList listHeader;
|
||||||
for ( int i=0; i<nColCount; i++ )
|
for ( int i=0; i<nColCount; i++ )
|
||||||
listHeader << pTableWidget->horizontalHeaderItem(i)->text();
|
listHeader << pTableWidget->horizontalHeaderItem(i)->text();
|
||||||
ui->tableWidget->setColumnCount( nColCount );
|
ui->tableWidget->setColumnCount( nColCount );
|
||||||
ui->tableWidget->setHorizontalHeaderLabels( listHeader );
|
ui->tableWidget->setHorizontalHeaderLabels( listHeader );
|
||||||
|
|
||||||
int nIndex = 1;
|
int nIndex = 1;
|
||||||
for ( int i=0; i<nRowCount; i++ )
|
for ( int i=0; i<nRowCount; i++ )
|
||||||
{
|
{
|
||||||
ui->tableWidget->insertRow( i );
|
ui->tableWidget->insertRow( i );
|
||||||
for ( int l=0; l<nColCount; l++ )
|
for ( int l=0; l<nColCount; l++ )
|
||||||
{
|
{
|
||||||
QTableWidgetItem* pItem = new QTableWidgetItem( pTableWidget->item(i,l)->text() );
|
QTableWidgetItem* pItem = new QTableWidgetItem( pTableWidget->item(i,l)->text() );
|
||||||
pItem->setTextAlignment( Qt::AlignCenter );
|
pItem->setTextAlignment( Qt::AlignCenter );
|
||||||
ui->tableWidget->setItem( i, l, pItem );
|
ui->tableWidget->setItem( i, l, pItem );
|
||||||
|
|
||||||
// 将记录写入右侧文本框
|
// 将记录写入右侧文本框
|
||||||
if ( l == 1 )
|
if ( l == 1 )
|
||||||
{
|
{
|
||||||
QStringList listCount = pTableWidget->item(i,l)->text().split("/");
|
QStringList listCount = pTableWidget->item(i,l)->text().split("/");
|
||||||
if ( listCount.count() == 2 )
|
if ( listCount.count() == 2 )
|
||||||
{
|
{
|
||||||
if ( listCount.at(0).toInt() >= m_nNormalAlarmCount )
|
if ( listCount.at(0).toInt() >= m_nNormalAlarmCount )
|
||||||
{
|
{
|
||||||
QString sText = ui->textEdit->toHtml();
|
QString sText = ui->textEdit->toHtml();
|
||||||
sText = sText + QString("%1:%2,普通告警偏高; \n").arg(nIndex++).arg(pTableWidget->item(i,0)->text());
|
sText = sText + QString("%1:%2,普通告警偏高; \n").arg(nIndex++).arg(pTableWidget->item(i,0)->text());
|
||||||
ui->textEdit->setText( sText );
|
ui->textEdit->setText( sText );
|
||||||
}
|
}
|
||||||
if ( listCount.at(1).toInt() >= m_nSmartAlarmCount )
|
if ( listCount.at(1).toInt() >= m_nSmartAlarmCount )
|
||||||
{
|
{
|
||||||
QString sText = ui->textEdit->toHtml();
|
QString sText = ui->textEdit->toHtml();
|
||||||
sText = sText + QString("%1:%2,智能告警偏高; \n").arg(nIndex++).arg(pTableWidget->item(i,0)->text());
|
sText = sText + QString("%1:%2,智能告警偏高; \n").arg(nIndex++).arg(pTableWidget->item(i,0)->text());
|
||||||
ui->textEdit->setText( sText );
|
ui->textEdit->setText( sText );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAlarmReport::slotPushButtonExportClicked( bool )
|
void CAlarmReport::slotPushButtonExportClicked( bool )
|
||||||
{
|
{
|
||||||
QDir dir(QCoreApplication::applicationDirPath());
|
QDir dir(QCoreApplication::applicationDirPath());
|
||||||
dir.cdUp();
|
dir.cdUp();
|
||||||
dir.cdUp();
|
dir.cdUp();
|
||||||
|
|
||||||
QString sPath = QFileDialog::getExistingDirectory(this, tr("选择导出目录"),
|
QString sPath = QFileDialog::getExistingDirectory(this, tr("选择导出目录"),
|
||||||
dir.absolutePath(),
|
dir.absolutePath(),
|
||||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
|
|
||||||
if ( sPath == "" )
|
if ( sPath == "" )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString sExcelFileName = QString("告警分析报告.xlsx");
|
QString sExcelFileName = QString("告警分析报告.xlsx");
|
||||||
QXlsx::Document xlsx;
|
QXlsx::Document xlsx;
|
||||||
xlsx.addSheet( "sheet1" );
|
xlsx.addSheet( "sheet1" );
|
||||||
|
|
||||||
// 宽度
|
// 宽度
|
||||||
xlsx.setColumnWidth( 1, 20 );
|
xlsx.setColumnWidth( 1, 20 );
|
||||||
xlsx.setColumnWidth( 2, 20 );
|
xlsx.setColumnWidth( 2, 20 );
|
||||||
xlsx.setColumnWidth( 3, 50 );
|
xlsx.setColumnWidth( 3, 50 );
|
||||||
|
|
||||||
// 写横向表头
|
// 写横向表头
|
||||||
xlsx.write( 1, 1, "名称" );
|
xlsx.write( 1, 1, "名称" );
|
||||||
xlsx.write( 1, 2, "告警数/智能告警数" );
|
xlsx.write( 1, 2, "告警数/智能告警数" );
|
||||||
|
|
||||||
// 写内容
|
// 写内容
|
||||||
int nRowCount = ui->tableWidget->rowCount();
|
int nRowCount = ui->tableWidget->rowCount();
|
||||||
int nColCount = ui->tableWidget->horizontalHeader()->count();
|
int nColCount = ui->tableWidget->horizontalHeader()->count();
|
||||||
for ( int i=0; i<nRowCount; i++ )
|
for ( int i=0; i<nRowCount; i++ )
|
||||||
{
|
{
|
||||||
for ( int l=0; l<nColCount; l++ )
|
for ( int l=0; l<nColCount; l++ )
|
||||||
{
|
{
|
||||||
xlsx.write( i+2, l+1, ui->tableWidget->item(i,l)->text() );
|
xlsx.write( i+2, l+1, ui->tableWidget->item(i,l)->text() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 写报告内容
|
// 写报告内容
|
||||||
QStringList listReport = ui->textEdit->toPlainText().split(" ");
|
QStringList listReport = ui->textEdit->toPlainText().split(" ");
|
||||||
for ( int i=0; i<listReport.count(); i++ )
|
for ( int i=0; i<listReport.count(); i++ )
|
||||||
xlsx.write( i+1, 3, listReport.at(i) );
|
xlsx.write( i+1, 3, listReport.at(i) );
|
||||||
|
|
||||||
// 保存到文件
|
// 保存到文件
|
||||||
xlsx.saveAs( sPath+"/"+sExcelFileName );
|
xlsx.saveAs( sPath+"/"+sExcelFileName );
|
||||||
|
|
||||||
// 提示导出路径
|
// 提示导出路径
|
||||||
showMsg( QMessageBox::Information, "提示", "导出完成\n文件为:"+sPath+"/"+sExcelFileName);
|
showMsg( QMessageBox::Information, "提示", "导出完成\n文件为:"+sPath+"/"+sExcelFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAlarmReport::paintEvent(QPaintEvent *pEvent)
|
void CAlarmReport::paintEvent(QPaintEvent *pEvent)
|
||||||
{
|
{
|
||||||
//< 用于qss设置背景图片
|
//< 用于qss设置背景图片
|
||||||
Q_UNUSED(pEvent)
|
Q_UNUSED(pEvent)
|
||||||
|
|
||||||
QStyleOption op;
|
QStyleOption op;
|
||||||
op.init(this);
|
op.init(this);
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &op, &p, this);
|
style()->drawPrimitive(QStyle::PE_Widget, &op, &p, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,45 +1,45 @@
|
|||||||
#ifndef CALARMREPORT_H
|
#ifndef CALARMREPORT_H
|
||||||
#define CALARMREPORT_H
|
#define CALARMREPORT_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "model_excel/xlsx/xlsxdocument.h"
|
#include "model_excel/xlsx/xlsxdocument.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CAlarmReport;
|
class CAlarmReport;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CAlarmReport : public QWidget
|
class CAlarmReport : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CAlarmReport(QWidget *parent = 0);
|
explicit CAlarmReport(QWidget *parent = 0);
|
||||||
~CAlarmReport();
|
~CAlarmReport();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void initData( QTableWidget* pTableWidget );
|
void initData( QTableWidget* pTableWidget );
|
||||||
void loadConfig();
|
void loadConfig();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotPushButtonExportClicked( bool bChecked );
|
void slotPushButtonExportClicked( bool bChecked );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *pEvent);
|
void paintEvent(QPaintEvent *pEvent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CAlarmReport *ui;
|
Ui::CAlarmReport *ui;
|
||||||
int m_nNormalAlarmCount; // 普通告警条数,从配置中获取,大于此条数则认为异常
|
int m_nNormalAlarmCount; // 普通告警条数,从配置中获取,大于此条数则认为异常
|
||||||
int m_nSmartAlarmCount; // 智能告警条数,从配置中获取,大于此条数则认为异常
|
int m_nSmartAlarmCount; // 智能告警条数,从配置中获取,大于此条数则认为异常
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CALARMREPORT_H
|
#endif // CALARMREPORT_H
|
||||||
|
|||||||
@ -1,73 +1,73 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CAlarmReport</class>
|
<class>CAlarmReport</class>
|
||||||
<widget class="QWidget" name="CAlarmReport">
|
<widget class="QWidget" name="CAlarmReport">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>762</width>
|
<width>762</width>
|
||||||
<height>431</height>
|
<height>431</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter">
|
<widget class="QSplitter" name="splitter">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="CTableWidget" name="tableWidget"/>
|
<widget class="CTableWidget" name="tableWidget"/>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTextEdit" name="textEdit"/>
|
<widget class="QTextEdit" name="textEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_export">
|
<widget class="QPushButton" name="pushButton_export">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>80</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>导出</string>
|
<string>导出</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>CTableWidget</class>
|
<class>CTableWidget</class>
|
||||||
<extends>QTableWidget</extends>
|
<extends>QTableWidget</extends>
|
||||||
<header>CTableWidget.h</header>
|
<header>CTableWidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,119 +1,119 @@
|
|||||||
#ifndef CALARMSTATISTICS_H
|
#ifndef CALARMSTATISTICS_H
|
||||||
#define CALARMSTATISTICS_H
|
#define CALARMSTATISTICS_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QCalendarWidget>
|
#include <QCalendarWidget>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include <QtCharts/QChart>
|
#include <QtCharts/QChart>
|
||||||
#include <QtCharts/QChartView>
|
#include <QtCharts/QChartView>
|
||||||
#include <QtCharts/QStackedBarSeries>
|
#include <QtCharts/QStackedBarSeries>
|
||||||
#include <QtCharts/QBarSet>
|
#include <QtCharts/QBarSet>
|
||||||
#include <QtCharts/QLegend>
|
#include <QtCharts/QLegend>
|
||||||
#include <QtCharts/QBarCategoryAxis>
|
#include <QtCharts/QBarCategoryAxis>
|
||||||
#include <QtCharts/QBarSeries>
|
#include <QtCharts/QBarSeries>
|
||||||
#include "CAlarmModel.h"
|
#include "CAlarmModel.h"
|
||||||
#include "CAlarmLevelComboBox.h"
|
#include "CAlarmLevelComboBox.h"
|
||||||
#include "SAlarmLevel.h"
|
#include "SAlarmLevel.h"
|
||||||
#include "CProcessDialog.h"
|
#include "CProcessDialog.h"
|
||||||
#include "CStatisticsQueryThread.h"
|
#include "CStatisticsQueryThread.h"
|
||||||
#include "CAlarmCompare.h"
|
#include "CAlarmCompare.h"
|
||||||
#include "CWaveListDialog.h"
|
#include "CWaveListDialog.h"
|
||||||
#include "CAlarmStatisticsPluginWidget.h"
|
#include "CAlarmStatisticsPluginWidget.h"
|
||||||
#include "CAlarmReport.h"
|
#include "CAlarmReport.h"
|
||||||
|
|
||||||
QT_CHARTS_USE_NAMESPACE
|
QT_CHARTS_USE_NAMESPACE
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CAlarmStatistics;
|
class CAlarmStatistics;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CAlarmStatistics : public CAlarmStatisticsPluginWidget
|
class CAlarmStatistics : public CAlarmStatisticsPluginWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QColor chartBackground READ chartBackground WRITE setChartBackground)
|
Q_PROPERTY(QColor chartBackground READ chartBackground WRITE setChartBackground)
|
||||||
Q_PROPERTY(QColor chartLabelColor READ chartLabelColor WRITE setChartLabelColor)
|
Q_PROPERTY(QColor chartLabelColor READ chartLabelColor WRITE setChartLabelColor)
|
||||||
Q_PROPERTY(QColor chartLineColor READ chartLineColor WRITE setChartLineColor)
|
Q_PROPERTY(QColor chartLineColor READ chartLineColor WRITE setChartLineColor)
|
||||||
public:
|
public:
|
||||||
explicit CAlarmStatistics(QWidget *parent = 0, bool editMode = true);
|
explicit CAlarmStatistics(QWidget *parent = 0, bool editMode = true);
|
||||||
~CAlarmStatistics();
|
~CAlarmStatistics();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void initialize( int nMode );
|
void initialize( int nMode );
|
||||||
void initVariate();
|
void initVariate();
|
||||||
void initUi();
|
void initUi();
|
||||||
void initBar();
|
void initBar();
|
||||||
void initLevelChoose();
|
void initLevelChoose();
|
||||||
void loadData();
|
void loadData();
|
||||||
void resetUi();
|
void resetUi();
|
||||||
void resetBar();
|
void resetBar();
|
||||||
void showBar();
|
void showBar();
|
||||||
|
|
||||||
QColor chartBackground();
|
QColor chartBackground();
|
||||||
void setChartBackground(const QColor& color);
|
void setChartBackground(const QColor& color);
|
||||||
|
|
||||||
QColor chartLabelColor();
|
QColor chartLabelColor();
|
||||||
void setChartLabelColor(const QColor& color);
|
void setChartLabelColor(const QColor& color);
|
||||||
|
|
||||||
QColor chartLineColor();
|
QColor chartLineColor();
|
||||||
void setChartLineColor(const QColor& color);
|
void setChartLineColor(const QColor& color);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotBarMouseMoveHovered( bool bStatus, int nIndex, QBarSet* pBarset );
|
void slotBarMouseMoveHovered( bool bStatus, int nIndex, QBarSet* pBarset );
|
||||||
void slotBarClicked( int nIndex, QBarSet* pBarset );
|
void slotBarClicked( int nIndex, QBarSet* pBarset );
|
||||||
void slotCheckBoxStateChanged( int );
|
void slotCheckBoxStateChanged( int );
|
||||||
void slotQueryEnd();
|
void slotQueryEnd();
|
||||||
void slotPushButtonQueryClicked( bool bChecked = false );
|
void slotPushButtonQueryClicked( bool bChecked = false );
|
||||||
void slotPushButtonCompareClicked( bool bChecked = false );
|
void slotPushButtonCompareClicked( bool bChecked = false );
|
||||||
void slotTableViewAlarmClicked( const QModelIndex& index );
|
void slotTableViewAlarmClicked( const QModelIndex& index );
|
||||||
void slotPushButtonReportClicked( bool bCheaked = false );
|
void slotPushButtonReportClicked( bool bCheaked = false );
|
||||||
void slotTableWidgetLocationCellClicked( int nRow, int nColumn );
|
void slotTableWidgetLocationCellClicked( int nRow, int nColumn );
|
||||||
void slotSetHiddenReport(bool hide);
|
void slotSetHiddenReport(bool hide);
|
||||||
void slotSetHiddenOptColumn(bool hide);
|
void slotSetHiddenOptColumn(bool hide);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalShowYCHistoryData( QString sYCTagName, qint64 nDateTimeMs );
|
void signalShowYCHistoryData( QString sYCTagName, qint64 nDateTimeMs );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent( QResizeEvent* pEvent );
|
void resizeEvent( QResizeEvent* pEvent );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_bEditMode;// 是否编辑态
|
bool m_bEditMode;// 是否编辑态
|
||||||
bool m_bAfterMsgBox;// 是否是在弹出告警条数过多之后第一次进入显示提示窗口的函数
|
bool m_bAfterMsgBox;// 是否是在弹出告警条数过多之后第一次进入显示提示窗口的函数
|
||||||
|
|
||||||
int m_nLastRow;
|
int m_nLastRow;
|
||||||
|
|
||||||
Ui::CAlarmStatistics *ui;
|
Ui::CAlarmStatistics *ui;
|
||||||
CStatisticsQueryThread* m_pQueryThread;// 查询数据线程
|
CStatisticsQueryThread* m_pQueryThread;// 查询数据线程
|
||||||
QChart *m_pChart;// 柱状图
|
QChart *m_pChart;// 柱状图
|
||||||
QLabel* m_pLabelValue;// 鼠标移动到柱状图上显示的提示窗口
|
QLabel* m_pLabelValue;// 鼠标移动到柱状图上显示的提示窗口
|
||||||
QList<QBarSet*> m_listBarSetNormal;
|
QList<QBarSet*> m_listBarSetNormal;
|
||||||
QList<QBarSet*> m_listBarSetSmart;
|
QList<QBarSet*> m_listBarSetSmart;
|
||||||
CAlarmLevelComboBox* m_pAlarmLevelComboBox;// 告警级别选择的下拉框
|
CAlarmLevelComboBox* m_pAlarmLevelComboBox;// 告警级别选择的下拉框
|
||||||
QList<QCheckBox*> m_listAlarmLevelCheckBox;// 柱状图告警等级选择的复选框集合
|
QList<QCheckBox*> m_listAlarmLevelCheckBox;// 柱状图告警等级选择的复选框集合
|
||||||
CProcessDialog* m_pProcessDialog;// 等待窗口
|
CProcessDialog* m_pProcessDialog;// 等待窗口
|
||||||
CAlarmCompare* m_pAlarmCompare;// 告警比对窗口
|
CAlarmCompare* m_pAlarmCompare;// 告警比对窗口
|
||||||
CAlarmReport* m_pAlarmReport;// 告警比对窗口
|
CAlarmReport* m_pAlarmReport;// 告警比对窗口
|
||||||
CWaveListDialog* m_pWageListDialog;// 录波文件列表框
|
CWaveListDialog* m_pWageListDialog;// 录波文件列表框
|
||||||
|
|
||||||
QStackedBarSeries* m_pBarSeriesNormal;
|
QStackedBarSeries* m_pBarSeriesNormal;
|
||||||
QStackedBarSeries* m_pBarSeriesSmart;
|
QStackedBarSeries* m_pBarSeriesSmart;
|
||||||
|
|
||||||
QColor m_chartBackground;
|
QColor m_chartBackground;
|
||||||
QColor m_chartLabelColor;
|
QColor m_chartLabelColor;
|
||||||
QColor m_chartLineColor;
|
QColor m_chartLineColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CALARMSTATISTICS_H
|
#endif // CALARMSTATISTICS_H
|
||||||
|
|||||||
@ -1,451 +1,451 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CAlarmStatistics</class>
|
<class>CAlarmStatistics</class>
|
||||||
<widget class="QWidget" name="CAlarmStatistics">
|
<widget class="QWidget" name="CAlarmStatistics">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>989</width>
|
<width>989</width>
|
||||||
<height>641</height>
|
<height>641</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>CAlarmStatistics</string>
|
<string>CAlarmStatistics</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QFrame" name="frame">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>位置</string>
|
<string>位置</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_location">
|
<widget class="QComboBox" name="comboBox_location">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string> 告警等级</string>
|
<string> 告警等级</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_level">
|
<widget class="QComboBox" name="comboBox_level">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string> 时间段</string>
|
<string> 时间段</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDateEdit" name="dateEdit_start">
|
<widget class="QDateEdit" name="dateEdit_start">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="displayFormat">
|
<property name="displayFormat">
|
||||||
<string>yyyy-MM-dd</string>
|
<string>yyyy-MM-dd</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="calendarPopup">
|
<property name="calendarPopup">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>-</string>
|
<string>-</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDateEdit" name="dateEdit_end">
|
<widget class="QDateEdit" name="dateEdit_end">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="displayFormat">
|
<property name="displayFormat">
|
||||||
<string>yyyy-MM-dd</string>
|
<string>yyyy-MM-dd</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="calendarPopup">
|
<property name="calendarPopup">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_keyWord">
|
<widget class="QLineEdit" name="lineEdit_keyWord">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>告警内容关键字</string>
|
<string>告警内容关键字</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pb_query">
|
<widget class="QPushButton" name="pb_query">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>查询</string>
|
<string>查询</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter_2">
|
<widget class="QSplitter" name="splitter_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="CTableWidget" name="tableWidget_location"/>
|
<widget class="CTableWidget" name="tableWidget_location"/>
|
||||||
<widget class="QSplitter" name="splitter">
|
<widget class="QSplitter" name="splitter">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QFrame" name="frame_bar">
|
<widget class="QFrame" name="frame_bar">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::Box</enum>
|
<enum>QFrame::Box</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_alarm_normal">
|
<widget class="QCheckBox" name="checkBox_alarm_normal">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>普通告警</string>
|
<string>普通告警</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_alarm_smart">
|
<widget class="QCheckBox" name="checkBox_alarm_smart">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>智能告警</string>
|
<string>智能告警</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QFrame" name="frame_alarm">
|
<widget class="QFrame" name="frame_alarm">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_name">
|
<widget class="QLabel" name="label_name">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pb_compare">
|
<widget class="QPushButton" name="pb_compare">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>80</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>告警比对</string>
|
<string>告警比对</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_report">
|
<widget class="QPushButton" name="pushButton_report">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>80</width>
|
||||||
<height>24</height>
|
<height>24</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>分析报告</string>
|
<string>分析报告</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="CTableView" name="tableView_alarm">
|
<widget class="CTableView" name="tableView_alarm">
|
||||||
<property name="statusTip">
|
<property name="statusTip">
|
||||||
<string>22</string>
|
<string>22</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string>33</string>
|
<string>33</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>CTableWidget</class>
|
<class>CTableWidget</class>
|
||||||
<extends>QTableWidget</extends>
|
<extends>QTableWidget</extends>
|
||||||
<header>CTableWidget.h</header>
|
<header>CTableWidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>CTableView</class>
|
<class>CTableView</class>
|
||||||
<extends>QTableView</extends>
|
<extends>QTableView</extends>
|
||||||
<header>CTableWidget.h</header>
|
<header>CTableWidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -1,28 +1,28 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "CAlarmStatisticsPluginWidget.h"
|
#include "CAlarmStatisticsPluginWidget.h"
|
||||||
#include "CAlarmStatistics.h"
|
#include "CAlarmStatistics.h"
|
||||||
|
|
||||||
CAlarmStatisticsPluginWidget::CAlarmStatisticsPluginWidget(QWidget *parent): QWidget(parent)
|
CAlarmStatisticsPluginWidget::CAlarmStatisticsPluginWidget(QWidget *parent): QWidget(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CAlarmStatisticsPluginWidget::~CAlarmStatisticsPluginWidget()
|
CAlarmStatisticsPluginWidget::~CAlarmStatisticsPluginWidget()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAlarmStatisticsPluginWidget::createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec)
|
bool CAlarmStatisticsPluginWidget::createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec)
|
||||||
{
|
{
|
||||||
Q_UNUSED(ptrVec)
|
Q_UNUSED(ptrVec)
|
||||||
CAlarmStatistics *pWidget = new CAlarmStatistics(parent, editMode);
|
CAlarmStatistics *pWidget = new CAlarmStatistics(parent, editMode);
|
||||||
//pWidget->initialize((int)E_Alarm_Dock);
|
//pWidget->initialize((int)E_Alarm_Dock);
|
||||||
*widget = (QWidget *)pWidget;
|
*widget = (QWidget *)pWidget;
|
||||||
*alarmWidget = (IPluginWidget *)pWidget;
|
*alarmWidget = (IPluginWidget *)pWidget;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAlarmStatisticsPluginWidget::release()
|
void CAlarmStatisticsPluginWidget::release()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,29 +1,29 @@
|
|||||||
#ifndef CALARMSTATISTICSPLUGINWIDGET_H
|
#ifndef CALARMSTATISTICSPLUGINWIDGET_H
|
||||||
#define CALARMSTATISTICSPLUGINWIDGET_H
|
#define CALARMSTATISTICSPLUGINWIDGET_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "GraphShape/CPluginWidget.h" //< ISCS6000_HOME/platform/src/include/gui/GraphShape
|
#include "GraphShape/CPluginWidget.h" //< ISCS6000_HOME/platform/src/include/gui/GraphShape
|
||||||
|
|
||||||
class CAlarmStatisticsPluginWidget : public QWidget, public CPluginWidgetInterface
|
class CAlarmStatisticsPluginWidget : public QWidget, public CPluginWidgetInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
||||||
Q_INTERFACES(CPluginWidgetInterface)
|
Q_INTERFACES(CPluginWidgetInterface)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAlarmStatisticsPluginWidget(QWidget *parent = 0);
|
CAlarmStatisticsPluginWidget(QWidget *parent = 0);
|
||||||
~CAlarmStatisticsPluginWidget();
|
~CAlarmStatisticsPluginWidget();
|
||||||
|
|
||||||
bool createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec);
|
bool createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec);
|
||||||
void release();
|
void release();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //CALARMSTATISTICSPLUGINWIDGET_H
|
#endif //CALARMSTATISTICSPLUGINWIDGET_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,267 +1,267 @@
|
|||||||
#include "CCompareQueryThread.h"
|
#include "CCompareQueryThread.h"
|
||||||
|
|
||||||
using namespace kbd_public;
|
using namespace kbd_public;
|
||||||
using namespace kbd_dbms;
|
using namespace kbd_dbms;
|
||||||
|
|
||||||
CCompareQueryThread::CCompareQueryThread()
|
CCompareQueryThread::CCompareQueryThread()
|
||||||
{
|
{
|
||||||
initVariate();
|
initVariate();
|
||||||
loadData();
|
loadData();
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCompareQueryThread::~CCompareQueryThread()
|
CCompareQueryThread::~CCompareQueryThread()
|
||||||
{
|
{
|
||||||
delete m_pDb;
|
delete m_pDb;
|
||||||
m_pDb = NULL;
|
m_pDb = NULL;
|
||||||
|
|
||||||
delete m_pAlarmModel;
|
delete m_pAlarmModel;
|
||||||
m_pAlarmModel = NULL;
|
m_pAlarmModel = NULL;
|
||||||
|
|
||||||
qDeleteAll( m_listAlarmLevel );
|
qDeleteAll( m_listAlarmLevel );
|
||||||
m_listAlarmLevel.clear();
|
m_listAlarmLevel.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompareQueryThread::setHiddenOptColumn(bool hide)
|
void CCompareQueryThread::setHiddenOptColumn(bool hide)
|
||||||
{
|
{
|
||||||
if(m_pAlarmModel)
|
if(m_pAlarmModel)
|
||||||
{
|
{
|
||||||
m_pAlarmModel->setHiddenOptColumn(hide);
|
m_pAlarmModel->setHiddenOptColumn(hide);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompareQueryThread::initVariate()
|
void CCompareQueryThread::initVariate()
|
||||||
{
|
{
|
||||||
m_pAlarmModel = new CAlarmModel();
|
m_pAlarmModel = new CAlarmModel();
|
||||||
|
|
||||||
m_listAlarmLevelColor.push_back( QColor(255,0,0) );
|
m_listAlarmLevelColor.push_back( QColor(255,0,0) );
|
||||||
m_listAlarmLevelColor.push_back( QColor(255,116,20) );
|
m_listAlarmLevelColor.push_back( QColor(255,116,20) );
|
||||||
m_listAlarmLevelColor.push_back( QColor(187,226,66) );
|
m_listAlarmLevelColor.push_back( QColor(187,226,66) );
|
||||||
m_listAlarmLevelColor.push_back( QColor(144,230,189) );
|
m_listAlarmLevelColor.push_back( QColor(144,230,189) );
|
||||||
m_listAlarmLevelColor.push_back( QColor(244,228,151) );
|
m_listAlarmLevelColor.push_back( QColor(244,228,151) );
|
||||||
|
|
||||||
m_nLastId = -1;
|
m_nLastId = -1;
|
||||||
m_nLastIndex = -1;
|
m_nLastIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompareQueryThread::loadData()
|
void CCompareQueryThread::loadData()
|
||||||
{
|
{
|
||||||
m_pDb = new CDbApi(DB_CONN_MODEL_READ);
|
m_pDb = new CDbApi(DB_CONN_MODEL_READ);
|
||||||
if ( m_pDb->open() )
|
if ( m_pDb->open() )
|
||||||
{
|
{
|
||||||
LOGINFO("initialize and open database success!");
|
LOGINFO("initialize and open database success!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGERROR("initialize or open database failed!");
|
LOGERROR("initialize or open database failed!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGINFO("DatabaseName: [%s]", m_pDb->getCurrentDbPara().getDatabaseName().toStdString().c_str());
|
LOGINFO("DatabaseName: [%s]", m_pDb->getCurrentDbPara().getDatabaseName().toStdString().c_str());
|
||||||
LOGINFO("HostName: [%s]", m_pDb->getCurrentDbPara().getHostName().toStdString().c_str());
|
LOGINFO("HostName: [%s]", m_pDb->getCurrentDbPara().getHostName().toStdString().c_str());
|
||||||
LOGINFO("UserName: [%s]", m_pDb->getCurrentDbPara().getUserName().toStdString().c_str());
|
LOGINFO("UserName: [%s]", m_pDb->getCurrentDbPara().getUserName().toStdString().c_str());
|
||||||
|
|
||||||
// 查询位置信息
|
// 查询位置信息
|
||||||
QSqlQuery query;
|
QSqlQuery query;
|
||||||
QString sSql = "select LOCATION_ID,DESCRIPTION from sys_model_location_info order by LOCATION_NO";
|
QString sSql = "select LOCATION_ID,DESCRIPTION from sys_model_location_info order by LOCATION_NO";
|
||||||
m_pDb->execute(sSql, query);
|
m_pDb->execute(sSql, query);
|
||||||
while( query.next() )
|
while( query.next() )
|
||||||
{
|
{
|
||||||
SLocation* pLocation = new SLocation;
|
SLocation* pLocation = new SLocation;
|
||||||
pLocation->nId = query.value(0).toInt();
|
pLocation->nId = query.value(0).toInt();
|
||||||
pLocation->sName = query.value(1).toString();
|
pLocation->sName = query.value(1).toString();
|
||||||
m_listLocation << pLocation;
|
m_listLocation << pLocation;
|
||||||
}
|
}
|
||||||
query.clear();
|
query.clear();
|
||||||
|
|
||||||
// 查询设备组信息
|
// 查询设备组信息
|
||||||
for ( int i=0; i<m_listLocation.count(); i++ )
|
for ( int i=0; i<m_listLocation.count(); i++ )
|
||||||
{
|
{
|
||||||
sSql = QString("select TAG_NAME,DESCRIPTION from dev_group where LOCATION_ID=%1")
|
sSql = QString("select TAG_NAME,DESCRIPTION from dev_group where LOCATION_ID=%1")
|
||||||
.arg( m_listLocation.at(i)->nId );
|
.arg( m_listLocation.at(i)->nId );
|
||||||
m_pDb->execute(sSql, query);
|
m_pDb->execute(sSql, query);
|
||||||
while( query.next() )
|
while( query.next() )
|
||||||
{
|
{
|
||||||
SDeviceGroup* pDeviceGroup = new SDeviceGroup;
|
SDeviceGroup* pDeviceGroup = new SDeviceGroup;
|
||||||
pDeviceGroup->sTagName = query.value(0).toString();
|
pDeviceGroup->sTagName = query.value(0).toString();
|
||||||
pDeviceGroup->sName = query.value(1).toString();
|
pDeviceGroup->sName = query.value(1).toString();
|
||||||
m_listLocation[i]->listDeviceGroup << pDeviceGroup;
|
m_listLocation[i]->listDeviceGroup << pDeviceGroup;
|
||||||
}
|
}
|
||||||
query.clear();
|
query.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询告警等级信息
|
// 查询告警等级信息
|
||||||
sSql = "select PRIORITY_ID,PRIORITY_ORDER,PRIORITY_NAME from alarm_level_define order by PRIORITY_ORDER";
|
sSql = "select PRIORITY_ID,PRIORITY_ORDER,PRIORITY_NAME from alarm_level_define order by PRIORITY_ORDER";
|
||||||
m_pDb->execute(sSql, query);
|
m_pDb->execute(sSql, query);
|
||||||
while( query.next() )
|
while( query.next() )
|
||||||
{
|
{
|
||||||
SAlarmLevel* pAlarmLevel = new SAlarmLevel;
|
SAlarmLevel* pAlarmLevel = new SAlarmLevel;
|
||||||
pAlarmLevel->nId = query.value(0).toInt();
|
pAlarmLevel->nId = query.value(0).toInt();
|
||||||
pAlarmLevel->nPriority = query.value(1).toInt();
|
pAlarmLevel->nPriority = query.value(1).toInt();
|
||||||
pAlarmLevel->sName = query.value(2).toString();
|
pAlarmLevel->sName = query.value(2).toString();
|
||||||
m_listAlarmLevel.append( pAlarmLevel );
|
m_listAlarmLevel.append( pAlarmLevel );
|
||||||
}
|
}
|
||||||
query.clear();
|
query.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompareQueryThread::clear()
|
void CCompareQueryThread::clear()
|
||||||
{
|
{
|
||||||
m_bCancel = false;
|
m_bCancel = false;
|
||||||
m_nCurrentLocationIndex = 0;
|
m_nCurrentLocationIndex = 0;
|
||||||
m_nStartMs = 0;
|
m_nStartMs = 0;
|
||||||
m_nEndMs = 0;
|
m_nEndMs = 0;
|
||||||
m_sSelectedLevel = "";
|
m_sSelectedLevel = "";
|
||||||
|
|
||||||
// 清空告警显示
|
// 清空告警显示
|
||||||
m_pAlarmModel->beginReset();
|
m_pAlarmModel->beginReset();
|
||||||
m_pAlarmModel->clearAlarmList();
|
m_pAlarmModel->clearAlarmList();
|
||||||
m_pAlarmModel->endReset();
|
m_pAlarmModel->endReset();
|
||||||
|
|
||||||
// 清空告警详细信息
|
// 清空告警详细信息
|
||||||
for ( int i=0; i<m_listAlarm.count(); i++ )
|
for ( int i=0; i<m_listAlarm.count(); i++ )
|
||||||
qDeleteAll( m_listAlarm.at(i) );
|
qDeleteAll( m_listAlarm.at(i) );
|
||||||
m_listAlarm.clear();
|
m_listAlarm.clear();
|
||||||
|
|
||||||
// 清空时间点
|
// 清空时间点
|
||||||
m_listTimePoint.clear();
|
m_listTimePoint.clear();
|
||||||
|
|
||||||
// 清空设备选择框
|
// 清空设备选择框
|
||||||
m_listCheckBox.clear();
|
m_listCheckBox.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompareQueryThread::calcTimePoint()
|
void CCompareQueryThread::calcTimePoint()
|
||||||
{
|
{
|
||||||
qint64 nStart = m_nStartMs;
|
qint64 nStart = m_nStartMs;
|
||||||
qint64 nEnd = m_nEndMs;
|
qint64 nEnd = m_nEndMs;
|
||||||
qint64 nOneDayMs = 24ll*60*60*1000;
|
qint64 nOneDayMs = 24ll*60*60*1000;
|
||||||
if ( m_eDateType == EN_DateType_Day )
|
if ( m_eDateType == EN_DateType_Day )
|
||||||
{
|
{
|
||||||
while ( nStart < nEnd )
|
while ( nStart < nEnd )
|
||||||
{
|
{
|
||||||
m_listTimePoint << nStart;
|
m_listTimePoint << nStart;
|
||||||
nStart = nStart + nOneDayMs;
|
nStart = nStart + nOneDayMs;
|
||||||
}
|
}
|
||||||
m_listTimePoint << nEnd;
|
m_listTimePoint << nEnd;
|
||||||
}
|
}
|
||||||
else if ( m_eDateType == EN_DateType_Month )
|
else if ( m_eDateType == EN_DateType_Month )
|
||||||
{
|
{
|
||||||
while ( nStart < nEnd )
|
while ( nStart < nEnd )
|
||||||
{
|
{
|
||||||
m_listTimePoint << nStart;
|
m_listTimePoint << nStart;
|
||||||
nStart = nStart + nOneDayMs;
|
nStart = nStart + nOneDayMs;
|
||||||
while ( QDateTime::fromMSecsSinceEpoch(nStart).date().day() != 1 )
|
while ( QDateTime::fromMSecsSinceEpoch(nStart).date().day() != 1 )
|
||||||
nStart = nStart + nOneDayMs;
|
nStart = nStart + nOneDayMs;
|
||||||
}
|
}
|
||||||
m_listTimePoint << nEnd;
|
m_listTimePoint << nEnd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompareQueryThread::run()
|
void CCompareQueryThread::run()
|
||||||
{
|
{
|
||||||
// 根据选择的统计类型计算时间点
|
// 根据选择的统计类型计算时间点
|
||||||
calcTimePoint();
|
calcTimePoint();
|
||||||
|
|
||||||
// 计算所有选择的站或者设备组
|
// 计算所有选择的站或者设备组
|
||||||
for ( int i=0; i<m_listCheckBox.count(); i++ )
|
for ( int i=0; i<m_listCheckBox.count(); i++ )
|
||||||
{
|
{
|
||||||
if ( m_bCancel )
|
if ( m_bCancel )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
QCheckBox* pCheckBox = m_listCheckBox.at(i);
|
QCheckBox* pCheckBox = m_listCheckBox.at(i);
|
||||||
QList<SAlarmList*> tmpListAlarm;
|
QList<SAlarmList*> tmpListAlarm;
|
||||||
for ( int l=0; l<m_listTimePoint.count()-1; l++ )
|
for ( int l=0; l<m_listTimePoint.count()-1; l++ )
|
||||||
{
|
{
|
||||||
if ( m_bCancel )
|
if ( m_bCancel )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SAlarmList* pAlarmList = new SAlarmList;
|
SAlarmList* pAlarmList = new SAlarmList;
|
||||||
while ( pAlarmList->listLevelCount.count() < m_listAlarmLevel.count() )
|
while ( pAlarmList->listLevelCount.count() < m_listAlarmLevel.count() )
|
||||||
pAlarmList->listLevelCount.append(0);
|
pAlarmList->listLevelCount.append(0);
|
||||||
tmpListAlarm.append( pAlarmList );
|
tmpListAlarm.append( pAlarmList );
|
||||||
if ( m_eDateType == EN_DateType_Day )
|
if ( m_eDateType == EN_DateType_Day )
|
||||||
pAlarmList->sName = QDateTime::fromMSecsSinceEpoch(m_listTimePoint.at(l)).toString("yyyy-MM-dd");
|
pAlarmList->sName = QDateTime::fromMSecsSinceEpoch(m_listTimePoint.at(l)).toString("yyyy-MM-dd");
|
||||||
else if ( m_eDateType == EN_DateType_Month )
|
else if ( m_eDateType == EN_DateType_Month )
|
||||||
pAlarmList->sName = QDateTime::fromMSecsSinceEpoch(m_listTimePoint.at(l)).toString("yyyy-MM");
|
pAlarmList->sName = QDateTime::fromMSecsSinceEpoch(m_listTimePoint.at(l)).toString("yyyy-MM");
|
||||||
|
|
||||||
QSqlQuery query;
|
QSqlQuery query;
|
||||||
QString sSql = "";
|
QString sSql = "";
|
||||||
if ( m_nCurrentLocationIndex == 0 )
|
if ( m_nCurrentLocationIndex == 0 )
|
||||||
{
|
{
|
||||||
pAlarmList->nId = pCheckBox->property("id").toInt();
|
pAlarmList->nId = pCheckBox->property("id").toInt();
|
||||||
sSql = QString("select TIME_STAMP,PRIORITY,CONTENT from %1 \
|
sSql = QString("select TIME_STAMP,PRIORITY,CONTENT from %1 \
|
||||||
where TIME_STAMP between %2 and %3 and LOCATION_ID=%4 and PRIORITY in(%5) \
|
where TIME_STAMP between %2 and %3 and LOCATION_ID=%4 and PRIORITY in(%5) \
|
||||||
order by TIME_STAMP")
|
order by TIME_STAMP")
|
||||||
.arg(CN_NORMALALARMTABLE).arg(m_listTimePoint.at(l))
|
.arg(CN_NORMALALARMTABLE).arg(m_listTimePoint.at(l))
|
||||||
.arg(m_listTimePoint.at(l+1)).arg(pAlarmList->nId).arg(m_sSelectedLevel);
|
.arg(m_listTimePoint.at(l+1)).arg(pAlarmList->nId).arg(m_sSelectedLevel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pAlarmList->sTagName = pCheckBox->property("id").toString();
|
pAlarmList->sTagName = pCheckBox->property("id").toString();
|
||||||
sSql = QString("select TIME_STAMP,PRIORITY,CONTENT from %1 \
|
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) \
|
where TIME_STAMP between %2 and %3 and DEV_GROUP_TAG='%4' and PRIORITY in(%5) \
|
||||||
order by TIME_STAMP")
|
order by TIME_STAMP")
|
||||||
.arg(CN_NORMALALARMTABLE).arg(m_listTimePoint.at(l))
|
.arg(CN_NORMALALARMTABLE).arg(m_listTimePoint.at(l))
|
||||||
.arg(m_listTimePoint.at(l+1)).arg(pAlarmList->sTagName).arg(m_sSelectedLevel);
|
.arg(m_listTimePoint.at(l+1)).arg(pAlarmList->sTagName).arg(m_sSelectedLevel);
|
||||||
}
|
}
|
||||||
m_pDb->execute(sSql, query);
|
m_pDb->execute(sSql, query);
|
||||||
while( query.next() )
|
while( query.next() )
|
||||||
{
|
{
|
||||||
if ( m_bCancel )
|
if ( m_bCancel )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// 有关键字
|
// 有关键字
|
||||||
if ( m_sKeyWord != "" )
|
if ( m_sKeyWord != "" )
|
||||||
{
|
{
|
||||||
if ( !query.value(2).toString().contains(m_sKeyWord) )
|
if ( !query.value(2).toString().contains(m_sKeyWord) )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SAlarmLevel* pAlarmLevel = NULL;
|
SAlarmLevel* pAlarmLevel = NULL;
|
||||||
int nLevelIndex = getAlarmLevelIndexById( query.value(1).toInt(), pAlarmLevel );
|
int nLevelIndex = getAlarmLevelIndexById( query.value(1).toInt(), pAlarmLevel );
|
||||||
if ( nLevelIndex < 0 )
|
if ( nLevelIndex < 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pAlarmList->listLevelCount[nLevelIndex]++;
|
pAlarmList->listLevelCount[nLevelIndex]++;
|
||||||
if ( pAlarmList->listAlarmInfo.count() >= CN_ALARMINFO_MAXROW )
|
if ( pAlarmList->listAlarmInfo.count() >= CN_ALARMINFO_MAXROW )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SAlarmInfo* pAlarmInfo = new SAlarmInfo;
|
SAlarmInfo* pAlarmInfo = new SAlarmInfo;
|
||||||
pAlarmInfo->sTime = QDateTime::fromMSecsSinceEpoch(query.value(0).toULongLong()).toString("yyyy-MM-dd hh:mm:ss.zzz");
|
pAlarmInfo->sTime = QDateTime::fromMSecsSinceEpoch(query.value(0).toULongLong()).toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||||
pAlarmInfo->sLevel = pAlarmLevel->sName;
|
pAlarmInfo->sLevel = pAlarmLevel->sName;
|
||||||
pAlarmInfo->sLocation = pCheckBox->text();
|
pAlarmInfo->sLocation = pCheckBox->text();
|
||||||
pAlarmInfo->sContent = query.value(2).toString();
|
pAlarmInfo->sContent = query.value(2).toString();
|
||||||
pAlarmList->listAlarmInfo.append( pAlarmInfo );
|
pAlarmList->listAlarmInfo.append( pAlarmInfo );
|
||||||
}
|
}
|
||||||
signalQueryPercent( l*100/(m_listTimePoint.count()-1)/m_listCheckBox.count()
|
signalQueryPercent( l*100/(m_listTimePoint.count()-1)/m_listCheckBox.count()
|
||||||
+ i*100/m_listCheckBox.count() );
|
+ i*100/m_listCheckBox.count() );
|
||||||
query.clear();
|
query.clear();
|
||||||
}
|
}
|
||||||
m_listAlarm << tmpListAlarm;
|
m_listAlarm << tmpListAlarm;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送查询完成信号
|
// 发送查询完成信号
|
||||||
signalQueryEnd();
|
signalQueryEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CCompareQueryThread::getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel )
|
int CCompareQueryThread::getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel )
|
||||||
{
|
{
|
||||||
if ( m_nLastId == nId && m_nLastIndex >= 0 )
|
if ( m_nLastId == nId && m_nLastIndex >= 0 )
|
||||||
{
|
{
|
||||||
pAlarmLevel = m_listAlarmLevel.at(m_nLastIndex);
|
pAlarmLevel = m_listAlarmLevel.at(m_nLastIndex);
|
||||||
return m_nLastIndex;
|
return m_nLastIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_nLastId = nId;
|
m_nLastId = nId;
|
||||||
for ( int i=0; i<m_listAlarmLevel.count(); i++ )
|
for ( int i=0; i<m_listAlarmLevel.count(); i++ )
|
||||||
{
|
{
|
||||||
if ( m_listAlarmLevel.at(i)->nId == nId )
|
if ( m_listAlarmLevel.at(i)->nId == nId )
|
||||||
{
|
{
|
||||||
m_nLastIndex = i;
|
m_nLastIndex = i;
|
||||||
pAlarmLevel = m_listAlarmLevel.at(i);
|
pAlarmLevel = m_listAlarmLevel.at(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return m_nLastIndex;
|
return m_nLastIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,70 +1,70 @@
|
|||||||
#ifndef CCOMPAREQUERYTHREAD_H
|
#ifndef CCOMPAREQUERYTHREAD_H
|
||||||
#define CCOMPAREQUERYTHREAD_H
|
#define CCOMPAREQUERYTHREAD_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include "CommonDefine.h"
|
#include "CommonDefine.h"
|
||||||
#include "pub_logger_api/logger.h"
|
#include "pub_logger_api/logger.h"
|
||||||
#include "db_sysinfo_api/CDbSysInfo.h"
|
#include "db_sysinfo_api/CDbSysInfo.h"
|
||||||
#include "db_api_ex/CDbApi.h"
|
#include "db_api_ex/CDbApi.h"
|
||||||
#include "CAlarmModel.h"
|
#include "CAlarmModel.h"
|
||||||
#include "SAlarmLevel.h"
|
#include "SAlarmLevel.h"
|
||||||
#include "SLocation.h"
|
#include "SLocation.h"
|
||||||
|
|
||||||
class CCompareQueryThread : public QThread
|
class CCompareQueryThread : public QThread
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum EN_DateType
|
enum EN_DateType
|
||||||
{
|
{
|
||||||
EN_DateType_Day = 0,
|
EN_DateType_Day = 0,
|
||||||
EN_DateType_Month = 1
|
EN_DateType_Month = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCompareQueryThread();
|
CCompareQueryThread();
|
||||||
~CCompareQueryThread();
|
~CCompareQueryThread();
|
||||||
|
|
||||||
void setHiddenOptColumn(bool hide);
|
void setHiddenOptColumn(bool hide);
|
||||||
signals:
|
signals:
|
||||||
void signalQueryPercent( int nPercent );// 查询完成百分比
|
void signalQueryPercent( int nPercent );// 查询完成百分比
|
||||||
void signalQueryEnd();// 查询结束
|
void signalQueryEnd();// 查询结束
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotCancel(){ m_bCancel = true; }
|
void slotCancel(){ m_bCancel = true; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void initVariate();
|
void initVariate();
|
||||||
void loadData();
|
void loadData();
|
||||||
void run();
|
void run();
|
||||||
void clear();
|
void clear();
|
||||||
void calcTimePoint();
|
void calcTimePoint();
|
||||||
int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel );
|
int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
kbd_dbms::CDbApi* m_pDb; // 数据库接口
|
kbd_dbms::CDbApi* m_pDb; // 数据库接口
|
||||||
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
|
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
|
||||||
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
|
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
|
||||||
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表
|
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表
|
||||||
QList<QList<SAlarmList*> > m_listAlarm;// 第一层是设备集合,第二次是时间集合
|
QList<QList<SAlarmList*> > m_listAlarm;// 第一层是设备集合,第二次是时间集合
|
||||||
|
|
||||||
int m_nCurrentLocationIndex;// 当前站序号,0表示全部站
|
int m_nCurrentLocationIndex;// 当前站序号,0表示全部站
|
||||||
qint64 m_nStartMs;// 开始时间 ms
|
qint64 m_nStartMs;// 开始时间 ms
|
||||||
qint64 m_nEndMs;// 结束时间 ms
|
qint64 m_nEndMs;// 结束时间 ms
|
||||||
QString m_sSelectedLevel;// 已选择的告警等级
|
QString m_sSelectedLevel;// 已选择的告警等级
|
||||||
bool m_bCancel;// 是否取消
|
bool m_bCancel;// 是否取消
|
||||||
|
|
||||||
QList<SLocation*> m_listLocation;// 位置信息列表
|
QList<SLocation*> m_listLocation;// 位置信息列表
|
||||||
QList<QCheckBox*> m_listCheckBox;// 选择列表(站或者设备组)
|
QList<QCheckBox*> m_listCheckBox;// 选择列表(站或者设备组)
|
||||||
EN_DateType m_eDateType;// 查询日期类型
|
EN_DateType m_eDateType;// 查询日期类型
|
||||||
QList<qint64> m_listTimePoint;// 根据开始时间、结束时间、查询类型计算的时间点
|
QList<qint64> m_listTimePoint;// 根据开始时间、结束时间、查询类型计算的时间点
|
||||||
QString m_sKeyWord;// 查询关键字
|
QString m_sKeyWord;// 查询关键字
|
||||||
int m_nLastId;
|
int m_nLastId;
|
||||||
int m_nLastIndex;
|
int m_nLastIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CCOMPAREQUERYTHREAD_H
|
#endif // CCOMPAREQUERYTHREAD_H
|
||||||
|
|||||||
@ -1,32 +1,32 @@
|
|||||||
#include "CProcessDialog.h"
|
#include "CProcessDialog.h"
|
||||||
#include "ui_CProcessDialog.h"
|
#include "ui_CProcessDialog.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
CProcessDialog::CProcessDialog(QDialog *parent) :
|
CProcessDialog::CProcessDialog(QDialog *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::CProcessDialog)
|
ui(new Ui::CProcessDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags()|Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
|
setWindowFlags(windowFlags()|Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
|
||||||
connect( ui->pb_cancel, SIGNAL(clicked(bool)), this, SLOT(slotPbcancelClicked(bool)), Qt::DirectConnection );
|
connect( ui->pb_cancel, SIGNAL(clicked(bool)), this, SLOT(slotPbcancelClicked(bool)), Qt::DirectConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
CProcessDialog::~CProcessDialog()
|
CProcessDialog::~CProcessDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProcessDialog::slotPbcancelClicked( bool )
|
void CProcessDialog::slotPbcancelClicked( bool )
|
||||||
{
|
{
|
||||||
signalCancel();
|
signalCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProcessDialog::slotSetValue( int nValue )
|
void CProcessDialog::slotSetValue( int nValue )
|
||||||
{
|
{
|
||||||
ui->progressBar->setValue( nValue );
|
ui->progressBar->setValue( nValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProcessDialog::reset()
|
void CProcessDialog::reset()
|
||||||
{
|
{
|
||||||
ui->progressBar->setValue( 0 );
|
ui->progressBar->setValue( 0 );
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +1,32 @@
|
|||||||
#ifndef CPROCESSDIALOG_H
|
#ifndef CPROCESSDIALOG_H
|
||||||
#define CPROCESSDIALOG_H
|
#define CPROCESSDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CProcessDialog;
|
class CProcessDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CProcessDialog : public QDialog
|
class CProcessDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CProcessDialog(QDialog *parent = 0);
|
explicit CProcessDialog(QDialog *parent = 0);
|
||||||
~CProcessDialog();
|
~CProcessDialog();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalCancel();
|
void signalCancel();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotPbcancelClicked( bool bChecked );
|
void slotPbcancelClicked( bool bChecked );
|
||||||
void slotSetValue( int nValue );
|
void slotSetValue( int nValue );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CProcessDialog *ui;
|
Ui::CProcessDialog *ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CPROCESSDIALOG_H
|
#endif // CPROCESSDIALOG_H
|
||||||
|
|||||||
@ -1,71 +1,71 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CProcessDialog</class>
|
<class>CProcessDialog</class>
|
||||||
<widget class="QWidget" name="CProcessDialog">
|
<widget class="QWidget" name="CProcessDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>28</height>
|
<height>28</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QProgressBar" name="progressBar">
|
<widget class="QProgressBar" name="progressBar">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>28</height>
|
<height>28</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pb_cancel">
|
<widget class="QPushButton" name="pb_cancel">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>28</height>
|
<height>28</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>取消</string>
|
<string>取消</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,57 +1,57 @@
|
|||||||
#ifndef CSTATISTICSQUERYTHREAD_H
|
#ifndef CSTATISTICSQUERYTHREAD_H
|
||||||
#define CSTATISTICSQUERYTHREAD_H
|
#define CSTATISTICSQUERYTHREAD_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "CommonDefine.h"
|
#include "CommonDefine.h"
|
||||||
#include "pub_logger_api/logger.h"
|
#include "pub_logger_api/logger.h"
|
||||||
#include "db_sysinfo_api/CDbSysInfo.h"
|
#include "db_sysinfo_api/CDbSysInfo.h"
|
||||||
#include "db_api_ex/CDbApi.h"
|
#include "db_api_ex/CDbApi.h"
|
||||||
#include "CAlarmModel.h"
|
#include "CAlarmModel.h"
|
||||||
#include "SAlarmLevel.h"
|
#include "SAlarmLevel.h"
|
||||||
#include "SLocation.h"
|
#include "SLocation.h"
|
||||||
|
|
||||||
class CStatisticsQueryThread : public QThread
|
class CStatisticsQueryThread : public QThread
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CStatisticsQueryThread();
|
CStatisticsQueryThread();
|
||||||
~CStatisticsQueryThread();
|
~CStatisticsQueryThread();
|
||||||
|
|
||||||
void setHiddenOptColumn(bool hide);
|
void setHiddenOptColumn(bool hide);
|
||||||
signals:
|
signals:
|
||||||
void signalQueryPercent( int nPercent );// 查询完成百分比
|
void signalQueryPercent( int nPercent );// 查询完成百分比
|
||||||
void signalQueryEnd();// 查询结束
|
void signalQueryEnd();// 查询结束
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotCancel(){ m_bCancel = true; }
|
void slotCancel(){ m_bCancel = true; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void initVariate();
|
void initVariate();
|
||||||
void loadData();
|
void loadData();
|
||||||
void run();
|
void run();
|
||||||
void clear();
|
void clear();
|
||||||
int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel );
|
int getAlarmLevelIndexById( int nId, SAlarmLevel* &pAlarmLevel );
|
||||||
void getWavePath( QString sAppTagName, QString& sPath, QString& sErrorMsg );
|
void getWavePath( QString sAppTagName, QString& sPath, QString& sErrorMsg );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
kbd_dbms::CDbApi* m_pDb; // 数据库接口
|
kbd_dbms::CDbApi* m_pDb; // 数据库接口
|
||||||
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
|
CAlarmModel* m_pAlarmModel; // 详细告警信息显示窗的model
|
||||||
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
|
QList<QColor> m_listAlarmLevelColor; // 告警优先级的颜色集合
|
||||||
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表
|
QList<SAlarmLevel*> m_listAlarmLevel; // 告警级别列表
|
||||||
QList<SAlarmList*> m_listAlarmNormal; // 所有站或者一个站的所有设备组的普通告警列表
|
QList<SAlarmList*> m_listAlarmNormal; // 所有站或者一个站的所有设备组的普通告警列表
|
||||||
QList<SAlarmList*> m_listAlarmSmart; // 所有站或者一个站的所有设备组的智能告警列表
|
QList<SAlarmList*> m_listAlarmSmart; // 所有站或者一个站的所有设备组的智能告警列表
|
||||||
QList<SLocation*> m_listLocation; // 位置信息列表
|
QList<SLocation*> m_listLocation; // 位置信息列表
|
||||||
int m_nCurrentLocationIndex;
|
int m_nCurrentLocationIndex;
|
||||||
qint64 m_nStartMs;
|
qint64 m_nStartMs;
|
||||||
qint64 m_nEndMs;
|
qint64 m_nEndMs;
|
||||||
QString m_sSelectedLevel;
|
QString m_sSelectedLevel;
|
||||||
bool m_bCancel;
|
bool m_bCancel;
|
||||||
QString m_sKeyWord;// 查询关键字
|
QString m_sKeyWord;// 查询关键字
|
||||||
int m_nLastId;
|
int m_nLastId;
|
||||||
int m_nLastIndex;
|
int m_nLastIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CSTATISTICSQUERYTHREAD_H
|
#endif // CSTATISTICSQUERYTHREAD_H
|
||||||
|
|||||||
@ -1,62 +1,62 @@
|
|||||||
#include "CTableWidget.h"
|
#include "CTableWidget.h"
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
||||||
CTableWidget::CTableWidget(QWidget *parent)
|
CTableWidget::CTableWidget(QWidget *parent)
|
||||||
: QTableWidget(parent)
|
: QTableWidget(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTableWidget::tableColumnWidth()
|
int CTableWidget::tableColumnWidth()
|
||||||
{
|
{
|
||||||
return m_nTableColWidth;
|
return m_nTableColWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableWidget::setTableColumnWidth(const int &nWidth)
|
void CTableWidget::setTableColumnWidth(const int &nWidth)
|
||||||
{
|
{
|
||||||
m_nTableColWidth = nWidth;
|
m_nTableColWidth = nWidth;
|
||||||
|
|
||||||
horizontalHeader()->setDefaultSectionSize(m_nTableColWidth);
|
horizontalHeader()->setDefaultSectionSize(m_nTableColWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTableWidget::tableRowHeight()
|
int CTableWidget::tableRowHeight()
|
||||||
{
|
{
|
||||||
return m_nTableRowHeight;
|
return m_nTableRowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableWidget::setTableRowHeight(const int &nHeight)
|
void CTableWidget::setTableRowHeight(const int &nHeight)
|
||||||
{
|
{
|
||||||
m_nTableRowHeight = nHeight;
|
m_nTableRowHeight = nHeight;
|
||||||
|
|
||||||
verticalHeader()->setDefaultSectionSize(m_nTableRowHeight);
|
verticalHeader()->setDefaultSectionSize(m_nTableRowHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTableView::CTableView(QWidget *parent)
|
CTableView::CTableView(QWidget *parent)
|
||||||
: QTableView(parent)
|
: QTableView(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTableView::tableColumnWidth()
|
int CTableView::tableColumnWidth()
|
||||||
{
|
{
|
||||||
return m_nTableColWidth;
|
return m_nTableColWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableView::setTableColumnWidth(const int &nWidth)
|
void CTableView::setTableColumnWidth(const int &nWidth)
|
||||||
{
|
{
|
||||||
m_nTableColWidth = nWidth;
|
m_nTableColWidth = nWidth;
|
||||||
|
|
||||||
horizontalHeader()->setDefaultSectionSize(m_nTableColWidth);
|
horizontalHeader()->setDefaultSectionSize(m_nTableColWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTableView::tableRowHeight()
|
int CTableView::tableRowHeight()
|
||||||
{
|
{
|
||||||
return m_nTableRowHeight;
|
return m_nTableRowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTableView::setTableRowHeight(const int &nHeight)
|
void CTableView::setTableRowHeight(const int &nHeight)
|
||||||
{
|
{
|
||||||
m_nTableRowHeight = nHeight;
|
m_nTableRowHeight = nHeight;
|
||||||
|
|
||||||
verticalHeader()->setDefaultSectionSize(m_nTableRowHeight);
|
verticalHeader()->setDefaultSectionSize(m_nTableRowHeight);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,46 +1,46 @@
|
|||||||
#ifndef CTABLEWIDGET_H
|
#ifndef CTABLEWIDGET_H
|
||||||
#define CTABLEWIDGET_H
|
#define CTABLEWIDGET_H
|
||||||
|
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
|
|
||||||
class CTableWidget : public QTableWidget
|
class CTableWidget : public QTableWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int tableColumnWidth READ tableColumnWidth WRITE setTableColumnWidth)
|
Q_PROPERTY(int tableColumnWidth READ tableColumnWidth WRITE setTableColumnWidth)
|
||||||
Q_PROPERTY(int tableRowHeight READ tableRowHeight WRITE setTableRowHeight)
|
Q_PROPERTY(int tableRowHeight READ tableRowHeight WRITE setTableRowHeight)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTableWidget(QWidget *parent = Q_NULLPTR);
|
CTableWidget(QWidget *parent = Q_NULLPTR);
|
||||||
|
|
||||||
int tableColumnWidth();
|
int tableColumnWidth();
|
||||||
void setTableColumnWidth(const int &nWidth);
|
void setTableColumnWidth(const int &nWidth);
|
||||||
|
|
||||||
int tableRowHeight();
|
int tableRowHeight();
|
||||||
void setTableRowHeight(const int &nHeight);
|
void setTableRowHeight(const int &nHeight);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_nTableColWidth;
|
int m_nTableColWidth;
|
||||||
int m_nTableRowHeight;
|
int m_nTableRowHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CTableView : public QTableView
|
class CTableView : public QTableView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int tableColumnWidth READ tableColumnWidth WRITE setTableColumnWidth)
|
Q_PROPERTY(int tableColumnWidth READ tableColumnWidth WRITE setTableColumnWidth)
|
||||||
Q_PROPERTY(int tableRowHeight READ tableRowHeight WRITE setTableRowHeight)
|
Q_PROPERTY(int tableRowHeight READ tableRowHeight WRITE setTableRowHeight)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTableView(QWidget *parent = Q_NULLPTR);
|
CTableView(QWidget *parent = Q_NULLPTR);
|
||||||
|
|
||||||
int tableColumnWidth();
|
int tableColumnWidth();
|
||||||
void setTableColumnWidth(const int &nWidth);
|
void setTableColumnWidth(const int &nWidth);
|
||||||
|
|
||||||
int tableRowHeight();
|
int tableRowHeight();
|
||||||
void setTableRowHeight(const int &nHeight);
|
void setTableRowHeight(const int &nHeight);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_nTableColWidth;
|
int m_nTableColWidth;
|
||||||
int m_nTableRowHeight;
|
int m_nTableRowHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CTABLEWIDGET_H
|
#endif // CTABLEWIDGET_H
|
||||||
|
|||||||
@ -1,49 +1,49 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include "CWaveListDialog.h"
|
#include "CWaveListDialog.h"
|
||||||
#include "ui_CWaveListDialog.h"
|
#include "ui_CWaveListDialog.h"
|
||||||
#include "pub_logger_api/logger.h"
|
#include "pub_logger_api/logger.h"
|
||||||
#include "pub_utility_api/FileUtil.h"
|
#include "pub_utility_api/FileUtil.h"
|
||||||
|
|
||||||
CWaveListDialog::CWaveListDialog(QWidget *parent) :
|
CWaveListDialog::CWaveListDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::CWaveListDialog)
|
ui(new Ui::CWaveListDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowTitle( "录波列表" );
|
setWindowTitle( "录波列表" );
|
||||||
|
|
||||||
connect( ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotShowWave(QListWidgetItem*)) );
|
connect( ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotShowWave(QListWidgetItem*)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CWaveListDialog::~CWaveListDialog()
|
CWaveListDialog::~CWaveListDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaveListDialog::clear()
|
void CWaveListDialog::clear()
|
||||||
{
|
{
|
||||||
m_sPath = "";
|
m_sPath = "";
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaveListDialog::addFileNameList( QString sPath, QStringList listName )
|
void CWaveListDialog::addFileNameList( QString sPath, QStringList listName )
|
||||||
{
|
{
|
||||||
m_sPath = sPath;
|
m_sPath = sPath;
|
||||||
ui->listWidget->addItems( listName );
|
ui->listWidget->addItems( listName );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWaveListDialog::slotShowWave( QListWidgetItem* pItem )
|
void CWaveListDialog::slotShowWave( QListWidgetItem* pItem )
|
||||||
{
|
{
|
||||||
const std::string strPath = std::move(kbd_public::CFileUtil::getPathOfBinFile(
|
const std::string strPath = std::move(kbd_public::CFileUtil::getPathOfBinFile(
|
||||||
std::string("WaveAnalyze") + kbd_public::CFileUtil::getProcSuffix()));
|
std::string("WaveAnalyze") + kbd_public::CFileUtil::getProcSuffix()));
|
||||||
if(strPath.empty())
|
if(strPath.empty())
|
||||||
{
|
{
|
||||||
LOGERROR("未找到可执行文件WaveAnalyze");
|
LOGERROR("未找到可执行文件WaveAnalyze");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList listArgument;
|
QStringList listArgument;
|
||||||
listArgument << m_sPath+"/"+pItem->text();
|
listArgument << m_sPath+"/"+pItem->text();
|
||||||
|
|
||||||
QProcess::startDetached( strPath.c_str(), listArgument );
|
QProcess::startDetached( strPath.c_str(), listArgument );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,31 +1,31 @@
|
|||||||
#ifndef CWAVELISTDIALOG_H
|
#ifndef CWAVELISTDIALOG_H
|
||||||
#define CWAVELISTDIALOG_H
|
#define CWAVELISTDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CWaveListDialog;
|
class CWaveListDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CWaveListDialog : public QDialog
|
class CWaveListDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CWaveListDialog(QWidget *parent = 0);
|
explicit CWaveListDialog(QWidget *parent = 0);
|
||||||
~CWaveListDialog();
|
~CWaveListDialog();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void clear();
|
void clear();
|
||||||
void addFileNameList( QString sPath, QStringList listName );
|
void addFileNameList( QString sPath, QStringList listName );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotShowWave( QListWidgetItem* pItem );
|
void slotShowWave( QListWidgetItem* pItem );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CWaveListDialog *ui;
|
Ui::CWaveListDialog *ui;
|
||||||
QString m_sPath;
|
QString m_sPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CWAVELISTDIALOG_H
|
#endif // CWAVELISTDIALOG_H
|
||||||
|
|||||||
@ -1,24 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CWaveListDialog</class>
|
<class>CWaveListDialog</class>
|
||||||
<widget class="QDialog" name="CWaveListDialog">
|
<widget class="QDialog" name="CWaveListDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>300</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="listWidget"/>
|
<widget class="QListWidget" name="listWidget"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
#ifndef COMMONDEFINE_H
|
#ifndef COMMONDEFINE_H
|
||||||
#define COMMONDEFINE_H
|
#define COMMONDEFINE_H
|
||||||
|
|
||||||
#define CN_MAXBARSERIES 5 // 最多柱状图组数
|
#define CN_MAXBARSERIES 5 // 最多柱状图组数
|
||||||
#define CN_ALARMINFO_MAXROW 5000 // 告警信息窗最多显示的条数
|
#define CN_ALARMINFO_MAXROW 5000 // 告警信息窗最多显示的条数
|
||||||
#define CN_DAYSOFSINGLEQUERY 1 // 单次查询的天数
|
#define CN_DAYSOFSINGLEQUERY 1 // 单次查询的天数
|
||||||
#define CN_MAXBARCOUNT 3 // 告警比对站(或设备组)最多个数
|
#define CN_MAXBARCOUNT 3 // 告警比对站(或设备组)最多个数
|
||||||
#define CN_NORMALALARMTABLE "his_event" // 普通告警的表名
|
#define CN_NORMALALARMTABLE "his_event" // 普通告警的表名
|
||||||
#define CN_SMARTALARMTABLE "his_intelli_alm" // 智能告警的表名
|
#define CN_SMARTALARMTABLE "his_intelli_alm" // 智能告警的表名
|
||||||
|
|
||||||
#endif // COMMONDEFINE_H
|
#endif // COMMONDEFINE_H
|
||||||
|
|||||||
@ -1,39 +1,39 @@
|
|||||||
#include "CommonFunction.h"
|
#include "CommonFunction.h"
|
||||||
|
|
||||||
void resizeColumnsToContents(QTableView* pView , int scaleColumn)
|
void resizeColumnsToContents(QTableView* pView , int scaleColumn)
|
||||||
{
|
{
|
||||||
if ( pView == NULL || pView->model() == NULL )
|
if ( pView == NULL || pView->model() == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int nColWidth = pView->width();
|
int nColWidth = pView->width();
|
||||||
if ( nColWidth <= 200 )
|
if ( nColWidth <= 200 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pView->resizeColumnsToContents();
|
pView->resizeColumnsToContents();
|
||||||
|
|
||||||
float fRatio = 1.0f;
|
float fRatio = 1.0f;
|
||||||
int nCurrentColWidth = 0;
|
int nCurrentColWidth = 0;
|
||||||
int nColCount = pView->model()->columnCount();
|
int nColCount = pView->model()->columnCount();
|
||||||
for ( int i=0; i<nColCount; i++ )
|
for ( int i=0; i<nColCount; i++ )
|
||||||
nCurrentColWidth += pView->columnWidth( i );
|
nCurrentColWidth += pView->columnWidth( i );
|
||||||
fRatio = float(nColWidth-20)/nCurrentColWidth;
|
fRatio = float(nColWidth-20)/nCurrentColWidth;
|
||||||
if(fRatio > 1.0)
|
if(fRatio > 1.0)
|
||||||
{
|
{
|
||||||
for ( int i=0; i<nColCount; i++ )
|
for ( int i=0; i<nColCount; i++ )
|
||||||
pView->setColumnWidth( i, pView->columnWidth(i)*fRatio );
|
pView->setColumnWidth( i, pView->columnWidth(i)*fRatio );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int nOffset = nColWidth - nCurrentColWidth - 25;
|
int nOffset = nColWidth - nCurrentColWidth - 25;
|
||||||
if(nColCount > scaleColumn)
|
if(nColCount > scaleColumn)
|
||||||
pView->setColumnWidth( scaleColumn, pView->columnWidth(scaleColumn)+nOffset);
|
pView->setColumnWidth( scaleColumn, pView->columnWidth(scaleColumn)+nOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showMsg( QMessageBox::Icon icon, QString sTitle, QString sText )
|
void showMsg( QMessageBox::Icon icon, QString sTitle, QString sText )
|
||||||
{
|
{
|
||||||
QMessageBox* pMsgBox = new QMessageBox(icon,sTitle,sText);
|
QMessageBox* pMsgBox = new QMessageBox(icon,sTitle,sText);
|
||||||
pMsgBox->setWindowFlags( ( pMsgBox->windowFlags() & ~Qt::WindowMinimizeButtonHint ) | Qt::WindowStaysOnTopHint | Qt::Dialog );
|
pMsgBox->setWindowFlags( ( pMsgBox->windowFlags() & ~Qt::WindowMinimizeButtonHint ) | Qt::WindowStaysOnTopHint | Qt::Dialog );
|
||||||
pMsgBox->exec();
|
pMsgBox->exec();
|
||||||
delete pMsgBox;
|
delete pMsgBox;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
#ifndef COMMONFUNCTION_H
|
#ifndef COMMONFUNCTION_H
|
||||||
#define COMMONFUNCTION_H
|
#define COMMONFUNCTION_H
|
||||||
|
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
void resizeColumnsToContents( QTableView* pView, int scaleColumn = 3 );
|
void resizeColumnsToContents( QTableView* pView, int scaleColumn = 3 );
|
||||||
void showMsg( QMessageBox::Icon icon, QString sTitle, QString sText );
|
void showMsg( QMessageBox::Icon icon, QString sTitle, QString sText );
|
||||||
|
|
||||||
#endif // COMMONFUNCTION_H
|
#endif // COMMONFUNCTION_H
|
||||||
|
|||||||
@ -1,23 +1,23 @@
|
|||||||
#ifndef SALARMINFO_H
|
#ifndef SALARMINFO_H
|
||||||
#define SALARMINFO_H
|
#define SALARMINFO_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
struct SAlarmInfo
|
struct SAlarmInfo
|
||||||
{
|
{
|
||||||
QString sTime; // 时间, 示例: 2019-01-02 09:12:44.267
|
QString sTime; // 时间, 示例: 2019-01-02 09:12:44.267
|
||||||
QString sLevel; // 级别,示例: 一级
|
QString sLevel; // 级别,示例: 一级
|
||||||
QString sLocation; // 位置,示例:清湖北站
|
QString sLocation; // 位置,示例:清湖北站
|
||||||
QString sContent; // 内容,示例:302间隔信息 C相电压 230.00kV 越上上限
|
QString sContent; // 内容,示例:302间隔信息 C相电压 230.00kV 越上上限
|
||||||
QString sKeyIdTag; // key_id_tag
|
QString sKeyIdTag; // key_id_tag
|
||||||
SAlarmInfo()
|
SAlarmInfo()
|
||||||
{
|
{
|
||||||
sTime = "";
|
sTime = "";
|
||||||
sLevel = "";
|
sLevel = "";
|
||||||
sLocation = "";
|
sLocation = "";
|
||||||
sContent = "";
|
sContent = "";
|
||||||
sKeyIdTag = "";
|
sKeyIdTag = "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SALARMINFO_H
|
#endif // SALARMINFO_H
|
||||||
|
|||||||
@ -1,20 +1,20 @@
|
|||||||
#ifndef SALARMLEVEL_H
|
#ifndef SALARMLEVEL_H
|
||||||
#define SALARMLEVEL_H
|
#define SALARMLEVEL_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
struct SAlarmLevel
|
struct SAlarmLevel
|
||||||
{
|
{
|
||||||
int nId; // id
|
int nId; // id
|
||||||
int nPriority; // 级别
|
int nPriority; // 级别
|
||||||
QString sName; // 名称
|
QString sName; // 名称
|
||||||
public:
|
public:
|
||||||
SAlarmLevel()
|
SAlarmLevel()
|
||||||
{
|
{
|
||||||
nId = 0;
|
nId = 0;
|
||||||
nPriority = 0;
|
nPriority = 0;
|
||||||
sName = "";
|
sName = "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SALARMLEVEL_H
|
#endif // SALARMLEVEL_H
|
||||||
|
|||||||
@ -1,37 +1,37 @@
|
|||||||
#ifndef SALARMLIST_H
|
#ifndef SALARMLIST_H
|
||||||
#define SALARMLIST_H
|
#define SALARMLIST_H
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "SAlarmInfo.h"
|
#include "SAlarmInfo.h"
|
||||||
|
|
||||||
struct SAlarmList
|
struct SAlarmList
|
||||||
{
|
{
|
||||||
int nId;// 站id
|
int nId;// 站id
|
||||||
QString sName;// 站或者设备组名称
|
QString sName;// 站或者设备组名称
|
||||||
QString sTagName; // 设备组tag
|
QString sTagName; // 设备组tag
|
||||||
QList<int> listLevelCount;//每级告警个数,下标表示优先级的顺序,不是优先级的值,也不是优先级的id
|
QList<int> listLevelCount;//每级告警个数,下标表示优先级的顺序,不是优先级的值,也不是优先级的id
|
||||||
QList<SAlarmInfo*> listAlarmInfo;//不分等级,前CN_ALARMINFO_MAXROW个
|
QList<SAlarmInfo*> listAlarmInfo;//不分等级,前CN_ALARMINFO_MAXROW个
|
||||||
SAlarmList()
|
SAlarmList()
|
||||||
{
|
{
|
||||||
nId = 0;
|
nId = 0;
|
||||||
sName = "";
|
sName = "";
|
||||||
sTagName = "";
|
sTagName = "";
|
||||||
listLevelCount.clear();
|
listLevelCount.clear();
|
||||||
listAlarmInfo.clear();
|
listAlarmInfo.clear();
|
||||||
}
|
}
|
||||||
~SAlarmList()
|
~SAlarmList()
|
||||||
{
|
{
|
||||||
listLevelCount.clear();
|
listLevelCount.clear();
|
||||||
qDeleteAll( listAlarmInfo );
|
qDeleteAll( listAlarmInfo );
|
||||||
listAlarmInfo.clear();
|
listAlarmInfo.clear();
|
||||||
}
|
}
|
||||||
int getAllLevelAlarmCount()// 获取所有告警的数目(所有等级)
|
int getAllLevelAlarmCount()// 获取所有告警的数目(所有等级)
|
||||||
{
|
{
|
||||||
int nCount = 0;
|
int nCount = 0;
|
||||||
for ( int i=0; i<listLevelCount.count(); i++ )
|
for ( int i=0; i<listLevelCount.count(); i++ )
|
||||||
nCount += listLevelCount.at(i);
|
nCount += listLevelCount.at(i);
|
||||||
return nCount;
|
return nCount;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SALARMLIST_H
|
#endif // SALARMLIST_H
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
#ifndef SDEVICEGROUP_H
|
#ifndef SDEVICEGROUP_H
|
||||||
#define SDEVICEGROUP_H
|
#define SDEVICEGROUP_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
struct SDeviceGroup
|
struct SDeviceGroup
|
||||||
{
|
{
|
||||||
QString sTagName;
|
QString sTagName;
|
||||||
QString sName;
|
QString sName;
|
||||||
SDeviceGroup()
|
SDeviceGroup()
|
||||||
{
|
{
|
||||||
sTagName = "";
|
sTagName = "";
|
||||||
sName = "";
|
sName = "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SDEVICEGROUP_H
|
#endif // SDEVICEGROUP_H
|
||||||
|
|||||||
@ -1,27 +1,27 @@
|
|||||||
#ifndef SLOCATION_H
|
#ifndef SLOCATION_H
|
||||||
#define SLOCATION_H
|
#define SLOCATION_H
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "SDeviceGroup.h"
|
#include "SDeviceGroup.h"
|
||||||
|
|
||||||
struct SLocation
|
struct SLocation
|
||||||
{
|
{
|
||||||
int nId;
|
int nId;
|
||||||
QString sName;
|
QString sName;
|
||||||
QString sTagName;
|
QString sTagName;
|
||||||
QList<SDeviceGroup*> listDeviceGroup;
|
QList<SDeviceGroup*> listDeviceGroup;
|
||||||
SLocation()
|
SLocation()
|
||||||
{
|
{
|
||||||
nId = 0;
|
nId = 0;
|
||||||
sName = "";
|
sName = "";
|
||||||
sTagName = "";
|
sTagName = "";
|
||||||
}
|
}
|
||||||
~SLocation()
|
~SLocation()
|
||||||
{
|
{
|
||||||
qDeleteAll( listDeviceGroup );
|
qDeleteAll( listDeviceGroup );
|
||||||
listDeviceGroup.clear();
|
listDeviceGroup.clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // SLOCATION_H
|
#endif // SLOCATION_H
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
#include "CAlarmStatistics.h"
|
#include "CAlarmStatistics.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include "pub_logger_api/logger.h"
|
#include "pub_logger_api/logger.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
kbd_public::StartLogSystem( "BASE", "alarm_statistics" );
|
kbd_public::StartLogSystem( "BASE", "alarm_statistics" );
|
||||||
|
|
||||||
CAlarmStatistics w( 0, false );
|
CAlarmStatistics w( 0, false );
|
||||||
w.show();
|
w.show();
|
||||||
int nRet = a.exec();
|
int nRet = a.exec();
|
||||||
|
|
||||||
kbd_public::StopLogSystem();
|
kbd_public::StopLogSystem();
|
||||||
return nRet;
|
return nRet;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/resource"/>
|
<qresource prefix="/resource"/>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>resource/combobox-drop-down.png</file>
|
<file>resource/combobox-drop-down.png</file>
|
||||||
<file>resource/icon.png</file>
|
<file>resource/icon.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,94 +1,94 @@
|
|||||||
#ifndef ADDOBJALARMDIALOG_H
|
#ifndef ADDOBJALARMDIALOG_H
|
||||||
#define ADDOBJALARMDIALOG_H
|
#define ADDOBJALARMDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "db_api_ex/CDbApi.h"
|
#include "db_api_ex/CDbApi.h"
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include "AlarmCalcInfo.h"
|
#include "AlarmCalcInfo.h"
|
||||||
#include "AlarmManageCommon.h"
|
#include "AlarmManageCommon.h"
|
||||||
#include "AlarmCalcParaTableModel.h"
|
#include "AlarmCalcParaTableModel.h"
|
||||||
#include "AlarmCalcParaTableDelegate.h"
|
#include "AlarmCalcParaTableDelegate.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AddObjAlarmDialog;
|
class AddObjAlarmDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AddObjAlarmDialog : public QDialog
|
class AddObjAlarmDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AddObjAlarmDialog(QList<ST_DEV_INFO> devList,QWidget *parent = 0);
|
explicit AddObjAlarmDialog(QList<ST_DEV_INFO> devList,QWidget *parent = 0);
|
||||||
~AddObjAlarmDialog();
|
~AddObjAlarmDialog();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigChangePara(QList<AlarmCalcInfoPtr>);
|
void sigChangePara(QList<AlarmCalcInfoPtr>);
|
||||||
|
|
||||||
void sigClearPara();
|
void sigClearPara();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotViewUpdate();
|
void slotViewUpdate();
|
||||||
|
|
||||||
void slotSelectPoint(AlarmCalcInfoPtr info);
|
void slotSelectPoint(AlarmCalcInfoPtr info);
|
||||||
private:
|
private:
|
||||||
void initLayout();
|
void initLayout();
|
||||||
|
|
||||||
void initMember();
|
void initMember();
|
||||||
|
|
||||||
void initData();
|
void initData();
|
||||||
|
|
||||||
void initConnect();
|
void initConnect();
|
||||||
|
|
||||||
void initView();
|
void initView();
|
||||||
|
|
||||||
bool checkIfAdd();
|
bool checkIfAdd();
|
||||||
|
|
||||||
void hideDiText();
|
void hideDiText();
|
||||||
|
|
||||||
void saveAi();
|
void saveAi();
|
||||||
|
|
||||||
void saveDi();
|
void saveDi();
|
||||||
|
|
||||||
QString getOneTagName();
|
QString getOneTagName();
|
||||||
|
|
||||||
int getDevType();
|
int getDevType();
|
||||||
|
|
||||||
int getLoctionId();
|
int getLoctionId();
|
||||||
|
|
||||||
bool execute(const QString &sql);
|
bool execute(const QString &sql);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void pointTypeChange(int index);
|
void pointTypeChange(int index);
|
||||||
|
|
||||||
void alarmLevelChange(int index);
|
void alarmLevelChange(int index);
|
||||||
|
|
||||||
void funcChange(int index);
|
void funcChange(int index);
|
||||||
|
|
||||||
void addObj();
|
void addObj();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AddObjAlarmDialog *ui;
|
Ui::AddObjAlarmDialog *ui;
|
||||||
|
|
||||||
kbd_dbms::CDbApi *m_pWriteDb;
|
kbd_dbms::CDbApi *m_pWriteDb;
|
||||||
|
|
||||||
QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作
|
QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作
|
||||||
|
|
||||||
QMap<int,QString > m_alarmActionMap; //告警动作
|
QMap<int,QString > m_alarmActionMap; //告警动作
|
||||||
QMap<int,int> m_alarmLevelActionMap; //等级--动作
|
QMap<int,int> m_alarmLevelActionMap; //等级--动作
|
||||||
QMap<int,QString> m_alarmLevelMap; //等级--等级描述
|
QMap<int,QString> m_alarmLevelMap; //等级--等级描述
|
||||||
|
|
||||||
QMap<int,int> m_alarmLevelIndexMap;
|
QMap<int,int> m_alarmLevelIndexMap;
|
||||||
|
|
||||||
QMap<QString,QString> m_funcMap; //计算公式
|
QMap<QString,QString> m_funcMap; //计算公式
|
||||||
|
|
||||||
QMap<QString,QList<AlarmCalcInfoPtr> > m_calcInfoMap; //计算公式参数
|
QMap<QString,QList<AlarmCalcInfoPtr> > m_calcInfoMap; //计算公式参数
|
||||||
|
|
||||||
QList<ST_DEV_INFO> m_devList;
|
QList<ST_DEV_INFO> m_devList;
|
||||||
|
|
||||||
QList<QString> m_diTextList;
|
QList<QString> m_diTextList;
|
||||||
AlarmCalcParaTableModel *m_model;
|
AlarmCalcParaTableModel *m_model;
|
||||||
AlarmCalcParaTableDelegate *m_delegate;
|
AlarmCalcParaTableDelegate *m_delegate;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ADDOBJALARMDIALOG_H
|
#endif // ADDOBJALARMDIALOG_H
|
||||||
|
|||||||
@ -1,335 +1,335 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>AddObjAlarmDialog</class>
|
<class>AddObjAlarmDialog</class>
|
||||||
<widget class="QDialog" name="AddObjAlarmDialog">
|
<widget class="QDialog" name="AddObjAlarmDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>655</width>
|
<width>655</width>
|
||||||
<height>554</height>
|
<height>554</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>655</width>
|
<width>655</width>
|
||||||
<height>554</height>
|
<height>554</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>655</width>
|
<width>655</width>
|
||||||
<height>554</height>
|
<height>554</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="0" column="0" colspan="3">
|
<item row="0" column="0" colspan="3">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>90</width>
|
<width>90</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>设备</string>
|
<string>设备</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox">
|
<widget class="QComboBox" name="comboBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="3">
|
<item row="1" column="0" colspan="3">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>90</width>
|
<width>90</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>自定义告警名称</string>
|
<string>自定义告警名称</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit"/>
|
<widget class="QLineEdit" name="lineEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>类型</string>
|
<string>类型</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="cbObjType">
|
<widget class="QComboBox" name="cbObjType">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="3">
|
<item row="2" column="0" colspan="3">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>90</width>
|
<width>90</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>告警等级定义</string>
|
<string>告警等级定义</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_2">
|
<widget class="QComboBox" name="comboBox_2">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>100</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="3">
|
<item row="3" column="0" colspan="3">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>90</width>
|
<width>90</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>告警点计算函数</string>
|
<string>告警点计算函数</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_3">
|
<widget class="QComboBox" name="comboBox_3">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="3">
|
<item row="5" column="0" colspan="3">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>88</height>
|
<height>88</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>告警规则</string>
|
<string>告警规则</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>越上限值</string>
|
<string>越上限值</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox">
|
<widget class="QDoubleSpinBox" name="doubleSpinBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="decimals">
|
<property name="decimals">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<double>-100000000.000000000000000</double>
|
<double>-100000000.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>100000000.000000000000000</double>
|
<double>100000000.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>越下限值</string>
|
<string>越下限值</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_2">
|
<widget class="QDoubleSpinBox" name="doubleSpinBox_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="decimals">
|
<property name="decimals">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<double>-100000000.000000000000000</double>
|
<double>-100000000.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>100000000.000000000000000</double>
|
<double>100000000.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<double>0.000000000000000</double>
|
<double>0.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_2">
|
<widget class="QWidget" name="page_2">
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>数字量文本:</string>
|
<string>数字量文本:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_4">
|
<widget class="QComboBox" name="comboBox_4">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="pushButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>添加</string>
|
<string>添加</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="6" column="2">
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>取消</string>
|
<string>取消</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="3">
|
<item row="4" column="0" colspan="3">
|
||||||
<widget class="QTableView" name="tableView">
|
<widget class="QTableView" name="tableView">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
#include "AlarmCalcInfo.h"
|
#include "AlarmCalcInfo.h"
|
||||||
|
|
||||||
AlarmCalcInfo::AlarmCalcInfo()
|
AlarmCalcInfo::AlarmCalcInfo()
|
||||||
{
|
{
|
||||||
m_nId = -1; //第几个
|
m_nId = -1; //第几个
|
||||||
m_strTip = QString();
|
m_strTip = QString();
|
||||||
m_tag = QString();
|
m_tag = QString();
|
||||||
m_desc = QString(); //可空
|
m_desc = QString(); //可空
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,23 @@
|
|||||||
#ifndef ALARMCALCINFO_H
|
#ifndef ALARMCALCINFO_H
|
||||||
#define ALARMCALCINFO_H
|
#define ALARMCALCINFO_H
|
||||||
|
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
class AlarmCalcInfo;
|
class AlarmCalcInfo;
|
||||||
typedef QSharedPointer<AlarmCalcInfo> AlarmCalcInfoPtr;
|
typedef QSharedPointer<AlarmCalcInfo> AlarmCalcInfoPtr;
|
||||||
|
|
||||||
class AlarmCalcInfo
|
class AlarmCalcInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AlarmCalcInfo();
|
AlarmCalcInfo();
|
||||||
|
|
||||||
int m_nId; //第几个
|
int m_nId; //第几个
|
||||||
QString m_strTip;
|
QString m_strTip;
|
||||||
QString m_tag;
|
QString m_tag;
|
||||||
QString m_desc; //可空
|
QString m_desc; //可空
|
||||||
|
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(AlarmCalcInfo)
|
Q_DECLARE_METATYPE(AlarmCalcInfo)
|
||||||
Q_DECLARE_METATYPE(AlarmCalcInfoPtr)
|
Q_DECLARE_METATYPE(AlarmCalcInfoPtr)
|
||||||
|
|
||||||
#endif // ALARMCALCINFO_H
|
#endif // ALARMCALCINFO_H
|
||||||
|
|||||||
@ -1,74 +1,74 @@
|
|||||||
#include "AlarmCalcParaTableDelegate.h"
|
#include "AlarmCalcParaTableDelegate.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include "AlarmCalcInfo.h"
|
#include "AlarmCalcInfo.h"
|
||||||
#include <QStyleOptionButton>
|
#include <QStyleOptionButton>
|
||||||
#include "public/pub_logger_api/logger.h"
|
#include "public/pub_logger_api/logger.h"
|
||||||
|
|
||||||
AlarmCalcParaTableDelegate::AlarmCalcParaTableDelegate(AlarmCalcParaTableModel *model, QObject *parent)
|
AlarmCalcParaTableDelegate::AlarmCalcParaTableDelegate(AlarmCalcParaTableModel *model, QObject *parent)
|
||||||
:m_pModel(model),
|
:m_pModel(model),
|
||||||
QStyledItemDelegate(parent)
|
QStyledItemDelegate(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmCalcParaTableDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void AlarmCalcParaTableDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
AlarmCalcInfoPtr info = m_pModel->getCalcParaInfo(index);
|
AlarmCalcInfoPtr info = m_pModel->getCalcParaInfo(index);
|
||||||
if(info == NULL)
|
if(info == NULL)
|
||||||
{
|
{
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
QStyleOptionButton buttonOption;
|
QStyleOptionButton buttonOption;
|
||||||
buttonOption.state |= QStyle::State_Enabled;
|
buttonOption.state |= QStyle::State_Enabled;
|
||||||
buttonOption.state |= QStyle::State_On;
|
buttonOption.state |= QStyle::State_On;
|
||||||
buttonOption.features = QStyleOptionButton::Flat;
|
buttonOption.features = QStyleOptionButton::Flat;
|
||||||
// bool hover = index.model()->data(index, Qt::UserRole).toBool();
|
// bool hover = index.model()->data(index, Qt::UserRole).toBool();
|
||||||
// if(hover)
|
// if(hover)
|
||||||
// {
|
// {
|
||||||
// buttonOption.state |= QStyle::State_On;
|
// buttonOption.state |= QStyle::State_On;
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// buttonOption.state |= QStyle::State_Off;
|
// buttonOption.state |= QStyle::State_Off;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
buttonOption.rect = option.rect;
|
buttonOption.rect = option.rect;
|
||||||
buttonOption.rect.adjust(option.rect.width()/2-32,2,-(option.rect.width()/2-32),-2);
|
buttonOption.rect.adjust(option.rect.width()/2-32,2,-(option.rect.width()/2-32),-2);
|
||||||
buttonOption.text = "···";
|
buttonOption.text = "···";
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
if(option.state & QStyle::State_Selected){
|
if(option.state & QStyle::State_Selected){
|
||||||
painter->fillRect(option.rect,option.palette.highlight());
|
painter->fillRect(option.rect,option.palette.highlight());
|
||||||
}
|
}
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
||||||
QApplication::style()->drawControl(QStyle::CE_PushButton, &buttonOption, painter);
|
QApplication::style()->drawControl(QStyle::CE_PushButton, &buttonOption, painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlarmCalcParaTableDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
|
bool AlarmCalcParaTableDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
|
||||||
{
|
{
|
||||||
Q_UNUSED(model);
|
Q_UNUSED(model);
|
||||||
AlarmCalcInfoPtr info = m_pModel->getCalcParaInfo(index);
|
AlarmCalcInfoPtr info = m_pModel->getCalcParaInfo(index);
|
||||||
if(event->type() == QEvent::MouseButtonRelease){
|
if(event->type() == QEvent::MouseButtonRelease){
|
||||||
|
|
||||||
QMouseEvent *e = (QMouseEvent*)event;
|
QMouseEvent *e = (QMouseEvent*)event;
|
||||||
|
|
||||||
if((e != NULL && e->button() == Qt::LeftButton && e->type() == QMouseEvent::MouseButtonRelease))
|
if((e != NULL && e->button() == Qt::LeftButton && e->type() == QMouseEvent::MouseButtonRelease))
|
||||||
{
|
{
|
||||||
|
|
||||||
QStyleOptionButton buttonOption;
|
QStyleOptionButton buttonOption;
|
||||||
buttonOption.rect = option.rect;
|
buttonOption.rect = option.rect;
|
||||||
buttonOption.rect.adjust(option.rect.width()/2-32,2,-(option.rect.width()/2-32),-2);
|
buttonOption.rect.adjust(option.rect.width()/2-32,2,-(option.rect.width()/2-32),-2);
|
||||||
QRect rect = buttonOption.rect;
|
QRect rect = buttonOption.rect;
|
||||||
|
|
||||||
if(rect.contains(e->pos()))
|
if(rect.contains(e->pos()))
|
||||||
{
|
{
|
||||||
LOGDEBUG("选点---------------------------------111111-----------------");
|
LOGDEBUG("选点---------------------------------111111-----------------");
|
||||||
emit sigselectPoint(info);
|
emit sigselectPoint(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,28 +1,28 @@
|
|||||||
#ifndef ALARMCALCPARATABLEDELEGATE_H
|
#ifndef ALARMCALCPARATABLEDELEGATE_H
|
||||||
#define ALARMCALCPARATABLEDELEGATE_H
|
#define ALARMCALCPARATABLEDELEGATE_H
|
||||||
|
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
#include <AlarmCalcParaTableModel.h>
|
#include <AlarmCalcParaTableModel.h>
|
||||||
|
|
||||||
|
|
||||||
class AlarmCalcParaTableDelegate : public QStyledItemDelegate
|
class AlarmCalcParaTableDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AlarmCalcParaTableDelegate(AlarmCalcParaTableModel *model, QObject *parent = 0);
|
AlarmCalcParaTableDelegate(AlarmCalcParaTableModel *model, QObject *parent = 0);
|
||||||
|
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
bool editorEvent(QEvent *event, QAbstractItemModel *model,
|
bool editorEvent(QEvent *event, QAbstractItemModel *model,
|
||||||
const QStyleOptionViewItem &option, const QModelIndex &index) Q_DECL_OVERRIDE;
|
const QStyleOptionViewItem &option, const QModelIndex &index) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigViewUpdate();
|
void sigViewUpdate();
|
||||||
|
|
||||||
void sigselectPoint(AlarmCalcInfoPtr info);
|
void sigselectPoint(AlarmCalcInfoPtr info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AlarmCalcParaTableModel * m_pModel;
|
AlarmCalcParaTableModel * m_pModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALARMCALCPARATABLEDELEGATE_H
|
#endif // ALARMCALCPARATABLEDELEGATE_H
|
||||||
|
|||||||
@ -1,122 +1,122 @@
|
|||||||
#include "AlarmCalcParaTableModel.h"
|
#include "AlarmCalcParaTableModel.h"
|
||||||
|
|
||||||
AlarmCalcParaTableModel::AlarmCalcParaTableModel(QObject *parent,QTableView *view)
|
AlarmCalcParaTableModel::AlarmCalcParaTableModel(QObject *parent,QTableView *view)
|
||||||
: m_view(view),
|
: m_view(view),
|
||||||
QAbstractTableModel(parent)
|
QAbstractTableModel(parent)
|
||||||
{
|
{
|
||||||
m_header <<tr("参数名称")<<tr("参数标签")<<tr("操作");
|
m_header <<tr("参数名称")<<tr("参数标签")<<tr("操作");
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant AlarmCalcParaTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant AlarmCalcParaTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
|
if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
|
||||||
{
|
{
|
||||||
return m_header.at(section);
|
return m_header.at(section);
|
||||||
}
|
}
|
||||||
return QAbstractTableModel::headerData(section,orientation,role);
|
return QAbstractTableModel::headerData(section,orientation,role);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AlarmCalcParaTableModel::rowCount(const QModelIndex &parent) const
|
int AlarmCalcParaTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return m_list.count();
|
return m_list.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AlarmCalcParaTableModel::columnCount(const QModelIndex &parent) const
|
int AlarmCalcParaTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return m_header.size();
|
return m_header.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant AlarmCalcParaTableModel::data(const QModelIndex &index, int role) const
|
QVariant AlarmCalcParaTableModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if(role == Qt::TextAlignmentRole)
|
if(role == Qt::TextAlignmentRole)
|
||||||
{
|
{
|
||||||
return QVariant(Qt::AlignCenter);
|
return QVariant(Qt::AlignCenter);
|
||||||
}else if(role == Qt::DisplayRole || role == Qt::EditRole)
|
}else if(role == Qt::DisplayRole || role == Qt::EditRole)
|
||||||
{
|
{
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case 0:
|
case 0:
|
||||||
return m_list.at(index.row())->m_strTip;
|
return m_list.at(index.row())->m_strTip;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
return m_list.at(index.row())->m_tag;
|
return m_list.at(index.row())->m_tag;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlarmCalcParaTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
bool AlarmCalcParaTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
{
|
{
|
||||||
if ( role == Qt::EditRole )
|
if ( role == Qt::EditRole )
|
||||||
{
|
{
|
||||||
int nCol = index.column();
|
int nCol = index.column();
|
||||||
if ( value.toString() == "" )
|
if ( value.toString() == "" )
|
||||||
return false;
|
return false;
|
||||||
switch ( nCol )
|
switch ( nCol )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
if ( m_list.at(index.row())->m_tag != value.toString() )
|
if ( m_list.at(index.row())->m_tag != value.toString() )
|
||||||
{
|
{
|
||||||
m_list.at(index.row())->m_tag = value.toString();
|
m_list.at(index.row())->m_tag = value.toString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags AlarmCalcParaTableModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags AlarmCalcParaTableModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
{
|
{
|
||||||
return Qt::NoItemFlags;
|
return Qt::NoItemFlags;
|
||||||
}
|
}
|
||||||
if(index.column() == 1)
|
if(index.column() == 1)
|
||||||
{
|
{
|
||||||
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
|
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
return QAbstractTableModel::flags(index);
|
return QAbstractTableModel::flags(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AlarmCalcInfoPtr AlarmCalcParaTableModel::getCalcParaInfo(const QModelIndex &index)
|
AlarmCalcInfoPtr AlarmCalcParaTableModel::getCalcParaInfo(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if(m_list.count()>index.row())
|
if(m_list.count()>index.row())
|
||||||
{
|
{
|
||||||
return m_list.value(index.row());
|
return m_list.value(index.row());
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmCalcParaTableModel::slotChangePara(QList<AlarmCalcInfoPtr> paraList)
|
void AlarmCalcParaTableModel::slotChangePara(QList<AlarmCalcInfoPtr> paraList)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_list.clear();
|
m_list.clear();
|
||||||
m_list = paraList;
|
m_list = paraList;
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmCalcParaTableModel::slotClearPara()
|
void AlarmCalcParaTableModel::slotClearPara()
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_list.clear();
|
m_list.clear();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,38 +1,38 @@
|
|||||||
#ifndef ALARMCALCPARATABLEMODEL_H
|
#ifndef ALARMCALCPARATABLEMODEL_H
|
||||||
#define ALARMCALCPARATABLEMODEL_H
|
#define ALARMCALCPARATABLEMODEL_H
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include "AlarmCalcInfo.h"
|
#include "AlarmCalcInfo.h"
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
|
|
||||||
class AlarmCalcParaTableModel : public QAbstractTableModel
|
class AlarmCalcParaTableModel : public QAbstractTableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AlarmCalcParaTableModel(QObject *parent = nullptr,QTableView *view = Q_NULLPTR);
|
explicit AlarmCalcParaTableModel(QObject *parent = nullptr,QTableView *view = Q_NULLPTR);
|
||||||
|
|
||||||
// Header:
|
// Header:
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
// Basic functionality:
|
// Basic functionality:
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(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;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
|
bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
|
Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
|
||||||
AlarmCalcInfoPtr getCalcParaInfo(const QModelIndex &index);
|
AlarmCalcInfoPtr getCalcParaInfo(const QModelIndex &index);
|
||||||
public slots:
|
public slots:
|
||||||
void slotChangePara(QList<AlarmCalcInfoPtr> paraList);
|
void slotChangePara(QList<AlarmCalcInfoPtr> paraList);
|
||||||
|
|
||||||
void slotClearPara();
|
void slotClearPara();
|
||||||
private:
|
private:
|
||||||
QTableView *m_view;
|
QTableView *m_view;
|
||||||
QStringList m_header;
|
QStringList m_header;
|
||||||
QList<AlarmCalcInfoPtr> m_list;
|
QList<AlarmCalcInfoPtr> m_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALARMCALCPARATABLEMODEL_H
|
#endif // ALARMCALCPARATABLEMODEL_H
|
||||||
|
|||||||
@ -1,233 +1,233 @@
|
|||||||
#include "AlarmDevTreeModel.h"
|
#include "AlarmDevTreeModel.h"
|
||||||
#include "AlarmDevTreeView.h"
|
#include "AlarmDevTreeView.h"
|
||||||
#include "QTreeWidgetItem"
|
#include "QTreeWidgetItem"
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include "AlarmMng.h"
|
#include "AlarmMng.h"
|
||||||
|
|
||||||
AlarmDevTreeModel::AlarmDevTreeModel(QObject *parent,QTreeView *view)
|
AlarmDevTreeModel::AlarmDevTreeModel(QObject *parent,QTreeView *view)
|
||||||
: QAbstractItemModel(parent),
|
: QAbstractItemModel(parent),
|
||||||
m_pView(view),
|
m_pView(view),
|
||||||
m_isLink(false),
|
m_isLink(false),
|
||||||
m_root(Q_NULLPTR)
|
m_root(Q_NULLPTR)
|
||||||
{
|
{
|
||||||
m_root = new QTreeWidgetItem();
|
m_root = new QTreeWidgetItem();
|
||||||
m_devTypeMap = AlarmMng::instance()->getDevType();
|
m_devTypeMap = AlarmMng::instance()->getDevType();
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
AlarmDevTreeModel::~AlarmDevTreeModel()
|
AlarmDevTreeModel::~AlarmDevTreeModel()
|
||||||
{
|
{
|
||||||
if(Q_NULLPTR != m_root)
|
if(Q_NULLPTR != m_root)
|
||||||
{
|
{
|
||||||
delete m_root;
|
delete m_root;
|
||||||
}
|
}
|
||||||
m_root = Q_NULLPTR;
|
m_root = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant AlarmDevTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant AlarmDevTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(section)
|
Q_UNUSED(section)
|
||||||
Q_UNUSED(role)
|
Q_UNUSED(role)
|
||||||
if(role == Qt::DisplayRole)
|
if(role == Qt::DisplayRole)
|
||||||
{
|
{
|
||||||
if(orientation == Qt::Horizontal)
|
if(orientation == Qt::Horizontal)
|
||||||
{
|
{
|
||||||
return QVariant(tr("位置/设备组"));
|
return QVariant(tr("位置/设备组"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex AlarmDevTreeModel::index(int row, int column, const QModelIndex &parent) const
|
QModelIndex AlarmDevTreeModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if(!hasIndex(row, column, parent) || Q_NULLPTR == m_root)
|
if(!hasIndex(row, column, parent) || Q_NULLPTR == m_root)
|
||||||
{
|
{
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem * parentItem;
|
QTreeWidgetItem * parentItem;
|
||||||
if(!parent.isValid())
|
if(!parent.isValid())
|
||||||
{
|
{
|
||||||
parentItem = m_root;
|
parentItem = m_root;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parentItem = static_cast<QTreeWidgetItem*>(parent.internalPointer());
|
parentItem = static_cast<QTreeWidgetItem*>(parent.internalPointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(parentItem)
|
if(parentItem)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *childItem = parentItem->child(row);
|
QTreeWidgetItem *childItem = parentItem->child(row);
|
||||||
if(childItem)
|
if(childItem)
|
||||||
{
|
{
|
||||||
return createIndex(row,0,childItem);
|
return createIndex(row,0,childItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex AlarmDevTreeModel::parent(const QModelIndex &index) const
|
QModelIndex AlarmDevTreeModel::parent(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
{
|
{
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *childItem = static_cast<QTreeWidgetItem*>(index.internalPointer());
|
QTreeWidgetItem *childItem = static_cast<QTreeWidgetItem*>(index.internalPointer());
|
||||||
if (!childItem)
|
if (!childItem)
|
||||||
{
|
{
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *parentItem = childItem->parent();
|
QTreeWidgetItem *parentItem = childItem->parent();
|
||||||
|
|
||||||
if (parentItem == m_root)
|
if (parentItem == m_root)
|
||||||
{
|
{
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
int row = parentItem->parent()->indexOfChild(parentItem);
|
int row = parentItem->parent()->indexOfChild(parentItem);
|
||||||
return createIndex(row, 0, parentItem);
|
return createIndex(row, 0, parentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AlarmDevTreeModel::rowCount(const QModelIndex &parent) const
|
int AlarmDevTreeModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if(!parent.isValid())
|
if(!parent.isValid())
|
||||||
{
|
{
|
||||||
if (NULL != m_root)
|
if (NULL != m_root)
|
||||||
{
|
{
|
||||||
return m_root->childCount();
|
return m_root->childCount();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QTreeWidgetItem * parentItem = static_cast<QTreeWidgetItem*>(parent.internalPointer());
|
QTreeWidgetItem * parentItem = static_cast<QTreeWidgetItem*>(parent.internalPointer());
|
||||||
return parentItem->childCount();
|
return parentItem->childCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int AlarmDevTreeModel::columnCount(const QModelIndex &parent) const
|
int AlarmDevTreeModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant AlarmDevTreeModel::data(const QModelIndex &index, int role) const
|
QVariant AlarmDevTreeModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
QTreeWidgetItem * item = static_cast<QTreeWidgetItem*>(index.internalPointer());
|
QTreeWidgetItem * item = static_cast<QTreeWidgetItem*>(index.internalPointer());
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
return item->data(index.column(), role);
|
return item->data(index.column(), role);
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags AlarmDevTreeModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags AlarmDevTreeModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
{
|
{
|
||||||
return Qt::NoItemFlags;
|
return Qt::NoItemFlags;
|
||||||
}
|
}
|
||||||
if(index.column()==0)
|
if(index.column()==0)
|
||||||
{
|
{
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmDevTreeModel::setFilter(QString text)
|
void AlarmDevTreeModel::setFilter(QString text)
|
||||||
{
|
{
|
||||||
m_fltText = text.toStdString();
|
m_fltText = text.toStdString();
|
||||||
updateDevTreeNodeStatus();
|
updateDevTreeNodeStatus();
|
||||||
m_pView->viewport()->update();
|
m_pView->viewport()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmDevTreeModel::init()
|
void AlarmDevTreeModel::init()
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
QList<int> locList = AlarmMng::instance()->getLocOrder();
|
QList<int> locList = AlarmMng::instance()->getLocOrder();
|
||||||
foreach (const int loc, locList) {
|
foreach (const int loc, locList) {
|
||||||
QString locdesc = AlarmMng::instance()->getLocDescById(loc);
|
QString locdesc = AlarmMng::instance()->getLocDescById(loc);
|
||||||
QList<QString> devgList = AlarmMng::instance()->getDevGroupInfo(loc);
|
QList<QString> devgList = AlarmMng::instance()->getDevGroupInfo(loc);
|
||||||
if(devgList.isEmpty())
|
if(devgList.isEmpty())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QTreeWidgetItem * locItem = new QTreeWidgetItem(m_root, QStringList() << locdesc);
|
QTreeWidgetItem * locItem = new QTreeWidgetItem(m_root, QStringList() << locdesc);
|
||||||
locItem->setData(0, Qt::UserRole, loc);
|
locItem->setData(0, Qt::UserRole, loc);
|
||||||
locItem->setData(0, Qt::UserRole+1,LOCATION_TYPE);
|
locItem->setData(0, Qt::UserRole+1,LOCATION_TYPE);
|
||||||
locItem->setData(0, Qt::UserRole+2,locdesc);
|
locItem->setData(0, Qt::UserRole+2,locdesc);
|
||||||
for(int index(0);index<devgList.count();index++)
|
for(int index(0);index<devgList.count();index++)
|
||||||
{
|
{
|
||||||
QString devgdesc = AlarmMng::instance()->getDevgDescByTag(devgList.at(index));
|
QString devgdesc = AlarmMng::instance()->getDevgDescByTag(devgList.at(index));
|
||||||
QTreeWidgetItem * devgItem = new QTreeWidgetItem(locItem, QStringList() << devgdesc);
|
QTreeWidgetItem * devgItem = new QTreeWidgetItem(locItem, QStringList() << devgdesc);
|
||||||
devgItem->setData(0, Qt::UserRole, devgList.at(index));
|
devgItem->setData(0, Qt::UserRole, devgList.at(index));
|
||||||
devgItem->setData(0, Qt::UserRole+1,DEV_GROUP_TYPE);
|
devgItem->setData(0, Qt::UserRole+1,DEV_GROUP_TYPE);
|
||||||
devgItem->setData(0, Qt::UserRole+2,devgdesc);
|
devgItem->setData(0, Qt::UserRole+2,devgdesc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmDevTreeModel::updateDevTreeNodeStatus()
|
void AlarmDevTreeModel::updateDevTreeNodeStatus()
|
||||||
{
|
{
|
||||||
if(!m_root)
|
if(!m_root)
|
||||||
{
|
{
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
if(m_fltText.empty())
|
if(m_fltText.empty())
|
||||||
{
|
{
|
||||||
for(int nIndex(0); nIndex<rowCount(); nIndex++)
|
for(int nIndex(0); nIndex<rowCount(); nIndex++)
|
||||||
{
|
{
|
||||||
setAllChildShow(index(nIndex, 0));
|
setAllChildShow(index(nIndex, 0));
|
||||||
}
|
}
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
for(int locIndex(0);locIndex<rowCount();locIndex++)
|
for(int locIndex(0);locIndex<rowCount();locIndex++)
|
||||||
{
|
{
|
||||||
QModelIndex locModelIndex = index(locIndex,0);
|
QModelIndex locModelIndex = index(locIndex,0);
|
||||||
std::string strLoc = data(locModelIndex, Qt::UserRole+2).toString().toStdString();
|
std::string strLoc = data(locModelIndex, Qt::UserRole+2).toString().toStdString();
|
||||||
if(strLoc.find(m_fltText, 0) == -1)
|
if(strLoc.find(m_fltText, 0) == -1)
|
||||||
{
|
{
|
||||||
bool isShow = false;
|
bool isShow = false;
|
||||||
for(int devgIndex(0);devgIndex<rowCount(locModelIndex);devgIndex++)
|
for(int devgIndex(0);devgIndex<rowCount(locModelIndex);devgIndex++)
|
||||||
{
|
{
|
||||||
QModelIndex devgModelIndex = index(devgIndex, 0, locModelIndex);
|
QModelIndex devgModelIndex = index(devgIndex, 0, locModelIndex);
|
||||||
std::string stdDevgDesc = data(devgModelIndex, Qt::UserRole+2).toString().toStdString();
|
std::string stdDevgDesc = data(devgModelIndex, Qt::UserRole+2).toString().toStdString();
|
||||||
if(stdDevgDesc.find(m_fltText, 0) != -1)
|
if(stdDevgDesc.find(m_fltText, 0) != -1)
|
||||||
{
|
{
|
||||||
m_pView->setRowHidden(devgIndex,locModelIndex,false);
|
m_pView->setRowHidden(devgIndex,locModelIndex,false);
|
||||||
isShow = true;
|
isShow = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pView->setRowHidden(devgIndex,locModelIndex,true);
|
m_pView->setRowHidden(devgIndex,locModelIndex,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_pView->setRowHidden(locIndex, parent(locModelIndex), !isShow);
|
m_pView->setRowHidden(locIndex, parent(locModelIndex), !isShow);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setAllChildShow(locModelIndex);
|
setAllChildShow(locModelIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmDevTreeModel::setAllChildShow(const QModelIndex &parent)
|
void AlarmDevTreeModel::setAllChildShow(const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
m_pView->setRowHidden(parent.row(), parent.parent(), false);
|
m_pView->setRowHidden(parent.row(), parent.parent(), false);
|
||||||
int childCount = rowCount(parent);
|
int childCount = rowCount(parent);
|
||||||
for(int nIndex(0); nIndex < childCount; nIndex++)
|
for(int nIndex(0); nIndex < childCount; nIndex++)
|
||||||
{
|
{
|
||||||
m_pView->setRowHidden(nIndex, parent, false);
|
m_pView->setRowHidden(nIndex, parent, false);
|
||||||
setAllChildShow(index(nIndex, 0, parent));
|
setAllChildShow(index(nIndex, 0, parent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,73 +1,73 @@
|
|||||||
#ifndef ALARMDEVTREEMODEL_H
|
#ifndef ALARMDEVTREEMODEL_H
|
||||||
#define ALARMDEVTREEMODEL_H
|
#define ALARMDEVTREEMODEL_H
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
class AlarmDevTreeView;
|
class AlarmDevTreeView;
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
class QTreeView;
|
class QTreeView;
|
||||||
|
|
||||||
|
|
||||||
enum EN_ALARM_DEV_TREE_NODE
|
enum EN_ALARM_DEV_TREE_NODE
|
||||||
{
|
{
|
||||||
ROOT_TYPE = 0,
|
ROOT_TYPE = 0,
|
||||||
LOCATION_TYPE,
|
LOCATION_TYPE,
|
||||||
DEV_GROUP_TYPE,
|
DEV_GROUP_TYPE,
|
||||||
DEV_TYPE
|
DEV_TYPE
|
||||||
};
|
};
|
||||||
|
|
||||||
class AlarmDevTreeModel : public QAbstractItemModel
|
class AlarmDevTreeModel : public QAbstractItemModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AlarmDevTreeModel(QObject *parent = Q_NULLPTR, QTreeView *view = Q_NULLPTR);
|
explicit AlarmDevTreeModel(QObject *parent = Q_NULLPTR, QTreeView *view = Q_NULLPTR);
|
||||||
~AlarmDevTreeModel();
|
~AlarmDevTreeModel();
|
||||||
// Header:
|
// Header:
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
// Basic functionality:
|
// Basic functionality:
|
||||||
QModelIndex index(int row, int column,
|
QModelIndex index(int row, int column,
|
||||||
const QModelIndex &parent = QModelIndex()) const override;
|
const QModelIndex &parent = QModelIndex()) const override;
|
||||||
QModelIndex parent(const QModelIndex &index) const override;
|
QModelIndex parent(const QModelIndex &index) const override;
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(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;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
|
|
||||||
void setFilter(QString text);
|
void setFilter(QString text);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void itemCheckStateChanged(QStringList tagList,bool checked);
|
void itemCheckStateChanged(QStringList tagList,bool checked);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void setChildCheck(QTreeWidgetItem *item);
|
void setChildCheck(QTreeWidgetItem *item);
|
||||||
|
|
||||||
void setParentCheck(QTreeWidgetItem *item);
|
void setParentCheck(QTreeWidgetItem *item);
|
||||||
|
|
||||||
void updateDevTreeNodeStatus();
|
void updateDevTreeNodeStatus();
|
||||||
|
|
||||||
void setAllChildShow(const QModelIndex &parent);
|
void setAllChildShow(const QModelIndex &parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTreeView *m_pView;
|
QTreeView *m_pView;
|
||||||
|
|
||||||
QStringList m_header;
|
QStringList m_header;
|
||||||
|
|
||||||
QTreeWidgetItem *m_root;
|
QTreeWidgetItem *m_root;
|
||||||
|
|
||||||
bool m_isLink;
|
bool m_isLink;
|
||||||
|
|
||||||
std::string m_fltText;
|
std::string m_fltText;
|
||||||
|
|
||||||
QMap<QString,QString> m_devTypeMap;
|
QMap<QString,QString> m_devTypeMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALARMDEVTREEMODEL_H
|
#endif // ALARMDEVTREEMODEL_H
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include "AlarmDevTreeView.h"
|
#include "AlarmDevTreeView.h"
|
||||||
|
|
||||||
AlarmDevTreeView::AlarmDevTreeView(QWidget *parent)
|
AlarmDevTreeView::AlarmDevTreeView(QWidget *parent)
|
||||||
:QTreeView(parent)
|
:QTreeView(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
#ifndef ALARMDEVTREEVIEW_H
|
#ifndef ALARMDEVTREEVIEW_H
|
||||||
#define ALARMDEVTREEVIEW_H
|
#define ALARMDEVTREEVIEW_H
|
||||||
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
class AlarmDevTreeView : public QTreeView
|
class AlarmDevTreeView : public QTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AlarmDevTreeView(QWidget *parent = Q_NULLPTR);
|
AlarmDevTreeView(QWidget *parent = Q_NULLPTR);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALARMDEVTREEVIEW_H
|
#endif // ALARMDEVTREEVIEW_H
|
||||||
|
|||||||
@ -1,75 +1,75 @@
|
|||||||
#ifndef ALARMMANAGECOMMON_H
|
#ifndef ALARMMANAGECOMMON_H
|
||||||
#define ALARMMANAGECOMMON_H
|
#define ALARMMANAGECOMMON_H
|
||||||
#include<QString>
|
#include<QString>
|
||||||
|
|
||||||
enum EN_POINT_TYPE_INDEX
|
enum EN_POINT_TYPE_INDEX
|
||||||
{
|
{
|
||||||
EN_POINT_AI_INDEX =0,
|
EN_POINT_AI_INDEX =0,
|
||||||
EN_POINT_DI_INDEX =1
|
EN_POINT_DI_INDEX =1
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ST_OBJ_INFO
|
struct ST_OBJ_INFO
|
||||||
{
|
{
|
||||||
bool bIsObj;
|
bool bIsObj;
|
||||||
int iPriority;
|
int iPriority;
|
||||||
QString strPushPic;
|
QString strPushPic;
|
||||||
QString strVoice;
|
QString strVoice;
|
||||||
ST_OBJ_INFO()
|
ST_OBJ_INFO()
|
||||||
{
|
{
|
||||||
bIsObj = false;
|
bIsObj = false;
|
||||||
iPriority = 0;
|
iPriority = 0;
|
||||||
strPushPic =QString();
|
strPushPic =QString();
|
||||||
strVoice = QString();
|
strVoice = QString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ST_LIMIT_INFO
|
struct ST_LIMIT_INFO
|
||||||
{
|
{
|
||||||
bool bIsLimit;
|
bool bIsLimit;
|
||||||
int iLevel; // 0,1,2
|
int iLevel; // 0,1,2
|
||||||
double dLimitUp1;
|
double dLimitUp1;
|
||||||
double dLimitDown1;
|
double dLimitDown1;
|
||||||
double dLimitUp2;
|
double dLimitUp2;
|
||||||
double dLimitDown2;
|
double dLimitDown2;
|
||||||
ST_LIMIT_INFO()
|
ST_LIMIT_INFO()
|
||||||
{
|
{
|
||||||
bIsLimit =false;
|
bIsLimit =false;
|
||||||
iLevel =0;
|
iLevel =0;
|
||||||
dLimitUp1 = 0.0;
|
dLimitUp1 = 0.0;
|
||||||
dLimitDown1 = 0.0;
|
dLimitDown1 = 0.0;
|
||||||
dLimitUp2 = 0.0;
|
dLimitUp2 = 0.0;
|
||||||
dLimitDown2 = 0.0;
|
dLimitDown2 = 0.0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct ST_USER_DEF
|
struct ST_USER_DEF
|
||||||
{
|
{
|
||||||
int iId;
|
int iId;
|
||||||
QString strName;
|
QString strName;
|
||||||
QString strAlias;
|
QString strAlias;
|
||||||
QString strDesc;
|
QString strDesc;
|
||||||
ST_USER_DEF() {
|
ST_USER_DEF() {
|
||||||
|
|
||||||
iId = -1;
|
iId = -1;
|
||||||
strName = QString();
|
strName = QString();
|
||||||
strAlias= QString();
|
strAlias= QString();
|
||||||
strDesc = QString();
|
strDesc = QString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ST_DEV_INFO
|
struct ST_DEV_INFO
|
||||||
{
|
{
|
||||||
QString strDev;
|
QString strDev;
|
||||||
QString strDevDesc;
|
QString strDevDesc;
|
||||||
int nLocId;
|
int nLocId;
|
||||||
int nSubId;
|
int nSubId;
|
||||||
int nDevType;
|
int nDevType;
|
||||||
ST_DEV_INFO()
|
ST_DEV_INFO()
|
||||||
{
|
{
|
||||||
strDev = QString();
|
strDev = QString();
|
||||||
strDevDesc = QString();
|
strDevDesc = QString();
|
||||||
nLocId = -1;
|
nLocId = -1;
|
||||||
nSubId = -1;
|
nSubId = -1;
|
||||||
nDevType = -1;
|
nDevType = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif // ALARMMANAGECOMMON_H
|
#endif // ALARMMANAGECOMMON_H
|
||||||
|
|||||||
@ -1,84 +1,84 @@
|
|||||||
#include "AlarmManageForm.h"
|
#include "AlarmManageForm.h"
|
||||||
#include "ui_AlarmManageForm.h"
|
#include "ui_AlarmManageForm.h"
|
||||||
|
|
||||||
#include "AlarmManageWidget.h"
|
#include "AlarmManageWidget.h"
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include "net_msg_bus_api/MsgBusApi.h"
|
#include "net_msg_bus_api/MsgBusApi.h"
|
||||||
#include "pub_logger_api/logger.h"
|
#include "pub_logger_api/logger.h"
|
||||||
#include "pub_utility_api/FileStyle.h"
|
#include "pub_utility_api/FileStyle.h"
|
||||||
|
|
||||||
AlarmManageForm::AlarmManageForm(QWidget *parent,bool edit) :
|
AlarmManageForm::AlarmManageForm(QWidget *parent,bool edit) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
m_bEdit(edit),
|
m_bEdit(edit),
|
||||||
m_alarmWidget(Q_NULLPTR),
|
m_alarmWidget(Q_NULLPTR),
|
||||||
ui(new Ui::AlarmManageForm)
|
ui(new Ui::AlarmManageForm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
QString qss = QString();
|
QString qss = QString();
|
||||||
|
|
||||||
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
std::string strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("public.qss") ;
|
||||||
QFile qssfile1(QString::fromStdString(strFullPath));
|
QFile qssfile1(QString::fromStdString(strFullPath));
|
||||||
qssfile1.open(QFile::ReadOnly);
|
qssfile1.open(QFile::ReadOnly);
|
||||||
if (qssfile1.isOpen())
|
if (qssfile1.isOpen())
|
||||||
{
|
{
|
||||||
qss += QLatin1String(qssfile1.readAll());
|
qss += QLatin1String(qssfile1.readAll());
|
||||||
//setStyleSheet(qss);
|
//setStyleSheet(qss);
|
||||||
qssfile1.close();
|
qssfile1.close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "public.qss 无法打开!";
|
qDebug() << "public.qss 无法打开!";
|
||||||
}
|
}
|
||||||
|
|
||||||
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarmmng.qss") ;
|
strFullPath = kbd_public::CFileStyle::getPathOfStyleFile("alarmmng.qss") ;
|
||||||
QFile qssfile2(QString::fromStdString(strFullPath));
|
QFile qssfile2(QString::fromStdString(strFullPath));
|
||||||
qssfile2.open(QFile::ReadOnly);
|
qssfile2.open(QFile::ReadOnly);
|
||||||
if (qssfile2.isOpen())
|
if (qssfile2.isOpen())
|
||||||
{
|
{
|
||||||
qss += QLatin1String(qssfile2.readAll());
|
qss += QLatin1String(qssfile2.readAll());
|
||||||
//setStyleSheet(qss);
|
//setStyleSheet(qss);
|
||||||
qssfile2.close();
|
qssfile2.close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "alarmmng.qss 无法打开!";
|
qDebug() << "alarmmng.qss 无法打开!";
|
||||||
}
|
}
|
||||||
if(!qss.isEmpty())
|
if(!qss.isEmpty())
|
||||||
{
|
{
|
||||||
setStyleSheet(qss);
|
setStyleSheet(qss);
|
||||||
}
|
}
|
||||||
initLayout();
|
initLayout();
|
||||||
initMember();
|
initMember();
|
||||||
}
|
}
|
||||||
|
|
||||||
AlarmManageForm::~AlarmManageForm()
|
AlarmManageForm::~AlarmManageForm()
|
||||||
{
|
{
|
||||||
if(m_alarmWidget)
|
if(m_alarmWidget)
|
||||||
{
|
{
|
||||||
delete m_alarmWidget;
|
delete m_alarmWidget;
|
||||||
m_alarmWidget = NULL;
|
m_alarmWidget = NULL;
|
||||||
}
|
}
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmManageForm::initLayout()
|
void AlarmManageForm::initLayout()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmManageForm::initMember()
|
void AlarmManageForm::initMember()
|
||||||
{
|
{
|
||||||
if(m_alarmWidget == NULL)
|
if(m_alarmWidget == NULL)
|
||||||
{
|
{
|
||||||
m_alarmWidget = new AlarmManageWidget(this,m_bEdit);
|
m_alarmWidget = new AlarmManageWidget(this,m_bEdit);
|
||||||
addWidget();
|
addWidget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmManageForm::addWidget()
|
void AlarmManageForm::addWidget()
|
||||||
{
|
{
|
||||||
QGridLayout *gridLayout = new QGridLayout(ui->widget);
|
QGridLayout *gridLayout = new QGridLayout(ui->widget);
|
||||||
gridLayout->setSpacing(6);
|
gridLayout->setSpacing(6);
|
||||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
gridLayout->addWidget(m_alarmWidget, 0, 0, 1, 1);
|
gridLayout->addWidget(m_alarmWidget, 0, 0, 1, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +1,32 @@
|
|||||||
#ifndef ALARMMANAGEFORM_H
|
#ifndef ALARMMANAGEFORM_H
|
||||||
#define ALARMMANAGEFORM_H
|
#define ALARMMANAGEFORM_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AlarmManageForm;
|
class AlarmManageForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AlarmManageForm : public QWidget
|
class AlarmManageForm : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AlarmManageForm(QWidget *parent = 0, bool edit = false);
|
explicit AlarmManageForm(QWidget *parent = 0, bool edit = false);
|
||||||
~AlarmManageForm();
|
~AlarmManageForm();
|
||||||
|
|
||||||
void initLayout();
|
void initLayout();
|
||||||
|
|
||||||
void initMember();
|
void initMember();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addWidget();
|
void addWidget();
|
||||||
private:
|
private:
|
||||||
Ui::AlarmManageForm *ui;
|
Ui::AlarmManageForm *ui;
|
||||||
|
|
||||||
QWidget *m_alarmWidget;
|
QWidget *m_alarmWidget;
|
||||||
|
|
||||||
bool m_bEdit;
|
bool m_bEdit;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALARMMANAGEFORM_H
|
#endif // ALARMMANAGEFORM_H
|
||||||
|
|||||||
@ -1,36 +1,36 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>AlarmManageForm</class>
|
<class>AlarmManageForm</class>
|
||||||
<widget class="QWidget" name="AlarmManageForm">
|
<widget class="QWidget" name="AlarmManageForm">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1157</width>
|
<width>1157</width>
|
||||||
<height>610</height>
|
<height>610</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QWidget" name="widget" native="true"/>
|
<widget class="QWidget" name="widget" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -1,25 +1,25 @@
|
|||||||
#include "AlarmManagePluginWidget.h"
|
#include "AlarmManagePluginWidget.h"
|
||||||
#include "AlarmManageForm.h"
|
#include "AlarmManageForm.h"
|
||||||
AlarmManagePluginWidget::AlarmManagePluginWidget(QObject *parent): QObject(parent)
|
AlarmManagePluginWidget::AlarmManagePluginWidget(QObject *parent): QObject(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AlarmManagePluginWidget::~AlarmManagePluginWidget()
|
AlarmManagePluginWidget::~AlarmManagePluginWidget()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlarmManagePluginWidget::createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec)
|
bool AlarmManagePluginWidget::createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec)
|
||||||
{
|
{
|
||||||
Q_UNUSED(ptrVec)
|
Q_UNUSED(ptrVec)
|
||||||
AlarmManageForm *pWidget = new AlarmManageForm(parent, editMode);
|
AlarmManageForm *pWidget = new AlarmManageForm(parent, editMode);
|
||||||
*widget = (QWidget *)pWidget;
|
*widget = (QWidget *)pWidget;
|
||||||
*alarmWidget = (IPluginWidget *)pWidget;
|
*alarmWidget = (IPluginWidget *)pWidget;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmManagePluginWidget::release()
|
void AlarmManagePluginWidget::release()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +1,22 @@
|
|||||||
#ifndef ALARMMANAGEPLUGINWIDGET_H
|
#ifndef ALARMMANAGEPLUGINWIDGET_H
|
||||||
#define ALARMMANAGEPLUGINWIDGET_H
|
#define ALARMMANAGEPLUGINWIDGET_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "GraphShape/CPluginWidget.h" //< ISCS6000_HOME/platform/src/include/gui/GraphShape
|
#include "GraphShape/CPluginWidget.h" //< ISCS6000_HOME/platform/src/include/gui/GraphShape
|
||||||
|
|
||||||
|
|
||||||
class AlarmManagePluginWidget : public QObject, public CPluginWidgetInterface
|
class AlarmManagePluginWidget : public QObject, public CPluginWidgetInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
Q_PLUGIN_METADATA(IID "kbd.PluginWidgetInterface/1.0")
|
||||||
Q_INTERFACES(CPluginWidgetInterface)
|
Q_INTERFACES(CPluginWidgetInterface)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AlarmManagePluginWidget(QObject *parent = 0);
|
AlarmManagePluginWidget(QObject *parent = 0);
|
||||||
~AlarmManagePluginWidget();
|
~AlarmManagePluginWidget();
|
||||||
|
|
||||||
bool createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec);
|
bool createWidget(QWidget *parent, bool editMode, QWidget **widget, IPluginWidget **alarmWidget, QVector<void *> ptrVec);
|
||||||
void release();
|
void release();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALARMMANAGEPLUGINWIDGET_H
|
#endif // ALARMMANAGEPLUGINWIDGET_H
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,146 +1,146 @@
|
|||||||
#ifndef ALARMMANAGEWIDGET_H
|
#ifndef ALARMMANAGEWIDGET_H
|
||||||
#define ALARMMANAGEWIDGET_H
|
#define ALARMMANAGEWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include "PointInfo.h"
|
#include "PointInfo.h"
|
||||||
#include "db_api_ex/CDbApi.h"
|
#include "db_api_ex/CDbApi.h"
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class AlarmDevTreeView;
|
class AlarmDevTreeView;
|
||||||
class AlarmDevTreeModel;
|
class AlarmDevTreeModel;
|
||||||
class QThread;
|
class QThread;
|
||||||
class AlarmPointTableModel;
|
class AlarmPointTableModel;
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AlarmManageWidget;
|
class AlarmManageWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AlarmManageWidget : public QWidget
|
class AlarmManageWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AlarmManageWidget(QWidget *parent = 0, bool editMode = false);
|
explicit AlarmManageWidget(QWidget *parent = 0, bool editMode = false);
|
||||||
~AlarmManageWidget();
|
~AlarmManageWidget();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigSelectPoint(const QString &devg,const int index,const QString &filter = "");
|
void sigSelectPoint(const QString &devg,const int index,const QString &filter = "");
|
||||||
|
|
||||||
void sigClearPointTable();
|
void sigClearPointTable();
|
||||||
private:
|
private:
|
||||||
void initLayout();
|
void initLayout();
|
||||||
|
|
||||||
void initMember();
|
void initMember();
|
||||||
|
|
||||||
void initModel();
|
void initModel();
|
||||||
|
|
||||||
void initData();
|
void initData();
|
||||||
|
|
||||||
bool initCurUser();
|
bool initCurUser();
|
||||||
|
|
||||||
void initConnect();
|
void initConnect();
|
||||||
|
|
||||||
void setEnableProperty(bool enable);
|
void setEnableProperty(bool enable);
|
||||||
|
|
||||||
void setEnableDesc(bool enable);
|
void setEnableDesc(bool enable);
|
||||||
|
|
||||||
void setEnableObjAlarm(bool enable);
|
void setEnableObjAlarm(bool enable);
|
||||||
|
|
||||||
void setEnableLimitAlarm(bool enable);
|
void setEnableLimitAlarm(bool enable);
|
||||||
|
|
||||||
void saveAi();
|
void saveAi();
|
||||||
|
|
||||||
void saveDi();
|
void saveDi();
|
||||||
|
|
||||||
void showShieldProperty();
|
void showShieldProperty();
|
||||||
|
|
||||||
void initView();
|
void initView();
|
||||||
|
|
||||||
void initProperty();
|
void initProperty();
|
||||||
|
|
||||||
void initHide();
|
void initHide();
|
||||||
|
|
||||||
void reLoadData(const QString &filter ="");
|
void reLoadData(const QString &filter ="");
|
||||||
|
|
||||||
void deleteAi();
|
void deleteAi();
|
||||||
|
|
||||||
void deleteDi();
|
void deleteDi();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void filter();
|
void filter();
|
||||||
|
|
||||||
void alarmActionCheckChange(int index);
|
void alarmActionCheckChange(int index);
|
||||||
|
|
||||||
void ifLimitChange(const QString & );
|
void ifLimitChange(const QString & );
|
||||||
|
|
||||||
void ifObjChange(const QString &);
|
void ifObjChange(const QString &);
|
||||||
|
|
||||||
void getPushPicPath();
|
void getPushPicPath();
|
||||||
|
|
||||||
void getVoicePath();
|
void getVoicePath();
|
||||||
|
|
||||||
void showAiAlarmProperty(const QModelIndex &cur);
|
void showAiAlarmProperty(const QModelIndex &cur);
|
||||||
|
|
||||||
void showDiAlarmProperty(const QModelIndex &cur);
|
void showDiAlarmProperty(const QModelIndex &cur);
|
||||||
|
|
||||||
void showAiProperty();
|
void showAiProperty();
|
||||||
|
|
||||||
void showDiProperty();
|
void showDiProperty();
|
||||||
|
|
||||||
void checkClick(const QModelIndex &index);
|
void checkClick(const QModelIndex &index);
|
||||||
|
|
||||||
void ifLimitLevelChange(const QString &);
|
void ifLimitLevelChange(const QString &);
|
||||||
|
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
bool checkAiIfSave();
|
bool checkAiIfSave();
|
||||||
|
|
||||||
void addObjAlarm();
|
void addObjAlarm();
|
||||||
|
|
||||||
void updateStack(int index);
|
void updateStack(int index);
|
||||||
|
|
||||||
void filterPoint();
|
void filterPoint();
|
||||||
|
|
||||||
void sigOrMul(int checked);
|
void sigOrMul(int checked);
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QContextMenuEvent *event);
|
void contextMenuEvent(QContextMenuEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AlarmManageWidget *ui;
|
Ui::AlarmManageWidget *ui;
|
||||||
|
|
||||||
QThread *m_pThread;
|
QThread *m_pThread;
|
||||||
|
|
||||||
AlarmDevTreeModel *m_pDevTreeModel;
|
AlarmDevTreeModel *m_pDevTreeModel;
|
||||||
AlarmPointTableModel * m_pAiPointTableModel;
|
AlarmPointTableModel * m_pAiPointTableModel;
|
||||||
AlarmPointTableModel * m_pDiPointTableModel;
|
AlarmPointTableModel * m_pDiPointTableModel;
|
||||||
QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作
|
QMap<int,QCheckBox*> m_alarmActionCheckMap;//选中的告警动作
|
||||||
|
|
||||||
QMap<int,QString > m_alarmActionMap; //告警动作
|
QMap<int,QString > m_alarmActionMap; //告警动作
|
||||||
QMap<int,int> m_alarmLevelActionMap; //等级--动作
|
QMap<int,int> m_alarmLevelActionMap; //等级--动作
|
||||||
QMap<int,QString> m_alarmLevelMap; //等级--等级描述
|
QMap<int,QString> m_alarmLevelMap; //等级--等级描述
|
||||||
|
|
||||||
QMap<int,int> m_alarmLevelIndexMap;
|
QMap<int,int> m_alarmLevelIndexMap;
|
||||||
|
|
||||||
kbd_dbms::CDbApi *m_pReadDb;
|
kbd_dbms::CDbApi *m_pReadDb;
|
||||||
kbd_dbms::CDbApi *m_pWriteDb;
|
kbd_dbms::CDbApi *m_pWriteDb;
|
||||||
|
|
||||||
int m_userId;
|
int m_userId;
|
||||||
int m_usergId;
|
int m_usergId;
|
||||||
|
|
||||||
QString m_hostName;
|
QString m_hostName;
|
||||||
|
|
||||||
QString m_devgName;
|
QString m_devgName;
|
||||||
|
|
||||||
bool m_bIsEditMode;
|
bool m_bIsEditMode;
|
||||||
QString m_strMediaPath;
|
QString m_strMediaPath;
|
||||||
|
|
||||||
QButtonGroup *m_buttonGroup;
|
QButtonGroup *m_buttonGroup;
|
||||||
int m_curStackIndex;
|
int m_curStackIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALARMMANAGEWIDGET_H
|
#endif // ALARMMANAGEWIDGET_H
|
||||||
|
|||||||
@ -1,91 +1,91 @@
|
|||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#
|
#
|
||||||
# Project created by QtCreator 2020-09-01T08:48:38
|
# Project created by QtCreator 2020-09-01T08:48:38
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui sql
|
QT += core gui sql
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = AlarmManageWidget
|
TARGET = AlarmManageWidget
|
||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
|
|
||||||
CONFIG += plugin
|
CONFIG += plugin
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
# depend on your compiler). Please consult the documentation of the
|
# depend on your compiler). Please consult the documentation of the
|
||||||
# deprecated API in order to know how to port your code away from it.
|
# deprecated API in order to know how to port your code away from it.
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
# You can also make your code fail to compile if you use deprecated APIs.
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
# In order to do so, uncomment the following line.
|
# 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.
|
# 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
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../../../../../platform/src/include/tools/model_table \
|
INCLUDEPATH += $$PWD/../../../../../platform/src/include/tools/model_table \
|
||||||
$$PWD/../../../../../platform/src/include/tools/model_excel/xlsx
|
$$PWD/../../../../../platform/src/include/tools/model_excel/xlsx
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
AlarmManageWidget.cpp \
|
AlarmManageWidget.cpp \
|
||||||
AlarmDevTreeView.cpp \
|
AlarmDevTreeView.cpp \
|
||||||
AlarmDevTreeModel.cpp \
|
AlarmDevTreeModel.cpp \
|
||||||
AlarmPointTableView.cpp \
|
AlarmPointTableView.cpp \
|
||||||
AlarmPointTableModel.cpp \
|
AlarmPointTableModel.cpp \
|
||||||
PointInfo.cpp \
|
PointInfo.cpp \
|
||||||
AlarmMng.cpp \
|
AlarmMng.cpp \
|
||||||
AlarmManageForm.cpp \
|
AlarmManageForm.cpp \
|
||||||
AlarmManagePluginWidget.cpp \
|
AlarmManagePluginWidget.cpp \
|
||||||
AddObjAlarmDialog.cpp \
|
AddObjAlarmDialog.cpp \
|
||||||
#main.cpp \
|
#main.cpp \
|
||||||
AlarmCalcInfo.cpp \
|
AlarmCalcInfo.cpp \
|
||||||
AlarmCalcParaTableDelegate.cpp \
|
AlarmCalcParaTableDelegate.cpp \
|
||||||
AlarmCalcParaTableModel.cpp \
|
AlarmCalcParaTableModel.cpp \
|
||||||
AlarmUuidBase64.cpp
|
AlarmUuidBase64.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
AlarmManageWidget.h \
|
AlarmManageWidget.h \
|
||||||
AlarmDevTreeView.h \
|
AlarmDevTreeView.h \
|
||||||
AlarmDevTreeModel.h \
|
AlarmDevTreeModel.h \
|
||||||
AlarmPointTableView.h \
|
AlarmPointTableView.h \
|
||||||
AlarmPointTableModel.h \
|
AlarmPointTableModel.h \
|
||||||
PointInfo.h \
|
PointInfo.h \
|
||||||
AlarmMng.h \
|
AlarmMng.h \
|
||||||
AlarmManageCommon.h \
|
AlarmManageCommon.h \
|
||||||
AlarmManageForm.h \
|
AlarmManageForm.h \
|
||||||
AlarmManagePluginWidget.h \
|
AlarmManagePluginWidget.h \
|
||||||
AddObjAlarmDialog.h \
|
AddObjAlarmDialog.h \
|
||||||
AlarmCalcInfo.h \
|
AlarmCalcInfo.h \
|
||||||
AlarmCalcParaTableDelegate.h \
|
AlarmCalcParaTableDelegate.h \
|
||||||
AlarmCalcParaTableModel.h \
|
AlarmCalcParaTableModel.h \
|
||||||
AlarmUuidBase64.h
|
AlarmUuidBase64.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
AlarmManageWidget.ui \
|
AlarmManageWidget.ui \
|
||||||
AlarmManageForm.ui \
|
AlarmManageForm.ui \
|
||||||
AddObjAlarmDialog.ui
|
AddObjAlarmDialog.ui
|
||||||
|
|
||||||
|
|
||||||
LIBS += -lboost_system -lboost_chrono
|
LIBS += -lboost_system -lboost_chrono
|
||||||
LIBS += -llog4cplus -lpub_logger_api
|
LIBS += -llog4cplus -lpub_logger_api
|
||||||
LIBS += -lpub_utility_api -lpub_sysinfo_api
|
LIBS += -lpub_utility_api -lpub_sysinfo_api
|
||||||
LIBS += -ldb_base_api -ldb_api_ex -lrdb_api -lrdb_net_api -ltsdb_api
|
LIBS += -ldb_base_api -ldb_api_ex -lrdb_api -lrdb_net_api -ltsdb_api
|
||||||
LIBS += -lperm_mng_api -ldp_chg_data_api
|
LIBS += -lperm_mng_api -ldp_chg_data_api
|
||||||
LIBS += -lnet_msg_bus_api
|
LIBS += -lnet_msg_bus_api
|
||||||
|
|
||||||
LIBS += -lmodel_table
|
LIBS += -lmodel_table
|
||||||
|
|
||||||
win32-msvc* {
|
win32-msvc* {
|
||||||
LIBS += -lbcrypt
|
LIBS += -lbcrypt
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBS += -lboost_system -lboost_chrono -lboost_program_options
|
LIBS += -lboost_system -lboost_chrono -lboost_program_options
|
||||||
LIBS += -lboost_filesystem
|
LIBS += -lboost_filesystem
|
||||||
|
|
||||||
exists($$PWD/../../../common.pri) {
|
exists($$PWD/../../../common.pri) {
|
||||||
include($$PWD/../../../common.pri)
|
include($$PWD/../../../common.pri)
|
||||||
}else {
|
}else {
|
||||||
error("FATAL error: connot find common.pri")
|
error("FATAL error: connot find common.pri")
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
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