#include "dialog_upgrade.h" #include "ui_dialog_upgrade.h" #include "base/HGUtility.h" #include #include #include #include Dialog_upgrade::Dialog_upgrade(class VersionDll *versionDll, HGVersionInfo *versionInfo, QWidget *parent) : QDialog(parent) , ui(new Ui::Dialog_upgrade) , m_versionDll(versionDll) , m_versionInfo(versionInfo) { ui->setupUi(this); setWindowTitle(tr("upgrade online")); setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); this->layout()->setSizeConstraint(QLayout::SetFixedSize); 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; #elif defined(OEM_ZHONGJING) oemName = HGVERSION_OEMNAME_MICROTEK; #elif defined(OEM_ZIGUANG) oemName = HGVERSION_OEMNAME_UNIS; #elif defined(OEM_NEUTRAL) oemName = HGVERSION_OEMNAME_NEUTRAL; #else oemName = HGVERSION_OEMNAME_HUAGO; #endif HGChar currVersion[64] = {0}; m_versionDll->GetCurrVersion(HGVERSION_APPNAME_SCANNER, oemName, currVersion, 64); HGInt result = 0; m_versionDll->CompareVersion(currVersion, m_versionInfo[0].version, &result); if(result >= 0) { 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); 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") + str + "\n"); } else { ui->label_detectResult->setText(tr("Discover the new version : ") + m_versionInfo[0].version + tr(" ,the current version is : ") + currVersion); } } } Dialog_upgrade::~Dialog_upgrade() { delete ui; } QString Dialog_upgrade::getVersionNum() { return m_versionNum; } void Dialog_upgrade::on_pbtn_upgrade_clicked() { m_versionNum = m_versionInfo[0].version; accept(); }