timeline minor refactor

This commit is contained in:
itsmattkc
2019-02-17 22:32:18 -08:00
parent 5cf5321c0f
commit a63b4fbe52
10 changed files with 944 additions and 779 deletions
+240 -240
View File
@@ -33,258 +33,258 @@ Config olive::CurrentConfig;
RuntimeConfig olive::CurrentRuntimeConfig; RuntimeConfig olive::CurrentRuntimeConfig;
Config::Config() Config::Config()
: saved_layout(false), : saved_layout(false),
show_track_lines(true), show_track_lines(true),
scroll_zooms(false), scroll_zooms(false),
edit_tool_selects_links(false), edit_tool_selects_links(false),
edit_tool_also_seeks(false), edit_tool_also_seeks(false),
select_also_seeks(false), select_also_seeks(false),
paste_seeks(true), 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), rectified_waveforms(false),
default_transition_length(30), default_transition_length(30),
timecode_view(TIMECODE_DROP), timecode_view(TIMECODE_DROP),
show_title_safe_area(false), show_title_safe_area(false),
use_custom_title_safe_ratio(false), use_custom_title_safe_ratio(false),
custom_title_safe_ratio(1), custom_title_safe_ratio(1),
enable_drag_files_to_timeline(true), enable_drag_files_to_timeline(true),
autoscale_by_default(false), autoscale_by_default(false),
recording_mode(2), recording_mode(2),
enable_seek_to_import(false), enable_seek_to_import(false),
enable_audio_scrubbing(true), enable_audio_scrubbing(true),
drop_on_media_to_replace(true), drop_on_media_to_replace(true),
autoscroll(AUTOSCROLL_PAGE_SCROLL), autoscroll(AUTOSCROLL_PAGE_SCROLL),
audio_rate(48000), audio_rate(48000),
fast_seeking(false), fast_seeking(false),
hover_focus(false), hover_focus(false),
project_view_type(PROJECT_VIEW_TREE), project_view_type(PROJECT_VIEW_TREE),
set_name_with_marker(true), set_name_with_marker(true),
show_project_toolbar(false), show_project_toolbar(false),
previous_queue_size(3), previous_queue_size(3),
previous_queue_type(FRAME_QUEUE_TYPE_FRAMES), previous_queue_type(FRAME_QUEUE_TYPE_FRAMES),
upcoming_queue_size(0.5), upcoming_queue_size(0.5),
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS), upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
loop(false), loop(false),
seek_also_selects(false), seek_also_selects(false),
effect_textbox_lines(3), effect_textbox_lines(3),
use_software_fallback(false), use_software_fallback(false),
center_timeline_timecodes(true), center_timeline_timecodes(true),
waveform_resolution(64), waveform_resolution(64),
thumbnail_resolution(120), thumbnail_resolution(120),
add_default_effects_to_clips(true) add_default_effects_to_clips(true)
{} {}
void Config::load(QString path) { void Config::load(QString path) {
QFile f(path); QFile f(path);
if (f.exists() && f.open(QIODevice::ReadOnly)) { if (f.exists() && f.open(QIODevice::ReadOnly)) {
QXmlStreamReader stream(&f); QXmlStreamReader stream(&f);
while (!stream.atEnd()) { while (!stream.atEnd()) {
stream.readNext(); stream.readNext();
if (stream.isStartElement()) { if (stream.isStartElement()) {
if (stream.name() == "SavedLayout") { if (stream.name() == "SavedLayout") {
stream.readNext(); stream.readNext();
saved_layout = (stream.text() == "1"); saved_layout = (stream.text() == "1");
} else if (stream.name() == "ShowTrackLines") { } else if (stream.name() == "ShowTrackLines") {
stream.readNext(); stream.readNext();
show_track_lines = (stream.text() == "1"); show_track_lines = (stream.text() == "1");
} else if (stream.name() == "ScrollZooms") { } else if (stream.name() == "ScrollZooms") {
stream.readNext(); stream.readNext();
scroll_zooms = (stream.text() == "1"); scroll_zooms = (stream.text() == "1");
} else if (stream.name() == "EditToolSelectsLinks") { } else if (stream.name() == "EditToolSelectsLinks") {
stream.readNext(); stream.readNext();
edit_tool_selects_links = (stream.text() == "1"); edit_tool_selects_links = (stream.text() == "1");
} else if (stream.name() == "EditToolAlsoSeeks") { } else if (stream.name() == "EditToolAlsoSeeks") {
stream.readNext(); stream.readNext();
edit_tool_also_seeks = (stream.text() == "1"); edit_tool_also_seeks = (stream.text() == "1");
} else if (stream.name() == "SelectAlsoSeeks") { } else if (stream.name() == "SelectAlsoSeeks") {
stream.readNext(); stream.readNext();
select_also_seeks = (stream.text() == "1"); select_also_seeks = (stream.text() == "1");
} else if (stream.name() == "PasteSeeks") { } else if (stream.name() == "PasteSeeks") {
stream.readNext(); stream.readNext();
paste_seeks = (stream.text() == "1"); paste_seeks = (stream.text() == "1");
} else if (stream.name() == "ImageSequenceFormats") { } else if (stream.name() == "ImageSequenceFormats") {
stream.readNext(); stream.readNext();
img_seq_formats = stream.text().toString(); img_seq_formats = stream.text().toString();
} else if (stream.name() == "RectifiedWaveforms") { } else if (stream.name() == "RectifiedWaveforms") {
stream.readNext(); stream.readNext();
rectified_waveforms = (stream.text() == "1"); rectified_waveforms = (stream.text() == "1");
} else if (stream.name() == "DefaultTransitionLength") { } else if (stream.name() == "DefaultTransitionLength") {
stream.readNext(); stream.readNext();
default_transition_length = stream.text().toInt(); default_transition_length = stream.text().toInt();
} else if (stream.name() == "TimecodeView") { } else if (stream.name() == "TimecodeView") {
stream.readNext(); stream.readNext();
timecode_view = stream.text().toInt(); timecode_view = stream.text().toInt();
} else if (stream.name() == "ShowTitleSafeArea") { } else if (stream.name() == "ShowTitleSafeArea") {
stream.readNext(); stream.readNext();
show_title_safe_area = (stream.text() == "1"); show_title_safe_area = (stream.text() == "1");
} else if (stream.name() == "UseCustomTitleSafeRatio") { } else if (stream.name() == "UseCustomTitleSafeRatio") {
stream.readNext(); stream.readNext();
use_custom_title_safe_ratio = (stream.text() == "1"); use_custom_title_safe_ratio = (stream.text() == "1");
} else if (stream.name() == "CustomTitleSafeRatio") { } else if (stream.name() == "CustomTitleSafeRatio") {
stream.readNext(); stream.readNext();
custom_title_safe_ratio = stream.text().toDouble(); custom_title_safe_ratio = stream.text().toDouble();
} else if (stream.name() == "EnableDragFilesToTimeline") { } else if (stream.name() == "EnableDragFilesToTimeline") {
stream.readNext(); stream.readNext();
enable_drag_files_to_timeline = (stream.text() == "1");; enable_drag_files_to_timeline = (stream.text() == "1");;
} else if (stream.name() == "AutoscaleByDefault") { } else if (stream.name() == "AutoscaleByDefault") {
stream.readNext(); stream.readNext();
autoscale_by_default = (stream.text() == "1"); autoscale_by_default = (stream.text() == "1");
} else if (stream.name() == "RecordingMode") { } else if (stream.name() == "RecordingMode") {
stream.readNext(); stream.readNext();
recording_mode = stream.text().toInt(); recording_mode = stream.text().toInt();
} else if (stream.name() == "EnableSeekToImport") { } else if (stream.name() == "EnableSeekToImport") {
stream.readNext(); stream.readNext();
enable_seek_to_import = (stream.text() == "1"); enable_seek_to_import = (stream.text() == "1");
} else if (stream.name() == "AudioScrubbing") { } else if (stream.name() == "AudioScrubbing") {
stream.readNext(); stream.readNext();
enable_audio_scrubbing = (stream.text() == "1"); enable_audio_scrubbing = (stream.text() == "1");
} else if (stream.name() == "DropFileOnMediaToReplace") { } else if (stream.name() == "DropFileOnMediaToReplace") {
stream.readNext(); stream.readNext();
drop_on_media_to_replace = (stream.text() == "1"); drop_on_media_to_replace = (stream.text() == "1");
} else if (stream.name() == "Autoscroll") { } else if (stream.name() == "Autoscroll") {
stream.readNext(); stream.readNext();
autoscroll = stream.text().toInt(); autoscroll = stream.text().toInt();
} else if (stream.name() == "AudioRate") { } else if (stream.name() == "AudioRate") {
stream.readNext(); stream.readNext();
audio_rate = stream.text().toInt(); audio_rate = stream.text().toInt();
} else if (stream.name() == "FastSeeking") { } else if (stream.name() == "FastSeeking") {
stream.readNext(); stream.readNext();
fast_seeking = (stream.text() == "1"); fast_seeking = (stream.text() == "1");
} else if (stream.name() == "HoverFocus") { } else if (stream.name() == "HoverFocus") {
stream.readNext(); stream.readNext();
hover_focus = (stream.text() == "1"); hover_focus = (stream.text() == "1");
} else if (stream.name() == "ProjectViewType") { } else if (stream.name() == "ProjectViewType") {
stream.readNext(); stream.readNext();
project_view_type = stream.text().toInt(); project_view_type = stream.text().toInt();
} else if (stream.name() == "SetNameWithMarker") { } else if (stream.name() == "SetNameWithMarker") {
stream.readNext(); stream.readNext();
set_name_with_marker = (stream.text() == "1"); set_name_with_marker = (stream.text() == "1");
} else if (stream.name() == "ShowProjectToolbar") { } else if (stream.name() == "ShowProjectToolbar") {
stream.readNext(); stream.readNext();
show_project_toolbar = (stream.text() == "1"); show_project_toolbar = (stream.text() == "1");
} else if (stream.name() == "PreviousFrameQueueSize") { } else if (stream.name() == "PreviousFrameQueueSize") {
stream.readNext(); stream.readNext();
previous_queue_size = stream.text().toDouble(); previous_queue_size = stream.text().toDouble();
} else if (stream.name() == "PreviousFrameQueueType") { } else if (stream.name() == "PreviousFrameQueueType") {
stream.readNext(); stream.readNext();
previous_queue_type = stream.text().toInt(); previous_queue_type = stream.text().toInt();
} else if (stream.name() == "UpcomingFrameQueueSize") { } else if (stream.name() == "UpcomingFrameQueueSize") {
stream.readNext(); stream.readNext();
upcoming_queue_size = stream.text().toDouble(); upcoming_queue_size = stream.text().toDouble();
} else if (stream.name() == "UpcomingFrameQueueType") { } else if (stream.name() == "UpcomingFrameQueueType") {
stream.readNext(); stream.readNext();
upcoming_queue_type = stream.text().toInt(); upcoming_queue_type = stream.text().toInt();
} else if (stream.name() == "Loop") { } else if (stream.name() == "Loop") {
stream.readNext(); stream.readNext();
loop = (stream.text() == "1"); loop = (stream.text() == "1");
} else if (stream.name() == "SeekAlsoSelects") { } else if (stream.name() == "SeekAlsoSelects") {
stream.readNext(); stream.readNext();
seek_also_selects = (stream.text() == "1"); seek_also_selects = (stream.text() == "1");
} else if (stream.name() == "CSSPath") { } else if (stream.name() == "CSSPath") {
stream.readNext(); stream.readNext();
css_path = stream.text().toString(); css_path = stream.text().toString();
} else if (stream.name() == "EffectTextboxLines") { } else if (stream.name() == "EffectTextboxLines") {
stream.readNext(); stream.readNext();
effect_textbox_lines = stream.text().toInt(); effect_textbox_lines = stream.text().toInt();
} else if (stream.name() == "UseSoftwareFallback") { } else if (stream.name() == "UseSoftwareFallback") {
stream.readNext(); stream.readNext();
use_software_fallback = (stream.text() == "1"); use_software_fallback = (stream.text() == "1");
} else if (stream.name() == "CenterTimelineTimecodes") { } else if (stream.name() == "CenterTimelineTimecodes") {
stream.readNext(); stream.readNext();
center_timeline_timecodes = (stream.text() == "1"); center_timeline_timecodes = (stream.text() == "1");
} else if (stream.name() == "PreferredAudioOutput") { } else if (stream.name() == "PreferredAudioOutput") {
stream.readNext(); stream.readNext();
preferred_audio_output = stream.text().toString(); preferred_audio_output = stream.text().toString();
} else if (stream.name() == "PreferredAudioInput") { } else if (stream.name() == "PreferredAudioInput") {
stream.readNext(); stream.readNext();
preferred_audio_input = stream.text().toString(); preferred_audio_input = stream.text().toString();
} else if (stream.name() == "LanguageFile") { } else if (stream.name() == "LanguageFile") {
stream.readNext(); stream.readNext();
language_file = stream.text().toString(); language_file = stream.text().toString();
} else if (stream.name() == "ThumbnailResolution") { } else if (stream.name() == "ThumbnailResolution") {
stream.readNext(); stream.readNext();
thumbnail_resolution = stream.text().toInt(); thumbnail_resolution = stream.text().toInt();
} else if (stream.name() == "WaveformResolution") { } else if (stream.name() == "WaveformResolution") {
stream.readNext(); stream.readNext();
waveform_resolution = stream.text().toInt(); waveform_resolution = stream.text().toInt();
} else if (stream.name() == "AddDefaultEffectsToClips") { } else if (stream.name() == "AddDefaultEffectsToClips") {
stream.readNext(); stream.readNext();
add_default_effects_to_clips = (stream.text() == "1"); add_default_effects_to_clips = (stream.text() == "1");
} }
} }
} }
if (stream.hasError()) { if (stream.hasError()) {
qCritical() << "Error parsing config XML." << stream.errorString(); qCritical() << "Error parsing config XML." << stream.errorString();
} }
f.close(); f.close();
} }
} }
void Config::save(QString path) { void Config::save(QString path) {
QFile f(path); QFile f(path);
if (!f.open(QIODevice::WriteOnly)) { if (!f.open(QIODevice::WriteOnly)) {
qCritical() << "Could not save configuration"; qCritical() << "Could not save configuration";
return; return;
} }
QXmlStreamWriter stream(&f); QXmlStreamWriter stream(&f);
stream.setAutoFormatting(true); stream.setAutoFormatting(true);
stream.writeStartDocument(); // doc stream.writeStartDocument(); // doc
stream.writeStartElement("Configuration"); // configuration stream.writeStartElement("Configuration"); // configuration
stream.writeTextElement("Version", QString::number(SAVE_VERSION)); stream.writeTextElement("Version", QString::number(SAVE_VERSION));
stream.writeTextElement("SavedLayout", QString::number(saved_layout)); stream.writeTextElement("SavedLayout", QString::number(saved_layout));
stream.writeTextElement("ShowTrackLines", QString::number(show_track_lines)); stream.writeTextElement("ShowTrackLines", QString::number(show_track_lines));
stream.writeTextElement("ScrollZooms", QString::number(scroll_zooms)); stream.writeTextElement("ScrollZooms", QString::number(scroll_zooms));
stream.writeTextElement("EditToolSelectsLinks", QString::number(edit_tool_selects_links)); stream.writeTextElement("EditToolSelectsLinks", QString::number(edit_tool_selects_links));
stream.writeTextElement("EditToolAlsoSeeks", QString::number(edit_tool_also_seeks)); stream.writeTextElement("EditToolAlsoSeeks", QString::number(edit_tool_also_seeks));
stream.writeTextElement("SelectAlsoSeeks", QString::number(select_also_seeks)); stream.writeTextElement("SelectAlsoSeeks", QString::number(select_also_seeks));
stream.writeTextElement("PasteSeeks", QString::number(paste_seeks)); stream.writeTextElement("PasteSeeks", QString::number(paste_seeks));
stream.writeTextElement("ImageSequenceFormats", img_seq_formats); stream.writeTextElement("ImageSequenceFormats", img_seq_formats);
stream.writeTextElement("RectifiedWaveforms", QString::number(rectified_waveforms)); stream.writeTextElement("RectifiedWaveforms", QString::number(rectified_waveforms));
stream.writeTextElement("DefaultTransitionLength", QString::number(default_transition_length)); stream.writeTextElement("DefaultTransitionLength", QString::number(default_transition_length));
stream.writeTextElement("TimecodeView", QString::number(timecode_view)); stream.writeTextElement("TimecodeView", QString::number(timecode_view));
stream.writeTextElement("ShowTitleSafeArea", QString::number(show_title_safe_area)); stream.writeTextElement("ShowTitleSafeArea", QString::number(show_title_safe_area));
stream.writeTextElement("UseCustomTitleSafeRatio", QString::number(use_custom_title_safe_ratio)); stream.writeTextElement("UseCustomTitleSafeRatio", QString::number(use_custom_title_safe_ratio));
stream.writeTextElement("CustomTitleSafeRatio", QString::number(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("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("RecordingMode", QString::number(recording_mode));
stream.writeTextElement("EnableSeekToImport", QString::number(enable_seek_to_import)); stream.writeTextElement("EnableSeekToImport", QString::number(enable_seek_to_import));
stream.writeTextElement("AudioScrubbing", QString::number(enable_audio_scrubbing)); stream.writeTextElement("AudioScrubbing", QString::number(enable_audio_scrubbing));
stream.writeTextElement("DropFileOnMediaToReplace", QString::number(drop_on_media_to_replace)); stream.writeTextElement("DropFileOnMediaToReplace", QString::number(drop_on_media_to_replace));
stream.writeTextElement("Autoscroll", QString::number(autoscroll)); stream.writeTextElement("Autoscroll", QString::number(autoscroll));
stream.writeTextElement("AudioRate", QString::number(audio_rate)); stream.writeTextElement("AudioRate", QString::number(audio_rate));
stream.writeTextElement("FastSeeking", QString::number(fast_seeking)); stream.writeTextElement("FastSeeking", QString::number(fast_seeking));
stream.writeTextElement("HoverFocus", QString::number(hover_focus)); stream.writeTextElement("HoverFocus", QString::number(hover_focus));
stream.writeTextElement("ProjectViewType", QString::number(project_view_type)); stream.writeTextElement("ProjectViewType", QString::number(project_view_type));
stream.writeTextElement("SetNameWithMarker", QString::number(set_name_with_marker)); stream.writeTextElement("SetNameWithMarker", QString::number(set_name_with_marker));
stream.writeTextElement("ShowProjectToolbar", QString::number(panel_project->toolbar_widget->isVisible())); stream.writeTextElement("ShowProjectToolbar", QString::number(panel_project->toolbar_widget->isVisible()));
stream.writeTextElement("PreviousFrameQueueSize", QString::number(previous_queue_size)); stream.writeTextElement("PreviousFrameQueueSize", QString::number(previous_queue_size));
stream.writeTextElement("PreviousFrameQueueType", QString::number(previous_queue_type)); stream.writeTextElement("PreviousFrameQueueType", QString::number(previous_queue_type));
stream.writeTextElement("UpcomingFrameQueueSize", QString::number(upcoming_queue_size)); stream.writeTextElement("UpcomingFrameQueueSize", QString::number(upcoming_queue_size));
stream.writeTextElement("UpcomingFrameQueueType", QString::number(upcoming_queue_type)); stream.writeTextElement("UpcomingFrameQueueType", QString::number(upcoming_queue_type));
stream.writeTextElement("Loop", QString::number(loop)); stream.writeTextElement("Loop", QString::number(loop));
stream.writeTextElement("SeekAlsoSelects", QString::number(seek_also_selects)); stream.writeTextElement("SeekAlsoSelects", QString::number(seek_also_selects));
stream.writeTextElement("CSSPath", css_path); stream.writeTextElement("CSSPath", css_path);
stream.writeTextElement("EffectTextboxLines", QString::number(effect_textbox_lines)); stream.writeTextElement("EffectTextboxLines", QString::number(effect_textbox_lines));
stream.writeTextElement("UseSoftwareFallback", QString::number(use_software_fallback)); stream.writeTextElement("UseSoftwareFallback", QString::number(use_software_fallback));
stream.writeTextElement("CenterTimelineTimecodes", QString::number(center_timeline_timecodes)); stream.writeTextElement("CenterTimelineTimecodes", QString::number(center_timeline_timecodes));
stream.writeTextElement("PreferredAudioOutput", preferred_audio_output); stream.writeTextElement("PreferredAudioOutput", preferred_audio_output);
stream.writeTextElement("PreferredAudioInput", preferred_audio_input); stream.writeTextElement("PreferredAudioInput", preferred_audio_input);
stream.writeTextElement("LanguageFile", language_file); stream.writeTextElement("LanguageFile", language_file);
stream.writeTextElement("ThumbnailResolution", QString::number(thumbnail_resolution)); stream.writeTextElement("ThumbnailResolution", QString::number(thumbnail_resolution));
stream.writeTextElement("WaveformResolution", QString::number(waveform_resolution)); stream.writeTextElement("WaveformResolution", QString::number(waveform_resolution));
stream.writeTextElement("AddDefaultEffectsToClips", QString::number(add_default_effects_to_clips)); stream.writeTextElement("AddDefaultEffectsToClips", QString::number(add_default_effects_to_clips));
stream.writeEndElement(); // configuration stream.writeEndElement(); // configuration
stream.writeEndDocument(); // doc stream.writeEndDocument(); // doc
f.close(); f.close();
} }
RuntimeConfig::RuntimeConfig() : RuntimeConfig::RuntimeConfig() :
shaders_are_enabled(true), shaders_are_enabled(true),
disable_blending(false) disable_blending(false)
{} {}
+52 -52
View File
@@ -45,67 +45,67 @@
#define FRAME_QUEUE_TYPE_SECONDS 1 #define FRAME_QUEUE_TYPE_SECONDS 1
struct Config { struct Config {
Config(); Config();
bool saved_layout; bool saved_layout;
bool show_track_lines; bool show_track_lines;
bool scroll_zooms; bool scroll_zooms;
bool edit_tool_selects_links; bool edit_tool_selects_links;
bool edit_tool_also_seeks; bool edit_tool_also_seeks;
bool select_also_seeks; bool select_also_seeks;
bool paste_seeks; bool paste_seeks;
QString img_seq_formats; QString img_seq_formats;
bool rectified_waveforms; bool rectified_waveforms;
int default_transition_length; int default_transition_length;
int timecode_view; int timecode_view;
bool show_title_safe_area; bool show_title_safe_area;
bool use_custom_title_safe_ratio; bool use_custom_title_safe_ratio;
double custom_title_safe_ratio; double custom_title_safe_ratio;
bool enable_drag_files_to_timeline; bool enable_drag_files_to_timeline;
bool autoscale_by_default; bool autoscale_by_default;
int recording_mode; int recording_mode;
bool enable_seek_to_import; bool enable_seek_to_import;
bool enable_audio_scrubbing; bool enable_audio_scrubbing;
bool drop_on_media_to_replace; bool drop_on_media_to_replace;
int autoscroll; int autoscroll;
int audio_rate; int audio_rate;
bool fast_seeking; bool fast_seeking;
bool hover_focus; bool hover_focus;
int project_view_type; int project_view_type;
bool set_name_with_marker; bool set_name_with_marker;
bool show_project_toolbar; bool show_project_toolbar;
double previous_queue_size; double previous_queue_size;
int previous_queue_type; int previous_queue_type;
double upcoming_queue_size; double upcoming_queue_size;
int upcoming_queue_type; int upcoming_queue_type;
bool loop; bool loop;
bool seek_also_selects; bool seek_also_selects;
QString css_path; QString css_path;
int effect_textbox_lines; int effect_textbox_lines;
bool use_software_fallback; bool use_software_fallback;
bool center_timeline_timecodes; bool center_timeline_timecodes;
QString preferred_audio_output; QString preferred_audio_output;
QString preferred_audio_input; QString preferred_audio_input;
QString language_file; QString language_file;
int waveform_resolution; int waveform_resolution;
int thumbnail_resolution; int thumbnail_resolution;
bool add_default_effects_to_clips; bool add_default_effects_to_clips;
void load(QString path); void load(QString path);
void save(QString path); void save(QString path);
}; };
struct RuntimeConfig { struct RuntimeConfig {
RuntimeConfig(); RuntimeConfig();
bool shaders_are_enabled; bool shaders_are_enabled;
bool disable_blending; bool disable_blending;
QString external_translation_file; QString external_translation_file;
}; };
namespace olive { namespace olive {
extern Config CurrentConfig; extern Config CurrentConfig;
extern RuntimeConfig CurrentRuntimeConfig; extern RuntimeConfig CurrentRuntimeConfig;
} }
#endif // CONFIG_H #endif // CONFIG_H
+2 -2
View File
@@ -426,8 +426,8 @@ void MainWindow::setup_menus() {
view_menu->addAction(tr("Zoom In"), &olive::FocusFilter, SLOT(zoom_in()), QKeySequence("="))->setProperty("id", "zoomin"); view_menu->addAction(tr("Zoom In"), &olive::FocusFilter, SLOT(zoom_in()), QKeySequence("="))->setProperty("id", "zoomin");
view_menu->addAction(tr("Zoom Out"), &olive::FocusFilter, SLOT(zoom_out()), QKeySequence("-"))->setProperty("id", "zoomout"); view_menu->addAction(tr("Zoom Out"), &olive::FocusFilter, SLOT(zoom_out()), QKeySequence("-"))->setProperty("id", "zoomout");
view_menu->addAction(tr("Increase Track Height"), panel_timeline, SLOT(increase_track_height()), QKeySequence("Ctrl+="))->setProperty("id", "vzoomin"); view_menu->addAction(tr("Increase Track Height"), panel_timeline, SLOT(IncreaseTrackHeight()), QKeySequence("Ctrl+="))->setProperty("id", "vzoomin");
view_menu->addAction(tr("Decrease Track Height"), panel_timeline, SLOT(decrease_track_height()), QKeySequence("Ctrl+-"))->setProperty("id", "vzoomout"); view_menu->addAction(tr("Decrease Track Height"), panel_timeline, SLOT(DecreaseTrackHeight()), QKeySequence("Ctrl+-"))->setProperty("id", "vzoomout");
show_all = view_menu->addAction(tr("Toggle Show All"), panel_timeline, SLOT(toggle_show_all()), QKeySequence("\\")); show_all = view_menu->addAction(tr("Toggle Show All"), panel_timeline, SLOT(toggle_show_all()), QKeySequence("\\"));
show_all->setProperty("id", "showall"); show_all->setProperty("id", "showall");
-2
View File
@@ -38,8 +38,6 @@
#include "debug.h" #include "debug.h"
GraphEditor::GraphEditor(QWidget* parent) : Panel(parent), row(nullptr) { GraphEditor::GraphEditor(QWidget* parent) : Panel(parent), row(nullptr) {
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
resize(720, 480); resize(720, 480);
QWidget* main_widget = new QWidget(this); QWidget* main_widget = new QWidget(this);
-2
View File
@@ -72,8 +72,6 @@ QStringList recent_projects;
Project::Project(QWidget *parent) : Project::Project(QWidget *parent) :
Panel(parent) Panel(parent)
{ {
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QWidget* dockWidgetContents = new QWidget(this); QWidget* dockWidgetContents = new QWidget(this);
QVBoxLayout* verticalLayout = new QVBoxLayout(dockWidgetContents); QVBoxLayout* verticalLayout = new QVBoxLayout(dockWidgetContents);
+43 -72
View File
@@ -71,7 +71,7 @@ Timeline::Timeline(QWidget *parent) :
moving_proc(false), moving_proc(false),
move_insert(false), move_insert(false),
trim_target(-1), trim_target(-1),
trim_in_point(false), trim_type(TRIM_NONE),
splitting(false), splitting(false),
importing(false), importing(false),
importing_files(false), importing_files(false),
@@ -84,12 +84,8 @@ Timeline::Timeline(QWidget *parent) :
block_repaints(false), block_repaints(false),
scroll(0) scroll(0)
{ {
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setup_ui(); setup_ui();
default_track_height = qRound((QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96) * TRACK_DEFAULT_HEIGHT);
headers->viewer = panel_sequence_viewer; headers->viewer = panel_sequence_viewer;
video_area->bottom_align = true; video_area->bottom_align = true;
@@ -233,7 +229,7 @@ void Timeline::create_ghosts_from_media(SequencePtr seq, long entry_point, QVect
if (can_import) { if (can_import) {
Ghost g; Ghost g;
g.clip = -1; g.clip = -1;
g.trimming = false; g.trim_type = TRIM_NONE;
g.old_clip_in = g.clip_in = default_clip_in; g.old_clip_in = g.clip_in = default_clip_in;
g.media = medium; g.media = medium;
g.in = entry_point; g.in = entry_point;
@@ -374,14 +370,6 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, SequencePtr s) {
snapped = false; snapped = false;
} }
int Timeline::get_track_height_size(bool video) {
if (video) {
return video_track_heights.size();
} else {
return audio_track_heights.size();
}
}
void Timeline::add_transition() { void Timeline::add_transition() {
ComboAction* ca = new ComboAction(); ComboAction* ca = new ComboAction();
bool adding = false; bool adding = false;
@@ -472,18 +460,6 @@ void Timeline::nest() {
} }
} }
int Timeline::calculate_track_height(int track, int value) {
int index = (track < 0) ? qAbs(track + 1) : track;
QVector<int>& vector = (track < 0) ? video_track_heights : audio_track_heights;
while (vector.size() < index+1) {
vector.append(default_track_height);
}
if (value > -1) {
vector[index] = value;
}
return vector.at(index);
}
void Timeline::update_sequence() { void Timeline::update_sequence() {
bool null_sequence = (olive::ActiveSequence == nullptr); bool null_sequence = (olive::ActiveSequence == nullptr);
@@ -793,15 +769,6 @@ void Timeline::decheck_tool_buttons(QObject* sender) {
} }
} }
QVector<int> Timeline::get_tracks_of_linked_clips(int i) {
QVector<int> tracks;
ClipPtr clip = olive::ActiveSequence->clips.at(i);
for (int j=0;j<clip->linked.size();j++) {
tracks.append(olive::ActiveSequence->clips.at(clip->linked.at(j))->track);
}
return tracks;
}
void Timeline::zoom_in() { void Timeline::zoom_in() {
multiply_zoom(2.0); multiply_zoom(2.0);
} }
@@ -810,6 +777,45 @@ void Timeline::zoom_out() {
multiply_zoom(0.5); multiply_zoom(0.5);
} }
int Timeline::GetTrackHeight(int track) {
for (int i=0;i<track_heights.size();i++) {
if (track_heights.at(i).index == track) {
return track_heights.at(i).height;
}
}
return olive::timeline::kTrackDefaultHeight;
}
void Timeline::SetTrackHeight(int track, int height) {
for (int i=0;i<track_heights.size();i++) {
if (track_heights.at(i).index == track) {
track_heights[i].height = height;
return;
}
}
// we don't have a track height, so set a new one
TimelineTrackHeight t;
t.index = track;
t.height = height;
track_heights.append(t);
}
void Timeline::IncreaseTrackHeight() {
for (int i=0;i<track_heights.size();i++) {
track_heights[i].height += olive::timeline::kTrackHeightIncrement;
}
repaint_timeline();
}
void Timeline::DecreaseTrackHeight() {
for (int i=0;i<track_heights.size();i++) {
track_heights[i].height = qMax(track_heights[i].height - olive::timeline::kTrackHeightIncrement,
olive::timeline::kTrackDefaultHeight);
}
repaint_timeline();
}
bool is_clip_selected(ClipPtr clip, bool containing) { bool is_clip_selected(ClipPtr clip, bool containing) {
for (int i=0;i<clip->sequence->selections.size();i++) { for (int i=0;i<clip->sequence->selections.size();i++) {
const Selection& s = clip->sequence->selections.at(i); const Selection& s = clip->sequence->selections.at(i);
@@ -886,18 +892,9 @@ ClipPtr Timeline::split_clip(ComboAction* ca, bool transitions, int p, long fram
return nullptr; return nullptr;
} }
bool Timeline::has_clip_been_split(int c) {
for (int i=0;i<split_cache.size();i++) {
if (split_cache.at(i) == c) {
return true;
}
}
return false;
}
bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool relink) { bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool relink) {
// see if we split this clip before // see if we split this clip before
if (has_clip_been_split(clip)) { if (split_cache.contains(clip)) {
return false; return false;
} }
@@ -923,7 +920,7 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool
// find linked clips of old clip // find linked clips of old clip
for (int i=0;i<c->linked.size();i++) { for (int i=0;i<c->linked.size();i++) {
int l = c->linked.at(i); int l = c->linked.at(i);
if (!has_clip_been_split(l)) { if (!split_cache.contains(l)) {
ClipPtr link = olive::ActiveSequence->clips.at(l); ClipPtr link = olive::ActiveSequence->clips.at(l);
if ((original_clip_is_selected && is_clip_selected(link, true)) || !original_clip_is_selected) { if ((original_clip_is_selected && is_clip_selected(link, true)) || !original_clip_is_selected) {
split_cache.append(l); split_cache.append(l);
@@ -1675,32 +1672,6 @@ void Timeline::toggle_links() {
} }
} }
void Timeline::increase_track_height() {
for (int i=0;i<video_track_heights.size();i++) {
video_track_heights[i] += olive::timeline::kTrackHeightIncrement;
}
for (int i=0;i<audio_track_heights.size();i++) {
audio_track_heights[i] += olive::timeline::kTrackHeightIncrement;
}
repaint_timeline();
}
void Timeline::decrease_track_height() {
for (int i=0;i<video_track_heights.size();i++) {
video_track_heights[i] = qMax(
video_track_heights[i] - olive::timeline::kTrackHeightIncrement,
olive::timeline::kTrackMinHeight
);
}
for (int i=0;i<audio_track_heights.size();i++) {
audio_track_heights[i] = qMax(
audio_track_heights[i] - olive::timeline::kTrackHeightIncrement,
olive::timeline::kTrackMinHeight
);
}
repaint_timeline();
}
void Timeline::deselect() { void Timeline::deselect() {
olive::ActiveSequence->selections.clear(); olive::ActiveSequence->selections.clear();
repaint_timeline(); repaint_timeline();
+24 -26
View File
@@ -35,14 +35,20 @@
#include "ui/audiomonitor.h" #include "ui/audiomonitor.h"
#include "ui/panel.h" #include "ui/panel.h"
#define TRACK_DEFAULT_HEIGHT 40 enum CreateObjects {
ADD_OBJ_TITLE,
ADD_OBJ_SOLID,
ADD_OBJ_BARS,
ADD_OBJ_TONE,
ADD_OBJ_NOISE,
ADD_OBJ_AUDIO
};
#define ADD_OBJ_TITLE 0 enum TrimType {
#define ADD_OBJ_SOLID 1 TRIM_NONE,
#define ADD_OBJ_BARS 2 TRIM_IN,
#define ADD_OBJ_TONE 3 TRIM_OUT
#define ADD_OBJ_NOISE 4 };
#define ADD_OBJ_AUDIO 5
bool is_clip_selected(ClipPtr clip, bool containing); bool is_clip_selected(ClipPtr clip, bool containing);
int getScreenPointFromFrame(double zoom, long frame); int getScreenPointFromFrame(double zoom, long frame);
@@ -70,8 +76,7 @@ struct Ghost {
// other variables // other variables
long ghost_length; long ghost_length;
long media_length; long media_length;
bool trim_in; TrimType trim_type;
bool trimming;
// transition trimming // transition trimming
TransitionPtr transition; TransitionPtr transition;
@@ -82,7 +87,7 @@ class Timeline : public Panel
Q_OBJECT Q_OBJECT
public: public:
explicit Timeline(QWidget *parent = nullptr); explicit Timeline(QWidget *parent = nullptr);
~Timeline(); virtual ~Timeline() override;
bool focused(); bool focused();
void multiply_zoom(double m); void multiply_zoom(double m);
@@ -98,8 +103,6 @@ public:
void relink_clips_using_ids(QVector<int>& old_clips, QVector<ClipPtr>& new_clips); void relink_clips_using_ids(QVector<int>& old_clips, QVector<ClipPtr>& new_clips);
void update_sequence(); void update_sequence();
QVector<int> get_tracks_of_linked_clips(int i);
bool has_clip_been_split(int c);
void edit_to_point_internal(bool in, bool ripple); void edit_to_point_internal(bool in, bool ripple);
void delete_in_out_internal(bool ripple); void delete_in_out_internal(bool ripple);
@@ -128,10 +131,8 @@ public:
bool showing_all; bool showing_all;
double old_zoom; double old_zoom;
QVector<int> video_track_heights; int GetTrackHeight(int track);
QVector<int> audio_track_heights; void SetTrackHeight(int track, int height);
int get_track_height_size(bool video);
int calculate_track_height(int track, int height);
// snapping // snapping
bool snapping; bool snapping;
@@ -145,10 +146,7 @@ public:
void select_all(); void select_all();
bool rect_select_init; bool rect_select_init;
bool rect_select_proc; bool rect_select_proc;
int rect_select_x; QRect rect_select_rect;
int rect_select_y;
int rect_select_w;
int rect_select_h;
// moving // moving
bool moving_init; bool moving_init;
@@ -160,7 +158,7 @@ public:
// trimming // trimming
int trim_target; int trim_target;
bool trim_in_point; TrimType trim_type;
int transition_select; int transition_select;
// splitting // splitting
@@ -211,8 +209,8 @@ public:
bool can_ripple_empty_space(long frame, int track); bool can_ripple_empty_space(long frame, int track);
void resizeEvent(QResizeEvent *event);
protected: protected:
virtual void resizeEvent(QResizeEvent *event) override;
virtual void Retranslate() override; virtual void Retranslate() override;
public slots: public slots:
void paste(bool insert = false); void paste(bool insert = false);
@@ -233,8 +231,8 @@ public slots:
void edit_to_in_point(); void edit_to_in_point();
void edit_to_out_point(); void edit_to_out_point();
void increase_track_height(); void IncreaseTrackHeight();
void decrease_track_height(); void DecreaseTrackHeight();
void previous_cut(); void previous_cut();
void next_cut(); void next_cut();
@@ -268,12 +266,12 @@ private:
void setup_ui(); void setup_ui();
int default_track_height;
// ripple delete empty space variables // ripple delete empty space variables
long rc_ripple_min; long rc_ripple_min;
long rc_ripple_max; long rc_ripple_max;
QVector<TimelineTrackHeight> track_heights;
QWidget* timeline_area; QWidget* timeline_area;
TimelineWidget* video_area; TimelineWidget* video_area;
TimelineWidget* audio_area; TimelineWidget* audio_area;
-2
View File
@@ -66,8 +66,6 @@ Viewer::Viewer(QWidget *parent) :
cue_recording_internal(false), cue_recording_internal(false),
playback_speed(0) playback_speed(0)
{ {
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setup_ui(); setup_ui();
headers->viewer = this; headers->viewer = this;
+527 -334
View File
File diff suppressed because it is too large Load Diff
+56 -47
View File
@@ -25,6 +25,8 @@
#include <QWidget> #include <QWidget>
#include <QScrollBar> #include <QScrollBar>
#include <QPainter> #include <QPainter>
#include <QApplication>
#include <QDesktopWidget>
#include "project/sequence.h" #include "project/sequence.h"
#include "project/clip.h" #include "project/clip.h"
@@ -36,79 +38,86 @@
class Timeline; class Timeline;
namespace olive { namespace olive {
namespace timeline { namespace timeline {
const int kGhostThickness = 2; const int kGhostThickness = 2;
const int kClipTextPadding = 3; const int kClipTextPadding = 3;
const int kTrackMinHeight = 30; const int kTrackDefaultHeight = 40/* * QApplication::desktop()->devicePixelRatio()*/;
const int kTrackHeightIncrement = 10; const int kTrackMinHeight = 30;
} const int kTrackHeightIncrement = 10;
}
} }
struct TimelineTrackHeight {
int index;
int height;
};
bool same_sign(int a, int b); bool same_sign(int a, int b);
void draw_waveform(ClipPtr clip, const FootageStream *ms, long media_length, QPainter* p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom); void draw_waveform(ClipPtr clip, const FootageStream *ms, long media_length, QPainter* p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom);
class TimelineWidget : public QWidget { class TimelineWidget : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit TimelineWidget(QWidget *parent = 0); explicit TimelineWidget(QWidget *parent = 0);
QScrollBar* scrollBar; QScrollBar* scrollBar;
bool bottom_align; bool bottom_align;
public slots:
protected: protected:
void paintEvent(QPaintEvent*); void paintEvent(QPaintEvent*);
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
void leaveEvent(QEvent *event); void leaveEvent(QEvent *event);
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event); void dragLeaveEvent(QDragLeaveEvent *event);
void dropEvent(QDropEvent* event); void dropEvent(QDropEvent* event);
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event);
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event);
private: private:
void init_ghosts(); void init_ghosts();
void update_ghosts(const QPoint& mouse_pos, bool lock_frame); void update_ghosts(const QPoint& mouse_pos, bool lock_frame);
bool is_track_visible(int track); bool is_track_visible(int track);
int getTrackFromScreenPoint(int y); int getTrackFromScreenPoint(int y);
int getScreenPointFromTrack(int track); int getScreenPointFromTrack(int track);
int getClipIndexFromCoords(long frame, int track); int getClipIndexFromCoords(long frame, int track);
int track_resize_mouse_cache; bool track_resizing;
int track_resize_old_value; int track_target;
bool track_resizing;
int track_target;
QVector<ClipPtr> pre_clips; QVector<ClipPtr> pre_clips;
QVector<ClipPtr> post_clips; QVector<ClipPtr> post_clips;
Media* rc_reveal_media; Media* rc_reveal_media;
SequencePtr self_created_sequence; SequencePtr self_created_sequence;
QTimer tooltip_timer; QTimer tooltip_timer;
int tooltip_clip; int tooltip_clip;
int scroll; int scroll;
SetSelectionsCommand* selection_command; SetSelectionsCommand* selection_command;
signals: signals:
public slots: public slots:
void setScroll(int); void setScroll(int);
private slots: private slots:
void reveal_media(); void reveal_media();
void show_context_menu(const QPoint& pos); void show_context_menu(const QPoint& pos);
void toggle_autoscale(); void toggle_autoscale();
void tooltip_timer_timeout(); void tooltip_timer_timeout();
void rename_clip(); void rename_clip();
void open_sequence_properties(); void open_sequence_properties();
}; };
#endif // TIMELINEWIDGET_H #endif // TIMELINEWIDGET_H