Changeset View
Changeset View
Standalone View
Standalone View
plugins/dockers/animation/timeline_docker.cpp
Context not available. | |||||
32 | #include "timeline_frames_model.h" | 32 | #include "timeline_frames_model.h" | ||
---|---|---|---|---|---|
33 | #include "timeline_frames_view.h" | 33 | #include "timeline_frames_view.h" | ||
34 | #include "kis_animation_frame_cache.h" | 34 | #include "kis_animation_frame_cache.h" | ||
35 | #include "kis_image_animation_interface.h" | ||||
35 | #include "kis_signal_auto_connection.h" | 36 | #include "kis_signal_auto_connection.h" | ||
36 | #include "kis_node_manager.h" | 37 | #include "kis_node_manager.h" | ||
37 | 38 | | |||
38 | #include <QPointer> | 39 | #include <QPointer> | ||
40 | #include <QTimer> | ||||
39 | 41 | | |||
40 | struct TimelineDocker::Private | 42 | struct TimelineDocker::Private | ||
41 | { | 43 | { | ||
Context not available. | |||||
44 | view(new TimelineFramesView(parent)) | 46 | view(new TimelineFramesView(parent)) | ||
45 | { | 47 | { | ||
46 | view->setModel(model); | 48 | view->setModel(model); | ||
49 | refreshTimelineUITimer = new QTimer(parent); | ||||
47 | } | 50 | } | ||
48 | 51 | | |||
49 | TimelineFramesModel *model; | 52 | TimelineFramesModel *model; | ||
Context not available. | |||||
51 | 54 | | |||
52 | QPointer<KisCanvas2> canvas; | 55 | QPointer<KisCanvas2> canvas; | ||
53 | 56 | | |||
57 | | ||||
58 | QTimer *refreshTimelineUITimer; | ||||
59 | | ||||
60 | | ||||
54 | KisSignalAutoConnectionsStore canvasConnections; | 61 | KisSignalAutoConnectionsStore canvasConnections; | ||
55 | }; | 62 | }; | ||
56 | 63 | | |||
Context not available. | |||||
124 | m_d->canvasConnections.addConnection( | 131 | m_d->canvasConnections.addConnection( | ||
125 | m_d->canvas->viewManager()->mainWindow(), SIGNAL(themeChanged()), | 132 | m_d->canvas->viewManager()->mainWindow(), SIGNAL(themeChanged()), | ||
126 | this, SLOT(slotUpdateIcons()) ); | 133 | this, SLOT(slotUpdateIcons()) ); | ||
134 | | ||||
135 | m_d->canvasConnections.addConnection(m_d->canvas->image(), SIGNAL(sigImageUpdated(const QRect &)), | ||||
136 | this, SLOT(slotImageUpdated())); | ||||
137 | | ||||
138 | m_d->canvasConnections.addConnection(m_d->refreshTimelineUITimer, SIGNAL(timeout()), this, SLOT(slotRefreshUI())); | ||||
139 | | ||||
127 | } | 140 | } | ||
128 | 141 | | |||
129 | } | 142 | } | ||
Context not available. | |||||
135 | } | 148 | } | ||
136 | } | 149 | } | ||
137 | 150 | | |||
151 | void TimelineDocker::slotImageUpdated() | ||||
152 | { | ||||
153 | m_d->refreshTimelineUITimer->setSingleShot(true); | ||||
154 | m_d->refreshTimelineUITimer->start(500); | ||||
155 | } | ||||
156 | | ||||
157 | void TimelineDocker::slotRefreshUI() | ||||
158 | { | ||||
159 | m_d->refreshTimelineUITimer->stop(); | ||||
160 | | ||||
161 | | ||||
162 | // Potential hack... | ||||
163 | // the animation timeline UI updates its display when the frame changes | ||||
164 | // this forces that refresh to happen by quickly changing frames back and forth | ||||
165 | // just setting the frame to the current frame has no effect | ||||
166 | if (m_d->canvas && m_d->canvas->image() ) { | ||||
167 | int currentFrame = m_d->model->currentTime(); | ||||
168 | m_d->canvas->image()->animationInterface()->sigUiTimeChanged(currentFrame+1); | ||||
169 | m_d->canvas->image()->animationInterface()->sigUiTimeChanged(currentFrame-1); | ||||
170 | m_d->canvas->image()->animationInterface()->sigUiTimeChanged(currentFrame); | ||||
171 | } | ||||
172 | } | ||||
173 | | ||||
138 | void TimelineDocker::unsetCanvas() | 174 | void TimelineDocker::unsetCanvas() | ||
139 | { | 175 | { | ||
140 | setCanvas(0); | 176 | setCanvas(0); | ||
Context not available. |