documentation
This commit is contained in:
parent
8d5385f99e
commit
96751b6945
7 changed files with 145 additions and 126 deletions
|
@ -150,7 +150,7 @@ QString CSV_Exporter::makeLine(QString name, QDate *date, int startH, int startM
|
||||||
QString start;
|
QString start;
|
||||||
start.append(QString::number(startH));
|
start.append(QString::number(startH));
|
||||||
start.append(":00");
|
start.append(":00");
|
||||||
// start.append(QString::number(startM));
|
// start.append(QString::number(startM));
|
||||||
start.append(":00");
|
start.append(":00");
|
||||||
|
|
||||||
QString end;
|
QString end;
|
||||||
|
@ -172,7 +172,7 @@ QString CSV_Exporter::makeLine(QString name, QDate *date, int startH, int startM
|
||||||
description.append("טרם נקבע מיקום");
|
description.append("טרם נקבע מיקום");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
description.append(" ב");
|
description.append(" ב");
|
||||||
description.append(room);
|
description.append(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,24 +71,24 @@ calendarExamCourse *calendarExam::lineToCourse(QString line)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
serial = templinearray[calendarExamCourse::ExamScheme::SERIAL].toInt();
|
serial = templinearray[calendarExamCourse::CourseScheme::SERIAL].toInt();
|
||||||
name = templinearray[calendarExamCourse::ExamScheme::NAME];
|
name = templinearray[calendarExamCourse::CourseScheme::NAME];
|
||||||
|
|
||||||
lecturer = templinearray[calendarExamCourse::ExamScheme::LECTURER];
|
lecturer = templinearray[calendarExamCourse::CourseScheme::LECTURER];
|
||||||
if (lecturer.isEmpty())
|
if (lecturer.isEmpty())
|
||||||
lecturer = LECTURER_DEFAULT_STRING;
|
lecturer = LECTURER_DEFAULT_STRING;
|
||||||
|
|
||||||
field = templinearray[calendarExamCourse::ExamScheme::FIELD];
|
field = templinearray[calendarExamCourse::CourseScheme::FIELD];
|
||||||
type = templinearray[calendarExamCourse::ExamScheme::TYPE];
|
type = templinearray[calendarExamCourse::CourseScheme::TYPE];
|
||||||
|
|
||||||
firstDate = templinearray[calendarExamCourse::ExamScheme::FIRST_DATE];
|
firstDate = templinearray[calendarExamCourse::CourseScheme::FIRST_DATE];
|
||||||
if (firstDate.isEmpty())
|
if (firstDate.isEmpty())
|
||||||
return NULL; //can't set a default date to an exam. must be an error
|
return NULL; //can't set a default date to an exam. must be an error
|
||||||
|
|
||||||
firstHourbegin = templinearray[calendarExamCourse::ExamScheme::FIRST_HOUR_BEGIN];
|
firstHourbegin = templinearray[calendarExamCourse::CourseScheme::FIRST_HOUR_BEGIN];
|
||||||
if (firstHourbegin.isEmpty())
|
if (firstHourbegin.isEmpty())
|
||||||
firstHourbegin = HOUR_DEFAULT_STRING;
|
firstHourbegin = HOUR_DEFAULT_STRING;
|
||||||
secondDate = templinearray[calendarExamCourse::ExamScheme::SECOND_DATE];
|
secondDate = templinearray[calendarExamCourse::CourseScheme::SECOND_DATE];
|
||||||
if (secondDate.isEmpty())
|
if (secondDate.isEmpty())
|
||||||
{
|
{
|
||||||
secondDate = SECOND_DATE_DEFAULT_STRING;
|
secondDate = SECOND_DATE_DEFAULT_STRING;
|
||||||
|
@ -96,7 +96,7 @@ calendarExamCourse *calendarExam::lineToCourse(QString line)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
secondHourbegin = templinearray[calendarExamCourse::ExamScheme::SECOND_HOUR_BEGIN];
|
secondHourbegin = templinearray[calendarExamCourse::CourseScheme::SECOND_HOUR_BEGIN];
|
||||||
if (secondHourbegin.isEmpty())
|
if (secondHourbegin.isEmpty())
|
||||||
secondHourbegin = HOUR_DEFAULT_STRING;
|
secondHourbegin = HOUR_DEFAULT_STRING;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* @brief The calendarExamCourse class
|
* @brief The calendarExamCourse class
|
||||||
*
|
*
|
||||||
* This class holds each exam course
|
* This class holds each exam course
|
||||||
* the course scheme can be found below, inside the enum ExamScheme
|
* the course scheme can be found below, inside the enum CourseScheme
|
||||||
*
|
*
|
||||||
* The class's constructor gets the data and manipulate it into an object
|
* The class's constructor gets the data and manipulate it into an object
|
||||||
* with its relevant information.
|
* with its relevant information.
|
||||||
|
@ -29,7 +29,7 @@ class calendarExamCourse : public Course
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum ExamScheme
|
enum CourseScheme
|
||||||
{
|
{
|
||||||
SERIAL,
|
SERIAL,
|
||||||
NAME,
|
NAME,
|
||||||
|
|
|
@ -15,6 +15,7 @@ gradeCourse::~gradeCourse()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double gradeCourse::getGrade() const
|
double gradeCourse::getGrade() const
|
||||||
{
|
{
|
||||||
double noGrade = NO_GRADE_YET;
|
double noGrade = NO_GRADE_YET;
|
||||||
|
|
|
@ -1,18 +1,25 @@
|
||||||
#ifndef GRADE_COURSE_H
|
#ifndef GRADE_COURSE_H
|
||||||
#define GRADE_COURSE_H
|
#define GRADE_COURSE_H
|
||||||
|
|
||||||
/* This Code Made By Sagi Dayan
|
|
||||||
* SagiDayan@gmail.com
|
|
||||||
*
|
|
||||||
* Minor changes has been made by Liran Ben Gida
|
|
||||||
* LiranBG@gmail.com
|
|
||||||
*/
|
|
||||||
#include "../course.h"
|
#include "../course.h"
|
||||||
|
|
||||||
#define COURSE_FIELDS 10
|
#define COURSE_FIELDS 10
|
||||||
#define NO_GRADE_YET 101;
|
#define NO_GRADE_YET 101;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The gradeCourse class
|
||||||
|
*
|
||||||
|
* This class holds a list of course in GPA
|
||||||
|
* the course scheme can be found below, inside the enum CourseScheme
|
||||||
|
*
|
||||||
|
* The class's constructor gets the data and manipulate it into an object
|
||||||
|
* with its relevant information.
|
||||||
|
*
|
||||||
|
* Made By:
|
||||||
|
* Sagi Dayan, SagiDayan@gmail.com
|
||||||
|
* Liran Ben Gida, LiranBG@gmail.com
|
||||||
|
* On 31/8/2014
|
||||||
|
*/
|
||||||
class gradeCourse : public Course {
|
class gradeCourse : public Course {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -13,35 +13,46 @@
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The GradePage class
|
||||||
|
*
|
||||||
|
* This class generating html string to a list of gradeCourse
|
||||||
|
* Each item in a list is a course with its information (grade, points, name, serial and etc)
|
||||||
|
*
|
||||||
|
* Made By:
|
||||||
|
* Sagi Dayan, SagiDayan@gmail.com
|
||||||
|
* Liran Ben Gida, LiranBG@gmail.com
|
||||||
|
* On 31/8/2014
|
||||||
|
*/
|
||||||
class GradePage : public Page
|
class GradePage : public Page
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GradePage(QString html);
|
GradePage(QString html);
|
||||||
~GradePage();
|
~GradePage();
|
||||||
|
|
||||||
void removeCourse(QString courseSerialID);
|
void removeCourse(QString courseSerialID);
|
||||||
|
|
||||||
double getAvg();
|
double getAvg();
|
||||||
double getAvg(int year);
|
double getAvg(int year);
|
||||||
double getAvg(int year, int semester);
|
double getAvg(int year, int semester);
|
||||||
|
|
||||||
int getMinYearInList();
|
int getMinYearInList();
|
||||||
int getMaxYearInList();
|
int getMaxYearInList();
|
||||||
|
|
||||||
|
|
||||||
QList<gradeCourse*> getCourses() { return courses; }
|
QList<gradeCourse*> getCourses() { return courses; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void coursesListInit(QString &linesTokinzedString);
|
void coursesListInit(QString &linesTokinzedString);
|
||||||
gradeCourse* lineToCourse(QString line);
|
gradeCourse* lineToCourse(QString line);
|
||||||
|
|
||||||
bool isGradedYet(QString grade);
|
bool isGradedYet(QString grade);
|
||||||
|
|
||||||
QList<gradeCourse*> courses;
|
QList<gradeCourse*> courses;
|
||||||
|
|
||||||
QString tempHtml;
|
QString tempHtml;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,80 +2,80 @@
|
||||||
#include "ui_gradegraph.h"
|
#include "ui_gradegraph.h"
|
||||||
|
|
||||||
gradegraph::gradegraph(QWidget *parent) :
|
gradegraph::gradegraph(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::gradegraph)
|
ui(new Ui::gradegraph)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->gp = NULL;
|
this->gp = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gradegraph::showGraph(GradePage *gpPTR)
|
void gradegraph::showGraph(GradePage *gpPTR)
|
||||||
{
|
{
|
||||||
this->gp = gpPTR;
|
this->gp = gpPTR;
|
||||||
setVisualization();
|
setVisualization();
|
||||||
setGraphsData();
|
setGraphsData();
|
||||||
this->show();
|
this->show();
|
||||||
this->setModal(true); //makes it on top of application
|
this->setModal(true); //makes it on top of application
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gradegraph::~gradegraph()
|
gradegraph::~gradegraph()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gradegraph::setGraphsData()
|
void gradegraph::setGraphsData()
|
||||||
{
|
{
|
||||||
int minYearInList = gp->getMinYearInList();
|
int minYearInList = gp->getMinYearInList();
|
||||||
int maxYearInList = gp->getMaxYearInList()+1;
|
int maxYearInList = gp->getMaxYearInList()+1;
|
||||||
int xRangeForYear = (maxYearInList - minYearInList+2)*3;
|
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) //filling data
|
for (int yearCount=0,i=1; i<xRangeForYear; ++i) //filling data
|
||||||
{
|
{
|
||||||
double lastAvg = 0;
|
double lastAvg = 0;
|
||||||
sem[i] = i;
|
sem[i] = i;
|
||||||
if (i%4==1) //years
|
if (i%4==1) //years
|
||||||
{
|
{
|
||||||
lastAvg = gp->getAvg(minYearInList+yearCount);
|
lastAvg = gp->getAvg(minYearInList+yearCount);
|
||||||
yearlyAvg[i] = lastAvg;
|
yearlyAvg[i] = lastAvg;
|
||||||
|
|
||||||
// add the text label at the top:
|
// add the text label at the top:
|
||||||
QCPItemText *textLabel = new QCPItemText(ui->graphwidget);
|
QCPItemText *textLabel = new QCPItemText(ui->graphwidget);
|
||||||
ui->graphwidget->addItem(textLabel);
|
ui->graphwidget->addItem(textLabel);
|
||||||
textLabel->position->setCoords(i, lastAvg+1.5); // place position at center/top of axis rect
|
textLabel->position->setCoords(i, lastAvg+1.5); // place position at center/top of axis rect
|
||||||
textLabel->setText(QString::number(lastAvg,'g',4));
|
textLabel->setText(QString::number(lastAvg,'g',4));
|
||||||
textLabel->setFont(QFont(font().family(), 8)); // make font a bit larger
|
textLabel->setFont(QFont(font().family(), 8)); // make font a bit larger
|
||||||
textLabel->setPen(QPen(Qt::black)); // show black border around text
|
textLabel->setPen(QPen(Qt::black)); // show black border around text
|
||||||
yearCount++;
|
yearCount++;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (i+4 < xRangeForYear) //semesters
|
if (i+4 < xRangeForYear) //semesters
|
||||||
{
|
{
|
||||||
double avg = gp->getAvg(minYearInList+yearCount,(i-1)%4);
|
double avg = gp->getAvg(minYearInList+yearCount,(i-1)%4);
|
||||||
SemesterialAvg[i+4] = avg;
|
SemesterialAvg[i+4] = avg;
|
||||||
// add the text label at the top:
|
// add the text label at the top:
|
||||||
|
|
||||||
QCPItemText *textLabel = new QCPItemText(ui->graphwidget);
|
QCPItemText *textLabel = new QCPItemText(ui->graphwidget);
|
||||||
ui->graphwidget->addItem(textLabel);
|
ui->graphwidget->addItem(textLabel);
|
||||||
textLabel->position->setCoords(i+4, avg+0.5); // place position at center/top of axis rect
|
textLabel->position->setCoords(i+4, avg+0.5); // place position at center/top of axis rect
|
||||||
textLabel->setText(QString::number(avg,'g',4));
|
textLabel->setText(QString::number(avg,'g',4));
|
||||||
textLabel->setFont(QFont(font().family(), 8)); // make font a bit larger
|
textLabel->setFont(QFont(font().family(), 8)); // make font a bit larger
|
||||||
textLabel->setPen(QPen(Qt::black)); // show black border around text
|
textLabel->setPen(QPen(Qt::black)); // show black border around text
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yearlyAvg[i] = 0;
|
yearlyAvg[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//yearly
|
//yearly
|
||||||
ui->graphwidget->graph(0)->setData(sem,yearlyAvg);
|
ui->graphwidget->graph(0)->setData(sem,yearlyAvg);
|
||||||
//yearly
|
//yearly
|
||||||
ui->graphwidget->graph(1)->setData(sem,SemesterialAvg);
|
ui->graphwidget->graph(1)->setData(sem,SemesterialAvg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,71 +83,71 @@ void gradegraph::setGraphsData()
|
||||||
*/
|
*/
|
||||||
void gradegraph::setVisualization()
|
void gradegraph::setVisualization()
|
||||||
{
|
{
|
||||||
ui->graphwidget->axisRect()->setupFullAxesBox(true); //make the graph looks like a box
|
ui->graphwidget->axisRect()->setupFullAxesBox(true); //make the graph looks like a box
|
||||||
|
|
||||||
ui->graphwidget->addGraph(); //yearly and semesterial graphs
|
ui->graphwidget->addGraph(); //yearly and semesterial graphs
|
||||||
ui->graphwidget->addGraph();
|
ui->graphwidget->addGraph();
|
||||||
|
|
||||||
ui->graphwidget->graph(0)->setName(tr("Yearly Average"));
|
ui->graphwidget->graph(0)->setName(tr("Yearly Average"));
|
||||||
ui->graphwidget->graph(0)->setLineStyle(QCPGraph::lsLine);
|
ui->graphwidget->graph(0)->setLineStyle(QCPGraph::lsLine);
|
||||||
ui->graphwidget->graph(0)->setPen(QPen(Qt::GlobalColor::blue));
|
ui->graphwidget->graph(0)->setPen(QPen(Qt::GlobalColor::blue));
|
||||||
|
|
||||||
ui->graphwidget->graph(1)->setName(tr("Semesterial Average"));
|
ui->graphwidget->graph(1)->setName(tr("Semesterial Average"));
|
||||||
ui->graphwidget->graph(1)->setLineStyle(QCPGraph::lsLine);
|
ui->graphwidget->graph(1)->setLineStyle(QCPGraph::lsLine);
|
||||||
ui->graphwidget->graph(1)->setPen(QPen( QColor(Qt::GlobalColor::red)));
|
ui->graphwidget->graph(1)->setPen(QPen( QColor(Qt::GlobalColor::red)));
|
||||||
|
|
||||||
int minYearInList = gp->getMinYearInList();
|
int minYearInList = gp->getMinYearInList();
|
||||||
int maxYearInList = gp->getMaxYearInList()+1;
|
int maxYearInList = gp->getMaxYearInList()+1;
|
||||||
int xRangeForYear = (maxYearInList - minYearInList+2)*3;
|
int xRangeForYear = (maxYearInList - minYearInList+2)*3;
|
||||||
|
|
||||||
QVector<QString> xStrings(0);
|
QVector<QString> xStrings(0);
|
||||||
for (int year=minYearInList,i = 0; i < xRangeForYear-1; ++i)
|
for (int year=minYearInList,i = 0; i < xRangeForYear-1; ++i)
|
||||||
{
|
{
|
||||||
//set year x axe label to be yyyy A B C yyyy+1 A B C yyyy+2....
|
//set year x axe label to be yyyy A B C yyyy+1 A B C yyyy+2....
|
||||||
int semesterChar = i%4;
|
int semesterChar = i%4;
|
||||||
QString tempString;
|
QString tempString;
|
||||||
switch (semesterChar)
|
switch (semesterChar)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
tempString = tr("A");
|
tempString = tr("A");
|
||||||
xStrings << tempString;
|
xStrings << tempString;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
tempString = tr("B");
|
tempString = tr("B");
|
||||||
xStrings << tempString;
|
xStrings << tempString;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
tempString = tr("C");
|
tempString = tr("C");
|
||||||
xStrings << tempString;
|
xStrings << tempString;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
tempString = QString::number(year);
|
tempString = QString::number(year);
|
||||||
xStrings << tempString;
|
xStrings << tempString;
|
||||||
year++;
|
year++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui->graphwidget->yAxis->setLabel(tr("AVG Grade"));
|
ui->graphwidget->yAxis->setLabel(tr("AVG Grade"));
|
||||||
ui->graphwidget->yAxis->setTickLabelFont(QFont(QFont().family(), 8));
|
ui->graphwidget->yAxis->setTickLabelFont(QFont(QFont().family(), 8));
|
||||||
ui->graphwidget->yAxis->setRange(50,100);
|
ui->graphwidget->yAxis->setRange(50,100);
|
||||||
ui->graphwidget->yAxis->setTickStep(2);
|
ui->graphwidget->yAxis->setTickStep(2);
|
||||||
ui->graphwidget->yAxis->setAutoSubTicks(false);
|
ui->graphwidget->yAxis->setAutoSubTicks(false);
|
||||||
ui->graphwidget->yAxis->setAutoTickStep(false);
|
ui->graphwidget->yAxis->setAutoTickStep(false);
|
||||||
ui->graphwidget->yAxis->setSubTickCount(5);
|
ui->graphwidget->yAxis->setSubTickCount(5);
|
||||||
|
|
||||||
|
|
||||||
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->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->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
|
||||||
}
|
}
|
||||||
|
|
||||||
void gradegraph::on_pushButton_clicked()
|
void gradegraph::on_pushButton_clicked()
|
||||||
|
|
Loading…
Reference in a new issue