Back to index

fet  5.18.0
Public Slots | Public Member Functions
GroupsForm Class Reference

#include <groupsform.h>

List of all members.

Public Slots

void addGroup ()
void removeGroup ()
void modifyGroup ()
void sortGroups ()
void yearChanged (const QString &yearName)
void groupChanged (const QString &groupName)
void activateStudents ()
void deactivateStudents ()

Public Member Functions

 GroupsForm (QWidget *parent)
 ~GroupsForm ()

Detailed Description

Definition at line 23 of file groupsform.h.


Constructor & Destructor Documentation

GroupsForm::GroupsForm ( QWidget *  parent)

Definition at line 40 of file groupsform.cpp.

                                     : QDialog(parent)
{
       setupUi(this);
       
       groupTextEdit->setReadOnly(true);
       
       modifyGroupPushButton->setDefault(true);

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

       connect(yearsListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(yearChanged(const QString&)));
       connect(addGroupPushButton, SIGNAL(clicked()), this, SLOT(addGroup()));
       connect(removeGroupPushButton, SIGNAL(clicked()), this, SLOT(removeGroup()));
       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
       connect(groupsListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(groupChanged(const QString&)));
       connect(modifyGroupPushButton, SIGNAL(clicked()), this, SLOT(modifyGroup()));
       connect(sortGroupsPushButton, SIGNAL(clicked()), this, SLOT(sortGroups()));
       connect(activateStudentsPushButton, SIGNAL(clicked()), this, SLOT(activateStudents()));
       connect(deactivateStudentsPushButton, SIGNAL(clicked()), this, SLOT(deactivateStudents()));
       connect(groupsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyGroup()));

       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();
}

Here is the call graph for this function:

Definition at line 82 of file groupsform.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 249 of file groupsform.cpp.

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

       if(groupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected group"));
              return;
       }

       QString groupName=groupsListWidget->currentItem()->text();
       int count=gt.rules.activateStudents(groupName);
       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 GroupsForm::addGroup ( ) [slot]

Definition at line 90 of file groupsform.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);

       AddStudentsGroupForm form(this, yearName);
       setParentAndOtherThings(&form, this);
       form.exec();

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 268 of file groupsform.cpp.

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

       if(groupsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected group"));
              return;
       }

       QString groupName=groupsListWidget->currentItem()->text();
       int count=gt.rules.deactivateStudents(groupName);
       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 GroupsForm::groupChanged ( const QString &  groupName) [slot]

Definition at line 180 of file groupsform.cpp.

{
       StudentsSet* ss=gt.rules.searchStudentsSet(groupName);
       if(ss==NULL){
              groupTextEdit->setPlainText(QString(""));
              return;
       }
       StudentsGroup* sg=(StudentsGroup*)ss;
       groupTextEdit->setPlainText(sg->getDetailedDescriptionWithConstraints(gt.rules));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GroupsForm::modifyGroup ( ) [slot]

Definition at line 205 of file groupsform.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(yearsListWidget->currentItem()->text());
       assert(yearIndex>=0);
       
       int q=groupsListWidget->currentRow();
       int valv=groupsListWidget->verticalScrollBar()->value();
       int valh=groupsListWidget->horizontalScrollBar()->value();

       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(yearsListWidget->currentItem()->text(), groupName);
       assert(groupIndex>=0);

       int numberOfStudents=gt.rules.searchStudentsSet(groupName)->numberOfStudents;
       
       ModifyStudentsGroupForm form(this, yearName, groupName, numberOfStudents);
       setParentAndOtherThings(&form, this);
       form.exec();

       yearChanged(yearsListWidget->currentItem()->text());
       
       groupsListWidget->verticalScrollBar()->setValue(valv);
       groupsListWidget->horizontalScrollBar()->setValue(valh);
       
       if(q>=groupsListWidget->count())
              q=groupsListWidget->count()-1;
       if(q>=0)
              groupsListWidget->setCurrentRow(q);
       else
              groupTextEdit->setPlainText(QString(""));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GroupsForm::removeGroup ( ) [slot]

Definition at line 111 of file groupsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected year"));
              return;
       }
       int yearIndex=gt.rules.searchYear(yearsListWidget->currentItem()->text());
       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(yearsListWidget->currentItem()->text(), groupName);
       assert(groupIndex>=0);

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

       bool tmp=gt.rules.removeGroup(yearsListWidget->currentItem()->text(), groupName);
       assert(tmp);
       if(tmp){
              int q=groupsListWidget->currentRow();
              
              groupsListWidget->setCurrentRow(-1);
              QListWidgetItem* item;
              item=groupsListWidget->takeItem(q);
              delete item;
              
              if(q>=groupsListWidget->count())
                     q=groupsListWidget->count()-1;
              if(q>=0)
                     groupsListWidget->setCurrentRow(q);
              else
                     groupTextEdit->setPlainText(QString(""));
       }

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

Here is the call graph for this function:

Here is the caller graph for this function:

void GroupsForm::sortGroups ( ) [slot]

Definition at line 191 of file groupsform.cpp.

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

       yearChanged(yearsListWidget->currentItem()->text());
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 157 of file groupsform.cpp.

{
       int yearIndex=gt.rules.searchYear(yearName);
       if(yearIndex<0){
              groupsListWidget->clear();
              groupTextEdit->setPlainText(QString(""));
              return;
       }

       groupsListWidget->clear();

       StudentsYear* sty=gt.rules.yearsList.at(yearIndex);
       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
              groupTextEdit->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: