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
be9ac2e0
Commit
be9ac2e0
authored
Jun 19, 2009
by
Max-Wilhelm Bruker
Browse files
save/restore login information
parent
a246a8d5
Changes
3
Show whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_connect.cpp
View file @
be9ac2e0
...
@@ -4,20 +4,23 @@
...
@@ -4,20 +4,23 @@
DlgConnect
::
DlgConnect
(
QWidget
*
parent
)
DlgConnect
::
DlgConnect
(
QWidget
*
parent
)
:
QDialog
(
parent
)
:
QDialog
(
parent
)
{
{
QSettings
settings
;
settings
.
beginGroup
(
"server"
);
hostLabel
=
new
QLabel
(
tr
(
"&Host:"
));
hostLabel
=
new
QLabel
(
tr
(
"&Host:"
));
hostEdit
=
new
QLineEdit
(
"cockatrice.de"
);
hostEdit
=
new
QLineEdit
(
settings
.
value
(
"hostname"
,
"cockatrice.de"
)
.
toString
())
;
hostLabel
->
setBuddy
(
hostEdit
);
hostLabel
->
setBuddy
(
hostEdit
);
portLabel
=
new
QLabel
(
tr
(
"&Port:"
));
portLabel
=
new
QLabel
(
tr
(
"&Port:"
));
portEdit
=
new
QLineEdit
(
"4747"
);
portEdit
=
new
QLineEdit
(
settings
.
value
(
"port"
,
"4747"
).
toString
()
);
portLabel
->
setBuddy
(
portEdit
);
portLabel
->
setBuddy
(
portEdit
);
playernameLabel
=
new
QLabel
(
tr
(
"Player &name:"
));
playernameLabel
=
new
QLabel
(
tr
(
"Player &name:"
));
playernameEdit
=
new
QLineEdit
(
"Player"
);
playernameEdit
=
new
QLineEdit
(
settings
.
value
(
"playername"
,
"Player"
).
toString
()
);
playernameLabel
->
setBuddy
(
playernameEdit
);
playernameLabel
->
setBuddy
(
playernameEdit
);
passwordLabel
=
new
QLabel
(
tr
(
"P&assword:"
));
passwordLabel
=
new
QLabel
(
tr
(
"P&assword:"
));
passwordEdit
=
new
QLineEdit
;
passwordEdit
=
new
QLineEdit
(
settings
.
value
(
"password"
).
toString
())
;
passwordLabel
->
setBuddy
(
passwordEdit
);
passwordLabel
->
setBuddy
(
passwordEdit
);
passwordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
passwordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
...
@@ -48,26 +51,19 @@ DlgConnect::DlgConnect(QWidget *parent)
...
@@ -48,26 +51,19 @@ DlgConnect::DlgConnect(QWidget *parent)
setWindowTitle
(
tr
(
"Connect to server"
));
setWindowTitle
(
tr
(
"Connect to server"
));
setFixedHeight
(
sizeHint
().
height
());
setFixedHeight
(
sizeHint
().
height
());
connect
(
okButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
ac
cept
()));
connect
(
okButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
ac
tOk
()));
connect
(
cancelButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
reject
()));
connect
(
cancelButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
reject
()));
}
}
QString
DlgConnect
::
getHost
()
void
DlgConnect
::
actOk
()
{
{
return
hostEdit
->
text
()
;
QSettings
settings
;
}
settings
.
beginGroup
(
"server"
);
settings
.
setValue
(
"hostname"
,
hostEdit
->
text
());
int
DlgConnect
::
getPort
()
settings
.
setValue
(
"port"
,
portEdit
->
text
());
{
settings
.
setValue
(
"playername"
,
playernameEdit
->
text
());
r
et
urn
p
or
t
Edit
->
text
()
.
toInt
(
);
s
et
tings
.
setValue
(
"password"
,
passw
or
d
Edit
->
text
());
}
settings
.
endGroup
();
QString
DlgConnect
::
getPlayerName
()
accept
();
{
return
playernameEdit
->
text
();
}
QString
DlgConnect
::
getPassword
()
{
return
passwordEdit
->
text
();
}
}
cockatrice/src/dlg_connect.h
View file @
be9ac2e0
...
@@ -2,19 +2,21 @@
...
@@ -2,19 +2,21 @@
#define DLG_CONNECT_H
#define DLG_CONNECT_H
#include
<QDialog>
#include
<QDialog>
#include
<QLineEdit>
class
QLabel
;
class
QLabel
;
class
QLineEdit
;
class
QPushButton
;
class
QPushButton
;
class
DlgConnect
:
public
QDialog
{
class
DlgConnect
:
public
QDialog
{
Q_OBJECT
Q_OBJECT
public:
public:
DlgConnect
(
QWidget
*
parent
=
0
);
DlgConnect
(
QWidget
*
parent
=
0
);
QString
getHost
();
QString
getHost
()
const
{
return
hostEdit
->
text
();
}
int
getPort
();
int
getPort
()
const
{
return
portEdit
->
text
().
toInt
();
}
QString
getPlayerName
();
QString
getPlayerName
()
const
{
return
playernameEdit
->
text
();
}
QString
getPassword
();
QString
getPassword
()
const
{
return
passwordEdit
->
text
();
}
private
slots
:
void
actOk
();
private:
private:
QLabel
*
hostLabel
,
*
portLabel
,
*
playernameLabel
,
*
passwordLabel
;
QLabel
*
hostLabel
,
*
portLabel
,
*
playernameLabel
,
*
passwordLabel
;
QLineEdit
*
hostEdit
,
*
portEdit
,
*
playernameEdit
,
*
passwordEdit
;
QLineEdit
*
hostEdit
,
*
portEdit
,
*
playernameEdit
,
*
passwordEdit
;
...
...
cockatrice/src/main.cpp
View file @
be9ac2e0
...
@@ -43,6 +43,10 @@ int main(int argc, char *argv[])
...
@@ -43,6 +43,10 @@ int main(int argc, char *argv[])
app
.
addLibraryPath
(
"plugins"
);
app
.
addLibraryPath
(
"plugins"
);
QTextCodec
::
setCodecForCStrings
(
QTextCodec
::
codecForName
(
"UTF-8"
));
QTextCodec
::
setCodecForCStrings
(
QTextCodec
::
codecForName
(
"UTF-8"
));
QCoreApplication
::
setOrganizationName
(
"Cockatrice"
);
QCoreApplication
::
setOrganizationDomain
(
"cockatrice.de"
);
QCoreApplication
::
setApplicationName
(
"Cockatrice"
);
MainWindow
*
ui
=
new
MainWindow
;
MainWindow
*
ui
=
new
MainWindow
;
qDebug
(
"main(): MainWindow constructor finished"
);
qDebug
(
"main(): MainWindow constructor finished"
);
ui
->
show
();
ui
->
show
();
...
...
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