gpa contains years and semester
This commit is contained in:
parent
fe6951dbf4
commit
026c6b937c
16 changed files with 25197 additions and 68 deletions
13
jceGrade.pro
13
jceGrade.pro
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui network widgets
|
QT += core gui network widgets printsupport
|
||||||
|
|
||||||
CONFIG += qt c++11
|
CONFIG += qt c++11
|
||||||
|
|
||||||
|
@ -25,7 +25,8 @@ TRANSLATIONS = jce_en.ts \
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
main/mainscreen.ui \
|
main/mainscreen.ui \
|
||||||
src/jceData/Calendar/calendarDialog.ui
|
src/jceData/Calendar/calendarDialog.ui \
|
||||||
|
src/jceData/Grades/graph/gradegraph.ui
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources/connectionstatus.qrc
|
resources/connectionstatus.qrc
|
||||||
|
@ -50,7 +51,9 @@ HEADERS += \
|
||||||
src/jceData/CSV/csv_exporter.h \
|
src/jceData/CSV/csv_exporter.h \
|
||||||
src/appDatabase/simplecrypt.h \
|
src/appDatabase/simplecrypt.h \
|
||||||
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/gradegraph.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main/CalendarTab/CalendarManager.cpp \
|
main/CalendarTab/CalendarManager.cpp \
|
||||||
|
@ -71,4 +74,6 @@ SOURCES += \
|
||||||
src/jceData/CSV/csv_exporter.cpp \
|
src/jceData/CSV/csv_exporter.cpp \
|
||||||
src/appDatabase/simplecrypt.cpp \
|
src/appDatabase/simplecrypt.cpp \
|
||||||
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/gradegraph.cpp
|
||||||
|
|
|
@ -12,12 +12,17 @@ coursesTableManager::coursesTableManager(QTableWidget *ptr, user *usrPtr)
|
||||||
courseTBL->setRowCount(0);
|
courseTBL->setRowCount(0);
|
||||||
courseTBL->setColumnCount(COURSE_FIELDS);
|
courseTBL->setColumnCount(COURSE_FIELDS);
|
||||||
QStringList mz;
|
QStringList mz;
|
||||||
mz << QObject::tr("Code") << 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(true);
|
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,gp);
|
||||||
}
|
}
|
||||||
|
|
||||||
coursesTableManager::~coursesTableManager()
|
coursesTableManager::~coursesTableManager()
|
||||||
|
@ -61,6 +66,8 @@ bool coursesTableManager::changes(QString change, int row, int col)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool isNumFlag = true;
|
bool isNumFlag = true;
|
||||||
|
if (courseTBL->item(row,gradeCourse::CourseScheme::SERIAL) == NULL)
|
||||||
|
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())
|
||||||
|
@ -69,6 +76,15 @@ bool coursesTableManager::changes(QString change, int row, int col)
|
||||||
{
|
{
|
||||||
switch (col)
|
switch (col)
|
||||||
{
|
{
|
||||||
|
case (gradeCourse::CourseScheme::COURSE_NUMBER_IN_LIST):
|
||||||
|
c->setCourseNumInList(change.toInt());
|
||||||
|
break;
|
||||||
|
case (gradeCourse::CourseScheme::YEAR):
|
||||||
|
c->setYear(change.toInt());
|
||||||
|
break;
|
||||||
|
case (gradeCourse::CourseScheme::SEMESTER):
|
||||||
|
c->setSemester(change.toInt());
|
||||||
|
break;
|
||||||
case (gradeCourse::CourseScheme::NAME):
|
case (gradeCourse::CourseScheme::NAME):
|
||||||
c->setName(change);
|
c->setName(change);
|
||||||
break;
|
break;
|
||||||
|
@ -132,10 +148,10 @@ bool coursesTableManager::changes(QString change, int row, int col)
|
||||||
*/
|
*/
|
||||||
void coursesTableManager::addRow(const gradeCourse *courseToAdd)
|
void coursesTableManager::addRow(const gradeCourse *courseToAdd)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i=1,j=1;
|
||||||
i = courseTBL->rowCount();
|
|
||||||
j = 0;
|
j = 0;
|
||||||
QTableWidgetItem *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)
|
||||||
{
|
{
|
||||||
|
@ -143,19 +159,29 @@ void coursesTableManager::addRow(const gradeCourse *courseToAdd)
|
||||||
if (!isCourseAlreadyInserted(c->getSerialNum()))
|
if (!isCourseAlreadyInserted(c->getSerialNum()))
|
||||||
{
|
{
|
||||||
courseTBL->setRowCount(courseTBL->rowCount() + 1);
|
courseTBL->setRowCount(courseTBL->rowCount() + 1);
|
||||||
|
i = courseTBL->rowCount()-1;
|
||||||
|
|
||||||
|
number = new QTableWidgetItem(QString::number(c->getCourseNumInList()));
|
||||||
|
number->setFlags(number->flags() & ~Qt::ItemIsEditable);
|
||||||
|
year = new QTableWidgetItem(QString::number(c->getYear()));
|
||||||
|
year->setFlags(year->flags() & ~Qt::ItemIsEditable);
|
||||||
|
semester = new QTableWidgetItem(QString::number(c->getSemester()));
|
||||||
|
semester->setFlags(semester->flags() & ~Qt::ItemIsEditable);
|
||||||
serial = new QTableWidgetItem(QString::number(c->getSerialNum()));
|
serial = new QTableWidgetItem(QString::number(c->getSerialNum()));
|
||||||
serial->setFlags(serial->flags() & ~Qt::ItemIsEditable);
|
serial->setFlags(serial->flags() & ~Qt::ItemIsEditable);
|
||||||
points = new QTableWidgetItem(QString::number(c->getPoints()));
|
points = new QTableWidgetItem(QString::number(c->getPoints()));
|
||||||
points->setFlags(serial->flags() & ~Qt::ItemIsEditable);
|
points->setFlags(points->flags() & ~Qt::ItemIsEditable);
|
||||||
hours = new QTableWidgetItem(QString::number(c->getHours()));
|
hours = new QTableWidgetItem(QString::number(c->getHours()));
|
||||||
hours->setFlags(serial->flags() & ~Qt::ItemIsEditable);
|
hours->setFlags(hours->flags() & ~Qt::ItemIsEditable);
|
||||||
grade = new QTableWidgetItem(QString::number(c->getGrade()));
|
grade = new QTableWidgetItem(QString::number(c->getGrade()));
|
||||||
name = new QTableWidgetItem(c->getName());
|
name = new QTableWidgetItem(c->getName());
|
||||||
name->setFlags(serial->flags() & ~Qt::ItemIsEditable);
|
name->setFlags(name->flags() & ~Qt::ItemIsEditable);
|
||||||
type = new QTableWidgetItem(c->getType());
|
type = new QTableWidgetItem(c->getType());
|
||||||
type->setFlags(serial->flags() & ~Qt::ItemIsEditable);
|
type->setFlags(type->flags() & ~Qt::ItemIsEditable);
|
||||||
addition = new QTableWidgetItem(c->getAddidtions());
|
addition = new QTableWidgetItem(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++,serial);
|
||||||
courseTBL->setItem(i,j++,name);
|
courseTBL->setItem(i,j++,name);
|
||||||
courseTBL->setItem(i,j++,type);
|
courseTBL->setItem(i,j++,type);
|
||||||
|
@ -164,10 +190,12 @@ void coursesTableManager::addRow(const gradeCourse *courseToAdd)
|
||||||
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!";
|
||||||
}
|
}
|
||||||
courseTBL->resizeColumnsToContents();
|
courseTBL->resizeColumnsToContents();
|
||||||
|
|
||||||
|
@ -179,6 +207,12 @@ double coursesTableManager::getAvg()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void coursesTableManager::showGraph()
|
||||||
|
{
|
||||||
|
if (gp != NULL)
|
||||||
|
this->graph->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void coursesTableManager::influnceCourseChanged(bool ignoreCourseStatus)
|
void coursesTableManager::influnceCourseChanged(bool ignoreCourseStatus)
|
||||||
{
|
{
|
||||||
|
@ -232,13 +266,16 @@ gradeCourse *coursesTableManager::getCourseByRow(int row)
|
||||||
|
|
||||||
bool coursesTableManager::isCourseAlreadyInserted(double courseID)
|
bool coursesTableManager::isCourseAlreadyInserted(double courseID)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i;
|
||||||
for (i = 0; i < courseTBL->rowCount(); ++i)
|
for (i = courseTBL->rowCount(); i >= 0; --i)
|
||||||
|
{
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
#include "./src/jceData/Grades/graph/gradegraph.h"
|
||||||
#include "./src/jceData/Grades/gradePage.h"
|
#include "./src/jceData/Grades/gradePage.h"
|
||||||
#include "./src/jceSettings/user.h"
|
#include "./src/jceSettings/user.h"
|
||||||
|
|
||||||
|
@ -27,10 +28,13 @@ public:
|
||||||
void addRow(const gradeCourse * courseToAdd = 0);
|
void addRow(const gradeCourse * courseToAdd = 0);
|
||||||
double getAvg();
|
double getAvg();
|
||||||
|
|
||||||
|
void showGraph();
|
||||||
|
|
||||||
void influnceCourseChanged(bool status);
|
void influnceCourseChanged(bool status);
|
||||||
void clearTable();
|
void clearTable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
gradegraph *graph;
|
||||||
QTableWidget *courseTBL;
|
QTableWidget *courseTBL;
|
||||||
GradePage *gp;
|
GradePage *gp;
|
||||||
user *us;
|
user *us;
|
||||||
|
|
|
@ -229,6 +229,10 @@ void MainScreen::on_clearTableButton_clicked()
|
||||||
courseTableMgr->clearTable();
|
courseTableMgr->clearTable();
|
||||||
ui->avgLCD->display(courseTableMgr->getAvg());
|
ui->avgLCD->display(courseTableMgr->getAvg());
|
||||||
}
|
}
|
||||||
|
void MainScreen::on_graphButton_clicked()
|
||||||
|
{
|
||||||
|
courseTableMgr->showGraph();
|
||||||
|
}
|
||||||
//EVENTS ON CALENDAR TAB
|
//EVENTS ON CALENDAR TAB
|
||||||
void MainScreen::on_getCalendarBtn_clicked()
|
void MainScreen::on_getCalendarBtn_clicked()
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,6 +67,8 @@ private slots:
|
||||||
|
|
||||||
void on_labelMadeBy_linkActivated(const QString &link);
|
void on_labelMadeBy_linkActivated(const QString &link);
|
||||||
|
|
||||||
|
void on_graphButton_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void checkLocale();
|
void checkLocale();
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>855</width>
|
<width>1133</width>
|
||||||
<height>517</height>
|
<height>623</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -64,7 +64,7 @@ background: qlineargradient(spread:pad, x1:0.496, y1:0, x2:0.508, y2:1, stop:0 r
|
||||||
<enum>QTabWidget::Rounded</enum>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="documentMode">
|
<property name="documentMode">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -385,6 +385,13 @@ font-size: 15px;
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="AvghorizontalLayout">
|
<layout class="QHBoxLayout" name="AvghorizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="graphButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Graph View</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelAverage">
|
<widget class="QLabel" name="labelAverage">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -629,6 +636,13 @@ font-size: 15px;
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelMadeBy">
|
||||||
|
<property name="text">
|
||||||
|
<string><p align="center">Made By <a href="http://liranbg.github.io/JceManager/"><span style=" text-decoration: underline; color:#0000ff;">JceManager</span></a></p></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QProgressBar" name="progressBar">
|
<widget class="QProgressBar" name="progressBar">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -641,7 +655,7 @@ font-size: 15px;
|
||||||
<string notr="true">#progressBar::horizontal {
|
<string notr="true">#progressBar::horizontal {
|
||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
background: white;
|
background: transparent;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
}
|
}
|
||||||
#progressBar::chunk:horizontal {
|
#progressBar::chunk:horizontal {
|
||||||
|
@ -652,7 +666,7 @@ background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 green, stop:
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="textVisible">
|
<property name="textVisible">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -668,13 +682,6 @@ background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 green, stop:
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelMadeBy">
|
|
||||||
<property name="text">
|
|
||||||
<string><p align="center">Made By <a href="http://liranbg.github.io/JceManager/"><span style=" text-decoration: underline; color:#0000ff;">JceManager</span></a></p></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menuBar">
|
<widget class="QMenuBar" name="menuBar">
|
||||||
|
@ -682,8 +689,8 @@ background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 green, stop:
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>855</width>
|
<width>1133</width>
|
||||||
<height>21</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuA_about">
|
<widget class="QMenu" name="menuA_about">
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
#include "gradeCourse.h"
|
#include "gradeCourse.h"
|
||||||
|
|
||||||
gradeCourse::gradeCourse(int serial, QString name, QString type, double points, double hours, double grade, QString additions) : Course(serial,name,type,points)
|
gradeCourse::gradeCourse(int year, int semester, int courseNumInList, int serial, QString name, QString type, double points,double hours, double grade, QString additions) : Course(serial,name,type,points)
|
||||||
{
|
{
|
||||||
this->hours = hours;
|
this->hours = hours;
|
||||||
this->grade = grade;
|
this->grade = grade;
|
||||||
this->additions = additions;
|
this->additions = additions;
|
||||||
|
this->year = year;
|
||||||
|
this->semester = semester;
|
||||||
|
this->courseNumInList = courseNumInList;
|
||||||
}
|
}
|
||||||
|
|
||||||
gradeCourse::~gradeCourse()
|
gradeCourse::~gradeCourse()
|
||||||
|
@ -34,3 +37,23 @@ void gradeCourse::setAdditions(QString additions)
|
||||||
{
|
{
|
||||||
this->additions = additions;
|
this->additions = additions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gradeCourse::setYear(int year)
|
||||||
|
{
|
||||||
|
this->year = year;
|
||||||
|
|
||||||
|
}
|
||||||
|
void gradeCourse::setSemester(int semester)
|
||||||
|
{
|
||||||
|
this->semester = semester;
|
||||||
|
}
|
||||||
|
int gradeCourse::getCourseNumInList() const
|
||||||
|
{
|
||||||
|
return courseNumInList;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gradeCourse::setCourseNumInList(int value)
|
||||||
|
{
|
||||||
|
courseNumInList = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#define COURSE_FIELDS 7
|
#define COURSE_FIELDS 10
|
||||||
#define NO_GRADE_YET 101;
|
#define NO_GRADE_YET 101;
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@ class gradeCourse : public Course {
|
||||||
public:
|
public:
|
||||||
enum CourseScheme
|
enum CourseScheme
|
||||||
{
|
{
|
||||||
|
YEAR,
|
||||||
|
SEMESTER,
|
||||||
|
COURSE_NUMBER_IN_LIST,
|
||||||
SERIAL,
|
SERIAL,
|
||||||
NAME,
|
NAME,
|
||||||
TYPE,
|
TYPE,
|
||||||
|
@ -30,9 +33,11 @@ public:
|
||||||
ADDITION
|
ADDITION
|
||||||
};
|
};
|
||||||
|
|
||||||
gradeCourse(int serial, QString name, QString type, double points,double hours, double grade, QString additions);
|
gradeCourse(int year, int semester, int courseNumInList, int serial, QString name, QString type, double points,double hours, double grade, QString additions);
|
||||||
~gradeCourse();
|
~gradeCourse();
|
||||||
|
|
||||||
|
int getYear() const { return this->year; }
|
||||||
|
int getSemester() const { return this->semester; }
|
||||||
double getHours() const {return this->hours;}
|
double getHours() const {return this->hours;}
|
||||||
double getGrade() const;
|
double getGrade() const;
|
||||||
QString getAddidtions() const {return this->additions;}
|
QString getAddidtions() const {return this->additions;}
|
||||||
|
@ -40,12 +45,20 @@ public:
|
||||||
void setHours(double hours);
|
void setHours(double hours);
|
||||||
void setGrade(double grade);
|
void setGrade(double grade);
|
||||||
void setAdditions(QString additions);
|
void setAdditions(QString additions);
|
||||||
|
void setYear(int year);
|
||||||
|
void setSemester(int semester);
|
||||||
|
|
||||||
|
int getCourseNumInList() const;
|
||||||
|
void setCourseNumInList(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
double hours;
|
double hours;
|
||||||
double grade;
|
double grade;
|
||||||
QString additions;
|
QString additions;
|
||||||
|
int year;
|
||||||
|
int semester;
|
||||||
|
int courseNumInList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ void GradePage::coursesListInit(QString &linesTokinzedString)
|
||||||
char* tok;
|
char* tok;
|
||||||
char* textToTok = strdup(linesTokinzedString.toStdString().c_str());
|
char* textToTok = strdup(linesTokinzedString.toStdString().c_str());
|
||||||
tok = strtok(textToTok,"\n");
|
tok = strtok(textToTok,"\n");
|
||||||
while (tok != NULL)
|
while (tok != NULL) //putting every line in a string holder before parsing it
|
||||||
{
|
{
|
||||||
temp = tok;
|
temp = tok;
|
||||||
stringHolder.push_back(temp);
|
stringHolder.push_back(temp);
|
||||||
|
@ -52,7 +52,6 @@ void GradePage::coursesListInit(QString &linesTokinzedString)
|
||||||
|
|
||||||
QString GradePage::tokenToLines(QString &textToPhrase)
|
QString GradePage::tokenToLines(QString &textToPhrase)
|
||||||
{
|
{
|
||||||
int ctr = 0;
|
|
||||||
QString temp = "";
|
QString temp = "";
|
||||||
char *tok;
|
char *tok;
|
||||||
char* textToTok = strdup(textToPhrase.toStdString().c_str());
|
char* textToTok = strdup(textToPhrase.toStdString().c_str());
|
||||||
|
@ -65,7 +64,6 @@ QString GradePage::tokenToLines(QString &textToPhrase)
|
||||||
temp += tok;
|
temp += tok;
|
||||||
temp += "\n";
|
temp += "\n";
|
||||||
}
|
}
|
||||||
ctr++;
|
|
||||||
tok = strtok(NULL, "\n");
|
tok = strtok(NULL, "\n");
|
||||||
}
|
}
|
||||||
return temp;
|
return temp;
|
||||||
|
@ -75,7 +73,7 @@ gradeCourse* GradePage::lineToCourse(QString line)
|
||||||
{
|
{
|
||||||
gradeCourse *tempC = NULL;
|
gradeCourse *tempC = NULL;
|
||||||
QString templinearray[COURSE_FIELDS];//[serial,name,type,points,hours,grade,additions]
|
QString templinearray[COURSE_FIELDS];//[serial,name,type,points,hours,grade,additions]
|
||||||
int serial;
|
int serial,year,semester,courseNumInList;
|
||||||
double points,hours,grade;
|
double points,hours,grade;
|
||||||
QString name,type, additions;
|
QString name,type, additions;
|
||||||
QString tempS = "";
|
QString tempS = "";
|
||||||
|
@ -85,35 +83,44 @@ gradeCourse* GradePage::lineToCourse(QString line)
|
||||||
tok = strtok(cLine, "\t");
|
tok = strtok(cLine, "\t");
|
||||||
while(tok != NULL)
|
while(tok != NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
tempS = tok;
|
tempS = tok;
|
||||||
if (i == 1) //skip the tokenizing loop just once
|
|
||||||
|
if (i == gradeCourse::CourseScheme::SERIAL) //we need to extract the serial manually
|
||||||
{
|
{
|
||||||
tempS = "";
|
tempS = "";
|
||||||
char *tokTemp;
|
char *tokTemp;
|
||||||
tokTemp = tok;
|
tokTemp = tok;
|
||||||
while (!(isdigit((int)*tokTemp)))
|
while (!(isdigit((int)*tokTemp))) //getting to serial number starting pointer
|
||||||
tokTemp++;
|
tokTemp++;
|
||||||
|
|
||||||
while (isdigit((int)*tokTemp))
|
while (isdigit((int)*tokTemp)) //serial number
|
||||||
{
|
{
|
||||||
tempS += QString(*tokTemp);
|
tempS += QString(*tokTemp);
|
||||||
tokTemp++;
|
tokTemp++;
|
||||||
}
|
}
|
||||||
templinearray[i-1] = tempS.trimmed();
|
templinearray[i] = tempS.trimmed();
|
||||||
templinearray[i] = QString(tokTemp).trimmed();
|
templinearray[i+1] = QString(tokTemp).trimmed();
|
||||||
|
i +=2; //skipping on serial and course name
|
||||||
}
|
}
|
||||||
else if (i > 1)
|
else
|
||||||
{
|
{
|
||||||
templinearray[i] = tempS;
|
templinearray[i] = tempS.trimmed();
|
||||||
}
|
|
||||||
i++;
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == COURSE_FIELDS)
|
||||||
|
break;
|
||||||
tok=strtok(NULL, "\t");
|
tok=strtok(NULL, "\t");
|
||||||
}
|
}
|
||||||
if (templinearray[0] == "") //empty phrasing
|
if (templinearray[0] == "") //empty parsing
|
||||||
|
{
|
||||||
|
qCritical() << Q_FUNC_INFO << "empty parsing";
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
year = templinearray[gradeCourse::CourseScheme::YEAR].toInt();
|
||||||
|
semester = templinearray[gradeCourse::CourseScheme::SEMESTER].toInt();
|
||||||
|
courseNumInList = templinearray[gradeCourse::CourseScheme::COURSE_NUMBER_IN_LIST].toInt();
|
||||||
serial = templinearray[gradeCourse::CourseScheme::SERIAL].toInt();
|
serial = templinearray[gradeCourse::CourseScheme::SERIAL].toInt();
|
||||||
|
|
||||||
name = templinearray[gradeCourse::CourseScheme::NAME];
|
name = templinearray[gradeCourse::CourseScheme::NAME];
|
||||||
|
@ -129,7 +136,7 @@ gradeCourse* GradePage::lineToCourse(QString line)
|
||||||
|
|
||||||
additions = templinearray[gradeCourse::CourseScheme::ADDITION];
|
additions = templinearray[gradeCourse::CourseScheme::ADDITION];
|
||||||
|
|
||||||
tempC = new gradeCourse(serial,name,type,points,hours,grade,additions);
|
tempC = new gradeCourse(year,semester,courseNumInList,serial,name,type,points,hours,grade,additions);
|
||||||
return tempC;
|
return tempC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
src/jceData/Grades/graph/gradegraph.cpp
Normal file
15
src/jceData/Grades/graph/gradegraph.cpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#include "gradegraph.h"
|
||||||
|
#include "ui_gradegraph.h"
|
||||||
|
|
||||||
|
gradegraph::gradegraph(QWidget *parent, GradePage *gpPTR) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::gradegraph)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
this->gp = gpPTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
gradegraph::~gradegraph()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
26
src/jceData/Grades/graph/gradegraph.h
Normal file
26
src/jceData/Grades/graph/gradegraph.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef GRADEGRAPH_H
|
||||||
|
#define GRADEGRAPH_H
|
||||||
|
|
||||||
|
#include "./src/jceData/Grades/gradePage.h"
|
||||||
|
#include "qcustomplot.h"
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class gradegraph;
|
||||||
|
}
|
||||||
|
|
||||||
|
class gradegraph : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
gradegraph(QWidget *parent = 0, GradePage *gpPTR = 0);
|
||||||
|
~gradegraph();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
GradePage *gp;
|
||||||
|
Ui::gradegraph *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GRADEGRAPH_H
|
51
src/jceData/Grades/graph/gradegraph.ui
Normal file
51
src/jceData/Grades/graph/gradegraph.ui
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>gradegraph</class>
|
||||||
|
<widget class="QDialog" name="gradegraph">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>597</width>
|
||||||
|
<height>461</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><span style=" font-size:18pt; font-weight:600;">Graph View</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCustomPlot" name="graphwidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>QCustomPlot</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>src/jceData/Grades/graph/qcustomplot.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
21370
src/jceData/Grades/graph/qcustomplot.cpp
Normal file
21370
src/jceData/Grades/graph/qcustomplot.cpp
Normal file
File diff suppressed because it is too large
Load diff
3529
src/jceData/Grades/graph/qcustomplot.h
Normal file
3529
src/jceData/Grades/graph/qcustomplot.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
#include "page.h"
|
#include "page.h"
|
||||||
|
|
||||||
Page::Page() {}
|
Page::Page() { dateHeader = "";}
|
||||||
/**
|
/**
|
||||||
* @brief Page::getString
|
* @brief Page::getString
|
||||||
* @param htmlToPhrased
|
* @param htmlToPhrased
|
||||||
|
@ -36,10 +36,16 @@ void Page::manageTableContent(QString &html, int index)
|
||||||
QString tableTag = html.mid(i, 4); //legth of "tr/td"
|
QString tableTag = html.mid(i, 4); //legth of "tr/td"
|
||||||
if (tableTag == "<tr>")
|
if (tableTag == "<tr>")
|
||||||
{
|
{
|
||||||
temp += "\n"; //new row -> new line
|
temp += dateHeader;
|
||||||
i = stitchText(html, temp, i+4);
|
i = stitchText(html, temp, i+4);
|
||||||
if (i == -1) //EOF
|
if (i == -1) //EOF
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (tableTag == "</tr")
|
||||||
|
{
|
||||||
|
temp += "\n"; //end row -> new line
|
||||||
|
i+=5;
|
||||||
}
|
}
|
||||||
else if (tableTag == "<td>" || tableTag == "<th>")
|
else if (tableTag == "<td>" || tableTag == "<th>")
|
||||||
{
|
{
|
||||||
|
@ -57,12 +63,18 @@ void Page::manageTableContent(QString &html, int index)
|
||||||
}
|
}
|
||||||
else if (tableTag == "<td ") // a Year title (in grades table)
|
else if (tableTag == "<td ") // a Year title (in grades table)
|
||||||
{
|
{
|
||||||
|
if (!temp.isEmpty())
|
||||||
|
if (temp.lastIndexOf(dateHeader) == temp.length()-dateHeader.length())
|
||||||
|
{
|
||||||
|
temp.chop(dateHeader.length()+1);
|
||||||
temp += "\t";
|
temp += "\t";
|
||||||
while(html.at(i) != '>')
|
|
||||||
i++;
|
|
||||||
i = stitchText(html, temp, i+1);
|
|
||||||
}
|
}
|
||||||
else if (html.mid(i,(endofTable).length()) == endofTable) //is end of table
|
while (html.mid(i,3) != "<b>")
|
||||||
|
i++;
|
||||||
|
i = stitchText(html, temp, i);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (html.mid(i,(endofTable).length()) == endofTable) //is end of table
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -78,9 +90,32 @@ int Page::stitchText(QString &from, QString &to, int index)
|
||||||
if (from.at(index) == '<')
|
if (from.at(index) == '<')
|
||||||
{
|
{
|
||||||
QString bTag = from.mid(index, 3);
|
QString bTag = from.mid(index, 3);
|
||||||
|
QString dateline = from.mid(index,from.indexOf("</b>",index+4)-index);
|
||||||
|
QString temp;
|
||||||
|
QString date;
|
||||||
|
char* tok;
|
||||||
|
int i = 0;
|
||||||
|
char* textToTok = strdup(dateline.toStdString().c_str());
|
||||||
|
tok = strtok(textToTok,"<> :");
|
||||||
|
while (tok != NULL)
|
||||||
|
{
|
||||||
|
if (i == 1)
|
||||||
|
{
|
||||||
|
temp = tok;
|
||||||
|
date += temp + "\t";
|
||||||
|
}
|
||||||
|
else if (i == 3)
|
||||||
|
{
|
||||||
|
temp = tok;
|
||||||
|
date += temp;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
tok = strtok(NULL, "<> :");
|
||||||
|
}
|
||||||
|
dateHeader = date;
|
||||||
if (bTag != "<b>")
|
if (bTag != "<b>")
|
||||||
return index-1; //go back one step - for the main function to inc i
|
return index-1; //go back one step - for the main function to inc i
|
||||||
index += 3;
|
index += dateline.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (from.at(index) != '<' && index < (int)from.length())
|
while (from.at(index) != '<' && index < (int)from.length())
|
||||||
|
@ -103,7 +138,7 @@ int Page::stitchText(QString &from, QString &to, int index)
|
||||||
else if (from.at(index) == '<')
|
else if (from.at(index) == '<')
|
||||||
return index - 1; //go back one step - for the main function to inc i
|
return index - 1; //go back one step - for the main function to inc i
|
||||||
|
|
||||||
if (from.at(index) != '\n') //check the actuall data before continue
|
if ((from.at(index) != '\n') && (from.at(index) != '\t')) //check the actuall data before continue
|
||||||
to += from.at(index);
|
to += from.at(index);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ private:
|
||||||
bool endOfString(int index, int length);
|
bool endOfString(int index, int length);
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
|
QString dateHeader;
|
||||||
QString title;
|
QString title;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue