source: smplayer/trunk/src/prefgeneral.cpp@ 175

Last change on this file since 175 was 170, checked in by Silvan Scherrer, 11 years ago

SMPlayer: updated trunk to 14.9.0

  • Property svn:eol-style set to LF
File size: 35.7 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net>
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
20#include "prefgeneral.h"
21#include "preferences.h"
22#include "filedialog.h"
23#include "images.h"
24#include "mediasettings.h"
25#include "paths.h"
26#include "vdpauproperties.h"
27
28#if USE_ALSA_DEVICES || USE_DSOUND_DEVICES
29#include "deviceinfo.h"
30#endif
31
32PrefGeneral::PrefGeneral(QWidget * parent, Qt::WindowFlags f)
33 : PrefWidget(parent, f )
34{
35 setupUi(this);
36
37 mplayerbin_edit->setDialogType(FileChooser::GetFileName);
38 screenshot_edit->setDialogType(FileChooser::GetDirectory);
39
40 // Read driver info from InfoReader:
41 InfoReader * i = InfoReader::obj();
42 vo_list = i->voList();
43 ao_list = i->aoList();
44
45#if USE_DSOUND_DEVICES
46 dsound_devices = DeviceInfo::dsoundDevices();
47#endif
48
49#if USE_ALSA_DEVICES
50 alsa_devices = DeviceInfo::alsaDevices();
51#endif
52#if USE_XV_ADAPTORS
53 xv_adaptors = DeviceInfo::xvAdaptors();
54#endif
55
56 // Screensaver
57#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
58 screensaver_check->hide();
59 #ifndef SCREENSAVER_OFF
60 turn_screensaver_off_check->hide();
61 #endif
62 #ifndef AVOID_SCREENSAVER
63 avoid_screensaver_check->hide();
64 #endif
65#else
66 screensaver_group->hide();
67#endif
68
69#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
70 vdpau_button->hide();
71#endif
72
73#ifndef AUTO_SHUTDOWN_PC
74 shutdown_widget->hide();
75#endif
76
77 // Channels combo
78 channels_combo->addItem( "2", MediaSettings::ChStereo );
79 channels_combo->addItem( "4", MediaSettings::ChSurround );
80 channels_combo->addItem( "6", MediaSettings::ChFull51 );
81 channels_combo->addItem( "7", MediaSettings::ChFull61 );
82 channels_combo->addItem( "8", MediaSettings::ChFull71 );
83
84 connect(vo_combo, SIGNAL(currentIndexChanged(int)),
85 this, SLOT(vo_combo_changed(int)));
86 connect(ao_combo, SIGNAL(currentIndexChanged(int)),
87 this, SLOT(ao_combo_changed(int)));
88
89 retranslateStrings();
90}
91
92PrefGeneral::~PrefGeneral()
93{
94}
95
96QString PrefGeneral::sectionName() {
97 return tr("General");
98}
99
100QPixmap PrefGeneral::sectionIcon() {
101 return Images::icon("pref_general", 22);
102}
103
104void PrefGeneral::retranslateStrings() {
105 retranslateUi(this);
106
107 channels_combo->setItemText(0, tr("2 (Stereo)") );
108 channels_combo->setItemText(1, tr("4 (4.0 Surround)") );
109 channels_combo->setItemText(2, tr("6 (5.1 Surround)") );
110 channels_combo->setItemText(3, tr("7 (6.1 Surround)") );
111 channels_combo->setItemText(4, tr("8 (7.1 Surround)") );
112
113 int deinterlace_item = deinterlace_combo->currentIndex();
114 deinterlace_combo->clear();
115 deinterlace_combo->addItem( tr("None"), MediaSettings::NoDeinterlace );
116 deinterlace_combo->addItem( tr("Lowpass5"), MediaSettings::L5 );
117 deinterlace_combo->addItem( tr("Yadif (normal)"), MediaSettings::Yadif );
118 deinterlace_combo->addItem( tr("Yadif (double framerate)"), MediaSettings::Yadif_1 );
119 deinterlace_combo->addItem( tr("Linear Blend"), MediaSettings::LB );
120 deinterlace_combo->addItem( tr("Kerndeint"), MediaSettings::Kerndeint );
121 deinterlace_combo->setCurrentIndex(deinterlace_item);
122
123 int filesettings_method_item = filesettings_method_combo->currentIndex();
124 filesettings_method_combo->clear();
125 filesettings_method_combo->addItem( tr("one ini file"), "normal");
126 filesettings_method_combo->addItem( tr("multiple ini files"), "hash");
127 filesettings_method_combo->setCurrentIndex(filesettings_method_item);
128
129 updateDriverCombos();
130
131 // Icons
132 /*
133 resize_window_icon->setPixmap( Images::icon("resize_window") );
134 volume_icon->setPixmap( Images::icon("speaker") );
135 */
136
137 mplayerbin_edit->setCaption(tr("Select the mplayer executable"));
138#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
139 mplayerbin_edit->setFilter(tr("Executables") +" (*.exe)");
140#else
141 mplayerbin_edit->setFilter(tr("All files") +" (*)");
142#endif
143 screenshot_edit->setCaption(tr("Select a directory"));
144
145 preferred_desc->setText(
146 tr("Here you can type your preferred language for the audio "
147 "and subtitle streams. When a media with multiple audio or "
148 "subtitle streams is found, SMPlayer will try to use your "
149 "preferred language. This only will work with media that offer "
150 "info about the language of audio and subtitle streams, like DVDs "
151 "or mkv files.<br>These fields accept regular expressions. "
152 "Example: <b>es|esp|spa</b> will select the track if it matches with "
153 "<i>es</i>, <i>esp</i> or <i>spa</i>."));
154
155 createHelp();
156}
157
158void PrefGeneral::setData(Preferences * pref) {
159 setMplayerPath( pref->mplayer_bin );
160
161 setUseScreenshots( pref->use_screenshot );
162 setScreenshotDir( pref->screenshot_directory );
163
164 QString vo = pref->vo;
165 if (vo.isEmpty()) {
166#ifdef Q_OS_WIN
167 if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA) {
168 vo = "direct3d,";
169 } else {
170 vo = "directx,";
171 }
172#else
173#ifdef Q_OS_OS2
174 vo = "kva";
175#else
176 vo = "xv,";
177#endif
178#endif
179 }
180 setVO( vo );
181
182 QString ao = pref->ao;
183
184#ifdef Q_OS_OS2
185 if (ao.isEmpty()) {
186 if (pref->mplayer_detected_version >= MPLAYER_KAI_VERSION) {
187 ao = "kai";
188 } else {
189 ao = "dart";
190 }
191 }
192#endif
193
194 setAO( ao );
195
196 setRememberSettings( !pref->dont_remember_media_settings );
197 setRememberTimePos( !pref->dont_remember_time_pos );
198 setFileSettingsMethod( pref->file_settings_method );
199 setAudioLang( pref->audio_lang );
200 setSubtitleLang( pref->subtitle_lang );
201 setAudioTrack( pref->initial_audio_track );
202 setSubtitleTrack( pref->initial_subtitle_track );
203 setCloseOnFinish( pref->close_on_finish );
204 setPauseWhenHidden( pref->pause_when_hidden );
205#ifdef AUTO_SHUTDOWN_PC
206 shutdown_check->setChecked( pref->auto_shutdown_pc );
207#endif
208
209 setEq2( pref->use_soft_video_eq );
210 setUseAudioEqualizer( pref->use_audio_equalizer );
211 global_audio_equalizer_check->setChecked(pref->global_audio_equalizer);
212 setGlobalVolume( pref->global_volume );
213 setSoftVol( pref->use_soft_vol );
214 setAc3DTSPassthrough( pref->use_hwac3 );
215 setInitialVolNorm( pref->initial_volnorm );
216 setAmplification( pref->softvol_max );
217 setInitialPostprocessing( pref->initial_postprocessing );
218 setInitialDeinterlace( pref->initial_deinterlace );
219 setInitialZoom( pref->initial_zoom_factor );
220 setDirectRendering( pref->use_direct_rendering );
221 setDoubleBuffer( pref->use_double_buffer );
222 setUseSlices( pref->use_slices );
223 setStartInFullscreen( pref->start_in_fullscreen );
224 setBlackbordersOnFullscreen( pref->add_blackborders_on_fullscreen );
225 setAutoq( pref->autoq );
226
227#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
228 #ifdef SCREENSAVER_OFF
229 setTurnScreensaverOff( pref->turn_screensaver_off );
230 #endif
231 #ifdef AVOID_SCREENSAVER
232 setAvoidScreensaver( pref->avoid_screensaver );
233 #endif
234#else
235 setDisableScreensaver( pref->disable_screensaver );
236#endif
237
238#if !defined(Q_OS_WIN) && !defined(Q_OS_OS2)
239 vdpau = pref->vdpau;
240#endif
241
242 setAudioChannels( pref->initial_audio_channels );
243 setScaleTempoFilter( pref->use_scaletempo );
244
245 setAutoSyncActivated( pref->autosync );
246 setAutoSyncFactor( pref->autosync_factor );
247
248 setMcActivated( pref->use_mc );
249 setMc( pref->mc_value );
250}
251
252void PrefGeneral::getData(Preferences * pref) {
253 requires_restart = false;
254 filesettings_method_changed = false;
255
256 if (pref->mplayer_bin != mplayerPath()) {
257 requires_restart = true;
258 pref->mplayer_bin = mplayerPath();
259
260 qDebug("PrefGeneral::getData: mplayer binary has changed, getting version number");
261 // Forces to get info from mplayer to update version number
262 InfoReader i( pref->mplayer_bin );
263 i.getInfo();
264 // Update the drivers list at the same time
265 //setDrivers( i.voList(), i.aoList() );
266#ifdef Q_OS_OS2
267 vo_list = i.voList();
268 ao_list = i.aoList();
269 updateDriverCombos();
270#endif
271 }
272
273 TEST_AND_SET(pref->use_screenshot, useScreenshots());
274 TEST_AND_SET(pref->screenshot_directory, screenshotDir());
275 TEST_AND_SET(pref->vo, VO());
276 TEST_AND_SET(pref->ao, AO());
277
278 bool dont_remember_ms = !rememberSettings();
279 TEST_AND_SET(pref->dont_remember_media_settings, dont_remember_ms);
280
281 bool dont_remember_time = !rememberTimePos();
282 TEST_AND_SET(pref->dont_remember_time_pos, dont_remember_time);
283
284 if (pref->file_settings_method != fileSettingsMethod()) {
285 pref->file_settings_method = fileSettingsMethod();
286 filesettings_method_changed = true;
287 }
288
289 pref->audio_lang = audioLang();
290 pref->subtitle_lang = subtitleLang();
291
292 pref->initial_audio_track = audioTrack();
293 pref->initial_subtitle_track = subtitleTrack();
294
295 pref->close_on_finish = closeOnFinish();
296 pref->pause_when_hidden = pauseWhenHidden();
297
298#ifdef AUTO_SHUTDOWN_PC
299 pref->auto_shutdown_pc = shutdown_check->isChecked();
300#endif
301
302 TEST_AND_SET(pref->use_soft_video_eq, eq2());
303 TEST_AND_SET(pref->use_soft_vol, softVol());
304 pref->global_volume = globalVolume();
305 TEST_AND_SET(pref->use_audio_equalizer, useAudioEqualizer());
306 pref->global_audio_equalizer = global_audio_equalizer_check->isChecked();
307 TEST_AND_SET(pref->use_hwac3, Ac3DTSPassthrough());
308 pref->initial_volnorm = initialVolNorm();
309 TEST_AND_SET(pref->softvol_max, amplification());
310 pref->initial_postprocessing = initialPostprocessing();
311 pref->initial_deinterlace = initialDeinterlace();
312 pref->initial_zoom_factor = initialZoom();
313 TEST_AND_SET(pref->use_direct_rendering, directRendering());
314 TEST_AND_SET(pref->use_double_buffer, doubleBuffer());
315 TEST_AND_SET(pref->use_slices, useSlices());
316 pref->start_in_fullscreen = startInFullscreen();
317 if (pref->add_blackborders_on_fullscreen != blackbordersOnFullscreen()) {
318 pref->add_blackborders_on_fullscreen = blackbordersOnFullscreen();
319 if (pref->fullscreen) requires_restart = true;
320 }
321 TEST_AND_SET(pref->autoq, autoq());
322
323#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
324 #ifdef SCREENSAVER_OFF
325 TEST_AND_SET(pref->turn_screensaver_off, turnScreensaverOff());
326 #endif
327 #ifdef AVOID_SCREENSAVER
328 pref->avoid_screensaver = avoidScreensaver();
329 #endif
330#else
331 TEST_AND_SET(pref->disable_screensaver, disableScreensaver());
332#endif
333
334#if !defined(Q_OS_WIN) && !defined(Q_OS_OS2)
335 pref->vdpau = vdpau;
336#endif
337
338 pref->initial_audio_channels = audioChannels();
339 TEST_AND_SET(pref->use_scaletempo, scaleTempoFilter());
340
341 TEST_AND_SET(pref->autosync, autoSyncActivated());
342 TEST_AND_SET(pref->autosync_factor, autoSyncFactor());
343
344 TEST_AND_SET(pref->use_mc, mcActivated());
345 TEST_AND_SET(pref->mc_value, mc());
346}
347
348void PrefGeneral::updateDriverCombos() {
349 int vo_current = vo_combo->currentIndex();
350 int ao_current = ao_combo->currentIndex();
351
352 vo_combo->clear();
353 ao_combo->clear();
354
355 QString vo;
356 for ( int n = 0; n < vo_list.count(); n++ ) {
357 vo = vo_list[n].name();
358#ifdef Q_OS_WIN
359 if ( vo == "directx" ) {
360 vo_combo->addItem( "directx (" + tr("fast") + ")", "directx" );
361 vo_combo->addItem( "directx (" + tr("slow") + ")", "directx:noaccel" );
362 }
363 else
364#else
365#ifdef Q_OS_OS2
366 if ( vo == "kva") {
367 vo_combo->addItem( "kva (" + tr("fast") + ")", "kva" );
368 vo_combo->addItem( "kva (" + tr("snap mode") + ")", "kva:snap" );
369 vo_combo->addItem( "kva (" + tr("slower dive mode") + ")", "kva:dive" );
370 }
371 else
372#else
373 /*
374 if (vo == "xv") vo_combo->addItem( "xv (" + tr("fastest") + ")", vo);
375 else
376 */
377#if USE_XV_ADAPTORS
378 if ((vo == "xv") && (!xv_adaptors.isEmpty())) {
379 vo_combo->addItem(vo, vo);
380 for (int n=0; n < xv_adaptors.count(); n++) {
381 vo_combo->addItem( "xv (" + xv_adaptors[n].ID().toString() + " - " + xv_adaptors[n].desc() + ")",
382 "xv:adaptor=" + xv_adaptors[n].ID().toString() );
383 }
384 }
385 else
386#endif // USE_XV_ADAPTORS
387#endif
388#endif
389 if (vo == "x11") vo_combo->addItem( "x11 (" + tr("slow") + ")", vo);
390 else
391 if (vo == "gl") {
392 vo_combo->addItem( vo, vo);
393 vo_combo->addItem( "gl (" + tr("fast") + ")", "gl:yuv=2:force-pbo");
394 vo_combo->addItem( "gl (" + tr("fast - ATI cards") + ")", "gl:yuv=2:force-pbo:ati-hack");
395 vo_combo->addItem( "gl (yuv)", "gl:yuv=3");
396 }
397 else
398 if (vo == "gl2") {
399 vo_combo->addItem( vo, vo);
400 vo_combo->addItem( "gl2 (yuv)", "gl2:yuv=3");
401 }
402 else
403 if (vo == "gl_tiled") {
404 vo_combo->addItem( vo, vo);
405 vo_combo->addItem( "gl_tiled (yuv)", "gl_tiled:yuv=3");
406 }
407 else
408 if (vo == "null" || vo == "png" || vo == "jpeg" || vo == "gif89a" ||
409 vo == "tga" || vo == "pnm" || vo == "md5sum" )
410 {
411 ; // Nothing to do
412 }
413 else
414 vo_combo->addItem( vo, vo );
415 }
416 vo_combo->addItem( tr("User defined..."), "user_defined" );
417
418 QString ao;
419 for ( int n = 0; n < ao_list.count(); n++) {
420 ao = ao_list[n].name();
421 ao_combo->addItem( ao, ao );
422#ifdef Q_OS_OS2
423 if ( ao == "kai") {
424 ao_combo->addItem( "kai (" + tr("uniaud mode") + ")", "kai:uniaud" );
425 ao_combo->addItem( "kai (" + tr("dart mode") + ")", "kai:dart" );
426 }
427#endif
428#if USE_ALSA_DEVICES
429 if ((ao == "alsa") && (!alsa_devices.isEmpty())) {
430 for (int n=0; n < alsa_devices.count(); n++) {
431 ao_combo->addItem( "alsa (" + alsa_devices[n].ID().toString() + " - " + alsa_devices[n].desc() + ")",
432 "alsa:device=hw=" + alsa_devices[n].ID().toString() );
433 }
434 }
435#endif
436#if USE_DSOUND_DEVICES
437 if ((ao == "dsound") && (!dsound_devices.isEmpty())) {
438 for (int n=0; n < dsound_devices.count(); n++) {
439 ao_combo->addItem( "dsound (" + dsound_devices[n].ID().toString() + " - " + dsound_devices[n].desc() + ")",
440 "dsound:device=" + dsound_devices[n].ID().toString() );
441 }
442 }
443#endif
444 }
445 ao_combo->addItem( tr("User defined..."), "user_defined" );
446
447 vo_combo->setCurrentIndex( vo_current );
448 ao_combo->setCurrentIndex( ao_current );
449}
450
451void PrefGeneral::setMplayerPath( QString path ) {
452 mplayerbin_edit->setText( path );
453}
454
455QString PrefGeneral::mplayerPath() {
456 return mplayerbin_edit->text();
457}
458
459void PrefGeneral::setUseScreenshots(bool b) {
460 use_screenshots_check->setChecked(b);
461}
462
463bool PrefGeneral::useScreenshots() {
464 return use_screenshots_check->isChecked();
465}
466
467void PrefGeneral::setScreenshotDir( QString path ) {
468 screenshot_edit->setText( path );
469}
470
471QString PrefGeneral::screenshotDir() {
472 return screenshot_edit->text();
473}
474
475void PrefGeneral::setVO( QString vo_driver ) {
476 int idx = vo_combo->findData( vo_driver );
477 if (idx != -1) {
478 vo_combo->setCurrentIndex(idx);
479 } else {
480 vo_combo->setCurrentIndex(vo_combo->findData("user_defined"));
481 vo_user_defined_edit->setText(vo_driver);
482 }
483 vo_combo_changed(vo_combo->currentIndex());
484}
485
486void PrefGeneral::setAO( QString ao_driver ) {
487 int idx = ao_combo->findData( ao_driver );
488 if (idx != -1) {
489 ao_combo->setCurrentIndex(idx);
490 } else {
491 ao_combo->setCurrentIndex(ao_combo->findData("user_defined"));
492 ao_user_defined_edit->setText(ao_driver);
493 }
494 ao_combo_changed(ao_combo->currentIndex());
495}
496
497QString PrefGeneral::VO() {
498 QString vo = vo_combo->itemData(vo_combo->currentIndex()).toString();
499 if (vo == "user_defined") {
500 vo = vo_user_defined_edit->text();
501 /*
502 if (vo.isEmpty()) {
503 vo = vo_combo->itemData(0).toString();
504 qDebug("PrefGeneral::VO: user defined vo is empty, using %s", vo.toUtf8().constData());
505 }
506 */
507 }
508 return vo;
509}
510
511QString PrefGeneral::AO() {
512 QString ao = ao_combo->itemData(ao_combo->currentIndex()).toString();
513 if (ao == "user_defined") {
514 ao = ao_user_defined_edit->text();
515 /*
516 if (ao.isEmpty()) {
517 ao = ao_combo->itemData(0).toString();
518 qDebug("PrefGeneral::AO: user defined ao is empty, using %s", ao.toUtf8().constData());
519 }
520 */
521 }
522 return ao;
523}
524
525void PrefGeneral::setRememberSettings(bool b) {
526 remember_all_check->setChecked(b);
527 //rememberAllButtonToggled(b);
528}
529
530bool PrefGeneral::rememberSettings() {
531 return remember_all_check->isChecked();
532}
533
534void PrefGeneral::setRememberTimePos(bool b) {
535 remember_time_check->setChecked(b);
536}
537
538bool PrefGeneral::rememberTimePos() {
539 return remember_time_check->isChecked();
540}
541
542void PrefGeneral::setFileSettingsMethod(QString method) {
543 int index = filesettings_method_combo->findData(method);
544 if (index < 0) index = 0;
545 filesettings_method_combo->setCurrentIndex(index);
546}
547
548QString PrefGeneral::fileSettingsMethod() {
549 return filesettings_method_combo->itemData(filesettings_method_combo->currentIndex()).toString();
550}
551
552void PrefGeneral::setAudioLang(QString lang) {
553 audio_lang_edit->setText(lang);
554}
555
556QString PrefGeneral::audioLang() {
557 return audio_lang_edit->text();
558}
559
560void PrefGeneral::setSubtitleLang(QString lang) {
561 subtitle_lang_edit->setText(lang);
562}
563
564QString PrefGeneral::subtitleLang() {
565 return subtitle_lang_edit->text();
566}
567
568void PrefGeneral::setAudioTrack(int track) {
569 audio_track_spin->setValue(track);
570}
571
572int PrefGeneral::audioTrack() {
573 return audio_track_spin->value();
574}
575
576void PrefGeneral::setSubtitleTrack(int track) {
577 subtitle_track_spin->setValue(track);
578}
579
580int PrefGeneral::subtitleTrack() {
581 return subtitle_track_spin->value();
582}
583
584void PrefGeneral::setCloseOnFinish(bool b) {
585 close_on_finish_check->setChecked(b);
586}
587
588bool PrefGeneral::closeOnFinish() {
589 return close_on_finish_check->isChecked();
590}
591
592void PrefGeneral::setPauseWhenHidden(bool b) {
593 pause_if_hidden_check->setChecked(b);
594}
595
596bool PrefGeneral::pauseWhenHidden() {
597 return pause_if_hidden_check->isChecked();
598}
599
600
601void PrefGeneral::setEq2(bool b) {
602 eq2_check->setChecked(b);
603}
604
605bool PrefGeneral::eq2() {
606 return eq2_check->isChecked();
607}
608
609void PrefGeneral::setSoftVol(bool b) {
610 softvol_check->setChecked(b);
611}
612
613void PrefGeneral::setGlobalVolume(bool b) {
614 global_volume_check->setChecked(b);
615}
616
617bool PrefGeneral::globalVolume() {
618 return global_volume_check->isChecked();
619}
620
621bool PrefGeneral::softVol() {
622 return softvol_check->isChecked();
623}
624
625void PrefGeneral::setAutoSyncFactor(int factor) {
626 autosync_spin->setValue(factor);
627}
628
629int PrefGeneral::autoSyncFactor() {
630 return autosync_spin->value();
631}
632
633void PrefGeneral::setAutoSyncActivated(bool b) {
634 autosync_check->setChecked(b);
635}
636
637bool PrefGeneral::autoSyncActivated() {
638 return autosync_check->isChecked();
639}
640
641void PrefGeneral::setMc(double value) {
642 mc_spin->setValue(value);
643}
644
645double PrefGeneral::mc() {
646 return mc_spin->value();
647}
648
649void PrefGeneral::setMcActivated(bool b) {
650 use_mc_check->setChecked(b);
651}
652
653bool PrefGeneral::mcActivated() {
654 return use_mc_check->isChecked();
655}
656
657void PrefGeneral::setUseAudioEqualizer(bool b) {
658 audio_equalizer_check->setChecked(b);
659}
660
661bool PrefGeneral::useAudioEqualizer() {
662 return audio_equalizer_check->isChecked();
663}
664
665void PrefGeneral::setAc3DTSPassthrough(bool b) {
666 hwac3_check->setChecked(b);
667}
668
669bool PrefGeneral::Ac3DTSPassthrough() {
670 return hwac3_check->isChecked();
671}
672
673void PrefGeneral::setInitialVolNorm(bool b) {
674 volnorm_check->setChecked(b);
675}
676
677bool PrefGeneral::initialVolNorm() {
678 return volnorm_check->isChecked();
679}
680
681void PrefGeneral::setInitialPostprocessing(bool b) {
682 postprocessing_check->setChecked(b);
683}
684
685bool PrefGeneral::initialPostprocessing() {
686 return postprocessing_check->isChecked();
687}
688
689void PrefGeneral::setInitialDeinterlace(int ID) {
690 int pos = deinterlace_combo->findData(ID);
691 if (pos != -1) {
692 deinterlace_combo->setCurrentIndex(pos);
693 } else {
694 qWarning("PrefGeneral::setInitialDeinterlace: ID: %d not found in combo", ID);
695 }
696}
697
698int PrefGeneral::initialDeinterlace() {
699 if (deinterlace_combo->currentIndex() != -1) {
700 return deinterlace_combo->itemData( deinterlace_combo->currentIndex() ).toInt();
701 } else {
702 qWarning("PrefGeneral::initialDeinterlace: no item selected");
703 return 0;
704 }
705}
706
707void PrefGeneral::setInitialZoom(double v) {
708 zoom_spin->setValue(v);
709}
710
711double PrefGeneral::initialZoom() {
712 return zoom_spin->value();
713}
714
715void PrefGeneral::setDirectRendering(bool b) {
716 direct_rendering_check->setChecked(b);
717}
718
719bool PrefGeneral::directRendering() {
720 return direct_rendering_check->isChecked();
721}
722
723void PrefGeneral::setDoubleBuffer(bool b) {
724 double_buffer_check->setChecked(b);
725}
726
727bool PrefGeneral::doubleBuffer() {
728 return double_buffer_check->isChecked();
729}
730
731void PrefGeneral::setUseSlices(bool b) {
732 use_slices_check->setChecked(b);
733}
734
735bool PrefGeneral::useSlices() {
736 return use_slices_check->isChecked();
737}
738
739void PrefGeneral::setAmplification(int n) {
740 softvol_max_spin->setValue(n);
741}
742
743int PrefGeneral::amplification() {
744 return softvol_max_spin->value();
745}
746
747void PrefGeneral::setAudioChannels(int ID) {
748 int pos = channels_combo->findData(ID);
749 if (pos != -1) {
750 channels_combo->setCurrentIndex(pos);
751 } else {
752 qWarning("PrefGeneral::setAudioChannels: ID: %d not found in combo", ID);
753 }
754}
755
756int PrefGeneral::audioChannels() {
757 if (channels_combo->currentIndex() != -1) {
758 return channels_combo->itemData( channels_combo->currentIndex() ).toInt();
759 } else {
760 qWarning("PrefGeneral::audioChannels: no item selected");
761 return 0;
762 }
763}
764
765void PrefGeneral::setStartInFullscreen(bool b) {
766 start_fullscreen_check->setChecked(b);
767}
768
769bool PrefGeneral::startInFullscreen() {
770 return start_fullscreen_check->isChecked();
771}
772
773#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
774#ifdef AVOID_SCREENSAVER
775void PrefGeneral::setAvoidScreensaver(bool b) {
776 avoid_screensaver_check->setChecked(b);
777}
778
779bool PrefGeneral::avoidScreensaver() {
780 return avoid_screensaver_check->isChecked();
781}
782#endif
783
784#ifdef SCREENSAVER_OFF
785void PrefGeneral::setTurnScreensaverOff(bool b) {
786 turn_screensaver_off_check->setChecked(b);
787}
788
789bool PrefGeneral::turnScreensaverOff() {
790 return turn_screensaver_off_check->isChecked();
791}
792#endif
793
794#else
795void PrefGeneral::setDisableScreensaver(bool b) {
796 screensaver_check->setChecked(b);
797}
798
799bool PrefGeneral::disableScreensaver() {
800 return screensaver_check->isChecked();
801}
802#endif
803
804void PrefGeneral::setBlackbordersOnFullscreen(bool b) {
805 blackborders_on_fs_check->setChecked(b);
806}
807
808bool PrefGeneral::blackbordersOnFullscreen() {
809 return blackborders_on_fs_check->isChecked();
810}
811
812void PrefGeneral::setAutoq(int n) {
813 autoq_spin->setValue(n);
814}
815
816int PrefGeneral::autoq() {
817 return autoq_spin->value();
818}
819
820void PrefGeneral::setScaleTempoFilter(Preferences::OptionState value) {
821 scaletempo_combo->setState(value);
822}
823
824Preferences::OptionState PrefGeneral::scaleTempoFilter() {
825 return scaletempo_combo->state();
826}
827
828void PrefGeneral::vo_combo_changed(int idx) {
829 qDebug("PrefGeneral::vo_combo_changed: %d", idx);
830 bool visible = (vo_combo->itemData(idx).toString() == "user_defined");
831 vo_user_defined_edit->setVisible(visible);
832 vo_user_defined_edit->setFocus();
833
834#ifndef Q_OS_WIN
835 bool vdpau_button_visible = (vo_combo->itemData(idx).toString() == "vdpau");
836 vdpau_button->setVisible(vdpau_button_visible);
837#endif
838}
839
840void PrefGeneral::ao_combo_changed(int idx) {
841 qDebug("PrefGeneral::ao_combo_changed: %d", idx);
842 bool visible = (ao_combo->itemData(idx).toString() == "user_defined");
843 ao_user_defined_edit->setVisible(visible);
844 ao_user_defined_edit->setFocus();
845}
846
847#ifndef Q_OS_WIN
848void PrefGeneral::on_vdpau_button_clicked() {
849 qDebug("PrefGeneral::on_vdpau_button_clicked");
850
851 VDPAUProperties d(this);
852
853 d.setffh264vdpau(vdpau.ffh264vdpau);
854 d.setffmpeg12vdpau(vdpau.ffmpeg12vdpau);
855 d.setffwmv3vdpau(vdpau.ffwmv3vdpau);
856 d.setffvc1vdpau(vdpau.ffvc1vdpau);
857 d.setffodivxvdpau(vdpau.ffodivxvdpau);
858
859 d.setDisableFilters(vdpau.disable_video_filters);
860
861 if (d.exec() == QDialog::Accepted) {
862 vdpau.ffh264vdpau = d.ffh264vdpau();
863 vdpau.ffmpeg12vdpau = d.ffmpeg12vdpau();
864 vdpau.ffwmv3vdpau = d.ffwmv3vdpau();
865 vdpau.ffvc1vdpau = d.ffvc1vdpau();
866 vdpau.ffodivxvdpau = d.ffodivxvdpau();
867
868 vdpau.disable_video_filters = d.disableFilters();
869 }
870}
871#endif
872
873void PrefGeneral::createHelp() {
874 clearHelp();
875
876 addSectionTitle(tr("General"));
877
878 setWhatsThis(mplayerbin_edit, tr("MPlayer executable"),
879 tr("Here you must specify the mplayer "
880 "executable that SMPlayer will use.<br>"
881 "SMPlayer requires at least MPlayer 1.0rc1 (although a recent "
882 "revision from SVN is highly recommended).") + "<br><b>" +
883 tr("If this setting is wrong, SMPlayer won't be able to play "
884 "anything!") + "</b>");
885
886 setWhatsThis(remember_all_check, tr("Remember settings"),
887 tr("Usually SMPlayer will remember the settings for each file you "
888 "play (audio track selected, volume, filters...). Disable this "
889 "option if you don't like this feature.") );
890
891 setWhatsThis(remember_time_check, tr("Remember time position"),
892 tr("If you check this option, SMPlayer will remember the last position "
893 "of the file when you open it again. This option works only with "
894 "regular files (not with DVDs, CDs, URLs...).") );
895
896 setWhatsThis(filesettings_method_combo, tr("Method to store the file settings"),
897 tr("This option allows to change the way the file settings would be "
898 "stored. The following options are available:") +"<ul><li>" +
899 tr("<b>one ini file</b>: the settings for all played files will be "
900 "saved in a single ini file (%1)").arg(QString("<i>"+Paths::iniPath()+"/smplayer.ini</i>")) + "</li><li>" +
901 tr("<b>multiple ini files</b>: one ini file will be used for each played file. "
902 "Those ini files will be saved in the folder %1").arg(QString("<i>"+Paths::iniPath()+"/file_settings</i>")) + "</li></ul>" +
903 tr("The latter method could be faster if there is info for a lot of files.") );
904
905 setWhatsThis(use_screenshots_check, tr("Enable screenshots"),
906 tr("You can use this option to enable or disable the possibility to "
907 "take screenshots.") );
908
909 setWhatsThis(screenshot_edit, tr("Screenshots folder"),
910 tr("Here you can specify a folder where the screenshots taken by "
911 "SMPlayer will be stored. If the folder is not valid the "
912 "screenshot feature will be disabled.") );
913
914 setWhatsThis(pause_if_hidden_check, tr("Pause when minimized"),
915 tr("If this option is enabled, the file will be paused when the "
916 "main window is hidden. When the window is restored, playback "
917 "will be resumed.") );
918
919 setWhatsThis(close_on_finish_check, tr("Close when finished"),
920 tr("If this option is checked, the main window will be automatically "
921 "closed when the current file/playlist finishes.") );
922
923#ifdef AUTO_SHUTDOWN_PC
924 setWhatsThis(shutdown_check, tr("Shut down computer"),
925 tr("If this option is enabled, the computer will shut down just after SMPlayer is closed.") );
926#endif
927
928 // Video tab
929 addSectionTitle(tr("Video"));
930
931 setWhatsThis(vo_combo, tr("Video output driver"),
932 tr("Select the video output driver. %1 provides the best performance.")
933#ifdef Q_OS_WIN
934 .arg("<b><i>directx</i></b>")
935#else
936#ifdef Q_OS_OS2
937 .arg("<b><i>kva</i></b>")
938#else
939 .arg("<b><i>xv</i></b>")
940#endif
941#endif
942 );
943
944#if !defined(Q_OS_WIN) && !defined(Q_OS_OS2)
945 /*
946 setWhatsThis(vdpau_filters_check, tr("Disable video filters when using vdpau"),
947 tr("Usually video filters won't work when using vdpau as video output "
948 "driver, so it's wise to keep this option checked.") );
949 */
950#endif
951
952 setWhatsThis(postprocessing_check, tr("Enable postprocessing by default"),
953 tr("Postprocessing will be used by default on new opened files.") );
954
955 setWhatsThis(autoq_spin, tr("Postprocessing quality"),
956 tr("Dynamically changes the level of postprocessing depending on the "
957 "available spare CPU time. The number you specify will be the "
958 "maximum level used. Usually you can use some big number.") );
959
960 setWhatsThis(deinterlace_combo, tr("Deinterlace by default"),
961 tr("Select the deinterlace filter that you want to be used for new "
962 "videos opened.") +" "+
963 tr("<b>Note:</b> This option won't be used for TV channels.") );
964
965 setWhatsThis(zoom_spin, tr("Default zoom"),
966 tr("This option sets the default zoom which will be used for "
967 "new videos.") );
968
969 setWhatsThis(eq2_check, tr("Software video equalizer"),
970 tr("You can check this option if video equalizer is not supported by "
971 "your graphic card or the selected video output driver.<br>"
972 "<b>Note:</b> this option can be incompatible with some video "
973 "output drivers.") );
974
975 setWhatsThis(direct_rendering_check, tr("Direct rendering"),
976 tr("If checked, turns on direct rendering (not supported by all "
977 "codecs and video outputs)<br>"
978 "<b>Warning:</b> May cause OSD/SUB corruption!") );
979
980 setWhatsThis(double_buffer_check, tr("Double buffering"),
981 tr("Double buffering fixes flicker by storing two frames in memory, "
982 "and displaying one while decoding another. If disabled it can "
983 "affect OSD negatively, but often removes OSD flickering.") );
984
985 setWhatsThis(use_slices_check, tr("Draw video using slices"),
986 tr("Enable/disable drawing video by 16-pixel height slices/bands. "
987 "If disabled, the whole frame is drawn in a single run. "
988 "May be faster or slower, depending on video card and available "
989 "cache. It has effect only with libmpeg2 and libavcodec codecs.") );
990
991 setWhatsThis(start_fullscreen_check, tr("Start videos in fullscreen"),
992 tr("If this option is checked, all videos will start to play in "
993 "fullscreen mode.") );
994
995 setWhatsThis(blackborders_on_fs_check, tr("Add black borders on fullscreen"),
996 tr("If this option is enabled, black borders will be added to the "
997 "image in fullscreen mode. This allows subtitles to be displayed "
998 "on the black borders.") /* + "<br>" +
999 tr("This option will be ignored if MPlayer uses its own window, as "
1000 "some video drivers (like gl) are already able to display the "
1001 "subtitles automatically in the black borders.") */ );
1002
1003#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
1004 #ifdef SCREENSAVER_OFF
1005 setWhatsThis(turn_screensaver_off_check, tr("Switch screensaver off"),
1006 tr("This option switches the screensaver off just before starting to "
1007 "play a file and switches it on when playback finishes. If this "
1008 "option is enabled, the screensaver won't appear even if playing "
1009 "audio files or when a file is paused."));
1010 #endif
1011 #ifdef AVOID_SCREENSAVER
1012 setWhatsThis(avoid_screensaver_check, tr("Avoid screensaver"),
1013 tr("When this option is checked, SMPlayer will try to prevent the "
1014 "screensaver to be shown when playing a video file. The screensaver "
1015 "will be allowed to be shown if playing an audio file or in pause "
1016 "mode. This option only works if the SMPlayer window is in "
1017 "the foreground."));
1018 #endif
1019#else
1020 setWhatsThis(screensaver_check, tr("Disable screensaver"),
1021 tr("Check this option to disable the screensaver while playing.<br>"
1022 "The screensaver will enabled again when play finishes.")
1023 );
1024#endif
1025
1026 // Audio tab
1027 addSectionTitle(tr("Audio"));
1028
1029 setWhatsThis(ao_combo, tr("Audio output driver"),
1030 tr("Select the audio output driver.")
1031#ifndef Q_OS_WIN
1032#ifdef Q_OS_OS2
1033 + " " +
1034 tr("%1 is the recommended one. %2 is only available on older MPlayer (before version %3)")
1035 .arg("<b><i>kai</i></b>")
1036 .arg("<b><i>dart</i></b>")
1037 .arg(MPLAYER_KAI_VERSION)
1038#else
1039 + " " +
1040 tr("%1 is the recommended one. Try to avoid %2 and %3, they are slow "
1041 "and can have an impact on performance.")
1042 .arg("<b><i>alsa</i></b>")
1043 .arg("<b><i>esd</i></b>")
1044 .arg("<b><i>arts</i></b>")
1045#endif
1046#endif
1047 );
1048
1049 setWhatsThis(audio_equalizer_check, tr("Enable the audio equalizer"),
1050 tr("Check this option if you want to use the audio equalizer.") );
1051
1052 setWhatsThis(global_audio_equalizer_check, tr("Global audio equalizer"),
1053 tr("If this option is checked, all media files share the audio equalizer.") +" "+
1054 tr("If it's not checked, the audio equalizer values are saved along each file "
1055 "and loaded back when the file is played later.") );
1056
1057 setWhatsThis(hwac3_check, tr("AC3/DTS pass-through S/PDIF"),
1058 tr("Uses hardware AC3 passthrough.") + "<br>" +
1059 tr("<b>Note:</b> none of the audio filters will be used when this "
1060 "option is enabled.") );
1061
1062 setWhatsThis(channels_combo, tr("Channels by default"),
1063 tr("Requests the number of playback channels. MPlayer "
1064 "asks the decoder to decode the audio into as many channels as "
1065 "specified. Then it is up to the decoder to fulfill the "
1066 "requirement. This is usually only important when playing "
1067 "videos with AC3 audio (like DVDs). In that case liba52 does "
1068 "the decoding by default and correctly downmixes the audio "
1069 "into the requested number of channels. "
1070 "<b>Note</b>: This option is honored by codecs (AC3 only), "
1071 "filters (surround) and audio output drivers (OSS at least).") );
1072
1073 setWhatsThis(scaletempo_combo, tr("High speed playback without altering pitch"),
1074 tr("Allows to change the playback speed without altering pitch. "
1075 "Requires at least MPlayer dev-SVN-r24924.") );
1076
1077 setWhatsThis(global_volume_check, tr("Global volume"),
1078 tr("If this option is checked, the same volume will be used for "
1079 "all files you play. If the option is not checked each "
1080 "file uses its own volume.") + "<br>" +
1081 tr("This option also applies for the mute control.") );
1082
1083 setWhatsThis(softvol_check, tr("Software volume control"),
1084 tr("Check this option to use the software mixer, instead of "
1085 "using the sound card mixer.") );
1086
1087 setWhatsThis(softvol_max_spin, tr("Max. Amplification"),
1088 tr("Sets the maximum amplification level in percent (default: 110). "
1089 "A value of 200 will allow you to adjust the volume up to a "
1090 "maximum of double the current level. With values below 100 the "
1091 "initial volume (which is 100%) will be above the maximum, which "
1092 "e.g. the OSD cannot display correctly.") );
1093
1094 setWhatsThis(volnorm_check, tr("Volume normalization by default"),
1095 tr("Maximizes the volume without distorting the sound.") );
1096
1097 setWhatsThis(autosync_check, tr("Audio/video auto synchronization"),
1098 tr("Gradually adjusts the A/V sync based on audio delay "
1099 "measurements.") );
1100
1101 setWhatsThis(mc_spin, tr("A-V sync correction"),
1102 tr("Maximum A-V sync correction per frame (in seconds)") );
1103
1104 addSectionTitle(tr("Preferred audio and subtitles"));
1105
1106 setWhatsThis(audio_lang_edit, tr("Preferred audio language"),
1107 tr("Here you can type your preferred language for the audio streams. "
1108 "When a media with multiple audio streams is found, SMPlayer will "
1109 "try to use your preferred language.<br>"
1110 "This only will work with media that offer info about the language "
1111 "of the audio streams, like DVDs or mkv files.<br>"
1112 "This field accepts regular expressions. Example: <b>es|esp|spa</b> "
1113 "will select the audio track if it matches with <i>es</i>, "
1114 "<i>esp</i> or <i>spa</i>.") );
1115
1116 setWhatsThis(subtitle_lang_edit, tr("Preferred subtitle language"),
1117 tr("Here you can type your preferred language for the subtitle stream. "
1118 "When a media with multiple subtitle streams is found, SMPlayer will "
1119 "try to use your preferred language.<br>"
1120 "This only will work with media that offer info about the language "
1121 "of the subtitle streams, like DVDs or mkv files.<br>"
1122 "This field accepts regular expressions. Example: <b>es|esp|spa</b> "
1123 "will select the subtitle stream if it matches with <i>es</i>, "
1124 "<i>esp</i> or <i>spa</i>.") );
1125
1126 setWhatsThis(audio_track_spin, tr("Audio track"),
1127 tr("Specifies the default audio track which will be used when playing "
1128 "new files. If the track doesn't exist, the first one will be used. "
1129 "<br><b>Note:</b> the <i>\"preferred audio language\"</i> has "
1130 "preference over this option.") );
1131
1132 setWhatsThis(subtitle_track_spin, tr("Subtitle track"),
1133 tr("Specifies the default subtitle track which will be used when "
1134 "playing new files. If the track doesn't exist, the first one "
1135 "will be used. <br><b>Note:</b> the <i>\"preferred subtitle "
1136 "language\"</i> has preference over this option.") );
1137
1138}
1139
1140#include "moc_prefgeneral.cpp"
Note: See TracBrowser for help on using the repository browser.