diff --git a/jceGrade.pro b/jceGrade.pro index 011cfa6..ad64892 100644 --- a/jceGrade.pro +++ b/jceGrade.pro @@ -1,67 +1,68 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2014-05-31T19:49:42 -# -#------------------------------------------------- - -QT += core gui network widgets -TARGET = jceGrade -TEMPLATE = app -RC_FILE = appConfigure.rc -CONFIG += qt c++11 -CONFIG += console static - -TRANSLATIONS = jce_en.ts \ - jce_he.ts - -FORMS += \ - main/mainscreen.ui \ - src/jceData/Calendar/calendarDialog.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 \ - src/jceData/Calendar/calendarSchedule.h \ - src/jceData/CSV/csv_exporter.h \ - src/appDatabase/simplecrypt.h \ - src/jceData/Calendar/calendarDialog.h \ - src/jce_logger.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 \ - src/jceData/Calendar/calendarSchedule.cpp \ - src/jceData/CSV/csv_exporter.cpp \ - src/appDatabase/simplecrypt.cpp \ - src/jceData/Calendar/calendarDialog.cpp \ - src/jce_logger.cpp +#------------------------------------------------- +# +# Project created by QtCreator 2014-05-31T19:49:42 +# +#------------------------------------------------- + +QT += core gui network widgets + +CONFIG += qt c++11 +CONFIG += console static + +TARGET = jceManager +TEMPLATE = app +VERSION = 1.0.0 + +RC_FILE = appConfigure.rc +TRANSLATIONS = jce_en.ts \ + jce_he.ts + +FORMS += \ + main/mainscreen.ui \ + src/jceData/Calendar/calendarDialog.ui + +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 \ + src/jceData/Calendar/calendarSchedule.h \ + src/jceData/CSV/csv_exporter.h \ + src/appDatabase/simplecrypt.h \ + src/jceData/Calendar/calendarDialog.h \ + src/appDatabase/jce_logger.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 \ + src/jceData/Calendar/calendarSchedule.cpp \ + src/jceData/CSV/csv_exporter.cpp \ + src/appDatabase/simplecrypt.cpp \ + src/jceData/Calendar/calendarDialog.cpp \ + src/appDatabase/jce_logger.cpp diff --git a/main/CalendarTab/CalendarManager.cpp b/main/CalendarTab/CalendarManager.cpp index 8a9d4e5..d6c5041 100644 --- a/main/CalendarTab/CalendarManager.cpp +++ b/main/CalendarTab/CalendarManager.cpp @@ -1,8 +1,9 @@ #include "CalendarManager.h" -CalendarManager::CalendarManager(calendarSchedule *ptr) +CalendarManager::CalendarManager(QGridLayout *ptr) { - this->caliSchedPtr = ptr; + caliSchedPtr = new calendarSchedule(); + ptr->addWidget(caliSchedPtr); caliDialog = new CalendarDialog(); } diff --git a/main/CalendarTab/CalendarManager.h b/main/CalendarTab/CalendarManager.h index 98ba20a..a0ce3b1 100644 --- a/main/CalendarTab/CalendarManager.h +++ b/main/CalendarTab/CalendarManager.h @@ -5,13 +5,17 @@ #include "./src/jceData/Calendar/calendarSchedule.h" #include "./src/jceData/CSV/csv_exporter.h" #include "./src/jceData/Calendar/calendarDialog.h" -#include + +#include +#include #include -class CalendarManager +class CalendarManager : public QObject { + Q_OBJECT + public: - CalendarManager(calendarSchedule *ptr); + CalendarManager(QGridLayout *ptr); ~CalendarManager() { delete caliSchedPtr; diff --git a/main/LoginTab/loginhandler.cpp b/main/LoginTab/loginhandler.cpp index 9d0d66a..1a46f7e 100644 --- a/main/LoginTab/loginhandler.cpp +++ b/main/LoginTab/loginhandler.cpp @@ -17,10 +17,10 @@ loginHandler::loginHandler(user *ptr, QStatusBar *statusBarPtr,QPushButton *logi } bool loginHandler::login(QString username,QString password) { - qDebug() << Q_FUNC_INFO << "Login with username and password"; + qDebug() << Q_FUNC_INFO << "logging in with username and password"; if (isLoggedInFlag()) { - qDebug() << Q_FUNC_INFO << "Loging out"; + qDebug() << Q_FUNC_INFO << "we are already connected. Logging out and return false"; logout(); return false; } diff --git a/main/mainscreen.cpp b/main/mainscreen.cpp index fb261e3..f249830 100644 --- a/main/mainscreen.cpp +++ b/main/mainscreen.cpp @@ -2,7 +2,7 @@ #include "ui_mainscreen.h" -MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScreen) +MainScreen::MainScreen(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainScreen) { ui->setupUi(this); //this->setFixedSize(this->size()); //main not resizeable @@ -20,28 +20,30 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScr ui->statusBar->setMaximumSize(this->geometry().width(),STATUS_ICON_HEIGH); ui->statusBar->showMessage(tr("Ready")); - //Course, Calendar Tab - calendarSchedule * calendarSchedulePtr = new calendarSchedule(); - ui->calendarGridLayoutMain->addWidget(calendarSchedulePtr); + //GPA Tab ui->avgLCD->setPalette(QPalette(QPalette::WindowText,Qt::blue)); //Pointer allocating + qDebug() << Q_FUNC_INFO << "Allocating pointers"; this->userLoginSetting = new user("",""); this->courseTableMgr = new coursesTableManager(ui->coursesTable,userLoginSetting); this->loginHandel = new loginHandler(userLoginSetting,ui->statusBar,ui->loginButton); - this->calendar = new CalendarManager(calendarSchedulePtr); + this->calendar = new CalendarManager(ui->calendarGridLayoutMain); this->data = new SaveData(); //check login File if (data->isSaved()) { + qDebug() << Q_FUNC_INFO << "Loading data from file"; ui->usrnmLineEdit->setText(data->getUsername()); ui->pswdLineEdit->setText(data->getPassword()); ui->keepLogin->setChecked(true); } //language + qDebug() << Q_FUNC_INFO << "Checking locale"; checkLocale(); + qDebug() << Q_FUNC_INFO << "Ready."; } MainScreen::~MainScreen() @@ -53,13 +55,11 @@ MainScreen::~MainScreen() delete data; delete ui; } -//EVENTS ON STATUS BAR //EVENTS ON LOGIN TAB void MainScreen::on_loginButton_clicked() { - qDebug() << Q_FUNC_INFO; - bool isSettingsOk = false; + qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName(); if ((ui->usrnmLineEdit->text().isEmpty()) || (ui->pswdLineEdit->text().isEmpty())) { if (ui->usrnmLineEdit->text().isEmpty()) @@ -80,18 +80,25 @@ void MainScreen::on_loginButton_clicked() } else { - isSettingsOk = true; ui->labelUsrInputStatus->setVisible(false); ui->labelPswInputStatus->setVisible(false); } - + qDebug() << Q_FUNC_INFO << "login session start"; if (this->loginHandel->login(ui->usrnmLineEdit->text(),ui->pswdLineEdit->text()) == true) { + qDebug() << Q_FUNC_INFO << "login session end with true"; ui->pswdLineEdit->setDisabled(true); ui->usrnmLineEdit->setDisabled(true); + if (ui->keepLogin->isChecked()) + { + qDebug() << Q_FUNC_INFO << "saving data"; + data->setUsername(ui->usrnmLineEdit->text()); + data->setPassword(ui->pswdLineEdit->text()); + } } else { + qDebug() << Q_FUNC_INFO << "login session end with end"; ui->pswdLineEdit->setDisabled(false); ui->usrnmLineEdit->setDisabled(false); @@ -99,8 +106,10 @@ void MainScreen::on_loginButton_clicked() } void MainScreen::on_keepLogin_clicked() { + qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName(); if (ui->keepLogin->isChecked()) { + qDebug() << Q_FUNC_INFO << "saving data"; data->setUsername(ui->usrnmLineEdit->text()); data->setPassword(ui->pswdLineEdit->text()); } @@ -109,15 +118,17 @@ void MainScreen::on_keepLogin_clicked() } void MainScreen::on_usrnmLineEdit_editingFinished() { + qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName(); ui->usrnmLineEdit->setText(ui->usrnmLineEdit->text().toLower()); } //EVENTS ON GPA TAB void MainScreen::on_ratesButton_clicked() { + qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName(); if (!checkIfValidDates()) { - qWarning() << "MainScreen::on_ratesButton_clicked; Invalid dates! "; + qWarning() << Q_FUNC_INFO << "Invalid dates! return"; QMessageBox::critical(this,tr("Error"),tr("Invalid Dates.\nMake Sure everything is correct and try again")); return; } @@ -127,16 +138,22 @@ void MainScreen::on_ratesButton_clicked() { if ((status = loginHandel->makeGradeRequest(ui->spinBoxCoursesFromYear->value(), ui->spinBoxCoursesToYear->value(),ui->spinBoxCoursesFromSemester->value(), - ui->spinBoxCoursesToSemester->value())) == jceLogin::JCE_GRADE_PAGE_PASSED) + ui->spinBoxCoursesToSemester->value())) == jceLogin::JCE_PAGE_PASSED) { + qDebug() << Q_FUNC_INFO << "grade page is ready"; pageString = loginHandel->getCurrentPageContect(); courseTableMgr->setCoursesList(pageString); courseTableMgr->insertJceCoursesIntoTable(); } else if (status == jceLogin::JCE_NOT_CONNECTED) { + qWarning() << Q_FUNC_INFO << "not connected"; QMessageBox::critical(this,tr("Error"),tr("Not Connected")); } + else + { + qCritical() << Q_FUNC_INFO << "grade get ended with" << status; + } } } bool MainScreen::checkIfValidDates() @@ -157,6 +174,7 @@ bool MainScreen::checkIfValidDates() } void MainScreen::on_checkBoxCoursesInfluence_toggled(bool checked) { + qDebug() << Q_FUNC_INFO << "only main courses toggeled" << checked; this->userLoginSetting->setInfluenceCourseOnly(checked); this->courseTableMgr->influnceCourseChanged(checked); } @@ -179,38 +197,49 @@ void MainScreen::on_spinBoxCoursesToSemester_valueChanged(int arg1) } void MainScreen::on_coursesTable_itemChanged(QTableWidgetItem *item) { + qDebug() << Q_FUNC_INFO << "item at row:" << item->row() << " colum:" << item->column() << " text: " << item->text(); if (this->courseTableMgr->changes(item->text(),item->row(),item->column())) ui->avgLCD->display(courseTableMgr->getAvg()); else + { + qWarning() << Q_FUNC_INFO << "missmatch data"; QMessageBox::critical(this,tr("Error"),tr("Missmatching data")); + } } void MainScreen::on_clearTableButton_clicked() { + qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName(); courseTableMgr->clearTable(); ui->avgLCD->display(courseTableMgr->getAvg()); } //EVENTS ON CALENDAR TAB void MainScreen::on_getCalendarBtn_clicked() { + qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName(); int status = 0; if (loginHandel->isLoggedInFlag()) { - if ((status = loginHandel->makeCalendarRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_GRADE_PAGE_PASSED) + if ((status = loginHandel->makeCalendarRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_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->resetTable(); calendar->setCalendar(loginHandel->getCurrentPageContect()); + qDebug() << Q_FUNC_INFO << "calendar is loaded"; } else if (status == jceLogin::JCE_NOT_CONNECTED) { + qWarning() << Q_FUNC_INFO << "not connected"; QMessageBox::critical(this,tr("Error"),tr("Not Connected")); } + else + qCritical() << Q_FUNC_INFO << "calendar get ended with" << status; } } void MainScreen::on_exportToCVSBtn_clicked() { + qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName(); if (loginHandel->isLoggedInFlag()) { this->calendar->exportCalendarCSV(); @@ -220,40 +249,54 @@ void MainScreen::on_exportToCVSBtn_clicked() //EVENTS ON MENU BAR void MainScreen::on_actionCredits_triggered() { - QMessageBox::about(this, "About", tr("CREDITS-ROOL-UP1") + " v1.0

" - + tr("CREDITS-ROOL-UP2")+"
GNU LESSER GENERAL PUBLIC LICENSE V2
" - + tr("CREDITS-ROOL-UP3")+"
" - "jceAverageCalculator Repository" - "

"+tr("CREDITS-ROOL-UP4")+" Jce Connection

" - +tr("DevBy")+":" - ""); + qDebug() << Q_FUNC_INFO; + QMessageBox::about(this, "About", + tr("Jce Manager")+ + "v1.0.0

" + +tr("License:")+ + "
GNU LESSER GENERAL PUBLIC LICENSE V2.1
" + +"
"+ + "JceManager Repository"+ + "

" + +tr("powered by: ")+ + "Jce Connection

" + +tr("DevBy")+ + ":" + ); } void MainScreen::on_actionExit_triggered() { + qDebug() << Q_FUNC_INFO; exit(0); } void MainScreen::on_actionHow_To_triggered() { + qDebug() << Q_FUNC_INFO; QMessageBox::information(this,"How To", - "How To.." - "
    " - "
  • "+tr("HELP1")+"
  • " - "
  • "+tr("HELP2")+"
  • " - "
  • "+tr("HELP3")+"
  • " - "
  • "+tr("HELP4")+"
  • " - "
  • "+tr("HELP5")+"
  • " - "
"); + "" + +tr("Guide")+ + "

  • " + +tr("login")+ + "

  • " + +tr("get gpa")+ + "

  • " + +tr("changing gpa")+ + "

  • " + +tr("getting calendar")+ + "

  • " + +tr("exporting")+ + "
"); } void MainScreen::on_actionHebrew_triggered() { + qDebug() << Q_FUNC_INFO; if (ui->actionEnglish->isChecked() || ui->actionOS_Default->isChecked()) { ui->actionEnglish->setChecked(false); ui->actionOS_Default->setChecked(false); - qDebug() << "Changed Language to hebrew"; + qDebug() << Q_FUNC_INFO << "Changed Language to hebrew"; data->setLocal("he"); QMessageBox::information(this,tr("Settings"),tr("Your settings will take effect next time you start the program"),QMessageBox::Ok); } @@ -262,11 +305,12 @@ void MainScreen::on_actionHebrew_triggered() } void MainScreen::on_actionEnglish_triggered() { + qDebug() << Q_FUNC_INFO; if (ui->actionHebrew->isChecked() || ui->actionOS_Default->isChecked()) { ui->actionHebrew->setChecked(false); ui->actionOS_Default->setChecked(false); - qDebug() << "Changed Language to English"; + qDebug() << Q_FUNC_INFO << "Changed Language to English"; data->setLocal("en"); QMessageBox::information(this,"Settings",tr("Your settings will take effect next time you start the program"),QMessageBox::Ok); } @@ -275,11 +319,12 @@ void MainScreen::on_actionEnglish_triggered() } void MainScreen::on_actionOS_Default_triggered() { + qDebug() << Q_FUNC_INFO; if (ui->actionHebrew->isChecked() || ui->actionEnglish->isChecked()) { ui->actionHebrew->setChecked(false); ui->actionEnglish->setChecked(false); - qDebug() << "Changed Language to OS Default"; + qDebug() << Q_FUNC_INFO << "Changed Language to OS Default"; data->setLocal("default"); QMessageBox::information(this,tr("Settings"),tr("Your settings will take effect next time you start the program"),QMessageBox::Ok); } diff --git a/main/mainscreen.h b/main/mainscreen.h index 9c641b6..a6186f9 100644 --- a/main/mainscreen.h +++ b/main/mainscreen.h @@ -7,9 +7,6 @@ #include #include -#include -#include - #include "./CourseTab/coursestablemanager.h" #include "./LoginTab/loginhandler.h" #include "./CalendarTab/CalendarManager.h" @@ -82,7 +79,6 @@ private: CalendarManager * calendar; coursesTableManager *courseTableMgr; - loginHandler *loginHandel; }; diff --git a/main/mainscreen.ui b/main/mainscreen.ui index 885971b..60f58d6 100644 --- a/main/mainscreen.ui +++ b/main/mainscreen.ui @@ -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 diff --git a/src/jce_logger.cpp b/src/appDatabase/jce_logger.cpp similarity index 100% rename from src/jce_logger.cpp rename to src/appDatabase/jce_logger.cpp diff --git a/src/jce_logger.h b/src/appDatabase/jce_logger.h similarity index 100% rename from src/jce_logger.h rename to src/appDatabase/jce_logger.h diff --git a/src/jceSettings/jcelogin.cpp b/src/jceSettings/jcelogin.cpp index b0ec4ae..5a25587 100644 --- a/src/jceSettings/jcelogin.cpp +++ b/src/jceSettings/jcelogin.cpp @@ -188,9 +188,9 @@ int jceLogin::getCalendar(int year, int semester) if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getCalendar(*jceA,year,semester))))) { if (!(JceConnector->recieveData(*recieverPage,false))) - return jceLogin::ERROR_ON_GETTING_GRADES; + return jceLogin::ERROR_ON_GETTING_PAGE; else - return jceLogin::JCE_GRADE_PAGE_PASSED; + return jceLogin::JCE_PAGE_PASSED; } else return jceLogin::ERROR_ON_SEND_REQUEST; @@ -211,9 +211,9 @@ int jceLogin::getGrades(int fromYear, int toYear, int fromSemester, int toSemest if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getGradesPath(*jceA,fromYear, toYear, fromSemester, toSemester))))) { if (!(JceConnector->recieveData(*recieverPage,false))) - return jceLogin::ERROR_ON_GETTING_GRADES; + return jceLogin::ERROR_ON_GETTING_PAGE; else - return jceLogin::JCE_GRADE_PAGE_PASSED; + return jceLogin::JCE_PAGE_PASSED; } else return jceLogin::ERROR_ON_SEND_REQUEST; diff --git a/src/jceSettings/jcelogin.h b/src/jceSettings/jcelogin.h index 622843a..ede8514 100644 --- a/src/jceSettings/jcelogin.h +++ b/src/jceSettings/jcelogin.h @@ -24,12 +24,12 @@ public: ERROR_ON_OPEN_SOCKET, ERROR_ON_SEND_REQUEST, ERROR_ON_GETTING_INFO, - ERROR_ON_GETTING_GRADES, + ERROR_ON_GETTING_PAGE, JCE_START_VALIDATING_PROGRESS, JCE_VALIDATION_PASSED, JCE_YOU_ARE_IN, - JCE_GRADE_PAGE_PASSED + JCE_PAGE_PASSED }; int makeConnection();