Back to index

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

#include <constraintsubjectpreferredroomform.h>

List of all members.

Public Slots

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

Public Member Functions

 ConstraintSubjectPreferredRoomForm (QWidget *parent)
 ~ConstraintSubjectPreferredRoomForm ()
bool filterOk (SpaceConstraint *ctr)

Public Attributes

SpaceConstraintsList visibleConstraintsList

Detailed Description

Definition at line 26 of file constraintsubjectpreferredroomform.h.


Constructor & Destructor Documentation

Definition at line 30 of file constraintsubjectpreferredroomform.cpp.

                                                                                     : QDialog(parent)
{
       setupUi(this);

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

       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(roomsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
       connect(subjectsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
       connect(constraintsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyConstraint()));

       centerWidgetOnScreen(this);
       restoreFETDialogGeometry(this);

       QSize tmp3=subjectsComboBox->minimumSizeHint();
       Q_UNUSED(tmp3);
       
       QSize tmp5=roomsComboBox->minimumSizeHint();
       Q_UNUSED(tmp5);
       
       roomsComboBox->addItem("");
       for(int i=0; i<gt.rules.roomsList.size(); i++){
              Room* rm=gt.rules.roomsList[i];
              roomsComboBox->addItem(rm->name);
       }

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

       this->filterChanged();
}

Here is the call graph for this function:

Definition at line 71 of file constraintsubjectpreferredroomform.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 117 of file constraintsubjectpreferredroomform.cpp.

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

       filterChanged();
       
       constraintsListWidget->setCurrentRow(constraintsListWidget->count()-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 105 of file constraintsubjectpreferredroomform.cpp.

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

Here is the caller graph for this function:

Definition at line 87 of file constraintsubjectpreferredroomform.cpp.

{
       this->visibleConstraintsList.clear();
       constraintsListWidget->clear();
       for(int i=0; i<gt.rules.spaceConstraintsList.size(); i++){
              SpaceConstraint* ctr=gt.rules.spaceConstraintsList[i];
              if(filterOk(ctr)){
                     visibleConstraintsList.append(ctr);
                     constraintsListWidget->addItem(ctr->getDescription(gt.rules));
              }
       }
       
       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 76 of file constraintsubjectpreferredroomform.cpp.

{
       if(ctr->type==CONSTRAINT_SUBJECT_PREFERRED_ROOM){
              ConstraintSubjectPreferredRoom* c=(ConstraintSubjectPreferredRoom*) ctr;
              return (c->roomName==roomsComboBox->currentText() || roomsComboBox->currentText()=="")
               && (c->subjectName==subjectsComboBox->currentText() || subjectsComboBox->currentText()=="");
       }
       else
              return false;
}

Here is the caller graph for this function:

Definition at line 128 of file constraintsubjectpreferredroomform.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;
       }
       SpaceConstraint* ctr=this->visibleConstraintsList.at(i);

       ModifyConstraintSubjectPreferredRoomForm form(this, (ConstraintSubjectPreferredRoom*)ctr);
       setParentAndOtherThings(&form, this);
       form.exec();

       filterChanged();
       
       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 158 of file constraintsubjectpreferredroomform.cpp.

{
       int i=constraintsListWidget->currentRow();
       if(i<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected constraint"));
              return;
       }
       SpaceConstraint* 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.removeSpaceConstraint(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

Definition at line 29 of file constraintsubjectpreferredroomform.h.


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