mirror of https://github.com/AxioDL/metaforce.git
Merge pull request #3 from lioncash/ptr
General: Use unique_ptr for UI instances
This commit is contained in:
commit
b2ce4b983c
|
@ -6,16 +6,13 @@
|
||||||
|
|
||||||
ArgumentEditor::ArgumentEditor(QWidget* parent)
|
ArgumentEditor::ArgumentEditor(QWidget* parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_ui(new Ui::ArgumentEditor) {
|
, m_ui(std::make_unique<Ui::ArgumentEditor>()) {
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_model.setStringList(QSettings().value("urde_arguments").toStringList());
|
m_model.setStringList(QSettings().value("urde_arguments").toStringList());
|
||||||
m_ui->argumentEditor->setModel(&m_model);
|
m_ui->argumentEditor->setModel(&m_model);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgumentEditor::~ArgumentEditor() {
|
ArgumentEditor::~ArgumentEditor() = default;
|
||||||
delete m_ui;
|
|
||||||
m_ui = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArgumentEditor::on_addButton_clicked() {
|
void ArgumentEditor::on_addButton_clicked() {
|
||||||
QInputDialog input(this);
|
QInputDialog input(this);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QStringListModel>
|
#include <QStringListModel>
|
||||||
|
|
||||||
|
@ -11,10 +13,11 @@ class ArgumentEditor;
|
||||||
|
|
||||||
class ArgumentEditor : public QDialog {
|
class ArgumentEditor : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Ui::ArgumentEditor* m_ui;
|
|
||||||
|
std::unique_ptr<Ui::ArgumentEditor> m_ui;
|
||||||
QStringListModel m_model;
|
QStringListModel m_model;
|
||||||
public:
|
public:
|
||||||
explicit ArgumentEditor(QWidget* parent = 0);
|
explicit ArgumentEditor(QWidget* parent = nullptr);
|
||||||
virtual ~ArgumentEditor();
|
virtual ~ArgumentEditor();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -57,10 +57,10 @@ const QStringList MainWindow::skUpdateTracks = QStringList() << "stable" << "dev
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget* parent)
|
MainWindow::MainWindow(QWidget* parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
|
, m_ui(std::make_unique<Ui::MainWindow>())
|
||||||
, m_fileMgr(_SYS_STR("urde"))
|
, m_fileMgr(_SYS_STR("urde"))
|
||||||
, m_cvarManager(m_fileMgr)
|
, m_cvarManager(m_fileMgr)
|
||||||
, m_cvarCommons(m_cvarManager)
|
, m_cvarCommons(m_cvarManager)
|
||||||
, m_ui(new Ui::MainWindow)
|
|
||||||
, m_heclProc(this)
|
, m_heclProc(this)
|
||||||
, m_dlManager(this)
|
, m_dlManager(this)
|
||||||
, m_launchMenu(m_cvarCommons, this) {
|
, m_launchMenu(m_cvarCommons, this) {
|
||||||
|
@ -109,7 +109,6 @@ MainWindow::MainWindow(QWidget* parent)
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
KillProcessTree(m_heclProc);
|
KillProcessTree(m_heclProc);
|
||||||
delete m_ui;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onExtract() {
|
void MainWindow::onExtract() {
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
#include <memory>
|
|
||||||
|
#include "Common.hpp"
|
||||||
#include "DownloadManager.hpp"
|
#include "DownloadManager.hpp"
|
||||||
#include "LaunchMenu.hpp"
|
#include "LaunchMenu.hpp"
|
||||||
#include "Common.hpp"
|
|
||||||
#include "hecl/Runtime.hpp"
|
#include <hecl/CVarCommons.hpp>
|
||||||
#include "hecl/CVarCommons.hpp"
|
#include <hecl/Runtime.hpp>
|
||||||
class QTextEdit;
|
|
||||||
class QTextCharFormat;
|
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
class QTextCharFormat;
|
||||||
|
class QTextEdit;
|
||||||
class QuaZip;
|
class QuaZip;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -21,10 +25,10 @@ class MainWindow;
|
||||||
class MainWindow : public QMainWindow {
|
class MainWindow : public QMainWindow {
|
||||||
static const QStringList skUpdateTracks;
|
static const QStringList skUpdateTracks;
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
std::unique_ptr<Ui::MainWindow> m_ui;
|
||||||
hecl::Runtime::FileStoreManager m_fileMgr;
|
hecl::Runtime::FileStoreManager m_fileMgr;
|
||||||
hecl::CVarManager m_cvarManager;
|
hecl::CVarManager m_cvarManager;
|
||||||
hecl::CVarCommons m_cvarCommons;
|
hecl::CVarCommons m_cvarCommons;
|
||||||
Ui::MainWindow* m_ui;
|
|
||||||
QTextCursor m_cursor;
|
QTextCursor m_cursor;
|
||||||
QString m_path;
|
QString m_path;
|
||||||
QString m_urdePath;
|
QString m_urdePath;
|
||||||
|
@ -38,7 +42,7 @@ class MainWindow : public QMainWindow {
|
||||||
bool m_inContinueNote = false;
|
bool m_inContinueNote = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget* parent = 0);
|
explicit MainWindow(QWidget* parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
void setTextTermFormatting(const QString& text);
|
void setTextTermFormatting(const QString& text);
|
||||||
void insertContinueNote(const QString& text);
|
void insertContinueNote(const QString& text);
|
||||||
|
|
Loading…
Reference in New Issue