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