AddConstraintActivitiesPreferredStartingTimesForm::AddConstraintActivitiesPreferredStartingTimesForm(QWidget* parent): QDialog(parent) { setupUi(this); addConstraintPushButton->setDefault(true); connect(preferredTimesTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(itemClicked(QTableWidgetItem*))); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(setAllAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsAllowed())); connect(setAllNotAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsNotAllowed())); 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); updateTeachersComboBox(); updateStudentsComboBox(); updateSubjectsComboBox(); updateActivityTagsComboBox(); preferredTimesTable->setRowCount(gt.rules.nHoursPerDay); preferredTimesTable->setColumnCount(gt.rules.nDaysPerWeek); for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.daysOfTheWeek[j]); preferredTimesTable->setHorizontalHeaderItem(j, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.hoursOfTheDay[i]); preferredTimesTable->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(YES); item->setTextAlignment(Qt::AlignCenter); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); colorItem(item); preferredTimesTable->setItem(i, j, item); } preferredTimesTable->resizeRowsToContents(); connect(preferredTimesTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(horizontalHeaderClicked(int))); connect(preferredTimesTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(verticalHeaderClicked(int))); preferredTimesTable->setSelectionMode(QAbstractItemView::NoSelection); tableWidgetUpdateBug(preferredTimesTable); setStretchAvailabilityTableNicely(preferredTimesTable); }
void AddConstraintActivitiesPreferredStartingTimesForm::verticalHeaderClicked(int row) { if(row>=0 && row<gt.rules.nHoursPerDay){ QString s=preferredTimesTable->item(row, 0)->text(); if(s==YES) s=NO; else{ assert(s==NO); s=YES; } for(int col=0; col<gt.rules.nDaysPerWeek; col++){ /*QString s=notAllowedTimesTable->text(row, col); if(s==YES) s=NO; else{ assert(s==NO); s=YES; }*/ preferredTimesTable->item(row, col)->setText(s); colorItem(preferredTimesTable->item(row, col)); } tableWidgetUpdateBug(preferredTimesTable); } }
void AddConstraintActivitiesPreferredTimeSlotsForm::horizontalHeaderClicked(int col) { if(col>=0 && col<gt.rules.nDaysPerWeek){ QString s=preferredTimesTable->item(0, col)->text(); if(s==YES) s=NO; else{ assert(s==NO); s=YES; } for(int row=0; row<gt.rules.nHoursPerDay; row++){ /*QString s=notAllowedTimesTable->text(row, col); if(s==YES) s=NO; else{ assert(s==NO); s=YES; }*/ preferredTimesTable->item(row, col)->setText(s); colorItem(preferredTimesTable->item(row, col)); } tableWidgetUpdateBug(preferredTimesTable); } }
void ModifyConstraintRoomNotAvailableTimesForm::setAllNotAvailable() { for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++){ notAllowedTimesTable->item(i, j)->setText(YES); colorItem(notAllowedTimesTable->item(i,j)); } tableWidgetUpdateBug(notAllowedTimesTable); }
void AddConstraintStudentsSetNotAvailableTimesForm::setAllAvailable() { for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++){ notAllowedTimesTable->item(i, j)->setText(NO); colorItem(notAllowedTimesTable->item(i,j)); } tableWidgetUpdateBug(notAllowedTimesTable); }
void ModifyConstraintSubactivitiesPreferredStartingTimesForm::setAllSlotsNotAllowed() { for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++){ preferredTimesTable->item(i, j)->setText(NO); colorItem(preferredTimesTable->item(i,j)); } tableWidgetUpdateBug(preferredTimesTable); }
void ModifyConstraintActivitiesMaxSimultaneousInSelectedTimeSlotsForm::setAllSelected() { for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++){ selectedTimesTable->item(i, j)->setText(YES); colorItem(selectedTimesTable->item(i,j)); } tableWidgetUpdateBug(selectedTimesTable); }
void ModifyConstraintActivityPreferredTimeSlotsForm::setAllSlotsAllowed() { for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++){ preferredTimesTable->item(i, j)->setText(YES); colorItem(preferredTimesTable->item(i,j)); } tableWidgetUpdateBug(preferredTimesTable); }
AddConstraintTeacherNotAvailableTimesForm::AddConstraintTeacherNotAvailableTimesForm(QWidget* parent): QDialog(parent) { setupUi(this); addConstraintPushButton->setDefault(true); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addCurrentConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); connect(notAllowedTimesTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(itemClicked(QTableWidgetItem*))); connect(pushButton5, SIGNAL(clicked()), this, SLOT(help())); connect(setAllAvailablePushButton, SIGNAL(clicked()), this, SLOT(setAllAvailable())); connect(setAllNotAvailablePushButton, SIGNAL(clicked()), this, SLOT(setAllNotAvailable())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp1=teachersComboBox->minimumSizeHint(); Q_UNUSED(tmp1); updateTeachersComboBox(); notAllowedTimesTable->setRowCount(gt.rules.nHoursPerDay); notAllowedTimesTable->setColumnCount(gt.rules.nDaysPerWeek); for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.daysOfTheWeek[j]); notAllowedTimesTable->setHorizontalHeaderItem(j, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.hoursOfTheDay[i]); notAllowedTimesTable->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]); notAllowedTimesTable->setItem(i, j, item); } notAllowedTimesTable->resizeRowsToContents(); connect(notAllowedTimesTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(horizontalHeaderClicked(int))); connect(notAllowedTimesTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(verticalHeaderClicked(int))); notAllowedTimesTable->setSelectionMode(QAbstractItemView::NoSelection); tableWidgetUpdateBug(notAllowedTimesTable); setStretchAvailabilityTableNicely(notAllowedTimesTable); }
void AddConstraintStudentsSetNotAvailableTimesForm::itemClicked(QTableWidgetItem* item) { QString s=item->text(); if(s==YES) s=NO; else{ assert(s==NO); s=YES; } item->setText(s); colorItem(item); tableWidgetUpdateBug(notAllowedTimesTable); }
void ModifyConstraintActivitiesMaxSimultaneousInSelectedTimeSlotsForm::itemClicked(QTableWidgetItem* item) { QString s=item->text(); if(s==YES) s=NO; else{ assert(s==NO); s=YES; } item->setText(s); colorItem(item); tableWidgetUpdateBug(selectedTimesTable); }
void ModifyConstraintSubactivitiesPreferredStartingTimesForm::itemClicked(QTableWidgetItem* item) { QString s=item->text(); if(s==YES) s=NO; else{ assert(s==NO); s=YES; } item->setText(s); colorItem(item); tableWidgetUpdateBug(preferredTimesTable); }
void AddConstraintActivityPreferredTimeSlotsForm::itemClicked(QTableWidgetItem* item) { QString s=item->text(); if(s==YES) s=NO; else{ assert(s==NO); s=YES; } item->setText(s); colorItem(item); tableWidgetUpdateBug(preferredTimesTable); }
void ModifyConstraintRoomNotAvailableTimesForm::verticalHeaderClicked(int row) { if(row>=0 && row<gt.rules.nHoursPerDay){ QString s=notAllowedTimesTable->item(row, 0)->text(); if(s==YES) s=NO; else{ assert(s==NO); s=YES; } for(int col=0; col<gt.rules.nDaysPerWeek; col++){ notAllowedTimesTable->item(row, col)->setText(s); colorItem(notAllowedTimesTable->item(row,col)); } tableWidgetUpdateBug(notAllowedTimesTable); } }
void AddConstraintTeacherNotAvailableTimesForm::horizontalHeaderClicked(int col) { if(col>=0 && col<gt.rules.nDaysPerWeek){ QString s=notAllowedTimesTable->item(0, col)->text(); if(s==YES) s=NO; else{ assert(s==NO); s=YES; } for(int row=0; row<gt.rules.nHoursPerDay; row++){ notAllowedTimesTable->item(row, col)->setText(s); colorItem(notAllowedTimesTable->item(row,col)); } tableWidgetUpdateBug(notAllowedTimesTable); } }
void ModifyConstraintActivitiesMaxSimultaneousInSelectedTimeSlotsForm::verticalHeaderClicked(int row) { if(row>=0 && row<gt.rules.nHoursPerDay){ QString s=selectedTimesTable->item(row, 0)->text(); if(s==YES) s=NO; else{ assert(s==NO); s=YES; } for(int col=0; col<gt.rules.nDaysPerWeek; col++){ selectedTimesTable->item(row, col)->setText(s); colorItem(selectedTimesTable->item(row,col)); } tableWidgetUpdateBug(selectedTimesTable); } }
void AddConstraintActivitiesMaxSimultaneousInSelectedTimeSlotsForm::horizontalHeaderClicked(int col) { if(col>=0 && col<gt.rules.nDaysPerWeek){ QString s=selectedTimesTable->item(0, col)->text(); if(s==YES) s=NO; else{ assert(s==NO); s=YES; } for(int row=0; row<gt.rules.nHoursPerDay; row++){ selectedTimesTable->item(row, col)->setText(s); colorItem(selectedTimesTable->item(row,col)); } tableWidgetUpdateBug(selectedTimesTable); } }
ModifyConstraintSubactivitiesPreferredStartingTimesForm::ModifyConstraintSubactivitiesPreferredStartingTimesForm(QWidget* parent, ConstraintSubactivitiesPreferredStartingTimes* ctr): QDialog(parent) { setupUi(this); okPushButton->setDefault(true); connect(preferredTimesTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(itemClicked(QTableWidgetItem*))); connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok())); connect(setAllAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsAllowed())); connect(setAllNotAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsNotAllowed())); 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; updateTeachersComboBox(); updateStudentsComboBox(parent); updateSubjectsComboBox(); updateActivityTagsComboBox(); componentNumberSpinBox->setMinimum(1); componentNumberSpinBox->setMaximum(MAX_SPLIT_OF_AN_ACTIVITY); componentNumberSpinBox->setValue(this->_ctr->componentNumber); preferredTimesTable->setRowCount(gt.rules.nHoursPerDay); preferredTimesTable->setColumnCount(gt.rules.nDaysPerWeek); for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.daysOfTheWeek[j]); preferredTimesTable->setHorizontalHeaderItem(j, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.hoursOfTheDay[i]); preferredTimesTable->setVerticalHeaderItem(i, item); } Matrix2D<bool> currentMatrix; currentMatrix.resize(gt.rules.nHoursPerDay, gt.rules.nDaysPerWeek); //bool currentMatrix[MAX_HOURS_PER_DAY][MAX_DAYS_PER_WEEK]; for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++) currentMatrix[i][j]=false; for(int k=0; k<ctr->nPreferredStartingTimes_L; k++){ if(ctr->hours_L[k]==-1 || ctr->days_L[k]==-1) assert(0); int i=ctr->hours_L[k]; int j=ctr->days_L[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); preferredTimesTable->setItem(i, j, item); if(!currentMatrix[i][j]) item->setText(NO); else item->setText(YES); colorItem(item); } preferredTimesTable->resizeRowsToContents(); weightLineEdit->setText(CustomFETString::number(ctr->weightPercentage)); connect(preferredTimesTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(horizontalHeaderClicked(int))); connect(preferredTimesTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(verticalHeaderClicked(int))); preferredTimesTable->setSelectionMode(QAbstractItemView::NoSelection); tableWidgetUpdateBug(preferredTimesTable); setStretchAvailabilityTableNicely(preferredTimesTable); }
AddConstraintActivityPreferredTimeSlotsForm::AddConstraintActivityPreferredTimeSlotsForm(QWidget* parent): QDialog(parent) { setupUi(this); addConstraintPushButton->setDefault(true); connect(preferredTimesTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(itemClicked(QTableWidgetItem*))); connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint())); connect(closePushButton, SIGNAL(clicked()), this, SLOT(close())); 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(setAllAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsAllowed())); connect(setAllNotAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsNotAllowed())); 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); QSize tmp5=activitiesComboBox->minimumSizeHint(); Q_UNUSED(tmp5); activitiesComboBox->setMaximumWidth(maxRecommendedWidth(this)); 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); updateActivitiesComboBox(); preferredTimesTable->setRowCount(gt.rules.nHoursPerDay); preferredTimesTable->setColumnCount(gt.rules.nDaysPerWeek); for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.daysOfTheWeek[j]); preferredTimesTable->setHorizontalHeaderItem(j, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.hoursOfTheDay[i]); preferredTimesTable->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(YES); 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]); preferredTimesTable->setItem(i, j, item); } preferredTimesTable->resizeRowsToContents(); connect(preferredTimesTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(horizontalHeaderClicked(int))); connect(preferredTimesTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(verticalHeaderClicked(int))); preferredTimesTable->setSelectionMode(QAbstractItemView::NoSelection); tableWidgetUpdateBug(preferredTimesTable); setStretchAvailabilityTableNicely(preferredTimesTable); }
ModifyConstraintActivityPreferredTimeSlotsForm::ModifyConstraintActivityPreferredTimeSlotsForm(QWidget* parent, ConstraintActivityPreferredTimeSlots* ctr): QDialog(parent) { setupUi(this); okPushButton->setDefault(true); connect(preferredTimesTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(itemClicked(QTableWidgetItem*))); connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok())); connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel())); 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(setAllAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsAllowed())); connect(setAllNotAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsNotAllowed())); 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); QSize tmp5=activitiesComboBox->minimumSizeHint(); Q_UNUSED(tmp5); activitiesComboBox->setMaximumWidth(maxRecommendedWidth(this)); this->_ctr=ctr; 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); 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); updateActivitiesComboBox(); preferredTimesTable->setRowCount(gt.rules.nHoursPerDay); preferredTimesTable->setColumnCount(gt.rules.nDaysPerWeek); for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.daysOfTheWeek[j]); preferredTimesTable->setHorizontalHeaderItem(j, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.hoursOfTheDay[i]); preferredTimesTable->setVerticalHeaderItem(i, item); } Matrix2D<bool> currentMatrix; currentMatrix.resize(gt.rules.nHoursPerDay, gt.rules.nDaysPerWeek); //bool currentMatrix[MAX_HOURS_PER_DAY][MAX_DAYS_PER_WEEK]; for(int i=0; i<gt.rules.nHoursPerDay; i++) for(int j=0; j<gt.rules.nDaysPerWeek; j++) currentMatrix[i][j]=false; for(int k=0; k<ctr->p_nPreferredTimeSlots_L; k++){ if(ctr->p_days_L[k]==-1 || ctr->p_hours_L[k]==-1) assert(0); int i=ctr->p_hours_L[k]; int j=ctr->p_days_L[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]); preferredTimesTable->setItem(i, j, item); if(!currentMatrix[i][j]) item->setText(NO); else item->setText(YES); colorItem(item); } preferredTimesTable->resizeRowsToContents(); connect(preferredTimesTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(horizontalHeaderClicked(int))); connect(preferredTimesTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(verticalHeaderClicked(int))); preferredTimesTable->setSelectionMode(QAbstractItemView::NoSelection); tableWidgetUpdateBug(preferredTimesTable); setStretchAvailabilityTableNicely(preferredTimesTable); }
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(); }
ModifyConstraintRoomNotAvailableTimesForm::ModifyConstraintRoomNotAvailableTimesForm(QWidget* parent, ConstraintRoomNotAvailableTimes* ctr): QDialog(parent) { setupUi(this); okPushButton->setDefault(true); connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok())); connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(notAllowedTimesTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(itemClicked(QTableWidgetItem*))); connect(setAllAvailablePushButton, SIGNAL(clicked()), this, SLOT(setAllAvailable())); connect(setAllNotAvailablePushButton, SIGNAL(clicked()), this, SLOT(setAllNotAvailable())); centerWidgetOnScreen(this); restoreFETDialogGeometry(this); QSize tmp5=roomsComboBox->minimumSizeHint(); Q_UNUSED(tmp5); this->_ctr=ctr; weightLineEdit->setText(CustomFETString::number(ctr->weightPercentage)); updateRoomsComboBox(); notAllowedTimesTable->setRowCount(gt.rules.nHoursPerDay); notAllowedTimesTable->setColumnCount(gt.rules.nDaysPerWeek); for(int j=0; j<gt.rules.nDaysPerWeek; j++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.daysOfTheWeek[j]); notAllowedTimesTable->setHorizontalHeaderItem(j, item); } for(int i=0; i<gt.rules.nHoursPerDay; i++){ QTableWidgetItem* item=new QTableWidgetItem(gt.rules.hoursOfTheDay[i]); notAllowedTimesTable->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->days.count()==ctr->hours.count()); for(int k=0; k<ctr->days.count(); k++){ if(ctr->hours.at(k)==-1 || ctr->days.at(k)==-1) assert(0); int i=ctr->hours.at(k); int j=ctr->days.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]); notAllowedTimesTable->setItem(i, j, item); if(!currentMatrix[i][j]) item->setText(NO); else item->setText(YES); colorItem(item); } notAllowedTimesTable->resizeRowsToContents(); connect(notAllowedTimesTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(horizontalHeaderClicked(int))); connect(notAllowedTimesTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(verticalHeaderClicked(int))); notAllowedTimesTable->setSelectionMode(QAbstractItemView::NoSelection); tableWidgetUpdateBug(notAllowedTimesTable); setStretchAvailabilityTableNicely(notAllowedTimesTable); }