Merge pull request #30 from liranbg/Dev

Dev
This commit is contained in:
Liran BG 2014-10-16 10:54:50 +03:00
commit 3f43e576c7
73 changed files with 30352 additions and 2400 deletions

View file

@ -4,12 +4,13 @@
#
#-------------------------------------------------
QT += core gui network widgets
QT += core gui network widgets printsupport
CONFIG += qt c++11
#CONFIG-=app_bundle
TARGET = jceManager
VERSION = 1.0.0
VERSION = 1.1.0
TEMPLATE = app
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
@ -25,7 +26,9 @@ TRANSLATIONS = jce_en.ts \
FORMS += \
main/mainscreen.ui \
src/jceData/Calendar/calendarDialog.ui
src/jceData/Grades/graph/gradegraph.ui \
src/jceData/Calendar/Exams/examDialog.ui \
src/jceData/Calendar/coursesSchedule/calendarDialog.ui
RESOURCES += \
resources/connectionstatus.qrc
@ -37,7 +40,6 @@ HEADERS += \
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 \
@ -45,12 +47,19 @@ HEADERS += \
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
src/appDatabase/jce_logger.h \
src/jceData/Grades/graph/qcustomplot.h \
src/jceData/Grades/graph/gradegraph.h \
src/jceData/Calendar/Exams/examDialog.h \
src/jceData/Calendar/Exams/calendarExam.h \
src/jceData/Calendar/Exams/calendarExamCourse.h \
src/jceData/Calendar/coursesSchedule/calendarDialog.h \
src/jceData/Calendar/coursesSchedule/calendarPage.h \
src/jceData/Calendar/coursesSchedule/calendarPageCourse.h \
src/jceData/Calendar/coursesSchedule/calendarSchedule.h \
main/jceWidgets/jcestatusbar.h
SOURCES += \
main/CalendarTab/CalendarManager.cpp \
@ -60,15 +69,22 @@ SOURCES += \
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
src/appDatabase/jce_logger.cpp \
src/jceData/Grades/graph/qcustomplot.cpp \
src/jceData/Grades/graph/gradegraph.cpp \
src/jceData/Calendar/Exams/examDialog.cpp \
src/jceData/Calendar/Exams/calendarExam.cpp \
src/jceData/Calendar/Exams/calendarExamCourse.cpp \
src/jceData/Calendar/coursesSchedule/calendarDialog.cpp \
src/jceData/Calendar/coursesSchedule/calendarPage.cpp \
src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp \
src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp \
main/jceWidgets/jcestatusbar.cpp

BIN
jce_en.qm

Binary file not shown.

595
jce_en.ts
View file

@ -1,43 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="en_US">
<TS version="2.1" language="en_US">
<context>
<name>CalendarDialog</name>
<message>
<location filename="src/jceData/Calendar/calendarDialog.ui" line="14"/>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.ui" line="26"/>
<source>Dates Dialog</source>
<oldsource>Dialog</oldsource>
<translation>Dates Dialog</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarDialog.ui" line="29"/>
<source>&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:9pt; font-weight:600;&quot;&gt;The dates were chosen according to JCE General Academic Calendar for the first semester&lt;/span&gt;&lt;/p&gt;</source>
<translation>&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:9pt; font-weight:600;&quot;&gt;The dates were chosen according to JCE General Academic Calendar for the first semester&lt;/span&gt;&lt;/p&gt;</translation>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.ui" line="34"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;Schedule Exportation&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;Schedule Exportation&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarDialog.ui" line="42"/>
<source>Semester Starts At:</source>
<translation>&lt;b&gt;Semester Starts At:</translation>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.ui" line="45"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Semester Starts At:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Semester Starts At:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarDialog.ui" line="49"/>
<source>Semester Ends At:</source>
<translation>&lt;b&gt;Semester Ends At:</translation>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.ui" line="96"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Semester Ends At:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Semester Ends At:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarDialog.ui" line="141"/>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.ui" line="144"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;The dates were chosen according to JCE General Academic Calendar for the first semester&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;The dates were chosen according to JCE General Academic Calendar for the first semester&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.ui" line="189"/>
<source>Include Exams</source>
<translation>Include Exams</translation>
</message>
<message>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.ui" line="169"/>
<source>&lt;b&gt;Please chose your dates correctly&lt;/b&gt;</source>
<translation>&lt;b&gt;Please chose your dates correctly&lt;/b&gt;</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarDialog.cpp" line="38"/>
<location filename="src/jceData/Calendar/calendarDialog.cpp" line="60"/>
<source>The end of the semester can NOT be equal or before the semester begin.</source>
<translation>The end of the semester can NOT be equal or before the semester begin.</translation>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.cpp" line="48"/>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.cpp" line="74"/>
<source>Invalid dates interval</source>
<translation>Invalid dates interval</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarDialog.cpp" line="44"/>
<location filename="src/jceData/Calendar/calendarDialog.cpp" line="66"/>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.cpp" line="55"/>
<source>Looks fine, Click &quot;OK&quot;</source>
<translation>Looks fine, Click &quot;OK&quot;</translation>
</message>
<message>
<location filename="src/jceData/Calendar/coursesSchedule/calendarDialog.cpp" line="81"/>
<source>Looks ok, Press OK</source>
<translation>Looks ok, Press OK</translation>
</message>
@ -50,250 +64,246 @@
<translation>JCE Manager</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="86"/>
<location filename="main/mainscreen.ui" line="178"/>
<location filename="main/mainscreen.ui" line="89"/>
<location filename="main/mainscreen.ui" line="183"/>
<source>Login</source>
<translation>Login</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="162"/>
<location filename="main/mainscreen.ui" line="164"/>
<source>Keep login</source>
<translation>Keep login</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="240"/>
<location filename="main/mainscreen.ui" line="251"/>
<source>Username</source>
<translation>Username</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="281"/>
<location filename="main/mainscreen.ui" line="292"/>
<source>Password</source>
<translation>Password</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="314"/>
<location filename="main/mainscreen.ui" line="325"/>
<source>GPA</source>
<translation>GPA</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="351"/>
<location filename="main/mainscreen.ui" line="551"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Get your grades&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Get your grades&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="354"/>
<source>Add</source>
<translation>Add</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="361"/>
<location filename="main/mainscreen.ui" line="532"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Clear table&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Clear table&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="364"/>
<source>Clear</source>
<translation>Clear</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="388"/>
<location filename="main/mainscreen.ui" line="784"/>
<source>Average:</source>
<translation>Average:</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="426"/>
<location filename="main/mainscreen.ui" line="611"/>
<source>Only Main Courses</source>
<translation>Only Main Courses</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="439"/>
<source>From</source>
<translation>&lt;b&gt;From&lt;/b&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="446"/>
<location filename="main/mainscreen.ui" line="512"/>
<location filename="main/mainscreen.ui" line="425"/>
<location filename="main/mainscreen.ui" line="691"/>
<source>Year:</source>
<translation>Year:</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="466"/>
<location filename="main/mainscreen.ui" line="396"/>
<location filename="main/mainscreen.ui" line="720"/>
<source>Semester:</source>
<translation>Semester:</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="505"/>
<source>To</source>
<translation>&lt;b&gt;To&lt;/b&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="532"/>
<source>Semester</source>
<translation>Semester</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="557"/>
<source>Calendar</source>
<translation>Calendar</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="595"/>
<source>Get Calendar</source>
<translation>Get Calendar</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="602"/>
<location filename="main/mainscreen.ui" line="897"/>
<source>Export to CSV</source>
<translation>Export to .CSV</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="632"/>
<location filename="main/mainscreen.ui" line="927"/>
<source>&lt;p align=&quot;center&quot;&gt;Made By &lt;a href=&quot;http://liranbg.github.io/JceManager/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;JceManager&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</source>
<oldsource>&lt;p align=&quot;right&quot;&gt;Made By &lt;a href=&quot;http://liranbg.github.io/JceManager/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;JceManager&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</oldsource>
<translation>&lt;p align=&quot;center&quot;&gt;Made By &lt;a href=&quot;http://liranbg.github.io/JceManager/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;JceManager&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="649"/>
<source>&amp;File</source>
<translation>&amp;File</translation>
<location filename="main/mainscreen.ui" line="456"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;To&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;To&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="653"/>
<location filename="main/mainscreen.ui" line="177"/>
<source>login</source>
<translation>login</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="535"/>
<source>Clear Table</source>
<translation>Clear Table</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="554"/>
<source>Get GPA</source>
<translation>Get GPA</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="570"/>
<source>Revert Changes</source>
<translation>Revert Changes</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="748"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;From&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;From&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="777"/>
<source>Graph View</source>
<translation>Graph View</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="845"/>
<source>Schedule</source>
<translation>Schedule</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="883"/>
<source>Get Schedule &amp;&amp; Exam</source>
<translation>Get Schedule &amp;&amp; Exam</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="890"/>
<source>Show Exams</source>
<translation>Show Exams</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="988"/>
<location filename="main/mainscreen.ui" line="1036"/>
<source>Team Credit</source>
<translation>Team Credit</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="1198"/>
<location filename="main/mainscreen.ui" line="1249"/>
<source>Help</source>
<translation>Help</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="1090"/>
<location filename="main/mainscreen.ui" line="1138"/>
<source>Language</source>
<translation>Language</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="682"/>
<source>Credits</source>
<translation>Credits</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="687"/>
<source>Exit</source>
<translation>Exit</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="695"/>
<source>Hebrew</source>
<translation>עברית</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="703"/>
<source>English</source>
<translation>English</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="711"/>
<source>OS Default</source>
<translation>OS Default</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="716"/>
<source>How To</source>
<translation>How To</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="23"/>
<source>Ready</source>
<translation>Ready</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="136"/>
<location filename="main/mainscreen.cpp" line="157"/>
<location filename="main/mainscreen.cpp" line="212"/>
<location filename="main/mainscreen.cpp" line="242"/>
<location filename="main/mainscreen.cpp" line="139"/>
<location filename="main/mainscreen.cpp" line="161"/>
<location filename="main/mainscreen.cpp" line="220"/>
<location filename="main/mainscreen.cpp" line="234"/>
<location filename="main/mainscreen.cpp" line="286"/>
<location filename="main/mainscreen.cpp" line="296"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="136"/>
<location filename="main/mainscreen.cpp" line="139"/>
<source>Invalid Dates.
Make Sure everything is correct and try again</source>
<translation>Invalid dates. Make sure everything is correct and try again</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="157"/>
<location filename="main/mainscreen.cpp" line="242"/>
<location filename="main/mainscreen.cpp" line="161"/>
<location filename="main/mainscreen.cpp" line="286"/>
<location filename="main/mainscreen.cpp" line="296"/>
<source>Not Connected</source>
<translation>Not Connected</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="212"/>
<location filename="main/mainscreen.cpp" line="220"/>
<source>Missmatching data</source>
<translation>Missmatching Data</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="264"/>
<location filename="main/mainscreen.cpp" line="411"/>
<source>License:</source>
<translation>License:</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="269"/>
<location filename="main/mainscreen.cpp" line="416"/>
<source>Powered By: </source>
<oldsource>powered by: </oldsource>
<translation>Powered By: </translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="271"/>
<location filename="main/mainscreen.cpp" line="418"/>
<source>Developed By</source>
<translation>Developed By</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="287"/>
<location filename="main/mainscreen.cpp" line="430"/>
<source>Help Guide</source>
<oldsource>Guide</oldsource>
<translation>Help Guide</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="273"/>
<location filename="main/mainscreen.cpp" line="420"/>
<source>Liran</source>
<translation>Liran Ben Gida</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="274"/>
<location filename="main/mainscreen.cpp" line="234"/>
<source>You must to load GPA first
Click on &apos;Get GPA&apos;</source>
<translation>You must to load GPA first
Click on &apos;Get GPA&apos;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="421"/>
<source>Sagi</source>
<translation>Sagi Dayan</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="289"/>
<location filename="main/mainscreen.cpp" line="432"/>
<source>&lt;br&gt;&lt;li&gt;Login: &lt;ul&gt;&lt;li&gt;Type your username and password and click Login.&lt;/li&gt;&lt;li&gt;Once you are connected, you will see a green ball in the right buttom panel.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</source>
<translation>&lt;br&gt;&lt;li&gt;Login: &lt;ul&gt;&lt;li&gt;Type your username and password and click Login.&lt;/li&gt;&lt;li&gt;Once you are connected, you will see a green ball in the right buttom panel.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="290"/>
<location filename="main/mainscreen.cpp" line="433"/>
<source>&lt;br&gt;&lt;li&gt;Getting GPA sheet&lt;ul&gt;&lt;li&gt;Click on GPA Tab&lt;/li&gt;&lt;li&gt; Select your dates and click on Add&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</source>
<translation>&lt;br&gt;&lt;li&gt;Getting GPA sheet&lt;ul&gt;&lt;li&gt;Click on GPA Tab&lt;/li&gt;&lt;li&gt; Select your dates and click on Add&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="291"/>
<location filename="main/mainscreen.cpp" line="434"/>
<source>&lt;br&gt;&lt;li&gt;Average Changing&lt;ul&gt;&lt;li&gt;Change one of your grade and see the average in the buttom panel changing.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</source>
<translation>&lt;br&gt;&lt;li&gt;Average Changing&lt;ul&gt;&lt;li&gt;Change one of your grade and see the average in the buttom panel changing.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="292"/>
<location filename="main/mainscreen.cpp" line="435"/>
<source>&lt;br&gt;&lt;li&gt;Getting Calendar&lt;ul&gt;&lt;li&gt;Click on Calendar Tab&lt;/li&gt;&lt;li&gt; Select your dates and click on Get Calendar&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</source>
<translation>&lt;br&gt;&lt;li&gt;Getting Calendar&lt;ul&gt;&lt;li&gt;Click on Calendar Tab&lt;/li&gt;&lt;li&gt; Select your dates and click on Get Calendar&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="293"/>
<location filename="main/mainscreen.cpp" line="436"/>
<source>&lt;br&gt;&lt;li&gt;For exporting your calendar to a .CSV file:&lt;ul&gt;&lt;li&gt;Do previous step and continue to next step&lt;/li&gt;&lt;li&gt; Click on Export to CSV&lt;/li&gt;&lt;li&gt;Select your dates and click OK&lt;/li&gt;&lt;li&gt;Once you&apos;re Done, go on your calendar and import your csv file&lt;/li&gt;&lt;/li&gt;</source>
<translation>&lt;br&gt;&lt;li&gt;For exporting your calendar to a .CSV file:&lt;ul&gt;&lt;li&gt;Do previous step and continue to next step&lt;/li&gt;&lt;li&gt; Click on Export to CSV&lt;/li&gt;&lt;li&gt;Select your dates and click OK&lt;/li&gt;&lt;li&gt;Once you&apos;re Done, go on your calendar and import your csv file&lt;/li&gt;&lt;/li&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="295"/>
<location filename="main/mainscreen.cpp" line="438"/>
<source>&lt;b&gt;For more information, please visit us at: &lt;a href=&apos;http://liranbg.github.io/JceManager/&apos;&gt;Jce Manager site&lt;/a&gt;&lt;/b&gt;</source>
<translation>&lt;b&gt;For more information, please visit us at: &lt;a href=&apos;http://liranbg.github.io/JceManager/&apos;&gt;Jce Manager site&lt;/a&gt;&lt;/b&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="306"/>
<location filename="main/mainscreen.cpp" line="334"/>
<location filename="main/mainscreen.cpp" line="402"/>
<source>Settings</source>
<translation>Settings</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="306"/>
<location filename="main/mainscreen.cpp" line="320"/>
<location filename="main/mainscreen.cpp" line="334"/>
<location filename="main/mainscreen.cpp" line="402"/>
<source>Your settings will take effect next time you start the program</source>
<translation>Your settings will take effect next time you start the program</translation>
</message>
@ -301,20 +311,15 @@ Make Sure everything is correct and try again</source>
<context>
<name>QObject</name>
<message>
<location filename="main/CalendarTab/CalendarManager.cpp" line="28"/>
<location filename="main/CalendarTab/CalendarManager.cpp" line="42"/>
<source>Exported Successfuly!</source>
<translation>Exported Successfuly!</translation>
</message>
<message>
<location filename="main/CalendarTab/CalendarManager.cpp" line="36"/>
<location filename="main/CalendarTab/CalendarManager.cpp" line="50"/>
<source>Dates not valid</source>
<translation>Invalid Dates</translation>
</message>
<message>
<location filename="main/CourseTab/coursestablemanager.cpp" line="15"/>
<source>Code</source>
<translation>Code</translation>
</message>
<message>
<location filename="main/CourseTab/coursestablemanager.cpp" line="15"/>
<source>Name</source>
@ -346,227 +351,439 @@ Make Sure everything is correct and try again</source>
<translation>Additions</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="35"/>
<location filename="main/CourseTab/coursestablemanager.cpp" line="15"/>
<source>Number</source>
<translation>Number</translation>
</message>
<message>
<location filename="main/CourseTab/coursestablemanager.cpp" line="15"/>
<source>Year</source>
<translation>Year</translation>
</message>
<message>
<location filename="main/CourseTab/coursestablemanager.cpp" line="15"/>
<source>Semester</source>
<translation>Semester</translation>
</message>
<message>
<location filename="main/CourseTab/coursestablemanager.cpp" line="15"/>
<source>Serial</source>
<translation>Serial</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="33"/>
<source>Logout</source>
<translation>Logout</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="47"/>
<location filename="main/LoginTab/loginhandler.cpp" line="46"/>
<source>Login</source>
<translation>Login</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="68"/>
<location filename="main/LoginTab/loginhandler.cpp" line="67"/>
<source>Please Check Your Username &amp; Password</source>
<translation>Please Check Your Username &amp; Password</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="73"/>
<location filename="main/LoginTab/loginhandler.cpp" line="72"/>
<source>You have been &lt;b&gt;BLOCKED&lt;/b&gt; by JCE, please try in a couple of minutes.</source>
<oldsource>You have been blocked by JCE, please try in a couple of minutes.</oldsource>
<translation>You have been &lt;b&gt;blocked&lt;/b&gt; by JCE, please try in a couple of minutes.</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="78"/>
<location filename="main/LoginTab/loginhandler.cpp" line="77"/>
<source>Please Check Your Internet Connection.</source>
<translation>Please Check Your Internet Connection.</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="87"/>
<location filename="main/LoginTab/loginhandler.cpp" line="86"/>
<source>Receive Request Timeout.</source>
<translation>Receive Request Timeout.</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="92"/>
<location filename="main/LoginTab/loginhandler.cpp" line="91"/>
<source>Send Request Timeout.</source>
<translation>Send Request Timeout.</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="172"/>
<location filename="main/LoginTab/loginhandler.cpp" line="163"/>
<source>
If this message appear without reason, please contact me at liranbg@gmail.com</source>
<translation>
If this message appear without reason, please contact me at liranbg@gmail.com</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="175"/>
<location filename="main/LoginTab/loginhandler.cpp" line="166"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarSchedule.cpp" line="22"/>
<location filename="src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp" line="21"/>
<source>Sunday</source>
<translation>Sunday</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarSchedule.cpp" line="22"/>
<location filename="src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp" line="21"/>
<source>Monday</source>
<translation>Monday</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarSchedule.cpp" line="22"/>
<location filename="src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp" line="21"/>
<source>Tuesday</source>
<translation>Thesday</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarSchedule.cpp" line="22"/>
<location filename="src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp" line="21"/>
<source>Wednesday</source>
<translation>Wednesday</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarSchedule.cpp" line="22"/>
<location filename="src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp" line="21"/>
<source>Thursday</source>
<translation>Thursday</translation>
</message>
<message>
<location filename="src/jceData/Calendar/calendarSchedule.cpp" line="22"/>
<location filename="src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp" line="21"/>
<source>Friday</source>
<translation>Friday</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="263"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="300"/>
<source>ConnectionRefusedError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="268"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="305"/>
<source>RemoteHostClosedError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="278"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="315"/>
<source>HostNotFoundError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="283"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="320"/>
<source>SocketAccessError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="287"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="324"/>
<source>SocketTimeoutError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="294"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="331"/>
<source>NetworkError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="303"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="340"/>
<source>SslHandshakeFailedError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="307"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="344"/>
<source>SslInternalError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="311"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="348"/>
<source>SslInvalidUserDataError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="315"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="352"/>
<source>DatagramTooLargeError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="320"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="357"/>
<source>OperationError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="323"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="360"/>
<source>AddressInUseError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="326"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="363"/>
<source>SocketAddressNotAvailableError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="329"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="366"/>
<source>UnsupportedSocketOperationError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="332"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="369"/>
<source>ProxyAuthenticationRequiredError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="335"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="372"/>
<source>ProxyConnectionRefusedError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="338"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="375"/>
<source>UnfinishedSocketOperationError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="341"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="378"/>
<source>ProxyConnectionClosedError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="344"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="381"/>
<source>ProxyConnectionTimeoutError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="347"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="384"/>
<source>ProxyNotFoundError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="350"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="387"/>
<source>ProxyProtocolError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="353"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="390"/>
<source>TemporaryError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="356"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="393"/>
<source>UnknownSocketError</source>
<translation>Your error is critical. Our team need your help, please send your log file named J_M_Log.log to us. see link in About. The file DOES NOT CONTAIN YOUR PASSWORD</translation>
</message>
<message>
<location filename="src/jceData/CSV/csv_exporter.cpp" line="45"/>
<location filename="src/jceData/CSV/csv_exporter.cpp" line="44"/>
<source>Unable to open or create the file.
Exporting Failed</source>
<translation>Unable to open or create the file.
Exporting Failed</translation>
</message>
<message>
<location filename="src/jceData/CSV/csv_exporter.cpp" line="143"/>
<source>JceManager Save Schedule Dialog</source>
<translation>JceManager Save Schedule Dialog</translation>
</message>
<message>
<location filename="src/jceData/CSV/csv_exporter.cpp" line="144"/>
<source>CSV Files (*.csv);;All Files (*)</source>
<translation>CSV Files (*.csv);;All Files (*)</translation>
</message>
</context>
<context>
<name>loginHandler</name>
<name>examDialog</name>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="150"/>
<source>Connecting...</source>
<translation>Connecting...</translation>
<location filename="src/jceData/Calendar/Exams/examDialog.ui" line="20"/>
<source>Exam Dialog</source>
<oldsource>Dialog</oldsource>
<translation>Exam Dialog</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="154"/>
<source>Connected</source>
<translation>Connected</translation>
<location filename="src/jceData/Calendar/Exams/examDialog.ui" line="71"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Revert changes&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Revert changes&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="158"/>
<location filename="src/jceData/Calendar/Exams/examDialog.ui" line="74"/>
<source>Revert</source>
<translation>Revert</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.ui" line="81"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Discard and hide&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Discard and hide&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.ui" line="84"/>
<source>Cancel</source>
<translation>Cancel</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.ui" line="91"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Save and hide&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Save and hide&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.ui" line="94"/>
<source>Ok</source>
<translation>Ok</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.ui" line="120"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;Exams Schedule&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;Exams Schedule&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.cpp" line="18"/>
<source>Serial</source>
<translation>Serial</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.cpp" line="18"/>
<source>Course</source>
<translation>Course</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.cpp" line="18"/>
<source>Lecturer</source>
<translation>Lecturer</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.cpp" line="18"/>
<source>Field</source>
<translation>Field</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.cpp" line="18"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.cpp" line="18"/>
<source>Exam 1 Date</source>
<translation>Exam 1 Date</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.cpp" line="18"/>
<source>Starting Hour</source>
<translation>Starting Hour</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.cpp" line="18"/>
<source>Exam 2 Date</source>
<translation>Exam 2 Date</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.cpp" line="158"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location filename="src/jceData/Calendar/Exams/examDialog.cpp" line="158"/>
<source>Missmatching data.
Format: hh:mm
In Example: 08:25 or 12:05</source>
<translation>Missmatching data.
Format: hh:mm
In Example: 08:25 or 12:05</translation>
</message>
</context>
<context>
<name>gradegraph</name>
<message>
<location filename="src/jceData/Grades/graph/gradegraph.ui" line="14"/>
<source>GPA Graph View</source>
<translation>GPA Graph View</translation>
</message>
<message>
<location filename="src/jceData/Grades/graph/gradegraph.ui" line="36"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:18pt; font-weight:600;&quot;&gt;GPA Graph View&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:18pt; font-weight:600;&quot;&gt;GPA Graph View&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="src/jceData/Grades/graph/gradegraph.ui" line="71"/>
<source>Close</source>
<translation>Close</translation>
</message>
<message>
<location filename="src/jceData/Grades/graph/gradegraph.cpp" line="124"/>
<source>Yearly Average</source>
<translation>Yearly Average</translation>
</message>
<message>
<location filename="src/jceData/Grades/graph/gradegraph.cpp" line="129"/>
<source>Semesterial Average</source>
<translation>Semesterial Average</translation>
</message>
<message>
<location filename="src/jceData/Grades/graph/gradegraph.cpp" line="147"/>
<source>A</source>
<translation>A</translation>
</message>
<message>
<location filename="src/jceData/Grades/graph/gradegraph.cpp" line="151"/>
<source>B</source>
<translation>B</translation>
</message>
<message>
<location filename="src/jceData/Grades/graph/gradegraph.cpp" line="155"/>
<source>C</source>
<translation>Summer</translation>
</message>
<message>
<location filename="src/jceData/Grades/graph/gradegraph.cpp" line="166"/>
<source>AVG Grade</source>
<translation>Grade Axis</translation>
</message>
<message>
<location filename="src/jceData/Grades/graph/gradegraph.cpp" line="175"/>
<source>Years</source>
<translation>Year Axis</translation>
</message>
</context>
<context>
<name>jceStatusBar</name>
<message>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="7"/>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="81"/>
<source>Ready</source>
<translation>Ready</translation>
</message>
<message>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="71"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="76"/>
<source>Disconnected</source>
<translation>Disconnected</translation>
</message>
<message>
<location filename="main/LoginTab/loginhandler.cpp" line="162"/>
<source>Ready.</source>
<translation>Ready.</translation>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="86"/>
<source>Connecting...</source>
<translation>Connecting...</translation>
</message>
<message>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="92"/>
<source>Sending...</source>
<translation>Sending...</translation>
</message>
<message>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="98"/>
<source>Recieving...</source>
<translation>Recieving...</translation>
</message>
<message>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="103"/>
<source>Connected</source>
<translation>Connected</translation>
</message>
<message>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="108"/>
<source>Inserting</source>
<translation>Inserting</translation>
</message>
<message>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="113"/>
<source>Logged In.</source>
<translation>Logged In.</translation>
</message>
<message>
<location filename="main/jceWidgets/jcestatusbar.cpp" line="118"/>
<source>Done</source>
<translation>Done</translation>
</message>
</context>
</TS>

BIN
jce_he.qm

Binary file not shown.

713
jce_he.ts

File diff suppressed because it is too large Load diff

View file

@ -1,19 +1,33 @@
#include "CalendarManager.h"
CalendarManager::CalendarManager(QGridLayout *ptr)
CalendarManager::CalendarManager(QWidget *parent, QGridLayout *ptr) : QWidget(parent)
{
caliSchedPtr = new calendarSchedule();
caliSchedPtr = new calendarSchedule(this);
examSchePtr = new calendarExam();
ptr->addWidget(caliSchedPtr);
caliDialog = new CalendarDialog();
caliDialog = new CalendarDialog(this);
examDialogPtr = new examDialog(this,examSchePtr);
}
void CalendarManager::setCalendar(QString html)
{
caliSchedPtr->setPage(html);
}
void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug
void CalendarManager::setExamsSchedule(QString html)
{
if (this->caliSchedPtr->getCourses() == NULL)
examSchePtr->setPage(html);
examDialogPtr->initializingDataIntoTable();
}
void CalendarManager::showExamDialog()
{
examDialogPtr->show();
}
void CalendarManager::exportCalendarCSV()
{
if (this->caliSchedPtr->getCourses().isEmpty())
return;
QMessageBox msgBox;
int buttonClicked = caliDialog->exec();
@ -22,7 +36,7 @@ void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer
//calDialog.getStartDate(),calDialog.getEndDate()
if (caliDialog->ok())
{
if (CSV_Exporter::exportCalendar(caliSchedPtr, caliDialog))
if (CSV_Exporter::exportCalendar(caliSchedPtr, caliDialog, examSchePtr))
{
msgBox.setIcon(QMessageBox::Information);
msgBox.setText(QObject::tr("Exported Successfuly!"));

View file

@ -1,21 +1,25 @@
#ifndef CALENDARMANAGER_H
#define CALENDARMANAGER_H
#include "./src/jceData/Calendar/calendarPage.h"
#include "./src/jceData/Calendar/calendarSchedule.h"
#include "./src/jceData/CSV/csv_exporter.h"
#include "./src/jceData/Calendar/calendarDialog.h"
#include "../../src/jceData/Calendar/coursesSchedule/calendarPage.h"
#include "../../src/jceData/Calendar/coursesSchedule/calendarSchedule.h"
#include "../../src/jceData/Calendar/coursesSchedule/calendarDialog.h"
#include "../../src/jceData/CSV/csv_exporter.h"
#include "../../src/jceData/Calendar/Exams/calendarExam.h"
#include "../../src/jceData/Calendar/Exams/examDialog.h"
#include <QObject>
#include <QWidget>
#include <QGridLayout>
#include <QMessageBox>
class CalendarManager : public QObject
class CalendarManager : public QWidget
{
Q_OBJECT
public:
CalendarManager(QGridLayout *ptr);
CalendarManager(QWidget *parent = 0, QGridLayout *ptr = 0);
~CalendarManager()
{
delete caliSchedPtr;
@ -23,9 +27,15 @@ public:
}
void exportCalendarCSV();
void setCalendar(QString html);
void setExamsSchedule(QString html);
void showExamDialog();
void resetTable() { if (caliSchedPtr != NULL) caliSchedPtr->clearTableItems(); }
private:
calendarExam * examSchePtr;
examDialog * examDialogPtr;
calendarSchedule * caliSchedPtr;
CalendarDialog * caliDialog;

View file

@ -1,37 +1,41 @@
#include "coursestablemanager.h"
coursesTableManager::coursesTableManager(QTableWidget *ptr, user *usrPtr)
{
this->gp = NULL;
this->us = usrPtr;
this->courseTBL = ptr;
this->gp = NULL;
this->gpCpy = 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;}");
/*
* Initilizing Table
*/
courseTBL->setRowCount(0);
courseTBL->setColumnCount(COURSE_FIELDS);
QStringList mz;
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->verticalHeader()->setVisible(false);
courseTBL->setSelectionMode(QAbstractItemView::SingleSelection);
courseTBL->setShowGrid(true);
courseTBL->setStyleSheet("QTableView {selection-background-color: red;}");
graph = new gradegraph(ptr);
}
coursesTableManager::~coursesTableManager()
{
courseTBL = NULL;
delete gp;
gp = NULL;
courseTBL = NULL;
delete gp;
delete gpCpy;
gpCpy = NULL;
gp = NULL;
}
/**
* @brief coursesTableManager::insertJceCoursesIntoTable phrasing the course list to rows in table
*/
void coursesTableManager::insertJceCoursesIntoTable()
{
for (gradeCourse *c: *gp->getCourses())
for (gradeCourse *c: gp->getCourses())
{
if (us->getInfluenceCourseOnly())
{
@ -48,7 +52,10 @@ void coursesTableManager::insertJceCoursesIntoTable()
*/
void coursesTableManager::setCoursesList(QString &html)
{
gp = new GradePage(html);
clearTable();
gp = new GradePage(html);
this->gpCpy = new GradePage(*gp);
insertJceCoursesIntoTable();
}
/**
* @brief coursesTableManager::changes when user changes the table manually it updates it
@ -59,16 +66,26 @@ void coursesTableManager::setCoursesList(QString &html)
*/
bool coursesTableManager::changes(QString change, int row, int col)
{
bool isNumFlag = true;
if (courseTBL->item(row,gradeCourse::CourseScheme::SERIAL) == NULL)
return true;
bool isNumFlag = true;
int serialCourse = courseTBL->item(row,gradeCourse::CourseScheme::SERIAL)->text().toInt();
for (gradeCourse *c: *gp->getCourses())
int serialCourse = courseTBL->item(row,gradeCourse::CourseScheme::SERIAL)->text().toInt();
for (gradeCourse *c: gp->getCourses())
{
if (c->getSerialNum() == serialCourse)
{
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):
c->setName(change);
break;
@ -100,17 +117,21 @@ bool coursesTableManager::changes(QString change, int row, int col)
break;
}
case (gradeCourse::CourseScheme::GRADE):
{
{
change.toDouble(&isNumFlag);
if (!isNumFlag)
{
if (!isNumFlag) //not a number
{
courseTBL->item(row,col)->setText(QString::number(c->getGrade()));
}
else
{
if ((change.toDouble() >= 0) && (change.toDouble() <= 100))
c->setGrade(change.toDouble());
{
c->setGrade(change.toDouble());
colorTheGrade(row);
}
else
courseTBL->item(row,col)->setText(QString::number(c->getGrade()));
}
@ -132,44 +153,82 @@ bool coursesTableManager::changes(QString change, int row, int col)
*/
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)
int i=1,j=1;
j = 0;
QTableWidgetItem *number,*year,*semester,*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(c->getName());
name->setFlags(serial->flags() & ~Qt::ItemIsEditable);
type = new QTableWidgetItem(c->getType());
type->setFlags(serial->flags() & ~Qt::ItemIsEditable);
addition = new QTableWidgetItem(c->getAddidtions());
courseTBL->setRowCount(courseTBL->rowCount() + 1);
i = courseTBL->rowCount()-1;
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);
number = new QTableWidgetItem();
number->setData(Qt::EditRole, c->getCourseNumInList());
number->setFlags(number->flags() & ~Qt::ItemIsEditable);
year = new QTableWidgetItem();
year->setData(Qt::EditRole,c->getYear());
year->setFlags(year->flags() & ~Qt::ItemIsEditable);
semester = new QTableWidgetItem();
semester->setData(Qt::EditRole,c->getSemester());
semester->setFlags(semester->flags() & ~Qt::ItemIsEditable);
serial = new QTableWidgetItem();
serial->setData(Qt::EditRole,c->getSerialNum());
serial->setFlags(serial->flags() & ~Qt::ItemIsEditable);
name = new QTableWidgetItem();
name->setData(Qt::EditRole,c->getName());
name->setFlags(name->flags() & ~Qt::ItemIsEditable);
type = new QTableWidgetItem();
type->setData(Qt::EditRole, c->getType());
type->setFlags(type->flags() & ~Qt::ItemIsEditable);
points = new QTableWidgetItem();
points->setData(Qt::EditRole, c->getPoints());
points->setFlags(points->flags() & ~Qt::ItemIsEditable);
hours = new QTableWidgetItem();
hours->setData(Qt::EditRole, c->getHours());
hours->setFlags(hours->flags() & ~Qt::ItemIsEditable);
grade = new QTableWidgetItem();
//grade->setData(Qt::EditRole,c->getGrade());
//BUG QT bug
//good for sorting, the problem is when you edit -> the cell indicator disappear
grade->setText(QString::number(c->getGrade()));
addition = new QTableWidgetItem();
addition->setData(Qt::EditRole,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++,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);
colorTheGrade(i);
}
}
else
{
qCritical() << Q_FUNC_INFO << " no course to load!";
}
courseTBL->resizeColumnsToContents();
courseTBL->resizeColumnsToContents();
courseTBL->resizeRowsToContents();
}
double coursesTableManager::getAvg()
@ -179,6 +238,18 @@ double coursesTableManager::getAvg()
return 0;
}
bool coursesTableManager::showGraph()
{
qDebug() << Q_FUNC_INFO;
if (gp != NULL)
{
this->graph->showGraph(gp);
return true;
}
qWarning() << Q_FUNC_INFO << "open with null grade page";
return false;
}
void coursesTableManager::influnceCourseChanged(bool ignoreCourseStatus)
{
@ -194,13 +265,13 @@ void coursesTableManager::influnceCourseChanged(bool ignoreCourseStatus)
}
else
{
if (gp != NULL)
for (gradeCourse *c: *gp->getCourses())
{
if (!(isCourseAlreadyInserted(c->getSerialNum())))
if (c->getPoints() == 0)
addRow(c);
}
if (this->gp != NULL)
for (gradeCourse *c: gp->getCourses())
{
if (!(isCourseAlreadyInserted(c->getSerialNum())))
if (c->getPoints() == 0)
addRow(c);
}
}
}
@ -213,17 +284,50 @@ void coursesTableManager::clearTable()
int i = 0; //starting point
while (courseTBL->rowCount() > i)
{
gp->removeCourse(courseTBL->item(i,gradeCourse::CourseScheme::SERIAL)->text());
courseTBL->removeRow(i);
if (gp != NULL)
gp->removeCourse(courseTBL->item(i,gradeCourse::CourseScheme::SERIAL)->text());
courseTBL->removeRow(i);
}
gp = NULL;
courseTBL->repaint();
if (gp != NULL)
delete gp;
gp = NULL;
courseTBL->repaint();
}
/**
* @brief coursesTableManager::revertChanges
*
* restored data from the copy of grade page
* TODO: revert-> make it efficient
*/
void coursesTableManager::revertChanges()
{
if (courseTBL->rowCount() <= 0)
return;
if (this->gpCpy == NULL)
return;
if (this->gp == NULL)
return;
for (int i = 0; i < courseTBL->rowCount(); ++i)
{
gradeCourse * temp = getCourseByRow(i);
for (gradeCourse * notChangedCourse: gpCpy->getCourses())
{
if ((temp->getGrade() != notChangedCourse->getGrade()) &&
(temp->getSerialNum() == notChangedCourse->getSerialNum()))
{
courseTBL->item(i,gradeCourse::CourseScheme::GRADE)->setText(QString::number(notChangedCourse->getGrade()));
break;
}
}
}
}
gradeCourse *coursesTableManager::getCourseByRow(int row)
{
QString courseSerial = courseTBL->item(row,gradeCourse::CourseScheme::SERIAL)->text();
for (gradeCourse *c: *gp->getCourses())
QString courseSerial = courseTBL->item(row,gradeCourse::CourseScheme::SERIAL)->text();
for (gradeCourse *c: gp->getCourses())
{
if (c->getSerialNum() == courseSerial.toDouble())
return c;
@ -233,12 +337,15 @@ gradeCourse *coursesTableManager::getCourseByRow(int row)
bool coursesTableManager::isCourseAlreadyInserted(double courseID)
{
int i=0;
for (i = 0; i < courseTBL->rowCount(); ++i)
int i;
for (i = courseTBL->rowCount(); i >= 0; --i)
{
QString courseSerial = courseTBL->item(i,gradeCourse::CourseScheme::SERIAL)->text();
if (QString::number(courseID) == courseSerial)
return true;
if (courseTBL->item(i,gradeCourse::CourseScheme::SERIAL) != NULL)
{
QString courseSerial = courseTBL->item(i,gradeCourse::CourseScheme::SERIAL)->text();
if (QString::number(courseID) == courseSerial)
return true;
}
}
return false;
}
@ -250,3 +357,28 @@ bool coursesTableManager::isCourseInfluence(const gradeCourse *courseToCheck)
return false;
}
/**
* @brief coursesTableManager::colorTheGrade - color the course grade
* @param rowIndex - course's row index
*/
void coursesTableManager::colorTheGrade(int rowIndex)
{
gradeCourse * temp = getCourseByRow(rowIndex);
if (temp != NULL)
{
if (temp->getGrade() != 0)
{
float green,red, blue = 0;
float grade = ((float)temp->getGrade());
green = qRound(grade * 255 / 100);
red = qRound((255 * (100 - grade) / 100));
blue = 0;
//higher the grade -> the greener it is
courseTBL->item(rowIndex,gradeCourse::CourseScheme::GRADE)->setBackground(QColor(red,green,blue));
courseTBL->item(rowIndex,gradeCourse::CourseScheme::GRADE)->setTextColor(Qt::black);
}
}
}

View file

@ -2,19 +2,16 @@
#define COURSESTABLEMANAGER_H
#include <QApplication>
#include <QDesktopWidget>
#include <QtCore/QCoreApplication>
#include <QtGlobal>
#include <QHeaderView>
#include <QMessageBox>
#include <QTableWidget>
#include <QString>
#include <QMessageBox>
#include <list>
#include "./src/jceData/Grades/gradePage.h"
#include "./src/jceSettings/user.h"
#include "../../src/jceData/Grades/graph/gradegraph.h"
#include "../../src/jceData/Grades/gradePage.h"
#include "../../src/jceSettings/user.h"
class coursesTableManager
{
@ -27,17 +24,25 @@ public:
void addRow(const gradeCourse * courseToAdd = 0);
double getAvg();
bool showGraph();
void influnceCourseChanged(bool status);
void clearTable();
void revertChanges();
private:
gradegraph *graph;
QTableWidget *courseTBL;
GradePage *gp;
GradePage *gpCpy;
user *us;
gradeCourse * getCourseByRow(int row);
bool isCourseAlreadyInserted(double courseID);
bool isCourseInfluence(const gradeCourse *courseToCheck);
void colorTheGrade(int rowIndex);
};
#endif // COURSESTABLEMANAGER_H

View file

@ -1,19 +1,19 @@
#include "loginhandler.h"
loginHandler::loginHandler(user *ptr, QStatusBar *statusBarPtr,QPushButton *loginButtonPtr): logggedInFlag(false)
loginHandler::loginHandler(user *ptr, QPushButton *loginButtonPtr, jceStatusBar *progressbarPtr): logggedInFlag(false)
{
this->loginButtonPtr = loginButtonPtr;
this->statusBar = progressbarPtr;
//statusBar
statusBar = statusBarPtr;
iconButtomStatusLabel = new QLabel();
statusBar->addPermanentWidget(iconButtomStatusLabel,0);
setIconConnectionStatus(jceLogin::jceStatus::JCE_NOT_CONNECTED);
statusBar->setIconConnectionStatus(jceStatusBar::Disconnected);
//user settings
userPtr = ptr;
this->jceLog = new jceLogin(userPtr);
this->jceLog = new jceLogin(userPtr,statusBar);
QObject::connect(this->jceLog,SIGNAL(connectionReadyAfterDisconnection()),this,SLOT(readyAfterConnectionLost()));
}
bool loginHandler::login(QString username,QString password)
{
@ -24,19 +24,18 @@ bool loginHandler::login(QString username,QString password)
logout();
return false;
}
setIconConnectionStatus(jceLogin::jceStatus::JCE_START_VALIDATING_PROGRESS);
userPtr->setUsername(username);
userPtr->setPassword(password);
if (makeConnection() == true)
{
setIconConnectionStatus(jceLogin::jceStatus::JCE_YOU_ARE_IN);
loginButtonPtr->setText(QObject::tr("Logout"));
return isLoggedInFlag();
}
else
{
logout();
return false;
}
@ -45,7 +44,7 @@ bool loginHandler::login(QString username,QString password)
void loginHandler::logout()
{
loginButtonPtr->setText(QObject::tr("Login"));
setIconConnectionStatus(jceLogin::jceStatus::JCE_NOT_CONNECTED);
statusBar->setIconConnectionStatus(jceStatusBar::Disconnected);
jceLog->closeAll();
logggedInFlag = false;
}
@ -101,6 +100,7 @@ void loginHandler::readyAfterConnectionLost()
{
qWarning() << Q_FUNC_INFO;
setLoginFlag(false);
statusBar->setIconConnectionStatus(jceStatusBar::Disconnected);
login(userPtr->getUsername(),userPtr->getPassword());
}
@ -118,54 +118,45 @@ void loginHandler::setLoginFlag(bool flag)
}
QString loginHandler::getCurrentPageContect()
{
QTextEdit phrase;
QTextEdit parse;
if (isLoggedInFlag())
phrase.setText(jceLog->getPage());
parse.setText(jceLog->getPage());
else
throw jceLogin::ERROR_ON_GETTING_INFO;
return phrase.toPlainText();
return "";
return parse.toPlainText();
}
int loginHandler::makeGradeRequest(int fromYear, int toYear, int fromSemester, int toSemester)
{
if (isLoggedInFlag())
{
statusBar->setIconConnectionStatus(jceStatusBar::Sending);
return jceLog->getGrades(fromYear, toYear, fromSemester, toSemester);
}
else
return jceLogin::JCE_NOT_CONNECTED;
}
int loginHandler::makeCalendarRequest(int year, int semester)
{
if (isLoggedInFlag())
{
statusBar->setIconConnectionStatus(jceStatusBar::Sending);
return jceLog->getCalendar(year,semester);
}
else
return jceLogin::JCE_NOT_CONNECTED;
}
void loginHandler::setIconConnectionStatus(jceLogin::jceStatus statusDescription)
int loginHandler::makeExamsScheduleRequest(int year, int semester)
{
QPixmap iconPix;
switch (statusDescription)
{
case jceLogin::jceStatus::JCE_START_VALIDATING_PROGRESS:
iconPix.load(":/icons/blueStatusIcon.png");
statusBar->showMessage(tr("Connecting..."));
break;
case jceLogin::jceStatus::JCE_YOU_ARE_IN:
iconPix.load(":/icons/greenStatusIcon.png");
statusBar->showMessage(tr("Connected"));
break;
case jceLogin::jceStatus::JCE_NOT_CONNECTED:
iconPix.load(":/icons/redStatusIcon.png");
statusBar->showMessage(tr("Disconnected"));
break;
default:
iconPix.load(":/icons/redStatusIcon.png");
statusBar->showMessage(tr("Ready."));
break;
}
iconButtomStatusLabel->setPixmap(iconPix);
this->statusBar->repaint();
if (isLoggedInFlag())
{
statusBar->setIconConnectionStatus(jceStatusBar::Sending);
return jceLog->getExams(year,semester);
}
else
return jceLogin::JCE_NOT_CONNECTED;
}
void loginHandler::popMessage(QString message,bool addInfo)
{
if (addInfo)

View file

@ -6,27 +6,25 @@
#include <QLabel>
#include <QMessageBox>
#include <QPixmap>
#include <QStatusBar>
#include <QPushButton>
#include "./src/jceSettings/jcelogin.h"
#include "./src/appDatabase/savedata.h"
#include "../../src/jceSettings/jcelogin.h"
#include "../../src/appDatabase/savedata.h"
#include "../../main/jceWidgets/jcestatusbar.h"
class loginHandler : public QObject
{
Q_OBJECT
public:
loginHandler(user *ptr, QStatusBar *statusBarPtr,QPushButton *loginButtonPtr);
loginHandler(user *ptr, QPushButton *loginButtonPtr, jceStatusBar *progressbarPtr);
~loginHandler()
{
delete iconButtomStatusLabel;
delete jceLog;
}
bool login(QString username,QString password);
void logout();
void setIconConnectionStatus(jceLogin::jceStatus statusDescription);
bool makeConnection();
@ -36,6 +34,7 @@ public:
int makeGradeRequest(int fromYear, int toYear, int fromSemester, int toSemester);
int makeCalendarRequest(int year,int semester);
int makeExamsScheduleRequest(int year, int semester);
private slots:
void readyAfterConnectionLost();
@ -48,8 +47,8 @@ private:
jceLogin * jceLog;
user * userPtr;
QStatusBar *statusBar;
QLabel *iconButtomStatusLabel;
jceStatusBar *statusBar;
QPushButton *loginButtonPtr;
};

View file

@ -0,0 +1,150 @@
#include "jcestatusbar.h"
jceStatusBar::jceStatusBar(QWidget *parent) :
QStatusBar(parent)
{
this->setFixedHeight(STATUS_ICON_HEIGH+30);
this->showMessage(tr("Ready"));
this->setStyleSheet("QStatusBar {"
"border: 0px solid black;"
"background: rgba(255, 255, 255, 255);"
"padding: 3px;"
"padding-left: 1px;"
"padding-right: 1px;"
"min-height: 50px;"
"max-height: 50px;"
"}");
//Icon
iconButtomStatusLabel = new QLabel(this);
iconButtomStatusLabel->setStyleSheet("QLabel {"
"border: 0px solid black"
"border-radius: 16px;"
"padding: 1px;"
"padding-left: 1px;"
"padding-right: 1px;"
"min-width: 48px;"
"max-width: 48px;"
"min-height: 48px;"
"max-height: 48px;"
"}");
iconButtomStatusLabel->setMaximumHeight(STATUS_ICON_HEIGH+2);
iconButtomStatusLabel->setMinimumHeight(STATUS_ICON_HEIGH+2);
iconButtomStatusLabel->setAlignment(Qt::AlignHCenter);
//ProgressBar
progressBar = new QProgressBar(this);
connect(progressBar,SIGNAL(valueChanged(int)),this,SLOT(setProgressValue(int)));
connect(this,SIGNAL(progressHasPacket(int)),this,SLOT(addValueToProgressBar(int)));
progressBar->setFixedWidth(120);
progressBar->setFixedHeight(STATUS_ICON_HEIGH);
progressBar->setStyleSheet("QProgressBar {"
"border: 1px solid gray;"
"border-radius: 3px;"
"background: transparent;"
"padding: 1px;"
"}"
"QProgressBar::chunk {"
"background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 #b4e391 , stop: 1 #61c419);"
"}");
progressBar->setRange(0,100);
progressBar->setValue(0);
progressBar->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
progressBar->setTextVisible(true);
progressBar->setFormat("%p%");
progressBar->setOrientation(Qt::Horizontal);
addPermanentWidget(progressBar,0);
addPermanentWidget(iconButtomStatusLabel,0);
}
void jceStatusBar::setIconConnectionStatus(jceProgressStatus update)
{
QPixmap iconPix;
switch (update)
{
case jceProgressStatus::Error:
setProgressValue(0);
iconPix.load(":/icons/disconnected.png");
showMessage(tr("Error"));
break;
case jceProgressStatus::Disconnected:
setProgressValue(0);
iconPix.load(":/icons/disconnected.png");
showMessage(tr("Disconnected"));
break;
case jceProgressStatus::Ready:
setProgressValue(0);
iconPix.load(":/icons/disconnected.png");
showMessage(tr("Ready"));
break;
case jceProgressStatus::Connecting:
setProgressValue(5);
iconPix.load(":/icons/busy.png");
showMessage(tr("Connecting..."));
break;
case jceProgressStatus::Sending:
if (progressBar->value() < 10)
setProgressValue(10);
iconPix.load(":/icons/busy.png");
showMessage(tr("Sending..."));
break;
case jceProgressStatus::Recieving:
if (progressBar->value() < 15)
setProgressValue(15);
iconPix.load(":/icons/busy.png");
showMessage(tr("Recieving..."));
break;
case jceProgressStatus::Connected:
setProgressValue(30);
iconPix.load(":/icons/busy.png");
showMessage(tr("Connected"));
break;
case jceProgressStatus::Inserting:
setProgressValue(80);
iconPix.load(":/icons/busy.png");
showMessage(tr("Inserting"));
break;
case jceProgressStatus::LoggedIn:
setProgressValue(100);
iconPix.load(":/icons/connected.png");
showMessage(tr("Logged In."));
break;
case jceProgressStatus::Done:
setProgressValue(100);
iconPix.load(":/icons/connected.png");
showMessage(tr("Done"));
break;
}
iconButtomStatusLabel->setPixmap(iconPix);
repaint();
}
/**
* @brief Every time the value changes this method will be called
* @param value = the value of the progress Bar
*/
void jceStatusBar::setProgressValue(int value)
{
if (value == 0 || value == 100)
{
progressBar->setVisible(false);
progressBar->setValue(0);
}
else
{
progressBar->setValue(value);
progressBar->setVisible(true);
}
}
void jceStatusBar::addValueToProgressBar(int value)
{
progressBar->setValue(progressBar->value() + value);
}

View file

@ -0,0 +1,54 @@
#ifndef JCESTATUSBAR_H
#define JCESTATUSBAR_H
#include <QDebug>
#include <QLayout>
#include <QStatusBar>
#include <QProgressBar>
#include <QLabel>
#define STATUS_ICON_HEIGH 48
class jceStatusBar : public QStatusBar
{
Q_OBJECT
public:
enum jceProgressStatus
{
Ready,
Disconnected,
Connecting,
Connected,
LoggedIn,
Sending,
Recieving,
Inserting,
Done,
Error
};
jceStatusBar(QWidget *parent = 0);
void setIconConnectionStatus(jceProgressStatus update);
signals:
void progressHasPacket(int num);
public slots:
void setProgressValue(int val);
private slots:
void addValueToProgressBar(int value);
private:
QProgressBar * progressBar;
QLabel *iconButtomStatusLabel;
};
#endif // JCESTATUSBAR_H

View file

@ -5,34 +5,34 @@
#include "../src/appDatabase/savedata.h"
#include "../src/appDatabase/jce_logger.h"
//TODO: Project todo list
//update translation, update site spelling, release notes, update help
int main(int argc, char *argv[])
{
#ifdef QT_DEBUG // Incase QtCreator is in Debug mode all qDebug messages will go to terminal
qDebug() << "Running a debug build";
qDebug() << Q_FUNC_INFO << "Running a debug build";
#else // If QtCreator is on Release mode , qDebug messages will be logged in a log file.
// qDebug() << "Running a release build";
qInstallMessageHandler(jce_logger::customMessageHandler);
#endif
qDebug() << "Start : JCE Manager Launched";
qDebug() << Q_FUNC_INFO << "Start : JCE Manager Launched";
QApplication a(argc, argv);
QTranslator translator;
QString loco;
SaveData data;
loco = data.getLocal();
//Loading Local (From Settings file (SaveData.cpp)
if(loco == "default")
if(data.getLocale() == "en")
{
QString locale = QLocale::system().name();
translator.load("jce_"+locale , a.applicationDirPath());
qDebug() << "Local : Default Local Loaded";
}else if(loco == "he"){
translator.load("jce_he" , a.applicationDirPath());
qDebug() << "Local : Hebrew Local Loaded";
translator.load("jce_" + data.getLocale() , a.applicationDirPath());
qDebug() << Q_FUNC_INFO << "Locale : English Local Loaded";
}else if(data.getLocale() == "he"){
translator.load("jce_" + data.getLocale() , a.applicationDirPath());
qDebug() << Q_FUNC_INFO << "Local : Hebrew Local Loaded";
}else{
translator.load("jce_en" , a.applicationDirPath());
qDebug() << "Local : English Local Loaded";
data.reset();
qCritical() << Q_FUNC_INFO << "save data corrupted, reset file.";
}
a.installTranslator(&translator); //Setting local
a.setApplicationVersion(APP_VERSION);
@ -42,8 +42,8 @@ int main(int argc, char *argv[])
//Getting the exit code from QApplication. for debug reasons
int returnCode = a.exec();
if(returnCode == 0)
qDebug() << "End : JCE Manager Ended Successfully With A Return Code: " << returnCode;
qDebug() << Q_FUNC_INFO << "End : JCE Manager Ended Successfully With A Return Code: " << returnCode;
else
qCritical() << "End : JCE Manager Ended Unusccessfully With A Return Code: " << returnCode;
qCritical() << Q_FUNC_INFO << "End : JCE Manager Ended Unusccessfully With A Return Code: " << returnCode;
return returnCode;
}

View file

@ -1,362 +1,458 @@
#include "mainscreen.h"
#include "ui_mainscreen.h"
MainScreen::MainScreen(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainScreen)
{
ui->setupUi(this);
//this->setFixedSize(this->size()); //main not resizeable
ui->setupUi(this);
this->isBlocked = false;
//Login Tab
iconPix.load(":/icons/iconX.png");
ui->pswdLineEdit->setEchoMode((QLineEdit::Password));
ui->labelUsrInputStatus->setVisible(false);
ui->labelPswInputStatus->setVisible(false);
ui->labelUsrInputStatus->setPixmap(iconPix);
ui->labelPswInputStatus->setPixmap(iconPix);
ui->labelMadeBy->setOpenExternalLinks(true);
//StatusBar
statusBar = new jceStatusBar(this);
this->setStatusBar(statusBar);
//Login Tab
iconPix.load(":/icons/iconX.png");
ui->pswdLineEdit->setEchoMode((QLineEdit::Password));
ui->labelUsrInputStatus->setVisible(false);
ui->labelPswInputStatus->setVisible(false);
ui->labelUsrInputStatus->setPixmap(iconPix);
ui->labelPswInputStatus->setPixmap(iconPix);
//GPA Tab
ui->avgLCD->setPalette(QPalette(QPalette::WindowText,Qt::blue));
//StatusBar
ui->statusBar->setStyleSheet("QStatusBar::item { border: 0px solid black };");
ui->statusBar->setFixedHeight(STATUS_ICON_HEIGH);
ui->statusBar->showMessage(tr("Ready"));
//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->loginButton, statusBar);
this->calendar = new CalendarManager(this,ui->calendarGridLayoutMain);
this->data = new SaveData();
//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(ui->calendarGridLayoutMain);
this->data = new SaveData();
//check login File
if (data->isSaved())
//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);
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.";
//language
qDebug() << Q_FUNC_INFO << "Checking locale";
checkLocale();
qDebug() << Q_FUNC_INFO << "Ready.";
}
MainScreen::~MainScreen()
{
delete calendar;
delete courseTableMgr;
delete userLoginSetting;
delete loginHandel;
delete data;
delete ui;
delete statusBar;
delete calendar;
delete courseTableMgr;
delete userLoginSetting;
delete loginHandel;
delete data;
delete ui;
}
//EVENTS ON LOGIN TAB
void MainScreen::on_loginButton_clicked()
{
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
if ((ui->usrnmLineEdit->text().isEmpty()) || (ui->pswdLineEdit->text().isEmpty()))
if (!isBusy())
{
if (ui->usrnmLineEdit->text().isEmpty())
lock();
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
if ((ui->usrnmLineEdit->text().isEmpty()) || (ui->pswdLineEdit->text().isEmpty()))
{
ui->labelUsrInputStatus->setVisible(true);
qDebug() << Q_FUNC_INFO << "username input is empty";
}
else
ui->labelUsrInputStatus->setVisible(false);
if (ui->pswdLineEdit->text().isEmpty())
{
ui->labelPswInputStatus->setVisible(true);
qDebug() << Q_FUNC_INFO << "password input is empty";
}
else
ui->labelPswInputStatus->setVisible(false);
return;
}
else
{
ui->labelUsrInputStatus->setVisible(false);
ui->labelPswInputStatus->setVisible(false);
}
qDebug() << Q_FUNC_INFO << "login session start";
QApplication::setOverrideCursor(Qt::WaitCursor);
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 false";
ui->pswdLineEdit->setDisabled(false);
ui->usrnmLineEdit->setDisabled(false);
if (ui->usrnmLineEdit->text().isEmpty())
{
ui->labelUsrInputStatus->setVisible(true);
qDebug() << Q_FUNC_INFO << "username input is empty";
}
else
ui->labelUsrInputStatus->setVisible(false);
if (ui->pswdLineEdit->text().isEmpty())
{
ui->labelPswInputStatus->setVisible(true);
qDebug() << Q_FUNC_INFO << "password input is empty";
}
else
ui->labelPswInputStatus->setVisible(false);
unlock();
return;
}
else
{
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 false";
ui->pswdLineEdit->setDisabled(false);
ui->usrnmLineEdit->setDisabled(false);
}
unlock();
}
QApplication::restoreOverrideCursor();
}
void MainScreen::on_keepLogin_clicked()
{
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
if (ui->keepLogin->isChecked())
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());
qDebug() << Q_FUNC_INFO << "saving data";
data->setUsername(ui->usrnmLineEdit->text());
data->setPassword(ui->pswdLineEdit->text());
}
else
data->reset();
else
data->reset();
}
void MainScreen::on_usrnmLineEdit_editingFinished()
{
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
ui->usrnmLineEdit->setText(ui->usrnmLineEdit->text().toLower());
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())
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
if (!isBusy())
{
qWarning() << Q_FUNC_INFO << "Invalid dates! return";
QMessageBox::critical(this,tr("Error"),tr("Invalid Dates.\nMake Sure everything is correct and try again"));
return;
lock();
if (!checkIfValidDates())
{
qWarning() << Q_FUNC_INFO << "Invalid dates! return";
QMessageBox::critical(this,tr("Error"),tr("Invalid Dates.\nMake Sure everything is correct and try again"));
return;
}
QString pageString;
int status = 0;
if (loginHandel->isLoggedInFlag())
{
statusBar->setIconConnectionStatus(jceStatusBar::Ready);
if ((status = loginHandel->makeGradeRequest(ui->spinBoxCoursesFromYear->value(),
ui->spinBoxCoursesToYear->value(),ui->spinBoxCoursesFromSemester->value(),
ui->spinBoxCoursesToSemester->value())) == jceLogin::JCE_PAGE_PASSED)
{
qDebug() << Q_FUNC_INFO << "grade page is ready";
statusBar->setIconConnectionStatus(jceStatusBar::Inserting);
pageString = loginHandel->getCurrentPageContect();
courseTableMgr->setCoursesList(pageString);
statusBar->setIconConnectionStatus(jceStatusBar::Done);
}
else if (status == jceLogin::JCE_NOT_CONNECTED)
{
qWarning() << Q_FUNC_INFO << "not connected";
QApplication::restoreOverrideCursor();
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
statusBar->setIconConnectionStatus(jceStatusBar::Disconnected);
}
else
{
statusBar->setIconConnectionStatus(jceStatusBar::Error);
qCritical() << Q_FUNC_INFO << "grade get ended with" << status;
}
}
unlock();
}
QString pageString;
int status = 0;
QApplication::setOverrideCursor(Qt::WaitCursor);
if (loginHandel->isLoggedInFlag())
{
if ((status = loginHandel->makeGradeRequest(ui->spinBoxCoursesFromYear->value(),
ui->spinBoxCoursesToYear->value(),ui->spinBoxCoursesFromSemester->value(),
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";
QApplication::restoreOverrideCursor();
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
}
else
{
qCritical() << Q_FUNC_INFO << "grade get ended with" << status;
}
}
QApplication::restoreOverrideCursor();
}
bool MainScreen::checkIfValidDates()
{
bool flag = false;
if (ui->spinBoxCoursesFromYear->value() < ui->spinBoxCoursesToYear->value())
bool flag = false;
if (ui->spinBoxCoursesFromYear->value() < ui->spinBoxCoursesToYear->value())
{
//doesnt matter what is the semester, its valid!
flag = true;
}
else if ((ui->spinBoxCoursesFromYear->value() == ui->spinBoxCoursesToYear->value()))
{
//semester from must be equal or less than to semester
if (ui->spinBoxCoursesFromSemester->value() <= ui->spinBoxCoursesToSemester->value())
//doesnt matter what is the semester, its valid!
flag = true;
}
return flag;
else if ((ui->spinBoxCoursesFromYear->value() == ui->spinBoxCoursesToYear->value()))
{
//semester from must be equal or less than to semester
if (ui->spinBoxCoursesFromSemester->value() <= ui->spinBoxCoursesToSemester->value())
flag = true;
}
return flag;
}
void MainScreen::on_checkBoxCoursesInfluence_toggled(bool checked)
{
qDebug() << Q_FUNC_INFO << "only main courses toggeled" << checked;
this->userLoginSetting->setInfluenceCourseOnly(checked);
this->courseTableMgr->influnceCourseChanged(checked);
qDebug() << Q_FUNC_INFO << "only main courses toggeled" << checked;
this->userLoginSetting->setInfluenceCourseOnly(checked);
this->courseTableMgr->influnceCourseChanged(checked);
}
void MainScreen::on_spinBoxCoursesFromYear_valueChanged(int arg1)
{
ui->spinBoxCoursesFromYear->setValue(arg1);
ui->spinBoxCoursesFromYear->setValue(arg1);
}
void MainScreen::on_spinBoxCoursesToYear_valueChanged(int arg1)
{
ui->spinBoxCoursesToYear->setValue(arg1);
ui->spinBoxCoursesToYear->setValue(arg1);
}
void MainScreen::on_spinBoxCoursesFromSemester_valueChanged(int arg1)
{
ui->spinBoxCoursesFromSemester->setValue(arg1%4);
ui->spinBoxCoursesFromSemester->setValue(arg1%4);
}
void MainScreen::on_spinBoxCoursesToSemester_valueChanged(int arg1)
{
ui->spinBoxCoursesToSemester->setValue(arg1%4);
ui->spinBoxCoursesToSemester->setValue(arg1%4);
}
void MainScreen::on_coursesTable_itemChanged(QTableWidgetItem *item)
{
if (this->courseTableMgr->changes(item->text(),item->row(),item->column()))
ui->avgLCD->display(courseTableMgr->getAvg());
else
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"));
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());
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
courseTableMgr->clearTable();
ui->avgLCD->display(courseTableMgr->getAvg());
}
void MainScreen::on_graphButton_clicked()
{
qDebug() << Q_FUNC_INFO;
if (!courseTableMgr->showGraph())
QMessageBox::critical(this,tr("Error"),tr("You must to load GPA first\nClick on 'Get GPA'"));
}
void MainScreen::on_revertBtn_clicked()
{
qDebug() << Q_FUNC_INFO;
if (!isBusy())
{
lock();
courseTableMgr->revertChanges();
unlock();
}
}
//EVENTS ON CALENDAR TAB
void MainScreen::on_examsBtn_clicked()
{
calendar->showExamDialog();
}
void MainScreen::on_getCalendarBtn_clicked()
{
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
int status = 0;
QApplication::setOverrideCursor(Qt::WaitCursor);
if (loginHandel->isLoggedInFlag())
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
if (!isBusy())
{
if ((status = loginHandel->makeCalendarRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_PAGE_PASSED)
lock();
int status = 0;
QString page;
if (loginHandel->isLoggedInFlag())
{
//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";
}
statusBar->setIconConnectionStatus(jceStatusBar::Ready);
if ((status = loginHandel->makeCalendarRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_PAGE_PASSED)
{
statusBar->setIconConnectionStatus(jceStatusBar::Inserting);
calendar->resetTable();
page = loginHandel->getCurrentPageContect();
calendar->setCalendar(page);
else if (status == jceLogin::JCE_NOT_CONNECTED)
{
qWarning() << Q_FUNC_INFO << "not connected";
QApplication::restoreOverrideCursor();
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
qDebug() << Q_FUNC_INFO << "calendar is loaded";
//auto getting exam
if (loginHandel->isLoggedInFlag())
{
if ((status = loginHandel->makeExamsScheduleRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_PAGE_PASSED)
{
page = loginHandel->getCurrentPageContect();
calendar->setExamsSchedule(page);
qDebug() << Q_FUNC_INFO << "exams schedule is loaded";
statusBar->setIconConnectionStatus(jceStatusBar::Done);
}
else if (status == jceLogin::JCE_NOT_CONNECTED)
{
qWarning() << Q_FUNC_INFO << "not connected";
QApplication::restoreOverrideCursor();
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
statusBar->setIconConnectionStatus(jceStatusBar::Disconnected);
}
else
qCritical() << Q_FUNC_INFO << "exams request get ended with" << status;
}
else if (status == jceLogin::JCE_NOT_CONNECTED)
{
qWarning() << Q_FUNC_INFO << "not connected";
QApplication::restoreOverrideCursor();
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
statusBar->setIconConnectionStatus(jceStatusBar::Disconnected);
}
else
qCritical() << Q_FUNC_INFO << "calendar get ended with" << status;
}
}
else
qCritical() << Q_FUNC_INFO << "calendar get ended with" << status;
unlock();
}
QApplication::restoreOverrideCursor();
}
void MainScreen::on_exportToCVSBtn_clicked()
{
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
if (loginHandel->isLoggedInFlag())
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
if (loginHandel->isLoggedInFlag())
{
this->calendar->exportCalendarCSV();
this->calendar->exportCalendarCSV();
}
}
//EVENTS ON MENU BAR
void MainScreen::on_actionCredits_triggered()
{
qDebug() << Q_FUNC_INFO;
QMessageBox::about(this, "About",
"<a href='http://liranbg.github.io/JceManager/'>Jce Manager</a> v1.0.0<br><br>"
+tr("License:")+
"<br>GNU LESSER GENERAL PUBLIC LICENSE V2.1<br>"
+"<br>"+
"<a href='https://github.com/liranbg/JceManager'>JceManager Repository</a>"+
"<br><br>"
+tr("Powered By: ")+
"<a href='https://github.com/liranbg/jceConnection'> Jce Connection</a><br><br>"
+tr("Developed By")+
":<ul>"+
"<li><a href='mailto:liranbg@gmail.com'>"+tr("Liran")+"</a></li>"+
"<li><a href='mailto:sagidayan@gmail.com'>"+tr("Sagi")+"</a></li></ul>"
);
}
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",
"<b>"
+tr("Help Guide")+
"</b><ul>"
+tr("<br><li>Login: <ul><li>Type your username and password and click Login.</li><li>Once you are connected, you will see a green ball in the right buttom panel.</li></ul></li>")
+tr("<br><li>Getting GPA sheet<ul><li>Click on GPA Tab</li><li> Select your dates and click on Add</li></ul></li>")
+tr("<br><li>Average Changing<ul><li>Change one of your grade and see the average in the buttom panel changing.</li></ul></li>")
+tr("<br><li>Getting Calendar<ul><li>Click on Calendar Tab</li><li> Select your dates and click on Get Calendar</li></ul></li>")
+tr("<br><li>For exporting your calendar to a .CSV file:<ul><li>Do previous step and continue to next step</li><li> Click on Export to CSV</li><li>Select your dates and click OK</li><li>Once you're Done, go on your calendar and import your csv file</li></li>")+
"<br><br>"
+tr("<b>For more information, please visit us at: <a href='http://liranbg.github.io/JceManager/'>Jce Manager site</a></b>"));
}
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() << 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);
}
else
ui->actionHebrew->setChecked(true);
}
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() << 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);
}
else
ui->actionEnglish->setChecked(true);
}
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() << 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);
}
else
ui->actionOS_Default->setChecked(true);
}
void MainScreen::checkLocale()
{
if(data->getLocal() == "en")
{
ui->actionHebrew->setChecked(false);
ui->actionOS_Default->setChecked(false);
ui->actionEnglish->setChecked(true);
}else if(data->getLocal() == "he"){
ui->actionHebrew->setChecked(true);
ui->actionOS_Default->setChecked(false);
ui->actionEnglish->setChecked(false);
}else{
ui->actionHebrew->setChecked(false);
ui->actionOS_Default->setChecked(true);
ui->actionEnglish->setChecked(false);
}
}
//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() << 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);
// }
// else
// ui->actionHebrew->setChecked(true);
//}
//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() << 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);
// }
// else
// ui->actionEnglish->setChecked(true);
//}
//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() << Q_FUNC_INFO << "Changed Language to OS Default";
// data->setLocal("default");
//
// }
// else
// ui->actionOS_Default->setChecked(true);
//}
//MAIN SCREEN
void MainScreen::on_labelMadeBy_linkActivated(const QString &link)
{
qDebug() << Q_FUNC_INFO << "link: " << link;
qDebug() << Q_FUNC_INFO << "link: " << link;
}
/**
* @brief MainScreen::lock
* turn isblocked into true to avoid multiple requests and to cause errors
*/
void MainScreen::lock()
{
QApplication::setOverrideCursor(Qt::WaitCursor);
this->isBlocked = true;
}
void MainScreen::unlock()
{
QApplication::restoreOverrideCursor();
this->isBlocked = false;
}
bool MainScreen::isBusy()
{
return this->isBlocked;
}
void MainScreen::on_langButton_clicked()
{
qDebug() << Q_FUNC_INFO;
if (data->getLocale() == "en")
{
qDebug() << Q_FUNC_INFO << "Changed lang to he";
data->setLocale("he");
}else if(data->getLocale() == "he"){
qDebug() << Q_FUNC_INFO << "Changed lang to en";
data->setLocale("en");
}else{
qCritical() << Q_FUNC_INFO << "currupted data. reset to en";
data->reset();
data->setLocale("en");
}
checkLocale();
QMessageBox::information(this,tr("Settings"),tr("Your settings will take effect next time you start the program"),QMessageBox::Ok);
}
void MainScreen::on_creditButton_clicked()
{
qDebug() << Q_FUNC_INFO;
QMessageBox::about(this, "About",
"<a href='http://liranbg.github.io/JceManager/'>Jce Manager</a> v1.0.0<br><br>"
+tr("License:")+
"<br>GNU LESSER GENERAL PUBLIC LICENSE V2.1<br>"
+"<br>"+
"<a href='https://github.com/liranbg/JceManager'>JceManager Repository</a>"+
"<br><br>"
+tr("Powered By: ")+
"<a href='https://github.com/liranbg/jceConnection'> Jce Connection</a><br><br>"
+tr("Developed By")+
":<ul>"+
"<li><a href='mailto:liranbg@gmail.com'>"+tr("Liran")+"</a></li>"+
"<li><a href='mailto:sagidayan@gmail.com'>"+tr("Sagi")+"</a></li></ul>"
);
}
void MainScreen::on_howtoButton_clicked()
{
qDebug() << Q_FUNC_INFO;
QMessageBox::information(this,"How To",
"<b>"
+tr("Help Guide")+
"</b><ul>"
+tr("<br><li>Login: <ul><li>Type your username and password and click Login.</li><li>Once you are connected, you will see a green ball in the right buttom panel.</li></ul></li>")
+tr("<br><li>Getting GPA sheet<ul><li>Click on GPA Tab</li><li> Select your dates and click on Add</li></ul></li>")
+tr("<br><li>Average Changing<ul><li>Change one of your grade and see the average in the buttom panel changing.</li></ul></li>")
+tr("<br><li>Getting Calendar<ul><li>Click on Calendar Tab</li><li> Select your dates and click on Get Calendar</li></ul></li>")
+tr("<br><li>For exporting your calendar to a .CSV file:<ul><li>Do previous step and continue to next step</li><li> Click on Export to CSV</li><li>Select your dates and click OK</li><li>Once you're Done, go on your calendar and import your csv file</li></li>")+
"<br><br>"
+tr("<b>For more information, please visit us at: <a href='http://liranbg.github.io/JceManager/'>Jce Manager site</a></b>"));
}
void MainScreen::checkLocale()
{
qDebug() << Q_FUNC_INFO;
if (data->getLocale() == "en")
{
ui->langButton->setIcon(QIcon(":/icons/us.png"));
}else if(data->getLocale() == "he"){
ui->langButton->setIcon(QIcon(":/icons/il.png"));
}else{
qCritical() << Q_FUNC_INFO << "currupted data. reset eng";
data->reset();
ui->langButton->setIcon(QIcon(":/icons/us.png"));
}
}

View file

@ -10,9 +10,10 @@
#include "./CourseTab/coursestablemanager.h"
#include "./LoginTab/loginhandler.h"
#include "./CalendarTab/CalendarManager.h"
#include "./jceWidgets/jcestatusbar.h"
#define STATUS_ICON_HEIGH 35
namespace Ui {
class MainScreen;
}
@ -27,54 +28,50 @@ public:
private slots:
void on_ratesButton_clicked();
//Login Tab slots
void on_loginButton_clicked();
void on_keepLogin_clicked();
void on_usrnmLineEdit_editingFinished();
void on_actionCredits_triggered();
//GPA Tab slots
void on_ratesButton_clicked();
void on_graphButton_clicked();
void on_revertBtn_clicked();
void on_clearTableButton_clicked();
void on_actionExit_triggered();
void on_coursesTable_itemChanged(QTableWidgetItem *item);
void on_keepLogin_clicked();
void on_actionHow_To_triggered();
void on_getCalendarBtn_clicked();
void on_checkBoxCoursesInfluence_toggled(bool checked);
//Schedule Tab slots
void on_getCalendarBtn_clicked();
void on_examsBtn_clicked();
void on_exportToCVSBtn_clicked();
void on_actionHebrew_triggered();
void on_actionEnglish_triggered();
void on_actionOS_Default_triggered();
//Main screen general slots
void on_spinBoxCoursesFromSemester_valueChanged(int arg1);
void on_spinBoxCoursesFromYear_valueChanged(int arg1);
void on_spinBoxCoursesToYear_valueChanged(int arg1);
void on_spinBoxCoursesToSemester_valueChanged(int arg1);
void on_labelMadeBy_linkActivated(const QString &link);
//Setting dock
void on_langButton_clicked();
void on_creditButton_clicked();
void on_howtoButton_clicked();
private:
void checkLocale();
bool checkIfValidDates();
bool isBusy();
void lock();
void unlock();
Ui::MainScreen *ui;
bool isBlocked;
QPixmap iconPix;
user *userLoginSetting;
SaveData *data;
@ -83,6 +80,8 @@ private:
coursesTableManager *courseTableMgr;
loginHandler *loginHandel;
jceStatusBar *statusBar;
};
#endif // MAINSCREEN_H

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

BIN
resources/busy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
resources/connected.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -1,10 +1,15 @@
<RCC>
<qresource prefix="/icons">
<file>blueStatusIcon.png</file>
<file>greenStatusIcon.png</file>
<file>redStatusIcon.png</file>
<file>icon.ico</file>
<file>iconX.png</file>
<file>iconV.png</file>
<file>il.png</file>
<file>us.png</file>
<file>help.png</file>
<file>team.png</file>
<file>busy.png</file>
<file>connected.png</file>
<file>disconnected.png</file>
<file>logo.png</file>
</qresource>
</RCC>

BIN
resources/disconnected.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
resources/flags/il.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
resources/flags/us.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

BIN
resources/help.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
resources/il.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
resources/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

BIN
resources/team.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
resources/us.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -8,7 +8,7 @@
* Message types cam be:
*
* - DEBUG
* - WARNING
* - WARNINGS
* - CRITICAL
* - FATAL
*

View file

@ -39,7 +39,7 @@ bool SaveData::isSaved()
* # username
* # password
* # calendar
* # local
* # locale
*/
void SaveData::reset()
{
@ -82,13 +82,13 @@ void SaveData::setCal(QString cal)
}
/**
* @brief gest a local and saves it into the QMap.
* @brief gest a locale and saves it into the QMap.
* QMap then is saved to the file.
* @param local - QString (he, en, default)
* @param locale - QString (he, en)
*/
void SaveData::setLocal(QString local)
void SaveData::setLocale(QString local)
{
DB.insert("local", local);
DB.insert("locale", local);
save();
}
@ -112,11 +112,11 @@ QString SaveData::getPassword()
/**
* @brief read from file
* @return local
* @return locale
*/
QString SaveData::getLocal()
QString SaveData::getLocale()
{
return DB.value("local");
return DB.value("locale");
}
/**
@ -160,7 +160,7 @@ void SaveData::createDB()
{
DB.insert("username", "");
DB.insert("password", "");
DB.insert("local", "default");
DB.insert("locale", "en");
DB.insert("calendar", "");
}

View file

@ -12,7 +12,7 @@
* Keys:
* "username"
* "password"
* "local"
* "locale"
* "calendar"
*
* Note that the password will be encrypted using the SimpleCrypt class!
@ -40,11 +40,11 @@ public:
void setUsername(QString username);
void setPassword(QString password);
void setCal(QString cal);
void setLocal(QString local);
void setLocale(QString locale);
QString getUsername();
QString getPassword();
QString getCal();
QString getLocal();
QString getLocale();
private:
QMap<QString, QString> DB;

View file

@ -3,17 +3,20 @@
/**
* @brief jceSSLClient::jceSSLClient Constructer, setting the signals
*/
jceSSLClient::jceSSLClient() : flag(false), packet(""),networkConf(), reConnection(false)
jceSSLClient::jceSSLClient(jceStatusBar *statusBar) : loggedIAndConnectedFlag(false), readingFlag(false),
reConnectionFlag(false), networkConf(), packet(""), recieveLastPacket(false), packetSizeRecieved(0)
{
//setting signals
connect(this,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(checkErrors(QAbstractSocket::SocketError)));
connect(this,SIGNAL(connected()),this,SLOT(setConnected()));
connect(this,SIGNAL(encrypted()),this,SLOT(setEncrypted()));
connect(this,SIGNAL(disconnected()),this,SLOT(setDisconnected()));
connect(&networkConf,SIGNAL(onlineStateChanged(bool)),this,SLOT(setOnlineState(bool)));
//loop event will connect the server, and when it is connected, it will quit - but connection will be open
connect(this, SIGNAL(encrypted()), &loop, SLOT(quit()));
connect(this, SIGNAL(error(QAbstractSocket::SocketError)),&loop,SLOT(quit()));
this->statusBar = statusBar;
//setting signals
connect(this,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(checkErrors(QAbstractSocket::SocketError)));
connect(this,SIGNAL(connected()),this,SLOT(setConnected()));
connect(this,SIGNAL(encrypted()),this,SLOT(setEncrypted()));
connect(this,SIGNAL(disconnected()),this,SLOT(setDisconnected()));
connect(&networkConf,SIGNAL(onlineStateChanged(bool)),this,SLOT(setOnlineState(bool)));
//loop event will connect the server, and when it is connected, it will quit - but connection will be open
connect(this, SIGNAL(encrypted()), &loginThreadLoop, SLOT(quit()));
connect(this, SIGNAL(error(QAbstractSocket::SocketError)),&loginThreadLoop,SLOT(quit()));
}
/**
@ -24,48 +27,48 @@ jceSSLClient::jceSSLClient() : flag(false), packet(""),networkConf(), reConnecti
*/
bool jceSSLClient::makeConnect(QString server, int port)
{
if (this->supportsSsl() == false)
if (this->supportsSsl() == false)
{
qCritical() << Q_FUNC_INFO << "Couldnt load ssl package. ERROR";
return false;
qCritical() << Q_FUNC_INFO << "Couldnt load ssl package. ERROR";
return false;
}
else
qDebug() << Q_FUNC_INFO << "ssl loaded.";
else
qDebug() << Q_FUNC_INFO << "ssl loaded.";
if (isConnectedToNetwork() == false)
if (isConnectedToNetwork() == false)
{
qDebug() << Q_FUNC_INFO << "return false. not online";
return false;
qDebug() << Q_FUNC_INFO << "return false. not online";
return false;
}
else
qDebug() << Q_FUNC_INFO << "we're online";
else
qDebug() << Q_FUNC_INFO << "we're online";
if (reConnection) //reset reconnectiong flag
if (reConnectionFlag) //reset reconnectiong flag
{
qDebug() << Q_FUNC_INFO << "Making Reconnection";
qDebug() << Q_FUNC_INFO << "Making Reconnection";
}
else
qDebug() << Q_FUNC_INFO << "Making Connection";
else
qDebug() << Q_FUNC_INFO << "Making Connection";
if (isConnected())
if (isConnected())
{
qDebug() << Q_FUNC_INFO << "flag=true, calling makeDisconnect()";
makeDiconnect();
qDebug() << Q_FUNC_INFO << "flag=true, calling makeDisconnect()";
makeDiconnect();
}
qDebug() << Q_FUNC_INFO << "Connection to: " << server << "On Port: " << port;
connectToHostEncrypted(server.toStdString().c_str(), port);
qDebug() << Q_FUNC_INFO << "Connection to: " << server << "On Port: " << port;
connectToHostEncrypted(server.toStdString().c_str(), port);
loop.exec(); //starting connection, waiting to encryption and then it ends
loginThreadLoop.exec(); //starting connection, waiting to encryption and then it ends
qDebug() << Q_FUNC_INFO << "returning the connection status: " << isConnected();
if (reConnection)
qDebug() << Q_FUNC_INFO << "returning the connection status: " << isConnected();
if (reConnectionFlag)
{
reConnection = false;
emit serverDisconnectedbyRemote();
reConnectionFlag = false;
emit serverDisconnectedbyRemote();
}
return isConnected();
return isConnected();
}
/**
@ -74,15 +77,15 @@ bool jceSSLClient::makeConnect(QString server, int port)
*/
bool jceSSLClient::makeDiconnect()
{
if (loop.isRunning())
if (loginThreadLoop.isRunning())
{
qWarning() << Q_FUNC_INFO << "Killing connection thread";
loop.exit();
qWarning() << Q_FUNC_INFO << "Killing connection thread";
loginThreadLoop.exit();
}
qDebug() << Q_FUNC_INFO << "disconnecting from host and emitting disconnected()";
this->disconnectFromHost(); //emits disconnected > setDisconnected
setSocketState(QAbstractSocket::SocketState::UnconnectedState);
return (!isConnected());
qDebug() << Q_FUNC_INFO << "disconnecting from host and emitting disconnected()";
this->disconnectFromHost(); //emits disconnected > setDisconnected
setSocketState(QAbstractSocket::SocketState::UnconnectedState);
return (!isConnected());
}
@ -92,30 +95,30 @@ bool jceSSLClient::makeDiconnect()
*/
bool jceSSLClient::isConnected()
{
bool tempFlag = false;
//checking state before returning flag!
if (state() == QAbstractSocket::SocketState::UnconnectedState)
bool tempFlag = false;
//checking state before returning flag!
if (state() == QAbstractSocket::SocketState::UnconnectedState)
{
tempFlag = false;
tempFlag = false;
}
else if (state() == QAbstractSocket::SocketState::ClosingState)
else if (state() == QAbstractSocket::SocketState::ClosingState)
{
tempFlag = false;
tempFlag = false;
}
else if (state() == QAbstractSocket::SocketState::ConnectedState)
else if (state() == QAbstractSocket::SocketState::ConnectedState)
{
if (isConnectedToNetwork())
tempFlag = true;
else
if (isConnectedToNetwork())
tempFlag = true;
else
{
this->setSocketState(QAbstractSocket::SocketState::UnconnectedState);
tempFlag = false;
this->setSocketState(QAbstractSocket::SocketState::UnconnectedState);
tempFlag = false;
}
}
if (!isConnectedToNetwork()) //no link, ethernet\wifi
tempFlag = false;
return ((flag) && (tempFlag));
if (!isConnectedToNetwork()) //no link, ethernet\wifi
tempFlag = false;
return ((loggedIAndConnectedFlag) && (tempFlag));
}
/**
* @brief jceSSLClient::sendData - given string, send it to server
@ -124,88 +127,122 @@ bool jceSSLClient::isConnected()
*/
bool jceSSLClient::sendData(QString str)
{
bool sendDataFlag = false;
if (isConnected()) //if connected
bool sendDataFlag = false;
int amount = 0;
if (isConnected()) //if connected
{
write(str.toStdString().c_str(),str.length());
if (waitForBytesWritten())
sendDataFlag = true;
}
qDebug() << Q_FUNC_INFO << "Sending Data status is: " << sendDataFlag;
return sendDataFlag;
}
/**
* @brief jceSSLClient::recieveData
* @param str this variable will store the recieved data
* @param fast true for LOGIN ONLY, false to retrieve all data
* @return true if recieved data bigger than zero
*/
bool jceSSLClient::recieveData(QString &str, bool fast)
{
qDebug() << Q_FUNC_INFO << "Data receiving!";
packet = "";
bool sflag = false;
if (fast) //fast mode connection, good only for login step!!!!
{
qDebug() << "jceSSLClient::recieveData login step receiving";
QEventLoop loop;
connect(this, SIGNAL(readyRead()), &loop, SLOT(quit()));
connect(this, SIGNAL(readyRead()), this, SLOT(readIt()));
loop.exec();
disconnect(this, SIGNAL(readyRead()), &loop, SLOT(quit()));
disconnect(this, SIGNAL(readyRead()), this, SLOT(readIt()));
}
else
{
qDebug() << "jceSSLClient::recieveData normal receiving";
QString p;
while (waitForReadyRead(milisTimeOut))
statusBar->setIconConnectionStatus(jceStatusBar::Sending);
amount = write(str.toStdString().c_str(),str.length());
qDebug() << Q_FUNC_INFO << "lenght send: " << str.length() << "lenght recieved: " << amount;
if (amount == -1)
{
do
{
p = readAll();
packet.append(p);
}while (p.size() > 0);
qCritical() << Q_FUNC_INFO << "SendData ended with -1";
sendDataFlag = false;
}
else if (waitForBytesWritten())
sendDataFlag = true;
}
str = packet;
qDebug() << Q_FUNC_INFO << "received bytes: " << str.length() ;
if (str.length() > 0)
sflag = true;
qDebug() << Q_FUNC_INFO << "return with flag: " << sflag;
return sflag;
qDebug() << Q_FUNC_INFO << "Sending Data status is: " << sendDataFlag;
return sendDataFlag;
}
/**
* @brief jceSSLClient::recieveData - recieving data through threaded reading and mutex
* @param str - string to fill with data.
* @return true if packet has recieced the last packet -> true, otherwise ->false
*/
bool jceSSLClient::recieveData(QString *str)
{
statusBar->setIconConnectionStatus(jceStatusBar::Recieving);
qDebug() << Q_FUNC_INFO << "Data receiving!";
str->clear();
packet = "";
recieveLastPacket = false;
packetSizeRecieved = 0; //counting packet size
readingFlag = true; //to ignore timeout socket error
timer.setSingleShot(true); //counting just once.
timer.start(milisTimeOut); //if timer is timeout -> it means the connection takes long time
connect(this, SIGNAL(readyRead()), this, SLOT(readIt())); //we have something to read
connect(&timer, SIGNAL(timeout()), &readerLoop, SLOT(quit())); //if timer timeout > exiting event
readerLoop.exec();
disconnect(&timer, SIGNAL(timeout()), &readerLoop, SLOT(quit()));
disconnect(this, SIGNAL(readyRead()), this, SLOT(readIt()));
str->append(packet);
// qDebug() << *str; //if you want to see the whole packet, unmark me
qDebug() << Q_FUNC_INFO << "packet size: " << packetSizeRecieved << "received data lenght: " << str->length();
qDebug() << Q_FUNC_INFO << "return with flag: " << recieveLastPacket;
readingFlag = false; //finished reading session
return recieveLastPacket; //we have the last packet
}
/**
* @brief jceSSLClient::readIt function to read for fast mode in recieved data
* @brief jceSSLClient::readIt
* this method, called by a thread to read the bytes avilable by the remote server
* each packet we append into the class private var 'packet' (mutexed)
* if we recieve the last packet (see tags below) we set the timer of the calling function to 100msc
*
*/
void jceSSLClient::readIt()
{
QString p;
do
int packSize = bytesAvailable();
int doTimes=0;
QByteArray tempPacket;
do
{
p = readAll();
packet.append(p);
}while (p.size() > 0);
// qDebug() << Q_FUNC_INFO << "packet size" << packSize;
if (doTimes++ > 0) //for debbuging, checking thread looping times
qDebug() << Q_FUNC_INFO << "do loop" << doTimes;
waitForReadyRead(100);
tempPacket = read(packSize);
readerAppendingLocker.lock();
packetSizeRecieved += packSize;
packet.append(tempPacket);
packet.append("\0");
readerAppendingLocker.unlock();
emit statusBar->progressHasPacket(10);
if ((tempPacket.mid(tempPacket.length()-7,7) == ".HTM-->")
|| (tempPacket.mid(tempPacket.length()-7,7) == ".htm-->")
|| tempPacket.contains("</html>")
)
{
//we have the last packet. (uses only in login first step
recieveLastPacket = true;
timer.setInterval(200);
}
else
{
//just a packet with data
}
}while ((packSize = bytesAvailable()) > 0);
}
void jceSSLClient::setOnlineState(bool isOnline)
{
qWarning() << Q_FUNC_INFO << "isOnline status change: " << isOnline;
if (isOnline) //to be added later
qWarning() << Q_FUNC_INFO << "isOnline status change: " << isOnline;
if (isOnline) //to be added later
{
qDebug() << Q_FUNC_INFO << "Online Statue has been changed. we are online";
//we can add here auto reconnect if wifi\ethernet link has appear
//will be added next version
qDebug() << Q_FUNC_INFO << "Online Statue has been changed. we are online";
//we can add here auto reconnect if wifi\ethernet link has appear
//will be added next version
}
else
else
{
qWarning() << Q_FUNC_INFO << "Online State has been changed. emitting NoInternetLink";
this->makeDiconnect();
emit noInternetLink();
qWarning() << Q_FUNC_INFO << "Online State has been changed. emitting NoInternetLink";
this->makeDiconnect();
emit noInternetLink();
}
}
@ -214,19 +251,19 @@ void jceSSLClient::setOnlineState(bool isOnline)
*/
void jceSSLClient::setConnected()
{
waitForEncrypted();
waitForEncrypted();
}
/**
* @brief jceSSLClient::setDisconnected closing socket, updating state and setting flag to false
*/
void jceSSLClient::setDisconnected()
{
qDebug() << Q_FUNC_INFO << "connection has been DISCONNECTED";
this->setSocketState(QAbstractSocket::SocketState::UnconnectedState);
packet.clear();
flag = false;
if (reConnection)
makeConnect();
qDebug() << Q_FUNC_INFO << "connection has been DISCONNECTED";
this->setSocketState(QAbstractSocket::SocketState::UnconnectedState);
packet.clear();
loggedIAndConnectedFlag = false;
if (reConnectionFlag)
makeConnect();
}
@ -235,14 +272,14 @@ void jceSSLClient::setDisconnected()
*/
void jceSSLClient::setEncrypted()
{
qDebug() << Q_FUNC_INFO << "connection has been ENCRYPTED";
setReadBufferSize(10000);
setSocketOption(QAbstractSocket::KeepAliveOption,true);
flag = true;
if (!isConnected())
qDebug() << Q_FUNC_INFO << "connection has been ENCRYPTED";
setReadBufferSize(packetSize);
setSocketOption(QAbstractSocket::KeepAliveOption,true);
loggedIAndConnectedFlag = true;
if (!isConnected())
{
qWarning() << Q_FUNC_INFO << "Connection status didnt change! reseting flag to false";
flag = false;
qWarning() << Q_FUNC_INFO << "Connection status didnt change! reseting flag to false";
loggedIAndConnectedFlag = false;
}
}
@ -253,116 +290,116 @@ void jceSSLClient::setEncrypted()
*/
void jceSSLClient::showIfErrorMsg()
{
QMessageBox msgBox;
SocketError enumError = error();
QString errorString;
bool relevantError = false;
switch (enumError)
QMessageBox msgBox;
SocketError enumError = error();
QString errorString;
bool relevantError = false;
switch (enumError)
{
case QAbstractSocket::SocketError::ConnectionRefusedError: /**/
errorString = QObject::tr("ConnectionRefusedError");
//The connection was refused by the peer (or timed out).
relevantError = true;
break;
errorString = QObject::tr("ConnectionRefusedError");
//The connection was refused by the peer (or timed out).
relevantError = true;
break;
case QAbstractSocket::SocketError::RemoteHostClosedError: /**/
errorString = QObject::tr("RemoteHostClosedError");
//The remote host closed the connection
if (isConnectedToNetwork()) //we can reconnect
errorString = QObject::tr("RemoteHostClosedError");
//The remote host closed the connection
if (isConnectedToNetwork()) //we can reconnect
{
reConnection = true;
reConnectionFlag = true;
}
else
relevantError = true;
break;
else
relevantError = true;
break;
case QAbstractSocket::SocketError::HostNotFoundError: /**/
errorString = QObject::tr("HostNotFoundError");
//The host address was not found.
relevantError = true;
break;
case QAbstractSocket::SocketError::SocketAccessError: /**/
errorString = QObject::tr("SocketAccessError");
//The socket operation failed because the application lacked the required privileges.
break;
case QAbstractSocket::SocketError::SocketTimeoutError: /**/
errorString = QObject::tr("SocketTimeoutError");
//The socket operation timed out.
if (isConnected()); //ignore it if connected.
else
errorString = QObject::tr("HostNotFoundError");
//The host address was not found.
relevantError = true;
break;
break;
case QAbstractSocket::SocketError::SocketAccessError: /**/
errorString = QObject::tr("SocketAccessError");
//The socket operation failed because the application lacked the required privileges.
break;
case QAbstractSocket::SocketError::SocketTimeoutError: /**/
errorString = QObject::tr("SocketTimeoutError");
//The socket operation timed out.
if (isConnected()); //ignore it if connected.
else
relevantError = true;
break;
case QAbstractSocket::SocketError::NetworkError: /**/
errorString = QObject::tr("NetworkError");
//An error occurred with the network (e.g., the network cable was accidentally plugged out).
if (isConnectedToNetwork()) //we can reconnect
errorString = QObject::tr("NetworkError");
//An error occurred with the network (e.g., the network cable was accidentally plugged out).
if (isConnectedToNetwork()) //we can reconnect
{
}
else
relevantError = true;
break;
else
relevantError = true;
break;
case QAbstractSocket::SocketError::SslHandshakeFailedError: /**/
errorString = QObject::tr("SslHandshakeFailedError");
relevantError = true;
break;
errorString = QObject::tr("SslHandshakeFailedError");
relevantError = true;
break;
case QAbstractSocket::SocketError::SslInternalError: /**/
errorString = QObject::tr("SslInternalError");
relevantError = true;
break;
errorString = QObject::tr("SslInternalError");
relevantError = true;
break;
case QAbstractSocket::SocketError::SslInvalidUserDataError: /**/
errorString = QObject::tr("SslInvalidUserDataError");
relevantError = true;
break;
errorString = QObject::tr("SslInvalidUserDataError");
relevantError = true;
break;
case QAbstractSocket::SocketError::DatagramTooLargeError: //not relevant to us
errorString = QObject::tr("DatagramTooLargeError");
break;
errorString = QObject::tr("DatagramTooLargeError");
break;
case QAbstractSocket::SocketError::SocketResourceError: //not relevant to us
break;
break;
case QAbstractSocket::SocketError::OperationError: //not relevant, except for debug
errorString = QObject::tr("OperationError");
break;
errorString = QObject::tr("OperationError");
break;
case QAbstractSocket::SocketError::AddressInUseError: //not relevant to us
errorString = QObject::tr("AddressInUseError");
break;
errorString = QObject::tr("AddressInUseError");
break;
case QAbstractSocket::SocketError::SocketAddressNotAvailableError: //not relevant to us
errorString = QObject::tr("SocketAddressNotAvailableError");
break;
errorString = QObject::tr("SocketAddressNotAvailableError");
break;
case QAbstractSocket::SocketError::UnsupportedSocketOperationError: //for very old computers, not relevant to us
errorString = QObject::tr("UnsupportedSocketOperationError");
break;
errorString = QObject::tr("UnsupportedSocketOperationError");
break;
case QAbstractSocket::SocketError::ProxyAuthenticationRequiredError: //not relevant to us
errorString = QObject::tr("ProxyAuthenticationRequiredError");
break;
errorString = QObject::tr("ProxyAuthenticationRequiredError");
break;
case QAbstractSocket::SocketError::ProxyConnectionRefusedError: //not relevant to us
errorString = QObject::tr("ProxyConnectionRefusedError");
break;
errorString = QObject::tr("ProxyConnectionRefusedError");
break;
case QAbstractSocket::SocketError::UnfinishedSocketOperationError: //not relevant to us
errorString = QObject::tr("UnfinishedSocketOperationError");
break;
errorString = QObject::tr("UnfinishedSocketOperationError");
break;
case QAbstractSocket::SocketError::ProxyConnectionClosedError: //not relevant to us
errorString = QObject::tr("ProxyConnectionClosedError");
break;
errorString = QObject::tr("ProxyConnectionClosedError");
break;
case QAbstractSocket::SocketError::ProxyConnectionTimeoutError: //not relevant to us
errorString = QObject::tr("ProxyConnectionTimeoutError");
break;
errorString = QObject::tr("ProxyConnectionTimeoutError");
break;
case QAbstractSocket::SocketError::ProxyNotFoundError: //not relevant to us
errorString = QObject::tr("ProxyNotFoundError");
break;
errorString = QObject::tr("ProxyNotFoundError");
break;
case QAbstractSocket::SocketError::ProxyProtocolError: //not relevant to us
errorString = QObject::tr("ProxyProtocolError");
break;
errorString = QObject::tr("ProxyProtocolError");
break;
case QAbstractSocket::SocketError::TemporaryError: //not relevant to us
errorString = QObject::tr("TemporaryError");
break;
errorString = QObject::tr("TemporaryError");
break;
case QAbstractSocket::SocketError::UnknownSocketError: //not relevant, except for debug
errorString = QObject::tr("UnknownSocketError");
relevantError = true;
break;
errorString = QObject::tr("UnknownSocketError");
relevantError = true;
break;
}
if (relevantError) //informative string to be shown
if (relevantError) //informative string to be shown
{
qDebug() << Q_FUNC_INFO << "relevant error.";
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(errorString);
msgBox.exec();
qDebug() << Q_FUNC_INFO << "relevant error.";
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(errorString);
msgBox.exec();
}
}
/**
@ -371,46 +408,50 @@ void jceSSLClient::showIfErrorMsg()
*/
void jceSSLClient::checkErrors(QAbstractSocket::SocketError a)
{
//ignore this stupid error
bool timeout = (a == QAbstractSocket::SocketError::SocketTimeoutError);
if (!((isConnected()) && (timeout)))
//ignore this stupid error
bool timeout = (a == QAbstractSocket::SocketError::SocketTimeoutError);
if (!((isConnected()) && (timeout)))
{
qWarning() << Q_FUNC_INFO << "isOnline?: " << isConnectedToNetwork();
qWarning() << Q_FUNC_INFO << "state is: " << state();
qWarning() << Q_FUNC_INFO << "Var Error: " << a;
qWarning() << Q_FUNC_INFO << "Error: " << errorString();
qWarning() << Q_FUNC_INFO << "isOnline?: " << isConnectedToNetwork();
qWarning() << Q_FUNC_INFO << "state is: " << state();
qWarning() << Q_FUNC_INFO << "Var Error: " << a;
qWarning() << Q_FUNC_INFO << "Error: " << errorString();
}
else
else if (!readingFlag)
{
qDebug() << Q_FUNC_INFO << "isConnected?: " << isConnected() << "is timeout?" << timeout;
qWarning() << Q_FUNC_INFO << "isOnline?: " << isConnectedToNetwork();
qWarning() << Q_FUNC_INFO << "state is: " << state();
qWarning() << Q_FUNC_INFO << "Var Error: " << a;
qWarning() << Q_FUNC_INFO << "Error: " << errorString();
qWarning() << Q_FUNC_INFO << "isConnected?: " << isConnected() << "is timeout?" << timeout;
qWarning() << Q_FUNC_INFO << "isOnline?: " << isConnectedToNetwork() << "state is: " << state();
qWarning() << Q_FUNC_INFO << "Error: " << errorString();
}
showIfErrorMsg();
else
{
//timeout when reading
}
showIfErrorMsg();
}
/** written by KARAN BALKAR
* @brief jceSSLClient::isConnectedToNetwork
*
* @return
*/
bool jceSSLClient::isConnectedToNetwork(){
QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces();
bool result = false;
QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces();
bool result = false;
for (int i = 0; i < ifaces.count(); ++i)
for (int i = 0; i < ifaces.count(); ++i)
{
QNetworkInterface iface = ifaces.at(i);
QNetworkInterface iface = ifaces.at(i);
if ( iface.flags().testFlag(QNetworkInterface::IsUp) && !iface.flags().testFlag(QNetworkInterface::IsLoopBack))
for (int j=0; j < iface.addressEntries().count(); ++j)
// got an interface which is up, and has an ip address
if (result == false)
result = true;
if ( iface.flags().testFlag(QNetworkInterface::IsUp) && !iface.flags().testFlag(QNetworkInterface::IsLoopBack))
for (int j=0; j < iface.addressEntries().count(); ++j)
// got an interface which is up, and has an ip address
if (result == false)
result = true;
}
return result;
return result;
}

View file

@ -1,49 +1,70 @@
#ifndef JCESSLCLIENT_H
#define JCESSLCLIENT_H
#include <QObject>
#include <QString>
#include <QSslSocket>
#include <QThread>
#include <QEventLoop>
#include <QTimer>
#include <QMutex>
#include <QMessageBox>
#include <QNetworkConfigurationManager>
#include <QtNetwork/QNetworkInterface>
#define milisTimeOut 4000
#include "../../main/jceWidgets/jcestatusbar.h"
#define packetSize 4096 //4k
#define milisTimeOut 5000 //4 seconds
class jceSSLClient : public QSslSocket
{
Q_OBJECT
Q_OBJECT
public:
jceSSLClient();
jceSSLClient(jceStatusBar *statusBar);
bool makeConnect(QString server = "yedion.jce.ac.il", int port = 443);
bool makeDiconnect();
bool isConnected();
bool sendData(QString str);
bool recieveData(QString &str, bool fast);
void showIfErrorMsg();
bool makeConnect(QString server = "yedion.jce.ac.il", int port = 443);
bool makeDiconnect();
bool isConnected();
bool sendData(QString str);
bool recieveData(QString *str);
void showIfErrorMsg();
signals:
void serverDisconnectedbyRemote();
void noInternetLink();
void socketDisconnected();
void serverDisconnectedbyRemote();
void noInternetLink();
void socketDisconnected();
private slots:
void checkErrors(QAbstractSocket::SocketError a);
void setConnected();
void setEncrypted();
void setDisconnected();
void readIt();
void setOnlineState(bool isOnline);
void checkErrors(QAbstractSocket::SocketError a);
void setConnected();
void setEncrypted();
void setDisconnected();
void readIt();
void setOnlineState(bool isOnline);
private:
bool isConnectedToNetwork(); //checking if online
bool flag;
QString packet;
QEventLoop loop; //handle the connection as thread
QNetworkConfigurationManager networkConf; //checking if online
bool reConnection; //used for remote host disconnecting
bool isConnectedToNetwork(); //checking if online
bool loggedIAndConnectedFlag;
bool readingFlag;
bool reConnectionFlag; //used for remote host disconnecting
QNetworkConfigurationManager networkConf; //checking if online
QString packet;
bool recieveLastPacket;
int packetSizeRecieved;
QEventLoop loginThreadLoop; //handle the connection as thread
QEventLoop readerLoop;
QMutex readerAppendingLocker; //locking packet when appending
QTimer timer; //uses to check if reading has reached its timeout
jceStatusBar *statusBar; //progressbar pointer
};

View file

@ -2,8 +2,7 @@
/*
*
* Class doc can be bound in csv_exporter.h
*
* Class doc can be found in csv_exporter.h
*/
CSV_Exporter::CSV_Exporter()
{
@ -18,12 +17,12 @@ CSV_Exporter::CSV_Exporter()
* @param cal - The Calendar dialog witch holdes the starting date and the eand date.
* @return - True if *all* went well, false if something on the way went wrong.
*/
bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *cal)
bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *cal, calendarExam *exams)
{
if ((cal == NULL) || (calSched == NULL)) //pointers checking!
return false;
if (calSched->getCourses() == NULL)
if (calSched->getCourses().isEmpty())
return false;
qDebug() << Q_FUNC_INFO << "Getting path for csv file from user...";
@ -53,7 +52,7 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca
out << CSV_CALENDAR_HEADER << "\n"; // macro in header file
for (calendarCourse *coursePtr: *(calSched->getCourses())) //main loop - running though all courses
for (calendarCourse *coursePtr: (calSched->getCourses())) //main loop - running though all courses
{
// Getting course info - store in vars for easy access
int day = coursePtr->getDay();
@ -97,6 +96,36 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca
out.flush();
}
if(cal->isExams()) //Export Exams as well
{
qDebug() << "Exporting Exams!";
for(calendarExamCourse* exam:exams->getExams())
{
QTime startH = exam->getFirstHourbegin();
QTime endH = startH.addSecs(60*60*3);//add 3 hours
QString type = "מועד א";
QString name = exam->getName();
QDate date = exam->getFirstDate();
QString line = makeLine(name, &date, startH.hour(), startH.minute(), endH.hour(), endH.minute(), "", "", type);
if(line != NULL)
out << line << char(0x0A);
else
qWarning() << Q_FUNC_INFO << "CSV : Got A NULL in Line! in function: " << Q_FUNC_INFO;
//===============
// Second Date
//===============
startH = exam->getSecondHourbegin();
endH = startH.addSecs(60*60*3);//add 3 hours
date = exam->getSecondDate();
type = "מועד ב";
line = makeLine(name, &date, startH.hour(), startH.minute(), endH.hour(), endH.minute(), "", "", type);
if(line != NULL)
out << line << char(0x0A);
else
qWarning() << Q_FUNC_INFO << "CSV : Got A NULL in Line! in function: " << Q_FUNC_INFO;
}
out.flush();
}
file.close();
qDebug() << Q_FUNC_INFO << "CSV : Exported Successfully";
@ -110,10 +139,14 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca
*/
QString CSV_Exporter::getFileFath()
{
QString fileName = QFileDialog::getSaveFileName();
QString fileName = QFileDialog::getSaveFileName(NULL,
QObject::tr("JceManager Save Schedule Dialog"), "",
QObject::tr("CSV Files (*.csv);;All Files (*)"));
if (fileName == "")
return NULL;
if (!fileName.contains(".csv", Qt::CaseInsensitive))
//IMPORTENT! ADD CSV EXTENTION
if(!fileName.contains(".csv") && !fileName.contains(".CSV"))
fileName.append(".csv");
return fileName;
}
@ -124,7 +157,7 @@ QString CSV_Exporter::getFileFath()
* @param name
* @param date
* @param startH
* @param startM - Not used at the moment.
* @param startM
* @param endH
* @param endM
* @param lecturer
@ -149,20 +182,32 @@ QString CSV_Exporter::makeLine(QString name, QDate *date, int startH, int startM
QString start;
start.append(QString::number(startH));
start.append(":00");
// start.append(QString::number(startM));
if(startM != 0)
{
start.append(":");
start.append(QString::number(startM));
}
else
start.append(":00");
start.append(":00");
QString end;
end.append(QString::number(endH));
end.append(":");
end.append(QString::number(endM));
if(endM != 0)
{
end.append(":");
end.append(QString::number(endM));
}
else
end.append(":00");
end.append(":00");
QString description = "\"מרצה ";
if (lecturer == LECTURER_DEFAULT_STRING)
description.append("טרם נקבע מרצה או מתרגל");
else if(lecturer == "")
description = "";
else
description.append(lecturer);
@ -172,11 +217,14 @@ QString CSV_Exporter::makeLine(QString name, QDate *date, int startH, int startM
description.append("טרם נקבע מיקום");
else
{
description.append(" ב");
description.append(" ב");
description.append(room);
}
description.append("\n Created with JCE Manager.\"");
if(room == "")
description = "\"Good Luck!\n";
description.append("\nCreated with JCE Manager.\"");
//Create the Fucking Line
//Header: Subject,Start Date,Start Time,End Date,End Time,Description,Location
@ -237,3 +285,4 @@ void CSV_Exporter::changeDayNumberFromQtToNormal(int *QtDay)
}
return; //Done.
}

View file

@ -16,8 +16,9 @@
#include <QDebug>
#include <QMessageBox>
#include "../Calendar/calendarSchedule.h"
#include "../Calendar/calendarDialog.h"
#include "../Calendar/coursesSchedule/calendarSchedule.h"
#include "../Calendar/coursesSchedule/calendarDialog.h"
#include "../Calendar/Exams/calendarExam.h"
#define CSV_CALENDAR_HEADER "Subject,Start Date,Start Time,End Date,End Time,Description,Location"
@ -26,7 +27,7 @@ class CSV_Exporter
{
public:
CSV_Exporter();
static bool exportCalendar(calendarSchedule* calSched, CalendarDialog *cal);
static bool exportCalendar(calendarSchedule* calSched, CalendarDialog *cal, calendarExam* exams);
private:

View file

@ -0,0 +1,127 @@
#include "calendarExam.h"
calendarExam::calendarExam()
{
htmlDataHolderParsed = "";
}
/**
* @brief calendarExam::calendarExam
* copy constructor
* @param other
*/
calendarExam::calendarExam(calendarExam &other)
{
examsCounter = 0;
exams.clear();
for (calendarExamCourse * tempExam: other.getExams())
{
this->exams.push_back(new calendarExamCourse(*tempExam));
examsCounter++;
}
}
/**
* @brief calendarExam::setPage - getting a html page and stripping it into a exams schedule in a list
* @param html - html page with tags
*/
void calendarExam::setPage(QString html)
{
examsCounter = 0;
exams.clear();
this->htmlDataHolderParsed = getString(html);
examListInit(htmlDataHolderParsed);
}
/**
* @brief calendarExam::examListInit spliting the stripped html into lines, and using linetocourse function to make it an object
* @param linesTokinzedString - list of lines, each line has differen exam information
*/
void calendarExam::examListInit(QString &linesTokinzedString)
{
QString tempToken;
QStringList holder = linesTokinzedString.split("\n");
QStringList::iterator iterator;
for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
{
tempToken = (*iterator);
if (!tempToken.isEmpty())
{
calendarExamCourse *cTemp = lineToCourse(tempToken);
if (cTemp != NULL)
this->exams.push_back(cTemp);
}
}
}
/**
* @brief calendarExam::lineToCourse getting line of exam with data and make it an object containing data (date, time, course name and etc)
* @param line - parsed line with tabs between each relevant data
* @return object of examcourse with its data
*/
calendarExamCourse *calendarExam::lineToCourse(QString line)
{
calendarExamCourse *tempC = NULL;
QString templinearray[EXAM_SCHEDULE_FIELDS];
//SERIAL, NAME, LECTURER, FIELD, TYPE, FIRST_DATE, FIRST_HOUR_BEGIN, SECOND_DATE, SECOND_HOUR_BEGIN
int serial;
QString name, lecturer, field, type, firstDate, firstHourbegin, secondDate, secondHourbegin;
QString tempToken;
int i = 0;
QStringList holder = line.split("\t");
QStringList::iterator iterator;
for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
{
tempToken = (*iterator);
templinearray[i] = tempToken.trimmed();
i++;
if (i >= EXAM_SCHEDULE_FIELDS)
break;
}
if (templinearray[0] == "") //empty parsing
return NULL;
serial = templinearray[calendarExamCourse::CourseScheme::SERIAL].toInt();
name = templinearray[calendarExamCourse::CourseScheme::NAME];
lecturer = templinearray[calendarExamCourse::CourseScheme::LECTURER];
if (lecturer.isEmpty())
lecturer = LECTURER_DEFAULT_STRING;
field = templinearray[calendarExamCourse::CourseScheme::FIELD];
type = templinearray[calendarExamCourse::CourseScheme::TYPE];
firstDate = templinearray[calendarExamCourse::CourseScheme::FIRST_DATE];
if (firstDate.isEmpty())
return NULL; //can't set a default date to an exam. must be an error
firstHourbegin = templinearray[calendarExamCourse::CourseScheme::FIRST_HOUR_BEGIN];
if (firstHourbegin.isEmpty())
firstHourbegin = HOUR_DEFAULT_STRING;
secondDate = templinearray[calendarExamCourse::CourseScheme::SECOND_DATE];
if (secondDate.isEmpty())
{
secondDate = SECOND_DATE_DEFAULT_STRING;
secondHourbegin = HOUR_DEFAULT_STRING;
}
else
{
secondHourbegin = templinearray[calendarExamCourse::CourseScheme::SECOND_HOUR_BEGIN];
if (secondHourbegin.isEmpty())
secondHourbegin = HOUR_DEFAULT_STRING;
}
tempC = new calendarExamCourse(serial,name,lecturer,field,type,firstDate,firstHourbegin,secondDate,secondHourbegin);
examsCounter++;
return tempC;
}
int calendarExam::getExamsCounter() const
{
return examsCounter;
}

View file

@ -0,0 +1,42 @@
#ifndef CALENDAREXAM_H
#define CALENDAREXAM_H
#include "../../page.h"
#include "calendarExamCourse.h"
#include <QString>
#include <QStringList>
#include <QList>
/**
* @brief The calendarExam class
*
* This class generating html string to a list of examcourses
* Each item in a list is a course with its information (hour, day, name, serial and etc)
*
* Made By liran ben gida, LiranBG@gmail.com On 08/10/2014
*/
class calendarExam : public Page
{
public:
calendarExam();
calendarExam(calendarExam &other);
void setPage(QString html);
QList<calendarExamCourse*> getExams() { return exams; }
int getExamsCounter() const;
private:
void examListInit(QString &linesTokinzedString);
calendarExamCourse * lineToCourse(QString line);
QString htmlDataHolderParsed;
QList<calendarExamCourse*> exams;
int examsCounter; //not including madei b
};
#endif // CALENDAREXAM_H

View file

@ -0,0 +1,113 @@
#include "calendarExamCourse.h"
calendarExamCourse::calendarExamCourse(int serial, QString name, QString lecturer, QString field,
QString type, QString firstDate, QString firstHourbegin,
QString secondDate, QString secondHourbegin) : Course (serial,name,type)
{
this->lecturer = lecturer;
this->field = field;
setDate(firstDate,true);
setDate(secondDate,false);
setTime(firstHourbegin,true);
setTime(secondHourbegin,false);
}
calendarExamCourse::calendarExamCourse(calendarExamCourse &other)
:Course (other.getSerialNum(),other.getName(),other.getType())
{
this->lecturer = other.lecturer;
this->field = other.field;
this->firstDate = other.getFirstDate();
this->firstHourbegin = other.firstHourbegin;
this->secondDate = other.secondDate;
this->secondHourbegin = other.secondHourbegin;
}
/**
* @brief calendarExamCourse::setDate
* @param date
* @param isFirst if true > first. otherwise > second
*/
void calendarExamCourse::setDate(QString date, bool isFirst)
{
if (isFirst)
this->firstDate = QDate::fromString(date,"dd/MM/yyyy");
else
this->secondDate = QDate::fromString(date,"dd/MM/yyyy");
}
/**
* @brief calendarExamCourse::setTime
* @param time
* @param isFirst if true > first. otherwise > second
*/
void calendarExamCourse::setTime(QString time, bool isFirst)
{
// qDebug() << "time string is: " << time;
if (isFirst)
this->firstHourbegin = QTime::fromString(time,"hh:mm");
else
this->secondHourbegin = QTime::fromString(time,"hh:mm");
}
QTime calendarExamCourse::getSecondHourbegin() const
{
return secondHourbegin;
}
void calendarExamCourse::setSecondHourbegin(const QTime &value)
{
secondHourbegin = value;
}
QDate calendarExamCourse::getSecondDate() const
{
return secondDate;
}
void calendarExamCourse::setSecondDate(const QDate &value)
{
secondDate = value;
}
QTime calendarExamCourse::getFirstHourbegin() const
{
return firstHourbegin;
}
void calendarExamCourse::setFirstHourbegin(const QTime &value)
{
firstHourbegin = value;
}
QDate calendarExamCourse::getFirstDate() const
{
return firstDate;
}
void calendarExamCourse::setFirstDate(const QDate &value)
{
firstDate = value;
}
QString calendarExamCourse::getField() const
{
return field;
}
void calendarExamCourse::setField(const QString &value)
{
field = value;
}
QString calendarExamCourse::getLecturer() const
{
return lecturer;
}
void calendarExamCourse::setLecturer(const QString &value)
{
lecturer = value;
}

View file

@ -0,0 +1,82 @@
#ifndef CALENDAREXAMCOURSE_H
#define CALENDAREXAMCOURSE_H
#include "../../course.h"
#include <QTime>
#include <QString>
#include <QDate>
#define EXAM_SCHEDULE_FIELDS 9
#define LECTURER_DEFAULT_STRING "nullLecturer"
#define HOUR_DEFAULT_STRING "00:00"
#define SECOND_DATE_DEFAULT_STRING "nullSECOND_DATE"
/**
* @brief The calendarExamCourse class
*
* This class holds each exam course
* the course scheme can be found below, inside the enum CourseScheme
*
* The class's constructor gets the data and manipulate it into an object
* with its relevant information.
*
* Made By liran ben gida, LiranBG@gmail.com On 08/10/2014
*/
class calendarExamCourse : public Course
{
public:
enum CourseScheme
{
SERIAL,
NAME,
LECTURER,
FIELD,
TYPE,
FIRST_DATE,
FIRST_HOUR_BEGIN,
SECOND_DATE,
SECOND_HOUR_BEGIN
};
calendarExamCourse(int serial, QString name, QString lecturer, QString field,
QString type, QString firstDate, QString firstHourbegin,
QString secondDate, QString secondHourbegin);
calendarExamCourse(calendarExamCourse &other);
QString getLecturer() const;
void setLecturer(const QString &value);
QString getField() const;
void setField(const QString &value);
QDate getFirstDate() const;
void setFirstDate(const QDate &value);
QTime getFirstHourbegin() const;
void setFirstHourbegin(const QTime &value);
QDate getSecondDate() const;
void setSecondDate(const QDate &value);
QTime getSecondHourbegin() const;
void setSecondHourbegin(const QTime &value);
private:
void setDate(QString date, bool isFirst); //isFirst = true > first. otherwise > second
void setTime(QString time, bool isFirst); //isFirst = true > first. otherwise > second
QString lecturer;
QString field;
QDate firstDate;
QTime firstHourbegin;
QDate secondDate;
QTime secondHourbegin;
};
#endif // CALENDAREXAMCOURSE_H

View file

@ -0,0 +1,245 @@
#include "examDialog.h"
#include "ui_examDialog.h"
/**
* @brief examDialog::examDialog
* @param parent
* @param calSchedPtr - list of courses with information about each exam
*/
examDialog::examDialog(QWidget *parent, calendarExam *calExamPtr) : QDialog(parent),
ui(new Ui::examDialog)
{
ui->setupUi(this);
exams = calExamPtr;
this->examsCpy = NULL;
QStringList headLine;
//SERIAL, NAME, LECTURER, FIELD, TYPE, FIRST_DATE, FIRST_HOUR_BEGIN, SECOND_DATE, SECOND_HOUR_BEGIN
headLine << tr("Serial") << tr("Course") << tr("Lecturer") << tr("Field") << tr("Type") << tr("Exam 1 Date") << tr("Starting Hour") << tr("Exam 2 Date") << tr("Starting Hour");
ui->tableWidget->verticalHeader()->setVisible(false);
ui->tableWidget->horizontalHeader()->setVisible(true);
ui->tableWidget->setColumnCount(EXAM_SCHEDULE_FIELDS);
ui->tableWidget->setHorizontalHeaderLabels(headLine);
ui->tableWidget->setLayoutDirection(Qt::LayoutDirection::RightToLeft);
ui->tableWidget->setSortingEnabled(false);
this->setModal(true); //always on top
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Interactive);
connect(ui->tableWidget,SIGNAL(itemChanged(QTableWidgetItem*)),this,SLOT(upgradeExamsTime(QTableWidgetItem*)));
}
/**
* @brief examDialog::initializingDataIntoTable
*
* Inserting each object of exam into the table
*/
void examDialog::initializingDataIntoTable()
{
disconnect(ui->tableWidget,SIGNAL(itemChanged(QTableWidgetItem*)),this,SLOT(upgradeExamsTime(QTableWidgetItem*)));
ui->tableWidget->setRowCount(exams->getExamsCounter());
this->examsCpy = new calendarExam(*exams);
int i=0,j=0;
int year,month,day; //for constructin qdate by setdate
QTableWidgetItem *lecturer,*name,*type;
QTableWidgetItem *serial;
QTableWidgetItem *field;
QTableWidgetItem *firstDate;
QTableWidgetItem *firstHourbegin;
QTableWidgetItem *secondDate;
QTableWidgetItem *secondHourbegin;
for (calendarExamCourse * tempExam: exams->getExams())
{
j=0;
lecturer = new QTableWidgetItem();
lecturer->setData(Qt::EditRole, tempExam->getLecturer());
lecturer->setFlags(lecturer->flags() & ~Qt::ItemIsEditable);
name = new QTableWidgetItem();
name->setData(Qt::EditRole, tempExam->getName());
name->setFlags(name->flags() & ~Qt::ItemIsEditable);
type = new QTableWidgetItem();
type->setData(Qt::EditRole, tempExam->getType());
type->setFlags(type->flags() & ~Qt::ItemIsEditable);
serial = new QTableWidgetItem();
serial->setData(Qt::EditRole, tempExam->getSerialNum());
serial->setFlags(serial->flags() & ~Qt::ItemIsEditable);
field = new QTableWidgetItem();
field->setData(Qt::EditRole, tempExam->getField());
field->setFlags(field->flags() & ~Qt::ItemIsEditable);
firstDate = new QTableWidgetItem();
tempExam->getFirstDate().getDate(&year,&month,&day);
firstDate->setData(Qt::EditRole, QDate(year,month,day).toString("d/M/yy"));
firstDate->setFlags(firstDate->flags() & ~Qt::ItemIsEditable);
secondDate = new QTableWidgetItem();
tempExam->getSecondDate().getDate(&year,&month,&day);
secondDate->setData(Qt::EditRole, QDate(year,month,day).toString("d/M/yy"));
secondDate->setFlags(secondDate->flags() & ~Qt::ItemIsEditable);
firstHourbegin = new QTableWidgetItem();
firstHourbegin->setData(Qt::EditRole, QTime(tempExam->getFirstHourbegin().hour(),tempExam->getFirstHourbegin().minute()).toString("hh:mm"));
secondHourbegin = new QTableWidgetItem();
secondHourbegin->setData(Qt::EditRole, QTime(tempExam->getSecondHourbegin().hour(),tempExam->getSecondHourbegin().minute()).toString("hh:mm"));
ui->tableWidget->setItem(i,j++,serial);
ui->tableWidget->setItem(i,j++,name);
ui->tableWidget->setItem(i,j++,lecturer);
ui->tableWidget->setItem(i,j++,field);
ui->tableWidget->setItem(i,j++,type);
ui->tableWidget->setItem(i,j++,firstDate);
ui->tableWidget->setItem(i,j++,firstHourbegin);
ui->tableWidget->setItem(i,j++,secondDate);
ui->tableWidget->setItem(i,j++,secondHourbegin);
i++;
}
resetGeo();
connect(ui->tableWidget,SIGNAL(itemChanged(QTableWidgetItem*)),this,SLOT(upgradeExamsTime(QTableWidgetItem*)));
}
examDialog::~examDialog()
{
delete ui;
}
/**
* @brief examDialog::upgradeExamsTime
* gets an item and check if its value is valid by time.
* currently we allow only modification of time
*
* @param item - tablewidet from ui->tablewidet.
* @return true if has been changed. false otherwise
*/
bool examDialog::upgradeExamsTime(QTableWidgetItem *item)
{
QString text;
int row,col;
text = item->text();
row = item->row();
col = item->column();
if (ui->tableWidget->item(row,calendarExamCourse::CourseScheme::SERIAL) == NULL)
return true;
int serialCourse = ui->tableWidget->item(row,calendarExamCourse::CourseScheme::SERIAL)->text().toInt();
for (calendarExamCourse * tempExam: exams->getExams())
{
if (tempExam->getSerialNum() == serialCourse)
{
if (QTime::fromString(text).isValid())
{
if (col == calendarExamCourse::CourseScheme::FIRST_HOUR_BEGIN)
tempExam->setFirstHourbegin(QTime::fromString(text));
else if (col == calendarExamCourse::CourseScheme::SECOND_HOUR_BEGIN)
tempExam->setSecondHourbegin(QTime::fromString(text));
else
qCritical() << Q_FUNC_INFO; //is doesnt need to get here. we allow modifications only at hours
return true;
}
else
{
if (col == calendarExamCourse::CourseScheme::FIRST_HOUR_BEGIN)
ui->tableWidget->item(row,col)->setData(Qt::EditRole, QTime(tempExam->getFirstHourbegin().hour(),tempExam->getFirstHourbegin().minute()).toString("hh:mm"));
else if (col == calendarExamCourse::CourseScheme::SECOND_HOUR_BEGIN)
ui->tableWidget->item(row,col)->setData(Qt::EditRole, QTime(tempExam->getSecondHourbegin().hour(),tempExam->getSecondHourbegin().minute()).toString("hh:mm"));
else
qCritical() << Q_FUNC_INFO; //is doesnt need to get here. we allow modifications only at hours
qWarning() << Q_FUNC_INFO << "missmatch data";
QMessageBox::critical(this,tr("Error"),tr("Missmatching data.\nFormat: hh:mm\nIn Example: 08:25 or 12:05"));
return false;
}
}
}
return false;
}
/**
* @brief examDialog::resetGeo
* Resizes Dialog according to widgets and table content
*/
void examDialog::resetGeo()
{
ui->tableWidget->resizeColumnsToContents();
ui->tableWidget->resizeRowsToContents();
int mWidth=0,mHeight=0;
mHeight += ui->tableWidget->horizontalHeader()->height() + 4;
for (int i=0,j=0; i < ui->tableWidget->rowCount() && j < ui->tableWidget->columnCount();++i,++j)
{
mWidth += ui->tableWidget->columnWidth(j);
mHeight += ui->tableWidget->rowHeight(i) + 4;
}
mHeight += ui->frameBtns->height() + 30;
mHeight += ui->labelHeader->height() + 4;
this->setMinimumHeight(mHeight);
}
void examDialog::on_pushButtonOk_clicked()
{
qDebug() << Q_FUNC_INFO;
this->hide();
}
void examDialog::on_pushButtonRevert_clicked()
{
qDebug() << Q_FUNC_INFO;
if (ui->tableWidget->rowCount() <= 0)
return;
if (this->exams == NULL)
return;
if (this->examsCpy == NULL)
return;
for (int i = 0; i < ui->tableWidget->rowCount(); ++i)
{
calendarExamCourse * temp = getExamByRow(i);
for (calendarExamCourse * notChangedCourse: examsCpy->getExams())
{
if (temp->getSerialNum() == notChangedCourse->getSerialNum())
{
if (temp->getFirstHourbegin() != notChangedCourse->getFirstHourbegin())
{
ui->tableWidget->item(i,calendarExamCourse::CourseScheme::FIRST_HOUR_BEGIN)->setData(Qt::EditRole, QTime(notChangedCourse->getFirstHourbegin().hour(),notChangedCourse->getFirstHourbegin().minute()).toString("hh:mm"));
}
if (temp->getSecondHourbegin() != notChangedCourse->getSecondHourbegin())
{
ui->tableWidget->item(i,calendarExamCourse::CourseScheme::SECOND_HOUR_BEGIN)->setData(Qt::EditRole, QTime(notChangedCourse->getSecondHourbegin().hour(),notChangedCourse->getSecondHourbegin().minute()).toString("hh:mm"));
}
break; //done with course. go to next row
}
}
}
}
calendarExamCourse *examDialog::getExamByRow(int row)
{
int serialNum = ui->tableWidget->item(row,calendarExamCourse::CourseScheme::SERIAL)->text().toInt();
for (calendarExamCourse * temp : exams->getExams())
{
if (serialNum == temp->getSerialNum())
return temp;
}
return NULL;
}
void examDialog::on_pushButtonCancel_clicked()
{
on_pushButtonRevert_clicked(); //make revert to discard all changes
this->hide();
}

View file

@ -0,0 +1,54 @@
#ifndef EXAMDIALOG_H
#define EXAMDIALOG_H
#include <QDialog>
#include <QTime>
#include <QTableWidgetItem>
#include <QMessageBox>
#include <QScrollBar>
#include "calendarExam.h"
namespace Ui {
class examDialog;
}
/**
* @brief The examDialog class
*
* This class preseting a Dialog with dates, information and time of exams
*
* This dialog main goal is to let the user an option to edit and see the containing data of his exam schedule.
* The user will be able to export the exam schedule into .CSV file through CalendarTab
*
* Made By liran ben gida, LiranBG@gmail.com On 08/10/2014
*/
class examDialog : public QDialog
{
Q_OBJECT
public:
explicit examDialog(QWidget *parent, calendarExam * calExamPtr);
void initializingDataIntoTable();
~examDialog();
private slots:
bool upgradeExamsTime(QTableWidgetItem* item);
void on_pushButtonOk_clicked();
void on_pushButtonRevert_clicked();
void on_pushButtonCancel_clicked();
private:
calendarExamCourse *getExamByRow(int row);
void resetGeo();
Ui::examDialog *ui;
calendarExam * exams;
calendarExam * examsCpy;
};
#endif // EXAMDIALOG_H

View file

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>examDialog</class>
<widget class="QDialog" name="examDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>810</width>
<height>306</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Exam Dialog</string>
</property>
<property name="windowIcon">
<iconset resource="../../../../resources/connectionstatus.qrc">
<normaloff>:/icons/icon.ico</normaloff>:/icons/icon.ico</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QFrame" name="frameAll">
<property name="styleSheet">
<string notr="true">#frameAll {
border: 0px solids;
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="0">
<widget class="QFrame" name="frameBtns">
<property name="styleSheet">
<string notr="true">#frameBtns {
border: 0px solids;
}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>510</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButtonRevert">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Revert changes&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Revert</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonCancel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Discard and hide&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonOk">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Save and hide&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Ok</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QTableWidget" name="tableWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelHeader">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;Exams Schedule&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../../../resources/connectionstatus.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -1,216 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CalendarDialog</class>
<widget class="QDialog" name="CalendarDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>631</width>
<height>281</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Dates Dialog</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>613</width>
<height>263</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:9pt; font-weight:600;&quot;&gt;The dates were chosen according to JCE General Academic Calendar for the first semester&lt;/span&gt;&lt;/p&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelSemesterStart">
<property name="text">
<string>Semester Starts At:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelSemesterEnd">
<property name="text">
<string>Semester Ends At:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCalendarWidget" name="calStart">
<property name="locale">
<locale language="Hebrew" country="Israel"/>
</property>
<property name="inputMethodHints">
<set>Qt::ImhNone</set>
</property>
<property name="selectedDate">
<date>
<year>2014</year>
<month>10</month>
<day>26</day>
</date>
</property>
<property name="minimumDate">
<date>
<year>2000</year>
<month>9</month>
<day>14</day>
</date>
</property>
<property name="maximumDate">
<date>
<year>2080</year>
<month>12</month>
<day>31</day>
</date>
</property>
<property name="gridVisible">
<bool>true</bool>
</property>
<property name="verticalHeaderFormat">
<enum>QCalendarWidget::NoVerticalHeader</enum>
</property>
</widget>
</item>
<item>
<widget class="QCalendarWidget" name="calEnd">
<property name="selectedDate">
<date>
<year>2015</year>
<month>2</month>
<day>1</day>
</date>
</property>
<property name="minimumDate">
<date>
<year>2000</year>
<month>9</month>
<day>14</day>
</date>
</property>
<property name="maximumDate">
<date>
<year>2080</year>
<month>12</month>
<day>31</day>
</date>
</property>
<property name="gridVisible">
<bool>true</bool>
</property>
<property name="verticalHeaderFormat">
<enum>QCalendarWidget::NoVerticalHeader</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="labelIconStatus">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_status">
<property name="text">
<string>&lt;b&gt;Please chose your dates correctly&lt;/b&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CalendarDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>CalendarDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -1,120 +0,0 @@
#include "calendarPage.h"
QString CalendarPage::htmlToString()
{
return tempHtml;
}
void CalendarPage::setPage(QString html)
{
courses = new std::list<calendarCourse*>();
tempHtml = getString(html);
tempHtml = tokenToLines(tempHtml);
calendarListInit(tempHtml);
}
QString CalendarPage::tokenToLines(QString &textToParse)
{
int ctr = 0;
QString temp = "";
char *tok;
char* textToTok = strdup(textToParse.toStdString().c_str());
tok = strtok(textToTok, "\n");
while(tok != NULL)
{
//amount of data before the actual needed data and no empty lines
if (strcmp(tok," \t ") != 0)
{
temp += tok;
temp += "\n";
}
ctr++;
tok = strtok(NULL, "\n");
}
return temp;
}
void CalendarPage::calendarListInit(QString &linesTokinzedString)
{
std::list<QString> stringHolder;
QString temp;
calendarCourse * cTemp = NULL;
char* tok;
char* textToTok = strdup(linesTokinzedString.toStdString().c_str());
tok = strtok(textToTok,"\n");
while (tok != NULL)
{
temp = tok;
stringHolder.push_back(temp);
tok = strtok(NULL, "\n");
}
for (QString temp: stringHolder)
{
cTemp = lineToCourse(temp);
if (cTemp != NULL)
courses->push_back(cTemp);
}
}
calendarCourse *CalendarPage::lineToCourse(QString line)
{
calendarCourse *tempC = NULL;
QString templinearray[CALENDAR_COURSE_FIELDS];//[serial,name,type,lecturer,points,semesterhours,dayandhours,room]
int serial;
double points,semesterHours;
QString name,type, lecturer,dayAndHour,room;
QString tempS = "";
int i = 0;
char* tok;
char* cLine = strdup(line.toStdString().c_str());
tok = strtok(cLine, "\t");
while(tok != NULL)
{
tempS = QString(tok);
if (i >= 1)
{
templinearray[i-1] = tempS.trimmed();
}
i++;
if (i > 8)
break;
tok=strtok(NULL, "\t");
}
if (templinearray[0] == "") //empty parsing
return NULL;
serial = templinearray[calendarCourse::CourseScheme::SERIAL].toInt();
name = templinearray[calendarCourse::CourseScheme::NAME];
type = templinearray[calendarCourse::CourseScheme::TYPE];
if (!templinearray[calendarCourse::CourseScheme::LECTURER].isEmpty())
lecturer = templinearray[calendarCourse::CourseScheme::LECTURER];
else
lecturer = LECTURER_DEFAULT_STRING;
if (!templinearray[calendarCourse::CourseScheme::POINTS].isEmpty())
points = templinearray[calendarCourse::CourseScheme::POINTS].toDouble();
else
points = 0;
if (!templinearray[calendarCourse::CourseScheme::SEM_HOURS].isEmpty())
semesterHours = templinearray[calendarCourse::CourseScheme::SEM_HOURS].toDouble();
else
semesterHours = 0;
dayAndHour = templinearray[calendarCourse::CourseScheme::DAY_AND_HOURS];
if (!templinearray[calendarCourse::CourseScheme::ROOM].isEmpty())
room = templinearray[calendarCourse::CourseScheme::ROOM];
else
room = ROOM_DEFAULT_STRING;
tempC = new calendarCourse(serial,name,type,lecturer,points,semesterHours,dayAndHour,room);
return tempC;
}

View file

@ -1,35 +0,0 @@
#ifndef CALENDARPAGE_H
#define CALENDARPAGE_H
#include "../page.h"
#include "calendarCourse.h"
#include <list>
#define ROOM_DEFAULT_STRING "nullRoom"
#define LECTURER_DEFAULT_STRING "nullLecturer"
class CalendarPage : public Page
{
public:
QString htmlToString();
std::list<calendarCourse*>* getCourses() { return courses; }
protected:
virtual void setPage(QString html);
CalendarPage() { courses = NULL; }
private:
QString tokenToLines(QString &textToParse);
void calendarListInit(QString &linesTokinzedString);
calendarCourse* lineToCourse(QString line);
QString tempHtml;
std::list<calendarCourse*>* courses;
};
#endif // CALENDARPAGE_H

View file

@ -43,12 +43,14 @@ void CalendarDialog::on_calStart_selectionChanged()
{
if(ui->calStart->selectedDate() >= ui->calEnd->selectedDate()) //User input is invalid
{
changeLabeStatusIcon(false);
ui->lbl_status->setText(tr("The end of the semester can NOT be equal or before the semester begin."));
ui->lbl_status->setText(tr("Invalid dates interval"));
this->isOK = false;
}
else // input is valid
{
this->resize(610,310);
changeLabeStatusIcon(true);
ui->lbl_status->setText(tr("Looks fine, Click \"OK\""));
this->isOK = true;
@ -61,7 +63,7 @@ void CalendarDialog::on_calStart_selectionChanged()
void CalendarDialog::on_buttonBox_accepted()
{
if(this->isOK)
qDebug() << "CalendarDialog: Valid input";
qDebug() << Q_FUNC_INFO << "CalendarDialog: Valid input";
}
void CalendarDialog::on_calEnd_selectionChanged()
@ -69,7 +71,8 @@ void CalendarDialog::on_calEnd_selectionChanged()
if(ui->calStart->selectedDate() >= ui->calEnd->selectedDate())
{
changeLabeStatusIcon(false);
ui->lbl_status->setText(tr("The end of the semester can NOT be equal or before the semester begin."));
ui->lbl_status->setText(tr("Invalid dates interval"));
this->isOK = false;
}
else
@ -93,3 +96,7 @@ void CalendarDialog::changeLabeStatusIcon(bool goodOrBad)
iconPixStatus.load(":/icons/iconX.png");
this->ui->labelIconStatus->setPixmap(iconPixStatus);
}
bool CalendarDialog::isExams(){
return ui->isExam->isChecked();
}

View file

@ -1,10 +1,12 @@
/**
* JCE Manager (C)
*
* This QDialog widget will hold the dates of a Semester, Start and End.
* This QDialog widget hold the dates of a Semester, Start and End.
*
* this dialog will help the csv_exporter class to export a CSV file that will contain
* all the courses within that period of time.
*
* Made By Sagi Dayan, sagidayan@gmail.com On 22/09/2014
*/
#ifndef CALENDARDIALOG_H
@ -28,6 +30,7 @@ public:
QDate getStartDate();
QDate getEndDate();
bool ok();
bool isExams();
private slots:
void on_calStart_selectionChanged();

View file

@ -0,0 +1,247 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CalendarDialog</class>
<widget class="QDialog" name="CalendarDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>830</width>
<height>310</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Dates Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelHeader">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;Schedule Exportation&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayoutSem">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayoutSemStart">
<item row="0" column="0">
<widget class="QLabel" name="labelSemesterStart">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Semester Starts At:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCalendarWidget" name="calStart">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="inputMethodHints">
<set>Qt::ImhNone</set>
</property>
<property name="selectedDate">
<date>
<year>2014</year>
<month>10</month>
<day>26</day>
</date>
</property>
<property name="minimumDate">
<date>
<year>2000</year>
<month>9</month>
<day>14</day>
</date>
</property>
<property name="maximumDate">
<date>
<year>2080</year>
<month>12</month>
<day>31</day>
</date>
</property>
<property name="gridVisible">
<bool>true</bool>
</property>
<property name="verticalHeaderFormat">
<enum>QCalendarWidget::NoVerticalHeader</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayoutSemEnd">
<item row="0" column="0">
<widget class="QLabel" name="labelSemesterEnd">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Semester Ends At:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCalendarWidget" name="calEnd">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="selectedDate">
<date>
<year>2015</year>
<month>2</month>
<day>1</day>
</date>
</property>
<property name="minimumDate">
<date>
<year>2000</year>
<month>9</month>
<day>14</day>
</date>
</property>
<property name="maximumDate">
<date>
<year>2080</year>
<month>12</month>
<day>31</day>
</date>
</property>
<property name="gridVisible">
<bool>true</bool>
</property>
<property name="verticalHeaderFormat">
<enum>QCalendarWidget::NoVerticalHeader</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelNote">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;The dates were chosen according to JCE General Academic Calendar for the first semester&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0">
<layout class="QGridLayout" name="gridLayoutButtomPanel">
<item row="0" column="0">
<widget class="QLabel" name="labelIconStatus">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lbl_status">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>&lt;b&gt;Please chose your dates correctly&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="isExam">
<property name="text">
<string>Include Exams</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CalendarDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>CalendarDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -0,0 +1,112 @@
#include "calendarPage.h"
/**
* @brief CalendarPage::setPage getting the html and stripping it into a courses schedule in a list
* @param html
*/
void CalendarPage::setPage(QString html)
{
courses.clear();
tempHtml = getString(html);
calendarListInit(tempHtml);
}
/**
* @brief CalendarPage::calendarListInit - make an object from each line of course
* @param linesTokinzedString - string contain lines of coureses. each string contain single course information
*/
void CalendarPage::calendarListInit(QString &linesTokinzedString)
{
QString tempToken;
QStringList holder = linesTokinzedString.split("\n");
QStringList::iterator iterator;
for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
{
tempToken = (*iterator);
if (!tempToken.isEmpty())
{
calendarCourse *cTemp = lineToCourse(tempToken);
if (cTemp != NULL)
this->courses.push_back(cTemp);
}
}
}
/**
* @brief CalendarPage::lineToCourse
* @param line - line of course contain its data and information
* @return calendarcourse object with its information
*/
calendarCourse *CalendarPage::lineToCourse(QString line)
{
calendarCourse *tempC = NULL;
QString templinearray[CALENDAR_COURSE_FIELDS];//[serial,name,type,lecturer,points,semesterhours,dayandhours,room]
int serial;
double points,semesterHours;
QString name,type, lecturer,dayAndHour,room;
QString tempToken;
int i = 0;
QStringList holder = line.split("\t");
QStringList::iterator iterator;
for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
{
tempToken = (*iterator);
if (i >= 1) //skips on semester character
{
templinearray[i-1] = tempToken.trimmed();
}
i++;
if (i > CALENDAR_COURSE_FIELDS)
break;
}
if (templinearray[0] == "") //empty parsing
return NULL;
serial = templinearray[calendarCourse::CourseScheme::SERIAL].toInt();
name = templinearray[calendarCourse::CourseScheme::NAME];
type = templinearray[calendarCourse::CourseScheme::TYPE];
if (!templinearray[calendarCourse::CourseScheme::LECTURER].isEmpty())
lecturer = templinearray[calendarCourse::CourseScheme::LECTURER];
else
lecturer = LECTURER_DEFAULT_STRING;
if (!templinearray[calendarCourse::CourseScheme::POINTS].isEmpty())
points = templinearray[calendarCourse::CourseScheme::POINTS].toDouble();
else
points = 0;
if (!templinearray[calendarCourse::CourseScheme::SEM_HOURS].isEmpty())
semesterHours = templinearray[calendarCourse::CourseScheme::SEM_HOURS].toDouble();
else
semesterHours = 0;
dayAndHour = templinearray[calendarCourse::CourseScheme::DAY_AND_HOURS];
if (!templinearray[calendarCourse::CourseScheme::ROOM].isEmpty())
room = templinearray[calendarCourse::CourseScheme::ROOM];
else
room = ROOM_DEFAULT_STRING;
tempC = new calendarCourse(serial,name,type,lecturer,points,semesterHours,dayAndHour,room);
// qDebug() << "serial is: " << tempC->getSerialNum();
// qDebug() << tempC->getName();
// qDebug() << tempC->getType();
// qDebug() << tempC->getLecturer();
// qDebug() << tempC->getPoints();
// qDebug() << tempC->getHourBegin() << ":" << tempC->getMinutesBegin();
// qDebug() << tempC->getHourEnd() << ":" << tempC->getMinutesEnd();
// qDebug() << tempC->getDay();
// qDebug() << tempC->getRoom();
return tempC;
}

View file

@ -0,0 +1,42 @@
#ifndef CALENDARPAGE_H
#define CALENDARPAGE_H
#include "../../page.h"
#include "calendarPageCourse.h"
#include <QList>
#define ROOM_DEFAULT_STRING "nullRoom"
#define LECTURER_DEFAULT_STRING "nullLecturer"
/**
* @brief The CalendarPage class
*
* This class generating html string to a list of calendarCourses
* Each item in a list is a course with its information (hour, day, name, serial and etc)
*
* Made By liran ben gida, LiranBG@gmail.com On 31/8/2014
*/
class CalendarPage : public Page
{
public:
QList<calendarCourse*> getCourses() { return courses; }
protected:
virtual void setPage(QString html);
CalendarPage() { }
private:
void calendarListInit(QString &linesTokinzedString);
calendarCourse * lineToCourse(QString line);
QString tempHtml;
QList<calendarCourse*> courses;
};
#endif // CALENDARPAGE_H

View file

@ -1,9 +1,10 @@
#include "calendarCourse.h"
#include "calendarPageCourse.h"
calendarCourse::calendarCourse(int serial, QString name, QString type, QString lecturer, double points,
double semesterHours, QString dayAndHour,
QString room) : Course(serial,name, type,points)
QString room) : Course(serial,name, type)
{
this->points = points;
this->lecturer = lecturer;
this->semesterHours = semesterHours;
this->room = room;
@ -16,35 +17,35 @@ calendarCourse::calendarCourse(int serial, QString name, QString type, QString l
*/
void calendarCourse::setDayAndHour(QString parse)
{
int ctr = 0;
QString temp = "";
QTime timetemp;
char *tok;
char* textToTok = strdup(parse.toStdString().c_str());
tok = strtok(textToTok, " -");
while(tok != NULL)
{
temp = tok;
switch (ctr)
int ctr = 0;
QString temp = "";
QTime timetemp;
char *tok;
char* textToTok = strdup(parse.toStdString().c_str());
tok = strtok(textToTok, " -");
while(tok != NULL)
{
case 0: //day
setDay(temp);
break;
case 1: //hour it begins
timetemp = QTime::fromString(temp,"hh:mm");
setHourBegin(timetemp.hour());
setMinutesBegin(timetemp.minute());
break;
case 2: //hour it ends
timetemp = QTime::fromString(temp,"hh:mm");
setHourEnd(timetemp.hour());
setMinutesEnd(timetemp.minute());
break;
}
temp = tok;
switch (ctr)
{
case 0: //day
setDay(temp);
break;
case 1: //hour it begins
timetemp = QTime::fromString(temp,"hh:mm");
setHourBegin(timetemp.hour());
setMinutesBegin(timetemp.minute());
break;
case 2: //hour it ends
timetemp = QTime::fromString(temp,"hh:mm");
setHourEnd(timetemp.hour());
setMinutesEnd(timetemp.minute());
break;
}
ctr++;
tok = strtok(NULL, " -");
}
ctr++;
tok = strtok(NULL, " -");
}
}
QString calendarCourse::getLecturer() const
@ -101,26 +102,6 @@ void calendarCourse::setMinutesEnd(int value)
{
minutesEnd = value;
}
/**
* @brief calendarCourse::courseToString
* @return prints the course into string pattern
*/
QString calendarCourse::courseToString()
{
QString courseText = "";
courseText += " " + QString::number(this->getSerialNum());
courseText += " " + this->getName();
courseText += " " + this->getType();
courseText += " " + this->lecturer;
courseText += " " + QString::number(this->getPoints());
courseText += " " + QString::number(this->semesterHours);
courseText += " " + QString::number(this->day);
courseText += " " + QString::number(this->hourBegin) + ":" + QString::number(this->minutesBegin) + "-" + QString::number(this->hourEnd) + ":" + QString::number(this->minutesEnd);
courseText += " " + this->room;
courseText += "\n";
return courseText;
}
int calendarCourse::getDay() const
{
return day;
@ -157,10 +138,31 @@ void calendarCourse::setRoom(const QString &value)
{
room = value;
}
double calendarCourse::getPoints() const
{
return points;
}
void calendarCourse::setPoints(double value)
{
points = value;
}
double points;
QString lecturer;
double semesterHours;
int day;
int hourBegin;
int minutesBegin;
int hourEnd;
int minutesEnd;
QString room;
QString calendarCourse::toString()
{
QTime begin,end;
begin.setHMS(hourBegin,minutesBegin,0);
end.setHMS(hourEnd,minutesEnd,0);
return QString("%1 %2 %3\n%4 %5\n%6 - %7").arg(QString::number(this->getSerialNum()),this->getName(),QString::number(this->points),this->getLecturer(),this->getRoom(),
begin.toString("hh:mm"),end.toString(("hh:mm")));
}

View file

@ -1,14 +1,26 @@
#ifndef CALENDARCOURSE_H
#define CALENDARCOURSE_H
#include "../course.h"
#include "../../course.h"
#include <QTime>
#define CALENDAR_COURSE_FIELDS 8
/**
* @brief The calendarCourse class
*
* This class holds each scheduled course
* the course scheme can be found below, inside the enum CourseScheme
*
* The class's constructor gets the data and manipulate it into an object
* with its relevant information.
*
* Made By liran ben gida, LiranBG@gmail.com On 31/8/2014
*/
class calendarCourse : public Course
{
public:
enum CourseScheme
{
SERIAL,
@ -20,8 +32,11 @@ public:
DAY_AND_HOURS,
ROOM
};
calendarCourse(int serial, QString name, QString type, QString lecturer,
double points, double semesterHours, QString dayAndHour, QString room);
double points, double semesterHours, QString dayAndHour,
QString room);
~calendarCourse(){}
int getDay() const;
@ -32,6 +47,7 @@ public:
int getMinutesBegin() const;
int getHourEnd() const;
int getMinutesEnd() const;
double getPoints() const;
void setDay(const QString &value);
void setLecturer(const QString &value);
@ -41,14 +57,15 @@ public:
void setMinutesBegin(int value);
void setHourEnd(int value);
void setMinutesEnd(int value);
void setPoints(double value);
QString courseToString();
QString toString();
private:
void setDayAndHour(QString parse);
double points;
QString lecturer;
double semesterHours;
int day;

View file

@ -1,6 +1,5 @@
#include "calendarSchedule.h"
calendarSchedule::calendarSchedule()
calendarSchedule::calendarSchedule(QWidget *parent) : QTableWidget(parent)
{
QStringList days,hours;
QTextStream hourString;
@ -22,7 +21,7 @@ calendarSchedule::calendarSchedule()
days << QObject::tr("Sunday") << QObject::tr("Monday") << QObject::tr("Tuesday") << QObject::tr("Wednesday") << QObject::tr("Thursday") << QObject::tr("Friday");
setRowCount(endingHour - startingHour + 1);
setColumnCount(6);
setColumnCount(6); //number of days not including saturday ofcourse :)
setLayoutDirection(Qt::LayoutDirection::RightToLeft);\
@ -37,7 +36,7 @@ calendarSchedule::calendarSchedule()
void calendarSchedule::setPage(QString html)
{
CalendarPage::setPage(html);
qDebug() << Q_FUNC_INFO << "inserting into table";
insertCourseIntoTable();
}
@ -57,15 +56,15 @@ void calendarSchedule::insertCourseIntoTable()
QTableWidgetItem *item;
QString courseString;
int currentHour,currentDay,blocksNumer;
int currentHour,currentDay,blocksNumber;
int row,col;
for (calendarCourse *coursePtr: *getCourses())
for (calendarCourse *coursePtr: getCourses())
{
courseString = "";
currentHour = coursePtr->getHourBegin();
currentDay = coursePtr->getDay();
blocksNumer = coursePtr->getHourEnd() - coursePtr->getHourBegin(); //every hour is a block to fill!
while (blocksNumer >= 0)
blocksNumber = coursePtr->getHourEnd() - coursePtr->getHourBegin(); //every hour is a block to fill!
while (blocksNumber >= 0)
{
row = currentHour - HOURS_BEGIN;
col = currentDay-1;
@ -83,12 +82,13 @@ void calendarSchedule::insertCourseIntoTable()
item = new QTableWidgetItem(courseString);
item->setToolTip(coursePtr->toString());
if (this->takeItem(row,col) != NULL)
delete this->takeItem(row,col);
this->setItem(row,col,item);
currentHour++;
--blocksNumer;
--blocksNumber;
}
horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

View file

@ -12,11 +12,19 @@
#define HOURS_END 20
#define ACADEMIN_HOUR 45
/**
* @brief The calendarSchedule class
*
* This class combining the courses schedule with each course into a table
* setpage -> insertingIntoTable -> showing data
*
* Made By liran ben gida, LiranBG@gmail.com On 31/8/2014
*/
class calendarSchedule : public QTableWidget, public CalendarPage
{
Q_OBJECT
public:
calendarSchedule();
calendarSchedule(QWidget *parent = 0);
~calendarSchedule() { clearTableItems(); }
void setPage(QString html);
void clearTableItems();

View file

@ -1,16 +1,32 @@
#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)
{
this->points = points;
this->hours = hours;
this->grade = grade;
this->additions = additions;
this->year = year;
this->semester = semester;
this->courseNumInList = courseNumInList;
}
gradeCourse::gradeCourse(gradeCourse &other) : Course(other.getSerialNum(),other.getName(),other.getType())
{
this->points = other.points;
this->hours = other.hours;
this->grade = other.grade;
this->additions = other.additions;
this->year = other.year;
this->semester = other.semester;
this->courseNumInList = other.courseNumInList;
}
gradeCourse::~gradeCourse()
{
}
double gradeCourse::getGrade() const
{
double noGrade = NO_GRADE_YET;
@ -34,3 +50,33 @@ void gradeCourse::setAdditions(QString 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;
}
double gradeCourse::getPoints() const
{
return points;
}
void gradeCourse::setPoints(double value)
{
points = value;
}

View file

@ -1,26 +1,33 @@
#ifndef GRADE_COURSE_H
#define GRADE_COURSE_H
/* This Code Made By Sagi Dayan
* SagiDayan@gmail.com
*
* Minor changes has been made by Liran Ben Gida
* LiranBG@gmail.com
*/
#include "../course.h"
#include <string>
#include <iostream>
#include <list>
#define COURSE_FIELDS 7
#define COURSE_FIELDS 10
#define NO_GRADE_YET 101;
/**
* @brief The gradeCourse class
*
* This class holds a list of course in GPA
* the course scheme can be found below, inside the enum CourseScheme
*
* The class's constructor gets the data and manipulate it into an object
* with its relevant information.
*
* Made By:
* Sagi Dayan, SagiDayan@gmail.com
* Liran Ben Gida, LiranBG@gmail.com
* On 31/8/2014
*/
class gradeCourse : public Course {
public:
enum CourseScheme
{
YEAR,
SEMESTER,
COURSE_NUMBER_IN_LIST,
SERIAL,
NAME,
TYPE,
@ -30,22 +37,35 @@ public:
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 &other);
~gradeCourse();
int getYear() const { return this->year; }
int getSemester() const { return this->semester; }
double getHours() const {return this->hours;}
double getGrade() const ;
double getGrade() const;
QString getAddidtions() const {return this->additions;}
int getCourseNumInList() const;
double getPoints() const;
void setHours(double hours);
void setGrade(double grade);
void setAdditions(QString additions);
void setYear(int year);
void setSemester(int semester);
void setCourseNumInList(int value);
void setPoints(double value);
private:
double hours;
double grade;
double points;
double hours;
double grade;
QString additions;
int year;
int semester;
int courseNumInList;
};

View file

@ -1,119 +1,130 @@
#include "gradePage.h"
static int maxYear = 0;
static int minYear = 9999;
GradePage::GradePage(QString html) : Page()
{
courses = new std::list<gradeCourse*>();
tempHtml = getString(html);
tempHtml = tokenToLines(tempHtml);
coursesListInit(tempHtml);
}
GradePage::GradePage(GradePage &other)
{
for(gradeCourse* c : other.getCourses())
{
courses.push_back(new gradeCourse(*c));
}
}
GradePage::~GradePage()
{
for(Course* c : *courses)
for (Course* c : courses)
delete c;
delete courses;
}
/**
* @brief GradePage::removeCourse
* @param courseSerialID - course ID to remove
*/
void GradePage::removeCourse(QString courseSerialID)
{
for(gradeCourse* c : *courses)
for(gradeCourse* c : courses)
{
if (c->getSerialNum() == courseSerialID.toInt())
{
courses->remove(c);
courses.removeAll(c);
delete c;
return;
}
}
}
/**
* @brief GradePage::coursesListInit
* using lineToCourse function, its making a list of gradeCourse object from a given string of information
* @param linesTokinzedString list of courses, tokenized by lines. containing data of each course
*/
void GradePage::coursesListInit(QString &linesTokinzedString)
{
std::list<QString> stringHolder;
QString temp;
gradeCourse* cTemp = NULL;
char* tok;
char* textToTok = strdup(linesTokinzedString.toStdString().c_str());
tok = strtok(textToTok,"\n");
while (tok != NULL)
{
temp = tok;
stringHolder.push_back(temp);
tok = strtok(NULL, "\n");
}
for(QString temp: stringHolder)
{
cTemp = lineToCourse(temp);
if (cTemp != NULL)
courses->push_back(cTemp);
}
}
QString tempToken;
QString GradePage::tokenToLines(QString &textToPhrase)
{
int ctr = 0;
QString temp = "";
char *tok;
char* textToTok = strdup(textToPhrase.toStdString().c_str());
tok = strtok(textToTok, "\n");
while(tok != NULL)
QStringList holder = linesTokinzedString.split("\n");
QStringList::iterator iterator;
for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
{
//amount of data before the actual needed data and no empty lines
if (strcmp(tok," \t ") != 0)
tempToken = (*iterator);
if ((!tempToken.isEmpty()) && (tempToken.length() > 1))
{
temp += tok;
temp += "\n";
gradeCourse *cTemp = lineToCourse(tempToken);
if (cTemp != NULL)
this->courses.push_back(cTemp);
}
ctr++;
tok = strtok(NULL, "\n");
}
return temp;
}
/**
* @brief GradePage::lineToCourse
* making an object of gradepage with the given information from string
* @param line - lines tokenized by tabs containing each course information (year, serial, name, points and etc..)
* @return
*/
gradeCourse* GradePage::lineToCourse(QString line)
{
gradeCourse *tempC = NULL;
QString templinearray[COURSE_FIELDS];//[serial,name,type,points,hours,grade,additions]
int serial;
QString templinearray[COURSE_FIELDS];//[year,semester,numInList,serial,name,type,points,hours,grade,additions]
int serial,year,semester,courseNumInList;
double points,hours,grade;
QString name,type, additions;
QString tempS = "";
QString tempToken;
int i = 0;
char* tok;
char* cLine = strdup(line.toStdString().c_str());
tok = strtok(cLine, "\t");
while(tok != NULL)
QStringList holder = line.split("\t");
QStringList::iterator iterator;
for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
{
tempS = tok;
if (i == 1) //skip the tokenizing loop just once
tempToken = (*iterator);
tempToken = tempToken.trimmed();
//we are checking it because in GPA, serial and course name are mixed
if (i == gradeCourse::CourseScheme::SERIAL)
{
tempS = "";
char *tokTemp;
tokTemp = tok;
while (!(isdigit((int)*tokTemp)))
tokTemp++;
QString tempDataOfSerialCourseName;
while (isdigit((int)*tokTemp))
//getting serial
QStringList secHolder = tempToken.split(" ");
QStringList::iterator secIterator = secHolder.begin();
tempDataOfSerialCourseName = *secIterator;
templinearray[i] = tempDataOfSerialCourseName.trimmed();
//getting course name;
++secIterator;
tempDataOfSerialCourseName.clear();
while (secIterator != secHolder.end())
{
tempS += QString(*tokTemp);
tokTemp++;
tempDataOfSerialCourseName.append(*secIterator + " ");
secIterator++;
}
templinearray[i-1] = tempS.trimmed();
templinearray[i] = QString(tokTemp).trimmed();
templinearray[++i] = tempDataOfSerialCourseName.trimmed();
}
else if (i > 1)
else
{
templinearray[i] = tempS;
templinearray[i] = tempToken;
}
i++;
tok=strtok(NULL, "\t");
}
if (templinearray[0] == "") //empty phrasing
return NULL;
i++;
if (i >= COURSE_FIELDS)
break;
}
if (templinearray[0] == "") //empty parsing
{
qCritical() << Q_FUNC_INFO << "empty parsing";
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();
name = templinearray[gradeCourse::CourseScheme::NAME];
@ -129,31 +140,49 @@ gradeCourse* GradePage::lineToCourse(QString line)
additions = templinearray[gradeCourse::CourseScheme::ADDITION];
tempC = new gradeCourse(serial,name,type,points,hours,grade,additions);
if (year >= maxYear)
maxYear = year;
if ((year <= minYear) && (points > 0)) //not graded yet isnt influced year!
{
minYear = year;
}
tempC = new gradeCourse(year,semester,courseNumInList,serial,name,type,points,hours,grade,additions);
return tempC;
}
//checking if one of the chars inside grade is not a number
/**
* @brief GradePage::isGradedYet checking if one of the chars inside grade is not a number
* @param grade
* @return if has bee graded or not
*/
bool GradePage::isGradedYet(QString grade)
{
if (strlen(grade.toStdString().c_str()) <= 1)
return false;
for (char c: grade.toStdString())
for (QChar c: grade)
{
if (c == '\0')
break;
if (((!isdigit((int)c)) && (!isspace((int)c)))) //48 = 0, 57 = 9
if (((!c.isDigit()) && (!c.isSpace()))) //48 = 0, 57 = 9
return false;
}
return true;
}
/**
* @brief GradePage::getAvg getting avg
* @return - gpa avg of all courses
*/
double GradePage::getAvg()
{
double avg = 0;
double points = 0;
for(gradeCourse* c : *courses)
for (gradeCourse* c : courses)
{
if ((c->getGrade() != 0))
{
@ -165,3 +194,67 @@ double GradePage::getAvg()
avg /= points;
return avg;
}
/**
* @brief GradePage::getAvg getting avg of given year
* @param year - year (yyyy)
* @return - gpa avg of given year
*/
double GradePage::getAvg(int year)
{
double avg = 0;
double points = 0;
for (gradeCourse* c : courses)
{
if ((c->getGrade() != 0) && (c->getYear() == year))
{
avg += c->getGrade() * c->getPoints();
points += c->getPoints();
}
}
if (points != 0)
avg /= points;
else
avg=0;
return avg;
}
/**
* @brief GradePage::getAvg
* @param year - year (yyyy)
* @param semester - semeser (1-3)
* @return -gpa avg of given year in given semester
*/
double GradePage::getAvg(int year, int semester)
{
double avg = 0;
double points = 0;
for (gradeCourse* c : courses)
{
if ((c->getGrade() != 0) && (c->getYear() == year) && (c->getSemester() == semester))
{
avg += c->getGrade() * c->getPoints();
points += c->getPoints();
}
}
if (points != 0)
avg /= points;
else
avg=0;
return avg;
}
/**
* @brief GradePage::getMinYearInList
* @return the minimal year inside courses list
*/
int GradePage::getMinYearInList()
{
return minYear;
}
int GradePage::getMaxYearInList()
{
return maxYear;
}

View file

@ -11,29 +11,48 @@
#include "../page.h"
#include "../Grades/gradeCourse.h"
#include <list>
#include <QList>
/**
* @brief The GradePage class
*
* This class generating html string to a list of gradeCourse
* Each item in a list is a course with its information (grade, points, name, serial and etc)
*
* Made By:
* Sagi Dayan, SagiDayan@gmail.com
* Liran Ben Gida, LiranBG@gmail.com
* On 31/8/2014
*/
class GradePage : public Page
{
public:
GradePage(QString html);
~GradePage();
GradePage(GradePage &other);
~GradePage();
void removeCourse(QString courseSerialID);
double getAvg();
std::list<gradeCourse*>* getCourses() { return courses; }
double getAvg();
double getAvg(int year);
double getAvg(int year, int semester);
int getMinYearInList();
int getMaxYearInList();
QList<gradeCourse*> getCourses() { return courses; }
private:
QString tokenToLines(QString &textToPhrase);
void coursesListInit(QString &linesTokinzedString);
gradeCourse* lineToCourse(QString line);
bool isGradedYet(QString grade);
std::list<gradeCourse*>* courses;
QList<gradeCourse*> courses;
QString tempHtml;
};

View file

@ -0,0 +1,202 @@
#include "gradegraph.h"
#include "ui_gradegraph.h"
gradegraph::gradegraph(QWidget *parent) : QDialog(parent), ui(new Ui::gradegraph)
{
ui->setupUi(this);
this->setModal(true); //makes it on top of application
this->gp = NULL;
tableWidget = new QCustomPlot(this);
ui->verticalLayoutTable->addWidget(tableWidget);
}
void gradegraph::showGraph(GradePage *gpPTR)
{
qDebug() << Q_FUNC_INFO;
this->gp = gpPTR;
if (tableWidget->graphCount() > 0)
clearGraph();
setVisualization();
setGraphsData();
tableWidget->replot();
this->show();
}
gradegraph::~gradegraph()
{
delete ui;
}
void gradegraph::setGraphsData()
{
int minYearInList = gp->getMinYearInList()-1;
int maxYearInList = gp->getMaxYearInList()+1;
int xRangeForYear = (maxYearInList - minYearInList+2)*3;
QVector<double> SemesterialAvg(xRangeForYear),yearlyAvg(xRangeForYear),indicatorX(xRangeForYear);
for (int yearCount=0,i=1; i<xRangeForYear; ++i) //filling data
{
indicatorX[i] = i;
if (i%4==1) //years
{
QCPItemText *textLabel = new QCPItemText(tableWidget);
tableWidget->addItem(textLabel);
double lastAvg = gp->getAvg(minYearInList+yearCount);
if (lastAvg > 0)
{
// add the text label at the top:
if (lastAvg <= MIN_GRADE) //will be below the graph
{
textLabel->position->setCoords(i, MIN_GRADE+5); // place position at center/top of axis rect
textLabel->setText(QString::number(lastAvg,'g',4) + "<= Min Grade (" + QString::number(MIN_GRADE) + ")");
}
else
{
textLabel->position->setCoords(i, lastAvg+1.5); // place position at center/top of axis rect
textLabel->setText(QString::number(lastAvg,'g',4));
}
}
textLabel->setFont(QFont(font().family(), 8)); // make font a bit larger
textLabel->setPen(QPen(Qt::black)); // show black border around text
yearlyAvg[i] = lastAvg;
yearCount++;
}
else
{
if (i+4 < xRangeForYear) //semesters
{
QCPItemText *textLabel = new QCPItemText(tableWidget);
tableWidget->addItem(textLabel);
//qDebug() << "year: " << minYearInList+yearCount << "sem " << (i-1)%4;
double avg = gp->getAvg(minYearInList+yearCount,(i-1)%4);
//qDebug() << "avg: " << avg;
if (avg > 0)
{
// add the text label at the top:
if (avg <= MIN_GRADE) //will be below the graph
{
textLabel->position->setCoords(i+4, MIN_GRADE+1.5); // place position at center/top of axis rect
textLabel->setText(QString::number(avg,'g',4) + "<= Min Grade (" + QString::number(MIN_GRADE) + ")");
}
else
{
textLabel->position->setCoords(i+4, avg+1.5); // place position at center/top of axis rect
textLabel->setText(QString::number(avg,'g',4));
}
textLabel->setFont(QFont(font().family(), 8)); // make font a bit larger
textLabel->setPen(QPen(Qt::black)); // show black border around text
SemesterialAvg[i+4] = avg;
}
}
yearlyAvg[i] = 0;
}
}
//yearly
tableWidget->graph(0)->setData(indicatorX,yearlyAvg);
//yearly
tableWidget->graph(1)->setData(indicatorX,SemesterialAvg);
}
/**
* @brief gradegraph::setvisualization set graph borders text, range and looking
*/
void gradegraph::setVisualization()
{
tableWidget->setBackground(QBrush(Qt::white));
tableWidget->axisRect()->setupFullAxesBox(true); //make the graph looks like a box
tableWidget->addGraph(); //yearly and semesterial graphs
tableWidget->addGraph();
tableWidget->graph(0)->setName(tr("Yearly Average"));
tableWidget->graph(0)->setPen(QPen(Qt::GlobalColor::blue));
tableWidget->graph(0)->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, Qt::blue, Qt::blue, 7));
tableWidget->graph(0)->setLineStyle(QCPGraph::lsImpulse );
tableWidget->graph(1)->setName(tr("Semesterial Average"));
tableWidget->graph(1)->setLineStyle(QCPGraph::lsStepLeft);
tableWidget->graph(1)->setPen(QPen( QColor(Qt::GlobalColor::red)));
tableWidget->graph(1)->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, Qt::red, Qt::red, 7));
int minYearInList = gp->getMinYearInList()-1;
int maxYearInList = gp->getMaxYearInList()+1;
int xRangeForYear = (maxYearInList - minYearInList+2)*3;
QVector<QString> xStrings(0);
for (int year=minYearInList,i = 0; i < xRangeForYear-1; ++i)
{
//set year x axe label to be yyyy A B C yyyy+1 A B C yyyy+2....
int semesterChar = i%4;
QString tempString;
switch (semesterChar)
{
case 1:
tempString = tr("A");
xStrings << tempString;
break;
case 2:
tempString = tr("B");
xStrings << tempString;
break;
case 3:
tempString = tr("C");
xStrings << tempString;
break;
case 0:
tempString = QString::number(year);
xStrings << tempString;
year++;
break;
}
}
tableWidget->yAxis->setLabel(tr("AVG Grade"));
tableWidget->yAxis->setTickLabelFont(QFont(QFont().family(), 8));
tableWidget->yAxis->setRange(MIN_GRADE,MAX_GRADE);
tableWidget->yAxis->setTickStep(2);
tableWidget->yAxis->setAutoSubTicks(false);
tableWidget->yAxis->setAutoTickStep(false);
tableWidget->yAxis->setSubTickCount(5);
tableWidget->xAxis->setLabel(tr("Years"));
tableWidget->xAxis->setAutoTickLabels(false);
tableWidget->xAxis->setTickLabelFont(QFont(QFont().family(), 7));
tableWidget->xAxis->setAutoTickStep(false);
tableWidget->xAxis->setTickStep(1);
tableWidget->xAxis->setAutoSubTicks(false);
tableWidget->xAxis->setSubTickCount(0);
tableWidget->xAxis->setTickVectorLabels(xStrings);
tableWidget->xAxis->setRange(1,xRangeForYear);
tableWidget->legend->setVisible(true); //show graph name on top right
}
void gradegraph::clearGraph()
{
int itemDeleted,graphs,plots;
itemDeleted = tableWidget->clearItems();
graphs = tableWidget->clearGraphs();
plots = tableWidget->clearPlottables();
qDebug() << Q_FUNC_INFO << "items:" << itemDeleted << "graphs" << graphs << "plots:" << plots;
}
void gradegraph::on_pushButton_clicked()
{
qDebug() << Q_FUNC_INFO << " Closed Graph Dialog";
this->done(0);
}

View file

@ -0,0 +1,39 @@
#ifndef GRADEGRAPH_H
#define GRADEGRAPH_H
#include "../gradePage.h"
#include "qcustomplot.h"
#include <QDialog>
namespace Ui {
class gradegraph;
}
#define MIN_GRADE 50
#define MAX_GRADE 100
class gradegraph : public QDialog
{
Q_OBJECT
public:
gradegraph(QWidget *parent = 0);
void showGraph(GradePage *gpPTR);
~gradegraph();
private slots:
void on_pushButton_clicked();
private:
GradePage *gp;
QCustomPlot *tableWidget;
void setVisualization();
void setGraphsData();
void clearGraph();
Ui::gradegraph *ui;
};
#endif // GRADEGRAPH_H

View file

@ -0,0 +1,86 @@
<?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>624</width>
<height>531</height>
</rect>
</property>
<property name="windowTitle">
<string>GPA Graph View</string>
</property>
<property name="windowIcon">
<iconset resource="../../../../resources/connectionstatus.qrc">
<normaloff>:/icons/icon.ico</normaloff>:/icons/icon.ico</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:18pt; font-weight:600;&quot;&gt;GPA Graph View&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayoutMain">
<item>
<layout class="QVBoxLayout" name="verticalLayoutTable"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutButtomPanel">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>90</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../../../resources/connectionstatus.qrc"/>
</resources>
<connections/>
</ui>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -10,27 +10,33 @@
#include <QString>
#include <list>
/**
* @brief The Course class
*
* This class is a prototype of a basic course structure
*
* Made By:
* Sagi Dayan, SagiDayan@gmail.com
* Liran Ben Gida, LiranBG@gmail.com
* On 31/8/2014
*/
class Course {
public:
Course(int serial,QString name, QString type, double points) {
Course(int serial,QString name, QString type) {
this->serialNum = serial;
this->name = name;
this->type = type;
this->points = points;
}
virtual ~Course() { }
int getSerialNum() const {return this->serialNum;}
virtual QString getName() const {return this->name;}
virtual QString getType() const {return this->type;}
virtual double getPoints() const {return this->points;}
virtual void setName(QString name) { this->name = name;}
virtual void setType(QString type){ this->type = type;}
virtual void setPoints(double points){ this->points = points;}
private:
@ -38,7 +44,6 @@ private:
int serialNum;
QString name;
QString type;
double points;
};

View file

@ -1,6 +1,6 @@
#include "page.h"
Page::Page() {}
Page::Page() { dateHeader = "";}
/**
* @brief Page::getString
* @param htmlToPhrased
@ -8,14 +8,14 @@ Page::Page() {}
*/
QString Page::getString(QString &htmlToParse)
{
makeText(htmlToParse);
return this->text;
makeText(htmlToParse);
return this->text;
}
void Page::makeText(QString &html)
{
int index = 0;
index = html.indexOf("<tbody>",0); //set index into the place where the data is
manageTableContent(html, index);
int index = 0;
index = html.indexOf("<tbody>",0); //set index into the place where the data is
manageTableContent(html, index);
}
/**
* @brief Page::manageTableContent strip html, make it string
@ -24,95 +24,153 @@ void Page::makeText(QString &html)
*/
void Page::manageTableContent(QString &html, int index)
{
if (index == -1)
return;
QString temp;
for (int i = index; i < html.length(); i++)
if (index == -1)
return;
QString temp;
for (int i = index; i < html.length(); i++)
{
if(html.at(i) == '<')
if (html.at(i) == '<')
{
//<tr> / <td> / <th>
QString endofTable = "</tbody>";
QString tableTag = html.mid(i, 4); //legth of "tr/td"
if (tableTag == "<tr>")
{
temp += "\n"; //new row -> new line
i = stitchText(html, temp, i+4);
if(i == -1) //EOF
break;
}
else if (tableTag == "<td>" || tableTag == "<th>")
{
temp += "\t"; // new cell -> tab between data
if (html.mid(i, 6) == "<td><a") //link to lecturer portal, need to be deleted
{
i += 6;
while (html.at(++i) != '>');
i = stitchText(html, temp, i+1);
}
else
i = stitchText(html, temp, i+4);
if (i == -1) //EOF
break;
}
else if(tableTag == "<td ") // a Year title (in grades table)
{
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
//<tr> / <td> / <th>
QString endofTable = "</tbody>";
QString tableTag = html.mid(i, 4); //legth of "tr/td"
if (tableTag == "<tr>")
{
if (!dateHeader.isEmpty())
temp += dateHeader;
i = stitchText(html, temp, i+4);
if (i == -1) //EOF
break;
}
else if (tableTag == "</tr")
{
temp += "\n"; //end row -> new line
i+=5;
}
else if (tableTag == "<td>" || tableTag == "<th>")
{
if (!dateHeader.isEmpty())
temp += "\t"; // new cell -> tab between data
if (html.mid(i, 6) == "<td><a") //link to lecturer portal, need to be deleted
{
i += 6;
while (html.at(++i) != '>');
i = stitchText(html, temp, i+1);
}
else
i = stitchText(html, temp, i+4);
if (dateHeader.isEmpty())
temp += "\t";
if (i == -1) //EOF
break;
}
else if (tableTag == "<td ") // a Year title (in grades table) or Day and Hour (in calendar page)
{
if (!dateHeader.isEmpty())
{
//checking if theres a need to fill a timestamp of course
//if the string is not empty, then we will chop the last date stamp to avoid multiple date stamp in empty rows
if (!temp.isEmpty())
if (temp.lastIndexOf(dateHeader) == temp.length()-dateHeader.length())
{
temp.chop(dateHeader.length()+5);
temp += "\t";
}
}
while ((html.mid(i,5) != "</td>") && (i < (int)html.length()))
{
if (html.mid(i,3) == "<b>") //for gpa. year & semester title
{
break;
}
else if ((html.at(i) == '>') && (html.mid(i+4,3) != "<b>")) //for calendar. day and hours
{
i += 1; //lenght of >
break;
}
i++;
}
i = stitchText(html, temp, i);
temp += "\t";
}
if (html.mid(i,(endofTable).length()) == endofTable) //is end of table
{
break;
}
}
}
this->text = temp;
this->text = temp;
}
int Page::stitchText(QString &from, QString &to, int index)
{
if (from.at(index) == '<')
if (from.mid(index,3) == "<b>")
{
QString bTag = from.mid(index, 3);
if (bTag != "<b>")
return index-1; //go back one step - for the main function to inc i
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,"<>&nbsp;:");
while (tok != NULL)
{
if (i == 1)
{
temp = tok;
date += temp + "\t";
}
else if (i == 3)
{
temp = tok;
date += temp;
}
i++;
tok = strtok(NULL, "<>&nbsp;:");
}
dateHeader = date;
if (bTag != "<b>")
return index-1; //go back one step - for the main function to inc i
index += dateline.length();
}
while (from.at(index) != '<' && index < (int)from.length())
while (from.at(index) != '<' && index < (int)from.length())
{
if (from[index] == '&')
if (from[index] == '&')
{
//&nbsp;
QString nbspChr = from.mid(index, 6);
if (nbspChr == "&nbsp;")
//&nbsp;
QString nbspChr = from.mid(index, 6);
if (nbspChr == "&nbsp;")
{
index += 5;
from.replace(index,1,' ');
index += 5;
from.replace(index,1,' ');
}
}
if (endOfString(index,(int) from.length()))
return -1; //EOF
if (endOfString(index,(int) from.length()))
return -1; //EOF
else if (from.at(index) == '<')
return index - 1; //go back one step - for the main function to inc i
else if (from.at(index) == '<')
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
to += from.at(index);
index++;
if ((from.at(index) != '\n') && (from.at(index) != '\t')) //check the actuall data before continue
to += from.at(index);
index++;
}
return index-1;
return index-1;
}
bool Page::endOfString(int index, int length)
{
if(index < length)
return false;
return true;
if(index < length)
return false;
return true;
}

View file

@ -1,12 +1,6 @@
#ifndef PAGE_H
#define PAGE_H
/* This Code Made By Sagi Dayan
* SagiDayan@gmail.com
*
* Changes have been made by Liran Ben Gida
* LiranBG@gmail.com
*/
#include <QDebug>
#include <QString>
@ -14,6 +8,11 @@
* @brief The Page class
* parsing given page - strip and clean html tags
* use only with JCE
*
* Made By:
* Sagi Dayan, SagiDayan@gmail.com
* Liran Ben Gida, LiranBG@gmail.com
* On 31/8/2014
*/
class Page
{
@ -33,6 +32,7 @@ private:
bool endOfString(int index, int length);
QString text;
QString dateHeader;
QString title;
};

View file

@ -1,7 +1,7 @@
#ifndef JCELOGINHTMLSCRIPTS_H
#define JCELOGINHTMLSCRIPTS_H
#include "./src/jceSettings/user.h"
#include "../../src/jceSettings/user.h"
#define dst_host "yedion.jce.ac.il"
#define dst_port 443
@ -84,6 +84,17 @@ public:
parameters += "R1C2=" + QString::number(semester) + "&";
return parameters;
}
const static QString getExamSchedule(const user &usr,int year, int semester)
{
QString parameters;
parameters = "PRGNAME=HADPASAT_TOCHNIT_BEHINOT&ARGUMENTS=TZ,UNIQ,R1C1,R1C2,R1C3&";
parameters += "TZ=" + usr.getUserID() + "&";
parameters += "UNIQ=" + usr.getHashedPassword() + "&";
parameters += "R1C1=" + QString::number(year) + "&";
parameters += "R1C2=" + QString::number(semester) + "&";
parameters += "R1C3=0";
return parameters;
}
};

View file

@ -4,22 +4,23 @@
* @brief jceLogin::jceLogin
* @param username pointer to allocated user settings
*/
jceLogin::jceLogin(user* username)
jceLogin::jceLogin(user* username, jceStatusBar *statusBar)
{
this->recieverPage = new QString();
this->jceA = username;
this->JceConnector = new jceSSLClient();
QObject::connect(JceConnector,SIGNAL(serverDisconnectedbyRemote()),this,SLOT(reValidation()));
QObject::connect(JceConnector,SIGNAL(noInternetLink()),this,SLOT(reMakeConnection()));
this->statusBar = statusBar;
this->recieverPage = new QString();
this->jceA = username;
this->JceConnector = new jceSSLClient(statusBar);
QObject::connect(JceConnector,SIGNAL(serverDisconnectedbyRemote()),this,SLOT(reValidation()));
QObject::connect(JceConnector,SIGNAL(noInternetLink()),this,SLOT(reMakeConnection()));
}
jceLogin::~jceLogin()
{
this->jceA = NULL;
delete recieverPage;
delete JceConnector;
JceConnector = NULL;
recieverPage = NULL;
this->jceA = NULL;
delete recieverPage;
delete JceConnector;
JceConnector = NULL;
recieverPage = NULL;
}
/**
* @brief jceLogin::makeConnection Connecting to JCE student web site with JceA (username object) and validate it.
@ -27,74 +28,79 @@ jceLogin::~jceLogin()
*/
int jceLogin::makeConnection()
{
qDebug() << "jceLogin::makeConnection(); connection to be make";
qDebug() << Q_FUNC_INFO << "connection to be make";
if (this->recieverPage == NULL)
this->recieverPage = new QString();
if (this->recieverPage == NULL)
this->recieverPage = new QString();
int returnMode; //gets status according to called function of validation step
jceStatus status = jceStatus::JCE_NOT_CONNECTED;
int returnMode; //gets status according to called function of validation step
jceStatus status = jceStatus::JCE_NOT_CONNECTED;
returnMode = checkConnection(); //checking socket status. is connected?
returnMode = checkConnection(); //checking socket status. is connected?
if (returnMode == false)
if (returnMode == (int)false)
{
if (JceConnector->makeConnect(dst_host,dst_port) == false) //couldnt make a connection
return jceStatus::ERROR_ON_OPEN_SOCKET;
else
returnMode = true;
statusBar->setIconConnectionStatus(jceStatusBar::Connecting);
if (JceConnector->makeConnect(dst_host,dst_port) == false) //couldnt make a connection
return jceStatus::ERROR_ON_OPEN_SOCKET;
else
returnMode = true;
}
if (returnMode == true) //connected to host
if (returnMode == (int)true) //connected to host
{
returnMode = makeFirstVisit();
if (returnMode == true) //requst and send first validation
statusBar->setIconConnectionStatus(jceStatusBar::Connected);
returnMode = makeFirstVisit();
if (returnMode == (int)true) //requst and send first validation
{
status = jceStatus::JCE_START_VALIDATING_PROGRESS;
returnMode = checkValidation();
if (returnMode == true) //check if username and password are matching
status = jceStatus::JCE_START_VALIDATING_PROGRESS;
returnMode = checkValidation();
if (returnMode == (int)true) //check if username and password are matching
{
status = jceStatus::JCE_VALIDATION_PASSED;
returnMode = makeSecondVisit();
if (returnMode == true) //siging in the website
status = jceStatus::JCE_VALIDATION_PASSED;
returnMode = makeSecondVisit();
if (returnMode == (int)true) //siging in the website
{
qDebug() << "jceLogin::makeConnection(); Signed in succeesfully";
status = jceStatus::JCE_YOU_ARE_IN;
setLoginFlag(true);
qDebug() << Q_FUNC_INFO << "Signed in succeesfully";
status = jceStatus::JCE_YOU_ARE_IN;
setLoginFlag(true);
statusBar->setIconConnectionStatus(jceStatusBar::LoggedIn);
}
else if (returnMode == jceLogin::ERROR_ON_GETTING_INFO)
else if (returnMode == jceLogin::ERROR_ON_GETTING_INFO)
{
status = jceLogin::ERROR_ON_GETTING_INFO;
status = jceLogin::ERROR_ON_GETTING_INFO;
}
else if (returnMode == jceLogin::ERROR_ON_SEND_REQUEST)
else if (returnMode == jceLogin::ERROR_ON_SEND_REQUEST)
{
status = jceLogin::ERROR_ON_SEND_REQUEST;
status = jceLogin::ERROR_ON_SEND_REQUEST;
}
else
status = jceStatus::ERROR_ON_VALIDATION;
}
else
else
status = jceStatus::ERROR_ON_VALIDATION;
}
else
status = jceStatus::ERROR_ON_VALIDATION;
}
else if (returnMode == jceLogin::ERROR_ON_GETTING_INFO)
else if (returnMode == jceLogin::ERROR_ON_GETTING_INFO)
{
status = jceLogin::ERROR_ON_GETTING_INFO;
status = jceLogin::ERROR_ON_GETTING_INFO;
}
else if (returnMode == jceLogin::ERROR_ON_SEND_REQUEST)
else if (returnMode == jceLogin::ERROR_ON_SEND_REQUEST)
{
status = jceLogin::ERROR_ON_SEND_REQUEST;
status = jceLogin::ERROR_ON_SEND_REQUEST;
}
else
status = jceStatus::ERROR_ON_VALIDATION_USER_BLOCKED;
else
status = jceStatus::ERROR_ON_VALIDATION_USER_BLOCKED;
}
else
status = jceStatus::JCE_NOT_CONNECTED;
else
status = jceStatus::JCE_NOT_CONNECTED;
//we throw status even if we are IN!
qDebug() << "jceLogin::makeConnection(); return status: " << status;
return status;
if (status != jceStatus::JCE_YOU_ARE_IN)
statusBar->setIconConnectionStatus(jceStatusBar::Error);
//we throw status even if we are IN!
qDebug() << Q_FUNC_INFO << "return status: " << status;
return status;
}
/**
@ -103,21 +109,22 @@ int jceLogin::makeConnection()
*/
bool jceLogin::checkConnection() const
{
if (JceConnector->isConnected())
return true;
if (JceConnector->isConnected())
return true;
return false;
return false;
}
/**
* @brief jceLogin::closeAll
*/
void jceLogin::closeAll()
{
this->JceConnector->makeDiconnect();
if ((this->recieverPage != NULL) && (!this->recieverPage->isEmpty()))
statusBar->setIconConnectionStatus(jceStatusBar::Disconnected);
this->JceConnector->makeDiconnect();
if ((this->recieverPage != NULL) && (!this->recieverPage->isEmpty()))
{
delete recieverPage;
recieverPage = NULL;
delete recieverPage;
recieverPage = NULL;
}
}
@ -126,17 +133,17 @@ void jceLogin::closeAll()
*/
void jceLogin::reMakeConnection()
{
if (this->JceConnector != NULL)
delete JceConnector;
if (this->recieverPage != NULL)
delete recieverPage;
recieverPage = NULL;
JceConnector = NULL;
this->recieverPage = new QString();
this->JceConnector = new jceSSLClient();
QObject::connect(JceConnector,SIGNAL(serverDisconnectedbyRemote()),this,SLOT(reValidation()));
QObject::connect(JceConnector,SIGNAL(noInternetLink()),this,SLOT(reMakeConnection()));
emit connectionReadyAfterDisconnection();
if (this->JceConnector != NULL)
delete JceConnector;
if (this->recieverPage != NULL)
delete recieverPage;
recieverPage = NULL;
JceConnector = NULL;
this->recieverPage = new QString();
this->JceConnector = new jceSSLClient(statusBar);
QObject::connect(JceConnector,SIGNAL(serverDisconnectedbyRemote()),this,SLOT(reValidation()));
QObject::connect(JceConnector,SIGNAL(noInternetLink()),this,SLOT(reMakeConnection()));
emit connectionReadyAfterDisconnection();
}
/**
@ -145,17 +152,15 @@ void jceLogin::reMakeConnection()
*/
int jceLogin::makeFirstVisit()
{
QString usr = jceA->getUsername();
QString psw = jceA->getPassword();
if (JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getFirstValidationStep(*jceA))))
if (JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getFirstValidationStep(*jceA))))
{
if (!JceConnector->recieveData(*recieverPage,true))
return jceLogin::ERROR_ON_GETTING_INFO;
if (!JceConnector->recieveData(recieverPage))
return jceLogin::ERROR_ON_GETTING_INFO;
}
else
return jceLogin::ERROR_ON_SEND_REQUEST;
else
return jceLogin::ERROR_ON_SEND_REQUEST;
return true;
return true;
}
/**
* @brief jceLogin::makeSecondVisit making the second validation step of jce student portal login
@ -163,19 +168,19 @@ int jceLogin::makeFirstVisit()
*/
int jceLogin::makeSecondVisit()
{
QString usrid=jceA->getUserID();
QString pswid=jceA->getHashedPassword();
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getSecondValidationStep(*jceA)))))
QString usrid=jceA->getUserID();
QString pswid=jceA->getHashedPassword();
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getSecondValidationStep(*jceA)))))
{
if (!(JceConnector->recieveData(*recieverPage,true)))
return jceLogin::ERROR_ON_GETTING_INFO;
if (!(JceConnector->recieveData(recieverPage)))
return jceLogin::ERROR_ON_GETTING_INFO;
return true;
return true;
}
else
return jceLogin::ERROR_ON_SEND_REQUEST;
else
return jceLogin::ERROR_ON_SEND_REQUEST;
return true;
return true;
}
/**
* @brief jceLogin::getCalendar according to parameters, we make an HTML request and send it over socket to server
@ -185,18 +190,32 @@ int jceLogin::makeSecondVisit()
*/
int jceLogin::getCalendar(int year, int semester)
{
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getCalendar(*jceA,year,semester)))))
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getCalendar(*jceA,year,semester)))))
{
if (!(JceConnector->recieveData(*recieverPage,false)))
return jceLogin::ERROR_ON_GETTING_PAGE;
else
return jceLogin::JCE_PAGE_PASSED;
if (!(JceConnector->recieveData(recieverPage)))
return jceLogin::ERROR_ON_GETTING_PAGE;
else
return jceLogin::JCE_PAGE_PASSED;
}
else
return jceLogin::ERROR_ON_SEND_REQUEST;
return true;
}
int jceLogin::getExams(int year, int semester)
{
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getExamSchedule(*jceA,year,semester)))))
{
if (!(JceConnector->recieveData(recieverPage)))
return jceLogin::ERROR_ON_GETTING_PAGE;
else
return jceLogin::JCE_PAGE_PASSED;
}
else
return jceLogin::ERROR_ON_SEND_REQUEST;
return jceLogin::ERROR_ON_SEND_REQUEST;
return true;
}
/**
* @brief jceLogin::getGrades according to parameters, we make an HTML request and send it over socket to server
@ -208,17 +227,17 @@ int jceLogin::getCalendar(int year, int semester)
*/
int jceLogin::getGrades(int fromYear, int toYear, int fromSemester, int toSemester)
{
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getGradesPath(*jceA,fromYear, toYear, fromSemester, toSemester)))))
if ((JceConnector->sendData(jceLoginHtmlScripts::makeRequest(jceLoginHtmlScripts::getGradesPath(*jceA,fromYear, toYear, fromSemester, toSemester)))))
{
if (!(JceConnector->recieveData(*recieverPage,false)))
return jceLogin::ERROR_ON_GETTING_PAGE;
else
return jceLogin::JCE_PAGE_PASSED;
if (!(JceConnector->recieveData(recieverPage)))
return jceLogin::ERROR_ON_GETTING_PAGE;
else
return jceLogin::JCE_PAGE_PASSED;
}
else
return jceLogin::ERROR_ON_SEND_REQUEST;
else
return jceLogin::ERROR_ON_SEND_REQUEST;
return true;
return true;
}
/**
@ -228,43 +247,43 @@ int jceLogin::getGrades(int fromYear, int toYear, int fromSemester, int toSemest
bool jceLogin::checkValidation()
{
//finds the hashed password
QString constUserID_TAG = "value=\"-N";
QString constHassID_TAG = "-A,-N";
QString hasspass,hassid;
std::size_t hasspass_position1,hasspass_position2;
std::size_t id_position1,id_position2;
//finds the hashed password
QString constUserID_TAG = "value=\"-N";
QString constHassID_TAG = "-A,-N";
QString hasspass,hassid;
std::size_t hasspass_position1,hasspass_position2;
std::size_t id_position1,id_position2;
hasspass_position1 = this->recieverPage->toStdString().find(constHassID_TAG.toStdString()); //looking for hasspass index
if (hasspass_position1 == std::string::npos) //didnt find the tag
return false;
else
hasspass_position1 += constHassID_TAG.length(); //skip the index of tag
hasspass_position2 = this->recieverPage->toStdString().find(",-A,-A", hasspass_position1);
//finds the hass pass
if (hasspass_position2 != std::string::npos) //found the hasspass! storing it
hasspass = recieverPage->mid(hasspass_position1,hasspass_position2-hasspass_position1);
else
return false;
//finds the user id
id_position1 = this->recieverPage->toStdString().find(constUserID_TAG.toStdString(), 0); //looking for hassid index
if (id_position1 == std::string::npos) //didnt find the tag
return false;
else
id_position1 += constUserID_TAG.length(); //skip the index of tag
id_position2 = this->recieverPage->toStdString().find(",-A", id_position1);
if (id_position2 != std::string::npos) //found the hassid! storing it
hassid = recieverPage->mid(id_position1,id_position2-id_position1);
else
return false;
hasspass_position1 = this->recieverPage->toStdString().find(constHassID_TAG.toStdString()); //looking for hasspass index
if (hasspass_position1 == std::string::npos) //didnt find the tag
return false;
else
hasspass_position1 += constHassID_TAG.length(); //skip the index of tag
hasspass_position2 = this->recieverPage->toStdString().find(",-A,-A", hasspass_position1);
//finds the hass pass
if (hasspass_position2 != std::string::npos) //found the hasspass! storing it
hasspass = recieverPage->mid(hasspass_position1,hasspass_position2-hasspass_position1);
else
return false;
//finds the user id
id_position1 = this->recieverPage->toStdString().find(constUserID_TAG.toStdString(), 0); //looking for hassid index
if (id_position1 == std::string::npos) //didnt find the tag
return false;
else
id_position1 += constUserID_TAG.length(); //skip the index of tag
id_position2 = this->recieverPage->toStdString().find(",-A", id_position1);
if (id_position2 != std::string::npos) //found the hassid! storing it
hassid = recieverPage->mid(id_position1,id_position2-id_position1);
else
return false;
//setting user information with given data hassid and hasspass
jceA->setHashedPassword(hasspass);
jceA->setUserID(hassid);
//setting user information with given data hassid and hasspass
jceA->setHashedPassword(hasspass);
jceA->setUserID(hassid);
qDebug() << "jceLogin::checkValidation(); Found Hashed: " << hasspass << "And ID: " << hassid;
qDebug() << "jceLogin::checkValidation(); Found Hashed: " << hasspass << "And ID: " << hassid;
return true;
return true;
}
/**
* @brief jceLogin::setLoginFlag
@ -272,7 +291,7 @@ bool jceLogin::checkValidation()
*/
void jceLogin::setLoginFlag(bool x)
{
this->loginFlag = x;
this->loginFlag = x;
}
/**
* @brief jceLogin::isLoginFlag checking if there is a connection, if true - > return if we signed in. otherwise, return not (not connected dough)
@ -280,9 +299,9 @@ void jceLogin::setLoginFlag(bool x)
*/
bool jceLogin::isLoginFlag() const
{
if (checkConnection())
return this->loginFlag;
return false;
if (checkConnection())
return this->loginFlag;
return false;
}
/**
@ -291,26 +310,30 @@ bool jceLogin::isLoginFlag() const
*/
QString jceLogin::getPage()
{
return *recieverPage;
return *recieverPage;
}
void jceLogin::reValidation()
{
qDebug() << Q_FUNC_INFO << "Revalidating user";
if (makeFirstVisit() == true)
qDebug() << Q_FUNC_INFO << "Revalidating user";
if (makeFirstVisit() == (int)true)
{
if (checkValidation())
if (checkValidation())
{
if (makeSecondVisit() == true)
qDebug() << Q_FUNC_INFO << "Validated";
else
qWarning() << Q_FUNC_INFO << "Second visit finished with an error";
if (makeSecondVisit() == (int)true)
{
statusBar->setIconConnectionStatus(jceStatusBar::LoggedIn);
qDebug() << Q_FUNC_INFO << "Validated";
}
else
qWarning() << Q_FUNC_INFO << "Second visit finished with an error";
}
else
qDebug() << Q_FUNC_INFO << "checking validation ended with an error";
else
qDebug() << Q_FUNC_INFO << "checking validation ended with an error";
}
else
else
{
qDebug() << Q_FUNC_INFO << "Couldnt Validate User";
qDebug() << Q_FUNC_INFO << "Couldnt Validate User";
}
}

View file

@ -1,66 +1,71 @@
#ifndef JCELOGIN_H
#define JCELOGIN_H
#include "./src/jceConnection/jcesslclient.h"
#include "./src/jceSettings/user.h"
#include "../../src/jceConnection/jcesslclient.h"
#include "../../src/jceSettings/user.h"
#include "jceLoginHtmlScripts.h"
#include <QObject>
#include <QString>
class jceLogin : public QObject
{
Q_OBJECT
Q_OBJECT
public:
jceLogin() {}
jceLogin(user* username);
~jceLogin();
enum jceStatus {
JCE_NOT_CONNECTED,
ERROR_ON_VALIDATION,
ERROR_ON_VALIDATION_USER_BLOCKED,
ERROR_ON_OPEN_SOCKET,
ERROR_ON_SEND_REQUEST,
ERROR_ON_GETTING_INFO,
ERROR_ON_GETTING_PAGE,
jceLogin(user* username, jceStatusBar *statusBar);
~jceLogin();
JCE_START_VALIDATING_PROGRESS,
JCE_VALIDATION_PASSED,
JCE_YOU_ARE_IN,
JCE_PAGE_PASSED
};
enum jceStatus {
JCE_NOT_CONNECTED,
ERROR_ON_VALIDATION,
ERROR_ON_VALIDATION_USER_BLOCKED,
ERROR_ON_OPEN_SOCKET,
ERROR_ON_SEND_REQUEST,
ERROR_ON_GETTING_INFO,
ERROR_ON_GETTING_PAGE,
int makeConnection();
void closeAll();
JCE_START_VALIDATING_PROGRESS,
JCE_VALIDATION_PASSED,
JCE_YOU_ARE_IN,
JCE_PAGE_PASSED
};
bool checkConnection() const;
bool isLoginFlag() const;
int getCalendar(int year, int semester);
int getGrades(int fromYear, int toYear, int fromSemester, int toSemester);
int makeConnection();
void closeAll();
QString getPage();
bool checkConnection() const;
bool isLoginFlag() const;
int getExams(int year, int semester);
int getCalendar(int year, int semester);
int getGrades(int fromYear, int toYear, int fromSemester, int toSemester);
QString getPage();
private slots:
void reValidation();
void reMakeConnection();
void reValidation();
void reMakeConnection();
signals:
void connectionReadyAfterDisconnection();
void connectionReadyAfterDisconnection();
private:
int makeFirstVisit();
int makeSecondVisit();
bool checkValidation();
void setLoginFlag(bool x);
int makeFirstVisit();
int makeSecondVisit();
bool checkValidation();
void setLoginFlag(bool x);
bool loginFlag;
QString * recieverPage;
user * jceA;
jceSSLClient * JceConnector;
bool loginFlag;
QString * recieverPage;
user * jceA;
jceSSLClient * JceConnector;
jceStatusBar *statusBar;
};

View file

@ -2,8 +2,8 @@ IDI_ICON1 ICON DISCARDABLE "./resources/icon.ico"
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1, 0, 0
PRODUCTVERSION 1, 0, 0
FILEVERSION 1, 1, 0
PRODUCTVERSION 1, 1, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
@ -20,12 +20,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Jce Manager\0"
VALUE "FileDescription", "\0"
VALUE "FileVersion", "1.0.0\0"
VALUE "FileVersion", "1.1.0\0"
VALUE "InternalName", "jceManager\0"
VALUE "LegalCopyright", "Jce Manager Team, liranbg@gmail.com\0"
VALUE "OriginalFilename", "jceManager\0"
VALUE "ProductName", "Jce Manager\0"
VALUE "ProductVersion", "1.0.0\0"
VALUE "ProductVersion", "1.1.0\0"
END
END
END