summaryrefslogtreecommitdiff
path: root/src/prefgeneral.cpp
diff options
context:
space:
mode:
authorMateusz Łukasik <mati75@linuxmint.pl>2016-04-08 10:03:05 +0200
committerMateusz Łukasik <mati75@linuxmint.pl>2016-04-08 10:03:05 +0200
commit1a2f0c9c1087899a00298db8fa70518d3c1e69f8 (patch)
tree7efa117e122fbe21eb6a832540007aeeef377fcb /src/prefgeneral.cpp
parentba0162e8cb8a12c90ef9775f5a20a6da095a0b35 (diff)
Imported Upstream version 16.4.0~ds0
Diffstat (limited to 'src/prefgeneral.cpp')
-rw-r--r--src/prefgeneral.cpp97
1 files changed, 90 insertions, 7 deletions
diff --git a/src/prefgeneral.cpp b/src/prefgeneral.cpp
index d1021c1..7bc52ff 100644
--- a/src/prefgeneral.cpp
+++ b/src/prefgeneral.cpp
@@ -30,6 +30,20 @@
#include "deviceinfo.h"
#endif
+#ifdef MPLAYER_MPV_SELECTION
+ #define PLAYER_COMBO_MPLAYER 0
+ #define PLAYER_COMBO_MPV 1
+ #define PLAYER_COMBO_OTHER 2
+
+ #ifdef Q_OS_WIN
+ #define PLAYER_COMBO_MPLAYER_PATH "mplayer/mplayer.exe"
+ #define PLAYER_COMBO_MPV_PATH "mpv/mpv.exe"
+ #else
+ #define PLAYER_COMBO_MPLAYER_PATH "mplayer"
+ #define PLAYER_COMBO_MPV_PATH "mpv"
+ #endif
+#endif
+
PrefGeneral::PrefGeneral(QWidget * parent, Qt::WindowFlags f)
: PrefWidget(parent, f )
{
@@ -92,6 +106,14 @@ PrefGeneral::PrefGeneral(QWidget * parent, Qt::WindowFlags f)
channels_combo->addItem( "7", MediaSettings::ChFull61 );
channels_combo->addItem( "8", MediaSettings::ChFull71 );
+#ifdef MPLAYER_MPV_SELECTION
+ connect(player_combo, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(player_combo_changed(int)));
+#else
+ player_combo->hide();
+ player_spacer->changeSize(0, 20, QSizePolicy::Fixed, QSizePolicy::Minimum);
+#endif
+
connect(vo_combo, SIGNAL(currentIndexChanged(int)),
this, SLOT(vo_combo_changed(int)));
connect(ao_combo, SIGNAL(currentIndexChanged(int)),
@@ -115,6 +137,15 @@ QPixmap PrefGeneral::sectionIcon() {
void PrefGeneral::retranslateStrings() {
retranslateUi(this);
+#ifdef MPLAYER_MPV_SELECTION
+ int player_item = player_combo->currentIndex();
+ player_combo->clear();
+ player_combo->addItem("mplayer", PLAYER_COMBO_MPLAYER);
+ player_combo->addItem("mpv", PLAYER_COMBO_MPV);
+ player_combo->addItem(tr("Other..."), PLAYER_COMBO_OTHER);
+ player_combo->setCurrentIndex(player_item);
+#endif
+
channels_combo->setItemText(0, tr("2 (Stereo)") );
channels_combo->setItemText(1, tr("4 (4.0 Surround)") );
channels_combo->setItemText(2, tr("6 (5.1 Surround)") );
@@ -145,7 +176,7 @@ void PrefGeneral::retranslateStrings() {
volume_icon->setPixmap( Images::icon("speaker") );
*/
- mplayerbin_edit->setCaption(tr("Select the mplayer executable"));
+ mplayerbin_edit->setCaption(tr("Select the %1 executable").arg(PLAYER_NAME));
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
mplayerbin_edit->setFilter(tr("Executables") +" (*.exe)");
#else
@@ -163,7 +194,9 @@ void PrefGeneral::retranslateStrings() {
"Example: <b>es|esp|spa</b> will select the track if it matches with "
"<i>es</i>, <i>esp</i> or <i>spa</i>."));
+#ifndef MPLAYER_MPV_SELECTION
executable_label->setText( tr("%1 &executable:").arg(PLAYER_NAME) );
+#endif
createHelp();
}
@@ -472,9 +505,32 @@ void PrefGeneral::updateDriverCombos() {
void PrefGeneral::setMplayerPath( QString path ) {
mplayerbin_edit->setText( path );
+
+#ifdef MPLAYER_MPV_SELECTION
+ if (path == PLAYER_COMBO_MPLAYER_PATH) {
+ player_combo->setCurrentIndex(PLAYER_COMBO_MPLAYER);
+ }
+ else
+ if (path == PLAYER_COMBO_MPV_PATH) {
+ player_combo->setCurrentIndex(PLAYER_COMBO_MPV);
+ }
+ else {
+ player_combo->setCurrentIndex(PLAYER_COMBO_OTHER);
+ }
+#endif
}
QString PrefGeneral::mplayerPath() {
+#ifdef MPLAYER_MPV_SELECTION
+ if (player_combo->currentIndex() == PLAYER_COMBO_MPLAYER) {
+ return PLAYER_COMBO_MPLAYER_PATH;
+ }
+ else
+ if (player_combo->currentIndex() == PLAYER_COMBO_MPV) {
+ return PLAYER_COMBO_MPV_PATH;
+ }
+ else
+#endif
return mplayerbin_edit->text();
}
@@ -859,6 +915,21 @@ Preferences::OptionState PrefGeneral::scaleTempoFilter() {
return scaletempo_combo->state();
}
+#ifdef MPLAYER_MPV_SELECTION
+void PrefGeneral::player_combo_changed(int idx) {
+ qDebug("PrefGeneral::player_combo_changed: %d", idx);
+ int d = player_combo->itemData(idx).toInt();
+ if (d == PLAYER_COMBO_OTHER) {
+ player_spacer->changeSize(0, 20, QSizePolicy::Fixed, QSizePolicy::Minimum);
+ mplayerbin_edit->setVisible(true);
+ //mplayerbin_edit->setFocus();
+ } else {
+ player_spacer->changeSize(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+ mplayerbin_edit->setVisible(false);
+ }
+}
+#endif
+
void PrefGeneral::vo_combo_changed(int idx) {
qDebug("PrefGeneral::vo_combo_changed: %d", idx);
bool visible = (vo_combo->itemData(idx).toString() == "user_defined");
@@ -909,6 +980,12 @@ void PrefGeneral::createHelp() {
addSectionTitle(tr("General"));
+#ifdef MPLAYER_MPV_SELECTION
+ setWhatsThis(player_combo, tr("Multimedia engine"),
+ tr("Select which multimedia engine you want to use, either MPlayer or mpv.") +" "+
+ tr("The option 'other' allows you to manually select the path of the executable.") );
+#endif
+
setWhatsThis(mplayerbin_edit, tr("%1 executable").arg(PLAYER_NAME),
tr("Here you must specify the %1 "
"executable that SMPlayer will use.").arg(PLAYER_NAME) + "<br><b>" +
@@ -951,12 +1028,18 @@ void PrefGeneral::createHelp() {
"%2 adds a 4 digit number padded with zeros.").arg("%F").arg("%04n") + " " +
tr("For a full list of the template specifiers visit this link:") +
" <a href=\"http://mpv.io/manual/stable/#options-screenshot-template\">"
- "http://mpv.io/manual/stable/#options-screenshot-template</a>" + "<br>" +
- tr("This option only works with mpv.") );
+ "http://mpv.io/manual/stable/#options-screenshot-template</a>"
+ #ifdef MPLAYER_SUPPORT
+ + "<br>" + tr("This option only works with mpv.")
+ #endif
+ );
setWhatsThis(screenshot_format_combo, tr("Format for screenshots"),
- tr("This option allows to choose the image file type used for saving screenshots.") + " " +
- tr("This option only works with mpv.") );
+ tr("This option allows to choose the image file type used for saving screenshots.")
+ #ifdef MPLAYER_SUPPORT
+ + " " + tr("This option only works with mpv.")
+ #endif
+ );
#endif
setWhatsThis(pause_if_hidden_check, tr("Pause when minimized"),
@@ -1108,7 +1191,7 @@ void PrefGeneral::createHelp() {
"option is enabled.") );
setWhatsThis(channels_combo, tr("Channels by default"),
- tr("Requests the number of playback channels. MPlayer "
+ tr("Requests the number of playback channels. %1 "
"asks the decoder to decode the audio into as many channels as "
"specified. Then it is up to the decoder to fulfill the "
"requirement. This is usually only important when playing "
@@ -1116,7 +1199,7 @@ void PrefGeneral::createHelp() {
"the decoding by default and correctly downmixes the audio "
"into the requested number of channels. "
"<b>Note</b>: This option is honored by codecs (AC3 only), "
- "filters (surround) and audio output drivers (OSS at least).") );
+ "filters (surround) and audio output drivers (OSS at least).").arg(PLAYER_NAME) );
setWhatsThis(scaletempo_combo, tr("High speed playback without altering pitch"),
tr("Allows to change the playback speed without altering pitch.") );