#include "mainwindow.h" #include "ui_mainwindow.h" #include "HGUpgrade.h" #include #include MainWindow::MainWindow(const std::string &appName, const std::string& pkgPath, QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , m_appName(appName) , m_pkgPath(pkgPath) , m_thread(nullptr) { ui->setupUi(this); setWindowTitle(tr("Installation")); setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint); ui->label_text->setText(tr("Installation in progress, please wait...")); QMovie *movie = new QMovie(":images/image_rsc/logo/waiting.gif"); ui->label_gif->setMovie(movie); movie->setCacheMode(QMovie::CacheAll); movie->setScaledSize(QSize(ui->label_gif->width(), ui->label_gif->height())); movie->start(); ui->label_gif->show(); 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(); }