src/corelib/global/qlibraryinfo.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    44 #include "qconfig.h"
    44 #include "qconfig.h"
    45 #include "qsettings.h"
    45 #include "qsettings.h"
    46 #include "qlibraryinfo.h"
    46 #include "qlibraryinfo.h"
    47 #include "qscopedpointer.h"
    47 #include "qscopedpointer.h"
    48 
    48 
    49 #ifdef QT_BUILD_QMAKE
    49 #if defined(QT_BUILD_QMAKE) || defined(QT_BOOTSTRAPPED)
       
    50 # define BOOTSTRAPPING
       
    51 #endif
       
    52 
       
    53 #ifdef BOOTSTRAPPING
    50 QT_BEGIN_NAMESPACE
    54 QT_BEGIN_NAMESPACE
    51 extern QString qmake_libraryInfoFile();
    55 extern QString qmake_libraryInfoFile();
    52 QT_END_NAMESPACE
    56 QT_END_NAMESPACE
    53 #else
    57 #else
    54 # include "qcoreapplication.h"
    58 # include "qcoreapplication.h"
    89 };
    93 };
    90 
    94 
    91 QLibrarySettings::QLibrarySettings()
    95 QLibrarySettings::QLibrarySettings()
    92     : settings(QLibraryInfoPrivate::findConfiguration())
    96     : settings(QLibraryInfoPrivate::findConfiguration())
    93 {
    97 {
    94 #ifndef QT_BUILD_QMAKE
    98 #ifndef BOOTSTRAPPING
    95     qAddPostRoutine(QLibraryInfoPrivate::cleanup);
    99     qAddPostRoutine(QLibraryInfoPrivate::cleanup);
    96 #endif
   100 #endif
    97 }
   101 }
    98 
   102 
    99 QSettings *QLibraryInfoPrivate::findConfiguration()
   103 QSettings *QLibraryInfoPrivate::findConfiguration()
   100 {
   104 {
   101     QString qtconfig = QLatin1String(":/qt/etc/qt.conf");
   105     QString qtconfig = QLatin1String(":/qt/etc/qt.conf");
   102 #ifdef QT_BUILD_QMAKE
   106 #ifdef BOOTSTRAPPING
   103     if(!QFile::exists(qtconfig))
   107     if(!QFile::exists(qtconfig))
   104         qtconfig = qmake_libraryInfoFile();
   108         qtconfig = qmake_libraryInfoFile();
   105 #else
   109 #else
   106     if (!QFile::exists(qtconfig) && QCoreApplication::instance()) {
   110     if (!QFile::exists(qtconfig) && QCoreApplication::instance()) {
   107 #ifdef Q_OS_MAC
   111 #ifdef Q_OS_MAC
   204 QString
   208 QString
   205 QLibraryInfo::buildKey()
   209 QLibraryInfo::buildKey()
   206 {
   210 {
   207     return QString::fromLatin1(QT_BUILD_KEY);
   211     return QString::fromLatin1(QT_BUILD_KEY);
   208 }
   212 }
       
   213 
       
   214 /*!
       
   215     \since 4.6
       
   216     Returns the installation date for this build of Qt. The install date will
       
   217     usually be the last time that Qt sources were configured.
       
   218 */
       
   219 #ifndef QT_NO_DATESTRING
       
   220 QDate
       
   221 QLibraryInfo::buildDate()
       
   222 {
       
   223     return QDate::fromString(QString::fromLatin1(qt_configure_installation + 12), Qt::ISODate);
       
   224 }
       
   225 #endif //QT_NO_DATESTRING
   209 
   226 
   210 /*!
   227 /*!
   211   Returns the location specified by \a loc.
   228   Returns the location specified by \a loc.
   212 
   229 
   213 */
   230 */
   410     }
   427     }
   411 
   428 
   412     if (QDir::isRelativePath(ret)) {
   429     if (QDir::isRelativePath(ret)) {
   413         if (loc == PrefixPath) {
   430         if (loc == PrefixPath) {
   414             // we make the prefix path absolute to the executable's directory
   431             // we make the prefix path absolute to the executable's directory
   415 #ifdef QT_BUILD_QMAKE
   432 #ifdef BOOTSTRAPPING
   416             return QFileInfo(qmake_libraryInfoFile()).absolutePath();
   433             return QFileInfo(qmake_libraryInfoFile()).absolutePath();
   417 #else
   434 #else
   418             if (QCoreApplication::instance()) {
   435             if (QCoreApplication::instance()) {
   419 #ifdef Q_OS_MAC
   436 #ifdef Q_OS_MAC
   420                 CFBundleRef bundleRef = CFBundleGetMainBundle();
   437                 CFBundleRef bundleRef = CFBundleGetMainBundle();
   479     printf("This is the QtCore library version " QT_VERSION_STR "\n"
   496     printf("This is the QtCore library version " QT_VERSION_STR "\n"
   480            "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).\n"
   497            "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).\n"
   481            "Contact: Nokia Corporation (qt-info@nokia.com)\n"
   498            "Contact: Nokia Corporation (qt-info@nokia.com)\n"
   482            "\n"
   499            "\n"
   483            "Build key:           " QT_BUILD_KEY "\n"
   500            "Build key:           " QT_BUILD_KEY "\n"
       
   501            "Build date:          %s\n"
   484            "Installation prefix: %s\n"
   502            "Installation prefix: %s\n"
   485            "Library path:        %s\n"
   503            "Library path:        %s\n"
   486            "Include path:        %s\n",
   504            "Include path:        %s\n",
       
   505            qt_configure_installation + 12,
   487            qt_configure_prefix_path_str + 12,
   506            qt_configure_prefix_path_str + 12,
   488            qt_configure_libraries_path_str + 12,
   507            qt_configure_libraries_path_str + 12,
   489            qt_configure_headers_path_str + 12);
   508            qt_configure_headers_path_str + 12);
       
   509 
       
   510 #ifdef QT_EVAL
       
   511     extern void qt_core_eval_init(uint);
       
   512     qt_core_eval_init(1);
       
   513 #endif
       
   514 
   490     exit(0);
   515     exit(0);
   491 }
   516 }
   492 
   517 
   493 #endif
   518 #endif