Back to index

fet  5.18.0
Public Slots | Public Member Functions | Public Attributes
ConstraintSubactivitiesPreferredTimeSlotsForm Class Reference

#include <constraintsubactivitiespreferredtimeslotsform.h>

List of all members.

Public Slots

void constraintChanged (int index)
void addConstraint ()
void modifyConstraint ()
void removeConstraint ()
void help ()

Public Member Functions

 ConstraintSubactivitiesPreferredTimeSlotsForm (QWidget *parent)
 ~ConstraintSubactivitiesPreferredTimeSlotsForm ()
void refreshConstraintsListWidget ()
bool filterOk (TimeConstraint *ctr)

Public Attributes

TimeConstraintsList visibleConstraintsList

Detailed Description

Definition at line 26 of file constraintsubactivitiespreferredtimeslotsform.h.


Constructor & Destructor Documentation

Definition at line 30 of file constraintsubactivitiespreferredtimeslotsform.cpp.

                                                                                                           : QDialog(parent)
{
       setupUi(this);

       currentConstraintTextEdit->setReadOnly(true);
       
       modifyConstraintPushButton->setDefault(true);

       constraintsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);

       connect(constraintsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(constraintChanged(int)));
       connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint()));
       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
       connect(removeConstraintPushButton, SIGNAL(clicked()), this, SLOT(removeConstraint()));
       connect(modifyConstraintPushButton, SIGNAL(clicked()), this, SLOT(modifyConstraint()));
       connect(constraintsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyConstraint()));
       connect(helpPushButton, SIGNAL(clicked()), this, SLOT(help()));

       centerWidgetOnScreen(this);
       restoreFETDialogGeometry(this);
       
       this->refreshConstraintsListWidget();
}

Here is the call graph for this function:

Definition at line 54 of file constraintsubactivitiespreferredtimeslotsform.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 101 of file constraintsubactivitiespreferredtimeslotsform.cpp.

{
       AddConstraintSubactivitiesPreferredTimeSlotsForm form(this);
       setParentAndOtherThings(&form, this);
       form.exec();

       this->refreshConstraintsListWidget();
       
       constraintsListWidget->setCurrentRow(constraintsListWidget->count()-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 87 of file constraintsubactivitiespreferredtimeslotsform.cpp.

{
       if(index<0){
              currentConstraintTextEdit->setPlainText("");
              return;
       }
       QString s;
       assert(index<this->visibleConstraintsList.size());
       TimeConstraint* ctr=this->visibleConstraintsList.at(index);
       assert(ctr!=NULL);
       s=ctr->getDetailedDescription(gt.rules);
       currentConstraintTextEdit->setPlainText(s);
}

Here is the caller graph for this function:

Definition at line 79 of file constraintsubactivitiespreferredtimeslotsform.cpp.

{
       if(ctr->type==CONSTRAINT_SUBACTIVITIES_PREFERRED_TIME_SLOTS)
              return true;
       else
              return false;
}

Here is the caller graph for this function:

Definition at line 180 of file constraintsubactivitiespreferredtimeslotsform.cpp.

{
       LongTextMessageBox::largeInformation(this, tr("FET help"), tr(
        "This constraint is used to specify that for some components of a type of"
       " activities, for instance for Mathematics activities, you need that from say 4-5"
       " per week, at least the first 2 to be early (say in the first 4 hours).")
       +"\n\n"+
       tr(
       "This is simple: just add 2 constraints of this type, with the component"
       " number 1, (then 2) and the corresponding subject (you can also"
       " define teacher, students set and activity tag, of course)."
        )
        +"\n\n"+
        tr("Note: if you have Maths with 4 and 5 splits and want to constrain 2 subactivities for those with 4 per week and 3 subactivities"
        " for those with 5 per week, you can add constraints only for Maths with components 3, 4 and 5 (nice trick)")
        +"\n\n"+
        tr("Note: if an activity does not belong to a larger group (is a single activity),"
        " it is considered to have component number 1. As an advice, if you have activities of say Biology splitted into 1"
        " or 2 per week and want to constrain only one component if there are 2 per week, add a constraint for Biology with component number=2")
        +"\n\n"+
        tr("Note: if a teacher or a students set cannot have lessons in some slots because of this constraint, gaps will be counted (if you have max gaps constraints)"
         ". So be careful if you add this constraint for all sub-activities, for only a teacher or for only a students set"));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 112 of file constraintsubactivitiespreferredtimeslotsform.cpp.

{
       int valv=constraintsListWidget->verticalScrollBar()->value();
       int valh=constraintsListWidget->horizontalScrollBar()->value();

       int i=constraintsListWidget->currentRow();
       if(i<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected constraint"));
              return;
       }
       TimeConstraint* ctr=this->visibleConstraintsList.at(i);

       ModifyConstraintSubactivitiesPreferredTimeSlotsForm form(this, (ConstraintSubactivitiesPreferredTimeSlots*)ctr);
       setParentAndOtherThings(&form, this);
       form.exec();

       this->refreshConstraintsListWidget();
       
       constraintsListWidget->verticalScrollBar()->setValue(valv);
       constraintsListWidget->horizontalScrollBar()->setValue(valh);

       if(i>=constraintsListWidget->count())
              i=constraintsListWidget->count()-1;

       if(i>=0)
              constraintsListWidget->setCurrentRow(i);
       else
              this->constraintChanged(-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 59 of file constraintsubactivitiespreferredtimeslotsform.cpp.

{
       this->visibleConstraintsList.clear();
       constraintsListWidget->clear();
       for(int i=0; i<gt.rules.timeConstraintsList.size(); i++){
              TimeConstraint* ctr=gt.rules.timeConstraintsList[i];
              if(filterOk(ctr)){
                     QString s;
                     s=ctr->getDescription(gt.rules);
                     visibleConstraintsList.append(ctr);
                     constraintsListWidget->addItem(s);
              }
       }

       if(constraintsListWidget->count()>0)
              constraintsListWidget->setCurrentRow(0);
       else
              this->constraintChanged(-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 142 of file constraintsubactivitiespreferredtimeslotsform.cpp.

{
       int i=constraintsListWidget->currentRow();
       if(i<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected constraint"));
              return;
       }
       TimeConstraint* ctr=this->visibleConstraintsList.at(i);
       QString s;
       s=tr("Remove constraint?");
       s+="\n\n";
       s+=ctr->getDetailedDescription(gt.rules);
       
       QListWidgetItem* item;

       switch( LongTextMessageBox::confirmation( this, tr("FET confirmation"),
              s, tr("Yes"), tr("No"), 0, 0, 1 ) ){
       case 0: // The user clicked the OK button or pressed Enter
              gt.rules.removeTimeConstraint(ctr);
              
              visibleConstraintsList.removeAt(i);
              constraintsListWidget->setCurrentRow(-1);
              item=constraintsListWidget->takeItem(i);
              delete item;
              
              break;
       case 1: // The user clicked the Cancel button or pressed Escape
              break;
       }

       if(i>=constraintsListWidget->count())
              i=constraintsListWidget->count()-1;
       if(i>=0)
              constraintsListWidget->setCurrentRow(i);
       else
              this->constraintChanged(-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation


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