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
6bf421cc
Commit
6bf421cc
authored
Jul 07, 2015
by
Zach
Browse files
Merge pull request #1210 from ctrlaltca/profile_edit
Profile management
parents
2b484aa9
14bce93c
Changes
24
Hide whitespace changes
Inline
Side-by-side
cockatrice/CMakeLists.txt
View file @
6bf421cc
...
...
@@ -11,7 +11,10 @@ SET(cockatrice_SOURCES
src/dlg_filter_games.cpp
src/dlg_connect.cpp
src/dlg_create_token.cpp
src/dlg_edit_avatar.cpp
src/dlg_edit_password.cpp
src/dlg_edit_tokens.cpp
src/dlg_edit_user.cpp
src/dlg_register.cpp
src/abstractclient.cpp
src/remoteclient.cpp
...
...
cockatrice/src/dlg_edit_avatar.cpp
0 → 100644
View file @
6bf421cc
#include
<QBuffer>
#include
<QDebug>
#include
<QDialogButtonBox>
#include
<QDir>
#include
<QFileDialog>
#include
<QImageReader>
#include
<QLabel>
#include
<QPushButton>
#include
<QVBoxLayout>
#include
"dlg_edit_avatar.h"
DlgEditAvatar
::
DlgEditAvatar
(
QWidget
*
parent
)
:
QDialog
(
parent
)
{
imageLabel
=
new
QLabel
(
tr
(
"No image chosen."
));
imageLabel
->
setFixedSize
(
400
,
200
);
imageLabel
->
setAlignment
(
Qt
::
AlignHCenter
|
Qt
::
AlignVCenter
);
imageLabel
->
setStyleSheet
(
"border: 1px solid #000"
);
textLabel
=
new
QLabel
(
tr
(
"To change your avatar, choose a new image.
\n
To remove your current avatar, confirm without choosing a new image."
));
browseButton
=
new
QPushButton
(
tr
(
"Browse..."
));
connect
(
browseButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actBrowse
()));
QGridLayout
*
grid
=
new
QGridLayout
;
grid
->
addWidget
(
imageLabel
,
0
,
0
,
1
,
2
);
grid
->
addWidget
(
textLabel
,
1
,
0
);
grid
->
addWidget
(
browseButton
,
1
,
1
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
);
connect
(
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
actOk
()));
connect
(
buttonBox
,
SIGNAL
(
rejected
()),
this
,
SLOT
(
actCancel
()));
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
;
mainLayout
->
addLayout
(
grid
);
mainLayout
->
addWidget
(
buttonBox
);
setLayout
(
mainLayout
);
setWindowTitle
(
tr
(
"Change avatar"
));
setFixedHeight
(
sizeHint
().
height
());
setMinimumWidth
(
300
);
}
void
DlgEditAvatar
::
actOk
()
{
accept
();
}
void
DlgEditAvatar
::
actCancel
()
{
reject
();
}
void
DlgEditAvatar
::
actBrowse
()
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Open Image"
),
QDir
::
homePath
(),
tr
(
"Image Files (*.png *.jpg *.bmp)"
));
if
(
fileName
.
isEmpty
())
{
imageLabel
->
setText
(
tr
(
"No image chosen."
));
return
;
}
QImage
image
;
QImageReader
imgReader
;
imgReader
.
setDecideFormatFromContent
(
true
);
imgReader
.
setFileName
(
fileName
);
if
(
!
imgReader
.
read
(
&
image
))
{
qDebug
()
<<
"Avatar image loading failed for file:"
<<
fileName
;
imageLabel
->
setText
(
tr
(
"Invalid image chosen."
));
return
;
}
imageLabel
->
setPixmap
(
QPixmap
::
fromImage
(
image
).
scaled
(
400
,
200
,
Qt
::
KeepAspectRatio
,
Qt
::
SmoothTransformation
));
}
QByteArray
DlgEditAvatar
::
getImage
()
{
const
QPixmap
*
pix
=
imageLabel
->
pixmap
();
if
(
!
pix
||
pix
->
isNull
())
return
QByteArray
();
QImage
image
=
pix
->
toImage
();
if
(
image
.
isNull
())
return
QByteArray
();
QByteArray
ba
;
QBuffer
buffer
(
&
ba
);
buffer
.
open
(
QIODevice
::
WriteOnly
);
image
.
save
(
&
buffer
,
"JPG"
);
return
ba
;
}
cockatrice/src/dlg_edit_avatar.h
0 → 100644
View file @
6bf421cc
#ifndef DLG_EDITAVATAR_H
#define DLG_EDITAVATAR_H
#include
<QDialog>
#include
<QLineEdit>
#include
<QComboBox>
class
QLabel
;
class
QPushButton
;
class
QCheckBox
;
class
DlgEditAvatar
:
public
QDialog
{
Q_OBJECT
public:
DlgEditAvatar
(
QWidget
*
parent
=
0
);
QByteArray
getImage
();
private
slots
:
void
actOk
();
void
actCancel
();
void
actBrowse
();
private:
QLabel
*
textLabel
,
*
imageLabel
;
QPushButton
*
browseButton
;
};
#endif
cockatrice/src/dlg_edit_password.cpp
0 → 100644
View file @
6bf421cc
#include
<QDialogButtonBox>
#include
<QGridLayout>
#include
<QHBoxLayout>
#include
<QLabel>
#include
<QMessageBox>
#include
<QSettings>
#include
"dlg_edit_password.h"
DlgEditPassword
::
DlgEditPassword
(
QWidget
*
parent
)
:
QDialog
(
parent
)
{
QSettings
settings
;
settings
.
beginGroup
(
"server"
);
oldPasswordLabel
=
new
QLabel
(
tr
(
"Old password:"
));
oldPasswordEdit
=
new
QLineEdit
();
if
(
settings
.
value
(
"save_password"
,
1
).
toInt
())
oldPasswordEdit
->
setText
(
settings
.
value
(
"password"
).
toString
());
oldPasswordLabel
->
setBuddy
(
oldPasswordEdit
);
oldPasswordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
newPasswordLabel
=
new
QLabel
(
tr
(
"New password:"
));
newPasswordEdit
=
new
QLineEdit
();
newPasswordLabel
->
setBuddy
(
newPasswordLabel
);
newPasswordEdit
->
setEchoMode
(
QLineEdit
::
Password
);
newPasswordLabel2
=
new
QLabel
(
tr
(
"Confirm new password:"
));
newPasswordEdit2
=
new
QLineEdit
();
newPasswordLabel2
->
setBuddy
(
newPasswordLabel2
);
newPasswordEdit2
->
setEchoMode
(
QLineEdit
::
Password
);
QGridLayout
*
grid
=
new
QGridLayout
;
grid
->
addWidget
(
oldPasswordLabel
,
0
,
0
);
grid
->
addWidget
(
oldPasswordEdit
,
0
,
1
);
grid
->
addWidget
(
newPasswordLabel
,
1
,
0
);
grid
->
addWidget
(
newPasswordEdit
,
1
,
1
);
grid
->
addWidget
(
newPasswordLabel2
,
2
,
0
);
grid
->
addWidget
(
newPasswordEdit2
,
2
,
1
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
);
connect
(
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
actOk
()));
connect
(
buttonBox
,
SIGNAL
(
rejected
()),
this
,
SLOT
(
actCancel
()));
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
;
mainLayout
->
addLayout
(
grid
);
mainLayout
->
addWidget
(
buttonBox
);
setLayout
(
mainLayout
);
setWindowTitle
(
tr
(
"Change password"
));
setFixedHeight
(
sizeHint
().
height
());
setMinimumWidth
(
300
);
}
void
DlgEditPassword
::
actOk
()
{
if
(
newPasswordEdit
->
text
()
!=
newPasswordEdit2
->
text
())
{
QMessageBox
::
warning
(
this
,
tr
(
"Error"
),
tr
(
"The new passwords don't match."
));
return
;
}
QSettings
settings
;
settings
.
beginGroup
(
"server"
);
// always save the password so it will be picked up by the connect dialog
settings
.
setValue
(
"password"
,
newPasswordEdit
->
text
());
settings
.
endGroup
();
accept
();
}
void
DlgEditPassword
::
actCancel
()
{
reject
();
}
cockatrice/src/dlg_edit_password.h
0 → 100644
View file @
6bf421cc
#ifndef DLG_EDITPASSWORD_H
#define DLG_EDITPASSWORD_H
#include
<QDialog>
#include
<QLineEdit>
#include
<QComboBox>
class
QLabel
;
class
QPushButton
;
class
QCheckBox
;
class
DlgEditPassword
:
public
QDialog
{
Q_OBJECT
public:
DlgEditPassword
(
QWidget
*
parent
=
0
);
QString
getOldPassword
()
const
{
return
oldPasswordEdit
->
text
();
}
QString
getNewPassword
()
const
{
return
newPasswordEdit
->
text
();
}
private
slots
:
void
actOk
();
void
actCancel
();
private:
QLabel
*
oldPasswordLabel
,
*
newPasswordLabel
,
*
newPasswordLabel2
;
QLineEdit
*
oldPasswordEdit
,
*
newPasswordEdit
,
*
newPasswordEdit2
;
};
#endif
cockatrice/src/dlg_edit_user.cpp
0 → 100644
View file @
6bf421cc
#include
<QSettings>
#include
<QLabel>
#include
<QGridLayout>
#include
<QHBoxLayout>
#include
<QDialogButtonBox>
#include
<QDebug>
#include
"dlg_edit_user.h"
#include
"settingscache.h"
DlgEditUser
::
DlgEditUser
(
QWidget
*
parent
,
QString
email
,
int
gender
,
QString
country
,
QString
realName
)
:
QDialog
(
parent
)
{
emailLabel
=
new
QLabel
(
tr
(
"Email:"
));
emailEdit
=
new
QLineEdit
();
emailLabel
->
setBuddy
(
emailEdit
);
emailEdit
->
setText
(
email
);
genderLabel
=
new
QLabel
(
tr
(
"Gender:"
));
genderEdit
=
new
QComboBox
();
genderLabel
->
setBuddy
(
genderEdit
);
genderEdit
->
insertItem
(
0
,
QIcon
(
":/resources/genders/unknown.svg"
),
tr
(
"Neutral"
));
genderEdit
->
insertItem
(
1
,
QIcon
(
":/resources/genders/male.svg"
),
tr
(
"Masculine"
));
genderEdit
->
insertItem
(
2
,
QIcon
(
":/resources/genders/female.svg"
),
tr
(
"Feminine"
));
genderEdit
->
setCurrentIndex
(
gender
+
1
);
countryLabel
=
new
QLabel
(
tr
(
"Country:"
));
countryEdit
=
new
QComboBox
();
countryLabel
->
setBuddy
(
countryEdit
);
countryEdit
->
insertItem
(
0
,
tr
(
"Undefined"
));
countryEdit
->
setCurrentIndex
(
0
);
QStringList
countries
=
settingsCache
->
getCountries
();
int
i
=
1
;
foreach
(
QString
c
,
countries
)
{
countryEdit
->
addItem
(
QPixmap
(
":/resources/countries/"
+
c
+
".svg"
),
c
);
if
(
c
==
country
)
countryEdit
->
setCurrentIndex
(
i
);
++
i
;
}
realnameLabel
=
new
QLabel
(
tr
(
"Real name:"
));
realnameEdit
=
new
QLineEdit
();
realnameLabel
->
setBuddy
(
realnameEdit
);
realnameEdit
->
setText
(
realName
);
QGridLayout
*
grid
=
new
QGridLayout
;
grid
->
addWidget
(
emailLabel
,
0
,
0
);
grid
->
addWidget
(
emailEdit
,
0
,
1
);
grid
->
addWidget
(
genderLabel
,
1
,
0
);
grid
->
addWidget
(
genderEdit
,
1
,
1
);
grid
->
addWidget
(
countryLabel
,
2
,
0
);
grid
->
addWidget
(
countryEdit
,
2
,
1
);
grid
->
addWidget
(
realnameLabel
,
3
,
0
);
grid
->
addWidget
(
realnameEdit
,
3
,
1
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
);
connect
(
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
actOk
()));
connect
(
buttonBox
,
SIGNAL
(
rejected
()),
this
,
SLOT
(
actCancel
()));
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
;
mainLayout
->
addLayout
(
grid
);
mainLayout
->
addWidget
(
buttonBox
);
setLayout
(
mainLayout
);
setWindowTitle
(
tr
(
"Edit user profile"
));
setFixedHeight
(
sizeHint
().
height
());
setMinimumWidth
(
300
);
}
void
DlgEditUser
::
actOk
()
{
accept
();
}
void
DlgEditUser
::
actCancel
()
{
reject
();
}
cockatrice/src/dlg_edit_user.h
0 → 100644
View file @
6bf421cc
#ifndef DLG_EDITUSER_H
#define DLG_EDITUSER_H
#include
<QDialog>
#include
<QLineEdit>
#include
<QComboBox>
class
QLabel
;
class
QPushButton
;
class
QCheckBox
;
class
DlgEditUser
:
public
QDialog
{
Q_OBJECT
public:
DlgEditUser
(
QWidget
*
parent
=
0
,
QString
email
=
QString
(),
int
gender
=
-
1
,
QString
country
=
QString
(),
QString
realName
=
QString
());
QString
getEmail
()
const
{
return
emailEdit
->
text
();
}
int
getGender
()
const
{
return
genderEdit
->
currentIndex
()
-
1
;
}
QString
getCountry
()
const
{
return
genderEdit
->
currentIndex
()
==
0
?
""
:
countryEdit
->
currentText
();
}
QString
getRealName
()
const
{
return
realnameEdit
->
text
();
}
private
slots
:
void
actOk
();
void
actCancel
();
private:
QLabel
*
emailLabel
,
*
genderLabel
,
*
countryLabel
,
*
realnameLabel
;
QLineEdit
*
emailEdit
,
*
realnameEdit
;
QComboBox
*
genderEdit
,
*
countryEdit
;
};
#endif
cockatrice/src/dlg_register.cpp
View file @
6bf421cc
...
...
@@ -7,6 +7,7 @@
#include
<QDebug>
#include
"dlg_register.h"
#include
"settingscache.h"
#include
"pb/serverinfo_user.pb.h"
DlgRegister
::
DlgRegister
(
QWidget
*
parent
)
...
...
@@ -39,265 +40,21 @@ DlgRegister::DlgRegister(QWidget *parent)
genderLabel
=
new
QLabel
(
tr
(
"Gender:"
));
genderEdit
=
new
QComboBox
();
genderLabel
->
setBuddy
(
genderEdit
);
genderEdit
->
insertItem
(
0
,
QIcon
(
":/resources/genders/unknown.svg"
),
tr
(
"
Undefined
"
));
genderEdit
->
insertItem
(
1
,
QIcon
(
":/resources/genders/male.svg"
),
tr
(
"Ma
l
e"
));
genderEdit
->
insertItem
(
2
,
QIcon
(
":/resources/genders/female.svg"
),
tr
(
"Fem
al
e"
));
genderEdit
->
insertItem
(
0
,
QIcon
(
":/resources/genders/unknown.svg"
),
tr
(
"
Neutral
"
));
genderEdit
->
insertItem
(
1
,
QIcon
(
":/resources/genders/male.svg"
),
tr
(
"Ma
sculin
e"
));
genderEdit
->
insertItem
(
2
,
QIcon
(
":/resources/genders/female.svg"
),
tr
(
"Fem
inin
e"
));
genderEdit
->
setCurrentIndex
(
0
);
countryLabel
=
new
QLabel
(
tr
(
"Country:"
));
countryEdit
=
new
QComboBox
();
countryLabel
->
setBuddy
(
countryEdit
);
countryEdit
->
insertItem
(
0
,
tr
(
"Undefined"
));
countryEdit
->
addItem
(
QPixmap
(
":/resources/countries/ad.svg"
),
"ad"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ae.svg"
),
"ae"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/af.svg"
),
"af"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ag.svg"
),
"ag"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ai.svg"
),
"ai"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/al.svg"
),
"al"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/am.svg"
),
"am"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ao.svg"
),
"ao"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/aq.svg"
),
"aq"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ar.svg"
),
"ar"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/as.svg"
),
"as"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/at.svg"
),
"at"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/au.svg"
),
"au"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/aw.svg"
),
"aw"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ax.svg"
),
"ax"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/az.svg"
),
"az"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ba.svg"
),
"ba"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bb.svg"
),
"bb"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bd.svg"
),
"bd"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/be.svg"
),
"be"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bf.svg"
),
"bf"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bg.svg"
),
"bg"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bh.svg"
),
"bh"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bi.svg"
),
"bi"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bj.svg"
),
"bj"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bl.svg"
),
"bl"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bm.svg"
),
"bm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bn.svg"
),
"bn"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bo.svg"
),
"bo"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bq.svg"
),
"bq"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/br.svg"
),
"br"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bs.svg"
),
"bs"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bt.svg"
),
"bt"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bv.svg"
),
"bv"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bw.svg"
),
"bw"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/by.svg"
),
"by"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/bz.svg"
),
"bz"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ca.svg"
),
"ca"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cc.svg"
),
"cc"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cd.svg"
),
"cd"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cf.svg"
),
"cf"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cg.svg"
),
"cg"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ch.svg"
),
"ch"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ci.svg"
),
"ci"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ck.svg"
),
"ck"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cl.svg"
),
"cl"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cm.svg"
),
"cm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cn.svg"
),
"cn"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/co.svg"
),
"co"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cr.svg"
),
"cr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cu.svg"
),
"cu"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cv.svg"
),
"cv"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cw.svg"
),
"cw"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cx.svg"
),
"cx"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cy.svg"
),
"cy"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/cz.svg"
),
"cz"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/de.svg"
),
"de"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/dj.svg"
),
"dj"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/dk.svg"
),
"dk"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/dm.svg"
),
"dm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/do.svg"
),
"do"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/dz.svg"
),
"dz"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ec.svg"
),
"ec"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ee.svg"
),
"ee"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/eg.svg"
),
"eg"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/eh.svg"
),
"eh"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/er.svg"
),
"er"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/es.svg"
),
"es"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/et.svg"
),
"et"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/fi.svg"
),
"fi"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/fj.svg"
),
"fj"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/fk.svg"
),
"fk"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/fm.svg"
),
"fm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/fo.svg"
),
"fo"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/fr.svg"
),
"fr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ga.svg"
),
"ga"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gb.svg"
),
"gb"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gd.svg"
),
"gd"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ge.svg"
),
"ge"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gf.svg"
),
"gf"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gg.svg"
),
"gg"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gh.svg"
),
"gh"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gi.svg"
),
"gi"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gl.svg"
),
"gl"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gm.svg"
),
"gm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gn.svg"
),
"gn"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gp.svg"
),
"gp"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gq.svg"
),
"gq"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gr.svg"
),
"gr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gs.svg"
),
"gs"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gt.svg"
),
"gt"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gu.svg"
),
"gu"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gw.svg"
),
"gw"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/gy.svg"
),
"gy"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/hk.svg"
),
"hk"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/hm.svg"
),
"hm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/hn.svg"
),
"hn"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/hr.svg"
),
"hr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ht.svg"
),
"ht"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/hu.svg"
),
"hu"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/id.svg"
),
"id"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ie.svg"
),
"ie"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/il.svg"
),
"il"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/im.svg"
),
"im"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/in.svg"
),
"in"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/io.svg"
),
"io"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/iq.svg"
),
"iq"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ir.svg"
),
"ir"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/is.svg"
),
"is"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/it.svg"
),
"it"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/je.svg"
),
"je"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/jm.svg"
),
"jm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/jo.svg"
),
"jo"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/jp.svg"
),
"jp"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ke.svg"
),
"ke"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/kg.svg"
),
"kg"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/kh.svg"
),
"kh"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ki.svg"
),
"ki"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/km.svg"
),
"km"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/kn.svg"
),
"kn"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/kp.svg"
),
"kp"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/kr.svg"
),
"kr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/kw.svg"
),
"kw"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ky.svg"
),
"ky"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/kz.svg"
),
"kz"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/la.svg"
),
"la"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/lb.svg"
),
"lb"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/lc.svg"
),
"lc"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/li.svg"
),
"li"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/lk.svg"
),
"lk"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/lr.svg"
),
"lr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ls.svg"
),
"ls"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/lt.svg"
),
"lt"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/lu.svg"
),
"lu"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/lv.svg"
),
"lv"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ly.svg"
),
"ly"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ma.svg"
),
"ma"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mc.svg"
),
"mc"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/md.svg"
),
"md"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/me.svg"
),
"me"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mf.svg"
),
"mf"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mg.svg"
),
"mg"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mh.svg"
),
"mh"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mk.svg"
),
"mk"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ml.svg"
),
"ml"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mm.svg"
),
"mm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mn.svg"
),
"mn"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mo.svg"
),
"mo"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mp.svg"
),
"mp"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mq.svg"
),
"mq"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mr.svg"
),
"mr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ms.svg"
),
"ms"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mt.svg"
),
"mt"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mu.svg"
),
"mu"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mv.svg"
),
"mv"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mw.svg"
),
"mw"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mx.svg"
),
"mx"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/my.svg"
),
"my"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/mz.svg"
),
"mz"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/na.svg"
),
"na"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/nc.svg"
),
"nc"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ne.svg"
),
"ne"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/nf.svg"
),
"nf"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ng.svg"
),
"ng"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ni.svg"
),
"ni"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/nl.svg"
),
"nl"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/no.svg"
),
"no"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/np.svg"
),
"np"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/nr.svg"
),
"nr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/nu.svg"
),
"nu"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/nz.svg"
),
"nz"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/om.svg"
),
"om"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pa.svg"
),
"pa"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pe.svg"
),
"pe"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pf.svg"
),
"pf"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pg.svg"
),
"pg"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ph.svg"
),
"ph"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pk.svg"
),
"pk"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pl.svg"
),
"pl"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pm.svg"
),
"pm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pn.svg"
),
"pn"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pr.svg"
),
"pr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ps.svg"
),
"ps"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pt.svg"
),
"pt"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/pw.svg"
),
"pw"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/py.svg"
),
"py"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/qa.svg"
),
"qa"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/re.svg"
),
"re"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ro.svg"
),
"ro"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/rs.svg"
),
"rs"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ru.svg"
),
"ru"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/rw.svg"
),
"rw"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sa.svg"
),
"sa"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sb.svg"
),
"sb"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sc.svg"
),
"sc"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sd.svg"
),
"sd"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/se.svg"
),
"se"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sg.svg"
),
"sg"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sh.svg"
),
"sh"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/si.svg"
),
"si"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sj.svg"
),
"sj"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sk.svg"
),
"sk"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sl.svg"
),
"sl"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sm.svg"
),
"sm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sn.svg"
),
"sn"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/so.svg"
),
"so"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sr.svg"
),
"sr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ss.svg"
),
"ss"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/st.svg"
),
"st"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sv.svg"
),
"sv"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sx.svg"
),
"sx"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sy.svg"
),
"sy"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/sz.svg"
),
"sz"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tc.svg"
),
"tc"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/td.svg"
),
"td"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tf.svg"
),
"tf"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tg.svg"
),
"tg"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/th.svg"
),
"th"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tj.svg"
),
"tj"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tk.svg"
),
"tk"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tl.svg"
),
"tl"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tm.svg"
),
"tm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tn.svg"
),
"tn"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/to.svg"
),
"to"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tr.svg"
),
"tr"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tt.svg"
),
"tt"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tv.svg"
),
"tv"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tw.svg"
),
"tw"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/tz.svg"
),
"tz"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ua.svg"
),
"ua"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ug.svg"
),
"ug"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/um.svg"
),
"um"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/us.svg"
),
"us"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/uy.svg"
),
"uy"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/uz.svg"
),
"uz"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/va.svg"
),
"va"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/vc.svg"
),
"vc"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ve.svg"
),
"ve"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/vg.svg"
),
"vg"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/vi.svg"
),
"vi"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/vn.svg"
),
"vn"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/vu.svg"
),
"vu"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/wf.svg"
),
"wf"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ws.svg"
),
"ws"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/ye.svg"
),
"ye"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/yt.svg"
),
"yt"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/za.svg"
),
"za"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/zm.svg"
),
"zm"
);
countryEdit
->
addItem
(
QIcon
(
":/resources/countries/zw.svg"
),
"zw"
);
countryEdit
->
setCurrentIndex
(
0
);
QStringList
countries
=
settingsCache
->
getCountries
();
foreach
(
QString
c
,
countries
)
{
countryEdit
->
addItem
(
QPixmap
(
":/resources/countries/"
+
c
+
".svg"
),
c
);
}
realnameLabel
=
new
QLabel
(
tr
(
"Real name:"
));
realnameEdit
=
new
QLineEdit
();
...
...
cockatrice/src/playerlistwidget.cpp
View file @
6bf421cc
...
...
@@ -6,7 +6,6 @@
#include
"tab_supervisor.h"
#include
"tab_userlists.h"
#include
"userlist.h"
#include
"userinfobox.h"
#include
"user_context_menu.h"
#include
<QMouseEvent>
#include
<QAction>
...
...
cockatrice/src/settingscache.cpp
View file @
6bf421cc
...
...
@@ -386,3 +386,35 @@ void SettingsCache::setPixmapCacheSize(const int _pixmapCacheSize)
settings
->
setValue
(
"personal/pixmapCacheSize"
,
pixmapCacheSize
);
emit
pixmapCacheSizeChanged
(
pixmapCacheSize
);
}
QStringList
SettingsCache
::
getCountries
()
const
{
static
QStringList
countries
=
QStringList
()
<<
"ad"
<<
"ae"
<<
"af"
<<
"ag"
<<
"ai"
<<
"al"
<<
"am"
<<
"ao"
<<
"aq"
<<
"ar"
<<
"as"
<<
"at"
<<
"au"
<<
"aw"
<<
"ax"
<<
"az"
<<
"ba"
<<
"bb"
<<
"bd"
<<
"be"
<<
"bf"
<<
"bg"
<<
"bh"
<<
"bi"
<<
"bj"
<<
"bl"
<<
"bm"
<<
"bn"
<<
"bo"
<<
"bq"
<<
"br"
<<
"bs"
<<
"bt"
<<
"bv"
<<
"bw"
<<
"by"
<<
"bz"
<<
"ca"
<<
"cc"
<<
"cd"
<<
"cf"
<<
"cg"
<<
"ch"
<<
"ci"
<<
"ck"
<<
"cl"
<<
"cm"
<<
"cn"
<<
"co"
<<
"cr"
<<
"cu"
<<
"cv"
<<
"cw"
<<
"cx"
<<
"cy"
<<
"cz"
<<
"de"
<<
"dj"
<<
"dk"
<<
"dm"
<<
"do"
<<
"dz"
<<
"ec"
<<
"ee"
<<
"eg"
<<
"eh"
<<
"er"
<<
"es"
<<
"et"
<<
"fi"
<<
"fj"
<<
"fk"
<<
"fm"
<<
"fo"
<<
"fr"
<<
"ga"
<<
"gb"
<<
"gd"
<<
"ge"
<<
"gf"
<<
"gg"
<<
"gh"
<<
"gi"
<<
"gl"
<<
"gm"
<<
"gn"
<<
"gp"
<<
"gq"
<<
"gr"
<<
"gs"
<<
"gt"
<<
"gu"
<<
"gw"
<<
"gy"
<<
"hk"
<<
"hm"
<<
"hn"
<<
"hr"
<<
"ht"
<<
"hu"
<<
"id"
<<
"ie"
<<
"il"
<<
"im"
<<
"in"
<<
"io"
<<
"iq"
<<
"ir"
<<
"is"
<<
"it"
<<
"je"
<<
"jm"
<<
"jo"
<<
"jp"
<<
"ke"
<<
"kg"
<<
"kh"
<<
"ki"
<<
"km"
<<
"kn"
<<
"kp"
<<
"kr"
<<
"kw"
<<
"ky"
<<
"kz"
<<
"la"
<<
"lb"
<<
"lc"
<<
"li"
<<
"lk"
<<
"lr"
<<
"ls"
<<
"lt"
<<
"lu"
<<
"lv"
<<
"ly"
<<
"ma"
<<
"mc"
<<
"md"
<<
"me"
<<
"mf"
<<
"mg"
<<
"mh"
<<
"mk"
<<
"ml"
<<
"mm"
<<
"mn"
<<
"mo"
<<
"mp"
<<
"mq"
<<
"mr"
<<
"ms"
<<
"mt"
<<
"mu"
<<
"mv"
<<
"mw"
<<
"mx"
<<
"my"
<<
"mz"
<<
"na"
<<
"nc"
<<
"ne"
<<
"nf"
<<
"ng"
<<
"ni"
<<
"nl"
<<
"no"
<<
"np"
<<
"nr"
<<
"nu"
<<
"nz"
<<
"om"
<<
"pa"
<<
"pe"
<<
"pf"
<<
"pg"
<<
"ph"
<<
"pk"
<<
"pl"
<<
"pm"
<<
"pn"
<<
"pr"
<<
"ps"
<<
"pt"
<<
"pw"
<<
"py"
<<
"qa"
<<
"re"
<<
"ro"
<<
"rs"
<<
"ru"
<<
"rw"
<<
"sa"
<<
"sb"
<<
"sc"
<<
"sd"
<<
"se"
<<
"sg"
<<
"sh"
<<
"si"
<<
"sj"
<<
"sk"
<<
"sl"
<<
"sm"
<<
"sn"
<<
"so"
<<
"sr"
<<
"ss"
<<
"st"
<<
"sv"
<<
"sx"
<<
"sy"
<<
"sz"
<<
"tc"
<<
"td"
<<
"tf"
<<
"tg"
<<
"th"
<<
"tj"
<<
"tk"
<<
"tl"
<<
"tm"
<<
"tn"
<<
"to"
<<
"tr"
<<
"tt"
<<
"tv"
<<
"tw"
<<
"tz"
<<
"ua"
<<
"ug"
<<
"um"
<<
"us"
<<
"uy"
<<
"uz"
<<
"va"
<<
"vc"
<<
"ve"
<<
"vg"
<<
"vi"
<<
"vn"
<<
"vu"
<<
"wf"
<<
"ws"
<<
"ye"
<<
"yt"
<<
"za"
<<
"zm"
<<
"zw"
;
return
countries
;
}
\ No newline at end of file
cockatrice/src/settingscache.h
View file @
6bf421cc
...
...
@@ -2,6 +2,7 @@
#define SETTINGSCACHE_H
#include
<QObject>
#include
<QStringList>
// the falbacks are used for cards without a muid
#define PIC_URL_DEFAULT "http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!cardid!&type=card"
...
...
@@ -139,6 +140,7 @@ public:
bool
getLeftJustified
()
const
{
return
leftJustified
;
}
int
getMasterVolume
()
const
{
return
masterVolume
;
}
int
getCardInfoViewMode
()
const
{
return
cardInfoViewMode
;
}
QStringList
getCountries
()
const
;
public
slots
:
void
setMainWindowGeometry
(
const
QByteArray
&
_mainWindowGeometry
);
void
setLang
(
const
QString
&
_lang
);
...
...
cockatrice/src/tab_server.cpp
View file @
6bf421cc
...
...
@@ -12,7 +12,6 @@
#include
"tab_server.h"
#include
"abstractclient.h"
#include
"userlist.h"
#include
"userinfobox.h"
#include
<QDebug>
#include
"pending_command.h"
...
...
cockatrice/src/tab_userlists.cpp
View file @
6bf421cc
...
...
@@ -21,7 +21,7 @@ TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor, AbstractClient *_clien
allUsersList
=
new
UserList
(
_tabSupervisor
,
client
,
UserList
::
AllUsersList
);
buddyList
=
new
UserList
(
_tabSupervisor
,
client
,
UserList
::
BuddyList
);
ignoreList
=
new
UserList
(
_tabSupervisor
,
client
,
UserList
::
IgnoreList
);
userInfoBox
=
new
UserInfoBox
(
client
,
fals
e
);
userInfoBox
=
new
UserInfoBox
(
client
,
tru
e
);
userInfoBox
->
updateInfo
(
userInfo
);
connect
(
allUsersList
,
SIGNAL
(
openMessageDialog
(
const
QString
&
,
bool
)),
this
,
SIGNAL
(
openMessageDialog
(
const
QString
&
,
bool
)));
...
...
cockatrice/src/user_context_menu.cpp
View file @
6bf421cc
...
...
@@ -145,7 +145,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
QAction
*
actionClicked
=
menu
->
exec
(
pos
);
if
(
actionClicked
==
aDetails
)
{
UserInfoBox
*
infoWidget
=
new
UserInfoBox
(
client
,
tru
e
,
static_cast
<
QWidget
*>
(
parent
()),
Qt
::
Dialog
|
Qt
::
WindowTitleHint
|
Qt
::
CustomizeWindowHint
|
Qt
::
WindowCloseButtonHint
);
UserInfoBox
*
infoWidget
=
new
UserInfoBox
(
client
,
fals
e
,
static_cast
<
QWidget
*>
(
parent
()),
Qt
::
Dialog
|
Qt
::
WindowTitleHint
|
Qt
::
CustomizeWindowHint
|
Qt
::
WindowCloseButtonHint
);
infoWidget
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
infoWidget
->
updateInfo
(
userName
);
}
else
if
(
actionClicked
==
aChat
)
...
...
cockatrice/src/userinfobox.cpp
View file @
6bf421cc
#include
"userinfobox.h"
#include
"pixmapgenerator.h"
#include
"abstractclient.h"
#include
"dlg_edit_user.h"
#include
"dlg_edit_password.h"
#include
"dlg_edit_avatar.h"
#include
<QLabel>
#include
<QDateTime>
#include
<QGridLayout>
#include
<QHBoxLayout>
#include
<QMessageBox>
#include
"pending_command.h"
#include
"pb/session_commands.pb.h"
...
...
@@ -14,8 +19,8 @@ const qint64 SIXTY = 60;
const
qint64
HOURS_IN_A_DAY
=
24
;
const
qint64
DAYS_IN_A_YEAR
=
365
;
UserInfoBox
::
UserInfoBox
(
AbstractClient
*
_client
,
bool
_
fullInfo
,
QWidget
*
parent
,
Qt
::
WindowFlags
flags
)
:
QWidget
(
parent
,
flags
),
client
(
_client
),
fullInfo
(
_fullInfo
)
UserInfoBox
::
UserInfoBox
(
AbstractClient
*
_client
,
bool
_
editable
,
QWidget
*
parent
,
Qt
::
WindowFlags
flags
)
:
QWidget
(
parent
,
flags
),
client
(
_client
),
editable
(
_editable
)
{
QFont
nameFont
=
nameLabel
.
font
();
nameFont
.
setBold
(
true
);
...
...
@@ -41,6 +46,19 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _fullInfo, QWidget *paren
mainLayout
->
addWidget
(
&
accountAgeLebel1
,
6
,
0
,
1
,
1
);
mainLayout
->
addWidget
(
&
accountAgeLabel2
,
6
,
2
,
1
,
1
);
mainLayout
->
setColumnStretch
(
2
,
10
);
if
(
editable
)
{
QHBoxLayout
*
buttonsLayout
=
new
QHBoxLayout
;
buttonsLayout
->
addWidget
(
&
editButton
);
buttonsLayout
->
addWidget
(
&
passwordButton
);
buttonsLayout
->
addWidget
(
&
avatarButton
);
mainLayout
->
addLayout
(
buttonsLayout
,
7
,
0
,
1
,
3
);
connect
(
&
editButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actEdit
()));
connect
(
&
passwordButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actPassword
()));
connect
(
&
avatarButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actAvatar
()));
}
setWindowTitle
(
tr
(
"User information"
));
setLayout
(
mainLayout
);
...
...
@@ -54,6 +72,10 @@ void UserInfoBox::retranslateUi()
countryLabel1
.
setText
(
tr
(
"Location:"
));
userLevelLabel1
.
setText
(
tr
(
"User level:"
));
accountAgeLebel1
.
setText
(
tr
(
"Account Age:"
));
editButton
.
setText
(
tr
(
"Edit"
));
passwordButton
.
setText
(
tr
(
"Change password"
));
avatarButton
.
setText
(
tr
(
"Change avatar"
));
}
void
UserInfoBox
::
updateInfo
(
const
ServerInfo_User
&
user
)
...
...
@@ -140,3 +162,126 @@ void UserInfoBox::processResponse(const Response &r)
setFixedSize
(
sizeHint
());
show
();
}
void
UserInfoBox
::
actEdit
()
{
Command_GetUserInfo
cmd
;
PendingCommand
*
pend
=
client
->
prepareSessionCommand
(
cmd
);
connect
(
pend
,
SIGNAL
(
finished
(
Response
,
CommandContainer
,
QVariant
)),
this
,
SLOT
(
actEditInternal
(
const
Response
&
)));
client
->
sendCommand
(
pend
);
}
void
UserInfoBox
::
actEditInternal
(
const
Response
&
r
)
{
const
Response_GetUserInfo
&
response
=
r
.
GetExtension
(
Response_GetUserInfo
::
ext
);
const
ServerInfo_User
&
user
=
response
.
user_info
();
QString
email
=
QString
::
fromStdString
(
user
.
email
());
int
gender
=
user
.
gender
();
QString
country
=
QString
::
fromStdString
(
user
.
country
());
QString
realName
=
QString
::
fromStdString
(
user
.
real_name
());
DlgEditUser
dlg
(
this
,
email
,
gender
,
country
,
realName
);
if
(
!
dlg
.
exec
())
return
;
Command_AccountEdit
cmd
;
cmd
.
set_real_name
(
dlg
.
getRealName
().
toStdString
());
cmd
.
set_email
(
dlg
.
getEmail
().
toStdString
());
cmd
.
set_gender
((
ServerInfo_User_Gender
)
dlg
.
getGender
());
cmd
.
set_country
(
dlg
.
getCountry
().
toStdString
());
PendingCommand
*
pend
=
client
->
prepareSessionCommand
(
cmd
);
connect
(
pend
,
SIGNAL
(
finished
(
Response
,
CommandContainer
,
QVariant
)),
this
,
SLOT
(
processEditResponse
(
const
Response
&
)));
client
->
sendCommand
(
pend
);
}
void
UserInfoBox
::
actPassword
()
{
DlgEditPassword
dlg
(
this
);
if
(
!
dlg
.
exec
())
return
;
Command_AccountPassword
cmd
;
cmd
.
set_old_password
(
dlg
.
getOldPassword
().
toStdString
());
cmd
.
set_new_password
(
dlg
.
getNewPassword
().
toStdString
());
PendingCommand
*
pend
=
client
->
prepareSessionCommand
(
cmd
);
connect
(
pend
,
SIGNAL
(
finished
(
Response
,
CommandContainer
,
QVariant
)),
this
,
SLOT
(
processPasswordResponse
(
const
Response
&
)));
client
->
sendCommand
(
pend
);
}
void
UserInfoBox
::
actAvatar
()
{
DlgEditAvatar
dlg
(
this
);
if
(
!
dlg
.
exec
())
return
;
Command_AccountImage
cmd
;
cmd
.
set_image
(
dlg
.
getImage
().
data
(),
dlg
.
getImage
().
size
());
PendingCommand
*
pend
=
client
->
prepareSessionCommand
(
cmd
);
connect
(
pend
,
SIGNAL
(
finished
(
Response
,
CommandContainer
,
QVariant
)),
this
,
SLOT
(
processAvatarResponse
(
const
Response
&
)));
client
->
sendCommand
(
pend
);
}
void
UserInfoBox
::
processEditResponse
(
const
Response
&
r
)
{
switch
(
r
.
response_code
())
{
case
Response
::
RespOk
:
updateInfo
(
nameLabel
.
text
());
QMessageBox
::
information
(
this
,
tr
(
"Information"
),
tr
(
"User information updated."
));
break
;
case
Response
::
RespFunctionNotAllowed
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"This server does not permit you to update your user informations."
));
break
;
case
Response
::
RespInternalError
:
default:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"An error occured while trying to update your user informations."
));
break
;
}
}
void
UserInfoBox
::
processPasswordResponse
(
const
Response
&
r
)
{
switch
(
r
.
response_code
())
{
case
Response
::
RespOk
:
QMessageBox
::
information
(
this
,
tr
(
"Information"
),
tr
(
"Password changed."
));
break
;
case
Response
::
RespFunctionNotAllowed
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"This server does not permit you to change your password."
));
break
;
case
Response
::
RespPasswordTooShort
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"The new password is too short."
));
break
;
case
Response
::
RespWrongPassword
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"The old password is incorrect."
));
break
;
case
Response
::
RespInternalError
:
default:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"An error occured while trying to update your user informations."
));
break
;
}
}
void
UserInfoBox
::
processAvatarResponse
(
const
Response
&
r
)
{
switch
(
r
.
response_code
())
{
case
Response
::
RespOk
:
updateInfo
(
nameLabel
.
text
());
QMessageBox
::
information
(
this
,
tr
(
"Information"
),
tr
(
"Avatar updated."
));
break
;
case
Response
::
RespFunctionNotAllowed
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"This server does not permit you to update your avatar."
));
break
;
case
Response
::
RespInternalError
:
default:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"An error occured while trying to updater your avatar."
));
break
;
}
}
\ No newline at end of file
cockatrice/src/userinfobox.h
View file @
6bf421cc
...
...
@@ -3,8 +3,8 @@
#include
<QWidget>
#include
<QLabel>
#include
<QPushButton>
class
QLabel
;
class
ServerInfo_User
;
class
AbstractClient
;
class
Response
;
...
...
@@ -13,14 +13,24 @@ class UserInfoBox : public QWidget {
Q_OBJECT
private:
AbstractClient
*
client
;
bool
fullInfo
;
bool
editable
;
QLabel
avatarLabel
,
nameLabel
,
realNameLabel1
,
realNameLabel2
,
genderLabel1
,
genderLabel2
,
countryLabel1
,
countryLabel2
,
countryLabel3
,
userLevelLabel1
,
userLevelLabel2
,
userLevelLabel3
,
accountAgeLebel1
,
accountAgeLabel2
;
QPushButton
editButton
,
passwordButton
,
avatarButton
;
public:
UserInfoBox
(
AbstractClient
*
_client
,
bool
fullInfo
,
QWidget
*
parent
=
0
,
Qt
::
WindowFlags
flags
=
0
);
UserInfoBox
(
AbstractClient
*
_client
,
bool
editable
,
QWidget
*
parent
=
0
,
Qt
::
WindowFlags
flags
=
0
);
void
retranslateUi
();
private
slots
:
void
processResponse
(
const
Response
&
r
);
void
processEditResponse
(
const
Response
&
r
);
void
processPasswordResponse
(
const
Response
&
r
);
void
processAvatarResponse
(
const
Response
&
r
);
void
actEdit
();
void
actEditInternal
(
const
Response
&
r
);
void
actPassword
();
void
actAvatar
();
public
slots
:
void
updateInfo
(
const
ServerInfo_User
&
user
);
void
updateInfo
(
const
QString
&
userName
);
...
...
cockatrice/src/userlist.cpp
View file @
6bf421cc
...
...
@@ -3,7 +3,6 @@
#include
"tab_supervisor.h"
#include
"abstractclient.h"
#include
"pixmapgenerator.h"
#include
"userinfobox.h"
#include
"user_context_menu.h"
#include
"gameselector.h"
#include
<QHeaderView>
...
...
common/pb/serverinfo_user.proto
View file @
6bf421cc
...
...
@@ -22,4 +22,5 @@ message ServerInfo_User {
optional
sint32
server_id
=
9
[
default
=
-
1
];
optional
uint64
session_id
=
10
;
optional
uint64
accountage_secs
=
11
;
optional
string
email
=
12
;
}
common/pb/session_commands.proto
View file @
6bf421cc
...
...
@@ -20,6 +20,9 @@ message SessionCommand {
JOIN_ROOM
=
1015
;
REGISTER
=
1016
;
ACTIVATE
=
1017
;
ACCOUNT_EDIT
=
1018
;
ACCOUNT_IMAGE
=
1019
;
ACCOUNT_PASSWORD
=
1020
;
REPLAY_LIST
=
1100
;
REPLAY_DOWNLOAD
=
1101
;
REPLAY_MODIFY_MATCH
=
1102
;
...
...
@@ -110,11 +113,11 @@ message Command_Register {
required
string
password
=
2
;
// Email address of the client for user validation
optional
string
email
=
3
;
// Gender of the user
optional
ServerInfo_User.Gender
gender
=
4
;
// Country code of the user. 2 letter ISO format
optional
string
country
=
5
;
optional
string
real_name
=
6
;
// Gender of the user
optional
ServerInfo_User.Gender
gender
=
4
;
// Country code of the user. 2 letter ISO format
optional
string
country
=
5
;
optional
string
real_name
=
6
;
}
// User wants to activate an account
...
...
@@ -127,3 +130,28 @@ message Command_Activate {
// Activation token
required
string
token
=
2
;
}
message
Command_AccountEdit
{
extend
SessionCommand
{
optional
Command_AccountEdit
ext
=
1018
;
}
optional
string
real_name
=
1
;
optional
string
email
=
2
;
optional
ServerInfo_User.Gender
gender
=
3
;
optional
string
country
=
4
;
}
message
Command_AccountImage
{
extend
SessionCommand
{
optional
Command_AccountImage
ext
=
1019
;
}
optional
bytes
image
=
1
;
}
message
Command_AccountPassword
{
extend
SessionCommand
{
optional
Command_AccountPassword
ext
=
1020
;
}
optional
string
old_password
=
1
;
optional
string
new_password
=
2
;
}
\ No newline at end of file
common/server_database_interface.h
View file @
6bf421cc
...
...
@@ -44,6 +44,8 @@ public:
enum
LogMessage_TargetType
{
MessageTargetRoom
,
MessageTargetGame
,
MessageTargetChat
,
MessageTargetIslRoom
};
virtual
void
logMessage
(
const
int
/* senderId */
,
const
QString
&
/* senderName */
,
const
QString
&
/* senderIp */
,
const
QString
&
/* logMessage */
,
LogMessage_TargetType
/* targetType */
,
const
int
/* targetId */
,
const
QString
&
/* targetName */
)
{
};
bool
checkUserIsBanned
(
Server_ProtocolHandler
*
session
,
QString
&
banReason
,
int
&
banSecondsRemaining
);
virtual
bool
changeUserPassword
(
const
QString
&
/* user */
,
const
QString
&
/* oldPassword */
,
const
QString
&
/* newPassword */
)
{
return
true
;
};
virtual
QChar
getGenderChar
(
ServerInfo_User_Gender
const
&
/* gender */
)
{
return
QChar
(
'u'
);
};
};
#endif
Prev
1
2
Next
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