Apply changed Sort method 68/35168/1 submit/tizen_tv/20150210.071548
authorJuWan Kim <juwan.kim@samsung.com>
Tue, 10 Feb 2015 07:13:43 +0000 (16:13 +0900)
committerJuWan Kim <juwan.kim@samsung.com>
Tue, 10 Feb 2015 07:13:43 +0000 (16:13 +0900)
Change-Id: I8cd6c4ae83241a0e63bb6fd91fc1a1748fcc30d5
Signed-off-by: JuWan Kim <juwan.kim@samsung.com>
include/define.h
src/layouts/FbAllLayout.cpp
src/views/BaseView/FbBaseView.cpp
src/views/BaseView/FileGrid.cpp
src/views/BaseView/Info.h

index 671a7f7..1bc938d 100644 (file)
 #define __DEFINE_H__
 
 /* LAYOUT */
-#define FB_BASE_LAYOUT         "FB_BASE_LAYOUT"
+//#define FB_BASE_LAYOUT               "FB_BASE_LAYOUT"
+#define FB_ALL_LAYOUT          "FB_ALL_LAYOUT"
+#define FB_PHOTO_LAYOUT                "FB_PHOTO_LAYOUT"
+#define FB_VIDEO_LAYOUT                "FB_VIDEO_LAYOUT"
+#define FB_MUSIC_LAYOUT                "FB_MUSIC_LAYOUT"
 
 /* TEXT */
 #define NO_FILE_MESSAGE                "No File"
index 79942f0..2575eb7 100644 (file)
@@ -126,7 +126,7 @@ bool CFbAllLayout::Create(CLayoutMgr *mgr, void *data)
                _CHECK(m->eoBase = m->pLayoutMgr->Base())
                _CHECK(m->eoWin = m->pViewMgr->Window())
                _CHECK(layout = elm_layout_add(m->eoBase))
-               _CHECK(elm_layout_file_set(layout, EDJEFILE, FB_BASE_LAYOUT))
+               _CHECK(elm_layout_file_set(layout, EDJEFILE, FB_ALL_LAYOUT))
                _CHECK(t_CreateFileGrid(layout))
                _COMMAND{ elm_object_part_content_set(m->eoBase, FBR_PART_CONTENT, layout); }
                _CHECK(CBaseLayout::Create(layout))
index bfd7c2c..4d7caf4 100644 (file)
@@ -27,7 +27,6 @@
 #include "dbg.h"
 #include <MediaContentDbListener.h>
 #include <UsbConnectionListener.h>
-#include "SortName.h"
 #include "Popup.h"
 #include "InputHandler.h"
 
@@ -91,6 +90,12 @@ struct SFbBaseView {
 
        CLayoutMgr    *pLayoutMgr;
        CFbAllLayout *pFbAllLayout;
+#if 0
+       CBaseLayout    *pCurrentLayout;
+       CFbPhotoLayout *pFbPhotoLayout;
+       CFbMusicLayout *pFbMusicLayout;
+       CFbVideoLayout *pFbVideoLayout;
+#endif
 
        SFbBaseView() {
                int a;
@@ -125,6 +130,7 @@ struct SFbBaseView {
                        else if (!strcmp(ev->keyname, KEY_ENTER)) {
                                if (elm_object_focus_get(m->eoSelectedBtnGroup)) {
                                        m->pFbAllLayout->SetFocus(EINA_TRUE);
+                                       // TODO: Each layout SetFocus???
                                }
                        }
                }
@@ -144,12 +150,20 @@ struct SFbBaseView {
                        switch (instance->Type()) {
                        case CCtxPopup::TOPBTN_SORT:
                                elm_object_text_set(m->eoBtnSort, text);
+#if 1
                                m->pFbAllLayout->Update(true);
+#else
+                               m->pCurrentLayout->Update(true);
+#endif
                                break;
 
                        case CCtxPopup::TOPBTN_SOURCE:
                                elm_object_text_set(m->eoBtnSource, text);
+#if 1
                                m->pFbAllLayout->Update(false);
+#else
+                               m->pCurrentLayout->Update(true);
+#endif
                                break;
 
                        default:
@@ -211,7 +225,30 @@ struct SFbBaseView {
                        m->eoSelectedBtnGroup = obj;
                        elm_object_signal_emit(m->eoSelectedBtnGroup, FBR_SIGNAL_GROUP_SELECTED, "");
 
+#if 1
                        m->pFbAllLayout->Update(false);
+                       // TODO: not update, it should be "Show" as each layout
+#else
+                       switch(id)
+                       {
+                               case E_GRP_ALL:
+                                       m->pFbAllLayout->Update(false);
+                                       break;
+                               case E_GRP_PHOTO:
+                                       m->pFbPhotoLayout->Update(false);
+                                       break;
+                               case E_GRP_VIDEO:
+                                       m->pFbVideoLayout->Update(false);
+                                       break;
+                               case E_GRP_MUSIC:
+                                       m->pFbMusicLayout->Update(false);
+                                       break;
+                               default:
+                                       _DBG("Fix it: it can not make it , MouseClicked");
+                                       break;
+
+                       }
+#endif
                }
        } *pHandlerGroup[TOTAL_GROUP_BTNS];
 };
@@ -388,7 +425,8 @@ void CFbBaseView::t_CreateLeftSession(void)
                elm_object_style_set(m->eoBtnGroup[i], FBR_STYLE_GROUPBTN);
                elm_object_text_set(m->eoBtnGroup[i], _(btninfo[i].txt));
                
-               m->pHandlerGroup[i]->Connect(m->eoBtnGroup[i]);
+               m->pHandlerGroup[i]->Connect(m->eoBtnGroup[i], i);
+
                ic = elm_image_add(m->eoBtnGroup[i]);
                if (!ic)
                        continue;
@@ -496,7 +534,7 @@ bool CFbBaseView::Create(void *data)
                }
                _CHECK(m->pLayoutMgr = new CLayoutMgr)
                _CHECK(m->pLayoutMgr->Create(eoBase, NULL))
-               _CHECK(m->pFbAllLayout = new CFbAllLayout(FB_BASE_LAYOUT))
+               _CHECK(m->pFbAllLayout = new CFbAllLayout(FB_ALL_LAYOUT))
                _CHECK(m->pFbAllLayout->Create(m->pLayoutMgr, NULL))
                _CHECK(m->pLayoutMgr->AddLayout(m->pFbAllLayout))
                _CHECK(CUsbConnectionListener::Create())
@@ -516,7 +554,7 @@ bool CFbBaseView::Create(void *data)
 
 
        // original create grid
-       m->pLayoutMgr->Show(FB_BASE_LAYOUT);
+       m->pLayoutMgr->Show(FB_ALL_LAYOUT);
        CInfo::SetSortType(0/*CSort::SORT_NAME_AZ*/);
        evas_object_data_set(eoBase, BASE_VIEW_DATA, this);
        t_CreateFullView();
index 3c2fd80..438e119 100644 (file)
@@ -26,7 +26,8 @@
 #include <AppCommon.h>
 #include "Mediadata.h"
 #include "ExtNameInfo.h"
-#include "SortName.h"
+#include <Sort.h>
+#include <SortMgr.h>
 #include "GengridItemClass.h"
 #include "InputHandler.h"
 #include "FileGrid.h"
@@ -287,7 +288,34 @@ void CFileGrid::t_Update(char *fid, bool sort_flag)
                else
                        m_GetFolderList();
        }
-       m->elFile = CSortName::Sort(m->elFile, (CSortName::ESort)CInfo::SortType());
+       
+       const char* sortType;
+       switch(CInfo::SortType())
+       {
+               case 0:
+                       sortType = SORT_BY_NAME_AZ;
+                       break;
+               case 1:
+                       sortType = SORT_BY_NAME_ZA;
+                       break;
+               case 2:
+                       sortType = SORT_BY_DATE_ASC;
+                       break;
+               case 3:
+                       sortType = SORT_BY_DATE_DES;
+                       break;
+               case 4:
+                       sortType = SORT_BY_SIZE_ASC;
+                       break;
+               case 5:
+                       sortType = SORT_BY_SIZE_DES;
+                       break;
+               default:
+                       _DBG("Fix your code : sortType is invalid");
+                       sortType = SORT_BY_NAME_AZ;
+                       break;
+       }
+       m->elFile = CSort::Sort(m->elFile, sortType);
        t_Fill();
 
        if (fid)    // folder
index 327a427..59b73c8 100644 (file)
@@ -16,4 +16,4 @@ public:
 };
 
 
-#endif /* __INFO_H__ */
\ No newline at end of file
+#endif /* __INFO_H__ */