From 96751b69458e3f32cbbd1e6129d47795fe9a9fe5 Mon Sep 17 00:00:00 2001 From: liranbg Date: Fri, 10 Oct 2014 21:47:30 +0300 Subject: [PATCH] documentation --- src/jceData/CSV/csv_exporter.cpp | 4 +- src/jceData/Calendar/Exams/calendarExam.cpp | 18 +- .../Calendar/Exams/calendarExamCourse.h | 4 +- src/jceData/Grades/gradeCourse.cpp | 1 + src/jceData/Grades/gradeCourse.h | 23 ++- src/jceData/Grades/gradePage.h | 39 ++-- src/jceData/Grades/graph/gradegraph.cpp | 182 +++++++++--------- 7 files changed, 145 insertions(+), 126 deletions(-) diff --git a/src/jceData/CSV/csv_exporter.cpp b/src/jceData/CSV/csv_exporter.cpp index aaa01f1..96545f4 100644 --- a/src/jceData/CSV/csv_exporter.cpp +++ b/src/jceData/CSV/csv_exporter.cpp @@ -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); } diff --git a/src/jceData/Calendar/Exams/calendarExam.cpp b/src/jceData/Calendar/Exams/calendarExam.cpp index 31444b5..39b19b9 100644 --- a/src/jceData/Calendar/Exams/calendarExam.cpp +++ b/src/jceData/Calendar/Exams/calendarExam.cpp @@ -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; } diff --git a/src/jceData/Calendar/Exams/calendarExamCourse.h b/src/jceData/Calendar/Exams/calendarExamCourse.h index 12a37b8..8cb3776 100644 --- a/src/jceData/Calendar/Exams/calendarExamCourse.h +++ b/src/jceData/Calendar/Exams/calendarExamCourse.h @@ -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, diff --git a/src/jceData/Grades/gradeCourse.cpp b/src/jceData/Grades/gradeCourse.cpp index 2f9656f..13b1a8c 100644 --- a/src/jceData/Grades/gradeCourse.cpp +++ b/src/jceData/Grades/gradeCourse.cpp @@ -15,6 +15,7 @@ gradeCourse::~gradeCourse() { } + double gradeCourse::getGrade() const { double noGrade = NO_GRADE_YET; diff --git a/src/jceData/Grades/gradeCourse.h b/src/jceData/Grades/gradeCourse.h index 12d329b..8bd67e4 100644 --- a/src/jceData/Grades/gradeCourse.h +++ b/src/jceData/Grades/gradeCourse.h @@ -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: diff --git a/src/jceData/Grades/gradePage.h b/src/jceData/Grades/gradePage.h index c94c428..727c82d 100644 --- a/src/jceData/Grades/gradePage.h +++ b/src/jceData/Grades/gradePage.h @@ -13,35 +13,46 @@ #include +/** + * @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 getCourses() { return courses; } + QList 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 courses; + QList courses; - QString tempHtml; + QString tempHtml; }; diff --git a/src/jceData/Grades/graph/gradegraph.cpp b/src/jceData/Grades/graph/gradegraph.cpp index 235dd49..70ffcc3 100644 --- a/src/jceData/Grades/graph/gradegraph.cpp +++ b/src/jceData/Grades/graph/gradegraph.cpp @@ -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 SemesterialAvg(xRangeForYear),yearlyAvg(xRangeForYear),sem(xRangeForYear); + int minYearInList = gp->getMinYearInList(); + int maxYearInList = gp->getMaxYearInList()+1; + int xRangeForYear = (maxYearInList - minYearInList+2)*3; + QVector SemesterialAvg(xRangeForYear),yearlyAvg(xRangeForYear),sem(xRangeForYear); - for (int yearCount=0,i=1; igetAvg(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 xStrings(0); - for (int year=minYearInList,i = 0; i < xRangeForYear-1; ++i) + QVector 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()