source: smplayer/vendor/0.6.9/src/prefgeneral.cpp@ 189

Last change on this file since 189 was 90, checked in by Silvan Scherrer, 16 years ago

smplayer: import 0.6.9

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