Skip to content

Commit

Permalink
turn off QAction::TextHeuristicsRole for the "Settings directory" men…
Browse files Browse the repository at this point in the history
…u item, as it makes take the role of Preferences; fix opening the folder by using QUrl::fromLocalFile
  • Loading branch information
m0dB committed Jun 24, 2023
1 parent a6e6fdb commit 7c67396
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions src/widget/wmainmenubar.cpp
Expand Up @@ -578,8 +578,9 @@ void WMainMenuBar::initialize() {
auto* pHelpSupport = new QAction(supportTitle, this);
pHelpSupport->setStatusTip(supportText);
pHelpSupport->setWhatsThis(buildWhatsThis(supportTitle, supportText));
connect(pHelpSupport, &QAction::triggered,
this, [this] { slotVisitUrl(MIXXX_SUPPORT_URL); });
connect(pHelpSupport, &QAction::triggered, this, [this] {
slotVisitUrl(QUrl(MIXXX_SUPPORT_URL));
});
pHelpMenu->addAction(pHelpSupport);

// User Manual
Expand All @@ -594,7 +595,7 @@ void WMainMenuBar::initialize() {
pHelpManual->setStatusTip(manualText);
pHelpManual->setWhatsThis(buildWhatsThis(manualTitle, manualText));
connect(pHelpManual, &QAction::triggered, this, [this, manualUrl] {
slotVisitUrl(manualUrl.toString());
slotVisitUrl(manualUrl);
});
pHelpMenu->addAction(pHelpManual);

Expand All @@ -614,7 +615,7 @@ void WMainMenuBar::initialize() {
&QAction::triggered,
this,
[this, keyboardShortcutsUrl] {
slotVisitUrl(keyboardShortcutsUrl.toString());
slotVisitUrl(keyboardShortcutsUrl);
});
pHelpMenu->addAction(pHelpKbdShortcuts);

Expand All @@ -623,10 +624,11 @@ void WMainMenuBar::initialize() {
QString settingsDirTitle = tr("&Settings directory");
QString settingsDirText = tr("Open the Mixxx user settings directory.");
auto* pHelpSettingsDir = new QAction(settingsDirTitle, this);
pHelpSettingsDir->setMenuRole(QAction::NoRole);
pHelpSettingsDir->setStatusTip(settingsDirText);
pHelpSettingsDir->setWhatsThis(buildWhatsThis(settingsDirTitle, settingsDirText));
connect(pHelpSettingsDir, &QAction::triggered, this, [this, settingsDirPath] {
slotVisitUrl(settingsDirPath);
slotVisitUrl(QUrl::fromLocalFile(settingsDirPath));
});
pHelpMenu->addAction(pHelpSettingsDir);

Expand All @@ -636,8 +638,9 @@ void WMainMenuBar::initialize() {
auto* pHelpTranslation = new QAction(translateTitle, this);
pHelpTranslation->setStatusTip(translateText);
pHelpTranslation->setWhatsThis(buildWhatsThis(translateTitle, translateText));
connect(pHelpTranslation, &QAction::triggered,
this, [this] { slotVisitUrl(MIXXX_TRANSLATION_URL); });
connect(pHelpTranslation, &QAction::triggered, this, [this] {
slotVisitUrl(QUrl(MIXXX_TRANSLATION_URL));
});
pHelpMenu->addAction(pHelpTranslation);

pHelpMenu->addSeparator();
Expand Down Expand Up @@ -723,8 +726,8 @@ void WMainMenuBar::slotDeveloperDebugger(bool toggle) {
ConfigValue(toggle ? 1 : 0));
}

void WMainMenuBar::slotVisitUrl(const QString& url) {
QDesktopServices::openUrl(QUrl(url));
void WMainMenuBar::slotVisitUrl(const QUrl& url) {
QDesktopServices::openUrl(url);
}

void WMainMenuBar::createVisibilityControl(QAction* pAction,
Expand Down
2 changes: 1 addition & 1 deletion src/widget/wmainmenubar.h
Expand Up @@ -84,7 +84,7 @@ class WMainMenuBar : public QMenuBar {
void slotDeveloperStatsExperiment(bool enable);
void slotDeveloperStatsBase(bool enable);
void slotDeveloperDebugger(bool toggle);
void slotVisitUrl(const QString& url);
void slotVisitUrl(const QUrl& url);

private:
void initialize();
Expand Down

0 comments on commit 7c67396

Please sign in to comment.