diff options
author | Igor Olshevskyi <i.olshevskyi@samsung.com> | 2017-10-10 13:02:53 +0300 |
---|---|---|
committer | Igor Olshevskyi <i.olshevskyi@samsung.com> | 2017-10-10 15:33:14 +0300 |
commit | 7cd913933edc6fd3e8a87e13a238c674b3ca4726 (patch) | |
tree | c5dc127f3ae5a8711d77f9f40f2d9ad721a1b5a6 | |
parent | ae2ea59dd8cb144f5b54579d215f03af0b64adf3 (diff) | |
download | call-ui-7cd913933edc6fd3e8a87e13a238c674b3ca4726.tar.gz call-ui-7cd913933edc6fd3e8a87e13a238c674b3ca4726.tar.bz2 call-ui-7cd913933edc6fd3e8a87e13a238c674b3ca4726.zip |
TizenRefApp-9558 [Call UI] Reimplement AcceptDialog using base Dialog class
Change-Id: I70367e2e8bcd1c3cfc6fe01c9f78cf8f5c37aaae
-rw-r--r-- | .cproject | 30 | ||||
-rw-r--r-- | call-ui/presenters/dialogs/AcceptDialog.cpp | 101 | ||||
-rw-r--r-- | call-ui/presenters/dialogs/AcceptDialog.h | 40 | ||||
-rw-r--r-- | call-ui/presenters/dialogs/base/Dialog.cpp | 129 | ||||
-rw-r--r-- | call-ui/presenters/dialogs/base/Dialog.h | 124 | ||||
-rw-r--r-- | call-ui/presenters/dialogs/base/Dialog.hpp | 39 | ||||
-rw-r--r-- | call-ui/view/common.h | 1 | ||||
-rw-r--r-- | project_def.prop | 2 |
8 files changed, 350 insertions, 116 deletions
@@ -35,7 +35,6 @@ <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.2060575755" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath"> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/SDL2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore/""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-agent""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-watch""/> @@ -108,7 +107,9 @@ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/nsd/""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/phonenumber-utils""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/pkgmgr""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/privacy-privilege-manager/""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/rua/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/SDL2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/sensor""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/storage""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/system""/> @@ -249,7 +250,6 @@ <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.1481628386" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath"> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/SDL2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore/""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-agent""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-watch""/> @@ -322,7 +322,9 @@ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/nsd/""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/phonenumber-utils""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/pkgmgr""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/privacy-privilege-manager/""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/rua/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/SDL2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/sensor""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/storage""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/system""/> @@ -492,6 +494,12 @@ <option command="-id " id="sbi.gnu.edc.compiler.option.misc.id.434887912" name="Image Path (-id)" superClass="sbi.gnu.edc.compiler.option.misc.id" valueType="stringList"> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/images""/> </option> + <option id="sbi.gnu.edc.compiler.option.misc.sd.272942437" superClass="sbi.gnu.edc.compiler.option.misc.sd" valueType="stringList"> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/sounds""/> + </option> + <option id="sbi.gnu.edc.compiler.option.misc.fd.2099492430" superClass="sbi.gnu.edc.compiler.option.misc.fd" valueType="stringList"> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/fonts""/> + </option> </tool> </toolChain> </folderInfo> @@ -535,7 +543,6 @@ <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1432667313" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath"> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/SDL2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-agent""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-watch""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appfw""/> @@ -603,6 +610,8 @@ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/notification""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/nsd/""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/phonenumber-utils""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/privacy-privilege-manager/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/SDL2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/sensor""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/storage""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/system""/> @@ -734,7 +743,6 @@ <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.1440527129" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath"> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/SDL2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-agent""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-watch""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appfw""/> @@ -802,6 +810,8 @@ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/notification""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/nsd/""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/phonenumber-utils""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/privacy-privilege-manager/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/SDL2""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/sensor""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/storage""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/system""/> @@ -958,7 +968,17 @@ <tool id="org.tizen.nativecore.tool.ast.cpp.1169680363" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/> <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.765743958" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/> <tool id="org.tizen.nativecore.tool.sbi.po.compiler.1889777798" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/> - <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.1860406220" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/> + <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.1860406220" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"> + <option id="sbi.gnu.edc.compiler.option.misc.id.1760090476" superClass="sbi.gnu.edc.compiler.option.misc.id" valueType="stringList"> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/images""/> + </option> + <option id="sbi.gnu.edc.compiler.option.misc.sd.1539334293" superClass="sbi.gnu.edc.compiler.option.misc.sd" valueType="stringList"> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/sounds""/> + </option> + <option id="sbi.gnu.edc.compiler.option.misc.fd.1141822320" superClass="sbi.gnu.edc.compiler.option.misc.fd" valueType="stringList"> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/fonts""/> + </option> + </tool> </toolChain> </folderInfo> <sourceEntries> diff --git a/call-ui/presenters/dialogs/AcceptDialog.cpp b/call-ui/presenters/dialogs/AcceptDialog.cpp index 676b706..c6c3710 100644 --- a/call-ui/presenters/dialogs/AcceptDialog.cpp +++ b/call-ui/presenters/dialogs/AcceptDialog.cpp @@ -26,10 +26,6 @@ namespace callui { namespace { namespace impl { constexpr ElmStyle POPUP_STYLE {"circle"}; - constexpr SmartEvent POPUP_DISMISSED {"dismissed"}; - - constexpr EdjePart PART_SWL_CONTENT{"elm.swallow.content"}; - void *asData(const AcceptDialog::Event event) { return reinterpret_cast<void *>(static_cast<intptr_t>(event)); @@ -68,14 +64,15 @@ namespace callui { FAIL_RETURN_VALUE(result->prepare(parent), {}, "result->prepare() failed!"); + result->show(); + return result; } AcceptDialog::AcceptDialog(IRefCountObj &rc, const EventHandler &handler): - GuiPresenter(rc), - m_handler(handler), - m_isDismissed(false) + Dialog(rc), + m_handler(handler) { } @@ -86,46 +83,29 @@ namespace callui { Result AcceptDialog::prepare(ElmWidget &parent) { - FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR), - "Presenter::prepare() failed!"); - - FAIL_RETURN(createPopup(parent, impl::POPUP_STYLE), - "createPopup() failed!"); - - FAIL_RETURN(createGenlist(), - "createGenlist() failed!"); - - m_selfRef = asShared(*this); - - setLanguageChangeCallback(); - - addDeactivatorException(this); - broadcastDeactivate(); + FAIL_RETURN(Dialog::prepare(parent, PopupType::NORMAL, + [this]() + { + return doPrepare(); + }), + "Dialog::prepare failed"); return RES_OK; } - Result AcceptDialog::createPopup(ElmWidget &parent, ElmStyle style) + Result AcceptDialog::doPrepare() { - Evas_Object *const popupEo = elm_popup_add(parent); - if (!popupEo) { - LOG_RETURN(RES_FAIL, "elm_popup_add() failed!"); - } - m_popup = makeShared<StyledWidget>(popupEo); - m_popup->setStyle(style); - m_popup->setWeight(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - show(*m_popup); + m_popup->setStyle(impl::POPUP_STYLE); - m_popup->addEventHandler(impl::POPUP_DISMISSED, - WEAK_DELEGATE_THIS(onPopupDismissed)); + FAIL_RETURN(createGenlist(), "createGenlist() failed!"); - eext_object_event_callback_add(*m_popup, EEXT_CALLBACK_BACK, - CALLBACK_A(AcceptDialog::onPopupHWBackKey), this); + setLanguageChangeCallback(); return RES_OK; } - void AcceptDialog::onGenlistItemClickedCb(Evas_Object *obj, void *eventInfo) + void AcceptDialog::onGenlistItemClickedCb(Evas_Object *obj, + void *eventInfo) { if (!eventInfo) LOG_RETURN_VOID(RES_FAIL, "eventInfo is NULL"); @@ -155,7 +135,7 @@ namespace callui { FAIL_RETURN(fillGenlist(), "fillGenlist() failed!"); - m_popup->setContent(glEo, impl::PART_SWL_CONTENT); + m_popup->setContent(glEo); return RES_OK; } @@ -164,7 +144,8 @@ namespace callui { { static Elm_Genlist_Item_Class titleItc = utils::createGenlistItemClass("title", - [](void *data, Evas_Object *obj, const char *part) -> char * { + [](void *data, Evas_Object *obj, const char *part) -> char * + { return strdup(STR_ANSWER_CALL.translate()); }); @@ -184,7 +165,8 @@ namespace callui { { static Elm_Genlist_Item_Class textItc = utils::createGenlistItemClass("1text.1icon", - [](void *data, Evas_Object *obj, const char *part) -> char * { + [](void *data, Evas_Object *obj, const char *part) -> char * + { switch (impl::asEvent(data)) { case Event::HOLD_AND_ACCEPT: return strdup(STR_HOLD_AND_ACCEPT.translate()); @@ -223,7 +205,6 @@ namespace callui { return RES_OK; } - Result AcceptDialog::fillGenlist() { FAIL_RETURN(addGenlistTitleItem(), "addGenlistTitleItem() failed!"); @@ -275,45 +256,9 @@ namespace callui { return true; } - void AcceptDialog::onPopupDismissed(ucl::Widget &widget, void *eventInfo) - { - dispose(); - } - - void AcceptDialog::onPopupHWBackKey(Evas_Object *obj, void *eventInfo) + void AcceptDialog::onBackKey() { - if (!m_isDismissed) { - handleEvent(Event::BACK); - } - } - - void AcceptDialog::dismiss() - { - if (m_popup && !m_isDismissed) { - m_isDismissed = true; - deactivateBy(m_popup.get()); - elm_popup_dismiss(*m_popup); - } + handleEvent(Event::BACK); } - void AcceptDialog::dispose() - { - if (m_popup) { - - eext_object_event_callback_del(*m_popup, EEXT_CALLBACK_BACK, - CALLBACK_A(AcceptDialog::onPopupHWBackKey)); - - deactivateBy(m_popup.get()); - broadcastActivate(); - - m_popup.reset(); - - m_selfRef.reset(); - } - } - - bool AcceptDialog::isDisposed() const - { - return (!m_popup); - } } diff --git a/call-ui/presenters/dialogs/AcceptDialog.h b/call-ui/presenters/dialogs/AcceptDialog.h index fae6945..6fb1cb8 100644 --- a/call-ui/presenters/dialogs/AcceptDialog.h +++ b/call-ui/presenters/dialogs/AcceptDialog.h @@ -17,9 +17,7 @@ #ifndef __CALL_UI_PRESENTERS_DIALOGS_ACCEPT_DIALOG_H__ #define __CALL_UI_PRESENTERS_DIALOGS_ACCEPT_DIALOG_H__ -#include "ucl/mvp/GuiPresenter.h" - -#include "ucl/gui/StyledWidget.h" +#include "base/Dialog.h" #include "call-ui/types.h" @@ -30,8 +28,7 @@ namespace callui { /** * @brief Presenter of Accept call dialog */ - class AcceptDialog final : public ucl::GuiPresenter, - public ucl::IDisposable { + class AcceptDialog final : public Dialog { public: /** @@ -51,7 +48,7 @@ namespace callui { public: /** - * AcceptDialog builer + * AcceptDialog builder */ class Builder { public: @@ -77,32 +74,13 @@ namespace callui { EventHandler m_handler; }; - public: - - /** - * @brief Dismisses dialog - */ - void dismiss(); - - // ucl::IDisposable // - - /** - * @see ucl::IDisposable::dispose() - */ - virtual void dispose() final override; - - /** - * @see ucl::IDisposable::isDisposed() - */ - virtual bool isDisposed() const final override; - private: AcceptDialog(ucl::IRefCountObj &rc, const EventHandler &handler); ~AcceptDialog(); ucl::Result prepare(ucl::ElmWidget &parent); + ucl::Result doPrepare(); - ucl::Result createPopup(ucl::ElmWidget &parent, ucl::ElmStyle style); ucl::Result createGenlist(); ucl::Result fillGenlist(); ucl::Result addGenlistTitleItem(); @@ -116,17 +94,15 @@ namespace callui { void handleEvent(Event event); bool dispatchEvent(Event event); - void onPopupDismissed(ucl::Widget &widget, void *eventInfo); - void onPopupHWBackKey(Evas_Object *obj, void *eventInfo); - void onGenlistItemClickedCb(Evas_Object *obj, void *eventInfo); + // Dialog // + + virtual void onBackKey() override final; + private: const EventHandler m_handler; - ucl::StyledWidgetSRef m_popup; ucl::StyledWidgetSRef m_genlist; - AcceptDialogSRef m_selfRef; - bool m_isDismissed; friend class ucl::ReffedObj<AcceptDialog>; }; diff --git a/call-ui/presenters/dialogs/base/Dialog.cpp b/call-ui/presenters/dialogs/base/Dialog.cpp new file mode 100644 index 0000000..7cde517 --- /dev/null +++ b/call-ui/presenters/dialogs/base/Dialog.cpp @@ -0,0 +1,129 @@ +/* + * Copyright 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "Dialog.h" + +#include "call-ui/presenters/common.h" + +namespace callui { + + Dialog::Dialog(IRefCountObj &rc) : + GuiPresenter(rc), + m_isDismissed(false) + { + deactivateSelf(); + } + + Dialog::~Dialog() + { + if (const auto window = getWindowRef()) { + window->delEventHandler( + WidgetEvent::DEL, DELEGATE_THIS(onWindowDel)); + } + } + + Result Dialog::createPopup(ElmWidget &parent, const PopupType popupType) + { + Evas_Object *const popupEo = ((popupType == PopupType::NORMAL) ? + elm_popup_add(parent) : elm_ctxpopup_add(parent)); + if (!popupEo) { + LOG_RETURN(RES_FAIL, "elm_popup_add() failed!"); + } + + m_popup = makeShared<StyledWidget>(popupEo); + + m_popup->addEventHandler( + POPUP_DISMISSED, WEAK_DELEGATE_THIS(onPopupDismissed)); + + eext_object_event_callback_add(*m_popup, EEXT_CALLBACK_BACK, + CALLBACK_A(Dialog::onPopupHWBackKey), this); + + getWindow().addEventHandler( + WidgetEvent::DEL, WEAK_DELEGATE_THIS(onWindowDel)); + + return RES_OK; + } + + void Dialog::show() + { + using ucl::show; + if (m_popup && !m_isDismissed && !m_popup->isVisible()) { + show(*m_popup); + onShow(); + broadcastDeactivate(); + activateSelf(); + } + } + + void Dialog::dismiss() + { + if (m_popup && !m_isDismissed && m_popup->isVisible()) { + m_isDismissed = true; + deactivateSelf(); + elm_popup_dismiss(*m_popup); + onDismiss(); + } + } + + void Dialog::dispose() + { + if (m_popup) { + eext_object_event_callback_del(*m_popup, EEXT_CALLBACK_BACK, + CALLBACK_A(Dialog::onPopupHWBackKey)); + + deactivateSelf(); + m_popup.reset(); + m_selfRef.reset(); + + broadcastActivate(); + } + } + + bool Dialog::isDisposed() const + { + return !!m_popup; + } + + void Dialog::onPopupDismissed(Widget &widget, void *eventInfo) + { + dispose(); + } + + void Dialog::onPopupHWBackKey(Evas_Object *obj, void *eventInfo) + { + if (isActive()) { + onBackKey(); + } + } + + void Dialog::onWindowDel(Widget &widget, void *eventInfo) + { + dispose(); + } + + void Dialog::onShow() + { + } + + void Dialog::onDismiss() + { + } + + void Dialog::onBackKey() + { + dismiss(); + } +} diff --git a/call-ui/presenters/dialogs/base/Dialog.h b/call-ui/presenters/dialogs/base/Dialog.h new file mode 100644 index 0000000..bcb4155 --- /dev/null +++ b/call-ui/presenters/dialogs/base/Dialog.h @@ -0,0 +1,124 @@ +/* + * Copyright 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CALL_UI_PRESENTERS_DIALOGS_BASE_DIALOG_H__ +#define __CALL_UI_PRESENTERS_DIALOGS_BASE_DIALOG_H__ + +#include "ucl/gui/StyledWidget.h" + +#include "ucl/mvp/GuiPresenter.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(Dialog); + + /** + * @brief Base class for Dialogs + */ + class Dialog : public ucl::GuiPresenter, + public ucl::IDisposable { + public: + + /** + * @brief Shows dialog + */ + void show(); + + /** + * @brief Dismisses dialog + */ + void dismiss(); + + // ucl::IDisposable // + + /** + * @see ucl::IDisposable::dispose() + */ + virtual void dispose() final override; + + /** + * @see ucl::IDisposable::isDisposed() + */ + virtual bool isDisposed() const final override; + + protected: + /** + * @brief Enumeration of popup type for Dialog + */ + enum class PopupType { + NORMAL, /** < Default popup type */ + CONTEXT /** < Context popup type */ + }; + + protected: + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + */ + Dialog(ucl::IRefCountObj &rc); + + /** + * @brief Destructor + */ + ~Dialog(); + + /** + * @brief Prepares Dialog data + * @param[in] parent Parent for the popup + * @param[in] popupType Popup type + * @param[in] onPrepare Callback function to be called + * on child side to initialize child defined data + * @return RES_OK on success, otherwise error result. + */ + template <class ON_PREPARE> + ucl::Result prepare(ucl::ElmWidget &parent, PopupType popupType, + ON_PREPARE &&onPrepare); + + /** + * @brief Called on Dialog show event. + */ + virtual void onShow(); + + /** + * @brief Called on Dialog dismiss event. + */ + virtual void onDismiss(); + + /** + * @brief Called on Dialog back key press event. + */ + virtual void onBackKey(); + + private: + ucl::Result createPopup(ucl::ElmWidget &parent, PopupType popupType); + + void onPopupDismissed(ucl::Widget &widget, void *eventInfo); + void onPopupHWBackKey(Evas_Object *obj, void *eventInfo); + void onWindowDel(ucl::Widget &widget, void *eventInfo); + + protected: + ucl::StyledWidgetSRef m_popup; + private: + DialogSRef m_selfRef; + bool m_isDismissed; + }; +} + +#include "Dialog.hpp" + +#endif // __CALL_UI_PRESENTERS_DIALOGS_BASE_DIALOG_H__ diff --git a/call-ui/presenters/dialogs/base/Dialog.hpp b/call-ui/presenters/dialogs/base/Dialog.hpp new file mode 100644 index 0000000..090edfc --- /dev/null +++ b/call-ui/presenters/dialogs/base/Dialog.hpp @@ -0,0 +1,39 @@ +/* + * Copyright 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ucl/util/logging.h" + +namespace callui { + + template <class ON_PREPARE> + inline ucl::Result Dialog::prepare(ucl::ElmWidget &parent, + const PopupType popupType, ON_PREPARE &&onPrepare) + { + UCL_FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR), + "GuiPresenter::prepare() failed!"); + + UCL_FAIL_RETURN(createPopup(parent, popupType), + "createPopup() failed!"); + + setDeactivatorSink(m_popup); + + UCL_FAIL_RETURN(onPrepare(), "onPrepare() failed!"); + + m_selfRef = asShared(*this); + + return ucl::RES_OK; + } +} diff --git a/call-ui/view/common.h b/call-ui/view/common.h index cf9b0d4..c8e2100 100644 --- a/call-ui/view/common.h +++ b/call-ui/view/common.h @@ -37,6 +37,7 @@ namespace callui { constexpr ucl::SmartEvent BTN_CLICKED {"clicked"}; constexpr ucl::SmartEvent ATSPI_HIGHLIGHTED {"atspi,highlighted"}; + constexpr ucl::SmartEvent POPUP_DISMISSED {"dismissed"}; } #endif // __CALL_UI_VIEW_COMMON_H__ diff --git a/project_def.prop b/project_def.prop index c5169af..22da83a 100644 --- a/project_def.prop +++ b/project_def.prop @@ -9,7 +9,7 @@ type = app profile = wearable-4.0 # C/CPP Sources -USER_SRCS = call-ui/view/VolumeControl.cpp call-ui/model/impl/CallInfo.cpp call-ui/model/impl/IncomingCall.cpp ucl/source/appfw/helpers.cpp ucl/source/mvp/ListItemPresenter.cpp call-ui/model/impl/RejectMsg.cpp ucl/source/gui/Genlist.cpp ucl/source/util/types/Result.cpp call-ui/model/impl/ConferenceCallInfo.cpp call-ui/model/impl/BluetoothManager.cpp ucl/source/gui/Layout.cpp call-ui/presenters/misc/MotionSensorPresenter.cpp call-ui/model/impl/RssiStateSource.cpp call-ui/presenters/Instance.cpp call-ui/model/impl/ActiveCall.cpp call-ui/model/impl/SimSlotStateSource.cpp call-ui/presenters/misc/AcceptRejectPresenter.cpp ucl/source/gui/WidgetItem.cpp call-ui/presenters/pages/MainPage.cpp ucl/source/gui/NaviItem.cpp call-ui/presenters/misc/DeviceStatePresenter.cpp call-ui/model/impl/ContactInfoProvider.cpp call-ui/model/impl/HdVoiceStateSource.cpp ucl/source/gui/Window.cpp call-ui/model/impl/ConnectionStateSource.cpp call-ui/presenters/misc/RejectMsgPresenter.cpp call-ui/presenters/pages/KeypadPage.cpp ucl/source/util/logging.cpp ucl/source/appfw/UIApp.cpp call-ui/presenters/misc/AccessoryPresenter.cpp call-ui/model/impl/ContactInfo.cpp call-ui/model/impl/EndCall.cpp call-ui/view/Slider.cpp call-ui/model/impl/RejectMsgProvider.cpp ucl/source/mvp/GuiPresenter.cpp ucl/source/appfw/InstanceManagerBase.cpp call-ui/model/impl/BatteryStateSource.cpp ucl/source/gui/Widget.cpp call-ui/presenters/dialogs/AcceptDialog.cpp call-ui/types.cpp call-ui/presenters/misc/helpers.cpp call-ui/model/impl/IndicatorStateProvider.cpp call-ui/view/AcceptRejectWidget.cpp ucl/source/misc/Timeout.cpp call-ui/resources.cpp ucl/source/util/types/classTypes.cpp call-ui/model/CallUIBuilder.cpp call-ui/presenters/misc/CallStatusPresenter.cpp call-ui/model/impl/HeldCall.cpp call-ui/model/impl/SoundManager.cpp ucl/source/gui/EdjeWidget.cpp call-ui/model/impl/MsgClient.cpp call-ui/presenters/InstanceManager.cpp call-ui/presenters/pages/base/Page.cpp call-ui/presenters/misc/MoreOptionsPresenter.cpp call-ui/presenters/misc/IndicatorPresenter.cpp call-ui/presenters/misc/AtspiHighlightHelper.cpp ucl/source/gui/Naviframe.cpp call-ui/model/impl/CallUI.cpp ucl/source/gui/ElmWidget.cpp ucl/source/gui/RadioBox.cpp ucl/source/misc/Variant.cpp call-ui/view/helpers.cpp call-ui/main.cpp call-ui/model/impl/CallManager.cpp call-ui/presenters/misc/CallInfoPresenter.cpp ucl/source/appfw/SysEventProvider.cpp call-ui/model/impl/CallClient.cpp ucl/source/mvp/ListPresenter.cpp +USER_SRCS = call-ui/presenters/dialogs/base/Dialog.cpp call-ui/view/VolumeControl.cpp call-ui/model/impl/CallInfo.cpp call-ui/model/impl/IncomingCall.cpp ucl/source/appfw/helpers.cpp ucl/source/mvp/ListItemPresenter.cpp call-ui/model/impl/RejectMsg.cpp ucl/source/gui/Genlist.cpp ucl/source/util/types/Result.cpp call-ui/model/impl/ConferenceCallInfo.cpp call-ui/model/impl/BluetoothManager.cpp ucl/source/gui/Layout.cpp call-ui/presenters/misc/MotionSensorPresenter.cpp call-ui/model/impl/RssiStateSource.cpp call-ui/presenters/Instance.cpp call-ui/model/impl/ActiveCall.cpp call-ui/model/impl/SimSlotStateSource.cpp call-ui/presenters/misc/AcceptRejectPresenter.cpp ucl/source/gui/WidgetItem.cpp call-ui/presenters/pages/MainPage.cpp ucl/source/gui/NaviItem.cpp call-ui/presenters/misc/DeviceStatePresenter.cpp call-ui/model/impl/ContactInfoProvider.cpp call-ui/model/impl/HdVoiceStateSource.cpp ucl/source/gui/Window.cpp call-ui/model/impl/ConnectionStateSource.cpp call-ui/presenters/misc/RejectMsgPresenter.cpp call-ui/presenters/pages/KeypadPage.cpp ucl/source/util/logging.cpp ucl/source/appfw/UIApp.cpp call-ui/presenters/misc/AccessoryPresenter.cpp call-ui/model/impl/ContactInfo.cpp call-ui/model/impl/EndCall.cpp call-ui/view/Slider.cpp call-ui/model/impl/RejectMsgProvider.cpp ucl/source/mvp/GuiPresenter.cpp ucl/source/appfw/InstanceManagerBase.cpp call-ui/model/impl/BatteryStateSource.cpp ucl/source/gui/Widget.cpp call-ui/presenters/dialogs/AcceptDialog.cpp call-ui/types.cpp call-ui/presenters/misc/helpers.cpp call-ui/model/impl/IndicatorStateProvider.cpp call-ui/view/AcceptRejectWidget.cpp ucl/source/misc/Timeout.cpp call-ui/resources.cpp ucl/source/util/types/classTypes.cpp call-ui/model/CallUIBuilder.cpp call-ui/presenters/misc/CallStatusPresenter.cpp call-ui/model/impl/HeldCall.cpp call-ui/model/impl/SoundManager.cpp ucl/source/gui/EdjeWidget.cpp call-ui/model/impl/MsgClient.cpp call-ui/presenters/InstanceManager.cpp call-ui/presenters/pages/base/Page.cpp call-ui/presenters/misc/MoreOptionsPresenter.cpp call-ui/presenters/misc/IndicatorPresenter.cpp call-ui/presenters/misc/AtspiHighlightHelper.cpp ucl/source/gui/Naviframe.cpp call-ui/model/impl/CallUI.cpp ucl/source/gui/ElmWidget.cpp ucl/source/gui/RadioBox.cpp ucl/source/misc/Variant.cpp call-ui/view/helpers.cpp call-ui/main.cpp call-ui/model/impl/CallManager.cpp call-ui/presenters/misc/CallInfoPresenter.cpp ucl/source/appfw/SysEventProvider.cpp call-ui/model/impl/CallClient.cpp ucl/source/mvp/ListPresenter.cpp # EDC Sources USER_EDCS = |