Enable back screen dimming policy and handle events asynchronously 97/15097/1
authorRahul varna <rahul.varna@samsung.com>
Thu, 19 Dec 2013 08:30:52 +0000 (14:00 +0530)
committerRahul varna <rahul.varna@samsung.com>
Thu, 19 Dec 2013 08:31:01 +0000 (14:01 +0530)
Change-Id: I6dd2cf8bf59d0f7663dc1e57a44702164a77b778
Signed-off-by: Rahul varna <rahul.varna@samsung.com>
project/src/Camera/CameraCaptureForm.cpp
project/src/Image/ImageViewerForm.cpp
project/src/MediaPlayerForm.cpp
project/src/Player/CameraPlayerForm.cpp
project/src/Player/CameraPlayerForm.h
project/src/Player/VideoRecorderPlayerForm.cpp
project/src/Recorder/VideoRecorderForm.cpp

index b1cdf87..7c82038 100644 (file)
@@ -248,6 +248,8 @@ CameraCaptureForm::~CameraCaptureForm(void)
        SAFE_DELETE(__pSensorManager);
        SAFE_DELETE_ARRAYLIST(__pCapturedFileNameList);
        SAFE_DELETE_ARRAYLIST(__pCapturedBitmapList);
+
+       Tizen::System::PowerManager::KeepScreenOnState(false);
 }
 
 bool
index 197711e..c67fcaa 100644 (file)
@@ -685,7 +685,6 @@ ImageViewerForm::UpdateLog(result r, String fileName)
                        __pixelFmt == BITMAP_PIXEL_FORMAT_RGB565 ? "RGB16" : "RGB32", __ticks_decode, __ticks_resize, GetErrorMessage(r));
        }
 
-       __pBmpCtrl->Clear();
        __pBmpCtrl->SetBitmap(*__pBitmap);
        __pBmpCtrl->Draw();
 }
index f24c3b3..501df06 100644 (file)
@@ -147,6 +147,8 @@ MediaPlayerForm::~MediaPlayerForm(void)
 
        }
 
+       Tizen::System::PowerManager::KeepScreenOnState(false);
+
        AppLog("~MediaPlayerForm --");
 }
 
index 6105910..656b053 100644 (file)
@@ -42,6 +42,9 @@ using namespace Tizen::Media;
 #define METHOD_FILE_LINENO      __FUNCTION__, __FILE__, (__LINE__ - 1)
 #define MESSAGE_BOX_TIMEOUT     10000
 
+static const int START_PLAYER = 100;
+static const int STOP_PLAYER = 101;
+
 static const wchar_t* FORM_ID = L"CameraPlayerForm";
 const wchar_t* CAMERA_PLAYER_SCENE_ID = L"CameraPlayerScene";
 
@@ -396,19 +399,7 @@ CameraPlayerForm::OnActionPerformed(const Tizen::Ui::Control& source, int action
        case ID_BUTTON_START:
        {
                ShowFooterItem(0, false);
-
-               if (__isCameraStartedFlag == false)
-               {
-                       r = StartCamera();
-                       TryReturn(r == E_SUCCESS, ,"[%s] StartCamera", GetErrorMessage(r));
-               }
-
-               r = StartPlayer();
-               TryReturn(r == E_SUCCESS, ,"[%s] StartPlayer", GetErrorMessage(r));
-
-               SetFooterItem(0, L"Stop", ID_BUTTON_STOP);
-               ShowFooterItem(0, true);
-               __startFlag = true;
+               SendUserEvent(START_PLAYER, null);
 
        }
        break;
@@ -416,16 +407,8 @@ CameraPlayerForm::OnActionPerformed(const Tizen::Ui::Control& source, int action
        case ID_BUTTON_STOP:
        {
                ShowFooterItem(0, false);
+               SendUserEvent(STOP_PLAYER, null);
 
-               r = StopCamera();
-               TryReturn(r == E_SUCCESS, ,"[%s] StopCamera", GetErrorMessage(r));
-
-               r = StopPlayer();
-               TryReturn(r == E_SUCCESS, ,"[%s] StopPlayer", GetErrorMessage(r));
-
-               SetFooterItem(0, L"Start", ID_BUTTON_START);
-               ShowFooterItem(0, true);
-               __startFlag = false;
        }
        break;
 
@@ -445,6 +428,48 @@ CameraPlayerForm::OnActionPerformed(const Tizen::Ui::Control& source, int action
        return;
 }
 
+
+void
+CameraPlayerForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
+{
+       result r = E_SUCCESS;
+
+       switch(requestId)
+       {
+               case START_PLAYER:
+               {
+                       if (__isCameraStartedFlag == false)
+                       {
+                               r = StartCamera();
+                               TryReturn(r == E_SUCCESS, ,"[%s] StartCamera", GetErrorMessage(r));
+                       }
+
+                               r = StartPlayer();
+                               TryReturn(r == E_SUCCESS, ,"[%s] StartPlayer", GetErrorMessage(r));
+
+                               SetFooterItem(0, L"Stop", ID_BUTTON_STOP);
+                               ShowFooterItem(0, true);
+                               __startFlag = true;
+
+               }
+                       break;
+               case STOP_PLAYER:
+               {
+                       r = StopCamera();
+                       TryReturn(r == E_SUCCESS, ,"[%s] StopCamera", GetErrorMessage(r));
+
+                       r = StopPlayer();
+                       TryReturn(r == E_SUCCESS, ,"[%s] StopPlayer", GetErrorMessage(r));
+
+                       SetFooterItem(0, L"Start", ID_BUTTON_START);
+                       ShowFooterItem(0, true);
+                       __startFlag = false;
+               }
+                       break;
+       }
+
+}
+
 void
 CameraPlayerForm::GetCameraToForeground(void)
 {
index 696381d..a396b47 100644 (file)
@@ -78,6 +78,7 @@ protected:
        virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo){}
 
        virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String &state);
+       virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
 
        result CreateOverlayRegionForCamera(void);
        result CreateOverlayRegionForPlayer(void);
index a052117..55a7a14 100644 (file)
@@ -103,6 +103,8 @@ VideoRecorderPlayerForm::~VideoRecorderPlayerForm(void)
        SAFE_DELETE(__pPlayer);
        SAFE_DELETE(__pCamera);
        SAFE_DELETE(__pVideoRecorder);
+
+       Tizen::System::PowerManager::KeepScreenOnState(false);
 }
 
 bool
index 6fa211c..43e4b4f 100644 (file)
@@ -312,6 +312,8 @@ VideoRecorderForm::~VideoRecorderForm(void)
        DeletePopup(&__pPopupZoom);
        FreeResources();
 
+       Tizen::System::PowerManager::KeepScreenOnState(false);
+
        AppLog("VideoRecorderForm::~VideoRecorderForm");
 }