mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-25 08:03:54 -07:00
improved importer
This commit is contained in:
parent
aae2c437d6
commit
3c8f2b878b
9 changed files with 160 additions and 93 deletions
|
|
@ -98,8 +98,9 @@ QString CardInfo::getMainCardType() const
|
|||
|
||||
QString CardInfo::getCorrectedName() const
|
||||
{
|
||||
QString result = name;
|
||||
// Fire // Ice, Circle of Protection: Red
|
||||
return getName().remove(" // ").remove(":");
|
||||
return result.remove(" // ").remove(":");
|
||||
}
|
||||
|
||||
void CardInfo::addToSet(CardSet *set)
|
||||
|
|
@ -204,10 +205,10 @@ QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
|
|||
xml.writeStartElement("card");
|
||||
xml.writeTextElement("name", info->getName());
|
||||
|
||||
SetList sets = info->getSets();
|
||||
const SetList &sets = info->getSets();
|
||||
for (int i = 0; i < sets.size(); i++)
|
||||
xml.writeTextElement("set", sets[i]->getShortName());
|
||||
QStringList colors = info->getColors();
|
||||
const QStringList &colors = info->getColors();
|
||||
for (int i = 0; i < colors.size(); i++)
|
||||
xml.writeTextElement("color", colors[i]);
|
||||
|
||||
|
|
|
|||
|
|
@ -61,15 +61,15 @@ public:
|
|||
const SetList &_sets = SetList(),
|
||||
const QString &_picURL = QString());
|
||||
~CardInfo();
|
||||
QString getName() const { return name; }
|
||||
SetList getSets() const { return sets; }
|
||||
QString getManaCost() const { return manacost; }
|
||||
QString getCardType() const { return cardtype; }
|
||||
QString getPowTough() const { return powtough; }
|
||||
QString getText() const { return text; }
|
||||
const QString &getName() const { return name; }
|
||||
const SetList &getSets() const { return sets; }
|
||||
const QString &getManaCost() const { return manacost; }
|
||||
const QString &getCardType() const { return cardtype; }
|
||||
const QString &getPowTough() const { return powtough; }
|
||||
const QString &getText() const { return text; }
|
||||
void setText(const QString &_text) { text = _text; }
|
||||
QStringList getColors() const { return colors; }
|
||||
QString getPicURL() const { return picURL; }
|
||||
const QStringList &getColors() const { return colors; }
|
||||
const QString &getPicURL() const { return picURL; }
|
||||
QString getMainCardType() const;
|
||||
QString getCorrectedName() const;
|
||||
int getTableRow() const { return tableRow; }
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ QVariant CardDatabaseModel::data(const QModelIndex &index, int role) const
|
|||
case 0: return card->getName();
|
||||
case 1: {
|
||||
QStringList setList;
|
||||
QList<CardSet *> sets = card->getSets();
|
||||
const QList<CardSet *> &sets = card->getSets();
|
||||
for (int i = 0; i < sets.size(); i++)
|
||||
setList << sets[i]->getShortName();
|
||||
return setList.join(", ");
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ WndDeckEditor::WndDeckEditor(CardDatabase *_db, QWidget *parent)
|
|||
databaseView = new QTreeView();
|
||||
databaseView->setModel(databaseDisplayModel);
|
||||
databaseView->setUniformRowHeights(true);
|
||||
databaseView->setAlternatingRowColors(true);
|
||||
databaseView->setSortingEnabled(true);
|
||||
databaseView->sortByColumn(0, Qt::AscendingOrder);
|
||||
databaseView->resizeColumnToContents(0);
|
||||
|
|
@ -194,7 +195,7 @@ void WndDeckEditor::updateCardInfoRight(const QModelIndex ¤t, const QModel
|
|||
|
||||
void WndDeckEditor::updateSearch(const QString &search)
|
||||
{
|
||||
databaseDisplayModel->setFilterRegExp(search);
|
||||
databaseDisplayModel->setFilterFixedString(search);
|
||||
}
|
||||
|
||||
bool WndDeckEditor::confirmClose()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue