Ignore:
Timestamp:
May 3, 2016, 2:14:41 PM (9 years ago)
Author:
Silvan Scherrer
Message:

smplayer: update vendor to version 16.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • smplayer/vendor/current/src/prefgeneral.cpp

    r168 r175  
    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 #else
     42  #define PLAYER_COMBO_MPLAYER_PATH "mplayer"
     43  #define PLAYER_COMBO_MPV_PATH "mpv"
     44 #endif
    3045#endif
    3146
     
    4055        // Read driver info from InfoReader:
    4156        InfoReader * i = InfoReader::obj();
     57        i->getInfo();
    4258        vo_list = i->voList();
    4359        ao_list = i->aoList();
     
    7591#endif
    7692
     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
    77102        // Channels combo
    78103        channels_combo->addItem( "2", MediaSettings::ChStereo );
     
    82107        channels_combo->addItem( "8", MediaSettings::ChFull71 );
    83108
     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
    84117        connect(vo_combo, SIGNAL(currentIndexChanged(int)),
    85118            this, SLOT(vo_combo_changed(int)));
     
    104137void PrefGeneral::retranslateStrings() {
    105138        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
    106148
    107149        channels_combo->setItemText(0, tr("2 (Stereo)") );
     
    135177        */
    136178
    137         mplayerbin_edit->setCaption(tr("Select the mplayer executable"));
     179        mplayerbin_edit->setCaption(tr("Select the %1 executable").arg(PLAYER_NAME));
    138180#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
    139181        mplayerbin_edit->setFilter(tr("Executables") +" (*.exe)");
     
    153195            "<i>es</i>, <i>esp</i> or <i>spa</i>."));
    154196
     197#ifndef MPLAYER_MPV_SELECTION
     198        executable_label->setText( tr("%1 &executable:").arg(PLAYER_NAME) );
     199#endif
     200
    155201        createHelp();
    156202}
     
    161207        setUseScreenshots( pref->use_screenshot );
    162208        setScreenshotDir( pref->screenshot_directory );
     209#ifdef MPV_SUPPORT
     210        screenshot_template_edit->setText( pref->screenshot_template );
     211        setScreenshotFormat(pref->screenshot_format);
     212#endif
    163213
    164214        QString vo = pref->vo;
     
    260310                qDebug("PrefGeneral::getData: mplayer binary has changed, getting version number");
    261311                // 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();
    264314                // 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();
    269317                updateDriverCombos();
    270 #endif
    271318        }
    272319
    273320        TEST_AND_SET(pref->use_screenshot, useScreenshots());
    274321        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
    275327        TEST_AND_SET(pref->vo, VO());
    276     TEST_AND_SET(pref->ao, AO());
     328        TEST_AND_SET(pref->ao, AO());
    277329
    278330        bool dont_remember_ms = !rememberSettings();
     
    280332
    281333        bool dont_remember_time = !rememberTimePos();
    282     TEST_AND_SET(pref->dont_remember_time_pos, dont_remember_time);
     334        TEST_AND_SET(pref->dont_remember_time_pos, dont_remember_time);
    283335
    284336        if (pref->file_settings_method != fileSettingsMethod()) {
     
    288340
    289341        pref->audio_lang = audioLang();
    290     pref->subtitle_lang = subtitleLang();
     342        pref->subtitle_lang = subtitleLang();
    291343
    292344        pref->initial_audio_track = audioTrack();
     
    347399
    348400void 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();
    351403
    352404        vo_combo->clear();
    353405        ao_combo->clear();
     406
     407        vo_combo->addItem(tr("Default"), "player_default");
     408        ao_combo->addItem(tr("Default"), "player_default");
    354409
    355410        QString vo;
     
    445500        ao_combo->addItem( tr("User defined..."), "user_defined" );
    446501
    447         vo_combo->setCurrentIndex( vo_current );
    448         ao_combo->setCurrentIndex( ao_current );
     502        setVO(current_vo);
     503        setAO(current_ao);
    449504}
    450505
    451506void 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
    453521}
    454522
    455523QString 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
    456534        return mplayerbin_edit->text();
    457535}
     
    472550        return screenshot_edit->text();
    473551}
     552
     553#ifdef MPV_SUPPORT
     554void 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
     560QString PrefGeneral::screenshotFormat() {
     561        return screenshot_format_combo->currentText();
     562}
     563#endif
    474564
    475565void PrefGeneral::setVO( QString vo_driver ) {
     
    826916}
    827917
     918#ifdef MPLAYER_MPV_SELECTION
     919void 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
    828933void PrefGeneral::vo_combo_changed(int idx) {
    829934        qDebug("PrefGeneral::vo_combo_changed: %d", idx);
     
    876981        addSectionTitle(tr("General"));
    877982
    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>" +
    883992        tr("If this setting is wrong, SMPlayer won't be able to play "
    884993           "anything!") + "</b>");
     
    9111020           "SMPlayer will be stored. If the folder is not valid the "
    9121021           "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
    9131044
    9141045        setWhatsThis(pause_if_hidden_check, tr("Pause when minimized"),
     
    10611192
    10621193        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 "
    10641195           "asks the decoder to decode the audio into as many channels as "
    10651196           "specified. Then it is up to the decoder to fulfill the "
     
    10691200           "into the requested number of channels. "
    10701201           "<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) );
    10721203
    10731204        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.") );
    10761206
    10771207        setWhatsThis(global_volume_check, tr("Global volume"),
Note: See TracChangeset for help on using the changeset viewer.