diff --git a/jceGrade.pro.user b/jceGrade.pro.user new file mode 100644 index 0000000..459b4a0 --- /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 + + qt5 static + qt5 static + {dd51eedf-ba55-40ee-bad5-3104352e8e7b} + 1 + 0 + 0 + + C:/Users/liran/Dropbox/cpp/jceConQT/build-jceGrade-qt5_static-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 + + + C:/Users/liran/Dropbox/cpp/jceConQT/build-jceGrade-qt5_static-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:C:/Users/liran/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/jceGrade.pro.user.63df886 b/jceGrade.pro.user.63df886 new file mode 100644 index 0000000..97e82f1 --- /dev/null +++ b/jceGrade.pro.user.63df886 @@ -0,0 +1,263 @@ + + + + + + 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 + Desktop + {7f000311-5c80-4b7b-b77f-8740d071d018} + 0 + 0 + 0 + + /home/liran/Dropbox/cpp/jceConQT/build-jceGrade-Desktop-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/liran/Dropbox/cpp/jceConQT/build-jceGrade-Desktop-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + 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:/home/liran/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 + {63df8866-8eec-41bd-97e5-f9d818bdbcac} + + + ProjectExplorer.Project.Updater.FileVersion + 15 + + diff --git a/main/coursestablemanager.cpp b/main/coursestablemanager.cpp index b877956..276702a 100644 --- a/main/coursestablemanager.cpp +++ b/main/coursestablemanager.cpp @@ -56,9 +56,13 @@ void coursesTableManager::setCoursesList(std::string &html) * @param change string change * @param row row index * @param col col index + * @return if change has been done */ -void coursesTableManager::changes(std::string change, int row, int col) +bool coursesTableManager::changes(QString change, int row, int col) { + + bool isNumFlag = true; + int serialCourse = courseTBL->item(row,Course::CourseScheme::SERIAL)->text().toInt(); for (Course *c: *gp->getCourses()) { @@ -67,27 +71,60 @@ void coursesTableManager::changes(std::string change, int row, int col) switch (col) { case (Course::CourseScheme::NAME): - c->setName(change); + c->setName(change.toStdString()); break; case (Course::CourseScheme::TYPE): - c->setType(change); + c->setType(change.toStdString()); break; case (Course::CourseScheme::POINTS): - c->setPoints(stod(change)); + { + change.toDouble(&isNumFlag); + + if (!isNumFlag) + { + courseTBL->item(row,col)->setText(QString::number(c->getPoints())); + } + else + c->setPoints(change.toDouble()); break; + } case (Course::CourseScheme::HOURS): - c->setHours(stod(change)); + { + change.toDouble(&isNumFlag); + + if (!isNumFlag) + { + courseTBL->item(row,col)->setText(QString::number(c->getHours())); + } + else + c->setHours(change.toDouble()); break; + } case (Course::CourseScheme::GRADE): - c->setGrade(stod(change)); + { + 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 (Course::CourseScheme::ADDITION): - c->setAdditions(change); + c->setAdditions(change.toStdString()); break; } break; } } + return isNumFlag; } /** diff --git a/main/coursestablemanager.h b/main/coursestablemanager.h index 0748947..5ce2e85 100644 --- a/main/coursestablemanager.h +++ b/main/coursestablemanager.h @@ -8,7 +8,8 @@ #include #include #include -#include +#include +#include #include @@ -23,7 +24,7 @@ public: ~coursesTableManager(); void insertJceCoursesIntoTable(); void setCoursesList(std::string &htmlPage); - void changes(std::string change, int row, int col); + bool changes(QString change, int row, int col); void addRow(const Course * courseToAdd = 0); double getAvg(); diff --git a/main/mainscreen.cpp b/main/mainscreen.cpp index 70d7b90..4f9c420 100644 --- a/main/mainscreen.cpp +++ b/main/mainscreen.cpp @@ -5,29 +5,36 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScreen) { ui->setupUi(this); - // this->setWindowFlags(this->windowFlags() | Qt::MSWindowsFixedSizeDialogHint); this->setFixedSize(this->size()); //main not resizeable + + //Login Tab ui->pswdLineEdit->setEchoMode((QLineEdit::Password)); + + //Status Bar ui->statusBar->setStyleSheet("QStatusBar::item { border: 0px solid black };"); ButtomStatusLabel = new QLabel(this); statusLabel = new QLabel(this); - - - - ui->CoursesTab->setDisabled(true); - ui->SettingsTab->setDisabled(true); ui->statusBar->setMaximumSize(this->geometry().width(),StatusIconHeight); ui->statusBar->addPermanentWidget(ButtomStatusLabel,0); ui->statusBar->addPermanentWidget(statusLabel,1); + setLabelConnectionStatus(jceLogin::jceStatus::JCE_NOT_CONNECTED); + //Course and Setting Tab + ui->CoursesTab->setDisabled(true); + ui->SettingsTab->setDisabled(true); + ui->avgLCD->setPalette(QPalette(QPalette::WindowText,Qt::blue)); + + + + //Pointer allocating this->jceLog = NULL; this->userLoginSetting = new user("",""); - this->courseTableMgr = new coursesTableManager(ui->coursesTable,userLoginSetting); + updateDates(); - setLabelConnectionStatus(jceLogin::jceStatus::JCE_NOT_CONNECTED); + } @@ -103,15 +110,14 @@ void MainScreen::on_spinBoxToSemester_editingFinished() void MainScreen::on_coursesTable_itemChanged(QTableWidgetItem *item) { - this->courseTableMgr->changes(item->text().toStdString(),item->row(),item->column()); - ui->avgLCD->display(courseTableMgr->getAvg()); + if (this->courseTableMgr->changes(item->text(),item->row(),item->column())) + ui->avgLCD->display(courseTableMgr->getAvg()); + else + QMessageBox::critical(this,"Error","Missmatching data"); } void MainScreen::on_loginButton_clicked() { - setLabelConnectionStatus(jceLogin::jceStatus::JCE_START_VALIDATING_PROGRESS); - - if (this->jceLog == NULL) uiSetConnectMode(); else @@ -167,6 +173,8 @@ void MainScreen::uiSetConnectMode() //add icon near to username and password to mark it return; } + setLabelConnectionStatus(jceLogin::jceStatus::JCE_START_VALIDATING_PROGRESS); + username = ui->usrnmLineEdit->text().toStdString(); password = ui->pswdLineEdit->text().toStdString(); @@ -220,7 +228,7 @@ void MainScreen::setLabelConnectionStatus(jceLogin::jceStatus statusDescription) void MainScreen::on_actionCredits_triggered() { QMessageBox::about(this, "About", " A tiny application to calculate your grades average.

" - "This software is licensed under the
GNU LESSER GENERAL PUBLIC LICENSE V2
" + "This software is licensed under Qt5's
GNU LESSER GENERAL PUBLIC LICENSE V2
" "The source code is available at github:
" "jceAverageCalculator Repository" "

This front end is Powered by Jce Connection

" @@ -246,3 +254,4 @@ void MainScreen::on_actionExit_triggered() { exit(0); } + diff --git a/main/mainscreen.h b/main/mainscreen.h index fd44226..2da50a4 100644 --- a/main/mainscreen.h +++ b/main/mainscreen.h @@ -41,8 +41,6 @@ private slots: void on_spinBoxToSemester_editingFinished(); - void on_coursesTable_itemChanged(QTableWidgetItem *item); - void on_loginButton_clicked(); void on_checkBox_toggled(bool checked); @@ -55,6 +53,8 @@ private slots: void on_actionExit_triggered(); + void on_coursesTable_itemChanged(QTableWidgetItem *item); + private: void updateDates(); diff --git a/main/mainscreen.ui b/main/mainscreen.ui index 4094da2..da52fb8 100644 --- a/main/mainscreen.ui +++ b/main/mainscreen.ui @@ -6,8 +6,8 @@ 0 0 - 676 - 717 + 855 + 636 @@ -45,29 +45,14 @@ background: qlineargradient(spread:pad, x1:0.496, y1:0, x2:0.508, y2:1, stop:0 r - - + + true - #CoursesTab { -background: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #eef, stop: 1 #ccf); -border: none; -} -#LoginTab { -background: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #eef, stop: 1 #ccf); -border: none; -} -#SettingsTab { -background: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #eef, stop: 1 #ccf); -border: none; -} -#DebugTab { -background: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #eef, stop: 1 #ccf); -border: none; -} + QTabWidget::North @@ -88,29 +73,47 @@ border: none; false + + + + + + Login - - - - 200 - 230 - 301 - 146 - + + + QLayout::SetMinimumSize - - - 0 - 0 - + + 200 - - #LoginFrame { + + 100 + + + 200 + + + 100 + + + 0 + + + + + + 0 + 0 + + + + #LoginFrame { border: 3px solid rgb(160, 165, 170); border-radius: 40px; @@ -143,179 +146,160 @@ font-size: 15px; font-weight: bold; font-size: 15px; } - - - QFrame::StyledPanel - - - QFrame::Raised - - - - QLayout::SetDefaultConstraint - - - 20 - - - 15 - - - 20 - - - 15 - - - - - 0 + + + QFrame::StyledPanel + + + QFrame::Raised + + + + QLayout::SetDefaultConstraint - - - - + + 20 + + + 15 + + + 20 + + + 15 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - + 0 0 + + + - <color=#000000>Username - - - Qt::RichText - - - - - - - - - - - 0 - 0 - - - - Qt::ImhLatinOnly|Qt::ImhNoPredictiveText - - - 20 - - - true + Login - - - - 0 - + + 0 - - - - 0 - 0 - - - - Password - - - Qt::RichText - - + + + + + + 0 + 0 + + + + Qt::ImhLatinOnly|Qt::ImhNoPredictiveText + + + 20 + + + true + + + + + + + + 0 + 0 + + + + <color=#000000>Username + + + Qt::RichText + + + + - - - - 0 - 0 - + + + 0 - - Qt::ImhHiddenText|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhSensitiveData + + 0 - - 20 - - - QLineEdit::Password - - - true - - + + + + + 0 + 0 + + + + Password + + + Qt::RichText + + + + + + + + 0 + 0 + + + + Qt::ImhHiddenText|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhSensitiveData + + + 20 + + + QLineEdit::Password + + + true + + + + - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - - - Login - - - - - - - - - - - 0 - 0 - 650 - 600 - - - - - - - :/icons/AVG_LOGO.png - - - label_2 - LoginFrame + + + @@ -361,6 +345,9 @@ font-size: 15px; false + + <html><head/><body><p><span style=" font-weight:600;">Get your grades</span></p></body></html> + Add @@ -368,6 +355,9 @@ font-size: 15px; + + <html><head/><body><p><span style=" font-weight:600;">Clear table</span></p></body></html> + Clear @@ -398,7 +388,29 @@ font-size: 15px; - + + + + 75 + true + + + + + + + 0 + + + 0 + + + false + + + QLCDNumber::Filled + + @@ -412,235 +424,251 @@ font-size: 15px; false + + + 0 + 0 + + Settings - + - 10 - 180 - 201 - 26 + 20 + 20 + 251 + 141 - - Only influences Courses - - - false - - - - - - 10 - 40 - 231 - 121 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 10 - - - 10 - + - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 48 - 20 - - - - - - - - - - Semester - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Year - - - - - - - - - - - - - - - From - - - - - - - To - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 3 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - false - - - false - - - 2009 - - - 2015 - - - 2009 - - - - - - - - - - - 3 - - - 3 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - 2010 - - - 2026 - - - 2015 - - - - - - - - - - + + + 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 + + + 2009 + + + 2015 + + + 2009 + + + false + + + + + + + + + + + 3 + + + 3 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + 2010 + + + 2026 + + + 2015 + + + + + + + + + + + + + + + Only influences Courses + + + false + + + + + - @@ -652,8 +680,8 @@ font-size: 15px; 0 0 - 676 - 29 + 855 + 21 @@ -691,6 +719,20 @@ font-size: 15px; + + usrnmLineEdit + pswdLineEdit + loginButton + tabWidget + ratesButton + clearTableButton + checkBox + spinBoxFromSem + coursesTable + spinBoxFromYear + spinBoxToSemester + spinBoxToYear + diff --git a/resources/connectionstatus.qrc b/resources/connectionstatus.qrc index 547be37..61cb0fd 100644 --- a/resources/connectionstatus.qrc +++ b/resources/connectionstatus.qrc @@ -4,8 +4,5 @@ greenStatusIcon.png redStatusIcon.png icon.png - AVG_LOGO.png - - diff --git a/resources/icon.png b/resources/icon.png index efa2f5c..94232d4 100644 Binary files a/resources/icon.png and b/resources/icon.png differ diff --git a/resources/icon.xcf b/resources/icon.xcf new file mode 100644 index 0000000..bc3e8df Binary files /dev/null and b/resources/icon.xcf differ diff --git a/src/connection/qtsslsocket.cpp b/src/connection/qtsslsocket.cpp index 8a9e76e..db8bb29 100644 --- a/src/connection/qtsslsocket.cpp +++ b/src/connection/qtsslsocket.cpp @@ -34,23 +34,3 @@ bool qtsslsocket::recieve(std::string &str) flag = true; return flag; } - -void qtsslsocket::setProgressBar(QProgressBar *ptr) -{ - if (ptr != NULL) - { - this->pb=ptr; - connect(this->socket,SIGNAL(encryptedBytesWritten(qint64)),this,SLOT(on_read())); - //connect(this->socket,SIGNAL(readChannelFinished()),this,SLOT(on_read())); - } - -} - -void qtsslsocket::on_read() -{ - if (this->pb != NULL) - { - if (pb->value() <= 90) - pb->setValue(pb->value() + 10); - } -} diff --git a/src/connection/qtsslsocket.h b/src/connection/qtsslsocket.h index 6a53416..35236ea 100644 --- a/src/connection/qtsslsocket.h +++ b/src/connection/qtsslsocket.h @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #define milisTimeOut 3000 @@ -17,23 +16,16 @@ class qtsslsocket : public QObject public: qtsslsocket(std::string server,int port); ~qtsslsocket() { - disconnect(this->socket,SIGNAL(encryptedBytesWritten(qint64)),this,SLOT(on_read())); socket->close(); socket = NULL; - pb = NULL; - } bool isCon(); bool send(std::string str); bool recieve(std::string &str); - void setProgressBar(QProgressBar *ptr); -private slots: - void on_read(); private: QSslSocket *socket; - QProgressBar *pb; bool flag; }; diff --git a/src/grades/Course.cpp b/src/grades/Course.cpp index 50464f6..bc08f75 100644 --- a/src/grades/Course.cpp +++ b/src/grades/Course.cpp @@ -15,26 +15,6 @@ Course::~Course() { } - -void Course::printCourse() -{ - double noGrade = NO_GRADE_YET; - - std::cout << "===== Course =====" << std::endl; - std::cout << "serial: " << this->serialNum << std::endl; - std::cout << "name: " << this->name << std::endl; - std::cout << "type: " << this->type << std::endl; - std::cout << "points: " << this->points << std::endl; - std::cout << "hours: " << this->hours << std::endl; - - if (this->grade != noGrade) - std::cout << "grade: " << this->grade << std::endl; - else - std::cout << "grade: " << "No Grade" << std::endl; - - std::cout << "additions: " << this->additions << std::endl; -} - double Course::getGrade() const { double noGrade = NO_GRADE_YET; diff --git a/src/grades/Course.h b/src/grades/Course.h index 688320f..b577d31 100644 --- a/src/grades/Course.h +++ b/src/grades/Course.h @@ -1,6 +1,13 @@ #ifndef COURSE_H #define COURSE_H +/* This Code Made By Sagi Dayan + * SagiDayan@gmail.com + * + * Minor changes has been made by Liran Ben Gida + * LiranBG@gmail.com +*/ + #include #include #include @@ -26,9 +33,6 @@ public: Course(int serial,std::string name, std::string type, double points, double hours, double grade, std::string additions); ~Course(); - - void printCourse(); - int getSerialNum() const {return this->serialNum;} std::string getName() const {return this->name;} std::string getType() const {return this->type;} diff --git a/src/grades/GradePage.cpp b/src/grades/GradePage.cpp index 5c73f3b..315a2f9 100644 --- a/src/grades/GradePage.cpp +++ b/src/grades/GradePage.cpp @@ -160,12 +160,6 @@ bool GradePage::isGradedYet(std::string grade) } return true; } -void GradePage::printCourses() -{ - for(Course* c : *courses) - c->printCourse(); -} - double GradePage::getAvg() { double avg = 0; diff --git a/src/grades/GradePage.h b/src/grades/GradePage.h index 912dae5..355dc1a 100644 --- a/src/grades/GradePage.h +++ b/src/grades/GradePage.h @@ -1,6 +1,13 @@ #ifndef GRADE_PAGE_H #define GRADE_PAGE_H +/* This Code Made By Sagi Dayan + * SagiDayan@gmail.com + * + * Minor changes has been made by Liran Ben Gida + * LiranBG@gmail.com +*/ + #include "Page.h" #include "Course.h" @@ -15,7 +22,6 @@ class GradePage : public Page public: GradePage(std::string html); - void printCourses(); ~GradePage(); void addCourse(Course *); diff --git a/src/grades/Page.h b/src/grades/Page.h index c40f2e8..5796487 100644 --- a/src/grades/Page.h +++ b/src/grades/Page.h @@ -1,6 +1,13 @@ #ifndef PAGE_H #define PAGE_H +/* This Code Made By Sagi Dayan + * SagiDayan@gmail.com + * + * Minor changes has been made by Liran Ben Gida + * LiranBG@gmail.com +*/ + #include #include @@ -11,8 +18,6 @@ public: ~Page() {} - - protected: Page(std::string& html); std::string getString(); @@ -34,4 +39,4 @@ private: }; -#endif \ No newline at end of file +#endif diff --git a/src/jce/jcelogin.cpp b/src/jce/jcelogin.cpp index cd8f003..8706f62 100644 --- a/src/jce/jcelogin.cpp +++ b/src/jce/jcelogin.cpp @@ -15,54 +15,42 @@ jceLogin::~jceLogin() JceConnector = NULL; recieverPage = NULL; } - +/** + * @brief jceLogin::makeConnection Connecting to JCE student web site with JceA (username object) and validate it. + * throws error upon the given error from JCE website or Socket error + */ void jceLogin::makeConnection() throw (jceStatus) { jceStatus status; - cout << "Connecting with username: " << jceA->getUsername() << std::endl; - if (checkConnection() == true) + if (checkConnection() == true) //connected to host { - cout << "first visiting..." << endl; - if (makeFirstVisit() == true) + if (makeFirstVisit() == true) //requst and send first validation { status = jceStatus::JCE_FIRST_VALIDATION_PASSED; - cout << "validating..." << endl; - if (checkValidation() == true) + if (checkValidation() == true) //check if username and password are matching { - cout << "singing in" << endl; status = jceStatus::JCE_SECOND_VALIDATION_PASSED; - if (makeSecondVisit() == true) + if (makeSecondVisit() == true) //siging in the website { status = jceStatus::JCE_YOU_ARE_IN; setLoginFlag(true); } else - { status = jceStatus::ERROR_ON_VALIDATION; - cout << "not in evantually. error!" << std::endl; - } - } else - { status = jceStatus::ERROR_ON_VALIDATION; - cout<< "error on validation" << std::endl; - } } else - { - cout << "error on first visit" << std::endl; status = jceStatus::ERROR_ON_VALIDATION_USER_BLOCKED; - } } else - { - cout << "error on creating socket" << std::endl; status = jceStatus::ERROR_ON_OPEN_SOCKET; - } + + //we throw status even if we are IN! throw status; } @@ -151,11 +139,6 @@ void jceLogin::setLoginFlag(bool x) { this->loginFlag = x; } - -void jceLogin::setProgressBar(QProgressBar *ptr) -{ - this->JceConnector->setProgressBar(ptr); -} bool jceLogin::isLoginFlag() const { return this->loginFlag; @@ -166,6 +149,10 @@ std::string jceLogin::getPage() return *recieverPage; } +/** + * @brief jceLogin::checkValidation Made by Nadav Luzzato + * @return true if second validation step is right + */ bool jceLogin::checkValidation() { //finds the hashed password diff --git a/src/jce/jcelogin.h b/src/jce/jcelogin.h index e9448f1..8d804a8 100644 --- a/src/jce/jcelogin.h +++ b/src/jce/jcelogin.h @@ -41,9 +41,6 @@ public: int getGrades(); bool isLoginFlag() const; - - void setProgressBar(QProgressBar *); - std::string getPage();