| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- #include "dialogabout.h"
- #include "ui_dialogabout.h"
- #include "SNCDataBase.h"
- #include "wssso.h"
- #include "wscube.h"
- #include "wscube2.h"
- #include "respgetsysparam.h"
- #include "respgetmfsysparam.h"
- #include "respgetmf2sysparam.h"
- #include "dialogdbbackupandrecovery.h"
- DialogAbout::DialogAbout(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::DialogAbout)
- {
- ui->setupUi(this);
- ui->buttonBox->button(QDialogButtonBox::Ok)->setText("确定");
- ui->buttonBox->button(QDialogButtonBox::Cancel)->setText("取消");
- this->ui->lblAppName->setText(SNCDataBase::getProductName());
- this->ui->lblAppVersion->setText("软件版本:"+SNCDataBase::getAppVersion2());
- this->ui->lblSegVersion->setText("号段版本:"+SNCDataBase::getSegVersion() + "(共" + QString::number(SNCDataBase::getSegCount()) + "个号段)");
- this->ui->labelIcon->setPixmap(QPixmap(":/snc.ico"));
- this->ui->labelWebsite->setText("<a href=" + SNCDataBase::getWebsiteUrl() + ">" +\
- SNCDataBase::getWebsiteTitle()+"</a>");
- QObject::connect(ui->labelWebsite,SIGNAL(linkActivated(QString)),this,SLOT(onLinkActivated(QString)));
- QString fileName = ":/about.txt";
- QFile file(fileName);
- if(!file.open(QIODevice::ReadOnly))
- {
- return ;
- this->close();
- }
- QTextStream in(&file);
- QString log = in.readAll();
- file.close();
- this->ui->labelAbout->setText(log);
- setWindowFlags(windowFlags()&~Qt::WindowContextHelpButtonHint);
- }
- DialogAbout::~DialogAbout()
- {
- delete ui;
- }
- void DialogAbout::onLinkActivated(QString url)
- {
- qDebug()<<url;
- QDesktopServices::openUrl(QUrl(url));
- }
- void DialogAbout::on_pushButtonUpdateConfig_clicked()
- {
- //bool b1 = updateCubeSrvParam();
- setCursor(Qt::WaitCursor);
- bool b2 = updateCube2SrvParam();
- bool b3 = updateSSOSrvParam();
- setCursor(Qt::ArrowCursor);
- if(b2&&b3)
- {
- QMessageBox::information(this,"提示","配置信息更新成功!",QMessageBox::Ok);
- }
- else
- {
- QMessageBox::warning(this,"提示","配置信息未更新成功,请重试!",QMessageBox::Ok);
- }
- }
- bool DialogAbout::updateCubeSrvParam()
- {
- QString src = "mf-" + SNCDataBase::getAppVersion();
- QString authCode;
- QByteArray ba;
- QString str = src + SNCDataBase::getAuthCodeSyspara();
- ba = QCryptographicHash::hash ( str.toAscii(), QCryptographicHash::Md5 );
- authCode.append(ba.toHex());
- WSCube cube;
- QString json2 = cube.getSysParam(src,authCode);
- qDebug()<<json2;
- if(!json2.isEmpty())
- {
- RespGetMfSysParam response2(json2);
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"WSCube.getSysParam"<<response2.getRtnCode();
- SNCDataBase::updateSrvParam("cube",response2.getRs());
- qDebug()<<response2.getRs();
- return true;
- }
- return false;
- }
- bool DialogAbout::updateCube2SrvParam()
- {
- QString src = "mf-" + SNCDataBase::getAppVersion();
- QString authCode;
- QByteArray ba;
- QString str = src + SNCDataBase::getAuthCodeSyspara();
- ba = QCryptographicHash::hash ( str.toAscii(), QCryptographicHash::Md5 );
- authCode.append(ba.toHex());
- WSCube2 cube;
- QString json2 = cube.getSysParam(src,authCode);
- qDebug()<<"json2"<<json2;
- if(!json2.isEmpty())
- {
- RespGetMf2SysParam response2(json2);
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"WSCube2.getSysParam"<<response2.getRtnCode();
- SNCDataBase::updateSrvParam("cube2",response2.getRs());
- qDebug()<<response2.getRs();
- return true;
- }
- return false;
- }
- bool DialogAbout::updateSSOSrvParam()
- {
- QString src = "mf-" + SNCDataBase::getAppVersion();
- QString authCode;
- QByteArray ba;
- QString str = src + SNCDataBase::getAuthCodeSeg();
- ba = QCryptographicHash::hash ( str.toAscii(), QCryptographicHash::Md5 );
- authCode.append(ba.toHex());
- WSSSO interface;
- QString json = interface.getSysParam(src,authCode);
- if(!json.isEmpty())
- {
- RespGetSysParam response(json);
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"WSSSO.getSysParam"<<response.getRtnCode();
- SNCDataBase::updateSrvParam("sso",response.getRs());
- return true;
- }
- return false;
- }
- void DialogAbout::on_pushButtonDb_clicked()
- {
- DialogDbBackupAndRecovery dialog;
- dialog.exec();
- }
|