Moved library version info out of about.html and into a QLabel beneath Hedgehog.png on about page.
authordag10 <gottlieb.drew@gmail.com>
Sat, 19 Jan 2013 14:11:06 -0500
changeset 8404 f06227b2ea14
parent 8402 659e043da6da
child 8405 becac012d502
Moved library version info out of about.html and into a QLabel beneath Hedgehog.png on about page.
QTfrontend/res/html/about.html
QTfrontend/ui/widget/about.cpp
--- a/QTfrontend/res/html/about.html	Sat Jan 19 00:55:51 2013 +0400
+++ b/QTfrontend/res/html/about.html	Sat Jan 19 14:11:06 2013 -0500
@@ -90,13 +90,5 @@
         Natasha Korotaeva &lt;<a href="mailto:layout@pisem.net">layout@pisem.net</a>&gt;<br>
         Adam Higerd (aka ahigerd at FreeNode)
         </p>
-
-        <h2>What we use:</h2><p>
-            %COMPILER_A_OPEN%Compiler%COMPILER_A_CLOSE%: %COMPILER%<br>
-            <a href="http://www.libsdl.org/">SDL</a>: %SDL%<br>
-            <a href="http://qt-project.org/">Qt</a> version: %QT%<br>
-            <a href="http://icculus.org/physfs/">PhysicsFS</a> %PHYSFS%<br>
-            %LIBAV%
-        </p>
 </body>
 </html>
--- a/QTfrontend/ui/widget/about.cpp	Sat Jan 19 00:55:51 2013 +0400
+++ b/QTfrontend/ui/widget/about.cpp	Sat Jan 19 14:11:06 2013 -0500
@@ -46,6 +46,9 @@
 {
     QGridLayout *mainLayout = new QGridLayout(this);
 
+    QVBoxLayout * leftLayout = new QVBoxLayout();
+    mainLayout->addLayout(leftLayout, 0, 0, 2, 1);
+
     QLabel *imageLabel = new QLabel;
     QImage image(":/res/Hedgehog.png");
     imageLabel->setPixmap(QPixmap::fromImage(image));
@@ -55,7 +58,7 @@
     imageLabel->setMinimumHeight(30);
     imageLabel->setMaximumHeight(300);
 
-    mainLayout->addWidget(imageLabel, 0, 0, 2, 1);
+    leftLayout->addWidget(imageLabel, 0, Qt::AlignHCenter);
 
     QLabel *lbl1 = new QLabel(this);
     lbl1->setOpenExternalLinks(true);
@@ -66,63 +69,55 @@
         "</style>"
         "<div align=\"center\"><h1>Hedgewars</h1>"
         "<h3>" + QLabel::tr("Version") + " " + *cVersionString + "</h3>"
-        "<p><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p><br>" +
+        "<p><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p>" +
         QLabel::tr("This program is distributed under the GNU General Public License v2") +
         "</div>"
     );
     lbl1->setWordWrap(true);
     mainLayout->addWidget(lbl1, 0, 1);
 
-    QString html;
-    QFile file(":/res/html/about.html");
-    if(!file.open(QIODevice::ReadOnly))
-        QMessageBox::information(0, "Error loading about page", file.errorString());
-
-    QTextStream in(&file);
+    lbl2 = new QTextBrowser(this);
+    lbl2->setOpenExternalLinks(true);
+    QUrl localpage = QUrl::fromLocalFile(":/res/html/about.html"); 
+    lbl2->setSource(localpage); //sets the source of the label from the file above
+    mainLayout->addWidget(lbl2, 1, 1);
 
-    while(!in.atEnd())
-        html.append(in.readLine());
-
-    file.close();
-
-    /* Get information */
+    /* Library information */
 
-    QString compilerText, compilerOpen, compilerClose;
-    #ifdef __GNUC__
-        compilerText = "GCC " + QString(__VERSION__) + "\n";
-        compilerOpen = "<a href=\"http://gcc.gnu.org\">";
-        compilerClose = "</a>";
-    #else
-        compilerText = "Unknown\n";
-        compilerOpen = compilerClose = "";
-    #endif
+    QString libinfo = "<style type=text/css>a:link { color: #FFFF6E; }</style>";
 
-    /* Add information */
+#ifdef __GNUC__
+    libinfo.append(QString("Compiler: <a href=\"http://gcc.gnu.org\">GCC</a> %1<br>").arg(__VERSION__));
+#else
+    libinfo.append(QString("Compiler: Unknown<br>").arg(__VERSION__));
+#endif
 
-    html.replace("%COMPILER_A_OPEN%", compilerOpen);
-    html.replace("%COMPILER_A_CLOSE%", compilerClose);
-    html.replace("%COMPILER%", compilerText);
-    html.replace("%SDL%", QString("version: %1.%2.%3")
+    libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL</a> version: %1.%2.%3<br>")
         .arg(SDL_MAJOR_VERSION)
         .arg(SDL_MINOR_VERSION)
         .arg(SDL_PATCHLEVEL));
-    html.replace("%QT%", QT_VERSION_STR);
+
+    libinfo.append(QString("<a href=\"http://qt-project.org/\">Qt</a> version: %1<br>").arg(QT_VERSION_STR));
+
 #ifdef VIDEOREC
-    html.replace("%LIBAV%", QString("<a href=\"http://libav.org\">Libav</a> version: %1.%2.%3")
+    libinfo.append(QString("<a href=\"http://libav.org\">Libav</a> version: %1.%2.%3<br>")
         .arg(LIBAVUTIL_VERSION_MAJOR)
         .arg(LIBAVUTIL_VERSION_MINOR)
         .arg(LIBAVUTIL_VERSION_MICRO));
 #endif
-    html.replace("%PHYSFS%", QString("version: %1.%2.%3")
+
+    libinfo.append(QString("<a href=\"http://icculus.org/physfs/\">PhysFS</a> version: %1.%2.%3<br>")
         .arg(PHYSFS_VER_MAJOR)
         .arg(PHYSFS_VER_MINOR)
         .arg(PHYSFS_VER_PATCH));
 
-    lbl2 = new QTextBrowser(this);
-    lbl2->setOpenExternalLinks(true);
-    lbl2->setHtml(html);
-    mainLayout->addWidget(lbl2, 1, 1);
-    
+    QLabel * lblLibInfo = new QLabel();
+    lblLibInfo->setText(libinfo);
+    lblLibInfo->setWordWrap(true);
+    lblLibInfo->setMaximumWidth(280);
+    leftLayout->addWidget(lblLibInfo, 0, Qt::AlignTop | Qt::AlignHCenter);
+    leftLayout->addStretch(1);
+
     setAcceptDrops(true);
 }