| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2013 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 | #include "preferences.h"
|
|---|
| 20 | #include "global.h"
|
|---|
| 21 | #include "paths.h"
|
|---|
| 22 | #include "mediasettings.h"
|
|---|
| 23 | #include "recents.h"
|
|---|
| 24 | #include "urlhistory.h"
|
|---|
| 25 | #include "filters.h"
|
|---|
| 26 |
|
|---|
| 27 | #include <QSettings>
|
|---|
| 28 | #include <QFileInfo>
|
|---|
| 29 | #include <QRegExp>
|
|---|
| 30 | #include <QDir>
|
|---|
| 31 | #include <QLocale>
|
|---|
| 32 |
|
|---|
| 33 | #if QT_VERSION >= 0x040400
|
|---|
| 34 | #include <QDesktopServices>
|
|---|
| 35 | #endif
|
|---|
| 36 |
|
|---|
| 37 | #ifdef YOUTUBE_SUPPORT
|
|---|
| 38 | #include "retrieveyoutubeurl.h"
|
|---|
| 39 | #endif
|
|---|
| 40 |
|
|---|
| 41 | #define CURRENT_CONFIG_VERSION 4
|
|---|
| 42 |
|
|---|
| 43 | using namespace Global;
|
|---|
| 44 |
|
|---|
| 45 | Preferences::Preferences() {
|
|---|
| 46 | history_recents = new Recents;
|
|---|
| 47 | history_urls = new URLHistory;
|
|---|
| 48 | filters = new Filters;
|
|---|
| 49 |
|
|---|
| 50 | reset();
|
|---|
| 51 |
|
|---|
| 52 | #ifndef NO_USE_INI_FILES
|
|---|
| 53 | load();
|
|---|
| 54 | #endif
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | Preferences::~Preferences() {
|
|---|
| 58 | #ifndef NO_USE_INI_FILES
|
|---|
| 59 | save();
|
|---|
| 60 | #endif
|
|---|
| 61 |
|
|---|
| 62 | delete history_recents;
|
|---|
| 63 | delete history_urls;
|
|---|
| 64 | delete filters;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | void Preferences::reset() {
|
|---|
| 68 | /* *******
|
|---|
| 69 | General
|
|---|
| 70 | ******* */
|
|---|
| 71 |
|
|---|
| 72 | config_version = CURRENT_CONFIG_VERSION;
|
|---|
| 73 |
|
|---|
| 74 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 75 | mplayer_bin= "mplayer/mplayer.exe";
|
|---|
| 76 | #else
|
|---|
| 77 | mplayer_bin = "mplayer";
|
|---|
| 78 | #endif
|
|---|
| 79 |
|
|---|
| 80 | vo = "";
|
|---|
| 81 | ao = "";
|
|---|
| 82 |
|
|---|
| 83 | use_screenshot = true;
|
|---|
| 84 | screenshot_directory="";
|
|---|
| 85 | #ifdef PORTABLE_APP
|
|---|
| 86 | screenshot_directory= "./screenshots";
|
|---|
| 87 | #else
|
|---|
| 88 | #if QT_VERSION < 0x040400
|
|---|
| 89 | QString default_screenshot_path = Paths::configPath() + "/screenshots";
|
|---|
| 90 | if (QFile::exists(default_screenshot_path)) {
|
|---|
| 91 | screenshot_directory = default_screenshot_path;
|
|---|
| 92 | }
|
|---|
| 93 | #endif
|
|---|
| 94 | #endif
|
|---|
| 95 |
|
|---|
| 96 | dont_remember_media_settings = false;
|
|---|
| 97 | dont_remember_time_pos = false;
|
|---|
| 98 |
|
|---|
| 99 | audio_lang = "";
|
|---|
| 100 | subtitle_lang = "";
|
|---|
| 101 |
|
|---|
| 102 | use_direct_rendering = false;
|
|---|
| 103 | use_double_buffer = true;
|
|---|
| 104 |
|
|---|
| 105 | use_soft_video_eq = false;
|
|---|
| 106 | use_slices = false;
|
|---|
| 107 | autoq = 6;
|
|---|
| 108 | add_blackborders_on_fullscreen = false;
|
|---|
| 109 |
|
|---|
| 110 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 111 | turn_screensaver_off = false;
|
|---|
| 112 | avoid_screensaver = true;
|
|---|
| 113 | #else
|
|---|
| 114 | disable_screensaver = true;
|
|---|
| 115 | #endif
|
|---|
| 116 |
|
|---|
| 117 | #ifndef Q_OS_WIN
|
|---|
| 118 | vdpau.ffh264vdpau = true;
|
|---|
| 119 | vdpau.ffmpeg12vdpau = true;
|
|---|
| 120 | vdpau.ffwmv3vdpau = true;
|
|---|
| 121 | vdpau.ffvc1vdpau = true;
|
|---|
| 122 | vdpau.ffodivxvdpau = false;
|
|---|
| 123 | vdpau.disable_video_filters = true;
|
|---|
| 124 | #endif
|
|---|
| 125 |
|
|---|
| 126 | use_soft_vol = true;
|
|---|
| 127 | softvol_max = 110; // 110 = default value in mplayer
|
|---|
| 128 | use_scaletempo = Detect;
|
|---|
| 129 | use_hwac3 = false;
|
|---|
| 130 | use_audio_equalizer = true;
|
|---|
| 131 |
|
|---|
| 132 | global_volume = true;
|
|---|
| 133 | volume = 50;
|
|---|
| 134 | mute = false;
|
|---|
| 135 |
|
|---|
| 136 | autosync = false;
|
|---|
| 137 | autosync_factor = 100;
|
|---|
| 138 |
|
|---|
| 139 | use_mc = false;
|
|---|
| 140 | mc_value = 0;
|
|---|
| 141 |
|
|---|
| 142 | osd = None;
|
|---|
| 143 | osd_delay = 2200;
|
|---|
| 144 |
|
|---|
| 145 | file_settings_method = "hash"; // Possible values: normal & hash
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 | /* ***************
|
|---|
| 149 | Drives (CD/DVD)
|
|---|
| 150 | *************** */
|
|---|
| 151 |
|
|---|
| 152 | dvd_device = "";
|
|---|
| 153 | cdrom_device = "";
|
|---|
| 154 |
|
|---|
| 155 | #ifndef Q_OS_WIN
|
|---|
| 156 | // Try to set default values
|
|---|
| 157 | if (QFile::exists("/dev/dvd")) dvd_device = "/dev/dvd";
|
|---|
| 158 | if (QFile::exists("/dev/cdrom")) cdrom_device = "/dev/cdrom";
|
|---|
| 159 | #endif
|
|---|
| 160 |
|
|---|
| 161 | #ifdef Q_OS_WIN
|
|---|
| 162 | enable_audiocd_on_windows = false;
|
|---|
| 163 | #endif
|
|---|
| 164 |
|
|---|
| 165 | vcd_initial_title = 2; // Most VCD's start at title #2
|
|---|
| 166 |
|
|---|
| 167 | #if DVDNAV_SUPPORT
|
|---|
| 168 | use_dvdnav = false;
|
|---|
| 169 | #endif
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 | /* ***********
|
|---|
| 173 | Performance
|
|---|
| 174 | *********** */
|
|---|
| 175 |
|
|---|
| 176 | priority = AboveNormal; // Option only for windows
|
|---|
| 177 | frame_drop = false;
|
|---|
| 178 | hard_frame_drop = false;
|
|---|
| 179 | coreavc = false;
|
|---|
| 180 | h264_skip_loop_filter = LoopEnabled;
|
|---|
| 181 | HD_height = 720;
|
|---|
| 182 |
|
|---|
| 183 | // MPlayer 1.0rc1 require restart, new versions don't
|
|---|
| 184 | fast_audio_change = Detect;
|
|---|
| 185 | #if !SMART_DVD_CHAPTERS
|
|---|
| 186 | fast_chapter_change = false;
|
|---|
| 187 | #endif
|
|---|
| 188 |
|
|---|
| 189 | threads = 1;
|
|---|
| 190 |
|
|---|
| 191 | cache_for_files = 2048;
|
|---|
| 192 | cache_for_streams = 2048;
|
|---|
| 193 | cache_for_dvds = 0; // not recommended to use cache for dvds
|
|---|
| 194 | cache_for_vcds = 1024;
|
|---|
| 195 | cache_for_audiocds = 1024;
|
|---|
| 196 | cache_for_tv = 3000;
|
|---|
| 197 |
|
|---|
| 198 | #ifdef YOUTUBE_SUPPORT
|
|---|
| 199 | yt_quality = RetrieveYoutubeUrl::MP4_720p;
|
|---|
| 200 | yt_user_agent = QString::null;
|
|---|
| 201 | #endif
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 | /* *********
|
|---|
| 205 | Subtitles
|
|---|
| 206 | ********* */
|
|---|
| 207 |
|
|---|
| 208 | font_file = "";
|
|---|
| 209 | font_name = "";
|
|---|
| 210 | use_fontconfig = false;
|
|---|
| 211 | subcp = "ISO-8859-1";
|
|---|
| 212 | use_enca = false;
|
|---|
| 213 | enca_lang = QString(QLocale::system().name()).section("_",0,0);
|
|---|
| 214 | font_autoscale = 1;
|
|---|
| 215 | subfuzziness = 1;
|
|---|
| 216 | autoload_sub = true;
|
|---|
| 217 |
|
|---|
| 218 | use_ass_subtitles = true;
|
|---|
| 219 | ass_line_spacing = 0;
|
|---|
| 220 |
|
|---|
| 221 | use_forced_subs_only = false;
|
|---|
| 222 |
|
|---|
| 223 | sub_visibility = true;
|
|---|
| 224 |
|
|---|
| 225 | subtitles_on_screenshots = false;
|
|---|
| 226 |
|
|---|
| 227 | use_new_sub_commands = Detect;
|
|---|
| 228 | change_sub_scale_should_restart = Detect;
|
|---|
| 229 |
|
|---|
| 230 | fast_load_sub = true;
|
|---|
| 231 |
|
|---|
| 232 | // ASS styles
|
|---|
| 233 | // Nothing to do, default values are given in
|
|---|
| 234 | // AssStyles constructor
|
|---|
| 235 |
|
|---|
| 236 | force_ass_styles = false;
|
|---|
| 237 | user_forced_ass_style.clear();
|
|---|
| 238 |
|
|---|
| 239 | freetype_support = true;
|
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 | /* ********
|
|---|
| 243 | Advanced
|
|---|
| 244 | ******** */
|
|---|
| 245 |
|
|---|
| 246 | #if USE_ADAPTER
|
|---|
| 247 | adapter = -1;
|
|---|
| 248 | #endif
|
|---|
| 249 |
|
|---|
| 250 | #if USE_COLORKEY
|
|---|
| 251 | color_key = 0x020202;
|
|---|
| 252 | #endif
|
|---|
| 253 |
|
|---|
| 254 | use_mplayer_window = false;
|
|---|
| 255 |
|
|---|
| 256 | monitor_aspect=""; // Autodetect
|
|---|
| 257 |
|
|---|
| 258 | use_idx = false;
|
|---|
| 259 |
|
|---|
| 260 | mplayer_additional_options="";
|
|---|
| 261 | #ifdef PORTABLE_APP
|
|---|
| 262 | mplayer_additional_options="-nofontconfig";
|
|---|
| 263 | #endif
|
|---|
| 264 | mplayer_additional_video_filters="";
|
|---|
| 265 | mplayer_additional_audio_filters="";
|
|---|
| 266 |
|
|---|
| 267 | #ifdef LOG_MPLAYER
|
|---|
| 268 | log_mplayer = true;
|
|---|
| 269 | verbose_log = false;
|
|---|
| 270 | autosave_mplayer_log = false;
|
|---|
| 271 | mplayer_log_saveto = "";
|
|---|
| 272 | #endif
|
|---|
| 273 | #ifdef LOG_SMPLAYER
|
|---|
| 274 | log_smplayer = true;
|
|---|
| 275 | log_filter = ".*";
|
|---|
| 276 | save_smplayer_log = false;
|
|---|
| 277 | #endif
|
|---|
| 278 |
|
|---|
| 279 | #if REPAINT_BACKGROUND_OPTION
|
|---|
| 280 | // "Repaint video background" in the preferences dialog
|
|---|
| 281 | #ifndef Q_OS_WIN
|
|---|
| 282 | repaint_video_background = false;
|
|---|
| 283 | #else
|
|---|
| 284 | repaint_video_background = true;
|
|---|
| 285 | #endif
|
|---|
| 286 | #endif
|
|---|
| 287 |
|
|---|
| 288 | use_edl_files = true;
|
|---|
| 289 |
|
|---|
| 290 | prefer_ipv4 = true;
|
|---|
| 291 |
|
|---|
| 292 | use_short_pathnames = false;
|
|---|
| 293 |
|
|---|
| 294 | change_video_equalizer_on_startup = true;
|
|---|
| 295 |
|
|---|
| 296 | use_pausing_keep_force = true;
|
|---|
| 297 |
|
|---|
| 298 | use_correct_pts = Detect;
|
|---|
| 299 |
|
|---|
| 300 | actions_to_run = "";
|
|---|
| 301 |
|
|---|
| 302 | show_tag_in_window_title = true;
|
|---|
| 303 |
|
|---|
| 304 | time_to_kill_mplayer = 1000;
|
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 | /* *********
|
|---|
| 308 | GUI stuff
|
|---|
| 309 | ********* */
|
|---|
| 310 |
|
|---|
| 311 | fullscreen = false;
|
|---|
| 312 | start_in_fullscreen = false;
|
|---|
| 313 | compact_mode = false;
|
|---|
| 314 | stay_on_top = NeverOnTop;
|
|---|
| 315 | size_factor = 100; // 100%
|
|---|
| 316 |
|
|---|
| 317 | resize_method = Never;
|
|---|
| 318 |
|
|---|
| 319 | #if STYLE_SWITCHING
|
|---|
| 320 | style="";
|
|---|
| 321 | #endif
|
|---|
| 322 |
|
|---|
| 323 | move_when_dragging = false;
|
|---|
| 324 |
|
|---|
| 325 |
|
|---|
| 326 | #if DVDNAV_SUPPORT
|
|---|
| 327 | mouse_left_click_function = "dvdnav_mouse";
|
|---|
| 328 | #else
|
|---|
| 329 | mouse_left_click_function = "";
|
|---|
| 330 | #endif
|
|---|
| 331 | mouse_right_click_function = "show_context_menu";
|
|---|
| 332 | mouse_double_click_function = "fullscreen";
|
|---|
| 333 | mouse_middle_click_function = "mute";
|
|---|
| 334 | mouse_xbutton1_click_function = "";
|
|---|
| 335 | mouse_xbutton2_click_function = "";
|
|---|
| 336 | wheel_function = Seeking;
|
|---|
| 337 | wheel_function_cycle = Seeking | Volume | Zoom | ChangeSpeed;
|
|---|
| 338 | wheel_function_seeking_reverse = false;
|
|---|
| 339 |
|
|---|
| 340 | seeking1 = 10;
|
|---|
| 341 | seeking2 = 60;
|
|---|
| 342 | seeking3 = 10*60;
|
|---|
| 343 | seeking4 = 30;
|
|---|
| 344 |
|
|---|
| 345 | update_while_seeking = false;
|
|---|
| 346 | #if ENABLE_DELAYED_DRAGGING
|
|---|
| 347 | time_slider_drag_delay = 100;
|
|---|
| 348 | #endif
|
|---|
| 349 | #if SEEKBAR_RESOLUTION
|
|---|
| 350 | relative_seeking = false;
|
|---|
| 351 | #endif
|
|---|
| 352 | precise_seeking = true;
|
|---|
| 353 |
|
|---|
| 354 | reset_stop = false;
|
|---|
| 355 |
|
|---|
| 356 | language = "";
|
|---|
| 357 |
|
|---|
| 358 | balloon_count = 5;
|
|---|
| 359 |
|
|---|
| 360 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 361 | restore_pos_after_fullscreen = true;
|
|---|
| 362 | #else
|
|---|
| 363 | restore_pos_after_fullscreen = false;
|
|---|
| 364 | #endif
|
|---|
| 365 |
|
|---|
| 366 | save_window_size_on_exit = true;
|
|---|
| 367 |
|
|---|
| 368 | close_on_finish = false;
|
|---|
| 369 |
|
|---|
| 370 | default_font = "";
|
|---|
| 371 |
|
|---|
| 372 | pause_when_hidden = false;
|
|---|
| 373 |
|
|---|
| 374 | allow_video_movement = false;
|
|---|
| 375 |
|
|---|
| 376 | #ifdef SKINS
|
|---|
| 377 | gui = "SkinGUI";
|
|---|
| 378 | iconset = "Gonzo";
|
|---|
| 379 | #else
|
|---|
| 380 | gui = "DefaultGUI";
|
|---|
| 381 | iconset = "";
|
|---|
| 382 | #endif
|
|---|
| 383 |
|
|---|
| 384 | #if USE_MINIMUMSIZE
|
|---|
| 385 | gui_minimum_width = 0; // 0 == disabled
|
|---|
| 386 | #endif
|
|---|
| 387 | default_size = QSize(683, 509);
|
|---|
| 388 |
|
|---|
| 389 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
|---|
| 390 | hide_video_window_on_audio_files = true;
|
|---|
| 391 | #endif
|
|---|
| 392 |
|
|---|
| 393 | report_mplayer_crashes = true;
|
|---|
| 394 |
|
|---|
| 395 | #if REPORT_OLD_MPLAYER
|
|---|
| 396 | reported_mplayer_is_old = false;
|
|---|
| 397 | #endif
|
|---|
| 398 |
|
|---|
| 399 | auto_add_to_playlist = true;
|
|---|
| 400 | add_to_playlist_consecutive_files = false;
|
|---|
| 401 |
|
|---|
| 402 | #if LOGO_ANIMATION
|
|---|
| 403 | animated_logo = true;
|
|---|
| 404 | #endif
|
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 | /* ********
|
|---|
| 408 | TV (dvb)
|
|---|
| 409 | ******** */
|
|---|
| 410 |
|
|---|
| 411 | check_channels_conf_on_startup = true;
|
|---|
| 412 | initial_tv_deinterlace = MediaSettings::Yadif_1;
|
|---|
| 413 | last_dvb_channel = "";
|
|---|
| 414 | last_tv_channel = "";
|
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 | /* ***********
|
|---|
| 418 | Directories
|
|---|
| 419 | *********** */
|
|---|
| 420 |
|
|---|
| 421 | latest_dir = QDir::homePath();
|
|---|
| 422 | last_dvd_directory="";
|
|---|
| 423 | save_dirs = true;
|
|---|
| 424 |
|
|---|
| 425 | /* **************
|
|---|
| 426 | Initial values
|
|---|
| 427 | ************** */
|
|---|
| 428 |
|
|---|
| 429 | initial_sub_scale = 5;
|
|---|
| 430 | initial_sub_scale_ass = 1;
|
|---|
| 431 | initial_volume = 40;
|
|---|
| 432 | initial_contrast = 0;
|
|---|
| 433 | initial_brightness = 0;
|
|---|
| 434 | initial_hue = 0;
|
|---|
| 435 | initial_saturation = 0;
|
|---|
| 436 | initial_gamma = 0;
|
|---|
| 437 |
|
|---|
| 438 | initial_audio_equalizer << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
|
|---|
| 439 |
|
|---|
| 440 | initial_zoom_factor = 1.0;
|
|---|
| 441 | initial_sub_pos = 100; // 100%
|
|---|
| 442 |
|
|---|
| 443 | initial_postprocessing = false;
|
|---|
| 444 | initial_volnorm = false;
|
|---|
| 445 |
|
|---|
| 446 | initial_deinterlace = MediaSettings::NoDeinterlace;
|
|---|
| 447 |
|
|---|
| 448 | initial_audio_channels = MediaSettings::ChDefault;
|
|---|
| 449 | initial_stereo_mode = MediaSettings::Stereo;
|
|---|
| 450 |
|
|---|
| 451 | initial_audio_track = 1;
|
|---|
| 452 | initial_subtitle_track = 1;
|
|---|
| 453 |
|
|---|
| 454 |
|
|---|
| 455 | /* ************
|
|---|
| 456 | MPlayer info
|
|---|
| 457 | ************ */
|
|---|
| 458 |
|
|---|
| 459 | mplayer_detected_version = -1; //None version parsed yet
|
|---|
| 460 | mplayer_user_supplied_version = -1;
|
|---|
| 461 | mplayer_is_mplayer2 = false;
|
|---|
| 462 | mplayer2_detected_version = QString::null;
|
|---|
| 463 |
|
|---|
| 464 |
|
|---|
| 465 | /* *********
|
|---|
| 466 | Instances
|
|---|
| 467 | ********* */
|
|---|
| 468 | #ifdef SINGLE_INSTANCE
|
|---|
| 469 | use_single_instance = true;
|
|---|
| 470 | #endif
|
|---|
| 471 |
|
|---|
| 472 |
|
|---|
| 473 | /* ****************
|
|---|
| 474 | Floating control
|
|---|
| 475 | **************** */
|
|---|
| 476 |
|
|---|
| 477 | floating_control_margin = 0;
|
|---|
| 478 | floating_control_width = 70; //70 %
|
|---|
| 479 | floating_control_animated = true;
|
|---|
| 480 | floating_display_in_compact_mode = false;
|
|---|
| 481 | #ifndef Q_OS_WIN
|
|---|
| 482 | bypass_window_manager = true;
|
|---|
| 483 | #endif
|
|---|
| 484 |
|
|---|
| 485 |
|
|---|
| 486 | /* *******
|
|---|
| 487 | History
|
|---|
| 488 | ******* */
|
|---|
| 489 |
|
|---|
| 490 | history_recents->clear();
|
|---|
| 491 | history_urls->clear();
|
|---|
| 492 |
|
|---|
| 493 |
|
|---|
| 494 | /* *******
|
|---|
| 495 | Filters
|
|---|
| 496 | ******* */
|
|---|
| 497 |
|
|---|
| 498 | filters->init();
|
|---|
| 499 |
|
|---|
| 500 |
|
|---|
| 501 | /* *********
|
|---|
| 502 | SMPlayer info
|
|---|
| 503 | ********* */
|
|---|
| 504 |
|
|---|
| 505 | #ifdef CHECK_UPGRADED
|
|---|
| 506 | smplayer_stable_version = "";
|
|---|
| 507 | check_if_upgraded = true;
|
|---|
| 508 | #endif
|
|---|
| 509 | #ifdef FONTCACHE_DIALOG
|
|---|
| 510 | smplayer_version = "";
|
|---|
| 511 | #endif
|
|---|
| 512 | }
|
|---|
| 513 |
|
|---|
| 514 | #ifndef NO_USE_INI_FILES
|
|---|
| 515 | void Preferences::save() {
|
|---|
| 516 | qDebug("Preferences::save");
|
|---|
| 517 |
|
|---|
| 518 | QSettings * set = settings;
|
|---|
| 519 |
|
|---|
| 520 |
|
|---|
| 521 | /* *******
|
|---|
| 522 | General
|
|---|
| 523 | ******* */
|
|---|
| 524 |
|
|---|
| 525 | set->beginGroup( "general");
|
|---|
| 526 |
|
|---|
| 527 | set->setValue("config_version", config_version);
|
|---|
| 528 |
|
|---|
| 529 | set->setValue("mplayer_bin", mplayer_bin);
|
|---|
| 530 | set->setValue("driver/vo", vo);
|
|---|
| 531 | set->setValue("driver/audio_output", ao);
|
|---|
| 532 |
|
|---|
| 533 | set->setValue("use_screenshot", use_screenshot);
|
|---|
| 534 | #if QT_VERSION >= 0x040400
|
|---|
| 535 | set->setValue("screenshot_folder", screenshot_directory);
|
|---|
| 536 | #else
|
|---|
| 537 | set->setValue("screenshot_directory", screenshot_directory);
|
|---|
| 538 | #endif
|
|---|
| 539 |
|
|---|
| 540 | set->setValue("dont_remember_media_settings", dont_remember_media_settings);
|
|---|
| 541 | set->setValue("dont_remember_time_pos", dont_remember_time_pos);
|
|---|
| 542 |
|
|---|
| 543 | set->setValue("audio_lang", audio_lang);
|
|---|
| 544 | set->setValue("subtitle_lang", subtitle_lang);
|
|---|
| 545 |
|
|---|
| 546 | set->setValue("use_direct_rendering", use_direct_rendering);
|
|---|
| 547 | set->setValue("use_double_buffer", use_double_buffer);
|
|---|
| 548 | set->setValue("use_soft_video_eq", use_soft_video_eq);
|
|---|
| 549 | set->setValue("use_slices", use_slices );
|
|---|
| 550 | set->setValue("autoq", autoq);
|
|---|
| 551 | set->setValue("add_blackborders_on_fullscreen", add_blackborders_on_fullscreen);
|
|---|
| 552 |
|
|---|
| 553 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 554 | set->setValue("turn_screensaver_off", turn_screensaver_off);
|
|---|
| 555 | set->setValue("avoid_screensaver", avoid_screensaver);
|
|---|
| 556 | #else
|
|---|
| 557 | set->setValue("disable_screensaver", disable_screensaver);
|
|---|
| 558 | #endif
|
|---|
| 559 |
|
|---|
| 560 | #ifndef Q_OS_WIN
|
|---|
| 561 | set->setValue("vdpau_ffh264vdpau", vdpau.ffh264vdpau);
|
|---|
| 562 | set->setValue("vdpau_ffmpeg12vdpau", vdpau.ffmpeg12vdpau);
|
|---|
| 563 | set->setValue("vdpau_ffwmv3vdpau", vdpau.ffwmv3vdpau);
|
|---|
| 564 | set->setValue("vdpau_ffvc1vdpau", vdpau.ffvc1vdpau);
|
|---|
| 565 | set->setValue("vdpau_ffodivxvdpau", vdpau.ffodivxvdpau);
|
|---|
| 566 | set->setValue("vdpau_disable_video_filters", vdpau.disable_video_filters);
|
|---|
| 567 | #endif
|
|---|
| 568 |
|
|---|
| 569 | set->setValue("use_soft_vol", use_soft_vol);
|
|---|
| 570 | set->setValue("softvol_max", softvol_max);
|
|---|
| 571 | set->setValue("use_scaletempo", use_scaletempo);
|
|---|
| 572 | set->setValue("use_hwac3", use_hwac3 );
|
|---|
| 573 | set->setValue("use_audio_equalizer", use_audio_equalizer );
|
|---|
| 574 |
|
|---|
| 575 | set->setValue("global_volume", global_volume);
|
|---|
| 576 | set->setValue("volume", volume);
|
|---|
| 577 | set->setValue("mute", mute);
|
|---|
| 578 |
|
|---|
| 579 | set->setValue("autosync", autosync);
|
|---|
| 580 | set->setValue("autosync_factor", autosync_factor);
|
|---|
| 581 |
|
|---|
| 582 | set->setValue("use_mc", use_mc);
|
|---|
| 583 | set->setValue("mc_value", mc_value);
|
|---|
| 584 |
|
|---|
| 585 | set->setValue("osd", osd);
|
|---|
| 586 | set->setValue("osd_delay", osd_delay);
|
|---|
| 587 |
|
|---|
| 588 | set->setValue("file_settings_method", file_settings_method);
|
|---|
| 589 |
|
|---|
| 590 | set->endGroup(); // general
|
|---|
| 591 |
|
|---|
| 592 |
|
|---|
| 593 | /* ***************
|
|---|
| 594 | Drives (CD/DVD)
|
|---|
| 595 | *************** */
|
|---|
| 596 |
|
|---|
| 597 | set->beginGroup( "drives");
|
|---|
| 598 |
|
|---|
| 599 | set->setValue("dvd_device", dvd_device);
|
|---|
| 600 | set->setValue("cdrom_device", cdrom_device);
|
|---|
| 601 |
|
|---|
| 602 | #ifdef Q_OS_WIN
|
|---|
| 603 | set->setValue("enable_audiocd_on_windows", enable_audiocd_on_windows);
|
|---|
| 604 | #endif
|
|---|
| 605 |
|
|---|
| 606 | set->setValue("vcd_initial_title", vcd_initial_title);
|
|---|
| 607 |
|
|---|
| 608 | #if DVDNAV_SUPPORT
|
|---|
| 609 | set->setValue("use_dvdnav", use_dvdnav);
|
|---|
| 610 | #endif
|
|---|
| 611 |
|
|---|
| 612 | set->endGroup(); // drives
|
|---|
| 613 |
|
|---|
| 614 |
|
|---|
| 615 | /* ***********
|
|---|
| 616 | Performance
|
|---|
| 617 | *********** */
|
|---|
| 618 |
|
|---|
| 619 | set->beginGroup( "performance");
|
|---|
| 620 |
|
|---|
| 621 | set->setValue("priority", priority);
|
|---|
| 622 | set->setValue("frame_drop", frame_drop);
|
|---|
| 623 | set->setValue("hard_frame_drop", hard_frame_drop);
|
|---|
| 624 | set->setValue("coreavc", coreavc);
|
|---|
| 625 | set->setValue("h264_skip_loop_filter", h264_skip_loop_filter);
|
|---|
| 626 | set->setValue("HD_height", HD_height);
|
|---|
| 627 |
|
|---|
| 628 | set->setValue("fast_audio_change", fast_audio_change);
|
|---|
| 629 | #if !SMART_DVD_CHAPTERS
|
|---|
| 630 | set->setValue("fast_chapter_change", fast_chapter_change);
|
|---|
| 631 | #endif
|
|---|
| 632 |
|
|---|
| 633 | set->setValue("threads", threads);
|
|---|
| 634 |
|
|---|
| 635 | set->setValue("cache_for_files", cache_for_files);
|
|---|
| 636 | set->setValue("cache_for_streams", cache_for_streams);
|
|---|
| 637 | set->setValue("cache_for_dvds", cache_for_dvds);
|
|---|
| 638 | set->setValue("cache_for_vcds", cache_for_vcds);
|
|---|
| 639 | set->setValue("cache_for_audiocds", cache_for_audiocds);
|
|---|
| 640 | set->setValue("cache_for_tv", cache_for_tv);
|
|---|
| 641 |
|
|---|
| 642 | set->endGroup(); // performance
|
|---|
| 643 |
|
|---|
| 644 | #ifdef YOUTUBE_SUPPORT
|
|---|
| 645 | set->beginGroup("youtube");
|
|---|
| 646 | set->setValue("quality", yt_quality);
|
|---|
| 647 | set->setValue("user_agent", yt_user_agent);
|
|---|
| 648 | set->endGroup();
|
|---|
| 649 | #endif
|
|---|
| 650 |
|
|---|
| 651 |
|
|---|
| 652 | /* *********
|
|---|
| 653 | Subtitles
|
|---|
| 654 | ********* */
|
|---|
| 655 |
|
|---|
| 656 | set->beginGroup("subtitles");
|
|---|
| 657 |
|
|---|
| 658 | set->setValue("font_file", font_file);
|
|---|
| 659 | set->setValue("font_name", font_name);
|
|---|
| 660 |
|
|---|
| 661 | set->setValue("use_fontconfig", use_fontconfig);
|
|---|
| 662 | set->setValue("subcp", subcp);
|
|---|
| 663 | set->setValue("use_enca", use_enca);
|
|---|
| 664 | set->setValue("enca_lang", enca_lang);
|
|---|
| 665 | set->setValue("font_autoscale", font_autoscale);
|
|---|
| 666 | set->setValue("subfuzziness", subfuzziness);
|
|---|
| 667 | set->setValue("autoload_sub", autoload_sub);
|
|---|
| 668 |
|
|---|
| 669 | set->setValue("use_ass_subtitles", use_ass_subtitles);
|
|---|
| 670 | set->setValue("ass_line_spacing", ass_line_spacing);
|
|---|
| 671 | set->setValue("use_forced_subs_only", use_forced_subs_only);
|
|---|
| 672 |
|
|---|
| 673 | set->setValue("sub_visibility", sub_visibility);
|
|---|
| 674 |
|
|---|
| 675 | set->setValue("subtitles_on_screenshots", subtitles_on_screenshots);
|
|---|
| 676 |
|
|---|
| 677 | set->setValue("use_new_sub_commands", use_new_sub_commands);
|
|---|
| 678 | set->setValue("change_sub_scale_should_restart", change_sub_scale_should_restart);
|
|---|
| 679 |
|
|---|
| 680 | set->setValue("fast_load_sub", fast_load_sub);
|
|---|
| 681 |
|
|---|
| 682 | // ASS styles
|
|---|
| 683 | ass_styles.save(set);
|
|---|
| 684 | set->setValue("force_ass_styles", force_ass_styles);
|
|---|
| 685 | set->setValue("user_forced_ass_style", user_forced_ass_style);
|
|---|
| 686 |
|
|---|
| 687 | set->setValue("freetype_support", freetype_support);
|
|---|
| 688 |
|
|---|
| 689 | set->endGroup(); // subtitles
|
|---|
| 690 |
|
|---|
| 691 |
|
|---|
| 692 | /* ********
|
|---|
| 693 | Advanced
|
|---|
| 694 | ******** */
|
|---|
| 695 |
|
|---|
| 696 | set->beginGroup( "advanced");
|
|---|
| 697 |
|
|---|
| 698 | #if USE_ADAPTER
|
|---|
| 699 | set->setValue("adapter", adapter);
|
|---|
| 700 | #endif
|
|---|
| 701 |
|
|---|
| 702 | #if USE_COLORKEY
|
|---|
| 703 | set->setValue("color_key", QString::number(color_key,16));
|
|---|
| 704 | #endif
|
|---|
| 705 |
|
|---|
| 706 | set->setValue("use_mplayer_window", use_mplayer_window);
|
|---|
| 707 |
|
|---|
| 708 | set->setValue("monitor_aspect", monitor_aspect);
|
|---|
| 709 |
|
|---|
| 710 | set->setValue("use_idx", use_idx);
|
|---|
| 711 |
|
|---|
| 712 | set->setValue("mplayer_additional_options", mplayer_additional_options);
|
|---|
| 713 | set->setValue("mplayer_additional_video_filters", mplayer_additional_video_filters);
|
|---|
| 714 | set->setValue("mplayer_additional_audio_filters", mplayer_additional_audio_filters);
|
|---|
| 715 |
|
|---|
| 716 | #ifdef LOG_MPLAYER
|
|---|
| 717 | set->setValue("log_mplayer", log_mplayer);
|
|---|
| 718 | set->setValue("verbose_log", verbose_log);
|
|---|
| 719 | set->setValue("autosave_mplayer_log", autosave_mplayer_log);
|
|---|
| 720 | set->setValue("mplayer_log_saveto", mplayer_log_saveto);
|
|---|
| 721 | #endif
|
|---|
| 722 | #ifdef LOG_SMPLAYER
|
|---|
| 723 | set->setValue("log_smplayer", log_smplayer);
|
|---|
| 724 | set->setValue("log_filter", log_filter);
|
|---|
| 725 | set->setValue("save_smplayer_log", save_smplayer_log);
|
|---|
| 726 | #endif
|
|---|
| 727 |
|
|---|
| 728 | #if REPAINT_BACKGROUND_OPTION
|
|---|
| 729 | set->setValue("repaint_video_background", repaint_video_background);
|
|---|
| 730 | #endif
|
|---|
| 731 |
|
|---|
| 732 | set->setValue("use_edl_files", use_edl_files);
|
|---|
| 733 |
|
|---|
| 734 | set->setValue("prefer_ipv4", prefer_ipv4);
|
|---|
| 735 |
|
|---|
| 736 | set->setValue("use_short_pathnames", use_short_pathnames);
|
|---|
| 737 |
|
|---|
| 738 | set->setValue("change_video_equalizer_on_startup", change_video_equalizer_on_startup);
|
|---|
| 739 |
|
|---|
| 740 | set->setValue("use_pausing_keep_force", use_pausing_keep_force);
|
|---|
| 741 |
|
|---|
| 742 | set->setValue("correct_pts", use_correct_pts);
|
|---|
| 743 |
|
|---|
| 744 | set->setValue("actions_to_run", actions_to_run);
|
|---|
| 745 |
|
|---|
| 746 | set->setValue("show_tag_in_window_title", show_tag_in_window_title);
|
|---|
| 747 |
|
|---|
| 748 | set->setValue("time_to_kill_mplayer", time_to_kill_mplayer);
|
|---|
| 749 |
|
|---|
| 750 | set->endGroup(); // advanced
|
|---|
| 751 |
|
|---|
| 752 |
|
|---|
| 753 | /* *********
|
|---|
| 754 | GUI stuff
|
|---|
| 755 | ********* */
|
|---|
| 756 |
|
|---|
| 757 | set->beginGroup("gui");
|
|---|
| 758 |
|
|---|
| 759 | set->setValue("fullscreen", fullscreen);
|
|---|
| 760 | set->setValue("start_in_fullscreen", start_in_fullscreen);
|
|---|
| 761 |
|
|---|
| 762 | set->setValue("compact_mode", compact_mode);
|
|---|
| 763 | set->setValue("stay_on_top", (int) stay_on_top);
|
|---|
| 764 | set->setValue("size_factor", size_factor);
|
|---|
| 765 | set->setValue("resize_method", resize_method);
|
|---|
| 766 |
|
|---|
| 767 | #if STYLE_SWITCHING
|
|---|
| 768 | set->setValue("style", style);
|
|---|
| 769 | #endif
|
|---|
| 770 |
|
|---|
| 771 | set->setValue("move_when_dragging", move_when_dragging);
|
|---|
| 772 |
|
|---|
| 773 | set->setValue("mouse_left_click_function", mouse_left_click_function);
|
|---|
| 774 | set->setValue("mouse_right_click_function", mouse_right_click_function);
|
|---|
| 775 | set->setValue("mouse_double_click_function", mouse_double_click_function);
|
|---|
| 776 | set->setValue("mouse_middle_click_function", mouse_middle_click_function);
|
|---|
| 777 | set->setValue("mouse_xbutton1_click_function", mouse_xbutton1_click_function);
|
|---|
| 778 | set->setValue("mouse_xbutton2_click_function", mouse_xbutton2_click_function);
|
|---|
| 779 | set->setValue("mouse_wheel_function", wheel_function);
|
|---|
| 780 | set->setValue("wheel_function_cycle", (int) wheel_function_cycle);
|
|---|
| 781 | set->setValue("wheel_function_seeking_reverse", wheel_function_seeking_reverse);
|
|---|
| 782 |
|
|---|
| 783 | set->setValue("seeking1", seeking1);
|
|---|
| 784 | set->setValue("seeking2", seeking2);
|
|---|
| 785 | set->setValue("seeking3", seeking3);
|
|---|
| 786 | set->setValue("seeking4", seeking4);
|
|---|
| 787 |
|
|---|
| 788 | set->setValue("update_while_seeking", update_while_seeking);
|
|---|
| 789 | #if ENABLE_DELAYED_DRAGGING
|
|---|
| 790 | set->setValue("time_slider_drag_delay", time_slider_drag_delay);
|
|---|
| 791 | #endif
|
|---|
| 792 | #if SEEKBAR_RESOLUTION
|
|---|
| 793 | set->setValue("relative_seeking", relative_seeking);
|
|---|
| 794 | #endif
|
|---|
| 795 | set->setValue("precise_seeking", precise_seeking);
|
|---|
| 796 |
|
|---|
| 797 | set->setValue("reset_stop", reset_stop);
|
|---|
| 798 |
|
|---|
| 799 | set->setValue("language", language);
|
|---|
| 800 | set->setValue("iconset", iconset);
|
|---|
| 801 |
|
|---|
| 802 | set->setValue("balloon_count", balloon_count);
|
|---|
| 803 |
|
|---|
| 804 | set->setValue("restore_pos_after_fullscreen", restore_pos_after_fullscreen);
|
|---|
| 805 | set->setValue("save_window_size_on_exit", save_window_size_on_exit);
|
|---|
| 806 |
|
|---|
| 807 | set->setValue("close_on_finish", close_on_finish);
|
|---|
| 808 |
|
|---|
| 809 | set->setValue("default_font", default_font);
|
|---|
| 810 |
|
|---|
| 811 | set->setValue("pause_when_hidden", pause_when_hidden);
|
|---|
| 812 |
|
|---|
| 813 | set->setValue("allow_video_movement", allow_video_movement);
|
|---|
| 814 |
|
|---|
| 815 | set->setValue("gui", gui);
|
|---|
| 816 |
|
|---|
| 817 | #if USE_MINIMUMSIZE
|
|---|
| 818 | set->setValue("gui_minimum_width", gui_minimum_width);
|
|---|
| 819 | #endif
|
|---|
| 820 | set->setValue("default_size", default_size);
|
|---|
| 821 |
|
|---|
| 822 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
|---|
| 823 | set->setValue("hide_video_window_on_audio_files", hide_video_window_on_audio_files);
|
|---|
| 824 | #endif
|
|---|
| 825 |
|
|---|
| 826 | set->setValue("report_mplayer_crashes", report_mplayer_crashes);
|
|---|
| 827 |
|
|---|
| 828 | #if REPORT_OLD_MPLAYER
|
|---|
| 829 | set->setValue("reported_mplayer_is_old", reported_mplayer_is_old);
|
|---|
| 830 | #endif
|
|---|
| 831 |
|
|---|
| 832 | set->setValue("auto_add_to_playlist", auto_add_to_playlist);
|
|---|
| 833 | set->setValue("add_to_playlist_consecutive_files", add_to_playlist_consecutive_files);
|
|---|
| 834 |
|
|---|
| 835 | #if LOGO_ANIMATION
|
|---|
| 836 | set->setValue("animated_logo", animated_logo);
|
|---|
| 837 | #endif
|
|---|
| 838 |
|
|---|
| 839 | set->endGroup(); // gui
|
|---|
| 840 |
|
|---|
| 841 |
|
|---|
| 842 | /* ********
|
|---|
| 843 | TV (dvb)
|
|---|
| 844 | ******** */
|
|---|
| 845 |
|
|---|
| 846 | set->beginGroup( "tv");
|
|---|
| 847 | set->setValue("check_channels_conf_on_startup", check_channels_conf_on_startup);
|
|---|
| 848 | set->setValue("initial_tv_deinterlace", initial_tv_deinterlace);
|
|---|
| 849 | set->setValue("last_dvb_channel", last_dvb_channel);
|
|---|
| 850 | set->setValue("last_tv_channel", last_tv_channel);
|
|---|
| 851 | set->endGroup(); // tv
|
|---|
| 852 |
|
|---|
| 853 | /* ***********
|
|---|
| 854 | Directories
|
|---|
| 855 | *********** */
|
|---|
| 856 |
|
|---|
| 857 | set->beginGroup( "directories");
|
|---|
| 858 | if (save_dirs) {
|
|---|
| 859 | set->setValue("latest_dir", latest_dir);
|
|---|
| 860 | set->setValue("last_dvd_directory", last_dvd_directory);
|
|---|
| 861 | } else {
|
|---|
| 862 | set->setValue("latest_dir", "");
|
|---|
| 863 | set->setValue("last_dvd_directory", "");
|
|---|
| 864 | }
|
|---|
| 865 | set->setValue("save_dirs", save_dirs);
|
|---|
| 866 | set->endGroup(); // directories
|
|---|
| 867 |
|
|---|
| 868 |
|
|---|
| 869 | /* **************
|
|---|
| 870 | Initial values
|
|---|
| 871 | ************** */
|
|---|
| 872 |
|
|---|
| 873 | set->beginGroup( "defaults");
|
|---|
| 874 |
|
|---|
| 875 | set->setValue("initial_sub_scale", initial_sub_scale);
|
|---|
| 876 | set->setValue("initial_sub_scale_ass", initial_sub_scale_ass);
|
|---|
| 877 | set->setValue("initial_volume", initial_volume);
|
|---|
| 878 | set->setValue("initial_contrast", initial_contrast);
|
|---|
| 879 | set->setValue("initial_brightness", initial_brightness);
|
|---|
| 880 | set->setValue("initial_hue", initial_hue);
|
|---|
| 881 | set->setValue("initial_saturation", initial_saturation);
|
|---|
| 882 | set->setValue("initial_gamma", initial_gamma);
|
|---|
| 883 |
|
|---|
| 884 | set->setValue("initial_audio_equalizer", initial_audio_equalizer);
|
|---|
| 885 |
|
|---|
| 886 | set->setValue("initial_zoom_factor", initial_zoom_factor);
|
|---|
| 887 | set->setValue("initial_sub_pos", initial_sub_pos);
|
|---|
| 888 |
|
|---|
| 889 | set->setValue("initial_volnorm", initial_volnorm);
|
|---|
| 890 | set->setValue("initial_postprocessing", initial_postprocessing);
|
|---|
| 891 |
|
|---|
| 892 | set->setValue("initial_deinterlace", initial_deinterlace);
|
|---|
| 893 |
|
|---|
| 894 | set->setValue("initial_audio_channels", initial_audio_channels);
|
|---|
| 895 | set->setValue("initial_stereo_mode", initial_stereo_mode);
|
|---|
| 896 |
|
|---|
| 897 | set->setValue("initial_audio_track", initial_audio_track);
|
|---|
| 898 | set->setValue("initial_subtitle_track", initial_subtitle_track);
|
|---|
| 899 |
|
|---|
| 900 | set->endGroup(); // defaults
|
|---|
| 901 |
|
|---|
| 902 |
|
|---|
| 903 | /* ************
|
|---|
| 904 | MPlayer info
|
|---|
| 905 | ************ */
|
|---|
| 906 |
|
|---|
| 907 | set->beginGroup( "mplayer_info");
|
|---|
| 908 | set->setValue("mplayer_detected_version", mplayer_detected_version);
|
|---|
| 909 | set->setValue("mplayer_user_supplied_version", mplayer_user_supplied_version);
|
|---|
| 910 | set->setValue("is_mplayer2", mplayer_is_mplayer2);
|
|---|
| 911 | set->setValue("mplayer2_detected_version", mplayer2_detected_version);
|
|---|
| 912 | set->endGroup(); // mplayer_info
|
|---|
| 913 |
|
|---|
| 914 |
|
|---|
| 915 | /* *********
|
|---|
| 916 | Instances
|
|---|
| 917 | ********* */
|
|---|
| 918 | #ifdef SINGLE_INSTANCE
|
|---|
| 919 | set->beginGroup("instances");
|
|---|
| 920 | set->setValue("single_instance_enabled", use_single_instance);
|
|---|
| 921 | set->endGroup(); // instances
|
|---|
| 922 | #endif
|
|---|
| 923 |
|
|---|
| 924 |
|
|---|
| 925 | /* ****************
|
|---|
| 926 | Floating control
|
|---|
| 927 | **************** */
|
|---|
| 928 |
|
|---|
| 929 | set->beginGroup("floating_control");
|
|---|
| 930 | set->setValue("margin", floating_control_margin);
|
|---|
| 931 | set->setValue("width", floating_control_width);
|
|---|
| 932 | set->setValue("animated", floating_control_animated);
|
|---|
| 933 | set->setValue("display_in_compact_mode", floating_display_in_compact_mode);
|
|---|
| 934 | #ifndef Q_OS_WIN
|
|---|
| 935 | set->setValue("bypass_window_manager", bypass_window_manager);
|
|---|
| 936 | #endif
|
|---|
| 937 | set->endGroup(); // floating_control
|
|---|
| 938 |
|
|---|
| 939 |
|
|---|
| 940 | /* *******
|
|---|
| 941 | History
|
|---|
| 942 | ******* */
|
|---|
| 943 |
|
|---|
| 944 | set->beginGroup("history");
|
|---|
| 945 | set->setValue("recents", history_recents->toStringList());
|
|---|
| 946 | set->setValue("recents/max_items", history_recents->maxItems());
|
|---|
| 947 | set->setValue("urls", history_urls->toStringList());
|
|---|
| 948 | set->setValue("urls/max_items", history_urls->maxItems());
|
|---|
| 949 | set->endGroup(); // history
|
|---|
| 950 |
|
|---|
| 951 |
|
|---|
| 952 | /* *******
|
|---|
| 953 | Filters
|
|---|
| 954 | ******* */
|
|---|
| 955 |
|
|---|
| 956 | filters->save(set);
|
|---|
| 957 |
|
|---|
| 958 |
|
|---|
| 959 | /* *********
|
|---|
| 960 | SMPlayer info
|
|---|
| 961 | ********* */
|
|---|
| 962 |
|
|---|
| 963 | set->beginGroup("smplayer");
|
|---|
| 964 | #ifdef CHECK_UPGRADED
|
|---|
| 965 | set->setValue("stable_version", smplayer_stable_version);
|
|---|
| 966 | set->setValue("check_if_upgraded", check_if_upgraded);
|
|---|
| 967 | #endif
|
|---|
| 968 | #ifdef FONTCACHE_DIALOG
|
|---|
| 969 | set->setValue("version", smplayer_version);
|
|---|
| 970 | #endif
|
|---|
| 971 | set->endGroup();
|
|---|
| 972 |
|
|---|
| 973 |
|
|---|
| 974 | /* *********
|
|---|
| 975 | Update
|
|---|
| 976 | ********* */
|
|---|
| 977 |
|
|---|
| 978 | #ifdef UPDATE_CHECKER
|
|---|
| 979 | update_checker_data.save(set);
|
|---|
| 980 | #endif
|
|---|
| 981 |
|
|---|
| 982 | set->sync();
|
|---|
| 983 | }
|
|---|
| 984 |
|
|---|
| 985 | void Preferences::load() {
|
|---|
| 986 | qDebug("Preferences::load");
|
|---|
| 987 |
|
|---|
| 988 | QSettings * set = settings;
|
|---|
| 989 |
|
|---|
| 990 |
|
|---|
| 991 | /* *******
|
|---|
| 992 | General
|
|---|
| 993 | ******* */
|
|---|
| 994 |
|
|---|
| 995 | set->beginGroup( "general");
|
|---|
| 996 |
|
|---|
| 997 | config_version = set->value("config_version", 0).toInt();
|
|---|
| 998 |
|
|---|
| 999 | mplayer_bin = set->value("mplayer_bin", mplayer_bin).toString();
|
|---|
| 1000 | vo = set->value("driver/vo", vo).toString();
|
|---|
| 1001 | ao = set->value("driver/audio_output", ao).toString();
|
|---|
| 1002 |
|
|---|
| 1003 | use_screenshot = set->value("use_screenshot", use_screenshot).toBool();
|
|---|
| 1004 | #if QT_VERSION >= 0x040400
|
|---|
| 1005 | screenshot_directory = set->value("screenshot_folder", screenshot_directory).toString();
|
|---|
| 1006 | setupScreenshotFolder();
|
|---|
| 1007 | #else
|
|---|
| 1008 | screenshot_directory = set->value("screenshot_directory", screenshot_directory).toString();
|
|---|
| 1009 | #endif
|
|---|
| 1010 |
|
|---|
| 1011 | dont_remember_media_settings = set->value("dont_remember_media_settings", dont_remember_media_settings).toBool();
|
|---|
| 1012 | dont_remember_time_pos = set->value("dont_remember_time_pos", dont_remember_time_pos).toBool();
|
|---|
| 1013 |
|
|---|
| 1014 | audio_lang = set->value("audio_lang", audio_lang).toString();
|
|---|
| 1015 | subtitle_lang = set->value("subtitle_lang", subtitle_lang).toString();
|
|---|
| 1016 |
|
|---|
| 1017 | use_direct_rendering = set->value("use_direct_rendering", use_direct_rendering).toBool();
|
|---|
| 1018 | use_double_buffer = set->value("use_double_buffer", use_double_buffer).toBool();
|
|---|
| 1019 |
|
|---|
| 1020 | use_soft_video_eq = set->value("use_soft_video_eq", use_soft_video_eq).toBool();
|
|---|
| 1021 | use_slices = set->value("use_slices", use_slices ).toBool();
|
|---|
| 1022 | autoq = set->value("autoq", autoq).toInt();
|
|---|
| 1023 | add_blackborders_on_fullscreen = set->value("add_blackborders_on_fullscreen", add_blackborders_on_fullscreen).toBool();
|
|---|
| 1024 |
|
|---|
| 1025 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
|---|
| 1026 | turn_screensaver_off = set->value("turn_screensaver_off", turn_screensaver_off).toBool();
|
|---|
| 1027 | avoid_screensaver = set->value("avoid_screensaver", avoid_screensaver).toBool();
|
|---|
| 1028 | #else
|
|---|
| 1029 | disable_screensaver = set->value("disable_screensaver", disable_screensaver).toBool();
|
|---|
| 1030 | #endif
|
|---|
| 1031 |
|
|---|
| 1032 | #ifndef Q_OS_WIN
|
|---|
| 1033 | vdpau.ffh264vdpau = set->value("vdpau_ffh264vdpau", vdpau.ffh264vdpau).toBool();
|
|---|
| 1034 | vdpau.ffmpeg12vdpau = set->value("vdpau_ffmpeg12vdpau", vdpau.ffmpeg12vdpau).toBool();
|
|---|
| 1035 | vdpau.ffwmv3vdpau = set->value("vdpau_ffwmv3vdpau", vdpau.ffwmv3vdpau).toBool();
|
|---|
| 1036 | vdpau.ffvc1vdpau = set->value("vdpau_ffvc1vdpau", vdpau.ffvc1vdpau).toBool();
|
|---|
| 1037 | vdpau.ffodivxvdpau = set->value("vdpau_ffodivxvdpau", vdpau.ffodivxvdpau).toBool();
|
|---|
| 1038 | vdpau.disable_video_filters = set->value("vdpau_disable_video_filters", vdpau.disable_video_filters).toBool();
|
|---|
| 1039 | #endif
|
|---|
| 1040 |
|
|---|
| 1041 | use_soft_vol = set->value("use_soft_vol", use_soft_vol).toBool();
|
|---|
| 1042 | softvol_max = set->value("softvol_max", softvol_max).toInt();
|
|---|
| 1043 | use_scaletempo = (OptionState) set->value("use_scaletempo", use_scaletempo).toInt();
|
|---|
| 1044 | use_hwac3 = set->value("use_hwac3", use_hwac3 ).toBool();
|
|---|
| 1045 | use_audio_equalizer = set->value("use_audio_equalizer", use_audio_equalizer ).toBool();
|
|---|
| 1046 |
|
|---|
| 1047 | global_volume = set->value("global_volume", global_volume).toBool();
|
|---|
| 1048 | volume = set->value("volume", volume).toInt();
|
|---|
| 1049 | mute = set->value("mute", mute).toBool();
|
|---|
| 1050 |
|
|---|
| 1051 | autosync = set->value("autosync", autosync).toBool();
|
|---|
| 1052 | autosync_factor = set->value("autosync_factor", autosync_factor).toInt();
|
|---|
| 1053 |
|
|---|
| 1054 | use_mc = set->value("use_mc", use_mc).toBool();
|
|---|
| 1055 | mc_value = set->value("mc_value", mc_value).toDouble();
|
|---|
| 1056 |
|
|---|
| 1057 | osd = set->value("osd", osd).toInt();
|
|---|
| 1058 | osd_delay = set->value("osd_delay", osd_delay).toInt();
|
|---|
| 1059 |
|
|---|
| 1060 | file_settings_method = set->value("file_settings_method", file_settings_method).toString();
|
|---|
| 1061 |
|
|---|
| 1062 | set->endGroup(); // general
|
|---|
| 1063 |
|
|---|
| 1064 |
|
|---|
| 1065 | /* ***************
|
|---|
| 1066 | Drives (CD/DVD)
|
|---|
| 1067 | *************** */
|
|---|
| 1068 |
|
|---|
| 1069 | set->beginGroup( "drives");
|
|---|
| 1070 |
|
|---|
| 1071 | dvd_device = set->value("dvd_device", dvd_device).toString();
|
|---|
| 1072 | cdrom_device = set->value("cdrom_device", cdrom_device).toString();
|
|---|
| 1073 |
|
|---|
| 1074 | #ifdef Q_OS_WIN
|
|---|
| 1075 | enable_audiocd_on_windows = set->value("enable_audiocd_on_windows", enable_audiocd_on_windows).toBool();
|
|---|
| 1076 | #endif
|
|---|
| 1077 |
|
|---|
| 1078 | vcd_initial_title = set->value("vcd_initial_title", vcd_initial_title ).toInt();
|
|---|
| 1079 |
|
|---|
| 1080 | #if DVDNAV_SUPPORT
|
|---|
| 1081 | use_dvdnav = set->value("use_dvdnav", use_dvdnav).toBool();
|
|---|
| 1082 | #endif
|
|---|
| 1083 |
|
|---|
| 1084 | set->endGroup(); // drives
|
|---|
| 1085 |
|
|---|
| 1086 |
|
|---|
| 1087 | /* ***********
|
|---|
| 1088 | Performance
|
|---|
| 1089 | *********** */
|
|---|
| 1090 |
|
|---|
| 1091 | set->beginGroup( "performance");
|
|---|
| 1092 |
|
|---|
| 1093 | priority = set->value("priority", priority).toInt();
|
|---|
| 1094 | frame_drop = set->value("frame_drop", frame_drop).toBool();
|
|---|
| 1095 | hard_frame_drop = set->value("hard_frame_drop", hard_frame_drop).toBool();
|
|---|
| 1096 | coreavc = set->value("coreavc", coreavc).toBool();
|
|---|
| 1097 | h264_skip_loop_filter = (H264LoopFilter) set->value("h264_skip_loop_filter", h264_skip_loop_filter).toInt();
|
|---|
| 1098 | HD_height = set->value("HD_height", HD_height).toInt();
|
|---|
| 1099 |
|
|---|
| 1100 | fast_audio_change = (OptionState) set->value("fast_audio_change", fast_audio_change).toInt();
|
|---|
| 1101 | #if !SMART_DVD_CHAPTERS
|
|---|
| 1102 | fast_chapter_change = set->value("fast_chapter_change", fast_chapter_change).toBool();
|
|---|
| 1103 | #endif
|
|---|
| 1104 |
|
|---|
| 1105 | threads = set->value("threads", threads).toInt();
|
|---|
| 1106 |
|
|---|
| 1107 | cache_for_files = set->value("cache_for_files", cache_for_files).toInt();
|
|---|
| 1108 | cache_for_streams = set->value("cache_for_streams", cache_for_streams).toInt();
|
|---|
| 1109 | cache_for_dvds = set->value("cache_for_dvds", cache_for_dvds).toInt();
|
|---|
| 1110 | cache_for_vcds = set->value("cache_for_vcds", cache_for_vcds).toInt();
|
|---|
| 1111 | cache_for_audiocds = set->value("cache_for_audiocds", cache_for_audiocds).toInt();
|
|---|
| 1112 | cache_for_tv = set->value("cache_for_tv", cache_for_tv).toInt();
|
|---|
| 1113 |
|
|---|
| 1114 | set->endGroup(); // performance
|
|---|
| 1115 |
|
|---|
| 1116 | #ifdef YOUTUBE_SUPPORT
|
|---|
| 1117 | set->beginGroup("youtube");
|
|---|
| 1118 | yt_quality = set->value("quality", yt_quality).toInt();
|
|---|
| 1119 | yt_user_agent = set->value("user_agent", yt_user_agent).toString();
|
|---|
| 1120 | set->endGroup();
|
|---|
| 1121 | #endif
|
|---|
| 1122 |
|
|---|
| 1123 |
|
|---|
| 1124 | /* *********
|
|---|
| 1125 | Subtitles
|
|---|
| 1126 | ********* */
|
|---|
| 1127 |
|
|---|
| 1128 | set->beginGroup("subtitles");
|
|---|
| 1129 |
|
|---|
| 1130 | font_file = set->value("font_file", font_file).toString();
|
|---|
| 1131 | font_name = set->value("font_name", font_name).toString();
|
|---|
| 1132 |
|
|---|
| 1133 | use_fontconfig = set->value("use_fontconfig", use_fontconfig).toBool();
|
|---|
| 1134 | subcp = set->value("subcp", subcp).toString();
|
|---|
| 1135 | use_enca = set->value("use_enca", use_enca).toBool();
|
|---|
| 1136 | enca_lang = set->value("enca_lang", enca_lang).toString();
|
|---|
| 1137 | font_autoscale = set->value("font_autoscale", font_autoscale).toInt();
|
|---|
| 1138 | subfuzziness = set->value("subfuzziness", subfuzziness).toInt();
|
|---|
| 1139 | autoload_sub = set->value("autoload_sub", autoload_sub).toBool();
|
|---|
| 1140 |
|
|---|
| 1141 | use_ass_subtitles = set->value("use_ass_subtitles", use_ass_subtitles).toBool();
|
|---|
| 1142 | ass_line_spacing = set->value("ass_line_spacing", ass_line_spacing).toInt();
|
|---|
| 1143 |
|
|---|
| 1144 | use_forced_subs_only = set->value("use_forced_subs_only", use_forced_subs_only).toBool();
|
|---|
| 1145 |
|
|---|
| 1146 | sub_visibility = set->value("sub_visibility", sub_visibility).toBool();
|
|---|
| 1147 |
|
|---|
| 1148 | subtitles_on_screenshots = set->value("subtitles_on_screenshots", subtitles_on_screenshots).toBool();
|
|---|
| 1149 |
|
|---|
| 1150 | use_new_sub_commands = (OptionState) set->value("use_new_sub_commands", use_new_sub_commands).toInt();
|
|---|
| 1151 | change_sub_scale_should_restart = (OptionState) set->value("change_sub_scale_should_restart", change_sub_scale_should_restart).toInt();
|
|---|
| 1152 |
|
|---|
| 1153 | fast_load_sub = set->value("fast_load_sub", fast_load_sub).toBool();
|
|---|
| 1154 |
|
|---|
| 1155 | // ASS styles
|
|---|
| 1156 | ass_styles.load(set);
|
|---|
| 1157 | force_ass_styles = set->value("force_ass_styles", force_ass_styles).toBool();
|
|---|
| 1158 | user_forced_ass_style = set->value("user_forced_ass_style", user_forced_ass_style).toString();
|
|---|
| 1159 |
|
|---|
| 1160 | freetype_support = set->value("freetype_support", freetype_support).toBool();
|
|---|
| 1161 |
|
|---|
| 1162 | set->endGroup(); // subtitles
|
|---|
| 1163 |
|
|---|
| 1164 |
|
|---|
| 1165 | /* ********
|
|---|
| 1166 | Advanced
|
|---|
| 1167 | ******** */
|
|---|
| 1168 |
|
|---|
| 1169 | set->beginGroup( "advanced");
|
|---|
| 1170 |
|
|---|
| 1171 | #if USE_ADAPTER
|
|---|
| 1172 | adapter = set->value("adapter", adapter).toInt();
|
|---|
| 1173 | #endif
|
|---|
| 1174 |
|
|---|
| 1175 | #if USE_COLORKEY
|
|---|
| 1176 | bool ok;
|
|---|
| 1177 | QString color = set->value("color_key", QString::number(color_key,16)).toString();
|
|---|
| 1178 | unsigned int temp_color_key = color.toUInt(&ok, 16);
|
|---|
| 1179 | if (ok)
|
|---|
| 1180 | color_key = temp_color_key;
|
|---|
| 1181 | //color_key = set->value("color_key", color_key).toInt();
|
|---|
| 1182 | #endif
|
|---|
| 1183 |
|
|---|
| 1184 | use_mplayer_window = set->value("use_mplayer_window", use_mplayer_window).toBool();
|
|---|
| 1185 |
|
|---|
| 1186 | monitor_aspect = set->value("monitor_aspect", monitor_aspect).toString();
|
|---|
| 1187 |
|
|---|
| 1188 | use_idx = set->value("use_idx", use_idx).toBool();
|
|---|
| 1189 |
|
|---|
| 1190 | mplayer_additional_options = set->value("mplayer_additional_options", mplayer_additional_options).toString();
|
|---|
| 1191 | mplayer_additional_video_filters = set->value("mplayer_additional_video_filters", mplayer_additional_video_filters).toString();
|
|---|
| 1192 | mplayer_additional_audio_filters = set->value("mplayer_additional_audio_filters", mplayer_additional_audio_filters).toString();
|
|---|
| 1193 |
|
|---|
| 1194 | #ifdef LOG_MPLAYER
|
|---|
| 1195 | log_mplayer = set->value("log_mplayer", log_mplayer).toBool();
|
|---|
| 1196 | verbose_log = set->value("verbose_log", verbose_log).toBool();
|
|---|
| 1197 | autosave_mplayer_log = set->value("autosave_mplayer_log", autosave_mplayer_log).toBool();
|
|---|
| 1198 | mplayer_log_saveto = set->value("mplayer_log_saveto", mplayer_log_saveto).toString();
|
|---|
| 1199 | #endif
|
|---|
| 1200 | #ifdef LOG_SMPLAYER
|
|---|
| 1201 | log_smplayer = set->value("log_smplayer", log_smplayer).toBool();
|
|---|
| 1202 | log_filter = set->value("log_filter", log_filter).toString();
|
|---|
| 1203 | save_smplayer_log = set->value("save_smplayer_log", save_smplayer_log).toBool();
|
|---|
| 1204 | #endif
|
|---|
| 1205 |
|
|---|
| 1206 | #if REPAINT_BACKGROUND_OPTION
|
|---|
| 1207 | repaint_video_background = set->value("repaint_video_background", repaint_video_background).toBool();
|
|---|
| 1208 | #endif
|
|---|
| 1209 |
|
|---|
| 1210 | use_edl_files = set->value("use_edl_files", use_edl_files).toBool();
|
|---|
| 1211 |
|
|---|
| 1212 | prefer_ipv4 = set->value("prefer_ipv4", prefer_ipv4).toBool();
|
|---|
| 1213 |
|
|---|
| 1214 | use_short_pathnames = set->value("use_short_pathnames", use_short_pathnames).toBool();
|
|---|
| 1215 |
|
|---|
| 1216 | use_pausing_keep_force = set->value("use_pausing_keep_force", use_pausing_keep_force).toBool();
|
|---|
| 1217 |
|
|---|
| 1218 | use_correct_pts = (OptionState) set->value("correct_pts", use_correct_pts).toInt();
|
|---|
| 1219 |
|
|---|
| 1220 | actions_to_run = set->value("actions_to_run", actions_to_run).toString();
|
|---|
| 1221 |
|
|---|
| 1222 | show_tag_in_window_title = set->value("show_tag_in_window_title", show_tag_in_window_title).toBool();
|
|---|
| 1223 |
|
|---|
| 1224 | time_to_kill_mplayer = set->value("time_to_kill_mplayer", time_to_kill_mplayer).toInt();
|
|---|
| 1225 |
|
|---|
| 1226 | set->endGroup(); // advanced
|
|---|
| 1227 |
|
|---|
| 1228 |
|
|---|
| 1229 | /* *********
|
|---|
| 1230 | GUI stuff
|
|---|
| 1231 | ********* */
|
|---|
| 1232 |
|
|---|
| 1233 | set->beginGroup("gui");
|
|---|
| 1234 |
|
|---|
| 1235 | fullscreen = set->value("fullscreen", fullscreen).toBool();
|
|---|
| 1236 | start_in_fullscreen = set->value("start_in_fullscreen", start_in_fullscreen).toBool();
|
|---|
| 1237 |
|
|---|
| 1238 | compact_mode = set->value("compact_mode", compact_mode).toBool();
|
|---|
| 1239 | stay_on_top = (Preferences::OnTop) set->value("stay_on_top", (int) stay_on_top).toInt();
|
|---|
| 1240 | size_factor = set->value("size_factor", size_factor).toInt();
|
|---|
| 1241 | resize_method = set->value("resize_method", resize_method).toInt();
|
|---|
| 1242 |
|
|---|
| 1243 | #if STYLE_SWITCHING
|
|---|
| 1244 | style = set->value("style", style).toString();
|
|---|
| 1245 | #endif
|
|---|
| 1246 |
|
|---|
| 1247 | move_when_dragging = set->value("move_when_dragging", move_when_dragging).toBool();
|
|---|
| 1248 |
|
|---|
| 1249 | mouse_left_click_function = set->value("mouse_left_click_function", mouse_left_click_function).toString();
|
|---|
| 1250 | mouse_right_click_function = set->value("mouse_right_click_function", mouse_right_click_function).toString();
|
|---|
| 1251 | mouse_double_click_function = set->value("mouse_double_click_function", mouse_double_click_function).toString();
|
|---|
| 1252 | mouse_middle_click_function = set->value("mouse_middle_click_function", mouse_middle_click_function).toString();
|
|---|
| 1253 | mouse_xbutton1_click_function = set->value("mouse_xbutton1_click_function", mouse_xbutton1_click_function).toString();
|
|---|
| 1254 | mouse_xbutton2_click_function = set->value("mouse_xbutton2_click_function", mouse_xbutton2_click_function).toString();
|
|---|
| 1255 | wheel_function = set->value("mouse_wheel_function", wheel_function).toInt();
|
|---|
| 1256 | int wheel_function_cycle_int = set->value("wheel_function_cycle", (int) wheel_function_cycle).toInt();
|
|---|
| 1257 | wheel_function_cycle = QFlags<Preferences::WheelFunctions> (QFlag(wheel_function_cycle_int));
|
|---|
| 1258 | wheel_function_seeking_reverse = set->value("wheel_function_seeking_reverse", wheel_function_seeking_reverse).toBool();
|
|---|
| 1259 |
|
|---|
| 1260 | seeking1 = set->value("seeking1", seeking1).toInt();
|
|---|
| 1261 | seeking2 = set->value("seeking2", seeking2).toInt();
|
|---|
| 1262 | seeking3 = set->value("seeking3", seeking3).toInt();
|
|---|
| 1263 | seeking4 = set->value("seeking4", seeking4).toInt();
|
|---|
| 1264 |
|
|---|
| 1265 | update_while_seeking = set->value("update_while_seeking", update_while_seeking).toBool();
|
|---|
| 1266 | #if ENABLE_DELAYED_DRAGGING
|
|---|
| 1267 | time_slider_drag_delay = set->value("time_slider_drag_delay", time_slider_drag_delay).toInt();
|
|---|
| 1268 | #endif
|
|---|
| 1269 | #if SEEKBAR_RESOLUTION
|
|---|
| 1270 | relative_seeking = set->value("relative_seeking", relative_seeking).toBool();
|
|---|
| 1271 | #endif
|
|---|
| 1272 | precise_seeking = set->value("precise_seeking", precise_seeking).toBool();
|
|---|
| 1273 |
|
|---|
| 1274 | reset_stop = set->value("reset_stop", reset_stop).toBool();
|
|---|
| 1275 |
|
|---|
| 1276 | language = set->value("language", language).toString();
|
|---|
| 1277 | iconset= set->value("iconset", iconset).toString();
|
|---|
| 1278 |
|
|---|
| 1279 | balloon_count = set->value("balloon_count", balloon_count).toInt();
|
|---|
| 1280 |
|
|---|
| 1281 | restore_pos_after_fullscreen = set->value("restore_pos_after_fullscreen", restore_pos_after_fullscreen).toBool();
|
|---|
| 1282 | save_window_size_on_exit = set->value("save_window_size_on_exit", save_window_size_on_exit).toBool();
|
|---|
| 1283 |
|
|---|
| 1284 | close_on_finish = set->value("close_on_finish", close_on_finish).toBool();
|
|---|
| 1285 |
|
|---|
| 1286 | default_font = set->value("default_font", default_font).toString();
|
|---|
| 1287 |
|
|---|
| 1288 | pause_when_hidden = set->value("pause_when_hidden", pause_when_hidden).toBool();
|
|---|
| 1289 |
|
|---|
| 1290 | allow_video_movement = set->value("allow_video_movement", allow_video_movement).toBool();
|
|---|
| 1291 |
|
|---|
| 1292 | gui = set->value("gui", gui).toString();
|
|---|
| 1293 |
|
|---|
| 1294 | #if USE_MINIMUMSIZE
|
|---|
| 1295 | gui_minimum_width = set->value("gui_minimum_width", gui_minimum_width).toInt();
|
|---|
| 1296 | #endif
|
|---|
| 1297 | default_size = set->value("default_size", default_size).toSize();
|
|---|
| 1298 |
|
|---|
| 1299 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
|---|
| 1300 | hide_video_window_on_audio_files = set->value("hide_video_window_on_audio_files", hide_video_window_on_audio_files).toBool();
|
|---|
| 1301 | #endif
|
|---|
| 1302 |
|
|---|
| 1303 | report_mplayer_crashes = set->value("report_mplayer_crashes", report_mplayer_crashes).toBool();
|
|---|
| 1304 |
|
|---|
| 1305 | #if REPORT_OLD_MPLAYER
|
|---|
| 1306 | reported_mplayer_is_old = set->value("reported_mplayer_is_old", reported_mplayer_is_old).toBool();
|
|---|
| 1307 | #endif
|
|---|
| 1308 |
|
|---|
| 1309 | auto_add_to_playlist = set->value("auto_add_to_playlist", auto_add_to_playlist).toBool();
|
|---|
| 1310 | add_to_playlist_consecutive_files = set->value("add_to_playlist_consecutive_files", add_to_playlist_consecutive_files).toBool();
|
|---|
| 1311 |
|
|---|
| 1312 | #if LOGO_ANIMATION
|
|---|
| 1313 | animated_logo = set->value("animated_logo", animated_logo).toBool();
|
|---|
| 1314 | #endif
|
|---|
| 1315 |
|
|---|
| 1316 | set->endGroup(); // gui
|
|---|
| 1317 |
|
|---|
| 1318 |
|
|---|
| 1319 | /* ********
|
|---|
| 1320 | TV (dvb)
|
|---|
| 1321 | ******** */
|
|---|
| 1322 |
|
|---|
| 1323 | set->beginGroup( "tv");
|
|---|
| 1324 | check_channels_conf_on_startup = set->value("check_channels_conf_on_startup", check_channels_conf_on_startup).toBool();
|
|---|
| 1325 | initial_tv_deinterlace = set->value("initial_tv_deinterlace", initial_tv_deinterlace).toInt();
|
|---|
| 1326 | last_dvb_channel = set->value("last_dvb_channel", last_dvb_channel).toString();
|
|---|
| 1327 | last_tv_channel = set->value("last_tv_channel", last_tv_channel).toString();
|
|---|
| 1328 | set->endGroup(); // tv
|
|---|
| 1329 |
|
|---|
| 1330 |
|
|---|
| 1331 | /* ***********
|
|---|
| 1332 | Directories
|
|---|
| 1333 | *********** */
|
|---|
| 1334 |
|
|---|
| 1335 | set->beginGroup( "directories");
|
|---|
| 1336 | save_dirs = set->value("save_dirs", save_dirs).toBool();
|
|---|
| 1337 | if (save_dirs) {
|
|---|
| 1338 | latest_dir = set->value("latest_dir", latest_dir).toString();
|
|---|
| 1339 | last_dvd_directory = set->value("last_dvd_directory", last_dvd_directory).toString();
|
|---|
| 1340 | }
|
|---|
| 1341 | set->endGroup(); // directories
|
|---|
| 1342 |
|
|---|
| 1343 |
|
|---|
| 1344 | /* **************
|
|---|
| 1345 | Initial values
|
|---|
| 1346 | ************** */
|
|---|
| 1347 |
|
|---|
| 1348 | set->beginGroup( "defaults");
|
|---|
| 1349 |
|
|---|
| 1350 | initial_sub_scale = set->value("initial_sub_scale", initial_sub_scale).toDouble();
|
|---|
| 1351 | initial_sub_scale_ass = set->value("initial_sub_scale_ass", initial_sub_scale_ass).toDouble();
|
|---|
| 1352 | initial_volume = set->value("initial_volume", initial_volume).toInt();
|
|---|
| 1353 | initial_contrast = set->value("initial_contrast", initial_contrast).toInt();
|
|---|
| 1354 | initial_brightness = set->value("initial_brightness", initial_brightness).toInt();
|
|---|
| 1355 | initial_hue = set->value("initial_hue", initial_hue).toInt();
|
|---|
| 1356 | initial_saturation = set->value("initial_saturation", initial_saturation).toInt();
|
|---|
| 1357 | initial_gamma = set->value("initial_gamma", initial_gamma).toInt();
|
|---|
| 1358 |
|
|---|
| 1359 | initial_audio_equalizer = set->value("initial_audio_equalizer", initial_audio_equalizer).toList();
|
|---|
| 1360 |
|
|---|
| 1361 | initial_zoom_factor = set->value("initial_zoom_factor", initial_zoom_factor).toDouble();
|
|---|
| 1362 | initial_sub_pos = set->value("initial_sub_pos", initial_sub_pos).toInt();
|
|---|
| 1363 |
|
|---|
| 1364 | initial_volnorm = set->value("initial_volnorm", initial_volnorm).toBool();
|
|---|
| 1365 | initial_postprocessing = set->value("initial_postprocessing", initial_postprocessing).toBool();
|
|---|
| 1366 |
|
|---|
| 1367 | initial_deinterlace = set->value("initial_deinterlace", initial_deinterlace).toInt();
|
|---|
| 1368 |
|
|---|
| 1369 | initial_audio_channels = set->value("initial_audio_channels", initial_audio_channels).toInt();
|
|---|
| 1370 | initial_stereo_mode = set->value("initial_stereo_mode", initial_stereo_mode).toInt();
|
|---|
| 1371 |
|
|---|
| 1372 | initial_audio_track = set->value("initial_audio_track", initial_audio_track).toInt();
|
|---|
| 1373 | initial_subtitle_track = set->value("initial_subtitle_track", initial_subtitle_track).toInt();
|
|---|
| 1374 |
|
|---|
| 1375 | set->endGroup(); // defaults
|
|---|
| 1376 |
|
|---|
| 1377 |
|
|---|
| 1378 | /* ************
|
|---|
| 1379 | MPlayer info
|
|---|
| 1380 | ************ */
|
|---|
| 1381 |
|
|---|
| 1382 | set->beginGroup( "mplayer_info");
|
|---|
| 1383 | mplayer_detected_version = set->value("mplayer_detected_version", mplayer_detected_version).toInt();
|
|---|
| 1384 | mplayer_user_supplied_version = set->value("mplayer_user_supplied_version", mplayer_user_supplied_version).toInt();
|
|---|
| 1385 | mplayer_is_mplayer2 = set->value("is_mplayer2", mplayer_is_mplayer2).toBool();
|
|---|
| 1386 | mplayer2_detected_version = set->value("mplayer2_detected_version", mplayer2_detected_version).toString();
|
|---|
| 1387 |
|
|---|
| 1388 | set->endGroup(); // mplayer_info
|
|---|
| 1389 |
|
|---|
| 1390 |
|
|---|
| 1391 | /* *********
|
|---|
| 1392 | Instances
|
|---|
| 1393 | ********* */
|
|---|
| 1394 | #ifdef SINGLE_INSTANCE
|
|---|
| 1395 | set->beginGroup("instances");
|
|---|
| 1396 | use_single_instance = set->value("single_instance_enabled", use_single_instance).toBool();
|
|---|
| 1397 | set->endGroup(); // instances
|
|---|
| 1398 | #endif
|
|---|
| 1399 |
|
|---|
| 1400 |
|
|---|
| 1401 | /* ****************
|
|---|
| 1402 | Floating control
|
|---|
| 1403 | **************** */
|
|---|
| 1404 |
|
|---|
| 1405 | set->beginGroup("floating_control");
|
|---|
| 1406 | floating_control_margin = set->value("margin", floating_control_margin).toInt();
|
|---|
| 1407 | floating_control_width = set->value("width", floating_control_width).toInt();
|
|---|
| 1408 | floating_control_animated = set->value("animated", floating_control_animated).toBool();
|
|---|
| 1409 | floating_display_in_compact_mode = set->value("display_in_compact_mode", floating_display_in_compact_mode).toBool();
|
|---|
| 1410 | #ifndef Q_OS_WIN
|
|---|
| 1411 | bypass_window_manager = set->value("bypass_window_manager", bypass_window_manager).toBool();
|
|---|
| 1412 | #endif
|
|---|
| 1413 | set->endGroup(); // floating_control
|
|---|
| 1414 |
|
|---|
| 1415 |
|
|---|
| 1416 | /* *******
|
|---|
| 1417 | History
|
|---|
| 1418 | ******* */
|
|---|
| 1419 |
|
|---|
| 1420 | set->beginGroup("history");
|
|---|
| 1421 |
|
|---|
| 1422 | history_recents->setMaxItems( set->value("recents/max_items", history_recents->maxItems()).toInt() );
|
|---|
| 1423 | history_recents->fromStringList( set->value("recents", history_recents->toStringList()).toStringList() );
|
|---|
| 1424 |
|
|---|
| 1425 | history_urls->setMaxItems( set->value("urls/max_items", history_urls->maxItems()).toInt() );
|
|---|
| 1426 | history_urls->fromStringList( set->value("urls", history_urls->toStringList()).toStringList() );
|
|---|
| 1427 |
|
|---|
| 1428 | set->endGroup(); // history
|
|---|
| 1429 |
|
|---|
| 1430 |
|
|---|
| 1431 | /* *******
|
|---|
| 1432 | Filters
|
|---|
| 1433 | ******* */
|
|---|
| 1434 |
|
|---|
| 1435 | filters->load(set);
|
|---|
| 1436 |
|
|---|
| 1437 |
|
|---|
| 1438 | /* *********
|
|---|
| 1439 | SMPlayer info
|
|---|
| 1440 | ********* */
|
|---|
| 1441 |
|
|---|
| 1442 | #ifdef CHECK_UPGRADED
|
|---|
| 1443 | set->beginGroup("smplayer");
|
|---|
| 1444 | smplayer_stable_version = set->value("stable_version", smplayer_stable_version).toString();
|
|---|
| 1445 | check_if_upgraded = set->value("check_if_upgraded", check_if_upgraded).toBool();
|
|---|
| 1446 | #endif
|
|---|
| 1447 | #ifdef FONTCACHE_DIALOG
|
|---|
| 1448 | smplayer_version = set->value("version", smplayer_version).toString();
|
|---|
| 1449 | #endif
|
|---|
| 1450 | set->endGroup();
|
|---|
| 1451 |
|
|---|
| 1452 |
|
|---|
| 1453 | /* *********
|
|---|
| 1454 | Update
|
|---|
| 1455 | ********* */
|
|---|
| 1456 |
|
|---|
| 1457 | #ifdef UPDATE_CHECKER
|
|---|
| 1458 | update_checker_data.load(set);
|
|---|
| 1459 | #endif
|
|---|
| 1460 |
|
|---|
| 1461 |
|
|---|
| 1462 | // Fix some values if config is old
|
|---|
| 1463 | if (config_version < CURRENT_CONFIG_VERSION) {
|
|---|
| 1464 | qDebug("Preferences::load: config version is old, updating it");
|
|---|
| 1465 | /*
|
|---|
| 1466 | if (config_version <= 2) {
|
|---|
| 1467 | use_slices = false;
|
|---|
| 1468 | }
|
|---|
| 1469 | if (config_version <= 3) {
|
|---|
| 1470 | osd = None;
|
|---|
| 1471 | frame_drop = false;
|
|---|
| 1472 | cache_for_files = 2048;
|
|---|
| 1473 | cache_for_streams = 2048;
|
|---|
| 1474 | time_to_kill_mplayer = 1000;
|
|---|
| 1475 | }
|
|---|
| 1476 | */
|
|---|
| 1477 | if (config_version <= 4) {
|
|---|
| 1478 | use_slices = false;
|
|---|
| 1479 | osd = None;
|
|---|
| 1480 | frame_drop = false;
|
|---|
| 1481 | cache_for_files = 2048;
|
|---|
| 1482 | cache_for_streams = 2048;
|
|---|
| 1483 | time_to_kill_mplayer = 1000;
|
|---|
| 1484 |
|
|---|
| 1485 | resize_method = Never;
|
|---|
| 1486 | move_when_dragging = false;
|
|---|
| 1487 | }
|
|---|
| 1488 | config_version = CURRENT_CONFIG_VERSION;
|
|---|
| 1489 | }
|
|---|
| 1490 |
|
|---|
| 1491 | #ifdef Q_OS_WIN
|
|---|
| 1492 | // Check if the mplayer binary exists and try to fix it
|
|---|
| 1493 | if (!QFile::exists(mplayer_bin)) {
|
|---|
| 1494 | qWarning("mplayer_bin '%s' doesn' exist", mplayer_bin.toLatin1().constData());
|
|---|
| 1495 | bool fixed = false;
|
|---|
| 1496 | if (QFile::exists("mplayer/mplayer.exe")) {
|
|---|
| 1497 | mplayer_bin = "mplayer/mplayer.exe";
|
|---|
| 1498 | fixed = true;
|
|---|
| 1499 | } else
|
|---|
| 1500 | if (QFile::exists("mplayer/mplayer2.exe")) {
|
|---|
| 1501 | mplayer_bin = "mplayer/mplayer2.exe";
|
|---|
| 1502 | fixed = true;
|
|---|
| 1503 | }
|
|---|
| 1504 | if (fixed) {
|
|---|
| 1505 | qWarning("mplayer_bin changed to '%s'", mplayer_bin.toLatin1().constData());
|
|---|
| 1506 | }
|
|---|
| 1507 | }
|
|---|
| 1508 | #endif
|
|---|
| 1509 | }
|
|---|
| 1510 |
|
|---|
| 1511 | #endif // NO_USE_INI_FILES
|
|---|
| 1512 |
|
|---|
| 1513 | double Preferences::monitor_aspect_double() {
|
|---|
| 1514 | qDebug("Preferences::monitor_aspect_double");
|
|---|
| 1515 |
|
|---|
| 1516 | QRegExp exp("(\\d+)[:/](\\d+)");
|
|---|
| 1517 | if (exp.indexIn( monitor_aspect ) != -1) {
|
|---|
| 1518 | int w = exp.cap(1).toInt();
|
|---|
| 1519 | int h = exp.cap(2).toInt();
|
|---|
| 1520 | qDebug(" monitor_aspect parsed successfully: %d:%d", w, h);
|
|---|
| 1521 | return (double) w/h;
|
|---|
| 1522 | }
|
|---|
| 1523 |
|
|---|
| 1524 | bool ok;
|
|---|
| 1525 | double res = monitor_aspect.toDouble(&ok);
|
|---|
| 1526 | if (ok) {
|
|---|
| 1527 | qDebug(" monitor_aspect parsed successfully: %f", res);
|
|---|
| 1528 | return res;
|
|---|
| 1529 | } else {
|
|---|
| 1530 | qDebug(" warning: monitor_aspect couldn't be parsed!");
|
|---|
| 1531 | qDebug(" monitor_aspect set to 0");
|
|---|
| 1532 | return 0;
|
|---|
| 1533 | }
|
|---|
| 1534 | }
|
|---|
| 1535 |
|
|---|
| 1536 | void Preferences::setupScreenshotFolder() {
|
|---|
| 1537 | #if QT_VERSION >= 0x040400
|
|---|
| 1538 | if (screenshot_directory.isEmpty()) {
|
|---|
| 1539 | QString pdir = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
|
|---|
| 1540 | if (pdir.isEmpty()) pdir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
|
|---|
| 1541 | if (pdir.isEmpty()) pdir = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
|
|---|
| 1542 | if (pdir.isEmpty()) pdir = "/tmp";
|
|---|
| 1543 | if (!QFile::exists(pdir)) {
|
|---|
| 1544 | qWarning("Preferences::setupScreenshotFolder: folder '%s' does not exist. Using /tmp as fallback", pdir.toUtf8().constData());
|
|---|
| 1545 | pdir = "/tmp";
|
|---|
| 1546 | }
|
|---|
| 1547 | QString default_screenshot_path = pdir + "/smplayer_screenshots";
|
|---|
| 1548 | if (!QFile::exists(default_screenshot_path)) {
|
|---|
| 1549 | qDebug("Preferences::setupScreenshotFolder: creating '%s'", default_screenshot_path.toUtf8().constData());
|
|---|
| 1550 | if (!QDir().mkdir(default_screenshot_path)) {
|
|---|
| 1551 | qWarning("Preferences::setupScreenshotFolder: failed to create '%s'", default_screenshot_path.toUtf8().constData());
|
|---|
| 1552 | }
|
|---|
| 1553 | }
|
|---|
| 1554 | if (QFile::exists(default_screenshot_path)) {
|
|---|
| 1555 | screenshot_directory = default_screenshot_path;
|
|---|
| 1556 | }
|
|---|
| 1557 | }
|
|---|
| 1558 | #endif
|
|---|
| 1559 | }
|
|---|