diff --git a/jceGrade.pro b/jceGrade.pro
index 9e068ba..b341c1b 100644
--- a/jceGrade.pro
+++ b/jceGrade.pro
@@ -1,53 +1,55 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2014-05-31T19:49:42
-#
-#-------------------------------------------------
-
-QT += core gui network
-
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-TARGET = jceGrade
-TEMPLATE = app
-RC_FILE = appConfigure.rc
-CONFIG += c++11 static
-SOURCES += main/coursestablemanager.cpp \
- main/loginhandler.cpp \
- main/main.cpp \
- main/mainscreen.cpp \
- src/connection/jcesslclient.cpp \
- src/user.cpp \
- src/grades/Course.cpp \
- src/grades/GradePage.cpp \
- src/grades/Page.cpp \
- src/jce/jcedate.cpp \
- src/jce/jcelogin.cpp \
- src/data/savedata.cpp \
-
-
-
-
-HEADERS += main/coursestablemanager.h \
- main/loginhandler.h \
- main/mainscreen.h \
- src/connection/jcesslclient.h \
- src/user.h \
- src/grades/Course.h \
- src/grades/GradePage.h \
- src/grades/Page.h \
- src/jce/jcedate.h \
- src/jce/jcelogin.h \
- src/jce/jceLoginHtmlScripts.h \
- src/data/savedata.h \
-
-
-TRANSLATIONS = jce_en.ts \
- jce_he.ts
-
-FORMS += \
- main/mainscreen.ui
-
-OTHER_FILES +=
-
-RESOURCES += \
- resources/connectionstatus.qrc
+#-------------------------------------------------
+#
+# Project created by QtCreator 2014-05-31T19:49:42
+#
+#-------------------------------------------------
+
+QT += core gui network
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+TARGET = jceGrade
+TEMPLATE = app
+RC_FILE = appConfigure.rc
+CONFIG += c++11 static
+
+FORMS += \
+ main/mainscreen.ui
+
+OTHER_FILES +=
+
+RESOURCES += \
+ resources/connectionstatus.qrc
+
+HEADERS += \
+ main/CalendarTab/CalendarManager.h \
+ main/CourseTab/coursestablemanager.h \
+ main/LoginTab/loginhandler.h \
+ main/mainscreen.h \
+ src/appDatabase/savedata.h \
+ src/jceConnection/jcesslclient.h \
+ src/jceData/Calendar/calendarPage.h \
+ src/jceData/Grades/gradeCourse.h \
+ src/jceData/Grades/gradePage.h \
+ src/jceData/course.h \
+ src/jceData/page.h \
+ src/jceSettings/jcelogin.h \
+ src/jceSettings/jceLoginHtmlScripts.h \
+ src/jceSettings/user.h \
+ src/jceData/Calendar/calendarCourse.h
+
+SOURCES += \
+ main/CalendarTab/CalendarManager.cpp \
+ main/CourseTab/coursestablemanager.cpp \
+ main/LoginTab/loginhandler.cpp \
+ main/main.cpp \
+ main/mainscreen.cpp \
+ src/appDatabase/savedata.cpp \
+ src/jceConnection/jcesslclient.cpp \
+ src/jceData/Calendar/calendarPage.cpp \
+ src/jceData/Grades/gradeCourse.cpp \
+ src/jceData/Grades/gradePage.cpp \
+ src/jceData/page.cpp \
+ src/jceSettings/jcelogin.cpp \
+ src/jceSettings/user.cpp \
+ src/jceData/Calendar/calendarCourse.cpp
+
diff --git a/jceGrade.pro.user b/jceGrade.pro.user
new file mode 100644
index 0000000..c29c631
--- /dev/null
+++ b/jceGrade.pro.user
@@ -0,0 +1,251 @@
+
+
+
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop Qt 5.3.0 MinGW 32bit
+ Desktop Qt 5.3.0 MinGW 32bit
+ qt.53.win32_mingw482_kit
+ 0
+ 0
+ 0
+
+ D:/Dropbox/cpp/jceConQT/build-jceGrade-Desktop_Qt_5_3_0_MinGW_32bit-Debug
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ false
+ true
+
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+ true
+
+
+ D:/Dropbox/cpp/jceConQT/build-jceGrade-Desktop_Qt_5_3_0_MinGW_32bit-Release
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ false
+ true
+
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+ 2
+
+
+ 0
+ Deploy
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Deploy locally
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ jceGrade
+
+ Qt4ProjectManager.Qt4RunConfiguration:D:/Dropbox/cpp/jceConQT/jceAverageCalculator/jceGrade.pro
+
+ jceGrade.pro
+ false
+ false
+
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.EnvironmentId
+ {f3f3b933-8225-47b3-aa78-fc5de0bd714b}
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 15
+
+
diff --git a/main/CalendarTab/CalendarManager.cpp b/main/CalendarTab/CalendarManager.cpp
new file mode 100644
index 0000000..80dce68
--- /dev/null
+++ b/main/CalendarTab/CalendarManager.cpp
@@ -0,0 +1,17 @@
+#include "CalendarManager.h"
+
+CalendarManager::CalendarManager(QPlainTextEdit *ptr)
+{
+ this->ptr = ptr;
+}
+
+void CalendarManager::setCalendar(std::string html)
+{
+ cali = new CalendarPage(html);
+ QString text;
+ for (calendarCourse *a: *cali->getCourses())
+ {
+ text += QString::fromStdString(a->courseToString());
+ }
+ ptr->setPlainText(text);
+}
diff --git a/main/CalendarTab/CalendarManager.h b/main/CalendarTab/CalendarManager.h
new file mode 100644
index 0000000..dc91bf4
--- /dev/null
+++ b/main/CalendarTab/CalendarManager.h
@@ -0,0 +1,24 @@
+#ifndef CALENDARMANAGER_H
+#define CALENDARMANAGER_H
+
+#include "./src/jceData/Calendar/calendarPage.h"
+#include
+
+#include
+
+class CalendarManager
+{
+public:
+ CalendarManager(QPlainTextEdit *ptr);
+ ~CalendarManager()
+ {
+ delete cali;
+ }
+
+ void setCalendar(std::string html);
+private:
+ QPlainTextEdit * ptr;
+ CalendarPage * cali;
+};
+
+#endif // CALENDARMANAGER_H
diff --git a/main/CourseTab/coursestablemanager.cpp b/main/CourseTab/coursestablemanager.cpp
new file mode 100644
index 0000000..c32a4c2
--- /dev/null
+++ b/main/CourseTab/coursestablemanager.cpp
@@ -0,0 +1,251 @@
+#include "coursestablemanager.h"
+
+coursesTableManager::coursesTableManager(QTableWidget *ptr, user *usrPtr)
+{
+ this->gp = NULL;
+ this->us = usrPtr;
+ this->courseTBL = ptr;
+
+ /*
+ * Initilizing Table
+ */
+ courseTBL->setRowCount(0);
+ courseTBL->setColumnCount(COURSE_FIELDS);
+ QStringList mz;
+ mz << QObject::tr("Code") << QObject::tr("Name") << QObject::tr("Type") << QObject::tr("Points") << QObject::tr("Hours") << QObject::tr("Grade") << QObject::tr("Additions");
+ courseTBL->setHorizontalHeaderLabels(mz);
+ courseTBL->verticalHeader()->setVisible(true);
+ courseTBL->setSelectionMode(QAbstractItemView::SingleSelection);
+ courseTBL->setShowGrid(true);
+ courseTBL->setStyleSheet("QTableView {selection-background-color: red;}");
+}
+
+coursesTableManager::~coursesTableManager()
+{
+ courseTBL = NULL;
+ delete gp;
+ gp = NULL;
+}
+/**
+ * @brief coursesTableManager::insertJceCoursesIntoTable phrasing the course list to rows in table
+ */
+void coursesTableManager::insertJceCoursesIntoTable()
+{
+ for (gradeCourse *c: *gp->getCourses())
+ {
+ if (us->getInfluenceCourseOnly())
+ {
+ if (isCourseInfluence(c))
+ addRow(c);
+ }
+ else
+ addRow(c);
+ }
+}
+/**
+ * @brief coursesTableManager::setCoursesList creating courses list with given html page
+ * @param html
+ */
+void coursesTableManager::setCoursesList(std::string &html)
+{
+ gp = new GradePage(html);
+}
+/**
+ * @brief coursesTableManager::changes when user changes the table manually it updates it
+ * @param change string change
+ * @param row row index
+ * @param col col index
+ * @return if change has been done
+ */
+bool coursesTableManager::changes(QString change, int row, int col)
+{
+
+ bool isNumFlag = true;
+
+ int serialCourse = courseTBL->item(row,gradeCourse::CourseScheme::SERIAL)->text().toInt();
+ for (gradeCourse *c: *gp->getCourses())
+ {
+ if (c->getSerialNum() == serialCourse)
+ {
+ switch (col)
+ {
+ case (gradeCourse::CourseScheme::NAME):
+ c->setName(change.toStdString());
+ break;
+ case (gradeCourse::CourseScheme::TYPE):
+ c->setType(change.toStdString());
+ break;
+ case (gradeCourse::CourseScheme::POINTS):
+ {
+ change.toDouble(&isNumFlag);
+
+ if (!isNumFlag)
+ {
+ courseTBL->item(row,col)->setText(QString::number(c->getPoints()));
+ }
+ else
+ c->setPoints(change.toDouble());
+ 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.toStdString());
+ break;
+ }
+ break;
+ }
+ }
+ return isNumFlag;
+
+}
+/**
+ * @brief coursesTableManager::addRow adds row with given information
+ * @param courseToAdd if exists, add its information to table
+ */
+void coursesTableManager::addRow(const gradeCourse *courseToAdd)
+{
+ int i,j;
+ i = courseTBL->rowCount();
+ j = 0;
+ QTableWidgetItem *serial,*name,*type,*points,*hours,*grade,*addition;
+ const gradeCourse * c;
+ if (courseToAdd != NULL)
+ {
+ c = courseToAdd;
+ if (!isCourseAlreadyInserted(c->getSerialNum()))
+ {
+ courseTBL->setRowCount(courseTBL->rowCount()+1);
+ serial = new QTableWidgetItem(QString::number(c->getSerialNum()));
+ serial->setFlags(serial->flags() & ~Qt::ItemIsEditable);
+ points = new QTableWidgetItem(QString::number(c->getPoints()));
+ points->setFlags(serial->flags() & ~Qt::ItemIsEditable);
+ hours = new QTableWidgetItem(QString::number(c->getHours()));
+ hours->setFlags(serial->flags() & ~Qt::ItemIsEditable);
+ grade = new QTableWidgetItem(QString::number(c->getGrade()));
+ name = new QTableWidgetItem(QString::fromStdString(c->getName()));
+ name->setFlags(serial->flags() & ~Qt::ItemIsEditable);
+ type = new QTableWidgetItem(QString::fromStdString(c->getType()));
+ type->setFlags(serial->flags() & ~Qt::ItemIsEditable);
+ addition = new QTableWidgetItem(QString::fromStdString(c->getAddidtions()));
+
+ courseTBL->setItem(i,j++,serial);
+ courseTBL->setItem(i,j++,name);
+ courseTBL->setItem(i,j++,type);
+ courseTBL->setItem(i,j++,points);
+ courseTBL->setItem(i,j++,hours);
+ courseTBL->setItem(i,j++,grade);
+ courseTBL->setItem(i,j,addition);
+
+ }
+ }
+ else
+ {
+ }
+ courseTBL->resizeColumnsToContents();
+
+}
+double coursesTableManager::getAvg()
+{
+ if (this->gp != NULL)
+ return gp->getAvg();
+ return 0;
+}
+
+
+void coursesTableManager::influnceCourseChanged(bool ignoreCourseStatus)
+{
+ if (ignoreCourseStatus)
+ {
+ int i = 0;
+ while (i < courseTBL->rowCount())
+ {
+ if (courseTBL->item(i,gradeCourse::CourseScheme::POINTS)->text().compare("0") == 0)
+ courseTBL->removeRow(i--);
+ i++;
+ }
+ }
+ else
+ {
+ for (gradeCourse *c: *gp->getCourses())
+ {
+ if (!(isCourseAlreadyInserted(c->getSerialNum())))
+ if (c->getPoints() == 0)
+ addRow(c);
+ }
+ }
+
+}
+
+void coursesTableManager::clearTable()
+{
+ if (courseTBL->rowCount() == 0)
+ return;
+
+ int i = 0; //starting point
+ while (courseTBL->rowCount() > i)
+ {
+ gp->removeCourse(courseTBL->item(i,gradeCourse::CourseScheme::SERIAL)->text().toStdString());
+ courseTBL->removeRow(i);
+ }
+ gp = NULL;
+ courseTBL->repaint();
+}
+
+gradeCourse *coursesTableManager::getCourseByRow(int row)
+{
+ QString courseSerial = courseTBL->item(row,gradeCourse::CourseScheme::SERIAL)->text();
+ for (gradeCourse *c: *gp->getCourses())
+ {
+ if (c->getSerialNum() == courseSerial.toDouble())
+ return c;
+ }
+ return NULL;
+}
+
+bool coursesTableManager::isCourseAlreadyInserted(double courseID)
+{
+ int i=0;
+ for (i = 0; i < courseTBL->rowCount(); ++i)
+ {
+ QString courseSerial = courseTBL->item(i,gradeCourse::CourseScheme::SERIAL)->text();
+ if (QString::number(courseID) == courseSerial)
+ return true;
+ }
+ return false;
+}
+
+bool coursesTableManager::isCourseInfluence(const gradeCourse *courseToCheck)
+{
+ if (courseToCheck->getPoints() > 0)
+ return true;
+ return false;
+
+}
diff --git a/main/CourseTab/coursestablemanager.h b/main/CourseTab/coursestablemanager.h
new file mode 100644
index 0000000..4dabc58
--- /dev/null
+++ b/main/CourseTab/coursestablemanager.h
@@ -0,0 +1,43 @@
+#ifndef COURSESTABLEMANAGER_H
+#define COURSESTABLEMANAGER_H
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include "./src/jceData/Grades/gradePage.h"
+#include "./src/jceSettings/user.h"
+
+class coursesTableManager
+{
+public:
+ coursesTableManager(QTableWidget *, user *usrPtr);
+ ~coursesTableManager();
+ void insertJceCoursesIntoTable();
+ void setCoursesList(std::string &htmlPage);
+ bool changes(QString change, int row, int col);
+ void addRow(const gradeCourse * courseToAdd = 0);
+ double getAvg();
+
+ void influnceCourseChanged(bool status);
+ void clearTable();
+
+private:
+ QTableWidget *courseTBL;
+ GradePage *gp;
+ user *us;
+
+ gradeCourse * getCourseByRow(int row);
+ bool isCourseAlreadyInserted(double courseID);
+ bool isCourseInfluence(const gradeCourse *courseToCheck);
+};
+
+#endif // COURSESTABLEMANAGER_H
diff --git a/main/LoginTab/loginhandler.cpp b/main/LoginTab/loginhandler.cpp
new file mode 100644
index 0000000..5480bd7
--- /dev/null
+++ b/main/LoginTab/loginhandler.cpp
@@ -0,0 +1,141 @@
+#include "loginhandler.h"
+
+loginHandler::loginHandler(user *ptr): logggedInFlag(false)
+{
+ this->jceLog = new jceLogin(ptr);
+}
+void loginHandler::setPointers(QLabel *statusLabelPtr,QLineEdit *pswdEditPtr,QLineEdit *usrnmEditPtr)
+{
+
+ this->statusLabelPtr = statusLabelPtr;
+ this->pswdEditPtr = pswdEditPtr;
+ this->usrnmEditPtr = usrnmEditPtr;
+}
+
+bool loginHandler::makeConnection()
+{
+ if (this->jceLog == NULL)
+ return false;
+
+ try
+ {
+ jceLog->makeConnection();
+ }
+ catch (jceLogin::jceStatus &a)
+ {
+ int status = (int)a;
+ switch (status)
+ {
+ case jceLogin::JCE_YOU_ARE_IN:
+ {
+ logggedInFlag = true;
+ return logggedInFlag;
+ break;
+ }
+ case jceLogin::ERROR_ON_VALIDATION:
+ {
+ popMessage("Please Check Your Username & Password",false);
+
+ usrnmEditPtr->setDisabled(false);
+ pswdEditPtr->setDisabled(false);
+
+ pswdEditPtr->selectAll();
+ pswdEditPtr->setFocus();
+ return false;
+ }
+ case jceLogin::ERROR_ON_VALIDATION_USER_BLOCKED:
+ {
+ popMessage("You have been blocked by JCE, please try in a couple of minutes.");
+ jceLog->closeAll();
+ return false;
+ }
+ case jceLogin::ERROR_ON_OPEN_SOCKET:
+ {
+ popMessage("Please Check Your Internet Connection.");
+ jceLog->closeAll();
+ return false;
+ }
+ case jceLogin::JCE_NOT_CONNECTED:
+ {
+ jceLog->reConnect();
+ /*
+ * Fix: need to add a prompte window to ask user whether he wants to reconnect or not
+ */
+ break;
+ }
+ case jceLogin::ERROR_ON_GETTING_INFO:
+ {
+ popMessage("Recieve Request Time Out.");
+ jceLog->closeAll();
+ return false;
+ break;
+ }
+ case jceLogin::ERROR_ON_SEND_REQUEST:
+ {
+ popMessage("Send Request Time Out.");
+ jceLog->closeAll();
+ return false;
+ break;
+ }
+ }
+ }
+ return false;
+}
+
+
+bool loginHandler::isLoggedInFlag()
+{
+ return this->logggedInFlag;
+}
+
+void loginHandler::setLoginFlag(bool flag)
+{
+ this->logggedInFlag = flag;
+}
+
+QString loginHandler::getCurrentPageContect()
+{
+ QTextEdit phrase;
+ if (isLoggedInFlag())
+ phrase.setText(QString::fromStdString(jceLog->getPage()));
+ else
+ throw jceLogin::ERROR_ON_GETTING_INFO;
+
+ return phrase.toPlainText();
+}
+
+void loginHandler::makeDisconnectionRequest()
+{
+ jceLog->closeAll();
+ this->logggedInFlag = false;
+}
+
+int loginHandler::makeGradeRequest(int fromYear, int toYear, int fromSemester, int toSemester)
+{
+ if (isLoggedInFlag())
+ return jceLog->getGrades(fromYear, toYear, fromSemester, toSemester);
+ else
+ return jceLogin::JCE_NOT_CONNECTED;
+}
+
+int loginHandler::makeCalendarRequest(int year, int semester)
+{
+ if (isLoggedInFlag())
+ return jceLog->getCalendar(year,semester);
+ else
+ return jceLogin::JCE_NOT_CONNECTED;
+}
+void loginHandler::popMessage(QString message,bool addInfo)
+{
+ if (addInfo)
+ message.append("\nIf this message appear without reason, please contact me at liranbg@gmail.com");
+
+ QMessageBox msgBox;
+ msgBox.setWindowTitle("Error");
+ msgBox.setText(message);
+ msgBox.exec();
+ msgBox.setFocus();
+
+}
+
+
diff --git a/main/LoginTab/loginhandler.h b/main/LoginTab/loginhandler.h
new file mode 100644
index 0000000..2795d67
--- /dev/null
+++ b/main/LoginTab/loginhandler.h
@@ -0,0 +1,44 @@
+#ifndef LOGINHANDLER_H
+#define LOGINHANDLER_H
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "./src/jceSettings/jcelogin.h"
+#include "./src/appDatabase/savedata.h"
+
+
+class loginHandler
+{
+public:
+ loginHandler(user *ptr);
+ void setPointers(QLabel *statusLabelPtr,QLineEdit *pswdEditPtr,QLineEdit *usrnmEditPtr);
+ bool makeConnection();
+ bool isLoggedInFlag();
+ void setLoginFlag(bool flag);
+
+ QString getCurrentPageContect();
+
+ int makeGradeRequest(int fromYear, int toYear, int fromSemester, int toSemester);
+ int makeCalendarRequest(int year,int semester);
+
+ void makeDisconnectionRequest();
+
+private:
+
+ void popMessage(QString message, bool addInfo = true);
+
+ bool logggedInFlag;
+ jceLogin *jceLog;
+
+ QLabel *statusLabelPtr;
+ QLineEdit *pswdEditPtr;
+ QLineEdit *usrnmEditPtr;
+
+
+};
+
+#endif // LOGINHANDLER_H
diff --git a/main/mainscreen.cpp b/main/mainscreen.cpp
index 20cd284..39a3925 100644
--- a/main/mainscreen.cpp
+++ b/main/mainscreen.cpp
@@ -6,7 +6,7 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScr
{
ui->setupUi(this);
- this->setFixedSize(this->size()); //main not resizeable
+ //this->setFixedSize(this->size()); //main not resizeable
//Login Tab
@@ -21,9 +21,8 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScr
ui->statusBar->addPermanentWidget(statusLabel,1);
setLabelConnectionStatus(jceLogin::jceStatus::JCE_NOT_CONNECTED);
- //Course and Setting Tab
+ //Course, Setting, Calendar Tab
ui->CoursesTab->setDisabled(true);
- ui->SettingsTab->setDisabled(true);
ui->avgLCD->setPalette(QPalette(QPalette::WindowText,Qt::blue));
@@ -32,8 +31,7 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScr
this->userLoginSetting = new user("","");
this->courseTableMgr = new coursesTableManager(ui->coursesTable,userLoginSetting);
this->loginHandel = new loginHandler(userLoginSetting);
-
- updateDates();
+ this->calendar = new CalendarManager(ui->calendartext);
//check login File
SaveData::init();
@@ -51,7 +49,6 @@ MainScreen::~MainScreen()
delete loginHandel;
delete ui;
}
-/*** LOGIN TAB FUNCTIONS ***/
void MainScreen::on_loginButton_clicked()
{
if (loginHandel->isLoggedInFlag())
@@ -61,26 +58,32 @@ void MainScreen::on_loginButton_clicked()
uiSetConnectMode();
}
-void MainScreen::on_usrnmLineEdit_editingFinished()
+void MainScreen::on_pushButton_clicked()
{
- ui->usrnmLineEdit->setText(ui->usrnmLineEdit->text().toLower());
-}
-void MainScreen::on_keepLogin_clicked()
-{
- if (ui->keepLogin->isChecked())
- SaveData::save(ui->usrnmLineEdit->text(),ui->pswdLineEdit->text());
+ int status = 0;
+ if (loginHandel->isLoggedInFlag())
+ {
+ if ((status = loginHandel->makeCalendarRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_GRADE_PAGE_PASSED)
+ {
+ //Use it for debug. add plain text and change the object name to 'plainTextEdit' so you will get the html request
+ //ui->plainTextEdit->setPlainText(loginHandel->getCurrentPageContect());
+ calendar->setCalendar(loginHandel->getCurrentPageContect().toStdString());
+ }
- else
- SaveData::deleteData();
+ else if (status == jceLogin::JCE_NOT_CONNECTED)
+ {
+ QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
+ }
+ }
}
-/*** COURSES TAB FUNCTIONS ***/
+
void MainScreen::on_ratesButton_clicked()
{
std::string pageString;
int status = 0;
if (loginHandel->isLoggedInFlag())
{
- if ((status = loginHandel->makeGradeRequest()) == jceLogin::JCE_GRADE_PAGE_PASSED)
+ if ((status = loginHandel->makeGradeRequest(ui->spinBoxCoursesFromYear->value(),ui->spinBoxCoursesToYear->value(),ui->spinBoxCoursesFromSemester->value(),ui->spinBoxCoursesToSemester->value())) == jceLogin::JCE_GRADE_PAGE_PASSED)
{
pageString = loginHandel->getCurrentPageContect().toStdString();
courseTableMgr->setCoursesList(pageString);
@@ -91,7 +94,56 @@ void MainScreen::on_ratesButton_clicked()
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
}
}
+
+
+
}
+void MainScreen::on_checkBoxCoursesInfluence_toggled(bool checked)
+{
+ this->userLoginSetting->setInfluenceCourseOnly(checked);
+ this->courseTableMgr->influnceCourseChanged(checked);
+}
+void MainScreen::on_spinBoxCoursesFromYear_editingFinished()
+{
+ if (ui->spinBoxCoursesFromYear->value() > ui->spinBoxCoursesToYear->value())
+ {
+ ui->spinBoxCoursesFromYear->setValue(ui->spinBoxCoursesToYear->value());
+ ui->spinBoxCoursesFromYear->setFocus();
+ }
+
+}
+void MainScreen::on_spinBoxCoursesToYear_editingFinished()
+{
+ if (ui->spinBoxCoursesFromYear->value() > ui->spinBoxCoursesToYear->value())
+ {
+ ui->spinBoxCoursesToYear->setValue(ui->spinBoxCoursesFromYear->value());
+ ui->spinBoxCoursesToYear->setFocus();
+
+ }
+}
+void MainScreen::on_spinBoxCoursesFromSemester_editingFinished()
+{
+ if (ui->spinBoxCoursesFromYear->value() == ui->spinBoxCoursesToYear->value())
+ {
+ if (ui->spinBoxCoursesFromSemester->value() > ui->spinBoxCoursesToSemester->value())
+ {
+ ui->spinBoxCoursesFromSemester->setValue(ui->spinBoxCoursesToSemester->value());
+ ui->spinBoxCoursesFromSemester->setFocus();
+ }
+ }
+}
+void MainScreen::on_spinBoxCoursesToSemester_editingFinished()
+{
+ if (ui->spinBoxCoursesFromYear->value() == ui->spinBoxCoursesToYear->value())
+ {
+ if (ui->spinBoxCoursesFromSemester->value() > ui->spinBoxCoursesToSemester->value())
+ {
+ ui->spinBoxCoursesToSemester->setValue(ui->spinBoxCoursesFromSemester->value());
+ ui->spinBoxCoursesToSemester->setFocus();
+ }
+ }
+}
+
void MainScreen::on_coursesTable_itemChanged(QTableWidgetItem *item)
{
if (this->courseTableMgr->changes(item->text(),item->row(),item->column()))
@@ -99,79 +151,11 @@ void MainScreen::on_coursesTable_itemChanged(QTableWidgetItem *item)
else
QMessageBox::critical(this,"Error","Missmatching data");
}
-void MainScreen::on_clearTableButton_clicked()
-{
- courseTableMgr->clearTable();
- ui->avgLCD->display(courseTableMgr->getAvg());
-}
-
-/*** SETTING TAB FUNCTIONS ***/
-void MainScreen::on_spinBoxFromYear_editingFinished()
+void MainScreen::on_usrnmLineEdit_editingFinished()
{
- if (ui->spinBoxFromYear->value() > ui->spinBoxToYear->value())
- {
- ui->spinBoxFromYear->setValue(ui->spinBoxToYear->value());
- ui->spinBoxFromYear->setFocus();
- updateDates();
- }
- else
- updateDates();
+ ui->usrnmLineEdit->setText(ui->usrnmLineEdit->text().toLower());
}
-void MainScreen::on_spinBoxToYear_editingFinished()
-{
- if (ui->spinBoxFromYear->value() > ui->spinBoxToYear->value())
- {
- ui->spinBoxToYear->setValue(ui->spinBoxFromYear->value());
- ui->spinBoxToYear->setFocus();
- updateDates();
- }
- else
- updateDates();
-}
-void MainScreen::on_spinBoxFromSem_editingFinished()
-{
- if (ui->spinBoxFromYear->value() == ui->spinBoxToYear->value())
- {
- if (ui->spinBoxFromSem->value() > ui->spinBoxToSemester->value())
- {
- ui->spinBoxFromSem->setValue(ui->spinBoxToSemester->value());
- ui->spinBoxFromSem->setFocus();
- }
- }
- updateDates();
-}
-void MainScreen::on_spinBoxToSemester_editingFinished()
-{
- if (ui->spinBoxFromYear->value() == ui->spinBoxToYear->value())
- {
- if (ui->spinBoxFromSem->value() > ui->spinBoxToSemester->value())
- {
- ui->spinBoxToSemester->setValue(ui->spinBoxFromSem->value());
- ui->spinBoxToSemester->setFocus();
- }
- }
- updateDates();
-}
-void MainScreen::on_checkBox_toggled(bool checked)
-{
- this->userLoginSetting->setInfluenceCourseOnly(checked);
- this->courseTableMgr->influnceCourseChanged(checked);
-}
-/*
- * ------------------------------
- *
-*/
-void MainScreen::updateDates()
-{
- std::string fy,ty,fs,ts;
- fy = std::to_string(ui->spinBoxFromYear->value());
- ty = std::to_string(ui->spinBoxToYear->value());
- fs = std::to_string(ui->spinBoxFromSem->value());
- ts = std::to_string(ui->spinBoxToSemester->value());
- userLoginSetting->setDate(fy,fs,ty,ts);
-}
-
void MainScreen::uiSetDisconnectMode()
{
setLabelConnectionStatus(jceLogin::jceStatus::JCE_NOT_CONNECTED);
@@ -213,7 +197,6 @@ void MainScreen::uiSetConnectMode() //fix before distrbute
ui->loginButton->setText("&Logout");
this->ui->ratesButton->setEnabled(true);
ui->CoursesTab->setEnabled(true);
- ui->SettingsTab->setEnabled(true);
}
else
@@ -262,6 +245,12 @@ void MainScreen::on_actionCredits_triggered()
"");
}
+void MainScreen::on_clearTableButton_clicked()
+{
+
+ courseTableMgr->clearTable();
+ ui->avgLCD->display(courseTableMgr->getAvg());
+}
void MainScreen::on_actionExit_triggered()
{
@@ -269,7 +258,14 @@ void MainScreen::on_actionExit_triggered()
}
+void MainScreen::on_keepLogin_clicked()
+{
+ if (ui->keepLogin->isChecked())
+ SaveData::save(ui->usrnmLineEdit->text(),ui->pswdLineEdit->text());
+ else
+ SaveData::deleteData();
+}
void MainScreen::on_actionHow_To_triggered()
{
diff --git a/main/mainscreen.h b/main/mainscreen.h
index bf4b4a3..ddf79c3 100644
--- a/main/mainscreen.h
+++ b/main/mainscreen.h
@@ -10,8 +10,9 @@
#include
#include
-#include "coursestablemanager.h"
-#include "loginhandler.h"
+#include "./CourseTab/coursestablemanager.h"
+#include "./LoginTab/loginhandler.h"
+#include "./CalendarTab/CalendarManager.h"
#define StatusIconHeight 35
namespace Ui {
@@ -30,18 +31,16 @@ private slots:
void on_ratesButton_clicked();
- void on_spinBoxFromYear_editingFinished();
+ void on_spinBoxCoursesFromYear_editingFinished();
- void on_spinBoxFromSem_editingFinished();
+ void on_spinBoxCoursesFromSemester_editingFinished();
- void on_spinBoxToYear_editingFinished();
+ void on_spinBoxCoursesToYear_editingFinished();
- void on_spinBoxToSemester_editingFinished();
+ void on_spinBoxCoursesToSemester_editingFinished();
void on_loginButton_clicked();
- void on_checkBox_toggled(bool checked);
-
void on_usrnmLineEdit_editingFinished();
void on_actionCredits_triggered();
@@ -55,10 +54,13 @@ private slots:
void on_keepLogin_clicked();
void on_actionHow_To_triggered();
-
+
+ void on_pushButton_clicked();
+
+ void on_checkBoxCoursesInfluence_toggled(bool checked);
+
private:
- void updateDates();
void uiSetDisconnectMode();
void uiSetConnectMode();
void setLabelConnectionStatus(jceLogin::jceStatus statusDescription);
@@ -67,6 +69,7 @@ private:
user *userLoginSetting;
+ CalendarManager * calendar;
coursesTableManager *courseTableMgr;
loginHandler *loginHandel;
diff --git a/main/mainscreen.ui b/main/mainscreen.ui
index 2f62dd3..71993fc 100644
--- a/main/mainscreen.ui
+++ b/main/mainscreen.ui
@@ -7,7 +7,7 @@
0
0
855
- 649
+ 517
@@ -61,7 +61,7 @@ background: qlineargradient(spread:pad, x1:0.496, y1:0, x2:0.508, y2:1, stop:0 r
QTabWidget::Rounded
- 1
+ 0
false
@@ -303,7 +303,7 @@ font-size: 15px;
- Courses
+ GPA
-
@@ -311,7 +311,7 @@ font-size: 15px;
0
-
-
+
-
@@ -330,7 +330,7 @@ font-size: 15px;
- -
+
-
-
@@ -375,7 +375,7 @@ font-size: 15px;
-
-
-
+
Average:
@@ -410,260 +410,211 @@ font-size: 15px;
-
-
-
-
-
-
- false
-
-
-
- 0
- 0
-
-
-
- Settings
-
-
-
-
- 20
- 20
- 251
- 159
-
-
-
- -
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
-
-
-
-
-
-
-
-
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 48
- 20
-
-
-
-
- -
-
-
-
-
-
- Semester
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 50
- 20
-
-
-
-
- -
-
-
- Year
-
-
-
-
-
-
-
- -
-
-
-
-
-
- QLayout::SetMinimumSize
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 40
- 16777215
-
-
-
- From
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 40
- 16777215
-
-
-
- To
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- 3
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- false
-
-
- false
-
-
- 2009
-
-
- 2015
-
-
- 2009
-
-
-
-
-
- -
-
-
-
-
-
- 3
-
-
- 3
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- 2010
-
-
- 2026
-
-
- 2015
-
-
-
-
-
-
-
-
-
-
-
- -
-
+
-
+
+
-
+
- Only influence Courses
+ Only Main Courses
-
- false
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ From
+
+
+
+ -
+
+
+ Year:
+
+
+
+ -
+
+
+ 2008
+
+
+ 2015
+
+
+ 2011
+
+
+
+ -
+
+
+ Semester:
+
+
+
+ -
+
+
+ 1
+
+
+ 3
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ To
+
+
+
+ -
+
+
+ Year:
+
+
+
+ -
+
+
+ 2008
+
+
+ 2015
+
+
+ 2014
+
+
+
+ -
+
+
+ Semester
+
+
+
+ -
+
+
+ 1
+
+
+ 3
+
+
+ 3
-
-
-
-
+
+
+
+
+
+
+
+ Calendar
+
+
+ -
+
+
-
+
+
-
+
+
-
+
+
+ 2012
+
+
+ 2020
+
+
+ 2014
+
+
+
+ -
+
+
+ 1
+
+
+ 3
+
+
+ 2
+
+
+
+ -
+
+
+ Get Calendar
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::RightToLeft
+
+
+
+
+
+
+
+
@@ -675,7 +626,7 @@ font-size: 15px;
0
0
855
- 29
+ 21