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


C++ Downloader类代码示例

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


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

示例1: downloadrequested

void Tab::startDownload(QNetworkReply *reply)
{
    std::cout<<"startDownload(QNetworkReply *reply): downloadrequested() signal emitted by the webpage\n";
	Downloader *downloader = new Downloader;
	if(downloader->handleDownloadRequest(WebView->page()->networkAccessManager(),reply))
		downloader->show();
}
开发者ID:JHooverman,项目名称:WebRender-1.0,代码行数:7,代码来源:tab.cpp

示例2: main

//Main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;



    //system("sudo ifup wlan0");

     Downloader d;
     d.doDownload("http://www.vesta-tab.com/jo/showId.php");

    Object data;

    viewer.setCursor(Qt::BlankCursor);
    viewer.rootContext()->setContextProperty("image", &data);

    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    //viewer.setMainQmlFile("qrc:/main.qml");
    viewer.setSource(QUrl("qrc:/qml/BBB/main.qml"));
    viewer.showFullScreen();

    return app->exec();
}
开发者ID:Aginorty,项目名称:vesta,代码行数:26,代码来源:main.cpp

示例3: GetDownloaderPolicy

void
MediaBase::OnPropertyChanged (PropertyChangedEventArgs *args, MoonError *error)
{
	if (args->GetProperty ()->GetOwnerType() != Type::MEDIABASE) {
		FrameworkElement::OnPropertyChanged (args, error);
		return;
	}
	
	if (args->GetId () == MediaBase::SourceProperty) {
		const char *uri = args->GetNewValue() ? args->GetNewValue()->AsString () : NULL;
		
		if (IsAttached () && AllowDownloads ()) {
			if (uri && *uri) {
				Downloader *dl;
				if ((dl = GetDeployment ()->CreateDownloader ())) {
					dl->Open ("GET", uri, GetDownloaderPolicy (uri));
					SetSource (dl, "");
					dl->unref ();
				} else {
					// we're shutting down
				}
			} else {
				SetSource (NULL, NULL);
			}
		} else {
			source_changed = true;
		}
		
		InvalidateMeasure ();
	}
	
	NotifyListenersOfPropertyChange (args, error);
}
开发者ID:snorp,项目名称:moon,代码行数:33,代码来源:media.cpp

示例4:

void
Downloader::SendAsync (EventObject *user_data)
{
	Downloader *downloader = (Downloader *) user_data;
	
	downloader->SendInternal ();
}
开发者ID:snorp,项目名称:moon,代码行数:7,代码来源:downloader.cpp

示例5: download

// CURL 下载线程
static void * download(void *arg)
{
    //LOG("downloading...\n");
    Downloader *downloader = (Downloader *)arg;
    downloader->performDownload();

    return NULL;
}
开发者ID:renbing,项目名称:Canvas,代码行数:9,代码来源:network.cpp

示例6: Download

bool Util::Download(RequestParameter param, string file) {
	HttpRequest request;
	Downloader downloader;
	downloader.SetFile(file);
	request.SetListener(&downloader);
	request.SetRequestParameter(param);
	return request.Get(10);
}
开发者ID:zhangbo7364,项目名称:winutil,代码行数:8,代码来源:Util.cpp

示例7: downloadThreadProc

void downloadThreadProc(void *param)
{
    Downloader *d = (Downloader *)param;
    bool res = d->downloadFiles();

    if((!d->downloadCancelled) && d->finishedCallback)
        d->finishedCallback(d, res);
}
开发者ID:WPN-XM,项目名称:WPN-XM,代码行数:8,代码来源:downloader.cpp

示例8:

void * Downloader::downloaderThread(void *opaque)
{
    Downloader *instance = reinterpret_cast<Downloader *>(opaque);
    int canc = vlc_savecancel();
    instance->Run();
    vlc_restorecancel( canc );
    return NULL;
}
开发者ID:0xheart0,项目名称:vlc,代码行数:8,代码来源:Downloader.cpp

示例9: main

int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);

    Downloader *d = Downloader::instance();

    qDebug() << "download return code" << d->fetch(QUrl("http://download.cegit.de/kde-windows/installer/config.txt"),"config.txt");
	qDebug() << "download return code" << d->fetch(QUrl("http://go.microsoft.com/fwlink/?LinkId=51410&clcid=0x409"),"vcexpress.exe");
    qDebug() << "download return code" << d->fetch(QUrl("ftp://ftp.scarlet.be/pub/kde/unstable/3.97/windows/"),"config-ftp.txt");
    return 0;
}
开发者ID:KDE,项目名称:kdewin-installer,代码行数:11,代码来源:test-downloader.cpp

示例10: assert

int Downloader::ProgressFileFunction(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) {
	assert(clientp);
	int percentage = dlnow * 100.0 / dltotal;

	if (percentage < 0)
		percentage = 0;
	if (percentage > 100)
		percentage = 100;

	Downloader* c = (Downloader *) clientp;
	c->ProgressFileCallback((size_t)percentage);

	return 0;
}
开发者ID:cyclefusion,项目名称:szarp,代码行数:14,代码来源:downloader.cpp

示例11: main

int main( int argc, char* argv[] )
{
	// creating the qt-application object
	QApplication qApplication( argc, argv );
	qApplication.setQuitOnLastWindowClosed( true );
	
	// creating downloader object, and showing it
	Downloader downloader;
	downloader.initEnvironement();
	downloader.show();
	
	// running the application
	return qApplication.exec();
}
开发者ID:nic0lae,项目名称:freebsddistro,代码行数:14,代码来源:main.cpp

示例12: curl_progress

int curl_progress(void *pointer, double dltotal, double dlnow, double ultotal, double ulnow)
{
    Q_UNUSED(dltotal);
    Q_UNUSED(dlnow);
    Q_UNUSED(ultotal);
    Q_UNUSED(ulnow);
    Downloader *dl = (Downloader *)pointer;
    dl->mutex()->lock ();
    bool aborted = dl->stream()->aborted;
    dl->mutex()->unlock();
    if (aborted)
    {
        return -1;
    }
    return 0;
}
开发者ID:TodorGrin,项目名称:boox-opensource,代码行数:16,代码来源:downloader.cpp

示例13: curl_easy_init

void Http::Request(const string &url, bool async, bool usePost, const void *data, size_t dataLen, HttpCallback callback,
                   void *callbackArg, map<std::string, string> *header, int timeout)
{
    if( timeout <= 0 ) {
        timeout = 60;
    }
    
    CURL *handle = curl_easy_init();
    Downloader *downloader = new Downloader(handle, callback, callbackArg);
    
    curl_easy_setopt(handle, CURLOPT_URL, url.c_str());
    curl_easy_setopt(handle, CURLOPT_TIMEOUT, timeout);
    curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writer);
    curl_easy_setopt(handle, CURLOPT_FORBID_REUSE, 1);
    curl_easy_setopt(handle, CURLOPT_WRITEDATA, downloader);
    curl_easy_setopt(handle, CURLOPT_PRIVATE, downloader);
    if( usePost ){
        curl_easy_setopt(handle, CURLOPT_POST, 1);
        curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE, dataLen);
        curl_easy_setopt(handle, CURLOPT_COPYPOSTFIELDS, data);
    }
    if( header != NULL ) {
        struct curl_slist *headers = NULL;
        map<string,string>::const_iterator it = header->begin();
        for(; it != header->end(); it++ ) {
            headers = curl_slist_append(headers, (it->first + ": " + it->second).c_str());
        }
        curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers);
        downloader->setHeaders(headers);
    }
    
    if( async ) {
        curl_multi_add_handle(m_mcurl, handle);
        int running = 0;
        curl_multi_perform(m_mcurl, &running);
    }else {
        int repCode = -1;
        CURLcode code = curl_easy_perform(handle);
        if ( CURLE_OK == code )
        {
            curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &repCode);
        }
        
        downloader->didFinish(code, repCode);
        delete  downloader;
    }
}
开发者ID:renbing,项目名称:Giraffe,代码行数:47,代码来源:Http.cpp

示例14: performNetworkOperation

NetworkResult NetworkFactory::performNetworkOperation(const QString &url, int timeout, const QByteArray &input_data,
                                         const QString &input_content_type, QByteArray &output,
                                         QNetworkAccessManager::Operation operation, bool protected_contents,
                                         const QString &username, const QString &password, bool set_basic_header) {
  Downloader downloader;
  QEventLoop loop;
  NetworkResult result;

  QString str(input_data);

  downloader.appendRawHeader("Content-Type", input_content_type.toLocal8Bit());

  if (set_basic_header) {
    QString basic_value = username + ":" + password;
    QString header_value = QString("Basic ") + QString(basic_value.toUtf8().toBase64());

    downloader.appendRawHeader("Authorization", header_value.toLocal8Bit());
  }

  // We need to quit event loop when the download finishes.
  QObject::connect(&downloader, SIGNAL(completed(QNetworkReply::NetworkError)), &loop, SLOT(quit()));

  downloader.manipulateData(url, operation, input_data, timeout, protected_contents, username, password);
  loop.exec();
  output = downloader.lastOutputData();
  result.first = downloader.lastOutputError();
  result.second = downloader.lastContentType();

  return result;
}
开发者ID:keinkurt,项目名称:rssguard,代码行数:30,代码来源:networkfactory.cpp

示例15: idpDownloadFiles

bool idpDownloadFiles()
{
	downloader.setUI(NULL);
	downloader.setUserAgent(userAgent);
	downloader.setInternetOptions(internetOptions);
	return downloader.downloadFiles();
}
开发者ID:Mirovinger,项目名称:WPN-XM,代码行数:7,代码来源:idp.cpp


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