src/hbcore/gui/hbsplashscreen.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
    25 
    25 
    26 #include "hbsplashscreen.h"
    26 #include "hbsplashscreen.h"
    27 #include "hbsplashscreen_generic_p.h"
    27 #include "hbsplashscreen_generic_p.h"
    28 #include "hbsplash_p.h"
    28 #include "hbsplash_p.h"
    29 #include "hbsplashdefs_p.h"
    29 #include "hbsplashdefs_p.h"
       
    30 #include "hbapplication.h"
    30 #include <QPainter>
    31 #include <QPainter>
    31 #include <QApplication>
    32 #include <QApplication>
    32 
    33 
    33 #if QT_VERSION >= 0x040700
    34 #if QT_VERSION >= 0x040700
    34 #include <QElapsedTimer>
    35 #include <QElapsedTimer>
    38 #define ELAPSED_TIMER QTime
    39 #define ELAPSED_TIMER QTime
    39 #endif
    40 #endif
    40 
    41 
    41 #if defined(Q_OS_SYMBIAN) && defined(HB_EFFECTS_OPENVG)
    42 #if defined(Q_OS_SYMBIAN) && defined(HB_EFFECTS_OPENVG)
    42 // When Symbian/EGL/OpenVG is available we can use the more efficient
    43 // When Symbian/EGL/OpenVG is available we can use the more efficient
    43 // implementation which is not just faster but is able to operate
    44 // implementation which is not only faster but is able to operate
    44 // without having Qt or any other framework initialized. This means
    45 // without having Qt or any other framework initialized. This means
    45 // having truly 'instant' splash screens.
    46 // having truly 'instant' splash screens.
    46 #define HB_SPLASH_DIRECT_WS
    47 #define HB_SPLASH_DIRECT_WS
    47 #endif
    48 #endif
    48 
    49 
   160   is aware of this and will call this function at the most ideal time, depending
   161   is aware of this and will call this function at the most ideal time, depending
   161   on the underlying implementation. However when start() is called directly by
   162   on the underlying implementation. However when start() is called directly by
   162   the application, this becomes important because the application startup
   163   the application, this becomes important because the application startup
   163   experience can be greatly improved by making sure the splash is shown as early
   164   experience can be greatly improved by making sure the splash is shown as early
   164   as possible.
   165   as possible.
       
   166 
       
   167   On Symbian the splash will be automatically suppressed (i.e. not shown) if the
       
   168   application was started to background, that is,
       
   169   HbApplication::startedToBackground() returns true. To override this default
       
   170   behavior, pass HbSplashScreen::ShowWhenStartingToBackground.
   165  */
   171  */
   166 void HbSplashScreen::start(Flags flags)
   172 void HbSplashScreen::start(Flags flags)
   167 {
   173 {
   168     Flags realFlags = flags | requestProps()->mSplashFlags;
   174     Flags realFlags = flags | requestProps()->mSplashFlags;
       
   175     if (!realFlags.testFlag(ShowWhenStartingToBackground)
       
   176         && HbApplication::startedToBackground()) {
       
   177         splDebug("[hbsplash] app started to background, suppressing splash");
       
   178         return;
       
   179     }
   169     if (!splashScreen) {
   180     if (!splashScreen) {
   170 #ifdef HB_SPLASH_DIRECT_WS
   181 #ifdef HB_SPLASH_DIRECT_WS
   171         if (realFlags.testFlag(HbSplashScreen::ForceQt)) {
   182         if (realFlags.testFlag(ForceQt)) {
   172             splashScreen = new HbSplashScreenGeneric;
   183             splashScreen = new HbSplashScreenGeneric;
   173         } else {
   184         } else {
   174             splashScreen = new HbSplashScreenSymbianVg;
   185             splashScreen = new HbSplashScreenSymbianVg;
   175         }
   186         }
   176 #else
   187 #else