Changeset 175 for smplayer/vendor/current/src/prefgeneral.cpp
- Timestamp:
- May 3, 2016, 2:14:41 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/vendor/current/src/prefgeneral.cpp
r168 r175 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 #else 42 #define PLAYER_COMBO_MPLAYER_PATH "mplayer" 43 #define PLAYER_COMBO_MPV_PATH "mpv" 44 #endif 30 45 #endif 31 46 … … 40 55 // Read driver info from InfoReader: 41 56 InfoReader * i = InfoReader::obj(); 57 i->getInfo(); 42 58 vo_list = i->voList(); 43 59 ao_list = i->aoList(); … … 75 91 #endif 76 92 93 #ifdef MPV_SUPPORT 94 screenshot_format_combo->addItems(QStringList() << "png" << "ppm" << "pgm" << "pgmyuv" << "tga" << "jpg" << "jpeg"); 95 #else 96 screenshot_template_label->hide(); 97 screenshot_template_edit->hide(); 98 screenshot_format_label->hide(); 99 screenshot_format_combo->hide(); 100 #endif 101 77 102 // Channels combo 78 103 channels_combo->addItem( "2", MediaSettings::ChStereo ); … … 82 107 channels_combo->addItem( "8", MediaSettings::ChFull71 ); 83 108 109 #ifdef MPLAYER_MPV_SELECTION 110 connect(player_combo, SIGNAL(currentIndexChanged(int)), 111 this, SLOT(player_combo_changed(int))); 112 #else 113 player_combo->hide(); 114 player_spacer->changeSize(0, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); 115 #endif 116 84 117 connect(vo_combo, SIGNAL(currentIndexChanged(int)), 85 118 this, SLOT(vo_combo_changed(int))); … … 104 137 void PrefGeneral::retranslateStrings() { 105 138 retranslateUi(this); 139 140 #ifdef MPLAYER_MPV_SELECTION 141 int player_item = player_combo->currentIndex(); 142 player_combo->clear(); 143 player_combo->addItem("mplayer", PLAYER_COMBO_MPLAYER); 144 player_combo->addItem("mpv", PLAYER_COMBO_MPV); 145 player_combo->addItem(tr("Other..."), PLAYER_COMBO_OTHER); 146 player_combo->setCurrentIndex(player_item); 147 #endif 106 148 107 149 channels_combo->setItemText(0, tr("2 (Stereo)") ); … … 135 177 */ 136 178 137 mplayerbin_edit->setCaption(tr("Select the mplayer executable"));179 mplayerbin_edit->setCaption(tr("Select the %1 executable").arg(PLAYER_NAME)); 138 180 #if defined(Q_OS_WIN) || defined(Q_OS_OS2) 139 181 mplayerbin_edit->setFilter(tr("Executables") +" (*.exe)"); … … 153 195 "<i>es</i>, <i>esp</i> or <i>spa</i>.")); 154 196 197 #ifndef MPLAYER_MPV_SELECTION 198 executable_label->setText( tr("%1 &executable:").arg(PLAYER_NAME) ); 199 #endif 200 155 201 createHelp(); 156 202 } … … 161 207 setUseScreenshots( pref->use_screenshot ); 162 208 setScreenshotDir( pref->screenshot_directory ); 209 #ifdef MPV_SUPPORT 210 screenshot_template_edit->setText( pref->screenshot_template ); 211 setScreenshotFormat(pref->screenshot_format); 212 #endif 163 213 164 214 QString vo = pref->vo; … … 260 310 qDebug("PrefGeneral::getData: mplayer binary has changed, getting version number"); 261 311 // Forces to get info from mplayer to update version number 262 InfoReader i( pref->mplayer_bin);263 i .getInfo();312 InfoReader * i = InfoReader::obj(); 313 i->getInfo(); 264 314 // 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(); 315 vo_list = i->voList(); 316 ao_list = i->aoList(); 269 317 updateDriverCombos(); 270 #endif271 318 } 272 319 273 320 TEST_AND_SET(pref->use_screenshot, useScreenshots()); 274 321 TEST_AND_SET(pref->screenshot_directory, screenshotDir()); 322 #ifdef MPV_SUPPORT 323 TEST_AND_SET(pref->screenshot_template, screenshot_template_edit->text()); 324 TEST_AND_SET(pref->screenshot_format, screenshotFormat()); 325 #endif 326 275 327 TEST_AND_SET(pref->vo, VO()); 276 328 TEST_AND_SET(pref->ao, AO()); 277 329 278 330 bool dont_remember_ms = !rememberSettings(); … … 280 332 281 333 bool dont_remember_time = !rememberTimePos(); 282 334 TEST_AND_SET(pref->dont_remember_time_pos, dont_remember_time); 283 335 284 336 if (pref->file_settings_method != fileSettingsMethod()) { … … 288 340 289 341 pref->audio_lang = audioLang(); 290 342 pref->subtitle_lang = subtitleLang(); 291 343 292 344 pref->initial_audio_track = audioTrack(); … … 347 399 348 400 void PrefGeneral::updateDriverCombos() { 349 int vo_current = vo_combo->currentIndex();350 int ao_current = ao_combo->currentIndex();401 QString current_vo = VO(); 402 QString current_ao = AO(); 351 403 352 404 vo_combo->clear(); 353 405 ao_combo->clear(); 406 407 vo_combo->addItem(tr("Default"), "player_default"); 408 ao_combo->addItem(tr("Default"), "player_default"); 354 409 355 410 QString vo; … … 445 500 ao_combo->addItem( tr("User defined..."), "user_defined" ); 446 501 447 vo_combo->setCurrentIndex( vo_current);448 ao_combo->setCurrentIndex( ao_current);502 setVO(current_vo); 503 setAO(current_ao); 449 504 } 450 505 451 506 void PrefGeneral::setMplayerPath( QString path ) { 452 mplayerbin_edit->setText( path ); 507 mplayerbin_edit->setText( path ); 508 509 #ifdef MPLAYER_MPV_SELECTION 510 if (path == PLAYER_COMBO_MPLAYER_PATH) { 511 player_combo->setCurrentIndex(PLAYER_COMBO_MPLAYER); 512 } 513 else 514 if (path == PLAYER_COMBO_MPV_PATH) { 515 player_combo->setCurrentIndex(PLAYER_COMBO_MPV); 516 } 517 else { 518 player_combo->setCurrentIndex(PLAYER_COMBO_OTHER); 519 } 520 #endif 453 521 } 454 522 455 523 QString PrefGeneral::mplayerPath() { 524 #ifdef MPLAYER_MPV_SELECTION 525 if (player_combo->currentIndex() == PLAYER_COMBO_MPLAYER) { 526 return PLAYER_COMBO_MPLAYER_PATH; 527 } 528 else 529 if (player_combo->currentIndex() == PLAYER_COMBO_MPV) { 530 return PLAYER_COMBO_MPV_PATH; 531 } 532 else 533 #endif 456 534 return mplayerbin_edit->text(); 457 535 } … … 472 550 return screenshot_edit->text(); 473 551 } 552 553 #ifdef MPV_SUPPORT 554 void PrefGeneral::setScreenshotFormat(const QString format) { 555 int i = screenshot_format_combo->findText(format); 556 if (i < 0) i = 0; 557 screenshot_format_combo->setCurrentIndex(i); 558 } 559 560 QString PrefGeneral::screenshotFormat() { 561 return screenshot_format_combo->currentText(); 562 } 563 #endif 474 564 475 565 void PrefGeneral::setVO( QString vo_driver ) { … … 826 916 } 827 917 918 #ifdef MPLAYER_MPV_SELECTION 919 void PrefGeneral::player_combo_changed(int idx) { 920 qDebug("PrefGeneral::player_combo_changed: %d", idx); 921 int d = player_combo->itemData(idx).toInt(); 922 if (d == PLAYER_COMBO_OTHER) { 923 player_spacer->changeSize(0, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); 924 mplayerbin_edit->setVisible(true); 925 //mplayerbin_edit->setFocus(); 926 } else { 927 player_spacer->changeSize(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 928 mplayerbin_edit->setVisible(false); 929 } 930 } 931 #endif 932 828 933 void PrefGeneral::vo_combo_changed(int idx) { 829 934 qDebug("PrefGeneral::vo_combo_changed: %d", idx); … … 876 981 addSectionTitle(tr("General")); 877 982 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>" + 983 #ifdef MPLAYER_MPV_SELECTION 984 setWhatsThis(player_combo, tr("Multimedia engine"), 985 tr("Select which multimedia engine you want to use, either MPlayer or mpv.") +" "+ 986 tr("The option 'other' allows you to manually select the path of the executable.") ); 987 #endif 988 989 setWhatsThis(mplayerbin_edit, tr("%1 executable").arg(PLAYER_NAME), 990 tr("Here you must specify the %1 " 991 "executable that SMPlayer will use.").arg(PLAYER_NAME) + "<br><b>" + 883 992 tr("If this setting is wrong, SMPlayer won't be able to play " 884 993 "anything!") + "</b>"); … … 911 1020 "SMPlayer will be stored. If the folder is not valid the " 912 1021 "screenshot feature will be disabled.") ); 1022 1023 #ifdef MPV_SUPPORT 1024 setWhatsThis(screenshot_template_edit, tr("Template for screenshots"), 1025 tr("This option specifies the filename template used to save screenshots.") + " " + 1026 tr("For example %1 would save the screenshot as 'moviename_0001.png'.").arg("%F_%04n") + "<br>" + 1027 tr("%1 specifies the filename of the video without the extension, " 1028 "%2 adds a 4 digit number padded with zeros.").arg("%F").arg("%04n") + " " + 1029 tr("For a full list of the template specifiers visit this link:") + 1030 " <a href=\"http://mpv.io/manual/stable/#options-screenshot-template\">" 1031 "http://mpv.io/manual/stable/#options-screenshot-template</a>" 1032 #ifdef MPLAYER_SUPPORT 1033 + "<br>" + tr("This option only works with mpv.") 1034 #endif 1035 ); 1036 1037 setWhatsThis(screenshot_format_combo, tr("Format for screenshots"), 1038 tr("This option allows to choose the image file type used for saving screenshots.") 1039 #ifdef MPLAYER_SUPPORT 1040 + " " + tr("This option only works with mpv.") 1041 #endif 1042 ); 1043 #endif 913 1044 914 1045 setWhatsThis(pause_if_hidden_check, tr("Pause when minimized"), … … 1061 1192 1062 1193 setWhatsThis(channels_combo, tr("Channels by default"), 1063 tr("Requests the number of playback channels. MPlayer"1194 tr("Requests the number of playback channels. %1 " 1064 1195 "asks the decoder to decode the audio into as many channels as " 1065 1196 "specified. Then it is up to the decoder to fulfill the " … … 1069 1200 "into the requested number of channels. " 1070 1201 "<b>Note</b>: This option is honored by codecs (AC3 only), " 1071 "filters (surround) and audio output drivers (OSS at least).") );1202 "filters (surround) and audio output drivers (OSS at least).").arg(PLAYER_NAME) ); 1072 1203 1073 1204 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.") ); 1205 tr("Allows to change the playback speed without altering pitch.") ); 1076 1206 1077 1207 setWhatsThis(global_volume_check, tr("Global volume"),
Note:
See TracChangeset
for help on using the changeset viewer.