Solution to issue N_SE-38859
authorsrinivasa.mr <srinivasa.mr@samsung.com>
Fri, 17 May 2013 11:45:06 +0000 (20:45 +0900)
committersrinivasa.mr <srinivasa.mr@samsung.com>
Fri, 17 May 2013 11:45:06 +0000 (20:45 +0900)
Change-Id: I3eaf6582c39870b339c3079f347b9df5b727b66e
Signed-off-by: srinivasa.mr <srinivasa.mr@samsung.com>
project/inc/MultiForm.h
project/src/MultiForm.cpp
project/src/Player/MultiPlayForm.cpp
project/src/Player/MultiPlayForm.h

index 0e7586a..dd53b5b 100644 (file)
@@ -80,6 +80,7 @@ public:
        bool GetErrorPopupState(void) const;
        result ShowMessageBox(const char* pTitle, const char* pFormat, ...);
        void ShowMessagePopup(const char* pMessage, unsigned int actionId);
+       void ShowMessagePopup(String title,String message, unsigned int actionId);
 
 protected:
        CONST_INT(ID_BUTTON_ERROR_POPUP_OK);
index 9c80b98..65bd993 100644 (file)
@@ -603,6 +603,115 @@ MultiForm::ShowMessagePopup(const char* pMessage, unsigned int actionId)
        AppLog("MessagePopup Show failed due to OUT_OF_MEMORY");
 }
 
+
+void
+MultiForm::ShowMessagePopup(String title,String message, unsigned int actionId)
+{
+       int orientationStatus = 0;
+       Rectangle popupLableRect;
+       int xPos = 0;
+       int yPos = 0;
+
+       orientationStatus = GetOrientationStatus();
+
+       if (orientationStatus == ORIENTATION_STATUS_PORTRAIT ||
+               orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
+       {
+               _pErrorMessagePopup = new (std::nothrow) Popup;
+               if (_pErrorMessagePopup == null)
+               {
+                       goto FAIL;
+               }
+               _pErrorMessagePopup->Construct(true, Dimension(ERROR_MESSAGE_POPUP_WIDTH, ERROR_MESSAGE_POPUP_HEIGHT));
+               _pErrorMessagePopup->SetTitleText(title);
+
+               _pErrorMessagePopupLabel = new (std::nothrow) Label;
+               if (_pErrorMessagePopupLabel == null)
+               {
+                       goto FAIL;
+               }
+
+               popupLableRect = _pErrorMessagePopup->GetClientAreaBounds();
+
+               popupLableRect.x = 0;
+               popupLableRect.y = 0;
+
+               _pErrorMessagePopupLabel->Construct(popupLableRect, L"");
+               _pErrorMessagePopup->AddControl(*_pErrorMessagePopupLabel);
+
+               _pErrorMessagePopupBtn = new (std::nothrow) Button;
+               if (_pErrorMessagePopupBtn == null)
+               {
+                       goto FAIL;
+               }
+
+               xPos = (popupLableRect.width/2)-(ERROR_MESSAGE_POPUP_BUTTON_W/2);
+               yPos = (popupLableRect.height  - ERROR_MESSAGE_POPUP_BUTTON_H - 20);
+
+               _pErrorMessagePopupBtn->Construct(Rectangle(xPos, yPos,
+                                                                                                  ERROR_MESSAGE_POPUP_BUTTON_W,
+                                                                                                  ERROR_MESSAGE_POPUP_BUTTON_H),
+                                                                                L"Ok");
+               _pErrorMessagePopupBtn->SetActionId(actionId);
+               _pErrorMessagePopupBtn->AddActionEventListener(*this);
+               _pErrorMessagePopup->AddControl(*_pErrorMessagePopupBtn);
+
+       }
+       else
+       {
+               _pErrorMessagePopup = new (std::nothrow) Popup;
+               if (_pErrorMessagePopup == null)
+               {
+                       goto FAIL;
+               }
+               _pErrorMessagePopup->Construct(true, Dimension(ERROR_MESSAGE_POPUP_LANDSCAPE_WIDTH, ERROR_MESSAGE_POPUP_LANDSCAPE_HEIGHT));
+               _pErrorMessagePopup->SetTitleText(L"Error");
+
+               _pErrorMessagePopupLabel = new (std::nothrow) Label;
+               if (_pErrorMessagePopupLabel == null)
+               {
+                       goto FAIL;
+               }
+
+               popupLableRect = _pErrorMessagePopup->GetClientAreaBounds();
+
+               popupLableRect.x = 0;
+               popupLableRect.y = 0;
+
+               _pErrorMessagePopupLabel->Construct(popupLableRect, L"");
+               _pErrorMessagePopup->AddControl(*_pErrorMessagePopupLabel);
+
+               _pErrorMessagePopupBtn = new (std::nothrow) Button;
+               if (_pErrorMessagePopupBtn == null)
+               {
+                       goto FAIL;
+               }
+
+               xPos = (popupLableRect.width/2)-(ERROR_MESSAGE_POPUP_LANDSCAPE_BUTTON_W/2);
+               yPos = ERROR_MESSAGE_POPUP_LANDSCAPE_HEIGHT - ERROR_MESSAGE_POPUP_LANDSCAPE_BUTTON_H;
+
+               yPos = (popupLableRect.height  - ERROR_MESSAGE_POPUP_LANDSCAPE_BUTTON_H -20);
+
+               _pErrorMessagePopupBtn->Construct(Rectangle(xPos, yPos,
+                                                                                                  ERROR_MESSAGE_POPUP_LANDSCAPE_BUTTON_W,
+                                                                                                  ERROR_MESSAGE_POPUP_LANDSCAPE_BUTTON_H),
+                                                                                L"Ok");
+               _pErrorMessagePopupBtn->SetActionId(actionId);
+               _pErrorMessagePopupBtn->AddActionEventListener(*this);
+               _pErrorMessagePopup->AddControl(*_pErrorMessagePopupBtn);
+       }
+
+       _pErrorMessagePopupLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+       _pErrorMessagePopupLabel->SetTextConfig(ERROR_MESSAGE_POPUP_LABEL_TEXT_FONT, LABEL_TEXT_STYLE_NORMAL);
+       _pErrorMessagePopupLabel->SetText(message);
+       _pErrorMessagePopupLabel->RequestRedraw();
+
+       _pErrorMessagePopup->Show();
+       return;
+       FAIL:
+       AppLog("MessagePopup Show failed due to OUT_OF_MEMORY");
+}
+
 void
 MultiForm::ClearErrorPopup(void)
 {
index 80e4184..bc9234d 100644 (file)
@@ -143,16 +143,6 @@ MultiPlayForm::Activate(void* pParam)
        return E_SUCCESS;
 }
 
-void
-MultiPlayForm::ShowErrorMessageBox(String strText1, String strText2)
-{
-       MessageBox messageBox;
-       messageBox.Construct(strText1, strText2, MSGBOX_STYLE_NONE, 2000);
-       int modalResult = 0;
-       messageBox.ShowAndWait(modalResult);
-       return;
-}
-
 result
 MultiPlayForm::GetFilePathFromConfigAndOpen()
 {
@@ -235,7 +225,7 @@ MultiPlayForm::CreatePlayerInstance(int index)
        if (IsFailed(r))
        {
                AppLog(" Construct has failed r = %d", GetErrorMessage(r));
-               ShowErrorMessageBox(strTemp, L"Player construct Failed");
+               ShowMessagePopup(String(L"Error"), String(L"Player Construct failed"), ID_ERROR_POPUP);
                __nTotalPlayCount = __nTotalPlayCount - 1;
                __pListMenu->SetItemChecked(index, false);
                __pListMenu->RequestRedraw();
@@ -248,7 +238,7 @@ MultiPlayForm::CreatePlayerInstance(int index)
        if (IsFailed(r))
        {
                AppLog(" OpenFile has failed r = %d", GetErrorMessage(r));
-               ShowErrorMessageBox(strTemp, L"Open Failed");
+               ShowMessagePopup(String(L"Error"), String(L"OpenFile failed"), ID_ERROR_POPUP);
                SAFE_DELETE(__pPlayer[nCurPlayerVal]);
                return r;
        }
@@ -256,7 +246,7 @@ MultiPlayForm::CreatePlayerInstance(int index)
        if (IsFailed(r))
        {
                AppLog("Play has failed r = %d", GetErrorMessage(r));
-               ShowErrorMessageBox(strTemp, L"Play Failed");
+               ShowMessagePopup(String(L"Error"), String(L"Play Failed"), ID_ERROR_POPUP);
                SAFE_DELETE(__pPlayer[nCurPlayerVal]);
                return r;
        }
@@ -488,6 +478,13 @@ MultiPlayForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
        case ID_RESUME:
                ResumePlayback();
                break;
+       case ID_ERROR_POPUP:
+               __isWarningShown = false;
+               ClearErrorPopup();
+               Draw();
+               break;
+       default:
+               break;
        }
 }
 
@@ -566,7 +563,8 @@ MultiPlayForm::OnPlayerAudioFocusChanged(void)
        if (!__isWarningShown)
        {
                __isWarningShown = true;
-               ShowMessageBox("Info", "Press Resume to Resume playback");
+               ShowMessagePopup(String(L"Info"), String(L"Press Resume to Resume playback"), ID_ERROR_POPUP);
+               RemoveFooterItem(INDEX_RESUME);
                AddFooterItem(L"Resume", ID_RESUME);
                SetFooterItem(INDEX_RESUME, L"Resume", ID_RESUME);
        }
@@ -597,14 +595,13 @@ MultiPlayForm::ResumePlayback(void)
                                                r = pPobj->Play();
                                                if (r == E_DEVICE_BUSY)
                                                {
-                                                       ShowErrorMessageBox(L"Warning", L"Device is Busy, try again later");
+                                                       ShowMessagePopup(String(L"Warning"), String(L"Device is Busy, try again later"), ID_ERROR_POPUP);
                                                        __isWarningShown = false;
                                                        return;
                                                }
                                                else if (r != E_SUCCESS)
                                                {
-                                                       String strTemp = _pConfig->GetContentPath(MULTI_PLAY_SECTION_NAME, "srcfile%d", index);
-                                                       ShowErrorMessageBox(strTemp, L"Play Failed");
+                                                       ShowMessagePopup(String(L"Error"),String(L"Play Failed"), ID_ERROR_POPUP);
                                                        __isWarningShown = false;
                                                        return;
                                                }
@@ -893,7 +890,7 @@ MultiPlayForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listVie
                        AppLog("checked  enter __nTotalPlayCount = %d", __nTotalPlayCount);
                        if (__nTotalPlayCount > MAX_PLAY_COUNT)
                        {
-                               ShowErrorMessageBox(L"Max Play count of 10 reached", L"");
+                               ShowMessagePopup(String("Warning"), String("Max Play count of 10 reached"), ID_ERROR_POPUP);
                                __nTotalPlayCount = __nTotalPlayCount - 1;
                                __pListMenu->SetItemChecked(index, false);
                                __pListMenu->RequestRedraw();
index c1fc3e2..f8fc4fb 100644 (file)
@@ -94,7 +94,6 @@ protected:
        void OnPlayerInterrupted(void);
        void OnPlayerReleased(void);
        void OnPlayerAudioFocusChanged(void);
-       void ShowErrorMessageBox(String strText1, String strText2);
 
        // Called when the application's frame moves to the top of the screen.
        virtual void OnForeground(void);
@@ -143,6 +142,7 @@ private:
        CONST_INT(ID_RESUME);
        static const int INDEX_RESET = 0;
        static const int INDEX_RESUME = 1;
+       static const int ID_ERROR_POPUP = 0x3142;
        Tizen::Ui::Controls::ListView* __pListMenu;
        Player* __pPlayer[MAX_PLAY_COUNT];
        Tizen::Base::Collection::HashMap __playerIdMap;