Olive
oliveglobal.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 OLIVEGLOBAL_H
22 #define OLIVEGLOBAL_H
23 
24 #include "project/undo.h"
25 
26 #include <QTimer>
27 #include <QFile>
28 #include <QTranslator>
29 
35 class OliveGlobal : public QObject {
36  Q_OBJECT
37 public:
43  OliveGlobal();
44 
50  const QString& get_project_file_filter();
51 
65  void update_project_filename(const QString& s);
66 
75 
92  void set_rendering_state(bool rendering);
93 
104  void load_project_on_launch(const QString& s);
105 
111 
116 
117 public slots:
121  void undo();
122 
126  void redo();
127 
135  void paste();
136 
145  void paste_insert();
146 
153  void new_project();
154 
161  void open_project();
162 
172  void open_recent(int index);
173 
184  bool save_project_as();
185 
196  bool save_project();
197 
210  bool can_close_project();
211 
215  void open_export_dialog();
216 
220  void open_about_dialog();
221 
225  void open_debug_log();
226 
230  void open_speed_dialog();
231 
235  void open_action_search();
236 
242  void clear_undo_stack();
243 
250  void finished_initialize();
251 
258  void save_autorecovery_file();
259 
263  void open_preferences();
264 
265 private:
282  void open_project_worker(const QString& fn, bool autorecovery);
283 
288 
293 
298 
302  std::unique_ptr<QTranslator> translator;
303 
304 
305 private slots:
306 
307 };
308 
309 namespace olive {
313  extern std::unique_ptr<OliveGlobal> Global;
314 
321  extern QString ActiveProjectFilename;
322 
326  extern QString AppName;
327 }
328 
329 #endif // OLIVEGLOBAL_H
void open_debug_log()
Open the Debug Log window.
Definition: oliveglobal.cpp:321
bool save_project_as()
Shows a save file dialog and saves the project as the resulting filename.
Definition: oliveglobal.cpp:185
void check_for_autorecovery_file()
Check whether an auto-recovery file exists and ask the user if they want to load it.
Definition: oliveglobal.cpp:82
QTimer autorecovery_timer
Regular interval to save an auto-recovery project.
Definition: oliveglobal.h:292
void load_project_on_launch(const QString &s)
Set a project to load just after launching.
Definition: oliveglobal.cpp:108
void set_rendering_state(bool rendering)
Set the application state depending on if the user is exporting a video.
Definition: oliveglobal.cpp:99
void redo()
Redo user's last action.
Definition: oliveglobal.cpp:296
void save_autorecovery_file()
Save an auto-recovery file of the current project.
Definition: oliveglobal.cpp:266
void clear_undo_stack()
Clears the current undo stack.
Definition: oliveglobal.cpp:338
OliveGlobal()
OliveGlobal Constructor.
Definition: oliveglobal.cpp:52
void open_recent(int index)
Open recent project from list.
Definition: oliveglobal.cpp:169
std::unique_ptr< OliveGlobal > Global
Object resource for various global functions used throughout Olive.
Definition: oliveglobal.cpp:48
void open_preferences()
Opens the Preferences dialog.
Definition: oliveglobal.cpp:273
void finished_initialize()
Function called when Olive has finished starting up.
Definition: oliveglobal.cpp:240
void paste_insert()
Paste contents of clipboard, making space for it when possible.
Definition: oliveglobal.cpp:310
QString get_recent_project_list_file()
Retrieves the URL of the config file containing the autorecovery projects.
Definition: oliveglobal.cpp:113
Definition: debugdialog.h:39
void open_action_search()
Open the Action Search overlay.
Definition: oliveglobal.cpp:342
void open_project()
Open a project from file.
Definition: oliveglobal.cpp:162
const QString & get_project_file_filter()
Returns the file dialog filter used when interfacing with Olive project files.
Definition: oliveglobal.cpp:70
void paste()
Paste contents of clipboard.
Definition: oliveglobal.cpp:304
bool can_close_project()
Determine whether the current project can be closed.
Definition: oliveglobal.cpp:207
void update_project_filename(const QString &s)
Change the current active project filename.
Definition: oliveglobal.cpp:74
bool save_project()
Saves the current project to file.
Definition: oliveglobal.cpp:198
bool enable_load_project_on_init
Internal variable set to TRUE by main() if a project file was set as an argument.
Definition: oliveglobal.h:297
The Olive Global class.
Definition: oliveglobal.h:35
QString AppName
Current application name.
Definition: oliveglobal.cpp:50
void open_export_dialog()
Open the Export dialog to trigger an export of the current sequence.
Definition: oliveglobal.cpp:228
void open_project_worker(const QString &fn, bool autorecovery)
Internal function to handle loading a project from file.
Definition: oliveglobal.cpp:282
QString ActiveProjectFilename
Currently active project filename.
Definition: oliveglobal.cpp:49
void open_speed_dialog()
Open the Speed/Duration dialog.
Definition: oliveglobal.cpp:325
std::unique_ptr< QTranslator > translator
Internal translator object that interfaces with the currently loaded language file.
Definition: oliveglobal.h:302
void new_project()
Create new project.
Definition: oliveglobal.cpp:143
QString project_file_filter
File filter used for any file dialogs relating to Olive project files.
Definition: oliveglobal.h:287
void undo()
Undo user's last action.
Definition: oliveglobal.cpp:288
void open_about_dialog()
Open the About Olive dialog.
Definition: oliveglobal.cpp:316
void load_translation_from_config()
(Re)load translation file from olive::config
Definition: oliveglobal.cpp:117