Preparation for Help module

Added a preference switch to enable the use of the Help module.
Doing this before the release so users of 0.20 will be able to
use the Help module when it's ready
This commit is contained in:
Yorik van Havre
2022-03-02 19:07:44 +01:00
parent 3a85c7c729
commit e4ca93bfbc

View File

@@ -691,14 +691,22 @@ void MainWindow::whatsThis()
void MainWindow::showDocumentation(const QString& help)
{
QUrl url(help);
if (url.scheme().isEmpty()) {
QString page;
page = QString::fromUtf8("%1.html").arg(help);
d->assistant->showDocumentation(page);
}
else {
QDesktopServices::openUrl(url);
// temporary - allows to enable/disable the use of the Help module
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Help");
bool useHelpModule = hGrp->GetBool("UseHelpModule", false);
if (useHelpModule) {
Gui::Command::addModule(Gui::Command::Gui,"Help");
Gui::Command::doCommand(Gui::Command::Gui,"Help.show(\"%s\")", help.toStdString().c_str());
} else {
QUrl url(help);
if (url.scheme().isEmpty()) {
QString page;
page = QString::fromUtf8("%1.html").arg(help);
d->assistant->showDocumentation(page);
}
else {
QDesktopServices::openUrl(url);
}
}
}