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