From 771572f65b4e1b42d4448b4f4161fdc703727f7e Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sun, 16 Jun 2019 15:13:53 -0700 Subject: [PATCH] began work setting several timings to use rational rather than long/double --- effects/effectfield.cpp | 67 +++++++++++++++------------ effects/effectfield.h | 9 ++-- effects/fields/boolfield.cpp | 13 ++---- effects/fields/boolfield.h | 4 +- effects/fields/colorfield.cpp | 4 +- effects/fields/colorfield.h | 4 +- effects/fields/combofield.cpp | 2 +- effects/fields/combofield.h | 2 +- effects/fields/doublefield.cpp | 12 ++--- effects/fields/doublefield.h | 4 +- effects/fields/filefield.cpp | 4 +- effects/fields/filefield.h | 4 +- effects/fields/fontfield.cpp | 4 +- effects/fields/fontfield.h | 4 +- effects/fields/stringfield.cpp | 4 +- effects/fields/stringfield.h | 4 +- effects/internal/richtexteffect.cpp | 8 ++-- effects/internal/richtexteffect.h | 2 +- effects/internal/solideffect.cpp | 2 +- effects/internal/solideffect.h | 2 +- effects/internal/texteffect.cpp | 2 +- effects/internal/texteffect.h | 2 +- effects/internal/timecodeeffect.cpp | 14 +++--- effects/internal/timecodeeffect.h | 2 +- effects/keyframe.h | 4 +- global/global.cpp | 2 + global/timing.cpp | 6 ++- global/timing.h | 6 ++- nodes/inputs/boolinput.cpp | 2 +- nodes/inputs/boolinput.h | 2 +- nodes/inputs/colorinput.cpp | 2 +- nodes/inputs/colorinput.h | 2 +- nodes/inputs/fontinput.cpp | 2 +- nodes/inputs/fontinput.h | 2 +- nodes/inputs/stringinput.cpp | 2 +- nodes/inputs/stringinput.h | 2 +- nodes/inputs/vecinput.cpp | 20 ++++----- nodes/inputs/vecinput.h | 20 ++++----- nodes/node.cpp | 2 +- nodes/node.h | 2 +- nodes/nodeio.cpp | 4 +- nodes/nodeio.h | 5 ++- nodes/oldeffectnode.cpp | 14 +----- nodes/oldeffectnode.h | 28 +----------- panels/effectcontrols.cpp | 3 +- panels/viewer.cpp | 5 ++- panels/viewer.h | 1 - project/media.cpp | 4 +- timeline/sequence.cpp | 70 +++++++++++++++++++++++++++++ timeline/sequence.h | 2 +- ts/olive_ar.ts | 48 ++++++++++---------- ts/olive_bs.ts | 48 ++++++++++---------- ts/olive_de.ts | 48 ++++++++++---------- ts/olive_es.ts | 48 ++++++++++---------- ts/olive_fr.ts | 48 ++++++++++---------- ts/olive_id.ts | 48 ++++++++++---------- ts/olive_it.ts | 48 ++++++++++---------- ts/olive_ru.ts | 48 ++++++++++---------- ts/olive_sr.ts | 48 ++++++++++---------- ui/labelslider.cpp | 4 +- ui/timelinearea.cpp | 2 - ui/timelineheader.cpp | 2 +- ui/timelineview.cpp | 12 ++--- 63 files changed, 448 insertions(+), 397 deletions(-) diff --git a/effects/effectfield.cpp b/effects/effectfield.cpp index 10db09797..f8c052eed 100644 --- a/effects/effectfield.cpp +++ b/effects/effectfield.cpp @@ -65,9 +65,9 @@ QString EffectField::ConvertValueToString(const QVariant &v) return v.toString(); } -void EffectField::UpdateWidgetValue(QWidget *, double) {} +void EffectField::UpdateWidgetValue(QWidget *, const rational &) {} -QVariant EffectField::GetValueAt(double timecode) +QVariant EffectField::GetValueAt(const rational& timecode) { if (HasKeyframes()) { int before_keyframe; @@ -96,15 +96,19 @@ QVariant EffectField::GetValueAt(double timecode) } else if (before_key.type == EFFECT_KEYFRAME_BEZIER || after_key.type == EFFECT_KEYFRAME_BEZIER) { + double timecode_dbl = timecode.ToDouble(); + double before_time_dbl = before_key.time.ToDouble(); + double after_time_dbl = after_key.time.ToDouble(); + // bezier interpolation if (before_key.type == EFFECT_KEYFRAME_BEZIER && after_key.type == EFFECT_KEYFRAME_BEZIER) { // cubic bezier - double t = cubic_t_from_x(timecode, - before_key.time, - before_key.time+GetValidKeyframeHandlePosition(before_keyframe, true), - after_key.time+GetValidKeyframeHandlePosition(after_keyframe, false), - after_key.time); + double t = cubic_t_from_x(timecode_dbl, + before_time_dbl, + before_time_dbl+GetValidKeyframeHandlePosition(before_keyframe, true), + after_time_dbl+GetValidKeyframeHandlePosition(after_keyframe, false), + after_time_dbl); value = cubic_from_t(before_dbl, before_dbl+before_key.post_handle.y(), @@ -115,10 +119,10 @@ QVariant EffectField::GetValueAt(double timecode) } else if (after_key.type == EFFECT_KEYFRAME_LINEAR) { // quadratic bezier // last keyframe is the bezier one - double t = quad_t_from_x(timecode, - before_key.time, - before_key.time+GetValidKeyframeHandlePosition(before_keyframe, true), - after_key.time); + double t = quad_t_from_x(timecode_dbl, + before_time_dbl, + before_time_dbl+GetValidKeyframeHandlePosition(before_keyframe, true), + after_time_dbl); value = quad_from_t(before_dbl, before_dbl+before_key.post_handle.y(), @@ -127,10 +131,10 @@ QVariant EffectField::GetValueAt(double timecode) } else { // this keyframe is the bezier one - double t = quad_t_from_x(timecode, - before_key.time, - after_key.time+GetValidKeyframeHandlePosition(after_keyframe, false), - after_key.time); + double t = quad_t_from_x(timecode_dbl, + before_time_dbl, + after_time_dbl+GetValidKeyframeHandlePosition(after_keyframe, false), + after_time_dbl); value = quad_from_t(before_dbl, after_dbl+after_key.pre_handle.y(), @@ -177,7 +181,7 @@ QVariant EffectField::GetValueAt(double timecode) return persistent_data_; } -void EffectField::SetValueAt(double time, const QVariant &value) +void EffectField::SetValueAt(const rational &time, const QVariant &value) { if (HasKeyframes()) { @@ -186,7 +190,7 @@ void EffectField::SetValueAt(double time, const QVariant &value) // Check array if a keyframe at this time already exists int keyframe_index = -1; for (int i=0;i keyframes.at(key).time) == post) && (comp_key == -1 - || ((keyframes.at(i).time < keyframes.at(comp_key).time) == post))) { + || ((keyframes.at(i).time < keyframes.at(comp_key).time) == post))) { // compare with next keyframe for post or previous frame for pre comp_key = i; } @@ -269,7 +273,7 @@ double EffectField::GetValidKeyframeHandlePosition(int key, bool post) { return adjusted_key; } - double comp = keyframes.at(comp_key).time - keyframes.at(key).time; + double comp = keyframes.at(comp_key).time.ToDouble() - keyframes.at(key).time.ToDouble(); // if comp keyframe is bezier, validate with its accompanying handle if (keyframes.at(comp_key).type == EFFECT_KEYFRAME_BEZIER) { @@ -294,24 +298,29 @@ double EffectField::GetValidKeyframeHandlePosition(int key, bool post) { return adjusted_key; } -void EffectField::GetKeyframeData(double timecode, int &before, int &after, double &progress) { +void EffectField::GetKeyframeData(const rational& timecode, int &before, int &after, double &progress) { int before_keyframe_index = -1; int after_keyframe_index = -1; double before_keyframe_time = DBL_MIN; double after_keyframe_time = DBL_MAX; for (int i=0;i before_keyframe_time) { - before_keyframe_index = i; - before_keyframe_time = eval_keyframe_time; - } else if (eval_keyframe_time > timecode && eval_keyframe_time < after_keyframe_time) { - after_keyframe_index = i; - after_keyframe_time = eval_keyframe_time; + } else { + + double eval_keyframe_dbl = eval_keyframe_time.ToDouble(); + + if (eval_keyframe_time < timecode && eval_keyframe_dbl > before_keyframe_time) { + before_keyframe_index = i; + before_keyframe_time = eval_keyframe_dbl; + } else if (eval_keyframe_time > timecode && eval_keyframe_dbl < after_keyframe_time) { + after_keyframe_index = i; + after_keyframe_time = eval_keyframe_dbl; + } } } @@ -320,7 +329,7 @@ void EffectField::GetKeyframeData(double timecode, int &before, int &after, doub // interpolate before = before_keyframe_index; after = after_keyframe_index; - progress = (timecode-before_keyframe_time)/(after_keyframe_time-before_keyframe_time); + progress = (timecode.ToDouble()-before_keyframe_time)/(after_keyframe_time-before_keyframe_time); } else if (before_keyframe_index > -1) { before = before_keyframe_index; after = before_keyframe_index; diff --git a/effects/effectfield.h b/effects/effectfield.h index 543dafc47..57937da5c 100644 --- a/effects/effectfield.h +++ b/effects/effectfield.h @@ -28,6 +28,7 @@ #include "effects/keyframe.h" #include "undo/undostack.h" #include "nodes/nodedatatypes.h" +#include "global/rational.h" class NodeIO; class ComboAction; @@ -151,7 +152,7 @@ public: * * A QVariant representation of the value at the given timecode. */ - QVariant GetValueAt(double timecode); + QVariant GetValueAt(const rational &timecode); /** * @brief Set the value of this field at a given timecode @@ -176,7 +177,7 @@ public: * * The QVariant value to set at this time. */ - void SetValueAt(double time, const QVariant& value); + void SetValueAt(const rational& time, const QVariant& value); /** * @brief Set up keyframing on this field @@ -285,7 +286,7 @@ public: * * The time in clip/media seconds to retrieve data from. */ - virtual void UpdateWidgetValue(QWidget* widget, double timecode); + virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode); /** * @brief Get the correct X position/time value of a bezier keyframe's handles @@ -408,7 +409,7 @@ private: * * The progress between the `before` keyframe and `after` keyframe from 0.0 to 1.0. */ - void GetKeyframeData(double timecode, int& before, int& after, double& d); + void GetKeyframeData(const rational &timecode, int& before, int& after, double& d); /** * @brief Internal enabled value diff --git a/effects/fields/boolfield.cpp b/effects/fields/boolfield.cpp index fbd2b2ea0..c61c95564 100644 --- a/effects/fields/boolfield.cpp +++ b/effects/fields/boolfield.cpp @@ -29,7 +29,7 @@ BoolField::BoolField(NodeIO *parent) : EffectField(parent, EffectField::EFFECT_FIELD_BOOL) {} -bool BoolField::GetBoolAt(double timecode) +bool BoolField::GetBoolAt(const rational &timecode) { return GetValueAt(timecode).toBool(); } @@ -56,7 +56,7 @@ QWidget *BoolField::CreateWidget(QWidget *existing) return cb; } -void BoolField::UpdateWidgetValue(QWidget *widget, double timecode) +void BoolField::UpdateWidgetValue(QWidget *widget, const rational &timecode) { QCheckBox* cb = static_cast(widget); @@ -65,13 +65,8 @@ void BoolField::UpdateWidgetValue(QWidget *widget, double timecode) cb->blockSignals(true); - if (qIsNaN(timecode)) { - cb->setTristate(true); - cb->setCheckState(Qt::PartiallyChecked); - } else { - cb->setTristate(false); - cb->setChecked(GetBoolAt(timecode)); - } + cb->setTristate(false); + cb->setChecked(GetBoolAt(timecode)); cb->blockSignals(false); diff --git a/effects/fields/boolfield.h b/effects/fields/boolfield.h index 7595aab73..91ccaee0c 100644 --- a/effects/fields/boolfield.h +++ b/effects/fields/boolfield.h @@ -50,7 +50,7 @@ public: * * The boolean value at this timecode */ - bool GetBoolAt(double timecode); + bool GetBoolAt(const rational& timecode); /** * @brief Reimplementation of EffectField::CreateWidget() @@ -62,7 +62,7 @@ public: /** * @brief Reimplementation of EffectField::UpdateWidgetValue() */ - virtual void UpdateWidgetValue(QWidget* widget, double timecode) override; + virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override; /** * @brief Reimplementation of EffectField::ConvertStringToValue() diff --git a/effects/fields/colorfield.cpp b/effects/fields/colorfield.cpp index 2a52c879a..6c32a5103 100644 --- a/effects/fields/colorfield.cpp +++ b/effects/fields/colorfield.cpp @@ -30,7 +30,7 @@ ColorField::ColorField(NodeIO* parent) : EffectField(parent, EffectField::EFFECT_FIELD_COLOR) {} -QColor ColorField::GetColorAt(double timecode) +QColor ColorField::GetColorAt(const rational& timecode) { return GetValueAt(timecode).value(); } @@ -45,7 +45,7 @@ QWidget *ColorField::CreateWidget(QWidget *existing) return cb; } -void ColorField::UpdateWidgetValue(QWidget *widget, double timecode) +void ColorField::UpdateWidgetValue(QWidget *widget, const rational &timecode) { ColorButton* cb = static_cast(widget); diff --git a/effects/fields/colorfield.h b/effects/fields/colorfield.h index 0744a25e6..1b8cc9b9a 100644 --- a/effects/fields/colorfield.h +++ b/effects/fields/colorfield.h @@ -50,7 +50,7 @@ public: * * The color value at this timecode */ - QColor GetColorAt(double timecode); + QColor GetColorAt(const rational &timecode); /** * @brief CreateWidget @@ -62,7 +62,7 @@ public: /** * @brief Reimplementation of EffectField::UpdateWidgetValue() */ - virtual void UpdateWidgetValue(QWidget* widget, double timecode) override; + virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override; /** * @brief Reimplementation of EffectField::ConvertStringToValue() diff --git a/effects/fields/combofield.cpp b/effects/fields/combofield.cpp index 5779b00e8..869c0e41a 100644 --- a/effects/fields/combofield.cpp +++ b/effects/fields/combofield.cpp @@ -62,7 +62,7 @@ QWidget *ComboField::CreateWidget(QWidget *existing) return cb; } -void ComboField::UpdateWidgetValue(QWidget *widget, double timecode) +void ComboField::UpdateWidgetValue(QWidget *widget, const rational &timecode) { QVariant data = GetValueAt(timecode); diff --git a/effects/fields/combofield.h b/effects/fields/combofield.h index 76c199e1e..909f8b2b7 100644 --- a/effects/fields/combofield.h +++ b/effects/fields/combofield.h @@ -79,7 +79,7 @@ public: /** * @brief Reimplementation of EffectField::UpdateWidgetValue() */ - virtual void UpdateWidgetValue(QWidget* widget, double timecode) override; + virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override; signals: /** diff --git a/effects/fields/doublefield.cpp b/effects/fields/doublefield.cpp index 5b8033249..e647b7439 100644 --- a/effects/fields/doublefield.cpp +++ b/effects/fields/doublefield.cpp @@ -36,7 +36,7 @@ DoubleField::DoubleField(NodeIO* parent) : connect(this, SIGNAL(Changed()), this, SLOT(ValueHasBeenSet()), Qt::DirectConnection); } -double DoubleField::GetDoubleAt(double timecode) +double DoubleField::GetDoubleAt(const rational& timecode) { return GetValueAt(timecode).toDouble(); } @@ -117,13 +117,13 @@ QWidget *DoubleField::CreateWidget(QWidget *existing) return ls; } -void DoubleField::UpdateWidgetValue(QWidget *widget, double timecode) +void DoubleField::UpdateWidgetValue(QWidget *widget, const rational &timecode) { - if (qIsNaN(timecode)) { - static_cast(widget)->SetValue(qSNaN()); - } else { + //if (qIsNaN(timecode)) { + //static_cast(widget)->SetValue(qSNaN()); + //} else { static_cast(widget)->SetValue(GetDoubleAt(timecode)); - } + //} } void DoubleField::ValueHasBeenSet() diff --git a/effects/fields/doublefield.h b/effects/fields/doublefield.h index 33a91d434..108f1d7c9 100644 --- a/effects/fields/doublefield.h +++ b/effects/fields/doublefield.h @@ -54,7 +54,7 @@ public: * * Double value at the set timecode */ - double GetDoubleAt(double timecode); + double GetDoubleAt(const rational &timecode); /** * @brief Sets the minimum allowed number for the user to set to `minimum`. @@ -103,7 +103,7 @@ public: /** * @brief Reimplementation of EffectField::UpdateWidgetValue() */ - virtual void UpdateWidgetValue(QWidget* widget, double timecode) override; + virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override; signals: /** * @brief Signal emitted when the field's maximum value has changed diff --git a/effects/fields/filefield.cpp b/effects/fields/filefield.cpp index 4258227ed..8840156bc 100644 --- a/effects/fields/filefield.cpp +++ b/effects/fields/filefield.cpp @@ -33,7 +33,7 @@ FileField::FileField(NodeIO* parent) : SetValueAt(0, ""); } -QString FileField::GetFileAt(double timecode) +QString FileField::GetFileAt(const rational& timecode) { return GetValueAt(timecode).toString(); } @@ -48,7 +48,7 @@ QWidget *FileField::CreateWidget(QWidget *existing) return efc; } -void FileField::UpdateWidgetValue(QWidget *widget, double timecode) +void FileField::UpdateWidgetValue(QWidget *widget, const rational &timecode) { EmbeddedFileChooser* efc = static_cast(widget); diff --git a/effects/fields/filefield.h b/effects/fields/filefield.h index 032ef93ee..622d71af1 100644 --- a/effects/fields/filefield.h +++ b/effects/fields/filefield.h @@ -51,7 +51,7 @@ public: * * The filename at this timecode */ - QString GetFileAt(double timecode); + QString GetFileAt(const rational &timecode); /** * @brief Reimplementation of EffectField::CreateWidget() @@ -63,7 +63,7 @@ public: /** * @brief Reimplementation of EffectField::UpdateWidgetValue() */ - virtual void UpdateWidgetValue(QWidget *widget, double timecode) override; + virtual void UpdateWidgetValue(QWidget *widget, const rational& timecode) override; private slots: /** * @brief Internal function connected to any QWidget made from CreateWidget() to update the value based on user input diff --git a/effects/fields/fontfield.cpp b/effects/fields/fontfield.cpp index 282becff5..e6267496f 100644 --- a/effects/fields/fontfield.cpp +++ b/effects/fields/fontfield.cpp @@ -37,7 +37,7 @@ FontField::FontField(NodeIO* parent) : SetValueAt(0, font_list.first()); } -QString FontField::GetFontAt(double timecode) +QString FontField::GetFontAt(const rational& timecode) { return GetValueAt(timecode).toString(); } @@ -66,7 +66,7 @@ QWidget *FontField::CreateWidget(QWidget *existing) return fcb; } -void FontField::UpdateWidgetValue(QWidget *widget, double timecode) +void FontField::UpdateWidgetValue(QWidget *widget, const rational &timecode) { QVariant data = GetValueAt(timecode); diff --git a/effects/fields/fontfield.h b/effects/fields/fontfield.h index 50ef9a509..21869fb80 100644 --- a/effects/fields/fontfield.h +++ b/effects/fields/fontfield.h @@ -52,7 +52,7 @@ public: * * The font family name at this timecode */ - QString GetFontAt(double timecode); + QString GetFontAt(const rational &timecode); /** * @brief Reimplementation of EffectField::CreateWidget() @@ -64,7 +64,7 @@ public: /** * @brief Reimplementation of EffectField::UpdateWidgetValue() */ - virtual void UpdateWidgetValue(QWidget* widget, double timecode) override; + virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override; private: /** diff --git a/effects/fields/stringfield.cpp b/effects/fields/stringfield.cpp index 4f1d1470e..ad1c2b312 100644 --- a/effects/fields/stringfield.cpp +++ b/effects/fields/stringfield.cpp @@ -36,7 +36,7 @@ StringField::StringField(NodeIO* parent, bool rich_text) : SetValueAt(0, ""); } -QString StringField::GetStringAt(double timecode) +QString StringField::GetStringAt(const rational& timecode) { return GetValueAt(timecode).toString(); } @@ -69,7 +69,7 @@ QWidget *StringField::CreateWidget(QWidget *existing) return text_edit; } -void StringField::UpdateWidgetValue(QWidget *widget, double timecode) +void StringField::UpdateWidgetValue(QWidget *widget, const rational &timecode) { TextEditEx* text = static_cast(widget); diff --git a/effects/fields/stringfield.h b/effects/fields/stringfield.h index d18cd84ed..a2438e92a 100644 --- a/effects/fields/stringfield.h +++ b/effects/fields/stringfield.h @@ -54,7 +54,7 @@ public: * * The string at this timecode */ - QString GetStringAt(double timecode); + QString GetStringAt(const rational &timecode); /** * @brief Reimplementation of EffectField::CreateWidget() @@ -66,7 +66,7 @@ public: /** * @brief Reimplementation of EffectField::UpdateWidgetValue() */ - virtual void UpdateWidgetValue(QWidget* widget, double timecode) override; + virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override; private slots: /** * @brief Internal function connected to any QWidget made from CreateWidget() to update the value based on user input diff --git a/effects/internal/richtexteffect.cpp b/effects/internal/richtexteffect.cpp index 09e5c7efd..748f6b481 100644 --- a/effects/internal/richtexteffect.cpp +++ b/effects/internal/richtexteffect.cpp @@ -117,7 +117,7 @@ OldEffectNodePtr RichTextEffect::Create(Clip *c) return std::make_shared(c); } -void RichTextEffect::redraw(double timecode) +void RichTextEffect::redraw(const rational &timecode) { QPainter p(&img); p.setRenderHint(QPainter::Antialiasing); @@ -144,7 +144,7 @@ void RichTextEffect::redraw(double timecode) if (auto_scroll_dir != SCROLL_OFF) { double clip_length_secs = double(parent_clip->length()) / parent_clip->media_frame_rate(); - scroll_progress = (timecode - double(parent_clip->clip_in()) / parent_clip->media_frame_rate()) / clip_length_secs; + scroll_progress = (timecode.ToDouble() - double(parent_clip->clip_in()) / parent_clip->media_frame_rate()) / clip_length_secs; } if (auto_scroll_dir == SCROLL_OFF || auto_scroll_dir == SCROLL_LEFT || auto_scroll_dir == SCROLL_RIGHT) { @@ -221,5 +221,7 @@ void RichTextEffect::redraw(double timecode) bool RichTextEffect::AlwaysUpdate() { - return autoscroll->GetValueAt(Now()).toInt() != SCROLL_OFF; + // FIXME + //return autoscroll->GetValueAt(Now()).toInt() != SCROLL_OFF; + return false; } diff --git a/effects/internal/richtexteffect.h b/effects/internal/richtexteffect.h index 28a477c01..a22907dc8 100644 --- a/effects/internal/richtexteffect.h +++ b/effects/internal/richtexteffect.h @@ -36,7 +36,7 @@ public: virtual olive::TrackType subtype() override; virtual OldEffectNodePtr Create(Clip *c) override; - virtual void redraw(double timecode) override; + virtual void redraw(const rational& timecode) override; protected: virtual bool AlwaysUpdate() override; diff --git a/effects/internal/solideffect.cpp b/effects/internal/solideffect.cpp index c5104a4e9..836a26f90 100644 --- a/effects/internal/solideffect.cpp +++ b/effects/internal/solideffect.cpp @@ -104,7 +104,7 @@ OldEffectNodePtr SolidEffect::Create(Clip *c) return std::make_shared(c); } -void SolidEffect::redraw(double timecode) { +void SolidEffect::redraw(const rational &timecode) { int w = img.width(); int h = img.height(); int alpha = qRound(opacity_field->GetDoubleAt(timecode)*2.55); diff --git a/effects/internal/solideffect.h b/effects/internal/solideffect.h index 0d3e60410..473f16514 100644 --- a/effects/internal/solideffect.h +++ b/effects/internal/solideffect.h @@ -44,7 +44,7 @@ public: virtual olive::TrackType subtype() override; virtual OldEffectNodePtr Create(Clip *c) override; - virtual void redraw(double timecode) override; + virtual void redraw(const rational& timecode) override; void SetType(SolidType type); private slots: diff --git a/effects/internal/texteffect.cpp b/effects/internal/texteffect.cpp index d82360bc0..133badd16 100644 --- a/effects/internal/texteffect.cpp +++ b/effects/internal/texteffect.cpp @@ -156,7 +156,7 @@ OldEffectNodePtr TextEffect::Create(Clip *c) return std::make_shared(c); } -void TextEffect::redraw(double timecode) { +void TextEffect::redraw(const rational &timecode) { if (size_val->GetDoubleAt(timecode) <= 0) { return; } diff --git a/effects/internal/texteffect.h b/effects/internal/texteffect.h index c054caaf5..f33e90b51 100644 --- a/effects/internal/texteffect.h +++ b/effects/internal/texteffect.h @@ -39,7 +39,7 @@ public: virtual olive::TrackType subtype() override; virtual OldEffectNodePtr Create(Clip *c) override; - virtual void redraw(double timecode) override; + virtual void redraw(const rational& timecode) override; private slots: void outline_enable(bool); void shadow_enable(bool); diff --git a/effects/internal/timecodeeffect.cpp b/effects/internal/timecodeeffect.cpp index 6e2c85517..e63de55f4 100644 --- a/effects/internal/timecodeeffect.cpp +++ b/effects/internal/timecodeeffect.cpp @@ -110,18 +110,18 @@ OldEffectNodePtr TimecodeEffect::Create(Clip *c) } -void TimecodeEffect::redraw(double timecode) { +void TimecodeEffect::redraw(const rational &timecode) { Sequence* sequence = parent_clip->track()->sequence(); if (tc_select->GetValueAt(timecode).toBool()) { - display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(sequence->playhead, - olive::config.timecode_view, - sequence->frame_rate()); + display_timecode = prepend_text->GetStringAt(timecode) + TimeToSMPTE(sequence->playhead, + olive::config.timecode_view, + sequence->frame_rate()); } else { double media_rate = parent_clip->media_frame_rate(); - display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(qRound(timecode * media_rate), - olive::config.timecode_view, - media_rate); + display_timecode = prepend_text->GetStringAt(timecode) + TimeToSMPTE(timecode, + olive::config.timecode_view, + media_rate); } img.fill(Qt::transparent); diff --git a/effects/internal/timecodeeffect.h b/effects/internal/timecodeeffect.h index 74ee7fd18..b8c97aac8 100644 --- a/effects/internal/timecodeeffect.h +++ b/effects/internal/timecodeeffect.h @@ -39,7 +39,7 @@ public: virtual olive::TrackType subtype() override; virtual OldEffectNodePtr Create(Clip *c) override; - virtual void redraw(double timecode) override; + virtual void redraw(const rational &timecode) override; DoubleInput* scale_val; ColorInput* color_val; ColorInput* color_bg_val; diff --git a/effects/keyframe.h b/effects/keyframe.h index 924d554a2..a6b14c309 100644 --- a/effects/keyframe.h +++ b/effects/keyframe.h @@ -24,6 +24,8 @@ #include #include +#include "global/rational.h" + class EffectField; class EffectKeyframe { @@ -31,7 +33,7 @@ public: EffectKeyframe(); int type; - double time; + rational time; QVariant data; // only for bezier type diff --git a/global/global.cpp b/global/global.cpp index 03c2a8b9a..61a7ca514 100644 --- a/global/global.cpp +++ b/global/global.cpp @@ -325,6 +325,7 @@ void OliveGlobal::save_recent_projects() void OliveGlobal::PasteInternal(Sequence *s, bool insert) { + /* FIXME: Broken, will probably need rewrite if (s == nullptr) { return; } @@ -457,6 +458,7 @@ void OliveGlobal::PasteInternal(Sequence *s, bool insert) update_ui(true); } } + */ } void OliveGlobal::EffectMenuAction(QAction *q) diff --git a/global/timing.cpp b/global/timing.cpp index 9d0ae84db..a0a087369 100644 --- a/global/timing.cpp +++ b/global/timing.cpp @@ -46,7 +46,7 @@ bool frame_rate_is_droppable(double rate) { || qFuzzyCompare(rate, 59.94)); } -long timecode_to_frame(const QString& s, int view, double frame_rate) { +long SMPTEToTime(const QString& s, int view, double frame_rate) { QList list = s.split(QRegExp("[:;]")); if (view == olive::kTimecodeFrames || (list.size() == 1 && view != olive::kTimecodeMilliseconds)) { @@ -102,7 +102,9 @@ long timecode_to_frame(const QString& s, int view, double frame_rate) { return f; } -QString frame_to_timecode(long f, int view, double frame_rate) { +QString TimeToSMPTE(const rational& time, int view, double frame_rate) { + long f = qFloor(time.ToDouble()*frame_rate); // FIXME: Not sure if this should be Floor or Round + if (view == olive::kTimecodeFrames) { return QString::number(f); } diff --git a/global/timing.h b/global/timing.h index c42a45b5c..88377dc11 100644 --- a/global/timing.h +++ b/global/timing.h @@ -4,6 +4,8 @@ #include #include +#include "global/rational.h" + class Clip; /** @@ -131,7 +133,7 @@ int64_t seconds_to_timestamp(Clip* c, double seconds); int64_t playhead_to_timestamp(Clip *c, long playhead); bool frame_rate_is_droppable(double rate); -long timecode_to_frame(const QString& s, int view, double frame_rate); -QString frame_to_timecode(long f, int view, double frame_rate); +long SMPTEToTime(const QString& s, int view, double frame_rate); +QString TimeToSMPTE(const rational &time, int view, double frame_rate); #endif // TIMING_H diff --git a/nodes/inputs/boolinput.cpp b/nodes/inputs/boolinput.cpp index e7be2f5a0..b27ae2570 100644 --- a/nodes/inputs/boolinput.cpp +++ b/nodes/inputs/boolinput.cpp @@ -10,7 +10,7 @@ BoolInput::BoolInput(Node *parent, const QString& id, const QString& name, bool AddAcceptedNodeInput(olive::nodes::kBoolean); } -bool BoolInput::GetBoolAt(double timecode) +bool BoolInput::GetBoolAt(const rational& timecode) { return static_cast(Field(0))->GetBoolAt(timecode); } diff --git a/nodes/inputs/boolinput.h b/nodes/inputs/boolinput.h index b49d9e36f..adee70012 100644 --- a/nodes/inputs/boolinput.h +++ b/nodes/inputs/boolinput.h @@ -22,7 +22,7 @@ public: * * The boolean value at this timecode */ - bool GetBoolAt(double timecode); + bool GetBoolAt(const rational &timecode); signals: /** diff --git a/nodes/inputs/colorinput.cpp b/nodes/inputs/colorinput.cpp index f7a57670d..51915f00d 100644 --- a/nodes/inputs/colorinput.cpp +++ b/nodes/inputs/colorinput.cpp @@ -8,7 +8,7 @@ ColorInput::ColorInput(Node *parent, const QString& id, const QString& name, boo AddAcceptedNodeInput(olive::nodes::kColor); } -QColor ColorInput::GetColorAt(double timecode) +QColor ColorInput::GetColorAt(const rational& timecode) { return static_cast(Field(0))->GetColorAt(timecode); } diff --git a/nodes/inputs/colorinput.h b/nodes/inputs/colorinput.h index 2475ed7fe..bb2cb7a0c 100644 --- a/nodes/inputs/colorinput.h +++ b/nodes/inputs/colorinput.h @@ -22,7 +22,7 @@ public: * * The color value at this timecode */ - QColor GetColorAt(double timecode); + QColor GetColorAt(const rational &timecode); }; #endif // COLORINPUT_H diff --git a/nodes/inputs/fontinput.cpp b/nodes/inputs/fontinput.cpp index fe1bd7b3c..4ed489af4 100644 --- a/nodes/inputs/fontinput.cpp +++ b/nodes/inputs/fontinput.cpp @@ -8,7 +8,7 @@ FontInput::FontInput(Node *parent, const QString& id, const QString& name, bool AddAcceptedNodeInput(olive::nodes::kFont); } -QString FontInput::GetFontAt(double timecode) +QString FontInput::GetFontAt(const rational& timecode) { return static_cast(Field(0))->GetFontAt(timecode); } diff --git a/nodes/inputs/fontinput.h b/nodes/inputs/fontinput.h index d238eefef..f061e1e6c 100644 --- a/nodes/inputs/fontinput.h +++ b/nodes/inputs/fontinput.h @@ -22,7 +22,7 @@ public: * * The font family name at this timecode */ - QString GetFontAt(double timecode); + QString GetFontAt(const rational &timecode); }; #endif // FONTINPUT_H diff --git a/nodes/inputs/stringinput.cpp b/nodes/inputs/stringinput.cpp index 1989276b8..1d0536640 100644 --- a/nodes/inputs/stringinput.cpp +++ b/nodes/inputs/stringinput.cpp @@ -8,7 +8,7 @@ StringInput::StringInput(Node *parent, const QString& id, const QString& name, b AddAcceptedNodeInput(olive::nodes::kString); } -QString StringInput::GetStringAt(double timecode) +QString StringInput::GetStringAt(const rational& timecode) { return static_cast(Field(0))->GetStringAt(timecode); } diff --git a/nodes/inputs/stringinput.h b/nodes/inputs/stringinput.h index 0f7d4c854..6cc2ace7a 100644 --- a/nodes/inputs/stringinput.h +++ b/nodes/inputs/stringinput.h @@ -27,7 +27,7 @@ public: * * The string at this timecode */ - QString GetStringAt(double timecode); + QString GetStringAt(const rational &timecode); }; #endif // STRINGINPUT_H diff --git a/nodes/inputs/vecinput.cpp b/nodes/inputs/vecinput.cpp index f9415fe87..94d3e315d 100644 --- a/nodes/inputs/vecinput.cpp +++ b/nodes/inputs/vecinput.cpp @@ -84,7 +84,7 @@ DoubleInput::DoubleInput(Node *parent, const QString &id, const QString &name, b { } -double DoubleInput::GetDoubleAt(double timecode) +double DoubleInput::GetDoubleAt(const rational& timecode) { return static_cast(Field(0))->GetDoubleAt(timecode); } @@ -94,12 +94,12 @@ Vec2Input::Vec2Input(Node *parent, const QString &id, const QString &name, bool { } -QVector2D Vec2Input::GetVector2DAt(double timecode) +QVector2D Vec2Input::GetVector2DAt(const rational &timecode) { return GetValueAt(timecode).value(); } -QVariant Vec2Input::GetValueAt(double timecode) +QVariant Vec2Input::GetValueAt(const rational &timecode) { QVector2D vec2; vec2.setX(static_cast(Field(0))->GetDoubleAt(timecode)); @@ -113,7 +113,7 @@ QVariant Vec2Input::GetValueAt(double timecode) return vec2; } -void Vec2Input::SetValueAt(double timecode, const QVariant &value) +void Vec2Input::SetValueAt(const rational &timecode, const QVariant &value) { QVector2D vec2 = value.value(); @@ -126,12 +126,12 @@ Vec3Input::Vec3Input(Node *parent, const QString &id, const QString &name, bool { } -QVector3D Vec3Input::GetVector3DAt(double timecode) +QVector3D Vec3Input::GetVector3DAt(const rational &timecode) { return GetValueAt(timecode).value(); } -QVariant Vec3Input::GetValueAt(double timecode) +QVariant Vec3Input::GetValueAt(const rational &timecode) { QVector3D vec3; vec3.setX(static_cast(Field(0))->GetDoubleAt(timecode)); @@ -147,7 +147,7 @@ QVariant Vec3Input::GetValueAt(double timecode) return vec3; } -void Vec3Input::SetValueAt(double timecode, const QVariant &value) +void Vec3Input::SetValueAt(const rational &timecode, const QVariant &value) { QVector3D vec3 = value.value(); @@ -161,12 +161,12 @@ Vec4Input::Vec4Input(Node *parent, const QString &id, const QString &name, bool { } -QVector4D Vec4Input::GetVector4DAt(double timecode) +QVector4D Vec4Input::GetVector4DAt(const rational &timecode) { return GetValueAt(timecode).value(); } -QVariant Vec4Input::GetValueAt(double timecode) +QVariant Vec4Input::GetValueAt(const rational &timecode) { QVector4D vec4; vec4.setX(static_cast(Field(0))->GetDoubleAt(timecode)); @@ -184,7 +184,7 @@ QVariant Vec4Input::GetValueAt(double timecode) return vec4; } -void Vec4Input::SetValueAt(double timecode, const QVariant &value) +void Vec4Input::SetValueAt(const rational &timecode, const QVariant &value) { QVector4D vec4 = value.value(); diff --git a/nodes/inputs/vecinput.h b/nodes/inputs/vecinput.h index 598e0872e..294e916e7 100644 --- a/nodes/inputs/vecinput.h +++ b/nodes/inputs/vecinput.h @@ -45,34 +45,34 @@ class DoubleInput : public VecInput public: DoubleInput(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); - double GetDoubleAt(double timecode); + double GetDoubleAt(const rational &timecode); }; class Vec2Input : public VecInput { public: Vec2Input(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); - QVector2D GetVector2DAt(double timecode); - virtual QVariant GetValueAt(double timecode) override; - virtual void SetValueAt(double timecode, const QVariant &value) override; + QVector2D GetVector2DAt(const rational& timecode); + virtual QVariant GetValueAt(const rational& timecode) override; + virtual void SetValueAt(const rational& timecode, const QVariant &value) override; }; class Vec3Input : public VecInput { public: Vec3Input(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); - QVector3D GetVector3DAt(double timecode); - virtual QVariant GetValueAt(double timecode) override; - virtual void SetValueAt(double timecode, const QVariant &value) override; + QVector3D GetVector3DAt(const rational& timecode); + virtual QVariant GetValueAt(const rational& timecode) override; + virtual void SetValueAt(const rational& timecode, const QVariant &value) override; }; class Vec4Input : public VecInput { public: Vec4Input(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); - QVector4D GetVector4DAt(double timecode); - virtual QVariant GetValueAt(double timecode) override; - virtual void SetValueAt(double timecode, const QVariant &value) override; + QVector4D GetVector4DAt(const rational& timecode); + virtual QVariant GetValueAt(const rational& timecode) override; + virtual void SetValueAt(const rational& timecode, const QVariant &value) override; }; #endif // VEC2INPUT_H diff --git a/nodes/node.cpp b/nodes/node.cpp index 2a28b1e37..08b00ca1f 100644 --- a/nodes/node.cpp +++ b/nodes/node.cpp @@ -38,7 +38,7 @@ int Node::ParameterCount() return parameters_.size(); } -double Node::Time() +const rational& Node::Time() { return 0; } diff --git a/nodes/node.h b/nodes/node.h index 7fdbfc79d..56ecc168b 100644 --- a/nodes/node.h +++ b/nodes/node.h @@ -22,7 +22,7 @@ public: NodeIO* Parameter(int i); int ParameterCount(); - double Time(); + const rational &Time(); NodeGraph* ParentGraph(); diff --git a/nodes/nodeio.cpp b/nodes/nodeio.cpp index 7bfd63083..4dca9ee56 100644 --- a/nodes/nodeio.cpp +++ b/nodes/nodeio.cpp @@ -141,7 +141,7 @@ QVariant NodeIO::GetValue() return GetValueAt(0); } -QVariant NodeIO::GetValueAt(double timecode) +QVariant NodeIO::GetValueAt(const rational& timecode) { if (FieldCount() == 0) { return data_; @@ -157,7 +157,7 @@ void NodeIO::SetValue(const QVariant &value) SetValueAt(0, value); } -void NodeIO::SetValueAt(double timecode, const QVariant &value) +void NodeIO::SetValueAt(const rational &timecode, const QVariant &value) { if (FieldCount() == 0) { data_ = value; diff --git a/nodes/nodeio.h b/nodes/nodeio.h index 68240a1f8..d0080e650 100644 --- a/nodes/nodeio.h +++ b/nodes/nodeio.h @@ -36,6 +36,7 @@ class ClickableLabel; #include "effects/effectfields.h" #include "nodes/nodeedge.h" +#include "global/rational.h" /** * @brief The EffectRow class @@ -201,7 +202,7 @@ public: * * The value of the first EffectField at the given timecode */ - virtual QVariant GetValueAt(double timecode); + virtual QVariant GetValueAt(const rational &timecode); /** * @brief Set value @@ -230,7 +231,7 @@ public: * * Value to set at this timecode */ - virtual void SetValueAt(double timecode, const QVariant& value); + virtual void SetValueAt(const rational& timecode, const QVariant& value); /** * @brief Sets the enabled state on all EffectField objects on this row to enabled diff --git a/nodes/oldeffectnode.cpp b/nodes/oldeffectnode.cpp index e561e3381..0688529d1 100644 --- a/nodes/oldeffectnode.cpp +++ b/nodes/oldeffectnode.cpp @@ -796,17 +796,7 @@ bool OldEffectNode::are_gizmos_enabled() { return (gizmos.size() > 0); } -double OldEffectNode::Now() -{ - return playhead_to_clip_seconds(parent_clip, parent_clip->track()->sequence()->playhead); -} - -long OldEffectNode::NowInFrames() -{ - return playhead_to_clip_frame(parent_clip, parent_clip->track()->sequence()->playhead); -} - -void OldEffectNode::redraw(double) { +void OldEffectNode::redraw(const rational &) { /* // run javascript QPainter p(&img); @@ -850,7 +840,7 @@ void OldEffectNode::redraw(double) { */ } -bool OldEffectNode::valueHasChanged(double timecode) { +bool OldEffectNode::valueHasChanged(const rational &timecode) { if (cachedValues.isEmpty()) { for (int i=0;i T randomNumber() { @@ -267,8 +243,8 @@ private: // superimpose functions - virtual void redraw(double timecode); - bool valueHasChanged(double timecode); + virtual void redraw(const rational& timecode); + bool valueHasChanged(const rational& timecode); QVector cachedValues; void delete_texture(); void validate_meta_path(); diff --git a/panels/effectcontrols.cpp b/panels/effectcontrols.cpp index 92c19a9f1..8297319ec 100644 --- a/panels/effectcontrols.cpp +++ b/panels/effectcontrols.cpp @@ -87,7 +87,8 @@ void EffectControls::set_zoom(bool in) { update_keyframes(); if (!selected_clips_.isEmpty()) { - scroll_to_frame(selected_clips_.first()->track()->sequence()->playhead); + // FIXME + //scroll_to_frame(selected_clips_.first()->track()->sequence()->playhead); } } diff --git a/panels/viewer.cpp b/panels/viewer.cpp index 3b6b76d40..f2c16a7cb 100644 --- a/panels/viewer.cpp +++ b/panels/viewer.cpp @@ -129,6 +129,7 @@ bool Viewer::focused() { } void Viewer::reset_all_audio() { + /* FIXME: Entire audio system is being rewritten // reset all clip audio if (seq != nullptr) { long last_frame = 0; @@ -150,6 +151,7 @@ void Viewer::reset_all_audio() { audio_ibuffer_timecode = double(audio_ibuffer_frame) / seq->frame_rate(); } clear_audio_ibuffer(); + */ } void Viewer::seek(long p) { @@ -174,7 +176,6 @@ void Viewer::seek(long p) { reset_all_audio(); audio_scrub = true; - last_playhead = seq->playhead; update_parents(update_fx); } @@ -382,7 +383,7 @@ void Viewer::update_playhead_timecode(long p) { } void Viewer::update_end_timecode() { - end_timecode->setText((seq == nullptr) ? frame_to_timecode(0, olive::config.timecode_view, 30) : frame_to_timecode(seq->GetEndFrame(), olive::config.timecode_view, seq->frame_rate())); + end_timecode->setText((seq == nullptr) ? TimeToSMPTE(0, olive::config.timecode_view, 30) : TimeToSMPTE(seq->GetEndFrame(), olive::config.timecode_view, seq->frame_rate())); } void Viewer::update_header_zoom() { diff --git a/panels/viewer.h b/panels/viewer.h index 9ce04ee39..a75fb614b 100644 --- a/panels/viewer.h +++ b/panels/viewer.h @@ -144,7 +144,6 @@ private: QString panel_name; double minimum_zoom; bool playing_in_to_out; - long last_playhead; void set_zoom_value(double d); void set_sb_max(); void set_playback_speed(int s); diff --git a/project/media.cpp b/project/media.cpp index 6d1f2a9bf..0e17e7dc0 100644 --- a/project/media.cpp +++ b/project/media.cpp @@ -288,7 +288,7 @@ int Media::columnCount() const { QString Media::GetStringDuration() { if (get_type() == MEDIA_TYPE_SEQUENCE) { Sequence* s = to_sequence().get(); - return frame_to_timecode(s->GetEndFrame(), olive::config.timecode_view, s->frame_rate()); + return TimeToSMPTE(s->GetEndFrame(), olive::config.timecode_view, s->frame_rate()); } if (get_type() == MEDIA_TYPE_FOOTAGE) { Footage* f = to_footage(); @@ -298,7 +298,7 @@ QString Media::GetStringDuration() { r = f->video_tracks.at(0).video_frame_rate * f->speed; long len = f->get_length_in_frames(r); - if (len > 0) return frame_to_timecode(len, olive::config.timecode_view, r); + if (len > 0) return TimeToSMPTE(len, olive::config.timecode_view, r); } return QString(); } diff --git a/timeline/sequence.cpp b/timeline/sequence.cpp index 0d419cc04..dd6665d4f 100644 --- a/timeline/sequence.cpp +++ b/timeline/sequence.cpp @@ -22,6 +22,8 @@ #include +#include "nodes/nodes/nodemedia.h" +#include "nodes/nodes/nodevideoclip.h" #include "timelinefunctions.h" #include "panels/panels.h" #include "global/clipboard.h" @@ -310,6 +312,74 @@ void Sequence::AddClipsFromGhosts(ComboAction* ca, const QVector& ghosts) } olive::timeline::snapped = false; + + /* FIXME: Old Clip create code, should be removed but keeping for reference for the timebeing + // add clips + long earliest_point = LONG_MAX; + QVector added_clips; + for (int i=0;i(g.track->Sibling(g.track_movement)); + c->set_media(g.media, g.media_stream); + c->set_timeline_in(g.in); + c->set_timeline_out(g.out); + c->set_clip_in(g.clip_in); + if (c->media()->get_type() == MEDIA_TYPE_FOOTAGE) { + Footage* m = c->media()->to_footage(); + if (m->video_tracks.size() == 0) { + // audio only (greenish) + c->set_color(128, 192, 128); + } else if (m->audio_tracks.size() == 0) { + // video only (orangeish) + c->set_color(192, 160, 128); + } else { + // video and audio (blueish) + c->set_color(128, 128, 192); + } + c->set_name(m->name); + } else if (c->media()->get_type() == MEDIA_TYPE_SEQUENCE) { + // sequence (red?ish?) + c->set_color(192, 128, 128); + + c->set_name(c->media()->to_sequence()->name()); + } + c->refresh(); + added_clips.append(c); + + } + ca->append(new AddClipCommand(added_clips)); + + // link clips from the same media + for (int i=0;imedia() == cc->media()) { + c->linked.append(cc.get()); + } + } + + if (olive::config.add_default_effects_to_clips) { + if (c->type() == olive::kTypeVideo) { + // add default video effects + c->effects.append(olive::node_library[kTransformEffect]->Create(c.get())); + } else if (c->type() == olive::kTypeAudio) { + // add default audio effects + c->effects.append(olive::node_library[kVolumeEffect]->Create(c.get())); + c->effects.append(olive::node_library[kPanEffect]->Create(c.get())); + } + } + } + + if (olive::config.enable_seek_to_import) { + panel_sequence_viewer->seek(earliest_point); + } + + olive::timeline::snapped = false; + */ } void Sequence::MoveClip(Clip *c, ComboAction *ca, long iin, long iout, long iclip_in, Track *itrack, bool verify_transitions, bool relative) diff --git a/timeline/sequence.h b/timeline/sequence.h index 8cb58607a..6518a5473 100644 --- a/timeline/sequence.h +++ b/timeline/sequence.h @@ -129,7 +129,7 @@ public: NodeIO* texture_io; // END TEST CODE - long playhead; + rational playhead; bool using_workarea; long workarea_in; diff --git a/ts/olive_ar.ts b/ts/olive_ar.ts index badaa17ce..7bd2a587b 100644 --- a/ts/olive_ar.ts +++ b/ts/olive_ar.ts @@ -2023,118 +2023,118 @@ Audio Layout: %6 مقطع جديد - + Preset: قالب: - + Film 4K فلم 4K - + TV 4K (Ultra HD/2160p) 4K تلفاز (أقصى-عالي الدقة/2160p) - + 1080p - + 720p - + 480p - + 360p - + 240p - + 144p - + NTSC (480i) - + PAL (576i) - + Custom مخصوص - + Video فيديو - + Width: العرض: - + Height: الطول: - + Frame Rate: معدل اﻹطارات: - + Pixel Aspect Ratio: للمراجعة معدل نسبة البيكسل: - + Square Pixels (1.0) بكسيل مربع (1.0) - + Interlacing: المشابكة: - + None (Progressive) لا شيء (متفاقم) - + Audio الصوت - + Sample Rate: معدل الإعتيان: - + Name: اﻷسم: @@ -3384,7 +3384,7 @@ Seek quickly (may briefly show inaccurate frames when seeking - doesn't aff Sequence - + %1 (copy) %1 (نسخ) diff --git a/ts/olive_bs.ts b/ts/olive_bs.ts index a7acf863c..4b98fc110 100644 --- a/ts/olive_bs.ts +++ b/ts/olive_bs.ts @@ -1828,117 +1828,117 @@ Audio Layout: %6 - + Preset: - + Film 4K - + TV 4K (Ultra HD/2160p) - + 1080p - + 720p - + 480p - + 360p - + 240p - + 144p - + NTSC (480i) - + PAL (576i) - + Custom - + Video Video - + Width: Širina: - + Height: Visina: - + Frame Rate: Okvirna stopa: - + Pixel Aspect Ratio: - + Square Pixels (1.0) - + Interlacing: - + None (Progressive) Nema (progresivno) - + Audio Audio - + Sample Rate: - + Name: @@ -3119,7 +3119,7 @@ Audio Layout: %6 Sequence - + %1 (copy) diff --git a/ts/olive_de.ts b/ts/olive_de.ts index 8babd7b2a..dc7b344ae 100644 --- a/ts/olive_de.ts +++ b/ts/olive_de.ts @@ -2040,121 +2040,121 @@ Audio Layout: %6 Neue Sequenz - + Preset: Could be also preset Vorgabe: - + Film 4K Film 4K - + TV 4K (Ultra HD/2160p) TV 4K (Ultra HD/2160p) - + 1080p 1080p - + 720p 720p - + 480p 480p - + 360p 360p - + 240p 240p - + 144p 144p - + NTSC (480i) NTSC (480i) - + PAL (576i) PAL (576i) - + Custom Benutzerdefiniert - + Video Same as in english Video - + Width: Breite: - + Height: Höhe: - + Frame Rate: Bildrate: - + Pixel Aspect Ratio: Pixel-Seitenverhältnis: - + Square Pixels (1.0) Quadratische Pixel (1.0) - + Interlacing: Same as in english Interlacing: - + None (Progressive) Keine (Progressive) - + Audio Same as in english Audio - + Sample Rate: Abtastrate: - + Name: Name: @@ -3410,7 +3410,7 @@ Sucht schneller (kann kurzzeitig ungenaue Frame anzeigen - wirkt sich nicht auf Sequence - + %1 (copy) %1 (kopieren) diff --git a/ts/olive_es.ts b/ts/olive_es.ts index 2ddb4411e..dc6a394fa 100644 --- a/ts/olive_es.ts +++ b/ts/olive_es.ts @@ -1679,117 +1679,117 @@ Audio Layout: %6 - + Preset: - + Film 4K - + TV 4K (Ultra HD/2160p) - + 1080p - + 720p - + 480p - + 360p - + 240p - + 144p - + NTSC (480i) - + PAL (576i) - + Custom - + Video - + Width: - + Height: - + Frame Rate: - + Pixel Aspect Ratio: - + Square Pixels (1.0) - + Interlacing: - + None (Progressive) - + Audio - + Sample Rate: - + Name: @@ -2970,7 +2970,7 @@ Audio Layout: %6 Sequence - + %1 (copy) diff --git a/ts/olive_fr.ts b/ts/olive_fr.ts index ad06dacf1..05e46b5e6 100644 --- a/ts/olive_fr.ts +++ b/ts/olive_fr.ts @@ -2008,117 +2008,117 @@ Canaux audio : %6 Nouvelle séquence - + Preset: Préréglage : - + Film 4K Film 4K - + TV 4K (Ultra HD/2160p) TV 4K (Ultra HD/2160p) - + 1080p 1080p - + 720p 720p - + 480p 480p - + 360p 360p - + 240p 240p - + 144p 144p - + NTSC (480i) NTSC (480i) - + PAL (576i) PAL (576i) - + Custom Personnalisé - + Video Vidéo - + Width: Largeur : - + Height: Hauteur : - + Frame Rate: Images par seconde : - + Pixel Aspect Ratio: Ratio des pixels : - + Square Pixels (1.0) Pixels carré (1,0) - + Interlacing: Entrelacement : - + None (Progressive) Aucun (Progressif) - + Audio Audio - + Sample Rate: Taux d'échantillonnage : - + Name: Nom : @@ -3362,7 +3362,7 @@ Montrer rapidement (la prévisualition peut montrer brièvement des images impr Sequence - + %1 (copy) %1 (copy) diff --git a/ts/olive_id.ts b/ts/olive_id.ts index c8a96359d..770525dc7 100644 --- a/ts/olive_id.ts +++ b/ts/olive_id.ts @@ -1869,117 +1869,117 @@ Tata Audio: %6 Rangkaian Baru - + Preset: - + Film 4K - + TV 4K (Ultra HD/2160p) - + 1080p - + 720p - + 480p - + 360p - + 240p - + 144p - + NTSC (480i) - + PAL (576i) - + Custom Kustom - + Video - + Width: Lebar: - + Height: Tinggi: - + Frame Rate: Laju frame (fps): - + Pixel Aspect Ratio: Rasio aspek piksel: - + Square Pixels (1.0) Persegi (1.0) - + Interlacing: Mode interlace: - + None (Progressive) Tidak ada (Progresif) - + Audio - + Sample Rate: Laju sampel: - + Name: Nama: @@ -3220,7 +3220,7 @@ Tampilkan frame dengan cepat (dapat menampilkan frame yang salah ketika menggese Sequence - + %1 (copy) %1 (salinan) diff --git a/ts/olive_it.ts b/ts/olive_it.ts index 2cfb3ba7a..8285b04b2 100644 --- a/ts/olive_it.ts +++ b/ts/olive_it.ts @@ -1862,117 +1862,117 @@ Disposizione audio: %6 Nuova sequenza - + Preset: Preimpostazioni: - + Film 4K Film 4K - + TV 4K (Ultra HD/2160p) TV 4K (Ultra HD/2160p) - + 1080p 1080p - + 720p 720p - + 480p 480p - + 360p 360p - + 240p 240p - + 144p 144p - + NTSC (480i) NTSC (480i) - + PAL (576i) PAL (576i) - + Custom Personalizzato - + Video Video - + Width: Larghezza: - + Height: Altezza: - + Frame Rate: Velocità fotogrammi: - + Pixel Aspect Ratio: Proporzioni dei pixel: - + Square Pixels (1.0) Pixel quadrati (1.0) - + Interlacing: Interlacciamento: - + None (Progressive) Nessuno (progressivo) - + Audio Audio - + Sample Rate: Frequenza di campionamento: - + Name: Nome: @@ -3211,7 +3211,7 @@ Sposta velocemente il cursore (potrebbe mostrare fotogrammi non perfettamente ac Sequence - + %1 (copy) %1 (copia) diff --git a/ts/olive_ru.ts b/ts/olive_ru.ts index fb78426e5..114c62d75 100644 --- a/ts/olive_ru.ts +++ b/ts/olive_ru.ts @@ -1759,117 +1759,117 @@ Audio Layout: %6 Новая последовательность - + Preset: Предстановка: - + Film 4K Кино 4К - + TV 4K (Ultra HD/2160p) TV 4K (Ultra HD/2160p) - + 1080p 1080p - + 720p 720p - + 480p 480p - + 360p 360p - + 240p 240p - + 144p 144p - + NTSC (480i) NTSC (480i) - + PAL (576i) PAL (576i) - + Custom Другое - + Video Видео - + Width: Ширина: - + Height: Высота: - + Frame Rate: Частота кадров: - + Pixel Aspect Ratio: Соотношение сторон пикселя: - + Square Pixels (1.0) Квадратные пиксели (1.0) - + Interlacing: Чересстрочность: - + None (Progressive) Нет (прогрессивно) - + Audio Звук - + Sample Rate: Частота дискретизации: - + Name: Название: @@ -3086,7 +3086,7 @@ Audio Layout: %6 Sequence - + %1 (copy) %1 (копия) diff --git a/ts/olive_sr.ts b/ts/olive_sr.ts index 1064d35df..1a8c5054a 100644 --- a/ts/olive_sr.ts +++ b/ts/olive_sr.ts @@ -1815,117 +1815,117 @@ Audio Layout: %6 - + Preset: - + Film 4K - + TV 4K (Ultra HD/2160p) - + 1080p - + 720p - + 480p - + 360p - + 240p - + 144p - + NTSC (480i) - + PAL (576i) - + Custom - + Video Видео - + Width: Ширина: - + Height: Висина: - + Frame Rate: Оквирна стопа: - + Pixel Aspect Ratio: - + Square Pixels (1.0) - + Interlacing: - + None (Progressive) Нема (прогресивно) - + Audio Аудио - + Sample Rate: - + Name: @@ -3106,7 +3106,7 @@ Audio Layout: %6 Sequence - + %1 (copy) diff --git a/ui/labelslider.cpp b/ui/labelslider.cpp index 9aa622a28..a814884d1 100644 --- a/ui/labelslider.cpp +++ b/ui/labelslider.cpp @@ -94,7 +94,7 @@ QString LabelSlider::ValueToString() { } else { switch (display_type) { case FrameNumber: - return frame_to_timecode(long(v), olive::config.timecode_view, frame_rate); + return TimeToSMPTE(long(v), olive::config.timecode_view, frame_rate); case Percent: return QString::number((v*100), 'f', decimal_places).append("%"); case Decibel: @@ -311,7 +311,7 @@ void LabelSlider::ShowDialog() if (s.isEmpty()) return; // parse string timecode to a frame number - d = timecode_to_frame(s, olive::config.timecode_view, frame_rate); + d = SMPTEToTime(s, olive::config.timecode_view, frame_rate); } else { diff --git a/ui/timelinearea.cpp b/ui/timelinearea.cpp index 9d6e07989..0602d8b0d 100644 --- a/ui/timelinearea.cpp +++ b/ui/timelinearea.cpp @@ -59,9 +59,7 @@ void TimelineArea::SetTrackType(Sequence *sequence, olive::TrackType track_type) type_ = track_type; if (sequence_ != nullptr) { - connect(sequence_, SIGNAL(NodeGraphChanged()), this, SLOT(RefreshLabels())); - } RefreshLabels(); diff --git a/ui/timelineheader.cpp b/ui/timelineheader.cpp index d6cd92f3c..6303a70cf 100644 --- a/ui/timelineheader.cpp +++ b/ui/timelineheader.cpp @@ -389,7 +389,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) { // draw text bool draw_text = false; if (text_enabled && lineX-textWidth > lastTextBoundary) { - timecode = frame_to_timecode(frame + in_visible, olive::config.timecode_view, viewer->seq->frame_rate()); + timecode = TimeToSMPTE(frame + in_visible, olive::config.timecode_view, viewer->seq->frame_rate()); fullTextWidth = fm.width(timecode); textWidth = fullTextWidth>>1; diff --git a/ui/timelineview.cpp b/ui/timelineview.cpp index 5d3643db4..b7351c332 100644 --- a/ui/timelineview.cpp +++ b/ui/timelineview.cpp @@ -210,9 +210,9 @@ void TimelineView::tooltip_timer_timeout() { QToolTip::showText(QCursor::pos(), tr("%1\nStart: %2\nEnd: %3\nDuration: %4").arg( tooltip_clip->name(), - frame_to_timecode(tooltip_clip->timeline_in(), olive::config.timecode_view, sequence()->frame_rate()), - frame_to_timecode(tooltip_clip->timeline_out(), olive::config.timecode_view, sequence()->frame_rate()), - frame_to_timecode(tooltip_clip->length(), olive::config.timecode_view, sequence()->frame_rate()) + TimeToSMPTE(tooltip_clip->timeline_in(), olive::config.timecode_view, sequence()->frame_rate()), + TimeToSMPTE(tooltip_clip->timeline_out(), olive::config.timecode_view, sequence()->frame_rate()), + TimeToSMPTE(tooltip_clip->length(), olive::config.timecode_view, sequence()->frame_rate()) )); } @@ -1988,9 +1988,9 @@ void TimelineView::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { */ if (ParentTimeline()->importing) { - QToolTip::showText(mapToGlobal(mouse_pos), frame_to_timecode(earliest_in_point, olive::config.timecode_view, sequence()->frame_rate())); + QToolTip::showText(mapToGlobal(mouse_pos), TimeToSMPTE(earliest_in_point, olive::config.timecode_view, sequence()->frame_rate())); } else { - QString tip = ((frame_diff < 0) ? "-" : "+") + frame_to_timecode(qAbs(frame_diff), olive::config.timecode_view, sequence()->frame_rate()); + QString tip = ((frame_diff < 0) ? "-" : "+") + TimeToSMPTE(qAbs(frame_diff), olive::config.timecode_view, sequence()->frame_rate()); if (ParentTimeline()->trim_target != nullptr) { // find which clip is being moved @@ -2010,7 +2010,7 @@ void TimelineView::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { } else { len += frame_diff; } - tip += frame_to_timecode(len, olive::config.timecode_view, sequence()->frame_rate()); + tip += TimeToSMPTE(len, olive::config.timecode_view, sequence()->frame_rate()); } }