~ubuntu-branches/debian/sid/smplayer/sid

« back to all changes in this revision

Viewing changes to src/preferences.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Maia Kozheva
  • Date: 2009-03-31 23:05:43 UTC
  • mto: (1.1.9 upstream) (3.1.2 squeeze)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20090331230543-nsklbxenl2hf2n6h
Tags: upstream-0.6.7
ImportĀ upstreamĀ versionĀ 0.6.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  smplayer, GUI front-end for mplayer.
 
2
    Copyright (C) 2006-2009 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
 
 
26
#include <QSettings>
 
27
#include <QFileInfo>
 
28
#include <QRegExp>
 
29
#include <QDir>
 
30
#include <QLocale>
 
31
 
 
32
using namespace Global;
 
33
 
 
34
Preferences::Preferences() {
 
35
        history_recents = new Recents;
 
36
        history_urls = new URLHistory;
 
37
 
 
38
        reset();
 
39
 
 
40
#ifndef NO_USE_INI_FILES
 
41
        load();
 
42
#endif
 
43
}
 
44
 
 
45
Preferences::~Preferences() {
 
46
#ifndef NO_USE_INI_FILES
 
47
        save();
 
48
#endif
 
49
 
 
50
        delete history_recents;
 
51
        delete history_urls;
 
52
}
 
53
 
 
54
void Preferences::reset() {
 
55
    /* *******
 
56
       General
 
57
       ******* */
 
58
 
 
59
#ifdef Q_OS_WIN
 
60
        mplayer_bin= "mplayer/mplayer.exe";
 
61
#else
 
62
        mplayer_bin = "mplayer";
 
63
#endif
 
64
 
 
65
        vo = ""; 
 
66
        ao = "";
 
67
 
 
68
        screenshot_directory="";
 
69
#ifndef PORTABLE_APP
 
70
        if (QFile::exists(Paths::configPath() + "/screenshots")) {
 
71
                screenshot_directory = Paths::configPath() + "/screenshots";
 
72
        }
 
73
#endif
 
74
 
 
75
        dont_remember_media_settings = false;
 
76
        dont_remember_time_pos = false;
 
77
 
 
78
        audio_lang = "";
 
79
        subtitle_lang = "";
 
80
 
 
81
        use_direct_rendering = false;
 
82
        use_double_buffer = true;
 
83
        disable_screensaver = true;
 
84
        use_soft_video_eq = false;
 
85
        use_slices = true;
 
86
        autoq = 6;
 
87
        add_blackborders_on_fullscreen = false;
 
88
 
 
89
        use_soft_vol = true;
 
90
        softvol_max = 110; // 110 = default value in mplayer
 
91
        use_scaletempo = Detect;
 
92
        dont_change_volume = false;
 
93
        use_hwac3 = false;
 
94
        use_audio_equalizer = true;
 
95
        use_volume_option = Detect; 
 
96
 
 
97
        loop = false;
 
98
        osd = None;
 
99
 
 
100
        file_settings_method = "hash"; // Possible values: normal & hash
 
101
 
 
102
 
 
103
    /* ***************
 
104
       Drives (CD/DVD)
 
105
       *************** */
 
106
 
 
107
        dvd_device = "";
 
108
        cdrom_device = "";
 
109
 
 
110
#ifndef Q_OS_WIN
 
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";
 
114
#endif
 
115
 
 
116
#ifdef Q_OS_WIN
 
117
        enable_audiocd_on_windows = false;
 
118
#endif
 
119
 
 
120
        vcd_initial_title = 2; // Most VCD's start at title #2
 
121
 
 
122
#if DVDNAV_SUPPORT
 
123
        use_dvdnav = false;
 
124
#endif
 
125
 
 
126
 
 
127
    /* ***********
 
128
       Performance
 
129
       *********** */
 
130
 
 
131
        priority = AboveNormal; // Option only for windows
 
132
        frame_drop = true;
 
133
        hard_frame_drop = false;
 
134
        autosync = false;
 
135
        autosync_factor = 100;
 
136
 
 
137
        h264_skip_loop_filter = LoopEnabled;
 
138
        HD_height = 720;
 
139
 
 
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;
 
144
#endif
 
145
 
 
146
        threads = 1;
 
147
 
 
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;
 
153
 
 
154
 
 
155
    /* *********
 
156
       Subtitles
 
157
       ********* */
 
158
 
 
159
        font_file = "";
 
160
        font_name = "";
 
161
        use_fontconfig = false;
 
162
        subcp = "ISO-8859-1";
 
163
        use_enca = false;
 
164
        enca_lang = QString(QLocale::system().name()).section("_",0,0);
 
165
        font_autoscale = 1;
 
166
        subfuzziness = 1;
 
167
        autoload_sub = true;
 
168
 
 
169
        use_ass_subtitles = true;
 
170
        ass_line_spacing = 0;
 
171
 
 
172
        use_closed_caption_subs = false;
 
173
        use_forced_subs_only = false;
 
174
 
 
175
        subtitles_on_screenshots = false;
 
176
 
 
177
        use_new_sub_commands = Detect;
 
178
        change_sub_scale_should_restart = Detect;
 
179
 
 
180
        // ASS styles
 
181
        // Nothing to do, default values are given in
 
182
        // AssStyles constructor
 
183
 
 
184
        force_ass_styles = false;
 
185
        user_forced_ass_style.clear();
 
186
 
 
187
        freetype_support = true;
 
188
 
 
189
 
 
190
    /* ********
 
191
       Advanced
 
192
       ******** */
 
193
 
 
194
#if USE_ADAPTER
 
195
        adapter = -1;
 
196
#endif
 
197
 
 
198
#if USE_COLORKEY
 
199
        color_key = 0x020202;
 
200
#endif
 
201
 
 
202
        use_mplayer_window = false;
 
203
 
 
204
        monitor_aspect=""; // Autodetect
 
205
 
 
206
        use_idx = false;
 
207
 
 
208
        mplayer_additional_options="";
 
209
    mplayer_additional_video_filters="";
 
210
    mplayer_additional_audio_filters="";
 
211
 
 
212
        log_mplayer = true;
 
213
        log_smplayer = true;
 
214
        log_filter = ".*";
 
215
 
 
216
    //mplayer log autosaving
 
217
    autosave_mplayer_log = false;
 
218
    mplayer_log_saveto = "";
 
219
    //mplayer log autosaving end
 
220
 
 
221
#if REPAINT_BACKGROUND_OPTION
 
222
        // "Repaint video background" in the preferences dialog
 
223
        #ifndef Q_OS_WIN
 
224
        repaint_video_background = false;
 
225
        #else
 
226
        repaint_video_background = true;
 
227
        #endif
 
228
#endif
 
229
 
 
230
        use_edl_files = true;
 
231
 
 
232
        prefer_ipv4 = true;
 
233
 
 
234
        use_short_pathnames = false;
 
235
 
 
236
        change_video_equalizer_on_startup = true;
 
237
 
 
238
        use_pausing_keep_force = true;
 
239
 
 
240
        use_correct_pts = Detect;
 
241
 
 
242
        actions_to_run = "";
 
243
 
 
244
 
 
245
    /* *********
 
246
       GUI stuff
 
247
       ********* */
 
248
 
 
249
        fullscreen = false;
 
250
        start_in_fullscreen = false;
 
251
        compact_mode = false;
 
252
        stay_on_top = NeverOnTop;
 
253
        size_factor = 100; // 100%
 
254
 
 
255
        resize_method = Always;
 
256
 
 
257
#if STYLE_SWITCHING
 
258
        style="";
 
259
#endif
 
260
 
 
261
        show_frame_counter = FALSE;
 
262
        show_motion_vectors = false;
 
263
 
 
264
#if DVDNAV_SUPPORT
 
265
        mouse_left_click_function = "dvdnav_mouse";
 
266
#else
 
267
        mouse_left_click_function = "";
 
268
#endif
 
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;
 
275
 
 
276
        seeking1 = 10;
 
277
        seeking2 = 60;
 
278
        seeking3 = 10*60;
 
279
        seeking4 = 30;
 
280
 
 
281
        update_while_seeking = false;
 
282
#if ENABLE_DELAYED_DRAGGING
 
283
        time_slider_drag_delay = 100;
 
284
#endif
 
285
 
 
286
        language = "";
 
287
        iconset = "";
 
288
 
 
289
        balloon_count = 5;
 
290
 
 
291
#ifdef Q_OS_WIN
 
292
        restore_pos_after_fullscreen = true;
 
293
#else
 
294
        restore_pos_after_fullscreen = false;
 
295
#endif
 
296
 
 
297
        save_window_size_on_exit = true;
 
298
 
 
299
        close_on_finish = false;
 
300
 
 
301
        default_font = "";
 
302
 
 
303
        pause_when_hidden = false;
 
304
 
 
305
        allow_video_movement = false;
 
306
 
 
307
        gui = "DefaultGui";
 
308
 
 
309
#if USE_MINIMUMSIZE
 
310
        gui_minimum_width = 0; // 0 == disabled
 
311
#endif
 
312
        default_size = QSize(580, 440);
 
313
 
 
314
#if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
 
315
        hide_video_window_on_audio_files = true;
 
316
#endif
 
317
 
 
318
        report_mplayer_crashes = true;
 
319
 
 
320
#if REPORT_OLD_MPLAYER
 
321
        reported_mplayer_is_old = false;
 
322
#endif
 
323
 
 
324
        auto_add_to_playlist = true;
 
325
        add_to_playlist_consecutive_files = false;
 
326
 
 
327
 
 
328
    /* ***********
 
329
       Directories
 
330
       *********** */
 
331
 
 
332
        latest_dir = QDir::homePath();
 
333
        last_dvd_directory="";
 
334
 
 
335
 
 
336
    /* **************
 
337
       Initial values
 
338
       ************** */
 
339
 
 
340
        initial_sub_scale = 5;
 
341
        initial_sub_scale_ass = 1;
 
342
        initial_volume = 40;
 
343
        initial_contrast = 0;
 
344
        initial_brightness = 0;
 
345
        initial_hue = 0;
 
346
        initial_saturation = 0;
 
347
        initial_gamma = 0;
 
348
 
 
349
        initial_audio_equalizer << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
 
350
 
 
351
        initial_panscan_factor = 1.0;
 
352
        initial_sub_pos = 100; // 100%
 
353
 
 
354
        initial_postprocessing = false;
 
355
        initial_volnorm = false;
 
356
 
 
357
        initial_deinterlace = MediaSettings::NoDeinterlace;
 
358
 
 
359
        initial_audio_channels = MediaSettings::ChDefault;
 
360
        initial_stereo_mode = MediaSettings::Stereo;
 
361
 
 
362
        initial_audio_track = 1;
 
363
        initial_subtitle_track = 1;
 
364
 
 
365
 
 
366
    /* ************
 
367
       MPlayer info
 
368
       ************ */
 
369
 
 
370
        mplayer_detected_version = -1; //None version parsed yet
 
371
        mplayer_user_supplied_version = -1;
 
372
 
 
373
 
 
374
    /* *********
 
375
       Instances
 
376
       ********* */
 
377
 
 
378
#ifdef Q_OS_WIN
 
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; 
 
382
#else
 
383
        use_single_instance = true;
 
384
#endif
 
385
        use_autoport = true;
 
386
        connection_port = 8000;
 
387
        autoport = 0;
 
388
 
 
389
 
 
390
    /* ****************
 
391
       Floating control
 
392
       **************** */
 
393
 
 
394
        floating_control_margin = 0;
 
395
        floating_control_width = 100; //100 %
 
396
        floating_control_animated = true;
 
397
        floating_display_in_compact_mode = false;
 
398
#ifndef Q_OS_WIN
 
399
        bypass_window_manager = true;
 
400
#endif
 
401
 
 
402
 
 
403
    /* *******
 
404
       History
 
405
       ******* */
 
406
 
 
407
        history_recents->clear();
 
408
        history_urls->clear();
 
409
}
 
410
 
 
411
#ifndef NO_USE_INI_FILES
 
412
void Preferences::save() {
 
413
        qDebug("Preferences::save");
 
414
 
 
415
        QSettings * set = settings;
 
416
 
 
417
 
 
418
    /* *******
 
419
       General
 
420
       ******* */
 
421
 
 
422
        set->beginGroup( "general");
 
423
 
 
424
        set->setValue("mplayer_bin", mplayer_bin);
 
425
        set->setValue("driver/vo", vo);
 
426
        set->setValue("driver/ao", ao);
 
427
 
 
428
        set->setValue("screenshot_directory", screenshot_directory);
 
429
 
 
430
        set->setValue("dont_remember_media_settings", dont_remember_media_settings);
 
431
        set->setValue("dont_remember_time_pos", dont_remember_time_pos);
 
432
 
 
433
        set->setValue("audio_lang", audio_lang);
 
434
        set->setValue("subtitle_lang", subtitle_lang);
 
435
 
 
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);
 
443
 
 
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);
 
451
 
 
452
        set->setValue("loop", loop);
 
453
        set->setValue("osd", osd);
 
454
 
 
455
        set->setValue("file_settings_method", file_settings_method);
 
456
 
 
457
        set->endGroup(); // general
 
458
 
 
459
 
 
460
    /* ***************
 
461
       Drives (CD/DVD)
 
462
       *************** */
 
463
 
 
464
        set->beginGroup( "drives");
 
465
 
 
466
        set->setValue("dvd_device", dvd_device);
 
467
        set->setValue("cdrom_device", cdrom_device);
 
468
 
 
469
#ifdef Q_OS_WIN
 
470
        set->setValue("enable_audiocd_on_windows", enable_audiocd_on_windows);
 
471
#endif
 
472
 
 
473
        set->setValue("vcd_initial_title", vcd_initial_title);
 
474
 
 
475
#if DVDNAV_SUPPORT
 
476
        set->setValue("use_dvdnav", use_dvdnav);
 
477
#endif
 
478
 
 
479
        set->endGroup(); // drives
 
480
 
 
481
 
 
482
    /* ***********
 
483
       Performance
 
484
       *********** */
 
485
 
 
486
        set->beginGroup( "performance");
 
487
 
 
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);
 
493
 
 
494
        set->setValue("h264_skip_loop_filter", h264_skip_loop_filter);
 
495
        set->setValue("HD_height", HD_height);
 
496
 
 
497
        set->setValue("fast_audio_change", fast_audio_change);
 
498
#if !SMART_DVD_CHAPTERS
 
499
        set->setValue("fast_chapter_change", fast_chapter_change);
 
500
#endif
 
501
 
 
502
        set->setValue("threads", threads);
 
503
 
 
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);
 
509
 
 
510
        set->endGroup(); // performance
 
511
 
 
512
 
 
513
    /* *********
 
514
       Subtitles
 
515
       ********* */
 
516
 
 
517
        set->beginGroup("subtitles");
 
518
 
 
519
        set->setValue("font_file", font_file);
 
520
        set->setValue("font_name", font_name);
 
521
 
 
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);
 
529
 
 
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);
 
534
 
 
535
        set->setValue("subtitles_on_screenshots", subtitles_on_screenshots);
 
536
 
 
537
        set->setValue("use_new_sub_commands", use_new_sub_commands);
 
538
        set->setValue("change_sub_scale_should_restart", change_sub_scale_should_restart);
 
539
 
 
540
        // ASS styles
 
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);
 
544
 
 
545
        set->setValue("freetype_support", freetype_support);
 
546
 
 
547
        set->endGroup(); // subtitles
 
548
 
 
549
 
 
550
    /* ********
 
551
       Advanced
 
552
       ******** */
 
553
 
 
554
        set->beginGroup( "advanced");
 
555
 
 
556
#if USE_ADAPTER
 
557
        set->setValue("adapter", adapter);
 
558
#endif
 
559
 
 
560
#if USE_COLORKEY
 
561
        set->setValue("color_key", QString::number(color_key,16));
 
562
#endif
 
563
 
 
564
        set->setValue("use_mplayer_window", use_mplayer_window);
 
565
 
 
566
        set->setValue("monitor_aspect", monitor_aspect);
 
567
 
 
568
        set->setValue("use_idx", use_idx);
 
569
 
 
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);
 
573
 
 
574
        set->setValue("log_mplayer", log_mplayer);
 
575
        set->setValue("log_smplayer", log_smplayer);
 
576
        set->setValue("log_filter", log_filter);
 
577
 
 
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
 
582
 
 
583
#if REPAINT_BACKGROUND_OPTION
 
584
        set->setValue("repaint_video_background", repaint_video_background);
 
585
#endif
 
586
 
 
587
        set->setValue("use_edl_files", use_edl_files);
 
588
 
 
589
        set->setValue("prefer_ipv4", prefer_ipv4);
 
590
 
 
591
        set->setValue("use_short_pathnames", use_short_pathnames);
 
592
 
 
593
        set->setValue("change_video_equalizer_on_startup", change_video_equalizer_on_startup);
 
594
 
 
595
        set->setValue("use_pausing_keep_force", use_pausing_keep_force);
 
596
 
 
597
        set->setValue("correct_pts", use_correct_pts);
 
598
 
 
599
        set->setValue("actions_to_run", actions_to_run);
 
600
 
 
601
        set->endGroup(); // advanced
 
602
 
 
603
 
 
604
    /* *********
 
605
       GUI stuff
 
606
       ********* */
 
607
 
 
608
        set->beginGroup("gui");
 
609
 
 
610
        set->setValue("fullscreen", fullscreen);
 
611
        set->setValue("start_in_fullscreen", start_in_fullscreen);
 
612
 
 
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);
 
617
 
 
618
#if STYLE_SWITCHING
 
619
        set->setValue("style", style);
 
620
#endif
 
621
 
 
622
        set->setValue("show_frame_counter", show_frame_counter);
 
623
        set->setValue("show_motion_vectors", show_motion_vectors);
 
624
 
 
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);
 
632
 
 
633
        set->setValue("seeking1", seeking1);
 
634
        set->setValue("seeking2", seeking2);
 
635
        set->setValue("seeking3", seeking3);
 
636
        set->setValue("seeking4", seeking4);
 
637
 
 
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);
 
641
#endif
 
642
 
 
643
        set->setValue("language", language);
 
644
        set->setValue("iconset", iconset);
 
645
 
 
646
        set->setValue("balloon_count", balloon_count);
 
647
 
 
648
        set->setValue("restore_pos_after_fullscreen", restore_pos_after_fullscreen);
 
649
        set->setValue("save_window_size_on_exit", save_window_size_on_exit);
 
650
 
 
651
        set->setValue("close_on_finish", close_on_finish);
 
652
 
 
653
        set->setValue("default_font", default_font);
 
654
 
 
655
        set->setValue("pause_when_hidden", pause_when_hidden);
 
656
 
 
657
        set->setValue("allow_video_movement", allow_video_movement);
 
658
 
 
659
        set->setValue("gui", gui);
 
660
 
 
661
#if USE_MINIMUMSIZE
 
662
        set->setValue("gui_minimum_width", gui_minimum_width);
 
663
#endif
 
664
        set->setValue("default_size", default_size);
 
665
 
 
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);
 
668
#endif
 
669
 
 
670
        set->setValue("report_mplayer_crashes", report_mplayer_crashes);
 
671
 
 
672
#if REPORT_OLD_MPLAYER
 
673
        set->setValue("reported_mplayer_is_old", reported_mplayer_is_old);
 
674
#endif
 
675
 
 
676
    set->setValue("auto_add_to_playlist", auto_add_to_playlist);
 
677
    set->setValue("add_to_playlist_consecutive_files", add_to_playlist_consecutive_files);
 
678
 
 
679
        set->endGroup(); // gui
 
680
 
 
681
 
 
682
    /* ***********
 
683
       Directories
 
684
       *********** */
 
685
 
 
686
        set->beginGroup( "directories");
 
687
        set->setValue("latest_dir", latest_dir);
 
688
        set->setValue("last_dvd_directory", last_dvd_directory);
 
689
        set->endGroup(); // directories
 
690
 
 
691
 
 
692
    /* **************
 
693
       Initial values
 
694
       ************** */
 
695
 
 
696
        set->beginGroup( "defaults");
 
697
 
 
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);
 
706
 
 
707
        set->setValue("initial_audio_equalizer", initial_audio_equalizer);
 
708
 
 
709
        set->setValue("initial_panscan_factor", initial_panscan_factor);
 
710
        set->setValue("initial_sub_pos", initial_sub_pos);
 
711
 
 
712
        set->setValue("initial_volnorm", initial_volnorm);
 
713
        set->setValue("initial_postprocessing", initial_postprocessing);
 
714
 
 
715
        set->setValue("initial_deinterlace", initial_deinterlace);
 
716
 
 
717
        set->setValue("initial_audio_channels", initial_audio_channels);
 
718
        set->setValue("initial_stereo_mode", initial_stereo_mode);
 
719
 
 
720
        set->setValue("initial_audio_track", initial_audio_track);
 
721
        set->setValue("initial_subtitle_track", initial_subtitle_track);
 
722
 
 
723
        set->endGroup(); // defaults
 
724
 
 
725
 
 
726
    /* ************
 
727
       MPlayer info
 
728
       ************ */
 
729
 
 
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
 
734
 
 
735
 
 
736
    /* *********
 
737
       Instances
 
738
       ********* */
 
739
 
 
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
 
746
 
 
747
 
 
748
    /* ****************
 
749
       Floating control
 
750
       **************** */
 
751
 
 
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);
 
757
#ifndef Q_OS_WIN
 
758
        set->setValue("bypass_window_manager", bypass_window_manager);
 
759
#endif
 
760
        set->endGroup(); // floating_control
 
761
 
 
762
 
 
763
    /* *******
 
764
       History
 
765
       ******* */
 
766
 
 
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
 
773
 
 
774
        set->sync();
 
775
}
 
776
 
 
777
void Preferences::load() {
 
778
        qDebug("Preferences::load");
 
779
 
 
780
        QSettings * set = settings;
 
781
 
 
782
 
 
783
    /* *******
 
784
       General
 
785
       ******* */
 
786
 
 
787
        set->beginGroup( "general");
 
788
 
 
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();
 
792
 
 
793
        screenshot_directory = set->value("screenshot_directory", screenshot_directory).toString();
 
794
 
 
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();
 
797
 
 
798
        audio_lang = set->value("audio_lang", audio_lang).toString();
 
799
        subtitle_lang = set->value("subtitle_lang", subtitle_lang).toString();
 
800
 
 
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();
 
808
 
 
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();
 
816
 
 
817
        loop = set->value("loop", loop).toBool();
 
818
        osd = set->value("osd", osd).toInt();
 
819
 
 
820
        file_settings_method = set->value("file_settings_method", file_settings_method).toString();
 
821
 
 
822
        set->endGroup(); // general
 
823
 
 
824
 
 
825
    /* ***************
 
826
       Drives (CD/DVD)
 
827
       *************** */
 
828
 
 
829
        set->beginGroup( "drives");
 
830
 
 
831
        dvd_device = set->value("dvd_device", dvd_device).toString();
 
832
        cdrom_device = set->value("cdrom_device", cdrom_device).toString();
 
833
 
 
834
#ifdef Q_OS_WIN
 
835
        enable_audiocd_on_windows = set->value("enable_audiocd_on_windows", enable_audiocd_on_windows).toBool();
 
836
#endif
 
837
 
 
838
        vcd_initial_title = set->value("vcd_initial_title", vcd_initial_title ).toInt();
 
839
 
 
840
#if DVDNAV_SUPPORT
 
841
        use_dvdnav = set->value("use_dvdnav", use_dvdnav).toBool();
 
842
#endif
 
843
 
 
844
        set->endGroup(); // drives
 
845
 
 
846
 
 
847
    /* ***********
 
848
       Performance
 
849
       *********** */
 
850
 
 
851
        set->beginGroup( "performance");
 
852
 
 
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();
 
858
 
 
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();
 
861
 
 
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();
 
865
#endif
 
866
 
 
867
        threads = set->value("threads", threads).toInt();
 
868
 
 
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();
 
874
 
 
875
        set->endGroup(); // performance
 
876
 
 
877
 
 
878
    /* *********
 
879
       Subtitles
 
880
       ********* */
 
881
 
 
882
        set->beginGroup("subtitles");
 
883
 
 
884
        font_file = set->value("font_file", font_file).toString();
 
885
        font_name = set->value("font_name", font_name).toString();
 
886
 
 
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();
 
894
 
 
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();
 
897
 
 
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();
 
900
 
 
901
        subtitles_on_screenshots = set->value("subtitles_on_screenshots", subtitles_on_screenshots).toBool();
 
902
 
 
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();
 
905
 
 
906
        // ASS styles
 
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();
 
910
 
 
911
        freetype_support = set->value("freetype_support", freetype_support).toBool();
 
912
 
 
913
        set->endGroup(); // subtitles
 
914
 
 
915
 
 
916
    /* ********
 
917
       Advanced
 
918
       ******** */
 
919
 
 
920
        set->beginGroup( "advanced");
 
921
 
 
922
#if USE_ADAPTER
 
923
        adapter = set->value("adapter", adapter).toInt();
 
924
#endif
 
925
 
 
926
#if USE_COLORKEY
 
927
        bool ok;
 
928
        QString color = set->value("color_key", QString::number(color_key,16)).toString();
 
929
        unsigned int temp_color_key = color.toUInt(&ok, 16);
 
930
        if (ok)
 
931
                color_key = temp_color_key;
 
932
        //color_key = set->value("color_key", color_key).toInt();
 
933
#endif
 
934
 
 
935
        use_mplayer_window = set->value("use_mplayer_window", use_mplayer_window).toBool();
 
936
 
 
937
        monitor_aspect = set->value("monitor_aspect", monitor_aspect).toString();
 
938
 
 
939
        use_idx = set->value("use_idx", use_idx).toBool();
 
940
 
 
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();
 
944
 
 
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();
 
948
 
 
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
 
953
 
 
954
#if REPAINT_BACKGROUND_OPTION
 
955
        repaint_video_background = set->value("repaint_video_background", repaint_video_background).toBool();
 
956
#endif
 
957
 
 
958
        use_edl_files = set->value("use_edl_files", use_edl_files).toBool();
 
959
 
 
960
        prefer_ipv4 = set->value("prefer_ipv4", prefer_ipv4).toBool();
 
961
 
 
962
        use_short_pathnames = set->value("use_short_pathnames", use_short_pathnames).toBool();
 
963
 
 
964
        use_pausing_keep_force = set->value("use_pausing_keep_force", use_pausing_keep_force).toBool();
 
965
 
 
966
        use_correct_pts = (OptionState) set->value("correct_pts", use_correct_pts).toInt();
 
967
 
 
968
        actions_to_run = set->value("actions_to_run", actions_to_run).toString();
 
969
 
 
970
        set->endGroup(); // advanced
 
971
 
 
972
 
 
973
    /* *********
 
974
       GUI stuff
 
975
       ********* */
 
976
 
 
977
        set->beginGroup("gui");
 
978
 
 
979
        fullscreen = set->value("fullscreen", fullscreen).toBool();
 
980
        start_in_fullscreen = set->value("start_in_fullscreen", start_in_fullscreen).toBool();
 
981
 
 
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();
 
986
 
 
987
#if STYLE_SWITCHING
 
988
        style = set->value("style", style).toString();
 
989
#endif
 
990
 
 
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();
 
993
 
 
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();
 
1001
 
 
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();
 
1006
 
 
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();
 
1010
#endif
 
1011
 
 
1012
        language = set->value("language", language).toString();
 
1013
        iconset= set->value("iconset", iconset).toString();
 
1014
 
 
1015
        balloon_count = set->value("balloon_count", balloon_count).toInt();
 
1016
 
 
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();
 
1019
 
 
1020
        close_on_finish = set->value("close_on_finish", close_on_finish).toBool();
 
1021
 
 
1022
        default_font = set->value("default_font", default_font).toString();
 
1023
 
 
1024
        pause_when_hidden = set->value("pause_when_hidden", pause_when_hidden).toBool();
 
1025
 
 
1026
        allow_video_movement = set->value("allow_video_movement", allow_video_movement).toBool();
 
1027
 
 
1028
        gui = set->value("gui", gui).toString();
 
1029
 
 
1030
#if USE_MINIMUMSIZE
 
1031
        gui_minimum_width = set->value("gui_minimum_width", gui_minimum_width).toInt();
 
1032
#endif
 
1033
        default_size = set->value("default_size", default_size).toSize();
 
1034
 
 
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();
 
1037
#endif
 
1038
 
 
1039
        report_mplayer_crashes = set->value("report_mplayer_crashes", report_mplayer_crashes).toBool();
 
1040
 
 
1041
#if REPORT_OLD_MPLAYER
 
1042
        reported_mplayer_is_old = set->value("reported_mplayer_is_old", reported_mplayer_is_old).toBool();
 
1043
#endif
 
1044
 
 
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();
 
1047
 
 
1048
        set->endGroup(); // gui
 
1049
 
 
1050
 
 
1051
    /* ***********
 
1052
       Directories
 
1053
       *********** */
 
1054
 
 
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
 
1059
 
 
1060
 
 
1061
    /* **************
 
1062
       Initial values
 
1063
       ************** */
 
1064
 
 
1065
        set->beginGroup( "defaults");
 
1066
 
 
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();
 
1075
 
 
1076
        initial_audio_equalizer = set->value("initial_audio_equalizer", initial_audio_equalizer).toList();
 
1077
 
 
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();
 
1080
 
 
1081
        initial_volnorm = set->value("initial_volnorm", initial_volnorm).toBool();
 
1082
        initial_postprocessing = set->value("initial_postprocessing", initial_postprocessing).toBool();
 
1083
 
 
1084
        initial_deinterlace = set->value("initial_deinterlace", initial_deinterlace).toInt();
 
1085
 
 
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();
 
1088
 
 
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();
 
1091
 
 
1092
        set->endGroup(); // defaults
 
1093
 
 
1094
 
 
1095
    /* ************
 
1096
       MPlayer info
 
1097
       ************ */
 
1098
 
 
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
 
1103
 
 
1104
 
 
1105
    /* *********
 
1106
       Instances
 
1107
       ********* */
 
1108
 
 
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
 
1115
 
 
1116
 
 
1117
    /* ****************
 
1118
       Floating control
 
1119
       **************** */
 
1120
 
 
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();
 
1126
#ifndef Q_OS_WIN
 
1127
        bypass_window_manager = set->value("bypass_window_manager", bypass_window_manager).toBool();
 
1128
#endif
 
1129
        set->endGroup(); // floating_control
 
1130
 
 
1131
 
 
1132
    /* *******
 
1133
       History
 
1134
       ******* */
 
1135
 
 
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
 
1142
}
 
1143
 
 
1144
#endif // NO_USE_INI_FILES
 
1145
 
 
1146
double Preferences::monitor_aspect_double() {
 
1147
        qDebug("Preferences::monitor_aspect_double");
 
1148
 
 
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;
 
1155
        }
 
1156
 
 
1157
        bool ok;
 
1158
        double res = monitor_aspect.toDouble(&ok);
 
1159
        if (ok) {
 
1160
                qDebug(" monitor_aspect parsed successfully: %f", res);
 
1161
                return res;
 
1162
        } else {
 
1163
                qDebug(" warning: monitor_aspect couldn't be parsed!");
 
1164
        qDebug(" monitor_aspect set to 0");
 
1165
                return 0;
 
1166
        }
 
1167
}