source: smplayer/trunk/src/preferences.h

Last change on this file was 188, checked in by Silvan Scherrer, 8 years ago

SMPlayer: update trunk to version 17.1.0

  • Property svn:eol-style set to LF
File size: 13.8 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2017 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
106#ifdef ADD_BLACKBORDERS_FS
107 bool add_blackborders_on_fullscreen;
108#endif
109
110#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
111 #ifdef SCREENSAVER_OFF
112 bool turn_screensaver_off;
113 #endif
114 #ifdef AVOID_SCREENSAVER
115 bool avoid_screensaver;
116 #endif
117#else
118 bool disable_screensaver;
119#endif
120
121#ifndef Q_OS_WIN
122 struct VDPAU_settings {
123 bool ffh264vdpau;
124 bool ffmpeg12vdpau;
125 bool ffwmv3vdpau;
126 bool ffvc1vdpau;
127 bool ffodivxvdpau;
128 bool disable_video_filters;
129 } vdpau;
130#endif
131
132 // Audio
133 bool use_soft_vol;
134 int softvol_max;
135 OptionState use_scaletempo;
136 bool use_hwac3; // -afm hwac3
137 bool use_audio_equalizer;
138
139 // Global volume options
140 bool global_volume;
141 int volume;
142 bool mute;
143
144 // Global equalizer
145 bool global_audio_equalizer;
146 AudioEqualizerList audio_equalizer;
147
148 bool autosync;
149 int autosync_factor;
150
151 // For the -mc option
152 bool use_mc;
153 double mc_value;
154
155 // 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
156 bool autoload_m4a;
157 int min_step; //<! Step to increase of decrease the controls for color, contrast, brightness and so on
158
159 // Misc
160 int osd;
161 double osd_scale; // mpv
162 double subfont_osd_scale; // mplayer
163 int osd_delay; //<! Delay in ms to show the OSD.
164
165 QString file_settings_method; //!< Method to be used for saving file settings
166
167 bool tablet_mode;
168 #ifdef Q_OS_WIN
169 QString tablet_mode_change_answer;
170 #endif
171
172 /* ***************
173 Drives (CD/DVD)
174 *************** */
175
176 QString dvd_device;
177 QString cdrom_device;
178#ifdef BLURAY_SUPPORT
179 QString bluray_device;
180#endif
181
182#ifdef Q_OS_WIN
183 bool enable_audiocd_on_windows;
184#endif
185
186 int vcd_initial_title;
187
188#if DVDNAV_SUPPORT
189 bool use_dvdnav; //!< Opens DVDs using dvdnav: instead of dvd:
190#endif
191
192
193 /* ***********
194 Performance
195 *********** */
196
197#ifdef Q_OS_WIN
198 int priority;
199#endif
200 bool frame_drop;
201 bool hard_frame_drop;
202 bool coreavc;
203 H264LoopFilter h264_skip_loop_filter;
204 int HD_height; //!< An HD is a video which height is equal or greater than this.
205
206#ifdef OBSOLETE_FAST_AUDIO_CHANGE
207 OptionState fast_audio_change; // If activated, not restart mplayer
208#endif
209
210#if !SMART_DVD_CHAPTERS
211 bool fast_chapter_change;
212#endif
213
214 int threads; //!< number of threads to use for decoding (-lavdopts threads <1-8>)
215 QString hwdec; //!< hardware video decoding (mpv only)
216
217 bool cache_auto;
218 int cache_for_files;
219 int cache_for_streams;
220 int cache_for_dvds;
221 int cache_for_vcds;
222 int cache_for_audiocds;
223#ifdef TV_SUPPORT
224 int cache_for_tv;
225#endif
226
227
228 /* *********
229 Subtitles
230 ********* */
231
232 QString subcp; // -subcp
233 bool use_enca;
234 QString enca_lang;
235 int subfuzziness;
236 bool autoload_sub;
237
238 bool use_ass_subtitles;
239 bool enable_ass_styles;
240 int ass_line_spacing;
241
242 bool use_forced_subs_only;
243
244 bool sub_visibility;
245
246 bool subtitles_on_screenshots;
247
248 OptionState change_sub_scale_should_restart;
249
250 //! If true, loading an external subtitle will be done
251 //! by using the sub_load slave command. Otherwise
252 //! mplayer will be restarted.
253 bool fast_load_sub;
254
255 // ASS styles
256 AssStyles ass_styles;
257 bool force_ass_styles; // Use ass styles even for ass files
258 QString user_forced_ass_style; //!< Specifies a style defined by the user to be used with -ass-force-style
259
260 //! If false, options requiring freetype won't be used
261 bool freetype_support;
262#ifdef FONTS_HACK
263 bool use_windowsfontdir;
264#endif
265
266
267 /* ********
268 Advanced
269 ******** */
270
271#if USE_ADAPTER
272 int adapter; //Screen for overlay. If -1 it won't be used.
273#endif
274
275#if USE_COLORKEY
276 unsigned int color_key;
277#endif
278
279 bool use_mplayer_window;
280
281 QString monitor_aspect;
282
283 bool use_idx; //!< Use -idx
284 bool use_lavf_demuxer;
285
286 // Let the user pass options to mplayer
287 QString mplayer_additional_options;
288 QString mplayer_additional_video_filters;
289 QString mplayer_additional_audio_filters;
290
291 // Logs
292#ifdef LOG_MPLAYER
293 bool log_mplayer;
294 bool verbose_log;
295 bool autosave_mplayer_log;
296 QString mplayer_log_saveto;
297#endif
298#ifdef LOG_SMPLAYER
299 bool log_smplayer;
300 QString log_filter;
301 bool save_smplayer_log;
302#endif
303
304#if REPAINT_BACKGROUND_OPTION
305 //! If true, mplayerlayer erases its background
306 bool repaint_video_background;
307#endif
308
309 //! If true it will autoload edl files with the same name of the file
310 //! to play
311 bool use_edl_files;
312
313#ifdef MPLAYER_SUPPORT
314 //! If true it will pass to mplayer the -playlist option
315 bool use_playlist_option;
316#endif
317
318 //! Preferred connection method: ipv4 or ipv6
319 bool prefer_ipv4;
320
321 //! Windows only. If true, smplayer will pass short filenames to mplayer.
322 //! To workaround a bug in mplayer.
323 bool use_short_pathnames;
324
325 //! If false, -brightness, -contrast and so on, won't be passed to
326 //! mplayer. It seems that some graphic cards don't support those options.
327 bool change_video_equalizer_on_startup;
328
329 //! If true, smplayer will use the prefix pausing_keep_force to keep
330 //! the pause on slave commands. This experimental prefix was added
331 //! in mplayer svn r27665.
332 bool use_pausing_keep_force;
333
334 OptionState use_correct_pts; //!< Pass -correct-pts to mplayer
335
336 QString actions_to_run; //!< List of actions to run every time a video loads.
337
338 //! Show file tag in window title
339 bool show_tag_in_window_title;
340
341 int time_to_kill_mplayer;
342
343#ifdef MPRIS2
344 bool use_mpris2;
345#endif
346
347#ifdef MPV_SUPPORT
348 QString mpv_osd_media_info;
349#endif
350#ifdef MPLAYER_SUPPORT
351 QString mplayer_osd_media_info;
352#endif
353
354
355 /* *********
356 GUI stuff
357 ********* */
358
359 bool fullscreen;
360 bool start_in_fullscreen;
361 bool compact_mode;
362 OnTop stay_on_top;
363 int size_factor;
364
365 int resize_method; //!< Mainwindow resize method
366
367#if STYLE_SWITCHING
368 QString style; //!< SMPlayer look
369#endif
370
371 bool center_window; //!< Center the main window when playback starts
372 bool center_window_if_outside; //!< Center the main window after an autoresize if it's outside of the screen
373
374#ifdef GLOBALSHORTCUTS
375 bool use_global_shortcuts;
376#endif
377
378 // Function of mouse buttons:
379 QString mouse_left_click_function;
380 QString mouse_right_click_function;
381 QString mouse_double_click_function;
382 QString mouse_middle_click_function;
383 QString mouse_xbutton1_click_function;
384 QString mouse_xbutton2_click_function;
385 int wheel_function;
386
387 WheelFunctions wheel_function_cycle;
388 bool wheel_function_seeking_reverse;
389
390 int drag_function;
391
392 // Configurable seeking
393 int seeking1; // By default 10s
394 int seeking2; // By default 1m
395 int seeking3; // By default 10m
396 int seeking4; // For mouse wheel, by default 30s
397
398 bool update_while_seeking;
399#if ENABLE_DELAYED_DRAGGING
400 int time_slider_drag_delay;
401#endif
402#if SEEKBAR_RESOLUTION
403 //! If true, seeking will be done using a
404 //! percentage (with fractions) instead of time.
405 bool relative_seeking;
406#endif
407 bool precise_seeking; //! Enable precise_seeking (only available with mpv)
408
409 bool reset_stop; //! Pressing the stop button resets the position
410
411 //! If true, the left click in the video is delayed some ms
412 //! to check if the user double clicked
413 bool delay_left_click;
414
415 QString language;
416 QString iconset;
417
418 //! Number of times to show the balloon remembering that the program
419 //! is still running in the system tray.
420 int balloon_count;
421
422 //! If true, the position of the main window will be saved before
423 //! entering in fullscreen and will restore when going back to
424 //! window mode.
425 bool restore_pos_after_fullscreen;
426
427 bool save_window_size_on_exit;
428
429 //! Close the main window when a file or playlist finish
430 bool close_on_finish;
431
432#ifdef AUTO_SHUTDOWN_PC
433 bool auto_shutdown_pc;
434#endif
435
436 QString default_font;
437
438 //!< Pause the current file when the main window is not visible
439 bool pause_when_hidden;
440
441 //!< Allow frre movement of the video window
442 bool allow_video_movement;
443
444 QString gui; //!< The name of the GUI to use
445
446#if USE_MINIMUMSIZE
447 int gui_minimum_width;
448#endif
449 QSize default_size; // Default size of the main window
450
451#if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
452 bool hide_video_window_on_audio_files;
453#endif
454
455 bool report_mplayer_crashes;
456
457#if REPORT_OLD_MPLAYER
458 bool reported_mplayer_is_old;
459#endif
460
461 bool auto_add_to_playlist; //!< Add files to open to playlist
462 AutoAddToPlaylistFilter media_to_add_to_playlist;
463
464#if LOGO_ANIMATION
465 bool animated_logo;
466#endif
467
468
469 /* ********
470 TV (dvb)
471 ******** */
472#ifdef TV_SUPPORT
473 bool check_channels_conf_on_startup;
474 int initial_tv_deinterlace;
475 QString last_dvb_channel;
476 QString last_tv_channel;
477#endif
478
479
480 /* ********
481 Network
482 ******** */
483
484 // Streaming
485 int streaming_type;
486 #ifdef YOUTUBE_SUPPORT
487 int yt_quality;
488 QString yt_user_agent;
489 bool yt_use_https_main;
490 bool yt_use_https_vi;
491 #endif
492
493 // Proxy
494 bool use_proxy;
495 int proxy_type;
496 QString proxy_host;
497 int proxy_port;
498 QString proxy_username;
499 QString proxy_password;
500
501
502 /* ***********
503 Directories
504 *********** */
505
506 QString latest_dir; //!< Directory of the latest file loaded
507 QString last_dvd_directory;
508 bool save_dirs; // Save or not the latest dirs
509
510 /* **************
511 Initial values
512 ************** */
513
514 double initial_sub_scale;
515 double initial_sub_scale_ass;
516 int initial_volume;
517 int initial_contrast;
518 int initial_brightness;
519 int initial_hue;
520 int initial_saturation;
521 int initial_gamma;
522
523 AudioEqualizerList initial_audio_equalizer;
524
525 //! Default value for zoom (1.0 = no zoom)
526 double initial_zoom_factor;
527
528 //! Default value for position of subtitles on screen
529 //! 100 = 100% at the bottom
530 int initial_sub_pos;
531
532#ifdef INITIAL_BLACKBORDERS
533 bool initial_blackborders;
534#endif
535
536 bool initial_postprocessing; //!< global postprocessing filter
537 bool initial_volnorm;
538
539 int initial_deinterlace;
540
541 int initial_audio_channels;
542 int initial_stereo_mode;
543
544 int initial_audio_track;
545 int initial_subtitle_track;
546
547
548 /* ************
549 MPlayer info
550 ************ */
551
552 int mplayer_detected_version; //!< Latest version of mplayer parsed
553
554 //! Version of mplayer supplied by the user which will be used if
555 //! the version can't be parsed from mplayer output
556 int mplayer_user_supplied_version;
557
558#ifdef MPLAYER2_SUPPORT
559 bool mplayer_is_mplayer2; //! True if the detected version is mplayer2
560 QString mplayer2_detected_version;
561#endif
562
563
564 /* *********
565 Instances
566 ********* */
567#ifdef SINGLE_INSTANCE
568 bool use_single_instance;
569#endif
570
571
572 /* ****************
573 Floating control
574 **************** */
575
576 int floating_control_margin;
577 int floating_control_width;
578 bool floating_control_animated;
579 bool floating_display_in_compact_mode;
580 int floating_activation_area;
581 int floating_hide_delay;
582
583
584 /* *******
585 History
586 ******* */
587
588 Recents * history_recents;
589 URLHistory * history_urls;
590
591
592 /* *******
593 Filters
594 ******* */
595 Filters * filters;
596
597
598 /* *********
599 SMPlayer info
600 ********* */
601
602#ifdef CHECK_UPGRADED
603 QString smplayer_stable_version;
604 bool check_if_upgraded;
605#endif
606#ifdef FONTCACHE_DIALOG
607 QString smplayer_version;
608#endif
609
610
611 /* *********
612 Update
613 ********* */
614
615#ifdef UPDATE_CHECKER
616 UpdateCheckerData update_checker_data;
617#endif
618};
619
620Q_DECLARE_OPERATORS_FOR_FLAGS(Preferences::WheelFunctions)
621
622#endif
Note: See TracBrowser for help on using the repository browser.