From: HyukSoon Choi Date: Thu, 11 Apr 2013 06:40:33 +0000 (+0900) Subject: AppControl - Crop X-Git-Tag: accepted/tizen_2.1/20130425.023641~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b475e687d56305fab06775dde72a3f1a7981d31e;p=apps%2Fosp%2FImageViewer.git AppControl - Crop Change-Id: I1f51af9485b73dde304c982b70180661a5e82bd4 Signed-off-by: HyukSoon Choi --- diff --git a/inc/IvTypes.h b/inc/IvTypes.h index ca9a0e3..e74b6e8 100644 --- a/inc/IvTypes.h +++ b/inc/IvTypes.h @@ -113,6 +113,7 @@ extern const wchar_t* APPCONTROL_KEY_SOCIAL_ITEM_TYPE; extern const wchar_t* APPCONTROL_KEY_SOCIAL_RESULT_TYPE; extern const wchar_t* APPCONTROL_KEY_MESSAGE_TYPE; extern const wchar_t* APPCONTROL_KEY_SOCIAL_ITEM_ID; +extern const wchar_t* APPCONTROL_KEY_IMAGE_CROP_MODE; extern const wchar_t* APPCONTROL_URI_MMS_TO; extern const wchar_t* APPCONTROL_URI_MAIL_TO; @@ -129,6 +130,8 @@ extern const wchar_t* APPCONTROL_DATA_ITEM_ID; extern const wchar_t* APPCONTROL_DATA_URI_FILE; extern const wchar_t* APPCONTROL_DATA_PERSON; extern const wchar_t* APPCONTROL_DATA_MMS; +extern const wchar_t* APPCONTROL_DATA_AUTO; +extern const wchar_t* APPCONTROL_DATA_FIT_TO_SCREEN; extern const wchar_t* SETTING_VALUE_HOME_SCREEN_WALLPAPER; extern const wchar_t* SETTING_VALUE_LOCK_SCREEN_WALLPAPER; @@ -163,6 +166,7 @@ extern const wchar_t* EMPTY_SPACE; extern const wchar_t* DIRECTORY_SEPARATOR; extern const wchar_t* FILE_EXT_SEPARATOR; extern const wchar_t* APPCONTROL_PATH_SEPARATOR; +extern const wchar_t* FILE_NAME_SEPARATOR; extern const wchar_t* IDB_IMAGE_VIEWERFORM_BUTTON_PLAY; extern const wchar_t* IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS; diff --git a/src/IvImageCropForm.cpp b/src/IvImageCropForm.cpp index 19f236a..2af24dc 100644 --- a/src/IvImageCropForm.cpp +++ b/src/IvImageCropForm.cpp @@ -24,6 +24,7 @@ #include #include #include "IvImageCropForm.h" +#include "IvImageViewerApp.h" #include "IvImageViewerPresentationModel.h" #include "IvResourceManager.h" #include "IvTypes.h" @@ -44,7 +45,8 @@ static const unsigned int CROP_BOX_RECTANGLE_COLOR = Color32<199, 110, 6>::Value static const int CROP_BOX_LINE_WIDTH = 5; ImageCropForm::ImageCropForm(void) - : __imageHeight(0) + : __cropMode(APPCONTROL_DATA_AUTO) + , __imageHeight(0) , __imageWidth(0) , __isOrientationChanged(false) , __pCanvas(null) @@ -85,8 +87,6 @@ ImageCropForm::Initialize(void) result ImageCropForm::OnInitializing(void) { - result r = E_SUCCESS; - AppResource* pAppResource = null; Bitmap* pSaveButtonBitmap = null; Bitmap* pCancelButtonBitmap = null; @@ -136,7 +136,7 @@ ImageCropForm::OnInitializing(void) AddOrientationEventListener(*this); __pPresentationModel->AddFileUpdateListener(this); - return r; + return E_SUCCESS; } void @@ -145,85 +145,61 @@ ImageCropForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& AppLogDebug("ENTER pArgs(%x)", pArgs); if (pArgs != null) { - IEnumerator* pEnum = pArgs->GetEnumeratorN(); - if (pEnum->MoveNext() != E_SUCCESS) - { - delete pEnum; - delete pArgs; - AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + __sourceFilePath = *(static_cast(pArgs->GetAt(0))); + __cropMode = *(static_cast(pArgs->GetAt(1))); + } + else + { + __sourceFilePath = __pPresentationModel->GetFilePathAt(0); - return; - } - __sourceFilePath = *(static_cast(pEnum->GetCurrent())); - if (__sourceFilePath.IsEmpty() == false) + ImageViewerApp* pImageViewerApp = static_cast(ImageViewerApp::GetInstance()); + const IMap* pIMap = pImageViewerApp->GetAppControlArguments(); + + if (pIMap != null) { - result r = __imageBuffer.Construct(__sourceFilePath.GetPointer()); - if (r == E_SUCCESS) + const String* pCropMode = static_cast(pIMap->GetValue(String(APPCONTROL_KEY_IMAGE_CROP_MODE))); + + if (pCropMode != null) { - __imageWidth = __imageBuffer.GetWidth(); - __imageHeight = __imageBuffer.GetHeight(); - __pCurrentBitmap = __imageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_RGB565, BUFFER_SCALING_AUTO); + __cropMode = *pCropMode; } - Image img; - __imageFormat = img.GetImageFormat(__sourceFilePath); } - if (pEnum->MoveNext() != E_SUCCESS) + } + + if (__sourceFilePath.IsEmpty() == false) + { + result r = __imageBuffer.Construct(__sourceFilePath.GetPointer()); + if (r == E_SUCCESS) { - delete pEnum; - delete pArgs; - AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); + __imageWidth = __imageBuffer.GetWidth(); + __imageHeight = __imageBuffer.GetHeight(); + __pCurrentBitmap = __imageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_RGB565, BUFFER_SCALING_AUTO); + } + Image img; + __imageFormat = img.GetImageFormat(__sourceFilePath); + } - return; + if (__cropMode == APPCONTROL_DATA_AUTO) + { + SetValue(); + return; + } + else if (__cropMode == APPCONTROL_DATA_FIT_TO_SCREEN) + { + Integer *pStatus = static_cast(pArgs->GetAt(2)); + if (pStatus != null) + { + __statusValue = pStatus->ToInt(); } - __cropMode = *(static_cast(pEnum->GetCurrent())); - if (__cropMode.IsEmpty() == false) + if (__statusValue == SET_AT_TYPE_CALLER_IMAGE) { - __cropMode.ToLowerCase(); - if (__cropMode == "auto") - { - delete pEnum; - delete pArgs; - SetValue(); - return; - } - else if (__cropMode == "fit-to-screen") + LongLong* pContentId = static_cast(pArgs->GetAt(3)); + if (pContentId != null) { - if (pEnum->MoveNext() != E_SUCCESS) - { - delete pEnum; - delete pArgs; - AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult())); - - return; - } - Integer *pStatus = static_cast(pEnum->GetCurrent()); - if (pStatus != null) - { - __statusValue = pStatus->ToInt(); - } - if (__statusValue == SET_AT_TYPE_CALLER_IMAGE) - { - if (pEnum->MoveNext() != E_SUCCESS) - { - delete pEnum; - delete pArgs; - AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult())); - - return; - } - - LongLong* pContentId = static_cast(pEnum->GetCurrent()); - if (pContentId != null) - { - __contentId = pContentId->ToLongLong(); - } - } - - delete pEnum; - delete pArgs; - SetValue(); + __contentId = pContentId->ToLongLong(); } } + SetValue(); } AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } @@ -254,7 +230,7 @@ ImageCropForm::OnDraw(void) r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x + __cropBox.width - (CROP_RECTANGLE_HEIGHT / 2), (__cropBox.y + __cropBox.height - (CROP_RECTANGLE_HEIGHT / 2)), CROP_RECTANGLE_HEIGHT, CROP_RECTANGLE_HEIGHT), *__pRectangleBitmap); // Bottom Right Rectangle r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x - (CROP_RECTANGLE_HEIGHT / 2), (__cropBox.y + __cropBox.height - (CROP_RECTANGLE_HEIGHT / 2)), CROP_RECTANGLE_HEIGHT, CROP_RECTANGLE_HEIGHT), *__pRectangleBitmap); // Bottom Left Rectangle } - AppLogDebug("EXIT"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); return r; } @@ -269,20 +245,18 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) break; case IDA_BUTTON_SAVE: { - if (__cropMode == "auto") + if (__cropMode == APPCONTROL_DATA_AUTO) { ImageBuffer* pCropBuffer = null; int count = 1; int index = 0; String destFilePath; - String stringToInsert = L"_"; - String delimiter = L"."; if (__sourceFilePath.IsEmpty() == false) { __sourceFilePath.Reverse(); - __sourceFilePath.IndexOf(delimiter, 0, index); + __sourceFilePath.IndexOf(FILE_EXT_SEPARATOR, 0, index); __sourceFilePath.Reverse(); - __sourceFilePath.Insert(stringToInsert, __sourceFilePath.GetLength() - index - 1); + __sourceFilePath.Insert(FILE_NAME_SEPARATOR, __sourceFilePath.GetLength() - index - 1); destFilePath.Append(__sourceFilePath); destFilePath.Insert(count, destFilePath.GetLength() - index - 1); while (File::IsFileExist(destFilePath) == true) @@ -302,7 +276,7 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) pList->Add(new (std::nothrow) String(destFilePath)); pSceneManager->GoBackward(BackwardSceneTransition(), pList); } - else if(__cropMode == "fit-to-screen") + else if(__cropMode == APPCONTROL_DATA_FIT_TO_SCREEN) { ImageBuffer* pCropBuffer = null; result r = E_SUCCESS; @@ -310,40 +284,26 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) (__cropBox.width * __imageWidth) / __imageBox.width, (__cropBox.height * __imageHeight) / __imageBox.height); if (__statusValue == SET_AT_TYPE_HOME_SCREEN_WALLPAPER) { - String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER; + String destPath = App::GetInstance()->GetAppDataPath() + TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER; r = pCropBuffer->EncodeToFile(destPath, __imageFormat, true, 100); if (r == E_SUCCESS) { r = SettingInfo::SetValue(SETTING_VALUE_HOME_SCREEN_WALLPAPER, destPath); } - else if (r == E_OVERFLOW) - { - MessageBox messageBox; - messageBox.Construct(L"", L"File size is too big", MSGBOX_STYLE_NONE, 3000); - int modalResult = 0; - messageBox.ShowAndWait(modalResult); - } } else if (__statusValue == SET_AT_TYPE_LOCK_SCREEN_WALLPAPER) { - String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER; + String destPath = App::GetInstance()->GetAppDataPath() + TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER; r = pCropBuffer->EncodeToFile(destPath, __imageFormat, true, 100); if (r == E_SUCCESS) { r = SettingInfo::SetValue(SETTING_VALUE_LOCK_SCREEN_WALLPAPER, destPath); } - else if (r == E_OVERFLOW) - { - MessageBox messageBox; - messageBox.Construct(L"", L"File size is too big", MSGBOX_STYLE_NONE, 3000); - int modalResult = 0; - messageBox.ShowAndWait(modalResult); - } } else if (__statusValue == SET_AT_TYPE_HOME_AND_LOCK_SCREEN_WALLPAPER) { - String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER; - String destPathHome = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER; + String destPath = App::GetInstance()->GetAppDataPath() + TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER; + String destPathHome = App::GetInstance()->GetAppDataPath() + TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER; r = pCropBuffer->EncodeToFile(destPath, __imageFormat, true, 100); r = pCropBuffer->EncodeToFile(destPathHome, __imageFormat, true, 100); if (r == E_SUCCESS) @@ -364,14 +324,13 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) int count = 1; int index = 0; String destFilePath; - String stringToInsert = L"_"; - String delimiter = L"."; + if (__sourceFilePath.IsEmpty() == false) { __sourceFilePath.Reverse(); - __sourceFilePath.IndexOf(delimiter, 0, index); + __sourceFilePath.IndexOf(FILE_EXT_SEPARATOR, 0, index); __sourceFilePath.Reverse(); - __sourceFilePath.Insert(stringToInsert, __sourceFilePath.GetLength() - index - 1); + __sourceFilePath.Insert(FILE_NAME_SEPARATOR, __sourceFilePath.GetLength() - index - 1); destFilePath.Append(__sourceFilePath); destFilePath.Insert(count, destFilePath.GetLength() - index - 1); while (File::IsFileExist(destFilePath) == true) @@ -399,7 +358,7 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); pList->Add(new (std::nothrow) String(destFilePath)); pSceneManager->GoBackward(BackwardSceneTransition(), pList); - AppLog("Exit"); + AppLogDebug("EXIT(%s)1", GetErrorMessage(GetLastResult())); return; } delete pCropBuffer; @@ -408,7 +367,7 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) } break; } - AppLog("Exit"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } void @@ -418,7 +377,7 @@ ImageCropForm::OnOrientationChanged(const Control &source, OrientationStatus ori __isOrientationChanged = true; SetValue(); __pCanvas->Clear(); - AppLogDebug("EXIT"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } void @@ -427,7 +386,7 @@ ImageCropForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Gra AppLogDebug("ENTER"); __touchStart = currentPosition; CheckCurrentPosition(currentPosition); - AppLogDebug("EXIT"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } void @@ -436,7 +395,7 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph AppLogDebug("ENTER"); int deltaX = currentPosition.x - __touchStart.x; int deltaY = currentPosition.y - __touchStart.y; - if (__cropMode.Equals("auto", false)) + if (__cropMode.Equals(APPCONTROL_DATA_AUTO, false)) { switch(__pointLocation) { @@ -561,7 +520,7 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph break; } } - else if (__cropMode != "auto") + else if (__cropMode != APPCONTROL_DATA_AUTO) { if (__pointLocation == INSIDE_LEFT_RECTANGLE || __pointLocation == INSIDE_BOTTOM_LEFT_RECTANGLE || __pointLocation == INSIDE_TOP_LEFT_RECTANGLE) @@ -828,7 +787,7 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph } RequestRedraw(false); __touchStart = currentPosition; - AppLogDebug("EXIT"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } void @@ -836,7 +795,7 @@ ImageCropForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Gr { AppLogDebug("ENTER"); __pointLocation = OUTSIDE_CROPBOX; - AppLogDebug("EXIT"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } void @@ -891,7 +850,7 @@ ImageCropForm::CheckCurrentPosition(const Point currentPosition) { __pointLocation = OUTSIDE_CROPBOX; } - AppLogDebug("EXIT"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); return; } diff --git a/src/IvImageInfo.cpp b/src/IvImageInfo.cpp index 631d90b..31f46c6 100644 --- a/src/IvImageInfo.cpp +++ b/src/IvImageInfo.cpp @@ -41,7 +41,7 @@ ImageInfo::~ImageInfo(void) void ImageInfo::Construct(const String& pFilePath, Bitmap* pBitmap) { - AppLogDebug("Enter"); + AppLogDebug("ENTER"); __pFilePath = pFilePath; __pBitmap = pBitmap; AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); @@ -50,7 +50,7 @@ ImageInfo::Construct(const String& pFilePath, Bitmap* pBitmap) String ImageInfo::GetFilePath(void) const { - AppLogDebug("Enter"); + AppLogDebug("ENTER"); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); return __pFilePath; } @@ -58,7 +58,7 @@ ImageInfo::GetFilePath(void) const void ImageInfo::SetFilePath(const String& filePath) { - AppLogDebug("Enter"); + AppLogDebug("ENTER"); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); __pFilePath = filePath; } @@ -66,7 +66,7 @@ ImageInfo::SetFilePath(const String& filePath) Bitmap* ImageInfo::GetBitmapN(void) const { - AppLogDebug("Enter"); + AppLogDebug("ENTER"); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); return CommonUtil::CloneBitmapN(*__pBitmap); } @@ -74,7 +74,7 @@ ImageInfo::GetBitmapN(void) const void ImageInfo::SetBitmap(Tizen::Graphics::Bitmap* pBitmap) { - AppLogDebug("Enter pBitmap(%x)", pBitmap); + AppLogDebug("ENTER pBitmap(%x)", pBitmap); if (__pBitmap != null) { delete __pBitmap; @@ -86,7 +86,7 @@ ImageInfo::SetBitmap(Tizen::Graphics::Bitmap* pBitmap) void ImageInfo::ClearBitmap(void) { - AppLogDebug("Enter"); + AppLogDebug("ENTER"); delete __pBitmap; __pBitmap = null; AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); diff --git a/src/IvImageNameEditorForm.cpp b/src/IvImageNameEditorForm.cpp index 629933d..3cc77f0 100644 --- a/src/IvImageNameEditorForm.cpp +++ b/src/IvImageNameEditorForm.cpp @@ -163,7 +163,7 @@ ImageNameEditorForm::OnActionPerformed(const Control& source, int actionId) { String fileName = File::GetFileName(filePath); String fileExtension = File::GetFileExtension(filePath); - String tempFileName = __nameEditFieldText + L"." + fileExtension; + String tempFileName = __nameEditFieldText + FILE_EXT_SEPARATOR + fileExtension; filePath.Replace(fileName, tempFileName); if (File::IsFileExist(filePath) == true) diff --git a/src/IvImageViewerApp.cpp b/src/IvImageViewerApp.cpp index c70fdfc..1b269fc 100644 --- a/src/IvImageViewerApp.cpp +++ b/src/IvImageViewerApp.cpp @@ -183,30 +183,25 @@ ImageViewerApp::OnAppControlRequestReceived(RequestId reqId, const String& opera return; } - AppLogDebug("ENTER2"); + const String* pType = static_cast(pExtraData->GetValue(String(APPCONTROL_KEY_TYPE))); const ArrayList* pList = static_cast(pExtraData->GetValue(String(APPCONTROL_KEY_PATH))); const String* pIndex = static_cast(pExtraData->GetValue(String(APPCONTROL_KEY_INDEX))); - AppLogDebug("ENTER3"); + if (pType != null) { - AppLogDebug("ENTER4"); pArguments->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(*pType)); } if (pList != null) { - AppLog("Check pointer(%x) pExtraData(%x)", pList, pExtraData); - AppLogDebug("ENTER5"); ArrayList* pArrayList = new (std::nothrow) ArrayList(); pArrayList->Construct(); const String* temp; - AppLogDebug("ENTER6"); int loopCount = pList->GetCount(); - AppLogDebug("ENTER7 loopCount(%d)", loopCount); + for (int i = 0; i < loopCount; ++i) { temp = static_cast(pList->GetAt(i)); - AppLogDebug("ENTER8 temp(%ls)", temp->GetPointer()); pArrayList->Add(new (std::nothrow) String(*temp)); } pArguments->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), pArrayList); diff --git a/src/IvImageViewerForm.cpp b/src/IvImageViewerForm.cpp index 1739984..07f9c5c 100644 --- a/src/IvImageViewerForm.cpp +++ b/src/IvImageViewerForm.cpp @@ -1460,10 +1460,10 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) messageBox.ShowAndWait(modalResult); return; } - String cropMode = L"auto"; + ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); pList->Add(new (std::nothrow) String(filePath)); - pList->Add(new (std::nothrow) String(cropMode)); + pList->Add(new (std::nothrow) String(APPCONTROL_DATA_AUTO)); pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList); } break; @@ -1511,7 +1511,7 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) case ACTION_ID_CONTEXTMENU_HOME: { String filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex()); - String cropMode = "fit-to-screen"; + String cropMode = APPCONTROL_DATA_FIT_TO_SCREEN; ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); pList->Add(new (std::nothrow) String(filePath)); pList->Add(new (std::nothrow) String(cropMode)); @@ -1522,7 +1522,7 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) case ACTION_ID_CONTEXTMENU_LOCK: { String filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex()); - String cropMode = "fit-to-screen"; + String cropMode = APPCONTROL_DATA_FIT_TO_SCREEN; ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); pList->Add(new (std::nothrow) String(filePath)); pList->Add(new (std::nothrow) String(cropMode)); @@ -1549,7 +1549,7 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) case ACTION_ID_CONTEXTMENU_HOME_AND_LOCK: { String filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex()); - String cropMode = "fit-to-screen"; + String cropMode = APPCONTROL_DATA_FIT_TO_SCREEN; ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); pList->Add(new (std::nothrow) String(filePath)); pList->Add(new (std::nothrow) String(cropMode)); @@ -1746,7 +1746,7 @@ ImageViewerForm::OnAppControlCompleteResponseReceived(const AppId& appId, { LongLong::Parse(*pContactId, lresult); String filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex()); - String cropMode = "fit-to-screen"; + String cropMode = APPCONTROL_DATA_FIT_TO_SCREEN; ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); pList->Add(new (std::nothrow) String(filePath)); pList->Add(new (std::nothrow) String(cropMode)); @@ -1873,29 +1873,23 @@ ImageViewerForm::OnTimerExpired(Timer &timer) void ImageViewerForm::CreateShuffledList(int count) { - AppLogDebug("ImageViewerForm::CreateShuffledList ENTER"); + AppLogDebug("ENTER"); if(__pShuffledList == null) { __pShuffledList = new (std::nothrow) int[count]; - for(int i = 0; i < count; i++) + for(int i = 0; i < count; ++i) { __pShuffledList[i] = i; } } - for(int i = count - 1; i > 1; i--) + for(int i = count - 1; i > 1; --i) { int randomNum = Math::Rand() % (i+1); int t = __pShuffledList[randomNum]; __pShuffledList[randomNum] = __pShuffledList[i]; __pShuffledList[i] = t; } - - for(int i = 0; i < count; i++) - { - AppLogDebug("ShuffeldList i = %d & Val = %d", i, __pShuffledList[i]); - } - - AppLogDebug("ImageViewerForm::CreateShuffledList EXIT"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } void @@ -1918,9 +1912,6 @@ ImageViewerForm::OnContentDownloadCompleted(RequestId requestId, ContentId conte result transferResult, const String& errorCode, const String& errorMessage) { AppLogDebug("ENTER"); - AppLogTag("IV", "ImageViewerForm::OnContentDownloadCompleted"); - AppLogTag("IV", "DownloadCompleted Error [%s]", GetErrorMessage(transferResult)); - AppLogTag("IV", "errorCode [%ls] errorMessage [%ls]", errorCode.GetPointer(), errorMessage.GetPointer()); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } @@ -2250,7 +2241,7 @@ ImageViewerForm::OnSlideSettingPopUpItemSelected(int index) __pPopUp->SetShowState(false); } - if (index == 0) // start slide show + if (index == 0) { int repeatValue = 0; int interval = 0 ; @@ -2262,11 +2253,8 @@ ImageViewerForm::OnSlideSettingPopUpItemSelected(int index) __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER, ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, interval); - interval = interval * 1000; - AppLogDebug("The slide interval is %d", interval); - __pGallery->SetSlideShowViewDuration(interval); - - + interval = interval * 1000; + __pGallery->SetSlideShowViewDuration(interval); __pGallery->UpdateGallery(); if (__detail == false) @@ -2318,7 +2306,7 @@ ImageViewerForm::OnSlideSettingPopUpItemSelected(int index) } } } - else if (index == 1) // launch settings + else if (index == 1) { __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_GALLERY, APPCONTROL_OPERATION_ID_CONFIGURE, null, null, null, this); diff --git a/src/IvImageViewerPresentationModel.cpp b/src/IvImageViewerPresentationModel.cpp index d661967..415610b 100644 --- a/src/IvImageViewerPresentationModel.cpp +++ b/src/IvImageViewerPresentationModel.cpp @@ -115,8 +115,6 @@ ImageViewerPresentationModel::Construct(void) const ArrayList* pList = static_cast(pArguments->GetValue(String(APPCONTROL_KEY_PATH))); const String* pIndex = static_cast(pArguments->GetValue(String(APPCONTROL_KEY_INDEX))); - AppLog("pType %x pList %x pIndex %x", pType, pList, pIndex); - if (pIndex != null) { Integer::Parse(*pIndex, __startIndex); @@ -138,8 +136,6 @@ ImageViewerPresentationModel::Construct(void) { pImageInfo = new (std::nothrow) ImageInfo(); tempPath = *(const_cast(static_cast(pList->GetAt(i)))); - AppLog("(%d) tempPath(%ls)", i, tempPath.GetPointer()); - pImageInfo->Construct(tempPath, null); __pImageCaches->Add(pImageInfo); tempPath.Clear(); @@ -492,12 +488,13 @@ ImageViewerPresentationModel::OnImageReceivedN(IEventArg& eventArg) } } } - AppLogDebug("Exit"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } void ImageViewerPresentationModel::LoadSettingValue() { + AppLogDebug("ENTER"); int returnValue = 0; __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER, @@ -520,10 +517,13 @@ ImageViewerPresentationModel::LoadSettingValue() default: break; } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } -int ImageViewerPresentationModel::GetImageCacheIndex(const String& afilePath) +int +ImageViewerPresentationModel::GetImageCacheIndex(const String& afilePath) { + AppLogDebug("ENTER"); int loopCount = __pImageCaches->GetCount(); String filePath; ImageInfo* pImageInfo; @@ -535,32 +535,41 @@ int ImageViewerPresentationModel::GetImageCacheIndex(const String& afilePath) if (afilePath == filePath) { AppLogDebug(" returning the index %d", i); + AppLogDebug("EXIT(%s)1", GetErrorMessage(GetLastResult())); return i; } } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); return -1; } -void ImageViewerPresentationModel::OnContentFileCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r) +void +ImageViewerPresentationModel::OnContentFileCreated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r) { - AppLogDebug(" Enter"); - AppLogDebug(" Exit"); + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } -void ImageViewerPresentationModel::OnContentFileUpdated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r) + +void +ImageViewerPresentationModel::OnContentFileUpdated(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r) { - AppLogDebug(" Enter"); - AppLogDebug(" Exit"); + AppLogDebug("ENTER"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } -void ImageViewerPresentationModel::OnContentFileDeleted(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r) + +void +ImageViewerPresentationModel::OnContentFileDeleted(Tizen::Content::ContentId contentId, Tizen::Content::ContentType contentType, result r) { - AppLogDebug("Enter"); + AppLogDebug("ENTER"); __contentId = contentId; __ivTriggeredDeleteEvent = true; - AppLogDebug("Exit"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } -void ImageViewerPresentationModel::OnContentDirectoryScanCompleted(const Tizen::Base::String& filePath, result r) + +void +ImageViewerPresentationModel::OnContentDirectoryScanCompleted(const Tizen::Base::String& filePath, result r) { - AppLogDebug(" Enter"); + AppLogDebug("ENTER"); AppLogDebug(" directory path is %ls", filePath.GetPointer()); if ( !__ivTriggeredEvent && __ivTriggeredDeleteEvent) { @@ -584,6 +593,5 @@ void ImageViewerPresentationModel::OnContentDirectoryScanCompleted(const Tizen:: __ivTriggeredEvent = false; } __ivTriggeredDeleteEvent = false; - AppLogDebug("Exit"); + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } - diff --git a/src/IvTypes.cpp b/src/IvTypes.cpp index b9e12f1..b708757 100644 --- a/src/IvTypes.cpp +++ b/src/IvTypes.cpp @@ -56,6 +56,7 @@ const wchar_t* APPCONTROL_KEY_SOCIAL_ITEM_TYPE = L"http://tizen.org/appcontrol/d const wchar_t* APPCONTROL_KEY_SOCIAL_RESULT_TYPE = L"http://tizen.org/appcontrol/data/social/result_type"; const wchar_t* APPCONTROL_KEY_MESSAGE_TYPE = L"http://tizen.org/appcontrol/data/message/type"; const wchar_t* APPCONTROL_KEY_SOCIAL_ITEM_ID = L"http://tizen.org/appcontrol/data/social/item_id"; +const wchar_t* APPCONTROL_KEY_IMAGE_CROP_MODE = L"http://tizen.org/appcontrol/data/image/crop_mode"; const wchar_t* APPCONTROL_URI_MMS_TO = L"mmsto"; const wchar_t* APPCONTROL_URI_MAIL_TO = L"mailto"; @@ -72,14 +73,16 @@ const wchar_t* APPCONTROL_DATA_ITEM_ID = L"item_id"; const wchar_t* APPCONTROL_DATA_URI_FILE = L"file://"; const wchar_t* APPCONTROL_DATA_PERSON = L"person"; const wchar_t* APPCONTROL_DATA_MMS = L"mms"; +const wchar_t* APPCONTROL_DATA_AUTO = L"auto"; +const wchar_t* APPCONTROL_DATA_FIT_TO_SCREEN = L"fit_to_screen"; const wchar_t* SETTING_VALUE_HOME_SCREEN_WALLPAPER = L"http://tizen.org/setting/screen.wallpaper"; const wchar_t* SETTING_VALUE_LOCK_SCREEN_WALLPAPER = L"http://tizen.org/setting/screen.wallpaper.lock"; const wchar_t* FOLDER_PATH_DOWNLOADS = L"Downloads/"; -const wchar_t* TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER = L"shared/data/home.jpg"; -const wchar_t* TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER = L"shared/data/lock.jpg"; +const wchar_t* TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER = L"home.jpg"; +const wchar_t* TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER = L"lock.jpg"; const wchar_t* TEMP_FILE_PATH_WEB_FILE = L"data/test_out.jpg"; const wchar_t* WEB_URL_HTTP = L"http://"; @@ -107,6 +110,7 @@ const wchar_t* APPCONTROL_SEPARATOR = L"/"; const wchar_t* DIRECTORY_SEPARATOR = L"/"; const wchar_t* FILE_EXT_SEPARATOR = L"."; const wchar_t* APPCONTROL_PATH_SEPARATOR = L";"; +const wchar_t* FILE_NAME_SEPARATOR = L"_"; const wchar_t* IDB_IMAGE_VIEWERFORM_BUTTON_PLAY = L"T0_1_btn_play.png"; const wchar_t* IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS = L"T01_1_controlbar_icon_detail.png";