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_DETAILS_CONTORL_LABEL (20, 0, 200, 48);
54 static const int W_PLAY_BUTTON = 160;
55 static const int H_PLAY_BUTTON = 160;
57 static const int GAP_W_POPUP_ITEM = 5;
58 static const int W_DELETE_POPUP = 600;
59 static const int H_DELETE_POPUP = 300;
60 static const int H_DELETE_LABEL = 180;
61 static const int Y_DELETE_BUTTON = 180;
62 static const int H_DELETE_BUTTON = 80;
64 static const Dimension DUMMY_IMAGE_DIMENSION (720, 1280);
65 static const Rectangle DUMMY_IMAGE_RECTANGLE (0, 0, 720, 1280);
67 static const int PAGE_NO_CONTENT_SEARCH = 1;
68 static const int COUNT_PER_PAGE_CONTENT_SEARCH = 10;
70 static const int FORMAT_BUFFER_SIZE = 256;
72 static const long long SINGLE_GIGA_BYTE = (1024 * 1024 * 1024);
73 static const long long SINGLE_MEGA_BYTE = (1024 * 1024);
74 static const long long SINGLE_KILO_BYTE = 1024;
76 static const int Y_RENAME_BUTTON = 100;
77 static const int H_RENAME_BUTTON = 64;
78 static const int W_RENAME_BUTTON = 64;
80 static const int GAP_W_END_OF_LABEL = 60;
81 static const int X_DETAIL_FILEINFO_LABEL = 20;
82 static const int H_DETAIL_FILEINFO_LABEL = 50;
83 static const int H_DETAIL_MAIN_TEXT = 48;
84 static const int H_DETAIL_SUB_TEXT = 42;
85 static const int GAP_H_DETAIL_TEXT = 26;
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 = 32;
91 static const int DETAIL_MAIN_FONT_SIZE = 36;
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");
119 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
122 ImageViewerForm::~ImageViewerForm(void)
124 AppLogDebug("ENTER");
125 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
129 ImageViewerForm::Initialize()
131 AppLogDebug("ENTER");
132 __pPresentationModel = ImageViewerPresentationModel::GetInstance();
134 if (__pPresentationModel->GetFileCount() > 0)
136 if (__pPresentationModel->GetType() == APPCONTROL_DATA_SLIDE_SHOW)
142 __pSettingPresentationModel = SettingPresentationModel::GetInstance();
144 int startIndex = __pPresentationModel->GetStartIndex();
145 String filePath = __pPresentationModel->GetFilePathAt(startIndex);
147 if (filePath.StartsWith(WEB_URL_HTTP, 0) == true)
149 __initializeDisplayModeCurrent = APPCONTROL_MODE_WEB_LINK;
151 else if (__pPresentationModel->GetType() == APPCONTROL_DATA_MESSAGE)
153 __initializeDisplayModeCurrent = APPCONTROL_MODE_MESSAGE;
155 else if (__pPresentationModel->GetType() == APPCONTROL_DATA_EMAIL)
157 __initializeDisplayModeCurrent = APPCONTROL_MODE_EMAIL;
161 __initializeDisplayModeCurrent = APPCONTROL_MODE_NORMAL;
164 result r = Form::Construct(IDL_FORM_IMAGE_VIEWER);
166 if (filePath == EMPTY_SPACE)
168 MessageBox messageBox;
169 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_IV_POP_INVALID_IMAGE_FILE"), MSGBOX_STYLE_NONE,
172 messageBox.ShowAndWait(modalResult);
174 UiApp* pApp = UiApp::GetInstance();
178 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
184 ImageViewerForm::OnInitializing(void)
186 AppLogDebug("ENTER");
187 SetFormBackEventListener(this);
188 __pPresentationModel->AddListener(this);
191 InitializeDisplay(__initializeDisplayModeCurrent);
192 InitializePanelDetail();
195 if ( __initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL
196 || __initializeDisplayModeCurrent == APPCONTROL_MODE_MESSAGE
197 || __initializeDisplayModeCurrent == APPCONTROL_MODE_EMAIL)
199 int index = __pPresentationModel->GetStartIndex();
200 __pGallery->UpdateGallery();
201 __pGallery->SetCurrentItemIndex(index);
204 String filePath = __pPresentationModel->GetFilePathAt(index);
205 __pPresentationModel->RequestImage(filePath);
207 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
214 __pTimer = new (std::nothrow) Timer();
215 __pTimer->Construct(*this);
219 result r = SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
220 AddOrientationEventListener(*this);
221 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
227 ImageViewerForm::OnInitialized(void)
229 AppLogDebug("ENTER");
230 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
236 ImageViewerForm::OnOrientationChanged(const Control &source, OrientationStatus orientationStatus)
238 AppLogDebug("ENTER");
239 if (__detail == false)
241 ShowPanelDetail(true);
245 ShowPanelDetail(false);
248 Rectangle clientRect = GetClientAreaBounds();
249 Rectangle rect = GetBounds();
251 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
252 __pPlayButton->SetBounds(Rectangle(clientRect.width / 2 - W_PLAY_BUTTON / 2,
253 clientRect.height / 2 - W_PLAY_BUTTON / 2, W_PLAY_BUTTON, H_PLAY_BUTTON));
256 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
260 ImageViewerForm::InitializeDisplay(AppControlMode status)
262 AppLogDebug("ENTER");
264 String strItemIdxText;
266 __pHeader = GetHeader();
267 __pHeader->AddActionEventListener(*this);
269 __pFooter = GetFooter();
270 __pFooter->AddActionEventListener(*this);
271 __pFooter->RemoveAllItems();
273 GetHeaderString(0, strItemText, strItemIdxText);
274 Rectangle rect = GetClientAreaBounds();
275 __pHeader->SetTitleText(strItemText);
276 __pHeader->SetDescriptionText(strItemIdxText);
278 if (status == APPCONTROL_MODE_NORMAL)
280 __pPlayButton = new (std::nothrow) Button();
281 if (__pPlayButton != null)
283 Rectangle clientRect = GetClientAreaBounds();
285 __pPlayButton->Construct(Rectangle(clientRect.width / 2 - W_PLAY_BUTTON / 2,
286 clientRect.height / 2 - W_PLAY_BUTTON / 2, W_PLAY_BUTTON, H_PLAY_BUTTON));
287 __pPlayButton->SetActionId(ACTION_ID_CONTORL_BUTTON_PLAY);
288 AddControl(*__pPlayButton);
290 Bitmap* pNormalBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
291 __pPlayButton->SetNormalBackgroundBitmap(*pNormalBackgroundBitmap);
292 delete pNormalBackgroundBitmap;
294 Bitmap* pPressedBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
295 __pPlayButton->SetPressedBackgroundBitmap(*pPressedBackgroundBitmap);
296 delete pPressedBackgroundBitmap;
298 __pPlayButton->AddActionEventListener(*this);
299 __pPlayButton->SetShowState(false);
302 __pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT);
303 __pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
304 __pFooter->SetBackButton();
306 FooterItem footerItem1;
307 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SHARE);
308 Bitmap* pFooterItemShareNomal =
309 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_SHARE_NORMAL);
310 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemShareNomal);
312 FooterItem footerItem2;
313 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_DELETE);
314 Bitmap* pFooterItemDeleteNomal =
315 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_DELETE_NORMAL);
316 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemDeleteNomal);
318 __pFooter->AddItem(footerItem1);
319 __pFooter->AddItem(footerItem2);
321 delete pFooterItemShareNomal;
322 delete pFooterItemDeleteNomal;
324 ButtonItem buttonItemMore;
325 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
326 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL,
327 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_NORMAL));
328 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED,
329 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_PRESSED));
330 __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItemMore);
332 else if (status == APPCONTROL_MODE_WEB_LINK)
334 __pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
335 __pFooter->SetBackButton();
337 FooterItem footerItem1;
338 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SHARE);
339 Bitmap* pFooterItemShareNomal =
340 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_FOOTER_ICON_SHARE_NORMAL);
341 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemShareNomal);
343 FooterItem footerItem2;
344 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_DOWNLOAD);
345 Bitmap* pFooterItemDownlordNomal = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DOWNLOAD);
346 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pFooterItemDownlordNomal);
348 __pFooter->AddItem(footerItem1);
349 __pFooter->AddItem(footerItem2);
351 delete pFooterItemShareNomal;
352 delete pFooterItemDownlordNomal;
354 ButtonItem buttonItemMore;
355 buttonItemMore.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_FOOTER_MORE);
356 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL,
357 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_NORMAL));
358 buttonItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED,
359 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_MORE_PRESSED));
360 __pFooter->SetButton(BUTTON_POSITION_LEFT, buttonItemMore);
362 __pFooter->AddItem(footerItem1);
363 __pFooter->AddItem(footerItem2);
365 else if (status == APPCONTROL_MODE_CROP)
367 FooterItem footerItem1;
368 footerItem1.Construct(ACTION_ID_FOOTER_BUTTON_SAVE);
369 Bitmap* pfooterItem1 = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_SAVE);
370 footerItem1.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem1);
372 FooterItem footerItem2;
373 footerItem2.Construct(ACTION_ID_FOOTER_BUTTON_BACK);
374 Bitmap* pfooterItem2 = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_X);
375 footerItem2.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem2);
377 __pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
378 __pFooter->AddItem(footerItem1);
379 __pFooter->AddItem(footerItem2);
384 else if (status == APPCONTROL_MODE_MESSAGE || status == APPCONTROL_MODE_EMAIL)
386 __pPlayButton = new (std::nothrow) Button();
387 if (__pPlayButton != null)
389 Rectangle clientRect = GetClientAreaBounds();
391 __pPlayButton->Construct(Rectangle(clientRect.width / 2 - W_PLAY_BUTTON / 2,
392 clientRect.height / 2 - W_PLAY_BUTTON / 2, W_PLAY_BUTTON, H_PLAY_BUTTON));
393 __pPlayButton->SetActionId(ACTION_ID_CONTORL_BUTTON_PLAY);
394 AddControl(*__pPlayButton);
396 Bitmap* pNormalBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
397 __pPlayButton->SetNormalBackgroundBitmap(*pNormalBackgroundBitmap);
398 delete pNormalBackgroundBitmap;
400 Bitmap* pPressedBackgroundBitmap = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_PLAY);
401 __pPlayButton->SetPressedBackgroundBitmap(*pPressedBackgroundBitmap);
402 delete pPressedBackgroundBitmap;
404 __pPlayButton->AddActionEventListener(*this);
405 __pPlayButton->SetShowState(false);
408 __pFooter->SetBackButton();
411 String filePath = __pPresentationModel->GetFilePathAt(0);
412 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
413 if (contentType == CONTENT_TYPE_VIDEO)
415 __pPlayButton->SetShowState(true);
417 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
421 ImageViewerForm::GetHeaderString(int index, String &fileName, String &page)
423 AppLogDebug("ENTER");
424 int allCount = __pPresentationModel->GetFileCount();
425 String pStr = __pPresentationModel->GetFilePathAt(index);
426 fileName = __pPresentationModel->GetFileName(pStr);
427 page.Format(FORMAT_BUFFER_SIZE, L"%d/%d", index + 1, allCount);
428 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
432 ImageViewerForm::DeleteImageFile()
434 AppLogDebug("ENTER");
435 int currentIndex = __pGallery->GetCurrentItemIndex();
437 String strItemText(EMPTY_SPACE);
438 String strItemIdxText(EMPTY_SPACE);
439 int countPath = __pPresentationModel->GetFileCount();
440 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
441 result r = E_SUCCESS;
442 if (filePath.GetLength() == 0)
444 UiApp* pApp = UiApp::GetInstance();
446 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
451 if (filePath.StartsWith(Environment::GetMediaPath(), 0) == true
452 || filePath.StartsWith(Environment::GetExternalStoragePath(), 0) == true)
454 ContentId contentId = __pPresentationModel->GetFileContentId(filePath);
455 ContentManager contentManager;
456 contentManager.Construct();
457 r = contentManager.DeleteContent(contentId);
460 r = File::Remove(filePath);
463 MessageBox messageBox;
464 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_DELETE_FAILED"),
465 MSGBOX_STYLE_NONE, 3000);
467 messageBox.ShowAndWait(modalResult);
468 AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
476 r = File::Remove(filePath);
479 __pPresentationModel->DeleteFilePathAt(currentIndex);
482 UiApp* pApp = UiApp::GetInstance();
484 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
488 else if ((countPath - 1) == currentIndex)
490 __pGallery->SetCurrentItemIndex(--currentIndex);
493 __pGallery->UpdateGallery();
494 filePath = __pPresentationModel->GetFilePathAt(currentIndex);
495 __pPresentationModel->RequestImage(filePath);
497 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
498 __pHeader->SetTitleText(strItemText);
499 __pHeader->SetDescriptionText(strItemIdxText);
501 if (__visible == true)
503 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
505 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
507 __pPlayButton->SetShowState(false);
511 __pPlayButton->SetShowState(true);
515 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
521 ImageViewerForm::CallVideoPlayer(void)
523 AppLogDebug("ENTER");
524 int index = __pGallery->GetCurrentItemIndex();
525 String filePath = __pPresentationModel->GetFilePathAt(index);
527 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
528 pDataList->Construct();
529 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),
530 new (std::nothrow) String(APPCONTROL_DATA_VIDEO));
531 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), new (std::nothrow) String(filePath));
533 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_VIDEO_PLAYER,
534 APPCONTROL_OPERATION_ID_PLAY, pDataList, this);
535 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
539 ImageViewerForm::CreateGallery(void)
541 AppLogDebug("ENTER");
542 Rectangle clientRect = GetClientAreaBounds();
543 Rectangle rect = GetBounds();
545 __pGallery = new (std::nothrow) Gallery();
546 __pGallery->Construct(Rectangle(0, -clientRect.y, rect.width, rect.height));
547 __pGallery->SetName(L"GalleryControl");
548 __pGallery->SetItemProvider(*this);
549 __pGallery->AddGalleryEventListener(*this);
550 AddControl(*__pGallery);
551 __pGallery->SetTextOfEmptyGallery(ResourceManager::GetString(L"IDS_COM_BODY_LOADING"));
553 SlideShowTransitionEffect effect = __pPresentationModel->GetTransitionEffectOfSlideShow();
557 case SLIDE_SHOW_TRANSITION_EFFECT_DISSOLVE:
558 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_DISSOLVE);
560 case SLIDE_SHOW_TRANSITION_EFFECT_ZOOM:
561 __pGallery->SetSlideShowAnimation(Controls::GALLERY_ANIMATION_ZOOM);
563 case SLIDE_SHOW_TRANSITION_EFFECT_SLIDE:
567 __pGallery->SetSlideShowViewDuration(__pPresentationModel->GetDurationOfSlideShow());
569 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
573 ImageViewerForm::InitializePanelDetail()
575 AppLogDebug("ENTER");
576 __pScrollPanel = new (std::nothrow) ScrollPanel();
578 String arrayId[DETAIL_COUNT_MAX] =
580 L"IDS_COM_BODY_DETAILS_NAME", L"IDS_IV_BODY_FILE_FORMAT", L"IDS_IV_BODY_DATE_CREATED",
581 L"IDS_COM_BODY_SIZE", L"IDS_IV_BODY_RESOLUTION", L"IDS_COM_BODY_LOCATION",
582 L"IDS_COM_BODY_LATITUDE", L"IDS_COM_BODY_LONGITUDE", L"IDS_IV_BODY_FILE_LOCATION"
585 if (__pScrollPanel == null)
587 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
589 return E_INVALID_STATE;
592 Rectangle clientRect = GetClientAreaBounds();
593 result r = __pScrollPanel->Construct(Rectangle(0, 0, clientRect.width, clientRect.height));
596 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
598 return E_INVALID_STATE;
601 __pDetail_Label = new (std::nothrow) Label();
602 __pDetail_Label->Construct(RECT_DETAILS_CONTORL_LABEL, ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"));
603 __pScrollPanel->AddControl(*__pDetail_Label);
604 __pDetail_Label->SetTextVerticalAlignment(ALIGNMENT_TOP);
605 __pDetail_Label->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
606 __pDetail_Label->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
607 __pDetail_Label->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
609 for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
611 __pDetail_FileInfo_Label[i] = new (std::nothrow) Label();
612 __pDetail_FileInfo_Label[i]->Construct(
613 Rectangle(X_DETAIL_FILEINFO_LABEL,
614 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT + H_DETAIL_SUB_TEXT) * i,
615 clientRect.width - GAP_W_END_OF_LABEL, H_DETAIL_FILEINFO_LABEL), ResourceManager::GetString(arrayId[i]));
616 __pScrollPanel->AddControl(*__pDetail_FileInfo_Label[i]);
618 __pDetail_FileInfo_Label[i]->SetTextVerticalAlignment(ALIGNMENT_TOP);
619 __pDetail_FileInfo_Label[i]->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
620 __pDetail_FileInfo_Label[i]->SetTextColor(Color::GetColor(COLOR_ID_GREY));
621 __pDetail_FileInfo_Label[i]->SetTextConfig(DETAIL_SUB_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
623 __pDetail_FileInfo_Value_Label[i] = new (std::nothrow) Label();
625 if (i == DETAIL_COUNT_MAX - 1)
627 __pDetail_FileInfo_Value_Label[i]->Construct(
628 Rectangle(X_DETAIL_FILEINFO_LABEL,
629 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT * i) + H_DETAIL_SUB_TEXT * (i + 1),
630 clientRect.width - GAP_W_END_OF_LABEL, H_DETAIL_FILEINFO_VALUE_LABEL * 3), L"");
634 __pDetail_FileInfo_Value_Label[i]->Construct(
635 Rectangle(X_DETAIL_FILEINFO_LABEL,
636 GAP_H_DETAIL_TEXT * (i + 1) + H_DETAIL_MAIN_TEXT + (H_DETAIL_MAIN_TEXT * i) + H_DETAIL_SUB_TEXT * (i + 1),
637 clientRect.width - GAP_W_END_OF_LABEL, H_DETAIL_FILEINFO_VALUE_LABEL), L"");
640 __pScrollPanel->AddControl(*__pDetail_FileInfo_Value_Label[i]);
642 __pDetail_FileInfo_Value_Label[i]->SetTextVerticalAlignment(ALIGNMENT_TOP);
643 __pDetail_FileInfo_Value_Label[i]->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
644 __pDetail_FileInfo_Value_Label[i]->SetTextColor(Color::GetColor(COLOR_ID_WHITE));
645 __pDetail_FileInfo_Value_Label[i]->SetTextConfig(DETAIL_MAIN_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
648 __pScrollPanel->SetBackgroundColor(COLOR_HEADER_CONTORL_PANEL);
649 __pScrollPanel->SetShowState(false);
651 AddControl(*__pScrollPanel);
652 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
658 ImageViewerForm::InitializePopup(void)
660 AppLogDebug("ENTER");
661 if (__pDeletePopup == null)
663 __pDeletePopup = new (std::nothrow) Popup();
664 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
666 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
668 Label* pLabel = new (std::nothrow) Label();
669 pLabel->Construct(Rectangle(0, 0, popupClientBounds.width, H_DELETE_LABEL),
670 ResourceManager::GetString(L"IDS_COM_BODY_DELETE") + L"?");
672 Button* pDeleteButton = new (std::nothrow) Button();
673 pDeleteButton->Construct(
674 Rectangle(0, Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
675 ResourceManager::GetString(L"IDS_COM_BODY_DELETE"));
676 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
677 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
678 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
679 pDeleteButton->SetActionId(ACTION_ID_DELETE_POPUP_DEL);
680 pDeleteButton->AddActionEventListener(*this);
682 Button* pCancelButton = new (std::nothrow) Button();
683 pCancelButton->Construct(
684 Rectangle(popupClientBounds.width / 2 + GAP_W_POPUP_ITEM,
685 Y_DELETE_BUTTON, popupClientBounds.width / 2 - GAP_W_POPUP_ITEM, H_DELETE_BUTTON),
686 ResourceManager::GetString(L"IDS_COM_SK_CANCEL"));
687 pCancelButton->SetActionId(ACTION_ID_DELETE_POPUP_CANCEL);
688 pCancelButton->AddActionEventListener(*this);
690 __pDeletePopup->AddControl(*pLabel);
691 __pDeletePopup->AddControl(*pDeleteButton);
692 __pDeletePopup->AddControl(*pCancelButton);
696 __pDeletePopup->SetShowState(true);
697 __pDeletePopup->Show();
699 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
705 ImageViewerForm::InitializeContextMenuMore(void)
707 AppLogDebug("ENTER");
708 int currentIndex = __pGallery->GetCurrentItemIndex();
709 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
711 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
713 if (__pContextMenuMore != null)
715 delete __pContextMenuMore;
716 __pContextMenuMore = null;
719 __pContextMenuMore = new (std::nothrow) ContextMenu();
721 __pContextMenuMore->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
722 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
724 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
726 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_SET_AS"),
727 ACTION_ID_CONTEXTMENU_SET_AS);
730 if (__pGallery->GetItemCount() > 1)
732 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_SLIDE_SHOW"),
733 ACTION_ID_FOOTER_BUTTON_SLIDE);
735 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_DETAILS"),
736 ACTION_ID_FOOTER_BUTTON_DETAILS);
737 __pContextMenuMore->SetShowState(false);
738 __pContextMenuMore->AddActionEventListener(*this);
739 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
745 ImageViewerForm::InitializeContextMenuSetAs(void)
747 AppLogDebug("ENTER");
749 if (__pContextMenuSetAs != null)
751 delete __pContextMenuSetAs;
752 __pContextMenuSetAs = null;
755 __pContextMenuSetAs = new (std::nothrow) ContextMenu();
756 __pContextMenuSetAs->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height),
757 CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
759 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_HOME_SCREEN_WALLPAPER_ABB"),
760 ACTION_ID_CONTEXTMENU_HOME);
761 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_HEADER_LOCK_SCREEN_WALLPAPER_ABB"),
762 ACTION_ID_CONTEXTMENU_LOCK);
763 __pContextMenuSetAs->AddItem(ResourceManager::GetString(L"IDS_IV_BODY_CALLER_IMAGE"),
764 ACTION_ID_CONTEXTMENU_CALLER);
765 __pContextMenuSetAs->AddActionEventListener(*this);
766 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
772 ImageViewerForm::InitializeContextMenuShare(void)
774 AppLogDebug("ENTER");
775 if (__pContextMenuShare != null)
777 delete __pContextMenuShare;
778 __pContextMenuShare = null;
780 __pContextMenuShare = new (std::nothrow) ContextMenu();
781 __pContextMenuShare->Construct(Point((GetClientAreaBounds().width - (X_MORE * 4)) / 4 + X_MORE * 2,
782 GetClientAreaBounds().y + GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST,
783 CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
785 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
786 ACTION_ID_CONTEXTMENU_MESSAGE);
787 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), ACTION_ID_CONTEXTMENU_EMAIL);
788 __pContextMenuShare->AddActionEventListener(*this);
789 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
795 ImageViewerForm::GetFileSize(String filePath)
797 AppLogDebug("ENTER");
801 result r = File::GetAttributes(filePath, attr);
804 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
808 size = attr.GetFileSize();
809 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
815 ImageViewerForm::SetDetailInfo(void)
817 AppLogDebug("ENTER");
819 Rectangle clientRect = GetClientAreaBounds();
820 __pScrollPanel->SetBounds(0, 0, clientRect.width, clientRect.height);
822 int currentIndex = __pGallery->GetCurrentItemIndex();
823 String strFilePath = __pPresentationModel->GetFilePathAt(currentIndex);
825 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(strFilePath);
827 String strResult[DETAIL_COUNT_MAX] = {EMPTY_SPACE, };
829 strResult[0] = __pPresentationModel->GetFileName(strFilePath);
830 strResult[1] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
833 result r = File::GetAttributes(strFilePath, attr);
836 long long nSize = attr.GetFileSize();
837 DateTime dateTime = attr.GetDateTime();
838 strResult[2] = dateTime.ToString();
840 if (nSize > SINGLE_GIGA_BYTE)
842 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_GIGA_BYTE);
843 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_GB"));
845 else if (nSize > SINGLE_MEGA_BYTE)
847 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_MEGA_BYTE);
848 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_MB"));
850 else if (nSize > SINGLE_KILO_BYTE)
852 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize / SINGLE_KILO_BYTE);
853 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_KB"));
857 strResult[3].Format(FORMAT_BUFFER_SIZE, L"%lld ", nSize);
858 strResult[3].Append(ResourceManager::GetString(L"IDS_COM_BODY_B"));
863 strResult[2] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
864 strResult[3] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
867 strResult[4] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
868 strResult[5] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
869 strResult[6] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
870 strResult[7] = ResourceManager::GetString(L"IDS_COM_BODY_UNKNOWN");
871 strResult[8] = strFilePath;
872 String fileName = File::GetFileName(strFilePath);
873 strResult[8].Remove(strResult[8].GetLength() - fileName.GetLength(), fileName.GetLength());
875 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
877 strResult[0] = __downLordFileName;
879 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
881 ImageMetadata* pImgMeta = ContentManagerUtil::GetImageMetaN(strFilePath);
883 if (pImgMeta != null)
885 ImageContentInfo imageContentInfo;
886 r = imageContentInfo.Construct(&strFilePath);
889 strResult[1] = imageContentInfo.GetMediaFormat();
890 strResult[4].Format(FORMAT_BUFFER_SIZE, L"%d x %d", pImgMeta->GetWidth(),
891 pImgMeta->GetHeight());
893 if (imageContentInfo.GetLocationTag() != EMPTY_SPACE)
895 strResult[5].Format(FORMAT_BUFFER_SIZE, L"%ls", imageContentInfo.GetLocationTag().GetPointer());
898 if (pImgMeta->GetLatitude() > 1.0 && pImgMeta->GetLongitude() > 1.0)
900 strResult[6].Format(FORMAT_BUFFER_SIZE, L"%f", pImgMeta->GetLatitude());
901 strResult[7].Format(FORMAT_BUFFER_SIZE, L"%f", pImgMeta->GetLongitude());
907 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
909 VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(strFilePath);
910 if (pVideoMeta != null)
912 VideoContentInfo videoContentInfo;
913 r = videoContentInfo.Construct(&strFilePath);
916 strResult[1] = videoContentInfo.GetMediaFormat();
917 strResult[4].Format(FORMAT_BUFFER_SIZE, L"%d x %d", pVideoMeta->GetWidth(),
918 pVideoMeta->GetHeight());
919 if (videoContentInfo.GetLocationTag() != EMPTY_SPACE)
921 strResult[5].Format(FORMAT_BUFFER_SIZE, L"%ls", videoContentInfo.GetLocationTag().GetPointer());
927 for (int i = 0; i < DETAIL_COUNT_MAX; ++i)
929 __pDetail_FileInfo_Value_Label[i]->SetText(strResult[i]);
930 __pDetail_FileInfo_Value_Label[i]->RequestRedraw();
933 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
935 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
939 if (__pRenameButton == null)
941 __pRenameButton = new (std::nothrow) Button();
942 Rectangle rect = GetBounds();
943 __pRenameButton->Construct(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
944 __pRenameButton->SetActionId(ACTION_ID_PANEL_HEADER_DETAILS_RENAME);
946 Bitmap* pIcon = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME);
947 Bitmap* pIconBackground =
948 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND);
949 Bitmap* pIconPressed =
950 ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND_PRESS);
952 if (pIcon != null && pIconPressed != null && pIconBackground != null)
954 __pRenameButton->SetNormalBackgroundBitmap(*pIconBackground);
955 __pRenameButton->SetPressedBackgroundBitmap(*pIconPressed);
956 Point iconPosition(0, 0);
957 __pRenameButton->SetNormalBitmap(iconPosition, *pIcon);
958 __pRenameButton->SetPressedBitmap(iconPosition, *pIconPressed);
962 __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
963 __pRenameButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_HEADER_BUTTON1);
967 delete pIconBackground;
969 __pScrollPanel->AddControl(*__pRenameButton);
970 __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
971 __pRenameButton->AddActionEventListener(*this);
975 Rectangle rect = GetBounds();
976 __pRenameButton->SetBounds(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
978 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
984 ImageViewerForm::ShowPanelDetail(bool showStatus)
986 AppLogDebug("ENTER");
990 __pScrollPanel->SetShowState(true);
995 __pScrollPanel->SetShowState(false);
998 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1004 ImageViewerForm::ChangeFooterItem(bool isChanged, Footer* pFooter, int position)
1006 AppLogDebug("ENTER");
1007 FooterItem footerItem;
1008 footerItem.Construct(ACTION_ID_FOOTER_BUTTON_DETAILS);
1009 Bitmap* pfooterItem = null;
1013 pfooterItem = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS_CLOSE);
1014 footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem);
1018 pfooterItem = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_DETAILS);
1019 footerItem.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pfooterItem);
1022 pFooter->SetItemAt(position, footerItem);
1023 pFooter->Invalidate(true);
1027 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1033 ImageViewerForm::DownloadFile(void)
1035 AppLogDebug("ENTER");
1036 String DestPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_WEB_FILE;
1037 if (File::IsFileExist(DestPath) == false)
1039 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1043 ContentId contentId;
1044 ContentManager contentManager;
1045 contentManager.Construct();
1047 ImageContentInfo imageContentInfo;
1048 imageContentInfo.Construct(null);
1050 imageContentInfo.SetKeyword(L"platform, tizen");
1051 String sourcePath = DestPath;
1052 String destPath = Environment::GetMediaPath();
1053 destPath.Append(FOLDER_PATH_DOWNLOADS);
1054 destPath.Append(__downLordFileName);
1056 contentId = contentManager.CreateContent(sourcePath, destPath, true, &imageContentInfo);
1057 ImageViewerForm::OnFormBackRequested(*this);
1058 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1062 ImageViewerForm::GetItemCount(void)
1064 AppLogDebug("ENTER");
1065 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1067 return __pPresentationModel->GetFileCount();
1071 ImageViewerForm::CreateItem(int index)
1073 AppLogDebug("ENTER : index(%d)", index);
1074 GalleryItem* pGallery = new (std::nothrow) GalleryItem();
1076 String filePath = __pPresentationModel->GetFilePathAt(index);
1077 ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
1078 Bitmap* pBitmap = pImageInfo->GetBitmapN();
1079 if (pBitmap == null)
1081 pBitmap = GetQuickThumbnailN(filePath);
1083 if (pBitmap == null)
1085 pBitmap = new (std::nothrow) Bitmap();
1086 pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
1089 pGallery->Construct(*pBitmap, filePath);
1091 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1097 ImageViewerForm::DeleteItem(int index, GalleryItem* pItem)
1099 AppLogDebug("ENTER index(%d)", index);
1100 ImageInfo* pImageInfo = __pPresentationModel->GetImageCacheAt(index);
1101 pImageInfo->ClearBitmap();
1103 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1109 ImageViewerForm::OnGalleryCurrentItemChanged(Gallery& view, int index)
1111 AppLogDebug("ENTER index(%d)", index);
1113 String filePath = __pPresentationModel->GetFilePathAt(index);
1114 AppLogDebug("ENTER index(%d) filePath(%ls)", index, filePath.GetPointer());
1115 __pPresentationModel->RequestImage(filePath);
1118 String strItemIdxText;
1119 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
1120 __pHeader->SetTitleText(strItemText);
1121 __pHeader->SetDescriptionText(strItemIdxText);
1123 if (__visible == true)
1125 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1126 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1128 __pPlayButton->SetShowState(true);
1132 __pPlayButton->SetShowState(false);
1137 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1141 ImageViewerForm::OnGalleryItemClicked(Gallery& view, int index)
1143 AppLogDebug("ENTER");
1145 String filePath = __pPresentationModel->GetFilePathAt(index);
1146 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1148 if (__visible == true)
1150 if (contentType == CONTENT_TYPE_VIDEO)
1152 __pPlayButton->SetShowState(false);
1155 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
1160 if (contentType == CONTENT_TYPE_VIDEO)
1162 __pPlayButton->SetShowState(true);
1165 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
1168 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
1169 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y + 1);
1172 Rectangle clientRect = GetClientAreaBounds();
1173 Rectangle rect = GetBounds();
1174 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1176 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1180 ImageViewerForm::OnGallerySlideShowStarted(Gallery& gallery)
1182 AppLogDebug("ENTER");
1183 PowerManager::KeepScreenOnState(true, false);
1184 if (__visible == true)
1186 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, false);
1188 int index = __pGallery->GetCurrentItemIndex();
1189 String filePath = __pPresentationModel->GetFilePathAt(index);
1190 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1192 if (contentType == CONTENT_TYPE_VIDEO)
1194 __pPlayButton->SetShowState(false);
1200 Rectangle clientRect = GetClientAreaBounds();
1201 Rectangle rect = GetBounds();
1202 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1204 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1208 ImageViewerForm::OnGallerySlideShowStopped(Gallery& gallery)
1210 AppLogDebug("ENTER");
1211 PowerManager::KeepScreenOnState(false, true);
1212 int index = __pGallery->GetCurrentItemIndex();
1214 if (__visible == false)
1216 SetActionBarsVisible(FORM_ACTION_BAR_INDICATOR | FORM_ACTION_BAR_HEADER | FORM_ACTION_BAR_FOOTER, true);
1218 String filePath = __pPresentationModel->GetFilePathAt(index);
1219 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1220 if (contentType == CONTENT_TYPE_VIDEO)
1222 __pPlayButton->SetShowState(true);
1225 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y - 1);
1226 __pPlayButton->SetPosition(__pPlayButton->GetPosition().x, __pPlayButton->GetPosition().y + 1);
1232 String strItemIdxText;
1233 GetHeaderString(index, strItemText, strItemIdxText);
1234 __pHeader->SetTitleText(strItemText);
1235 __pHeader->SetDescriptionText(strItemIdxText);
1237 Rectangle clientRect = GetClientAreaBounds();
1238 Rectangle rect = GetBounds();
1239 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1242 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1246 ImageViewerForm::OnUpdateContentList(void)
1251 ImageViewerForm::OnTerminating(void)
1253 AppLogDebug("ENTER");
1255 if (__pTimer != null)
1262 __pPresentationModel->ClearImageRequests();
1263 __pPresentationModel->RemoveListener(*this);
1265 if (__pContextMenuCopy != null)
1267 delete __pContextMenuCopy;
1268 __pContextMenuCopy = null;
1271 if (__pContextMenuSetAs != null)
1273 delete __pContextMenuSetAs;
1274 __pContextMenuSetAs = null;
1277 if (__pDeletePopup != null)
1279 delete __pDeletePopup;
1280 __pDeletePopup = null;
1283 if (__pContextMenuShare != null)
1285 delete __pContextMenuShare;
1286 __pContextMenuShare = null;
1289 if (__pContextMenuMore != null)
1291 delete __pContextMenuMore;
1292 __pContextMenuMore = null;
1295 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1301 ImageViewerForm::OnActionPerformed(const Control& source, int actionId)
1303 AppLogDebug("ENTER actionId(%d)", actionId);
1304 SceneManager* pSceneManager = SceneManager::GetInstance();
1309 case ACTION_ID_FOOTER_MORE:
1311 InitializeContextMenuMore();
1313 __pContextMenuMore->SetShowState(true);
1314 __pContextMenuMore->Show();
1317 case ACTION_ID_CONTEXTMENU_SET_AS:
1318 InitializeContextMenuSetAs();
1320 __pContextMenuSetAs->SetShowState(true);
1321 __pContextMenuSetAs->Show();
1323 case ACTION_ID_FOOTER_BUTTON_SHARE:
1324 InitializeContextMenuShare();
1326 __pContextMenuShare->SetShowState(true);
1327 __pContextMenuShare->Show();
1329 case ACTION_ID_FOOTER_BUTTON_DELETE:
1330 __pDeletePopup->SetShowState(true);
1331 __pDeletePopup->Show();
1333 case ACTION_ID_FOOTER_BUTTON_SLIDE:
1335 int repeatValue = 0;
1337 if (__pPresentationModel->GetFileCount() > 1)
1339 __pGallery->UpdateGallery();
1340 if (__detail == false)
1342 ShowPanelDetail(false);
1345 __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
1346 ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
1348 if( repeatValue == 0)
1350 __pGallery->StartSlideShow(false);
1354 __pGallery->StartSlideShow(true);
1359 case ACTION_ID_FOOTER_BUTTON_DETAILS:
1361 ShowPanelDetail(__detail);
1364 case ACTION_ID_FOOTER_BUTTON_BACK:
1365 ImageViewerForm::OnFormBackRequested(*this);
1367 case ACTION_ID_FOOTER_BUTTON_DOWNLOAD:
1370 case ACTION_ID_FOOTER_BUTTON_SAVE:
1372 case ACTION_ID_PANEL_HEADER_DETAILS_RENAME:
1374 ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
1375 pSelectedIndex->Construct();
1376 pSelectedIndex->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1377 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_NAME_EDITOR), pSelectedIndex);
1380 case ACTION_ID_CONTEXTMENU_HOME:
1382 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1383 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1384 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_HOME_SCREEN_WALLPAPER));
1385 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1386 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1389 case ACTION_ID_CONTEXTMENU_LOCK:
1391 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1392 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1393 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_LOCK_SCREEN_WALLPAPER));
1394 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1395 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1398 case ACTION_ID_CONTEXTMENU_CALLER:
1400 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1401 pDataList->Construct();
1402 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_SELECTION_MODE),
1403 new (std::nothrow) String(APPCONTROL_DATA_SINGLE));
1404 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_RETURN_TYPE),
1405 new (std::nothrow) String(APPCONTROL_DATA_CONTACT_ID));
1407 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_CONTACTS,
1408 APPCONTROL_OPERATION_ID_PICK, pDataList, this);
1411 case ACTION_ID_CONTEXTMENU_EMAIL:
1413 OnRequestEmailAction();
1416 case ACTION_ID_CONTEXTMENU_MESSAGE:
1418 OnRequestMessagesAction();
1421 case ACTION_ID_CONTEXTMENU_COPY:
1423 int currentIndex = __pGallery->GetCurrentItemIndex();
1424 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1427 item.Construct(CLIPBOARD_DATA_TYPE_IMAGE, filePath);
1428 Clipboard* pClipboard = Clipboard::GetInstance();
1429 pClipboard->CopyItem(item);
1432 case ACTION_ID_DELETE_POPUP_DEL:
1434 __pDeletePopup->SetShowState(false);
1435 __pDeletePopup->Show();
1438 if (__detail == false)
1440 ShowPanelDetail(false);
1444 case ACTION_ID_DELETE_POPUP_CANCEL:
1446 __pDeletePopup->SetShowState(false);
1447 __pDeletePopup->Show();
1450 case ACTION_ID_CONTORL_BUTTON_PLAY:
1456 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1460 ImageViewerForm::OnFormBackRequested(Form& source)
1462 AppLogDebug("ENTER");
1463 if (__detail == false)
1465 ShowPanelDetail(false);
1469 UiApp* pApp = UiApp::GetInstance();
1472 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1476 ImageViewerForm::OnSceneActivatedN(const SceneId& previousSceneId,
1477 const SceneId& currentSceneId, IList* pArgs)
1479 AppLogDebug("ENTER");
1481 Rectangle clientRect = GetClientAreaBounds();
1482 Rectangle rect = GetBounds();
1484 __pGallery->SetBounds(Rectangle(0, -clientRect.y, rect.width, rect.height));
1485 __pScrollPanel->SetBounds(Rectangle(0, 0, clientRect.width, clientRect.height));
1486 __pPlayButton->SetBounds(Rectangle(clientRect.width / 2 - 80, clientRect.height / 2 - 80, 160, 160));
1488 if (previousSceneId == IDSCN_IMAGE_NAME_EDITOR && currentSceneId == IDSCN_IMAGE_VIEWER)
1491 String strItemText(EMPTY_SPACE);
1492 String strItemIdxText(EMPTY_SPACE);
1493 GetHeaderString(__pGallery->GetCurrentItemIndex(), strItemText, strItemIdxText);
1494 __pHeader->SetTitleText(strItemText);
1495 __pHeader->SetDescriptionText(strItemIdxText);
1499 if (__pGallery->GetCurrentItemIndex() < 0)
1501 SetFooterItemState(false);
1505 SetFooterItemState(true);
1508 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1512 ImageViewerForm::OnSceneDeactivated(const SceneId& currentSceneId,
1513 const SceneId& nextSceneId)
1515 AppLogDebug("ENTER");
1516 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1520 ImageViewerForm::OnImageDecodedN(const int index)
1522 AppLogDebug("ENTER");
1523 __pGallery->RefreshGallery(index, GALLERY_REFRESH_TYPE_ITEM_MODIFY);
1525 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1529 ImageViewerForm::OnAppControlCompleteResponseReceived(const AppId& appId,
1530 const String& operationId, AppCtrlResult appControlResult,
1531 const IMap* pExtraData)
1533 AppLogDebug("ENTER");
1535 if (appId == APPCONTROL_PROVIDER_ID_CONTACTS
1536 && operationId == APPCONTROL_OPERATION_ID_PICK
1537 && appControlResult == APP_CTRL_RESULT_SUCCEEDED)
1539 const String* pReturnType =
1540 static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_RETURN_TYPE)));
1541 if (pReturnType != null && pReturnType->CompareTo(APPCONTROL_DATA_CONTACT_ID) == 0)
1543 const String* pContactId =
1544 static_cast<const String*>(pExtraData->GetValue(String(APPCONTROL_KEY_VALUE)));
1545 SceneManager* pSceneManager = SceneManager::GetInstance();
1546 long long lresult = 0;
1547 if (pContactId != null && pContactId->GetLength() > 0)
1549 LongLong::Parse(*pContactId, lresult);
1551 ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
1552 pList->Add(new (std::nothrow) Integer(__pGallery->GetCurrentItemIndex()));
1553 pList->Add(new (std::nothrow) Integer(SET_AT_TYPE_CALLER_IMAGE));
1554 pList->Add(new (std::nothrow) LongLong(lresult));
1555 __pPresentationModel->SetSetterIndex(__pGallery->GetCurrentItemIndex());
1556 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_SETTER), pList);
1560 ImageViewerApp* pImageViewerApp = static_cast<ImageViewerApp*>(ImageViewerApp::GetInstance());
1561 pImageViewerApp->SetFrameEnabled(true);
1562 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1566 ImageViewerForm::OnOverlayControlCreated(const Control& source)
1568 AppLogDebug("ENTER");
1569 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1573 ImageViewerForm::OnOverlayControlOpened(const Control& source)
1575 AppLogDebug("ENTER");
1576 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1580 ImageViewerForm::OnOverlayControlClosed(const Control& source)
1582 AppLogDebug("ENTER");
1583 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1587 ImageViewerForm::OnOtherControlSelected(const Control& source)
1589 AppLogDebug("ENTER");
1590 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1594 ImageViewerForm::InitShowGallery(void)
1596 AppLogDebug("ENTER");
1597 if (__pGallery != null && __pGallery->IsVisible() == false)
1599 Canvas* pCanvas = GetCanvasN();
1600 if (pCanvas == null || GetLastResult() != E_SUCCESS)
1602 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1608 __pGallery->SetShowState(true);
1612 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1616 ImageViewerForm::OnTimerExpired(Timer &timer)
1618 int repeatValue = 0;
1619 AppLogDebug("ENTER");
1620 if (__pPresentationModel->GetFileCount() > 1)
1622 __pSettingPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
1623 ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
1625 if( repeatValue == 0)
1627 __pGallery->StartSlideShow(false);
1631 __pGallery->StartSlideShow(true);
1634 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1638 ImageViewerForm::OnContentTransferInProgress(RequestId requestId, int totalReceivedSize)
1640 AppLogDebug("ENTER");
1641 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1645 ImageViewerForm::OnContentUploadCompleted(RequestId requestId, result transferResult, const String& errorCode,
1646 const String& errorMessage)
1648 AppLogDebug("ENTER");
1649 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1653 ImageViewerForm::OnContentDownloadCompleted(RequestId requestId, ContentId contentId,
1654 result transferResult, const String& errorCode, const String& errorMessage)
1656 AppLogDebug("ENTER");
1657 AppLogTag("IV", "ImageViewerForm::OnContentDownloadCompleted");
1658 AppLogTag("IV", "DownloadCompleted Error [%s]", GetErrorMessage(transferResult));
1659 AppLogTag("IV", "errorCode [%ls] errorMessage [%ls]", errorCode.GetPointer(), errorMessage.GetPointer());
1660 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1664 ImageViewerForm::OnContentDownloadToBufferCompleted(RequestId reqId, ByteBuffer* pBuffer, result r,
1665 const String& errorCode, const String& errorMessage)
1667 AppLogDebug("ENTER");
1668 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1672 ImageViewerForm::OnContentTransferCanceled(RequestId reqId, result res, const String& errorCode,
1673 const String& errorMessage)
1675 AppLogDebug("ENTER");
1676 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1680 ImageViewerForm::RequestDecodeUrl(void)
1682 AppLogDebug("ENTER");
1684 String filePath = __pPresentationModel->GetFilePathAt(0);
1686 if (filePath.StartsWith(WEB_URL_HTTP, 0) == false)
1688 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1693 __downLordFileName = __pPresentationModel->GetFileName(filePath);
1695 Image* pImage = new (std::nothrow) Image();
1696 pImage->Construct();
1699 uri.SetUri(filePath);
1701 pImage->DecodeUrl(uri, BITMAP_PIXEL_FORMAT_RGB565, 720, 1280, reqId, *this, 5000);
1705 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1709 ImageViewerForm::OnImageDecodeUrlReceived (RequestId reqId, Bitmap *pBitmap,
1710 result r, const String errorCode, const String errorMessage)
1712 AppLogDebug("ENTER");
1713 Image* pImage = new (std::nothrow) Image();
1714 pImage->Construct();
1716 String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_WEB_FILE;
1717 r = pImage->EncodeToFile(*pBitmap, IMG_FORMAT_JPG, destPath, true);
1721 __pPresentationModel->GetImageCacheAt(0)->SetFilePath(destPath);
1722 __pPresentationModel->GetImageCacheAt(0)->SetBitmap(pBitmap);
1724 __pGallery->RefreshGallery(0, GALLERY_REFRESH_TYPE_ITEM_MODIFY);
1726 __pPresentationModel->RequestImage(destPath);
1730 AppLogDebug("ImageViewerForm::OnImageDecodeUrlReceived [%s]", GetErrorMessage(r));
1735 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1739 ImageViewerForm::OnRequestEmailAction(void)
1741 AppLogDebug("ENTER");
1742 int currentIndex = __pGallery->GetCurrentItemIndex();
1744 if (__pPresentationModel->GetFileCount() <= 0)
1746 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1750 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1752 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1754 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE || mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1756 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1757 pDataList->Construct();
1758 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
1759 new (std::nothrow) String(filePath));
1761 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL,
1762 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, this);
1764 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1768 ImageViewerForm::OnRequestMessagesAction(void)
1770 AppLogDebug("ENTER");
1771 int currentIndex = __pGallery->GetCurrentItemIndex();
1773 if (__pPresentationModel->GetFileCount() <= 0)
1775 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
1779 String filePath = __pPresentationModel->GetFilePathAt(currentIndex);
1781 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1783 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE || mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1785 HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
1786 pDataList->Construct();
1787 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE),
1788 new (std::nothrow) String(filePath));
1789 pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
1790 new (std::nothrow) String(APPCONTROL_DATA_MMS));
1792 __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGES,
1793 APPCONTROL_OPERATION_ID_COMPOSE, pDataList, this);
1795 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1799 ImageViewerForm::SetFooterItemState(bool isEnable)
1801 AppLogDebug("ENTER");
1802 if (__initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL)
1804 __pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, isEnable);
1805 __pFooter->SetItemEnabled(0, isEnable);
1806 __pFooter->SetItemEnabled(1, isEnable);
1808 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_WEB_LINK)
1810 __pFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, isEnable);
1811 __pFooter->SetItemEnabled(0, isEnable);
1812 __pFooter->SetItemEnabled(1, isEnable);
1814 else if (__initializeDisplayModeCurrent == APPCONTROL_MODE_CROP)
1816 __pFooter->SetItemEnabled(0, isEnable);
1818 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
1822 ImageViewerForm::GetQuickThumbnailN(String& filePath)
1824 AppLogDebug("ENTER");
1825 Bitmap* pBitmap = null;
1827 if (filePath.GetLength() > 4)
1831 ContentSearch contentSearch;
1832 ContentSearchResult* pResultItem = null;
1833 IList* pContentInfoList = null;
1835 ContentType contentType = ContentManagerUtil::CheckContentType(filePath);
1836 result r = contentSearch.Construct(contentType);
1837 AppLogDebug("r(%s)", GetErrorMessage(r));
1840 pBitmap = new (std::nothrow) Bitmap();
1841 r = pBitmap->Construct(DUMMY_IMAGE_DIMENSION, BITMAP_PIXEL_FORMAT_RGB565);
1852 queryString = CONTENT_QUERY_PREFIX_FILENAME;
1853 queryString.Append(L"'");
1854 queryString.Append(__pPresentationModel->GetFileName(filePath));
1855 queryString.Append(L"'");
1857 pContentInfoList = contentSearch.SearchN(PAGE_NO_CONTENT_SEARCH, COUNT_PER_PAGE_CONTENT_SEARCH,
1858 totalPage, totalCount, queryString, EMPTY_SPACE, SORT_ORDER_NONE);
1860 if ((pContentInfoList != null) && GetLastResult() == E_SUCCESS && (pContentInfoList->GetCount() > 0))
1862 IEnumerator* pEnum = pContentInfoList->GetEnumeratorN();
1863 while (pEnum->MoveNext() == E_SUCCESS)
1865 pResultItem = static_cast<ContentSearchResult*>(pEnum->GetCurrent());
1866 if (pResultItem == null)
1871 if (pResultItem->GetContentInfo()->GetContentPath().CompareTo(filePath) == 0)
1873 pBitmap = pResultItem->GetContentInfo()->GetThumbnailN();
1879 if (pContentInfoList != null)
1881 delete pContentInfoList;
1884 if (pBitmap != null)
1886 ImageViewerMediaType mediaType = CommonUtil::GetMediaType(filePath);
1887 if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_IMAGE)
1889 ImageMetadata* pImgMeta = ContentManagerUtil::GetImageMetaN(filePath);
1891 if (pImgMeta != null)
1893 Dimension srcDim(pImgMeta->GetWidth(), pImgMeta->GetHeight());
1894 pBitmap->Scale(srcDim);
1899 ImageBuffer* imageBuffer = new (std::nothrow) ImageBuffer();
1900 result r = imageBuffer->Construct(filePath);
1903 Dimension srcDim(imageBuffer->GetWidth(), imageBuffer->GetHeight());
1904 pBitmap->Scale(srcDim);
1909 else if (mediaType == IMAGE_VIEWER_MEDIA_TYPE_VIDEO)
1911 VideoMetadata* pVideoMeta = ContentManagerUtil::GetVideoMetaN(filePath);
1913 if (pVideoMeta != null && GetLastResult() == E_SUCCESS)
1915 Dimension srcDim(pVideoMeta->GetWidth(), pVideoMeta->GetHeight());
1916 pBitmap->Scale(srcDim);
1924 mainCanvas.Construct(DUMMY_IMAGE_RECTANGLE);
1925 mainCanvas.FillRectangle(Color::GetColor(COLOR_ID_WHITE), DUMMY_IMAGE_RECTANGLE);
1926 pBitmap = new (std::nothrow) Bitmap();
1927 pBitmap->Construct(mainCanvas, DUMMY_IMAGE_RECTANGLE);
1930 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));