Back to index

fet  5.18.0
Public Slots | Public Member Functions | Private Attributes
AddConstraintThreeActivitiesGroupedForm Class Reference

#include <addconstraintthreeactivitiesgroupedform.h>

List of all members.

Public Slots

void addCurrentConstraint ()
void filterChanged ()

Public Member Functions

 AddConstraintThreeActivitiesGroupedForm (QWidget *parent)
 ~AddConstraintThreeActivitiesGroupedForm ()
bool filterOk (Activity *a)
void updateActivitiesComboBox ()

Private Attributes

QList< int > firstActivitiesList
QList< int > secondActivitiesList
QList< int > thirdActivitiesList

Detailed Description

Definition at line 28 of file addconstraintthreeactivitiesgroupedform.h.


Constructor & Destructor Documentation

Definition at line 25 of file addconstraintthreeactivitiesgroupedform.cpp.

                                                                                               : QDialog(parent)
{
       setupUi(this);

       addConstraintPushButton->setDefault(true);

       connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addCurrentConstraint()));
       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
       connect(teachersComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
       connect(studentsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
       connect(subjectsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
       connect(activityTagsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));

       centerWidgetOnScreen(this);
       restoreFETDialogGeometry(this);

       QSize tmp1=teachersComboBox->minimumSizeHint();
       Q_UNUSED(tmp1);
       QSize tmp2=studentsComboBox->minimumSizeHint();
       Q_UNUSED(tmp2);
       QSize tmp3=subjectsComboBox->minimumSizeHint();
       Q_UNUSED(tmp3);
       QSize tmp4=activityTagsComboBox->minimumSizeHint();
       Q_UNUSED(tmp4);
       
       QSize tmp5=firstActivitiesComboBox->minimumSizeHint();
       Q_UNUSED(tmp5);
       QSize tmp6=secondActivitiesComboBox->minimumSizeHint();
       Q_UNUSED(tmp6);
       QSize tmp7=thirdActivitiesComboBox->minimumSizeHint();
       Q_UNUSED(tmp7);
       
       firstActivitiesComboBox->setMaximumWidth(maxRecommendedWidth(this));
       secondActivitiesComboBox->setMaximumWidth(maxRecommendedWidth(this));
       thirdActivitiesComboBox->setMaximumWidth(maxRecommendedWidth(this));
       
       teachersComboBox->addItem("");
       for(int i=0; i<gt.rules.teachersList.size(); i++){
              Teacher* tch=gt.rules.teachersList[i];
              teachersComboBox->addItem(tch->name);
       }
       teachersComboBox->setCurrentIndex(0);

       subjectsComboBox->addItem("");
       for(int i=0; i<gt.rules.subjectsList.size(); i++){
              Subject* sb=gt.rules.subjectsList[i];
              subjectsComboBox->addItem(sb->name);
       }
       subjectsComboBox->setCurrentIndex(0);

       activityTagsComboBox->addItem("");
       for(int i=0; i<gt.rules.activityTagsList.size(); i++){
              ActivityTag* st=gt.rules.activityTagsList[i];
              activityTagsComboBox->addItem(st->name);
       }
       activityTagsComboBox->setCurrentIndex(0);

       studentsComboBox->addItem("");
       for(int i=0; i<gt.rules.yearsList.size(); i++){
              StudentsYear* sty=gt.rules.yearsList[i];
              studentsComboBox->addItem(sty->name);
              for(int j=0; j<sty->groupsList.size(); j++){
                     StudentsGroup* stg=sty->groupsList[j];
                     studentsComboBox->addItem(stg->name);
                     for(int k=0; k<stg->subgroupsList.size(); k++){
                            StudentsSubgroup* sts=stg->subgroupsList[k];
                            studentsComboBox->addItem(sts->name);
                     }
              }
       }
       studentsComboBox->setCurrentIndex(0);

       updateActivitiesComboBox();
}

Here is the call graph for this function:

Definition at line 100 of file addconstraintthreeactivitiesgroupedform.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 179 of file addconstraintthreeactivitiesgroupedform.cpp.

{
       TimeConstraint *ctr=NULL;

       double weight;
       QString tmp=weightLineEdit->text();
       weight_sscanf(tmp, "%lf", &weight);
       if(weight<0.0 || weight>100.0){
              QMessageBox::warning(this, tr("FET information"),
                     tr("Invalid weight (percentage)"));
              return;
       }

       int fid;
       int tmp2=firstActivitiesComboBox->currentIndex();
       assert(tmp2<gt.rules.activitiesList.size());
       assert(tmp2<firstActivitiesList.size());
       if(tmp2<0){
              QMessageBox::warning(this, tr("FET information"),
                     tr("Invalid activity"));
              return;
       }
       else
              fid=firstActivitiesList.at(tmp2);
       
       int sid;
       int tmp3=secondActivitiesComboBox->currentIndex();
       assert(tmp3<gt.rules.activitiesList.size());
       assert(tmp3<secondActivitiesList.size());
       if(tmp3<0){
              QMessageBox::warning(this, tr("FET information"),
                     tr("Invalid activity"));
              return;
       }
       else
              sid=secondActivitiesList.at(tmp3);
              
       int tid;
       int tmp4=thirdActivitiesComboBox->currentIndex();
       assert(tmp4<gt.rules.activitiesList.size());
       assert(tmp4<thirdActivitiesList.size());
       if(tmp4<0){
              QMessageBox::warning(this, tr("FET information"),
                     tr("Invalid activity"));
              return;
       }
       else
              tid=thirdActivitiesList.at(tmp4);
              
       if(sid==fid || sid==tid || fid==tid){
              QMessageBox::warning(this, tr("FET information"),
                     tr("Same activities - impossible"));
              return;
       }
       
       ctr=new ConstraintThreeActivitiesGrouped(weight, fid, sid, tid);

       bool tmp5=gt.rules.addTimeConstraint(ctr);
       if(tmp5)
              LongTextMessageBox::information(this, tr("FET information"),
                     tr("Constraint added:")+"\n\n"+ctr->getDetailedDescription(gt.rules));
       else{
              QMessageBox::warning(this, tr("FET information"),
                     tr("Constraint NOT added - error?"));
              delete ctr;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 174 of file addconstraintthreeactivitiesgroupedform.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 105 of file addconstraintthreeactivitiesgroupedform.cpp.

{
       QString tn=teachersComboBox->currentText();
       QString stn=studentsComboBox->currentText();
       QString sbn=subjectsComboBox->currentText();
       QString sbtn=activityTagsComboBox->currentText();
       int ok=true;

       //teacher
       if(tn!=""){
              bool ok2=false;
              for(QStringList::Iterator it=act->teachersNames.begin(); it!=act->teachersNames.end(); it++)
                     if(*it == tn){
                            ok2=true;
                            break;
                     }
              if(!ok2)
                     ok=false;
       }

       //subject
       if(sbn!="" && sbn!=act->subjectName)
              ok=false;
              
       //activity tag
       if(sbtn!="" && !act->activityTagsNames.contains(sbtn))
              ok=false;
              
       //students
       if(stn!=""){
              bool ok2=false;
              for(QStringList::Iterator it=act->studentsNames.begin(); it!=act->studentsNames.end(); it++)
                     if(*it == stn){
                            ok2=true;
                            break;
                     }
              if(!ok2)
                     ok=false;
       }
       
       return ok;
}

Here is the caller graph for this function:

Definition at line 148 of file addconstraintthreeactivitiesgroupedform.cpp.

                                                                      {
       firstActivitiesComboBox->clear();
       firstActivitiesList.clear();

       secondActivitiesComboBox->clear();
       secondActivitiesList.clear();
       
       thirdActivitiesComboBox->clear();
       thirdActivitiesList.clear();
       
       for(int i=0; i<gt.rules.activitiesList.size(); i++){
              Activity* act=gt.rules.activitiesList[i];
              
              if(filterOk(act)){
                     firstActivitiesComboBox->addItem(act->getDescription(gt.rules));
                     this->firstActivitiesList.append(act->id);

                     secondActivitiesComboBox->addItem(act->getDescription(gt.rules));
                     this->secondActivitiesList.append(act->id);

                     thirdActivitiesComboBox->addItem(act->getDescription(gt.rules));
                     this->thirdActivitiesList.append(act->id);
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 46 of file addconstraintthreeactivitiesgroupedform.h.

Definition at line 47 of file addconstraintthreeactivitiesgroupedform.h.

Definition at line 48 of file addconstraintthreeactivitiesgroupedform.h.


The documentation for this class was generated from the following files: