Merge branch 'master' of ssh://cockatrice.de/home/cockgit/cockatrice

This commit is contained in:
Max-Wilhelm Bruker 2010-10-11 17:46:00 +02:00
commit fbcb34db61
39 changed files with 1125 additions and 379 deletions

View file

@ -64,6 +64,7 @@ HEADERS += src/counter.h \
src/localserver.h \
src/localserverinterface.h \
src/localclient.h \
../common/color.h \
../common/serializable_item.h \
../common/decklist.h \
../common/protocol.h \

View file

@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/" >
<file alias="back.svg" >resources/back.svg</file>
<file>resources/icon_delete.svg</file>
<file>resources/icon_tab_changed.svg</file>
<file>resources/icon_config_general.svg</file>
<file>resources/icon_config_appearance.svg</file>

View file

@ -0,0 +1,357 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
id="svg2646"
sodipodi:version="0.32"
inkscape:version="0.47pre4 r22446"
version="1.0"
sodipodi:docname="remove_row.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs2648">
<linearGradient
id="linearGradient3169">
<stop
style="stop-color:#0000ff;stop-opacity:1;"
offset="0"
id="stop3171" />
<stop
style="stop-color:#000067;stop-opacity:1;"
offset="1"
id="stop3173" />
</linearGradient>
<linearGradient
id="linearGradient4766">
<stop
style="stop-color:#784421;stop-opacity:1;"
offset="0"
id="stop4768" />
<stop
style="stop-color:#3d2210;stop-opacity:0;"
offset="1"
id="stop4770" />
</linearGradient>
<linearGradient
id="linearGradient4758">
<stop
style="stop-color:#a05a2c;stop-opacity:1;"
offset="0"
id="stop4760" />
<stop
style="stop-color:#3d2210;stop-opacity:1;"
offset="1"
id="stop4762" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective2654" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4758"
id="linearGradient3508"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="590.62201"
y1="434.7522"
x2="698.54004"
y2="517.79218" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4766"
id="linearGradient3510"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="661.24402"
y1="602.90814"
x2="431.5"
y2="201.5482" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3169"
id="radialGradient3512"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.2116376,0,44.257186)"
cx="120.07376"
cy="56.138123"
fx="120.07376"
fy="56.138123"
r="82.790039" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4758"
id="linearGradient3514"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="590.62201"
y1="434.7522"
x2="698.54004"
y2="517.79218" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4766"
id="linearGradient3516"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="661.24402"
y1="602.90814"
x2="431.5"
y2="201.5482" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3169"
id="radialGradient3518"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.2116376,0,44.257186)"
cx="120.07376"
cy="56.138123"
fx="120.07376"
fy="56.138123"
r="82.790039" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4758"
id="linearGradient3520"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="590.62201"
y1="434.7522"
x2="698.54004"
y2="517.79218" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4766"
id="linearGradient3522"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="661.24402"
y1="602.90814"
x2="431.5"
y2="201.5482" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3169"
id="radialGradient3524"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.2116376,0,44.257186)"
cx="120.07376"
cy="56.138123"
fx="120.07376"
fy="56.138123"
r="82.790039" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4758"
id="linearGradient2442"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="590.62201"
y1="434.7522"
x2="698.54004"
y2="517.79218" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4766"
id="linearGradient2444"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="661.24402"
y1="602.90814"
x2="431.5"
y2="201.5482" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3169"
id="radialGradient2446"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.2116376,0,44.257186)"
cx="120.07376"
cy="56.138123"
fx="120.07376"
fy="56.138123"
r="82.790039" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4758"
id="linearGradient2470"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="590.62201"
y1="434.7522"
x2="698.54004"
y2="517.79218" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4766"
id="linearGradient2472"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="661.24402"
y1="602.90814"
x2="431.5"
y2="201.5482" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3169"
id="radialGradient2474"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.2116376,0,44.257186)"
cx="120.07376"
cy="56.138123"
fx="120.07376"
fy="56.138123"
r="82.790039" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4758"
id="linearGradient2476"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="590.62201"
y1="434.7522"
x2="698.54004"
y2="517.79218" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4766"
id="linearGradient2478"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="661.24402"
y1="602.90814"
x2="431.5"
y2="201.5482" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3169"
id="radialGradient2480"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.2116376,0,44.257186)"
cx="120.07376"
cy="56.138123"
fx="120.07376"
fy="56.138123"
r="82.790039" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4758"
id="linearGradient2482"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="590.62201"
y1="434.7522"
x2="698.54004"
y2="517.79218" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4766"
id="linearGradient2484"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="661.24402"
y1="602.90814"
x2="431.5"
y2="201.5482" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3169"
id="radialGradient2486"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.2116376,0,44.257186)"
cx="120.07376"
cy="56.138123"
fx="120.07376"
fy="56.138123"
r="82.790039" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4758"
id="linearGradient2488"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="590.62201"
y1="434.7522"
x2="698.54004"
y2="517.79218" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4766"
id="linearGradient2490"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9650128,0,0,0.9948433,-449.70565,-312.80927)"
x1="661.24402"
y1="602.90814"
x2="431.5"
y2="201.5482" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3169"
id="radialGradient2492"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.2116376,0,44.257186)"
cx="120.07376"
cy="56.138123"
fx="120.07376"
fy="56.138123"
r="82.790039" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.625"
inkscape:cx="12.656427"
inkscape:cy="31.784541"
inkscape:document-units="px"
inkscape:current-layer="layer2"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="725"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="1" />
<metadata
id="metadata2651">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
style="display:inline" />
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Pfeil"
style="display:inline">
<path
style="fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
d="M 6.433227,14.50946 L 23.923767,32 L 6.433227,49.490541 L 14.50946,57.566773 L 32,40.076233 L 49.490541,57.566773 L 57.566773,49.490541 L 40.076233,32 L 57.566773,14.50946 L 49.490541,6.433227 L 32,23.923767 L 14.50946,6.433227 L 6.433227,14.50946 z"
id="rect3548" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -3,13 +3,16 @@
#include <QCursor>
#include <QStyleOptionGraphicsItem>
#include <QGraphicsSceneMouseEvent>
#include <math.h>
#include "carddatabase.h"
#include "abstractcarditem.h"
#include "settingscache.h"
#include "main.h"
#include <QDebug>
#include <QTimer>
AbstractCardItem::AbstractCardItem(const QString &_name, Player *_owner, QGraphicsItem *parent)
: ArrowTarget(_owner, parent), info(db->getCard(_name)), name(_name), tapped(false)
: ArrowTarget(_owner, parent), info(db->getCard(_name)), name(_name), tapped(false), tapAngle(0)
{
setCursor(Qt::OpenHandCursor);
setFlag(ItemIsSelectable);
@ -17,6 +20,10 @@ AbstractCardItem::AbstractCardItem(const QString &_name, Player *_owner, QGraphi
setCacheMode(DeviceCoordinateCache);
connect(info, SIGNAL(pixmapUpdated()), this, SLOT(pixmapUpdated()));
animationTimer = new QTimer(this);
animationTimer->setSingleShot(false);
connect(animationTimer, SIGNAL(timeout()), this, SLOT(animationEvent()));
}
AbstractCardItem::~AbstractCardItem()
@ -37,19 +44,22 @@ void AbstractCardItem::pixmapUpdated()
void AbstractCardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/)
{
painter->save();
QSizeF translatedSize = painter->combinedTransform().mapRect(boundingRect()).size();
if (tapped)
translatedSize.transpose();
qreal w = painter->combinedTransform().map(QLineF(0, 0, boundingRect().width(), 0)).length();
qreal h = painter->combinedTransform().map(QLineF(0, 0, 0, boundingRect().height())).length();
QSizeF translatedSize(w, h);
QRectF totalBoundingRect = painter->combinedTransform().mapRect(boundingRect());
QPixmap *translatedPixmap = info->getPixmap(translatedSize.toSize());
painter->save();
if (translatedPixmap) {
painter->resetTransform();
if (tapped) {
painter->translate(((qreal) translatedSize.height()) / 2, ((qreal) translatedSize.width()) / 2);
painter->rotate(90);
painter->translate(-((qreal) translatedSize.width()) / 2, -((qreal) translatedSize.height()) / 2);
}
painter->drawPixmap(translatedPixmap->rect(), *translatedPixmap, translatedPixmap->rect());
QTransform pixmapTransform;
pixmapTransform.translate(totalBoundingRect.width() / 2, totalBoundingRect.height() / 2);
pixmapTransform.rotate(tapAngle);
QPointF transPoint = QPointF(-w / 2, -h / 2);
pixmapTransform.translate(transPoint.x(), transPoint.y());
painter->setTransform(pixmapTransform);
painter->drawPixmap(QPointF(0, 0), *translatedPixmap);
} else {
QFont f("Times");
f.setStyleHint(QFont::Serif);
@ -105,6 +115,21 @@ void AbstractCardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *
painter->restore();
}
void AbstractCardItem::animationEvent()
{
int delta = 18;
if (!tapped)
delta *= -1;
tapAngle += delta;
setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(tapAngle).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
update();
if ((tapped && (tapAngle >= 90)) || (!tapped && (tapAngle <= 0)))
animationTimer->stop();
}
void AbstractCardItem::setName(const QString &_name)
{
disconnect(info, 0, this, 0);
@ -120,14 +145,19 @@ void AbstractCardItem::setColor(const QString &_color)
update();
}
void AbstractCardItem::setTapped(bool _tapped)
void AbstractCardItem::setTapped(bool _tapped, bool canAnimate)
{
if (tapped == _tapped)
return;
tapped = _tapped;
if (tapped)
setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(90).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
else
setTransform(QTransform());
update();
if (settingsCache->getTapAnimation() && canAnimate)
animationTimer->start(25);
else {
tapAngle = tapped ? 90 : 0;
setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(tapAngle).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
update();
}
}
void AbstractCardItem::mousePressEvent(QGraphicsSceneMouseEvent *event)

View file

@ -5,6 +5,7 @@
class CardInfo;
class Player;
class QTimer;
const int CARD_WIDTH = 72;
const int CARD_HEIGHT = 102;
@ -15,8 +16,12 @@ protected:
CardInfo *info;
QString name;
bool tapped;
int tapAngle;
QString color;
private:
QTimer *animationTimer;
private slots:
void animationEvent();
void pixmapUpdated();
signals:
void hovered(AbstractCardItem *card);
@ -33,7 +38,7 @@ public:
QString getColor() const { return color; }
void setColor(const QString &_color);
bool getTapped() const { return tapped; }
void setTapped(bool _tapped);
void setTapped(bool _tapped, bool canAnimate = false);
void processHoverEvent();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);

View file

@ -252,6 +252,7 @@ CardDatabase::CardDatabase(QObject *parent)
CardDatabase::~CardDatabase()
{
clear();
delete noCard;
}
void CardDatabase::clear()
@ -453,7 +454,7 @@ bool CardDatabase::loadFromFile(const QString &fileName)
}
}
qDebug(QString("%1 cards in %2 sets loaded").arg(cardHash.size()).arg(setHash.size()).toLatin1());
return true;
return !cardHash.isEmpty();
}
bool CardDatabase::saveToFile(const QString &fileName)

View file

@ -151,43 +151,57 @@ void GeneralSettingsPage::retranslateUi()
AppearanceSettingsPage::AppearanceSettingsPage()
{
QIcon deleteIcon(":/resources/icon_delete.svg");
handBgLabel = new QLabel;
handBgEdit = new QLineEdit(settingsCache->getHandBgPath());
handBgEdit->setReadOnly(true);
QPushButton *handBgClearButton = new QPushButton(deleteIcon, QString());
connect(handBgClearButton, SIGNAL(clicked()), this, SLOT(handBgClearButtonClicked()));
QPushButton *handBgButton = new QPushButton("...");
connect(handBgButton, SIGNAL(clicked()), this, SLOT(handBgButtonClicked()));
tableBgLabel = new QLabel;
tableBgEdit = new QLineEdit(settingsCache->getTableBgPath());
tableBgEdit->setReadOnly(true);
QPushButton *tableBgClearButton = new QPushButton(deleteIcon, QString());
connect(tableBgClearButton, SIGNAL(clicked()), this, SLOT(tableBgClearButtonClicked()));
QPushButton *tableBgButton = new QPushButton("...");
connect(tableBgButton, SIGNAL(clicked()), this, SLOT(tableBgButtonClicked()));
playerAreaBgLabel = new QLabel;
playerAreaBgEdit = new QLineEdit(settingsCache->getPlayerBgPath());
playerAreaBgEdit->setReadOnly(true);
QPushButton *playerAreaBgClearButton = new QPushButton(deleteIcon, QString());
connect(playerAreaBgClearButton, SIGNAL(clicked()), this, SLOT(playerAreaBgClearButtonClicked()));
QPushButton *playerAreaBgButton = new QPushButton("...");
connect(playerAreaBgButton, SIGNAL(clicked()), this, SLOT(playerAreaBgButtonClicked()));
cardBackPicturePathLabel = new QLabel;
cardBackPicturePathEdit = new QLineEdit(settingsCache->getCardBackPicturePath());
cardBackPicturePathEdit->setReadOnly(true);
QPushButton *cardBackPicturePathClearButton = new QPushButton(deleteIcon, QString());
connect(cardBackPicturePathClearButton, SIGNAL(clicked()), this, SLOT(cardBackPicturePathClearButtonClicked()));
QPushButton *cardBackPicturePathButton = new QPushButton("...");
connect(cardBackPicturePathButton, SIGNAL(clicked()), this, SLOT(cardBackPicturePathButtonClicked()));
QGridLayout *zoneBgGrid = new QGridLayout;
zoneBgGrid->addWidget(handBgLabel, 0, 0);
zoneBgGrid->addWidget(handBgEdit, 0, 1);
zoneBgGrid->addWidget(handBgButton, 0, 2);
zoneBgGrid->addWidget(handBgClearButton, 0, 2);
zoneBgGrid->addWidget(handBgButton, 0, 3);
zoneBgGrid->addWidget(tableBgLabel, 1, 0);
zoneBgGrid->addWidget(tableBgEdit, 1, 1);
zoneBgGrid->addWidget(tableBgButton, 1, 2);
zoneBgGrid->addWidget(tableBgClearButton, 1, 2);
zoneBgGrid->addWidget(tableBgButton, 1, 3);
zoneBgGrid->addWidget(playerAreaBgLabel, 2, 0);
zoneBgGrid->addWidget(playerAreaBgEdit, 2, 1);
zoneBgGrid->addWidget(playerAreaBgButton, 2, 2);
zoneBgGrid->addWidget(playerAreaBgClearButton, 2, 2);
zoneBgGrid->addWidget(playerAreaBgButton, 2, 3);
zoneBgGrid->addWidget(cardBackPicturePathLabel, 3, 0);
zoneBgGrid->addWidget(cardBackPicturePathEdit, 3, 1);
zoneBgGrid->addWidget(cardBackPicturePathButton, 3, 2);
zoneBgGrid->addWidget(cardBackPicturePathClearButton, 3, 2);
zoneBgGrid->addWidget(cardBackPicturePathButton, 3, 3);
zoneBgGroupBox = new QGroupBox;
zoneBgGroupBox->setLayout(zoneBgGrid);
@ -202,12 +216,12 @@ AppearanceSettingsPage::AppearanceSettingsPage()
handGroupBox = new QGroupBox;
handGroupBox->setLayout(handGrid);
economicGridCheckBox = new QCheckBox;
economicGridCheckBox->setChecked(settingsCache->getEconomicGrid());
connect(economicGridCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setEconomicGrid(int)));
economicalGridCheckBox = new QCheckBox;
economicalGridCheckBox->setChecked(settingsCache->getEconomicalGrid());
connect(economicalGridCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setEconomicalGrid(int)));
QGridLayout *tableGrid = new QGridLayout;
tableGrid->addWidget(economicGridCheckBox, 0, 0, 1, 2);
tableGrid->addWidget(economicalGridCheckBox, 0, 0, 1, 2);
tableGroupBox = new QGroupBox;
tableGroupBox->setLayout(tableGrid);
@ -248,13 +262,19 @@ void AppearanceSettingsPage::retranslateUi()
horizontalHandCheckBox->setText(tr("Display hand horizontally (wastes space)"));
tableGroupBox->setTitle(tr("Table grid layout"));
economicGridCheckBox->setText(tr("Economic layout"));
economicalGridCheckBox->setText(tr("Economical layout"));
zoneViewGroupBox->setTitle(tr("Zone view layout"));
zoneViewSortByNameCheckBox->setText(tr("Sort by name"));
zoneViewSortByTypeCheckBox->setText(tr("Sort by type"));
}
void AppearanceSettingsPage::handBgClearButtonClicked()
{
handBgEdit->setText(QString());
settingsCache->setHandBgPath(QString());
}
void AppearanceSettingsPage::handBgButtonClicked()
{
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
@ -265,6 +285,12 @@ void AppearanceSettingsPage::handBgButtonClicked()
settingsCache->setHandBgPath(path);
}
void AppearanceSettingsPage::tableBgClearButtonClicked()
{
tableBgEdit->setText(QString());
settingsCache->setTableBgPath(QString());
}
void AppearanceSettingsPage::tableBgButtonClicked()
{
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
@ -275,6 +301,12 @@ void AppearanceSettingsPage::tableBgButtonClicked()
settingsCache->setTableBgPath(path);
}
void AppearanceSettingsPage::playerAreaBgClearButtonClicked()
{
playerAreaBgEdit->setText(QString());
settingsCache->setPlayerBgPath(QString());
}
void AppearanceSettingsPage::playerAreaBgButtonClicked()
{
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
@ -285,6 +317,12 @@ void AppearanceSettingsPage::playerAreaBgButtonClicked()
settingsCache->setPlayerBgPath(path);
}
void AppearanceSettingsPage::cardBackPicturePathClearButtonClicked()
{
cardBackPicturePathEdit->setText(QString());
settingsCache->setCardBackPicturePath(QString());
}
void AppearanceSettingsPage::cardBackPicturePathButtonClicked()
{
QString path = QFileDialog::getOpenFileName(this, tr("Choose path"));
@ -307,8 +345,19 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
generalGroupBox = new QGroupBox;
generalGroupBox->setLayout(generalGrid);
tapAnimationCheckBox = new QCheckBox;
tapAnimationCheckBox->setChecked(settingsCache->getTapAnimation());
connect(tapAnimationCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setTapAnimation(int)));
QGridLayout *animationGrid = new QGridLayout;
animationGrid->addWidget(tapAnimationCheckBox, 0, 0);
animationGroupBox = new QGroupBox;
animationGroupBox->setLayout(animationGrid);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(generalGroupBox);
mainLayout->addWidget(animationGroupBox);
setLayout(mainLayout);
}
@ -317,6 +366,8 @@ void UserInterfaceSettingsPage::retranslateUi()
{
generalGroupBox->setTitle(tr("General interface settings"));
doubleClickToPlayCheckBox->setText(tr("&Double-click cards to play them (instead of single-click)"));
animationGroupBox->setTitle(tr("Animation settings"));
tapAnimationCheckBox->setText(tr("&Tap/untap animation"));
}
MessagesSettingsPage::MessagesSettingsPage()
@ -472,17 +523,22 @@ void DlgSettings::changeEvent(QEvent *event)
void DlgSettings::closeEvent(QCloseEvent *event)
{
if (!db->getLoadSuccess()) {
QMessageBox::critical(this, tr("Error"), tr("Your card database is invalid. Please check if the path is set correctly."));
event->ignore();
} else if (!QDir(settingsCache->getDeckPath()).exists()) {
QMessageBox::critical(this, tr("Error"), tr("The path to your deck directory is invalid."));
event->ignore();
} else if (!QDir(settingsCache->getPicsPath()).exists()) {
QMessageBox::critical(this, tr("Error"), tr("The path to your card pictures directory is invalid."));
event->ignore();
} else
event->accept();
if (!db->getLoadSuccess())
if (QMessageBox::critical(this, tr("Error"), tr("Your card database is invalid. Would you like to go back and set the correct path?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
event->ignore();
return;
}
if (!QDir(settingsCache->getDeckPath()).exists())
if (QMessageBox::critical(this, tr("Error"), tr("The path to your deck directory is invalid. Would you like to go back and set the correct path?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
event->ignore();
return;
}
if (!QDir(settingsCache->getPicsPath()).exists())
if (QMessageBox::critical(this, tr("Error"), tr("The path to your card pictures directory is invalid. Would you like to go back and set the correct path?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
event->ignore();
return;
}
event->accept();
}
void DlgSettings::retranslateUi()

View file

@ -48,9 +48,13 @@ private:
class AppearanceSettingsPage : public AbstractSettingsPage {
Q_OBJECT
private slots:
void handBgClearButtonClicked();
void handBgButtonClicked();
void tableBgClearButtonClicked();
void tableBgButtonClicked();
void playerAreaBgClearButtonClicked();
void playerAreaBgButtonClicked();
void cardBackPicturePathClearButtonClicked();
void cardBackPicturePathButtonClicked();
signals:
void handBgChanged(const QString &path);
@ -60,7 +64,7 @@ signals:
private:
QLabel *handBgLabel, *tableBgLabel, *playerAreaBgLabel, *cardBackPicturePathLabel;
QLineEdit *handBgEdit, *tableBgEdit, *playerAreaBgEdit, *cardBackPicturePathEdit;
QCheckBox *horizontalHandCheckBox, *economicGridCheckBox, *zoneViewSortByNameCheckBox, *zoneViewSortByTypeCheckBox;
QCheckBox *horizontalHandCheckBox, *economicalGridCheckBox, *zoneViewSortByNameCheckBox, *zoneViewSortByTypeCheckBox;
QGroupBox *zoneBgGroupBox, *handGroupBox, *tableGroupBox, *zoneViewGroupBox;
public:
AppearanceSettingsPage();
@ -71,7 +75,8 @@ class UserInterfaceSettingsPage : public AbstractSettingsPage {
Q_OBJECT
private:
QCheckBox *doubleClickToPlayCheckBox;
QGroupBox *generalGroupBox;
QCheckBox *tapAnimationCheckBox;
QGroupBox *generalGroupBox, *animationGroupBox;
public:
UserInterfaceSettingsPage();
void retranslateUi();

View file

@ -528,7 +528,7 @@ void Player::setCardAttrHelper(CardItem *card, const QString &aname, const QStri
if (!(!tapped && card->getDoesntUntap() && allCards)) {
if (!allCards)
emit logSetTapped(this, card->getName(), tapped);
card->setTapped(tapped);
card->setTapped(tapped, true);
}
} else if (aname == "attacking")
card->setAttacking(avalue == "1");
@ -958,7 +958,7 @@ void Player::addZone(CardZone *z)
Counter *Player::addCounter(ServerInfo_Counter *counter)
{
return addCounter(counter->getId(), counter->getName(), counter->getColor(), counter->getRadius(), counter->getCount());
return addCounter(counter->getId(), counter->getName(), counter->getColor().getQColor(), counter->getRadius(), counter->getCount());
}
Counter *Player::addCounter(int counterId, const QString &name, QColor color, int radius, int value)
@ -1012,9 +1012,9 @@ ArrowItem *Player::addArrow(ServerInfo_Arrow *arrow)
return 0;
if (targetCard)
return addArrow(arrow->getId(), startCard, targetCard, arrow->getColor());
return addArrow(arrow->getId(), startCard, targetCard, arrow->getColor().getQColor());
else
return addArrow(arrow->getId(), startCard, targetPlayer->getPlayerTarget(), arrow->getColor());
return addArrow(arrow->getId(), startCard, targetPlayer->getPlayerTarget(), arrow->getColor().getQColor());
}
ArrowItem *Player::addArrow(int arrowId, CardItem *startCard, ArrowTarget *targetItem, const QColor &color)

View file

@ -19,7 +19,8 @@ SettingsCache::SettingsCache()
picDownload = settings->value("personal/picturedownload", false).toBool();
doubleClickToPlay = settings->value("interface/doubleclicktoplay", true).toBool();
horizontalHand = settings->value("hand/horizontal", false).toBool();
economicGrid = settings->value("table/economic", false).toBool();
economicalGrid = settings->value("table/economic", false).toBool();
tapAnimation = settings->value("cards/tapanimation", true).toBool();
zoneViewSortByName = settings->value("zoneview/sortbyname", false).toBool();
zoneViewSortByType = settings->value("zoneview/sortbytype", false).toBool();
@ -100,11 +101,17 @@ void SettingsCache::setHorizontalHand(int _horizontalHand)
emit horizontalHandChanged();
}
void SettingsCache::setEconomicGrid(int _economicGrid)
void SettingsCache::setEconomicalGrid(int _economicalGrid)
{
economicGrid = _economicGrid;
settings->setValue("table/economic", economicGrid);
emit economicGridChanged();
economicalGrid = _economicalGrid;
settings->setValue("table/economic", economicalGrid);
emit economicalGridChanged();
}
void SettingsCache::setTapAnimation(int _tapAnimation)
{
tapAnimation = _tapAnimation;
settings->setValue("cards/tapanimation", tapAnimation);
}
void SettingsCache::setZoneViewSortByName(int _zoneViewSortByName)

View file

@ -17,7 +17,7 @@ signals:
void cardBackPicturePathChanged();
void picDownloadChanged();
void horizontalHandChanged();
void economicGridChanged();
void economicalGridChanged();
private:
QSettings *settings;
@ -27,7 +27,8 @@ private:
bool picDownload;
bool doubleClickToPlay;
bool horizontalHand;
bool economicGrid;
bool economicalGrid;
bool tapAnimation;
bool zoneViewSortByName, zoneViewSortByType;
public:
SettingsCache();
@ -42,7 +43,8 @@ public:
bool getPicDownload() const { return picDownload; }
bool getDoubleClickToPlay() const { return doubleClickToPlay; }
bool getHorizontalHand() const { return horizontalHand; }
bool getEconomicGrid() const { return economicGrid; }
bool getEconomicalGrid() const { return economicalGrid; }
bool getTapAnimation() const { return tapAnimation; }
bool getZoneViewSortByName() const { return zoneViewSortByName; }
bool getZoneViewSortByType() const { return zoneViewSortByType; }
public slots:
@ -57,7 +59,8 @@ public slots:
void setPicDownload(int _picDownload);
void setDoubleClickToPlay(int _doubleClickToPlay);
void setHorizontalHand(int _horizontalHand);
void setEconomicGrid(int _economicGrid);
void setEconomicalGrid(int _economicalGrid);
void setTapAnimation(int _tapAnimation);
void setZoneViewSortByName(int _zoneViewSortByName);
void setZoneViewSortByType(int _zoneViewSortByType);
};

View file

@ -1,3 +1,4 @@
#include <QLabel>
#include <QTreeView>
#include <QCheckBox>
#include <QPushButton>
@ -338,12 +339,65 @@ void UserList::userClicked(QTreeWidgetItem *item, int /*column*/)
emit openMessageDialog(item->data(2, Qt::UserRole).toString(), true);
}
UserInfoBox::UserInfoBox(AbstractClient *_client, QWidget *parent)
: QWidget(parent)
{
avatarLabel = new QLabel;
nameLabel = new QLabel;
QFont nameFont = nameLabel->font();
nameFont.setBold(true);
nameFont.setPointSize(nameFont.pointSize() * 1.5);
nameLabel->setFont(nameFont);
countryLabel1 = new QLabel;
countryLabel2 = new QLabel;
userLevelLabel1 = new QLabel;
userLevelLabel2 = new QLabel;
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(avatarLabel, 0, 0, 3, 1);
mainLayout->addWidget(nameLabel, 0, 1, 1, 2);
mainLayout->addWidget(countryLabel1, 1, 1, 1, 1);
mainLayout->addWidget(countryLabel2, 1, 2, 1, 1);
mainLayout->addWidget(userLevelLabel1, 2, 1, 1, 1);
mainLayout->addWidget(userLevelLabel2, 2, 2, 1, 1);
setLayout(mainLayout);
Command_GetUserInfo *cmd = new Command_GetUserInfo;
connect(cmd, SIGNAL(finished(ProtocolResponse *)), this, SLOT(processResponse(ProtocolResponse *)));
_client->sendCommand(cmd);
}
void UserInfoBox::retranslateUi()
{
countryLabel1->setText(tr("Location:"));
userLevelLabel1->setText(tr("User level:"));
}
void UserInfoBox::processResponse(ProtocolResponse *response)
{
Response_GetUserInfo *resp = qobject_cast<Response_GetUserInfo *>(response);
if (!resp)
return;
ServerInfo_User *user = resp->getUserInfo();
QPixmap avatarPixmap;
if (!avatarPixmap.loadFromData(user->getAvatarBmp()))
avatarPixmap = UserLevelPixmapGenerator::generatePixmap(64, user->getUserLevel());
avatarLabel->setPixmap(avatarPixmap);
nameLabel->setText(user->getName());
countryLabel2->setPixmap(CountryPixmapGenerator::generatePixmap(15, user->getCountry()));
userLevelLabel2->setPixmap(UserLevelPixmapGenerator::generatePixmap(15, user->getUserLevel()));
}
TabServer::TabServer(AbstractClient *_client, QWidget *parent)
: Tab(parent), client(_client)
{
gameSelector = new GameSelector(client);
chatChannelSelector = new ChatChannelSelector(client);
serverMessageLog = new ServerMessageLog(client);
userInfoBox = new UserInfoBox(client);
userList = new UserList(client);
connect(gameSelector, SIGNAL(gameJoined(int)), this, SIGNAL(gameJoined(int)));
@ -359,9 +413,13 @@ TabServer::TabServer(AbstractClient *_client, QWidget *parent)
vbox->addWidget(gameSelector);
vbox->addLayout(hbox);
QVBoxLayout *vbox2 = new QVBoxLayout;
vbox2->addWidget(userInfoBox);
vbox2->addWidget(userList);
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addLayout(vbox, 3);
mainLayout->addWidget(userList, 1);
mainLayout->addLayout(vbox2, 1);
setLayout(mainLayout);
}
@ -371,5 +429,6 @@ void TabServer::retranslateUi()
gameSelector->retranslateUi();
chatChannelSelector->retranslateUi();
serverMessageLog->retranslateUi();
userInfoBox->retranslateUi();
userList->retranslateUi();
}

View file

@ -13,6 +13,7 @@ class QTreeWidgetItem;
class QPushButton;
class QCheckBox;
class QTextEdit;
class QLabel;
class GamesModel;
class GamesProxyModel;
@ -101,6 +102,17 @@ public:
void retranslateUi();
};
class UserInfoBox : public QWidget {
Q_OBJECT
private:
QLabel *avatarLabel, *nameLabel, *countryLabel1, *countryLabel2, *userLevelLabel1, *userLevelLabel2;
private slots:
void processResponse(ProtocolResponse *response);
public:
UserInfoBox(AbstractClient *_client, QWidget *parent = 0);
void retranslateUi();
};
class TabServer : public Tab {
Q_OBJECT
signals:
@ -114,6 +126,7 @@ private:
ChatChannelSelector *chatChannelSelector;
ServerMessageLog *serverMessageLog;
UserList *userList;
UserInfoBox *userInfoBox;
public:
TabServer(AbstractClient *_client, QWidget *parent = 0);
void retranslateUi();

View file

@ -12,10 +12,10 @@ TableZone::TableZone(Player *_p, QGraphicsItem *parent)
: CardZone(_p, "table", true, false, true, parent), active(false)
{
connect(settingsCache, SIGNAL(tableBgPathChanged()), this, SLOT(updateBgPixmap()));
connect(settingsCache, SIGNAL(economicGridChanged()), this, SLOT(reorganizeCards()));
connect(settingsCache, SIGNAL(economicalGridChanged()), this, SLOT(reorganizeCards()));
updateBgPixmap();
if (settingsCache->getEconomicGrid())
if (settingsCache->getEconomicalGrid())
height = 2 * boxLineWidth + (int) (14.0 / 3 * CARD_HEIGHT + 3 * paddingY);
else
height = 2 * boxLineWidth + 4 * CARD_HEIGHT + 3 * paddingY;
@ -210,7 +210,7 @@ CardItem *TableZone::getCardFromCoords(const QPointF &point) const
QPointF TableZone::mapFromGrid(const QPoint &gridPoint) const
{
qreal x, y;
if ((gridPoint.y() == 3) && (settingsCache->getEconomicGrid())) {
if ((gridPoint.y() == 3) && (settingsCache->getEconomicalGrid())) {
x = marginX + (CARD_WIDTH * gridPoint.x() + CARD_WIDTH * (gridPoint.x() / 3)) / 2;
y = boxLineWidth + (CARD_HEIGHT + paddingY) * gridPoint.y() + (gridPoint.x() % 3 * CARD_HEIGHT) / 3;
} else {
@ -245,7 +245,7 @@ QPoint TableZone::mapToGrid(const QPointF &mapPoint) const
int resultY = (int) (y / (CARD_HEIGHT + paddingY));
if ((resultY == 3) && (settingsCache->getEconomicGrid()))
if ((resultY == 3) && (settingsCache->getEconomicalGrid()))
return QPoint(
(int) (x * 2 / CARD_WIDTH - floor(x / (2 * CARD_WIDTH))),
3

View file

@ -27,62 +27,66 @@
<context>
<name>AppearanceSettingsPage</name>
<message>
<location filename="../src/dlg_settings.cpp" line="241"/>
<location filename="../src/dlg_settings.cpp" line="255"/>
<source>Zone background pictures</source>
<translation>Hintergrundbilder für Kartenzonen</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="242"/>
<location filename="../src/dlg_settings.cpp" line="256"/>
<source>Path to hand background:</source>
<translation>Hintergrundbild für die Hand:</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="243"/>
<location filename="../src/dlg_settings.cpp" line="257"/>
<source>Path to table background:</source>
<translation>Hintergrundbild für das Spielfeld:</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="244"/>
<location filename="../src/dlg_settings.cpp" line="258"/>
<source>Path to player info background:</source>
<translation>Hintergrundbild für den Spielerbereich:</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="245"/>
<location filename="../src/dlg_settings.cpp" line="259"/>
<source>Path to picture of card back:</source>
<translation>Pfad zum Bild der Kartenrückseite:</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="247"/>
<location filename="../src/dlg_settings.cpp" line="261"/>
<source>Hand layout</source>
<translation>Kartenhand</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="248"/>
<location filename="../src/dlg_settings.cpp" line="262"/>
<source>Display hand horizontally (wastes space)</source>
<translation>Hand horizonal anzeigen (verschwendet Platz)</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="250"/>
<location filename="../src/dlg_settings.cpp" line="264"/>
<source>Table grid layout</source>
<translation>Spielfeldraster</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="251"/>
<source>Economic layout</source>
<location filename="../src/dlg_settings.cpp" line="265"/>
<source>Economical layout</source>
<translation>Platzsparende Anordnung</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="253"/>
<source>Economic layout</source>
<translation type="obsolete">Platzsparende Anordnung</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="267"/>
<source>Zone view layout</source>
<translation>Aussehen des Zonenbetrachters</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="254"/>
<location filename="../src/dlg_settings.cpp" line="268"/>
<source>Sort by name</source>
<translation>nach Namen sortieren</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="255"/>
<location filename="../src/dlg_settings.cpp" line="269"/>
<source>Sort by type</source>
<translation>nach Kartentypen sortieren</translation>
</message>
@ -91,10 +95,10 @@
<translation type="obsolete">standardmäßig alphabetisch sortieren</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="260"/>
<location filename="../src/dlg_settings.cpp" line="270"/>
<location filename="../src/dlg_settings.cpp" line="280"/>
<location filename="../src/dlg_settings.cpp" line="290"/>
<location filename="../src/dlg_settings.cpp" line="296"/>
<location filename="../src/dlg_settings.cpp" line="312"/>
<location filename="../src/dlg_settings.cpp" line="328"/>
<source>Choose path</source>
<translation>Pfad auswählen</translation>
</message>
@ -398,27 +402,27 @@
<context>
<name>ChatChannelSelector</name>
<message>
<location filename="../src/tab_server.cpp" line="151"/>
<location filename="../src/tab_server.cpp" line="152"/>
<source>Chat channels</source>
<translation>Chaträume</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="152"/>
<location filename="../src/tab_server.cpp" line="153"/>
<source>Joi&amp;n</source>
<translation>Teil&amp;nehmen</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="155"/>
<location filename="../src/tab_server.cpp" line="156"/>
<source>Channel</source>
<translation>Raum</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="156"/>
<location filename="../src/tab_server.cpp" line="157"/>
<source>Description</source>
<translation>Beschreibung</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="157"/>
<location filename="../src/tab_server.cpp" line="158"/>
<source>Players</source>
<translation>Spieler</translation>
</message>
@ -854,54 +858,66 @@
<context>
<name>DlgSettings</name>
<message>
<location filename="../src/dlg_settings.cpp" line="476"/>
<location filename="../src/dlg_settings.cpp" line="479"/>
<location filename="../src/dlg_settings.cpp" line="482"/>
<location filename="../src/dlg_settings.cpp" line="527"/>
<location filename="../src/dlg_settings.cpp" line="532"/>
<location filename="../src/dlg_settings.cpp" line="537"/>
<source>Error</source>
<translation>Fehler</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="476"/>
<source>Your card database is invalid. Please check if the path is set correctly.</source>
<translation>Ihre Kartendatenbank ist ungültig. Bitte überprüfen Sie, ob der Pfad korrekt gesetzt ist.</translation>
<translation type="obsolete">Ihre Kartendatenbank ist ungültig. Bitte überprüfen Sie, ob der Pfad korrekt gesetzt ist.</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="479"/>
<source>The path to your deck directory is invalid.</source>
<translation>Der Pfad zum Deckverzeichnis ist ungültig.</translation>
<translation type="obsolete">Der Pfad zum Deckverzeichnis ist ungültig.</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="482"/>
<source>The path to your card pictures directory is invalid.</source>
<translation>Der Pfad zum Kartenbilderverzeichnis ist ungültig.</translation>
<translation type="obsolete">Der Pfad zum Kartenbilderverzeichnis ist ungültig.</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="490"/>
<location filename="../src/dlg_settings.cpp" line="527"/>
<source>Your card database is invalid. Would you like to go back and set the correct path?</source>
<translation>Ihre Kartendatenbank ist ungültig. Möchten Sie zurückgehen und den korrekten Pfad einstellen?</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="532"/>
<source>The path to your deck directory is invalid. Would you like to go back and set the correct path?</source>
<translation>Der Pfad zu Ihrem Deckordner ist ungültig. Möchten Sie zurückgehen und den korrekten Pfad einstellen?</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="537"/>
<source>The path to your card pictures directory is invalid. Would you like to go back and set the correct path?</source>
<translation>Der Pfad zu Ihrem Kartenbilderordner ist ungültig. Möchten Sie zurückgehen und den korrekten Pfad einstellen?</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="546"/>
<source>Settings</source>
<translation>Einstellungen</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="492"/>
<location filename="../src/dlg_settings.cpp" line="548"/>
<source>General</source>
<translation>Allgemeines</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="493"/>
<location filename="../src/dlg_settings.cpp" line="549"/>
<source>Appearance</source>
<translation>Erscheinungsbild</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="494"/>
<location filename="../src/dlg_settings.cpp" line="550"/>
<source>User interface</source>
<translation>Bedienung</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="495"/>
<location filename="../src/dlg_settings.cpp" line="551"/>
<source>Messages</source>
<translation>Nachrichten</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="497"/>
<location filename="../src/dlg_settings.cpp" line="553"/>
<source>&amp;Close</source>
<translation>S&amp;chließen</translation>
</message>
@ -1167,20 +1183,20 @@
<context>
<name>GameSelector</name>
<message>
<location filename="../src/tab_server.cpp" line="115"/>
<location filename="../src/tab_server.cpp" line="116"/>
<source>C&amp;reate</source>
<translation>Spiel e&amp;rstellen</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="116"/>
<location filename="../src/tab_server.cpp" line="117"/>
<source>&amp;Join</source>
<translation>&amp;Teilnehmen</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="78"/>
<location filename="../src/tab_server.cpp" line="79"/>
<location filename="../src/tab_server.cpp" line="80"/>
<location filename="../src/tab_server.cpp" line="81"/>
<location filename="../src/tab_server.cpp" line="82"/>
<source>Error</source>
<translation>Fehler</translation>
</message>
@ -1189,47 +1205,47 @@
<translation type="obsolete">XXX</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="78"/>
<location filename="../src/tab_server.cpp" line="79"/>
<source>Wrong password.</source>
<translation>Falsches Passwort.</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="79"/>
<location filename="../src/tab_server.cpp" line="80"/>
<source>Spectators are not allowed in this game.</source>
<translation>In diesem Spiel sind keine Zuschauer zugelassen.</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="80"/>
<location filename="../src/tab_server.cpp" line="81"/>
<source>The game is already full.</source>
<translation>Das Spiel ist bereits voll.</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="81"/>
<location filename="../src/tab_server.cpp" line="82"/>
<source>The game does not exist any more.</source>
<translation>Dieses Spiel gibt es nicht mehr.</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="97"/>
<location filename="../src/tab_server.cpp" line="98"/>
<source>Join game</source>
<translation>Spiel beitreten</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="97"/>
<location filename="../src/tab_server.cpp" line="98"/>
<source>Password:</source>
<translation>Passwort:</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="113"/>
<location filename="../src/tab_server.cpp" line="114"/>
<source>Games</source>
<translation>Spiele</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="114"/>
<location filename="../src/tab_server.cpp" line="115"/>
<source>&amp;Show full games</source>
<translation>&amp;Volle Spiele anzeigen</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="117"/>
<location filename="../src/tab_server.cpp" line="118"/>
<source>J&amp;oin as spectator</source>
<translation>&amp;Zuschauen</translation>
</message>
@ -2186,12 +2202,12 @@
<context>
<name>MessagesSettingsPage</name>
<message>
<location filename="../src/dlg_settings.cpp" line="379"/>
<location filename="../src/dlg_settings.cpp" line="430"/>
<source>&amp;Add</source>
<translation>&amp;Hinzufügen</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="380"/>
<location filename="../src/dlg_settings.cpp" line="431"/>
<source>&amp;Remove</source>
<translation>&amp;Entfernen</translation>
</message>
@ -2204,12 +2220,12 @@
<translation type="obsolete">Entfernen</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="362"/>
<location filename="../src/dlg_settings.cpp" line="413"/>
<source>Add message</source>
<translation>Nachricht hinzufügen</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="362"/>
<location filename="../src/dlg_settings.cpp" line="413"/>
<source>Message:</source>
<translation>Nachricht:</translation>
</message>
@ -2753,27 +2769,27 @@
<context>
<name>QObject</name>
<message>
<location filename="../../common/decklist.cpp" line="79"/>
<location filename="../../common/decklist.cpp" line="78"/>
<source>Maindeck</source>
<translation>Hauptdeck</translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="81"/>
<location filename="../../common/decklist.cpp" line="80"/>
<source>Sideboard</source>
<translation>Sideboard</translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="229"/>
<location filename="../../common/decklist.cpp" line="228"/>
<source>Cockatrice decks (*.cod)</source>
<translation>Cockatrice Decks (*.cod)</translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="230"/>
<location filename="../../common/decklist.cpp" line="229"/>
<source>Plain text decks (*.dec *.mwDeck)</source>
<translation>Text Decks (*.dec *.mwDeck)</translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="231"/>
<location filename="../../common/decklist.cpp" line="230"/>
<source>All files (*.*)</source>
<translation>Alle Dateien (*.*)</translation>
</message>
@ -2799,7 +2815,7 @@
<context>
<name>ServerMessageLog</name>
<message>
<location filename="../src/tab_server.cpp" line="231"/>
<location filename="../src/tab_server.cpp" line="232"/>
<source>Server messages</source>
<translation>Servernachrichten</translation>
</message>
@ -3050,7 +3066,7 @@ Bitte geben Sie einen Namen ein:</translation>
<context>
<name>TabServer</name>
<message>
<location filename="../src/tab_server.h" line="120"/>
<location filename="../src/tab_server.h" line="133"/>
<source>Server</source>
<translation>Server</translation>
</message>
@ -3070,23 +3086,46 @@ Bitte geben Sie einen Namen ein:</translation>
<translation type="obsolete">Spiel %1</translation>
</message>
</context>
<context>
<name>UserInfoBox</name>
<message>
<location filename="../src/tab_server.cpp" line="373"/>
<source>Location:</source>
<translation>Ort:</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="374"/>
<source>User level:</source>
<translation>Nutzerstatus:</translation>
</message>
</context>
<context>
<name>UserInterfaceSettingsPage</name>
<message>
<location filename="../src/dlg_settings.cpp" line="318"/>
<location filename="../src/dlg_settings.cpp" line="367"/>
<source>General interface settings</source>
<translation>Allgemeine Bedienung</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="319"/>
<location filename="../src/dlg_settings.cpp" line="368"/>
<source>&amp;Double-click cards to play them (instead of single-click)</source>
<translation>Karten durch &amp;Doppelklick ausspielen (statt Einzelklick)</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="369"/>
<source>Animation settings</source>
<translation>Animationseinstellungen</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="370"/>
<source>&amp;Tap/untap animation</source>
<translation>Animiertes &amp;Tappen/Enttappen</translation>
</message>
</context>
<context>
<name>UserList</name>
<message>
<location filename="../src/tab_server.cpp" line="281"/>
<location filename="../src/tab_server.cpp" line="282"/>
<source>Users online: %1</source>
<translation>Benutzer online: %1</translation>
</message>

View file

@ -4,70 +4,70 @@
<context>
<name>AppearanceSettingsPage</name>
<message>
<location filename="../src/dlg_settings.cpp" line="241"/>
<location filename="../src/dlg_settings.cpp" line="255"/>
<source>Zone background pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="242"/>
<location filename="../src/dlg_settings.cpp" line="256"/>
<source>Path to hand background:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="243"/>
<location filename="../src/dlg_settings.cpp" line="257"/>
<source>Path to table background:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="244"/>
<location filename="../src/dlg_settings.cpp" line="258"/>
<source>Path to player info background:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="245"/>
<location filename="../src/dlg_settings.cpp" line="259"/>
<source>Path to picture of card back:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="247"/>
<location filename="../src/dlg_settings.cpp" line="261"/>
<source>Hand layout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="248"/>
<location filename="../src/dlg_settings.cpp" line="262"/>
<source>Display hand horizontally (wastes space)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="250"/>
<location filename="../src/dlg_settings.cpp" line="264"/>
<source>Table grid layout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="251"/>
<source>Economic layout</source>
<location filename="../src/dlg_settings.cpp" line="265"/>
<source>Economical layout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="253"/>
<location filename="../src/dlg_settings.cpp" line="267"/>
<source>Zone view layout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="254"/>
<location filename="../src/dlg_settings.cpp" line="268"/>
<source>Sort by name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="255"/>
<location filename="../src/dlg_settings.cpp" line="269"/>
<source>Sort by type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="260"/>
<location filename="../src/dlg_settings.cpp" line="270"/>
<location filename="../src/dlg_settings.cpp" line="280"/>
<location filename="../src/dlg_settings.cpp" line="290"/>
<location filename="../src/dlg_settings.cpp" line="296"/>
<location filename="../src/dlg_settings.cpp" line="312"/>
<location filename="../src/dlg_settings.cpp" line="328"/>
<source>Choose path</source>
<translation type="unfinished"></translation>
</message>
@ -352,27 +352,27 @@
<context>
<name>ChatChannelSelector</name>
<message>
<location filename="../src/tab_server.cpp" line="151"/>
<location filename="../src/tab_server.cpp" line="152"/>
<source>Chat channels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="152"/>
<location filename="../src/tab_server.cpp" line="153"/>
<source>Joi&amp;n</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="155"/>
<location filename="../src/tab_server.cpp" line="156"/>
<source>Channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="156"/>
<location filename="../src/tab_server.cpp" line="157"/>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="157"/>
<location filename="../src/tab_server.cpp" line="158"/>
<source>Players</source>
<translation type="unfinished"></translation>
</message>
@ -735,54 +735,54 @@
<context>
<name>DlgSettings</name>
<message>
<location filename="../src/dlg_settings.cpp" line="476"/>
<location filename="../src/dlg_settings.cpp" line="479"/>
<location filename="../src/dlg_settings.cpp" line="482"/>
<location filename="../src/dlg_settings.cpp" line="527"/>
<location filename="../src/dlg_settings.cpp" line="532"/>
<location filename="../src/dlg_settings.cpp" line="537"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="476"/>
<source>Your card database is invalid. Please check if the path is set correctly.</source>
<location filename="../src/dlg_settings.cpp" line="527"/>
<source>Your card database is invalid. Would you like to go back and set the correct path?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="479"/>
<source>The path to your deck directory is invalid.</source>
<location filename="../src/dlg_settings.cpp" line="532"/>
<source>The path to your deck directory is invalid. Would you like to go back and set the correct path?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="482"/>
<source>The path to your card pictures directory is invalid.</source>
<location filename="../src/dlg_settings.cpp" line="537"/>
<source>The path to your card pictures directory is invalid. Would you like to go back and set the correct path?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="490"/>
<location filename="../src/dlg_settings.cpp" line="546"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="492"/>
<location filename="../src/dlg_settings.cpp" line="548"/>
<source>General</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="493"/>
<location filename="../src/dlg_settings.cpp" line="549"/>
<source>Appearance</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="494"/>
<location filename="../src/dlg_settings.cpp" line="550"/>
<source>User interface</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="495"/>
<location filename="../src/dlg_settings.cpp" line="551"/>
<source>Messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="497"/>
<location filename="../src/dlg_settings.cpp" line="553"/>
<source>&amp;Close</source>
<translation type="unfinished"></translation>
</message>
@ -790,65 +790,65 @@
<context>
<name>GameSelector</name>
<message>
<location filename="../src/tab_server.cpp" line="115"/>
<location filename="../src/tab_server.cpp" line="116"/>
<source>C&amp;reate</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="116"/>
<location filename="../src/tab_server.cpp" line="117"/>
<source>&amp;Join</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="78"/>
<location filename="../src/tab_server.cpp" line="79"/>
<location filename="../src/tab_server.cpp" line="80"/>
<location filename="../src/tab_server.cpp" line="81"/>
<location filename="../src/tab_server.cpp" line="82"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="78"/>
<location filename="../src/tab_server.cpp" line="79"/>
<source>Wrong password.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="79"/>
<location filename="../src/tab_server.cpp" line="80"/>
<source>Spectators are not allowed in this game.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="80"/>
<location filename="../src/tab_server.cpp" line="81"/>
<source>The game is already full.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="81"/>
<location filename="../src/tab_server.cpp" line="82"/>
<source>The game does not exist any more.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="97"/>
<location filename="../src/tab_server.cpp" line="98"/>
<source>Join game</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="97"/>
<location filename="../src/tab_server.cpp" line="98"/>
<source>Password:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="113"/>
<location filename="../src/tab_server.cpp" line="114"/>
<source>Games</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="114"/>
<location filename="../src/tab_server.cpp" line="115"/>
<source>&amp;Show full games</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="117"/>
<location filename="../src/tab_server.cpp" line="118"/>
<source>J&amp;oin as spectator</source>
<translation type="unfinished"></translation>
</message>
@ -1489,22 +1489,22 @@
<context>
<name>MessagesSettingsPage</name>
<message>
<location filename="../src/dlg_settings.cpp" line="379"/>
<location filename="../src/dlg_settings.cpp" line="430"/>
<source>&amp;Add</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="380"/>
<location filename="../src/dlg_settings.cpp" line="431"/>
<source>&amp;Remove</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="362"/>
<location filename="../src/dlg_settings.cpp" line="413"/>
<source>Add message</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="362"/>
<location filename="../src/dlg_settings.cpp" line="413"/>
<source>Message:</source>
<translation type="unfinished"></translation>
</message>
@ -1876,27 +1876,27 @@
<context>
<name>QObject</name>
<message>
<location filename="../../common/decklist.cpp" line="79"/>
<location filename="../../common/decklist.cpp" line="78"/>
<source>Maindeck</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="81"/>
<location filename="../../common/decklist.cpp" line="80"/>
<source>Sideboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="229"/>
<location filename="../../common/decklist.cpp" line="228"/>
<source>Cockatrice decks (*.cod)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="230"/>
<location filename="../../common/decklist.cpp" line="229"/>
<source>Plain text decks (*.dec *.mwDeck)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="231"/>
<location filename="../../common/decklist.cpp" line="230"/>
<source>All files (*.*)</source>
<translation type="unfinished"></translation>
</message>
@ -1922,7 +1922,7 @@
<context>
<name>ServerMessageLog</name>
<message>
<location filename="../src/tab_server.cpp" line="231"/>
<location filename="../src/tab_server.cpp" line="232"/>
<source>Server messages</source>
<translation type="unfinished"></translation>
</message>
@ -2144,28 +2144,51 @@ Please enter a name:</source>
<context>
<name>TabServer</name>
<message>
<location filename="../src/tab_server.h" line="120"/>
<location filename="../src/tab_server.h" line="133"/>
<source>Server</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserInfoBox</name>
<message>
<location filename="../src/tab_server.cpp" line="373"/>
<source>Location:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="374"/>
<source>User level:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserInterfaceSettingsPage</name>
<message>
<location filename="../src/dlg_settings.cpp" line="318"/>
<location filename="../src/dlg_settings.cpp" line="367"/>
<source>General interface settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="319"/>
<location filename="../src/dlg_settings.cpp" line="368"/>
<source>&amp;Double-click cards to play them (instead of single-click)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="369"/>
<source>Animation settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="370"/>
<source>&amp;Tap/untap animation</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserList</name>
<message>
<location filename="../src/tab_server.cpp" line="281"/>
<location filename="../src/tab_server.cpp" line="282"/>
<source>Users online: %1</source>
<translation type="unfinished"></translation>
</message>

View file

@ -4,70 +4,74 @@
<context>
<name>AppearanceSettingsPage</name>
<message>
<location filename="../src/dlg_settings.cpp" line="241"/>
<location filename="../src/dlg_settings.cpp" line="255"/>
<source>Zone background pictures</source>
<translation>Imagenes de la zona de fondo</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="242"/>
<location filename="../src/dlg_settings.cpp" line="256"/>
<source>Path to hand background:</source>
<translation>Ruta a la imagen de fondo de la mano:</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="243"/>
<location filename="../src/dlg_settings.cpp" line="257"/>
<source>Path to table background:</source>
<translation>Ruta a la imagen de fondo de la mesa:</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="244"/>
<location filename="../src/dlg_settings.cpp" line="258"/>
<source>Path to player info background:</source>
<translation>Ruta a la imagen de fondo de la información del jugador:</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="245"/>
<location filename="../src/dlg_settings.cpp" line="259"/>
<source>Path to picture of card back:</source>
<translation>Ruta al reverso de las cartas:</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="247"/>
<location filename="../src/dlg_settings.cpp" line="261"/>
<source>Hand layout</source>
<translation>Disposición de la mano</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="248"/>
<location filename="../src/dlg_settings.cpp" line="262"/>
<source>Display hand horizontally (wastes space)</source>
<translation>Mostrar la mano horizontalmente (desperdicia espacio)</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="250"/>
<location filename="../src/dlg_settings.cpp" line="264"/>
<source>Table grid layout</source>
<translation>Disposición de la rejilla de la mesa</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="251"/>
<source>Economic layout</source>
<translation>Disposición económica</translation>
<location filename="../src/dlg_settings.cpp" line="265"/>
<source>Economical layout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="253"/>
<source>Economic layout</source>
<translation type="obsolete">Disposición económica</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="267"/>
<source>Zone view layout</source>
<translation>Distribución de la zona de visionado</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="254"/>
<location filename="../src/dlg_settings.cpp" line="268"/>
<source>Sort by name</source>
<translation>Ordenar por nombre</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="255"/>
<location filename="../src/dlg_settings.cpp" line="269"/>
<source>Sort by type</source>
<translation>Ordenar por tipo</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="260"/>
<location filename="../src/dlg_settings.cpp" line="270"/>
<location filename="../src/dlg_settings.cpp" line="280"/>
<location filename="../src/dlg_settings.cpp" line="290"/>
<location filename="../src/dlg_settings.cpp" line="296"/>
<location filename="../src/dlg_settings.cpp" line="312"/>
<location filename="../src/dlg_settings.cpp" line="328"/>
<source>Choose path</source>
<translation>Elija ruta</translation>
</message>
@ -352,27 +356,27 @@
<context>
<name>ChatChannelSelector</name>
<message>
<location filename="../src/tab_server.cpp" line="151"/>
<location filename="../src/tab_server.cpp" line="152"/>
<source>Chat channels</source>
<translation>Canales de Chat</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="152"/>
<location filename="../src/tab_server.cpp" line="153"/>
<source>Joi&amp;n</source>
<translation>E&amp;ntrar</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="155"/>
<location filename="../src/tab_server.cpp" line="156"/>
<source>Channel</source>
<translation>Canal</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="156"/>
<location filename="../src/tab_server.cpp" line="157"/>
<source>Description</source>
<translation>Descripción</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="157"/>
<location filename="../src/tab_server.cpp" line="158"/>
<source>Players</source>
<translation>Jugadores</translation>
</message>
@ -735,54 +739,66 @@
<context>
<name>DlgSettings</name>
<message>
<location filename="../src/dlg_settings.cpp" line="476"/>
<location filename="../src/dlg_settings.cpp" line="479"/>
<location filename="../src/dlg_settings.cpp" line="482"/>
<location filename="../src/dlg_settings.cpp" line="527"/>
<location filename="../src/dlg_settings.cpp" line="532"/>
<location filename="../src/dlg_settings.cpp" line="537"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="476"/>
<source>Your card database is invalid. Please check if the path is set correctly.</source>
<translation>Tu base de datos de cartas es invalida. Por favor, comprueba si la ruta está asignada correctamente.</translation>
<translation type="obsolete">Tu base de datos de cartas es invalida. Por favor, comprueba si la ruta está asignada correctamente.</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="479"/>
<source>The path to your deck directory is invalid.</source>
<translation>La ruta a tu directorio de mazos es invalida.</translation>
<translation type="obsolete">La ruta a tu directorio de mazos es invalida.</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="482"/>
<source>The path to your card pictures directory is invalid.</source>
<translation>La ruta a tu directorio de imagenes de las cartas es invalida.</translation>
<translation type="obsolete">La ruta a tu directorio de imagenes de las cartas es invalida.</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="490"/>
<location filename="../src/dlg_settings.cpp" line="527"/>
<source>Your card database is invalid. Would you like to go back and set the correct path?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="532"/>
<source>The path to your deck directory is invalid. Would you like to go back and set the correct path?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="537"/>
<source>The path to your card pictures directory is invalid. Would you like to go back and set the correct path?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="546"/>
<source>Settings</source>
<translation>Preferencias</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="492"/>
<location filename="../src/dlg_settings.cpp" line="548"/>
<source>General</source>
<translation>General</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="493"/>
<location filename="../src/dlg_settings.cpp" line="549"/>
<source>Appearance</source>
<translation>Apariencia</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="494"/>
<location filename="../src/dlg_settings.cpp" line="550"/>
<source>User interface</source>
<translation>Interfaz de usuario</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="495"/>
<location filename="../src/dlg_settings.cpp" line="551"/>
<source>Messages</source>
<translation>Mensajes</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="497"/>
<location filename="../src/dlg_settings.cpp" line="553"/>
<source>&amp;Close</source>
<translation>&amp;Cerrar</translation>
</message>
@ -790,65 +806,65 @@
<context>
<name>GameSelector</name>
<message>
<location filename="../src/tab_server.cpp" line="115"/>
<location filename="../src/tab_server.cpp" line="116"/>
<source>C&amp;reate</source>
<translation>C&amp;rear</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="116"/>
<location filename="../src/tab_server.cpp" line="117"/>
<source>&amp;Join</source>
<translation>E&amp;ntrar</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="78"/>
<location filename="../src/tab_server.cpp" line="79"/>
<location filename="../src/tab_server.cpp" line="80"/>
<location filename="../src/tab_server.cpp" line="81"/>
<location filename="../src/tab_server.cpp" line="82"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="78"/>
<location filename="../src/tab_server.cpp" line="79"/>
<source>Wrong password.</source>
<translation>Contraseña incorrecta.</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="79"/>
<location filename="../src/tab_server.cpp" line="80"/>
<source>Spectators are not allowed in this game.</source>
<translation>No se permiten espectadores en esta partida.</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="80"/>
<location filename="../src/tab_server.cpp" line="81"/>
<source>The game is already full.</source>
<translation>La partida no tiene plazas libres.</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="81"/>
<location filename="../src/tab_server.cpp" line="82"/>
<source>The game does not exist any more.</source>
<translation>La partida ya no existe.</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="97"/>
<location filename="../src/tab_server.cpp" line="98"/>
<source>Join game</source>
<translation>Entrar en la partida</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="97"/>
<location filename="../src/tab_server.cpp" line="98"/>
<source>Password:</source>
<translation>Contraseña:</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="113"/>
<location filename="../src/tab_server.cpp" line="114"/>
<source>Games</source>
<translation>Partidas</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="114"/>
<location filename="../src/tab_server.cpp" line="115"/>
<source>&amp;Show full games</source>
<translation>&amp;Ver partidas sin plazas libres</translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="117"/>
<location filename="../src/tab_server.cpp" line="118"/>
<source>J&amp;oin as spectator</source>
<translation>Entrar como e&amp;spectador</translation>
</message>
@ -1489,22 +1505,22 @@
<context>
<name>MessagesSettingsPage</name>
<message>
<location filename="../src/dlg_settings.cpp" line="379"/>
<location filename="../src/dlg_settings.cpp" line="430"/>
<source>&amp;Add</source>
<translation>&amp;Añadir</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="380"/>
<location filename="../src/dlg_settings.cpp" line="431"/>
<source>&amp;Remove</source>
<translation>&amp;Quitar</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="362"/>
<location filename="../src/dlg_settings.cpp" line="413"/>
<source>Add message</source>
<translation>Añadir mensaje</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="362"/>
<location filename="../src/dlg_settings.cpp" line="413"/>
<source>Message:</source>
<translation>Mensaje:</translation>
</message>
@ -1888,27 +1904,27 @@
<context>
<name>QObject</name>
<message>
<location filename="../../common/decklist.cpp" line="79"/>
<location filename="../../common/decklist.cpp" line="78"/>
<source>Maindeck</source>
<translation>Mazo principal</translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="81"/>
<location filename="../../common/decklist.cpp" line="80"/>
<source>Sideboard</source>
<translation>Reserva</translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="229"/>
<location filename="../../common/decklist.cpp" line="228"/>
<source>Cockatrice decks (*.cod)</source>
<translation>Mazos de Cockatrice (*.cod)</translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="230"/>
<location filename="../../common/decklist.cpp" line="229"/>
<source>Plain text decks (*.dec *.mwDeck)</source>
<translation>Archivos de texto plano (*.dec *.mwDeck)</translation>
</message>
<message>
<location filename="../../common/decklist.cpp" line="231"/>
<location filename="../../common/decklist.cpp" line="230"/>
<source>All files (*.*)</source>
<translation>Todos los archivos (*.*)</translation>
</message>
@ -1934,7 +1950,7 @@
<context>
<name>ServerMessageLog</name>
<message>
<location filename="../src/tab_server.cpp" line="231"/>
<location filename="../src/tab_server.cpp" line="232"/>
<source>Server messages</source>
<translation>Mensajes del servidor</translation>
</message>
@ -2157,28 +2173,51 @@ Por favor, introduzca un nombre:</translation>
<context>
<name>TabServer</name>
<message>
<location filename="../src/tab_server.h" line="120"/>
<location filename="../src/tab_server.h" line="133"/>
<source>Server</source>
<translation>Servidor</translation>
</message>
</context>
<context>
<name>UserInfoBox</name>
<message>
<location filename="../src/tab_server.cpp" line="373"/>
<source>Location:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tab_server.cpp" line="374"/>
<source>User level:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserInterfaceSettingsPage</name>
<message>
<location filename="../src/dlg_settings.cpp" line="318"/>
<location filename="../src/dlg_settings.cpp" line="367"/>
<source>General interface settings</source>
<translation>Preferencias generales de la interfaz</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="319"/>
<location filename="../src/dlg_settings.cpp" line="368"/>
<source>&amp;Double-click cards to play them (instead of single-click)</source>
<translation>&amp;Doble click en las cartas para jugarlas (en lugar de un solo click)</translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="369"/>
<source>Animation settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/dlg_settings.cpp" line="370"/>
<source>&amp;Tap/untap animation</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserList</name>
<message>
<location filename="../src/tab_server.cpp" line="281"/>
<location filename="../src/tab_server.cpp" line="282"/>
<source>Users online: %1</source>
<translation>Usuarios online: %1</translation>
</message>

27
common/color.h Normal file
View file

@ -0,0 +1,27 @@
#ifndef COLOR_H
#define COLOR_H
#ifdef QT_GUI_LIB
#include <QColor>
#endif
class Color {
private:
int value;
public:
Color(int _value = 0) : value(_value) { }
Color(int r, int g, int b) : value(r * 65536 + g * 256 + b) { }
int getValue() const { return value; }
#ifdef QT_GUI_LIB
Color(const QColor &_color)
{
value = _color.red() * 65536 + _color.green() * 256 + _color.blue();
}
QColor getQColor() const
{
return QColor(value / 65536, (value % 65536) / 256, value % 256);
}
#endif
};
#endif

View file

@ -1,5 +1,4 @@
#include <QFile>
#include <QFileDialog>
#include <QTextStream>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>

View file

@ -5,6 +5,7 @@
#include <QVector>
#include <QPair>
#include <QObject>
#include <QStringList>
#include "serializable_item.h"
class CardDatabase;

View file

@ -38,6 +38,7 @@ void ProtocolItem::initializeHash()
registerSerializableItem("resp", ProtocolResponse::newItem);
ProtocolResponse::initializeHash();
registerSerializableItem("resplist_users", Response_ListUsers::newItem);
registerSerializableItem("respget_user_info", Response_GetUserInfo::newItem);
registerSerializableItem("respdeck_list", Response_DeckList::newItem);
registerSerializableItem("respdeck_download", Response_DeckDownload::newItem);
registerSerializableItem("respdeck_upload", Response_DeckUpload::newItem);
@ -232,6 +233,14 @@ Response_DeckList::Response_DeckList(int _cmdId, ResponseCode _responseCode, Dec
insertItem(_root);
}
Response_GetUserInfo::Response_GetUserInfo(int _cmdId, ResponseCode _responseCode, ServerInfo_User *_user)
: ProtocolResponse(_cmdId, _responseCode, "get_user_info")
{
if (!_user)
_user = new ServerInfo_User;
insertItem(_user);
}
Response_DeckDownload::Response_DeckDownload(int _cmdId, ResponseCode _responseCode, DeckList *_deck)
: ProtocolResponse(_cmdId, _responseCode, "deck_download")
{

View file

@ -38,10 +38,11 @@ enum ItemId {
ItemId_Event_Join = ItemId_Other + 210,
ItemId_Event_Ping = ItemId_Other + 211,
ItemId_Response_ListUsers = ItemId_Other + 300,
ItemId_Response_DeckList = ItemId_Other + 301,
ItemId_Response_DeckDownload = ItemId_Other + 302,
ItemId_Response_DeckUpload = ItemId_Other + 303,
ItemId_Response_DumpZone = ItemId_Other + 304,
ItemId_Response_GetUserInfo = ItemId_Other + 301,
ItemId_Response_DeckList = ItemId_Other + 302,
ItemId_Response_DeckDownload = ItemId_Other + 303,
ItemId_Response_DeckUpload = ItemId_Other + 304,
ItemId_Response_DumpZone = ItemId_Other + 305,
ItemId_Invalid = ItemId_Other + 1000
};
@ -210,6 +211,15 @@ public:
QList<ServerInfo_User *> getUserList() const { return typecastItemList<ServerInfo_User *>(); }
};
class Response_GetUserInfo : public ProtocolResponse {
Q_OBJECT
public:
Response_GetUserInfo(int _cmdId = -1, ResponseCode _responseCode = RespOk, ServerInfo_User *_userInfo = 0);
int getItemId() const { return ItemId_Response_GetUserInfo; }
static SerializableItem *newItem() { return new Response_GetUserInfo; }
ServerInfo_User *getUserInfo() const { return static_cast<ServerInfo_User *>(itemMap.value("user")); }
};
class Response_DeckList : public ProtocolResponse {
Q_OBJECT
public:

View file

@ -12,12 +12,13 @@ ServerInfo_ChatChannel::ServerInfo_ChatChannel(const QString &_name, const QStri
insertItem(new SerializableItem_Bool("auto_join", _autoJoin));
}
ServerInfo_User::ServerInfo_User(const QString &_name, int _userLevel, const QString &_country)
ServerInfo_User::ServerInfo_User(const QString &_name, int _userLevel, const QString &_country, const QByteArray &_avatarBmp)
: SerializableItem_Map("user")
{
insertItem(new SerializableItem_String("name", _name));
insertItem(new SerializableItem_Int("userlevel", _userLevel));
insertItem(new SerializableItem_String("country", _country));
insertItem(new SerializableItem_ByteArray("avatar_bmp", _avatarBmp));
}
ServerInfo_User::ServerInfo_User(const ServerInfo_User *other)
@ -26,6 +27,7 @@ ServerInfo_User::ServerInfo_User(const ServerInfo_User *other)
insertItem(new SerializableItem_String("name", other->getName()));
insertItem(new SerializableItem_Int("userlevel", other->getUserLevel()));
insertItem(new SerializableItem_String("country", other->getCountry()));
insertItem(new SerializableItem_ByteArray("avatar_bmp", other->getAvatarBmp()));
}
ServerInfo_Game::ServerInfo_Game(int _gameId, const QString &_description, bool _hasPassword, int _playerCount, int _maxPlayers, ServerInfo_User *_creatorInfo, bool _spectatorsAllowed, bool _spectatorsNeedPassword, int _spectatorCount)
@ -113,7 +115,7 @@ QList<ServerInfo_Card *> ServerInfo_Zone::getCardList() const
return result;
}
ServerInfo_Counter::ServerInfo_Counter(int _id, const QString &_name, const QColor &_color, int _radius, int _count)
ServerInfo_Counter::ServerInfo_Counter(int _id, const QString &_name, const Color &_color, int _radius, int _count)
: SerializableItem_Map("counter")
{
insertItem(new SerializableItem_Int("id", _id));
@ -123,7 +125,7 @@ ServerInfo_Counter::ServerInfo_Counter(int _id, const QString &_name, const QCol
insertItem(new SerializableItem_Int("count", _count));
}
ServerInfo_Arrow::ServerInfo_Arrow(int _id, int _startPlayerId, const QString &_startZone, int _startCardId, int _targetPlayerId, const QString &_targetZone, int _targetCardId, const QColor &_color)
ServerInfo_Arrow::ServerInfo_Arrow(int _id, int _startPlayerId, const QString &_startZone, int _startCardId, int _targetPlayerId, const QString &_targetZone, int _targetCardId, const Color &_color)
: SerializableItem_Map("arrow")
{
insertItem(new SerializableItem_Int("id", _id));

View file

@ -2,9 +2,9 @@
#define PROTOCOL_DATASTRUCTURES_H
#include <QString>
#include <QColor>
#include <QDateTime>
#include "serializable_item.h"
#include "color.h"
class DeckList;
@ -39,13 +39,14 @@ public:
IsJudge = 0x04,
IsAdmin = 0x08
};
ServerInfo_User(const QString &_name = QString(), int _userLevel = IsNothing, const QString &_country = QString());
ServerInfo_User(const QString &_name = QString(), int _userLevel = IsNothing, const QString &_country = QString(), const QByteArray &_avatarBmp = QByteArray());
ServerInfo_User(const ServerInfo_User *other);
static SerializableItem *newItem() { return new ServerInfo_User; }
QString getName() const { return static_cast<SerializableItem_String *>(itemMap.value("name"))->getData(); }
int getUserLevel() const { return static_cast<SerializableItem_Int *>(itemMap.value("userlevel"))->getData(); }
void setUserLevel(int _userLevel) { static_cast<SerializableItem_Int *>(itemMap.value("userlevel"))->setData(_userLevel); }
QString getCountry() const { return static_cast<SerializableItem_String *>(itemMap.value("country"))->getData(); }
QByteArray getAvatarBmp() const { return static_cast<SerializableItem_ByteArray *>(itemMap.value("avatar_bmp"))->getData(); }
};
class ServerInfo_Game : public SerializableItem_Map {
@ -107,18 +108,18 @@ public:
class ServerInfo_Counter : public SerializableItem_Map {
public:
ServerInfo_Counter(int _id = -1, const QString &_name = QString(), const QColor &_color = QColor(), int _radius = -1, int _count = -1);
ServerInfo_Counter(int _id = -1, const QString &_name = QString(), const Color &_color = Color(), int _radius = -1, int _count = -1);
static SerializableItem *newItem() { return new ServerInfo_Counter; }
int getId() const { return static_cast<SerializableItem_Int *>(itemMap.value("id"))->getData(); }
QString getName() const { return static_cast<SerializableItem_String *>(itemMap.value("name"))->getData(); }
QColor getColor() const { return static_cast<SerializableItem_Color *>(itemMap.value("color"))->getData(); }
Color getColor() const { return static_cast<SerializableItem_Color *>(itemMap.value("color"))->getData(); }
int getRadius() const { return static_cast<SerializableItem_Int *>(itemMap.value("radius"))->getData(); }
int getCount() const { return static_cast<SerializableItem_Int *>(itemMap.value("count"))->getData(); }
};
class ServerInfo_Arrow : public SerializableItem_Map {
public:
ServerInfo_Arrow(int _id = -1, int _startPlayerId = -1, const QString &_startZone = QString(), int _startCardId = -1, int _targetPlayerId = -1, const QString &_targetZone = QString(), int _targetCardId = -1, const QColor &_color = QColor());
ServerInfo_Arrow(int _id = -1, int _startPlayerId = -1, const QString &_startZone = QString(), int _startCardId = -1, int _targetPlayerId = -1, const QString &_targetZone = QString(), int _targetCardId = -1, const Color &_color = Color());
static SerializableItem *newItem() { return new ServerInfo_Arrow; }
int getId() const { return static_cast<SerializableItem_Int *>(itemMap.value("id"))->getData(); }
int getStartPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("start_player_id"))->getData(); }
@ -127,7 +128,7 @@ public:
int getTargetPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("target_player_id"))->getData(); }
QString getTargetZone() const { return static_cast<SerializableItem_String *>(itemMap.value("target_zone"))->getData(); }
int getTargetCardId() const { return static_cast<SerializableItem_Int *>(itemMap.value("target_card_id"))->getData(); }
QColor getColor() const { return static_cast<SerializableItem_Color *>(itemMap.value("color"))->getData(); }
Color getColor() const { return static_cast<SerializableItem_Color *>(itemMap.value("color"))->getData(); }
};
class ServerInfo_PlayerProperties : public SerializableItem_Map {

View file

@ -2,71 +2,72 @@ enum AutoItemId {
ItemId_Command_Ping = 1001,
ItemId_Command_Login = 1002,
ItemId_Command_Message = 1003,
ItemId_Command_DeckList = 1004,
ItemId_Command_DeckNewDir = 1005,
ItemId_Command_DeckDelDir = 1006,
ItemId_Command_DeckDel = 1007,
ItemId_Command_DeckDownload = 1008,
ItemId_Command_ListChatChannels = 1009,
ItemId_Command_ChatJoinChannel = 1010,
ItemId_Command_ChatLeaveChannel = 1011,
ItemId_Command_ChatSay = 1012,
ItemId_Command_ListGames = 1013,
ItemId_Command_ListUsers = 1014,
ItemId_Command_CreateGame = 1015,
ItemId_Command_JoinGame = 1016,
ItemId_Command_LeaveGame = 1017,
ItemId_Command_Say = 1018,
ItemId_Command_Shuffle = 1019,
ItemId_Command_Mulligan = 1020,
ItemId_Command_RollDie = 1021,
ItemId_Command_DrawCards = 1022,
ItemId_Command_MoveCard = 1023,
ItemId_Command_FlipCard = 1024,
ItemId_Command_AttachCard = 1025,
ItemId_Command_CreateToken = 1026,
ItemId_Command_CreateArrow = 1027,
ItemId_Command_DeleteArrow = 1028,
ItemId_Command_SetCardAttr = 1029,
ItemId_Command_SetCardCounter = 1030,
ItemId_Command_IncCardCounter = 1031,
ItemId_Command_ReadyStart = 1032,
ItemId_Command_Concede = 1033,
ItemId_Command_IncCounter = 1034,
ItemId_Command_CreateCounter = 1035,
ItemId_Command_SetCounter = 1036,
ItemId_Command_DelCounter = 1037,
ItemId_Command_NextTurn = 1038,
ItemId_Command_SetActivePhase = 1039,
ItemId_Command_DumpZone = 1040,
ItemId_Command_StopDumpZone = 1041,
ItemId_Event_Say = 1042,
ItemId_Event_Leave = 1043,
ItemId_Event_GameClosed = 1044,
ItemId_Event_Shuffle = 1045,
ItemId_Event_RollDie = 1046,
ItemId_Event_MoveCard = 1047,
ItemId_Event_FlipCard = 1048,
ItemId_Event_DestroyCard = 1049,
ItemId_Event_AttachCard = 1050,
ItemId_Event_CreateToken = 1051,
ItemId_Event_DeleteArrow = 1052,
ItemId_Event_SetCardAttr = 1053,
ItemId_Event_SetCardCounter = 1054,
ItemId_Event_SetCounter = 1055,
ItemId_Event_DelCounter = 1056,
ItemId_Event_SetActivePlayer = 1057,
ItemId_Event_SetActivePhase = 1058,
ItemId_Event_DumpZone = 1059,
ItemId_Event_StopDumpZone = 1060,
ItemId_Event_ServerMessage = 1061,
ItemId_Event_Message = 1062,
ItemId_Event_GameJoined = 1063,
ItemId_Event_UserLeft = 1064,
ItemId_Event_ChatLeaveChannel = 1065,
ItemId_Event_ChatSay = 1066,
ItemId_Context_ReadyStart = 1067,
ItemId_Context_Concede = 1068,
ItemId_Context_DeckSelect = 1069,
ItemId_Other = 1070
ItemId_Command_GetUserInfo = 1004,
ItemId_Command_DeckList = 1005,
ItemId_Command_DeckNewDir = 1006,
ItemId_Command_DeckDelDir = 1007,
ItemId_Command_DeckDel = 1008,
ItemId_Command_DeckDownload = 1009,
ItemId_Command_ListChatChannels = 1010,
ItemId_Command_ChatJoinChannel = 1011,
ItemId_Command_ChatLeaveChannel = 1012,
ItemId_Command_ChatSay = 1013,
ItemId_Command_ListGames = 1014,
ItemId_Command_ListUsers = 1015,
ItemId_Command_CreateGame = 1016,
ItemId_Command_JoinGame = 1017,
ItemId_Command_LeaveGame = 1018,
ItemId_Command_Say = 1019,
ItemId_Command_Shuffle = 1020,
ItemId_Command_Mulligan = 1021,
ItemId_Command_RollDie = 1022,
ItemId_Command_DrawCards = 1023,
ItemId_Command_MoveCard = 1024,
ItemId_Command_FlipCard = 1025,
ItemId_Command_AttachCard = 1026,
ItemId_Command_CreateToken = 1027,
ItemId_Command_CreateArrow = 1028,
ItemId_Command_DeleteArrow = 1029,
ItemId_Command_SetCardAttr = 1030,
ItemId_Command_SetCardCounter = 1031,
ItemId_Command_IncCardCounter = 1032,
ItemId_Command_ReadyStart = 1033,
ItemId_Command_Concede = 1034,
ItemId_Command_IncCounter = 1035,
ItemId_Command_CreateCounter = 1036,
ItemId_Command_SetCounter = 1037,
ItemId_Command_DelCounter = 1038,
ItemId_Command_NextTurn = 1039,
ItemId_Command_SetActivePhase = 1040,
ItemId_Command_DumpZone = 1041,
ItemId_Command_StopDumpZone = 1042,
ItemId_Event_Say = 1043,
ItemId_Event_Leave = 1044,
ItemId_Event_GameClosed = 1045,
ItemId_Event_Shuffle = 1046,
ItemId_Event_RollDie = 1047,
ItemId_Event_MoveCard = 1048,
ItemId_Event_FlipCard = 1049,
ItemId_Event_DestroyCard = 1050,
ItemId_Event_AttachCard = 1051,
ItemId_Event_CreateToken = 1052,
ItemId_Event_DeleteArrow = 1053,
ItemId_Event_SetCardAttr = 1054,
ItemId_Event_SetCardCounter = 1055,
ItemId_Event_SetCounter = 1056,
ItemId_Event_DelCounter = 1057,
ItemId_Event_SetActivePlayer = 1058,
ItemId_Event_SetActivePhase = 1059,
ItemId_Event_DumpZone = 1060,
ItemId_Event_StopDumpZone = 1061,
ItemId_Event_ServerMessage = 1062,
ItemId_Event_Message = 1063,
ItemId_Event_GameJoined = 1064,
ItemId_Event_UserLeft = 1065,
ItemId_Event_ChatLeaveChannel = 1066,
ItemId_Event_ChatSay = 1067,
ItemId_Context_ReadyStart = 1068,
ItemId_Context_Concede = 1069,
ItemId_Context_DeckSelect = 1070,
ItemId_Other = 1071
};

View file

@ -17,6 +17,11 @@ Command_Message::Command_Message(const QString &_userName, const QString &_text)
insertItem(new SerializableItem_String("user_name", _userName));
insertItem(new SerializableItem_String("text", _text));
}
Command_GetUserInfo::Command_GetUserInfo(const QString &_userName)
: Command("get_user_info")
{
insertItem(new SerializableItem_String("user_name", _userName));
}
Command_DeckList::Command_DeckList()
: Command("deck_list")
{
@ -152,7 +157,7 @@ Command_CreateToken::Command_CreateToken(int _gameId, const QString &_zone, cons
insertItem(new SerializableItem_Int("x", _x));
insertItem(new SerializableItem_Int("y", _y));
}
Command_CreateArrow::Command_CreateArrow(int _gameId, int _startPlayerId, const QString &_startZone, int _startCardId, int _targetPlayerId, const QString &_targetZone, int _targetCardId, const QColor &_color)
Command_CreateArrow::Command_CreateArrow(int _gameId, int _startPlayerId, const QString &_startZone, int _startCardId, int _targetPlayerId, const QString &_targetZone, int _targetCardId, const Color &_color)
: GameCommand("create_arrow", _gameId)
{
insertItem(new SerializableItem_Int("start_player_id", _startPlayerId));
@ -207,7 +212,7 @@ Command_IncCounter::Command_IncCounter(int _gameId, int _counterId, int _delta)
insertItem(new SerializableItem_Int("counter_id", _counterId));
insertItem(new SerializableItem_Int("delta", _delta));
}
Command_CreateCounter::Command_CreateCounter(int _gameId, const QString &_counterName, const QColor &_color, int _radius, int _value)
Command_CreateCounter::Command_CreateCounter(int _gameId, const QString &_counterName, const Color &_color, int _radius, int _value)
: GameCommand("create_counter", _gameId)
{
insertItem(new SerializableItem_String("counter_name", _counterName));
@ -432,6 +437,7 @@ void ProtocolItem::initializeHashAuto()
itemNameHash.insert("cmdping", Command_Ping::newItem);
itemNameHash.insert("cmdlogin", Command_Login::newItem);
itemNameHash.insert("cmdmessage", Command_Message::newItem);
itemNameHash.insert("cmdget_user_info", Command_GetUserInfo::newItem);
itemNameHash.insert("cmddeck_list", Command_DeckList::newItem);
itemNameHash.insert("cmddeck_new_dir", Command_DeckNewDir::newItem);
itemNameHash.insert("cmddeck_del_dir", Command_DeckDelDir::newItem);

View file

@ -1,6 +1,7 @@
0:ping
0:login:s,username:s,password
0:message:s,user_name:s,text
0:get_user_info:s,user_name
0:deck_list
0:deck_new_dir:s,path:s,dir_name
0:deck_del_dir:s,path

View file

@ -28,6 +28,14 @@ public:
static SerializableItem *newItem() { return new Command_Message; }
int getItemId() const { return ItemId_Command_Message; }
};
class Command_GetUserInfo : public Command {
Q_OBJECT
public:
Command_GetUserInfo(const QString &_userName = QString());
QString getUserName() const { return static_cast<SerializableItem_String *>(itemMap.value("user_name"))->getData(); };
static SerializableItem *newItem() { return new Command_GetUserInfo; }
int getItemId() const { return ItemId_Command_GetUserInfo; }
};
class Command_DeckList : public Command {
Q_OBJECT
public:
@ -235,14 +243,14 @@ public:
class Command_CreateArrow : public GameCommand {
Q_OBJECT
public:
Command_CreateArrow(int _gameId = -1, int _startPlayerId = -1, const QString &_startZone = QString(), int _startCardId = -1, int _targetPlayerId = -1, const QString &_targetZone = QString(), int _targetCardId = -1, const QColor &_color = QColor());
Command_CreateArrow(int _gameId = -1, int _startPlayerId = -1, const QString &_startZone = QString(), int _startCardId = -1, int _targetPlayerId = -1, const QString &_targetZone = QString(), int _targetCardId = -1, const Color &_color = Color());
int getStartPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("start_player_id"))->getData(); };
QString getStartZone() const { return static_cast<SerializableItem_String *>(itemMap.value("start_zone"))->getData(); };
int getStartCardId() const { return static_cast<SerializableItem_Int *>(itemMap.value("start_card_id"))->getData(); };
int getTargetPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("target_player_id"))->getData(); };
QString getTargetZone() const { return static_cast<SerializableItem_String *>(itemMap.value("target_zone"))->getData(); };
int getTargetCardId() const { return static_cast<SerializableItem_Int *>(itemMap.value("target_card_id"))->getData(); };
QColor getColor() const { return static_cast<SerializableItem_Color *>(itemMap.value("color"))->getData(); };
Color getColor() const { return static_cast<SerializableItem_Color *>(itemMap.value("color"))->getData(); };
static SerializableItem *newItem() { return new Command_CreateArrow; }
int getItemId() const { return ItemId_Command_CreateArrow; }
};
@ -314,9 +322,9 @@ public:
class Command_CreateCounter : public GameCommand {
Q_OBJECT
public:
Command_CreateCounter(int _gameId = -1, const QString &_counterName = QString(), const QColor &_color = QColor(), int _radius = -1, int _value = -1);
Command_CreateCounter(int _gameId = -1, const QString &_counterName = QString(), const Color &_color = Color(), int _radius = -1, int _value = -1);
QString getCounterName() const { return static_cast<SerializableItem_String *>(itemMap.value("counter_name"))->getData(); };
QColor getColor() const { return static_cast<SerializableItem_Color *>(itemMap.value("color"))->getData(); };
Color getColor() const { return static_cast<SerializableItem_Color *>(itemMap.value("color"))->getData(); };
int getRadius() const { return static_cast<SerializableItem_Int *>(itemMap.value("radius"))->getData(); };
int getValue() const { return static_cast<SerializableItem_Int *>(itemMap.value("value"))->getData(); };
static SerializableItem *newItem() { return new Command_CreateCounter; }

View file

@ -109,9 +109,9 @@ while (<file>) {
$constructorCode .= "\tinsertItem(new SerializableItem_Int(\"$value\", _$prettyVarName));\n";
$getFunctionCode .= "\t$dataType get$prettyVarName2() const { return static_cast<SerializableItem_Int *>(itemMap.value(\"$value\"))->getData(); };\n";
} elsif ($key eq 'c') {
$dataType = 'QColor';
$constructorParamsH .= "const QColor &_$prettyVarName = QColor()";
$constructorParamsCpp .= "const QColor &_$prettyVarName";
$dataType = 'Color';
$constructorParamsH .= "const Color &_$prettyVarName = Color()";
$constructorParamsCpp .= "const Color &_$prettyVarName";
$constructorCode .= "\tinsertItem(new SerializableItem_Color(\"$value\", _$prettyVarName));\n";
$getFunctionCode .= "\t$dataType get$prettyVarName2() const { return static_cast<SerializableItem_Color *>(itemMap.value(\"$value\"))->getData(); };\n";
}

View file

@ -116,29 +116,19 @@ void SerializableItem_Bool::writeElement(QXmlStreamWriter *xml)
xml->writeCharacters(data ? "1" : "0");
}
int SerializableItem_Color::colorToInt(const QColor &color) const
{
return color.red() * 65536 + color.green() * 256 + color.blue();
}
QColor SerializableItem_Color::colorFromInt(int colorValue) const
{
return QColor(colorValue / 65536, (colorValue % 65536) / 256, colorValue % 256);
}
bool SerializableItem_Color::readElement(QXmlStreamReader *xml)
{
if (xml->isCharacters() && !xml->isWhitespace()) {
bool ok;
int colorValue = xml->text().toString().toInt(&ok);
data = ok ? colorFromInt(colorValue) : Qt::black;
data = ok ? Color(colorValue) : Color();
}
return SerializableItem::readElement(xml);
}
void SerializableItem_Color::writeElement(QXmlStreamWriter *xml)
{
xml->writeCharacters(QString::number(colorToInt(data)));
xml->writeCharacters(QString::number(data.getValue()));
}
bool SerializableItem_DateTime::readElement(QXmlStreamReader *xml)
@ -155,3 +145,16 @@ void SerializableItem_DateTime::writeElement(QXmlStreamWriter *xml)
{
xml->writeCharacters(QString::number(data.toTime_t()));
}
bool SerializableItem_ByteArray::readElement(QXmlStreamReader *xml)
{
if (xml->isCharacters() && !xml->isWhitespace())
data = qUncompress(QByteArray::fromBase64(xml->text().toString().toAscii()));
return SerializableItem::readElement(xml);
}
void SerializableItem_ByteArray::writeElement(QXmlStreamWriter *xml)
{
xml->writeCharacters(QString(qCompress(data).toBase64()));
}

View file

@ -6,8 +6,8 @@
#include <QMap>
#include <QList>
#include <QHash>
#include <QColor>
#include <QDateTime>
#include "color.h"
class QXmlStreamReader;
class QXmlStreamWriter;
@ -111,19 +111,17 @@ public:
class SerializableItem_Color : public SerializableItem {
private:
QColor data;
int colorToInt(const QColor &color) const;
QColor colorFromInt(int colorValue) const;
Color data;
protected:
bool readElement(QXmlStreamReader *xml);
void writeElement(QXmlStreamWriter *xml);
public:
SerializableItem_Color(const QString &_itemType, const QColor &_data)
SerializableItem_Color(const QString &_itemType, const Color &_data)
: SerializableItem(_itemType), data(_data) { }
const QColor &getData() { return data; }
void setData(const QColor &_data) { data = _data; }
const Color &getData() { return data; }
void setData(const Color &_data) { data = _data; }
};
class SerializableItem_DateTime : public SerializableItem {
private:
QDateTime data;
@ -137,4 +135,17 @@ public:
void setData(const QDateTime &_data) { data = _data; }
};
class SerializableItem_ByteArray : public SerializableItem {
private:
QByteArray data;
protected:
bool readElement(QXmlStreamReader *xml);
void writeElement(QXmlStreamWriter *xml);
public:
SerializableItem_ByteArray(const QString &_itemType, const QByteArray &_data)
: SerializableItem(_itemType), data(_data) { }
const QByteArray &getData() { return data; }
void setData(const QByteArray &_data) { data = _data; }
};
#endif

View file

@ -56,8 +56,6 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString
}
ServerInfo_User *data = getUserData(name);
if (authState == PasswordRight)
data->setUserLevel(data->getUserLevel() | ServerInfo_User::IsRegistered);
session->setUserInfo(data);
users.insert(name, session);

View file

@ -1,7 +1,7 @@
#ifndef SERVER_ARROW_H
#define SERVER_ARROW_H
#include <QColor>
#include "color.h"
class Server_Card;
class Server_ArrowTarget;
@ -11,14 +11,14 @@ private:
int id;
Server_Card *startCard;
Server_ArrowTarget *targetItem;
QColor color;
Color color;
public:
Server_Arrow(int _id, Server_Card *_startCard, Server_ArrowTarget *_targetItem, const QColor &_color)
Server_Arrow(int _id, Server_Card *_startCard, Server_ArrowTarget *_targetItem, const Color &_color)
: id(_id), startCard(_startCard), targetItem(_targetItem), color(_color) { }
int getId() const { return id; }
Server_Card *getStartCard() const { return startCard; }
Server_ArrowTarget *getTargetItem() const { return targetItem; }
QColor getColor() const { return color; }
const Color &getColor() const { return color; }
};
#endif

View file

@ -21,21 +21,21 @@
#define SERVER_COUNTER_H
#include <QString>
#include <QColor>
#include "color.h"
class Server_Counter {
protected:
int id;
QString name;
QColor color;
Color color;
int radius;
int count;
public:
Server_Counter(int _id, const QString &_name, const QColor &_color, int _radius, int _count = 0) : id(_id), name(_name), color(_color), radius(_radius), count(_count) { }
Server_Counter(int _id, const QString &_name, const Color &_color, int _radius, int _count = 0) : id(_id), name(_name), color(_color), radius(_radius), count(_count) { }
~Server_Counter() { }
int getId() const { return id; }
QString getName() const { return name; }
QColor getColor() const { return color; }
Color getColor() const { return color; }
int getRadius() const { return radius; }
int getCount() const { return count; }
void setCount(int _count) { count = _count; }

View file

@ -67,14 +67,14 @@ void Server_Player::setupZones()
addZone(new Server_CardZone(this, "grave", false, PublicZone));
addZone(new Server_CardZone(this, "rfg", false, PublicZone));
addCounter(new Server_Counter(0, "life", Qt::white, 25, 20));
addCounter(new Server_Counter(1, "w", QColor(255, 255, 150), 20, 0));
addCounter(new Server_Counter(2, "u", QColor(150, 150, 255), 20, 0));
addCounter(new Server_Counter(3, "b", QColor(150, 150, 150), 20, 0));
addCounter(new Server_Counter(4, "r", QColor(250, 150, 150), 20, 0));
addCounter(new Server_Counter(5, "g", QColor(150, 255, 150), 20, 0));
addCounter(new Server_Counter(6, "x", QColor(255, 255, 255), 20, 0));
addCounter(new Server_Counter(7, "storm", QColor(255, 255, 255), 20, 0));
addCounter(new Server_Counter(0, "life", Color(255, 255, 255), 25, 20));
addCounter(new Server_Counter(1, "w", Color(255, 255, 150), 20, 0));
addCounter(new Server_Counter(2, "u", Color(150, 150, 255), 20, 0));
addCounter(new Server_Counter(3, "b", Color(150, 150, 150), 20, 0));
addCounter(new Server_Counter(4, "r", Color(250, 150, 150), 20, 0));
addCounter(new Server_Counter(5, "g", Color(150, 255, 150), 20, 0));
addCounter(new Server_Counter(6, "x", Color(255, 255, 255), 20, 0));
addCounter(new Server_Counter(7, "storm", Color(255, 255, 255), 20, 0));
initialCards = 7;

View file

@ -123,6 +123,7 @@ ResponseCode Server_ProtocolHandler::processCommandHelper(Command *command, Comm
case ItemId_Command_DeckDel: return cmdDeckDel(qobject_cast<Command_DeckDel *>(command), cont);
case ItemId_Command_DeckUpload: return cmdDeckUpload(qobject_cast<Command_DeckUpload *>(command), cont);
case ItemId_Command_DeckDownload: return cmdDeckDownload(qobject_cast<Command_DeckDownload *>(command), cont);
case ItemId_Command_GetUserInfo: return cmdGetUserInfo(qobject_cast<Command_GetUserInfo *>(command), cont);
case ItemId_Command_ListChatChannels: return cmdListChatChannels(qobject_cast<Command_ListChatChannels *>(command), cont);
case ItemId_Command_ChatJoinChannel: return cmdChatJoinChannel(qobject_cast<Command_ChatJoinChannel *>(command), cont);
case ItemId_Command_ListUsers: return cmdListUsers(qobject_cast<Command_ListUsers *>(command), cont);
@ -246,6 +247,25 @@ ResponseCode Server_ProtocolHandler::cmdMessage(Command_Message *cmd, CommandCon
return RespOk;
}
ResponseCode Server_ProtocolHandler::cmdGetUserInfo(Command_GetUserInfo *cmd, CommandContainer *cont)
{
if (authState == PasswordWrong)
return RespLoginNeeded;
ServerInfo_User *result;
if (cmd->getUserName().isEmpty())
result = new ServerInfo_User(userInfo);
else {
Server_ProtocolHandler *handler = server->getUsers().value(cmd->getUserName());
if (!handler)
return RespNameNotFound;
result = handler->getUserInfo();
}
cont->setResponse(new Response_GetUserInfo(cont->getCmdId(), RespOk, result));
return RespNothing;
}
ResponseCode Server_ProtocolHandler::cmdListChatChannels(Command_ListChatChannels * /*cmd*/, CommandContainer *cont)
{
if (authState == PasswordWrong)

View file

@ -44,6 +44,7 @@ private:
virtual ResponseCode cmdDeckDel(Command_DeckDel *cmd, CommandContainer *cont) = 0;
virtual ResponseCode cmdDeckUpload(Command_DeckUpload *cmd, CommandContainer *cont) = 0;
virtual ResponseCode cmdDeckDownload(Command_DeckDownload *cmd, CommandContainer *cont) = 0;
ResponseCode cmdGetUserInfo(Command_GetUserInfo *cmd, CommandContainer *cont);
ResponseCode cmdListChatChannels(Command_ListChatChannels *cmd, CommandContainer *cont);
ResponseCode cmdChatJoinChannel(Command_ChatJoinChannel *cmd, CommandContainer *cont);
ResponseCode cmdChatLeaveChannel(Command_ChatLeaveChannel *cmd, CommandContainer *cont, Server_ChatChannel *channel);

View file

@ -11,9 +11,11 @@ OBJECTS_DIR = build
CONFIG += qt debug
QT += network sql
QT -= gui
HEADERS += src/servatrice.h \
src/serversocketinterface.h \
../common/color.h \
../common/serializable_item.h \
../common/decklist.h \
../common/protocol.h \

View file

@ -20,6 +20,7 @@
#include <QtSql>
#include <QSettings>
#include <QDebug>
#include <iostream>
#include "servatrice.h"
#include "server_chatchannel.h"
#include "serversocketinterface.h"
@ -79,8 +80,12 @@ bool Servatrice::openDatabase()
sqldb.setPassword(settings->value("password").toString());
settings->endGroup();
if (!sqldb.open())
std::cerr << "Opening database...";
if (!sqldb.open()) {
std::cerr << "error" << std::endl;
return false;
}
std::cerr << "OK" << std::endl;
if (!nextGameId) {
QSqlQuery query;
@ -124,7 +129,7 @@ AuthenticationResult Servatrice::checkUserPassword(const QString &user, const QS
checkSql();
QSqlQuery query;
query.prepare("select password from users where name = :name");
query.prepare("select password from users where name = :name and active = 1");
query.bindValue(":name", user);
if (!execSqlQuery(query))
return PasswordWrong;
@ -147,7 +152,7 @@ ServerInfo_User *Servatrice::getUserData(const QString &name)
checkSql();
QSqlQuery query;
query.prepare("select admin, country from users where name = :name");
query.prepare("select admin, country, avatar_bmp from users where name = :name and active = 1");
query.bindValue(":name", name);
if (!execSqlQuery(query))
return new ServerInfo_User(name);
@ -155,15 +160,17 @@ ServerInfo_User *Servatrice::getUserData(const QString &name)
if (query.next()) {
bool is_admin = query.value(0).toInt();
QString country = query.value(1).toString();
QByteArray avatarBmp = query.value(2).toByteArray();
int userLevel = ServerInfo_User::IsUser;
int userLevel = ServerInfo_User::IsUser | ServerInfo_User::IsRegistered;
if (is_admin)
userLevel |= ServerInfo_User::IsAdmin;
return new ServerInfo_User(
name,
userLevel,
country
country,
avatarBmp
);
} else
return new ServerInfo_User(name);
@ -171,4 +178,4 @@ ServerInfo_User *Servatrice::getUserData(const QString &name)
return new ServerInfo_User(name);
}
const QString Servatrice::versionString = "Servatrice 0.20100918";
const QString Servatrice::versionString = "Servatrice 0.20101009";