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