Add cheat-sheet link to help menu

master
Torsten Paul 2015-01-14 20:01:53 +01:00
parent 4af38828d2
commit 1e14e63947
7 changed files with 30 additions and 4 deletions

View File

@ -240,6 +240,7 @@ public slots:
void helpAbout();
void helpHomepage();
void helpManual();
void helpCheatSheet();
void helpLibrary();
void helpFontInfo();
void quit();

View File

@ -360,6 +360,7 @@
<addaction name="helpActionAbout"/>
<addaction name="helpActionHomepage"/>
<addaction name="helpActionManual"/>
<addaction name="helpActionCheatSheet"/>
<addaction name="helpActionLibraryInfo"/>
<addaction name="helpActionFontInfo"/>
</widget>
@ -874,9 +875,6 @@
<property name="text">
<string>Show Scale Markers</string>
</property>
<!--<property name="shortcut">
<string></string>
</property>-->
</action>
<action name="viewActionAnimate">
<property name="checkable">
@ -1189,6 +1187,11 @@
<string>Hide toolbars</string>
</property>
</action>
<action name="helpActionCheatSheet">
<property name="text">
<string>Cheat Sheet</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -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");
}

View File

@ -42,4 +42,6 @@ namespace UIUtils {
void openHomepageURL();
void openUserManualURL();
void openCheatSheetURL();
}

View File

@ -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) {

View File

@ -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) ")"

View File

@ -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.