frontend/applets/swkbd: use system username

This commit is contained in:
zhupengfei 2018-07-17 22:42:53 +08:00
parent dcaf4a8e83
commit b54e3b7aa9
No known key found for this signature in database
GPG key ID: 85B82A3E62174206
3 changed files with 9 additions and 6 deletions

View file

@ -7,6 +7,6 @@
namespace Frontend { namespace Frontend {
void RegisterDefaultApplets() { void RegisterDefaultApplets() {
RegisterSoftwareKeyboard(std::make_shared<DefaultCitraKeyboard>()); RegisterSoftwareKeyboard(std::make_shared<DefaultKeyboard>());
} }
} // namespace Frontend } // namespace Frontend

View file

@ -6,8 +6,10 @@
#include <cctype> #include <cctype>
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/string_util.h"
#include "core/core.h" #include "core/core.h"
#include "core/frontend/applets/swkbd.h" #include "core/frontend/applets/swkbd.h"
#include "core/hle/service/cfg/cfg.h"
namespace Frontend { namespace Frontend {
@ -130,18 +132,19 @@ ValidationError SoftwareKeyboard::Finalize(const std::string& text, u8 button) {
data = {text, button}; data = {text, button};
} }
void DefaultCitraKeyboard::Setup(const Frontend::KeyboardConfig* config) { void DefaultKeyboard::Setup(const Frontend::KeyboardConfig* config) {
SoftwareKeyboard::Setup(config); SoftwareKeyboard::Setup(config);
std::string username = Common::UTF16ToUTF8(Service::CFG::GetCurrentModule()->GetUsername());
switch (this->config.button_config) { switch (this->config.button_config) {
case ButtonConfig::None: case ButtonConfig::None:
case ButtonConfig::Single: case ButtonConfig::Single:
Finalize("Citra", 0); Finalize(username, 0);
break; break;
case ButtonConfig::Dual: case ButtonConfig::Dual:
Finalize("Citra", 1); Finalize(username, 1);
break; break;
case ButtonConfig::Triple: case ButtonConfig::Triple:
Finalize("Citra", 2); Finalize(username, 2);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();

View file

@ -119,7 +119,7 @@ protected:
KeyboardData data; KeyboardData data;
}; };
class DefaultCitraKeyboard final : public SoftwareKeyboard { class DefaultKeyboard final : public SoftwareKeyboard {
public: public:
void Setup(const KeyboardConfig* config) override; void Setup(const KeyboardConfig* config) override;
}; };