升级后不再发送安装日志,因为会和安装包发送的重复
This commit is contained in:
parent
5b101e1464
commit
6d52429a2a
|
@ -386,7 +386,7 @@ bool PostUninstallInfo(const std::string &desc)
|
||||||
return PostInfo(2, desc);
|
return PostInfo(2, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Setup(const std::string& pkgPath)
|
bool Upgrade(const std::string& pkgPath)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ static bool Setup(const std::string& pkgPath)
|
||||||
STARTUPINFOA StartupInfo;
|
STARTUPINFOA StartupInfo;
|
||||||
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
|
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
|
||||||
StartupInfo.cb = sizeof(StartupInfo);
|
StartupInfo.cb = sizeof(StartupInfo);
|
||||||
|
|
||||||
char command[256];
|
char command[256];
|
||||||
sprintf(command, "%s %s", pkgPath.c_str(), "/verysilent");
|
sprintf(command, "%s %s", pkgPath.c_str(), "/verysilent");
|
||||||
if (CreateProcessA(nullptr, command, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &StartupInfo, &ProcessInfo))
|
if (CreateProcessA(nullptr, command, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &StartupInfo, &ProcessInfo))
|
||||||
|
@ -416,14 +416,6 @@ static bool Setup(const std::string& pkgPath)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Upgrade(const std::string& pkgPath, const std::string &desc)
|
|
||||||
{
|
|
||||||
bool ret = Setup(pkgPath);
|
|
||||||
if (ret)
|
|
||||||
PostInfo(1, desc);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AppIsRun()
|
bool AppIsRun()
|
||||||
{
|
{
|
||||||
#if defined(HG_CMP_MSC)
|
#if defined(HG_CMP_MSC)
|
||||||
|
|
|
@ -10,7 +10,7 @@ bool PostInstallInfo(const std::string &desc);
|
||||||
bool PostUninstallInfo(const std::string &desc);
|
bool PostUninstallInfo(const std::string &desc);
|
||||||
|
|
||||||
// 升级安装, 使用之前的安装路径
|
// 升级安装, 使用之前的安装路径
|
||||||
bool Upgrade(const std::string& pkgPath, const std::string &desc);
|
bool Upgrade(const std::string& pkgPath);
|
||||||
|
|
||||||
// 判断app是否在运行
|
// 判断app是否在运行
|
||||||
bool AppIsRun();
|
bool AppIsRun();
|
||||||
|
|
|
@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
||||||
while (AppIsRun())
|
while (AppIsRun())
|
||||||
QThread::msleep(20);
|
QThread::msleep(20);
|
||||||
|
|
||||||
MainWindow w(pkgPath, desc);
|
MainWindow w(pkgPath);
|
||||||
QScreen *screen = QGuiApplication::primaryScreen();
|
QScreen *screen = QGuiApplication::primaryScreen();
|
||||||
w.move((screen->size().width() - w.width()) / 2, (screen->size().height() - w.height()) / 2);
|
w.move((screen->size().width() - w.width()) / 2, (screen->size().height() - w.height()) / 2);
|
||||||
w.show();
|
w.show();
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "HGUpgrade.h"
|
#include "HGUpgrade.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(const std::string& pkgPath, const std::string& desc, QWidget *parent)
|
MainWindow::MainWindow(const std::string& pkgPath, QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
, m_pkgPath(pkgPath)
|
, m_pkgPath(pkgPath)
|
||||||
, m_desc(desc)
|
|
||||||
, m_thread(nullptr)
|
, m_thread(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -31,7 +30,7 @@ void MainWindow::ThreadFunc(HGThread thread, HGPointer param)
|
||||||
{
|
{
|
||||||
(void)thread;
|
(void)thread;
|
||||||
MainWindow* p = (MainWindow*)param;
|
MainWindow* p = (MainWindow*)param;
|
||||||
Upgrade(p->m_pkgPath, p->m_desc);
|
Upgrade(p->m_pkgPath);
|
||||||
|
|
||||||
emit p->closeWnd();
|
emit p->closeWnd();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ class MainWindow : public QMainWindow
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(const std::string &pkgPath, const std::string& desc, QWidget *parent = nullptr);
|
MainWindow(const std::string &pkgPath, QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -26,7 +26,6 @@ private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
||||||
std::string m_pkgPath;
|
std::string m_pkgPath;
|
||||||
std::string m_desc;
|
|
||||||
HGThread m_thread;
|
HGThread m_thread;
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
Loading…
Reference in New Issue