mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
CMake GUI: Add "CMake Reference Manual" help item
And switch the ordering of "Help" and "About".
This commit is contained in:
@@ -181,11 +181,25 @@ CMakeSetupDialog::CMakeSetupDialog()
|
||||
&QCMakeCacheView::collapseAll);
|
||||
|
||||
QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help"));
|
||||
a = HelpMenu->addAction(tr("About"));
|
||||
QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doAbout);
|
||||
a = HelpMenu->addAction(tr("Help"));
|
||||
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);
|
||||
});
|
||||
a = HelpMenu->addAction(tr("About"));
|
||||
QObject::connect(a, &QAction::triggered, this, &CMakeSetupDialog::doAbout);
|
||||
|
||||
this->setAcceptDrops(true);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define CMake_DEFAULT_RECURSION_LIMIT @CMake_DEFAULT_RECURSION_LIMIT@
|
||||
#define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@"
|
||||
#define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@"
|
||||
#define CMAKE_DOC_DIR "/@CMAKE_DOC_DIR@"
|
||||
|
||||
#define CM_FALLTHROUGH cmsys_FALLTHROUGH
|
||||
|
||||
|
||||
@@ -2077,6 +2077,7 @@ static std::string cmSystemToolsCMakeCursesCommand;
|
||||
static std::string cmSystemToolsCMakeGUICommand;
|
||||
static std::string cmSystemToolsCMClDepsCommand;
|
||||
static std::string cmSystemToolsCMakeRoot;
|
||||
static std::string cmSystemToolsHTMLDoc;
|
||||
void cmSystemTools::FindCMakeResources(const char* argv0)
|
||||
{
|
||||
std::string exe_dir;
|
||||
@@ -2166,10 +2167,15 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
|
||||
// Install tree has
|
||||
// - "<prefix><CMAKE_BIN_DIR>/cmake"
|
||||
// - "<prefix><CMAKE_DATA_DIR>"
|
||||
// - "<prefix><CMAKE_DOC_DIR>"
|
||||
if (cmHasLiteralSuffix(exe_dir, CMAKE_BIN_DIR)) {
|
||||
std::string const prefix =
|
||||
exe_dir.substr(0, exe_dir.size() - cmStrLen(CMAKE_BIN_DIR));
|
||||
cmSystemToolsCMakeRoot = cmStrCat(prefix, CMAKE_DATA_DIR);
|
||||
if (cmSystemTools::FileExists(
|
||||
cmStrCat(prefix, CMAKE_DOC_DIR "/html/index.html"))) {
|
||||
cmSystemToolsHTMLDoc = cmStrCat(prefix, CMAKE_DOC_DIR "/html");
|
||||
}
|
||||
}
|
||||
if (cmSystemToolsCMakeRoot.empty() ||
|
||||
!cmSystemTools::FileExists(
|
||||
@@ -2192,6 +2198,11 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
|
||||
cmSystemToolsCMakeRoot = src_dir;
|
||||
}
|
||||
}
|
||||
if (!cmSystemToolsCMakeRoot.empty() && cmSystemToolsHTMLDoc.empty() &&
|
||||
cmSystemTools::FileExists(
|
||||
cmStrCat(dir, "/Utilities/Sphinx/html/index.html"))) {
|
||||
cmSystemToolsHTMLDoc = cmStrCat(dir, "/Utilities/Sphinx/html");
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Bootstrap build knows its source.
|
||||
@@ -2234,6 +2245,11 @@ std::string const& cmSystemTools::GetCMakeRoot()
|
||||
return cmSystemToolsCMakeRoot;
|
||||
}
|
||||
|
||||
std::string const& cmSystemTools::GetHTMLDoc()
|
||||
{
|
||||
return cmSystemToolsHTMLDoc;
|
||||
}
|
||||
|
||||
std::string cmSystemTools::GetCurrentWorkingDirectory()
|
||||
{
|
||||
return cmSystemTools::CollapseFullPath(
|
||||
|
||||
@@ -389,6 +389,7 @@ public:
|
||||
static std::string const& GetCMakeCursesCommand();
|
||||
static std::string const& GetCMClDepsCommand();
|
||||
static std::string const& GetCMakeRoot();
|
||||
static std::string const& GetHTMLDoc();
|
||||
|
||||
/** Get the CWD mapped through the KWSys translation map. */
|
||||
static std::string GetCurrentWorkingDirectory();
|
||||
|
||||
Reference in New Issue
Block a user