summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorronso0 <ronso0@mixxx.org>2021-03-28 04:14:53 +0200
committerronso0 <ronso0@mixxx.org>2021-03-29 16:04:21 +0200
commit1a48b2d7d8913ab248ccb5c2a848bf4ed004dfea (patch)
treea7570e8976d1a2a2c6e0d4c5bd3d9eee1c62924b
parent407c7962031ebc9f6c6a57d79afb5efa5aa5648e (diff)
Help menu: link to local keyboard shortcut overview file if available
-rw-r--r--src/defs_urls.h1
-rw-r--r--src/widget/wmainmenubar.cpp64
2 files changed, 50 insertions, 15 deletions
diff --git a/src/defs_urls.h b/src/defs_urls.h
index e2419f55a2..b6af77fb8d 100644
--- a/src/defs_urls.h
+++ b/src/defs_urls.h
@@ -49,3 +49,4 @@
#define MIXXX_MANUAL_VINYL_TROUBLESHOOTING_URL \
MIXXX_MANUAL_URL "/chapters/vinyl_control.html#troubleshooting"
#define MIXXX_MANUAL_FILENAME "Mixxx-Manual.pdf"
+#define MIXXX_KBD_SHORTCUTS_FILENAME "Mixxx-Keyboard-Shortcuts.pdf"
diff --git a/src/widget/wmainmenubar.cpp b/src/widget/wmainmenubar.cpp
index 343fdbb0e0..5f869eebf2 100644
--- a/src/widget/wmainmenubar.cpp
+++ b/src/widget/wmainmenubar.cpp
@@ -521,6 +521,7 @@ void WMainMenuBar::initialize() {
// HELP MENU
QMenu* pHelpMenu = new QMenu(tr("&Help"), this);
+ QDir resourceDir(m_pConfig->getResourcePath());
QString externalLinkSuffix;
#ifndef __APPLE__
// According to Apple's Human Interface Guidelines devs are encouraged
@@ -529,6 +530,7 @@ void WMainMenuBar::initialize() {
externalLinkSuffix = QChar(' ') + QChar(0x2197); // north-east arrow
#endif
+ // Community Support
QString supportTitle = tr("&Community Support") + externalLinkSuffix;
QString supportText = tr("Get help with Mixxx");
auto* pHelpSupport = new QAction(supportTitle, this);
@@ -538,26 +540,27 @@ void WMainMenuBar::initialize() {
this, [this] { slotVisitUrl(MIXXX_SUPPORT_URL); });
pHelpMenu->addAction(pHelpSupport);
- QDir resourceDir(m_pConfig->getResourcePath());
+ // User Manual
// Default to the mixxx.org hosted version of the manual.
QUrl qManualUrl(MIXXX_MANUAL_URL);
+ QDir manualDir(resourceDir);
QString manualSuffix;
#if defined(__APPLE__)
// FIXME: We don't include the PDF manual in the bundle on OSX.
// Default to the web-hosted version.
#elif defined(__WINDOWS__)
// On Windows, the manual PDF sits in the same folder as the 'skins' folder.
- if (resourceDir.exists(MIXXX_MANUAL_FILENAME)) {
+ if (manualDir.exists(MIXXX_MANUAL_FILENAME)) {
qManualUrl = QUrl::fromLocalFile(
- resourceDir.absoluteFilePath(MIXXX_MANUAL_FILENAME));
+ manualDir.absoluteFilePath(MIXXX_MANUAL_FILENAME));
} else {
manualSuffix = externalLinkSuffix;
}
#elif defined(__LINUX__)
// On GNU/Linux, the manual is installed to e.g. /usr/share/doc/mixxx/
- if (resourceDir.cd("../doc/mixxx") && resourceDir.exists(MIXXX_MANUAL_FILENAME)) {
+ if (manualDir.cd("../doc/mixxx") && manualDir.exists(MIXXX_MANUAL_FILENAME)) {
qManualUrl = QUrl::fromLocalFile(
- resourceDir.absoluteFilePath(MIXXX_MANUAL_FILENAME));
+ manualDir.absoluteFilePath(MIXXX_MANUAL_FILENAME));
} else {
manualSuffix = externalLinkSuffix;
}
@@ -565,7 +568,6 @@ void WMainMenuBar::initialize() {
// No idea, default to the mixxx.org hosted version.
manualSuffix = externalLinkSuffix;
#endif
-
QString manualTitle = tr("&User Manual") + manualSuffix;
QString manualText = tr("Read the Mixxx user manual.");
auto* pHelpManual = new QAction(manualTitle, this);
@@ -575,16 +577,48 @@ void WMainMenuBar::initialize() {
this, [this, qManualUrl] { slotVisitUrl(qManualUrl.toString()); });
pHelpMenu->addAction(pHelpManual);
- QString shortcutsTitle = tr("&Keyboard Shortcuts") + externalLinkSuffix;
+ // Keyboard Shortcuts
+ QUrl qKeyboardShortcutsUrl(MIXXX_MANUAL_SHORTCUTS_URL);
+ QDir kbdShortcutsDir(resourceDir);
+ QString kbdShortcutsSuffix;
+#if defined(__APPLE__)
+ // FIXME: We don't include the PDF manual in the bundle on OSX.
+ // Default to the web-hosted version.
+#elif defined(__WINDOWS__)
+ // On Windows, the shortcut PDF sits in the same folder as the 'skins' folder.
+ if (kbdShortcutsDir.exists(MIXXX_KBD_SHORTCUTS_FILENAME)) {
+ qKeyboardShortcutsUrl = QUrl::fromLocalFile(
+ kbdShortcutsDir.absoluteFilePath(MIXXX_KBD_SHORTCUTS_FILENAME));
+ } else {
+ kbdShortcutsSuffix = externalLinkSuffix;
+ }
+#elif defined(__LINUX__)
+ // On GNU/Linux, the shortcut is installed to e.g. /usr/share/doc/mixxx/
+ if (kbdShortcutsDir.cd("../doc/mixxx") &&
+ kbdShortcutsDir.exists(MIXXX_KBD_SHORTCUTS_FILENAME)) {
+ qKeyboardShortcutsUrl = QUrl::fromLocalFile(
+ kbdShortcutsDir.absoluteFilePath(MIXXX_KBD_SHORTCUTS_FILENAME));
+ } else {
+ kbdShortcutsSuffix = externalLinkSuffix;
+ }
+#else
+ // No idea, default to the mixxx.org hosted version.
+ kbdShortcutsSuffix = externalLinkSuffix;
+#endif
+ QString shortcutsTitle = tr("&Keyboard Shortcuts") + kbdShortcutsSuffix;
QString shortcutsText = tr("Speed up your workflow with keyboard shortcuts.");
- auto* pHelpShortcuts = new QAction(shortcutsTitle, this);
- pHelpShortcuts->setStatusTip(shortcutsText);
- pHelpShortcuts->setWhatsThis(buildWhatsThis(shortcutsTitle, shortcutsText));
- connect(pHelpShortcuts, &QAction::triggered, this, [this] {
- slotVisitUrl(MIXXX_MANUAL_SHORTCUTS_URL);
- });
- pHelpMenu->addAction(pHelpShortcuts);
-
+ auto* pHelpKbdShortcuts = new QAction(shortcutsTitle, this);
+ pHelpKbdShortcuts->setStatusTip(shortcutsText);
+ pHelpKbdShortcuts->setWhatsThis(buildWhatsThis(shortcutsTitle, shortcutsText));
+ connect(pHelpKbdShortcuts,
+ &QAction::triggered,
+ this,
+ [this, qKeyboardShortcutsUrl] {
+ slotVisitUrl(qKeyboardShortcutsUrl.toString());
+ });
+ pHelpMenu->addAction(pHelpKbdShortcuts);
+
+ // Translate This Application
QString translateTitle = tr("&Translate This Application") + externalLinkSuffix;
QString translateText = tr("Help translate this application into your language.");
auto* pHelpTranslation = new QAction(translateTitle, this);