Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/global/qglobal.cpp

    r800 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    5959#include <string.h>
    6060
     61
     62
     63
     64
     65
    6166#if !defined(Q_OS_WINCE)
    6267#  include <errno.h>
     
    8287
    8388_LIT(qt_S60Filter, "Series60v?.*.sis");
    84 _LIT(qt_S60SystemInstallDir, "z:\\system\\install\\");
     89_LIT(qt_symbianFilter, "Symbianv*.sis");
     90_LIT(qt_symbianSystemInstallDir, "z:\\system\\install\\");
    8591#endif
    8692
     
    16751681  \relates <QtGlobal>
    16761682
    1677   Defined on S60.
     1683  Defined on S60.
    16781684
    16791685  \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS
     
    18661872
    18671873#ifdef Q_OS_SYMBIAN
    1868 # ifdef Q_WS_S60
    1869 static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1);
    1870 
    1871 QSysInfo::S60Version QSysInfo::s60Version()
    1872 {
    1873     if (cachedS60Version != -1)
    1874         return cachedS60Version;
     1874static QSysInfo::SymbianVersion cachedSymbianVersion = QSysInfo::SymbianVersion(-1);
     1875
     1876QSysInfo::SymbianVersion QSysInfo::symbianVersion()
     1877{
     1878    if (cachedSymbianVersion != -1)
     1879        return cachedSymbianVersion;
    18751880
    18761881    // Use pure Symbian code, because if done using QDir, there will be a call back
     
    18801885    TFindFile fileFinder(rfs);
    18811886    CDir* contents;
    1882     TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents);
     1887
     1888    // Check for Symbian4
     1889    TInt err = fileFinder.FindWildByDir(qt_symbianFilter, qt_symbianSystemInstallDir, contents);
    18831890    if (err == KErrNone) {
     1891
     1892
     1893
     1894
     1895
     1896
     1897
     1898
     1899
     1900
     1901
     1902
     1903
     1904
    18841905        err = contents->Sort(EDescending|ESortByName);
    18851906        if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) {
     
    18881909            if (major == 3) {
    18891910                if (minor == 1) {
    1890                     return cachedS60Version = SV_S60_3_1;
     1911                    return cachedS;
    18911912                } else if (minor == 2) {
    1892                     return cachedS60Version = SV_S60_3_2;
     1913                    return cachedS;
    18931914                }
    18941915            } else if (major == 5) {
    18951916                if (minor == 0) {
    1896                     return cachedS60Version = SV_S60_5_0;
     1917                    return cachedS;
    18971918                }
    18981919                else if (minor == 1) {
    1899                     return cachedS60Version = SV_S60_5_1;
     1920                    return cachedS;
    19001921                }
    19011922                else if (minor == 2) {
    1902                     return cachedS60Version = SV_S60_5_2;
     1923                    return cachedS;
    19031924                }
    19041925            }
    19051926        }
    1906         delete contents;
    19071927    }
    19081928
    19091929#  ifdef Q_CC_NOKIAX86
    19101930    // Some emulator environments may not contain the version specific .sis files, so
    1911     // simply hardcode the version on those environments.
     1931    // simply hardcode the version on those environments. Note that can't use
     1932    // SYMBIAN_VERSION_* defines for S60 3.x/5.0 platforms, as they do not define them
     1933    // right anyway in case .sis files are not found.
    19121934#   if defined(__SERIES60_31__)
    1913     return cachedS60Version = SV_S60_3_1;
     1935    return cachedS;
    19141936#   elif defined(__S60_32__)
    1915     return cachedS60Version = SV_S60_3_2;
     1937    return cachedS;
    19161938#   elif defined(__S60_50__)
    1917     return cachedS60Version = SV_S60_5_0;
     1939    return cachedSymbianVersion = SV_9_4;
     1940#   elif defined(SYMBIAN_VERSION_SYMBIAN3)
     1941    return cachedSymbianVersion = SV_SF_3;
     1942#   elif defined(SYMBIAN_VERSION_SYMBIAN4)
     1943    return cachedSymbianVersion = SV_SF_4;
    19181944#   endif
    19191945#  endif
    19201946    //If reaching here, it was not possible to determine the version
    1921     return cachedS60Version = SV_S60_Unknown;
    1922 }
    1923 QSysInfo::SymbianVersion QSysInfo::symbianVersion()
    1924 {
    1925     switch (s60Version()) {
    1926     case SV_S60_3_1:
    1927         return SV_9_2;
    1928     case SV_S60_3_2:
    1929         return SV_9_3;
    1930     case SV_S60_5_0:
    1931         return SV_9_4;
    1932     case SV_S60_5_1:
    1933         return SV_9_4;
    1934     case SV_S60_5_2:
    1935         return SV_9_4;
     1947    return cachedSymbianVersion = SV_Unknown;
     1948}
     1949
     1950QSysInfo::S60Version QSysInfo::s60Version()
     1951{
     1952    switch (symbianVersion()) {
     1953    case SV_9_2:
     1954        return SV_S60_3_1;
     1955    case SV_9_3:
     1956        return SV_S60_3_2;
     1957    case SV_9_4:
     1958        return SV_S60_5_0;
     1959    case SV_SF_2:
     1960        return SV_S60_5_1;
     1961    case SV_SF_3:
     1962        return SV_S60_5_2;
    19361963    default:
    1937         return SV_Unknown;
     1964        return SV_Unknown;
    19381965    }
    19391966}
    1940 #else
    1941 QSysInfo::S60Version QSysInfo::s60Version()
    1942 {
    1943     return SV_S60_None;
    1944 }
    1945 
    1946 QSysInfo::SymbianVersion QSysInfo::symbianVersion()
    1947 {
    1948     return SV_Unknown;
    1949 }
    1950 # endif // ifdef Q_WS_S60
    19511967#endif // ifdef Q_OS_SYMBIAN
    19521968
     
    25412557    appends a newline at the end.
    25422558
    2543     To supress the output at runtime, install your own message handler
     2559    To supress the output at runtime, install your own message handler
    25442560    with qInstallMsgHandler().
    25452561
     
    25772593    appended at the end.
    25782594
    2579     To supress the output at runtime, install your own message handler
     2595    To supress the output at runtime, install your own message handler
    25802596    with qInstallMsgHandler().
    25812597
     
    26422658    \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 30
    26432659
    2644     To supress the output at runtime, install your own message handler
     2660    To supress the output at runtime, install your own message handler
    26452661    with qInstallMsgHandler().
    26462662
     
    26582674// getenv is declared as deprecated in VS2005. This function
    26592675// makes use of the new secure getenv function.
     2676
     2677
     2678
     2679
     2680
     2681
     2682
     2683
     2684
     2685
     2686
     2687
     2688
    26602689QByteArray qgetenv(const char *varName)
    26612690{
     
    26772706}
    26782707
     2708
     2709
     2710
     2711
     2712
     2713
     2714
     2715
     2716
     2717
     2718
     2719
     2720
     2721
    26792722bool qputenv(const char *varName, const QByteArray& value)
    26802723{
     
    27442787    srand(seed);
    27452788#endif
    2746 }
    2747 
    2748 /*! \internal
    2749     \relates <QtGlobal>
    2750     \since 4.6
    2751 
    2752     Seed the PRNG, but only if it has not already been seeded.
    2753 
    2754     The default seed is a combination of current time, a stack address and a
    2755     serial counter (since thread stack addresses are re-used).
    2756 */
    2757 void qsrand()
    2758 {
    2759 #if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD)
    2760     SeedStorage *seedStorage = randTLS();
    2761     if (seedStorage) {
    2762         SeedStorageType *pseed = seedStorage->localData();
    2763         if (pseed) {
    2764             // already seeded
    2765             return;
    2766         }
    2767         seedStorage->setLocalData(pseed = new SeedStorageType);
    2768         // start beyond 1 to avoid the sequence reset
    2769         static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2);
    2770         *pseed = QDateTime::currentDateTime().toTime_t()
    2771                  + quintptr(&pseed)
    2772                  + serial.fetchAndAddRelaxed(1);
    2773 #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
    2774         // for Windows and Symbian the srand function must still be called.
    2775         srand(*pseed);
    2776 #endif
    2777     }
    2778 
    2779 //QT_NO_THREAD implementations
    2780 #else
    2781     static unsigned int seed = 0;
    2782 
    2783     if (seed)
    2784         return;
    2785 
    2786 #if defined(Q_OS_SYMBIAN)
    2787     seed = Math::Random();
    2788 #elif defined(Q_OS_WIN)
    2789     seed = GetTickCount();
    2790 #else
    2791     seed = quintptr(&seed) + QDateTime::currentDateTime().toTime_t();
    2792 #endif
    2793     srand(seed);
    2794 #endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD)
    27952789}
    27962790
     
    31033097
    31043098    You can use this macro to specify information about a custom type
    3105     \a Type. With accurate type information, Qt's \l{generic
    3106     containers} can choose appropriate storage methods and algorithms.
     3099    \a Type. With accurate type information, Qt's \l{Container Classes}
     3100    {generic containers} can choose appropriate storage methods and
     3101    algorithms.
    31073102
    31083103    \a Flags can be one of the following:
Note: See TracChangeset for help on using the changeset viewer.