From 4ec5ca887066d2b58a5ab707343178ff7827944e Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 4 Jan 2019 09:25:53 +1100 Subject: [PATCH 1/4] fixed crash when dragging the left side of a solid #238 --- ui/timelinewidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index 2e11b423e..f7ae50e5b 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -1272,9 +1272,9 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { Clip* c = NULL; if (g.clip != -1) c = sequence->clips.at(g.clip); - const FootageStream* ms = NULL; + const FootageStream* ms = NULL; if (g.clip != -1 && c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE) { - ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream); + ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream); } // validate ghosts for trimming @@ -1304,7 +1304,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { } // prevent clip_in from going below 0 - if (c->media->get_type() == MEDIA_TYPE_SEQUENCE + if ((c->media != NULL && c->media->get_type() == MEDIA_TYPE_SEQUENCE) || (ms != NULL && !ms->infinite_length)) { validator = g.old_clip_in + frame_diff; if (validator < 0) frame_diff -= validator; From b82817132c4767c3e7e643c0a8f3d0c71e8f7d71 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 4 Jan 2019 09:32:30 +1100 Subject: [PATCH 2/4] fixed #239 --- ui/timelinewidget.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index f7ae50e5b..c51530b22 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -1234,15 +1234,19 @@ void validate_transitions(Clip* c, int transition_type, long& frame_diff) { } void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { + int effective_tool = panel_timeline->tool; + if (panel_timeline->importing || panel_timeline->creating) effective_tool = TIMELINE_TOOL_POINTER; + int mouse_track = getTrackFromScreenPoint(mouse_pos.y()); long frame_diff = (lock_frame) ? 0 : panel_timeline->getTimelineFrameFromScreenPoint(mouse_pos.x()) - panel_timeline->drag_frame_start; - int track_diff = ((panel_timeline->tool == TIMELINE_TOOL_SLIDE || panel_timeline->transition_select != TA_NO_TRANSITION) && !panel_timeline->importing) ? 0 : mouse_track - panel_timeline->drag_track_start; + int track_diff = ((effective_tool == TIMELINE_TOOL_SLIDE || panel_timeline->transition_select != TA_NO_TRANSITION) && !panel_timeline->importing) ? 0 : mouse_track - panel_timeline->drag_track_start; long validator; long earliest_in_point = LONG_MAX; // first try to snap long fm; - if (panel_timeline->tool != TIMELINE_TOOL_SLIP) { + + if (effective_tool != TIMELINE_TOOL_SLIP) { // slipping doesn't move the clips so we don't bother snapping for it for (int i=0;ighosts.size();i++) { const Ghost& g = panel_timeline->ghosts.at(i); @@ -1263,7 +1267,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { } } - bool clips_are_movable = (panel_timeline->tool == TIMELINE_TOOL_POINTER || panel_timeline->tool == TIMELINE_TOOL_SLIDE || panel_timeline->importing); + bool clips_are_movable = (effective_tool == TIMELINE_TOOL_POINTER || effective_tool == TIMELINE_TOOL_SLIDE); // validate ghosts long temp_frame_diff = frame_diff; // cache to see if we change it (thus cancelling any snap) @@ -1280,8 +1284,8 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { // validate ghosts for trimming if (panel_timeline->creating) { // i feel like we might need something here but we haven't so far? - } else if (panel_timeline->tool == TIMELINE_TOOL_SLIP) { - if (c->media->get_type() == MEDIA_TYPE_SEQUENCE + } else if (effective_tool == TIMELINE_TOOL_SLIP) { + if ((c->media != NULL && c->media->get_type() == MEDIA_TYPE_SEQUENCE) || (ms != NULL && !ms->infinite_length)) { // prevent slip moving a clip below 0 clip_in validator = g.old_clip_in - frame_diff; @@ -1298,7 +1302,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { if (validator < 1) frame_diff -= (1 - validator); // prevent timeline in from going below 0 - if (panel_timeline->tool != TIMELINE_TOOL_RIPPLE) { + if (effective_tool != TIMELINE_TOOL_RIPPLE) { validator = g.old_in + frame_diff; if (validator < 0) frame_diff -= validator; } @@ -1349,7 +1353,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { } // ripple ops - if (panel_timeline->tool == TIMELINE_TOOL_RIPPLE) { + if (effective_tool == TIMELINE_TOOL_RIPPLE) { for (int j=0;jtool == TIMELINE_TOOL_TRANSITION) { + } else if (effective_tool == TIMELINE_TOOL_TRANSITION) { if (panel_timeline->transition_tool_post_clip == -1) { validate_transitions(c, panel_timeline->transition_tool_type, frame_diff); } else { @@ -1453,7 +1457,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { for (int i=0;ighosts.size();i++) { Ghost& g = panel_timeline->ghosts[i]; - if (panel_timeline->tool == TIMELINE_TOOL_SLIP) { + if (effective_tool == TIMELINE_TOOL_SLIP) { g.clip_in = g.old_clip_in - frame_diff; } else if (g.trimming) { long ghost_diff = frame_diff; @@ -1506,7 +1510,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { } else if (same_sign(g.old_track, panel_timeline->drag_track_start)) { g.track += track_diff; } - } else if (panel_timeline->tool == TIMELINE_TOOL_TRANSITION) { + } else if (effective_tool == TIMELINE_TOOL_TRANSITION) { if (panel_timeline->transition_tool_post_clip > -1) { g.in = g.old_in - frame_diff; g.out = g.old_out + frame_diff; @@ -1521,7 +1525,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { } // apply changes to selections - if (panel_timeline->tool != TIMELINE_TOOL_SLIP && !panel_timeline->importing && !panel_timeline->creating) { + if (effective_tool != TIMELINE_TOOL_SLIP && !panel_timeline->importing && !panel_timeline->creating) { for (int i=0;iselections.size();i++) { Selection& s = sequence->selections[i]; if (panel_timeline->trim_target > -1) { From fda1ba64daa6aadcbc9e176c3a9221abbf9a7318 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 4 Jan 2019 18:55:14 +1100 Subject: [PATCH 3/4] fix #242 --- main.cpp | 5 +++-- mainwindow.cpp | 31 ++++++++++++++++++++++++------- mainwindow.h | 8 ++++++++ 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/main.cpp b/main.cpp index 4286a3bd0..8dd018067 100644 --- a/main.cpp +++ b/main.cpp @@ -9,10 +9,11 @@ extern "C" { int main(int argc, char *argv[]) { // init ffmpeg subsystem av_register_all(); - avfilter_register_all(); + avfilter_register_all(); - QApplication a(argc, argv); + QApplication a(argc, argv); MainWindow w; + if (argc > 1) w.launch_with_project(argv[1]); w.showMaximized(); return a.exec(); diff --git a/mainwindow.cpp b/mainwindow.cpp index f84212d13..2d1f6b7b1 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -96,6 +96,8 @@ void MainWindow::setup_layout(bool reset) { MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { + enable_launch_with_project = false; + setup_debug(); mainWindow = this; @@ -211,8 +213,7 @@ MainWindow::MainWindow(QWidget *parent) : autorecovery_filename = data_dir + "/autorecovery.ove"; if (QFile::exists(autorecovery_filename)) { if (QMessageBox::question(NULL, "Auto-recovery", "Olive didn't close properly and an autorecovery file was detected. Would you like to open it?", QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { - updateTitle(autorecovery_filename); - panel_project->load_project(true); + open_project_worker(autorecovery_filename, true); } } autorecovery_timer.setInterval(60000); @@ -268,6 +269,11 @@ MainWindow::~MainWindow() { close_debug(); } +void MainWindow::launch_with_project(const char* s) { + project_url = s; + enable_launch_with_project = true; +} + void MainWindow::make_new_menu(QMenu *parent) { parent->addAction("&Project", this, SLOT(new_project()), QKeySequence("Ctrl+N")); parent->addSeparator(); @@ -810,6 +816,10 @@ void MainWindow::closeEvent(QCloseEvent *e) { void MainWindow::paintEvent(QPaintEvent *event) { QMainWindow::paintEvent(event); + if (enable_launch_with_project) { + QTimer::singleShot(10, this, SLOT(load_with_launch())); + enable_launch_with_project = false; + } #ifndef QT_DEBUG if (!demoNoticeShown) { DemoNotice* d = new DemoNotice(this); @@ -826,12 +836,20 @@ void MainWindow::clear_undo_stack() { void MainWindow::open_project() { QString fn = QFileDialog::getOpenFileName(this, "Open Project...", "", OLIVE_FILE_FILTER); if (!fn.isEmpty() && can_close_project()) { - updateTitle(fn); - panel_project->load_project(false); - undo_stack.clear(); + open_project_worker(fn, false); } } +void MainWindow::open_project_worker(const QString& fn, bool autorecovery) { + updateTitle(fn); + panel_project->load_project(autorecovery); + undo_stack.clear(); +} + +void MainWindow::load_with_launch() { + open_project_worker(project_url, false); +} + void MainWindow::reset_layout() { setup_layout(true); } @@ -1012,8 +1030,7 @@ void MainWindow::load_recent_project() { panel_project->save_recent_projects(); } } else if (can_close_project()) { - updateTitle(recent_url); - panel_project->load_project(false); + open_project_worker(recent_url, false); } } diff --git a/mainwindow.h b/mainwindow.h index 043b083b3..fc9f32e88 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -15,6 +15,8 @@ public: void updateTitle(const QString &url); ~MainWindow(); + void launch_with_project(const char *s); + void make_new_menu(QMenu* parent); void make_inout_menu(QMenu* parent); @@ -111,6 +113,10 @@ private slots: void toggle_panel_visibility(); void set_timecode_view(); + void open_project_worker(const QString &fn, bool autorecovery); + + void load_with_launch(); + private: void setup_layout(bool reset); bool can_close_project(); @@ -169,6 +175,8 @@ private: void set_bool_action_checked(QAction* a); void set_int_action_checked(QAction* a, const int& i); void set_button_action_checked(QAction* a); + + bool enable_launch_with_project; }; extern MainWindow* mainWindow; From cdd01db9abd651bb09ec89e1bc8f6258d8321762 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 4 Jan 2019 19:01:49 +1100 Subject: [PATCH 4/4] added #244 --- io/config.cpp | 247 ++++++++++++++++++++++---------------------- io/config.h | 47 ++++----- mainwindow.cpp | 5 + mainwindow.h | 1 + panels/timeline.cpp | 49 +++++---- 5 files changed, 185 insertions(+), 164 deletions(-) diff --git a/io/config.cpp b/io/config.cpp index 2ecb744ba..0e1c14028 100644 --- a/io/config.cpp +++ b/io/config.cpp @@ -9,88 +9,89 @@ Config config; Config::Config() - : saved_layout(false), + : saved_layout(false), show_track_lines(true), - scroll_zooms(false), - edit_tool_selects_links(false), - edit_tool_also_seeks(false), - select_also_seeks(false), + scroll_zooms(false), + edit_tool_selects_links(false), + edit_tool_also_seeks(false), + select_also_seeks(false), paste_seeks(true), - img_seq_formats("jpg|jpeg|bmp|tiff|tif|psd|png|tga|jp2|gif"), + img_seq_formats("jpg|jpeg|bmp|tiff|tif|psd|png|tga|jp2|gif"), rectified_waveforms(false), - default_transition_length(30), - timecode_view(TIMECODE_DROP), - show_title_safe_area(false), - use_custom_title_safe_ratio(false), + default_transition_length(30), + timecode_view(TIMECODE_DROP), + show_title_safe_area(false), + use_custom_title_safe_ratio(false), custom_title_safe_ratio(1), enable_drag_files_to_timeline(true), autoscale_by_default(false), recording_mode(2), - enable_seek_to_import(false), - enable_audio_scrubbing(true), - drop_on_media_to_replace(true), - autoscroll(AUTOSCROLL_PAGE_SCROLL), - audio_rate(48000), - fast_seeking(false), - hover_focus(false), - project_view_type(PROJECT_VIEW_TREE) + enable_seek_to_import(false), + enable_audio_scrubbing(true), + drop_on_media_to_replace(true), + autoscroll(AUTOSCROLL_PAGE_SCROLL), + audio_rate(48000), + fast_seeking(false), + hover_focus(false), + project_view_type(PROJECT_VIEW_TREE), + set_name_with_marker(true) {} void Config::load(QString path) { - QFile f(path); - if (f.exists() && f.open(QIODevice::ReadOnly)) { - QXmlStreamReader stream(&f); + QFile f(path); + if (f.exists() && f.open(QIODevice::ReadOnly)) { + QXmlStreamReader stream(&f); - while (!stream.atEnd()) { - stream.readNext(); - if (stream.isStartElement()) { - if (stream.name() == "SavedLayout") { - stream.readNext(); - saved_layout = (stream.text() == "1"); - } else if (stream.name() == "ShowTrackLines") { - stream.readNext(); - show_track_lines = (stream.text() == "1"); - } else if (stream.name() == "ScrollZooms") { - stream.readNext(); - scroll_zooms = (stream.text() == "1"); - } else if (stream.name() == "EditToolSelectsLinks") { - stream.readNext(); - edit_tool_selects_links = (stream.text() == "1"); - } else if (stream.name() == "EditToolAlsoSeeks") { - stream.readNext(); - edit_tool_also_seeks = (stream.text() == "1"); - } else if (stream.name() == "SelectAlsoSeeks") { - stream.readNext(); - select_also_seeks = (stream.text() == "1"); - } else if (stream.name() == "PasteSeeks") { - stream.readNext(); - paste_seeks = (stream.text() == "1"); - } else if (stream.name() == "ImageSequenceFormats") { - stream.readNext(); - img_seq_formats = stream.text().toString(); + while (!stream.atEnd()) { + stream.readNext(); + if (stream.isStartElement()) { + if (stream.name() == "SavedLayout") { + stream.readNext(); + saved_layout = (stream.text() == "1"); + } else if (stream.name() == "ShowTrackLines") { + stream.readNext(); + show_track_lines = (stream.text() == "1"); + } else if (stream.name() == "ScrollZooms") { + stream.readNext(); + scroll_zooms = (stream.text() == "1"); + } else if (stream.name() == "EditToolSelectsLinks") { + stream.readNext(); + edit_tool_selects_links = (stream.text() == "1"); + } else if (stream.name() == "EditToolAlsoSeeks") { + stream.readNext(); + edit_tool_also_seeks = (stream.text() == "1"); + } else if (stream.name() == "SelectAlsoSeeks") { + stream.readNext(); + select_also_seeks = (stream.text() == "1"); + } else if (stream.name() == "PasteSeeks") { + stream.readNext(); + paste_seeks = (stream.text() == "1"); + } else if (stream.name() == "ImageSequenceFormats") { + stream.readNext(); + img_seq_formats = stream.text().toString(); } else if (stream.name() == "RectifiedWaveforms") { - stream.readNext(); + stream.readNext(); rectified_waveforms = (stream.text() == "1"); } else if (stream.name() == "DefaultTransitionLength") { - stream.readNext(); - default_transition_length = stream.text().toInt(); - } else if (stream.name() == "TimecodeView") { - stream.readNext(); - timecode_view = stream.text().toInt(); - }else if (stream.name() == "ShowTitleSafeArea") { - stream.readNext(); - show_title_safe_area = (stream.text() == "1"); - } else if (stream.name() == "UseCustomTitleSafeRatio") { - stream.readNext(); - use_custom_title_safe_ratio = (stream.text() == "1"); - } else if (stream.name() == "CustomTitleSafeRatio") { - stream.readNext(); - custom_title_safe_ratio = stream.text().toDouble(); + stream.readNext(); + default_transition_length = stream.text().toInt(); + } else if (stream.name() == "TimecodeView") { + stream.readNext(); + timecode_view = stream.text().toInt(); + } else if (stream.name() == "ShowTitleSafeArea") { + stream.readNext(); + show_title_safe_area = (stream.text() == "1"); + } else if (stream.name() == "UseCustomTitleSafeRatio") { + stream.readNext(); + use_custom_title_safe_ratio = (stream.text() == "1"); + } else if (stream.name() == "CustomTitleSafeRatio") { + stream.readNext(); + custom_title_safe_ratio = stream.text().toDouble(); } else if (stream.name() == "EnableDragFilesToTimeline") { stream.readNext(); enable_drag_files_to_timeline = (stream.text() == "1");; - } else if (stream.name() == "AutoscaleByDefault") { - stream.readNext(); + } else if (stream.name() == "AutoscaleByDefault") { + stream.readNext(); autoscale_by_default = (stream.text() == "1"); } else if (stream.name() == "RecordingMode") { stream.readNext(); @@ -98,78 +99,82 @@ void Config::load(QString path) { } else if (stream.name() == "EnableSeekToImport") { stream.readNext(); enable_seek_to_import = (stream.text() == "1"); - } else if (stream.name() == "AudioScrubbing") { - stream.readNext(); - enable_audio_scrubbing = (stream.text() == "1"); - } else if (stream.name() == "DropFileOnMediaToReplace") { - stream.readNext(); - drop_on_media_to_replace = (stream.text() == "1"); - } else if (stream.name() == "Autoscroll") { - stream.readNext(); - autoscroll = stream.text().toInt(); - } else if (stream.name() == "AudioRate") { - stream.readNext(); - audio_rate = stream.text().toInt(); - } else if (stream.name() == "FastSeeking") { - stream.readNext(); - fast_seeking = (stream.text() == "1"); - } else if (stream.name() == "HoverFocus") { - stream.readNext(); - hover_focus = (stream.text() == "1"); - } else if (stream.name() == "ProjectViewType") { - stream.readNext(); - project_view_type = stream.text().toInt(); - } - } - } - if (stream.hasError()) { + } else if (stream.name() == "AudioScrubbing") { + stream.readNext(); + enable_audio_scrubbing = (stream.text() == "1"); + } else if (stream.name() == "DropFileOnMediaToReplace") { + stream.readNext(); + drop_on_media_to_replace = (stream.text() == "1"); + } else if (stream.name() == "Autoscroll") { + stream.readNext(); + autoscroll = stream.text().toInt(); + } else if (stream.name() == "AudioRate") { + stream.readNext(); + audio_rate = stream.text().toInt(); + } else if (stream.name() == "FastSeeking") { + stream.readNext(); + fast_seeking = (stream.text() == "1"); + } else if (stream.name() == "HoverFocus") { + stream.readNext(); + hover_focus = (stream.text() == "1"); + } else if (stream.name() == "ProjectViewType") { + stream.readNext(); + project_view_type = stream.text().toInt(); + } else if (stream.name() == "SetNameWithMarker") { + stream.readNext(); + set_name_with_marker = (stream.text() == "1"); + } + } + } + if (stream.hasError()) { dout << "[ERROR] Error parsing config XML." << stream.errorString(); - } + } - f.close(); + f.close(); } } void Config::save(QString path) { - QFile f(path); - if (!f.open(QIODevice::WriteOnly)) { + QFile f(path); + if (!f.open(QIODevice::WriteOnly)) { dout << "[ERROR] Could not save configuration"; - return; - } + return; + } - QXmlStreamWriter stream(&f); - stream.setAutoFormatting(true); - stream.writeStartDocument(); // doc - stream.writeStartElement("Configuration"); // configuration + QXmlStreamWriter stream(&f); + stream.setAutoFormatting(true); + stream.writeStartDocument(); // doc + stream.writeStartElement("Configuration"); // configuration stream.writeTextElement("Version", QString::number(SAVE_VERSION)); - stream.writeTextElement("SavedLayout", QString::number(saved_layout)); - stream.writeTextElement("ShowTrackLines", QString::number(show_track_lines)); - stream.writeTextElement("ScrollZooms", QString::number(scroll_zooms)); - stream.writeTextElement("EditToolSelectsLinks", QString::number(edit_tool_selects_links)); - stream.writeTextElement("EditToolAlsoSeeks", QString::number(edit_tool_also_seeks)); - stream.writeTextElement("SelectAlsoSeeks", QString::number(select_also_seeks)); - stream.writeTextElement("PasteSeeks", QString::number(paste_seeks)); - stream.writeTextElement("ImageSequenceFormats", img_seq_formats); + stream.writeTextElement("SavedLayout", QString::number(saved_layout)); + stream.writeTextElement("ShowTrackLines", QString::number(show_track_lines)); + stream.writeTextElement("ScrollZooms", QString::number(scroll_zooms)); + stream.writeTextElement("EditToolSelectsLinks", QString::number(edit_tool_selects_links)); + stream.writeTextElement("EditToolAlsoSeeks", QString::number(edit_tool_also_seeks)); + stream.writeTextElement("SelectAlsoSeeks", QString::number(select_also_seeks)); + stream.writeTextElement("PasteSeeks", QString::number(paste_seeks)); + stream.writeTextElement("ImageSequenceFormats", img_seq_formats); stream.writeTextElement("RectifiedWaveforms", QString::number(rectified_waveforms)); stream.writeTextElement("DefaultTransitionLength", QString::number(default_transition_length)); - stream.writeTextElement("TimecodeView", QString::number(timecode_view)); - stream.writeTextElement("ShowTitleSafeArea", QString::number(show_title_safe_area)); - stream.writeTextElement("UseCustomTitleSafeRatio", QString::number(use_custom_title_safe_ratio)); - stream.writeTextElement("CustomTitleSafeRatio", QString::number(custom_title_safe_ratio)); + stream.writeTextElement("TimecodeView", QString::number(timecode_view)); + stream.writeTextElement("ShowTitleSafeArea", QString::number(show_title_safe_area)); + stream.writeTextElement("UseCustomTitleSafeRatio", QString::number(use_custom_title_safe_ratio)); + stream.writeTextElement("CustomTitleSafeRatio", QString::number(custom_title_safe_ratio)); stream.writeTextElement("EnableDragFilesToTimeline", QString::number(enable_drag_files_to_timeline)); - stream.writeTextElement("AutoscaleByDefault", QString::number(autoscale_by_default)); + stream.writeTextElement("AutoscaleByDefault", QString::number(autoscale_by_default)); stream.writeTextElement("RecordingMode", QString::number(recording_mode)); stream.writeTextElement("EnableSeekToImport", QString::number(enable_seek_to_import)); - stream.writeTextElement("AudioScrubbing", QString::number(enable_audio_scrubbing)); - stream.writeTextElement("DropFileOnMediaToReplace", QString::number(drop_on_media_to_replace)); - stream.writeTextElement("Autoscroll", QString::number(autoscroll)); - stream.writeTextElement("AudioRate", QString::number(audio_rate)); - stream.writeTextElement("FastSeeking", QString::number(fast_seeking)); - stream.writeTextElement("HoverFocus", QString::number(hover_focus)); - stream.writeTextElement("ProjectViewType", QString::number(project_view_type)); + stream.writeTextElement("AudioScrubbing", QString::number(enable_audio_scrubbing)); + stream.writeTextElement("DropFileOnMediaToReplace", QString::number(drop_on_media_to_replace)); + stream.writeTextElement("Autoscroll", QString::number(autoscroll)); + stream.writeTextElement("AudioRate", QString::number(audio_rate)); + stream.writeTextElement("FastSeeking", QString::number(fast_seeking)); + stream.writeTextElement("HoverFocus", QString::number(hover_focus)); + stream.writeTextElement("ProjectViewType", QString::number(project_view_type)); + stream.writeTextElement("SetNameWithMarker", QString::number(set_name_with_marker)); stream.writeEndElement(); // configuration - stream.writeEndDocument(); // doc + stream.writeEndDocument(); // doc f.close(); } diff --git a/io/config.h b/io/config.h index 4972c9dd3..ea91f7f99 100644 --- a/io/config.h +++ b/io/config.h @@ -22,35 +22,36 @@ #define PROJECT_VIEW_ICON 1 struct Config { - Config(); - bool saved_layout; - bool show_track_lines; - bool scroll_zooms; - bool edit_tool_selects_links; - bool edit_tool_also_seeks; - bool select_also_seeks; - bool paste_seeks; - QString img_seq_formats; + Config(); + bool saved_layout; + bool show_track_lines; + bool scroll_zooms; + bool edit_tool_selects_links; + bool edit_tool_also_seeks; + bool select_also_seeks; + bool paste_seeks; + QString img_seq_formats; bool rectified_waveforms; int default_transition_length; - int timecode_view; - bool show_title_safe_area; - bool use_custom_title_safe_ratio; - double custom_title_safe_ratio; + int timecode_view; + bool show_title_safe_area; + bool use_custom_title_safe_ratio; + double custom_title_safe_ratio; bool enable_drag_files_to_timeline; - bool autoscale_by_default; + bool autoscale_by_default; int recording_mode; bool enable_seek_to_import; - bool enable_audio_scrubbing; - bool drop_on_media_to_replace; - int autoscroll; - int audio_rate; - bool fast_seeking; - bool hover_focus; - int project_view_type; + bool enable_audio_scrubbing; + bool drop_on_media_to_replace; + int autoscroll; + int audio_rate; + bool fast_seeking; + bool hover_focus; + int project_view_type; + bool set_name_with_marker; - void load(QString path); - void save(QString path); + void load(QString path); + void save(QString path); }; extern Config config; diff --git a/mainwindow.cpp b/mainwindow.cpp index 2d1f6b7b1..5ea809050 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -755,6 +755,10 @@ void MainWindow::setup_menus() { enable_hover_focus->setCheckable(true); enable_hover_focus->setData(reinterpret_cast(&config.hover_focus)); + set_name_and_marker = tools_menu->addAction("Ask For Name When Setting Marker", this, SLOT(toggle_bool_action())); + set_name_and_marker->setCheckable(true); + set_name_and_marker->setData(reinterpret_cast(&config.set_name_with_marker)); + tools_menu->addSeparator(); no_autoscroll = tools_menu->addAction("No Auto-Scroll", this, SLOT(set_autoscroll())); @@ -973,6 +977,7 @@ void MainWindow::toolMenu_About_To_Be_Shown() { set_bool_action_checked(enable_audio_scrubbing); 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_int_action_checked(no_autoscroll, config.autoscroll); set_int_action_checked(page_autoscroll, config.autoscroll); diff --git a/mainwindow.h b/mainwindow.h index fc9f32e88..ed04b9e0c 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -167,6 +167,7 @@ private: QAction* enable_audio_scrubbing; QAction* enable_drop_on_media_to_replace; QAction* enable_hover_focus; + QAction* set_name_and_marker; // edit menu actions QAction* undo_action; diff --git a/panels/timeline.cpp b/panels/timeline.cpp index 2f450ae56..82ec7ac02 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -182,7 +182,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector can_import = m->ready; if (m->using_inout) { double source_fr = 30; - if (m->video_tracks.size() > 0 && !qIsNull(m->video_tracks.at(0).video_frame_rate)) source_fr = m->video_tracks.at(0).video_frame_rate; + if (m->video_tracks.size() > 0 && !qIsNull(m->video_tracks.at(0).video_frame_rate)) source_fr = m->video_tracks.at(0).video_frame_rate; default_clip_in = refactor_frame_number(m->in, source_fr, seq->frame_rate); default_clip_out = refactor_frame_number(m->out, source_fr, seq->frame_rate); } @@ -214,7 +214,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector switch (medium->get_type()) { case MEDIA_TYPE_FOOTAGE: // is video source a still image? - if (m->video_tracks.size() > 0 && m->video_tracks.at(0).infinite_length && m->audio_tracks.size() == 0) { + if (m->video_tracks.size() > 0 && m->video_tracks.at(0).infinite_length && m->audio_tracks.size() == 0) { g.out = g.in + 100; } else { long length = m->get_length_in_frames(seq->frame_rate); @@ -225,20 +225,20 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector } for (int j=0;jaudio_tracks.size();j++) { - if (m->audio_tracks.at(j).enabled) { - g.track = j; - g.media_stream = m->audio_tracks.at(j).file_index; - ghosts.append(g); - audio_ghosts = true; - } + if (m->audio_tracks.at(j).enabled) { + g.track = j; + g.media_stream = m->audio_tracks.at(j).file_index; + ghosts.append(g); + audio_ghosts = true; + } } for (int j=0;jvideo_tracks.size();j++) { - if (m->video_tracks.at(j).enabled) { - g.track = -1-j; - g.media_stream = m->video_tracks.at(j).file_index; - ghosts.append(g); - video_ghosts = true; - } + if (m->video_tracks.at(j).enabled) { + g.track = -1-j; + g.media_stream = m->video_tracks.at(j).file_index; + ghosts.append(g); + video_ghosts = true; + } } break; case MEDIA_TYPE_SEQUENCE: @@ -1359,12 +1359,21 @@ bool Timeline::snap_to_timeline(long* l, bool use_playhead, bool use_markers, bo } void Timeline::set_marker() { - QInputDialog d(this); - d.setWindowTitle("Set Marker"); - d.setLabelText("Set marker name:"); - d.setInputMode(QInputDialog::TextInput); - if (d.exec() == QDialog::Accepted) { - undo_stack.push(new AddMarkerAction(sequence, sequence->playhead, d.textValue())); + bool add_marker = !config.set_name_with_marker; + QString marker_name; + + if (!add_marker) { + QInputDialog d(this); + d.setWindowTitle("Set Marker"); + d.setLabelText("Set marker name:"); + d.setInputMode(QInputDialog::TextInput); + add_marker = (d.exec() == QDialog::Accepted); + marker_name = d.textValue(); + } + + + if (add_marker) { + undo_stack.push(new AddMarkerAction(sequence, sequence->playhead, marker_name)); } }