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;
Config::Config()
: saved_layout(false),
show_track_lines(true),
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"),
rectified_waveforms(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),
set_name_with_marker(true),
show_project_toolbar(false),
previous_queue_size(3),
previous_queue_type(FRAME_QUEUE_TYPE_FRAMES),
upcoming_queue_size(0.5),
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
loop(false),
seek_also_selects(false),
effect_textbox_lines(3),
use_software_fallback(false),
center_timeline_timecodes(true),
waveform_resolution(64),
thumbnail_resolution(120),
add_default_effects_to_clips(true)
: saved_layout(false),
show_track_lines(true),
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"),
rectified_waveforms(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),
set_name_with_marker(true),
show_project_toolbar(false),
previous_queue_size(3),
previous_queue_type(FRAME_QUEUE_TYPE_FRAMES),
upcoming_queue_size(0.5),
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
loop(false),
seek_also_selects(false),
effect_textbox_lines(3),
use_software_fallback(false),
center_timeline_timecodes(true),
waveform_resolution(64),
thumbnail_resolution(120),
add_default_effects_to_clips(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();
} else if (stream.name() == "RectifiedWaveforms") {
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();
} else if (stream.name() == "EnableDragFilesToTimeline") {
stream.readNext();
enable_drag_files_to_timeline = (stream.text() == "1");;
} else if (stream.name() == "AutoscaleByDefault") {
stream.readNext();
autoscale_by_default = (stream.text() == "1");
} else if (stream.name() == "RecordingMode") {
stream.readNext();
recording_mode = stream.text().toInt();
} 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();
} else if (stream.name() == "SetNameWithMarker") {
stream.readNext();
set_name_with_marker = (stream.text() == "1");
} else if (stream.name() == "ShowProjectToolbar") {
stream.readNext();
show_project_toolbar = (stream.text() == "1");
} else if (stream.name() == "PreviousFrameQueueSize") {
stream.readNext();
previous_queue_size = stream.text().toDouble();
} else if (stream.name() == "PreviousFrameQueueType") {
stream.readNext();
previous_queue_type = stream.text().toInt();
} else if (stream.name() == "UpcomingFrameQueueSize") {
stream.readNext();
upcoming_queue_size = stream.text().toDouble();
} 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() == "SeekAlsoSelects") {
stream.readNext();
seek_also_selects = (stream.text() == "1");
} else if (stream.name() == "CSSPath") {
stream.readNext();
css_path = stream.text().toString();
} else if (stream.name() == "EffectTextboxLines") {
stream.readNext();
effect_textbox_lines = stream.text().toInt();
} else if (stream.name() == "UseSoftwareFallback") {
stream.readNext();
use_software_fallback = (stream.text() == "1");
} else if (stream.name() == "CenterTimelineTimecodes") {
stream.readNext();
center_timeline_timecodes = (stream.text() == "1");
} else if (stream.name() == "PreferredAudioOutput") {
stream.readNext();
preferred_audio_output = stream.text().toString();
} else if (stream.name() == "PreferredAudioInput") {
stream.readNext();
preferred_audio_input = stream.text().toString();
} else if (stream.name() == "LanguageFile") {
stream.readNext();
language_file = stream.text().toString();
} else if (stream.name() == "ThumbnailResolution") {
stream.readNext();
thumbnail_resolution = stream.text().toInt();
} else if (stream.name() == "WaveformResolution") {
stream.readNext();
waveform_resolution = stream.text().toInt();
} else if (stream.name() == "AddDefaultEffectsToClips") {
stream.readNext();
add_default_effects_to_clips = (stream.text() == "1");
}
}
}
if (stream.hasError()) {
qCritical() << "Error parsing config XML." << stream.errorString();
}
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();
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();
} else if (stream.name() == "EnableDragFilesToTimeline") {
stream.readNext();
enable_drag_files_to_timeline = (stream.text() == "1");;
} else if (stream.name() == "AutoscaleByDefault") {
stream.readNext();
autoscale_by_default = (stream.text() == "1");
} else if (stream.name() == "RecordingMode") {
stream.readNext();
recording_mode = stream.text().toInt();
} 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();
} else if (stream.name() == "SetNameWithMarker") {
stream.readNext();
set_name_with_marker = (stream.text() == "1");
} else if (stream.name() == "ShowProjectToolbar") {
stream.readNext();
show_project_toolbar = (stream.text() == "1");
} else if (stream.name() == "PreviousFrameQueueSize") {
stream.readNext();
previous_queue_size = stream.text().toDouble();
} else if (stream.name() == "PreviousFrameQueueType") {
stream.readNext();
previous_queue_type = stream.text().toInt();
} else if (stream.name() == "UpcomingFrameQueueSize") {
stream.readNext();
upcoming_queue_size = stream.text().toDouble();
} 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() == "SeekAlsoSelects") {
stream.readNext();
seek_also_selects = (stream.text() == "1");
} else if (stream.name() == "CSSPath") {
stream.readNext();
css_path = stream.text().toString();
} else if (stream.name() == "EffectTextboxLines") {
stream.readNext();
effect_textbox_lines = stream.text().toInt();
} else if (stream.name() == "UseSoftwareFallback") {
stream.readNext();
use_software_fallback = (stream.text() == "1");
} else if (stream.name() == "CenterTimelineTimecodes") {
stream.readNext();
center_timeline_timecodes = (stream.text() == "1");
} else if (stream.name() == "PreferredAudioOutput") {
stream.readNext();
preferred_audio_output = stream.text().toString();
} else if (stream.name() == "PreferredAudioInput") {
stream.readNext();
preferred_audio_input = stream.text().toString();
} else if (stream.name() == "LanguageFile") {
stream.readNext();
language_file = stream.text().toString();
} else if (stream.name() == "ThumbnailResolution") {
stream.readNext();
thumbnail_resolution = stream.text().toInt();
} else if (stream.name() == "WaveformResolution") {
stream.readNext();
waveform_resolution = stream.text().toInt();
} else if (stream.name() == "AddDefaultEffectsToClips") {
stream.readNext();
add_default_effects_to_clips = (stream.text() == "1");
}
}
}
if (stream.hasError()) {
qCritical() << "Error parsing config XML." << stream.errorString();
}
f.close();
}
f.close();
}
}
void Config::save(QString path) {
QFile f(path);
if (!f.open(QIODevice::WriteOnly)) {
qCritical() << "Could not save configuration";
return;
}
QFile f(path);
if (!f.open(QIODevice::WriteOnly)) {
qCritical() << "Could not save configuration";
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("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("EnableDragFilesToTimeline", QString::number(enable_drag_files_to_timeline));
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("SetNameWithMarker", QString::number(set_name_with_marker));
stream.writeTextElement("ShowProjectToolbar", QString::number(panel_project->toolbar_widget->isVisible()));
stream.writeTextElement("PreviousFrameQueueSize", QString::number(previous_queue_size));
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("SeekAlsoSelects", QString::number(seek_also_selects));
stream.writeTextElement("CSSPath", css_path);
stream.writeTextElement("EffectTextboxLines", QString::number(effect_textbox_lines));
stream.writeTextElement("UseSoftwareFallback", QString::number(use_software_fallback));
stream.writeTextElement("CenterTimelineTimecodes", QString::number(center_timeline_timecodes));
stream.writeTextElement("PreferredAudioOutput", preferred_audio_output);
stream.writeTextElement("PreferredAudioInput", preferred_audio_input);
stream.writeTextElement("LanguageFile", language_file);
stream.writeTextElement("ThumbnailResolution", QString::number(thumbnail_resolution));
stream.writeTextElement("WaveformResolution", QString::number(waveform_resolution));
stream.writeTextElement("AddDefaultEffectsToClips", QString::number(add_default_effects_to_clips));
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("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("EnableDragFilesToTimeline", QString::number(enable_drag_files_to_timeline));
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("SetNameWithMarker", QString::number(set_name_with_marker));
stream.writeTextElement("ShowProjectToolbar", QString::number(panel_project->toolbar_widget->isVisible()));
stream.writeTextElement("PreviousFrameQueueSize", QString::number(previous_queue_size));
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("SeekAlsoSelects", QString::number(seek_also_selects));
stream.writeTextElement("CSSPath", css_path);
stream.writeTextElement("EffectTextboxLines", QString::number(effect_textbox_lines));
stream.writeTextElement("UseSoftwareFallback", QString::number(use_software_fallback));
stream.writeTextElement("CenterTimelineTimecodes", QString::number(center_timeline_timecodes));
stream.writeTextElement("PreferredAudioOutput", preferred_audio_output);
stream.writeTextElement("PreferredAudioInput", preferred_audio_input);
stream.writeTextElement("LanguageFile", language_file);
stream.writeTextElement("ThumbnailResolution", QString::number(thumbnail_resolution));
stream.writeTextElement("WaveformResolution", QString::number(waveform_resolution));
stream.writeTextElement("AddDefaultEffectsToClips", QString::number(add_default_effects_to_clips));
stream.writeEndElement(); // configuration
stream.writeEndDocument(); // doc
f.close();
stream.writeEndElement(); // configuration
stream.writeEndDocument(); // doc
f.close();
}
RuntimeConfig::RuntimeConfig() :
shaders_are_enabled(true),
disable_blending(false)
shaders_are_enabled(true),
disable_blending(false)
{}
+52 -52
View File
@@ -45,67 +45,67 @@
#define FRAME_QUEUE_TYPE_SECONDS 1
struct Config {
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;
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;
bool enable_drag_files_to_timeline;
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 set_name_with_marker;
bool show_project_toolbar;
double previous_queue_size;
int previous_queue_type;
double upcoming_queue_size;
int upcoming_queue_type;
bool loop;
bool seek_also_selects;
QString css_path;
int effect_textbox_lines;
bool use_software_fallback;
bool center_timeline_timecodes;
QString preferred_audio_output;
QString preferred_audio_input;
QString language_file;
int waveform_resolution;
int thumbnail_resolution;
bool add_default_effects_to_clips;
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;
bool enable_drag_files_to_timeline;
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 set_name_with_marker;
bool show_project_toolbar;
double previous_queue_size;
int previous_queue_type;
double upcoming_queue_size;
int upcoming_queue_type;
bool loop;
bool seek_also_selects;
QString css_path;
int effect_textbox_lines;
bool use_software_fallback;
bool center_timeline_timecodes;
QString preferred_audio_output;
QString preferred_audio_input;
QString language_file;
int waveform_resolution;
int thumbnail_resolution;
bool add_default_effects_to_clips;
void load(QString path);
void save(QString path);
void load(QString path);
void save(QString path);
};
struct RuntimeConfig {
RuntimeConfig();
RuntimeConfig();
bool shaders_are_enabled;
bool disable_blending;
QString external_translation_file;
bool shaders_are_enabled;
bool disable_blending;
QString external_translation_file;
};
namespace olive {
extern Config CurrentConfig;
extern RuntimeConfig CurrentRuntimeConfig;
extern Config CurrentConfig;
extern RuntimeConfig CurrentRuntimeConfig;
}
#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 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("Decrease Track Height"), panel_timeline, SLOT(decrease_track_height()), QKeySequence("Ctrl+-"))->setProperty("id", "vzoomout");
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(DecreaseTrackHeight()), QKeySequence("Ctrl+-"))->setProperty("id", "vzoomout");
show_all = view_menu->addAction(tr("Toggle Show All"), panel_timeline, SLOT(toggle_show_all()), QKeySequence("\\"));
show_all->setProperty("id", "showall");
-2
View File
@@ -38,8 +38,6 @@
#include "debug.h"
GraphEditor::GraphEditor(QWidget* parent) : Panel(parent), row(nullptr) {
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
resize(720, 480);
QWidget* main_widget = new QWidget(this);
-2
View File
@@ -72,8 +72,6 @@ QStringList recent_projects;
Project::Project(QWidget *parent) :
Panel(parent)
{
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QWidget* dockWidgetContents = new QWidget(this);
QVBoxLayout* verticalLayout = new QVBoxLayout(dockWidgetContents);
+43 -72
View File
@@ -71,7 +71,7 @@ Timeline::Timeline(QWidget *parent) :
moving_proc(false),
move_insert(false),
trim_target(-1),
trim_in_point(false),
trim_type(TRIM_NONE),
splitting(false),
importing(false),
importing_files(false),
@@ -84,12 +84,8 @@ Timeline::Timeline(QWidget *parent) :
block_repaints(false),
scroll(0)
{
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setup_ui();
default_track_height = qRound((QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96) * TRACK_DEFAULT_HEIGHT);
headers->viewer = panel_sequence_viewer;
video_area->bottom_align = true;
@@ -233,7 +229,7 @@ void Timeline::create_ghosts_from_media(SequencePtr seq, long entry_point, QVect
if (can_import) {
Ghost g;
g.clip = -1;
g.trimming = false;
g.trim_type = TRIM_NONE;
g.old_clip_in = g.clip_in = default_clip_in;
g.media = medium;
g.in = entry_point;
@@ -374,14 +370,6 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, SequencePtr s) {
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() {
ComboAction* ca = new ComboAction();
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() {
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() {
multiply_zoom(2.0);
}
@@ -810,6 +777,45 @@ void Timeline::zoom_out() {
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) {
for (int i=0;i<clip->sequence->selections.size();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;
}
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) {
// see if we split this clip before
if (has_clip_been_split(clip)) {
if (split_cache.contains(clip)) {
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
for (int i=0;i<c->linked.size();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);
if ((original_clip_is_selected && is_clip_selected(link, true)) || !original_clip_is_selected) {
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() {
olive::ActiveSequence->selections.clear();
repaint_timeline();
+24 -26
View File
@@ -35,14 +35,20 @@
#include "ui/audiomonitor.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
#define ADD_OBJ_SOLID 1
#define ADD_OBJ_BARS 2
#define ADD_OBJ_TONE 3
#define ADD_OBJ_NOISE 4
#define ADD_OBJ_AUDIO 5
enum TrimType {
TRIM_NONE,
TRIM_IN,
TRIM_OUT
};
bool is_clip_selected(ClipPtr clip, bool containing);
int getScreenPointFromFrame(double zoom, long frame);
@@ -70,8 +76,7 @@ struct Ghost {
// other variables
long ghost_length;
long media_length;
bool trim_in;
bool trimming;
TrimType trim_type;
// transition trimming
TransitionPtr transition;
@@ -82,7 +87,7 @@ class Timeline : public Panel
Q_OBJECT
public:
explicit Timeline(QWidget *parent = nullptr);
~Timeline();
virtual ~Timeline() override;
bool focused();
void multiply_zoom(double m);
@@ -98,8 +103,6 @@ public:
void relink_clips_using_ids(QVector<int>& old_clips, QVector<ClipPtr>& new_clips);
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 delete_in_out_internal(bool ripple);
@@ -128,10 +131,8 @@ public:
bool showing_all;
double old_zoom;
QVector<int> video_track_heights;
QVector<int> audio_track_heights;
int get_track_height_size(bool video);
int calculate_track_height(int track, int height);
int GetTrackHeight(int track);
void SetTrackHeight(int track, int height);
// snapping
bool snapping;
@@ -145,10 +146,7 @@ public:
void select_all();
bool rect_select_init;
bool rect_select_proc;
int rect_select_x;
int rect_select_y;
int rect_select_w;
int rect_select_h;
QRect rect_select_rect;
// moving
bool moving_init;
@@ -160,7 +158,7 @@ public:
// trimming
int trim_target;
bool trim_in_point;
TrimType trim_type;
int transition_select;
// splitting
@@ -211,8 +209,8 @@ public:
bool can_ripple_empty_space(long frame, int track);
void resizeEvent(QResizeEvent *event);
protected:
virtual void resizeEvent(QResizeEvent *event) override;
virtual void Retranslate() override;
public slots:
void paste(bool insert = false);
@@ -233,8 +231,8 @@ public slots:
void edit_to_in_point();
void edit_to_out_point();
void increase_track_height();
void decrease_track_height();
void IncreaseTrackHeight();
void DecreaseTrackHeight();
void previous_cut();
void next_cut();
@@ -268,12 +266,12 @@ private:
void setup_ui();
int default_track_height;
// ripple delete empty space variables
long rc_ripple_min;
long rc_ripple_max;
QVector<TimelineTrackHeight> track_heights;
QWidget* timeline_area;
TimelineWidget* video_area;
TimelineWidget* audio_area;
-2
View File
@@ -66,8 +66,6 @@ Viewer::Viewer(QWidget *parent) :
cue_recording_internal(false),
playback_speed(0)
{
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setup_ui();
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 <QScrollBar>
#include <QPainter>
#include <QApplication>
#include <QDesktopWidget>
#include "project/sequence.h"
#include "project/clip.h"
@@ -36,79 +38,86 @@
class Timeline;
namespace olive {
namespace timeline {
const int kGhostThickness = 2;
const int kClipTextPadding = 3;
namespace timeline {
const int kGhostThickness = 2;
const int kClipTextPadding = 3;
const int kTrackMinHeight = 30;
const int kTrackHeightIncrement = 10;
}
const int kTrackDefaultHeight = 40/* * QApplication::desktop()->devicePixelRatio()*/;
const int kTrackMinHeight = 30;
const int kTrackHeightIncrement = 10;
}
}
struct TimelineTrackHeight {
int index;
int height;
};
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);
class TimelineWidget : public QWidget {
Q_OBJECT
Q_OBJECT
public:
explicit TimelineWidget(QWidget *parent = 0);
QScrollBar* scrollBar;
bool bottom_align;
explicit TimelineWidget(QWidget *parent = 0);
QScrollBar* scrollBar;
bool bottom_align;
public slots:
protected:
void paintEvent(QPaintEvent*);
void paintEvent(QPaintEvent*);
void resizeEvent(QResizeEvent *event);
void resizeEvent(QResizeEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void leaveEvent(QEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void leaveEvent(QEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event);
void dropEvent(QDropEvent* event);
void dragMoveEvent(QDragMoveEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event);
void dropEvent(QDropEvent* event);
void dragMoveEvent(QDragMoveEvent *event);
void wheelEvent(QWheelEvent *event);
void wheelEvent(QWheelEvent *event);
private:
void init_ghosts();
void update_ghosts(const QPoint& mouse_pos, bool lock_frame);
bool is_track_visible(int track);
int getTrackFromScreenPoint(int y);
int getScreenPointFromTrack(int track);
int getClipIndexFromCoords(long frame, int track);
void init_ghosts();
void update_ghosts(const QPoint& mouse_pos, bool lock_frame);
bool is_track_visible(int track);
int getTrackFromScreenPoint(int y);
int getScreenPointFromTrack(int track);
int getClipIndexFromCoords(long frame, int track);
int track_resize_mouse_cache;
int track_resize_old_value;
bool track_resizing;
int track_target;
bool track_resizing;
int track_target;
QVector<ClipPtr> pre_clips;
QVector<ClipPtr> post_clips;
QVector<ClipPtr> pre_clips;
QVector<ClipPtr> post_clips;
Media* rc_reveal_media;
Media* rc_reveal_media;
SequencePtr self_created_sequence;
SequencePtr self_created_sequence;
QTimer tooltip_timer;
int tooltip_clip;
QTimer tooltip_timer;
int tooltip_clip;
int scroll;
int scroll;
SetSelectionsCommand* selection_command;
SetSelectionsCommand* selection_command;
signals:
public slots:
void setScroll(int);
void setScroll(int);
private slots:
void reveal_media();
void show_context_menu(const QPoint& pos);
void toggle_autoscale();
void tooltip_timer_timeout();
void rename_clip();
void open_sequence_properties();
void reveal_media();
void show_context_menu(const QPoint& pos);
void toggle_autoscale();
void tooltip_timer_timeout();
void rename_clip();
void open_sequence_properties();
};
#endif // TIMELINEWIDGET_H