Fixed prevent issue
[apps/osp/Gallery.git] / src / GlSettingMainForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 /**
18  * @file                GlSettingMainForm.cpp
19  * @brief               This is the implementation file for SettingMainForm class.
20  */
21
22 #include "GlDropDownCustomItem.h"
23 #include "GlFileListPresentationModel.h"
24 #include "GlGalleryApp.h"
25 #include "GlRadioCustomItem.h"
26 #include "GlResourceManager.h"
27 #include "GlSettingMainForm.h"
28 #include "GlSettingPresentationModel.h"
29 #include "GlSettingToggleCustomItem.h"
30 #include "GlTypes.h"
31
32 using namespace Tizen::App;
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Content;
36 using namespace Tizen::Graphics;
37 using namespace Tizen::System;
38 using namespace Tizen::Ui;
39 using namespace Tizen::Ui::Controls;
40 using namespace Tizen::Ui::Scenes;
41
42 SettingMainForm::SettingMainForm(void)
43         : __pList(null)
44         , __pPresentationModel(null)
45         , __contentUpdated(false)
46 {
47         AppLogDebug("ENTER");
48         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
49 }
50
51 SettingMainForm::~SettingMainForm(void)
52 {
53         AppLogDebug("ENTER");
54         if (pGroupItemCount)
55         {
56                 delete[] pGroupItemCount;
57         }
58         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
59 }
60
61 result
62 SettingMainForm::Initialize(void)
63 {
64         AppLogDebug("ENTER");
65         result r = Form::Construct(IDL_FORM_SETTING_MAIN);
66         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
67
68         return r;
69 }
70
71 result
72 SettingMainForm::OnInitializing(void)
73 {
74         AppLogDebug("ENTER");
75         __pPresentationModel = SettingPresentationModel::GetInstance();
76         SettingInfo::AddSettingEventListener(*this);
77
78         Header* pHeader = GetHeader();
79         AppAssert(pHeader);
80         pHeader->SetStyle(HEADER_STYLE_TITLE);
81         pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_GALLERY"));
82
83         __pList = static_cast<GroupedListView*>(GetControl(L"IDC_SETTING_LIST"));
84
85         if (__pList != null)
86         {
87                 __pList->SetItemProvider(*this);
88                 __pList->AddGroupedListViewItemEventListener(*this);
89         }
90
91         SetFormBackEventListener(this);
92         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
93
94         return E_SUCCESS;
95 }
96
97 result
98 SettingMainForm::OnTerminating(void)
99 {
100         AppLogDebug("ENTER");
101         SettingInfo::RemoveSettingEventListener(*this);
102         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
103
104         return E_SUCCESS;
105 }
106
107 void
108 SettingMainForm::OnActionPerformed(const Control& source, int actionId)
109 {
110         AppLogDebug("ENTER");
111         SceneManager* pSceneManager = SceneManager::GetInstance();
112         AppAssert(pSceneManager);
113
114         switch (actionId)
115         {
116         default:
117         {
118                 break;
119         }
120         }
121         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
122 }
123
124 void
125 SettingMainForm::OnFormBackRequested(Form& source)
126 {
127         AppLogDebug("ENTER");
128
129         GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
130         if (pApp != null)
131         {
132                 if (pApp->GetAppControlOperationId() == APPCONTROL_OPERATION_ID_CONFIGURE)
133                 {
134                         if (pApp->GetFrameActivated() == true)
135                         {
136                                 pApp->SendAppControlResult(APP_CTRL_RESULT_TERMINATED, null);
137                                 pApp->Terminate();
138                         }
139                 }
140                 else
141                 {
142                         SceneManager* pSceneManager = SceneManager::GetInstance();
143                         if (__contentUpdated)
144                         {
145                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
146                         }
147                         else
148                         {
149                                 pSceneManager->GoBackward(BackwardSceneTransition());
150                         }
151                 }
152         }
153
154         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
155 }
156
157 void
158 SettingMainForm::OnContentUpdated(void)
159 {
160         AppLogDebug("ENTER");
161         __contentUpdated = true;
162         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
163 }
164
165 void
166 SettingMainForm::OnSceneActivatedN(const SceneId& previousSceneId,
167                 const SceneId& currentSceneId, IList* pArgs)
168 {
169         AppLogDebug("ENTER");
170         FileListPresentationModel::GetInstance()->AddContentEventListener(this);
171         __pPresentationModel->CreateDefaultRegistry();
172         InitializeSettingValues();
173         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
174 }
175
176 void
177 SettingMainForm::OnSceneDeactivated(const SceneId& currentSceneId,
178                 const SceneId& nextSceneId)
179 {
180         AppLogDebug("ENTER");
181         __contentUpdated = false;
182         __pPresentationModel->DeleteRegistry();
183         FileListPresentationModel::GetInstance()->RemoveContentEventListener(this);
184         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
185 }
186
187 void
188 SettingMainForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
189 {
190         int effectiveIndex = 0;
191         int inputValue = 0;
192
193         effectiveIndex = effectiveIndex + itemIndex;
194
195         if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)
196         {
197                 AppLogDebug("refreshing data child count is %d", settingInfo[effectiveIndex].childCount);
198                 if (settingInfo[effectiveIndex].isOpen == false)
199                 {
200                         settingInfo[effectiveIndex].isOpen = true;
201                         settingInfo[effectiveIndex].childCount = 0;
202                         for (int iter = effectiveIndex + 1; iter < SETTING_MAX; ++iter)
203                         {
204                                 if (settingInfo[iter].itemType == ITEM_TYPE_RADIO)
205                                 {
206                                         ++settingInfo[effectiveIndex].childCount;
207                                 }
208                                 else
209                                 {
210                                         break;
211                                 }
212                         }
213                         listView.UpdateList();
214                 }
215                 else
216                 {
217                         settingInfo[effectiveIndex].isOpen = false;
218                         listView.UpdateList();
219                 }
220         }
221         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)
222         {
223                 int parentIndex = 0;
224                 for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)
225                 {
226                         if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN)
227                         {
228                                 break;
229                         }
230                 }
231                 settingInfo[parentIndex].subText = settingInfo[effectiveIndex].titleText;
232
233                 for (int iter = 0; iter < settingInfo[parentIndex].childCount; ++iter)
234                 {
235                         if (parentIndex + iter + 1 != effectiveIndex)
236                         {
237                                 AppLogDebug("long effectiveIndex %d set to false", itemIndex - (effectiveIndex - parentIndex) + iter + 1);
238                                 settingInfo[parentIndex + iter + 1].isSelected = false;
239                         }
240                         else
241                         {
242                                 AppLogDebug("effectiveIndex %d set to true", effectiveIndex);
243                                 settingInfo[effectiveIndex].isSelected = true;
244                         }
245                 }
246
247                 Invalidate(true);
248         }
249         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)
250         {
251                 if (settingInfo[effectiveIndex].isSelected == true)
252                 {
253                         settingInfo[effectiveIndex].isSelected = false;
254                 }
255                 else
256                 {
257                         settingInfo[effectiveIndex].isSelected = true;
258                 }
259                 if (__pList != null)
260                 {
261                         __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
262                 }
263         }
264
265         switch (effectiveIndex)
266         {
267         case SETTING_INTERVAL_2:
268         {
269                 inputValue = 2;
270                 __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER, ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL,
271                                 inputValue);
272                 listView.UpdateList();
273         }
274         break;
275
276         case SETTING_INTERVAL_3:
277         {
278                 inputValue = 3;
279                 __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER,
280                                 ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, inputValue);
281                 listView.UpdateList();
282         }
283         break;
284
285         case SETTING_INTERVAL_5:
286         {
287                 inputValue = 5;
288                 __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER,
289                                 ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, inputValue);
290                 listView.UpdateList();
291         }
292         break;
293
294         case SETTING_INTERVAL_10:
295         {
296                 inputValue = 10;
297                 __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER,
298                                 ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, inputValue);
299                 listView.UpdateList();
300         }
301         break;
302
303         case SETTING_INTERVAL_20:
304         {
305                 inputValue = 20;
306                 __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER,
307                                 ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL, inputValue);
308                 listView.UpdateList();
309         }
310         break;
311
312         case SETTING_TRANSITION_PAGE:
313         {
314                 inputValue = 0;
315                 __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER,
316                                 ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT, inputValue);
317                 listView.UpdateList();
318         }
319         break;
320
321         case SETTING_TRANSITION_DISSOLVE:
322         {
323                 inputValue = 1;
324                 result r = __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER,
325                                 ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT, inputValue);
326                 if (r == E_SUCCESS)
327                 {
328                         AppLogDebug(" Passed");
329                 }
330
331                 listView.UpdateList();
332         }
333         break;
334
335         case SETTING_TRANSITION_ZOOM:
336         {
337                 inputValue = 2;
338                  __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER,
339                                 ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT, inputValue);
340                 listView.UpdateList();
341         }
342         break;
343
344         case SETTING_REPEAT:
345         {
346                 int repeatValue = 0;
347
348                 __pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
349                                 ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
350
351                 if (repeatValue == 0)
352                 {
353                         inputValue = 1;
354                 }
355                 else
356                 {
357                         inputValue = 0;
358                 }
359
360                 __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER,
361                                 ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, inputValue);
362         }
363         break;
364
365         case SETTING_SHUFFLE:
366         {
367                 int shuffleValue = 0;
368
369                 __pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
370                                 ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE, shuffleValue);
371
372                 if (shuffleValue == 0)
373                 {
374                         inputValue = 1;
375                 }
376                 else
377                 {
378                         inputValue = 0;
379                 }
380
381                 __pPresentationModel->SetValue(SECTION_NAME_IMAGE_VIEWER,
382                                 ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE, inputValue);
383         }
384         break;
385
386         default:
387                 break;
388         }
389 }
390
391 GroupItem*
392 SettingMainForm::CreateGroupItem(int groupIndex, int itemWidth)
393 {
394         GroupItem* pItem = new (std::nothrow) GroupItem();
395         if (pItem == null)
396         {
397                 return null;
398         }
399         result r = pItem->Construct(Dimension(itemWidth, 46));
400         if (IsFailed(r))
401         {
402                 delete pItem;
403                 return null;
404         }
405
406         String text;
407         switch (groupIndex)
408         {
409         case 0:
410                 text = ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW");
411         break;
412
413         default:
414                 break;
415         }
416
417         pItem->SetElement(text, null);
418
419         AppLogDebug("background color set result %s", GetErrorMessage(r));
420
421         pItem->SetTextColor(CUSTOM_COLOR_SETTINGS_GROUPTITLE);
422         return pItem;
423 }
424
425 ListItemBase*
426 SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
427 {
428         AppLog("SettingMainForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d ", groupIndex, itemIndex,
429                         itemWidth);
430
431         result r = E_SUCCESS;
432         int effectiveIndex = 0;
433         const Color ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND;
434         const Color ITEM_RADIO_ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_RADIO_BACKGROUND;
435         const Color ITEM_BACKGROUND_COLOR_HIGHLIGHTED = CUSTOM_BACKGROUND_COLOR_LISTVIEW_PRESSED_HIGHLIGHTED;
436
437         effectiveIndex = effectiveIndex + itemIndex;
438         AppLogDebug("SettingMainForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d effectiveIndex %d", groupIndex, itemIndex, itemWidth, effectiveIndex);
439
440         String fontSizeStr;
441         int fontSize = 0;
442         int itemHeight = 0;
443         int defaultHeight = 112;
444         int defaultFontSize = 44;
445
446         SettingInfo::GetValue("http://tizen.org/setting/font.size", fontSizeStr);
447         AppLog("the font value is %S",fontSizeStr.GetPointer());
448
449         if(fontSizeStr == "medium")
450         {
451                 fontSize = 44;
452                 itemHeight = defaultHeight + (fontSize - defaultFontSize);
453         }
454         else if(fontSizeStr == "huge")
455         {
456                 fontSize =  81;
457                 itemHeight = defaultHeight + (fontSize - defaultFontSize);
458         }
459         else if(fontSizeStr == "giant")
460         {
461                 fontSize = 98;
462                 itemHeight = defaultHeight + (fontSize - defaultFontSize);
463         }
464         else if(fontSizeStr == "small")
465         {
466                 fontSize = 36;
467                 itemHeight = defaultHeight + (fontSize - defaultFontSize);
468         }
469         else if(fontSizeStr == "large")
470         {
471                 fontSize = 64;
472                 itemHeight = defaultHeight + (fontSize - defaultFontSize);
473         }
474         else
475         {
476                 fontSize = 44;
477                 itemHeight = defaultHeight;
478         }
479
480
481         if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)
482         {
483                 SettingToggleCustomItem* pItem = new (std::nothrow) SettingToggleCustomItem();
484                 r = pItem->Construct(itemWidth, itemHeight);
485
486                 if (IsFailed(r))
487                 {
488                         delete pItem;
489                         return null;
490                 }
491
492                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_BACKGROUND_COLOR);
493                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
494
495                 if (__pList != null)
496                 {
497                         __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected);
498                 }
499
500                 pItem->SetText(settingInfo[effectiveIndex].titleText);
501                 pItem->Make(fontSize);
502
503                 return pItem;
504         }
505         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)
506         {
507                 DropDownCustomItem* pItem = new (std::nothrow) DropDownCustomItem();
508                 r = pItem->Construct(itemWidth,itemHeight);
509                 if (IsFailed(r))
510                 {
511                         delete pItem;
512                         return null;
513                 }
514
515                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_BACKGROUND_COLOR);
516                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
517
518                 pItem->SetMainText(settingInfo[effectiveIndex].titleText);
519                 pItem->SetSubText(settingInfo[effectiveIndex].subText);
520                 if (settingInfo[effectiveIndex].isOpen)
521                 {
522                         pItem->SetCurState(DROP_DOWN_ITEM_STATE_OPENED);
523                 }
524                 else
525                 {
526                         pItem->SetCurState(DROP_DOWN_ITEM_STATE_CLOSED);
527                 }
528
529                 r = pItem->Make(fontSize,itemHeight);
530
531                 if (IsFailed(r))
532                 {
533                         delete pItem;
534                         return null;
535                 }
536
537                 return pItem;
538         }
539         else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO)
540         {
541                 RadioCustomItem* pItem = new (std::nothrow) RadioCustomItem();
542                 int parentIndex = 0;
543
544                 for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--)
545                 {
546                         if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN)
547                                 break;
548                 }
549
550                 if (settingInfo[parentIndex].isOpen == false)
551                 {
552                         r = pItem->Construct(itemWidth, 0);
553                         __pList->SetItemEnabled(groupIndex, itemIndex,false);
554                         AppLogDebug("construct with height 0 %s", GetErrorMessage(r));
555                         return pItem;
556                 }
557                 else
558                 {
559                         pItem->Construct(itemWidth, itemHeight);
560                         __pList->SetItemEnabled(groupIndex, itemIndex, true);
561                 }
562
563                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_RADIO_ITEM_BACKGROUND_COLOR);
564                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, ITEM_BACKGROUND_COLOR_HIGHLIGHTED);
565
566                 pItem->SetText(settingInfo[effectiveIndex].titleText);
567                 AppLogDebug("effectiveIndex %d SettingInfo[effectiveIndex].isSelected %d", effectiveIndex, settingInfo[effectiveIndex].isSelected);
568
569                 __pList->SetItemChecked(groupIndex,itemIndex,settingInfo[effectiveIndex].isSelected);
570                 pItem->Make(fontSize);
571
572                 return pItem;
573         }
574         else
575         {
576                 return null;
577         }
578 }
579
580 bool
581 SettingMainForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
582 {
583         delete pItem;
584         return true;
585 }
586
587 bool
588 SettingMainForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
589 {
590         delete pItem;
591         return true;
592 }
593
594 int
595 SettingMainForm::GetGroupCount(void)
596 {
597         int groupCount = 1;
598
599         return groupCount;
600 }
601
602 int
603 SettingMainForm::GetItemCount(int groupIndex)
604 {
605         AppLog(" SettingMainForm::GetItemCount --> groupIndex : %d,", groupIndex);
606         return pGroupItemCount[groupIndex];
607 }
608
609 void
610 SettingMainForm::InitializeSettingValues(void)
611 {
612         pGroupItemCount = new (std::nothrow) int[1];
613         pGroupItemCount[0] = 12;
614         int interval = 0;
615         int transitionValue = 0;
616         int repeatValue = 0;
617         int shuffletValue = 0;
618         String selectedInterval;
619         String selectedTransition;
620
621         for (int iter = (int) SETTING_INVALID + 1; iter < (int) SETTING_MAX; ++iter)
622         {
623                 settingInfo[iter].isSelected = false;
624         }
625
626         result r =__pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER, ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_INTERVAL,
627                         interval);
628
629         if (r == E_SUCCESS)
630         {
631                 switch (interval)
632                 {
633                 case 2:
634                 {
635                         selectedInterval = ResourceManager::GetString(L"IDS_MEDIABR_OPT_2_SECONDS");
636                         settingInfo[SETTING_INTERVAL_2].isSelected = true;
637                 }
638                 break;
639
640                 case 3:
641                 {
642                         selectedInterval = ResourceManager::GetString(L"IDS_MEDIABR_OPT_3_SECONDS");
643                         settingInfo[SETTING_INTERVAL_3].isSelected = true;
644                 }
645                 break;
646
647                 case 5:
648                 {
649                         selectedInterval = ResourceManager::GetString(L"IDS_MEDIABR_BODY_5_SECONDS");
650                         settingInfo[SETTING_INTERVAL_5].isSelected = true;
651                 }
652                 break;
653
654                 case 10:
655                 {
656                         selectedInterval = ResourceManager::GetString(L"IDS_MEDIABR_BODY_10_SECONDS");
657                         settingInfo[SETTING_INTERVAL_10].isSelected = true;
658                 }
659                 break;
660
661                 case 20:
662                 {
663                         selectedInterval = ResourceManager::GetString(L"IDS_MEDIABR_BODY_20_SECONDS");
664                         settingInfo[SETTING_INTERVAL_20].isSelected = true;
665                 }
666                 break;
667
668                 default:
669                         break;
670                 }
671         }
672
673         r = __pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
674                         ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT, transitionValue);
675
676         if (r == E_SUCCESS)
677         {
678                 switch (transitionValue)
679                 {
680                 case 0:
681                 {
682                         selectedTransition = ResourceManager::GetString(L"IDS_EBOOK_BODY_PAGE");
683                         settingInfo[SETTING_TRANSITION_PAGE].isSelected = true;
684                 }
685                 break;
686
687                 case 1:
688                 {
689                         selectedTransition = ResourceManager::GetString(L"IDS_MEDIABR_BODY_DISSOLVE");
690                         settingInfo[SETTING_TRANSITION_DISSOLVE].isSelected = true;
691                 }
692                 break;
693
694                 case 2:
695                 {
696                         selectedTransition = ResourceManager::GetString(L"IDS_IV_OPT_ZOOM");
697                         settingInfo[SETTING_TRANSITION_ZOOM].isSelected = true;
698                 }
699                 break;
700
701                 default:
702                         break;
703                 }
704         }
705
706         settingInfo[SETTING_SLIDESHOW_INTERVAL_TITLE].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_SLIDESHOW_INTERVAL");
707         settingInfo[SETTING_SLIDESHOW_INTERVAL_TITLE].subText = selectedInterval;
708         settingInfo[SETTING_SLIDESHOW_INTERVAL_TITLE].itemType = ITEM_TYPE_DROPDOWN;
709
710         settingInfo[SETTING_INTERVAL_2].titleText = ResourceManager::GetString(L"IDS_MEDIABR_OPT_2_SECONDS");
711         settingInfo[SETTING_INTERVAL_2].subText = L"";
712         settingInfo[SETTING_INTERVAL_2].itemType = ITEM_TYPE_RADIO;
713
714         settingInfo[SETTING_INTERVAL_3].titleText = ResourceManager::GetString(L"IDS_MEDIABR_OPT_3_SECONDS");
715         settingInfo[SETTING_INTERVAL_3].subText = L"";
716         settingInfo[SETTING_INTERVAL_3].itemType = ITEM_TYPE_RADIO;
717
718         settingInfo[SETTING_INTERVAL_5].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_5_SECONDS");
719         settingInfo[SETTING_INTERVAL_5].subText = L"";
720         settingInfo[SETTING_INTERVAL_5].itemType = ITEM_TYPE_RADIO;
721
722         settingInfo[SETTING_INTERVAL_10].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_10_SECONDS");
723         settingInfo[SETTING_INTERVAL_10].subText = L"";
724         settingInfo[SETTING_INTERVAL_10].itemType = ITEM_TYPE_RADIO;
725
726         settingInfo[SETTING_INTERVAL_20].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_20_SECONDS");
727         settingInfo[SETTING_INTERVAL_20].subText = L"";
728         settingInfo[SETTING_INTERVAL_20].itemType = ITEM_TYPE_RADIO;
729
730         r = __pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER, ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE, repeatValue);
731
732         settingInfo[SETTING_REPEAT].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_REPEAT");
733         settingInfo[SETTING_REPEAT].itemType = ITEM_TYPE_TOGGLE;
734
735         if (repeatValue == 0)
736         {
737                 settingInfo[SETTING_REPEAT].isSelected = false;
738         }
739         else
740         {
741                 settingInfo[SETTING_REPEAT].isSelected = true;
742         }
743
744         r = __pPresentationModel->GetValue(SECTION_NAME_IMAGE_VIEWER,
745                         ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE, shuffletValue);
746
747         settingInfo[SETTING_SHUFFLE].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_SHUFFLE");
748         settingInfo[SETTING_SHUFFLE].itemType = ITEM_TYPE_TOGGLE;
749
750         if (shuffletValue == 0)
751         {
752                 settingInfo[SETTING_SHUFFLE].isSelected = false;
753         }
754         else
755         {
756                 settingInfo[SETTING_SHUFFLE].isSelected = true;
757         }
758
759         settingInfo[SETTING_TRANSITION_EFFECT_TITLE].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_TRANSITION_EFFECT");
760         settingInfo[SETTING_TRANSITION_EFFECT_TITLE].subText = selectedTransition;
761         settingInfo[SETTING_TRANSITION_EFFECT_TITLE].itemType = ITEM_TYPE_DROPDOWN;
762
763         settingInfo[SETTING_TRANSITION_PAGE].titleText = ResourceManager::GetString(L"IDS_EBOOK_BODY_PAGE");
764         settingInfo[SETTING_TRANSITION_PAGE].subText = L"";
765         settingInfo[SETTING_TRANSITION_PAGE].itemType = ITEM_TYPE_RADIO;
766
767         settingInfo[SETTING_TRANSITION_DISSOLVE].titleText = ResourceManager::GetString(L"IDS_MEDIABR_BODY_DISSOLVE");
768         settingInfo[SETTING_TRANSITION_DISSOLVE].subText = L"";
769         settingInfo[SETTING_TRANSITION_DISSOLVE].itemType = ITEM_TYPE_RADIO;
770
771         settingInfo[SETTING_TRANSITION_ZOOM].titleText = ResourceManager::GetString(L"IDS_IV_OPT_ZOOM");
772         settingInfo[SETTING_TRANSITION_ZOOM].subText = L"";
773         settingInfo[SETTING_TRANSITION_ZOOM].itemType = ITEM_TYPE_RADIO;
774 }
775
776 SettingMainForm::SettingItemInfo::SettingItemInfo(void)
777         : childCount(0)
778         , isOpen(false)
779         , isSelected(false)
780 {
781 }
782
783
784 void
785 SettingMainForm::OnSettingChanged(String& key)
786 {
787         AppLogDebug("ENTER");
788         if (key == L"http://tizen.org/setting/font.size")
789         {
790                 __pList->UpdateList();
791         }
792         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
793 }