Conflicts:
	main/CourseTab/coursestablemanager.cpp
This commit is contained in:
liranbg 2014-10-08 00:50:02 +03:00
commit 5a287a25ef
3 changed files with 64 additions and 47 deletions

View file

@ -157,57 +157,74 @@ void coursesTableManager::addRow(const gradeCourse *courseToAdd)
c = courseToAdd;
if (!isCourseAlreadyInserted(c->getSerialNum()))
{
courseTBL->setRowCount(courseTBL->rowCount() + 1);
i = courseTBL->rowCount()-1;
courseTBL->setRowCount(courseTBL->rowCount() + 1);
i = courseTBL->rowCount()-1;
number = new QTableWidgetItem();
number->setData(Qt::EditRole, c->getCourseNumInList());
number->setFlags(number->flags() & ~Qt::ItemIsEditable);
number = new QTableWidgetItem();
number->setData(Qt::EditRole, c->getCourseNumInList());
number->setFlags(number->flags() & ~Qt::ItemIsEditable);
year = new QTableWidgetItem();
year->setData(Qt::EditRole,c->getYear());
year->setFlags(year->flags() & ~Qt::ItemIsEditable);
year = new QTableWidgetItem();
year->setData(Qt::EditRole,c->getYear());
year->setFlags(year->flags() & ~Qt::ItemIsEditable);
semester = new QTableWidgetItem();
semester->setData(Qt::EditRole,c->getSemester());
semester->setFlags(semester->flags() & ~Qt::ItemIsEditable);
semester = new QTableWidgetItem();
semester->setData(Qt::EditRole,c->getSemester());
semester->setFlags(semester->flags() & ~Qt::ItemIsEditable);
serial = new QTableWidgetItem();
serial->setData(Qt::EditRole,c->getSerialNum());
serial->setFlags(serial->flags() & ~Qt::ItemIsEditable);
serial = new QTableWidgetItem();
serial->setData(Qt::EditRole,c->getSerialNum());
serial->setFlags(serial->flags() & ~Qt::ItemIsEditable);
name = new QTableWidgetItem();
name->setData(Qt::EditRole,c->getName());
name->setFlags(name->flags() & ~Qt::ItemIsEditable);
name = new QTableWidgetItem();
name->setData(Qt::EditRole,c->getName());
name->setFlags(name->flags() & ~Qt::ItemIsEditable);
type = new QTableWidgetItem();
type->setData(Qt::EditRole, c->getType());
type->setFlags(type->flags() & ~Qt::ItemIsEditable);
type = new QTableWidgetItem();
type->setData(Qt::EditRole, c->getType());
type->setFlags(type->flags() & ~Qt::ItemIsEditable);
points = new QTableWidgetItem();
points->setData(Qt::EditRole, c->getPoints());
points->setFlags(points->flags() & ~Qt::ItemIsEditable);
points = new QTableWidgetItem();
points->setData(Qt::EditRole, c->getPoints());
points->setFlags(points->flags() & ~Qt::ItemIsEditable);
hours = new QTableWidgetItem();
hours->setData(Qt::EditRole, c->getHours());
hours->setFlags(hours->flags() & ~Qt::ItemIsEditable);
hours = new QTableWidgetItem();
hours->setData(Qt::EditRole, c->getHours());
hours->setFlags(hours->flags() & ~Qt::ItemIsEditable);
grade = new QTableWidgetItem();
grade->setData(Qt::EditRole,c->getGrade());
grade = new QTableWidgetItem();
grade->setData(Qt::EditRole,c->getGrade());
addition = new QTableWidgetItem();
addition->setData(Qt::EditRole,c->getAddidtions());
addition = new QTableWidgetItem();
addition->setData(Qt::EditRole,c->getAddidtions());
courseTBL->setItem(i,j++,number);
courseTBL->setItem(i,j++,year);
courseTBL->setItem(i,j++,semester);
courseTBL->setItem(i,j++,serial);
courseTBL->setItem(i,j++,name);
courseTBL->setItem(i,j++,type);
courseTBL->setItem(i,j++,points);
courseTBL->setItem(i,j++,hours);
courseTBL->setItem(i,j++,grade);
courseTBL->setItem(i,j,addition);
courseTBL->setItem(i,j++,number);
courseTBL->setItem(i,j++,year);
courseTBL->setItem(i,j++,semester);
courseTBL->setItem(i,j++,serial);
courseTBL->setItem(i,j++,name);
courseTBL->setItem(i,j++,type);
courseTBL->setItem(i,j++,points);
courseTBL->setItem(i,j++,hours);
courseTBL->setItem(i,j,grade);
if(c->getGrade() < 55 && c->getGrade() != 0)
{
courseTBL->item(i, j)->setBackground(Qt::darkRed);
courseTBL->item(i,j)->setTextColor(Qt::white);
}
else if(55 <= c->getGrade() && c->getGrade() < 70 )
{
courseTBL->item(i, j)->setBackground(Qt::darkYellow);
courseTBL->item(i,j)->setTextColor(Qt::white);
}
// else if(70 < c->getGrade() && c->getGrade() <= 80 )
// courseTBL->item(i, j)->setBackground(Qt::darkGreen); //They Look Bad!!
// else if(c->getGrade() > 80)
// courseTBL->item(i, j)->setBackground(Qt::green);
j++;
courseTBL->setItem(i,j,addition);
}
}

View file

@ -2,21 +2,21 @@
calendarCourse::calendarCourse(int serial, QString name, QString type, QString lecturer, double points,
double semesterHours, QString dayAndHour,
QString room, calendarCourse::CourseCalendarType type) : Course(serial,name, type,points)
QString room, calendarCourse::CourseCalendarType courseType) : Course(serial,name, type,points)
{
this->lecturer = lecturer;
this->semesterHours = semesterHours;
this->room = room;
setDayAndHour(dayAndHour.type);
setDayAndHour(dayAndHour,courseType);
}
/**
* @brief calendarCourse::setDayAndHour
* given a string of time and day - parsing it into day, hour it begins and hour it ends seperated
* @param parse -
*/
void calendarCourse::setDayAndHour(QString parse, calendarCourse::CourseCalendarType type)
void calendarCourse::setDayAndHour(QString parse, calendarCourse::CourseCalendarType courseType)
{
if (type == calendarCourse::CourseCalendarType::CoursesSchedule)
if (courseType == calendarCourse::CourseCalendarType::CoursesSchedule)
{
int ctr = 0;
QString temp = "";
@ -48,7 +48,7 @@ void calendarCourse::setDayAndHour(QString parse, calendarCourse::CourseCalendar
tok = strtok(NULL, " -");
}
}
if (type == calendarCourse::CourseCalendarType::ExamSchedule)
if (courseType == calendarCourse::CourseCalendarType::ExamSchedule)
{
}

View file

@ -28,7 +28,7 @@ public:
};
calendarCourse(int serial, QString name, QString type, QString lecturer,
double points, double semesterHours, QString dayAndHour,
QString room, calendarCourse::CourseCalendarType type = calendarCourse::CourseCalendarType::CoursesSchedule);
QString room, calendarCourse::CourseCalendarType courseType = calendarCourse::CourseCalendarType::CoursesSchedule);
~calendarCourse(){}
int getDay() const;
@ -54,7 +54,7 @@ public:
private:
void setDayAndHour(QString parse, CourseCalendarType type);
void setDayAndHour(QString parse, CourseCalendarType courseType);
QString lecturer;
double semesterHours;