Back to index

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

#include <buildingsform.h>

List of all members.

Public Slots

void addBuilding ()
void removeBuilding ()
void buildingChanged (int index)
void sortBuildings ()
void modifyBuilding ()
void filterChanged ()

Public Member Functions

 BuildingsForm (QWidget *parent)
 ~BuildingsForm ()
bool filterOk (Building *bu)

Public Attributes

BuildingsList visibleBuildingsList

Detailed Description

Definition at line 25 of file buildingsform.h.


Constructor & Destructor Documentation

BuildingsForm::BuildingsForm ( QWidget *  parent)

Definition at line 39 of file buildingsform.cpp.

                                           : QDialog(parent)
{
       setupUi(this);
       
       currentBuildingTextEdit->setReadOnly(true);

       modifyBuildingPushButton->setDefault(true);

       buildingsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);

       connect(addBuildingPushButton, SIGNAL(clicked()), this, SLOT(addBuilding()));
       connect(removeBuildingPushButton, SIGNAL(clicked()), this, SLOT(removeBuilding()));
       connect(buildingsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(buildingChanged(int)));
       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
       connect(modifyBuildingPushButton, SIGNAL(clicked()), this, SLOT(modifyBuilding()));
       connect(sortBuildingsPushButton, SIGNAL(clicked()), this, SLOT(sortBuildings()));
       connect(buildingsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyBuilding()));

       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 buildingsform.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 BuildingsForm::addBuilding ( ) [slot]

Definition at line 104 of file buildingsform.cpp.

{
       AddBuildingForm addBuildingForm(this);
       setParentAndOtherThings(&addBuildingForm, this);
       addBuildingForm.exec();
       
       filterChanged();
       
       buildingsListWidget->setCurrentRow(buildingsListWidget->count()-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BuildingsForm::buildingChanged ( int  index) [slot]

Definition at line 147 of file buildingsform.cpp.

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

       QString s;
       Building* building=visibleBuildingsList.at(index);

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 84 of file buildingsform.cpp.

{
       QString s;
       buildingsListWidget->clear();
       visibleBuildingsList.clear();
       for(int i=0; i<gt.rules.buildingsList.size(); i++){
              Building* bu=gt.rules.buildingsList[i];
              if(this->filterOk(bu)){
                     s=bu->name;
                     visibleBuildingsList.append(bu);
                     buildingsListWidget->addItem(s);
              }
       }
       
       if(buildingsListWidget->count()>0)
              buildingsListWidget->setCurrentRow(0);
       else
              buildingChanged(-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 75 of file buildingsform.cpp.

{
       Q_UNUSED(bu);

       bool ok=true;

       return ok;
}

Here is the caller graph for this function:

Definition at line 169 of file buildingsform.cpp.

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

       int ci=buildingsListWidget->currentRow();
       if(ci<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected building"));
              return;
       }
       
       Building* bu=visibleBuildingsList.at(ci);
       ModifyBuildingForm form(this, bu->name);
       setParentAndOtherThings(&form, this);
       form.exec();

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 115 of file buildingsform.cpp.

{
       int ind=buildingsListWidget->currentRow();
       if(ind<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected building"));
              return;
       }
       
       Building* bu=visibleBuildingsList.at(ind);
       assert(bu!=NULL);

       if(QMessageBox::warning( this, tr("FET"),
              tr("Are you sure you want to delete this building?"),
              tr("Yes"), tr("No"), 0, 0, 1 ) == 1)
              return;
              
       bool tmp=gt.rules.removeBuilding(bu->name);
       assert(tmp);
       
       visibleBuildingsList.removeAt(ind);
       buildingsListWidget->setCurrentRow(-1);
       QListWidgetItem* item=buildingsListWidget->takeItem(ind);
       delete item;
       
       if(ind>=buildingsListWidget->count())
              ind=buildingsListWidget->count()-1;
       if(ind>=0)
              buildingsListWidget->setCurrentRow(ind);
       else
              currentBuildingTextEdit->setPlainText(QString(""));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 162 of file buildingsform.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 30 of file buildingsform.h.


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