| | |
| | | #include "mainwindow.h" |
| | | #include "ui_mainwindow.h" |
| | | #include "qaesencryption.h" |
| | | #include "licensedata.h" |
| | | #include "shortcrypto.h" |
| | | |
| | | #include <QClipboard> |
| | | #include <QDateTime> |
| | |
| | | ui->label_biosnum->setVisible(false); |
| | | ui->label_basenum_2->setVisible(false); |
| | | ui->label_biosnum_2->setVisible(false); |
| | | QTextOption opt = ui->textEdit_localid->document()->defaultTextOption(); |
| | | opt.setWrapMode(QTextOption::WrapAnywhere); |
| | | ui->textEdit_localid->document()->setDefaultTextOption(opt); |
| | | QTextOption opt_lic = ui->textEdit_licensekey->document()->defaultTextOption(); |
| | | opt_lic.setWrapMode(QTextOption::WrapAnywhere); |
| | | ui->textEdit_licensekey->document()->setDefaultTextOption(opt_lic); |
| | | //前七条是简化加密数据必用的,在这里设定好方便对应 |
| | | m_numToInfo.insert("1","Baseboard_Uuid"); |
| | | m_numToInfo.insert("2","CPU_Processorid"); |
| | |
| | | m_numToInfo.insert("12","IsEnabled_pipe"); |
| | | m_numToInfo.insert("13","IsEnabled_network"); |
| | | m_numToInfo.insert("14","Baseboard_Serialnumber"); |
| | | changeUIstate(); |
| | | } |
| | | |
| | | QString MainWindow::toUpperAndLower(QString src) |
| | |
| | | void MainWindow::on_pushButton_decrypt_clicked() |
| | | { |
| | | QString encryptlocalid = ui->textEdit_localid->toPlainText(); |
| | | QString localid = getDecrypt(encryptlocalid,key); |
| | | QByteArray localidbyte = localid.toLocal8Bit(); |
| | | QJsonParseError err_rpt; |
| | | QJsonDocument localidjsondoc(QJsonDocument::fromJson(localid.toUtf8(), &err_rpt));//字符串格式化为JSON |
| | | if(err_rpt.error != QJsonParseError::NoError) |
| | | { |
| | | localinfo = LicenseInfo(); |
| | | licenseinfo = LicenseInfo(); |
| | | workingjsondoc = QJsonDocument(); |
| | | ui->textEdit_licensekey->setPlainText(""); |
| | | changeUIstate(); |
| | | qDebug() << QStringLiteral("localid JSON格式错误"); |
| | | QMessageBox msgbox(QMessageBox::Information,QStringLiteral(""),QStringLiteral("解析失败,不是一个正确的设备ID序列"),QMessageBox::Ok); |
| | | msgbox.setButtonText(QMessageBox::Ok,QStringLiteral("确定")); |
| | | msgbox.exec(); |
| | | } |
| | | else //JSON格式正确 |
| | | { |
| | | QMessageBox msgbox(QMessageBox::Information,QStringLiteral(""),QStringLiteral("解析成功"),QMessageBox::Ok); |
| | | msgbox.setButtonText(QMessageBox::Ok,QStringLiteral("确定")); |
| | | msgbox.exec(); |
| | | ui->textEdit_licensekey->setPlainText(ui->textEdit_localid->toPlainText()); |
| | | workingjsondoc = QJsonDocument(QJsonDocument::fromJson(localidbyte)); |
| | | // 一键解密 |
| | | lic2.fromBinary(ShortCrypto::decrypt(encryptlocalid, key)); |
| | | qDebug()<<"on_pushButton_decrypt_clicked"<<lic2.toDebugString(); |
| | | //与之前的加密对应,且去掉冗余信息 |
| | | localinfo.Baseboard_Uuid = LicenseData::uuidBinaryToString(lic2.boardUuid); |
| | | localinfo.CPU_Processorid = LicenseData::binaryToHexString(lic2.cpuSerial); |
| | | localinfo.Username = lic2.userName; |
| | | localinfo.LicensedDuration_end = lic2.expireDate.toString("yyyy-MM-dd"); |
| | | // localinfo.LicensedDuration_start = localid_Obj.value(m_numToInfo.key("LicensedDuration_start")).toString(); |
| | | localinfo.Productid = QString::number(lic2.productId); |
| | | localinfo.Versionid = QString::number(lic2.verMajor)+"."+QString::number(lic2.verMinor); |
| | | localinfo.ActiveState = static_cast<int>(lic2.activeState); |
| | | licenseinfo = LicenseInfo(localinfo); |
| | | ui->textEdit_licensekey->setPlainText(ui->textEdit_localid->toPlainText()); |
| | | changeUIstate(); |
| | | |
| | | QJsonObject localid_Obj = localidjsondoc.object(); |
| | | // localinfo.Baseboard_Serialnumber = localid_Obj.value("Baseboard_Serialnumber").toString(); |
| | | // localinfo.Baseboard_Uuid = localid_Obj.value("Baseboard_Uuid").toString(); |
| | | // localinfo.Bios_Serialnumber = localid_Obj.value("Bios_Serialnumber").toString(); |
| | | // localinfo.CPU_Processorid = localid_Obj.value("CPU_Processorid").toString(); |
| | | // localinfo.Username = localid_Obj.value("Username").toString(); |
| | | // localinfo.IsEnabled_cell = localid_Obj.value("IsEnabled_cell").toInt(); |
| | | // localinfo.IsEnabled_aquifer = localid_Obj.value("IsEnabled_aquifer").toInt(); |
| | | // localinfo.IsEnabled_pipe = localid_Obj.value("IsEnabled_pipe").toInt(); |
| | | // localinfo.IsEnabled_network = localid_Obj.value("IsEnabled_network").toInt(); |
| | | // localinfo.LicensedDuration_end = localid_Obj.value("LicensedDuration_end").toString(); |
| | | // localinfo.LicensedDuration_start = localid_Obj.value("LicensedDuration_start").toString(); |
| | | // localinfo.Productid = localid_Obj.value("Productid").toString(); |
| | | // localinfo.Versionid = localid_Obj.value("Versionid").toString(); |
| | | // QString localid = getDecrypt(encryptlocalid,key); |
| | | // QByteArray localidbyte = localid.toLocal8Bit(); |
| | | // QJsonParseError err_rpt; |
| | | // QJsonDocument localidjsondoc(QJsonDocument::fromJson(localid.toUtf8(), &err_rpt));//字符串格式化为JSON |
| | | // if(err_rpt.error != QJsonParseError::NoError) |
| | | // { |
| | | // localinfo = LicenseInfo(); |
| | | // licenseinfo = LicenseInfo(); |
| | | // workingjsondoc = QJsonDocument(); |
| | | // ui->textEdit_licensekey->setPlainText(""); |
| | | // changeUIstate(); |
| | | // qDebug() << QStringLiteral("localid JSON格式错误"); |
| | | // QMessageBox msgbox(QMessageBox::Information,QStringLiteral(""),QStringLiteral("解析失败,不是一个正确的设备ID序列"),QMessageBox::Ok); |
| | | // msgbox.setButtonText(QMessageBox::Ok,QStringLiteral("确定")); |
| | | // msgbox.exec(); |
| | | // } |
| | | // else //JSON格式正确 |
| | | // { |
| | | // QMessageBox msgbox(QMessageBox::Information,QStringLiteral(""),QStringLiteral("解析成功"),QMessageBox::Ok); |
| | | // msgbox.setButtonText(QMessageBox::Ok,QStringLiteral("确定")); |
| | | // msgbox.exec(); |
| | | // ui->textEdit_licensekey->setPlainText(ui->textEdit_localid->toPlainText()); |
| | | // workingjsondoc = QJsonDocument(QJsonDocument::fromJson(localidbyte)); |
| | | |
| | | //与之前的加密对应,且去掉冗余信息 |
| | | localinfo.Baseboard_Uuid = localid_Obj.value(m_numToInfo.key("Baseboard_Uuid")).toString(); |
| | | localinfo.CPU_Processorid = localid_Obj.value(m_numToInfo.key("CPU_Processorid")).toString(); |
| | | localinfo.Username = localid_Obj.value(m_numToInfo.key("Username")).toString(); |
| | | localinfo.LicensedDuration_end = localid_Obj.value(m_numToInfo.key("LicensedDuration_end")).toString(); |
| | | localinfo.LicensedDuration_start = localid_Obj.value(m_numToInfo.key("LicensedDuration_start")).toString(); |
| | | localinfo.Productid = localid_Obj.value(m_numToInfo.key("Productid")).toString(); |
| | | localinfo.Versionid = localid_Obj.value(m_numToInfo.key("Versionid")).toString(); |
| | | localinfo.ActiveState = localid_Obj.value(m_numToInfo.key("ActiveState")).toInt(); |
| | | licenseinfo = LicenseInfo(localinfo); |
| | | changeUIstate(); |
| | | } |
| | | // QJsonObject localid_Obj = localidjsondoc.object(); |
| | | //// localinfo.Baseboard_Serialnumber = localid_Obj.value("Baseboard_Serialnumber").toString(); |
| | | //// localinfo.Baseboard_Uuid = localid_Obj.value("Baseboard_Uuid").toString(); |
| | | //// localinfo.Bios_Serialnumber = localid_Obj.value("Bios_Serialnumber").toString(); |
| | | //// localinfo.CPU_Processorid = localid_Obj.value("CPU_Processorid").toString(); |
| | | //// localinfo.Username = localid_Obj.value("Username").toString(); |
| | | //// localinfo.IsEnabled_cell = localid_Obj.value("IsEnabled_cell").toInt(); |
| | | //// localinfo.IsEnabled_aquifer = localid_Obj.value("IsEnabled_aquifer").toInt(); |
| | | //// localinfo.IsEnabled_pipe = localid_Obj.value("IsEnabled_pipe").toInt(); |
| | | //// localinfo.IsEnabled_network = localid_Obj.value("IsEnabled_network").toInt(); |
| | | //// localinfo.LicensedDuration_end = localid_Obj.value("LicensedDuration_end").toString(); |
| | | //// localinfo.LicensedDuration_start = localid_Obj.value("LicensedDuration_start").toString(); |
| | | //// localinfo.Productid = localid_Obj.value("Productid").toString(); |
| | | //// localinfo.Versionid = localid_Obj.value("Versionid").toString(); |
| | | |
| | | // //与之前的加密对应,且去掉冗余信息 |
| | | // localinfo.Baseboard_Uuid = localid_Obj.value(m_numToInfo.key("Baseboard_Uuid")).toString(); |
| | | // localinfo.CPU_Processorid = localid_Obj.value(m_numToInfo.key("CPU_Processorid")).toString(); |
| | | // localinfo.Username = localid_Obj.value(m_numToInfo.key("Username")).toString(); |
| | | // localinfo.LicensedDuration_end = localid_Obj.value(m_numToInfo.key("LicensedDuration_end")).toString(); |
| | | // localinfo.LicensedDuration_start = localid_Obj.value(m_numToInfo.key("LicensedDuration_start")).toString(); |
| | | // localinfo.Productid = localid_Obj.value(m_numToInfo.key("Productid")).toString(); |
| | | // localinfo.Versionid = localid_Obj.value(m_numToInfo.key("Versionid")).toString(); |
| | | // localinfo.ActiveState = localid_Obj.value(m_numToInfo.key("ActiveState")).toInt(); |
| | | // licenseinfo = LicenseInfo(localinfo); |
| | | // changeUIstate(); |
| | | // } |
| | | } |
| | | |
| | | void MainWindow::on_pushButton_accreditall_clicked() |
| | |
| | | |
| | | void MainWindow::giveLicense(int time) |
| | | { |
| | | QJsonObject licensekey_Obj = workingjsondoc.object(); |
| | | // licensekey_Obj[m_numToInfo.key("IsEnabled_cell")] = 1; |
| | | // licensekey_Obj[m_numToInfo.key("IsEnabled_aquifer")] = 1; |
| | | // licensekey_Obj[m_numToInfo.key("IsEnabled_pipe")] = 1; |
| | | // licensekey_Obj[m_numToInfo.key("IsEnabled_network")] = 1; |
| | | licensekey_Obj[m_numToInfo.key("ActiveState")] = 1; |
| | | // QDateTime licensedate = QDateTime::fromString(licensekey_Obj[m_numToInfo.key("LicensedDuration_end")].toString(),"yyyy-MM-dd hh:mm:ss"); |
| | | // if(licensedate.isNull()){ |
| | | // qDebug()<<"licenseTime is Null"; |
| | | // licensedate = QDateTime::currentDateTime(); |
| | | // } |
| | | //现在点击授权是从当前的时间加授权时间 |
| | | QDateTime licensedate = QDateTime::currentDateTime(); |
| | | QDateTime newlicensedate = licensedate.addMonths(time); |
| | | QString licensedatestr = newlicensedate.toString("yyyy-MM-dd hh:mm:ss"); |
| | | licensekey_Obj[m_numToInfo.key("LicensedDuration_end")] = licensedatestr; |
| | | workingjsondoc.setObject(licensekey_Obj); |
| | | //数据压缩,去空格换行等多余无用信息 |
| | | QByteArray compressedArray = QJsonDocument(licensekey_Obj).toJson(QJsonDocument::Compact); |
| | | QByteArray jsonbytearray = qCompress(compressedArray,9); |
| | | QString testid = jsonbytearray.toBase64(); |
| | | ui->textEdit_licensekey->setPlainText(""); |
| | | ui->textEdit_licensekey->setPlainText(getEncrypt(QString(testid),key)); |
| | | setLicenseinfo(licensekey_Obj); |
| | | QString licensedatestr = newlicensedate.toString("yyyy-MM-dd"); |
| | | lic2.expireDate = QDate::fromString(licensedatestr,"yyyy-MM-dd"); |
| | | // lic2.expireDate = lic2.expireDate.addMonths(time); |
| | | lic2.activeState = 1; |
| | | QString cipher = ShortCrypto::encrypt(lic2.toBinary(), key); |
| | | ui->textEdit_licensekey->clear(); |
| | | ui->textEdit_licensekey->setPlainText(cipher); |
| | | // 一键解密 |
| | | LicenseData lic3; |
| | | lic3.fromBinary(ShortCrypto::decrypt(cipher, key)); |
| | | qDebug()<<"change"<<cipher<<lic3.toDebugString()<<cipher.size(); |
| | | //更新licenseinfo,只需要更新LicensedDuration_end、LicensedDuration_start、ActiveState |
| | | licenseinfo.LicensedDuration_end = newlicensedate.toString("yyyy-MM-dd"); |
| | | licenseinfo.LicensedDuration_start = licensedate.toString("yyyy-MM-dd"); |
| | | licenseinfo.ActiveState = 1; |
| | | changeUIstate(); |
| | | //将授权信息记录到excel表中 |
| | | QString edition =""; |
| | | if(time == 3){ |
| | |
| | | }else if(time == 12){ |
| | | edition = QStringLiteral("专业版"); |
| | | } |
| | | ActiveRecord(licensekey_Obj,edition,ui->textEdit_licensekey->toPlainText()); |
| | | ActiveRecord(lic2,edition,ui->textEdit_licensekey->toPlainText()); |
| | | } |
| | | |
| | | void MainWindow::ActiveRecord(QJsonObject jsonObj,QString edition, QString licenseKey) |
| | | void MainWindow::ActiveRecord(LicenseData lic,QString edition, QString licenseKey) |
| | | { |
| | | QString Baseboard_Uuid = jsonObj[m_numToInfo.key("Baseboard_Uuid")].toString(); |
| | | QString Baseboard_Uuid = LicenseData::uuidBinaryToString(lic.boardUuid); |
| | | QString src = QApplication::applicationDirPath(); |
| | | QDir dir(src); |
| | | QString file_name(QStringLiteral("安全评价软件授权人数统计表.xlsx")); |
| | |
| | | int rowCount = xlsx.dimension().rowCount()+1; |
| | | int id = xlsx.read(rowCount-1,1).toInt(); |
| | | xlsx.write(rowCount, 1, id+1); |
| | | xlsx.write(rowCount, 2, jsonObj[m_numToInfo.key("Baseboard_Uuid")].toString()); |
| | | xlsx.write(rowCount, 2, LicenseData::uuidBinaryToString(lic.boardUuid)); |
| | | xlsx.write(rowCount, 3, edition); |
| | | xlsx.write(rowCount, 4, jsonObj[m_numToInfo.key("LicensedDuration_start")].toString()); |
| | | xlsx.write(rowCount, 5, jsonObj[m_numToInfo.key("LicensedDuration_end")].toString()); |
| | | xlsx.write(rowCount, 6, jsonObj[m_numToInfo.key("Productid")].toString()); |
| | | xlsx.write(rowCount, 7, jsonObj[m_numToInfo.key("Versionid")].toString()); |
| | | xlsx.write(rowCount, 4, QDate::currentDate().toString("yyyy-MM-dd")); |
| | | xlsx.write(rowCount, 5, lic.expireDate.toString("yyyy-MM-dd")); |
| | | xlsx.write(rowCount, 6, QString::number(lic2.productId)); |
| | | xlsx.write(rowCount, 7, QString::number(lic2.verMajor)+"."+QString::number(lic2.verMinor)); |
| | | xlsx.write(rowCount, 8, licenseKey); |
| | | }else{ |
| | | //如果存在这条记录就更新数据信息 |
| | | xlsx.write(uuidColumn, 2, jsonObj[m_numToInfo.key("Baseboard_Uuid")].toString()); |
| | | xlsx.write(uuidColumn, 2, LicenseData::uuidBinaryToString(lic.boardUuid)); |
| | | xlsx.write(uuidColumn, 3, edition); |
| | | xlsx.write(uuidColumn, 4, jsonObj[m_numToInfo.key("LicensedDuration_start")].toString()); |
| | | xlsx.write(uuidColumn, 5, jsonObj[m_numToInfo.key("LicensedDuration_end")].toString()); |
| | | xlsx.write(uuidColumn, 6, jsonObj[m_numToInfo.key("Productid")].toString()); |
| | | xlsx.write(uuidColumn, 7, jsonObj[m_numToInfo.key("Versionid")].toString()); |
| | | xlsx.write(uuidColumn, 4, QDate::currentDate().toString("yyyy-MM-dd")); |
| | | xlsx.write(uuidColumn, 5, lic.expireDate.toString("yyyy-MM-dd")); |
| | | xlsx.write(uuidColumn, 6, QString::number(lic2.productId)); |
| | | xlsx.write(uuidColumn, 7, QString::number(lic2.verMajor)+"."+QString::number(lic2.verMinor)); |
| | | xlsx.write(uuidColumn, 8, licenseKey); |
| | | } |
| | | xlsx.save(); |
| | | } |
| | | |
| | | QString MainWindow::getEncrypt_New() |
| | | { |
| | | QString localid = ""; |
| | | LicenseInfo localinfo; |
| | | //查询系统用户名 |
| | | localinfo.Username = qgetenv("USER"); // Linux系统 |
| | | if (localinfo.Username.isEmpty()) |
| | | localinfo.Username = qgetenv("USERNAME"); // Windows系统 |
| | | //查询CPU序列号 |
| | | localinfo.CPU_Processorid = getWindowsInfo("wmic cpu get processorid"); |
| | | //查询主板序列号 |
| | | localinfo.Baseboard_Serialnumber = getWindowsInfo("wmic baseboard get serialnumber"); |
| | | //查询BIOS序列号 |
| | | localinfo.Bios_Serialnumber = getWindowsInfo("wmic bios get serialnumber"); |
| | | //查询主板唯一标识 |
| | | localinfo.Baseboard_Uuid = getWindowsInfo("wmic csproduct get uuid"); |
| | | |
| | | //尝试新的加密方法 |
| | | LicenseData lic; |
| | | lic.boardUuid = LicenseData::hexStringToBinary(localinfo.Baseboard_Uuid); |
| | | lic.cpuSerial = LicenseData::hexStringToBinary(localinfo.CPU_Processorid); |
| | | lic.userName = localinfo.Username; |
| | | lic.expireDate = QDate::fromString(localinfo.LicensedDuration_end,"yyyy-MM-dd"); |
| | | lic.productId = localinfo.Productid.toUInt(); |
| | | QString version = localinfo.Versionid; |
| | | lic.verMajor = version.split(".").at(0).toUInt(); |
| | | lic.verMinor = version.split(".").at(1).toUInt(); |
| | | lic.activeState = localinfo.ActiveState; |
| | | // 一键加密 |
| | | QString cipher = ShortCrypto::encrypt(lic.toBinary(), key); |
| | | // ui->textEdit_localid->setText(cipher); |
| | | return cipher; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | QString localid = getLocalID(); |
| | | QString encryptid = getEncrypt(localid,key); |
| | | |
| | | //新的加密方法 |
| | | encryptid = getEncrypt_New(); |
| | | ui->textEdit_localid->setText(encryptid); |
| | | |
| | | localinfo = LicenseInfo(); |
| | |
| | | |
| | | void MainWindow::on_pushButton_setproid_clicked() |
| | | { |
| | | QJsonObject licensekey_Obj = workingjsondoc.object(); |
| | | licensekey_Obj[m_numToInfo.key("Productid")] = ui->lineEdit_setproid->text(); |
| | | workingjsondoc.setObject(licensekey_Obj); |
| | | // QJsonObject licensekey_Obj = workingjsondoc.object(); |
| | | // licensekey_Obj[m_numToInfo.key("Productid")] = ui->lineEdit_setproid->text(); |
| | | // workingjsondoc.setObject(licensekey_Obj); |
| | | |
| | | QByteArray compressedArray = QJsonDocument(licensekey_Obj).toJson(QJsonDocument::Compact); |
| | | QByteArray jsonbytearray = qCompress(compressedArray,9); |
| | | QString testid = jsonbytearray.toBase64(); |
| | | ui->textEdit_licensekey->setPlainText(""); |
| | | ui->textEdit_licensekey->setPlainText(getEncrypt(QString(testid),key)); |
| | | |
| | | // QByteArray jsonbytearray = workingjsondoc.toJson(); |
| | | // QByteArray compressedArray = QJsonDocument(licensekey_Obj).toJson(QJsonDocument::Compact); |
| | | // QByteArray jsonbytearray = qCompress(compressedArray,9); |
| | | // QString testid = jsonbytearray.toBase64(); |
| | | // ui->textEdit_licensekey->setPlainText(""); |
| | | // ui->textEdit_licensekey->setPlainText(getEncrypt(QString(jsonbytearray),key)); |
| | | setLicenseinfo(licensekey_Obj); |
| | | // ui->textEdit_licensekey->setPlainText(getEncrypt(QString(testid),key)); |
| | | |
| | | lic2.productId = ui->lineEdit_setproid->text().toUInt(); |
| | | QString cipher = ShortCrypto::encrypt(lic2.toBinary(), key); |
| | | ui->textEdit_licensekey->setPlainText(cipher); |
| | | // setLicenseinfo(licensekey_Obj); |
| | | |
| | | //這裡也只需要更新productId |
| | | licenseinfo.Productid = ui->lineEdit_setproid->text(); |
| | | changeUIstate(); |
| | | |
| | | } |
| | | |
| | | void MainWindow::on_pushButton_setversion_clicked() |
| | | { |
| | | QJsonObject licensekey_Obj = workingjsondoc.object(); |
| | | licensekey_Obj[m_numToInfo.key("Versionid")] = ui->lineEdit_setversion->text(); |
| | | workingjsondoc.setObject(licensekey_Obj); |
| | | // QJsonObject licensekey_Obj = workingjsondoc.object(); |
| | | // licensekey_Obj[m_numToInfo.key("Versionid")] = ui->lineEdit_setversion->text(); |
| | | // workingjsondoc.setObject(licensekey_Obj); |
| | | |
| | | QByteArray compressedArray = QJsonDocument(licensekey_Obj).toJson(QJsonDocument::Compact); |
| | | QByteArray jsonbytearray = qCompress(compressedArray,9); |
| | | QString testid = jsonbytearray.toBase64(); |
| | | ui->textEdit_licensekey->setPlainText(""); |
| | | ui->textEdit_licensekey->setPlainText(getEncrypt(QString(testid),key)); |
| | | |
| | | // QByteArray jsonbytearray = workingjsondoc.toJson(); |
| | | // QByteArray compressedArray = QJsonDocument(licensekey_Obj).toJson(QJsonDocument::Compact); |
| | | // QByteArray jsonbytearray = qCompress(compressedArray,9); |
| | | // QString testid = jsonbytearray.toBase64(); |
| | | // ui->textEdit_licensekey->setPlainText(""); |
| | | // ui->textEdit_licensekey->setPlainText(getEncrypt(QString(jsonbytearray),key)); |
| | | setLicenseinfo(licensekey_Obj); |
| | | // ui->textEdit_licensekey->setPlainText(getEncrypt(QString(testid),key)); |
| | | |
| | | // setLicenseinfo(licensekey_Obj); |
| | | QString version = ui->lineEdit_setversion->text(); |
| | | lic2.verMajor = version.split(".").at(0).toUInt(); |
| | | lic2.verMinor = version.split(".").at(1).toUInt(); |
| | | QString cipher = ShortCrypto::encrypt(lic2.toBinary(), key); |
| | | ui->textEdit_licensekey->setPlainText(cipher); |
| | | //這裡也只需要更新Versionid |
| | | licenseinfo.Versionid = ui->lineEdit_setversion->text(); |
| | | changeUIstate(); |
| | | } |
| | | |
| | | void MainWindow::on_pushButton_normal_clicked() |
| | |
| | | |
| | | void MainWindow::on_pushButton_viewUsers_clicked() |
| | | { |
| | | QString excelPath = QApplication::applicationDirPath(); |
| | | // QString filename = QFileDialog::getOpenFileName(nullptr,tr("打开文件"),excelPath,tr("excel文件(*.xlsx)")); |
| | | // if(filename=="") |
| | | // { |
| | | // return; |
| | | // } |
| | | QString excelPath = QApplication::applicationDirPath()+QStringLiteral("/安全评价软件授权人数统计表.xlsx"); |
| | | |
| | | QUrl fileUrl = QUrl::fromLocalFile(excelPath); |
| | | |
| | | // 2. 调用系统服务打开文件管理器并选中文件 |