forked from jonathan46000/crude-wget-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdownloadlist.cpp
46 lines (33 loc) · 837 Bytes
/
downloadlist.cpp
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
#include "downloadlist.h"
#include <QTextStream>
void DownloadList::exportList(QFile *dest) {
dest->open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream out(dest);
QStringList::iterator i;
for(i = this->list.begin(); i != this->list.end(); ++i) {
out << *i + "\n";
}
dest->close();
}
void DownloadList::importList(QFile *src) {
src->open(QIODevice::ReadOnly | QIODevice::Text);
QTextStream in(src);
while(!in.atEnd()) {
this->append(in.readLine());
}
src->close();
}
void DownloadList::append(QString s) {
list.append(s);
this->setStringList(list);
}
int DownloadList::length() {
return list.length();
}
QString DownloadList::at(int idx) {
return list.at(idx);
}
void DownloadList::clear() {
list.clear();
this->setStringList(list);
}