camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp
changeset 58 ddba9caa7f32
parent 42 feebad15db8c
equal deleted inserted replaced
55:0da2a5b56583 58:ddba9caa7f32
    46     connect(mApplicationMonitor, SIGNAL(batteryEmpty()), this, SLOT(handleBatteryEmpty()));
    46     connect(mApplicationMonitor, SIGNAL(batteryEmpty()), this, SLOT(handleBatteryEmpty()));
    47 
    47 
    48     // USB mass memory mode signal
    48     // USB mass memory mode signal
    49     connect(mApplicationMonitor, SIGNAL(usbMassMemoryModeToggled(bool)),
    49     connect(mApplicationMonitor, SIGNAL(usbMassMemoryModeToggled(bool)),
    50             this, SLOT(handleUsbMassMemoryModeChanged(bool)));
    50             this, SLOT(handleUsbMassMemoryModeChanged(bool)));
       
    51     
       
    52     // Task switcher state signal
       
    53     connect(mApplicationMonitor, SIGNAL(taskSwitcherStateChanged(bool)), this, SLOT(handleTaskSwitcherStateChanged(bool)));
    51 
    54 
    52     // Severe error signals
    55     // Severe error signals
    53     connect(mErrorManager, SIGNAL(errorPopupShown()), this, SLOT(handleSevereError()));
    56     connect(mErrorManager, SIGNAL(errorPopupShown()), this, SLOT(handleSevereError()));
    54     connect(mErrorManager, SIGNAL(errorPopupClosed()), this, SLOT(handleErrorCleared()));
    57     connect(mErrorManager, SIGNAL(errorPopupClosed()), this, SLOT(handleErrorCleared()));
    55 
    58 
   119         // When returning to background, error situation will be re-checked.
   122         // When returning to background, error situation will be re-checked.
   120         setState(Background);
   123         setState(Background);
   121         mErrorManager->clear();
   124         mErrorManager->clear();
   122     } else {
   125     } else {
   123         CX_DEBUG(("CxuiApplicationState - application is in partial / full foreground"));
   126         CX_DEBUG(("CxuiApplicationState - application is in partial / full foreground"));
   124         // Check that we were in background. Switching between partial and full background
   127         // Check that we were in background or standby state. 
   125         // needs no actions.
   128         // State can be standby, if camera lost focus to task switcher.
   126         if (currentState() == Background) {
   129         if (currentState() == Background || currentState() == Standby) {
   127            CX_DEBUG(("CxuiApplicationState - application was in background before, moving to foreground"));
   130            CX_DEBUG(("CxuiApplicationState - application was in partial/full background, moving to foreground"));
   128             // Check that there's no active errors that have been ignored in background.
   131             // Check that there's no active errors that have been ignored in background.
   129             checkErrors();
   132             checkErrors();
   130             if (currentState() != Error) {
   133             if (currentState() != Error) {
   131                 setState(Normal);
   134                 setState(Normal);
   132             }
   135             }
   157         // If we had USB error, clear it now.
   160         // If we had USB error, clear it now.
   158         if (currentState() == Error) {
   161         if (currentState() == Error) {
   159             setState(Standby);
   162             setState(Standby);
   160             // Clear memory not accessible error.
   163             // Clear memory not accessible error.
   161             mErrorManager->clear();
   164             mErrorManager->clear();
       
   165         }
       
   166     }
       
   167     CX_DEBUG_EXIT_FUNCTION();
       
   168 }
       
   169 
       
   170 /*!
       
   171 * Handle Task Switcher state changes.
       
   172 * If Task Switcher activates, we enter standby mode.
       
   173 * When we receive foreground event, we can move back to Normal mode.
       
   174 * @param foreground Is the Task Switcher in foreground/active.
       
   175 */
       
   176 void CxuiApplicationState::handleTaskSwitcherStateChanged(bool foreground)
       
   177 {
       
   178     CX_DEBUG_ENTER_FUNCTION();
       
   179     if (foreground) {
       
   180         // When task switcher is active, we enter standby mode.
       
   181         if (currentState() == Normal) {
       
   182             // Go to standby mode (release camera).
       
   183             CX_DEBUG(("CxuiApplicationState - application losing partial-foreground to task switcher"));
       
   184             setState(Standby);
   162         }
   185         }
   163     }
   186     }
   164     CX_DEBUG_EXIT_FUNCTION();
   187     CX_DEBUG_EXIT_FUNCTION();
   165 }
   188 }
   166 
   189