2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file IvImageViewerForm.cpp
19 * @brief This is the implementation file for ImageViewerForm class.
23 #include "IvCommonUtil.h"
24 #include "IvImageInfo.h"
25 #include "IvImageViewerApp.h"
26 #include "IvImageViewerForm.h"
27 #include "IvImageViewerPresentationModel.h"
28 #include "IvResourceManager.h"
29 #include "IvSettingPresentationModel.h"
32 using namespace Tizen::App;
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Base::Runtime;
36 using namespace Tizen::Base::Utility;
37 using namespace Tizen::Content;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Io;
40 using namespace Tizen::Media;
41 using namespace Tizen::System;
42 using namespace Tizen::Ui;
43 using namespace Tizen::Ui::Controls;
44 using namespace Tizen::Ui::Scenes;
46 static const unsigned int COLOR_HEADER_CONTORL_PANEL = Color32<0, 0, 0, 100>::Value;
47 static const unsigned int COLOR_HEADER_BUTTON1 = Color32<0, 0, 0, 100>::Value;
49 static const Rectangle RECT_CONTORL_BUTTON_PLAY (280, 400, 160, 160);
50 static const Rectangle RECT_LANDSCAP_CONTORL_BUTTON_PLAY (560, 216, 160, 160);
52 static const Rectangle RECT_DETAILS_CONTORL_PANEL (0, 0, 720, 1008);
53 static const Rectangle RECT_LANDSCAPE_DETAILS_CONTORL_PANEL (0, 0, 1280, 484);
54 static const Rectangle RECT_DETAILS_CONTORL_LABEL (20, 0, 200, 48);
56 static const int GAP_LABEL_END = 60;
57 static const int GAP_W_POPUP_ITEM = 5;
58 static const int W_DELETE_POPUP = 600;
59 static const int H_DELETE_POPUP = 300;
60 static const int H_DELETE_LABEL = 180;
61 static const int Y_DELETE_BUTTON = 180;
62 static const int H_DELETE_BUTTON = 80;
64 static const Dimension DUMMY_IMAGE_DIMENSION (720, 1280);
65 static const Rectangle DUMMY_IMAGE_RECTANGLE (0, 0, 720, 1280);
67 static const int PAGE_NO_CONTENT_SEARCH = 1;
68 static const int COUNT_PER_PAGE_CONTENT_SEARCH = 10;
70 static const int FORMAT_BUFFER_SIZE = 256;
72 static const long long SINGLE_GIGA_BYTE = (1024 * 1024 * 1024);
73 static const long long SINGLE_MEGA_BYTE = (1024 * 1024);
74 static const long long SINGLE_KILO_BYTE = 1024;
76 static const int Y_RENAME_BUTTON = 100;
77 static const int H_RENAME_BUTTON = 64;
78 static const int W_RENAME_BUTTON = 64;
80 static const int X_DETAIL_FILEINFO_LABEL = 20;
81 static const int W_DETAIL_FILEINFO_LABEL = 420;
82 static const int H_DETAIL_FILEINFO_LABEL = 50;
83 static const int H_DETAIL_MAIN_TEXT = 48;
84 static const int H_DETAIL_SUB_TEXT = 42;
85 static const int GAP_H_DETAIL_TEXT = 8;
86 static const int W_DETAIL_FILEINFO_VALUE_LABEL = 650;
87 static const int H_DETAIL_FILEINFO_VALUE_LABEL = 56;
89 static const int X_MORE = 55;
91 static const int DETAIL_SUB_FONT_SIZE = 42;
92 static const int DETAIL_MAIN_FONT_SIZE = 48;
93 static const int DETAIL_COUNT_MAX = 9;
95 ImageViewerForm::ImageViewerForm(void)
96 : __initializeDisplayModeCurrent(APPCONTROL_MODE_NORMAL)
99 , __pScrollPanel(null)
100 , __pDetail_Label(null)
101 , __pLabelMessage(null)
102 , __pPlayButton(null)
103 , __pRenameButton(null)
104 , __pDetailFooterItem(null)
107 , __pDecodeBitmap(null)
108 , __pContextMenuMore(null)
109 , __pContextMenuCopy(null)
110 , __pContextMenuSetAs(null)
111 , __pContextMenuShare(null)
112 , __pDeletePopup(null)
115 , __startSlide(false)
117 , __pPresentationModel(null)
119 AppLogDebug("ENTER");
121 __pDetail_FileInfo_Value_Label[0] = null;
122 __pDetail_FileInfo_Value_Label[1] = null;
123 __pDetail_FileInfo_Value_Label[2] = null;
124 __pDetail_FileInfo_Value_Label[3] = null;
125 __pDetail_FileInfo_Value_Label[4] = null;
126 __pDetail_FileInfo_Value_Label[5] = null;
127 __pDetail_FileInfo_Value_Label[6] = null;
128 __pDetail_FileInfo_Value_Label[7] = null;
129 __pDetail_FileInfo_Value_Label[8] = null;
130 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
133 ImageViewerForm::~ImageViewerForm(void)
135 AppLogDebug("ENTER");
136 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
140 ImageViewerForm::Initialize()
142 AppLogDebug("ENTER");
143 __pPresentationModel = ImageViewerPresentationModel::GetInstance();
145 if (__pPresentationModel->GetFileCount() > 0)
147 if (__pPresentationModel->GetType() == APPCONTROL_DATA_SLIDE_SHOW)
153 __pSettingPresentationModel = SettingPresentationModel::GetInstance();
155 int startIndex = __pPresentationModel->GetStartIndex();
156 String filePath = __pPresentationModel->GetFilePathAt(startIndex);
158 if (filePath.StartsWith(WEB_URL_HTTP, 0) == true)
160 __initializeDisplayModeCurrent = APPCONTROL_MODE_WEB_LINK;
162 else if (__pPresentationModel->GetType() == APPCONTROL_DATA_MESSAGE)
164 __initializeDisplayModeCurrent = APPCONTROL_MODE_MESSAGE;
166 else if (__pPresentationModel->GetType() == APPCONTROL_DATA_EMAIL)
168 __initializeDisplayModeCurrent = APPCONTROL_MODE_EMAIL;
172 __initializeDisplayModeCurrent = APPCONTROL_MODE_NORMAL;
175 result r = Form::Construct(IDL_FORM_IMAGE_VIEWER);
177 if (filePath == EMPTY_SPACE)
179 MessageBox messageBox;
180 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_IV_POP_INVALID_IMAGE_FILE"), MSGBOX_STYLE_NONE,
183 messageBox.ShowAndWait(modalResult);
185 UiApp* pApp = UiApp::GetInstance();
189 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
195 ImageViewerForm::OnInitializing(void)
197 AppLogDebug("ENTER");
198 SetFormBackEventListener(this);
199 __pPresentationModel->AddListener(this);
202 InitializeDisplay(__initializeDisplayModeCurrent);
203 InitializePanelDetail();
206 if ( __initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL
207 || __initializeDisplayModeCurrent == APPCONTROL_MODE_MESSAGE
208 || __initializeDisplayModeCurrent == APPCONTROL_MODE_EMAIL)
210 int index = __pPresentationModel->GetStartIndex();
211 __pGallery->UpdateGallery();
212 __pGallery->SetCurrentItemIndex(index);
215 String filePath = __pPresentationModel->GetFilePathAt(index);
216 __pPresentationModel->RequestImage(filePath);
218 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
225 __pTimer = new (std::nothrow) Timer();
226 __pTimer->Construct(*this);
230 result r = SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
231 AddOrientationEventListener(*this);
232 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
238 ImageViewerForm::OnInitialized(void)
240 AppLogDebug("ENTER");
241 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
247 ImageViewerForm::OnOrientationChanged(const Control &source, OrientationStatus orientationStatus)
249 AppLogDebug("ENTER");
250 if (__detail == false)
252 ShowPanelDetail(true);
256 ShowPanelDetail(false);
259 if (orientationStatus == ORIENTATION_STATUS_PORTRAIT ||
260 orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
262 Rectangle clientRect = GetClientAreaBounds();
263 Rectangle rect = GetBounds();
265 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
266 __pPlayButton->SetBounds(Rectangle(RECT_CONTORL_BUTTON_PLAY.x, RECT_CONTORL_BUTTON_PLAY.y,
267 RECT_CONTORL_BUTTON_PLAY.width, RECT_CONTORL_BUTTON_PLAY.height));
271 else if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE ||
272 orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
274 Rectangle clientRect = GetClientAreaBounds();
275 Rectangle rect = GetBounds();
277 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
278 __pPlayButton->SetBounds(Rectangle(RECT_LANDSCAP_CONTORL_BUTTON_PLAY.x, RECT_LANDSCAP_CONTORL_BUTTON_PLAY.y,
279 RECT_LANDSCAP_CONTORL_BUTTON_PLAY.width, RECT_LANDSCAP_CONTORL_BUTTON_PLAY.height));
283 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
287 ImageViewerForm::InitializeDisplay(AppControlMode status)
289 AppLogDebug("ENTER");
291 String strItemIdxText;
293 __pHeader = GetHeader();
294 __pHeader->AddActionEventListener(*this);
296 __pFooter = GetFooter();
297 __pFooter->AddActionEventListener(*this);
298 __pFooter->RemoveAllItems();
300 GetHeaderString(0, strItemText, strItemIdxText);
301 Rectangle rect = GetClientAreaBounds();
302 __pHeader->SetTitleText(strItemText);
303 __pHeader->SetDescriptionText(strItemIdxText);
305 if (status == APPCONTROL_MODE_NORMAL)
307 __pPlayButton = new (std::nothrow) Button();
308 if (__pPlayButton != null)
310 __pPlayButton->Construct(RECT_CONTORL_BUTTON_PLAY);
311 __pPlayButton->SetActionId(ACTION_ID_CONTORL_BUTTON_PLAY);
312 AddControl(*__pPlayButton);
314 Bitmap* pNormalBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
315 __pPlayButton->SetNormalBackgroundBitmap(*pNormalBackgroundBitmap);
316 delete pNormalBackgroundBitmap;
318 Bitmap* pPressedBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
319 __pPlayButton->SetPressedBackgroundBitmap(*pPressedBackgroundBitmap);
320 delete pPressedBackgroundBitmap;
322 __pPlayButton->AddActionEventListener(*this);
323 __pPlayButton->SetShowState(false);
326 __pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
327 __pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
328 __pFooter->SetBackButton();
330 FooterItem footerItem1;
331 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SHARE);
332 Bitmap* pFooterItemShareNomal =
333 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_SHARE_NORMAL);
334 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemShareNomal);
336 FooterItem footerItem2;
337 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_DELETE);
338 Bitmap* pFooterItemDeleteNomal =
339 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_DELETE_NORMAL);
340 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemDeleteNomal);
342 __pFooter->AddItem(footerItem1);
343 __pFooter->AddItem(footerItem2);
345 delete pFooterItemShareNomal;
346 delete pFooterItemDeleteNomal;
348 ButtonItem buttonItemMore;
349 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
350 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL,
351 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_NORMAL));
352 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED,
353 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_PRESSED));
354 __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItemMore);
356 else if (status == APPCONTROL_MODE_WEB_LINK)
358 __pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
359 __pFooter->SetBackButton();
361 FooterItem footerItem1;
362 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SHARE);
363 Bitmap* pFooterItemShareNomal =
364 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_SHARE_NORMAL);
365 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemShareNomal);
367 FooterItem footerItem2;
368 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_DOWNLOAD);
369 Bitmap* pFooterItemDownlordNomal = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DOWNLOAD);
370 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemDownlordNomal);
372 __pFooter->AddItem(footerItem1);
373 __pFooter->AddItem(footerItem2);
375 delete pFooterItemShareNomal;
376 delete pFooterItemDownlordNomal;
378 ButtonItem buttonItemMore;
379 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
380 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL,
381 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_NORMAL));
382 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED,
383 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_PRESSED));
384 __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItemMore);
386 __pFooter->AddItem(footerItem1);
387 __pFooter->AddItem(footerItem2);
389 else if (status == APPCONTROL_MODE_CROP)
391 FooterItem footerItem1;
392 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SAVE);
393 Bitmap* pfooterItem1 = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_SAVE);
394 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem1);
396 FooterItem footerItem2;
397 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_BACK);
398 Bitmap* pfooterItem2 = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_X);
399 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem2);
401 __pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
402 __pFooter->AddItem(footerItem1);
403 __pFooter->AddItem(footerItem2);
408 else if (status == APPCONTROL_MODE_MESSAGE || status == APPCONTROL_MODE_EMAIL)
410 __pPlayButton = new (std::nothrow) Button();
411 if (__pPlayButton != null)
413 __pPlayButton->Construct(RECT_CONTORL_BUTTON_PLAY);
414 __pPlayButton->SetActionId(ACTION_ID_CONTORL_BUTTON_PLAY);
415 AddControl(*__pPlayButton);
417 Bitmap* pNormalBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
418 __pPlayButton->SetNormalBackgroundBitmap(*pNormalBackgroundBitmap);
419 delete pNormalBackgroundBitmap;
421 Bitmap* pPressedBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
422 __pPlayButton->SetPressedBackgroundBitmap(*pPressedBackgroundBitmap);
423 delete pPressedBackgroundBitmap;
425 __pPlayButton->AddActionEventListener(*this);
426 __pPlayButton->SetShowState(false);
429 __pFooter->SetBackButton();
432 String filePath = __pPresentationModel->GetFilePathAt(0);
433 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
434 if (contentType == CONTENT_TYPE_VIDEO)
436 __pPlayButton->SetShowState(true);
438 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
442 ImageViewerForm::GetHeaderString(int index, String &fileName, String &page)
444 AppLogDebug("ENTER");
445 int allCount = __pPresentationModel->GetFileCount();
446 String pStr = __pPresentationModel->GetFilePathAt(index);
447 fileName = __pPresentationModel->GetFileName(pStr);
448 page.Format(FORMAT_BUFFER_SIZE, L"%d/%d", index + 1, allCount);
449 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
453 ImageViewerForm::DeleteImageFile()
455 AppLogDebug("ENTER");
456 int currentIndex = __pGallery->GetCurrentItemIndex();
458 String strItemText(EMPTY_SPACE);
459 String strItemIdxText(EMPTY_SPACE);
460 int countPath = __pPresentationModel->GetFileCount();
461 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
462 result r = E_SUCCESS;
463 if (filePath.GetLength() == 0)
465 UiApp* pApp = UiApp::GetInstance();
467 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
472 if (filePath.StartsWith(Environment::GetMediaPath(), 0) == true
473 || filePath.StartsWith(Environment::GetExternalStoragePath(), 0) == true)
475 ContentId contentId = __pPresentationModel->GetFileContentId(filePath);
476 ContentManager contentManager;
477 contentManager.Construct();
478 r = contentManager.DeleteContent(contentId);
481 r = File::Remove(filePath);
484 MessageBox messageBox;
485 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_DELETE_FAILED"),
486 MSGBOX_STYLE_NONE, 3000);
488 messageBox.ShowAndWait(modalResult);
489 AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
497 r = File::Remove(filePath);
500 __pPresentationModel->DeleteFilePathAt(currentIndex);
503 UiApp* pApp = UiApp::GetInstance();
505 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
509 else if ((countPath - 1) == currentIndex)
511 __pGallery->SetCurrentItemIndex(--currentIndex);
514 __pGallery->UpdateGallery();
515 filePath = __pPresentationModel->GetFilePathAt(currentIndex);
516 __pPresentationModel->RequestImage(filePath);
518 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
519 __pHeader->SetTitleText(strItemText);
520 __pHeader->SetDescriptionText(strItemIdxText);
522 if (__visible == true)
524 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
526 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
528 __pPlayButton->SetShowState(false);
532 __pPlayButton->SetShowState(true);
536 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
542 ImageViewerForm::CallVideoPlayer(void)
544 AppLogDebug("ENTER");
545 int index = __pGallery->GetCurrentItemIndex();
546 String filePath = __pPresentationModel->GetFilePathAt(index);
548 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
549 pDataList->Construct();
550 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),
551 new (std::nothrow) String(APPCONTROL_DATA_VIDEO));
552 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), new (std::nothrow) String(filePath));
554 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_VIDEO_PLAYER,
555 APPCONTROL_OPERATION_ID_PLAY, pDataList, this);
556 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
560 ImageViewerForm::CreateGallery(void)
562 AppLogDebug("ENTER");
563 Rectangle clientRect = GetClientAreaBounds();
564 Rectangle rect = GetBounds();
566 __pGallery = new (std::nothrow) Gallery();
567 __pGallery->Construct(Rectangle(0, -clientRect.y, rect.width, rect.height));
568 __pGallery->SetName(L"GalleryControl");
569 __pGallery->SetItemProvider(*this);
570 __pGallery->AddGalleryEventListener(*this);
571 AddControl(*__pGallery);
572 __pGallery->SetTextOfEmptyGallery(ResourceManager::GetString(L"IDS_COM_BODY_LOADING"));
574 SlideShowTransitionEffect effect = __pPresentationModel->GetTransitionEffectOfSlideShow();
578 case SLIDE_SHOW_TRANSITION_EFFECT_DISSOLVE:
579 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_DISSOLVE);
581 case SLIDE_SHOW_TRANSITION_EFFECT_ZOOM:
582 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_ZOOM);
584 case SLIDE_SHOW_TRANSITION_EFFECT_SLIDE:
588 __pGallery->SetSlideShowViewDuration(__pPresentationModel->GetDurationOfSlideShow());
590 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
594 ImageViewerForm::InitializePanelDetail()
596 AppLogDebug("ENTER");
597 __pScrollPanel = new (std::nothrow) ScrollPanel();
599 String arrayId[DETAIL_COUNT_MAX] =
601 L"IDS_COM_BODY_DETAILS_NAME", L"IDS_IV_BODY_FILE_FORMAT", L"IDS_IV_BODY_DATE_CREATED",
602 L"IDS_COM_BODY_SIZE", L"IDS_IV_BODY_RESOLUTION", L"IDS_COM_BODY_LOCATION",
603 L"IDS_COM_BODY_LATITUDE", L"IDS_COM_BODY_LONGITUDE", L"IDS_IV_BODY_FILE_LOCATION"
606 if (__pScrollPanel == null)
608 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
610 return E_INVALID_STATE;
613 result r = __pScrollPanel->Construct(RECT_DETAILS_CONTORL_PANEL);
616 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
618 return E_INVALID_STATE;
621 __pDetail_Label = new (std::nothrow) Label();
622 __pDetail_Label->Construct(RECT_DETAILS_CONTORL_LABEL, ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"));
623 __pScrollPanel->AddControl(*__pDetail_Label);
624 __pDetail_Label->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
625 __pDetail_Label->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
626 __pDetail_Label->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
627 __pDetail_Label->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
629 for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
631 __pDetail_FileInfo_Label[i] = new (std::nothrow) Label();
632 __pDetail_FileInfo_Label[i]->Construct(
633 Rectangle(X_DETAIL_FILEINFO_LABEL,
634 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT + H_DETAIL_SUB_TEXT) * i,
635 W_DETAIL_FILEINFO_LABEL, H_DETAIL_FILEINFO_LABEL), ResourceManager::GetString(arrayId[i]));
636 __pScrollPanel->AddControl(*__pDetail_FileInfo_Label[i]);
638 __pDetail_FileInfo_Label[i]->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
639 __pDetail_FileInfo_Label[i]->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
640 __pDetail_FileInfo_Label[i]->SetTextColor(Color::GetColor(COLOR_ID_GREY));
641 __pDetail_FileInfo_Label[i]->SetTextConfig(DETAIL_SUB_FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
643 __pDetail_FileInfo_Value_Label[i] = new (std::nothrow) Label();
644 __pDetail_FileInfo_Value_Label[i]->Construct(
645 Rectangle(X_DETAIL_FILEINFO_LABEL,
646 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT * i) + H_DETAIL_SUB_TEXT * (i + 1),
647 W_DETAIL_FILEINFO_VALUE_LABEL, H_DETAIL_FILEINFO_VALUE_LABEL), L"");
648 __pScrollPanel->AddControl(*__pDetail_FileInfo_Value_Label[i]);
650 __pDetail_FileInfo_Value_Label[i]->SetTextVerticalAlignment(ALIGNMENT_BOTTOM);
651 __pDetail_FileInfo_Value_Label[i]->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
652 __pDetail_FileInfo_Value_Label[i]->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
653 __pDetail_FileInfo_Value_Label[i]->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
656 __pScrollPanel->SetBackgroundColor(COLOR_HEADER_CONTORL_PANEL);
657 __pScrollPanel->SetShowState(false);
659 AddControl(*__pScrollPanel);
660 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
666 ImageViewerForm::InitializePopup(void)
668 AppLogDebug("ENTER");
669 if (__pDeletePopup == null)
671 __pDeletePopup = new (std::nothrow) Popup();
672 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
674 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
676 Label* pLabel = new (std::nothrow) Label();
677 pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
678 ResourceManager::GetString(L"IDS_COM_BODY_DELETE") + L"?");
680 Button* pDeleteButton = new (std::nothrow) Button();
681 pDeleteButton->Construct(
682 Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
683 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
684 pDeleteButton->SetActionId(ACTION_ID_DELETE_POPUP_DEL);
685 pDeleteButton->AddActionEventListener(*this);
687 Button* pCancelButton = new (std::nothrow) Button();
688 pCancelButton->Construct(
689 Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM,
690 Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
691 ResourceManager::GetString(L"IDS_COM_SK_CANCEL"));
692 pCancelButton->SetActionId(ACTION_ID_DELETE_POPUP_CANCEL);
693 pCancelButton->AddActionEventListener(*this);
695 __pDeletePopup->AddControl(*pLabel);
696 __pDeletePopup->AddControl(*pDeleteButton);
697 __pDeletePopup->AddControl(*pCancelButton);
701 __pDeletePopup->SetShowState(true);
702 __pDeletePopup->Show();
704 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
710 ImageViewerForm::InitializeContextMenuMore(void)
712 AppLogDebug("ENTER");
713 int currentIndex = __pGallery->GetCurrentItemIndex();
714 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
716 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
718 if (__pContextMenuMore != null)
720 delete __pContextMenuMore;
721 __pContextMenuMore = null;
724 __pContextMenuMore = new (std::nothrow) ContextMenu();
726 __pContextMenuMore->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
727 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
729 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
731 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_SET_AS"),
732 ACTION_ID_CONTEXTMENU_SET_AS);
735 if (__pGallery->GetItemCount() > 1)
737 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_SLIDE_SHOW"),
738 ACTION_ID_FOOTER_BUTTON_SLIDE);
740 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"),
741 ACTION_ID_FOOTER_BUTTON_DETAILS);
742 __pContextMenuMore->SetShowState(false);
743 __pContextMenuMore->AddActionEventListener(*this);
744 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
750 ImageViewerForm::InitializeContextMenuSetAs(void)
752 AppLogDebug("ENTER");
754 if (__pContextMenuSetAs != null)
756 delete __pContextMenuSetAs;
757 __pContextMenuSetAs = null;
760 __pContextMenuSetAs = new (std::nothrow) ContextMenu();
761 __pContextMenuSetAs->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
762 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
764 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_HOME_SCREEN_WALLPAPER_ABB"),
765 ACTION_ID_CONTEXTMENU_HOME);
766 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_LOCK_SCREEN_WALLPAPER_ABB"),
767 ACTION_ID_CONTEXTMENU_LOCK);
768 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_BODY_CALLER_IMAGE"),
769 ACTION_ID_CONTEXTMENU_CALLER);
770 __pContextMenuSetAs->AddActionEventListener(*this);
771 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
777 ImageViewerForm::InitializeContextMenuShare(void)
779 AppLogDebug("ENTER");
780 if (__pContextMenuShare != null)
782 delete __pContextMenuShare;
783 __pContextMenuShare = null;
785 __pContextMenuShare = new (std::nothrow) ContextMenu();
786 __pContextMenuShare->Construct(Point((GetClientAreaBounds().width - (X_MORE * 4)) / 4 + X_MORE * 2,
787 GetClientAreaBounds().y + GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST,
788 CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
790 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
791 ACTION_ID_CONTEXTMENU_MESSAGE);
792 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), ACTION_ID_CONTEXTMENU_EMAIL);
793 __pContextMenuShare->AddActionEventListener(*this);
794 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
800 ImageViewerForm::GetFileSize(String filePath)
802 AppLogDebug("ENTER");
806 result r = File::GetAttributes(filePath, attr);
809 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
813 size = attr.GetFileSize();
814 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
820 ImageViewerForm::SetDetailInfo(void)
822 AppLogDebug("ENTER");
824 Rectangle clientRect = GetClientAreaBounds();
825 AppLogDebug("PORTRAIT GetClientAreaBounds(%d %d %d %d)", clientRect.x, clientRect.y, clientRect.width, clientRect.height);
826 OrientationStatus currentOrientaton = GetOrientationStatus();
828 if (currentOrientaton == ORIENTATION_STATUS_LANDSCAPE || currentOrientaton == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
830 __pScrollPanel->SetBounds(Rectangle(0, 0, clientRect.width, RECT_LANDSCAPE_DETAILS_CONTORL_PANEL.height));
834 __pScrollPanel->SetBounds(0, 0, clientRect.width, RECT_DETAILS_CONTORL_PANEL.height);
837 int currentIndex = __pGallery->GetCurrentItemIndex();
838 String strFilePath = __pPresentationModel->GetFilePathAt(currentIndex);
840 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(strFilePath);
842 String strResult[DETAIL_COUNT_MAX] = {EMPTY_SPACE, };
844 strResult[0] = __pPresentationModel->GetFileName(strFilePath);
845 strResult[1] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
848 result r = File::GetAttributes(strFilePath, attr);
851 long long nSize = attr.GetFileSize();
852 DateTime dateTime = attr.GetDateTime();
853 strResult[2] = dateTime.ToString();
855 if (nSize > SINGLE_GIGA_BYTE)
857 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_GIGA_BYTE);
858 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_GB"));
860 else if (nSize > SINGLE_MEGA_BYTE)
862 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_MEGA_BYTE);
863 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_MB"));
865 else if (nSize > SINGLE_KILO_BYTE)
867 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_KILO_BYTE);
868 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_KB"));
872 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize);
873 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_B"));
878 strResult[2] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
879 strResult[3] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
882 strResult[4] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
883 strResult[5] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
884 strResult[6] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
885 strResult[7] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
886 strResult[8] = strFilePath;
888 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
890 strResult[0] = __downLordFileName;
892 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
894 ImageMetadata* pImgMeta = ContentManagerUtil::GetImageMetaN(strFilePath);
896 if (pImgMeta != null)
898 ImageContentInfo imageContentInfo;
899 r = imageContentInfo.Construct(&strFilePath);
902 strResult[1] = imageContentInfo.GetMediaFormat();
903 strResult[4].Format(FORMAT_BUFFER_SIZE, L"%d x %d", pImgMeta->GetWidth(),
904 pImgMeta->GetHeight());
906 if (imageContentInfo.GetLocationTag() != EMPTY_SPACE)
908 strResult[5].Format(FORMAT_BUFFER_SIZE, L"%ls", imageContentInfo.GetLocationTag().GetPointer());
911 if (pImgMeta->GetLatitude() > 1.0 && pImgMeta->GetLongitude() > 1.0)
913 strResult[6].Format(FORMAT_BUFFER_SIZE, L"%f", pImgMeta->GetLatitude());
914 strResult[7].Format(FORMAT_BUFFER_SIZE, L"%f", pImgMeta->GetLongitude());
917 strResult[8] = imageContentInfo.GetContentPath();
922 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
924 VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(strFilePath);
925 if (pVideoMeta != null)
927 VideoContentInfo videoContentInfo;
928 r = videoContentInfo.Construct(&strFilePath);
931 strResult[1] = videoContentInfo.GetMediaFormat();
932 strResult[4].Format(FORMAT_BUFFER_SIZE, L"%d x %d", pVideoMeta->GetWidth(),
933 pVideoMeta->GetHeight());
934 if (videoContentInfo.GetLocationTag() != EMPTY_SPACE)
936 strResult[5].Format(FORMAT_BUFFER_SIZE, L"%ls", videoContentInfo.GetLocationTag().GetPointer());
939 strResult[8] = videoContentInfo.GetContentPath();
944 for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
946 __pDetail_FileInfo_Value_Label[i]->SetBounds(X_DETAIL_FILEINFO_LABEL, GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT * i) + H_DETAIL_SUB_TEXT * (i + 1),
947 clientRect.width - GAP_LABEL_END, H_DETAIL_FILEINFO_VALUE_LABEL);
948 __pDetail_FileInfo_Value_Label[i]->SetText(strResult[i]);
949 __pDetail_FileInfo_Value_Label[i]->RequestRedraw();
952 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
954 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
958 if (__pRenameButton == null)
960 __pRenameButton = new (std::nothrow) Button();
961 Rectangle rect = GetBounds();
962 __pRenameButton->Construct(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
963 __pRenameButton->SetActionId(ACTION_ID_PANEL_HEADER_DETAILS_RENAME);
965 Bitmap* pIcon = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME);
966 Bitmap* pIconBackground =
967 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND);
968 Bitmap* pIconPressed =
969 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND_PRESS);
971 if (pIcon != null && pIconPressed != null && pIconBackground != null)
973 __pRenameButton->SetNormalBackgroundBitmap(*pIconBackground);
974 __pRenameButton->SetPressedBackgroundBitmap(*pIconPressed);
975 Point iconPosition(0, 0);
976 __pRenameButton->SetNormalBitmap(iconPosition, *pIcon);
977 __pRenameButton->SetPressedBitmap(iconPosition, *pIconPressed);
981 __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
982 __pRenameButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_HEADER_BUTTON1);
986 delete pIconBackground;
988 __pScrollPanel->AddControl(*__pRenameButton);
989 __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
990 __pRenameButton->AddActionEventListener(*this);
994 Rectangle rect = GetBounds();
995 __pRenameButton->SetBounds(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
997 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1003 ImageViewerForm::ShowPanelDetail(bool showStatus)
1005 AppLogDebug("ENTER");
1009 __pScrollPanel->SetShowState(true);
1014 __pScrollPanel->SetShowState(false);
1017 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1023 ImageViewerForm::ChangeFooterItem(bool isChanged, Footer* pFooter, int position)
1025 AppLogDebug("ENTER");
1026 FooterItem footerItem;
1027 footerItem.Construct(ACTION_ID_FOOTER_BUTTON_DETAILS);
1028 Bitmap* pfooterItem = null;
1032 pfooterItem = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS_CLOSE);
1033 footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem);
1037 pfooterItem = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS);
1038 footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem);
1041 pFooter->SetItemAt(position, footerItem);
1042 pFooter->Invalidate(true);
1046 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1052 ImageViewerForm::DownloadFile(void)
1054 AppLogDebug("ENTER");
1055 String DestPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_WEB_FILE;
1056 if (File::IsFileExist(DestPath) == false)
1058 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1062 ContentId contentId;
1063 ContentManager contentManager;
1064 contentManager.Construct();
1066 ImageContentInfo imageContentInfo;
1067 imageContentInfo.Construct(null);
1069 imageContentInfo.SetKeyword(L"platform, tizen");
1070 String sourcePath = DestPath;
1071 String destPath = Environment::GetMediaPath();
1072 destPath.Append(FOLDER_PATH_DOWNLOADS);
1073 destPath.Append(__downLordFileName);
1075 contentId = contentManager.CreateContent(sourcePath, destPath, true, &imageContentInfo);
1076 ImageViewerForm::OnFormBackRequested(*this);
1077 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1081 ImageViewerForm::GetItemCount(void)
1083 AppLogDebug("ENTER");
1084 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1086 return __pPresentationModel->GetFileCount();
1090 ImageViewerForm::CreateItem(int index)
1092 AppLogDebug("ENTER : index(%d)", index);
1093 GalleryItem* pGallery = new (std::nothrow) GalleryItem();
1095 String filePath = __pPresentationModel->GetFilePathAt(index);
1096 ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
1097 Bitmap* pBitmap = pImageInfo->GetBitmapN();
1098 if (pBitmap == null)
1100 pBitmap = GetQuickThumbnailN(filePath);
1102 if (pBitmap == null)
1104 pBitmap = new (std::nothrow) Bitmap();
1105 pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
1108 pGallery->Construct(*pBitmap, filePath);
1110 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1116 ImageViewerForm::DeleteItem(int index, GalleryItem* pItem)
1118 AppLogDebug("ENTER index(%d)", index);
1119 ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
1120 pImageInfo->ClearBitmap();
1122 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1128 ImageViewerForm::OnGalleryCurrentItemChanged(Gallery& view, int index)
1130 AppLogDebug("ENTER index(%d)", index);
1132 String filePath = __pPresentationModel->GetFilePathAt(index);
1133 AppLogDebug("ENTER index(%d) filePath(%ls)", index, filePath.GetPointer());
1134 __pPresentationModel->RequestImage(filePath);
1137 String strItemIdxText;
1138 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
1139 __pHeader->SetTitleText(strItemText);
1140 __pHeader->SetDescriptionText(strItemIdxText);
1142 if (__visible == true)
1144 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1145 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1147 __pPlayButton->SetShowState(true);
1151 __pPlayButton->SetShowState(false);
1156 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1160 ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index)
1162 AppLogDebug("ENTER");
1164 String filePath = __pPresentationModel->GetFilePathAt(index);
1165 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1167 if (__visible == true)
1169 if (contentType == CONTENT_TYPE_VIDEO)
1171 __pPlayButton->SetShowState(false);
1174 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
1179 if (contentType == CONTENT_TYPE_VIDEO)
1181 __pPlayButton->SetShowState(true);
1184 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
1187 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
1188 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y + 1);
1191 Rectangle clientRect = GetClientAreaBounds();
1192 Rectangle rect = GetBounds();
1193 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1195 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1199 ImageViewerForm::OnGallerySlideShowStarted(Gallery& gallery)
1201 AppLogDebug("ENTER");
1202 PowerManager::KeepScreenOnState(true, false);
1203 if (__visible == true)
1205 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
1207 int index = __pGallery->GetCurrentItemIndex();
1208 String filePath = __pPresentationModel->GetFilePathAt(index);
1209 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1211 if (contentType == CONTENT_TYPE_VIDEO)
1213 __pPlayButton->SetShowState(false);
1219 Rectangle clientRect = GetClientAreaBounds();
1220 Rectangle rect = GetBounds();
1221 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1223 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1227 ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery)
1229 AppLogDebug("ENTER");
1230 PowerManager::KeepScreenOnState(false, true);
1231 int index = __pGallery->GetCurrentItemIndex();
1233 if (__visible == false)
1235 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
1237 String filePath = __pPresentationModel->GetFilePathAt(index);
1238 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1239 if (contentType == CONTENT_TYPE_VIDEO)
1241 __pPlayButton->SetShowState(true);
1244 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
1245 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y + 1);
1251 String strItemIdxText;
1252 GetHeaderString(index, strItemText, strItemIdxText);
1253 __pHeader->SetTitleText(strItemText);
1254 __pHeader->SetDescriptionText(strItemIdxText);
1256 Rectangle clientRect = GetClientAreaBounds();
1257 Rectangle rect = GetBounds();
1258 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1261 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1265 ImageViewerForm::OnUpdateContentList(void)
1270 ImageViewerForm::OnTerminating(void)
1272 AppLogDebug("ENTER");
1274 if (__pTimer != null)
1281 __pPresentationModel->ClearImageRequests();
1282 __pPresentationModel->RemoveListener(*this);
1284 if (__pContextMenuCopy != null)
1286 delete __pContextMenuCopy;
1287 __pContextMenuCopy = null;
1290 if (__pContextMenuSetAs != null)
1292 delete __pContextMenuSetAs;
1293 __pContextMenuSetAs = null;
1296 if (__pDeletePopup != null)
1298 delete __pDeletePopup;
1299 __pDeletePopup = null;
1302 if (__pContextMenuShare != null)
1304 delete __pContextMenuShare;
1305 __pContextMenuShare = null;
1308 if (__pContextMenuMore != null)
1310 delete __pContextMenuMore;
1311 __pContextMenuMore = null;
1314 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1320 ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
1322 AppLogDebug("ENTER actionId(%d)", actionId);
1323 SceneManager* pSceneManager = SceneManager::GetInstance();
1328 case ACTION_ID_FOOTER_MORE:
1330 InitializeContextMenuMore();
1332 __pContextMenuMore->SetShowState(true);
1333 __pContextMenuMore->Show();
1336 case ACTION_ID_CONTEXTMENU_SET_AS:
1337 InitializeContextMenuSetAs();
1339 __pContextMenuSetAs->SetShowState(true);
1340 __pContextMenuSetAs->Show();
1342 case ACTION_ID_FOOTER_BUTTON_SHARE:
1343 InitializeContextMenuShare();
1345 __pContextMenuShare->SetShowState(true);
1346 __pContextMenuShare->Show();
1348 case ACTION_ID_FOOTER_BUTTON_DELETE:
1349 __pDeletePopup->SetShowState(true);
1350 __pDeletePopup->Show();
1352 case ACTION_ID_FOOTER_BUTTON_SLIDE:
1354 int repeatValue = 0;
1356 if (__pPresentationModel->GetFileCount() > 1)
1358 __pGallery->UpdateGallery();
1359 if (__detail == false)
1361 ShowPanelDetail(false);
1364 __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
1365 ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
1367 if( repeatValue == 0)
1369 __pGallery->StartSlideShow(false);
1373 __pGallery->StartSlideShow(true);
1378 case ACTION_ID_FOOTER_BUTTON_DETAILS:
1380 ShowPanelDetail(__detail);
1383 case ACTION_ID_FOOTER_BUTTON_BACK:
1384 ImageViewerForm::OnFormBackRequested(*this);
1386 case ACTION_ID_FOOTER_BUTTON_DOWNLOAD:
1389 case ACTION_ID_FOOTER_BUTTON_SAVE:
1391 case ACTION_ID_PANEL_HEADER_DETAILS_RENAME:
1393 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
1394 pSelectedIndex->Construct();
1395 pSelectedIndex->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1396 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_NAME_EDITOR), pSelectedIndex);
1399 case ACTION_ID_CONTEXTMENU_HOME:
1401 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1402 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1403 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_HOME_SCREEN_WALLPAPER));
1404 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1405 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1408 case ACTION_ID_CONTEXTMENU_LOCK:
1410 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1411 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1412 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_LOCK_SCREEN_WALLPAPER));
1413 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1414 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1417 case ACTION_ID_CONTEXTMENU_CALLER:
1419 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1420 pDataList->Construct();
1421 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SELECTION_MODE),
1422 new (std::nothrow) String(APPCONTROL_DATA_SINGLE));
1423 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_RETURN_TYPE),
1424 new (std::nothrow) String(APPCONTROL_DATA_CONTACT_ID));
1426 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_CONTACTS,
1427 APPCONTROL_OPERATION_ID_PICK, pDataList, this);
1430 case ACTION_ID_CONTEXTMENU_EMAIL:
1432 OnRequestEmailAction();
1435 case ACTION_ID_CONTEXTMENU_MESSAGE:
1437 OnRequestMessagesAction();
1440 case ACTION_ID_CONTEXTMENU_COPY:
1442 int currentIndex = __pGallery->GetCurrentItemIndex();
1443 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1446 item.Construct(CLIPBOARD_DATA_TYPE_IMAGE, filePath);
1447 Clipboard* pClipboard = Clipboard::GetInstance();
1448 pClipboard->CopyItem(item);
1451 case ACTION_ID_DELETE_POPUP_DEL:
1453 __pDeletePopup->SetShowState(false);
1454 __pDeletePopup->Show();
1457 if (__detail == false)
1459 ShowPanelDetail(false);
1463 case ACTION_ID_DELETE_POPUP_CANCEL:
1465 __pDeletePopup->SetShowState(false);
1466 __pDeletePopup->Show();
1469 case ACTION_ID_CONTORL_BUTTON_PLAY:
1475 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1479 ImageViewerForm::OnFormBackRequested(Form& source)
1481 AppLogDebug("ENTER");
1482 if (__detail == false)
1484 ShowPanelDetail(false);
1488 UiApp* pApp = UiApp::GetInstance();
1491 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1495 ImageViewerForm::OnSceneActivatedN(const SceneId& previousSceneId,
1496 const SceneId& currentSceneId, IList* pArgs)
1498 AppLogDebug("ENTER");
1499 OrientationStatus status = GetOrientationStatus();
1500 if (status == ORIENTATION_STATUS_PORTRAIT ||
1501 status == ORIENTATION_STATUS_PORTRAIT_REVERSE)
1503 AppLogDebug("ORIENTATION_STATUS : PORTRAIT");
1504 Rectangle clientRect = GetClientAreaBounds();
1505 Rectangle rect = GetBounds();
1506 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1507 __pPlayButton->SetBounds(RECT_CONTORL_BUTTON_PLAY);
1508 __pScrollPanel->SetBounds(RECT_DETAILS_CONTORL_PANEL);
1510 else if (status == ORIENTATION_STATUS_LANDSCAPE ||
1511 status == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
1513 AppLogDebug("ORIENTATION_STATUS : LANDSCAPE");
1514 Rectangle clientRect = GetClientAreaBounds();
1515 Rectangle rect = GetBounds();
1516 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1517 __pPlayButton->SetBounds(RECT_LANDSCAP_CONTORL_BUTTON_PLAY);
1518 __pScrollPanel->SetBounds(RECT_LANDSCAPE_DETAILS_CONTORL_PANEL);
1521 if (previousSceneId == IDSCN_IMAGE_NAME_EDITOR && currentSceneId == IDSCN_IMAGE_VIEWER)
1524 String strItemText(EMPTY_SPACE);
1525 String strItemIdxText(EMPTY_SPACE);
1526 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
1527 __pHeader->SetTitleText(strItemText);
1528 __pHeader->SetDescriptionText(strItemIdxText);
1532 if (__pGallery->GetCurrentItemIndex() < 0)
1534 SetFooterItemState(false);
1538 SetFooterItemState(true);
1541 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1545 ImageViewerForm::OnSceneDeactivated(const SceneId& currentSceneId,
1546 const SceneId& nextSceneId)
1548 AppLogDebug("ENTER");
1549 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1553 ImageViewerForm::OnImageDecodedN(const int index)
1555 AppLogDebug("ENTER");
1556 __pGallery->RefreshGallery(index, GALLERY_REFRESH_TYPE_ITEM_MODIFY);
1558 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1562 ImageViewerForm::OnAppControlCompleteResponseReceived(const AppId& appId,
1563 const String& operationId, AppCtrlResult appControlResult,
1564 const IMap* pExtraData)
1566 AppLogDebug("ENTER");
1568 if (appId == APPCONTROL_PROVIDER_ID_CONTACTS
1569 && operationId == APPCONTROL_OPERATION_ID_PICK
1570 && appControlResult == APP_CTRL_RESULT_SUCCEEDED)
1572 const String* pReturnType =
1573 static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_RETURN_TYPE)));
1574 if (pReturnType != null && pReturnType->CompareTo(APPCONTROL_DATA_CONTACT_ID) == 0)
1576 const String* pContactId =
1577 static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_VALUE)));
1578 SceneManager* pSceneManager = SceneManager::GetInstance();
1579 long long lresult = 0;
1580 if (pContactId != null && pContactId->GetLength() > 0)
1582 LongLong::Parse(*pContactId, lresult);
1584 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1585 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1586 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_CALLER_IMAGE));
1587 pList->Add(new (std::nothrow) LongLong(lresult));
1588 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1589 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1593 ImageViewerApp* pImageViewerApp = static_cast<ImageViewerApp*>(ImageViewerApp::GetInstance());
1594 pImageViewerApp->SetFrameEnabled(true);
1595 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1599 ImageViewerForm::OnOverlayControlCreated(const Control& source)
1601 AppLogDebug("ENTER");
1602 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1606 ImageViewerForm::OnOverlayControlOpened(const Control& source)
1608 AppLogDebug("ENTER");
1609 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1613 ImageViewerForm::OnOverlayControlClosed(const Control& source)
1615 AppLogDebug("ENTER");
1616 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1620 ImageViewerForm::OnOtherControlSelected(const Control& source)
1622 AppLogDebug("ENTER");
1623 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1627 ImageViewerForm::InitShowGallery(void)
1629 AppLogDebug("ENTER");
1630 if (__pGallery != null && __pGallery->IsVisible() == false)
1632 Canvas* pCanvas = GetCanvasN();
1633 if (pCanvas == null || GetLastResult() != E_SUCCESS)
1635 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1641 __pGallery->SetShowState(true);
1645 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1649 ImageViewerForm::OnTimerExpired(Timer &timer)
1651 int repeatValue = 0;
1652 AppLogDebug("ENTER");
1653 if (__pPresentationModel->GetFileCount() > 1)
1655 __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
1656 ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
1658 if( repeatValue == 0)
1660 __pGallery->StartSlideShow(false);
1664 __pGallery->StartSlideShow(true);
1667 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1671 ImageViewerForm::OnContentTransferInProgress(RequestId requestId, int totalReceivedSize)
1673 AppLogDebug("ENTER");
1674 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1678 ImageViewerForm::OnContentUploadCompleted(RequestId requestId, result transferResult, const String& errorCode,
1679 const String& errorMessage)
1681 AppLogDebug("ENTER");
1682 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1686 ImageViewerForm::OnContentDownloadCompleted(RequestId requestId, ContentId contentId,
1687 result transferResult, const String& errorCode, const String& errorMessage)
1689 AppLogDebug("ENTER");
1690 AppLogTag("IV", "ImageViewerForm::OnContentDownloadCompleted");
1691 AppLogTag("IV", "DownloadCompleted Error [%s]", GetErrorMessage(transferResult));
1692 AppLogTag("IV", "errorCode [%ls] errorMessage [%ls]", errorCode.GetPointer(), errorMessage.GetPointer());
1693 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1697 ImageViewerForm::OnContentDownloadToBufferCompleted(RequestId reqId, ByteBuffer* pBuffer, result r,
1698 const String& errorCode, const String& errorMessage)
1700 AppLogDebug("ENTER");
1701 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1705 ImageViewerForm::OnContentTransferCanceled(RequestId reqId, result res, const String& errorCode,
1706 const String& errorMessage)
1708 AppLogDebug("ENTER");
1709 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1713 ImageViewerForm::RequestDecodeUrl(void)
1715 AppLogDebug("ENTER");
1717 String filePath = __pPresentationModel->GetFilePathAt(0);
1719 if (filePath.StartsWith(WEB_URL_HTTP, 0) == false)
1721 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1726 __downLordFileName = __pPresentationModel->GetFileName(filePath);
1728 Image* pImage = new (std::nothrow) Image();
1729 pImage->Construct();
1732 uri.SetUri(filePath);
1734 pImage->DecodeUrl(uri, BITMAP_PIXEL_FORMAT_RGB565, 720, 1280, reqId, *this, 5000);
1738 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1742 ImageViewerForm::OnImageDecodeUrlReceived (RequestId reqId, Bitmap *pBitmap,
1743 result r, const String errorCode, const String errorMessage)
1745 AppLogDebug("ENTER");
1746 Image* pImage = new (std::nothrow) Image();
1747 pImage->Construct();
1749 String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_WEB_FILE;
1750 r = pImage->EncodeToFile(*pBitmap, IMG_FORMAT_JPG, destPath, true);
1754 __pPresentationModel->GetImageCacheAt(0)->SetFilePath(destPath);
1755 __pPresentationModel->GetImageCacheAt(0)->SetBitmap(pBitmap);
1757 __pGallery->RefreshGallery(0, GALLERY_REFRESH_TYPE_ITEM_MODIFY);
1759 __pPresentationModel->RequestImage(destPath);
1763 AppLogDebug("ImageViewerForm::OnImageDecodeUrlReceived [%s]", GetErrorMessage(r));
1768 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1772 ImageViewerForm::OnRequestEmailAction(void)
1774 AppLogDebug("ENTER");
1775 int currentIndex = __pGallery->GetCurrentItemIndex();
1777 if (__pPresentationModel->GetFileCount() <= 0)
1779 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1783 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1785 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1787 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE || mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1789 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1790 pDataList->Construct();
1791 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
1792 new (std::nothrow) String(filePath));
1794 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL,
1795 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, this);
1797 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1801 ImageViewerForm::OnRequestMessagesAction(void)
1803 AppLogDebug("ENTER");
1804 int currentIndex = __pGallery->GetCurrentItemIndex();
1806 if (__pPresentationModel->GetFileCount() <= 0)
1808 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1812 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1814 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1816 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE || mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1818 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1819 pDataList->Construct();
1820 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
1821 new (std::nothrow) String(filePath));
1823 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGES,
1824 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, this);
1826 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1830 ImageViewerForm::SetFooterItemState(bool isEnable)
1832 AppLogDebug("ENTER");
1833 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL)
1835 __pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, isEnable);
1836 __pFooter->SetItemEnabled(0, isEnable);
1837 __pFooter->SetItemEnabled(1, isEnable);
1839 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
1841 __pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, isEnable);
1842 __pFooter->SetItemEnabled(0, isEnable);
1843 __pFooter->SetItemEnabled(1, isEnable);
1845 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_CROP)
1847 __pFooter->SetItemEnabled(0, isEnable);
1849 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1853 ImageViewerForm::GetQuickThumbnailN(String& filePath)
1855 AppLogDebug("ENTER");
1856 Bitmap* pBitmap = null;
1858 if (filePath.GetLength() > 4)
1862 ContentSearch contentSearch;
1863 ContentSearchResult* pResultItem = null;
1864 IList* pContentInfoList = null;
1866 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1867 result r = contentSearch.Construct(contentType);
1868 AppLogDebug("r(%s)", GetErrorMessage(r));
1871 pBitmap = new (std::nothrow) Bitmap();
1872 r = pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
1883 queryString = CONTENT_QUERY_PREFIX_FILENAME;
1884 queryString.Append(L"'");
1885 queryString.Append(__pPresentationModel->GetFileName(filePath));
1886 queryString.Append(L"'");
1888 pContentInfoList = contentSearch.SearchN(PAGE_NO_CONTENT_SEARCH, COUNT_PER_PAGE_CONTENT_SEARCH,
1889 totalPage, totalCount, queryString, EMPTY_SPACE, SORT_ORDER_NONE);
1891 if ((pContentInfoList != null) && GetLastResult() == E_SUCCESS && (pContentInfoList->GetCount() > 0))
1893 IEnumerator* pEnum = pContentInfoList->GetEnumeratorN();
1894 while (pEnum->MoveNext() == E_SUCCESS)
1896 pResultItem = static_cast<ContentSearchResult*>(pEnum->GetCurrent());
1897 if (pResultItem == null)
1902 if (pResultItem->GetContentInfo()->GetContentPath().CompareTo(filePath) == 0)
1904 pBitmap = pResultItem->GetContentInfo()->GetThumbnailN();
1910 if (pContentInfoList != null)
1912 delete pContentInfoList;
1915 if (pBitmap != null)
1917 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1918 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
1920 ImageMetadata* pImgMeta = ContentManagerUtil::GetImageMetaN(filePath);
1922 if (pImgMeta != null)
1924 Dimension srcDim(pImgMeta->GetWidth(), pImgMeta->GetHeight());
1925 pBitmap->Scale(srcDim);
1930 ImageBuffer* imageBuffer = new (std::nothrow) ImageBuffer();
1931 result r = imageBuffer->Construct(filePath);
1934 Dimension srcDim(imageBuffer->GetWidth(), imageBuffer->GetHeight());
1935 pBitmap->Scale(srcDim);
1940 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1942 VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(filePath);
1944 if (pVideoMeta != null && GetLastResult() == E_SUCCESS)
1946 Dimension srcDim(pVideoMeta->GetWidth(), pVideoMeta->GetHeight());
1947 pBitmap->Scale(srcDim);
1955 mainCanvas.Construct(DUMMY_IMAGE_RECTANGLE);
1956 mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_WHITE), DUMMY_IMAGE_RECTANGLE);
1957 pBitmap = new (std::nothrow) Bitmap();
1958 pBitmap->Construct(mainCanvas, DUMMY_IMAGE_RECTANGLE);
1961 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));