QTfrontend/ui/widget/about.cpp
branchwebgl
changeset 8444 75db7bb8dce8
parent 8330 aaefa587e277
parent 8434 4821897a0f10
child 8833 c13ebed437cb
equal deleted inserted replaced
8340:46a9fde631f4 8444:75db7bb8dce8
    21 #include <QList>
    21 #include <QList>
    22 #include <QUrl>
    22 #include <QUrl>
    23 #include <QRegExp>
    23 #include <QRegExp>
    24 #include <QNetworkAccessManager>
    24 #include <QNetworkAccessManager>
    25 #include <QNetworkRequest>
    25 #include <QNetworkRequest>
       
    26 #include <QMessageBox>
    26 #include <QNetworkReply>
    27 #include <QNetworkReply>
    27 #include <QDebug>
    28 #include <QDebug>
    28 #include "hwconsts.h"
    29 #include "hwconsts.h"
    29 #include "SDLInteraction.h"
    30 #include "SDLInteraction.h"
       
    31 #include "SDL.h"
       
    32 #include "SDL_version.h"
       
    33 #include "physfs.h"
       
    34 
       
    35 #ifdef VIDEOREC
       
    36 extern "C"
       
    37 {
       
    38 #include "libavutil/avutil.h"
       
    39 }
       
    40 #endif
    30 
    41 
    31 #include "about.h"
    42 #include "about.h"
    32 
    43 
    33 About::About(QWidget * parent) :
    44 About::About(QWidget * parent) :
    34     QWidget(parent)
    45     QWidget(parent)
    35 {
    46 {
    36     QGridLayout *mainLayout = new QGridLayout(this);
    47     QGridLayout *mainLayout = new QGridLayout(this);
       
    48 
       
    49     QVBoxLayout * leftLayout = new QVBoxLayout();
       
    50     mainLayout->addLayout(leftLayout, 0, 0, 2, 1);
    37 
    51 
    38     QLabel *imageLabel = new QLabel;
    52     QLabel *imageLabel = new QLabel;
    39     QImage image(":/res/Hedgehog.png");
    53     QImage image(":/res/Hedgehog.png");
    40     imageLabel->setPixmap(QPixmap::fromImage(image));
    54     imageLabel->setPixmap(QPixmap::fromImage(image));
    41     imageLabel->setScaledContents(true);
    55     imageLabel->setScaledContents(true);
    42     imageLabel->setMinimumWidth(2.8);
    56     imageLabel->setMinimumWidth(2.8);
    43     imageLabel->setMaximumWidth(280);
    57     imageLabel->setMaximumWidth(280);
    44     imageLabel->setMinimumHeight(30);
    58     imageLabel->setMinimumHeight(30);
    45     imageLabel->setMaximumHeight(300);
    59     imageLabel->setMaximumHeight(300);
    46 
    60 
    47     mainLayout->addWidget(imageLabel, 0, 0, 2, 1);
    61     leftLayout->addWidget(imageLabel, 0, Qt::AlignHCenter);
    48 
    62 
    49     QLabel *lbl1 = new QLabel(this);
    63     QLabel *lbl1 = new QLabel(this);
    50     lbl1->setOpenExternalLinks(true);
    64     lbl1->setOpenExternalLinks(true);
    51     lbl1->setText(
    65     lbl1->setText(
    52         "<style type=\"text/css\">"
    66         "<style type=\"text/css\">"
    53         "a { color: #ffcc00; }"
    67         "a { color: #ffcc00; }"
    54 //            "a:hover { color: yellow; }"
    68 //            "a:hover { color: yellow; }"
    55         "</style>"
    69         "</style>"
    56         "<div align=\"center\"><h1>Hedgewars</h1>"
    70         "<div align=\"center\"><h1>Hedgewars</h1>"
    57         "<h3>" + QLabel::tr("Version") + " " + *cVersionString + "</h3>"
    71         "<h3>" + QLabel::tr("Version") + " " + *cVersionString + "</h3>"
    58         "<p><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p><br>" +
    72         "<p><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p>" +
    59         QLabel::tr("This program is distributed under the GNU General Public License v2") +
    73         QLabel::tr("This program is distributed under the GNU General Public License v2") +
    60         "</div>"
    74         "</div>"
    61     );
    75     );
    62     lbl1->setWordWrap(true);
    76     lbl1->setWordWrap(true);
    63     mainLayout->addWidget(lbl1, 0, 1);
    77     mainLayout->addWidget(lbl1, 0, 1);
    65     lbl2 = new QTextBrowser(this);
    79     lbl2 = new QTextBrowser(this);
    66     lbl2->setOpenExternalLinks(true);
    80     lbl2->setOpenExternalLinks(true);
    67     QUrl localpage = QUrl::fromLocalFile(":/res/html/about.html");
    81     QUrl localpage = QUrl::fromLocalFile(":/res/html/about.html");
    68     lbl2->setSource(localpage); //sets the source of the label from the file above
    82     lbl2->setSource(localpage); //sets the source of the label from the file above
    69     mainLayout->addWidget(lbl2, 1, 1);
    83     mainLayout->addWidget(lbl2, 1, 1);
       
    84 
       
    85     /* Library information */
       
    86 
       
    87     QString libinfo = "<style type=text/css>a:link { color: #FFFF6E; }</style>";
       
    88 
       
    89 #ifdef __GNUC__
       
    90     libinfo.append(QString("Compiler: <a href=\"http://gcc.gnu.org\">GCC</a> %1<br>").arg(__VERSION__));
       
    91 #else
       
    92     libinfo.append(QString("Compiler: Unknown<br>").arg(__VERSION__));
       
    93 #endif
       
    94 
       
    95     libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL</a> version: %1.%2.%3<br>")
       
    96         .arg(SDL_MAJOR_VERSION)
       
    97         .arg(SDL_MINOR_VERSION)
       
    98         .arg(SDL_PATCHLEVEL));
       
    99 
       
   100     libinfo.append(QString("<a href=\"http://qt-project.org/\">Qt</a> version: %1<br>").arg(QT_VERSION_STR));
       
   101 
       
   102 #ifdef VIDEOREC
       
   103     libinfo.append(QString("<a href=\"http://libav.org\">Libav</a> version: %1.%2.%3<br>")
       
   104         .arg(LIBAVUTIL_VERSION_MAJOR)
       
   105         .arg(LIBAVUTIL_VERSION_MINOR)
       
   106         .arg(LIBAVUTIL_VERSION_MICRO));
       
   107 #endif
       
   108 
       
   109     libinfo.append(QString("<a href=\"http://icculus.org/physfs/\">PhysFS</a> version: %1.%2.%3<br>")
       
   110         .arg(PHYSFS_VER_MAJOR)
       
   111         .arg(PHYSFS_VER_MINOR)
       
   112         .arg(PHYSFS_VER_PATCH));
       
   113 
       
   114     QLabel * lblLibInfo = new QLabel();
       
   115     lblLibInfo->setText(libinfo);
       
   116     lblLibInfo->setWordWrap(true);
       
   117     lblLibInfo->setMaximumWidth(280);
       
   118     leftLayout->addWidget(lblLibInfo, 0, Qt::AlignTop | Qt::AlignHCenter);
       
   119     leftLayout->addStretch(1);
    70 
   120 
    71     setAcceptDrops(true);
   121     setAcceptDrops(true);
    72 }
   122 }
    73 
   123 
    74 void About::dragEnterEvent(QDragEnterEvent * event)
   124 void About::dragEnterEvent(QDragEnterEvent * event)