programmation* agenda::trouverProgrammation(const Date& d, const Horaire& hdebut, const Duree& dur){ Horaire hfin=Horaire(hdebut+dur); for(std::vector<programmation*>::const_iterator it=progs.begin();it!=progs.end();it++) { if((*it)->getDate()==d && ((hdebut>=(*it)->getHoraire() && hdebut<(*it)->getHorairefin()) ||((*it)->getHoraire()<hfin && hfin<(*it)->getHorairefin()))) { return (*it); } } return 0; }
void CreerTacheSimpleNonPreemptive::retourFenetrePrincipaleValider(){ try{ nomProjet.creerAjouterTache( chemin, *tailleChemin, Date(dateDebut->date().day(), dateDebut->date().month(), dateDebut->date().year()), Horaire(horaireDebut->time().hour(), horaireDebut->time().minute()), Date(dateFin->date().day(), dateFin->date().month(), dateFin->date().year()), Horaire(horaireFin->time().hour(), horaireFin->time().minute()), titre->text().toStdString(), false, false, Duree(heures->value(), minutes->value())); QMessageBox::information(this, "Création de tâche simple non préemptive", "Votre tâche simple non préemptive " + titre->text() +" a bien été créée."); } catch(std::logic_error& e){ QMessageBox::warning(this, "Création de tâche tâche simple non préemptive", e.what()); } this->close(); }
void FenetreProgrammerActivite::enregistrer(){ programmation& progact = agenda::getInstance().ajouterProgrammationActivite(activite, Date(ProgDate->date().day(),ProgDate->date().month(),ProgDate->date().year()),Horaire(ProgHh->value(), ProgHm->value())); if(&progact!=0){ QMessageBox msgBox; msgBox.setText("L'Activité a été programmée"); msgBox.exec(); this->close(); } else { delete &progact; QMessageBox msgBox; msgBox.setText("L'Activité n'a pas été programmée"); msgBox.exec(); } }