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
9f353401
Commit
9f353401
authored
Oct 03, 2009
by
Max-Wilhelm Bruker
Browse files
bugfix
parent
ebca3757
Changes
11
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/carddatabase.cpp
View file @
9f353401
...
...
@@ -222,6 +222,14 @@ void CardInfo::clearPixmapCache()
}
}
void
CardInfo
::
clearPixmapCacheMiss
()
{
if
(
!
pixmap
)
return
;
if
(
pixmap
->
isNull
())
clearPixmapCache
();
}
void
CardInfo
::
updatePixmapCache
()
{
qDebug
(
QString
(
"Updating pixmap cache for %1"
).
arg
(
name
).
toLatin1
());
...
...
@@ -456,6 +464,14 @@ void CardDatabase::updatePicDownload(int _picDownload)
picDownload
=
settings
.
value
(
"personal/picturedownload"
,
0
).
toInt
();
}
else
picDownload
=
_picDownload
;
if
(
picDownload
)
{
QHashIterator
<
QString
,
CardInfo
*>
cardIterator
(
cardHash
);
while
(
cardIterator
.
hasNext
())
{
CardInfo
*
c
=
cardIterator
.
next
().
value
();
c
->
clearPixmapCacheMiss
();
}
}
}
void
CardDatabase
::
updatePicsPath
(
const
QString
&
path
)
...
...
cockatrice/src/carddatabase.h
View file @
9f353401
...
...
@@ -83,6 +83,7 @@ public:
QPixmap
*
loadPixmap
();
QPixmap
*
getPixmap
(
QSize
size
);
void
clearPixmapCache
();
void
clearPixmapCacheMiss
();
void
updatePixmapCache
();
private
slots
:
void
picDownloadFinished
(
int
id
,
bool
error
);
...
...
cockatrice/src/client.cpp
View file @
9f353401
...
...
@@ -226,10 +226,20 @@ void Client::readLine()
ServerResponse
resp
;
if
(
values
[
0
]
==
"ok"
)
resp
=
RespOk
;
else
if
(
values
[
0
]
==
"name_not_found"
)
resp
=
RespNameNotFound
;
else
if
(
values
[
0
]
==
"login_needed"
)
resp
=
RespLoginNeeded
;
else
if
(
values
[
0
]
==
"syntax"
)
resp
=
RespSyntaxError
;
else
if
(
values
[
0
]
==
"context"
)
resp
=
RespContextError
;
else
if
(
values
[
0
]
==
"password"
)
resp
=
RespPassword
;
resp
=
RespPasswordWrong
;
else
if
(
values
[
0
]
==
"spectators_not_allowed"
)
resp
=
RespSpectatorsNotAllowed
;
else
resp
=
Resp
Err
;
resp
=
Resp
Invalid
;
pc
->
responseReceived
(
resp
);
}
else
if
(
prefix
==
"list_games"
)
{
if
(
values
.
size
()
!=
8
)
{
...
...
cockatrice/src/client.h
View file @
9f353401
...
...
@@ -20,8 +20,13 @@ enum ProtocolStatus { StatusDisconnected,
enum
ServerResponse
{
RespOk
,
RespPassword
,
RespErr
RespNameNotFound
,
RespLoginNeeded
,
RespSyntaxError
,
RespContextError
,
RespPasswordWrong
,
RespSpectatorsNotAllowed
,
RespInvalid
};
enum
ServerEventType
{
...
...
cockatrice/src/dlg_creategame.cpp
View file @
9f353401
...
...
@@ -72,7 +72,7 @@ void DlgCreateGame::checkResponse(ServerResponse response)
if
(
response
==
RespOk
)
accept
();
else
{
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"
XXX
"
));
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"
Server error.
"
));
return
;
}
}
cockatrice/src/gameselector.cpp
View file @
9f353401
...
...
@@ -51,22 +51,19 @@ void GameSelector::actCreate()
disableGameList
();
}
void
GameSelector
::
actRefresh
()
{
client
->
listGames
();
}
void
GameSelector
::
checkResponse
(
ServerResponse
response
)
{
createButton
->
setEnabled
(
true
);
joinButton
->
setEnabled
(
true
);
spectateButton
->
setEnabled
(
true
);
if
(
response
==
RespOk
)
disableGameList
();
else
{
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"XXX"
));
return
;
switch
(
response
)
{
case
RespOk
:
disableGameList
();
break
;
case
RespPasswordWrong
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"Wrong password."
));
break
;
case
RespSpectatorsNotAllowed
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"Spectators are not allowed in this game."
));
break
;
case
RespContextError
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"The game is already full."
));
break
;
case
RespNameNotFound
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"The game does not exist any more."
));
break
;
default:
;
}
}
...
...
@@ -77,7 +74,7 @@ void GameSelector::actJoin()
QModelIndex
ind
=
gameListView
->
currentIndex
();
if
(
!
ind
.
isValid
())
return
;
const
ServerGame
&
game
=
gameListModel
->
getGame
(
ind
.
row
());
const
ServerGame
&
game
=
gameListModel
->
getGame
(
ind
.
data
(
Qt
::
UserRole
).
toInt
());
QString
password
;
if
(
game
.
getHasPassword
())
{
bool
ok
;
...
...
cockatrice/src/gameselector.h
View file @
9f353401
...
...
@@ -20,7 +20,6 @@ public:
private
slots
:
void
showFullGamesChanged
(
int
state
);
void
actCreate
();
void
actRefresh
();
void
actJoin
();
void
checkResponse
(
ServerResponse
response
);
private:
...
...
cockatrice/src/gamesmodel.cpp
View file @
9f353401
...
...
@@ -8,7 +8,11 @@ GamesModel::~GamesModel()
QVariant
GamesModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
if
((
role
!=
Qt
::
DisplayRole
)
||
!
index
.
isValid
())
if
(
!
index
.
isValid
())
return
QVariant
();
if
(
role
==
Qt
::
UserRole
)
return
index
.
row
();
if
(
role
!=
Qt
::
DisplayRole
)
return
QVariant
();
if
((
index
.
row
()
>=
gameList
.
size
())
||
(
index
.
column
()
>=
columnCount
()))
return
QVariant
();
...
...
cockatrice/src/messagelogwidget.cpp
View file @
9f353401
...
...
@@ -35,7 +35,7 @@ void MessageLogWidget::logSocketError(const QString &errorString)
void
MessageLogWidget
::
logServerError
(
ServerResponse
response
)
{
switch
(
response
)
{
case
RespPassword
:
append
(
tr
(
"Invalid password."
));
break
;
case
RespPassword
Wrong
:
append
(
tr
(
"Invalid password."
));
break
;
default:
;
}
}
...
...
cockatrice/translations/cockatrice_de.ts
View file @
9f353401
...
...
@@ -304,12 +304,12 @@
<
translation
>
F12
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/counter.cpp
"
line
=
"
10
0
"
/>
<
location
filename
=
"
../src/counter.cpp
"
line
=
"
10
3
"
/>
<
source
>
Set
counter
<
/source
>
<
translation
>
Zähler
setzen
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/counter.cpp
"
line
=
"
10
0
"
/>
<
location
filename
=
"
../src/counter.cpp
"
line
=
"
10
3
"
/>
<
source
>
New
value
for
counter
&
apos
;
%
1
&
apos
;:
<
/source
>
<
translation
>
Neuer
Wert
für
den
Zähler
&
apos
;
%
1
&
apos
;:
<
/translation
>
<
/message
>
...
...
@@ -433,8 +433,12 @@
<
/message
>
<
message
>
<
location
filename
=
"
../src/dlg_creategame.cpp
"
line
=
"
75
"
/>
<
source
>
Server
error
.
<
/source
>
<
translation
>
Serverfehler
.
<
/translation
>
<
/message
>
<
message
>
<
source
>
XXX
<
/source
>
<
translation
>
XXX
<
/translation
>
<
translation
type
=
"
obsolete
"
>
XXX
<
/translation
>
<
/message
>
<
/context
>
<
context
>
...
...
@@ -770,42 +774,64 @@
<
context
>
<
name
>
GameSelector
<
/name
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
11
9
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
11
6
"
/>
<
source
>
C
&
amp
;
reate
<
/source
>
<
translation
>
Spiel
e
&
amp
;
rstellen
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
1
20
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
1
17
"
/>
<
source
>&
amp
;
Join
<
/source
>
<
translation
>&
amp
;
Teilnehmen
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
68
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
62
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
63
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
64
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
65
"
/>
<
source
>
Error
<
/source
>
<
translation
>
Fehler
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
68
"
/>
<
source
>
XXX
<
/source
>
<
translation
>
XXX
<
/translation
>
<
translation
type
=
"
obsolete
"
>
XXX
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
62
"
/>
<
source
>
Wrong
password
.
<
/source
>
<
translation
>
Falsches
Passwort
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
63
"
/>
<
source
>
Spectators
are
not
allowed
in
this
game
.
<
/source
>
<
translation
>
In
diesem
Spiel
sind
keine
Zuschauer
zugelassen
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
64
"
/>
<
source
>
The
game
is
already
full
.
<
/source
>
<
translation
>
Das
Spiel
ist
bereits
voll
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
65
"
/>
<
source
>
The
game
does
not
exist
any
more
.
<
/source
>
<
translation
>
Dieses
Spiel
gibt
es
nicht
mehr
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
8
4
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
8
1
"
/>
<
source
>
Join
game
<
/source
>
<
translation
>
Spiel
beitreten
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
8
4
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
8
1
"
/>
<
source
>
Password
:
<
/source
>
<
translation
>
Passwort
:
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
11
8
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
11
5
"
/>
<
source
>&
amp
;
Show
full
games
<
/source
>
<
translation
>&
amp
;
Volle
Spiele
anzeigen
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
1
2
1
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
11
8
"
/>
<
source
>
J
&
amp
;
oin
as
spectator
<
/source
>
<
translation
>&
amp
;
Zuschauen
<
/translation
>
<
/message
>
...
...
@@ -813,12 +839,12 @@
<
context
>
<
name
>
GamesModel
<
/name
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
0
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
4
"
/>
<
source
>
yes
<
/source
>
<
translation
>
ja
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
0
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
4
"
/>
<
source
>
no
<
/source
>
<
translation
>
nein
<
/translation
>
<
/message
>
...
...
@@ -827,32 +853,32 @@
<
translation
type
=
"
obsolete
"
>
Spiel
ID
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
3
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
7
"
/>
<
source
>
Creator
<
/source
>
<
translation
>
Ersteller
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
2
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
6
"
/>
<
source
>
Description
<
/source
>
<
translation
>
Beschreibung
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
2
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
6
"
/>
<
source
>
not
allowed
<
/source
>
<
translation
>
nicht
erlaubt
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
4
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
8
"
/>
<
source
>
Password
<
/source
>
<
translation
>
Passwort
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
5
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
9
"
/>
<
source
>
Players
<
/source
>
<
translation
>
Spieler
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
36
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
40
"
/>
<
source
>
Spectators
<
/source
>
<
translation
>
Zuschauer
<
/translation
>
<
/message
>
...
...
cockatrice/translations/cockatrice_en.ts
View file @
9f353401
...
...
@@ -269,12 +269,12 @@
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/counter.cpp
"
line
=
"
10
0
"
/>
<
location
filename
=
"
../src/counter.cpp
"
line
=
"
10
3
"
/>
<
source
>
Set
counter
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/counter.cpp
"
line
=
"
10
0
"
/>
<
location
filename
=
"
../src/counter.cpp
"
line
=
"
10
3
"
/>
<
source
>
New
value
for
counter
&
apos
;
%
1
&
apos
;:
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
...
...
@@ -398,7 +398,7 @@
<
/message
>
<
message
>
<
location
filename
=
"
../src/dlg_creategame.cpp
"
line
=
"
75
"
/>
<
source
>
XXX
<
/source
>
<
source
>
Server
error
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
...
...
@@ -564,42 +564,60 @@
<
context
>
<
name
>
GameSelector
<
/name
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
11
9
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
11
6
"
/>
<
source
>
C
&
amp
;
reate
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
1
20
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
1
17
"
/>
<
source
>&
amp
;
Join
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
68
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
62
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
63
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
64
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
65
"
/>
<
source
>
Error
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
6
8
"
/>
<
source
>
XXX
<
/source
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
6
2
"
/>
<
source
>
Wrong
password
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
84
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
63
"
/>
<
source
>
Spectators
are
not
allowed
in
this
game
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
64
"
/>
<
source
>
The
game
is
already
full
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
65
"
/>
<
source
>
The
game
does
not
exist
any
more
.
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
81
"
/>
<
source
>
Join
game
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
8
4
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
8
1
"
/>
<
source
>
Password
:
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
11
8
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
11
5
"
/>
<
source
>&
amp
;
Show
full
games
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
1
2
1
"
/>
<
location
filename
=
"
../src/gameselector.cpp
"
line
=
"
11
8
"
/>
<
source
>
J
&
amp
;
oin
as
spectator
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
...
...
@@ -607,42 +625,42 @@
<
context
>
<
name
>
GamesModel
<
/name
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
0
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
4
"
/>
<
source
>
yes
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
0
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
4
"
/>
<
source
>
no
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
3
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
7
"
/>
<
source
>
Creator
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
2
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
6
"
/>
<
source
>
Description
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
2
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
2
6
"
/>
<
source
>
not
allowed
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
4
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
8
"
/>
<
source
>
Password
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
5
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
3
9
"
/>
<
source
>
Players
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
36
"
/>
<
location
filename
=
"
../src/gamesmodel.cpp
"
line
=
"
40
"
/>
<
source
>
Spectators
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
...
...
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