author | nemo |
Wed, 31 Aug 2011 08:45:22 -0400 | |
changeset 5715 | 59a8dd33f274 |
parent 5582 | 48ced03a9949 |
child 5746 | fbc52bb92cad |
permissions | -rw-r--r-- |
5271 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
3 |
* Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#include <QGridLayout> |
|
20 |
#include <QPushButton> |
|
5567
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
21 |
#include <QNetworkAccessManager> |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
22 |
#include <QNetworkRequest> |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
23 |
#include <QFileInfo> |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
24 |
#include <QFileDialog> |
5271 | 25 |
|
26 |
#include "pagedata.h" |
|
27 |
||
28 |
PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent) |
|
29 |
{ |
|
30 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
31 |
pageLayout->setColumnStretch(0, 1); |
|
32 |
pageLayout->setColumnStretch(1, 1); |
|
33 |
pageLayout->setColumnStretch(2, 1); |
|
34 |
||
35 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
|
36 |
||
37 |
web = new QWebView(this); |
|
5582
48ced03a9949
Properly implement slot, connect signal from the object which actually sends it to the slot
unc0rr
parents:
5567
diff
changeset
|
38 |
connect(web, SIGNAL(linkClicked(const QUrl&)), this, SLOT(install(const QUrl&))); |
5567
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
39 |
web->load(QUrl("http://m8y.org/hw/downloads/")); |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
40 |
web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); |
5271 | 41 |
pageLayout->addWidget(web, 0, 0, 1, 3); |
42 |
} |
|
5567
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
43 |
|
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
44 |
void PageDataDownload::install(const QUrl &url) |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
45 |
{ |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
46 |
qWarning("Download Request"); |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
47 |
QString fileName = QFileInfo(url.toString()).fileName(); |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
48 |
|
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
49 |
QNetworkRequest newRequest(url); |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
50 |
newRequest.setAttribute(QNetworkRequest::User, fileName); |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
51 |
|
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
52 |
QNetworkAccessManager *manager = new QNetworkAccessManager(this); |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
53 |
QNetworkReply *reply = manager->get(newRequest); |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
54 |
//connect( reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)) ); |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
55 |
//connect( reply, SIGNAL(finished()), this, SLOT(downloadIssueFinished())); |
44c9a577b082
Tiny bit of progress on download page - hooked it up to "Info" button for now.
nemo
parents:
5271
diff
changeset
|
56 |
} |