Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove doubling "None" in effect selection #2176

Merged
merged 1 commit into from Jun 20, 2019
Merged

remove doubling "None" in effect selection #2176

merged 1 commit into from Jun 20, 2019

Conversation

goddisignz
Copy link
Contributor

Remove the doubling "None" in the preferences -> equalizer -> effect list when "None" is already selected.
Fixes https://bugs.launchpad.net/mixxx/+bug/1824624.

@@ -231,10 +231,10 @@ void DlgPrefEQ::slotPopulateDeckEffectSelectors() {
}
//: Displayed when no effect is selected
box->addItem(tr("None"), QVariant(QString("")));
if (selectedEffectId.isNull()) {
if (selectedEffectId.isNull() || QString::compare(selectedEffectName, tr("None")) == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please prefer to use operator == if you don't need the ordering capabilities of compare()

currentIndex = availableQuickEffects.size(); // selects "None"
}
if (currentIndex < 0 && !selectedEffectName.isEmpty()) {
else if (currentIndex < 0 && !selectedEffectName.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow our coding guidelines by placing the else on the same line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just didn't see them beforehand. I will keep it in mind and re-commit.

@rrrapha
Copy link
Contributor

rrrapha commented Jun 18, 2019

I don't really like the string compare, wouldn't the following diff work as well?
(untested)

--- a/src/preferences/dialog/dlgprefeq.cpp
+++ b/src/preferences/dialog/dlgprefeq.cpp
@@ -231,7 +231,7 @@ void DlgPrefEQ::slotPopulateDeckEffectSelectors() {
         }
         //: Displayed when no effect is selected
         box->addItem(tr("None"), QVariant(QString("")));
-        if (selectedEffectId.isNull()) {
+        if (selectedEffectId.isEmpty()) {
             currentIndex = availableEQEffects.size(); // selects "None"
         }
         if (currentIndex < 0 && !selectedEffectName.isEmpty()) {
@@ -261,7 +261,7 @@ void DlgPrefEQ::slotPopulateDeckEffectSelectors() {
         }
         //: Displayed when no effect is selected
         box->addItem(tr("None"), QVariant(QString("")));
-        if (selectedEffectId.isNull()) {
+        if (selectedEffectId.isEmpty()) {
             currentIndex = availableQuickEffects.size(); // selects "None"
         }
         if (currentIndex < 0 && !selectedEffectName.isEmpty()) {

@goddisignz
Copy link
Contributor Author

I will give it a shot, but the code would probably not work as expected. As far as I can tell the selectedEffectId will not be empty unless no entry of the was ever selected. Probably only after fresh install or something.

@rrrapha
Copy link
Contributor

rrrapha commented Jun 18, 2019

I think selectedEffectId is empty if 'None' is selected, no?

@goddisignz
Copy link
Contributor Author

@rrrapha thanks for the hint, the isEmpty() does the job. I didn't recognize that the effectid is set to an empty string.

@rrrapha
Copy link
Contributor

rrrapha commented Jun 20, 2019

Cool, it looks good and works for me :)

@uklotzde
Copy link
Contributor

LGTM. Thank you.

@uklotzde uklotzde merged commit 9213287 into mixxxdj:master Jun 20, 2019
@uklotzde uklotzde added this to the 2.3.0 milestone Jun 20, 2019
@goddisignz goddisignz deleted the double_none_effect branch June 21, 2019 16:07
@Holzhaus Holzhaus added this to Done in 2.3 release Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
2.3 release
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants