display a message when network is down or server is not reachable, nemo also made the page refresh at display time
--- a/QTfrontend/hwform.cpp Wed Oct 12 04:14:38 2011 +0200
+++ b/QTfrontend/hwform.cpp Fri Oct 14 19:00:31 2011 +0200
@@ -471,6 +471,10 @@
#ifdef USE_XFIRE
updateXfire();
#endif
+ if (id == ID_PAGE_DATADOWNLOAD)
+ {
+ ui.pageDataDownload->fetchList();
+ }
if (id == ID_PAGE_DRAWMAP) {
DrawMapScene * scene;
if(lastid == ID_PAGE_MULTIPLAYER)
--- a/QTfrontend/pagedata.cpp Wed Oct 12 04:14:38 2011 +0200
+++ b/QTfrontend/pagedata.cpp Fri Oct 14 19:00:31 2011 +0200
@@ -51,7 +51,7 @@
progressBarsLayout = new QVBoxLayout();
pageLayout->addLayout(progressBarsLayout, 1, 0, 1, 3);
- fetchList();
+ web->setHtml("<center><h2>Hedgewars Downloadable Content</h2><br><br><i>Loading, please wait</i></center>");
}
void PageDataDownload::request(const QUrl &url)
@@ -95,7 +95,7 @@
{
QNetworkReply * reply = qobject_cast<QNetworkReply *>(sender());
- if(reply)
+ if(reply && (reply->error() == QNetworkReply::NoError))
{
QString html = QString::fromUtf8(reply->readAll());
int begin = html.indexOf("<!-- BEGIN -->");
@@ -107,6 +107,10 @@
}
web->setHtml(html);
}
+ else
+ {
+ web->setHtml("<center><h2>Hedgewars Downloadable Content</h2><br><br><p><i><h4>This page requires an internet connection.</i></h4></center>");
+ }
}
void PageDataDownload::fileDownloaded()
@@ -146,7 +150,7 @@
void PageDataDownload::fetchList()
{
- request(QUrl("http://hedgewars.org/content.html"));
+ request(QUrl("http://www.hedgewars.org/content.html"));
}
bool PageDataDownload::extractDataPack(QByteArray * buf)