using qt lists, fixed documentation
This commit is contained in:
parent
01f49ddfc7
commit
65c23138e5
4 changed files with 34 additions and 38 deletions
|
@ -145,22 +145,20 @@ bool jceSSLClient::sendData(QString str)
|
||||||
return sendDataFlag;
|
return sendDataFlag;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief jceSSLClient::recieveData
|
* @brief jceSSLClient::recieveData - recieving data through threaded reading and mutex
|
||||||
* @param str this variable will store the recieved data
|
* @param str - string to fill with data.
|
||||||
* @param fast true for LOGIN ONLY, false to retrieve all data
|
* @return true if packet has recieced the last packet -> true, otherwise ->false
|
||||||
* @return true if recieved data bigger than zero
|
|
||||||
*/
|
*/
|
||||||
bool jceSSLClient::recieveData(QString *str)
|
bool jceSSLClient::recieveData(QString *str)
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "Data receiving!";
|
qDebug() << Q_FUNC_INFO << "Data receiving!";
|
||||||
bool sflag = false; //success on recieving flag
|
|
||||||
str->clear();
|
str->clear();
|
||||||
packet = "";
|
packet = "";
|
||||||
recieveLastPacket = false;
|
recieveLastPacket = false;
|
||||||
packetSizeRecieved = 0; //counting packet size
|
packetSizeRecieved = 0; //counting packet size
|
||||||
readingFlag = true; //to ignore timeout socket error
|
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
|
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(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()));
|
disconnect(this, SIGNAL(readyRead()), this, SLOT(readIt()));
|
||||||
|
|
||||||
str->append(packet);
|
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();
|
qDebug() << Q_FUNC_INFO << "packet size: " << packetSizeRecieved << "received data lenght: " << str->length();
|
||||||
if (str->length() > 0)
|
qDebug() << Q_FUNC_INFO << "return with flag: " << recieveLastPacket;
|
||||||
sflag = true;
|
|
||||||
qDebug() << Q_FUNC_INFO << "return with flag: " << sflag;
|
readingFlag = false; //finished reading session
|
||||||
readingFlag = false;
|
return recieveLastPacket; //we have the last packet
|
||||||
return sflag;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @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()
|
void jceSSLClient::readIt()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,10 +6,12 @@
|
||||||
*/
|
*/
|
||||||
void CalendarPage::setPage(QString html)
|
void CalendarPage::setPage(QString html)
|
||||||
{
|
{
|
||||||
|
if (courses == NULL)
|
||||||
|
courses = new QList<calendarCourse*>();
|
||||||
|
else
|
||||||
|
courses->clear();
|
||||||
|
|
||||||
courses = new std::list<calendarCourse*>();
|
|
||||||
tempHtml = getString(html);
|
tempHtml = getString(html);
|
||||||
qDebug() << "starting ..";
|
|
||||||
calendarListInit(tempHtml);
|
calendarListInit(tempHtml);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +28,7 @@ void CalendarPage::calendarListInit(QString &linesTokinzedString)
|
||||||
for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
|
for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
|
||||||
{
|
{
|
||||||
tempToken = (*iterator);
|
tempToken = (*iterator);
|
||||||
|
|
||||||
if (!tempToken.isEmpty())
|
if (!tempToken.isEmpty())
|
||||||
{
|
{
|
||||||
calendarCourse *cTemp = lineToCourse(tempToken);
|
calendarCourse *cTemp = lineToCourse(tempToken);
|
||||||
|
@ -55,14 +58,14 @@ calendarCourse *CalendarPage::lineToCourse(QString line)
|
||||||
QStringList::iterator iterator;
|
QStringList::iterator iterator;
|
||||||
for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
|
for (iterator = holder.begin(); iterator != holder.end(); ++iterator)
|
||||||
{
|
{
|
||||||
|
|
||||||
tempToken = (*iterator);
|
tempToken = (*iterator);
|
||||||
|
|
||||||
if (i >= 1) //skips on semester character
|
if (i >= 1) //skips on semester character
|
||||||
{
|
{
|
||||||
templinearray[i] = tempToken.trimmed();
|
templinearray[i-1] = tempToken.trimmed();
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
if (i >= CALENDAR_COURSE_FIELDS)
|
if (i > CALENDAR_COURSE_FIELDS)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,16 +101,16 @@ calendarCourse *CalendarPage::lineToCourse(QString line)
|
||||||
|
|
||||||
|
|
||||||
tempC = new calendarCourse(serial,name,type,lecturer,points,semesterHours,dayAndHour,room);
|
tempC = new calendarCourse(serial,name,type,lecturer,points,semesterHours,dayAndHour,room);
|
||||||
qDebug() << "serial is: " << tempC->getSerialNum();
|
// qDebug() << "serial is: " << tempC->getSerialNum();
|
||||||
qDebug() << tempC->getName();
|
// qDebug() << tempC->getName();
|
||||||
qDebug() << tempC->getType();
|
// qDebug() << tempC->getType();
|
||||||
qDebug() << tempC->getLecturer();
|
// qDebug() << tempC->getLecturer();
|
||||||
qDebug() << tempC->getPoints();
|
// qDebug() << tempC->getPoints();
|
||||||
qDebug() << tempC->getHourBegin() << ":" << tempC->getMinutesBegin();
|
// qDebug() << tempC->getHourBegin() << ":" << tempC->getMinutesBegin();
|
||||||
qDebug() << tempC->getHourEnd() << ":" << tempC->getMinutesEnd();
|
// qDebug() << tempC->getHourEnd() << ":" << tempC->getMinutesEnd();
|
||||||
|
|
||||||
qDebug() << tempC->getDay();
|
// qDebug() << tempC->getDay();
|
||||||
qDebug() << tempC->getRoom();
|
// qDebug() << tempC->getRoom();
|
||||||
|
|
||||||
return tempC;
|
return tempC;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "../../page.h"
|
#include "../../page.h"
|
||||||
#include "calendarPageCourse.h"
|
#include "calendarPageCourse.h"
|
||||||
#include <list>
|
#include <QList>
|
||||||
|
|
||||||
#define ROOM_DEFAULT_STRING "nullRoom"
|
#define ROOM_DEFAULT_STRING "nullRoom"
|
||||||
#define LECTURER_DEFAULT_STRING "nullLecturer"
|
#define LECTURER_DEFAULT_STRING "nullLecturer"
|
||||||
|
@ -12,7 +12,7 @@ class CalendarPage : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
std::list<calendarCourse*>* getCourses() { return courses; }
|
QList<calendarCourse*> *getCourses() { return courses; }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -27,7 +27,7 @@ private:
|
||||||
calendarCourse * lineToCourse(QString line);
|
calendarCourse * lineToCourse(QString line);
|
||||||
|
|
||||||
QString tempHtml;
|
QString tempHtml;
|
||||||
std::list<calendarCourse*>* courses;
|
QList<calendarCourse*> *courses;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -138,14 +138,6 @@ void calendarCourse::setRoom(const QString &value)
|
||||||
{
|
{
|
||||||
room = value;
|
room = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
double calendarCourse::getPoints() const
|
double calendarCourse::getPoints() const
|
||||||
{
|
{
|
||||||
return points;
|
return points;
|
||||||
|
|
Loading…
Reference in a new issue