Changeset 846 for trunk/src/corelib/global/qglobal.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/corelib/global/qglobal.cpp
r800 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 59 59 #include <string.h> 60 60 61 62 63 64 65 61 66 #if !defined(Q_OS_WINCE) 62 67 # include <errno.h> … … 82 87 83 88 _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\\"); 85 91 #endif 86 92 … … 1675 1681 \relates <QtGlobal> 1676 1682 1677 Defined on S60 .1683 Defined on S60. 1678 1684 1679 1685 \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS … … 1866 1872 1867 1873 #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; 1874 static QSysInfo::SymbianVersion cachedSymbianVersion = QSysInfo::SymbianVersion(-1); 1875 1876 QSysInfo::SymbianVersion QSysInfo::symbianVersion() 1877 { 1878 if (cachedSymbianVersion != -1) 1879 return cachedSymbianVersion; 1875 1880 1876 1881 // Use pure Symbian code, because if done using QDir, there will be a call back … … 1880 1885 TFindFile fileFinder(rfs); 1881 1886 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); 1883 1890 if (err == KErrNone) { 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1884 1905 err = contents->Sort(EDescending|ESortByName); 1885 1906 if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) { … … 1888 1909 if (major == 3) { 1889 1910 if (minor == 1) { 1890 return cachedS 60Version = SV_S60_3_1;1911 return cachedS; 1891 1912 } else if (minor == 2) { 1892 return cachedS 60Version = SV_S60_3_2;1913 return cachedS; 1893 1914 } 1894 1915 } else if (major == 5) { 1895 1916 if (minor == 0) { 1896 return cachedS 60Version = SV_S60_5_0;1917 return cachedS; 1897 1918 } 1898 1919 else if (minor == 1) { 1899 return cachedS 60Version = SV_S60_5_1;1920 return cachedS; 1900 1921 } 1901 1922 else if (minor == 2) { 1902 return cachedS 60Version = SV_S60_5_2;1923 return cachedS; 1903 1924 } 1904 1925 } 1905 1926 } 1906 delete contents;1907 1927 } 1908 1928 1909 1929 # ifdef Q_CC_NOKIAX86 1910 1930 // 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. 1912 1934 # if defined(__SERIES60_31__) 1913 return cachedS 60Version = SV_S60_3_1;1935 return cachedS; 1914 1936 # elif defined(__S60_32__) 1915 return cachedS 60Version = SV_S60_3_2;1937 return cachedS; 1916 1938 # 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; 1918 1944 # endif 1919 1945 # endif 1920 1946 //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 1950 QSysInfo::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; 1936 1963 default: 1937 return SV_ Unknown;1964 return SV_Unknown; 1938 1965 } 1939 1966 } 1940 #else1941 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_S601951 1967 #endif // ifdef Q_OS_SYMBIAN 1952 1968 … … 2541 2557 appends a newline at the end. 2542 2558 2543 To sup ress the output at runtime, install your own message handler2559 To supress the output at runtime, install your own message handler 2544 2560 with qInstallMsgHandler(). 2545 2561 … … 2577 2593 appended at the end. 2578 2594 2579 To sup ress the output at runtime, install your own message handler2595 To supress the output at runtime, install your own message handler 2580 2596 with qInstallMsgHandler(). 2581 2597 … … 2642 2658 \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 30 2643 2659 2644 To sup ress the output at runtime, install your own message handler2660 To supress the output at runtime, install your own message handler 2645 2661 with qInstallMsgHandler(). 2646 2662 … … 2658 2674 // getenv is declared as deprecated in VS2005. This function 2659 2675 // makes use of the new secure getenv function. 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2660 2689 QByteArray qgetenv(const char *varName) 2661 2690 { … … 2677 2706 } 2678 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2679 2722 bool qputenv(const char *varName, const QByteArray& value) 2680 2723 { … … 2744 2787 srand(seed); 2745 2788 #endif 2746 }2747 2748 /*! \internal2749 \relates <QtGlobal>2750 \since 4.62751 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 a2755 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 seeded2765 return;2766 }2767 seedStorage->setLocalData(pseed = new SeedStorageType);2768 // start beyond 1 to avoid the sequence reset2769 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 #endif2777 }2778 2779 //QT_NO_THREAD implementations2780 #else2781 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 #else2791 seed = quintptr(&seed) + QDateTime::currentDateTime().toTime_t();2792 #endif2793 srand(seed);2794 #endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD)2795 2789 } 2796 2790 … … 3103 3097 3104 3098 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. 3107 3102 3108 3103 \a Flags can be one of the following:
Note:
See TracChangeset
for help on using the changeset viewer.