Back to index

fet  5.18.0
Public Slots | Public Member Functions
AddStudentsSubgroupForm Class Reference

#include <addstudentssubgroupform.h>

List of all members.

Public Slots

void addStudentsSubgroup ()

Public Member Functions

 AddStudentsSubgroupForm (QWidget *parent, const QString &yearName, const QString &groupName)
 ~AddStudentsSubgroupForm ()

Detailed Description

Definition at line 27 of file addstudentssubgroupform.h.


Constructor & Destructor Documentation

AddStudentsSubgroupForm::AddStudentsSubgroupForm ( QWidget *  parent,
const QString &  yearName,
const QString &  groupName 
)

Definition at line 22 of file addstudentssubgroupform.cpp.

                                                                                                                  : QDialog(parent)
{
       setupUi(this);

       addStudentsSubgroupPushButton->setDefault(true);

       connect(addStudentsSubgroupPushButton, SIGNAL(clicked()), this, SLOT(addStudentsSubgroup()));
       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));

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

       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 45 of file addstudentssubgroupform.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 50 of file addstudentssubgroupform.cpp.

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

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

              numberSpinBox->setValue(ss->numberOfStudents);
              sts=(StudentsSubgroup*)ss;
       }
       else{
              sts=new StudentsSubgroup();
              sts->name=subgroupName;
              sts->numberOfStudents=numberSpinBox->value();
       }
       gt.rules.addSubgroup(yearName, groupName, sts);
       QMessageBox::information(this, tr("Subgroup insertion dialog"),
              tr("Subgroup 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: