aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliamWsyHK <WilliamWsyHK@users.noreply.github.com>2023-06-04 11:30:24 +0800
committerGitHub <noreply@github.com>2023-06-04 05:30:24 +0200
commitd511c845b70a8771de7d64369e24ab3f1ed1c325 (patch)
treecb57689ed2f6080b8e3e8bbc465db6358a7e9012
parent21c9ac6240a3db3300143d1d0dd4a1070d4f576f (diff)
Check KeyboardMode in GUI (#4343)1.1.862
* Update SoftwareKeyboard to send KeyboardMode to UI * Update GTK UI to check text against KeyboardMode * Update Ava UI to check text against KeyboardMode * Restructure input validation * true when text is not empty * Add English validation text for SoftwareKeyboardMode * Add Chinese validation text for SoftwareKeyboardMode * Update base on feedback --------- Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
-rw-r--r--src/Ryujinx.Ava/Assets/Locales/en_US.json3
-rw-r--r--src/Ryujinx.Ava/Assets/Locales/zh_CN.json3
-rw-r--r--src/Ryujinx.Ava/Assets/Locales/zh_TW.json3
-rw-r--r--src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs59
-rw-r--r--src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/KeyboardMode.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs1
-rw-r--r--src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardUiArgs.cs3
-rw-r--r--src/Ryujinx/Ui/Applet/GtkHostUiHandler.cs1
-rw-r--r--src/Ryujinx/Ui/Applet/SwkbdAppletDialog.cs56
9 files changed, 109 insertions, 22 deletions
diff --git a/src/Ryujinx.Ava/Assets/Locales/en_US.json b/src/Ryujinx.Ava/Assets/Locales/en_US.json
index 8f4965e14..79765db16 100644
--- a/src/Ryujinx.Ava/Assets/Locales/en_US.json
+++ b/src/Ryujinx.Ava/Assets/Locales/en_US.json
@@ -544,6 +544,9 @@
544 "SwkbdMinCharacters": "Must be at least {0} characters long", 544 "SwkbdMinCharacters": "Must be at least {0} characters long",
545 "SwkbdMinRangeCharacters": "Must be {0}-{1} characters long", 545 "SwkbdMinRangeCharacters": "Must be {0}-{1} characters long",
546 "SoftwareKeyboard": "Software Keyboard", 546 "SoftwareKeyboard": "Software Keyboard",
547 "SoftwareKeyboardModeNumbersOnly": "Must be numbers only",
548 "SoftwareKeyboardModeAlphabet": "Must be alphabets only",
549 "SoftwareKeyboardModeASCII": "Must be ASCII text only",
547 "DialogControllerAppletMessagePlayerRange": "Application requests {0} player(s) with:\n\nTYPES: {1}\n\nPLAYERS: {2}\n\n{3}Please open Settings and reconfigure Input now or press Close.", 550 "DialogControllerAppletMessagePlayerRange": "Application requests {0} player(s) with:\n\nTYPES: {1}\n\nPLAYERS: {2}\n\n{3}Please open Settings and reconfigure Input now or press Close.",
548 "DialogControllerAppletMessage": "Application requests exactly {0} player(s) with:\n\nTYPES: {1}\n\nPLAYERS: {2}\n\n{3}Please open Settings and reconfigure Input now or press Close.", 551 "DialogControllerAppletMessage": "Application requests exactly {0} player(s) with:\n\nTYPES: {1}\n\nPLAYERS: {2}\n\n{3}Please open Settings and reconfigure Input now or press Close.",
549 "DialogControllerAppletDockModeSet": "Docked mode set. Handheld is also invalid.\n\n", 552 "DialogControllerAppletDockModeSet": "Docked mode set. Handheld is also invalid.\n\n",
diff --git a/src/Ryujinx.Ava/Assets/Locales/zh_CN.json b/src/Ryujinx.Ava/Assets/Locales/zh_CN.json
index 25dc3cbaf..b47dda975 100644
--- a/src/Ryujinx.Ava/Assets/Locales/zh_CN.json
+++ b/src/Ryujinx.Ava/Assets/Locales/zh_CN.json
@@ -527,6 +527,9 @@
527 "SwkbdMinCharacters": "至少应为 {0} 个字长", 527 "SwkbdMinCharacters": "至少应为 {0} 个字长",
528 "SwkbdMinRangeCharacters": "必须为 {0}-{1} 个字长", 528 "SwkbdMinRangeCharacters": "必须为 {0}-{1} 个字长",
529 "SoftwareKeyboard": "软件键盘", 529 "SoftwareKeyboard": "软件键盘",
530 "SoftwareKeyboardModeNumbersOnly": "只接受数字",
531 "SoftwareKeyboardModeAlphabet": "只接受英文字母",
532 "SoftwareKeyboardModeASCII": "只接受 ASCII 符号",
530 "DialogControllerAppletMessagePlayerRange": "游戏需要 {0} 个玩家并满足以下要求:\n\n手柄类型:{1}\n\n玩家类型:{2}\n\n{3}请打开设置窗口,重新配置手柄输入;或者关闭返回。", 533 "DialogControllerAppletMessagePlayerRange": "游戏需要 {0} 个玩家并满足以下要求:\n\n手柄类型:{1}\n\n玩家类型:{2}\n\n{3}请打开设置窗口,重新配置手柄输入;或者关闭返回。",
531 "DialogControllerAppletMessage": "游戏需要刚好 {0} 个玩家并满足以下要求:\n\n手柄类型:{1}\n\n玩家类型:{2}\n\n{3}请打开设置窗口,重新配置手柄输入;或者关闭返回。", 534 "DialogControllerAppletMessage": "游戏需要刚好 {0} 个玩家并满足以下要求:\n\n手柄类型:{1}\n\n玩家类型:{2}\n\n{3}请打开设置窗口,重新配置手柄输入;或者关闭返回。",
532 "DialogControllerAppletDockModeSet": "目前处于主机模式,无法使用掌机操作方式", 535 "DialogControllerAppletDockModeSet": "目前处于主机模式,无法使用掌机操作方式",
diff --git a/src/Ryujinx.Ava/Assets/Locales/zh_TW.json b/src/Ryujinx.Ava/Assets/Locales/zh_TW.json
index 940282a0f..e943691ce 100644
--- a/src/Ryujinx.Ava/Assets/Locales/zh_TW.json
+++ b/src/Ryujinx.Ava/Assets/Locales/zh_TW.json
@@ -527,6 +527,9 @@
527 "SwkbdMinCharacters": "至少應為 {0} 個字長", 527 "SwkbdMinCharacters": "至少應為 {0} 個字長",
528 "SwkbdMinRangeCharacters": "必須為 {0}-{1} 個字長", 528 "SwkbdMinRangeCharacters": "必須為 {0}-{1} 個字長",
529 "SoftwareKeyboard": "軟體鍵盤", 529 "SoftwareKeyboard": "軟體鍵盤",
530 "SoftwareKeyboardModeNumbersOnly": "只接受數字",
531 "SoftwareKeyboardModeAlphabet": "只接受英文字母",
532 "SoftwareKeyboardModeASCII": "只接受 ASCII 符號",
530 "DialogControllerAppletMessagePlayerRange": "本遊戲需要 {0} 個玩家持有:\n\n類型:{1}\n\n玩家:{2}\n\n{3}請打開設定畫面,配置手把,或者關閉本視窗。", 533 "DialogControllerAppletMessagePlayerRange": "本遊戲需要 {0} 個玩家持有:\n\n類型:{1}\n\n玩家:{2}\n\n{3}請打開設定畫面,配置手把,或者關閉本視窗。",
531 "DialogControllerAppletMessage": "本遊戲需要剛好 {0} 個玩家持有:\n\n類型:{1}\n\n玩家:{2}\n\n{3}請打開設定畫面,配置手把,或者關閉本視窗。", 534 "DialogControllerAppletMessage": "本遊戲需要剛好 {0} 個玩家持有:\n\n類型:{1}\n\n玩家:{2}\n\n{3}請打開設定畫面,配置手把,或者關閉本視窗。",
532 "DialogControllerAppletDockModeSet": "現在處於主機模式,無法使用掌機操作方式\n\n", 535 "DialogControllerAppletDockModeSet": "現在處於主機模式,無法使用掌機操作方式\n\n",
diff --git a/src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs b/src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs
index cb69e96b7..04bc46193 100644
--- a/src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs
+++ b/src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs
@@ -9,14 +9,17 @@ using Ryujinx.Ava.Common.Locale;
9using Ryujinx.Ava.UI.Helpers; 9using Ryujinx.Ava.UI.Helpers;
10using Ryujinx.Ava.UI.Windows; 10using Ryujinx.Ava.UI.Windows;
11using Ryujinx.HLE.HOS.Applets; 11using Ryujinx.HLE.HOS.Applets;
12using Ryujinx.HLE.HOS.Applets.SoftwareKeyboard;
12using System; 13using System;
14using System.Linq;
13using System.Threading.Tasks; 15using System.Threading.Tasks;
14 16
15namespace Ryujinx.Ava.UI.Controls 17namespace Ryujinx.Ava.UI.Controls
16{ 18{
17 internal partial class SwkbdAppletDialog : UserControl 19 internal partial class SwkbdAppletDialog : UserControl
18 { 20 {
19 private Predicate<int> _checkLength; 21 private Predicate<int> _checkLength = _ => true;
22 private Predicate<string> _checkInput = _ => true;
20 private int _inputMax; 23 private int _inputMax;
21 private int _inputMin; 24 private int _inputMin;
22 private string _placeholder; 25 private string _placeholder;
@@ -35,8 +38,6 @@ namespace Ryujinx.Ava.UI.Controls
35 Input.Watermark = _placeholder; 38 Input.Watermark = _placeholder;
36 39
37 Input.AddHandler(TextInputEvent, Message_TextInput, RoutingStrategies.Tunnel, true); 40 Input.AddHandler(TextInputEvent, Message_TextInput, RoutingStrategies.Tunnel, true);
38
39 SetInputLengthValidation(0, int.MaxValue); // Disable by default.
40 } 41 }
41 42
42 public SwkbdAppletDialog() 43 public SwkbdAppletDialog()
@@ -67,6 +68,7 @@ namespace Ryujinx.Ava.UI.Controls
67 string input = string.Empty; 68 string input = string.Empty;
68 69
69 content.SetInputLengthValidation(args.StringLengthMin, args.StringLengthMax); 70 content.SetInputLengthValidation(args.StringLengthMin, args.StringLengthMax);
71 content.SetInputValidation(args.KeyboardMode);
70 72
71 content._host = contentDialog; 73 content._host = contentDialog;
72 contentDialog.Title = title; 74 contentDialog.Title = title;
@@ -91,6 +93,12 @@ namespace Ryujinx.Ava.UI.Controls
91 return (result, input); 93 return (result, input);
92 } 94 }
93 95
96 private void ApplyValidationInfo(string text)
97 {
98 Error.IsVisible = !string.IsNullOrEmpty(text);
99 Error.Text = text;
100 }
101
94 public void SetInputLengthValidation(int min, int max) 102 public void SetInputLengthValidation(int min, int max)
95 { 103 {
96 _inputMin = Math.Min(min, max); 104 _inputMin = Math.Min(min, max);
@@ -99,6 +107,8 @@ namespace Ryujinx.Ava.UI.Controls
99 Error.IsVisible = false; 107 Error.IsVisible = false;
100 Error.FontStyle = FontStyle.Italic; 108 Error.FontStyle = FontStyle.Italic;
101 109
110 string validationInfoText = "";
111
102 if (_inputMin <= 0 && _inputMax == int.MaxValue) // Disable. 112 if (_inputMin <= 0 && _inputMax == int.MaxValue) // Disable.
103 { 113 {
104 Error.IsVisible = false; 114 Error.IsVisible = false;
@@ -107,21 +117,48 @@ namespace Ryujinx.Ava.UI.Controls
107 } 117 }
108 else if (_inputMin > 0 && _inputMax == int.MaxValue) 118 else if (_inputMin > 0 && _inputMax == int.MaxValue)
109 { 119 {
110 Error.IsVisible = true; 120 validationInfoText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SwkbdMinCharacters, _inputMin);
111
112 Error.Text = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SwkbdMinCharacters, _inputMin);
113 121
114 _checkLength = length => _inputMin <= length; 122 _checkLength = length => _inputMin <= length;
115 } 123 }
116 else 124 else
117 { 125 {
118 Error.IsVisible = true; 126 validationInfoText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SwkbdMinRangeCharacters, _inputMin, _inputMax);
119
120 Error.Text = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SwkbdMinRangeCharacters, _inputMin, _inputMax);
121 127
122 _checkLength = length => _inputMin <= length && length <= _inputMax; 128 _checkLength = length => _inputMin <= length && length <= _inputMax;
123 } 129 }
124 130
131 ApplyValidationInfo(validationInfoText);
132 Message_TextInput(this, new TextInputEventArgs());
133 }
134
135 private void SetInputValidation(KeyboardMode mode)
136 {
137 string validationInfoText = Error.Text;
138 string localeText;
139 switch (mode)
140 {
141 case KeyboardMode.NumbersOnly:
142 localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeNumbersOnly);
143 validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
144 _checkInput = text => text.All(char.IsDigit);
145 break;
146 case KeyboardMode.Alphabet:
147 localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeAlphabet);
148 validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
149 _checkInput = text => text.All(char.IsAsciiLetter);
150 break;
151 case KeyboardMode.ASCII:
152 localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeASCII);
153 validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
154 _checkInput = text => text.All(char.IsAscii);
155 break;
156 default:
157 _checkInput = _ => true;
158 break;
159 }
160
161 ApplyValidationInfo(validationInfoText);
125 Message_TextInput(this, new TextInputEventArgs()); 162 Message_TextInput(this, new TextInputEventArgs());
126 } 163 }
127 164
@@ -129,7 +166,7 @@ namespace Ryujinx.Ava.UI.Controls
129 { 166 {
130 if (_host != null) 167 if (_host != null)
131 { 168 {
132 _host.IsPrimaryButtonEnabled = _checkLength(Message.Length); 169 _host.IsPrimaryButtonEnabled = _checkLength(Message.Length) && _checkInput(Message);
133 } 170 }
134 } 171 }
135 172
@@ -141,7 +178,7 @@ namespace Ryujinx.Ava.UI.Controls
141 } 178 }
142 else 179 else
143 { 180 {
144 _host.IsPrimaryButtonEnabled = _checkLength(Message.Length); 181 _host.IsPrimaryButtonEnabled = _checkLength(Message.Length) && _checkInput(Message);
145 } 182 }
146 } 183 }
147 } 184 }
diff --git a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/KeyboardMode.cs b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/KeyboardMode.cs
index f512050e1..01b3c9634 100644
--- a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/KeyboardMode.cs
+++ b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/KeyboardMode.cs
@@ -3,7 +3,7 @@
3 /// <summary> 3 /// <summary>
4 /// Identifies the variant of keyboard displayed on screen. 4 /// Identifies the variant of keyboard displayed on screen.
5 /// </summary> 5 /// </summary>
6 enum KeyboardMode : uint 6 public enum KeyboardMode : uint
7 { 7 {
8 /// <summary> 8 /// <summary>
9 /// A full alpha-numeric keyboard. 9 /// A full alpha-numeric keyboard.
diff --git a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs
index 278ea56c2..4b484e802 100644
--- a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs
+++ b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs
@@ -209,6 +209,7 @@ namespace Ryujinx.HLE.HOS.Applets
209 // Call the configured GUI handler to get user's input. 209 // Call the configured GUI handler to get user's input.
210 var args = new SoftwareKeyboardUiArgs 210 var args = new SoftwareKeyboardUiArgs
211 { 211 {
212 KeyboardMode = _keyboardForegroundConfig.Mode,
212 HeaderText = StripUnicodeControlCodes(_keyboardForegroundConfig.HeaderText), 213 HeaderText = StripUnicodeControlCodes(_keyboardForegroundConfig.HeaderText),
213 SubtitleText = StripUnicodeControlCodes(_keyboardForegroundConfig.SubtitleText), 214 SubtitleText = StripUnicodeControlCodes(_keyboardForegroundConfig.SubtitleText),
214 GuideText = StripUnicodeControlCodes(_keyboardForegroundConfig.GuideText), 215 GuideText = StripUnicodeControlCodes(_keyboardForegroundConfig.GuideText),
diff --git a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardUiArgs.cs b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardUiArgs.cs
index d24adec33..d67a44094 100644
--- a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardUiArgs.cs
+++ b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardUiArgs.cs
@@ -1,7 +1,10 @@
1using Ryujinx.HLE.HOS.Applets.SoftwareKeyboard;
2
1namespace Ryujinx.HLE.HOS.Applets 3namespace Ryujinx.HLE.HOS.Applets
2{ 4{
3 public struct SoftwareKeyboardUiArgs 5 public struct SoftwareKeyboardUiArgs
4 { 6 {
7 public KeyboardMode KeyboardMode;
5 public string HeaderText; 8 public string HeaderText;
6 public string SubtitleText; 9 public string SubtitleText;
7 public string InitialText; 10 public string InitialText;
diff --git a/src/Ryujinx/Ui/Applet/GtkHostUiHandler.cs b/src/Ryujinx/Ui/Applet/GtkHostUiHandler.cs
index d81cbe3c5..b7577b85d 100644
--- a/src/Ryujinx/Ui/Applet/GtkHostUiHandler.cs
+++ b/src/Ryujinx/Ui/Applet/GtkHostUiHandler.cs
@@ -106,6 +106,7 @@ namespace Ryujinx.Ui.Applet
106 swkbdDialog.OkButton.Label = args.SubmitText; 106 swkbdDialog.OkButton.Label = args.SubmitText;
107 107
108 swkbdDialog.SetInputLengthValidation(args.StringLengthMin, args.StringLengthMax); 108 swkbdDialog.SetInputLengthValidation(args.StringLengthMin, args.StringLengthMax);
109 swkbdDialog.SetInputValidation(args.KeyboardMode);
109 110
110 if (swkbdDialog.Run() == (int)ResponseType.Ok) 111 if (swkbdDialog.Run() == (int)ResponseType.Ok)
111 { 112 {
diff --git a/src/Ryujinx/Ui/Applet/SwkbdAppletDialog.cs b/src/Ryujinx/Ui/Applet/SwkbdAppletDialog.cs
index 7c14f0e8d..28067b751 100644
--- a/src/Ryujinx/Ui/Applet/SwkbdAppletDialog.cs
+++ b/src/Ryujinx/Ui/Applet/SwkbdAppletDialog.cs
@@ -1,5 +1,7 @@
1using Gtk; 1using Gtk;
2using Ryujinx.HLE.HOS.Applets.SoftwareKeyboard;
2using System; 3using System;
4using System.Linq;
3 5
4namespace Ryujinx.Ui.Applet 6namespace Ryujinx.Ui.Applet
5{ 7{
@@ -7,8 +9,12 @@ namespace Ryujinx.Ui.Applet
7 { 9 {
8 private int _inputMin; 10 private int _inputMin;
9 private int _inputMax; 11 private int _inputMax;
12 private KeyboardMode _mode;
10 13
11 private Predicate<int> _checkLength; 14 private string _validationInfoText = "";
15
16 private Predicate<int> _checkLength = _ => true;
17 private Predicate<string> _checkInput = _ => true;
12 18
13 private readonly Label _validationInfo; 19 private readonly Label _validationInfo;
14 20
@@ -38,8 +44,12 @@ namespace Ryujinx.Ui.Applet
38 44
39 ((Box)MessageArea).PackEnd(_validationInfo, true, true, 0); 45 ((Box)MessageArea).PackEnd(_validationInfo, true, true, 0);
40 ((Box)MessageArea).PackEnd(InputEntry, true, true, 4); 46 ((Box)MessageArea).PackEnd(InputEntry, true, true, 4);
47 }
41 48
42 SetInputLengthValidation(0, int.MaxValue); // Disable by default. 49 private void ApplyValidationInfo()
50 {
51 _validationInfo.Visible = !string.IsNullOrEmpty(_validationInfoText);
52 _validationInfo.Markup = _validationInfoText;
43 } 53 }
44 54
45 public void SetInputLengthValidation(int min, int max) 55 public void SetInputLengthValidation(int min, int max)
@@ -53,23 +63,49 @@ namespace Ryujinx.Ui.Applet
53 { 63 {
54 _validationInfo.Visible = false; 64 _validationInfo.Visible = false;
55 65
56 _checkLength = (length) => true; 66 _checkLength = _ => true;
57 } 67 }
58 else if (_inputMin > 0 && _inputMax == int.MaxValue) 68 else if (_inputMin > 0 && _inputMax == int.MaxValue)
59 { 69 {
60 _validationInfo.Visible = true; 70 _validationInfoText = $"<i>Must be at least {_inputMin} characters long.</i> ";
61 _validationInfo.Markup = $"<i>Must be at least {_inputMin} characters long</i>";
62 71
63 _checkLength = (length) => _inputMin <= length; 72 _checkLength = length => _inputMin <= length;
64 } 73 }
65 else 74 else
66 { 75 {
67 _validationInfo.Visible = true; 76 _validationInfoText = $"<i>Must be {_inputMin}-{_inputMax} characters long.</i> ";
68 _validationInfo.Markup = $"<i>Must be {_inputMin}-{_inputMax} characters long</i>";
69 77
70 _checkLength = (length) => _inputMin <= length && length <= _inputMax; 78 _checkLength = length => _inputMin <= length && length <= _inputMax;
79 }
80
81 ApplyValidationInfo();
82 OnInputChanged(this, EventArgs.Empty);
83 }
84
85 public void SetInputValidation(KeyboardMode mode)
86 {
87 _mode = mode;
88
89 switch (mode)
90 {
91 case KeyboardMode.NumbersOnly:
92 _validationInfoText += "<i>Must be numbers only.</i>";
93 _checkInput = text => text.All(char.IsDigit);
94 break;
95 case KeyboardMode.Alphabet:
96 _validationInfoText += "<i>Must be alphabets only.</i>";
97 _checkInput = text => text.All(char.IsAsciiLetter);
98 break;
99 case KeyboardMode.ASCII:
100 _validationInfoText += "<i>Must be ASCII text only.</i>";
101 _checkInput = text => text.All(char.IsAscii);
102 break;
103 default:
104 _checkInput = _ => true;
105 break;
71 } 106 }
72 107
108 ApplyValidationInfo();
73 OnInputChanged(this, EventArgs.Empty); 109 OnInputChanged(this, EventArgs.Empty);
74 } 110 }
75 111
@@ -83,7 +119,7 @@ namespace Ryujinx.Ui.Applet
83 119
84 private void OnInputChanged(object sender, EventArgs e) 120 private void OnInputChanged(object sender, EventArgs e)
85 { 121 {
86 OkButton.Sensitive = _checkLength(InputEntry.Text.Length); 122 OkButton.Sensitive = _checkLength(InputEntry.Text.Length) && _checkInput(InputEntry.Text);
87 } 123 }
88 } 124 }
89} \ No newline at end of file 125} \ No newline at end of file