Fixed scene transition after press back from SettingsForm
[apps/osp/Gallery.git] / src / GlSettingMainForm.cpp
index efe7551..c25cdaf 100644 (file)
@@ -42,6 +42,7 @@ using namespace Tizen::Ui::Scenes;
 SettingMainForm::SettingMainForm(void)
        : __pList(null)
        , __pPresentationModel(null)
+       , __contentUpdated(false)
 {
        AppLogDebug("ENTER");
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -72,6 +73,7 @@ SettingMainForm::OnInitializing(void)
 {
        AppLogDebug("ENTER");
        __pPresentationModel = SettingPresentationModel::GetInstance();
+       SettingInfo::AddSettingEventListener(*this);
 
        InitializeSettingValues();
 
@@ -436,10 +438,50 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
        effectiveIndex = effectiveIndex + itemIndex;
        AppLogDebug("SettingMainForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d effectiveIndex %d", groupIndex, itemIndex, itemWidth, effectiveIndex);
 
+       String fontSizeStr;
+       int fontSize = 0;
+       int itemHeight = 0;
+       int defaultHeight = 112 ;
+       int defaultFontSize = 44 ;
+
+       SettingInfo::GetValue("http://tizen.org/setting/font.size", fontSizeStr);
+       AppLog("the font value is %S",fontSizeStr.GetPointer());
+
+       if(fontSizeStr == "medium")
+       {
+               fontSize = 44;
+               itemHeight = defaultHeight + ( fontSize - defaultFontSize);
+       }
+       else if(fontSizeStr == "huge")
+       {
+               fontSize =  81;
+               itemHeight = defaultHeight + ( fontSize - defaultFontSize);
+       }
+       else if(fontSizeStr == "giant")
+       {
+               fontSize = 98;
+               itemHeight = defaultHeight + ( fontSize - defaultFontSize);
+       }
+       else if(fontSizeStr == "small")
+       {
+               fontSize = 36;
+               itemHeight = defaultHeight + ( fontSize - defaultFontSize);
+       }
+       else if(fontSizeStr == "large")
+       {
+               fontSize = 64;
+               itemHeight = defaultHeight + ( fontSize - defaultFontSize);
+       }
+       else
+       {
+               fontSize = 44;
+       }
+
+
        if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)
        {
                SettingToggleCustomItem* pItem = new (std::nothrow) SettingToggleCustomItem();
-               r = pItem->Construct(itemWidth, 112);
+               r = pItem->Construct(itemWidth, itemHeight);
 
                if (IsFailed(r))
                {
@@ -456,14 +498,14 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                }
 
                pItem->SetText(settingInfo[effectiveIndex].titleText);
-               pItem->Make();
+               pItem->Make(fontSize);
 
                return pItem;
        }
        else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)
        {
                DropDownCustomItem* pItem = new (std::nothrow) DropDownCustomItem();
-               r = pItem->Construct(itemWidth);
+               r = pItem->Construct(itemWidth,itemHeight);
                if (IsFailed(r))
                {
                        delete pItem;
@@ -484,7 +526,7 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                        pItem->SetCurState(DROP_DOWN_ITEM_STATE_CLOSED);
                }
 
-               r = pItem->Make();
+               r = pItem->Make(fontSize,itemHeight);
 
                if (IsFailed(r))
                {
@@ -513,7 +555,7 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                }
                else
                {
-                       pItem->Construct(itemWidth, 112);
+                       pItem->Construct(itemWidth, itemHeight);
                }
 
                pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_RADIO_ITEM_BACKGROUND_COLOR);
@@ -523,7 +565,7 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                AppLogDebug("effectiveIndex %d SettingInfo[effectiveIndex].isSelected %d", effectiveIndex, settingInfo[effectiveIndex].isSelected);
 
                pItem->SetSelected(settingInfo[effectiveIndex].isSelected);
-               pItem->Make();
+               pItem->Make(fontSize);
 
                return pItem;
        }
@@ -735,3 +777,15 @@ SettingMainForm::SettingItemInfo::SettingItemInfo(void)
        , isSelected(false)
 {
 }
+
+
+void
+SettingMainForm::OnSettingChanged(String& key)
+{
+       AppLogDebug("ENTER");
+       if (key == L"http://tizen.org/setting/font.size")
+       {
+               __pList->UpdateList();
+       }
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}