ZoneView improvements
This commit is contained in:
parent
88829d0f66
commit
939ab62273
19 changed files with 90 additions and 63 deletions
|
@ -12,5 +12,5 @@ QT += network
|
||||||
#QTPLUGIN += qjpeg
|
#QTPLUGIN += qjpeg
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
HEADERS += src/counter.h src/dlg_games.h src/dlg_creategame.h src/dlg_connect.h src/gamesmodel.h src/client.h src/window_main.h src/servergame.h src/servereventdata.h src/serverresponse.h src/pendingcommand.h src/zonelist.h src/counterlist.h src/cardzone.h src/player.h src/cardlist.h src/carditem.h src/tablezone.h src/handzone.h src/playerlist.h src/game.h src/carddatabase.h src/gameview.h src/decklistmodel.h src/dlg_startgame.h src/cardinfowidget.h src/messagelogwidget.h src/serverzonecard.h src/zoneviewzone.h src/zoneviewwidget.h src/libraryzone.h src/gravezone.h src/rfgzone.h src/sideboardzone.h src/carddragitem.h src/zoneclosebutton.h src/zoneviewlayout.h src/playerarea.h src/carddatabasemodel.h src/window_deckeditor.h
|
HEADERS += src/counter.h src/dlg_games.h src/dlg_creategame.h src/dlg_connect.h src/gamesmodel.h src/client.h src/window_main.h src/servergame.h src/servereventdata.h src/serverresponse.h src/pendingcommand.h src/zonelist.h src/counterlist.h src/cardzone.h src/player.h src/cardlist.h src/carditem.h src/tablezone.h src/handzone.h src/playerlist.h src/game.h src/carddatabase.h src/gameview.h src/decklistmodel.h src/dlg_startgame.h src/cardinfowidget.h src/messagelogwidget.h src/serverzonecard.h src/zoneviewzone.h src/zoneviewwidget.h src/libraryzone.h src/gravezone.h src/rfgzone.h src/sideboardzone.h src/carddragitem.h src/zoneviewlayout.h src/playerarea.h src/carddatabasemodel.h src/window_deckeditor.h
|
||||||
SOURCES += src/counter.cpp src/dlg_games.cpp src/dlg_creategame.cpp src/dlg_connect.cpp src/client.cpp src/main.cpp src/window_main.cpp src/servereventdata.cpp src/gamesmodel.cpp src/player.cpp src/cardzone.cpp src/zonelist.cpp src/counterlist.cpp src/cardlist.cpp src/carditem.cpp src/tablezone.cpp src/handzone.cpp src/playerlist.cpp src/game.cpp src/carddatabase.cpp src/gameview.cpp src/decklistmodel.cpp src/dlg_startgame.cpp src/cardinfowidget.cpp src/messagelogwidget.cpp src/zoneviewzone.cpp src/zoneviewwidget.cpp src/libraryzone.cpp src/gravezone.cpp src/rfgzone.cpp src/sideboardzone.cpp src/carddragitem.cpp src/zoneclosebutton.cpp src/zoneviewlayout.cpp src/playerarea.cpp src/carddatabasemodel.cpp src/window_deckeditor.cpp
|
SOURCES += src/counter.cpp src/dlg_games.cpp src/dlg_creategame.cpp src/dlg_connect.cpp src/client.cpp src/main.cpp src/window_main.cpp src/servereventdata.cpp src/gamesmodel.cpp src/player.cpp src/cardzone.cpp src/zonelist.cpp src/counterlist.cpp src/cardlist.cpp src/carditem.cpp src/tablezone.cpp src/handzone.cpp src/playerlist.cpp src/game.cpp src/carddatabase.cpp src/gameview.cpp src/decklistmodel.cpp src/dlg_startgame.cpp src/cardinfowidget.cpp src/messagelogwidget.cpp src/zoneviewzone.cpp src/zoneviewwidget.cpp src/libraryzone.cpp src/gravezone.cpp src/rfgzone.cpp src/sideboardzone.cpp src/carddragitem.cpp src/zoneviewlayout.cpp src/playerarea.cpp src/carddatabasemodel.cpp src/window_deckeditor.cpp
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "zoneviewzone.h"
|
#include "zoneviewzone.h"
|
||||||
|
|
||||||
CardZone::CardZone(Player *_p, const QString &_name, QGraphicsItem *parent, bool isView)
|
CardZone::CardZone(Player *_p, const QString &_name, bool _hasCardAttr, bool _isShufflable, QGraphicsItem *parent, bool isView)
|
||||||
: QGraphicsItem(parent), player(_p), name(_name), cards(NULL), menu(NULL), hasCardAttr(false)
|
: QGraphicsItem(parent), player(_p), name(_name), cards(NULL), menu(NULL), hasCardAttr(_hasCardAttr), isShufflable(_isShufflable)
|
||||||
{
|
{
|
||||||
if (!isView)
|
if (!isView)
|
||||||
player->addZone(this);
|
player->addZone(this);
|
||||||
|
|
|
@ -17,15 +17,17 @@ protected:
|
||||||
QList<ZoneViewZone *> views;
|
QList<ZoneViewZone *> views;
|
||||||
QMenu *menu;
|
QMenu *menu;
|
||||||
bool hasCardAttr;
|
bool hasCardAttr;
|
||||||
|
bool isShufflable;
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||||
public:
|
public:
|
||||||
enum { Type = typeZone };
|
enum { Type = typeZone };
|
||||||
int type() const { return Type; }
|
int type() const { return Type; }
|
||||||
virtual void handleDropEvent(int cardId, CardZone *startZone, const QPoint &dropPoint, bool faceDown) = 0;
|
virtual void handleDropEvent(int cardId, CardZone *startZone, const QPoint &dropPoint, bool faceDown) = 0;
|
||||||
CardZone(Player *_player, const QString &_name, QGraphicsItem *parent = 0, bool isView = false);
|
CardZone(Player *_player, const QString &_name, bool _hasCardAttr, bool _isShufflable, QGraphicsItem *parent = 0, bool isView = false);
|
||||||
~CardZone();
|
~CardZone();
|
||||||
void clearContents();
|
void clearContents();
|
||||||
bool getHasCardAttr() const { return hasCardAttr; }
|
bool getHasCardAttr() const { return hasCardAttr; }
|
||||||
|
bool getIsShufflable() const { return isShufflable; }
|
||||||
QMenu *getMenu() const { return menu; }
|
QMenu *getMenu() const { return menu; }
|
||||||
void setMenu(QMenu *_menu) { menu = _menu; }
|
void setMenu(QMenu *_menu) { menu = _menu; }
|
||||||
QString getName() const { return name; }
|
QString getName() const { return name; }
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "zoneviewzone.h"
|
#include "zoneviewzone.h"
|
||||||
|
|
||||||
GraveZone::GraveZone(Player *_p, QGraphicsItem *parent)
|
GraveZone::GraveZone(Player *_p, QGraphicsItem *parent)
|
||||||
: CardZone(_p, "grave", parent)
|
: CardZone(_p, "grave", false, false, parent)
|
||||||
{
|
{
|
||||||
cards = new CardList(true);
|
cards = new CardList(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
HandZone::HandZone(Player *_p, QGraphicsItem *parent)
|
HandZone::HandZone(Player *_p, QGraphicsItem *parent)
|
||||||
: CardZone(_p, "hand", parent)
|
: CardZone(_p, "hand", false, false, parent)
|
||||||
{
|
{
|
||||||
cards = new CardList(player->getLocal());
|
cards = new CardList(player->getLocal());
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "zoneviewzone.h"
|
#include "zoneviewzone.h"
|
||||||
|
|
||||||
LibraryZone::LibraryZone(Player *_p, QGraphicsItem *parent)
|
LibraryZone::LibraryZone(Player *_p, QGraphicsItem *parent)
|
||||||
: CardZone(_p, "deck", parent)
|
: CardZone(_p, "deck", false, true, parent)
|
||||||
{
|
{
|
||||||
cards = new CardList(false);
|
cards = new CardList(false);
|
||||||
setCursor(Qt::OpenHandCursor);
|
setCursor(Qt::OpenHandCursor);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "zoneviewzone.h"
|
#include "zoneviewzone.h"
|
||||||
|
|
||||||
RfgZone::RfgZone(Player *_p, QGraphicsItem *parent)
|
RfgZone::RfgZone(Player *_p, QGraphicsItem *parent)
|
||||||
: CardZone(_p, "rfg", parent)
|
: CardZone(_p, "rfg", false, false, parent)
|
||||||
{
|
{
|
||||||
cards = new CardList(true);
|
cards = new CardList(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "zoneviewzone.h"
|
#include "zoneviewzone.h"
|
||||||
|
|
||||||
SideboardZone::SideboardZone(Player *_p, QGraphicsItem *parent)
|
SideboardZone::SideboardZone(Player *_p, QGraphicsItem *parent)
|
||||||
: CardZone(_p, "sb", parent)
|
: CardZone(_p, "sb", false, false, parent)
|
||||||
{
|
{
|
||||||
cards = new CardList(false);
|
cards = new CardList(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
TableZone::TableZone(Player *_p, QGraphicsItem *parent)
|
TableZone::TableZone(Player *_p, QGraphicsItem *parent)
|
||||||
: CardZone(_p, "table", parent), width(720), height(510)
|
: CardZone(_p, "table", true, false, parent), width(720), height(510)
|
||||||
{
|
{
|
||||||
cards = new CardList(true);
|
cards = new CardList(true);
|
||||||
hasCardAttr = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF TableZone::boundingRect() const
|
QRectF TableZone::boundingRect() const
|
||||||
|
|
|
@ -181,6 +181,11 @@ void MainWindow::createActions()
|
||||||
connect(aDeckEditor, SIGNAL(triggered()), this, SLOT(actDeckEditor()));
|
connect(aDeckEditor, SIGNAL(triggered()), this, SLOT(actDeckEditor()));
|
||||||
aExit = new QAction(tr("&Exit"), this);
|
aExit = new QAction(tr("&Exit"), this);
|
||||||
connect(aExit, SIGNAL(triggered()), this, SLOT(actExit()));
|
connect(aExit, SIGNAL(triggered()), this, SLOT(actExit()));
|
||||||
|
|
||||||
|
aCloseMostRecentZoneView = new QAction(tr("Close most recent zone view"), this);
|
||||||
|
aCloseMostRecentZoneView->setShortcut(tr("Esc"));
|
||||||
|
connect(aCloseMostRecentZoneView, SIGNAL(triggered()), zoneLayout, SLOT(closeMostRecentZoneView()));
|
||||||
|
addAction(aCloseMostRecentZoneView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::createMenus()
|
void MainWindow::createMenus()
|
||||||
|
@ -208,8 +213,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
// setWindowState(windowState() | Qt::WindowFullScreen);
|
// setWindowState(windowState() | Qt::WindowFullScreen);
|
||||||
|
|
||||||
QPixmapCache::setCacheLimit(200000);
|
QPixmapCache::setCacheLimit(200000);
|
||||||
createActions();
|
|
||||||
createMenus();
|
|
||||||
|
|
||||||
db = new CardDatabase;
|
db = new CardDatabase;
|
||||||
int cardCount = db->loadFromFile("../cards.dat");
|
int cardCount = db->loadFromFile("../cards.dat");
|
||||||
|
@ -262,6 +265,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
connect(client, SIGNAL(welcomeMsgReceived(const QStringList)), messageLog, SLOT(logConnected(const QStringList)));
|
connect(client, SIGNAL(welcomeMsgReceived(const QStringList)), messageLog, SLOT(logConnected(const QStringList)));
|
||||||
connect(this, SIGNAL(logDisconnected()), messageLog, SLOT(logDisconnected()));
|
connect(this, SIGNAL(logDisconnected()), messageLog, SLOT(logDisconnected()));
|
||||||
connect(client, SIGNAL(logSocketError(const QString &)), messageLog, SLOT(logSocketError(const QString &)));
|
connect(client, SIGNAL(logSocketError(const QString &)), messageLog, SLOT(logSocketError(const QString &)));
|
||||||
|
|
||||||
|
createActions();
|
||||||
|
createMenus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
|
|
|
@ -66,6 +66,7 @@ private:
|
||||||
void createMenus();
|
void createMenus();
|
||||||
QMenu *gameMenu, *actionsMenu, *cardMenu;
|
QMenu *gameMenu, *actionsMenu, *cardMenu;
|
||||||
QAction *aConnect, *aDisconnect, *aGames, *aRestartGame, *aLeaveGame, *aDeckEditor, *aExit;
|
QAction *aConnect, *aDisconnect, *aGames, *aRestartGame, *aLeaveGame, *aDeckEditor, *aExit;
|
||||||
|
QAction *aCloseMostRecentZoneView;
|
||||||
|
|
||||||
CardInfoWidget *cardInfo;
|
CardInfoWidget *cardInfo;
|
||||||
MessageLogWidget *messageLog;
|
MessageLogWidget *messageLog;
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
#include <QtGui>
|
|
||||||
#include "zoneclosebutton.h"
|
|
||||||
|
|
||||||
void ZoneCloseButton::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
emit triggered();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ZoneCloseButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
|
||||||
{
|
|
||||||
painter->fillRect(rect(), QColor("red"));
|
|
||||||
}
|
|
||||||
|
|
||||||
ZoneCloseButton::ZoneCloseButton(QGraphicsItem *parent)
|
|
||||||
: QGraphicsWidget(parent)
|
|
||||||
{
|
|
||||||
resize(20, 20);
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
#ifndef ZONECLOSEBUTTON_H
|
|
||||||
#define ZONECLOSEBUTTON_H
|
|
||||||
|
|
||||||
#include <QGraphicsWidget>
|
|
||||||
|
|
||||||
class ZoneCloseButton : public QGraphicsWidget {
|
|
||||||
Q_OBJECT
|
|
||||||
signals:
|
|
||||||
void triggered();
|
|
||||||
protected:
|
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
||||||
public:
|
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
|
||||||
ZoneCloseButton(QGraphicsItem *parent = 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -11,10 +11,22 @@ ZoneViewLayout::ZoneViewLayout(CardDatabase *_db, QGraphicsItem *parent)
|
||||||
void ZoneViewLayout::reorganize()
|
void ZoneViewLayout::reorganize()
|
||||||
{
|
{
|
||||||
qDebug(QString("ZoneViewLayout: activate: count=%1").arg(views.size()).toLatin1());
|
qDebug(QString("ZoneViewLayout: activate: count=%1").arg(views.size()).toLatin1());
|
||||||
resize(views.size() * 150, 1000);
|
if (views.isEmpty()) {
|
||||||
for (int i = 0; i < views.size(); i++) {
|
resize(0, 0);
|
||||||
views.at(i)->setPos(i * 150, 0);
|
emit sizeChanged();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
qreal x, y;
|
||||||
|
views.at(0)->getWindowFrameMargins(&x, &y, 0, 0);
|
||||||
|
qreal totalWidth = x;
|
||||||
|
for (int i = 0; i < views.size(); i++) {
|
||||||
|
QRectF viewSize = views.at(i)->windowFrameRect();
|
||||||
|
qreal w = viewSize.right() - viewSize.left();
|
||||||
|
qreal h = viewSize.bottom() - viewSize.top();
|
||||||
|
views.at(i)->setPos(totalWidth, y);
|
||||||
|
totalWidth += w;
|
||||||
|
}
|
||||||
|
resize(totalWidth, scene()->sceneRect().height());
|
||||||
emit sizeChanged();
|
emit sizeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +43,12 @@ void ZoneViewLayout::removeItem(ZoneViewWidget *item)
|
||||||
qDebug("ZoneViewLayout::removeItem");
|
qDebug("ZoneViewLayout::removeItem");
|
||||||
views.removeAt(views.indexOf(item));
|
views.removeAt(views.indexOf(item));
|
||||||
scene()->removeItem(item);
|
scene()->removeItem(item);
|
||||||
delete item;
|
|
||||||
reorganize();
|
reorganize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ZoneViewLayout::closeMostRecentZoneView()
|
||||||
|
{
|
||||||
|
if (views.isEmpty())
|
||||||
|
return;
|
||||||
|
views.at(views.size() - 1)->close();
|
||||||
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void addItem(Player *player, const QString &zoneName, int numberCards = 0);
|
void addItem(Player *player, const QString &zoneName, int numberCards = 0);
|
||||||
void removeItem(ZoneViewWidget *item);
|
void removeItem(ZoneViewWidget *item);
|
||||||
|
void closeMostRecentZoneView();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,18 +5,41 @@
|
||||||
#include "zoneviewzone.h"
|
#include "zoneviewzone.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "zoneclosebutton.h"
|
|
||||||
|
|
||||||
ZoneViewWidget::ZoneViewWidget(CardDatabase *_db, Player *_player, CardZone *_origZone, int numberCards, QGraphicsItem *parent)
|
ZoneViewWidget::ZoneViewWidget(CardDatabase *_db, Player *_player, CardZone *_origZone, int numberCards, QGraphicsItem *parent)
|
||||||
: QGraphicsWidget(parent), db(_db), player(_player)
|
: QGraphicsWidget(parent, Qt::Tool | Qt::CustomizeWindowHint | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), db(_db), player(_player)
|
||||||
{
|
{
|
||||||
ZoneCloseButton *closeButton = new ZoneCloseButton(this);
|
setWindowTitle(QString("%1's %2").arg(player->getName()).arg(_origZone->getName()));
|
||||||
connect(closeButton, SIGNAL(triggered()), this, SLOT(slotClosePressed()));
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
resize(150, 1000);
|
qreal y = 10;
|
||||||
|
if (_origZone->getIsShufflable() && (numberCards == 0)) {
|
||||||
|
shuffleCheckBox = new QCheckBox("shuffle when closing");
|
||||||
|
shuffleCheckBox->setChecked(true);
|
||||||
|
QGraphicsProxyWidget *shuffleProxy = new QGraphicsProxyWidget(this);
|
||||||
|
shuffleProxy->setWidget(shuffleCheckBox);
|
||||||
|
y += shuffleProxy->y() + shuffleProxy->size().height();
|
||||||
|
} else
|
||||||
|
shuffleCheckBox = 0;
|
||||||
|
|
||||||
|
qreal left, top, right, bottom;
|
||||||
|
getWindowFrameMargins(&left, &top, &right, &bottom);
|
||||||
|
qreal h = scene()->sceneRect().height() - (top + bottom);
|
||||||
|
|
||||||
|
scrollBar = new QScrollBar(Qt::Vertical);
|
||||||
|
QGraphicsProxyWidget *scrollProxy = new QGraphicsProxyWidget(this);
|
||||||
|
scrollProxy->setWidget(scrollBar);
|
||||||
|
scrollProxy->setPos(138, y);
|
||||||
|
scrollProxy->resize(scrollProxy->size().width(), h - y);
|
||||||
|
|
||||||
|
qreal w = 138 + scrollProxy->size().width();
|
||||||
|
resize(w, h);
|
||||||
|
setMinimumSize(w, h);
|
||||||
|
setMaximumSize(w, h);
|
||||||
|
|
||||||
zone = new ZoneViewZone(player, _origZone, numberCards, this);
|
zone = new ZoneViewZone(player, _origZone, numberCards, this);
|
||||||
zone->setPos(0, 30);
|
zone->setPos(3, y);
|
||||||
|
zone->setHeight(h - y);
|
||||||
if (!zone->initializeCards()) {
|
if (!zone->initializeCards()) {
|
||||||
connect(player->client, SIGNAL(zoneDumpReceived(int, QList<ServerZoneCard *>)), this, SLOT(zoneDumpReceived(int, QList<ServerZoneCard *>)));
|
connect(player->client, SIGNAL(zoneDumpReceived(int, QList<ServerZoneCard *>)), this, SLOT(zoneDumpReceived(int, QList<ServerZoneCard *>)));
|
||||||
cmdId = player->client->dumpZone(player->getId(), _origZone->getName(), numberCards);
|
cmdId = player->client->dumpZone(player->getId(), _origZone->getName(), numberCards);
|
||||||
|
@ -39,7 +62,11 @@ void ZoneViewWidget::zoneDumpReceived(int commandId, QList<ServerZoneCard *> car
|
||||||
zone->reorganizeCards();
|
zone->reorganizeCards();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneViewWidget::slotClosePressed()
|
void ZoneViewWidget::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
|
if (shuffleCheckBox)
|
||||||
|
if (shuffleCheckBox->isChecked())
|
||||||
|
player->client->shuffle();
|
||||||
emit closePressed(this);
|
emit closePressed(this);
|
||||||
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ class CardZone;
|
||||||
class ZoneViewZone;
|
class ZoneViewZone;
|
||||||
class Player;
|
class Player;
|
||||||
class CardDatabase;
|
class CardDatabase;
|
||||||
|
class QScrollBar;
|
||||||
|
class QCheckBox;
|
||||||
|
|
||||||
class ZoneViewWidget : public QGraphicsWidget {
|
class ZoneViewWidget : public QGraphicsWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -17,15 +19,19 @@ private:
|
||||||
ZoneViewZone *zone;
|
ZoneViewZone *zone;
|
||||||
int cmdId;
|
int cmdId;
|
||||||
|
|
||||||
|
QScrollBar *scrollBar;
|
||||||
|
QCheckBox *shuffleCheckBox;
|
||||||
|
|
||||||
CardDatabase *db;
|
CardDatabase *db;
|
||||||
Player *player;
|
Player *player;
|
||||||
signals:
|
signals:
|
||||||
void closePressed(ZoneViewWidget *zv);
|
void closePressed(ZoneViewWidget *zv);
|
||||||
private slots:
|
private slots:
|
||||||
void zoneDumpReceived(int commandId, QList<ServerZoneCard *> cards);
|
void zoneDumpReceived(int commandId, QList<ServerZoneCard *> cards);
|
||||||
void slotClosePressed();
|
|
||||||
public:
|
public:
|
||||||
ZoneViewWidget(CardDatabase *_db, Player *_player, CardZone *_origZone, int numberCards = 0, QGraphicsItem *parent = 0);
|
ZoneViewWidget(CardDatabase *_db, Player *_player, CardZone *_origZone, int numberCards = 0, QGraphicsItem *parent = 0);
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent *event);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
ZoneViewZone::ZoneViewZone(Player *_p, CardZone *_origZone, int _numberCards, QGraphicsItem *parent)
|
ZoneViewZone::ZoneViewZone(Player *_p, CardZone *_origZone, int _numberCards, QGraphicsItem *parent)
|
||||||
: CardZone(_p, _origZone->getName(), parent, true), numberCards(_numberCards), origZone(_origZone)
|
: CardZone(_p, _origZone->getName(), false, false, parent, true), height(0), numberCards(_numberCards), origZone(_origZone)
|
||||||
{
|
{
|
||||||
cards = new CardList(true);
|
cards = new CardList(true);
|
||||||
origZone->addView(this);
|
origZone->addView(this);
|
||||||
|
@ -18,7 +18,7 @@ ZoneViewZone::~ZoneViewZone()
|
||||||
|
|
||||||
QRectF ZoneViewZone::boundingRect() const
|
QRectF ZoneViewZone::boundingRect() const
|
||||||
{
|
{
|
||||||
return QRectF(0, 0, CARD_WIDTH * 1.75, scene()->sceneRect().height());
|
return QRectF(0, 0, CARD_WIDTH * 1.75, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneViewZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void ZoneViewZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
|
|
@ -8,6 +8,7 @@ class ZoneViewWidget;
|
||||||
|
|
||||||
class ZoneViewZone : public CardZone {
|
class ZoneViewZone : public CardZone {
|
||||||
private:
|
private:
|
||||||
|
int height;
|
||||||
int numberCards;
|
int numberCards;
|
||||||
void handleDropEvent(int cardId, CardZone *startZone, const QPoint &dropPoint, bool faceDown);
|
void handleDropEvent(int cardId, CardZone *startZone, const QPoint &dropPoint, bool faceDown);
|
||||||
CardZone *origZone;
|
CardZone *origZone;
|
||||||
|
@ -22,6 +23,7 @@ public:
|
||||||
void reorganizeCards();
|
void reorganizeCards();
|
||||||
bool initializeCards();
|
bool initializeCards();
|
||||||
void removeCard(int position);
|
void removeCard(int position);
|
||||||
|
void setHeight(int _height) { height = _height; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue