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
dfaa6b1d
Commit
dfaa6b1d
authored
Jul 28, 2009
by
brukie
Browse files
settings dialog
parent
789db32b
Changes
11
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/carddatabase.cpp
View file @
dfaa6b1d
...
@@ -63,16 +63,7 @@ CardInfo::CardInfo(CardDatabase *_db, const QString &_name, const QString &_mana
...
@@ -63,16 +63,7 @@ CardInfo::CardInfo(CardDatabase *_db, const QString &_name, const QString &_mana
CardInfo
::~
CardInfo
()
CardInfo
::~
CardInfo
()
{
{
if
(
pixmap
)
{
clearPixmapCache
();
qDebug
(
QString
(
"Deleting pixmap for %1"
).
arg
(
name
).
toLatin1
());
delete
pixmap
;
QMapIterator
<
int
,
QPixmap
*>
i
(
scaledPixmapCache
);
while
(
i
.
hasNext
())
{
i
.
next
();
qDebug
(
QString
(
" Deleting cached pixmap for width %1"
).
arg
(
i
.
key
()).
toLatin1
());
delete
i
.
value
();
}
}
}
}
QString
CardInfo
::
getMainCardType
()
const
QString
CardInfo
::
getMainCardType
()
const
...
@@ -114,9 +105,10 @@ QPixmap *CardInfo::loadPixmap()
...
@@ -114,9 +105,10 @@ QPixmap *CardInfo::loadPixmap()
{
{
if
(
pixmap
)
if
(
pixmap
)
return
pixmap
;
return
pixmap
;
QString
picsPath
=
db
->
getPicsPath
();
pixmap
=
new
QPixmap
();
pixmap
=
new
QPixmap
();
if
(
getName
().
isEmpty
())
{
if
(
getName
().
isEmpty
())
{
pixmap
->
load
(
"../pics/back.jpg"
);
pixmap
->
load
(
QString
(
"%1/back.jpg"
).
arg
(
picsPath
)
);
return
pixmap
;
return
pixmap
;
}
}
sets
.
sortByKey
();
sets
.
sortByKey
();
...
@@ -129,9 +121,9 @@ QPixmap *CardInfo::loadPixmap()
...
@@ -129,9 +121,9 @@ QPixmap *CardInfo::loadPixmap()
for
(
int
i
=
0
;
i
<
sets
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
sets
.
size
();
i
++
)
{
// Fire // Ice, Circle of Protection: Red
// Fire // Ice, Circle of Protection: Red
QString
correctedName
=
getName
().
remove
(
" // "
).
remove
(
":"
);
QString
correctedName
=
getName
().
remove
(
" // "
).
remove
(
":"
);
if
(
pixmap
->
load
(
QString
(
"
../pics/
%1/%2.full.jpg"
).
arg
(
sets
[
i
]
->
getShortName
()).
arg
(
correctedName
)))
if
(
pixmap
->
load
(
QString
(
"%1/%2
/%3
.full.jpg"
).
arg
(
picsPath
).
arg
(
sets
[
i
]
->
getShortName
()).
arg
(
correctedName
)))
return
pixmap
;
return
pixmap
;
if
(
pixmap
->
load
(
QString
(
"
../pics/
%1/%2%3.full.jpg"
).
arg
(
sets
[
i
]
->
getShortName
()).
arg
(
correctedName
).
arg
(
1
)))
if
(
pixmap
->
load
(
QString
(
"%1/%2
/
%3
%4
.full.jpg"
).
arg
(
picsPath
).
arg
(
sets
[
i
]
->
getShortName
()).
arg
(
correctedName
).
arg
(
1
)))
return
pixmap
;
return
pixmap
;
}
}
return
pixmap
;
return
pixmap
;
...
@@ -161,6 +153,22 @@ QPixmap *CardInfo::getPixmap(QSize size)
...
@@ -161,6 +153,22 @@ QPixmap *CardInfo::getPixmap(QSize size)
return
result
;
return
result
;
}
}
void
CardInfo
::
clearPixmapCache
()
{
if
(
pixmap
)
{
qDebug
(
QString
(
"Deleting pixmap for %1"
).
arg
(
name
).
toLatin1
());
delete
pixmap
;
pixmap
=
0
;
QMapIterator
<
int
,
QPixmap
*>
i
(
scaledPixmapCache
);
while
(
i
.
hasNext
())
{
i
.
next
();
qDebug
(
QString
(
" Deleting cached pixmap for width %1"
).
arg
(
i
.
key
()).
toLatin1
());
delete
i
.
value
();
}
scaledPixmapCache
.
clear
();
}
}
QXmlStreamWriter
&
operator
<<
(
QXmlStreamWriter
&
xml
,
const
CardInfo
*
info
)
QXmlStreamWriter
&
operator
<<
(
QXmlStreamWriter
&
xml
,
const
CardInfo
*
info
)
{
{
xml
.
writeStartElement
(
"card"
);
xml
.
writeStartElement
(
"card"
);
...
@@ -181,8 +189,12 @@ QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
...
@@ -181,8 +189,12 @@ QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
return
xml
;
return
xml
;
}
}
CardDatabase
::
CardDatabase
()
CardDatabase
::
CardDatabase
(
QObject
*
parent
)
:
QObject
(
parent
),
noCard
(
0
)
{
{
updateDatabasePath
();
updatePicsPath
();
noCard
=
new
CardInfo
(
this
);
noCard
=
new
CardInfo
(
this
);
noCard
->
loadPixmap
();
// cache pixmap for card back
noCard
->
loadPixmap
();
// cache pixmap for card back
}
}
...
@@ -247,6 +259,17 @@ SetList CardDatabase::getSetList() const
...
@@ -247,6 +259,17 @@ SetList CardDatabase::getSetList() const
return
result
;
return
result
;
}
}
void
CardDatabase
::
clearPixmapCache
()
{
QHashIterator
<
QString
,
CardInfo
*>
i
(
cardHash
);
while
(
i
.
hasNext
())
{
i
.
next
();
i
.
value
()
->
clearPixmapCache
();
}
if
(
noCard
)
noCard
->
clearPixmapCache
();
}
void
CardDatabase
::
importOracleFile
(
const
QString
&
fileName
,
CardSet
*
set
)
void
CardDatabase
::
importOracleFile
(
const
QString
&
fileName
,
CardSet
*
set
)
{
{
QFile
file
(
fileName
);
QFile
file
(
fileName
);
...
@@ -424,3 +447,25 @@ bool CardDatabase::saveToFile(const QString &fileName)
...
@@ -424,3 +447,25 @@ bool CardDatabase::saveToFile(const QString &fileName)
return
true
;
return
true
;
}
}
void
CardDatabase
::
updatePicsPath
(
const
QString
&
path
)
{
if
(
path
.
isEmpty
())
{
QSettings
settings
;
settings
.
beginGroup
(
"paths"
);
picsPath
=
settings
.
value
(
"pics"
).
toString
();
}
else
picsPath
=
path
;
clearPixmapCache
();
}
void
CardDatabase
::
updateDatabasePath
(
const
QString
&
path
)
{
if
(
path
.
isEmpty
())
{
QSettings
settings
;
settings
.
beginGroup
(
"paths"
);
cardDatabasePath
=
settings
.
value
(
"carddatabase"
).
toString
();
}
else
cardDatabasePath
=
path
;
loadFromFile
(
cardDatabasePath
);
}
cockatrice/src/carddatabase.h
View file @
dfaa6b1d
...
@@ -66,30 +66,36 @@ public:
...
@@ -66,30 +66,36 @@ public:
void
addToSet
(
CardSet
*
set
);
void
addToSet
(
CardSet
*
set
);
QPixmap
*
loadPixmap
();
QPixmap
*
loadPixmap
();
QPixmap
*
getPixmap
(
QSize
size
);
QPixmap
*
getPixmap
(
QSize
size
);
void
clearPixmapCache
();
};
};
class
CardDatabase
{
class
CardDatabase
:
public
QObject
{
Q_OBJECT
private:
private:
QHash
<
QString
,
CardInfo
*>
cardHash
;
QHash
<
QString
,
CardInfo
*>
cardHash
;
QHash
<
QString
,
CardSet
*>
setHash
;
QHash
<
QString
,
CardSet
*>
setHash
;
CardInfo
*
noCard
;
CardInfo
*
noCard
;
static
const
unsigned
int
magicNumber
=
0x12345678
;
QString
picsPath
,
cardDatabasePath
;
static
const
unsigned
int
fileVersion
=
1
;
void
loadCardsFromXml
(
QXmlStreamReader
&
xml
);
void
loadCardsFromXml
(
QXmlStreamReader
&
xml
);
void
loadSetsFromXml
(
QXmlStreamReader
&
xml
);
void
loadSetsFromXml
(
QXmlStreamReader
&
xml
);
public:
public:
CardDatabase
();
CardDatabase
(
QObject
*
parent
=
0
);
~
CardDatabase
();
~
CardDatabase
();
void
clear
();
void
clear
();
CardInfo
*
getCard
(
const
QString
&
cardName
=
QString
());
CardInfo
*
getCard
(
const
QString
&
cardName
=
QString
());
CardSet
*
getSet
(
const
QString
&
setName
);
CardSet
*
getSet
(
const
QString
&
setName
);
QList
<
CardInfo
*>
getCardList
()
const
{
return
cardHash
.
values
();
}
QList
<
CardInfo
*>
getCardList
()
const
{
return
cardHash
.
values
();
}
SetList
getSetList
()
const
;
SetList
getSetList
()
const
;
void
clearPixmapCache
();
void
importOracleFile
(
const
QString
&
fileName
,
CardSet
*
set
);
void
importOracleFile
(
const
QString
&
fileName
,
CardSet
*
set
);
void
importOracleDir
();
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
;
}
public
slots
:
void
updatePicsPath
(
const
QString
&
path
=
QString
());
void
updateDatabasePath
(
const
QString
&
path
=
QString
());
};
};
#endif
#endif
cockatrice/src/cardinfowidget.cpp
View file @
dfaa6b1d
...
@@ -8,30 +8,30 @@
...
@@ -8,30 +8,30 @@
CardInfoWidget
::
CardInfoWidget
(
CardDatabase
*
_db
,
QWidget
*
parent
)
CardInfoWidget
::
CardInfoWidget
(
CardDatabase
*
_db
,
QWidget
*
parent
)
:
QFrame
(
parent
),
db
(
_db
),
pixmapHeight
(
pixmapWidth
)
:
QFrame
(
parent
),
db
(
_db
),
pixmapHeight
(
pixmapWidth
)
{
{
cardPicture
=
new
QLabel
()
;
cardPicture
=
new
QLabel
;
cardPicture
->
setAlignment
(
Qt
::
AlignCenter
);
cardPicture
->
setAlignment
(
Qt
::
AlignCenter
);
QFont
f
;
QFont
f
;
f
.
setPixelSize
(
11
);
f
.
setPixelSize
(
11
);
nameLabel1
=
new
QLabel
(
tr
(
"Name:"
))
;
nameLabel1
=
new
QLabel
;
nameLabel1
->
setFont
(
f
);
nameLabel1
->
setFont
(
f
);
nameLabel2
=
new
QLabel
()
;
nameLabel2
=
new
QLabel
;
nameLabel2
->
setWordWrap
(
true
);
nameLabel2
->
setWordWrap
(
true
);
nameLabel2
->
setFont
(
f
);
nameLabel2
->
setFont
(
f
);
manacostLabel1
=
new
QLabel
(
tr
(
"Mana cost:"
))
;
manacostLabel1
=
new
QLabel
;
manacostLabel1
->
setFont
(
f
);
manacostLabel1
->
setFont
(
f
);
manacostLabel2
=
new
QLabel
()
;
manacostLabel2
=
new
QLabel
;
manacostLabel2
->
setFont
(
f
);
manacostLabel2
->
setFont
(
f
);
manacostLabel2
->
setWordWrap
(
true
);
manacostLabel2
->
setWordWrap
(
true
);
cardtypeLabel1
=
new
QLabel
(
tr
(
"Card type:"
))
;
cardtypeLabel1
=
new
QLabel
;
cardtypeLabel1
->
setFont
(
f
);
cardtypeLabel1
->
setFont
(
f
);
cardtypeLabel2
=
new
QLabel
()
;
cardtypeLabel2
=
new
QLabel
;
cardtypeLabel2
->
setFont
(
f
);
cardtypeLabel2
->
setFont
(
f
);
cardtypeLabel2
->
setWordWrap
(
true
);
cardtypeLabel2
->
setWordWrap
(
true
);
powtoughLabel1
=
new
QLabel
(
tr
(
"P / T:"
))
;
powtoughLabel1
=
new
QLabel
;
powtoughLabel1
->
setFont
(
f
);
powtoughLabel1
->
setFont
(
f
);
powtoughLabel2
=
new
QLabel
()
;
powtoughLabel2
=
new
QLabel
;
powtoughLabel2
->
setFont
(
f
);
powtoughLabel2
->
setFont
(
f
);
textLabel
=
new
QTextEdit
();
textLabel
=
new
QTextEdit
();
...
@@ -60,6 +60,7 @@ CardInfoWidget::CardInfoWidget(CardDatabase *_db, QWidget *parent)
...
@@ -60,6 +60,7 @@ CardInfoWidget::CardInfoWidget(CardDatabase *_db, QWidget *parent)
pixmapHeight
=
pixmapWidth
*
bigPixmap
->
height
()
/
bigPixmap
->
width
();
pixmapHeight
=
pixmapWidth
*
bigPixmap
->
height
()
/
bigPixmap
->
width
();
setCard
(
cardBack
);
setCard
(
cardBack
);
retranslateUi
();
setFrameStyle
(
QFrame
::
Panel
|
QFrame
::
Raised
);
setFrameStyle
(
QFrame
::
Panel
|
QFrame
::
Raised
);
setFixedSize
(
sizeHint
());
setFixedSize
(
sizeHint
());
}
}
...
@@ -86,3 +87,11 @@ void CardInfoWidget::setCard(const QString &cardName)
...
@@ -86,3 +87,11 @@ void CardInfoWidget::setCard(const QString &cardName)
{
{
setCard
(
db
->
getCard
(
cardName
));
setCard
(
db
->
getCard
(
cardName
));
}
}
void
CardInfoWidget
::
retranslateUi
()
{
nameLabel1
->
setText
(
tr
(
"Name:"
));
manacostLabel1
->
setText
(
tr
(
"Mana cost:"
));
cardtypeLabel1
->
setText
(
tr
(
"Card type:"
));
powtoughLabel1
->
setText
(
tr
(
"P / T:"
));
}
cockatrice/src/cardinfowidget.h
View file @
dfaa6b1d
...
@@ -22,6 +22,7 @@ private:
...
@@ -22,6 +22,7 @@ private:
QTextEdit
*
textLabel
;
QTextEdit
*
textLabel
;
public:
public:
CardInfoWidget
(
CardDatabase
*
_db
,
QWidget
*
parent
=
0
);
CardInfoWidget
(
CardDatabase
*
_db
,
QWidget
*
parent
=
0
);
void
retranslateUi
();
public
slots
:
public
slots
:
void
setCard
(
CardInfo
*
card
);
void
setCard
(
CardInfo
*
card
);
void
setCard
(
const
QString
&
cardName
);
void
setCard
(
const
QString
&
cardName
);
...
...
cockatrice/src/dlg_settings.cpp
View file @
dfaa6b1d
#include
<QtGui>
#include
<QtGui>
#include
"carddatabase.h"
#include
"dlg_settings.h"
#include
"dlg_settings.h"
GeneralSettingsPage
::
GeneralSettingsPage
()
GeneralSettingsPage
::
GeneralSettingsPage
()
{
{
QGroupBox
*
personalGroupBox
=
new
QGroupBox
(
tr
(
"Personal settings"
));
QSettings
settings
;
QLabel
*
languageLabel
=
new
QLabel
(
tr
(
"Language:"
));
QComboBox
*
languageBox
=
new
QComboBox
;
personalGroupBox
=
new
QGroupBox
;
languageLabel
=
new
QLabel
;
languageBox
=
new
QComboBox
;
settings
.
beginGroup
(
"personal"
);
QString
setLanguage
=
settings
.
value
(
"lang"
).
toString
();
QStringList
qmFiles
=
findQmFiles
();
QStringList
qmFiles
=
findQmFiles
();
for
(
int
i
=
0
;
i
<
qmFiles
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
qmFiles
.
size
();
i
++
)
{
languageBox
->
addItem
(
languageName
(
qmFiles
[
i
]),
qmFiles
[
i
]);
QString
langName
=
languageName
(
qmFiles
[
i
]);
languageBox
->
addItem
(
langName
,
qmFiles
[
i
]);
if
((
qmFiles
[
i
]
==
settings
.
value
(
"lang"
).
toString
())
||
(
setLanguage
.
isEmpty
()
&&
langName
==
tr
(
"English"
)))
languageBox
->
setCurrentIndex
(
i
);
}
settings
.
endGroup
();
connect
(
languageBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
languageBoxChanged
(
int
)));
QGridLayout
*
personalGrid
=
new
QGridLayout
;
QGridLayout
*
personalGrid
=
new
QGridLayout
;
personalGrid
->
addWidget
(
languageLabel
,
0
,
0
);
personalGrid
->
addWidget
(
languageLabel
,
0
,
0
);
personalGrid
->
addWidget
(
languageBox
,
0
,
1
);
personalGrid
->
addWidget
(
languageBox
,
0
,
1
);
personalGroupBox
->
setLayout
(
personalGrid
);
personalGroupBox
->
setLayout
(
personalGrid
);
QGroupBox
*
pathsGroupBox
=
new
QGroupBox
(
tr
(
"Paths"
));
pathsGroupBox
=
new
QGroupBox
;
QLabel
*
deckPathLabel
=
new
QLabel
(
tr
(
"Decks directory:"
));
settings
.
beginGroup
(
"paths"
);
QLineEdit
*
deckPathEdit
=
new
QLineEdit
;
QLabel
*
picsPathLabel
=
new
QLabel
(
tr
(
"Pictures directory:"
));
deckPathLabel
=
new
QLabel
;
QLineEdit
*
picsPathEdit
=
new
QLineEdit
;
deckPathEdit
=
new
QLineEdit
(
settings
.
value
(
"decks"
).
toString
());
QLabel
*
cardDatabasePathLabel
=
new
QLabel
(
tr
(
"Path to card database:"
));
deckPathEdit
->
setReadOnly
(
true
);
QLineEdit
*
cardDatabasePathEdit
=
new
QLineEdit
;
QPushButton
*
deckPathButton
=
new
QPushButton
(
"..."
);
connect
(
deckPathButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
deckPathButtonClicked
()));
picsPathLabel
=
new
QLabel
;
picsPathEdit
=
new
QLineEdit
(
settings
.
value
(
"pics"
).
toString
());
picsPathEdit
->
setReadOnly
(
true
);
QPushButton
*
picsPathButton
=
new
QPushButton
(
"..."
);
connect
(
picsPathButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
picsPathButtonClicked
()));
cardDatabasePathLabel
=
new
QLabel
;
cardDatabasePathEdit
=
new
QLineEdit
(
settings
.
value
(
"carddatabase"
).
toString
());
cardDatabasePathEdit
->
setReadOnly
(
true
);
QPushButton
*
cardDatabasePathButton
=
new
QPushButton
(
"..."
);
connect
(
cardDatabasePathButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cardDatabasePathButtonClicked
()));
QGridLayout
*
pathsGrid
=
new
QGridLayout
;
QGridLayout
*
pathsGrid
=
new
QGridLayout
;
pathsGrid
->
addWidget
(
deckPathLabel
,
0
,
0
);
pathsGrid
->
addWidget
(
deckPathLabel
,
0
,
0
);
pathsGrid
->
addWidget
(
deckPathEdit
,
0
,
1
);
pathsGrid
->
addWidget
(
deckPathEdit
,
0
,
1
);
pathsGrid
->
addWidget
(
deckPathButton
,
0
,
2
);
pathsGrid
->
addWidget
(
picsPathLabel
,
1
,
0
);
pathsGrid
->
addWidget
(
picsPathLabel
,
1
,
0
);
pathsGrid
->
addWidget
(
picsPathEdit
,
1
,
1
);
pathsGrid
->
addWidget
(
picsPathEdit
,
1
,
1
);
pathsGrid
->
addWidget
(
picsPathButton
,
1
,
2
);
pathsGrid
->
addWidget
(
cardDatabasePathLabel
,
2
,
0
);
pathsGrid
->
addWidget
(
cardDatabasePathLabel
,
2
,
0
);
pathsGrid
->
addWidget
(
cardDatabasePathEdit
,
2
,
1
);
pathsGrid
->
addWidget
(
cardDatabasePathEdit
,
2
,
1
);
pathsGrid
->
addWidget
(
cardDatabasePathButton
,
2
,
2
);
pathsGroupBox
->
setLayout
(
pathsGrid
);
pathsGroupBox
->
setLayout
(
pathsGrid
);
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
;
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
;
...
@@ -61,16 +88,77 @@ QString GeneralSettingsPage::languageName(const QString &qmFile)
...
@@ -61,16 +88,77 @@ QString GeneralSettingsPage::languageName(const QString &qmFile)
return
translator
.
translate
(
"GeneralSettingsPage"
,
"English"
);
return
translator
.
translate
(
"GeneralSettingsPage"
,
"English"
);
}
}
void
GeneralSettingsPage
::
deckPathButtonClicked
()
{
QString
path
=
QFileDialog
::
getExistingDirectory
(
this
,
tr
(
"Choose path"
));
if
(
path
.
isEmpty
())
return
;
QSettings
settings
;
settings
.
beginGroup
(
"paths"
);
settings
.
setValue
(
"decks"
,
path
);
deckPathEdit
->
setText
(
path
);
}
void
GeneralSettingsPage
::
picsPathButtonClicked
()
{
QString
path
=
QFileDialog
::
getExistingDirectory
(
this
,
tr
(
"Choose path"
));
if
(
path
.
isEmpty
())
return
;
QSettings
settings
;
settings
.
beginGroup
(
"paths"
);
settings
.
setValue
(
"pics"
,
path
);
picsPathEdit
->
setText
(
path
);
emit
picsPathChanged
(
path
);
}
void
GeneralSettingsPage
::
cardDatabasePathButtonClicked
()
{
QString
path
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose path"
));
if
(
path
.
isEmpty
())
return
;
QSettings
settings
;
settings
.
beginGroup
(
"paths"
);
settings
.
setValue
(
"carddatabase"
,
path
);
cardDatabasePathEdit
->
setText
(
path
);
emit
cardDatabasePathChanged
(
path
);
}
void
GeneralSettingsPage
::
languageBoxChanged
(
int
index
)
{
QString
qmFile
=
languageBox
->
itemData
(
index
).
toString
();
QSettings
settings
;
settings
.
beginGroup
(
"personal"
);
settings
.
setValue
(
"lang"
,
qmFile
);
emit
changeLanguage
(
qmFile
);
}
void
GeneralSettingsPage
::
retranslateUi
()
{
personalGroupBox
->
setTitle
(
tr
(
"Personal settings"
));
languageLabel
->
setText
(
tr
(
"Language:"
));
pathsGroupBox
->
setTitle
(
tr
(
"Paths"
));
deckPathLabel
->
setText
(
tr
(
"Decks directory:"
));
picsPathLabel
->
setText
(
tr
(
"Pictures directory:"
));
cardDatabasePathLabel
->
setText
(
tr
(
"Path to card database:"
));
}
AppearanceSettingsPage
::
AppearanceSettingsPage
()
AppearanceSettingsPage
::
AppearanceSettingsPage
()
{
{
}
}
void
AppearanceSettingsPage
::
retranslateUi
()
{
}
MessagesSettingsPage
::
MessagesSettingsPage
()
MessagesSettingsPage
::
MessagesSettingsPage
()
{
{
aAdd
=
new
QAction
(
tr
(
"Add"
),
this
);
aAdd
=
new
QAction
(
this
);
connect
(
aAdd
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actAdd
()));
connect
(
aAdd
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actAdd
()));
aRemove
=
new
QAction
(
tr
(
"Remove"
),
this
);
aRemove
=
new
QAction
(
this
);
connect
(
aRemove
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actRemove
()));
connect
(
aRemove
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actRemove
()));
messageList
=
new
QListWidget
;
messageList
=
new
QListWidget
;
...
@@ -90,6 +178,8 @@ MessagesSettingsPage::MessagesSettingsPage()
...
@@ -90,6 +178,8 @@ MessagesSettingsPage::MessagesSettingsPage()
mainLayout
->
addWidget
(
messageToolBar
);
mainLayout
->
addWidget
(
messageToolBar
);
setLayout
(
mainLayout
);
setLayout
(
mainLayout
);
retranslateUi
();
}
}
void
MessagesSettingsPage
::
storeSettings
()
void
MessagesSettingsPage
::
storeSettings
()
...
@@ -119,8 +209,14 @@ void MessagesSettingsPage::actRemove()
...
@@ -119,8 +209,14 @@ void MessagesSettingsPage::actRemove()
}
}
}
}
DlgSettings
::
DlgSettings
()
void
MessagesSettingsPage
::
retranslateUi
()
:
QDialog
()
{
aAdd
->
setText
(
tr
(
"&Add"
));
aRemove
->
setText
(
tr
(
"&Remove"
));
}
DlgSettings
::
DlgSettings
(
CardDatabase
*
_db
,
QTranslator
*
_translator
,
QWidget
*
parent
)
:
QDialog
(
parent
),
db
(
_db
),
translator
(
_translator
)
{
{
contentsWidget
=
new
QListWidget
;
contentsWidget
=
new
QListWidget
;
contentsWidget
->
setViewMode
(
QListView
::
IconMode
);
contentsWidget
->
setViewMode
(
QListView
::
IconMode
);
...
@@ -130,11 +226,15 @@ DlgSettings::DlgSettings()
...
@@ -130,11 +226,15 @@ DlgSettings::DlgSettings()
contentsWidget
->
setSpacing
(
12
);
contentsWidget
->
setSpacing
(
12
);
pagesWidget
=
new
QStackedWidget
;
pagesWidget
=
new
QStackedWidget
;
pagesWidget
->
addWidget
(
new
GeneralSettingsPage
);
GeneralSettingsPage
*
general
=
new
GeneralSettingsPage
;
connect
(
general
,
SIGNAL
(
picsPathChanged
(
const
QString
&
)),
db
,
SLOT
(
updatePicsPath
(
const
QString
&
)));
connect
(
general
,
SIGNAL
(
cardDatabasePathChanged
(
const
QString
&
)),
db
,
SLOT
(
updateDatabasePath
(
const
QString
&
)));
connect
(
general
,
SIGNAL
(
changeLanguage
(
const
QString
&
)),
this
,
SLOT
(
changeLanguage
(
const
QString
&
)));
pagesWidget
->
addWidget
(
general
);
pagesWidget
->
addWidget
(
new
AppearanceSettingsPage
);
pagesWidget
->
addWidget
(
new
AppearanceSettingsPage
);
pagesWidget
->
addWidget
(
new
MessagesSettingsPage
);
pagesWidget
->
addWidget
(
new
MessagesSettingsPage
);
QPushButton
*
closeButton
=
new
QPushButton
(
tr
(
"&Close"
))
;
closeButton
=
new
QPushButton
;
connect
(
closeButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
close
()));
connect
(
closeButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
close
()));
createIcons
();
createIcons
();
...
@@ -155,23 +255,20 @@ DlgSettings::DlgSettings()
...
@@ -155,23 +255,20 @@ DlgSettings::DlgSettings()
mainLayout
->
addLayout
(
buttonsLayout
);
mainLayout
->
addLayout
(
buttonsLayout
);
setLayout
(
mainLayout
);
setLayout
(
mainLayout
);
s
et
WindowTitle
(
tr
(
"Settings"
)
);
r
et
ranslateUi
(
);
}
}
void
DlgSettings
::
createIcons
()
void
DlgSettings
::
createIcons
()
{
{
QListWidgetItem
*
generalButton
=
new
QListWidgetItem
(
contentsWidget
);
generalButton
=
new
QListWidgetItem
(
contentsWidget
);
generalButton
->
setText
(
tr
(
"General"
));
generalButton
->
setTextAlignment
(
Qt
::
AlignHCenter
);
generalButton
->
setTextAlignment
(
Qt
::
AlignHCenter
);
generalButton
->
setFlags
(
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsEnabled
);
generalButton
->
setFlags
(
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsEnabled
);
QListWidgetItem
*
appearanceButton
=
new
QListWidgetItem
(
contentsWidget
);
appearanceButton
=
new
QListWidgetItem
(
contentsWidget
);
appearanceButton
->
setText
(
tr
(
"Appearance"
));
appearanceButton
->
setTextAlignment
(
Qt
::
AlignHCenter
);
appearanceButton
->
setTextAlignment
(
Qt
::
AlignHCenter
);
appearanceButton
->
setFlags
(
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsEnabled
);
appearanceButton
->
setFlags
(
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsEnabled
);
QListWidgetItem
*
messagesButton
=
new
QListWidgetItem
(
contentsWidget
);
messagesButton
=
new
QListWidgetItem
(
contentsWidget
);
messagesButton
->
setText
(
tr
(
"Messages"
));
messagesButton
->
setTextAlignment
(
Qt
::
AlignHCenter
);
messagesButton
->
setTextAlignment
(
Qt
::
AlignHCenter
);
messagesButton
->
setFlags
(
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsEnabled
);
messagesButton
->
setFlags
(
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsEnabled
);
...
@@ -185,3 +282,31 @@ void DlgSettings::changePage(QListWidgetItem *current, QListWidgetItem *previous
...
@@ -185,3 +282,31 @@ void DlgSettings::changePage(QListWidgetItem *current, QListWidgetItem *previous
pagesWidget
->
setCurrentIndex
(
contentsWidget
->
row
(
current
));
pagesWidget
->
setCurrentIndex
(
contentsWidget
->
row
(
current
));
}
}
void
DlgSettings
::
changeLanguage
(
const
QString
&
qmFile
)
{
qApp
->
removeTranslator
(
translator
);
translator
->
load
(
qmFile
);
qApp
->
installTranslator
(
translator
);
}
void
DlgSettings
::
changeEvent
(
QEvent
*
event
)
{
if
(
event
->
type
()
==
QEvent
::
LanguageChange
)
retranslateUi
();
QDialog
::
changeEvent
(
event
);
}
void
DlgSettings
::
retranslateUi
()
{
setWindowTitle
(
tr
(
"Settings"
));
generalButton
->
setText
(
tr
(
"General"
));
appearanceButton
->
setText
(
tr
(
"Appearance"
));
messagesButton
->
setText
(
tr
(
"Messages"
));
closeButton
->
setText
(
tr
(
"&Close"
));
for
(
int
i
=
0
;
i
<
pagesWidget
->
count
();
i
++
)
dynamic_cast
<
AbstractSettingsPage
*>
(
pagesWidget
->
widget
(
i
))
->
retranslateUi
();
}
cockatrice/src/dlg_settings.h
View file @
dfaa6b1d
...
@@ -3,29 +3,57 @@
...
@@ -3,29 +3,57 @@
#include
<QDialog>
#include
<QDialog>
class
CardDatabase
;
class
QTranslator
;
class
QListWidget
;
class
QListWidget
;
class
QListWidgetItem
;
class
QListWidgetItem
;
class
QStackedWidget
;
class
QStackedWidget
;
class
QLineEdit
;
class
QPushButton
;
class
QComboBox
;
class
QGroupBox
;
class
QLabel
;
class
GeneralSettingsPage
:
public
QWidget
{
class
AbstractSettingsPage
:
public
QWidget
{
public:
virtual
void
retranslateUi
()
=
0
;
};
class
GeneralSettingsPage
:
public
AbstractSettingsPage
{
Q_OBJECT
Q_OBJECT
public:
public:
GeneralSettingsPage
();
GeneralSettingsPage
();
void
retranslateUi
();
private
slots
:
void
deckPathButtonClicked
();
void
picsPathButtonClicked
();
void
cardDatabasePathButtonClicked
();
void
languageBoxChanged
(
int
index
);
signals:
void
picsPathChanged
(
const
QString
&
path
);
void
cardDatabasePathChanged
(
const
QString
&
path
);
void
changeLanguage
(
const
QString
&
qmFile
);
private:
private:
QStringList
findQmFiles
();
QStringList
findQmFiles
();
QString
languageName
(
const
QString
&
qmFile
);
QString
languageName
(
const
QString
&
qmFile
);
QLineEdit
*
deckPathEdit
,
*
picsPathEdit
,
*
cardDatabasePathEdit
;
QGroupBox
*
personalGroupBox
,
*
pathsGroupBox
;
QComboBox
*
languageBox
;
QLabel
*
languageLabel
,
*
deckPathLabel
,
*
picsPathLabel
,
*
cardDatabasePathLabel
;
};
};
class
AppearanceSettingsPage
:
public
QWid
ge
t
{
class
AppearanceSettingsPage
:
public
AbstractSettingsPa
ge
{
Q_OBJECT
Q_OBJECT
public:
public:
AppearanceSettingsPage
();
AppearanceSettingsPage
();
void
retranslateUi
();
};
};
class
MessagesSettingsPage
:
public
QWid
ge
t
{
class
MessagesSettingsPage
:
public
AbstractSettingsPa
ge
{
Q_OBJECT
Q_OBJECT
public:
public:
MessagesSettingsPage
();
MessagesSettingsPage
();
void
retranslateUi
();
private
slots
:
private
slots
:
void
actAdd
();
void
actAdd
();
void
actRemove
();
void
actRemove
();
...
@@ -39,13 +67,21 @@ private:
...
@@ -39,13 +67,21 @@ private:
class
DlgSettings
:
public
QDialog
{
class
DlgSettings
:
public
QDialog
{
Q_OBJECT
Q_OBJECT
public:
public:
DlgSettings
();
DlgSettings
(
CardDatabase
*
_db
,
QTranslator
*
_translator
,
QWidget
*
parent
=
0
);
p
ublic
slots
:
p
rivate
slots
:
void
changePage
(
QListWidgetItem
*
current
,
QListWidgetItem
*
previous
);
void
changePage
(
QListWidgetItem
*
current
,
QListWidgetItem
*
previous
);
void
changeLanguage
(
const
QString
&
qmFile
);
private:
private:
CardDatabase
*
db
;
QTranslator
*
translator
;
QListWidget
*
contentsWidget
;
QListWidget
*
contentsWidget
;
QStackedWidget
*
pagesWidget
;
QStackedWidget
*
pagesWidget
;
QListWidgetItem
*
generalButton
,
*
appearanceButton
,
*
messagesButton
;
QPushButton
*
closeButton
;
void
createIcons
();
void
createIcons
();
void
retranslateUi
();
protected:
void
changeEvent
(
QEvent
*
event
);
};
};
#endif
#endif
cockatrice/src/main.cpp
View file @
dfaa6b1d
...
@@ -22,6 +22,9 @@
...
@@ -22,6 +22,9 @@
#include
<QApplication>
#include
<QApplication>
#include
<QTextCodec>
#include
<QTextCodec>
#include
<QtPlugin>
#include
<QtPlugin>
#include
<QTranslator>
#include
<QLibraryInfo>
#include
<QSettings>
#include
<stdio.h>
#include
<stdio.h>
#include
"window_main.h"
#include
"window_main.h"
...
@@ -48,10 +51,25 @@ int main(int argc, char *argv[])
...
@@ -48,10 +51,25 @@ int main(int argc, char *argv[])
QCoreApplication
::
setOrganizationDomain
(
"cockatrice.de"
);
QCoreApplication
::
setOrganizationDomain
(
"cockatrice.de"
);
QCoreApplication
::
setApplicationName
(
"Cockatrice"
);
QCoreApplication
::
setApplicationName
(
"Cockatrice"
);
MainWindow
*
ui
=
new
MainWindow
;
QString
localeName
=
QLocale
::
system
().
name
();
QTranslator
qtTranslator
;
qtTranslator
.
load
(
"qt_"
+
localeName
,
QLibraryInfo
::
location
(
QLibraryInfo
::
TranslationsPath
));
app
.
installTranslator
(
&
qtTranslator
);
QTranslator
translator
;
QSettings
settings
;
settings
.
beginGroup
(
"personal"
);
QString
lang
=
settings
.
value
(
"lang"
).
toString
();
if
(
lang
.
isEmpty
())
translator
.
load
(
"cockatrice_"
+
localeName
,
":/translations"
,
QString
(),
".qm"
);
else
translator
.
load
(
lang
);
app
.
installTranslator
(
&
translator
);
MainWindow
ui
(
&
translator
);
qDebug
(
"main(): MainWindow constructor finished"
);
qDebug
(
"main(): MainWindow constructor finished"
);
ui
->
show
();
ui
.
show
();
qDebug
(
"main(): ui
->
show() finished"
);
qDebug
(
"main(): ui
.
show() finished"
);
return
app
.
exec
();
return
app
.
exec
();
}
}
...
...
cockatrice/src/window_main.cpp
View file @
dfaa6b1d
...
@@ -133,7 +133,7 @@ void MainWindow::actFullScreen(bool checked)
...
@@ -133,7 +133,7 @@ void MainWindow::actFullScreen(bool checked)
void
MainWindow
::
actSettings
()
void
MainWindow
::
actSettings
()
{
{
DlgSettings
dlg
;
DlgSettings
dlg
(
db
,
translator
,
this
)
;
dlg
.
exec
();
dlg
.
exec
();
}
}
...
@@ -180,40 +180,61 @@ void MainWindow::serverTimeout()
...
@@ -180,40 +180,61 @@ void MainWindow::serverTimeout()
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"Server timeout"
));
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"Server timeout"
));
}
}
void
MainWindow
::
retranslateUi
()
{
aConnect
->
setText
(
tr
(
"&Connect..."
));
aDisconnect
->
setText
(
tr
(
"&Disconnect"
));
aRestartGame
->
setText
(
tr
(
"&Restart game..."
));
aRestartGame
->
setShortcut
(
tr
(
"F2"
));
aLeaveGame
->
setText
(
tr
(
"&Leave game"
));
aDeckEditor
->
setText
(
tr
(
"&Deck editor"
));
aFullScreen
->
setText
(
tr
(
"&Full screen"
));
aFullScreen
->
setShortcut
(
tr
(
"Ctrl+F"
));
aSettings
->
setText
(
tr
(
"&Settings..."
));
aExit
->
setText
(
tr
(
"&Exit"
));
aCloseMostRecentZoneView
->
setText
(
tr
(
"Close most recent zone view"
));
aCloseMostRecentZoneView
->
setShortcut
(
tr
(
"Esc"
));
gameMenu
->
setTitle
(
tr
(
"&Game"
));
actionsMenu
->
setTitle
(
tr
(
"&Actions"
));
cardMenu
->
setTitle
(
tr
(
"&Card"
));
sayLabel
->
setText
(
tr
(
"&Say:"
));
cardInfo
->
retranslateUi
();
}
void
MainWindow
::
createActions
()
void
MainWindow
::
createActions
()
{
{
aConnect
=
new
QAction
(
tr
(
"&Connect..."
),
this
);
aConnect
=
new
QAction
(
this
);
connect
(
aConnect
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actConnect
()));
connect
(
aConnect
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actConnect
()));
aDisconnect
=
new
QAction
(
tr
(
"&Disconnect"
),
this
);
aDisconnect
=
new
QAction
(
this
);
aDisconnect
->
setEnabled
(
false
);
aDisconnect
->
setEnabled
(
false
);
connect
(
aDisconnect
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actDisconnect
()));
connect
(
aDisconnect
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actDisconnect
()));
aRestartGame
=
new
QAction
(
tr
(
"&Restart game..."
),
this
);
aRestartGame
=
new
QAction
(
this
);
aRestartGame
->
setShortcut
(
tr
(
"F2"
));
aRestartGame
->
setEnabled
(
false
);
aRestartGame
->
setEnabled
(
false
);
connect
(
aRestartGame
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actRestartGame
()));
connect
(
aRestartGame
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actRestartGame
()));
aLeaveGame
=
new
QAction
(
tr
(
"&Leave game"
),
this
);
aLeaveGame
=
new
QAction
(
this
);
aLeaveGame
->
setEnabled
(
false
);
aLeaveGame
->
setEnabled
(
false
);
connect
(
aLeaveGame
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actLeaveGame
()));
connect
(
aLeaveGame
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actLeaveGame
()));
aDeckEditor
=
new
QAction
(
tr
(
"&Deck editor"
),
this
);
aDeckEditor
=
new
QAction
(
this
);
connect
(
aDeckEditor
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actDeckEditor
()));
connect
(
aDeckEditor
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actDeckEditor
()));
aFullScreen
=
new
QAction
(
tr
(
"&Full screen"
),
this
);
aFullScreen
=
new
QAction
(
this
);
aFullScreen
->
setShortcut
(
tr
(
"Ctrl+F"
));
aFullScreen
->
setCheckable
(
true
);
aFullScreen
->
setCheckable
(
true
);
connect
(
aFullScreen
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
actFullScreen
(
bool
)));
connect
(
aFullScreen
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
actFullScreen
(
bool
)));
aSettings
=
new
QAction
(
tr
(
"&Settings..."
),
this
);
aSettings
=
new
QAction
(
this
);
connect
(
aSettings
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actSettings
()));
connect
(
aSettings
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actSettings
()));
aExit
=
new
QAction
(
tr
(
"&Exit"
),
this
);
aExit
=
new
QAction
(
this
);
connect
(
aExit
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actExit
()));
connect
(
aExit
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actExit
()));
aCloseMostRecentZoneView
=
new
QAction
(
tr
(
"Close most recent zone view"
),
this
);
aCloseMostRecentZoneView
=
new
QAction
(
this
);
aCloseMostRecentZoneView
->
setShortcut
(
tr
(
"Esc"
));
connect
(
aCloseMostRecentZoneView
,
SIGNAL
(
triggered
()),
zoneLayout
,
SLOT
(
closeMostRecentZoneView
()));
connect
(
aCloseMostRecentZoneView
,
SIGNAL
(
triggered
()),
zoneLayout
,
SLOT
(
closeMostRecentZoneView
()));
addAction
(
aCloseMostRecentZoneView
);
addAction
(
aCloseMostRecentZoneView
);
}
}
void
MainWindow
::
createMenus
()
void
MainWindow
::
createMenus
()
{
{
gameMenu
=
menuBar
()
->
addMenu
(
tr
(
"&Game"
));
gameMenu
=
menuBar
()
->
addMenu
(
QString
(
));
gameMenu
->
addAction
(
aConnect
);
gameMenu
->
addAction
(
aConnect
);
gameMenu
->
addAction
(
aDisconnect
);
gameMenu
->
addAction
(
aDisconnect
);
gameMenu
->
addSeparator
();
gameMenu
->
addSeparator
();
...
@@ -228,18 +249,17 @@ void MainWindow::createMenus()
...
@@ -228,18 +249,17 @@ void MainWindow::createMenus()
gameMenu
->
addSeparator
();
gameMenu
->
addSeparator
();
gameMenu
->
addAction
(
aExit
);
gameMenu
->
addAction
(
aExit
);
actionsMenu
=
menuBar
()
->
addMenu
(
tr
(
"&Actions"
));
actionsMenu
=
menuBar
()
->
addMenu
(
QString
(
));
cardMenu
=
menuBar
()
->
addMenu
(
tr
(
"&Card"
));
cardMenu
=
menuBar
()
->
addMenu
(
QString
(
));
}
}
MainWindow
::
MainWindow
(
QWidget
*
parent
)
MainWindow
::
MainWindow
(
QTranslator
*
_translator
,
QWidget
*
parent
)
:
QMainWindow
(
parent
),
game
(
NULL
)
:
QMainWindow
(
parent
),
game
(
NULL
)
,
translator
(
_translator
)
{
{
QPixmapCache
::
setCacheLimit
(
200000
);
QPixmapCache
::
setCacheLimit
(
200000
);
db
=
new
CardDatabase
;
db
=
new
CardDatabase
(
this
);
db
->
loadFromFile
(
"../cards.xml"
);
// db->importOracleDir();
// db->importOracleDir();
// db->saveToFile("../cards.xml");
// db->saveToFile("../cards.xml");
...
@@ -255,7 +275,7 @@ MainWindow::MainWindow(QWidget *parent)
...
@@ -255,7 +275,7 @@ MainWindow::MainWindow(QWidget *parent)
cardInfo
=
new
CardInfoWidget
(
db
);
cardInfo
=
new
CardInfoWidget
(
db
);
messageLog
=
new
MessageLogWidget
;
messageLog
=
new
MessageLogWidget
;
QLabel
*
sayLabel
=
new
QLabel
(
tr
(
"&Say:"
))
;
sayLabel
=
new
QLabel
;
sayEdit
=
new
QLineEdit
;
sayEdit
=
new
QLineEdit
;
sayLabel
->
setBuddy
(
sayEdit
);
sayLabel
->
setBuddy
(
sayEdit
);
...
@@ -294,8 +314,18 @@ MainWindow::MainWindow(QWidget *parent)
...
@@ -294,8 +314,18 @@ MainWindow::MainWindow(QWidget *parent)
createActions
();
createActions
();
createMenus
();
createMenus
();
retranslateUi
();
}
}
void
MainWindow
::
closeEvent
(
QCloseEvent
*/
*
event
*/
)
void
MainWindow
::
closeEvent
(
QCloseEvent
*/
*
event
*/
)
{
{
delete
game
;
}
void
MainWindow
::
changeEvent
(
QEvent
*
event
)
{
if
(
event
->
type
()
==
QEvent
::
LanguageChange
)
retranslateUi
();
QMainWindow
::
changeEvent
(
event
);
}
}
cockatrice/src/window_main.h
View file @
dfaa6b1d
...
@@ -29,9 +29,11 @@ class Game;
...
@@ -29,9 +29,11 @@ class Game;
class
CardDatabase
;
class
CardDatabase
;
class
Player
;
class
Player
;
class
QTranslator
;
class
QVBoxLayout
;
class
QVBoxLayout
;
class
CardInfoWidget
;
class
CardInfoWidget
;
class
MessageLogWidget
;
class
MessageLogWidget
;
class
QLabel
;
class
QLineEdit
;
class
QLineEdit
;
class
QPushButton
;
class
QPushButton
;
class
ServerZoneCard
;
class
ServerZoneCard
;
...
@@ -64,6 +66,7 @@ signals:
...
@@ -64,6 +66,7 @@ signals:
void
logConnecting
(
QString
hostname
);
void
logConnecting
(
QString
hostname
);
void
logDisconnected
();
void
logDisconnected
();
private:
private:
void
retranslateUi
();
void
createActions
();
void
createActions
();
void
createMenus
();
void
createMenus
();
QMenu
*
gameMenu
,
*
actionsMenu
,
*
cardMenu
;
QMenu
*
gameMenu
,
*
actionsMenu
,
*
cardMenu
;
...
@@ -73,6 +76,7 @@ private:
...
@@ -73,6 +76,7 @@ private:
CardInfoWidget
*
cardInfo
;
CardInfoWidget
*
cardInfo
;
MessageLogWidget
*
messageLog
;
MessageLogWidget
*
messageLog
;
QLabel
*
sayLabel
;
QLineEdit
*
sayEdit
;
QLineEdit
*
sayEdit
;
Client
*
client
;
Client
*
client
;
...
@@ -81,10 +85,12 @@ private:
...
@@ -81,10 +85,12 @@ private:
Game
*
game
;
Game
*
game
;
CardDatabase
*
db
;
CardDatabase
*
db
;
ZoneViewLayout
*
zoneLayout
;
ZoneViewLayout
*
zoneLayout
;
QTranslator
*
translator
;
public:
public:
MainWindow
(
QWidget
*
parent
=
0
);
MainWindow
(
QTranslator
*
_translator
,
QWidget
*
parent
=
0
);
protected:
protected:
void
closeEvent
(
QCloseEvent
*
event
);
void
closeEvent
(
QCloseEvent
*
event
);
void
changeEvent
(
QEvent
*
event
);
};
};
#endif
#endif
cockatrice/translations/cockatrice_de.ts
View file @
dfaa6b1d
...
@@ -209,27 +209,27 @@
...
@@ -209,27 +209,27 @@
<
context
>
<
context
>
<
name
>
DlgSettings
<
/name
>
<
name
>
DlgSettings
<
/name
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
158
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
302
"
/>
<
source
>
Settings
<
/source
>
<
source
>
Settings
<
/source
>
<
translation
>
Einstellungen
<
/translation
>
<
translation
>
Einstellungen
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
16
4
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
30
4
"
/>
<
source
>
General
<
/source
>
<
source
>
General
<
/source
>
<
translation
>
Allgemeines
<
/translation
>
<
translation
>
Allgemeines
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
169
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
305
"
/>
<
source
>
Appearance
<
/source
>
<
source
>
Appearance
<
/source
>
<
translation
>
Erscheinungsbild
<
/translation
>
<
translation
>
Erscheinungsbild
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
174
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
306
"
/>
<
source
>
Messages
<
/source
>
<
source
>
Messages
<
/source
>
<
translation
>
Nachrichten
<
/translation
>
<
translation
>
Nachrichten
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
137
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
308
"
/>
<
source
>&
amp
;
Close
<
/source
>
<
source
>&
amp
;
Close
<
/source
>
<
translation
>
S
&
amp
;
chließen
<
/translation
>
<
translation
>
S
&
amp
;
chließen
<
/translation
>
<
/message
>
<
/message
>
...
@@ -543,37 +543,45 @@
...
@@ -543,37 +543,45 @@
<
context
>
<
context
>
<
name
>
GeneralSettingsPage
<
/name
>
<
name
>
GeneralSettingsPage
<
/name
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
7
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
93
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
104
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
117
"
/>
<
source
>
Choose
path
<
/source
>
<
translation
>
Pfad
auswählen
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
139
"
/>
<
source
>
Personal
settings
<
/source
>
<
source
>
Personal
settings
<
/source
>
<
translation
>
Persönliche
Einstellungen
<
/translation
>
<
translation
>
Persönliche
Einstellungen
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
8
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
140
"
/>
<
source
>
Language
:
<
/source
>
<
source
>
Language
:
<
/source
>
<
translation
>
Sprache
:
<
/translation
>
<
translation
>
Sprache
:
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
20
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
141
"
/>
<
source
>
Paths
<
/source
>
<
source
>
Paths
<
/source
>
<
translation
>
Pfade
<
/translation
>
<
translation
>
Pfade
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
2
1
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
1
42
"
/>
<
source
>
Decks
directory
:
<
/source
>
<
source
>
Decks
directory
:
<
/source
>
<
translation
>
Verzeichnis
mit
Decklisten
:
<
/translation
>
<
translation
>
Verzeichnis
mit
Decklisten
:
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
2
3
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
14
3
"
/>
<
source
>
Pictures
directory
:
<
/source
>
<
source
>
Pictures
directory
:
<
/source
>
<
translation
>
Verzeichnis
mit
Bilddateien
:
<
/translation
>
<
translation
>
Verzeichnis
mit
Bilddateien
:
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
25
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
144
"
/>
<
source
>
Path
to
card
database
:
<
/source
>
<
source
>
Path
to
card
database
:
<
/source
>
<
translation
>
Pfad
zur
Kartendatenbank
:
<
/translation
>
<
translation
>
Pfad
zur
Kartendatenbank
:
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
61
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
20
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
88
"
/>
<
source
>
English
<
/source
>
<
source
>
English
<
/source
>
<
translation
>
Deutsch
<
/translation
>
<
translation
>
Deutsch
<
/translation
>
<
/message
>
<
/message
>
...
@@ -666,7 +674,7 @@
...
@@ -666,7 +674,7 @@
<
translation
>&
amp
;
Karte
<
/translation
>
<
translation
>&
amp
;
Karte
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/window_main.cpp
"
line
=
"
25
8
"
/>
<
location
filename
=
"
../src/window_main.cpp
"
line
=
"
25
7
"
/>
<
source
>&
amp
;
Say
:
<
/source
>
<
source
>&
amp
;
Say
:
<
/source
>
<
translation
>&
amp
;
Sagen
:
<
/translation
>
<
translation
>&
amp
;
Sagen
:
<
/translation
>
<
/message
>
<
/message
>
...
@@ -797,22 +805,30 @@
...
@@ -797,22 +805,30 @@
<
context
>
<
context
>
<
name
>
MessagesSettingsPage
<
/name
>
<
name
>
MessagesSettingsPage
<
/name
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
71
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
214
"
/>
<
source
>&
amp
;
Add
<
/source
>
<
translation
>&
amp
;
Hinzufügen
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
215
"
/>
<
source
>&
amp
;
Remove
<
/source
>
<
translation
>&
amp
;
Entfernen
<
/translation
>
<
/message
>
<
message
>
<
source
>
Add
<
/source
>
<
source
>
Add
<
/source
>
<
translation
>
Hinzufügen
<
/translation
>
<
translation
type
=
"
obsolete
"
>
Hinzufügen
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
73
"
/>
<
source
>
Remove
<
/source
>
<
source
>
Remove
<
/source
>
<
translation
>
Entfernen
<
/translation
>
<
translation
type
=
"
obsolete
"
>
Entfernen
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
1
0
7
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
1
9
7
"
/>
<
source
>
Add
message
<
/source
>
<
source
>
Add
message
<
/source
>
<
translation
>
Nachricht
hinzufügen
<
/translation
>
<
translation
>
Nachricht
hinzufügen
<
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
1
0
7
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
1
9
7
"
/>
<
source
>
Message
:
<
/source
>
<
source
>
Message
:
<
/source
>
<
translation
>
Nachricht
:
<
/translation
>
<
translation
>
Nachricht
:
<
/translation
>
<
/message
>
<
/message
>
...
...
cockatrice/translations/cockatrice_en.ts
View file @
dfaa6b1d
...
@@ -173,27 +173,27 @@
...
@@ -173,27 +173,27 @@
<
context
>
<
context
>
<
name
>
DlgSettings
<
/name
>
<
name
>
DlgSettings
<
/name
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
158
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
302
"
/>
<
source
>
Settings
<
/source
>
<
source
>
Settings
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
16
4
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
30
4
"
/>
<
source
>
General
<
/source
>
<
source
>
General
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
169
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
305
"
/>
<
source
>
Appearance
<
/source
>
<
source
>
Appearance
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
174
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
306
"
/>
<
source
>
Messages
<
/source
>
<
source
>
Messages
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
137
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
308
"
/>
<
source
>&
amp
;
Close
<
/source
>
<
source
>&
amp
;
Close
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
...
@@ -499,37 +499,45 @@
...
@@ -499,37 +499,45 @@
<
context
>
<
context
>
<
name
>
GeneralSettingsPage
<
/name
>
<
name
>
GeneralSettingsPage
<
/name
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
7
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
93
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
104
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
117
"
/>
<
source
>
Choose
path
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
139
"
/>
<
source
>
Personal
settings
<
/source
>
<
source
>
Personal
settings
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
8
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
140
"
/>
<
source
>
Language
:
<
/source
>
<
source
>
Language
:
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
20
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
141
"
/>
<
source
>
Paths
<
/source
>
<
source
>
Paths
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
2
1
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
1
42
"
/>
<
source
>
Decks
directory
:
<
/source
>
<
source
>
Decks
directory
:
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
2
3
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
14
3
"
/>
<
source
>
Pictures
directory
:
<
/source
>
<
source
>
Pictures
directory
:
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
25
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
144
"
/>
<
source
>
Path
to
card
database
:
<
/source
>
<
source
>
Path
to
card
database
:
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
61
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
20
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
88
"
/>
<
source
>
English
<
/source
>
<
source
>
English
<
/source
>
<
translation
>
English
<
/translation
>
<
translation
>
English
<
/translation
>
<
/message
>
<
/message
>
...
@@ -622,7 +630,7 @@
...
@@ -622,7 +630,7 @@
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/window_main.cpp
"
line
=
"
25
8
"
/>
<
location
filename
=
"
../src/window_main.cpp
"
line
=
"
25
7
"
/>
<
source
>&
amp
;
Say
:
<
/source
>
<
source
>&
amp
;
Say
:
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
...
@@ -753,22 +761,22 @@
...
@@ -753,22 +761,22 @@
<
context
>
<
context
>
<
name
>
MessagesSettingsPage
<
/name
>
<
name
>
MessagesSettingsPage
<
/name
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
71
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
214
"
/>
<
source
>
Add
<
/source
>
<
source
>
&
amp
;
Add
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
73
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
215
"
/>
<
source
>
Remove
<
/source
>
<
source
>
&
amp
;
Remove
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
1
0
7
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
1
9
7
"
/>
<
source
>
Add
message
<
/source
>
<
source
>
Add
message
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/message
>
<
message
>
<
message
>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
1
0
7
"
/>
<
location
filename
=
"
../src/dlg_settings.cpp
"
line
=
"
1
9
7
"
/>
<
source
>
Message
:
<
/source
>
<
source
>
Message
:
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/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