diff --git a/res/controllers/Traktor Kontrol S4 MK3.hid.xml b/res/controllers/Traktor Kontrol S4 MK3.hid.xml index 0c6f835c9723..615dd69b7818 100644 --- a/res/controllers/Traktor Kontrol S4 MK3.hid.xml +++ b/res/controllers/Traktor Kontrol S4 MK3.hid.xml @@ -102,9 +102,9 @@ variable="gridButtonBlinkOverBeat" type="boolean" default="false" - label="Make the <tt style='background-color: #111111; color: #d9d9d9;padding: 2px;'>GRID</tt> button blink over the beat"> + label="Make the :hwbtn:`GRID` button blink over the beat"> - This will make the <tt style="background-color: #111111; color: #d9d9d9;padding: 2px;">GRID</tt> button blink when the track is going over a detected beat. This can help adjusting the beat grid or BPM. + This will make the :hwbtn:`GRID` button blink when the track is going over a detected beat. This can help adjusting the beat grid or BPM. diff --git a/src/controllers/legacycontrollersettings.cpp b/src/controllers/legacycontrollersettings.cpp index 918e5ea9c99e..4b4a26a58ddd 100644 --- a/src/controllers/legacycontrollersettings.cpp +++ b/src/controllers/legacycontrollersettings.cpp @@ -11,6 +11,32 @@ #include "moc_legacycontrollersettings.cpp" +namespace { + +// Regex that allows to use :hwbtn:`LABELSTRING` in xml controller settings xml +const QRegularExpression kHwbtnRe(QStringLiteral(":hwbtn:`([^`]*)`")); + +const QString kHwbtnStyleWrapper = QStringLiteral( + " \\1 "); + +QString replaceMarkupStyleStr(QString str) { + return str.replace(kHwbtnRe, kHwbtnStyleWrapper); +} + +} // namespace + LegacyControllerSettingBuilder* LegacyControllerSettingBuilder::instance() { static LegacyControllerSettingBuilder* s_self = nullptr; @@ -32,11 +58,11 @@ LegacyControllerSettingBuilder::LegacyControllerSettingBuilder() { AbstractLegacyControllerSetting::AbstractLegacyControllerSetting(const QDomElement& element) { m_variableName = element.attribute("variable").trimmed(); - m_label = element.attribute("label", m_variableName).trimmed(); + m_label = replaceMarkupStyleStr(element.attribute("label", m_variableName).trimmed()); QDomElement description = element.firstChildElement("description"); if (!description.isNull()) { - m_description = description.text().trimmed(); + m_description = replaceMarkupStyleStr(description.text().trimmed()); } }