1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef TIMEBASEDWIDGET_H
#define TIMEBASEDWIDGET_H
#include <QWidget>
#include "node/output/viewer/viewer.h"
#include "timeline/timelinecommon.h"
#include "widget/resizablescrollbar/resizablescrollbar.h"
#include "widget/timelinewidget/timelinescaledobject.h"
#include "widget/timelinewidget/view/timelineview.h"
#include "widget/timeruler/timeruler.h"
OLIVE_NAMESPACE_ENTER
class TimeBasedWidget : public TimelineScaledWidget
{
Q_OBJECT
public:
TimeBasedWidget(bool ruler_text_visible = true, bool ruler_cache_status_visible = false, QWidget* parent = nullptr);
rational GetTime() const;
const int64_t& GetTimestamp() const;
void ZoomIn();
void ZoomOut();
ViewerOutput* GetConnectedNode() const;
void ConnectViewerNode(ViewerOutput *node);
void SetScaleAndCenterOnPlayhead(const double& scale);
TimeRuler* ruler() const;
public slots:
void SetTimestamp(int64_t timestamp);
void SetTimebase(const rational& timebase);
void SetScale(const double& scale);
void GoToStart();
void PrevFrame();
void NextFrame();
void GoToEnd();
void GoToPrevCut();
void GoToNextCut();
void SetInAtPlayhead();
void SetOutAtPlayhead();
void ResetIn();
void ResetOut();
void ClearInOutPoints();
void SetMarker();
void ToggleShowAll();
void GoToIn();
void GoToOut();
protected slots:
void SetTimeAndSignal(const int64_t& t);
protected:
ResizableScrollBar* scrollbar() const;
virtual void TimebaseChangedEvent(const rational&) override;
virtual void TimeChangedEvent(const int64_t&){}
virtual void ScaleChangedEvent(const double &) override;
virtual void ConnectedNodeChanged(ViewerOutput*){}
virtual void ConnectNodeInternal(ViewerOutput*){}
virtual void DisconnectNodeInternal(ViewerOutput*){}
void SetAutoMaxScrollBar(bool e);
virtual void resizeEvent(QResizeEvent *event) override;
virtual TimelinePoints* ConnectTimelinePoints();
virtual Project* GetTimelinePointsProject();
TimelinePoints* GetConnectedTimelinePoints() const;
void ConnectTimelineView(TimelineViewBase* base);
protected slots:
/**
* @brief Slot to center the horizontal scroll bar on the playhead's current position
*/
void CenterScrollOnPlayhead();
/**
* @brief By default, TimeBasedWidget will set the timebase to the viewer node's video timebase.
* Set this to false if you want to set your own timebase.
*/
void SetAutoSetTimebase(bool e);
signals:
void TimeChanged(const int64_t&);
void TimebaseChanged(const rational&);
private:
/**
* @brief Set either in or out point to the current playhead
*
* @param m
*
* Set to kTrimIn or kTrimOut for setting the in point or out point respectively.
*/
void SetPoint(Timeline::MovementMode m, const rational &time);
/**
* @brief Reset either the in or out point
*
* Sets either the in point to 0 or the out point to `RATIONAL_MAX`.
*
* @param m
*
* Set to kTrimIn or kTrimOut for setting the in point or out point respectively.
*/
void ResetPoint(Timeline::MovementMode m);
ViewerOutput* viewer_node_;
TimeRuler* ruler_;
ResizableScrollBar* scrollbar_;
bool auto_max_scrollbar_;
TimelinePoints* points_;
QList<TimelineViewBase*> timeline_views_;
bool toggle_show_all_;
double toggle_show_all_old_scale_;
int toggle_show_all_old_scroll_;
bool auto_set_timebase_;
private slots:
void UpdateMaximumScroll();
void ScrollBarResized(const double& multiplier);
};
OLIVE_NAMESPACE_EXIT
#endif // TIMEBASEDWIDGET_H
|