diff --git a/src/controllers/dlgprefcontroller.cpp b/src/controllers/dlgprefcontroller.cpp index 4d3e02e6bb88..342181ffe848 100644 --- a/src/controllers/dlgprefcontroller.cpp +++ b/src/controllers/dlgprefcontroller.cpp @@ -271,14 +271,24 @@ QString DlgPrefController::presetManualLink( return url; } -QString DlgPrefController::presetScriptFileLinks( +QString DlgPrefController::presetFileLinks( const ControllerPresetPointer pPreset) const { - if (!pPreset || pPreset->getScriptFiles().empty()) { - return tr("No Scripts"); + if (!pPreset) { + return QString(); } + const QString builtinFileSuffix = QStringLiteral(" (") + tr("built-in") + QStringLiteral(")"); QString systemPresetPath = resourcePresetsPath(m_pConfig); QStringList linkList; + QString xmlFileName = QFileInfo(pPreset->filePath()).fileName(); + QString xmlFileLink = QStringLiteral("filePath() + QStringLiteral("\">") + + xmlFileName + QStringLiteral(""); + if (pPreset->filePath().startsWith(systemPresetPath)) { + xmlFileLink += builtinFileSuffix; + } + linkList << xmlFileLink; + for (const auto& script : pPreset->getScriptFiles()) { QString scriptFileLink = QStringLiteral("") + @@ -289,8 +299,7 @@ QString DlgPrefController::presetScriptFileLinks( QStringLiteral(" (") + tr("missing") + QStringLiteral(")"); } else if (script.file.absoluteFilePath().startsWith( systemPresetPath)) { - scriptFileLink += - QStringLiteral(" (") + tr("built-in") + QStringLiteral(")"); + scriptFileLink += builtinFileSuffix; } linkList << scriptFileLink; @@ -475,7 +484,7 @@ void DlgPrefController::slotPresetSelected(int chosenIndex) { applyPresetChanges(); if (m_pPreset && m_pPreset->isDirty()) { if (QMessageBox::question(this, - tr("Preset has been edited"), + tr("Mapping has been edited"), tr("Do you want to save the changes?")) == QMessageBox::Yes) { savePreset(); @@ -498,7 +507,7 @@ void DlgPrefController::savePreset() { } if (!m_pPreset->isDirty()) { - qDebug() << "Preset has not been edited, no need to save it."; + qDebug() << "Mapping is not dirty, no need to save it."; return; } @@ -556,13 +565,13 @@ void DlgPrefController::savePreset() { if (!saveAsNew) { newFilePath = oldFilePath; } else { - QString savePresetTitle = tr("Save user preset"); - QString savePresetLabel = tr("Enter the name for saving the preset to the user folder."); - QString savingFailedTitle = tr("Saving preset failed"); + QString savePresetTitle = tr("Save user mapping"); + QString savePresetLabel = tr("Enter the name for saving the mapping to the user folder."); + QString savingFailedTitle = tr("Saving mapping failed"); QString invalidNameLabel = - tr("A preset cannot have a blank name and may not contain " + tr("A mapping cannot have a blank name and may not contain " "special characters."); - QString fileExistsLabel = tr("A preset file with that name already exists."); + QString fileExistsLabel = tr("A mapping file with that name already exists."); // Only allow the name to contain letters, numbers, whitespaces and _-+()/ const QRegExp rxRemove = QRegExp("[^[(a-zA-Z0-9\\_\\-\\+\\(\\)\\/|\\s]"); @@ -600,14 +609,14 @@ void DlgPrefController::savePreset() { validPresetName = true; } m_pPreset->setName(presetName); - qDebug() << "Preset renamed to" << m_pPreset->name(); + qDebug() << "Mapping renamed to" << m_pPreset->name(); } if (!m_pPreset->savePreset(newFilePath)) { - qDebug() << "Failed to save preset as" << newFilePath; + qDebug() << "Failed to save mapping as" << newFilePath; return; } - qDebug() << "Preset saved as" << newFilePath; + qDebug() << "Mapping saved as" << newFilePath; m_pPreset->setFilePath(newFilePath); m_pPreset->setDirty(false); @@ -666,8 +675,8 @@ void DlgPrefController::slotShowPreset(ControllerPresetPointer preset) { QString support = supportLinks.join("  "); m_ui.labelLoadedPresetSupportLinks->setText(support); - QString scriptFiles = presetScriptFileLinks(preset); - m_ui.labelLoadedPresetScriptFileLinks->setText(scriptFiles); + QString mappingFileLinks = presetFileLinks(preset); + m_ui.labelLoadedPresetScriptFileLinks->setText(mappingFileLinks); // 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 2e1e9d112e40..844e61f26201 100644 --- a/src/controllers/dlgprefcontroller.h +++ b/src/controllers/dlgprefcontroller.h @@ -74,7 +74,7 @@ class DlgPrefController : public DlgPreferencePage { QString presetForumLink(const ControllerPresetPointer pPreset) const; QString presetManualLink(const ControllerPresetPointer pPreset) const; QString presetWikiLink(const ControllerPresetPointer pPreset) const; - QString presetScriptFileLinks(const ControllerPresetPointer pPreset) const; + QString presetFileLinks(const ControllerPresetPointer pPreset) const; void applyPresetChanges(); void savePreset(); void initTableView(QTableView* pTable); diff --git a/src/controllers/dlgprefcontrollerdlg.ui b/src/controllers/dlgprefcontrollerdlg.ui index e523bf02ff06..87b030458642 100644 --- a/src/controllers/dlgprefcontrollerdlg.ui +++ b/src/controllers/dlgprefcontrollerdlg.ui @@ -116,7 +116,7 @@ - Load Preset: + Load Mapping: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -145,11 +145,11 @@ - Preset Info + Mapping Info - + 0 @@ -182,7 +182,7 @@ - (preset name goes here) + (mapping name goes here) true @@ -214,7 +214,7 @@ - (preset author goes here) + (mapping author goes here) @@ -255,7 +255,7 @@ - (preset description goes here) even when it is a damn long text which should wrap but does not + (mapping description goes here) even when it is a damn long text which should wrap but does not Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -299,7 +299,7 @@ Qt::ImhUrlCharactersOnly - (forum link for preset goes here) + (forum link for mapping goes here) true @@ -318,7 +318,7 @@ - Script Files: + Mapping Files: Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing @@ -343,7 +343,7 @@ Qt::ImhUrlCharactersOnly - (links to loaded preset script files go here) + (links to loaded mapping script files go here) false diff --git a/src/controllers/dlgprefcontrollersdlg.ui b/src/controllers/dlgprefcontrollersdlg.ui index a3ec8586eb00..45894afc14f2 100644 --- a/src/controllers/dlgprefcontrollersdlg.ui +++ b/src/controllers/dlgprefcontrollersdlg.ui @@ -76,7 +76,7 @@ - Presets + Mappings @@ -88,7 +88,7 @@ - Mixxx uses "presets" to connect messages from your controller to controls in Mixxx. If you do not see a preset for your controller in the "Load Preset" menu when you click on your controller on the left sidebar, you may be able to download one online from the <a href="https://mixxx.discourse.group/c/controller-mappings/10">Mixxx Forum</a>. Place the XML (.xml) and Javascript (.js) file(s) in the "User Preset 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 Preset Folder" then restart Mixxx: + 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 <a href="https://mixxx.discourse.group/c/controller-mappings/10">Mixxx Forum</a>. 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: true @@ -107,7 +107,7 @@ - Open User Preset Folder + Open User Mapping Folder @@ -159,7 +159,7 @@ - <a href="https://github.com/mixxxdj/mixxx/wiki/Midi-Controller-Mapping-File-Format">MIDI Preset File Format</a> + <a href="https://github.com/mixxxdj/mixxx/wiki/Midi-Controller-Mapping-File-Format">MIDI Mapping File Format</a> true