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


C++ requestFinished函数代码示例

本文整理汇总了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();
    }
}
开发者ID:PyPavel,项目名称:minitube,代码行数:34,代码来源:downloaditem.cpp

示例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)));
}
开发者ID:Etrnls,项目名称:evangel,代码行数:8,代码来源:trackerclient.cpp

示例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()));
    }
}
开发者ID:Krasnogorov,项目名称:vreen,代码行数:7,代码来源:commentsmodel.cpp

示例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();
}
开发者ID:Distrotech,项目名称:qtjsondb,代码行数:31,代码来源:jsondbpartition.cpp

示例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)));
};
开发者ID:leeight,项目名称:berserkJS,代码行数:26,代码来源:mywebview.cpp

示例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()));
  }
}
开发者ID:hkiel,项目名称:OMEdit,代码行数:33,代码来源:DocumentationWidget.cpp

示例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();
}
开发者ID:SunRain,项目名称:cloudmusicqt,代码行数:32,代码来源:musiccollector.cpp

示例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();
    }
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:30,代码来源:hshomescreenclient.cpp

示例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)));

}
开发者ID:Gira-X,项目名称:minitube,代码行数:27,代码来源:updatechecker.cpp

示例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();
}
开发者ID:mblsha,项目名称:afisha-cinema,代码行数:34,代码来源:cinema.cpp

示例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()));
}
开发者ID:chenbk85,项目名称:bluecherry-client,代码行数:32,代码来源:MediaDownload.cpp

示例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;
}
开发者ID:Dawn-King,项目名称:berserkJS,代码行数:27,代码来源:networkaccessmanager.cpp

示例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()));
}
开发者ID:Krasnogorov,项目名称:vreen,代码行数:8,代码来源:newsfeedmodel.cpp

示例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
}
开发者ID:AdrianBZG,项目名称:SyncMe,代码行数:9,代码来源:SM_qdropbox.cpp

示例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()));
}
开发者ID:amccarthy,项目名称:qtlocation,代码行数:9,代码来源:initreply.cpp


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