iVS3D v2.0.0
Loading...
Searching...
No Matches
timeline.h
1#ifndef TIMELINE_H
2#define TIMELINE_H
3
4#include <QWidget>
5#include <QSpinBox>
6#include <QScreen>
7#include "slideablelabel.h"
8#include "timelinelabel.h"
9#include "ui_timeline.h"
10
11#define MARKER_COLOR Qt::black
12#define BOUNDARY_COLOR Qt::black
13
14namespace Ui {
15class Timeline;
16}
17
29class Timeline : public QWidget
30{
31 Q_OBJECT
32
33public:
38 explicit Timeline(QWidget *parent = nullptr);
39 ~Timeline();
40
45 void updateKeyframes(const std::vector<uint> &newKeyframes);
46
52 void setFrames(const std::vector<uint> &keyframes, uint frameCount);
53
58 uint selectedFrame();
59
64 void selectFrame(uint index);
65
70
75 void resizeEvent(QResizeEvent *ev) override;
76
81 void setEnabled(bool enable);
82
87 QPoint getBoundaries();
88
93 void setBoundaries(QPoint boundaries);
94
95 void resetBoundaries();
96
97signals:
98 void sig_selectedChanged(uint index);
99 void sig_boundariesChanged(QPoint boundaries);
100
101private slots:
102 // triggered by SlideableLabels mouseMoved signal
103 void highlighterMoved(int xMovement);
104 void markerMoved(int xMovement);
105 void sbIndexChanged(int index);
106 void boundaryMoved(int xMovement, SlideableLabel *boundaryLabel);
107 // triggered by click on Timeline
108 void slot_totalTimelineClicked(QPoint pos);
109 void slot_zoomTimelineClicked(QPoint pos);
110 void zoomChanged();
111
112public slots:
116 void resize();
117
118private:
119 Ui::Timeline *ui;
120 // ui elements
121 SlideableLabel *m_highlighter = 0; // used for highlighting the zoomed area
122 SlideableLabel *m_marker = 0; // used to mark the currently shown frame
123 TimelineLabel *m_zoomTimeline = 0; // displays a only highlighted frames
124 TimelineLabel *m_totalTimeline = 0; // displays every frame
125 SlideableLabel *m_startBoundaryLabel = 0; // marks the start boundary of the corpped frames
126 SlideableLabel *m_endBoundaryLabel = 0; // marks the end boundary of the cropped frames
127 QDoubleSpinBox *m_zoomSpinBox = 0; // adjust width of the highlighter (=> zoom)
128 QSpinBox *m_indexSpinBox = 0; // shows and changes current index
129
130 QPointF getHighlighterRange();
131 void setupSpinBoxes();
132 QPixmap drawMarker(uint pixWidth, uint pixHeight, uint symbolWidth, uint symbolHeigth, uint topMargin);
133
134 // cropped boundaries
135 QPoint m_boundaries;
136 QPixmap drawBoundary(uint pixWidth, uint pixHeight, uint symbolWidth, uint topBottomMargin, bool isStart);
137 void positionBoundaries(uint startPos, uint endPos);
138
139 // frame data
140 std::vector<uint> m_keyframes;
141 uint m_frameCount = 1;
142
143 bool m_selectActive = false;
144 bool m_enableWindow = false;
145};
146
147#endif // TIMELINE_H
The SlideableLabel class is the label which sits on the timeline and can be moved on it.
Definition slideablelabel.h:20
The Timeline class is the class wich coordinates and manages all timeline events and elements.
Definition timeline.h:30
uint selectedFrame()
selectedFrame returns the index of the frame which is currently selected
Definition timeline.cpp:121
void selectFrame(uint index)
selectFrame moves markers to new positions
Definition timeline.cpp:127
QPoint getBoundaries()
getBoundaries gets the boundaries of the working set
Definition timeline.cpp:207
void resizeEvent(QResizeEvent *ev) override
resizeEvent redraws timeline when window resizes
Definition timeline.cpp:162
void updateHighlighterWidth()
updateHighlighterWidth redraws highlighter with new width
Definition timeline.cpp:145
void updateKeyframes(const std::vector< uint > &newKeyframes)
updateKeyframes redraws timeline with new keyframe positions
Definition timeline.cpp:64
void setFrames(const std::vector< uint > &keyframes, uint frameCount)
setFrames sets the frame
Definition timeline.cpp:109
void setEnabled(bool enable)
setEnabled en/disables the timeline
Definition timeline.cpp:175
void resize()
resize redraws the timeline when window resizes
Definition timeline.cpp:70
void setBoundaries(QPoint boundaries)
setBoundaries sets the boundaries of the working set and moves them to the desired position
Definition timeline.cpp:212
The TimelineLabel class is the background of the timeline, it displays positions of frames and keyfra...
Definition timelinelabel.h:29