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