Back to index

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

#include <roomsform.h>

List of all members.

Public Slots

void addRoom ()
void removeRoom ()
void modifyRoom ()
void sortRooms ()
void roomChanged (int index)
void filterChanged ()

Public Member Functions

 RoomsForm (QWidget *parent)
 ~RoomsForm ()
bool filterOk (Room *rm)

Public Attributes

RoomsList visibleRoomsList

Detailed Description

Definition at line 25 of file roomsform.h.


Constructor & Destructor Documentation

RoomsForm::RoomsForm ( QWidget *  parent)

Definition at line 38 of file roomsform.cpp.

                                   : QDialog(parent)
{
       setupUi(this);
       
       currentRoomTextEdit->setReadOnly(true);
       
       modifyRoomPushButton->setDefault(true);
       
       roomsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);

       connect(addRoomPushButton, SIGNAL(clicked()), this, SLOT(addRoom()));
       connect(removeRoomPushButton, SIGNAL(clicked()), this, SLOT(removeRoom()));
       connect(roomsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(roomChanged(int)));
       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
       connect(modifyRoomPushButton, SIGNAL(clicked()), this, SLOT(modifyRoom()));
       connect(sortRoomsPushButton, SIGNAL(clicked()), this, SLOT(sortRooms()));
       connect(roomsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyRoom()));

       centerWidgetOnScreen(this);
       restoreFETDialogGeometry(this);
       //restore splitter state
       QSettings settings(COMPANY, PROGRAM);
       if(settings.contains(this->metaObject()->className()+QString("/splitter-state")))
              splitter->restoreState(settings.value(this->metaObject()->className()+QString("/splitter-state")).toByteArray());
       
       this->filterChanged();
}

Here is the call graph for this function:

Definition at line 67 of file roomsform.cpp.

{
       saveFETDialogGeometry(this);
       //save splitter state
       QSettings settings(COMPANY, PROGRAM);
       settings.setValue(this->metaObject()->className()+QString("/splitter-state"), splitter->saveState());
}

Here is the call graph for this function:


Member Function Documentation

void RoomsForm::addRoom ( ) [slot]

Definition at line 103 of file roomsform.cpp.

{
       AddRoomForm addRoomForm(this);
       setParentAndOtherThings(&addRoomForm, this);
       addRoomForm.exec();
       
       filterChanged();
       
       roomsListWidget->setCurrentRow(roomsListWidget->count()-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void RoomsForm::filterChanged ( ) [slot]

Definition at line 83 of file roomsform.cpp.

{
       QString s;
       roomsListWidget->clear();
       visibleRoomsList.clear();
       for(int i=0; i<gt.rules.roomsList.size(); i++){
              Room* rm=gt.rules.roomsList[i];
              if(this->filterOk(rm)){
                     s=rm->getDescription();
                     visibleRoomsList.append(rm);
                     roomsListWidget->addItem(s);
              }
       }
       
       if(roomsListWidget->count()>0)
              roomsListWidget->setCurrentRow(0);
       else
              roomChanged(-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool RoomsForm::filterOk ( Room rm)

Definition at line 75 of file roomsform.cpp.

{
       Q_UNUSED(rm);

       bool ok=true;
       return ok;
}

Here is the caller graph for this function:

void RoomsForm::modifyRoom ( ) [slot]

Definition at line 168 of file roomsform.cpp.

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

       int ci=roomsListWidget->currentRow();
       if(ci<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected room"));
              return;
       }
       
       Room* rm=visibleRoomsList.at(ci);
       ModifyRoomForm form(this, rm->name, rm->building, rm->capacity);
       setParentAndOtherThings(&form, this);
       form.exec();

       filterChanged();
       
       roomsListWidget->verticalScrollBar()->setValue(valv);
       roomsListWidget->horizontalScrollBar()->setValue(valh);

       if(ci>=roomsListWidget->count())
              ci=roomsListWidget->count()-1;

       if(ci>=0)
              roomsListWidget->setCurrentRow(ci);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void RoomsForm::removeRoom ( ) [slot]

Definition at line 114 of file roomsform.cpp.

{
       int ind=roomsListWidget->currentRow();
       if(ind<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected room"));
              return;
       }
       
       Room* rm=visibleRoomsList.at(ind);
       assert(rm!=NULL);

       if(QMessageBox::warning( this, tr("FET"),
              tr("Are you sure you want to delete this room and all related constraints?"),
              tr("Yes"), tr("No"), 0, 0, 1 ) == 1)
              return;

       bool tmp=gt.rules.removeRoom(this, rm->name);
       assert(tmp);

       visibleRoomsList.removeAt(ind);
       roomsListWidget->setCurrentRow(-1);
       QListWidgetItem* item=roomsListWidget->takeItem(ind);
       delete item;

       if(ind>=roomsListWidget->count())
              ind=roomsListWidget->count()-1;
       if(ind>=0)
              roomsListWidget->setCurrentRow(ind);
       else
              currentRoomTextEdit->setPlainText(QString(""));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void RoomsForm::roomChanged ( int  index) [slot]

Definition at line 146 of file roomsform.cpp.

{
       if(index<0){
              currentRoomTextEdit->setPlainText("");
              return;
       }

       QString s;
       Room* room=visibleRoomsList.at(index);

       assert(room!=NULL);
       s=room->getDetailedDescriptionWithConstraints(gt.rules);
       currentRoomTextEdit->setPlainText(s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void RoomsForm::sortRooms ( ) [slot]

Definition at line 161 of file roomsform.cpp.

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 roomsform.h.


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