diff options
author | Igor Nazarov <i.nazarov@samsung.com> | 2017-04-12 18:55:37 +0300 |
---|---|---|
committer | Igor Nazarov <i.nazarov@samsung.com> | 2017-04-12 18:55:37 +0300 |
commit | f224911896900087fcf03db6af64f2334225da63 (patch) | |
tree | 02a01ec2143501e3f3e5445da8cde24579ac230f | |
parent | ff044cd8ec4264edea237d4cb5892deed961b89b (diff) | |
download | gallery-f224911896900087fcf03db6af64f2334225da63.tar.gz gallery-f224911896900087fcf03db6af64f2334225da63.tar.bz2 gallery-f224911896900087fcf03db6af64f2334225da63.zip |
[Gallery] Hot-fix change
- Fixed undefined behavior in ImageGrid related to item selection;
- Fixed erroneous animation in some cases when performing select mode zoom
out in ImageGrid;
- UCL changes.
Change-Id: I467834554a671ab0e8722029403d4e36df84c60c
-rw-r--r-- | inc/view/ImageGrid.h | 2 | ||||
-rw-r--r-- | src/model/GalleryAlbum.cpp | 2 | ||||
-rw-r--r-- | src/presenters/PreviewPage.cpp | 1 | ||||
-rw-r--r-- | src/view/ImageGrid.cpp | 53 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/Window.hpp | 2 | ||||
-rw-r--r-- | ucl/inc/ucl/misc/TString.h | 2 | ||||
-rw-r--r-- | ucl/inc/ucl/misc/TString.hpp | 4 |
7 files changed, 40 insertions, 26 deletions
diff --git a/inc/view/ImageGrid.h b/inc/view/ImageGrid.h index 9c7756c..c707646 100644 --- a/inc/view/ImageGrid.h +++ b/inc/view/ImageGrid.h @@ -128,6 +128,7 @@ namespace gallery { void evalSlotSizes(); void finalizeTransition(); Eina_Bool onAnimationFrame(); + void onSlotResize(Widget &widget, void *eventInfo); void onBoxResize(Evas *e, Evas_Object *obj, void *eventInfo); void onTransitonFinished(Evas_Object *obj, const char *emission, const char *source); @@ -225,6 +226,7 @@ namespace gallery { int m_eventsLock; Ecore_Animator *m_animator; + int m_scrollLockIndex; bool m_isInSelectMode; bool m_isRotaryActive; }; diff --git a/src/model/GalleryAlbum.cpp b/src/model/GalleryAlbum.cpp index 7fe098c..33f08e8 100644 --- a/src/model/GalleryAlbum.cpp +++ b/src/model/GalleryAlbum.cpp @@ -67,7 +67,7 @@ namespace gallery { return RES_FAIL; } - ret = media_filter_set_condition(m_filter, impl::CONDITION, + ret = media_filter_set_condition(m_filter, impl::CONDITION.c_str(), MEDIA_CONTENT_COLLATE_DEFAULT); if (ret != 0) { ELOG("media_filter_set_condition() failed: %d", ret); diff --git a/src/presenters/PreviewPage.cpp b/src/presenters/PreviewPage.cpp index 143243f..f7ee75f 100644 --- a/src/presenters/PreviewPage.cpp +++ b/src/presenters/PreviewPage.cpp @@ -339,6 +339,7 @@ namespace gallery { if (m_imageGrid->isInSelectMode()) { if (event == ImageGrid::ITEM_EVENT_CLICK) { toggleItemSelected(itemIndex); + m_imageGrid->bringInItem(itemIndex); } return; } diff --git a/src/view/ImageGrid.cpp b/src/view/ImageGrid.cpp index 690c1bc..1f792a1 100644 --- a/src/view/ImageGrid.cpp +++ b/src/view/ImageGrid.cpp @@ -445,8 +445,8 @@ namespace gallery { for (int i = 0; i < length; ++i) { m_items.emplace_back(makeShared<Item>(imageGrid, m_layout)); - m_layout.setContent( - EdjePart(impl::SLOT_PART_FMT.format(i)), + const auto partName = impl::SLOT_PART_FMT.format(i); + m_layout.setContent(EdjePart(partName.c_str()), m_items.back()->getWidget()); } } @@ -520,10 +520,10 @@ namespace gallery { if (!m_items[itemOffset]->setSelected(selected)) { return; } - const auto aSignal = EdjeSignal(selected ? + const auto signalName = (selected ? impl::SIGNAL_SELECT_ITEM_FMT.format(itemOffset) : impl::SIGNAL_UNSELECT_ITEM_FMT.format(itemOffset)); - m_layout.emitSignal(aSignal); + m_layout.emitSignal(EdjeSignal(signalName.c_str())); } private: @@ -581,6 +581,7 @@ namespace gallery { m_eventsLock(0), m_animator(nullptr), + m_scrollLockIndex(0), m_isInSelectMode(selectModeStartup), m_isRotaryActive(false) { @@ -736,6 +737,8 @@ namespace gallery { return RES_FAIL; } + m_scrollLockIndex = (m_scrollOffset / m_slotSize); + m_isInSelectMode = enabled; elm_object_scroll_freeze_push(*m_scroller); @@ -760,8 +763,12 @@ namespace gallery { EVAS_CALLBACK_RESIZE, EO_CALLBACK_PRIORITY_AFTER, CALLBACK_A(ImageGrid::onBoxResize), this); - elm_object_signal_callback_add( - m_slots[m_beginSlotIndex & 1]->getLayout(), + auto &slotlayout = m_slots[m_beginSlotIndex & 1]->getLayout(); + + slotlayout.addEventHandler(WidgetEvent::CHANGED_SIZE_HINTS, + WEAK_DELEGATE(ImageGrid::onSlotResize, asWeak(*this))); + + elm_object_signal_callback_add(slotlayout, impl::SIGNAL_TRANSITION_FINISHED.name, "", CALLBACK_A(ImageGrid::onTransitonFinished), this); @@ -806,8 +813,12 @@ namespace gallery { evas_object_event_callback_del_full(m_box, EVAS_CALLBACK_RESIZE, CALLBACK_A(ImageGrid::onBoxResize), this); - elm_object_signal_callback_del( - m_slots[m_beginSlotIndex & 1]->getLayout(), + auto &slotlayout = m_slots[m_beginSlotIndex & 1]->getLayout(); + + slotlayout.delEventHandler(WidgetEvent::CHANGED_SIZE_HINTS, + WEAK_DELEGATE(ImageGrid::onSlotResize, asWeak(*this))); + + elm_object_signal_callback_del(slotlayout, "gallery,transition,finished", "", CALLBACK_A(ImageGrid::onTransitonFinished)); } @@ -825,27 +836,27 @@ namespace gallery { } } - void ImageGrid::onBoxResize(Evas *e, Evas_Object *obj, void *eventInfo) + void ImageGrid::onSlotResize(Widget &widget, void *eventInfo) { - const int scrollLockIndex = (m_scrollOffset / m_slotSize); - if (updateSlotSize()) { - - m_scrollOffset = (scrollLockIndex * m_slotSize); - if (m_info.isHorizontal) { - elm_scroller_region_show(*m_scroller, - m_scrollOffset, 0, m_scrollerSize, 1); - } else { - elm_scroller_region_show(*m_scroller, - 0, m_scrollOffset, 1, m_scrollerSize); - } - updatePadSizes(); updateScrollBias(); updateRectMins(); } } + void ImageGrid::onBoxResize(Evas *e, Evas_Object *obj, void *eventInfo) + { + m_scrollOffset = (m_scrollLockIndex * m_slotSize); + if (m_info.isHorizontal) { + elm_scroller_region_show(*m_scroller, + m_scrollOffset, 0, m_scrollerSize, 1); + } else { + elm_scroller_region_show(*m_scroller, + 0, m_scrollOffset, 1, m_scrollerSize); + } + } + void ImageGrid::update() { Unrealizer(*this); diff --git a/ucl/inc/ucl/gui/Window.hpp b/ucl/inc/ucl/gui/Window.hpp index f1add02..3d4c959 100644 --- a/ucl/inc/ucl/gui/Window.hpp +++ b/ucl/inc/ucl/gui/Window.hpp @@ -113,7 +113,7 @@ namespace ucl { inline std::string Window::getTitle() const { - return elm_win_title_get(getEo()); + return nz(elm_win_title_get(getEo())); } inline void Window::setIndicatorVisible(bool value) diff --git a/ucl/inc/ucl/misc/TString.h b/ucl/inc/ucl/misc/TString.h index 72ea460..5ad240d 100644 --- a/ucl/inc/ucl/misc/TString.h +++ b/ucl/inc/ucl/misc/TString.h @@ -56,7 +56,7 @@ namespace ucl { const char *translate() const; template <typename ...ARGS> - TString format(ARGS ...args) const; + std::string format(ARGS ...args) const; private: const char *doTranslate(const char *strId) const; diff --git a/ucl/inc/ucl/misc/TString.hpp b/ucl/inc/ucl/misc/TString.hpp index f940385..01c1327 100644 --- a/ucl/inc/ucl/misc/TString.hpp +++ b/ucl/inc/ucl/misc/TString.hpp @@ -115,7 +115,7 @@ namespace ucl { } template <typename ...ARGS> - inline TString TString::format(ARGS ...args) const + inline std::string TString::format(ARGS ...args) const { constexpr auto STR_LEN_ADJUST = 1.7f; @@ -141,6 +141,6 @@ namespace ucl { strLen = n + 1; } - return {result, false}; + return result; } } |