mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-28 12:40:06 +00:00
Use unique_ptr for Wizard::InstallationPage members
This commit is contained in:
parent
e222afc764
commit
c197896765
@ -17,38 +17,38 @@ Wizard::InstallationPage::InstallationPage(QWidget *parent, Config::GameSettings
|
|||||||
|
|
||||||
mFinished = false;
|
mFinished = false;
|
||||||
|
|
||||||
mThread = new QThread();
|
mThread = std::make_unique<QThread>();
|
||||||
mUnshield = new UnshieldWorker(mGameSettings.value("morrowind-bsa-filesize").toLongLong());
|
mUnshield = std::make_unique<UnshieldWorker>(mGameSettings.value("morrowind-bsa-filesize").toLongLong());
|
||||||
mUnshield->moveToThread(mThread);
|
mUnshield->moveToThread(mThread.get());
|
||||||
|
|
||||||
connect(mThread, SIGNAL(started()),
|
connect(mThread.get(), SIGNAL(started()),
|
||||||
mUnshield, SLOT(extract()));
|
mUnshield.get(), SLOT(extract()));
|
||||||
|
|
||||||
connect(mUnshield, SIGNAL(finished()),
|
connect(mUnshield.get(), SIGNAL(finished()),
|
||||||
mThread, SLOT(quit()));
|
mThread.get(), SLOT(quit()));
|
||||||
|
|
||||||
connect(mUnshield, SIGNAL(finished()),
|
connect(mUnshield.get(), SIGNAL(finished()),
|
||||||
this, SLOT(installationFinished()), Qt::QueuedConnection);
|
this, SLOT(installationFinished()), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(mUnshield, SIGNAL(error(QString, QString)),
|
connect(mUnshield.get(), SIGNAL(error(QString, QString)),
|
||||||
this, SLOT(installationError(QString, QString)), Qt::QueuedConnection);
|
this, SLOT(installationError(QString, QString)), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(mUnshield, SIGNAL(textChanged(QString)),
|
connect(mUnshield.get(), SIGNAL(textChanged(QString)),
|
||||||
installProgressLabel, SLOT(setText(QString)), Qt::QueuedConnection);
|
installProgressLabel, SLOT(setText(QString)), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(mUnshield, SIGNAL(textChanged(QString)),
|
connect(mUnshield.get(), SIGNAL(textChanged(QString)),
|
||||||
logTextEdit, SLOT(appendPlainText(QString)), Qt::QueuedConnection);
|
logTextEdit, SLOT(appendPlainText(QString)), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(mUnshield, SIGNAL(textChanged(QString)),
|
connect(mUnshield.get(), SIGNAL(textChanged(QString)),
|
||||||
mWizard, SLOT(addLogText(QString)), Qt::QueuedConnection);
|
mWizard, SLOT(addLogText(QString)), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(mUnshield, SIGNAL(progressChanged(int)),
|
connect(mUnshield.get(), SIGNAL(progressChanged(int)),
|
||||||
installProgressBar, SLOT(setValue(int)), Qt::QueuedConnection);
|
installProgressBar, SLOT(setValue(int)), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(mUnshield, SIGNAL(requestFileDialog(Wizard::Component)),
|
connect(mUnshield.get(), SIGNAL(requestFileDialog(Wizard::Component)),
|
||||||
this, SLOT(showFileDialog(Wizard::Component)), Qt::QueuedConnection);
|
this, SLOT(showFileDialog(Wizard::Component)), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(mUnshield, SIGNAL(requestOldVersionDialog()),
|
connect(mUnshield.get(), SIGNAL(requestOldVersionDialog()),
|
||||||
this, SLOT(showOldVersionDialog())
|
this, SLOT(showOldVersionDialog())
|
||||||
, Qt::QueuedConnection);
|
, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
@ -60,9 +60,6 @@ Wizard::InstallationPage::~InstallationPage()
|
|||||||
mThread->quit();
|
mThread->quit();
|
||||||
mThread->wait();
|
mThread->wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete mUnshield;
|
|
||||||
delete mThread;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wizard::InstallationPage::initializePage()
|
void Wizard::InstallationPage::initializePage()
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef INSTALLATIONPAGE_HPP
|
#ifndef INSTALLATIONPAGE_HPP
|
||||||
#define INSTALLATIONPAGE_HPP
|
#define INSTALLATIONPAGE_HPP
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <QWizardPage>
|
#include <QWizardPage>
|
||||||
|
|
||||||
#include "unshield/unshieldworker.hpp"
|
#include "unshield/unshieldworker.hpp"
|
||||||
@ -30,8 +32,8 @@ namespace Wizard
|
|||||||
MainWizard *mWizard;
|
MainWizard *mWizard;
|
||||||
bool mFinished;
|
bool mFinished;
|
||||||
|
|
||||||
QThread* mThread;
|
std::unique_ptr<QThread> mThread;
|
||||||
UnshieldWorker *mUnshield;
|
std::unique_ptr<UnshieldWorker> mUnshield;
|
||||||
|
|
||||||
void startInstallation();
|
void startInstallation();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user