From 1e14e63947a56c836dcf918a3ba6a417528d7de8 Mon Sep 17 00:00:00 2001 From: Torsten Paul Date: Wed, 14 Jan 2015 20:01:53 +0100 Subject: [PATCH] Add cheat-sheet link to help menu --- src/MainWindow.h | 1 + src/MainWindow.ui | 9 ++++++--- src/UIUtils.cc | 13 ++++++++++++- src/UIUtils.h | 2 ++ src/mainwin.cc | 6 ++++++ src/openscad.cc | 2 ++ src/openscad.h | 1 + 7 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/MainWindow.h b/src/MainWindow.h index dc5c8140..48e22a28 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -240,6 +240,7 @@ public slots: void helpAbout(); void helpHomepage(); void helpManual(); + void helpCheatSheet(); void helpLibrary(); void helpFontInfo(); void quit(); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index e316e56b..01300dd5 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -360,6 +360,7 @@ + @@ -874,9 +875,6 @@ Show Scale Markers - @@ -1189,6 +1187,11 @@ Hide toolbars + + + Cheat Sheet + + diff --git a/src/UIUtils.cc b/src/UIUtils.cc index 3e8c8c01..8b701c45 100644 --- a/src/UIUtils.cc +++ b/src/UIUtils.cc @@ -34,6 +34,7 @@ #include "qtgettext.h" #include "UIUtils.h" #include "PlatformUtils.h" +#include "openscad.h" QFileInfo UIUtils::openFile(QWidget *parent) { @@ -103,7 +104,17 @@ void UIUtils::openHomepageURL() QDesktopServices::openUrl(QUrl("http://openscad.org/")); } +static void openVersionedURL(QString url) +{ + QDesktopServices::openUrl(QUrl(url.arg(versionnumber.c_str()))); +} + void UIUtils::openUserManualURL() { - QDesktopServices::openUrl(QUrl("http://www.openscad.org/documentation.html")); + openVersionedURL("http://www.openscad.org/documentation.html?version=%1"); +} + +void UIUtils::openCheatSheetURL() +{ + openVersionedURL("http://www.openscad.org/cheatsheet/index.html?version=%1"); } diff --git a/src/UIUtils.h b/src/UIUtils.h index 4e26e35b..5ce87b28 100644 --- a/src/UIUtils.h +++ b/src/UIUtils.h @@ -42,4 +42,6 @@ namespace UIUtils { void openHomepageURL(); void openUserManualURL(); + + void openCheatSheetURL(); } diff --git a/src/mainwin.cc b/src/mainwin.cc index 7e91f4cf..a11dd96e 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -407,6 +407,7 @@ MainWindow::MainWindow(const QString &filename) connect(this->helpActionAbout, SIGNAL(triggered()), this, SLOT(helpAbout())); connect(this->helpActionHomepage, SIGNAL(triggered()), this, SLOT(helpHomepage())); connect(this->helpActionManual, SIGNAL(triggered()), this, SLOT(helpManual())); + connect(this->helpActionCheatSheet, SIGNAL(triggered()), this, SLOT(helpCheatSheet())); connect(this->helpActionLibraryInfo, SIGNAL(triggered()), this, SLOT(helpLibrary())); connect(this->helpActionFontInfo, SIGNAL(triggered()), this, SLOT(helpFontInfo())); @@ -2518,6 +2519,11 @@ void MainWindow::helpManual() UIUtils::openUserManualURL(); } +void MainWindow::helpCheatSheet() +{ + UIUtils::openCheatSheetURL(); +} + void MainWindow::helpLibrary() { if (!this->library_info_dialog) { diff --git a/src/openscad.cc b/src/openscad.cc index 0b0de394..ae9a872a 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -93,6 +93,8 @@ static std::string arg_colorscheme; #define QUOTE(x__) # x__ #define QUOTED(x__) QUOTE(x__) +std::string versionnumber = QUOTED(OPENSCAD_VERSION); + std::string openscad_versionnumber = QUOTED(OPENSCAD_VERSION) #ifdef OPENSCAD_COMMIT " (git " QUOTED(OPENSCAD_COMMIT) ")" diff --git a/src/openscad.h b/src/openscad.h index f37f0253..04f530ed 100644 --- a/src/openscad.h +++ b/src/openscad.h @@ -35,6 +35,7 @@ extern std::string commandline_commands; // doing this, use currentdir to get the original CWD. extern std::string currentdir; +// Version number without the git suffix. extern std::string versionnumber; // Just the number (might have the git commit as suffix), e.g. 2014.12.23.