File indexing completed on 2024-11-10 04:56:48

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "effectsmodel.h"
0013 
0014 namespace KWin
0015 {
0016 
0017 class AnimationsModel : public EffectsModel
0018 {
0019     Q_OBJECT
0020     Q_PROPERTY(bool animationEnabled READ animationEnabled WRITE setAnimationEnabled NOTIFY animationEnabledChanged)
0021     Q_PROPERTY(int animationIndex READ animationIndex WRITE setAnimationIndex NOTIFY animationIndexChanged)
0022     Q_PROPERTY(bool currentConfigurable READ currentConfigurable NOTIFY currentConfigurableChanged)
0023     Q_PROPERTY(bool defaultAnimationEnabled READ defaultAnimationEnabled NOTIFY defaultAnimationEnabledChanged)
0024     Q_PROPERTY(int defaultAnimationIndex READ defaultAnimationIndex NOTIFY defaultAnimationIndexChanged)
0025 
0026 public:
0027     explicit AnimationsModel(QObject *parent = nullptr);
0028 
0029     bool animationEnabled() const;
0030     void setAnimationEnabled(bool enabled);
0031 
0032     int animationIndex() const;
0033     void setAnimationIndex(int index);
0034 
0035     bool currentConfigurable() const;
0036 
0037     bool defaultAnimationEnabled() const;
0038     int defaultAnimationIndex() const;
0039 
0040     void load();
0041     void save();
0042     void defaults();
0043     bool isDefaults() const;
0044     bool needsSave() const;
0045 
0046 Q_SIGNALS:
0047     void animationEnabledChanged();
0048     void animationIndexChanged();
0049     void currentConfigurableChanged();
0050     void defaultAnimationEnabledChanged();
0051     void defaultAnimationIndexChanged();
0052 
0053 protected:
0054     bool shouldStore(const EffectData &data) const override;
0055 
0056 private:
0057     Status status(int row) const;
0058     void loadDefaults();
0059     bool modelAnimationEnabled() const;
0060     int modelAnimationIndex() const;
0061 
0062     bool m_animationEnabled = false;
0063     bool m_defaultAnimationEnabled = false;
0064     int m_animationIndex = -1;
0065     int m_defaultAnimationIndex = -1;
0066     bool m_currentConfigurable = false;
0067 
0068     Q_DISABLE_COPY(AnimationsModel)
0069 };
0070 
0071 }