added loop options and middle click drag in timeline
This commit is contained in:
+12
-2
@@ -43,7 +43,9 @@ Config::Config()
|
||||
previous_queue_size(3),
|
||||
previous_queue_type(FRAME_QUEUE_TYPE_FRAMES),
|
||||
upcoming_queue_size(0.5),
|
||||
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS)
|
||||
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
|
||||
loop(true),
|
||||
pause_at_out_point(true)
|
||||
{}
|
||||
|
||||
void Config::load(QString path) {
|
||||
@@ -150,7 +152,13 @@ void Config::load(QString path) {
|
||||
} else if (stream.name() == "UpcomingFrameQueueType") {
|
||||
stream.readNext();
|
||||
upcoming_queue_type = stream.text().toInt();
|
||||
}
|
||||
} else if (stream.name() == "Loop") {
|
||||
stream.readNext();
|
||||
loop = (stream.text() == "1");
|
||||
} else if (stream.name() == "PauseAtOutPoint") {
|
||||
stream.readNext();
|
||||
pause_at_out_point = (stream.text() == "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stream.hasError()) {
|
||||
@@ -206,6 +214,8 @@ void Config::save(QString path) {
|
||||
stream.writeTextElement("PreviousFrameQueueType", QString::number(previous_queue_type));
|
||||
stream.writeTextElement("UpcomingFrameQueueSize", QString::number(upcoming_queue_size));
|
||||
stream.writeTextElement("UpcomingFrameQueueType", QString::number(upcoming_queue_type));
|
||||
stream.writeTextElement("Loop", QString::number(loop));
|
||||
stream.writeTextElement("PauseAtOutPoint", QString::number(pause_at_out_point));
|
||||
|
||||
stream.writeEndElement(); // configuration
|
||||
stream.writeEndDocument(); // doc
|
||||
|
||||
@@ -58,6 +58,8 @@ struct Config {
|
||||
int previous_queue_type;
|
||||
double upcoming_queue_size;
|
||||
int upcoming_queue_type;
|
||||
bool loop;
|
||||
bool pause_at_out_point;
|
||||
|
||||
void load(QString path);
|
||||
void save(QString path);
|
||||
|
||||
@@ -769,6 +769,14 @@ void MainWindow::setup_menus() {
|
||||
set_name_and_marker->setCheckable(true);
|
||||
set_name_and_marker->setData(reinterpret_cast<quintptr>(&config.set_name_with_marker));
|
||||
|
||||
loop_action = tools_menu->addAction("Loop", this, SLOT(toggle_bool_action()));
|
||||
loop_action->setCheckable(true);
|
||||
loop_action->setData(reinterpret_cast<quintptr>(&config.loop));
|
||||
|
||||
pause_at_out_point_action = tools_menu->addAction("Pause At Out Point", this, SLOT(toggle_bool_action()));
|
||||
pause_at_out_point_action->setCheckable(true);
|
||||
pause_at_out_point_action->setData(reinterpret_cast<quintptr>(&config.pause_at_out_point));
|
||||
|
||||
tools_menu->addSeparator();
|
||||
|
||||
no_autoscroll = tools_menu->addAction("No Auto-Scroll", this, SLOT(set_autoscroll()));
|
||||
@@ -1066,6 +1074,8 @@ void MainWindow::toolMenu_About_To_Be_Shown() {
|
||||
set_bool_action_checked(enable_drop_on_media_to_replace);
|
||||
set_bool_action_checked(enable_hover_focus);
|
||||
set_bool_action_checked(set_name_and_marker);
|
||||
set_bool_action_checked(loop_action);
|
||||
set_bool_action_checked(pause_at_out_point_action);
|
||||
|
||||
set_int_action_checked(no_autoscroll, config.autoscroll);
|
||||
set_int_action_checked(page_autoscroll, config.autoscroll);
|
||||
|
||||
@@ -172,6 +172,8 @@ private:
|
||||
QAction* enable_drop_on_media_to_replace;
|
||||
QAction* enable_hover_focus;
|
||||
QAction* set_name_and_marker;
|
||||
QAction* loop_action;
|
||||
QAction* pause_at_out_point_action;
|
||||
|
||||
// edit menu actions
|
||||
QAction* undo_action;
|
||||
|
||||
+32
-8
@@ -307,6 +307,12 @@ void Viewer::play() {
|
||||
if (panel_footage_viewer->playing) panel_footage_viewer->pause();
|
||||
|
||||
if (seq != NULL) {
|
||||
if (!is_recording_cued()
|
||||
&& seq->playhead >= get_seq_out()
|
||||
&& (config.loop || !main_sequence)) {
|
||||
seek(get_seq_in());
|
||||
}
|
||||
|
||||
reset_all_audio();
|
||||
if (is_recording_cued() && !start_recording()) {
|
||||
dout << "[ERROR] Failed to record audio";
|
||||
@@ -452,7 +458,19 @@ void Viewer::set_zoom_value(double d) {
|
||||
}
|
||||
|
||||
void Viewer::set_sb_max() {
|
||||
headers->set_scrollbar_max(horizontal_bar, seq->getEndFrame(), headers->width());
|
||||
headers->set_scrollbar_max(horizontal_bar, seq->getEndFrame(), headers->width());
|
||||
}
|
||||
|
||||
long Viewer::get_seq_in() {
|
||||
return (seq->using_workarea)
|
||||
? seq->workarea_in
|
||||
: 0;
|
||||
}
|
||||
|
||||
long Viewer::get_seq_out() {
|
||||
return (seq->using_workarea && previous_playhead < seq->workarea_out)
|
||||
? seq->workarea_out
|
||||
: seq->getEndFrame();
|
||||
}
|
||||
|
||||
void Viewer::setup_ui() {
|
||||
@@ -637,19 +655,25 @@ void Viewer::update_playhead() {
|
||||
}
|
||||
|
||||
void Viewer::timer_update() {
|
||||
long previous_playhead = seq->playhead;
|
||||
previous_playhead = seq->playhead;
|
||||
|
||||
seq->playhead = qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
|
||||
update_parents();
|
||||
|
||||
long end_frame = (seq->using_workarea && previous_playhead < seq->workarea_out) ? seq->workarea_out : seq->getEndFrame();
|
||||
if ((!recording
|
||||
long end_frame = get_seq_out();
|
||||
if (!recording
|
||||
&& playing
|
||||
&& seq->playhead >= end_frame
|
||||
&& previous_playhead < end_frame)
|
||||
|| (recording && recording_start != recording_end && seq->playhead >= recording_end)) {
|
||||
pause();
|
||||
}
|
||||
&& previous_playhead < end_frame) {
|
||||
if (!config.pause_at_out_point && config.loop) {
|
||||
seek(get_seq_in());
|
||||
play();
|
||||
} else if (config.pause_at_out_point || !main_sequence) {
|
||||
pause();
|
||||
}
|
||||
} else if (recording && recording_start != recording_end && seq->playhead >= recording_end) {
|
||||
pause();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::recording_flasher_update() {
|
||||
|
||||
@@ -94,6 +94,9 @@ private:
|
||||
void set_zoom_value(double d);
|
||||
void set_sb_max();
|
||||
|
||||
long get_seq_in();
|
||||
long get_seq_out();
|
||||
|
||||
QIcon playIcon;
|
||||
|
||||
void setup_ui();
|
||||
@@ -112,6 +115,8 @@ private:
|
||||
|
||||
bool cue_recording_internal;
|
||||
QTimer recording_flasher;
|
||||
|
||||
long previous_playhead;
|
||||
};
|
||||
|
||||
#endif // VIEWER_H
|
||||
|
||||
Reference in New Issue
Block a user