whitespace modifications in preparation for merge

This commit is contained in:
sylvanbasilisk 2014-03-25 01:13:41 +00:00
parent 378cc91c17
commit 748aac7ee8
6 changed files with 1013 additions and 1013 deletions

View file

@ -2,12 +2,12 @@
#include "filtertree.h"
CardDatabaseModel::CardDatabaseModel(CardDatabase *_db, QObject *parent)
: QAbstractListModel(parent), db(_db)
: QAbstractListModel(parent), db(_db)
{
connect(db, SIGNAL(cardListChanged()), this, SLOT(updateCardList()));
connect(db, SIGNAL(cardAdded(CardInfo *)), this, SLOT(cardAdded(CardInfo *)));
connect(db, SIGNAL(cardRemoved(CardInfo *)), this, SLOT(cardRemoved(CardInfo *)));
updateCardList();
connect(db, SIGNAL(cardListChanged()), this, SLOT(updateCardList()));
connect(db, SIGNAL(cardAdded(CardInfo *)), this, SLOT(cardAdded(CardInfo *)));
connect(db, SIGNAL(cardRemoved(CardInfo *)), this, SLOT(cardRemoved(CardInfo *)));
updateCardList();
}
CardDatabaseModel::~CardDatabaseModel()
@ -16,164 +16,164 @@ CardDatabaseModel::~CardDatabaseModel()
int CardDatabaseModel::rowCount(const QModelIndex &/*parent*/) const
{
return cardList.size();
return cardList.size();
}
int CardDatabaseModel::columnCount(const QModelIndex &/*parent*/) const
{
return 5;
return 5;
}
QVariant CardDatabaseModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if ((index.row() >= cardList.size()) || (index.column() >= 5))
return QVariant();
if (role != Qt::DisplayRole)
return QVariant();
if (!index.isValid())
return QVariant();
if ((index.row() >= cardList.size()) || (index.column() >= 5))
return QVariant();
if (role != Qt::DisplayRole)
return QVariant();
CardInfo *card = cardList.at(index.row());
switch (index.column()){
case 0: return card->getName();
case 1: {
QStringList setList;
const QList<CardSet *> &sets = card->getSets();
for (int i = 0; i < sets.size(); i++)
setList << sets[i]->getShortName();
return setList.join(", ");
}
case 2: return card->getManaCost();
case 3: return card->getCardType();
case 4: return card->getPowTough();
default: return QVariant();
}
CardInfo *card = cardList.at(index.row());
switch (index.column()){
case 0: return card->getName();
case 1: {
QStringList setList;
const QList<CardSet *> &sets = card->getSets();
for (int i = 0; i < sets.size(); i++)
setList << sets[i]->getShortName();
return setList.join(", ");
}
case 2: return card->getManaCost();
case 3: return card->getCardType();
case 4: return card->getPowTough();
default: return QVariant();
}
}
QVariant CardDatabaseModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
if (orientation != Qt::Horizontal)
return QVariant();
switch (section) {
case 0: return QString(tr("Name"));
case 1: return QString(tr("Sets"));
case 2: return QString(tr("Mana cost"));
case 3: return QString(tr("Card type"));
case 4: return QString(tr("P/T"));
default: return QVariant();
}
if (role != Qt::DisplayRole)
return QVariant();
if (orientation != Qt::Horizontal)
return QVariant();
switch (section) {
case 0: return QString(tr("Name"));
case 1: return QString(tr("Sets"));
case 2: return QString(tr("Mana cost"));
case 3: return QString(tr("Card type"));
case 4: return QString(tr("P/T"));
default: return QVariant();
}
}
void CardDatabaseModel::updateCardList()
{
for (int i = 0; i < cardList.size(); ++i)
disconnect(cardList[i], 0, this, 0);
cardList = db->getCardList();
for (int i = 0; i < cardList.size(); ++i)
connect(cardList[i], SIGNAL(cardInfoChanged(CardInfo *)), this, SLOT(cardInfoChanged(CardInfo *)));
reset();
for (int i = 0; i < cardList.size(); ++i)
disconnect(cardList[i], 0, this, 0);
cardList = db->getCardList();
for (int i = 0; i < cardList.size(); ++i)
connect(cardList[i], SIGNAL(cardInfoChanged(CardInfo *)), this, SLOT(cardInfoChanged(CardInfo *)));
reset();
}
void CardDatabaseModel::cardInfoChanged(CardInfo *card)
{
const int row = cardList.indexOf(card);
if (row == -1)
return;
emit dataChanged(index(row, 0), index(row, 4));
const int row = cardList.indexOf(card);
if (row == -1)
return;
emit dataChanged(index(row, 0), index(row, 4));
}
void CardDatabaseModel::cardAdded(CardInfo *card)
{
beginInsertRows(QModelIndex(), cardList.size(), cardList.size());
cardList.append(card);
connect(card, SIGNAL(cardInfoChanged(CardInfo *)), this, SLOT(cardInfoChanged(CardInfo *)));
endInsertRows();
beginInsertRows(QModelIndex(), cardList.size(), cardList.size());
cardList.append(card);
connect(card, SIGNAL(cardInfoChanged(CardInfo *)), this, SLOT(cardInfoChanged(CardInfo *)));
endInsertRows();
}
void CardDatabaseModel::cardRemoved(CardInfo *card)
{
const int row = cardList.indexOf(card);
if (row == -1)
return;
beginRemoveRows(QModelIndex(), row, row);
cardList.removeAt(row);
endRemoveRows();
const int row = cardList.indexOf(card);
if (row == -1)
return;
beginRemoveRows(QModelIndex(), row, row);
cardList.removeAt(row);
endRemoveRows();
}
CardDatabaseDisplayModel::CardDatabaseDisplayModel(QObject *parent)
: QSortFilterProxyModel(parent),
isToken(ShowAll)
: QSortFilterProxyModel(parent),
isToken(ShowAll)
{
filterTree = NULL;
setFilterCaseSensitivity(Qt::CaseInsensitive);
setSortCaseSensitivity(Qt::CaseInsensitive);
filterTree = NULL;
setFilterCaseSensitivity(Qt::CaseInsensitive);
setSortCaseSensitivity(Qt::CaseInsensitive);
}
bool CardDatabaseDisplayModel::filterAcceptsRow(int sourceRow, const QModelIndex & /*sourceParent*/) const
{
CardInfo const *info = static_cast<CardDatabaseModel *>(sourceModel())->getCard(sourceRow);
CardInfo const *info = static_cast<CardDatabaseModel *>(sourceModel())->getCard(sourceRow);
if (((isToken == ShowTrue) && !info->getIsToken()) || ((isToken == ShowFalse) && info->getIsToken()))
return false;
if (!cardNameBeginning.isEmpty())
if (!info->getName().startsWith(cardNameBeginning, Qt::CaseInsensitive))
return false;
if (!cardName.isEmpty())
if (!info->getName().contains(cardName, Qt::CaseInsensitive))
return false;
if (!cardNameSet.isEmpty())
if (!cardNameSet.contains(info->getName()))
return false;
if (!cardText.isEmpty())
if (!info->getText().contains(cardText, Qt::CaseInsensitive))
return false;
if (!cardColors.isEmpty())
if (QSet<QString>::fromList(info->getColors()).intersect(cardColors).isEmpty() && !(info->getColors().isEmpty() && cardColors.contains("X")))
return false;
if (!cardTypes.isEmpty())
if (!cardTypes.contains(info->getMainCardType()))
return false;
if (((isToken == ShowTrue) && !info->getIsToken()) || ((isToken == ShowFalse) && info->getIsToken()))
return false;
if (!cardNameBeginning.isEmpty())
if (!info->getName().startsWith(cardNameBeginning, Qt::CaseInsensitive))
return false;
if (!cardName.isEmpty())
if (!info->getName().contains(cardName, Qt::CaseInsensitive))
return false;
if (!cardNameSet.isEmpty())
if (!cardNameSet.contains(info->getName()))
return false;
if (!cardText.isEmpty())
if (!info->getText().contains(cardText, Qt::CaseInsensitive))
return false;
if (!cardColors.isEmpty())
if (QSet<QString>::fromList(info->getColors()).intersect(cardColors).isEmpty() && !(info->getColors().isEmpty() && cardColors.contains("X")))
return false;
if (!cardTypes.isEmpty())
if (!cardTypes.contains(info->getMainCardType()))
return false;
if (filterTree != NULL)
return filterTree->acceptsCard(info);
if (filterTree != NULL)
return filterTree->acceptsCard(info);
return true;
return true;
}
void CardDatabaseDisplayModel::clearSearch()
{
cardName.clear();
cardText.clear();
cardTypes.clear();
cardColors.clear();
if (filterTree != NULL)
filterTree->clear();
invalidateFilter();
cardName.clear();
cardText.clear();
cardTypes.clear();
cardColors.clear();
if (filterTree != NULL)
filterTree->clear();
invalidateFilter();
}
void CardDatabaseDisplayModel::setFilterTree(FilterTree *filterTree)
{
if (this->filterTree != NULL)
disconnect(this->filterTree, 0, this, 0);
if (this->filterTree != NULL)
disconnect(this->filterTree, 0, this, 0);
this->filterTree = filterTree;
connect(this->filterTree, SIGNAL(changed()), this, SLOT(filterTreeChanged()));
invalidate();
this->filterTree = filterTree;
connect(this->filterTree, SIGNAL(changed()), this, SLOT(filterTreeChanged()));
invalidate();
}
void CardDatabaseDisplayModel::filterTreeChanged()
{
invalidate();
invalidate();
}

View file

@ -10,50 +10,50 @@
class FilterTree;
class CardDatabaseModel : public QAbstractListModel {
Q_OBJECT
Q_OBJECT
public:
CardDatabaseModel(CardDatabase *_db, QObject *parent = 0);
~CardDatabaseModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
CardDatabase *getDatabase() const { return db; }
CardInfo *getCard(int index) const { return cardList[index]; }
CardDatabaseModel(CardDatabase *_db, QObject *parent = 0);
~CardDatabaseModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
CardDatabase *getDatabase() const { return db; }
CardInfo *getCard(int index) const { return cardList[index]; }
private:
QList<CardInfo *> cardList;
CardDatabase *db;
QList<CardInfo *> cardList;
CardDatabase *db;
private slots:
void updateCardList();
void cardAdded(CardInfo *card);
void cardRemoved(CardInfo *card);
void cardInfoChanged(CardInfo *card);
void updateCardList();
void cardAdded(CardInfo *card);
void cardRemoved(CardInfo *card);
void cardInfoChanged(CardInfo *card);
};
class CardDatabaseDisplayModel : public QSortFilterProxyModel {
Q_OBJECT
Q_OBJECT
public:
enum FilterBool { ShowTrue, ShowFalse, ShowAll };
enum FilterBool { ShowTrue, ShowFalse, ShowAll };
private:
FilterBool isToken;
QString cardNameBeginning, cardName, cardText;
QSet<QString> cardNameSet, cardTypes, cardColors;
FilterTree *filterTree;
FilterBool isToken;
QString cardNameBeginning, cardName, cardText;
QSet<QString> cardNameSet, cardTypes, cardColors;
FilterTree *filterTree;
public:
CardDatabaseDisplayModel(QObject *parent = 0);
void setFilterTree(FilterTree *filterTree);
void setIsToken(FilterBool _isToken) { isToken = _isToken; invalidate(); }
void setCardNameBeginning(const QString &_beginning) { cardNameBeginning = _beginning; invalidate(); }
void setCardName(const QString &_cardName) { cardName = _cardName; invalidate(); }
void setCardNameSet(const QSet<QString> &_cardNameSet) { cardNameSet = _cardNameSet; invalidate(); }
void setCardText(const QString &_cardText) { cardText = _cardText; invalidate(); }
void setCardTypes(const QSet<QString> &_cardTypes) { cardTypes = _cardTypes; invalidate(); }
void setCardColors(const QSet<QString> &_cardColors) { cardColors = _cardColors; invalidate(); }
void clearSearch();
CardDatabaseDisplayModel(QObject *parent = 0);
void setFilterTree(FilterTree *filterTree);
void setIsToken(FilterBool _isToken) { isToken = _isToken; invalidate(); }
void setCardNameBeginning(const QString &_beginning) { cardNameBeginning = _beginning; invalidate(); }
void setCardName(const QString &_cardName) { cardName = _cardName; invalidate(); }
void setCardNameSet(const QSet<QString> &_cardNameSet) { cardNameSet = _cardNameSet; invalidate(); }
void setCardText(const QString &_cardText) { cardText = _cardText; invalidate(); }
void setCardTypes(const QSet<QString> &_cardTypes) { cardTypes = _cardTypes; invalidate(); }
void setCardColors(const QSet<QString> &_cardColors) { cardColors = _cardColors; invalidate(); }
void clearSearch();
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
private slots:
void filterTreeChanged();
void filterTreeChanged();
};
#endif

View file

@ -14,454 +14,454 @@
#include "deck_loader.h"
DeckListModel::DeckListModel(QObject *parent)
: QAbstractItemModel(parent)
: QAbstractItemModel(parent)
{
deckList = new DeckLoader;
connect(deckList, SIGNAL(deckLoaded()), this, SLOT(rebuildTree()));
connect(deckList, SIGNAL(deckHashChanged()), this, SIGNAL(deckHashChanged()));
root = new InnerDecklistNode;
deckList = new DeckLoader;
connect(deckList, SIGNAL(deckLoaded()), this, SLOT(rebuildTree()));
connect(deckList, SIGNAL(deckHashChanged()), this, SIGNAL(deckHashChanged()));
root = new InnerDecklistNode;
}
DeckListModel::~DeckListModel()
{
delete root;
delete deckList;
delete root;
delete deckList;
}
void DeckListModel::rebuildTree()
{
root->clearTree();
InnerDecklistNode *listRoot = deckList->getRoot();
for (int i = 0; i < listRoot->size(); i++) {
InnerDecklistNode *currentZone = dynamic_cast<InnerDecklistNode *>(listRoot->at(i));
InnerDecklistNode *node = new InnerDecklistNode(currentZone->getName(), root);
for (int j = 0; j < currentZone->size(); j++) {
DecklistCardNode *currentCard = dynamic_cast<DecklistCardNode *>(currentZone->at(j));
// XXX better sanity checking
if (!currentCard)
continue;
root->clearTree();
InnerDecklistNode *listRoot = deckList->getRoot();
for (int i = 0; i < listRoot->size(); i++) {
InnerDecklistNode *currentZone = dynamic_cast<InnerDecklistNode *>(listRoot->at(i));
InnerDecklistNode *node = new InnerDecklistNode(currentZone->getName(), root);
for (int j = 0; j < currentZone->size(); j++) {
DecklistCardNode *currentCard = dynamic_cast<DecklistCardNode *>(currentZone->at(j));
// XXX better sanity checking
if (!currentCard)
continue;
CardInfo *info = db->getCard(currentCard->getName());
QString cardType;
if (!info)
cardType = "unknown";
else
cardType = info->getMainCardType();
InnerDecklistNode *cardTypeNode = dynamic_cast<InnerDecklistNode *>(node->findChild(cardType));
if (!cardTypeNode)
cardTypeNode = new InnerDecklistNode(cardType, node);
CardInfo *info = db->getCard(currentCard->getName());
QString cardType;
if (!info)
cardType = "unknown";
else
cardType = info->getMainCardType();
InnerDecklistNode *cardTypeNode = dynamic_cast<InnerDecklistNode *>(node->findChild(cardType));
if (!cardTypeNode)
cardTypeNode = new InnerDecklistNode(cardType, node);
new DecklistModelCardNode(currentCard, cardTypeNode);
}
}
new DecklistModelCardNode(currentCard, cardTypeNode);
}
}
reset();
reset();
}
int DeckListModel::rowCount(const QModelIndex &parent) const
{
// debugIndexInfo("rowCount", parent);
InnerDecklistNode *node = getNode<InnerDecklistNode *>(parent);
if (node)
return node->size();
else
return 0;
// debugIndexInfo("rowCount", parent);
InnerDecklistNode *node = getNode<InnerDecklistNode *>(parent);
if (node)
return node->size();
else
return 0;
}
int DeckListModel::columnCount(const QModelIndex &/*parent*/) const
{
if (settingsCache->getPriceTagFeature())
return 3;
else
return 2;
if (settingsCache->getPriceTagFeature())
return 3;
else
return 2;
}
QVariant DeckListModel::data(const QModelIndex &index, int role) const
{
// debugIndexInfo("data", index);
if (!index.isValid())
return QVariant();
// debugIndexInfo("data", index);
if (!index.isValid())
return QVariant();
if (index.column() >= columnCount())
return QVariant();
return QVariant();
AbstractDecklistNode *temp = static_cast<AbstractDecklistNode *>(index.internalPointer());
DecklistModelCardNode *card = dynamic_cast<DecklistModelCardNode *>(temp);
if (!card) {
InnerDecklistNode *node = dynamic_cast<InnerDecklistNode *>(temp);
switch (role) {
case Qt::FontRole: {
QFont f;
f.setBold(true);
return f;
}
case Qt::DisplayRole:
case Qt::EditRole:
switch (index.column()) {
AbstractDecklistNode *temp = static_cast<AbstractDecklistNode *>(index.internalPointer());
DecklistModelCardNode *card = dynamic_cast<DecklistModelCardNode *>(temp);
if (!card) {
InnerDecklistNode *node = dynamic_cast<InnerDecklistNode *>(temp);
switch (role) {
case Qt::FontRole: {
QFont f;
f.setBold(true);
return f;
}
case Qt::DisplayRole:
case Qt::EditRole:
switch (index.column()) {
case 0: return node->recursiveCount(true);
case 1: return node->getVisibleName();
case 2: return QString().sprintf("$%.2f", node->recursivePrice(true));
default: return QVariant();
}
case Qt::BackgroundRole: {
int color = 90 + 60 * node->depth();
return QBrush(QColor(color, 255, color));
}
default: return QVariant();
}
} else {
switch (role) {
case Qt::DisplayRole:
case Qt::EditRole: {
switch (index.column()) {
default: return QVariant();
}
case Qt::BackgroundRole: {
int color = 90 + 60 * node->depth();
return QBrush(QColor(color, 255, color));
}
default: return QVariant();
}
} else {
switch (role) {
case Qt::DisplayRole:
case Qt::EditRole: {
switch (index.column()) {
case 0: return card->getNumber();
case 1: return card->getName();
case 2: return QString().sprintf("$%.2f", card->getTotalPrice());
default: return QVariant();
}
}
case Qt::BackgroundRole: {
int color = 255 - (index.row() % 2) * 30;
return QBrush(QColor(color, color, color));
}
default: return QVariant();
}
}
default: return QVariant();
}
}
case Qt::BackgroundRole: {
int color = 255 - (index.row() % 2) * 30;
return QBrush(QColor(color, color, color));
}
default: return QVariant();
}
}
}
QVariant DeckListModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if ((role != Qt::DisplayRole) || (orientation != Qt::Horizontal))
return QVariant();
if ((role != Qt::DisplayRole) || (orientation != Qt::Horizontal))
return QVariant();
if (section >= columnCount())
return QVariant();
switch (section) {
return QVariant();
switch (section) {
case 0: return tr("Number");
case 1: return tr("Card");
case 2: return tr("Price");
default: return QVariant();
}
default: return QVariant();
}
}
QModelIndex DeckListModel::index(int row, int column, const QModelIndex &parent) const
{
// debugIndexInfo("index", parent);
if (!hasIndex(row, column, parent))
return QModelIndex();
// debugIndexInfo("index", parent);
if (!hasIndex(row, column, parent))
return QModelIndex();
InnerDecklistNode *parentNode = getNode<InnerDecklistNode *>(parent);
if (row >= parentNode->size())
return QModelIndex();
InnerDecklistNode *parentNode = getNode<InnerDecklistNode *>(parent);
if (row >= parentNode->size())
return QModelIndex();
return createIndex(row, column, parentNode->at(row));
return createIndex(row, column, parentNode->at(row));
}
QModelIndex DeckListModel::parent(const QModelIndex &ind) const
{
if (!ind.isValid())
return QModelIndex();
if (!ind.isValid())
return QModelIndex();
return nodeToIndex(static_cast<AbstractDecklistNode *>(ind.internalPointer())->getParent());
return nodeToIndex(static_cast<AbstractDecklistNode *>(ind.internalPointer())->getParent());
}
Qt::ItemFlags DeckListModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
if (!index.isValid())
return 0;
Qt::ItemFlags result = Qt::ItemIsEnabled;
result |= Qt::ItemIsSelectable;
Qt::ItemFlags result = Qt::ItemIsEnabled;
result |= Qt::ItemIsSelectable;
return result;
return result;
}
void DeckListModel::emitRecursiveUpdates(const QModelIndex &index)
{
if (!index.isValid())
return;
emit dataChanged(index, index);
emitRecursiveUpdates(index.parent());
if (!index.isValid())
return;
emit dataChanged(index, index);
emitRecursiveUpdates(index.parent());
}
bool DeckListModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
DecklistModelCardNode *node = getNode<DecklistModelCardNode *>(index);
if (!node || (role != Qt::EditRole))
return false;
DecklistModelCardNode *node = getNode<DecklistModelCardNode *>(index);
if (!node || (role != Qt::EditRole))
return false;
switch (index.column()) {
switch (index.column()) {
case 0: node->setNumber(value.toInt()); break;
case 1: node->setName(value.toString()); break;
case 2: node->setPrice(value.toFloat()); break;
default: return false;
}
emitRecursiveUpdates(index);
deckList->updateDeckHash();
return true;
default: return false;
}
emitRecursiveUpdates(index);
deckList->updateDeckHash();
return true;
}
bool DeckListModel::removeRows(int row, int count, const QModelIndex &parent)
{
InnerDecklistNode *node = getNode<InnerDecklistNode *>(parent);
if (!node)
return false;
if (row + count > node->size())
return false;
InnerDecklistNode *node = getNode<InnerDecklistNode *>(parent);
if (!node)
return false;
if (row + count > node->size())
return false;
beginRemoveRows(parent, row, row + count - 1);
for (int i = 0; i < count; i++) {
AbstractDecklistNode *toDelete = node->takeAt(row);
if (DecklistModelCardNode *temp = dynamic_cast<DecklistModelCardNode *>(toDelete))
deckList->deleteNode(temp->getDataNode());
delete toDelete;
}
endRemoveRows();
beginRemoveRows(parent, row, row + count - 1);
for (int i = 0; i < count; i++) {
AbstractDecklistNode *toDelete = node->takeAt(row);
if (DecklistModelCardNode *temp = dynamic_cast<DecklistModelCardNode *>(toDelete))
deckList->deleteNode(temp->getDataNode());
delete toDelete;
}
endRemoveRows();
if (!node->size() && (node != root))
removeRows(parent.row(), 1, parent.parent());
else
emitRecursiveUpdates(parent);
if (!node->size() && (node != root))
removeRows(parent.row(), 1, parent.parent());
else
emitRecursiveUpdates(parent);
return true;
return true;
}
InnerDecklistNode *DeckListModel::createNodeIfNeeded(const QString &name, InnerDecklistNode *parent)
{
InnerDecklistNode *newNode = dynamic_cast<InnerDecklistNode *>(parent->findChild(name));
if (!newNode) {
beginInsertRows(nodeToIndex(parent), parent->size(), parent->size());
newNode = new InnerDecklistNode(name, parent);
endInsertRows();
}
return newNode;
InnerDecklistNode *newNode = dynamic_cast<InnerDecklistNode *>(parent->findChild(name));
if (!newNode) {
beginInsertRows(nodeToIndex(parent), parent->size(), parent->size());
newNode = new InnerDecklistNode(name, parent);
endInsertRows();
}
return newNode;
}
DecklistModelCardNode *DeckListModel::findCardNode(const QString &cardName, const QString &zoneName) const
{
InnerDecklistNode *zoneNode, *typeNode;
CardInfo *info;
QString cardType;
InnerDecklistNode *zoneNode, *typeNode;
CardInfo *info;
QString cardType;
zoneNode = dynamic_cast<InnerDecklistNode *>(root->findChild(zoneName));
if(!zoneNode)
return NULL;
zoneNode = dynamic_cast<InnerDecklistNode *>(root->findChild(zoneName));
if(!zoneNode)
return NULL;
info = db->getCard(cardName);
if(!info)
return NULL;
info = db->getCard(cardName);
if(!info)
return NULL;
cardType = info->getMainCardType();
typeNode = dynamic_cast<InnerDecklistNode *>(zoneNode->findChild(cardType));
if(!typeNode)
return NULL;
cardType = info->getMainCardType();
typeNode = dynamic_cast<InnerDecklistNode *>(zoneNode->findChild(cardType));
if(!typeNode)
return NULL;
return dynamic_cast<DecklistModelCardNode *>(typeNode->findChild(cardName));
return dynamic_cast<DecklistModelCardNode *>(typeNode->findChild(cardName));
}
QModelIndex DeckListModel::findCard(const QString &cardName, const QString &zoneName) const
{
DecklistModelCardNode *cardNode;
DecklistModelCardNode *cardNode;
cardNode = findCardNode(cardName, zoneName);
if(!cardNode)
return QModelIndex();
return nodeToIndex(cardNode);
cardNode = findCardNode(cardName, zoneName);
if(!cardNode)
return QModelIndex();
return nodeToIndex(cardNode);
}
QModelIndex DeckListModel::addCard(const QString &cardName, const QString &zoneName)
{
InnerDecklistNode *zoneNode = createNodeIfNeeded(zoneName, root);
InnerDecklistNode *zoneNode = createNodeIfNeeded(zoneName, root);
CardInfo *info = db->getCard(cardName);
QString cardType = info->getMainCardType();
InnerDecklistNode *cardTypeNode = createNodeIfNeeded(cardType, zoneNode);
CardInfo *info = db->getCard(cardName);
QString cardType = info->getMainCardType();
InnerDecklistNode *cardTypeNode = createNodeIfNeeded(cardType, zoneNode);
DecklistModelCardNode *cardNode = dynamic_cast<DecklistModelCardNode *>(cardTypeNode->findChild(cardName));
if (!cardNode) {
DecklistCardNode *decklistCard = deckList->addCard(cardName, zoneName);
QModelIndex parentIndex = nodeToIndex(cardTypeNode);
beginInsertRows(parentIndex, cardTypeNode->size(), cardTypeNode->size());
cardNode = new DecklistModelCardNode(decklistCard, cardTypeNode);
endInsertRows();
sort(1);
emitRecursiveUpdates(parentIndex);
return nodeToIndex(cardNode);
} else {
cardNode->setNumber(cardNode->getNumber() + 1);
QModelIndex ind = nodeToIndex(cardNode);
emitRecursiveUpdates(ind);
deckList->updateDeckHash();
return ind;
}
DecklistModelCardNode *cardNode = dynamic_cast<DecklistModelCardNode *>(cardTypeNode->findChild(cardName));
if (!cardNode) {
DecklistCardNode *decklistCard = deckList->addCard(cardName, zoneName);
QModelIndex parentIndex = nodeToIndex(cardTypeNode);
beginInsertRows(parentIndex, cardTypeNode->size(), cardTypeNode->size());
cardNode = new DecklistModelCardNode(decklistCard, cardTypeNode);
endInsertRows();
sort(1);
emitRecursiveUpdates(parentIndex);
return nodeToIndex(cardNode);
} else {
cardNode->setNumber(cardNode->getNumber() + 1);
QModelIndex ind = nodeToIndex(cardNode);
emitRecursiveUpdates(ind);
deckList->updateDeckHash();
return ind;
}
}
QModelIndex DeckListModel::nodeToIndex(AbstractDecklistNode *node) const
{
if (node == root)
return QModelIndex();
return createIndex(node->getParent()->indexOf(node), 0, node);
if (node == root)
return QModelIndex();
return createIndex(node->getParent()->indexOf(node), 0, node);
}
void DeckListModel::sortHelper(InnerDecklistNode *node, Qt::SortOrder order)
{
// Sort children of node and save the information needed to
// update the list of persistent indexes.
QVector<QPair<int, int> > sortResult = node->sort(order);
QModelIndexList from, to;
for (int i = sortResult.size() - 1; i >= 0; --i) {
const int fromRow = sortResult[i].first;
const int toRow = sortResult[i].second;
AbstractDecklistNode *temp = node->at(toRow);
for (int j = columnCount(); j; --j) {
from << createIndex(fromRow, 0, temp);
to << createIndex(toRow, 0, temp);
}
}
changePersistentIndexList(from, to);
// Recursion
for (int i = node->size() - 1; i >= 0; --i) {
InnerDecklistNode *subNode = dynamic_cast<InnerDecklistNode *>(node->at(i));
if (subNode)
sortHelper(subNode, order);
}
// Sort children of node and save the information needed to
// update the list of persistent indexes.
QVector<QPair<int, int> > sortResult = node->sort(order);
QModelIndexList from, to;
for (int i = sortResult.size() - 1; i >= 0; --i) {
const int fromRow = sortResult[i].first;
const int toRow = sortResult[i].second;
AbstractDecklistNode *temp = node->at(toRow);
for (int j = columnCount(); j; --j) {
from << createIndex(fromRow, 0, temp);
to << createIndex(toRow, 0, temp);
}
}
changePersistentIndexList(from, to);
// Recursion
for (int i = node->size() - 1; i >= 0; --i) {
InnerDecklistNode *subNode = dynamic_cast<InnerDecklistNode *>(node->at(i));
if (subNode)
sortHelper(subNode, order);
}
}
void DeckListModel::sort(int /*column*/, Qt::SortOrder order)
{
emit layoutAboutToBeChanged();
sortHelper(root, order);
emit layoutChanged();
emit layoutAboutToBeChanged();
sortHelper(root, order);
emit layoutChanged();
}
void DeckListModel::cleanList()
{
setDeckList(new DeckLoader);
setDeckList(new DeckLoader);
}
void DeckListModel::setDeckList(DeckLoader *_deck)
{
delete deckList;
deckList = _deck;
connect(deckList, SIGNAL(deckLoaded()), this, SLOT(rebuildTree()));
connect(deckList, SIGNAL(deckHashChanged()), this, SIGNAL(deckHashChanged()));
rebuildTree();
delete deckList;
deckList = _deck;
connect(deckList, SIGNAL(deckLoaded()), this, SLOT(rebuildTree()));
connect(deckList, SIGNAL(deckHashChanged()), this, SIGNAL(deckHashChanged()));
rebuildTree();
}
void DeckListModel::printDeckListNode(QTextCursor *cursor, InnerDecklistNode *node)
{
const int totalColumns = settingsCache->getPriceTagFeature() ? 3 : 2;
const int totalColumns = settingsCache->getPriceTagFeature() ? 3 : 2;
if (node->height() == 1) {
QTextBlockFormat blockFormat;
QTextCharFormat charFormat;
charFormat.setFontPointSize(11);
charFormat.setFontWeight(QFont::Bold);
cursor->insertBlock(blockFormat, charFormat);
QString priceStr;
if (settingsCache->getPriceTagFeature())
priceStr = QString().sprintf(": $%.2f", node->recursivePrice(true));
if (node->height() == 1) {
QTextBlockFormat blockFormat;
QTextCharFormat charFormat;
charFormat.setFontPointSize(11);
charFormat.setFontWeight(QFont::Bold);
cursor->insertBlock(blockFormat, charFormat);
QString priceStr;
if (settingsCache->getPriceTagFeature())
priceStr = QString().sprintf(": $%.2f", node->recursivePrice(true));
cursor->insertText(QString("%1: %2").arg(node->getVisibleName()).arg(node->recursiveCount(true)).append(priceStr));
QTextTableFormat tableFormat;
tableFormat.setCellPadding(0);
tableFormat.setCellSpacing(0);
tableFormat.setBorder(0);
QTextTableFormat tableFormat;
tableFormat.setCellPadding(0);
tableFormat.setCellSpacing(0);
tableFormat.setBorder(0);
QTextTable *table = cursor->insertTable(node->size() + 1, totalColumns, tableFormat);
for (int i = 0; i < node->size(); i++) {
AbstractDecklistCardNode *card = dynamic_cast<AbstractDecklistCardNode *>(node->at(i));
for (int i = 0; i < node->size(); i++) {
AbstractDecklistCardNode *card = dynamic_cast<AbstractDecklistCardNode *>(node->at(i));
QTextCharFormat cellCharFormat;
cellCharFormat.setFontPointSize(9);
QTextCharFormat cellCharFormat;
cellCharFormat.setFontPointSize(9);
QTextTableCell cell = table->cellAt(i, 0);
cell.setFormat(cellCharFormat);
QTextCursor cellCursor = cell.firstCursorPosition();
cellCursor.insertText(QString("%1 ").arg(card->getNumber()));
QTextTableCell cell = table->cellAt(i, 0);
cell.setFormat(cellCharFormat);
QTextCursor cellCursor = cell.firstCursorPosition();
cellCursor.insertText(QString("%1 ").arg(card->getNumber()));
cell = table->cellAt(i, 1);
cell.setFormat(cellCharFormat);
cellCursor = cell.firstCursorPosition();
cellCursor.insertText(card->getName());
cell = table->cellAt(i, 1);
cell.setFormat(cellCharFormat);
cellCursor = cell.firstCursorPosition();
cellCursor.insertText(card->getName());
if (settingsCache->getPriceTagFeature()) {
cell = table->cellAt(i, 2);
cell.setFormat(cellCharFormat);
cellCursor = cell.firstCursorPosition();
cellCursor.insertText(QString().sprintf("$%.2f ", card->getTotalPrice()));
}
}
} else if (node->height() == 2) {
QTextBlockFormat blockFormat;
QTextCharFormat charFormat;
charFormat.setFontPointSize(14);
charFormat.setFontWeight(QFont::Bold);
if (settingsCache->getPriceTagFeature()) {
cell = table->cellAt(i, 2);
cell.setFormat(cellCharFormat);
cellCursor = cell.firstCursorPosition();
cellCursor.insertText(QString().sprintf("$%.2f ", card->getTotalPrice()));
}
}
} else if (node->height() == 2) {
QTextBlockFormat blockFormat;
QTextCharFormat charFormat;
charFormat.setFontPointSize(14);
charFormat.setFontWeight(QFont::Bold);
cursor->insertBlock(blockFormat, charFormat);
QString priceStr;
if (settingsCache->getPriceTagFeature())
priceStr = QString().sprintf(": $%.2f", node->recursivePrice(true));
cursor->insertBlock(blockFormat, charFormat);
QString priceStr;
if (settingsCache->getPriceTagFeature())
priceStr = QString().sprintf(": $%.2f", node->recursivePrice(true));
cursor->insertText(QString("%1: %2").arg(node->getVisibleName()).arg(node->recursiveCount(true)).append(priceStr));
QTextTableFormat tableFormat;
tableFormat.setCellPadding(10);
tableFormat.setCellSpacing(0);
tableFormat.setBorder(0);
QVector<QTextLength> constraints;
for (int i = 0; i < totalColumns; i++)
constraints << QTextLength(QTextLength::PercentageLength, 100.0 / totalColumns);
tableFormat.setColumnWidthConstraints(constraints);
QTextTableFormat tableFormat;
tableFormat.setCellPadding(10);
tableFormat.setCellSpacing(0);
tableFormat.setBorder(0);
QVector<QTextLength> constraints;
for (int i = 0; i < totalColumns; i++)
constraints << QTextLength(QTextLength::PercentageLength, 100.0 / totalColumns);
tableFormat.setColumnWidthConstraints(constraints);
QTextTable *table = cursor->insertTable(1, totalColumns, tableFormat);
for (int i = 0; i < node->size(); i++) {
QTextCursor cellCursor = table->cellAt(0, (i * totalColumns) / node->size()).lastCursorPosition();
printDeckListNode(&cellCursor, dynamic_cast<InnerDecklistNode *>(node->at(i)));
}
}
cursor->movePosition(QTextCursor::End);
QTextTable *table = cursor->insertTable(1, totalColumns, tableFormat);
for (int i = 0; i < node->size(); i++) {
QTextCursor cellCursor = table->cellAt(0, (i * totalColumns) / node->size()).lastCursorPosition();
printDeckListNode(&cellCursor, dynamic_cast<InnerDecklistNode *>(node->at(i)));
}
}
cursor->movePosition(QTextCursor::End);
}
void DeckListModel::printDeckList(QPrinter *printer)
{
QTextDocument doc;
QTextDocument doc;
QFont font("Serif");
font.setStyleHint(QFont::Serif);
doc.setDefaultFont(font);
QFont font("Serif");
font.setStyleHint(QFont::Serif);
doc.setDefaultFont(font);
QTextCursor cursor(&doc);
QTextCursor cursor(&doc);
QTextBlockFormat headerBlockFormat;
QTextCharFormat headerCharFormat;
headerCharFormat.setFontPointSize(16);
headerCharFormat.setFontWeight(QFont::Bold);
QTextBlockFormat headerBlockFormat;
QTextCharFormat headerCharFormat;
headerCharFormat.setFontPointSize(16);
headerCharFormat.setFontWeight(QFont::Bold);
cursor.insertBlock(headerBlockFormat, headerCharFormat);
cursor.insertText(deckList->getName());
cursor.insertBlock(headerBlockFormat, headerCharFormat);
cursor.insertText(deckList->getName());
headerCharFormat.setFontPointSize(12);
cursor.insertBlock(headerBlockFormat, headerCharFormat);
cursor.insertText(deckList->getComments());
cursor.insertBlock(headerBlockFormat, headerCharFormat);
headerCharFormat.setFontPointSize(12);
cursor.insertBlock(headerBlockFormat, headerCharFormat);
cursor.insertText(deckList->getComments());
cursor.insertBlock(headerBlockFormat, headerCharFormat);
for (int i = 0; i < root->size(); i++) {
cursor.insertHtml("<br><img src=:/resources/hr.jpg>");
//cursor.insertHtml("<hr>");
cursor.insertBlock(headerBlockFormat, headerCharFormat);
for (int i = 0; i < root->size(); i++) {
cursor.insertHtml("<br><img src=:/resources/hr.jpg>");
//cursor.insertHtml("<hr>");
cursor.insertBlock(headerBlockFormat, headerCharFormat);
printDeckListNode(&cursor, dynamic_cast<InnerDecklistNode *>(root->at(i)));
}
printDeckListNode(&cursor, dynamic_cast<InnerDecklistNode *>(root->at(i)));
}
doc.print(printer);
doc.print(printer);
}
void DeckListModel::pricesUpdated(InnerDecklistNode *node)
{
if (!node)
node = root;
if (node->isEmpty())
return;
emit dataChanged(createIndex(0, 2, node->at(0)), createIndex(node->size() - 1, 2, node->last()));
if (!node)
node = root;
if (node->isEmpty())
return;
emit dataChanged(createIndex(0, 2, node->at(0)), createIndex(node->size() - 1, 2, node->last()));
}

View file

@ -13,63 +13,63 @@ class QTextCursor;
class DecklistModelCardNode : public AbstractDecklistCardNode {
private:
DecklistCardNode *dataNode;
DecklistCardNode *dataNode;
public:
DecklistModelCardNode(DecklistCardNode *_dataNode, InnerDecklistNode *_parent) : AbstractDecklistCardNode(_parent), dataNode(_dataNode) { }
int getNumber() const { return dataNode->getNumber(); }
void setNumber(int _number) { dataNode->setNumber(_number); }
DecklistModelCardNode(DecklistCardNode *_dataNode, InnerDecklistNode *_parent) : AbstractDecklistCardNode(_parent), dataNode(_dataNode) { }
int getNumber() const { return dataNode->getNumber(); }
void setNumber(int _number) { dataNode->setNumber(_number); }
float getPrice() const { return dataNode->getPrice(); }
void setPrice(float _price) { dataNode->setPrice(_price); }
QString getName() const { return dataNode->getName(); }
void setName(const QString &_name) { dataNode->setName(_name); }
DecklistCardNode *getDataNode() const { return dataNode; }
QString getName() const { return dataNode->getName(); }
void setName(const QString &_name) { dataNode->setName(_name); }
DecklistCardNode *getDataNode() const { return dataNode; }
};
class DeckListModel : public QAbstractItemModel {
Q_OBJECT
Q_OBJECT
private slots:
void rebuildTree();
void rebuildTree();
public slots:
void printDeckList(QPrinter *printer);
void printDeckList(QPrinter *printer);
signals:
void deckHashChanged();
void deckHashChanged();
public:
DeckListModel(QObject *parent = 0);
~DeckListModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
DeckListModel(QObject *parent = 0);
~DeckListModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &/*parent*/ = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
QModelIndex findCard(const QString &cardName, const QString &zoneName) const;
QModelIndex addCard(const QString &cardName, const QString &zoneName);
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
void cleanList();
DeckLoader *getDeckList() const { return deckList; }
void setDeckList(DeckLoader *_deck);
void pricesUpdated(InnerDecklistNode *node = 0);
QModelIndex findCard(const QString &cardName, const QString &zoneName) const;
QModelIndex addCard(const QString &cardName, const QString &zoneName);
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
void cleanList();
DeckLoader *getDeckList() const { return deckList; }
void setDeckList(DeckLoader *_deck);
void pricesUpdated(InnerDecklistNode *node = 0);
private:
DeckLoader *deckList;
InnerDecklistNode *root;
InnerDecklistNode *createNodeIfNeeded(const QString &name, InnerDecklistNode *parent);
QModelIndex nodeToIndex(AbstractDecklistNode *node) const;
DecklistModelCardNode *findCardNode(const QString &cardName, const QString &zoneName) const;
void emitRecursiveUpdates(const QModelIndex &index);
void sortHelper(InnerDecklistNode *node, Qt::SortOrder order);
DeckLoader *deckList;
InnerDecklistNode *root;
InnerDecklistNode *createNodeIfNeeded(const QString &name, InnerDecklistNode *parent);
QModelIndex nodeToIndex(AbstractDecklistNode *node) const;
DecklistModelCardNode *findCardNode(const QString &cardName, const QString &zoneName) const;
void emitRecursiveUpdates(const QModelIndex &index);
void sortHelper(InnerDecklistNode *node, Qt::SortOrder order);
void printDeckListNode(QTextCursor *cursor, InnerDecklistNode *node);
void printDeckListNode(QTextCursor *cursor, InnerDecklistNode *node);
template<typename T> T getNode(const QModelIndex &index) const
{
if (!index.isValid())
return dynamic_cast<T>(root);
return dynamic_cast<T>(static_cast<AbstractDecklistNode *>(index.internalPointer()));
}
template<typename T> T getNode(const QModelIndex &index) const
{
if (!index.isValid())
return dynamic_cast<T>(root);
return dynamic_cast<T>(static_cast<AbstractDecklistNode *>(index.internalPointer()));
}
};
#endif

File diff suppressed because it is too large Load diff

View file

@ -20,98 +20,98 @@ class FilterTreeModel;
class CardInfo;
class SearchLineEdit : public QLineEdit {
private:
QTreeView *treeView;
protected:
void keyPressEvent(QKeyEvent *event);
public:
SearchLineEdit() : QLineEdit(), treeView(0) { }
void setTreeView(QTreeView *_treeView) { treeView = _treeView; }
private:
QTreeView *treeView;
protected:
void keyPressEvent(QKeyEvent *event);
public:
SearchLineEdit() : QLineEdit(), treeView(0) { }
void setTreeView(QTreeView *_treeView) { treeView = _treeView; }
};
class TabDeckEditor : public Tab {
Q_OBJECT
Q_OBJECT
private slots:
void updateName(const QString &name);
void updateComments();
void updateHash();
void updateCardInfoLeft(const QModelIndex &current, const QModelIndex &previous);
void updateCardInfoRight(const QModelIndex &current, const QModelIndex &previous);
void updateSearch(const QString &search);
void updateName(const QString &name);
void updateComments();
void updateHash();
void updateCardInfoLeft(const QModelIndex &current, const QModelIndex &previous);
void updateCardInfoRight(const QModelIndex &current, const QModelIndex &previous);
void updateSearch(const QString &search);
void actNewDeck();
void actLoadDeck();
bool actSaveDeck();
bool actSaveDeckAs();
void actLoadDeckFromClipboard();
void actSaveDeckToClipboard();
void actPrintDeck();
void actAnalyzeDeck();
void actNewDeck();
void actLoadDeck();
bool actSaveDeck();
bool actSaveDeckAs();
void actLoadDeckFromClipboard();
void actSaveDeckToClipboard();
void actPrintDeck();
void actAnalyzeDeck();
void actEditSets();
void actEditTokens();
void actClearSearch();
void actEditSets();
void actEditTokens();
void actClearSearch();
void actAddCard();
void actAddCardToSideboard();
void actRemoveCard();
void actIncrement();
void actDecrement();
void actDecrementCard();
void actDecrementCardFromSideboard();
void actAddCard();
void actAddCardToSideboard();
void actRemoveCard();
void actIncrement();
void actDecrement();
void actDecrementCard();
void actDecrementCardFromSideboard();
void actUpdatePrices();
void finishedUpdatingPrices();
void saveDeckRemoteFinished(const Response &r);
void filterViewCustomContextMenu(const QPoint &point);
void filterRemove(QAction *action);
void saveDeckRemoteFinished(const Response &r);
void filterViewCustomContextMenu(const QPoint &point);
void filterRemove(QAction *action);
private:
CardInfo *currentCardInfo() const;
void addCardHelper(QString zoneName);
void offsetCountAtIndex(const QModelIndex &idx, int offset);
void decrementCardHelper(QString zoneName);
void recursiveExpand(const QModelIndex &index);
bool confirmClose();
CardInfo *currentCardInfo() const;
void addCardHelper(QString zoneName);
void offsetCountAtIndex(const QModelIndex &idx, int offset);
void decrementCardHelper(QString zoneName);
void recursiveExpand(const QModelIndex &index);
bool confirmClose();
CardDatabaseModel *databaseModel;
CardDatabaseDisplayModel *databaseDisplayModel;
DeckListModel *deckModel;
QTreeView *databaseView;
KeySignals dbViewKeySignals;
QTreeView *deckView;
KeySignals deckViewKeySignals;
CardFrame *cardInfo;
QLabel *searchLabel;
SearchLineEdit *searchEdit;
KeySignals searchKeySignals;
QLabel *nameLabel;
QLineEdit *nameEdit;
QLabel *commentsLabel;
QTextEdit *commentsEdit;
QLabel *hashLabel1;
QLabel *hashLabel;
FilterTreeModel *filterModel;
QTreeView *filterView;
CardDatabaseModel *databaseModel;
CardDatabaseDisplayModel *databaseDisplayModel;
DeckListModel *deckModel;
QTreeView *databaseView;
KeySignals dbViewKeySignals;
QTreeView *deckView;
KeySignals deckViewKeySignals;
CardFrame *cardInfo;
QLabel *searchLabel;
SearchLineEdit *searchEdit;
KeySignals searchKeySignals;
QLabel *nameLabel;
QLineEdit *nameEdit;
QLabel *commentsLabel;
QTextEdit *commentsEdit;
QLabel *hashLabel1;
QLabel *hashLabel;
FilterTreeModel *filterModel;
QTreeView *filterView;
QMenu *deckMenu, *dbMenu;
QAction *aNewDeck, *aLoadDeck, *aSaveDeck, *aSaveDeckAs, *aLoadDeckFromClipboard, *aSaveDeckToClipboard, *aPrintDeck, *aAnalyzeDeck, *aClose;
QAction *aEditSets, *aEditTokens, *aClearSearch, *aCardTextOnly;
QMenu *deckMenu, *dbMenu;
QAction *aNewDeck, *aLoadDeck, *aSaveDeck, *aSaveDeckAs, *aLoadDeckFromClipboard, *aSaveDeckToClipboard, *aPrintDeck, *aAnalyzeDeck, *aClose;
QAction *aEditSets, *aEditTokens, *aClearSearch, *aCardTextOnly;
QAction *aAddCard, *aAddCardToSideboard, *aRemoveCard, *aIncrement, *aDecrement, *aUpdatePrices;
bool modified;
bool modified;
public:
TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent = 0);
~TabDeckEditor();
void retranslateUi();
QString getTabText() const;
void setDeck(DeckLoader *_deckLoader);
void setModified(bool _windowModified);
TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent = 0);
~TabDeckEditor();
void retranslateUi();
QString getTabText() const;
void setDeck(DeckLoader *_deckLoader);
void setModified(bool _windowModified);
public slots:
void closeRequest();
void closeRequest();
signals:
void deckEditorClosing(TabDeckEditor *tab);
void deckEditorClosing(TabDeckEditor *tab);
};
#endif