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
f33d7908
Commit
f33d7908
authored
Aug 01, 2009
by
Max-Wilhelm Bruker
Browse files
small changes
parent
d6ec869c
Changes
7
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/carddatabase.cpp
View file @
f33d7908
...
@@ -54,8 +54,8 @@ void SetList::sortByKey()
...
@@ -54,8 +54,8 @@ void SetList::sortByKey()
qSort
(
begin
(),
end
(),
CompareFunctor
());
qSort
(
begin
(),
end
(),
CompareFunctor
());
}
}
CardInfo
::
CardInfo
(
CardDatabase
*
_db
,
const
QString
&
_name
,
const
QString
&
_manacost
,
const
QString
&
_cardtype
,
const
QString
&
_powtough
,
const
QString
&
_text
,
int
_tableRow
,
const
SetList
&
_sets
)
CardInfo
::
CardInfo
(
CardDatabase
*
_db
,
const
QString
&
_name
,
const
QString
&
_manacost
,
const
QString
&
_cardtype
,
const
QString
&
_powtough
,
const
QString
&
_text
,
const
QStringList
&
_colors
,
int
_tableRow
,
const
SetList
&
_sets
)
:
db
(
_db
),
name
(
_name
),
sets
(
_sets
),
manacost
(
_manacost
),
cardtype
(
_cardtype
),
powtough
(
_powtough
),
text
(
_text
),
tableRow
(
_tableRow
),
pixmap
(
NULL
)
:
db
(
_db
),
name
(
_name
),
sets
(
_sets
),
manacost
(
_manacost
),
cardtype
(
_cardtype
),
powtough
(
_powtough
),
text
(
_text
),
colors
(
_colors
),
tableRow
(
_tableRow
),
pixmap
(
NULL
)
{
{
for
(
int
i
=
0
;
i
<
sets
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
sets
.
size
();
i
++
)
sets
[
i
]
->
append
(
this
);
sets
[
i
]
->
append
(
this
);
...
@@ -184,6 +184,9 @@ QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
...
@@ -184,6 +184,9 @@ QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
SetList
sets
=
info
->
getSets
();
SetList
sets
=
info
->
getSets
();
for
(
int
i
=
0
;
i
<
sets
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
sets
.
size
();
i
++
)
xml
.
writeTextElement
(
"set"
,
sets
[
i
]
->
getShortName
());
xml
.
writeTextElement
(
"set"
,
sets
[
i
]
->
getShortName
());
QStringList
colors
=
info
->
getColors
();
for
(
int
i
=
0
;
i
<
colors
.
size
();
i
++
)
xml
.
writeTextElement
(
"color"
,
colors
[
i
]);
xml
.
writeTextElement
(
"manacost"
,
info
->
getManaCost
());
xml
.
writeTextElement
(
"manacost"
,
info
->
getManaCost
());
xml
.
writeTextElement
(
"type"
,
info
->
getCardType
());
xml
.
writeTextElement
(
"type"
,
info
->
getCardType
());
...
@@ -277,79 +280,6 @@ void CardDatabase::clearPixmapCache()
...
@@ -277,79 +280,6 @@ void CardDatabase::clearPixmapCache()
noCard
->
clearPixmapCache
();
noCard
->
clearPixmapCache
();
}
}
void
CardDatabase
::
importOracleFile
(
const
QString
&
fileName
,
CardSet
*
set
)
{
QFile
file
(
fileName
);
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
);
QTextStream
in
(
&
file
);
while
(
!
in
.
atEnd
())
{
QString
cardname
=
in
.
readLine
();
if
(
cardname
.
isEmpty
())
continue
;
QString
manacost
=
in
.
readLine
();
QString
cardtype
,
powtough
;
QStringList
text
;
if
(
manacost
.
contains
(
"Land"
,
Qt
::
CaseInsensitive
))
{
cardtype
=
manacost
;
manacost
.
clear
();
}
else
{
cardtype
=
in
.
readLine
();
powtough
=
in
.
readLine
();
// Dirty hack.
// Cards to test: Any creature, any basic land, Ancestral Vision, Fire // Ice.
if
(
!
powtough
.
contains
(
"/"
)
||
powtough
.
size
()
>
5
)
{
text
<<
powtough
;
powtough
=
QString
();
}
}
QString
line
=
in
.
readLine
();
while
(
!
line
.
isEmpty
())
{
text
<<
line
;
line
=
in
.
readLine
();
}
CardInfo
*
card
;
if
(
cardHash
.
contains
(
cardname
))
card
=
cardHash
.
value
(
cardname
);
else
{
card
=
new
CardInfo
(
this
,
cardname
,
manacost
,
cardtype
,
powtough
,
text
.
join
(
"
\n
"
));
int
tableRow
=
1
;
QString
mainCardType
=
card
->
getMainCardType
();
if
(
mainCardType
==
"Land"
)
tableRow
=
0
;
else
if
((
mainCardType
==
"Sorcery"
)
||
(
mainCardType
==
"Instant"
))
tableRow
=
2
;
else
if
(
mainCardType
==
"Creature"
)
tableRow
=
3
;
card
->
setTableRow
(
tableRow
);
cardHash
.
insert
(
cardname
,
card
);
}
card
->
addToSet
(
set
);
}
}
void
CardDatabase
::
importOracleDir
()
{
clear
();
QDir
dir
(
"../db"
);
dir
.
setSorting
(
QDir
::
Name
|
QDir
::
IgnoreCase
);
QFileInfoList
files
=
dir
.
entryInfoList
(
QStringList
()
<<
"*.txt"
);
for
(
int
k
=
0
;
k
<
files
.
size
();
k
++
)
{
QFileInfo
i
=
files
[
k
];
QString
shortName
=
i
.
fileName
().
left
(
i
.
fileName
().
indexOf
(
'_'
));
QString
longName
=
i
.
fileName
().
mid
(
i
.
fileName
().
indexOf
(
'_'
)
+
1
);
longName
=
longName
.
left
(
longName
.
indexOf
(
'.'
));
CardSet
*
set
=
new
CardSet
(
shortName
,
longName
);
setHash
.
insert
(
shortName
,
set
);
importOracleFile
(
i
.
filePath
(),
set
);
}
qDebug
(
QString
(
"CardDatabase: %1 cards imported"
).
arg
(
cardHash
.
size
()).
toLatin1
());
}
void
CardDatabase
::
loadSetsFromXml
(
QXmlStreamReader
&
xml
)
void
CardDatabase
::
loadSetsFromXml
(
QXmlStreamReader
&
xml
)
{
{
while
(
!
xml
.
atEnd
())
{
while
(
!
xml
.
atEnd
())
{
...
@@ -377,6 +307,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml)
...
@@ -377,6 +307,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml)
break
;
break
;
if
(
xml
.
name
()
==
"card"
)
{
if
(
xml
.
name
()
==
"card"
)
{
QString
name
,
manacost
,
type
,
pt
,
text
;
QString
name
,
manacost
,
type
,
pt
,
text
;
QStringList
colors
;
SetList
sets
;
SetList
sets
;
int
tableRow
=
0
;
int
tableRow
=
0
;
while
(
!
xml
.
atEnd
())
{
while
(
!
xml
.
atEnd
())
{
...
@@ -394,10 +325,12 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml)
...
@@ -394,10 +325,12 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml)
text
=
xml
.
readElementText
();
text
=
xml
.
readElementText
();
else
if
(
xml
.
name
()
==
"set"
)
else
if
(
xml
.
name
()
==
"set"
)
sets
<<
getSet
(
xml
.
readElementText
());
sets
<<
getSet
(
xml
.
readElementText
());
else
if
(
xml
.
name
()
==
"color"
)
colors
<<
xml
.
readElementText
();
else
if
(
xml
.
name
()
==
"tablerow"
)
else
if
(
xml
.
name
()
==
"tablerow"
)
tableRow
=
xml
.
readElementText
().
toInt
();
tableRow
=
xml
.
readElementText
().
toInt
();
}
}
cardHash
.
insert
(
name
,
new
CardInfo
(
this
,
name
,
manacost
,
type
,
pt
,
text
,
tableRow
,
sets
));
cardHash
.
insert
(
name
,
new
CardInfo
(
this
,
name
,
manacost
,
type
,
pt
,
text
,
colors
,
tableRow
,
sets
));
}
}
}
}
}
}
...
...
cockatrice/src/carddatabase.h
View file @
f33d7908
...
@@ -41,6 +41,7 @@ private:
...
@@ -41,6 +41,7 @@ private:
QString
cardtype
;
QString
cardtype
;
QString
powtough
;
QString
powtough
;
QString
text
;
QString
text
;
QStringList
colors
;
int
tableRow
;
int
tableRow
;
QPixmap
*
pixmap
;
QPixmap
*
pixmap
;
QMap
<
int
,
QPixmap
*>
scaledPixmapCache
;
QMap
<
int
,
QPixmap
*>
scaledPixmapCache
;
...
@@ -51,6 +52,7 @@ public:
...
@@ -51,6 +52,7 @@ public:
const
QString
&
_cardtype
=
QString
(),
const
QString
&
_cardtype
=
QString
(),
const
QString
&
_powtough
=
QString
(),
const
QString
&
_powtough
=
QString
(),
const
QString
&
_text
=
QString
(),
const
QString
&
_text
=
QString
(),
const
QStringList
&
_colors
=
QStringList
(),
int
_tableRow
=
0
,
int
_tableRow
=
0
,
const
SetList
&
_sets
=
SetList
());
const
SetList
&
_sets
=
SetList
());
~
CardInfo
();
~
CardInfo
();
...
@@ -60,6 +62,7 @@ public:
...
@@ -60,6 +62,7 @@ public:
QString
getCardType
()
const
{
return
cardtype
;
}
QString
getCardType
()
const
{
return
cardtype
;
}
QString
getPowTough
()
const
{
return
powtough
;
}
QString
getPowTough
()
const
{
return
powtough
;
}
QString
getText
()
const
{
return
text
;
}
QString
getText
()
const
{
return
text
;
}
QStringList
getColors
()
const
{
return
colors
;
}
QString
getMainCardType
()
const
;
QString
getMainCardType
()
const
;
int
getTableRow
()
const
{
return
tableRow
;
}
int
getTableRow
()
const
{
return
tableRow
;
}
void
setTableRow
(
int
_tableRow
)
{
tableRow
=
_tableRow
;
}
void
setTableRow
(
int
_tableRow
)
{
tableRow
=
_tableRow
;
}
...
@@ -72,12 +75,12 @@ public:
...
@@ -72,12 +75,12 @@ public:
class
CardDatabase
:
public
QObject
{
class
CardDatabase
:
public
QObject
{
Q_OBJECT
Q_OBJECT
pr
ivate
:
pr
otected
:
QHash
<
QString
,
CardInfo
*>
cardHash
;
QHash
<
QString
,
CardInfo
*>
cardHash
;
QHash
<
QString
,
CardSet
*>
setHash
;
QHash
<
QString
,
CardSet
*>
setHash
;
CardInfo
*
noCard
;
CardInfo
*
noCard
;
QString
picsPath
,
cardDatabasePath
;
QString
picsPath
,
cardDatabasePath
;
private:
void
loadCardsFromXml
(
QXmlStreamReader
&
xml
);
void
loadCardsFromXml
(
QXmlStreamReader
&
xml
);
void
loadSetsFromXml
(
QXmlStreamReader
&
xml
);
void
loadSetsFromXml
(
QXmlStreamReader
&
xml
);
public:
public:
...
@@ -89,8 +92,6 @@ public:
...
@@ -89,8 +92,6 @@ public:
QList
<
CardInfo
*>
getCardList
()
const
{
return
cardHash
.
values
();
}
QList
<
CardInfo
*>
getCardList
()
const
{
return
cardHash
.
values
();
}
SetList
getSetList
()
const
;
SetList
getSetList
()
const
;
void
clearPixmapCache
();
void
clearPixmapCache
();
void
importOracleFile
(
const
QString
&
fileName
,
CardSet
*
set
);
void
importOracleDir
();
int
loadFromFile
(
const
QString
&
fileName
);
int
loadFromFile
(
const
QString
&
fileName
);
bool
saveToFile
(
const
QString
&
fileName
);
bool
saveToFile
(
const
QString
&
fileName
);
const
QString
&
getPicsPath
()
const
{
return
picsPath
;
}
const
QString
&
getPicsPath
()
const
{
return
picsPath
;
}
...
...
cockatrice/src/decklist.cpp
View file @
f33d7908
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include
<QXmlStreamWriter>
#include
<QXmlStreamWriter>
#include
<QProgressDialog>
#include
<QProgressDialog>
#include
<QVariant>
#include
<QVariant>
#include
<QSettings>
#include
"decklist.h"
#include
"decklist.h"
#include
"carddatabase.h"
#include
"carddatabase.h"
...
@@ -313,6 +314,8 @@ bool DeckList::saveToFile(const QString &fileName, FileFormat fmt)
...
@@ -313,6 +314,8 @@ bool DeckList::saveToFile(const QString &fileName, FileFormat fmt)
bool
DeckList
::
loadDialog
(
QWidget
*
parent
)
bool
DeckList
::
loadDialog
(
QWidget
*
parent
)
{
{
QFileDialog
dialog
(
parent
,
tr
(
"Load deck"
));
QFileDialog
dialog
(
parent
,
tr
(
"Load deck"
));
QSettings
settings
;
dialog
.
setDirectory
(
settings
.
value
(
"paths/decks"
).
toString
());
dialog
.
setNameFilters
(
fileNameFilters
);
dialog
.
setNameFilters
(
fileNameFilters
);
if
(
!
dialog
.
exec
())
if
(
!
dialog
.
exec
())
return
false
;
return
false
;
...
@@ -336,6 +339,8 @@ bool DeckList::loadDialog(QWidget *parent)
...
@@ -336,6 +339,8 @@ bool DeckList::loadDialog(QWidget *parent)
bool
DeckList
::
saveDialog
(
QWidget
*
parent
)
bool
DeckList
::
saveDialog
(
QWidget
*
parent
)
{
{
QFileDialog
dialog
(
parent
,
tr
(
"Save deck"
));
QFileDialog
dialog
(
parent
,
tr
(
"Save deck"
));
QSettings
settings
;
dialog
.
setDirectory
(
settings
.
value
(
"paths/decks"
).
toString
());
dialog
.
setAcceptMode
(
QFileDialog
::
AcceptSave
);
dialog
.
setAcceptMode
(
QFileDialog
::
AcceptSave
);
dialog
.
setConfirmOverwrite
(
true
);
dialog
.
setConfirmOverwrite
(
true
);
dialog
.
setDefaultSuffix
(
"cod"
);
dialog
.
setDefaultSuffix
(
"cod"
);
...
...
cockatrice/src/main.cpp
View file @
f33d7908
...
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
...
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
QCoreApplication
::
setOrganizationDomain
(
"cockatrice.de"
);
QCoreApplication
::
setOrganizationDomain
(
"cockatrice.de"
);
QCoreApplication
::
setApplicationName
(
"Cockatrice"
);
QCoreApplication
::
setApplicationName
(
"Cockatrice"
);
QString
localeName
=
QLocale
::
system
().
name
();
QString
localeName
;
//
= QLocale::system().name();
QTranslator
qtTranslator
;
QTranslator
qtTranslator
;
qtTranslator
.
load
(
"qt_"
+
localeName
,
QLibraryInfo
::
location
(
QLibraryInfo
::
TranslationsPath
));
qtTranslator
.
load
(
"qt_"
+
localeName
,
QLibraryInfo
::
location
(
QLibraryInfo
::
TranslationsPath
));
app
.
installTranslator
(
&
qtTranslator
);
app
.
installTranslator
(
&
qtTranslator
);
...
...
cockatrice/src/messagelogwidget.cpp
View file @
f33d7908
...
@@ -4,132 +4,132 @@
...
@@ -4,132 +4,132 @@
void
MessageLogWidget
::
logConnecting
(
QString
hostname
)
void
MessageLogWidget
::
logConnecting
(
QString
hostname
)
{
{
append
(
tr
(
"Connecting to %1..."
).
arg
(
hostname
));
append
PlainText
(
tr
(
"Connecting to %1..."
).
arg
(
hostname
));
}
}
void
MessageLogWidget
::
logConnected
(
const
QStringList
WelcomeMsg
)
void
MessageLogWidget
::
logConnected
(
const
QStringList
WelcomeMsg
)
{
{
append
(
tr
(
"Connected."
));
append
PlainText
(
tr
(
"Connected."
));
QStringListIterator
i
(
WelcomeMsg
);
QStringListIterator
i
(
WelcomeMsg
);
while
(
i
.
hasNext
())
while
(
i
.
hasNext
())
append
(
i
.
next
());
append
PlainText
(
i
.
next
());
}
}
void
MessageLogWidget
::
logDisconnected
()
void
MessageLogWidget
::
logDisconnected
()
{
{
append
(
tr
(
"Disconnected from server."
));
append
PlainText
(
tr
(
"Disconnected from server."
));
}
}
void
MessageLogWidget
::
logSocketError
(
const
QString
&
errorString
)
void
MessageLogWidget
::
logSocketError
(
const
QString
&
errorString
)
{
{
append
(
errorString
);
append
PlainText
(
errorString
);
}
}
void
MessageLogWidget
::
logServerError
(
ServerResponse
response
)
void
MessageLogWidget
::
logServerError
(
ServerResponse
response
)
{
{
switch
(
response
)
{
switch
(
response
)
{
case
RespPassword
:
append
(
tr
(
"Invalid password."
));
break
;
case
RespPassword
:
append
PlainText
(
tr
(
"Invalid password."
));
break
;
default:
;
default:
;
}
}
}
}
void
MessageLogWidget
::
logPlayerListReceived
(
QStringList
players
)
void
MessageLogWidget
::
logPlayerListReceived
(
QStringList
players
)
{
{
append
(
"---"
);
append
PlainText
(
"---"
);
append
(
tr
(
"You have joined the game. Player list:"
));
append
PlainText
(
tr
(
"You have joined the game. Player list:"
));
for
(
int
i
=
0
;
i
<
players
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
players
.
size
();
i
++
)
append
(
players
.
at
(
i
));
append
PlainText
(
players
.
at
(
i
));
append
(
"---"
);
append
PlainText
(
"---"
);
}
}
void
MessageLogWidget
::
logJoin
(
QString
playerName
)
void
MessageLogWidget
::
logJoin
(
QString
playerName
)
{
{
append
(
tr
(
"%1 has joined the game"
).
arg
(
playerName
));
append
PlainText
(
tr
(
"%1 has joined the game"
).
arg
(
playerName
));
}
}
void
MessageLogWidget
::
logLeave
(
QString
playerName
)
void
MessageLogWidget
::
logLeave
(
QString
playerName
)
{
{
append
(
tr
(
"%1 has left the game"
).
arg
(
playerName
));
append
PlainText
(
tr
(
"%1 has left the game"
).
arg
(
playerName
));
}
}
void
MessageLogWidget
::
logReadyStart
(
QString
playerName
)
void
MessageLogWidget
::
logReadyStart
(
QString
playerName
)
{
{
append
(
tr
(
"%1 is ready to start a new game."
).
arg
(
playerName
));
append
PlainText
(
tr
(
"%1 is ready to start a new game."
).
arg
(
playerName
));
}
}
void
MessageLogWidget
::
logGameStart
()
void
MessageLogWidget
::
logGameStart
()
{
{
append
(
tr
(
"Game has started."
));
append
PlainText
(
tr
(
"Game has started."
));
}
}
void
MessageLogWidget
::
logSay
(
QString
playerName
,
QString
message
)
void
MessageLogWidget
::
logSay
(
QString
playerName
,
QString
message
)
{
{
append
(
QString
(
"<font color=
\"
red
\"
>%1:</font> %2"
).
arg
(
playerName
).
arg
(
message
));
append
Html
(
QString
(
"<font color=
\"
red
\"
>%1:</font> %2"
).
arg
(
playerName
).
arg
(
message
));
}
}
void
MessageLogWidget
::
logShuffle
(
QString
playerName
)
void
MessageLogWidget
::
logShuffle
(
QString
playerName
)
{
{
append
(
tr
(
"%1 shuffles his/her library"
).
arg
(
playerName
));
append
PlainText
(
tr
(
"%1 shuffles his/her library"
).
arg
(
playerName
));
}
}
void
MessageLogWidget
::
logRollDice
(
QString
playerName
,
int
sides
,
int
roll
)
void
MessageLogWidget
::
logRollDice
(
QString
playerName
,
int
sides
,
int
roll
)
{
{
append
(
tr
(
"%1 rolled a %2 with a %3-sided dice"
).
arg
(
playerName
).
arg
(
roll
).
arg
(
sides
));
append
PlainText
(
tr
(
"%1 rolled a %2 with a %3-sided dice"
).
arg
(
playerName
).
arg
(
roll
).
arg
(
sides
));
}
}
void
MessageLogWidget
::
logDraw
(
QString
playerName
,
int
number
)
void
MessageLogWidget
::
logDraw
(
QString
playerName
,
int
number
)
{
{
if
(
number
==
1
)
if
(
number
==
1
)
append
(
tr
(
"%1 draws a card"
).
arg
(
playerName
));
append
PlainText
(
tr
(
"%1 draws a card"
).
arg
(
playerName
));
else
else
append
(
tr
(
"%1 draws %2 cards"
).
arg
(
playerName
).
arg
(
number
));
append
PlainText
(
tr
(
"%1 draws %2 cards"
).
arg
(
playerName
).
arg
(
number
));
}
}
void
MessageLogWidget
::
logMoveCard
(
QString
playerName
,
QString
cardName
,
QString
startZone
,
QString
targetZone
)
void
MessageLogWidget
::
logMoveCard
(
QString
playerName
,
QString
cardName
,
QString
startZone
,
QString
targetZone
)
{
{
append
(
tr
(
"%1 moves %2 from %3 to %4"
).
arg
(
playerName
).
arg
(
cardName
).
arg
(
startZone
).
arg
(
targetZone
));
append
PlainText
(
tr
(
"%1 moves %2 from %3 to %4"
).
arg
(
playerName
).
arg
(
cardName
).
arg
(
startZone
).
arg
(
targetZone
));
}
}
void
MessageLogWidget
::
logCreateToken
(
QString
playerName
,
QString
cardName
)
void
MessageLogWidget
::
logCreateToken
(
QString
playerName
,
QString
cardName
)
{
{
append
(
tr
(
"%1 creates token: %2"
).
arg
(
playerName
).
arg
(
cardName
));
append
PlainText
(
tr
(
"%1 creates token: %2"
).
arg
(
playerName
).
arg
(
cardName
));
}
}
void
MessageLogWidget
::
logSetCardCounters
(
QString
playerName
,
QString
cardName
,
int
value
,
int
oldValue
)
void
MessageLogWidget
::
logSetCardCounters
(
QString
playerName
,
QString
cardName
,
int
value
,
int
oldValue
)
{
{
if
(
value
>
oldValue
)
if
(
value
>
oldValue
)
append
(
tr
(
"%1 places %2 counters on %3 (now %4)"
).
arg
(
playerName
).
arg
(
value
-
oldValue
).
arg
(
cardName
).
arg
(
value
));
append
PlainText
(
tr
(
"%1 places %2 counters on %3 (now %4)"
).
arg
(
playerName
).
arg
(
value
-
oldValue
).
arg
(
cardName
).
arg
(
value
));
else
else
append
(
tr
(
"%1 removes %2 counters from %3 (now %4)"
).
arg
(
playerName
).
arg
(
oldValue
-
value
).
arg
(
cardName
).
arg
(
value
));
append
PlainText
(
tr
(
"%1 removes %2 counters from %3 (now %4)"
).
arg
(
playerName
).
arg
(
oldValue
-
value
).
arg
(
cardName
).
arg
(
value
));
}
}
void
MessageLogWidget
::
logSetTapped
(
QString
playerName
,
QString
cardName
,
bool
tapped
)
void
MessageLogWidget
::
logSetTapped
(
QString
playerName
,
QString
cardName
,
bool
tapped
)
{
{
if
(
cardName
==
"-1"
)
if
(
cardName
==
"-1"
)
cardName
=
tr
(
"his permanents"
);
cardName
=
tr
(
"his permanents"
);
append
(
tr
(
"%1 %2 %3"
).
arg
(
playerName
).
arg
(
tapped
?
"taps"
:
"untaps"
).
arg
(
cardName
));
append
PlainText
(
tr
(
"%1 %2 %3"
).
arg
(
playerName
).
arg
(
tapped
?
"taps"
:
"untaps"
).
arg
(
cardName
));
}
}
void
MessageLogWidget
::
logSetCounter
(
QString
playerName
,
QString
counterName
,
int
value
,
int
oldValue
)
void
MessageLogWidget
::
logSetCounter
(
QString
playerName
,
QString
counterName
,
int
value
,
int
oldValue
)
{
{
append
(
tr
(
"%1 sets counter
\"
%2
\"
to %3 (%4%5)"
).
arg
(
playerName
).
arg
(
counterName
).
arg
(
value
).
arg
(
value
>
oldValue
?
"+"
:
""
).
arg
(
value
-
oldValue
));
append
PlainText
(
tr
(
"%1 sets counter
\"
%2
\"
to %3 (%4%5)"
).
arg
(
playerName
).
arg
(
counterName
).
arg
(
value
).
arg
(
value
>
oldValue
?
"+"
:
""
).
arg
(
value
-
oldValue
));
}
}
void
MessageLogWidget
::
logSetDoesntUntap
(
QString
playerName
,
QString
cardName
,
bool
doesntUntap
)
void
MessageLogWidget
::
logSetDoesntUntap
(
QString
playerName
,
QString
cardName
,
bool
doesntUntap
)
{
{
if
(
doesntUntap
)
if
(
doesntUntap
)
append
(
tr
(
"%1 sets %2 to not untap normally."
).
arg
(
playerName
).
arg
(
cardName
));
append
PlainText
(
tr
(
"%1 sets %2 to not untap normally."
).
arg
(
playerName
).
arg
(
cardName
));
else
else
append
(
tr
(
"%1 sets %2 to untap normally."
).
arg
(
playerName
).
arg
(
cardName
));
append
PlainText
(
tr
(
"%1 sets %2 to untap normally."
).
arg
(
playerName
).
arg
(
cardName
));
}
}
void
MessageLogWidget
::
logDumpZone
(
QString
playerName
,
QString
zoneName
,
QString
zoneOwner
,
int
numberCards
)
void
MessageLogWidget
::
logDumpZone
(
QString
playerName
,
QString
zoneName
,
QString
zoneOwner
,
int
numberCards
)
{
{
if
(
numberCards
)
if
(
numberCards
)
append
(
tr
(
"%1 is looking at the top %2 cards of %3's %4"
).
arg
(
playerName
).
arg
(
numberCards
).
arg
(
zoneOwner
).
arg
(
zoneName
));
append
PlainText
(
tr
(
"%1 is looking at the top %2 cards of %3's %4"
).
arg
(
playerName
).
arg
(
numberCards
).
arg
(
zoneOwner
).
arg
(
zoneName
));
else
else
append
(
tr
(
"%1 is looking at %2's %3"
).
arg
(
playerName
).
arg
(
zoneOwner
).
arg
(
zoneName
));
append
PlainText
(
tr
(
"%1 is looking at %2's %3"
).
arg
(
playerName
).
arg
(
zoneOwner
).
arg
(
zoneName
));
}
}
...
@@ -154,7 +154,7 @@ void MessageLogWidget::connectToGame(Game *game)
...
@@ -154,7 +154,7 @@ void MessageLogWidget::connectToGame(Game *game)
}
}
MessageLogWidget
::
MessageLogWidget
(
QWidget
*
parent
)
MessageLogWidget
::
MessageLogWidget
(
QWidget
*
parent
)
:
QTextEdit
(
parent
)
:
Q
Plain
TextEdit
(
parent
)
{
{
setReadOnly
(
true
);
setReadOnly
(
true
);
QFont
f
;
QFont
f
;
...
...
cockatrice/src/messagelogwidget.h
View file @
f33d7908
#ifndef MESSAGELOGWIDGET_H
#ifndef MESSAGELOGWIDGET_H
#define MESSAGELOGWIDGET_H
#define MESSAGELOGWIDGET_H
#include
<QTextEdit>
#include
<Q
Plain
TextEdit>
#include
<QAbstractSocket>
#include
<QAbstractSocket>
#include
"client.h"
#include
"client.h"
class
Game
;
class
Game
;
class
MessageLogWidget
:
public
QTextEdit
{
class
MessageLogWidget
:
public
Q
Plain
TextEdit
{
Q_OBJECT
Q_OBJECT
public
slots
:
public
slots
:
void
logConnecting
(
QString
hostname
);
void
logConnecting
(
QString
hostname
);
...
...
cockatrice/src/window_main.cpp
View file @
f33d7908
...
@@ -260,9 +260,7 @@ MainWindow::MainWindow(QTranslator *_translator, QWidget *parent)
...
@@ -260,9 +260,7 @@ MainWindow::MainWindow(QTranslator *_translator, QWidget *parent)
QPixmapCache
::
setCacheLimit
(
200000
);
QPixmapCache
::
setCacheLimit
(
200000
);
db
=
new
CardDatabase
(
this
);
db
=
new
CardDatabase
(
this
);
// db->importOracleDir();
// db->saveToFile("../cards.xml");
scene
=
new
QGraphicsScene
(
0
,
0
,
1096
,
1160
,
this
);
scene
=
new
QGraphicsScene
(
0
,
0
,
1096
,
1160
,
this
);
view
=
new
GameView
(
scene
);
view
=
new
GameView
(
scene
);
...
...
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