1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
3 |
|
---|
4 | This program is free software; you can redistribute it and/or modify
|
---|
5 | it under the terms of the GNU General Public License as published by
|
---|
6 | the Free Software Foundation; either version 2 of the License, or
|
---|
7 | (at your option) any later version.
|
---|
8 |
|
---|
9 | This program is distributed in the hope that it will be useful,
|
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License
|
---|
15 | along with this program; if not, write to the Free Software
|
---|
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | #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 | #include "autohidewidget.h"
|
---|
27 | #include "helper.h"
|
---|
28 |
|
---|
29 | #include <QSettings>
|
---|
30 | #include <QFileInfo>
|
---|
31 | #include <QRegExp>
|
---|
32 | #include <QDir>
|
---|
33 | #include <QLocale>
|
---|
34 | #include <QNetworkProxy>
|
---|
35 |
|
---|
36 | #if QT_VERSION >= 0x050000
|
---|
37 | #include <QStandardPaths>
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | #if QT_VERSION >= 0x040400
|
---|
41 | #include <QDesktopServices>
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #ifdef YOUTUBE_SUPPORT
|
---|
45 | #include "retrieveyoutubeurl.h"
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | //#define USE_CONFIG_VERSION
|
---|
49 | #ifdef USE_CONFIG_VERSION
|
---|
50 | #define CURRENT_CONFIG_VERSION 4
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | using namespace Global;
|
---|
54 |
|
---|
55 | Preferences::Preferences() {
|
---|
56 | history_recents = new Recents;
|
---|
57 | history_urls = new URLHistory;
|
---|
58 | filters = new Filters;
|
---|
59 |
|
---|
60 | reset();
|
---|
61 |
|
---|
62 | load();
|
---|
63 | }
|
---|
64 |
|
---|
65 | Preferences::~Preferences() {
|
---|
66 | save();
|
---|
67 |
|
---|
68 | delete history_recents;
|
---|
69 | delete history_urls;
|
---|
70 | delete filters;
|
---|
71 | }
|
---|
72 |
|
---|
73 | void Preferences::reset() {
|
---|
74 | /* *******
|
---|
75 | General
|
---|
76 | ******* */
|
---|
77 |
|
---|
78 | #ifdef USE_CONFIG_VERSION
|
---|
79 | config_version = CURRENT_CONFIG_VERSION;
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
---|
83 | //mplayer_bin= "mplayer/mplayer.exe";
|
---|
84 | mplayer_bin= "mpv/mpv.exe";
|
---|
85 | #else
|
---|
86 | //mplayer_bin = "mplayer";
|
---|
87 | mplayer_bin = "mpv";
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | vo = "player_default";
|
---|
91 | ao = "player_default";
|
---|
92 |
|
---|
93 | use_screenshot = true;
|
---|
94 | #ifdef MPV_SUPPORT
|
---|
95 | screenshot_template = "cap_%F_%p_%02n";
|
---|
96 | screenshot_format = "jpg";
|
---|
97 | #endif
|
---|
98 | screenshot_directory="";
|
---|
99 | #ifdef PORTABLE_APP
|
---|
100 | screenshot_directory= "./screenshots";
|
---|
101 | #else
|
---|
102 | #if QT_VERSION < 0x040400
|
---|
103 | QString default_screenshot_path = Paths::configPath() + "/screenshots";
|
---|
104 | if (QFile::exists(default_screenshot_path)) {
|
---|
105 | screenshot_directory = default_screenshot_path;
|
---|
106 | }
|
---|
107 | #endif
|
---|
108 | #endif
|
---|
109 |
|
---|
110 | #ifdef CAPTURE_STREAM
|
---|
111 | capture_directory = "";
|
---|
112 | #endif
|
---|
113 |
|
---|
114 | remember_media_settings = true;
|
---|
115 | remember_time_pos = true;
|
---|
116 | remember_stream_settings = true;
|
---|
117 |
|
---|
118 | audio_lang = "";
|
---|
119 | subtitle_lang = "";
|
---|
120 |
|
---|
121 | use_direct_rendering = false;
|
---|
122 | use_double_buffer = true;
|
---|
123 |
|
---|
124 | use_soft_video_eq = false;
|
---|
125 | use_slices = false;
|
---|
126 | autoq = 6;
|
---|
127 | add_blackborders_on_fullscreen = false;
|
---|
128 |
|
---|
129 | #ifdef Q_OS_WIN
|
---|
130 | #ifdef SCREENSAVER_OFF
|
---|
131 | turn_screensaver_off = false;
|
---|
132 | #endif
|
---|
133 | #ifdef AVOID_SCREENSAVER
|
---|
134 | avoid_screensaver = true;
|
---|
135 | #endif
|
---|
136 | #else
|
---|
137 | disable_screensaver = true;
|
---|
138 | #endif
|
---|
139 |
|
---|
140 | #ifndef Q_OS_WIN
|
---|
141 | vdpau.ffh264vdpau = true;
|
---|
142 | vdpau.ffmpeg12vdpau = true;
|
---|
143 | vdpau.ffwmv3vdpau = true;
|
---|
144 | vdpau.ffvc1vdpau = true;
|
---|
145 | vdpau.ffodivxvdpau = false;
|
---|
146 | vdpau.disable_video_filters = true;
|
---|
147 | #endif
|
---|
148 |
|
---|
149 | #ifdef Q_OS_WIN
|
---|
150 | use_soft_vol = false;
|
---|
151 | #else
|
---|
152 | use_soft_vol = true;
|
---|
153 | #endif
|
---|
154 | softvol_max = 110; // 110 = default value in mplayer
|
---|
155 | use_scaletempo = Detect;
|
---|
156 | use_hwac3 = false;
|
---|
157 | use_audio_equalizer = true;
|
---|
158 |
|
---|
159 | global_volume = true;
|
---|
160 | volume = 50;
|
---|
161 | mute = false;
|
---|
162 |
|
---|
163 | global_audio_equalizer = true;
|
---|
164 | audio_equalizer << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // FIXME: use initial_audio_equalizer (but it's set later)
|
---|
165 |
|
---|
166 | autosync = false;
|
---|
167 | autosync_factor = 100;
|
---|
168 |
|
---|
169 | use_mc = false;
|
---|
170 | mc_value = 0;
|
---|
171 |
|
---|
172 | autoload_m4a = true;
|
---|
173 | min_step = 4;
|
---|
174 |
|
---|
175 | osd = Seek;
|
---|
176 | osd_scale = 1;
|
---|
177 | subfont_osd_scale = 3;
|
---|
178 | osd_delay = 2200;
|
---|
179 |
|
---|
180 | file_settings_method = "hash"; // Possible values: normal & hash
|
---|
181 |
|
---|
182 | tablet_mode = false;
|
---|
183 | #ifdef Q_OS_WIN
|
---|
184 | tablet_mode_change_answer = "";
|
---|
185 | #endif
|
---|
186 |
|
---|
187 | /* ***************
|
---|
188 | Drives (CD/DVD)
|
---|
189 | *************** */
|
---|
190 |
|
---|
191 | dvd_device = "";
|
---|
192 | cdrom_device = "";
|
---|
193 | #ifdef BLURAY_SUPPORT
|
---|
194 | bluray_device = "";
|
---|
195 | #endif
|
---|
196 |
|
---|
197 | #ifndef Q_OS_WIN
|
---|
198 | // Try to set default values
|
---|
199 | if (QFile::exists("/dev/dvd")) dvd_device = "/dev/dvd";
|
---|
200 | if (QFile::exists("/dev/cdrom")) cdrom_device = "/dev/cdrom";
|
---|
201 | #endif
|
---|
202 |
|
---|
203 | #ifdef Q_OS_WIN
|
---|
204 | enable_audiocd_on_windows = false;
|
---|
205 | #endif
|
---|
206 |
|
---|
207 | vcd_initial_title = 2; // Most VCD's start at title #2
|
---|
208 |
|
---|
209 | #if DVDNAV_SUPPORT
|
---|
210 | use_dvdnav = false;
|
---|
211 | #endif
|
---|
212 |
|
---|
213 |
|
---|
214 | /* ***********
|
---|
215 | Performance
|
---|
216 | *********** */
|
---|
217 |
|
---|
218 | #ifdef Q_OS_WIN
|
---|
219 | priority = Normal;
|
---|
220 | #endif
|
---|
221 | frame_drop = false;
|
---|
222 | hard_frame_drop = false;
|
---|
223 | coreavc = false;
|
---|
224 | h264_skip_loop_filter = LoopEnabled;
|
---|
225 | HD_height = 720;
|
---|
226 |
|
---|
227 | #ifdef OBSOLETE_FAST_AUDIO_CHANGE
|
---|
228 | // MPlayer 1.0rc1 require restart, new versions don't
|
---|
229 | fast_audio_change = Detect;
|
---|
230 | #endif
|
---|
231 |
|
---|
232 | #if !SMART_DVD_CHAPTERS
|
---|
233 | fast_chapter_change = false;
|
---|
234 | #endif
|
---|
235 |
|
---|
236 | threads = 1;
|
---|
237 | hwdec = "no";
|
---|
238 |
|
---|
239 | cache_auto = true;
|
---|
240 | cache_for_files = 2048;
|
---|
241 | cache_for_streams = 2048;
|
---|
242 | cache_for_dvds = 0; // not recommended to use cache for dvds
|
---|
243 | cache_for_vcds = 1024;
|
---|
244 | cache_for_audiocds = 1024;
|
---|
245 | #ifdef TV_SUPPORT
|
---|
246 | cache_for_tv = 3000;
|
---|
247 | #endif
|
---|
248 |
|
---|
249 |
|
---|
250 | /* *********
|
---|
251 | Subtitles
|
---|
252 | ********* */
|
---|
253 |
|
---|
254 | subcp = "ISO-8859-1";
|
---|
255 | use_enca = false;
|
---|
256 | enca_lang = QString(QLocale::system().name()).section("_",0,0);
|
---|
257 | subfuzziness = 1;
|
---|
258 | autoload_sub = true;
|
---|
259 |
|
---|
260 | use_ass_subtitles = true;
|
---|
261 | enable_ass_styles = true;
|
---|
262 | ass_line_spacing = 0;
|
---|
263 |
|
---|
264 | use_forced_subs_only = false;
|
---|
265 |
|
---|
266 | sub_visibility = true;
|
---|
267 |
|
---|
268 | subtitles_on_screenshots = false;
|
---|
269 |
|
---|
270 | change_sub_scale_should_restart = Detect;
|
---|
271 |
|
---|
272 | fast_load_sub = true;
|
---|
273 |
|
---|
274 | // ASS styles
|
---|
275 | // Nothing to do, default values are given in
|
---|
276 | // AssStyles constructor
|
---|
277 |
|
---|
278 | force_ass_styles = false;
|
---|
279 | user_forced_ass_style.clear();
|
---|
280 |
|
---|
281 | freetype_support = true;
|
---|
282 | #ifdef FONTS_HACK
|
---|
283 | use_windowsfontdir = false;
|
---|
284 | #endif
|
---|
285 |
|
---|
286 |
|
---|
287 | /* ********
|
---|
288 | Advanced
|
---|
289 | ******** */
|
---|
290 |
|
---|
291 | #if USE_ADAPTER
|
---|
292 | adapter = -1;
|
---|
293 | #endif
|
---|
294 |
|
---|
295 | #if USE_COLORKEY
|
---|
296 | color_key = 0x020202;
|
---|
297 | #endif
|
---|
298 |
|
---|
299 | use_mplayer_window = false;
|
---|
300 |
|
---|
301 | monitor_aspect=""; // Autodetect
|
---|
302 |
|
---|
303 | use_idx = false;
|
---|
304 | use_lavf_demuxer = false;
|
---|
305 |
|
---|
306 | mplayer_additional_options="";
|
---|
307 | #if defined(PORTABLE_APP) && defined(FONTS_HACK)
|
---|
308 | mplayer_additional_options="-nofontconfig";
|
---|
309 | #endif
|
---|
310 | mplayer_additional_video_filters="";
|
---|
311 | mplayer_additional_audio_filters="";
|
---|
312 |
|
---|
313 | #ifdef LOG_MPLAYER
|
---|
314 | log_mplayer = true;
|
---|
315 | verbose_log = false;
|
---|
316 | autosave_mplayer_log = false;
|
---|
317 | mplayer_log_saveto = "";
|
---|
318 | #endif
|
---|
319 | #ifdef LOG_SMPLAYER
|
---|
320 | log_smplayer = true;
|
---|
321 | log_filter = ".*";
|
---|
322 | save_smplayer_log = false;
|
---|
323 | #endif
|
---|
324 |
|
---|
325 | #if REPAINT_BACKGROUND_OPTION
|
---|
326 | // "Repaint video background" in the preferences dialog
|
---|
327 | #ifndef Q_OS_WIN
|
---|
328 | // Note: on linux there could be flickering when using mplayer if this option is true
|
---|
329 | // but setting it to false could display a corrupted window
|
---|
330 | // from the moment the user press play until playback actually starts
|
---|
331 | repaint_video_background = true;
|
---|
332 | #else
|
---|
333 | repaint_video_background = true;
|
---|
334 | #endif
|
---|
335 | #endif
|
---|
336 |
|
---|
337 | use_edl_files = true;
|
---|
338 |
|
---|
339 | #ifdef MPLAYER_SUPPORT
|
---|
340 | use_playlist_option = false;
|
---|
341 | #endif
|
---|
342 |
|
---|
343 | prefer_ipv4 = true;
|
---|
344 |
|
---|
345 | use_short_pathnames = false;
|
---|
346 |
|
---|
347 | change_video_equalizer_on_startup = true;
|
---|
348 |
|
---|
349 | use_pausing_keep_force = true;
|
---|
350 |
|
---|
351 | use_correct_pts = Detect;
|
---|
352 |
|
---|
353 | actions_to_run = "";
|
---|
354 |
|
---|
355 | show_tag_in_window_title = true;
|
---|
356 |
|
---|
357 | time_to_kill_mplayer = 1000;
|
---|
358 |
|
---|
359 | #ifdef MPRIS2
|
---|
360 | use_mpris2 = true;
|
---|
361 | #endif
|
---|
362 |
|
---|
363 |
|
---|
364 | /* *********
|
---|
365 | GUI stuff
|
---|
366 | ********* */
|
---|
367 |
|
---|
368 | fullscreen = false;
|
---|
369 | start_in_fullscreen = false;
|
---|
370 | compact_mode = false;
|
---|
371 | stay_on_top = NeverOnTop;
|
---|
372 | size_factor = 100; // 100%
|
---|
373 |
|
---|
374 | resize_method = Never;
|
---|
375 |
|
---|
376 | #if STYLE_SWITCHING
|
---|
377 | #if QT_VERSION >= 0x050000
|
---|
378 | style = "Fusion";
|
---|
379 | #else
|
---|
380 | style="";
|
---|
381 | #endif
|
---|
382 | #endif
|
---|
383 |
|
---|
384 | center_window = false;
|
---|
385 | center_window_if_outside = false;
|
---|
386 |
|
---|
387 | #ifdef GLOBALSHORTCUTS
|
---|
388 | use_global_shortcuts = false;
|
---|
389 | #endif
|
---|
390 |
|
---|
391 | #if DVDNAV_SUPPORT
|
---|
392 | mouse_left_click_function = "dvdnav_mouse";
|
---|
393 | #else
|
---|
394 | mouse_left_click_function = "";
|
---|
395 | #endif
|
---|
396 | mouse_right_click_function = "show_context_menu";
|
---|
397 | mouse_double_click_function = "fullscreen";
|
---|
398 | mouse_middle_click_function = "mute";
|
---|
399 | mouse_xbutton1_click_function = "";
|
---|
400 | mouse_xbutton2_click_function = "";
|
---|
401 | wheel_function = Seeking;
|
---|
402 | wheel_function_cycle = Seeking | Volume | Zoom | ChangeSpeed;
|
---|
403 | wheel_function_seeking_reverse = false;
|
---|
404 |
|
---|
405 | drag_function = MoveWindow;
|
---|
406 |
|
---|
407 | seeking1 = 10;
|
---|
408 | seeking2 = 60;
|
---|
409 | seeking3 = 10*60;
|
---|
410 | seeking4 = 30;
|
---|
411 |
|
---|
412 | update_while_seeking = false;
|
---|
413 | #if ENABLE_DELAYED_DRAGGING
|
---|
414 | time_slider_drag_delay = 100;
|
---|
415 | #endif
|
---|
416 | #if SEEKBAR_RESOLUTION
|
---|
417 | relative_seeking = false;
|
---|
418 | #endif
|
---|
419 | precise_seeking = true;
|
---|
420 |
|
---|
421 | reset_stop = false;
|
---|
422 | delay_left_click = false;
|
---|
423 |
|
---|
424 | language = "";
|
---|
425 |
|
---|
426 | balloon_count = 5;
|
---|
427 |
|
---|
428 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
---|
429 | restore_pos_after_fullscreen = true;
|
---|
430 | #else
|
---|
431 | restore_pos_after_fullscreen = false;
|
---|
432 | #endif
|
---|
433 |
|
---|
434 | save_window_size_on_exit = true;
|
---|
435 |
|
---|
436 | close_on_finish = false;
|
---|
437 |
|
---|
438 | #ifdef AUTO_SHUTDOWN_PC
|
---|
439 | auto_shutdown_pc = false;
|
---|
440 | #endif
|
---|
441 |
|
---|
442 | default_font = "";
|
---|
443 |
|
---|
444 | pause_when_hidden = false;
|
---|
445 |
|
---|
446 | allow_video_movement = false;
|
---|
447 |
|
---|
448 | gui = "DefaultGUI";
|
---|
449 | iconset = "H2O";
|
---|
450 |
|
---|
451 |
|
---|
452 | #if USE_MINIMUMSIZE
|
---|
453 | gui_minimum_width = 0; // 0 == disabled
|
---|
454 | #endif
|
---|
455 | default_size = QSize(683, 509);
|
---|
456 |
|
---|
457 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
---|
458 | hide_video_window_on_audio_files = true;
|
---|
459 | #endif
|
---|
460 |
|
---|
461 | report_mplayer_crashes = true;
|
---|
462 |
|
---|
463 | #if REPORT_OLD_MPLAYER
|
---|
464 | reported_mplayer_is_old = false;
|
---|
465 | #endif
|
---|
466 |
|
---|
467 | auto_add_to_playlist = true;
|
---|
468 | media_to_add_to_playlist = NoFiles;
|
---|
469 |
|
---|
470 | #if LOGO_ANIMATION
|
---|
471 | animated_logo = true;
|
---|
472 | #endif
|
---|
473 |
|
---|
474 |
|
---|
475 | /* ********
|
---|
476 | TV (dvb)
|
---|
477 | ******** */
|
---|
478 | #ifdef TV_SUPPORT
|
---|
479 | check_channels_conf_on_startup = true;
|
---|
480 | initial_tv_deinterlace = MediaSettings::Yadif_1;
|
---|
481 | last_dvb_channel = "";
|
---|
482 | last_tv_channel = "";
|
---|
483 | #endif
|
---|
484 |
|
---|
485 |
|
---|
486 | /* ********
|
---|
487 | Network
|
---|
488 | ******** */
|
---|
489 |
|
---|
490 | #ifdef MPV_SUPPORT
|
---|
491 | streaming_type = StreamingAuto;
|
---|
492 | #else
|
---|
493 | streaming_type = StreamingYT;
|
---|
494 | #endif
|
---|
495 | #ifdef YOUTUBE_SUPPORT
|
---|
496 | yt_quality = RetrieveYoutubeUrl::MP4_720p;
|
---|
497 | //yt_user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:5.0.1) Gecko/20100101 Firefox/5.0.1";
|
---|
498 | yt_user_agent = "";
|
---|
499 | yt_use_https_main = false;
|
---|
500 | yt_use_https_vi = false;
|
---|
501 | #endif
|
---|
502 |
|
---|
503 | // Proxy
|
---|
504 | use_proxy = false;
|
---|
505 | proxy_type = QNetworkProxy::HttpProxy;
|
---|
506 | proxy_host = "";
|
---|
507 | proxy_port = 0;
|
---|
508 | proxy_username = "";
|
---|
509 | proxy_password = "";
|
---|
510 |
|
---|
511 |
|
---|
512 | /* ***********
|
---|
513 | Directories
|
---|
514 | *********** */
|
---|
515 |
|
---|
516 | latest_dir = QDir::homePath();
|
---|
517 | last_dvd_directory="";
|
---|
518 | save_dirs = true;
|
---|
519 |
|
---|
520 | /* **************
|
---|
521 | Initial values
|
---|
522 | ************** */
|
---|
523 |
|
---|
524 | initial_sub_scale = 5;
|
---|
525 | initial_sub_scale_ass = 1;
|
---|
526 | initial_volume = 40;
|
---|
527 | initial_contrast = 0;
|
---|
528 | initial_brightness = 0;
|
---|
529 | initial_hue = 0;
|
---|
530 | initial_saturation = 0;
|
---|
531 | initial_gamma = 0;
|
---|
532 |
|
---|
533 | initial_audio_equalizer << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
|
---|
534 |
|
---|
535 | initial_zoom_factor = 1.0;
|
---|
536 | initial_sub_pos = 100; // 100%
|
---|
537 |
|
---|
538 | initial_postprocessing = false;
|
---|
539 | initial_volnorm = false;
|
---|
540 |
|
---|
541 | initial_deinterlace = MediaSettings::NoDeinterlace;
|
---|
542 |
|
---|
543 | initial_audio_channels = MediaSettings::ChDefault;
|
---|
544 | initial_stereo_mode = MediaSettings::Stereo;
|
---|
545 |
|
---|
546 | initial_audio_track = 1;
|
---|
547 | initial_subtitle_track = 1;
|
---|
548 |
|
---|
549 |
|
---|
550 | /* ************
|
---|
551 | MPlayer info
|
---|
552 | ************ */
|
---|
553 |
|
---|
554 | mplayer_detected_version = -1; //None version parsed yet
|
---|
555 | mplayer_user_supplied_version = -1;
|
---|
556 | #ifdef MPLAYER2_SUPPORT
|
---|
557 | mplayer_is_mplayer2 = false;
|
---|
558 | mplayer2_detected_version = QString::null;
|
---|
559 | #endif
|
---|
560 |
|
---|
561 |
|
---|
562 | /* *********
|
---|
563 | Instances
|
---|
564 | ********* */
|
---|
565 | #ifdef SINGLE_INSTANCE
|
---|
566 | use_single_instance = true;
|
---|
567 | #endif
|
---|
568 |
|
---|
569 |
|
---|
570 | /* ****************
|
---|
571 | Floating control
|
---|
572 | **************** */
|
---|
573 |
|
---|
574 | floating_control_margin = 0;
|
---|
575 | floating_control_width = 100; //100%
|
---|
576 | floating_control_animated = true;
|
---|
577 | floating_display_in_compact_mode = false;
|
---|
578 | floating_activation_area = AutohideWidget::Anywhere;
|
---|
579 | floating_hide_delay = 3000;
|
---|
580 |
|
---|
581 |
|
---|
582 | /* *******
|
---|
583 | History
|
---|
584 | ******* */
|
---|
585 |
|
---|
586 | history_recents->clear();
|
---|
587 | history_urls->clear();
|
---|
588 |
|
---|
589 |
|
---|
590 | /* *******
|
---|
591 | Filters
|
---|
592 | ******* */
|
---|
593 |
|
---|
594 | filters->init();
|
---|
595 |
|
---|
596 |
|
---|
597 | /* *********
|
---|
598 | SMPlayer info
|
---|
599 | ********* */
|
---|
600 |
|
---|
601 | #ifdef CHECK_UPGRADED
|
---|
602 | smplayer_stable_version = "";
|
---|
603 | check_if_upgraded = true;
|
---|
604 | #endif
|
---|
605 | #ifdef FONTCACHE_DIALOG
|
---|
606 | smplayer_version = "";
|
---|
607 | #endif
|
---|
608 | }
|
---|
609 |
|
---|
610 | void Preferences::save() {
|
---|
611 | qDebug("Preferences::save");
|
---|
612 |
|
---|
613 | QSettings * set = settings;
|
---|
614 |
|
---|
615 |
|
---|
616 | /* *******
|
---|
617 | General
|
---|
618 | ******* */
|
---|
619 |
|
---|
620 | set->beginGroup("General");
|
---|
621 |
|
---|
622 | set->setValue("config_version", config_version);
|
---|
623 |
|
---|
624 | set->setValue("mplayer_bin", mplayer_bin);
|
---|
625 | set->setValue("driver/vo", vo);
|
---|
626 | set->setValue("driver/audio_output", ao);
|
---|
627 |
|
---|
628 | set->setValue("use_screenshot", use_screenshot);
|
---|
629 | #ifdef MPV_SUPPORT
|
---|
630 | set->setValue("screenshot_template", screenshot_template);
|
---|
631 | set->setValue("screenshot_format", screenshot_format);
|
---|
632 | #endif
|
---|
633 | #if QT_VERSION >= 0x040400
|
---|
634 | set->setValue("screenshot_folder", screenshot_directory);
|
---|
635 | #else
|
---|
636 | set->setValue("screenshot_directory", screenshot_directory);
|
---|
637 | #endif
|
---|
638 |
|
---|
639 | #ifdef CAPTURE_STREAM
|
---|
640 | set->setValue("capture_directory", capture_directory);
|
---|
641 | #endif
|
---|
642 |
|
---|
643 | set->setValue("remember_media_settings", remember_media_settings);
|
---|
644 | set->setValue("remember_time_pos", remember_time_pos);
|
---|
645 | set->setValue("remember_stream_settings", remember_stream_settings);
|
---|
646 |
|
---|
647 | set->setValue("audio_lang", audio_lang);
|
---|
648 | set->setValue("subtitle_lang", subtitle_lang);
|
---|
649 |
|
---|
650 | set->setValue("use_direct_rendering", use_direct_rendering);
|
---|
651 | set->setValue("use_double_buffer", use_double_buffer);
|
---|
652 | set->setValue("use_soft_video_eq", use_soft_video_eq);
|
---|
653 | set->setValue("use_slices", use_slices );
|
---|
654 | set->setValue("autoq", autoq);
|
---|
655 | set->setValue("add_blackborders_on_fullscreen", add_blackborders_on_fullscreen);
|
---|
656 |
|
---|
657 | #ifdef Q_OS_WIN
|
---|
658 | #ifdef SCREENSAVER_OFF
|
---|
659 | set->setValue("turn_screensaver_off", turn_screensaver_off);
|
---|
660 | #endif
|
---|
661 | #ifdef AVOID_SCREENSAVER
|
---|
662 | set->setValue("avoid_screensaver", avoid_screensaver);
|
---|
663 | #endif
|
---|
664 | #else
|
---|
665 | set->setValue("disable_screensaver", disable_screensaver);
|
---|
666 | #endif
|
---|
667 |
|
---|
668 | #ifndef Q_OS_WIN
|
---|
669 | set->setValue("vdpau_ffh264vdpau", vdpau.ffh264vdpau);
|
---|
670 | set->setValue("vdpau_ffmpeg12vdpau", vdpau.ffmpeg12vdpau);
|
---|
671 | set->setValue("vdpau_ffwmv3vdpau", vdpau.ffwmv3vdpau);
|
---|
672 | set->setValue("vdpau_ffvc1vdpau", vdpau.ffvc1vdpau);
|
---|
673 | set->setValue("vdpau_ffodivxvdpau", vdpau.ffodivxvdpau);
|
---|
674 | set->setValue("vdpau_disable_video_filters", vdpau.disable_video_filters);
|
---|
675 | #endif
|
---|
676 |
|
---|
677 | set->setValue("use_soft_vol", use_soft_vol);
|
---|
678 | set->setValue("softvol_max", softvol_max);
|
---|
679 | set->setValue("use_scaletempo", use_scaletempo);
|
---|
680 | set->setValue("use_hwac3", use_hwac3 );
|
---|
681 | set->setValue("use_audio_equalizer", use_audio_equalizer );
|
---|
682 |
|
---|
683 | set->setValue("global_volume", global_volume);
|
---|
684 | set->setValue("volume", volume);
|
---|
685 | set->setValue("mute", mute);
|
---|
686 |
|
---|
687 | set->setValue("global_audio_equalizer", global_audio_equalizer);
|
---|
688 | set->setValue("audio_equalizer", audio_equalizer);
|
---|
689 |
|
---|
690 | set->setValue("autosync", autosync);
|
---|
691 | set->setValue("autosync_factor", autosync_factor);
|
---|
692 |
|
---|
693 | set->setValue("use_mc", use_mc);
|
---|
694 | set->setValue("mc_value", mc_value);
|
---|
695 |
|
---|
696 | set->setValue("autoload_m4a", autoload_m4a);
|
---|
697 | set->setValue("min_step", min_step);
|
---|
698 |
|
---|
699 | set->setValue("osd", osd);
|
---|
700 | set->setValue("osd_scale", osd_scale);
|
---|
701 | set->setValue("subfont_osd_scale", subfont_osd_scale);
|
---|
702 | set->setValue("osd_delay", osd_delay);
|
---|
703 |
|
---|
704 | set->setValue("file_settings_method", file_settings_method);
|
---|
705 |
|
---|
706 | set->setValue("tablet_mode", tablet_mode);
|
---|
707 | #ifdef Q_OS_WIN
|
---|
708 | set->setValue("tablet_mode_change_answer", tablet_mode_change_answer);
|
---|
709 | #endif
|
---|
710 |
|
---|
711 | set->endGroup(); // General
|
---|
712 |
|
---|
713 |
|
---|
714 | /* ***************
|
---|
715 | Drives (CD/DVD)
|
---|
716 | *************** */
|
---|
717 |
|
---|
718 | set->beginGroup( "drives");
|
---|
719 |
|
---|
720 | set->setValue("dvd_device", dvd_device);
|
---|
721 | set->setValue("cdrom_device", cdrom_device);
|
---|
722 | #ifdef BLURAY_SUPPORT
|
---|
723 | set->setValue("bluray_device", bluray_device);
|
---|
724 | #endif
|
---|
725 |
|
---|
726 | #ifdef Q_OS_WIN
|
---|
727 | set->setValue("enable_audiocd_on_windows", enable_audiocd_on_windows);
|
---|
728 | #endif
|
---|
729 |
|
---|
730 | set->setValue("vcd_initial_title", vcd_initial_title);
|
---|
731 |
|
---|
732 | #if DVDNAV_SUPPORT
|
---|
733 | set->setValue("use_dvdnav", use_dvdnav);
|
---|
734 | #endif
|
---|
735 |
|
---|
736 | set->endGroup(); // drives
|
---|
737 |
|
---|
738 |
|
---|
739 | /* ***********
|
---|
740 | Performance
|
---|
741 | *********** */
|
---|
742 |
|
---|
743 | set->beginGroup( "performance");
|
---|
744 |
|
---|
745 | #ifdef Q_OS_WIN
|
---|
746 | set->setValue("priority", priority);
|
---|
747 | #endif
|
---|
748 | set->setValue("frame_drop", frame_drop);
|
---|
749 | set->setValue("hard_frame_drop", hard_frame_drop);
|
---|
750 | set->setValue("coreavc", coreavc);
|
---|
751 | set->setValue("h264_skip_loop_filter", h264_skip_loop_filter);
|
---|
752 | set->setValue("HD_height", HD_height);
|
---|
753 |
|
---|
754 | #ifdef OBSOLETE_FAST_AUDIO_CHANGE
|
---|
755 | set->setValue("fast_audio_change", fast_audio_change);
|
---|
756 | #endif
|
---|
757 |
|
---|
758 | #if !SMART_DVD_CHAPTERS
|
---|
759 | set->setValue("fast_chapter_change", fast_chapter_change);
|
---|
760 | #endif
|
---|
761 |
|
---|
762 | set->setValue("threads", threads);
|
---|
763 | set->setValue("hwdec", hwdec);
|
---|
764 |
|
---|
765 | set->setValue("cache_auto", cache_auto);
|
---|
766 | set->setValue("cache_for_files", cache_for_files);
|
---|
767 | set->setValue("cache_for_streams", cache_for_streams);
|
---|
768 | set->setValue("cache_for_dvds", cache_for_dvds);
|
---|
769 | set->setValue("cache_for_vcds", cache_for_vcds);
|
---|
770 | set->setValue("cache_for_audiocds", cache_for_audiocds);
|
---|
771 | #ifdef TV_SUPPORT
|
---|
772 | set->setValue("cache_for_tv", cache_for_tv);
|
---|
773 | #endif
|
---|
774 |
|
---|
775 | set->endGroup(); // performance
|
---|
776 |
|
---|
777 |
|
---|
778 | /* *********
|
---|
779 | Subtitles
|
---|
780 | ********* */
|
---|
781 |
|
---|
782 | set->beginGroup("subtitles");
|
---|
783 |
|
---|
784 | set->setValue("subcp", subcp);
|
---|
785 | set->setValue("use_enca", use_enca);
|
---|
786 | set->setValue("enca_lang", enca_lang);
|
---|
787 | set->setValue("subfuzziness", subfuzziness);
|
---|
788 | set->setValue("autoload_sub", autoload_sub);
|
---|
789 |
|
---|
790 | set->setValue("use_ass_subtitles", use_ass_subtitles);
|
---|
791 | set->setValue("enable_ass_styles", enable_ass_styles);
|
---|
792 | set->setValue("ass_line_spacing", ass_line_spacing);
|
---|
793 | set->setValue("use_forced_subs_only", use_forced_subs_only);
|
---|
794 |
|
---|
795 | set->setValue("sub_visibility", sub_visibility);
|
---|
796 |
|
---|
797 | set->setValue("subtitles_on_screenshots", subtitles_on_screenshots);
|
---|
798 |
|
---|
799 | set->setValue("change_sub_scale_should_restart", change_sub_scale_should_restart);
|
---|
800 |
|
---|
801 | set->setValue("fast_load_sub", fast_load_sub);
|
---|
802 |
|
---|
803 | // ASS styles
|
---|
804 | ass_styles.save(set);
|
---|
805 | set->setValue("force_ass_styles", force_ass_styles);
|
---|
806 | set->setValue("user_forced_ass_style", user_forced_ass_style);
|
---|
807 |
|
---|
808 | set->setValue("freetype_support", freetype_support);
|
---|
809 | #ifdef FONTS_HACK
|
---|
810 | set->setValue("use_windowsfontdir", use_windowsfontdir);
|
---|
811 | #endif
|
---|
812 |
|
---|
813 | set->endGroup(); // subtitles
|
---|
814 |
|
---|
815 |
|
---|
816 | /* ********
|
---|
817 | Advanced
|
---|
818 | ******** */
|
---|
819 |
|
---|
820 | set->beginGroup( "advanced");
|
---|
821 |
|
---|
822 | #if USE_ADAPTER
|
---|
823 | set->setValue("adapter", adapter);
|
---|
824 | #endif
|
---|
825 |
|
---|
826 | #if USE_COLORKEY
|
---|
827 | set->setValue("color_key", QString::number(color_key,16));
|
---|
828 | #endif
|
---|
829 |
|
---|
830 | set->setValue("use_mplayer_window", use_mplayer_window);
|
---|
831 |
|
---|
832 | set->setValue("monitor_aspect", monitor_aspect);
|
---|
833 |
|
---|
834 | set->setValue("use_idx", use_idx);
|
---|
835 | set->setValue("use_lavf_demuxer", use_lavf_demuxer);
|
---|
836 |
|
---|
837 | set->setValue("mplayer_additional_options", mplayer_additional_options);
|
---|
838 | set->setValue("mplayer_additional_video_filters", mplayer_additional_video_filters);
|
---|
839 | set->setValue("mplayer_additional_audio_filters", mplayer_additional_audio_filters);
|
---|
840 |
|
---|
841 | #ifdef LOG_MPLAYER
|
---|
842 | set->setValue("log_mplayer", log_mplayer);
|
---|
843 | set->setValue("verbose_log", verbose_log);
|
---|
844 | set->setValue("autosave_mplayer_log", autosave_mplayer_log);
|
---|
845 | set->setValue("mplayer_log_saveto", mplayer_log_saveto);
|
---|
846 | #endif
|
---|
847 | #ifdef LOG_SMPLAYER
|
---|
848 | set->setValue("log_smplayer", log_smplayer);
|
---|
849 | set->setValue("log_filter", log_filter);
|
---|
850 | set->setValue("save_smplayer_log", save_smplayer_log);
|
---|
851 | #endif
|
---|
852 |
|
---|
853 | #if REPAINT_BACKGROUND_OPTION
|
---|
854 | set->setValue("repaint_video_background", repaint_video_background);
|
---|
855 | #endif
|
---|
856 |
|
---|
857 | set->setValue("use_edl_files", use_edl_files);
|
---|
858 |
|
---|
859 | #ifdef MPLAYER_SUPPORT
|
---|
860 | set->setValue("use_playlist_option", use_playlist_option);
|
---|
861 | #endif
|
---|
862 |
|
---|
863 | set->setValue("prefer_ipv4", prefer_ipv4);
|
---|
864 |
|
---|
865 | set->setValue("use_short_pathnames", use_short_pathnames);
|
---|
866 |
|
---|
867 | set->setValue("change_video_equalizer_on_startup", change_video_equalizer_on_startup);
|
---|
868 |
|
---|
869 | set->setValue("use_pausing_keep_force", use_pausing_keep_force);
|
---|
870 |
|
---|
871 | set->setValue("correct_pts", use_correct_pts);
|
---|
872 |
|
---|
873 | set->setValue("actions_to_run", actions_to_run);
|
---|
874 |
|
---|
875 | set->setValue("show_tag_in_window_title", show_tag_in_window_title);
|
---|
876 |
|
---|
877 | set->setValue("time_to_kill_mplayer", time_to_kill_mplayer);
|
---|
878 |
|
---|
879 | #ifdef MPRIS2
|
---|
880 | set->setValue("use_mpris2", use_mpris2);
|
---|
881 | #endif
|
---|
882 |
|
---|
883 | set->endGroup(); // advanced
|
---|
884 |
|
---|
885 |
|
---|
886 | /* *********
|
---|
887 | GUI stuff
|
---|
888 | ********* */
|
---|
889 |
|
---|
890 | set->beginGroup("gui");
|
---|
891 |
|
---|
892 | set->setValue("fullscreen", fullscreen);
|
---|
893 | set->setValue("start_in_fullscreen", start_in_fullscreen);
|
---|
894 |
|
---|
895 | set->setValue("compact_mode", compact_mode);
|
---|
896 | set->setValue("stay_on_top", (int) stay_on_top);
|
---|
897 | set->setValue("size_factor", size_factor);
|
---|
898 | set->setValue("resize_method", resize_method);
|
---|
899 |
|
---|
900 | #if STYLE_SWITCHING
|
---|
901 | set->setValue("qt_style", style);
|
---|
902 | #endif
|
---|
903 |
|
---|
904 | set->setValue("center_window", center_window);
|
---|
905 | set->setValue("center_window_if_outside", center_window_if_outside);
|
---|
906 |
|
---|
907 | #ifdef GLOBALSHORTCUTS
|
---|
908 | set->setValue("use_global_shortcuts", use_global_shortcuts);
|
---|
909 | #endif
|
---|
910 |
|
---|
911 | set->setValue("mouse_left_click_function", mouse_left_click_function);
|
---|
912 | set->setValue("mouse_right_click_function", mouse_right_click_function);
|
---|
913 | set->setValue("mouse_double_click_function", mouse_double_click_function);
|
---|
914 | set->setValue("mouse_middle_click_function", mouse_middle_click_function);
|
---|
915 | set->setValue("mouse_xbutton1_click_function", mouse_xbutton1_click_function);
|
---|
916 | set->setValue("mouse_xbutton2_click_function", mouse_xbutton2_click_function);
|
---|
917 | set->setValue("mouse_wheel_function", wheel_function);
|
---|
918 | set->setValue("wheel_function_cycle", (int) wheel_function_cycle);
|
---|
919 | set->setValue("wheel_function_seeking_reverse", wheel_function_seeking_reverse);
|
---|
920 |
|
---|
921 | set->setValue("drag_function", drag_function);
|
---|
922 |
|
---|
923 | set->setValue("seeking1", seeking1);
|
---|
924 | set->setValue("seeking2", seeking2);
|
---|
925 | set->setValue("seeking3", seeking3);
|
---|
926 | set->setValue("seeking4", seeking4);
|
---|
927 |
|
---|
928 | set->setValue("update_while_seeking", update_while_seeking);
|
---|
929 | #if ENABLE_DELAYED_DRAGGING
|
---|
930 | set->setValue("time_slider_drag_delay", time_slider_drag_delay);
|
---|
931 | #endif
|
---|
932 | #if SEEKBAR_RESOLUTION
|
---|
933 | set->setValue("relative_seeking", relative_seeking);
|
---|
934 | #endif
|
---|
935 | set->setValue("precise_seeking", precise_seeking);
|
---|
936 |
|
---|
937 | set->setValue("reset_stop", reset_stop);
|
---|
938 | set->setValue("delay_left_click", delay_left_click);
|
---|
939 |
|
---|
940 | set->setValue("language", language);
|
---|
941 | set->setValue("iconset", iconset);
|
---|
942 |
|
---|
943 | set->setValue("balloon_count", balloon_count);
|
---|
944 |
|
---|
945 | set->setValue("restore_pos_after_fullscreen", restore_pos_after_fullscreen);
|
---|
946 | set->setValue("save_window_size_on_exit", save_window_size_on_exit);
|
---|
947 |
|
---|
948 | set->setValue("close_on_finish", close_on_finish);
|
---|
949 |
|
---|
950 | #ifdef AUTO_SHUTDOWN_PC
|
---|
951 | set->setValue("auto_shutdown_pc", auto_shutdown_pc);
|
---|
952 | #endif
|
---|
953 |
|
---|
954 | set->setValue("default_font", default_font);
|
---|
955 |
|
---|
956 | set->setValue("pause_when_hidden", pause_when_hidden);
|
---|
957 |
|
---|
958 | set->setValue("allow_video_movement", allow_video_movement);
|
---|
959 |
|
---|
960 | set->setValue("gui", gui);
|
---|
961 |
|
---|
962 | #if USE_MINIMUMSIZE
|
---|
963 | set->setValue("gui_minimum_width", gui_minimum_width);
|
---|
964 | #endif
|
---|
965 | set->setValue("default_size", default_size);
|
---|
966 |
|
---|
967 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
---|
968 | set->setValue("hide_video_window_on_audio_files", hide_video_window_on_audio_files);
|
---|
969 | #endif
|
---|
970 |
|
---|
971 | set->setValue("report_mplayer_crashes", report_mplayer_crashes);
|
---|
972 |
|
---|
973 | #if REPORT_OLD_MPLAYER
|
---|
974 | set->setValue("reported_mplayer_is_old", reported_mplayer_is_old);
|
---|
975 | #endif
|
---|
976 |
|
---|
977 | set->setValue("auto_add_to_playlist", auto_add_to_playlist);
|
---|
978 | set->setValue("media_to_add_to_playlist", media_to_add_to_playlist);
|
---|
979 |
|
---|
980 | #if LOGO_ANIMATION
|
---|
981 | set->setValue("animated_logo", animated_logo);
|
---|
982 | #endif
|
---|
983 |
|
---|
984 | set->endGroup(); // gui
|
---|
985 |
|
---|
986 |
|
---|
987 | /* ********
|
---|
988 | TV (dvb)
|
---|
989 | ******** */
|
---|
990 | #ifdef TV_SUPPORT
|
---|
991 | set->beginGroup( "tv");
|
---|
992 | set->setValue("check_channels_conf_on_startup", check_channels_conf_on_startup);
|
---|
993 | set->setValue("initial_tv_deinterlace", initial_tv_deinterlace);
|
---|
994 | set->setValue("last_dvb_channel", last_dvb_channel);
|
---|
995 | set->setValue("last_tv_channel", last_tv_channel);
|
---|
996 | set->endGroup(); // tv
|
---|
997 | #endif
|
---|
998 |
|
---|
999 |
|
---|
1000 | /* ********
|
---|
1001 | Network
|
---|
1002 | ******** */
|
---|
1003 |
|
---|
1004 | set->beginGroup("streaming");
|
---|
1005 | set->setValue("streaming_type", streaming_type);
|
---|
1006 |
|
---|
1007 | #ifdef YOUTUBE_SUPPORT
|
---|
1008 | set->beginGroup("streaming/youtube");
|
---|
1009 | set->setValue("quality", yt_quality);
|
---|
1010 | set->setValue("user_agent", yt_user_agent);
|
---|
1011 | set->setValue("yt_use_https_main", yt_use_https_main);
|
---|
1012 | set->setValue("yt_use_https_vi", yt_use_https_vi);
|
---|
1013 | set->endGroup();
|
---|
1014 | #endif
|
---|
1015 | set->endGroup(); // streaming
|
---|
1016 |
|
---|
1017 | set->beginGroup("proxy");
|
---|
1018 | set->setValue("use_proxy", use_proxy);
|
---|
1019 | set->setValue("type", proxy_type);
|
---|
1020 | set->setValue("host", proxy_host);
|
---|
1021 | set->setValue("port", proxy_port);
|
---|
1022 | set->setValue("username", proxy_username);
|
---|
1023 | set->setValue("password", proxy_password);
|
---|
1024 | set->endGroup(); // proxy
|
---|
1025 |
|
---|
1026 |
|
---|
1027 | /* ***********
|
---|
1028 | Directories
|
---|
1029 | *********** */
|
---|
1030 |
|
---|
1031 | set->beginGroup( "directories");
|
---|
1032 | if (save_dirs) {
|
---|
1033 | set->setValue("latest_dir", latest_dir);
|
---|
1034 | set->setValue("last_dvd_directory", last_dvd_directory);
|
---|
1035 | } else {
|
---|
1036 | set->setValue("latest_dir", "");
|
---|
1037 | set->setValue("last_dvd_directory", "");
|
---|
1038 | }
|
---|
1039 | set->setValue("save_dirs", save_dirs);
|
---|
1040 | set->endGroup(); // directories
|
---|
1041 |
|
---|
1042 |
|
---|
1043 | /* **************
|
---|
1044 | Initial values
|
---|
1045 | ************** */
|
---|
1046 |
|
---|
1047 | set->beginGroup( "defaults");
|
---|
1048 |
|
---|
1049 | set->setValue("initial_sub_scale", initial_sub_scale);
|
---|
1050 | set->setValue("initial_sub_scale_ass", initial_sub_scale_ass);
|
---|
1051 | set->setValue("initial_volume", initial_volume);
|
---|
1052 | set->setValue("initial_contrast", initial_contrast);
|
---|
1053 | set->setValue("initial_brightness", initial_brightness);
|
---|
1054 | set->setValue("initial_hue", initial_hue);
|
---|
1055 | set->setValue("initial_saturation", initial_saturation);
|
---|
1056 | set->setValue("initial_gamma", initial_gamma);
|
---|
1057 |
|
---|
1058 | set->setValue("initial_audio_equalizer", initial_audio_equalizer);
|
---|
1059 |
|
---|
1060 | set->setValue("initial_zoom_factor", initial_zoom_factor);
|
---|
1061 | set->setValue("initial_sub_pos", initial_sub_pos);
|
---|
1062 |
|
---|
1063 | set->setValue("initial_volnorm", initial_volnorm);
|
---|
1064 | set->setValue("initial_postprocessing", initial_postprocessing);
|
---|
1065 |
|
---|
1066 | set->setValue("initial_deinterlace", initial_deinterlace);
|
---|
1067 |
|
---|
1068 | set->setValue("initial_audio_channels", initial_audio_channels);
|
---|
1069 | set->setValue("initial_stereo_mode", initial_stereo_mode);
|
---|
1070 |
|
---|
1071 | set->setValue("initial_audio_track", initial_audio_track);
|
---|
1072 | set->setValue("initial_subtitle_track", initial_subtitle_track);
|
---|
1073 |
|
---|
1074 | set->endGroup(); // defaults
|
---|
1075 |
|
---|
1076 |
|
---|
1077 | /* ************
|
---|
1078 | MPlayer info
|
---|
1079 | ************ */
|
---|
1080 |
|
---|
1081 | set->beginGroup( "mplayer_info");
|
---|
1082 | set->setValue("mplayer_detected_version", mplayer_detected_version);
|
---|
1083 | set->setValue("mplayer_user_supplied_version", mplayer_user_supplied_version);
|
---|
1084 | #ifdef MPLAYER2_SUPPORT
|
---|
1085 | set->setValue("is_mplayer2", mplayer_is_mplayer2);
|
---|
1086 | set->setValue("mplayer2_detected_version", mplayer2_detected_version);
|
---|
1087 | #endif
|
---|
1088 | set->endGroup(); // mplayer_info
|
---|
1089 |
|
---|
1090 |
|
---|
1091 | /* *********
|
---|
1092 | Instances
|
---|
1093 | ********* */
|
---|
1094 | #ifdef SINGLE_INSTANCE
|
---|
1095 | set->beginGroup("instances");
|
---|
1096 | set->setValue("single_instance_enabled", use_single_instance);
|
---|
1097 | set->endGroup(); // instances
|
---|
1098 | #endif
|
---|
1099 |
|
---|
1100 |
|
---|
1101 | /* ****************
|
---|
1102 | Floating control
|
---|
1103 | **************** */
|
---|
1104 |
|
---|
1105 | set->beginGroup("floating_control");
|
---|
1106 | set->setValue("margin", floating_control_margin);
|
---|
1107 | set->setValue("width", floating_control_width);
|
---|
1108 | set->setValue("animated", floating_control_animated);
|
---|
1109 | set->setValue("display_in_compact_mode", floating_display_in_compact_mode);
|
---|
1110 | set->setValue("activation_area", floating_activation_area);
|
---|
1111 | set->setValue("hide_delay", floating_hide_delay);
|
---|
1112 | set->endGroup(); // floating_control
|
---|
1113 |
|
---|
1114 |
|
---|
1115 | /* *******
|
---|
1116 | History
|
---|
1117 | ******* */
|
---|
1118 |
|
---|
1119 | set->beginGroup("history");
|
---|
1120 | set->setValue("recents", history_recents->toStringList());
|
---|
1121 | set->setValue("recents/max_items", history_recents->maxItems());
|
---|
1122 | set->setValue("urls", history_urls->toStringList());
|
---|
1123 | set->setValue("urls/max_items", history_urls->maxItems());
|
---|
1124 | set->endGroup(); // history
|
---|
1125 |
|
---|
1126 |
|
---|
1127 | /* *******
|
---|
1128 | Filters
|
---|
1129 | ******* */
|
---|
1130 |
|
---|
1131 | filters->save(set);
|
---|
1132 |
|
---|
1133 |
|
---|
1134 | /* *********
|
---|
1135 | SMPlayer info
|
---|
1136 | ********* */
|
---|
1137 |
|
---|
1138 | set->beginGroup("smplayer");
|
---|
1139 | #ifdef CHECK_UPGRADED
|
---|
1140 | set->setValue("stable_version", smplayer_stable_version);
|
---|
1141 | set->setValue("check_if_upgraded", check_if_upgraded);
|
---|
1142 | #endif
|
---|
1143 | #ifdef FONTCACHE_DIALOG
|
---|
1144 | set->setValue("version", smplayer_version);
|
---|
1145 | #endif
|
---|
1146 | set->endGroup();
|
---|
1147 |
|
---|
1148 |
|
---|
1149 | /* *********
|
---|
1150 | Update
|
---|
1151 | ********* */
|
---|
1152 |
|
---|
1153 | #ifdef UPDATE_CHECKER
|
---|
1154 | update_checker_data.save(set);
|
---|
1155 | #endif
|
---|
1156 |
|
---|
1157 | set->sync();
|
---|
1158 | }
|
---|
1159 |
|
---|
1160 | void Preferences::load() {
|
---|
1161 | qDebug("Preferences::load");
|
---|
1162 |
|
---|
1163 | QSettings * set = settings;
|
---|
1164 |
|
---|
1165 |
|
---|
1166 | /* *******
|
---|
1167 | General
|
---|
1168 | ******* */
|
---|
1169 |
|
---|
1170 | set->beginGroup("General");
|
---|
1171 |
|
---|
1172 | config_version = set->value("config_version", 0).toInt();
|
---|
1173 |
|
---|
1174 | mplayer_bin = set->value("mplayer_bin", mplayer_bin).toString();
|
---|
1175 | vo = set->value("driver/vo", vo).toString();
|
---|
1176 | ao = set->value("driver/audio_output", ao).toString();
|
---|
1177 |
|
---|
1178 | use_screenshot = set->value("use_screenshot", use_screenshot).toBool();
|
---|
1179 | #ifdef MPV_SUPPORT
|
---|
1180 | screenshot_template = set->value("screenshot_template", screenshot_template).toString();
|
---|
1181 | screenshot_format = set->value("screenshot_format", screenshot_format).toString();
|
---|
1182 | #endif
|
---|
1183 | #if QT_VERSION >= 0x040400
|
---|
1184 | screenshot_directory = set->value("screenshot_folder", screenshot_directory).toString();
|
---|
1185 | setupScreenshotFolder();
|
---|
1186 | #else
|
---|
1187 | screenshot_directory = set->value("screenshot_directory", screenshot_directory).toString();
|
---|
1188 | #endif
|
---|
1189 |
|
---|
1190 | #ifdef CAPTURE_STREAM
|
---|
1191 | capture_directory = set->value("capture_directory", capture_directory).toString();
|
---|
1192 | #endif
|
---|
1193 |
|
---|
1194 | remember_media_settings = set->value("remember_media_settings", remember_media_settings).toBool();
|
---|
1195 | remember_time_pos = set->value("remember_time_pos", remember_time_pos).toBool();
|
---|
1196 | remember_stream_settings = set->value("remember_stream_settings", remember_stream_settings).toBool();
|
---|
1197 |
|
---|
1198 | audio_lang = set->value("audio_lang", audio_lang).toString();
|
---|
1199 | subtitle_lang = set->value("subtitle_lang", subtitle_lang).toString();
|
---|
1200 |
|
---|
1201 | use_direct_rendering = set->value("use_direct_rendering", use_direct_rendering).toBool();
|
---|
1202 | use_double_buffer = set->value("use_double_buffer", use_double_buffer).toBool();
|
---|
1203 |
|
---|
1204 | use_soft_video_eq = set->value("use_soft_video_eq", use_soft_video_eq).toBool();
|
---|
1205 | use_slices = set->value("use_slices", use_slices ).toBool();
|
---|
1206 | autoq = set->value("autoq", autoq).toInt();
|
---|
1207 | add_blackborders_on_fullscreen = set->value("add_blackborders_on_fullscreen", add_blackborders_on_fullscreen).toBool();
|
---|
1208 |
|
---|
1209 | #ifdef Q_OS_WIN
|
---|
1210 | #ifdef SCREENSAVER_OFF
|
---|
1211 | turn_screensaver_off = set->value("turn_screensaver_off", turn_screensaver_off).toBool();
|
---|
1212 | #endif
|
---|
1213 | #ifdef AVOID_SCREENSAVER
|
---|
1214 | avoid_screensaver = set->value("avoid_screensaver", avoid_screensaver).toBool();
|
---|
1215 | #endif
|
---|
1216 | #else
|
---|
1217 | disable_screensaver = set->value("disable_screensaver", disable_screensaver).toBool();
|
---|
1218 | #endif
|
---|
1219 |
|
---|
1220 | #ifndef Q_OS_WIN
|
---|
1221 | vdpau.ffh264vdpau = set->value("vdpau_ffh264vdpau", vdpau.ffh264vdpau).toBool();
|
---|
1222 | vdpau.ffmpeg12vdpau = set->value("vdpau_ffmpeg12vdpau", vdpau.ffmpeg12vdpau).toBool();
|
---|
1223 | vdpau.ffwmv3vdpau = set->value("vdpau_ffwmv3vdpau", vdpau.ffwmv3vdpau).toBool();
|
---|
1224 | vdpau.ffvc1vdpau = set->value("vdpau_ffvc1vdpau", vdpau.ffvc1vdpau).toBool();
|
---|
1225 | vdpau.ffodivxvdpau = set->value("vdpau_ffodivxvdpau", vdpau.ffodivxvdpau).toBool();
|
---|
1226 | vdpau.disable_video_filters = set->value("vdpau_disable_video_filters", vdpau.disable_video_filters).toBool();
|
---|
1227 | #endif
|
---|
1228 |
|
---|
1229 | use_soft_vol = set->value("use_soft_vol", use_soft_vol).toBool();
|
---|
1230 | softvol_max = set->value("softvol_max", softvol_max).toInt();
|
---|
1231 | use_scaletempo = (OptionState) set->value("use_scaletempo", use_scaletempo).toInt();
|
---|
1232 | use_hwac3 = set->value("use_hwac3", use_hwac3 ).toBool();
|
---|
1233 | use_audio_equalizer = set->value("use_audio_equalizer", use_audio_equalizer ).toBool();
|
---|
1234 |
|
---|
1235 | global_volume = set->value("global_volume", global_volume).toBool();
|
---|
1236 | volume = set->value("volume", volume).toInt();
|
---|
1237 | mute = set->value("mute", mute).toBool();
|
---|
1238 |
|
---|
1239 | global_audio_equalizer = set->value("global_audio_equalizer", global_audio_equalizer).toBool();
|
---|
1240 | audio_equalizer = set->value("audio_equalizer", audio_equalizer).toList();
|
---|
1241 |
|
---|
1242 | autosync = set->value("autosync", autosync).toBool();
|
---|
1243 | autosync_factor = set->value("autosync_factor", autosync_factor).toInt();
|
---|
1244 |
|
---|
1245 | use_mc = set->value("use_mc", use_mc).toBool();
|
---|
1246 | mc_value = set->value("mc_value", mc_value).toDouble();
|
---|
1247 |
|
---|
1248 | autoload_m4a = set->value("autoload_m4a", autoload_m4a).toBool();
|
---|
1249 | min_step = set->value("min_step", min_step).toInt();
|
---|
1250 |
|
---|
1251 | osd = set->value("osd", osd).toInt();
|
---|
1252 | osd_scale = set->value("osd_scale", osd_scale).toDouble();
|
---|
1253 | subfont_osd_scale = set->value("subfont_osd_scale", subfont_osd_scale).toDouble();
|
---|
1254 | osd_delay = set->value("osd_delay", osd_delay).toInt();
|
---|
1255 |
|
---|
1256 | file_settings_method = set->value("file_settings_method", file_settings_method).toString();
|
---|
1257 |
|
---|
1258 | tablet_mode = set->value("tablet_mode", tablet_mode).toBool();
|
---|
1259 | #ifdef Q_OS_WIN
|
---|
1260 | tablet_mode_change_answer = set->value("tablet_mode_change_answer", tablet_mode_change_answer).toString();
|
---|
1261 | #endif
|
---|
1262 |
|
---|
1263 | set->endGroup(); // General
|
---|
1264 |
|
---|
1265 |
|
---|
1266 | /* ***************
|
---|
1267 | Drives (CD/DVD)
|
---|
1268 | *************** */
|
---|
1269 |
|
---|
1270 | set->beginGroup( "drives");
|
---|
1271 |
|
---|
1272 | dvd_device = set->value("dvd_device", dvd_device).toString();
|
---|
1273 | cdrom_device = set->value("cdrom_device", cdrom_device).toString();
|
---|
1274 | #ifdef BLURAY_SUPPORT
|
---|
1275 | bluray_device = set->value("bluray_device", bluray_device).toString();
|
---|
1276 | #endif
|
---|
1277 |
|
---|
1278 | #ifdef Q_OS_WIN
|
---|
1279 | enable_audiocd_on_windows = set->value("enable_audiocd_on_windows", enable_audiocd_on_windows).toBool();
|
---|
1280 | #endif
|
---|
1281 |
|
---|
1282 | vcd_initial_title = set->value("vcd_initial_title", vcd_initial_title ).toInt();
|
---|
1283 |
|
---|
1284 | #if DVDNAV_SUPPORT
|
---|
1285 | use_dvdnav = set->value("use_dvdnav", use_dvdnav).toBool();
|
---|
1286 | #endif
|
---|
1287 |
|
---|
1288 | set->endGroup(); // drives
|
---|
1289 |
|
---|
1290 |
|
---|
1291 | /* ***********
|
---|
1292 | Performance
|
---|
1293 | *********** */
|
---|
1294 |
|
---|
1295 | set->beginGroup( "performance");
|
---|
1296 |
|
---|
1297 | #ifdef Q_OS_WIN
|
---|
1298 | priority = set->value("priority", priority).toInt();
|
---|
1299 | #endif
|
---|
1300 | frame_drop = set->value("frame_drop", frame_drop).toBool();
|
---|
1301 | hard_frame_drop = set->value("hard_frame_drop", hard_frame_drop).toBool();
|
---|
1302 | coreavc = set->value("coreavc", coreavc).toBool();
|
---|
1303 | h264_skip_loop_filter = (H264LoopFilter) set->value("h264_skip_loop_filter", h264_skip_loop_filter).toInt();
|
---|
1304 | HD_height = set->value("HD_height", HD_height).toInt();
|
---|
1305 |
|
---|
1306 | #ifdef OBSOLETE_FAST_AUDIO_CHANGE
|
---|
1307 | fast_audio_change = (OptionState) set->value("fast_audio_change", fast_audio_change).toInt();
|
---|
1308 | #endif
|
---|
1309 |
|
---|
1310 | #if !SMART_DVD_CHAPTERS
|
---|
1311 | fast_chapter_change = set->value("fast_chapter_change", fast_chapter_change).toBool();
|
---|
1312 | #endif
|
---|
1313 |
|
---|
1314 | threads = set->value("threads", threads).toInt();
|
---|
1315 | hwdec = set->value("hwdec", hwdec).toString();
|
---|
1316 |
|
---|
1317 | cache_auto = set->value("cache_auto", cache_auto).toBool();
|
---|
1318 | cache_for_files = set->value("cache_for_files", cache_for_files).toInt();
|
---|
1319 | cache_for_streams = set->value("cache_for_streams", cache_for_streams).toInt();
|
---|
1320 | cache_for_dvds = set->value("cache_for_dvds", cache_for_dvds).toInt();
|
---|
1321 | cache_for_vcds = set->value("cache_for_vcds", cache_for_vcds).toInt();
|
---|
1322 | cache_for_audiocds = set->value("cache_for_audiocds", cache_for_audiocds).toInt();
|
---|
1323 | #ifdef TV_SUPPORT
|
---|
1324 | cache_for_tv = set->value("cache_for_tv", cache_for_tv).toInt();
|
---|
1325 | #endif
|
---|
1326 |
|
---|
1327 | set->endGroup(); // performance
|
---|
1328 |
|
---|
1329 |
|
---|
1330 | /* *********
|
---|
1331 | Subtitles
|
---|
1332 | ********* */
|
---|
1333 |
|
---|
1334 | set->beginGroup("subtitles");
|
---|
1335 |
|
---|
1336 | subcp = set->value("subcp", subcp).toString();
|
---|
1337 | use_enca = set->value("use_enca", use_enca).toBool();
|
---|
1338 | enca_lang = set->value("enca_lang", enca_lang).toString();
|
---|
1339 | subfuzziness = set->value("subfuzziness", subfuzziness).toInt();
|
---|
1340 | autoload_sub = set->value("autoload_sub", autoload_sub).toBool();
|
---|
1341 |
|
---|
1342 | use_ass_subtitles = set->value("use_ass_subtitles", use_ass_subtitles).toBool();
|
---|
1343 | enable_ass_styles = set->value("enable_ass_styles", enable_ass_styles).toBool();
|
---|
1344 | ass_line_spacing = set->value("ass_line_spacing", ass_line_spacing).toInt();
|
---|
1345 |
|
---|
1346 | use_forced_subs_only = set->value("use_forced_subs_only", use_forced_subs_only).toBool();
|
---|
1347 |
|
---|
1348 | sub_visibility = set->value("sub_visibility", sub_visibility).toBool();
|
---|
1349 |
|
---|
1350 | subtitles_on_screenshots = set->value("subtitles_on_screenshots", subtitles_on_screenshots).toBool();
|
---|
1351 |
|
---|
1352 | change_sub_scale_should_restart = (OptionState) set->value("change_sub_scale_should_restart", change_sub_scale_should_restart).toInt();
|
---|
1353 |
|
---|
1354 | fast_load_sub = set->value("fast_load_sub", fast_load_sub).toBool();
|
---|
1355 |
|
---|
1356 | // ASS styles
|
---|
1357 | ass_styles.load(set);
|
---|
1358 | force_ass_styles = set->value("force_ass_styles", force_ass_styles).toBool();
|
---|
1359 | user_forced_ass_style = set->value("user_forced_ass_style", user_forced_ass_style).toString();
|
---|
1360 |
|
---|
1361 | freetype_support = set->value("freetype_support", freetype_support).toBool();
|
---|
1362 | #ifdef FONTS_HACK
|
---|
1363 | use_windowsfontdir = set->value("use_windowsfontdir", use_windowsfontdir).toBool();
|
---|
1364 | #endif
|
---|
1365 |
|
---|
1366 | set->endGroup(); // subtitles
|
---|
1367 |
|
---|
1368 |
|
---|
1369 | /* ********
|
---|
1370 | Advanced
|
---|
1371 | ******** */
|
---|
1372 |
|
---|
1373 | set->beginGroup( "advanced");
|
---|
1374 |
|
---|
1375 | #if USE_ADAPTER
|
---|
1376 | adapter = set->value("adapter", adapter).toInt();
|
---|
1377 | #endif
|
---|
1378 |
|
---|
1379 | #if USE_COLORKEY
|
---|
1380 | bool ok;
|
---|
1381 | QString color = set->value("color_key", QString::number(color_key,16)).toString();
|
---|
1382 | unsigned int temp_color_key = color.toUInt(&ok, 16);
|
---|
1383 | if (ok)
|
---|
1384 | color_key = temp_color_key;
|
---|
1385 | //color_key = set->value("color_key", color_key).toInt();
|
---|
1386 | #endif
|
---|
1387 |
|
---|
1388 | use_mplayer_window = set->value("use_mplayer_window", use_mplayer_window).toBool();
|
---|
1389 |
|
---|
1390 | monitor_aspect = set->value("monitor_aspect", monitor_aspect).toString();
|
---|
1391 |
|
---|
1392 | use_idx = set->value("use_idx", use_idx).toBool();
|
---|
1393 | use_lavf_demuxer = set->value("use_lavf_demuxer", use_lavf_demuxer).toBool();
|
---|
1394 |
|
---|
1395 | mplayer_additional_options = set->value("mplayer_additional_options", mplayer_additional_options).toString();
|
---|
1396 | mplayer_additional_video_filters = set->value("mplayer_additional_video_filters", mplayer_additional_video_filters).toString();
|
---|
1397 | mplayer_additional_audio_filters = set->value("mplayer_additional_audio_filters", mplayer_additional_audio_filters).toString();
|
---|
1398 |
|
---|
1399 | #ifdef LOG_MPLAYER
|
---|
1400 | log_mplayer = set->value("log_mplayer", log_mplayer).toBool();
|
---|
1401 | verbose_log = set->value("verbose_log", verbose_log).toBool();
|
---|
1402 | autosave_mplayer_log = set->value("autosave_mplayer_log", autosave_mplayer_log).toBool();
|
---|
1403 | mplayer_log_saveto = set->value("mplayer_log_saveto", mplayer_log_saveto).toString();
|
---|
1404 | #endif
|
---|
1405 | #ifdef LOG_SMPLAYER
|
---|
1406 | log_smplayer = set->value("log_smplayer", log_smplayer).toBool();
|
---|
1407 | log_filter = set->value("log_filter", log_filter).toString();
|
---|
1408 | save_smplayer_log = set->value("save_smplayer_log", save_smplayer_log).toBool();
|
---|
1409 | #endif
|
---|
1410 |
|
---|
1411 | #if REPAINT_BACKGROUND_OPTION
|
---|
1412 | repaint_video_background = set->value("repaint_video_background", repaint_video_background).toBool();
|
---|
1413 | #endif
|
---|
1414 |
|
---|
1415 | use_edl_files = set->value("use_edl_files", use_edl_files).toBool();
|
---|
1416 |
|
---|
1417 | #ifdef MPLAYER_SUPPORT
|
---|
1418 | use_playlist_option = set->value("use_playlist_option", use_playlist_option).toBool();
|
---|
1419 | #endif
|
---|
1420 |
|
---|
1421 | prefer_ipv4 = set->value("prefer_ipv4", prefer_ipv4).toBool();
|
---|
1422 |
|
---|
1423 | use_short_pathnames = set->value("use_short_pathnames", use_short_pathnames).toBool();
|
---|
1424 |
|
---|
1425 | use_pausing_keep_force = set->value("use_pausing_keep_force", use_pausing_keep_force).toBool();
|
---|
1426 |
|
---|
1427 | use_correct_pts = (OptionState) set->value("correct_pts", use_correct_pts).toInt();
|
---|
1428 |
|
---|
1429 | actions_to_run = set->value("actions_to_run", actions_to_run).toString();
|
---|
1430 |
|
---|
1431 | show_tag_in_window_title = set->value("show_tag_in_window_title", show_tag_in_window_title).toBool();
|
---|
1432 |
|
---|
1433 | time_to_kill_mplayer = set->value("time_to_kill_mplayer", time_to_kill_mplayer).toInt();
|
---|
1434 |
|
---|
1435 | #ifdef MPRIS2
|
---|
1436 | use_mpris2 = set->value("use_mpris2", use_mpris2).toBool();
|
---|
1437 | #endif
|
---|
1438 |
|
---|
1439 | set->endGroup(); // advanced
|
---|
1440 |
|
---|
1441 |
|
---|
1442 | /* *********
|
---|
1443 | GUI stuff
|
---|
1444 | ********* */
|
---|
1445 |
|
---|
1446 | set->beginGroup("gui");
|
---|
1447 |
|
---|
1448 | fullscreen = set->value("fullscreen", fullscreen).toBool();
|
---|
1449 | start_in_fullscreen = set->value("start_in_fullscreen", start_in_fullscreen).toBool();
|
---|
1450 |
|
---|
1451 | compact_mode = set->value("compact_mode", compact_mode).toBool();
|
---|
1452 | stay_on_top = (Preferences::OnTop) set->value("stay_on_top", (int) stay_on_top).toInt();
|
---|
1453 | size_factor = set->value("size_factor", size_factor).toInt();
|
---|
1454 | resize_method = set->value("resize_method", resize_method).toInt();
|
---|
1455 |
|
---|
1456 | #if STYLE_SWITCHING
|
---|
1457 | style = set->value("qt_style", style).toString();
|
---|
1458 | #endif
|
---|
1459 |
|
---|
1460 | center_window = set->value("center_window", center_window).toBool();
|
---|
1461 | center_window_if_outside = set->value("center_window_if_outside", center_window_if_outside).toBool();
|
---|
1462 |
|
---|
1463 | #ifdef GLOBALSHORTCUTS
|
---|
1464 | use_global_shortcuts = set->value("use_global_shortcuts", use_global_shortcuts).toBool();
|
---|
1465 | #endif
|
---|
1466 |
|
---|
1467 | mouse_left_click_function = set->value("mouse_left_click_function", mouse_left_click_function).toString();
|
---|
1468 | mouse_right_click_function = set->value("mouse_right_click_function", mouse_right_click_function).toString();
|
---|
1469 | mouse_double_click_function = set->value("mouse_double_click_function", mouse_double_click_function).toString();
|
---|
1470 | mouse_middle_click_function = set->value("mouse_middle_click_function", mouse_middle_click_function).toString();
|
---|
1471 | mouse_xbutton1_click_function = set->value("mouse_xbutton1_click_function", mouse_xbutton1_click_function).toString();
|
---|
1472 | mouse_xbutton2_click_function = set->value("mouse_xbutton2_click_function", mouse_xbutton2_click_function).toString();
|
---|
1473 | wheel_function = set->value("mouse_wheel_function", wheel_function).toInt();
|
---|
1474 | {
|
---|
1475 | int wheel_function_cycle_int = set->value("wheel_function_cycle", (int) wheel_function_cycle).toInt();
|
---|
1476 | wheel_function_cycle = (WheelFunctions) wheel_function_cycle_int;
|
---|
1477 | }
|
---|
1478 | wheel_function_seeking_reverse = set->value("wheel_function_seeking_reverse", wheel_function_seeking_reverse).toBool();
|
---|
1479 |
|
---|
1480 | drag_function = set->value("drag_function", drag_function).toInt();
|
---|
1481 |
|
---|
1482 | seeking1 = set->value("seeking1", seeking1).toInt();
|
---|
1483 | seeking2 = set->value("seeking2", seeking2).toInt();
|
---|
1484 | seeking3 = set->value("seeking3", seeking3).toInt();
|
---|
1485 | seeking4 = set->value("seeking4", seeking4).toInt();
|
---|
1486 |
|
---|
1487 | update_while_seeking = set->value("update_while_seeking", update_while_seeking).toBool();
|
---|
1488 | #if ENABLE_DELAYED_DRAGGING
|
---|
1489 | time_slider_drag_delay = set->value("time_slider_drag_delay", time_slider_drag_delay).toInt();
|
---|
1490 | #endif
|
---|
1491 | #if SEEKBAR_RESOLUTION
|
---|
1492 | relative_seeking = set->value("relative_seeking", relative_seeking).toBool();
|
---|
1493 | #endif
|
---|
1494 | precise_seeking = set->value("precise_seeking", precise_seeking).toBool();
|
---|
1495 |
|
---|
1496 | reset_stop = set->value("reset_stop", reset_stop).toBool();
|
---|
1497 | delay_left_click = set->value("delay_left_click", delay_left_click).toBool();
|
---|
1498 |
|
---|
1499 | language = set->value("language", language).toString();
|
---|
1500 | iconset= set->value("iconset", iconset).toString();
|
---|
1501 |
|
---|
1502 | balloon_count = set->value("balloon_count", balloon_count).toInt();
|
---|
1503 |
|
---|
1504 | restore_pos_after_fullscreen = set->value("restore_pos_after_fullscreen", restore_pos_after_fullscreen).toBool();
|
---|
1505 | save_window_size_on_exit = set->value("save_window_size_on_exit", save_window_size_on_exit).toBool();
|
---|
1506 |
|
---|
1507 | close_on_finish = set->value("close_on_finish", close_on_finish).toBool();
|
---|
1508 |
|
---|
1509 | #ifdef AUTO_SHUTDOWN_PC
|
---|
1510 | auto_shutdown_pc = set->value("auto_shutdown_pc", auto_shutdown_pc).toBool();
|
---|
1511 | #endif
|
---|
1512 |
|
---|
1513 | default_font = set->value("default_font", default_font).toString();
|
---|
1514 |
|
---|
1515 | pause_when_hidden = set->value("pause_when_hidden", pause_when_hidden).toBool();
|
---|
1516 |
|
---|
1517 | allow_video_movement = set->value("allow_video_movement", allow_video_movement).toBool();
|
---|
1518 |
|
---|
1519 | gui = set->value("gui", gui).toString();
|
---|
1520 |
|
---|
1521 | #if USE_MINIMUMSIZE
|
---|
1522 | gui_minimum_width = set->value("gui_minimum_width", gui_minimum_width).toInt();
|
---|
1523 | #endif
|
---|
1524 | default_size = set->value("default_size", default_size).toSize();
|
---|
1525 |
|
---|
1526 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
---|
1527 | hide_video_window_on_audio_files = set->value("hide_video_window_on_audio_files", hide_video_window_on_audio_files).toBool();
|
---|
1528 | #endif
|
---|
1529 |
|
---|
1530 | report_mplayer_crashes = set->value("report_mplayer_crashes", report_mplayer_crashes).toBool();
|
---|
1531 |
|
---|
1532 | #if REPORT_OLD_MPLAYER
|
---|
1533 | reported_mplayer_is_old = set->value("reported_mplayer_is_old", reported_mplayer_is_old).toBool();
|
---|
1534 | #endif
|
---|
1535 |
|
---|
1536 | auto_add_to_playlist = set->value("auto_add_to_playlist", auto_add_to_playlist).toBool();
|
---|
1537 | media_to_add_to_playlist = (AutoAddToPlaylistFilter) set->value("media_to_add_to_playlist", media_to_add_to_playlist).toInt();
|
---|
1538 |
|
---|
1539 | #if LOGO_ANIMATION
|
---|
1540 | animated_logo = set->value("animated_logo", animated_logo).toBool();
|
---|
1541 | #endif
|
---|
1542 |
|
---|
1543 | set->endGroup(); // gui
|
---|
1544 |
|
---|
1545 |
|
---|
1546 | /* ********
|
---|
1547 | TV (dvb)
|
---|
1548 | ******** */
|
---|
1549 | #ifdef TV_SUPPORT
|
---|
1550 | set->beginGroup( "tv");
|
---|
1551 | check_channels_conf_on_startup = set->value("check_channels_conf_on_startup", check_channels_conf_on_startup).toBool();
|
---|
1552 | initial_tv_deinterlace = set->value("initial_tv_deinterlace", initial_tv_deinterlace).toInt();
|
---|
1553 | last_dvb_channel = set->value("last_dvb_channel", last_dvb_channel).toString();
|
---|
1554 | last_tv_channel = set->value("last_tv_channel", last_tv_channel).toString();
|
---|
1555 | set->endGroup(); // tv
|
---|
1556 | #endif
|
---|
1557 |
|
---|
1558 |
|
---|
1559 | /* ********
|
---|
1560 | Network
|
---|
1561 | ******** */
|
---|
1562 |
|
---|
1563 | set->beginGroup("streaming");
|
---|
1564 | streaming_type = set->value("streaming_type", streaming_type).toInt();
|
---|
1565 |
|
---|
1566 | #ifdef YOUTUBE_SUPPORT
|
---|
1567 | set->beginGroup("streaming/youtube");
|
---|
1568 | yt_quality = set->value("quality", yt_quality).toInt();
|
---|
1569 | yt_user_agent = set->value("user_agent", yt_user_agent).toString();
|
---|
1570 | yt_use_https_main = set->value("yt_use_https_main", yt_use_https_main).toBool();
|
---|
1571 | yt_use_https_vi = set->value("yt_use_https_vi", yt_use_https_vi).toBool();
|
---|
1572 | set->endGroup();
|
---|
1573 | #endif
|
---|
1574 | set->endGroup(); // streaming
|
---|
1575 |
|
---|
1576 | set->beginGroup("proxy");
|
---|
1577 | use_proxy = set->value("use_proxy", use_proxy).toBool();
|
---|
1578 | proxy_type = set->value("type", proxy_type).toInt();
|
---|
1579 | proxy_host = set->value("host", proxy_host).toString();
|
---|
1580 | proxy_port = set->value("port", proxy_port).toInt();
|
---|
1581 | proxy_username = set->value("username", proxy_username).toString();
|
---|
1582 | proxy_password = set->value("password", proxy_password).toString();
|
---|
1583 | set->endGroup(); // proxy
|
---|
1584 |
|
---|
1585 |
|
---|
1586 | /* ***********
|
---|
1587 | Directories
|
---|
1588 | *********** */
|
---|
1589 |
|
---|
1590 | set->beginGroup( "directories");
|
---|
1591 | save_dirs = set->value("save_dirs", save_dirs).toBool();
|
---|
1592 | if (save_dirs) {
|
---|
1593 | latest_dir = set->value("latest_dir", latest_dir).toString();
|
---|
1594 | last_dvd_directory = set->value("last_dvd_directory", last_dvd_directory).toString();
|
---|
1595 | }
|
---|
1596 | set->endGroup(); // directories
|
---|
1597 |
|
---|
1598 |
|
---|
1599 | /* **************
|
---|
1600 | Initial values
|
---|
1601 | ************** */
|
---|
1602 |
|
---|
1603 | set->beginGroup( "defaults");
|
---|
1604 |
|
---|
1605 | initial_sub_scale = set->value("initial_sub_scale", initial_sub_scale).toDouble();
|
---|
1606 | initial_sub_scale_ass = set->value("initial_sub_scale_ass", initial_sub_scale_ass).toDouble();
|
---|
1607 | initial_volume = set->value("initial_volume", initial_volume).toInt();
|
---|
1608 | initial_contrast = set->value("initial_contrast", initial_contrast).toInt();
|
---|
1609 | initial_brightness = set->value("initial_brightness", initial_brightness).toInt();
|
---|
1610 | initial_hue = set->value("initial_hue", initial_hue).toInt();
|
---|
1611 | initial_saturation = set->value("initial_saturation", initial_saturation).toInt();
|
---|
1612 | initial_gamma = set->value("initial_gamma", initial_gamma).toInt();
|
---|
1613 |
|
---|
1614 | initial_audio_equalizer = set->value("initial_audio_equalizer", initial_audio_equalizer).toList();
|
---|
1615 |
|
---|
1616 | initial_zoom_factor = set->value("initial_zoom_factor", initial_zoom_factor).toDouble();
|
---|
1617 | initial_sub_pos = set->value("initial_sub_pos", initial_sub_pos).toInt();
|
---|
1618 |
|
---|
1619 | initial_volnorm = set->value("initial_volnorm", initial_volnorm).toBool();
|
---|
1620 | initial_postprocessing = set->value("initial_postprocessing", initial_postprocessing).toBool();
|
---|
1621 |
|
---|
1622 | initial_deinterlace = set->value("initial_deinterlace", initial_deinterlace).toInt();
|
---|
1623 |
|
---|
1624 | initial_audio_channels = set->value("initial_audio_channels", initial_audio_channels).toInt();
|
---|
1625 | initial_stereo_mode = set->value("initial_stereo_mode", initial_stereo_mode).toInt();
|
---|
1626 |
|
---|
1627 | initial_audio_track = set->value("initial_audio_track", initial_audio_track).toInt();
|
---|
1628 | initial_subtitle_track = set->value("initial_subtitle_track", initial_subtitle_track).toInt();
|
---|
1629 |
|
---|
1630 | set->endGroup(); // defaults
|
---|
1631 |
|
---|
1632 |
|
---|
1633 | /* ************
|
---|
1634 | MPlayer info
|
---|
1635 | ************ */
|
---|
1636 |
|
---|
1637 | set->beginGroup( "mplayer_info");
|
---|
1638 | mplayer_detected_version = set->value("mplayer_detected_version", mplayer_detected_version).toInt();
|
---|
1639 | mplayer_user_supplied_version = set->value("mplayer_user_supplied_version", mplayer_user_supplied_version).toInt();
|
---|
1640 | #ifdef MPLAYER2_SUPPORT
|
---|
1641 | mplayer_is_mplayer2 = set->value("is_mplayer2", mplayer_is_mplayer2).toBool();
|
---|
1642 | mplayer2_detected_version = set->value("mplayer2_detected_version", mplayer2_detected_version).toString();
|
---|
1643 | #endif
|
---|
1644 | set->endGroup(); // mplayer_info
|
---|
1645 |
|
---|
1646 |
|
---|
1647 | /* *********
|
---|
1648 | Instances
|
---|
1649 | ********* */
|
---|
1650 | #ifdef SINGLE_INSTANCE
|
---|
1651 | set->beginGroup("instances");
|
---|
1652 | use_single_instance = set->value("single_instance_enabled", use_single_instance).toBool();
|
---|
1653 | set->endGroup(); // instances
|
---|
1654 | #endif
|
---|
1655 |
|
---|
1656 |
|
---|
1657 | /* ****************
|
---|
1658 | Floating control
|
---|
1659 | **************** */
|
---|
1660 |
|
---|
1661 | set->beginGroup("floating_control");
|
---|
1662 | floating_control_margin = set->value("margin", floating_control_margin).toInt();
|
---|
1663 | floating_control_width = set->value("width", floating_control_width).toInt();
|
---|
1664 | floating_control_animated = set->value("animated", floating_control_animated).toBool();
|
---|
1665 | floating_display_in_compact_mode = set->value("display_in_compact_mode", floating_display_in_compact_mode).toBool();
|
---|
1666 | floating_activation_area = set->value("activation_area", floating_activation_area).toInt();
|
---|
1667 | floating_hide_delay = set->value("hide_delay", floating_hide_delay).toInt();
|
---|
1668 | set->endGroup(); // floating_control
|
---|
1669 |
|
---|
1670 |
|
---|
1671 | /* *******
|
---|
1672 | History
|
---|
1673 | ******* */
|
---|
1674 |
|
---|
1675 | set->beginGroup("history");
|
---|
1676 |
|
---|
1677 | history_recents->setMaxItems( set->value("recents/max_items", history_recents->maxItems()).toInt() );
|
---|
1678 | history_recents->fromStringList( set->value("recents", history_recents->toStringList()).toStringList() );
|
---|
1679 |
|
---|
1680 | history_urls->setMaxItems( set->value("urls/max_items", history_urls->maxItems()).toInt() );
|
---|
1681 | history_urls->fromStringList( set->value("urls", history_urls->toStringList()).toStringList() );
|
---|
1682 |
|
---|
1683 | set->endGroup(); // history
|
---|
1684 |
|
---|
1685 |
|
---|
1686 | /* *******
|
---|
1687 | Filters
|
---|
1688 | ******* */
|
---|
1689 |
|
---|
1690 | filters->load(set);
|
---|
1691 |
|
---|
1692 |
|
---|
1693 | /* *********
|
---|
1694 | SMPlayer info
|
---|
1695 | ********* */
|
---|
1696 |
|
---|
1697 | set->beginGroup("smplayer");
|
---|
1698 | #ifdef CHECK_UPGRADED
|
---|
1699 | smplayer_stable_version = set->value("stable_version", smplayer_stable_version).toString();
|
---|
1700 | check_if_upgraded = set->value("check_if_upgraded", check_if_upgraded).toBool();
|
---|
1701 | #endif
|
---|
1702 | #ifdef FONTCACHE_DIALOG
|
---|
1703 | smplayer_version = set->value("version", smplayer_version).toString();
|
---|
1704 | #endif
|
---|
1705 | set->endGroup();
|
---|
1706 |
|
---|
1707 |
|
---|
1708 | /* *********
|
---|
1709 | Update
|
---|
1710 | ********* */
|
---|
1711 |
|
---|
1712 | #ifdef UPDATE_CHECKER
|
---|
1713 | update_checker_data.load(set);
|
---|
1714 | #endif
|
---|
1715 |
|
---|
1716 |
|
---|
1717 | // Fix some options
|
---|
1718 | if (vo == "player_default") vo = "";
|
---|
1719 | if (ao == "player_default") ao = "";
|
---|
1720 |
|
---|
1721 | #if QT_VERSION < 0x050000
|
---|
1722 | if (style.toLower() == "fusion") style = "";
|
---|
1723 | #endif
|
---|
1724 |
|
---|
1725 | // Remove old option names
|
---|
1726 | if (set->contains("gui/style")) set->remove("gui/style");
|
---|
1727 |
|
---|
1728 | #ifdef USE_CONFIG_VERSION
|
---|
1729 | qDebug("Preferences::load: config_version: %d, CURRENT_CONFIG_VERSION: %d", config_version, CURRENT_CONFIG_VERSION);
|
---|
1730 | // Fix some values if config is old
|
---|
1731 | if (config_version < CURRENT_CONFIG_VERSION) {
|
---|
1732 | qDebug("Preferences::load: config version is old, updating it");
|
---|
1733 | /*
|
---|
1734 | if (config_version <= 2) {
|
---|
1735 | use_slices = false;
|
---|
1736 | }
|
---|
1737 | if (config_version <= 3) {
|
---|
1738 | osd = None;
|
---|
1739 | frame_drop = false;
|
---|
1740 | cache_for_files = 2048;
|
---|
1741 | cache_for_streams = 2048;
|
---|
1742 | time_to_kill_mplayer = 1000;
|
---|
1743 | }
|
---|
1744 | */
|
---|
1745 | if (config_version <= 4) {
|
---|
1746 | use_slices = false;
|
---|
1747 | osd = Seek;
|
---|
1748 | frame_drop = false;
|
---|
1749 | cache_for_files = 2048;
|
---|
1750 | cache_for_streams = 2048;
|
---|
1751 | time_to_kill_mplayer = 1000;
|
---|
1752 |
|
---|
1753 | resize_method = Never;
|
---|
1754 | //move_when_dragging = false;
|
---|
1755 | }
|
---|
1756 | config_version = CURRENT_CONFIG_VERSION;
|
---|
1757 | }
|
---|
1758 | #endif
|
---|
1759 |
|
---|
1760 | #if defined(MPV_SUPPORT) && defined(MPLAYER_SUPPORT)
|
---|
1761 | #ifdef Q_OS_WIN
|
---|
1762 | // Check if the mplayer binary exists and try to fix it
|
---|
1763 | if (!QFile::exists(mplayer_bin)) {
|
---|
1764 | qWarning("mplayer_bin '%s' doesn't exist", mplayer_bin.toLatin1().constData());
|
---|
1765 | bool fixed = false;
|
---|
1766 | if (QFile::exists("mplayer/mplayer.exe")) {
|
---|
1767 | mplayer_bin = "mplayer/mplayer.exe";
|
---|
1768 | fixed = true;
|
---|
1769 | }
|
---|
1770 | else
|
---|
1771 | if (QFile::exists("mplayer/mplayer2.exe")) {
|
---|
1772 | mplayer_bin = "mplayer/mplayer2.exe";
|
---|
1773 | fixed = true;
|
---|
1774 | }
|
---|
1775 | else
|
---|
1776 | if (QFile::exists("mpv/mpv.exe")) {
|
---|
1777 | mplayer_bin = "mpv/mpv.exe";
|
---|
1778 | fixed = true;
|
---|
1779 | }
|
---|
1780 | if (fixed) {
|
---|
1781 | qWarning("mplayer_bin changed to '%s'", mplayer_bin.toLatin1().constData());
|
---|
1782 | }
|
---|
1783 | }
|
---|
1784 | #endif
|
---|
1785 | #ifdef Q_OS_LINUX
|
---|
1786 | if (!QFile::exists(mplayer_bin)) {
|
---|
1787 | QString app_path = Helper::findExecutable(mplayer_bin);
|
---|
1788 | //qDebug("Preferences::load: app_path: %s", app_path.toUtf8().constData());
|
---|
1789 | if (!app_path.isEmpty()) {
|
---|
1790 | mplayer_bin = app_path;
|
---|
1791 | } else {
|
---|
1792 | // Executable not found, try to find an alternative
|
---|
1793 | if (mplayer_bin.startsWith("mplayer")) {
|
---|
1794 | app_path = Helper::findExecutable("mpv");
|
---|
1795 | if (!app_path.isEmpty()) mplayer_bin = app_path;
|
---|
1796 | }
|
---|
1797 | else
|
---|
1798 | if (mplayer_bin.startsWith("mpv")) {
|
---|
1799 | app_path = Helper::findExecutable("mplayer");
|
---|
1800 | if (!app_path.isEmpty()) mplayer_bin = app_path;
|
---|
1801 | }
|
---|
1802 | }
|
---|
1803 | }
|
---|
1804 | #endif
|
---|
1805 | #endif
|
---|
1806 | }
|
---|
1807 |
|
---|
1808 |
|
---|
1809 | double Preferences::monitor_aspect_double() {
|
---|
1810 | qDebug("Preferences::monitor_aspect_double");
|
---|
1811 |
|
---|
1812 | QRegExp exp("(\\d+)[:/](\\d+)");
|
---|
1813 | if (exp.indexIn( monitor_aspect ) != -1) {
|
---|
1814 | int w = exp.cap(1).toInt();
|
---|
1815 | int h = exp.cap(2).toInt();
|
---|
1816 | qDebug(" monitor_aspect parsed successfully: %d:%d", w, h);
|
---|
1817 | return (double) w/h;
|
---|
1818 | }
|
---|
1819 |
|
---|
1820 | bool ok;
|
---|
1821 | double res = monitor_aspect.toDouble(&ok);
|
---|
1822 | if (ok) {
|
---|
1823 | qDebug(" monitor_aspect parsed successfully: %f", res);
|
---|
1824 | return res;
|
---|
1825 | } else {
|
---|
1826 | qDebug(" warning: monitor_aspect couldn't be parsed!");
|
---|
1827 | qDebug(" monitor_aspect set to 0");
|
---|
1828 | return 0;
|
---|
1829 | }
|
---|
1830 | }
|
---|
1831 |
|
---|
1832 | void Preferences::setupScreenshotFolder() {
|
---|
1833 | #if QT_VERSION >= 0x040400
|
---|
1834 | if (screenshot_directory.isEmpty()) {
|
---|
1835 | #if QT_VERSION >= 0x050000
|
---|
1836 | QString pdir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
---|
1837 | if (pdir.isEmpty()) pdir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
---|
1838 | if (pdir.isEmpty()) pdir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
---|
1839 | #else
|
---|
1840 | QString pdir = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
|
---|
1841 | if (pdir.isEmpty()) pdir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
|
---|
1842 | if (pdir.isEmpty()) pdir = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
|
---|
1843 | #endif
|
---|
1844 | if (pdir.isEmpty()) pdir = "/tmp";
|
---|
1845 | if (!QFile::exists(pdir)) {
|
---|
1846 | qWarning("Preferences::setupScreenshotFolder: folder '%s' does not exist. Using /tmp as fallback", pdir.toUtf8().constData());
|
---|
1847 | pdir = "/tmp";
|
---|
1848 | }
|
---|
1849 | QString default_screenshot_path = QDir::toNativeSeparators(pdir + "/smplayer_screenshots");
|
---|
1850 | if (!QFile::exists(default_screenshot_path)) {
|
---|
1851 | qDebug("Preferences::setupScreenshotFolder: creating '%s'", default_screenshot_path.toUtf8().constData());
|
---|
1852 | if (!QDir().mkdir(default_screenshot_path)) {
|
---|
1853 | qWarning("Preferences::setupScreenshotFolder: failed to create '%s'", default_screenshot_path.toUtf8().constData());
|
---|
1854 | }
|
---|
1855 | }
|
---|
1856 | if (QFile::exists(default_screenshot_path)) {
|
---|
1857 | screenshot_directory = default_screenshot_path;
|
---|
1858 | }
|
---|
1859 | }
|
---|
1860 | else {
|
---|
1861 | screenshot_directory = QDir::toNativeSeparators(screenshot_directory);
|
---|
1862 | }
|
---|
1863 | #endif
|
---|
1864 | }
|
---|