From e2047833564efee89a1a7c9ce0e71aeda7fbfb4b Mon Sep 17 00:00:00 2001 From: chitta ranjan Date: Sat, 13 Apr 2013 21:12:22 +0900 Subject: [PATCH] 1.Cropped image destFilePath changed. 2.Coding idioms fixes Change-Id: I44aba51a607ce68134a03639f15807786ffdb18d Signed-off-by: chitta ranjan --- src/IvImageCropForm.cpp | 47 ++++++++++++++++++++++------- src/IvImageViewerForm.cpp | 75 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 89 insertions(+), 33 deletions(-) diff --git a/src/IvImageCropForm.cpp b/src/IvImageCropForm.cpp index d3f0e83..a4ce300 100644 --- a/src/IvImageCropForm.cpp +++ b/src/IvImageCropForm.cpp @@ -270,21 +270,49 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) int count = 1; int index = 0; String destFilePath; + ImageViewerApp* pApp = dynamic_cast(UiApp::GetInstance()); + if (__sourceFilePath.IsEmpty() == false) { - __sourceFilePath.Reverse(); - __sourceFilePath.IndexOf(FILE_EXT_SEPARATOR, 0, index); - __sourceFilePath.Reverse(); - __sourceFilePath.Insert(FILE_NAME_SEPARATOR, __sourceFilePath.GetLength() - index - 1); - destFilePath.Append(__sourceFilePath); - destFilePath.Insert(count, destFilePath.GetLength() - index - 1); - while (File::IsFileExist(destFilePath) == true) + if (pApp->GetAppControlOperationId() == APPCONTROL_OPERATION_ID_IMAGE_CROP) + { + destFilePath.Append(App::GetInstance()->GetAppDataPath()); + destFilePath.Append(__pPresentationModel->GetFileName(__sourceFilePath)); + destFilePath.Reverse(); + destFilePath.IndexOf(FILE_EXT_SEPARATOR, 0, index); + destFilePath.Reverse(); + destFilePath.Insert(FILE_NAME_SEPARATOR, destFilePath.GetLength() - index - 1); + destFilePath.Insert(count, destFilePath.GetLength() - index - 1); + + while (File::IsFileExist(destFilePath) == true) + { + count++; + destFilePath.Clear(); + destFilePath.Append(App::GetInstance()->GetAppDataPath()); + destFilePath.Append(__pPresentationModel->GetFileName(__sourceFilePath)); + destFilePath.Insert(FILE_NAME_SEPARATOR, destFilePath.GetLength() - index - 1); + destFilePath.Insert(count, destFilePath.GetLength() - index - 1); + } + + } + else { - count++; - destFilePath.Clear(); + __sourceFilePath.Reverse(); + __sourceFilePath.IndexOf(FILE_EXT_SEPARATOR, 0, index); + __sourceFilePath.Reverse(); + __sourceFilePath.Insert(FILE_NAME_SEPARATOR, __sourceFilePath.GetLength() - index - 1); destFilePath.Append(__sourceFilePath); destFilePath.Insert(count, destFilePath.GetLength() - index - 1); + while (File::IsFileExist(destFilePath) == true) + { + count++; + destFilePath.Clear(); + destFilePath.Append(__sourceFilePath); + destFilePath.Insert(count, destFilePath.GetLength() - index - 1); + } + } + pCropBuffer = __imageBuffer.CropN(((__cropBox.x - __imageBox.x) * __imageWidth) / __imageBox.width, ((__cropBox.y - __imageBox.y) * __imageHeight) / __imageBox.height, (__cropBox.width * __imageWidth) / __imageBox.width, (__cropBox.height * __imageHeight) / __imageBox.height); pCropBuffer->EncodeToFile(destFilePath, __imageFormat, true, 100); @@ -293,7 +321,6 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) } ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter); pList->Add(new (std::nothrow) String(destFilePath)); - ImageViewerApp* pApp = dynamic_cast(UiApp::GetInstance()); if (pApp->GetAppControlOperationId() == APPCONTROL_OPERATION_ID_IMAGE_CROP) { diff --git a/src/IvImageViewerForm.cpp b/src/IvImageViewerForm.cpp index abb9487..7298489 100644 --- a/src/IvImageViewerForm.cpp +++ b/src/IvImageViewerForm.cpp @@ -1416,22 +1416,30 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) __pContextMenuMore->Show(); } break; + case IDA_CONTEXTMENU_SET_AS: + { InitializeContextMenuSetAs(); - __pContextMenuSetAs->SetShowState(true); __pContextMenuSetAs->Show(); - break; + } + break; + case IDA_FOOTER_BUTTON_SHARE: + { InitializeContextMenuShare(); - __pContextMenuShare->SetShowState(true); __pContextMenuShare->Show(); - break; + } + break; + case IDA_FOOTER_BUTTON_DELETE: + { __pDeletePopup->SetShowState(true); __pDeletePopup->Show(); - break; + } + break; + case IDA_FOOTER_BUTTON_SLIDE: { if (__pPopUp != null) @@ -1439,9 +1447,9 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) __pPopUp->SetShowState(true); __pPopUp->Show(); } - - break; } + break; + case IDA_FOOTER_BUTTON_CROP: { String filePath; @@ -1480,6 +1488,7 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) ContentManager::ScanFile(filePath); } break; + case IDA_FOOTER_BUTTON_ROTATE_LEFT: { int currentIndex = __pGallery->GetCurrentItemIndex(); @@ -1490,27 +1499,37 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) ContentManager::ScanFile(filePath); } break; + case IDA_FOOTER_BUTTON_DETAILS: { ShowPanelDetail(__isDetail); - break; } + break; + case IDA_FOOTER_BUTTON_BACK: + { ImageViewerForm::OnFormBackRequested(*this); - break; + } + break; + case IDA_FOOTER_BUTTON_DOWNLOAD: + { DownloadFile(); - break; + } + break; + case IDA_FOOTER_BUTTON_SAVE: - break; + break; + case IDA_PANEL_HEADER_DETAILS_RENAME: { ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter); pSelectedIndex->Construct(); pSelectedIndex->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex())); pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_NAME_EDITOR), pSelectedIndex); - break; } + break; + case IDA_CONTEXTMENU_HOME: { String filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex()); @@ -1520,8 +1539,9 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) pList->Add(new (std::nothrow) String(cropMode)); pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_HOME_SCREEN_WALLPAPER)); pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList); - break; } + break; + case IDA_CONTEXTMENU_LOCK: { String filePath = __pPresentationModel->GetFilePathAt(__pGallery->GetCurrentItemIndex()); @@ -1531,8 +1551,9 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) pList->Add(new (std::nothrow) String(cropMode)); pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_LOCK_SCREEN_WALLPAPER)); pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList); - break; } + break; + case IDA_CONTEXTMENU_CALLER: { HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter); @@ -1546,8 +1567,8 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_CONTACTS, APPCONTROL_OPERATION_ID_SOCIAL_PICK, null, null, pDataList, this); - break; } + break; case IDA_CONTEXTMENU_HOME_AND_LOCK: { @@ -1558,19 +1579,21 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) pList->Add(new (std::nothrow) String(cropMode)); pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_HOME_AND_LOCK_SCREEN_WALLPAPER)); pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), pList); - break; } + break; case IDA_CONTEXTMENU_EMAIL: { OnRequestEmailAction(); - break; } + break; + case IDA_CONTEXTMENU_MESSAGE: { OnRequestMessagesAction(); - break; } + break; + case IDA_CONTEXTMENU_COPY: { int currentIndex = __pGallery->GetCurrentItemIndex(); @@ -1580,8 +1603,9 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) item.Construct(CLIPBOARD_DATA_TYPE_IMAGE, filePath); Clipboard* pClipboard = Clipboard::GetInstance(); pClipboard->CopyItem(item); - break; } + break; + case IDA_DELETE_POPUP_DEL: { __pDeletePopup->SetShowState(false); @@ -1592,17 +1616,22 @@ ImageViewerForm::OnActionPerformed(const Control& source, int actionId) { ShowPanelDetail(false); } - break; } + break; + case IDA_DELETE_POPUP_CANCEL: { __pDeletePopup->SetShowState(false); __pDeletePopup->Show(); - break; } + break; + case IDA_CONTORL_BUTTON_PLAY: + { CallVideoPlayer(); - break; + } + break; + default: break; } @@ -1693,7 +1722,7 @@ ImageViewerForm::OnSceneActivatedN(const SceneId& previousSceneId, __pGallery->UpdateGallery(); __pGallery->SetCurrentItemIndex(count); __pPresentationModel->RequestImage(filePath); - ShowPanelDetail(__isDetail); + ShowPanelDetail(false); } if (__pGallery->GetCurrentItemIndex() < 0) -- 2.7.4