using qt lists, fixed documentation

This commit is contained in:
liranbg 2014-10-10 18:50:07 +03:00
parent 01f49ddfc7
commit 65c23138e5
4 changed files with 34 additions and 38 deletions

View file

@ -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()
{

View file

@ -6,10 +6,12 @@
*/
void CalendarPage::setPage(QString html)
{
if (courses == NULL)
courses = new QList<calendarCourse*>();
else
courses->clear();
courses = new std::list<calendarCourse*>();
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;
}

View file

@ -3,7 +3,7 @@
#include "../../page.h"
#include "calendarPageCourse.h"
#include <list>
#include <QList>
#define ROOM_DEFAULT_STRING "nullRoom"
#define LECTURER_DEFAULT_STRING "nullLecturer"
@ -12,7 +12,7 @@ class CalendarPage : public Page
{
public:
std::list<calendarCourse*>* getCourses() { return courses; }
QList<calendarCourse*> *getCourses() { return courses; }
protected:
@ -27,7 +27,7 @@ private:
calendarCourse * lineToCourse(QString line);
QString tempHtml;
std::list<calendarCourse*>* courses;
QList<calendarCourse*> *courses;
};

View file

@ -138,14 +138,6 @@ void calendarCourse::setRoom(const QString &value)
{
room = value;
}
double calendarCourse::getPoints() const
{
return points;