source: smplayer/trunk/src/preferences.h@ 182

Last change on this file since 182 was 182, checked in by Silvan Scherrer, 9 years ago

smplayer: restore some os/2 removals from vendor, fix branding

  • Property svn:eol-style set to LF
File size: 13.5 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/
18
19
20#ifndef PREFERENCES_H
21#define PREFERENCES_H
22
23/* Global settings */
24
25#include <QString>
26#include <QStringList>
27#include <QSize>
28#include "config.h"
29#include "audioequalizerlist.h"
30#include "assstyles.h"
31
32#ifdef UPDATE_CHECKER
33#include "updatecheckerdata.h"
34#endif
35
36class Recents;
37class URLHistory;
38class Filters;
39
40class Preferences {
41
42public:
43 enum OSD { None = 0, Seek = 1, SeekTimer = 2, SeekTimerTotal = 3 };
44 enum OnTop { NeverOnTop = 0, AlwaysOnTop = 1, WhilePlayingOnTop = 2 };
45 enum Resize { Never = 0, Always = 1, Afterload = 2 };
46 enum Priority { Realtime = 0, High = 1, AboveNormal = 2, Normal = 3,
47 BelowNormal = 4, Idle = 5 };
48 enum WheelFunction { DoNothing = 1, Seeking = 2, Volume = 4, Zoom = 8,
49 ChangeSpeed = 16 };
50 enum DragFunction { DragDisabled = 0, MoveWindow = 1, Gestures = 2 };
51 enum OptionState { Detect = -1, Disabled = 0, Enabled = 1 };
52 enum H264LoopFilter { LoopDisabled = 0, LoopEnabled = 1, LoopDisabledOnHD = 2 };
53 enum AutoAddToPlaylistFilter { NoFiles = 0, VideoFiles = 1, AudioFiles = 2, MultimediaFiles = 3, ConsecutiveFiles = 4 };
54 enum Streaming { NoStreaming = 0, StreamingAuto = 1, StreamingYT = 2, StreamingYTDL = 3 };
55
56 Q_DECLARE_FLAGS(WheelFunctions, WheelFunction);
57
58 Preferences();
59 virtual ~Preferences();
60
61 virtual void reset();
62
63 void save();
64 void load();
65
66 double monitor_aspect_double();
67 void setupScreenshotFolder();
68
69
70
71 /* *******
72 General
73 ******* */
74
75 int config_version;
76
77 QString mplayer_bin;
78 QString vo; // video output
79 QString ao; // audio output
80
81 bool use_screenshot;
82#ifdef MPV_SUPPORT
83 QString screenshot_template;
84 QString screenshot_format;
85#endif
86 QString screenshot_directory;
87#ifdef CAPTURE_STREAM
88 QString capture_directory;
89#endif
90
91 // Possibility to remember all media settings
92 bool remember_media_settings;
93 bool remember_time_pos;
94 bool remember_stream_settings;
95
96 QString audio_lang; // Preferred audio language
97 QString subtitle_lang; // Preferred subtitle language
98
99 // Video
100 bool use_direct_rendering;
101 bool use_double_buffer;
102 bool use_soft_video_eq;
103 bool use_slices;
104 int autoq; //!< Postprocessing quality
105 bool add_blackborders_on_fullscreen;
106
107#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
108 #ifdef SCREENSAVER_OFF
109 bool turn_screensaver_off;
110 #endif
111 #ifdef AVOID_SCREENSAVER
112 bool avoid_screensaver;
113 #endif
114#else
115 bool disable_screensaver;
116#endif
117
118#ifndef Q_OS_WIN
119 struct VDPAU_settings {
120 bool ffh264vdpau;
121 bool ffmpeg12vdpau;
122 bool ffwmv3vdpau;
123 bool ffvc1vdpau;
124 bool ffodivxvdpau;
125 bool disable_video_filters;
126 } vdpau;
127#endif
128
129 // Audio
130 bool use_soft_vol;
131 int softvol_max;
132 OptionState use_scaletempo;
133 bool use_hwac3; // -afm hwac3
134 bool use_audio_equalizer;
135
136 // Global volume options
137 bool global_volume;
138 int volume;
139 bool mute;
140
141 // Global equalizer
142 bool global_audio_equalizer;
143 AudioEqualizerList audio_equalizer;
144
145 bool autosync;
146 int autosync_factor;
147
148 // For the -mc option
149 bool use_mc;
150 double mc_value;
151
152 // When playing a mp4 file, it will use a m4a file for audio if a there's a file with same name but extension m4a
153 bool autoload_m4a;
154 int min_step; //<! Step to increase of decrease the controls for color, contrast, brightness and so on
155
156 // Misc
157 int osd;
158 double osd_scale; // mpv
159 double subfont_osd_scale; // mplayer
160 int osd_delay; //<! Delay in ms to show the OSD.
161
162 QString file_settings_method; //!< Method to be used for saving file settings
163
164 bool tablet_mode;
165 #ifdef Q_OS_WIN
166 QString tablet_mode_change_answer;
167 #endif
168
169 /* ***************
170 Drives (CD/DVD)
171 *************** */
172
173 QString dvd_device;
174 QString cdrom_device;
175#ifdef BLURAY_SUPPORT
176 QString bluray_device;
177#endif
178
179#ifdef Q_OS_WIN
180 bool enable_audiocd_on_windows;
181#endif
182
183 int vcd_initial_title;
184
185#if DVDNAV_SUPPORT
186 bool use_dvdnav; //!< Opens DVDs using dvdnav: instead of dvd:
187#endif
188
189
190 /* ***********
191 Performance
192 *********** */
193
194#ifdef Q_OS_WIN
195 int priority;
196#endif
197 bool frame_drop;
198 bool hard_frame_drop;
199 bool coreavc;
200 H264LoopFilter h264_skip_loop_filter;
201 int HD_height; //!< An HD is a video which height is equal or greater than this.
202
203#ifdef OBSOLETE_FAST_AUDIO_CHANGE
204 OptionState fast_audio_change; // If activated, not restart mplayer
205#endif
206
207#if !SMART_DVD_CHAPTERS
208 bool fast_chapter_change;
209#endif
210
211 int threads; //!< number of threads to use for decoding (-lavdopts threads <1-8>)
212 QString hwdec; //!< hardware video decoding (mpv only)
213
214 bool cache_auto;
215 int cache_for_files;
216 int cache_for_streams;
217 int cache_for_dvds;
218 int cache_for_vcds;
219 int cache_for_audiocds;
220#ifdef TV_SUPPORT
221 int cache_for_tv;
222#endif
223
224
225 /* *********
226 Subtitles
227 ********* */
228
229 QString subcp; // -subcp
230 bool use_enca;
231 QString enca_lang;
232 int subfuzziness;
233 bool autoload_sub;
234
235 bool use_ass_subtitles;
236 bool enable_ass_styles;
237 int ass_line_spacing;
238
239 bool use_forced_subs_only;
240
241 bool sub_visibility;
242
243 bool subtitles_on_screenshots;
244
245 OptionState change_sub_scale_should_restart;
246
247 //! If true, loading an external subtitle will be done
248 //! by using the sub_load slave command. Otherwise
249 //! mplayer will be restarted.
250 bool fast_load_sub;
251
252 // ASS styles
253 AssStyles ass_styles;
254 bool force_ass_styles; // Use ass styles even for ass files
255 QString user_forced_ass_style; //!< Specifies a style defined by the user to be used with -ass-force-style
256
257 //! If false, options requiring freetype won't be used
258 bool freetype_support;
259#ifdef FONTS_HACK
260 bool use_windowsfontdir;
261#endif
262
263
264 /* ********
265 Advanced
266 ******** */
267
268#if USE_ADAPTER
269 int adapter; //Screen for overlay. If -1 it won't be used.
270#endif
271
272#if USE_COLORKEY
273 unsigned int color_key;
274#endif
275
276 bool use_mplayer_window;
277
278 QString monitor_aspect;
279
280 bool use_idx; //!< Use -idx
281 bool use_lavf_demuxer;
282
283 // Let the user pass options to mplayer
284 QString mplayer_additional_options;
285 QString mplayer_additional_video_filters;
286 QString mplayer_additional_audio_filters;
287
288 // Logs
289#ifdef LOG_MPLAYER
290 bool log_mplayer;
291 bool verbose_log;
292 bool autosave_mplayer_log;
293 QString mplayer_log_saveto;
294#endif
295#ifdef LOG_SMPLAYER
296 bool log_smplayer;
297 QString log_filter;
298 bool save_smplayer_log;
299#endif
300
301#if REPAINT_BACKGROUND_OPTION
302 //! If true, mplayerlayer erases its background
303 bool repaint_video_background;
304#endif
305
306 //! If true it will autoload edl files with the same name of the file
307 //! to play
308 bool use_edl_files;
309
310#ifdef MPLAYER_SUPPORT
311 //! If true it will pass to mplayer the -playlist option
312 bool use_playlist_option;
313#endif
314
315 //! Preferred connection method: ipv4 or ipv6
316 bool prefer_ipv4;
317
318 //! Windows only. If true, smplayer will pass short filenames to mplayer.
319 //! To workaround a bug in mplayer.
320 bool use_short_pathnames;
321
322 //! If false, -brightness, -contrast and so on, won't be passed to
323 //! mplayer. It seems that some graphic cards don't support those options.
324 bool change_video_equalizer_on_startup;
325
326 //! If true, smplayer will use the prefix pausing_keep_force to keep
327 //! the pause on slave commands. This experimental prefix was added
328 //! in mplayer svn r27665.
329 bool use_pausing_keep_force;
330
331 OptionState use_correct_pts; //!< Pass -correct-pts to mplayer
332
333 QString actions_to_run; //!< List of actions to run every time a video loads.
334
335 //! Show file tag in window title
336 bool show_tag_in_window_title;
337
338 int time_to_kill_mplayer;
339
340#ifdef MPRIS2
341 bool use_mpris2;
342#endif
343
344
345 /* *********
346 GUI stuff
347 ********* */
348
349 bool fullscreen;
350 bool start_in_fullscreen;
351 bool compact_mode;
352 OnTop stay_on_top;
353 int size_factor;
354
355 int resize_method; //!< Mainwindow resize method
356
357#if STYLE_SWITCHING
358 QString style; //!< SMPlayer look
359#endif
360
361 bool center_window; //!< Center the main window when playback starts
362 bool center_window_if_outside; //!< Center the main window after an autoresize if it's outside of the screen
363
364#ifdef GLOBALSHORTCUTS
365 bool use_global_shortcuts;
366#endif
367
368 // Function of mouse buttons:
369 QString mouse_left_click_function;
370 QString mouse_right_click_function;
371 QString mouse_double_click_function;
372 QString mouse_middle_click_function;
373 QString mouse_xbutton1_click_function;
374 QString mouse_xbutton2_click_function;
375 int wheel_function;
376
377 WheelFunctions wheel_function_cycle;
378 bool wheel_function_seeking_reverse;
379
380 int drag_function;
381
382 // Configurable seeking
383 int seeking1; // By default 10s
384 int seeking2; // By default 1m
385 int seeking3; // By default 10m
386 int seeking4; // For mouse wheel, by default 30s
387
388 bool update_while_seeking;
389#if ENABLE_DELAYED_DRAGGING
390 int time_slider_drag_delay;
391#endif
392#if SEEKBAR_RESOLUTION
393 //! If true, seeking will be done using a
394 //! percentage (with fractions) instead of time.
395 bool relative_seeking;
396#endif
397 bool precise_seeking; //! Enable precise_seeking (only available with mpv)
398
399 bool reset_stop; //! Pressing the stop button resets the position
400
401 //! If true, the left click in the video is delayed some ms
402 //! to check if the user double clicked
403 bool delay_left_click;
404
405 QString language;
406 QString iconset;
407
408 //! Number of times to show the balloon remembering that the program
409 //! is still running in the system tray.
410 int balloon_count;
411
412 //! If true, the position of the main window will be saved before
413 //! entering in fullscreen and will restore when going back to
414 //! window mode.
415 bool restore_pos_after_fullscreen;
416
417 bool save_window_size_on_exit;
418
419 //! Close the main window when a file or playlist finish
420 bool close_on_finish;
421
422#ifdef AUTO_SHUTDOWN_PC
423 bool auto_shutdown_pc;
424#endif
425
426 QString default_font;
427
428 //!< Pause the current file when the main window is not visible
429 bool pause_when_hidden;
430
431 //!< Allow frre movement of the video window
432 bool allow_video_movement;
433
434 QString gui; //!< The name of the GUI to use
435
436#if USE_MINIMUMSIZE
437 int gui_minimum_width;
438#endif
439 QSize default_size; // Default size of the main window
440
441#if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
442 bool hide_video_window_on_audio_files;
443#endif
444
445 bool report_mplayer_crashes;
446
447#if REPORT_OLD_MPLAYER
448 bool reported_mplayer_is_old;
449#endif
450
451 bool auto_add_to_playlist; //!< Add files to open to playlist
452 AutoAddToPlaylistFilter media_to_add_to_playlist;
453
454#if LOGO_ANIMATION
455 bool animated_logo;
456#endif
457
458
459 /* ********
460 TV (dvb)
461 ******** */
462#ifdef TV_SUPPORT
463 bool check_channels_conf_on_startup;
464 int initial_tv_deinterlace;
465 QString last_dvb_channel;
466 QString last_tv_channel;
467#endif
468
469
470 /* ********
471 Network
472 ******** */
473
474 // Streaming
475 int streaming_type;
476 #ifdef YOUTUBE_SUPPORT
477 int yt_quality;
478 QString yt_user_agent;
479 bool yt_use_https_main;
480 bool yt_use_https_vi;
481 #endif
482
483 // Proxy
484 bool use_proxy;
485 int proxy_type;
486 QString proxy_host;
487 int proxy_port;
488 QString proxy_username;
489 QString proxy_password;
490
491
492 /* ***********
493 Directories
494 *********** */
495
496 QString latest_dir; //!< Directory of the latest file loaded
497 QString last_dvd_directory;
498 bool save_dirs; // Save or not the latest dirs
499
500 /* **************
501 Initial values
502 ************** */
503
504 double initial_sub_scale;
505 double initial_sub_scale_ass;
506 int initial_volume;
507 int initial_contrast;
508 int initial_brightness;
509 int initial_hue;
510 int initial_saturation;
511 int initial_gamma;
512
513 AudioEqualizerList initial_audio_equalizer;
514
515 //! Default value for zoom (1.0 = no zoom)
516 double initial_zoom_factor;
517
518 //! Default value for position of subtitles on screen
519 //! 100 = 100% at the bottom
520 int initial_sub_pos;
521
522 bool initial_postprocessing; //!< global postprocessing filter
523 bool initial_volnorm;
524
525 int initial_deinterlace;
526
527 int initial_audio_channels;
528 int initial_stereo_mode;
529
530 int initial_audio_track;
531 int initial_subtitle_track;
532
533
534 /* ************
535 MPlayer info
536 ************ */
537
538 int mplayer_detected_version; //!< Latest version of mplayer parsed
539
540 //! Version of mplayer supplied by the user which will be used if
541 //! the version can't be parsed from mplayer output
542 int mplayer_user_supplied_version;
543
544#ifdef MPLAYER2_SUPPORT
545 bool mplayer_is_mplayer2; //! True if the detected version is mplayer2
546 QString mplayer2_detected_version;
547#endif
548
549
550 /* *********
551 Instances
552 ********* */
553#ifdef SINGLE_INSTANCE
554 bool use_single_instance;
555#endif
556
557
558 /* ****************
559 Floating control
560 **************** */
561
562 int floating_control_margin;
563 int floating_control_width;
564 bool floating_control_animated;
565 bool floating_display_in_compact_mode;
566 int floating_activation_area;
567 int floating_hide_delay;
568
569
570 /* *******
571 History
572 ******* */
573
574 Recents * history_recents;
575 URLHistory * history_urls;
576
577
578 /* *******
579 Filters
580 ******* */
581 Filters * filters;
582
583
584 /* *********
585 SMPlayer info
586 ********* */
587
588#ifdef CHECK_UPGRADED
589 QString smplayer_stable_version;
590 bool check_if_upgraded;
591#endif
592#ifdef FONTCACHE_DIALOG
593 QString smplayer_version;
594#endif
595
596
597 /* *********
598 Update
599 ********* */
600
601#ifdef UPDATE_CHECKER
602 UpdateCheckerData update_checker_data;
603#endif
604};
605
606Q_DECLARE_OPERATORS_FOR_FLAGS(Preferences::WheelFunctions)
607
608#endif
Note: See TracBrowser for help on using the repository browser.