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;
48 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<208, 82, 82>::Value;
49 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
50 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
52 static const Rectangle RECT_CONTORL_BUTTON_PLAY (280, 400, 160, 160);
53 static const Rectangle RECT_LANDSCAP_CONTORL_BUTTON_PLAY (560, 216, 160, 160);
55 static const Rectangle RECT_DETAILS_CONTORL_PANEL (0, 0, 720, 1008);
56 static const Rectangle RECT_LANDSCAPE_DETAILS_CONTORL_PANEL (0, 0, 1280, 484);
57 static const Rectangle RECT_DETAILS_CONTORL_LABEL (20, 0, 200, 48);
59 static const int GAP_LABEL_END = 60;
60 static const int GAP_W_POPUP_ITEM = 5;
61 static const int W_DELETE_POPUP = 600;
62 static const int H_DELETE_POPUP = 300;
63 static const int H_DELETE_LABEL = 180;
64 static const int Y_DELETE_BUTTON = 180;
65 static const int H_DELETE_BUTTON = 80;
67 static const Dimension DUMMY_IMAGE_DIMENSION (720, 1280);
68 static const Rectangle DUMMY_IMAGE_RECTANGLE (0, 0, 720, 1280);
70 static const int PAGE_NO_CONTENT_SEARCH = 1;
71 static const int COUNT_PER_PAGE_CONTENT_SEARCH = 10;
73 static const int FORMAT_BUFFER_SIZE = 256;
75 static const long long SINGLE_GIGA_BYTE = (1024 * 1024 * 1024);
76 static const long long SINGLE_MEGA_BYTE = (1024 * 1024);
77 static const long long SINGLE_KILO_BYTE = 1024;
79 static const int Y_RENAME_BUTTON = 100;
80 static const int H_RENAME_BUTTON = 64;
81 static const int W_RENAME_BUTTON = 64;
83 static const int X_DETAIL_FILEINFO_LABEL = 20;
84 static const int W_DETAIL_FILEINFO_LABEL = 420;
85 static const int H_DETAIL_FILEINFO_LABEL = 50;
86 static const int H_DETAIL_MAIN_TEXT = 48;
87 static const int H_DETAIL_SUB_TEXT = 42;
88 static const int GAP_H_DETAIL_TEXT = 8;
89 static const int W_DETAIL_FILEINFO_VALUE_LABEL = 650;
90 static const int H_DETAIL_FILEINFO_VALUE_LABEL = 56;
92 static const int X_MORE = 55;
94 static const int DETAIL_SUB_FONT_SIZE = 42;
95 static const int DETAIL_MAIN_FONT_SIZE = 48;
96 static const int DETAIL_COUNT_MAX = 9;
98 ImageViewerForm::ImageViewerForm(void)
99 : __initializeDisplayModeCurrent(APPCONTROL_MODE_NORMAL)
102 , __pScrollPanel(null)
103 , __pDetail_Label(null)
104 , __pLabelMessage(null)
105 , __pPlayButton(null)
106 , __pRenameButton(null)
107 , __pDetailFooterItem(null)
110 , __pDecodeBitmap(null)
111 , __pContextMenuMore(null)
112 , __pContextMenuCopy(null)
113 , __pContextMenuSetAs(null)
114 , __pContextMenuShare(null)
115 , __pDeletePopup(null)
118 , __startSlide(false)
120 , __pPresentationModel(null)
122 AppLogDebug("ENTER");
124 __pDetail_FileInfo_Value_Label[0] = null;
125 __pDetail_FileInfo_Value_Label[1] = null;
126 __pDetail_FileInfo_Value_Label[2] = null;
127 __pDetail_FileInfo_Value_Label[3] = null;
128 __pDetail_FileInfo_Value_Label[4] = null;
129 __pDetail_FileInfo_Value_Label[5] = null;
130 __pDetail_FileInfo_Value_Label[6] = null;
131 __pDetail_FileInfo_Value_Label[7] = null;
132 __pDetail_FileInfo_Value_Label[8] = null;
133 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
136 ImageViewerForm::~ImageViewerForm(void)
138 AppLogDebug("ENTER");
139 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
143 ImageViewerForm::Initialize()
145 AppLogDebug("ENTER");
146 __pPresentationModel = ImageViewerPresentationModel::GetInstance();
148 if (__pPresentationModel->GetFileCount() > 0)
150 if (__pPresentationModel->GetType() == APPCONTROL_DATA_SLIDE_SHOW)
156 __pSettingPresentationModel = SettingPresentationModel::GetInstance();
158 int startIndex = __pPresentationModel->GetStartIndex();
159 String filePath = __pPresentationModel->GetFilePathAt(startIndex);
161 if (filePath.StartsWith(WEB_URL_HTTP, 0) == true)
163 __initializeDisplayModeCurrent = APPCONTROL_MODE_WEB_LINK;
165 else if (__pPresentationModel->GetType() == APPCONTROL_DATA_MESSAGE)
167 __initializeDisplayModeCurrent = APPCONTROL_MODE_MESSAGE;
169 else if (__pPresentationModel->GetType() == APPCONTROL_DATA_EMAIL)
171 __initializeDisplayModeCurrent = APPCONTROL_MODE_EMAIL;
175 __initializeDisplayModeCurrent = APPCONTROL_MODE_NORMAL;
178 result r = Form::Construct(IDL_FORM_IMAGE_VIEWER);
180 if (filePath == EMPTY_SPACE)
182 MessageBox messageBox;
183 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_IV_POP_INVALID_IMAGE_FILE"), MSGBOX_STYLE_NONE,
186 messageBox.ShowAndWait(modalResult);
188 UiApp* pApp = UiApp::GetInstance();
192 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
198 ImageViewerForm::OnInitializing(void)
200 AppLogDebug("ENTER");
201 SetFormBackEventListener(this);
202 __pPresentationModel->AddListener(this);
205 InitializeDisplay(__initializeDisplayModeCurrent);
206 InitializePanelDetail();
209 if ( __initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL
210 || __initializeDisplayModeCurrent == APPCONTROL_MODE_MESSAGE
211 || __initializeDisplayModeCurrent == APPCONTROL_MODE_EMAIL)
213 int index = __pPresentationModel->GetStartIndex();
214 __pGallery->UpdateGallery();
215 __pGallery->SetCurrentItemIndex(index);
218 String filePath = __pPresentationModel->GetFilePathAt(index);
219 __pPresentationModel->RequestImage(filePath);
221 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
228 __pTimer = new (std::nothrow) Timer();
229 __pTimer->Construct(*this);
233 result r = SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
234 AddOrientationEventListener(*this);
235 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
241 ImageViewerForm::OnInitialized(void)
243 AppLogDebug("ENTER");
244 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
250 ImageViewerForm::OnOrientationChanged(const Control &source, OrientationStatus orientationStatus)
252 AppLogDebug("ENTER");
253 if (__detail == false)
255 ShowPanelDetail(true);
259 ShowPanelDetail(false);
262 if (orientationStatus == ORIENTATION_STATUS_PORTRAIT ||
263 orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
265 Rectangle clientRect = GetClientAreaBounds();
266 Rectangle rect = GetBounds();
268 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
269 __pPlayButton->SetBounds(Rectangle(RECT_CONTORL_BUTTON_PLAY.x, RECT_CONTORL_BUTTON_PLAY.y,
270 RECT_CONTORL_BUTTON_PLAY.width, RECT_CONTORL_BUTTON_PLAY.height));
274 else if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE ||
275 orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
277 Rectangle clientRect = GetClientAreaBounds();
278 Rectangle rect = GetBounds();
280 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
281 __pPlayButton->SetBounds(Rectangle(RECT_LANDSCAP_CONTORL_BUTTON_PLAY.x, RECT_LANDSCAP_CONTORL_BUTTON_PLAY.y,
282 RECT_LANDSCAP_CONTORL_BUTTON_PLAY.width, RECT_LANDSCAP_CONTORL_BUTTON_PLAY.height));
286 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
290 ImageViewerForm::InitializeDisplay(AppControlMode status)
292 AppLogDebug("ENTER");
294 String strItemIdxText;
296 __pHeader = GetHeader();
297 __pHeader->AddActionEventListener(*this);
299 __pFooter = GetFooter();
300 __pFooter->AddActionEventListener(*this);
301 __pFooter->RemoveAllItems();
303 GetHeaderString(0, strItemText, strItemIdxText);
304 Rectangle rect = GetClientAreaBounds();
305 __pHeader->SetTitleText(strItemText);
306 __pHeader->SetDescriptionText(strItemIdxText);
308 if (status == APPCONTROL_MODE_NORMAL)
310 __pPlayButton = new (std::nothrow) Button();
311 if (__pPlayButton != null)
313 __pPlayButton->Construct(RECT_CONTORL_BUTTON_PLAY);
314 __pPlayButton->SetActionId(ACTION_ID_CONTORL_BUTTON_PLAY);
315 AddControl(*__pPlayButton);
317 Bitmap* pNormalBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
318 __pPlayButton->SetNormalBackgroundBitmap(*pNormalBackgroundBitmap);
319 delete pNormalBackgroundBitmap;
321 Bitmap* pPressedBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
322 __pPlayButton->SetPressedBackgroundBitmap(*pPressedBackgroundBitmap);
323 delete pPressedBackgroundBitmap;
325 __pPlayButton->AddActionEventListener(*this);
326 __pPlayButton->SetShowState(false);
329 __pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
330 __pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
331 __pFooter->SetBackButton();
333 FooterItem footerItem1;
334 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SHARE);
335 Bitmap* pFooterItemShareNomal =
336 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_SHARE_NORMAL);
337 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemShareNomal);
339 FooterItem footerItem2;
340 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_DELETE);
341 Bitmap* pFooterItemDeleteNomal =
342 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_DELETE_NORMAL);
343 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemDeleteNomal);
345 __pFooter->AddItem(footerItem1);
346 __pFooter->AddItem(footerItem2);
348 delete pFooterItemShareNomal;
349 delete pFooterItemDeleteNomal;
351 ButtonItem buttonItemMore;
352 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
353 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL,
354 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_NORMAL));
355 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED,
356 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_PRESSED));
357 __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItemMore);
359 else if (status == APPCONTROL_MODE_WEB_LINK)
361 __pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
362 __pFooter->SetBackButton();
364 FooterItem footerItem1;
365 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SHARE);
366 Bitmap* pFooterItemShareNomal =
367 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_SHARE_NORMAL);
368 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemShareNomal);
370 FooterItem footerItem2;
371 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_DOWNLOAD);
372 Bitmap* pFooterItemDownlordNomal = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DOWNLOAD);
373 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemDownlordNomal);
375 __pFooter->AddItem(footerItem1);
376 __pFooter->AddItem(footerItem2);
378 delete pFooterItemShareNomal;
379 delete pFooterItemDownlordNomal;
381 ButtonItem buttonItemMore;
382 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
383 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL,
384 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_NORMAL));
385 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED,
386 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_PRESSED));
387 __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItemMore);
389 __pFooter->AddItem(footerItem1);
390 __pFooter->AddItem(footerItem2);
392 else if (status == APPCONTROL_MODE_CROP)
394 FooterItem footerItem1;
395 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SAVE);
396 Bitmap* pfooterItem1 = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_SAVE);
397 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem1);
399 FooterItem footerItem2;
400 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_BACK);
401 Bitmap* pfooterItem2 = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_X);
402 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem2);
404 __pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
405 __pFooter->AddItem(footerItem1);
406 __pFooter->AddItem(footerItem2);
411 else if (status == APPCONTROL_MODE_MESSAGE || status == APPCONTROL_MODE_EMAIL)
413 __pPlayButton = new (std::nothrow) Button();
414 if (__pPlayButton != null)
416 __pPlayButton->Construct(RECT_CONTORL_BUTTON_PLAY);
417 __pPlayButton->SetActionId(ACTION_ID_CONTORL_BUTTON_PLAY);
418 AddControl(*__pPlayButton);
420 Bitmap* pNormalBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
421 __pPlayButton->SetNormalBackgroundBitmap(*pNormalBackgroundBitmap);
422 delete pNormalBackgroundBitmap;
424 Bitmap* pPressedBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
425 __pPlayButton->SetPressedBackgroundBitmap(*pPressedBackgroundBitmap);
426 delete pPressedBackgroundBitmap;
428 __pPlayButton->AddActionEventListener(*this);
429 __pPlayButton->SetShowState(false);
432 __pFooter->SetBackButton();
435 String filePath = __pPresentationModel->GetFilePathAt(0);
436 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
437 if (contentType == CONTENT_TYPE_VIDEO)
439 __pPlayButton->SetShowState(true);
441 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
445 ImageViewerForm::GetHeaderString(int index, String &fileName, String &page)
447 AppLogDebug("ENTER");
448 int allCount = __pPresentationModel->GetFileCount();
449 String pStr = __pPresentationModel->GetFilePathAt(index);
450 fileName = __pPresentationModel->GetFileName(pStr);
451 page.Format(FORMAT_BUFFER_SIZE, L"%d/%d", index + 1, allCount);
452 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
456 ImageViewerForm::DeleteImageFile()
458 AppLogDebug("ENTER");
459 int currentIndex = __pGallery->GetCurrentItemIndex();
461 String strItemText(EMPTY_SPACE);
462 String strItemIdxText(EMPTY_SPACE);
463 int countPath = __pPresentationModel->GetFileCount();
464 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
465 result r = E_SUCCESS;
466 if (filePath.GetLength() == 0)
468 UiApp* pApp = UiApp::GetInstance();
470 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
475 if (filePath.StartsWith(Environment::GetMediaPath(), 0) == true
476 || filePath.StartsWith(Environment::GetExternalStoragePath(), 0) == true)
478 ContentId contentId = __pPresentationModel->GetFileContentId(filePath);
479 ContentManager contentManager;
480 contentManager.Construct();
481 r = contentManager.DeleteContent(contentId);
484 r = File::Remove(filePath);
487 MessageBox messageBox;
488 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_DELETE_FAILED"),
489 MSGBOX_STYLE_NONE, 3000);
491 messageBox.ShowAndWait(modalResult);
492 AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
500 r = File::Remove(filePath);
503 __pPresentationModel->DeleteFilePathAt(currentIndex);
506 UiApp* pApp = UiApp::GetInstance();
508 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
512 else if ((countPath - 1) == currentIndex)
514 __pGallery->SetCurrentItemIndex(--currentIndex);
517 __pGallery->UpdateGallery();
518 filePath = __pPresentationModel->GetFilePathAt(currentIndex);
519 __pPresentationModel->RequestImage(filePath);
521 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
522 __pHeader->SetTitleText(strItemText);
523 __pHeader->SetDescriptionText(strItemIdxText);
525 if (__visible == true)
527 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
529 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
531 __pPlayButton->SetShowState(false);
535 __pPlayButton->SetShowState(true);
539 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
545 ImageViewerForm::CallVideoPlayer(void)
547 AppLogDebug("ENTER");
548 int index = __pGallery->GetCurrentItemIndex();
549 String filePath = __pPresentationModel->GetFilePathAt(index);
551 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
552 pDataList->Construct();
553 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),
554 new (std::nothrow) String(APPCONTROL_DATA_VIDEO));
555 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), new (std::nothrow) String(filePath));
557 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_VIDEO_PLAYER,
558 APPCONTROL_OPERATION_ID_PLAY, pDataList, this);
559 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
563 ImageViewerForm::CreateGallery(void)
565 AppLogDebug("ENTER");
566 Rectangle clientRect = GetClientAreaBounds();
567 Rectangle rect = GetBounds();
569 __pGallery = new (std::nothrow) Gallery();
570 __pGallery->Construct(Rectangle(0, -clientRect.y, rect.width, rect.height));
571 __pGallery->SetName(L"GalleryControl");
572 __pGallery->SetItemProvider(*this);
573 __pGallery->AddGalleryEventListener(*this);
574 AddControl(*__pGallery);
575 __pGallery->SetTextOfEmptyGallery(ResourceManager::GetString(L"IDS_COM_BODY_LOADING"));
577 SlideShowTransitionEffect effect = __pPresentationModel->GetTransitionEffectOfSlideShow();
581 case SLIDE_SHOW_TRANSITION_EFFECT_DISSOLVE:
582 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_DISSOLVE);
584 case SLIDE_SHOW_TRANSITION_EFFECT_ZOOM:
585 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_ZOOM);
587 case SLIDE_SHOW_TRANSITION_EFFECT_SLIDE:
591 __pGallery->SetSlideShowViewDuration(__pPresentationModel->GetDurationOfSlideShow());
593 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
597 ImageViewerForm::InitializePanelDetail()
599 AppLogDebug("ENTER");
600 __pScrollPanel = new (std::nothrow) ScrollPanel();
602 String arrayId[DETAIL_COUNT_MAX] =
604 L"IDS_COM_BODY_DETAILS_NAME", L"IDS_IV_BODY_FILE_FORMAT", L"IDS_IV_BODY_DATE_CREATED",
605 L"IDS_COM_BODY_SIZE", L"IDS_IV_BODY_RESOLUTION", L"IDS_COM_BODY_LOCATION",
606 L"IDS_COM_BODY_LATITUDE", L"IDS_COM_BODY_LONGITUDE", L"IDS_IV_BODY_FILE_LOCATION"
609 if (__pScrollPanel == null)
611 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
613 return E_INVALID_STATE;
616 result r = __pScrollPanel->Construct(RECT_DETAILS_CONTORL_PANEL);
619 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
621 return E_INVALID_STATE;
624 __pDetail_Label = new (std::nothrow) Label();
625 __pDetail_Label->Construct(RECT_DETAILS_CONTORL_LABEL, ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"));
626 __pScrollPanel->AddControl(*__pDetail_Label);
627 __pDetail_Label->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
628 __pDetail_Label->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
629 __pDetail_Label->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
630 __pDetail_Label->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
632 for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
634 __pDetail_FileInfo_Label[i] = new (std::nothrow) Label();
635 __pDetail_FileInfo_Label[i]->Construct(
636 Rectangle(X_DETAIL_FILEINFO_LABEL,
637 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT + H_DETAIL_SUB_TEXT) * i,
638 W_DETAIL_FILEINFO_LABEL, H_DETAIL_FILEINFO_LABEL), ResourceManager::GetString(arrayId[i]));
639 __pScrollPanel->AddControl(*__pDetail_FileInfo_Label[i]);
641 __pDetail_FileInfo_Label[i]->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
642 __pDetail_FileInfo_Label[i]->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
643 __pDetail_FileInfo_Label[i]->SetTextColor(Color::GetColor(COLOR_ID_GREY));
644 __pDetail_FileInfo_Label[i]->SetTextConfig(DETAIL_SUB_FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
646 __pDetail_FileInfo_Value_Label[i] = new (std::nothrow) Label();
647 __pDetail_FileInfo_Value_Label[i]->Construct(
648 Rectangle(X_DETAIL_FILEINFO_LABEL,
649 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT * i) + H_DETAIL_SUB_TEXT * (i + 1),
650 W_DETAIL_FILEINFO_VALUE_LABEL, H_DETAIL_FILEINFO_VALUE_LABEL), L"");
651 __pScrollPanel->AddControl(*__pDetail_FileInfo_Value_Label[i]);
653 __pDetail_FileInfo_Value_Label[i]->SetTextVerticalAlignment(ALIGNMENT_BOTTOM);
654 __pDetail_FileInfo_Value_Label[i]->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
655 __pDetail_FileInfo_Value_Label[i]->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
656 __pDetail_FileInfo_Value_Label[i]->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
659 __pScrollPanel->SetBackgroundColor(COLOR_HEADER_CONTORL_PANEL);
660 __pScrollPanel->SetShowState(false);
662 AddControl(*__pScrollPanel);
663 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
669 ImageViewerForm::InitializePopup(void)
671 AppLogDebug("ENTER");
672 if (__pDeletePopup == null)
674 __pDeletePopup = new (std::nothrow) Popup();
675 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
677 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
679 Label* pLabel = new (std::nothrow) Label();
680 pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
681 ResourceManager::GetString(L"IDS_COM_BODY_DELETE") + L"?");
683 Button* pDeleteButton = new (std::nothrow) Button();
684 pDeleteButton->Construct(
685 Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
686 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
687 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
688 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
689 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
690 pDeleteButton->SetActionId(ACTION_ID_DELETE_POPUP_DEL);
691 pDeleteButton->AddActionEventListener(*this);
693 Button* pCancelButton = new (std::nothrow) Button();
694 pCancelButton->Construct(
695 Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM,
696 Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
697 ResourceManager::GetString(L"IDS_COM_SK_CANCEL"));
698 pCancelButton->SetActionId(ACTION_ID_DELETE_POPUP_CANCEL);
699 pCancelButton->AddActionEventListener(*this);
701 __pDeletePopup->AddControl(*pLabel);
702 __pDeletePopup->AddControl(*pDeleteButton);
703 __pDeletePopup->AddControl(*pCancelButton);
707 __pDeletePopup->SetShowState(true);
708 __pDeletePopup->Show();
710 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
716 ImageViewerForm::InitializeContextMenuMore(void)
718 AppLogDebug("ENTER");
719 int currentIndex = __pGallery->GetCurrentItemIndex();
720 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
722 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
724 if (__pContextMenuMore != null)
726 delete __pContextMenuMore;
727 __pContextMenuMore = null;
730 __pContextMenuMore = new (std::nothrow) ContextMenu();
732 __pContextMenuMore->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
733 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
735 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
737 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_SET_AS"),
738 ACTION_ID_CONTEXTMENU_SET_AS);
741 if (__pGallery->GetItemCount() > 1)
743 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_SLIDE_SHOW"),
744 ACTION_ID_FOOTER_BUTTON_SLIDE);
746 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"),
747 ACTION_ID_FOOTER_BUTTON_DETAILS);
748 __pContextMenuMore->SetShowState(false);
749 __pContextMenuMore->AddActionEventListener(*this);
750 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
756 ImageViewerForm::InitializeContextMenuSetAs(void)
758 AppLogDebug("ENTER");
760 if (__pContextMenuSetAs != null)
762 delete __pContextMenuSetAs;
763 __pContextMenuSetAs = null;
766 __pContextMenuSetAs = new (std::nothrow) ContextMenu();
767 __pContextMenuSetAs->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
768 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
770 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_HOME_SCREEN_WALLPAPER_ABB"),
771 ACTION_ID_CONTEXTMENU_HOME);
772 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_LOCK_SCREEN_WALLPAPER_ABB"),
773 ACTION_ID_CONTEXTMENU_LOCK);
774 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_BODY_CALLER_IMAGE"),
775 ACTION_ID_CONTEXTMENU_CALLER);
776 __pContextMenuSetAs->AddActionEventListener(*this);
777 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
783 ImageViewerForm::InitializeContextMenuShare(void)
785 AppLogDebug("ENTER");
786 if (__pContextMenuShare != null)
788 delete __pContextMenuShare;
789 __pContextMenuShare = null;
791 __pContextMenuShare = new (std::nothrow) ContextMenu();
792 __pContextMenuShare->Construct(Point((GetClientAreaBounds().width - (X_MORE * 4)) / 4 + X_MORE * 2,
793 GetClientAreaBounds().y + GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST,
794 CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
796 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
797 ACTION_ID_CONTEXTMENU_MESSAGE);
798 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), ACTION_ID_CONTEXTMENU_EMAIL);
799 __pContextMenuShare->AddActionEventListener(*this);
800 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
806 ImageViewerForm::GetFileSize(String filePath)
808 AppLogDebug("ENTER");
812 result r = File::GetAttributes(filePath, attr);
815 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
819 size = attr.GetFileSize();
820 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
826 ImageViewerForm::SetDetailInfo(void)
828 AppLogDebug("ENTER");
830 Rectangle clientRect = GetClientAreaBounds();
831 AppLogDebug("PORTRAIT GetClientAreaBounds(%d %d %d %d)", clientRect.x, clientRect.y, clientRect.width, clientRect.height);
832 OrientationStatus currentOrientaton = GetOrientationStatus();
834 if (currentOrientaton == ORIENTATION_STATUS_LANDSCAPE || currentOrientaton == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
836 __pScrollPanel->SetBounds(Rectangle(0, 0, clientRect.width, RECT_LANDSCAPE_DETAILS_CONTORL_PANEL.height));
840 __pScrollPanel->SetBounds(0, 0, clientRect.width, RECT_DETAILS_CONTORL_PANEL.height);
843 int currentIndex = __pGallery->GetCurrentItemIndex();
844 String strFilePath = __pPresentationModel->GetFilePathAt(currentIndex);
846 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(strFilePath);
848 String strResult[DETAIL_COUNT_MAX] = {EMPTY_SPACE, };
850 strResult[0] = __pPresentationModel->GetFileName(strFilePath);
851 strResult[1] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
854 result r = File::GetAttributes(strFilePath, attr);
857 long long nSize = attr.GetFileSize();
858 DateTime dateTime = attr.GetDateTime();
859 strResult[2] = dateTime.ToString();
861 if (nSize > SINGLE_GIGA_BYTE)
863 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_GIGA_BYTE);
864 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_GB"));
866 else if (nSize > SINGLE_MEGA_BYTE)
868 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_MEGA_BYTE);
869 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_MB"));
871 else if (nSize > SINGLE_KILO_BYTE)
873 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_KILO_BYTE);
874 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_KB"));
878 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize);
879 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_B"));
884 strResult[2] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
885 strResult[3] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
888 strResult[4] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
889 strResult[5] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
890 strResult[6] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
891 strResult[7] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
892 strResult[8] = strFilePath;
894 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
896 strResult[0] = __downLordFileName;
898 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
900 ImageMetadata* pImgMeta = ContentManagerUtil::GetImageMetaN(strFilePath);
902 if (pImgMeta != null)
904 ImageContentInfo imageContentInfo;
905 r = imageContentInfo.Construct(&strFilePath);
908 strResult[1] = imageContentInfo.GetMediaFormat();
909 strResult[4].Format(FORMAT_BUFFER_SIZE, L"%d x %d", pImgMeta->GetWidth(),
910 pImgMeta->GetHeight());
912 if (imageContentInfo.GetLocationTag() != EMPTY_SPACE)
914 strResult[5].Format(FORMAT_BUFFER_SIZE, L"%ls", imageContentInfo.GetLocationTag().GetPointer());
917 if (pImgMeta->GetLatitude() > 1.0 && pImgMeta->GetLongitude() > 1.0)
919 strResult[6].Format(FORMAT_BUFFER_SIZE, L"%f", pImgMeta->GetLatitude());
920 strResult[7].Format(FORMAT_BUFFER_SIZE, L"%f", pImgMeta->GetLongitude());
923 strResult[8] = imageContentInfo.GetContentPath();
928 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
930 VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(strFilePath);
931 if (pVideoMeta != null)
933 VideoContentInfo videoContentInfo;
934 r = videoContentInfo.Construct(&strFilePath);
937 strResult[1] = videoContentInfo.GetMediaFormat();
938 strResult[4].Format(FORMAT_BUFFER_SIZE, L"%d x %d", pVideoMeta->GetWidth(),
939 pVideoMeta->GetHeight());
940 if (videoContentInfo.GetLocationTag() != EMPTY_SPACE)
942 strResult[5].Format(FORMAT_BUFFER_SIZE, L"%ls", videoContentInfo.GetLocationTag().GetPointer());
945 strResult[8] = videoContentInfo.GetContentPath();
950 for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
952 __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),
953 clientRect.width - GAP_LABEL_END, H_DETAIL_FILEINFO_VALUE_LABEL);
954 __pDetail_FileInfo_Value_Label[i]->SetText(strResult[i]);
955 __pDetail_FileInfo_Value_Label[i]->RequestRedraw();
958 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
960 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
964 if (__pRenameButton == null)
966 __pRenameButton = new (std::nothrow) Button();
967 Rectangle rect = GetBounds();
968 __pRenameButton->Construct(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
969 __pRenameButton->SetActionId(ACTION_ID_PANEL_HEADER_DETAILS_RENAME);
971 Bitmap* pIcon = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME);
972 Bitmap* pIconBackground =
973 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND);
974 Bitmap* pIconPressed =
975 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND_PRESS);
977 if (pIcon != null && pIconPressed != null && pIconBackground != null)
979 __pRenameButton->SetNormalBackgroundBitmap(*pIconBackground);
980 __pRenameButton->SetPressedBackgroundBitmap(*pIconPressed);
981 Point iconPosition(0, 0);
982 __pRenameButton->SetNormalBitmap(iconPosition, *pIcon);
983 __pRenameButton->SetPressedBitmap(iconPosition, *pIconPressed);
987 __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
988 __pRenameButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_HEADER_BUTTON1);
992 delete pIconBackground;
994 __pScrollPanel->AddControl(*__pRenameButton);
995 __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
996 __pRenameButton->AddActionEventListener(*this);
1000 Rectangle rect = GetBounds();
1001 __pRenameButton->SetBounds(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
1003 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1009 ImageViewerForm::ShowPanelDetail(bool showStatus)
1011 AppLogDebug("ENTER");
1015 __pScrollPanel->SetShowState(true);
1020 __pScrollPanel->SetShowState(false);
1023 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1029 ImageViewerForm::ChangeFooterItem(bool isChanged, Footer* pFooter, int position)
1031 AppLogDebug("ENTER");
1032 FooterItem footerItem;
1033 footerItem.Construct(ACTION_ID_FOOTER_BUTTON_DETAILS);
1034 Bitmap* pfooterItem = null;
1038 pfooterItem = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS_CLOSE);
1039 footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem);
1043 pfooterItem = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS);
1044 footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem);
1047 pFooter->SetItemAt(position, footerItem);
1048 pFooter->Invalidate(true);
1052 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1058 ImageViewerForm::DownloadFile(void)
1060 AppLogDebug("ENTER");
1061 String DestPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_WEB_FILE;
1062 if (File::IsFileExist(DestPath) == false)
1064 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1068 ContentId contentId;
1069 ContentManager contentManager;
1070 contentManager.Construct();
1072 ImageContentInfo imageContentInfo;
1073 imageContentInfo.Construct(null);
1075 imageContentInfo.SetKeyword(L"platform, tizen");
1076 String sourcePath = DestPath;
1077 String destPath = Environment::GetMediaPath();
1078 destPath.Append(FOLDER_PATH_DOWNLOADS);
1079 destPath.Append(__downLordFileName);
1081 contentId = contentManager.CreateContent(sourcePath, destPath, true, &imageContentInfo);
1082 ImageViewerForm::OnFormBackRequested(*this);
1083 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1087 ImageViewerForm::GetItemCount(void)
1089 AppLogDebug("ENTER");
1090 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1092 return __pPresentationModel->GetFileCount();
1096 ImageViewerForm::CreateItem(int index)
1098 AppLogDebug("ENTER : index(%d)", index);
1099 GalleryItem* pGallery = new (std::nothrow) GalleryItem();
1101 String filePath = __pPresentationModel->GetFilePathAt(index);
1102 ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
1103 Bitmap* pBitmap = pImageInfo->GetBitmapN();
1104 if (pBitmap == null)
1106 pBitmap = GetQuickThumbnailN(filePath);
1108 if (pBitmap == null)
1110 pBitmap = new (std::nothrow) Bitmap();
1111 pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
1114 pGallery->Construct(*pBitmap, filePath);
1116 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1122 ImageViewerForm::DeleteItem(int index, GalleryItem* pItem)
1124 AppLogDebug("ENTER index(%d)", index);
1125 ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
1126 pImageInfo->ClearBitmap();
1128 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1134 ImageViewerForm::OnGalleryCurrentItemChanged(Gallery& view, int index)
1136 AppLogDebug("ENTER index(%d)", index);
1138 String filePath = __pPresentationModel->GetFilePathAt(index);
1139 AppLogDebug("ENTER index(%d) filePath(%ls)", index, filePath.GetPointer());
1140 __pPresentationModel->RequestImage(filePath);
1143 String strItemIdxText;
1144 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
1145 __pHeader->SetTitleText(strItemText);
1146 __pHeader->SetDescriptionText(strItemIdxText);
1148 if (__visible == true)
1150 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1151 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1153 __pPlayButton->SetShowState(true);
1157 __pPlayButton->SetShowState(false);
1162 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1166 ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index)
1168 AppLogDebug("ENTER");
1170 String filePath = __pPresentationModel->GetFilePathAt(index);
1171 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1173 if (__visible == true)
1175 if (contentType == CONTENT_TYPE_VIDEO)
1177 __pPlayButton->SetShowState(false);
1180 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
1185 if (contentType == CONTENT_TYPE_VIDEO)
1187 __pPlayButton->SetShowState(true);
1190 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
1193 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
1194 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y + 1);
1197 Rectangle clientRect = GetClientAreaBounds();
1198 Rectangle rect = GetBounds();
1199 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1201 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1205 ImageViewerForm::OnGallerySlideShowStarted(Gallery& gallery)
1207 AppLogDebug("ENTER");
1208 PowerManager::KeepScreenOnState(true, false);
1209 if (__visible == true)
1211 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
1213 int index = __pGallery->GetCurrentItemIndex();
1214 String filePath = __pPresentationModel->GetFilePathAt(index);
1215 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1217 if (contentType == CONTENT_TYPE_VIDEO)
1219 __pPlayButton->SetShowState(false);
1225 Rectangle clientRect = GetClientAreaBounds();
1226 Rectangle rect = GetBounds();
1227 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1229 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1233 ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery)
1235 AppLogDebug("ENTER");
1236 PowerManager::KeepScreenOnState(false, true);
1237 int index = __pGallery->GetCurrentItemIndex();
1239 if (__visible == false)
1241 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
1243 String filePath = __pPresentationModel->GetFilePathAt(index);
1244 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1245 if (contentType == CONTENT_TYPE_VIDEO)
1247 __pPlayButton->SetShowState(true);
1250 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
1251 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y + 1);
1257 String strItemIdxText;
1258 GetHeaderString(index, strItemText, strItemIdxText);
1259 __pHeader->SetTitleText(strItemText);
1260 __pHeader->SetDescriptionText(strItemIdxText);
1262 Rectangle clientRect = GetClientAreaBounds();
1263 Rectangle rect = GetBounds();
1264 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1267 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1271 ImageViewerForm::OnUpdateContentList(void)
1276 ImageViewerForm::OnTerminating(void)
1278 AppLogDebug("ENTER");
1280 if (__pTimer != null)
1287 __pPresentationModel->ClearImageRequests();
1288 __pPresentationModel->RemoveListener(*this);
1290 if (__pContextMenuCopy != null)
1292 delete __pContextMenuCopy;
1293 __pContextMenuCopy = null;
1296 if (__pContextMenuSetAs != null)
1298 delete __pContextMenuSetAs;
1299 __pContextMenuSetAs = null;
1302 if (__pDeletePopup != null)
1304 delete __pDeletePopup;
1305 __pDeletePopup = null;
1308 if (__pContextMenuShare != null)
1310 delete __pContextMenuShare;
1311 __pContextMenuShare = null;
1314 if (__pContextMenuMore != null)
1316 delete __pContextMenuMore;
1317 __pContextMenuMore = null;
1320 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1326 ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
1328 AppLogDebug("ENTER actionId(%d)", actionId);
1329 SceneManager* pSceneManager = SceneManager::GetInstance();
1334 case ACTION_ID_FOOTER_MORE:
1336 InitializeContextMenuMore();
1338 __pContextMenuMore->SetShowState(true);
1339 __pContextMenuMore->Show();
1342 case ACTION_ID_CONTEXTMENU_SET_AS:
1343 InitializeContextMenuSetAs();
1345 __pContextMenuSetAs->SetShowState(true);
1346 __pContextMenuSetAs->Show();
1348 case ACTION_ID_FOOTER_BUTTON_SHARE:
1349 InitializeContextMenuShare();
1351 __pContextMenuShare->SetShowState(true);
1352 __pContextMenuShare->Show();
1354 case ACTION_ID_FOOTER_BUTTON_DELETE:
1355 __pDeletePopup->SetShowState(true);
1356 __pDeletePopup->Show();
1358 case ACTION_ID_FOOTER_BUTTON_SLIDE:
1360 int repeatValue = 0;
1362 if (__pPresentationModel->GetFileCount() > 1)
1364 __pGallery->UpdateGallery();
1365 if (__detail == false)
1367 ShowPanelDetail(false);
1370 __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
1371 ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
1373 if( repeatValue == 0)
1375 __pGallery->StartSlideShow(false);
1379 __pGallery->StartSlideShow(true);
1384 case ACTION_ID_FOOTER_BUTTON_DETAILS:
1386 ShowPanelDetail(__detail);
1389 case ACTION_ID_FOOTER_BUTTON_BACK:
1390 ImageViewerForm::OnFormBackRequested(*this);
1392 case ACTION_ID_FOOTER_BUTTON_DOWNLOAD:
1395 case ACTION_ID_FOOTER_BUTTON_SAVE:
1397 case ACTION_ID_PANEL_HEADER_DETAILS_RENAME:
1399 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
1400 pSelectedIndex->Construct();
1401 pSelectedIndex->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1402 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_NAME_EDITOR), pSelectedIndex);
1405 case ACTION_ID_CONTEXTMENU_HOME:
1407 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1408 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1409 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_HOME_SCREEN_WALLPAPER));
1410 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1411 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1414 case ACTION_ID_CONTEXTMENU_LOCK:
1416 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1417 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1418 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_LOCK_SCREEN_WALLPAPER));
1419 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1420 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1423 case ACTION_ID_CONTEXTMENU_CALLER:
1425 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1426 pDataList->Construct();
1427 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SELECTION_MODE),
1428 new (std::nothrow) String(APPCONTROL_DATA_SINGLE));
1429 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_RETURN_TYPE),
1430 new (std::nothrow) String(APPCONTROL_DATA_CONTACT_ID));
1432 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_CONTACTS,
1433 APPCONTROL_OPERATION_ID_PICK, pDataList, this);
1436 case ACTION_ID_CONTEXTMENU_EMAIL:
1438 OnRequestEmailAction();
1441 case ACTION_ID_CONTEXTMENU_MESSAGE:
1443 OnRequestMessagesAction();
1446 case ACTION_ID_CONTEXTMENU_COPY:
1448 int currentIndex = __pGallery->GetCurrentItemIndex();
1449 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1452 item.Construct(CLIPBOARD_DATA_TYPE_IMAGE, filePath);
1453 Clipboard* pClipboard = Clipboard::GetInstance();
1454 pClipboard->CopyItem(item);
1457 case ACTION_ID_DELETE_POPUP_DEL:
1459 __pDeletePopup->SetShowState(false);
1460 __pDeletePopup->Show();
1463 if (__detail == false)
1465 ShowPanelDetail(false);
1469 case ACTION_ID_DELETE_POPUP_CANCEL:
1471 __pDeletePopup->SetShowState(false);
1472 __pDeletePopup->Show();
1475 case ACTION_ID_CONTORL_BUTTON_PLAY:
1481 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1485 ImageViewerForm::OnFormBackRequested(Form& source)
1487 AppLogDebug("ENTER");
1488 if (__detail == false)
1490 ShowPanelDetail(false);
1494 UiApp* pApp = UiApp::GetInstance();
1497 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1501 ImageViewerForm::OnSceneActivatedN(const SceneId& previousSceneId,
1502 const SceneId& currentSceneId, IList* pArgs)
1504 AppLogDebug("ENTER");
1505 OrientationStatus status = GetOrientationStatus();
1506 if (status == ORIENTATION_STATUS_PORTRAIT ||
1507 status == ORIENTATION_STATUS_PORTRAIT_REVERSE)
1509 AppLogDebug("ORIENTATION_STATUS : PORTRAIT");
1510 Rectangle clientRect = GetClientAreaBounds();
1511 Rectangle rect = GetBounds();
1512 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1513 __pPlayButton->SetBounds(RECT_CONTORL_BUTTON_PLAY);
1514 __pScrollPanel->SetBounds(RECT_DETAILS_CONTORL_PANEL);
1516 else if (status == ORIENTATION_STATUS_LANDSCAPE ||
1517 status == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
1519 AppLogDebug("ORIENTATION_STATUS : LANDSCAPE");
1520 Rectangle clientRect = GetClientAreaBounds();
1521 Rectangle rect = GetBounds();
1522 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1523 __pPlayButton->SetBounds(RECT_LANDSCAP_CONTORL_BUTTON_PLAY);
1524 __pScrollPanel->SetBounds(RECT_LANDSCAPE_DETAILS_CONTORL_PANEL);
1527 if (previousSceneId == IDSCN_IMAGE_NAME_EDITOR && currentSceneId == IDSCN_IMAGE_VIEWER)
1530 String strItemText(EMPTY_SPACE);
1531 String strItemIdxText(EMPTY_SPACE);
1532 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
1533 __pHeader->SetTitleText(strItemText);
1534 __pHeader->SetDescriptionText(strItemIdxText);
1538 if (__pGallery->GetCurrentItemIndex() < 0)
1540 SetFooterItemState(false);
1544 SetFooterItemState(true);
1547 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1551 ImageViewerForm::OnSceneDeactivated(const SceneId& currentSceneId,
1552 const SceneId& nextSceneId)
1554 AppLogDebug("ENTER");
1555 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1559 ImageViewerForm::OnImageDecodedN(const int index)
1561 AppLogDebug("ENTER");
1562 __pGallery->RefreshGallery(index, GALLERY_REFRESH_TYPE_ITEM_MODIFY);
1564 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1568 ImageViewerForm::OnAppControlCompleteResponseReceived(const AppId& appId,
1569 const String& operationId, AppCtrlResult appControlResult,
1570 const IMap* pExtraData)
1572 AppLogDebug("ENTER");
1574 if (appId == APPCONTROL_PROVIDER_ID_CONTACTS
1575 && operationId == APPCONTROL_OPERATION_ID_PICK
1576 && appControlResult == APP_CTRL_RESULT_SUCCEEDED)
1578 const String* pReturnType =
1579 static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_RETURN_TYPE)));
1580 if (pReturnType != null && pReturnType->CompareTo(APPCONTROL_DATA_CONTACT_ID) == 0)
1582 const String* pContactId =
1583 static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_VALUE)));
1584 SceneManager* pSceneManager = SceneManager::GetInstance();
1585 long long lresult = 0;
1586 if (pContactId != null && pContactId->GetLength() > 0)
1588 LongLong::Parse(*pContactId, lresult);
1590 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1591 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1592 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_CALLER_IMAGE));
1593 pList->Add(new (std::nothrow) LongLong(lresult));
1594 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1595 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1599 ImageViewerApp* pImageViewerApp = static_cast<ImageViewerApp*>(ImageViewerApp::GetInstance());
1600 pImageViewerApp->SetFrameEnabled(true);
1601 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1605 ImageViewerForm::OnOverlayControlCreated(const Control& source)
1607 AppLogDebug("ENTER");
1608 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1612 ImageViewerForm::OnOverlayControlOpened(const Control& source)
1614 AppLogDebug("ENTER");
1615 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1619 ImageViewerForm::OnOverlayControlClosed(const Control& source)
1621 AppLogDebug("ENTER");
1622 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1626 ImageViewerForm::OnOtherControlSelected(const Control& source)
1628 AppLogDebug("ENTER");
1629 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1633 ImageViewerForm::InitShowGallery(void)
1635 AppLogDebug("ENTER");
1636 if (__pGallery != null && __pGallery->IsVisible() == false)
1638 Canvas* pCanvas = GetCanvasN();
1639 if (pCanvas == null || GetLastResult() != E_SUCCESS)
1641 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1647 __pGallery->SetShowState(true);
1651 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1655 ImageViewerForm::OnTimerExpired(Timer &timer)
1657 int repeatValue = 0;
1658 AppLogDebug("ENTER");
1659 if (__pPresentationModel->GetFileCount() > 1)
1661 __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
1662 ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
1664 if( repeatValue == 0)
1666 __pGallery->StartSlideShow(false);
1670 __pGallery->StartSlideShow(true);
1673 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1677 ImageViewerForm::OnContentTransferInProgress(RequestId requestId, int totalReceivedSize)
1679 AppLogDebug("ENTER");
1680 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1684 ImageViewerForm::OnContentUploadCompleted(RequestId requestId, result transferResult, const String& errorCode,
1685 const String& errorMessage)
1687 AppLogDebug("ENTER");
1688 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1692 ImageViewerForm::OnContentDownloadCompleted(RequestId requestId, ContentId contentId,
1693 result transferResult, const String& errorCode, const String& errorMessage)
1695 AppLogDebug("ENTER");
1696 AppLogTag("IV", "ImageViewerForm::OnContentDownloadCompleted");
1697 AppLogTag("IV", "DownloadCompleted Error [%s]", GetErrorMessage(transferResult));
1698 AppLogTag("IV", "errorCode [%ls] errorMessage [%ls]", errorCode.GetPointer(), errorMessage.GetPointer());
1699 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1703 ImageViewerForm::OnContentDownloadToBufferCompleted(RequestId reqId, ByteBuffer* pBuffer, result r,
1704 const String& errorCode, const String& errorMessage)
1706 AppLogDebug("ENTER");
1707 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1711 ImageViewerForm::OnContentTransferCanceled(RequestId reqId, result res, const String& errorCode,
1712 const String& errorMessage)
1714 AppLogDebug("ENTER");
1715 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1719 ImageViewerForm::RequestDecodeUrl(void)
1721 AppLogDebug("ENTER");
1723 String filePath = __pPresentationModel->GetFilePathAt(0);
1725 if (filePath.StartsWith(WEB_URL_HTTP, 0) == false)
1727 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1732 __downLordFileName = __pPresentationModel->GetFileName(filePath);
1734 Image* pImage = new (std::nothrow) Image();
1735 pImage->Construct();
1738 uri.SetUri(filePath);
1740 pImage->DecodeUrl(uri, BITMAP_PIXEL_FORMAT_RGB565, 720, 1280, reqId, *this, 5000);
1744 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1748 ImageViewerForm::OnImageDecodeUrlReceived (RequestId reqId, Bitmap *pBitmap,
1749 result r, const String errorCode, const String errorMessage)
1751 AppLogDebug("ENTER");
1752 Image* pImage = new (std::nothrow) Image();
1753 pImage->Construct();
1755 String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_WEB_FILE;
1756 r = pImage->EncodeToFile(*pBitmap, IMG_FORMAT_JPG, destPath, true);
1760 __pPresentationModel->GetImageCacheAt(0)->SetFilePath(destPath);
1761 __pPresentationModel->GetImageCacheAt(0)->SetBitmap(pBitmap);
1763 __pGallery->RefreshGallery(0, GALLERY_REFRESH_TYPE_ITEM_MODIFY);
1765 __pPresentationModel->RequestImage(destPath);
1769 AppLogDebug("ImageViewerForm::OnImageDecodeUrlReceived [%s]", GetErrorMessage(r));
1774 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1778 ImageViewerForm::OnRequestEmailAction(void)
1780 AppLogDebug("ENTER");
1781 int currentIndex = __pGallery->GetCurrentItemIndex();
1783 if (__pPresentationModel->GetFileCount() <= 0)
1785 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1789 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1791 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1793 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE || mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1795 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1796 pDataList->Construct();
1797 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
1798 new (std::nothrow) String(filePath));
1800 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL,
1801 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, this);
1803 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1807 ImageViewerForm::OnRequestMessagesAction(void)
1809 AppLogDebug("ENTER");
1810 int currentIndex = __pGallery->GetCurrentItemIndex();
1812 if (__pPresentationModel->GetFileCount() <= 0)
1814 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1818 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1820 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1822 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE || mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1824 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1825 pDataList->Construct();
1826 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),
1827 new (std::nothrow) String(filePath));
1828 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
1829 new (std::nothrow) String(APPCONTROL_DATA_MMS));
1831 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGES,
1832 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, this);
1834 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1838 ImageViewerForm::SetFooterItemState(bool isEnable)
1840 AppLogDebug("ENTER");
1841 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL)
1843 __pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, isEnable);
1844 __pFooter->SetItemEnabled(0, isEnable);
1845 __pFooter->SetItemEnabled(1, isEnable);
1847 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
1849 __pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, isEnable);
1850 __pFooter->SetItemEnabled(0, isEnable);
1851 __pFooter->SetItemEnabled(1, isEnable);
1853 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_CROP)
1855 __pFooter->SetItemEnabled(0, isEnable);
1857 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1861 ImageViewerForm::GetQuickThumbnailN(String& filePath)
1863 AppLogDebug("ENTER");
1864 Bitmap* pBitmap = null;
1866 if (filePath.GetLength() > 4)
1870 ContentSearch contentSearch;
1871 ContentSearchResult* pResultItem = null;
1872 IList* pContentInfoList = null;
1874 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1875 result r = contentSearch.Construct(contentType);
1876 AppLogDebug("r(%s)", GetErrorMessage(r));
1879 pBitmap = new (std::nothrow) Bitmap();
1880 r = pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
1891 queryString = CONTENT_QUERY_PREFIX_FILENAME;
1892 queryString.Append(L"'");
1893 queryString.Append(__pPresentationModel->GetFileName(filePath));
1894 queryString.Append(L"'");
1896 pContentInfoList = contentSearch.SearchN(PAGE_NO_CONTENT_SEARCH, COUNT_PER_PAGE_CONTENT_SEARCH,
1897 totalPage, totalCount, queryString, EMPTY_SPACE, SORT_ORDER_NONE);
1899 if ((pContentInfoList != null) && GetLastResult() == E_SUCCESS && (pContentInfoList->GetCount() > 0))
1901 IEnumerator* pEnum = pContentInfoList->GetEnumeratorN();
1902 while (pEnum->MoveNext() == E_SUCCESS)
1904 pResultItem = static_cast<ContentSearchResult*>(pEnum->GetCurrent());
1905 if (pResultItem == null)
1910 if (pResultItem->GetContentInfo()->GetContentPath().CompareTo(filePath) == 0)
1912 pBitmap = pResultItem->GetContentInfo()->GetThumbnailN();
1918 if (pContentInfoList != null)
1920 delete pContentInfoList;
1923 if (pBitmap != null)
1925 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1926 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
1928 ImageMetadata* pImgMeta = ContentManagerUtil::GetImageMetaN(filePath);
1930 if (pImgMeta != null)
1932 Dimension srcDim(pImgMeta->GetWidth(), pImgMeta->GetHeight());
1933 pBitmap->Scale(srcDim);
1938 ImageBuffer* imageBuffer = new (std::nothrow) ImageBuffer();
1939 result r = imageBuffer->Construct(filePath);
1942 Dimension srcDim(imageBuffer->GetWidth(), imageBuffer->GetHeight());
1943 pBitmap->Scale(srcDim);
1948 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1950 VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(filePath);
1952 if (pVideoMeta != null && GetLastResult() == E_SUCCESS)
1954 Dimension srcDim(pVideoMeta->GetWidth(), pVideoMeta->GetHeight());
1955 pBitmap->Scale(srcDim);
1963 mainCanvas.Construct(DUMMY_IMAGE_RECTANGLE);
1964 mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_WHITE), DUMMY_IMAGE_RECTANGLE);
1965 pBitmap = new (std::nothrow) Bitmap();
1966 pBitmap->Construct(mainCanvas, DUMMY_IMAGE_RECTANGLE);
1969 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));