Ignore:
Timestamp:
May 3, 2016, 5:25:45 PM (9 years ago)
Author:
Silvan Scherrer
Message:

smplayer: update trunk to version 16.4

Location:
smplayer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • smplayer/trunk

  • smplayer/trunk/src/prefgeneral.cpp

    r170 r176  
    11/*  smplayer, GUI front-end for mplayer.
    2     Copyright (C) 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net>
     2    Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net>
    33
    44    This program is free software; you can redistribute it and/or modify
     
    2525#include "paths.h"
    2626#include "vdpauproperties.h"
     27#include "playerid.h"
    2728
    2829#if USE_ALSA_DEVICES || USE_DSOUND_DEVICES
    2930#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
    3048#endif
    3149
     
    4058        // Read driver info from InfoReader:
    4159        InfoReader * i = InfoReader::obj();
     60        i->getInfo();
    4261        vo_list = i->voList();
    4362        ao_list = i->aoList();
     
    7594#endif
    7695
     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
    77105        // Channels combo
    78106        channels_combo->addItem( "2", MediaSettings::ChStereo );
     
    82110        channels_combo->addItem( "8", MediaSettings::ChFull71 );
    83111
     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
    84120        connect(vo_combo, SIGNAL(currentIndexChanged(int)),
    85121            this, SLOT(vo_combo_changed(int)));
     
    104140void PrefGeneral::retranslateStrings() {
    105141        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
    106151
    107152        channels_combo->setItemText(0, tr("2 (Stereo)") );
     
    135180        */
    136181
    137         mplayerbin_edit->setCaption(tr("Select the mplayer executable"));
     182        mplayerbin_edit->setCaption(tr("Select the %1 executable").arg(PLAYER_NAME));
    138183#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
    139184        mplayerbin_edit->setFilter(tr("Executables") +" (*.exe)");
     
    153198            "<i>es</i>, <i>esp</i> or <i>spa</i>."));
    154199
     200#ifndef MPLAYER_MPV_SELECTION
     201        executable_label->setText( tr("%1 &executable:").arg(PLAYER_NAME) );
     202#endif
     203
    155204        createHelp();
    156205}
     
    161210        setUseScreenshots( pref->use_screenshot );
    162211        setScreenshotDir( pref->screenshot_directory );
     212#ifdef MPV_SUPPORT
     213        screenshot_template_edit->setText( pref->screenshot_template );
     214        setScreenshotFormat(pref->screenshot_format);
     215#endif
    163216
    164217        QString vo = pref->vo;
     
    260313                qDebug("PrefGeneral::getData: mplayer binary has changed, getting version number");
    261314                // 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();
    264317                // 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();
    269320                updateDriverCombos();
    270 #endif
    271321        }
    272322
    273323        TEST_AND_SET(pref->use_screenshot, useScreenshots());
    274324        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
    275330        TEST_AND_SET(pref->vo, VO());
    276     TEST_AND_SET(pref->ao, AO());
     331        TEST_AND_SET(pref->ao, AO());
    277332
    278333        bool dont_remember_ms = !rememberSettings();
     
    280335
    281336        bool dont_remember_time = !rememberTimePos();
    282     TEST_AND_SET(pref->dont_remember_time_pos, dont_remember_time);
     337        TEST_AND_SET(pref->dont_remember_time_pos, dont_remember_time);
    283338
    284339        if (pref->file_settings_method != fileSettingsMethod()) {
     
    288343
    289344        pref->audio_lang = audioLang();
    290     pref->subtitle_lang = subtitleLang();
     345        pref->subtitle_lang = subtitleLang();
    291346
    292347        pref->initial_audio_track = audioTrack();
     
    347402
    348403void 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();
    351406
    352407        vo_combo->clear();
    353408        ao_combo->clear();
     409
     410        vo_combo->addItem(tr("Default"), "player_default");
     411        ao_combo->addItem(tr("Default"), "player_default");
    354412
    355413        QString vo;
     
    445503        ao_combo->addItem( tr("User defined..."), "user_defined" );
    446504
    447         vo_combo->setCurrentIndex( vo_current );
    448         ao_combo->setCurrentIndex( ao_current );
     505        setVO(current_vo);
     506        setAO(current_ao);
    449507}
    450508
    451509void 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
    453524}
    454525
    455526QString 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
    456537        return mplayerbin_edit->text();
    457538}
     
    472553        return screenshot_edit->text();
    473554}
     555
     556#ifdef MPV_SUPPORT
     557void 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
     563QString PrefGeneral::screenshotFormat() {
     564        return screenshot_format_combo->currentText();
     565}
     566#endif
    474567
    475568void PrefGeneral::setVO( QString vo_driver ) {
     
    826919}
    827920
     921#ifdef MPLAYER_MPV_SELECTION
     922void 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
    828936void PrefGeneral::vo_combo_changed(int idx) {
    829937        qDebug("PrefGeneral::vo_combo_changed: %d", idx);
     
    876984        addSectionTitle(tr("General"));
    877985
    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>" +
    883995        tr("If this setting is wrong, SMPlayer won't be able to play "
    884996           "anything!") + "</b>");
     
    9111023           "SMPlayer will be stored. If the folder is not valid the "
    9121024           "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
    9131047
    9141048        setWhatsThis(pause_if_hidden_check, tr("Pause when minimized"),
     
    10611195
    10621196        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 "
    10641198           "asks the decoder to decode the audio into as many channels as "
    10651199           "specified. Then it is up to the decoder to fulfill the "
     
    10691203           "into the requested number of channels. "
    10701204           "<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) );
    10721206
    10731207        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.") );
    10761209
    10771210        setWhatsThis(global_volume_check, tr("Global volume"),
Note: See TracChangeset for help on using the changeset viewer.