Exemplo n.º 1
0
void tst_QStringMatcher::indexIn()
{
    QFETCH(QString, needle);
    QFETCH(QString, haystack);
    QFETCH(int, from);
    QFETCH(int, indexIn);

    QStringMatcher matcher;
    matcher.setPattern(needle);

    QCOMPARE(matcher.indexIn(haystack, from), indexIn);
}
Exemplo n.º 2
0
void tst_QStringMatcher::setCaseSensitivity()
{
    QFETCH(QString, needle);
    QFETCH(QString, haystack);
    QFETCH(int, from);
    QFETCH(int, indexIn);
    QFETCH(int, cs);

    QStringMatcher matcher;
    matcher.setPattern(needle);
    matcher.setCaseSensitivity(static_cast<Qt::CaseSensitivity> (cs));

    QCOMPARE(matcher.indexIn(haystack, from), indexIn);
}
Exemplo n.º 3
0
void Fetcher::downloadUrl(QUrl url)
{
    QStringMatcher js;

    js.setPattern(".js");

    if (js.indexIn(url.toString())!=-1)
        qDebug() << "javascript. Ignoring";
    else
    {
//        qDebug() << "Getting url:" << url;
        QNetworkReply* reply = dlMgr->get(QNetworkRequest(url));

        statusText->setText("Downloading:");
        statusText->show();
        progressBar->show();
        connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(updateProgress(qint64,qint64)));
        connect(reply,SIGNAL(finished()),progressBar,SLOT(hide()));
        connect(reply,SIGNAL(finished()),statusText,SLOT(hide()));
    }
}