void UBHttpFileDownloader::finished ()
{
        mCurrentFile->flush();
        mCurrentFile->close();

        if (mReply)
                delete mReply;

        downloadNext();
}
示例#2
0
//called when book package has done downloading.
void MobileApp::downloadDone()
{
    //Book downloaded
    if (downloader)
    {
        ui->downloadPrgBar->hide();

        //this file has finished downloading, get the next file.
        downloadNext();
    }
}
示例#3
0
void MobileApp::downloadError()
{
    qDebug() << "Error downloading: " + downloader->getFileName();

    ui->downloadInfo->setToolTip("Error");

    //QMessageBox msgBox;
    //msgBox.setText(tr("Error downloading: ")  + downloader->getFileName() + tr("\nPlease try to re download it."));
    //msgBox.exec();

    //remove the tmpfile created by the downloader.
    //downloader->getFile()->remove();

    downloadNext();
}
示例#4
0
/**
  Starts the download. If finished the signal downloaded ist emited.
  */
int ModuleDownloader::start()
{
    DEBUG_FUNC_NAME
    //create folder where the modules should be downloaded
    QDir dir(m_settings->homePath);
    dir.mkdir(m_settings->homePath + "modules");

    //hack: remove duplicates
    const QSet<QString> set = m_data.keys().toSet();
    m_urls = set.toList();

    //init stuff
    m_counter = 0;
    m_fileCount = m_urls.size();

    //now we can download
    downloadNext();
    return m_fileCount;
}
示例#5
0
void MobileApp::downloadStart()
{
    downloadsList.clear();
    hashs.clear();

    for (int i=0; i<ui->downloadListWidget->count(); i++)
    {
        QListWidgetItem *item = ui->downloadListWidget->item(i);
        if (item->checkState() == Qt::Checked)
        {
            //Generate download urls
            int n;
            if (ToNum(item->whatsThis(), &n))
            {
                if (groups.size() > n)
                {
                    for (int j=0; j<groups[n].books.size(); j++)
                    {
                        if (groups[n].books[j].needToDownload)
                        {
                            QString url = groups[n].books[j].URL;
                            downloadsList << url;
                            hashs << groups[n].books[j].hash;
                        }
                    }
                }
            }
        }
    }
    downloadNum = downloadsList.size();

    ui->downloadInfo->toolTip() = "";

    ui->downloadListWidget->setEnabled(false);
    ui->downloadBTN->setEnabled(false);


    // download the next file in downloadsList.
    downloadNext();
}
	void MetadataDownload::reject(Uint32 piece)
	{
		Out(SYS_GEN|LOG_NOTICE) << "Metadata download, piece " << piece << " rejected" << endl;
		downloadNext();
	}
示例#7
0
void ModuleDownloader::save(QString url, QString name, int status)
{
    m_retData[url] = name;
    downloadNext();
}