mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-05 07:10:26 +00:00
CMake GUI: Add --browse-manual argument
This commit is contained in:
@@ -11,6 +11,7 @@ Synopsis
|
|||||||
cmake-gui [<options>]
|
cmake-gui [<options>]
|
||||||
cmake-gui [<options>] {<path-to-source> | <path-to-existing-build>}
|
cmake-gui [<options>] {<path-to-source> | <path-to-existing-build>}
|
||||||
cmake-gui [<options>] -S <path-to-source> -B <path-to-build>
|
cmake-gui [<options>] -S <path-to-source> -B <path-to-build>
|
||||||
|
cmake-gui [<options>] --browse-manual
|
||||||
|
|
||||||
Description
|
Description
|
||||||
===========
|
===========
|
||||||
@@ -40,6 +41,9 @@ Options
|
|||||||
Name of the preset to use from the project's
|
Name of the preset to use from the project's
|
||||||
:manual:`presets <cmake-presets(7)>` files, if it has them.
|
:manual:`presets <cmake-presets(7)>` files, if it has them.
|
||||||
|
|
||||||
|
``--browse-manual``
|
||||||
|
Open the CMake reference manual in a browser and immediately exit.
|
||||||
|
|
||||||
.. include:: OPTIONS_HELP.txt
|
.. include:: OPTIONS_HELP.txt
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ static const char* cmDocumentationUsage[][2] = {
|
|||||||
" cmake-gui [options]\n"
|
" cmake-gui [options]\n"
|
||||||
" cmake-gui [options] <path-to-source>\n"
|
" cmake-gui [options] <path-to-source>\n"
|
||||||
" cmake-gui [options] <path-to-existing-build>\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 }
|
{ nullptr, nullptr }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -56,6 +57,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin);
|
|||||||
|
|
||||||
int CMakeGUIExec(CMakeSetupDialog* window);
|
int CMakeGUIExec(CMakeSetupDialog* window);
|
||||||
void SetupDefaultQSettings();
|
void SetupDefaultQSettings();
|
||||||
|
void OpenReferenceManual();
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
@@ -193,6 +195,9 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
presetName = preset.toLocal8Bit().data();
|
presetName = preset.toLocal8Bit().data();
|
||||||
|
} else if (arg == "--browse-manual") {
|
||||||
|
OpenReferenceManual();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!sourceDirectory.empty() &&
|
if (!sourceDirectory.empty() &&
|
||||||
|
|||||||
@@ -43,6 +43,21 @@
|
|||||||
#include "RegexExplorer.h"
|
#include "RegexExplorer.h"
|
||||||
#include "WarningMessagesDialog.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 {
|
namespace {
|
||||||
const QString PRESETS_DISABLED_TOOLTIP =
|
const QString PRESETS_DISABLED_TOOLTIP =
|
||||||
"This option is disabled because there are no available presets in "
|
"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);
|
QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doHelp);
|
||||||
a->setShortcut(QKeySequence::HelpContents);
|
a->setShortcut(QKeySequence::HelpContents);
|
||||||
a = HelpMenu->addAction(tr("CMake Reference Manual"));
|
a = HelpMenu->addAction(tr("CMake Reference Manual"));
|
||||||
QObject::connect(a, &QAction::triggered, this, []() {
|
QObject::connect(a, &QAction::triggered, this, 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);
|
|
||||||
});
|
|
||||||
a = HelpMenu->addAction(tr("About"));
|
a = HelpMenu->addAction(tr("About"));
|
||||||
QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doAbout);
|
QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doAbout);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user