Add media & notification volum control bar and fix wallpaper crash issue
authorTaeHo Choi <thanks.choi@samsung.com>
Thu, 18 Apr 2013 12:46:05 +0000 (21:46 +0900)
committerTaeHo Choi <thanks.choi@samsung.com>
Thu, 18 Apr 2013 12:46:05 +0000 (21:46 +0900)
Change-Id: I92f3bb465a3e39c09f8e59411bb875811d4b6a37
Signed-off-by: TaeHo Choi <thanks.choi@samsung.com>
src/StSoundsForm.cpp
src/StWallpaperAlbumListPresentationModel.cpp

index fd71408..6b8ad9c 100644 (file)
@@ -41,8 +41,10 @@ static const int ID_ITEM_MAIN_VIBRATION = 1;
 
 static const int ID_GROUP_VOLUME = 1;
 
-static const int ID_GROUP_VOLUME_ITEM_COUNT = 1;
-static const int ID_ITEM_VOLUME_SYSTEM = 0;
+static const int ID_GROUP_VOLUME_ITEM_COUNT = 3;
+static const int ID_ITEM_VOLUME_NOTIFICATION = 0;
+static const int ID_ITEM_VOLUME_MEDIA = 1;
+static const int ID_ITEM_VOLUME_SYSTEM = 2;
 
 static const int ID_GROUP_VIBRATION = 2;
 static const int ID_GROUP_VIBRATION_ITEM_COUNT = 2;
@@ -71,6 +73,8 @@ static const int ID_GROUP3 = 2;
 static const int ID_GROUP4 = 3;
 
 static const int ID_GROUP2_INDEX1 = 0;
+static const int ID_GROUP2_INDEX2 = 1;
+static const int ID_GROUP2_INDEX3 = 2;
 
 static const int ID_SOUND_VOLUME_PAGE = 1;
 static const int ID_SOUND_RINGTONE_PAGE = 2;
@@ -153,10 +157,14 @@ SoundsForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
                        {
                                __pTableView->SetItemChecked(ID_GROUP1, ID_ITEM_MAIN_VOLUME, true);
                                __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX1, true);
+                               __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX2, true);
+                               __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX3, true);
                        }
                        else
                        {
                                __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX1, false);
+                               __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX2, false);
+                               __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX3, false);
                        }
                }
 
@@ -491,11 +499,22 @@ SoundsForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                {
                        String sliderItemName;
                        sliderItemName.Format(STRING_SIZE_LIMIT, L"volumeItem_%d", itemIndex);
+                       String settingInfoVolumeKey = SETTING_INFO_KEY_SOUND_SYSTEM_VOLUME;
 
                        if (itemIndex == ID_ITEM_VOLUME_SYSTEM)
                        {
                                itemText = ResourceManager::GetString(L"IDS_ST_BODY_SYSTEM");
                        }
+                       else if (itemIndex == ID_ITEM_VOLUME_MEDIA)
+                       {
+                               itemText = ResourceManager::GetString(L"IDS_COM_BODY_MEDIA");
+                               settingInfoVolumeKey = SETTING_INFO_KEY_SOUND_MEDIA_VOLUME;
+                       }
+                       else if (itemIndex == ID_ITEM_VOLUME_NOTIFICATION)
+                       {
+                               itemText = ResourceManager::GetString(L"IDS_ST_BODY_NOTIFICATION");
+                               settingInfoVolumeKey = SETTING_INFO_KEY_SOUND_NOTIFICATION_VOLUME;
+                       }
 
                        pSlider = new (std::nothrow) Slider();
 
@@ -503,7 +522,7 @@ SoundsForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                        pSlider->SetTitleText(itemText);
 
                        int systemVolume = 0;
-                       if (SettingInfo::GetValue(SETTING_INFO_KEY_SOUND_SYSTEM_VOLUME, systemVolume) != E_SUCCESS)
+                       if (SettingInfo::GetValue(settingInfoVolumeKey, systemVolume) != E_SUCCESS)
                        {
                                pSlider->SetValue(GROUP_ITEM_SLIDER_DEFAULT_VALUE);
                        }
@@ -707,6 +726,8 @@ SoundsForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTable
                                                {
                                                        tableView.SetItemChecked(groupIndex, itemIndex, itemSelectStatus);
                                                        tableView.SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX1, itemSelectStatus);
+                                                       tableView.SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX2, itemSelectStatus);
+                                                       tableView.SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX3, itemSelectStatus);
                                                        __pTableView->RefreshAllItems();
                                                }
                                                else
@@ -830,21 +851,21 @@ SoundsForm::OnAdjustmentValueChanged(const Tizen::Ui::Control& source, int adjus
 
        if (sourceName == L"volumeItem_0")
        {
-               if (SettingInfo::SetValue(SETTING_INFO_KEY_SOUND_SYSTEM_VOLUME, adjustment) != E_SUCCESS)
+               if (SettingInfo::SetValue(SETTING_INFO_KEY_SOUND_NOTIFICATION_VOLUME, adjustment) != E_SUCCESS)
                {
                        AppLogDebug("Set system volume fail... - %s", GetErrorMessage(GetLastResult()));
                }
        }
        else if (sourceName == L"volumeItem_1")
        {
-               if(SettingInfo::SetVolume (SETTING_INFO_KEY_SOUND_NOTIFICATION_VOLUME, adjustment) != E_SUCCESS)
+               if(SettingInfo::SetVolume (SETTING_INFO_KEY_SOUND_MEDIA_VOLUME, adjustment) != E_SUCCESS)
                {
                        AppLogDebug("NotificationSoundVolume Fail..  - %s", GetErrorMessage(GetLastResult()));
                }
        }
        else if (sourceName == L"volumeItem_2")
        {
-               if (SettingInfo::SetVolume (SETTING_INFO_KEY_SOUND_MEDIA_VOLUME, adjustment) != E_SUCCESS)
+               if (SettingInfo::SetVolume (SETTING_INFO_KEY_SOUND_SYSTEM_VOLUME, adjustment) != E_SUCCESS)
                {
                        AppLogDebug("MediaSoundVolume Fail..  - %s", GetErrorMessage(GetLastResult()));
                }
@@ -991,11 +1012,15 @@ SoundsForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::I
                                {
                                        __pTableView->SetItemChecked(ID_GROUP1, ID_ITEM_MAIN_VOLUME, false);
                                        __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX1, false);
+                                       __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX2, false);
+                                       __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX3, false);
                                }
                                else
                                {
                                        __pTableView->SetItemChecked(ID_GROUP1, ID_ITEM_MAIN_VOLUME, true);
                                        __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX1, true);
+                                       __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX2, true);
+                                       __pTableView->SetItemEnabled(ID_GROUP2, ID_GROUP2_INDEX3, true);
                                }
                        }
                }
index 54dd200..4a88452 100644 (file)
@@ -198,6 +198,11 @@ WallpaperAlbumListPresentationModel::DrawPartialImage(Canvas& canvas, AlbumInfo*
        ContentManager pContentManager;
        pContentManager.Construct();
        ContentInfo* pContentInfo = pContentManager.GetContentInfoN(pContentId);
+       if (pContentInfo == null)
+       {
+               AppLogDebug("pContentInfo is null");
+               return;
+       }
        Bitmap* pBitmap1 = ResourceManager::GetApplicationBitmapN(pContentInfo->GetContentPath());
        if (pBitmap1 != null)
        {
@@ -333,6 +338,12 @@ WallpaperAlbumListPresentationModel::CreateDetailMergeBitmapN(int index)
                return null;
        }
 
+       if (pContentInfo == null)
+       {
+               AppLogDebug("pContentInfo is null");
+               delete pBitmapNew;
+               return null;
+       }
        Bitmap* pBitmap = ResourceManager::GetApplicationBitmapN(pContentInfo->GetContentPath());
        if (pBitmap != null)
        {