X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=search.h;h=4908ac668d6d153877befa3ddd083805430c9f65;hb=a972500f457b9d2259d3e7f6ea87624bd9a6f7d2;hp=6405ea187c631d744e87b846560b06f5b5c4b495;hpb=8eea7446dbcf2df23b7633db28d6e8e78bb856f3;p=dorian diff --git a/search.h b/search.h index 6405ea1..4908ac6 100644 --- a/search.h +++ b/search.h @@ -16,6 +16,7 @@ class Search: public QObject Q_OBJECT public: + /** Search query. */ struct Query { QString title; @@ -23,6 +24,7 @@ public: QStringList languages; }; + /** Search result. */ struct Result { QString id; @@ -31,6 +33,17 @@ public: QStringList authors; QString language; QImage cover; + bool operator ==(const Result &other) const { + return (source == other.source) && (id == other.id); + } + }; + + /** Download status. */ + enum + { + Ok, + DownloadError, + FileError, }; static Search *instance(); @@ -42,12 +55,13 @@ signals: void endSearch(); void beginDownload(int totalBlocks); void downloading(int blocks); - void endDownload(); + void endDownload(int status, const Search::Result &result, + const QString &fileName); public slots: void start(const Query &query); QList results(); - bool download(const Result &result, const QString &fileName); + void download(const Result &result, const QString &fileName); void finished(); void downloadFinished(); @@ -58,6 +72,8 @@ private: QNetworkReply *reply; QNetworkReply *downloadReply; QList searchResults; + Search::Result downloadResult; + QString downloadFileName; }; #endif // SEARCH_H