Client OPDS per Calibre Web (Sailfish OS): core C++ testato, UI Silica, packaging RPM
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#ifndef DOWNLOADER_H
|
||||
#define DOWNLOADER_H
|
||||
|
||||
#include <QHash>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QObject>
|
||||
|
||||
class QFile;
|
||||
class QNetworkReply;
|
||||
class Settings;
|
||||
|
||||
// Download di file (libri) con segnali di progresso.
|
||||
// Supporta più download concorrenti.
|
||||
class Downloader : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Downloader(Settings *settings, QObject *parent = 0);
|
||||
|
||||
Q_INVOKABLE void download(const QString &url, const QString &destPath);
|
||||
|
||||
signals:
|
||||
void progress(qint64 received, qint64 total, const QString &path);
|
||||
void finished(const QString &path, bool ok, const QString &error);
|
||||
|
||||
private:
|
||||
Settings *m_settings;
|
||||
QNetworkAccessManager m_nam;
|
||||
QHash<QNetworkReply *, QFile *> m_files;
|
||||
QHash<QNetworkReply *, QString> m_paths;
|
||||
};
|
||||
|
||||
#endif // DOWNLOADER_H
|
||||
Reference in New Issue
Block a user