place timecode conversion functions into a Timecode class rather than an olive namespace
Code cleanup and improvement.
This commit is contained in:
@@ -290,7 +290,7 @@ void TimelineWidget::GoToPrevCut()
|
||||
int64_t this_track_closest_cut = 0;
|
||||
|
||||
foreach (Block* block, track->Blocks()) {
|
||||
int64_t block_out_ts = olive::time_to_timestamp(block->out(), timebase());
|
||||
int64_t block_out_ts = Timecode::time_to_timestamp(block->out(), timebase());
|
||||
|
||||
if (block_out_ts < playhead_) {
|
||||
this_track_closest_cut = block_out_ts;
|
||||
@@ -314,14 +314,14 @@ void TimelineWidget::GoToNextCut()
|
||||
int64_t closest_cut = INT64_MAX;
|
||||
|
||||
foreach (TrackOutput* track, timeline_node_->Tracks()) {
|
||||
int64_t this_track_closest_cut = olive::time_to_timestamp(track->track_length(), timebase());
|
||||
int64_t this_track_closest_cut = Timecode::time_to_timestamp(track->track_length(), timebase());
|
||||
|
||||
if (this_track_closest_cut <= playhead_) {
|
||||
this_track_closest_cut = INT64_MAX;
|
||||
}
|
||||
|
||||
foreach (Block* block, track->Blocks()) {
|
||||
int64_t block_in_ts = olive::time_to_timestamp(block->in(), timebase());
|
||||
int64_t block_in_ts = Timecode::time_to_timestamp(block->in(), timebase());
|
||||
|
||||
if (block_in_ts > playhead_) {
|
||||
this_track_closest_cut = block_in_ts;
|
||||
@@ -339,7 +339,7 @@ void TimelineWidget::GoToNextCut()
|
||||
|
||||
void TimelineWidget::SplitAtPlayhead()
|
||||
{
|
||||
rational playhead_time = olive::timestamp_to_time(playhead_, timebase());
|
||||
rational playhead_time = Timecode::timestamp_to_time(playhead_, timebase());
|
||||
|
||||
QList<TimelineViewBlockItem *> selected_blocks = GetSelectedBlocks();
|
||||
|
||||
@@ -494,7 +494,7 @@ QList<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
|
||||
|
||||
void TimelineWidget::RippleEditTo(olive::timeline::MovementMode mode, bool insert_gaps)
|
||||
{
|
||||
rational playhead_time = olive::timestamp_to_time(playhead_, timebase());
|
||||
rational playhead_time = Timecode::timestamp_to_time(playhead_, timebase());
|
||||
|
||||
rational closest_point_to_playhead;
|
||||
if (mode == olive::timeline::kTrimIn) {
|
||||
@@ -551,7 +551,7 @@ void TimelineWidget::RippleEditTo(olive::timeline::MovementMode mode, bool inser
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
|
||||
if (mode == olive::timeline::kTrimIn && !insert_gaps) {
|
||||
int64_t new_time = olive::time_to_timestamp(closest_point_to_playhead, timebase());
|
||||
int64_t new_time = Timecode::time_to_timestamp(closest_point_to_playhead, timebase());
|
||||
|
||||
SetTimeAndSignal(new_time);
|
||||
}
|
||||
|
||||
@@ -185,10 +185,10 @@ void TimelineWidget::ImportTool::DragMove(TimelineViewMouseEvent *event)
|
||||
}
|
||||
|
||||
// Generate tooltip (showing earliest in point of imported clip)
|
||||
int64_t earliest_timestamp = olive::time_to_timestamp(earliest_ghost, parent()->timebase());
|
||||
QString tooltip_text = olive::timestamp_to_timecode(earliest_timestamp,
|
||||
parent()->timebase(),
|
||||
olive::CurrentTimecodeDisplay());
|
||||
int64_t earliest_timestamp = Timecode::time_to_timestamp(earliest_ghost, parent()->timebase());
|
||||
QString tooltip_text = Timecode::timestamp_to_timecode(earliest_timestamp,
|
||||
parent()->timebase(),
|
||||
Timecode::CurrentDisplay());
|
||||
|
||||
// Force tooltip to update (otherwise the tooltip won't move as written in the documentation, and could get in the way
|
||||
// of the cursor)
|
||||
|
||||
@@ -326,11 +326,11 @@ void TimelineWidget::PointerTool::ProcessDrag(const TimelineCoordinate &mouse_po
|
||||
|
||||
// Show tooltip
|
||||
// Generate tooltip (showing earliest in point of imported clip)
|
||||
int64_t earliest_timestamp = olive::time_to_timestamp(time_movement, parent()->timebase());
|
||||
QString tooltip_text = olive::timestamp_to_timecode(earliest_timestamp,
|
||||
parent()->timebase(),
|
||||
olive::CurrentTimecodeDisplay(),
|
||||
true);
|
||||
int64_t earliest_timestamp = Timecode::time_to_timestamp(time_movement, parent()->timebase());
|
||||
QString tooltip_text = Timecode::timestamp_to_timecode(earliest_timestamp,
|
||||
parent()->timebase(),
|
||||
Timecode::CurrentDisplay(),
|
||||
true);
|
||||
|
||||
// Force tooltip to update (otherwise the tooltip won't move as written in the documentation, and could get in the way
|
||||
// of the cursor)
|
||||
|
||||
@@ -51,11 +51,11 @@ void TimelineWidget::SlipTool::ProcessDrag(const TimelineCoordinate &mouse_pos)
|
||||
|
||||
// Show tooltip
|
||||
// Generate tooltip (showing earliest in point of imported clip)
|
||||
int64_t earliest_timestamp = olive::time_to_timestamp(time_movement, parent()->timebase());
|
||||
QString tooltip_text = olive::timestamp_to_timecode(earliest_timestamp,
|
||||
parent()->timebase(),
|
||||
olive::CurrentTimecodeDisplay(),
|
||||
true);
|
||||
int64_t earliest_timestamp = Timecode::time_to_timestamp(time_movement, parent()->timebase());
|
||||
QString tooltip_text = Timecode::timestamp_to_timecode(earliest_timestamp,
|
||||
parent()->timebase(),
|
||||
Timecode::CurrentDisplay(),
|
||||
true);
|
||||
// Force tooltip to update (otherwise the tooltip won't move as written in the documentation, and could get in the way
|
||||
// of the cursor)
|
||||
QToolTip::hideText();
|
||||
|
||||
@@ -89,7 +89,7 @@ bool TimelineViewBase::PlayheadMove(QMouseEvent *event)
|
||||
QPointF scene_pos = mapToScene(event->pos());
|
||||
rational mouse_time = SceneToTime(scene_pos.x());
|
||||
|
||||
int64_t target_ts = olive::time_to_timestamp(mouse_time, timebase());
|
||||
int64_t target_ts = Timecode::time_to_timestamp(mouse_time, timebase());
|
||||
|
||||
SetTime(target_ts);
|
||||
emit TimeChanged(target_ts);
|
||||
|
||||
Reference in New Issue
Block a user