本文整理汇总了C++中requestFinished函数的典型用法代码示例。如果您正苦于以下问题:C++ requestFinished函数的具体用法?C++ requestFinished怎么用?C++ requestFinished使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了requestFinished函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
void DownloadItem::init() {
if (!m_reply)
return;
if (m_file.exists())
m_file.remove();
m_status = Starting;
m_startedSaving = false;
m_finishedDownloading = false;
// attach to the m_reply
m_url = m_reply->url();
connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead()));
connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(error(QNetworkReply::NetworkError)));
connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)),
this, SLOT(downloadProgress(qint64, qint64)));
connect(m_reply, SIGNAL(metaDataChanged()),
this, SLOT(metaDataChanged()));
connect(m_reply, SIGNAL(finished()),
this, SLOT(requestFinished()));
// start timer for the download estimation
m_totalTime = 0;
m_downloadTime.start();
speedCheckTimer->start();
if (m_reply->error() != QNetworkReply::NoError) {
error(m_reply->error());
requestFinished();
}
}
示例2: URL
TrackerClient::TrackerClient(const QUrl &URL, const QByteArray &infoHash, const TrackerClientManager *manager, TrackerClientSocket *socket)
: URL(URL), key(Utility::rand(Q_INT64_C(0xffffffff))), infoHash(infoHash),
manager(manager), socket(socket),
minimalRequestInterval(defaultMinimalRequestInterval),
requestTimer(startTimer(defaultRequestInterval)), running(false)
{
connect(dynamic_cast<QObject*>(socket), SIGNAL(requestFinished(QByteArray)), SLOT(requestFinished(QByteArray)));
}
示例3: connect
void CommentsModel::getComments(int offset, int count)
{
if (m_session.data() && m_postId) {
auto reply = m_session.data()->getComments(offset, count);
connect(reply, SIGNAL(resultReady(QVariant)), SIGNAL(requestFinished()));
}
}
示例4: qWarning
int JsonDbPartition::create(const QJSValue &object, const QJSValue &options, const QJSValue &callback)
{
QJSValue actualOptions = options;
QJSValue actualCallback = callback;
if (options.isCallable()) {
if (!callback.isUndefined()) {
qWarning() << "Callback should be the last parameter.";
return -1;
}
actualCallback = actualOptions;
actualOptions = QJSValue(QJSValue::UndefinedValue);
}
//#TODO ADD options
QVariant obj = qjsvalue_to_qvariant(object);
QJsonDbWriteRequest *request(0);
if (obj.type() == QVariant::List) {
request = new QJsonDbCreateRequest(qvariantlist_to_qjsonobject_list(obj.toList()));
} else {
request = new QJsonDbCreateRequest(QJsonObject::fromVariantMap(obj.toMap()));
}
request->setPartition(_name);
connect(request, SIGNAL(finished()), this, SLOT(requestFinished()));
connect(request, SIGNAL(finished()), request, SLOT(deleteLater()));
connect(request, SIGNAL(error(QtJsonDb::QJsonDbRequest::ErrorCode,QString)),
this, SLOT(requestError(QtJsonDb::QJsonDbRequest::ErrorCode,QString)));
connect(request, SIGNAL(error(QtJsonDb::QJsonDbRequest::ErrorCode,QString)),
request, SLOT(deleteLater()));
JsonDatabase::sharedConnection().send(request);
writeCallbacks.insert(request, actualCallback);
return request->property("requestId").toInt();
}
示例5: connect
void MyWebView::initEvents()
{
// 委托页面所有连接在当前视图中打开
myPage->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
connect(myPage, SIGNAL(linkClicked(QUrl)), this, SLOT(onOpenUrl(QUrl)));
// 对所有事件添加信号槽
connect(myFrame, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
connect(myFrame, SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(onJavaScriptWindowObjectCleared()));
connect(myFrame, SIGNAL(initialLayoutCompleted()), this, SLOT(onInitialLayoutCompleted()));
connect(myFrame, SIGNAL(pageChanged()), this, SLOT(onPageChanged()));
connect(myFrame, SIGNAL(contentsSizeChanged(const QSize)), this, SLOT(onContentsSizeChanged(const QSize)));
connect(myFrame, SIGNAL(iconChanged()), this, SLOT(onIconChanged()));
connect(myFrame, SIGNAL(loadStarted()), this, SLOT(onLoadStarted()));
connect(myFrame, SIGNAL(titleChanged(const QString)), this, SLOT(onTitleChanged(const QString)));
connect(myFrame, SIGNAL(urlChanged(const QUrl)), this, SLOT(onUrlChanged(const QUrl)));
connect(myPage, SIGNAL(loadProgress(int)), this, SLOT(onLoadProgress(int)));
connect(myPage, SIGNAL(repaintRequested(const QRect)), this, SLOT(onRepaintRequested(const QRect)));
connect(myPage, SIGNAL(geometryChangeRequested(const QRect)), this, SLOT(onGeometryChangeRequested(const QRect)));
connect(newManager, SIGNAL(requestFinished(QString)),
this, SLOT(onRequestFinished(QString)));
connect(newManager, SIGNAL(requestStart(QString)),
this, SLOT(onRequestStart(QString)));
};
示例6: if
/*!
* \brief DocumentationViewer::processLinkClick
* \param url
* Slot activated when linkClicked signal of webview is raised.
* Handles the link processing. Sends all the http starting links to the QDesktopServices and process all Modelica starting links.
*/
void DocumentationViewer::processLinkClick(QUrl url)
{
// Send all http requests to desktop services for now.
// if url contains http or mailto: send it to desktop services
if ((url.toString().startsWith("http")) || (url.toString().startsWith("mailto:"))) {
QDesktopServices::openUrl(url);
} else if (url.scheme().compare("modelica") == 0) { // if the user has clicked on some Modelica Links like modelica://
// remove modelica:/// from Qurl
QString resourceLink = url.toString().mid(12);
/* if the link is a resource e.g .html, .txt or .pdf */
if (resourceLink.endsWith(".html") || resourceLink.endsWith(".txt") || resourceLink.endsWith(".pdf")) {
QString resourceAbsoluteFileName = mpDocumentationWidget->getMainWindow()->getOMCProxy()->uriToFilename("modelica://" + resourceLink);
QDesktopServices::openUrl("file:///" + resourceAbsoluteFileName);
} else {
LibraryTreeItem *pLibraryTreeItem = mpDocumentationWidget->getMainWindow()->getLibraryWidget()->getLibraryTreeModel()->findLibraryTreeItem(resourceLink);
// send the new className to DocumentationWidget
if (pLibraryTreeItem) {
mpDocumentationWidget->showDocumentation(pLibraryTreeItem);
}
}
} else { // if it is normal http request then check if its not redirected to https
QNetworkAccessManager* accessManager = page()->networkAccessManager();
QNetworkRequest request(url);
QNetworkReply* reply = accessManager->get(request);
connect(reply, SIGNAL(finished()), SLOT(requestFinished()));
}
}
示例7: refresh
void MusicCollector::loadList()
{
if (playlistId == 0) {
if (nextOperation == OperationNone) {
nextOperation = OperationLoadPlaylist;
operatingId.clear();
}
if (!currentReply || currentReply->property(KeyOperation).toInt() != OperationLoadPid) {
refresh();
}
return;
}
if (currentReply && currentReply->isRunning())
currentReply->abort();
QUrl url(QString(ApiBaseUrl).append("/v2/playlist/detail"));
url.addEncodedQueryItem("id", QByteArray::number(playlistId));
url.addEncodedQueryItem("t", "-1");
url.addEncodedQueryItem("n", "1000");
url.addEncodedQueryItem("s", "0");
checkNAM();
currentReply = manager->get(QNetworkRequest(url));
currentReply->setProperty(KeyOperation, OperationLoadPlaylist);
connect(currentReply, SIGNAL(finished()), SLOT(requestFinished()), Qt::QueuedConnection);
emit loadingChanged();
}
示例8: XQServiceRequest
/*!
* Uses Qt Highway to send 'addWidget' request to home screen application.
* \a uri and \a preferences as in widget model.
*/
void HsHomescreenClient::doAddWidget(
const QString &uri,
const QVariantHash &preferences)
{
delete mAsyncRequest;
mAsyncRequest = 0;
mAsyncRequest = new XQServiceRequest(INTERFACE_NAME,
"addWidget(QString,QVariantHash)", false);
XQRequestInfo requestInfo = mAsyncRequest->info();
requestInfo.setBackground(true);
mAsyncRequest->setInfo(requestInfo);
*mAsyncRequest << uri;
*mAsyncRequest << preferences;
connect(mAsyncRequest, SIGNAL(requestCompleted(QVariant)),
SLOT(onRequestCompleted(QVariant)));
connect(mAsyncRequest, SIGNAL(requestError(int)),
SLOT(onRequestError(int)));
mRequestResult = false;
if (!mAsyncRequest->send()) {
emit requestFinished();
}
}
示例9: url
void UpdateChecker::checkForUpdate() {
QUrl url(QLatin1String(Constants::WEBSITE) + "-ws/release.xml");
{
QUrlQueryHelper urlHelper(url);
urlHelper.addQueryItem("v", Constants::VERSION);
#ifdef APP_MAC
urlHelper.addQueryItem("os", "mac");
#endif
#ifdef APP_WIN
urlHelper.addQueryItem("os", "win");
#endif
#ifdef APP_ACTIVATION
QString t = "demo";
if (Activation::instance().isActivated()) t = "active";
urlHelper.addQueryItem("t", t);
#endif
#ifdef APP_MAC_STORE
urlHelper.addQueryItem("store", "mac");
#endif
}
QObject *reply = The::http()->get(url);
connect(reply, SIGNAL(data(QByteArray)), SLOT(requestFinished(QByteArray)));
}
示例10: Q_ASSERT
void Cinema::initFromXml(const QDomElement& e)
{
Q_ASSERT(e.tagName() == "cinema");
clear();
id_ = XMLHelper::subTagText(e, "id");
name_ = XMLHelper::subTagText(e, "name");
address_ = XMLHelper::subTagText(e, "address");
metro_ = XMLHelper::subTagText(e, "metro");
details_ = XMLHelper::subTagText(e, "details");
ll_ = XMLHelper::subTagText(e, "ll");
if (!e.attribute("detailed").isEmpty()) {
hasDetailedInfo_ = true;
finishedProgress_ = 50;
if (!address_.isEmpty() && ll_.isEmpty() && !XMLHelper::hasSubTag(e, "ll")) {
Geocoder* geocoder = new Geocoder(QString("%1_geocoder_%2")
.arg(AfishaHelpers::cinemaCacheDate())
.arg(id_), this);
request_ = geocoder;
connect(geocoder, SIGNAL(finished()), SLOT(requestFinished()));
geocoder->request(address_);
}
else {
finishedProgress_ = 100;
}
// if (!details_.isEmpty())
// qWarning() << id_ << name_ << address_ << metro_;
}
emit dataChanged();
}
示例11: Q_ASSERT
void MediaDownloadTask::start(const QUrl &url, const QList<QNetworkCookie> &cookies, unsigned position,
unsigned size)
{
Q_ASSERT(!m_reply);
if (!threadNAM.hasLocalData())
{
threadNAM.setLocalData(new QNetworkAccessManager);
/* XXX certificate validation */
}
threadNAM.localData()->cookieJar()->setCookiesFromUrl(cookies, url);
if (threadNAM.localData()->cookieJar()->cookiesForUrl(url).isEmpty())
qDebug() << "MediaDownload: No cookies for media URL, likely to fail authentication";
QNetworkRequest req(url);
if (position || size)
{
QByteArray range = "bytes=" + QByteArray::number(position) + "-";
if (size)
range += QByteArray::number(position + size);
req.setRawHeader("Range", range);
}
m_writePos = position;
m_reply = threadNAM.localData()->get(req);
m_reply->ignoreSslErrors(); // XXX Do this properly!
connect(m_reply, SIGNAL(metaDataChanged()), SLOT(metaDataReady()));
connect(m_reply, SIGNAL(readyRead()), SLOT(read()));
connect(m_reply, SIGNAL(finished()), SLOT(requestFinished()));
}
示例12: requestStart
QNetworkReply* NetworkAccessManager::createRequest(QNetworkAccessManager::Operation operation,
const QNetworkRequest &request, QIODevice *device)
{
qint64 time;
if (isListener) {
time = QDateTime::currentDateTime().toMSecsSinceEpoch();
}
QNetworkReply *reply = QNetworkAccessManager::createRequest(operation, request, device);
reply->ignoreSslErrors();
if (isListener) {
// 触发请求开始的自定义信号
emit requestStart(request.url().toString());
// 不清除这个指针
// TODO: 该类由 webview 接管处理
CustomDownload* customDownload = new CustomDownload(reply, request,
QDateTime::currentDateTime().toMSecsSinceEpoch() - time,
time);
connect(customDownload, SIGNAL(requestFinished(QString)),
this, SLOT(onRequestFinished(QString)));
}
return reply;
}
示例13: connect
void NewsFeedModel::getNews(int filters, quint8 count, int offset)
{
if (m_newsFeed.isNull())
return;
auto reply = m_newsFeed.data()->getNews(static_cast<Vreen::NewsFeed::Filters>(filters), count, offset);
connect(reply, SIGNAL(resultReady(QVariant)), SIGNAL(requestFinished()));
}
示例14: qDebug
void SM_QDropbox::networkReplyFinished(QNetworkReply *rply)
{
#ifdef SM_QTDROPBOX_DEBUG
qDebug() << "reply finished" << endl;
#endif
int reqnr = replynrMap[rply];
requestFinished(reqnr, rply);
rply->deleteLater(); // release memory
}
示例15: QPlaceReply
CategoryInitReply::CategoryInitReply(QPlaceManagerEngineJsonDb *engine)
: QPlaceReply(engine),
m_engine(engine),
m_traverser(new CategoryTraverser(m_engine->db(), this))
{
Q_ASSERT(m_traverser);
connect(m_traverser, SIGNAL(finished()),
this, SLOT(requestFinished()));
}