Add home button to DLC page
authorWuzzy <almikes@aol.com>
Wed, 12 Apr 2017 19:35:44 +0200
changeset 12234 2e725778e107
parent 12233 05fb32410350
child 12235 0844c680b4bc
Add home button to DLC page
QTfrontend/hedgewars.qrc
QTfrontend/res/home.png
QTfrontend/res/home.svg
QTfrontend/ui/page/pagedata.cpp
QTfrontend/ui/page/pagedata.h
--- a/QTfrontend/hedgewars.qrc	Wed Apr 12 00:23:10 2017 +0200
+++ b/QTfrontend/hedgewars.qrc	Wed Apr 12 19:35:44 2017 +0200
@@ -149,6 +149,7 @@
         <file>res/iconScript.png</file>
         <file>res/dice.png</file>
         <file>res/Star.png</file>
+        <file>res/home.png</file>
         <file>res/inverse-corner-bl.png</file>
         <file>res/Flake.png</file>
         <file>res/Egg.png</file>
Binary file QTfrontend/res/home.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/res/home.svg	Wed Apr 12 19:35:44 2017 +0200
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="svg2"
+   xml:space="preserve"
+   overflow="visible"
+   inkscape:export-ydpi="93.75"
+   viewBox="0 0 48 48"
+   inkscape:export-xdpi="93.75"
+   version="1.0"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:docname="home.svg"
+   inkscape:export-filename="/home/wuzzy/src/hedgewars/hg2/QTfrontend/res/home.png"
+   inkscape:version="0.92.1 r"
+   sodipodi:version="0.32"
+   enable-background="new 0 0 128 129.396"
+   width="51.200001"
+   height="51.200001"
+   style="overflow:visible"><defs
+     id="defs365"><linearGradient
+       id="XMLID_39_"
+       y2="35.569"
+       gradientUnits="userSpaceOnUse"
+       x2="64.388"
+       gradientTransform="matrix(0.3541,0,0,0.3541,1.6387,-0.083649)"
+       y1="65.124001"
+       x1="64.388"><stop
+         id="stop336"
+         style="stop-color:#FFFFFF"
+         offset="0" /><stop
+         id="stop338"
+         style="stop-color:#FF6200"
+         offset=".8539" /><stop
+         id="stop340"
+         style="stop-color:#F25D00"
+         offset="1" /><midPointStop
+         id="midPointStop335"
+         style="stop-color:#FFFFFF"
+         offset="0" /><midPointStop
+         id="midPointStop337"
+         style="stop-color:#FFFFFF"
+         offset="0.5" /><midPointStop
+         id="midPointStop339"
+         style="stop-color:#FF6200"
+         offset="0.8539" /><midPointStop
+         id="midPointStop341"
+         style="stop-color:#FF6200"
+         offset="0.5" /><midPointStop
+         id="midPointStop343"
+         style="stop-color:#F25D00"
+         offset="1" /></linearGradient><radialGradient
+       id="radialGradient2325"
+       gradientUnits="userSpaceOnUse"
+       cy="37.425999"
+       cx="20.444"
+       gradientTransform="matrix(1.1253,0,0,0.98274,-3.4287,0.73111)"
+       r="1.0821"
+       inkscape:collect="always"><stop
+         id="stop2321"
+         style="stop-color:#000000"
+         offset="0" /><stop
+         id="stop2323"
+         style="stop-color:#000000;stop-opacity:0"
+         offset="1" /></radialGradient></defs><sodipodi:namedview
+     id="base"
+     bordercolor="#666666"
+     inkscape:pageshadow="2"
+     inkscape:window-y="31"
+     pagecolor="#ffffff"
+     inkscape:showpageshadow="false"
+     inkscape:zoom="5.3063965"
+     inkscape:window-x="0"
+     stroke="#a40000"
+     borderopacity="0.21568627"
+     inkscape:current-layer="svg2"
+     inkscape:cx="15.947549"
+     inkscape:cy="61.117875"
+     inkscape:guide-bbox="true"
+     inkscape:window-width="1920"
+     showgrid="false"
+     inkscape:pageopacity="0.0"
+     inkscape:window-height="1024"
+     showguides="true"
+     fill="#555753"
+     inkscape:window-maximized="1" /><g
+     id="g7069"
+     transform="matrix(0.93589527,0,0,0.93589527,1.8266136,2.3833932)"><path
+       inkscape:connector-curvature="0"
+       d="m 21.62,8.1834 h 5.957 c 0.84,0 13.887,15.436 13.887,16.341 l -0.444,18.497 c 0,0.905 -0.676,1.634 -1.516,1.634 H 8.047 c -0.8398,0 -1.5158,-0.729 -1.5158,-1.634 l 0.0565,-18.497 c 0,-0.905 14.192,-16.341 15.032,-16.341 z"
+       style="color:#000000;fill:#ff81f7;fill-opacity:1;stroke:#000000;stroke-width:1.50659478;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       sodipodi:nodetypes="ccccccccc"
+       id="rect1512" /><path
+       inkscape:connector-curvature="0"
+       d="M 46.964,45.736 H 1.639 l -3e-4,-45.325 45.325,-3.2e-4 v 45.325 z"
+       style="fill:none"
+       id="path5" /><path
+       inkscape:connector-curvature="0"
+       d="m 21.809212,9.4056 h 5.482047 c 0.772022,0 12.817736,14.399 12.817736,15.244 l -0.342135,18.212 c 0,0.459 -0.140995,0.654 -0.504821,0.654 l -30.9469468,0.014 c -0.3637279,0 -0.576108,-0.08 -0.576108,-0.454 l 0.2123801,-18.426 c 0,-0.845 13.0859227,-15.244 13.8579457,-15.244 z"
+       style="color:#000000;opacity:0.31100003;fill:none;stroke:#ffffff;stroke-width:0.99296516"
+       sodipodi:nodetypes="ccccccccc"
+       id="path2357" /><path
+       inkscape:connector-curvature="0"
+       d="m 7.2075,27.943 -0.0542,2.595 18.368,-13.179 15.287,11.154 0.071,-0.311 -16.37,-15.904 z"
+       style="clip-rule:evenodd;opacity:0.2;fill:#575757;fill-opacity:0.47952444;fill-rule:evenodd"
+       sodipodi:nodetypes="cccccccc"
+       id="path23" /><path
+       inkscape:connector-curvature="0"
+       d="m 19.577,36.448 c 0.673,0 1.216,0.474 1.216,1.058 0,0.59 -0.543,1.069 -1.216,1.069 -0.672,0 -1.219,-0.479 -1.219,-1.069 0.001,-0.584 0.547,-1.058 1.219,-1.058 z"
+       style="clip-rule:evenodd;opacity:0.40909005;fill:url(#radialGradient2325);fill-rule:evenodd"
+       id="path2315" /><rect
+       style="opacity:1;fill:#e6ba64;fill-opacity:1;fill-rule:nonzero;stroke:#000003;stroke-width:1.27166378;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+       id="rect7073"
+       width="11.291932"
+       height="14.464803"
+       x="11.353704"
+       y="30.095888" /><path
+       inkscape:connector-curvature="0"
+       d="m 19.462,35.932 c 0.673,0 1.217,0.475 1.217,1.059 0,0.59 -0.544,1.068 -1.217,1.068 -0.672,0 -1.218,-0.478 -1.218,-1.068 0,-0.584 0.546,-1.059 1.218,-1.059 z"
+       style="clip-rule:evenodd;fill:#d0af33;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.34406248;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path217" /><path
+       inkscape:connector-curvature="0"
+       d="m 24.448,11.559 18.927,17.17 0.494,0.392 L 44.273,28.95 43.9,28.188 43.623,27.965 24.448,12.392 5.058,28.136 4.8206,28.28 4.6039,28.987 5.0373,29.116 5.4219,28.807 24.4479,11.559 Z"
+       style="fill:url(#XMLID_39_)"
+       sodipodi:nodetypes="ccccccccccccc"
+       id="path342" /><path
+       inkscape:connector-curvature="0"
+       d="m 24.33,2.2713 -21.882,18.102 -0.6243,7.166 1.9999,2.064 c 0,0 20.407,-17.157 20.624,-17.328 l 19.632,17.543 1.899,-2.324 -1.616,-7.111 -19.915,-18.216 -0.118,0.1043 z"
+       style="fill:#5195e9;fill-opacity:1;stroke:#170000;stroke-width:1.50659478;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       sodipodi:nodetypes="cccccccccc"
+       id="path362" /><path
+       inkscape:connector-curvature="0"
+       d="M 3.2473101,20.732415 2.5498,27.236 24.3688,8.98 24.406273,3.2299977 Z"
+       style="color:#000000;opacity:0.40909005;fill:#ffffff;fill-opacity:1"
+       sodipodi:nodetypes="cccccc"
+       id="path1536" /><path
+       inkscape:connector-curvature="0"
+       d="M 24.484,8.751 24.406273,3.2299977 43.840351,20.585783 45.404,27.325612 24.484,8.7509 Z"
+       style="color:#000000;opacity:0.13636002;fill:#000000;fill-opacity:1"
+       sodipodi:nodetypes="cccccc"
+       id="path2337" /><path
+       inkscape:connector-curvature="0"
+       d="m 26.946683,27.490623 h 9.210885 c 0.785575,0 1.417294,0.63172 1.417294,1.417294 l -0.0081,9.250622 c 0,0.785574 -0.607267,1.289931 -1.39284,1.289931 h -9.227188 c -0.784555,0 -1.417294,-0.63172 -1.417294,-1.417294 v -9.123259 c 0,-0.785574 0.632739,-1.417294 1.417294,-1.417294 z"
+       style="color:#000000;opacity:0.3181801;fill:none;stroke:#ffffff;stroke-width:1.01888192;stroke-miterlimit:4;stroke-dasharray:none"
+       sodipodi:nodetypes="ccccccccc"
+       id="rect2361" /><rect
+       x="26.507999"
+       y="28.514"
+       width="10.001"
+       height="9.9624996"
+       ry="0.38128"
+       rx="0.38128"
+       style="color:#000000;fill:#ffffff;fill-opacity:0.96169093;stroke:#050505;stroke-width:1.30382288;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect3263" /><rect
+       x="26.507999"
+       y="28.514"
+       width="1.9008306"
+       height="10.140061"
+       ry="0.19481476"
+       rx="0.19481476"
+       style="color:#000000;overflow:visible;fill:#000000;fill-opacity:0.10957181;stroke:none;stroke-width:0.66618741;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect3263-0" /><rect
+       x="28.408831"
+       y="28.514"
+       width="7.8143654"
+       height="1.8147584"
+       ry="0.19481476"
+       rx="0.19481476"
+       style="color:#000000;overflow:visible;fill:#000000;fill-opacity:0.10957181;stroke:none;stroke-width:0.66618741;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect3263-0-6" /></g><metadata
+     id="metadata6453"><rdf:RDF><cc:Work><dc:format>image/svg+xml</dc:format><dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><cc:license
+           rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" /><dc:publisher><cc:Agent
+             rdf:about="http://openclipart.org/"><dc:title>Openclipart</dc:title></cc:Agent></dc:publisher><dc:title></dc:title><dc:date>2010-03-10T10:25:42</dc:date><dc:description>Home icon from &lt;A href=&quot;http://tango.freedesktop.org/Tango_Desktop_Project&quot;&gt; Tango Project &lt;/A&gt; \n&lt;BR&gt;&lt;BR&gt;\nSince version 0.8.90 Tango Project icons are Public Domain: &lt;A href=&quot;http://tango.freedesktop.org/Frequently_Asked_Questions#Terms_of_Use.3F&quot;&gt; Tango Project FAQ &lt;/A&gt;</dc:description><dc:source>https://openclipart.org/detail/30805/tango-go-home-by-warszawianka</dc:source><dc:creator><cc:Agent><dc:title>warszawianka</dc:title></cc:Agent></dc:creator><dc:subject><rdf:Bag><rdf:li>architecture</rdf:li><rdf:li>building</rdf:li><rdf:li>externalsource</rdf:li><rdf:li>home</rdf:li><rdf:li>house</rdf:li><rdf:li>icon</rdf:li><rdf:li>tango</rdf:li></rdf:Bag></dc:subject></cc:Work><cc:License
+         rdf:about="http://creativecommons.org/publicdomain/zero/1.0/"><cc:permits
+           rdf:resource="http://creativecommons.org/ns#Reproduction" /><cc:permits
+           rdf:resource="http://creativecommons.org/ns#Distribution" /><cc:permits
+           rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /></cc:License></rdf:RDF></metadata><rect
+     style="opacity:1;fill:#ffffff;fill-opacity:0.34886648;fill-rule:nonzero;stroke:none;stroke-width:1.20093751;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+     id="rect7090"
+     width="9.3733196"
+     height="1.0192808"
+     x="13.039264"
+     y="31.150461" /><rect
+     style="overflow:visible;opacity:1;fill:#ffffff;fill-opacity:0.34886648;fill-rule:nonzero;stroke:none;stroke-width:1.20093751;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+     id="rect7090-9"
+     width="0.92969835"
+     height="11.319164"
+     x="13.039264"
+     y="32.169743" /><rect
+     style="overflow:visible;opacity:1;fill:#000000;fill-opacity:0.11712844;fill-rule:nonzero;stroke:none;stroke-width:1.20093751;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+     id="rect7090-9-3"
+     width="0.64861304"
+     height="11.350396"
+     x="21.763969"
+     y="32.138512" /></svg>
\ No newline at end of file
--- a/QTfrontend/ui/page/pagedata.cpp	Wed Apr 12 00:23:10 2017 +0200
+++ b/QTfrontend/ui/page/pagedata.cpp	Wed Apr 12 19:35:44 2017 +0200
@@ -54,7 +54,12 @@
     QHBoxLayout * bottomLayout = new QHBoxLayout();
     bottomLayout->setStretch(0, 1);
 
-    pbOpenDir = addButton(tr("Open packages directory"), bottomLayout, 1, false, Qt::AlignBottom);
+    pbHome = addButton(":/res/home.png", bottomLayout, 1, true, Qt::AlignBottom);
+    pbHome->setMinimumHeight(50);
+    pbHome->setMinimumWidth(50);
+    pbHome->setWhatsThis(tr("Return to the start page"));
+
+    pbOpenDir = addButton(tr("Open packages directory"), bottomLayout, 2, false, Qt::AlignBottom);
     pbOpenDir->setMinimumHeight(50);
 
     bottomLayout->setStretch(2, 1);
@@ -67,6 +72,7 @@
     connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(request(const QUrl&)));
     connect(this, SIGNAL(goBack()), this, SLOT(onPageLeave()));
     connect(pbOpenDir, SIGNAL(clicked()), this, SLOT(openPackagesDir()));
+    connect(pbHome, SIGNAL(clicked()), this, SLOT(fetchList()));
 }
 
 PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent)
@@ -85,7 +91,12 @@
 void PageDataDownload::request(const QUrl &url)
 {
     QUrl finalUrl;
-    if(url.host().isEmpty())
+    if(url.isEmpty())
+    {
+        qWarning() << "Empty URL requested";
+        return;
+    }
+    else if(url.host().isEmpty())
         finalUrl = QUrl("https://www.hedgewars.org" + url.path());
     else
         finalUrl = url;
@@ -199,7 +210,6 @@
     request(QUrl("https://hedgewars.org/content.html"));
 }
 
-
 void PageDataDownload::onPageLeave()
 {
     if (m_contentDownloaded)
--- a/QTfrontend/ui/page/pagedata.h	Wed Apr 12 00:23:10 2017 +0200
+++ b/QTfrontend/ui/page/pagedata.h	Wed Apr 12 19:35:44 2017 +0200
@@ -48,6 +48,7 @@
         QHash<QNetworkReply*, QProgressBar *> progressBars;
         QVBoxLayout *progressBarsLayout;
         QPushButtonWithSound * pbOpenDir;
+        QPushButtonWithSound * pbHome;
 
         bool m_contentDownloaded; ///< true if something was downloaded since last page leave