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"
31 using namespace Tizen::App;
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Base::Runtime;
35 using namespace Tizen::Base::Utility;
36 using namespace Tizen::Content;
37 using namespace Tizen::Graphics;
38 using namespace Tizen::Io;
39 using namespace Tizen::Media;
40 using namespace Tizen::System;
41 using namespace Tizen::Ui;
42 using namespace Tizen::Ui::Controls;
43 using namespace Tizen::Ui::Scenes;
45 static const unsigned int COLOR_HEADER_CONTORL_PANEL = Color32<0, 0, 0, 100>::Value;
46 static const unsigned int COLOR_HEADER_BUTTON1 = Color32<0, 0, 0, 100>::Value;
48 static const Rectangle RECT_CONTORL_BUTTON_PLAY (280, 400, 160, 160);
49 static const Rectangle RECT_LANDSCAP_CONTORL_BUTTON_PLAY (560, 216, 160, 160);
51 static const Rectangle RECT_DETAILS_CONTORL_PANEL (0, 0, 720, 1008);
52 static const Rectangle RECT_LANDSCAPE_DETAILS_CONTORL_PANEL (0, 0, 1280, 484);
53 static const Rectangle RECT_DETAILS_CONTORL_LABEL (20, 0, 200, 48);
55 static const int GAP_LABEL_END = 60;
56 static const int GAP_W_POPUP_ITEM = 5;
57 static const int W_DELETE_POPUP = 600;
58 static const int H_DELETE_POPUP = 300;
59 static const int H_DELETE_LABEL = 180;
60 static const int Y_DELETE_BUTTON = 180;
61 static const int H_DELETE_BUTTON = 80;
63 static const Dimension DUMMY_IMAGE_DIMENSION (720, 1280);
64 static const Rectangle DUMMY_IMAGE_RECTANGLE (0, 0, 720, 1280);
66 static const int PAGE_NO_CONTENT_SEARCH = 1;
67 static const int COUNT_PER_PAGE_CONTENT_SEARCH = 10;
69 static const int FORMAT_BUFFER_SIZE = 256;
71 static const long long SINGLE_GIGA_BYTE = (1024 * 1024 * 1024);
72 static const long long SINGLE_MEGA_BYTE = (1024 * 1024);
73 static const long long SINGLE_KILO_BYTE = 1024;
75 static const int Y_RENAME_BUTTON = 100;
76 static const int H_RENAME_BUTTON = 64;
77 static const int W_RENAME_BUTTON = 64;
79 static const int X_DETAIL_FILEINFO_LABEL = 20;
80 static const int W_DETAIL_FILEINFO_LABEL = 420;
81 static const int H_DETAIL_FILEINFO_LABEL = 50;
82 static const int H_DETAIL_MAIN_TEXT = 48;
83 static const int H_DETAIL_SUB_TEXT = 42;
84 static const int GAP_H_DETAIL_TEXT = 8;
85 static const int W_DETAIL_FILEINFO_VALUE_LABEL = 650;
86 static const int H_DETAIL_FILEINFO_VALUE_LABEL = 56;
88 static const int X_MORE = 55;
90 static const int DETAIL_SUB_FONT_SIZE = 42;
91 static const int DETAIL_MAIN_FONT_SIZE = 48;
92 static const int DETAIL_COUNT_MAX = 9;
94 ImageViewerForm::ImageViewerForm(void)
95 : __initializeDisplayModeCurrent(APPCONTROL_MODE_NORMAL)
98 , __pScrollPanel(null)
99 , __pDetail_Label(null)
100 , __pLabelMessage(null)
101 , __pPlayButton(null)
102 , __pRenameButton(null)
103 , __pDetailFooterItem(null)
106 , __pDecodeBitmap(null)
107 , __pContextMenuMore(null)
108 , __pContextMenuCopy(null)
109 , __pContextMenuSetAs(null)
110 , __pContextMenuShare(null)
111 , __pDeletePopup(null)
114 , __startSlide(false)
116 , __pPresentationModel(null)
118 AppLogDebug("ENTER");
120 __pDetail_FileInfo_Value_Label[0] = null;
121 __pDetail_FileInfo_Value_Label[1] = null;
122 __pDetail_FileInfo_Value_Label[2] = null;
123 __pDetail_FileInfo_Value_Label[3] = null;
124 __pDetail_FileInfo_Value_Label[4] = null;
125 __pDetail_FileInfo_Value_Label[5] = null;
126 __pDetail_FileInfo_Value_Label[6] = null;
127 __pDetail_FileInfo_Value_Label[7] = null;
128 __pDetail_FileInfo_Value_Label[8] = null;
129 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
132 ImageViewerForm::~ImageViewerForm(void)
134 AppLogDebug("ENTER");
135 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
139 ImageViewerForm::Initialize()
141 AppLogDebug("ENTER");
142 __pPresentationModel = ImageViewerPresentationModel::GetInstance();
144 if (__pPresentationModel->GetFileCount() > 0)
146 if (__pPresentationModel->GetType() == APPCONTROL_DATA_SLIDE_SHOW)
152 int startIndex = __pPresentationModel->GetStartIndex();
153 String filePath = __pPresentationModel->GetFilePathAt(startIndex);
155 if (filePath.StartsWith(WEB_URL_HTTP, 0) == true)
157 __initializeDisplayModeCurrent = APPCONTROL_MODE_WEB_LINK;
159 else if (__pPresentationModel->GetType() == APPCONTROL_DATA_EMAIL)
161 __initializeDisplayModeCurrent = APPCONTROL_MODE_EMAIL;
165 __initializeDisplayModeCurrent = APPCONTROL_MODE_NORMAL;
168 result r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
171 SetOrientation(ORIENTATION_AUTOMATIC);
174 if (filePath == EMPTY_SPACE)
176 MessageBox messageBox;
177 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_IV_POP_INVALID_IMAGE_FILE"), MSGBOX_STYLE_NONE,
180 messageBox.ShowAndWait(modalResult);
182 UiApp* pApp = UiApp::GetInstance();
186 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
192 ImageViewerForm::OnInitializing(void)
194 AppLogDebug("ENTER");
195 SetFormBackEventListener(this);
196 __pPresentationModel->AddListener(this);
199 InitializeDisplay(__initializeDisplayModeCurrent);
200 InitializePanelDetail();
203 if ( __initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL
204 || __initializeDisplayModeCurrent == APPCONTROL_MODE_EMAIL)
206 int index = __pPresentationModel->GetStartIndex();
207 __pGallery->UpdateGallery();
208 __pGallery->SetCurrentItemIndex(index);
211 String filePath = __pPresentationModel->GetFilePathAt(index);
212 __pPresentationModel->RequestImage(filePath);
214 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
221 __pTimer = new (std::nothrow) Timer();
222 __pTimer->Construct(*this);
226 result r = SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
227 AddOrientationEventListener(*this);
228 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
234 ImageViewerForm::OnInitialized(void)
236 AppLogDebug("ENTER");
237 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
243 ImageViewerForm::OnOrientationChanged(const Control &source, OrientationStatus orientationStatus)
245 AppLogDebug("ENTER");
246 if (__detail == false)
248 ShowPanelDetail(true);
252 ShowPanelDetail(false);
255 if (orientationStatus == ORIENTATION_STATUS_PORTRAIT ||
256 orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
258 Rectangle clientRect = GetClientAreaBounds();
259 Rectangle rect = GetBounds();
261 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
262 __pPlayButton->SetBounds(Rectangle(RECT_CONTORL_BUTTON_PLAY.x, RECT_CONTORL_BUTTON_PLAY.y,
263 RECT_CONTORL_BUTTON_PLAY.width, RECT_CONTORL_BUTTON_PLAY.height));
267 else if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE ||
268 orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
270 Rectangle clientRect = GetClientAreaBounds();
271 Rectangle rect = GetBounds();
273 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
274 __pPlayButton->SetBounds(Rectangle(RECT_LANDSCAP_CONTORL_BUTTON_PLAY.x, RECT_LANDSCAP_CONTORL_BUTTON_PLAY.y,
275 RECT_LANDSCAP_CONTORL_BUTTON_PLAY.width, RECT_LANDSCAP_CONTORL_BUTTON_PLAY.height));
279 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
283 ImageViewerForm::InitializeDisplay(AppControlMode status)
285 AppLogDebug("ENTER");
287 String strItemIdxText;
289 __pHeader = GetHeader();
290 __pHeader->AddActionEventListener(*this);
292 __pFooter = GetFooter();
293 __pFooter->AddActionEventListener(*this);
294 __pFooter->RemoveAllItems();
296 GetHeaderString(0, strItemText, strItemIdxText);
297 Rectangle rect = GetClientAreaBounds();
298 __pHeader->SetTitleText(strItemText);
299 __pHeader->SetDescriptionText(strItemIdxText);
301 if (status == APPCONTROL_MODE_NORMAL)
303 __pPlayButton = new (std::nothrow) Button();
304 if (__pPlayButton != null)
306 __pPlayButton->Construct(RECT_CONTORL_BUTTON_PLAY);
307 __pPlayButton->SetActionId(ACTION_ID_CONTORL_BUTTON_PLAY);
308 AddControl(*__pPlayButton);
310 Bitmap* pNormalBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
311 __pPlayButton->SetNormalBackgroundBitmap(*pNormalBackgroundBitmap);
312 delete pNormalBackgroundBitmap;
314 Bitmap* pPressedBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
315 __pPlayButton->SetPressedBackgroundBitmap(*pPressedBackgroundBitmap);
316 delete pPressedBackgroundBitmap;
318 __pPlayButton->AddActionEventListener(*this);
319 __pPlayButton->SetShowState(false);
322 __pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
323 __pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
324 __pFooter->SetBackButton();
326 FooterItem footerItem1;
327 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SHARE);
328 Bitmap* pFooterItemShareNomal =
329 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_SHARE_NORMAL);
330 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemShareNomal);
332 FooterItem footerItem2;
333 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_DELETE);
334 Bitmap* pFooterItemDeleteNomal =
335 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_DELETE_NORMAL);
336 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemDeleteNomal);
338 __pFooter->AddItem(footerItem1);
339 __pFooter->AddItem(footerItem2);
341 delete pFooterItemShareNomal;
342 delete pFooterItemDeleteNomal;
344 ButtonItem buttonItemMore;
345 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
346 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL,
347 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_NORMAL));
348 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED,
349 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_PRESSED));
350 __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItemMore);
352 else if (status == APPCONTROL_MODE_WEB_LINK)
354 __pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
355 __pFooter->SetBackButton();
357 FooterItem footerItem1;
358 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SHARE);
359 Bitmap* pFooterItemShareNomal =
360 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_SHARE_NORMAL);
361 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemShareNomal);
363 FooterItem footerItem2;
364 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_DOWNLOAD);
365 Bitmap* pFooterItemDownlordNomal = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DOWNLOAD);
366 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemDownlordNomal);
368 __pFooter->AddItem(footerItem1);
369 __pFooter->AddItem(footerItem2);
371 delete pFooterItemShareNomal;
372 delete pFooterItemDownlordNomal;
374 ButtonItem buttonItemMore;
375 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
376 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL,
377 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_NORMAL));
378 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED,
379 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_PRESSED));
380 __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItemMore);
382 __pFooter->AddItem(footerItem1);
383 __pFooter->AddItem(footerItem2);
385 else if (status == APPCONTROL_MODE_CROP)
387 FooterItem footerItem1;
388 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SAVE);
389 Bitmap* pfooterItem1 = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_SAVE);
390 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem1);
392 FooterItem footerItem2;
393 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_BACK);
394 Bitmap* pfooterItem2 = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_X);
395 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem2);
397 __pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
398 __pFooter->AddItem(footerItem1);
399 __pFooter->AddItem(footerItem2);
404 else if (status == APPCONTROL_MODE_EMAIL)
406 __pPlayButton = new (std::nothrow) Button();
407 if (__pPlayButton != null)
409 __pPlayButton->Construct(RECT_CONTORL_BUTTON_PLAY);
410 __pPlayButton->SetActionId(ACTION_ID_CONTORL_BUTTON_PLAY);
411 AddControl(*__pPlayButton);
413 Bitmap* pNormalBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
414 __pPlayButton->SetNormalBackgroundBitmap(*pNormalBackgroundBitmap);
415 delete pNormalBackgroundBitmap;
417 Bitmap* pPressedBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
418 __pPlayButton->SetPressedBackgroundBitmap(*pPressedBackgroundBitmap);
419 delete pPressedBackgroundBitmap;
421 __pPlayButton->AddActionEventListener(*this);
422 __pPlayButton->SetShowState(false);
425 __pFooter->SetBackButton();
428 String filePath = __pPresentationModel->GetFilePathAt(0);
429 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
430 if (contentType == CONTENT_TYPE_VIDEO)
432 __pPlayButton->SetShowState(true);
434 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
438 ImageViewerForm::GetHeaderString(int index, String &fileName, String &page)
440 AppLogDebug("ENTER");
441 int allCount = __pPresentationModel->GetFileCount();
442 String pStr = __pPresentationModel->GetFilePathAt(index);
443 fileName = __pPresentationModel->GetFileName(pStr);
444 page.Format(FORMAT_BUFFER_SIZE, L"%d/%d", index + 1, allCount);
445 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
449 ImageViewerForm::DeleteImageFile()
451 AppLogDebug("ENTER");
452 int currentIndex = __pGallery->GetCurrentItemIndex();
454 String strItemText(EMPTY_SPACE);
455 String strItemIdxText(EMPTY_SPACE);
456 int countPath = __pPresentationModel->GetFileCount();
457 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
458 result r = E_SUCCESS;
459 if (filePath.GetLength() == 0)
461 UiApp* pApp = UiApp::GetInstance();
463 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
468 if (filePath.StartsWith(Environment::GetMediaPath(), 0) == true
469 || filePath.StartsWith(Environment::GetExternalStoragePath(), 0) == true)
471 ContentId contentId = __pPresentationModel->GetFileContentId(filePath);
472 ContentManager contentManager;
473 contentManager.Construct();
474 r = contentManager.DeleteContent(contentId);
477 r = File::Remove(filePath);
480 MessageBox messageBox;
481 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_DELETE_FAILED"),
482 MSGBOX_STYLE_NONE, 3000);
484 messageBox.ShowAndWait(modalResult);
485 AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
493 r = File::Remove(filePath);
496 __pPresentationModel->DeleteFilePathAt(currentIndex);
499 UiApp* pApp = UiApp::GetInstance();
501 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
505 else if ((countPath - 1) == currentIndex)
507 __pGallery->SetCurrentItemIndex(--currentIndex);
510 __pGallery->UpdateGallery();
511 filePath = __pPresentationModel->GetFilePathAt(currentIndex);
512 __pPresentationModel->RequestImage(filePath);
514 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
515 __pHeader->SetTitleText(strItemText);
516 __pHeader->SetDescriptionText(strItemIdxText);
518 if (__visible == true)
520 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
522 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
524 __pPlayButton->SetShowState(false);
528 __pPlayButton->SetShowState(true);
532 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
538 ImageViewerForm::CallVideoPlayer(void)
540 AppLogDebug("ENTER");
541 int index = __pGallery->GetCurrentItemIndex();
542 String filePath = __pPresentationModel->GetFilePathAt(index);
544 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
545 pDataList->Construct();
546 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),
547 new (std::nothrow) String(APPCONTROL_DATA_VIDEO));
548 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), new (std::nothrow) String(filePath));
550 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_VIDEO_PLAYER,
551 APPCONTROL_OPERATION_ID_PLAY, pDataList, this);
552 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
556 ImageViewerForm::CreateGallery(void)
558 AppLogDebug("ENTER");
559 Rectangle clientRect = GetClientAreaBounds();
560 Rectangle rect = GetBounds();
562 __pGallery = new (std::nothrow) Gallery();
563 __pGallery->Construct(Rectangle(0, -clientRect.y, rect.width, rect.height));
564 __pGallery->SetName(L"GalleryControl");
565 __pGallery->SetItemProvider(*this);
566 __pGallery->AddGalleryEventListener(*this);
567 AddControl(*__pGallery);
568 __pGallery->SetTextOfEmptyGallery(ResourceManager::GetString(L"IDS_COM_BODY_LOADING"));
570 SlideShowTransitionEffect effect = __pPresentationModel->GetTransitionEffectOfSlideShow();
574 case SLIDE_SHOW_TRANSITION_EFFECT_PAGE:
575 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_PAGE);
577 case SLIDE_SHOW_TRANSITION_EFFECT_DISSOLVE:
578 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_DISSOLVE);
580 case SLIDE_SHOW_TRANSITION_EFFECT_ZOOM:
581 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_ZOOM);
583 case SLIDE_SHOW_TRANSITION_EFFECT_SLIDE:
587 __pGallery->SetSlideShowViewDuration(__pPresentationModel->GetDurationOfSlideShow());
589 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
593 ImageViewerForm::InitializePanelDetail()
595 AppLogDebug("ENTER");
596 __pScrollPanel = new (std::nothrow) ScrollPanel();
598 String arrayId[DETAIL_COUNT_MAX] =
600 L"IDS_COM_BODY_DETAILS_NAME", L"IDS_IV_BODY_FILE_FORMAT", L"IDS_IV_BODY_DATE_CREATED",
601 L"IDS_COM_BODY_SIZE", L"IDS_IV_BODY_RESOLUTION", L"IDS_COM_BODY_LOCATION",
602 L"IDS_COM_BODY_LATITUDE", L"IDS_COM_BODY_LONGITUDE", L"IDS_IV_BODY_FILE_LOCATION"
605 if (__pScrollPanel == null)
607 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
609 return E_INVALID_STATE;
612 result r = __pScrollPanel->Construct(RECT_DETAILS_CONTORL_PANEL);
615 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
617 return E_INVALID_STATE;
620 __pDetail_Label = new (std::nothrow) Label();
621 __pDetail_Label->Construct(RECT_DETAILS_CONTORL_LABEL, ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"));
622 __pScrollPanel->AddControl(*__pDetail_Label);
623 __pDetail_Label->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
624 __pDetail_Label->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
625 __pDetail_Label->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
626 __pDetail_Label->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
628 for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
630 __pDetail_FileInfo_Label[i] = new (std::nothrow) Label();
631 __pDetail_FileInfo_Label[i]->Construct(
632 Rectangle(X_DETAIL_FILEINFO_LABEL,
633 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT + H_DETAIL_SUB_TEXT) * i,
634 W_DETAIL_FILEINFO_LABEL, H_DETAIL_FILEINFO_LABEL), ResourceManager::GetString(arrayId[i]));
635 __pScrollPanel->AddControl(*__pDetail_FileInfo_Label[i]);
637 __pDetail_FileInfo_Label[i]->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
638 __pDetail_FileInfo_Label[i]->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
639 __pDetail_FileInfo_Label[i]->SetTextColor(Color::GetColor(COLOR_ID_GREY));
640 __pDetail_FileInfo_Label[i]->SetTextConfig(DETAIL_SUB_FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
642 __pDetail_FileInfo_Value_Label[i] = new (std::nothrow) Label();
643 __pDetail_FileInfo_Value_Label[i]->Construct(
644 Rectangle(X_DETAIL_FILEINFO_LABEL,
645 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT * i) + H_DETAIL_SUB_TEXT * (i + 1),
646 W_DETAIL_FILEINFO_VALUE_LABEL, H_DETAIL_FILEINFO_VALUE_LABEL), L"");
647 __pScrollPanel->AddControl(*__pDetail_FileInfo_Value_Label[i]);
649 __pDetail_FileInfo_Value_Label[i]->SetTextVerticalAlignment(ALIGNMENT_BOTTOM);
650 __pDetail_FileInfo_Value_Label[i]->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
651 __pDetail_FileInfo_Value_Label[i]->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
652 __pDetail_FileInfo_Value_Label[i]->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
655 __pScrollPanel->SetBackgroundColor(COLOR_HEADER_CONTORL_PANEL);
656 __pScrollPanel->SetShowState(false);
658 AddControl(*__pScrollPanel);
659 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
665 ImageViewerForm::InitializePopup(void)
667 AppLogDebug("ENTER");
668 if (__pDeletePopup == null)
670 __pDeletePopup = new (std::nothrow) Popup();
671 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
673 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
675 Label* pLabel = new (std::nothrow) Label();
676 pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
677 ResourceManager::GetString(L"IDS_COM_BODY_DELETE") + L"?");
679 Button* pDeleteButton = new (std::nothrow) Button();
680 pDeleteButton->Construct(
681 Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
682 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
683 pDeleteButton->SetActionId(ACTION_ID_DELETE_POPUP_DEL);
684 pDeleteButton->AddActionEventListener(*this);
686 Button* pCancelButton = new (std::nothrow) Button();
687 pCancelButton->Construct(
688 Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM,
689 Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
690 ResourceManager::GetString(L"IDS_COM_SK_CANCEL"));
691 pCancelButton->SetActionId(ACTION_ID_DELETE_POPUP_CANCEL);
692 pCancelButton->AddActionEventListener(*this);
694 __pDeletePopup->AddControl(*pLabel);
695 __pDeletePopup->AddControl(*pDeleteButton);
696 __pDeletePopup->AddControl(*pCancelButton);
700 __pDeletePopup->SetShowState(true);
701 __pDeletePopup->Show();
703 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
709 ImageViewerForm::InitializeContextMenuMore(void)
711 AppLogDebug("ENTER");
712 int currentIndex = __pGallery->GetCurrentItemIndex();
713 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
715 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
717 if (__pContextMenuMore != null)
719 delete __pContextMenuMore;
720 __pContextMenuMore = null;
723 __pContextMenuMore = new (std::nothrow) ContextMenu();
725 __pContextMenuMore->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
726 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
728 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
730 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_SET_AS"),
731 ACTION_ID_CONTEXTMENU_SET_AS);
734 if (__pGallery->GetItemCount() > 1)
736 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_SLIDE_SHOW"),
737 ACTION_ID_FOOTER_BUTTON_SLIDE);
739 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"),
740 ACTION_ID_FOOTER_BUTTON_DETAILS);
741 __pContextMenuMore->SetShowState(false);
742 __pContextMenuMore->AddActionEventListener(*this);
743 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
749 ImageViewerForm::InitializeContextMenuSetAs(void)
751 AppLogDebug("ENTER");
753 if (__pContextMenuSetAs != null)
755 delete __pContextMenuSetAs;
756 __pContextMenuSetAs = null;
759 __pContextMenuSetAs = new (std::nothrow) ContextMenu();
760 __pContextMenuSetAs->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
761 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
763 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_HOME_SCREEN_WALLPAPER_ABB"),
764 ACTION_ID_CONTEXTMENU_HOME);
765 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_LOCK_SCREEN_WALLPAPER_ABB"),
766 ACTION_ID_CONTEXTMENU_LOCK);
767 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_BODY_CALLER_IMAGE"),
768 ACTION_ID_CONTEXTMENU_CALLER);
769 __pContextMenuSetAs->AddActionEventListener(*this);
770 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
776 ImageViewerForm::InitializeContextMenuShare(void)
778 AppLogDebug("ENTER");
779 if (__pContextMenuShare != null)
781 delete __pContextMenuShare;
782 __pContextMenuShare = null;
784 __pContextMenuShare = new (std::nothrow) ContextMenu();
785 __pContextMenuShare->Construct(Point((GetClientAreaBounds().width - (X_MORE * 4)) / 4 + X_MORE * 2,
786 GetClientAreaBounds().y + GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST,
787 CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
789 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),ACTION_ID_CONTEXTMENU_EMAIL);
790 __pContextMenuShare->AddActionEventListener(*this);
791 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
797 ImageViewerForm::GetFileSize(String filePath)
799 AppLogDebug("ENTER");
803 result r = File::GetAttributes(filePath, attr);
806 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
810 size = attr.GetFileSize();
811 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
817 ImageViewerForm::SetDetailInfo(void)
819 AppLogDebug("ENTER");
821 Rectangle clientRect = GetClientAreaBounds();
822 AppLogDebug("PORTRAIT GetClientAreaBounds(%d %d %d %d)", clientRect.x, clientRect.y, clientRect.width, clientRect.height);
823 OrientationStatus currentOrientaton = GetOrientationStatus();
825 if (currentOrientaton == ORIENTATION_STATUS_LANDSCAPE || currentOrientaton == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
827 __pScrollPanel->SetBounds(Rectangle(0, 0, clientRect.width, RECT_LANDSCAPE_DETAILS_CONTORL_PANEL.height));
831 __pScrollPanel->SetBounds(0, 0, clientRect.width, RECT_DETAILS_CONTORL_PANEL.height);
834 int currentIndex = __pGallery->GetCurrentItemIndex();
835 String strFilePath = __pPresentationModel->GetFilePathAt(currentIndex);
837 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(strFilePath);
839 String strResult[DETAIL_COUNT_MAX] = {EMPTY_SPACE, };
841 strResult[0] = __pPresentationModel->GetFileName(strFilePath);
842 strResult[1] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
845 result r = File::GetAttributes(strFilePath, attr);
848 long long nSize = attr.GetFileSize();
849 DateTime dateTime = attr.GetDateTime();
850 strResult[2] = dateTime.ToString();
852 if (nSize > SINGLE_GIGA_BYTE)
854 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld GB", nSize / SINGLE_GIGA_BYTE);
856 else if (nSize > SINGLE_MEGA_BYTE)
858 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld MB", nSize / SINGLE_MEGA_BYTE);
860 else if (nSize > SINGLE_KILO_BYTE)
862 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld KB", nSize / SINGLE_KILO_BYTE);
866 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld Byte", nSize);
871 strResult[2] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
872 strResult[3] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
875 strResult[4] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
876 strResult[5] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
877 strResult[6] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
878 strResult[7] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
879 strResult[8] = strFilePath;
881 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
883 strResult[0] = __downLordFileName;
885 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
887 ImageMetadata* pImgMeta = ContentManagerUtil::GetImageMetaN(strFilePath);
889 if (pImgMeta != null)
891 ImageContentInfo imageContentInfo;
892 r = imageContentInfo.Construct(&strFilePath);
895 strResult[1] = imageContentInfo.GetMediaFormat();
896 strResult[4].Format(FORMAT_BUFFER_SIZE, L"%d x %d", pImgMeta->GetWidth(),
897 pImgMeta->GetHeight());
899 if (imageContentInfo.GetLocationTag() != EMPTY_SPACE)
901 strResult[5].Format(FORMAT_BUFFER_SIZE, L"%ls", imageContentInfo.GetLocationTag().GetPointer());
904 if (pImgMeta->GetLatitude() > 1.0 && pImgMeta->GetLongitude() > 1.0)
906 strResult[6].Format(FORMAT_BUFFER_SIZE, L"%f", pImgMeta->GetLatitude());
907 strResult[7].Format(FORMAT_BUFFER_SIZE, L"%f", pImgMeta->GetLongitude());
910 strResult[8] = imageContentInfo.GetContentPath();
915 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
917 VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(strFilePath);
918 if (pVideoMeta != null)
920 VideoContentInfo videoContentInfo;
921 r = videoContentInfo.Construct(&strFilePath);
924 strResult[1] = videoContentInfo.GetMediaFormat();
925 strResult[4].Format(FORMAT_BUFFER_SIZE, L"%d x %d", pVideoMeta->GetWidth(),
926 pVideoMeta->GetHeight());
927 if (videoContentInfo.GetLocationTag() != EMPTY_SPACE)
929 strResult[5].Format(FORMAT_BUFFER_SIZE, L"%ls", videoContentInfo.GetLocationTag().GetPointer());
932 strResult[8] = videoContentInfo.GetContentPath();
937 for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
939 __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),
940 clientRect.width - GAP_LABEL_END, H_DETAIL_FILEINFO_VALUE_LABEL);
941 __pDetail_FileInfo_Value_Label[i]->SetText(strResult[i]);
942 __pDetail_FileInfo_Value_Label[i]->RequestRedraw();
945 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
947 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
951 if (__pRenameButton == null)
953 __pRenameButton = new (std::nothrow) Button();
954 Rectangle rect = GetBounds();
955 __pRenameButton->Construct(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
956 __pRenameButton->SetActionId(ACTION_ID_PANEL_HEADER_DETAILS_RENAME);
958 Bitmap* pIcon = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME);
959 Bitmap* pIconBackground =
960 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND);
961 Bitmap* pIconPressed =
962 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND_PRESS);
964 if (pIcon != null && pIconPressed != null && pIconBackground != null)
966 __pRenameButton->SetNormalBackgroundBitmap(*pIconBackground);
967 __pRenameButton->SetPressedBackgroundBitmap(*pIconPressed);
968 Point iconPosition(0, 0);
969 __pRenameButton->SetNormalBitmap(iconPosition, *pIcon);
970 __pRenameButton->SetPressedBitmap(iconPosition, *pIconPressed);
974 __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
975 __pRenameButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_HEADER_BUTTON1);
979 delete pIconBackground;
981 __pScrollPanel->AddControl(*__pRenameButton);
982 __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
983 __pRenameButton->AddActionEventListener(*this);
987 Rectangle rect = GetBounds();
988 __pRenameButton->SetBounds(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
990 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
996 ImageViewerForm::ShowPanelDetail(bool showStatus)
998 AppLogDebug("ENTER");
1002 __pScrollPanel->SetShowState(true);
1007 __pScrollPanel->SetShowState(false);
1010 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1016 ImageViewerForm::ChangeFooterItem(bool isChanged, Footer* pFooter, int position)
1018 AppLogDebug("ENTER");
1019 FooterItem footerItem;
1020 footerItem.Construct(ACTION_ID_FOOTER_BUTTON_DETAILS);
1021 Bitmap* pfooterItem = null;
1025 pfooterItem = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS_CLOSE);
1026 footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem);
1030 pfooterItem = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS);
1031 footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem);
1034 pFooter->SetItemAt(position, footerItem);
1035 pFooter->Invalidate(true);
1039 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1045 ImageViewerForm::DownloadFile(void)
1047 AppLogDebug("ENTER");
1048 String DestPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_WEB_FILE;
1049 if (File::IsFileExist(DestPath) == false)
1051 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1055 ContentId contentId;
1056 ContentManager contentManager;
1057 contentManager.Construct();
1059 ImageContentInfo imageContentInfo;
1060 imageContentInfo.Construct(null);
1062 imageContentInfo.SetKeyword(L"platform, tizen");
1063 String sourcePath = DestPath;
1064 String destPath = Environment::GetMediaPath();
1065 destPath.Append(FOLDER_PATH_DOWNLOADS);
1066 destPath.Append(__downLordFileName);
1068 contentId = contentManager.CreateContent(sourcePath, destPath, true, &imageContentInfo);
1069 ImageViewerForm::OnFormBackRequested(*this);
1070 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1074 ImageViewerForm::GetItemCount(void)
1076 AppLogDebug("ENTER");
1077 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1079 return __pPresentationModel->GetFileCount();
1083 ImageViewerForm::CreateItem(int index)
1085 AppLogDebug("ENTER : index(%d)", index);
1086 GalleryItem* pGallery = new (std::nothrow) GalleryItem();
1088 String filePath = __pPresentationModel->GetFilePathAt(index);
1089 ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
1090 Bitmap* pBitmap = pImageInfo->GetBitmapN();
1091 if (pBitmap == null)
1093 pBitmap = GetQuickThumbnailN(filePath);
1095 if (pBitmap == null)
1097 pBitmap = new (std::nothrow) Bitmap();
1098 pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
1101 pGallery->Construct(*pBitmap, filePath);
1103 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1109 ImageViewerForm::DeleteItem(int index, GalleryItem* pItem)
1111 AppLogDebug("ENTER index(%d)", index);
1112 ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
1113 pImageInfo->ClearBitmap();
1115 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1121 ImageViewerForm::OnGalleryCurrentItemChanged(Gallery& view, int index)
1123 AppLogDebug("ENTER index(%d)", index);
1125 String filePath = __pPresentationModel->GetFilePathAt(index);
1126 AppLogDebug("ENTER index(%d) filePath(%ls)", index, filePath.GetPointer());
1127 __pPresentationModel->RequestImage(filePath);
1130 String strItemIdxText;
1131 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
1132 __pHeader->SetTitleText(strItemText);
1133 __pHeader->SetDescriptionText(strItemIdxText);
1135 if (__visible == true)
1137 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1138 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1140 __pPlayButton->SetShowState(true);
1144 __pPlayButton->SetShowState(false);
1149 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1153 ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index)
1155 AppLogDebug("ENTER");
1157 String filePath = __pPresentationModel->GetFilePathAt(index);
1158 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1160 if (__visible == true)
1162 if (contentType == CONTENT_TYPE_VIDEO)
1164 __pPlayButton->SetShowState(false);
1167 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
1172 if (contentType == CONTENT_TYPE_VIDEO)
1174 __pPlayButton->SetShowState(true);
1177 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
1180 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
1181 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y + 1);
1184 Rectangle clientRect = GetClientAreaBounds();
1185 Rectangle rect = GetBounds();
1186 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1188 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1192 ImageViewerForm::OnGallerySlideShowStarted(Gallery& gallery)
1194 AppLogDebug("ENTER");
1195 PowerManager::KeepScreenOnState(true, false);
1196 if (__visible == true)
1198 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
1200 int index = __pGallery->GetCurrentItemIndex();
1201 String filePath = __pPresentationModel->GetFilePathAt(index);
1202 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1204 if (contentType == CONTENT_TYPE_VIDEO)
1206 __pPlayButton->SetShowState(false);
1212 Rectangle clientRect = GetClientAreaBounds();
1213 Rectangle rect = GetBounds();
1214 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1216 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1220 ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery)
1222 AppLogDebug("ENTER");
1223 PowerManager::KeepScreenOnState(false, true);
1224 int index = __pGallery->GetCurrentItemIndex();
1226 if (__visible == false)
1228 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
1230 String filePath = __pPresentationModel->GetFilePathAt(index);
1231 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1232 if (contentType == CONTENT_TYPE_VIDEO)
1234 __pPlayButton->SetShowState(true);
1237 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
1238 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y + 1);
1244 String strItemIdxText;
1245 GetHeaderString(index, strItemText, strItemIdxText);
1246 __pHeader->SetTitleText(strItemText);
1247 __pHeader->SetDescriptionText(strItemIdxText);
1249 Rectangle clientRect = GetClientAreaBounds();
1250 Rectangle rect = GetBounds();
1251 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1254 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1258 ImageViewerForm::OnUpdateContentList(void)
1263 ImageViewerForm::OnTerminating(void)
1265 AppLogDebug("ENTER");
1267 if (__pTimer != null)
1274 __pPresentationModel->ClearImageRequests();
1275 __pPresentationModel->RemoveListener(*this);
1277 if (__pContextMenuCopy != null)
1279 delete __pContextMenuCopy;
1280 __pContextMenuCopy = null;
1283 if (__pContextMenuSetAs != null)
1285 delete __pContextMenuSetAs;
1286 __pContextMenuSetAs = null;
1289 if (__pDeletePopup != null)
1291 delete __pDeletePopup;
1292 __pDeletePopup = null;
1295 if (__pContextMenuShare != null)
1297 delete __pContextMenuShare;
1298 __pContextMenuShare = null;
1301 if (__pContextMenuMore != null)
1303 delete __pContextMenuMore;
1304 __pContextMenuMore = null;
1307 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1313 ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
1315 AppLogDebug("ENTER actionId(%d)", actionId);
1316 SceneManager* pSceneManager = SceneManager::GetInstance();
1321 case ACTION_ID_FOOTER_MORE:
1323 InitializeContextMenuMore();
1325 __pContextMenuMore->SetShowState(true);
1326 __pContextMenuMore->Show();
1329 case ACTION_ID_CONTEXTMENU_SET_AS:
1330 InitializeContextMenuSetAs();
1332 __pContextMenuSetAs->SetShowState(true);
1333 __pContextMenuSetAs->Show();
1335 case ACTION_ID_FOOTER_BUTTON_SHARE:
1336 InitializeContextMenuShare();
1338 __pContextMenuShare->SetShowState(true);
1339 __pContextMenuShare->Show();
1341 case ACTION_ID_FOOTER_BUTTON_DELETE:
1342 __pDeletePopup->SetShowState(true);
1343 __pDeletePopup->Show();
1345 case ACTION_ID_FOOTER_BUTTON_SLIDE:
1347 if (__pPresentationModel->GetFileCount() > 1)
1349 __pGallery->UpdateGallery();
1350 if (__detail == false)
1352 ShowPanelDetail(false);
1354 __pGallery->StartSlideShow(true);
1358 case ACTION_ID_FOOTER_BUTTON_DETAILS:
1360 ShowPanelDetail(__detail);
1363 case ACTION_ID_FOOTER_BUTTON_BACK:
1364 ImageViewerForm::OnFormBackRequested(*this);
1366 case ACTION_ID_FOOTER_BUTTON_DOWNLOAD:
1369 case ACTION_ID_FOOTER_BUTTON_SAVE:
1371 case ACTION_ID_PANEL_HEADER_DETAILS_RENAME:
1373 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
1374 pSelectedIndex->Construct();
1375 pSelectedIndex->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1376 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_NAME_EDITOR), pSelectedIndex);
1379 case ACTION_ID_CONTEXTMENU_HOME:
1381 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1382 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1383 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_HOME_SCREEN_WALLPAPER));
1384 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1385 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1388 case ACTION_ID_CONTEXTMENU_LOCK:
1390 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1391 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1392 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_LOCK_SCREEN_WALLPAPER));
1393 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1394 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1397 case ACTION_ID_CONTEXTMENU_CALLER:
1399 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1400 pDataList->Construct();
1401 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SELECTION_MODE),
1402 new (std::nothrow) String(APPCONTROL_DATA_SINGLE));
1403 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_RETURN_TYPE),
1404 new (std::nothrow) String(APPCONTROL_DATA_CONTACT_ID));
1406 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_CONTACTS,
1407 APPCONTROL_OPERATION_ID_PICK, pDataList, this);
1410 case ACTION_ID_CONTEXTMENU_EMAIL:
1412 OnRequestEmailAction();
1415 case ACTION_ID_CONTEXTMENU_COPY:
1417 int currentIndex = __pGallery->GetCurrentItemIndex();
1418 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1421 item.Construct(CLIPBOARD_DATA_TYPE_IMAGE, filePath);
1422 Clipboard* pClipboard = Clipboard::GetInstance();
1423 pClipboard->CopyItem(item);
1426 case ACTION_ID_DELETE_POPUP_DEL:
1428 __pDeletePopup->SetShowState(false);
1429 __pDeletePopup->Show();
1432 if (__detail == false)
1434 ShowPanelDetail(false);
1438 case ACTION_ID_DELETE_POPUP_CANCEL:
1440 __pDeletePopup->SetShowState(false);
1441 __pDeletePopup->Show();
1444 case ACTION_ID_CONTORL_BUTTON_PLAY:
1450 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1454 ImageViewerForm::OnFormBackRequested(Form& source)
1456 AppLogDebug("ENTER");
1457 if (__detail == false)
1459 ShowPanelDetail(false);
1463 UiApp* pApp = UiApp::GetInstance();
1466 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1470 ImageViewerForm::OnSceneActivatedN(const SceneId& previousSceneId,
1471 const SceneId& currentSceneId, IList* pArgs)
1473 AppLogDebug("ENTER");
1474 OrientationStatus status = GetOrientationStatus();
1475 if (status == ORIENTATION_STATUS_PORTRAIT ||
1476 status == ORIENTATION_STATUS_PORTRAIT_REVERSE)
1478 AppLogDebug("ORIENTATION_STATUS : PORTRAIT");
1479 Rectangle clientRect = GetClientAreaBounds();
1480 Rectangle rect = GetBounds();
1481 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1482 __pPlayButton->SetBounds(RECT_CONTORL_BUTTON_PLAY);
1483 __pScrollPanel->SetBounds(RECT_DETAILS_CONTORL_PANEL);
1485 else if (status == ORIENTATION_STATUS_LANDSCAPE ||
1486 status == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
1488 AppLogDebug("ORIENTATION_STATUS : LANDSCAPE");
1489 Rectangle clientRect = GetClientAreaBounds();
1490 Rectangle rect = GetBounds();
1491 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1492 __pPlayButton->SetBounds(RECT_LANDSCAP_CONTORL_BUTTON_PLAY);
1493 __pScrollPanel->SetBounds(RECT_LANDSCAPE_DETAILS_CONTORL_PANEL);
1496 if (previousSceneId == IDSCN_IMAGE_NAME_EDITOR && currentSceneId == IDSCN_IMAGE_VIEWER)
1499 String strItemText(EMPTY_SPACE);
1500 String strItemIdxText(EMPTY_SPACE);
1501 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
1502 __pHeader->SetTitleText(strItemText);
1503 __pHeader->SetDescriptionText(strItemIdxText);
1507 if (__pGallery->GetCurrentItemIndex() < 0)
1509 SetFooterItemState(false);
1513 SetFooterItemState(true);
1516 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1520 ImageViewerForm::OnSceneDeactivated(const SceneId& currentSceneId,
1521 const SceneId& nextSceneId)
1523 AppLogDebug("ENTER");
1524 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1528 ImageViewerForm::OnImageDecodedN(const int index)
1530 AppLogDebug("ENTER");
1531 __pGallery->RefreshGallery(index, GALLERY_REFRESH_TYPE_ITEM_MODIFY);
1533 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1537 ImageViewerForm::OnAppControlCompleteResponseReceived(const AppId& appId,
1538 const String& operationId, AppCtrlResult appControlResult,
1539 const IMap* pExtraData)
1541 AppLogDebug("ENTER");
1543 if (appId == APPCONTROL_PROVIDER_ID_CONTACTS
1544 && operationId == APPCONTROL_OPERATION_ID_PICK
1545 && appControlResult == APP_CTRL_RESULT_SUCCEEDED)
1547 const String* pReturnType =
1548 static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_RETURN_TYPE)));
1549 if (pReturnType != null && pReturnType->CompareTo(APPCONTROL_DATA_CONTACT_ID) == 0)
1551 const String* pContactId =
1552 static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_VALUE)));
1553 SceneManager* pSceneManager = SceneManager::GetInstance();
1554 long long lresult = 0;
1555 if (pContactId != null && pContactId->GetLength() > 0)
1557 LongLong::Parse(*pContactId, lresult);
1559 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1560 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1561 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_CALLER_IMAGE));
1562 pList->Add(new (std::nothrow) LongLong(lresult));
1563 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1564 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1568 ImageViewerApp* pImageViewerApp = static_cast<ImageViewerApp*>(ImageViewerApp::GetInstance());
1569 pImageViewerApp->SetFrameEnabled(true);
1570 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1574 ImageViewerForm::OnOverlayControlCreated(const Control& source)
1576 AppLogDebug("ENTER");
1577 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1581 ImageViewerForm::OnOverlayControlOpened(const Control& source)
1583 AppLogDebug("ENTER");
1584 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1588 ImageViewerForm::OnOverlayControlClosed(const Control& source)
1590 AppLogDebug("ENTER");
1591 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1595 ImageViewerForm::OnOtherControlSelected(const Control& source)
1597 AppLogDebug("ENTER");
1598 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1602 ImageViewerForm::InitShowGallery(void)
1604 AppLogDebug("ENTER");
1605 if (__pGallery != null && __pGallery->IsVisible() == false)
1607 Canvas* pCanvas = GetCanvasN();
1608 if (pCanvas == null || GetLastResult() != E_SUCCESS)
1610 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1616 __pGallery->SetShowState(true);
1620 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1624 ImageViewerForm::OnTimerExpired(Timer &timer)
1626 AppLogDebug("ENTER");
1627 if (__pPresentationModel->GetFileCount() > 1)
1629 __pGallery->StartSlideShow(true);
1631 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1635 ImageViewerForm::OnContentTransferInProgress(RequestId requestId, int totalReceivedSize)
1637 AppLogDebug("ENTER");
1638 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1642 ImageViewerForm::OnContentUploadCompleted(RequestId requestId, result transferResult, const String& errorCode,
1643 const String& errorMessage)
1645 AppLogDebug("ENTER");
1646 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1650 ImageViewerForm::OnContentDownloadCompleted(RequestId requestId, ContentId contentId,
1651 result transferResult, const String& errorCode, const String& errorMessage)
1653 AppLogDebug("ENTER");
1654 AppLogTag("IV", "ImageViewerForm::OnContentDownloadCompleted");
1655 AppLogTag("IV", "DownloadCompleted Error [%s]", GetErrorMessage(transferResult));
1656 AppLogTag("IV", "errorCode [%ls] errorMessage [%ls]", errorCode.GetPointer(), errorMessage.GetPointer());
1657 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1661 ImageViewerForm::OnContentDownloadToBufferCompleted(RequestId reqId, ByteBuffer* pBuffer, result r,
1662 const String& errorCode, const String& errorMessage)
1664 AppLogDebug("ENTER");
1665 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1669 ImageViewerForm::OnContentTransferCanceled(RequestId reqId, result res, const String& errorCode,
1670 const String& errorMessage)
1672 AppLogDebug("ENTER");
1673 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1677 ImageViewerForm::RequestDecodeUrl(void)
1679 AppLogDebug("ENTER");
1681 String filePath = __pPresentationModel->GetFilePathAt(0);
1683 if (filePath.StartsWith(WEB_URL_HTTP, 0) == false)
1685 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1690 __downLordFileName = __pPresentationModel->GetFileName(filePath);
1692 Image* pImage = new (std::nothrow) Image();
1693 pImage->Construct();
1696 uri.SetUri(filePath);
1698 pImage->DecodeUrl(uri, BITMAP_PIXEL_FORMAT_RGB565, 720, 1280, reqId, *this, 5000);
1702 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1706 ImageViewerForm::OnImageDecodeUrlReceived (RequestId reqId, Bitmap *pBitmap,
1707 result r, const String errorCode, const String errorMessage)
1709 AppLogDebug("ENTER");
1710 Image* pImage = new (std::nothrow) Image();
1711 pImage->Construct();
1713 String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_WEB_FILE;
1714 r = pImage->EncodeToFile(*pBitmap, IMG_FORMAT_JPG, destPath, true);
1718 __pPresentationModel->GetImageCacheAt(0)->SetFilePath(destPath);
1719 __pPresentationModel->GetImageCacheAt(0)->SetBitmap(pBitmap);
1721 __pGallery->RefreshGallery(0, GALLERY_REFRESH_TYPE_ITEM_MODIFY);
1723 __pPresentationModel->RequestImage(destPath);
1727 AppLogDebug("ImageViewerForm::OnImageDecodeUrlReceived [%s]", GetErrorMessage(r));
1732 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1736 ImageViewerForm::OnRequestEmailAction(void)
1738 AppLogDebug("ENTER");
1739 int currentIndex = __pGallery->GetCurrentItemIndex();
1741 if (__pPresentationModel->GetFileCount() <= 0)
1743 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1748 String combineText = EMPTY_SPACE;
1750 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1752 if (filePath.EndsWith(CONTENT_EXT_PNG)
1753 || filePath.EndsWith(CONTENT_EXT_BMP)
1754 || filePath.EndsWith(CONTENT_EXT_JPG)
1755 || filePath.EndsWith(CONTENT_EXT_GIF)
1756 || filePath.EndsWith(CONTENT_EXT_TIF)
1757 || filePath.EndsWith(CONTENT_EXT_MP4)
1758 || filePath.EndsWith(CONTENT_EXT_3GP)
1759 || filePath.EndsWith(CONTENT_EXT_AVI)
1760 || filePath.EndsWith(CONTENT_EXT_RM)
1761 || filePath.EndsWith(CONTENT_EXT_WMV)
1762 || filePath.EndsWith(CONTENT_EXT_ASF))
1764 if (combineText.CompareTo(EMPTY_SPACE) != 0)
1766 combineText.Append(L";");
1769 combineText.Append(filePath);
1772 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1773 pDataList->Construct();
1774 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
1775 new (std::nothrow) String(combineText));
1777 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL,
1778 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, this);
1779 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1783 ImageViewerForm::SetFooterItemState(bool isEnable)
1785 AppLogDebug("ENTER");
1786 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL)
1788 __pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, isEnable);
1789 __pFooter->SetItemEnabled(0, isEnable);
1790 __pFooter->SetItemEnabled(1, isEnable);
1792 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
1794 __pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, isEnable);
1795 __pFooter->SetItemEnabled(0, isEnable);
1796 __pFooter->SetItemEnabled(1, isEnable);
1798 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_CROP)
1800 __pFooter->SetItemEnabled(0, isEnable);
1802 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1806 ImageViewerForm::GetQuickThumbnailN(String& filePath)
1808 AppLogDebug("ENTER");
1809 Bitmap* pBitmap = null;
1811 if (filePath.GetLength() > 4)
1815 ContentSearch contentSearch;
1816 ContentSearchResult* pResultItem = null;
1817 IList* pContentInfoList = null;
1819 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1820 result r = contentSearch.Construct(contentType);
1821 AppLogDebug("r(%s)", GetErrorMessage(r));
1824 pBitmap = new (std::nothrow) Bitmap();
1825 r = pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
1836 queryString = CONTENT_QUERY_PREFIX_FILENAME;
1837 queryString.Append(L"'");
1838 queryString.Append(__pPresentationModel->GetFileName(filePath));
1839 queryString.Append(L"'");
1841 pContentInfoList = contentSearch.SearchN(PAGE_NO_CONTENT_SEARCH, COUNT_PER_PAGE_CONTENT_SEARCH,
1842 totalPage, totalCount, queryString, EMPTY_SPACE, SORT_ORDER_NONE);
1844 if ((pContentInfoList != null) && GetLastResult() == E_SUCCESS && (pContentInfoList->GetCount() > 0))
1846 IEnumerator* pEnum = pContentInfoList->GetEnumeratorN();
1847 while (pEnum->MoveNext() == E_SUCCESS)
1849 pResultItem = static_cast<ContentSearchResult*>(pEnum->GetCurrent());
1850 if (pResultItem == null)
1855 if (pResultItem->GetContentInfo()->GetContentPath().CompareTo(filePath) == 0)
1857 pBitmap = pResultItem->GetContentInfo()->GetThumbnailN();
1863 if (pContentInfoList != null)
1865 delete pContentInfoList;
1868 if (pBitmap != null)
1870 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1871 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
1873 ImageMetadata* pImgMeta = ContentManagerUtil::GetImageMetaN(filePath);
1875 if (pImgMeta != null)
1877 Dimension srcDim(pImgMeta->GetWidth(), pImgMeta->GetHeight());
1878 pBitmap->Scale(srcDim);
1883 ImageBuffer* imageBuffer = new (std::nothrow) ImageBuffer();
1884 result r = imageBuffer->Construct(filePath);
1887 Dimension srcDim(imageBuffer->GetWidth(), imageBuffer->GetHeight());
1888 pBitmap->Scale(srcDim);
1893 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1895 VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(filePath);
1897 if (pVideoMeta != null && GetLastResult() == E_SUCCESS)
1899 Dimension srcDim(pVideoMeta->GetWidth(), pVideoMeta->GetHeight());
1900 pBitmap->Scale(srcDim);
1908 mainCanvas.Construct(DUMMY_IMAGE_RECTANGLE);
1909 mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_WHITE), DUMMY_IMAGE_RECTANGLE);
1910 pBitmap = new (std::nothrow) Bitmap();
1911 pBitmap->Construct(mainCanvas, DUMMY_IMAGE_RECTANGLE);
1914 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));