QTfrontend/ui/widget/about.cpp
changeset 8390 0b2403003640
parent 8256 19dbb3209f46
child 8391 9f2527848ffd
equal deleted inserted replaced
8389:6d65ed1f832c 8390:0b2403003640
    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 #include "libavutil/version.h"
       
    37 #endif
    30 
    38 
    31 #include "about.h"
    39 #include "about.h"
    32 
    40 
    33 About::About(QWidget * parent) :
    41 About::About(QWidget * parent) :
    34     QWidget(parent)
    42     QWidget(parent)
    60         "</div>"
    68         "</div>"
    61     );
    69     );
    62     lbl1->setWordWrap(true);
    70     lbl1->setWordWrap(true);
    63     mainLayout->addWidget(lbl1, 0, 1);
    71     mainLayout->addWidget(lbl1, 0, 1);
    64 
    72 
       
    73     QString html;
       
    74     QFile file(":/res/html/about.html");
       
    75     if(!file.open(QIODevice::ReadOnly))
       
    76         QMessageBox::information(0, "Error loading about page", file.errorString());
       
    77 
       
    78     QTextStream in(&file);
       
    79 
       
    80     while(!in.atEnd())
       
    81         html.append(in.readLine());
       
    82 
       
    83     file.close();
       
    84 
       
    85     /* Get information */
       
    86 
       
    87     QString compilerText, compilerOpen, compilerClose;
       
    88     #ifdef __GNUC__
       
    89         compilerText = "GCC " + QString(__VERSION__) + "\n";
       
    90         compilerOpen = "<a href=\"http://gcc.gnu.org\">";
       
    91         compilerClose = "</a>";
       
    92     #else
       
    93         compilerText = "Unknown\n";
       
    94         compilerOpen = compilerClose = "";
       
    95     #endif
       
    96 
       
    97     /* Add information */
       
    98 
       
    99     html.replace("%COMPILER_A_OPEN%", compilerOpen);
       
   100     html.replace("%COMPILER_A_CLOSE%", compilerClose);
       
   101     html.replace("%COMPILER%", compilerText);
       
   102     html.replace("%SDL%", QString("version: %1.%2.%3")
       
   103         .arg(SDL_MAJOR_VERSION)
       
   104         .arg(SDL_MINOR_VERSION)
       
   105         .arg(SDL_PATCHLEVEL));
       
   106     html.replace("%QT%", QT_VERSION_STR);
       
   107 #ifdef VIDEOREC
       
   108     html.replace("%LIBAV%", QString("<a href=\"http://libav.org\">Libav</a> version: %1.%2.%3")
       
   109         .arg(LIBAVUTIL_VERSION_MAJOR)
       
   110         .arg(LIBAVUTIL_VERSION_MINOR)
       
   111         .arg(LIBAVUTIL_VERSION_MICRO));
       
   112 #endif
       
   113     html.replace("%PHYSFS%", QString("version: %1.%2.%3")
       
   114         .arg(PHYSFS_VER_MAJOR)
       
   115         .arg(PHYSFS_VER_MINOR)
       
   116         .arg(PHYSFS_VER_PATCH));
       
   117 
    65     lbl2 = new QTextBrowser(this);
   118     lbl2 = new QTextBrowser(this);
    66     lbl2->setOpenExternalLinks(true);
   119     lbl2->setOpenExternalLinks(true);
    67     QUrl localpage = QUrl::fromLocalFile(":/res/html/about.html"); 
   120     lbl2->setHtml(html);
    68     lbl2->setSource(localpage); //sets the source of the label from the file above
       
    69     mainLayout->addWidget(lbl2, 1, 1);
   121     mainLayout->addWidget(lbl2, 1, 1);
    70     
   122     
    71     setAcceptDrops(true);
   123     setAcceptDrops(true);
    72 }
   124 }
    73 
   125