16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 */ |
17 */ |
18 |
18 |
19 #include <QGridLayout> |
19 #include <QGridLayout> |
20 #include <QPushButton> |
20 #include <QPushButton> |
|
21 #include <QNetworkAccessManager> |
|
22 #include <QNetworkRequest> |
|
23 #include <QFileInfo> |
|
24 #include <QFileDialog> |
21 |
25 |
22 #include "pagedata.h" |
26 #include "pagedata.h" |
23 |
27 |
24 PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent) |
28 PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent) |
25 { |
29 { |
29 pageLayout->setColumnStretch(2, 1); |
33 pageLayout->setColumnStretch(2, 1); |
30 |
34 |
31 BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
35 BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
32 |
36 |
33 web = new QWebView(this); |
37 web = new QWebView(this); |
34 web->load(QUrl("http://m8y.org/hw/")); |
38 connect(this, SIGNAL(linkClicked(const QUrl&)), this, SLOT(install(const QUrl&))); |
|
39 web->load(QUrl("http://m8y.org/hw/downloads/")); |
|
40 web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); |
35 pageLayout->addWidget(web, 0, 0, 1, 3); |
41 pageLayout->addWidget(web, 0, 0, 1, 3); |
36 } |
42 } |
|
43 |
|
44 void PageDataDownload::install(const QUrl &url) |
|
45 { |
|
46 qWarning("Download Request"); |
|
47 QString fileName = QFileInfo(url.toString()).fileName(); |
|
48 |
|
49 QNetworkRequest newRequest(url); |
|
50 newRequest.setAttribute(QNetworkRequest::User, fileName); |
|
51 |
|
52 QNetworkAccessManager *manager = new QNetworkAccessManager(this); |
|
53 QNetworkReply *reply = manager->get(newRequest); |
|
54 //connect( reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)) ); |
|
55 //connect( reply, SIGNAL(finished()), this, SLOT(downloadIssueFinished())); |
|
56 } |