blob: 053f29978f61be7f899b25b1322cb8a458bc58de (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#ifndef PODBOAT_DOWNLOAD_H_
#define PODBOAT_DOWNLOAD_H_
#include <string>
namespace podboat {
enum class DlStatus {
QUEUED = 0,
DOWNLOADING,
CANCELLED,
DELETED,
FINISHED,
FAILED,
ALREADY_DOWNLOADED,
READY,
PLAYED
};
class PbController;
class Download {
public:
explicit Download(PbController* c = 0);
~Download();
double percents_finished() const;
const std::string status_text() const;
DlStatus status() const
{
return download_status;
}
const std::string filename() const;
const std::string basename() const;
const std::string url() const;
void set_filename(const std::string& str);
void set_url(const std::string& url);
void set_progress(double downloaded, double total);
void set_status(DlStatus dls);
void set_kbps(double kbps);
double kbps() const;
void set_offset(unsigned long offset);
double current_size() const
{
return cursize + offs;
}
double total_size() const
{
return totalsize + offs;
}
private:
std::string fn;
std::string url_;
DlStatus download_status;
float cursize;
float totalsize;
double curkbps;
unsigned long offs;
PbController* ctrl;
};
} // namespace podboat
#endif /* PODBOAT_DOWNLOAD_H_ */
|