forked from olive-editor/olive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
358 lines (308 loc) · 9.82 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
class Project;
class EffectControls;
class Viewer;
class Timeline;
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent);
virtual ~MainWindow() override;
/**
* @brief Update window title
*
* Updates the window title to reflect the current project filename. Call if the project filename changes.
*
* NOTE: It's recommended to use update_project_filename() from Olive::Global to update the filename completely
* instead of calling this function directly (update_project_filename() calls this function in the process).
*/
void updateTitle();
/**
* @brief Load shortcut file.
*
* Loads a shortcut configuration from file and sets Olive to use them.
*
* @param fn
*
* URL of the shortcut file to be loaded
*
*/
void load_shortcuts(const QString &fn);
/**
* @brief Save shortcut file.
*
* Saves the current shortcut configuration to file. Only saves shortcuts that have been changed from default.
*
* @param fn
*
* URL to save the shortcut file to.
*/
void save_shortcuts(const QString &fn);
/**
* @brief Load a CSS/QSS style from file to customize Olive's interface.
*
* @param fn
*
* URL to load the CSS file from.
*/
void load_css_from_file(const QString& fn);
public slots:
/**
* @brief Toggles full screen mode.
*
* Toggles the main window between full screen and windowed modes.
*/
void toggle_full_screen();
signals:
/**
* @brief Signal emitted once when the main window has finished initializing
*
* Emitted the first time paintEvent runs. Connect this to functions that must be completed post-initialization.
*/
void finished_first_paint();
protected:
/**
* @brief Close event
*
* Confirms whether the project can be closed, and if so performs various clean-up functions before the application
* exits. It's preferable to call clean-up functions here rather than in the destructor because this will get called
* first.
*/
virtual void closeEvent(QCloseEvent *) override;
/**
* @brief Paint event
*
* Overridden to provide the finished_first_paint() signal.
*/
virtual void paintEvent(QPaintEvent *) override;
/**
* @brief Change event
*
* Overridden to handle language changes (e->type() == QEvent::LanguageChange) by calling Retranslate().
*
* See documentation for QWidget::changeEvent() for more information.
*
* @param e
* @return
*/
virtual void changeEvent(QEvent* e) override;
private slots:
/**
* @brief Maximizes the currently hovered panel.
*
* Saves the current state of the panels/dock widgets and removes all except the currently hovered panel,
* effectively maximizing the panel to the entire window.
*/
void maximize_panel();
/**
* @brief Reset panel layout to default.
*
* Resets the current panel layout to default. Doesn't save the current layout.
*/
void reset_layout();
/**
* @brief Function to prepare File menu.
*
* Primarily used to populate the Open Recent Projects menu.
*/
void fileMenu_About_To_Be_Shown();
/**
* @brief Function to prepare Edit menu.
*
* Primarily used to set the enabled state on Undo and Redo depending if there are undos/redos available.
*/
void editMenu_About_To_Be_Shown();
/**
* @brief Function to prepare Window menu.
*
* Primarily used to set the checked state of menu items corresponding to the panels that are currently visible.
*/
void windowMenu_About_To_Be_Shown();
/**
* @brief Function to prepare Playback menu.
*
* Primarily used to set the checked state on the "Loop" item.
*/
void playbackMenu_About_To_Be_Shown();
/**
* @brief Function to prepare View menu.
*
* Primarily used to set the checked state of various options in the view menu (e.g. title safe area, timecode
* units, etc.)
*/
void viewMenu_About_To_Be_Shown();
/**
* @brief Function to prepare Tools menu.
*
* Primarily used to set the checked state on various settings available from the Tools menu.
*/
void toolMenu_About_To_Be_Shown();
/**
* @brief Toggle whether a panel is visible or not.
*
* Assumes the sender() QAction has a pointer to a QDockWidget in its data variable. Casts it and toggles its
* visibility.
*/
void toggle_panel_visibility();
/**
* @brief Set panel lock
*
* @param locked
*
* If **TRUE** prevents panels from being moved around. Defaults to **FALSE**.
*/
void set_panels_locked(bool locked);
private:
/**
* @brief Internal function for setting the panel layout to a predetermined preset.
*
* Resets layout to default and optionally loads a layout from file. If loading from file, this function will
* always load from `get_config_path() + "/layout"`.
*
* @param reset
*
* **TRUE** if this function should just reset the current layout. **FALSE** if it should load from the
* aforementioned layout file.
*/
void setup_layout(bool reset);
/**
* @brief Initialize menu bar menus and items.
*
* Internal initialization function for all menus and menu items in the main window. Called once from the
* MainWindow() constructor.
*/
void setup_menus();
void Retranslate();
// file menu actions
QMenu* file_menu;
QMenu* new_menu;
QAction* open_project;
QMenu* open_recent;
QAction* open_action;
QAction* clear_open_recent_action;
QAction* save_project;
QAction* save_project_as;
QAction* import_action;
QAction* export_action;
QAction* exit_action;
// edit menu actions
QMenu* edit_menu;
QAction* undo_action;
QAction* redo_action;
QAction* select_all_action;
QAction* deselect_all_action;
QAction* ripple_to_in_point_;
QAction* ripple_to_out_point_;
QAction* edit_to_in_point_;
QAction* edit_to_out_point_;
QAction* delete_inout_point_;
QAction* ripple_delete_inout_point_;
QAction* setedit_marker_;
// view menu actions
QMenu* view_menu;
QAction* zoom_in_;
QAction* zoom_out_;
QAction* increase_track_height_;
QAction* decrease_track_height_;
QAction* track_lines;
QAction* frames_action;
QAction* drop_frame_action;
QAction* nondrop_frame_action;
QAction* milliseconds_action;
QAction* no_autoscroll;
QAction* page_autoscroll;
QAction* smooth_autoscroll;
QMenu* title_safe_area_menu;
QAction* title_safe_off;
QAction* title_safe_default;
QAction* title_safe_43;
QAction* title_safe_169;
QAction* title_safe_custom;
QAction* full_screen;
QAction* full_screen_viewer_;
QAction* show_all;
// playback menu
QMenu* playback_menu;
QAction* go_to_start_;
QAction* previous_frame_;
QAction* playpause_;
QAction* play_in_to_out_;
QAction* next_frame_;
QAction* go_to_end_;
QAction* go_to_prev_cut_;
QAction* go_to_next_cut_;
QAction* go_to_in_point_;
QAction* go_to_out_point_;
QAction* shuttle_left_;
QAction* shuttle_stop_;
QAction* shuttle_right_;
QAction* loop_action_;
// window menu
QMenu* window_menu;
QAction* window_project_action;
QAction* window_effectcontrols_action;
QAction* window_timeline_action;
QAction* window_graph_editor_action;
QAction* window_footageviewer_action;
QAction* window_sequenceviewer_action;
QAction* maximize_panel_;
QAction* lock_panels_;
QAction* reset_default_layout_;
// tools menu
QMenu* tools_menu;
QAction* pointer_tool_action;
QAction* edit_tool_action;
QAction* ripple_tool_action;
QAction* razor_tool_action;
QAction* slip_tool_action;
QAction* slide_tool_action;
QAction* hand_tool_action;
QAction* transition_tool_action;
QAction* snap_toggle;
QAction* selecting_also_seeks;
QAction* edit_tool_also_seeks;
QAction* edit_tool_selects_links;
QAction* seek_to_end_of_pastes;
QAction* scroll_wheel_zooms;
QAction* invert_timeline_scroll_axes;
QAction* rectified_waveforms;
QAction* enable_drag_files_to_timeline;
QAction* autoscale_by_default;
QAction* enable_seek_to_import;
QAction* enable_audio_scrubbing;
QAction* enable_drop_on_media_to_replace;
QAction* enable_hover_focus;
QAction* set_name_and_marker;
QAction* seek_also_selects;
QAction* preferences_action_;
QAction* clear_undo_action_;
// help menu
QMenu* help_menu;
QAction* action_search_;
QAction* debug_log_;
QAction* about_action_;
// used to store the panel state when one panel is maximized
QByteArray temp_panel_state;
// used in paintEvent() to determine the first paintEvent() performed
bool first_show;
};
namespace olive {
extern MainWindow* MainWindow;
}
#endif // MAINWINDOW_H