CLinkModel: Make strings as translatable where applicable
This commit is contained in:
parent
28e6efb060
commit
ae34c2461d
|
@ -35,43 +35,43 @@ int CLinkModel::columnCount(const QModelIndex& /*rkParent*/) const
|
|||
|
||||
QVariant CLinkModel::data(const QModelIndex& rkIndex, int Role) const
|
||||
{
|
||||
if (!mpObject) return QVariant::Invalid;
|
||||
if (!mpObject)
|
||||
return QVariant::Invalid;
|
||||
|
||||
else if ((Role == Qt::DisplayRole) || (Role == Qt::ToolTipRole))
|
||||
if (Role == Qt::DisplayRole || Role == Qt::ToolTipRole)
|
||||
{
|
||||
CLink *pLink = mpObject->Link(mType, rkIndex.row());
|
||||
|
||||
switch (rkIndex.column())
|
||||
{
|
||||
|
||||
case 0: // Column 0 - Target Object
|
||||
{
|
||||
uint32 TargetID = (mType == ELinkType::Incoming ? pLink->SenderID() : pLink->ReceiverID());
|
||||
CScriptObject *pTarget = mpObject->Area()->InstanceByID(TargetID);
|
||||
const uint32 TargetID = (mType == ELinkType::Incoming ? pLink->SenderID() : pLink->ReceiverID());
|
||||
const CScriptObject *pTarget = mpObject->Area()->InstanceByID(TargetID);
|
||||
|
||||
if (pTarget)
|
||||
{
|
||||
QString ObjType = QString("[%1] ").arg(UICommon::ToQString(pTarget->Template()->Name()));
|
||||
const QString ObjType = tr("[%1] ").arg(UICommon::ToQString(pTarget->Template()->Name()));
|
||||
return ObjType + UICommon::ToQString(pTarget->InstanceName());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
QString StrID = QString::number(TargetID, 16).toUpper();
|
||||
while (StrID.length() < 8) StrID = "0" + StrID;
|
||||
return QString("External: ") + StrID;
|
||||
while (StrID.length() < 8)
|
||||
StrID = "0" + StrID;
|
||||
return tr("External: %1").arg(StrID);
|
||||
}
|
||||
}
|
||||
|
||||
case 1: // Column 1 - State
|
||||
{
|
||||
TString StateName = mpObject->GameTemplate()->StateByID(pLink->State()).Name;
|
||||
const TString StateName = mpObject->GameTemplate()->StateByID(pLink->State()).Name;
|
||||
return UICommon::ToQString(StateName);
|
||||
}
|
||||
|
||||
case 2: // Column 2 - Message
|
||||
{
|
||||
TString MessageName = mpObject->GameTemplate()->MessageByID(pLink->Message()).Name;
|
||||
const TString MessageName = mpObject->GameTemplate()->MessageByID(pLink->Message()).Name;
|
||||
return UICommon::ToQString(MessageName);
|
||||
}
|
||||
|
||||
|
@ -80,21 +80,21 @@ QVariant CLinkModel::data(const QModelIndex& rkIndex, int Role) const
|
|||
}
|
||||
}
|
||||
|
||||
else return QVariant::Invalid;
|
||||
return QVariant::Invalid;
|
||||
}
|
||||
|
||||
QVariant CLinkModel::headerData(int Section, Qt::Orientation Orientation, int Role) const
|
||||
{
|
||||
if ((Orientation == Qt::Horizontal) && (Role == Qt::DisplayRole))
|
||||
if (Orientation == Qt::Horizontal && Role == Qt::DisplayRole)
|
||||
{
|
||||
switch (Section)
|
||||
{
|
||||
case 0: return (mType == ELinkType::Incoming ? "Sender" : "Target");
|
||||
case 1: return "State";
|
||||
case 2: return "Message";
|
||||
case 0: return (mType == ELinkType::Incoming ? tr("Sender") : tr("Target"));
|
||||
case 1: return tr("State");
|
||||
case 2: return tr("Message");
|
||||
default: return QVariant::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
else return QVariant::Invalid;
|
||||
return QVariant::Invalid;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue