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

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

SMPlayer: update trunk to latest 0.8.7

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