src/corelib/global/qglobal.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    79 #endif
    79 #endif
    80 
    80 
    81 #if defined(Q_OS_SYMBIAN)
    81 #if defined(Q_OS_SYMBIAN)
    82 #include <e32def.h>
    82 #include <e32def.h>
    83 #include <e32debug.h>
    83 #include <e32debug.h>
    84 #include <flogger.h>
       
    85 #include <f32file.h>
    84 #include <f32file.h>
    86 #include <e32math.h>
    85 #include <e32math.h>
    87 # include "private/qcore_symbian_p.h"
    86 # include "private/qcore_symbian_p.h"
    88 
    87 
    89 _LIT(qt_S60Filter, "Series60v?.*.sis");
    88 _LIT(qt_S60Filter, "Series60v?.*.sis");
  1827     RFs rfs = qt_s60GetRFs();
  1826     RFs rfs = qt_s60GetRFs();
  1828     TFindFile fileFinder(rfs);
  1827     TFindFile fileFinder(rfs);
  1829     CDir* contents;
  1828     CDir* contents;
  1830     TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents);
  1829     TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents);
  1831     if (err == KErrNone) {
  1830     if (err == KErrNone) {
       
  1831         QScopedPointer<CDir> contentsDeleter(contents);
  1832         err = contents->Sort(EDescending|ESortByName);
  1832         err = contents->Sort(EDescending|ESortByName);
  1833         if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) {
  1833         if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) {
  1834             TInt major = (*contents)[0].iName[9] - '0';
  1834             TInt major = (*contents)[0].iName[9] - '0';
  1835             TInt minor = (*contents)[0].iName[11] - '0';
  1835             TInt minor = (*contents)[0].iName[11] - '0';
  1836             if (major == 3) {
  1836             if (major == 3) {
  1849                 else if (minor == 2) {
  1849                 else if (minor == 2) {
  1850                     return cachedS60Version = SV_S60_5_2;
  1850                     return cachedS60Version = SV_S60_5_2;
  1851                 }
  1851                 }
  1852             }
  1852             }
  1853         }
  1853         }
  1854         delete contents;
       
  1855     }
  1854     }
  1856 
  1855 
  1857 #  ifdef Q_CC_NOKIAX86
  1856 #  ifdef Q_CC_NOKIAX86
  1858     // Some emulator environments may not contain the version specific .sis files, so
  1857     // Some emulator environments may not contain the version specific .sis files, so
  1859     // simply hardcode the version on those environments.
  1858     // simply hardcode the version on those environments.
  1876     case SV_S60_3_2:
  1875     case SV_S60_3_2:
  1877         return SV_9_3;
  1876         return SV_9_3;
  1878     case SV_S60_5_0:
  1877     case SV_S60_5_0:
  1879         return SV_9_4;
  1878         return SV_9_4;
  1880     case SV_S60_5_1:
  1879     case SV_S60_5_1:
  1881         return SV_9_4;
  1880         return SV_SF_2;
  1882     case SV_S60_5_2:
  1881     case SV_S60_5_2:
  1883         return SV_9_4;
  1882         return SV_SF_3;
  1884     default:
  1883     default:
  1885         return SV_Unknown;
  1884         return SV_Unknown;
  1886     }
  1885     }
  1887 }
  1886 }
  1888 #endif // ifdef Q_OS_SYMBIAN
  1887 #endif // ifdef Q_OS_SYMBIAN
  2220         for (int i = 0; i < ptr.Length(); i += hbuffer->Length()) {
  2219         for (int i = 0; i < ptr.Length(); i += hbuffer->Length()) {
  2221             hbuffer->Des().Copy(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i)));
  2220             hbuffer->Des().Copy(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i)));
  2222             RDebug::Print(format, hbuffer);
  2221             RDebug::Print(format, hbuffer);
  2223         }
  2222         }
  2224         delete hbuffer;
  2223         delete hbuffer;
  2225         _LIT( KLogDir, "QT" );
       
  2226         _LIT( KLogFile, "QT.log" );
       
  2227         _LIT( KLogStarting, "Starting: %S");
       
  2228         static bool logStarted;
       
  2229         if ( !logStarted ){
       
  2230             RProcess curProc;
       
  2231             TBuf<KMaxFullName + 20> procName;
       
  2232             TFullName fullName = curProc.FullName();
       
  2233             procName.Format(KLogStarting, &fullName);
       
  2234             RFileLogger::Write( KLogDir, KLogFile, EFileLoggingModeAppend, procName);
       
  2235             logStarted = true; 
       
  2236         }
       
  2237 
       
  2238         RFileLogger::Write( KLogDir, KLogFile, EFileLoggingModeAppend, ptr );
       
  2239 #else
  2224 #else
  2240         fprintf(stderr, "%s\n", buf);
  2225         fprintf(stderr, "%s\n", buf);
  2241         fflush(stderr);
  2226         fflush(stderr);
  2242 #endif
  2227 #endif
  2243     }
  2228     }
  2387     \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 27
  2372     \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 27
  2388 
  2373 
  2389     This syntax inserts a space between each item, and
  2374     This syntax inserts a space between each item, and
  2390     appends a newline at the end.
  2375     appends a newline at the end.
  2391 
  2376 
  2392     To supress the output at runtime, install your own message handler
  2377     To suppress the output at runtime, install your own message handler
  2393     with qInstallMsgHandler().
  2378     with qInstallMsgHandler().
  2394 
  2379 
  2395     \sa qDebug(), qCritical(), qFatal(), qInstallMsgHandler(),
  2380     \sa qDebug(), qCritical(), qFatal(), qInstallMsgHandler(),
  2396         {Debugging Techniques}
  2381         {Debugging Techniques}
  2397 */
  2382 */
  2423     \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 29
  2408     \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 29
  2424 
  2409 
  2425     A space is inserted between the items, and a newline is
  2410     A space is inserted between the items, and a newline is
  2426     appended at the end.
  2411     appended at the end.
  2427 
  2412 
  2428     To supress the output at runtime, install your own message handler
  2413     To suppress the output at runtime, install your own message handler
  2429     with qInstallMsgHandler().
  2414     with qInstallMsgHandler().
  2430 
  2415 
  2431     \sa qDebug(), qWarning(), qFatal(), qInstallMsgHandler(),
  2416     \sa qDebug(), qWarning(), qFatal(), qInstallMsgHandler(),
  2432         {Debugging Techniques}
  2417         {Debugging Techniques}
  2433 */
  2418 */
  2488     similar to the C printf() function.
  2473     similar to the C printf() function.
  2489 
  2474 
  2490     Example:
  2475     Example:
  2491     \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 30
  2476     \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 30
  2492 
  2477 
  2493     To supress the output at runtime, install your own message handler
  2478     To suppress the output at runtime, install your own message handler
  2494     with qInstallMsgHandler().
  2479     with qInstallMsgHandler().
  2495 
  2480 
  2496     \sa qDebug(), qCritical(), qWarning(), qInstallMsgHandler(),
  2481     \sa qDebug(), qCritical(), qWarning(), qInstallMsgHandler(),
  2497         {Debugging Techniques}
  2482         {Debugging Techniques}
  2498 */
  2483 */
  2927 /*!
  2912 /*!
  2928     \macro Q_DECLARE_TYPEINFO(Type, Flags)
  2913     \macro Q_DECLARE_TYPEINFO(Type, Flags)
  2929     \relates <QtGlobal>
  2914     \relates <QtGlobal>
  2930 
  2915 
  2931     You can use this macro to specify information about a custom type
  2916     You can use this macro to specify information about a custom type
  2932     \a Type. With accurate type information, Qt's \l{generic
  2917     \a Type. With accurate type information, Qt's \l{Container Classes}
  2933     containers} can choose appropriate storage methods and algorithms.
  2918     {generic containers} can choose appropriate storage methods and
       
  2919     algorithms.
  2934 
  2920 
  2935     \a Flags can be one of the following:
  2921     \a Flags can be one of the following:
  2936 
  2922 
  2937     \list
  2923     \list
  2938     \o \c Q_PRIMITIVE_TYPE specifies that \a Type is a POD (plain old
  2924     \o \c Q_PRIMITIVE_TYPE specifies that \a Type is a POD (plain old