Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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 #include "timeline/clip.h"
33 
34 class LoadThread : public QThread
35 {
36  Q_OBJECT
37 public:
38  LoadThread(const QString& filename, bool autorecovery);
39  void run();
40 public slots:
41  void cancel();
42 signals:
43  void start_question(const QString &title, const QString &text, int buttons);
44  void success();
45  void error();
46  void report_progress(int p);
47 private slots:
48  void question_func(const QString &title, const QString &text, int buttons);
49  void error_func();
50  void success_func();
51 private:
53  QString filename_;
54 
55  bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
56  void load_effect(QXmlStreamReader& stream, Clip* c);
57 
58  void read_next(QXmlStreamReader& stream);
59  void read_next_start_element(QXmlStreamReader& stream);
60  void update_current_element_count(QXmlStreamReader& stream);
61 
62  void show_message(const QString& title, const QString& body, int buttons);
63 
65  QVector<Media*> loaded_media_items;
66  QDir proj_dir;
69  bool show_err;
70  QString error_str;
71 
72  bool is_element(QXmlStreamReader& stream);
73 
74  QVector<MediaPtr> loaded_folders;
75  QVector<ClipPtr> loaded_clips;
76  QVector<Media*> loaded_sequences;
78  void OrganizeFolders(int folder = 0);
79 
82 
83  QMutex mutex;
84  QWaitCondition waitCond;
85 
86  bool cancelled_;
87  bool xml_error;
88 
89  QMessageBox::StandardButton question_btn;
90 };
91 
92 #endif // LOADTHREAD_H
LoadThread(const QString &filename, bool autorecovery)
Definition: loadthread.cpp:40
QVector< Media * > loaded_media_items
Definition: loadthread.h:65
QVector< ClipPtr > loaded_clips
Definition: loadthread.h:75
void run()
Definition: loadthread.cpp:624
SequencePtr open_seq
Definition: loadthread.h:64
void start_question(const QString &title, const QString &text, int buttons)
QVector< Media * > loaded_sequences
Definition: loadthread.h:76
bool cancelled_
Definition: loadthread.h:86
void error_func()
Definition: loadthread.cpp:748
bool show_err
Definition: loadthread.h:69
bool autorecovery_
Definition: loadthread.h:52
QDir internal_proj_dir
Definition: loadthread.h:67
QMutex mutex
Definition: loadthread.h:83
Definition: loadthread.h:34
void success_func()
Definition: loadthread.cpp:763
void error()
int current_element_count
Definition: loadthread.h:80
Definition: clip.h:56
bool xml_error
Definition: loadthread.h:87
void read_next_start_element(QXmlStreamReader &stream)
Definition: loadthread.cpp:176
QDir proj_dir
Definition: loadthread.h:66
void report_progress(int p)
void question_func(const QString &title, const QString &text, int buttons)
Definition: loadthread.cpp:737
void update_current_element_count(QXmlStreamReader &stream)
Definition: loadthread.cpp:181
QVector< MediaPtr > loaded_folders
Definition: loadthread.h:74
Definition: media.h:45
Media * find_loaded_folder_by_id(int id)
Definition: loadthread.cpp:599
QString filename_
Definition: loadthread.h:53
void cancel()
Definition: loadthread.cpp:732
void show_message(const QString &title, const QString &body, int buttons)
Definition: loadthread.cpp:188
bool is_element(QXmlStreamReader &stream)
Definition: loadthread.cpp:198
bool load_worker(QFile &f, QXmlStreamReader &stream, int type)
Definition: loadthread.cpp:207
QMessageBox::StandardButton question_btn
Definition: loadthread.h:89
void load_effect(QXmlStreamReader &stream, Clip *c)
Definition: loadthread.cpp:58
void read_next(QXmlStreamReader &stream)
Definition: loadthread.cpp:171
QString internal_proj_url
Definition: loadthread.h:68
QWaitCondition waitCond
Definition: loadthread.h:84
QString error_str
Definition: loadthread.h:70
void OrganizeFolders(int folder=0)
Definition: loadthread.cpp:610
int total_element_count
Definition: loadthread.h:81
std::shared_ptr< Sequence > SequencePtr
Definition: media.h:38
void success()