Back to index

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

#include <modifyconstraintactivitytagpreferredroomsform.h>

Collaboration diagram for ModifyConstraintActivityTagPreferredRoomsForm:
Collaboration graph
[legend]

List of all members.

Public Slots

void addRoom ()
void removeRoom ()
void ok ()
void cancel ()
void clear ()

Public Member Functions

 ModifyConstraintActivityTagPreferredRoomsForm (QWidget *parent, ConstraintActivityTagPreferredRooms *ctr)
 ~ModifyConstraintActivityTagPreferredRoomsForm ()
void updateRoomsListWidget ()

Private Attributes

ConstraintActivityTagPreferredRooms_ctr

Detailed Description

Definition at line 26 of file modifyconstraintactivitytagpreferredroomsform.h.


Constructor & Destructor Documentation

Definition at line 28 of file modifyconstraintactivitytagpreferredroomsform.cpp.

                                                                                                                                                     : QDialog(parent)
{
       setupUi(this);

       okPushButton->setDefault(true);
       
       roomsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
       selectedRoomsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);

       connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel()));
       connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok()));
       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 tmp4=activityTagsComboBox->minimumSizeHint();
       Q_UNUSED(tmp4);
       
       updateRoomsListWidget();
       
       int i=0;
       int j=-1;
       for(int k=0; k<gt.rules.activityTagsList.size(); k++){
              ActivityTag* sb=gt.rules.activityTagsList[k];
              activityTagsComboBox->addItem(sb->name);
              if(ctr->activityTagName==sb->name){
                     assert(j==-1);
                     j=i;
              }
              i++;
       }
       assert(j>=0);
       activityTagsComboBox->setCurrentIndex(j);
       
       this->_ctr=ctr;
       
       weightLineEdit->setText(CustomFETString::number(ctr->weightPercentage));
       
       for(QStringList::Iterator it=ctr->roomsNames.begin(); it!=ctr->roomsNames.end(); it++)
              selectedRoomsListWidget->addItem(*it);
}

Here is the call graph for this function:

Definition at line 74 of file modifyconstraintactivitytagpreferredroomsform.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 138 of file modifyconstraintactivitytagpreferredroomsform.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 133 of file modifyconstraintactivitytagpreferredroomsform.cpp.

{
       this->close();
}

Here is the caller graph for this function:

Definition at line 171 of file modifyconstraintactivitytagpreferredroomsform.cpp.

{
       selectedRoomsListWidget->clear();
}

Here is the caller graph for this function:

Definition at line 90 of file modifyconstraintactivitytagpreferredroomsform.cpp.

{
       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 activity tag preferred room if you want a single room"));
              return;
       }
       
       if(activityTagsComboBox->currentIndex()<0){
              QMessageBox::warning(this, tr("FET information"),
                     tr("Invalid selected activity tag"));
              return;
       }
       QString activityTag=activityTagsComboBox->currentText();
       
       QStringList roomsList;
       for(int i=0; i<selectedRoomsListWidget->count(); i++)
              roomsList.append(selectedRoomsListWidget->item(i)->text());
       
       this->_ctr->weightPercentage=weight;
       this->_ctr->activityTagName=activityTag;
       this->_ctr->roomsNames=roomsList;
       
       gt.rules.internalStructureComputed=false;
       setRulesModifiedAndOtherThings(&gt.rules);
       
       this->close();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 155 of file modifyconstraintactivitytagpreferredroomsform.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 79 of file modifyconstraintactivitytagpreferredroomsform.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:


Member Data Documentation


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