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