From 1f0cbf43d6323669ac3b4b1e1b557929413d47c6 Mon Sep 17 00:00:00 2001
From: fearlessTobi <thm.frey@gmail.com>
Date: Fri, 24 Aug 2018 17:14:09 +0200
Subject: [PATCH 1/2] Port #942 from yuzu: "qt: Minor cleanup-related changes"

---
 src/citra_qt/aboutdialog.cpp                    |  4 +---
 src/citra_qt/aboutdialog.h                      |  2 +-
 src/citra_qt/bootmanager.h                      |  2 +-
 src/citra_qt/configuration/configure_debug.cpp  |  2 +-
 src/citra_qt/configuration/configure_dialog.cpp |  2 +-
 .../configuration/configure_general.cpp         |  2 +-
 .../configuration/configure_graphics.cpp        |  2 +-
 src/citra_qt/configuration/configure_system.cpp |  2 +-
 .../debugger/graphics/graphics_surface.cpp      |  3 ++-
 .../debugger/graphics/graphics_surface.h        |  6 +++---
 src/citra_qt/debugger/wait_tree.cpp             |  2 +-
 src/citra_qt/debugger/wait_tree.h               |  4 +++-
 src/citra_qt/game_list_p.h                      | 17 ++++++++---------
 13 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/citra_qt/aboutdialog.cpp b/src/citra_qt/aboutdialog.cpp
index 65d815427..ac2d3d91c 100644
--- a/src/citra_qt/aboutdialog.cpp
+++ b/src/citra_qt/aboutdialog.cpp
@@ -17,6 +17,4 @@ AboutDialog::AboutDialog(QWidget* parent)
                                        Common::g_scm_desc, QString(Common::g_build_date).left(10)));
 }
 
-AboutDialog::~AboutDialog() {
-    delete ui;
-}
+AboutDialog::~AboutDialog() = default;
diff --git a/src/citra_qt/aboutdialog.h b/src/citra_qt/aboutdialog.h
index 606789774..0148a08de 100644
--- a/src/citra_qt/aboutdialog.h
+++ b/src/citra_qt/aboutdialog.h
@@ -16,7 +16,7 @@ class AboutDialog : public QDialog {
 
 public:
     explicit AboutDialog(QWidget* parent = 0);
-    ~AboutDialog();
+    ~AboutDialog() override;
 
 private:
     Ui::AboutDialog* ui;
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h
index 39c280dbd..349bb17cb 100644
--- a/src/citra_qt/bootmanager.h
+++ b/src/citra_qt/bootmanager.h
@@ -106,7 +106,7 @@ class GRenderWindow : public QWidget, public EmuWindow {
 
 public:
     GRenderWindow(QWidget* parent, EmuThread* emu_thread);
-    ~GRenderWindow();
+    ~GRenderWindow() override;
 
     // EmuWindow implementation
     void SwapBuffers() override;
diff --git a/src/citra_qt/configuration/configure_debug.cpp b/src/citra_qt/configuration/configure_debug.cpp
index fa1294f25..7d879d1e4 100644
--- a/src/citra_qt/configuration/configure_debug.cpp
+++ b/src/citra_qt/configuration/configure_debug.cpp
@@ -25,7 +25,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co
     ui->toggle_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
 }
 
-ConfigureDebug::~ConfigureDebug() {}
+ConfigureDebug::~ConfigureDebug() = default;
 
 void ConfigureDebug::setConfiguration() {
     ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub);
diff --git a/src/citra_qt/configuration/configure_dialog.cpp b/src/citra_qt/configuration/configure_dialog.cpp
index b0ff30ad2..ca96b5f3d 100644
--- a/src/citra_qt/configuration/configure_dialog.cpp
+++ b/src/citra_qt/configuration/configure_dialog.cpp
@@ -14,7 +14,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui::
             &ConfigureDialog::onLanguageChanged);
 }
 
-ConfigureDialog::~ConfigureDialog() {}
+ConfigureDialog::~ConfigureDialog() = default;
 
 void ConfigureDialog::setConfiguration() {}
 
diff --git a/src/citra_qt/configuration/configure_general.cpp b/src/citra_qt/configuration/configure_general.cpp
index 58a7d4432..a6df681b1 100644
--- a/src/citra_qt/configuration/configure_general.cpp
+++ b/src/citra_qt/configuration/configure_general.cpp
@@ -40,7 +40,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
     ui->updateBox->setVisible(UISettings::values.updater_found);
 }
 
-ConfigureGeneral::~ConfigureGeneral() {}
+ConfigureGeneral::~ConfigureGeneral() = default;
 
 void ConfigureGeneral::setConfiguration() {
     ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
diff --git a/src/citra_qt/configuration/configure_graphics.cpp b/src/citra_qt/configuration/configure_graphics.cpp
index 4e4aeb8cd..4bbb7d19f 100644
--- a/src/citra_qt/configuration/configure_graphics.cpp
+++ b/src/citra_qt/configuration/configure_graphics.cpp
@@ -52,7 +52,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
     });
 }
 
-ConfigureGraphics::~ConfigureGraphics() {}
+ConfigureGraphics::~ConfigureGraphics() = default;
 
 void ConfigureGraphics::setConfiguration() {
     ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
diff --git a/src/citra_qt/configuration/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp
index b83a3a565..dc5f6d182 100644
--- a/src/citra_qt/configuration/configure_system.cpp
+++ b/src/citra_qt/configuration/configure_system.cpp
@@ -231,7 +231,7 @@ ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::
     this->setConfiguration();
 }
 
-ConfigureSystem::~ConfigureSystem() {}
+ConfigureSystem::~ConfigureSystem() = default;
 
 void ConfigureSystem::setConfiguration() {
     enabled = !Core::System::GetInstance().IsPoweredOn();
diff --git a/src/citra_qt/debugger/graphics/graphics_surface.cpp b/src/citra_qt/debugger/graphics/graphics_surface.cpp
index 0ac746906..d480505b0 100644
--- a/src/citra_qt/debugger/graphics/graphics_surface.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_surface.cpp
@@ -24,7 +24,8 @@
 
 SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_)
     : QLabel(parent), surface_widget(surface_widget_) {}
-SurfacePicture::~SurfacePicture() {}
+
+SurfacePicture::~SurfacePicture() = default;
 
 void SurfacePicture::mousePressEvent(QMouseEvent* event) {
     // Only do something while the left mouse button is held down
diff --git a/src/citra_qt/debugger/graphics/graphics_surface.h b/src/citra_qt/debugger/graphics/graphics_surface.h
index 28f5650a7..5ccf7ef92 100644
--- a/src/citra_qt/debugger/graphics/graphics_surface.h
+++ b/src/citra_qt/debugger/graphics/graphics_surface.h
@@ -20,11 +20,11 @@ class SurfacePicture : public QLabel {
 public:
     explicit SurfacePicture(QWidget* parent = nullptr,
                             GraphicsSurfaceWidget* surface_widget = nullptr);
-    ~SurfacePicture();
+    ~SurfacePicture() override;
 
 protected slots:
-    virtual void mouseMoveEvent(QMouseEvent* event);
-    virtual void mousePressEvent(QMouseEvent* event);
+    void mouseMoveEvent(QMouseEvent* event) override;
+    void mousePressEvent(QMouseEvent* event) override;
 
 private:
     GraphicsSurfaceWidget* surface_widget;
diff --git a/src/citra_qt/debugger/wait_tree.cpp b/src/citra_qt/debugger/wait_tree.cpp
index 61d422558..2114691c9 100644
--- a/src/citra_qt/debugger/wait_tree.cpp
+++ b/src/citra_qt/debugger/wait_tree.cpp
@@ -13,7 +13,7 @@
 #include "core/hle/kernel/timer.h"
 #include "core/hle/kernel/wait_object.h"
 
-WaitTreeItem::~WaitTreeItem() {}
+WaitTreeItem::~WaitTreeItem() = default;
 
 QColor WaitTreeItem::GetColor() const {
     return QColor(Qt::GlobalColor::black);
diff --git a/src/citra_qt/debugger/wait_tree.h b/src/citra_qt/debugger/wait_tree.h
index 24a235a76..719a49532 100644
--- a/src/citra_qt/debugger/wait_tree.h
+++ b/src/citra_qt/debugger/wait_tree.h
@@ -27,11 +27,13 @@ class WaitTreeThread;
 class WaitTreeItem : public QObject {
     Q_OBJECT
 public:
+    ~WaitTreeItem() override;
+
     virtual bool IsExpandable() const;
     virtual std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const;
     virtual QString GetText() const = 0;
     virtual QColor GetColor() const;
-    virtual ~WaitTreeItem();
+
     void Expand();
     WaitTreeItem* Parent() const;
     const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const;
diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h
index 93a98fd47..aa8480eb5 100644
--- a/src/citra_qt/game_list_p.h
+++ b/src/citra_qt/game_list_p.h
@@ -7,6 +7,7 @@
 #include <atomic>
 #include <map>
 #include <unordered_map>
+#include <utility>
 #include <QCoreApplication>
 #include <QFileInfo>
 #include <QImage>
@@ -142,11 +143,10 @@ public:
     // used to access type from item index
     static const int TypeRole = Qt::UserRole + 1;
     static const int SortRole = Qt::UserRole + 2;
-    GameListItem() : QStandardItem() {}
-    GameListItem(const QString& string) : QStandardItem(string) {
+    GameListItem() = default;
+    explicit GameListItem(const QString& string) : QStandardItem(string) {
         setData(string, SortRole);
     }
-    virtual ~GameListItem() override {}
 };
 
 /**
@@ -161,9 +161,8 @@ public:
     static const int FullPathRole = SortRole + 1;
     static const int ProgramIdRole = SortRole + 2;
 
-    GameListItemPath() : GameListItem() {}
-    GameListItemPath(const QString& game_path, const std::vector<u8>& smdh_data, u64 program_id)
-        : GameListItem() {
+    GameListItemPath() = default;
+    GameListItemPath(const QString& game_path, const std::vector<u8>& smdh_data, u64 program_id) {
         setData(type(), TypeRole);
         setData(game_path, FullPathRole);
         setData(qulonglong(program_id), ProgramIdRole);
@@ -284,8 +283,8 @@ class GameListItemSize : public GameListItem {
 public:
     static const int SizeRole = SortRole;
 
-    GameListItemSize() : GameListItem() {}
-    GameListItemSize(const qulonglong size_bytes) : GameListItem() {
+    GameListItemSize() = default;
+    explicit GameListItemSize(const qulonglong size_bytes) {
         setData(type(), TypeRole);
         setData(size_bytes, SizeRole);
     }
@@ -376,7 +375,7 @@ public:
     explicit GameListWorker(
         QList<UISettings::GameDir>& game_dirs,
         const std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list)
-        : QObject(), QRunnable(), game_dirs(game_dirs), compatibility_list(compatibility_list) {}
+        : game_dirs(game_dirs), compatibility_list(compatibility_list) {}
 
 public slots:
     /// Starts the processing of directory tree information.

From 4bf76833b8f7e09c0d6f57b2bb2ace64bd68ef76 Mon Sep 17 00:00:00 2001
From: fearlessTobi <thm.frey@gmail.com>
Date: Sat, 25 Aug 2018 14:45:50 +0200
Subject: [PATCH 2/2] Clean up aboutdialog.h

---
 src/citra_qt/aboutdialog.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/citra_qt/aboutdialog.h b/src/citra_qt/aboutdialog.h
index 0148a08de..43d76e1c8 100644
--- a/src/citra_qt/aboutdialog.h
+++ b/src/citra_qt/aboutdialog.h
@@ -2,9 +2,9 @@
 // Licensed under GPLv2 or any later version
 // Refer to the license.txt file included.
 
-#ifndef ABOUTDIALOG_H
-#define ABOUTDIALOG_H
+#pragma once
 
+#include <memory>
 #include <QDialog>
 
 namespace Ui {
@@ -19,7 +19,5 @@ public:
     ~AboutDialog() override;
 
 private:
-    Ui::AboutDialog* ui;
+    std::unique_ptr<Ui::AboutDialog> ui;
 };
-
-#endif // ABOUTDIALOG_H