Browse Source

more qt fixes

lizzie/unity-build
lizzie 1 week ago
parent
commit
81230b00ea
  1. 8
      src/video_core/vulkan_common/vulkan.h
  2. 17
      src/yuzu/applets/qt_profile_select.cpp
  3. 10
      src/yuzu/configuration/configure_input_player.cpp
  4. 2
      src/yuzu/configuration/configure_profile_manager.cpp
  5. 10
      src/yuzu/configuration/configure_ringcon.cpp
  6. 12
      src/yuzu/configuration/configure_touch_from_button.cpp
  7. 9
      src/yuzu/util/overlay_dialog.cpp
  8. 5
      src/yuzu/util/overlay_dialog.h

8
src/video_core/vulkan_common/vulkan.h

@ -22,13 +22,19 @@
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
/* X11 defines */
// X11 defines
#ifdef Success #ifdef Success
# undef Success # undef Success
#endif #endif
#ifdef BadValue #ifdef BadValue
# undef BadValue # undef BadValue
#endif #endif
#ifdef GrayScale
# undef GrayScale
#endif
#ifdef KeyPress
# undef KeyPress
#endif
// Define maintenance 7-9 extension names (not yet in official Vulkan headers) // Define maintenance 7-9 extension names (not yet in official Vulkan headers)
#ifndef VK_KHR_MAINTENANCE_7_EXTENSION_NAME #ifndef VK_KHR_MAINTENANCE_7_EXTENSION_NAME

17
src/yuzu/applets/qt_profile_select.cpp

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
@ -24,22 +24,22 @@
#include "yuzu/util/controller_navigation.h" #include "yuzu/util/controller_navigation.h"
namespace { namespace {
QString FormatUserEntryText(const QString& username, Common::UUID uuid) {
QString FormatProfileUserEntryText(const QString& username, Common::UUID uuid) {
return QtProfileSelectionDialog::tr( return QtProfileSelectionDialog::tr(
"%1\n%2", "%1 is the profile username, %2 is the formatted UUID (e.g. " "%1\n%2", "%1 is the profile username, %2 is the formatted UUID (e.g. "
"00112233-4455-6677-8899-AABBCCDDEEFF))") "00112233-4455-6677-8899-AABBCCDDEEFF))")
.arg(username, QString::fromStdString(uuid.FormattedString())); .arg(username, QString::fromStdString(uuid.FormattedString()));
} }
QString GetImagePath(Common::UUID uuid) {
QString GetProfileImagePath(const Common::UUID uuid) {
const auto path = const auto path =
Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir) / Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir) /
fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString()); fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString());
return QString::fromStdString(Common::FS::PathToUTF8String(path)); return QString::fromStdString(Common::FS::PathToUTF8String(path));
} }
QPixmap GetIcon(Common::UUID uuid) {
QPixmap icon{GetImagePath(uuid)};
QPixmap GetProfileIcon(Common::UUID uuid) {
QPixmap icon{GetProfileImagePath(uuid)};
if (!icon) { if (!icon) {
icon.fill(Qt::black); icon.fill(Qt::black);
@ -118,8 +118,11 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(
const auto username = Common::StringFromFixedZeroTerminatedBuffer( const auto username = Common::StringFromFixedZeroTerminatedBuffer(
reinterpret_cast<const char*>(profile.username.data()), profile.username.size()); reinterpret_cast<const char*>(profile.username.data()), profile.username.size());
list_items.push_back(QList<QStandardItem*>{new QStandardItem{
GetIcon(user), FormatUserEntryText(QString::fromStdString(username), user)}});
auto const text = QtProfileSelectionDialog::tr(
"%1\n%2", "%1 is the profile username, %2 is the formatted UUID (e.g. "
"00112233-4455-6677-8899-AABBCCDDEEFF))")
.arg(QString::fromStdString(username), QString::fromStdString(user.FormattedString()));
list_items.push_back(QList<QStandardItem*>{new QStandardItem{GetProfileIcon(user), text}});
} }
for (const auto& item : list_items) for (const auto& item : list_items)

10
src/yuzu/configuration/configure_input_player.cpp

@ -39,7 +39,7 @@ const std::array<std::string, ConfigureInputPlayer::ANALOG_SUB_BUTTONS_NUM>
namespace { namespace {
QString GetKeyName(int key_code) {
QString GetInputKeyName(int key_code) {
switch (key_code) { switch (key_code) {
case Qt::Key_Shift: case Qt::Key_Shift:
return QObject::tr("Shift"); return QObject::tr("Shift");
@ -54,7 +54,7 @@ QString GetKeyName(int key_code) {
} }
} }
QString GetButtonName(Common::Input::ButtonNames button_name) {
QString GetInputButtonName(Common::Input::ButtonNames button_name) {
switch (button_name) { switch (button_name) {
case Common::Input::ButtonNames::ButtonLeft: case Common::Input::ButtonNames::ButtonLeft:
return QObject::tr("Left"); return QObject::tr("Left");
@ -187,11 +187,11 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) {
const QString inverted = QString::fromStdString(param.Get("inverted", false) ? "!" : ""); const QString inverted = QString::fromStdString(param.Get("inverted", false) ? "!" : "");
const QString invert = QString::fromStdString(param.Get("invert", "+") == "-" ? "-" : ""); const QString invert = QString::fromStdString(param.Get("invert", "+") == "-" ? "-" : "");
const QString turbo = QString::fromStdString(param.Get("turbo", false) ? "$" : ""); const QString turbo = QString::fromStdString(param.Get("turbo", false) ? "$" : "");
const auto common_button_name = input_subsystem->GetButtonName(param);
const auto common_button_name = input_subsystem->GetInputButtonName(param);
// Retrieve the names from Qt // Retrieve the names from Qt
if (param.Get("engine", "") == "keyboard") { if (param.Get("engine", "") == "keyboard") {
const QString button_str = GetKeyName(param.Get("code", 0));
const QString button_str = GetInputKeyName(param.Get("code", 0));
return QObject::tr("%1%2%3%4").arg(turbo, toggle, inverted, button_str); return QObject::tr("%1%2%3%4").arg(turbo, toggle, inverted, button_str);
} }
@ -228,7 +228,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) {
} }
} }
QString button_name = GetButtonName(common_button_name);
QString button_name = GetInputButtonName(common_button_name);
if (param.Has("hat")) { if (param.Has("hat")) {
return QObject::tr("%1%2%3Hat %4").arg(turbo, toggle, inverted, button_name); return QObject::tr("%1%2%3Hat %4").arg(turbo, toggle, inverted, button_name);
} }

2
src/yuzu/configuration/configure_profile_manager.cpp

@ -36,7 +36,7 @@
namespace { namespace {
QString GetImagePath(const Common::UUID& uuid) {
QString GetImagePath(const Common::UUID uuid) {
const auto path = const auto path =
Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir) / Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir) /
fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString()); fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString());

10
src/yuzu/configuration/configure_ringcon.cpp

@ -29,7 +29,7 @@ const std::array<std::string, ConfigureRingController::ANALOG_SUB_BUTTONS_NUM>
namespace { namespace {
QString GetKeyName(int key_code) {
QString GetRingconKeyName(int key_code) {
switch (key_code) { switch (key_code) {
case Qt::Key_Shift: case Qt::Key_Shift:
return QObject::tr("Shift"); return QObject::tr("Shift");
@ -44,7 +44,7 @@ QString GetKeyName(int key_code) {
} }
} }
QString GetButtonName(Common::Input::ButtonNames button_name) {
QString GetRingconButtonName(Common::Input::ButtonNames button_name) {
switch (button_name) { switch (button_name) {
case Common::Input::ButtonNames::ButtonLeft: case Common::Input::ButtonNames::ButtonLeft:
return QObject::tr("Left"); return QObject::tr("Left");
@ -397,11 +397,11 @@ QString ConfigureRingController::ButtonToText(const Common::ParamPackage& param)
const QString toggle = QString::fromStdString(param.Get("toggle", false) ? "~" : ""); const QString toggle = QString::fromStdString(param.Get("toggle", false) ? "~" : "");
const QString inverted = QString::fromStdString(param.Get("inverted", false) ? "!" : ""); const QString inverted = QString::fromStdString(param.Get("inverted", false) ? "!" : "");
const auto common_button_name = input_subsystem->GetButtonName(param);
const auto common_button_name = input_subsystem->GetRingconButtonName(param);
// Retrieve the names from Qt // Retrieve the names from Qt
if (param.Get("engine", "") == "keyboard") { if (param.Get("engine", "") == "keyboard") {
const QString button_str = GetKeyName(param.Get("code", 0));
const QString button_str = GetRingconKeyName(param.Get("code", 0));
return QObject::tr("%1%2").arg(toggle, button_str); return QObject::tr("%1%2").arg(toggle, button_str);
} }
@ -438,7 +438,7 @@ QString ConfigureRingController::ButtonToText(const Common::ParamPackage& param)
} }
} }
QString button_name = GetButtonName(common_button_name);
QString button_name = GetRingconButtonName(common_button_name);
if (param.Has("hat")) { if (param.Has("hat")) {
return QObject::tr("%1%2Hat %3").arg(toggle, inverted, button_name); return QObject::tr("%1%2Hat %3").arg(toggle, inverted, button_name);
} }

12
src/yuzu/configuration/configure_touch_from_button.cpp

@ -15,7 +15,7 @@
#include "yuzu/configuration/configure_touch_from_button.h" #include "yuzu/configuration/configure_touch_from_button.h"
#include "yuzu/configuration/configure_touch_widget.h" #include "yuzu/configuration/configure_touch_widget.h"
static QString GetKeyName(int key_code) {
static QString GetTouchKeyName(int key_code) {
switch (key_code) { switch (key_code) {
case Qt::Key_Shift: case Qt::Key_Shift:
return QObject::tr("Shift"); return QObject::tr("Shift");
@ -30,13 +30,13 @@ static QString GetKeyName(int key_code) {
} }
} }
static QString ButtonToText(const Common::ParamPackage& param) {
static QString TouchButtonToText(const Common::ParamPackage& param) {
if (!param.Has("engine")) { if (!param.Has("engine")) {
return QObject::tr("[not set]"); return QObject::tr("[not set]");
} }
if (param.Get("engine", "") == "keyboard") { if (param.Get("engine", "") == "keyboard") {
return GetKeyName(param.Get("code", 0));
return GetTouchKeyName(param.Get("code", 0));
} }
if (param.Get("engine", "") == "sdl") { if (param.Get("engine", "") == "sdl") {
@ -116,7 +116,7 @@ void ConfigureTouchFromButton::UpdateUiDisplay() {
for (const auto& button_str : touch_maps[selected_index].buttons) { for (const auto& button_str : touch_maps[selected_index].buttons) {
Common::ParamPackage package{button_str}; Common::ParamPackage package{button_str};
QStandardItem* button = new QStandardItem(ButtonToText(package));
QStandardItem* button = new QStandardItem(TouchButtonToText(package));
button->setData(QString::fromStdString(button_str)); button->setData(QString::fromStdString(button_str));
button->setEditable(false); button->setEditable(false);
QStandardItem* xcoord = new QStandardItem(QString::number(package.Get("x", 0))); QStandardItem* xcoord = new QStandardItem(QString::number(package.Get("x", 0)));
@ -238,10 +238,10 @@ void ConfigureTouchFromButton::GetButtonInput(const int row_index, const bool is
binding_list_model->removeRow(row_index); binding_list_model->removeRow(row_index);
} else { } else {
cell->setText( cell->setText(
ButtonToText(Common::ParamPackage{cell->data().toString().toStdString()}));
TouchButtonToText(Common::ParamPackage{cell->data().toString().toStdString()}));
} }
} else { } else {
cell->setText(ButtonToText(params));
cell->setText(TouchButtonToText(params));
cell->setData(QString::fromStdString(params.Serialize())); cell->setData(QString::fromStdString(params.Serialize()));
} }
}; };

9
src/yuzu/util/overlay_dialog.cpp

@ -13,15 +13,6 @@
#include "ui_overlay_dialog.h" #include "ui_overlay_dialog.h"
#include "yuzu/util/overlay_dialog.h" #include "yuzu/util/overlay_dialog.h"
namespace {
constexpr float BASE_TITLE_FONT_SIZE = 14.0f;
constexpr float BASE_FONT_SIZE = 18.0f;
constexpr float BASE_WIDTH = 1280.0f;
constexpr float BASE_HEIGHT = 720.0f;
} // Anonymous namespace
OverlayDialog::OverlayDialog(QWidget* parent, Core::System& system, const QString& title_text, OverlayDialog::OverlayDialog(QWidget* parent, Core::System& system, const QString& title_text,
const QString& body_text, const QString& left_button_text, const QString& body_text, const QString& left_button_text,
const QString& right_button_text, Qt::Alignment alignment, const QString& right_button_text, Qt::Alignment alignment,

5
src/yuzu/util/overlay_dialog.h

@ -100,4 +100,9 @@ private:
std::unique_ptr<InputInterpreter> input_interpreter; std::unique_ptr<InputInterpreter> input_interpreter;
std::jthread input_thread; std::jthread input_thread;
static constexpr float BASE_TITLE_FONT_SIZE = 14.0f;
static constexpr float BASE_FONT_SIZE = 18.0f;
static constexpr float BASE_WIDTH = 1280.0f;
static constexpr float BASE_HEIGHT = 720.0f;
}; };
Loading…
Cancel
Save