Skip to content

Commit e5757f6

Browse files
committed
Fixed help feature for discrete materials. Also added help links for plotfile and logfile items in model tree.
1 parent 1bda9ba commit e5757f6

4 files changed

Lines changed: 54 additions & 5 deletions

File tree

FEBioStudio/HelpFeature.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,17 @@ SOFTWARE.*/
2929
#include "HelpFeature.h"
3030
#include <FEBioLink/FEBioClass.h>
3131

32-
#define MANUAL_PATH "https://febiosoftware.github.io/febio-feature-manual/features/"
32+
#define MANUAL_PATH "https://febiosoftware.github.io/febio-feature-manual/"
33+
34+
QString GetPlotHelpURL()
35+
{
36+
return "plotvars";
37+
}
38+
39+
QString GetLogHelpURL()
40+
{
41+
return "logvars";
42+
}
3343

3444
QString ClassIDToURL(int classID)
3545
{
@@ -43,6 +53,7 @@ QString ClassIDToURL(int classID)
4353

4454
QString tmp = QString(classInfo.szmod) + "_" + superClass + "_" + QString(classInfo.sztype);
4555
url = tmp.replace(" ", "_").toLower();
56+
url = "features/" + url;
4657
}
4758
return url;
4859
}

FEBioStudio/HelpFeature.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ SOFTWARE.*/
2828
#include <QString>
2929

3030
QString ClassIDToURL(int classID);
31+
QString GetPlotHelpURL();
32+
QString GetLogHelpURL();
3133
void ShowHelp(const QString& url);

FEBioStudio/ModelTree.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,8 +1220,14 @@ void CModelTree::UpdateDiscrete(QTreeWidgetItem* t1, FSModel& fem)
12201220
{
12211221
GDiscreteSpringSet* pg = dynamic_cast<GDiscreteSpringSet*>(po);
12221222

1223+
QString name = QString::fromStdString(pg->GetName());
1224+
if (auto dm = pg->GetMaterial())
1225+
{
1226+
name += QString(" [") + QString::fromStdString(dm->GetTypeString()) + "]";
1227+
}
1228+
12231229
QTreeWidgetItem* t2 = nullptr;
1224-
t2 = AddTreeItem(t1, QString::fromStdString(pg->GetName()), MT_DISCRETE_SET, pg->size(), pg);
1230+
t2 = AddTreeItem(t1, name, MT_DISCRETE_SET, pg->size(), pg);
12251231

12261232
if (t2 && !pg->IsActive())
12271233
{

FEBioStudio/ModelViewer.cpp

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,27 @@ void CModelViewer::on_refreshButton_clicked()
406406

407407
void CModelViewer::on_helpButton_clicked()
408408
{
409+
// firs check for plotfile
410+
QTreeWidgetItem* it = ui->tree->currentItem();
411+
if (it)
412+
{
413+
QString url;
414+
if (it->text(0) == "plotfile")
415+
{
416+
url = GetPlotHelpURL();
417+
}
418+
else if (it->text(0) == "logfile")
419+
{
420+
url = GetLogHelpURL();
421+
}
422+
423+
if (!url.isEmpty())
424+
{
425+
ShowHelp(url);
426+
return;
427+
}
428+
}
429+
409430
// make sure we have something selected
410431
if (m_currentObject == nullptr)
411432
{
@@ -1980,10 +2001,12 @@ void CModelViewer::ShowContextMenu(CModelTreeItem* data, QPoint pt)
19802001
break;
19812002
case MT_PROJECT_OUTPUT:
19822003
case MT_PROJECT_OUTPUT_PLT:
1983-
menu.addAction("Edit output...", this, SLOT(OnEditOutput()));
2004+
menu.addAction("Edit Output...", this, SLOT(OnEditOutput()));
2005+
menu.addAction("View Help ...", this, SLOT(on_helpButton_clicked()));
19842006
break;
19852007
case MT_PROJECT_OUTPUT_LOG:
1986-
menu.addAction("Edit output...", this, SLOT(OnEditOutputLog()));
2008+
menu.addAction("Edit Output...", this, SLOT(OnEditOutputLog()));
2009+
menu.addAction("View Help ...", this, SLOT(on_helpButton_clicked()));
19872010
break;
19882011
case MT_NAMED_SELECTION:
19892012
menu.addAction("Remove empty", this, SLOT(OnRemoveEmptySelections()));
@@ -2188,7 +2211,7 @@ void CModelViewer::ShowContextMenu(CModelTreeItem* data, QPoint pt)
21882211
if (!url.isEmpty())
21892212
{
21902213
menu.addSeparator();
2191-
menu.addAction("View Help", [=](){ ShowHelp(url); });
2214+
menu.addAction("View Help ...", [=](){ ShowHelp(url); });
21922215
}
21932216

21942217
if (del)
@@ -2737,6 +2760,13 @@ QString CModelViewer::HelpURLFromObject(FSObject* po)
27372760
classID = FEBio::GetClassId(pm->GetSuperClassID(), pm->GetTypeString());
27382761
}
27392762
}
2763+
if (auto ds = dynamic_cast<GDiscreteSpringSet*>(po))
2764+
{
2765+
if (auto dm = ds->GetMaterial())
2766+
{
2767+
classID = FEBio::GetClassId(dm->GetSuperClassID(), dm->GetTypeString());
2768+
}
2769+
}
27402770
FSModelComponent* pmc = dynamic_cast<FSModelComponent*>(po);
27412771
if (pmc)
27422772
{

0 commit comments

Comments
 (0)