Mapped index to elementId in listview:N_SE-45969
authorrahul varna <rahul.varna@samsung.com>
Fri, 12 Jul 2013 12:03:20 +0000 (17:33 +0530)
committerrahul varna <rahul.varna@samsung.com>
Fri, 12 Jul 2013 12:03:20 +0000 (17:33 +0530)
Signed-off-by: rahul varna <rahul.varna@samsung.com>
project/src/Camera/CameraCaptureForm.cpp
project/src/Camera/CameraCaptureForm.h
project/src/Recorder/VideoRecorderForm.cpp
project/src/Recorder/VideoRecorderForm.h

index 3687c2c..4a3edf3 100644 (file)
@@ -219,7 +219,7 @@ CameraCaptureForm::CameraCaptureForm(void)
        , __flashModeValue(CAMERA_FLASH_MODE_AUTO)
        , __sceneModeValue(CAMERA_SCENE_OFF)
 {
-
+       memset(__elementIdArray, -1, SETTINGS_OPTION_COUNT);
 }
 
 CameraCaptureForm::~CameraCaptureForm(void)
@@ -295,6 +295,19 @@ CameraCaptureForm::Initialize(void)
        return true;
 }
 
+int
+CameraCaptureForm::GetElementIdForIndex(int index)
+{
+       if (index != -1)
+       {
+               return __elementIdArray[index];
+       }
+       else
+       {
+               return -1;
+       }
+}
+
 CameraCaptureForm*
 CameraCaptureForm::GetListener(void)
 {
@@ -851,6 +864,8 @@ CameraCaptureForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
        HidePopUp(__pPopupSetting);
        if (&source == __pListViewSetting)
        {
+               elementId = GetElementIdForIndex(index);
+
                switch (elementId)
                {
                case ID_MENU_BRIGHTNESS:
@@ -2697,6 +2712,7 @@ CameraCaptureForm::CreateSettingPopUp(void)
 {
        result r = E_SUCCESS;
        bool value = false;
+       int index = 0;
 
        DeletePopup(&__pPopupSetting);
 
@@ -2724,6 +2740,8 @@ CameraCaptureForm::CreateSettingPopUp(void)
                        TryCatch(pData != null,  ,"CAMERA_PRIMARY_SUPPORT_EXPOSURE E_OUT_OF_MEMORY");
 
                        __pSettingItemArrayList->Add(*pData);
+                       __elementIdArray[index] = ID_MENU_EXPOSURE;
+                       index++;
                }
 
                r = GetMediaCapability(CAMERA_PRIMARY_SUPPORT_CONTRAST, value);
@@ -2734,6 +2752,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
 
                        __pSettingItemArrayList->Add(*pData);
 
+                       __elementIdArray[index] = ID_MENU_CONTRAST;
+                       index++;
+
                }
                r = GetMediaCapability(CAMERA_PRIMARY_EFFECT);
                if (r == E_SUCCESS)
@@ -2742,6 +2763,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                        TryCatch(pData != null,  ,"CAMERA_PRIMARY_EFFECT E_OUT_OF_MEMORY");
 
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_EFFECT;
+                       index++;
                }
 
                r = GetMediaCapability(CAMERA_PRIMARY_SUPPORT_ZOOM, value);
@@ -2751,6 +2775,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                        TryCatch(pData != null,  ,"CAMERA_PRIMARY_SUPPORT_ZOOM E_OUT_OF_MEMORY");
 
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_ZOOMLEVEL;
+                       index++;
                }
 
                r = GetMediaCapability(CAMERA_PRIMARY_PREVIEW_FRAMERATE);
@@ -2761,6 +2788,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
 
                        __pSettingItemArrayList->Add(*pData);
 
+                       __elementIdArray[index] = ID_MENU_FRAME_RATE;
+                       index++;
+
                }
 
                r = GetMediaCapability(CAMERA_PRIMARY_SUPPORT_PREVIEW, value);
@@ -2770,6 +2800,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                        TryCatch(pData != null,  ,"CAMERA_PRIMARY_SUPPORT_PREVIEW E_OUT_OF_MEMORY");
 
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_PREVIEW_RESOLUTION;
+                       index++;
                }
 
                r = GetMediaCapability(CAMERA_PRIMARY_SUPPORT_CAPTURE, value);
@@ -2779,6 +2812,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                        TryCatch(pData != null,  ,"CAMERA_PRIMARY_SUPPORT_CAPTURE E_OUT_OF_MEMORY");
 
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_CAPTURE_RESOLUTION;
+                       index++;
                }
 
                if (__isZeroShutterLag == false)
@@ -2787,6 +2823,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                        TryCatch(pData != null,  ,"CAMERA_PRIMARY_PREVIEW_FORMAT E_OUT_OF_MEMORY");
 
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_PREVIEW_FORMAT;
+                       index++;
                }
 
                r = GetMediaCapability(CAMERA_PRIMARY_SCENE_MODE);
@@ -2796,6 +2835,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                        TryCatch(pData != null,  ,"CAMERA_PRIMARY_SCENE_MODE E_OUT_OF_MEMORY");
 
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_SCENE_MODE;
+                       index++;
                }
 
                // If scene mode is set, then don't show these options
@@ -2808,6 +2850,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                                TryCatch(pData != null,  ,"CAMERA_PRIMARY_SUPPORT_BRIGHTNESS E_OUT_OF_MEMORY");
 
                                __pSettingItemArrayList->Add(*pData);
+
+                               __elementIdArray[index] = ID_MENU_BRIGHTNESS;
+                               index++;
                        }
 
                        r = GetMediaCapability(CAMERA_PRIMARY_ISO_LEVEL);
@@ -2817,6 +2862,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                                TryCatch(pData != null,  ,"CAMERA_PRIMARY_ISO_LEVEL E_OUT_OF_MEMORY");
 
                                __pSettingItemArrayList->Add(*pData);
+
+                               __elementIdArray[index] = ID_MENU_ISOLEVEL;
+                               index++;
                        }
 
                        r = GetMediaCapability(CAMERA_PRIMARY_WHITE_BALANCE);
@@ -2826,6 +2874,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                                TryCatch(pData != null,  ,"CAMERA_PRIMARY_WHITE_BALANCE E_OUT_OF_MEMORY");
 
                                __pSettingItemArrayList->Add(*pData);
+
+                               __elementIdArray[index] = ID_MENU_WHITEBALANCE;
+                               index++;
                        }
 
                        r = GetMediaCapability(CAMERA_PRIMARY_FOCUS_MODE);
@@ -2835,6 +2886,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                                TryCatch(pData != null,  ,"CAMERA_PRIMARY_FOCUS_MODE E_OUT_OF_MEMORY");
 
                                __pSettingItemArrayList->Add(*pData);
+
+                               __elementIdArray[index] = ID_MENU_FOCUS_MODE;
+                               index++;
                        }
 
                        r = GetMediaCapability(CAMERA_PRIMARY_FLASH_MODE);
@@ -2844,6 +2898,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                                TryCatch(pData != null,  ,"CAMERA_PRIMARY_FLASH_MODE E_OUT_OF_MEMORY");
 
                                __pSettingItemArrayList->Add(*pData);
+
+                               __elementIdArray[index] = ID_MENU_FLASH_MODE;
+                               index++;
                        }
 
                        r = GetMediaCapability(CAMERA_PRIMARY_METERING_MODE);
@@ -2853,6 +2910,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
                                TryCatch(pData != null,  ,"CAMERA_PRIMARY_METERING_MODE E_OUT_OF_MEMORY");
 
                                __pSettingItemArrayList->Add(*pData);
+
+                               __elementIdArray[index] = ID_MENU_METERING_MODE;
+                               index++;
                        }
 
                }
@@ -2862,6 +2922,9 @@ CameraCaptureForm::CreateSettingPopUp(void)
 
                __pSettingItemArrayList->Add(*pData);
 
+               __elementIdArray[index] = ID_MENU_CAPTURE_QUALITY;
+               index++;
+
                r = AddListView(&__pListViewSetting, __pPopupSetting, ID_BUTTON_SETTING_OK);
                TryCatch(r == E_SUCCESS, ,"[%s] AddListView", GetErrorMessage(r));
        }
index 3e4cfa7..91a8fd8 100644 (file)
@@ -24,6 +24,8 @@
 #include <FUixSensorISensorEventListener.h>
 #include "MultiForm.h"
 
+static const int SETTINGS_OPTION_COUNT = 20;
+
 class CameraCaptureForm
        : public MultiForm
        , public Tizen::Media::ICameraEventListener
@@ -148,6 +150,8 @@ private:
        void ShowCapturedImageThumbnail(String* pFileName);
        Tizen::Graphics::PixelFormat GetPreviewFormat(const int& previewFormatValue);
 
+       int GetElementIdForIndex(int index);
+
        bool IsBatteryLevelLow(void);
 private:
        //Do not change the e-num order, if any new things are to be added add to the end of the list
@@ -293,6 +297,7 @@ private:
        int __fileCount;
        int __iconListCount;
        int __iconListIndex;
+       int __elementIdArray[SETTINGS_OPTION_COUNT];
 
        bool __batteryLevelFlag;
        bool __background;
index b651b09..cdb3ed9 100644 (file)
@@ -272,6 +272,7 @@ VideoRecorderForm::VideoRecorderForm(void)
        , __sceneModeValue(CAMERA_SCENE_OFF)
        , __cameraError(CAMERA_ERROR_NONE)
 {
+       memset(__elementIdArray, -1, SETTINGS_MENU_OPTION_COUNT);
 }
 
 VideoRecorderForm::~VideoRecorderForm(void)
@@ -2411,6 +2412,19 @@ VideoRecorderForm::OnCameraPreviewed(Tizen::Base::ByteBuffer& previewedData, res
        __pOverlay->Show();
 }
 
+int
+VideoRecorderForm::GetElementIdForIndex(int index)
+{
+       if (index != -1)
+       {
+               return __elementIdArray[index];
+       }
+       else
+       {
+               return -1;
+       }
+}
+
 void
 VideoRecorderForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& source, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
 {
@@ -2907,6 +2921,8 @@ VideoRecorderForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& sou
        }
        else if (&source == __pListViewSetting)
        {
+               elementId = GetElementIdForIndex(index);
+
                HidePopUp(__pPopupSetting);
                switch (elementId)
                {
@@ -4300,6 +4316,7 @@ VideoRecorderForm::CreateSettingPopUp(void)
 {
        result r = E_SUCCESS;
        bool value = false;
+       int index = 0;
 
        DeletePopup(&__pPopupSetting);
        if (__pPopupSetting == null)
@@ -4333,6 +4350,8 @@ VideoRecorderForm::CreateSettingPopUp(void)
 
                                pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Brightness"), (int) ID_MENU_BRIGHTNESS);
                                __pSettingItemArrayList->Add(*pData);
+                               __elementIdArray[index] = ID_MENU_BRIGHTNESS;
+                               index++;
                        }
 
                        if (__camType == CAMERA_PRIMARY)
@@ -4348,6 +4367,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                        {
                                pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Focus Mode"), (int) ID_MENU_FOCUSMODE);
                                __pSettingItemArrayList->Add(*pData);
+
+                               __elementIdArray[index] = ID_MENU_FOCUSMODE;
+                               index++;
                        }
 
                        if (__camType == CAMERA_PRIMARY)
@@ -4362,6 +4384,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                        {
                                pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"IsoLevel"), (int) ID_MENU_ISOLEVEL);
                                __pSettingItemArrayList->Add(*pData);
+
+                               __elementIdArray[index] = ID_MENU_ISOLEVEL;
+                               index++;
                        }
 
                        if (__camType == CAMERA_PRIMARY)
@@ -4376,6 +4401,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                        {
                                pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"WhiteBalance"), (int) ID_MENU_WHITEBALANCE);
                                __pSettingItemArrayList->Add(*pData);
+
+                               __elementIdArray[index] = ID_MENU_WHITEBALANCE;
+                               index++;
                        }
 
                }
@@ -4393,6 +4421,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Scene Mode"), (int) ID_MENU_SCENE_MODE);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_SCENE_MODE;
+                       index++;
                }
 
                if (__camType == CAMERA_PRIMARY)
@@ -4408,6 +4439,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Exposure"), (int) ID_MENU_EXPOSURE);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_EXPOSURE;
+                       index++;
                }
 
                if (__camType == CAMERA_PRIMARY)
@@ -4422,6 +4456,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Contrast"), (int) ID_MENU_CONTRAST);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_CONTRAST;
+                       index++;
                }
 
                if (__camType == CAMERA_PRIMARY)
@@ -4437,6 +4474,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Effect"), (int) ID_MENU_EFFECT);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_EFFECT;
+                       index++;
                }
 
                if (__camType == CAMERA_PRIMARY)
@@ -4451,6 +4491,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"ZoomLevel"), (int) ID_MENU_ZOOMLEVEL);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_ZOOMLEVEL;
+                       index++;
                }
 
                if (__camType == CAMERA_PRIMARY)
@@ -4465,6 +4508,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Frame Rate"), (int) ID_MENU_FRAME_RATE);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_FRAME_RATE;
+                       index++;
                }
 
                if (__camType == CAMERA_PRIMARY)
@@ -4481,6 +4527,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Flip Type"), (int) ID_MENU_FLIP_TYPE);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_FLIP_TYPE;
+                       index++;
                }
 
                if (__camType == CAMERA_PRIMARY)
@@ -4495,17 +4544,26 @@ VideoRecorderForm::CreateSettingPopUp(void)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Recording Resolution"), (int) ID_MENU_RECORDING_RESOLUTION);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_RECORDING_RESOLUTION;
+                       index++;
                }
 
 
                pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Recording Quality"), (int) ID_MENU_RECORDING_QUALITY);
                __pSettingItemArrayList->Add(*pData);
 
+               __elementIdArray[index] = ID_MENU_RECORDING_QUALITY;
+               index++;
+
                r = GetMediaCapability(VIDEORECORDER_VIDEO_CODEC);
                if (r == E_SUCCESS)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Video Codec"), (int) ID_MENU_VIDEO_CODEC);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_VIDEO_CODEC;
+                       index++;
                }
 
                r = GetMediaCapability(VIDEORECORDER_AUDIO_CODEC);
@@ -4513,6 +4571,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Audio Codec"), (int) ID_MENU_AUDIO_CODEC);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_AUDIO_CODEC;
+                       index++;
                }
 
                r = GetMediaCapability(VIDEORECORDER_FORMAT);
@@ -4520,6 +4581,9 @@ VideoRecorderForm::CreateSettingPopUp(void)
                {
                        pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"File Format"), (int) ID_MENU_FILE_FORMAT);
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_FILE_FORMAT;
+                       index++;
                }
 
                if (__camType == CAMERA_PRIMARY)
@@ -4536,16 +4600,25 @@ VideoRecorderForm::CreateSettingPopUp(void)
                        TryCatch(pData != null,  ,"CAMERA_PRIMARY_PREVIEW_FORMAT E_OUT_OF_MEMORY");
 
                        __pSettingItemArrayList->Add(*pData);
+
+                       __elementIdArray[index] = ID_MENU_PREVIEW_FORMAT;
+                       index++;
                }
 
                //Add stream callback
                pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Audio Pre-Processing"), (int) ID_MENU_AUDIO_STREAM_CALLBACK);
                __pSettingItemArrayList->Add(*pData);
 
+               __elementIdArray[index] = ID_MENU_AUDIO_STREAM_CALLBACK;
+               index++;
+
                //Add stream callback
                pData = new (std::nothrow) SettingListData(new (std::nothrow) String(L"Video Pre-Processing"), (int) ID_MENU_VIDEO_STREAM_CALLBACK);
                __pSettingItemArrayList->Add(*pData);
 
+               __elementIdArray[index] = ID_MENU_VIDEO_STREAM_CALLBACK;
+               index++;
+
                r = AddListView(&__pListViewSetting, __pPopupSetting, ID_BUTTON_SETTING_OK);
                TryCatch(r == E_SUCCESS, ,"[%s] AddListView - Settings", GetErrorMessage(r));
 
index 3f8ae91..17f156c 100644 (file)
@@ -39,6 +39,8 @@ typedef enum
        RECORDER_STATE_PAUSE,
 } RecorderFormState;
 
+static const int SETTINGS_MENU_OPTION_COUNT = 20;
+
 class VideoRecorderForm
        : public MultiForm
        , public Tizen::Media::ICameraEventListener
@@ -125,6 +127,7 @@ protected:
        virtual void ProcessAudioStream(Tizen::Media::AudioFrame& frame);
        //IVideoStreamFilter
        virtual void ProcessVideoStream(Tizen::Media::VideoFrame &frame);
+       int GetElementIdForIndex(int index);
 
 private:
        bool CreateEffect(void);
@@ -388,6 +391,7 @@ private:
        int __brightnessSliderValue;
        int __contrastSliderValue;
        int __exposureSliderValue;
+       int __elementIdArray[SETTINGS_MENU_OPTION_COUNT];
 
        bool __backGround;
        bool __previewByCallback;