Olive
loadthread.h
1 #ifndef LOADTHREAD_H
2 #define LOADTHREAD_H
3 
4 #include <QThread>
5 #include <QDir>
6 #include <QXmlStreamReader>
7 #include <QMutex>
8 #include <QWaitCondition>
9 #include <QMessageBox>
10 
11 class Media;
12 struct Footage;
13 class Clip;
14 struct Sequence;
15 class LoadDialog;
16 struct TransitionData;
17 struct EffectMeta;
18 
19 class LoadThread : public QThread
20 {
21  Q_OBJECT
22 public:
23  LoadThread(LoadDialog* l, bool a);
24  void run();
25  void cancel();
26 signals:
27  void start_question(const QString &title, const QString &text, int buttons);
28  void success();
29  void error();
30  void start_create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
31  void start_create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta);
32  void report_progress(int p);
33 private slots:
34  void question_func(const QString &title, const QString &text, int buttons);
35  void error_func();
36  void success_func();
37  void create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
38  void create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta);
39 private:
40  LoadDialog* ld;
41  bool autorecovery;
42 
43  bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
44  void load_effect(QXmlStreamReader& stream, Clip* c);
45 
46  void read_next(QXmlStreamReader& stream);
47  void read_next_start_element(QXmlStreamReader& stream);
48  void update_current_element_count(QXmlStreamReader& stream);
49 
50  Sequence* open_seq;
51  QVector<Media*> loaded_media_items;
52  QDir proj_dir;
53  QDir internal_proj_dir;
54  QString internal_proj_url;
55  bool show_err;
56  QString error_str;
57 
58  bool is_element(QXmlStreamReader& stream);
59 
60  QVector<Media*> loaded_folders;
61  QVector<Clip*> loaded_clips;
62  QVector<Media*> loaded_sequences;
63  Media* find_loaded_folder_by_id(int id);
64 
65  int current_element_count;
66  int total_element_count;
67 
68  QMutex mutex;
69  QWaitCondition waitCond;
70 
71  bool cancelled;
72  bool xml_error;
73 
74  QMessageBox::StandardButton question_btn;
75 };
76 
77 #endif // LOADTHREAD_H
Definition: loadthread.h:19
Definition: sequence.h:13
Definition: effect.h:27
Definition: loadthread.cpp:21
Definition: loaddialog.h:13
Definition: media.h:20
Definition: clip.h:33
Definition: footage.h:46