1
/* smplayer, GUI front-end for mplayer.
2
Copyright (C) 2006-2009 Ricardo Villalba <rvm@escomposlinux.org>
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.
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.
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
19
#include "preferences.h"
22
#include "mediasettings.h"
24
#include "urlhistory.h"
32
using namespace Global;
34
Preferences::Preferences() {
35
history_recents = new Recents;
36
history_urls = new URLHistory;
40
#ifndef NO_USE_INI_FILES
45
Preferences::~Preferences() {
46
#ifndef NO_USE_INI_FILES
50
delete history_recents;
54
void Preferences::reset() {
60
mplayer_bin= "mplayer/mplayer.exe";
62
mplayer_bin = "mplayer";
68
screenshot_directory="";
70
if (QFile::exists(Paths::configPath() + "/screenshots")) {
71
screenshot_directory = Paths::configPath() + "/screenshots";
75
dont_remember_media_settings = false;
76
dont_remember_time_pos = false;
81
use_direct_rendering = false;
82
use_double_buffer = true;
83
disable_screensaver = true;
84
use_soft_video_eq = false;
87
add_blackborders_on_fullscreen = false;
90
softvol_max = 110; // 110 = default value in mplayer
91
use_scaletempo = Detect;
92
dont_change_volume = false;
94
use_audio_equalizer = true;
95
use_volume_option = Detect;
100
file_settings_method = "hash"; // Possible values: normal & hash
111
// Try to set default values
112
if (QFile::exists("/dev/dvd")) dvd_device = "/dev/dvd";
113
if (QFile::exists("/dev/cdrom")) cdrom_device = "/dev/cdrom";
117
enable_audiocd_on_windows = false;
120
vcd_initial_title = 2; // Most VCD's start at title #2
131
priority = AboveNormal; // Option only for windows
133
hard_frame_drop = false;
135
autosync_factor = 100;
137
h264_skip_loop_filter = LoopEnabled;
140
// MPlayer 1.0rc1 require restart, new versions don't
141
fast_audio_change = Detect;
142
#if !SMART_DVD_CHAPTERS
143
fast_chapter_change = false;
148
cache_for_files = 2000;
149
cache_for_streams = 1000;
150
cache_for_dvds = 0; // not recommended to use cache for dvds
151
cache_for_vcds = 1000;
152
cache_for_audiocds = 1000;
161
use_fontconfig = false;
162
subcp = "ISO-8859-1";
164
enca_lang = QString(QLocale::system().name()).section("_",0,0);
169
use_ass_subtitles = true;
170
ass_line_spacing = 0;
172
use_closed_caption_subs = false;
173
use_forced_subs_only = false;
175
subtitles_on_screenshots = false;
177
use_new_sub_commands = Detect;
178
change_sub_scale_should_restart = Detect;
181
// Nothing to do, default values are given in
182
// AssStyles constructor
184
force_ass_styles = false;
185
user_forced_ass_style.clear();
187
freetype_support = true;
199
color_key = 0x020202;
202
use_mplayer_window = false;
204
monitor_aspect=""; // Autodetect
208
mplayer_additional_options="";
209
mplayer_additional_video_filters="";
210
mplayer_additional_audio_filters="";
216
//mplayer log autosaving
217
autosave_mplayer_log = false;
218
mplayer_log_saveto = "";
219
//mplayer log autosaving end
221
#if REPAINT_BACKGROUND_OPTION
222
// "Repaint video background" in the preferences dialog
224
repaint_video_background = false;
226
repaint_video_background = true;
230
use_edl_files = true;
234
use_short_pathnames = false;
236
change_video_equalizer_on_startup = true;
238
use_pausing_keep_force = true;
240
use_correct_pts = Detect;
250
start_in_fullscreen = false;
251
compact_mode = false;
252
stay_on_top = NeverOnTop;
253
size_factor = 100; // 100%
255
resize_method = Always;
261
show_frame_counter = FALSE;
262
show_motion_vectors = false;
265
mouse_left_click_function = "dvdnav_mouse";
267
mouse_left_click_function = "";
269
mouse_right_click_function = "show_context_menu";
270
mouse_double_click_function = "fullscreen";
271
mouse_middle_click_function = "mute";
272
mouse_xbutton1_click_function = "";
273
mouse_xbutton2_click_function = "";
274
wheel_function = Seeking;
281
update_while_seeking = false;
282
#if ENABLE_DELAYED_DRAGGING
283
time_slider_drag_delay = 100;
292
restore_pos_after_fullscreen = true;
294
restore_pos_after_fullscreen = false;
297
save_window_size_on_exit = true;
299
close_on_finish = false;
303
pause_when_hidden = false;
305
allow_video_movement = false;
310
gui_minimum_width = 0; // 0 == disabled
312
default_size = QSize(580, 440);
314
#if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
315
hide_video_window_on_audio_files = true;
318
report_mplayer_crashes = true;
320
#if REPORT_OLD_MPLAYER
321
reported_mplayer_is_old = false;
324
auto_add_to_playlist = true;
325
add_to_playlist_consecutive_files = false;
332
latest_dir = QDir::homePath();
333
last_dvd_directory="";
340
initial_sub_scale = 5;
341
initial_sub_scale_ass = 1;
343
initial_contrast = 0;
344
initial_brightness = 0;
346
initial_saturation = 0;
349
initial_audio_equalizer << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
351
initial_panscan_factor = 1.0;
352
initial_sub_pos = 100; // 100%
354
initial_postprocessing = false;
355
initial_volnorm = false;
357
initial_deinterlace = MediaSettings::NoDeinterlace;
359
initial_audio_channels = MediaSettings::ChDefault;
360
initial_stereo_mode = MediaSettings::Stereo;
362
initial_audio_track = 1;
363
initial_subtitle_track = 1;
370
mplayer_detected_version = -1; //None version parsed yet
371
mplayer_user_supplied_version = -1;
379
// Some people reported smplayer doesn't start with this option enabled
380
// So now it's disabled by default on Windows
381
use_single_instance = false;
383
use_single_instance = true;
386
connection_port = 8000;
394
floating_control_margin = 0;
395
floating_control_width = 100; //100 %
396
floating_control_animated = true;
397
floating_display_in_compact_mode = false;
399
bypass_window_manager = true;
407
history_recents->clear();
408
history_urls->clear();
411
#ifndef NO_USE_INI_FILES
412
void Preferences::save() {
413
qDebug("Preferences::save");
415
QSettings * set = settings;
422
set->beginGroup( "general");
424
set->setValue("mplayer_bin", mplayer_bin);
425
set->setValue("driver/vo", vo);
426
set->setValue("driver/ao", ao);
428
set->setValue("screenshot_directory", screenshot_directory);
430
set->setValue("dont_remember_media_settings", dont_remember_media_settings);
431
set->setValue("dont_remember_time_pos", dont_remember_time_pos);
433
set->setValue("audio_lang", audio_lang);
434
set->setValue("subtitle_lang", subtitle_lang);
436
set->setValue("use_direct_rendering", use_direct_rendering);
437
set->setValue("use_double_buffer", use_double_buffer);
438
set->setValue("disable_screensaver", disable_screensaver);
439
set->setValue("use_soft_video_eq", use_soft_video_eq);
440
set->setValue("use_slices", use_slices );
441
set->setValue("autoq", autoq);
442
set->setValue("add_blackborders_on_fullscreen", add_blackborders_on_fullscreen);
444
set->setValue("use_soft_vol", use_soft_vol);
445
set->setValue("softvol_max", softvol_max);
446
set->setValue("use_scaletempo", use_scaletempo);
447
set->setValue("dont_change_volume", dont_change_volume );
448
set->setValue("use_hwac3", use_hwac3 );
449
set->setValue("use_audio_equalizer", use_audio_equalizer );
450
set->setValue("use_volume_option", use_volume_option);
452
set->setValue("loop", loop);
453
set->setValue("osd", osd);
455
set->setValue("file_settings_method", file_settings_method);
457
set->endGroup(); // general
464
set->beginGroup( "drives");
466
set->setValue("dvd_device", dvd_device);
467
set->setValue("cdrom_device", cdrom_device);
470
set->setValue("enable_audiocd_on_windows", enable_audiocd_on_windows);
473
set->setValue("vcd_initial_title", vcd_initial_title);
476
set->setValue("use_dvdnav", use_dvdnav);
479
set->endGroup(); // drives
486
set->beginGroup( "performance");
488
set->setValue("priority", priority);
489
set->setValue("frame_drop", frame_drop);
490
set->setValue("hard_frame_drop", hard_frame_drop);
491
set->setValue("autosync", autosync);
492
set->setValue("autosync_factor", autosync_factor);
494
set->setValue("h264_skip_loop_filter", h264_skip_loop_filter);
495
set->setValue("HD_height", HD_height);
497
set->setValue("fast_audio_change", fast_audio_change);
498
#if !SMART_DVD_CHAPTERS
499
set->setValue("fast_chapter_change", fast_chapter_change);
502
set->setValue("threads", threads);
504
set->setValue("cache_for_files", cache_for_files);
505
set->setValue("cache_for_streams", cache_for_streams);
506
set->setValue("cache_for_dvds", cache_for_dvds);
507
set->setValue("cache_for_vcds", cache_for_vcds);
508
set->setValue("cache_for_audiocds", cache_for_audiocds);
510
set->endGroup(); // performance
517
set->beginGroup("subtitles");
519
set->setValue("font_file", font_file);
520
set->setValue("font_name", font_name);
522
set->setValue("use_fontconfig", use_fontconfig);
523
set->setValue("subcp", subcp);
524
set->setValue("use_enca", use_enca);
525
set->setValue("enca_lang", enca_lang);
526
set->setValue("font_autoscale", font_autoscale);
527
set->setValue("subfuzziness", subfuzziness);
528
set->setValue("autoload_sub", autoload_sub);
530
set->setValue("use_ass_subtitles", use_ass_subtitles);
531
set->setValue("ass_line_spacing", ass_line_spacing);
532
set->setValue("use_closed_caption_subs", use_closed_caption_subs);
533
set->setValue("use_forced_subs_only", use_forced_subs_only);
535
set->setValue("subtitles_on_screenshots", subtitles_on_screenshots);
537
set->setValue("use_new_sub_commands", use_new_sub_commands);
538
set->setValue("change_sub_scale_should_restart", change_sub_scale_should_restart);
541
ass_styles.save(set);
542
set->setValue("force_ass_styles", force_ass_styles);
543
set->setValue("user_forced_ass_style", user_forced_ass_style);
545
set->setValue("freetype_support", freetype_support);
547
set->endGroup(); // subtitles
554
set->beginGroup( "advanced");
557
set->setValue("adapter", adapter);
561
set->setValue("color_key", QString::number(color_key,16));
564
set->setValue("use_mplayer_window", use_mplayer_window);
566
set->setValue("monitor_aspect", monitor_aspect);
568
set->setValue("use_idx", use_idx);
570
set->setValue("mplayer_additional_options", mplayer_additional_options);
571
set->setValue("mplayer_additional_video_filters", mplayer_additional_video_filters);
572
set->setValue("mplayer_additional_audio_filters", mplayer_additional_audio_filters);
574
set->setValue("log_mplayer", log_mplayer);
575
set->setValue("log_smplayer", log_smplayer);
576
set->setValue("log_filter", log_filter);
578
//mplayer log autosaving
579
set->setValue("autosave_mplayer_log", autosave_mplayer_log);
580
set->setValue("mplayer_log_saveto", mplayer_log_saveto);
581
//mplayer log autosaving end
583
#if REPAINT_BACKGROUND_OPTION
584
set->setValue("repaint_video_background", repaint_video_background);
587
set->setValue("use_edl_files", use_edl_files);
589
set->setValue("prefer_ipv4", prefer_ipv4);
591
set->setValue("use_short_pathnames", use_short_pathnames);
593
set->setValue("change_video_equalizer_on_startup", change_video_equalizer_on_startup);
595
set->setValue("use_pausing_keep_force", use_pausing_keep_force);
597
set->setValue("correct_pts", use_correct_pts);
599
set->setValue("actions_to_run", actions_to_run);
601
set->endGroup(); // advanced
608
set->beginGroup("gui");
610
set->setValue("fullscreen", fullscreen);
611
set->setValue("start_in_fullscreen", start_in_fullscreen);
613
set->setValue("compact_mode", compact_mode);
614
set->setValue("stay_on_top", (int) stay_on_top);
615
set->setValue("size_factor", size_factor);
616
set->setValue("resize_method", resize_method);
619
set->setValue("style", style);
622
set->setValue("show_frame_counter", show_frame_counter);
623
set->setValue("show_motion_vectors", show_motion_vectors);
625
set->setValue("mouse_left_click_function", mouse_left_click_function);
626
set->setValue("mouse_right_click_function", mouse_right_click_function);
627
set->setValue("mouse_double_click_function", mouse_double_click_function);
628
set->setValue("mouse_middle_click_function", mouse_middle_click_function);
629
set->setValue("mouse_xbutton1_click_function", mouse_xbutton1_click_function);
630
set->setValue("mouse_xbutton2_click_function", mouse_xbutton2_click_function);
631
set->setValue("wheel_function", wheel_function);
633
set->setValue("seeking1", seeking1);
634
set->setValue("seeking2", seeking2);
635
set->setValue("seeking3", seeking3);
636
set->setValue("seeking4", seeking4);
638
set->setValue("update_while_seeking", update_while_seeking);
639
#if ENABLE_DELAYED_DRAGGING
640
set->setValue("time_slider_drag_delay", time_slider_drag_delay);
643
set->setValue("language", language);
644
set->setValue("iconset", iconset);
646
set->setValue("balloon_count", balloon_count);
648
set->setValue("restore_pos_after_fullscreen", restore_pos_after_fullscreen);
649
set->setValue("save_window_size_on_exit", save_window_size_on_exit);
651
set->setValue("close_on_finish", close_on_finish);
653
set->setValue("default_font", default_font);
655
set->setValue("pause_when_hidden", pause_when_hidden);
657
set->setValue("allow_video_movement", allow_video_movement);
659
set->setValue("gui", gui);
662
set->setValue("gui_minimum_width", gui_minimum_width);
664
set->setValue("default_size", default_size);
666
#if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
667
set->setValue("hide_video_window_on_audio_files", hide_video_window_on_audio_files);
670
set->setValue("report_mplayer_crashes", report_mplayer_crashes);
672
#if REPORT_OLD_MPLAYER
673
set->setValue("reported_mplayer_is_old", reported_mplayer_is_old);
676
set->setValue("auto_add_to_playlist", auto_add_to_playlist);
677
set->setValue("add_to_playlist_consecutive_files", add_to_playlist_consecutive_files);
679
set->endGroup(); // gui
686
set->beginGroup( "directories");
687
set->setValue("latest_dir", latest_dir);
688
set->setValue("last_dvd_directory", last_dvd_directory);
689
set->endGroup(); // directories
696
set->beginGroup( "defaults");
698
set->setValue("initial_sub_scale", initial_sub_scale);
699
set->setValue("initial_sub_scale_ass", initial_sub_scale_ass);
700
set->setValue("initial_volume", initial_volume);
701
set->setValue("initial_contrast", initial_contrast);
702
set->setValue("initial_brightness", initial_brightness);
703
set->setValue("initial_hue", initial_hue);
704
set->setValue("initial_saturation", initial_saturation);
705
set->setValue("initial_gamma", initial_gamma);
707
set->setValue("initial_audio_equalizer", initial_audio_equalizer);
709
set->setValue("initial_panscan_factor", initial_panscan_factor);
710
set->setValue("initial_sub_pos", initial_sub_pos);
712
set->setValue("initial_volnorm", initial_volnorm);
713
set->setValue("initial_postprocessing", initial_postprocessing);
715
set->setValue("initial_deinterlace", initial_deinterlace);
717
set->setValue("initial_audio_channels", initial_audio_channels);
718
set->setValue("initial_stereo_mode", initial_stereo_mode);
720
set->setValue("initial_audio_track", initial_audio_track);
721
set->setValue("initial_subtitle_track", initial_subtitle_track);
723
set->endGroup(); // defaults
730
set->beginGroup( "mplayer_info");
731
set->setValue("mplayer_detected_version", mplayer_detected_version);
732
set->setValue("mplayer_user_supplied_version", mplayer_user_supplied_version);
733
set->endGroup(); // mplayer_info
740
set->beginGroup("instances");
741
set->setValue("use_single_instance", use_single_instance);
742
set->setValue("connection_port", connection_port);
743
set->setValue("use_autoport", use_autoport);
744
set->setValue("temp/autoport", autoport);
745
set->endGroup(); // instances
752
set->beginGroup("floating_control");
753
set->setValue("margin", floating_control_margin);
754
set->setValue("width", floating_control_width);
755
set->setValue("animated", floating_control_animated);
756
set->setValue("display_in_compact_mode", floating_display_in_compact_mode);
758
set->setValue("bypass_window_manager", bypass_window_manager);
760
set->endGroup(); // floating_control
767
set->beginGroup("history");
768
set->setValue("recents", history_recents->toStringList());
769
set->setValue("recents/max_items", history_recents->maxItems());
770
set->setValue("urls", history_urls->toStringList());
771
set->setValue("urls/max_items", history_urls->maxItems());
772
set->endGroup(); // history
777
void Preferences::load() {
778
qDebug("Preferences::load");
780
QSettings * set = settings;
787
set->beginGroup( "general");
789
mplayer_bin = set->value("mplayer_bin", mplayer_bin).toString();
790
vo = set->value("driver/vo", vo).toString();
791
ao = set->value("driver/ao", ao).toString();
793
screenshot_directory = set->value("screenshot_directory", screenshot_directory).toString();
795
dont_remember_media_settings = set->value("dont_remember_media_settings", dont_remember_media_settings).toBool();
796
dont_remember_time_pos = set->value("dont_remember_time_pos", dont_remember_time_pos).toBool();
798
audio_lang = set->value("audio_lang", audio_lang).toString();
799
subtitle_lang = set->value("subtitle_lang", subtitle_lang).toString();
801
use_direct_rendering = set->value("use_direct_rendering", use_direct_rendering).toBool();
802
use_double_buffer = set->value("use_double_buffer", use_double_buffer).toBool();
803
disable_screensaver = set->value("disable_screensaver", disable_screensaver).toBool();
804
use_soft_video_eq = set->value("use_soft_video_eq", use_soft_video_eq).toBool();
805
use_slices = set->value("use_slices", use_slices ).toBool();
806
autoq = set->value("autoq", autoq).toInt();
807
add_blackborders_on_fullscreen = set->value("add_blackborders_on_fullscreen", add_blackborders_on_fullscreen).toBool();
809
use_soft_vol = set->value("use_soft_vol", use_soft_vol).toBool();
810
softvol_max = set->value("softvol_max", softvol_max).toInt();
811
use_scaletempo = (OptionState) set->value("use_scaletempo", use_scaletempo).toInt();
812
dont_change_volume = set->value("dont_change_volume", dont_change_volume ).toBool();
813
use_hwac3 = set->value("use_hwac3", use_hwac3 ).toBool();
814
use_audio_equalizer = set->value("use_audio_equalizer", use_audio_equalizer ).toBool();
815
use_volume_option = (OptionState) set->value("use_volume_option", use_volume_option).toInt();
817
loop = set->value("loop", loop).toBool();
818
osd = set->value("osd", osd).toInt();
820
file_settings_method = set->value("file_settings_method", file_settings_method).toString();
822
set->endGroup(); // general
829
set->beginGroup( "drives");
831
dvd_device = set->value("dvd_device", dvd_device).toString();
832
cdrom_device = set->value("cdrom_device", cdrom_device).toString();
835
enable_audiocd_on_windows = set->value("enable_audiocd_on_windows", enable_audiocd_on_windows).toBool();
838
vcd_initial_title = set->value("vcd_initial_title", vcd_initial_title ).toInt();
841
use_dvdnav = set->value("use_dvdnav", use_dvdnav).toBool();
844
set->endGroup(); // drives
851
set->beginGroup( "performance");
853
priority = set->value("priority", priority).toInt();
854
frame_drop = set->value("frame_drop", frame_drop).toBool();
855
hard_frame_drop = set->value("hard_frame_drop", hard_frame_drop).toBool();
856
autosync = set->value("autosync", autosync).toBool();
857
autosync_factor = set->value("autosync_factor", autosync_factor).toInt();
859
h264_skip_loop_filter = (H264LoopFilter) set->value("h264_skip_loop_filter", h264_skip_loop_filter).toInt();
860
HD_height = set->value("HD_height", HD_height).toInt();
862
fast_audio_change = (OptionState) set->value("fast_audio_change", fast_audio_change).toInt();
863
#if !SMART_DVD_CHAPTERS
864
fast_chapter_change = set->value("fast_chapter_change", fast_chapter_change).toBool();
867
threads = set->value("threads", threads).toInt();
869
cache_for_files = set->value("cache_for_files", cache_for_files).toInt();
870
cache_for_streams = set->value("cache_for_streams", cache_for_streams).toInt();
871
cache_for_dvds = set->value("cache_for_dvds", cache_for_dvds).toInt();
872
cache_for_vcds = set->value("cache_for_vcds", cache_for_vcds).toInt();
873
cache_for_audiocds = set->value("cache_for_audiocds", cache_for_audiocds).toInt();
875
set->endGroup(); // performance
882
set->beginGroup("subtitles");
884
font_file = set->value("font_file", font_file).toString();
885
font_name = set->value("font_name", font_name).toString();
887
use_fontconfig = set->value("use_fontconfig", use_fontconfig).toBool();
888
subcp = set->value("subcp", subcp).toString();
889
use_enca = set->value("use_enca", use_enca).toBool();
890
enca_lang = set->value("enca_lang", enca_lang).toString();
891
font_autoscale = set->value("font_autoscale", font_autoscale).toInt();
892
subfuzziness = set->value("subfuzziness", subfuzziness).toInt();
893
autoload_sub = set->value("autoload_sub", autoload_sub).toBool();
895
use_ass_subtitles = set->value("use_ass_subtitles", use_ass_subtitles).toBool();
896
ass_line_spacing = set->value("ass_line_spacing", ass_line_spacing).toInt();
898
use_closed_caption_subs = set->value("use_closed_caption_subs", use_closed_caption_subs).toBool();
899
use_forced_subs_only = set->value("use_forced_subs_only", use_forced_subs_only).toBool();
901
subtitles_on_screenshots = set->value("subtitles_on_screenshots", subtitles_on_screenshots).toBool();
903
use_new_sub_commands = (OptionState) set->value("use_new_sub_commands", use_new_sub_commands).toInt();
904
change_sub_scale_should_restart = (OptionState) set->value("change_sub_scale_should_restart", change_sub_scale_should_restart).toInt();
907
ass_styles.load(set);
908
force_ass_styles = set->value("force_ass_styles", force_ass_styles).toBool();
909
user_forced_ass_style = set->value("user_forced_ass_style", user_forced_ass_style).toString();
911
freetype_support = set->value("freetype_support", freetype_support).toBool();
913
set->endGroup(); // subtitles
920
set->beginGroup( "advanced");
923
adapter = set->value("adapter", adapter).toInt();
928
QString color = set->value("color_key", QString::number(color_key,16)).toString();
929
unsigned int temp_color_key = color.toUInt(&ok, 16);
931
color_key = temp_color_key;
932
//color_key = set->value("color_key", color_key).toInt();
935
use_mplayer_window = set->value("use_mplayer_window", use_mplayer_window).toBool();
937
monitor_aspect = set->value("monitor_aspect", monitor_aspect).toString();
939
use_idx = set->value("use_idx", use_idx).toBool();
941
mplayer_additional_options = set->value("mplayer_additional_options", mplayer_additional_options).toString();
942
mplayer_additional_video_filters = set->value("mplayer_additional_video_filters", mplayer_additional_video_filters).toString();
943
mplayer_additional_audio_filters = set->value("mplayer_additional_audio_filters", mplayer_additional_audio_filters).toString();
945
log_mplayer = set->value("log_mplayer", log_mplayer).toBool();
946
log_smplayer = set->value("log_smplayer", log_smplayer).toBool();
947
log_filter = set->value("log_filter", log_filter).toString();
949
//mplayer log autosaving
950
autosave_mplayer_log = set->value("autosave_mplayer_log", autosave_mplayer_log).toBool();
951
mplayer_log_saveto = set->value("mplayer_log_saveto", mplayer_log_saveto).toString();
952
//mplayer log autosaving end
954
#if REPAINT_BACKGROUND_OPTION
955
repaint_video_background = set->value("repaint_video_background", repaint_video_background).toBool();
958
use_edl_files = set->value("use_edl_files", use_edl_files).toBool();
960
prefer_ipv4 = set->value("prefer_ipv4", prefer_ipv4).toBool();
962
use_short_pathnames = set->value("use_short_pathnames", use_short_pathnames).toBool();
964
use_pausing_keep_force = set->value("use_pausing_keep_force", use_pausing_keep_force).toBool();
966
use_correct_pts = (OptionState) set->value("correct_pts", use_correct_pts).toInt();
968
actions_to_run = set->value("actions_to_run", actions_to_run).toString();
970
set->endGroup(); // advanced
977
set->beginGroup("gui");
979
fullscreen = set->value("fullscreen", fullscreen).toBool();
980
start_in_fullscreen = set->value("start_in_fullscreen", start_in_fullscreen).toBool();
982
compact_mode = set->value("compact_mode", compact_mode).toBool();
983
stay_on_top = (Preferences::OnTop) set->value("stay_on_top", (int) stay_on_top).toInt();
984
size_factor = set->value("size_factor", size_factor).toInt();
985
resize_method = set->value("resize_method", resize_method).toInt();
988
style = set->value("style", style).toString();
991
show_frame_counter = set->value("show_frame_counter", show_frame_counter).toBool();
992
show_motion_vectors = set->value("show_motion_vectors", show_motion_vectors).toBool();
994
mouse_left_click_function = set->value("mouse_left_click_function", mouse_left_click_function).toString();
995
mouse_right_click_function = set->value("mouse_right_click_function", mouse_right_click_function).toString();
996
mouse_double_click_function = set->value("mouse_double_click_function", mouse_double_click_function).toString();
997
mouse_middle_click_function = set->value("mouse_middle_click_function", mouse_middle_click_function).toString();
998
mouse_xbutton1_click_function = set->value("mouse_xbutton1_click_function", mouse_xbutton1_click_function).toString();
999
mouse_xbutton2_click_function = set->value("mouse_xbutton2_click_function", mouse_xbutton2_click_function).toString();
1000
wheel_function = set->value("wheel_function", wheel_function).toInt();
1002
seeking1 = set->value("seeking1", seeking1).toInt();
1003
seeking2 = set->value("seeking2", seeking2).toInt();
1004
seeking3 = set->value("seeking3", seeking3).toInt();
1005
seeking4 = set->value("seeking4", seeking4).toInt();
1007
update_while_seeking = set->value("update_while_seeking", update_while_seeking).toBool();
1008
#if ENABLE_DELAYED_DRAGGING
1009
time_slider_drag_delay = set->value("time_slider_drag_delay", time_slider_drag_delay).toInt();
1012
language = set->value("language", language).toString();
1013
iconset= set->value("iconset", iconset).toString();
1015
balloon_count = set->value("balloon_count", balloon_count).toInt();
1017
restore_pos_after_fullscreen = set->value("restore_pos_after_fullscreen", restore_pos_after_fullscreen).toBool();
1018
save_window_size_on_exit = set->value("save_window_size_on_exit", save_window_size_on_exit).toBool();
1020
close_on_finish = set->value("close_on_finish", close_on_finish).toBool();
1022
default_font = set->value("default_font", default_font).toString();
1024
pause_when_hidden = set->value("pause_when_hidden", pause_when_hidden).toBool();
1026
allow_video_movement = set->value("allow_video_movement", allow_video_movement).toBool();
1028
gui = set->value("gui", gui).toString();
1031
gui_minimum_width = set->value("gui_minimum_width", gui_minimum_width).toInt();
1033
default_size = set->value("default_size", default_size).toSize();
1035
#if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
1036
hide_video_window_on_audio_files = set->value("hide_video_window_on_audio_files", hide_video_window_on_audio_files).toBool();
1039
report_mplayer_crashes = set->value("report_mplayer_crashes", report_mplayer_crashes).toBool();
1041
#if REPORT_OLD_MPLAYER
1042
reported_mplayer_is_old = set->value("reported_mplayer_is_old", reported_mplayer_is_old).toBool();
1045
auto_add_to_playlist = set->value("auto_add_to_playlist", auto_add_to_playlist).toBool();
1046
add_to_playlist_consecutive_files = set->value("add_to_playlist_consecutive_files", add_to_playlist_consecutive_files).toBool();
1048
set->endGroup(); // gui
1055
set->beginGroup( "directories");
1056
latest_dir = set->value("latest_dir", latest_dir).toString();
1057
last_dvd_directory = set->value("last_dvd_directory", last_dvd_directory).toString();
1058
set->endGroup(); // directories
1065
set->beginGroup( "defaults");
1067
initial_sub_scale = set->value("initial_sub_scale", initial_sub_scale).toDouble();
1068
initial_sub_scale_ass = set->value("initial_sub_scale_ass", initial_sub_scale_ass).toDouble();
1069
initial_volume = set->value("initial_volume", initial_volume).toInt();
1070
initial_contrast = set->value("initial_contrast", initial_contrast).toInt();
1071
initial_brightness = set->value("initial_brightness", initial_brightness).toInt();
1072
initial_hue = set->value("initial_hue", initial_hue).toInt();
1073
initial_saturation = set->value("initial_saturation", initial_saturation).toInt();
1074
initial_gamma = set->value("initial_gamma", initial_gamma).toInt();
1076
initial_audio_equalizer = set->value("initial_audio_equalizer", initial_audio_equalizer).toList();
1078
initial_panscan_factor = set->value("initial_panscan_factor", initial_panscan_factor).toDouble();
1079
initial_sub_pos = set->value("initial_sub_pos", initial_sub_pos).toInt();
1081
initial_volnorm = set->value("initial_volnorm", initial_volnorm).toBool();
1082
initial_postprocessing = set->value("initial_postprocessing", initial_postprocessing).toBool();
1084
initial_deinterlace = set->value("initial_deinterlace", initial_deinterlace).toInt();
1086
initial_audio_channels = set->value("initial_audio_channels", initial_audio_channels).toInt();
1087
initial_stereo_mode = set->value("initial_stereo_mode", initial_stereo_mode).toInt();
1089
initial_audio_track = set->value("initial_audio_track", initial_audio_track).toInt();
1090
initial_subtitle_track = set->value("initial_subtitle_track", initial_subtitle_track).toInt();
1092
set->endGroup(); // defaults
1099
set->beginGroup( "mplayer_info");
1100
mplayer_detected_version = set->value("mplayer_detected_version", mplayer_detected_version).toInt();
1101
mplayer_user_supplied_version = set->value("mplayer_user_supplied_version", mplayer_user_supplied_version).toInt();
1102
set->endGroup(); // mplayer_info
1109
set->beginGroup("instances");
1110
use_single_instance = set->value("use_single_instance", use_single_instance).toBool();
1111
connection_port = set->value("connection_port", connection_port).toInt();
1112
use_autoport = set->value("use_autoport", use_autoport).toBool();
1113
autoport = set->value("temp/autoport", autoport).toInt();
1114
set->endGroup(); // instances
1121
set->beginGroup("floating_control");
1122
floating_control_margin = set->value("margin", floating_control_margin).toInt();
1123
floating_control_width = set->value("width", floating_control_width).toInt();
1124
floating_control_animated = set->value("animated", floating_control_animated).toBool();
1125
floating_display_in_compact_mode = set->value("display_in_compact_mode", floating_display_in_compact_mode).toBool();
1127
bypass_window_manager = set->value("bypass_window_manager", bypass_window_manager).toBool();
1129
set->endGroup(); // floating_control
1136
set->beginGroup("history");
1137
history_recents->fromStringList( set->value("recents", history_recents->toStringList()).toStringList() );
1138
history_recents->setMaxItems( set->value("recents/max_items", history_recents->maxItems()).toInt() );;
1139
history_urls->fromStringList( set->value("urls", history_urls->toStringList()).toStringList() );
1140
history_urls->setMaxItems( set->value("urls/max_items", history_urls->maxItems()).toInt() );;
1141
set->endGroup(); // history
1144
#endif // NO_USE_INI_FILES
1146
double Preferences::monitor_aspect_double() {
1147
qDebug("Preferences::monitor_aspect_double");
1149
QRegExp exp("(\\d+)[:/](\\d+)");
1150
if (exp.indexIn( monitor_aspect ) != -1) {
1151
int w = exp.cap(1).toInt();
1152
int h = exp.cap(2).toInt();
1153
qDebug(" monitor_aspect parsed successfully: %d:%d", w, h);
1154
return (double) w/h;
1158
double res = monitor_aspect.toDouble(&ok);
1160
qDebug(" monitor_aspect parsed successfully: %f", res);
1163
qDebug(" warning: monitor_aspect couldn't be parsed!");
1164
qDebug(" monitor_aspect set to 0");