Back to index

fet  5.18.0
Public Slots | Public Member Functions
AddConstraintStudentsSetHomeRoomsForm Class Reference

#include <addconstraintstudentssethomeroomsform.h>

List of all members.

Public Slots

void addRoom ()
void removeRoom ()
void addConstraint ()
void clear ()

Public Member Functions

 AddConstraintStudentsSetHomeRoomsForm (QWidget *parent)
 ~AddConstraintStudentsSetHomeRoomsForm ()
void updateRoomsListWidget ()

Detailed Description

Definition at line 26 of file addconstraintstudentssethomeroomsform.h.


Constructor & Destructor Documentation

Definition at line 29 of file addconstraintstudentssethomeroomsform.cpp.

                                                                                           : QDialog(parent)
{
       setupUi(this);

       addConstraintPushButton->setDefault(true);

       roomsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
       selectedRoomsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);

       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
       connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint()));
       connect(roomsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addRoom()));
       connect(selectedRoomsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeRoom()));
       connect(clearPushButton, SIGNAL(clicked()), this, SLOT(clear()));

       centerWidgetOnScreen(this);
       restoreFETDialogGeometry(this);
       
       QSize tmp2=studentsComboBox->minimumSizeHint();
       Q_UNUSED(tmp2);

       updateRoomsListWidget();

       studentsComboBox->clear();
       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);
                     }
              }
       }
}

Here is the call graph for this function:

Definition at line 67 of file addconstraintstudentssethomeroomsform.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 83 of file addconstraintstudentssethomeroomsform.cpp.

{
       SpaceConstraint *ctr=NULL;

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

       if(selectedRoomsListWidget->count()==0){
              QMessageBox::warning(this, tr("FET information"),
                     tr("Empty list of selected rooms"));
              return;
       }
       if(selectedRoomsListWidget->count()==1){
              QMessageBox::warning(this, tr("FET information"),
                     tr("Only one selected room - please use constraint students set home room if you want a single room"));
              return;
       }

       QString students=studentsComboBox->currentText();
       assert(gt.rules.searchStudentsSet(students)!=NULL);

       QStringList roomsList;
       for(int i=0; i<selectedRoomsListWidget->count(); i++)
              roomsList.append(selectedRoomsListWidget->item(i)->text());
       
       ctr=new ConstraintStudentsSetHomeRooms(weight, students, roomsList);
       bool tmp2=gt.rules.addSpaceConstraint(ctr);
       
       if(tmp2){
              QString s=tr("Constraint added:");
              s+="\n\n";
              s+=ctr->getDetailedDescription(gt.rules);
              LongTextMessageBox::information(this, tr("FET information"), s);
       }
       else{
              QMessageBox::warning(this, tr("FET information"),
                     tr("Constraint NOT added - please report error"));
              delete ctr;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 130 of file addconstraintstudentssethomeroomsform.cpp.

{
       if(roomsListWidget->currentRow()<0)
              return;
       QString rmName=roomsListWidget->currentItem()->text();
       assert(rmName!="");
       int i;
       //duplicate?
       for(i=0; i<selectedRoomsListWidget->count(); i++)
              if(rmName==selectedRoomsListWidget->item(i)->text())
                     break;
       if(i<selectedRoomsListWidget->count())
              return;
       selectedRoomsListWidget->addItem(rmName);
       selectedRoomsListWidget->setCurrentRow(selectedRoomsListWidget->count()-1);
}

Here is the caller graph for this function:

Definition at line 162 of file addconstraintstudentssethomeroomsform.cpp.

{
       selectedRoomsListWidget->clear();
}

Here is the caller graph for this function:

Definition at line 147 of file addconstraintstudentssethomeroomsform.cpp.

{
       if(selectedRoomsListWidget->currentRow()<0 || selectedRoomsListWidget->count()<=0)
              return;
       int tmp=selectedRoomsListWidget->currentRow();

       selectedRoomsListWidget->setCurrentRow(-1);
       QListWidgetItem* item=selectedRoomsListWidget->takeItem(tmp);
       delete item;
       if(tmp<selectedRoomsListWidget->count())
              selectedRoomsListWidget->setCurrentRow(tmp);
       else
              selectedRoomsListWidget->setCurrentRow(selectedRoomsListWidget->count()-1);
}

Here is the caller graph for this function:

Definition at line 72 of file addconstraintstudentssethomeroomsform.cpp.

{
       roomsListWidget->clear();
       selectedRoomsListWidget->clear();

       for(int i=0; i<gt.rules.roomsList.size(); i++){
              Room* rm=gt.rules.roomsList[i];
              roomsListWidget->addItem(rm->name);
       }
}

Here is the caller graph for this function:


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