diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2021-01-08 01:32:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-08 01:32:43 +0100 |
commit | a1cc267f91826830ee4e1cab8318a44641e445e2 (patch) | |
tree | 04c40c2a4177953946346ad6a8c3e7d08bcba2c2 /src | |
parent | 361bad48f53a7127845d78a0636bbb6fb5ead08d (diff) | |
parent | 1c2955dbe8c15c087c293a1f1de8e82660cefa90 (diff) |
Merge pull request #3485 from ronso0/combobox-none
Preferences / Effect widgets: use '---' placeholder instead of 'None'
Diffstat (limited to 'src')
-rw-r--r-- | src/effects/effectsmanager.cpp | 2 | ||||
-rw-r--r-- | src/effects/effectsmanager.h | 2 | ||||
-rw-r--r-- | src/preferences/dialog/dlgprefeq.cpp | 23 | ||||
-rw-r--r-- | src/preferences/dialog/dlgprefsound.cpp | 10 | ||||
-rw-r--r-- | src/preferences/dialog/dlgprefsounditem.cpp | 12 | ||||
-rw-r--r-- | src/soundio/soundmanager.cpp | 2 | ||||
-rw-r--r-- | src/soundio/soundmanagerconfig.cpp | 3 | ||||
-rw-r--r-- | src/soundio/soundmanagerconfig.h | 1 | ||||
-rw-r--r-- | src/widget/weffect.cpp | 2 | ||||
-rw-r--r-- | src/widget/weffectchain.cpp | 2 | ||||
-rw-r--r-- | src/widget/weffectparameterbase.cpp | 2 | ||||
-rw-r--r-- | src/widget/weffectselector.cpp | 5 |
12 files changed, 42 insertions, 24 deletions
diff --git a/src/effects/effectsmanager.cpp b/src/effects/effectsmanager.cpp index 380a19b734..13c20f9ae4 100644 --- a/src/effects/effectsmanager.cpp +++ b/src/effects/effectsmanager.cpp @@ -13,6 +13,8 @@ #include "moc_effectsmanager.cpp" #include "util/assert.h" +const QString EffectsManager::kNoEffectString = QStringLiteral("---"); + namespace { const QString kEffectGroupSeparator = "_"; const QString kGroupClose = "]"; diff --git a/src/effects/effectsmanager.h b/src/effects/effectsmanager.h index cccb756e18..8f85a8d30a 100644 --- a/src/effects/effectsmanager.h +++ b/src/effects/effectsmanager.h @@ -23,6 +23,8 @@ class EffectsBackend; class EffectsManager : public QObject { Q_OBJECT public: + static const QString kNoEffectString; + typedef bool (*EffectManifestFilterFnc)(EffectManifest* pManifest); EffectsManager(QObject* pParent, diff --git a/src/preferences/dialog/dlgprefeq.cpp b/src/preferences/dialog/dlgprefeq.cpp index 3c4110f04d..a001d13a78 100644 --- a/src/preferences/dialog/dlgprefeq.cpp +++ b/src/preferences/dialog/dlgprefeq.cpp @@ -225,10 +225,12 @@ void DlgPrefEQ::slotPopulateDeckEffectSelectors() { currentIndex = i; } } - //: Displayed when no effect is selected - box->addItem(tr("None"), QVariant(QString(""))); + // Add empty item, no effect + box->addItem(EffectsManager::kNoEffectString); + if (selectedEffectId.isEmpty()) { - currentIndex = availableEQEffects.size(); // selects "None" + // Configured effect has no id, clear selection + currentIndex = availableEQEffects.size(); } else if (currentIndex < 0 && !selectedEffectName.isEmpty() ) { // current selection is not part of the new list // So we need to add it @@ -254,10 +256,12 @@ void DlgPrefEQ::slotPopulateDeckEffectSelectors() { currentIndex = i; } } - //: Displayed when no effect is selected - box->addItem(tr("None"), QVariant(QString(""))); + // Add empty item, no effect + box->addItem(EffectsManager::kNoEffectString); + if (selectedEffectId.isEmpty()) { - currentIndex = availableQuickEffects.size(); // selects "None" + // Configured effect has no id, clear selection + currentIndex = availableQuickEffects.size(); } else if (currentIndex < 0 && !selectedEffectName.isEmpty()) { // current selection is not part of the new list // So we need to add it @@ -671,12 +675,13 @@ void DlgPrefEQ::setUpMasterEQ() { for (const auto& pManifest : availableMasterEQEffects) { comboBoxMasterEq->addItem(pManifest->name(), QVariant(pManifest->id())); } - //: Displayed when no effect is selected - comboBoxMasterEq->addItem(tr("None"), QVariant()); + // Add empty item, no effect + comboBoxMasterEq->addItem(EffectsManager::kNoEffectString); int masterEqIndex = comboBoxMasterEq->findData(configuredEffect); if (masterEqIndex < 0) { - masterEqIndex = availableMasterEQEffects.size(); // selects "None" + // Configured effect not in list, clear selection + masterEqIndex = availableMasterEQEffects.size(); } comboBoxMasterEq->setCurrentIndex(masterEqIndex); diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp index 2d6358d7d8..ad336bbd76 100644 --- a/src/preferences/dialog/dlgprefsound.cpp +++ b/src/preferences/dialog/dlgprefsound.cpp @@ -32,10 +32,14 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, // Create text color for the wiki links createLinkColor(); - connect(m_pSoundManager, &SoundManager::devicesUpdated, this, &DlgPrefSound::refreshDevices); + connect(m_pSoundManager, + &SoundManager::devicesUpdated, + this, + &DlgPrefSound::refreshDevices); apiComboBox->clear(); - apiComboBox->addItem(tr("None"), "None"); + apiComboBox->addItem(SoundManagerConfig::kEmptyComboBox, + SoundManagerConfig::kDefaultAPI); updateAPIs(); connect(apiComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), @@ -628,7 +632,7 @@ void DlgPrefSound::updateAudioBufferSizes(int sampleRateIndex) { * just changes and we need to display new devices. */ void DlgPrefSound::refreshDevices() { - if (m_config.getAPI() == "None") { + if (m_config.getAPI() == SoundManagerConfig::kDefaultAPI) { m_outputDevices.clear(); m_inputDevices.clear(); } else { diff --git a/src/preferences/dialog/dlgprefsounditem.cpp b/src/preferences/dialog/dlgprefsounditem.cpp index 8efa2d3c04..043f14e5da 100644 --- a/src/preferences/dialog/dlgprefsounditem.cpp +++ b/src/preferences/dialog/dlgprefsounditem.cpp @@ -16,9 +16,12 @@ * @param isInput true if this is representing an AudioInput, false otherwise * @param index the index of the represented AudioPath, if applicable */ -DlgPrefSoundItem::DlgPrefSoundItem(QWidget* parent, AudioPathType type, - const QList<SoundDevicePointer>& devices, bool isInput, - unsigned int index) +DlgPrefSoundItem::DlgPrefSoundItem( + QWidget* parent, + AudioPathType type, + const QList<SoundDevicePointer>& devices, + bool isInput, + unsigned int index) : QWidget(parent), m_type(type), m_index(index), @@ -27,7 +30,8 @@ DlgPrefSoundItem::DlgPrefSoundItem(QWidget* parent, AudioPathType type, setupUi(this); typeLabel->setText(AudioPath::getTrStringFromType(type, index)); - deviceComboBox->addItem(tr("None"), QVariant::fromValue(SoundDeviceId())); + deviceComboBox->addItem(SoundManagerConfig::kEmptyComboBox, + QVariant::fromValue(SoundDeviceId())); // Set the focus policy for QComboBoxes (and wide QDoubleSpinBoxes) and // connect them to the custom event filter below so they don't accept focus diff --git a/src/soundio/soundmanager.cpp b/src/soundio/soundmanager.cpp index de0030e1f2..eb204e883e 100644 --- a/src/soundio/soundmanager.cpp +++ b/src/soundio/soundmanager.cpp @@ -106,7 +106,7 @@ QList<SoundDevicePointer> SoundManager::getDeviceList( const QString& filterAPI, bool bOutputDevices, bool bInputDevices) const { //qDebug() << "SoundManager::getDeviceList"; - if (filterAPI == "None") { + if (filterAPI == SoundManagerConfig::kDefaultAPI) { return QList<SoundDevicePointer>(); } diff --git a/src/soundio/soundmanagerconfig.cpp b/src/soundio/soundmanagerconfig.cpp index e4b67eafe3..9d29275ffe 100644 --- a/src/soundio/soundmanagerconfig.cpp +++ b/src/soundio/soundmanagerconfig.cpp @@ -11,7 +11,8 @@ // this (7) represents latency values from 1 ms to about 80 ms -- bkgood const unsigned int SoundManagerConfig::kMaxAudioBufferSizeIndex = 7; -const QString SoundManagerConfig::kDefaultAPI = QString("None"); +const QString SoundManagerConfig::kDefaultAPI = QStringLiteral("None"); +const QString SoundManagerConfig::kEmptyComboBox = QStringLiteral("---"); // Sample Rate even the cheap sound Devices will support most likely const unsigned int SoundManagerConfig::kFallbackSampleRate = 48000; const unsigned int SoundManagerConfig::kDefaultDeckCount = 2; diff --git a/src/soundio/soundmanagerconfig.h b/src/soundio/soundmanagerconfig.h index d158ae3cd6..54efb9e471 100644 --- a/src/soundio/soundmanagerconfig.h +++ b/src/soundio/soundmanagerconfig.h @@ -25,6 +25,7 @@ public: }; static const unsigned int kMaxAudioBufferSizeIndex; static const QString kDefaultAPI; + static const QString kEmptyComboBox; static const unsigned int kFallbackSampleRate; static const unsigned int kDefaultDeckCount; static const int kDefaultAudioBufferSizeIndex; diff --git a/src/widget/weffect.cpp b/src/widget/weffect.cpp index f9141d3a52..97132dd65d 100644 --- a/src/widget/weffect.cpp +++ b/src/widget/weffect.cpp @@ -49,7 +49,7 @@ void WEffect::effectUpdated() { description = tr("%1: %2").arg(pManifest->name(), pManifest->description()); } } else { - name = tr("None"); + name = EffectsManager::kNoEffectString; description = tr("No effect loaded."); } setText(name); diff --git a/src/widget/weffectchain.cpp b/src/widget/weffectchain.cpp index 66211e1368..c2580266c7 100644 --- a/src/widget/weffectchain.cpp +++ b/src/widget/weffectchain.cpp @@ -39,7 +39,7 @@ void WEffectChain::setEffectChainSlot(EffectChainSlotPointer pEffectChainSlot) { } void WEffectChain::chainUpdated() { - QString name = tr("None"); + QString name = EffectsManager::kNoEffectString; QString description = tr("No effect chain loaded."); if (m_pEffectChainSlot) { EffectChainPointer pChain = m_pEffectChainSlot->getEffectChain(); diff --git a/src/widget/weffectparameterbase.cpp b/src/widget/weffectparameterbase.cpp index 22191ee58b..27d047bacc 100644 --- a/src/widget/weffectparameterbase.cpp +++ b/src/widget/weffectparameterbase.cpp @@ -34,7 +34,7 @@ void WEffectParameterBase::parameterUpdated() { m_pEffectParameterSlot->name(), m_pEffectParameterSlot->description())); } else { - setText(tr("None")); + setText(EffectsManager::kNoEffectString); setBaseTooltip(tr("No effect loaded.")); } } diff --git a/src/widget/weffectselector.cpp b/src/widget/weffectselector.cpp index 02c9c3f230..4480ef0301 100644 --- a/src/widget/weffectselector.cpp +++ b/src/widget/weffectselector.cpp @@ -71,9 +71,8 @@ void WEffectSelector::populate() { setItemData(i, QVariant(QStringLiteral("<b>") + name + QStringLiteral("</b><br/>") + description), Qt::ToolTipRole); } - - //: Displayed when no effect is loaded - addItem(tr("None"), QVariant()); + // Add empty item, no effect + addItem(EffectsManager::kNoEffectString); setItemData(visibleEffectManifests.size(), QVariant(tr("No effect loaded.")), Qt::ToolTipRole); |