mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
changed lock icon, added sideboard locking, issue #15 fixed
This commit is contained in:
parent
0b51af888c
commit
b2b7242802
17 changed files with 336 additions and 122 deletions
|
|
@ -166,7 +166,6 @@ void DeckViewCardContainer::paint(QPainter *painter, const QStyleOptionGraphicsI
|
|||
painter->setPen(QColor(255, 255, 255, 100));
|
||||
painter->drawLine(QPointF(0, yUntilNow - paddingY / 2), QPointF(width, yUntilNow - paddingY / 2));
|
||||
}
|
||||
|
||||
qreal thisRowHeight = CARD_HEIGHT * currentRowsAndCols[i].first;
|
||||
QRectF textRect(0, yUntilNow, totalTextWidth, thisRowHeight);
|
||||
yUntilNow += thisRowHeight + paddingY;
|
||||
|
|
@ -268,22 +267,27 @@ void DeckViewCardContainer::setWidth(qreal _width)
|
|||
}
|
||||
|
||||
DeckViewScene::DeckViewScene(QObject *parent)
|
||||
: QGraphicsScene(parent), locked(false), deck(0), optimalAspectRatio(1.0)
|
||||
: QGraphicsScene(parent), locked(true), deck(0), optimalAspectRatio(1.0)
|
||||
{
|
||||
}
|
||||
|
||||
DeckViewScene::~DeckViewScene()
|
||||
{
|
||||
clearContents();
|
||||
}
|
||||
|
||||
void DeckViewScene::clearContents()
|
||||
{
|
||||
QMapIterator<QString, DeckViewCardContainer *> i(cardContainers);
|
||||
while (i.hasNext())
|
||||
delete i.next().value();
|
||||
cardContainers.clear();
|
||||
}
|
||||
|
||||
void DeckViewScene::setDeck(DeckList *_deck)
|
||||
{
|
||||
if (deck)
|
||||
delete deck;
|
||||
QMapIterator<QString, DeckViewCardContainer *> i(cardContainers);
|
||||
while (i.hasNext())
|
||||
delete i.next().value();
|
||||
cardContainers.clear();
|
||||
|
||||
deck = _deck;
|
||||
rebuildTree();
|
||||
|
|
@ -293,6 +297,11 @@ void DeckViewScene::setDeck(DeckList *_deck)
|
|||
|
||||
void DeckViewScene::rebuildTree()
|
||||
{
|
||||
clearContents();
|
||||
|
||||
if (!deck)
|
||||
return;
|
||||
|
||||
InnerDecklistNode *listRoot = deck->getRoot();
|
||||
for (int i = 0; i < listRoot->size(); i++) {
|
||||
InnerDecklistNode *currentZone = dynamic_cast<InnerDecklistNode *>(listRoot->at(i));
|
||||
|
|
@ -432,6 +441,12 @@ QList<MoveCard_ToZone> DeckViewScene::getSideboardPlan() const
|
|||
return result;
|
||||
}
|
||||
|
||||
void DeckViewScene::resetSideboardPlan()
|
||||
{
|
||||
rebuildTree();
|
||||
rearrangeItems();
|
||||
}
|
||||
|
||||
DeckView::DeckView(QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
|
|
@ -463,3 +478,8 @@ void DeckView::setDeck(DeckList *_deck)
|
|||
{
|
||||
deckViewScene->setDeck(_deck);
|
||||
}
|
||||
|
||||
void DeckView::resetSideboardPlan()
|
||||
{
|
||||
deckViewScene->resetSideboardPlan();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue