Make additional strings in controller settings translatable
This commit is contained in:
parent
559dc23e4e
commit
8f54711c72
|
@ -466,25 +466,31 @@ std::optional<s32> AnalogController::StaticGetButtonCodeByName(std::string_view
|
||||||
|
|
||||||
Controller::AxisList AnalogController::StaticGetAxisNames()
|
Controller::AxisList AnalogController::StaticGetAxisNames()
|
||||||
{
|
{
|
||||||
#define A(n) \
|
return {{TRANSLATABLE("AnalogController", "LeftX"), static_cast<s32>(Axis::LeftX)},
|
||||||
{ \
|
{TRANSLATABLE("AnalogController", "LeftY"), static_cast<s32>(Axis::LeftY)},
|
||||||
#n, static_cast < s32>(Axis::n) \
|
{TRANSLATABLE("AnalogController", "RightX"), static_cast<s32>(Axis::RightX)},
|
||||||
}
|
{TRANSLATABLE("AnalogController", "RightY"), static_cast<s32>(Axis::RightY)}};
|
||||||
|
|
||||||
return {A(LeftX), A(LeftY), A(RightX), A(RightY)};
|
|
||||||
|
|
||||||
#undef A
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller::ButtonList AnalogController::StaticGetButtonNames()
|
Controller::ButtonList AnalogController::StaticGetButtonNames()
|
||||||
{
|
{
|
||||||
#define B(n) \
|
return {{TRANSLATABLE("AnalogController", "Up"), static_cast<s32>(Button::Up)},
|
||||||
{ \
|
{TRANSLATABLE("AnalogController", "Down"), static_cast<s32>(Button::Down)},
|
||||||
#n, static_cast < s32>(Button::n) \
|
{TRANSLATABLE("AnalogController", "Left"), static_cast<s32>(Button::Left)},
|
||||||
}
|
{TRANSLATABLE("AnalogController", "Right"), static_cast<s32>(Button::Right)},
|
||||||
return {B(Up), B(Down), B(Left), B(Right), B(Select), B(Start), B(Triangle), B(Cross), B(Circle),
|
{TRANSLATABLE("AnalogController", "Select"), static_cast<s32>(Button::Select)},
|
||||||
B(Square), B(L1), B(L2), B(R1), B(R2), B(L3), B(R3), B(Analog)};
|
{TRANSLATABLE("AnalogController", "Start"), static_cast<s32>(Button::Start)},
|
||||||
#undef B
|
{TRANSLATABLE("AnalogController", "Triangle"), static_cast<s32>(Button::Triangle)},
|
||||||
|
{TRANSLATABLE("AnalogController", "Cross"), static_cast<s32>(Button::Cross)},
|
||||||
|
{TRANSLATABLE("AnalogController", "Circle"), static_cast<s32>(Button::Circle)},
|
||||||
|
{TRANSLATABLE("AnalogController", "Square"), static_cast<s32>(Button::Square)},
|
||||||
|
{TRANSLATABLE("AnalogController", "L1"), static_cast<s32>(Button::L1)},
|
||||||
|
{TRANSLATABLE("AnalogController", "L2"), static_cast<s32>(Button::L2)},
|
||||||
|
{TRANSLATABLE("AnalogController", "R1"), static_cast<s32>(Button::R1)},
|
||||||
|
{TRANSLATABLE("AnalogController", "R2"), static_cast<s32>(Button::R2)},
|
||||||
|
{TRANSLATABLE("AnalogController", "L3"), static_cast<s32>(Button::L3)},
|
||||||
|
{TRANSLATABLE("AnalogController", "R3"), static_cast<s32>(Button::R3)},
|
||||||
|
{TRANSLATABLE("AnalogController", "Analog"), static_cast<s32>(Button::Analog)}};
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 AnalogController::StaticGetVibrationMotorCount()
|
u32 AnalogController::StaticGetVibrationMotorCount()
|
||||||
|
@ -495,11 +501,14 @@ u32 AnalogController::StaticGetVibrationMotorCount()
|
||||||
Controller::SettingList AnalogController::StaticGetSettings()
|
Controller::SettingList AnalogController::StaticGetSettings()
|
||||||
{
|
{
|
||||||
static constexpr std::array<SettingInfo, 2> settings = {
|
static constexpr std::array<SettingInfo, 2> settings = {
|
||||||
{{SettingInfo::Type::Boolean, "AutoEnableAnalog", "Enable Analog Mode on Reset",
|
{{SettingInfo::Type::Boolean, "AutoEnableAnalog", TRANSLATABLE("AnalogController", "Enable Analog Mode on Reset"),
|
||||||
"Automatically enables analog mode when the console is reset/powered on.", "false"},
|
TRANSLATABLE("AnalogController", "Automatically enables analog mode when the console is reset/powered on."),
|
||||||
{SettingInfo::Type::Float, "AxisScale", "Analog Axis Scale",
|
"false"},
|
||||||
"Sets the analog stick axis scaling factor. A value between 1.30 and 1.40 is recommended when using recent "
|
{SettingInfo::Type::Float, "AxisScale", TRANSLATABLE("AnalogController", "Analog Axis Scale"),
|
||||||
"controllers, e.g. DualShock 4, Xbox One Controller.",
|
TRANSLATABLE(
|
||||||
|
"AnalogController",
|
||||||
|
"Sets the analog stick axis scaling factor. A value between 1.30 and 1.40 is recommended when using recent "
|
||||||
|
"controllers, e.g. DualShock 4, Xbox One Controller."),
|
||||||
"1.00f", "0.01f", "1.50f", "0.01f"}}};
|
"1.00f", "0.01f", "1.50f", "0.01f"}}};
|
||||||
|
|
||||||
return SettingList(settings.begin(), settings.end());
|
return SettingList(settings.begin(), settings.end());
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "digital_controller.h"
|
#include "digital_controller.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/state_wrapper.h"
|
#include "common/state_wrapper.h"
|
||||||
|
#include "host_interface.h"
|
||||||
|
|
||||||
DigitalController::DigitalController() = default;
|
DigitalController::DigitalController() = default;
|
||||||
|
|
||||||
|
@ -155,13 +156,20 @@ Controller::AxisList DigitalController::StaticGetAxisNames()
|
||||||
|
|
||||||
Controller::ButtonList DigitalController::StaticGetButtonNames()
|
Controller::ButtonList DigitalController::StaticGetButtonNames()
|
||||||
{
|
{
|
||||||
#define B(n) \
|
return {{TRANSLATABLE("DigitalController", "Up"), static_cast<s32>(Button::Up)},
|
||||||
{ \
|
{TRANSLATABLE("DigitalController", "Down"), static_cast<s32>(Button::Down)},
|
||||||
#n, static_cast < s32>(Button::n) \
|
{TRANSLATABLE("DigitalController", "Left"), static_cast<s32>(Button::Left)},
|
||||||
}
|
{TRANSLATABLE("DigitalController", "Right"), static_cast<s32>(Button::Right)},
|
||||||
return {B(Up), B(Down), B(Left), B(Right), B(Select), B(Start), B(Triangle),
|
{TRANSLATABLE("DigitalController", "Select"), static_cast<s32>(Button::Select)},
|
||||||
B(Cross), B(Circle), B(Square), B(L1), B(L2), B(R1), B(R2)};
|
{TRANSLATABLE("DigitalController", "Start"), static_cast<s32>(Button::Start)},
|
||||||
#undef B
|
{TRANSLATABLE("DigitalController", "Triangle"), static_cast<s32>(Button::Triangle)},
|
||||||
|
{TRANSLATABLE("DigitalController", "Cross"), static_cast<s32>(Button::Cross)},
|
||||||
|
{TRANSLATABLE("DigitalController", "Circle"), static_cast<s32>(Button::Circle)},
|
||||||
|
{TRANSLATABLE("DigitalController", "Square"), static_cast<s32>(Button::Square)},
|
||||||
|
{TRANSLATABLE("DigitalController", "L1"), static_cast<s32>(Button::L1)},
|
||||||
|
{TRANSLATABLE("DigitalController", "L2"), static_cast<s32>(Button::L2)},
|
||||||
|
{TRANSLATABLE("DigitalController", "R1"), static_cast<s32>(Button::R1)},
|
||||||
|
{TRANSLATABLE("DigitalController", "R2"), static_cast<s32>(Button::R2)}};
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 DigitalController::StaticGetVibrationMotorCount()
|
u32 DigitalController::StaticGetVibrationMotorCount()
|
||||||
|
|
|
@ -209,12 +209,9 @@ Controller::AxisList NamcoGunCon::StaticGetAxisNames()
|
||||||
|
|
||||||
Controller::ButtonList NamcoGunCon::StaticGetButtonNames()
|
Controller::ButtonList NamcoGunCon::StaticGetButtonNames()
|
||||||
{
|
{
|
||||||
#define B(n) \
|
return {{TRANSLATABLE("NamcoGunCon", "Trigger"), static_cast<s32>(Button::Trigger)},
|
||||||
{ \
|
{TRANSLATABLE("NamcoGunCon", "A"), static_cast<s32>(Button::A)},
|
||||||
#n, static_cast < s32>(Button::n) \
|
{TRANSLATABLE("NamcoGunCon", "B"), static_cast<s32>(Button::B)}};
|
||||||
}
|
|
||||||
return {B(Trigger), B(A), B(B)};
|
|
||||||
#undef B
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 NamcoGunCon::StaticGetVibrationMotorCount()
|
u32 NamcoGunCon::StaticGetVibrationMotorCount()
|
||||||
|
|
|
@ -174,6 +174,7 @@ void ControllerSettingsWidget::createPortBindingSettingsUi(int index, PortSettin
|
||||||
|
|
||||||
QGridLayout* layout = new QGridLayout(ui->bindings_container);
|
QGridLayout* layout = new QGridLayout(ui->bindings_container);
|
||||||
const auto buttons = Controller::GetButtonNames(ctype);
|
const auto buttons = Controller::GetButtonNames(ctype);
|
||||||
|
const char* cname = Settings::GetControllerTypeName(ctype);
|
||||||
|
|
||||||
InputBindingWidget* first_button = nullptr;
|
InputBindingWidget* first_button = nullptr;
|
||||||
InputBindingWidget* last_button = nullptr;
|
InputBindingWidget* last_button = nullptr;
|
||||||
|
@ -196,7 +197,7 @@ void ControllerSettingsWidget::createPortBindingSettingsUi(int index, PortSettin
|
||||||
|
|
||||||
std::string section_name = StringUtil::StdStringFromFormat("Controller%d", index + 1);
|
std::string section_name = StringUtil::StdStringFromFormat("Controller%d", index + 1);
|
||||||
std::string key_name = StringUtil::StdStringFromFormat("Button%s", button_name.c_str());
|
std::string key_name = StringUtil::StdStringFromFormat("Button%s", button_name.c_str());
|
||||||
QLabel* label = new QLabel(QString::fromStdString(button_name), ui->bindings_container);
|
QLabel* label = new QLabel(qApp->translate(cname, button_name.c_str()), ui->bindings_container);
|
||||||
InputButtonBindingWidget* button = new InputButtonBindingWidget(m_host_interface, std::move(section_name),
|
InputButtonBindingWidget* button = new InputButtonBindingWidget(m_host_interface, std::move(section_name),
|
||||||
std::move(key_name), ui->bindings_container);
|
std::move(key_name), ui->bindings_container);
|
||||||
layout->addWidget(label, start_row + current_row, current_column);
|
layout->addWidget(label, start_row + current_row, current_column);
|
||||||
|
@ -233,7 +234,7 @@ void ControllerSettingsWidget::createPortBindingSettingsUi(int index, PortSettin
|
||||||
|
|
||||||
std::string section_name = StringUtil::StdStringFromFormat("Controller%d", index + 1);
|
std::string section_name = StringUtil::StdStringFromFormat("Controller%d", index + 1);
|
||||||
std::string key_name = StringUtil::StdStringFromFormat("Axis%s", axis_name.c_str());
|
std::string key_name = StringUtil::StdStringFromFormat("Axis%s", axis_name.c_str());
|
||||||
QLabel* label = new QLabel(QString::fromStdString(axis_name), ui->bindings_container);
|
QLabel* label = new QLabel(qApp->translate(cname, axis_name.c_str()), ui->bindings_container);
|
||||||
InputAxisBindingWidget* button = new InputAxisBindingWidget(m_host_interface, std::move(section_name),
|
InputAxisBindingWidget* button = new InputAxisBindingWidget(m_host_interface, std::move(section_name),
|
||||||
std::move(key_name), ui->bindings_container);
|
std::move(key_name), ui->bindings_container);
|
||||||
layout->addWidget(label, start_row + current_row, current_column);
|
layout->addWidget(label, start_row + current_row, current_column);
|
||||||
|
@ -282,13 +283,13 @@ void ControllerSettingsWidget::createPortBindingSettingsUi(int index, PortSettin
|
||||||
{
|
{
|
||||||
std::string section_name = StringUtil::StdStringFromFormat("Controller%d", index + 1);
|
std::string section_name = StringUtil::StdStringFromFormat("Controller%d", index + 1);
|
||||||
std::string key_name = si.key;
|
std::string key_name = si.key;
|
||||||
const QString setting_tooltip = si.description ? QString::fromUtf8(si.description) : "";
|
const QString setting_tooltip = si.description ? qApp->translate(cname, si.description) : QString();
|
||||||
|
|
||||||
switch (si.type)
|
switch (si.type)
|
||||||
{
|
{
|
||||||
case SettingInfo::Type::Boolean:
|
case SettingInfo::Type::Boolean:
|
||||||
{
|
{
|
||||||
QCheckBox* cb = new QCheckBox(tr(si.visible_name), ui->bindings_container);
|
QCheckBox* cb = new QCheckBox(qApp->translate(cname, si.visible_name), ui->bindings_container);
|
||||||
cb->setToolTip(setting_tooltip);
|
cb->setToolTip(setting_tooltip);
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, cb, std::move(section_name),
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, cb, std::move(section_name),
|
||||||
std::move(key_name), si.BooleanDefaultValue());
|
std::move(key_name), si.BooleanDefaultValue());
|
||||||
|
@ -306,7 +307,7 @@ void ControllerSettingsWidget::createPortBindingSettingsUi(int index, PortSettin
|
||||||
sb->setSingleStep(si.IntegerStepValue());
|
sb->setSingleStep(si.IntegerStepValue());
|
||||||
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, sb, std::move(section_name),
|
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, sb, std::move(section_name),
|
||||||
std::move(key_name), si.IntegerDefaultValue());
|
std::move(key_name), si.IntegerDefaultValue());
|
||||||
layout->addWidget(new QLabel(tr(si.visible_name), ui->bindings_container), start_row, 0);
|
layout->addWidget(new QLabel(qApp->translate(cname, si.visible_name), ui->bindings_container), start_row, 0);
|
||||||
layout->addWidget(sb, start_row, 1, 1, 3);
|
layout->addWidget(sb, start_row, 1, 1, 3);
|
||||||
start_row++;
|
start_row++;
|
||||||
}
|
}
|
||||||
|
@ -321,7 +322,7 @@ void ControllerSettingsWidget::createPortBindingSettingsUi(int index, PortSettin
|
||||||
sb->setSingleStep(si.FloatStepValue());
|
sb->setSingleStep(si.FloatStepValue());
|
||||||
SettingWidgetBinder::BindWidgetToFloatSetting(m_host_interface, sb, std::move(section_name),
|
SettingWidgetBinder::BindWidgetToFloatSetting(m_host_interface, sb, std::move(section_name),
|
||||||
std::move(key_name), si.FloatDefaultValue());
|
std::move(key_name), si.FloatDefaultValue());
|
||||||
layout->addWidget(new QLabel(tr(si.visible_name), ui->bindings_container), start_row, 0);
|
layout->addWidget(new QLabel(qApp->translate(cname, si.visible_name), ui->bindings_container), start_row, 0);
|
||||||
layout->addWidget(sb, start_row, 1, 1, 3);
|
layout->addWidget(sb, start_row, 1, 1, 3);
|
||||||
start_row++;
|
start_row++;
|
||||||
}
|
}
|
||||||
|
@ -333,7 +334,7 @@ void ControllerSettingsWidget::createPortBindingSettingsUi(int index, PortSettin
|
||||||
le->setToolTip(setting_tooltip);
|
le->setToolTip(setting_tooltip);
|
||||||
SettingWidgetBinder::BindWidgetToStringSetting(m_host_interface, le, std::move(section_name),
|
SettingWidgetBinder::BindWidgetToStringSetting(m_host_interface, le, std::move(section_name),
|
||||||
std::move(key_name), si.StringDefaultValue());
|
std::move(key_name), si.StringDefaultValue());
|
||||||
layout->addWidget(new QLabel(tr(si.visible_name), ui->bindings_container), start_row, 0);
|
layout->addWidget(new QLabel(qApp->translate(cname, si.visible_name), ui->bindings_container), start_row, 0);
|
||||||
layout->addWidget(le, start_row, 1, 1, 3);
|
layout->addWidget(le, start_row, 1, 1, 3);
|
||||||
start_row++;
|
start_row++;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +357,7 @@ void ControllerSettingsWidget::createPortBindingSettingsUi(int index, PortSettin
|
||||||
hbox->addWidget(le, 1);
|
hbox->addWidget(le, 1);
|
||||||
hbox->addWidget(browse_button);
|
hbox->addWidget(browse_button);
|
||||||
|
|
||||||
layout->addWidget(new QLabel(tr(si.visible_name), ui->bindings_container), start_row, 0);
|
layout->addWidget(new QLabel(qApp->translate(cname, si.visible_name), ui->bindings_container), start_row, 0);
|
||||||
layout->addLayout(hbox, start_row, 1, 1, 3);
|
layout->addLayout(hbox, start_row, 1, 1, 3);
|
||||||
start_row++;
|
start_row++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,11 @@
|
||||||
#include <QtWidgets/QStyleFactory>
|
#include <QtWidgets/QStyleFactory>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
static constexpr char DISC_IMAGE_FILTER[] =
|
static constexpr char DISC_IMAGE_FILTER[] = QT_TRANSLATE_NOOP(
|
||||||
|
"MainWindow",
|
||||||
"All File Types (*.bin *.img *.cue *.chd *.exe *.psexe *.psf);;Single-Track Raw Images (*.bin *.img);;Cue Sheets "
|
"All File Types (*.bin *.img *.cue *.chd *.exe *.psexe *.psf);;Single-Track Raw Images (*.bin *.img);;Cue Sheets "
|
||||||
"(*.cue);;MAME CHD Images (*.chd);;PlayStation Executables (*.exe *.psexe);;Portable Sound Format Files "
|
"(*.cue);;MAME CHD Images (*.chd);;PlayStation Executables (*.exe *.psexe);;Portable Sound Format Files "
|
||||||
"(*.psf);;Playlists (*.m3u)";
|
"(*.psf);;Playlists (*.m3u)");
|
||||||
|
|
||||||
ALWAYS_INLINE static QString getWindowTitle()
|
ALWAYS_INLINE static QString getWindowTitle()
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <QtWidgets/QFileDialog>
|
#include <QtWidgets/QFileDialog>
|
||||||
#include <QtWidgets/QLabel>
|
#include <QtWidgets/QLabel>
|
||||||
|
|
||||||
static constexpr char MEMORY_CARD_IMAGE_FILTER[] = "All Memory Card Types (*.mcd *.mcr *.mc)";
|
static constexpr char MEMORY_CARD_IMAGE_FILTER[] = QT_TRANSLATE_NOOP("MemoryCardSettingsWidget", "All Memory Card Types (*.mcd *.mcr *.mc)");
|
||||||
|
|
||||||
MemoryCardSettingsWidget::MemoryCardSettingsWidget(QtHostInterface* host_interface, QWidget* parent,
|
MemoryCardSettingsWidget::MemoryCardSettingsWidget(QtHostInterface* host_interface, QWidget* parent,
|
||||||
SettingsDialog* dialog)
|
SettingsDialog* dialog)
|
||||||
|
|
Loading…
Reference in New Issue