some refactoring work

This commit is contained in:
itsmattkc
2019-02-19 02:28:50 -08:00
parent ee967294ea
commit 7efea428c7
14 changed files with 223 additions and 218 deletions
+6 -6
View File
@@ -43,7 +43,7 @@ Config::Config()
img_seq_formats("jpg|jpeg|bmp|tiff|tif|psd|png|tga|jp2|gif"),
rectified_waveforms(false),
default_transition_length(30),
timecode_view(TIMECODE_DROP),
timecode_view(olive::kTimecodeDrop),
show_title_safe_area(false),
use_custom_title_safe_ratio(false),
custom_title_safe_ratio(1),
@@ -53,17 +53,17 @@ Config::Config()
enable_seek_to_import(false),
enable_audio_scrubbing(true),
drop_on_media_to_replace(true),
autoscroll(AUTOSCROLL_PAGE_SCROLL),
autoscroll(olive::AUTOSCROLL_PAGE_SCROLL),
audio_rate(48000),
fast_seeking(false),
hover_focus(false),
project_view_type(PROJECT_VIEW_TREE),
project_view_type(olive::PROJECT_VIEW_TREE),
set_name_with_marker(true),
show_project_toolbar(false),
previous_queue_size(3),
previous_queue_type(FRAME_QUEUE_TYPE_FRAMES),
previous_queue_type(olive::FRAME_QUEUE_TYPE_FRAMES),
upcoming_queue_size(0.5),
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
upcoming_queue_type(olive::FRAME_QUEUE_TYPE_SECONDS),
loop(false),
seek_also_selects(false),
effect_textbox_lines(3),
@@ -234,7 +234,7 @@ void Config::save(QString path) {
stream.writeStartDocument(); // doc
stream.writeStartElement("Configuration"); // configuration
stream.writeTextElement("Version", QString::number(SAVE_VERSION));
stream.writeTextElement("Version", QString::number(olive::kSaveVersion));
stream.writeTextElement("SavedLayout", QString::number(saved_layout));
stream.writeTextElement("ShowTrackLines", QString::number(show_track_lines));
stream.writeTextElement("ScrollZooms", QString::number(scroll_zooms));
+28 -25
View File
@@ -23,36 +23,39 @@
#include <QString>
#define SAVE_VERSION 190219 // YYMMDD
#define MIN_SAVE_VERSION 190219 // lowest compatible project version
namespace olive {
const int kSaveVersion = 190219; // YYMMDD
const int kMinimumSaveVersion = 190219; // lowest compatible project version
enum TimecodeType {
TIMECODE_DROP,
TIMECODE_NONDROP,
TIMECODE_FRAMES,
TIMECODE_MILLISECONDS
};
enum TimecodeType {
kTimecodeDrop,
kTimecodeNonDrop,
kTimecodeFrames,
kTimecodeMilliseconds
};
enum RecordingMode {
RECORD_MODE_MONO,
RECORD_MODE_STEREO
};
enum RecordingMode {
RECORD_MODE_MONO,
RECORD_MODE_STEREO
};
enum AutoScrollMode {
AUTOSCROLL_NO_SCROLL,
AUTOSCROLL_PAGE_SCROLL,
AUTOSCROLL_SMOOTH_SCROLL
};
enum AutoScrollMode {
AUTOSCROLL_NO_SCROLL,
AUTOSCROLL_PAGE_SCROLL,
AUTOSCROLL_SMOOTH_SCROLL
};
enum ProjectView {
PROJECT_VIEW_TREE,
PROJECT_VIEW_ICON
};
enum ProjectView {
PROJECT_VIEW_TREE,
PROJECT_VIEW_ICON
};
enum FrameQueueType {
FRAME_QUEUE_TYPE_FRAMES,
FRAME_QUEUE_TYPE_SECONDS
};
}
enum FrameQueueType {
FRAME_QUEUE_TYPE_FRAMES,
FRAME_QUEUE_TYPE_SECONDS
};
struct Config {
Config();
+2 -2
View File
@@ -169,14 +169,14 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
show_err = true;
int proj_version = SAVE_VERSION;
int proj_version = olive::kSaveVersion;
while (!stream.atEnd() && !cancelled) {
read_next_start_element(stream);
if (stream.name() == root_search) {
if (type == LOAD_TYPE_VERSION) {
proj_version = stream.readElementText().toInt();
if (proj_version < MIN_SAVE_VERSION || proj_version > SAVE_VERSION) {
if (proj_version < olive::kMinimumSaveVersion || proj_version > olive::kSaveVersion) {
emit start_question(
tr("Version Mismatch"),
tr("This project was saved in a different version of Olive and may not be fully compatible with this version. Would you like to attempt loading it anyway?"),