code_app/app/upgrade/mainwindow.cpp

40 lines
962 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
MainWindow::MainWindow(const std::string& pkgPath, const std::string& src, const std::string& desc, QWidget *parent)
2022-06-29 09:46:00 +00:00
: QMainWindow(parent)
, ui(new Ui::MainWindow)
, m_pkgPath(pkgPath)
, m_src(src)
, m_desc(desc)
, 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 = NULL;
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, p->m_src, p->m_desc);
emit p->closeWnd();
}