summaryrefslogtreecommitdiffstats
path: root/src/controllers
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2021-01-06 01:46:28 +0100
committerGitHub <noreply@github.com>2021-01-06 01:46:28 +0100
commitd688a25873c3432a9cf47cba66543e7176c9e10f (patch)
tree258dae248cdd5e67bdefa9603375685390a6ca18 /src/controllers
parent3ebc02c78a1d368a0c8dc6650f920018f8d06534 (diff)
parent678df3f9fdc7a268ee6f7eede57b8cea38f3f5f8 (diff)
Merge pull request #3464 from ronso0/pref-link-color
Preferences/About: draw links with a more readable color, improve defs_urls usage
Diffstat (limited to 'src/controllers')
-rw-r--r--src/controllers/dlgprefcontroller.cpp111
-rw-r--r--src/controllers/dlgprefcontroller.h4
-rw-r--r--src/controllers/dlgprefcontrollers.cpp38
-rw-r--r--src/controllers/dlgprefcontrollersdlg.ui15
-rw-r--r--src/controllers/midi/midicontroller.cpp8
5 files changed, 90 insertions, 86 deletions
diff --git a/src/controllers/dlgprefcontroller.cpp b/src/controllers/dlgprefcontroller.cpp
index dcfc38d0f9..f6ca3580e3 100644
--- a/src/controllers/dlgprefcontroller.cpp
+++ b/src/controllers/dlgprefcontroller.cpp
@@ -38,6 +38,8 @@ DlgPrefController::DlgPrefController(QWidget* parent,
m_pOutputProxyModel(nullptr),
m_bDirty(false) {
m_ui.setupUi(this);
+ // Create text color for the file and wiki links
+ createLinkColor();
initTableView(m_ui.m_pInputMappingTableView);
initTableView(m_ui.m_pOutputMappingTableView);
@@ -234,40 +236,46 @@ QString DlgPrefController::presetAuthor(
return tr("No Author");
}
-QString DlgPrefController::presetForumLink(
+QString DlgPrefController::presetSupportLinks(
const ControllerPresetPointer pPreset) const {
- QString url;
- if (pPreset) {
- QString link = pPreset->forumlink();
- if (link.length() > 0) {
- url = "<a href=\"" + link + "\">Mixxx Forums</a>";
- }
+ if (!pPreset) {
+ return QString();
}
- return url;
-}
-QString DlgPrefController::presetWikiLink(
- const ControllerPresetPointer pPreset) const {
- QString url;
- if (pPreset) {
- QString link = pPreset->wikilink();
- if (link.length() > 0) {
- url = "<a href=\"" + link + "\">Mixxx Wiki</a>";
- }
+ QStringList linkList;
+
+ QString forumLink = pPreset->forumlink();
+ if (!forumLink.isEmpty()) {
+ linkList << coloredLinkString(
+ m_pLinkColor,
+ "Mixxx Forums",
+ forumLink);
}
- return url;
-}
-QString DlgPrefController::presetManualLink(
- const ControllerPresetPointer pPreset) const {
- QString url;
- if (pPreset) {
- QString link = pPreset->manualLink();
- if (!link.isEmpty()) {
- url = "<a href=\"" + link + "\">Manual</a>";
- }
+ QString wikiLink = pPreset->wikilink();
+ if (!wikiLink.isEmpty()) {
+ linkList << coloredLinkString(
+ m_pLinkColor,
+ "Mixxx Wiki",
+ wikiLink);
+ }
+
+ QString manualLink = pPreset->manualLink();
+ if (!manualLink.isEmpty()) {
+ linkList << coloredLinkString(
+ m_pLinkColor,
+ "Mixxx Manual",
+ manualLink);
}
- return url;
+
+ // There is always at least one support link.
+ // TODO(rryan): This is a horrible general support link for MIDI!
+ linkList << coloredLinkString(
+ m_pLinkColor,
+ tr("Troubleshooting"),
+ MIXXX_WIKI_MIDI_SCRIPTING_URL);
+
+ return QString(linkList.join("&nbsp;&nbsp;"));
}
QString DlgPrefController::presetFileLinks(
@@ -279,20 +287,20 @@ QString DlgPrefController::presetFileLinks(
const QString builtinFileSuffix = QStringLiteral(" (") + tr("built-in") + QStringLiteral(")");
QString systemPresetPath = resourcePresetsPath(m_pConfig);
QStringList linkList;
- QString xmlFileName = QFileInfo(pPreset->filePath()).fileName();
- QString xmlFileLink = QStringLiteral("<a href=\"") +
- pPreset->filePath() + QStringLiteral("\">") +
- xmlFileName + QStringLiteral("</a>");
+ QString xmlFileLink = coloredLinkString(
+ m_pLinkColor,
+ QFileInfo(pPreset->filePath()).fileName(),
+ pPreset->filePath());
if (pPreset->filePath().startsWith(systemPresetPath)) {
xmlFileLink += builtinFileSuffix;
}
linkList << xmlFileLink;
for (const auto& script : pPreset->getScriptFiles()) {
- QString scriptFileLink = QStringLiteral("<a href=\"") +
- script.file.absoluteFilePath() + QStringLiteral("\">") +
- script.name + QStringLiteral("</a>");
-
+ QString scriptFileLink = coloredLinkString(
+ m_pLinkColor,
+ script.name,
+ script.file.absoluteFilePath());
if (!script.file.exists()) {
scriptFileLink +=
QStringLiteral(" (") + tr("missing") + QStringLiteral(")");
@@ -647,35 +655,8 @@ void DlgPrefController::slotShowPreset(ControllerPresetPointer preset) {
m_ui.labelLoadedPreset->setText(presetName(preset));
m_ui.labelLoadedPresetDescription->setText(presetDescription(preset));
m_ui.labelLoadedPresetAuthor->setText(presetAuthor(preset));
- QStringList supportLinks;
-
- QString forumLink = presetForumLink(preset);
- if (forumLink.length() > 0) {
- supportLinks << forumLink;
- }
-
- QString manualLink = presetManualLink(preset);
- if (manualLink.length() > 0) {
- supportLinks << manualLink;
- }
-
- QString wikiLink = presetWikiLink(preset);
- if (wikiLink.length() > 0) {
- supportLinks << wikiLink;
- }
-
- // There is always at least one support link.
- // TODO(rryan): This is a horrible general support link for MIDI!
- QString troubleShooting = QString(
- "<a href=\"http://mixxx.org/wiki/doku.php/midi_scripting\">%1</a>")
- .arg(tr("Troubleshooting"));
- supportLinks << troubleShooting;
-
- QString support = supportLinks.join("&nbsp;&nbsp;");
- m_ui.labelLoadedPresetSupportLinks->setText(support);
-
- QString mappingFileLinks = presetFileLinks(preset);
- m_ui.labelLoadedPresetScriptFileLinks->setText(mappingFileLinks);
+ m_ui.labelLoadedPresetSupportLinks->setText(presetSupportLinks(preset));
+ m_ui.labelLoadedPresetScriptFileLinks->setText(presetFileLinks(preset));
// We mutate this preset so keep a reference to it while we are using it.
// TODO(rryan): Clone it? Technically a waste since nothing else uses this
diff --git a/src/controllers/dlgprefcontroller.h b/src/controllers/dlgprefcontroller.h
index 8b114d9719..75407f616a 100644
--- a/src/controllers/dlgprefcontroller.h
+++ b/src/controllers/dlgprefcontroller.h
@@ -66,9 +66,7 @@ class DlgPrefController : public DlgPreferencePage {
QString presetName(const ControllerPresetPointer pPreset) const;
QString presetAuthor(const ControllerPresetPointer pPreset) const;
QString presetDescription(const ControllerPresetPointer pPreset) const;
- QString presetForumLink(const ControllerPresetPointer pPreset) const;
- QString presetManualLink(const ControllerPresetPointer pPreset) const;
- QString presetWikiLink(const ControllerPresetPointer pPreset) const;
+ QString presetSupportLinks(const ControllerPresetPointer pPreset) const;
QString presetFileLinks(const ControllerPresetPointer pPreset) const;
void applyPresetChanges();
void savePreset();
diff --git a/src/controllers/dlgprefcontrollers.cpp b/src/controllers/dlgprefcontrollers.cpp
index c734944bad..9adef3a00c 100644
--- a/src/controllers/dlgprefcontrollers.cpp
+++ b/src/controllers/dlgprefcontrollers.cpp
@@ -19,6 +19,8 @@ DlgPrefControllers::DlgPrefControllers(DlgPreferences* pPreferences,
m_pControllerManager(pControllerManager),
m_pControllerTreeItem(pControllerTreeItem) {
setupUi(this);
+ // Create text color for the cue mode link "?" to the manual
+ createLinkColor();
setupControllerWidgets();
const QString presetsPath = userPresetsPath(m_pConfig);
@@ -30,6 +32,42 @@ DlgPrefControllers::DlgPrefControllers(DlgPreferences* pPreferences,
&ControllerManager::devicesChanged,
this,
&DlgPrefControllers::rescanControllers);
+
+ // Setting the description text here instead of in the ui file allows to paste
+ // a formatted link (text color is a more readable blend of text color and original link color).
+ txtPresetsOverview->setText(tr(
+ "Mixxx uses \"mappings\" to connect messages from your controller to "
+ "controls in Mixxx. If you do not see a mapping for your controller "
+ "in the \"Load Mapping\" menu when you click on your controller on the "
+ "left sidebar, you may be able to download one online from the %1. "
+ "Place the XML (.xml) and Javascript (.js) file(s) in the \"User Mapping "
+ "Folder\" then restart Mixxx. If you download a mapping in a ZIP file, "
+ "extract the XML and Javascript file(s) from the ZIP file to your "
+ "\"User Mapping Folder\" then restart Mixxx.")
+ .arg(coloredLinkString(
+ m_pLinkColor,
+ QStringLiteral("Mixxx Controller Forums"),
+ MIXXX_CONTROLLER_FORUMS_URL)));
+
+ txtHardwareCompatibility->setText(coloredLinkString(
+ m_pLinkColor,
+ tr("Mixxx DJ Hardware Guide"),
+ MIXXX_WIKI_HARDWARE_COMPATIBILITY_URL));
+
+ txtControllerForums->setText(coloredLinkString(
+ m_pLinkColor,
+ tr("MIDI Mapping File Format"),
+ MIXXX_WIKI_CONTROLLER_PRESET_FORMAT_URL));
+
+ txtControllerPresetFormat->setText(coloredLinkString(
+ m_pLinkColor,
+ QStringLiteral("Mixxx Controller Forums"),
+ MIXXX_CONTROLLER_FORUMS_URL));
+
+ txtControllerScripting->setText(coloredLinkString(
+ m_pLinkColor,
+ tr("MIDI Scripting with Javascript"),
+ MIXXX_WIKI_MIDI_SCRIPTING_URL));
}
DlgPrefControllers::~DlgPrefControllers() {
diff --git a/src/controllers/dlgprefcontrollersdlg.ui b/src/controllers/dlgprefcontrollersdlg.ui
index 45894afc14..5f1aa4e8eb 100644
--- a/src/controllers/dlgprefcontrollersdlg.ui
+++ b/src/controllers/dlgprefcontrollersdlg.ui
@@ -87,9 +87,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text">
- <string>Mixxx uses &quot;mappings&quot; to connect messages from your controller to controls in Mixxx. If you do not see a mapping for your controller in the "Load Mapping" menu when you click on your controller on the left sidebar, you may be able to download one online from the &lt;a href=&quot;https://mixxx.discourse.group/c/controller-mappings/10&quot;&gt;Mixxx Forum&lt;/a&gt;. Place the XML (.xml) and Javascript (.js) file(s) in the &quot;User Mapping Folder&quot; then restart Mixxx. If you download a mapping in a ZIP file, extract the XML and Javascript file(s) from the ZIP file to your &quot;User Mapping Folder&quot; then restart Mixxx:</string>
- </property>
<property name="wordWrap">
<bool>true</bool>
</property>
@@ -138,9 +135,6 @@
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="txtHardwareCompatibility">
- <property name="text">
- <string>&lt;a href=&quot;https://github.com/mixxxdj/mixxx/wiki/Hardware%20compatibility&quot;&gt;Mixxx DJ Hardware Guide&lt;/a&gt;</string>
- </property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
@@ -148,9 +142,6 @@
</item>
<item row="0" column="1">
<widget class="QLabel" name="txtControllerForums">
- <property name="text">
- <string>&lt;a href=&quot;https://mixxx.discourse.group/c/controller-mappings/10&quot;&gt;Mixxx Controller Forums&lt;/a&gt;</string>
- </property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
@@ -158,9 +149,6 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="txtControllerPresetFormat">
- <property name="text">
- <string>&lt;a href=&quot;https://github.com/mixxxdj/mixxx/wiki/Midi-Controller-Mapping-File-Format&quot;&gt;MIDI Mapping File Format&lt;/a&gt;</string>
- </property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
@@ -168,9 +156,6 @@
</item>
<item row="1" column="1">
<widget class="QLabel" name="txtControllerScripting">
- <property name="text">
- <string>&lt;a href=&quot;https://github.com/mixxxdj/mixxx/wiki/midi%20scripting&quot;&gt;MIDI Scripting with Javascript&lt;/a&gt;</string>
- </property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
diff --git a/src/controllers/midi/midicontroller.cpp b/src/controllers/midi/midicontroller.cpp
index fd88cf8390..430141fe8e 100644
--- a/src/controllers/midi/midicontroller.cpp
+++ b/src/controllers/midi/midicontroller.cpp
@@ -4,6 +4,7 @@
#include "controllers/controllerdebug.h"
#include "controllers/defs_controllers.h"
#include "controllers/midi/midiutils.h"
+#include "defs_urls.h"
#include "errordialoghandler.h"
#include "mixer/playermanager.h"
#include "moc_midicontroller.cpp"
@@ -131,9 +132,10 @@ void MidiController::createOutputHandlers() {
QString detailsText = tr("* Check to see that the MixxxControl "
"names are spelled correctly in the mapping "
"file (.xml)\n");
- detailsText += tr("* Make sure the MixxxControls in question actually exist."
- " Visit this wiki page for a complete list: ");
- detailsText += "http://mixxx.org/wiki/doku.php/mixxxcontrols\n\n";
+ detailsText += tr(
+ "* Make sure the MixxxControls in question actually exist."
+ " Visit the manual for a complete list: ");
+ detailsText += MIXXX_MANUAL_CONTROLS_URL + QStringLiteral("\n\n");
detailsText += failures.join("\n");
props->setDetails(detailsText);
ErrorDialogHandler::instance()->requestErrorDialog(props);