Move buttons text to a separate file

This commit is contained in:
Valentin Vanelslande 2018-10-16 16:05:56 -05:00
parent 910c4a4f7a
commit 145b9251bb
4 changed files with 21 additions and 11 deletions

View File

@ -9,6 +9,7 @@
#include <QString>
#include <QVBoxLayout>
#include "citra_qt/applets/swkbd.h"
#include "core/hle/applets/buttons.h"
QtKeyboardValidator::QtKeyboardValidator(QtKeyboard* keyboard_) : keyboard(keyboard_) {}
@ -36,31 +37,31 @@ QtKeyboardDialog::QtKeyboardDialog(QWidget* parent, QtKeyboard* keyboard_)
case ButtonConfig::Triple:
buttons->addButton(config.has_custom_button_text
? QString::fromStdString(config.button_text[2])
: tr(BUTTON_OKAY),
: tr(AppletButton::Ok),
QDialogButtonBox::ButtonRole::AcceptRole);
buttons->addButton(config.has_custom_button_text
? QString::fromStdString(config.button_text[1])
: tr(BUTTON_FORGOT),
: tr(AppletButton::IForgot),
QDialogButtonBox::ButtonRole::HelpRole);
buttons->addButton(config.has_custom_button_text
? QString::fromStdString(config.button_text[0])
: tr(BUTTON_CANCEL),
: tr(AppletButton::Cancel),
QDialogButtonBox::ButtonRole::RejectRole);
break;
case ButtonConfig::Dual:
buttons->addButton(config.has_custom_button_text
? QString::fromStdString(config.button_text[1])
: tr(BUTTON_OKAY),
: tr(AppletButton::Ok),
QDialogButtonBox::ButtonRole::AcceptRole);
buttons->addButton(config.has_custom_button_text
? QString::fromStdString(config.button_text[0])
: tr(BUTTON_CANCEL),
: tr(AppletButton::Cancel),
QDialogButtonBox::ButtonRole::RejectRole);
break;
case ButtonConfig::Single:
buttons->addButton(config.has_custom_button_text
? QString::fromStdString(config.button_text[0])
: tr(BUTTON_OKAY),
: tr(AppletButton::Ok),
QDialogButtonBox::ButtonRole::AcceptRole);
break;
case ButtonConfig::None:

View File

@ -94,6 +94,7 @@ add_library(core STATIC
gdbstub/gdbstub.h
hle/applets/applet.cpp
hle/applets/applet.h
hle/applets/buttons.h
hle/applets/erreula.cpp
hle/applets/erreula.h
hle/applets/mii_selector.cpp

View File

@ -29,11 +29,6 @@ enum class ButtonConfig {
None, /// No button (returned by swkbdInputText in special cases)
};
/// Default English button text mappings. Frontends may need to copy this to internationalize it.
constexpr char BUTTON_OKAY[] = "Ok";
constexpr char BUTTON_CANCEL[] = "Cancel";
constexpr char BUTTON_FORGOT[] = "I Forgot";
/// Configuration thats relevent to frontend implementation of applets. Anything missing that we
/// later learn is needed can be added here and filled in by the backend HLE applet
struct KeyboardConfig {

View File

@ -0,0 +1,13 @@
// Copyright 2018 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
namespace AppletButton {
constexpr char Ok[] = "Ok";
constexpr char Cancel[] = "Cancel";
constexpr char IForgot[] = "I Forgot";
} // namespace AppletButton