derive clips, tracks, and sequences from the same base

This commit is contained in:
itsmattkc
2019-04-14 11:13:00 +10:00
parent 336ef69d73
commit 1b9a963eeb
26 changed files with 284 additions and 108 deletions
+34
View File
@@ -1,5 +1,8 @@
#include "track.h"
#include <QApplication>
#include <QDesktopWidget>
#include "timeline/clip.h"
#include "timeline/tracklist.h"
#include "timeline/sequence.h"
@@ -9,6 +12,8 @@ int olive::timeline::kTrackDefaultHeight = 40;
int olive::timeline::kTrackMinHeight = 30;
int olive::timeline::kTrackHeightIncrement = 10;
int olive::timeline::kTimelineLabelFixedWidth = 200;
Track::Track(TrackList* parent, olive::TrackType type) :
parent_(parent),
type_(type),
@@ -206,6 +211,26 @@ bool Track::ContainsClip(Clip *c)
return false;
}
int Track::SequenceWidth()
{
return sequence()->width;
}
int Track::SequenceHeight()
{
return sequence()->height;
}
double Track::SequenceFrameRate()
{
return sequence()->frame_rate;
}
long Track::SequencePlayhead()
{
return sequence()->playhead;
}
Track *Track::Previous()
{
int index = Index();
@@ -433,3 +458,12 @@ void Track::SetLocked(bool locked)
{
locked_ = locked;
}
void olive::timeline::MultiplyTrackSizesByDPI()
{
kTrackDefaultHeight *= qApp->fontMetrics().height() * 3;
kTrackMinHeight *= qApp->fontMetrics().height();
kTrackHeightIncrement *= qApp->fontMetrics().height() / 2;
kTimelineLabelFixedWidth *= QApplication::desktop()->devicePixelRatio();
}