virtual void OnScreenOff(void);
virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String &state);
void ShowErrorMessagePopup(String filePath, String Class, const char* pMethod, result r, const char* pSrcfileName, int lineNo, String errorMsg = L"");
- void ClearErrorPopup(void);
- bool GetErrorPopupState(void) const;
- result ShowMessageBox(const char* pTitle, const char* pFormat, ...);
+ void ShowErrorMessagePopup(String title,unsigned int actionId, const char* pFormat, ...);
void ShowMessagePopup(const char* pMessage, unsigned int actionId);
void ShowMessagePopup(String title,String message, unsigned int actionId);
-
+ void ClearErrorPopup(void);
+ bool GetErrorPopupState(void) const;
protected:
CONST_INT(ID_BUTTON_ERROR_POPUP_OK);
r = __pPlayer->Play();\r
if(IsFailed(r))
{
- ShowMessageBox("Error", "Play failed\n(%s)", GetErrorMessage(r));
+ ShowErrorMessagePopup("Error", ID_ERROR_POPUP, "Play failed\n(%s)", GetErrorMessage(r));
return;
}
ShowFooterItem(0, false); //ShowFooterItem(int index, bool show). index = 0 for Play and 1 for Stop button.\r
if (__recordedTime == 0)
{
AppLog("Clip Too short so reset");
- MessageBox msgBox;
- int modalResult = 0;
- msgBox.Construct("Warning", "Clip too short so reseting the application", MSGBOX_STYLE_NONE, 3000);
- msgBox.ShowAndWait(modalResult);
- AppLog("modal Result - %d", modalResult);
- Draw();
+ ShowMessagePopup("Warning", "Clip too short so application will reset", ID_ERROR_POPUP);
return E_INVALID_ARG;
}
String maxTime;
else
{
AppLog("Clip Too short so reset");
- MessageBox msgBox;
- int modalResult = 0;
- msgBox.Construct("Warning", "Clip too short so reseting the applicaiton", MSGBOX_STYLE_NONE, 3000);
- msgBox.ShowAndWait(modalResult);
- AppLog("modal Result - %d", modalResult);
+ ShowMessagePopup("Warning", "Clip too short so application will reset", ID_ERROR_POPUP);
return E_INVALID_ARG;
}
}
//Tone list is constructed & added.
//Tones A,B,C,D not added in UI so ignoring those enums.
r = __toneList.Construct(toneCount + 1);
- TryCatch(r == E_SUCCESS, ShowMessageBox("Error", "__toneList Construct failed\n(%s)", GetErrorMessage(r)), "__toneList Construct failed");
+ TryCatch(r == E_SUCCESS, ShowErrorMessagePopup("Error", ID_POPUP_CLEAR, "__toneList Construct failed\n(%s)", GetErrorMessage(r)), "__toneList Construct failed");
__pTones = new (std::nothrow) Tone[toneCount + 1];
TryCatch(__pTones != null, r = E_OUT_OF_MEMORY, "__pTones could not be created\n(%s)", GetErrorMessage(r));
{
pErrorString = reinterpret_cast<const char*> (pByteBuffer->GetPointer());
}
- ShowMessageBox( GetErrorMessage(r), pErrorString);
+ ShowErrorMessagePopup(GetErrorMessage(GetLastResult()), ID_ERROR_POPUP, pErrorString);
__showErrorCalled = true;
delete pByteBuffer;
__inErrorState = false;
}
}
break;
-
+ case ID_ERROR_POPUP:
+ ClearErrorPopup();
+ break;
default:
break;
}
PLAY_STATE_STOP,
PLAY_STATE_ERROR
};
+ CONST_INT(ID_ERROR_POPUP);
+
Tizen::Ui::Controls::Progress* __pProgressBar;
Tizen::Ui::Controls::EditArea* __pEditFileInformations;
Tizen::Base::String __filename;
{
pErrorString = (char*) pByteBuffer->GetPointer();
}
- ShowMessageBox((const char*) GetErrorMessage(r), (const char*) pErrorString);
+ ShowErrorMessagePopup(GetErrorMessage(r), ID_ERROR_POPUP, pErrorString);
__showErrorCalled = true;
if (pByteBuffer != null)
{
}
}
break;
-
+ case ID_ERROR_POPUP:
+ ClearErrorPopup();
+ break;
default:
break;
}
virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
const Tizen::Ui::Scenes::SceneId& nextSceneId);
private:
+ CONST_INT(ID_ERROR_POPUP);
enum PlayState
{
STATE_IDLE,
{
pErrorString = (char*) pByteBuffer->GetPointer();
}
- ShowMessageBox((const char*) GetErrorMessage(r), (const char*) pErrorString);
+ ShowErrorMessagePopup(GetErrorMessage(r), ID_ERROR_POPUP, pErrorString);
__showErrorCalled = true;
delete pByteBuffer;
__inErrorState = false;
AppLog("VideoDecoderForm VIDEO NEXT is clicked! EXIT \n");
}
break;
-
+ case ID_ERROR_POPUP:
+ ClearErrorPopup();
+ break;
default:
break;
}
virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
const Tizen::Ui::Scenes::SceneId& nextSceneId);
private:
+ CONST_INT(ID_ERROR_POPUP);
enum PlayState
{
PLAY_STATE_IDLE,
{
pErrorString = (char*) pByteBuffer->GetPointer();
}
- ShowMessageBox((const char*) GetErrorMessage(r), (const char*) pErrorString);
+ ShowErrorMessagePopup(GetErrorMessage(r), ID_ERROR_POPUP, pErrorString);
__showErrorCalled = true;
delete pByteBuffer;
__inErrorState = false;
AppLog("Codec Selection Button is clicked! EXIT \n");
}
break;
-
+ case ID_ERROR_POPUP:
+ ClearErrorPopup();
+ break;
default:
break;
}
virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
const Tizen::Ui::Scenes::SceneId& nextSceneId);
private:
+ CONST_INT(ID_ERROR_POPUP);
enum PlayState
{
STATE_IDLE,
}
void
+MultiForm::ShowErrorMessagePopup(String title,unsigned int actionId, const char* pFormat,...)
+{
+ int orientationStatus = 0;
+ Rectangle popupLableRect;
+ int xPos = 0;
+ int yPos = 0;
+ va_list ap;
+ char text[1024];
+ String msg;
+
+ va_start(ap, pFormat);
+ vsnprintf(text, sizeof(text), pFormat, ap);
+ va_end(ap);
+ msg = text;
+
+ 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(msg);
+ _pErrorMessagePopupLabel->RequestRedraw();
+
+ _pErrorMessagePopup->Show();
+ return;
+FAIL:
+ AppLog("MessagePopup Show failed due to OUT_OF_MEMORY");
+}
+
+void
MultiForm::ClearErrorPopup(void)
{
if (_pErrorMessagePopup != null)
return _inErrorState;
}
-result
-MultiForm::ShowMessageBox(const char* pTitle, const char* pFormat, ...)
-{
- MessageBox msgBox;
- va_list ap;
- char text[1024];
- String msg;
- int ret;
-
- va_start(ap, pFormat);
- vsnprintf(text, sizeof(text), pFormat, ap);
- va_end(ap);
- msg = text;
-
- msgBox.Construct(pTitle, msg, MSGBOX_STYLE_OK);
- msgBox.ShowAndWait(ret);
- return E_SUCCESS;
-}
-
Tizen::Graphics::Rectangle
MultiForm::GetClientBounds(Tizen::Ui::Control& ctrl) const
{
void
CaptureVideoForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
{
- result r, ret = E_SUCCESS;
+ result r = E_SUCCESS;
int index;
AppLog("UserEvent:%d %x", requestId, pArgs);
switch (requestId)
break;
case ID_PLAYER_EOS:
- __pLog->Log("\nEOS:%s", GetErrorMessage(ret));
- if (ret != E_SUCCESS)
- ShowMessageBox("Error", "Player Error\n(%s)", GetErrorMessage(ret));
+ __pLog->Log("EOS");
SendUserEvent(ID_RESET, 0);
SAFE_DELETE(pArgs);
CATCH:
if (IsFailed(r))
{
- //ShowErrorMessageBox(path, L"Media content open failed");
ShowMessagePopup(String(L"Error"), String("Media content open failed\n") + String(GetErrorMessage(r)), ID_ERROR_POPUP);
}
return r;
#define MEDIA_PLAYER_SECTION_NAME L"MediaPlayer"
-static const int ERROR_MESSAGE_POPUP_WIDTH = 400;
-static const int ERROR_MESSAGE_POPUP_HEIGHT = 480;
-
-static const int ERROR_MESSAGE_POPUP_BUTTON_X = 150;
-static const int ERROR_MESSAGE_POPUP_BUTTON_Y = 336;
-static const int ERROR_MESSAGE_POPUP_BUTTON_W = 100;
-static const int ERROR_MESSAGE_POPUP_BUTTON_H = 60;
-
-static const int ERROR_MESSAGE_POPUP_LABEL_X = 0;
-static const int ERROR_MESSAGE_POPUP_LABEL_Y = 0;
-static const int ERROR_MESSAGE_POPUP_LABEL_W = 395;
-static const int ERROR_MESSAGE_POPUP_LABEL_H = 300;
-static const int ERROR_MESSAGE_POPUP_LABEL_TEXT_FONT = 30;
-
static const int MIN_PERCENT_COUNT = 0;
static const int PROGRESS_TIMER_DURATION = 250;
static const int DEFAULT_VOLUME_LEVEL = 100;
return E_SUCCESS;
}
-void
-PlayerForm::ShowErrorMessageBox(String strText1, String strText2)
-{
- MessageBox messageBox;
- messageBox.Construct(strText1, strText2, MSGBOX_STYLE_NONE, 2000);
- int modalResult = 0;
- messageBox.ShowAndWait(modalResult);
- return;
-}
-
result
PlayerForm::GetFilePathFromConfig(void)
{
}
void
-PlayerForm::ShowErrorMessagePopup(String Class, const char* method, result r, const char* srcfileName, int lineNo, String errorMsg)
-{
- String errorMessage;
-
- if (__inErrorState == true)
- {
- AppLog("Already in the error state");
- return;
- }
-
- __inErrorState = true;
- AppLog("ShowErrorMessagePopup");
- __pPopupMessage = new (std::nothrow) Popup;
- __pPopupMessage->Construct(true, Dimension(ERROR_MESSAGE_POPUP_WIDTH, ERROR_MESSAGE_POPUP_HEIGHT));
- __pPopupMessage->SetTitleText(L"Error");
-
- __pErrorMessagePopupLabel = new (std::nothrow) Label;
- __pErrorMessagePopupLabel->Construct(Rectangle(ERROR_MESSAGE_POPUP_LABEL_X,
- ERROR_MESSAGE_POPUP_LABEL_Y,
- ERROR_MESSAGE_POPUP_LABEL_W,
- ERROR_MESSAGE_POPUP_LABEL_H), L"");
- __pPopupMessage->AddControl(*__pErrorMessagePopupLabel);
-
- __pErrorMessagePopupBtn = new (std::nothrow) Button;
- __pErrorMessagePopupBtn->Construct(Rectangle(ERROR_MESSAGE_POPUP_BUTTON_X,
- ERROR_MESSAGE_POPUP_BUTTON_Y,
- ERROR_MESSAGE_POPUP_BUTTON_W,
- ERROR_MESSAGE_POPUP_BUTTON_H),
- L"Ok");
- __pErrorMessagePopupBtn->SetActionId(ID_BUTTON_ERROR_POPUP_OK);
- __pErrorMessagePopupBtn->AddActionEventListener(*this);
-
- __pPopupMessage->AddControl(*__pErrorMessagePopupBtn);
-
- __pPopupMessage->SetShowState(true);
-
- errorMessage.Append(L"Path:");
- errorMessage.Append(__relativePath);
- errorMessage.Append('\n');
- errorMessage.Append(L"Class:");
- errorMessage.Append(Class);
- errorMessage.Append('\n');
- errorMessage.Append(L"Method:");
- errorMessage.Append(method);
- errorMessage.Append('\n');
- errorMessage.Append(L"Error:");
- if (errorMsg.GetLength())
- {
- errorMessage.Append(errorMsg);
- }
- else
- {
- errorMessage.Append(GetErrorMessage(r));
- }
- errorMessage.Append('\n');
- errorMessage.Append(L"File:");
- errorMessage.Append(srcfileName);
- errorMessage.Append('\n');
- errorMessage.Append(L"Line:");
- errorMessage.Append(lineNo);
-
- __pErrorMessagePopupLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
- __pErrorMessagePopupLabel->SetTextConfig(ERROR_MESSAGE_POPUP_LABEL_TEXT_FONT, LABEL_TEXT_STYLE_NORMAL);
- __pErrorMessagePopupLabel->SetText(errorMessage);
- __pErrorMessagePopupLabel->Draw();
-
- r = __pPopupMessage->Show();
- AppLog("__pPopupMessage Show: %s", GetErrorMessage(r));
-}
-
-void
-PlayerForm::ClearErrorMessagePopup(void)
-{
- AppLog("Enter ");
- if (__pPopupMessage != null)
- {
- __pPopupMessage->RemoveAllControls();
- __pPopupMessage->SetShowState(false);
- SAFE_DELETE(__pPopupMessage);
- }
- __inErrorState = false;
-}
-
-void
PlayerForm::RefreshButtonTexts(void)
{
AppLog("Enter ");
r = __pPlayer->Play();
if (r == E_DEVICE_BUSY)
{
- ShowMessageBox("Error", "Play failed\n(%s)\n%ls", GetErrorMessage(r), __filePath.GetPointer());
+ ShowErrorMessagePopup("Error", ID_ERROR_POPUP, "Play failed\n(%s)\n%ls", GetErrorMessage(r), __filePath.GetPointer());
return;
}
if (IsFailed(r))
{
ShowFooterItem(ID_PLAY - FOOTER_ITEM_BASE, false);
- ShowMessageBox("Error", "Play failed\n(%s)\n%ls", GetErrorMessage(r), __filePath.GetPointer());
+ ShowErrorMessagePopup("Error", ID_ERROR_POPUP, "Play failed\n(%s)\n%ls", GetErrorMessage(r), __filePath.GetPointer());
return;
}
break;
case ID_BUTTON_ERROR_POPUP_OK:
- ClearErrorMessagePopup();
+ ClearErrorPopup();
Draw();
if ((__isPausedInMove == true) && (__pPlayer) && (__pPlayer->GetState() == PLAYER_STATE_PAUSED))
{
if (IsFailed(r))
{
AppLog("pPlayer->OpenFile has failed\n");
- ShowMessageBox("Error", "OpenUrl failed\n(%s)\n%ls", GetErrorMessage(r), __filePath.GetPointer());
+ ShowErrorMessagePopup("Error", ID_ERROR_POPUP, "OpenUrl failed\n(%s)\n%ls", GetErrorMessage(r), mediaUri.ToString().GetPointer());
return r;
}
__isUrlContent = true;
if (IsFailed(r))
{
AppLog("pPlayer->OpenFile has failed\n");
- ShowMessageBox("Error", "OpenFile failed\n(%s)\n%ls", GetErrorMessage(r), __filePath.GetPointer());
+ ShowErrorMessagePopup("Error", ID_ERROR_POPUP, "OpenFile failed\n(%s)\n%ls", GetErrorMessage(r),__filePath.GetPointer());
return r;
}
ShowFooterItem(ID_PLAY - FOOTER_ITEM_BASE, true);
ShowFooterItem(ID_PLAY - FOOTER_ITEM_BASE, true);
if (r != E_SUCCESS)
{
- ShowErrorMessagePopup(L"PlayerForm", __FUNCTION__, r, __FILE__, __LINE__);
+ ShowErrorMessagePopup(L"Error", ID_ERROR_POPUP, "SeekTo failed with %s", GetErrorMessage(r));
}
if ((__isPausedInMove == true) && (__pPlayer->GetState() == PLAYER_STATE_PAUSED))
{
nCurPercent = __progressCnt;
UpdateProgressBar(nCurPercent);
}
- ShowErrorMessagePopup(L"PlayerForm", __FUNCTION__, r, __FILE__, __LINE__);
+ ShowErrorMessagePopup(L"Error", ID_ERROR_POPUP, "SeekTo failed with %s", GetErrorMessage(r));
if (__configFileCount == 0)
{
ShowFooterItem(ID_PREV - FOOTER_ITEM_BASE, false);
Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& path, int W, int H);
result ReCreatePlayer(void);
result DrawAudioIcon(void);
- void ShowErrorMessagePopup(String Class, const char* method, result r, const char* srcfileName, int lineNo, String errorMsg = L"");
void ClearErrorMessagePopup(void);
static const int FOOTER_ITEM_BASE = 1000;
static const int ID_PREV = FOOTER_ITEM_BASE;