Пример #1
0
void Updater::getFile( const QUrl &url )
{
    QNetworkRequest request( url );
    request.setRawHeader( "User-Agent", "QMPlay2" );
    QNetworkReply *reply = net.get( request );
    connect( reply, SIGNAL( metaDataChanged() ), this, SLOT( headerChanged() ) );
    connect( reply, SIGNAL( readyRead() ), this, SLOT( writeToFile() ) );
    connect( reply, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( downloadprogress( qint64, qint64 ) ) );
    connect( reply, SIGNAL( finished() ), this, SLOT( downloadFinished() ) );
    reply->ignoreSslErrors();
    firstChunk = true;
}
Пример #2
0
HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request,
        const QByteArray &fileData, const QString& mimeType)
    : data(fileData), origLen(fileData.length())
{
    setRequest(request);
    setOpenMode(QIODevice::ReadOnly);

    setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
    setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen));
    QTimer::singleShot(0, this, SIGNAL(metaDataChanged()));
    QTimer::singleShot(0, this, SIGNAL(readyRead()));
}
Пример #3
0
HttpThread::HttpThread(string const & url,
                       downloader::IHttpThreadCallback & cb,
                       int64_t beg,
                       int64_t end,
                       int64_t size,
                       string const & pb)
  : m_callback(cb), m_begRange(beg), m_endRange(end), m_downloadedBytes(0), m_expectedSize(size)
{
  QUrl const qUrl(url.c_str());
  QNetworkRequest request(qUrl);

  // use Range header only if we don't download whole file from start
  if (!(beg == 0 && end < 0))
  {
    if (end > 0)
    {
      LOG(LDEBUG, (url, "downloading range [", beg, ",", end, "]"));
      QString const range = QString("bytes=") + QString::number(beg)
                            + '-' + QString::number(end);
      request.setRawHeader("Range", range.toUtf8());
    }
    else
    {
      LOG(LDEBUG, (url, "resuming download from position", beg));
      QString const range = QString("bytes=") + QString::number(beg) + '-';
      request.setRawHeader("Range", range.toUtf8());
    }
  }

  // set user-agent with unique client id only for mapswithme requests
  if (url.find("mapswithme.com") != string::npos)
  {
    static string const uid = GetPlatform().UniqueClientId();
    request.setRawHeader("User-Agent", uid.c_str());
  }

  /// Use single instance for whole app
  static QNetworkAccessManager netManager;

  if (pb.empty())
    m_reply = netManager.get(request);
  else
  {
    request.setRawHeader("Content-Type", "application/json");
    request.setRawHeader("Content-Length", QString::number(pb.size()).toLocal8Bit());
    m_reply = netManager.post(request, pb.c_str());
  }

  connect(m_reply, SIGNAL(metaDataChanged()), this, SLOT(OnHeadersReceived()));
  connect(m_reply, SIGNAL(readyRead()), this, SLOT(OnChunkDownloaded()));
  connect(m_reply, SIGNAL(finished()), this, SLOT(OnDownloadFinished()));
  LOG(LDEBUG, ("Connecting to", url, "[", beg, ",", end, "]", "size=", size));
}
Пример #4
0
VideoEditor::VideoEditor(QQuickView *view, Doc *doc, QObject *parent)
    : FunctionEditor(view, doc, parent)
    , m_video(NULL)
{
    m_view->rootContext()->setContextProperty("videoEditor", this);
    m_mediaPlayer = new QMediaPlayer(this, QMediaPlayer::VideoSurface);

    connect(m_mediaPlayer, SIGNAL(metaDataChanged(QString,QVariant)),
            this, SLOT(slotMetaDataChanged(QString,QVariant)));
    connect(m_mediaPlayer, SIGNAL(durationChanged(qint64)),
                this, SLOT(slotDurationChanged(qint64)));
}
Пример #5
0
void AbstractNetworkJob::setupConnections(QNetworkReply *reply)
{
    connect(reply, SIGNAL(finished()), SLOT(slotFinished()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
    connect(reply, SIGNAL(encrypted()), SIGNAL(networkActivity()));
#endif
    connect(reply->manager(), SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), SIGNAL(networkActivity()));
    connect(reply, SIGNAL(sslErrors(QList<QSslError>)), SIGNAL(networkActivity()));
    connect(reply, SIGNAL(metaDataChanged()), SIGNAL(networkActivity()));
    connect(reply, SIGNAL(downloadProgress(qint64,qint64)), SIGNAL(networkActivity()));
    connect(reply, SIGNAL(uploadProgress(qint64,qint64)), SIGNAL(networkActivity()));
}
void QGstreamerMetaDataProvider::updateTags()
{
    QVariantMap oldTags = m_tags;
    m_tags.clear();
    bool changed = false;

    QMapIterator<QByteArray ,QVariant> i(m_session->tags());
    while (i.hasNext()) {
         i.next();
         //use gstreamer native keys for elements not in our key map
         QString key = qt_gstreamerMetaDataKeys()->value(i.key(), i.key());
         m_tags.insert(key, i.value());
         if (i.value() != oldTags.value(key)) {
             changed = true;
             emit metaDataChanged(key, i.value());
         }
    }

    if (changed)
        emit metaDataChanged();
}
QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObject *parent):
    QMediaService(parent)
{
    m_captureSession = 0;
    m_cameraControl = 0;
    m_metaDataControl = 0;

    m_videoInput = 0;
    m_audioInputEndpointSelector = 0;
    m_videoInputDevice = 0;

    m_videoOutput = 0;
    m_videoRenderer = 0;
    m_videoWindow = 0;
    m_videoWidgetControl = 0;
    m_imageCaptureControl = 0;

    if (service == Q_MEDIASERVICE_AUDIOSOURCE) {
        m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::Audio, this);
    }

   if (service == Q_MEDIASERVICE_CAMERA) {
        m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::AudioAndVideo, this);
        m_cameraControl = new QGstreamerCameraControl(m_captureSession);
        m_videoInput = new QGstreamerV4L2Input(this);
        m_captureSession->setVideoInput(m_videoInput);
        m_videoInputDevice = new QGstreamerVideoInputDeviceControl(this);

        connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)),
                m_videoInput, SLOT(setDevice(QString)));

        if (m_videoInputDevice->deviceCount())
            m_videoInput->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));

        m_videoRenderer = new QGstreamerVideoRenderer(this);

#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
        m_videoWindow = new QGstreamerVideoOverlay(this);
        m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
#endif    
        m_imageCaptureControl = new QGstreamerImageCaptureControl(m_captureSession);
    }

    m_audioInputEndpointSelector = new QGstreamerAudioInputEndpointSelector(this);
    connect(m_audioInputEndpointSelector, SIGNAL(activeEndpointChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString)));

    if (m_captureSession && m_audioInputEndpointSelector->availableEndpoints().size() > 0)
        m_captureSession->setCaptureDevice(m_audioInputEndpointSelector->defaultEndpoint());

    m_metaDataControl = new QGstreamerCaptureMetaDataControl(this);
    connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)),
            m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>)));
}
Пример #8
0
 void MediaController::playing(const MediaFileRef& file)
 {
     if (file.path().isEmpty())
     {
         stopped();
     }
     else
     {
         current_file = file;
         metaDataChanged();
     }
 }
void DirectShowMetaDataControl::customEvent(QEvent *event)
{
    if (event->type() == QEvent::Type(MetaDataChanged)) {
        event->accept();

        setMetadataAvailable(!m_metadata.isEmpty());

        emit metaDataChanged();
    } else {
        QMetaDataReaderControl::customEvent(event);
    }
}
Пример #10
0
void
EngineController::initializePhonon()
{
    DEBUG_BLOCK

    delete m_media;
    delete m_audio;
    delete m_preamp;

    PERF_LOG( "EngineController: loading phonon objects" )
    m_media = new Phonon::MediaObject( this );
    m_audio = new Phonon::AudioOutput( Phonon::MusicCategory, this );

    m_path = Phonon::createPath( m_media, m_audio );
    
    // HACK we turn off replaygain manually on OSX, until the phonon coreaudio backend is fixed.
    // as the default is specified in the .cfg file, we can't just tell it to be a different default on OSX
#ifdef Q_WS_MAC
    AmarokConfig::setReplayGainMode( AmarokConfig::EnumReplayGainMode::Off );
#endif

    // only create pre-amp if we have replaygain on, preamp can cause phonon issues
    if( AmarokConfig::replayGainMode() != AmarokConfig::EnumReplayGainMode::Off )
    {   
        m_preamp = new Phonon::VolumeFaderEffect( this );
        m_path.insertEffect( m_preamp );
    }

    m_media->setTickInterval( 100 );
    debug() << "Tick Interval (actual): " << m_media->tickInterval();
    PERF_LOG( "EngineController: loaded phonon objects" )

    // Get the next track when there is 2 seconds left on the current one.
    m_media->setPrefinishMark( 2000 );

    connect( m_media, SIGNAL( finished() ), SLOT( slotQueueEnded() ) );
    connect( m_media, SIGNAL( aboutToFinish()), SLOT( slotAboutToFinish() ) );
    connect( m_media, SIGNAL( metaDataChanged() ), SLOT( slotMetaDataChanged() ) );
    connect( m_media, SIGNAL( stateChanged( Phonon::State, Phonon::State ) ), SLOT( slotStateChanged( Phonon::State, Phonon::State ) ) );
    connect( m_media, SIGNAL( tick( qint64 ) ), SLOT( slotTick( qint64 ) ) );
    connect( m_media, SIGNAL( totalTimeChanged( qint64 ) ), SLOT( slotTrackLengthChanged( qint64 ) ) );
    connect( m_media, SIGNAL( currentSourceChanged( const Phonon::MediaSource & ) ), SLOT( slotNewTrackPlaying( const Phonon::MediaSource & ) ) );

    
    //TODO: The xine engine does not support crossfading. Cannot get the gstreamer engine to work, will test this once I do.
#if 0
    if( AmarokConfig::trackDelayLength() > -1 )
        m_media->setTransitionTime( AmarokConfig::trackDelayLength() ); // Also Handles gapless.
    else if( AmarokConfig::crossfadeLength() > 0 )  // TODO: Handle the possible options on when to crossfade.. the values are not documented anywhere however
        m_media->setTransitionTime( -AmarokConfig::crossfadeLength() );
#endif
}
Пример #11
0
void DownloadFile::getRequest( QUrl url )
{
        QNetworkRequest req(url);
        if(!file->isOpen())
        {
                file->open(QFile::ReadWrite);
        }
        reply = manager->get(req);
        connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloaded(qint64,qint64)));
        connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(emitError(QNetworkReply::NetworkError)));
        connect(reply, SIGNAL(metaDataChanged()), this, SLOT(gotMetaData()));

}
Пример #12
0
void UpdateApplication::connectSignals(QNetworkReply *reply)
// ----------------------------------------------------------------------------
//    Connect signals of reply object to 'this'
// ----------------------------------------------------------------------------
{
    connect(reply, SIGNAL(metaDataChanged()), this, SLOT(processReply()));
    connect(reply, SIGNAL(finished()), this, SLOT(downloadFinished()));
    connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
            this, SLOT(networkError(QNetworkReply::NetworkError)));
    connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
            this, SLOT(downloadProgress(qint64,qint64)));

}
Пример #13
0
TrackChange::TrackChange(QObject *parent) : QObject(parent)
{
    m_core = SoundCore::instance();
    m_plManager = PlayListManager::instance();
    connect(m_core, SIGNAL(stateChanged(Qmmp::State)), SLOT(onStateChanged(Qmmp::State)));
    connect(m_core, SIGNAL(metaDataChanged()), SLOT(onMetaDataChanged()));
    connect(m_core, SIGNAL(finished()), SLOT(onFinised()));
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    m_newTrackCommand = settings.value("TrackChange/new_track_command").toString();
    m_endOfTrackCommand = settings.value("TrackChange/end_of_track_command").toString();
    m_endOfPlCommand = settings.value("TrackChange/end_of_pl_command").toString();
    m_titleChangeCommand = settings.value("TrackChange/title_change_command").toString();
}
Пример #14
0
void OpDownloader::init()
{
    if (m_reply == 0)
        finished();
    m_reply->setParent(this);
    connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead()));
    connect(m_reply, SIGNAL(metaDataChanged()),
            this, SLOT(metaDataChanged()));
    connect(m_reply, SIGNAL(finished()),
            this, SLOT(finished()));

    QString filename = getFileName();
    
    if (m_reply->error() != QNetworkReply::NoError) {
        finished();
    } else {
        OPNET::OpNetwork::instance()->sendDownloadRequest(m_reqId, filename.toLatin1());
        m_sent = true;
        // check one first
        downloadReadyRead();
    }
}
Пример #15
0
void DownloadItem::startDownloading()
{
    QUrl locationHeader = m_reply->header(QNetworkRequest::LocationHeader).toUrl();

    bool hasFtpUrlInHeader = locationHeader.isValid() && (locationHeader.scheme() == "ftp");
    if (m_reply->url().scheme() == "ftp" || hasFtpUrlInHeader) {
        QUrl url = hasFtpUrlInHeader ? locationHeader : m_reply->url();
        m_reply->abort();
        m_reply->deleteLater();
        m_reply = 0;

        startDownloadingFromFtp(url);
        return;
    }
    else if (locationHeader.isValid()) {
        m_reply->abort();
        m_reply->deleteLater();

        m_reply = mApp->networkManager()->get(QNetworkRequest(locationHeader));
    }

    m_reply->setParent(this);
    connect(m_reply, SIGNAL(finished()), this, SLOT(finished()));
    connect(m_reply, SIGNAL(readyRead()), this, SLOT(readyRead()));
    connect(m_reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
    connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error()));
    connect(m_reply, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged()));

    m_downloading = true;
    m_timer.start(1000, this);
    readyRead();
    QTimer::singleShot(200, this, SLOT(updateDownload()));

    if (m_reply->error() != QNetworkReply::NoError) {
        stop(false);
        error();
    }
}
Пример #16
0
void S60AudioPlayerSession::updateMetaDataEntriesL()
{
    metaDataEntries().clear();
    int numberOfMetaDataEntries = 0;
    m_player->GetNumberOfMetaDataEntries(numberOfMetaDataEntries);
    for (int i=0; i<numberOfMetaDataEntries; ++i) {
        CMMFMetaDataEntry *entry = 0;
        entry = m_player->GetMetaDataEntryL(i);
        metaDataEntries().insert(QString::fromUtf16(entry->Name().Ptr(), entry->Name().Length()),
                                 QString::fromUtf16(entry->Value().Ptr(), entry->Value().Length()));
        delete entry;
    }
    emit metaDataChanged();
}
Пример #17
0
void GrlMedia::setMetaData()
{
	if (m_player->isMetaDataAvailable())
	{
		MediaMetaData metaData;
		metaData.title       = m_player->metaData(QMediaMetaData::Title).toString();
		metaData.albumTitle  = m_player->metaData(QMediaMetaData::AlbumTitle).toString();
		metaData.albumArtist = m_player->metaData(QMediaMetaData::AlbumArtist).toString();
		emit metaDataChanged(metaData);

		QSize resolution = m_player->metaData(QMediaMetaData::Resolution).toSize();
		emit resizeChanged(resolution);
	}
}
Пример #18
0
void QNetworkAccessDebugPipeBackend::socketReadyRead()
{
    if (bareProtocol) {
        qint64 bytesToRead = socket.bytesAvailable();
        if (bytesToRead) {
            QByteArray buffer;
            buffer.resize(bytesToRead);
            qint64 bytesRead = socket.read(buffer.data(), bytesToRead);
            if (bytesRead < bytesToRead)
                buffer.truncate(bytesRead);
            writeDownstreamData(buffer);
            readyReadEmitted = true;
        }
        return;
    }

    while (canReceive() &&
            (socket.state() == QAbstractSocket::UnconnectedState || nextDownstreamBlockSize())) {
        DataPacket packet;
        if (receive(packet)) {
            if (!packet.headers.isEmpty()) {
                QList<QPair<QByteArray, QByteArray> >::ConstIterator
                it = packet.headers.constBegin(),
                end = packet.headers.constEnd();
                for ( ; it != end; ++it)
                    setRawHeader(it->first, it->second);
                metaDataChanged();
            }

            if (!packet.data.isEmpty()) {
                writeDownstreamData(packet.data);
                readyReadEmitted = true;
            }

            if (packet.headers.isEmpty() && packet.data.isEmpty()) {
                // it's an eof
                socket.close();
                readyReadEmitted = true;
            }
        } else {
            // got an error
            QString msg = QObject::tr("Read error reading from %1: %2")
                          .arg(url().toString(), socket.errorString());
            error(QNetworkReply::ProtocolFailure, msg);

            finished();
            return;
        }
    }
}
bool QNetworkAccessCacheBackend::sendCacheContents()
{
    setCachingEnabled(false);
    QAbstractNetworkCache *nc = networkCache();
    if (!nc)
        return false;

    QNetworkCacheMetaData item = nc->metaData(url());
    if (!item.isValid())
        return false;

    QNetworkCacheMetaData::AttributesMap attributes = item.attributes();
    setAttribute(QNetworkRequest::HttpStatusCodeAttribute, attributes.value(QNetworkRequest::HttpStatusCodeAttribute));
    setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute));

    // set the raw headers
    QNetworkCacheMetaData::RawHeaderList rawHeaders = item.rawHeaders();
    QNetworkCacheMetaData::RawHeaderList::ConstIterator it = rawHeaders.constBegin(),
                                                       end = rawHeaders.constEnd();
    for ( ; it != end; ++it) {
        if (it->first.toLower() == "cache-control" &&
            it->second.toLower().contains("must-revalidate")) {
            return false;
        }
        setRawHeader(it->first, it->second);
    }

    // handle a possible redirect
    QVariant redirectionTarget = attributes.value(QNetworkRequest::RedirectionTargetAttribute);
    if (redirectionTarget.isValid()) {
        setAttribute(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget);
        redirectionRequested(redirectionTarget.toUrl());
    }

    // signal we're open
    metaDataChanged();

    if (operation() == QNetworkAccessManager::GetOperation) {
        QIODevice *contents = nc->data(url());
        if (!contents)
            return false;
        contents->setParent(this);
        writeDownstreamData(contents);
    }

#if defined(QNETWORKACCESSCACHEBACKEND_DEBUG)
    qDebug() << "Successfully sent cache:" << url();
#endif
    return true;
}
Пример #20
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QAction* aRemove = ui->actionRemove_Playlist_Selection;
    QAction* aClear = ui->actionClear_Playlist;

    connect(aRemove, SIGNAL(triggered()), ui->player->playlist(), SLOT(removeSelection()));
    connect(aClear, SIGNAL(triggered()), ui->player->playlist(), SLOT(clear()));

    connect(ui->player->inner_player(), SIGNAL(metaDataChanged(QString,QVariant)), SLOT(metadataChanged(QString,QVariant)));
}
Пример #21
0
VideoEditor::VideoEditor(QWidget* parent, Video *video, Doc* doc)
    : QWidget(parent)
    , m_doc(doc)
    , m_video(video)
{
    Q_ASSERT(doc != NULL);
    Q_ASSERT(video != NULL);

    setupUi(this);

    m_nameEdit->setText(m_video->name());
    m_nameEdit->setSelection(0, m_nameEdit->text().length());

    connect(m_video, SIGNAL(totalTimeChanged(qint64)),
            this, SLOT(slotDurationChanged(qint64)));
    connect(m_video, SIGNAL(metaDataChanged(QString,QVariant)),
            this, SLOT(slotMetaDataChanged(QString,QVariant)));

    connect(m_nameEdit, SIGNAL(textEdited(const QString&)),
            this, SLOT(slotNameEdited(const QString&)));
    connect(m_fileButton, SIGNAL(clicked()),
            this, SLOT(slotSourceFileClicked()));

    connect(m_previewButton, SIGNAL(toggled(bool)),
            this, SLOT(slotPreviewToggled(bool)));

    m_filenameLabel->setText(m_video->getSourceFileName());
    m_durationLabel->setText(Function::speedToString(m_video->totalDuration()));

    for (int i = 0; i < m_video->getScreenCount(); i++)
        m_screenCombo->addItem(QString("Screen %1").arg(i + 1));

    m_screenCombo->setCurrentIndex(m_video->screen());

    if (m_video->fullscreen() == true)
        m_fullCheck->setChecked(true);
    else
        m_winCheck->setChecked(true);

    connect(m_screenCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(slotScreenIndexChanged(int)));
    connect(m_winCheck, SIGNAL(clicked()),
            this, SLOT(slotWindowedCheckClicked()));
    connect(m_fullCheck, SIGNAL(clicked()),
            this, SLOT(slotFullscreenCheckClicked()));

    // Set focus to the editor
    m_nameEdit->setFocus();
}
Пример #22
0
	void PasteServiceBase::InitReply (QNetworkReply *reply)
	{
		connect (reply,
				SIGNAL (finished ()),
				this,
				SLOT (handleFinished ()));
		connect (reply,
				SIGNAL (metaDataChanged ()),
				this,
				SLOT (handleMetadata ()));
		connect (reply,
				SIGNAL (error (QNetworkReply::NetworkError)),
				this,
				SLOT (handleError ()));
	}
Пример #23
0
void DownloadItem::init()
{
    if (!m_reply)
        return;

    m_finished = false;

    // attach to the m_reply
    m_url = m_reply->url();
    m_success_init = getFileName();

    if (m_success_init) {
        if (m_reply->isRunning()) {
            connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead()));
            connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)),
                    this, SLOT(error(QNetworkReply::NetworkError)));
            connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)),
                    this, SLOT(downloadProgress(qint64, qint64)));
            connect(m_reply, SIGNAL(metaDataChanged()),
                    this, SLOT(metaDataChanged()));
            connect(m_reply, SIGNAL(finished()),
                    this, SLOT(finished()));
            // reset info
            downloadInfoLabel->clear();
            progressBar->setValue(0);

            // start timer for the download estimation
            m_downloadTime.start();
        } else {
            if (m_reply->error() != QNetworkReply::NoError)
                error(m_reply->error());

            finished();
        }
    }
}
Пример #24
0
void DownloadItem::init()
{
    if (!m_reply)
        return;

    m_startedSaving = false;
    m_finishedDownloading = false;

    openButton->setEnabled(false);

    // attach to the m_reply
    m_url = m_reply->url();
    m_reply->setParent(this);
    connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead()));
    connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)),
            this, SLOT(error(QNetworkReply::NetworkError)));
    connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)),
            this, SLOT(downloadProgress(qint64, qint64)));
    connect(m_reply, SIGNAL(metaDataChanged()),
            this, SLOT(metaDataChanged()));
    connect(m_reply, SIGNAL(finished()),
            this, SLOT(finished()));

    // reset info
    downloadInfoLabel->clear();
    progressBar->setValue(0);
    getFileName();

    // start timer for the download estimation
    m_downloadTime.start();

    if (m_reply->error() != QNetworkReply::NoError) {
        error(m_reply->error());
        finished();
    }
}
Пример #25
0
// actions
void Player::setActions(){
    connect(playButton, SIGNAL(clicked()), this, SLOT(play()));
    connect(nextButton, SIGNAL(clicked()), this, SLOT(next()));
    connect(prevButton, SIGNAL(clicked()), this, SLOT(prev()));
    connect(videoPlayer->mediaObject(), SIGNAL(finished()), this, SLOT(finished()));
    connect(videoPlayer->mediaObject(), SIGNAL(totalTimeChanged(qint64)), this, SLOT(updateTime()));
    connect(videoPlayer->mediaObject(), SIGNAL(tick(qint64)), this, SLOT(updateTime()));    
    connect(videoPlayer->mediaObject(), SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(stateChanged(Phonon::State, Phonon::State)));
    connect(videoPlayer->mediaObject(), SIGNAL(metaDataChanged()), this, SLOT(updateInfo()));
    connect(timeSlider, SIGNAL(sliderReleased()),this, SLOT(seekFile()));
    connect(volumeSlider, SIGNAL(sliderReleased()),this, SLOT(saveVolume()));
    connect(volumeSlider, SIGNAL(valueChanged(int)),this, SLOT(changeVolume()));
    connect(this, SIGNAL(enterfullScreen()), this, SLOT(setFullScreen()));
    connect(this, SIGNAL(exitfullScreen()), this, SLOT(unsetFullScreen()));
}
void QAndroidMetaDataReaderControl::updateData(const QVariantMap &metadata, const QUrl &url)
{
    const QMutexLocker l(&m_mtx);

    if (m_mediaContent.canonicalUrl() != url)
        return;

    const bool oldAvailable = m_available;
    m_metadata = metadata;
    m_available = !m_metadata.isEmpty();

    if (m_available != oldAvailable)
        Q_EMIT metaDataAvailableChanged(m_available);

    Q_EMIT metaDataChanged();
}
Пример #27
0
void WebLoadManager::sendRequest(webFileLoaderPrivate *loader, const QString &redirect) {
	Replies::iterator j = _replies.find(loader->reply());
	if (j != _replies.cend()) {
		QNetworkReply *r = j.key();
		_replies.erase(j);

		r->abort();
		r->deleteLater();
	}

	QNetworkReply *r = loader->request(_manager, redirect);
	connect(r, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(onProgress(qint64, qint64)));
	connect(r, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onFailed(QNetworkReply::NetworkError)));
	connect(r, SIGNAL(metaDataChanged()), this, SLOT(onMeta()));
	_replies.insert(r, loader);
}
Пример #28
0
        void MediaObject::loadingFinished(MediaGraph *mg)
        {
            if (mg == currentGraph()) {
#ifndef QT_NO_PHONON_MEDIACONTROLLER
                //Title interface
                m_currentTitle = 0;
                setTitles(currentGraph()->titles());
#endif //QT_NO_PHONON_MEDIACONTROLLER

                HRESULT hr = mg->renderResult();

                if (catchComError(hr)) {
                    return;
                }

                if (m_oldHasVideo != currentGraph()->hasVideo()) {
                    emit hasVideoChanged(currentGraph()->hasVideo());
                }

#ifndef QT_NO_PHONON_VIDEO
                if (currentGraph()->hasVideo()) {
                    updateVideoGeometry();
                }
#endif //QT_NO_PHONON_VIDEO

                emit metaDataChanged(currentGraph()->metadata());
                emit totalTimeChanged(totalTime());

                //let's put the next state
                switch(m_nextState)
                {
                case Phonon::PausedState:
                    pause();
                    break;
                case Phonon::PlayingState:
                    play();
                    break;
                case Phonon::ErrorState:
                    setState(Phonon::ErrorState);
                    break;
                case Phonon::StoppedState:
                default:
                    stop();
                    break;
                }
            }
        }
Пример #29
0
ProjectMWidget::ProjectMWidget(QListWidget *listWidget, QWidget *parent)
    : QGLWidget(parent)
{
    setMouseTracking(true);
    m_listWidget = listWidget;
    m_projectM = 0;
    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()),SLOT(updateGL()));
    m_menu = new QMenu(this);
    connect(SoundCore::instance(), SIGNAL(metaDataChanged()), SLOT(updateTitle()));
#if QT_VERSION >= 0x040700
    qDebug("ProjectMWidget: opengl version: %d.%d",
           context()->format().majorVersion(),
           context()->format().minorVersion());
    createActions();
#endif
}
void S60VideoPlayerSession::updateMetaDataEntriesL()
{
    DP0("S60VideoPlayerSession::updateMetaDataEntriesL +++");

    metaDataEntries().clear();
    int numberOfMetaDataEntries = 0;
    numberOfMetaDataEntries = m_player->NumberOfMetaDataEntriesL();
    for (int i = 0; i < numberOfMetaDataEntries; i++) {
        CMMFMetaDataEntry *entry = NULL;
        entry = m_player->MetaDataEntryL(i);
        metaDataEntries().insert(TDesC2QString(entry->Name()), TDesC2QString(entry->Value()));
        delete entry;
    }
    emit metaDataChanged();

    DP0("S60VideoPlayerSession::updateMetaDataEntriesL ---");
}