Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/common/effectmodel.h
Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Line(s) | 40 | public: | |||
---|---|---|---|---|---|
172 | 172 | | |||
173 | /** | 173 | /** | ||
174 | * Resets the status of each effect to the default state. | 174 | * Resets the status of each effect to the default state. | ||
175 | * | 175 | * | ||
176 | * @note In order to actually apply the change, you have to call save(). | 176 | * @note In order to actually apply the change, you have to call save(). | ||
177 | **/ | 177 | **/ | ||
178 | void defaults(); | 178 | void defaults(); | ||
179 | 179 | | |||
180 | /** | ||||
181 | * Whether the model has unsaved changes. | ||||
182 | **/ | ||||
183 | bool needsSave() const; | ||||
184 | | ||||
185 | /** | ||||
186 | * Finds an effect with the given plugin id. | ||||
187 | **/ | ||||
188 | QModelIndex findByPluginId(const QString &pluginId) const; | ||||
189 | | ||||
180 | protected: | 190 | protected: | ||
181 | enum class Kind { | 191 | enum class Kind { | ||
182 | BuiltIn, | 192 | BuiltIn, | ||
183 | Binary, | 193 | Binary, | ||
184 | Scripted | 194 | Scripted | ||
185 | }; | 195 | }; | ||
186 | 196 | | |||
187 | struct EffectData { | 197 | struct EffectData { | ||
188 | QString name; | 198 | QString name; | ||
189 | QString description; | 199 | QString description; | ||
190 | QString authorName; | 200 | QString authorName; | ||
191 | QString authorEmail; | 201 | QString authorEmail; | ||
192 | QString license; | 202 | QString license; | ||
193 | QString version; | 203 | QString version; | ||
194 | QString untranslatedCategory; | 204 | QString untranslatedCategory; | ||
195 | QString category; | 205 | QString category; | ||
196 | QString serviceName; | 206 | QString serviceName; | ||
197 | QString iconName; | 207 | QString iconName; | ||
198 | Status effectStatus; | 208 | Status effectStatus; | ||
209 | Status originalStatus; | ||||
199 | bool enabledByDefault; | 210 | bool enabledByDefault; | ||
200 | bool enabledByDefaultFunction; | 211 | bool enabledByDefaultFunction; | ||
201 | QUrl video; | 212 | QUrl video; | ||
202 | QUrl website; | 213 | QUrl website; | ||
203 | bool supported; | 214 | bool supported; | ||
204 | QString exclusiveGroup; | 215 | QString exclusiveGroup; | ||
205 | bool internal; | 216 | bool internal; | ||
206 | bool configurable; | 217 | bool configurable; | ||
207 | Kind kind; | 218 | Kind kind; | ||
208 | bool changed = false; | 219 | bool changed = false; | ||
209 | }; | 220 | }; | ||
210 | 221 | | |||
211 | /** | 222 | /** | ||
212 | * Returns whether the given effect should be stored in the model. | 223 | * Returns whether the given effect should be stored in the model. | ||
213 | * | 224 | * | ||
214 | * @param data The effect. | 225 | * @param data The effect. | ||
215 | * @returns @c true if the effect should be stored, otherwise @c false. | 226 | * @returns @c true if the effect should be stored, otherwise @c false. | ||
216 | **/ | 227 | **/ | ||
217 | virtual bool shouldStore(const EffectData &data) const; | 228 | virtual bool shouldStore(const EffectData &data) const; | ||
218 | 229 | | |||
219 | private: | 230 | private: | ||
220 | void loadBuiltInEffects(const KConfigGroup &kwinConfig, const KPluginInfo::List &configs); | 231 | void loadBuiltInEffects(const KConfigGroup &kwinConfig, const KPluginInfo::List &configs); | ||
221 | void loadJavascriptEffects(const KConfigGroup &kwinConfig); | 232 | void loadJavascriptEffects(const KConfigGroup &kwinConfig); | ||
222 | void loadPluginEffects(const KConfigGroup &kwinConfig, const KPluginInfo::List &configs); | 233 | void loadPluginEffects(const KConfigGroup &kwinConfig, const KPluginInfo::List &configs); | ||
223 | int findRowByServiceName(const QString &serviceName); | | |||
224 | void syncEffectsToKWin(); | 234 | void syncEffectsToKWin(); | ||
225 | 235 | | |||
226 | QVector<EffectData> m_effectsList; | 236 | QVector<EffectData> m_effectsList; | ||
227 | QVector<EffectData> m_effectsChanged; | 237 | QVector<EffectData> m_effectsChanged; | ||
228 | 238 | | |||
229 | Q_DISABLE_COPY(EffectModel) | 239 | Q_DISABLE_COPY(EffectModel) | ||
230 | }; | 240 | }; | ||
231 | 241 | | |||
232 | } | 242 | } |