From 2b1b300eaecbb865c2e4c01b48abdfddef960b6a Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 2 Mar 2022 19:07:44 +0100 Subject: [PATCH] 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 --- src/Gui/MainWindow.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 6343df10f1..1c87ebb617 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -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); + } } }