Back to index

fet  5.18.0
Public Slots | Public Member Functions | Public Attributes
ModifySubactivityForm Class Reference

#include <modifysubactivityform.h>

Collaboration diagram for ModifySubactivityForm:
Collaboration graph
[legend]

List of all members.

Public Slots

void ok ()
void cancel ()
void addTeacher ()
void removeTeacher ()
void addStudents ()
void removeStudents ()
void clearTeachers ()
void clearStudents ()
void addActivityTag ()
void removeActivityTag ()
void clearActivityTags ()
void showYearsChanged ()
void showGroupsChanged ()
void showSubgroupsChanged ()
void help ()

Public Member Functions

 ModifySubactivityForm (QWidget *parent, int id, int activityGroupId)
 ~ModifySubactivityForm ()
void updateStudentsListWidget ()
void updateTeachersListWidget ()
void updateSubjectsComboBox ()
void updateActivityTagsListWidget ()

Public Attributes

QList< QString > canonicalStudentsSetsNames
int _id
int _activityGroupId
Activity_activity
QStringList _teachers
QString _subject
QStringList _activityTags
QStringList _students

Detailed Description

Definition at line 27 of file modifysubactivityform.h.


Constructor & Destructor Documentation

ModifySubactivityForm::ModifySubactivityForm ( QWidget *  parent,
int  id,
int  activityGroupId 
)

Definition at line 33 of file modifysubactivityform.cpp.

                                                                                        : QDialog(parent)
{
       setupUi(this);

       allTeachersListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
       selectedTeachersListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
       allStudentsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
       selectedStudentsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
       allActivityTagsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
       selectedActivityTagsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);

       connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel()));
       connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok()));
       connect(clearTeacherPushButton, SIGNAL(clicked()), this, SLOT(clearTeachers()));
       connect(clearStudentsPushButton, SIGNAL(clicked()), this, SLOT(clearStudents()));
       connect(allTeachersListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addTeacher()));
       connect(selectedTeachersListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeTeacher()));
       connect(allStudentsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addStudents()));
       connect(selectedStudentsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeStudents()));
       connect(clearActivityTagPushButton, SIGNAL(clicked()), this, SLOT(clearActivityTags()));
       connect(allActivityTagsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addActivityTag()));
       connect(selectedActivityTagsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeActivityTag()));
       connect(showYearsCheckBox, SIGNAL(toggled(bool)), this, SLOT(showYearsChanged()));
       connect(showGroupsCheckBox, SIGNAL(toggled(bool)), this, SLOT(showGroupsChanged()));
       connect(showSubgroupsCheckBox, SIGNAL(toggled(bool)), this, SLOT(showSubgroupsChanged()));
       connect(helpPushButton, SIGNAL(clicked()), this, SLOT(help()));

       centerWidgetOnScreen(this);
       restoreFETDialogGeometry(this);

       QSize tmp3=subjectsComboBox->minimumSizeHint();
       Q_UNUSED(tmp3);
       
       int splitIndex=0;
       int nSplit=0;
       bool found=false;
       
       this->_id=id;
       this->_activityGroupId=activityGroupId;
       for(int i=0; i<gt.rules.activitiesList.size(); i++){
              Activity* act=gt.rules.activitiesList[i];
              if(act->activityGroupId==this->_activityGroupId && act->id==this->_id){
                     this->_activity=act;
                     splitIndex++;
                     nSplit++;
                     found=true;
              }
              else if(this->_activityGroupId!=0 && act->activityGroupId!=0 && act->activityGroupId==this->_activityGroupId){
                     if(!found)
                            splitIndex++;
                     nSplit++;
              }
       }
       
       crtTextLabel->setText(tr("Current subactivity has split index %1 out of %2").arg(splitIndex).arg(nSplit)+
        "<br />"+tr("The current data applies only to this subactivity"));

       this->_teachers=this->_activity->teachersNames;
       this->_subject = this->_activity->subjectName;
       this->_activityTags = this->_activity->activityTagsNames;
       this->_students=this->_activity->studentsNames;
       
       durationSpinBox->setMaximum(gt.rules.nHoursPerDay);
       durationSpinBox->setValue(this->_activity->duration);
       activeCheckBox->setChecked(this->_activity->active);

       nStudentsSpinBox->setMinimum(-1);
       nStudentsSpinBox->setMaximum(MAX_ROOM_CAPACITY);
       nStudentsSpinBox->setValue(-1);
       
       if(this->_activity->computeNTotalStudents==false)
              nStudentsSpinBox->setValue(this->_activity->nTotalStudents);
       
       updateStudentsListWidget();
       updateTeachersListWidget();
       updateSubjectsComboBox();
       updateActivityTagsListWidget();

       selectedStudentsListWidget->clear();
       for(QStringList::Iterator it=this->_students.begin(); it!=this->_students.end(); it++)
              selectedStudentsListWidget->addItem(*it);
       
       okPushButton->setDefault(true);
       okPushButton->setFocus();
}

Here is the call graph for this function:

Definition at line 119 of file modifysubactivityform.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 198 of file modifysubactivityform.cpp.

{
       if(allActivityTagsListWidget->currentRow()<0 || allActivityTagsListWidget->currentRow()>=allActivityTagsListWidget->count())
              return;

       for(int i=0; i<selectedActivityTagsListWidget->count(); i++)
              if(selectedActivityTagsListWidget->item(i)->text()==allActivityTagsListWidget->currentItem()->text())
                     return;

       selectedActivityTagsListWidget->addItem(allActivityTagsListWidget->currentItem()->text());
       selectedActivityTagsListWidget->setCurrentRow(selectedActivityTagsListWidget->count()-1);
}

Here is the caller graph for this function:

Definition at line 166 of file modifysubactivityform.cpp.

{
       if(allStudentsListWidget->currentRow()<0 || allStudentsListWidget->currentRow()>=allStudentsListWidget->count())
              return;

       assert(canonicalStudentsSetsNames.count()==allStudentsListWidget->count());
       QString sn=canonicalStudentsSetsNames.at(allStudentsListWidget->currentRow());

       for(int i=0; i<selectedStudentsListWidget->count(); i++)
              if(selectedStudentsListWidget->item(i)->text()==sn)
                     return;

       selectedStudentsListWidget->addItem(sn);
       selectedStudentsListWidget->setCurrentRow(selectedStudentsListWidget->count()-1);
}

Here is the caller graph for this function:

Definition at line 137 of file modifysubactivityform.cpp.

{
       if(allTeachersListWidget->currentRow()<0 || allTeachersListWidget->currentRow()>=allTeachersListWidget->count())
              return;

       for(int i=0; i<selectedTeachersListWidget->count(); i++)
              if(selectedTeachersListWidget->item(i)->text()==allTeachersListWidget->currentItem()->text())
                     return;

       selectedTeachersListWidget->addItem(allTeachersListWidget->currentItem()->text());
       selectedTeachersListWidget->setCurrentRow(selectedTeachersListWidget->count()-1);
}

Here is the caller graph for this function:

Definition at line 311 of file modifysubactivityform.cpp.

{
       this->reject();
}

Here is the caller graph for this function:

Definition at line 400 of file modifysubactivityform.cpp.

{
       selectedActivityTagsListWidget->clear();
}

Here is the caller graph for this function:

Definition at line 395 of file modifysubactivityform.cpp.

{
       selectedStudentsListWidget->clear();
}

Here is the caller graph for this function:

Definition at line 390 of file modifysubactivityform.cpp.

{
       selectedTeachersListWidget->clear();
}

Here is the caller graph for this function:

void ModifySubactivityForm::help ( ) [slot]

Definition at line 405 of file modifysubactivityform.cpp.

{
       QString s;
       
       s+=tr("Abbreviations in this dialog:");
       s+="\n\n";
       s+=tr("'Students' (the text near the spin box), means 'Number of students (-1 for automatic)'");
       s+="\n";
       
       //show the message in a dialog
       QDialog dialog(this);
       
       dialog.setWindowTitle(tr("FET - help on modifying subactivity(ies)"));

       QVBoxLayout* vl=new QVBoxLayout(&dialog);
       QPlainTextEdit* te=new QPlainTextEdit();
       te->setPlainText(s);
       te->setReadOnly(true);
       QPushButton* pb=new QPushButton(tr("OK"));

       QHBoxLayout* hl=new QHBoxLayout(0);
       hl->addStretch(1);
       hl->addWidget(pb);

       vl->addWidget(te);
       vl->addLayout(hl);
       connect(pb, SIGNAL(clicked()), &dialog, SLOT(close()));

       dialog.resize(600,470);
       centerWidgetOnScreen(&dialog);

       setParentAndOtherThings(&dialog, this);
       dialog.exec();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ModifySubactivityForm::ok ( ) [slot]

Definition at line 316 of file modifysubactivityform.cpp.

{
       //teachers
       QStringList teachers_names;
       if(selectedTeachersListWidget->count()<=0){
              int t=QMessageBox::question(this, tr("FET question"),
               tr("Do you really want to have the subactivity without teacher(s)?"),
               QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);

              if(t==QMessageBox::No)
                     return;
       }
       else{
              for(int i=0; i<selectedTeachersListWidget->count(); i++){
                     assert(gt.rules.searchTeacher(selectedTeachersListWidget->item(i)->text())>=0);
                     teachers_names.append(selectedTeachersListWidget->item(i)->text());
              }
       }

       //subject
       QString subject_name=subjectsComboBox->currentText();
       int subject_index=gt.rules.searchSubject(subject_name);
       if(subject_index<0){
              QMessageBox::warning(this, tr("FET information"),
                     tr("Invalid subject"));
              return;
       }

       //activity tag
       QStringList activity_tags_names;
       for(int i=0; i<selectedActivityTagsListWidget->count(); i++){
              assert(gt.rules.searchActivityTag(selectedActivityTagsListWidget->item(i)->text())>=0);
              activity_tags_names.append(selectedActivityTagsListWidget->item(i)->text());
       }

       //students
       QStringList students_names;
       if(selectedStudentsListWidget->count()<=0){
              int t=QMessageBox::question(this, tr("FET question"),
               tr("Do you really want to have the subactivity without student set(s)?"),
                QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);

              if(t==QMessageBox::No)
                     return;
       }
       else{
              for(int i=0; i<selectedStudentsListWidget->count(); i++){
                     assert(gt.rules.searchStudentsSet(selectedStudentsListWidget->item(i)->text())!=NULL);
                     students_names.append(selectedStudentsListWidget->item(i)->text());
              }
       }

       int total_number_of_students=0;
       for(QStringList::Iterator it=students_names.begin(); it!=students_names.end(); it++){
              StudentsSet* ss=gt.rules.searchStudentsSet(*it);
              total_number_of_students+=ss->numberOfStudents;
       }

       if(nStudentsSpinBox->value()==-1){
              gt.rules.modifySubactivity(this->_id, this->_activityGroupId, teachers_names, subject_name,
               activity_tags_names,students_names, durationSpinBox->value(), activeCheckBox->isChecked(),
               (nStudentsSpinBox->value()==-1), total_number_of_students);
       }
       else{
              gt.rules.modifySubactivity(this->_id, this->_activityGroupId, teachers_names, subject_name,
               activity_tags_names,students_names, durationSpinBox->value(), activeCheckBox->isChecked(),
               (nStudentsSpinBox->value()==-1), nStudentsSpinBox->value());
       }
       
       PlanningChanged::increasePlanningCommunicationSpinBox();
       
       this->accept();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 211 of file modifysubactivityform.cpp.

{
       if(selectedActivityTagsListWidget->count()<=0 || selectedActivityTagsListWidget->currentRow()<0 ||
        selectedActivityTagsListWidget->currentRow()>=selectedActivityTagsListWidget->count())
              return;

       int i=selectedActivityTagsListWidget->currentRow();
       selectedActivityTagsListWidget->setCurrentRow(-1);
       QListWidgetItem* item=selectedActivityTagsListWidget->takeItem(i);
       delete item;
       if(i<selectedActivityTagsListWidget->count())
              selectedActivityTagsListWidget->setCurrentRow(i);
       else
              selectedActivityTagsListWidget->setCurrentRow(selectedActivityTagsListWidget->count()-1);
}

Here is the caller graph for this function:

Definition at line 182 of file modifysubactivityform.cpp.

{
       if(selectedStudentsListWidget->count()<=0 || selectedStudentsListWidget->currentRow()<0 ||
        selectedStudentsListWidget->currentRow()>=selectedStudentsListWidget->count())
              return;

       int i=selectedStudentsListWidget->currentRow();
       selectedStudentsListWidget->setCurrentRow(-1);
       QListWidgetItem* item=selectedStudentsListWidget->takeItem(i);
       delete item;
       if(i<selectedStudentsListWidget->count())
              selectedStudentsListWidget->setCurrentRow(i);
       else
              selectedStudentsListWidget->setCurrentRow(selectedStudentsListWidget->count()-1);
}

Here is the caller graph for this function:

Definition at line 150 of file modifysubactivityform.cpp.

{
       if(selectedTeachersListWidget->count()<=0 || selectedTeachersListWidget->currentRow()<0 ||
        selectedTeachersListWidget->currentRow()>=selectedTeachersListWidget->count())
              return;

       int i=selectedTeachersListWidget->currentRow();
       selectedTeachersListWidget->setCurrentRow(-1);
       QListWidgetItem* item=selectedTeachersListWidget->takeItem(i);
       delete item;
       if(i<selectedTeachersListWidget->count())
              selectedTeachersListWidget->setCurrentRow(i);
       else
              selectedTeachersListWidget->setCurrentRow(selectedTeachersListWidget->count()-1);
}

Here is the caller graph for this function:

Definition at line 259 of file modifysubactivityform.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 264 of file modifysubactivityform.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 254 of file modifysubactivityform.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 241 of file modifysubactivityform.cpp.

{
       allActivityTagsListWidget->clear();
       for(int i=0; i<gt.rules.activityTagsList.size(); i++){
              ActivityTag* at=gt.rules.activityTagsList[i];
              allActivityTagsListWidget->addItem(at->name);
       }
              
       selectedActivityTagsListWidget->clear();
       for(QStringList::Iterator it=this->_activityTags.begin(); it!=this->_activityTags.end(); it++)
              selectedActivityTagsListWidget->addItem(*it);
}

Here is the caller graph for this function:

Definition at line 269 of file modifysubactivityform.cpp.

{
       const int INDENT=2;

       bool showYears=showYearsCheckBox->isChecked();
       bool showGroups=showGroupsCheckBox->isChecked();
       bool showSubgroups=showSubgroupsCheckBox->isChecked();

       allStudentsListWidget->clear();
       canonicalStudentsSetsNames.clear();
       for(int i=0; i<gt.rules.yearsList.size(); i++){
              StudentsYear* sty=gt.rules.yearsList[i];
              if(showYears){
                     allStudentsListWidget->addItem(sty->name);
                     canonicalStudentsSetsNames.append(sty->name);
              }
              for(int j=0; j<sty->groupsList.size(); j++){
                     StudentsGroup* stg=sty->groupsList[j];
                     if(showGroups){
                            QString begin=QString("");
                            QString end=QString("");
                            begin=QString(INDENT, ' ');
                            allStudentsListWidget->addItem(begin+stg->name+end);
                            canonicalStudentsSetsNames.append(stg->name);
                     }
                     for(int k=0; k<stg->subgroupsList.size(); k++){
                            StudentsSubgroup* sts=stg->subgroupsList[k];
                            if(showSubgroups){
                                   QString begin=QString("");
                                   QString end=QString("");
                                   begin=QString(2*INDENT, ' ');
                                   allStudentsListWidget->addItem(begin+sts->name+end);
                                   canonicalStudentsSetsNames.append(sts->name);
                            }
                     }
              }
       }

       int q=allStudentsListWidget->verticalScrollBar()->minimum();
       allStudentsListWidget->verticalScrollBar()->setValue(q);
}

Here is the caller graph for this function:

Definition at line 227 of file modifysubactivityform.cpp.

{
       int i=0, j=-1;
       subjectsComboBox->clear();
       for(int k=0; k<gt.rules.subjectsList.size(); k++, i++){
              Subject* sbj=gt.rules.subjectsList[k];
              subjectsComboBox->addItem(sbj->name);
              if(sbj->name==this->_subject)
                     j=i;
       }
       assert(j!=-1);
       subjectsComboBox->setCurrentIndex(j);
}

Here is the caller graph for this function:

Definition at line 124 of file modifysubactivityform.cpp.

{
       allTeachersListWidget->clear();
       for(int i=0; i<gt.rules.teachersList.size(); i++){
              Teacher* tch=gt.rules.teachersList[i];
              allTeachersListWidget->addItem(tch->name);
       }
              
       selectedTeachersListWidget->clear();
       for(QStringList::Iterator it=this->_teachers.begin(); it!=this->_teachers.end(); it++)
              selectedTeachersListWidget->addItem(*it);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 35 of file modifysubactivityform.h.

Definition at line 34 of file modifysubactivityform.h.

Definition at line 38 of file modifysubactivityform.h.

Definition at line 33 of file modifysubactivityform.h.

Definition at line 39 of file modifysubactivityform.h.

Definition at line 37 of file modifysubactivityform.h.

Definition at line 36 of file modifysubactivityform.h.

Definition at line 31 of file modifysubactivityform.h.


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