apply modified CBaseView in application-common 59/38759/2 accepted/tizen/tv/20150429.051823 accepted/tizen/tv/20150429.124014 submit/tizen/20150429.030043 submit/tizen/20150429.043336
authorJehun Lim <jehun.lim@samsung.com>
Tue, 28 Apr 2015 06:30:56 +0000 (15:30 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Tue, 28 Apr 2015 07:43:48 +0000 (16:43 +0900)
Change-Id: Iaca6dc4cc6169d759fae769789343613e70591ef
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
include/FbBaseView.h
include/FbContextView.h
src/views/BaseView/FbBaseView.cpp
src/views/FbContextView.cpp

index f1c25c9..2040fb0 100644 (file)
@@ -31,9 +31,8 @@ public:
        CFbBaseView(const char *szViewId) : CBaseView(szViewId), m(0) {}
        virtual ~CFbBaseView() {}
 
-       virtual bool Create(void *data);
+       virtual bool Create(void *data, Evas_Object *base);
        virtual void Destroy(void);
-       virtual Evas_Object* Base(void);
 
 public:
 
index b08bf85..50cd126 100644 (file)
@@ -62,9 +62,8 @@ public:
        CContextView(const char *szViewId) : CBaseView(szViewId), m(0) {}
        virtual ~CContextView() {}
 
-       virtual bool Create(void *data);
+       virtual bool Create(void *data, Evas_Object *base);
        virtual void Destroy(void);
-       virtual Evas_Object* Base(void);
 };
 
 
index 03bd6c7..182354e 100644 (file)
@@ -345,20 +345,20 @@ void CFbBaseView::UpdateEmptyFocusSequence(void)
        _DBG("");
 
        if (t_SelectedGroupButton() == m->eoBtnGroup[E_GRP_ALL]) {
-               elm_object_part_text_set(m->eoBase, FBR_PART_NO_CONTENT,     _(NO_FILE_MESSAGE));
-               elm_object_part_text_set(m->eoBase, FBR_PART_NO_CONTENT_SUB, _(NO_FILE_MESSAGE_SUB));
+               elm_object_part_text_set(Base(), FBR_PART_NO_CONTENT,     _(NO_FILE_MESSAGE));
+               elm_object_part_text_set(Base(), FBR_PART_NO_CONTENT_SUB, _(NO_FILE_MESSAGE_SUB));
        }
        else if (t_SelectedGroupButton() == m->eoBtnGroup[E_GRP_PHOTO]) {
-               elm_object_part_text_set(m->eoBase, FBR_PART_NO_CONTENT,     _(NO_PHOTO_MESSAGE));
-               elm_object_part_text_set(m->eoBase, FBR_PART_NO_CONTENT_SUB, _(NO_PHOTO_MESSAGE_SUB));
+               elm_object_part_text_set(Base(), FBR_PART_NO_CONTENT,     _(NO_PHOTO_MESSAGE));
+               elm_object_part_text_set(Base(), FBR_PART_NO_CONTENT_SUB, _(NO_PHOTO_MESSAGE_SUB));
        }
        else if (t_SelectedGroupButton() == m->eoBtnGroup[E_GRP_VIDEO]) {
-               elm_object_part_text_set(m->eoBase, FBR_PART_NO_CONTENT,     _(NO_VIDEO_MESSAGE));
-               elm_object_part_text_set(m->eoBase, FBR_PART_NO_CONTENT_SUB, _(NO_VIDEO_MESSAGE_SUB));
+               elm_object_part_text_set(Base(), FBR_PART_NO_CONTENT,     _(NO_VIDEO_MESSAGE));
+               elm_object_part_text_set(Base(), FBR_PART_NO_CONTENT_SUB, _(NO_VIDEO_MESSAGE_SUB));
        }
        else if (t_SelectedGroupButton() == m->eoBtnGroup[E_GRP_MUSIC]) {
-               elm_object_part_text_set(m->eoBase, FBR_PART_NO_CONTENT,     _(NO_MUSIC_MESSAGE));
-               elm_object_part_text_set(m->eoBase, FBR_PART_NO_CONTENT_SUB, _(NO_MUSIC_MESSAGE_SUB));
+               elm_object_part_text_set(Base(), FBR_PART_NO_CONTENT,     _(NO_MUSIC_MESSAGE));
+               elm_object_part_text_set(Base(), FBR_PART_NO_CONTENT_SUB, _(NO_MUSIC_MESSAGE_SUB));
        }
 }
 
@@ -394,8 +394,8 @@ void CFbBaseView::CbLinkApp(int type, int source_type, char *path)
 
 void CFbBaseView::UpdatedGrid(void)
 {
-       elm_object_part_text_set(m->eoBase, FBR_PART_NO_CONTENT, "");
-       elm_object_part_text_set(m->eoBase, FBR_PART_NO_CONTENT_SUB, "");
+       elm_object_part_text_set(Base(), FBR_PART_NO_CONTENT, "");
+       elm_object_part_text_set(Base(), FBR_PART_NO_CONTENT_SUB, "");
 }
 
 void CFbBaseView::t_CreateTopSession(void)
@@ -410,18 +410,18 @@ void CFbBaseView::t_CreateTopSession(void)
        btninfo[TOPBTN_SORT].style = FBR_STYLE_SORT_BTN;
        btninfo[TOPBTN_SORT].part  = FBR_PART_SORT_HOVERSEL;
 
-       elm_object_part_text_set(m->eoBase, FBR_PART_TITLE,
+       elm_object_part_text_set(Base(), FBR_PART_TITLE,
                _(FBR_TEXT_TITLE));
 
        for (i = 0; i < TOTAL_TOP_BTNS; i++) {
-               btn = _add_button(m->eoBase);
+               btn = _add_button(Base());
                if (!btn) {
                        _ERR(" Adding btn failed ");
                        return;
                }
 
                elm_object_style_set(btn, btninfo[i].style);
-               elm_object_part_content_set(m->eoBase, btninfo[i].part, btn);
+               elm_object_part_content_set(Base(), btninfo[i].part, btn);
 
                m->pHandlerButton[i]->Connect(btn);
 
@@ -451,7 +451,7 @@ void CFbBaseView::t_CreateLeftSession(void)
        btninfo[E_GRP_MUSIC].txt = N_("MUSIC");
        btninfo[E_GRP_MUSIC].icon_path = FBR_IMAGE_GRPBTN_MUSIC;
 
-       box = elm_box_add(m->eoBase);
+       box = elm_box_add(Base());
        if (!box)
                return;
        evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -486,7 +486,7 @@ void CFbBaseView::t_CreateLeftSession(void)
 
        elm_object_signal_emit(m->eoBtnGroup[E_GRP_ALL], FBR_SIGNAL_GROUP_SELECTED, "");
        elm_object_focus_set(m->eoBtnGroup[E_GRP_ALL], EINA_TRUE);
-       elm_object_part_content_set(m->eoBase, FBR_PART_GROUPBTN_BOX, box);
+       elm_object_part_content_set(Base(), FBR_PART_GROUPBTN_BOX, box);
 
        elm_object_focus_next_object_set(m->eoBtnGroup[E_GRP_ALL], m->eoBtnGroup[E_GRP_MUSIC], ELM_FOCUS_UP);
        elm_object_focus_next_object_set(m->eoBtnGroup[E_GRP_MUSIC], m->eoBtnGroup[E_GRP_ALL], ELM_FOCUS_DOWN);
@@ -522,7 +522,7 @@ void CFbBaseView::t_OnShow(void)
 {
        _DBG();
 
-       evas_object_show(m->eoBase);
+       evas_object_show(Base());
 
        CBaseView::t_OnShow();
 }
@@ -548,12 +548,12 @@ void CFbBaseView::t_OnUpdate(void *data)
 
 void CFbBaseView::t_OnHide(void)
 {
-       evas_object_hide(m->eoBase);
+       evas_object_hide(Base());
 
        CBaseView::t_OnHide();
 }
 
-bool CFbBaseView::Create(void *data)
+bool CFbBaseView::Create(void *data, Evas_Object *base)
 {
        ASSERT(!m);
 
@@ -630,6 +630,8 @@ bool CFbBaseView::Create(void *data)
        } _CREATE_END_AND_CATCH{ return false; }
 
 
+       CBaseView::Create(NULL, eoBase);
+
        // original create grid
        CInfo::SetSortType(0/*CSort::SORT_NAME_AZ*/);
        evas_object_data_set(eoBase, BASE_VIEW_DATA, this);
@@ -638,7 +640,6 @@ bool CFbBaseView::Create(void *data)
        t_CreateFullView();
        elm_object_focus_allow_set(eoBase, EINA_FALSE);
        m->pHandlerBase->Connect(eoBase);
-       CBaseView::Create(NULL);
        return true;
 }
 
@@ -646,6 +647,10 @@ void CFbBaseView::Destroy(void)
 {
        ASSERT(m);
 
+       m->pHandlerBase->Disconnect(Base());
+
+       evas_object_del(Base());
+
        CBaseView::Destroy();
 
        if(CMediaContentListener::FlagCreate())
@@ -672,28 +677,18 @@ void CFbBaseView::Destroy(void)
        m->pLayoutMgr->Destroy();
        delete m->pLayoutMgr;
 
-       evas_object_del(m->eoBase);
-
        delete m;
        m = NULL;
 }
 
 
-Evas_Object* CFbBaseView::Base(void)
-{
-       ASSERT(m);
-
-       return m->eoBase;
-}
-
-
 void CFbBaseView::OnStatusChanged(SUsbHostDeviceInfo *changedDevice, SUsbHostDeviceStatus status)
 {
        if(status == USB_HOST_DEV_CONNECTED) {
                m->pPopup = new CPopup;
                if (!m->pPopup)
                        return;
-               if (!m->pPopup->Create(m->eoBase)) {
+               if (!m->pPopup->Create(Base())) {
                        delete m->pPopup;
                        m->pPopup = NULL;
                        return;
index 07df956..8ad2e78 100644 (file)
@@ -41,7 +41,6 @@
 
 struct SContextView {
        Evas_Object *eoWin;
-       Evas_Object *eoBase;
        Evas_Object *eoBtnOpen;
        Evas_Object *rel_first[TABLE_MAX_COL];
        Evas_Object *rel_last[TABLE_MAX_COL];
@@ -54,7 +53,6 @@ struct SContextView {
 
        SContextView() {
                eoWin = NULL;
-               eoBase = NULL;
                eoBtnOpen = NULL;
                int a;
                for (a = 0; a < TABLE_MAX_COL; a++) {
@@ -580,7 +578,7 @@ bool CContextView::m_CreateContentApps(Eina_List *list, enum content_app_type ty
        Evas_Object *scroller, *table;
        int r;
 
-       scroller = _add_scroller(m->eoBase);
+       scroller = _add_scroller(Base());
        if (!scroller) {
                _ERR("_add_scroller failed.");
                return false;
@@ -603,10 +601,10 @@ bool CContextView::m_CreateContentApps(Eina_List *list, enum content_app_type ty
        elm_object_content_set(scroller, table);
 
        if (type == APP_LINKED)
-               elm_object_part_content_set(m->eoBase, FBR_PART_CTXT_LINK_AREA,
+               elm_object_part_content_set(Base(), FBR_PART_CTXT_LINK_AREA,
                scroller);
        else
-               elm_object_part_content_set(m->eoBase, FBR_PART_CTXT_REL_AREA,
+               elm_object_part_content_set(Base(), FBR_PART_CTXT_REL_AREA,
                scroller);
 
        return true;
@@ -616,7 +614,7 @@ bool CContextView::m_CreateContentApps(Eina_List *list, enum content_app_type ty
 bool CContextView::m_CreateBtnsPart(void)
 {
        Evas_Object *btn, *box;
-       box = _add_btnbox(m->eoBase);
+       box = _add_btnbox(Base());
        if (!box)
                return false;
 
@@ -637,7 +635,7 @@ bool CContextView::m_CreateBtnsPart(void)
 
        m->pHandlerButton->Connect(m->eoBtnOpen);
 
-       elm_object_part_content_set(m->eoBase, FBR_PART_CTXT_BTNAREA, box);
+       elm_object_part_content_set(Base(), FBR_PART_CTXT_BTNAREA, box);
 
        return true;
 }
@@ -663,40 +661,40 @@ bool CContextView::m_CreateInfoPart(void)
        type = m->finfo->Type();
        if (!path) {
                if (type == E_GRP_PHOTO) {
-                       img = _get_icon(m->eoBase, m->finfo);
+                       img = _get_icon(Base(), m->finfo);
                        if (!img)
                                goto finish;
                } else {
-                       img = elm_image_add(m->eoBase);
+                       img = elm_image_add(Base());
                        if (!img)
                                goto finish;
                        _set_default_thumb(img, type);
                }
        } else {
-               img = elm_image_add(m->eoBase);
+               img = elm_image_add(Base());
                if (!img)
                        goto finish;
                elm_image_file_set(img, path, NULL);
                elm_image_aspect_fixed_set(img, EINA_FALSE);
        }
 
-       elm_object_part_content_set(m->eoBase, FBR_PART_CTXT_ICON, img);
+       elm_object_part_content_set(Base(), FBR_PART_CTXT_ICON, img);
 
-       lbl = _create_lbl(m->eoBase, title);
+       lbl = _create_lbl(Base(), title);
        if (lbl) {
-               elm_object_part_content_set(m->eoBase, FBR_PART_CTXT_TITLE, lbl);
+               elm_object_part_content_set(Base(), FBR_PART_CTXT_TITLE, lbl);
                _lbl_start_slide(lbl);
        }
 
-       elm_object_part_text_set(m->eoBase, FBR_PART_CTXT_SUBTITLE,  subtitle);
-       elm_object_part_text_set(m->eoBase, FBR_PART_CTXT_SUBTITLE2, subtitle2);
+       elm_object_part_text_set(Base(), FBR_PART_CTXT_SUBTITLE,  subtitle);
+       elm_object_part_text_set(Base(), FBR_PART_CTXT_SUBTITLE2, subtitle2);
 
-       elm_object_part_text_set(m->eoBase, FBR_PART_CTXT_LINK_TEXT, _(FBR_TEXT_LINK));
+       elm_object_part_text_set(Base(), FBR_PART_CTXT_LINK_TEXT, _(FBR_TEXT_LINK));
        linkapplist = CDummyContent::ListLinkApp(type);
        if (linkapplist)
                m_CreateContentApps(linkapplist, APP_LINKED);
 
-       elm_object_part_text_set(m->eoBase, FBR_PART_CTXT_REL_TEXT, _(FBR_TEXT_REL));
+       elm_object_part_text_set(Base(), FBR_PART_CTXT_REL_TEXT, _(FBR_TEXT_REL));
        rltvlist = CDummyContent::ListRelative(type);
        if (rltvlist)
                m_CreateContentApps(rltvlist, APP_OTHER);
@@ -727,15 +725,15 @@ void CContextView::sm_CbKeyPressed(void *dt, Evas *e, Evas_Object *obj, void *ei
 
 void CContextView::t_OnShow(void)
 {
-       evas_object_show(m->eoBase);
+       evas_object_show(Base());
 }
 
 void CContextView::t_OnHide(void)
 {
-       evas_object_hide(m->eoBase);
+       evas_object_hide(Base());
 }
 
-bool CContextView::Create(void *data)
+bool CContextView::Create(void *data, Evas_Object *base)
 {
        ASSERT(!m);
 
@@ -747,7 +745,8 @@ bool CContextView::Create(void *data)
                _CHECK(m = new SContextView)
                _CHECK(eoBase = elm_layout_add(eoWin))
                _CHECK(elm_layout_file_set(eoBase, EDJEFILE, FBR_CONTEXT_VIEW))
-               _COMMAND{ m->eoWin = eoWin; m->eoBase = eoBase; m->finfo = (CExtNameInfo*)data; }
+               _COMMAND{ m->eoWin = eoWin; m->finfo = (CExtNameInfo*)data; }
+               _CHECK(CBaseView::Create(NULL, eoBase))
                _CHECK(m_CreateInfoPart())
                _CHECK(m_CreateBtnsPart())
 
@@ -757,6 +756,7 @@ bool CContextView::Create(void *data)
 
                _CHECK_FAIL{ /* m_CreateBtnsPart */ }
                _CHECK_FAIL{ /* m_CreateInfoPart */ }
+               _CHECK_FAIL{ CBaseView::Destroy(); }
                _CHECK_FAIL{}
                _CHECK_FAIL{ evas_object_del(eoBase);  }
                _CHECK_FAIL{ delete m; m = NULL; }
@@ -769,14 +769,10 @@ void CContextView::Destroy(void)
 {
        ASSERT(m);
 
-       evas_object_del(m->eoBase);
-       delete m;
-       m = NULL;
-}
+       evas_object_del(Base());
 
-Evas_Object* CContextView::Base(void)
-{
-       ASSERT(m);
+       CBaseView::Destroy();
 
-       return m->eoBase;
+       delete m;
+       m = NULL;
 }