improve help implementation

This commit is contained in:
Geoffray Levasseur committed 2026-11-07 13:25:21 +01:00
1 parent 2dcc63875d
commit 9ef24e3a9e
10 files changed
+52 -26

No files matched your search

+18 -11
View File
@@ -1696,25 +1696,32 @@ void ListDlg::mousePressEvent(QMouseEvent *event)
case ListKind::ChooseTech:
case ListKind::ChooseEnemyTech:
case ListKind::StealTech:
if (lix == adMilitary)
if (lix == adMilitary) {
// TODO: needs a live HelpDlg instance's textIndex('MILRES')
// (MainScreen singleton not ported) - opens the text page
// list instead of the exact targeted entry.
Help::showNewContent(WindowMode::Persistent, Help::LinkCategory::Text, 0);
else if (lix < adMilitary)
Help::showNewContent(WindowMode::Persistent, Help::LinkCategory::Adv, lix);
if (auto *dlg = Term::mainScreenHelpDlg())
dlg->showNewContent(WindowMode::Persistent, Help::LinkCategory::Text, 0);
} else if (lix < adMilitary) {
if (auto *dlg = Term::mainScreenHelpDlg())
dlg->showNewContent(WindowMode::Persistent, Help::LinkCategory::Adv, lix);
}
break;
case ListKind::Project:
if (lix == cpImp + imTrGoods)
Help::showNewContent(WindowMode::Persistent, Help::LinkCategory::Text, 0);
else if ((lix & (cpImp | cpType)) == 0)
if (lix == cpImp + imTrGoods) {
if (auto *dlg = Term::mainScreenHelpDlg())
dlg->showNewContent(WindowMode::Persistent, Help::LinkCategory::Text, 0);
} else if ((lix & (cpImp | cpType)) == 0) {
UnitStat::showNewContentOwnModel(WindowMode::Persistent, lix & cpIndex);
else if ((lix & cpType) == 0 && lix != cpImp + imTrGoods)
Help::showNewContent(WindowMode::Persistent, Help::LinkCategory::Imp, lix & cpIndex);
} else if ((lix & cpType) == 0 && lix != cpImp + imTrGoods) {
if (auto *dlg = Term::mainScreenHelpDlg())
dlg->showNewContent(WindowMode::Persistent, Help::LinkCategory::Imp, lix & cpIndex);
}
break;
case ListKind::Government:
Help::showNewContent(WindowMode::Persistent, Help::LinkCategory::Misc,
static_cast<int>(Help::MiscLinkIndex::GovList));
if (auto *dlg = Term::mainScreenHelpDlg())
dlg->showNewContent(WindowMode::Persistent, Help::LinkCategory::Misc,
static_cast<int>(Help::MiscLinkIndex::GovList));
break;
default:
break;