From 676726a7652bc9b28a29456e83020f18d156ed11 Mon Sep 17 00:00:00 2001 From: Janusz Majnert Date: Tue, 11 Aug 2015 10:44:06 +0200 Subject: [PATCH 01/16] Refactored HistoryUI service [Issue#] https://bugs.tizen.org/jira/browse/TT-72 [Problem] Lots of style fixes, several fixes for build warnings [Cause] n/a [Solution] Reformat code, fix casting and remove unused variables [Verify] 1. Check that there are no build problems caused by this change 2. Run the browser and explore the history ui to see if nothing got broken List of changes: * tabs -> spaces * proper indentation * other minor style fixes * removing unused variables' declarations * renaming a few class members to better express their use * replacing reinterpret_cast with static_cast where appropriate * adding null-checks in callback functions * replacing deprecated Elementary API call with its successor Change-Id: Id2c4c020573138d641a8e6a676942830a6505ab5 --- services/HistoryUI/HistoryUI.cpp | 367 +++++++++++++++++---------------------- services/HistoryUI/HistoryUI.h | 28 +-- 2 files changed, 171 insertions(+), 224 deletions(-) diff --git a/services/HistoryUI/HistoryUI.cpp b/services/HistoryUI/HistoryUI.cpp index be63ad0..c2724da 100644 --- a/services/HistoryUI/HistoryUI.cpp +++ b/services/HistoryUI/HistoryUI.cpp @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include "HistoryUI.h" @@ -33,43 +35,41 @@ EXPORT_SERVICE(HistoryUI, "org.tizen.browser.historyui") typedef struct _HistoryItemData { - std::shared_ptr item; - std::shared_ptr historyUI; + std::shared_ptr item; + std::shared_ptr historyUI; } HistoryItemData; struct ItemData{ - tizen_browser::base_ui::HistoryUI* historyUI; - Elm_Object_Item * e_item; + tizen_browser::base_ui::HistoryUI* historyUI; + Elm_Object_Item * e_item; }; -static std::vector m_history_item_data; +static std::vector _history_item_data; -#define efl_scale (elm_config_scale_get() / elm_app_base_scale_get()) HistoryUI::HistoryUI() - : m_gengrid(NULL) - , m_parent(NULL) - , m_item_class(NULL) - , m_gengridSetup(false) - , m_history_layout(NULL) - , m_historyitem_layout(NULL) - , m_genListActionBar(NULL) - , m_genListToday(NULL) - , m_itemClassToday(NULL) + : m_history_layout(nullptr) + , m_genListActionBar(nullptr) + , m_genListToday(nullptr) + , m_itemClassToday(nullptr) + , m_gengrid(nullptr) + , m_parent(nullptr) + , m_item_class(nullptr) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - edjFilePath = EDJE_DIR; - edjFilePath.append("HistoryUI/History.edj"); + m_edjFilePath = EDJE_DIR; + m_edjFilePath.append("HistoryUI/History.edj"); } HistoryUI::~HistoryUI() { + } void HistoryUI::show(Evas_Object* parent) { - elm_theme_extension_add(NULL, edjFilePath.c_str()); + elm_theme_extension_add(nullptr, m_edjFilePath.c_str()); m_history_layout = elm_layout_add(parent); - elm_layout_file_set(m_history_layout, edjFilePath.c_str(), "history-layout"); + elm_layout_file_set(m_history_layout, m_edjFilePath.c_str(), "history-layout"); evas_object_size_hint_weight_set(m_history_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(m_history_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(m_history_layout); @@ -79,41 +79,36 @@ void HistoryUI::show(Evas_Object* parent) m_gengrid = elm_gengrid_add(m_history_layout); elm_object_part_content_set(m_history_layout, "history_gengird", m_gengrid); - /*evas_object_smart_callback_add(m_gengrid, "item,focused", focusItem, NULL); - evas_object_smart_callback_add(m_gengrid, "item,unfocused", unFocusItem, NULL); - evas_object_smart_callback_add(m_gengrid, "activated", _itemSelected, this);*/ - - if (!m_item_class) { - m_item_class = elm_gengrid_item_class_new(); - m_item_class->item_style = "history_item"; - m_item_class->func.text_get = _grid_text_get; - m_item_class->func.content_get = _history_grid_content_get; - m_item_class->func.state_get = NULL; - m_item_class->func.del = NULL; - } + if (!m_item_class) { + m_item_class = elm_gengrid_item_class_new(); + m_item_class->item_style = "history_item"; + m_item_class->func.text_get = _grid_text_get; + m_item_class->func.content_get = _history_grid_content_get; + m_item_class->func.state_get = nullptr; + m_item_class->func.del = nullptr; + } - M_ASSERT(m_parent); - elm_gengrid_align_set(m_gengrid, 0, 0); - elm_gengrid_select_mode_set(m_gengrid, ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_gengrid_multi_select_set(m_gengrid, EINA_FALSE); - elm_gengrid_horizontal_set(m_gengrid, EINA_TRUE); - elm_gengrid_highlight_mode_set(m_gengrid, EINA_TRUE); - elm_scroller_policy_set(m_gengrid, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON); - elm_scroller_page_size_set(m_gengrid, 0, 580); + elm_gengrid_align_set(m_gengrid, 0, 0); + elm_gengrid_select_mode_set(m_gengrid, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_gengrid_multi_select_set(m_gengrid, EINA_FALSE); + elm_gengrid_horizontal_set(m_gengrid, EINA_TRUE); + elm_gengrid_highlight_mode_set(m_gengrid, EINA_TRUE); + elm_scroller_policy_set(m_gengrid, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON); + elm_scroller_page_size_set(m_gengrid, 0, 580); - evas_object_size_hint_weight_set(m_gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(m_gengrid, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(m_gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(m_gengrid, EVAS_HINT_FILL, EVAS_HINT_FILL); + double efl_scale = elm_config_scale_get() / elm_app_base_scale_get(); elm_gengrid_item_size_set(m_gengrid, 580 * efl_scale, 580 * efl_scale); addItems(); - } void HistoryUI::showActionBar() { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - elm_theme_extension_add(NULL, edjFilePath.c_str()); + elm_theme_extension_add(nullptr, m_edjFilePath.c_str()); m_genListActionBar = elm_genlist_add(m_history_layout); elm_object_part_content_set(m_history_layout, "action_bar_history_genlist", m_genListActionBar); elm_genlist_homogeneous_set(m_genListActionBar, EINA_FALSE); @@ -125,98 +120,106 @@ void HistoryUI::showActionBar() m_itemClassActionBar = elm_genlist_item_class_new(); m_itemClassActionBar->item_style = "action_bar_history_items"; - m_itemClassActionBar->func.text_get = NULL; // &listTopItemTextGet; - m_itemClassActionBar->func.content_get = &listActionBarContentGet; - m_itemClassActionBar->func.state_get = 0; - m_itemClassActionBar->func.del = 0; + m_itemClassActionBar->func.text_get = nullptr; // &listTopItemTextGet; + m_itemClassActionBar->func.content_get = &_listActionBarContentGet; + m_itemClassActionBar->func.state_get = nullptr; + m_itemClassActionBar->func.del = nullptr; - ItemData * id = new ItemData; + ItemData *id = new ItemData; id->historyUI = this; - Elm_Object_Item* elmItem = elm_genlist_item_append(m_genListActionBar, //genlist - m_itemClassActionBar, //item Class - id, - NULL, //parent item - ELM_GENLIST_ITEM_NONE,//item type - NULL, - NULL //data passed to above function - ); + Elm_Object_Item *elmItem = elm_genlist_item_append(m_genListActionBar, //genlist + m_itemClassActionBar, //item Class + id, + nullptr, //parent item + ELM_GENLIST_ITEM_NONE, //item type + nullptr, + nullptr //data passed to above function + ); id->e_item = elmItem; - ItemData * id2 = new ItemData; + ItemData *id2 = new ItemData; id2->historyUI = this; - Elm_Object_Item* elmItem2 = elm_genlist_item_append(m_genListActionBar, //genlist - m_itemClassActionBar, //item Class - id2, - NULL, //parent item - ELM_GENLIST_ITEM_NONE,//item type - NULL, - NULL //data passed to above function - ); + Elm_Object_Item *elmItem2 = elm_genlist_item_append(m_genListActionBar, //genlist + m_itemClassActionBar, //item Class + id2, + nullptr, //parent item + ELM_GENLIST_ITEM_NONE, //item type + nullptr, + nullptr //data passed to above function + ); id2->e_item = elmItem2; } -Evas_Object* HistoryUI::listActionBarContentGet(void* data, Evas_Object* obj , const char* part) +Evas_Object* HistoryUI::_listActionBarContentGet(void* data, Evas_Object* obj , const char* part) { - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - if(!strcmp(part, "clearhistory_click")) - { - Evas_Object *clearHistoryButton = elm_button_add(obj); - elm_object_style_set(clearHistoryButton, "history_button"); - evas_object_smart_callback_add(clearHistoryButton, "clicked", tizen_browser::base_ui::HistoryUI::_clearhistory_clicked, data); - return clearHistoryButton; + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (obj && part) { + const char *part_name1 = "clearhistory_click"; + static const int part_name1_len = strlen(part_name1); + const char *part_name2 = "close_click"; + static const int part_name2_len = strlen(part_name2); + + if (!strncmp(part_name1, part, part_name1_len)) { + Evas_Object *clearHistoryButton = elm_button_add(obj); + elm_object_style_set(clearHistoryButton, "history_button"); + evas_object_smart_callback_add(clearHistoryButton, "clicked", tizen_browser::base_ui::HistoryUI::_clearhistory_clicked, data); + return clearHistoryButton; + } + if (!strncmp(part_name2, part, part_name2_len)) { + Evas_Object *close_click = elm_button_add(obj); + elm_object_style_set(close_click, "history_button"); + evas_object_smart_callback_add(close_click, "clicked", HistoryUI::_close_clicked_cb, data); + return close_click; } - else if(!strcmp(part, "close_click")) - { - Evas_Object *close_click = elm_button_add(obj); - elm_object_style_set(close_click, "history_button"); - evas_object_smart_callback_add(close_click, "clicked", HistoryUI::close_clicked_cb, data); - return close_click; - } - - return NULL; + } + return nullptr; } -void HistoryUI::close_clicked_cb(void * data, Evas_Object * /* obj */, void * event_info) +void HistoryUI::_close_clicked_cb(void * data, Evas_Object*, void*) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - ItemData * id = static_cast(data); - id->historyUI->closeHistoryUIClicked(std::string()); - id->historyUI->clearItems(); -} + if (data) { + ItemData *id = static_cast(data); + id->historyUI->closeHistoryUIClicked(std::string()); + id->historyUI->clearItems(); + } +} -char* HistoryUI::listTodayTextGet(void* data, Evas_Object* obj , const char* part) +char* HistoryUI::_listTodayTextGet(void* data, Evas_Object*, const char* part) { - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - HistoryItemData * id = static_cast(data); - if(!strcmp(part, "history_url_text")) - { - if(!id->item->getUrl().empty()){ - std::string str = id->item->getTitle() + " - " + id->item->getUrl(); - return strdup(str.c_str()); + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (data) { + HistoryItemData *id = static_cast(data); + const char *part_name = "history_url_text"; + static const int part_name_len = strlen(part_name); + + if (!strncmp(part_name, part, part_name_len)) { + if (!id->item->getUrl().empty()) { + std::string str = id->item->getTitle() + " - " + id->item->getUrl(); + return strdup(str.c_str()); + } } } - return NULL; + return nullptr; } -void HistoryUI::_clearhistory_clicked(void * data, Evas_Object * /* obj */, void * event_info) +void HistoryUI::_clearhistory_clicked(void*, Evas_Object*, void*) { - /* - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - ItemData* itemData = reinterpret_cast(data); - itemData->tabUI->clearItems(); - itemData->tabUI->newTabClicked(std::string()); - */ + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); +// ItemData *itemData = static_cast(data); +// itemData->tabUI->clearItems(); +// itemData->tabUI->newTabClicked(std::string()); } void HistoryUI::addItems() { - BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); - for (size_t i = 0; i < 1; i++) { - HistoryItemData *itemData = new HistoryItemData(); - itemData->historyUI = std::shared_ptr(this); - Elm_Object_Item* historyView = elm_gengrid_item_append(m_gengrid, m_item_class, itemData, NULL, this); - elm_gengrid_item_selected_set(historyView, EINA_FALSE); - } - BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); + BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); + for (size_t i = 0; i < 1; i++) { + HistoryItemData *itemData = new HistoryItemData(); + itemData->historyUI = std::shared_ptr(this); + Elm_Object_Item* historyView = elm_gengrid_item_append(m_gengrid, m_item_class, itemData, nullptr, this); + elm_gengrid_item_selected_set(historyView, EINA_FALSE); + } + BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); } void HistoryUI::addHistoryItem(std::shared_ptr hi) @@ -225,68 +228,71 @@ void HistoryUI::addHistoryItem(std::shared_ptritem = hi; itemData->historyUI = std::shared_ptr(this); - m_history_item_data.push_back(itemData); + _history_item_data.push_back(itemData); setEmptyGengrid(false); } void HistoryUI::addHistoryItems(std::vector > items) { BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); - m_history_item_data.clear(); + _history_item_data.clear(); for (auto it = items.begin(); it != items.end(); ++it) - addHistoryItem(*it); + addHistoryItem(*it); } -char* HistoryUI::_grid_text_get(void *data, Evas_Object *obj, const char *part) +char* HistoryUI::_grid_text_get(void*, Evas_Object*, const char *part) { BROWSER_LOGD("%s:%d %s part=%s", __FILE__, __LINE__, __func__, part); - HistoryItemData *itemData = reinterpret_cast(data); - const char* item_name = NULL; - if (!strcmp(part, "menu_label")) { - item_name = "Today"; - return strdup(item_name); + const char* part_name = "menu_label"; + static const int part_name_len = strlen(part_name); + + if (!strncmp(part_name, part, part_name_len)) { + return strdup("Today"); } - return NULL; + return nullptr; } -Evas_Object * HistoryUI::_history_grid_content_get(void *data, Evas_Object *obj, const char *part) +Evas_Object * HistoryUI::_history_grid_content_get(void *data, Evas_Object*, const char *part) { BROWSER_LOGD("[%s:%d] part : %s", __PRETTY_FUNCTION__, __LINE__, part); - HistoryItemData * id = static_cast(data); - if(!strcmp(part, "history_genlist")) - { - id->historyUI->m_genListToday = elm_genlist_add(id->historyUI->m_history_layout); - - elm_genlist_homogeneous_set(id->historyUI->m_genListToday, EINA_FALSE); - elm_genlist_multi_select_set(id->historyUI->m_genListToday, EINA_FALSE); - elm_genlist_select_mode_set(id->historyUI->m_genListToday, ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_genlist_mode_set(id->historyUI->m_genListToday, ELM_LIST_LIMIT); - elm_genlist_decorate_mode_set(id->historyUI->m_genListToday, EINA_TRUE); - evas_object_size_hint_weight_set(id->historyUI->m_genListToday, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - id->historyUI->m_itemClassToday = elm_genlist_item_class_new(); - id->historyUI->m_itemClassToday->item_style = "history_url_items"; - id->historyUI->m_itemClassToday->func.text_get = &listTodayTextGet; - id->historyUI->m_itemClassToday->func.content_get = NULL; - id->historyUI->m_itemClassToday->func.state_get = 0; - id->historyUI->m_itemClassToday->func.del = 0; - - for(auto it = m_history_item_data.begin(); it != m_history_item_data.end(); it++) { - Elm_Object_Item* historyView = elm_genlist_item_append(id->historyUI->m_genListToday, id->historyUI->m_itemClassToday, *it, NULL, ELM_GENLIST_ITEM_NONE, NULL, id->historyUI.get()); - id->historyUI->m_map_history_views.insert(std::pair((*it)->item->getUrl(), historyView)); - } - - return id->historyUI->m_genListToday; + if (data && part) { + HistoryItemData *id = static_cast(data); + const char *part_name = "history_genlist"; + static const int part_name_len = strlen(part_name); + + if(!strncmp(part_name, part, part_name_len)) { + id->historyUI->m_genListToday = elm_genlist_add(id->historyUI->m_history_layout); + + elm_genlist_homogeneous_set(id->historyUI->m_genListToday, EINA_FALSE); + elm_genlist_multi_select_set(id->historyUI->m_genListToday, EINA_FALSE); + elm_genlist_select_mode_set(id->historyUI->m_genListToday, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_genlist_mode_set(id->historyUI->m_genListToday, ELM_LIST_LIMIT); + elm_genlist_decorate_mode_set(id->historyUI->m_genListToday, EINA_TRUE); + evas_object_size_hint_weight_set(id->historyUI->m_genListToday, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + id->historyUI->m_itemClassToday = elm_genlist_item_class_new(); + id->historyUI->m_itemClassToday->item_style = "history_url_items"; + id->historyUI->m_itemClassToday->func.text_get = &_listTodayTextGet; + id->historyUI->m_itemClassToday->func.content_get = nullptr; + id->historyUI->m_itemClassToday->func.state_get = nullptr; + id->historyUI->m_itemClassToday->func.del = nullptr; + + for(auto it = _history_item_data.begin(); it != _history_item_data.end(); it++) { + Elm_Object_Item* historyView = elm_genlist_item_append(id->historyUI->m_genListToday, id->historyUI->m_itemClassToday, *it, nullptr, ELM_GENLIST_ITEM_NONE, nullptr, id->historyUI.get()); + id->historyUI->m_map_history_views.insert(std::pair((*it)->item->getUrl(), historyView)); + } + + return id->historyUI->m_genListToday; + } } - return NULL; + return nullptr; } void HistoryUI::removeHistoryItem(const std::string& uri) { BROWSER_LOGD("[%s] uri=%s", __func__, uri.c_str()); - if(m_map_history_views.find(uri) == m_map_history_views.end()) { + if(m_map_history_views.find(uri) == m_map_history_views.end()) return; - } Elm_Object_Item* historyView = m_map_history_views.at(uri); elm_object_item_del(historyView); @@ -295,34 +301,9 @@ void HistoryUI::removeHistoryItem(const std::string& uri) setEmptyGengrid(0 == m_map_history_views.size()); } -void HistoryUI::_item_deleted(void * /* data */, Evas_Object * /* obj */) -{ - -} - -void HistoryUI::_itemSelected(void * data, Evas_Object * /* obj */, void * event_info) -{ - Elm_Object_Item * selected = reinterpret_cast(event_info); - HistoryItemData * itemData = reinterpret_cast(elm_object_item_data_get(selected)); - HistoryUI * self = reinterpret_cast(data); - - self->historyItemClicked(itemData->item); -} - -void HistoryUI::_deleteHistory(void *data, Evas_Object * /* obj */, void * /* event_info */) -{ - HistoryItemData * itemData = reinterpret_cast(data); - //itemData->historysUI->historyDeleteClicked(itemData->item); -} - -void HistoryUI::_thumbSelected(void * data, Evas_Object * /* obj */, void * /* event_info */) -{ - HistoryItemData * itemData = reinterpret_cast(data); - // itemData->historysUI->historyClicked(itemData->item); -} - -Evas_Object* HistoryUI::createNoHistorysLabel() +Evas_Object* HistoryUI::createNoHistoryLabel() { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); Evas_Object *label = elm_label_add(m_parent); elm_object_text_set(label, "No favorite websites."); evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -332,11 +313,9 @@ Evas_Object* HistoryUI::createNoHistorysLabel() void HistoryUI::setEmptyGengrid(bool setEmpty) { - if(setEmpty) { - elm_object_part_content_set(m_gengrid, "elm.swallow.empty", createNoHistorysLabel()); - } else { - elm_object_part_content_set(m_gengrid, "elm.swallow.empty", NULL); - } + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + Evas_Object *obj = (setEmpty ? createNoHistoryLabel() : nullptr); + elm_object_part_content_set(m_gengrid, "elm.swallow.empty", obj); } void HistoryUI::hide() @@ -350,35 +329,15 @@ void HistoryUI::hide() void HistoryUI::clearItems() { - hide(); BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + hide(); elm_genlist_clear(m_genListToday); elm_gengrid_clear(m_gengrid); elm_genlist_clear(m_genListActionBar); m_map_history_views.clear(); - m_history_item_data.clear(); + _history_item_data.clear(); setEmptyGengrid(true); } -void HistoryUI::focusItem(void* /*data*/, Evas_Object* /*obj*/, void* event_info) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - Elm_Object_Item *item = reinterpret_cast(event_info); - elm_object_item_signal_emit( item, "mouse,in", "over2"); - - // selected manually - elm_gengrid_item_selected_set(item, EINA_TRUE); -} - -void HistoryUI::unFocusItem(void* /*data*/, Evas_Object* /*obj*/, void* event_info) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - Elm_Object_Item *item = reinterpret_cast(event_info); - elm_object_item_signal_emit( item, "mouse,out", "over2"); - - // unselected manually - elm_gengrid_item_selected_set(item, EINA_FALSE); -} - } } diff --git a/services/HistoryUI/HistoryUI.h b/services/HistoryUI/HistoryUI.h index 89c26a3..20bcc53 100644 --- a/services/HistoryUI/HistoryUI.h +++ b/services/HistoryUI/HistoryUI.h @@ -30,8 +30,8 @@ namespace tizen_browser{ namespace base_ui{ class BROWSER_EXPORT HistoryUI - : public tizen_browser::interfaces::AbstractUIComponent - , public tizen_browser::core::AbstractService + : public tizen_browser::interfaces::AbstractUIComponent + , public tizen_browser::core::AbstractService { public: HistoryUI(); @@ -53,21 +53,14 @@ private: static char* _grid_text_get(void *data, Evas_Object *obj, const char *part); static Evas_Object * _history_grid_content_get(void *data, Evas_Object *obj, const char *part); static Evas_Object * _grid_content_get(void *data, Evas_Object *obj, const char *part); - static Evas_Object* listActionBarContentGet(void *data, Evas_Object *obj, const char *part); - static Evas_Object* listTodayContentGet(void *data, Evas_Object *obj, const char *part); - static void _itemSelected(void * data, Evas_Object * obj, void * event_info); - static void _item_deleted(void *data, Evas_Object *obj); - static void _thumbSelected(void * data, Evas_Object * obj, void * event_info); - static void _deleteHistory(void *data, Evas_Object *obj, void *event_info); + static Evas_Object* _listActionBarContentGet(void *data, Evas_Object *obj, const char *part); static void _clearhistory_clicked(void *data, Evas_Object *obj, void *event_info); + static char* _listTodayTextGet(void* data, Evas_Object* obj , const char* part); + static void _close_clicked_cb(void *data, Evas_Object *obj, void *event_info); + void setEmptyGengrid(bool setEmpty); - static char* listTodayTextGet(void* data, Evas_Object* obj , const char* part); - static void close_clicked_cb(void *data, Evas_Object *obj, void *event_info); -private: - Evas_Object *m_history_layout; - Evas_Object *m_historyitem_layout; Evas_Object *m_genListActionBar; Evas_Object *m_genListToday; Elm_Genlist_Item_Class *m_itemClassActionBar; @@ -76,15 +69,10 @@ private: Evas_Object *m_parent; Elm_Gengrid_Item_Class * m_item_class; std::map m_map_history_views; - bool m_gengridSetup; - std::string edjFilePath; - Evas_Object *createNoHistorysLabel(); - - static void focusItem(void* data, Evas_Object* obj, void* event_info); - static void unFocusItem(void* data, Evas_Object* obj, void* event_info); + std::string m_edjFilePath; + Evas_Object *createNoHistoryLabel(); }; - } } -- 2.7.4 From 146f90a4a967dab0c4c5ffaa1e2cca48568b5328 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Wed, 12 Aug 2015 14:03:09 +0200 Subject: [PATCH 02/16] Improve sizes of tiles, remove unneeded medium style, small refactoring of white spaces. [Issue#] https://bugs.tizen.org/jira/browse/TT-73 [Problem] Sizes of most visited tiles were wrong. [Cause] N/A [Solution] Fixed style for small tiles, removed style for medium tiles. [Verify] Check if Most visited view has proper tiles sizes. Change-Id: I4d884e3d099056e553c99b492469b8abb03d8b16 Signed-off-by: Maciej Skrzypkowski --- services/MainUI/MainUI.cpp | 122 ++++++------- services/MainUI/MainUI.h | 7 +- services/MainUI/edc/MainUI.edc | 388 ++++++++++++----------------------------- 3 files changed, 170 insertions(+), 347 deletions(-) diff --git a/services/MainUI/MainUI.cpp b/services/MainUI/MainUI.cpp index d45d22c..173e306 100644 --- a/services/MainUI/MainUI.cpp +++ b/services/MainUI/MainUI.cpp @@ -30,6 +30,8 @@ namespace tizen_browser{ namespace base_ui{ +const int SMALL_TILES_ROWS = 2; + EXPORT_SERVICE(MainUI, "org.tizen.browser.mainui") typedef struct _HistoryItemData @@ -56,7 +58,6 @@ MainUI::MainUI() , m_genListBottom(nullptr) , m_parent(nullptr) , m_big_item_class(nullptr) - , m_medium_item_class(nullptr) , m_small_item_class(nullptr) , m_bookmark_item_class(nullptr) { @@ -80,29 +81,29 @@ void MainUI::show(Evas_Object* parent) evas_object_show(m_layout); m_parent = m_layout; - m_genListMVBig = elm_genlist_add(m_layout); - elm_object_part_content_set(m_layout, "elm.swallow.mvBig", m_genListMVBig); - elm_genlist_homogeneous_set(m_genListMVBig, EINA_FALSE); - elm_genlist_multi_select_set(m_genListMVBig, EINA_FALSE); - elm_genlist_select_mode_set(m_genListMVBig, ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_genlist_mode_set(m_genListMVBig, ELM_LIST_LIMIT); - evas_object_size_hint_weight_set(m_genListMVBig, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - m_genListMVMedium = elm_genlist_add(m_layout); - elm_object_part_content_set(m_layout, "elm.swallow.mvMedium", m_genListMVMedium); - elm_genlist_homogeneous_set(m_genListMVMedium, EINA_FALSE); - elm_genlist_multi_select_set(m_genListMVMedium, EINA_FALSE); - elm_genlist_select_mode_set(m_genListMVMedium, ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_genlist_mode_set(m_genListMVMedium, ELM_LIST_LIMIT); - evas_object_size_hint_weight_set(m_genListMVMedium, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - m_genListMVSmall = elm_genlist_add(m_layout); - elm_object_part_content_set(m_layout, "elm.swallow.mvSmall", m_genListMVSmall); - elm_genlist_homogeneous_set(m_genListMVSmall, EINA_FALSE); - elm_genlist_multi_select_set(m_genListMVSmall, EINA_FALSE); - elm_genlist_select_mode_set(m_genListMVSmall, ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_genlist_mode_set(m_genListMVSmall, ELM_LIST_LIMIT); - evas_object_size_hint_weight_set(m_genListMVSmall, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + m_genListLeft = elm_genlist_add(m_layout); + elm_object_part_content_set(m_layout, "elm.swallow.left", m_genListLeft); + elm_genlist_homogeneous_set(m_genListLeft, EINA_FALSE); + elm_genlist_multi_select_set(m_genListLeft, EINA_FALSE); + elm_genlist_select_mode_set(m_genListLeft, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_genlist_mode_set(m_genListLeft, ELM_LIST_LIMIT); + evas_object_size_hint_weight_set(m_genListLeft, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + m_genListCenter = elm_genlist_add(m_layout); + elm_object_part_content_set(m_layout, "elm.swallow.center", m_genListCenter); + elm_genlist_homogeneous_set(m_genListCenter, EINA_FALSE); + elm_genlist_multi_select_set(m_genListCenter, EINA_FALSE); + elm_genlist_select_mode_set(m_genListCenter, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_genlist_mode_set(m_genListCenter, ELM_LIST_LIMIT); + evas_object_size_hint_weight_set(m_genListCenter, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + m_genListRight = elm_genlist_add(m_layout); + elm_object_part_content_set(m_layout, "elm.swallow.right", m_genListRight); + elm_genlist_homogeneous_set(m_genListRight, EINA_FALSE); + elm_genlist_multi_select_set(m_genListRight, EINA_FALSE); + elm_genlist_select_mode_set(m_genListRight, ELM_OBJECT_SELECT_MODE_ALWAYS); + elm_genlist_mode_set(m_genListRight, ELM_LIST_LIMIT); + evas_object_size_hint_weight_set(m_genListRight, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); if (!m_big_item_class) { m_big_item_class = elm_genlist_item_class_new(); @@ -113,15 +114,6 @@ void MainUI::show(Evas_Object* parent) m_big_item_class->func.del = nullptr; } - if (!m_medium_item_class) { - m_medium_item_class = elm_genlist_item_class_new(); - m_medium_item_class->item_style = "medium_grid_item"; - m_medium_item_class->func.text_get = _grid_text_get; - m_medium_item_class->func.content_get = _grid_content_get; - m_medium_item_class->func.state_get = nullptr; - m_medium_item_class->func.del = nullptr; - } - if (!m_small_item_class) { m_small_item_class = elm_genlist_item_class_new(); m_small_item_class->item_style = "small_grid_item"; @@ -222,7 +214,6 @@ void MainUI::showBottomButton() BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); elm_theme_extension_add(nullptr, edjFilePath.c_str()); m_genListBottom = elm_genlist_add(m_layout); - elm_object_part_content_set(m_layout, "elm.swallow.genlistBottom", m_genListBottom); elm_genlist_homogeneous_set(m_genListBottom, EINA_FALSE); elm_genlist_multi_select_set(m_genListBottom, EINA_FALSE); elm_genlist_select_mode_set(m_genListBottom, ELM_OBJECT_SELECT_MODE_ALWAYS); @@ -318,22 +309,16 @@ void MainUI::addHistoryItem(std::shared_ptrmainUI = std::shared_ptr(this); Elm_Object_Item* historyView = nullptr; - switch(m_map_history_views.size()) + if (m_map_history_views.empty()) { - case 0: - BROWSER_LOGD("%s:%d %s m_map_history_views.size %d", __FILE__, __LINE__, __func__, m_map_history_views.size()); - historyView = elm_genlist_item_append(m_genListMVBig, m_big_item_class, itemData, nullptr, ELM_GENLIST_ITEM_NONE, nullptr, this); - break; - case 1: - case 2: - BROWSER_LOGD("%s:%d %s m_map_history_views.size %d", __FILE__, __LINE__, __func__, m_map_history_views.size()); - historyView = elm_genlist_item_append(m_genListMVMedium, m_medium_item_class, itemData, nullptr, ELM_GENLIST_ITEM_NONE, nullptr, this); - break; - case 3: - case 4: - BROWSER_LOGD("%s:%d %s m_map_history_views.size %d", __FILE__, __LINE__, __func__, m_map_history_views.size()); - historyView = elm_genlist_item_append(m_genListMVSmall, m_small_item_class, itemData, nullptr, ELM_GENLIST_ITEM_NONE, nullptr, this); - break; + BROWSER_LOGD("%s:%d %s m_map_history_views.size %d", __FILE__, __LINE__, __func__, m_map_history_views.size()); + historyView = elm_genlist_item_append(m_genListLeft, m_big_item_class, itemData, nullptr, ELM_GENLIST_ITEM_NONE, nullptr, this); + } else if (m_map_history_views.size() <= SMALL_TILES_ROWS) { + BROWSER_LOGD("%s:%d %s m_map_history_views.size %d", __FILE__, __LINE__, __func__, m_map_history_views.size()); + historyView = elm_genlist_item_append(m_genListCenter, m_small_item_class, itemData, nullptr, ELM_GENLIST_ITEM_NONE, nullptr, this); + } else { + BROWSER_LOGD("%s:%d %s m_map_history_views.size %d", __FILE__, __LINE__, __func__, m_map_history_views.size()); + historyView = elm_genlist_item_append(m_genListRight, m_small_item_class, itemData, nullptr, ELM_GENLIST_ITEM_NONE, nullptr, this); } m_map_history_views.insert(std::pair(hi->getUrl(),historyView)); @@ -463,22 +448,24 @@ void MainUI::_thumbSelected(void * data, Evas_Object * /* obj */, void * /* even void MainUI::clearHistoryGenlist() { - elm_genlist_clear(m_genListMVSmall); - elm_genlist_clear(m_genListMVBig); - elm_genlist_clear(m_genListMVMedium); + elm_genlist_clear(m_genListRight); + elm_genlist_clear(m_genListLeft); + elm_genlist_clear(m_genListCenter); m_map_history_views.clear(); - evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.mvBig")); - evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.mvSmall")); - evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.mvMedium")); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.left")); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.right")); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.center")); } void MainUI::showHistoryGenlist() { - evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.grid")); - elm_object_part_content_unset(m_layout, "elm.swallow.grid"); - elm_object_part_content_set(m_layout, "elm.swallow.mvBig", m_genListMVBig); - elm_object_part_content_set(m_layout, "elm.swallow.mvSmall", m_genListMVSmall); - elm_object_part_content_set(m_layout, "elm.swallow.mvMedium", m_genListMVMedium); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.grid")); + elm_object_part_content_unset(m_layout, "elm.swallow.grid"); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.genlistBottom")); + elm_object_part_content_unset(m_layout, "elm.swallow.genlistBottom"); + elm_object_part_content_set(m_layout, "elm.swallow.left", m_genListLeft); + elm_object_part_content_set(m_layout, "elm.swallow.right", m_genListRight); + elm_object_part_content_set(m_layout, "elm.swallow.center", m_genListCenter); } void MainUI::clearBookmarkGengrid() @@ -490,13 +477,14 @@ void MainUI::clearBookmarkGengrid() void MainUI::showBookmarkGengrid() { - evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.mvBig")); - evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.mvSmall")); - evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.mvMedium")); - elm_object_part_content_unset(m_layout, "elm.swallow.mvBig"); - elm_object_part_content_unset(m_layout, "elm.swallow.mvSmall"); - elm_object_part_content_unset(m_layout, "elm.swallow.mvMedium"); - elm_object_part_content_set(m_layout, "elm.swallow.grid", m_gengrid); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.left")); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.right")); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.center")); + elm_object_part_content_unset(m_layout, "elm.swallow.left"); + elm_object_part_content_unset(m_layout, "elm.swallow.right"); + elm_object_part_content_unset(m_layout, "elm.swallow.center"); + elm_object_part_content_set(m_layout, "elm.swallow.grid", m_gengrid); + elm_object_part_content_set(m_layout, "elm.swallow.genlistBottom", m_genListBottom); } void MainUI::hide() diff --git a/services/MainUI/MainUI.h b/services/MainUI/MainUI.h index c0beb25..bd77d53 100644 --- a/services/MainUI/MainUI.h +++ b/services/MainUI/MainUI.h @@ -77,9 +77,9 @@ private: static void _bookmark_manager_clicked(void * data, Evas_Object * obj, void * event_info); private: Evas_Object *m_genListTop; - Evas_Object *m_genListMVBig; - Evas_Object *m_genListMVMedium; - Evas_Object *m_genListMVSmall; + Evas_Object *m_genListLeft; + Evas_Object *m_genListCenter; + Evas_Object *m_genListRight; Elm_Genlist_Item_Class *m_itemClassTop; Evas_Object *m_genListBottom; Elm_Genlist_Item_Class *m_itemClassBottom; @@ -87,7 +87,6 @@ private: Evas_Object *m_layout; Evas_Object *m_parent; Elm_Gengrid_Item_Class * m_big_item_class; - Elm_Gengrid_Item_Class * m_medium_item_class; Elm_Gengrid_Item_Class * m_small_item_class; Elm_Gengrid_Item_Class * m_bookmark_item_class; std::multimap m_map_history_views; diff --git a/services/MainUI/edc/MainUI.edc b/services/MainUI/edc/MainUI.edc index 8357ec7..f094d4e 100644 --- a/services/MainUI/edc/MainUI.edc +++ b/services/MainUI/edc/MainUI.edc @@ -141,37 +141,38 @@ group { name: "mv_bookmarks"; type: RECT; mouse_events: 0; description { state: "default" 0.0; - color: 255 255 255 255; - min: 1920 181; - max: 1920 181; - align: 0.0 0.0; + color: 255 255 255 255; + min: 0 181; + max: -1 181; + align: 0.0 0.0; fixed: 0 0; rel1 { - relative: 0 0; offset: 0 104; + relative: 0 0; offset: 0 104; } rel2{ - relative: 1 1; + relative: 1 1; } } } - part { name: "gengrid_bg"; + part { name: "gengrid_bg"; type: RECT; mouse_events: 0; description { state: "default" 0.0; - color: 255 255 255 255; - min: 1920 626; - max: 1920 626; - align: 0.0 0.0; + color: 255 255 255 255; + min: 1920 626; + max: -1 626; + align: 0.0 0.0; fixed: 0 0; rel1 { - relative: 0 1; to: "genlistTop_bg"; + to: "genlistTop_bg"; + relative: 0 1; } rel2{ - relative: 1 1; + relative: 1 1; } } } - part { name: "genlistBottom_bg"; + part { name: "genlistBottom_bg"; type: RECT; mouse_events: 0; description { state: "default" 0.0; @@ -205,15 +206,33 @@ group { name: "mv_bookmarks"; } } } - part { name: "elm.swallow.mvBig"; + + part { name: "most_visited"; + type: RECT; + description { state: "default" 0.0; + min: 1592 614; + max: 1592 614; + visible: 0; + align: 0.5 0.0; + rel1 { + to: "gengrid_bg"; + relative: 0 0; + } + rel2 { + to: "gengrid_bg"; + relative: 1 1; + } + } + } + part { name: "elm.swallow.left"; type: SWALLOW; description { state: "default" 0.0; - min: 800 626; - max: 800 626; + min: 784 614; + max: 784 614; align: 0.0 0.0; fixed: 0 0; rel1 { - relative: 0 0; to: "gengrid_bg"; offset: 63 0; + relative: 0 0; to: "most_visited"; } rel2 { relative: 1 1; @@ -221,38 +240,44 @@ group { name: "mv_bookmarks"; } } } - part { name: "elm.swallow.mvMedium"; + part { name: "elm.swallow.center"; type: SWALLOW; description { state: "default" 0.0; - min: 600 626; - max: 600 626; + min: 378 614; + max: 378 614; align: 0.0 0.0; fixed: 0 0; rel1 { - relative: 0 0; to: "gengrid_bg"; offset: 889 0; + to: "most_visited"; + relative: 0 0; + offset: 810 0; } rel2{ + to: "most_visited"; relative: 1 1; offset: 0 0; } - } - } - part { name: "elm.swallow.mvSmall"; + } + } + part { name: "elm.swallow.right"; type: SWALLOW; description { state: "default" 0.0; - min: 342 626; - max: 342 626; + min: 378 614; + max: 378 614; align: 0.0 0.0; fixed: 0 0; rel1 { - relative: 0 0; to: "gengrid_bg"; offset: 1515 0; + to: "most_visited"; + relative: 0 0; + offset: 1214 0; } rel2 { + to: "most_visited"; relative: 1 1; offset: 0 0; } } - } + } part { name: "elm.swallow.genlistTop"; type: SWALLOW; @@ -331,11 +356,10 @@ group { name: "elm/genlist/item/big_grid_item/default"; type: RECT; mouse_events: 0; description { state: "default" 0.0; - min: 800 613; - max: 800 613; + min: 784 614; + max: 784 614; visible: 1; color: 231 231 231 255; - rel1.offset: 0 13; } description { state: "selected"; inherit: "default" 0.0; @@ -349,8 +373,8 @@ group { name: "elm/genlist/item/big_grid_item/default"; fixed: 1 0; align: 0.0 0.0; color : 231 231 231 255; - min: 800 526; - max: 800 526; + min: 784 526; + max: 784 526; rel1 { relative: 0.0 0.0; to: "bg"; } @@ -389,8 +413,8 @@ group { name: "elm/genlist/item/big_grid_item/default"; part { name: "background"; type: RECT; description { state: "default" 0.0; - min: 800 87; - max: 800 87; + min: 784 87; + max: 784 87; align: 0.0 0.0; color: 231 231 231 255; rel1 { @@ -522,7 +546,7 @@ group { name: "elm/genlist/item/big_grid_item/default"; } } -group { name: "elm/genlist/item/medium_grid_item/default"; +group { name: "elm/genlist/item/small_grid_item/default"; data.item: "texts" "page_title page_url"; data.item: "contents" "elm.thumbnail elm.thumbButton"; images { @@ -530,218 +554,30 @@ group { name: "elm/genlist/item/medium_grid_item/default"; image: "ico_bg_round_shape_37x37.png" COMP; } parts { + part { name: "border"; + type: RECT; + description { state: "default" 0.0; + min: 378 320; + max: 378 320; + visible: 0; + } + } + part { name: "bg"; type: RECT; mouse_events: 0; description { state: "default" 0.0; - min: 600 300; - max: 600 300; + min: 378 294; + max: 378 294; visible: 1; color: 231 231 231 255; - rel1.offset: 0 13; - } - description { state: "selected"; - inherit: "default" 0.0; - color: 70 143 254 255; - } - } - - part { name: "elm.thumbnail"; - type: SWALLOW; - description { state: "default" 0.0; - fixed: 1 0; - align: 0.0 0.0; - color : 231 231 231 255; - min: 600 203; - max: 600 203; - rel1 { - relative: 0.0 0.0; to: "bg"; - } - rel2 { - relative: 1.0 1.0; to: "bg"; - } - } - description { state: "selected"; - inherit: "default" 0.0; - } - } - - part { name: "focus_highlight"; - type: IMAGE; - description { state: "default" 0.0; - rel1 { - to: "elm.thumbnail"; - relative: 0.0 0.0; - } - rel2 { - to: "elm.thumbnail"; - relative: 1.0 1.0; - } - image.normal: "web_frame_selected.png"; - image.border: 8 8 8 0; - image.border_scale: 1; - image.middle: NONE; - visible: 0; - } - description { state: "selected"; - inherit: "default" 0.0; - visible: 1; - } - } - - part { name: "background"; - type: RECT; - description { state: "default" 0.0; - min: 600 87; - max: 600 87; - align: 0.0 0.0; - color: 231 231 231 255; - rel1 { - to: "elm.thumbnail"; - relative: 0.0 1.0; - } - rel2 { - relative: 1.0 1.0; - } - } - description { state: "selected" 0.0; - inherit: "default" 0.0; - color: 70 143 254 255; - } - } - - part { name: "page_title"; - type: TEXT; - description { state: "default" 0.0; - min: 500 48; - max: 500 48; - align: 0.0 0.5; - rel1 { - to: "background"; - relative: 0.0 0.0; - offset: 17 0; - } - rel2 { - to: "background"; - relative: 1.0 1.0; - } - color: 51 51 51 255; - text { - text: "Web page title"; - font: "Sans"; - size: 27; - align: 0 0.5; - } + align: 0.0 0.0; + rel1 { + relative: 0.0 0.0; to: "border"; } - description { state: "focus" 0.0; - inherit: "default" 0.0; - //color: focusTextColor; + rel2 { + relative: 1.0 1.0; to: "border"; } - description { state: "highlight" 0.0; - inherit: "default" 0.0; - //color: highlightTextColor; - } - } - - part { name: "page_url"; - type: TEXT; - description { state: "default" 0.0; - min: 500 48; - max: 500 48; - align: 0 0.5; - rel1 { - to: "page_title"; - relative: 0.0 1.0; - } - rel2 { - to: "page_title"; - relative: 1.0 1.0; - } - color: 153 153 153 255; - text { - text: "Web page url"; - font: "Sans"; - size: 24; - align: 0 0.5; - } - } - description { state: "focus" 0.0; - inherit: "default" 0.0; - //color: focusTextColor; - } - description { state: "highlight" 0.0; - inherit: "default" 0.0; - //color: highlightTextColor; - } - } - - part { name: "elm.thumbButton"; - type: SWALLOW; - description { state: "default" 0.0; - rel1.to: "elm.thumbnail"; - rel2.to: "elm.thumbnail"; - } - } - - part { name: "over2"; - type: RECT; - mouse_events: 1; - repeat_events: 1; - description { state: "default" 0.0; - color: 0 0 0 0; - rel1.to: "bg"; - rel2.to: "background"; - } - } - part { name: "over3"; - type: RECT; - mouse_events: 1; - repeat_events: 1; - description { state: "default" 0.0; - color: 0 0 0 0; - rel1.to: "background"; - rel2.to: "background"; - } - } - } - - programs{ - program { name: "mouse_in"; - signal: "mouse,in"; - source: "over2"; - action: STATE_SET "selected" 0.0; - target: "background"; - target: "focus_highlight"; - target: "bg"; - } - program { name: "mouse_out"; - signal: "mouse,out"; - source: "over2"; - action: STATE_SET "default" 0.0; - target: "background"; - target: "focus_highlight"; - target: "bg"; - } - } -} - -group { name: "elm/genlist/item/small_grid_item/default"; - data.item: "texts" "page_title page_url"; - data.item: "contents" "elm.thumbnail elm.thumbButton"; - images { - image: "web_frame_selected.png" COMP; - image: "ico_bg_round_shape_37x37.png" COMP; - } - parts { - part { name: "bg"; - type: RECT; - mouse_events: 0; - description { state: "default" 0.0; - min: 342 300; - max: 342 300; - visible: 1; - color: 231 231 231 255; - rel1.offset: 0 13; } description { state: "selected"; inherit: "default" 0.0; @@ -1137,7 +973,7 @@ group { name: "elm/genlist/item/top_button_item/default"; data.item: "texts" "mostvisited_text bookmark_text"; data.item: "contents" "mostvisited_click bookmark_click"; parts{ - part { + part { name: "bg_clipper"; scale:1; mouse_events: 1; @@ -1152,7 +988,7 @@ group { name: "elm/genlist/item/top_button_item/default"; rel2 { relative: 1.0 1.0;} } } - part { + part { name: "mostvisited_button"; scale:1; mouse_events: 1; @@ -1163,8 +999,8 @@ group { name: "elm/genlist/item/top_button_item/default"; fixed: 1 1; color: 192 192 192 255; align: 0 0; - min: 348 65; - max: 348 65; + min: 348 64; + max: 348 64; rel1 { relative: 0.0 0.0; to: "bg_clipper"; offset: 611 58;} rel2 { relative: 1.0 1.0; to: "bg_clipper"; } } @@ -1174,14 +1010,14 @@ group { name: "elm/genlist/item/top_button_item/default"; color_class: focusBgColor; visible: 1; } - description { + description { state: "focus" 0.0; inherit: "default" 0.0; color_class: focusbtBgColor; visible: 1; } } - part{ + part{ name: "mostvisited_text"; type: TEXT; scale: 1; @@ -1191,7 +1027,7 @@ group { name: "elm/genlist/item/top_button_item/default"; rel1 { relative: 0.0 0.0;to: "mostvisited_button";} rel2 { relative: 1.0 1.0;to: "mostvisited_button";} color: 0 0 0 255; - text { + text { text: "Most visited"; font: "Sans"; size: 27; @@ -1199,7 +1035,7 @@ group { name: "elm/genlist/item/top_button_item/default"; } } } - part { + part { name: "mostvisited_over"; scale:1; type: RECT; @@ -1209,14 +1045,14 @@ group { name: "elm/genlist/item/top_button_item/default"; visible: 1; align: 0 0; fixed: 1 1; - min: 348 65; - max: 348 65; + min: 348 64; + max: 348 64; rel1 { relative: 0.0 0.0; to: "mostvisited_button";} rel2 { relative: 1.0 1.0; to: "mostvisited_button";} color_class: transparent; } } - part { + part { name: "mostvisited_click"; scale:1; type: SWALLOW; @@ -1226,13 +1062,13 @@ group { name: "elm/genlist/item/top_button_item/default"; visible: 1; align: 0 0; fixed: 1 1; - min: 348 65; - max: 348 65; - rel1 { relative: 0.0 0.0; to: "mostvisited_over";} - rel2 { relative: 1.0 1.0; to: "mostvisited_over";} + min: 348 64; + max: 348 64; + rel1 { relative: 0.0 0.0; to: "mostvisited_button";} + rel2 { relative: 1.0 1.0; to: "mostvisited_button";} } } - part { + part { name: "bookmark_button"; scale:1; mouse_events: 1; @@ -1243,8 +1079,8 @@ group { name: "elm/genlist/item/top_button_item/default"; fixed: 1 1; color: 192 192 192 255; align: 0 0; - min: 348 65; - max: 348 65; + min: 348 64; + max: 348 64; rel1 { relative: 0.0 0.0; to: "bg_clipper"; offset: 961 58;} rel2 { relative: 1.0 1.0; to: "bg_clipper"; } } @@ -1261,7 +1097,7 @@ group { name: "elm/genlist/item/top_button_item/default"; visible: 1; } } - part{ + part{ name: "bookmark_text"; type: TEXT; scale: 1; @@ -1271,7 +1107,7 @@ group { name: "elm/genlist/item/top_button_item/default"; rel1 { relative: 0.0 0.0;to: "bookmark_button";} rel2 { relative: 1.0 1.0;to: "bookmark_button";} color: 0 0 0 255; - text { + text { text: "Bookmark"; font: "Sans"; size: 27; @@ -1279,7 +1115,7 @@ group { name: "elm/genlist/item/top_button_item/default"; } } } - part { + part { name: "bookmark_over"; scale:1; type: RECT; @@ -1289,8 +1125,8 @@ group { name: "elm/genlist/item/top_button_item/default"; visible: 1; align: 0 0; fixed: 1 1; - min: 348 65; - max: 348 65; + min: 348 64; + max: 348 64; rel1 { relative: 0.0 0.0; to: "bookmark_button";} rel2 { relative: 1.0 1.0; to: "bookmark_button";} color_class: transparent; @@ -1306,8 +1142,8 @@ group { name: "elm/genlist/item/top_button_item/default"; visible: 1; align: 0 0; fixed: 1 1; - min: 348 65; - max: 348 65; + min: 348 64; + max: 348 64; rel1 { relative: 0.0 0.0; to: "bookmark_over";} rel2 { relative: 1.0 1.0; to: "bookmark_over";} color_class: transparent; @@ -1323,7 +1159,7 @@ group { name: "elm/genlist/item/top_button_item/default"; emit("elm,action,click", ""); } } - program { + program { name: "mouse_in_mostvisited_click"; signal: "mouse,in"; source: "mostvisited_*"; @@ -1349,7 +1185,7 @@ group { name: "elm/genlist/item/top_button_item/default"; emit("elm,action,click", ""); } } - program { + program { name: "mouse_in_bookmark_click"; signal: "mouse,in"; source: "bookmark_*"; @@ -1367,7 +1203,7 @@ group { name: "elm/genlist/item/top_button_item/default"; target: "bookmark_over"; target: "mostvisited_text"; } - } + } } } @@ -1377,7 +1213,7 @@ group { name: "elm/genlist/item/bottom_button_item/default"; data.item: "texts" "bookmarkmanager_text"; data.item: "contents" "bookmarkmanager_click"; parts{ - part { + part { name: "bg_clipper"; scale:1; mouse_events: 1; @@ -1392,7 +1228,7 @@ group { name: "elm/genlist/item/bottom_button_item/default"; rel2 { relative: 1.0 1.0;} } } - part { + part { name: "bookmarkmanager_button"; scale:1; mouse_events: 1; @@ -1421,7 +1257,7 @@ group { name: "elm/genlist/item/bottom_button_item/default"; visible: 1; } } - part{ + part{ name: "bookmarkmanager_text"; type: TEXT; scale: 1; @@ -1431,7 +1267,7 @@ group { name: "elm/genlist/item/bottom_button_item/default"; rel1 { relative: 0.0 0.0;to: "bookmarkmanager_button";} rel2 { relative: 1.0 1.0;to: "bookmarkmanager_button";} color: 0 0 0 255; - text { + text { text: "Bookmark Manager"; font: "Sans"; size: 27; @@ -1439,7 +1275,7 @@ group { name: "elm/genlist/item/bottom_button_item/default"; } } } - part { + part { name: "bookmarkmanager_over"; scale:1; type: RECT; @@ -1456,7 +1292,7 @@ group { name: "elm/genlist/item/bottom_button_item/default"; color_class: transparent; } } - part { + part { name: "bookmarkmanager_click"; scale:1; type: SWALLOW; @@ -1482,7 +1318,7 @@ group { name: "elm/genlist/item/bottom_button_item/default"; emit("elm,action,click", ""); } } - program { + program { name: "mouse_in_bookmarkmanager_click"; signal: "mouse,in"; source: "bookmarkmanager_*"; -- 2.7.4 From 2e79d3bfb763dd55387dbb0df445c28c2bad8f15 Mon Sep 17 00:00:00 2001 From: Marcin Lapinski Date: Wed, 12 Aug 2015 15:31:53 +0200 Subject: [PATCH 03/16] Added action on clear history button clicked. [Issue#] https://bugs.tizen.org/jira/browse/TT-99 [Problem] 'Clear History' button does not work. [Cause] Buttons callback was empty. [Solution] Trigger history clear on button click. [Verify] 1. (History is not empty) 2. Open More menu -> history. 3. Click 'Clear History' button. 4. History should be deleted. Change-Id: I7d9b5d40451398d21ef88359f37660261ce1e6e6 --- services/HistoryUI/HistoryUI.cpp | 33 ++++++++++----------------------- services/HistoryUI/HistoryUI.h | 7 ++++--- services/SimpleUI/SimpleUI.cpp | 7 +++++++ services/SimpleUI/SimpleUI.h | 4 +++- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/services/HistoryUI/HistoryUI.cpp b/services/HistoryUI/HistoryUI.cpp index c2724da..c562a18 100644 --- a/services/HistoryUI/HistoryUI.cpp +++ b/services/HistoryUI/HistoryUI.cpp @@ -125,28 +125,14 @@ void HistoryUI::showActionBar() m_itemClassActionBar->func.state_get = nullptr; m_itemClassActionBar->func.del = nullptr; - ItemData *id = new ItemData; - id->historyUI = this; Elm_Object_Item *elmItem = elm_genlist_item_append(m_genListActionBar, //genlist m_itemClassActionBar, //item Class - id, + this, nullptr, //parent item ELM_GENLIST_ITEM_NONE, //item type nullptr, nullptr //data passed to above function ); - id->e_item = elmItem; - ItemData *id2 = new ItemData; - id2->historyUI = this; - Elm_Object_Item *elmItem2 = elm_genlist_item_append(m_genListActionBar, //genlist - m_itemClassActionBar, //item Class - id2, - nullptr, //parent item - ELM_GENLIST_ITEM_NONE, //item type - nullptr, - nullptr //data passed to above function - ); - id2->e_item = elmItem2; } Evas_Object* HistoryUI::_listActionBarContentGet(void* data, Evas_Object* obj , const char* part) @@ -161,7 +147,7 @@ Evas_Object* HistoryUI::_listActionBarContentGet(void* data, Evas_Object* obj , if (!strncmp(part_name1, part, part_name1_len)) { Evas_Object *clearHistoryButton = elm_button_add(obj); elm_object_style_set(clearHistoryButton, "history_button"); - evas_object_smart_callback_add(clearHistoryButton, "clicked", tizen_browser::base_ui::HistoryUI::_clearhistory_clicked, data); + evas_object_smart_callback_add(clearHistoryButton, "clicked", HistoryUI::_clearHistory_clicked, data); return clearHistoryButton; } if (!strncmp(part_name2, part, part_name2_len)) { @@ -178,9 +164,9 @@ void HistoryUI::_close_clicked_cb(void * data, Evas_Object*, void*) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); if (data) { - ItemData *id = static_cast(data); - id->historyUI->closeHistoryUIClicked(std::string()); - id->historyUI->clearItems(); + HistoryUI *historyUI = static_cast(data); + historyUI->closeHistoryUIClicked(std::string()); + historyUI->clearItems(); } } @@ -202,12 +188,13 @@ char* HistoryUI::_listTodayTextGet(void* data, Evas_Object*, const char* part) return nullptr; } -void HistoryUI::_clearhistory_clicked(void*, Evas_Object*, void*) +void HistoryUI::_clearHistory_clicked(void* data, Evas_Object*, void*) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); -// ItemData *itemData = static_cast(data); -// itemData->tabUI->clearItems(); -// itemData->tabUI->newTabClicked(std::string()); + + HistoryUI *historyUI = static_cast(data); + historyUI->clearHistoryClicked(std::string()); + historyUI->clearItems(); } void HistoryUI::addItems() diff --git a/services/HistoryUI/HistoryUI.h b/services/HistoryUI/HistoryUI.h index 20bcc53..4556327 100644 --- a/services/HistoryUI/HistoryUI.h +++ b/services/HistoryUI/HistoryUI.h @@ -43,18 +43,19 @@ public: void removeHistoryItem(const std::string& uri); void clearItems(); void hide(); - void showActionBar(); + void showActionBar(); void show(Evas_Object *main_layout); void addItems(); boost::signals2::signal closeHistoryUIClicked; + boost::signals2::signal clearHistoryClicked; boost::signals2::signal)> historyItemClicked; boost::signals2::signal)> historyDeleteClicked; private: static char* _grid_text_get(void *data, Evas_Object *obj, const char *part); - static Evas_Object * _history_grid_content_get(void *data, Evas_Object *obj, const char *part); + static Evas_Object * _history_grid_content_get(void *data, Evas_Object *obj, const char *part); static Evas_Object * _grid_content_get(void *data, Evas_Object *obj, const char *part); static Evas_Object* _listActionBarContentGet(void *data, Evas_Object *obj, const char *part); - static void _clearhistory_clicked(void *data, Evas_Object *obj, void *event_info); + static void _clearHistory_clicked(void *data, Evas_Object *obj, void *event_info); static char* _listTodayTextGet(void* data, Evas_Object* obj , const char* part); static void _close_clicked_cb(void *data, Evas_Object *obj, void *event_info); diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 0ccc4d0..4aa6931 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -588,6 +588,12 @@ void SimpleUI::onHistoryClicked(std::shared_ptrclearAllHistory(); +} + void SimpleUI::onMostVisitedClicked(const std::string&) { BROWSER_LOGD("[%s]", __func__); @@ -1057,6 +1063,7 @@ void SimpleUI::showHistoryUI(const std::string& str) std::dynamic_pointer_cast (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.historyui")); M_ASSERT(m_historyUI); + m_historyUI->clearHistoryClicked.connect(boost::bind(&SimpleUI::onClearHistoryClicked, this,_1)); m_historyUI->closeHistoryUIClicked.connect(boost::bind(&SimpleUI::closeHistoryUI, this,_1)); m_historyUI->historyItemClicked.connect(boost::bind(&SimpleUI::onHistoryClicked, this,_1)); m_historyUI->addHistoryItems(getHistory()); diff --git a/services/SimpleUI/SimpleUI.h b/services/SimpleUI/SimpleUI.h index 31bd390..482fcde 100644 --- a/services/SimpleUI/SimpleUI.h +++ b/services/SimpleUI/SimpleUI.h @@ -132,6 +132,8 @@ private: void onHistoryAdded(std::shared_ptr historyItem); void onHistoryRemoved(const std::string& uri); void onHistoryClicked(std::shared_ptr historyItem); + void onClearHistoryClicked(const std::string&); + void onMostVisitedClicked(const std::string&); void onBookmarkButtonClicked(const std::string&); void onBookmarkManagerButtonClicked(const std::string&); @@ -225,7 +227,7 @@ private: void showMoreMenu(); void closeMoreMenu(const std::string& str); void showHistoryUI(const std::string& str); - void closeHistoryUI(const std::string& str); + void closeHistoryUI(const std::string&); void showMainUI(); void hideMainUI(); void showURIBar(); -- 2.7.4 From 0fd97134fc1fb5a49e44279c777eae023833d0ae Mon Sep 17 00:00:00 2001 From: Marcin Lapinski Date: Thu, 13 Aug 2015 11:58:37 +0200 Subject: [PATCH 04/16] Refactor of HistoryUI::showActionBar function. [Issue#] https://bugs.tizen.org/jira/browse/TT-72 [Problem] HistoryUI::showActionBar is too complicated. Uses unnecessary genlist, with only one item to create action bar. This makes code long and unclear as it is not the proper use of genlist. [Cause] N/A [Solution] Use layout instead the genlist to make the code shorter and more self-explaining. [Verify] 1. Browser builds. 2. Run the browser and check history ui to see if the change is not introducing any new issues. Change-Id: I9b1ad458d7497af9d85741978e844ebb4f918079 --- services/HistoryUI/HistoryUI.cpp | 72 +++++++++++--------------------------- services/HistoryUI/HistoryUI.h | 3 +- services/HistoryUI/edc/History.edc | 12 +++---- 3 files changed, 26 insertions(+), 61 deletions(-) diff --git a/services/HistoryUI/HistoryUI.cpp b/services/HistoryUI/HistoryUI.cpp index c562a18..11ab3ed 100644 --- a/services/HistoryUI/HistoryUI.cpp +++ b/services/HistoryUI/HistoryUI.cpp @@ -48,7 +48,7 @@ static std::vector _history_item_data; HistoryUI::HistoryUI() : m_history_layout(nullptr) - , m_genListActionBar(nullptr) + , m_actionBar(nullptr) , m_genListToday(nullptr) , m_itemClassToday(nullptr) , m_gengrid(nullptr) @@ -108,56 +108,25 @@ void HistoryUI::show(Evas_Object* parent) void HistoryUI::showActionBar() { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - elm_theme_extension_add(nullptr, m_edjFilePath.c_str()); - m_genListActionBar = elm_genlist_add(m_history_layout); - elm_object_part_content_set(m_history_layout, "action_bar_history_genlist", m_genListActionBar); - elm_genlist_homogeneous_set(m_genListActionBar, EINA_FALSE); - elm_genlist_multi_select_set(m_genListActionBar, EINA_FALSE); - elm_genlist_select_mode_set(m_genListActionBar, ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_genlist_mode_set(m_genListActionBar, ELM_LIST_LIMIT); - elm_genlist_decorate_mode_set(m_genListActionBar, EINA_TRUE); - evas_object_size_hint_weight_set(m_genListActionBar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - m_itemClassActionBar = elm_genlist_item_class_new(); - m_itemClassActionBar->item_style = "action_bar_history_items"; - m_itemClassActionBar->func.text_get = nullptr; // &listTopItemTextGet; - m_itemClassActionBar->func.content_get = &_listActionBarContentGet; - m_itemClassActionBar->func.state_get = nullptr; - m_itemClassActionBar->func.del = nullptr; - - Elm_Object_Item *elmItem = elm_genlist_item_append(m_genListActionBar, //genlist - m_itemClassActionBar, //item Class - this, - nullptr, //parent item - ELM_GENLIST_ITEM_NONE, //item type - nullptr, - nullptr //data passed to above function - ); -} -Evas_Object* HistoryUI::_listActionBarContentGet(void* data, Evas_Object* obj , const char* part) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - if (obj && part) { - const char *part_name1 = "clearhistory_click"; - static const int part_name1_len = strlen(part_name1); - const char *part_name2 = "close_click"; - static const int part_name2_len = strlen(part_name2); - - if (!strncmp(part_name1, part, part_name1_len)) { - Evas_Object *clearHistoryButton = elm_button_add(obj); - elm_object_style_set(clearHistoryButton, "history_button"); - evas_object_smart_callback_add(clearHistoryButton, "clicked", HistoryUI::_clearHistory_clicked, data); - return clearHistoryButton; - } - if (!strncmp(part_name2, part, part_name2_len)) { - Evas_Object *close_click = elm_button_add(obj); - elm_object_style_set(close_click, "history_button"); - evas_object_smart_callback_add(close_click, "clicked", HistoryUI::_close_clicked_cb, data); - return close_click; - } - } - return nullptr; + m_actionBar = elm_layout_add(m_history_layout); + elm_object_part_content_set(m_history_layout, "action_bar_history", m_actionBar); + evas_object_size_hint_weight_set(m_actionBar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(m_actionBar, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_layout_file_set(m_actionBar, m_edjFilePath.c_str(), "action_bar"); + + Evas_Object *button = elm_button_add(m_actionBar); + elm_object_style_set(button, "history_button"); + evas_object_smart_callback_add(button, "clicked", HistoryUI::_clearHistory_clicked, this); + elm_object_part_content_set(m_actionBar, "clearhistory_click", button); + + button = elm_button_add(m_actionBar); + elm_object_style_set(button, "history_button"); + evas_object_smart_callback_add(button, "clicked", HistoryUI::_close_clicked_cb, this); + elm_object_part_content_set(m_actionBar, "close_click", button); + + evas_object_show(m_actionBar); } void HistoryUI::_close_clicked_cb(void * data, Evas_Object*, void*) @@ -310,7 +279,7 @@ void HistoryUI::hide() BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); evas_object_hide(elm_layout_content_get(m_history_layout, "m_genListToday")); evas_object_hide(elm_layout_content_get(m_history_layout, "m_gengrid")); - evas_object_hide(elm_layout_content_get(m_history_layout, "m_genListActionBar")); + evas_object_hide(elm_layout_content_get(m_history_layout, "m_ActionBar")); evas_object_hide(m_history_layout); } @@ -320,7 +289,6 @@ void HistoryUI::clearItems() hide(); elm_genlist_clear(m_genListToday); elm_gengrid_clear(m_gengrid); - elm_genlist_clear(m_genListActionBar); m_map_history_views.clear(); _history_item_data.clear(); setEmptyGengrid(true); diff --git a/services/HistoryUI/HistoryUI.h b/services/HistoryUI/HistoryUI.h index 4556327..7070ff8 100644 --- a/services/HistoryUI/HistoryUI.h +++ b/services/HistoryUI/HistoryUI.h @@ -62,9 +62,8 @@ private: void setEmptyGengrid(bool setEmpty); Evas_Object *m_history_layout; - Evas_Object *m_genListActionBar; + Evas_Object *m_actionBar; Evas_Object *m_genListToday; - Elm_Genlist_Item_Class *m_itemClassActionBar; Elm_Genlist_Item_Class *m_itemClassToday; Evas_Object *m_gengrid; Evas_Object *m_parent; diff --git a/services/HistoryUI/edc/History.edc b/services/HistoryUI/edc/History.edc index 4f36aef..cda9200 100644 --- a/services/HistoryUI/edc/History.edc +++ b/services/HistoryUI/edc/History.edc @@ -109,7 +109,7 @@ group { image: "web_shadow.png" COMP; } parts { - part { name: "action_bar_history_genlist_bg"; + part { name: "action_bar_bg"; type: RECT; mouse_events: 0; description { state: "default" 0.0; @@ -136,7 +136,7 @@ group { max: 1920 976; color: 231 231 231 255; rel1 { - relative: 0 1; to: "action_bar_history_genlist_bg"; + relative: 0 1; to: "action_bar_bg"; } rel2{ @@ -144,7 +144,7 @@ group { } } } - part { name: "action_bar_history_genlist"; + part { name: "action_bar_history"; type : SWALLOW; scale: 1; description { @@ -154,7 +154,7 @@ group { max: 1920 104; align: 0.0 0.0; fixed: 0 0; - rel1 { relative: 0.0 0.0; to: "action_bar_history_genlist_bg";} + rel1 { relative: 0.0 0.0; to: "action_bar_bg";} rel2 { relative: 1.0 1.0; } } description { @@ -200,7 +200,6 @@ group { min: 500 600; max: 500 600; data.item: "texts" "history_url_text"; - //data.item: "contents" "clearhistory_click"; parts{ part { name: "bg_clipper"; @@ -254,10 +253,9 @@ group { } } - group { name: "elm/genlist/item/action_bar_history_items/default"; + group { name: "action_bar"; min: 1920 104; max: 1920 104; - data.item: "texts" "clearhistory_text"; data.item: "contents" "clearhistory_click close_click"; parts{ part { -- 2.7.4 From ce14505e000b735ff8fcb63dc7ba124447e865e9 Mon Sep 17 00:00:00 2001 From: Albert Malewski Date: Wed, 12 Aug 2015 12:32:04 +0200 Subject: [PATCH 05/16] Fixed tabs addition [Issue#] https://bugs.tizen.org/jira/browse/TT-92 [Problem] Multiple tabs are added when navigating a page from Most Visited or Bookmarks. [Cause] Slots were added to signals every time the ShowMainUI function was called. [Solution] Changed time of adding slots. Now they are added in function exec only once (if m_initialised is false). [Verify] Launch Browser > Create new tabs > Obs Number of open tabs should be correct. Change-Id: I0401061a1cc75984c739a582be6bb83465849556 --- services/SimpleUI/SimpleUI.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 4aa6931..7c821c8 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -298,6 +298,16 @@ int SimpleUI::exec(const std::string& _url) } m_initialised = true; + m_mainUI = std::dynamic_pointer_cast + (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.mainui")); + M_ASSERT(m_mainUI.get()); + + m_historyService->historyAllDeleted.connect(boost::bind(&tizen_browser::base_ui::MainUI::clearHistoryGenlist, m_mainUI.get())); + m_mainUI->historyClicked.connect(boost::bind(&SimpleUI::onHistoryClicked, this,_1)); + m_mainUI->mostVisitedClicked.connect(boost::bind(&SimpleUI::onMostVisitedClicked, this,_1)); + m_mainUI->bookmarkClicked.connect(boost::bind(&SimpleUI::onBookmarkButtonClicked, this,_1)); + m_mainUI->bookmarkManagerClicked.connect(boost::bind(&SimpleUI::onBookmarkManagerButtonClicked, this,_1)); + // only when first run if (url.empty()) { BROWSER_LOGD("[%s]: changing to homeUrl", __func__); @@ -1043,16 +1053,11 @@ void SimpleUI::showMainUI() std::dynamic_pointer_cast (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.mainui")); - M_ASSERT(m_mainUI); + M_ASSERT(m_mainUI); hideWebView(); - m_mainUI->show(m_window.get()); + m_mainUI->show(m_window.get()); m_mainUI->addHistoryItems(getHistory()); - m_historyService->historyAllDeleted.connect(boost::bind(&tizen_browser::base_ui::MainUI::clearHistoryGenlist, m_mainUI.get())); - m_mainUI->historyClicked.connect(boost::bind(&SimpleUI::onHistoryClicked, this,_1)); - m_mainUI->mostVisitedClicked.connect(boost::bind(&SimpleUI::onMostVisitedClicked, this,_1)); - m_mainUI->bookmarkClicked.connect(boost::bind(&SimpleUI::onBookmarkButtonClicked, this,_1)); - m_mainUI->bookmarkManagerClicked.connect(boost::bind(&SimpleUI::onBookmarkManagerButtonClicked, this,_1)); m_isHomePageActive = true; } -- 2.7.4 From e1880e27029ccdbf44ef15de4707e8c08e219635 Mon Sep 17 00:00:00 2001 From: Marcin Lapinski Date: Mon, 17 Aug 2015 14:28:24 +0200 Subject: [PATCH 06/16] Disabled START_MINIBROWSER and READ_MODE features [Issue#] https://bugs.tizen.org/jira/browse/TT-129 [Problem] N/A [Cause] N/A [Solution] N/A [Verify] 1. Change builds. 2. Feature buttons in More Menu should be not visible. Change-Id: I9aec51faabafb9503a31e30955cd92d0ed31b10b --- services/MoreMenuUI/MoreMenuUI.cpp | 16 +++++++++++++++- services/MoreMenuUI/MoreMenuUI.h | 7 ++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/services/MoreMenuUI/MoreMenuUI.cpp b/services/MoreMenuUI/MoreMenuUI.cpp index 2670648..ff31301 100644 --- a/services/MoreMenuUI/MoreMenuUI.cpp +++ b/services/MoreMenuUI/MoreMenuUI.cpp @@ -282,7 +282,7 @@ void MoreMenuUI::hide() void MoreMenuUI::addItems() { BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); - for (size_t i = 0; i < 10; i++) { + for (size_t i = 0; i < static_cast(END_OF_RANGE); i++) { MoreMenuItemData *itemData = new MoreMenuItemData(); itemData->item = static_cast(i);; itemData->moreMenuUI = std::shared_ptr(this); @@ -304,9 +304,11 @@ char* MoreMenuUI::_grid_text_get(void* data, Evas_Object*, const char* part) if (!strncmp(part_name, part, part_name_len)) { const char* item_name = NULL; switch (itemData->item) { +#ifdef READER_MODE_ENABLED case READER_MODE: item_name = "Reader mode"; break; +#endif case BOOKMARK_MANAGER: item_name = "Bookmark manager"; break; @@ -316,9 +318,11 @@ char* MoreMenuUI::_grid_text_get(void* data, Evas_Object*, const char* part) case SCREEN_ZOOM: item_name = "Screen zoom"; break; +#ifdef START_MINIBROWSER_ENABLED case START_MINIBROWSER: item_name = "Start minibrowser"; break; +#endif case FOCUS_MODE: item_name = "Focus mode"; break; @@ -347,9 +351,11 @@ static const char* getImageFileNameForType(ItemType type, bool focused) { const char* file_name = NULL; switch (type) { +#ifdef READER_MODE_ENABLED case READER_MODE: file_name = focused ? "ic_more_readermode_foc.png" : "ic_more_readermode_nor.png"; break; +#endif case BOOKMARK_MANAGER: file_name = focused ? "ic_more_bookmark_foc.png" : "ic_more_bookmark_nor.png"; break; @@ -359,9 +365,11 @@ static const char* getImageFileNameForType(ItemType type, bool focused) case SCREEN_ZOOM: file_name = focused ? "ic_more_zoom_foc.png" : "ic_more_zoom_nor.png"; break; +#ifdef START_MINIBROWSER_ENABLED case START_MINIBROWSER: file_name = focused ? "ic_more_minibrowser_foc.png" : "ic_more_minibrowser_nor.png"; break; +#endif case FOCUS_MODE: file_name = focused ? "ic_more_focusmode_foc.png" : "ic_more_focusmode_nor.png"; break; @@ -455,9 +463,15 @@ void MoreMenuUI::_thumbSelected(void* data, Evas_Object*, void*) case BOOKMARK_MANAGER: itemData->moreMenuUI->bookmarkManagerClicked(std::string()); break; +#ifdef READER_MODE_ENABLED case READER_MODE: + //TODO: Implement reader mode +#endif case SCREEN_ZOOM: +#ifdef START_MINIBROWSER_ENABLED case START_MINIBROWSER: + //TODO: Implement minibrowser launching +#endif case FOCUS_MODE: case VIEW_MOBILE_WEB: case SHARE: diff --git a/services/MoreMenuUI/MoreMenuUI.h b/services/MoreMenuUI/MoreMenuUI.h index a837fad..1d87456 100644 --- a/services/MoreMenuUI/MoreMenuUI.h +++ b/services/MoreMenuUI/MoreMenuUI.h @@ -38,16 +38,21 @@ namespace base_ui{ class SimpleUI; enum ItemType { +#ifdef READER_MODE_ENABLED READER_MODE, +#endif BOOKMARK_MANAGER, HISTORY, SCREEN_ZOOM, +#ifdef START_MINIBROWSER_ENABLED START_MINIBROWSER, +#endif FOCUS_MODE, VIEW_MOBILE_WEB, SHARE, SETTINGS, - EXIT_BROWSER + EXIT_BROWSER, + END_OF_RANGE } item; class BROWSER_EXPORT MoreMenuUI -- 2.7.4 From e28d4d5ec1bf1123a34612b1b90776c3d520d12f Mon Sep 17 00:00:00 2001 From: "t.dakowicz" Date: Thu, 13 Aug 2015 15:05:35 +0200 Subject: [PATCH 07/16] Bug TT-94 Fixed bookmarks folder creation bug [Issue#] https://bugs.tizen.org/jira/browse/TT-94 [Problem] User couldn't create new folder for bookmarks. [Cause] Wrong initialization of variable [Solution] The variable initialized with zeros [Verify] MoreMenu -> Add bookmark -> '+' -> type new folder's name. Check if the folder is visible in Bookmark Manager. Change-Id: I630787ae4251cbe6ab4ad53ce23b756996173e3d --- services/BookmarkService/BookmarkService.cpp | 3 +++ services/SimpleUI/SimpleUI.cpp | 26 ++++++++++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/services/BookmarkService/BookmarkService.cpp b/services/BookmarkService/BookmarkService.cpp index 2489359..ac5cce3 100644 --- a/services/BookmarkService/BookmarkService.cpp +++ b/services/BookmarkService/BookmarkService.cpp @@ -330,12 +330,15 @@ int BookmarkService::save_folder(const char *title, int *saved_folder_id, int pa } bp_bookmark_info_fmt info; + std::memset(&info, 0, sizeof(bp_bookmark_info_fmt)); + info.type = 1; info.parent = parent_id; info.sequence = -1; info.is_operator = by_operator; info.access_count = -1; info.editable = 1; + if (title != nullptr && strlen(title) > 0) { info.title = (char *)title; diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 7c821c8..94d6a80 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -1376,7 +1376,8 @@ void SimpleUI::favicon_clicked(void *data, Evas_Object */*obj*/, const char */*e } void SimpleUI::addToBookmarks(int folder_id) -{ BROWSER_LOGD("[%s,%d],", __func__, __LINE__); +{ + BROWSER_LOGD("[%s,%d],", __func__, __LINE__); if (m_favoriteService) { if( m_webEngine && !m_webEngine->getURI().empty()) { m_favoriteService->addToBookmarks(m_webEngine->getURI(), m_webEngine->getTitle(), std::string(), @@ -1387,8 +1388,9 @@ void SimpleUI::addToBookmarks(int folder_id) } void SimpleUI::saveFolder(const char* title,int folder_id, int by_operator) -{ BROWSER_LOGD("[%s,%d],", __func__, __LINE__); - int id = -1; +{ + BROWSER_LOGD("[%s,%d],", __func__, __LINE__); + int id = -1; if (m_favoriteService) m_favoriteService->save_folder(title, &id, folder_id, by_operator); if (id >= 0 ) @@ -1403,20 +1405,16 @@ void SimpleUI::saveFolder(const char* title,int folder_id, int by_operator) void SimpleUI::NewFolder(const char* title,int folder_id, int by_operator) -{ BROWSER_LOGD("[%s,%d],", __func__, __LINE__); +{ int id = -1; if (m_favoriteService) m_favoriteService->save_folder(title, &id, folder_id, by_operator); - if (id >= 0 ) - { BROWSER_LOGD("[%s], Added New Folder", __func__); - } - if (m_favoriteService) - { if( m_webEngine && !m_webEngine->getURI().empty()) - { m_favoriteService->addToBookmarks(m_webEngine->getURI(), m_webEngine->getTitle(), std::string(), - m_webEngine->getSnapshotData(373, 240), - m_webEngine->getFavicon(),(unsigned int)id); - } - } + if (id >= 0) + { + BROWSER_LOGD("[%s], Added New Folder", __func__); + addToBookmarks(id); + m_moreMenuUI->getBookmarkFolderList(getBookmarkFolders()); + } } void SimpleUI::deleteBookmark(void) -- 2.7.4 From f408581c995f49eee8574b284d992ebbc878fb48 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Mon, 17 Aug 2015 15:03:27 +0200 Subject: [PATCH 08/16] Remove unneeded genlist from top buttons. [Issue#] https://bugs.tizen.org/jira/browse/TT-73 [Problem] Uneeded genlist caused scrolling of top buttons. [Cause] N/A [Solution] Removed genlist. [Verify] Check if buttons "Most visited" and "Bookmarks" work. Change-Id: I044d8502be38d55fe7ce9b44c1674f3cf155922c Signed-off-by: Maciej Skrzypkowski --- services/MainUI/MainUI.cpp | 96 ++++++++++++------------------------------ services/MainUI/MainUI.h | 9 ++-- services/MainUI/edc/MainUI.edc | 14 ++---- 3 files changed, 35 insertions(+), 84 deletions(-) diff --git a/services/MainUI/MainUI.cpp b/services/MainUI/MainUI.cpp index 173e306..c6feff8 100644 --- a/services/MainUI/MainUI.cpp +++ b/services/MainUI/MainUI.cpp @@ -53,10 +53,15 @@ struct ItemData{ }; MainUI::MainUI() - : m_gengrid(nullptr) - , m_genListTop(nullptr) + : m_parent(nullptr) + , m_layout(nullptr) + , m_layoutTop(nullptr) + , m_gengrid(nullptr) + , m_genListLeft(nullptr) + , m_genListCenter(nullptr) + , m_genListRight(nullptr) , m_genListBottom(nullptr) - , m_parent(nullptr) + , m_itemClassBottom(nullptr) , m_big_item_class(nullptr) , m_small_item_class(nullptr) , m_bookmark_item_class(nullptr) @@ -164,49 +169,25 @@ void MainUI::show(Evas_Object* parent) void MainUI::showTopButtons() { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - elm_theme_extension_add(nullptr, edjFilePath.c_str()); - m_genListTop = elm_genlist_add(m_layout); - elm_object_part_content_set(m_layout, "elm.swallow.genlistTop", m_genListTop); - elm_genlist_homogeneous_set(m_genListTop, EINA_FALSE); - elm_genlist_multi_select_set(m_genListTop, EINA_FALSE); - elm_genlist_select_mode_set(m_genListTop, ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_genlist_mode_set(m_genListTop, ELM_LIST_LIMIT); - //elm_genlist_decorate_mode_set(m_genListTop, EINA_TRUE); - evas_object_size_hint_weight_set(m_genListTop, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - /*evas_object_smart_callback_add(m_genList, "item,focused", focusItem, this); - evas_object_smart_callback_add(m_genList, "item,unfocused", unFocusItem, nullptr);*/ + m_layoutTop = elm_layout_add(m_layout); - m_itemClassTop = elm_genlist_item_class_new(); - m_itemClassTop->item_style = "top_button_item"; - m_itemClassTop->func.text_get = nullptr; // &listTopItemTextGet; - m_itemClassTop->func.content_get = &listTopItemContentGet; - m_itemClassTop->func.state_get = 0; - m_itemClassTop->func.del = 0; + elm_layout_file_set(m_layoutTop, edjFilePath.c_str(), "top_button_item"); + evas_object_size_hint_weight_set(m_layoutTop, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(m_layoutTop, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(m_layoutTop); - ItemData * id = new ItemData; - id->mainUI = this; - Elm_Object_Item* elmItem = elm_genlist_item_append(m_genListTop, //genlist - m_itemClassTop, //item Class - id, - nullptr, //parent item - ELM_GENLIST_ITEM_NONE,//item type - nullptr, - nullptr //data passed to above function - ); - id->e_item = elmItem; - ItemData * id2 = new ItemData; - id2->mainUI = this; - Elm_Object_Item* elmItem2 = elm_genlist_item_append(m_genListTop, //genlist - m_itemClassTop, //item Class - id2, - nullptr, //parent item - ELM_GENLIST_ITEM_NONE,//item type - nullptr, - nullptr //data passed to above function - ); - id2->e_item = elmItem2; - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + Evas_Object *mvButton = elm_button_add(m_layoutTop); + elm_object_style_set(mvButton, "invisible_button"); + evas_object_smart_callback_add(mvButton, "clicked", tizen_browser::base_ui::MainUI::_mostVisited_clicked, this); + elm_layout_content_set(m_layoutTop, "mostvisited_click", mvButton); + + Evas_Object *bmButton = elm_button_add(m_layoutTop); + elm_object_style_set(bmButton, "invisible_button"); + evas_object_smart_callback_add(bmButton, "clicked", tizen_browser::base_ui::MainUI::_bookmark_clicked, this); + elm_layout_content_set(m_layoutTop, "bookmark_click", bmButton); + + elm_object_part_content_set(m_layout, "elm.swallow.genlistTop", m_layoutTop); } void MainUI::showBottomButton() @@ -244,38 +225,18 @@ void MainUI::showBottomButton() id->e_item = elmItem; } -Evas_Object* MainUI::listTopItemContentGet(void* data, Evas_Object* obj, const char* part) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - if(!strcmp(part, "mostvisited_click")) - { - Evas_Object *mvButton = elm_button_add(obj); - elm_object_style_set(mvButton, "invisible_button"); - evas_object_smart_callback_add(mvButton, "clicked", tizen_browser::base_ui::MainUI::_mostVisited_clicked, data); - return mvButton; - } - else if(!strcmp(part, "bookmark_click")) - { - Evas_Object *bmButton = elm_button_add(obj); - elm_object_style_set(bmButton, "invisible_button"); - evas_object_smart_callback_add(bmButton, "clicked", tizen_browser::base_ui::MainUI::_bookmark_clicked, data); - return bmButton; - } - return nullptr; -} - void MainUI::_mostVisited_clicked(void * data, Evas_Object * /* obj */, void * event_info) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - ItemData* itemData = reinterpret_cast(data); - itemData->mainUI->mostVisitedClicked(std::string()); + MainUI* mainUI = reinterpret_cast(data); + mainUI->mostVisitedClicked(std::string()); } void MainUI::_bookmark_clicked(void * data, Evas_Object * /* obj */, void * event_info) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - ItemData* itemData = reinterpret_cast(data); - itemData->mainUI->bookmarkClicked(std::string()); + MainUI* mainUI = reinterpret_cast(data); + mainUI->bookmarkClicked(std::string()); } void MainUI::_bookmark_manager_clicked(void * data, Evas_Object * /* obj */, void * event_info) @@ -501,7 +462,6 @@ void MainUI::clearItems() BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); clearHistoryGenlist(); clearBookmarkGengrid(); - elm_genlist_clear(m_genListTop); elm_genlist_clear(m_genListBottom); } diff --git a/services/MainUI/MainUI.h b/services/MainUI/MainUI.h index bd77d53..c62a301 100644 --- a/services/MainUI/MainUI.h +++ b/services/MainUI/MainUI.h @@ -76,16 +76,15 @@ private: static void _bookmark_clicked(void * data, Evas_Object * obj, void * event_info); static void _bookmark_manager_clicked(void * data, Evas_Object * obj, void * event_info); private: - Evas_Object *m_genListTop; + Evas_Object *m_parent; + Evas_Object *m_layout; + Evas_Object *m_layoutTop; + Evas_Object *m_gengrid; Evas_Object *m_genListLeft; Evas_Object *m_genListCenter; Evas_Object *m_genListRight; - Elm_Genlist_Item_Class *m_itemClassTop; Evas_Object *m_genListBottom; Elm_Genlist_Item_Class *m_itemClassBottom; - Evas_Object *m_gengrid; - Evas_Object *m_layout; - Evas_Object *m_parent; Elm_Gengrid_Item_Class * m_big_item_class; Elm_Gengrid_Item_Class * m_small_item_class; Elm_Gengrid_Item_Class * m_bookmark_item_class; diff --git a/services/MainUI/edc/MainUI.edc b/services/MainUI/edc/MainUI.edc index f094d4e..a81e52a 100644 --- a/services/MainUI/edc/MainUI.edc +++ b/services/MainUI/edc/MainUI.edc @@ -967,7 +967,7 @@ group { name: "elm/gengrid/item/grid_item/default"; } } -group { name: "elm/genlist/item/top_button_item/default"; +group { name: "top_button_item"; min: 1920 181; max: 1920 181; data.item: "texts" "mostvisited_text bookmark_text"; @@ -1045,8 +1045,6 @@ group { name: "elm/genlist/item/top_button_item/default"; visible: 1; align: 0 0; fixed: 1 1; - min: 348 64; - max: 348 64; rel1 { relative: 0.0 0.0; to: "mostvisited_button";} rel2 { relative: 1.0 1.0; to: "mostvisited_button";} color_class: transparent; @@ -1062,8 +1060,6 @@ group { name: "elm/genlist/item/top_button_item/default"; visible: 1; align: 0 0; fixed: 1 1; - min: 348 64; - max: 348 64; rel1 { relative: 0.0 0.0; to: "mostvisited_button";} rel2 { relative: 1.0 1.0; to: "mostvisited_button";} } @@ -1125,8 +1121,6 @@ group { name: "elm/genlist/item/top_button_item/default"; visible: 1; align: 0 0; fixed: 1 1; - min: 348 64; - max: 348 64; rel1 { relative: 0.0 0.0; to: "bookmark_button";} rel2 { relative: 1.0 1.0; to: "bookmark_button";} color_class: transparent; @@ -1142,10 +1136,8 @@ group { name: "elm/genlist/item/top_button_item/default"; visible: 1; align: 0 0; fixed: 1 1; - min: 348 64; - max: 348 64; - rel1 { relative: 0.0 0.0; to: "bookmark_over";} - rel2 { relative: 1.0 1.0; to: "bookmark_over";} + rel1 { relative: 0.0 0.0; to: "bookmark_button";} + rel2 { relative: 1.0 1.0; to: "bookmark_button";} color_class: transparent; } } -- 2.7.4 From a76afd26f9fdd471633a68f0e383ac3bc286ae80 Mon Sep 17 00:00:00 2001 From: Albert Malewski Date: Mon, 17 Aug 2015 14:22:02 +0200 Subject: [PATCH 09/16] Added action on "Exit browser" button [Issue#] https://bugs.tizen.org/jira/browse/TT-131 [Problem] "Exit browser" in More Menu is not working. [Cause] There was no action connected to "exit browser" button. [Solution] Added function _exitClicked that calls elm_exit(). [Verify] Browser -> MoreMenu -> Exit browser -> Obs Browser should be closed. Change-Id: I14473625d1b8ba9d60e9049005193b63e3a66208 --- services/MoreMenuUI/MoreMenuUI.cpp | 17 +++++++++++++++-- services/MoreMenuUI/MoreMenuUI.h | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/services/MoreMenuUI/MoreMenuUI.cpp b/services/MoreMenuUI/MoreMenuUI.cpp index ff31301..3edef9d 100644 --- a/services/MoreMenuUI/MoreMenuUI.cpp +++ b/services/MoreMenuUI/MoreMenuUI.cpp @@ -465,17 +465,24 @@ void MoreMenuUI::_thumbSelected(void* data, Evas_Object*, void*) break; #ifdef READER_MODE_ENABLED case READER_MODE: - //TODO: Implement reader mode + //TODO: Implement reader mode + break; #endif case SCREEN_ZOOM: + break; #ifdef START_MINIBROWSER_ENABLED case START_MINIBROWSER: - //TODO: Implement minibrowser launching + //TODO: Implement minibrowser launching + break; #endif case FOCUS_MODE: + break; case VIEW_MOBILE_WEB: + break; case SHARE: + break; case EXIT_BROWSER: + _exitClicked(); break; } } @@ -499,6 +506,12 @@ void MoreMenuUI::clearItems() elm_cache_all_flush(); } +void MoreMenuUI::_exitClicked() +{ + BROWSER_LOGD("[%s:%d]", __PRETTY_FUNCTION__, __LINE__); + elm_exit(); +} + //void MoreMenuUI::focusItem(void*, Evas_Object*, void* event_info) //{ // BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); diff --git a/services/MoreMenuUI/MoreMenuUI.h b/services/MoreMenuUI/MoreMenuUI.h index 1d87456..0bb5b1e 100644 --- a/services/MoreMenuUI/MoreMenuUI.h +++ b/services/MoreMenuUI/MoreMenuUI.h @@ -81,6 +81,7 @@ private: static char* _grid_text_get(void *data, Evas_Object *obj, const char *part); static Evas_Object * _grid_content_get(void *data, Evas_Object *obj, const char *part); static void _thumbSelected(void * data, Evas_Object * obj, void * event_info); + static void _exitClicked(); static Evas_Object* listItemContentGet(void *data, Evas_Object *obj, const char *part); static char* listItemTextGet(void *data, Evas_Object *obj, const char *part); -- 2.7.4 From 7ef0447eb77b0dbd6c66c2c2827f8b1e988e9e53 Mon Sep 17 00:00:00 2001 From: Marcin Lapinski Date: Tue, 18 Aug 2015 11:46:41 +0200 Subject: [PATCH 10/16] Set callback for bookmark gengrid item instead of items thumbnail. [Issue#] https://bugs.tizen.org/jira/browse/TT-135 [Problem] Clicking on bookmark folder text doesn't work. [Cause] Callback was set on thumbnail instead of on whole item. [Sollution] Move callback to bookmark gengrid item click. [Verify] 1. Run browser 2. Create some bookmark folders 3. Open More Menu -> Bookmark manager 4. Click on some bookmark folder description 5. Bookmark folder shold be opened. Additional changes: - Changed some function names to make code more self-explaining. - Removed redundant focus managment callbacks causing problems in the current approach. Change-Id: Ibddc457a7cfdc19f7b68ce4163f4b2ae04d793db --- services/BookmarkManagerUI/BookmarkManagerUI.cpp | 59 ++++++------------------ services/BookmarkManagerUI/BookmarkManagerUI.h | 11 ++--- 2 files changed, 18 insertions(+), 52 deletions(-) diff --git a/services/BookmarkManagerUI/BookmarkManagerUI.cpp b/services/BookmarkManagerUI/BookmarkManagerUI.cpp index 9a0be45..2ae1617 100644 --- a/services/BookmarkManagerUI/BookmarkManagerUI.cpp +++ b/services/BookmarkManagerUI/BookmarkManagerUI.cpp @@ -80,15 +80,12 @@ void BookmarkManagerUI::show(Evas_Object* parent) elm_object_part_content_set(b_mm_layout, "elm.swallow.grid", m_gengrid); elm_object_style_set(m_gengrid, "back_ground"); - evas_object_smart_callback_add(m_gengrid, "item,focused", focusItem, nullptr); - evas_object_smart_callback_add(m_gengrid, "item,unfocused", unFocusItem, nullptr); - evas_object_smart_callback_add(m_gengrid, "activated", _itemSelected, this); if (!m_item_class) { m_item_class = elm_gengrid_item_class_new(); m_item_class->item_style = "grid_bm_item"; - m_item_class->func.text_get = _grid_text_get; - m_item_class->func.content_get = _grid_content_get; + m_item_class->func.text_get = _grid_folder_text_get; + m_item_class->func.content_get = _grid_folder_content_get; m_item_class->func.state_get = nullptr; m_item_class->func.del = nullptr; } @@ -298,7 +295,7 @@ void BookmarkManagerUI::addBookmarkFolderItem(std::shared_ptritem = hi; itemData->bookmarkManagerUI.reset(this); - Elm_Object_Item* BookmarkFolderView = elm_gengrid_item_append(m_gengrid, m_item_class, itemData, nullptr, this); + Elm_Object_Item* BookmarkFolderView = elm_gengrid_item_append(m_gengrid, m_item_class, itemData, _folderItemClicked, itemData); m_map_bookmark_folder_views.insert(std::pair(hi->getAddress(),BookmarkFolderView)); elm_gengrid_item_selected_set(BookmarkFolderView, EINA_FALSE); setEmptyGengrid(false); @@ -322,7 +319,7 @@ void BookmarkManagerUI::addBookmarkItem(std::shared_ptritem = hi; itemData->bookmarkManagerUI.reset(this); - Elm_Object_Item* BookmarkView = elm_gengrid_item_append(m_gengrid, m_detail_item_class, itemData, nullptr, this); + Elm_Object_Item* BookmarkView = elm_gengrid_item_append(m_gengrid, m_detail_item_class, itemData, _bookmarkItemClicked, itemData); m_map_bookmark_folder_views.insert(std::pair(hi->getAddress(),BookmarkView)); elm_gengrid_item_selected_set(BookmarkView, EINA_FALSE); setEmptyGengrid(false); @@ -339,7 +336,7 @@ void BookmarkManagerUI::addBookmarkItems(std::vector image = itemData->item->getThumbnail(); + std::shared_ptr image = itemData->item->getThumbnail(); if (image) { - thumb = tizen_browser::tools::EflTools::getEvasImage(image, itemData->bookmarkManagerUI->m_parent); + thumb = tools::EflTools::getEvasImage(image, itemData->bookmarkManagerUI->m_parent); } return thumb; } @@ -388,7 +385,6 @@ Evas_Object * BookmarkManagerUI::_grid_content_get(void *data, Evas_Object *obj, if (thumbButton != nullptr) { elm_object_style_set(thumbButton, "thumbButton"); - evas_object_smart_callback_add(thumbButton, "clicked", tizen_browser::base_ui::BookmarkManagerUI::_thumbSelected, data); } return thumbButton; } @@ -446,7 +442,6 @@ Evas_Object * BookmarkManagerUI::_grid_bookmark_content_get(void *data, Evas_Obj if (thumbButton != nullptr) { elm_object_style_set(thumbButton, "thumbButton"); - evas_object_smart_callback_add(thumbButton, "clicked", tizen_browser::base_ui::BookmarkManagerUI::_bookmark_thumbSelected, data); } return thumbButton; } @@ -454,11 +449,12 @@ Evas_Object * BookmarkManagerUI::_grid_bookmark_content_get(void *data, Evas_Obj return nullptr; } -void BookmarkManagerUI::_itemSelected(void * data, Evas_Object *, void * event_info) +void BookmarkManagerUI::_bookmarkItemClicked(void * data, Evas_Object *, void * event_info) { + BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); (void)data; (void)event_info; -#if 0 +/* if ((data != nullptr) && (event_info != nullptr)) { Elm_Object_Item * selected = static_cast(event_info); @@ -469,11 +465,12 @@ void BookmarkManagerUI::_itemSelected(void * data, Evas_Object *, void * event_i self->bookmarkClicked(itemData->item); } } -#endif +*/ } -void BookmarkManagerUI::_thumbSelected(void * data, Evas_Object *, void *) +void BookmarkManagerUI::_folderItemClicked(void * data, Evas_Object *, void *) { + BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); if (data != nullptr) { BookmarkFolderItemData * itemData = static_cast(data); @@ -483,7 +480,6 @@ void BookmarkManagerUI::_thumbSelected(void * data, Evas_Object *, void *) } } - void BookmarkManagerUI::_bookmark_thumbSelected(void * data, Evas_Object *, void *) { (void)data; @@ -508,7 +504,6 @@ void BookmarkManagerUI::clearItems() elm_cache_all_flush(); } - void BookmarkManagerUI::updateGengrid() { elm_genlist_clear(m_genList); @@ -516,31 +511,5 @@ void BookmarkManagerUI::updateGengrid() m_map_bookmark_folder_views.clear(); } -void BookmarkManagerUI::focusItem(void*, Evas_Object*, void* event_info) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - if (event_info != nullptr) - { - Elm_Object_Item *item = static_cast(event_info); - elm_object_item_signal_emit( item, "mouse,in", "over2"); - - // selected manually - elm_gengrid_item_selected_set(item, EINA_TRUE); - } -} - -void BookmarkManagerUI::unFocusItem(void*, Evas_Object*, void* event_info) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - if (event_info != nullptr) - { - Elm_Object_Item *item = static_cast(event_info); - elm_object_item_signal_emit( item, "mouse,out", "over2"); - - // unselected manually - elm_gengrid_item_selected_set(item, EINA_FALSE); - } -} - } } diff --git a/services/BookmarkManagerUI/BookmarkManagerUI.h b/services/BookmarkManagerUI/BookmarkManagerUI.h index 419f508..eeb2a57 100644 --- a/services/BookmarkManagerUI/BookmarkManagerUI.h +++ b/services/BookmarkManagerUI/BookmarkManagerUI.h @@ -61,13 +61,13 @@ public: boost::signals2::signal bookmarkFolderClicked; private: - static char* _grid_text_get(void *data, Evas_Object *obj, const char *part); - static Evas_Object * _grid_content_get(void *data, Evas_Object *obj, const char *part); + static char* _grid_folder_text_get(void *data, Evas_Object *obj, const char *part); + static Evas_Object * _grid_folder_content_get(void *data, Evas_Object *obj, const char *part); static char* _grid_bookmark_text_get(void *data, Evas_Object *obj, const char *part); static Evas_Object * _grid_bookmark_content_get(void *data, Evas_Object *obj, const char *part); - static void _itemSelected(void * data, Evas_Object * obj, void * event_info); - static void _thumbSelected(void * data, Evas_Object * obj, void * event_info); + static void _bookmarkItemClicked(void * data, Evas_Object * obj, void * event_info); + static void _folderItemClicked(void * data, Evas_Object * obj, void * event_info); static void _bookmark_thumbSelected(void * data, Evas_Object *, void *); void NewFolderCreate(Evas_Object * popup_content); @@ -95,9 +95,6 @@ private: std::string edjFilePath; std::string m_folder; bool m_gengridSetup; - - static void focusItem(void*, Evas_Object*, void* event_info); - static void unFocusItem(void*, Evas_Object*, void* event_info); }; } -- 2.7.4 From fddb1dac5662e51a56cc87b6b08224a1cc4c058e Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Mon, 17 Aug 2015 16:02:17 +0200 Subject: [PATCH 11/16] Change view of Most Visited tiles. [Issue#] https://bugs.tizen.org/jira/browse/TT-73 [Problem] Font sizes, colors, highlight were wrong. [Cause] N/A [Solution] Changed to proper ones. [Verify] Check tiles title and URL font and it's location acording to guideline. Check backgrounds. Check highliting tiles. Change-Id: I8ab0b869a72f6baedaf3832e58edb88c40135940 Signed-off-by: Maciej Skrzypkowski --- services/MainUI/edc/MainUI.edc | 867 +++++++++++++++++++++++------------------ 1 file changed, 478 insertions(+), 389 deletions(-) diff --git a/services/MainUI/edc/MainUI.edc b/services/MainUI/edc/MainUI.edc index a81e52a..ba358bf 100644 --- a/services/MainUI/edc/MainUI.edc +++ b/services/MainUI/edc/MainUI.edc @@ -100,11 +100,7 @@ group { name: "mv_bookmarks"; } color_class{ name: "focusBgColor"; - color: 69 143 255 255; - } - color_class{ - name: "highlightBgColor"; - color: 69 143 255 102; + color: 0 119 246 255; } color_class{ name: "imageHighlight"; @@ -343,425 +339,518 @@ group { name: "mv_bookmarks"; } group { name: "elm/genlist/item/big_grid_item/default"; - data.item: "texts" "page_title page_url"; - data.item: "contents" "elm.thumbnail elm.thumbButton"; - min: 600 614; - max: 600 614; - images { - image: "web_frame_selected.png" COMP; - image: "ico_bg_round_shape_37x37.png" COMP; - } - parts { - part { name: "bg"; - type: RECT; - mouse_events: 0; - description { state: "default" 0.0; - min: 784 614; - max: 784 614; - visible: 1; - color: 231 231 231 255; - } - description { state: "selected"; - inherit: "default" 0.0; - color: 70 143 254 255; - } - } - - part { name: "elm.thumbnail"; - type: SWALLOW; - description { state: "default" 0.0; - fixed: 1 0; - align: 0.0 0.0; - color : 231 231 231 255; - min: 784 526; - max: 784 526; - rel1 { - relative: 0.0 0.0; to: "bg"; - } - rel2 { - relative: 1.0 1.0; to: "bg"; - } - } - description { state: "selected"; - inherit: "default" 0.0; - } - } - - part { name: "focus_highlight"; - type: IMAGE; - description { state: "default" 0.0; - rel1 { - to: "elm.thumbnail"; - relative: 0.0 0.0; - } - rel2 { - to: "elm.thumbnail"; - relative: 1.0 1.0; - } - image.normal: "web_frame_selected.png"; - image.border: 8 8 8 0; - image.border_scale: 1; - image.middle: NONE; - visible: 0; - } - description { state: "selected"; - inherit: "default" 0.0; - visible: 1; - } - } - - part { name: "background"; - type: RECT; - description { state: "default" 0.0; - min: 784 87; - max: 784 87; - align: 0.0 0.0; - color: 231 231 231 255; - rel1 { - to: "elm.thumbnail"; - relative: 0.0 1.0; - } - rel2 { - relative: 1.0 1.0; - } - } - description { state: "selected" 0.0; - inherit: "default" 0.0; - color: 70 143 254 255; - } - } + data.item: "texts" "page_title page_url"; + data.item: "contents" "elm.thumbnail elm.thumbButton"; + min: 600 614; + max: 600 614; + images { + image: "web_frame_selected.png" COMP; + image: "ico_bg_round_shape_37x37.png" COMP; + } + parts { + part { name: "bg"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + min: 784 614; + max: 784 614; + visible: 1; + color: 231 231 231 255; + } + } - part { name: "page_title"; - type: TEXT; - description { state: "default" 0.0; - min: 700 48; - max: 700 48; - align: 0.0 0.5; - rel1 { - to: "background"; - relative: 0.0 0.0; - offset: 17 0; - } - rel2 { - to: "background"; - relative: 1.0 1.0; - } - color: 51 51 51 255; - text { - text: "Web page title"; - font: "Sans"; - size: 27; - align: 0 0.5; - } - } - description { state: "focus" 0.0; - inherit: "default" 0.0; - //color: focusTextColor; + part { name: "elm.thumbnail"; + type: SWALLOW; + description { state: "default" 0.0; + fixed: 1 0; + align: 0.0 0.0; + color : 231 231 231 255; + min: 784 498; + max: 784 498; + rel1 { + relative: 0.0 0.0; to: "bg"; } - description { state: "highlight" 0.0; - inherit: "default" 0.0; - //color: highlightTextColor; + rel2 { + relative: 1.0 1.0; to: "bg"; } - } + } + description { state: "selected"; + inherit: "default" 0.0; + } + } - part { name: "page_url"; - type: TEXT; - description { state: "default" 0.0; - min: 700 48; - max: 700 48; - align: 0 0.5; - rel1 { - to: "page_title"; - relative: 0.0 1.0; - } - rel2 { - to: "page_title"; - relative: 1.0 1.0; - } - color: 153 153 153 255; - text { - text: "Web page url"; - font: "Sans"; - size: 24; - align: 0 0.5; - } + part { name: "border_top"; + type: RECT; + description { state: "default" 0.0; + color_class: focusBgColor; + min: 0 6; + max: -1 6; + align: 0 0; + rel1 { + to: "elm.thumbnail"; + relative: 0.0 0.0; } - description { state: "focus" 0.0; - inherit: "default" 0.0; - //color: focusTextColor; + rel2 { + to: "elm.thumbnail"; + relative: 1.0 1.0; } - description { state: "highlight" 0.0; - inherit: "default" 0.0; - //color: highlightTextColor; + visible: 0; + } + description { state: "selected"; + inherit: "default" 0.0; + visible: 1; + } + } + + part { name: "border_left"; + type: RECT; + description { state: "default" 0.0; + color_class: focusBgColor; + min: 6 0; + max: 6 -1; + align: 0 0; + rel1 { + to: "elm.thumbnail"; + relative: 0.0 0.0; } + rel2 { + to: "elm.thumbnail"; + relative: 1.0 1.0; } + visible: 0; + } + description { state: "selected"; + inherit: "default" 0.0; + visible: 1; + } + } - part { name: "elm.thumbButton"; - type: SWALLOW; - description { state: "default" 0.0; - rel1.to: "elm.thumbnail"; - rel2.to: "elm.thumbnail"; - } - } - - part { name: "over2"; - type: RECT; - mouse_events: 1; - repeat_events: 1; - description { state: "default" 0.0; - color: 0 0 0 0; - rel1.to: "bg"; - rel2.to: "background"; - } - } - part { name: "over3"; - type: RECT; - mouse_events: 1; - repeat_events: 1; - description { state: "default" 0.0; - color: 0 0 0 0; - rel1.to: "background"; - rel2.to: "background"; - } - } - } - - programs{ - program { name: "mouse_in"; - signal: "mouse,in"; - source: "over2"; - action: STATE_SET "selected" 0.0; - target: "background"; - target: "focus_highlight"; - target: "bg"; - } - program { name: "mouse_out"; - signal: "mouse,out"; - source: "over2"; - action: STATE_SET "default" 0.0; - target: "background"; - target: "focus_highlight"; - target: "bg"; - } - } -} - -group { name: "elm/genlist/item/small_grid_item/default"; - data.item: "texts" "page_title page_url"; - data.item: "contents" "elm.thumbnail elm.thumbButton"; - images { - image: "web_frame_selected.png" COMP; - image: "ico_bg_round_shape_37x37.png" COMP; - } - parts { - part { name: "border"; + part { name: "border_right"; type: RECT; description { state: "default" 0.0; - min: 378 320; - max: 378 320; + color_class: focusBgColor; + min: 6 0; + max: 6 -1; + align: 1 0; + rel1 { + to: "elm.thumbnail"; + relative: 0.0 0.0; + } + rel2 { + to: "elm.thumbnail"; + relative: 1.0 1.0; + } visible: 0; } + description { state: "selected"; + inherit: "default" 0.0; + visible: 1; + } } - part { name: "bg"; - type: RECT; - mouse_events: 0; - description { state: "default" 0.0; - min: 378 294; - max: 378 294; - visible: 1; - color: 231 231 231 255; + part { name: "background"; + type: RECT; + description { state: "default" 0.0; + min: 784 116; + max: 784 116; align: 0.0 0.0; + color: 113 128 147 255; + visible: 1; rel1 { - relative: 0.0 0.0; to: "border"; + to: "elm.thumbnail"; + relative: 0.0 1.0; } rel2 { - relative: 1.0 1.0; to: "border"; + relative: 1.0 1.0; } - } - description { state: "selected"; - inherit: "default" 0.0; - color: 70 143 254 255; - } - } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + color: 0 119 246 255; + } + } - part { name: "elm.thumbnail"; - type: SWALLOW; - description { state: "default" 0.0; - fixed: 1 0; - align: 0.0 0.0; - color : 231 231 231 255; - min: 342 203; - max: 342 203; - rel1 { - relative: 0.0 0.0; to: "bg"; - } - rel2 { - relative: 1.0 1.0; to: "bg"; - } - } - description { state: "selected"; - inherit: "default" 0.0; - } - } + part { name: "page_title"; + type: TEXT; + description { state: "default" 0.0; + min: 700 36; + max: 700 36; + align: 0.0 0.0; + color: 255 255 255 255; + rel1 { + to: "background"; + relative: 0.0 0.0; + offset: 32 22; + } + rel2 { + to: "background"; + relative: 1.0 1.0; + } + text { + text: "Web page title"; + font: "Sans"; + size: 36; + align: 0 0.5; + } + } + description { state: "focus" 0.0; + inherit: "default" 0.0; + color_class: focusTextColor; + } + description { state: "highlight" 0.0; + inherit: "default" 0.0; + //color_class: highlightTextColor; + } + } - part { name: "focus_highlight"; - type: IMAGE; - description { state: "default" 0.0; - rel1 { - to: "elm.thumbnail"; - relative: 0.0 0.0; - } - rel2 { - to: "elm.thumbnail"; - relative: 1.0 1.0; - } - image.normal: "web_frame_selected.png"; - image.border: 8 8 8 0; - image.border_scale: 1; - image.middle: NONE; - visible: 0; - } - description { state: "selected"; - inherit: "default" 0.0; - visible: 1; - } - } + part { name: "page_url"; + type: TEXT; + description { state: "default" 0.0; + min: 700 28; + max: 700 28; + align: 0 0.0; + color: 255 255 255 255; + rel1 { + to: "page_title"; + relative: 0.0 1.0; + offset: 0 10; + } + rel2 { + to: "background"; + relative: 1.0 1.0; + } + text { + text: "Web page url"; + font: "Sans"; + size: 28; + align: 0 0.5; + } + } + description { state: "focus" 0.0; + inherit: "default" 0.0; + color_class: focusTextColor; + } + description { state: "highlight" 0.0; + inherit: "default" 0.0; + //color_class: highlightTextColor; + } + } - part { name: "background"; - type: RECT; - description { state: "default" 0.0; - min: 342 87; - max: 342 87; - align: 0.0 0.0; - color: 231 231 231 255; - rel1 { - to: "elm.thumbnail"; - relative: 0.0 1.0; - } - rel2 { - relative: 1.0 1.0; - } - } - description { state: "selected" 0.0; - inherit: "default" 0.0; - color: 70 143 254 255; - } - } + part { name: "elm.thumbButton"; + type: SWALLOW; + description { state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + } + } - part { name: "page_title"; - type: TEXT; - description { state: "default" 0.0; - min: 320 48; - max: 320 48; - align: 0.0 0.5; - rel1 { - to: "background"; - relative: 0.0 0.0; - offset: 17 0; - } - rel2 { - to: "background"; - relative: 1.0 1.0; - } - color: 51 51 51 255; - text { - text: "Web page title"; - font: "Sans"; - size: 27; - align: 0 0.5; - } + part { name: "over2"; + type: RECT; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + color: 0 0 0 0; + rel1.to: "bg"; + rel2.to: "background"; + } + } + part { name: "over3"; + type: RECT; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + color: 0 0 0 0; + rel1.to: "background"; + rel2.to: "background"; + } + } + } + + programs{ + program { name: "mouse_in"; + signal: "mouse,in"; + source: "over2"; + action: STATE_SET "selected" 0.0; + target: "background"; + target: "border_top"; + target: "border_left"; + target: "border_right"; + } + program { name: "mouse_out"; + signal: "mouse,out"; + source: "over2"; + action: STATE_SET "default" 0.0; + target: "background"; + target: "border_top"; + target: "border_left"; + target: "border_right"; + } + } +} + +group { name: "elm/genlist/item/small_grid_item/default"; + data.item: "texts" "page_title page_url"; + data.item: "contents" "elm.thumbnail elm.thumbButton"; + images { + image: "web_frame_selected.png" COMP; + image: "ico_bg_round_shape_37x37.png" COMP; + } + parts { + part { name: "container"; + type: RECT; + description { state: "default" 0.0; + min: 378 320; + max: 378 320; + visible: 0; + } + } + + part { name: "bg"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + min: 378 294; + max: 378 294; + visible: 1; + color: 231 231 231 255; + align: 0.0 0.0; + rel1 { + relative: 0.0 0.0; to: "container"; } - description { state: "focus" 0.0; - inherit: "default" 0.0; - //color: focusTextColor; + rel2 { + relative: 1.0 1.0; to: "container"; } - description { state: "highlight" 0.0; - inherit: "default" 0.0; - //color: highlightTextColor; + } + } + + part { name: "elm.thumbnail"; + type: SWALLOW; + description { state: "default" 0.0; + fixed: 1 0; + align: 0.0 0.0; + color : 231 231 231 255; + min: 378 198; + max: 378 198; + rel1 { + relative: 0.0 0.0; to: "bg"; } - } + rel2 { + relative: 1.0 1.0; to: "bg"; + } + } + description { state: "selected"; + inherit: "default" 0.0; + } + } - part { name: "page_url"; - type: TEXT; - description { state: "default" 0.0; - min: 320 48; - max: 320 48; - align: 0 0.5; - rel1 { - to: "page_title"; - relative: 0.0 1.0; - } - rel2 { - to: "page_title"; - relative: 1.0 1.0; - } - color: 153 153 153 255; - text { - text: "Web page url"; - font: "Sans"; - size: 24; - align: 0 0.5; - } + part { name: "border_top"; + type: RECT; + description { state: "default" 0.0; + color_class: focusBgColor; + min: 0 6; + max: -1 6; + align: 0 0; + rel1 { + to: "elm.thumbnail"; + relative: 0.0 0.0; } - description { state: "focus" 0.0; - inherit: "default" 0.0; - //color: focusTextColor; + rel2 { + to: "elm.thumbnail"; + relative: 1.0 1.0; } - description { state: "highlight" 0.0; - inherit: "default" 0.0; - //color: highlightTextColor; + visible: 0; + } + description { state: "selected"; + inherit: "default" 0.0; + visible: 1; + } + } + + part { name: "border_left"; + type: RECT; + description { state: "default" 0.0; + color_class: focusBgColor; + min: 6 0; + max: 6 -1; + align: 0 0; + rel1 { + to: "elm.thumbnail"; + relative: 0.0 0.0; } + rel2 { + to: "elm.thumbnail"; + relative: 1.0 1.0; } + visible: 0; + } + description { state: "selected"; + inherit: "default" 0.0; + visible: 1; + } + } - part { name: "elm.thumbButton"; - type: SWALLOW; - description { state: "default" 0.0; - rel1.to: "elm.thumbnail"; - rel2.to: "elm.thumbnail"; - } - } + part { name: "border_right"; + type: RECT; + description { state: "default" 0.0; + color_class: focusBgColor; + min: 6 0; + max: 6 -1; + align: 1 0; + rel1 { + to: "elm.thumbnail"; + relative: 0.0 0.0; + } + rel2 { + to: "elm.thumbnail"; + relative: 1.0 1.0; + } + visible: 0; + } + description { state: "selected"; + inherit: "default" 0.0; + visible: 1; + } + } - part { name: "over2"; - type: RECT; - mouse_events: 1; - repeat_events: 1; - description { state: "default" 0.0; - color: 0 0 0 0; - rel1.to: "bg"; - rel2.to: "background"; - } - } - part { name: "over3"; - type: RECT; - mouse_events: 1; - repeat_events: 1; - description { state: "default" 0.0; - color: 0 0 0 0; - rel1.to: "background"; - rel2.to: "background"; - } - } - } + part { name: "background"; + type: RECT; + description { state: "default" 0.0; + min: 378 96; + max: 378 96; + align: 0.0 0.0; + color: 113 128 147 255; + visible: 1; + rel1 { + to: "elm.thumbnail"; + relative: 0.0 1.0; + } + rel2 { + relative: 1.0 1.0; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + color: 0 119 246 255; + } + } - programs{ - program { name: "mouse_in"; - signal: "mouse,in"; - source: "over2"; - action: STATE_SET "selected" 0.0; - target: "background"; - target: "focus_highlight"; - target: "bg"; - } - program { name: "mouse_out"; - signal: "mouse,out"; - source: "over2"; - action: STATE_SET "default" 0.0; - target: "background"; - target: "focus_highlight"; - target: "bg"; - } - } + part { name: "page_title"; + type: TEXT; + description { state: "default" 0.0; + min: 314 28; + max: 314 28; + align: 0.0 0.0; + color: 255 255 255 255; + rel1 { + to: "background"; + relative: 0.0 0.0; + offset: 32 18; + } + rel2 { + to: "background"; + relative: 1.0 1.0; + } + text { + text: "Web page title"; + font: "Sans"; + size: 28; + align: 0 0.0; + } + } + description { state: "focus" 0.0; + inherit: "default" 0.0; + color_class: focusTextColor; + } + description { state: "highlight" 0.0; + inherit: "default" 0.0; + //color_class: highlightTextColor; + } + } + + part { name: "page_url"; + type: TEXT; + description { state: "default" 0.0; + min: 314 24; + max: 314 24; + align: 0 0.0; + color: 255 255 255 255; + rel1 { + to: "page_title"; + relative: 0.0 1.0; + offset: 0 8; + } + rel2 { + to: "background"; + relative: 1.0 1.0; + } + text { + text: "Web page url"; + font: "Sans"; + size: 24; + align: 0 0.5; + } + } + description { state: "focus" 0.0; + inherit: "default" 0.0; + color_class: focusTextColor; + } + description { state: "highlight" 0.0; + inherit: "default" 0.0; + //color_class: highlightTextColor; + } + } + + part { name: "elm.thumbButton"; + type: SWALLOW; + description { state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + } + } + + part { name: "over2"; + type: RECT; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + color: 0 0 0 0; + rel1.to: "bg"; + rel2.to: "background"; + } + } + + part { name: "over3"; + type: RECT; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + color: 0 0 0 0; + rel1.to: "background"; + rel2.to: "background"; + } + } + } + + programs { + program { name: "mouse_in"; + signal: "mouse,in"; + source: "over2"; + action: STATE_SET "selected" 0.0; + target: "background"; + target: "border_top"; + target: "border_left"; + target: "border_right"; + } + program { name: "mouse_out"; + signal: "mouse,out"; + source: "over2"; + action: STATE_SET "default" 0.0; + target: "background"; + target: "border_top"; + target: "border_left"; + target: "border_right"; + } + } } group { name: "elm/gengrid/item/grid_item/default"; -- 2.7.4 From 2a185292ceb2ec7d3b852bb9b5ddd94d62bce024 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Wed, 19 Aug 2015 11:13:52 +0200 Subject: [PATCH 12/16] Add removing http prefix from URL, add preventing from loading view two times. [Issue#] https://bugs.tizen.org/jira/browse/TT-73 [Problem] Full URL was shown, second click on button caused hiding view. [Cause] N/A [Solution] Parsing URL, preventing second view show. [Verify] Check URL on "Most visited" tiles, check if second click on "Most visited" or "Bookmark" button causes hiding view. Change-Id: I0b043c75e2779ae277620cc16d14c221da64df22 Signed-off-by: Maciej Skrzypkowski --- services/MainUI/MainUI.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/services/MainUI/MainUI.cpp b/services/MainUI/MainUI.cpp index c6feff8..8e4afd7 100644 --- a/services/MainUI/MainUI.cpp +++ b/services/MainUI/MainUI.cpp @@ -31,6 +31,9 @@ namespace tizen_browser{ namespace base_ui{ const int SMALL_TILES_ROWS = 2; +const int SUFIX_CHAR_DEL = 1; +const char * HTTP_PREFIX = "http://"; +const char * HTTPS_PREFIX = "https://"; EXPORT_SERVICE(MainUI, "org.tizen.browser.mainui") @@ -229,6 +232,8 @@ void MainUI::_mostVisited_clicked(void * data, Evas_Object * /* obj */, void * e { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); MainUI* mainUI = reinterpret_cast(data); + if (elm_object_part_content_get(mainUI->m_layout, "elm.swallow.left")) // check if most visited view is already set + return; mainUI->mostVisitedClicked(std::string()); } @@ -236,6 +241,8 @@ void MainUI::_bookmark_clicked(void * data, Evas_Object * /* obj */, void * even { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); MainUI* mainUI = reinterpret_cast(data); + if (elm_object_part_content_get(mainUI->m_layout, "elm.swallow.grid")) // check if bookmark view is already set + return; mainUI->bookmarkClicked(std::string()); } @@ -323,14 +330,21 @@ void MainUI::addBookmarkItems(std::vector(data); - if (!strcmp(part, "page_title")) { - return strdup(itemData->item->getTitle().c_str()); - } - if (!strcmp(part, "page_url")) { - return strdup(itemData->item->getUrl().c_str()); - } - return strdup(""); + HistoryItemData *itemData = reinterpret_cast(data); + if (!strcmp(part, "page_title")) { + return strdup(itemData->item->getTitle().c_str()); + } + if (!strcmp(part, "page_url")) { + if (itemData->item->getUrl().find(HTTPS_PREFIX) == 0) { + size_t len = strlen(HTTPS_PREFIX); + return strdup(itemData->item->getUrl().substr(len, itemData->item->getUrl().size() - len - SUFIX_CHAR_DEL).c_str()); // remove https prefix + } else if (itemData->item->getUrl().find(HTTP_PREFIX) == 0) { + size_t len = strlen(HTTP_PREFIX); + return strdup(itemData->item->getUrl().substr(len, itemData->item->getUrl().size() - len - SUFIX_CHAR_DEL).c_str()); // remove http prefix + } + return strdup(itemData->item->getUrl().c_str()); + } + return strdup(""); } char* MainUI::_grid_bookmark_text_get(void *data, Evas_Object *obj, const char *part) -- 2.7.4 From 4f9c8713e339024f2180079ba03df5c1779638f2 Mon Sep 17 00:00:00 2001 From: Albert Malewski Date: Tue, 18 Aug 2015 13:02:37 +0200 Subject: [PATCH 13/16] Fixed navigating to links from history [Issue#] https://bugs.tizen.org/jira/browse/TT-93 [Problem] Browser cannot navigate to links from history. [Cause] There is no implemented callback on click event in history. [Solution] Implemented callback _history_item_clicked_cb and switching the view. [Verify] Launch Browser > More menu > History > Click on some link > Obs Browser should load clicked webpage. Change-Id: Iaac04dd59776b302fa199dd6d631aafa03eca139 --- services/HistoryUI/HistoryUI.cpp | 9 ++++++++- services/HistoryUI/HistoryUI.h | 1 + services/SimpleUI/SimpleUI.cpp | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/services/HistoryUI/HistoryUI.cpp b/services/HistoryUI/HistoryUI.cpp index 11ab3ed..c4ec024 100644 --- a/services/HistoryUI/HistoryUI.cpp +++ b/services/HistoryUI/HistoryUI.cpp @@ -234,7 +234,7 @@ Evas_Object * HistoryUI::_history_grid_content_get(void *data, Evas_Object*, con id->historyUI->m_itemClassToday->func.del = nullptr; for(auto it = _history_item_data.begin(); it != _history_item_data.end(); it++) { - Elm_Object_Item* historyView = elm_genlist_item_append(id->historyUI->m_genListToday, id->historyUI->m_itemClassToday, *it, nullptr, ELM_GENLIST_ITEM_NONE, nullptr, id->historyUI.get()); + Elm_Object_Item* historyView = elm_genlist_item_append(id->historyUI->m_genListToday, id->historyUI->m_itemClassToday, *it, nullptr, ELM_GENLIST_ITEM_NONE, _history_item_clicked_cb, (*it)); id->historyUI->m_map_history_views.insert(std::pair((*it)->item->getUrl(), historyView)); } @@ -294,5 +294,12 @@ void HistoryUI::clearItems() setEmptyGengrid(true); } +void HistoryUI::_history_item_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + HistoryItemData * itemData = reinterpret_cast(data); + itemData->historyUI->historyItemClicked(itemData->item); +} + } } diff --git a/services/HistoryUI/HistoryUI.h b/services/HistoryUI/HistoryUI.h index 7070ff8..f6ac0b2 100644 --- a/services/HistoryUI/HistoryUI.h +++ b/services/HistoryUI/HistoryUI.h @@ -58,6 +58,7 @@ private: static void _clearHistory_clicked(void *data, Evas_Object *obj, void *event_info); static char* _listTodayTextGet(void* data, Evas_Object* obj , const char* part); static void _close_clicked_cb(void *data, Evas_Object *obj, void *event_info); + static void _history_item_clicked_cb(void *data, Evas_Object *obj, void *event_info); void setEmptyGengrid(bool setEmpty); diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 9f3c77e..05826d3 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -597,6 +597,15 @@ void SimpleUI::onHistoryAdded(std::shared_ptr historyItem) { std::string historyAddress = historyItem->getUrl(); + if(m_historyUI) { // TODO: remove this section when naviframes will be available + m_historyUI->clearItems(); + m_historyUI = nullptr; + } + + if(m_moreMenuUI) { // TODO: remove this section when naviframes will be available + m_moreMenuUI->clearItems(); + m_moreMenuUI = nullptr; + } openNewTab(historyAddress); } -- 2.7.4 From ee4309d7da13b43d31114187d514b0bc5db06660 Mon Sep 17 00:00:00 2001 From: Janusz Majnert Date: Tue, 18 Aug 2015 09:40:57 +0200 Subject: [PATCH 14/16] Removing ewk_context_default_get call [Issue#] N/A [Problem] Call to internal EWK API [Cause] Code restored during branch merge [Solution] Remove the call, it is not needed [Verify] Build and run the browser, load a few tabs, close tabs The call to ewk_context_default get was restored by mistake when performing a merge between branches. The version in tizen branch had the code replaced with another method to implicitly initialize EWK internal contexts. Change-Id: If21dcc4ca40242786c22e80b7a5591a70c56ecfb --- services/SimpleUI/SimpleUI.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 05826d3..4cf12a4 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -76,7 +76,6 @@ SimpleUI::SimpleUI() , m_ewkContext(ewk_context_new()) { elm_init(0, nullptr); - ewk_context_default_get(); Evas_Object *main_window = elm_win_util_standard_add("browserApp", "browserApp"); if (main_window == nullptr) BROWSER_LOGE("Failed to create main window"); -- 2.7.4 From 8f14e6e0d0f626dffa6f39f98ff46f681d7c3793 Mon Sep 17 00:00:00 2001 From: Maciej Skrzypkowski Date: Wed, 19 Aug 2015 15:49:06 +0200 Subject: [PATCH 15/16] Added "no visited site" view for Most visted tab. [Issue#] https://bugs.tizen.org/jira/browse/TT-73 [Problem] For no history there was no message. [Cause] N/A [Solution] Added label "No visited site" when there is no history [Verify] Run fresh browser instance, there should be "No visited site" message in Most visited tab. Change-Id: I171f6d5d74dbc175102a08afac37b22ff3bb6e50 Signed-off-by: Maciej Skrzypkowski --- services/MainUI/MainUI.cpp | 52 +++++++++++++++++-------------- services/MainUI/MainUI.h | 4 +-- services/MainUI/edc/MainUI.edc | 69 ++++++++++++++++++++++++++++++++---------- services/SimpleUI/SimpleUI.cpp | 20 ++++++------ 4 files changed, 96 insertions(+), 49 deletions(-) diff --git a/services/MainUI/MainUI.cpp b/services/MainUI/MainUI.cpp index 8e4afd7..c52bb07 100644 --- a/services/MainUI/MainUI.cpp +++ b/services/MainUI/MainUI.cpp @@ -31,6 +31,7 @@ namespace tizen_browser{ namespace base_ui{ const int SMALL_TILES_ROWS = 2; +const int MAX_TILES_NUMBER = 5; const int SUFIX_CHAR_DEL = 1; const char * HTTP_PREFIX = "http://"; const char * HTTPS_PREFIX = "https://"; @@ -269,8 +270,8 @@ Evas_Object* MainUI::listItemBottomContentGet(void* data, Evas_Object* obj, cons void MainUI::addHistoryItem(std::shared_ptr hi) { BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); - if (m_map_history_views.size() >= 5) - return; + if (m_map_history_views.size() >= MAX_TILES_NUMBER) + return; HistoryItemData *itemData = new HistoryItemData(); itemData->item = hi; @@ -290,19 +291,18 @@ void MainUI::addHistoryItem(std::shared_ptr(hi->getUrl(),historyView)); - - setEmptyGengrid(false); } void MainUI::addHistoryItems(std::vector > items) { - BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); - int i = 0; - for (auto it = items.begin(); it != items.end(); ++it) { - i++; - if (i > 5) break; - addHistoryItem(*it); - } + BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); + int i = 0; + for (auto it = items.begin(); it != items.end(); ++it) { + i++; + if (i > MAX_TILES_NUMBER) + break; + addHistoryItem(*it); + } } void MainUI::addBookmarkItem(std::shared_ptr bi) @@ -317,7 +317,7 @@ void MainUI::addBookmarkItem(std::shared_ptr > items) @@ -438,6 +438,12 @@ void MainUI::showHistoryGenlist() elm_object_part_content_unset(m_layout, "elm.swallow.grid"); evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.genlistBottom")); elm_object_part_content_unset(m_layout, "elm.swallow.genlistBottom"); + + if (m_map_history_views.empty()) { + setEmptyView(true); + return; + } + setEmptyView(false); elm_object_part_content_set(m_layout, "elm.swallow.left", m_genListLeft); elm_object_part_content_set(m_layout, "elm.swallow.right", m_genListRight); elm_object_part_content_set(m_layout, "elm.swallow.center", m_genListCenter); @@ -479,21 +485,23 @@ void MainUI::clearItems() elm_genlist_clear(m_genListBottom); } -Evas_Object* MainUI::createNoHistoryLabel() +void MainUI::showNoHistoryLabel() { - Evas_Object *label = elm_label_add(m_parent); - elm_object_text_set(label, "No favorite websites."); - evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); - return label; + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.left")); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.right")); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.center")); + + elm_layout_text_set(m_layout, "elm.text.empty", "No visited site"); + elm_layout_signal_emit(m_layout, "empty,view", "mainui"); } -void MainUI::setEmptyGengrid(bool setEmpty) +void MainUI::setEmptyView(bool empty) { - if(setEmpty) { - elm_object_part_content_set(m_gengrid, "elm.swallow.empty", createNoHistoryLabel()); + BROWSER_LOGD("%s:%d %s, empty: %d", __FILE__, __LINE__, __func__, empty); + if(empty) { + showNoHistoryLabel(); } else { - elm_object_part_content_set(m_gengrid, "elm.swallow.empty", nullptr); + elm_layout_signal_emit(m_layout, "not,empty,view", "mainui"); } } diff --git a/services/MainUI/MainUI.h b/services/MainUI/MainUI.h index c62a301..66e8d94 100644 --- a/services/MainUI/MainUI.h +++ b/services/MainUI/MainUI.h @@ -70,7 +70,7 @@ private: static void _item_deleted(void *data, Evas_Object *obj); static void _thumbSelected(void * data, Evas_Object * obj, void * event_info); static void _deleteBookmark(void *data, Evas_Object *obj, void *event_info); - void setEmptyGengrid(bool setEmpty); + void setEmptyView(bool empty); static void _mostVisited_clicked(void * data, Evas_Object * obj, void * event_info); static void _bookmark_clicked(void * data, Evas_Object * obj, void * event_info); @@ -92,7 +92,7 @@ private: std::map m_map_bookmark_views; bool m_gengridSetup; std::string edjFilePath; - Evas_Object *createNoHistoryLabel(); + void showNoHistoryLabel(); static void focusItem(void* data, Evas_Object* obj, void* event_info); static void unFocusItem(void* data, Evas_Object* obj, void* event_info); diff --git a/services/MainUI/edc/MainUI.edc b/services/MainUI/edc/MainUI.edc index ba358bf..ea2929e 100644 --- a/services/MainUI/edc/MainUI.edc +++ b/services/MainUI/edc/MainUI.edc @@ -203,7 +203,7 @@ group { name: "mv_bookmarks"; } } - part { name: "most_visited"; + part { name: "center_rect"; type: RECT; description { state: "default" 0.0; min: 1592 614; @@ -219,6 +219,11 @@ group { name: "mv_bookmarks"; relative: 1 1; } } + description { state: "empty" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 229 229 229 255; + } } part { name: "elm.swallow.left"; type: SWALLOW; @@ -228,7 +233,7 @@ group { name: "mv_bookmarks"; align: 0.0 0.0; fixed: 0 0; rel1 { - relative: 0 0; to: "most_visited"; + relative: 0 0; to: "center_rect"; } rel2 { relative: 1 1; @@ -244,12 +249,12 @@ group { name: "mv_bookmarks"; align: 0.0 0.0; fixed: 0 0; rel1 { - to: "most_visited"; + to: "center_rect"; relative: 0 0; offset: 810 0; } rel2{ - to: "most_visited"; + to: "center_rect"; relative: 1 1; offset: 0 0; } @@ -263,12 +268,12 @@ group { name: "mv_bookmarks"; align: 0.0 0.0; fixed: 0 0; rel1 { - to: "most_visited"; + to: "center_rect"; relative: 0 0; offset: 1214 0; } rel2 { - to: "most_visited"; + to: "center_rect"; relative: 1 1; offset: 0 0; } @@ -322,19 +327,51 @@ group { name: "mv_bookmarks"; offset: 0 0; } } - } - part { name: "elm.swallow.empty"; - type: SWALLOW; - description { state: "default" 0.0; + } + + part { name: "elm.text.empty"; + type: TEXT; + description { state: "default" 0.0; + visible: 0; align: 0.5 0.5; - rel1 { - relative: 0.5 0.5; - } - rel2 { - relative: 0.5 0.5; - } + color: 0 0 0 179; + text { + text: "empty"; + font: "Sans"; + size: 32; + align: 0.5 0.5; + } + rel1 { + to: "gengrid_bg"; + relative: 0.0 0.0; } + rel2 { + to: "gengrid_bg"; + relative: 1 1; + } + } + description { state: "empty" 0.0; + inherit: "default" 0.0; + visible: 1; } + } + } + + programs { + program { name: "empty"; + signal: "empty,view"; + source: "mainui"; + action: STATE_SET "empty" 0.0; + target: "elm.text.empty"; + target: "center_rect"; + } + program { name: "not_empty"; + signal: "not,empty,view"; + source: "mainui"; + action: STATE_SET "default" 0.0; + target: "elm.text.empty"; + target: "center_rect"; + } } } diff --git a/services/SimpleUI/SimpleUI.cpp b/services/SimpleUI/SimpleUI.cpp index 4cf12a4..10e3bab 100644 --- a/services/SimpleUI/SimpleUI.cpp +++ b/services/SimpleUI/SimpleUI.cpp @@ -610,8 +610,10 @@ void SimpleUI::onHistoryClicked(std::shared_ptrclearAllHistory(); + BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__); + m_historyService->clearAllHistory(); + m_mainUI->clearHistoryGenlist(); + m_mainUI->showHistoryGenlist(); } void SimpleUI::onMostVisitedClicked(const std::string&) @@ -1066,16 +1068,16 @@ void SimpleUI::hideMainUI() void SimpleUI::showMainUI() { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - m_mainUI = - std::dynamic_pointer_cast + m_mainUI = std::dynamic_pointer_cast (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.mainui")); - M_ASSERT(m_mainUI); - hideWebView(); - m_mainUI->show(m_window.get()); - m_mainUI->addHistoryItems(getHistory()); + M_ASSERT(m_mainUI); + hideWebView(); + m_mainUI->show(m_window.get()); + m_mainUI->addHistoryItems(getHistory()); + m_mainUI->showHistoryGenlist(); - m_isHomePageActive = true; + m_isHomePageActive = true; } void SimpleUI::showHistoryUI(const std::string& str) -- 2.7.4 From b6a9b4256f08a2176676a3ad2c0d857fe8073529 Mon Sep 17 00:00:00 2001 From: Marcin Lapinski Date: Wed, 19 Aug 2015 14:25:54 +0200 Subject: [PATCH 16/16] Refactoring MainUI [Issue#] https://bugs.tizen.org/jira/browse/TT-72 [Problem] MainUI needs refactoring. [Cause] N/A [Sollotion] -Removed redundant gengrid from bottom panel. -Removed unused declarations. -Removed redundant namespace identifiers. [Verify] 1. Browser builds 2. Refactor does not change behaviour of browser. Change-Id: If23e9979914cb44af91b881b25e5caffbba4c246 --- services/MainUI/MainUI.cpp | 73 ++++++++++++------------------------------ services/MainUI/MainUI.h | 6 +--- services/MainUI/edc/MainUI.edc | 8 ++--- 3 files changed, 25 insertions(+), 62 deletions(-) diff --git a/services/MainUI/MainUI.cpp b/services/MainUI/MainUI.cpp index c52bb07..a7ab4a7 100644 --- a/services/MainUI/MainUI.cpp +++ b/services/MainUI/MainUI.cpp @@ -64,8 +64,7 @@ MainUI::MainUI() , m_genListLeft(nullptr) , m_genListCenter(nullptr) , m_genListRight(nullptr) - , m_genListBottom(nullptr) - , m_itemClassBottom(nullptr) + , m_layoutBottom(nullptr) , m_big_item_class(nullptr) , m_small_item_class(nullptr) , m_bookmark_item_class(nullptr) @@ -183,12 +182,12 @@ void MainUI::showTopButtons() Evas_Object *mvButton = elm_button_add(m_layoutTop); elm_object_style_set(mvButton, "invisible_button"); - evas_object_smart_callback_add(mvButton, "clicked", tizen_browser::base_ui::MainUI::_mostVisited_clicked, this); + evas_object_smart_callback_add(mvButton, "clicked", _mostVisited_clicked, this); elm_layout_content_set(m_layoutTop, "mostvisited_click", mvButton); Evas_Object *bmButton = elm_button_add(m_layoutTop); elm_object_style_set(bmButton, "invisible_button"); - evas_object_smart_callback_add(bmButton, "clicked", tizen_browser::base_ui::MainUI::_bookmark_clicked, this); + evas_object_smart_callback_add(bmButton, "clicked", _bookmark_clicked, this); elm_layout_content_set(m_layoutTop, "bookmark_click", bmButton); elm_object_part_content_set(m_layout, "elm.swallow.genlistTop", m_layoutTop); @@ -198,35 +197,17 @@ void MainUI::showBottomButton() { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); elm_theme_extension_add(nullptr, edjFilePath.c_str()); - m_genListBottom = elm_genlist_add(m_layout); - elm_genlist_homogeneous_set(m_genListBottom, EINA_FALSE); - elm_genlist_multi_select_set(m_genListBottom, EINA_FALSE); - elm_genlist_select_mode_set(m_genListBottom, ELM_OBJECT_SELECT_MODE_ALWAYS); - elm_genlist_mode_set(m_genListBottom, ELM_LIST_LIMIT); - //elm_genlist_decorate_mode_set(m_genListBottom, EINA_TRUE); - evas_object_size_hint_weight_set(m_genListBottom, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - /*evas_object_smart_callback_add(m_genList, "item,focused", focusItem, this); - evas_object_smart_callback_add(m_genList, "item,unfocused", unFocusItem, nullptr);*/ + m_layoutBottom = elm_layout_add(m_layout); + evas_object_size_hint_weight_set(m_layoutBottom, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(m_layoutBottom, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_layout_file_set(m_layoutBottom, edjFilePath.c_str(), "bottom_button_item"); + //elm_object_part_content_set(m_layout, "elm.swallow.layoutBottom", m_layoutBottom); - m_itemClassBottom = elm_genlist_item_class_new(); - m_itemClassBottom->item_style = "bottom_button_item"; - m_itemClassBottom->func.text_get = nullptr; - m_itemClassBottom->func.content_get = &listItemBottomContentGet; - m_itemClassBottom->func.state_get = 0; - m_itemClassBottom->func.del = 0; - - ItemData * id = new ItemData; - id->mainUI = this; - Elm_Object_Item* elmItem = elm_genlist_item_append(m_genListBottom, //genlist - m_itemClassBottom, //item Class - id, - nullptr, //parent item - ELM_GENLIST_ITEM_NONE,//item type - nullptr, - nullptr //data passed to above function - ); - id->e_item = elmItem; + Evas_Object * bookmark_manager_button = elm_button_add(m_layoutBottom); + elm_object_style_set(bookmark_manager_button, "invisible_button"); + elm_object_part_content_set(m_layoutBottom, "bookmarkmanager_click", bookmark_manager_button); + evas_object_smart_callback_add(bookmark_manager_button, "clicked", _bookmark_manager_clicked, this); } void MainUI::_mostVisited_clicked(void * data, Evas_Object * /* obj */, void * event_info) @@ -250,21 +231,8 @@ void MainUI::_bookmark_clicked(void * data, Evas_Object * /* obj */, void * even void MainUI::_bookmark_manager_clicked(void * data, Evas_Object * /* obj */, void * event_info) { BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - ItemData* itemData = reinterpret_cast(data); - itemData->mainUI->bookmarkManagerClicked(std::string()); -} - -Evas_Object* MainUI::listItemBottomContentGet(void* data, Evas_Object* obj, const char* part) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - if(!strcmp(part, "bookmarkmanager_click")) - { - Evas_Object *bmButton = elm_button_add(obj); - elm_object_style_set(bmButton, "invisible_button"); - evas_object_smart_callback_add(bmButton, "clicked", tizen_browser::base_ui::MainUI::_bookmark_manager_clicked, data); - return bmButton; - } - return nullptr; + MainUI* mainUI = static_cast(data); + mainUI->bookmarkManagerClicked(std::string()); } void MainUI::addHistoryItem(std::shared_ptr hi) @@ -275,7 +243,7 @@ void MainUI::addHistoryItem(std::shared_ptritem = hi; - itemData->mainUI = std::shared_ptr(this); + itemData->mainUI = std::shared_ptr(this); Elm_Object_Item* historyView = nullptr; if (m_map_history_views.empty()) @@ -376,7 +344,7 @@ Evas_Object * MainUI::_grid_content_get(void *data, Evas_Object *obj, const char else if (!strcmp(part, "elm.thumbButton")) { Evas_Object *thumbButton = elm_button_add(obj); elm_object_style_set(thumbButton, "thumbButton"); - evas_object_smart_callback_add(thumbButton, "clicked", tizen_browser::base_ui::MainUI::_thumbSelected, data); + evas_object_smart_callback_add(thumbButton, "clicked", _thumbSelected, data); return thumbButton; } return nullptr; @@ -399,7 +367,7 @@ Evas_Object * MainUI::_grid_bookmark_content_get(void *data, Evas_Object *obj, c else if (!strcmp(part, "elm.thumbButton")) { Evas_Object *thumbButton = elm_button_add(obj); elm_object_style_set(thumbButton, "thumbButton"); - evas_object_smart_callback_add(thumbButton, "clicked", tizen_browser::base_ui::MainUI::_thumbSelected, data); + evas_object_smart_callback_add(thumbButton, "clicked", _thumbSelected, data); return thumbButton; } return nullptr; @@ -436,8 +404,8 @@ void MainUI::showHistoryGenlist() { evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.grid")); elm_object_part_content_unset(m_layout, "elm.swallow.grid"); - evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.genlistBottom")); - elm_object_part_content_unset(m_layout, "elm.swallow.genlistBottom"); + evas_object_hide(elm_object_part_content_get(m_layout, "elm.swallow.layoutBottom")); + elm_object_part_content_unset(m_layout, "elm.swallow.layoutBottom"); if (m_map_history_views.empty()) { setEmptyView(true); @@ -465,7 +433,7 @@ void MainUI::showBookmarkGengrid() elm_object_part_content_unset(m_layout, "elm.swallow.right"); elm_object_part_content_unset(m_layout, "elm.swallow.center"); elm_object_part_content_set(m_layout, "elm.swallow.grid", m_gengrid); - elm_object_part_content_set(m_layout, "elm.swallow.genlistBottom", m_genListBottom); + elm_object_part_content_set(m_layout, "elm.swallow.layoutBottom", m_layoutBottom); } void MainUI::hide() @@ -482,7 +450,6 @@ void MainUI::clearItems() BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); clearHistoryGenlist(); clearBookmarkGengrid(); - elm_genlist_clear(m_genListBottom); } void MainUI::showNoHistoryLabel() diff --git a/services/MainUI/MainUI.h b/services/MainUI/MainUI.h index 66e8d94..a5cefb5 100644 --- a/services/MainUI/MainUI.h +++ b/services/MainUI/MainUI.h @@ -58,9 +58,6 @@ public: boost::signals2::signal bookmarkClicked; boost::signals2::signal bookmarkManagerClicked; private: - static Evas_Object* listItemBottomContentGet(void *data, Evas_Object *obj, const char *part); - static Evas_Object* listTopItemContentGet(void *data, Evas_Object *obj, const char *part); - //static char* listItemTextGet(void *data, Evas_Object *obj, const char *part); static char* _grid_text_get(void *data, Evas_Object *obj, const char *part); static Evas_Object * _grid_content_get(void *data, Evas_Object *obj, const char *part); @@ -79,12 +76,11 @@ private: Evas_Object *m_parent; Evas_Object *m_layout; Evas_Object *m_layoutTop; + Evas_Object *m_layoutBottom; Evas_Object *m_gengrid; Evas_Object *m_genListLeft; Evas_Object *m_genListCenter; Evas_Object *m_genListRight; - Evas_Object *m_genListBottom; - Elm_Genlist_Item_Class *m_itemClassBottom; Elm_Gengrid_Item_Class * m_big_item_class; Elm_Gengrid_Item_Class * m_small_item_class; Elm_Gengrid_Item_Class * m_bookmark_item_class; diff --git a/services/MainUI/edc/MainUI.edc b/services/MainUI/edc/MainUI.edc index ea2929e..129d266 100644 --- a/services/MainUI/edc/MainUI.edc +++ b/services/MainUI/edc/MainUI.edc @@ -168,7 +168,7 @@ group { name: "mv_bookmarks"; } } } - part { name: "genlistBottom_bg"; + part { name: "layoutBottom_bg"; type: RECT; mouse_events: 0; description { state: "default" 0.0; @@ -312,7 +312,7 @@ group { name: "mv_bookmarks"; rel2 { relative: 1.0 1.0; } } } - part { name: "elm.swallow.genlistBottom"; + part { name: "elm.swallow.layoutBottom"; type: SWALLOW; description { state: "default" 0.0; min: 1920 181; @@ -320,7 +320,7 @@ group { name: "mv_bookmarks"; align: 0.0 0.0; fixed: 0 0; rel1 { - relative: 0 0; to: "genlistBottom_bg"; + relative: 0 0; to: "layoutBottom_bg"; } rel2 { relative: 1 1; @@ -1325,7 +1325,7 @@ group { name: "top_button_item"; } } -group { name: "elm/genlist/item/bottom_button_item/default"; +group { name: "bottom_button_item"; min: 1920 181; max: 1920 181; data.item: "texts" "bookmarkmanager_text"; -- 2.7.4