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); }
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); }
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())); } }