summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-02-09 16:31:04 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-02-09 16:33:06 (GMT)
commitb5383bc76798284dc928dd1d63b5f95d1a00f6b6 (patch)
treeee7c10be7098dc61be24cc74dd6af8afa1210841 /Source/QtDialog
parent536f35c4f155d9d6b234659562bb34607c9b93ce (diff)
downloadCMake-b5383bc76798284dc928dd1d63b5f95d1a00f6b6.zip
CMake-b5383bc76798284dc928dd1d63b5f95d1a00f6b6.tar.gz
CMake-b5383bc76798284dc928dd1d63b5f95d1a00f6b6.tar.bz2
cmake-gui: Add optional filename argument to --browse-manual
Diffstat (limited to 'Source/QtDialog')
-rw-r--r--Source/QtDialog/CMakeSetup.cxx11
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx7
2 files changed, 12 insertions, 6 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 50e8e3a..21ed8c8 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -34,7 +34,7 @@ const cmDocumentationEntry cmDocumentationUsage = {
" 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] --browse-manual"
+ " cmake-gui [options] --browse-manual [<filename>]"
};
const cmDocumentationEntry cmDocumentationOptions[3] = {
@@ -62,7 +62,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin);
int CMakeGUIExec(CMakeSetupDialog* window);
void SetupDefaultQSettings();
-void OpenReferenceManual();
+void OpenReferenceManual(const QString& filename);
int main(int argc, char** argv)
{
@@ -199,7 +199,12 @@ int main(int argc, char** argv)
}
presetName = preset.toStdString();
} else if (arg == "--browse-manual") {
- OpenReferenceManual();
+ ++i;
+ if (i >= args.size()) {
+ OpenReferenceManual("index.html");
+ } else {
+ OpenReferenceManual(args[i]);
+ }
return 0;
}
}
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 3d4d726..8641407 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -42,7 +42,7 @@
#include "RegexExplorer.h"
#include "WarningMessagesDialog.h"
-void OpenReferenceManual()
+void OpenReferenceManual(const QString& filename)
{
QString urlFormat("https://cmake.org/cmake/help/v%1.%2/");
QUrl url(urlFormat.arg(QString::number(cmVersion::GetMajorVersion()),
@@ -51,7 +51,7 @@ void OpenReferenceManual()
if (!cmSystemTools::GetHTMLDoc().empty()) {
url = QUrl::fromLocalFile(
QDir(QString::fromStdString(cmSystemTools::GetHTMLDoc()))
- .filePath("index.html"));
+ .filePath(filename));
}
QDesktopServices::openUrl(url);
@@ -212,7 +212,8 @@ 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, OpenReferenceManual);
+ QObject::connect(a, &QAction::triggered, this,
+ [] { OpenReferenceManual("index.html"); });
a = HelpMenu->addAction(tr("About"));
QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doAbout);