AddConstraintTeacherActivityTagMaxHoursDailyForm::AddConstraintTeacherActivityTagMaxHoursDailyForm(QWidget* parent): QDialog(parent) { setupUi(this); addConstraintPushButton->setDefault(true); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addCurrentConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp1=teachersComboBox->minimumSizeHint(); Q_UNUSED(tmp1); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); updateMaxHoursSpinBox(); teachersComboBox->clear(); for(int i=0; i<gt.rules.teachersList.size(); i++){ Teacher* tch=gt.rules.teachersList[i]; teachersComboBox->addItem(tch->name); } activityTagsComboBox->clear(); foreach(ActivityTag* at, gt.rules.activityTagsList) activityTagsComboBox->addItem(at->name); constraintChanged(); }
ModifyConstraintTeacherActivityTagMaxHoursContinuouslyForm::ModifyConstraintTeacherActivityTagMaxHoursContinuouslyForm(QWidget* parent, ConstraintTeacherActivityTagMaxHoursContinuously* ctr): QDialog(parent) { setupUi(this); okPushButton->setDefault(true); connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok())); connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp1=teachersComboBox->minimumSizeHint(); Q_UNUSED(tmp1); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); this->_ctr=ctr; weightLineEdit->setText(CustomFETString::number(ctr->weightPercentage)); updateMaxHoursSpinBox(); maxHoursSpinBox->setValue(ctr->maxHoursContinuously); teachersComboBox->clear(); int i=0, j=-1; for(int k=0; k<gt.rules.teachersList.size(); k++, i++){ Teacher* tch=gt.rules.teachersList[k]; teachersComboBox->addItem(tch->name); if(tch->name==this->_ctr->teacherName) j=i; } assert(j>=0); teachersComboBox->setCurrentIndex(j); j=-1; activityTagsComboBox->clear(); for(int k=0; k<gt.rules.activityTagsList.count(); k++){ ActivityTag* at=gt.rules.activityTagsList.at(k); activityTagsComboBox->addItem(at->name); if(at->name==this->_ctr->activityTagName) j=k; } assert(j>=0); activityTagsComboBox->setCurrentIndex(j); constraintChanged(); }