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;
|
||||
start.append(QString::number(startH));
|
||||
start.append(":00");
|
||||
// start.append(QString::number(startM));
|
||||
// start.append(QString::number(startM));
|
||||
start.append(":00");
|
||||
|
||||
QString end;
|
||||
|
@ -172,7 +172,7 @@ QString CSV_Exporter::makeLine(QString name, QDate *date, int startH, int startM
|
|||
description.append("טרם נקבע מיקום");
|
||||
else
|
||||
{
|
||||
description.append(" ב");
|
||||
description.append(" ב");
|
||||
description.append(room);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,24 +71,24 @@ calendarExamCourse *calendarExam::lineToCourse(QString line)
|
|||
return NULL;
|
||||
|
||||
|
||||
serial = templinearray[calendarExamCourse::ExamScheme::SERIAL].toInt();
|
||||
name = templinearray[calendarExamCourse::ExamScheme::NAME];
|
||||
serial = templinearray[calendarExamCourse::CourseScheme::SERIAL].toInt();
|
||||
name = templinearray[calendarExamCourse::CourseScheme::NAME];
|
||||
|
||||
lecturer = templinearray[calendarExamCourse::ExamScheme::LECTURER];
|
||||
lecturer = templinearray[calendarExamCourse::CourseScheme::LECTURER];
|
||||
if (lecturer.isEmpty())
|
||||
lecturer = LECTURER_DEFAULT_STRING;
|
||||
|
||||
field = templinearray[calendarExamCourse::ExamScheme::FIELD];
|
||||
type = templinearray[calendarExamCourse::ExamScheme::TYPE];
|
||||
field = templinearray[calendarExamCourse::CourseScheme::FIELD];
|
||||
type = templinearray[calendarExamCourse::CourseScheme::TYPE];
|
||||
|
||||
firstDate = templinearray[calendarExamCourse::ExamScheme::FIRST_DATE];
|
||||
firstDate = templinearray[calendarExamCourse::CourseScheme::FIRST_DATE];
|
||||
if (firstDate.isEmpty())
|
||||
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())
|
||||
firstHourbegin = HOUR_DEFAULT_STRING;
|
||||
secondDate = templinearray[calendarExamCourse::ExamScheme::SECOND_DATE];
|
||||
secondDate = templinearray[calendarExamCourse::CourseScheme::SECOND_DATE];
|
||||
if (secondDate.isEmpty())
|
||||
{
|
||||
secondDate = SECOND_DATE_DEFAULT_STRING;
|
||||
|
@ -96,7 +96,7 @@ calendarExamCourse *calendarExam::lineToCourse(QString line)
|
|||
}
|
||||
else
|
||||
{
|
||||
secondHourbegin = templinearray[calendarExamCourse::ExamScheme::SECOND_HOUR_BEGIN];
|
||||
secondHourbegin = templinearray[calendarExamCourse::CourseScheme::SECOND_HOUR_BEGIN];
|
||||
if (secondHourbegin.isEmpty())
|
||||
secondHourbegin = HOUR_DEFAULT_STRING;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* @brief The calendarExamCourse class
|
||||
*
|
||||
* 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
|
||||
* with its relevant information.
|
||||
|
@ -29,7 +29,7 @@ class calendarExamCourse : public Course
|
|||
|
||||
public:
|
||||
|
||||
enum ExamScheme
|
||||
enum CourseScheme
|
||||
{
|
||||
SERIAL,
|
||||
NAME,
|
||||
|
|
|
@ -15,6 +15,7 @@ gradeCourse::~gradeCourse()
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
double gradeCourse::getGrade() const
|
||||
{
|
||||
double noGrade = NO_GRADE_YET;
|
||||
|
|
|
@ -1,18 +1,25 @@
|
|||
#ifndef 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"
|
||||
|
||||
#define COURSE_FIELDS 10
|
||||
#define COURSE_FIELDS 10
|
||||
#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 {
|
||||
|
||||
public:
|
||||
|
|
|
@ -13,35 +13,46 @@
|
|||
|
||||
#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
|
||||
{
|
||||
|
||||
public:
|
||||
GradePage(QString html);
|
||||
~GradePage();
|
||||
GradePage(QString html);
|
||||
~GradePage();
|
||||
|
||||
void removeCourse(QString courseSerialID);
|
||||
void removeCourse(QString courseSerialID);
|
||||
|
||||
double getAvg();
|
||||
double getAvg(int year);
|
||||
double getAvg(int year, int semester);
|
||||
double getAvg();
|
||||
double getAvg(int year);
|
||||
double getAvg(int year, int semester);
|
||||
|
||||
int getMinYearInList();
|
||||
int getMaxYearInList();
|
||||
int getMinYearInList();
|
||||
int getMaxYearInList();
|
||||
|
||||
|
||||
QList<gradeCourse*> getCourses() { return courses; }
|
||||
QList<gradeCourse*> getCourses() { return courses; }
|
||||
|
||||
private:
|
||||
|
||||
void coursesListInit(QString &linesTokinzedString);
|
||||
gradeCourse* lineToCourse(QString line);
|
||||
void coursesListInit(QString &linesTokinzedString);
|
||||
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"
|
||||
|
||||
gradegraph::gradegraph(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::gradegraph)
|
||||
QDialog(parent),
|
||||
ui(new Ui::gradegraph)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->gp = NULL;
|
||||
ui->setupUi(this);
|
||||
this->gp = NULL;
|
||||
|
||||
}
|
||||
|
||||
void gradegraph::showGraph(GradePage *gpPTR)
|
||||
{
|
||||
this->gp = gpPTR;
|
||||
setVisualization();
|
||||
setGraphsData();
|
||||
this->show();
|
||||
this->setModal(true); //makes it on top of application
|
||||
this->gp = gpPTR;
|
||||
setVisualization();
|
||||
setGraphsData();
|
||||
this->show();
|
||||
this->setModal(true); //makes it on top of application
|
||||
|
||||
}
|
||||
|
||||
gradegraph::~gradegraph()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void gradegraph::setGraphsData()
|
||||
{
|
||||
int minYearInList = gp->getMinYearInList();
|
||||
int maxYearInList = gp->getMaxYearInList()+1;
|
||||
int xRangeForYear = (maxYearInList - minYearInList+2)*3;
|
||||
QVector<double> SemesterialAvg(xRangeForYear),yearlyAvg(xRangeForYear),sem(xRangeForYear);
|
||||
int minYearInList = gp->getMinYearInList();
|
||||
int maxYearInList = gp->getMaxYearInList()+1;
|
||||
int xRangeForYear = (maxYearInList - minYearInList+2)*3;
|
||||
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;
|
||||
sem[i] = i;
|
||||
if (i%4==1) //years
|
||||
double lastAvg = 0;
|
||||
sem[i] = i;
|
||||
if (i%4==1) //years
|
||||
{
|
||||
lastAvg = gp->getAvg(minYearInList+yearCount);
|
||||
yearlyAvg[i] = lastAvg;
|
||||
lastAvg = gp->getAvg(minYearInList+yearCount);
|
||||
yearlyAvg[i] = lastAvg;
|
||||
|
||||
// add the text label at the top:
|
||||
QCPItemText *textLabel = new QCPItemText(ui->graphwidget);
|
||||
ui->graphwidget->addItem(textLabel);
|
||||
textLabel->position->setCoords(i, lastAvg+1.5); // place position at center/top of axis rect
|
||||
textLabel->setText(QString::number(lastAvg,'g',4));
|
||||
textLabel->setFont(QFont(font().family(), 8)); // make font a bit larger
|
||||
textLabel->setPen(QPen(Qt::black)); // show black border around text
|
||||
yearCount++;
|
||||
// add the text label at the top:
|
||||
QCPItemText *textLabel = new QCPItemText(ui->graphwidget);
|
||||
ui->graphwidget->addItem(textLabel);
|
||||
textLabel->position->setCoords(i, lastAvg+1.5); // place position at center/top of axis rect
|
||||
textLabel->setText(QString::number(lastAvg,'g',4));
|
||||
textLabel->setFont(QFont(font().family(), 8)); // make font a bit larger
|
||||
textLabel->setPen(QPen(Qt::black)); // show black border around text
|
||||
yearCount++;
|
||||
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (i+4 < xRangeForYear) //semesters
|
||||
if (i+4 < xRangeForYear) //semesters
|
||||
{
|
||||
double avg = gp->getAvg(minYearInList+yearCount,(i-1)%4);
|
||||
SemesterialAvg[i+4] = avg;
|
||||
// add the text label at the top:
|
||||
double avg = gp->getAvg(minYearInList+yearCount,(i-1)%4);
|
||||
SemesterialAvg[i+4] = avg;
|
||||
// add the text label at the top:
|
||||
|
||||
QCPItemText *textLabel = new QCPItemText(ui->graphwidget);
|
||||
ui->graphwidget->addItem(textLabel);
|
||||
textLabel->position->setCoords(i+4, avg+0.5); // place position at center/top of axis rect
|
||||
textLabel->setText(QString::number(avg,'g',4));
|
||||
textLabel->setFont(QFont(font().family(), 8)); // make font a bit larger
|
||||
textLabel->setPen(QPen(Qt::black)); // show black border around text
|
||||
QCPItemText *textLabel = new QCPItemText(ui->graphwidget);
|
||||
ui->graphwidget->addItem(textLabel);
|
||||
textLabel->position->setCoords(i+4, avg+0.5); // place position at center/top of axis rect
|
||||
textLabel->setText(QString::number(avg,'g',4));
|
||||
textLabel->setFont(QFont(font().family(), 8)); // make font a bit larger
|
||||
textLabel->setPen(QPen(Qt::black)); // show black border around text
|
||||
|
||||
|
||||
}
|
||||
|
||||
yearlyAvg[i] = 0;
|
||||
yearlyAvg[i] = 0;
|
||||
}
|
||||
}
|
||||
//yearly
|
||||
ui->graphwidget->graph(0)->setData(sem,yearlyAvg);
|
||||
//yearly
|
||||
ui->graphwidget->graph(1)->setData(sem,SemesterialAvg);
|
||||
//yearly
|
||||
ui->graphwidget->graph(0)->setData(sem,yearlyAvg);
|
||||
//yearly
|
||||
ui->graphwidget->graph(1)->setData(sem,SemesterialAvg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,71 +83,71 @@ void gradegraph::setGraphsData()
|
|||
*/
|
||||
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();
|
||||
ui->graphwidget->addGraph(); //yearly and semesterial graphs
|
||||
ui->graphwidget->addGraph();
|
||||
|
||||
ui->graphwidget->graph(0)->setName(tr("Yearly Average"));
|
||||
ui->graphwidget->graph(0)->setLineStyle(QCPGraph::lsLine);
|
||||
ui->graphwidget->graph(0)->setPen(QPen(Qt::GlobalColor::blue));
|
||||
ui->graphwidget->graph(0)->setName(tr("Yearly Average"));
|
||||
ui->graphwidget->graph(0)->setLineStyle(QCPGraph::lsLine);
|
||||
ui->graphwidget->graph(0)->setPen(QPen(Qt::GlobalColor::blue));
|
||||
|
||||
ui->graphwidget->graph(1)->setName(tr("Semesterial Average"));
|
||||
ui->graphwidget->graph(1)->setLineStyle(QCPGraph::lsLine);
|
||||
ui->graphwidget->graph(1)->setPen(QPen( QColor(Qt::GlobalColor::red)));
|
||||
ui->graphwidget->graph(1)->setName(tr("Semesterial Average"));
|
||||
ui->graphwidget->graph(1)->setLineStyle(QCPGraph::lsLine);
|
||||
ui->graphwidget->graph(1)->setPen(QPen( QColor(Qt::GlobalColor::red)));
|
||||
|
||||
int minYearInList = gp->getMinYearInList();
|
||||
int maxYearInList = gp->getMaxYearInList()+1;
|
||||
int xRangeForYear = (maxYearInList - minYearInList+2)*3;
|
||||
int minYearInList = gp->getMinYearInList();
|
||||
int maxYearInList = gp->getMaxYearInList()+1;
|
||||
int xRangeForYear = (maxYearInList - minYearInList+2)*3;
|
||||
|
||||
QVector<QString> xStrings(0);
|
||||
for (int year=minYearInList,i = 0; i < xRangeForYear-1; ++i)
|
||||
QVector<QString> xStrings(0);
|
||||
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....
|
||||
int semesterChar = i%4;
|
||||
QString tempString;
|
||||
switch (semesterChar)
|
||||
//set year x axe label to be yyyy A B C yyyy+1 A B C yyyy+2....
|
||||
int semesterChar = i%4;
|
||||
QString tempString;
|
||||
switch (semesterChar)
|
||||
{
|
||||
case 1:
|
||||
tempString = tr("A");
|
||||
xStrings << tempString;
|
||||
break;
|
||||
tempString = tr("A");
|
||||
xStrings << tempString;
|
||||
break;
|
||||
case 2:
|
||||
tempString = tr("B");
|
||||
xStrings << tempString;
|
||||
break;
|
||||
tempString = tr("B");
|
||||
xStrings << tempString;
|
||||
break;
|
||||
case 3:
|
||||
tempString = tr("C");
|
||||
xStrings << tempString;
|
||||
break;
|
||||
tempString = tr("C");
|
||||
xStrings << tempString;
|
||||
break;
|
||||
case 0:
|
||||
tempString = QString::number(year);
|
||||
xStrings << tempString;
|
||||
year++;
|
||||
break;
|
||||
tempString = QString::number(year);
|
||||
xStrings << tempString;
|
||||
year++;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
ui->graphwidget->yAxis->setLabel(tr("AVG Grade"));
|
||||
ui->graphwidget->yAxis->setTickLabelFont(QFont(QFont().family(), 8));
|
||||
ui->graphwidget->yAxis->setRange(50,100);
|
||||
ui->graphwidget->yAxis->setTickStep(2);
|
||||
ui->graphwidget->yAxis->setAutoSubTicks(false);
|
||||
ui->graphwidget->yAxis->setAutoTickStep(false);
|
||||
ui->graphwidget->yAxis->setSubTickCount(5);
|
||||
ui->graphwidget->yAxis->setLabel(tr("AVG Grade"));
|
||||
ui->graphwidget->yAxis->setTickLabelFont(QFont(QFont().family(), 8));
|
||||
ui->graphwidget->yAxis->setRange(50,100);
|
||||
ui->graphwidget->yAxis->setTickStep(2);
|
||||
ui->graphwidget->yAxis->setAutoSubTicks(false);
|
||||
ui->graphwidget->yAxis->setAutoTickStep(false);
|
||||
ui->graphwidget->yAxis->setSubTickCount(5);
|
||||
|
||||
|
||||
ui->graphwidget->xAxis->setLabel(tr("Years"));
|
||||
ui->graphwidget->xAxis->setAutoTickLabels(false);
|
||||
ui->graphwidget->xAxis->setTickLabelFont(QFont(QFont().family(), 7));
|
||||
ui->graphwidget->xAxis->setAutoTickStep(false);
|
||||
ui->graphwidget->xAxis->setTickStep(1);
|
||||
ui->graphwidget->xAxis->setAutoSubTicks(false);
|
||||
ui->graphwidget->xAxis->setSubTickCount(1);
|
||||
ui->graphwidget->xAxis->setLabel(tr("Years"));
|
||||
ui->graphwidget->xAxis->setAutoTickLabels(false);
|
||||
ui->graphwidget->xAxis->setTickLabelFont(QFont(QFont().family(), 7));
|
||||
ui->graphwidget->xAxis->setAutoTickStep(false);
|
||||
ui->graphwidget->xAxis->setTickStep(1);
|
||||
ui->graphwidget->xAxis->setAutoSubTicks(false);
|
||||
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
|
||||
}
|
||||
|
||||
void gradegraph::on_pushButton_clicked()
|
||||
|
|
Loading…
Reference in a new issue