#include "mainwindow.h" #include "ui_mainwindow.h" #include "HGUpgrade.h" MainWindow::MainWindow(const std::string& pkgPath, QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , m_pkgPath(pkgPath) , m_thread(nullptr) { ui->setupUi(this); setWindowTitle(tr("Installation in progress, please wait...")); setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint); connect(this, SIGNAL(closeWnd()), this, SLOT(close()), Qt::QueuedConnection); HGBase_OpenThread(ThreadFunc, this, &m_thread); } MainWindow::~MainWindow() { HGBase_CloseThread(m_thread); m_thread = nullptr; delete ui; } void MainWindow::ThreadFunc(HGThread thread, HGPointer param) { (void)thread; MainWindow* p = (MainWindow*)param; Upgrade(p->m_pkgPath); emit p->closeWnd(); }