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

Last change on this file since 182 was 182, checked in by Silvan Scherrer, 9 years ago

smplayer: restore some os/2 removals from vendor, fix branding

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