コード例 #1
0
void SupprimerSousTache::remplirComboSousTache(const QString& t){
    ui->comboBoxSousTache->clear();
    ui->comboBoxSousTache->addItem(" ");
    if(t!=" "){
        TacheComposite* mere = static_cast<TacheComposite*>(ProjetManager::getInstance().trouverTache(t));
        if (mere!=0) {
            for(QMap<QString, Tache*>::const_iterator it=mere->getSousTaches().begin(); it!=mere->getSousTaches().end(); ++it){
                ui->comboBoxSousTache->addItem((*it)->getId());
            }
        }
    }
}
コード例 #2
0
ファイル: tachemanager.cpp プロジェクト: fabBu/brabrabra
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;
}