当前位置: 首页>>代码示例>>C++>>正文


C++ downloadFinished函数代码示例

本文整理汇总了C++中downloadFinished函数的典型用法代码示例。如果您正苦于以下问题:C++ downloadFinished函数的具体用法?C++ downloadFinished怎么用?C++ downloadFinished使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了downloadFinished函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setSaveFileName

/**
  Retrieves the firmware from the device
  */
void deviceWidget::downloadFirmware()
{
    if (!m_dfu->devices[deviceID].Readable) {
        myDevice->statusLabel->setText(QString("Device not readable!"));
        return;
    }

    myDevice->retrieveButton->setEnabled(false);
    filename = setSaveFileName();

    if (filename.isEmpty()) {
        status("Empty filename", STATUSICON_FAIL);
        return;
    }

    status("Downloading firmware from device", STATUSICON_RUNNING);
    connect(m_dfu, SIGNAL(progressUpdated(int)), this, SLOT(setProgress(int)));
    connect(m_dfu, SIGNAL(downloadFinished()), this, SLOT(downloadFinished()));
    downloadedFirmware.clear(); // Empty the byte array
    bool ret = m_dfu->DownloadFirmware(&downloadedFirmware,deviceID);
    if(!ret) {
        status("Could not start download!", STATUSICON_FAIL);
        return;
    }
    status("Download started, please wait", STATUSICON_RUNNING);
}
开发者ID:msmir,项目名称:vbrain,代码行数:29,代码来源:devicewidget.cpp

示例2: downloadFinished

void plugDownloader::startNextDownload()
{
    if (m_download_queue.isEmpty()) {
        emit downloadFinished(itemList);
        this->deleteLater();
        return;
    }
    currentItem =  m_download_queue.dequeue();

    currentOutput.setFileName(outPath+currentItem.filename);
    if (!currentOutput.open(QIODevice::WriteOnly)) {
        qDebug() << "Unable to open file";
        startNextDownload();
        return;                 // skip this download
    }
    QNetworkRequest request(currentItem.url);
    currentDownload = manager.get(request);
    connect(currentDownload, SIGNAL(downloadProgress(qint64,qint64)),
            SLOT(downloadProgress(qint64,qint64)));
    connect(currentDownload, SIGNAL(finished()),
            SLOT(downloadFinished()));
    connect(currentDownload, SIGNAL(readyRead()),
            SLOT(downloadReadyRead()));

    // prepare the output
    downloadTime.start();
}
开发者ID:veksha,项目名称:vekshas-qutim-plugins,代码行数:27,代码来源:plugdownloader.cpp

示例3: switch

void video::handleDownloads()
{
    switch (this->_step)
    {
        case 1:
        {
            handler->downloads.at(0)->tempFile->close();
            handler->downloads.at(0)->tempFile->open();
            QByteArray data = handler->downloads.at(0)->tempFile->readAll();
            handler->downloads.at(0)->tempFile->close();
            QString html = QString::fromUtf8(data, data.size());
            handler->clearDownloads();
            parseVideo(html);
            break;
        }

        case 3:
        {
            if (handler->downloads.size() == 1)
            {
                this->downloadFile = handler->downloads.at(0)->tempFile;
                emit downloadFinished();
            }
            else
            {
                this->_step = 4;
                converter_ffmpeg* ffmpeg = new converter_ffmpeg;

                QList<QFile*> files;
                for (int i=0; i < handler->downloads.size(); i++)
                {
                    files << handler->downloads.at(i)->tempFile;
                }
                this->_progressBar->setMinimum(0);
                this->_progressBar->setMaximum(0);
                for (int i = 0; i <= 3; i++)
                {
                   this->_treeItem->setToolTip(i, "<strong>" + tr("Converting ...") + "</strong>");
                }
                this->downloadFile = new QTemporaryFile(QDir::tempPath() + "/clipgrab-concat--XXXXXX");
                this->downloadFile->open(QIODevice::ReadOnly);
                this->downloadFile->close();
                qDebug() << this->downloadFile;
                connect(ffmpeg, SIGNAL(conversionFinished()), this, SLOT(handleDownloads()));

                ffmpeg->concatenate(files, this->downloadFile);
            }
            break;
        }

        case 4:
        {
            emit downloadFinished();
			break;
        }
    }
}
开发者ID:FreedomBen,项目名称:clipgrab,代码行数:57,代码来源:video.cpp

示例4: disconnect

/**
  Callback for the firmware download result
  */
void deviceWidget::downloadFinished()
{
    disconnect(m_dfu, SIGNAL(downloadFinished()), this, SLOT(downloadFinished()));
    disconnect(m_dfu, SIGNAL(progressUpdated(int)), this, SLOT(setProgress(int)));
    status("Download successful", STATUSICON_OK);
    // Now save the result (use the utility function from OP_DFU)
    m_dfu->SaveByteArrayToFile(filename, downloadedFirmware);
    myDevice->retrieveButton->setEnabled(true);
}
开发者ID:msmir,项目名称:vbrain,代码行数:12,代码来源:devicewidget.cpp

示例5: window

void WebView::unsupportedContent(QNetworkReply* pReply)
{
   bool closeAfterDownload = false;
   if (this->page()->history()->count() == 0)
   {
      /* This is for the case where a new browser window was launched just
         to show a PDF or save a file. Otherwise we would have an empty
         browser window with no history hanging around. */
      window()->hide();
      closeAfterDownload = true;
   }

   DownloadHelper* pDownloadHelper = NULL;

   QString contentType =
         pReply->header(QNetworkRequest::ContentTypeHeader).toString();
   if (contentType.contains(QRegExp(QString::fromAscii("^\\s*application/pdf($|;)"),
                                    Qt::CaseInsensitive)))
   {
      core::FilePath dir(options().scratchTempDir());

      QTemporaryFile pdfFile(QString::fromUtf8(
            dir.childPath("rstudio-XXXXXX.pdf").absolutePath().c_str()));
      pdfFile.open();
      pdfFile.close();
      // DownloadHelper frees itself when downloading is done
      pDownloadHelper = new DownloadHelper(pReply, pdfFile.fileName());
      connect(pDownloadHelper, SIGNAL(downloadFinished(QString)),
              this, SLOT(openFile(QString)));
   }
   else
   {
      QString fileName = promptForFilename(pReply->request(), pReply);
      if (fileName.isEmpty())
      {
         pReply->abort();
         if (closeAfterDownload)
            window()->close();
      }
      else
      {
         // DownloadHelper frees itself when downloading is done
         pDownloadHelper = new DownloadHelper(pReply, fileName);
      }
   }

   if (closeAfterDownload && pDownloadHelper)
   {
      connect(pDownloadHelper, SIGNAL(downloadFinished(QString)),
              window(), SLOT(close()));
   }
}
开发者ID:arich,项目名称:rstudio,代码行数:52,代码来源:DesktopWebView.cpp

示例6: downloadFinished

void Download::setBytesDownloaded(qint64 bytes)
{    
    m_bytesDownloaded = bytes;

    if(isDownloadFinished())
        emit downloadFinished();
}
开发者ID:Kampfgnom,项目名称:MorQ,代码行数:7,代码来源:download.cpp

示例7: qDebug

/*!
 * \qmlsignal MangoDownloader::startNextDownload()
 * Used if you want to download multiple files
 */
void MangoDownloader::startNextDownload()
{
    if (downloadQueue.isEmpty()) {
        qDebug() << downloadedCount << " " << totalCount << "files downloaded successfully\n";
        emit started(false);
        emit finished();
        return;
    }

    QUrl url = downloadQueue.dequeue();

    QString filename = saveFileName(mPath);
    output.setFileName(mPath + filename);
    if (!output.open(QIODevice::WriteOnly)) {
        qDebug() <<  "Problem opening save file for download";
        startNextDownload();
        return;
    }

    QNetworkRequest request(url);
    currentDownload = manager.get(request);
    connect(currentDownload, SIGNAL(downloadProgress(qint64,qint64)),
            SLOT(downloadProgress(qint64,qint64)));
    connect(currentDownload, SIGNAL(finished()),
            SLOT(downloadFinished()));
    connect(currentDownload, SIGNAL(readyRead()),
            SLOT(downloadReadyRead()));

    // prepare the output
    qDebug () << "Downloading " <<  url.toEncoded().constData() << "........";
    downloadTime.start();
}
开发者ID:bobweaver,项目名称:QtPlugins,代码行数:36,代码来源:mangodownloader.cpp

示例8: while

void TabDeckStorage::actDownload()
{
    QString filePath;
    QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
    if (!curLeft.isValid())
        filePath = localDirModel->rootPath();
    else {
        while (!localDirModel->isDir(curLeft))
            curLeft = curLeft.parent();
        filePath = localDirModel->filePath(curLeft);
    }

    RemoteDeckList_TreeModel::FileNode *curRight = dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(serverDirView->getCurrentItem());
    if (!curRight)
        return;
    filePath += QString("/deck_%1.cod").arg(curRight->getId());
    
    Command_DeckDownload cmd;
    cmd.set_deck_id(curRight->getId());
    
    PendingCommand *pend = client->prepareSessionCommand(cmd);
    pend->setExtraData(filePath);
    connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(downloadFinished(Response, CommandContainer, QVariant)));
    client->sendCommand(pend);
}
开发者ID:BeardAnnihilator,项目名称:Cockatrice,代码行数:25,代码来源:tab_deck_storage.cpp

示例9: f

void AppDownloader::packageFetched()
{
    QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
    reply->deleteLater();

    QString file = reply->property("file").toString();

    QFile f(m_storagePath + file);
    if (!f.open(QFile::WriteOnly | QFile::Truncate)) {
        qWarning() << "Error opening file for writing";
        return;
    }
    f.write(reply->readAll());
    f.flush();
    f.close();

    QString appid = file.split("/").first();

    if (!ZipHelper::unpackArchive(m_storagePath+file, m_storagePath + appid)) {
        qWarning() << "Error unpacking App zip file";
        return;
    }

    emit downloadFinished(appid);
}
开发者ID:awlx,项目名称:rockpool,代码行数:25,代码来源:appdownloader.cpp

示例10: qDebug

void AddNewTorrentDialog::show(QString source, QWidget *parent)
{
    if (source.startsWith("bc://bt/", Qt::CaseInsensitive)) {
        qDebug("Converting bc link to magnet link");
        source = Utils::Misc::bcLinkToMagnet(source);
    }

    AddNewTorrentDialog *dlg = new AddNewTorrentDialog(parent);

    if (Utils::Misc::isUrl(source)) {
        // Launch downloader
        Net::DownloadHandler *handler = Net::DownloadManager::instance()->downloadUrl(source, true, 10485760 /* 10MB */, true);
        connect(handler, SIGNAL(downloadFinished(QString, QString)), dlg, SLOT(handleDownloadFinished(QString, QString)));
        connect(handler, SIGNAL(downloadFailed(QString, QString)), dlg, SLOT(handleDownloadFailed(QString, QString)));
        connect(handler, SIGNAL(redirectedToMagnet(QString, QString)), dlg, SLOT(handleRedirectedToMagnet(QString, QString)));
    }
    else {
        bool ok = false;
        if (source.startsWith("magnet:", Qt::CaseInsensitive))
            ok = dlg->loadMagnet(source);
        else
            ok = dlg->loadTorrent(source);

        if (ok)
            dlg->open();
        else
            delete dlg;
    }
}
开发者ID:gabberworld,项目名称:qBittorrent,代码行数:29,代码来源:addnewtorrentdialog.cpp

示例11: QWidget

frmProgress::frmProgress(QWidget * parent, Qt::WFlags f) : QWidget(parent, f)
{
	qRegisterMetaType<QNapiSubtitleInfoList>("QNapiSubtitleInfoList");

	ui.setupUi(this);

#ifdef Q_WS_MAC
	setAttribute(Qt::WA_MacBrushedMetal, GlobalConfig().useBrushedMetal());
#endif
	setAttribute(Qt::WA_DeleteOnClose, false);
	setAttribute(Qt::WA_QuitOnClose, false);

	setBatchMode(false);

	connect(&getThread, SIGNAL(fileNameChange(const QString &)),
			ui.lbFileName, SLOT(setText(const QString &)));
	connect(&getThread, SIGNAL(actionChange(const QString &)),
			ui.lbAction, SLOT(setText(const QString &)));
	connect(&getThread, SIGNAL(progressChange(int, int, float)),
			this, SLOT(updateProgress(int, int, float)));
	connect(&getThread, SIGNAL(selectSubtitles(QString, QNapiSubtitleInfoList)),
			this, SLOT(selectSubtitles(QString, QNapiSubtitleInfoList)));
	connect(this, SIGNAL(subtitlesSelected(int)),
			&getThread, SLOT(subtitlesSelected(int)));
	connect(&getThread, SIGNAL(finished()),
			this, SLOT(downloadFinished()));
}
开发者ID:CybrixSystems,项目名称:Qnapi,代码行数:27,代码来源:frmprogress.cpp

示例12: dataStream

void SerialServer::processData(QByteArray& data)
{
    QDataStream dataStream(&data, QIODevice::ReadOnly);
    
    QString fileName;
    QByteArray fileData;
    
    dataStream >> fileName;
    dataStream >> fileData;
    
    if(fileName.isEmpty())
        return;
    
    QFileInfo fileInfo(fileName);
    
    QString projectPath = createProject(fileInfo.baseName());
    writeFile(projectPath + "/" + fileName, fileData);
    
    QString mainFilePath = projectPath + "/" + fileName;
    
    while(dataStream.status() == QDataStream::Ok) {
        fileName.clear();
        fileData.clear();
        
        dataStream >> fileName;
        dataStream >> fileData;
        
        if(!fileName.isEmpty()) {
            writeFile(projectPath + "/" + fileName, fileData);
        }
    }
    emit downloadFinished(mainFilePath);
}
开发者ID:Craug,项目名称:cbc,代码行数:33,代码来源:SerialServer.cpp

示例13: QFileInfo

void DownloadItem::stop(bool askForDeleteFile)
{
    if (downloadStopped_)
        return;

    downloadStopped_ = true;
    QString host = downloadUrl_.host();

    openAfterFinish_ = false;
    updateInfoTimer_.stop();
    reply_->abort();
    reply_->deleteLater();

    outputFile_.close();
    QString outputfile = QFileInfo(outputFile_).absoluteFilePath();
    downloadInfo_->setText(tr("Cancelled - %1").arg(host));
    progressFrame_->hide();
    item_->setSizeHint(sizeHint());

    downloading_ = false;

    emit downloadFinished(false);

    if (askForDeleteFile) {
        QMessageBox::StandardButton button =
            QMessageBox::question(item_->listWidget()->parentWidget(),
                                  tr("Delete file"),
                                  tr("Do you want to also delete downloaded file?"),
                                  QMessageBox::Yes | QMessageBox::No);
        if (button == QMessageBox::Yes) {
            QFile::remove(outputfile);
        }
    }
}
开发者ID:nsx0r,项目名称:quiterss,代码行数:34,代码来源:downloaditem.cpp

示例14: fileSizeToString

void DownloadItem::finished()
{
    updateInfoTimer_.stop();

    QString host = downloadUrl_.host();
    QString fileSize = fileSizeToString(total_);

    if (fileSize == tr("Unknown size")) {
        fileSize = fileSizeToString(received_);
    }
    downloadInfo_->setText(QString("%1 - %2 - %3").arg(fileSize, host, QDateTime::currentDateTime().time().toString()));

    progressFrame_->hide();
    item_->setSizeHint(sizeHint());
    outputFile_.close();

    reply_->deleteLater();

    downloading_ = false;

    if (openAfterFinish_) {
        openFile();
    }

    emit downloadFinished(true);
}
开发者ID:nsx0r,项目名称:quiterss,代码行数:26,代码来源:downloaditem.cpp

示例15: downloadFinished

void DownloadManagerImpl::slotDownloadFinished(int contactId, int downloadId, const QString &filePath, int type)
{
    emit downloadFinished(contactId, downloadId, filePath, type);
    removeAndUpdateDownload(downloadId, DownloadManager::Finished);
    qDebug() << __PRETTY_FUNCTION__ << " Emitted downloadFinished signal, contactId = "
             << contactId << ", downloadId = " << downloadId;
}
开发者ID:raycad,项目名称:downloadmanager,代码行数:7,代码来源:downloadmanagerimpl.cpp


注:本文中的downloadFinished函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。