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