| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2010 Ricardo Villalba <rvm@escomposlinux.org>
|
|---|
| 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 | class Recents;
|
|---|
| 33 | class URLHistory;
|
|---|
| 34 | class Filters;
|
|---|
| 35 |
|
|---|
| 36 | class Preferences {
|
|---|
| 37 |
|
|---|
| 38 | public:
|
|---|
| 39 | enum OSD { None = 0, Seek = 1, SeekTimer = 2, SeekTimerTotal = 3 };
|
|---|
| 40 | enum OnTop { NeverOnTop = 0, AlwaysOnTop = 1, WhilePlayingOnTop = 2 };
|
|---|
| 41 | enum Resize { Never = 0, Always = 1, Afterload = 2 };
|
|---|
| 42 | enum Priority { Realtime = 0, High = 1, AboveNormal = 2, Normal = 3,
|
|---|
| 43 | BelowNormal = 4, Idle = 5 };
|
|---|
| 44 | enum WheelFunction { DoNothing = 1, Seeking = 2, Volume = 4, Zoom = 8,
|
|---|
| 45 | ChangeSpeed = 16 };
|
|---|
| 46 | enum OptionState { Detect = -1, Disabled = 0, Enabled = 1 };
|
|---|
| 47 | enum H264LoopFilter { LoopDisabled = 0, LoopEnabled = 1, LoopDisabledOnHD = 2 };
|
|---|
| 48 |
|
|---|
| 49 | Q_DECLARE_FLAGS(WheelFunctions, WheelFunction);
|
|---|
| 50 |
|
|---|
| 51 | Preferences();
|
|---|
| 52 | virtual ~Preferences();
|
|---|
| 53 |
|
|---|
| 54 | virtual void reset();
|
|---|
| 55 |
|
|---|
| 56 | #ifndef NO_USE_INI_FILES
|
|---|
| 57 | void save();
|
|---|
| 58 | void load();
|
|---|
| 59 | #endif
|
|---|
| 60 |
|
|---|
| 61 | double monitor_aspect_double();
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 | /* *******
|
|---|
| 66 | General
|
|---|
| 67 | ******* */
|
|---|
| 68 |
|
|---|
| 69 | QString mplayer_bin;
|
|---|
| 70 | QString vo; // video output
|
|---|
| 71 | QString ao; // audio output
|
|---|
| 72 |
|
|---|
| 73 | bool use_screenshot;
|
|---|
| 74 | QString screenshot_directory;
|
|---|
| 75 |
|
|---|
| 76 | // SMPlayer will remember all media settings for all videos.
|
|---|
| 77 | // This options allow to disable it:
|
|---|
| 78 | bool dont_remember_media_settings; // Will not remember anything
|
|---|
| 79 | bool dont_remember_time_pos; // Will not remember time pos
|
|---|
| 80 |
|
|---|
| 81 | QString audio_lang; // Preferred audio language
|
|---|
| 82 | QString subtitle_lang; // Preferred subtitle language
|
|---|
| 83 |
|
|---|
| 84 | // Video
|
|---|
| 85 | bool use_direct_rendering;
|
|---|
| 86 | bool use_double_buffer;
|
|---|
| 87 | bool use_soft_video_eq;
|
|---|
| 88 | bool use_slices;
|
|---|
| 89 | int autoq; //!< Postprocessing quality
|
|---|
| 90 | bool add_blackborders_on_fullscreen;
|
|---|
| 91 |
|
|---|
| 92 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 93 | bool turn_screensaver_off;
|
|---|
| 94 | bool avoid_screensaver;
|
|---|
| 95 | #else
|
|---|
| 96 | bool disable_screensaver;
|
|---|
| 97 | #endif
|
|---|
| 98 |
|
|---|
| 99 | #ifndef Q_OS_WIN
|
|---|
| 100 | bool disable_video_filters_with_vdpau;
|
|---|
| 101 | #endif
|
|---|
| 102 |
|
|---|
| 103 | // Audio
|
|---|
| 104 | bool use_soft_vol;
|
|---|
| 105 | int softvol_max;
|
|---|
| 106 | OptionState use_scaletempo;
|
|---|
| 107 | bool use_hwac3; // -afm hwac3
|
|---|
| 108 | bool use_audio_equalizer;
|
|---|
| 109 |
|
|---|
| 110 | // Global volume options
|
|---|
| 111 | bool global_volume;
|
|---|
| 112 | int volume;
|
|---|
| 113 | bool mute;
|
|---|
| 114 |
|
|---|
| 115 | bool autosync;
|
|---|
| 116 | int autosync_factor;
|
|---|
| 117 |
|
|---|
| 118 | // For the -mc option
|
|---|
| 119 | bool use_mc;
|
|---|
| 120 | double mc_value;
|
|---|
| 121 |
|
|---|
| 122 | // Misc
|
|---|
| 123 | int osd;
|
|---|
| 124 | int osd_delay; //<! Delay in ms to show the OSD.
|
|---|
| 125 |
|
|---|
| 126 | QString file_settings_method; //!< Method to be used for saving file settings
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 | /* ***************
|
|---|
| 130 | Drives (CD/DVD)
|
|---|
| 131 | *************** */
|
|---|
| 132 |
|
|---|
| 133 | QString dvd_device;
|
|---|
| 134 | QString cdrom_device;
|
|---|
| 135 |
|
|---|
| 136 | #ifdef Q_OS_WIN
|
|---|
| 137 | bool enable_audiocd_on_windows;
|
|---|
| 138 | #endif
|
|---|
| 139 |
|
|---|
| 140 | int vcd_initial_title;
|
|---|
| 141 |
|
|---|
| 142 | #if DVDNAV_SUPPORT
|
|---|
| 143 | bool use_dvdnav; //!< Opens DVDs using dvdnav: instead of dvd:
|
|---|
| 144 | #endif
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 | /* ***********
|
|---|
| 148 | Performance
|
|---|
| 149 | *********** */
|
|---|
| 150 |
|
|---|
| 151 | int priority;
|
|---|
| 152 | bool frame_drop;
|
|---|
| 153 | bool hard_frame_drop;
|
|---|
| 154 | bool coreavc;
|
|---|
| 155 | H264LoopFilter h264_skip_loop_filter;
|
|---|
| 156 | int HD_height; //!< An HD is a video which height is equal or greater than this.
|
|---|
| 157 |
|
|---|
| 158 | OptionState fast_audio_change; // If activated, not restart mplayer
|
|---|
| 159 | #if !SMART_DVD_CHAPTERS
|
|---|
| 160 | bool fast_chapter_change;
|
|---|
| 161 | #endif
|
|---|
| 162 |
|
|---|
| 163 | int threads; //!< number of threads to use for decoding (-lavdopts threads <1-8>)
|
|---|
| 164 |
|
|---|
| 165 | int cache_for_files;
|
|---|
| 166 | int cache_for_streams;
|
|---|
| 167 | int cache_for_dvds;
|
|---|
| 168 | int cache_for_vcds;
|
|---|
| 169 | int cache_for_audiocds;
|
|---|
| 170 | int cache_for_tv;
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 | /* *********
|
|---|
| 174 | Subtitles
|
|---|
| 175 | ********* */
|
|---|
| 176 |
|
|---|
| 177 | QString font_file;
|
|---|
| 178 | QString font_name;
|
|---|
| 179 | bool use_fontconfig;
|
|---|
| 180 | QString subcp; // -subcp
|
|---|
| 181 | bool use_enca;
|
|---|
| 182 | QString enca_lang;
|
|---|
| 183 | int font_autoscale; // -subfont-autoscale
|
|---|
| 184 | int subfuzziness;
|
|---|
| 185 | bool autoload_sub;
|
|---|
| 186 |
|
|---|
| 187 | bool use_ass_subtitles;
|
|---|
| 188 | int ass_line_spacing;
|
|---|
| 189 |
|
|---|
| 190 | bool use_closed_caption_subs;
|
|---|
| 191 | bool use_forced_subs_only;
|
|---|
| 192 |
|
|---|
| 193 | bool sub_visibility;
|
|---|
| 194 |
|
|---|
| 195 | bool subtitles_on_screenshots;
|
|---|
| 196 |
|
|---|
| 197 | //! Use the new sub_vob, sub_demux and sub_file commands
|
|---|
| 198 | //! instead of sub_select
|
|---|
| 199 | OptionState use_new_sub_commands;
|
|---|
| 200 | OptionState change_sub_scale_should_restart;
|
|---|
| 201 |
|
|---|
| 202 | //! If true, loading an external subtitle will be done
|
|---|
| 203 | //! by using the sub_load slave command. Otherwise
|
|---|
| 204 | //! mplayer will be restarted.
|
|---|
| 205 | bool fast_load_sub;
|
|---|
| 206 |
|
|---|
| 207 | // ASS styles
|
|---|
| 208 | AssStyles ass_styles;
|
|---|
| 209 | bool force_ass_styles; // Use ass styles even for ass files
|
|---|
| 210 | QString user_forced_ass_style; //!< Specifies a style defined by the user to be used with -ass-force-style
|
|---|
| 211 |
|
|---|
| 212 | //! If false, options requiring freetype won't be used
|
|---|
| 213 | bool freetype_support;
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 | /* ********
|
|---|
| 217 | Advanced
|
|---|
| 218 | ******** */
|
|---|
| 219 |
|
|---|
| 220 | #if USE_ADAPTER
|
|---|
| 221 | int adapter; //Screen for overlay. If -1 it won't be used.
|
|---|
| 222 | #endif
|
|---|
| 223 |
|
|---|
| 224 | #if USE_COLORKEY
|
|---|
| 225 | unsigned int color_key;
|
|---|
| 226 | #endif
|
|---|
| 227 |
|
|---|
| 228 | bool use_mplayer_window;
|
|---|
| 229 |
|
|---|
| 230 | QString monitor_aspect;
|
|---|
| 231 |
|
|---|
| 232 | bool use_idx; //!< Use -idx
|
|---|
| 233 |
|
|---|
| 234 | // Let the user pass options to mplayer
|
|---|
| 235 | QString mplayer_additional_options;
|
|---|
| 236 | QString mplayer_additional_video_filters;
|
|---|
| 237 | QString mplayer_additional_audio_filters;
|
|---|
| 238 |
|
|---|
| 239 | // Logs
|
|---|
| 240 | bool log_mplayer;
|
|---|
| 241 | bool log_smplayer;
|
|---|
| 242 | QString log_filter;
|
|---|
| 243 | bool verbose_log;
|
|---|
| 244 | bool save_smplayer_log;
|
|---|
| 245 |
|
|---|
| 246 | //mplayer log autosaving
|
|---|
| 247 | bool autosave_mplayer_log;
|
|---|
| 248 | QString mplayer_log_saveto;
|
|---|
| 249 | //mplayer log autosaving end
|
|---|
| 250 |
|
|---|
| 251 | #if REPAINT_BACKGROUND_OPTION
|
|---|
| 252 | //! If true, mplayerlayer erases its background
|
|---|
| 253 | bool repaint_video_background;
|
|---|
| 254 | #endif
|
|---|
| 255 |
|
|---|
| 256 | //! If true it will autoload edl files with the same name of the file
|
|---|
| 257 | //! to play
|
|---|
| 258 | bool use_edl_files;
|
|---|
| 259 |
|
|---|
| 260 | //! Preferred connection method: ipv4 or ipv6
|
|---|
| 261 | bool prefer_ipv4;
|
|---|
| 262 |
|
|---|
| 263 | //! Windows only. If true, smplayer will pass short filenames to mplayer.
|
|---|
| 264 | //! To workaround a bug in mplayer.
|
|---|
| 265 | bool use_short_pathnames;
|
|---|
| 266 |
|
|---|
| 267 | //! If false, -brightness, -contrast and so on, won't be passed to
|
|---|
| 268 | //! mplayer. It seems that some graphic cards don't support those options.
|
|---|
| 269 | bool change_video_equalizer_on_startup;
|
|---|
| 270 |
|
|---|
| 271 | //! If true, smplayer will use the prefix pausing_keep_force to keep
|
|---|
| 272 | //! the pause on slave commands. This experimental prefix was added
|
|---|
| 273 | //! in mplayer svn r27665.
|
|---|
| 274 | bool use_pausing_keep_force;
|
|---|
| 275 |
|
|---|
| 276 | OptionState use_correct_pts; //!< Pass -correct-pts to mplayer
|
|---|
| 277 |
|
|---|
| 278 | QString actions_to_run; //!< List of actions to run every time a video loads.
|
|---|
| 279 |
|
|---|
| 280 |
|
|---|
| 281 | /* *********
|
|---|
| 282 | GUI stuff
|
|---|
| 283 | ********* */
|
|---|
| 284 |
|
|---|
| 285 | bool fullscreen;
|
|---|
| 286 | bool start_in_fullscreen;
|
|---|
| 287 | bool compact_mode;
|
|---|
| 288 | OnTop stay_on_top;
|
|---|
| 289 | int size_factor;
|
|---|
| 290 |
|
|---|
| 291 | int resize_method; //!< Mainwindow resize method
|
|---|
| 292 |
|
|---|
| 293 | #if STYLE_SWITCHING
|
|---|
| 294 | QString style; //!< SMPlayer look
|
|---|
| 295 | #endif
|
|---|
| 296 | bool show_motion_vectors;
|
|---|
| 297 |
|
|---|
| 298 | // Function of mouse buttons:
|
|---|
| 299 | QString mouse_left_click_function;
|
|---|
| 300 | QString mouse_right_click_function;
|
|---|
| 301 | QString mouse_double_click_function;
|
|---|
| 302 | QString mouse_middle_click_function;
|
|---|
| 303 | QString mouse_xbutton1_click_function;
|
|---|
| 304 | QString mouse_xbutton2_click_function;
|
|---|
| 305 | int wheel_function;
|
|---|
| 306 |
|
|---|
| 307 | QFlags<WheelFunctions> wheel_function_cycle;
|
|---|
| 308 |
|
|---|
| 309 | bool wheel_function_seeking_reverse;
|
|---|
| 310 |
|
|---|
| 311 | // Configurable seeking
|
|---|
| 312 | int seeking1; // By default 10s
|
|---|
| 313 | int seeking2; // By default 1m
|
|---|
| 314 | int seeking3; // By default 10m
|
|---|
| 315 | int seeking4; // For mouse wheel, by default 30s
|
|---|
| 316 |
|
|---|
| 317 | bool update_while_seeking;
|
|---|
| 318 | #if ENABLE_DELAYED_DRAGGING
|
|---|
| 319 | int time_slider_drag_delay;
|
|---|
| 320 | #endif
|
|---|
| 321 | #if SEEKBAR_RESOLUTION
|
|---|
| 322 | //! If true, seeking will be done using a
|
|---|
| 323 | //! percentage (with fractions) instead of time.
|
|---|
| 324 | bool relative_seeking;
|
|---|
| 325 | #endif
|
|---|
| 326 |
|
|---|
| 327 | QString language;
|
|---|
| 328 | QString iconset;
|
|---|
| 329 |
|
|---|
| 330 | //! Number of times to show the balloon remembering that the program
|
|---|
| 331 | //! is still running in the system tray.
|
|---|
| 332 | int balloon_count;
|
|---|
| 333 |
|
|---|
| 334 | //! If true, the position of the main window will be saved before
|
|---|
| 335 | //! entering in fullscreen and will restore when going back to
|
|---|
| 336 | //! window mode.
|
|---|
| 337 | bool restore_pos_after_fullscreen;
|
|---|
| 338 |
|
|---|
| 339 | bool save_window_size_on_exit;
|
|---|
| 340 |
|
|---|
| 341 | //! Close the main window when a file or playlist finish
|
|---|
| 342 | bool close_on_finish;
|
|---|
| 343 |
|
|---|
| 344 | QString default_font;
|
|---|
| 345 |
|
|---|
| 346 | //!< Pause the current file when the main window is not visible
|
|---|
| 347 | bool pause_when_hidden;
|
|---|
| 348 |
|
|---|
| 349 | //!< Allow frre movement of the video window
|
|---|
| 350 | bool allow_video_movement;
|
|---|
| 351 |
|
|---|
| 352 | QString gui; //!< The name of the GUI to use
|
|---|
| 353 |
|
|---|
| 354 | #if USE_MINIMUMSIZE
|
|---|
| 355 | int gui_minimum_width;
|
|---|
| 356 | #endif
|
|---|
| 357 | QSize default_size; // Default size of the main window
|
|---|
| 358 |
|
|---|
| 359 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
|---|
| 360 | bool hide_video_window_on_audio_files;
|
|---|
| 361 | #endif
|
|---|
| 362 |
|
|---|
| 363 | bool report_mplayer_crashes;
|
|---|
| 364 |
|
|---|
| 365 | #if REPORT_OLD_MPLAYER
|
|---|
| 366 | bool reported_mplayer_is_old;
|
|---|
| 367 | #endif
|
|---|
| 368 |
|
|---|
| 369 | bool auto_add_to_playlist; //!< Add files to open to playlist
|
|---|
| 370 | bool add_to_playlist_consecutive_files;
|
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 | /* ********
|
|---|
| 374 | TV (dvb)
|
|---|
| 375 | ******** */
|
|---|
| 376 |
|
|---|
| 377 | bool check_channels_conf_on_startup;
|
|---|
| 378 | int initial_tv_deinterlace;
|
|---|
| 379 | QString last_dvb_channel;
|
|---|
| 380 | QString last_tv_channel;
|
|---|
| 381 |
|
|---|
| 382 |
|
|---|
| 383 | /* ***********
|
|---|
| 384 | Directories
|
|---|
| 385 | *********** */
|
|---|
| 386 |
|
|---|
| 387 | QString latest_dir; //!< Directory of the latest file loaded
|
|---|
| 388 | QString last_dvd_directory;
|
|---|
| 389 |
|
|---|
| 390 |
|
|---|
| 391 | /* **************
|
|---|
| 392 | Initial values
|
|---|
| 393 | ************** */
|
|---|
| 394 |
|
|---|
| 395 | double initial_sub_scale;
|
|---|
| 396 | double initial_sub_scale_ass;
|
|---|
| 397 | int initial_volume;
|
|---|
| 398 | int initial_contrast;
|
|---|
| 399 | int initial_brightness;
|
|---|
| 400 | int initial_hue;
|
|---|
| 401 | int initial_saturation;
|
|---|
| 402 | int initial_gamma;
|
|---|
| 403 |
|
|---|
| 404 | AudioEqualizerList initial_audio_equalizer;
|
|---|
| 405 |
|
|---|
| 406 | //! Default value for zoom (1.0 = no zoom)
|
|---|
| 407 | double initial_zoom_factor;
|
|---|
| 408 |
|
|---|
| 409 | //! Default value for position of subtitles on screen
|
|---|
| 410 | //! 100 = 100% at the bottom
|
|---|
| 411 | int initial_sub_pos;
|
|---|
| 412 |
|
|---|
| 413 | bool initial_postprocessing; //!< global postprocessing filter
|
|---|
| 414 | bool initial_volnorm;
|
|---|
| 415 |
|
|---|
| 416 | int initial_deinterlace;
|
|---|
| 417 |
|
|---|
| 418 | int initial_audio_channels;
|
|---|
| 419 | int initial_stereo_mode;
|
|---|
| 420 |
|
|---|
| 421 | int initial_audio_track;
|
|---|
| 422 | int initial_subtitle_track;
|
|---|
| 423 |
|
|---|
| 424 |
|
|---|
| 425 | /* ************
|
|---|
| 426 | MPlayer info
|
|---|
| 427 | ************ */
|
|---|
| 428 |
|
|---|
| 429 | int mplayer_detected_version; //!< Latest version of mplayer parsed
|
|---|
| 430 |
|
|---|
| 431 | //! Version of mplayer supplied by the user which will be used if
|
|---|
| 432 | //! the version can't be parsed from mplayer output
|
|---|
| 433 | int mplayer_user_supplied_version;
|
|---|
| 434 |
|
|---|
| 435 |
|
|---|
| 436 | /* *********
|
|---|
| 437 | Instances
|
|---|
| 438 | ********* */
|
|---|
| 439 |
|
|---|
| 440 | bool use_single_instance;
|
|---|
| 441 | int connection_port; // Manual port
|
|---|
| 442 | bool use_autoport;
|
|---|
| 443 | int autoport; // Port automatically chosen by Qt
|
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 | /* ****************
|
|---|
| 447 | Floating control
|
|---|
| 448 | **************** */
|
|---|
| 449 |
|
|---|
| 450 | int floating_control_margin;
|
|---|
| 451 | int floating_control_width;
|
|---|
| 452 | bool floating_control_animated;
|
|---|
| 453 | bool floating_display_in_compact_mode;
|
|---|
| 454 | #ifndef Q_OS_WIN
|
|---|
| 455 | bool bypass_window_manager;
|
|---|
| 456 | #endif
|
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 | /* *******
|
|---|
| 460 | History
|
|---|
| 461 | ******* */
|
|---|
| 462 |
|
|---|
| 463 | Recents * history_recents;
|
|---|
| 464 | URLHistory * history_urls;
|
|---|
| 465 |
|
|---|
| 466 |
|
|---|
| 467 | /* *******
|
|---|
| 468 | Filters
|
|---|
| 469 | ******* */
|
|---|
| 470 | Filters * filters;
|
|---|
| 471 | };
|
|---|
| 472 | Q_DECLARE_OPERATORS_FOR_FLAGS(Preferences::WheelFunctions)
|
|---|
| 473 |
|
|---|
| 474 | #endif
|
|---|