author | Marco Bresciani |
Fri, 16 Sep 2011 14:55:48 +0200 | |
changeset 5929 | c13b88b52489 |
parent 5780 | 528dd4a14861 |
permissions | -rw-r--r-- |
5755
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
1 |
#ifndef DATABROWSER_H |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
2 |
#define DATABROWSER_H |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
3 |
|
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
4 |
#include <QTextBrowser> |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
5 |
#include <QSet> |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
6 |
|
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
7 |
class QNetworkAccessManager; |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
8 |
|
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
9 |
class DataBrowser : public QTextBrowser |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
10 |
{ |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
11 |
Q_OBJECT |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
12 |
public: |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
13 |
explicit DataBrowser(QWidget *parent = 0); |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
14 |
|
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
15 |
signals: |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
16 |
|
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
17 |
public slots: |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
18 |
|
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
19 |
private: |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
20 |
QNetworkAccessManager *manager; |
5780 | 21 |
|
22 |
// hash and set of QString instead of QUrl to support Qt versions |
|
23 |
// older than 4.7 (those have no support for qHash(const QUrl &)) |
|
24 |
QHash<QString, QByteArray> resources; |
|
25 |
QSet<QString> requestedResources; |
|
5755
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
26 |
|
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
27 |
QVariant loadResource(int type, const QUrl & name); |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
28 |
|
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
29 |
private slots: |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
30 |
void resourceDownloaded(); |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
31 |
}; |
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
32 |
|
a079b4dea081
Implement DataBrowser which downloads resources (images, css) on its own.
unc0rr
parents:
diff
changeset
|
33 |
#endif // DATABROWSER_H |