Merge pull request #4130 from FearlessTobi/port-942

Port #942 from yuzu: "qt: Minor cleanup-related changes"
This commit is contained in:
James Rowe 2018-08-26 12:22:34 -06:00 committed by GitHub
commit 05118a2326
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 28 additions and 30 deletions

View file

@ -17,6 +17,4 @@ AboutDialog::AboutDialog(QWidget* parent)
Common::g_scm_desc, QString(Common::g_build_date).left(10))); Common::g_scm_desc, QString(Common::g_build_date).left(10)));
} }
AboutDialog::~AboutDialog() { AboutDialog::~AboutDialog() = default;
delete ui;
}

View file

@ -2,9 +2,9 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef ABOUTDIALOG_H #pragma once
#define ABOUTDIALOG_H
#include <memory>
#include <QDialog> #include <QDialog>
namespace Ui { namespace Ui {
@ -16,10 +16,8 @@ class AboutDialog : public QDialog {
public: public:
explicit AboutDialog(QWidget* parent = 0); explicit AboutDialog(QWidget* parent = 0);
~AboutDialog(); ~AboutDialog() override;
private: private:
Ui::AboutDialog* ui; std::unique_ptr<Ui::AboutDialog> ui;
}; };
#endif // ABOUTDIALOG_H

View file

@ -106,7 +106,7 @@ class GRenderWindow : public QWidget, public EmuWindow {
public: public:
GRenderWindow(QWidget* parent, EmuThread* emu_thread); GRenderWindow(QWidget* parent, EmuThread* emu_thread);
~GRenderWindow(); ~GRenderWindow() override;
// EmuWindow implementation // EmuWindow implementation
void SwapBuffers() override; void SwapBuffers() override;

View file

@ -25,7 +25,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co
ui->toggle_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn()); ui->toggle_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
} }
ConfigureDebug::~ConfigureDebug() {} ConfigureDebug::~ConfigureDebug() = default;
void ConfigureDebug::setConfiguration() { void ConfigureDebug::setConfiguration() {
ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub); ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub);

View file

@ -17,7 +17,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, const HotkeyRegistry& registry
&ConfigureDialog::onLanguageChanged); &ConfigureDialog::onLanguageChanged);
} }
ConfigureDialog::~ConfigureDialog() {} ConfigureDialog::~ConfigureDialog() = default;
void ConfigureDialog::setConfiguration() {} void ConfigureDialog::setConfiguration() {}

View file

@ -40,7 +40,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
ui->updateBox->setVisible(UISettings::values.updater_found); ui->updateBox->setVisible(UISettings::values.updater_found);
} }
ConfigureGeneral::~ConfigureGeneral() {} ConfigureGeneral::~ConfigureGeneral() = default;
void ConfigureGeneral::setConfiguration() { void ConfigureGeneral::setConfiguration() {
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);

View file

@ -52,7 +52,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
}); });
} }
ConfigureGraphics::~ConfigureGraphics() {} ConfigureGraphics::~ConfigureGraphics() = default;
void ConfigureGraphics::setConfiguration() { void ConfigureGraphics::setConfiguration() {
ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer); ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer);

View file

@ -235,7 +235,7 @@ ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::
ConfigureTime(); ConfigureTime();
} }
ConfigureSystem::~ConfigureSystem() {} ConfigureSystem::~ConfigureSystem() = default;
void ConfigureSystem::setConfiguration() { void ConfigureSystem::setConfiguration() {
enabled = !Core::System::GetInstance().IsPoweredOn(); enabled = !Core::System::GetInstance().IsPoweredOn();

View file

@ -24,7 +24,8 @@
SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_) SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_)
: QLabel(parent), surface_widget(surface_widget_) {} : QLabel(parent), surface_widget(surface_widget_) {}
SurfacePicture::~SurfacePicture() {}
SurfacePicture::~SurfacePicture() = default;
void SurfacePicture::mousePressEvent(QMouseEvent* event) { void SurfacePicture::mousePressEvent(QMouseEvent* event) {
// Only do something while the left mouse button is held down // Only do something while the left mouse button is held down

View file

@ -20,11 +20,11 @@ class SurfacePicture : public QLabel {
public: public:
explicit SurfacePicture(QWidget* parent = nullptr, explicit SurfacePicture(QWidget* parent = nullptr,
GraphicsSurfaceWidget* surface_widget = nullptr); GraphicsSurfaceWidget* surface_widget = nullptr);
~SurfacePicture(); ~SurfacePicture() override;
protected slots: protected slots:
virtual void mouseMoveEvent(QMouseEvent* event); void mouseMoveEvent(QMouseEvent* event) override;
virtual void mousePressEvent(QMouseEvent* event); void mousePressEvent(QMouseEvent* event) override;
private: private:
GraphicsSurfaceWidget* surface_widget; GraphicsSurfaceWidget* surface_widget;

View file

@ -13,7 +13,7 @@
#include "core/hle/kernel/timer.h" #include "core/hle/kernel/timer.h"
#include "core/hle/kernel/wait_object.h" #include "core/hle/kernel/wait_object.h"
WaitTreeItem::~WaitTreeItem() {} WaitTreeItem::~WaitTreeItem() = default;
QColor WaitTreeItem::GetColor() const { QColor WaitTreeItem::GetColor() const {
return QColor(Qt::GlobalColor::black); return QColor(Qt::GlobalColor::black);

View file

@ -27,11 +27,13 @@ class WaitTreeThread;
class WaitTreeItem : public QObject { class WaitTreeItem : public QObject {
Q_OBJECT Q_OBJECT
public: public:
~WaitTreeItem() override;
virtual bool IsExpandable() const; virtual bool IsExpandable() const;
virtual std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const; virtual std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const;
virtual QString GetText() const = 0; virtual QString GetText() const = 0;
virtual QColor GetColor() const; virtual QColor GetColor() const;
virtual ~WaitTreeItem();
void Expand(); void Expand();
WaitTreeItem* Parent() const; WaitTreeItem* Parent() const;
const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const; const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const;

View file

@ -7,6 +7,7 @@
#include <atomic> #include <atomic>
#include <map> #include <map>
#include <unordered_map> #include <unordered_map>
#include <utility>
#include <QCoreApplication> #include <QCoreApplication>
#include <QFileInfo> #include <QFileInfo>
#include <QImage> #include <QImage>
@ -142,11 +143,10 @@ public:
// used to access type from item index // used to access type from item index
static const int TypeRole = Qt::UserRole + 1; static const int TypeRole = Qt::UserRole + 1;
static const int SortRole = Qt::UserRole + 2; static const int SortRole = Qt::UserRole + 2;
GameListItem() : QStandardItem() {} GameListItem() = default;
GameListItem(const QString& string) : QStandardItem(string) { explicit GameListItem(const QString& string) : QStandardItem(string) {
setData(string, SortRole); setData(string, SortRole);
} }
virtual ~GameListItem() override {}
}; };
/** /**
@ -161,9 +161,8 @@ public:
static const int FullPathRole = SortRole + 1; static const int FullPathRole = SortRole + 1;
static const int ProgramIdRole = SortRole + 2; static const int ProgramIdRole = SortRole + 2;
GameListItemPath() : GameListItem() {} GameListItemPath() = default;
GameListItemPath(const QString& game_path, const std::vector<u8>& smdh_data, u64 program_id) GameListItemPath(const QString& game_path, const std::vector<u8>& smdh_data, u64 program_id) {
: GameListItem() {
setData(type(), TypeRole); setData(type(), TypeRole);
setData(game_path, FullPathRole); setData(game_path, FullPathRole);
setData(qulonglong(program_id), ProgramIdRole); setData(qulonglong(program_id), ProgramIdRole);
@ -284,8 +283,8 @@ class GameListItemSize : public GameListItem {
public: public:
static const int SizeRole = SortRole; static const int SizeRole = SortRole;
GameListItemSize() : GameListItem() {} GameListItemSize() = default;
GameListItemSize(const qulonglong size_bytes) : GameListItem() { explicit GameListItemSize(const qulonglong size_bytes) {
setData(type(), TypeRole); setData(type(), TypeRole);
setData(size_bytes, SizeRole); setData(size_bytes, SizeRole);
} }
@ -376,7 +375,7 @@ public:
explicit GameListWorker( explicit GameListWorker(
QList<UISettings::GameDir>& game_dirs, QList<UISettings::GameDir>& game_dirs,
const std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list) 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: public slots:
/// Starts the processing of directory tree information. /// Starts the processing of directory tree information.