添加ICD文件生成按钮和下载文件
This commit is contained in:
parent
cd815c2de3
commit
b2e7544fc7
@ -80,7 +80,7 @@ void NetMgr::RequestFileInfo(const QString &sAddr)
|
|||||||
|
|
||||||
void NetMgr::RequestDownload(const QString &sAddr, const QString& sFileName,const QString &sFileSavePath)
|
void NetMgr::RequestDownload(const QString &sAddr, const QString& sFileName,const QString &sFileSavePath)
|
||||||
{
|
{
|
||||||
QString sUrl = QString("http://%1%2%3").arg(sAddr).arg("/cidwdat/").arg(sFileName);
|
QString sUrl = QString("http://%1%2%3").arg(sAddr).arg("/CIDW/config/").arg(sFileName);
|
||||||
|
|
||||||
//qDebug()<<"url[RequestDownload]:"<<sUrl;
|
//qDebug()<<"url[RequestDownload]:"<<sUrl;
|
||||||
QNetworkRequest req;
|
QNetworkRequest req;
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QFileDialog>
|
||||||
#include "ftpclient.h"
|
#include "ftpclient.h"
|
||||||
|
|
||||||
COtherConfig::COtherConfig(QWidget *parent) :
|
COtherConfig::COtherConfig(QWidget *parent) :
|
||||||
@ -315,12 +316,29 @@ void COtherConfig::slotNetMgr(QString sAddr, const QVariant &msg)
|
|||||||
ui->pushButton_open_close->setText("打开");
|
ui->pushButton_open_close->setText("打开");
|
||||||
}
|
}
|
||||||
get_status = false;
|
get_status = false;
|
||||||
|
}else if(arrays_value.toString() == "61850"){
|
||||||
|
bool Status = objec.take("success").toBool();
|
||||||
|
QString strMessage = objec.take("message").toString();
|
||||||
|
if(Status){
|
||||||
|
QMessageBox::information(this, QStringLiteral("提示"), strMessage);
|
||||||
|
QString filepath = QFileDialog::getExistingDirectory(this, tr("选择文件夹"), tr(""));
|
||||||
|
if(filepath == "")
|
||||||
|
return;
|
||||||
|
QString fileName = "SJ90C_IEC61850.icd";
|
||||||
|
g_NetMgr->RequestDownload(IP, fileName, filepath);
|
||||||
|
QFileInfo file(filepath + fileName);
|
||||||
|
qDebug()<<file;
|
||||||
|
if(file.exists()){
|
||||||
|
QMessageBox::information(this, QStringLiteral("提示"), "下载成功!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
QMessageBox::question(this, QStringLiteral("提示"), strMessage);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
bool Status = objec.take("success").toBool();
|
bool Status = objec.take("success").toBool();
|
||||||
QString strMessage = objec.take("message").toString();
|
QString strMessage = objec.take("message").toString();
|
||||||
if(Status){
|
if(Status){
|
||||||
QMessageBox::information(this, QStringLiteral("提示"), "保存成功!");
|
QMessageBox::information(this, QStringLiteral("提示"), "保存成功!");
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
QMessageBox::information(this, QStringLiteral("提示"), strMessage);
|
QMessageBox::information(this, QStringLiteral("提示"), strMessage);
|
||||||
}
|
}
|
||||||
@ -328,6 +346,7 @@ void COtherConfig::slotNetMgr(QString sAddr, const QVariant &msg)
|
|||||||
}
|
}
|
||||||
disconnect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
disconnect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void COtherConfig::on_radioButton_open_clicked()
|
void COtherConfig::on_radioButton_open_clicked()
|
||||||
{
|
{
|
||||||
//QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
|
//QString fileName = QCoreApplication::applicationDirPath() + "\\config\\ZeroDrift.json";
|
||||||
@ -548,3 +567,16 @@ void COtherConfig::on_pushButton_open_close_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void COtherConfig::on_pushButton_generate_clicked()
|
||||||
|
{
|
||||||
|
QJsonObject sendData;
|
||||||
|
sendData["cmd"] = "61850";
|
||||||
|
QNetworkRequest req;
|
||||||
|
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||||
|
req.setUrl(sUrl);
|
||||||
|
g_NetMgr->PostJson(req,sendData);
|
||||||
|
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,8 @@ private slots:
|
|||||||
|
|
||||||
void on_pushButton_open_close_clicked();
|
void on_pushButton_open_close_clicked();
|
||||||
|
|
||||||
|
void on_pushButton_generate_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::COtherConfig *ui;
|
Ui::COtherConfig *ui;
|
||||||
|
|
||||||
|
|||||||
@ -562,6 +562,41 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QPushButton" name="pushButton_generate">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>430</y>
|
||||||
|
<width>96</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>96</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>96</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">#pushButton_generate { border-image: url(:/image/Btn/normal_Btn.png);
|
||||||
|
color:#1f5188 }
|
||||||
|
#pushButton_generate:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||||
|
color:#ffffff}
|
||||||
|
#pushButton_generate:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||||
|
color:#ffffff}
|
||||||
|
#pushButton_generate:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||||
|
color:#ffffff}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>生成ICD文件</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@ -771,15 +771,6 @@ void MainWindow::slotNetMgr(QString sAddr, const QVariant &msg)
|
|||||||
}else{
|
}else{
|
||||||
QMessageBox::information(this, QStringLiteral("提示"), strMessage);
|
QMessageBox::information(this, QStringLiteral("提示"), strMessage);
|
||||||
}
|
}
|
||||||
}else if(cmd == "61850"){
|
|
||||||
bool Status = objec.take("success").toBool();
|
|
||||||
QString strMessage = objec.take("message").toString();
|
|
||||||
if(Status){
|
|
||||||
QMessageBox::information(this, QStringLiteral("提示"), strMessage);
|
|
||||||
|
|
||||||
}else{
|
|
||||||
QMessageBox::question(this, QStringLiteral("提示"), strMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
disconnect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||||||
@ -799,15 +790,3 @@ void MainWindow::on_pushButton_detail_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_pushButton_generate_clicked()
|
|
||||||
{
|
|
||||||
QJsonObject sendData;
|
|
||||||
sendData["cmd"] = "61850";
|
|
||||||
QNetworkRequest req;
|
|
||||||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
|
||||||
req.setUrl(sUrl);
|
|
||||||
g_NetMgr->PostJson(req,sendData);
|
|
||||||
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,6 @@ private slots:
|
|||||||
|
|
||||||
void on_pushButton_detail_clicked();
|
void on_pushButton_detail_clicked();
|
||||||
void slotNetMgr(QString sAddr,const QVariant& msg);
|
void slotNetMgr(QString sAddr,const QVariant& msg);
|
||||||
void on_pushButton_generate_clicked();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>678</width>
|
<width>698</width>
|
||||||
<height>737</height>
|
<height>737</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -1788,35 +1788,6 @@ background-image: url(:/image/bj.jpg);
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_generate">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>96</width>
|
|
||||||
<height>28</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>96</width>
|
|
||||||
<height>28</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">#pushButton_generate { border-image: url(:/image/Btn/normal_Btn.png);
|
|
||||||
color:#1f5188 }
|
|
||||||
#pushButton_generate:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
|
||||||
color:#ffffff}
|
|
||||||
#pushButton_generate:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
|
||||||
color:#ffffff}
|
|
||||||
#pushButton_generate:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
|
||||||
color:#ffffff}</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>生成ICD文件</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user