Skip to content

Commit cf04d25

Browse files
committed
The "short" name is now used to show the parameter and property name in the model tree. The "long" name is shown in the tooltip.
1 parent 832f259 commit cf04d25

7 files changed

Lines changed: 21 additions & 18 deletions

File tree

FEBioStudio/CurveEditor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void CCurveEditor::BuildLoadCurves(QTreeWidgetItem* t1, FSModelComponent* po, co
165165
if (p.GetLoadCurveID() > 0)
166166
{
167167
assert(p.IsVolatile());
168-
string pname = oname + "." + p.GetLongName();
168+
string pname = oname + "." + p.GetShortName();
169169
ui->addTreeItem(t1, QString::fromStdString(pname), &p);
170170
}
171171
}

FEBioStudio/DlgFEBioInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void CDlgFEBioInfo::onExport()
223223
}
224224
}
225225
paramObj["name"] = pi.name();
226-
paramObj["description"] = pi.longName();
226+
paramObj["description"] = (pi.longName() ? pi.longName() : "");
227227
paramObj["default"] = paramVal;
228228
paramObj["units"] = (pi.units() ? pi.units() : "");
229229
paramArray.append(paramObj);
@@ -239,7 +239,7 @@ void CDlgFEBioInfo::onExport()
239239
{
240240
QJsonObject paramObj;
241241
paramObj["name"] = szname;
242-
paramObj["description"] = "";
242+
paramObj["description"] = (prop->GetLongName() ? prop->GetLongName() : "");
243243
paramObj["default"] = "";
244244
paramObj["units"] = "";
245245
paramArray.append(paramObj);

FEBioStudio/FEClassPropsView.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void CPropertySelector::onSelectionChanged(int n)
8989
// also opening a custom dialog, and that works without any issues (with this object's destructor running
9090
// after this function exits as expected).
9191
#ifndef __APPLE__
92-
QString title = QString("Remove %1").arg(QString::fromStdString(m_pp->GetLongName()));
92+
QString title = QString("Remove %1").arg(QString::fromStdString(m_pp->GetName()));
9393
if (QMessageBox::question(this, title, "Are you sure you want to remove this property?", QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
9494
{
9595
emit currentDataChanged(n);
@@ -103,7 +103,7 @@ void CPropertySelector::onSelectionChanged(int n)
103103
{
104104
int superID = m_pp->GetSuperClassID();
105105
int baseID = m_pp->GetPropertyType();
106-
QString title = QString("Add %1").arg(QString::fromStdString(m_pp->GetLongName()));
106+
QString title = QString("Add %1").arg(QString::fromStdString(m_pp->GetName()));
107107
CDlgAddPhysicsItem dlg(title, superID, baseID, nullptr, true, false, this);
108108
dlg.ShowNameAndCategoryFields(false);
109109
if (dlg.exec())
@@ -120,7 +120,7 @@ void CPropertySelector::onSelectionChanged(int n)
120120
{
121121
int superID = m_pp->GetSuperClassID();
122122
int baseID = m_pp->GetPropertyType();
123-
QString title = QString("Copy %1").arg(QString::fromStdString(m_pp->GetLongName()));
123+
QString title = QString("Copy %1").arg(QString::fromStdString(m_pp->GetName()));
124124
FSModelComponent* src = dynamic_cast<FSModelComponent*>(m_pp->GetParent());
125125
CDlgCopyPhysicsItem dlg(title, superID, baseID, src, m_fem, this);
126126
if (dlg.exec())
@@ -231,8 +231,8 @@ class FEClassPropsModel : public QAbstractItemModel
231231
QString name;
232232
if (m_index == -1)
233233
{
234-
string sname = p.GetLongName();
235-
// string sname = FSCore::beautify_string(p.GetLongName());
234+
string sname = p.GetShortName();
235+
// string sname = FSCore::beautify_string(p.GetShortName());
236236
name = QString::fromStdString(sname);
237237
}
238238
else
@@ -253,7 +253,10 @@ class FEClassPropsModel : public QAbstractItemModel
253253
{
254254
if (m_index == -1)
255255
{
256-
QString toolTip = QString("<p><b>parameter:</b> <code>%1</code></p>").arg(p.GetShortName());
256+
QString toolTip;
257+
if (p.GetLongName())
258+
toolTip = QString("<p><b>%1: </b>%2</p>").arg(p.GetShortName()).arg(p.GetLongName());
259+
257260
if (p.IsVolatile())
258261
{
259262
if (p.GetLoadCurveID() > 0)
@@ -534,14 +537,14 @@ class FEClassPropsModel : public QAbstractItemModel
534537
{
535538
if ((p.maxSize()==1) || (m_index < 0))
536539
{
537-
QString s = QString("<b>property:</b> <code>%1</code>").arg(QString::fromStdString(p.GetName()));
540+
QString s = QString("<b>%1: </b>%2").arg(QString::fromStdString(p.GetName())).arg(QString::fromStdString(p.GetLongName()));
538541
return s;
539542
}
540543
}
541544
else
542545
{
543-
// string sname = FSCore::beautify_string(p.GetLongName().c_str());
544-
string sname = p.GetLongName().c_str();
546+
// string sname = FSCore::beautify_string(p.GetName().c_str());
547+
string sname = p.GetName().c_str();
545548
QString s = QString::fromStdString(sname);
546549
if (p.maxSize() != 1)
547550
{
@@ -1047,7 +1050,7 @@ class FEClassPropsModel : public QAbstractItemModel
10471050
if (paramId >= 0)
10481051
{
10491052
Param& p = pc->GetParam(paramId);
1050-
QString name = p.GetLongName();
1053+
QString name = p.GetShortName();
10511054

10521055
if (name.contains(m_filter, Qt::CaseInsensitive) == false)
10531056
{

FEBioStudio/MaterialPropsView.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class CMaterialPropsModel : public QAbstractItemModel
197197
Param& p = m_pm->GetParam(m_paramId);
198198
if (column == 0)
199199
{
200-
QString name(p.GetLongName());
200+
QString name(p.GetShortName());
201201
if (m_flag & Item_Indented)
202202
{
203203
name = " " + name;

FEBioStudio/ModelViewer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,8 @@ void CModelViewer::on_props_paramChanged(FSCoreBase* pc, Param* p)
659659
}
660660

661661
QString sp;
662-
if (po) sp = QString("\"%1.%2\"").arg(QString::fromStdString(po->GetName())).arg(p->GetLongName());
663-
else sp = QString("\"%1\"").arg(p->GetLongName());
662+
if (po) sp = QString("\"%1.%2\"").arg(QString::fromStdString(po->GetName())).arg(p->GetShortName());
663+
else sp = QString("\"%1\"").arg(p->GetShortName());
664664

665665
QString sv;
666666
switch (p->GetParamType())

FEBioStudio/ObjectProps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void CObjectProps::AddParameter(Param& p)
4141
{
4242
CProperty* prop = nullptr;
4343

44-
const char* szname = p.GetLongName();
44+
const char* szname = p.GetShortName();
4545
std::string sname = (m_beautify ? FSCore::beautify_string(szname) : szname);
4646
QString paramName = QString::fromStdString(sname);
4747

FEMLib/FEUserMaterial.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void FSUserMaterial::Save(OArchive &ar)
7474
{
7575
Param& p = PB[i];
7676
int ntype = p.GetParamType();
77-
ar.WriteChunk(PARAMNAME, (char*) p.GetLongName());
77+
ar.WriteChunk(PARAMNAME, (char*) p.GetShortName());
7878
ar.WriteChunk(PARAMTYPE, ntype);
7979
ar.BeginChunk(PARAMVALUE);
8080
{

0 commit comments

Comments
 (0)