diff options
author | Brad King <brad.king@kitware.com> | 2020-10-28 11:36:59 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-10-28 11:37:07 (GMT) |
commit | fe310851a8e4f960536a036352c0f9d60b3e8cb0 (patch) | |
tree | f3d2075c2e0aed63a0432436fa01302c26477d1e /Source | |
parent | 1a5c95e82878498e9dcd3ea51828cb9b3978f5d8 (diff) | |
parent | ef03124237a1bbbb47b71faaecbaac174839d1e4 (diff) | |
download | CMake-fe310851a8e4f960536a036352c0f9d60b3e8cb0.zip CMake-fe310851a8e4f960536a036352c0f9d60b3e8cb0.tar.gz CMake-fe310851a8e4f960536a036352c0f9d60b3e8cb0.tar.bz2 |
Merge topic 'cmake-gui-manual-argument' into release-3.19
ef03124237 CMake GUI: Add --browse-manual argument
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5417
Diffstat (limited to 'Source')
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 7 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 29 |
2 files changed, 22 insertions, 14 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 182c23d..7c3675b 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -32,7 +32,8 @@ static const char* cmDocumentationUsage[][2] = { " cmake-gui [options]\n" " cmake-gui [options] <path-to-source>\n" " cmake-gui [options] <path-to-existing-build>\n" - " cmake-gui [options] -S <path-to-source> -B <path-to-build>\n" }, + " cmake-gui [options] -S <path-to-source> -B <path-to-build>\n" + " cmake-gui [options] --browse-manual\n" }, { nullptr, nullptr } }; @@ -56,6 +57,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin); int CMakeGUIExec(CMakeSetupDialog* window); void SetupDefaultQSettings(); +void OpenReferenceManual(); int main(int argc, char** argv) { @@ -193,6 +195,9 @@ int main(int argc, char** argv) return 1; } presetName = preset.toLocal8Bit().data(); + } else if (arg == "--browse-manual") { + OpenReferenceManual(); + return 0; } } if (!sourceDirectory.empty() && diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index a15614d..05518a9 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -43,6 +43,21 @@ #include "RegexExplorer.h" #include "WarningMessagesDialog.h" +void OpenReferenceManual() +{ + QString urlFormat("https://cmake.org/cmake/help/v%1.%2/"); + QUrl url(urlFormat.arg(QString::number(cmVersion::GetMajorVersion()), + QString::number(cmVersion::GetMinorVersion()))); + + if (!cmSystemTools::GetHTMLDoc().empty()) { + url = QUrl::fromLocalFile( + QDir(QString::fromLocal8Bit(cmSystemTools::GetHTMLDoc().data())) + .filePath("index.html")); + } + + QDesktopServices::openUrl(url); +} + namespace { const QString PRESETS_DISABLED_TOOLTIP = "This option is disabled because there are no available presets in " @@ -194,19 +209,7 @@ CMakeSetupDialog::CMakeSetupDialog() QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doHelp); a->setShortcut(QKeySequence::HelpContents); a = HelpMenu->addAction(tr("CMake Reference Manual")); - QObject::connect(a, &QAction::triggered, this, []() { - QString urlFormat("https://cmake.org/cmake/help/v%1.%2/"); - QUrl url(urlFormat.arg(QString::number(cmVersion::GetMajorVersion()), - QString::number(cmVersion::GetMinorVersion()))); - - if (!cmSystemTools::GetHTMLDoc().empty()) { - url = QUrl::fromLocalFile( - QDir(QString::fromLocal8Bit(cmSystemTools::GetHTMLDoc().data())) - .filePath("index.html")); - } - - QDesktopServices::openUrl(url); - }); + QObject::connect(a, &QAction::triggered, this, OpenReferenceManual); a = HelpMenu->addAction(tr("About")); QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doAbout); |