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

Last change on this file since 128 was 124, checked in by Silvan Scherrer, 13 years ago

SMPlayer: 0.7.1 trunk update

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