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