This commit is contained in:
parent
67b5a0b1a9
commit
b315b0dba5
|
@ -1097,120 +1097,6 @@ void MainWindow::on_statusInfoDblClick()
|
|||
m_dialogLog->show();
|
||||
}
|
||||
|
||||
void MainWindow::on_upgradeApp(QString pkgPath)
|
||||
{
|
||||
QString curPath = QDir::currentPath();
|
||||
QString tmpPath = QDir::tempPath();
|
||||
|
||||
#if defined(HG_CMP_MSC)
|
||||
#if defined(OEM_HANWANG)
|
||||
QFile::remove(tmpPath + "/HwUpgradeApp.exe");
|
||||
QFile::copy(curPath + "/HwUpgradeApp.exe", tmpPath + "/HwUpgradeApp.exe");
|
||||
QFile::remove(tmpPath + "/HwBase.dll");
|
||||
QFile::copy(curPath + "/HwBase.dll", tmpPath + "/HwBase.dll");
|
||||
QFile::remove(tmpPath + "/HwVersion.dll");
|
||||
QFile::copy(curPath + "/HwVersion.dll", tmpPath + "/HwVersion.dll");
|
||||
#elif defined(OEM_LISICHENG)
|
||||
QFile::remove(tmpPath + "/LscUpgradeApp.exe");
|
||||
QFile::copy(curPath + "/LscUpgradeApp.exe", tmpPath + "/LscUpgradeApp.exe");
|
||||
QFile::remove(tmpPath + "/LscBase.dll");
|
||||
QFile::copy(curPath + "/LscBase.dll", tmpPath + "/LscBase.dll");
|
||||
QFile::remove(tmpPath + "/LscVersion.dll");
|
||||
QFile::copy(curPath + "/LscVersion.dll", tmpPath + "/LscVersion.dll");
|
||||
#else
|
||||
QFile::remove(tmpPath + "/HGUpgradeApp.exe");
|
||||
QFile::copy(curPath + "/HGUpgradeApp.exe", tmpPath + "/HGUpgradeApp.exe");
|
||||
QFile::remove(tmpPath + "/HGBase.dll");
|
||||
QFile::copy(curPath + "/HGBase.dll", tmpPath + "/HGBase.dll");
|
||||
QFile::remove(tmpPath + "/HGVersion.dll");
|
||||
QFile::copy(curPath + "/HGVersion.dll", tmpPath + "/HGVersion.dll");
|
||||
#endif
|
||||
|
||||
QFile::remove(tmpPath + "/msvcp140.dll");
|
||||
QFile::copy(curPath + "/msvcp140.dll", tmpPath + "/msvcp140.dll");
|
||||
QFile::remove(tmpPath + "/Qt5Core.dll");
|
||||
QFile::copy(curPath + "/Qt5Core.dll", tmpPath + "/Qt5Core.dll");
|
||||
QFile::remove(tmpPath + "/Qt5Gui.dll");
|
||||
QFile::copy(curPath + "/Qt5Gui.dll", tmpPath + "/Qt5Gui.dll");
|
||||
QFile::remove(tmpPath + "/Qt5Widgets.dll");
|
||||
QFile::copy(curPath + "/Qt5Widgets.dll", tmpPath + "/Qt5Widgets.dll");
|
||||
QFile::remove(tmpPath + "/vcruntime140.dll");
|
||||
QFile::copy(curPath + "/vcruntime140.dll", tmpPath + "/vcruntime140.dll");
|
||||
QDir dir;
|
||||
dir.mkdir(tmpPath + "/platforms");
|
||||
QFile::remove(tmpPath + "/platforms/qwindows.dll");
|
||||
QFile::copy(curPath + "/platforms/qwindows.dll", tmpPath + "/platforms/qwindows.dll");
|
||||
dir.mkdir(tmpPath + "/imageformats");
|
||||
QFile::remove(tmpPath + "/imageformats/qgif.dll");
|
||||
QFile::copy(curPath + "/imageformats/qgif.dll", tmpPath + "/imageformats/qgif.dll");
|
||||
#else
|
||||
#if defined(OEM_HANWANG)
|
||||
QFile::remove(tmpPath + "/HwUpgradeApp");
|
||||
QFile::copy(curPath + "/HwUpgradeApp", tmpPath + "/HwUpgradeApp");
|
||||
QFile::remove(tmpPath + "/libHwBase.so");
|
||||
QFile::copy(curPath + "/libHwBase.so", tmpPath + "/libHwBase.so");
|
||||
QFile::remove(tmpPath + "/libHwVersion.so");
|
||||
QFile::copy(curPath + "/libHwVersion.so", tmpPath + "/libHwVersion.so");
|
||||
#elif defined(OEM_LISICHENG)
|
||||
QFile::remove(tmpPath + "/LscUpgradeApp");
|
||||
QFile::copy(curPath + "/LscUpgradeApp", tmpPath + "/LscUpgradeApp");
|
||||
QFile::remove(tmpPath + "/libLscBase.so");
|
||||
QFile::copy(curPath + "/libLscBase.so", tmpPath + "/libLscBase.so");
|
||||
QFile::remove(tmpPath + "/libLscVersion.so");
|
||||
QFile::copy(curPath + "/libLscVersion.so", tmpPath + "/libLscVersion.so");
|
||||
#else
|
||||
QFile::remove(tmpPath + "/HGUpgradeApp");
|
||||
QFile::copy(curPath + "/HGUpgradeApp", tmpPath + "/HGUpgradeApp");
|
||||
QFile::remove(tmpPath + "/libHGBase.so");
|
||||
QFile::copy(curPath + "/libHGBase.so", tmpPath + "/libHGBase.so");
|
||||
QFile::remove(tmpPath + "/libHGVersion.so");
|
||||
QFile::copy(curPath + "/libHGVersion.so", tmpPath + "/libHGVersion.so");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
QProcess proc;
|
||||
bool isSuccessdStart = false;
|
||||
|
||||
QStringList argList;
|
||||
argList.push_back(QString("-appName=%1").arg(HGVERSION_APPNAME_SCANNER));
|
||||
argList.push_back(QString("-pkgpath=%1").arg(pkgPath.toStdString().c_str()));
|
||||
argList.push_back(QString("-type=%1").arg("upgrade"));
|
||||
|
||||
#if defined(HG_CMP_MSC)
|
||||
#if defined(OEM_HANWANG)
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/HwUpgradeApp.exe", argList);
|
||||
#elif defined(OEM_LISICHENG)
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/LscUpgradeApp.exe", argList);
|
||||
#else
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/HGUpgradeApp.exe", argList);
|
||||
#endif
|
||||
#else
|
||||
#if defined(OEM_HANWANG)
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/HwUpgradeApp", argList);
|
||||
#elif defined(OEM_LISICHENG)
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/LscUpgradeApp", argList);
|
||||
#else
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/HGUpgradeApp", argList);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(isSuccessdStart)
|
||||
{
|
||||
m_closeTip = false;
|
||||
close();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, tr("error"),
|
||||
tr("start failed!"),
|
||||
QMessageBox::Ok);
|
||||
msg.setButtonText(QMessageBox::Ok, tr("yes"));
|
||||
msg.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_act_thumbnailBar_triggered(bool checked)
|
||||
{
|
||||
ui->dockWidget->setVisible(checked);
|
||||
|
@ -3144,6 +3030,118 @@ bool MainWindow::judgeDiskSpace(QString currentPath)
|
|||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::upgradeApp(QString pkgPath)
|
||||
{
|
||||
QString curPath = QDir::currentPath();
|
||||
QString tmpPath = QDir::tempPath();
|
||||
|
||||
#if defined(HG_CMP_MSC)
|
||||
#if defined(OEM_HANWANG)
|
||||
QFile::remove(tmpPath + "/HwUpgradeApp.exe");
|
||||
QFile::copy(curPath + "/HwUpgradeApp.exe", tmpPath + "/HwUpgradeApp.exe");
|
||||
QFile::remove(tmpPath + "/HwBase.dll");
|
||||
QFile::copy(curPath + "/HwBase.dll", tmpPath + "/HwBase.dll");
|
||||
QFile::remove(tmpPath + "/HwVersion.dll");
|
||||
QFile::copy(curPath + "/HwVersion.dll", tmpPath + "/HwVersion.dll");
|
||||
#elif defined(OEM_LISICHENG)
|
||||
QFile::remove(tmpPath + "/LscUpgradeApp.exe");
|
||||
QFile::copy(curPath + "/LscUpgradeApp.exe", tmpPath + "/LscUpgradeApp.exe");
|
||||
QFile::remove(tmpPath + "/LscBase.dll");
|
||||
QFile::copy(curPath + "/LscBase.dll", tmpPath + "/LscBase.dll");
|
||||
QFile::remove(tmpPath + "/LscVersion.dll");
|
||||
QFile::copy(curPath + "/LscVersion.dll", tmpPath + "/LscVersion.dll");
|
||||
#else
|
||||
QFile::remove(tmpPath + "/HGUpgradeApp.exe");
|
||||
QFile::copy(curPath + "/HGUpgradeApp.exe", tmpPath + "/HGUpgradeApp.exe");
|
||||
QFile::remove(tmpPath + "/HGBase.dll");
|
||||
QFile::copy(curPath + "/HGBase.dll", tmpPath + "/HGBase.dll");
|
||||
QFile::remove(tmpPath + "/HGVersion.dll");
|
||||
QFile::copy(curPath + "/HGVersion.dll", tmpPath + "/HGVersion.dll");
|
||||
#endif
|
||||
|
||||
QFile::remove(tmpPath + "/msvcp140.dll");
|
||||
QFile::copy(curPath + "/msvcp140.dll", tmpPath + "/msvcp140.dll");
|
||||
QFile::remove(tmpPath + "/Qt5Core.dll");
|
||||
QFile::copy(curPath + "/Qt5Core.dll", tmpPath + "/Qt5Core.dll");
|
||||
QFile::remove(tmpPath + "/Qt5Gui.dll");
|
||||
QFile::copy(curPath + "/Qt5Gui.dll", tmpPath + "/Qt5Gui.dll");
|
||||
QFile::remove(tmpPath + "/Qt5Widgets.dll");
|
||||
QFile::copy(curPath + "/Qt5Widgets.dll", tmpPath + "/Qt5Widgets.dll");
|
||||
QFile::remove(tmpPath + "/vcruntime140.dll");
|
||||
QFile::copy(curPath + "/vcruntime140.dll", tmpPath + "/vcruntime140.dll");
|
||||
QDir dir;
|
||||
dir.mkdir(tmpPath + "/platforms");
|
||||
QFile::remove(tmpPath + "/platforms/qwindows.dll");
|
||||
QFile::copy(curPath + "/platforms/qwindows.dll", tmpPath + "/platforms/qwindows.dll");
|
||||
dir.mkdir(tmpPath + "/imageformats");
|
||||
QFile::remove(tmpPath + "/imageformats/qgif.dll");
|
||||
QFile::copy(curPath + "/imageformats/qgif.dll", tmpPath + "/imageformats/qgif.dll");
|
||||
#else
|
||||
#if defined(OEM_HANWANG)
|
||||
QFile::remove(tmpPath + "/HwUpgradeApp");
|
||||
QFile::copy(curPath + "/HwUpgradeApp", tmpPath + "/HwUpgradeApp");
|
||||
QFile::remove(tmpPath + "/libHwBase.so");
|
||||
QFile::copy(curPath + "/libHwBase.so", tmpPath + "/libHwBase.so");
|
||||
QFile::remove(tmpPath + "/libHwVersion.so");
|
||||
QFile::copy(curPath + "/libHwVersion.so", tmpPath + "/libHwVersion.so");
|
||||
#elif defined(OEM_LISICHENG)
|
||||
QFile::remove(tmpPath + "/LscUpgradeApp");
|
||||
QFile::copy(curPath + "/LscUpgradeApp", tmpPath + "/LscUpgradeApp");
|
||||
QFile::remove(tmpPath + "/libLscBase.so");
|
||||
QFile::copy(curPath + "/libLscBase.so", tmpPath + "/libLscBase.so");
|
||||
QFile::remove(tmpPath + "/libLscVersion.so");
|
||||
QFile::copy(curPath + "/libLscVersion.so", tmpPath + "/libLscVersion.so");
|
||||
#else
|
||||
QFile::remove(tmpPath + "/HGUpgradeApp");
|
||||
QFile::copy(curPath + "/HGUpgradeApp", tmpPath + "/HGUpgradeApp");
|
||||
QFile::remove(tmpPath + "/libHGBase.so");
|
||||
QFile::copy(curPath + "/libHGBase.so", tmpPath + "/libHGBase.so");
|
||||
QFile::remove(tmpPath + "/libHGVersion.so");
|
||||
QFile::copy(curPath + "/libHGVersion.so", tmpPath + "/libHGVersion.so");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
QProcess proc;
|
||||
bool isSuccessdStart = false;
|
||||
|
||||
QStringList argList;
|
||||
argList.push_back(QString("-appName=%1").arg(HGVERSION_APPNAME_SCANNER));
|
||||
argList.push_back(QString("-pkgpath=%1").arg(pkgPath.toStdString().c_str()));
|
||||
argList.push_back(QString("-type=%1").arg("upgrade"));
|
||||
|
||||
#if defined(HG_CMP_MSC)
|
||||
#if defined(OEM_HANWANG)
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/HwUpgradeApp.exe", argList);
|
||||
#elif defined(OEM_LISICHENG)
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/LscUpgradeApp.exe", argList);
|
||||
#else
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/HGUpgradeApp.exe", argList);
|
||||
#endif
|
||||
#else
|
||||
#if defined(OEM_HANWANG)
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/HwUpgradeApp", argList);
|
||||
#elif defined(OEM_LISICHENG)
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/LscUpgradeApp", argList);
|
||||
#else
|
||||
isSuccessdStart = proc.startDetached(tmpPath + "/HGUpgradeApp", argList);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (isSuccessdStart)
|
||||
{
|
||||
m_closeTip = false;
|
||||
close();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, tr("error"),
|
||||
tr("start failed!"),
|
||||
QMessageBox::Ok, this);
|
||||
msg.setButtonText(QMessageBox::Ok, tr("yes"));
|
||||
msg.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_scanOptions_changed(const QString &device, const QString &option, bool checked_now)
|
||||
{
|
||||
QString title(tr("app name"));
|
||||
|
@ -3300,13 +3298,13 @@ void MainWindow::on_actionact_update_triggered()
|
|||
|
||||
if (md5 == md5_2)
|
||||
{
|
||||
on_upgradeApp(savePath);
|
||||
upgradeApp(savePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
on_upgradeApp(savePath);
|
||||
upgradeApp(savePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,6 @@ private slots:
|
|||
void on_continueScan();
|
||||
void on_stopScan();
|
||||
void on_statusInfoDblClick();
|
||||
void on_upgradeApp(QString pkgPath);
|
||||
|
||||
void on_act_thumbnailBar_triggered(bool checked);
|
||||
|
||||
|
@ -229,6 +228,7 @@ private:
|
|||
QString passwordDecrypt(const QString& transcode);
|
||||
bool open_scanner(const QString& name, OPTSCHEME* schm);
|
||||
bool judgeDiskSpace(QString currentPath);
|
||||
void upgradeApp(QString pkgPath);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
|
Loading…
Reference in New Issue