Example #1
0
void LLUpdateDownloader::Implementation::download(LLURI const & uri,
												  std::string const & hash,
												  std::string const & updateChannel,
												  std::string const & updateVersion,
												  std::string const & info_url,
												  bool required)
{ 
	if(isDownloading()) mClient.downloadError("download in progress");

	mDownloadRecordPath = downloadMarkerPath();
	mDownloadData = LLSD();
	mDownloadData["required"] = required;
	mDownloadData["update_channel"] = updateChannel;
	mDownloadData["update_version"] = updateVersion;
	if (!info_url.empty())
	{
		mDownloadData["info_url"] = info_url;
	}
	try
	{
		startDownloading(uri, hash);
	}
	catch(DownloadError const & e)
	{
		mClient.downloadError(e.what());
	}
}
Example #2
0
void DownloadItem::metaDataChanged()
{
    QUrl locationHeader = m_reply->header(QNetworkRequest::LocationHeader).toUrl();
    if (locationHeader.isValid()) {
        m_reply->close();
        m_reply->deleteLater();

        m_reply = mApp->networkManager()->get(QNetworkRequest(locationHeader));
        startDownloading();
    }
}
Example #3
0
void MediaView::gotStreamUrl(QUrl streamUrl) {
    if (stopped) return;
    if (!streamUrl.isValid()) {
        skip();
        return;
    }

    Video *video = static_cast<Video *>(sender());
    if (!video) {
        qDebug() << "Cannot get sender in" << __PRETTY_FUNCTION__;
        return;
    }
    video->disconnect(this);

    currentVideoId = video->id();

#ifdef APP_PHONON_SEEK
    mediaObject->setCurrentSource(streamUrl);
    mediaObject->play();
#else
    startDownloading();
#endif

    // ensure we always have videos ahead
    playlistModel->searchNeeded();

    // ensure active item is visible
    int row = playlistModel->activeRow();
    if (row != -1) {
        QModelIndex index = playlistModel->index(row, 0, QModelIndex());
        playlistView->scrollTo(index, QAbstractItemView::EnsureVisible);
    }

#ifdef APP_ACTIVATION
    if (!Activation::instance().isActivated())
        demoTimer->start(180000);
#endif

#ifdef APP_EXTRA
    Extra::notify(video->title(), video->channelTitle(), video->formattedDuration());
#endif

    ChannelAggregator::instance()->videoWatched(video);
}
Example #4
0
DownloadItem::DownloadItem(QListWidgetItem* item, QNetworkReply* reply, const QString &path, const QString &fileName, const QPixmap &fileIcon, QTime* timer, bool openAfterFinishedDownload, const QUrl &downloadPage, DownloadManager* manager)
    : QWidget()
    , ui(new Ui::DownloadItem)
    , m_item(item)
    , m_reply(reply)
    , m_ftpDownloader(0)
    , m_path(path)
    , m_fileName(fileName)
    , m_downTimer(timer)
    , m_downUrl(reply->url())
    , m_downloadPage(downloadPage)
    , m_downloading(false)
    , m_openAfterFinish(openAfterFinishedDownload)
    , m_downloadStopped(false)
    , m_received(0)
    , m_total(0)
{
#ifdef DOWNMANAGER_DEBUG
    qDebug() << __FUNCTION__ << item << reply << path << fileName;
#endif
    QString fullPath = path + fileName;
    if (QFile::exists(fullPath)) {
        QFile::remove(fullPath);
    }

    m_outputFile.setFileName(fullPath);

    ui->setupUi(this);
    setMaximumWidth(525);

    ui->button->setPixmap(QIcon::fromTheme(QSL("process-stop")).pixmap(20, 20));
    ui->fileName->setText(m_fileName);
    ui->downloadInfo->setText(tr("Remaining time unavailable"));
    ui->fileIcon->setPixmap(fileIcon);

    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
    connect(ui->button, SIGNAL(clicked(QPoint)), this, SLOT(stop()));
    connect(manager, SIGNAL(resized(QSize)), this, SLOT(parentResized(QSize)));

    startDownloading();
}