reimplemented loading/saving into transitions
This commit is contained in:
+25
-15
@@ -23,26 +23,36 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#define SAVE_VERSION 190201 // YYMMDD
|
||||
#define MIN_SAVE_VERSION 190104 // lowest compatible project version
|
||||
#define SAVE_VERSION 190219 // YYMMDD
|
||||
#define MIN_SAVE_VERSION 190219 // lowest compatible project version
|
||||
|
||||
#define TIMECODE_DROP 0
|
||||
#define TIMECODE_NONDROP 1
|
||||
#define TIMECODE_FRAMES 2
|
||||
#define TIMECODE_MILLISECONDS 3
|
||||
enum TimecodeType {
|
||||
TIMECODE_DROP,
|
||||
TIMECODE_NONDROP,
|
||||
TIMECODE_FRAMES,
|
||||
TIMECODE_MILLISECONDS
|
||||
};
|
||||
|
||||
#define RECORD_MODE_MONO 1
|
||||
#define RECORD_MODE_STEREO 2
|
||||
enum RecordingMode {
|
||||
RECORD_MODE_MONO,
|
||||
RECORD_MODE_STEREO
|
||||
};
|
||||
|
||||
#define AUTOSCROLL_NO_SCROLL 0
|
||||
#define AUTOSCROLL_PAGE_SCROLL 1
|
||||
#define AUTOSCROLL_SMOOTH_SCROLL 2
|
||||
enum AutoScrollMode {
|
||||
AUTOSCROLL_NO_SCROLL,
|
||||
AUTOSCROLL_PAGE_SCROLL,
|
||||
AUTOSCROLL_SMOOTH_SCROLL
|
||||
};
|
||||
|
||||
#define PROJECT_VIEW_TREE 0
|
||||
#define PROJECT_VIEW_ICON 1
|
||||
enum ProjectView {
|
||||
PROJECT_VIEW_TREE,
|
||||
PROJECT_VIEW_ICON
|
||||
};
|
||||
|
||||
#define FRAME_QUEUE_TYPE_FRAMES 0
|
||||
#define FRAME_QUEUE_TYPE_SECONDS 1
|
||||
enum FrameQueueType {
|
||||
FRAME_QUEUE_TYPE_FRAMES,
|
||||
FRAME_QUEUE_TYPE_SECONDS
|
||||
};
|
||||
|
||||
struct Config {
|
||||
Config();
|
||||
|
||||
+630
-696
File diff suppressed because it is too large
Load Diff
+38
-48
@@ -30,69 +30,59 @@
|
||||
|
||||
#include "project/projectelements.h"
|
||||
|
||||
struct TransitionData {
|
||||
int id;
|
||||
QString name;
|
||||
long length;
|
||||
ClipPtr otc;
|
||||
ClipPtr ctc;
|
||||
};
|
||||
|
||||
class LoadThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoadThread(bool a);
|
||||
void run();
|
||||
void cancel();
|
||||
LoadThread(bool a);
|
||||
void run();
|
||||
void cancel();
|
||||
signals:
|
||||
void start_question(const QString &title, const QString &text, int buttons);
|
||||
void success();
|
||||
void error();
|
||||
void start_create_effect_ui(QXmlStreamReader* stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void start_create_dual_transition(const TransitionData* td, ClipPtr primary, ClipPtr secondary, const EffectMeta* meta);
|
||||
void report_progress(int p);
|
||||
void start_question(const QString &title, const QString &text, int buttons);
|
||||
void success();
|
||||
void error();
|
||||
void start_create_effect_ui(QXmlStreamReader* stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void report_progress(int p);
|
||||
private slots:
|
||||
void question_func(const QString &title, const QString &text, int buttons);
|
||||
void error_func();
|
||||
void success_func();
|
||||
void create_effect_ui(QXmlStreamReader* stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void create_dual_transition(const TransitionData* td, ClipPtr primary, ClipPtr secondary, const EffectMeta* meta);
|
||||
void question_func(const QString &title, const QString &text, int buttons);
|
||||
void error_func();
|
||||
void success_func();
|
||||
void create_effect_ui(QXmlStreamReader* stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
private:
|
||||
bool autorecovery;
|
||||
bool autorecovery;
|
||||
|
||||
bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
|
||||
void load_effect(QXmlStreamReader& stream, ClipPtr c);
|
||||
bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
|
||||
void load_effect(QXmlStreamReader& stream, ClipPtr c);
|
||||
|
||||
void read_next(QXmlStreamReader& stream);
|
||||
void read_next_start_element(QXmlStreamReader& stream);
|
||||
void update_current_element_count(QXmlStreamReader& stream);
|
||||
void read_next(QXmlStreamReader& stream);
|
||||
void read_next_start_element(QXmlStreamReader& stream);
|
||||
void update_current_element_count(QXmlStreamReader& stream);
|
||||
|
||||
SequencePtr open_seq;
|
||||
QVector<Media*> loaded_media_items;
|
||||
QDir proj_dir;
|
||||
QDir internal_proj_dir;
|
||||
QString internal_proj_url;
|
||||
bool show_err;
|
||||
QString error_str;
|
||||
SequencePtr open_seq;
|
||||
QVector<Media*> loaded_media_items;
|
||||
QDir proj_dir;
|
||||
QDir internal_proj_dir;
|
||||
QString internal_proj_url;
|
||||
bool show_err;
|
||||
QString error_str;
|
||||
|
||||
bool is_element(QXmlStreamReader& stream);
|
||||
bool is_element(QXmlStreamReader& stream);
|
||||
|
||||
QVector<Media*> loaded_folders;
|
||||
QVector<ClipPtr> loaded_clips;
|
||||
QVector<Media*> loaded_sequences;
|
||||
Media* find_loaded_folder_by_id(int id);
|
||||
QVector<Media*> loaded_folders;
|
||||
QVector<ClipPtr> loaded_clips;
|
||||
QVector<Media*> loaded_sequences;
|
||||
Media* find_loaded_folder_by_id(int id);
|
||||
|
||||
int current_element_count;
|
||||
int total_element_count;
|
||||
int current_element_count;
|
||||
int total_element_count;
|
||||
|
||||
QMutex mutex;
|
||||
QWaitCondition waitCond;
|
||||
QMutex mutex;
|
||||
QWaitCondition waitCond;
|
||||
|
||||
bool cancelled;
|
||||
bool xml_error;
|
||||
bool cancelled;
|
||||
bool xml_error;
|
||||
|
||||
QMessageBox::StandardButton question_btn;
|
||||
QMessageBox::StandardButton question_btn;
|
||||
};
|
||||
|
||||
#endif // LOADTHREAD_H
|
||||
|
||||
+25
-13
@@ -1086,21 +1086,8 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeAttribute("workareaIn", QString::number(s->workarea_in));
|
||||
stream.writeAttribute("workareaOut", QString::number(s->workarea_out));
|
||||
|
||||
/*
|
||||
QVector<TransitionPtr> transition_save_cache;
|
||||
QVector<int> transition_clip_save_cache;
|
||||
QVector<TransitionType> transition_type_save_cache;
|
||||
for (int j=0;j<s->transitions.size();j++) {
|
||||
TransitionPtr t = s->transitions.at(j);
|
||||
if (t != nullptr) {
|
||||
stream.writeStartElement("transition");
|
||||
stream.writeAttribute("id", QString::number(j));
|
||||
stream.writeAttribute("length", QString::number(t->get_true_length()));
|
||||
t->save(stream);
|
||||
stream.writeEndElement(); // transition
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
const ClipPtr& c = s->clips.at(j);
|
||||
@@ -1153,6 +1140,31 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
}
|
||||
stream.writeEndElement(); // linked
|
||||
|
||||
// save opening and closing transitions
|
||||
for (int t=kTransitionOpening;t<=kTransitionClosing;t++) {
|
||||
TransitionPtr transition = (t == kTransitionOpening) ? c->opening_transition : c->closing_transition;
|
||||
|
||||
if (transition != nullptr) {
|
||||
stream.writeStartElement((t == kTransitionOpening) ? "opening" : "closing");
|
||||
|
||||
// check if this is a shared transition and the transition has already been saved
|
||||
int transition_cache_index = transition_save_cache.indexOf(transition);
|
||||
|
||||
if (transition_cache_index > -1) {
|
||||
// if so, just save a reference to the other clip
|
||||
stream.writeAttribute("shared",
|
||||
QString::number(transition_clip_save_cache.at(transition_cache_index)));
|
||||
} else {
|
||||
// otherwise save the whole transition
|
||||
transition->save(stream);
|
||||
transition_save_cache.append(transition);
|
||||
transition_clip_save_cache.append(j);
|
||||
}
|
||||
|
||||
stream.writeEndElement(); // opening
|
||||
}
|
||||
}
|
||||
|
||||
for (int k=0;k<c->effects.size();k++) {
|
||||
stream.writeStartElement("effect"); // effect
|
||||
c->effects.at(k)->save(stream);
|
||||
|
||||
@@ -59,6 +59,11 @@ TransitionPtr Transition::copy(ClipPtr c, ClipPtr s) {
|
||||
return create_transition(c, s, meta, length);
|
||||
}
|
||||
|
||||
void Transition::save(QXmlStreamWriter &stream) {
|
||||
stream.writeAttribute("length", QString::number(get_true_length()));
|
||||
Effect::save(stream);
|
||||
}
|
||||
|
||||
void Transition::set_length(long l) {
|
||||
length = l;
|
||||
length_field->set_double_value(l);
|
||||
|
||||
@@ -51,6 +51,9 @@ public:
|
||||
Transition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||
virtual TransitionPtr copy(ClipPtr c, ClipPtr s);
|
||||
ClipPtr secondary_clip;
|
||||
|
||||
virtual void save(QXmlStreamWriter& stream) override;
|
||||
|
||||
void set_length(long l);
|
||||
long get_true_length();
|
||||
long get_length();
|
||||
|
||||
Reference in New Issue
Block a user