Back to index

fet  5.18.0
Public Slots | Public Member Functions
SubgroupsForm Class Reference

#include <subgroupsform.h>

List of all members.

Public Slots

void addSubgroup ()
void removeSubgroup ()
void modifySubgroup ()
void sortSubgroups ()
void yearChanged (const QString &yearName)
void groupChanged (const QString &groupName)
void subgroupChanged (const QString &subgroupName)
void activateStudents ()
void deactivateStudents ()

Public Member Functions

 SubgroupsForm (QWidget *parent)
 ~SubgroupsForm ()

Detailed Description

Definition at line 23 of file subgroupsform.h.


Constructor & Destructor Documentation

SubgroupsForm::SubgroupsForm ( QWidget *  parent)

Definition at line 39 of file subgroupsform.cpp.

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

       modifySubgroupPushButton->setDefault(true);

       yearsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
       groupsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
       subgroupsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);

       connect(yearsListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(yearChanged(const QString&)));
       connect(groupsListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(groupChanged(const QString&)));
       connect(addSubgroupPushButton, SIGNAL(clicked()), this, SLOT(addSubgroup()));
       connect(removeSubgroupPushButton, SIGNAL(clicked()), this, SLOT(removeSubgroup()));
       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
       connect(subgroupsListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(subgroupChanged(const QString&)));
       connect(modifySubgroupPushButton, SIGNAL(clicked()), this, SLOT(modifySubgroup()));
       connect(removeSubgroupPushButton_2, SIGNAL(clicked()), this, SLOT(sortSubgroups()));
       connect(activateStudentsPushButton, SIGNAL(clicked()), this, SLOT(activateStudents()));
       connect(deactivateStudentsPushButton, SIGNAL(clicked()), this, SLOT(deactivateStudents()));
       connect(subgroupsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifySubgroup()));

       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());
       
       yearsListWidget->clear();
       for(int i=0; i<gt.rules.yearsList.size(); i++){
              StudentsYear* year=gt.rules.yearsList[i];
              yearsListWidget->addItem(year->name);
       }

       if(yearsListWidget->count()>0)
              yearsListWidget->setCurrentRow(0);
       else{
              groupsListWidget->clear();
              subgroupsListWidget->clear();
       }
}

Here is the call graph for this function:

Definition at line 84 of file subgroupsform.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

Definition at line 313 of file subgroupsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected year"));
              return;
       }
       QString yearName=yearsListWidget->currentItem()->text();
       int yearIndex=gt.rules.searchYear(yearName);
       assert(yearIndex>=0);

       if(groupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected group"));
              return;
       }
       QString groupName=groupsListWidget->currentItem()->text();
       int groupIndex=gt.rules.searchGroup(yearName, groupName);
       assert(groupIndex>=0);

       if(subgroupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected subgroup"));
              return;
       }
       
       QString subgroupName=subgroupsListWidget->currentItem()->text();
       int count=gt.rules.activateStudents(subgroupName);
       QMessageBox::information(this, tr("FET information"), tr("Activated a number of %1 activities").arg(count));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SubgroupsForm::addSubgroup ( ) [slot]

Definition at line 92 of file subgroupsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected year"));
              return;
       }
       QString yearName=yearsListWidget->currentItem()->text();
       int yearIndex=gt.rules.searchYear(yearName);
       assert(yearIndex>=0);

       if(groupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected group"));
              return;
       }
       QString groupName=groupsListWidget->currentItem()->text();
       int groupIndex=gt.rules.searchGroup(yearName, groupName);
       assert(groupIndex>=0);

       AddStudentsSubgroupForm form(this, yearName, groupName);
       setParentAndOtherThings(&form, this);
       form.exec();

       groupChanged(groupsListWidget->currentItem()->text());
       
       int i=subgroupsListWidget->count()-1;
       if(i>=0)
              subgroupsListWidget->setCurrentRow(i);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 341 of file subgroupsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected year"));
              return;
       }
       QString yearName=yearsListWidget->currentItem()->text();
       int yearIndex=gt.rules.searchYear(yearName);
       assert(yearIndex>=0);

       if(groupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected group"));
              return;
       }
       QString groupName=groupsListWidget->currentItem()->text();
       int groupIndex=gt.rules.searchGroup(yearName, groupName);
       assert(groupIndex>=0);

       if(subgroupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected subgroup"));
              return;
       }
       
       QString subgroupName=subgroupsListWidget->currentItem()->text();
       int count=gt.rules.deactivateStudents(subgroupName);
       QMessageBox::information(this, tr("FET information"), tr("De-activated a number of %1 activities").arg(count));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SubgroupsForm::groupChanged ( const QString &  groupName) [slot]

Definition at line 201 of file subgroupsform.cpp.

{
       QString yearName=yearsListWidget->currentItem()->text();
       int yearIndex=gt.rules.searchYear(yearName);
       if(yearIndex<0){
              return;
       }
       StudentsYear* sty=gt.rules.yearsList.at(yearIndex);
       int groupIndex=gt.rules.searchGroup(yearName, groupName);
       if(groupIndex<0){
              subgroupsListWidget->clear();
              subgroupTextEdit->setPlainText(QString(""));
              return;
       }

       StudentsGroup* stg=sty->groupsList.at(groupIndex);

       subgroupsListWidget->clear();
       for(int i=0; i<stg->subgroupsList.size(); i++){
              StudentsSubgroup* sts=stg->subgroupsList[i];
              subgroupsListWidget->addItem(sts->name);
       }

       if(subgroupsListWidget->count()>0)
              subgroupsListWidget->setCurrentRow(0);
       else
              subgroupTextEdit->setPlainText(QString(""));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 264 of file subgroupsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected year"));
              return;
       }
       QString yearName=yearsListWidget->currentItem()->text();
       int yearIndex=gt.rules.searchYear(yearName);
       assert(yearIndex>=0);

       if(groupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected group"));
              return;
       }
       QString groupName=groupsListWidget->currentItem()->text();
       int groupIndex=gt.rules.searchGroup(yearName, groupName);
       assert(groupIndex>=0);

       int q=subgroupsListWidget->currentRow();
       int valv=subgroupsListWidget->verticalScrollBar()->value();
       int valh=subgroupsListWidget->horizontalScrollBar()->value();

       if(subgroupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected subgroup"));
              return;
       }
       QString subgroupName=subgroupsListWidget->currentItem()->text();
       int subgroupIndex=gt.rules.searchSubgroup(yearName, groupName, subgroupName);
       assert(subgroupIndex>=0);
       
       int numberOfStudents=gt.rules.searchStudentsSet(subgroupName)->numberOfStudents;
       
       ModifyStudentsSubgroupForm form(this, yearName, groupName, subgroupName, numberOfStudents);
       setParentAndOtherThings(&form, this);
       form.exec();

       groupChanged(groupName);
       
       subgroupsListWidget->verticalScrollBar()->setValue(valv);
       subgroupsListWidget->horizontalScrollBar()->setValue(valh);

       if(q>=subgroupsListWidget->count())
              q=subgroupsListWidget->count()-1;
       if(q>=0)
              subgroupsListWidget->setCurrentRow(q);
       else
              subgroupTextEdit->setPlainText(QString(""));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 121 of file subgroupsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected year"));
              return;
       }
       QString yearName=yearsListWidget->currentItem()->text();
       int yearIndex=gt.rules.searchYear(yearName);
       assert(yearIndex>=0);

       if(groupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected group"));
              return;
       }
       QString groupName=groupsListWidget->currentItem()->text();
       int groupIndex=gt.rules.searchGroup(yearName, groupName);
       assert(groupIndex>=0);

       if(subgroupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected subgroup"));
              return;
       }
       
       QString subgroupName=subgroupsListWidget->currentItem()->text();
       int subgroupIndex=gt.rules.searchSubgroup(yearName, groupName, subgroupName);
       assert(subgroupIndex>=0);

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

       bool tmp=gt.rules.removeSubgroup(yearName, groupName, subgroupName);
       assert(tmp);
       if(tmp){
              int q=subgroupsListWidget->currentRow();
              
              subgroupsListWidget->setCurrentRow(-1);
              QListWidgetItem* item;
              item=subgroupsListWidget->takeItem(q);
              delete item;
              
              if(q>=subgroupsListWidget->count())
                     q=subgroupsListWidget->count()-1;
              if(q>=0)
                     subgroupsListWidget->setCurrentRow(q);
              else
                     subgroupTextEdit->setPlainText(QString(""));
       }

       if(gt.rules.searchStudentsSet(subgroupName)!=NULL)
              QMessageBox::information( this, tr("FET"), tr("This subgroup still exists into another group. "
              "The related activities and constraints were not removed"));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 241 of file subgroupsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected year"));
              return;
       }
       QString yearName=yearsListWidget->currentItem()->text();
       int yearIndex=gt.rules.searchYear(yearName);
       assert(yearIndex>=0);

       if(groupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected group"));
              return;
       }
       QString groupName=groupsListWidget->currentItem()->text();
       int groupIndex=gt.rules.searchGroup(yearName, groupName);
       assert(groupIndex>=0);
       
       gt.rules.sortSubgroupsAlphabetically(yearName, groupName);
       
       groupChanged(groupName);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SubgroupsForm::subgroupChanged ( const QString &  subgroupName) [slot]

Definition at line 230 of file subgroupsform.cpp.

{
       StudentsSet* ss=gt.rules.searchStudentsSet(subgroupName);
       if(ss==NULL){
              subgroupTextEdit->setPlainText(QString(""));
              return;
       }
       StudentsSubgroup* s=(StudentsSubgroup*)ss;
       subgroupTextEdit->setPlainText(s->getDetailedDescriptionWithConstraints(gt.rules));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SubgroupsForm::yearChanged ( const QString &  yearName) [slot]

Definition at line 176 of file subgroupsform.cpp.

{
       int yearIndex=gt.rules.searchYear(yearName);
       if(yearIndex<0){
              groupsListWidget->clear();
              subgroupsListWidget->clear();
              subgroupTextEdit->setPlainText(QString(""));
              return;
       }
       StudentsYear* sty=gt.rules.yearsList.at(yearIndex);

       groupsListWidget->clear();
       for(int i=0; i<sty->groupsList.size(); i++){
              StudentsGroup* stg=sty->groupsList[i];
              groupsListWidget->addItem(stg->name);
       }

       if(groupsListWidget->count()>0)
              groupsListWidget->setCurrentRow(0);
       else{
              subgroupsListWidget->clear();
              subgroupTextEdit->setPlainText(QString(""));
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:


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