Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindesktop/animationsmodel.cpp
Show All 20 Lines | |||||
21 | #include "animationsmodel.h" | 21 | #include "animationsmodel.h" | ||
22 | 22 | | |||
23 | namespace KWin | 23 | namespace KWin | ||
24 | { | 24 | { | ||
25 | 25 | | |||
26 | AnimationsModel::AnimationsModel(QObject *parent) | 26 | AnimationsModel::AnimationsModel(QObject *parent) | ||
27 | : EffectsModel(parent) | 27 | : EffectsModel(parent) | ||
28 | { | 28 | { | ||
29 | connect(this, &EffectsModel::loaded, this, | ||||
30 | [this] { | ||||
31 | setEnabled(modelCurrentEnabled()); | ||||
32 | setCurrentIndex(modelCurrentIndex()); | ||||
33 | } | ||||
34 | ); | ||||
29 | connect(this, &AnimationsModel::currentIndexChanged, this, | 35 | connect(this, &AnimationsModel::currentIndexChanged, this, | ||
30 | [this] { | 36 | [this] { | ||
31 | const QModelIndex index_ = index(m_currentIndex, 0); | 37 | const QModelIndex index_ = index(m_currentIndex, 0); | ||
32 | if (!index_.isValid()) { | 38 | if (!index_.isValid()) { | ||
33 | return; | 39 | return; | ||
34 | } | 40 | } | ||
35 | const bool configurable = index_.data(ConfigurableRole).toBool(); | 41 | const bool configurable = index_.data(ConfigurableRole).toBool(); | ||
36 | if (configurable != m_currentConfigurable) { | 42 | if (configurable != m_currentConfigurable) { | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 104 | { | |||
103 | } | 109 | } | ||
104 | 110 | | |||
105 | return 0; | 111 | return 0; | ||
106 | } | 112 | } | ||
107 | 113 | | |||
108 | void AnimationsModel::load() | 114 | void AnimationsModel::load() | ||
109 | { | 115 | { | ||
110 | EffectsModel::load(); | 116 | EffectsModel::load(); | ||
111 | setEnabled(modelCurrentEnabled()); | | |||
112 | setCurrentIndex(modelCurrentIndex()); | | |||
113 | } | 117 | } | ||
114 | 118 | | |||
115 | void AnimationsModel::save() | 119 | void AnimationsModel::save() | ||
116 | { | 120 | { | ||
117 | for (int i = 0; i < rowCount(); ++i) { | 121 | for (int i = 0; i < rowCount(); ++i) { | ||
118 | const auto status = (m_enabled && i == m_currentIndex) | 122 | const auto status = (m_enabled && i == m_currentIndex) | ||
119 | ? EffectsModel::Status::Enabled | 123 | ? EffectsModel::Status::Enabled | ||
120 | : EffectsModel::Status::Disabled; | 124 | : EffectsModel::Status::Disabled; | ||
Show All 34 Lines |