예제 #1
0
void TorrentModel::populate() {
  // Load the torrents
  std::vector<Transfer> torrents = Session::instance()->getTransfers();
  std::vector<Transfer>::const_iterator it;
  for (it = torrents.begin(); it != torrents.end(); it++) {
    addTorrent(*it);
  }
  // Refresh timer
  connect(&m_refreshTimer, SIGNAL(timeout()), SLOT(forceModelRefresh()));
  m_refreshTimer.start(m_refreshInterval);
  // Listen for torrent changes
  connect(Session::instance(), SIGNAL(addedTransfer(Transfer)),
          SLOT(addTorrent(Transfer)));
  connect(Session::instance(), SIGNAL(transferAboutToBeRemoved(Transfer, bool)),
          SLOT(handleTorrentAboutToBeRemoved(Transfer, bool)));
  connect(Session::instance(), SIGNAL(deletedTransfer(QString)),
          SLOT(removeTorrent(QString)));
  connect(Session::instance(), SIGNAL(finishedTransfer(Transfer)),
          SLOT(handleTorrentUpdate(Transfer)));
  connect(Session::instance(), SIGNAL(metadataReceived(Transfer)),
          SLOT(handleTorrentUpdate(Transfer)));
  connect(Session::instance(), SIGNAL(resumedTransfer(Transfer)),
          SLOT(handleTorrentUpdate(Transfer)));
  connect(Session::instance(), SIGNAL(pausedTransfer(Transfer)),
          SLOT(handleTorrentUpdate(Transfer)));
  connect(Session::instance(), SIGNAL(transferFinishedChecking(Transfer)),
          SLOT(handleTorrentUpdate(Transfer)));
}
예제 #2
0
void Codec::processBitstream(const QByteArray &data,bool is_last)
{
  codec_bytes_processed+=data.length();
  codec_bytes_processed_changed=true;
  process(data,is_last);
  while((codec_metadata_bytes.size()>0)&&
	(codec_metadata_bytes.front()<codec_bytes_processed)) {
    emit metadataReceived(codec_frames_generated,codec_metadata_events.front());
    codec_metadata_bytes.pop();
    delete codec_metadata_events.front();
    codec_metadata_events.pop();
  }
}
예제 #3
0
Downloader::Downloader(int index, QString url,QString cookie) //Called when downloading for the first time.
{

    QMetaObject::invokeMethod(Globals::modelObject, "showPreparingToDownloadBox");


    downloadInfo = new Info();

    downloadInfo->url = url;
    downloadInfo->cookie = cookie;
    downloadInfo->index = index;

    qDebug() << "Setting cookie:" << cookie;

    //Initializing objects
    manager= new QNetworkAccessManager(this);

    request= new QNetworkRequest();

    request->setRawHeader("User-Agent", "Wget/1.9.1 (X11; Ubuntu; Linux x86_64)");

    request->setRawHeader("Cookie" , cookie.toUtf8());

    isAlive=false;



    //Resolving redirections & grabbing meta data

    metadataGrabber = new MetadataGrabber();

    redirectionManager = new RedirectionManager(manager,request);

    redirectionManager->redirect(url);

    connect(redirectionManager, SIGNAL(redirectionFinished(QNetworkReply*)), metadataGrabber,SLOT(getMetadata(QNetworkReply*)));

    connect(metadataGrabber , SIGNAL(metadataReceived()) , this, SLOT(synchronizeMetadata()));



    //Continues on synchronizeMetadata() method

}
예제 #4
0
void SM_QDropbox::parseMetadata(QString response)
{
#ifdef SM_QTDROPBOX_DEBUG
    qDebug() << "== metadata ==" << response << "== metadata end ==";
#endif

    SM_Dropbox_Json json;
    json.parseString(response);
    _tempJson.parseString(response);
    if(!json.isValid())
    {
        errorState = SM_QDropbox::APIError;
        errorText  = "Dropbox API did not send correct answer for file/directory metadata.";
#ifdef SM_QTDROPBOX_DEBUG
        qDebug() << "error: " << errorText << endl;
#endif
        emit errorOccured(errorState);
        stopEventLoop();
        return;
    }

    emit metadataReceived(response);
    return;
}