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

« back to all changes in this revision

Viewing changes to src/corelib/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 "helper.h"
22
 
#include "mediasettings.h"
23
 
 
24
 
#include <QSettings>
25
 
#include <QFileInfo>
26
 
#include <QRegExp>
27
 
#include <QDir>
28
 
 
29
 
using namespace Global;
30
 
 
31
 
Preferences::Preferences() {
32
 
        reset();
33
 
 
34
 
#ifndef NO_USE_INI_FILES
35
 
        load();
36
 
#endif
37
 
}
38
 
 
39
 
Preferences::~Preferences() {
40
 
#ifndef NO_USE_INI_FILES
41
 
        save();
42
 
#endif
43
 
}
44
 
 
45
 
void Preferences::reset() {
46
 
#ifdef Q_OS_WIN
47
 
        mplayer_bin= "mplayer/mplayer.exe";
48
 
#else
49
 
        mplayer_bin = "mplayer";
50
 
#endif
51
 
 
52
 
        /*
53
 
        QFileInfo fi(mplayer_bin);
54
 
        if (fi.exists()) {
55
 
                mplayer_bin = fi.absFilePath();
56
 
                qDebug("mplayer_bin: '%s'", mplayer_bin.toUtf8().data());
57
 
        }
58
 
        */
59
 
 
60
 
        use_fontconfig = FALSE;
61
 
        use_ass_subtitles = FALSE;
62
 
        font_file = "";
63
 
        font_name = "";
64
 
        subcp = "ISO-8859-1";
65
 
        font_autoscale = 1;
66
 
        autoload_sub = true;
67
 
        subfuzziness = 1;
68
 
        ass_color = 0xFFFF00;
69
 
    ass_border_color = 0x000000;
70
 
        //ass_styles = "Bold=1,Outline=2,Shadow=2";
71
 
        ass_styles = "";
72
 
        change_sub_scale_should_restart = Detect;
73
 
        use_new_sub_commands = Detect;
74
 
 
75
 
        use_closed_caption_subs = false;
76
 
        use_forced_subs_only = false;
77
 
 
78
 
        osd = None;
79
 
 
80
 
        vo = ""; 
81
 
        ao = "";
82
 
 
83
 
#if USE_COLORKEY
84
 
        color_key = 0x020202;
85
 
#endif
86
 
 
87
 
        dvd_device = "";
88
 
        cdrom_device = "";
89
 
 
90
 
        // MPlayer 1.0rc1 require restart, new versions don't
91
 
        fast_audio_change = Detect;
92
 
#if !SMART_DVD_CHAPTERS
93
 
        fast_chapter_change = false;
94
 
#endif
95
 
 
96
 
        cache_for_files = 0;
97
 
        cache_for_streams = 1000;
98
 
        cache_for_dvds = 0; // not recommended to use cache for dvds
99
 
        cache_for_vcds = 0;
100
 
        cache_for_audiocds = 0;
101
 
 
102
 
 
103
 
        use_mplayer_window = FALSE;
104
 
 
105
 
        monitor_aspect=""; // Autodetect
106
 
        
107
 
        latest_dir = QDir::homePath();
108
 
        last_url="";
109
 
        last_dvd_directory="";
110
 
 
111
 
        mplayer_verbose="";
112
 
 
113
 
        resize_method = Always;
114
 
        disable_screensaver = true;
115
 
 
116
 
        use_direct_rendering = false;
117
 
        use_double_buffer = true;
118
 
 
119
 
        screenshot_directory="";
120
 
        if (QFile::exists(Helper::appHomePath() + "/screenshots")) {
121
 
                screenshot_directory = Helper::appHomePath() + "/screenshots";
122
 
        }
123
 
        subtitles_on_screenshots = false;
124
 
 
125
 
        use_soft_video_eq = FALSE;
126
 
        use_soft_vol = FALSE;
127
 
    softvol_max = 110; // 110 = default value in mplayer
128
 
        use_scaletempo = Detect;
129
 
 
130
 
        audio_lang = "";
131
 
        subtitle_lang = "";
132
 
 
133
 
        use_idx = false;
134
 
 
135
 
        dont_change_volume = false;
136
 
 
137
 
        use_hwac3 = false;
138
 
 
139
 
        mplayer_additional_options="";
140
 
    mplayer_additional_video_filters="";
141
 
    mplayer_additional_audio_filters="";
142
 
 
143
 
        priority = AboveNormal; // Option only for windows
144
 
        frame_drop = true;
145
 
        hard_frame_drop = false;
146
 
        autosync = false;
147
 
        autosync_factor = 100;
148
 
 
149
 
        h264_skip_loop_filter = LoopEnabled;
150
 
        HD_height = 720;
151
 
 
152
 
        dont_remember_media_settings = FALSE;
153
 
        dont_remember_time_pos = FALSE;
154
 
 
155
 
#if STYLE_SWITCHING
156
 
        style="";
157
 
#endif
158
 
 
159
 
        fullscreen = FALSE;
160
 
        start_in_fullscreen = FALSE;
161
 
 
162
 
        compact_mode = FALSE;
163
 
        stay_on_top = FALSE;
164
 
        size_factor = 100; // 100%
165
 
 
166
 
        show_frame_counter = FALSE;
167
 
        show_motion_vectors = false;
168
 
 
169
 
        autoq = 6;
170
 
 
171
 
        loop = FALSE;
172
 
 
173
 
        use_single_instance = FALSE;
174
 
        connection_port = 8000;
175
 
 
176
 
        mouse_left_click_function = "";
177
 
        mouse_right_click_function = "show_context_menu";
178
 
        mouse_double_click_function = "fullscreen";
179
 
        mouse_middle_click_function = "mute";
180
 
        mouse_xbutton1_click_function = "";
181
 
        mouse_xbutton2_click_function = "";
182
 
        wheel_function = Seeking;
183
 
 
184
 
        recents_max_items = 10;
185
 
 
186
 
        seeking1 = 10;
187
 
        seeking2 = 60;
188
 
        seeking3 = 10*60;
189
 
        seeking4 = 30;
190
 
 
191
 
        update_while_seeking = false;
192
 
#if ENABLE_DELAYED_DRAGGING
193
 
        time_slider_drag_delay = 100;
194
 
#endif
195
 
 
196
 
        log_mplayer = TRUE;
197
 
        log_smplayer = TRUE;
198
 
        log_filter = ".*";
199
 
 
200
 
        language = "";
201
 
        iconset = "";
202
 
 
203
 
        // "Don't repaint video background" in the preferences dialog
204
 
#ifdef Q_OS_WIN
205
 
        always_clear_video_background = true;
206
 
#else
207
 
        always_clear_video_background = false;
208
 
#endif
209
 
 
210
 
        rx_endoffile = "Exiting... \\(End of file\\)";
211
 
        rx_novideo = "Video: no video";
212
 
 
213
 
        balloon_count = 5;
214
 
 
215
 
        dont_use_eq_options = false;
216
 
 
217
 
#ifdef Q_OS_WIN
218
 
        restore_pos_after_fullscreen = true;
219
 
#else
220
 
        restore_pos_after_fullscreen = false;
221
 
#endif
222
 
 
223
 
        save_window_size_on_exit = true;
224
 
 
225
 
#ifdef Q_OS_WIN
226
 
        //enable_vcd_on_windows = false;
227
 
        enable_audiocd_on_windows = false;
228
 
#endif
229
 
 
230
 
        close_on_finish = false;
231
 
 
232
 
        default_font = "";
233
 
 
234
 
        pause_when_hidden = false;
235
 
 
236
 
        allow_video_movement = false;
237
 
 
238
 
        use_edl_files = true;
239
 
 
240
 
        gui = "DefaultGui";
241
 
 
242
 
        vcd_initial_title = 2; // Most VCD's start at title #2
243
 
 
244
 
        initial_sub_scale = 5;
245
 
#if SCALE_ASS_SUBS
246
 
        initial_sub_scale_ass = 1;
247
 
#endif
248
 
        initial_volume = 40;
249
 
        initial_contrast = 0;
250
 
        initial_brightness = 0;
251
 
        initial_hue = 0;
252
 
        initial_saturation = 0;
253
 
        initial_gamma = 0;
254
 
 
255
 
        initial_panscan_factor = 1.0;
256
 
        initial_sub_pos = 100; // 100%
257
 
 
258
 
        initial_postprocessing = false;
259
 
        initial_volnorm = false;
260
 
 
261
 
        initial_deinterlace = MediaSettings::NoDeinterlace;
262
 
 
263
 
        initial_audio_channels = MediaSettings::ChDefault;
264
 
 
265
 
        initial_audio_track = 1;
266
 
        initial_subtitle_track = 1;
267
 
 
268
 
    //mplayer log autosaving
269
 
    autosave_mplayer_log = false;
270
 
    mplayer_log_saveto = "";
271
 
    //mplayer log autosaving end
272
 
 
273
 
        auto_add_to_playlist = true;
274
 
        use_volume_option2 = Detect; 
275
 
 
276
 
        use_short_pathnames = false;
277
 
 
278
 
        mplayer_detected_version = -1; //None version parsed yet
279
 
        mplayer_user_supplied_version = -1;
280
 
        mplayer_has_volume_option = false;
281
 
}
282
 
 
283
 
#ifndef NO_USE_INI_FILES
284
 
void Preferences::save() {
285
 
        qDebug("Preferences::save");
286
 
 
287
 
        QSettings * set = settings;
288
 
 
289
 
        set->beginGroup( "preferences");
290
 
 
291
 
        set->setValue("mplayer_bin", mplayer_bin);
292
 
        set->setValue("use_fontconfig", use_fontconfig);
293
 
        set->setValue("font_file", font_file);
294
 
        set->setValue("font_name", font_name);
295
 
        set->setValue("font_autoscale", font_autoscale);
296
 
        set->setValue("subcp", subcp);
297
 
        set->setValue("use_ass_subtitles", use_ass_subtitles);
298
 
        set->setValue("autoload_sub", autoload_sub);
299
 
        set->setValue("subfuzziness", subfuzziness);
300
 
        set->setValue("ass_color", (int) ass_color);
301
 
        set->setValue("ass_border_color", (int) ass_border_color);
302
 
        set->setValue("ass_styles", ass_styles);
303
 
        set->setValue("change_sub_scale_should_restart", change_sub_scale_should_restart);
304
 
        set->setValue("use_new_sub_commands", use_new_sub_commands);
305
 
        set->setValue("use_closed_caption_subs", use_closed_caption_subs);
306
 
        set->setValue("use_forced_subs_only", use_forced_subs_only);
307
 
 
308
 
        set->setValue("osd", osd);
309
 
        set->setValue("vo", vo);
310
 
        set->setValue("ao", ao);
311
 
 
312
 
#if USE_COLORKEY
313
 
        set->setValue("color_key", QString::number(color_key,16));
314
 
#endif
315
 
 
316
 
        set->setValue("fast_audio_change", fast_audio_change);
317
 
#if !SMART_DVD_CHAPTERS
318
 
        set->setValue("fast_chapter_change", fast_chapter_change);
319
 
#endif
320
 
 
321
 
        set->setValue("dvd_device", dvd_device);
322
 
        set->setValue("cdrom_device", cdrom_device);
323
 
 
324
 
        set->setValue("cache_for_files", cache_for_files);
325
 
        set->setValue("cache_for_streams", cache_for_streams);
326
 
        set->setValue("cache_for_dvds", cache_for_dvds);
327
 
        set->setValue("cache_for_vcds", cache_for_vcds);
328
 
        set->setValue("cache_for_audiocds", cache_for_audiocds);
329
 
 
330
 
 
331
 
        set->setValue("use_mplayer_window", use_mplayer_window);
332
 
 
333
 
        set->setValue("monitor_aspect", monitor_aspect);
334
 
 
335
 
        set->setValue("latest_dir", latest_dir);
336
 
        set->setValue("last_url", last_url);
337
 
        set->setValue("last_dvd_directory", last_dvd_directory);
338
 
 
339
 
        set->setValue("mplayer_verbose", mplayer_verbose);
340
 
        set->setValue("resize_method", resize_method);
341
 
        set->setValue("disable_screensaver", disable_screensaver);
342
 
 
343
 
        set->setValue("use_direct_rendering", use_direct_rendering);
344
 
        set->setValue("use_double_buffer", use_double_buffer);
345
 
 
346
 
        set->setValue("screenshot_directory", screenshot_directory);
347
 
        set->setValue("subtitles_on_screenshots", subtitles_on_screenshots);
348
 
 
349
 
        set->setValue("use_soft_video_eq", use_soft_video_eq);
350
 
        set->setValue("use_soft_vol", use_soft_vol);
351
 
        set->setValue("softvol_max", softvol_max);
352
 
        set->setValue("use_scaletempo", use_scaletempo);
353
 
 
354
 
        set->setValue("audio_lang", audio_lang);
355
 
        set->setValue("subtitle_lang", subtitle_lang);
356
 
 
357
 
        set->setValue("use_idx", use_idx);
358
 
 
359
 
        set->setValue("dont_change_volume", dont_change_volume );
360
 
 
361
 
        set->setValue("use_hwac3", use_hwac3 );
362
 
 
363
 
        set->setValue("vcd_initial_title", vcd_initial_title);
364
 
 
365
 
 
366
 
        set->setValue("mplayer_additional_options", mplayer_additional_options);
367
 
        set->setValue("mplayer_additional_video_filters", mplayer_additional_video_filters);
368
 
        set->setValue("mplayer_additional_audio_filters", mplayer_additional_audio_filters);
369
 
 
370
 
        set->setValue("priority", priority);
371
 
        set->setValue("frame_drop", frame_drop);
372
 
        set->setValue("hard_frame_drop", hard_frame_drop);
373
 
        set->setValue("autosync", autosync);
374
 
        set->setValue("autosync_factor", autosync_factor);
375
 
 
376
 
        set->setValue("h264_skip_loop_filter", h264_skip_loop_filter);
377
 
        set->setValue("HD_height", HD_height);
378
 
 
379
 
        set->setValue("dont_remember_media_settings", dont_remember_media_settings);
380
 
        set->setValue("dont_remember_time_pos", dont_remember_time_pos);
381
 
 
382
 
#if STYLE_SWITCHING
383
 
        set->setValue("style", style);
384
 
#endif
385
 
 
386
 
        set->setValue("fullscreen", fullscreen);
387
 
        set->setValue("start_in_fullscreen", start_in_fullscreen);
388
 
 
389
 
        set->setValue("compact_mode", compact_mode);
390
 
        set->setValue("stay_on_top", stay_on_top);
391
 
        set->setValue("size_factor", size_factor);
392
 
 
393
 
        set->setValue("show_frame_counter", show_frame_counter);
394
 
        set->setValue("show_motion_vectors", show_motion_vectors);
395
 
 
396
 
        set->setValue("autoq", autoq);
397
 
 
398
 
        set->setValue("loop", loop);
399
 
 
400
 
        set->setValue("use_single_instance", use_single_instance);
401
 
        set->setValue("connection_port", connection_port);
402
 
 
403
 
        set->setValue("mouse_left_click_function", mouse_left_click_function);
404
 
        set->setValue("mouse_right_click_function", mouse_right_click_function);
405
 
        set->setValue("mouse_double_click_function", mouse_double_click_function);
406
 
        set->setValue("mouse_middle_click_function", mouse_middle_click_function);
407
 
        set->setValue("mouse_xbutton1_click_function", mouse_xbutton1_click_function);
408
 
        set->setValue("mouse_xbutton2_click_function", mouse_xbutton2_click_function);
409
 
        set->setValue("wheel_function", wheel_function);
410
 
 
411
 
        set->setValue("recents_max_items", recents_max_items);
412
 
 
413
 
        set->setValue("seeking1", seeking1);
414
 
        set->setValue("seeking2", seeking2);
415
 
        set->setValue("seeking3", seeking3);
416
 
        set->setValue("seeking4", seeking4);
417
 
 
418
 
        set->setValue("update_while_seeking", update_while_seeking);
419
 
#if ENABLE_DELAYED_DRAGGING
420
 
        set->setValue("time_slider_drag_delay", time_slider_drag_delay);
421
 
#endif
422
 
 
423
 
        set->setValue("log_mplayer", log_mplayer);
424
 
        set->setValue("log_smplayer", log_smplayer);
425
 
        set->setValue("log_filter", log_filter);
426
 
 
427
 
        set->setValue("language", language);
428
 
        set->setValue("iconset", iconset);
429
 
 
430
 
        set->setValue("always_clear_video_background", always_clear_video_background);
431
 
 
432
 
        set->setValue("rx_endoffile", rx_endoffile);
433
 
        set->setValue("rx_novideo", rx_novideo);
434
 
 
435
 
        set->setValue("balloon_count", balloon_count);
436
 
 
437
 
        set->setValue("dont_use_eq_options", dont_use_eq_options);
438
 
 
439
 
        set->setValue("restore_pos_after_fullscreen", restore_pos_after_fullscreen);
440
 
        set->setValue("save_window_size_on_exit", save_window_size_on_exit);
441
 
 
442
 
#ifdef Q_OS_WIN
443
 
        //set->setValue("enable_vcd_on_windows", enable_vcd_on_windows);
444
 
        set->setValue("enable_audiocd_on_windows", enable_audiocd_on_windows);
445
 
#endif
446
 
 
447
 
        set->setValue("close_on_finish", close_on_finish);
448
 
 
449
 
        set->setValue("default_font", default_font);
450
 
 
451
 
        set->setValue("pause_when_hidden", pause_when_hidden);
452
 
 
453
 
        set->setValue("allow_video_movement", allow_video_movement);
454
 
 
455
 
        set->setValue("use_edl_files", use_edl_files);
456
 
 
457
 
        set->setValue("gui", gui);
458
 
 
459
 
    //mplayer log autosaving
460
 
    set->setValue("autosave_mplayer_log", autosave_mplayer_log);
461
 
    set->setValue("mplayer_log_saveto", mplayer_log_saveto);
462
 
    //mplayer log autosaving end
463
 
 
464
 
    set->setValue("auto_add_to_playlist", auto_add_to_playlist);
465
 
        set->setValue("use_volume_option2", use_volume_option2);
466
 
 
467
 
        set->setValue("use_short_pathnames", use_short_pathnames);
468
 
 
469
 
        set->endGroup();
470
 
 
471
 
 
472
 
        set->beginGroup( "defaults");
473
 
 
474
 
        set->setValue("initial_sub_scale", initial_sub_scale);
475
 
#if SCALE_ASS_SUBS
476
 
        set->setValue("initial_sub_scale_ass", initial_sub_scale_ass);
477
 
#endif
478
 
        set->setValue("initial_volume", initial_volume);
479
 
        set->setValue("initial_contrast", initial_contrast);
480
 
        set->setValue("initial_brightness", initial_brightness);
481
 
        set->setValue("initial_hue", initial_hue);
482
 
        set->setValue("initial_saturation", initial_saturation);
483
 
        set->setValue("initial_gamma", initial_gamma);
484
 
 
485
 
        set->setValue("initial_panscan_factor", initial_panscan_factor);
486
 
        set->setValue("initial_sub_pos", initial_sub_pos);
487
 
 
488
 
        set->setValue("initial_volnorm", initial_volnorm);
489
 
        set->setValue("initial_postprocessing", initial_postprocessing);
490
 
 
491
 
        set->setValue("initial_deinterlace", initial_deinterlace);
492
 
 
493
 
        set->setValue("initial_audio_channels", initial_audio_channels);
494
 
 
495
 
        set->setValue("initial_audio_track", initial_audio_track);
496
 
        set->setValue("initial_subtitle_track", initial_subtitle_track);
497
 
 
498
 
        set->endGroup();
499
 
 
500
 
        set->beginGroup( "mplayer_info");
501
 
        set->setValue("mplayer_detected_version", mplayer_detected_version);
502
 
        set->setValue("mplayer_user_supplied_version", mplayer_user_supplied_version);
503
 
        set->setValue("mplayer_has_volume_option", mplayer_has_volume_option);
504
 
        set->endGroup();
505
 
}
506
 
 
507
 
void Preferences::load() {
508
 
        qDebug("Preferences::load");
509
 
 
510
 
        QSettings * set = settings;
511
 
 
512
 
        set->beginGroup( "preferences");
513
 
 
514
 
        mplayer_bin = set->value("mplayer_bin", mplayer_bin).toString();
515
 
 
516
 
        use_fontconfig = set->value("use_fontconfig", use_fontconfig).toBool();
517
 
        font_file = set->value("font_file", font_file).toString();
518
 
        font_name = set->value("font_name", font_name).toString();
519
 
        font_autoscale = set->value("font_autoscale", font_autoscale).toInt();
520
 
        subcp = set->value("subcp", subcp).toString();
521
 
        subfuzziness = set->value("subfuzziness", subfuzziness).toInt();
522
 
        use_ass_subtitles = set->value("use_ass_subtitles", use_ass_subtitles).toBool();
523
 
        autoload_sub = set->value("autoload_sub", autoload_sub).toBool();
524
 
        ass_color = set->value("ass_color", ass_color).toInt();
525
 
        ass_border_color = set->value("ass_border_color", ass_border_color).toInt();
526
 
        ass_styles = set->value("ass_styles", ass_styles).toString();
527
 
        change_sub_scale_should_restart = (OptionState) set->value("change_sub_scale_should_restart", change_sub_scale_should_restart).toInt();
528
 
        use_new_sub_commands = (OptionState) set->value("use_new_sub_commands", use_new_sub_commands).toInt();
529
 
        use_closed_caption_subs = set->value("use_closed_caption_subs", use_closed_caption_subs).toBool();
530
 
        use_forced_subs_only = set->value("use_forced_subs_only", use_forced_subs_only).toBool();
531
 
 
532
 
        osd = set->value("osd", osd).toInt();
533
 
        vo = set->value("vo", vo).toString();
534
 
        ao = set->value("ao", ao).toString();
535
 
 
536
 
#if USE_COLORKEY
537
 
        bool ok;
538
 
        QString color = set->value("color_key", QString::number(color_key,16)).toString();
539
 
        unsigned int temp_color_key = color.toUInt(&ok, 16);
540
 
        if (ok)
541
 
                color_key = temp_color_key;
542
 
        //color_key = set->value("color_key", color_key).toInt();
543
 
#endif
544
 
 
545
 
        fast_audio_change = (OptionState) set->value("fast_audio_change", fast_audio_change).toInt();
546
 
#if !SMART_DVD_CHAPTERS
547
 
        fast_chapter_change = set->value("fast_chapter_change", fast_chapter_change).toBool();
548
 
#endif
549
 
 
550
 
        dvd_device = set->value("dvd_device", dvd_device).toString();
551
 
        cdrom_device = set->value("cdrom_device", cdrom_device).toString();
552
 
 
553
 
        cache_for_files = set->value("cache_for_files", cache_for_files).toInt();
554
 
        cache_for_streams = set->value("cache_for_streams", cache_for_streams).toInt();
555
 
        cache_for_dvds = set->value("cache_for_dvds", cache_for_dvds).toInt();
556
 
        cache_for_vcds = set->value("cache_for_vcds", cache_for_vcds).toInt();
557
 
        cache_for_audiocds = set->value("cache_for_audiocds", cache_for_audiocds).toInt();
558
 
 
559
 
        use_mplayer_window = set->value("use_mplayer_window", use_mplayer_window).toBool();
560
 
 
561
 
        monitor_aspect = set->value("monitor_aspect", monitor_aspect).toString();
562
 
                
563
 
        latest_dir = set->value("latest_dir", latest_dir).toString();
564
 
        last_url = set->value("last_url", last_url).toString();
565
 
        last_dvd_directory = set->value("last_dvd_directory", last_dvd_directory).toString();
566
 
 
567
 
        mplayer_verbose = set->value("mplayer_verbose", mplayer_verbose).toString();
568
 
        resize_method = set->value("resize_method", resize_method).toInt();
569
 
        disable_screensaver = set->value("disable_screensaver", disable_screensaver).toBool();
570
 
 
571
 
        use_direct_rendering = set->value("use_direct_rendering", use_direct_rendering).toBool();
572
 
        use_double_buffer = set->value("use_double_buffer", use_double_buffer).toBool();
573
 
 
574
 
        screenshot_directory = set->value("screenshot_directory", screenshot_directory).toString();
575
 
        subtitles_on_screenshots = set->value("subtitles_on_screenshots", subtitles_on_screenshots).toBool();
576
 
 
577
 
        use_soft_video_eq = set->value("use_soft_video_eq", use_soft_video_eq).toBool();
578
 
        use_soft_vol = set->value("use_soft_vol", use_soft_vol).toBool();
579
 
        softvol_max = set->value("softvol_max", softvol_max).toInt();
580
 
        use_scaletempo = (OptionState) set->value("use_scaletempo", use_scaletempo).toInt();
581
 
 
582
 
        audio_lang = set->value("audio_lang", audio_lang).toString();
583
 
        subtitle_lang = set->value("subtitle_lang", subtitle_lang).toString();
584
 
 
585
 
        use_idx = set->value("use_idx", use_idx).toBool();
586
 
 
587
 
        dont_change_volume = set->value("dont_change_volume", dont_change_volume ).toBool();
588
 
 
589
 
        use_hwac3 = set->value("use_hwac3", use_hwac3 ).toBool();
590
 
 
591
 
        vcd_initial_title = set->value("vcd_initial_title", vcd_initial_title ).toInt();
592
 
 
593
 
 
594
 
        mplayer_additional_options = set->value("mplayer_additional_options", mplayer_additional_options).toString();
595
 
        mplayer_additional_video_filters = set->value("mplayer_additional_video_filters", mplayer_additional_video_filters).toString();
596
 
        mplayer_additional_audio_filters = set->value("mplayer_additional_audio_filters", mplayer_additional_audio_filters).toString();
597
 
 
598
 
        priority = set->value("priority", priority).toInt();
599
 
        frame_drop = set->value("frame_drop", frame_drop).toBool();
600
 
        hard_frame_drop = set->value("hard_frame_drop", hard_frame_drop).toBool();
601
 
        autosync = set->value("autosync", autosync).toBool();
602
 
        autosync_factor = set->value("autosync_factor", autosync_factor).toInt();
603
 
 
604
 
        h264_skip_loop_filter = (H264LoopFilter) set->value("h264_skip_loop_filter", h264_skip_loop_filter).toInt();
605
 
        HD_height = set->value("HD_height", HD_height).toInt();
606
 
 
607
 
        dont_remember_media_settings = set->value("dont_remember_media_settings", dont_remember_media_settings).toBool();
608
 
        dont_remember_time_pos = set->value("dont_remember_time_pos", dont_remember_time_pos).toBool();
609
 
 
610
 
#if STYLE_SWITCHING
611
 
        style = set->value("style", style).toString();
612
 
#endif
613
 
 
614
 
        fullscreen = set->value("fullscreen", fullscreen).toBool();
615
 
        start_in_fullscreen = set->value("start_in_fullscreen", start_in_fullscreen).toBool();
616
 
 
617
 
        compact_mode = set->value("compact_mode", compact_mode).toBool();
618
 
        stay_on_top = set->value("stay_on_top", stay_on_top).toBool();
619
 
        size_factor = set->value("size_factor", size_factor).toInt();
620
 
 
621
 
        show_frame_counter = set->value("show_frame_counter", show_frame_counter).toBool();
622
 
        show_motion_vectors = set->value("show_motion_vectors", show_motion_vectors).toBool();
623
 
 
624
 
        autoq = set->value("autoq", autoq).toInt();
625
 
 
626
 
        loop = set->value("loop", loop).toBool();
627
 
 
628
 
        use_single_instance = set->value("use_single_instance", use_single_instance).toBool();
629
 
        connection_port = set->value("connection_port", connection_port).toInt();
630
 
 
631
 
        mouse_left_click_function = set->value("mouse_left_click_function", mouse_left_click_function).toString();
632
 
        mouse_right_click_function = set->value("mouse_right_click_function", mouse_right_click_function).toString();
633
 
        mouse_double_click_function = set->value("mouse_double_click_function", mouse_double_click_function).toString();
634
 
        mouse_middle_click_function = set->value("mouse_middle_click_function", mouse_middle_click_function).toString();
635
 
        mouse_xbutton1_click_function = set->value("mouse_xbutton1_click_function", mouse_xbutton1_click_function).toString();
636
 
        mouse_xbutton2_click_function = set->value("mouse_xbutton2_click_function", mouse_xbutton2_click_function).toString();
637
 
        wheel_function = set->value("wheel_function", wheel_function).toInt();
638
 
 
639
 
        recents_max_items = set->value("recents_max_items", recents_max_items).toInt();
640
 
 
641
 
        seeking1 = set->value("seeking1", seeking1).toInt();
642
 
        seeking2 = set->value("seeking2", seeking2).toInt();
643
 
        seeking3 = set->value("seeking3", seeking3).toInt();
644
 
        seeking4 = set->value("seeking4", seeking4).toInt();
645
 
 
646
 
        update_while_seeking = set->value("update_while_seeking", update_while_seeking).toBool();
647
 
#if ENABLE_DELAYED_DRAGGING
648
 
        time_slider_drag_delay = set->value("time_slider_drag_delay", time_slider_drag_delay).toInt();
649
 
#endif
650
 
 
651
 
        language = set->value("language", language).toString();
652
 
        iconset= set->value("iconset", iconset).toString();
653
 
 
654
 
        log_mplayer = set->value("log_mplayer", log_mplayer).toBool();
655
 
        log_smplayer = set->value("log_smplayer", log_smplayer).toBool();
656
 
        log_filter = set->value("log_filter", log_filter).toString();
657
 
 
658
 
        always_clear_video_background = set->value("always_clear_video_background", always_clear_video_background).toBool();
659
 
 
660
 
        rx_endoffile = set->value("rx_endoffile", rx_endoffile).toString();
661
 
        rx_novideo = set->value("rx_novideo", rx_novideo).toString();
662
 
 
663
 
        balloon_count = set->value("balloon_count", balloon_count).toInt();
664
 
 
665
 
        dont_use_eq_options = set->value("dont_use_eq_options", dont_use_eq_options).toBool();
666
 
 
667
 
        restore_pos_after_fullscreen = set->value("restore_pos_after_fullscreen", restore_pos_after_fullscreen).toBool();
668
 
        save_window_size_on_exit =      set->value("save_window_size_on_exit", save_window_size_on_exit).toBool();
669
 
 
670
 
#ifdef Q_OS_WIN
671
 
        //enable_vcd_on_windows = set->value("enable_vcd_on_windows", enable_vcd_on_windows).toBool();
672
 
        enable_audiocd_on_windows = set->value("enable_audiocd_on_windows", enable_audiocd_on_windows).toBool();
673
 
#endif
674
 
 
675
 
        close_on_finish = set->value("close_on_finish", close_on_finish).toBool();
676
 
 
677
 
        default_font = set->value("default_font", default_font).toString();
678
 
 
679
 
        pause_when_hidden = set->value("pause_when_hidden", pause_when_hidden).toBool();
680
 
 
681
 
        allow_video_movement = set->value("allow_video_movement", allow_video_movement).toBool();
682
 
 
683
 
        use_edl_files = set->value("use_edl_files", use_edl_files).toBool();
684
 
 
685
 
        gui = set->value("gui", gui).toString();
686
 
 
687
 
    //mplayer log autosaving
688
 
    autosave_mplayer_log = set->value("autosave_mplayer_log", autosave_mplayer_log).toBool();
689
 
    mplayer_log_saveto = set->value("mplayer_log_saveto", mplayer_log_saveto).toString();
690
 
    //mplayer log autosaving end
691
 
 
692
 
        auto_add_to_playlist = set->value("auto_add_to_playlist", auto_add_to_playlist).toBool();
693
 
        use_volume_option2 = (OptionState) set->value("use_volume_option2", use_volume_option2).toInt();
694
 
 
695
 
        use_short_pathnames = set->value("use_short_pathnames", use_short_pathnames).toBool();
696
 
 
697
 
        set->endGroup();
698
 
 
699
 
 
700
 
        set->beginGroup( "defaults");
701
 
 
702
 
        initial_sub_scale = set->value("initial_sub_scale", initial_sub_scale).toDouble();
703
 
#if SCALE_ASS_SUBS
704
 
        initial_sub_scale_ass = set->value("initial_sub_scale_ass", initial_sub_scale_ass).toDouble();
705
 
#endif
706
 
        initial_volume = set->value("initial_volume", initial_volume).toInt();
707
 
        initial_contrast = set->value("initial_contrast", initial_contrast).toInt();
708
 
        initial_brightness = set->value("initial_brightness", initial_brightness).toInt();
709
 
        initial_hue = set->value("initial_hue", initial_hue).toInt();
710
 
        initial_saturation = set->value("initial_saturation", initial_saturation).toInt();
711
 
        initial_gamma = set->value("initial_gamma", initial_gamma).toInt();
712
 
 
713
 
        initial_panscan_factor = set->value("initial_panscan_factor", initial_panscan_factor).toDouble();
714
 
        initial_sub_pos = set->value("initial_sub_pos", initial_sub_pos).toInt();
715
 
 
716
 
        initial_volnorm = set->value("initial_volnorm", initial_volnorm).toBool();
717
 
        initial_postprocessing = set->value("initial_postprocessing", initial_postprocessing).toBool();
718
 
 
719
 
        initial_deinterlace = set->value("initial_deinterlace", initial_deinterlace).toInt();
720
 
 
721
 
        initial_audio_channels = set->value("initial_audio_channels", initial_audio_channels).toInt();
722
 
 
723
 
        initial_audio_track = set->value("initial_audio_track", initial_audio_track).toInt();
724
 
        initial_subtitle_track = set->value("initial_subtitle_track", initial_subtitle_track).toInt();
725
 
 
726
 
        set->endGroup();
727
 
 
728
 
        set->beginGroup( "mplayer_info");
729
 
        mplayer_detected_version = set->value("mplayer_detected_version", mplayer_detected_version).toInt();
730
 
        mplayer_user_supplied_version = set->value("mplayer_user_supplied_version", mplayer_user_supplied_version).toInt();
731
 
        mplayer_has_volume_option = set->value("mplayer_has_volume_option", mplayer_has_volume_option).toBool();
732
 
        set->endGroup();
733
 
 
734
 
        /*
735
 
        QFileInfo fi(mplayer_bin);
736
 
        if (fi.exists()) {
737
 
                mplayer_bin = fi.absFilePath();
738
 
                qDebug("mplayer_bin: '%s'", mplayer_bin.toUtf8().data());
739
 
        }
740
 
        */
741
 
}
742
 
 
743
 
#endif // NO_USE_INI_FILES
744
 
 
745
 
double Preferences::monitor_aspect_double() {
746
 
        qDebug("Preferences::monitor_aspect_double");
747
 
 
748
 
        QRegExp exp("(\\d+)[:/](\\d+)");
749
 
        if (exp.indexIn( monitor_aspect ) != -1) {
750
 
                int w = exp.cap(1).toInt();
751
 
                int h = exp.cap(2).toInt();
752
 
                qDebug(" monitor_aspect parsed successfully: %d:%d", w, h);
753
 
                return (double) w/h;
754
 
        }
755
 
 
756
 
        bool ok;
757
 
        double res = monitor_aspect.toDouble(&ok);
758
 
        if (ok) {
759
 
                qDebug(" monitor_aspect parsed successfully: %f", res);
760
 
                return res;
761
 
        } else {
762
 
                qDebug(" warning: monitor_aspect couldn't be parsed!");
763
 
        qDebug(" monitor_aspect set to 0");
764
 
                return 0;
765
 
        }
766
 
}