Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
2487476f
Commit
2487476f
authored
Mar 03, 2012
by
Max-Wilhelm Bruker
Browse files
added checkbox to disable password storage
parent
a27bc208
Changes
2
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_connect.cpp
View file @
2487476f
#include
<QSettings>
#include
<QLabel>
#include
<QPushButton>
#include
<QCheckBox>
#include
<QGridLayout>
#include
<QHBoxLayout>
#include
"dlg_connect.h"
...
...
@@ -27,6 +28,9 @@ DlgConnect::DlgConnect(QWidget *parent)
passwordEdit
=
new
QLineEdit
(
settings
.
value
(
"password"
).
toString
());
passwordLabel
->
setBuddy
(
passwordEdit
);
passwordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
savePasswordCheckBox
=
new
QCheckBox
(
tr
(
"&Save password"
));
savePasswordCheckBox
->
setChecked
(
settings
.
value
(
"save_password"
,
1
).
toInt
());
okButton
=
new
QPushButton
(
tr
(
"&OK"
));
okButton
->
setDefault
(
true
);
...
...
@@ -41,6 +45,7 @@ DlgConnect::DlgConnect(QWidget *parent)
grid
->
addWidget
(
playernameEdit
,
2
,
1
);
grid
->
addWidget
(
passwordLabel
,
3
,
0
);
grid
->
addWidget
(
passwordEdit
,
3
,
1
);
grid
->
addWidget
(
savePasswordCheckBox
,
4
,
0
,
1
,
2
);
QHBoxLayout
*
buttonLayout
=
new
QHBoxLayout
;
buttonLayout
->
addStretch
();
...
...
@@ -67,7 +72,8 @@ void DlgConnect::actOk()
settings
.
setValue
(
"hostname"
,
hostEdit
->
text
());
settings
.
setValue
(
"port"
,
portEdit
->
text
());
settings
.
setValue
(
"playername"
,
playernameEdit
->
text
());
settings
.
setValue
(
"password"
,
passwordEdit
->
text
());
settings
.
setValue
(
"password"
,
savePasswordCheckBox
->
isChecked
()
?
passwordEdit
->
text
()
:
QString
());
settings
.
setValue
(
"save_password"
,
savePasswordCheckBox
->
isChecked
()
?
1
:
0
);
settings
.
endGroup
();
accept
();
...
...
cockatrice/src/dlg_connect.h
View file @
2487476f
...
...
@@ -6,6 +6,7 @@
class
QLabel
;
class
QPushButton
;
class
QCheckBox
;
class
DlgConnect
:
public
QDialog
{
Q_OBJECT
...
...
@@ -20,6 +21,7 @@ private slots:
private:
QLabel
*
hostLabel
,
*
portLabel
,
*
playernameLabel
,
*
passwordLabel
;
QLineEdit
*
hostEdit
,
*
portEdit
,
*
playernameEdit
,
*
passwordEdit
;
QCheckBox
*
savePasswordCheckBox
;
QPushButton
*
okButton
,
*
cancelButton
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment