Changeset 176 for smplayer/trunk/src/prefgeneral.cpp
- Timestamp:
- May 3, 2016, 5:25:45 PM (9 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 175
- Property svn:mergeinfo changed
-
smplayer/trunk/src/prefgeneral.cpp
r170 r176 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 4Ricardo Villalba <rvm@users.sourceforge.net>2 Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net> 3 3 4 4 This program is free software; you can redistribute it and/or modify … … 25 25 #include "paths.h" 26 26 #include "vdpauproperties.h" 27 #include "playerid.h" 27 28 28 29 #if USE_ALSA_DEVICES || USE_DSOUND_DEVICES 29 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 30 48 #endif 31 49 … … 40 58 // Read driver info from InfoReader: 41 59 InfoReader * i = InfoReader::obj(); 60 i->getInfo(); 42 61 vo_list = i->voList(); 43 62 ao_list = i->aoList(); … … 75 94 #endif 76 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 77 105 // Channels combo 78 106 channels_combo->addItem( "2", MediaSettings::ChStereo ); … … 82 110 channels_combo->addItem( "8", MediaSettings::ChFull71 ); 83 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 84 120 connect(vo_combo, SIGNAL(currentIndexChanged(int)), 85 121 this, SLOT(vo_combo_changed(int))); … … 104 140 void PrefGeneral::retranslateStrings() { 105 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 106 151 107 152 channels_combo->setItemText(0, tr("2 (Stereo)") ); … … 135 180 */ 136 181 137 mplayerbin_edit->setCaption(tr("Select the mplayer executable"));182 mplayerbin_edit->setCaption(tr("Select the %1 executable").arg(PLAYER_NAME)); 138 183 #if defined(Q_OS_WIN) || defined(Q_OS_OS2) 139 184 mplayerbin_edit->setFilter(tr("Executables") +" (*.exe)"); … … 153 198 "<i>es</i>, <i>esp</i> or <i>spa</i>.")); 154 199 200 #ifndef MPLAYER_MPV_SELECTION 201 executable_label->setText( tr("%1 &executable:").arg(PLAYER_NAME) ); 202 #endif 203 155 204 createHelp(); 156 205 } … … 161 210 setUseScreenshots( pref->use_screenshot ); 162 211 setScreenshotDir( pref->screenshot_directory ); 212 #ifdef MPV_SUPPORT 213 screenshot_template_edit->setText( pref->screenshot_template ); 214 setScreenshotFormat(pref->screenshot_format); 215 #endif 163 216 164 217 QString vo = pref->vo; … … 260 313 qDebug("PrefGeneral::getData: mplayer binary has changed, getting version number"); 261 314 // Forces to get info from mplayer to update version number 262 InfoReader i( pref->mplayer_bin);263 i .getInfo();315 InfoReader * i = InfoReader::obj(); 316 i->getInfo(); 264 317 // Update the drivers list at the same time 265 //setDrivers( i.voList(), i.aoList() ); 266 #ifdef Q_OS_OS2 267 vo_list = i.voList(); 268 ao_list = i.aoList(); 318 vo_list = i->voList(); 319 ao_list = i->aoList(); 269 320 updateDriverCombos(); 270 #endif271 321 } 272 322 273 323 TEST_AND_SET(pref->use_screenshot, useScreenshots()); 274 324 TEST_AND_SET(pref->screenshot_directory, screenshotDir()); 325 #ifdef MPV_SUPPORT 326 TEST_AND_SET(pref->screenshot_template, screenshot_template_edit->text()); 327 TEST_AND_SET(pref->screenshot_format, screenshotFormat()); 328 #endif 329 275 330 TEST_AND_SET(pref->vo, VO()); 276 331 TEST_AND_SET(pref->ao, AO()); 277 332 278 333 bool dont_remember_ms = !rememberSettings(); … … 280 335 281 336 bool dont_remember_time = !rememberTimePos(); 282 337 TEST_AND_SET(pref->dont_remember_time_pos, dont_remember_time); 283 338 284 339 if (pref->file_settings_method != fileSettingsMethod()) { … … 288 343 289 344 pref->audio_lang = audioLang(); 290 345 pref->subtitle_lang = subtitleLang(); 291 346 292 347 pref->initial_audio_track = audioTrack(); … … 347 402 348 403 void PrefGeneral::updateDriverCombos() { 349 int vo_current = vo_combo->currentIndex();350 int ao_current = ao_combo->currentIndex();404 QString current_vo = VO(); 405 QString current_ao = AO(); 351 406 352 407 vo_combo->clear(); 353 408 ao_combo->clear(); 409 410 vo_combo->addItem(tr("Default"), "player_default"); 411 ao_combo->addItem(tr("Default"), "player_default"); 354 412 355 413 QString vo; … … 445 503 ao_combo->addItem( tr("User defined..."), "user_defined" ); 446 504 447 vo_combo->setCurrentIndex( vo_current);448 ao_combo->setCurrentIndex( ao_current);505 setVO(current_vo); 506 setAO(current_ao); 449 507 } 450 508 451 509 void PrefGeneral::setMplayerPath( QString path ) { 452 mplayerbin_edit->setText( path ); 510 mplayerbin_edit->setText( path ); 511 512 #ifdef MPLAYER_MPV_SELECTION 513 if (path == PLAYER_COMBO_MPLAYER_PATH) { 514 player_combo->setCurrentIndex(PLAYER_COMBO_MPLAYER); 515 } 516 else 517 if (path == PLAYER_COMBO_MPV_PATH) { 518 player_combo->setCurrentIndex(PLAYER_COMBO_MPV); 519 } 520 else { 521 player_combo->setCurrentIndex(PLAYER_COMBO_OTHER); 522 } 523 #endif 453 524 } 454 525 455 526 QString PrefGeneral::mplayerPath() { 527 #ifdef MPLAYER_MPV_SELECTION 528 if (player_combo->currentIndex() == PLAYER_COMBO_MPLAYER) { 529 return PLAYER_COMBO_MPLAYER_PATH; 530 } 531 else 532 if (player_combo->currentIndex() == PLAYER_COMBO_MPV) { 533 return PLAYER_COMBO_MPV_PATH; 534 } 535 else 536 #endif 456 537 return mplayerbin_edit->text(); 457 538 } … … 472 553 return screenshot_edit->text(); 473 554 } 555 556 #ifdef MPV_SUPPORT 557 void PrefGeneral::setScreenshotFormat(const QString format) { 558 int i = screenshot_format_combo->findText(format); 559 if (i < 0) i = 0; 560 screenshot_format_combo->setCurrentIndex(i); 561 } 562 563 QString PrefGeneral::screenshotFormat() { 564 return screenshot_format_combo->currentText(); 565 } 566 #endif 474 567 475 568 void PrefGeneral::setVO( QString vo_driver ) { … … 826 919 } 827 920 921 #ifdef MPLAYER_MPV_SELECTION 922 void PrefGeneral::player_combo_changed(int idx) { 923 qDebug("PrefGeneral::player_combo_changed: %d", idx); 924 int d = player_combo->itemData(idx).toInt(); 925 if (d == PLAYER_COMBO_OTHER) { 926 player_spacer->changeSize(0, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); 927 mplayerbin_edit->setVisible(true); 928 //mplayerbin_edit->setFocus(); 929 } else { 930 player_spacer->changeSize(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 931 mplayerbin_edit->setVisible(false); 932 } 933 } 934 #endif 935 828 936 void PrefGeneral::vo_combo_changed(int idx) { 829 937 qDebug("PrefGeneral::vo_combo_changed: %d", idx); … … 876 984 addSectionTitle(tr("General")); 877 985 878 setWhatsThis(mplayerbin_edit, tr("MPlayer executable"), 879 tr("Here you must specify the mplayer " 880 "executable that SMPlayer will use.<br>" 881 "SMPlayer requires at least MPlayer 1.0rc1 (although a recent " 882 "revision from SVN is highly recommended).") + "<br><b>" + 986 #ifdef MPLAYER_MPV_SELECTION 987 setWhatsThis(player_combo, tr("Multimedia engine"), 988 tr("Select which multimedia engine you want to use, either MPlayer or mpv.") +" "+ 989 tr("The option 'other' allows you to manually select the path of the executable.") ); 990 #endif 991 992 setWhatsThis(mplayerbin_edit, tr("%1 executable").arg(PLAYER_NAME), 993 tr("Here you must specify the %1 " 994 "executable that SMPlayer will use.").arg(PLAYER_NAME) + "<br><b>" + 883 995 tr("If this setting is wrong, SMPlayer won't be able to play " 884 996 "anything!") + "</b>"); … … 911 1023 "SMPlayer will be stored. If the folder is not valid the " 912 1024 "screenshot feature will be disabled.") ); 1025 1026 #ifdef MPV_SUPPORT 1027 setWhatsThis(screenshot_template_edit, tr("Template for screenshots"), 1028 tr("This option specifies the filename template used to save screenshots.") + " " + 1029 tr("For example %1 would save the screenshot as 'moviename_0001.png'.").arg("%F_%04n") + "<br>" + 1030 tr("%1 specifies the filename of the video without the extension, " 1031 "%2 adds a 4 digit number padded with zeros.").arg("%F").arg("%04n") + " " + 1032 tr("For a full list of the template specifiers visit this link:") + 1033 " <a href=\"http://mpv.io/manual/stable/#options-screenshot-template\">" 1034 "http://mpv.io/manual/stable/#options-screenshot-template</a>" 1035 #ifdef MPLAYER_SUPPORT 1036 + "<br>" + tr("This option only works with mpv.") 1037 #endif 1038 ); 1039 1040 setWhatsThis(screenshot_format_combo, tr("Format for screenshots"), 1041 tr("This option allows to choose the image file type used for saving screenshots.") 1042 #ifdef MPLAYER_SUPPORT 1043 + " " + tr("This option only works with mpv.") 1044 #endif 1045 ); 1046 #endif 913 1047 914 1048 setWhatsThis(pause_if_hidden_check, tr("Pause when minimized"), … … 1061 1195 1062 1196 setWhatsThis(channels_combo, tr("Channels by default"), 1063 tr("Requests the number of playback channels. MPlayer"1197 tr("Requests the number of playback channels. %1 " 1064 1198 "asks the decoder to decode the audio into as many channels as " 1065 1199 "specified. Then it is up to the decoder to fulfill the " … … 1069 1203 "into the requested number of channels. " 1070 1204 "<b>Note</b>: This option is honored by codecs (AC3 only), " 1071 "filters (surround) and audio output drivers (OSS at least).") );1205 "filters (surround) and audio output drivers (OSS at least).").arg(PLAYER_NAME) ); 1072 1206 1073 1207 setWhatsThis(scaletempo_combo, tr("High speed playback without altering pitch"), 1074 tr("Allows to change the playback speed without altering pitch. " 1075 "Requires at least MPlayer dev-SVN-r24924.") ); 1208 tr("Allows to change the playback speed without altering pitch.") ); 1076 1209 1077 1210 setWhatsThis(global_volume_check, tr("Global volume"),
Note:
See TracChangeset
for help on using the changeset viewer.