Olive
loadthread.h
Go to the documentation of this file.
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef LOADTHREAD_H
22 #define LOADTHREAD_H
23 
24 #include <QThread>
25 #include <QDir>
26 #include <QXmlStreamReader>
27 #include <QMutex>
28 #include <QWaitCondition>
29 #include <QMessageBox>
30 
32 
33 class LoadThread : public QThread
34 {
35  Q_OBJECT
36 public:
37  LoadThread(bool a);
38  void run();
39  void cancel();
40 signals:
41  void start_question(const QString &title, const QString &text, int buttons);
42  void success();
43  void error();
44  void start_create_effect_ui(QXmlStreamReader* stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
45  void report_progress(int p);
46 private slots:
47  void question_func(const QString &title, const QString &text, int buttons);
48  void error_func();
49  void success_func();
50  void create_effect_ui(QXmlStreamReader* stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
51 private:
53 
54  bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
55  void load_effect(QXmlStreamReader& stream, ClipPtr c);
56 
57  void read_next(QXmlStreamReader& stream);
58  void read_next_start_element(QXmlStreamReader& stream);
59  void update_current_element_count(QXmlStreamReader& stream);
60 
62  QVector<Media*> loaded_media_items;
63  QDir proj_dir;
66  bool show_err;
67  QString error_str;
68 
69  bool is_element(QXmlStreamReader& stream);
70 
71  QVector<Media*> loaded_folders;
72  QVector<ClipPtr> loaded_clips;
73  QVector<Media*> loaded_sequences;
75 
78 
79  QMutex mutex;
80  QWaitCondition waitCond;
81 
82  bool cancelled;
83  bool xml_error;
84 
85  QMessageBox::StandardButton question_btn;
86 };
87 
88 #endif // LOADTHREAD_H
Definition: loadthread.h:33
bool is_element(QXmlStreamReader &stream)
Definition: loadthread.cpp:133
LoadThread(bool a)
Definition: loadthread.cpp:40
void update_current_element_count(QXmlStreamReader &stream)
Definition: loadthread.cpp:126
void read_next_start_element(QXmlStreamReader &stream)
Definition: loadthread.cpp:121
void question_func(const QString &title, const QString &text, int buttons)
Definition: loadthread.cpp:667
QVector< Media * > loaded_sequences
Definition: loadthread.h:73
int current_element_count
Definition: loadthread.h:76
Media * find_loaded_folder_by_id(int id)
Definition: loadthread.cpp:531
bool show_err
Definition: loadthread.h:66
QVector< Media * > loaded_media_items
Definition: loadthread.h:62
Definition: effect.h:50
bool cancelled
Definition: loadthread.h:82
void success_func()
Definition: loadthread.cpp:693
QMutex mutex
Definition: loadthread.h:79
void create_effect_ui(QXmlStreamReader *stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta *meta, long effect_length, bool effect_enabled)
Definition: loadthread.cpp:719
Definition: media.h:42
void run()
Definition: loadthread.cpp:542
std::shared_ptr< Clip > ClipPtr
Definition: cacher.h:28
void error()
QVector< Media * > loaded_folders
Definition: loadthread.h:71
QString error_str
Definition: loadthread.h:67
QDir proj_dir
Definition: loadthread.h:63
void success()
void start_create_effect_ui(QXmlStreamReader *stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta *meta, long effect_length, bool effect_enabled)
QMessageBox::StandardButton question_btn
Definition: loadthread.h:85
std::shared_ptr< Sequence > SequencePtr
Definition: clip.h:48
QDir internal_proj_dir
Definition: loadthread.h:64
void cancel()
Definition: loadthread.cpp:662
int total_element_count
Definition: loadthread.h:77
QWaitCondition waitCond
Definition: loadthread.h:80
QString internal_proj_url
Definition: loadthread.h:65
void error_func()
Definition: loadthread.cpp:678
SequencePtr open_seq
Definition: loadthread.h:61
bool xml_error
Definition: loadthread.h:83
void start_question(const QString &title, const QString &text, int buttons)
void load_effect(QXmlStreamReader &stream, ClipPtr c)
Definition: loadthread.cpp:48
void read_next(QXmlStreamReader &stream)
Definition: loadthread.cpp:116
void report_progress(int p)
bool autorecovery
Definition: loadthread.h:52
QVector< ClipPtr > loaded_clips
Definition: loadthread.h:72
bool load_worker(QFile &f, QXmlStreamReader &stream, int type)
Definition: loadthread.cpp:142