summaryrefslogtreecommitdiff
path: root/src/yuzu
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/CMakeLists.txt6
-rw-r--r--src/yuzu/about_dialog.cpp2
-rw-r--r--src/yuzu/bootmanager.cpp14
-rw-r--r--src/yuzu/configuration/config.cpp8
-rw-r--r--src/yuzu/configuration/configure_debug.cpp1
-rw-r--r--src/yuzu/configuration/configure_debug.ui12
-rw-r--r--src/yuzu/configuration/configure_dialog.cpp1
-rw-r--r--src/yuzu/configuration/configure_input.cpp91
-rw-r--r--src/yuzu/configuration/configure_system.cpp4
-rw-r--r--src/yuzu/debugger/registers.cpp1
-rw-r--r--src/yuzu/game_list.cpp2
-rw-r--r--src/yuzu/game_list_p.h2
-rw-r--r--src/yuzu/main.cpp13
-rw-r--r--src/yuzu/util/spinbox.cpp2
14 files changed, 84 insertions, 75 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index c52d5627a..f5c46f1e9 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -66,11 +66,7 @@ file(GLOB_RECURSE THEMES ${CMAKE_SOURCE_DIR}/dist/qt_themes/*)
create_directory_groups(${SRCS} ${HEADERS} ${UIS})
-if (Qt5_FOUND)
- qt5_wrap_ui(UI_HDRS ${UIS})
-else()
- qt4_wrap_ui(UI_HDRS ${UIS})
-endif()
+qt5_wrap_ui(UI_HDRS ${UIS})
if (APPLE)
set(MACOSX_ICON "../../dist/yuzu.icns")
diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp
index 0f1b6cdc6..da3429822 100644
--- a/src/yuzu/about_dialog.cpp
+++ b/src/yuzu/about_dialog.cpp
@@ -9,7 +9,7 @@
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
ui->setupUi(this);
ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg(
-Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
+ Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
}
AboutDialog::~AboutDialog() {}
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 843ac6ad7..61d678c9b 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -1,12 +1,8 @@
#include <QApplication>
#include <QHBoxLayout>
#include <QKeyEvent>
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-// Required for screen DPI information
#include <QScreen>
#include <QWindow>
-#endif
#include "common/microprofile.h"
#include "common/scm_rev.h"
@@ -120,15 +116,13 @@ GRenderWindow::~GRenderWindow() {
void GRenderWindow::moveContext() {
DoneCurrent();
-// We need to move GL context to the swapping thread in Qt5
-#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
+
// If the thread started running, move the GL Context to the new thread. Otherwise, move it
// back.
auto thread = (QThread::currentThread() == qApp->thread() && emu_thread != nullptr)
? emu_thread
: qApp->thread();
child->context()->moveToThread(thread);
-#endif
}
void GRenderWindow::SwapBuffers() {
@@ -191,12 +185,8 @@ QByteArray GRenderWindow::saveGeometry() {
}
qreal GRenderWindow::windowPixelRatio() {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
// windowHandle() might not be accessible until the window is displayed to screen.
return windowHandle() ? windowHandle()->screen()->devicePixelRatio() : 1.0f;
-#else
- return 1.0f;
-#endif
}
void GRenderWindow::closeEvent(QCloseEvent* event) {
@@ -299,9 +289,7 @@ void GRenderWindow::OnEmulationStopping() {
void GRenderWindow::showEvent(QShowEvent* event) {
QWidget::showEvent(event);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
// windowHandle() is not initialized until the Window is shown, so we connect it here.
connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this,
SLOT(OnFramebufferSizeChanged()), Qt::UniqueConnection);
-#endif
}
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 923a7c53f..6a40f035c 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -18,10 +18,10 @@ Config::Config() {
}
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, Qt::Key_H, Qt::Key_G,
- Qt::Key_Left, Qt::Key_Up, Qt::Key_Right, Qt::Key_Down, Qt::Key_J, Qt::Key_I, Qt::Key_L,
- Qt::Key_K, Qt::Key_D, Qt::Key_C, Qt::Key_B, Qt::Key_V,
+ 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,
+ Qt::Key_H, Qt::Key_G, Qt::Key_Left, Qt::Key_Up, Qt::Key_Right, Qt::Key_Down, Qt::Key_J,
+ Qt::Key_I, Qt::Key_L, Qt::Key_K, Qt::Key_D, Qt::Key_C, Qt::Key_B, Qt::Key_V,
};
const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp
index 9eb71c593..a45edd510 100644
--- a/src/yuzu/configuration/configure_debug.cpp
+++ b/src/yuzu/configuration/configure_debug.cpp
@@ -6,7 +6,6 @@
#include "ui_configure_debug.h"
#include "yuzu/configuration/configure_debug.h"
-
ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) {
ui->setupUi(this);
this->setConfiguration();
diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui
index 96638ebdb..a10bea2f4 100644
--- a/src/yuzu/configuration/configure_debug.ui
+++ b/src/yuzu/configuration/configure_debug.ui
@@ -13,24 +13,24 @@
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
+ <layout class="QVBoxLayout" name="verticalLayout_1">
<item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>GDB</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
- <widget class="QLabel">
+ <widget class="QLabel" name="label_1">
<property name="text">
<string>The GDB Stub only works correctly when the CPU JIT is off.</string>
</property>
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
<widget class="QCheckBox" name="toggle_gdbstub">
<property name="text">
@@ -52,7 +52,7 @@
</spacer>
</item>
<item>
- <widget class="QLabel" name="label">
+ <widget class="QLabel" name="label_2">
<property name="text">
<string>Port:</string>
</property>
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp
index 23e5687d0..358f33005 100644
--- a/src/yuzu/configuration/configure_dialog.cpp
+++ b/src/yuzu/configuration/configure_dialog.cpp
@@ -7,7 +7,6 @@
#include "yuzu/configuration/config.h"
#include "yuzu/configuration/configure_dialog.h"
-
ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ConfigureDialog) {
ui->setupUi(this);
this->setConfiguration();
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp
index cd7520f29..10043e6e8 100644
--- a/src/yuzu/configuration/configure_input.cpp
+++ b/src/yuzu/configuration/configure_input.cpp
@@ -42,6 +42,52 @@ static void SetAnalogButton(const Common::ParamPackage& input_param,
analog_param.Set(button_name, input_param.Serialize());
}
+static QString ButtonToText(const Common::ParamPackage& param) {
+ if (!param.Has("engine")) {
+ return QObject::tr("[not set]");
+ } else if (param.Get("engine", "") == "keyboard") {
+ return getKeyName(param.Get("code", 0));
+ } else if (param.Get("engine", "") == "sdl") {
+ QString text = QString(QObject::tr("Joystick %1")).arg(param.Get("joystick", "").c_str());
+ if (param.Has("hat")) {
+ text += QString(QObject::tr(" Hat %1 %2"))
+ .arg(param.Get("hat", "").c_str(), param.Get("direction", "").c_str());
+ }
+ if (param.Has("axis")) {
+ text += QString(QObject::tr(" Axis %1%2"))
+ .arg(param.Get("axis", "").c_str(), param.Get("direction", "").c_str());
+ }
+ if (param.Has("button")) {
+ text += QString(QObject::tr(" Button %1")).arg(param.Get("button", "").c_str());
+ }
+ return text;
+ } else {
+ return QObject::tr("[unknown]");
+ }
+};
+
+static QString AnalogToText(const Common::ParamPackage& param, const std::string& dir) {
+ if (!param.Has("engine")) {
+ return QObject::tr("[not set]");
+ } else if (param.Get("engine", "") == "analog_from_button") {
+ return ButtonToText(Common::ParamPackage{param.Get(dir, "")});
+ } else if (param.Get("engine", "") == "sdl") {
+ if (dir == "modifier") {
+ return QString(QObject::tr("[unused]"));
+ }
+
+ QString text = QString(QObject::tr("Joystick %1")).arg(param.Get("joystick", "").c_str());
+ if (dir == "left" || dir == "right") {
+ text += QString(QObject::tr(" Axis %1")).arg(param.Get("axis_x", "").c_str());
+ } else if (dir == "up" || dir == "down") {
+ text += QString(QObject::tr(" Axis %1")).arg(param.Get("axis_y", "").c_str());
+ }
+ return text;
+ } else {
+ return QObject::tr("[unknown]");
+ }
+};
+
ConfigureInput::ConfigureInput(QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()),
timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()) {
@@ -50,13 +96,13 @@ ConfigureInput::ConfigureInput(QWidget* parent)
setFocusPolicy(Qt::ClickFocus);
button_map = {
- ui->buttonA, ui->buttonB, ui->buttonX, ui->buttonY,
- ui->buttonLStick, ui->buttonRStick, ui->buttonL, ui->buttonR,
- ui->buttonZL, ui->buttonZR, ui->buttonPlus, ui->buttonMinus,
- ui->buttonDpadLeft, ui->buttonDpadUp, ui->buttonDpadRight, ui->buttonDpadDown,
- ui->buttonLStickLeft, ui->buttonLStickUp, ui->buttonLStickRight, ui->buttonLStickDown,
- ui->buttonRStickLeft, ui->buttonRStickUp, ui->buttonRStickRight, ui->buttonRStickDown,
- ui->buttonSL, ui->buttonSR, ui->buttonHome, ui->buttonScreenshot,
+ ui->buttonA, ui->buttonB, ui->buttonX, ui->buttonY,
+ ui->buttonLStick, ui->buttonRStick, ui->buttonL, ui->buttonR,
+ ui->buttonZL, ui->buttonZR, ui->buttonPlus, ui->buttonMinus,
+ ui->buttonDpadLeft, ui->buttonDpadUp, ui->buttonDpadRight, ui->buttonDpadDown,
+ ui->buttonLStickLeft, ui->buttonLStickUp, ui->buttonLStickRight, ui->buttonLStickDown,
+ ui->buttonRStickLeft, ui->buttonRStickUp, ui->buttonRStickRight, ui->buttonRStickDown,
+ ui->buttonSL, ui->buttonSR, ui->buttonHome, ui->buttonScreenshot,
};
analog_map_buttons = {{
@@ -166,37 +212,18 @@ void ConfigureInput::restoreDefaults() {
}
void ConfigureInput::updateButtonLabels() {
- QString non_keyboard(tr("[non-keyboard]"));
-
- auto KeyToText = [&non_keyboard](const Common::ParamPackage& param) {
- if (!param.Has("engine")) {
- return QString("[not set]");
- } else if (param.Get("engine", "") != "keyboard") {
- return non_keyboard;
- } else {
- return getKeyName(param.Get("code", 0));
- }
- };
-
for (int button = 0; button < Settings::NativeButton::NumButtons; button++) {
- button_map[button]->setText(KeyToText(buttons_param[button]));
+ button_map[button]->setText(ButtonToText(buttons_param[button]));
}
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
- if (analogs_param[analog_id].Get("engine", "") != "analog_from_button") {
- for (QPushButton* button : analog_map_buttons[analog_id]) {
- if (button)
- button->setText(non_keyboard);
- }
- } else {
- for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
- Common::ParamPackage param(
- analogs_param[analog_id].Get(analog_sub_buttons[sub_button_id], ""));
- if (analog_map_buttons[analog_id][sub_button_id])
- analog_map_buttons[analog_id][sub_button_id]->setText(KeyToText(param));
+ for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
+ if (analog_map_buttons[analog_id][sub_button_id]) {
+ analog_map_buttons[analog_id][sub_button_id]->setText(
+ AnalogToText(analogs_param[analog_id], analog_sub_buttons[sub_button_id]));
}
}
- analog_map_stick[analog_id]->setText("Set Analog Stick");
+ analog_map_stick[analog_id]->setText(tr("Set Analog Stick"));
}
}
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index 417afef87..89e783687 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -8,7 +8,6 @@
#include "yuzu/configuration/configure_system.h"
#include "yuzu/ui_settings.h"
-
static const std::array<int, 12> days_in_month = {{
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
}};
@@ -73,5 +72,6 @@ void ConfigureSystem::refreshConsoleID() {
if (reply == QMessageBox::No)
return;
u64 console_id{};
- ui->label_console_id->setText("Console ID: 0x" + QString::number(console_id, 16).toUpper());
+ ui->label_console_id->setText(
+ tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper()));
}
diff --git a/src/yuzu/debugger/registers.cpp b/src/yuzu/debugger/registers.cpp
index a52725075..06e2d1647 100644
--- a/src/yuzu/debugger/registers.cpp
+++ b/src/yuzu/debugger/registers.cpp
@@ -8,7 +8,6 @@
#include "yuzu/debugger/registers.h"
#include "yuzu/util/util.h"
-
RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) {
cpu_regs_ui.setupUi(this);
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 532c4ae63..679c89828 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -174,7 +174,7 @@ void GameList::onTextChanged(const QString& newText) {
child_file->data(GameListItemPath::ProgramIdRole).toString().toLower();
// Only items which filename in combination with its title contains all words
- // that are in the searchfiel will be visible in the gamelist
+ // that are in the searchfield will be visible in the gamelist
// The search is case insensitive because of toLower()
// I decided not to use Qt::CaseInsensitive in containsAllWords to prevent
// multiple conversions of edit_filter_text for each game in the gamelist
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index e40cd38b3..a758b77aa 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -9,8 +9,8 @@
#include <QRunnable>
#include <QStandardItem>
#include <QString>
-#include "yuzu/util/util.h"
#include "common/string_util.h"
+#include "yuzu/util/util.h"
/**
* Gets the default icon (for games without valid SMDH)
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 7c711158a..31f2825ee 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -122,8 +122,9 @@ void GMainWindow::InitializeWidgets() {
statusBar()->addPermanentWidget(message_label, 1);
emu_speed_label = new QLabel();
- emu_speed_label->setToolTip(tr("Current emulation speed. Values higher or lower than 100% "
- "indicate emulation is running faster or slower than a Switch."));
+ emu_speed_label->setToolTip(
+ tr("Current emulation speed. Values higher or lower than 100% "
+ "indicate emulation is running faster or slower than a Switch."));
game_fps_label = new QLabel();
game_fps_label->setToolTip(tr("How many frames per second the game is currently displaying. "
"This will vary from game to game and scene to scene."));
@@ -185,8 +186,8 @@ void GMainWindow::InitializeRecentFileMenuActions() {
void GMainWindow::InitializeHotkeys() {
RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
RegisterHotkey("Main Window", "Start Emulation");
- RegisterHotkey( "Main Window", "Fullscreen", QKeySequence::FullScreen );
- RegisterHotkey( "Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut );
+ RegisterHotkey("Main Window", "Fullscreen", QKeySequence::FullScreen);
+ RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut);
LoadHotkeys();
connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this,
@@ -194,9 +195,9 @@ void GMainWindow::InitializeHotkeys() {
connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this,
SLOT(OnStartGame()));
connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated,
- ui.action_Fullscreen, &QAction::trigger);
+ ui.action_Fullscreen, &QAction::trigger);
connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously,
- ui.action_Fullscreen, &QAction::trigger);
+ ui.action_Fullscreen, &QAction::trigger);
connect(GetHotkey("Main Window", "Exit Fullscreen", this), &QShortcut::activated, this, [&] {
if (emulation_running) {
ui.action_Fullscreen->setChecked(false);
diff --git a/src/yuzu/util/spinbox.cpp b/src/yuzu/util/spinbox.cpp
index ede6fe0a8..92753ec1c 100644
--- a/src/yuzu/util/spinbox.cpp
+++ b/src/yuzu/util/spinbox.cpp
@@ -31,8 +31,8 @@
#include <cstdlib>
#include <QLineEdit>
#include <QRegExpValidator>
-#include "yuzu/util/spinbox.h"
#include "common/assert.h"
+#include "yuzu/util/spinbox.h"
CSpinBox::CSpinBox(QWidget* parent)
: QAbstractSpinBox(parent), min_value(-100), max_value(100), value(0), base(10), num_digits(0) {