equal
deleted
inserted
replaced
52 QLayout * PageDataDownload::footerLayoutDefinition() |
52 QLayout * PageDataDownload::footerLayoutDefinition() |
53 { |
53 { |
54 QHBoxLayout * bottomLayout = new QHBoxLayout(); |
54 QHBoxLayout * bottomLayout = new QHBoxLayout(); |
55 bottomLayout->setStretch(0, 1); |
55 bottomLayout->setStretch(0, 1); |
56 |
56 |
57 pbOpenDir = addButton(tr("Open packages directory"), bottomLayout, 1, false, Qt::AlignBottom); |
57 pbHome = addButton(":/res/home.png", bottomLayout, 1, true, Qt::AlignBottom); |
|
58 pbHome->setMinimumHeight(50); |
|
59 pbHome->setMinimumWidth(50); |
|
60 pbHome->setWhatsThis(tr("Return to the start page")); |
|
61 |
|
62 pbOpenDir = addButton(tr("Open packages directory"), bottomLayout, 2, false, Qt::AlignBottom); |
58 pbOpenDir->setMinimumHeight(50); |
63 pbOpenDir->setMinimumHeight(50); |
59 |
64 |
60 bottomLayout->setStretch(2, 1); |
65 bottomLayout->setStretch(2, 1); |
61 |
66 |
62 return bottomLayout; |
67 return bottomLayout; |
65 void PageDataDownload::connectSignals() |
70 void PageDataDownload::connectSignals() |
66 { |
71 { |
67 connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(request(const QUrl&))); |
72 connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(request(const QUrl&))); |
68 connect(this, SIGNAL(goBack()), this, SLOT(onPageLeave())); |
73 connect(this, SIGNAL(goBack()), this, SLOT(onPageLeave())); |
69 connect(pbOpenDir, SIGNAL(clicked()), this, SLOT(openPackagesDir())); |
74 connect(pbOpenDir, SIGNAL(clicked()), this, SLOT(openPackagesDir())); |
|
75 connect(pbHome, SIGNAL(clicked()), this, SLOT(fetchList())); |
70 } |
76 } |
71 |
77 |
72 PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent) |
78 PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent) |
73 { |
79 { |
74 initPage(); |
80 initPage(); |
83 } |
89 } |
84 |
90 |
85 void PageDataDownload::request(const QUrl &url) |
91 void PageDataDownload::request(const QUrl &url) |
86 { |
92 { |
87 QUrl finalUrl; |
93 QUrl finalUrl; |
88 if(url.host().isEmpty()) |
94 if(url.isEmpty()) |
|
95 { |
|
96 qWarning() << "Empty URL requested"; |
|
97 return; |
|
98 } |
|
99 else if(url.host().isEmpty()) |
89 finalUrl = QUrl("https://www.hedgewars.org" + url.path()); |
100 finalUrl = QUrl("https://www.hedgewars.org" + url.path()); |
90 else |
101 else |
91 finalUrl = url; |
102 finalUrl = url; |
92 |
103 |
93 if(url.path().endsWith(".hwp") || url.path().endsWith(".zip")) |
104 if(url.path().endsWith(".hwp") || url.path().endsWith(".zip")) |
197 void PageDataDownload::fetchList() |
208 void PageDataDownload::fetchList() |
198 { |
209 { |
199 request(QUrl("https://hedgewars.org/content.html")); |
210 request(QUrl("https://hedgewars.org/content.html")); |
200 } |
211 } |
201 |
212 |
202 |
|
203 void PageDataDownload::onPageLeave() |
213 void PageDataDownload::onPageLeave() |
204 { |
214 { |
205 if (m_contentDownloaded) |
215 if (m_contentDownloaded) |
206 { |
216 { |
207 m_contentDownloaded = false; |
217 m_contentDownloaded = false; |