Show translated names in combobox.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-07-03 20:06:30 +03:00
parent fb71593e93
commit 1a67aafe05

View File

@ -155,10 +155,20 @@ void DialogTool::FillComboBoxCurves(QComboBox *box) const
obj->getType() == GOType::SplinePath) && obj->getMode() == Draw::Calculation) obj->getType() == GOType::SplinePath) && obj->getMode() == Draw::Calculation)
{ {
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(i.key()); const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(i.key());
QString newName = curve->name();
int bias = 0;
if (qApp->TrVars()->VariablesToUser(newName, 0, curve->name(), bias))
{
list[newName] = i.key();
}
else
{
list[curve->name()] = i.key(); list[curve->name()] = i.key();
} }
} }
} }
}
FillList(box, list); FillList(box, list);
} }
@ -508,9 +518,7 @@ CrossCirclesPoint DialogTool::getCurrentCrossPoint(QComboBox *box) const
bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &toolTip) bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &toolTip)
{ {
SCASSERT(box != nullptr); SCASSERT(box != nullptr);
const QSharedPointer<VGObject> obj = data->GetGObject(id); const qint32 index = box->findData(id);
SCASSERT(obj.isNull() == false);
const qint32 index = box->findText(obj->name());
if ( index != -1 ) if ( index != -1 )
{ // -1 for not found { // -1 for not found
box->setCurrentIndex(index); box->setCurrentIndex(index);
@ -519,7 +527,7 @@ bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &too
} }
else else
{ {
qWarning()<<"Can't find object by name"<<obj->name(); qWarning()<<"Can't find object by id"<<id;
} }
return false; return false;
} }
@ -832,10 +840,20 @@ void DialogTool::FillCombo(QComboBox *box, GOType gType, FillComboBox rule, cons
if (obj->getType() == gType && obj->getMode() == Draw::Calculation) if (obj->getType() == gType && obj->getMode() == Draw::Calculation)
{ {
const QSharedPointer<GObject> arc = data->GeometricObject<GObject>(i.key()); const QSharedPointer<GObject> arc = data->GeometricObject<GObject>(i.key());
QString newName = arc->name();
int bias = 0;
if (qApp->TrVars()->VariablesToUser(newName, 0, arc->name(), bias))
{
list[newName] = i.key();
}
else
{
list[arc->name()] = i.key(); list[arc->name()] = i.key();
} }
} }
} }
}
else else
{ {
if (i.key() != toolId) if (i.key() != toolId)
@ -844,11 +862,21 @@ void DialogTool::FillCombo(QComboBox *box, GOType gType, FillComboBox rule, cons
if (obj->getType() == gType && obj->getMode() == Draw::Calculation) if (obj->getType() == gType && obj->getMode() == Draw::Calculation)
{ {
const QSharedPointer<GObject> arc = data->GeometricObject<GObject>(i.key()); const QSharedPointer<GObject> arc = data->GeometricObject<GObject>(i.key());
QString newName = arc->name();
int bias = 0;
if (qApp->TrVars()->VariablesToUser(newName, 0, arc->name(), bias))
{
list[newName] = i.key();
}
else
{
list[arc->name()] = i.key(); list[arc->name()] = i.key();
} }
} }
} }
} }
}
FillList(box, list); FillList(box, list);
box->blockSignals(false); box->blockSignals(false);