Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
global.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 <memory>
25 #include "undo/undo.h"
26 
27 #include <QTimer>
28 #include <QFile>
29 #include <QTranslator>
30 
36 class OliveGlobal : public QObject {
37  Q_OBJECT
38 public:
44  OliveGlobal();
45 
51  const QString& get_project_file_filter();
52 
66  void update_project_filename(const QString& s);
67 
76 
93  void set_rendering_state(bool rendering);
94 
106  void set_modified(bool modified);
107 
118  bool is_modified();
119 
130  void load_project_on_launch(const QString& s);
131 
137 
142 
150  static void SetNativeStyling(QWidget* w);
151 
152 public slots:
156  void undo();
157 
161  void redo();
162 
170  void paste();
171 
180  void paste_insert();
181 
188  void new_project();
189 
196  void OpenProject();
197 
207  void ImportProject(const QString& fn);
208 
218  void open_recent(int index);
219 
230  bool save_project_as();
231 
242  bool save_project();
243 
256  bool can_close_project();
257 
261  void open_export_dialog();
262 
266  void open_about_dialog();
267 
271  void open_debug_log();
272 
276  void open_speed_dialog();
277 
282 
286  void open_action_search();
287 
293  void clear_undo_stack();
294 
301  void finished_initialize();
302 
309  void save_autorecovery_file();
310 
314  void open_preferences();
315 
327  void set_sequence(SequencePtr s);
328 
329 private:
346  void OpenProjectWorker(QString fn, bool autorecovery);
347 
358  bool CheckForActiveSequence(bool show_msg = true);
359 
386  void LoadProject(const QString& fn, bool autorecovery);
387 
394  void ClearProject();
395 
400 
405 
410 
414  std::unique_ptr<QTranslator> translator;
415 
425 
426 private slots:
427 
428 };
429 
430 namespace olive {
434  extern std::unique_ptr<OliveGlobal> Global;
435 
442  extern QString ActiveProjectFilename;
443 
447  extern QString AppName;
448 }
449 
450 #endif // OLIVEGLOBAL_H
QString get_recent_project_list_file()
Retrieves the URL of the config file containing the autorecovery projects.
Definition: global.cpp:136
void open_autocut_silence_dialog()
Open the auto-cut silence dialog.
Definition: global.cpp:441
OliveGlobal()
OliveGlobal Constructor.
Definition: global.cpp:54
const QString & get_project_file_filter()
Returns the file dialog filter used when interfacing with Olive project files.
Definition: global.cpp:77
void open_export_dialog()
Open the Export dialog to trigger an export of the current sequence.
Definition: global.cpp:304
void paste_insert()
Paste contents of clipboard, making space for it when possible.
Definition: global.cpp:414
static void SetNativeStyling(QWidget *w)
Set native UI styling on a given widget.
Definition: global.cpp:166
QTimer autorecovery_timer
Regular interval to save an auto-recovery project.
Definition: global.h:404
void set_rendering_state(bool rendering)
Set the application state depending on if the user is exporting a video.
Definition: global.cpp:111
void load_translation_from_config()
(Re)load translation file from olive::config
Definition: global.cpp:140
void ClearProject()
Indiscriminately clear the project without prompting the user.
Definition: global.cpp:198
std::unique_ptr< OliveGlobal > Global
Object resource for various global functions used throughout Olive.
Definition: global.cpp:50
bool save_project()
Saves the current project to file.
Definition: global.cpp:274
bool enable_load_project_on_init
Internal variable set to TRUE by main() if a project file was set as an argument. ...
Definition: global.h:409
void OpenProjectWorker(QString fn, bool autorecovery)
Internal function to handle loading a project from file.
Definition: global.cpp:369
void open_recent(int index)
Open recent project from list.
Definition: global.cpp:245
QString AppName
Current application name.
Definition: global.cpp:52
void LoadProject(const QString &fn, bool autorecovery)
Create a LoadDialog and start a LoadThread to load data from a project.
Definition: global.cpp:175
void open_about_dialog()
Open the About Olive dialog.
Definition: global.cpp:420
bool CheckForActiveSequence(bool show_msg=true)
Returns whether a Sequence is currently active or not, and optionally displays a messagebox if not...
Definition: global.cpp:376
void load_project_on_launch(const QString &s)
Set a project to load just after launching.
Definition: global.cpp:131
void ImportProject(const QString &fn)
Import project from file.
Definition: global.cpp:226
void undo()
Undo user&#39;s last action.
Definition: global.cpp:392
bool changed_since_last_autorecovery
Internal variable for whether the project has changed since the last autorecovery.
Definition: global.h:424
The Olive Global class.
Definition: global.h:36
void clear_undo_stack()
Clears the current undo stack.
Definition: global.cpp:459
QString ActiveProjectFilename
Currently active project filename.
Definition: global.cpp:51
std::unique_ptr< QTranslator > translator
Internal translator object that interfaces with the currently loaded language file.
Definition: global.h:414
bool can_close_project()
Determine whether the current project can be closed.
Definition: global.cpp:283
void open_preferences()
Opens the Preferences dialog.
Definition: global.cpp:350
void redo()
Redo user&#39;s last action.
Definition: global.cpp:400
void finished_initialize()
Function called when Olive has finished starting up.
Definition: global.cpp:311
void paste()
Paste contents of clipboard.
Definition: global.cpp:408
void open_action_search()
Open the Action Search overlay.
Definition: global.cpp:463
bool save_project_as()
Shows a save file dialog and saves the project as the resulting filename.
Definition: global.cpp:261
void update_project_filename(const QString &s)
Change the current active project filename.
Definition: global.cpp:81
void save_autorecovery_file()
Save an auto-recovery file of the current project.
Definition: global.cpp:340
void set_sequence(SequencePtr s)
Set the current active Sequence.
Definition: global.cpp:358
void OpenProject()
Open a project from file.
Definition: global.cpp:238
void open_debug_log()
Open the Debug Log window.
Definition: global.cpp:425
void check_for_autorecovery_file()
Check whether an auto-recovery file exists and ask the user if they want to load it.
Definition: global.cpp:89
QString project_file_filter
File filter used for any file dialogs relating to Olive project files.
Definition: global.h:399
std::shared_ptr< Sequence > SequencePtr
Definition: media.h:38
void set_modified(bool modified)
Set the application&#39;s &quot;modified&quot; state.
Definition: global.cpp:120
void open_speed_dialog()
Open the Speed/Duration dialog.
Definition: global.cpp:429
void new_project()
Create new project.
Definition: global.cpp:232
bool is_modified()
Get application&#39;s current &quot;modified&quot; state.
Definition: global.cpp:126