mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-29 10:03:55 -07:00
* Fix #3488 ; extracted new translations * Make operators translatable, too
This commit is contained in:
parent
463ef13fe0
commit
4eda7cda9e
7 changed files with 1216 additions and 1019 deletions
|
|
@ -1,47 +1,47 @@
|
|||
#include "cardfilter.h"
|
||||
|
||||
const char *CardFilter::typeName(Type t)
|
||||
const QString CardFilter::typeName(Type t)
|
||||
{
|
||||
switch (t) {
|
||||
case TypeAnd:
|
||||
return "AND";
|
||||
return tr("AND", "Logical conjunction operator used in card filter");
|
||||
case TypeOr:
|
||||
return "OR";
|
||||
return tr("OR", "Logical disjunction operator used in card filter");
|
||||
case TypeAndNot:
|
||||
return "AND NOT";
|
||||
return tr("AND NOT", "Negated logical conjunction operator used in card filter");
|
||||
case TypeOrNot:
|
||||
return "OR NOT";
|
||||
return tr("OR NOT", "Negated logical disjunction operator used in card filter");
|
||||
default:
|
||||
return "";
|
||||
return QString("");
|
||||
}
|
||||
}
|
||||
|
||||
const char *CardFilter::attrName(Attr a)
|
||||
const QString CardFilter::attrName(Attr a)
|
||||
{
|
||||
switch (a) {
|
||||
case AttrName:
|
||||
return "Name";
|
||||
return tr("Name");
|
||||
case AttrType:
|
||||
return "Type";
|
||||
return tr("Type");
|
||||
case AttrColor:
|
||||
return "Color";
|
||||
return tr("Color");
|
||||
case AttrText:
|
||||
return "Text";
|
||||
return tr("Text");
|
||||
case AttrSet:
|
||||
return "Set";
|
||||
return tr("Set");
|
||||
case AttrManaCost:
|
||||
return "Mana Cost";
|
||||
return tr("Mana Cost");
|
||||
case AttrCmc:
|
||||
return "CMC";
|
||||
return tr("CMC");
|
||||
case AttrRarity:
|
||||
return "Rarity";
|
||||
return tr("Rarity");
|
||||
case AttrPow:
|
||||
return "Power";
|
||||
return tr("Power");
|
||||
case AttrTough:
|
||||
return "Toughness";
|
||||
return tr("Toughness");
|
||||
case AttrLoyalty:
|
||||
return "Loyalty";
|
||||
return tr("Loyalty");
|
||||
default:
|
||||
return "";
|
||||
return QString("");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
#ifndef CARDFILTER_H
|
||||
#define CARDFILTER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class CardFilter
|
||||
class CardFilter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
|
|
@ -54,8 +57,8 @@ public:
|
|||
return a;
|
||||
}
|
||||
|
||||
static const char *typeName(Type t);
|
||||
static const char *attrName(Attr a);
|
||||
static const QString typeName(Type t);
|
||||
static const QString attrName(Attr a);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ FilterBuilder::FilterBuilder(QWidget *parent) : QWidget(parent)
|
|||
filterCombo = new QComboBox;
|
||||
filterCombo->setObjectName("filterCombo");
|
||||
for (int i = 0; i < CardFilter::AttrEnd; i++)
|
||||
filterCombo->addItem(tr(CardFilter::attrName(static_cast<CardFilter::Attr>(i))), QVariant(i));
|
||||
filterCombo->addItem(CardFilter::attrName(static_cast<CardFilter::Attr>(i)), QVariant(i));
|
||||
|
||||
typeCombo = new QComboBox;
|
||||
typeCombo->setObjectName("typeCombo");
|
||||
|
|
|
|||
|
|
@ -54,18 +54,14 @@ public:
|
|||
{
|
||||
return (parent() != NULL) ? parent()->childIndex(this) : -1;
|
||||
}
|
||||
virtual QString text() const
|
||||
virtual const QString text() const
|
||||
{
|
||||
return QString(textCStr());
|
||||
return QString("");
|
||||
}
|
||||
virtual bool isLeaf() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual const char *textCStr() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
virtual void nodeChanged() const
|
||||
{
|
||||
if (parent() != NULL)
|
||||
|
|
@ -126,7 +122,7 @@ public:
|
|||
const FilterItemList *findTypeList(CardFilter::Type type) const;
|
||||
FilterItemList *typeList(CardFilter::Type type);
|
||||
FilterTreeNode *parent() const;
|
||||
const char *textCStr() const
|
||||
const QString text() const
|
||||
{
|
||||
return CardFilter::attrName(attr);
|
||||
}
|
||||
|
|
@ -154,7 +150,7 @@ public:
|
|||
}
|
||||
int termIndex(const QString &term) const;
|
||||
FilterTreeNode *termNode(const QString &term);
|
||||
const char *textCStr() const
|
||||
const QString text() const
|
||||
{
|
||||
return CardFilter::typeName(type);
|
||||
}
|
||||
|
|
@ -190,14 +186,10 @@ public:
|
|||
{
|
||||
return p;
|
||||
}
|
||||
QString text() const
|
||||
const QString text() const
|
||||
{
|
||||
return term;
|
||||
}
|
||||
const char *textCStr() const
|
||||
{
|
||||
return term.toStdString().c_str();
|
||||
}
|
||||
bool isLeaf() const
|
||||
{
|
||||
return true;
|
||||
|
|
@ -263,9 +255,9 @@ public:
|
|||
FilterTreeNode *termNode(CardFilter::Attr attr, CardFilter::Type type, const QString &term);
|
||||
FilterTreeNode *termNode(const CardFilter *f);
|
||||
FilterTreeNode *attrTypeNode(CardFilter::Attr attr, CardFilter::Type type);
|
||||
const char *textCStr() const
|
||||
const QString text() const
|
||||
{
|
||||
return "root";
|
||||
return QString("root");
|
||||
}
|
||||
int index() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -128,10 +128,7 @@ QVariant FilterTreeModel::data(const QModelIndex &index, int role) const
|
|||
case Qt::ToolTipRole:
|
||||
case Qt::StatusTipRole:
|
||||
case Qt::WhatsThisRole:
|
||||
if (!node->isLeaf())
|
||||
return tr(node->textCStr());
|
||||
else
|
||||
return node->text();
|
||||
return node->text();
|
||||
case Qt::CheckStateRole:
|
||||
if (node->isEnabled())
|
||||
return Qt::Checked;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue