Back to index

fet  5.18.0
Public Slots | Public Member Functions
YearsForm Class Reference

#include <yearsform.h>

List of all members.

Public Slots

void addYear ()
void removeYear ()
void modifyYear ()
void sortYears ()
void yearChanged ()
void activateStudents ()
void deactivateStudents ()
void divideYear ()

Public Member Functions

 YearsForm (QWidget *parent)
 ~YearsForm ()

Detailed Description

Definition at line 23 of file yearsform.h.


Constructor & Destructor Documentation

YearsForm::YearsForm ( QWidget *  parent)

Definition at line 42 of file yearsform.cpp.

                                   : QDialog(parent)
{
       setupUi(this);
       
       detailsTextEdit->setReadOnly(true);
       
       modifyYearPushButton->setDefault(true);

       yearsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);

       connect(addYearPushButton, SIGNAL(clicked()), this, SLOT(addYear()));
       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
       connect(removeYearPushButton, SIGNAL(clicked()), this, SLOT(removeYear()));
       connect(yearsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(yearChanged()));
       connect(modifyYearPushButton, SIGNAL(clicked()), this, SLOT(modifyYear()));
       connect(sortYearsPushButton, SIGNAL(clicked()), this, SLOT(sortYears()));
       connect(activateStudentsPushButton, SIGNAL(clicked()), this, SLOT(activateStudents()));
       connect(deactivateStudentsPushButton, SIGNAL(clicked()), this, SLOT(deactivateStudents()));
       connect(divisionsPushButton, SIGNAL(clicked()), this, SLOT(divideYear()));
       connect(yearsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyYear()));

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

Here is the call graph for this function:

Definition at line 80 of file yearsform.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 YearsForm::activateStudents ( ) [slot]

Definition at line 197 of file yearsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected year"));
              return;
       }
       
       QString yearName=yearsListWidget->currentItem()->text();
       int count=gt.rules.activateStudents(yearName);
       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 YearsForm::addYear ( ) [slot]

Definition at line 88 of file yearsform.cpp.

{
       AddStudentsYearForm form(this);
       setParentAndOtherThings(&form, this);
       form.exec();

       yearsListWidget->clear();
       for(int i=0; i<gt.rules.yearsList.size(); i++){
              StudentsYear* year=gt.rules.yearsList[i];
              yearsListWidget->addItem(year->name);
       }
       
       int i=yearsListWidget->count()-1;
       if(i>=0)
              yearsListWidget->setCurrentRow(i);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 209 of file yearsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected year"));
              return;
       }
       
       QString yearName=yearsListWidget->currentItem()->text();
       int count=gt.rules.deactivateStudents(yearName);
       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 YearsForm::divideYear ( ) [slot]

Definition at line 221 of file yearsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected year"));
              return;
       }
       
       QString yearName=yearsListWidget->currentItem()->text();
       
       SplitYearForm form(this, yearName);
       setParentAndOtherThings(&form, this);
       form.exec();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void YearsForm::modifyYear ( ) [slot]

Definition at line 163 of file yearsform.cpp.

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

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

       ModifyStudentsYearForm form(this, yearName, numberOfStudents);
       setParentAndOtherThings(&form, this);
       form.exec();

       yearsListWidget->clear();
       for(int i=0; i<gt.rules.yearsList.size(); i++){
              StudentsYear* year=gt.rules.yearsList[i];
              yearsListWidget->addItem(year->name);
       }
       
       yearsListWidget->verticalScrollBar()->setValue(valv);
       yearsListWidget->horizontalScrollBar()->setValue(valh);

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

Here is the call graph for this function:

Here is the caller graph for this function:

void YearsForm::removeYear ( ) [slot]

Definition at line 105 of file yearsform.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(QMessageBox::warning( this, tr("FET"),
              tr("Are you sure you want to delete year %1 and all related groups, subgroups, activities and constraints?").arg(yearName),
              tr("Yes"), tr("No"), 0, 0, 1 ) == 1)
              return;

       bool tmp=gt.rules.removeYear(yearName);
       assert(tmp);
       if(tmp){
              int q=yearsListWidget->currentRow();

              yearsListWidget->setCurrentRow(-1);
              QListWidgetItem* item;
              item=yearsListWidget->takeItem(q);
              delete item;

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

Here is the call graph for this function:

Here is the caller graph for this function:

void YearsForm::sortYears ( ) [slot]

Definition at line 149 of file yearsform.cpp.

{
       gt.rules.sortYearsAlphabetically();

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

Here is the call graph for this function:

Here is the caller graph for this function:

void YearsForm::yearChanged ( ) [slot]

Definition at line 139 of file yearsform.cpp.

{
       if(yearsListWidget->currentRow()<0){
              detailsTextEdit->setPlainText("");
              return;
       }
       StudentsYear* sty=gt.rules.yearsList.at(yearsListWidget->currentRow());
       detailsTextEdit->setPlainText(sty->getDetailedDescriptionWithConstraints(gt.rules));
}

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: