Exemple #1
0
void AddBrass::ajoutBrasserie(){
    string rue, pays, ville, nom, codePostal, urlBrass, cheminImage, numero;
    QMMapView mapview(QMMapView::RoadMap,QMCoordinate(0,0),15);

    db_ = new DbBeerTemple();

    rue = ui->leRue->text().toStdString();
    pays = ui->cbPays->currentText().toStdString();
    ville = ui->leVille->text().toStdString();
    nom = ui ->leNomBrasserie->text().toStdString();
    transform(nom.begin(), nom.end(), nom.begin(), ::toupper);
    codePostal = ui->leCp->text().toStdString();
    urlBrass = ui->leUrlBrasserie->text().toStdString();
    numero = ui->leNumero->text().toStdString();

    //Vérification adresse correcte
    if(checkNotNull(rue) && checkNotNull(ville) && checkNotNull(nom) &&
            checkNotNull(codePostal) && checkNotNull(numero) && checkNotNull(pays) && checkNotNull(codePostal)){
        string s = rue + " " + numero + " " + codePostal+ " " + ville;

        //Verification brasserie n'existante pas dans la db
        if(!(db_->brasseriePresente(nom))){

            if(!(checkNotNull(urlBrass))){
                urlBrass = "";
            }
            if(selectImage_ != nullptr){
                if(selectImage_->getCheminImage() != ""){
                    cheminImage = selectImage_->getCheminImage();
                }else{
                    QMessageBox::information(this,"Image manquante!","La brasserie n'a pas pu être ajoutée.");
                    return;
                }

            }else{
                QMessageBox::information(this,"Image manquante!","La brasserie n'a pas pu être ajoutée.");
                return;
            }
            Brasserie brasserie(nom,urlBrass,cheminImage,pays,ville,rue,numero,codePostal);
            if(db_->ajoutBrasserie(brasserie)){
                ui->leRue->clear();
                ui->leVille->clear();
                ui->leNomBrasserie->clear();
                ui->leCp->clear();
                ui->leUrlBrasserie->clear();
                ui->leNumero->clear();
                selectImage_->setCheminImage("");
                selectImage_->setNomFichier(QString());
                ui->lbImageBrasserie->setText("image");
                QMessageBox::information(this,"Ajout valide","La brasserie a bien été ajoutée");
            }
        }else{
            QMessageBox::warning(this,"brasserie déjà présente", "la brasserie est deja presente dans la db");
        }
    }else{
        QMessageBox::warning(this,"Erreur!", "Tous les champs doivent être remplis pour ajouter une brasserie TABARNAK!");
    }
    delete db_;
}
Exemple #2
0
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_mapview_MapView_move
  (JNIEnv *env, jobject, jlong nativeDevice, jint dx, jint dy)
{
    RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_move: start");
    rhomap::IMapView *mv = mapview(env, nativeDevice);
    if (mv)
        mv->move(dx, dy);
    RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_move: finish");
}
Exemple #3
0
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_mapview_MapView_setZoom
  (JNIEnv *env, jobject, jlong nativeDevice, jint zoom)
{
    RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_setZoom: start");
    rhomap::IMapView *mv = mapview(env, nativeDevice);
    if (mv)
        mv->setZoom(zoom);
    RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_setZoom: finish");
}
Exemple #4
0
RHO_GLOBAL jint JNICALL Java_com_rhomobile_rhodes_mapview_MapView_zoom
  (JNIEnv *env, jobject, jlong nativeDevice)
{
    RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_zoom: start");
    jint ret = 0;
    rhomap::IMapView *mv = mapview(env, nativeDevice);
    if (mv)
        ret = mv->zoom();

    RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_zoom: finish");
    return ret;
}
Exemple #5
0
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_mapview_MapView_click
  (JNIEnv *env, jobject, jlong nativeDevice, jint x, jint y)
{
    RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_click: start");
    rhomap::IMapView *mv = mapview(env, nativeDevice);
    if (mv) {
        if (mv->handleClick(x, y) ) {
            // close
            mapview_close();
	}
    }
    RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_click: finish");
}