fix before first release

fixed english translation,
changed connectivity checkings
add more debugging functions
This commit is contained in:
liranbg 2014-09-27 01:40:02 +03:00
parent 0f6ffb1223
commit b16fc2b792
10 changed files with 583 additions and 515 deletions

View file

@ -6,7 +6,7 @@
QT += core gui network widgets
CONFIG += qt c++11 static
CONFIG += qt c++11
#CONFIG += console static
TARGET = jceManager

BIN
jce_en.qm

Binary file not shown.

107
jce_en.ts
View file

@ -46,8 +46,8 @@
<name>MainScreen</name>
<message>
<location filename="main/mainscreen.ui" line="20"/>
<source>JCE Avg Calculator</source>
<translation>JCE Avg Calculator</translation>
<source>JCE Manager</source>
<translation>JCE Manager</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="86"/>
@ -148,7 +148,8 @@
</message>
<message>
<location filename="main/mainscreen.ui" line="632"/>
<source>&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;</source>
<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;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;</translation>
</message>
<message>
@ -192,107 +193,107 @@
<translation>How To</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="21"/>
<location filename="main/mainscreen.cpp" line="23"/>
<source>Ready</source>
<translation>Ready</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="132"/>
<location filename="main/mainscreen.cpp" line="151"/>
<location filename="main/mainscreen.cpp" line="206"/>
<location filename="main/mainscreen.cpp" line="234"/>
<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"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="132"/>
<location filename="main/mainscreen.cpp" line="136"/>
<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="151"/>
<location filename="main/mainscreen.cpp" line="234"/>
<location filename="main/mainscreen.cpp" line="157"/>
<location filename="main/mainscreen.cpp" line="242"/>
<source>Not Connected</source>
<translation>Not Connected</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="206"/>
<location filename="main/mainscreen.cpp" line="212"/>
<source>Missmatching data</source>
<translation>Missmatching Data</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="255"/>
<location filename="main/mainscreen.cpp" line="264"/>
<source>License:</source>
<translation>License:</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="260"/>
<location filename="main/mainscreen.cpp" line="269"/>
<source>Powered By: </source>
<oldsource>powered by: </oldsource>
<translation>Powered By: </translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="262"/>
<location filename="main/mainscreen.cpp" line="271"/>
<source>Developed By</source>
<translation>Developed By</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="278"/>
<location filename="main/mainscreen.cpp" line="287"/>
<source>Help Guide</source>
<oldsource>Guide</oldsource>
<translation>Help Guide</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="264"/>
<location filename="main/mainscreen.cpp" line="273"/>
<source>Liran</source>
<translation>Liran Ben Gida</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="265"/>
<location filename="main/mainscreen.cpp" line="274"/>
<source>Sagi</source>
<translation>Sagi Dayan</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="280"/>
<location filename="main/mainscreen.cpp" line="289"/>
<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="281"/>
<location filename="main/mainscreen.cpp" line="290"/>
<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="282"/>
<location filename="main/mainscreen.cpp" line="291"/>
<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="283"/>
<location filename="main/mainscreen.cpp" line="292"/>
<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="284"/>
<location filename="main/mainscreen.cpp" line="293"/>
<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;על מנת לייצא לקובץ CSV&lt;ul&gt;&lt;li&gt;חזור על השלב הקודם ורק אז&lt;/li&gt;&lt;li&gt; לחת על ייצוא לקובץ CSV&lt;/li&gt;&lt;li&gt;בחר את התאריכים המתאימים ולחץ על אישור&lt;/li&gt;&lt;li&gt;ברגע שתסיים תוכל הודעה ולאחר מכן תוכל לייבא את הקובץ היכן שתרצה&lt;/li&gt;&lt;/li&gt;</translation>
<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="286"/>
<location filename="main/mainscreen.cpp" line="295"/>
<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="297"/>
<location filename="main/mainscreen.cpp" line="325"/>
<location filename="main/mainscreen.cpp" line="306"/>
<location filename="main/mainscreen.cpp" line="334"/>
<source>Settings</source>
<translation>Settings</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="297"/>
<location filename="main/mainscreen.cpp" line="311"/>
<location filename="main/mainscreen.cpp" line="325"/>
<location filename="main/mainscreen.cpp" line="306"/>
<location filename="main/mainscreen.cpp" line="320"/>
<location filename="main/mainscreen.cpp" line="334"/>
<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>
@ -423,117 +424,117 @@ If this message appear without reason, please contact me at liranbg@gmail.com</t
<translation>Friday</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="249"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="263"/>
<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="254"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="268"/>
<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="264"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="278"/>
<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="269"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="283"/>
<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="273"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="287"/>
<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="280"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="294"/>
<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="289"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="303"/>
<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="293"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="307"/>
<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="297"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="311"/>
<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="301"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="315"/>
<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="306"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="320"/>
<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="309"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="323"/>
<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="312"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="326"/>
<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="315"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="329"/>
<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="318"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="332"/>
<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="321"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="335"/>
<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="324"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="338"/>
<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="327"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="341"/>
<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="330"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="344"/>
<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="333"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="347"/>
<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="336"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="350"/>
<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="339"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="353"/>
<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="342"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="356"/>
<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>

BIN
jce_he.qm

Binary file not shown.

107
jce_he.ts
View file

@ -46,8 +46,8 @@
<name>MainScreen</name>
<message>
<location filename="main/mainscreen.ui" line="20"/>
<source>JCE Avg Calculator</source>
<translation>JCE Avg Calculator</translation>
<source>JCE Manager</source>
<translation>JCE Manager</translation>
</message>
<message>
<location filename="main/mainscreen.ui" line="86"/>
@ -148,8 +148,9 @@
</message>
<message>
<location filename="main/mainscreen.ui" line="632"/>
<source>&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;</source>
<translation>&lt;p align=&quot;right&quot;&gt;נוצר ע&quot;י: &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>
<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;נוצר ע&quot;י: &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"/>
@ -192,107 +193,107 @@
<translation>עזרה</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="21"/>
<location filename="main/mainscreen.cpp" line="23"/>
<source>Ready</source>
<translation>מוכן</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="132"/>
<location filename="main/mainscreen.cpp" line="151"/>
<location filename="main/mainscreen.cpp" line="206"/>
<location filename="main/mainscreen.cpp" line="234"/>
<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"/>
<source>Error</source>
<translation>שגיאה</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="132"/>
<location filename="main/mainscreen.cpp" line="136"/>
<source>Invalid Dates.
Make Sure everything is correct and try again</source>
<translation>תאריכים לא חוקיים. אנא בדוק שהנתונים שהוזנו נכונים ונסה מחדשה</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="151"/>
<location filename="main/mainscreen.cpp" line="234"/>
<location filename="main/mainscreen.cpp" line="157"/>
<location filename="main/mainscreen.cpp" line="242"/>
<source>Not Connected</source>
<translation>לא מחובר</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="206"/>
<location filename="main/mainscreen.cpp" line="212"/>
<source>Missmatching data</source>
<translation>שגיאה בהכנסת נתונים</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="255"/>
<location filename="main/mainscreen.cpp" line="264"/>
<source>License:</source>
<translation>רישיון:</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="260"/>
<location filename="main/mainscreen.cpp" line="269"/>
<source>Powered By: </source>
<oldsource>powered by: </oldsource>
<translation>מנוע:</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="262"/>
<location filename="main/mainscreen.cpp" line="271"/>
<source>Developed By</source>
<translation></translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="278"/>
<location filename="main/mainscreen.cpp" line="287"/>
<source>Help Guide</source>
<oldsource>Guide</oldsource>
<translation>תפריט עזרה</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="264"/>
<location filename="main/mainscreen.cpp" line="273"/>
<source>Liran</source>
<translation>לירן בן גידה</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="265"/>
<location filename="main/mainscreen.cpp" line="274"/>
<source>Sagi</source>
<translation>שגיא דיין</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="280"/>
<location filename="main/mainscreen.cpp" line="289"/>
<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;התחברות: &lt;ul&gt;&lt;li&gt;הזן את שם המשתמש והסיסמה ולחץ על התחבר&lt;/li&gt;&lt;li&gt;בגמר ההתחברות תראה בכדור ירוק בשורת המצב. המשמעות שהינך מחובר לאתר&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="281"/>
<location filename="main/mainscreen.cpp" line="290"/>
<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;קבלת גליון ציונים&lt;ul&gt;&lt;li&gt;לחץ על לשונית הציונים&lt;/li&gt;&lt;li&gt;בחר את טווח התאריכים הרצויים ולחץ על הוספה&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="282"/>
<location filename="main/mainscreen.cpp" line="291"/>
<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;שינוי ממוצע&lt;ul&gt;&lt;li&gt;שנה את אחד הציונים שלך בקורס והממוצע ישתנה בהתאם.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="283"/>
<location filename="main/mainscreen.cpp" line="292"/>
<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;קבלת שעות מערכת&lt;ul&gt;&lt;li&gt;לחץ על לשונית שעות מערכת&lt;/li&gt;&lt;li&gt;בחר את השנה והסמסטר ולחץ על הצג מערכת&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="284"/>
<location filename="main/mainscreen.cpp" line="293"/>
<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;על מנת לייצא לקובץ CSV&lt;ul&gt;&lt;li&gt;בצע את השלב הקודם ואז&lt;/li&gt;&lt;li&gt; לחץ על ייצוא לCSV&lt;/li&gt;&lt;li&gt;בחר את התאריכים המתאימים ולחץ אישור&lt;/li&gt;&lt;li&gt;לאחר השלמת הפעולה תוכל לייבא את המערכת שעות&lt;/li&gt;&lt;/li&gt;</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="286"/>
<location filename="main/mainscreen.cpp" line="295"/>
<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;לעוד מידע: &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="297"/>
<location filename="main/mainscreen.cpp" line="325"/>
<location filename="main/mainscreen.cpp" line="306"/>
<location filename="main/mainscreen.cpp" line="334"/>
<source>Settings</source>
<translation>הגדרות</translation>
</message>
<message>
<location filename="main/mainscreen.cpp" line="297"/>
<location filename="main/mainscreen.cpp" line="311"/>
<location filename="main/mainscreen.cpp" line="325"/>
<location filename="main/mainscreen.cpp" line="306"/>
<location filename="main/mainscreen.cpp" line="320"/>
<location filename="main/mainscreen.cpp" line="334"/>
<source>Your settings will take effect next time you start the program</source>
<translation>ההגדרות שלך ייכנסו לתוקפן בפעם הבאה שתפעיל את התוכנה</translation>
</message>
@ -423,117 +424,117 @@ If this message appear without reason, please contact me at liranbg@gmail.com</s
<translation>שישי</translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="249"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="263"/>
<source>ConnectionRefusedError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="254"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="268"/>
<source>RemoteHostClosedError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="264"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="278"/>
<source>HostNotFoundError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="269"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="283"/>
<source>SocketAccessError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="273"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="287"/>
<source>SocketTimeoutError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="280"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="294"/>
<source>NetworkError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="289"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="303"/>
<source>SslHandshakeFailedError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="293"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="307"/>
<source>SslInternalError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="297"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="311"/>
<source>SslInvalidUserDataError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="301"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="315"/>
<source>DatagramTooLargeError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="306"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="320"/>
<source>OperationError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="309"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="323"/>
<source>AddressInUseError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="312"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="326"/>
<source>SocketAddressNotAvailableError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="315"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="329"/>
<source>UnsupportedSocketOperationError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="318"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="332"/>
<source>ProxyAuthenticationRequiredError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="321"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="335"/>
<source>ProxyConnectionRefusedError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="324"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="338"/>
<source>UnfinishedSocketOperationError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="327"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="341"/>
<source>ProxyConnectionClosedError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="330"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="344"/>
<source>ProxyConnectionTimeoutError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="333"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="347"/>
<source>ProxyNotFoundError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="336"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="350"/>
<source>ProxyProtocolError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="339"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="353"/>
<source>TemporaryError</source>
<translation></translation>
</message>
<message>
<location filename="src/jceConnection/jcesslclient.cpp" line="342"/>
<location filename="src/jceConnection/jcesslclient.cpp" line="356"/>
<source>UnknownSocketError</source>
<translation></translation>
</message>

View file

@ -4,343 +4,359 @@
MainScreen::MainScreen(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainScreen)
{
ui->setupUi(this);
//this->setFixedSize(this->size()); //main not resizeable
ui->setupUi(this);
//this->setFixedSize(this->size()); //main not resizeable
//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
ui->statusBar->setStyleSheet("QStatusBar::item { border: 0px solid black };");
ui->statusBar->setFixedHeight(STATUS_ICON_HEIGH);
ui->statusBar->showMessage(tr("Ready"));
//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->statusBar,ui->loginButton);
this->calendar = new CalendarManager(ui->calendarGridLayoutMain);
this->data = new SaveData();
//GPA Tab
ui->avgLCD->setPalette(QPalette(QPalette::WindowText,Qt::blue));
//check login File
if (data->isSaved())
//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())
{
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 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()))
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
if ((ui->usrnmLineEdit->text().isEmpty()) || (ui->pswdLineEdit->text().isEmpty()))
{
if (ui->usrnmLineEdit->text().isEmpty())
if (ui->usrnmLineEdit->text().isEmpty())
{
ui->labelUsrInputStatus->setVisible(true);
qDebug() << Q_FUNC_INFO << "username input is empty";
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
{
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())
if (ui->pswdLineEdit->text().isEmpty())
{
qDebug() << Q_FUNC_INFO << "saving data";
data->setUsername(ui->usrnmLineEdit->text());
data->setPassword(ui->pswdLineEdit->text());
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
else
{
qDebug() << Q_FUNC_INFO << "login session end with false";
ui->pswdLineEdit->setDisabled(false);
ui->usrnmLineEdit->setDisabled(false);
qDebug() << Q_FUNC_INFO << "login session end with false";
ui->pswdLineEdit->setDisabled(false);
ui->usrnmLineEdit->setDisabled(false);
}
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());
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
ui->usrnmLineEdit->setText(ui->usrnmLineEdit->text().toLower());
}
//EVENTS ON GPA TAB
void MainScreen::on_ratesButton_clicked()
{
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
if (!checkIfValidDates())
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
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;
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())
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)
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();
qDebug() << Q_FUNC_INFO << "grade page is ready";
pageString = loginHandel->getCurrentPageContect();
courseTableMgr->setCoursesList(pageString);
courseTableMgr->insertJceCoursesIntoTable();
}
else if (status == jceLogin::JCE_NOT_CONNECTED)
else if (status == jceLogin::JCE_NOT_CONNECTED)
{
qWarning() << Q_FUNC_INFO << "not connected";
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
qWarning() << Q_FUNC_INFO << "not connected";
QApplication::restoreOverrideCursor();
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
}
else
else
{
qCritical() << Q_FUNC_INFO << "grade get ended with" << status;
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!
//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())
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())
flag = true;
}
return flag;
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)
{
qDebug() << Q_FUNC_INFO << "item at row:" << item->row() << " colum:" << item->column() << " text: " << item->text();
if (this->courseTableMgr->changes(item->text(),item->row(),item->column()))
ui->avgLCD->display(courseTableMgr->getAvg());
else
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());
}
//EVENTS ON CALENDAR TAB
void MainScreen::on_getCalendarBtn_clicked()
{
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
int status = 0;
if (loginHandel->isLoggedInFlag())
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
int status = 0;
QApplication::setOverrideCursor(Qt::WaitCursor);
if (loginHandel->isLoggedInFlag())
{
if ((status = loginHandel->makeCalendarRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_PAGE_PASSED)
if ((status = loginHandel->makeCalendarRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_PAGE_PASSED)
{
//Use it for debug. add plain text and change the object name to 'plainTextEdit' so you will get the html request
//ui->plainTextEdit->setPlainText(loginHandel->getCurrentPageContect());
calendar->resetTable();
calendar->setCalendar(loginHandel->getCurrentPageContect());
qDebug() << Q_FUNC_INFO << "calendar is loaded";
//Use it for debug. add plain text and change the object name to 'plainTextEdit' so you will get the html request
//ui->plainTextEdit->setPlainText(loginHandel->getCurrentPageContect());
calendar->resetTable();
calendar->setCalendar(loginHandel->getCurrentPageContect());
qDebug() << Q_FUNC_INFO << "calendar is loaded";
}
else if (status == jceLogin::JCE_NOT_CONNECTED)
else if (status == jceLogin::JCE_NOT_CONNECTED)
{
qWarning() << Q_FUNC_INFO << "not connected";
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
qWarning() << Q_FUNC_INFO << "not connected";
QApplication::restoreOverrideCursor();
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
}
else
qCritical() << Q_FUNC_INFO << "calendar get ended with" << status;
else
qCritical() << Q_FUNC_INFO << "calendar get ended with" << status;
}
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>"
);
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);
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>"));
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())
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);
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);
else
ui->actionHebrew->setChecked(true);
}
void MainScreen::on_actionEnglish_triggered()
{
qDebug() << Q_FUNC_INFO;
if (ui->actionHebrew->isChecked() || ui->actionOS_Default->isChecked())
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);
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);
else
ui->actionEnglish->setChecked(true);
}
void MainScreen::on_actionOS_Default_triggered()
{
qDebug() << Q_FUNC_INFO;
if (ui->actionHebrew->isChecked() || ui->actionEnglish->isChecked())
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);
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);
else
ui->actionOS_Default->setChecked(true);
}
void MainScreen::checkLocale()
{
if(data->getLocal() == "en")
if(data->getLocal() == "en")
{
ui->actionHebrew->setChecked(false);
ui->actionOS_Default->setChecked(false);
ui->actionEnglish->setChecked(true);
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);
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);
ui->actionHebrew->setChecked(false);
ui->actionOS_Default->setChecked(true);
ui->actionEnglish->setChecked(false);
}
}
void MainScreen::on_labelMadeBy_linkActivated(const QString &link)
{
qDebug() << Q_FUNC_INFO << "link: " << link;
}

View file

@ -65,6 +65,8 @@ private slots:
void on_spinBoxCoursesToSemester_valueChanged(int arg1);
void on_labelMadeBy_linkActivated(const QString &link);
private:
void checkLocale();

View file

@ -17,7 +17,7 @@
</sizepolicy>
</property>
<property name="windowTitle">
<string>JCE Avg Calculator</string>
<string>JCE Manager</string>
</property>
<property name="windowIcon">
<iconset resource="../resources/connectionstatus.qrc">
@ -61,7 +61,7 @@ background: qlineargradient(spread:pad, x1:0.496, y1:0, x2:0.508, y2:1, stop:0 r
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<property name="documentMode">
<bool>false</bool>
@ -627,7 +627,7 @@ font-size: 15px;
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelMadeBy">
<property name="text">
<string>&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;</string>
</property>

View file

@ -3,18 +3,17 @@
/**
* @brief jceSSLClient::jceSSLClient Constructer, setting the signals
*/
jceSSLClient::jceSSLClient() : flag(false), packet(""), networkConf(), reConnection(false)
jceSSLClient::jceSSLClient() : flag(false), packet(""),networkConf(), reConnection(false)
{
//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()));
//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()));
}
/**
@ -25,34 +24,48 @@ jceSSLClient::jceSSLClient() : flag(false), packet(""), networkConf(), reConnect
*/
bool jceSSLClient::makeConnect(QString server, int port)
{
if (this->networkConf.isOnline() == false)
return false;
if (reConnection) //reset reconnectiong flag
if (this->supportsSsl() == false)
{
qDebug() << Q_FUNC_INFO << "Making Reconnection";
qCritical() << Q_FUNC_INFO << "Couldnt load ssl package. ERROR";
return false;
}
else
qDebug() << Q_FUNC_INFO << "Making Connection";
else
qDebug() << Q_FUNC_INFO << "ssl loaded.";
if (isConnected())
if (isConnectedToNetwork() == false)
{
qDebug() << Q_FUNC_INFO << "flag=true, calling makeDisconnect()";
makeDiconnect();
qDebug() << Q_FUNC_INFO << "return false. not online";
return false;
}
else
qDebug() << Q_FUNC_INFO << "we're online";
if (reConnection) //reset reconnectiong flag
{
qDebug() << Q_FUNC_INFO << "Making Reconnection";
}
else
qDebug() << Q_FUNC_INFO << "Making Connection";
if (isConnected())
{
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
loop.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 (reConnection)
{
reConnection = false;
emit serverDisconnectedbyRemote();
reConnection = false;
emit serverDisconnectedbyRemote();
}
return isConnected();
return isConnected();
}
/**
@ -61,15 +74,15 @@ bool jceSSLClient::makeConnect(QString server, int port)
*/
bool jceSSLClient::makeDiconnect()
{
if (loop.isRunning())
if (loop.isRunning())
{
qWarning() << Q_FUNC_INFO << "Killing connection thread";
loop.exit();
qWarning() << Q_FUNC_INFO << "Killing connection thread";
loop.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());
}
@ -79,30 +92,30 @@ bool jceSSLClient::makeDiconnect()
*/
bool jceSSLClient::isConnected()
{
bool tempFlag;
//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 (this->networkConf.isOnline())
tempFlag = true;
else
if (isConnectedToNetwork())
tempFlag = true;
else
{
this->setSocketState(QAbstractSocket::SocketState::UnconnectedState);
tempFlag = false;
this->setSocketState(QAbstractSocket::SocketState::UnconnectedState);
tempFlag = false;
}
}
if (!this->networkConf.isOnline()) //no link, ethernet\wifi
tempFlag = false;
return ((flag) && (tempFlag));
if (!isConnectedToNetwork()) //no link, ethernet\wifi
tempFlag = false;
return ((flag) && (tempFlag));
}
/**
* @brief jceSSLClient::sendData - given string, send it to server
@ -111,15 +124,16 @@ bool jceSSLClient::isConnected()
*/
bool jceSSLClient::sendData(QString str)
{
bool sendDataFlag = false;
if (isConnected()) //if connected
bool sendDataFlag = false;
if (isConnected()) //if connected
{
write(str.toStdString().c_str(),str.length());
if (waitForBytesWritten())
sendDataFlag = true;
write(str.toStdString().c_str(),str.length());
if (waitForBytesWritten())
sendDataFlag = true;
}
qDebug() << Q_FUNC_INFO << "Sending Data status is: " << sendDataFlag;
return sendDataFlag;
qDebug() << Q_FUNC_INFO << "Sending Data status is: " << sendDataFlag;
return sendDataFlag;
}
/**
* @brief jceSSLClient::recieveData
@ -129,39 +143,39 @@ bool jceSSLClient::sendData(QString str)
*/
bool jceSSLClient::recieveData(QString &str, bool fast)
{
qDebug() << Q_FUNC_INFO << "Data receiving!";
packet = "";
bool sflag = false;
qDebug() << Q_FUNC_INFO << "Data receiving!";
packet = "";
bool sflag = false;
if (fast) //fast mode connection, good only for login step!!!!
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()));
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
else
{
qDebug() << "jceSSLClient::recieveData normal receiving";
QString p;
while (waitForReadyRead(milisTimeOut))
qDebug() << "jceSSLClient::recieveData normal receiving";
QString p;
while (waitForReadyRead(milisTimeOut))
{
do
do
{
p = readAll();
packet.append(p);
p = readAll();
packet.append(p);
}while (p.size() > 0);
}
}
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;
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;
}
/**
@ -169,29 +183,29 @@ bool jceSSLClient::recieveData(QString &str, bool fast)
*/
void jceSSLClient::readIt()
{
QString p;
do
QString p;
do
{
p = readAll();
packet.append(p);
p = readAll();
packet.append(p);
}while (p.size() > 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();
}
}
@ -200,19 +214,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();
flag = false;
if (reConnection)
makeConnect();
}
@ -221,14 +235,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(10000);
setSocketOption(QAbstractSocket::KeepAliveOption,true);
flag = 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";
flag = false;
}
}
@ -239,116 +253,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 (networkConf.isOnline()) //we can reconnect
errorString = QObject::tr("RemoteHostClosedError");
//The remote host closed the connection
if (isConnectedToNetwork()) //we can reconnect
{
reConnection = true;
reConnection = 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;
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;
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;
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 (networkConf.isOnline()) //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();
}
}
/**
@ -357,14 +371,46 @@ void jceSSLClient::showIfErrorMsg()
*/
void jceSSLClient::checkErrors(QAbstractSocket::SocketError a)
{
//ignore this stupid error
if (!((isConnected()) && (a == QAbstractSocket::SocketError::SocketTimeoutError)))
//ignore this stupid error
bool timeout = (a == QAbstractSocket::SocketError::SocketTimeoutError);
if (!((isConnected()) && (timeout)))
{
qWarning() << Q_FUNC_INFO << "isOnline?: " << this->networkConf.isOnline();
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();
}
showIfErrorMsg();
else
{
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();
}
showIfErrorMsg();
}
/** written by KARAN BALKAR
* @brief jceSSLClient::isConnectedToNetwork
* @return
*/
bool jceSSLClient::isConnectedToNetwork(){
QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces();
bool result = false;
for (int i = 0; i < ifaces.count(); ++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;
}
return result;
}

View file

@ -7,6 +7,7 @@
#include <QEventLoop>
#include <QMessageBox>
#include <QNetworkConfigurationManager>
#include <QtNetwork/QNetworkInterface>
#define milisTimeOut 4000
@ -37,6 +38,7 @@ private slots:
void setOnlineState(bool isOnline);
private:
bool isConnectedToNetwork(); //checking if online
bool flag;
QString packet;
QEventLoop loop; //handle the connection as thread