This commit is contained in:
itsmattkc
2019-01-04 19:01:49 +11:00
parent fda1ba64da
commit cdd01db9ab
5 changed files with 185 additions and 164 deletions
+126 -121
View File
@@ -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();
}
+24 -23
View File
@@ -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;
+5
View File
@@ -755,6 +755,10 @@ void MainWindow::setup_menus() {
enable_hover_focus->setCheckable(true);
enable_hover_focus->setData(reinterpret_cast<quintptr>(&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<quintptr>(&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);
+1
View File
@@ -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;
+29 -20
View File
@@ -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;j<m->audio_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;j<m->video_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));
}
}