konaclient-qt/konasearch.h
2014-10-18 18:42:15 +02:00

55 lines
1.1 KiB
C++
Executable File

#ifndef KONASEARCH_H
#define KONASEARCH_H
#include <QObject>
#include <QHttp>
#include <QFile>
#include <QUrl>
#include "konaclient.h"
#include "konaimage.h"
class KonaSearch : public QObject
{
Q_OBJECT
public:
KonaSearch(KonaClient *Kc, QString Tags = "", int Page=1, int Limit = 50);
~KonaSearch();
QString getTags() {return tags;}
int getPage() {return page;}
int getLimit() {return limit;}
void searchAgain();
QList<KonaImage*> getImages() {return result;}
bool isDone() {return searchIsDone;}
void newSearch(QString Tags = "", int Page=1, int Limit = 50);
int getTotalImages() {return totalImages;}
int getOffset() {return offset;}
private:
KonaClient *kc;
QString tags;
int page;
int limit;
QHttp *http;
QFile *file;
int statusCode;
int searchIsDone;
QList<KonaImage*> result;
int totalImages;
int offset;
signals:
void searchFinished(KonaSearch *ks);
void searchFailed(KonaSearch *ks, int errorCode);
public slots:
void requestFinished();
void responseHeaderReceived(QHttpResponseHeader resp);
};
#endif // KONASEARCH_H