summaryrefslogtreecommitdiff
path: root/src/yuzu
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/bootmanager.cpp6
-rw-r--r--src/yuzu/configuration/config.cpp13
-rw-r--r--src/yuzu/configuration/config.h14
-rw-r--r--src/yuzu/debugger/graphics/graphics_breakpoints.cpp33
-rw-r--r--src/yuzu/debugger/graphics/graphics_breakpoints_p.h2
-rw-r--r--src/yuzu/game_list.cpp17
6 files changed, 44 insertions, 41 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index e8ab23326..39eef8858 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -8,7 +8,6 @@
#include "common/microprofile.h"
#include "common/scm_rev.h"
-#include "common/string_util.h"
#include "core/core.h"
#include "core/frontend/framebuffer_layout.h"
#include "core/settings.h"
@@ -107,9 +106,8 @@ private:
GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread)
: QWidget(parent), child(nullptr), emu_thread(emu_thread) {
- std::string window_title = fmt::format("yuzu {} | {}-{}", Common::g_build_name,
- Common::g_scm_branch, Common::g_scm_desc);
- setWindowTitle(QString::fromStdString(window_title));
+ setWindowTitle(QStringLiteral("yuzu %1 | %2-%3")
+ .arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
setAttribute(Qt::WA_AcceptTouchEvents);
InputCommon::Init();
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 1fe9a7edd..d4fd60a73 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -13,11 +13,16 @@ Config::Config() {
// TODO: Don't hardcode the path; let the frontend decide where to put the config files.
qt_config_loc = FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "qt-config.ini";
FileUtil::CreateFullPath(qt_config_loc);
- qt_config = new QSettings(QString::fromStdString(qt_config_loc), QSettings::IniFormat);
+ qt_config =
+ std::make_unique<QSettings>(QString::fromStdString(qt_config_loc), QSettings::IniFormat);
Reload();
}
+Config::~Config() {
+ Save();
+}
+
const std::array<int, Settings::NativeButton::NumButtons> Config::default_buttons = {
Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_3, Qt::Key_4, Qt::Key_Q,
Qt::Key_W, Qt::Key_1, Qt::Key_2, Qt::Key_N, Qt::Key_M, Qt::Key_F, Qt::Key_T,
@@ -342,9 +347,3 @@ void Config::Reload() {
void Config::Save() {
SaveValues();
}
-
-Config::~Config() {
- Save();
-
- delete qt_config;
-}
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h
index cbf745ea2..9c99c1b75 100644
--- a/src/yuzu/configuration/config.h
+++ b/src/yuzu/configuration/config.h
@@ -5,6 +5,7 @@
#pragma once
#include <array>
+#include <memory>
#include <string>
#include <QVariant>
#include "core/settings.h"
@@ -12,12 +13,6 @@
class QSettings;
class Config {
- QSettings* qt_config;
- std::string qt_config_loc;
-
- void ReadValues();
- void SaveValues();
-
public:
Config();
~Config();
@@ -27,4 +22,11 @@ public:
static const std::array<int, Settings::NativeButton::NumButtons> default_buttons;
static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs;
+
+private:
+ void ReadValues();
+ void SaveValues();
+
+ std::unique_ptr<QSettings> qt_config;
+ std::string qt_config_loc;
};
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints.cpp b/src/yuzu/debugger/graphics/graphics_breakpoints.cpp
index b5c88f944..67ed0ba6d 100644
--- a/src/yuzu/debugger/graphics/graphics_breakpoints.cpp
+++ b/src/yuzu/debugger/graphics/graphics_breakpoints.cpp
@@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include <map>
#include <QLabel>
#include <QMetaType>
#include <QPushButton>
@@ -32,21 +31,8 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const {
switch (role) {
case Qt::DisplayRole: {
if (index.column() == 0) {
- static const std::map<Tegra::DebugContext::Event, QString> map = {
- {Tegra::DebugContext::Event::MaxwellCommandLoaded, tr("Maxwell command loaded")},
- {Tegra::DebugContext::Event::MaxwellCommandProcessed,
- tr("Maxwell command processed")},
- {Tegra::DebugContext::Event::IncomingPrimitiveBatch,
- tr("Incoming primitive batch")},
- {Tegra::DebugContext::Event::FinishedPrimitiveBatch,
- tr("Finished primitive batch")},
- };
-
- DEBUG_ASSERT(map.size() ==
- static_cast<std::size_t>(Tegra::DebugContext::Event::NumEvents));
- return (map.find(event) != map.end()) ? map.at(event) : QString();
+ return DebugContextEventToString(event);
}
-
break;
}
@@ -128,6 +114,23 @@ void BreakPointModel::OnResumed() {
active_breakpoint = context->active_breakpoint;
}
+QString BreakPointModel::DebugContextEventToString(Tegra::DebugContext::Event event) {
+ switch (event) {
+ case Tegra::DebugContext::Event::MaxwellCommandLoaded:
+ return tr("Maxwell command loaded");
+ case Tegra::DebugContext::Event::MaxwellCommandProcessed:
+ return tr("Maxwell command processed");
+ case Tegra::DebugContext::Event::IncomingPrimitiveBatch:
+ return tr("Incoming primitive batch");
+ case Tegra::DebugContext::Event::FinishedPrimitiveBatch:
+ return tr("Finished primitive batch");
+ case Tegra::DebugContext::Event::NumEvents:
+ break;
+ }
+
+ return tr("Unknown debug context event");
+}
+
GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(
std::shared_ptr<Tegra::DebugContext> debug_context, QWidget* parent)
: QDockWidget(tr("Maxwell Breakpoints"), parent), Tegra::DebugContext::BreakPointObserver(
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints_p.h b/src/yuzu/debugger/graphics/graphics_breakpoints_p.h
index 7112b87e6..fb488e38f 100644
--- a/src/yuzu/debugger/graphics/graphics_breakpoints_p.h
+++ b/src/yuzu/debugger/graphics/graphics_breakpoints_p.h
@@ -29,6 +29,8 @@ public:
void OnResumed();
private:
+ static QString DebugContextEventToString(Tegra::DebugContext::Event event);
+
std::weak_ptr<Tegra::DebugContext> context_weak;
bool at_breakpoint;
Tegra::DebugContext::Event active_breakpoint;
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 67890455a..a5a4aa432 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -16,7 +16,6 @@
#include <fmt/format.h>
#include "common/common_paths.h"
#include "common/common_types.h"
-#include "common/file_util.h"
#include "common/logging/log.h"
#include "core/file_sys/patch_manager.h"
#include "yuzu/compatibility_list.h"
@@ -217,11 +216,11 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, GMainWindow* parent)
tree_view->setContextMenuPolicy(Qt::CustomContextMenu);
item_model->insertColumns(0, COLUMN_COUNT);
- item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, "Name");
- item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, "Compatibility");
- item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, "Add-ons");
- item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, "File type");
- item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, "Size");
+ item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name"));
+ item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility"));
+ item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons"));
+ item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type"));
+ item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size"));
connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry);
connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu);
@@ -387,9 +386,9 @@ void GameList::LoadCompatibilityList() {
}
void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) {
- if (!FileUtil::Exists(dir_path.toStdString()) ||
- !FileUtil::IsDirectory(dir_path.toStdString())) {
- LOG_ERROR(Frontend, "Could not find game list folder at {}", dir_path.toLocal8Bit().data());
+ const QFileInfo dir_info{dir_path};
+ if (!dir_info.exists() || !dir_info.isDir()) {
+ LOG_ERROR(Frontend, "Could not find game list folder at {}", dir_path.toStdString());
search_field->setFilterResult(0, 0);
return;
}