예제 #1
0
void TacheManager::ajouterSousTache(const QString& t, const QString& soust)
{
    TacheComposite* t1=  dynamic_cast<TacheComposite*>(trouverTache(t));
    if (!t1) throw CalendarException(t+" n'existe pas ou n'est pas composite");
    Tache* t2=trouverTache(soust);
    if (!t2) throw CalendarException("TacheManager, "+soust+" inexistant");

    t1->ajouterSousTache(*t2);
}
예제 #2
0
void TacheManager::ajouterPred(const QString& t, const QString& pred)
{
    Tache* t1=  trouverTache(t);
    if (!t1) throw CalendarException("TacheManager, "+t+" inexistant");
    Tache* t2=trouverTache(pred);
    if (!t2) throw CalendarException("TacheManager, "+pred+" inexistant");

    t1->ajouterPredecesseur(*t2);
}
예제 #3
0
Tache* ProjetManager::getTache(const QString &id)
{
   //qDebug() << "getTache(" << id << ");" ;
   Tache* t = trouverTache(id);
    if (!t)
        throw CalendarException("erreur, ProjetManager, tache inexistante");
    return t;
}
예제 #4
0
Tache& TacheManager::ajouterTacheUnaire(const QString& t, const QString& desc, const QDate& dispo, const QDate& deadline, const Duree& dur, bool preempt){
    if( dispo < debut ) throw CalendarException(t+" ne doit pas commencer avant le début du projet");
    if( deadline > fin ) throw CalendarException(t+" ne doit pas terminer après la fin du projet");
    if (trouverTache(t))
        throw CalendarException("Une tâche portant le même nom existe déjà dans le projet");

    Tache* newt=new TacheUnaire(this, t,desc,dispo,deadline,dur,preempt);
    addItem(newt);

    return *newt;
}
예제 #5
0
void TacheManager::retirerTache(const QString& id)
{

    Tache* t=trouverTache(id);
    if( !t ) throw CalendarException("TM : Retrait d'une tache inexistante");

    TacheUnaire* tu = dynamic_cast<TacheUnaire*>(t);
    ProgrammationManager::getInstance().removeProgrammation(tu);

    const list<Tache*> l = t->getSucc();
    list<Tache*>::const_iterator it;
    for( it = l.begin() ; it != l.end() ; ++it )
    {
            (*it)->retirerPredecesseur(*t);
    }

    TacheComposite* tc;
    // Retirer la tâche de la sur-tache (composite) si elle existe
    Tache* st = t->getSurtache();
    if( st != 0 ) // La tache est une sous-tache d'une tacheComposite
    {
        tc = dynamic_cast<TacheComposite*>(st);
        tc->retirerSousTache(*t);
    }

    // Retirer toutes les sous-taches si la tache courante est composite
    if( tc = dynamic_cast<TacheComposite*>(t) )
    {
        const list<Tache*> l2 = tc->getSousTaches();
        for( it = l2.begin() ; it != l2.end() ; ++it )
        {
            tc->retirerSousTache((**it));
        }
    }

    taches.remove(t);
    delete t;
}
예제 #6
0
void TacheManager::addItem(Tache* t){
    if( trouverTache(t->getTitre()) )
        throw CalendarException("Ajout tâche : déjà existante dans le projet");
    taches.push_back(t);
}
예제 #7
0
Tache& TacheManager::getTache(const QString& titre){
    Tache* t=trouverTache(titre);
    if (!t) throw CalendarException("TacheManager, tache inexistante");
    return *t;
}
예제 #8
0
bool ProjetManager::isTacheExistante(const QString &id) const
{
    return trouverTache(id)!=0;
}
예제 #9
0
Tache& Projet::getTache(const QString& id){
    Tache* t=trouverTache(id);
    return *t;
}
예제 #10
0
TacheComposite& Projet::ajouterTacheComposite(const QString& id, const QString& t, const QDateTime &dispo, const QDateTime &deadline, bool b){
    if (trouverTache(id)) throw ProjetException("erreur, tache deja existante dans le projet");
    TacheComposite* newt=new TacheComposite(id,t,dispo,deadline, b);
    addItem(newt);
    return *newt;
}