void QgsGrassTools::on_mDirectFilterInput_textChanged( QString theText ) { QgsDebugMsg( "GRASS direct modules filter changed to :" + theText ); QRegExp::PatternSyntax mySyntax = QRegExp::PatternSyntax( QRegExp::RegExp ); Qt::CaseSensitivity myCaseSensitivity = Qt::CaseInsensitive; QRegExp myRegExp( theText, myCaseSensitivity, mySyntax ); mDirectModelProxy->setFilterRegExp( myRegExp ); }
void QgsPluginManager::on_leFilter_textChanged( QString theText ) { QgsDebugMsg( "PluginManager filter changed to :" + theText ); QRegExp::PatternSyntax mySyntax = QRegExp::PatternSyntax( QRegExp::RegExp ); Qt::CaseSensitivity myCaseSensitivity = Qt::CaseInsensitive; QRegExp myRegExp( theText, myCaseSensitivity, mySyntax ); mModelProxy->setFilterRegExp( myRegExp ); }
void QgsWFSSourceSelect::filterChanged( const QString& text ) { QgsDebugMsg( "WFS FeatureType filter changed to :" + text ); QRegExp::PatternSyntax mySyntax = QRegExp::PatternSyntax( QRegExp::RegExp ); Qt::CaseSensitivity myCaseSensitivity = Qt::CaseInsensitive; QRegExp myRegExp( text, myCaseSensitivity, mySyntax ); mModelProxy->setFilterRegExp( myRegExp ); mModelProxy->sort( mModelProxy->sortColumn(), mModelProxy->sortOrder() ); }
void CLastFm::managerReply(QNetworkReply *pReply, QString mtd) { int size1, size2; size1 = methods.size(); size2 = bytearrays.size(); if (size1 != size2) qDebug() << "WARNING ! Queues have different sizes !"; else qDebug() << "BEGIN: Queue size is" << size1; if (size1 <= 0) return; QByteArray data=pReply->readAll(); QString content(data); qDebug() << "lastFm manager reply :" << content; emit lastReply(content); qDebug() << "URL was :" << pReply->url().toString(); // JEŚLI RESPONSE JEST OK, TO USUWAMY JUŻ TEN REQUEST if (content.contains("status=\"ok\"")) { if (!methods.isEmpty()) methods.removeFirst(); if (!bytearrays.isEmpty()) bytearrays.removeFirst(); } // ===================== // // auth.getMobileSession // // ===================== // if (mtd == "auth.getMobileSession") { qDebug() << "I got auth.getMobileSession response..."; if (content.contains("status=\"ok\"")) { QRegExp myRegExp(".+<key>"); content.remove(myRegExp); myRegExp = QRegExp("</key>.+"); content.remove(myRegExp); lastFmSessionKey = content; isSessionOK = true; } else { isSessionOK = false; if (content.contains("error code=\"4\"")) { qDebug() << "Check your last.fm user/pass"; emit errSignal("Check your last.fm user/pass"); } else if (content.contains("error code=\"11\"")) { qDebug() << "Last.fm is temporarily offline"; emit errSignal("Last.fm is temporarily offline"); } else { qDebug() << "Some strange error occured and I couldn't get lastFm session"; emit errSignal("I couldn't get last.fm session"); } } } // ====================== // // track.updateNowPlaying // // ====================== // else if (mtd == "track.updateNowPlaying") { qDebug() << "I got track.updateNowPlaying response..."; if (content.contains("status=\"ok\"")) { // } else { if (content.contains("error code=\"9\"")) { qDebug() << "Invalid session key, I'm re-authenticating..."; isSessionOK = false; getSession(); } else if (content.contains("error code=\"11\"")) { qDebug() << "Last.fm is temporarily offline"; emit errSignal("Last.fm is temporarily offline"); } else if (content.contains("error code=\"16\"")) { qDebug() << "Last.fm is temporarily unavailable"; emit errSignal("Last.fm is temporarily unavailable"); } else { qDebug() << "Some strange error occured and I couldn't updateNowPlaying"; emit errSignal("I couldn't update \"Now Playing\""); } } } // ========== // // track.love // // ========== // else if (mtd == "track.love") { qDebug() << "I got track.love response..."; if (content.contains("status=\"ok\"")) { if (!myLoveQueue[0].isEmpty()) { myLoveQueue[0].removeAt(0); myLoveQueue[1].removeAt(0); myLoveQueue[2].removeAt(0); } if (!myLoveQueue[0].isEmpty()) { loveSongs(); } } } // ============ // // track.unlove // // ============ // else if (mtd == "track.unlove") { qDebug() << "I got track.unlove response..."; if (content.contains("status=\"ok\"")) { if (!myUnloveQueue[0].isEmpty()) { myUnloveQueue[0].removeAt(0); myUnloveQueue[1].removeAt(0); myUnloveQueue[2].removeAt(0); } if (!myUnloveQueue[0].isEmpty()) { unloveSongs(); } } } // ============== // // track.scrobble // // ============== // else if (mtd == "track.scrobble") { qDebug() << "I got track.scrobble response..."; int oldSize = myLastQueue[0].size(); int newSize; if (content.contains("status=\"ok\"")) { if (myLastQueue[0].size() > 10) { for (int i = 0 ; i <= 9 ; i++) { myLastQueue[0].removeAt(0); myLastQueue[1].removeAt(0); myLastQueue[2].removeAt(0); myLastQueue[3].removeAt(0); } newSize = myLastQueue[0].size(); lastFmSent = lastFmSent + (oldSize - newSize); emit sentChanged(lastFmSent); lastFmQueued = lastFmQueued - (oldSize - newSize); emit queueChanged(lastFmQueued); scrobbleSongs(); } else { int tmpSize = myLastQueue[0].size(); for (int i = 0 ; i < tmpSize ; i++) { myLastQueue[0].removeAt(0); myLastQueue[1].removeAt(0); myLastQueue[2].removeAt(0); myLastQueue[3].removeAt(0); } emit ifSongIsPlayingUpdateNowPlaying(); newSize = myLastQueue[0].size(); lastFmSent = lastFmSent + (oldSize - newSize); emit sentChanged(lastFmSent); lastFmQueued = lastFmQueued - (oldSize - newSize); emit queueChanged(lastFmQueued); } } else qDebug() << "There was an error sending track(s) to Last.fm"; } // ==================== // // other Method name... // // ==================== // else { qDebug() << "Strange response, ignoring..."; } size1 = methods.size(); size2 = bytearrays.size(); if (size1 != size2) qDebug() << "WARNING ! Queues have different sizes !"; else qDebug() << "END: Queue size is" << size1; // if (size1 > 0) popMyQ(); }
void Cancion::parsear(){ pugi::xml_document documento; pugi::xml_parse_result resultado; pugi::xml_node nodoActual, nodoVacio; resultado = documento.load_file(ruta.c_str()); if(!resultado){ lERROR << "ERROR"; } tituloCancion = documento.child("Song").child("Title").first_child().value(); descripcionCancion = documento.child("Song").child("Desc").first_child().value();; bpm = boost::lexical_cast<int>(documento.child("Song").child("BPM").first_child().value()); string cadenaNotas = documento.child("Song").child("Notes").first_child().value(); // Expresión regular para cazar las notas boost::regex myRegExp("(do|re|mi|fa|sol|la|si|xx)(5|6|0)(r|b|n|c)(p)?"); // Iterador de regexp para iterar por las diferentes notas captadas boost::sregex_iterator myIt(cadenaNotas.begin(), cadenaNotas.end(), myRegExp), itEnd; float acumulado = 0; for(;myIt != itEnd; myIt++){ bool puntillo = ((*myIt)[4] == "p"); string figura = (*myIt)[3]; string alturaRead = string((*myIt)[1]) + string((*myIt)[2]); t_altura alturaLocal = Do5; t_figura figuraLocal = (t_figura) Negra | Puntillo; float duracionLocal = 0; if(alturaRead == "do5") alturaLocal = Do5; else if(alturaRead == "re5") alturaLocal = Re5; else if(alturaRead == "mi5") alturaLocal = Mi5; else if(alturaRead == "fa5") alturaLocal = Fa5; else if(alturaRead == "sol5") alturaLocal = Sol5; else if(alturaRead == "la5") alturaLocal = La5; else if(alturaRead == "si5") alturaLocal = Si5; else if(alturaRead == "do6") alturaLocal = Do6; else if(alturaRead == "re6") alturaLocal = Re6; else if(alturaRead == "xx0") alturaLocal = Silencio; if(figura == "r"){ figuraLocal = Redonda; duracionLocal = 4; } else if(figura == "b"){ figuraLocal = Blanca; duracionLocal = 2; } else if(figura == "n"){ figuraLocal = Negra; duracionLocal = 1; } else if(figura == "c"){ figuraLocal = Corchea; duracionLocal = 0.5; } if(puntillo){ duracionLocal += duracionLocal / 2; figuraLocal = figuraLocal | Puntillo; } conjNotas.push_back(boost::shared_ptr<Nota>(new Nota(g, alturaLocal, figuraLocal, acumulado))); acumulado += duracionLocal; } conjNotas.push_back(boost::shared_ptr<Nota>(new NotaFinal(g, acumulado))); numeroInicialNotas = conjNotas.size(); lDEBUG << "BPM: " << bpm; milisegundosPorPulso = 1 / (bpm / 60.) * 1000; lDEBUG << "El espacio entre pulsos es " << milisegundosPorPulso << " ms"; lDEBUG << "El intervalo de refresco es " << REFRESCO << " ms"; // frecuencia = 1000./REFRESCO; // lDEBUG << "La frecuencia es de " << frecuencia << " Hz, es decir, salen " << frecuencia // << " fotogramas por segundo."; lDEBUG << "La distancia de un pulso (espacio entre dos negras) es " << distanciaPulso << " px"; lDEBUG << "Con " << bpm << " pulsos por minuto, se recorren " << distanciaPulso * bpm << " píxeles por minuto, ó " << distanciaPulso * bpm / 60. << " píxeles por segundo."; duracionCancion = acumulado * milisegundosPorPulso; maximoPuntos = incrementoDePuntos * (duracionCancion / REFRESCO); lDEBUG << "El total de tiempos de la canción es de " << acumulado << " pulsos."; lDEBUG << "El tiempo de la canción será de: " << duracionCancion << " ms"; lDEBUG << "En cada lectura, se añadirán " << incrementoDePuntos << " puntos."; lDEBUG << "Máximo de puntos: " << maximoPuntos; }