10178
by vulkanr
merge with trunk. revision 13100. |
1 |
/*
|
2 |
* Copyright (C) 2005-2008 Team XBMC
|
|
3 |
* http://www.xbmc.org
|
|
4 |
*
|
|
5 |
* This Program is free software; you can redistribute it and/or modify
|
|
6 |
* it under the terms of the GNU General Public License as published by
|
|
7 |
* the Free Software Foundation; either version 2, or (at your option)
|
|
8 |
* any later version.
|
|
9 |
*
|
|
10 |
* This Program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with XBMC; see the file COPYING. If not, write to
|
|
17 |
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
18 |
* http://www.gnu.org/copyleft/gpl.html
|
|
19 |
*
|
|
20 |
*/
|
|
21 |
||
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
22 |
#include "stdafx.h" |
8035
by yuvalt
Initial port to Linux/SDL |
23 |
#include "GUIDialogGamepad.h" |
7395
by kreet
fixed: EEPROM, SystemInfo backend overhauled, MD5 routines unified |
24 |
#include "utils/md5.h" |
8035
by yuvalt
Initial port to Linux/SDL |
25 |
#include "xbox/XKGeneral.h" |
10043
by vulkanr
merge with trunk. rev. 12805. |
26 |
#include "GUIAudioManager.h" |
27 |
#include "GUIWindowManager.h" |
|
28 |
#include "GUIDialogOK.h" |
|
3618
by bobbin007
fixed: ftp server can not be shut down via settings menu |
29 |
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
30 |
CGUIDialogGamepad::CGUIDialogGamepad(void) |
3746
by jmarshallnz
- 26-07-2005 changed: Skin files are loaded on demand rather than on boot. |
31 |
: CGUIDialogBoxBase(WINDOW_DIALOG_GAMEPAD, "DialogGamepad.xml") |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
32 |
{
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
33 |
m_bCanceled = false; |
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
34 |
m_strUserInput = ""; |
35 |
m_strPassword = ""; |
|
8767
by yuvalt
Major janitoring... |
36 |
m_iRetries = 0; |
2531
by jmarshallnz
- 24-01-2005 fixed: Zoom mode in Combo renderer + glitches. Should be as good as (or surpass) the YUY2 Overlays method now. |
37 |
m_bUserInputCleanup = true; |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
38 |
}
|
39 |
||
40 |
CGUIDialogGamepad::~CGUIDialogGamepad(void) |
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
41 |
{}
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
42 |
|
3160
by jmarshallnz
- 06-05-2005 changed: OnAction() now returns a bool. It should be true if the action has been dealt with and |
43 |
bool CGUIDialogGamepad::OnAction(const CAction &action) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
44 |
{
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
45 |
if ((action.m_dwButtonCode >= KEY_BUTTON_A && |
46 |
action.m_dwButtonCode <= KEY_BUTTON_RIGHT_TRIGGER) || |
|
47 |
(action.m_dwButtonCode >= KEY_BUTTON_DPAD_UP && |
|
48 |
action.m_dwButtonCode <= KEY_BUTTON_DPAD_RIGHT)) |
|
49 |
{
|
|
50 |
switch (action.m_dwButtonCode) |
|
51 |
{
|
|
52 |
case KEY_BUTTON_A : m_strUserInput += "A"; break; |
|
53 |
case KEY_BUTTON_B : m_strUserInput += "B"; break; |
|
54 |
case KEY_BUTTON_X : m_strUserInput += "X"; break; |
|
55 |
case KEY_BUTTON_Y : m_strUserInput += "Y"; break; |
|
56 |
case KEY_BUTTON_BLACK : m_strUserInput += "K"; break; |
|
57 |
case KEY_BUTTON_WHITE : m_strUserInput += "W"; break; |
|
58 |
case KEY_BUTTON_LEFT_TRIGGER : m_strUserInput += "("; break; |
|
59 |
case KEY_BUTTON_RIGHT_TRIGGER : m_strUserInput += ")"; break; |
|
60 |
case KEY_BUTTON_DPAD_UP : m_strUserInput += "U"; break; |
|
61 |
case KEY_BUTTON_DPAD_DOWN : m_strUserInput += "D"; break; |
|
62 |
case KEY_BUTTON_DPAD_LEFT : m_strUserInput += "L"; break; |
|
63 |
case KEY_BUTTON_DPAD_RIGHT : m_strUserInput += "R"; break; |
|
3160
by jmarshallnz
- 06-05-2005 changed: OnAction() now returns a bool. It should be true if the action has been dealt with and |
64 |
default : return true; break; |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
65 |
}
|
66 |
||
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
67 |
CStdString strHiddenInput(m_strUserInput); |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
68 |
for (int i = 0; i < (int)strHiddenInput.size(); i++) |
69 |
{
|
|
70 |
strHiddenInput[i] = m_cHideInputChar; |
|
71 |
}
|
|
72 |
SetLine(2, strHiddenInput); |
|
3160
by jmarshallnz
- 06-05-2005 changed: OnAction() now returns a bool. It should be true if the action has been dealt with and |
73 |
return true; |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
74 |
}
|
75 |
else if (action.m_dwButtonCode == KEY_BUTTON_BACK || action.wID == ACTION_CLOSE_DIALOG || action.wID == ACTION_PREVIOUS_MENU || action.wID == ACTION_PARENT_DIR) |
|
76 |
{
|
|
77 |
m_bConfirmed = false; |
|
78 |
m_bCanceled = true; |
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
79 |
m_strUserInput = ""; |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
80 |
m_bHideInputChars = true; |
81 |
Close(); |
|
3160
by jmarshallnz
- 06-05-2005 changed: OnAction() now returns a bool. It should be true if the action has been dealt with and |
82 |
return true; |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
83 |
}
|
84 |
else if (action.m_dwButtonCode == KEY_BUTTON_START) |
|
85 |
{
|
|
86 |
m_bConfirmed = false; |
|
87 |
m_bCanceled = false; |
|
7104
by darkdonno
changed: file cosmetics removed: trailing whitespace fixed: some TAB usage added: GPL Header |
88 |
|
7395
by kreet
fixed: EEPROM, SystemInfo backend overhauled, MD5 routines unified |
89 |
MD5_CTX md5state; |
7407
by kreet
fixed: MD5 routines fixed, resulting in SMB being fixed. (thanks elupus!) |
90 |
unsigned char md5pword[16]; |
7454
by kreet
fixed: password dialog md5 sums are no longer compared using case-sensitive methods (password itself is still case-sensitive), xml md5 sums changed back to lowercase |
91 |
char md5pword2[33]; |
7395
by kreet
fixed: EEPROM, SystemInfo backend overhauled, MD5 routines unified |
92 |
MD5Init(&md5state); |
93 |
MD5Update(&md5state, (unsigned char *)m_strUserInput.c_str(), (int)m_strUserInput.size()); |
|
7407
by kreet
fixed: MD5 routines fixed, resulting in SMB being fixed. (thanks elupus!) |
94 |
MD5Final(md5pword, &md5state); |
95 |
XKGeneral::BytesToHexStr(md5pword,16,md5pword2); |
|
7104
by darkdonno
changed: file cosmetics removed: trailing whitespace fixed: some TAB usage added: GPL Header |
96 |
|
7454
by kreet
fixed: password dialog md5 sums are no longer compared using case-sensitive methods (password itself is still case-sensitive), xml md5 sums changed back to lowercase |
97 |
if (!m_strPassword.Equals(md5pword2)) |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
98 |
{
|
99 |
// incorrect password entered
|
|
100 |
m_iRetries--; |
|
101 |
||
102 |
// don't clean up if the calling code wants the bad user input
|
|
103 |
if (m_bUserInputCleanup) |
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
104 |
m_strUserInput = ""; |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
105 |
else
|
106 |
m_bUserInputCleanup = true; |
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
107 |
|
108 |
m_bHideInputChars = true; |
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
109 |
Close(); |
3160
by jmarshallnz
- 06-05-2005 changed: OnAction() now returns a bool. It should be true if the action has been dealt with and |
110 |
return true; |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
111 |
}
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
112 |
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
113 |
// correct password entered
|
114 |
m_bConfirmed = true; |
|
115 |
m_iRetries = 0; |
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
116 |
m_strUserInput = ""; |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
117 |
m_bHideInputChars = true; |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
118 |
Close(); |
3160
by jmarshallnz
- 06-05-2005 changed: OnAction() now returns a bool. It should be true if the action has been dealt with and |
119 |
return true; |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
120 |
}
|
121 |
else if (action.wID >= REMOTE_0 && action.wID <= REMOTE_9) |
|
3160
by jmarshallnz
- 06-05-2005 changed: OnAction() now returns a bool. It should be true if the action has been dealt with and |
122 |
{
|
123 |
return true; // unhandled |
|
124 |
}
|
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
125 |
else
|
126 |
{
|
|
3160
by jmarshallnz
- 06-05-2005 changed: OnAction() now returns a bool. It should be true if the action has been dealt with and |
127 |
return CGUIDialog::OnAction(action); |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
128 |
}
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
129 |
}
|
130 |
||
131 |
bool CGUIDialogGamepad::OnMessage(CGUIMessage& message) |
|
132 |
{
|
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
133 |
switch ( message.GetMessage() ) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
134 |
{
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
135 |
case GUI_MSG_WINDOW_INIT: |
136 |
{
|
|
137 |
m_bConfirmed = false; |
|
138 |
m_bCanceled = false; |
|
139 |
m_cHideInputChar = g_localizeStrings.Get(12322).c_str()[0]; |
|
140 |
CGUIDialog::OnMessage(message); |
|
141 |
return true; |
|
142 |
}
|
|
143 |
break; |
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
144 |
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
145 |
case GUI_MSG_CLICKED: |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
146 |
{
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
147 |
m_bConfirmed = false; |
148 |
m_bCanceled = false; |
|
149 |
}
|
|
150 |
break; |
|
151 |
}
|
|
3746
by jmarshallnz
- 26-07-2005 changed: Skin files are loaded on demand rather than on boot. |
152 |
return CGUIDialogBoxBase::OnMessage(message); |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
153 |
}
|
154 |
||
155 |
// \brief Show gamepad keypad and replace aTextString with user input.
|
|
156 |
// \param aTextString String to preload into the keyboard accumulator. Overwritten with user input if return=true.
|
|
157 |
// \param dlgHeading String shown on dialog title. Converts to localized string if contains a positive integer.
|
|
158 |
// \param bHideUserInput Masks user input as asterisks if set as true. Currently not yet implemented.
|
|
159 |
// \return true if successful display and user input. false if unsucessful display, no user input, or canceled editing.
|
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
160 |
bool CGUIDialogGamepad::ShowAndGetInput(CStdString& aTextString, const CStdString &dlgHeading, bool bHideUserInput) |
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
161 |
{
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
162 |
// Prompt user for input
|
3596
by jmarshallnz
- 11-07-2005 changed: Cleanup of some of the dialog code. |
163 |
CStdString strUserInput = ""; |
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
164 |
if (ShowAndVerifyInput(strUserInput, dlgHeading, aTextString, "", "", true, bHideUserInput)) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
165 |
{
|
166 |
// user entry was blank
|
|
167 |
return false; |
|
168 |
}
|
|
169 |
||
3596
by jmarshallnz
- 11-07-2005 changed: Cleanup of some of the dialog code. |
170 |
if (strUserInput.IsEmpty()) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
171 |
// user canceled out
|
172 |
return false; |
|
173 |
||
174 |
||
175 |
// We should have a string to return
|
|
176 |
aTextString = strUserInput; |
|
177 |
return true; |
|
178 |
}
|
|
179 |
||
180 |
// \brief Show gamepad keypad twice to get and confirm a user-entered password string.
|
|
181 |
// \param strNewPassword String to preload into the keyboard accumulator. Overwritten with user input if return=true.
|
|
182 |
// \return true if successful display and user input entry/re-entry. false if unsucessful display, no user input, or canceled editing.
|
|
5032
by jmarshallnz
- 20-03-2006 fixed: Password entry would prompt twice for the password. Now only does so on XBMC passwords (lockcodes etc.) |
183 |
bool CGUIDialogGamepad::ShowAndVerifyNewPassword(CStdString& strNewPassword) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
184 |
{
|
185 |
// Prompt user for password input
|
|
3596
by jmarshallnz
- 11-07-2005 changed: Cleanup of some of the dialog code. |
186 |
CStdString strUserInput = ""; |
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
187 |
if (ShowAndVerifyInput(strUserInput, "12340", "12330", "12331", "", true, true)) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
188 |
{
|
189 |
// TODO: Show error to user saying the password entry was blank
|
|
7104
by darkdonno
changed: file cosmetics removed: trailing whitespace fixed: some TAB usage added: GPL Header |
190 |
CGUIDialogOK::ShowAndGetInput(12357, 12358, 0, 0); // Password is empty/blank |
191 |
return false; |
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
192 |
}
|
193 |
||
3596
by jmarshallnz
- 11-07-2005 changed: Cleanup of some of the dialog code. |
194 |
if (strUserInput.IsEmpty()) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
195 |
// user canceled out
|
196 |
return false; |
|
197 |
||
198 |
// Prompt again for password input, this time sending previous input as the password to verify
|
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
199 |
if (!ShowAndVerifyInput(strUserInput, "12341", "12330", "12331", "", false, true)) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
200 |
{
|
201 |
// TODO: Show error to user saying the password re-entry failed
|
|
7104
by darkdonno
changed: file cosmetics removed: trailing whitespace fixed: some TAB usage added: GPL Header |
202 |
CGUIDialogOK::ShowAndGetInput(12357, 12344, 0, 0); // Password do not match |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
203 |
return false; |
204 |
}
|
|
205 |
||
206 |
// password entry and re-entry succeeded
|
|
207 |
strNewPassword = strUserInput; |
|
208 |
return true; |
|
209 |
}
|
|
210 |
||
211 |
// \brief Show gamepad keypad and verify user input against strPassword.
|
|
212 |
// \param strPassword Value to compare against user input.
|
|
213 |
// \param dlgHeading String shown on dialog title. Converts to localized string if contains a positive integer.
|
|
3596
by jmarshallnz
- 11-07-2005 changed: Cleanup of some of the dialog code. |
214 |
// \param iRetries If greater than 0, shows "Incorrect password, %d retries left" on dialog line 2, else line 2 is blank.
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
215 |
// \return 0 if successful display and user input. 1 if unsucessful input. -1 if no user input or canceled editing.
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
216 |
int CGUIDialogGamepad::ShowAndVerifyPassword(CStdString& strPassword, const CStdString& dlgHeading, int iRetries) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
217 |
{
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
218 |
CStdString strLine2 = ""; |
3596
by jmarshallnz
- 11-07-2005 changed: Cleanup of some of the dialog code. |
219 |
if (0 < iRetries) |
220 |
{
|
|
221 |
// Show a string telling user they have iRetries retries left
|
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
222 |
strLine2.Format("%s %i %s", g_localizeStrings.Get(12342).c_str(), iRetries, g_localizeStrings.Get(12343).c_str()); |
3596
by jmarshallnz
- 11-07-2005 changed: Cleanup of some of the dialog code. |
223 |
}
|
224 |
||
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
225 |
// make a copy of strPassword to prevent from overwriting it later
|
3596
by jmarshallnz
- 11-07-2005 changed: Cleanup of some of the dialog code. |
226 |
CStdString strPassTemp = strPassword; |
227 |
if (ShowAndVerifyInput(strPassTemp, dlgHeading, g_localizeStrings.Get(12330), g_localizeStrings.Get(12331), strLine2, true, true)) |
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
228 |
{
|
229 |
// user entered correct password
|
|
230 |
return 0; |
|
231 |
}
|
|
232 |
||
3596
by jmarshallnz
- 11-07-2005 changed: Cleanup of some of the dialog code. |
233 |
if (strPassTemp.IsEmpty()) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
234 |
// user canceled out
|
235 |
return -1; |
|
236 |
||
237 |
// user must have entered an incorrect password
|
|
238 |
return 1; |
|
239 |
}
|
|
240 |
||
241 |
// \brief Show gamepad keypad and verify user input against strToVerify.
|
|
242 |
// \param strToVerify Value to compare against user input.
|
|
243 |
// \param dlgHeading String shown on dialog title. Converts to localized string if contains a positive integer.
|
|
244 |
// \param dlgLine0 String shown on dialog line 0. Converts to localized string if contains a positive integer.
|
|
245 |
// \param dlgLine1 String shown on dialog line 1. Converts to localized string if contains a positive integer.
|
|
246 |
// \param dlgLine2 String shown on dialog line 2. Converts to localized string if contains a positive integer.
|
|
247 |
// \param bGetUserInput If set as true and return=true, strToVerify is overwritten with user input string.
|
|
248 |
// \param bHideInputChars Masks user input as asterisks if set as true. Currently not yet implemented.
|
|
249 |
// \return true if successful display and user input. false if unsucessful display, no user input, or canceled editing.
|
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
250 |
bool CGUIDialogGamepad::ShowAndVerifyInput(CStdString& strToVerify, const CStdString& dlgHeading, |
251 |
const CStdString& dlgLine0, const CStdString& dlgLine1, |
|
252 |
const CStdString& dlgLine2, bool bGetUserInput, bool bHideInputChars) |
|
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
253 |
{
|
254 |
// Prompt user for password input
|
|
255 |
CGUIDialogGamepad *pDialog = (CGUIDialogGamepad *)m_gWindowManager.GetWindow(WINDOW_DIALOG_GAMEPAD); |
|
256 |
pDialog->m_strPassword = strToVerify; |
|
257 |
pDialog->m_bUserInputCleanup = !bGetUserInput; |
|
258 |
pDialog->m_bHideInputChars = bHideInputChars; |
|
259 |
||
260 |
// HACK: This won't work if the label specified is actually a positive numeric value, but that's very unlikely
|
|
5045
by jmarshallnz
- 22-03-2006 changed: Moved common string functions from CUtil to StringUtils and cleaned up unnecessary functions. |
261 |
if (!StringUtils::IsNaturalNumber(dlgHeading)) |
2531
by jmarshallnz
- 24-01-2005 fixed: Zoom mode in Combo renderer + glitches. Should be as good as (or surpass) the YUY2 Overlays method now. |
262 |
pDialog->SetHeading( dlgHeading ); |
263 |
else
|
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
264 |
pDialog->SetHeading( atoi(dlgHeading.c_str()) ); |
2531
by jmarshallnz
- 24-01-2005 fixed: Zoom mode in Combo renderer + glitches. Should be as good as (or surpass) the YUY2 Overlays method now. |
265 |
|
5045
by jmarshallnz
- 22-03-2006 changed: Moved common string functions from CUtil to StringUtils and cleaned up unnecessary functions. |
266 |
if (!StringUtils::IsNaturalNumber(dlgLine0)) |
2531
by jmarshallnz
- 24-01-2005 fixed: Zoom mode in Combo renderer + glitches. Should be as good as (or surpass) the YUY2 Overlays method now. |
267 |
pDialog->SetLine( 0, dlgLine0 ); |
268 |
else
|
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
269 |
pDialog->SetLine( 0, atoi(dlgLine0.c_str()) ); |
2531
by jmarshallnz
- 24-01-2005 fixed: Zoom mode in Combo renderer + glitches. Should be as good as (or surpass) the YUY2 Overlays method now. |
270 |
|
5045
by jmarshallnz
- 22-03-2006 changed: Moved common string functions from CUtil to StringUtils and cleaned up unnecessary functions. |
271 |
if (!StringUtils::IsNaturalNumber(dlgLine1)) |
2531
by jmarshallnz
- 24-01-2005 fixed: Zoom mode in Combo renderer + glitches. Should be as good as (or surpass) the YUY2 Overlays method now. |
272 |
pDialog->SetLine( 1, dlgLine1 ); |
273 |
else
|
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
274 |
pDialog->SetLine( 1, atoi(dlgLine1.c_str()) ); |
2531
by jmarshallnz
- 24-01-2005 fixed: Zoom mode in Combo renderer + glitches. Should be as good as (or surpass) the YUY2 Overlays method now. |
275 |
|
5045
by jmarshallnz
- 22-03-2006 changed: Moved common string functions from CUtil to StringUtils and cleaned up unnecessary functions. |
276 |
if (!StringUtils::IsNaturalNumber(dlgLine2)) |
2531
by jmarshallnz
- 24-01-2005 fixed: Zoom mode in Combo renderer + glitches. Should be as good as (or surpass) the YUY2 Overlays method now. |
277 |
pDialog->SetLine( 2, dlgLine2 ); |
278 |
else
|
|
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
279 |
pDialog->SetLine( 2, atoi(dlgLine2.c_str()) ); |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
280 |
|
8601
by vulkanr
merge with trunk. rev: 9636-10031. |
281 |
g_audioManager.Enable(false); // dont do sounds during pwd input |
5590
by jmarshallnz
- 25-05-2006 fixed: DoModal() and Show() on dialogs had to be called with the parent window, even though the information was never used. |
282 |
pDialog->DoModal(); |
8601
by vulkanr
merge with trunk. rev: 9636-10031. |
283 |
g_audioManager.Enable(true); |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
284 |
|
6007
by spiff_
fixed: bug when canceling input of gamepad lock code. |
285 |
if (bGetUserInput && !pDialog->IsCanceled()) |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
286 |
{
|
7395
by kreet
fixed: EEPROM, SystemInfo backend overhauled, MD5 routines unified |
287 |
MD5_CTX md5state; |
7407
by kreet
fixed: MD5 routines fixed, resulting in SMB being fixed. (thanks elupus!) |
288 |
unsigned char md5pword[16]; |
7454
by kreet
fixed: password dialog md5 sums are no longer compared using case-sensitive methods (password itself is still case-sensitive), xml md5 sums changed back to lowercase |
289 |
char md5pword2[33]; |
7395
by kreet
fixed: EEPROM, SystemInfo backend overhauled, MD5 routines unified |
290 |
MD5Init(&md5state); |
291 |
MD5Update(&md5state, (unsigned char *)pDialog->m_strUserInput.c_str(), (int)pDialog->m_strUserInput.size()); |
|
7407
by kreet
fixed: MD5 routines fixed, resulting in SMB being fixed. (thanks elupus!) |
292 |
MD5Final(md5pword, &md5state); |
293 |
XKGeneral::BytesToHexStr(md5pword,16,md5pword2); |
|
5695
by spiff_
changed: redid master lock. thanks to smokehead for skin work! |
294 |
strToVerify = md5pword2; |
7454
by kreet
fixed: password dialog md5 sums are no longer compared using case-sensitive methods (password itself is still case-sensitive), xml md5 sums changed back to lowercase |
295 |
strToVerify.ToLower(); |
4985
by jmarshallnz
- 14-03-2006 changed: All strings/labels are internally UTF-8 now. Will almost certainly require rescanning the databases if you use a non-Ascii charset. |
296 |
pDialog->m_strUserInput = ""; |
2504
by bobbin007
added: [ 1097753 ] Updated XBMC masterlock/share lock code (Thanks to slacker) |
297 |
}
|
298 |
||
299 |
if (!pDialog->IsConfirmed() || pDialog->IsCanceled()) |
|
300 |
{
|
|
301 |
// user canceled out or entered an incorrect password
|
|
302 |
return false; |
|
303 |
}
|
|
304 |
||
305 |
// user entered correct password
|
|
306 |
return true; |
|
307 |
}
|
|
308 |
||
309 |
bool CGUIDialogGamepad::IsCanceled() const |
|
310 |
{
|
|
2860
by jmarshallnz
Formatting for tabs -> 2 spaces |
311 |
return m_bCanceled; |
8035
by yuvalt
Initial port to Linux/SDL |
312 |
}
|
313 |