Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/common/effectsmodel.cpp
Show First 20 Lines • Show All 551 Lines • ▼ Show 20 Line(s) | |||||
552 | } | 552 | } | ||
553 | 553 | | |||
554 | void EffectsModel::defaults() | 554 | void EffectsModel::defaults() | ||
555 | { | 555 | { | ||
556 | for (int i = 0; i < m_effects.count(); ++i) { | 556 | for (int i = 0; i < m_effects.count(); ++i) { | ||
557 | const auto &effect = m_effects.at(i); | 557 | const auto &effect = m_effects.at(i); | ||
558 | if (effect.enabledByDefaultFunction && effect.status != Status::EnabledUndeterminded) { | 558 | if (effect.enabledByDefaultFunction && effect.status != Status::EnabledUndeterminded) { | ||
559 | updateEffectStatus(index(i, 0), Status::EnabledUndeterminded); | 559 | updateEffectStatus(index(i, 0), Status::EnabledUndeterminded); | ||
560 | } else if ((bool)effect.status != effect.enabledByDefault) { | 560 | } else if (static_cast<bool>(effect.status) != effect.enabledByDefault) { | ||
561 | updateEffectStatus(index(i, 0), effect.enabledByDefault ? Status::Enabled : Status::Disabled); | 561 | updateEffectStatus(index(i, 0), effect.enabledByDefault ? Status::Enabled : Status::Disabled); | ||
562 | } | 562 | } | ||
563 | } | 563 | } | ||
564 | } | 564 | } | ||
565 | 565 | | |||
566 | bool EffectsModel::isDefaults() const | 566 | bool EffectsModel::isDefaults() const | ||
567 | { | 567 | { | ||
568 | return std::all_of(m_effects.constBegin(), m_effects.constEnd(), [](const EffectData &effect) { | 568 | return std::all_of(m_effects.constBegin(), m_effects.constEnd(), [](const EffectData &effect) { | ||
569 | if (effect.enabledByDefaultFunction && effect.status != Status::EnabledUndeterminded) { | 569 | if (effect.enabledByDefaultFunction && effect.status != Status::EnabledUndeterminded) { | ||
570 | return false; | 570 | return false; | ||
571 | } | 571 | } | ||
572 | if ((bool)effect.status != effect.enabledByDefault) { | 572 | if (static_cast<bool>(effect.status) != effect.enabledByDefault) { | ||
573 | return false; | 573 | return false; | ||
574 | } | 574 | } | ||
575 | return true; | 575 | return true; | ||
576 | }); | 576 | }); | ||
577 | } | 577 | } | ||
578 | 578 | | |||
579 | bool EffectsModel::needsSave() const | 579 | bool EffectsModel::needsSave() const | ||
580 | { | 580 | { | ||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |