mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-01 10:53:30 +00:00
CExportGameDialog: Make use of in-class initializers where applicable
This commit is contained in:
parent
fea1c4e115
commit
c4b29106f1
@ -20,25 +20,17 @@
|
||||
|
||||
CExportGameDialog::CExportGameDialog(const QString& rkIsoPath, const QString& rkExportDir, QWidget *pParent /*= 0*/)
|
||||
: QDialog(pParent)
|
||||
, mpUI(new Ui::CExportGameDialog)
|
||||
, mpDisc(nullptr)
|
||||
, mpExporter(nullptr)
|
||||
, mDiscType(EDiscType::Normal)
|
||||
, mGame(EGame::Invalid)
|
||||
, mRegion(ERegion::Unknown)
|
||||
, mBuildVer(0.f)
|
||||
, mWiiFrontend(false)
|
||||
, mExportSuccess(false)
|
||||
, mpUI(std::make_unique<Ui::CExportGameDialog>())
|
||||
{
|
||||
mpUI->setupUi(this);
|
||||
|
||||
// Set up disc
|
||||
mpDisc = nod::OpenDiscFromImage(QStringToNodString(rkIsoPath)).release();
|
||||
mpDisc = nod::OpenDiscFromImage(QStringToNodString(rkIsoPath));
|
||||
|
||||
if (ValidateGame())
|
||||
{
|
||||
mBuildVer = FindBuildVersion();
|
||||
mpExporter = new CGameExporter(mDiscType, mGame, mWiiFrontend, mRegion, mGameTitle, mGameID, mBuildVer);
|
||||
mpExporter = std::make_unique<CGameExporter>(mDiscType, mGame, mWiiFrontend, mRegion, mGameTitle, mGameID, mBuildVer);
|
||||
InitUI(rkExportDir);
|
||||
|
||||
TString IsoName = TO_TSTRING(rkIsoPath).GetFileName();
|
||||
@ -46,17 +38,11 @@ CExportGameDialog::CExportGameDialog(const QString& rkIsoPath, const QString& rk
|
||||
}
|
||||
else
|
||||
{
|
||||
delete mpDisc;
|
||||
mpDisc = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
CExportGameDialog::~CExportGameDialog()
|
||||
{
|
||||
delete mpUI;
|
||||
delete mpDisc;
|
||||
delete mpExporter;
|
||||
}
|
||||
CExportGameDialog::~CExportGameDialog() = default;
|
||||
|
||||
void RecursiveAddToTree(const nod::Node *pkNode, QTreeWidgetItem *pParent);
|
||||
|
||||
@ -457,7 +443,7 @@ void CExportGameDialog::Export()
|
||||
StrExportDir.EnsureEndsWith('/');
|
||||
|
||||
CProgressDialog Dialog("Creating new game project", false, true, parentWidget());
|
||||
QFuture<bool> Future = QtConcurrent::run(mpExporter, &CGameExporter::Export, mpDisc, StrExportDir, &NameMap, &GameInfo, &Dialog);
|
||||
QFuture<bool> Future = QtConcurrent::run(mpExporter.get(), &CGameExporter::Export, mpDisc.get(), StrExportDir, &NameMap, &GameInfo, &Dialog);
|
||||
mExportSuccess = Dialog.WaitForResults(Future);
|
||||
|
||||
if (!mExportSuccess)
|
||||
@ -466,5 +452,7 @@ void CExportGameDialog::Export()
|
||||
UICommon::ErrorMsg(this, "Export failed!");
|
||||
}
|
||||
else
|
||||
{
|
||||
mNewProjectPath = TO_QSTRING(mpExporter->ProjectPath());
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QDialog>
|
||||
#include <QString>
|
||||
#include <nod/DiscBase.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
class CExportGameDialog;
|
||||
@ -16,25 +17,25 @@ class CExportGameDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Ui::CExportGameDialog *mpUI;
|
||||
nod::DiscBase *mpDisc;
|
||||
CGameExporter *mpExporter;
|
||||
std::unique_ptr<Ui::CExportGameDialog> mpUI;
|
||||
std::unique_ptr<nod::DiscBase> mpDisc;
|
||||
std::unique_ptr<CGameExporter> mpExporter;
|
||||
|
||||
TString mGameTitle;
|
||||
TString mGameID;
|
||||
|
||||
// Build Info
|
||||
EDiscType mDiscType;
|
||||
EGame mGame;
|
||||
ERegion mRegion;
|
||||
float mBuildVer;
|
||||
bool mWiiFrontend;
|
||||
EDiscType mDiscType{EDiscType::Normal};
|
||||
EGame mGame{EGame::Invalid};
|
||||
ERegion mRegion{ERegion::Unknown};
|
||||
float mBuildVer = 0.0f;
|
||||
bool mWiiFrontend = false;
|
||||
|
||||
bool mExportSuccess;
|
||||
bool mExportSuccess = false;
|
||||
QString mNewProjectPath;
|
||||
|
||||
public:
|
||||
explicit CExportGameDialog(const QString& rkIsoPath, const QString& rkExportDir, QWidget *pParent = 0);
|
||||
explicit CExportGameDialog(const QString& rkIsoPath, const QString& rkExportDir, QWidget *pParent = nullptr);
|
||||
~CExportGameDialog();
|
||||
|
||||
void InitUI(QString ExportDir);
|
||||
@ -46,9 +47,9 @@ public:
|
||||
void RecursiveAddToTree(const nod::Node *pkNode, class QTreeWidgetItem *pParent);
|
||||
|
||||
// Accessors
|
||||
inline bool HasValidDisc() const { return mpDisc != nullptr; }
|
||||
inline bool ExportSucceeded() const { return mExportSuccess; }
|
||||
inline QString ProjectPath() const { return mNewProjectPath; }
|
||||
bool HasValidDisc() const { return mpDisc != nullptr; }
|
||||
bool ExportSucceeded() const { return mExportSuccess; }
|
||||
QString ProjectPath() const { return mNewProjectPath; }
|
||||
|
||||
public slots:
|
||||
void BrowseOutputDirectory();
|
||||
|
Loading…
x
Reference in New Issue
Block a user