Changeset View
Standalone View
kcmkwin/kwindesktop/main.cpp
Show First 20 Lines • Show All 515 Lines • ▼ Show 20 Line(s) | |||||
516 | } | 516 | } | ||
517 | 517 | | |||
518 | void KWinDesktopConfig::slotEffectSelectionChanged(int index) | 518 | void KWinDesktopConfig::slotEffectSelectionChanged(int index) | ||
519 | { | 519 | { | ||
520 | bool enabled = false; | 520 | bool enabled = false; | ||
521 | if (index != 0) | 521 | if (index != 0) | ||
522 | enabled = true; | 522 | enabled = true; | ||
523 | m_ui->effectInfoButton->setEnabled(enabled); | 523 | m_ui->effectInfoButton->setEnabled(enabled); | ||
524 | // only cube has config dialog | 524 | | ||
525 | if (index != 2) | 525 | switch (index) { | ||
526 | case 1: // Slide | ||||
davidedmundson: can you add Q_FALLTHROUGH when pushing | |||||
zzag: Why? | |||||
Tells both the next person and the compiler that you're deliberately treating 1 and 2 the same and haven't just forgotten to return. Otherwise you get something like: Exact situations of what warns are compiler warns about are currently ambiguous and changing, so this might not currently, but it certainly won't do any harm. davidedmundson: Tells both the next person and the compiler that you're deliberately treating 1 and 2 the same… | |||||
No, I know what Q_FALLTHROUGH is. I don't understand why we need it here. I thought that's totally fine to have such kind of fall through: case 1: case 2: case 42: return; Am I wrong? zzag: No, I know what Q_FALLTHROUGH is. I don't understand why we need it here. I thought that's… | |||||
OK, I've re-read your last sentence. I don't think clang or gcc would produce warnings for such kind of fall though. It's worth to mention that LLVM use "case 1: case 2:" quite often. zzag: OK, I've re-read your last sentence. I don't think clang or gcc would produce warnings for such… | |||||
I'm aware they don't currently, I still think it's nicer form, but I also really don't care that much. Push whichever you prefer. davidedmundson: I'm aware they don't currently, I still think it's nicer form, but I also really don't care… | |||||
527 | case 2: // Cube Slide | ||||
528 | enabled = true; | ||||
529 | break; | ||||
530 | default: | ||||
526 | enabled = false; | 531 | enabled = false; | ||
532 | break; | ||||
533 | } | ||||
527 | m_ui->effectConfigButton->setEnabled(enabled); | 534 | m_ui->effectConfigButton->setEnabled(enabled); | ||
528 | } | 535 | } | ||
529 | 536 | | |||
530 | 537 | | |||
531 | bool KWinDesktopConfig::effectEnabled(const QString& effect, const KConfigGroup& cfg) const | 538 | bool KWinDesktopConfig::effectEnabled(const QString& effect, const KConfigGroup& cfg) const | ||
532 | { | 539 | { | ||
533 | KService::List services = KServiceTypeTrader::self()->query( | 540 | KService::List services = KServiceTypeTrader::self()->query( | ||
534 | "KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_" + effect + '\''); | 541 | "KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_" + effect + '\''); | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 603 | } else { | |||
605 | showDialog(aboutData); | 612 | showDialog(aboutData); | ||
606 | } | 613 | } | ||
607 | } | 614 | } | ||
608 | 615 | | |||
609 | void KWinDesktopConfig::slotConfigureEffectClicked() | 616 | void KWinDesktopConfig::slotConfigureEffectClicked() | ||
610 | { | 617 | { | ||
611 | QString effect; | 618 | QString effect; | ||
612 | switch(m_ui->effectComboBox->currentIndex()) { | 619 | switch(m_ui->effectComboBox->currentIndex()) { | ||
620 | case 1: | ||||
621 | effect = BuiltInEffects::nameForEffect(BuiltInEffect::Slide); | ||||
622 | break; | ||||
613 | case 2: | 623 | case 2: | ||
614 | effect = BuiltInEffects::nameForEffect(BuiltInEffect::CubeSlide); | 624 | effect = BuiltInEffects::nameForEffect(BuiltInEffect::CubeSlide); | ||
615 | break; | 625 | break; | ||
616 | default: | 626 | default: | ||
617 | return; | 627 | return; | ||
618 | } | 628 | } | ||
619 | 629 | | |||
620 | QPointer<QDialog> configDialog = new QDialog(this); | 630 | QPointer<QDialog> configDialog = new QDialog(this); | ||
Show All 32 Lines |
can you add Q_FALLTHROUGH when pushing