예제 #1
0
 void ScheduleTimerLambda::execute(float deltaTime){
     if (_lambda){
         _actionTime+=deltaTime;
         float progress(_actionTime/_duration);
         if (progress>=1.f) {
             _isDone=true;
             if (_finally)
                 _finally();
             return;
         }
         _lambda(deltaTime, progress ,_isDone);
     }
 }
void MainWindow::openLanguage(){
    if(!alphabet.empty()){
        QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
            tr("Text Files (*.txt)"));

        if (fileName != "") {
            QFile file(fileName);
            if (!file.open(QIODevice::ReadOnly)) {
                QMessageBox::critical(this, tr("Error"),
                tr("No se pudo abrir el archivo."));
                return;
            }
            if(!file.atEnd()){
                Language language(QString(file.readLine()).trimmed(),&alphabet);
                language.setPath(fileName.trimmed());
                QString words = file.readLine();

                QString _lambda(QChar(955));
                QString first=words.at(0);
                if(first==",")
                    words.prepend(_lambda);


                QStringList wordsList=words.split(',');
                    for(int i=0;i<wordsList.count();i++){
                         language.insert(wordsList.at(i));
                         //qDebug()<<"palabra";
                         //qDebug()<<wordsList.at(i);
                    }

                    this->languageList.push_back(language);
                    //qDebug()<<this->languageList.at(languageList.count()-1);
            }else
                QMessageBox::critical(this, tr("Error"),
                 tr("Archivo Vacio."));
            file.close();
            listLanguages();
            ui->languageList->setCurrentIndex(ui->languageList->count()-1);
        }

    }else
        QMessageBox::critical(this, tr("Error"),
        tr("Debe haber un alfabeto cargado."));

}
예제 #3
0
 void MCBCallLambda::execute(){
     if (_lambda)
         _lambda();
 }
예제 #4
0
 void ScheduleUpdateLambda::execute(float deltaTime){
     if (_lambda){
         _lambda(deltaTime,_isDone);
     }
 }