2022-07-18 08:59:12 +00:00
|
|
|
#include "dialog_upgrade.h"
|
|
|
|
#include "ui_dialog_upgrade.h"
|
|
|
|
#include "base/HGUtility.h"
|
|
|
|
#include <QCryptographicHash>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QFile>
|
|
|
|
|
2022-11-26 03:29:31 +00:00
|
|
|
Dialog_upgrade::Dialog_upgrade(class VersionDll *versionDll, HGVersionInfo *versionInfo, QWidget *parent) :
|
2022-07-18 08:59:12 +00:00
|
|
|
QDialog(parent)
|
|
|
|
, ui(new Ui::Dialog_upgrade)
|
|
|
|
, m_versionDll(versionDll)
|
2022-07-21 02:56:47 +00:00
|
|
|
, m_versionInfo(versionInfo)
|
2022-07-18 08:59:12 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
setWindowTitle(tr("upgrade online"));
|
|
|
|
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
|
|
|
|
|
2023-01-13 05:56:24 +00:00
|
|
|
const HGChar *oemName = nullptr;
|
|
|
|
|
|
|
|
#if defined(OEM_HANWANG)
|
|
|
|
oemName = HGVERSION_OEMNAME_HANVON;
|
|
|
|
#elif defined(OEM_LISICHENG)
|
|
|
|
oemName = HGVERSION_OEMNAME_LANXUM;
|
|
|
|
#elif defined(OEM_CANGTIAN)
|
|
|
|
oemName = HGVERSION_OEMNAME_CUMTENN;
|
2023-01-29 09:02:57 +00:00
|
|
|
#elif defined(OEM_ZHONGJING)
|
|
|
|
oemName = HGVERSION_OEMNAME_MICROTEK;
|
2023-03-10 05:39:50 +00:00
|
|
|
#elif defined(OEM_ZIGUANG)
|
2023-03-10 10:31:39 +00:00
|
|
|
oemName = HGVERSION_OEMNAME_UNIS;
|
2023-04-20 08:13:29 +00:00
|
|
|
#elif defined(OEM_NEUTRAL)
|
|
|
|
oemName = HGVERSION_OEMNAME_NEUTRAL;
|
2023-07-17 05:40:22 +00:00
|
|
|
#elif defined(OEM_DELI)
|
|
|
|
oemName = HGVERSION_OEMNAME_DELI;
|
2023-01-13 05:56:24 +00:00
|
|
|
#else
|
|
|
|
oemName = HGVERSION_OEMNAME_HUAGO;
|
|
|
|
#endif
|
|
|
|
|
2022-07-18 08:59:12 +00:00
|
|
|
HGChar currVersion[64] = {0};
|
2023-01-13 05:56:24 +00:00
|
|
|
m_versionDll->GetCurrVersion(HGVERSION_APPNAME_SCANNER, oemName, currVersion, 64);
|
2022-07-18 08:59:12 +00:00
|
|
|
HGInt result = 0;
|
2022-11-26 03:29:31 +00:00
|
|
|
m_versionDll->CompareVersion(currVersion, m_versionInfo[0].version, &result);
|
2022-11-29 10:45:50 +00:00
|
|
|
if(result >= 0)
|
2022-07-18 08:59:12 +00:00
|
|
|
{
|
|
|
|
ui->label_detectResult->setText(tr("The current version is the latest! The current version number is : ") + currVersion);
|
|
|
|
ui->pbtn_upgrade->setVisible(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->pbtn_upgrade->setVisible(true);
|
2022-11-29 08:57:39 +00:00
|
|
|
QString str(m_versionInfo[0].desc);
|
|
|
|
if (!str.isEmpty())
|
|
|
|
{
|
|
|
|
ui->label_detectResult->setText(tr("Discover the new version : ") +
|
|
|
|
m_versionInfo[0].version +
|
|
|
|
tr(" ,the current version is : ") + currVersion + "\n" + "\n" +
|
|
|
|
tr("upgrade contents: \n") +
|
2022-11-29 10:45:50 +00:00
|
|
|
str + "\n");
|
2022-11-29 08:57:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->label_detectResult->setText(tr("Discover the new version : ") +
|
|
|
|
m_versionInfo[0].version +
|
|
|
|
tr(" ,the current version is : ") + currVersion);
|
|
|
|
}
|
|
|
|
|
2022-07-18 08:59:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Dialog_upgrade::~Dialog_upgrade()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2022-07-21 07:41:16 +00:00
|
|
|
QString Dialog_upgrade::getVersionNum()
|
|
|
|
{
|
|
|
|
return m_versionNum;
|
|
|
|
}
|
|
|
|
|
2022-07-18 08:59:12 +00:00
|
|
|
void Dialog_upgrade::on_pbtn_upgrade_clicked()
|
|
|
|
{
|
2022-11-26 03:29:31 +00:00
|
|
|
m_versionNum = m_versionInfo[0].version;
|
|
|
|
accept();
|
2022-07-18 08:59:12 +00:00
|
|
|
}
|