ModifyConstraintActivitiesNotOverlappingForm::ModifyConstraintActivitiesNotOverlappingForm(QWidget* parent, ConstraintActivitiesNotOverlapping* ctr): QDialog(parent) { setupUi(this); okPushButton->setDefault(true); activitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection); notOverlappingActivitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok())); connect(activitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addActivity())); connect(addAllActivitiesPushButton, SIGNAL(clicked()), this, SLOT(addAllActivities())); connect(notOverlappingActivitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeActivity())); connect(teachersComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(studentsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(subjectsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(activityTagsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(clearPushButton, SIGNAL(clicked()), this, SLOT(clear())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp1=teachersComboBox->minimumSizeHint(); Q_UNUSED(tmp1); QSize tmp2=studentsComboBox->minimumSizeHint(); Q_UNUSED(tmp2); QSize tmp3=subjectsComboBox->minimumSizeHint(); Q_UNUSED(tmp3); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); this->_ctr=ctr; notOverlappingActivitiesList.clear(); notOverlappingActivitiesListWidget->clear(); for(int i=0; i<ctr->n_activities; i++){ int actId=ctr->activitiesId[i]; this->notOverlappingActivitiesList.append(actId); Activity* act=NULL; for(int k=0; k<gt.rules.activitiesList.size(); k++){ act=gt.rules.activitiesList[k]; if(act->id==actId) break; } assert(act); this->notOverlappingActivitiesListWidget->addItem(act->getDescription(gt.rules)); } weightLineEdit->setText(CustomFETString::number(ctr->weightPercentage)); //////////////// teachersComboBox->addItem(""); for(int i=0; i<gt.rules.teachersList.size(); i++){ Teacher* tch=gt.rules.teachersList[i]; teachersComboBox->addItem(tch->name); } teachersComboBox->setCurrentIndex(0); subjectsComboBox->addItem(""); for(int i=0; i<gt.rules.subjectsList.size(); i++){ Subject* sb=gt.rules.subjectsList[i]; subjectsComboBox->addItem(sb->name); } subjectsComboBox->setCurrentIndex(0); activityTagsComboBox->addItem(""); for(int i=0; i<gt.rules.activityTagsList.size(); i++){ ActivityTag* st=gt.rules.activityTagsList[i]; activityTagsComboBox->addItem(st->name); } activityTagsComboBox->setCurrentIndex(0); studentsComboBox->addItem(""); for(int i=0; i<gt.rules.yearsList.size(); i++){ StudentsYear* sty=gt.rules.yearsList[i]; studentsComboBox->addItem(sty->name); for(int j=0; j<sty->groupsList.size(); j++){ StudentsGroup* stg=sty->groupsList[j]; studentsComboBox->addItem(stg->name); for(int k=0; k<stg->subgroupsList.size(); k++){ StudentsSubgroup* sts=stg->subgroupsList[k]; studentsComboBox->addItem(sts->name); } } } studentsComboBox->setCurrentIndex(0); filterChanged(); }
ModifyConstraintActivitiesMaxSimultaneousInSelectedTimeSlotsForm::ModifyConstraintActivitiesMaxSimultaneousInSelectedTimeSlotsForm(QWidget* parent, ConstraintActivitiesMaxSimultaneousInSelectedTimeSlots* ctr): QDialog(parent) { setupUi(this); okPushButton->setDefault(true); allActivitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection); selectedActivitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok())); connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(selectedTimesTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(itemClicked(QTableWidgetItem*))); connect(setAllUnselectedPushButton, SIGNAL(clicked()), this, SLOT(setAllUnselected())); connect(setAllSelectedPushButton, SIGNAL(clicked()), this, SLOT(setAllSelected())); connect(allActivitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addActivity())); connect(addAllActivitiesPushButton, SIGNAL(clicked()), this, SLOT(addAllActivities())); connect(selectedActivitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeActivity())); connect(clearPushButton, SIGNAL(clicked()), this, SLOT(clear())); connect(teachersComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(studentsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(subjectsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(activityTagsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); this->_ctr=ctr; weightLineEdit->setText(CustomFETString::number(ctr->weightPercentage)); tabWidget->setCurrentIndex(0); maxSimultaneousSpinBox->setMinimum(0); maxSimultaneousSpinBox->setMaximum(MAX_ACTIVITIES); maxSimultaneousSpinBox->setValue(ctr->maxSimultaneous); selectedTimesTable->setRowCount(gt.rules.nHoursPerDay); selectedTimesTable->setColumnCount(gt.rules.nDaysPerWeek); for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.daysOfTheWeek[j]); selectedTimesTable->setHorizontalHeaderItem(j, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.hoursOfTheDay[i]); selectedTimesTable->setVerticalHeaderItem(i, item); } //bool currentMatrix[MAX_HOURS_PER_DAY][MAX_DAYS_PER_WEEK]; Matrix2D<bool> currentMatrix; currentMatrix.resize(gt.rules.nHoursPerDay, gt.rules.nDaysPerWeek); for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++) currentMatrix[i][j]=false; assert(ctr->selectedDays.count()==ctr->selectedHours.count()); for(int k=0; k<ctr->selectedDays.count(); k++){ if(ctr->selectedHours.at(k)==-1 || ctr->selectedDays.at(k)==-1) assert(0); int i=ctr->selectedHours.at(k); int j=ctr->selectedDays.at(k); if(i>=0 && i<gt.rules.nHoursPerDay && j>=0 && j<gt.rules.nDaysPerWeek) currentMatrix[i][j]=true; } for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item = new QTableWidgetItem(); item->setTextAlignment(Qt::AlignCenter); item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled); if(SHOW_TOOLTIPS_FOR_CONSTRAINTS_WITH_TABLES) item->setToolTip(gt.rules.daysOfTheWeek[j]+QString("\n")+gt.rules.hoursOfTheDay[i]); selectedTimesTable->setItem(i, j, item); if(!currentMatrix[i][j]) item->setText(NO); else item->setText(YES); colorItem(item); } selectedTimesTable->resizeRowsToContents(); connect(selectedTimesTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(horizontalHeaderClicked(int))); connect(selectedTimesTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(verticalHeaderClicked(int))); selectedTimesTable->setSelectionMode(QAbstractItemView::NoSelection); tableWidgetUpdateBug(selectedTimesTable); setStretchAvailabilityTableNicely(selectedTimesTable); //activities QSize tmp1=teachersComboBox->minimumSizeHint(); Q_UNUSED(tmp1); QSize tmp2=studentsComboBox->minimumSizeHint(); Q_UNUSED(tmp2); QSize tmp3=subjectsComboBox->minimumSizeHint(); Q_UNUSED(tmp3); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); selectedActivitiesList.clear(); selectedActivitiesListWidget->clear(); for(int i=0; i<ctr->activitiesIds.count(); i++){ int actId=ctr->activitiesIds.at(i); this->selectedActivitiesList.append(actId); Activity* act=NULL; for(int k=0; k<gt.rules.activitiesList.size(); k++){ act=gt.rules.activitiesList[k]; if(act->id==actId) break; } assert(act); this->selectedActivitiesListWidget->addItem(act->getDescription(gt.rules)); } teachersComboBox->addItem(""); for(int i=0; i<gt.rules.teachersList.size(); i++){ Teacher* tch=gt.rules.teachersList[i]; teachersComboBox->addItem(tch->name); } teachersComboBox->setCurrentIndex(0); subjectsComboBox->addItem(""); for(int i=0; i<gt.rules.subjectsList.size(); i++){ Subject* sb=gt.rules.subjectsList[i]; subjectsComboBox->addItem(sb->name); } subjectsComboBox->setCurrentIndex(0); activityTagsComboBox->addItem(""); for(int i=0; i<gt.rules.activityTagsList.size(); i++){ ActivityTag* st=gt.rules.activityTagsList[i]; activityTagsComboBox->addItem(st->name); } activityTagsComboBox->setCurrentIndex(0); studentsComboBox->addItem(""); for(int i=0; i<gt.rules.yearsList.size(); i++){ StudentsYear* sty=gt.rules.yearsList[i]; studentsComboBox->addItem(sty->name); for(int j=0; j<sty->groupsList.size(); j++){ StudentsGroup* stg=sty->groupsList[j]; studentsComboBox->addItem(stg->name); if(SHOW_SUBGROUPS_IN_COMBO_BOXES) for(int k=0; k<stg->subgroupsList.size(); k++){ StudentsSubgroup* sts=stg->subgroupsList[k]; studentsComboBox->addItem(sts->name); } } } studentsComboBox->setCurrentIndex(0); filterChanged(); }
ModifyGroupActivitiesInInitialOrderItemForm::ModifyGroupActivitiesInInitialOrderItemForm(QWidget* parent, GroupActivitiesInInitialOrderItem* item): QDialog(parent) { setupUi(this); okPushButton->setDefault(true); activitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection); selectedActivitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok())); connect(activitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addActivity())); connect(addAllActivitiesPushButton, SIGNAL(clicked()), this, SLOT(addAllActivities())); connect(selectedActivitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeActivity())); connect(teachersComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(studentsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(subjectsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(activityTagsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(clearPushButton, SIGNAL(clicked()), this, SLOT(clear())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp1=teachersComboBox->minimumSizeHint(); Q_UNUSED(tmp1); QSize tmp2=studentsComboBox->minimumSizeHint(); Q_UNUSED(tmp2); QSize tmp3=subjectsComboBox->minimumSizeHint(); Q_UNUSED(tmp3); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); this->_item=item; selectedActivitiesList.clear(); selectedActivitiesListWidget->clear(); for(int i=0; i<item->ids.count(); i++){ int actId=item->ids[i]; this->selectedActivitiesList.append(actId); Activity* act=NULL; for(int k=0; k<gt.rules.activitiesList.size(); k++){ act=gt.rules.activitiesList[k]; if(act->id==actId) break; } assert(act); this->selectedActivitiesListWidget->addItem(act->getDescription(gt.rules)); } //////////////// teachersComboBox->addItem(""); for(int i=0; i<gt.rules.teachersList.size(); i++){ Teacher* tch=gt.rules.teachersList[i]; teachersComboBox->addItem(tch->name); } teachersComboBox->setCurrentIndex(0); subjectsComboBox->addItem(""); for(int i=0; i<gt.rules.subjectsList.size(); i++){ Subject* sb=gt.rules.subjectsList[i]; subjectsComboBox->addItem(sb->name); } subjectsComboBox->setCurrentIndex(0); activityTagsComboBox->addItem(""); for(int i=0; i<gt.rules.activityTagsList.size(); i++){ ActivityTag* st=gt.rules.activityTagsList[i]; activityTagsComboBox->addItem(st->name); } activityTagsComboBox->setCurrentIndex(0); studentsComboBox->addItem(""); for(int i=0; i<gt.rules.yearsList.size(); i++){ StudentsYear* sty=gt.rules.yearsList[i]; studentsComboBox->addItem(sty->name); for(int j=0; j<sty->groupsList.size(); j++){ StudentsGroup* stg=sty->groupsList[j]; studentsComboBox->addItem(stg->name); if(SHOW_SUBGROUPS_IN_COMBO_BOXES) for(int k=0; k<stg->subgroupsList.size(); k++){ StudentsSubgroup* sts=stg->subgroupsList[k]; studentsComboBox->addItem(sts->name); } } } studentsComboBox->setCurrentIndex(0); filterChanged(); }
AddConstraintActivitiesSameStartingDayForm::AddConstraintActivitiesSameStartingDayForm(QWidget* parent): QDialog(parent) { setupUi(this); addConstraintPushButton->setDefault(true); activitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection); simultaneousActivitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint())); connect(teachersComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(studentsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(subjectsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(activityTagsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(clearPushButton, SIGNAL(clicked()), this, SLOT(clear())); connect(activitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addActivity())); connect(addAllActivitiesPushButton, SIGNAL(clicked()), this, SLOT(addAllActivities())); connect(simultaneousActivitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeActivity())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp1=teachersComboBox->minimumSizeHint(); Q_UNUSED(tmp1); QSize tmp2=studentsComboBox->minimumSizeHint(); Q_UNUSED(tmp2); QSize tmp3=subjectsComboBox->minimumSizeHint(); Q_UNUSED(tmp3); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); teachersComboBox->addItem(""); for(int i=0; i<gt.rules.teachersList.size(); i++){ Teacher* tch=gt.rules.teachersList[i]; teachersComboBox->addItem(tch->name); } teachersComboBox->setCurrentIndex(0); subjectsComboBox->addItem(""); for(int i=0; i<gt.rules.subjectsList.size(); i++){ Subject* sb=gt.rules.subjectsList[i]; subjectsComboBox->addItem(sb->name); } subjectsComboBox->setCurrentIndex(0); activityTagsComboBox->addItem(""); for(int i=0; i<gt.rules.activityTagsList.size(); i++){ ActivityTag* st=gt.rules.activityTagsList[i]; activityTagsComboBox->addItem(st->name); } activityTagsComboBox->setCurrentIndex(0); studentsComboBox->addItem(""); for(int i=0; i<gt.rules.yearsList.size(); i++){ StudentsYear* sty=gt.rules.yearsList[i]; studentsComboBox->addItem(sty->name); for(int j=0; j<sty->groupsList.size(); j++){ StudentsGroup* stg=sty->groupsList[j]; studentsComboBox->addItem(stg->name); if(SHOW_SUBGROUPS_IN_COMBO_BOXES) for(int k=0; k<stg->subgroupsList.size(); k++){ StudentsSubgroup* sts=stg->subgroupsList[k]; studentsComboBox->addItem(sts->name); } } } studentsComboBox->setCurrentIndex(0); simultaneousActivitiesListWidget->clear(); this->simultaneousActivitiesList.clear(); updateActivitiesListWidget(); }
AddConstraintActivitiesMaxSimultaneousInSelectedTimeSlotsForm::AddConstraintActivitiesMaxSimultaneousInSelectedTimeSlotsForm(QWidget* parent): QDialog(parent) { setupUi(this); addConstraintPushButton->setDefault(true); allActivitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection); selectedActivitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addCurrentConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(selectedTimesTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(itemClicked(QTableWidgetItem*))); connect(setAllUnselectedPushButton, SIGNAL(clicked()), this, SLOT(setAllUnselected())); connect(setAllSelectedPushButton, SIGNAL(clicked()), this, SLOT(setAllSelected())); connect(allActivitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addActivity())); connect(addAllActivitiesPushButton, SIGNAL(clicked()), this, SLOT(addAllActivities())); connect(selectedActivitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeActivity())); connect(clearPushButton, SIGNAL(clicked()), this, SLOT(clear())); connect(teachersComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(studentsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(subjectsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); connect(activityTagsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); tabWidget->setCurrentIndex(0); maxSimultaneousSpinBox->setMinimum(0); maxSimultaneousSpinBox->setMaximum(MAX_ACTIVITIES); maxSimultaneousSpinBox->setValue(0); selectedTimesTable->setRowCount(gt.rules.nHoursPerDay); selectedTimesTable->setColumnCount(gt.rules.nDaysPerWeek); for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.daysOfTheWeek[j]); selectedTimesTable->setHorizontalHeaderItem(j, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.hoursOfTheDay[i]); selectedTimesTable->setVerticalHeaderItem(i, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(NO); item->setTextAlignment(Qt::AlignCenter); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); colorItem(item); if(SHOW_TOOLTIPS_FOR_CONSTRAINTS_WITH_TABLES) item->setToolTip(gt.rules.daysOfTheWeek[j]+QString("\n")+gt.rules.hoursOfTheDay[i]); selectedTimesTable->setItem(i, j, item); } selectedTimesTable->resizeRowsToContents(); //selectedTimesTable->resizeColumnsToContents(); connect(selectedTimesTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(horizontalHeaderClicked(int))); connect(selectedTimesTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(verticalHeaderClicked(int))); selectedTimesTable->setSelectionMode(QAbstractItemView::NoSelection); tableWidgetUpdateBug(selectedTimesTable); setStretchAvailabilityTableNicely(selectedTimesTable); //activities QSize tmp1=teachersComboBox->minimumSizeHint(); Q_UNUSED(tmp1); QSize tmp2=studentsComboBox->minimumSizeHint(); Q_UNUSED(tmp2); QSize tmp3=subjectsComboBox->minimumSizeHint(); Q_UNUSED(tmp3); QSize tmp4=activityTagsComboBox->minimumSizeHint(); Q_UNUSED(tmp4); teachersComboBox->addItem(""); for(int i=0; i<gt.rules.teachersList.size(); i++){ Teacher* tch=gt.rules.teachersList[i]; teachersComboBox->addItem(tch->name); } teachersComboBox->setCurrentIndex(0); subjectsComboBox->addItem(""); for(int i=0; i<gt.rules.subjectsList.size(); i++){ Subject* sb=gt.rules.subjectsList[i]; subjectsComboBox->addItem(sb->name); } subjectsComboBox->setCurrentIndex(0); activityTagsComboBox->addItem(""); for(int i=0; i<gt.rules.activityTagsList.size(); i++){ ActivityTag* st=gt.rules.activityTagsList[i]; activityTagsComboBox->addItem(st->name); } activityTagsComboBox->setCurrentIndex(0); studentsComboBox->addItem(""); for(int i=0; i<gt.rules.yearsList.size(); i++){ StudentsYear* sty=gt.rules.yearsList[i]; studentsComboBox->addItem(sty->name); for(int j=0; j<sty->groupsList.size(); j++){ StudentsGroup* stg=sty->groupsList[j]; studentsComboBox->addItem(stg->name); if(SHOW_SUBGROUPS_IN_COMBO_BOXES) for(int k=0; k<stg->subgroupsList.size(); k++){ StudentsSubgroup* sts=stg->subgroupsList[k]; studentsComboBox->addItem(sts->name); } } } studentsComboBox->setCurrentIndex(0); selectedActivitiesListWidget->clear(); selectedActivitiesList.clear(); filterChanged(); }