2022-06-29 09:46:00 +00:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "ui_mainwindow.h"
|
2022-06-30 08:42:46 +00:00
|
|
|
#include "HGUpgrade.h"
|
2022-06-29 09:46:00 +00:00
|
|
|
|
2022-06-30 08:42:46 +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)
|
2022-06-30 08:42:46 +00:00
|
|
|
, m_pkgPath(pkgPath)
|
|
|
|
, m_src(src)
|
|
|
|
, m_desc(desc)
|
|
|
|
, m_thread(nullptr)
|
2022-06-29 09:46:00 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2022-06-30 08:42:46 +00:00
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
2022-06-30 08:42:46 +00:00
|
|
|
HGBase_CloseThread(m_thread);
|
|
|
|
m_thread = NULL;
|
|
|
|
|
2022-06-29 09:46:00 +00:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2022-06-30 08:42:46 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|