~ubuntu-branches/debian/experimental/smplayer/experimental

« back to all changes in this revision

Viewing changes to src/preferences.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Maia Kozheva
  • Date: 2009-01-03 17:08:06 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090103170806-eodntb2slv6g2pb6
Tags: 0.6.6-0ubuntu1
* The "just before FF" release.
* New upstream release.
* debian/control: Bumped Standards-Version to 3.8.0.
* debian/copyright: Changed (C) to © to fix Lintian warning.

Show diffs side-by-side

added added

removed removed

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