summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorronso0 <ronso0@mixxx.org>2021-01-05 20:16:25 +0100
committerronso0 <ronso0@mixxx.org>2021-01-05 22:11:28 +0100
commit850bbdf347c9b5ec72dd2539c25301f26abf5942 (patch)
treeb3b748061164a442376eb8b7c66bf59713f86e05 /src
parenta0e791157980c5fef0ea6fa3eb06b5fc58835a4f (diff)
string.h: make coloredLinkString() a free function
Diffstat (limited to 'src')
-rw-r--r--src/controllers/dlgprefcontroller.cpp12
-rw-r--r--src/controllers/dlgprefcontrollers.cpp10
-rw-r--r--src/preferences/dialog/dlgprefdeck.cpp2
-rw-r--r--src/preferences/dialog/dlgprefmodplug.cpp2
-rw-r--r--src/preferences/dialog/dlgprefnovinyl.cpp2
-rw-r--r--src/preferences/dialog/dlgprefsound.cpp4
-rw-r--r--src/preferences/dialog/dlgprefvinyl.cpp2
-rw-r--r--src/preferences/dlgpreferencepage.h1
-rw-r--r--src/util/string.h25
9 files changed, 28 insertions, 32 deletions
diff --git a/src/controllers/dlgprefcontroller.cpp b/src/controllers/dlgprefcontroller.cpp
index 647d74a590..8158e45992 100644
--- a/src/controllers/dlgprefcontroller.cpp
+++ b/src/controllers/dlgprefcontroller.cpp
@@ -244,7 +244,7 @@ QString DlgPrefController::presetSupportLinks(
QString forumLink = pPreset->forumlink();
if (!forumLink.isEmpty()) {
- linkList << m_stringFormatter.coloredLinkString(
+ linkList << coloredLinkString(
m_pLinkColor,
"Mixxx Forums",
forumLink);
@@ -252,7 +252,7 @@ QString DlgPrefController::presetSupportLinks(
QString wikiLink = pPreset->wikilink();
if (!wikiLink.isEmpty()) {
- linkList << m_stringFormatter.coloredLinkString(
+ linkList << coloredLinkString(
m_pLinkColor,
"Mixxx Wiki",
wikiLink);
@@ -260,7 +260,7 @@ QString DlgPrefController::presetSupportLinks(
QString manualLink = pPreset->manualLink();
if (!manualLink.isEmpty()) {
- linkList << m_stringFormatter.coloredLinkString(
+ linkList << coloredLinkString(
m_pLinkColor,
"Mixxx Manual",
manualLink);
@@ -268,7 +268,7 @@ QString DlgPrefController::presetSupportLinks(
// There is always at least one support link.
// TODO(rryan): This is a horrible general support link for MIDI!
- linkList << m_stringFormatter.coloredLinkString(
+ linkList << coloredLinkString(
m_pLinkColor,
tr("Troubleshooting"),
MIXXX_WIKI_MIDI_SCRIPTING_URL);
@@ -285,7 +285,7 @@ QString DlgPrefController::presetFileLinks(
const QString builtinFileSuffix = QStringLiteral(" (") + tr("built-in") + QStringLiteral(")");
QString systemPresetPath = resourcePresetsPath(m_pConfig);
QStringList linkList;
- QString xmlFileLink = m_stringFormatter.coloredLinkString(
+ QString xmlFileLink = coloredLinkString(
m_pLinkColor,
QFileInfo(pPreset->filePath()).fileName(),
pPreset->filePath());
@@ -295,7 +295,7 @@ QString DlgPrefController::presetFileLinks(
linkList << xmlFileLink;
for (const auto& script : pPreset->getScriptFiles()) {
- QString scriptFileLink = m_stringFormatter.coloredLinkString(
+ QString scriptFileLink = coloredLinkString(
m_pLinkColor,
script.name,
script.file.absoluteFilePath());
diff --git a/src/controllers/dlgprefcontrollers.cpp b/src/controllers/dlgprefcontrollers.cpp
index 6457ff0ab2..d66daa7ea7 100644
--- a/src/controllers/dlgprefcontrollers.cpp
+++ b/src/controllers/dlgprefcontrollers.cpp
@@ -42,27 +42,27 @@ DlgPrefControllers::DlgPrefControllers(DlgPreferences* pPreferences,
"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(m_stringFormatter.coloredLinkString(
+ .arg(coloredLinkString(
m_pLinkColor,
QStringLiteral("Mixxx Controller Forums"),
MIXXX_CONTROLLER_FORUMS_URL)));
- txtHardwareCompatibility->setText(m_stringFormatter.coloredLinkString(
+ txtHardwareCompatibility->setText(coloredLinkString(
m_pLinkColor,
tr("Mixxx DJ Hardware Guide"),
MIXXX_WIKI_HARDWARE_COMPATIBILITY_URL));
- txtControllerForums->setText(m_stringFormatter.coloredLinkString(
+ txtControllerForums->setText(coloredLinkString(
m_pLinkColor,
tr("MIDI Mapping File Format"),
MIXXX_WIKI_CONTROLLER_PRESET_FORMAT_URL));
- txtControllerPresetFormat->setText(m_stringFormatter.coloredLinkString(
+ txtControllerPresetFormat->setText(coloredLinkString(
m_pLinkColor,
QStringLiteral("Mixxx Controller Forums"),
MIXXX_CONTROLLER_FORUMS_URL));
- txtControllerScripting->setText(m_stringFormatter.coloredLinkString(
+ txtControllerScripting->setText(coloredLinkString(
m_pLinkColor,
tr("MIDI Scripting with Javascript"),
MIXXX_WIKI_MIDI_SCRIPTING_URL));
diff --git a/src/preferences/dialog/dlgprefdeck.cpp b/src/preferences/dialog/dlgprefdeck.cpp
index a37dbf0966..8c943fa276 100644
--- a/src/preferences/dialog/dlgprefdeck.cpp
+++ b/src/preferences/dialog/dlgprefdeck.cpp
@@ -334,7 +334,7 @@ DlgPrefDeck::DlgPrefDeck(QWidget* parent,
// Add "(?)" with a manual link to the label
labelCueMode->setText(labelCueMode->text() + QStringLiteral(" ") +
- m_stringFormatter.coloredLinkString(
+ coloredLinkString(
m_pLinkColor,
QStringLiteral("(?)"),
MIXXX_MANUAL_CUE_MODES_URL));
diff --git a/src/preferences/dialog/dlgprefmodplug.cpp b/src/preferences/dialog/dlgprefmodplug.cpp
index c3c0706e48..d4ed76f8cd 100644
--- a/src/preferences/dialog/dlgprefmodplug.cpp
+++ b/src/preferences/dialog/dlgprefmodplug.cpp
@@ -34,7 +34,7 @@ DlgPrefModplug::DlgPrefModplug(QWidget *parent,
m_pUi->modplugSettingsHint->setText(
tr("All settings take effect on next track load. Currently loaded tracks "
"are not affected. For an explanation of these settings, see the %1")
- .arg(m_stringFormatter.coloredLinkString(
+ .arg(coloredLinkString(
m_pLinkColor,
"OpenMPT manual",
"http://wiki.openmpt.org/Manual:_Setup/Player")));
diff --git a/src/preferences/dialog/dlgprefnovinyl.cpp b/src/preferences/dialog/dlgprefnovinyl.cpp
index d8e20d71ef..94eb893aee 100644
--- a/src/preferences/dialog/dlgprefnovinyl.cpp
+++ b/src/preferences/dialog/dlgprefnovinyl.cpp
@@ -14,7 +14,7 @@ DlgPrefNoVinyl::DlgPrefNoVinyl(QWidget * parent, SoundManager * soundman,
noVinylControlHint->setText(
tr("This version of Mixxx does not support vinyl control.\n"
"Please visit %1 for more information.")
- .arg(m_stringFormatter.coloredLinkString(
+ .arg(coloredLinkString(
m_pLinkColor,
MIXXX_WEBSITE_SHORT_URL,
MIXXX_WEBSITE_URL)));
diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp
index 47bbc14d69..e0baf65b7d 100644
--- a/src/preferences/dialog/dlgprefsound.cpp
+++ b/src/preferences/dialog/dlgprefsound.cpp
@@ -241,7 +241,7 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent,
realtimeHint->setText(
tr("To enable Realtime scheduling (currently disabled), see the %1.")
- .arg(m_stringFormatter.coloredLinkString(
+ .arg(coloredLinkString(
m_pLinkColor,
QStringLiteral("Mixxx Wiki"),
MIXXX_WIKI_AUDIO_LATENCY_URL)));
@@ -249,7 +249,7 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent,
hardwareGuide->setText(
tr("The %1 lists sound cards and controllers you may want to "
"consider for using Mixxx.")
- .arg(m_stringFormatter.coloredLinkString(
+ .arg(coloredLinkString(
m_pLinkColor,
tr("Mixxx DJ Hardware Guide"),
MIXXX_WIKI_HARDWARE_COMPATIBILITY_URL)));
diff --git a/src/preferences/dialog/dlgprefvinyl.cpp b/src/preferences/dialog/dlgprefvinyl.cpp
index fa4183b57b..1a12984ad2 100644
--- a/src/preferences/dialog/dlgprefvinyl.cpp
+++ b/src/preferences/dialog/dlgprefvinyl.cpp
@@ -77,7 +77,7 @@ DlgPrefVinyl::DlgPrefVinyl(QWidget * parent, VinylControlManager *pVCMan,
LeadinTime3->setSuffix(" s");
LeadinTime4->setSuffix(" s");
- TroubleshootingLink->setText(m_stringFormatter.coloredLinkString(
+ TroubleshootingLink->setText(coloredLinkString(
m_pLinkColor,
QStringLiteral("Troubleshooting"),
MIXXX_MANUAL_VINYL_TROUBLESHOOTING_URL));
diff --git a/src/preferences/dlgpreferencepage.h b/src/preferences/dlgpreferencepage.h
index 2871d6c6fb..d2a06a2515 100644
--- a/src/preferences/dlgpreferencepage.h
+++ b/src/preferences/dlgpreferencepage.h
@@ -20,7 +20,6 @@ class DlgPreferencePage : public QWidget {
virtual QUrl helpUrl() const;
QColor m_pLinkColor;
- LinkFormatter m_stringFormatter;
public slots:
/// Called when the preference dialog is shown to the user (not necessarily
diff --git a/src/util/string.h b/src/util/string.h
index 6a93728f40..64941f4c4b 100644
--- a/src/util/string.h
+++ b/src/util/string.h
@@ -26,17 +26,14 @@ class StringCollator {
QCollator m_collator;
};
-class LinkFormatter {
- public:
- // Helper to create html link strings to be used for ui files, mostly in
- // Preferences dialogs.
- QString coloredLinkString(
- const QColor& color,
- const QString& text,
- const QString& baseUrl,
- const QString& extUrl = nullptr) const {
- return QStringLiteral("<a style=\"color:") + color.name() +
- QStringLiteral(";\" href=\"") + baseUrl + extUrl +
- QStringLiteral("\">") + text + QStringLiteral("</a>");
- }
-};
+// Helper to create html link strings to be used for ui files, mostly in
+// Preferences dialogs.
+inline QString coloredLinkString(
+ const QColor& color,
+ const QString& text,
+ const QString& baseUrl,
+ const QString& extUrl = nullptr) {
+ return QStringLiteral("<a style=\"color:") + color.name() +
+ QStringLiteral(";\" href=\"") + baseUrl + extUrl +
+ QStringLiteral("\">") + text + QStringLiteral("</a>");
+}