Olive
project.h
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 PROJECT_H
22 #define PROJECT_H
23 
24 #include <QDockWidget>
25 #include <QVector>
26 #include <QTimer>
27 #include <QDir>
28 
29 #include "project/projectmodel.h"
30 #include "project/projectfilter.h"
31 
32 struct Footage;
33 struct Sequence;
34 class Clip;
35 class Timeline;
36 class Viewer;
37 class SourceTable;
38 class Media;
39 class QXmlStreamWriter;
40 class QXmlStreamReader;
41 class QFile;
42 class ProjectFilter;
43 class ComboAction;
44 class SourceIconView;
45 class QPushButton;
46 class SourcesCommon;
47 
48 #define LOAD_TYPE_VERSION 69
49 #define LOAD_TYPE_URL 70
50 
51 extern QString autorecovery_filename;
52 extern QStringList recent_projects;
53 extern ProjectModel project_model;
54 
55 Sequence* create_sequence_from_media(QVector<Media *> &media_list);
56 
57 QString get_channel_layout_name(int channels, uint64_t layout);
58 QString get_interlacing_name(int interlacing);
59 
60 class Project : public QDockWidget {
61  Q_OBJECT
62 public:
63  explicit Project(QWidget *parent = 0);
64  ~Project();
65  bool is_focused();
66  void clear();
67  Media* create_sequence_internal(ComboAction *ca, Sequence* s, bool open, Media* parent);
68  QString get_next_sequence_name(QString start = 0);
69  void process_file_list(QStringList& files, bool recursive = false, Media* replace = nullptr, Media *parent = nullptr);
70  void replace_media(Media* item, QString filename);
71  Media *get_selected_folder();
72  bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
73  void add_recent_project(QString url);
74 
75  void new_project();
76  void load_project(bool autorecovery);
77  void save_project(bool autorecovery);
78 
79  Media* create_folder_internal(QString name);
80  Media* item_to_media(const QModelIndex& index);
81 
82  void save_recent_projects();
83 
84  QVector<Media*> list_all_project_sequences();
85 
86  SourceTable* tree_view;
87  SourceIconView* icon_view;
88  SourcesCommon* sources_common;
89 
90  ProjectFilter* sorter;
91 
92  QVector<Media*> last_imported_media;
93 
94  QModelIndexList get_current_selected();
95 
96  void start_preview_generator(Media* item, bool replacing);
97  void get_all_media_from_table(QList<Media *> &items, QList<Media *> &list, int type = -1);
98 
99  QWidget* toolbar_widget;
100 public slots:
101  void import_dialog();
102  void delete_selected_media();
103  void duplicate_selected();
104  void delete_clips_using_selected_media();
105  void replace_selected_file();
106  void replace_clip_media();
107  void open_properties();
108  void new_folder();
109  void new_sequence();
110 private:
111  void save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex &parent = QModelIndex());
112  int folder_id;
113  int media_id;
114  int sequence_id;
115  void list_all_sequences_worker(QVector<Media *> *list, Media* parent);
116  QString get_file_name_from_path(const QString &path);
117  QDir proj_dir;
118  QWidget* icon_view_container;
119  QPushButton* directory_up;
120 private slots:
121  void update_view_type();
122  void set_icon_view();
123  void set_tree_view();
124  void clear_recent_projects();
125  void set_icon_view_size(int);
126  void set_up_dir_enabled();
127  void go_up_dir();
128  void make_new_menu();
129 };
130 
131 class MediaThrobber : public QObject {
132  Q_OBJECT
133 public:
135 public slots:
136  void start();
137  void stop(int, bool replace);
138 private slots:
139  void animation_update();
140 private:
141  QPixmap pixmap;
142  int animation;
143  Media* item;
144  QTimer* animator;
145 };
146 
147 #endif // PROJECT_H
Definition: sequence.h:33
Definition: projectmodel.h:28
Definition: sourcetable.h:31
Definition: undo.h:52
Definition: timeline.h:91
Definition: media.h:40
Definition: project.h:131
Definition: project.h:60
Definition: sourceiconview.h:28
Definition: sourcescommon.h:36
Definition: projectfilter.h:26
Definition: clip.h:53
Definition: viewer.h:45
Definition: footage.h:66