QTfrontend/ui/widget/about.cpp
branchwebgl
changeset 9521 8054d9d775fd
parent 9160 fc46e75f6b72
parent 9337 c9d4daae1dee
child 9950 2759212a27de
equal deleted inserted replaced
9282:92af50454cf2 9521:8054d9d775fd
    37 {
    37 {
    38 #include "libavutil/avutil.h"
    38 #include "libavutil/avutil.h"
    39 }
    39 }
    40 #endif
    40 #endif
    41 
    41 
       
    42 
       
    43 #if defined(Q_OS_WINDOWS)
       
    44 #define sopath(x) x ".dll"
       
    45 #elif defined(Q_OS_MAC)
       
    46 #define sopath(x) "@executable_path/../Frameworks/" x ".framework/" x
       
    47 #else
       
    48 #define sopath(x) "lib" x ".so"
       
    49 #endif
       
    50 
    42 #include "about.h"
    51 #include "about.h"
    43 
    52 
    44 About::About(QWidget * parent) :
    53 About::About(QWidget * parent) :
    45     QWidget(parent)
    54     QWidget(parent)
    46 {
    55 {
    88     libinfo.append(QString("<a href=\"http://gcc.gnu.org\">GCC</a> %1<br>").arg(__VERSION__));
    97     libinfo.append(QString("<a href=\"http://gcc.gnu.org\">GCC</a> %1<br>").arg(__VERSION__));
    89 #else
    98 #else
    90     libinfo.append(QString(tr("Unknown Compiler")).arg(__VERSION__) + QString("<br>"));
    99     libinfo.append(QString(tr("Unknown Compiler")).arg(__VERSION__) + QString("<br>"));
    91 #endif
   100 #endif
    92 
   101 
       
   102     const SDL_version *sdl_ver = SDL_Linked_Version();
    93     libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL</a> version: %1.%2.%3<br>")
   103     libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL</a> version: %1.%2.%3<br>")
    94         .arg(SDL_MAJOR_VERSION)
   104         .arg(sdl_ver->major)
    95         .arg(SDL_MINOR_VERSION)
   105         .arg(sdl_ver->minor)
    96         .arg(SDL_PATCHLEVEL));
   106         .arg(sdl_ver->patch));
       
   107 
       
   108     const SDL_version *sdlmixer_ver = Mix_Linked_Version();
       
   109     libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL_mixer</a> version: %1.%2.%3<br>")
       
   110         .arg(sdlmixer_ver->major)
       
   111         .arg(sdlmixer_ver->minor)
       
   112         .arg(sdlmixer_ver->patch));
       
   113 
       
   114     // the remaining sdl modules used only in engine, so instead of needlessly linking them here
       
   115     // we dynamically call the function returning the linked version
       
   116     void *sdlnet_handle = SDL_LoadObject(sopath("SDL_net"));
       
   117     if (sdlnet_handle != NULL) {
       
   118         SDL_version *(*sdlnet_ver_get)(void) = NULL;
       
   119         sdlnet_ver_get = (SDL_version *(*)(void)) SDL_LoadFunction(sdlnet_handle, "SDLNet_Linked_Version");
       
   120         if (sdlnet_ver_get != NULL) {
       
   121             SDL_version *sdlnet_ver = sdlnet_ver_get();
       
   122             libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL_net</a> version: %1.%2.%3<br>")
       
   123                 .arg(sdlnet_ver->major)
       
   124                 .arg(sdlnet_ver->minor)
       
   125                 .arg(sdlnet_ver->patch));
       
   126         }
       
   127         SDL_UnloadObject(sdlnet_handle);
       
   128     }
       
   129 
       
   130     void *sdlimage_handle = SDL_LoadObject(sopath("SDL_image"));
       
   131     if (sdlimage_handle != NULL) {
       
   132         SDL_version *(*sdlimage_ver_get)(void) = NULL;
       
   133         sdlimage_ver_get = (SDL_version *(*)(void)) SDL_LoadFunction(sdlimage_handle, "IMG_Linked_Version");
       
   134         if (sdlimage_ver_get != NULL) {
       
   135             SDL_version *sdlimage_ver = sdlimage_ver_get();
       
   136             libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL_image</a> version: %1.%2.%3<br>")
       
   137                 .arg(sdlimage_ver->major)
       
   138                 .arg(sdlimage_ver->minor)
       
   139                 .arg(sdlimage_ver->patch));
       
   140         }
       
   141         SDL_UnloadObject(sdlnet_handle);
       
   142     }
       
   143 
       
   144     void *sdlttf_handle = SDL_LoadObject(sopath("SDL_ttf"));
       
   145     if (sdlttf_handle != NULL) {
       
   146         SDL_version *(*sdlttf_ver_get)(void) = NULL;
       
   147         sdlttf_ver_get = (SDL_version *(*)(void)) SDL_LoadFunction(sdlttf_handle, "TTF_Linked_Version");
       
   148         if (sdlttf_ver_get != NULL) {
       
   149             SDL_version *sdlttf_ver = sdlttf_ver_get();
       
   150             libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL_ttf</a> version: %1.%2.%3<br>")
       
   151                 .arg(sdlttf_ver->major)
       
   152                 .arg(sdlttf_ver->minor)
       
   153                 .arg(sdlttf_ver->patch));
       
   154         }
       
   155         SDL_UnloadObject(sdlnet_handle);
       
   156     }
       
   157 
    97 
   158 
    98     libinfo.append(QString("<a href=\"http://qt-project.org/\">Qt</a> version: %1<br>").arg(QT_VERSION_STR));
   159     libinfo.append(QString("<a href=\"http://qt-project.org/\">Qt</a> version: %1<br>").arg(QT_VERSION_STR));
    99 
   160 
   100 #ifdef VIDEOREC
   161 #ifdef VIDEOREC
   101     libinfo.append(QString("<a href=\"http://libav.org\">Libav</a> version: %1.%2.%3<br>")
   162     libinfo.append(QString("<a href=\"http://libav.org\">Libav</a> version: %1.%2.%3<br>")
   106 
   167 
   107     libinfo.append(QString("<a href=\"http://icculus.org/physfs/\">PhysFS</a> version: %1.%2.%3<br>")
   168     libinfo.append(QString("<a href=\"http://icculus.org/physfs/\">PhysFS</a> version: %1.%2.%3<br>")
   108         .arg(PHYSFS_VER_MAJOR)
   169         .arg(PHYSFS_VER_MAJOR)
   109         .arg(PHYSFS_VER_MINOR)
   170         .arg(PHYSFS_VER_MINOR)
   110         .arg(PHYSFS_VER_PATCH));
   171         .arg(PHYSFS_VER_PATCH));
       
   172 
       
   173     // TODO: how to add Lua information?
   111 
   174 
   112     QLabel * lblLibInfo = new QLabel();
   175     QLabel * lblLibInfo = new QLabel();
   113     lblLibInfo->setOpenExternalLinks(true);
   176     lblLibInfo->setOpenExternalLinks(true);
   114     lblLibInfo->setText(libinfo);
   177     lblLibInfo->setText(libinfo);
   115     lblLibInfo->setWordWrap(true);
   178     lblLibInfo->setWordWrap(true);