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