void RouteDataGen::downloadReady (QNetworkReply *reply) { currentNetworkRequest = 0; emit dataFinished(); if (reply->error() != QNetworkReply::NoError) { QString errorString(reply->errorString()); qDebug() << errorString; #if defined(Q_WS_MAEMO_5) QMaemo5InformationBox::information(NULL, errorString, QMaemo5InformationBox::NoTimeout); #endif reply->deleteLater(); return; } if (!this->xmlReader.parse(QXmlInputSource(reply))) { qDebug() << "Parsing failed" << endl; } reply->deleteLater(); }
DccTransferRecvWriteCacheHandler::DccTransferRecvWriteCacheHandler( KIO::TransferJob* transferJob ) : m_transferJob( transferJob ) { m_writeReady = true; m_cacheStream = 0; connect( this, SIGNAL( dataFinished() ), m_transferJob, SLOT( slotFinished() ) ); connect( m_transferJob, SIGNAL( dataReq( KIO::Job*, QByteArray& ) ), this, SLOT( slotKIODataReq( KIO::Job*, QByteArray& ) ) ); connect( m_transferJob, SIGNAL( result( KIO::Job* ) ), this, SLOT( slotKIOResult( KIO::Job* ) ) ); m_transferJob->setAsyncDataEnabled( m_writeAsyncMode = true ); }
void Controller::sendDummyWeek(QDate startDate, QDate endDate) { // Sleep( 500 ); std::vector<Dish> dishesVect; dishesVect.push_back( Dish( "Ciorba de varza", "tortilla piept de pui cascaval ardei gras ceapa patrunjel ulei boia usturoi oregano sare", QPixmap(RESOURCES_ROOT"supa3.png"), 1 ) ); dishesVect.push_back( Dish( "Aripioare de pui cu crusta de porumb", "tortilla piept de pui cascaval ardei gras ceapa patrunjel ulei boia usturoi oregano sare", QPixmap(RESOURCES_ROOT"mancare5.png"), 2 ) ); dishesVect.push_back( Dish( "Pastrav pane cu spanac", "tortilla piept de pui cascaval ardei gras ceapa patrunjel ulei boia usturoi oregano sare", QPixmap(RESOURCES_ROOT"mancare1.png"), 2 ) ); dishesVect.push_back( Dish( "Salata din gradina ursului", "tortilla piept de pui cascaval ardei gras ceapa patrunjel ulei boia usturoi oregano sare", QPixmap(RESOURCES_ROOT"salata1.png"), 3 ) ); dishesVect.push_back( Dish( "Salata din gradina bunicii", "tortilla piept de pui cascaval ardei gras ceapa patrunjel ulei boia usturoi oregano sare", QPixmap(RESOURCES_ROOT"salata2.png"), 3 ) ); dishesVect.push_back( Dish( "Supa de ceva fara ceva", "tortilla piept de pui cascaval ardei gras ceapa patrunjel ulei boia usturoi oregano sare", QPixmap(RESOURCES_ROOT"supa4.png"), 1 ) ); dishesVect[0].setNumHappies( rand() % 250 ); dishesVect[1].setNumMeahs( rand() % 250 ); dishesVect[2].setNumWows( rand() % 250 ); dishesVect[3].setNumWows( rand() % 250 ); dishesVect[4].setNumWows( rand() % 250 ); dishesVect[5].setNumWows( rand() % 250 ); // // dishesVect[0].setUserRating( Dish::eHappy ); // dishesVect[1].setUserRating( Dish::eMeah ); // dishesVect[5].setUserRating( Dish::eHappy ); // dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) ); // dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); std::vector<Day> daysVect; srand(time(0)); randomizeRatings(dishesVect); std::random_shuffle( dishesVect.begin(), dishesVect.end() ); // dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) ); // dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); daysVect.push_back( Day( "Luni", dishesVect ) ); randomizeRatings(dishesVect); std::random_shuffle( dishesVect.begin(), dishesVect.end() ); // dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) ); // dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); daysVect.push_back( Day( "Marti", dishesVect ) ); randomizeRatings(dishesVect); std::random_shuffle( dishesVect.begin(), dishesVect.end() ); // dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) ); // dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); daysVect.push_back( Day( "Miercuri", dishesVect ) ); randomizeRatings(dishesVect); std::random_shuffle( dishesVect.begin(), dishesVect.end() ); // dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) ); // dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); daysVect.push_back( Day( "Joi", dishesVect ) ); randomizeRatings(dishesVect); std::random_shuffle( dishesVect.begin(), dishesVect.end() ); // dishesVect[0].setUserInterest( Dish::EUserInterest( rand() % 4 - 1 ) ); // dishesVect[1].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[2].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[3].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); // dishesVect[4].setUserInterest( Dish::EUserInterest( rand() % 4 - 1) ); // dishesVect[5].setUserInterest( Dish::EUserInterest( rand() % 4 ) ); daysVect.push_back( Day( "Vineri", dishesVect ) ); Week week( startDate, endDate, daysVect ); // Show only 2 after and 2 before QDate today = QDate::currentDate(); if( startDate.weekNumber() - today.weekNumber() > 1 ) week.setLastAvailable( true ); else if( startDate.weekNumber() - today.weekNumber() < -1 ) week.setFirstAvailable( true ); emit dataFinished( week ); }