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


C++ QUrl::toEncoded方法代码示例

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


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

示例1: getSource

void GetHTML::getSource(const QUrl &url)
{
    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() << "...";
    //printf("Downloading %s...\n", url.toEncoded().constData());
    downloadTime.start();
}
开发者ID:surfhai,项目名称:HomeRemote,代码行数:17,代码来源:gethtml.cpp

示例2: drawNewVectorLayer

/**
* Slot called after the user selects the x, y fields in the field selection gui component
* @param layerName - Name to display in the legend
* @param xCoordinate - Name of the field containing the x coordinate
* @param yCoordinate - Name of the field containing the y coordinate
*/
void eVisDatabaseConnectionGui::drawNewVectorLayer( const QString &layerName, const QString &xCoordinate, const QString &yCoordinate )
{
  //if coorindate fields are defined, load as a delimited text layer
  if ( !xCoordinate.isEmpty() && !yCoordinate.isEmpty() && !mTempOutputFileList->isEmpty() )
  {
    //fileName is only available if the file is open
    //the last file in the list is always the newest
    mTempOutputFileList->last()->open();
    QUrl url = QUrl::fromLocalFile( mTempOutputFileList->last()->fileName() );
    url.addQueryItem( QStringLiteral( "delimiter" ), QStringLiteral( "\t" ) );
    url.addQueryItem( QStringLiteral( "delimiterType" ), QStringLiteral( "regexp" ) );
    url.addQueryItem( QStringLiteral( "xField" ), xCoordinate );
    url.addQueryItem( QStringLiteral( "yField" ), yCoordinate );
    emit drawVectorLayer( QString::fromLatin1( url.toEncoded() ), layerName, QStringLiteral( "delimitedtext" ) );
    mTempOutputFileList->last()->close();
  }
}
开发者ID:cz172638,项目名称:QGIS,代码行数:23,代码来源:evisdatabaseconnectiongui.cpp

示例3: uniqueFileName

/*!
    Given a URL, generates a unique enough filename (and subdirectory)
 */
QString QNetworkDiskCachePrivate::uniqueFileName(const QUrl &url)
{
    QUrl cleanUrl = url;
    cleanUrl.setPassword(QString());
    cleanUrl.setFragment(QString());

    QCryptographicHash hash(QCryptographicHash::Sha1);
    hash.addData(cleanUrl.toEncoded());
    // convert sha1 to base36 form and return first 8 bytes for use as string
    QByteArray id =  QByteArray::number(*(qlonglong*)hash.result().data(), 36).left(8);
    // generates <one-char subdir>/<8-char filname.d>
    uint code = (uint)id.at(id.length()-1) % 16;
    QString pathFragment = QString::number(code, 16) + QLatin1Char('/')
                             + QLatin1String(id) + CACHE_POSTFIX;

    return pathFragment;
}
开发者ID:FlavioFalcao,项目名称:qt5,代码行数:20,代码来源:qnetworkdiskcache.cpp

示例4: GetEpisodeByUrl

PodcastEpisode PodcastBackend::GetEpisodeByUrl(const QUrl& url) {
  PodcastEpisode ret;

  QMutexLocker l(db_->Mutex());
  QSqlDatabase db(db_->Connect());

  QSqlQuery q("SELECT ROWID, " + PodcastEpisode::kColumnSpec +
                  " FROM podcast_episodes"
                  " WHERE url = :url",
              db);
  q.bindValue(":url", url.toEncoded());
  q.exec();
  if (!db_->CheckErrors(q) && q.next()) {
    ret.InitFromQuery(q);
  }

  return ret;
}
开发者ID:Aceler,项目名称:Clementine,代码行数:18,代码来源:podcastbackend.cpp

示例5: redirect

/*!
  \~english
  Redirects to the URL \a url.

  \~japanese
  URL \a url へリダイレクトする
 */
void TActionController::redirect(const QUrl &url, int statusCode)
{
    if (rendered) {
        tError("Unable to redirect. Has rendered already: %s", qPrintable(className() + '#' + activeAction()));
        return;
    }
    rendered = true;
    
    setStatusCode(statusCode);
    response.header().setRawHeader("Location", url.toEncoded());
    response.setBody(QByteArray("<html><body>redirected.</body></html>"));
    response.header().setContentType("text/html");
    
    // Enable flash-variants
    QVariant var;
    var.setValue(flashVars);
    sessionStore.insert(FLASH_VARS_SESSION_KEY, var);
}
开发者ID:deniskin82,项目名称:treefrog-framework,代码行数:25,代码来源:tactioncontroller.cpp

示例6: startDrag

void TreeView::startDrag(Qt::DropActions)
{
	QByteArray itemData;
	QList<QUrl> urls = this->selectedTracks();

	for (int i = 0; i < urls.size(); i++) {
		QUrl u = urls.at(i);
		itemData.append(u.toEncoded());
		if (i + 1 < urls.size()) {
			itemData.append('|');
		}
	}
	QMimeData *mimeData = new QMimeData;
	mimeData->setData("treeview/x-treeview-item", itemData);
	QDrag *drag = new QDrag(this);
	drag->setMimeData(mimeData);
	drag->exec(Qt::MoveAction | Qt::CopyAction, Qt::CopyAction);
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例7: ReplaceDecodeBin

bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) {
  GstElement* new_bin = nullptr;

  if (url.scheme() == "spotify") {
    new_bin = gst_bin_new("spotify_bin");

    // Create elements
    GstElement* src = engine_->CreateElement("tcpserversrc", new_bin);
    GstElement* gdp = engine_->CreateElement("gdpdepay", new_bin);
    if (!src || !gdp) return false;

    // Pick a port number
    const int port = Utilities::PickUnusedPort();
    g_object_set(G_OBJECT(src), "host", "127.0.0.1", nullptr);
    g_object_set(G_OBJECT(src), "port", port, nullptr);

    // Link the elements
    gst_element_link(src, gdp);

    // Add a ghost pad
    GstPad* pad = gst_element_get_static_pad(gdp, "src");
    gst_element_add_pad(GST_ELEMENT(new_bin), gst_ghost_pad_new("src", pad));
    gst_object_unref(GST_OBJECT(pad));

    // Tell spotify to start sending data to us.
    SpotifyServer* spotify_server =
        InternetModel::Service<SpotifyService>()->server();
    // Need to schedule this in the spotify server's thread
    QMetaObject::invokeMethod(
        spotify_server, "StartPlayback", Qt::QueuedConnection,
        Q_ARG(QString, url.toString()), Q_ARG(quint16, port));
  } else {
    new_bin = engine_->CreateElement("uridecodebin");
    g_object_set(G_OBJECT(new_bin), "uri", url.toEncoded().constData(),
                 nullptr);
    CHECKED_GCONNECT(G_OBJECT(new_bin), "drained", &SourceDrainedCallback,
                     this);
    CHECKED_GCONNECT(G_OBJECT(new_bin), "pad-added", &NewPadCallback, this);
    CHECKED_GCONNECT(G_OBJECT(new_bin), "notify::source", &SourceSetupCallback,
                     this);
  }

  return ReplaceDecodeBin(new_bin);
}
开发者ID:jonathanchristison,项目名称:Clementine,代码行数:44,代码来源:gstenginepipeline.cpp

示例8: gotTokenUrl

void SignUpForm::gotTokenUrl(QUrl url)
{
    settings->setConsumerKey(ui->lineEditKey->text());
    settings->setSharedSecret(ui->lineEditSharedSecret->text());
    settings->setApplicationName(ui->lineEditApplicationName->text());

    url.addQueryItem(STR(OAUTH_CONSUMER_KEY),ui->lineEditKey->text());

    qDebug() << url.toEncoded();
    if (loginForm != NULL)
    {
        loginForm->setParent(NULL);
        delete loginForm;
    }

    loginForm = new LoginForm(url,this);
    connect(loginForm,SIGNAL(loginSucceeded()),this,SLOT(loginSucceeded()));
    loginForm->show();
}
开发者ID:smandava,项目名称:cuteflix,代码行数:19,代码来源:signupform.cpp

示例9: getPostData

QByteArray OpenSearchEngine::getPostData(const QString &searchTerm) const
{
    if (m_searchMethod != QLatin1String("post")) {
        return QByteArray();
    }

    QUrl retVal = QUrl("http://foo.bar");

    QUrlQuery query(retVal);
    Parameters::const_iterator end = m_searchParameters.constEnd();
    Parameters::const_iterator i = m_searchParameters.constBegin();
    for (; i != end; ++i) {
        query.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
    }
    retVal.setQuery(query);

    QByteArray data = retVal.toEncoded(QUrl::RemoveScheme);
    return data.contains('?') ? data.mid(data.lastIndexOf('?') + 1) : QByteArray();
}
开发者ID:Acidburn0zzz,项目名称:qupzilla,代码行数:19,代码来源:opensearchengine.cpp

示例10:

QList<QByteArray> QMacPasteboardMimeFileUri::convertFromMime(const QString &mime, QVariant data, QString flav)
{
    QList<QByteArray> ret;
    if (!canConvert(mime, flav))
        return ret;
    QList<QVariant> urls = data.toList();
    for(int i = 0; i < urls.size(); ++i) {
        QUrl url = urls.at(i).toUrl();
        if (url.scheme().isEmpty())
            url.setScheme(QLatin1String("file"));
        if (url.scheme().toLower() == QLatin1String("file")) {
            if (url.host().isEmpty())
                url.setHost(QLatin1String("localhost"));
            url.setPath(url.path().normalized(QString::NormalizationForm_D));
        }
        ret.append(url.toEncoded());
    }
    return ret;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:19,代码来源:qmime_mac.cpp

示例11: open

/*!
 * \brief Opens a websocket connection using the given \a url.
 * If \a mask is true, all frames will be masked; this is only necessary for client side sockets; servers should never mask
 * \param url The url to connect to
 * \param mask When true, all frames are masked
 * \note A client socket must *always* mask its frames; servers may *never* mask its frames
 */
void WebSocket::open(const QUrl &url, bool mask)
{
	m_dataProcessor.clear();
	m_isClosingHandshakeReceived = false;
	m_isClosingHandshakeSent = false;

	setRequestUrl(url);
    QString resourceName = url.path() + url.toEncoded(); // NOTE 4.8
	if (resourceName.isEmpty())
	{
		resourceName = "/";
	}
	setResourceName(resourceName);
	enableMasking(mask);

	setSocketState(QAbstractSocket::ConnectingState);

	m_pSocket->connectToHost(url.host(), url.port(80));
}
开发者ID:Jasonic,项目名称:IanniX,代码行数:26,代码来源:websocket.cpp

示例12: resourcePathForUrl

QByteArray MmRendererMediaPlayerControl::resourcePathForUrl(const QUrl &url)
{
    // If this is a local file, mmrenderer expects the file:// prefix and an absolute path.
    // We treat URLs without scheme as local files, most likely someone just forgot to set the
    // file:// prefix when constructing the URL.
    if (url.isLocalFile() || url.scheme().isEmpty()) {
        QString relativeFilePath;
        if (!url.scheme().isEmpty())
            relativeFilePath = url.toLocalFile();
        else
            relativeFilePath = url.path();
        const QFileInfo fileInfo(relativeFilePath);
        return QFile::encodeName(QStringLiteral("file://") + fileInfo.absoluteFilePath());

    // HTTP or similar URL
    } else {
        return url.toEncoded();
    }
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:19,代码来源:mmrenderermediaplayercontrol.cpp

示例13: startNextDownload

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

    QUrl url = downloadQueue.dequeue();
    QFileInfo fileInf(url.toString());
    QString fileName = QString("%1%2").arg(mPath).arg("UbuntuCodeofConduct.txt");


//    QString filename = saveFileName(fileName);

    setSavedFileName(fileName);



    qDebug() << fileName;

    output.setFileName(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() << "........";
    downloadTime.start();
}
开发者ID:elmudometal,项目名称:cdc,代码行数:46,代码来源:downloader.cpp

示例14: ReplaceDecodeBin

bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) {
    GstElement* new_bin = NULL;

    if (url.scheme() == "spotify") {
#ifdef HAVE_SPOTIFY
        new_bin = gst_bin_new("spotify_bin");

        // Create elements
        GstElement* src = engine_->CreateElement("tcpserversrc", new_bin);
        GstElement* gdp = engine_->CreateElement("gdpdepay", new_bin);
        if (!src || !gdp)
            return false;

        // Pick a port number
        const int port = Utilities::PickUnusedPort();
        g_object_set(G_OBJECT(src), "host", "127.0.0.1", NULL);
        g_object_set(G_OBJECT(src), "port", port, NULL);

        // Link the elements
        gst_element_link(src, gdp);

        // Add a ghost pad
        GstPad* pad = gst_element_get_static_pad(gdp, "src");
        gst_element_add_pad(GST_ELEMENT(new_bin), gst_ghost_pad_new("src", pad));
        gst_object_unref(GST_OBJECT(pad));

        // Tell spotify to start sending data to us.
        InternetModel::Service<SpotifyService>()->server()->StartPlaybackLater(url.toString(), port);
#else // HAVE_SPOTIFY
        qLog(Error) << "Tried to play a spotify:// url, but spotify support is not compiled in";
        return false;
#endif
    } else {
        new_bin = engine_->CreateElement("uridecodebin");
        g_object_set(G_OBJECT(new_bin), "uri", url.toEncoded().constData(), NULL);
        CHECKED_GCONNECT(G_OBJECT(new_bin), "drained", &SourceDrainedCallback, this);
        CHECKED_GCONNECT(G_OBJECT(new_bin), "pad-added", &NewPadCallback, this);
        CHECKED_GCONNECT(G_OBJECT(new_bin), "notify::source", &SourceSetupCallback, this);
    }

    return ReplaceDecodeBin(new_bin);
}
开发者ID:nti1094,项目名称:clementine-subsonic,代码行数:42,代码来源:gstenginepipeline.cpp

示例15: DoSearch

void NetSearch::DoSearch()
{
    m_searchResultList->Reset();

    int numScripts = m_siteList->GetCount();
    for (int i = 0; i < numScripts; i++)
        m_siteList->GetItemAt(i)->SetText("", "count");

    if (m_pageText)
        m_pageText->Reset();

    m_pagenum = 1;
    m_maxpage = 1;

    QString cmd = m_siteList->GetDataValue().toString();
    QString grabber = m_siteList->GetItemCurrent()->GetText();
    QString query = m_search->GetText();

    if (query.isEmpty())
        return;

    QFileInfo fi(cmd);
    m_currentCmd = fi.fileName();
    m_currentGrabber = m_siteList->GetCurrentPos();
    m_currentSearch = query;

    QString title = tr("Searching %1 for \"%2\"...")
                    .arg(grabber).arg(query);
    OpenBusyPopup(title);

    if (!m_netSearch)
        m_netSearch = new QNetworkAccessManager(this);
    connect(m_netSearch, SIGNAL(finished(QNetworkReply*)),
            SLOT(SearchFinished(void)));

    QUrl init = GetMythXMLSearch(m_mythXML, m_currentSearch,
                                 m_currentCmd, m_pagenum);
    QUrl req(init.toEncoded(), QUrl::TolerantMode);
    LOG(VB_GENERAL, LOG_INFO,
        QString("Using Search URL %1").arg(req.toString()));
    m_reply = m_netSearch->get(QNetworkRequest(req));
}
开发者ID:DragonStalker,项目名称:mythtv,代码行数:42,代码来源:netsearch.cpp


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