forked from olive-editor/olive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
626 lines (543 loc) · 18.9 KB
/
config.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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
/***
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 CONFIG_H
#define CONFIG_H
#include <QString>
#include "ui/styling.h"
namespace olive {
/**
* @brief Version identifier for saved projects
*
* This constant is used to identify what version of Olive a project file was saved with. Every project file
* is saved with the current version number and the version is checked whenever an Olive project is loaded to
* determine how compatible it'll be with the current version.
*
* Sometimes this version identifier is used to invoke backwards compatibility in order to keep older project files
* able to load, but in this early rapidly developing stage, often backwards compatibility is abandoned. Ideally
* in the future, a class should be made that's able to "convert" an older project into one that the current
* loading system understands (so that the loading system doesn't get too bloated with backwards compatibility
* functions).
*/
const int kSaveVersion = 190219; // YYMMDD
/**
* @brief Minimum project version that this version of Olive can open
*
* When loading a project, the project's version number is actually checked whether it is somewhere between
* kSaveVersion and this value (inclusive). This is used if the current version of Olive contains backwards
* compatibility functionality for older project versions, and is bumped up if such backwards compatibility is
* ever removed.
*
* As stated in kSaveVersion documentation, ideally in the future, a system would be in place to account for all
* project version differences and bring them up to date for the current loading algorithm. This means ideally, this
* constant stays the same forever, but in this early stage it's not strictly necessary.
*/
const int kMinimumSaveVersion = 190219; // lowest compatible project version
/**
* @brief The TimecodeType enum
*
* Frame numbers can be displayed in various different ways. The timecode_to_frame() and frame_to_timecode()
* functions (which should be used for all frame <-> timecode conversions) respond to the timecode display type
* set in Config::timecode_view corresponding to a value from this enum.
*/
enum TimecodeType {
/** Show frame number as a drop-frame timecode */
kTimecodeDrop,
/** Show frame number as a non-drop-frame timecode */
kTimecodeNonDrop,
/** Show frame number as-is with no modifications */
kTimecodeFrames,
/** Show frame number as milliseconds */
kTimecodeMilliseconds
};
/**
* @brief The RecordingMode enum
*
* Olive currently supports recording mono or stereo and gives users the option of which mode to use when
* recording audio in-app. Audio recording responds to Config::recording_mode to a value from this enum.
*/
enum RecordingMode {
/** Record all audio in mono */
RECORD_MODE_MONO,
/** Record all audio in stereo */
RECORD_MODE_STEREO
};
/**
* @brief The AutoScrollMode enum
*
* The Timeline in Olive can automatically scroll to follow the playhead when the sequence is playing.
* The Timeline will respond to Config::autoscroll set to a value from this enum.
*/
enum AutoScrollMode {
/** Don't auto-scroll, scrolling will not follow the playhead */
AUTOSCROLL_NO_SCROLL,
/** Page auto-scroll (default), if the playhead goes off-screen while playing, the scroll will jump ahead
* one "page" to follow it */
AUTOSCROLL_PAGE_SCROLL,
/** Smooth auto-scroll, Olive will scroll to keep the playhead in the center of the screen at all times while
* playing */
AUTOSCROLL_SMOOTH_SCROLL
};
/**
* @brief The ProjectView enum
*
* The media in the Project panel can be displayed as a tree hierarchy or as an icon view. The Project panel
* responds to Config::project_view_type set to a value from this enum.
*/
enum ProjectView {
/** Display project media in tree hierarchy */
PROJECT_VIEW_TREE,
/** Display project media in icon browser */
PROJECT_VIEW_ICON,
/** Display project media in list browser */
PROJECT_VIEW_LIST
};
/**
* @brief The FrameQueueType enum
*
* Olive keeps a "frame queue" in memory to allow smoother playback/seeking. In order to give users control over
* the amount of memory consumption vs. playback performance, they can control how many frames are cached into
* memory. For extra fidelity, they can choose this value as a metric of either frames or seconds.
*
* The playback engine (playback/playback.h) responds to both Config::previous_queue_type and
* Config::upcoming_queue_type set to a value from this enum.
*/
enum FrameQueueType {
/** Queue size value is in frames */
FRAME_QUEUE_TYPE_FRAMES,
/** Queue size value is in seconds */
FRAME_QUEUE_TYPE_SECONDS
};
}
/**
* @brief The Config struct
*
* This struct handles any configuration that should persist between restarting Olive. It contains several variables
* as well as functions that load and save all the variables to file.
*/
struct Config {
/**
* @brief Config Constructor
*
* Sets all configuration variables to their defaults.
*/
Config();
/**
* @brief Show track lines
*
* **TRUE** if the Timeline should show lines between tracks.
*/
bool show_track_lines;
/**
* @brief The scroll wheel zooms rather than scrolls
*
* **TRUE** if the scroll wheel should zoom in and out rather than scroll up and down.
* The Control key temporarily toggles this setting.
*/
bool scroll_zooms;
/**
* @brief Edit tool selects links
*
* **TRUE** if the edit tool should also select links when the user selects a clip.
*/
bool edit_tool_selects_links;
/**
* @brief Edit tool also seeks
*
* **TRUE** if using the edit tool should also seek the sequence's playhead
*/
bool edit_tool_also_seeks;
/**
* @brief Selecting also seeks
*
* **TRUE** if the playhead should automatically seek to the start of any clip that gets selected
*/
bool select_also_seeks;
/**
* @brief Paste also seeks
*
* **TRUE** if the playhead should seek to the end of clips that are pasted
*/
bool paste_seeks;
/**
* @brief Image sequence formats
*
* A '|' separated list of file extensions that Olive will perform an image sequence test heuristic on when importing
*/
QString img_seq_formats;
/**
* @brief Use rectified waveforms
*
* **TRUE** if Olive should display waveforms as "rectified". Rectified waveforms start at the bottom rather than
* from the middle.
*/
bool rectified_waveforms;
/**
* @brief Default transition length
*
* The default transition length used when making a transition without the transition tool
*/
int default_transition_length;
/**
* @brief Timecode display mode
*
* The display mode with which timecode_to_frame() and frame_to_timecode() will use to convert frame numbers to
* more human-readable values.
*
* Set to a member of enum TimecodeType.
*/
int timecode_view;
/**
* @brief Show title/action safe area
*
* **TRUE** if the title/action safe area should be shown on the Viewer.
*/
bool show_title_safe_area;
/**
* @brief Use custom title/action safe area aspect ratio
*
* **TRUE** if the title/action save area should use a custom aspect ratio
*/
bool use_custom_title_safe_ratio;
/**
* @brief Custom title/action safe area aspect ratio
*
* If Config::use_custom_title_safe_ratio is true, this is the aspect ratio to use.
*
* Set to the result of an aspect ratio division (i.e. for 4:3 set to 1.333333 (4.0 / 3.0)
*/
double custom_title_safe_ratio;
/**
* @brief Enable dragging files outside Olive directly into the Timeline
*
* **TRUE** if the Timeline should respond to files dropped from outside Olive.
*/
bool enable_drag_files_to_timeline;
/**
* @brief Auto-scale by default
*
* **TRUE** if clips imported into the timeline should have Clip::autoscale **TRUE** by default. If a Clip is
* smaller or larger than the Sequence, auto-scale will automatically resize it to fit to the Sequence boundaries.
*/
bool autoscale_by_default;
/**
* @brief Recording mode/channel layout
*
* When recording audio within Olive, use this mode/channel layout (e.g. mono or stereo).
*
* Set to a member of enum RecordingMode.
*/
int recording_mode;
/**
* @brief Enable seek to import
*
* **TRUE** if the playhead should automatically seek to any newly imported clips
*/
bool enable_seek_to_import;
/**
* @brief Enable audio scrubbing
*
* **TRUE** if audio should "scrub" as the user drags the playhead around
*/
bool enable_audio_scrubbing;
/**
* @brief Enable drop on media to replace
*
* **TRUE** if dropping a file from outside Olive onto a media item in the Project panel should prompt the user
* whether the dropped file should replace the media item that the file was dropped on.
*/
bool drop_on_media_to_replace;
/**
* @brief Auto-scroll mode
*
* The Timeline behavior regarding scrolling to keep the playhead within view while a Sequence is playing.
*
* Set to a member of enum AutoScrollMode.
*/
int autoscroll;
/**
* @brief Current audio sample rate
*
* The sample rate to set the audio output device to. Also used as the value to resample audio to during playback
* (but not during rendering).
*/
int audio_rate;
/**
* @brief Enable hover focus
*
* Default behavior is panels are focused (and therefore respond to certain keyboard shortcuts)when they are clicked
* on, but Olive also supports panels being considered "focused" if the mouse is hovered over them.
*
* **TRUE** to enable hover focus mode.
*/
bool hover_focus;
/**
* @brief Project view type
*
* Whether to show media in the Project panel as a tree hierarchy or as a browser of icons.
*
* Set to a member of enum ProjectView.
*/
int project_view_type;
/**
* @brief Ask for a marker name when setting a marker
*
* **TRUE** if Olive should ask the user to name a marker when setting one. **FALSE** if markers should just be
* created without asking.
*/
bool set_name_with_marker;
/**
* @brief Show the project toolbar
*
* Olive has an optional toolbar for the Project panel.
*
* Set to **TRUE** to show it.
*/
bool show_project_toolbar;
/**
* @brief Previous frame queue size
*
* Olive caches frames in memory to improve playback performance (see enum FrameQueueType documentation for more
* details). This variable states how many frames to keep in memory prior to the playhead (in most cases, frames that
* have already been played, but are kept in memory in case the user wants to backtrack at any time).
*
* This value corresponds to Config::previous_queue_type.
*/
double previous_queue_size;
/**
* @brief Previous frame queue type
*
* The metric of which Config::previous_queue_size is using. For example, if Config::previous_queue_size is
* 3, this variable states whether that is 3 frames or 3 seconds.
*
* Set to a member of enum FrameQueueType.
*/
int previous_queue_type;
/**
* @brief Upcoming frame queue size
*
* Olive caches frames in memory to improve playback performance (see enum FrameQueueType documentation for more
* details). This variable states how many upcoming frames are stored in memory. Generally this value will be higher
* than Config::previous_queue_size since the user will be playing forwards most of the time.
*
* This value corresponds to Config::upcoming_queue_type.
*/
double upcoming_queue_size;
/**
* @brief Upcoming frame queue type
*
* The metric of which Config::upcoming_queue_size is using. For example, if Config::upcoming_queue_size is
* 3, this variable states whether that is 3 frames or 3 seconds.
*
* Set to a member of enum FrameQueueType.
*/
int upcoming_queue_type;
/**
* @brief Loop
*
* If an in/out point are set on the Sequence (Sequence::using_workarea is **TRUE**), set this to **TRUE** if Olive
* should rewind to the in point and start playing again after it reaches the out point repeatedly until the user
* pauses.
*/
bool loop;
/**
* @brief Seeking also selects
*
* Olive supports automatically selecting clips that the playhead is currently touching for a more efficient workflow.
*
* **TRUE** if this mode should be enabled.
*/
bool seek_also_selects;
/**
* @brief Automatically seek to the beginning of a sequence if the user plays beyond the end of it
*
* TRUE if this behavior should be enabled.
*/
bool auto_seek_to_beginning;
/**
* @brief CSS Path
*
* The URL to a CSS file if the user has loaded a custom stylesheet in. **EMPTY** if the user has not set a
* stylesheet.
*/
QString css_path;
/**
* @brief Number of lines that an Effect's textbox has
*
* The height of a Effect's textbox field in terms of lines.
*
* Set to a value >= 1
*/
int effect_textbox_lines;
/**
* @brief Use software fallbacks when possible
*
* Olive uses a lot of OpenGL-based hardware acceleration for performance. Some older hardware has difficulty
* supporting this functionality, so some of it has software-based (not hardware accelerated) fallbacks for these
* users.
*
* **TRUE** if Olive should prefer software fallbacks to hardware acceleration when they're available.
*/
bool use_software_fallback;
/**
* @brief Center Timeline timecodes
*
* By default, Olive shows timecodes in the TimelineHeader centered to the corresponding frame point. This may not
* always be desirable as, for example, this forces the initial 00:00:00;00 timecode's left half to be cut off.
* Olive supports aligning the timecode to the right of the frame rather than the center to address this.
*/
bool center_timeline_timecodes;
/**
* @brief Preferred audio output device
*
* Sets the audio device Olive should use to output audio to.
*
* Set to the name of the audio device or **EMPTY** to try using the default.
*/
QString preferred_audio_output;
/**
* @brief Preferred audio input device
*
* Sets the audio device Olive should use to input audio from.
*
* Set to the name of the audio device or **EMPTY** to try using the default.
*/
QString preferred_audio_input;
/**
* @brief Language/translation file
*
* Sets the translation file to load to display Olive in a different language.
*
* Set to the URL of the language file to load, or **EMPTY** to use default en-US language.
*/
QString language_file;
/**
* @brief Waveform resolution
*
* Sets how detailed the waveforms should be in the Timeline. Higher value = more detail.
*
* Specifically sets how many samples per second should be "cached" for preview. If the waveforms are too blocky,
* set this higher. If Timeline performance is slow, set this lower.
*/
int waveform_resolution;
/**
* @brief Thumbnail resolution
*
* The vertical pixel height to use for generating thumbnails.
*/
int thumbnail_resolution;
/**
* @brief Add default effects to clips
*
* **TRUE** if new clips imported into the Timeline should have a set of default effects (TransformEffect,
* VolumeEffect, and PanEffect) added to them by default.
*/
bool add_default_effects_to_clips;
/**
* @brief Invert Timeline scroll axes
*
* **TRUE** if scrolling vertically on the Timeline should scroll it horizontally
*/
bool invert_timeline_scroll_axes;
/**
* @brief Style to use when theming Olive.
*
* Set to a member of olive::styling::Style.
*/
olive::styling::Style style;
/**
* @brief Use native menu styling
*
* Use native styling on menus rather than cross-platform Fusion.
*/
bool use_native_menu_styling;
/**
* @brief Default Sequence video width
*/
int default_sequence_width;
/**
* @brief Default Sequence video height
*/
int default_sequence_height;
/**
* @brief Default Sequence video frame rate
*/
double default_sequence_framerate;
/**
* @brief Default Sequence audio frequency
*/
int default_sequence_audio_frequency;
/**
* @brief Default Sequence audio channel layout
*/
int default_sequence_audio_channel_layout;
/**
* @brief Load config from file
*
* Load configuration parameters from file
*
* @param path
*
* URL to the configuration file to load
*/
void load(QString path);
/**
* @brief Save config to file
*
* Save current configuration parameters to file
*
* @param path
*
* URL to save the configuration file to.
*/
void save(QString path);
};
/**
* @brief The RuntimeConfig struct
*
* This struct handles any configuration that's set as a command-line argument to Olive, and shouldn't be persistent
* between restarts of Olive.
*/
struct RuntimeConfig {
/**
* @brief RuntimeConfig Constructor
*
* Sets default runtime configuration
*/
RuntimeConfig();
/**
* @brief Enable shaders
*
* Debugging tool. Set to **FALSE** to bypass OpenGL shaders.
*/
bool shaders_are_enabled;
/**
* @brief Disable blending modes
*
* Some users had difficulty utilizing blending modes (provided by shaders). Set this to **TRUE** to bypass
* shader-based blending modes and utilize standard (less versatile) OpenGL blending instead.
*/
bool disable_blending;
/**
* @brief Load an external translation file
*
* Overrides Config::language_file and sets the path to a language file to use.
*/
QString external_translation_file;
};
namespace olive {
extern Config CurrentConfig;
extern RuntimeConfig CurrentRuntimeConfig;
}
#endif // CONFIG_H