code_app/app/upgrade/mainwindow.cpp

39 lines
912 B
C++
Raw Normal View History

2022-06-29 09:46:00 +00:00
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "HGUpgrade.h"
2022-06-29 09:46:00 +00:00
2022-07-14 04:01:39 +00:00
MainWindow::MainWindow(const std::string &appName, const std::string& pkgPath, QWidget *parent)
2022-06-29 09:46:00 +00:00
: QMainWindow(parent)
, ui(new Ui::MainWindow)
2022-07-14 04:01:39 +00:00
, m_appName(appName)
, m_pkgPath(pkgPath)
, m_thread(nullptr)
2022-06-29 09:46:00 +00:00
{
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);
2022-06-29 09:46:00 +00:00
}
MainWindow::~MainWindow()
{
HGBase_CloseThread(m_thread);
m_thread = nullptr;
2022-06-29 09:46:00 +00:00
delete ui;
}
void MainWindow::ThreadFunc(HGThread thread, HGPointer param)
{
(void)thread;
MainWindow* p = (MainWindow*)param;
Upgrade(p->m_pkgPath);
emit p->closeWnd();
}