Ignore:
Timestamp:
Jan 24, 2017, 12:41:54 PM (8 years ago)
Author:
Silvan Scherrer
Message:

SMPlayer: update trunk to version 17.1.0

Location:
smplayer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • smplayer/trunk

  • smplayer/trunk/src/prefnetwork.cpp

    r181 r188  
    11/*  smplayer, GUI front-end for mplayer.
    2     Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net>
     2    Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
    33
    44    This program is free software; you can redistribute it and/or modify
     
    2424#ifdef YOUTUBE_SUPPORT
    2525#include "retrieveyoutubeurl.h"
     26#endif
     27
     28#ifdef CHROMECAST_SUPPORT
     29#include "chromecast.h"
    2630#endif
    2731
     
    106110        yt_user_agent_edit->setText( pref->yt_user_agent );
    107111#endif
     112
     113#ifdef CHROMECAST_SUPPORT
     114        Chromecast * cc = Chromecast::instance();
     115        setLocalIP(cc->localAddress(), cc->localAddresses());
     116        port_spin->setValue(cc->serverPort());
     117        directory_listing_check->setChecked(cc->directoryListing());
     118#endif
    108119}
    109120
     
    124135        pref->yt_user_agent = yt_user_agent_edit->text();
    125136#endif
     137
     138#ifdef CHROMECAST_SUPPORT
     139        Chromecast * cc = Chromecast::instance();
     140        cc->setLocalAddress(localIP());
     141        cc->setServerPort(port_spin->value());
     142        cc->setDirectoryListing(directory_listing_check->isChecked());
     143#endif
    126144}
    127145
     
    163181        youtube_box->setEnabled(i == Preferences::StreamingYT || i == Preferences::StreamingAuto);
    164182}
     183
     184#ifdef CHROMECAST_SUPPORT
     185void PrefNetwork::setLocalIP(const QString & ip, const QStringList & values) {
     186        local_ip_combo->clear();
     187        local_ip_combo->addItem(tr("Auto"));
     188        local_ip_combo->addItems(values);
     189
     190        if (ip.isEmpty()) {
     191                local_ip_combo->setCurrentIndex(0);
     192        } else {
     193                int pos = local_ip_combo->findText(ip);
     194                if (pos > -1) {
     195                        local_ip_combo->setCurrentIndex(pos);
     196                } else {
     197                        local_ip_combo->setEditText(ip);
     198                }
     199        }
     200}
     201
     202QString PrefNetwork::localIP() {
     203        if (local_ip_combo->currentIndex() == 0) {
     204                return "";
     205        } else {
     206                return local_ip_combo->currentText();
     207        }
     208}
     209#endif
    165210
    166211void PrefNetwork::createHelp() {
     
    204249#endif
    205250
     251#ifdef CHROMECAST_SUPPORT
     252        addSectionTitle(tr("Chromecast"));
     253
     254        setWhatsThis(local_ip_combo, tr("Local IP"),
     255                tr("The local IP address of this computer. It will be passed to Chromecast "
     256            "so that it can access the files from this computer.") );
     257
     258        setWhatsThis(port_spin, tr("Port"),
     259                tr("The port that the web server will use.") );
     260
     261        setWhatsThis(directory_listing_check, tr("Directory listing"),
     262                tr("When the web server is running, any device in your network can access the "
     263           "files from this computer. If this option is on, any device can get a listing "
     264           "of the files in this computer. "
     265           "If this option is off, the list won't be available.") );
     266#endif
     267
    206268        addSectionTitle(tr("Proxy"));
    207269
Note: See TracChangeset for help on using the changeset viewer.