39 lines
912 B
C++
39 lines
912 B
C++
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
#include "HGUpgrade.h"
|
|
|
|
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 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();
|
|
}
|
|
|