Back to index

fet  5.18.0
Public Slots | Public Member Functions
AddStudentsGroupForm Class Reference

#include <addstudentsgroupform.h>

List of all members.

Public Slots

void addStudentsGroup ()

Public Member Functions

 AddStudentsGroupForm (QWidget *parent, const QString &yearName)
 ~AddStudentsGroupForm ()

Detailed Description

Definition at line 27 of file addstudentsgroupform.h.


Constructor & Destructor Documentation

AddStudentsGroupForm::AddStudentsGroupForm ( QWidget *  parent,
const QString &  yearName 
)

Definition at line 22 of file addstudentsgroupform.cpp.

                                                                                  : QDialog(parent)
{
       setupUi(this);
       
       addStudentsGroupPushButton->setDefault(true);

       connect(addStudentsGroupPushButton, SIGNAL(clicked()), this, SLOT(addStudentsGroup()));
       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));

       centerWidgetOnScreen(this);
       restoreFETDialogGeometry(this);
              
       yearNameLineEdit->setText(yearName);

       nameLineEdit->selectAll();
       nameLineEdit->setFocus();
       
       numberSpinBox->setMaximum(MAX_ROOM_CAPACITY);
       numberSpinBox->setMinimum(0);
       numberSpinBox->setValue(0);
}

Here is the call graph for this function:

Definition at line 44 of file addstudentsgroupform.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 49 of file addstudentsgroupform.cpp.

{
       StudentsGroup* sg;

       if(nameLineEdit->text().isEmpty()){
              QMessageBox::information(this, tr("FET information"), tr("Incorrect name"));
              return;
       }
       QString yearName=yearNameLineEdit->text();
       QString groupName=nameLineEdit->text();

       if(gt.rules.searchGroup(yearName, groupName)>=0){
              QMessageBox::information( this, tr("Group insertion dialog"),
                     tr("Could not insert item. Duplicate"));
              return;
       }
       StudentsSet* ss=gt.rules.searchStudentsSet(groupName);
       if(ss!=NULL && ss->type==STUDENTS_YEAR){
              QMessageBox::information( this, tr("Group insertion dialog"),
                     tr("This name is taken for a year - please consider another name"));
              return;
       }
       if(ss!=NULL && ss->type==STUDENTS_SUBGROUP){
              QMessageBox::information( this, tr("Group insertion dialog"),
                     tr("This name is taken for a subgroup - please consider another name"));
              return;
       }
       if(ss!=NULL){ //already existing group, but in other year. It is the same group.
              assert(ss->type==STUDENTS_GROUP);
              if(QMessageBox::warning( this, tr("FET"),
                     tr("This group already exists, but in another year. "
                     "If you insert current group to current year, that "
                     "means that some years share the same group (overlap). "
                     "If you want to make a new group, independent, "
                     "please abort now and give it another name.")+"\n\n"+tr("Note: the number of students for the added group will be the number of students of the already existing group"
                     " (you can modify the number of students in the modify group dialog)."),
                     tr("Add"),tr("Abort"), 0, 0, 1 ) == 1)
                     return;

              numberSpinBox->setValue(ss->numberOfStudents);
              sg=(StudentsGroup*)ss;
       }
       else{
              sg=new StudentsGroup();
              sg->name=groupName;
              sg->numberOfStudents=numberSpinBox->value();
       }

       gt.rules.addGroup(yearName, sg);
       QMessageBox::information(this, tr("Group insertion dialog"),
              tr("Group added"));

       nameLineEdit->selectAll();
       nameLineEdit->setFocus();
}

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: