Krita Source Code Documentation
Loading...
Searching...
No Matches
KisTimeBasedItemModel.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Jouni Pentikäinen <joupent@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef _KIS_TIME_BASED_ITEM_MODEL_H
8#define _KIS_TIME_BASED_ITEM_MODEL_H
9
10#include <QAbstractTableModel>
11#include <KisKineticScroller.h>
12
13#include "kritaanimationdocker_export.h"
14
15#include "kis_types.h"
16
17class KisTimeSpan;
20enum PlaybackState : unsigned int;
21
22class KRITAANIMATIONDOCKER_EXPORT KisTimeBasedItemModel : public QAbstractTableModel
23{
24 Q_OBJECT
25
26public:
27 KisTimeBasedItemModel(QObject *parent);
28 ~KisTimeBasedItemModel() override;
29
30 void setImage(KisImageWSP image);
31 void setFrameCache(KisAnimationFrameCacheSP cache);
32 bool isFrameCached(const int frame);
33 void setAnimationPlayer(KisCanvasAnimationState *player);
34 void setDocument(class KisDocument* document);
35 KisDocument* document() const;
36
37 void setLastVisibleFrame(int time);
38
39 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
40
41 QVariant data(const QModelIndex &index, int role) const override;
42 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
43 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
44 bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override;
45
46 void scrubHorizontalHeaderUpdate(int activeHeader);
47
48 bool removeFrames(const QModelIndexList &indexes);
49
50 bool removeFramesAndOffset(QModelIndexList indicesToRemove);
51
52 bool mirrorFrames(QModelIndexList indexes);
53
54 void setScrubState(bool active);
55 bool isScrubbing();
56
57 void setPlaybackRange(const KisTimeSpan &range);
58 bool isPlaybackActive() const;
59 bool isPlaybackPaused() const;
60 void stopPlayback() const;
61 int currentTime() const;
62
78
79protected:
80 virtual KisNodeSP nodeAt(QModelIndex index) const = 0;
81 virtual QMap<QString, KisKeyframeChannel *> channelsAt(QModelIndex index) const = 0;
82 virtual KisKeyframeChannel* channelByID(QModelIndex index, const QString &id) const = 0;
83 KisImageWSP image() const;
84
85 KUndo2Command* createOffsetFramesCommand(QModelIndexList srcIndexes, const QPoint &offset,
86 bool copyFrames, bool moveEmptyFrames,
87 KUndo2Command *parentCommand = 0);
88
89 bool cloneOfActiveFrame(const QModelIndex &index) const;
90 int cloneCount(const QModelIndex &index) const;
91
92protected Q_SLOTS:
93 void slotCurrentTimeChanged(int time);
94
95private Q_SLOTS:
96 void slotFramerateChanged();
97 void slotPlaybackRangeChanged();
98 void slotCacheChanged();
99
100 void slotPlaybackFrameChanged();
101 void slotPlaybackStateChanged(PlaybackState state);
102private:
103 struct Private;
104 const QScopedPointer<Private> m_d;
105};
106
107#endif
float value(const T *src, size_t ch)
The KisCanvasAnimationState class stores all of the canvas-specific animation state.
KisKeyframeChannel stores and manages KisKeyframes. Maps units of time to virtual keyframe values....
virtual KisNodeSP nodeAt(QModelIndex index) const =0
virtual KisKeyframeChannel * channelByID(QModelIndex index, const QString &id) const =0
const QScopedPointer< Private > m_d
virtual QMap< QString, KisKeyframeChannel * > channelsAt(QModelIndex index) const =0