diff --git a/src/jceConnection/jcesslclient.cpp b/src/jceConnection/jcesslclient.cpp index b740b42..ac97523 100644 --- a/src/jceConnection/jcesslclient.cpp +++ b/src/jceConnection/jcesslclient.cpp @@ -145,22 +145,20 @@ bool jceSSLClient::sendData(QString str) 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 + * @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) { qDebug() << Q_FUNC_INFO << "Data receiving!"; - bool sflag = false; //success on recieving flag str->clear(); packet = ""; recieveLastPacket = false; packetSizeRecieved = 0; //counting packet size readingFlag = true; //to ignore timeout socket error - timer.setSingleShot(true); + 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 @@ -172,18 +170,21 @@ bool jceSSLClient::recieveData(QString *str) disconnect(this, SIGNAL(readyRead()), this, SLOT(readIt())); str->append(packet); - qDebug() << *str; + //qDebug() << *str; //if you want to see the whole packet, unmark me qDebug() << Q_FUNC_INFO << "packet size: " << packetSizeRecieved << "received data lenght: " << str->length(); - if (str->length() > 0) - sflag = true; - qDebug() << Q_FUNC_INFO << "return with flag: " << sflag; - readingFlag = false; - return sflag; + 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() { diff --git a/src/jceData/Calendar/coursesSchedule/calendarPage.cpp b/src/jceData/Calendar/coursesSchedule/calendarPage.cpp index 24bcccb..245912e 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarPage.cpp +++ b/src/jceData/Calendar/coursesSchedule/calendarPage.cpp @@ -6,10 +6,12 @@ */ void CalendarPage::setPage(QString html) { + if (courses == NULL) + courses = new QList(); + else + courses->clear(); - courses = new std::list(); tempHtml = getString(html); - qDebug() << "starting .."; calendarListInit(tempHtml); } @@ -26,6 +28,7 @@ void CalendarPage::calendarListInit(QString &linesTokinzedString) for (iterator = holder.begin(); iterator != holder.end(); ++iterator) { tempToken = (*iterator); + if (!tempToken.isEmpty()) { calendarCourse *cTemp = lineToCourse(tempToken); @@ -55,14 +58,14 @@ calendarCourse *CalendarPage::lineToCourse(QString line) QStringList::iterator iterator; for (iterator = holder.begin(); iterator != holder.end(); ++iterator) { - tempToken = (*iterator); + if (i >= 1) //skips on semester character { - templinearray[i] = tempToken.trimmed(); + templinearray[i-1] = tempToken.trimmed(); } i++; - if (i >= CALENDAR_COURSE_FIELDS) + if (i > CALENDAR_COURSE_FIELDS) break; } @@ -98,16 +101,16 @@ calendarCourse *CalendarPage::lineToCourse(QString line) 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() << "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(); +// qDebug() << tempC->getDay(); +// qDebug() << tempC->getRoom(); return tempC; } diff --git a/src/jceData/Calendar/coursesSchedule/calendarPage.h b/src/jceData/Calendar/coursesSchedule/calendarPage.h index b4b9077..65d5b0d 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarPage.h +++ b/src/jceData/Calendar/coursesSchedule/calendarPage.h @@ -3,7 +3,7 @@ #include "../../page.h" #include "calendarPageCourse.h" -#include +#include #define ROOM_DEFAULT_STRING "nullRoom" #define LECTURER_DEFAULT_STRING "nullLecturer" @@ -12,7 +12,7 @@ class CalendarPage : public Page { public: - std::list* getCourses() { return courses; } + QList *getCourses() { return courses; } protected: @@ -27,7 +27,7 @@ private: calendarCourse * lineToCourse(QString line); QString tempHtml; - std::list* courses; + QList *courses; }; diff --git a/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp b/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp index a97fbe0..50735ad 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp +++ b/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp @@ -138,14 +138,6 @@ void calendarCourse::setRoom(const QString &value) { room = value; } - - - - - - - - double calendarCourse::getPoints() const { return points;