bool HttpWindow::RetriveJpgUrlFromFile(QString index_file, QString &jpgUrl) { QString begin_tag("g_img={url:'"); QFile file(index_file); if(!file.open(QIODevice::ReadOnly)) { qDebug("Cann't open file for read"); return FALSE; } QTextStream in(&file); while(!in.atEnd()) { qint16 i_begin = 0; qint16 i_end = 0; QString line = in.readLine(); i_begin = line.indexOf(begin_tag,0); if(-1 != i_begin) { i_begin = line.indexOf("'", i_begin); i_end = line.indexOf("'", i_begin + 1); jpgUrl = line.mid(i_begin + 1, i_end - i_begin - 1); jpgUrl.insert(0,"http://www.bing.com"); qDebug(jpgUrl.toAscii()); break; } } qDebug(jpgUrl.toAscii()); file.close(); return TRUE; }
result_type operator()(StoppableGenerator& gen) const { return result_type( iter_t(gen, begin_tag()), iter_t(gen, end_tag()) ); }