adding exam schedule
This commit is contained in:
parent
a87c5abb2c
commit
f3e65503b8
9 changed files with 250 additions and 220 deletions
|
@ -53,7 +53,8 @@ HEADERS += \
|
||||||
src/jceData/Calendar/calendarDialog.h \
|
src/jceData/Calendar/calendarDialog.h \
|
||||||
src/appDatabase/jce_logger.h \
|
src/appDatabase/jce_logger.h \
|
||||||
src/jceData/Grades/graph/qcustomplot.h \
|
src/jceData/Grades/graph/qcustomplot.h \
|
||||||
src/jceData/Grades/graph/gradegraph.h
|
src/jceData/Grades/graph/gradegraph.h \
|
||||||
|
src/jceData/Calendar/calendarExam.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main/CalendarTab/CalendarManager.cpp \
|
main/CalendarTab/CalendarManager.cpp \
|
||||||
|
@ -76,4 +77,5 @@ SOURCES += \
|
||||||
src/jceData/Calendar/calendarDialog.cpp \
|
src/jceData/Calendar/calendarDialog.cpp \
|
||||||
src/appDatabase/jce_logger.cpp \
|
src/appDatabase/jce_logger.cpp \
|
||||||
src/jceData/Grades/graph/qcustomplot.cpp \
|
src/jceData/Grades/graph/qcustomplot.cpp \
|
||||||
src/jceData/Grades/graph/gradegraph.cpp
|
src/jceData/Grades/graph/gradegraph.cpp \
|
||||||
|
src/jceData/Calendar/calendarExam.cpp
|
||||||
|
|
|
@ -2,49 +2,46 @@
|
||||||
|
|
||||||
coursesTableManager::coursesTableManager(QTableWidget *ptr, user *usrPtr)
|
coursesTableManager::coursesTableManager(QTableWidget *ptr, user *usrPtr)
|
||||||
{
|
{
|
||||||
this->gp = NULL;
|
this->gp = NULL;
|
||||||
this->us = usrPtr;
|
this->us = usrPtr;
|
||||||
this->courseTBL = ptr;
|
this->courseTBL = ptr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initilizing Table
|
* Initilizing Table
|
||||||
*/
|
*/
|
||||||
courseTBL->setRowCount(0);
|
courseTBL->setRowCount(0);
|
||||||
courseTBL->setColumnCount(COURSE_FIELDS);
|
courseTBL->setColumnCount(COURSE_FIELDS);
|
||||||
QStringList mz;
|
QStringList mz;
|
||||||
mz << QObject::tr("Number") << QObject::tr("Year") << QObject::tr("Semester") << QObject::tr("Serial") << QObject::tr("Name") << QObject::tr("Type") << QObject::tr("Points") << QObject::tr("Hours") << QObject::tr("Grade") << QObject::tr("Additions");
|
mz << QObject::tr("Number") << QObject::tr("Year") << QObject::tr("Semester") << QObject::tr("Serial") << QObject::tr("Name") << QObject::tr("Type") << QObject::tr("Points") << QObject::tr("Hours") << QObject::tr("Grade") << QObject::tr("Additions");
|
||||||
courseTBL->setHorizontalHeaderLabels(mz);
|
courseTBL->setHorizontalHeaderLabels(mz);
|
||||||
courseTBL->verticalHeader()->setVisible(false);
|
courseTBL->verticalHeader()->setVisible(false);
|
||||||
courseTBL->setSelectionMode(QAbstractItemView::SingleSelection);
|
courseTBL->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
courseTBL->setShowGrid(true);
|
courseTBL->setShowGrid(true);
|
||||||
courseTBL->setStyleSheet("QTableView {selection-background-color: red;}");
|
courseTBL->setStyleSheet("QTableView {selection-background-color: red;}");
|
||||||
|
|
||||||
/*
|
graph = new gradegraph(NULL);
|
||||||
*
|
|
||||||
*/
|
|
||||||
graph = new gradegraph(NULL,gp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
coursesTableManager::~coursesTableManager()
|
coursesTableManager::~coursesTableManager()
|
||||||
{
|
{
|
||||||
courseTBL = NULL;
|
courseTBL = NULL;
|
||||||
delete gp;
|
delete gp;
|
||||||
gp = NULL;
|
gp = NULL;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief coursesTableManager::insertJceCoursesIntoTable phrasing the course list to rows in table
|
* @brief coursesTableManager::insertJceCoursesIntoTable phrasing the course list to rows in table
|
||||||
*/
|
*/
|
||||||
void coursesTableManager::insertJceCoursesIntoTable()
|
void coursesTableManager::insertJceCoursesIntoTable()
|
||||||
{
|
{
|
||||||
for (gradeCourse *c: *gp->getCourses())
|
for (gradeCourse *c: *gp->getCourses())
|
||||||
{
|
{
|
||||||
if (us->getInfluenceCourseOnly())
|
if (us->getInfluenceCourseOnly())
|
||||||
{
|
{
|
||||||
if (isCourseInfluence(c))
|
if (isCourseInfluence(c))
|
||||||
addRow(c);
|
addRow(c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addRow(c);
|
addRow(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -53,9 +50,9 @@ void coursesTableManager::insertJceCoursesIntoTable()
|
||||||
*/
|
*/
|
||||||
void coursesTableManager::setCoursesList(QString &html)
|
void coursesTableManager::setCoursesList(QString &html)
|
||||||
{
|
{
|
||||||
if (gp != NULL)
|
if (gp != NULL)
|
||||||
gp->~GradePage();
|
gp->~GradePage();
|
||||||
gp = new GradePage(html);
|
gp = new GradePage(html);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief coursesTableManager::changes when user changes the table manually it updates it
|
* @brief coursesTableManager::changes when user changes the table manually it updates it
|
||||||
|
@ -67,81 +64,81 @@ void coursesTableManager::setCoursesList(QString &html)
|
||||||
bool coursesTableManager::changes(QString change, int row, int col)
|
bool coursesTableManager::changes(QString change, int row, int col)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool isNumFlag = true;
|
bool isNumFlag = true;
|
||||||
if (courseTBL->item(row,gradeCourse::CourseScheme::SERIAL) == NULL)
|
if (courseTBL->item(row,gradeCourse::CourseScheme::SERIAL) == NULL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int serialCourse = courseTBL->item(row,gradeCourse::CourseScheme::SERIAL)->text().toInt();
|
int serialCourse = courseTBL->item(row,gradeCourse::CourseScheme::SERIAL)->text().toInt();
|
||||||
for (gradeCourse *c: *gp->getCourses())
|
for (gradeCourse *c: *gp->getCourses())
|
||||||
{
|
{
|
||||||
if (c->getSerialNum() == serialCourse)
|
if (c->getSerialNum() == serialCourse)
|
||||||
{
|
{
|
||||||
switch (col)
|
switch (col)
|
||||||
{
|
{
|
||||||
case (gradeCourse::CourseScheme::COURSE_NUMBER_IN_LIST):
|
case (gradeCourse::CourseScheme::COURSE_NUMBER_IN_LIST):
|
||||||
c->setCourseNumInList(change.toInt());
|
c->setCourseNumInList(change.toInt());
|
||||||
break;
|
break;
|
||||||
case (gradeCourse::CourseScheme::YEAR):
|
case (gradeCourse::CourseScheme::YEAR):
|
||||||
c->setYear(change.toInt());
|
c->setYear(change.toInt());
|
||||||
break;
|
break;
|
||||||
case (gradeCourse::CourseScheme::SEMESTER):
|
case (gradeCourse::CourseScheme::SEMESTER):
|
||||||
c->setSemester(change.toInt());
|
c->setSemester(change.toInt());
|
||||||
break;
|
break;
|
||||||
case (gradeCourse::CourseScheme::NAME):
|
case (gradeCourse::CourseScheme::NAME):
|
||||||
c->setName(change);
|
c->setName(change);
|
||||||
break;
|
break;
|
||||||
case (gradeCourse::CourseScheme::TYPE):
|
case (gradeCourse::CourseScheme::TYPE):
|
||||||
c->setType(change);
|
c->setType(change);
|
||||||
break;
|
break;
|
||||||
case (gradeCourse::CourseScheme::POINTS):
|
case (gradeCourse::CourseScheme::POINTS):
|
||||||
{
|
{
|
||||||
change.toDouble(&isNumFlag);
|
change.toDouble(&isNumFlag);
|
||||||
|
|
||||||
if (!isNumFlag)
|
if (!isNumFlag)
|
||||||
{
|
{
|
||||||
courseTBL->item(row,col)->setText(QString::number(c->getPoints()));
|
courseTBL->item(row,col)->setText(QString::number(c->getPoints()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->setPoints(change.toDouble());
|
c->setPoints(change.toDouble());
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case (gradeCourse::CourseScheme::HOURS):
|
|
||||||
{
|
|
||||||
change.toDouble(&isNumFlag);
|
|
||||||
|
|
||||||
if (!isNumFlag)
|
|
||||||
{
|
|
||||||
courseTBL->item(row,col)->setText(QString::number(c->getHours()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
c->setHours(change.toDouble());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gradeCourse::CourseScheme::GRADE):
|
|
||||||
{
|
|
||||||
change.toDouble(&isNumFlag);
|
|
||||||
|
|
||||||
if (!isNumFlag)
|
|
||||||
{
|
|
||||||
courseTBL->item(row,col)->setText(QString::number(c->getGrade()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((change.toDouble() >= 0) && (change.toDouble() <= 100))
|
|
||||||
c->setGrade(change.toDouble());
|
|
||||||
else
|
|
||||||
courseTBL->item(row,col)->setText(QString::number(c->getGrade()));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gradeCourse::CourseScheme::ADDITION):
|
|
||||||
c->setAdditions(change);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
case (gradeCourse::CourseScheme::HOURS):
|
||||||
|
{
|
||||||
|
change.toDouble(&isNumFlag);
|
||||||
|
|
||||||
|
if (!isNumFlag)
|
||||||
|
{
|
||||||
|
courseTBL->item(row,col)->setText(QString::number(c->getHours()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
c->setHours(change.toDouble());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gradeCourse::CourseScheme::GRADE):
|
||||||
|
{
|
||||||
|
change.toDouble(&isNumFlag);
|
||||||
|
|
||||||
|
if (!isNumFlag)
|
||||||
|
{
|
||||||
|
courseTBL->item(row,col)->setText(QString::number(c->getGrade()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((change.toDouble() >= 0) && (change.toDouble() <= 100))
|
||||||
|
c->setGrade(change.toDouble());
|
||||||
|
else
|
||||||
|
courseTBL->item(row,col)->setText(QString::number(c->getGrade()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gradeCourse::CourseScheme::ADDITION):
|
||||||
|
c->setAdditions(change);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isNumFlag;
|
return isNumFlag;
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -150,163 +147,163 @@ bool coursesTableManager::changes(QString change, int row, int col)
|
||||||
*/
|
*/
|
||||||
void coursesTableManager::addRow(const gradeCourse *courseToAdd)
|
void coursesTableManager::addRow(const gradeCourse *courseToAdd)
|
||||||
{
|
{
|
||||||
int i=1,j=1;
|
int i=1,j=1;
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
QTableWidgetItem *number,*year,*semester,*serial,*name,*type,*points,*hours,*grade,*addition;
|
QTableWidgetItem *number,*year,*semester,*serial,*name,*type,*points,*hours,*grade,*addition;
|
||||||
const gradeCourse * c;
|
const gradeCourse * c;
|
||||||
if (courseToAdd != NULL)
|
if (courseToAdd != NULL)
|
||||||
{
|
{
|
||||||
c = courseToAdd;
|
c = courseToAdd;
|
||||||
if (!isCourseAlreadyInserted(c->getSerialNum()))
|
if (!isCourseAlreadyInserted(c->getSerialNum()))
|
||||||
{
|
{
|
||||||
courseTBL->setRowCount(courseTBL->rowCount() + 1);
|
courseTBL->setRowCount(courseTBL->rowCount() + 1);
|
||||||
i = courseTBL->rowCount()-1;
|
i = courseTBL->rowCount()-1;
|
||||||
|
|
||||||
number = new QTableWidgetItem();
|
number = new QTableWidgetItem();
|
||||||
number->setData(Qt::EditRole, c->getCourseNumInList());
|
number->setData(Qt::EditRole, c->getCourseNumInList());
|
||||||
number->setFlags(number->flags() & ~Qt::ItemIsEditable);
|
number->setFlags(number->flags() & ~Qt::ItemIsEditable);
|
||||||
|
|
||||||
year = new QTableWidgetItem();
|
year = new QTableWidgetItem();
|
||||||
year->setData(Qt::EditRole,c->getYear());
|
year->setData(Qt::EditRole,c->getYear());
|
||||||
year->setFlags(year->flags() & ~Qt::ItemIsEditable);
|
year->setFlags(year->flags() & ~Qt::ItemIsEditable);
|
||||||
|
|
||||||
semester = new QTableWidgetItem();
|
semester = new QTableWidgetItem();
|
||||||
semester->setData(Qt::EditRole,c->getSemester());
|
semester->setData(Qt::EditRole,c->getSemester());
|
||||||
semester->setFlags(semester->flags() & ~Qt::ItemIsEditable);
|
semester->setFlags(semester->flags() & ~Qt::ItemIsEditable);
|
||||||
|
|
||||||
serial = new QTableWidgetItem();
|
serial = new QTableWidgetItem();
|
||||||
serial->setData(Qt::EditRole,c->getSerialNum());
|
serial->setData(Qt::EditRole,c->getSerialNum());
|
||||||
serial->setFlags(serial->flags() & ~Qt::ItemIsEditable);
|
serial->setFlags(serial->flags() & ~Qt::ItemIsEditable);
|
||||||
|
|
||||||
name = new QTableWidgetItem();
|
name = new QTableWidgetItem();
|
||||||
name->setData(Qt::EditRole,c->getName());
|
name->setData(Qt::EditRole,c->getName());
|
||||||
name->setFlags(name->flags() & ~Qt::ItemIsEditable);
|
name->setFlags(name->flags() & ~Qt::ItemIsEditable);
|
||||||
|
|
||||||
type = new QTableWidgetItem();
|
type = new QTableWidgetItem();
|
||||||
type->setData(Qt::EditRole, c->getType());
|
type->setData(Qt::EditRole, c->getType());
|
||||||
type->setFlags(type->flags() & ~Qt::ItemIsEditable);
|
type->setFlags(type->flags() & ~Qt::ItemIsEditable);
|
||||||
|
|
||||||
points = new QTableWidgetItem();
|
points = new QTableWidgetItem();
|
||||||
points->setData(Qt::EditRole, c->getPoints());
|
points->setData(Qt::EditRole, c->getPoints());
|
||||||
points->setFlags(points->flags() & ~Qt::ItemIsEditable);
|
points->setFlags(points->flags() & ~Qt::ItemIsEditable);
|
||||||
|
|
||||||
hours = new QTableWidgetItem();
|
hours = new QTableWidgetItem();
|
||||||
hours->setData(Qt::EditRole, c->getHours());
|
hours->setData(Qt::EditRole, c->getHours());
|
||||||
hours->setFlags(hours->flags() & ~Qt::ItemIsEditable);
|
hours->setFlags(hours->flags() & ~Qt::ItemIsEditable);
|
||||||
|
|
||||||
grade = new QTableWidgetItem();
|
grade = new QTableWidgetItem();
|
||||||
grade->setData(Qt::EditRole,c->getGrade());
|
grade->setData(Qt::EditRole,c->getGrade());
|
||||||
|
|
||||||
addition = new QTableWidgetItem();
|
addition = new QTableWidgetItem();
|
||||||
addition->setData(Qt::EditRole,c->getAddidtions());
|
addition->setData(Qt::EditRole,c->getAddidtions());
|
||||||
|
|
||||||
courseTBL->setItem(i,j++,number);
|
courseTBL->setItem(i,j++,number);
|
||||||
courseTBL->setItem(i,j++,year);
|
courseTBL->setItem(i,j++,year);
|
||||||
courseTBL->setItem(i,j++,semester);
|
courseTBL->setItem(i,j++,semester);
|
||||||
courseTBL->setItem(i,j++,serial);
|
courseTBL->setItem(i,j++,serial);
|
||||||
courseTBL->setItem(i,j++,name);
|
courseTBL->setItem(i,j++,name);
|
||||||
courseTBL->setItem(i,j++,type);
|
courseTBL->setItem(i,j++,type);
|
||||||
courseTBL->setItem(i,j++,points);
|
courseTBL->setItem(i,j++,points);
|
||||||
courseTBL->setItem(i,j++,hours);
|
courseTBL->setItem(i,j++,hours);
|
||||||
courseTBL->setItem(i,j++,grade);
|
courseTBL->setItem(i,j++,grade);
|
||||||
courseTBL->setItem(i,j,addition);
|
courseTBL->setItem(i,j,addition);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qCritical() << Q_FUNC_INFO << "no course to load!";
|
qCritical() << Q_FUNC_INFO << "no course to load!";
|
||||||
}
|
}
|
||||||
courseTBL->resizeColumnsToContents();
|
courseTBL->resizeColumnsToContents();
|
||||||
|
|
||||||
}
|
}
|
||||||
double coursesTableManager::getAvg()
|
double coursesTableManager::getAvg()
|
||||||
{
|
{
|
||||||
if (this->gp != NULL)
|
if (this->gp != NULL)
|
||||||
return gp->getAvg();
|
return gp->getAvg();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void coursesTableManager::showGraph()
|
void coursesTableManager::showGraph()
|
||||||
{
|
{
|
||||||
if (gp != NULL)
|
if (gp != NULL)
|
||||||
{
|
{
|
||||||
this->graph->showGraph(gp);
|
this->graph->showGraph(gp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void coursesTableManager::influnceCourseChanged(bool ignoreCourseStatus)
|
void coursesTableManager::influnceCourseChanged(bool ignoreCourseStatus)
|
||||||
{
|
{
|
||||||
if (ignoreCourseStatus)
|
if (ignoreCourseStatus)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < courseTBL->rowCount())
|
while (i < courseTBL->rowCount())
|
||||||
{
|
{
|
||||||
if (courseTBL->item(i,gradeCourse::CourseScheme::POINTS)->text().compare("0") == 0)
|
if (courseTBL->item(i,gradeCourse::CourseScheme::POINTS)->text().compare("0") == 0)
|
||||||
courseTBL->removeRow(i--);
|
courseTBL->removeRow(i--);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this->gp != NULL)
|
if (this->gp != NULL)
|
||||||
for (gradeCourse *c: *gp->getCourses())
|
for (gradeCourse *c: *gp->getCourses())
|
||||||
{
|
{
|
||||||
if (!(isCourseAlreadyInserted(c->getSerialNum())))
|
if (!(isCourseAlreadyInserted(c->getSerialNum())))
|
||||||
if (c->getPoints() == 0)
|
if (c->getPoints() == 0)
|
||||||
addRow(c);
|
addRow(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void coursesTableManager::clearTable()
|
void coursesTableManager::clearTable()
|
||||||
{
|
{
|
||||||
if (courseTBL->rowCount() == 0)
|
if (courseTBL->rowCount() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int i = 0; //starting point
|
int i = 0; //starting point
|
||||||
while (courseTBL->rowCount() > i)
|
while (courseTBL->rowCount() > i)
|
||||||
{
|
{
|
||||||
gp->removeCourse(courseTBL->item(i,gradeCourse::CourseScheme::SERIAL)->text());
|
gp->removeCourse(courseTBL->item(i,gradeCourse::CourseScheme::SERIAL)->text());
|
||||||
courseTBL->removeRow(i);
|
courseTBL->removeRow(i);
|
||||||
}
|
}
|
||||||
gp = NULL;
|
gp = NULL;
|
||||||
courseTBL->repaint();
|
courseTBL->repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
gradeCourse *coursesTableManager::getCourseByRow(int row)
|
gradeCourse *coursesTableManager::getCourseByRow(int row)
|
||||||
{
|
{
|
||||||
QString courseSerial = courseTBL->item(row,gradeCourse::CourseScheme::SERIAL)->text();
|
QString courseSerial = courseTBL->item(row,gradeCourse::CourseScheme::SERIAL)->text();
|
||||||
for (gradeCourse *c: *gp->getCourses())
|
for (gradeCourse *c: *gp->getCourses())
|
||||||
{
|
{
|
||||||
if (c->getSerialNum() == courseSerial.toDouble())
|
if (c->getSerialNum() == courseSerial.toDouble())
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool coursesTableManager::isCourseAlreadyInserted(double courseID)
|
bool coursesTableManager::isCourseAlreadyInserted(double courseID)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = courseTBL->rowCount(); i >= 0; --i)
|
for (i = courseTBL->rowCount(); i >= 0; --i)
|
||||||
{
|
{
|
||||||
if (courseTBL->item(i,gradeCourse::CourseScheme::SERIAL) != NULL)
|
if (courseTBL->item(i,gradeCourse::CourseScheme::SERIAL) != NULL)
|
||||||
{
|
{
|
||||||
QString courseSerial = courseTBL->item(i,gradeCourse::CourseScheme::SERIAL)->text();
|
QString courseSerial = courseTBL->item(i,gradeCourse::CourseScheme::SERIAL)->text();
|
||||||
if (QString::number(courseID) == courseSerial)
|
if (QString::number(courseID) == courseSerial)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool coursesTableManager::isCourseInfluence(const gradeCourse *courseToCheck)
|
bool coursesTableManager::isCourseInfluence(const gradeCourse *courseToCheck)
|
||||||
{
|
{
|
||||||
if (courseToCheck->getPoints() > 0)
|
if (courseToCheck->getPoints() > 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,48 +2,55 @@
|
||||||
|
|
||||||
calendarCourse::calendarCourse(int serial, QString name, QString type, QString lecturer, double points,
|
calendarCourse::calendarCourse(int serial, QString name, QString type, QString lecturer, double points,
|
||||||
double semesterHours, QString dayAndHour,
|
double semesterHours, QString dayAndHour,
|
||||||
QString room) : Course(serial,name, type,points)
|
QString room, calendarCourse::CourseCalendarType type) : Course(serial,name, type,points)
|
||||||
{
|
{
|
||||||
this->lecturer = lecturer;
|
this->lecturer = lecturer;
|
||||||
this->semesterHours = semesterHours;
|
this->semesterHours = semesterHours;
|
||||||
this->room = room;
|
this->room = room;
|
||||||
setDayAndHour(dayAndHour);
|
setDayAndHour(dayAndHour.type);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief calendarCourse::setDayAndHour
|
* @brief calendarCourse::setDayAndHour
|
||||||
* given a string of time and day - parsing it into day, hour it begins and hour it ends seperated
|
* given a string of time and day - parsing it into day, hour it begins and hour it ends seperated
|
||||||
* @param parse -
|
* @param parse -
|
||||||
*/
|
*/
|
||||||
void calendarCourse::setDayAndHour(QString parse)
|
void calendarCourse::setDayAndHour(QString parse, calendarCourse::CourseCalendarType type)
|
||||||
{
|
{
|
||||||
int ctr = 0;
|
if (type == calendarCourse::CourseCalendarType::CoursesSchedule)
|
||||||
QString temp = "";
|
|
||||||
QTime timetemp;
|
|
||||||
char *tok;
|
|
||||||
char* textToTok = strdup(parse.toStdString().c_str());
|
|
||||||
tok = strtok(textToTok, " -");
|
|
||||||
while(tok != NULL)
|
|
||||||
{
|
{
|
||||||
temp = tok;
|
int ctr = 0;
|
||||||
switch (ctr)
|
QString temp = "";
|
||||||
|
QTime timetemp;
|
||||||
|
char *tok;
|
||||||
|
char* textToTok = strdup(parse.toStdString().c_str());
|
||||||
|
tok = strtok(textToTok, " -");
|
||||||
|
while(tok != NULL)
|
||||||
{
|
{
|
||||||
case 0: //day
|
temp = tok;
|
||||||
setDay(temp);
|
switch (ctr)
|
||||||
break;
|
{
|
||||||
case 1: //hour it begins
|
case 0: //day
|
||||||
timetemp = QTime::fromString(temp,"hh:mm");
|
setDay(temp);
|
||||||
setHourBegin(timetemp.hour());
|
break;
|
||||||
setMinutesBegin(timetemp.minute());
|
case 1: //hour it begins
|
||||||
break;
|
timetemp = QTime::fromString(temp,"hh:mm");
|
||||||
case 2: //hour it ends
|
setHourBegin(timetemp.hour());
|
||||||
timetemp = QTime::fromString(temp,"hh:mm");
|
setMinutesBegin(timetemp.minute());
|
||||||
setHourEnd(timetemp.hour());
|
break;
|
||||||
setMinutesEnd(timetemp.minute());
|
case 2: //hour it ends
|
||||||
break;
|
timetemp = QTime::fromString(temp,"hh:mm");
|
||||||
}
|
setHourEnd(timetemp.hour());
|
||||||
|
setMinutesEnd(timetemp.minute());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctr++;
|
||||||
|
tok = strtok(NULL, " -");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (type == calendarCourse::CourseCalendarType::ExamSchedule)
|
||||||
|
{
|
||||||
|
|
||||||
ctr++;
|
|
||||||
tok = strtok(NULL, " -");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,12 @@
|
||||||
class calendarCourse : public Course
|
class calendarCourse : public Course
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum CourseCalendarType
|
||||||
|
{
|
||||||
|
ExamSchedule,
|
||||||
|
CoursesSchedule
|
||||||
|
};
|
||||||
|
|
||||||
enum CourseScheme
|
enum CourseScheme
|
||||||
{
|
{
|
||||||
SERIAL,
|
SERIAL,
|
||||||
|
@ -21,7 +27,8 @@ public:
|
||||||
ROOM
|
ROOM
|
||||||
};
|
};
|
||||||
calendarCourse(int serial, QString name, QString type, QString lecturer,
|
calendarCourse(int serial, QString name, QString type, QString lecturer,
|
||||||
double points, double semesterHours, QString dayAndHour, QString room);
|
double points, double semesterHours, QString dayAndHour,
|
||||||
|
QString room, calendarCourse::CourseCalendarType type = calendarCourse::CourseCalendarType::CoursesSchedule);
|
||||||
~calendarCourse(){}
|
~calendarCourse(){}
|
||||||
|
|
||||||
int getDay() const;
|
int getDay() const;
|
||||||
|
@ -47,7 +54,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void setDayAndHour(QString parse);
|
void setDayAndHour(QString parse, CourseCalendarType type);
|
||||||
|
|
||||||
QString lecturer;
|
QString lecturer;
|
||||||
double semesterHours;
|
double semesterHours;
|
||||||
|
|
5
src/jceData/Calendar/calendarExam.cpp
Normal file
5
src/jceData/Calendar/calendarExam.cpp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#include "calendarExam.h"
|
||||||
|
|
||||||
|
calendarExam::calendarExam()
|
||||||
|
{
|
||||||
|
}
|
12
src/jceData/Calendar/calendarExam.h
Normal file
12
src/jceData/Calendar/calendarExam.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef CALENDAREXAM_H
|
||||||
|
#define CALENDAREXAM_H
|
||||||
|
|
||||||
|
#include "../page.h"
|
||||||
|
|
||||||
|
class calendarExam : public Page
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
calendarExam();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CALENDAREXAM_H
|
|
@ -28,7 +28,6 @@ private:
|
||||||
QString tempHtml;
|
QString tempHtml;
|
||||||
std::list<calendarCourse*>* courses;
|
std::list<calendarCourse*>* courses;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CALENDARPAGE_H
|
#endif // CALENDARPAGE_H
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#include "gradegraph.h"
|
#include "gradegraph.h"
|
||||||
#include "ui_gradegraph.h"
|
#include "ui_gradegraph.h"
|
||||||
|
|
||||||
gradegraph::gradegraph(QWidget *parent, GradePage *gpPTR) :
|
gradegraph::gradegraph(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::gradegraph)
|
ui(new Ui::gradegraph)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->gp = gpPTR;
|
this->gp = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ void gradegraph::showGraph(GradePage *gpPTR)
|
||||||
setVisualization();
|
setVisualization();
|
||||||
setGraphsData();
|
setGraphsData();
|
||||||
this->show();
|
this->show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gradegraph::~gradegraph()
|
gradegraph::~gradegraph()
|
||||||
|
@ -25,12 +26,12 @@ gradegraph::~gradegraph()
|
||||||
|
|
||||||
void gradegraph::setGraphsData()
|
void gradegraph::setGraphsData()
|
||||||
{
|
{
|
||||||
int minYearInList = gp->getMinYearInList(); //2012
|
int minYearInList = gp->getMinYearInList();
|
||||||
int maxYearInList = gp->getMaxYearInList()+1; //2016
|
int maxYearInList = gp->getMaxYearInList()+1;
|
||||||
int xRangeForYear = (maxYearInList - minYearInList+2)*3; //6*3=18
|
int xRangeForYear = (maxYearInList - minYearInList+2)*3;
|
||||||
QVector<double> SemesterialAvg(xRangeForYear),yearlyAvg(xRangeForYear),sem(xRangeForYear);
|
QVector<double> SemesterialAvg(xRangeForYear),yearlyAvg(xRangeForYear),sem(xRangeForYear);
|
||||||
|
|
||||||
for (int yearCount=0,i=1; i<xRangeForYear; ++i)
|
for (int yearCount=0,i=1; i<xRangeForYear; ++i) //filling data
|
||||||
{
|
{
|
||||||
double lastAvg = 0;
|
double lastAvg = 0;
|
||||||
sem[i] = i;
|
sem[i] = i;
|
||||||
|
@ -137,12 +138,12 @@ void gradegraph::setVisualization()
|
||||||
|
|
||||||
ui->graphwidget->xAxis->setLabel(tr("Years"));
|
ui->graphwidget->xAxis->setLabel(tr("Years"));
|
||||||
ui->graphwidget->xAxis->setAutoTickLabels(false);
|
ui->graphwidget->xAxis->setAutoTickLabels(false);
|
||||||
ui->graphwidget->xAxis->setTickVectorLabels(xStrings);
|
|
||||||
ui->graphwidget->xAxis->setTickLabelFont(QFont(QFont().family(), 7));
|
ui->graphwidget->xAxis->setTickLabelFont(QFont(QFont().family(), 7));
|
||||||
ui->graphwidget->xAxis->setAutoTickStep(false);
|
ui->graphwidget->xAxis->setAutoTickStep(false);
|
||||||
ui->graphwidget->xAxis->setTickStep(1);
|
ui->graphwidget->xAxis->setTickStep(1);
|
||||||
ui->graphwidget->xAxis->setAutoSubTicks(false);
|
ui->graphwidget->xAxis->setAutoSubTicks(false);
|
||||||
ui->graphwidget->xAxis->setSubTickCount(1);
|
ui->graphwidget->xAxis->setSubTickCount(1);
|
||||||
|
ui->graphwidget->xAxis->setTickVectorLabels(xStrings);
|
||||||
ui->graphwidget->xAxis->setRange(1,xRangeForYear);
|
ui->graphwidget->xAxis->setRange(1,xRangeForYear);
|
||||||
|
|
||||||
ui->graphwidget->legend->setVisible(true); //show graph name on top right
|
ui->graphwidget->legend->setVisible(true); //show graph name on top right
|
||||||
|
|
|
@ -14,7 +14,7 @@ class gradegraph : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
gradegraph(QWidget *parent = 0, GradePage *gpPTR = 0);
|
gradegraph(QWidget *parent = 0);
|
||||||
void showGraph(GradePage *gpPTR);
|
void showGraph(GradePage *gpPTR);
|
||||||
~gradegraph();
|
~gradegraph();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue