diff options
-rw-r--r-- | .cproject | 112 | ||||
-rw-r--r-- | Build/makefile | 2 | ||||
-rw-r--r-- | Build/makefile.mk | 40 | ||||
-rw-r--r-- | Build/platform.mk | 9 | ||||
-rw-r--r-- | LICENSE.Flora | 206 | ||||
-rw-r--r-- | call-ui/common.h (renamed from src/common.h) | 11 | ||||
-rw-r--r-- | call-ui/config.h (renamed from inc/config.h) | 6 | ||||
-rw-r--r-- | call-ui/helpers.h (renamed from src/helpers.h) | 13 | ||||
-rw-r--r-- | call-ui/helpers.hpp (renamed from src/helpers.hpp) | 21 | ||||
-rw-r--r-- | call-ui/main.cpp (renamed from src/main.cpp) | 0 | ||||
-rw-r--r-- | call-ui/model/CallUIBuilder.cpp (renamed from src/model/CallUIBuilder.cpp) | 6 | ||||
-rw-r--r-- | call-ui/model/CallUIBuilder.h (renamed from inc/model/CallUIBuilder.h) | 22 | ||||
-rw-r--r-- | call-ui/model/IActiveCall.h | 74 | ||||
-rw-r--r-- | call-ui/model/IBaseCallInfo.h (renamed from inc/model/IBaseCallInfo.h) | 32 | ||||
-rw-r--r-- | call-ui/model/ICallInfo.h | 95 | ||||
-rw-r--r-- | call-ui/model/ICallListener.h (renamed from inc/model/ICallListener.h) | 27 | ||||
-rw-r--r-- | call-ui/model/ICallManager.h | 90 | ||||
-rw-r--r-- | call-ui/model/ICallUI.h (renamed from inc/model/ICallUI.h) | 47 | ||||
-rw-r--r-- | call-ui/model/IConferenceCallInfo.h (renamed from inc/model/IConferenceCallInfo.h) | 15 | ||||
-rw-r--r-- | call-ui/model/IContactInfo.h | 56 | ||||
-rw-r--r-- | call-ui/model/IEndCall.h (renamed from inc/model/IEndCall.h) | 30 | ||||
-rw-r--r-- | call-ui/model/IHeldCall.h | 82 | ||||
-rw-r--r-- | call-ui/model/IIncomingCall.h | 80 | ||||
-rw-r--r-- | call-ui/model/IIndicatorStateListener.h (renamed from inc/model/IIndicatorStateListener.h) | 22 | ||||
-rw-r--r-- | call-ui/model/IIndicatorStateProvider.h (renamed from inc/model/IIndicatorStateProvider.h) | 32 | ||||
-rw-r--r-- | call-ui/model/IRejectMsg.h (renamed from inc/model/IRejectMsg.h) | 21 | ||||
-rw-r--r-- | call-ui/model/IRejectMsgProvider.h (renamed from inc/model/IRejectMsgProvider.h) | 34 | ||||
-rw-r--r-- | call-ui/model/ISoundManager.h | 165 | ||||
-rw-r--r-- | call-ui/model/IndicatorState.h | 96 | ||||
-rw-r--r-- | call-ui/model/impl/ActiveCall.cpp (renamed from src/model/ActiveCall.cpp) | 18 | ||||
-rw-r--r-- | call-ui/model/impl/ActiveCall.h (renamed from src/model/ActiveCall.h) | 63 | ||||
-rw-r--r-- | call-ui/model/impl/BatteryStateSource.cpp (renamed from src/model/BatteryStateSource.cpp) | 18 | ||||
-rw-r--r-- | call-ui/model/impl/BatteryStateSource.h (renamed from src/model/BatteryStateSource.h) | 41 | ||||
-rw-r--r-- | call-ui/model/impl/BluetoothManager.cpp (renamed from src/model/BluetoothManager.cpp) | 186 | ||||
-rw-r--r-- | call-ui/model/impl/BluetoothManager.h | 117 | ||||
-rw-r--r-- | call-ui/model/impl/CallClient.cpp (renamed from src/model/CallClient.cpp) | 0 | ||||
-rw-r--r-- | call-ui/model/impl/CallClient.h (renamed from src/model/CallClient.h) | 35 | ||||
-rw-r--r-- | call-ui/model/impl/CallInfo.cpp (renamed from src/model/CallInfo.cpp) | 36 | ||||
-rw-r--r-- | call-ui/model/impl/CallInfo.h (renamed from src/model/CallInfo.h) | 78 | ||||
-rw-r--r-- | call-ui/model/impl/CallManager.cpp (renamed from src/model/CallManager.cpp) | 165 | ||||
-rw-r--r-- | call-ui/model/impl/CallManager.h | 185 | ||||
-rw-r--r-- | call-ui/model/impl/CallUI.cpp (renamed from src/model/CallUI.cpp) | 128 | ||||
-rw-r--r-- | call-ui/model/impl/CallUI.h (renamed from src/model/CallUI.h) | 63 | ||||
-rw-r--r-- | call-ui/model/impl/ConferenceCallInfo.cpp (renamed from src/model/ConferenceCallInfo.cpp) | 25 | ||||
-rw-r--r-- | call-ui/model/impl/ConferenceCallInfo.h (renamed from src/model/ConferenceCallInfo.h) | 48 | ||||
-rw-r--r-- | call-ui/model/impl/ConnectionStateSource.cpp (renamed from src/model/ConnectionStateSource.cpp) | 105 | ||||
-rw-r--r-- | call-ui/model/impl/ConnectionStateSource.h (renamed from src/model/ConnectionStateSource.h) | 36 | ||||
-rw-r--r-- | call-ui/model/impl/ContactInfo.cpp (renamed from src/model/ContactInfo.cpp) | 33 | ||||
-rw-r--r-- | call-ui/model/impl/ContactInfo.h | 86 | ||||
-rw-r--r-- | call-ui/model/impl/ContactInfoProvider.cpp (renamed from src/model/ContactInfoProvider.cpp) | 12 | ||||
-rw-r--r-- | call-ui/model/impl/ContactInfoProvider.h (renamed from src/model/ContactInfoProvider.h) | 32 | ||||
-rw-r--r-- | call-ui/model/impl/EndCall.cpp (renamed from src/model/EndCall.cpp) | 21 | ||||
-rw-r--r-- | call-ui/model/impl/EndCall.h (renamed from src/model/EndCall.h) | 47 | ||||
-rw-r--r-- | call-ui/model/impl/HdVoiceStateSource.cpp (renamed from src/model/HdVoiceStateSource.cpp) | 19 | ||||
-rw-r--r-- | call-ui/model/impl/HdVoiceStateSource.h (renamed from src/model/HdVoiceStateSource.h) | 46 | ||||
-rw-r--r-- | call-ui/model/impl/HeldCall.cpp (renamed from src/model/HeldCall.cpp) | 21 | ||||
-rw-r--r-- | call-ui/model/impl/HeldCall.h (renamed from src/model/HeldCall.h) | 66 | ||||
-rw-r--r-- | call-ui/model/impl/ICallManagerListener.h (renamed from src/model/ICallManagerListener.h) | 29 | ||||
-rw-r--r-- | call-ui/model/impl/IIndicatorStateSource.h | 52 | ||||
-rw-r--r-- | call-ui/model/impl/IncomingCall.cpp (renamed from src/model/IncomingCall.cpp) | 28 | ||||
-rw-r--r-- | call-ui/model/impl/IncomingCall.h (renamed from src/model/IncomingCall.h) | 61 | ||||
-rw-r--r-- | call-ui/model/impl/IndicatorStateProvider.cpp (renamed from src/model/IndicatorStateProvider.cpp) | 12 | ||||
-rw-r--r-- | call-ui/model/impl/IndicatorStateProvider.h (renamed from src/model/IndicatorStateProvider.h) | 51 | ||||
-rw-r--r-- | call-ui/model/impl/MsgClient.cpp (renamed from src/model/MsgClient.cpp) | 0 | ||||
-rw-r--r-- | call-ui/model/impl/MsgClient.h (renamed from src/model/MsgClient.h) | 34 | ||||
-rw-r--r-- | call-ui/model/impl/RejectMsg.cpp (renamed from src/model/RejectMsg.cpp) | 36 | ||||
-rw-r--r-- | call-ui/model/impl/RejectMsg.h | 79 | ||||
-rw-r--r-- | call-ui/model/impl/RejectMsgProvider.cpp (renamed from src/model/RejectMsgProvider.cpp) | 7 | ||||
-rw-r--r-- | call-ui/model/impl/RejectMsgProvider.h (renamed from src/model/RejectMsgProvider.h) | 40 | ||||
-rw-r--r-- | call-ui/model/impl/RssiStateSource.cpp (renamed from src/model/RssiStateSource.cpp) | 18 | ||||
-rw-r--r-- | call-ui/model/impl/RssiStateSource.h (renamed from src/model/RssiStateSource.h) | 37 | ||||
-rw-r--r-- | call-ui/model/impl/SimSlotStateSource.cpp (renamed from src/model/SimSlotStateSource.cpp) | 15 | ||||
-rw-r--r-- | call-ui/model/impl/SimSlotStateSource.h | 89 | ||||
-rw-r--r-- | call-ui/model/impl/SoundManager.cpp (renamed from src/model/SoundManager.cpp) | 155 | ||||
-rw-r--r-- | call-ui/model/impl/SoundManager.h | 191 | ||||
-rw-r--r-- | call-ui/model/impl/common.h (renamed from src/model/common.h) | 8 | ||||
-rw-r--r-- | call-ui/model/impl/helpers.h | 100 | ||||
-rw-r--r-- | call-ui/model/impl/helpers.hpp (renamed from src/model/helpers.hpp) | 9 | ||||
-rw-r--r-- | call-ui/model/impl/types.h | 43 | ||||
-rw-r--r-- | call-ui/model/types.h | 195 | ||||
-rw-r--r-- | call-ui/presenters/Instance.cpp (renamed from src/presenters/Instance.cpp) | 149 | ||||
-rw-r--r-- | call-ui/presenters/Instance.h (renamed from inc/presenters/Instance.h) | 22 | ||||
-rw-r--r-- | call-ui/presenters/InstanceManager.cpp (renamed from src/presenters/InstanceManager.cpp) | 4 | ||||
-rw-r--r-- | call-ui/presenters/InstanceManager.h (renamed from inc/presenters/InstanceManager.h) | 8 | ||||
-rw-r--r-- | call-ui/presenters/common.h | 28 | ||||
-rw-r--r-- | call-ui/presenters/dialogs/AcceptDialog.cpp | 213 | ||||
-rw-r--r-- | call-ui/presenters/dialogs/AcceptDialog.h | 115 | ||||
-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/presenters/items/RejectMsgListItem.cpp | 86 | ||||
-rw-r--r-- | call-ui/presenters/items/RejectMsgListItem.h | 84 | ||||
-rw-r--r-- | call-ui/presenters/items/SimpleListItem.cpp | 76 | ||||
-rw-r--r-- | call-ui/presenters/items/SimpleListItem.h | 94 | ||||
-rw-r--r-- | call-ui/presenters/misc/AcceptRejectPresenter.cpp (renamed from src/presenters/AcceptRejectPresenter.cpp) | 84 | ||||
-rw-r--r-- | call-ui/presenters/misc/AcceptRejectPresenter.h | 164 | ||||
-rw-r--r-- | call-ui/presenters/misc/AccessoryPresenter.cpp | 646 | ||||
-rw-r--r-- | call-ui/presenters/misc/AccessoryPresenter.h | 204 | ||||
-rw-r--r-- | call-ui/presenters/misc/AtspiHighlightHelper.cpp | 149 | ||||
-rw-r--r-- | call-ui/presenters/misc/AtspiHighlightHelper.h | 93 | ||||
-rw-r--r-- | call-ui/presenters/misc/CallInfoPresenter.cpp (renamed from src/presenters/CallInfoPresenter.cpp) | 273 | ||||
-rw-r--r-- | call-ui/presenters/misc/CallInfoPresenter.h | 174 | ||||
-rw-r--r-- | call-ui/presenters/misc/CallStatusPresenter.cpp (renamed from src/presenters/CallStatusPresenter.cpp) | 125 | ||||
-rw-r--r-- | call-ui/presenters/misc/CallStatusPresenter.h | 143 | ||||
-rw-r--r-- | call-ui/presenters/misc/DeviceStatePresenter.cpp (renamed from src/presenters/DeviceStatePresenter.cpp) | 29 | ||||
-rw-r--r-- | call-ui/presenters/misc/DeviceStatePresenter.h | 143 | ||||
-rw-r--r-- | call-ui/presenters/misc/IndicatorPresenter.cpp (renamed from src/presenters/IndicatorPresenter.cpp) | 96 | ||||
-rw-r--r-- | call-ui/presenters/misc/IndicatorPresenter.h (renamed from inc/presenters/IndicatorPresenter.h) | 76 | ||||
-rw-r--r-- | call-ui/presenters/misc/MoreOptionsPresenter.cpp (renamed from src/presenters/MoreOptionsPresenter.cpp) | 376 | ||||
-rw-r--r-- | call-ui/presenters/misc/MoreOptionsPresenter.h | 211 | ||||
-rw-r--r-- | call-ui/presenters/misc/MotionSensorPresenter.cpp (renamed from src/presenters/MotionSensorPresenter.cpp) | 23 | ||||
-rw-r--r-- | call-ui/presenters/misc/MotionSensorPresenter.h (renamed from inc/presenters/MotionSensorPresenter.h) | 41 | ||||
-rw-r--r-- | call-ui/presenters/misc/RejectMsgPresenter.cpp | 501 | ||||
-rw-r--r-- | call-ui/presenters/misc/RejectMsgPresenter.h | 210 | ||||
-rw-r--r-- | call-ui/presenters/misc/VolumeControlPresenter.cpp | 418 | ||||
-rw-r--r-- | call-ui/presenters/misc/VolumeControlPresenter.h | 163 | ||||
-rw-r--r-- | call-ui/presenters/misc/helpers.cpp | 188 | ||||
-rw-r--r-- | call-ui/presenters/misc/helpers.h | 129 | ||||
-rw-r--r-- | call-ui/presenters/pages/KeypadPage.cpp | 403 | ||||
-rw-r--r-- | call-ui/presenters/pages/KeypadPage.h | 129 | ||||
-rw-r--r-- | call-ui/presenters/pages/MainPage.cpp | 852 | ||||
-rw-r--r-- | call-ui/presenters/pages/MainPage.h | 186 | ||||
-rw-r--r-- | call-ui/presenters/pages/base/Page.cpp (renamed from src/presenters/Page.cpp) | 35 | ||||
-rw-r--r-- | call-ui/presenters/pages/base/Page.h | 181 | ||||
-rw-r--r-- | call-ui/presenters/pages/base/Page.hpp (renamed from inc/presenters/Page.hpp) | 2 | ||||
-rw-r--r-- | call-ui/presenters/types.h | 46 | ||||
-rw-r--r-- | call-ui/resources.cpp | 93 | ||||
-rw-r--r-- | call-ui/resources.h (renamed from inc/resources.h) | 26 | ||||
-rw-r--r-- | call-ui/types.cpp (renamed from src/types.cpp) | 0 | ||||
-rw-r--r-- | call-ui/types.h (renamed from inc/types.h) | 6 | ||||
-rw-r--r-- | call-ui/view/AcceptRejectWidget.cpp (renamed from src/view/AcceptRejectWidget.cpp) | 402 | ||||
-rw-r--r-- | call-ui/view/AcceptRejectWidget.h (renamed from inc/view/AcceptRejectWidget.h) | 108 | ||||
-rw-r--r-- | call-ui/view/AoSequencer.cpp | 82 | ||||
-rw-r--r-- | call-ui/view/AoSequencer.h | 105 | ||||
-rw-r--r-- | call-ui/view/AoSequencer.hpp | 78 | ||||
-rw-r--r-- | call-ui/view/Slider.cpp (renamed from src/view/Slider.cpp) | 40 | ||||
-rw-r--r-- | call-ui/view/Slider.h (renamed from inc/view/Slider.h) | 60 | ||||
-rw-r--r-- | call-ui/view/VolumeControl.cpp | 247 | ||||
-rw-r--r-- | call-ui/view/VolumeControl.h | 191 | ||||
-rw-r--r-- | call-ui/view/common.h (renamed from src/view/common.h) | 12 | ||||
-rw-r--r-- | call-ui/view/helpers.cpp | 232 | ||||
-rw-r--r-- | call-ui/view/helpers.h | 142 | ||||
-rw-r--r-- | call-ui/view/types.h (renamed from inc/view/types.h) | 26 | ||||
-rw-r--r-- | edc/accept_reject.edc | 39 | ||||
-rw-r--r-- | edc/buttons.edc | 2 | ||||
-rw-r--r-- | edc/call_info.edc | 159 | ||||
-rw-r--r-- | edc/color_classes.edc | 2 | ||||
-rw-r--r-- | edc/images/Indicator_icon/indi_voice_control.png | bin | 1442 -> 0 bytes | |||
-rw-r--r-- | edc/images/w_outgoing_icon_gear_02.png | bin | 0 -> 2257 bytes | |||
-rw-r--r-- | edc/images/w_outgoing_icon_towatch_02.png | bin | 1826 -> 0 bytes | |||
-rw-r--r-- | edc/indicator.edc | 27 | ||||
-rw-r--r-- | edc/main_ly.edc | 28 | ||||
-rw-r--r-- | edc/more_option.edc | 9 | ||||
-rw-r--r-- | edc/reject_msg.edc | 13 | ||||
-rw-r--r-- | edc/volume_control.edc | 12 | ||||
-rw-r--r-- | inc/model/IActiveCall.h | 35 | ||||
-rw-r--r-- | inc/model/ICallInfo.h | 44 | ||||
-rw-r--r-- | inc/model/ICallManager.h | 34 | ||||
-rw-r--r-- | inc/model/IContactInfo.h | 32 | ||||
-rw-r--r-- | inc/model/IHeldCall.h | 35 | ||||
-rw-r--r-- | inc/model/IIncomingCall.h | 35 | ||||
-rw-r--r-- | inc/model/ISoundManager.h | 57 | ||||
-rw-r--r-- | inc/model/IndicatorState.h | 41 | ||||
-rw-r--r-- | inc/model/types.h | 172 | ||||
-rw-r--r-- | inc/presenters/AcceptDialog.h | 85 | ||||
-rw-r--r-- | inc/presenters/AcceptRejectPresenter.h | 97 | ||||
-rw-r--r-- | inc/presenters/AccessoryPresenter.h | 137 | ||||
-rw-r--r-- | inc/presenters/CallInfoPresenter.h | 99 | ||||
-rw-r--r-- | inc/presenters/CallStatusPresenter.h | 80 | ||||
-rw-r--r-- | inc/presenters/DeviceStatePresenter.h | 64 | ||||
-rw-r--r-- | inc/presenters/KeypadPage.h | 100 | ||||
-rw-r--r-- | inc/presenters/MainPage.h | 123 | ||||
-rw-r--r-- | inc/presenters/MoreOptionsPresenter.h | 118 | ||||
-rw-r--r-- | inc/presenters/Page.h | 93 | ||||
-rw-r--r-- | inc/presenters/RejectMsgPresenter.h | 116 | ||||
-rw-r--r-- | inc/presenters/types.h | 88 | ||||
-rw-r--r-- | inc/view/VolumeControl.h | 81 | ||||
-rw-r--r-- | inc/view/helpers.h | 49 | ||||
-rw-r--r-- | project_def.prop | 14 | ||||
-rw-r--r-- | res/po/ar.po | 123 | ||||
-rw-r--r-- | res/po/az.po | 123 | ||||
-rw-r--r-- | res/po/bg.po | 123 | ||||
-rw-r--r-- | res/po/ca.po | 123 | ||||
-rw-r--r-- | res/po/cs.po | 123 | ||||
-rw-r--r-- | res/po/da.po | 123 | ||||
-rw-r--r-- | res/po/de.po | 123 | ||||
-rw-r--r-- | res/po/el_GR.po | 123 | ||||
-rw-r--r-- | res/po/en.po | 123 | ||||
-rw-r--r-- | res/po/en_PH.po | 123 | ||||
-rw-r--r-- | res/po/en_US.po | 123 | ||||
-rw-r--r-- | res/po/es_ES.po | 123 | ||||
-rw-r--r-- | res/po/es_US.po | 123 | ||||
-rw-r--r-- | res/po/et.po | 123 | ||||
-rw-r--r-- | res/po/eu.po | 123 | ||||
-rw-r--r-- | res/po/fi.po | 123 | ||||
-rw-r--r-- | res/po/fr.po | 123 | ||||
-rw-r--r-- | res/po/fr_CA.po | 123 | ||||
-rw-r--r-- | res/po/ga.po | 123 | ||||
-rw-r--r-- | res/po/gl.po | 123 | ||||
-rw-r--r-- | res/po/hi.po | 123 | ||||
-rw-r--r-- | res/po/hr.po | 123 | ||||
-rw-r--r-- | res/po/hu.po | 123 | ||||
-rw-r--r-- | res/po/hy.po | 123 | ||||
-rw-r--r-- | res/po/is.po | 123 | ||||
-rw-r--r-- | res/po/it_IT.po | 123 | ||||
-rw-r--r-- | res/po/ja_JP.po | 123 | ||||
-rw-r--r-- | res/po/ka.po | 123 | ||||
-rw-r--r-- | res/po/kk.po | 123 | ||||
-rw-r--r-- | res/po/ko_KR.po | 123 | ||||
-rw-r--r-- | res/po/lt.po | 123 | ||||
-rw-r--r-- | res/po/lv.po | 123 | ||||
-rw-r--r-- | res/po/mk.po | 123 | ||||
-rw-r--r-- | res/po/nb.po | 123 | ||||
-rw-r--r-- | res/po/nl.po | 123 | ||||
-rw-r--r-- | res/po/pl.po | 123 | ||||
-rw-r--r-- | res/po/pt_BR.po | 123 | ||||
-rw-r--r-- | res/po/pt_PT.po | 123 | ||||
-rw-r--r-- | res/po/ro.po | 123 | ||||
-rw-r--r-- | res/po/ru_RU.po | 123 | ||||
-rw-r--r-- | res/po/sk.po | 123 | ||||
-rw-r--r-- | res/po/sl.po | 123 | ||||
-rw-r--r-- | res/po/sr.po | 123 | ||||
-rw-r--r-- | res/po/sv.po | 123 | ||||
-rw-r--r-- | res/po/tr_TR.po | 123 | ||||
-rw-r--r-- | res/po/uk.po | 123 | ||||
-rw-r--r-- | res/po/uz.po | 123 | ||||
-rw-r--r-- | res/po/zh_CN.po | 123 | ||||
-rw-r--r-- | res/po/zh_HK.po | 123 | ||||
-rw-r--r-- | res/po/zh_TW.po | 123 | ||||
-rw-r--r-- | src/model/BluetoothManager.h | 69 | ||||
-rw-r--r-- | src/model/CallManager.h | 98 | ||||
-rw-r--r-- | src/model/ContactInfo.h | 58 | ||||
-rw-r--r-- | src/model/IIndicatorStateSource.h | 33 | ||||
-rw-r--r-- | src/model/RejectMsg.h | 51 | ||||
-rw-r--r-- | src/model/SimSlotStateSource.h | 55 | ||||
-rw-r--r-- | src/model/SoundManager.h | 102 | ||||
-rw-r--r-- | src/model/VoiceControlStateProvider.cpp | 121 | ||||
-rw-r--r-- | src/model/VoiceControlStateProvider.h | 55 | ||||
-rw-r--r-- | src/model/VoiceControlStateSource.cpp | 110 | ||||
-rw-r--r-- | src/model/VoiceControlStateSource.h | 73 | ||||
-rw-r--r-- | src/model/helpers.h | 52 | ||||
-rw-r--r-- | src/model/implTypes.h | 84 | ||||
-rw-r--r-- | src/presenters/AcceptDialog.cpp | 297 | ||||
-rw-r--r-- | src/presenters/AccessoryPresenter.cpp | 688 | ||||
-rw-r--r-- | src/presenters/KeypadPage.cpp | 506 | ||||
-rw-r--r-- | src/presenters/MainPage.cpp | 672 | ||||
-rw-r--r-- | src/presenters/RejectMsgPresenter.cpp | 496 | ||||
-rw-r--r-- | src/presenters/common.h | 35 | ||||
-rw-r--r-- | src/presenters/helpers.cpp | 69 | ||||
-rw-r--r-- | src/presenters/helpers.h | 40 | ||||
-rw-r--r-- | src/resources.cpp | 51 | ||||
-rw-r--r-- | src/view/VolumeControl.cpp | 172 | ||||
-rw-r--r-- | src/view/helpers.cpp | 117 | ||||
-rw-r--r-- | tizen-manifest.xml | 1 | ||||
-rw-r--r-- | ucl/inc/ucl/appfw/IInstance.h | 34 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/EdjeWidget.h | 52 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/ElmWidget.h | 73 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/Genlist.h | 92 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/Layout.h | 58 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/NaviItem.h | 45 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/Naviframe.h | 100 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/Naviframe.hpp | 185 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/Theme.h | 59 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/Widget.h | 169 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/WidgetItem.h | 81 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/Window.h | 105 | ||||
-rw-r--r-- | ucl/inc/ucl/gui/helpers.h | 90 | ||||
-rw-r--r-- | ucl/inc/ucl/misc/AutoHandle.h | 92 | ||||
-rw-r--r-- | ucl/inc/ucl/misc/CString.h | 55 | ||||
-rw-r--r-- | ucl/inc/ucl/misc/ConstCString.h | 53 | ||||
-rw-r--r-- | ucl/inc/ucl/misc/Event.h | 62 | ||||
-rw-r--r-- | ucl/inc/ucl/misc/RefCountAware.h | 95 | ||||
-rw-r--r-- | ucl/inc/ucl/misc/TString.h | 72 | ||||
-rw-r--r-- | ucl/inc/ucl/misc/Variant.h | 149 | ||||
-rw-r--r-- | ucl/inc/ucl/mvp/GuiPresenter.h | 108 | ||||
-rw-r--r-- | ucl/inc/ucl/mvp/ListItemPresenter.h | 128 | ||||
-rw-r--r-- | ucl/inc/ucl/util/delegation/Callback.h | 73 | ||||
-rw-r--r-- | ucl/inc/ucl/util/delegation/Delegate.h | 56 | ||||
-rw-r--r-- | ucl/inc/ucl/util/delegation/Delegate2.h | 56 | ||||
-rw-r--r-- | ucl/inc/ucl/util/delegation/macro.h | 67 | ||||
-rw-r--r-- | ucl/inc/ucl/util/helpers.h | 115 | ||||
-rw-r--r-- | ucl/inc/ucl/util/memory/SharedRef.h | 88 | ||||
-rw-r--r-- | ucl/inc/ucl/util/memory/WeakRef.h | 84 | ||||
-rw-r--r-- | ucl/inc/ucl/util/memory/helpers.h | 139 | ||||
-rw-r--r-- | ucl/inc/ucl/util/smartDelegation/WeakDelegate.h | 46 | ||||
-rw-r--r-- | ucl/inc/ucl/util/types/classTypes.h | 75 | ||||
-rw-r--r-- | ucl/include/ucl/appfw/IInstance.h | 67 | ||||
-rw-r--r-- | ucl/include/ucl/appfw/IInstanceAppControlExt.h (renamed from ucl/inc/ucl/appfw/IInstanceAppControlExt.h) | 17 | ||||
-rw-r--r-- | ucl/include/ucl/appfw/IInstanceContext.h | 58 | ||||
-rw-r--r-- | ucl/include/ucl/appfw/InstanceManagerBase.h (renamed from ucl/inc/ucl/appfw/InstanceManagerBase.h) | 39 | ||||
-rw-r--r-- | ucl/include/ucl/appfw/SysEventProvider.h (renamed from ucl/inc/ucl/appfw/SysEventProvider.h) | 32 | ||||
-rw-r--r-- | ucl/include/ucl/appfw/SysEventProvider.hpp (renamed from ucl/inc/ucl/appfw/SysEventProvider.hpp) | 6 | ||||
-rw-r--r-- | ucl/include/ucl/appfw/UIApp.h (renamed from ucl/inc/ucl/appfw/UIApp.h) | 24 | ||||
-rw-r--r-- | ucl/include/ucl/appfw/helpers.h (renamed from ucl/inc/ucl/appfw/helpers.h) | 6 | ||||
-rw-r--r-- | ucl/include/ucl/appfw/types.h (renamed from ucl/inc/ucl/appfw/types.h) | 26 | ||||
-rw-r--r-- | ucl/include/ucl/config.h (renamed from ucl/inc/ucl/config.h) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Atspi.h | 274 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Atspi.hpp | 282 | ||||
-rw-r--r-- | ucl/include/ucl/gui/EdjeWidget.h | 117 | ||||
-rw-r--r-- | ucl/include/ucl/gui/EdjeWidget.hpp (renamed from ucl/inc/ucl/gui/EdjeWidget.hpp) | 12 | ||||
-rw-r--r-- | ucl/include/ucl/gui/ElmWidget.h | 148 | ||||
-rw-r--r-- | ucl/include/ucl/gui/ElmWidget.hpp (renamed from ucl/inc/ucl/gui/ElmWidget.hpp) | 33 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Genlist.h | 214 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Genlist.hpp (renamed from ucl/inc/ucl/gui/Genlist.hpp) | 2 | ||||
-rw-r--r-- | ucl/include/ucl/gui/GenlistItem.h (renamed from ucl/inc/ucl/gui/GenlistItem.h) | 50 | ||||
-rw-r--r-- | ucl/include/ucl/gui/GenlistItem.hpp (renamed from ucl/inc/ucl/gui/GenlistItem.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Layout.h | 132 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Layout.hpp (renamed from ucl/inc/ucl/gui/Layout.hpp) | 2 | ||||
-rw-r--r-- | ucl/include/ucl/gui/NaviItem.h | 81 | ||||
-rw-r--r-- | ucl/include/ucl/gui/NaviItem.hpp (renamed from ucl/inc/ucl/gui/NaviItem.hpp) | 9 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Naviframe.h | 304 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Naviframe.hpp | 240 | ||||
-rw-r--r-- | ucl/include/ucl/gui/RadioBox.h | 136 | ||||
-rw-r--r-- | ucl/include/ucl/gui/RadioBox.hpp | 82 | ||||
-rw-r--r-- | ucl/include/ucl/gui/StyledWidget.h (renamed from ucl/inc/ucl/gui/StyledWidget.h) | 20 | ||||
-rw-r--r-- | ucl/include/ucl/gui/StyledWidget.hpp (renamed from ucl/inc/ucl/gui/StyledWidget.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Theme.h | 146 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Theme.hpp (renamed from ucl/inc/ucl/gui/Theme.hpp) | 16 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Widget.h | 559 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Widget.hpp (renamed from ucl/inc/ucl/gui/Widget.hpp) | 56 | ||||
-rw-r--r-- | ucl/include/ucl/gui/WidgetItem.h | 230 | ||||
-rw-r--r-- | ucl/include/ucl/gui/WidgetItem.hpp (renamed from ucl/inc/ucl/gui/WidgetItem.hpp) | 12 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Window.h | 240 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Window.hpp (renamed from ucl/inc/ucl/gui/Window.hpp) | 4 | ||||
-rw-r--r-- | ucl/include/ucl/gui/helpers.h | 158 | ||||
-rw-r--r-- | ucl/include/ucl/gui/helpers.hpp (renamed from ucl/inc/ucl/gui/helpers.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/gui/stdTheme.h (renamed from ucl/inc/ucl/gui/stdTheme.h) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/gui/stdTheme/common.h (renamed from ucl/inc/ucl/gui/stdTheme/common.h) | 21 | ||||
-rw-r--r-- | ucl/include/ucl/gui/stdTheme/layout.h (renamed from ucl/inc/ucl/gui/stdTheme/layout.h) | 6 | ||||
-rw-r--r-- | ucl/include/ucl/gui/stdTheme/naviframe.h (renamed from ucl/inc/ucl/gui/stdTheme/naviframe.h) | 3 | ||||
-rw-r--r-- | ucl/include/ucl/gui/types.h (renamed from ucl/inc/ucl/gui/types.h) | 95 | ||||
-rw-r--r-- | ucl/include/ucl/gui/types.hpp (renamed from ucl/inc/ucl/gui/types.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/misc/Aspect.h (renamed from ucl/inc/ucl/misc/Aspect.h) | 46 | ||||
-rw-r--r-- | ucl/include/ucl/misc/Aspect.hpp (renamed from ucl/inc/ucl/misc/Aspect.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/misc/AutoObject.h | 137 | ||||
-rw-r--r-- | ucl/include/ucl/misc/CArray.h | 97 | ||||
-rw-r--r-- | ucl/include/ucl/misc/CArray.hpp | 71 | ||||
-rw-r--r-- | ucl/include/ucl/misc/CString.h | 123 | ||||
-rw-r--r-- | ucl/include/ucl/misc/CString.hpp (renamed from ucl/inc/ucl/misc/CString.hpp) | 10 | ||||
-rw-r--r-- | ucl/include/ucl/misc/ConstCString.h | 111 | ||||
-rw-r--r-- | ucl/include/ucl/misc/ConstCString.hpp (renamed from ucl/inc/ucl/misc/ConstCString.hpp) | 10 | ||||
-rw-r--r-- | ucl/include/ucl/misc/Event.h | 103 | ||||
-rw-r--r-- | ucl/include/ucl/misc/Event.hpp (renamed from ucl/inc/ucl/misc/Event.hpp) | 14 | ||||
-rw-r--r-- | ucl/include/ucl/misc/HashMap.h (renamed from ucl/inc/ucl/misc/HashMap.h) | 34 | ||||
-rw-r--r-- | ucl/include/ucl/misc/HashMap.hpp (renamed from ucl/inc/ucl/misc/HashMap.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/misc/MonoObservable.h | 114 | ||||
-rw-r--r-- | ucl/include/ucl/misc/MonoObservable.hpp | 105 | ||||
-rw-r--r-- | ucl/include/ucl/misc/Observable.h | 112 | ||||
-rw-r--r-- | ucl/include/ucl/misc/Observable.hpp | 98 | ||||
-rw-r--r-- | ucl/include/ucl/misc/RefCountAware.h | 200 | ||||
-rw-r--r-- | ucl/include/ucl/misc/RefCountAware.hpp (renamed from ucl/inc/ucl/misc/RefCountAware.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/misc/TString.h | 164 | ||||
-rw-r--r-- | ucl/include/ucl/misc/TString.hpp (renamed from ucl/inc/ucl/misc/TString.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/misc/Timeout.h (renamed from ucl/inc/ucl/misc/Timeout.h) | 28 | ||||
-rw-r--r-- | ucl/include/ucl/misc/Variant.h | 404 | ||||
-rw-r--r-- | ucl/include/ucl/misc/Variant.hpp (renamed from ucl/inc/ucl/misc/Variant.hpp) | 4 | ||||
-rw-r--r-- | ucl/include/ucl/misc/types.h | 30 | ||||
-rw-r--r-- | ucl/include/ucl/mvp/GuiPresenter.h | 317 | ||||
-rw-r--r-- | ucl/include/ucl/mvp/IPickable.h | 45 | ||||
-rw-r--r-- | ucl/include/ucl/mvp/IPicker.h | 68 | ||||
-rw-r--r-- | ucl/include/ucl/mvp/IPickerHost.h | 64 | ||||
-rw-r--r-- | ucl/include/ucl/mvp/ListItemPresenter.h | 401 | ||||
-rw-r--r-- | ucl/include/ucl/mvp/ListPresenter.h (renamed from ucl/inc/ucl/mvp/ListPresenter.h) | 110 | ||||
-rw-r--r-- | ucl/include/ucl/mvp/types.h (renamed from ucl/inc/ucl/mvp/types.h) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation.h (renamed from ucl/inc/ucl/util/delegation.h) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/BaseDelegate.h (renamed from ucl/inc/ucl/util/delegation/BaseDelegate.h) | 68 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/BaseDelegate.hpp (renamed from ucl/inc/ucl/util/delegation/BaseDelegate.hpp) | 4 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/BaseDelegate2.h (renamed from ucl/inc/ucl/util/delegation/BaseDelegate2.h) | 35 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/BaseDelegate2.hpp (renamed from ucl/inc/ucl/util/delegation/BaseDelegate2.hpp) | 4 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/Callback.h | 179 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/Callback.hpp (renamed from ucl/inc/ucl/util/delegation/Callback.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/Delegate.h | 117 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/Delegate.hpp (renamed from ucl/inc/ucl/util/delegation/Delegate.hpp) | 22 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/Delegate2.h | 117 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/Delegate2.hpp (renamed from ucl/inc/ucl/util/delegation/Delegate2.hpp) | 22 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/helpers.h (renamed from ucl/inc/ucl/util/delegation/helpers.h) | 75 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/internal.h | 98 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/macro.h | 120 | ||||
-rw-r--r-- | ucl/include/ucl/util/delegation/shortMacro.h (renamed from ucl/inc/ucl/util/delegation/shortMacro.h) | 12 | ||||
-rw-r--r-- | ucl/include/ucl/util/helpers.h | 283 | ||||
-rw-r--r-- | ucl/include/ucl/util/helpers.hpp (renamed from ucl/inc/ucl/util/helpers.hpp) | 8 | ||||
-rw-r--r-- | ucl/include/ucl/util/logging.h (renamed from ucl/inc/ucl/util/logging.h) | 5 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory.h (renamed from ucl/inc/ucl/util/memory.h) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/BaseRef.h (renamed from ucl/inc/ucl/util/memory/BaseRef.h) | 49 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/BaseRef.hpp (renamed from ucl/inc/ucl/util/memory/BaseRef.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/IRefCountObj.h (renamed from ucl/inc/ucl/util/memory/IRefCountObj.h) | 42 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/RefCountObj.h (renamed from ucl/inc/ucl/util/memory/RefCountObj.h) | 13 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/RefCountObj.hpp (renamed from ucl/inc/ucl/util/memory/RefCountObj.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/RefCounterMT.h (renamed from ucl/inc/ucl/util/memory/RefCounterMT.h) | 25 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/RefCounterMT.hpp (renamed from ucl/inc/ucl/util/memory/RefCounterMT.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/RefCounterST.h (renamed from ucl/inc/ucl/util/memory/RefCounterST.h) | 25 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/RefCounterST.hpp (renamed from ucl/inc/ucl/util/memory/RefCounterST.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/ReffedObj.h (renamed from ucl/inc/ucl/util/memory/ReffedObj.h) | 32 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/ReffedObj.hpp (renamed from ucl/inc/ucl/util/memory/ReffedObj.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/SharedRef.h | 205 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/SharedRef.hpp (renamed from ucl/inc/ucl/util/memory/SharedRef.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/WeakRef.h | 182 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/WeakRef.hpp (renamed from ucl/inc/ucl/util/memory/WeakRef.hpp) | 2 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/helpers.h | 243 | ||||
-rw-r--r-- | ucl/include/ucl/util/memory/macro.h (renamed from ucl/inc/ucl/util/memory/macro.h) | 11 | ||||
-rw-r--r-- | ucl/include/ucl/util/shortLogs.h (renamed from ucl/inc/ucl/util/shortLogs.h) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/smartDelegation.h (renamed from ucl/inc/ucl/util/smartDelegation.h) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/smartDelegation/WeakDelegate.h | 100 | ||||
-rw-r--r-- | ucl/include/ucl/util/smartDelegation/WeakDelegate.hpp (renamed from ucl/inc/ucl/util/smartDelegation/WeakDelegate.hpp) | 45 | ||||
-rw-r--r-- | ucl/include/ucl/util/smartDelegation/macro.h (renamed from ucl/inc/ucl/util/smartDelegation/macro.h) | 18 | ||||
-rw-r--r-- | ucl/include/ucl/util/smartDelegation/shortMacro.h (renamed from ucl/inc/ucl/util/smartDelegation/shortMacro.h) | 2 | ||||
-rw-r--r-- | ucl/include/ucl/util/threading.h (renamed from ucl/inc/ucl/util/threading.h) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/threading/CondVar.h (renamed from ucl/inc/ucl/util/threading/CondVar.h) | 31 | ||||
-rw-r--r-- | ucl/include/ucl/util/threading/CondVar.hpp (renamed from ucl/inc/ucl/util/threading/CondVar.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/threading/Mutex.h (renamed from ucl/inc/ucl/util/threading/Mutex.h) | 27 | ||||
-rw-r--r-- | ucl/include/ucl/util/threading/Mutex.hpp (renamed from ucl/inc/ucl/util/threading/Mutex.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/threading/MutexLock.h (renamed from ucl/inc/ucl/util/threading/MutexLock.h) | 21 | ||||
-rw-r--r-- | ucl/include/ucl/util/threading/MutexLock.hpp (renamed from ucl/inc/ucl/util/threading/MutexLock.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/threading/Thread.h (renamed from ucl/inc/ucl/util/threading/Thread.h) | 46 | ||||
-rw-r--r-- | ucl/include/ucl/util/threading/Thread.hpp (renamed from ucl/inc/ucl/util/threading/Thread.hpp) | 4 | ||||
-rw-r--r-- | ucl/include/ucl/util/types.h (renamed from ucl/inc/ucl/util/types.h) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/types/Result.h (renamed from ucl/inc/ucl/util/types/Result.h) | 67 | ||||
-rw-r--r-- | ucl/include/ucl/util/types/Result.hpp (renamed from ucl/inc/ucl/util/types/Result.hpp) | 0 | ||||
-rw-r--r-- | ucl/include/ucl/util/types/baseTypes.h (renamed from ucl/inc/ucl/util/types/baseTypes.h) | 4 | ||||
-rw-r--r-- | ucl/include/ucl/util/types/classTypes.h | 150 | ||||
-rw-r--r-- | ucl/source/appfw/InstanceManagerBase.cpp (renamed from ucl/src/appfw/InstanceManagerBase.cpp) | 0 | ||||
-rw-r--r-- | ucl/source/appfw/SysEventProvider.cpp (renamed from ucl/src/appfw/SysEventProvider.cpp) | 2 | ||||
-rw-r--r-- | ucl/source/appfw/UIApp.cpp (renamed from ucl/src/appfw/UIApp.cpp) | 17 | ||||
-rw-r--r-- | ucl/source/appfw/common.h | 22 | ||||
-rw-r--r-- | ucl/source/appfw/helpers.cpp (renamed from ucl/src/appfw/helpers.cpp) | 0 | ||||
-rw-r--r-- | ucl/source/common.h (renamed from ucl/src/common.h) | 6 | ||||
-rw-r--r-- | ucl/source/gui/EdjeWidget.cpp (renamed from ucl/src/gui/EdjeWidget.cpp) | 0 | ||||
-rw-r--r-- | ucl/source/gui/ElmWidget.cpp (renamed from ucl/inc/ucl/appfw/IInstanceContext.h) | 30 | ||||
-rw-r--r-- | ucl/source/gui/Genlist.cpp (renamed from ucl/src/gui/Genlist.cpp) | 3 | ||||
-rw-r--r-- | ucl/source/gui/Layout.cpp (renamed from ucl/src/gui/Layout.cpp) | 2 | ||||
-rw-r--r-- | ucl/source/gui/NaviItem.cpp (renamed from ucl/src/gui/NaviItem.cpp) | 0 | ||||
-rw-r--r-- | ucl/source/gui/Naviframe.cpp (renamed from ucl/src/gui/Naviframe.cpp) | 12 | ||||
-rw-r--r-- | ucl/source/gui/RadioBox.cpp | 46 | ||||
-rw-r--r-- | ucl/source/gui/Widget.cpp (renamed from ucl/src/gui/Widget.cpp) | 40 | ||||
-rw-r--r-- | ucl/source/gui/WidgetItem.cpp (renamed from ucl/src/gui/WidgetItem.cpp) | 0 | ||||
-rw-r--r-- | ucl/source/gui/Window.cpp (renamed from ucl/src/gui/Window.cpp) | 24 | ||||
-rw-r--r-- | ucl/source/gui/common.h (renamed from ucl/src/gui/common.h) | 8 | ||||
-rw-r--r-- | ucl/source/misc/Timeout.cpp (renamed from ucl/src/misc/Timeout.cpp) | 15 | ||||
-rw-r--r-- | ucl/source/misc/Variant.cpp (renamed from ucl/src/misc/Variant.cpp) | 2 | ||||
-rw-r--r-- | ucl/source/misc/common.h (renamed from ucl/src/appfw/common.h) | 8 | ||||
-rw-r--r-- | ucl/source/mvp/GuiPresenter.cpp (renamed from ucl/src/mvp/GuiPresenter.cpp) | 68 | ||||
-rw-r--r-- | ucl/source/mvp/ListItemPresenter.cpp | 520 | ||||
-rw-r--r-- | ucl/source/mvp/ListPresenter.cpp (renamed from ucl/src/mvp/ListPresenter.cpp) | 57 | ||||
-rw-r--r-- | ucl/source/mvp/common.h (renamed from ucl/src/misc/common.h) | 8 | ||||
-rw-r--r-- | ucl/source/util/logging.cpp (renamed from ucl/src/util/logging.cpp) | 0 | ||||
-rw-r--r-- | ucl/source/util/types/Result.cpp (renamed from ucl/src/util/types/Result.cpp) | 2 | ||||
-rw-r--r-- | ucl/source/util/types/classTypes.cpp (renamed from ucl/src/mvp/common.h) | 8 | ||||
-rw-r--r-- | ucl/src/gui/ElmWidget.cpp | 75 | ||||
-rw-r--r-- | ucl/src/mvp/ListItemPresenter.cpp | 292 |
449 files changed, 28776 insertions, 11093 deletions
@@ -24,18 +24,17 @@ <toolChain id="org.tizen.nativecore.toolchain.sbi.gcc45.app.debug.1048479076" name="Tizen Native Toolchain" superClass="org.tizen.nativecore.toolchain.sbi.gcc45.app.debug"> <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.299151930" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/> <builder autoBuildTarget="all" buildPath="${workspace_loc:/call-ui}/Debug" enableAutoBuild="true" id="org.tizen.nativecore.target.sbi.gnu.builder.287909858" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/> - <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.850939844" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/> + <tool command="i386-linux-gnueabi-ar" id="org.tizen.nativecore.tool.sbi.gnu.archiver.850939844" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/> <tool command="i386-linux-gnueabi-g++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.66050065" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler"> <option id="gnu.cpp.compiler.option.optimization.level.1977572256" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.1003532466" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/> <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.58197076" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/> <option id="sbi.gnu.cpp.compiler.option.1780411914" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs"> - <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_gcc49.i386.core.app"/> + <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_gcc49.i386"/> </option> <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""/> @@ -133,8 +134,8 @@ <listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/> </option> <option id="gnu.cpp.compiler.option.include.paths.79290911" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/ucl/inc}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/ucl/include}""/> </option> <option id="sbi.gnu.cpp.compiler.option.frameworks.core.1469916614" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs"> <listOptionValue builtIn="false" value="Native_API"/> @@ -152,12 +153,11 @@ <option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.1157370620" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/> <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.1654013693" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/> <option id="sbi.gnu.c.compiler.option.551225658" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs"> - <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_gcc49.i386.core.app"/> + <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_gcc49.i386"/> </option> <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""/> @@ -230,7 +230,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""/> @@ -255,7 +257,6 @@ <listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/> </option> <option id="gnu.c.compiler.option.include.paths.368004466" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/> <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/EGL""/> @@ -343,7 +344,18 @@ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/yaca""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/dbus-1.0/include""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/glib-2.0/include""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/ucl/inc}""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/asp/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/aul/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/call-manager""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/msg-service""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/pkgmgr""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/rua/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony-client""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ug-1""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vconf""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/ucl/include}""/> </option> <option id="sbi.gnu.c.compiler.option.frameworks.core.1478193049" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs"> <listOptionValue builtIn="false" value="Native_API"/> @@ -390,15 +402,19 @@ <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" name="Sound Path (-sd)" 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" name="Font Path (-fd)" superClass="sbi.gnu.edc.compiler.option.misc.fd" valueType="stringList"> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/fonts""/> + </option> </tool> </toolChain> </folderInfo> <sourceEntries> - <entry excluding="view/SlidingLabel.h" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="call-ui"/> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/> - <entry excluding="view/SlidingLabel.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> - <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="ucl/inc"/> - <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="ucl/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/source"/> </sourceEntries> </configuration> </storageModule> @@ -424,29 +440,25 @@ <toolChain id="org.tizen.nativecore.toolchain.sbi.gcc45.app.release.1202011079" name="Tizen Native Toolchain" superClass="org.tizen.nativecore.toolchain.sbi.gcc45.app.release"> <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.1547247838" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/> <builder buildPath="${workspace_loc:/call-ui}/Release" id="org.tizen.nativecore.target.sbi.gnu.builder.1410224621" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/> - <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.519529023" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/> + <tool command="i386-linux-gnueabi-ar" id="org.tizen.nativecore.tool.sbi.gnu.archiver.519529023" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/> <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.2053654917" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler"> <option id="gnu.cpp.compiler.option.optimization.level.1574455899" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/> <option defaultValue="gnu.cpp.compiler.debugging.level.none" id="sbi.gnu.cpp.compiler.option.debugging.level.core.1268930725" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/> <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.1954110782" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/> <option id="sbi.gnu.cpp.compiler.option.1348701994" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs"> - <listOptionValue builtIn="false" value="wearable-4.0-device.core.private_llvm37.armel.core.app"/> + <listOptionValue builtIn="false" value="wearable-4.0-emulator.core_llvm40.i386"/> </option> <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/""/> <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""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/asp/""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/aul/""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/badge""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/base""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/cairo""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/calendar-service2""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/call-manager""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/chromium-ewk""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ckm""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/contacts-svc""/> @@ -502,22 +514,18 @@ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/messaging""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/metadata-editor""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/minizip""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/msg-service""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/network""/> <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/pkgmgr""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/rua/""/> + <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""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony-client""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/tzsh""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ug-1""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ui""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vconf""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vulkan""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/widget_service""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/widget_viewer_dali""/> @@ -531,11 +539,10 @@ <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/> <listOptionValue builtIn="false" value=" -fPIE"/> <listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/> - <listOptionValue builtIn="false" value="-mthumb"/> </option> <option id="gnu.cpp.compiler.option.include.paths.382544999" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/ucl/inc}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/ucl/include}""/> </option> <option id="sbi.gnu.cpp.compiler.option.frameworks.core.863139267" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs"> <listOptionValue builtIn="false" value="Native_API"/> @@ -547,23 +554,19 @@ <option defaultValue="gnu.c.debugging.level.default" id="sbi.gnu.c.compiler.option.debugging.level.core.1220862817" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/> <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.1659164857" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/> <option id="sbi.gnu.c.compiler.option.207590264" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs"> - <listOptionValue builtIn="false" value="wearable-4.0-device.core.private_llvm37.armel.core.app"/> + <listOptionValue builtIn="false" value="wearable-4.0-emulator.core_llvm40.i386"/> </option> <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/""/> <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""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/asp/""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/aul/""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/badge""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/base""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/cairo""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/calendar-service2""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/call-manager""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/chromium-ewk""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ckm""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/contacts-svc""/> @@ -619,22 +622,18 @@ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/messaging""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/metadata-editor""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/minizip""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/msg-service""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/network""/> <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/pkgmgr""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/rua/""/> + <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""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony-client""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/tzsh""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ug-1""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ui""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vconf""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vulkan""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/widget_service""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/widget_viewer_dali""/> @@ -648,10 +647,8 @@ <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/> <listOptionValue builtIn="false" value=" -fPIE"/> <listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/> - <listOptionValue builtIn="false" value="-mthumb"/> </option> <option id="gnu.c.compiler.option.include.paths.1553190282" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/> <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/EGL""/> @@ -739,7 +736,18 @@ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/yaca""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/dbus-1.0/include""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/glib-2.0/include""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/ucl/inc}""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/asp/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/aul/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/call-manager""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/msg-service""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/pkgmgr""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/rua/""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony-client""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ug-1""/> + <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vconf""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/ucl/include}""/> </option> <option id="sbi.gnu.c.compiler.option.frameworks.core.1251626395" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs"> <listOptionValue builtIn="false" value="Native_API"/> @@ -767,7 +775,7 @@ <additionalInput kind="additionalinput" paths="$(LIBS)"/> </inputType> </tool> - <tool command="arm-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.1040646105" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base"> + <tool command="#{PLATFORM_DEFAULT_GCC_PREFIX}as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.1040646105" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base"> <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1529641874" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> </tool> <tool id="org.tizen.nativecore.tool.fnmapgen.1478404041" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/> @@ -776,15 +784,23 @@ <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" 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.1539334293" name="Sound Path (-sd)" 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" name="Font Path (-fd)" superClass="sbi.gnu.edc.compiler.option.misc.fd" valueType="stringList"> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/fonts""/> + </option> + </tool> </toolChain> </folderInfo> <sourceEntries> - <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="call-ui"/> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/> - <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> - <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/inc"/> - <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="ucl/source"/> </sourceEntries> </configuration> </storageModule> diff --git a/Build/makefile b/Build/makefile index f491b50..117b240 100644 --- a/Build/makefile +++ b/Build/makefile @@ -14,7 +14,7 @@ clean : app_clean version : build_version #PROJ_ROOT = . -BUILD_ROOT := $(PROJ_PATH)/Build# +#BUILD_ROOT := $(PROJ_PATH)/Build# ifeq ($(MAKE_NAME),mingw32-make) ifneq ($(SHELL),) diff --git a/Build/makefile.mk b/Build/makefile.mk index 205a3ad..53c0428 100644 --- a/Build/makefile.mk +++ b/Build/makefile.mk @@ -13,10 +13,18 @@ clean : app_clean version : build_version +_BLANK :=# +_SPACE := $(_BLANK) $(_BLANK)# +_SPACE_4MAKE := \$(_SPACE)# + +NULL_CHAR :=# +SPACE := $(NULL_CHAR) $(NULL_CHAR)# -#PROJ_ROOT := $(call BSLASH2SLASH,$(PROJ_PATH)) PROJ_ROOT := . -BUILD_ROOT := $(PROJ_ROOT)/Build +_PROJ_ROOT_4MAKE := $(subst $(_SPACE),$(_SPACE_4MAKE),$(PROJ_ROOT))# +PROJ_ROOT=$(_PROJ_ROOT_4MAKE) +_BUILD_ROOT_4MAKE := $(subst $(_SPACE),$(_SPACE_4MAKE),$(BUILD_ROOT))# +BUILD_ROOT=$(_BUILD_ROOT_4MAKE) include $(BUILD_ROOT)/basedef.mk @@ -109,7 +117,7 @@ $(APPFILE) : $(OBJS) $(UOBJS) @echo ' Building target: $@' @echo ' Invoking: C/C++ Linker' $(call MAKEDIRS,$(@D)) - $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath="/opt/usr/apps/$(APPID)/lib" -Werror-implicit-function-declaration $(USER_LINK_OPTS) + $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath='$$ORIGIN/../lib' -Werror-implicit-function-declaration $(USER_LINK_OPTS) @echo ' Finished building target: $@' endif ifeq ($(strip $(APPTYPE)),staticLib) @@ -137,19 +145,19 @@ $(OUTPUT_DIR) : $(call MAKEDIRS,$@) -ifneq ($(strip $(PLATFORM_INCS)),) -$(PLATFORM_INCS_FILE) : $(OBJ_OUTPUT) - @echo ' Building inc file: $@' -ifneq ($(findstring Windows,$(OS)),) -ifneq ($(findstring 3.82,$(MAKE_VERSION)),) - $(file > $@,$(PLATFORM_INCS)) -else - @echo $(PLATFORM_INCS) > $@ -endif -else - @echo $(PLATFORM_INCS) > $@ -endif -endif +#ifneq ($(strip $(PLATFORM_INCS)),) +#$(PLATFORM_INCS_FILE) : $(OBJ_OUTPUT) +# @echo ' Building inc file: $@' +#ifneq ($(findstring Windows,$(OS)),) +#ifneq ($(findstring 3.82,$(MAKE_VERSION)),) +# $(file > $@,$(PLATFORM_INCS)) +#else +# @echo $(PLATFORM_INCS) > $@ +#endif +#else +# @echo '$(PLATFORM_INCS)' > $@ +#endif +#endif include $(BUILD_ROOT)/build_edc.mk diff --git a/Build/platform.mk b/Build/platform.mk index 294a38a..3895d90 100644 --- a/Build/platform.mk +++ b/Build/platform.mk @@ -2,14 +2,17 @@ SYSROOT = $(SBI_SYSROOT) -USR_INCS := $(addprefix -I $(SYSROOT),$(PLATFORM_INCS_EX)) +#USR_INCS := $(addprefix -I "$(SYSROOT),$(PLATFORM_INCS_EX)) +USR_INCS1 := $(addsuffix ",$(PLATFORM_INCS_EX)) +USR_INCS := $(addprefix -I "$(SYSROOT),$(USR_INCS1)) ifeq ($(strip $(PLATFORM_LIB_PATHS)),) RS_LIB_PATHS := "$(SYSROOT)/usr/lib" else -RS_LIB_PATHS := $(addprefix -L$(SYSROOT),$(PLATFORM_LIB_PATHS)) +RS_LIB_PATHS1 := $(addsuffix ",$(PLATFORM_LIB_PATHS)) +RS_LIB_PATHS := $(addprefix -L "$(SYSROOT),$(RS_LIB_PATHS1)) endif RS_LIBRARIES := $(addprefix -l,$(RS_LIBRARIES_EX)) -PLATFORM_INCS = $(USR_INCS) -I"$(SDK_PATH)/library" +PLATFORM_INCS = $(USR_INCS) -I "$(SDK_PATH)/library" diff --git a/LICENSE.Flora b/LICENSE.Flora new file mode 100644 index 0000000..571fe79 --- /dev/null +++ b/LICENSE.Flora @@ -0,0 +1,206 @@ +Flora License + +Version 1.1, April, 2013 + +http://floralicense.org/license/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and +all other entities that control, are controlled by, or are +under common control with that entity. For the purposes of +this definition, "control" means (i) the power, direct or indirect, +to cause the direction or management of such entity, +whether by contract or otherwise, or (ii) ownership of fifty percent (50%) +or more of the outstanding shares, or (iii) beneficial ownership of +such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation source, +and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, +made available under the License, as indicated by a copyright notice +that is included in or attached to the work (an example is provided +in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, +that is based on (or derived from) the Work and for which the editorial +revisions, annotations, elaborations, or other modifications represent, +as a whole, an original work of authorship. For the purposes of this License, +Derivative Works shall not include works that remain separable from, +or merely link (or bind by name) to the interfaces of, the Work and +Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original +version of the Work and any modifications or additions to that Work or +Derivative Works thereof, that is intentionally submitted to Licensor +for inclusion in the Work by the copyright owner or by an individual or +Legal Entity authorized to submit on behalf of the copyright owner. +For the purposes of this definition, "submitted" means any form of +electronic, verbal, or written communication sent to the Licensor or +its representatives, including but not limited to communication on +electronic mailing lists, source code control systems, and issue +tracking systems that are managed by, or on behalf of, the Licensor +for the purpose of discussing and improving the Work, but excluding +communication that is conspicuously marked or otherwise designated +in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +"Tizen Certified Platform" shall mean a software platform that complies +with the standards set forth in the Tizen Compliance Specification +and passes the Tizen Compliance Tests as defined from time to time +by the Tizen Technical Steering Group and certified by the Tizen +Association or its designated agent. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work +solely as incorporated into a Tizen Certified Platform, where such +license applies only to those patent claims licensable by such +Contributor that are necessarily infringed by their Contribution(s) +alone or by combination of their Contribution(s) with the Work solely +as incorporated into a Tizen Certified Platform to which such +Contribution(s) was submitted. If You institute patent litigation +against any entity (including a cross-claim or counterclaim +in a lawsuit) alleging that the Work or a Contribution incorporated +within the Work constitutes direct or contributory patent infringement, +then any patent licenses granted to You under this License for that +Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof pursuant to the copyright license +above, in any medium, with or without modifications, and in Source or +Object form, provided that You meet the following conditions: + + 1. You must give any other recipients of the Work or Derivative Works + a copy of this License; and + 2. You must cause any modified files to carry prominent notices stating + that You changed the files; and + 3. You must retain, in the Source form of any Derivative Works that + You distribute, all copyright, patent, trademark, and attribution + notices from the Source form of the Work, excluding those notices + that do not pertain to any part of the Derivative Works; and + 4. If the Work includes a "NOTICE" text file as part of its distribution, + then any Derivative Works that You distribute must include a readable + copy of the attribution notices contained within such NOTICE file, + excluding those notices that do not pertain to any part of + the Derivative Works, in at least one of the following places: + within a NOTICE text file distributed as part of the Derivative Works; + within the Source form or documentation, if provided along with the + Derivative Works; or, within a display generated by the Derivative Works, + if and wherever such third-party notices normally appear. + The contents of the NOTICE file are for informational purposes only + and do not modify the License. You may add Your own attribution notices + within Derivative Works that You distribute, alongside or as an addendum + to the NOTICE text from the Work, provided that such additional attribution + notices cannot be construed as modifying the License. You may add Your own + copyright statement to Your modifications and may provide additional or + different license terms and conditions for use, reproduction, or + distribution of Your modifications, or for any such Derivative Works + as a whole, provided Your use, reproduction, and distribution of + the Work otherwise complies with the conditions stated in this License + and your own copyright statement or terms and conditions do not conflict + the conditions stated in the License including section 3. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Flora License to your work + +To apply the Flora License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + diff --git a/src/common.h b/call-ui/common.h index 1d8b345..f3bf02a 100644 --- a/src/common.h +++ b/call-ui/common.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __CALLUI_COMMON_H__ -#define __CALLUI_COMMON_H__ +#ifndef __CALL_UI_COMMON_H__ +#define __CALL_UI_COMMON_H__ #include <algorithm> @@ -38,7 +38,12 @@ namespace callui { using namespace ucl; constexpr SmartEvent WIN_POWER_KEY_UP_EVENT {"callui,powerkey,up"}; + constexpr SmartEvent WIN_LANGUAGE_CHANGED {"callui,language,changed"}; + namespace util { + + using ucl::util::dispose; + } } -#endif // __CALLUI_COMMON_H__ +#endif // __CALL_UI_COMMON_H__ diff --git a/inc/config.h b/call-ui/config.h index 5d9d113..c5e4dcd 100644 --- a/inc/config.h +++ b/call-ui/config.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __CALLUI_CONFIG_H__ -#define __CALLUI_CONFIG_H__ +#ifndef __CALL_UI_CONFIG_H__ +#define __CALL_UI_CONFIG_H__ #define CALLUI_LOG_TAG "CALLUI" @@ -24,6 +24,8 @@ namespace callui { constexpr auto WINDOW_NAME = "org.tizen.call-ui"; constexpr auto BASE_SCALE = 1.3; + + constexpr auto TEXT_DOMAIN = "w-call-ui"; } #endif // __CALL_UI_CONFIG_H__ diff --git a/src/helpers.h b/call-ui/helpers.h index 4bb49d6..5689ff4 100644 --- a/src/helpers.h +++ b/call-ui/helpers.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __CALLUI_HELPERS_H__ -#define __CALLUI_HELPERS_H__ +#ifndef __CALL_UI_HELPERS_H__ +#define __CALL_UI_HELPERS_H__ #include "types.h" @@ -29,8 +29,15 @@ namespace callui { namespace util { template <class FUNC, class ...ARGS> ucl::Result call(FUNC &&func, ARGS &&...args); + + // String helpers // + + bool beginsWith(const std::string &str, const std::string &prefix, + bool caseSensitive = true); + bool removePrefix(std::string &str, const std::string &prefix, + bool caseSensitive = true); }} #include "helpers.hpp" -#endif // __CALLUI_HELPERS_H__ +#endif // __CALL_UI_HELPERS_H__ diff --git a/src/helpers.hpp b/call-ui/helpers.hpp index d44e8e0..356ff12 100644 --- a/src/helpers.hpp +++ b/call-ui/helpers.hpp @@ -84,4 +84,25 @@ namespace callui { namespace util { } return ucl::RES_OK; } + + // String helpers // + + inline bool beginsWith(const std::string &str, const std::string &prefix, + bool caseSensitive) + { + if (caseSensitive) { + return (str.compare(0, prefix.size(), prefix) == 0); + } + return (strncasecmp(str.c_str(), prefix.c_str(), prefix.size()) == 0); + } + + inline bool removePrefix(std::string &str, const std::string &prefix, + bool caseSensitive) + { + if (beginsWith(str, prefix, caseSensitive)) { + str = str.substr(prefix.size()); + return true; + } + return false; + } }} diff --git a/src/main.cpp b/call-ui/main.cpp index 31ba842..31ba842 100644 --- a/src/main.cpp +++ b/call-ui/main.cpp diff --git a/src/model/CallUIBuilder.cpp b/call-ui/model/CallUIBuilder.cpp index 5a9d5ba..0168cbb 100644 --- a/src/model/CallUIBuilder.cpp +++ b/call-ui/model/CallUIBuilder.cpp @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "model/CallUIBuilder.h" +#include "CallUIBuilder.h" -#include "CallUI.h" +#include "impl/CallUI.h" -#include "common.h" +#include "call-ui/common.h" namespace callui { diff --git a/inc/model/CallUIBuilder.h b/call-ui/model/CallUIBuilder.h index ddcb11e..8ecfed3 100644 --- a/inc/model/CallUIBuilder.h +++ b/call-ui/model/CallUIBuilder.h @@ -14,19 +14,35 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_CALL_UI_BUILDER_H__ -#define __CALLUI_MODEL_CALL_UI_BUILDER_H__ +#ifndef __CALL_UI_MODEL_CALL_UI_BUILDER_H__ +#define __CALL_UI_MODEL_CALL_UI_BUILDER_H__ + +#include "ICallUI.h" #include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(CallUIBuilder); + + /** + * @brief Represents builder for CallUI + */ class CallUIBuilder { public: + + /** + * @brief Constructor + */ CallUIBuilder(); + + /** + * @brief Builds CallUI instance + * @return Shared reference to ICallUI + */ ICallUISRef build() const; }; } -#endif // __CALLUI_MODEL_CALL_UI_BUILDER_H__ +#endif // __CALL_UI_MODEL_CALL_UI_BUILDER_H__ diff --git a/call-ui/model/IActiveCall.h b/call-ui/model/IActiveCall.h new file mode 100644 index 0000000..301830b --- /dev/null +++ b/call-ui/model/IActiveCall.h @@ -0,0 +1,74 @@ +/* + * 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_MODEL_I_ACTIVE_CALL_H__ +#define __CALL_UI_MODEL_I_ACTIVE_CALL_H__ + +#include "ICallInfo.h" +#include "IConferenceCallInfo.h" + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(IActiveCall); + + /** + * @brief Represents Active call interface for operations with active call + */ + class IActiveCall : protected ucl::NonCopyable { + public: + + /** + * @brief Gets call info instance + * @return Constant shared reference to ICallInfo + */ + virtual ICallInfoSCRef getInfo() const = 0; + + + /** + * @brief Gets dialing mode state + * @return true if dialing mode is ON, false otherwise + */ + virtual bool isDialingMode() const = 0; + + /** + * @brief Sets active call into hold state + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result hold() = 0; + + /** + * @brief Sets active call into hold state + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result end() = 0; + + /** + * @brief Splits one call if call is conference + * @param[in] confCallInfo Call info of call that will be split + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result split( + const IConferenceCallInfoSCRef &confCallInfo) = 0; + + protected: + ~IActiveCall() = default; + }; + +} + +#endif // __CALL_UI_MODEL_I_ACTIVE_CALL_H__ diff --git a/inc/model/IBaseCallInfo.h b/call-ui/model/IBaseCallInfo.h index 3d1dd6a..57b0f91 100644 --- a/inc/model/IBaseCallInfo.h +++ b/call-ui/model/IBaseCallInfo.h @@ -14,20 +14,44 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_I_BASE_CALL_INFO_H__ -#define __CALLUI_MODEL_I_BASE_CALL_INFO_H__ +#ifndef __CALL_UI_MODEL_I_BASE_CALL_INFO_H__ +#define __CALL_UI_MODEL_I_BASE_CALL_INFO_H__ + +#include "IContactInfo.h" #include "types.h" namespace callui { - class IBaseCallInfo : public ucl::Polymorphic { + /** + * @brief Represents base Call info interface + * for base Call info operations + */ + class IBaseCallInfo : protected ucl::NonCopyable { public: + + /** + * @brief Gets call Id + * @return Call id + */ virtual unsigned int getCallId() const = 0; + + /** + * @brief Gets call phone number + * @return Call phone number + */ virtual const std::string &getPhoneNumber() const = 0; + + /** + * @brief Gets call contact info + * @return Constant shared reference to IContactInfo + */ virtual IContactInfoSCRef getContactInfo() const = 0; + + protected: + ~IBaseCallInfo() = default; }; } -#endif // __CALLUI_MODEL_I_BASE_CALL_INFO_H__ +#endif // __CALL_UI_MODEL_I_BASE_CALL_INFO_H__ diff --git a/call-ui/model/ICallInfo.h b/call-ui/model/ICallInfo.h new file mode 100644 index 0000000..b5e2a35 --- /dev/null +++ b/call-ui/model/ICallInfo.h @@ -0,0 +1,95 @@ +/* + * 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_MODEL_I_CALL_INFO_H__ +#define __CALL_UI_MODEL_I_CALL_INFO_H__ + +#include "IBaseCallInfo.h" + +#include <time.h> + +#include "IConferenceCallInfo.h" + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(ICallInfo); + + using ConfMemberList = std::vector<IConferenceCallInfoSCRef>; + + /** + * @brief Represents Call info interface to get information about call + */ + class ICallInfo : public IBaseCallInfo { + public: + + /** + * @brief Gets call duration + * @return Call duration + */ + virtual struct tm getDuration() const = 0; + + /** + * @brief Gets whether call is emergency + * @return true if call is emergency or false otherwise + */ + virtual bool isEmergency() const = 0; + + /** + * @brief Gets whether call has HD voice + * @return true if call has HD voice or false otherwise + */ + virtual bool isHDVoice() const = 0; + + /** + * @brief Gets whether call is forwarded + * @return true if call is forwarded or false otherwise + */ + virtual bool isForwarded() const = 0; + + /** + * @brief Gets whether call number is voicemail + * @return true if call number is voicemail or false otherwise + */ + virtual bool isVoiceMailNumber() const = 0; + + /** + * @brief Gets call conference members count + * @return Conference members count + */ + virtual int getConferenceMemberCount() const = 0; + + /** + * @brief Gets call conference members list + * @return Conference members list + */ + virtual const ConfMemberList &getConferenceMemberList() const = 0; + + protected: + ~ICallInfo() = default; + }; + + // Non-member functions // + + /** + * @brief Gets whether caller telephone number is unknown + * @return true if call number is unknown or false otherwise + */ + bool isUnknownCaller(const ICallInfo &info); +} + +#endif // __CALL_UI_MODEL_I_CALL_INFO_H__ diff --git a/inc/model/ICallListener.h b/call-ui/model/ICallListener.h index 0c72b73..b67de1b 100644 --- a/inc/model/ICallListener.h +++ b/call-ui/model/ICallListener.h @@ -14,19 +14,38 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_I_CALL_LISTENER_H__ -#define __CALLUI_MODEL_I_CALL_LISTENER_H__ +#ifndef __CALL_UI_MODEL_I_CALL_LISTENER_H__ +#define __CALL_UI_MODEL_I_CALL_LISTENER_H__ #include "types.h" namespace callui { - class ICallListener : public ucl::Polymorphic { + UCL_DECLARE_REF_ALIASES(ICallListener); + + /** + * @brief Represents Call listener interface for getting + * notification from ICall model + */ + class ICallListener : protected ucl::NonCopyable { public: + + /** + * @brief Called when new Call event is initiated + * @param[in] type Call event type + */ virtual void onCallEvent(CallEventType type) = 0; + + /** + * @brief Called when some error is happened + * @param[in] err Call error type + */ virtual void onError(CallErr err) = 0; + + protected: + ~ICallListener() = default; }; } -#endif // __CALLUI_MODEL_I_CALL_LISTENER_H__ +#endif // __CALL_UI_MODEL_I_CALL_LISTENER_H__ diff --git a/call-ui/model/ICallManager.h b/call-ui/model/ICallManager.h new file mode 100644 index 0000000..6b5dded --- /dev/null +++ b/call-ui/model/ICallManager.h @@ -0,0 +1,90 @@ +/* + * 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_MODEL_I_STATE_PROVIDER_H__ +#define __CALL_UI_MODEL_I_STATE_PROVIDER_H__ + +#include "types.h" + +#include "IIncomingCall.h" +#include "IActiveCall.h" +#include "IHeldCall.h" +#include "IEndCall.h" + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(ICallManager); + + /** + * @brief Represents Call Manager interface for operations with calls + * and their states + */ + class ICallManager : protected ucl::NonCopyable { + public: + + /** + * @brief Gets incoming call instance + * @return Shared reference to IIncomingCall instance on success + * or NULL otherwise + */ + virtual IIncomingCallSRef getIncomingCall() = 0; + + /** + * @brief Gets active call instance + * @return Shared reference to IActiveCall instance on success + * or NULL otherwise + */ + virtual IActiveCallSRef getActiveCall() = 0; + + /** + * @brief Gets held call instance + * @return Shared reference to IHeldCall instance on success + * or NULL otherwise + */ + virtual IHeldCallSRef getHeldCall() = 0; + + /** + * @brief Gets end call instance + * @return Shared reference to IEndCall instance on success + * or NULL otherwise + */ + virtual IEndCallSRef getEndCall() = 0; + + protected: + ~ICallManager() = default; + }; + + // Non-member functions // + + /** + * @brief Gets call mode by current state of Call Manager + * @param[in] cm Call manager instance + * @return Current Call mode + */ + CallMode getCallMode(const ICallManagerSRef &cm); + + /** + * @brief Gets mask of available calls by current state of Call Manager + * @param[in] cm Call manager instance + * @return Mask on current available calls + */ + CallMask getAvailableCalls(const ICallManagerSRef &cm); + +} + +#endif // __CALL_UI_MODEL_I_STATE_PROVIDER_H__ diff --git a/inc/model/ICallUI.h b/call-ui/model/ICallUI.h index 06deda1..4b95cc1 100644 --- a/inc/model/ICallUI.h +++ b/call-ui/model/ICallUI.h @@ -14,23 +14,62 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_I_CALL_UI_H__ -#define __CALLUI_MODEL_I_CALL_UI_H__ +#ifndef __CALL_UI_MODEL_I_CALL_UI_H__ +#define __CALL_UI_MODEL_I_CALL_UI_H__ #include <app_control.h> +#include "ISoundManager.h" +#include "ICallManager.h" +#include "IIndicatorStateProvider.h" +#include "ICallListener.h" + #include "types.h" namespace callui { - class ICallUI : public ucl::Polymorphic { + UCL_DECLARE_REF_ALIASES(ICallUI); + + /** + * @brief Represents CallUI interface of main model instance + */ + class ICallUI : protected ucl::NonCopyable { public: + + /** + * @brief Sets listener + * @param[in] listener Call listener + */ virtual void setListener(const ICallListenerWRef &listener) = 0; + + /** + * @brief Processes app control + * @param[in] appControl App Control handle + * @return RES_OK on success or another result otherwise + */ virtual ucl::Result processAppControl(app_control_h appControl) = 0; + + /** + * @brief Gets sound manager instance + * @return Shared refernce to ISoundManager + */ virtual ISoundManagerSRef getSoundManager() = 0; + + /** + * @brief Gets call manager instance + * @return Shared refernce to ICallManager + */ virtual ICallManagerSRef getCallManager() = 0; + + /** + * @brief Gets indicator state provider instance + * @return Shared refernce to IIndicatorStateProvider + */ virtual IIndicatorStateProviderSRef getIndicatorStateProvider() = 0; + + protected: + ~ICallUI() = default; }; } -#endif // __CALLUI_MODEL_I_CALL_UI_H__ +#endif // __CALL_UI_MODEL_I_CALL_UI_H__ diff --git a/inc/model/IConferenceCallInfo.h b/call-ui/model/IConferenceCallInfo.h index c2c24b9..a555520 100644 --- a/inc/model/IConferenceCallInfo.h +++ b/call-ui/model/IConferenceCallInfo.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_I_CONFERENCE_CALL_INFO_H__ -#define __CALLUI_MODEL_I_CONFERENCE_CALL_INFO_H__ +#ifndef __CALL_UI_MODEL_I_CONFERENCE_CALL_INFO_H__ +#define __CALL_UI_MODEL_I_CONFERENCE_CALL_INFO_H__ #include "IBaseCallInfo.h" @@ -23,8 +23,17 @@ namespace callui { + UCL_DECLARE_REF_ALIASES(IConferenceCallInfo); + + /** + * @brief Represents conference call info interface for + * getting information about callers in conference call + * @see IBaseCallInfo + */ class IConferenceCallInfo : public IBaseCallInfo { + protected: + ~IConferenceCallInfo() = default; }; } -#endif // __CALLUI_MODEL_I_CONFERENCE_CALL_INFO_H__ +#endif // __CALL_UI_MODEL_I_CONFERENCE_CALL_INFO_H__ diff --git a/call-ui/model/IContactInfo.h b/call-ui/model/IContactInfo.h new file mode 100644 index 0000000..45157b3 --- /dev/null +++ b/call-ui/model/IContactInfo.h @@ -0,0 +1,56 @@ +/* + * 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_MODEL_I_CONTACT_INFO_H__ +#define __CALL_UI_MODEL_I_CONTACT_INFO_H__ + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(IContactInfo); + + /** + * @brief Represents Contact info interface for operations with call contact info + */ + class IContactInfo : protected ucl::NonCopyable { + public: + + /** + * @brief Gets contact name + * @return Contact name + */ + virtual std::string getName() const = 0; + + /** + * @brief Gets path to contact image + * @return Contact image path + */ + virtual std::string getImagePath() const = 0; + + /** + * @brief Gets name source type + * @remark This is source type from what contact name was took from contact database + * @return Contact name source type + */ + virtual ContactNameSourceType getNameSourceType() const = 0; + + protected: + ~IContactInfo() = default; + }; +} + +#endif // __CALL_UI_MODEL_I_CONTACT_INFO_H__ diff --git a/inc/model/IEndCall.h b/call-ui/model/IEndCall.h index bb16cab..b644f5c 100644 --- a/inc/model/IEndCall.h +++ b/call-ui/model/IEndCall.h @@ -14,19 +14,39 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_I_END_CALL_H__ -#define __CALLUI_MODEL_I_END_CALL_H__ +#ifndef __CALL_UI_MODEL_I_END_CALL_H__ +#define __CALL_UI_MODEL_I_END_CALL_H__ + +#include "ICallInfo.h" #include "types.h" namespace callui { - class IEndCall : public ucl::Polymorphic { + UCL_DECLARE_REF_ALIASES(IEndCall); + + /** + * @brief Represents End call interface for operations in end call mode + */ + class IEndCall : protected ucl::NonCopyable { public: + + /** + * @brief Gets Call info instance + * @return Shared constant reference to ICallInfo instance on success + * or NULL otherwise + */ virtual ICallInfoSCRef getInfo() const = 0; + + /** + * @brief Initiates recall to the last caller + * @return RES_OK on success or another result otherwise + */ virtual ucl::Result callBack() = 0; - virtual ucl::Result writeMessage() = 0; + + protected: + ~IEndCall() = default; }; } -#endif // __CALLUI_MODEL_I_END_CALL_H__ +#endif // __CALL_UI_MODEL_I_END_CALL_H__ diff --git a/call-ui/model/IHeldCall.h b/call-ui/model/IHeldCall.h new file mode 100644 index 0000000..c34c46f --- /dev/null +++ b/call-ui/model/IHeldCall.h @@ -0,0 +1,82 @@ +/* + * 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_MODEL_I_HELD_CALL_H__ +#define __CALL_UI_MODEL_I_HELD_CALL_H__ + +#include "ICallInfo.h" +#include "IConferenceCallInfo.h" + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(IHeldCall); + + /** + * @brief Represents Held call interface for operations with call on hold + */ + class IHeldCall : protected ucl::NonCopyable { + public: + + /** + * @brief Gets call info instance + * @return Shared reference to ICallInfo instance + * on success or NULL otherwise + */ + virtual ICallInfoSCRef getInfo() const = 0; + + /** + * @brief Unholds call + * @remark this API can be used if there is no other calls except this + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result unhold() = 0; + + /** + * @brief Joins with active call + * @remark this API can be used if there is active call + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result joinWithActive() = 0; + + /** + * @brief Swaps with active call + * @remark this API can be used if there is active call + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result swapWithActive() = 0; + + /** + * @brief Ends call + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result end() = 0; + + /** + * @brief Splits one call if call is conference + * @param[in] confCallInfo Call info of call that will be split + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result split( + const IConferenceCallInfoSCRef &confCallInfo) = 0; + + protected: + ~IHeldCall() = default; + }; +} + +#endif // __CALL_UI_MODEL_I_HELD_CALL_H__ diff --git a/call-ui/model/IIncomingCall.h b/call-ui/model/IIncomingCall.h new file mode 100644 index 0000000..5700ee3 --- /dev/null +++ b/call-ui/model/IIncomingCall.h @@ -0,0 +1,80 @@ +/* + * 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_MODEL_I_INCOMING_CALL_H__ +#define __CALL_UI_MODEL_I_INCOMING_CALL_H__ + +#include "ICallInfo.h" +#include "IRejectMsgProvider.h" +#include "IRejectMsg.h" + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(IIncomingCall); + + /** + * @brief Represents Incoming call interface for operations with incoming call + */ + class IIncomingCall : protected ucl::NonCopyable { + public: + + /** + * @brief Gets call info instance + * @return Shared reference to ICallInfo instance on success + * or NULL otherwise + */ + virtual ICallInfoSCRef getInfo() const = 0; + + /** + * @brief Gets reject message provider instance + * @return Shared reference to IRejectMsgProvider instance on success + * or NULL otherwise + */ + virtual IRejectMsgProviderSRef getRejectMsgProvider() const = 0; + + /** + * @brief Answers call + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result answer(CallAnswerType type) = 0; + + /** + * @brief Reject call + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result reject() = 0; + + /** + * @brief Reject call with message + * @param[in] message Reject message to send + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result rejectWithMessage(IRejectMsgSRef message) = 0; + + /** + * @brief Stops playing incoming call ringtone + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result stopAlert() = 0; + + protected: + ~IIncomingCall() = default; + }; +} + +#endif // __CALL_UI_MODEL_I_INCOMING_CALL_H__ diff --git a/inc/model/IIndicatorStateListener.h b/call-ui/model/IIndicatorStateListener.h index 3f88a75..5be4c53 100644 --- a/inc/model/IIndicatorStateListener.h +++ b/call-ui/model/IIndicatorStateListener.h @@ -14,18 +14,32 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_I_INDICATOR_STATE_LISTENER_H__ -#define __CALLUI_MODEL_I_INDICATOR_STATE_LISTENER_H__ +#ifndef __CALL_UI_MODEL_I_INDICATOR_STATE_LISTENER_H__ +#define __CALL_UI_MODEL_I_INDICATOR_STATE_LISTENER_H__ #include "types.h" namespace callui { - class IIndicatorStateListener: public ucl::Polymorphic { + UCL_DECLARE_REF_ALIASES(IIndicatorStateListener); + + /** + * @brief Represents Indicator state listener interface for + * getting notification about Indicator components state changes + */ + class IIndicatorStateListener: protected ucl::NonCopyable { public: + + /** + * @brief Called on indicator state change + * @param[in] property Indicator property that is changed + */ virtual void onStateChanged(IndicatorProperty property) = 0; + + protected: + ~IIndicatorStateListener() = default; }; } -#endif // __CALLUI_MODEL_I_INDICATOR_STATE_LISTENER_H__ +#endif // __CALL_UI_MODEL_I_INDICATOR_STATE_LISTENER_H__ diff --git a/inc/model/IIndicatorStateProvider.h b/call-ui/model/IIndicatorStateProvider.h index 11255b6..e534924 100644 --- a/inc/model/IIndicatorStateProvider.h +++ b/call-ui/model/IIndicatorStateProvider.h @@ -14,20 +14,42 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_I_INDICATOR_STATE_PROVIDER_H__ -#define __CALLUI_MODEL_I_INDICATOR_STATE_PROVIDER_H__ +#ifndef __CALL_UI_MODEL_I_INDICATOR_STATE_PROVIDER_H__ +#define __CALL_UI_MODEL_I_INDICATOR_STATE_PROVIDER_H__ + +#include "IndicatorState.h" +#include "IIndicatorStateListener.h" -#include <model/IndicatorState.h> #include "types.h" namespace callui { - class IIndicatorStateProvider : public ucl::Polymorphic { + UCL_DECLARE_REF_ALIASES(IIndicatorStateProvider); + + /** + * @brief Represents Indicator state provider + * interface for operations with indicator states + */ + class IIndicatorStateProvider : protected ucl::NonCopyable { public: + + /** + * @brief Gets indicator state by property type + * @param[in] property Indicator property type + * @return Indicator state instance + */ virtual IndicatorState getState(IndicatorProperty property) const = 0; + + /** + * @brief Sets listener + * @param[in] listener Indicator state listener + */ virtual void setListener(IIndicatorStateListenerWRef listener) = 0; + + protected: + ~IIndicatorStateProvider() = default; }; } -#endif // __CALLUI_MODEL_I_INDICATOR_STATE_PROVIDER_H__ +#endif // __CALL_UI_MODEL_I_INDICATOR_STATE_PROVIDER_H__ diff --git a/inc/model/IRejectMsg.h b/call-ui/model/IRejectMsg.h index 364fc1c..893cc1e 100644 --- a/inc/model/IRejectMsg.h +++ b/call-ui/model/IRejectMsg.h @@ -14,19 +14,32 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_I_REJECT_MSG_H__ -#define __CALLUI_MODEL_I_REJECT_MSG_H__ +#ifndef __CALL_UI_MODEL_I_REJECT_MSG_H__ +#define __CALL_UI_MODEL_I_REJECT_MSG_H__ #include "types.h" namespace callui { - class IRejectMsg : public ucl::Polymorphic { + UCL_DECLARE_REF_ALIASES(IRejectMsg); + + /** + * @brief Represents Reject message interface + * for operations with reject message + */ + class IRejectMsg : protected ucl::NonCopyable { public: + + /** + * @brief Gets reject message text + * @return Reject message text + */ virtual std::string getText() const = 0; + protected: + ~IRejectMsg() = default; }; } -#endif // __CALLUI_I_REJECT_MSG_H__ +#endif // __CALL_UI_I_REJECT_MSG_H__ diff --git a/inc/model/IRejectMsgProvider.h b/call-ui/model/IRejectMsgProvider.h index 15db628..8e35a62 100644 --- a/inc/model/IRejectMsgProvider.h +++ b/call-ui/model/IRejectMsgProvider.h @@ -14,19 +14,45 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_I_REJECT_MSG_PROVIDER_H__ -#define __CALLUI_MODEL_I_REJECT_MSG_PROVIDER_H__ +#ifndef __CALL_UI_MODEL_I_REJECT_MSG_PROVIDER_H__ +#define __CALL_UI_MODEL_I_REJECT_MSG_PROVIDER_H__ + +#include "IRejectMsg.h" #include "types.h" namespace callui { - class IRejectMsgProvider : public ucl::Polymorphic { + UCL_DECLARE_REF_ALIASES(IRejectMsgProvider); + + /** + * @brief Represents Reject message provider interface for + * getting reject messages + */ + class IRejectMsgProvider : protected ucl::NonCopyable { + public: + /** + * @brief List of reject messages + */ + using RejectMsgList = std::vector<IRejectMsgSRef>; + public: + /** + * @brief Gets reject message list + * @return Reject message list + */ virtual RejectMsgList getMsgList() const = 0; + + /** + * @brief Gets reject message count + * @return Reject message count + */ virtual int getMsgCount() const = 0; + + protected: + ~IRejectMsgProvider() = default; }; } -#endif // __CALLUI_MODEL_I_REJECT_MSG_PROVIDER_H__ +#endif // __CALL_UI_MODEL_I_REJECT_MSG_PROVIDER_H__ diff --git a/call-ui/model/ISoundManager.h b/call-ui/model/ISoundManager.h new file mode 100644 index 0000000..d11b385 --- /dev/null +++ b/call-ui/model/ISoundManager.h @@ -0,0 +1,165 @@ +/* + * 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_MODEL_I_SOUND_MANAGER_H__ +#define __CALL_UI_MODEL_I_SOUND_MANAGER_H__ + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(ISoundManager); + + /** + * @brief Represents Sound manager interface for operations + * with sound during call + */ + class ISoundManager: protected ucl::NonCopyable { + public: + + /** + * @brief Sets speaker state + * @param[in] isEnable Speaker state to set + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result setSpeakerState(bool isEnable) = 0; + + /** + * @brief Sets Bluetooth headset connection state + * @param[in] isEnable Bluetooth headset connection state to set + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result setBluetoothState(bool isEnable) = 0; + + /** + * @brief Gets current audio state + * @return Audio state type + */ + virtual AudioStateType getAudioState() const = 0; + + /** + * @brief Sets mute state + * @param[in] isEnable Mute state to set + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result setMuteState(bool isEnable) = 0; + + /** + * @brief Gets mute state + * @return Mute state + */ + virtual bool getMuteState() const = 0; + + /** + * @brief Starts DTMF signal + * @param[in] dtmfDigit DTMF digit to start + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result startDtmf(const unsigned char dtmfDigit) = 0; + + /** + * @brief Stops DTMF signal + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result stopDtmf() = 0; + + /** + * @brief Adds audio state handler + * @param[in] handler Handler to add + */ + virtual void addAudioStateHandler(NotiHandler handler) = 0; + + /** + * @brief Deletes audio state handler + * @param[in] handler Handler to delete + */ + virtual void delAudioStateHandler(NotiHandler::CDRef handler) = 0; + + /** + * @brief Adds mute state handler + * @param[in] handler Handler to add + */ + virtual void addMuteStateHandler(NotiHandler handler) = 0; + + /** + * @brief Deletes mute state handler + * @param[in] handler Handler to delete + */ + virtual void delMuteStateHandler(NotiHandler::CDRef handler) = 0; + + /** + * @brief Adds volume state handler + * @param[in] handler Handler to add + */ + virtual void addVolumeStateHandler(NotiHandler handler) = 0; + + /** + * @brief Deletes volume state handler + * @param[in] handler Handler to delete + */ + virtual void delVolumeStateHandler(NotiHandler::CDRef handler) = 0; + + /** + * @brief Gets max volume level + * @return Max volume level value + */ + virtual int getMaxVolume() const = 0; + + /** + * @brief Gets current volume level + * @return Current volume level value + */ + virtual int getVolume() const = 0; + + /** + * @brief Sets volume level + * @param[in] value Volume level value to set + * @return RES_OK on success or another result otherwise + */ + virtual ucl::Result setVolume(int value) = 0; + + /** + * @brief Checks whether Bluetooth is supported + * @return true is supported, false otherwise + */ + virtual bool isBTSupported() const = 0; + + /** + * @brief Checks whether Bluetooth Headset is connected + * @return true if connected, false otherwise + */ + virtual bool isBTHeadsetConnected() const = 0; + + /** + * @brief Adds Bluetooth Headset connection change handler + * @param[in] handler Handler to add + */ + virtual void addBTHeadsetConnectionChangeHandler( + NotiHandler handler) = 0; + + /** + * @brief Deletes Bluetooth Headset connection change handler + * @param[in] handler Handler to delete + */ + virtual void delBTHeadsetConnectionChangeHandler( + NotiHandler::CDRef handler) = 0; + + protected: + ~ISoundManager() = default; + }; +} + +#endif // __CALL_UI_MODEL_I_SOUND_MANAGER_H__ diff --git a/call-ui/model/IndicatorState.h b/call-ui/model/IndicatorState.h new file mode 100644 index 0000000..1099310 --- /dev/null +++ b/call-ui/model/IndicatorState.h @@ -0,0 +1,96 @@ +/* + * 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_MODEL_INDICATOR_STATE_H__ +#define __CALL_UI_MODEL_INDICATOR_STATE_H__ + +#include "types.h" + +namespace callui { + + /** + * @brief Represents Indicator state instance + */ + struct IndicatorState { + uint64_t value; + }; + + /** + * @brief Gets connection state + * @param[in] state Indicator state + * @return Connection type + */ + ConnectionType getConnectionState(IndicatorState state); + + /** + * @brief Gets packet direction + * @param[in] state Indicator state + * @return Packet direction type + */ + PacketDirection getPacketDirection(IndicatorState state); + + /** + * @brief Gets RSSI state + * @param[in] state Indicator state + * @return RSSI state + */ + RssiState getRssiState(IndicatorState state); + + /** + * @brief Gets roaming state + * @param[in] state Indicator state + * @return true if roaming is on, false otherwise + */ + bool getRoamingState(IndicatorState state); + + /** + * @brief Gets battery charge level + * @param[in] state Indicator state + * @return Battery charge level + */ + int getBatteryLevel(IndicatorState state); + + /** + * @brief Gets battery state + * @param[in] state Indicator state + * @return Battery state + */ + BatteryState getBatteryState(IndicatorState state); + + /** + * @brief Gets current active sim slot type + * @param[in] state Indicator state + * @return Sim slot type + */ + SimSlot getSimSlotType(IndicatorState state); + + /** + * @brief Gets whether sim must have forwarded state + * @param[in] state Indicator state + * @return true if sim call forwarded state is set, false otherwise + */ + bool getSimForwardState(IndicatorState state); + + /** + * @brief Gets whether current call has HD voice + * @param[in] state Indicator state + * @return true if current call has HD voice, false otherwise + */ + bool getHDVoiceState(IndicatorState state); + +} + +#endif // __CALL_UI_MODEL_INDICATOR_STATE_H__ diff --git a/src/model/ActiveCall.cpp b/call-ui/model/impl/ActiveCall.cpp index 7e19f94..686699f 100644 --- a/src/model/ActiveCall.cpp +++ b/call-ui/model/impl/ActiveCall.cpp @@ -16,11 +16,7 @@ #include "ActiveCall.h" -#include <call-manager-extension.h> - #include "CallManager.h" -#include "CallClient.h" -#include "CallInfo.h" #include "common.h" @@ -29,26 +25,22 @@ namespace callui { using namespace ucl; ActiveCall::ActiveCall(CallManagerWRef cm, cm_call_data_h callData): - m_cm(cm), - m_isDialing(false) - { - } - - ActiveCall::~ActiveCall() + m_cm(std::move(cm)), + m_isDialing(false) { } ActiveCallSRef ActiveCall::newInstance(CallManagerWRef cm, cm_call_data_h callData) { if (!cm) { - LOG_RETURN_VALUE(RES_FAIL, {}, "cm is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "cm is NULL"); } if (!callData) { - LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "callData is NULL"); } - auto result = makeShared<ActiveCall>(cm, callData); + auto result = makeShared<ActiveCall>(std::move(cm), callData); FAIL_RETURN_VALUE(result->prepare(callData), {}, "result->prepare() failed!"); return result; } diff --git a/src/model/ActiveCall.h b/call-ui/model/impl/ActiveCall.h index ee2e22e..e6b05ca 100644 --- a/src/model/ActiveCall.h +++ b/call-ui/model/impl/ActiveCall.h @@ -14,42 +14,83 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_ACTIVE_CALL_H__ -#define __CALLUI_MODEL_ACTIVE_CALL_H__ +#ifndef __CALL_UI_MODEL_IMPL_ACTIVE_CALL_H__ +#define __CALL_UI_MODEL_IMPL_ACTIVE_CALL_H__ #include <call-manager-ext.h> -#include "model/IActiveCall.h" +#include "call-ui/model/IActiveCall.h" -#include "implTypes.h" +#include "CallClient.h" +#include "CallInfo.h" + +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(CallManager); + + UCL_DECLARE_REF_ALIASES(ActiveCall); + + /** + * @brief Represents implementation of IActiveCall interface + * @see IActiveCall + */ class ActiveCall final : public IActiveCall { public: - static ActiveCallSRef newInstance(CallManagerWRef cm, cm_call_data_h callData); - virtual ~ActiveCall(); - // IActiveCall + /** + * @brief Creates new instance of ActiveCall + * @param[in] cm Weak reference to CallManager + * @param[in] callData The platform Call Manager Call data handle + * @return Shared reference to ActiveCall + */ + static ActiveCallSRef newInstance(CallManagerWRef cm, + cm_call_data_h callData); + // IActiveCall // + + /** + * @see IActiveCall::getInfo() + */ virtual ICallInfoSCRef getInfo() const override final; + + /** + * @see IActiveCall::isDialingMode() + */ virtual bool isDialingMode() const override final; + + /** + * @see IActiveCall::hold() + */ virtual ucl::Result hold() override final; + + /** + * @see IActiveCall::end() + */ virtual ucl::Result end() override final; - virtual ucl::Result split(const IConferenceCallInfoSCRef &confCallInfo) override final; + + /** + * @see IActiveCall::split() + */ + virtual ucl::Result split( + const IConferenceCallInfoSCRef &confCallInfo) override final; private: - friend class ucl::ReffedObj<ActiveCall>; ActiveCall(CallManagerWRef cm, cm_call_data_h callData); + ~ActiveCall() = default; ucl::Result prepare(cm_call_data_h callData); private: - CallManagerWRef m_cm; + const CallManagerWRef m_cm; + CallInfoSRef m_callInfo; bool m_isDialing; + + friend class ucl::ReffedObj<ActiveCall>; }; } -#endif // __CALLUI_MODEL_ACTIVE_CALL_H__ +#endif // __CALL_UI_MODEL_IMPL_ACTIVE_CALL_H__ diff --git a/src/model/BatteryStateSource.cpp b/call-ui/model/impl/BatteryStateSource.cpp index 6eb2769..1a64825 100644 --- a/src/model/BatteryStateSource.cpp +++ b/call-ui/model/impl/BatteryStateSource.cpp @@ -127,8 +127,10 @@ namespace callui { void BatteryStateSource::onBatteryStateChangedCb(keynode_t *node) { - if (updateBatteryState() && m_handler) { - m_handler(); + if (updateBatteryState()) { + if (const auto handler = m_handler.lock()) { + handler(); + } } } @@ -137,25 +139,25 @@ namespace callui { int res = vconf_notify_key_changed(VCONFKEY_SYSMAN_CHARGER_STATUS, CALLBACK_B(BatteryStateSource::onBatteryStateChangedCb), this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } res = vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, CALLBACK_B(BatteryStateSource::onBatteryStateChangedCb), this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } res = vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, CALLBACK_B(BatteryStateSource::onBatteryStateChangedCb), this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } res = vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_CAPACITY, CALLBACK_B(BatteryStateSource::onBatteryStateChangedCb), this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } return RES_OK; @@ -178,9 +180,9 @@ namespace callui { return {m_bits.value}; } - void BatteryStateSource::setStateChangeHandler(const NotiHandler &handler) + void BatteryStateSource::setStateChangeHandler(NotiHandler handler) { - m_handler = handler; + m_handler = std::move(handler); } int getBatteryLevel(IndicatorState state) diff --git a/src/model/BatteryStateSource.h b/call-ui/model/impl/BatteryStateSource.h index 09c2a79..98faee2 100644 --- a/src/model/BatteryStateSource.h +++ b/call-ui/model/impl/BatteryStateSource.h @@ -14,30 +14,49 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_BATTERY_STATE_SOURCE_H__ -#define __CALLUI_MODEL_BATTERY_STATE_SOURCE_H__ - -#include "IIndicatorStateSource.h" +#ifndef __CALL_UI_MODEL_IMPL_BATTERY_STATE_SOURCE_H__ +#define __CALL_UI_MODEL_IMPL_BATTERY_STATE_SOURCE_H__ #include <vconf.h> -#include "implTypes.h" +#include "IIndicatorStateSource.h" + +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(BatteryStateSource); + + /** + * @brief Represents Battery state source for IndicatorStateProvider + * Inherits from IIndicatorStateSource + * @see IIndicatorStateSource + */ class BatteryStateSource final : public IIndicatorStateSource { public: + + /** + * @brief Creates new instance of BatteryStateSource + * @return Shared reference to BatteryStateSource instance on success + * or NULL otherwise + */ static BatteryStateSourceSRef newInstance(); - virtual ~BatteryStateSource(); - // IIndicatorStateSource + // IIndicatorStateSource // + /** + * @see IIndicatorStateSource::getState() + */ virtual IndicatorState getState() const override final; - virtual void setStateChangeHandler(const NotiHandler &handler) override final; + + /** + * @see IIndicatorStateSource::setStateChangeHandler() + */ + virtual void setStateChangeHandler(NotiHandler handler) override final; private: - friend class ucl::ReffedObj<BatteryStateSource>; BatteryStateSource(); + ~BatteryStateSource(); ucl::Result prepare(); @@ -69,8 +88,10 @@ namespace callui { private: Bits m_bits; NotiHandler m_handler; + + friend class ucl::ReffedObj<BatteryStateSource>; }; } -#endif // __CALLUI_MODEL_BATTERY_STATE_SOURCE_H__ +#endif // __CALL_UI_MODEL_IMPL_BATTERY_STATE_SOURCE_H__ diff --git a/src/model/BluetoothManager.cpp b/call-ui/model/impl/BluetoothManager.cpp index 27bdaed..0cb78c0 100644 --- a/src/model/BluetoothManager.cpp +++ b/call-ui/model/impl/BluetoothManager.cpp @@ -25,10 +25,37 @@ namespace callui { namespace { namespace impl { - using namespace ucl; - constexpr auto BT_VOLUME_MAX = 15; + bool isScoOpened() + { + bool isOpened = false; + auto res = bt_ag_is_sco_opened(&isOpened); + if (res != BT_ERROR_NONE) { + LOG_RETURN_VALUE(RES_FAIL, false, + "bt_ag_is_sco_opened() failed! " + "res[%d] msg[%s]", res, get_error_message(res)); + } + DLOG("SCO state [%s]", isOpened ? "opened" : "closed"); + + return isOpened; + } + + bool isCallCurrentSoundType() + { + sound_type_e soundType = SOUND_TYPE_SYSTEM; + auto res = sound_manager_get_current_sound_type(&soundType); + if (res != SOUND_MANAGER_ERROR_NONE) { + LOG_RETURN_VALUE(RES_FAIL, false, + "sound_manager_get_current_sound_type() failed! " + "res[%d] msg[%s]", res, get_error_message(res)); + } + bool ret = (soundType == SOUND_TYPE_CALL); + DLOG("Current sound type is Call [%s]", ret ? "YES" : "NO"); + + return ret; + } + }}} namespace callui { @@ -51,7 +78,8 @@ namespace callui { BluetoothManager::~BluetoothManager() { - unregisterAudioHandling(); + unregisterScoStateHandling(); + unregisterVolumeChangeHandling(); unregisterHeadsetConnectionHandling(); deinitializeBluetooth(); } @@ -61,8 +89,11 @@ namespace callui { FAIL_RETURN(initializeBluetooth(), "initializeBluetooth() failed!"); - FAIL_RETURN(registerAudioHandling(), - "registerAudioHandling() failed"); + FAIL_RETURN(registerVolumeChangeHandling(), + "registerVolumeChangeHandling() failed!"); + + FAIL_RETURN(registerScoStateHandling(), + "registerScoStateHandling() failed!"); FAIL_RETURN(registerHeadsetConnectionHandling(), "registerHeadsetConnectionHandling() failed!"); @@ -74,29 +105,36 @@ namespace callui { Result BluetoothManager::initializeBluetooth() { - auto ret = bt_initialize(); - if (ret != BT_ERROR_NONE) { + auto res = bt_initialize(); + if (res != BT_ERROR_NONE) { LOG_RETURN(RES_FAIL, "BT initialize failed! " - "ret[%d] msg[%s]", ret, get_error_message(ret)); - + "res[%d] msg[%s]", res, get_error_message(res)); } + m_btInitialized = true; return RES_OK; } void BluetoothManager::deinitializeBluetooth() { - bt_deinitialize(); + if (m_btInitialized) { + m_btInitialized = false; + bt_deinitialize(); + } } int BluetoothManager::getVolume() const { auto vol = 0; - auto ret = bt_ag_get_speaker_gain(&vol); - if (ret != BT_ERROR_NONE) { - LOG_RETURN_VALUE(RES_FAIL, -1, "bt_ag_get_speaker_gain() failed! " - "ret[%d] msg[%s]", ret, get_error_message(ret)); + if (impl::isScoOpened() && impl::isCallCurrentSoundType()) { + auto res = bt_ag_get_speaker_gain(&vol); + if (res != BT_ERROR_NONE) { + LOG_RETURN_VALUE(RES_FAIL, -1, + "bt_ag_get_speaker_gain() failed! " + "res[%d] msg[%s]", res, get_error_message(res)); + } } + DLOG("BT Volume level [%d]", vol); return vol; } @@ -108,55 +146,73 @@ namespace callui { Result BluetoothManager::setVolume(int volume) { - auto ret = bt_ag_notify_speaker_gain(volume); - if (ret != BT_ERROR_NONE) { - LOG_RETURN(RES_FAIL, "bt_ag_notify_speaker_gain() failed! " - "ret[%d] msg[%s]", ret, get_error_message(ret)); + if (impl::isScoOpened() && impl::isCallCurrentSoundType()) { + auto res = bt_ag_notify_speaker_gain(volume); + if (res != BT_ERROR_NONE) { + LOG_RETURN(RES_FAIL, "bt_ag_notify_speaker_gain() failed! " + "res[%d] msg[%s]", res, get_error_message(res)); + } + return RES_OK; } - return RES_OK; + + return RES_FAIL; } - void BluetoothManager::setVolumeStateHandler( - const BluetoothVolumeHandler &handler) + void BluetoothManager::setVolumeChangeHandler(NotiHandler handler) { - m_btVolumeHandler = handler; + m_btVolumeHandler = std::move(handler); } - Result BluetoothManager::registerAudioHandling() + Result BluetoothManager::registerVolumeChangeHandling() { - auto ret = bt_audio_initialize(); - if (ret != BT_ERROR_NONE) { + auto res = bt_audio_initialize(); + if (res != BT_ERROR_NONE) { LOG_RETURN(RES_FAIL, "bt_audio_initialize() failed! ", - "ret[%d] msg[%s]", ret, get_error_message(ret)); + "res[%d] msg[%s]", res, get_error_message(res)); } m_btAudioInitialized = true; - ret = bt_ag_set_speaker_gain_changed_cb( + res = bt_ag_set_speaker_gain_changed_cb( CALLBACK_B(BluetoothManager::onVolumeChanged), this); - if (ret != BT_ERROR_NONE) { + if (res != BT_ERROR_NONE) { LOG_RETURN(RES_FAIL, "bt_ag_set_speaker_gain_changed_cb() failed! " - "ret[%d] msg[%s]", ret, get_error_message(ret)); + "res[%d] msg[%s]", res, get_error_message(res)); } - return RES_OK; } - void BluetoothManager::unregisterAudioHandling() + void BluetoothManager::unregisterVolumeChangeHandling() { bt_ag_unset_speaker_gain_changed_cb(); if (m_btAudioInitialized) { - bt_audio_deinitialize(); m_btAudioInitialized = false; + bt_audio_deinitialize(); } } + Result BluetoothManager::registerScoStateHandling() + { + auto res = bt_ag_set_sco_state_changed_cb( + CALLBACK_B(BluetoothManager::onScoChanged), this); + if (res != BT_ERROR_NONE) { + LOG_RETURN(RES_FAIL, "bt_ag_set_sco_state_changed_cb() failed! ", + "res[%d] msg[%s]", res, get_error_message(res)); + } + return RES_OK; + } + + void BluetoothManager::unregisterScoStateHandling() + { + bt_ag_unset_sco_state_changed_cb(); + } + Result BluetoothManager::registerHeadsetConnectionHandling() { - auto ret = vconf_notify_key_changed(VCONFKEY_BT_DEVICE, + auto res = vconf_notify_key_changed(VCONFKEY_BT_DEVICE, CALLBACK_B(BluetoothManager::onHeadsetConnectionChanged), this); - if (ret != 0) { + if (res != 0) { LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } return RES_OK; @@ -164,30 +220,33 @@ namespace callui { void BluetoothManager::unregisterHeadsetConnectionHandling() { - vconf_ignore_key_changed( - VCONFKEY_BT_DEVICE, + vconf_ignore_key_changed(VCONFKEY_BT_DEVICE, CALLBACK_B(BluetoothManager::onHeadsetConnectionChanged)); } void BluetoothManager::onVolumeChanged(int volume) { - sound_type_e soundType = SOUND_TYPE_SYSTEM; - auto ret = sound_manager_get_current_sound_type(&soundType); - if (ret != SOUND_MANAGER_ERROR_NONE) { - LOG_RETURN_VOID(RES_FAIL, "sound_manager_get_current_sound_type() failed! " - "ret[%d] msg[%s]", ret, get_error_message(ret)); - } + DLOG(); + notifyVolumeChange(); + } + + void BluetoothManager::onScoChanged(int result, bool opened) + { + DLOG("Result [%d] SCO state [%s]", result, + opened ? "opened" : "close"); - bool isSCOOpened = false; - ret = bt_ag_is_sco_opened(&isSCOOpened); - if (ret != BT_ERROR_NONE) { - LOG_RETURN_VOID(RES_FAIL, "sound_manager_get_current_sound_type() failed! " - "ret[%d] msg[%s]", ret, get_error_message(ret)); + if (result == BT_ERROR_NONE && opened) { + notifyVolumeChange(); } + } - if (isSCOOpened && soundType == SOUND_TYPE_CALL) { - if (m_btVolumeHandler) { - m_btVolumeHandler(volume); + void BluetoothManager::notifyVolumeChange() + { + if (impl::isScoOpened() && impl::isCallCurrentSoundType()) { + DLOG("Try call volume change handler..."); + if (const auto handler = m_btVolumeHandler.lock()) { + DLOG("Call volume change handler"); + handler(); } } } @@ -197,18 +256,19 @@ namespace callui { return m_isHeadsetConnected; } - void BluetoothManager::setHeadsetConnectionChangeHandler(const NotiHandler &handler) + void BluetoothManager::setHeadsetConnectionChangeHandler( + NotiHandler handler) { - m_btConnectionHandler = handler; + m_btConnectionHandler = std::move(handler); } - bool BluetoothManager::getHeadsetConnectionState() + bool BluetoothManager::getHeadsetConnectionState() const { bt_adapter_state_e adapterState = BT_ADAPTER_DISABLED; - auto ret = bt_adapter_get_state(&adapterState); - if (ret != BT_ERROR_NONE) { + auto res = bt_adapter_get_state(&adapterState); + if (res != BT_ERROR_NONE) { LOG_RETURN_VALUE(RES_FAIL, false, "bt_adapter_get_state() failed! " - "ret[%d] msg[%s]", ret, get_error_message(ret)); + "res[%d] msg[%s]", res, get_error_message(res)); } if (adapterState == BT_ADAPTER_DISABLED) { @@ -216,10 +276,10 @@ namespace callui { } auto dev = 0; - ret = vconf_get_int(VCONFKEY_BT_DEVICE, &dev); - if (ret != 0) { + res = vconf_get_int(VCONFKEY_BT_DEVICE, &dev); + if (res != 0) { LOG_RETURN_VALUE(RES_FAIL, false, "vconf_get_int() failed! " - "ret[%d] msg[%s]", ret, get_error_message(ret)); + "res[%d] msg[%s]", res, get_error_message(res)); } if (dev == VCONFKEY_BT_DEVICE_NONE) { @@ -237,16 +297,18 @@ namespace callui { void BluetoothManager::setHeadsetConnectionState(bool isConnected) { if (m_isHeadsetConnected != isConnected) { + DLOG("BT Headset connection state update"); m_isHeadsetConnected = isConnected; - if (m_btConnectionHandler) { - m_btConnectionHandler(); + if (const auto handler = m_btConnectionHandler.lock()) { + handler(); } } } void BluetoothManager::onHeadsetConnectionChanged(keynode_t *node) { - bool isConnected = getHeadsetConnectionState(); + auto isConnected = getHeadsetConnectionState(); + DLOG("BT Headset connection state [%s]", isConnected ? "YES" : "NO"); setHeadsetConnectionState(isConnected); } diff --git a/call-ui/model/impl/BluetoothManager.h b/call-ui/model/impl/BluetoothManager.h new file mode 100644 index 0000000..e1b7f4f --- /dev/null +++ b/call-ui/model/impl/BluetoothManager.h @@ -0,0 +1,117 @@ +/* + * 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_MODEL_IMPL_BLUETOOTH_MANAGER_H__ +#define __CALL_UI_MODEL_IMPL_BLUETOOTH_MANAGER_H__ + +#include <vconf.h> + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(BluetoothManager); + + /** + * @brief Represents Bluetooth headset manager to operate + * Headset connected devices + */ + class BluetoothManager final { + public: + + /** + * @brief Creates new instance of BluetoothManager + * @return Shared reference to BluetoothManager instance on success + * or NULL otherwise + */ + static BluetoothManagerSRef newInstance(); + + /** + * @brief Gets volume level of connected BT headset device + * @return Volume level + */ + int getVolume() const; + + /** + * @brief Gets max volume level of connected BT headset device + * @return Max volume level + */ + int getMaxVolume() const; + + /** + * @brief Gets max volume level of connected BT headset device + * @param[in] volume Volume level to set + * @return RES_OK on success or another result otherwise + */ + ucl::Result setVolume(int volume); + + /** + * @brief Sets volume level change handler + * @param[in] handler Volume state change handler + */ + void setVolumeChangeHandler(NotiHandler handler); + + /** + * @brief Checks whether headset device is connected + * @return true if headset device is connected, false + */ + bool isHeadsetConnected() const; + + /** + * @brief Sets handler for monitoring headset connection change + * @return true if headset device is connected, false + */ + void setHeadsetConnectionChangeHandler(NotiHandler handler); + + private: + BluetoothManager(); + ~BluetoothManager(); + + ucl::Result prepare(); + + ucl::Result initializeBluetooth(); + void deinitializeBluetooth(); + + ucl::Result registerVolumeChangeHandling(); + void unregisterVolumeChangeHandling(); + void onVolumeChanged(int volume); + + ucl::Result registerScoStateHandling(); + void unregisterScoStateHandling(); + void onScoChanged(int result, bool opened); + + void notifyVolumeChange(); + + ucl::Result registerHeadsetConnectionHandling(); + void unregisterHeadsetConnectionHandling(); + + bool getHeadsetConnectionState() const; + void setHeadsetConnectionState(bool isConnected); + void onHeadsetConnectionChanged(keynode_t *node); + + private: + NotiHandler m_btVolumeHandler; + NotiHandler m_btConnectionHandler; + bool m_btInitialized; + bool m_btAudioInitialized; + + bool m_isHeadsetConnected; + + friend class ucl::ReffedObj<BluetoothManager>; + }; +} + +#endif // __CALL_UI_MODEL_IMPL_BLUETOOTH_MANAGER_H__ diff --git a/src/model/CallClient.cpp b/call-ui/model/impl/CallClient.cpp index f496bc2..f496bc2 100644 --- a/src/model/CallClient.cpp +++ b/call-ui/model/impl/CallClient.cpp diff --git a/src/model/CallClient.h b/call-ui/model/impl/CallClient.h index 6a375ae..415753f 100644 --- a/src/model/CallClient.h +++ b/call-ui/model/impl/CallClient.h @@ -14,30 +14,53 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_CALL_CLIENT_H__ -#define __CALLUI_MODEL_CALL_CLIENT_H__ +#ifndef __CALL_UI_MODEL_IMPL_CALL_CLIENT_H__ +#define __CALL_UI_MODEL_IMPL_CALL_CLIENT_H__ #include <call-manager.h> -#include "implTypes.h" +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(CallClient); + + /** + * @brief Represents wrapper on platform Call Manager handle + */ class CallClient { public: + + /** + * @brief Creates new instance of CallClient + * @return Shared reference to CallClient instance on success + * or NULL otherwise + */ static CallClientSRef newInstance(); - virtual ~CallClient(); + + /** + * @brief Gets platform Call Manager handle + * @return Platform Call Manager handle on success + * or NULL otherwise + */ cm_client_h getCmClient() const; + + /** + * @brief Operator cm_client_h + */ operator cm_client_h() const; private: - friend class ucl::ReffedObj<CallClient>; CallClient(); + ~CallClient(); + ucl::Result prepare(); private: cm_client_h m_client; + + friend class ucl::ReffedObj<CallClient>; }; } -#endif // __CALLUI_MODEL_CALL_CLIENT_H__ +#endif // __CALL_UI_MODEL_IMPL_CALL_CLIENT_H__ diff --git a/src/model/CallInfo.cpp b/call-ui/model/impl/CallInfo.cpp index 2f7a1d3..d1913d3 100644 --- a/src/model/CallInfo.cpp +++ b/call-ui/model/impl/CallInfo.cpp @@ -16,16 +16,10 @@ #include "CallInfo.h" -#include <call-manager-extension.h> #include <glib/gslist.h> #include <glib/gtypes.h> #include <sys/sysinfo.h> -#include "CallClient.h" -#include "ContactInfoProvider.h" -#include "ContactInfo.h" -#include "ConferenceCallInfo.h" - #include "common.h" namespace callui { namespace { namespace impl { @@ -73,33 +67,25 @@ namespace callui { { } - CallInfo::~CallInfo() - { - } - CallInfoSRef CallInfo::newInstance(CallClient &client, cm_call_data_h callData, - ContactInfoProviderSRef callInfoProvider) + const ContactInfoProviderSRef &contactInfoProvider) { - if (!client) { - LOG_RETURN_VALUE(RES_FAIL, {}, "client is NULL"); - } - if (!callData) { - LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "callData is NULL"); } auto result = makeShared<CallInfo>(); FAIL_RETURN_VALUE(result->prepare(client, callData, - callInfoProvider), + contactInfoProvider), {}, "result->prepare() failed!"); return result; } Result CallInfo::prepare(CallClient &client, cm_call_data_h callData, - ContactInfoProviderSRef callInfoProvider) + const ContactInfoProviderSRef &contactInfoProvider) { Result res = convertCMResult( cm_call_data_get_call_id(callData, &m_callId)); @@ -140,8 +126,8 @@ namespace callui { cm_call_data_get_person_id(callData, &personId)); FAIL_RETURN(res, "cm_call_data_get_person_id() failed!"); - if (personId >= 0 && callInfoProvider) { - m_contactInfo = callInfoProvider->createContactInfo(personId); + if (personId >= 0 && contactInfoProvider) { + m_contactInfo = contactInfoProvider->createContactInfo(personId); if (!m_contactInfo) { LOG_RETURN(RES_FAIL, "createContactInfo() failed!"); } @@ -151,7 +137,7 @@ namespace callui { FAIL_RETURN(res, "cm_call_data_get_call_member_count() failed!"); if (m_confMemberCount > 1) { - res = initConferenceCallInfoList(client, callInfoProvider); + res = initConferenceCallInfoList(client, contactInfoProvider); FAIL_RETURN(res, "initConferenceCallInfoList() failed!"); } @@ -159,7 +145,7 @@ namespace callui { } Result CallInfo::initConferenceCallInfoList(CallClient &client, - ContactInfoProviderSRef callInfoProvider) + const ContactInfoProviderSRef &contactInfoProvider) { // XXX: must be initialized with nullptr. If not an there is no conference calls // cm_get_conference_callList return CM_ERROR_NONE and pointer will be not changed. @@ -173,7 +159,7 @@ namespace callui { for (; l != nullptr; l = g_slist_next(l)) { auto confCallInfo = ConferenceCallInfo::newInstance( static_cast<cm_conf_call_data_t *>(l->data), - callInfoProvider); + contactInfoProvider); if (!confCallInfo) { LOG_BREAK(res = RES_OUT_OF_MEMORY, "ConferenceCallInfo::newInstance() failed!"); } @@ -210,7 +196,7 @@ namespace callui { { struct tm tmp{0}; FAIL_RETURN_VALUE(impl::getCurrTimeDiffInTm(m_startTime, tmp), - {0}, "getCurrTimeDiffInTm() failed"); + {0}, "getCurrTimeDiffInTm() failed!"); return tmp; } @@ -244,7 +230,7 @@ namespace callui { return m_confMemberList; } - // Non-member functions + // Non-member functions // bool isUnknownCaller(const ICallInfo &info) { diff --git a/src/model/CallInfo.h b/call-ui/model/impl/CallInfo.h index 345a6f7..db8d541 100644 --- a/src/model/CallInfo.h +++ b/call-ui/model/impl/CallInfo.h @@ -14,46 +14,100 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_CALL_INFO_H__ -#define __CALLUI_MODEL_CALL_INFO_H__ +#ifndef __CALL_UI_MODEL_IMPL_CALL_INFO_H__ +#define __CALL_UI_MODEL_IMPL_CALL_INFO_H__ #include <call-manager-ext.h> -#include "model/ICallInfo.h" +#include "call-ui/model/ICallInfo.h" -#include "implTypes.h" +#include "CallClient.h" +#include "ContactInfoProvider.h" +#include "ConferenceCallInfo.h" + +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(CallInfo); + + /** + * @brief Represents implementation of ICallInfo interface + * @see ICallInfo + */ class CallInfo final : public ICallInfo { public: + + /** + * @brief Creates new instance of CallInfo + * @return Shared reference to CallInfo instance on success + * or NULL otherwise + */ static CallInfoSRef newInstance(CallClient &client, cm_call_data_h callData, - ContactInfoProviderSRef callInfoProvider); - virtual ~CallInfo(); + const ContactInfoProviderSRef &contactInfoProvider); - // ICallInfo + // ICallInfo // + /** + * @see ICallInfo::getCallId() + */ virtual unsigned int getCallId() const override final; + + /** + * @see ICallInfo::getPhoneNumber() + */ virtual const std::string &getPhoneNumber() const override final; + + /** + * @see ICallInfo::getContactInfo() + */ virtual IContactInfoSCRef getContactInfo() const override final; + + /** + * @see ICallInfo::getDuration() + */ virtual struct tm getDuration() const override final; + + /** + * @see ICallInfo::isEmergency() + */ virtual bool isEmergency() const override final; + + /** + * @see ICallInfo::isHDVoice() + */ virtual bool isHDVoice() const override final; + + /** + * @see ICallInfo::isForwarded() + */ virtual bool isForwarded() const override final; + + /** + * @see ICallInfo::isVoiceMailNumber() + */ virtual bool isVoiceMailNumber() const override final; + + /** + * @see ICallInfo::getConferenceMemberCount() + */ virtual int getConferenceMemberCount() const override final; + + /** + * @see ICallInfo::getConferenceMemberList() + */ virtual const ConfMemberList &getConferenceMemberList() const override final; private: - friend class ucl::ReffedObj<CallInfo>; CallInfo(); + ~CallInfo() = default; ucl::Result prepare(CallClient &client, cm_call_data_h callData, - ContactInfoProviderSRef callInfoProvider); + const ContactInfoProviderSRef &contactInfoProvider); ucl::Result initConferenceCallInfoList(CallClient &client, - ContactInfoProviderSRef callInfoProvider); + const ContactInfoProviderSRef &contactInfoProvider); private: unsigned int m_callId; @@ -66,8 +120,10 @@ namespace callui { bool m_isVoiceMailNumber; int m_confMemberCount; ConfMemberList m_confMemberList; + + friend class ucl::ReffedObj<CallInfo>; }; } -#endif // __CALLUI_MODEL_CALL_INFO_H__ +#endif // __CALL_UI_MODEL_IMPL_CALL_INFO_H__ diff --git a/src/model/CallManager.cpp b/call-ui/model/impl/CallManager.cpp index 8c9c7bd..c63803f 100644 --- a/src/model/CallManager.cpp +++ b/call-ui/model/impl/CallManager.cpp @@ -16,20 +16,6 @@ #include "CallManager.h" -#include "ICallManagerListener.h" - -#include "CallClient.h" -#include "RejectMsgProvider.h" -#include "IncomingCall.h" -#include "ActiveCall.h" -#include "HeldCall.h" -#include "EndCall.h" - -#include "ContactInfoProvider.h" - -#include "CallInfo.h" -#include "ConferenceCallInfo.h" - #include "common.h" namespace callui { namespace { namespace impl { @@ -43,26 +29,27 @@ namespace callui { using namespace ucl; CallManager::CallManager(IRefCountObj &rc, - const CallClientSRef &callClient, - ICallManagerListenerWRef listener): - RefCountAware(&rc), - m_callClient(callClient), - m_listener(listener), - m_slot(SimSlot::UNDEFINED), - m_waitDialing(false), - m_confTypeCallReq(CALL_FLAG_NONE), - m_blockCMEvents(false) - { - } - - CallManager::~CallManager() + CallClientSRef callClient, + ICallManagerListenerWRef listener): + RefCountAware(&rc), + m_callClient(std::move(callClient)), + m_listener(std::move(listener)), + m_slot(SimSlot::UNDEFINED), + m_waitDialing(false), + m_confTypeCallReq(CALL_FLAG_NONE), + m_blockCMEvents(false) { } - CallManagerSRef CallManager::newInstance(const CallClientSRef &callClient, + CallManagerSRef CallManager::newInstance(CallClientSRef callClient, ICallManagerListenerWRef listener) { - auto result = makeShared<CallManager>(callClient, listener); + if (!callClient) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "callClient is NULL"); + } + + auto result = makeShared<CallManager>(std::move(callClient), + std::move(listener)); FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!"); return result; } @@ -71,7 +58,7 @@ namespace callui { { m_contactInfoProvider = ContactInfoProvider::newInstance(); if (!m_contactInfoProvider) { - ELOG("ContactInfoProvider::newInstance() failed"); + ELOG("ContactInfoProvider::newInstance() failed!"); } FAIL_RETURN(initCalls(), "initCalls() failed!"); @@ -154,32 +141,14 @@ namespace callui { return m_endCall; } - CallMask CallManager::getAvailableCalls() const - { - int res = CALL_FLAG_NONE; - - if (m_incomingCall) - res |= CALL_FLAG_INCOMING; - - if (m_activeCall) - res |= CALL_FLAG_ACTIVE; - - if (m_heldCall) - res |= CALL_FLAG_HELD; - - if (m_endCall) - res |= CALL_FLAG_END; - - return res; - } - Result CallManager::dialVoiceCall(const std::string &number) { char buff[impl::TEL_NUMBER_MAX_SIZE] = { 0 }; snprintf(buff, sizeof(buff), "%s", number.c_str()); return convertCMResult( - cm_dial_call(*m_callClient, buff, CM_CALL_TYPE_VOICE, convertCUISimSlot(m_slot))); + cm_dial_call(*m_callClient, buff, CM_CALL_TYPE_VOICE, + convertCUISimSlot(m_slot))); } Result CallManager::endCall(unsigned int callId, CallReleaseType type) @@ -203,10 +172,12 @@ namespace callui { } return convertCMResult( - cm_end_call(*m_callClient, callId, convertCUICallReleaseType(type))); + cm_end_call(*m_callClient, callId, + convertCUICallReleaseType(type))); } - Result CallManager::splitCalls(CallInfoSRef callInfo, const IConferenceCallInfoSCRef &confCallInfo) + Result CallManager::splitCalls(CallInfoSRef callInfo, + const IConferenceCallInfoSCRef &confCallInfo) { if (callInfo->getConferenceMemberCount() <= 1) { LOG_RETURN(RES_FAIL, "Not conference call"); @@ -218,7 +189,8 @@ namespace callui { LOG_RETURN(RES_FAIL, "Not a member of conference call"); } - return endCall((*iter)->getCallId(), CallReleaseType::BY_CALL_HANDLE); + return convertCMResult( + cm_split_call(*m_callClient, (*iter)->getCallId())); } ContactInfoProviderSRef CallManager::getContactInfoProvider() @@ -231,7 +203,8 @@ namespace callui { if (!m_rejectMsgProvider) { m_rejectMsgProvider = RejectMsgProvider::newInstance(); if (!m_rejectMsgProvider) { - LOG_RETURN_VALUE(RES_FAIL, {}, "RejectMsgProvider::newInstance() failed!"); + LOG_RETURN_VALUE(RES_FAIL, {}, + "RejectMsgProvider::newInstance() failed!"); } } @@ -253,14 +226,12 @@ namespace callui { return updateCall(m_endCall, m_heldCall->getInfo()); } else if (m_activeCall && m_confTypeCallReq == CALL_FLAG_ACTIVE) { - m_confTypeCallReq = CALL_FLAG_NONE; m_blockCMEvents = true; return updateCall(m_endCall, m_activeCall->getInfo()); } else if (m_heldCall && m_confTypeCallReq == CALL_FLAG_HELD) { - m_confTypeCallReq = CALL_FLAG_NONE; m_blockCMEvents = true; @@ -284,14 +255,18 @@ namespace callui { return RES_OK; } - FAIL_RETURN(updateCall(m_incomingCall, cmIncom), "updateCall() failed!"); - FAIL_RETURN(updateCall(m_activeCall, cmActive), "updateCall() failed!"); - FAIL_RETURN(updateCall(m_heldCall, cmHeld), "updateCall() failed!"); + FAIL_RETURN(updateCall(m_incomingCall, cmIncom), + "updateCall() failed!"); + FAIL_RETURN(updateCall(m_activeCall, cmActive), + "updateCall() failed!"); + FAIL_RETURN(updateCall(m_heldCall, cmHeld), + "updateCall() failed!"); return RES_OK; } - void CallManager::callEventCb(cm_call_event_e callEvent, cm_call_event_data_h callEventData) + void CallManager::callEventCb(cm_call_event_e callEvent, + cm_call_event_data_h callEventData) { m_waitDialing = false; @@ -411,14 +386,19 @@ namespace callui { Result CallManager::processOutgoingCall(const std::string &telNum) { - if (!m_waitDialing) { - m_waitDialing = true; - return dialVoiceCall(telNum); + if (m_waitDialing) { + WLOG("Wait dialing state. " + "Ignore attempt on making outgoing call on %s", + telNum.c_str()); + + return RES_OK; } - return RES_FAIL; + + m_waitDialing = true; + return dialVoiceCall(telNum); } - Result CallManager::processIncomingCall(SimSlot slot) + Result CallManager::processIncomingCall() { if (m_incomingCall) { if (m_slot == SimSlot::UNDEFINED) { @@ -434,4 +414,59 @@ namespace callui { return RES_FAIL; } + // Non-member functions // + + CallMode getCallMode(const ICallManagerSRef &cm) + { + if (!cm) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, + CallMode::UNDEFINED, "cm is NULL"); + } + + auto incom = cm->getIncomingCall(); + auto active = cm->getActiveCall(); + auto held = cm->getHeldCall(); + auto end = cm->getEndCall(); + + if (incom) { + return CallMode::INCOMING; + } else if (active && active->isDialingMode()) { + return CallMode::OUTGOING; + } else if (active || held) { + return CallMode::DURING; + } else if (end) { + return CallMode::END; + } + return CallMode::UNDEFINED; + } + + CallMask getAvailableCalls(const ICallManagerSRef &cm) + { + if (!cm) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, + CALL_FLAG_NONE, "cm is NULL"); + } + + auto incom = cm->getIncomingCall(); + auto active = cm->getActiveCall(); + auto held = cm->getHeldCall(); + auto end = cm->getEndCall(); + + int res = CALL_FLAG_NONE; + + if (incom) + res |= CALL_FLAG_INCOMING; + + if (active) + res |= CALL_FLAG_ACTIVE; + + if (held) + res |= CALL_FLAG_HELD; + + if (end) + res |= CALL_FLAG_END; + + return res; + } + } diff --git a/call-ui/model/impl/CallManager.h b/call-ui/model/impl/CallManager.h new file mode 100644 index 0000000..6d26700 --- /dev/null +++ b/call-ui/model/impl/CallManager.h @@ -0,0 +1,185 @@ +/* + * 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_MODEL_IMPL_CALL_MANAGER_H__ +#define __CALL_UI_MODEL_IMPL_CALL_MANAGER_H__ + +#include <call-manager-ext.h> + +#include "call-ui/model/ICallManager.h" + +#include "ICallManagerListener.h" +#include "CallClient.h" +#include "RejectMsgProvider.h" +#include "IncomingCall.h" +#include "ActiveCall.h" +#include "HeldCall.h" +#include "EndCall.h" + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(CallManager); + + /** + * @brief Represents implementation of ICallManager interface + * @see ICallManager + */ + class CallManager final : + public ucl::RefCountAware, + public ICallManager { + public: + + /** + * @brief Creates new instance of CallManager + * @param[in] callClient Call client + * @param[in] listener Call Manager listener + * @return Shared reference to CallManager instance on success + * or NULL otherwise + */ + static CallManagerSRef newInstance(CallClientSRef callClient, + ICallManagerListenerWRef listener); + + /** + * @brief Gets call client + * @return Reference on CallManager instance + */ + CallClient &getCallClient(); + + /** + * @brief Gets active call Sim slot + * @return Sim slot + */ + SimSlot getSimSlot() const; + + /** + * @brief Dials provided number for a voice call + * @param[in] number Telephone number to dial + * @return RES_OK on success or another result otherwise + */ + ucl::Result dialVoiceCall(const std::string &number); + + /** + * @brief Ends call + * @param[in] callId Call ID to end + * @param[in] type Call release type + * @return RES_OK on success or another result otherwise + */ + ucl::Result endCall(unsigned int callId, CallReleaseType type); + + /** + * @brief Splits selected conference call + * @param[in] callInfo Call info of a conference call + * @param[in] confCallInfo Call info of a call that must be split + * @return RES_OK on success or another result otherwise + */ + ucl::Result splitCalls(CallInfoSRef callInfo, + const IConferenceCallInfoSCRef &confCallInfo); + + /** + * @brief Gets contact info provider + * @return Shared reference to ContactInfoProvider instance + */ + ContactInfoProviderSRef getContactInfoProvider(); + + /** + * @brief Gets reject message provider + * @return Shared reference to RejectMsgProvider instance + */ + RejectMsgProviderSRef getRejectMsgProvider(); + + /** + * @brief Processes outgoing call request + * @param[in] telNum Telephone number for outgoing call + * @return RES_OK on success or another result otherwise + */ + ucl::Result processOutgoingCall(const std::string &telNum); + + /** + * @brief Processes incoming call request + * @return RES_OK on success or another result otherwise + */ + ucl::Result processIncomingCall(); + + // ICallManager // + + /* + * @see ICallManager::getIncomingCall() + */ + virtual IIncomingCallSRef getIncomingCall() override final; + + /* + * @see ICallManager::getActiveCall() + */ + virtual IActiveCallSRef getActiveCall() override final; + + /* + * @see ICallManager::getHeldCall() + */ + virtual IHeldCallSRef getHeldCall() override final; + + /* + * @see ICallManager::getEndCall() + */ + virtual IEndCallSRef getEndCall() override final; + + private: + CallManager(ucl::IRefCountObj &rc, CallClientSRef callClient, + ICallManagerListenerWRef listener); + ~CallManager() = default; + + ucl::Result prepare(); + ucl::Result initCalls(); + + template <class TYPE, class TYPE2> + ucl::Result updateCall(ucl::SharedRef<TYPE> &call, TYPE2 &&data); + + ucl::Result processEndCallEvent(unsigned int callId, + cm_call_data_h cmIncom, + cm_call_data_h cmActive, + cm_call_data_h cmHeld); + + ucl::Result processCommonCallEvent(unsigned int callId, + cm_call_data_h cmIncom, + cm_call_data_h cmActive, + cm_call_data_h cmHeld); + + void callEventCb(cm_call_event_e call_event, cm_call_event_data_h call_state_data); + void dialStatusCb(cm_dial_status_e status); + + private: + const CallClientSRef m_callClient; + const ICallManagerListenerWRef m_listener; + + RejectMsgProviderSRef m_rejectMsgProvider; + ContactInfoProviderSRef m_contactInfoProvider; + IncomingCallSRef m_incomingCall; + ActiveCallSRef m_activeCall; + HeldCallSRef m_heldCall; + EndCallSRef m_endCall; + SimSlot m_slot; + bool m_waitDialing; + + int m_confTypeCallReq; + bool m_blockCMEvents; + + friend class ucl::ReffedObj<CallManager>; + }; + +} + +#endif // __CALL_UI_MODEL_IMPL_CALL_MANAGER_H__ diff --git a/src/model/CallUI.cpp b/call-ui/model/impl/CallUI.cpp index 11eb494..45936a3 100644 --- a/src/model/CallUI.cpp +++ b/call-ui/model/impl/CallUI.cpp @@ -18,29 +18,20 @@ #include <app_control.h> -#include "model/ICallListener.h" -#include "model/IIncomingCall.h" -#include "model/IActiveCall.h" -#include "model/IHeldCall.h" -#include "model/IEndCall.h" -#include "model/ICallInfo.h" - #include "CallClient.h" #include "CallManager.h" #include "SoundManager.h" -#include "VoiceControlStateProvider.h" #include "IndicatorStateProvider.h" -#include "ConnectionStateSource.h" -#include "RssiStateSource.h" -#include "BatteryStateSource.h" -#include "VoiceControlStateSource.h" -#include "SimSlotStateSource.h" -#include "HdVoiceStateSource.h" - #include "common.h" +namespace callui { namespace { namespace impl { + + const std::string URI_PREFIX_TEL {"tel:"}; + const std::string URI_INCOMING_CALL {"MT"}; +}}} + namespace callui { using namespace ucl; @@ -50,10 +41,6 @@ namespace callui { { } - CallUI::~CallUI() - { - } - void CallUI::setListener(const ICallListenerWRef &listener) { m_listener = listener; @@ -65,68 +52,34 @@ namespace callui { FAIL_RETURN(RES_INVALID_ARGUMENTS, "appControl is NULL"); } - Result ret = RES_FAIL; - - char *operation = nullptr; - int res = app_control_get_operation(appControl, &operation); - if (res != APP_CONTROL_ERROR_NONE) { - LOG_RETURN(RES_FAIL, "app_control_get_operation() failed!"); - } - if (!operation) { - LOG_RETURN(RES_FAIL, "operation is NULL!"); + std::string operation; + FAIL_RETURN(util::getNz(app_control_get_operation, + operation, appControl), + "app_control_get_uri() failed!"); + if (operation != APP_CONTROL_OPERATION_CALL) { + LOG_RETURN(RES_FAIL, "Wrong operation [%s]!", operation.c_str()); } - char *uri = nullptr; - res = app_control_get_uri(appControl, &uri); - if (res != APP_CONTROL_ERROR_NONE) { - free(operation); - LOG_RETURN(RES_FAIL, "app_control_get_uri() failed!"); - } - if (!uri) { - free(operation); - LOG_RETURN(RES_FAIL, "uri is NULL!"); + std::string uri; + FAIL_RETURN(util::getNz(app_control_get_uri, + uri, appControl), + "app_control_get_uri() failed!"); + if (!util::beginsWith(uri, impl::URI_PREFIX_TEL, false)) { + LOG_RETURN(RES_FAIL, "Wrong uri [%s]!", operation.c_str()); } - if (strcmp(operation, APP_CONTROL_OPERATION_CALL) || strncmp(uri, "tel:", 4)) { - free(operation); - free(uri); - LOG_RETURN(RES_FAIL, "Not processed operation!"); + util::removePrefix(uri, impl::URI_PREFIX_TEL, false); + if (uri.empty()) { + LOG_RETURN(RES_FAIL, "Uri data is empty!"); } - char *tmp = nullptr; - if (!strncmp(uri, "tel:MT", 6)) { - res = app_control_get_extra_data(appControl, "sim_slot", &tmp); - if (res != APP_CONTROL_ERROR_NONE) { - ELOG("app_control_get_extra_data() failed!"); - } - if (!tmp) { - free(operation); - free(uri); - LOG_RETURN(RES_FAIL, "Sim slot is NULL!"); - } - DLOG("Sim slot [%s]", tmp); - free(tmp); - - ret = m_callManager->processIncomingCall( - convertCMSimSlot(static_cast<cm_multi_sim_slot_type_e>(atoi(tmp)))); - - } else { - tmp = static_cast<char *>(uri + 4); - DLOG("number [%s]", tmp); - - if (!tmp) { - free(operation); - free(uri); - LOG_RETURN(RES_FAIL, "number is NULL"); - } - - ret = m_callManager->processOutgoingCall(tmp); + if (uri == impl::URI_INCOMING_CALL) { + DLOG("Start process Incoming call request"); + return m_callManager->processIncomingCall(); } - free(operation); - free(uri); - - return ret; + DLOG("Start process Outgoing call [%s] request", uri.c_str()); + return m_callManager->processOutgoingCall(uri); } Result CallUI::prepare() @@ -149,12 +102,6 @@ namespace callui { "SoundManage::newInstance() failed!"); } - m_voiceControlPrv = VoiceControlStateProvider::newInstance(); - if (!m_voiceControlPrv) { - LOG_RETURN(RES_FAIL, - "VoiceControlStateProvider::newInstance() failed!"); - } - FAIL_RETURN(initInidcatorStateProvider(), "Init Indicator State Provider failed!"); @@ -195,24 +142,13 @@ namespace callui { IndicatorProperty::BATTERY, batteryStSrc), "setStateSource() failed!"); - auto voiceControlStSrc = - VoiceControlStateSource::newInstance(m_voiceControlPrv); - if (!voiceControlStSrc) { - LOG_RETURN(RES_FAIL, - "VoiceControlStateSource::newInstance() failed!"); - } - FAIL_RETURN(m_indicatorStPrv->setStateSource( - IndicatorProperty::VOICE_CONTROL, voiceControlStSrc), - "setStateSource() failed!"); - - m_simSlotStSrc = makeShared<SimSlotStateSource>( + m_simSlotStSrc = SimSlotStateSource::newInstance( m_callManager->getSimSlot(), getForwardedCallStatus()); FAIL_RETURN(m_indicatorStPrv->setStateSource( IndicatorProperty::SIM_SLOT, m_simSlotStSrc), "setStateSource() failed!"); - m_hdCallStSrc = makeShared<HdVoiceStateSource>( - getHDVoiceStatus()); + m_hdCallStSrc = HdVoiceStateSource::newInstance(getHDVoiceStatus()); FAIL_RETURN(m_indicatorStPrv->setStateSource( IndicatorProperty::HD_VOICE, m_hdCallStSrc), "setStateSource() failed!"); @@ -237,8 +173,8 @@ namespace callui { ICallInfoSCRef CallUI::getCurrentCallInfo() const { - CallMask calls = m_callManager->getAvailableCalls(); - if (!calls) { + CallMask calls = getAvailableCalls(m_callManager); + if (calls == CALL_FLAG_NONE) { DLOG("No available calls"); return {}; } else if (calls & CALL_FLAG_INCOMING) { @@ -273,12 +209,12 @@ namespace callui { void CallUI::updateHdVoiceStateSource() { - m_hdCallStSrc->updateState(getHDVoiceStatus()); + m_hdCallStSrc->setState(getHDVoiceStatus()); } void CallUI::updateSimSlotStateSource() { - m_simSlotStSrc->updateSimSlot(m_callManager->getSimSlot(), + m_simSlotStSrc->setSimSlot(m_callManager->getSimSlot(), getForwardedCallStatus()); } diff --git a/src/model/CallUI.h b/call-ui/model/impl/CallUI.h index 1be1aa3..aaa8f39 100644 --- a/src/model/CallUI.h +++ b/call-ui/model/impl/CallUI.h @@ -14,44 +14,79 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_CALL_UI_H__ -#define __CALLUI_MODEL_CALL_UI_H__ +#ifndef __CALL_UI_MODEL_IMPL_CALL_UI_H__ +#define __CALL_UI_MODEL_IMPL_CALL_UI_H__ -#include "model/ICallUI.h" +#include "call-ui/model/ICallUI.h" +#include "CallManager.h" #include "ICallManagerListener.h" +#include "SoundManager.h" +#include "ConnectionStateSource.h" +#include "RssiStateSource.h" +#include "BatteryStateSource.h" +#include "SimSlotStateSource.h" +#include "HdVoiceStateSource.h" +#include "IndicatorStateProvider.h" -#include "types.h" +#include "call-ui/model/types.h" namespace callui { - UCL_DECLARE_REF_ALIASES(CallManager); - UCL_DECLARE_REF_ALIASES(SoundManager); + UCL_DECLARE_REF_ALIASES(CallUI); + /** + * @brief Represents implementation of ICallUI interface + * @see ICallUI + */ class CallUI final : public ucl::RefCountAware, public ICallUI, public ICallManagerListener { public: - virtual ~CallUI(); - // ICallUI + // ICallUI // + /** + * @see ICallUI::setListener() + */ virtual void setListener(const ICallListenerWRef &listener) override final; + + /** + * @see ICallUI::processAppControl() + */ virtual ucl::Result processAppControl(app_control_h appControl) override final; + + /** + * @see ICallUI::getSoundManager() + */ virtual ISoundManagerSRef getSoundManager() override final; + + /** + * @see ICallUI::getCallManager() + */ virtual ICallManagerSRef getCallManager() override final; + + /** + * @see ICallUI::getIndicatorStateProvider() + */ virtual IIndicatorStateProviderSRef getIndicatorStateProvider() override final; - // ICallManagerListener + // ICallManagerListener // + /** + * @see ICallManagerListener::onCallEvent() + */ virtual void onCallEvent(CallEventType type) override final; + + /** + * @see ICallManagerListener::onError() + */ virtual void onError(CallManagerErr err) override final; private: - friend class CallUIBuilder; - friend class ucl::ReffedObj<CallUI>; CallUI(ucl::IRefCountObj &rc); + ~CallUI() = default; ucl::Result prepare(); @@ -70,9 +105,11 @@ namespace callui { SimSlotStateSourceSRef m_simSlotStSrc; HdVoiceStateSourceSRef m_hdCallStSrc; IndicatorStateProviderSRef m_indicatorStPrv; - VoiceControlStateProviderSRef m_voiceControlPrv; + + friend class CallUIBuilder; + friend class ucl::ReffedObj<CallUI>; }; } -#endif // __CALLUI_MODEL_CALL_UI_H__ +#endif // __CALL_UI_MODEL_IMPL_CALL_UI_H__ diff --git a/src/model/ConferenceCallInfo.cpp b/call-ui/model/impl/ConferenceCallInfo.cpp index fcc88ef..2d0bb1a 100644 --- a/src/model/ConferenceCallInfo.cpp +++ b/call-ui/model/impl/ConferenceCallInfo.cpp @@ -16,11 +16,6 @@ #include "ConferenceCallInfo.h" -#include <call-manager-ext.h> - -#include "ContactInfoProvider.h" -#include "ContactInfo.h" - #include "common.h" namespace callui { @@ -32,26 +27,23 @@ namespace callui { { } - ConferenceCallInfo::~ConferenceCallInfo() - { - } - ConferenceCallInfoSRef ConferenceCallInfo::newInstance( cm_conf_call_data_t *confCallData, - ContactInfoProviderSRef callInfoProvider) + const ContactInfoProviderSRef &contactInfoProvider) { if (!confCallData) { - LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "callData is NULL"); } auto result = makeShared<ConferenceCallInfo>(); - FAIL_RETURN_VALUE(result->prepare(confCallData, callInfoProvider), {}, "result->prepare() failed!"); + FAIL_RETURN_VALUE(result->prepare(confCallData, contactInfoProvider), + {}, "result->prepare() failed!"); return result; } Result ConferenceCallInfo::prepare( cm_conf_call_data_t *confCallData, - ContactInfoProviderSRef callInfoProvider) + const ContactInfoProviderSRef &contactInfoProvider) { Result res = convertCMResult( cm_conf_call_data_get_call_id(confCallData, &m_callId)); @@ -70,10 +62,11 @@ namespace callui { cm_conf_call_data_get_person_id(confCallData, &personId)); FAIL_RETURN(res, "cm_conf_call_data_get_person_id() failed!"); - if (personId >= 0 && callInfoProvider) { - m_contactInfo = callInfoProvider->createContactInfo(personId); + if (personId >= 0 && contactInfoProvider) { + m_contactInfo = contactInfoProvider->createContactInfo(personId); if (!m_contactInfo) { - LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "createContactInfo() failed!"); + LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, + "createContactInfo() failed!"); } } return RES_OK; diff --git a/src/model/ConferenceCallInfo.h b/call-ui/model/impl/ConferenceCallInfo.h index 8404602..d3b23ca 100644 --- a/src/model/ConferenceCallInfo.h +++ b/call-ui/model/impl/ConferenceCallInfo.h @@ -14,42 +14,70 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_CONFERENCE_CALL_INFO_H__ -#define __CALLUI_MODEL_CONFERENCE_CALL_INFO_H__ +#ifndef __CALL_UI_MODEL_IMPL_CONFERENCE_CALL_INFO_H__ +#define __CALL_UI_MODEL_IMPL_CONFERENCE_CALL_INFO_H__ #include <call-manager-ext.h> -#include "model/IConferenceCallInfo.h" +#include "call-ui/model/IConferenceCallInfo.h" -#include "implTypes.h" +#include "ContactInfoProvider.h" + +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(ConferenceCallInfo); + + /** + * @brief Represents implementation of IConferenceCallInfo interface + * @see IConferenceCallInfo + */ class ConferenceCallInfo final : public IConferenceCallInfo { public: + + /** + * @brief Creates new instance of ConferenceCallInfo + * @param[in] confCallData Native Call Manager conference call handler + * @param[in] contactInfoProvider Contact info provider + * @return Shared reference to ConferenceCallInfo instance on success + * or NULL otherwise + */ static ConferenceCallInfoSRef newInstance( cm_conf_call_data_t *confCallData, - ContactInfoProviderSRef callInfoProvider); - virtual ~ConferenceCallInfo(); + const ContactInfoProviderSRef &contactInfoProvider); - // IConferenceCallInfo + // IConferenceCallInfo // + /** + * @see IConferenceCallInfo::getCallId() + */ virtual unsigned int getCallId() const override final; + + /** + * @see IConferenceCallInfo::getPhoneNumber() + */ virtual const std::string &getPhoneNumber() const override final; + + /** + * @see IConferenceCallInfo::getContactInfo() + */ virtual IContactInfoSCRef getContactInfo() const override final; private: - friend class ucl::ReffedObj<ConferenceCallInfo>; ConferenceCallInfo(); + ~ConferenceCallInfo() = default; ucl::Result prepare(cm_conf_call_data_t *confCallData, - ContactInfoProviderSRef callInfoProvider); + const ContactInfoProviderSRef &contactInfoProvider); private: unsigned int m_callId; std::string m_phoneNum; ContactInfoSRef m_contactInfo; + + friend class ucl::ReffedObj<ConferenceCallInfo>; }; } -#endif // __CALLUI_MODEL_CONFERENCE_CALL_INFO_H__ +#endif // __CALL_UI_MODEL_IMPL_CONFERENCE_CALL_INFO_H__ diff --git a/src/model/ConnectionStateSource.cpp b/call-ui/model/impl/ConnectionStateSource.cpp index d2399e5..0fbdbf1 100644 --- a/src/model/ConnectionStateSource.cpp +++ b/call-ui/model/impl/ConnectionStateSource.cpp @@ -16,7 +16,7 @@ #include "ConnectionStateSource.h" -#include "model/IndicatorState.h" +#include "call-ui/model/IndicatorState.h" #include "common.h" @@ -70,7 +70,7 @@ namespace callui { { int state = VCONFKEY_WIFI_UNCONNECTED; if (vconf_get_int(VCONFKEY_WIFI_STATE, &state) < 0) { - ELOG("Get WiFi connection state failed"); + ELOG("Get WiFi connection state failed!"); return false; } return (state == VCONFKEY_WIFI_CONNECTED); @@ -187,7 +187,9 @@ namespace callui { } if (needNotify && m_handler) { - m_handler(); + if (const auto handler = m_handler.lock()) { + handler(); + } } } @@ -206,7 +208,7 @@ namespace callui { return PacketDirection::NO_INPUT; } } - ELOG("Get WiFi transfer state failed"); + ELOG("Get WiFi transfer state failed!"); return PacketDirection::NONE; } @@ -221,7 +223,7 @@ namespace callui { default: return PacketDirection::NO_INPUT; } } - ELOG("Get packet state failed"); + ELOG("Get packet state failed!"); return PacketDirection::NONE; } @@ -244,74 +246,98 @@ namespace callui { void ConnectionStateSource::onPacketStateChangedCb(keynode_t *node) { ILOG(); - if (updatePacketDir() && m_handler) { - m_handler(); + if (updatePacketDir()) { + if (const auto handler = m_handler.lock()) { + handler(); + } } } Result ConnectionStateSource::addSysStateCallbacks() { // CONNECTION - int res = vconf_notify_key_changed(VCONFKEY_WIFI_STRENGTH, - CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), this); + int res = vconf_notify_key_changed( + VCONFKEY_WIFI_STRENGTH, + CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), + this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } - res = vconf_notify_key_changed(VCONFKEY_WIFI_STATE, - CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), this); + res = vconf_notify_key_changed( + VCONFKEY_WIFI_STATE, + CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), + this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } - res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, - CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), this); + res = vconf_notify_key_changed( + VCONFKEY_TELEPHONY_FLIGHT_MODE, + CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), + this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } - res = vconf_notify_key_changed(VCONFKEY_DNET_STATE, - CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), this); + res = vconf_notify_key_changed( + VCONFKEY_DNET_STATE, + CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), + this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } - res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_PSTYPE, - CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), this); + res = vconf_notify_key_changed( + VCONFKEY_TELEPHONY_PSTYPE, + CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), + this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } - res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_SVCTYPE, - CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), this); + res = vconf_notify_key_changed( + VCONFKEY_TELEPHONY_SVCTYPE, + CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), + this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } - res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_SIM_SLOT, - CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), this); + res = vconf_notify_key_changed( + VCONFKEY_TELEPHONY_SIM_SLOT, + CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), + this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } - res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_EMERGENCY_CB_MODE_CDMA, - CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), this); + res = vconf_notify_key_changed( + VCONFKEY_TELEPHONY_EMERGENCY_CB_MODE_CDMA, + CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb), + this); + if (res != 0) { + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); + } // PACKET - res = vconf_notify_key_changed(VCONFKEY_PACKET_STATE, - CALLBACK_B(ConnectionStateSource::onPacketStateChangedCb), this); + res = vconf_notify_key_changed( + VCONFKEY_PACKET_STATE, + CALLBACK_B(ConnectionStateSource::onPacketStateChangedCb), + this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } - res = vconf_notify_key_changed(VCONFKEY_WIFI_TRANSFER_STATE, - CALLBACK_B(ConnectionStateSource::onPacketStateChangedCb), this); + res = vconf_notify_key_changed( + VCONFKEY_WIFI_TRANSFER_STATE, + CALLBACK_B(ConnectionStateSource::onPacketStateChangedCb), + this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } return RES_OK; - } void ConnectionStateSource::unsignSystStateCallbacks() @@ -339,7 +365,6 @@ namespace callui { CALLBACK_B(ConnectionStateSource::onPacketStateChangedCb)); vconf_ignore_key_changed(VCONFKEY_WIFI_TRANSFER_STATE, CALLBACK_B(ConnectionStateSource::onPacketStateChangedCb)); - } IndicatorState ConnectionStateSource::getState() const @@ -347,9 +372,9 @@ namespace callui { return {m_bits.value}; } - void ConnectionStateSource::setStateChangeHandler(const NotiHandler &handler) + void ConnectionStateSource::setStateChangeHandler(NotiHandler handler) { - m_handler = handler; + m_handler = std::move(handler); } ConnectionType getConnectionState(IndicatorState state) diff --git a/src/model/ConnectionStateSource.h b/call-ui/model/impl/ConnectionStateSource.h index 041e397..795a57e 100644 --- a/src/model/ConnectionStateSource.h +++ b/call-ui/model/impl/ConnectionStateSource.h @@ -14,30 +14,48 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_CONNECTION_STATE_SOURCE_H__ -#define __CALLUI_MODEL_CONNECTION_STATE_SOURCE_H__ +#ifndef __CALL_UI_MODEL_IMPL_CONNECTION_STATE_SOURCE_H__ +#define __CALL_UI_MODEL_IMPL_CONNECTION_STATE_SOURCE_H__ #include "IIndicatorStateSource.h" #include <vconf.h> -#include "implTypes.h" +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(ConnectionStateSource); + + /** + * @brief Represents Connection state source for IndicatorStateProvider + * @see IIndicatorStateSource + */ class ConnectionStateSource final : public IIndicatorStateSource { public: + + /** + * @brief Creates new instance of ConnectionStateSource + * @return Shared reference to ConnectionStateSource instance on success + * or NULL otherwise + */ static ConnectionStateSourceSRef newInstance(); - virtual ~ConnectionStateSource(); - // IIndicatorStateSource + // IIndicatorStateSource // + /** + * @see IIndicatorStateSource::getState() + */ virtual IndicatorState getState() const override final; - virtual void setStateChangeHandler(const NotiHandler &handler) override final; + + /** + * @see IIndicatorStateSource::setStateChangeHandler() + */ + virtual void setStateChangeHandler(NotiHandler handler) override final; private: - friend class ucl::ReffedObj<ConnectionStateSource>; ConnectionStateSource(); + ~ConnectionStateSource(); ucl::Result prepare(); @@ -77,8 +95,10 @@ namespace callui { private: Bits m_bits; NotiHandler m_handler; + + friend class ucl::ReffedObj<ConnectionStateSource>; }; } -#endif // __CALLUI_MODEL_CONNECTION_STATE_SOURCE_H__ +#endif // __CALL_UI_MODEL_IMPL_CONNECTION_STATE_SOURCE_H__ diff --git a/src/model/ContactInfo.cpp b/call-ui/model/impl/ContactInfo.cpp index 2724f57..d50fbde 100644 --- a/src/model/ContactInfo.cpp +++ b/call-ui/model/impl/ContactInfo.cpp @@ -14,10 +14,10 @@ * limitations under the License. */ -#include <call-manager-extension.h> - #include "ContactInfo.h" +#include <call-manager-extension.h> + #include "common.h" namespace callui { @@ -25,34 +25,33 @@ namespace callui { using namespace ucl; ContactInfo::ContactInfo(int personId, - const std::string &name, - const std::string &imagePath, + std::string name, + std::string imagePath, ContactNameSourceType type): - m_personId(personId), - m_name(name), - m_imagePath(imagePath), - m_nameSource(type) - { - } - - ContactInfo::~ContactInfo() + m_personId(personId), + m_name(std::move(name)), + m_imagePath(std::move(imagePath)), + m_nameSource(type) { } ContactInfoSRef ContactInfo::newInstance(int personId, - const std::string &name, - const std::string &imagePath, + std::string name, + std::string imagePath, ContactNameSourceType type) { - return makeShared<ContactInfo>(personId, name, imagePath, type); + return makeShared<ContactInfo>(personId, + std::move(name), + std::move(imagePath), + type); } - const std::string &ContactInfo::getName() const + std::string ContactInfo::getName() const { return m_name; } - const std::string &ContactInfo::getImagePath() const + std::string ContactInfo::getImagePath() const { return m_imagePath; } diff --git a/call-ui/model/impl/ContactInfo.h b/call-ui/model/impl/ContactInfo.h new file mode 100644 index 0000000..420cafd --- /dev/null +++ b/call-ui/model/impl/ContactInfo.h @@ -0,0 +1,86 @@ +/* + * 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_MODEL_IMPL_CONTACT_INFO_H__ +#define __CALL_UI_MODEL_IMPL_CONTACT_INFO_H__ + +#include <contacts_types.h> + +#include "call-ui/model/IContactInfo.h" + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(ContactInfo); + + /** + * @brief Represents implementation of IContactInfo interface + * @see IContactInfo + */ + class ContactInfo final : public IContactInfo { + public: + + /** + * @brief Creates new instance of ContactInfo + * @param[in] personId Contact database person ID + * @param[in] name Contact name + * @param[in] imagePath Path to contact image + * @param[in] type Contact name source type + * @return Shared reference to ContactInfo instance on success + * or NULL otherwise + */ + static ContactInfoSRef newInstance(int personId, + std::string name, + std::string imagePath, + ContactNameSourceType type); + + // IContactInfo // + + /** + * @see IContactInfo::getName() + */ + virtual std::string getName() const override final; + + /** + * @see IContactInfo::getImagePath() + */ + virtual std::string getImagePath() const override final; + + /** + * @see IContactInfo::getNameSourceType() + */ + virtual ContactNameSourceType getNameSourceType() const override final; + + private: + ContactInfo(int personId, + std::string name, + std::string imagePath, + ContactNameSourceType type); + ~ContactInfo() = default; + + private: + const int m_personId; + const std::string m_name; + const std::string m_imagePath; + const ContactNameSourceType m_nameSource; + + friend class ucl::ReffedObj<ContactInfo>; + }; + +} + +#endif // __CALL_UI_MODEL_IMPL_CONTACT_INFO_H__ diff --git a/src/model/ContactInfoProvider.cpp b/call-ui/model/impl/ContactInfoProvider.cpp index 3cffba2..3161dbd 100644 --- a/src/model/ContactInfoProvider.cpp +++ b/call-ui/model/impl/ContactInfoProvider.cpp @@ -20,15 +20,14 @@ #include <contacts_service.h> #include <contacts_errors.h> -#include "ContactInfo.h" - #include "common.h" namespace callui { namespace { namespace impl { using namespace ucl; - inline ContactNameSourceType convertContactNameSourceType(contacts_display_name_source_type_e cdbType) + inline ContactNameSourceType convertContactNameSourceType( + contacts_display_name_source_type_e cdbType) { switch (cdbType) { case CONTACTS_DISPLAY_NAME_SOURCE_TYPE_INVALID: return ContactNameSourceType::INVALID; @@ -51,7 +50,6 @@ namespace callui { ContactInfoProvider::ContactInfoProvider(): m_isConnected(false) { - } ContactInfoProvider::~ContactInfoProvider() @@ -86,7 +84,7 @@ namespace callui { std::string contactName; std::string contactImagePath; - ContactNameSourceType contactNameSource; + ContactNameSourceType contactNameSrc = ContactNameSourceType::INVALID; contacts_filter_h filter = nullptr; contacts_list_h list = nullptr; @@ -155,7 +153,7 @@ namespace callui { int type = CONTACTS_DISPLAY_NAME_SOURCE_TYPE_INVALID; contacts_record_get_int(record, _contacts_contact.display_source_type, &type); - contactNameSource = impl::convertContactNameSourceType( + contactNameSrc = impl::convertContactNameSourceType( static_cast<contacts_display_name_source_type_e>(type)); int count = 0; @@ -188,7 +186,7 @@ namespace callui { return ContactInfo::newInstance(contactId, contactName, contactImagePath, - contactNameSource); + contactNameSrc); } } diff --git a/src/model/ContactInfoProvider.h b/call-ui/model/impl/ContactInfoProvider.h index 9add61d..4d3d3c9 100644 --- a/src/model/ContactInfoProvider.h +++ b/call-ui/model/impl/ContactInfoProvider.h @@ -14,29 +14,49 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_CONTACT_INFO_PROVIDER_H__ -#define __CALLUI_MODEL_CONTACT_INFO_PROVIDER_H__ +#ifndef __CALL_UI_MODEL_IMPL_CONTACT_INFO_PROVIDER_H__ +#define __CALL_UI_MODEL_IMPL_CONTACT_INFO_PROVIDER_H__ -#include "implTypes.h" +#include "ContactInfo.h" + +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(ContactInfoProvider); + + /** + * @brief Represents Contact info provider + */ class ContactInfoProvider { public: + + /** + * @brief Creates new instance of ContactInfoProvider + * @return Shared reference to ContactInfoProvider instance on success + * or NULL otherwise + */ static ContactInfoProviderSRef newInstance(); - virtual ~ContactInfoProvider(); + /** + * @brief Creates new instance of ContactInfo + * @param[in] contactId Id of the caller in Contact database + * @return Shared reference to ContactInfo instance on success + * or NULL otherwise + */ ContactInfoSRef createContactInfo(int contactId); private: - friend class ucl::ReffedObj<ContactInfoProvider>; ContactInfoProvider(); + ~ContactInfoProvider(); ucl::Result prepare(); private: bool m_isConnected; + + friend class ucl::ReffedObj<ContactInfoProvider>; }; } -#endif // __CALLUI_MODEL_CONTACT_INFO_PROVIDER_H__ +#endif // __CALL_UI_MODEL_IMPL_CONTACT_INFO_PROVIDER_H__ diff --git a/src/model/EndCall.cpp b/call-ui/model/impl/EndCall.cpp index 1442ccf..261bf90 100644 --- a/src/model/EndCall.cpp +++ b/call-ui/model/impl/EndCall.cpp @@ -16,9 +16,7 @@ #include "EndCall.h" -#include "CallClient.h" #include "CallManager.h" -#include "CallInfo.h" #include "common.h" @@ -27,26 +25,22 @@ namespace callui { using namespace ucl; EndCall::EndCall(CallManagerWRef cm, ICallInfoSCRef callInfo): - m_cm(cm), - m_callInfo(callInfo), + m_cm(std::move(cm)), + m_callInfo(std::move(callInfo)), m_callbackInProgress(false) { } - EndCall::~EndCall() - { - } - EndCallSRef EndCall::newInstance(CallManagerWRef cm, ICallInfoSCRef callInfo) { if (!cm) { - LOG_RETURN_VALUE(RES_FAIL, {}, "cm is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "cm is NULL"); } if (!callInfo) { - LOG_RETURN_VALUE(RES_FAIL, {}, "callInfo is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "callInfo is NULL"); } - return makeShared<EndCall>(cm, callInfo); + return makeShared<EndCall>(std::move(cm), std::move(callInfo)); } ICallInfoSCRef EndCall::getInfo() const @@ -72,9 +66,4 @@ namespace callui { return res; } - Result EndCall::writeMessage() - { - UCL_ASSERT(0, "!!! NOT IMPLEMENTED !!!"); - } - } diff --git a/src/model/EndCall.h b/call-ui/model/impl/EndCall.h index 190d056..748e0c4 100644 --- a/src/model/EndCall.h +++ b/call-ui/model/impl/EndCall.h @@ -14,43 +14,64 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_END_CALL_H__ -#define __CALLUI_MODEL_END_CALL_H__ +#ifndef __CALL_UI_MODEL_IMPL_END_CALL_H__ +#define __CALL_UI_MODEL_IMPL_END_CALL_H__ #include <call-manager-ext.h> -#include "model/IEndCall.h" +#include "call-ui/model/IEndCall.h" -#include "implTypes.h" +#include "types.h" namespace callui { - class CallManager; + UCL_DECLARE_REF_ALIASES(CallManager); + UCL_DECLARE_REF_ALIASES(EndCall); + + /** + * @brief Implementation of IEndCall interface + * @see IEndCall + */ class EndCall final : public IEndCall { public: - static EndCallSRef newInstance(CallManagerWRef cm, ICallInfoSCRef callInfo); - virtual ~EndCall(); + /** + * @brief Creates new instance of EndCall + * @param[in] cm Weak reference to CallManager + * @param[in] callInfo Call info of the last ended call + * @return Shared reference to EndCall on success + * or NULL otherwise + */ + static EndCallSRef newInstance(CallManagerWRef cm, ICallInfoSCRef callInfo); - // IEndCall + // IEndCall // + /** + * @see IEndCall::getInfo() + */ virtual ICallInfoSCRef getInfo() const override final; + + /** + * @see IEndCall::callBack() + */ virtual ucl::Result callBack() override final; - virtual ucl::Result writeMessage() override final; private: - friend class ucl::ReffedObj<EndCall>; EndCall(CallManagerWRef cm, ICallInfoSCRef callInfo); + ~EndCall() = default; ucl::Result prepare(); private: - CallManagerWRef m_cm; - ICallInfoSCRef m_callInfo; + const CallManagerWRef m_cm; + const ICallInfoSCRef m_callInfo; + bool m_callbackInProgress; + + friend class ucl::ReffedObj<EndCall>; }; } -#endif // __CALLUI_MODEL_END_CALL_H__ +#endif // __CALL_UI_MODEL_IMPL_END_CALL_H__ diff --git a/src/model/HdVoiceStateSource.cpp b/call-ui/model/impl/HdVoiceStateSource.cpp index 90df282..fb988a6 100644 --- a/src/model/HdVoiceStateSource.cpp +++ b/call-ui/model/impl/HdVoiceStateSource.cpp @@ -42,29 +42,30 @@ namespace callui { m_bits.isEnable = isEnable; } - HdVoiceStateSource::~HdVoiceStateSource() - { - } - - void HdVoiceStateSource::updateState(bool isEnable) + void HdVoiceStateSource::setState(bool isEnable) { if (m_bits.isEnable != isEnable) { m_bits.isEnable = isEnable; - if (m_handler) { - m_handler(); + if (const auto handler = m_handler.lock()) { + handler(); } } } + HdVoiceStateSourceSRef HdVoiceStateSource::newInstance(bool isEnable) + { + return makeShared<HdVoiceStateSource>(isEnable); + } + IndicatorState HdVoiceStateSource::getState() const { return {m_bits.value}; } - void HdVoiceStateSource::setStateChangeHandler(const NotiHandler &handler) + void HdVoiceStateSource::setStateChangeHandler(NotiHandler handler) { - m_handler = handler; + m_handler = std::move(handler); } bool getHDVoiceState(IndicatorState state) diff --git a/src/model/HdVoiceStateSource.h b/call-ui/model/impl/HdVoiceStateSource.h index 7b98b7e..f56dbb1 100644 --- a/src/model/HdVoiceStateSource.h +++ b/call-ui/model/impl/HdVoiceStateSource.h @@ -14,23 +14,51 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_HD_VOICE_STATE_SOURCE_H__ -#define __CALLUI_MODEL_HD_VOICE_STATE_SOURCE_H__ +#ifndef __CALL_UI_MODEL_IMPL_HD_VOICE_STATE_SOURCE_H__ +#define __CALL_UI_MODEL_IMPL_HD_VOICE_STATE_SOURCE_H__ #include "IIndicatorStateSource.h" namespace callui { + UCL_DECLARE_REF_ALIASES(HdVoiceStateSource); + + /** + * @brief Represents HD voice state source for IndicatorStateProvider + * Inherits from IIndicatorStateSource + * @see IIndicatorStateSource + */ class HdVoiceStateSource final : public IIndicatorStateSource { public: - HdVoiceStateSource(bool isEnable); - virtual ~HdVoiceStateSource(); - void updateState(bool isEnable); - // IIndicatorStateSource + /** + * @brief Creates new instance of HdVoiceStateSource + * @return Shared reference to HdVoiceStateSource instance on success + * or NULL otherwise + */ + static HdVoiceStateSourceSRef newInstance(bool isEnable); + + /** + * @brief Sets HD voice state + * @param[in] isEnable State of HD voice + */ + void setState(bool isEnable); + // IIndicatorStateSource // + + /** + * @see IIndicatorStateSource::getState() + */ virtual IndicatorState getState() const override final; - virtual void setStateChangeHandler(const NotiHandler &handler) override final; + + /** + * @see IIndicatorStateSource::setStateChangeHandler() + */ + virtual void setStateChangeHandler(NotiHandler handler) override final; + + private: + HdVoiceStateSource(bool isEnable); + ~HdVoiceStateSource() = default; public: union Bits { @@ -47,8 +75,10 @@ namespace callui { private: Bits m_bits; NotiHandler m_handler; + + friend class ucl::ReffedObj<HdVoiceStateSource>; }; } -#endif // __CALLUI_MODEL_HD_VOICE_STATE_SOURCE_H__ +#endif // __CALL_UI_MODEL_IMPL_HD_VOICE_STATE_SOURCE_H__ diff --git a/src/model/HeldCall.cpp b/call-ui/model/impl/HeldCall.cpp index 1064899..83362eb 100644 --- a/src/model/HeldCall.cpp +++ b/call-ui/model/impl/HeldCall.cpp @@ -16,10 +16,7 @@ #include "HeldCall.h" -#include "CallClient.h" #include "CallManager.h" -#include "CallInfo.h" -#include "CallClient.h" #include "common.h" @@ -28,26 +25,23 @@ namespace callui { using namespace ucl; HeldCall::HeldCall(CallManagerWRef cm, cm_call_data_h callData): - m_cm(cm) - { - } - - HeldCall::~HeldCall() + m_cm(std::move(cm)) { } HeldCallSRef HeldCall::newInstance(CallManagerWRef cm, cm_call_data_h callData) { if (!cm) { - LOG_RETURN_VALUE(RES_FAIL, {}, "cm is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "cm is NULL"); } if (!callData) { - LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "callData is NULL"); } - auto result = makeShared<HeldCall>(cm, callData); - FAIL_RETURN_VALUE(result->prepare(callData), {}, "result->prepare() failed!"); + auto result = makeShared<HeldCall>(std::move(cm), callData); + FAIL_RETURN_VALUE(result->prepare(callData), {}, + "result->prepare() failed!"); return result; } @@ -61,7 +55,8 @@ namespace callui { callData, cm->getContactInfoProvider()); if (!m_callInfo) { - LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!"); + LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, + "CallInfo::newInstance() failed!"); } return RES_OK; } diff --git a/src/model/HeldCall.h b/call-ui/model/impl/HeldCall.h index bbb7866..fa56e1d 100644 --- a/src/model/HeldCall.h +++ b/call-ui/model/impl/HeldCall.h @@ -14,42 +14,86 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_HELD_CALL_H__ -#define __CALLUI_MODEL_HELD_CALL_H__ +#ifndef __CALL_UI_MODEL_IMPL_HELD_CALL_H__ +#define __CALL_UI_MODEL_IMPL_HELD_CALL_H__ #include <call-manager-ext.h> -#include "model/IHeldCall.h" +#include "call-ui/model/IHeldCall.h" +#include "CallInfo.h" -#include "implTypes.h" +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(CallManager); + + UCL_DECLARE_REF_ALIASES(HeldCall); + + /** + * @brief Implementation of IHeldCall interface + * @see IHeldCall + */ class HeldCall final : public IHeldCall { public: - static HeldCallSRef newInstance(CallManagerWRef cm, cm_call_data_h callData); - virtual ~HeldCall(); - // IHeldCall + /** + * @brief Creates new instance of HeldCall + * @param[in] cm Weak reference to CallManager + * @param[in] callData The platform Call Manager Call data handle + * @return Shared reference to HeldCall on success + * or NULL otherwise + */ + static HeldCallSRef newInstance(CallManagerWRef cm, + cm_call_data_h callData); + + // IHeldCall // + /** + * @see IHeldCall::getInfo() + */ virtual ICallInfoSCRef getInfo() const override final; + + /** + * @see IHeldCall::unhold() + */ virtual ucl::Result unhold() override final; + + /** + * @see IHeldCall::joinWithActive() + */ virtual ucl::Result joinWithActive() override final; + + /** + * @see IHeldCall::swapWithActive() + */ virtual ucl::Result swapWithActive() override final; + + /** + * @see IHeldCall::end() + */ virtual ucl::Result end() override final; - virtual ucl::Result split(const IConferenceCallInfoSCRef &confCallInfo) override final; + + /** + * @see IHeldCall::split() + */ + virtual ucl::Result split( + const IConferenceCallInfoSCRef &confCallInfo) override final; private: - friend class ucl::ReffedObj<HeldCall>; HeldCall(CallManagerWRef cm, cm_call_data_h callData); + ~HeldCall() = default; ucl::Result prepare(cm_call_data_h callData); private: - CallManagerWRef m_cm; + const CallManagerWRef m_cm; + CallInfoSRef m_callInfo; + + friend class ucl::ReffedObj<HeldCall>; }; } -#endif // __CALLUI_MODEL_HELD_CALL_H__ +#endif // __CALL_UI_MODEL_IMPL_HELD_CALL_H__ diff --git a/src/model/ICallManagerListener.h b/call-ui/model/impl/ICallManagerListener.h index 5d66a7c..b5ece70 100644 --- a/src/model/ICallManagerListener.h +++ b/call-ui/model/impl/ICallManagerListener.h @@ -14,19 +14,38 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_I_CALL_MANAGER_LISTENER_H__ -#define __CALLUI_MODEL_I_CALL_MANAGER_LISTENER_H__ +#ifndef __CALL_UI_MODEL_IMPL_I_CALL_MANAGER_LISTENER_H__ +#define __CALL_UI_MODEL_IMPL_I_CALL_MANAGER_LISTENER_H__ -#include "implTypes.h" +#include "types.h" namespace callui { - class ICallManagerListener : public ucl::Polymorphic { + UCL_DECLARE_REF_ALIASES(ICallManagerListener); + + /** + * @brief Represents Call Manager listener interface. + * Uses for get notifications from Call Manager about changes + */ + class ICallManagerListener : protected ucl::NonCopyable { public: + + /** + * @brief Called on Call Manager call event + * @param[in] type Call event type + */ virtual void onCallEvent(CallEventType type) = 0; + + /** + * @brief Called on Call Manager error + * @param[in] err Error type + */ virtual void onError(CallManagerErr err) = 0; + + protected: + ~ICallManagerListener() = default; }; } -#endif // __CALLUI_MODEL_I_CALL_MANAGER_LISTENER_H__ +#endif // __CALL_UI_MODEL_IMPL_I_CALL_MANAGER_LISTENER_H__ diff --git a/call-ui/model/impl/IIndicatorStateSource.h b/call-ui/model/impl/IIndicatorStateSource.h new file mode 100644 index 0000000..a73ab27 --- /dev/null +++ b/call-ui/model/impl/IIndicatorStateSource.h @@ -0,0 +1,52 @@ +/* + * 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_MODEL_IMPL_I_STATE_SOURCE_H__ +#define __CALL_UI_MODEL_IMPL_I_STATE_SOURCE_H__ + +#include "types.h" + +#include "call-ui/model/IndicatorState.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(IIndicatorStateSource); + + /** + * @brief Represents Indicator state source interface. + * Provides API to get value and notification about indicator state + */ + class IIndicatorStateSource : protected ucl::NonCopyable { + public: + + /** + * @brief Gets state + * @return Indicator state instance + */ + virtual IndicatorState getState() const = 0; + + /** + * @brief Sets state change handler + * @param[in] handler Handler to set + */ + virtual void setStateChangeHandler(NotiHandler handler) = 0; + + protected: + ~IIndicatorStateSource() = default; + }; +} + +#endif // __CALL_UI_MODEL_IMPL_I_STATE_SOURCE_H__ diff --git a/src/model/IncomingCall.cpp b/call-ui/model/impl/IncomingCall.cpp index c3e784e..332dab7 100644 --- a/src/model/IncomingCall.cpp +++ b/call-ui/model/impl/IncomingCall.cpp @@ -16,11 +16,7 @@ #include "IncomingCall.h" -#include "CallClient.h" #include "CallManager.h" -#include "CallClient.h" -#include "CallInfo.h" -#include "RejectMsgProvider.h" #include "RejectMsg.h" #include "common.h" @@ -30,26 +26,24 @@ namespace callui { using namespace ucl; IncomingCall::IncomingCall(CallManagerWRef cm, cm_call_data_h callData): - m_cm(cm) + m_cm(std::move(cm)) { } - IncomingCall::~IncomingCall() - { - } - - IncomingCallSRef IncomingCall::newInstance(CallManagerWRef cm, cm_call_data_h callData) + IncomingCallSRef IncomingCall::newInstance(CallManagerWRef cm, + cm_call_data_h callData) { if (!cm) { - LOG_RETURN_VALUE(RES_FAIL, {}, "cm is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "cm is NULL"); } if (!callData) { - LOG_RETURN_VALUE(RES_FAIL, {}, "callData is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "callData is NULL"); } - auto result = makeShared<IncomingCall>(cm, callData); - FAIL_RETURN_VALUE(result->prepare(callData), {}, "result->prepare() failed!"); + auto result = makeShared<IncomingCall>(std::move(cm), callData); + FAIL_RETURN_VALUE(result->prepare(callData), {}, + "result->prepare() failed!"); return result; } @@ -63,7 +57,8 @@ namespace callui { callData, cm->getContactInfoProvider()); if (!m_callInfo) { - LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, "CallInfo::newInstance() failed!"); + LOG_RETURN_VALUE(RES_FAIL, RES_FAIL, + "CallInfo::newInstance() failed!"); } return RES_OK; @@ -89,7 +84,8 @@ namespace callui { if (!cm) { LOG_RETURN(RES_FAIL, "Call Manager is NULL"); } - return convertCMResult(cm_answer_call(cm->getCallClient(), convertCUICallAnswerType(type))); + return convertCMResult(cm_answer_call(cm->getCallClient(), + convertCUICallAnswerType(type))); } Result IncomingCall::reject() diff --git a/src/model/IncomingCall.h b/call-ui/model/impl/IncomingCall.h index db7c1b6..9f553df 100644 --- a/src/model/IncomingCall.h +++ b/call-ui/model/impl/IncomingCall.h @@ -14,43 +14,84 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_ICOMING_CALL_H__ -#define __CALLUI_MODEL_ICOMING_CALL_H__ +#ifndef __CALL_UI_MODEL_IMPL_INCOMING_CALL_H__ +#define __CALL_UI_MODEL_IMPL_INCOMING_CALL_H__ #include <call-manager-ext.h> -#include "model/IIncomingCall.h" +#include "call-ui/model/IIncomingCall.h" +#include "CallInfo.h" -#include "implTypes.h" +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(CallManager); + + UCL_DECLARE_REF_ALIASES(IncomingCall); + + /** + * @brief Implementation of IIncomingCall interface + * @see IIncomingCall + */ class IncomingCall final : public IIncomingCall { public: - static IncomingCallSRef newInstance(CallManagerWRef cm, cm_call_data_h callData); - virtual ~IncomingCall(); + /** + * @brief Creates new instance of IncomingCall + * @param[in] cm Weak reference to CallManager + * @param[in] callData The platform Call Manager Call data handle + * @return Shared reference to IncomingCall on success + * or NULL otherwise + */ + static IncomingCallSRef newInstance(CallManagerWRef cm, cm_call_data_h callData); - // IIncomingCall + // IIncomingCall // + /* + * @see IIncomingCall::getInfo() + */ virtual ICallInfoSCRef getInfo() const override final; + + /* + * @see IIncomingCall::getRejectMsgProvider() + */ virtual IRejectMsgProviderSRef getRejectMsgProvider() const override final; + + /* + * @see IIncomingCall::answer() + */ virtual ucl::Result answer(CallAnswerType type) override final; + + /* + * @see IIncomingCall::reject() + */ virtual ucl::Result reject() override final; + + /* + * @see IIncomingCall::rejectWithMessage() + */ virtual ucl::Result rejectWithMessage(IRejectMsgSRef message) override final; + + /* + * @see IIncomingCall::stopAlert() + */ virtual ucl::Result stopAlert() override final; private: - friend class ucl::ReffedObj<IncomingCall>; IncomingCall(CallManagerWRef cm, cm_call_data_h callData); + ~IncomingCall() = default; ucl::Result prepare(cm_call_data_h callData); private: - CallManagerWRef m_cm; + const CallManagerWRef m_cm; + CallInfoSRef m_callInfo; + + friend class ucl::ReffedObj<IncomingCall>; }; } -#endif // __CALLUI_MODEL_ICOMING_CALL_H__ +#endif // __CALL_UI_MODEL_IMPL_INCOMING_CALL_H__ diff --git a/src/model/IndicatorStateProvider.cpp b/call-ui/model/impl/IndicatorStateProvider.cpp index 4ef85e7..1d7b275 100644 --- a/src/model/IndicatorStateProvider.cpp +++ b/call-ui/model/impl/IndicatorStateProvider.cpp @@ -16,16 +16,13 @@ #include "IndicatorStateProvider.h" -#include "model/IIndicatorStateListener.h" -#include "IIndicatorStateSource.h" - #include "common.h" namespace callui { using namespace ucl; - class IndicatorStateProvider::SourceHandler : + class IndicatorStateProvider::SourceHandler final : public RefCountAware { public: SourceHandler(IRefCountObj &rc, @@ -38,8 +35,7 @@ namespace callui { m_source(source) { m_source->setStateChangeHandler( - WEAK_DELEGATE(SourceHandler::onStateChanged, - asWeak(*this))); + WEAK_DELEGATE_THIS(onStateChanged)); } IndicatorState getState() const @@ -65,10 +61,6 @@ namespace callui { { } - IndicatorStateProvider::~IndicatorStateProvider() - { - } - IndicatorStateProviderSRef IndicatorStateProvider::newInstance() { return makeShared<IndicatorStateProvider>(); diff --git a/src/model/IndicatorStateProvider.h b/call-ui/model/impl/IndicatorStateProvider.h index fd091a6..448cf44 100644 --- a/src/model/IndicatorStateProvider.h +++ b/call-ui/model/impl/IndicatorStateProvider.h @@ -14,40 +14,63 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_INDICATOR_STATE_PROVIDER_H__ -#define __CALLUI_MODEL_INDICATOR_STATE_PROVIDER_H__ +#ifndef __CALL_UI_MODEL_IMPL_INDICATOR_STATE_PROVIDER_H__ +#define __CALL_UI_MODEL_IMPL_INDICATOR_STATE_PROVIDER_H__ -#include "model/IIndicatorStateProvider.h" +#include "call-ui/model/IIndicatorStateProvider.h" -#include "implTypes.h" +#include "IIndicatorStateSource.h" + +#include "types.h" namespace callui { - class IIndicatorStateListener; + UCL_DECLARE_REF_ALIASES(IndicatorStateProvider); - class IndicatorStateProvider final: public IIndicatorStateProvider { + /** + * @brief Implementation of IIndicatorStateProvider interface + * @see IIncomingCall + */ + class IndicatorStateProvider final : public IIndicatorStateProvider { public: - static IndicatorStateProviderSRef newInstance(); - virtual ~IndicatorStateProvider(); + /** + * @brief Creates new instance of IndicatorStateProvider + * @return Shared reference to IndicatorStateProvider on success + * or NULL otherwise + */ + static IndicatorStateProviderSRef newInstance(); - virtual ucl::Result setStateSource(IndicatorProperty property, + /** + * @brief Sets state source + * @param[in] property Property type to set + * @param[in] source State source to set in accordance to property type + * @return RES_OK on success or another result otherwise + */ + ucl::Result setStateSource(IndicatorProperty property, IIndicatorStateSourceSRef source); - // IIndicatorStateProvider + // IIndicatorStateProvider // + /** + * @see IIndicatorStateProvider::getState() + */ virtual IndicatorState getState(IndicatorProperty property) const override final; + + /** + * @see IIndicatorStateProvider::setListener() + */ virtual void setListener(IIndicatorStateListenerWRef listener) override final; private: - friend class ucl::ReffedObj<IndicatorStateProvider>; IndicatorStateProvider(); + ~IndicatorStateProvider() = default; void dispatchStateChanged(IndicatorProperty property) const; private: enum { - STATE_COUNT = 6 + STATE_COUNT = 5 }; class SourceHandler; @@ -56,8 +79,10 @@ namespace callui { private: IIndicatorStateListenerWRef m_listener; std::array<SourceHandlerSRef, STATE_COUNT> m_sources; + + friend class ucl::ReffedObj<IndicatorStateProvider>; }; } -#endif // __CALLUI_MODEL_INDICATOR_STATE_PROVIDER_H__ +#endif // __CALL_UI_MODEL_IMPL_INDICATOR_STATE_PROVIDER_H__ diff --git a/src/model/MsgClient.cpp b/call-ui/model/impl/MsgClient.cpp index e0cad27..e0cad27 100644 --- a/src/model/MsgClient.cpp +++ b/call-ui/model/impl/MsgClient.cpp diff --git a/src/model/MsgClient.h b/call-ui/model/impl/MsgClient.h index 1fdd2e0..2ab153c 100644 --- a/src/model/MsgClient.h +++ b/call-ui/model/impl/MsgClient.h @@ -14,32 +14,54 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_MSG_CLIENT_H__ -#define __CALLUI_MODEL_MSG_CLIENT_H__ +#ifndef __CALL_UI_MODEL_IMPL_MSG_CLIENT_H__ +#define __CALL_UI_MODEL_IMPL_MSG_CLIENT_H__ #include <msg_types.h> -#include "implTypes.h" +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(MsgClient); + + /** + * @brief Represents wrapper on platform Message handle + */ class MsgClient { public: + + /** + * @brief Creates new instance of MsgClient + * @return Shared reference to MsgClient instance on success + * or NULL otherwise + */ static MsgClientSRef newInstance(); - virtual ~MsgClient(); + + /** + * @brief Gets platform Message handle + * @return Platform Message handle on success + * or NULL otherwise + */ msg_handle_t getMsgHandle() const; + + /** + * @brief Operator msg_handle_t + */ operator msg_handle_t() const; private: - friend class ucl::ReffedObj<MsgClient>; MsgClient(); + ~MsgClient(); ucl::Result prepare(); private: msg_handle_t m_handle; + + friend class ucl::ReffedObj<MsgClient>; }; } -#endif // __CALLUI_MODEL_MSG_CLIENT_H__ +#endif // __CALL_UI_MODEL_IMPL_MSG_CLIENT_H__ diff --git a/src/model/RejectMsg.cpp b/call-ui/model/impl/RejectMsg.cpp index c1f6d52..301eab1 100644 --- a/src/model/RejectMsg.cpp +++ b/call-ui/model/impl/RejectMsg.cpp @@ -19,27 +19,25 @@ #include <msg.h> #include <msg_transport.h> -#include "MsgClient.h" - #include "common.h" namespace callui { using namespace ucl; - RejectMsg::RejectMsg(MsgClientWRef client, const TString &string): - m_msgClient(client), - m_msg(string) + RejectMsg::RejectMsg(MsgClientWRef client, TString string): + m_msgClient(std::move(client)), + m_msg(std::move(string)) { } - RejectMsg::~RejectMsg() + RejectMsgSRef RejectMsg::newInstance(MsgClientWRef client, TString string) { - } + if (!client) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "client is NULL"); + } - RejectMsgSRef RejectMsg::newInstance(MsgClientWRef client, const TString &string) - { - return makeShared<RejectMsg>(client, string); + return makeShared<RejectMsg>(std::move(client), std::move(string)); } std::string RejectMsg::getText() const @@ -72,18 +70,28 @@ namespace callui { msg_set_bool_value(sendOpt, MSG_SEND_OPT_SETTING_BOOL, false); // Set message body - if (msg_set_str_value(msgInfo, MSG_MESSAGE_SMS_DATA_STR, msgText, strlen(msgText)) != MSG_SUCCESS) { + if (msg_set_str_value(msgInfo, + MSG_MESSAGE_SMS_DATA_STR, + msgText, + strlen(msgText)) != MSG_SUCCESS) { ELOG("msg_set_str_value() failed!"); } else { // Create address list msg_struct_list_s *addrList = nullptr; - msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addrList); + msg_get_list_handle(msgInfo, + MSG_MESSAGE_ADDR_LIST_STRUCT, + (void **)&addrList); msg_struct_t addrInfo = addrList->msg_struct_info[0]; const char *number = phoneNumber.c_str(); // Set message address - msg_set_int_value(addrInfo, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO); - msg_set_str_value(addrInfo, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, number, strlen(number)); + msg_set_int_value(addrInfo, + MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, + MSG_RECIPIENTS_TYPE_TO); + msg_set_str_value(addrInfo, + MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, + number, + strlen(number)); addrList->nCount = 1; // Set message struct to Request diff --git a/call-ui/model/impl/RejectMsg.h b/call-ui/model/impl/RejectMsg.h new file mode 100644 index 0000000..9fff9a7 --- /dev/null +++ b/call-ui/model/impl/RejectMsg.h @@ -0,0 +1,79 @@ +/* + * 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_MODEL_IMPL_REJECT_MSG_H__ +#define __CALL_UI_MODEL_IMPL_REJECT_MSG_H__ + +#include "call-ui/model/IRejectMsg.h" + +#include "ucl/misc/TString.h" + +#include "MsgClient.h" + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(RejectMsg); + + /** + * @brief Implementation of IRejectMsg interface + * @see IRejectMsg + */ + class RejectMsg final : public IRejectMsg { + public: + + /** + * @brief Creates new instance of RejectMsg + * @param[in] client Message client instance + * @param[in] string Message text + * @return Shared reference to RejectMsg on success + * or NULL otherwise + */ + static RejectMsgSRef newInstance(MsgClientWRef client, + ucl::TString string); + + /** + * @brief Sends reject message + * @param[in] number Sending number + * @param[in] slot Sim slot to send from + * @return RES_OK on success or another result otherwise + */ + ucl::Result send(const std::string &number, SimSlot slot); + + // IRejectMsg // + + /** + * @see IRejectMsg::getText() + */ + std::string getText() const override final; + + private: + RejectMsg(MsgClientWRef client, ucl::TString string); + ~RejectMsg() = default; + + ucl::Result prepare(); + + private: + const MsgClientWRef m_msgClient; + const ucl::TString m_msg; + + friend class ucl::ReffedObj<RejectMsg>; + }; + +} + +#endif // __CALL_UI_MODEL_IMPL_REJECT_MSG_H__ diff --git a/src/model/RejectMsgProvider.cpp b/call-ui/model/impl/RejectMsgProvider.cpp index fe33f19..412dffb 100644 --- a/src/model/RejectMsgProvider.cpp +++ b/call-ui/model/impl/RejectMsgProvider.cpp @@ -18,7 +18,6 @@ #include <vconf.h> -#include "MsgClient.h" #include "RejectMsg.h" #include "common.h" @@ -31,10 +30,6 @@ namespace callui { { } - RejectMsgProvider::~RejectMsgProvider() - { - } - RejectMsgProviderSRef RejectMsgProvider::newInstance() { auto result = makeShared<RejectMsgProvider>(); @@ -86,7 +81,7 @@ namespace callui { return msg; } - RejectMsgList RejectMsgProvider::getMsgList() const + IRejectMsgProvider::RejectMsgList RejectMsgProvider::getMsgList() const { RejectMsgList list; int count = getMsgCount(); diff --git a/src/model/RejectMsgProvider.h b/call-ui/model/impl/RejectMsgProvider.h index b1cc8b1..881bae8 100644 --- a/src/model/RejectMsgProvider.h +++ b/call-ui/model/impl/RejectMsgProvider.h @@ -14,36 +14,58 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_REJECT_MSG_PROVIDER_H__ -#define __CALLUI_MODEL_REJECT_MSG_PROVIDER_H__ +#ifndef __CALL_UI_MODEL_IMPL_REJECT_MSG_PROVIDER_H__ +#define __CALL_UI_MODEL_IMPL_REJECT_MSG_PROVIDER_H__ -#include "model/IRejectMsgProvider.h" +#include "call-ui/model/IRejectMsgProvider.h" -#include "implTypes.h" +#include "MsgClient.h" + +#include "types.h" namespace callui { - class RejectMsgProvider : public IRejectMsgProvider { + UCL_DECLARE_REF_ALIASES(RejectMsgProvider); + + /** + * @brief Implementation of IRejectMsgProvider interface + * @see IRejectMsgProvider + */ + class RejectMsgProvider final : public IRejectMsgProvider { public: + + /** + * @brief Creates new instance of RejectMsgProvider + * @return Shared reference to RejectMsgProvider on success + * or NULL otherwise + */ static RejectMsgProviderSRef newInstance(); - virtual ~RejectMsgProvider(); - // IRejectMsgProvider + // IRejectMsgProvider // + /** + * @see IRejectMsgProvider::getMsgList() + */ virtual RejectMsgList getMsgList() const override final; + + /** + * @see IRejectMsgProvider::getMsgCount() + */ virtual int getMsgCount() const override final; private: - friend class ucl::ReffedObj<RejectMsgProvider>; RejectMsgProvider(); + ~RejectMsgProvider() = default; ucl::Result prepare(); IRejectMsgSRef getRejectMsgByIndex(int index) const; private: MsgClientSRef m_msgClient; + + friend class ucl::ReffedObj<RejectMsgProvider>; }; } -#endif // __CALLUI_MODEL_REJECT_MSG_PROVIDER_H__ +#endif // __CALL_UI_MODEL_IMPL_REJECT_MSG_PROVIDER_H__ diff --git a/src/model/RssiStateSource.cpp b/call-ui/model/impl/RssiStateSource.cpp index 71ce4d1..915d715 100644 --- a/src/model/RssiStateSource.cpp +++ b/call-ui/model/impl/RssiStateSource.cpp @@ -147,7 +147,9 @@ namespace callui { } if (needNotify && m_handler) { - m_handler(); + if (const auto handler = m_handler.lock()) { + handler(); + } } } @@ -156,31 +158,31 @@ namespace callui { int res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_SVC_ROAM, CALLBACK_B(RssiStateSource::onRssiChangedCb), this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, CALLBACK_B(RssiStateSource::onRssiChangedCb), this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_SVCTYPE, CALLBACK_B(RssiStateSource::onRssiChangedCb), this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_RSSI, CALLBACK_B(RssiStateSource::onRssiChangedCb), this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_ROAM_ICON_MODE, CALLBACK_B(RssiStateSource::onRssiChangedCb), this); if (res != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); + LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!"); } return RES_OK; @@ -205,9 +207,9 @@ namespace callui { return {m_bits.value}; } - void RssiStateSource::setStateChangeHandler(const NotiHandler &handler) + void RssiStateSource::setStateChangeHandler(NotiHandler handler) { - m_handler = handler; + m_handler = std::move(handler); } RssiState getRssiState(IndicatorState state) diff --git a/src/model/RssiStateSource.h b/call-ui/model/impl/RssiStateSource.h index 967bf25..74d0ba2 100644 --- a/src/model/RssiStateSource.h +++ b/call-ui/model/impl/RssiStateSource.h @@ -14,30 +14,49 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_RSSI_STATE_SOURCE_H__ -#define __CALLUI_MODEL_RSSI_STATE_SOURCE_H__ +#ifndef __CALL_UI_MODEL_IMPL_RSSI_STATE_SOURCE_H__ +#define __CALL_UI_MODEL_IMPL_RSSI_STATE_SOURCE_H__ #include "IIndicatorStateSource.h" #include <vconf.h> -#include "implTypes.h" +#include "types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(RssiStateSource); + + /** + * @brief Represents RSSI state source for IndicatorStateProvider + * Inherits from IIndicatorStateSource + * @see IIndicatorStateSource + */ class RssiStateSource final : public IIndicatorStateSource { public: + + /** + * @brief Creates new instance of RssiStateSource + * @return Shared reference to RssiStateSource instance on success + * or NULL otherwise + */ static RssiStateSourceSRef newInstance(); - virtual ~RssiStateSource(); - // IIndicatorStateSource + // IIndicatorStateSource // + /** + * @see IIndicatorStateSource::getState() + */ virtual IndicatorState getState() const override final; - virtual void setStateChangeHandler(const NotiHandler &handler) override final; + + /** + * @see IIndicatorStateSource::setStateChangeHandler() + */ + virtual void setStateChangeHandler(NotiHandler handler) override final; private: - friend class ucl::ReffedObj<RssiStateSource>; RssiStateSource(); + ~RssiStateSource(); ucl::Result prepare(); ucl::Result addSysStateCallbacks(); @@ -68,8 +87,10 @@ namespace callui { private: Bits m_bits; NotiHandler m_handler; + + friend class ucl::ReffedObj<RssiStateSource>; }; } -#endif // __CALLUI_MODEL_RSSI_STATE_SOURCE_H__ +#endif // __CALL_UI_MODEL_IMPL_RSSI_STATE_SOURCE_H__ diff --git a/src/model/SimSlotStateSource.cpp b/call-ui/model/impl/SimSlotStateSource.cpp index e65f4b7..c92bb6f 100644 --- a/src/model/SimSlotStateSource.cpp +++ b/call-ui/model/impl/SimSlotStateSource.cpp @@ -43,11 +43,12 @@ namespace callui { m_bits.isForwarded = isForwarded; } - SimSlotStateSource::~SimSlotStateSource() + SimSlotStateSourceSRef SimSlotStateSource::newInstance(SimSlot slot, bool isForwarded) { + return makeShared<SimSlotStateSource>(slot, isForwarded); } - void SimSlotStateSource::updateSimSlot(SimSlot slot, bool isForwarded) + void SimSlotStateSource::setSimSlot(SimSlot slot, bool isForwarded) { int simSlotInt = convertEnumValueToInt(slot); bool needUpdate = false; @@ -62,8 +63,10 @@ namespace callui { needUpdate = true; } - if (needUpdate && m_handler) { - m_handler(); + if (needUpdate) { + if (const auto handler = m_handler.lock()) { + handler(); + } } } @@ -72,9 +75,9 @@ namespace callui { return {m_bits.value}; } - void SimSlotStateSource::setStateChangeHandler(const NotiHandler &handler) + void SimSlotStateSource::setStateChangeHandler(NotiHandler handler) { - m_handler = handler; + m_handler = std::move(handler); } SimSlot getSimSlotType(IndicatorState state) diff --git a/call-ui/model/impl/SimSlotStateSource.h b/call-ui/model/impl/SimSlotStateSource.h new file mode 100644 index 0000000..76f8426 --- /dev/null +++ b/call-ui/model/impl/SimSlotStateSource.h @@ -0,0 +1,89 @@ +/* + * 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_MODEL_IMPL_SIM_SLOT_STATE_SOURCE_H__ +#define __CALL_UI_MODEL_IMPL_SIM_SLOT_STATE_SOURCE_H__ + +#include "IIndicatorStateSource.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(SimSlotStateSource); + + /** + * @brief Represents Sim slot source for IndicatorStateProvider + * Inherits from IIndicatorStateSource + * @see IIndicatorStateSource + */ + class SimSlotStateSource final : public IIndicatorStateSource { + public: + + /** + * @brief Creates new instance of SimSlotStateSource + * @param[in] slot Sim slot type + * @param[in] isForwarded Is current call forwarded + * @return Shared reference to SimSlotStateSource instance on success + * or NULL otherwise + */ + static SimSlotStateSourceSRef newInstance(SimSlot slot, + bool isForwarded); + + /** + * @brief Sets Sim slot type + * @param[in] slot Sim slot type + * @param[in] isForwarded Is current call forwarded + */ + void setSimSlot(SimSlot slot, bool isForwarded); + + // IIndicatorStateSource // + + /** + * @see IIndicatorStateSource::getState() + */ + virtual IndicatorState getState() const override final; + + /** + * @see IIndicatorStateSource::setStateChangeHandler() + */ + virtual void setStateChangeHandler(NotiHandler handler) override final; + + private: + SimSlotStateSource(SimSlot slot, bool isForwarded); + ~SimSlotStateSource() = default; + + public: + union Bits { + struct { + uint8_t property : 4; + uint8_t simSlot : 4; + uint8_t isForwarded: 1; + }; + uint64_t value; + + Bits(); + Bits(const IndicatorState &state); + }; + + private: + Bits m_bits; + NotiHandler m_handler; + + friend class ucl::ReffedObj<SimSlotStateSource>; + }; + +} + +#endif // __CALL_UI_MODEL_IMPL_SIM_SLOT_STATE_SOURCE_H__ diff --git a/src/model/SoundManager.cpp b/call-ui/model/impl/SoundManager.cpp index dd9cb62..563b6c2 100644 --- a/src/model/SoundManager.cpp +++ b/call-ui/model/impl/SoundManager.cpp @@ -16,96 +16,35 @@ #include "SoundManager.h" -#include "BluetoothManager.h" -#include "CallClient.h" - #include "common.h" -namespace callui { namespace { namespace impl { - - using namespace ucl; - - Result getBTHeadsetConnectedState(bool &state) - { - Result res = RES_FAIL; - state = false; - - sound_device_list_h deviceList = nullptr; - auto ret = sound_manager_get_device_list( - SOUND_DEVICE_ALL_MASK, &deviceList); - if (ret != SOUND_MANAGER_ERROR_NONE) { - LOG_RETURN(RES_FAIL, "sound_manager_get_device_list() failed. " - "[%d][%s]", ret, get_error_message(ret)); - } - sound_device_type_e searchType = SOUND_DEVICE_BLUETOOTH_VOICE; - sound_device_h device; - sound_device_type_e type; - - while (true) { - device = nullptr; - ret = sound_manager_get_next_device(deviceList, &device); - - if (ret == SOUND_MANAGER_ERROR_NO_DATA) { - res = RES_OK; - ILOG("No more device to check"); - break; - } else if (ret != SOUND_MANAGER_ERROR_NONE) { - UCL_FAIL_BREAK(res, "sound_manager_get_next_device() failed. " - "[%d][%s]", ret, get_error_message(ret)); - } - - if (!device) { - UCL_FAIL_BREAK(res, "device is NULL"); - } - - sound_manager_get_device_type(device, &type); - if (searchType == type) { - DLOG("Bluetooth voice device found"); - state = true; - } - - // For debug only - int id; - char *name; - sound_device_io_direction_e direction; - sound_manager_get_device_id(device, &id); - sound_manager_get_device_name(device, &name); - sound_manager_get_device_io_direction(device, &direction); - DLOG("--------------------------"); - DLOG("Device ID [%d]", id); - DLOG("Device name [%s]", name); - DLOG("Device IO direction [%d]", direction); - DLOG("Device type [%d]", type); - } - sound_manager_free_device_list(deviceList); - - return res; - } -}}} - namespace callui { using namespace ucl; - SoundManager::SoundManager(IRefCountObj &rc, const CallClientSRef &client): - RefCountAware(&rc), - m_client(client), - m_deviceVolumeCbID(-1) + SoundManager::SoundManager(IRefCountObj &rc, CallClientSRef client): + RefCountAware(&rc), + m_client(std::move(client)), + m_deviceVolumeCbId(-1) { } SoundManager::~SoundManager() { - if (m_deviceVolumeCbID >= 0) { - sound_manager_remove_volume_changed_cb(m_deviceVolumeCbID); + if (m_deviceVolumeCbId >= 0) { + sound_manager_remove_volume_changed_cb(m_deviceVolumeCbId); } cm_unset_audio_state_changed_cb(*m_client); cm_unset_mute_status_cb(*m_client); } - SoundManagerSRef SoundManager::newInstance(const CallClientSRef &client) + SoundManagerSRef SoundManager::newInstance(CallClientSRef client) { - auto result = makeShared<SoundManager>(client); + if (!client) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "client is NULL"); + } + + auto result = makeShared<SoundManager>(std::move(client)); FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!"); return result; } @@ -115,17 +54,16 @@ namespace callui { DLOG(); if (state == CM_AUDIO_STATE_NONE_E) { - ILOG("Ignore. Unhandled state [%d]", state); + ILOG("Ignored. Unhandled state [%d]", state); return; } - m_audioStateEvent.dispatch(convertCMAudioState(state)); + + m_audioStateEvent.dispatch(); } void SoundManager::onMuteStateChanged(cm_mute_status_e status) { - DLOG(); - - m_muteStateEvent.dispatch(status == CM_MUTE_STATUS_ON); + m_muteStateEvent.dispatch(); } Result SoundManager::prepare() @@ -154,20 +92,18 @@ namespace callui { int ret = sound_manager_add_volume_changed_cb( CALLBACK_B(SoundManager::onGearVolumeChanged), this, - &m_deviceVolumeCbID); + &m_deviceVolumeCbId); if (ret != SOUND_MANAGER_ERROR_NONE) { LOG_RETURN(RES_FAIL, - "sound_manager_add_volume_changed_cb() failed"); + "sound_manager_add_volume_changed_cb() failed!"); } if (isBTSupported()) { - m_btManager->setVolumeStateHandler( - WEAK_DELEGATE(SoundManager::onBTHeadsetVolumeChanged, - asWeak(*this))); + m_btManager->setVolumeChangeHandler( + WEAK_DELEGATE_THIS(onBTHeadsetVolumeChanged)); m_btManager->setHeadsetConnectionChangeHandler( - WEAK_DELEGATE(SoundManager::onHeadsetConnectionChanged, - asWeak(*this))); + WEAK_DELEGATE_THIS(onHeadsetConnectionChanged)); } return RES_OK; @@ -193,17 +129,11 @@ namespace callui { LOG_RETURN(RES_NOT_SUPPORTED, "Bluetooth not supported"); } - bool state = false; - Result res = impl::getBTHeadsetConnectedState(state); - DLOG("Sound manager BT Headset connection status [%d], res [%s]", - state, getResultData(res).name); - - if (!isBTHeadsetConnected()) { - LOG_RETURN(RES_NOT_CONNECTED, - "Bluetooth headset device not connected"); - } - if (isEnable) { + if (!isBTHeadsetConnected()) { + LOG_RETURN(RES_NOT_CONNECTED, + "Bluetooth headset device not connected"); + } return convertCMResult(cm_bluetooth_on(*m_client)); } else { return convertCMResult(cm_bluetooth_off(*m_client)); @@ -244,32 +174,32 @@ namespace callui { return convertCMResult(cm_stop_dtmf(*m_client)); } - void SoundManager::addAudioStateHandler(const AudioStateHandler &handler) + void SoundManager::addAudioStateHandler(NotiHandler handler) { - m_audioStateEvent += handler; + m_audioStateEvent += std::move(handler); } - void SoundManager::delAudioStateHandler(const AudioStateHandler &handler) + void SoundManager::delAudioStateHandler(NotiHandler::CDRef handler) { m_audioStateEvent -= handler; } - void SoundManager::addMuteStateHandler(const MuteStateHandler &handler) + void SoundManager::addMuteStateHandler(NotiHandler handler) { - m_muteStateEvent += handler; + m_muteStateEvent += std::move(handler); } - void SoundManager::delMuteStateHandler(const MuteStateHandler &handler) + void SoundManager::delMuteStateHandler(NotiHandler::CDRef handler) { m_muteStateEvent -= handler; } - void SoundManager::addVolumeStateHandler(const VolumeLevelHandler &handler) + void SoundManager::addVolumeStateHandler(NotiHandler handler) { - m_volumeLevelEvent += handler; + m_volumeLevelEvent += std::move(handler); } - void SoundManager::delVolumeStateHandler(const VolumeLevelHandler &handler) + void SoundManager::delVolumeStateHandler(NotiHandler::CDRef handler) { m_volumeLevelEvent -= handler; } @@ -334,7 +264,7 @@ namespace callui { bool SoundManager::isBTSupported() const { - return (m_btManager != nullptr); + return (m_btManager.get() != nullptr); } bool SoundManager::isBTHeadsetConnected() const @@ -343,36 +273,33 @@ namespace callui { } void SoundManager::addBTHeadsetConnectionChangeHandler( - const NotiHandler &handler) + NotiHandler handler) { - m_btVoiceDeviceConnEvent += handler; + m_btVoiceDeviceConnEvent += std::move(handler); } void SoundManager::delBTHeadsetConnectionChangeHandler( - const NotiHandler &handler) + NotiHandler::CDRef handler) { m_btVoiceDeviceConnEvent -= handler; } void SoundManager::onGearVolumeChanged(sound_type_e type, unsigned int volume) { - DLOG("Volume [%d]", volume); if (type != SOUND_TYPE_CALL) { ILOG("Ignored. Not type Call."); return; } if (getAudioState() != AudioStateType::BT) { - m_volumeLevelEvent.dispatch(volume); + m_volumeLevelEvent.dispatch(); } } - void SoundManager::onBTHeadsetVolumeChanged(int volume) + void SoundManager::onBTHeadsetVolumeChanged() { - DLOG("Volume [%d]", volume); - if (getAudioState() == AudioStateType::BT) { - m_volumeLevelEvent.dispatch(volume); + m_volumeLevelEvent.dispatch(); } } diff --git a/call-ui/model/impl/SoundManager.h b/call-ui/model/impl/SoundManager.h new file mode 100644 index 0000000..70e7167 --- /dev/null +++ b/call-ui/model/impl/SoundManager.h @@ -0,0 +1,191 @@ +/* + * 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_MODEL_IMPL_SOUND_MANAGER_H__ +#define __CALL_UI_MODEL_IMPL_SOUND_MANAGER_H__ + +#include "call-ui/model/ISoundManager.h" + +#include <call-manager-ext.h> +#include <sound_manager.h> + +#include "BluetoothManager.h" +#include "CallClient.h" + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(SoundManager); + + /** + * @brief Implementation of ISoundManager interface + * @see ISoundManager + */ + class SoundManager final : + public ucl::RefCountAware, + public ISoundManager { + public: + + /** + * @brief Creates new instance of SoundManager + * @param[in] client Call client instance + * @return Shared reference to SoundManager on success + * or NULL otherwise + */ + static SoundManagerSRef newInstance(CallClientSRef client); + + // ISoundManager // + + /** + * @see ISoundManager::setSpeakerState() + */ + virtual ucl::Result setSpeakerState(bool isEnable) override final; + + /** + * @see ISoundManager::setBluetoothState() + */ + virtual ucl::Result setBluetoothState(bool isEnable) override final; + + /** + * @see ISoundManager::getAudioState() + */ + virtual AudioStateType getAudioState() const override final; + + /** + * @see ISoundManager::setMuteState() + */ + virtual ucl::Result setMuteState(bool isEnable) override final; + + /** + * @see ISoundManager::getMuteState() + */ + virtual bool getMuteState() const override final; + + /** + * @see ISoundManager::startDtmf() + */ + virtual ucl::Result startDtmf( + const unsigned char dtmfDigit) override final; + + /** + * @see ISoundManager::stopDtmf() + */ + virtual ucl::Result stopDtmf() override final; + + /** + * @see ISoundManager::addAudioStateHandler() + */ + virtual void addAudioStateHandler( + NotiHandler handler) override final; + + /** + * @see ISoundManager::delAudioStateHandler() + */ + virtual void delAudioStateHandler( + NotiHandler::CDRef handler) override final; + + /** + * @see ISoundManager::addMuteStateHandler() + */ + virtual void addMuteStateHandler( + NotiHandler handler) override final; + + /** + * @see ISoundManager::delMuteStateHandler() + */ + virtual void delMuteStateHandler( + NotiHandler::CDRef handler) override final; + + /** + * @see ISoundManager::addVolumeStateHandler() + */ + virtual void addVolumeStateHandler( + NotiHandler handler) override final; + + /** + * @see ISoundManager::delVolumeStateHandler() + */ + virtual void delVolumeStateHandler( + NotiHandler::CDRef handler) override final; + + /** + * @see ISoundManager::getMaxVolume() + */ + virtual int getMaxVolume() const override final; + + /** + * @see ISoundManager::getVolume() + */ + virtual int getVolume() const override final; + + /** + * @see ISoundManager::setVolume() + */ + virtual ucl::Result setVolume(int value) override final; + + /** + * @see ISoundManager::isBTSupported() + */ + virtual bool isBTSupported() const override final; + + /** + * @see ISoundManager::isBTHeadsetConnected() + */ + virtual bool isBTHeadsetConnected() const override final; + + /** + * @see ISoundManager::addBTHeadsetConnectionChangeHandler() + */ + virtual void addBTHeadsetConnectionChangeHandler( + NotiHandler handler) override final; + + /** + * @see ISoundManager::delBTHeadsetConnectionChangeHandler() + */ + virtual void delBTHeadsetConnectionChangeHandler( + NotiHandler::CDRef handler) override final; + + private: + SoundManager(ucl::IRefCountObj &rc, CallClientSRef client); + ~SoundManager(); + + ucl::Result prepare(); + ucl::Result registerCallbacks(); + + void onAudioStateChanged(cm_audio_state_type_e state); + void onMuteStateChanged(cm_mute_status_e status); + void onHeadsetConnectionChanged(); + + void onBTHeadsetVolumeChanged(); + void onGearVolumeChanged(sound_type_e type, unsigned int volume); + + private: + const CallClientSRef m_client; + + BluetoothManagerSRef m_btManager; + ucl::Event<NotiHandler> m_audioStateEvent; + ucl::Event<NotiHandler> m_muteStateEvent; + ucl::Event<NotiHandler> m_volumeLevelEvent; + ucl::Event<NotiHandler> m_btVoiceDeviceConnEvent; + int m_deviceVolumeCbId; + + friend class ucl::ReffedObj<SoundManager>; + }; + +} + +#endif // __CALL_UI_MODEL_IMPL_SOUND_MANAGER_H__ diff --git a/src/model/common.h b/call-ui/model/impl/common.h index 569d6af..4f3d655 100644 --- a/src/model/common.h +++ b/call-ui/model/impl/common.h @@ -14,11 +14,11 @@ * limitations under the License. */ -#ifndef __CALLUI_MODEL_COMMON_H__ -#define __CALLUI_MODEL_COMMON_H__ +#ifndef __CALL_UI_MODEL_IMPL_COMMON_H__ +#define __CALL_UI_MODEL_IMPL_COMMON_H__ -#include "../common.h" +#include "call-ui/common.h" #include "helpers.h" -#endif // __CALLUI_MODEL_COMMON_H__ +#endif // __CALL_UI_MODEL_IMPL_COMMON_H__ diff --git a/call-ui/model/impl/helpers.h b/call-ui/model/impl/helpers.h new file mode 100644 index 0000000..fdf12e1 --- /dev/null +++ b/call-ui/model/impl/helpers.h @@ -0,0 +1,100 @@ +/* + * 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_MODEL_IMPL_HELPERS_H__ +#define __CALL_UI_MODEL_IMPL_HELPERS_H__ + +#include <call-manager-ext.h> +#include <type_traits> + +#include "types.h" + +namespace callui { + + /** + * @brief Converts native Call Manager results into application results + * @param[in] cmRes Native Call Manager result + * @return Application defined result + */ + ucl::Result convertCMResult(int cmRes); + + /** + * @brief Converts native Call Manager audio states types + * into application types + * @param[in] state Native Call Manager audio states type + * @return Application defined audio states type + */ + AudioStateType convertCMAudioState(cm_audio_state_type_e state); + + /** + * @brief Converts application Sim slot types into Call Manager types + * @param[in] slot Application defined sim slot type + * @return Native Call Manager sim slot type + */ + cm_multi_sim_slot_type_e convertCUISimSlot(SimSlot slot); + + /** + * @brief Converts native Call Manager Sim slot types + * into application types + * @param[in] slot Native Call Manager Sim slot type + * @return Application defined Sim slot type + */ + SimSlot convertCMSimSlot(cm_multi_sim_slot_type_e slot); + + /** + * @brief Converts application call release types + * into Call Manager types + * @param[in] type Application defined call release type + * @return Native Call Manager call release type + */ + cm_call_release_type_e convertCUICallReleaseType(CallReleaseType type); + + /** + * @brief Converts native Call Manager call event types + * into application types + * @param[in] cmEvent Native Call Manager call event type + * @param[out] appEvent Application defined call event type + * @return RES_OK on success or another result otherwise + */ + ucl::Result convertCMEventType(cm_call_event_e cmEvent, + CallEventType *appEvent); + + /** + * @brief Converts application call answer types into Call Manager types + * @param[in] type Application defined call answer type + * @return Native Call Manager call answer type + */ + cm_call_answer_type_e convertCUICallAnswerType(CallAnswerType type); + + /** + * @brief Checks whether Flight mode is turned on + * @return true if Flight mode is active, false otherwise + */ + bool isFlightModeActive(); + + /** + * @brief Converts enum class value to int value + * @param[in] e Template type of enum class + * @return int value of enum class + */ + template<typename TYPE> + constexpr auto convertEnumValueToInt(TYPE e) -> + typename std::underlying_type<TYPE>::type; +} + +#include "helpers.hpp" + +#endif // __CALL_UI_MODEL_IMPL_HELPERS_H__ diff --git a/src/model/helpers.hpp b/call-ui/model/impl/helpers.hpp index 302350b..10ae638 100644 --- a/src/model/helpers.hpp +++ b/call-ui/model/impl/helpers.hpp @@ -132,7 +132,7 @@ namespace callui { inline bool isFlightModeActive() { - int status = false;; + int status = false; if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &status) != 0) { ELOG("Get Flight mode status failed!"); return false; @@ -140,4 +140,11 @@ namespace callui { return status; } + template<typename TYPE> + inline constexpr auto convertEnumValueToInt(TYPE e) -> + typename std::underlying_type<TYPE>::type + { + return static_cast<typename std::underlying_type<TYPE>::type>(e); + } + } diff --git a/call-ui/model/impl/types.h b/call-ui/model/impl/types.h new file mode 100644 index 0000000..b8fe106 --- /dev/null +++ b/call-ui/model/impl/types.h @@ -0,0 +1,43 @@ +/* + * 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_MODEL_IMPL_TYPES_H__ +#define __CALL_UI_MODEL_IMPL_TYPES_H__ + +#include "call-ui/model/types.h" +#include "ucl/misc/Event.h" +#include "ucl/util/smartDelegation.h" + +namespace callui { + + enum class CallReleaseType { + BY_CALL_HANDLE, + ALL, + ALL_HOLD, + ALL_ACTIVE + }; + + enum class CallManagerErr { + DIAL_CANCEL, + DIAL_FAIL, + DIAL_FAIL_SS, + DIAL_FAIL_FDN, + DIAL_FLIGHT_MODE + }; + +} + +#endif // __CALL_UI_MODEL_IMPL_IMPL_TYPES_H__ diff --git a/call-ui/model/types.h b/call-ui/model/types.h new file mode 100644 index 0000000..2f7720f --- /dev/null +++ b/call-ui/model/types.h @@ -0,0 +1,195 @@ +/* + * 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_MODEL_TYPES_H__ +#define __CALL_UI_MODEL_TYPES_H__ + +#include <vector> + +#include "call-ui/types.h" + +namespace callui { + + /** + * @brief Enumeration for call error type + */ + enum class CallErr { + DIAL_CANCEL, /**< Dial canceled by system service */ + DIAL_FAIL, /**< Dial on provided number failed */ + DIAL_FLIGHT_MODE /**< Flight mode is on */ + }; + + /** + * @brief Enumeration for sim slot type + */ + enum class SimSlot { + UNDEFINED = 0, /**< Undefined Sim slot */ + GEAR, /**< Gear Sim card */ + MOBILE_FIRST, /**< Mobile first Sim card */ + MOBILE_SECOND, /**< Mobile second Sim card */ + MOBILE_DEFAULT /**< Mobile default Sim card */ + }; + + /** + * Enumeration for call answer type + */ + enum class CallAnswerType { + NORMAL, /**< Only single call exist, Accept the Incoming call */ + HOLD_ACTIVE_AND_ACCEPT, /**< Put the active call on hold and accepts the call */ + RELEASE_ACTIVE_AND_ACCEPT, /**< Releases the active call and accept the call */ + RELEASE_HOLD_AND_ACCEPT, /**< Releases the held call and accept the call */ + RELEASE_ALL_AND_ACCEPT /**< Releases all calls and accept the call */ + }; + + /** + * @brief Enumeration for audio state type + */ + enum class AudioStateType { + NONE, /**< None */ + SPEAKER, /**< System LoudSpeaker path */ + RECEIVER, /**< System Receiver */ + EARJACK, /**< Earjack path */ + BT /**< System BT Headset path */ + }; + + /** + * @brief Enumeration for call flags of current available calls + */ + enum { + CALL_FLAG_NONE = 0, /**< None */ + CALL_FLAG_INCOMING = 1, /**< Incoming call flag value */ + CALL_FLAG_ACTIVE = 2, /**< Active call flag value */ + CALL_FLAG_HELD = 4, /**< Held call flag value */ + CALL_FLAG_END = 8 /**< End call flag value */ + }; + /** + * @brief CallMask definition + */ + using CallMask = int; + + /** + * Enumeration for Call event type + */ + enum class CallEventType { + END, /**< Call End event */ + DIALING, /**< Call Dialing event */ + ACTIVE, /**< Call Active event */ + HELD, /**< Call Held event */ + ALERT, /**< Call Alert event */ + INCOMING, /**< Call Incoming event */ + WAITING, /**< Call Waiting event */ + JOIN, /**< Call Join event */ + SPLIT, /**< Call Split event */ + SWAPPED, /**< Call Swapped event */ + RETRIEVED, /**< Call Retrieved event */ + SAT_CALL_CONTROL /**< Sat call control event */ + }; + + + /** + * @brief Enumeration for Contact display name source type + */ + enum class ContactNameSourceType { + INVALID, /**< Invalid source of display name */ + EMAIL, /**< Produced display name from email record */ + NUMBER, /**< Produced display name from number record */ + NICKNAME, /**< Produced display name from nickname record */ + COMPANY, /**< Produced display name from company record */ + NAME /**< Produced display name from name record */ + }; + + /** + * @brief Enumeration for Network connection type + */ + enum class ConnectionType { + NONE = 0, /**< None */ + EDGE_E, /**< EDGE */ + GPRS_G, /**< GPRS */ + SIMPLE_2G, /**< 2G */ + HSDPA_H, /**< HSDPA */ + HSPA_H_PLUS, /**< HSPA Plus */ + LTE_4G, /**< LTE 4G */ + UMTS_3G, /**< UMTS 3G */ + UMTS_3G_PLUS, /**< UMTS 3G Plus */ + NO_SIM, /**< No SIM */ + WIFI_00, /**< WiFi strength level 0 */ + WIFI_01, /**< WiFi strength level 1 */ + WIFI_02, /**< WiFi strength level 2 */ + WIFI_03, /**< WiFi strength level 3 */ + WIFI_04, /**< WiFi strength level 4 */ + NO_SIGNAL, /**< No signal */ + }; + + /** + * @brief Enumeration for Packet direction type + */ + enum class PacketDirection { + NONE = 0, /**< None */ + NO_INPUT, /**< No input */ + IN, /**< Incoming */ + OUT, /**< Outgoing */ + INOUT /**< Incoming and outgoing */ + }; + + /** + * @brief Enumeration for RSSI state + */ + enum class RssiState { + NONE = 0, /**< None */ + LEVEL_0, /**< Level 0 */ + LEVEL_1, /**< Level 1 */ + LEVEL_2, /**< Level 2 */ + LEVEL_3, /**< Level 3 */ + LEVEL_4, /**< Level 4 */ + NO_SIGNAL, /**< No signal */ + FLIGHT_MODE /**< Flight mode */ + }; + + /** + * @brief Enumeration for Battery state + */ + enum class BatteryState { + NORMAL = 0, /**< Normal battery work flaw */ + CHARGING, /**< Battery is charging */ + CHARGING_PROBLEM, /**< Battery charging issue */ + UNKNOWN /**< Unknown battery state */ + }; + + /** + * @brief Enumeration for Indicator property type + */ + enum class IndicatorProperty { + NW_CONNECTION = 0, /**< Network connection property */ + RSSI, /**< RSSI property */ + BATTERY, /**< Battery property */ + SIM_SLOT, /**< Sim slot property */ + HD_VOICE /**< Call HD voice property */ + }; + + /** + * @brief Enumeration of Call modes + */ + enum class CallMode { + UNDEFINED, /**< Undefined */ + INCOMING, /**< Incoming */ + OUTGOING, /**< Outgoing */ + DURING, /**< During */ + END /**< End */ + }; + +} + +#endif // __CALL_UI_MODEL_TYPES_H__ diff --git a/src/presenters/Instance.cpp b/call-ui/presenters/Instance.cpp index e77f8c4..4a91def 100644 --- a/src/presenters/Instance.cpp +++ b/call-ui/presenters/Instance.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "presenters/Instance.h" +#include "Instance.h" #include "ucl/util/memory.h" #include "ucl/appfw/SysEventProvider.h" @@ -22,18 +22,22 @@ #include <system_settings.h> -#include "model/CallUIBuilder.h" -#include "model/ICallUI.h" -#include "model/ICallManager.h" -#include "presenters/MainPage.h" +#include "call-ui/model/CallUIBuilder.h" +#include "call-ui/model/ICallUI.h" +#include "call-ui/model/ICallManager.h" +#include "pages/MainPage.h" -#include "resources.h" +#include "call-ui/resources.h" +#include "call-ui/presenters/types.h" +#include "call-ui/view/helpers.h" #include "common.h" namespace callui { namespace { namespace impl { using namespace ucl; + constexpr auto POWER_KEY_HOLD_TIMEOUT = 0.4; + const char *STR_POWER_KEY = "XF86PowerOff"; }}} @@ -47,21 +51,23 @@ namespace callui { RefCountAware(&rc), m_sysEventProvider(sysEventProvider), m_context(nullptr), - m_keyUpEventHandler(nullptr) + m_keyUpEventHandler(nullptr), + m_keyDownEventHandler(nullptr), + m_ignorePowerClick(false) { } Instance::~Instance() { - elm_win_keygrab_unset(*m_win, impl::STR_POWER_KEY, 0, 0); + m_powerKeyHoldTimout.reset(); + + elm_win_keygrab_unset(as_eo(*m_win), impl::STR_POWER_KEY, 0, 0); if (m_keyUpEventHandler) { ecore_event_handler_del(m_keyUpEventHandler); } - if (const auto page = m_page.lock()) { - page->exitNoTransition(); - } + util::dispose(m_page); } Result Instance::onCreate(IInstanceContext *const context) @@ -70,11 +76,14 @@ namespace callui { m_win = m_context->getWindow(); - elm_win_keygrab_set(*m_win, impl::STR_POWER_KEY, 0, 0, 0, - ELM_WIN_KEYGRAB_EXCLUSIVE); + elm_win_keygrab_set(as_eo(*m_win), impl::STR_POWER_KEY, 0, 0, 0, + ELM_WIN_KEYGRAB_TOPMOST); m_keyUpEventHandler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, CALLBACK_A(Instance::onKeyUpEventCb), this); + m_keyDownEventHandler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, + CALLBACK_A(Instance::onKeyDownEventCb), this); + if (!m_keyUpEventHandler) { LOG_RETURN(RES_FAIL, "m_eventHandler is NULL"); } @@ -94,23 +103,30 @@ namespace callui { m_win->getConformant().setContent(*m_navi); - FAIL_RETURN(createCircleSurface(*m_navi), + auto &atspi = m_win->getAtspi(); + atspi.setTDomain(TEXT_DOMAIN); + atspi.setName(AO_STR_CALL); + + FAIL_RETURN(utils::createCircleSurface(*m_navi), "createCircleSurface() failed!"); - m_sysEventProvider.addEventHandler( - WEAK_DELEGATE(Instance::onSysEvent, asWeak(*this))); + m_sysEventProvider.addEventHandler(WEAK_DELEGATE_THIS(onSysEvent)); return RES_OK; } void Instance::onPause() { - ILOG("PAUSED"); + DLOG("PAUSE"); + + setInstancePaused(*m_win, true); } void Instance::onResume() { - ILOG("RESUMED"); + DLOG("RESUME"); + + setInstancePaused(*m_win, false); } void Instance::onAppControl(app_control_h appControl) @@ -119,8 +135,7 @@ namespace callui { auto page = MainPage::Builder(). setNaviframe(m_navi). setCallUI(m_call). - build(WEAK_DELEGATE(Instance::onPageExitRequest, - asWeak(this))); + build(WEAK_DELEGATE_THIS(onPageExitRequest)); if (!page) { ELOG("Create page failed! Exit application"); m_context->exitApp(); @@ -133,11 +148,13 @@ namespace callui { if (res != RES_OK) { ELOG("processAppControl() failed!"); ICallManagerSRef callManager = m_call->getCallManager(); - if (!callManager->getAvailableCalls()) { + if (getAvailableCalls(callManager) == CALL_FLAG_NONE) { ILOG("No calls. Exit application"); m_context->exitApp(); } } + + updateAppLanguage(false); } Result Instance::setupTheme() @@ -154,42 +171,112 @@ namespace callui { return RES_OK; } + Eina_Bool Instance::onKeyDownEventCb(int type, void *event) + { + if (!event) { + LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_PASS_ON, "event is NULL"); + } + + Ecore_Event_Key *ev = static_cast<Ecore_Event_Key *>(event); + if (!strcmp(ev->keyname, impl::STR_POWER_KEY)) { + DLOG("Key Power [Down]"); + return processPowerKeyDownEvent(); + } + return ECORE_CALLBACK_PASS_ON; + } + Eina_Bool Instance::onKeyUpEventCb(int type, void *event) { if (!event) { - LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_DONE, "event is NULL"); + LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_PASS_ON, + "event is NULL"); } Ecore_Event_Key *ev = static_cast<Ecore_Event_Key *>(event); if (!strcmp(ev->keyname, impl::STR_POWER_KEY)) { - DLOG("Key power [Up]"); - m_win->callEvent(WIN_POWER_KEY_UP_EVENT, nullptr); + DLOG("Key Power [Up]"); + return processPowerKeyUpEvent(); } + return ECORE_CALLBACK_PASS_ON; + } + + Eina_Bool Instance::processPowerKeyDownEvent() + { + m_ignorePowerClick = isInstancePaused(*m_win); + if (m_ignorePowerClick) { + DLOG("Ignored. Instance is in pause state"); + return ECORE_CALLBACK_PASS_ON; + } + + m_powerKeyHoldTimout = Timeout::create( + impl::POWER_KEY_HOLD_TIMEOUT, + WEAK_DELEGATE_THIS(onPowerKeyHoldTimeout)); + return ECORE_CALLBACK_DONE; } + Eina_Bool Instance::processPowerKeyUpEvent() + { + if (m_ignorePowerClick) { + DLOG("Ignored."); + return ECORE_CALLBACK_PASS_ON; + } + + PowerBtnEventInfo eventInfo; + m_win->callEvent(WIN_POWER_KEY_UP_EVENT, &eventInfo); + + return ECORE_CALLBACK_DONE; + } + + void Instance::onPowerKeyHoldTimeout(Timeout *sender) + { + m_ignorePowerClick = true; + m_powerKeyHoldTimout.reset(); + } + void Instance::onPageExitRequest(Page &page) { m_context->exitApp(); } + void Instance::onSysEvent(const SysEvent sysEvent) { switch(sysEvent) { case SysEvent::LANGUAGE_CHANGED: + { ILOG("SysEvent::LANGUAGE_CHANGED"); - { - char *locale = NULL; - system_settings_get_value_string( - SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); - elm_language_set(locale); - free(locale); - } + FAIL_RETURN_VOID(updateAppLanguage(), + "updateAppLanguage() failed!"); break; + } default: ILOG("sysEvent: %d", sysEvent); break; } } + Result Instance::updateAppLanguage(bool needNotify) + { + char *locale = NULL; + system_settings_get_value_string( + SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, + &locale); + elm_language_set(locale); + + Result res = isLTRCharacterOrientation(locale); + if (res == RES_FAIL) { + ELOG("isLTRCharacterOrientation() failed!"); + } else { + utils::setMirroredMode(res == RES_OK ? false : true); + } + free(locale); + + if (needNotify) { + m_win->callEvent(WIN_LANGUAGE_CHANGED, nullptr); + } + + return res; + } + } diff --git a/inc/presenters/Instance.h b/call-ui/presenters/Instance.h index 0c15077..03f6ced 100644 --- a/inc/presenters/Instance.h +++ b/call-ui/presenters/Instance.h @@ -14,17 +14,19 @@ * limitations under the License. */ -#ifndef __CALLUI_PRESENTERS_INSTANCE_H__ -#define __CALLUI_PRESENTERS_INSTANCE_H__ +#ifndef __CALL_UI_PRESENTERS_INSTANCE_H__ +#define __CALL_UI_PRESENTERS_INSTANCE_H__ #include "ucl/appfw/IInstance.h" #include "ucl/appfw/IInstanceAppControlExt.h" #include "ucl/appfw/SysEventProvider.h" - #include "ucl/gui/Theme.h" #include "ucl/gui/Naviframe.h" +#include "ucl/misc/Timeout.h" + +#include "call-ui/model/ICallUI.h" -#include "types.h" +#include "pages/base/Page.h" namespace callui { @@ -53,7 +55,13 @@ namespace callui { void onSysEvent(const ucl::SysEvent sysEvent); void onPageExitRequest(Page &page); + Eina_Bool onKeyDownEventCb(int type, void *event); Eina_Bool onKeyUpEventCb(int type, void *event); + Eina_Bool processPowerKeyDownEvent(); + Eina_Bool processPowerKeyUpEvent(); + void onPowerKeyHoldTimeout(ucl::Timeout *sender); + + ucl::Result updateAppLanguage(bool needNotify = true); private: ucl::SysEventProvider &m_sysEventProvider; @@ -68,7 +76,11 @@ namespace callui { PageWRef m_page; Ecore_Event_Handler *m_keyUpEventHandler; + Ecore_Event_Handler *m_keyDownEventHandler; + ucl::TimeoutSRef m_powerKeyHoldTimout; + + bool m_ignorePowerClick; }; } -#endif // __CALLUI_PRESENTERS_INSTANCE_H__ +#endif // __CALL_UI_PRESENTERS_INSTANCE_H__ diff --git a/src/presenters/InstanceManager.cpp b/call-ui/presenters/InstanceManager.cpp index 7022bed..36f5a11 100644 --- a/src/presenters/InstanceManager.cpp +++ b/call-ui/presenters/InstanceManager.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "presenters/InstanceManager.h" +#include "InstanceManager.h" -#include "presenters/Instance.h" +#include "Instance.h" namespace callui { diff --git a/inc/presenters/InstanceManager.h b/call-ui/presenters/InstanceManager.h index c58389e..11d7b83 100644 --- a/inc/presenters/InstanceManager.h +++ b/call-ui/presenters/InstanceManager.h @@ -14,10 +14,10 @@ * limitations under the License. */ -#ifndef __CALLUI_PRESENTERS_INSTANCE_MANAGER_H__ -#define __CALLUI_PRESENTERS_INSTANCE_MANAGER_H__ +#ifndef __CALL_UI_PRESENTERS_INSTANCE_MANAGER_H__ +#define __CALL_UI_PRESENTERS_INSTANCE_MANAGER_H__ -#include "types.h" +#include "call-ui/model/types.h" #include "ucl/appfw/InstanceManagerBase.h" @@ -33,4 +33,4 @@ namespace callui { }; } -#endif // __CALLUI_PRESENTERS_INSTANCE_MANAGER_H__ +#endif // __CALL_UI_PRESENTERS_INSTANCE_MANAGER_H__ diff --git a/call-ui/presenters/common.h b/call-ui/presenters/common.h new file mode 100644 index 0000000..8183203 --- /dev/null +++ b/call-ui/presenters/common.h @@ -0,0 +1,28 @@ +/* + * 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_COMMON_H__ +#define __CALL_UI_PRESENTERS_COMMON_H__ + +#include "ucl/gui/stdTheme.h" + +#include "call-ui/view/helpers.h" + +#include "misc/helpers.h" + +#include "call-ui/view/common.h" + +#endif // __CALL_UI_PRESENTERS_COMMON_H__ diff --git a/call-ui/presenters/dialogs/AcceptDialog.cpp b/call-ui/presenters/dialogs/AcceptDialog.cpp new file mode 100644 index 0000000..f3d2ced --- /dev/null +++ b/call-ui/presenters/dialogs/AcceptDialog.cpp @@ -0,0 +1,213 @@ +/* + * 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 "AcceptDialog.h" + +#include "call-ui/resources.h" + +#include "call-ui/presenters/common.h" + +namespace callui { namespace { namespace impl { + + using namespace ucl; + + constexpr ElmStyle POPUP_STYLE {"circle"}; + + constexpr EdjePart PART_CIRCLE_SFC {"elm.swallow.progress"}; +}}} + +namespace callui { + + using namespace ucl; + + AcceptDialog::Builder::Builder() + { + } + + AcceptDialog::Builder & + AcceptDialog::Builder::setHandler(EventHandler handler) + { + m_handler = handler; + return *this; + } + + AcceptDialogWRef AcceptDialog::Builder::build(ElmWidget &parent) const + { + if (!m_handler) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "m_handler is NULL"); + } + + auto result = makeShared<AcceptDialog>(m_handler); + FAIL_RETURN_VALUE(result->prepare(parent), {}, + "result->prepare() failed!"); + + result->show(); + + return result; + } + + AcceptDialog::AcceptDialog(IRefCountObj &rc, + const EventHandler &handler): + Dialog(rc), + m_handler(handler), + m_circleObj(nullptr), + m_isRotaryActive(false) + { + } + + Result AcceptDialog::prepare(ElmWidget &parent) + { + FAIL_RETURN(Dialog::prepare(parent, PopupType::NORMAL, + [this]() + { + return doPrepare(); + }), + "Dialog::prepare() failed!"); + + return RES_OK; + } + + Result AcceptDialog::doPrepare() + { + m_popup->setStyle(impl::POPUP_STYLE); + + FAIL_RETURN(createList(), "createList() failed!"); + + FAIL_RETURN(createCircleObject(), "createCircleObject() failed!"); + + FAIL_RETURN(createListItems(), "createListItems() failed!"); + + return RES_OK; + } + + Result AcceptDialog::createCircleObject() + { + const auto layout = Layout::Builder(). + setIsOwner(false). + build(*m_popup); + if (!layout) { + LOG_RETURN(RES_FAIL, "Layout::build() failed!"); + } + m_popup->setContent(*layout, impl::PART_CIRCLE_SFC); + + auto surface = eext_circle_surface_layout_add(as_eo(*layout)); + + m_circleObj = eext_circle_object_genlist_add( + as_eo(m_listPresenter->getWidget()), surface); + + eext_circle_object_genlist_scroller_policy_set(m_circleObj, + ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + + updateRotaryActiveState(); + + return RES_OK; + } + + Result AcceptDialog::createList() + { + m_listPresenter = ListPresenter::Builder(). + setParentWidget(m_popup). + build(*this); + if (!m_listPresenter) { + LOG_RETURN(RES_FAIL, "ListPresenter::build() failed!"); + } + m_popup->setContent(m_listPresenter->getWidget()); + + return RES_OK; + } + + ucl::Result AcceptDialog::createListItems() + { + FAIL_RETURN(m_listPresenter->append( + *makeTitleListItem(STR_ANSWER_CALL)), + "m_listPresenter->append failed!"); + + FAIL_RETURN(m_listPresenter->append( + *makeMenuListItem(STR_HOLD_AND_ACCEPT, + WEAK_DELEGATE_THIS(onHoldAndAcceptItemSelected))), + "m_listPresenter->append failed!"); + + FAIL_RETURN(m_listPresenter->append( + *makeMenuListItem(STR_END_AND_ACCEPT, + WEAK_DELEGATE_THIS(onEndAndAcceptItemSelected))), + "m_listPresenter->append failed!"); + + FAIL_RETURN(m_listPresenter->append(*makePaddingListItem()), + "m_listPresenter->append failed!"); + + return RES_OK; + } + + void AcceptDialog::onHoldAndAcceptItemSelected() + { + handleEvent(Event::HOLD_AND_ACCEPT); + } + + void AcceptDialog::onEndAndAcceptItemSelected() + { + handleEvent(Event::END_AND_ACCEPT); + } + + void AcceptDialog::handleEvent(Event event) + { + const auto keepAliver = asShared(*this); + if (dispatchEvent(event)) { + dismiss(); + } + } + + bool AcceptDialog::dispatchEvent(Event event) + { + if (const auto handler = m_handler.lock()) { + return handler(*this, event); + } + WLOG("Handler was destroyed!"); + return true; + } + + void AcceptDialog::onBackKey() + { + handleEvent(Event::BACK); + } + + bool AcceptDialog::isNeedRotaryActivate() const + { + return isActive(); + } + + void AcceptDialog::updateRotaryActiveState() + { + if (m_circleObj) { + const bool needActivate = isNeedRotaryActivate(); + if (needActivate != m_isRotaryActive) { + m_isRotaryActive = needActivate; + eext_rotary_object_event_activated_set(m_circleObj, + toEina(needActivate)); + } + } + } + + void AcceptDialog::onActivate() + { + updateRotaryActiveState(); + } + + void AcceptDialog::onDeactivate() + { + updateRotaryActiveState(); + } + +} diff --git a/call-ui/presenters/dialogs/AcceptDialog.h b/call-ui/presenters/dialogs/AcceptDialog.h new file mode 100644 index 0000000..6c627d0 --- /dev/null +++ b/call-ui/presenters/dialogs/AcceptDialog.h @@ -0,0 +1,115 @@ +/* + * 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_ACCEPT_DIALOG_H__ +#define __CALL_UI_PRESENTERS_DIALOGS_ACCEPT_DIALOG_H__ + +#include "base/Dialog.h" + +#include "ucl/mvp/ListPresenter.h" + +#include "call-ui/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(AcceptDialog); + + /** + * @brief Presenter of Accept call dialog + */ + class AcceptDialog final : public Dialog { + public: + + /** + * @brief Enumeration of dialog events + */ + enum class Event { + HOLD_AND_ACCEPT, /**< Set active call on hold and accept incoming */ + END_AND_ACCEPT, /**< End active call and accept incoming */ + BACK /**< Back button event */ + }; + + /** + * @brief Dialog event handler definition + */ + using EventHandler = ucl::WeakDelegate<bool(AcceptDialog &, Event)>; + + public: + + /** + * AcceptDialog builder + */ + class Builder { + public: + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets event handler + * @param[in] handler Event handler + * @return Reference to builder + */ + Builder &setHandler(EventHandler handler); + + /** + * @brief Builds AcceptDialog + * @param[in] parent Parent widget for dialog + * @return Weak reference to AcceptDialog + */ + AcceptDialogWRef build(ucl::ElmWidget &parent) const; + private: + EventHandler m_handler; + }; + + private: + AcceptDialog(ucl::IRefCountObj &rc, const EventHandler &handler); + ~AcceptDialog() = default; + + ucl::Result prepare(ucl::ElmWidget &parent); + ucl::Result doPrepare(); + + ucl::Result createList(); + ucl::Result createCircleObject(); + ucl::Result createListItems(); + void onHoldAndAcceptItemSelected(); + void onEndAndAcceptItemSelected(); + + void handleEvent(Event event); + bool dispatchEvent(Event event); + + bool isNeedRotaryActivate() const; + void updateRotaryActiveState(); + + // Dialog // + + virtual void onBackKey() override final; + virtual void onActivate() override final; + virtual void onDeactivate() override final; + + private: + const EventHandler m_handler; + + ucl::ListPresenterSRef m_listPresenter; + Evas_Object *m_circleObj; + bool m_isRotaryActive; + + friend class ucl::ReffedObj<AcceptDialog>; + }; +} + +#endif // __CALL_UI_PRESENTERS_DIALOGS_ACCEPT_DIALOG_H__ diff --git a/call-ui/presenters/dialogs/base/Dialog.cpp b/call-ui/presenters/dialogs/base/Dialog.cpp new file mode 100644 index 0000000..5236a66 --- /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(as_eo(parent)) : + elm_ctxpopup_add(as_eo(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(popupEo, 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(as_eo(*m_popup)); + onDismiss(); + } + } + + void Dialog::dispose() + { + if (m_popup) { + eext_object_event_callback_del(as_eo(*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/presenters/items/RejectMsgListItem.cpp b/call-ui/presenters/items/RejectMsgListItem.cpp new file mode 100644 index 0000000..c4e547a --- /dev/null +++ b/call-ui/presenters/items/RejectMsgListItem.cpp @@ -0,0 +1,86 @@ +/* + * 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 "RejectMsgListItem.h" + +#include "call-ui/presenters/common.h" + +namespace callui { namespace { namespace impl { + + constexpr ElmStyle ITEM_STYLE {"1text"}; + + constexpr EdjePart ITEM_PART_TITLE {"elm.text"}; + + CString getDisplayText(std::string rejectMsgTxt) + { + auto trnsTxt = TString{std::move(rejectMsgTxt), true}.translate(); + auto markupTxt = elm_entry_utf8_to_markup(trnsTxt); + std::string resStr(markupTxt); + free(markupTxt); + + replaceSubstringInString(resStr, "<br/>", " "); + + return CString::dup(resStr.c_str()); + } +}}} + +namespace callui { + + RejectMsgListItem::RejectMsgListItem(IRefCountObj &rc, + IRejectMsgSRef rm, + SelectHandler handler, + Private) : + ListItemPresenter::ListItemPresenter(rc), + m_rm(std::move(rm)), + m_onItemSelected(std::move(handler)) + { + UCL_ASSERT(m_rm, "m_rm is NULL"); + UCL_ASSERT(m_onItemSelected, "m_onItemSelected is NULL"); + } + + RejectMsgListItemSRef RejectMsgListItem::newInstance(IRejectMsgSRef rm, + SelectHandler handler) + { + return makeShared<RejectMsgListItem>( + std::move(rm), + std::move(handler), PRIVATE); + } + + ListItemPresenter::ItemInsertionParams + RejectMsgListItem::getItemInsertionParams() + { + return impl::ITEM_STYLE; + } + + CString RejectMsgListItem::getItemPartText(EdjePart part) + { + if (part == impl::ITEM_PART_TITLE) { + return impl::getDisplayText(m_rm->getText()); + } + + return nullptr; + } + + void RejectMsgListItem::onItemSelected() + { + if (isActive()) { + if (const auto handler = m_onItemSelected.lock()) { + handler(m_rm); + } + } + } + +} diff --git a/call-ui/presenters/items/RejectMsgListItem.h b/call-ui/presenters/items/RejectMsgListItem.h new file mode 100644 index 0000000..d9c68b2 --- /dev/null +++ b/call-ui/presenters/items/RejectMsgListItem.h @@ -0,0 +1,84 @@ +/* + * 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_ITEMS_REJECT_MSG_LIST_ITEM_H__ +#define __CALL_UI_PRESENTERS_ITEMS_REJECT_MSG_LIST_ITEM_H__ + +#include "ucl/mvp/ListItemPresenter.h" + +#include "call-ui/model/IRejectMsg.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(RejectMsgListItem); + + class RejectMsgListItem final : public ucl::ListItemPresenter { + public: + + /** + * @brief Item select handler definition + */ + using SelectHandler = ucl::WeakDelegate<void( + const IRejectMsgSRef &rm)>; + + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + * @param[in] rm Reject message instance + * @param[in] handler Item select handler + * @return Shared reference to RejectMsgListItem on success otherwise NULL + */ + static RejectMsgListItemSRef newInstance(IRejectMsgSRef rm, + SelectHandler handler); + + protected: + + // ListItemPresenter // + + /** + * @see ucl::ListItemPresenter::getItemInsertionParams() + */ + virtual ItemInsertionParams getItemInsertionParams() override; + + /** + * @see ucl::ListItemPresenter::getItemPartText() + */ + virtual ucl::CString getItemPartText(ucl::EdjePart part) override; + + /** + * @see ucl::ListItemPresenter::onItemSelected() + */ + virtual void onItemSelected() override; + + private: + RejectMsgListItem(ucl::IRefCountObj &rc, + IRejectMsgSRef rm, + RejectMsgListItem::SelectHandler handler, + Private); + ~RejectMsgListItem() = default; + + private: + const IRejectMsgSRef m_rm; + + SelectHandler m_onItemSelected; + + friend class ucl::ReffedObj<RejectMsgListItem>; + }; +} + +#endif // __CALL_UI_PRESENTERS_ITEMS_REJECT_MSG_LIST_ITEM_H__ diff --git a/call-ui/presenters/items/SimpleListItem.cpp b/call-ui/presenters/items/SimpleListItem.cpp new file mode 100644 index 0000000..e34dc1d --- /dev/null +++ b/call-ui/presenters/items/SimpleListItem.cpp @@ -0,0 +1,76 @@ +/* + * 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 "SimpleListItem.h" + +#include "call-ui/presenters/common.h" + +namespace callui { + + using ucl::ListItemPresenter; + + SimpleListItem::SimpleListItem(IRefCountObj &rc, ElmStyle style, + PartTextMap parts, bool useAtspiRedundant) : + ListItemPresenter::ListItemPresenter(rc), + m_listItemStyle(style), + m_listItemParts(std::move(parts)), + m_useAtspiRedundant(useAtspiRedundant) + { + } + + SimpleListItem::SimpleListItem(IRefCountObj &rc, ElmStyle style) : + ListItemPresenter::ListItemPresenter(rc), + m_listItemStyle(style), + m_useAtspiRedundant(true) + { + } + + void SimpleListItem::setItemSelectHandler(NotiHandler handler) + { + m_onItemSelected = std::move(handler); + } + + ListItemPresenter::ItemInsertionParams + SimpleListItem::getItemInsertionParams() + { + return m_listItemStyle; + } + + CString SimpleListItem::getItemPartText(EdjePart part) + { + TString text; + if (!m_listItemParts.get(part, text)) + return nullptr; + + return CString::dup(text.translate()); + } + + void SimpleListItem::onItemSelected() + { + if (isActive()) { + if (const auto handler = m_onItemSelected.lock()) { + handler(); + } + } + } + + void SimpleListItem::onItemAttached() + { + if (m_useAtspiRedundant) { + getItemAtspi()->setRole(ELM_ATSPI_ROLE_REDUNDANT_OBJECT); + } + } +} diff --git a/call-ui/presenters/items/SimpleListItem.h b/call-ui/presenters/items/SimpleListItem.h new file mode 100644 index 0000000..2ec4a9a --- /dev/null +++ b/call-ui/presenters/items/SimpleListItem.h @@ -0,0 +1,94 @@ +/* + * 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_ITEMS_SIMPLE_LIST_ITEM_H__ +#define __CALL_UI_PRESENTERS_ITEMS_SIMPLE_LIST_ITEM_H__ + +#include "ucl/mvp/ListItemPresenter.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(SimpleListItem); + + class SimpleListItem final : public ucl::ListItemPresenter { + public: + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + * @param[in] style Item style + * @param[in] parts Map of item text parts value + * @param[in] useAtspiRedundant true - if item is Atspi redundant object, + * false - otherwise + */ + SimpleListItem(ucl::IRefCountObj &rc, ucl::ElmStyle style, + PartTextMap parts, bool useAtspiRedundant = false); + + /** + * @brief Constructor + * @details Constructor that creates items already as Atspi redundant + * object + * @param[in] rc Pointer to IRefCountObj (passed automatically) + * @param[in] style Item style + */ + SimpleListItem(ucl::IRefCountObj &rc, ucl::ElmStyle style); + + /** + * @brief Sets item select handler + * @param[in] handler Select handler + */ + void setItemSelectHandler(NotiHandler handler); + + protected: + + // ListItemPresenter // + + /** + * @see ucl::ListItemPresenter::getItemInsertionParams() + */ + virtual ItemInsertionParams getItemInsertionParams() override; + + /** + * @see ucl::ListItemPresenter::getItemPartText() + */ + virtual ucl::CString getItemPartText(ucl::EdjePart part) override; + + /** + * @see ucl::ListItemPresenter::onItemSelected() + */ + virtual void onItemSelected() override; + + /** + * @see ucl::ListItemPresenter::onItemAttached() + */ + virtual void onItemAttached() override; + + private: + ~SimpleListItem() = default; + + private: + const ucl::ElmStyle m_listItemStyle; + const PartTextMap m_listItemParts; + + NotiHandler m_onItemSelected; + bool m_useAtspiRedundant; + + friend class ucl::ReffedObj<SimpleListItem>; + }; +} + +#endif // __CALL_UI_PRESENTERS_ITEMS_SIMPLE_LIST_ITEM_H__ diff --git a/src/presenters/AcceptRejectPresenter.cpp b/call-ui/presenters/misc/AcceptRejectPresenter.cpp index 831637b..e9132bd 100644 --- a/src/presenters/AcceptRejectPresenter.cpp +++ b/call-ui/presenters/misc/AcceptRejectPresenter.cpp @@ -14,38 +14,25 @@ * limitations under the License. */ -#include "presenters/AcceptRejectPresenter.h" +#include "AcceptRejectPresenter.h" -#include "model/IIncomingCall.h" -#include "model/ISoundManager.h" - -#include "presenters/AcceptDialog.h" -#include "presenters/MotionSensorPresenter.h" - -#include "view/AcceptRejectWidget.h" - -#include "common.h" +#include "call-ui/presenters/common.h" namespace callui { using namespace ucl; - // AcceptRejectPresenter::Builder + // AcceptRejectPresenter::Builder // AcceptRejectPresenter::Builder::Builder(): m_callMask(CALL_FLAG_NONE) { } - AcceptRejectPresenter::Builder::~Builder() - { - } - AcceptRejectPresenter::Builder & - AcceptRejectPresenter::Builder::setIncomingCall( - const IIncomingCallSRef &call) + AcceptRejectPresenter::Builder::setIncomingCall(IIncomingCallSRef call) { - m_call = call; + m_call = std::move(call); return *this; } @@ -57,18 +44,16 @@ namespace callui { } AcceptRejectPresenter::Builder & - AcceptRejectPresenter::Builder::setSoundManager( - const ISoundManagerSRef &sm) + AcceptRejectPresenter::Builder::setSoundManager(ISoundManagerSRef sm) { - m_sm = sm; + m_sm = std::move(sm); return *this; } AcceptRejectPresenter::Builder & - AcceptRejectPresenter::Builder::setParentWidget( - const ElmWidgetSRef &parentWidget) + AcceptRejectPresenter::Builder::setParentWidget(ElmWidgetSRef parentWidget) { - m_parentWidget = parentWidget; + m_parentWidget = std::move(parentWidget); return *this; } @@ -87,16 +72,16 @@ namespace callui { return result; } - // AcceptRejectPresenter + // AcceptRejectPresenter // AcceptRejectPresenter::AcceptRejectPresenter(IRefCountObj &rc, - const IIncomingCallSRef &call, + IIncomingCallSRef call, CallMask calls, - const ISoundManagerSRef &sm): - GuiPresenter(rc), - m_call(call), - m_callMask(calls), - m_sm(sm) + ISoundManagerSRef sm): + GuiPresenter(rc), + m_call(std::move(call)), + m_sm(std::move(sm)), + m_callMask(calls) { } @@ -111,9 +96,7 @@ namespace callui { } m_sm->delBTHeadsetConnectionChangeHandler( - WEAK_DELEGATE(AcceptRejectPresenter:: - onBTHeadsetConnectionChanged, - asWeak(*this))); + DELEGATE_THIS(onBTHeadsetConnectionChanged)); } Result AcceptRejectPresenter::prepare(GuiPresenter &parent, @@ -123,9 +106,7 @@ namespace callui { "Presenter::prepare() failed!"); m_sm->addBTHeadsetConnectionChangeHandler( - WEAK_DELEGATE(AcceptRejectPresenter:: - onBTHeadsetConnectionChanged, - asWeak(*this))); + WEAK_DELEGATE_THIS(onBTHeadsetConnectionChanged)); FAIL_RETURN(createWidget(parentWidget), "createWidget() failed!"); @@ -157,12 +138,8 @@ namespace callui { Result AcceptRejectPresenter::createWidget(ElmWidget &parent) { m_widget = AcceptRejectWidget::Builder(). - setAcceptEventHandler(WEAK_DELEGATE( - AcceptRejectPresenter::onAcceptEvent, - asWeak(*this))). - setRejectEventHandler(WEAK_DELEGATE( - AcceptRejectPresenter::onRejectEvent, - asWeak(*this))). + setAcceptEventHandler(WEAK_DELEGATE_THIS(onAcceptEvent)). + setRejectEventHandler(WEAK_DELEGATE_THIS(onRejectEvent)). setAcceptBtnType(m_sm->isBTHeadsetConnected() ? AcceptButtonType::BT_HEADSET : AcceptButtonType::SIMPLE). @@ -179,8 +156,7 @@ namespace callui { Result AcceptRejectPresenter::createMotionSensorPresenter() { m_motionPrs = MotionSensorPresenter::Builder(). - build(WEAK_DELEGATE(AcceptRejectPresenter::onMotionEvent, - asWeak(*this))); + build(WEAK_DELEGATE_THIS(onMotionEvent)); if (!m_motionPrs) { LOG_RETURN(RES_FAIL, @@ -214,18 +190,18 @@ namespace callui { } bool AcceptRejectPresenter::onAcceptPopupEvent(AcceptDialog &popup, - AcceptDialogEvent event) + AcceptDialog::Event event) { m_widget->reset(); switch (event) { - case AcceptDialogEvent::HOLD_AND_ACCEPT: + case AcceptDialog::Event::HOLD_AND_ACCEPT: FAIL_RETURN_VALUE( m_call->answer(CallAnswerType::HOLD_ACTIVE_AND_ACCEPT), true, "incom->answer() failed!"); return false; - case AcceptDialogEvent::END_AND_ACCEPT: + case AcceptDialog::Event::END_AND_ACCEPT: FAIL_RETURN_VALUE( m_call->answer(CallAnswerType::RELEASE_ACTIVE_AND_ACCEPT), true, @@ -240,9 +216,7 @@ namespace callui { { if (!m_popup) { m_popup = AcceptDialog::Builder(). - setHandler(WEAK_DELEGATE( - AcceptRejectPresenter::onAcceptPopupEvent, - asWeak(*this))). + setHandler(WEAK_DELEGATE_THIS(onAcceptPopupEvent)). build(*m_widget); } else { WLOG("Popup already shown!"); @@ -278,5 +252,13 @@ namespace callui { AcceptButtonType::SIMPLE); } + ElmWidget *AcceptRejectPresenter::getAcceptAo() + { + return m_widget->getAcceptAo(); + } + ElmWidget *AcceptRejectPresenter::getRejectAo() + { + return m_widget->getRejectAo(); + } } diff --git a/call-ui/presenters/misc/AcceptRejectPresenter.h b/call-ui/presenters/misc/AcceptRejectPresenter.h new file mode 100644 index 0000000..825f89e --- /dev/null +++ b/call-ui/presenters/misc/AcceptRejectPresenter.h @@ -0,0 +1,164 @@ +/* + * 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_MISC_ACCEPT_REJECT_PRESENTER_H__ +#define __CALL_UI_PRESENTERS_MISC_ACCEPT_REJECT_PRESENTER_H__ + +#include "ucl/mvp/GuiPresenter.h" + +#include "ucl/gui/Layout.h" +#include "ucl/gui/StyledWidget.h" + +#include "call-ui/model/IIncomingCall.h" +#include "call-ui/model/ISoundManager.h" +#include "call-ui/view/AcceptRejectWidget.h" +#include "call-ui/presenters/dialogs/AcceptDialog.h" +#include "MotionSensorPresenter.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(AcceptRejectPresenter); + + /** + * @brief Presenter of Accept / Reject call widget + */ + class AcceptRejectPresenter final : public ucl::GuiPresenter { + public: + /** + * @brief AcceptRejectPresenter builder + */ + class Builder { + public: + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets Incoming Call instance + * @param[in] call Incoming Call instance + * @return Reference to builder + */ + Builder &setIncomingCall(IIncomingCallSRef call); + + /** + * @brief Sets Sound Manager instance + * @param[in] sm Sound Manager instance + * @return Reference to builder + */ + Builder &setSoundManager(ISoundManagerSRef sm); + + /** + * @brief Sets available calls flag + * @param[in] calls Available calls flag + * @return Reference to builder + */ + Builder &setAvailableCallsFlag(CallMask calls); + + /** + * @brief Sets parent widget for UI components creation + * @param[in] parentWidget Parent widget + * @return Reference to builder + */ + Builder &setParentWidget(ucl::ElmWidgetSRef parentWidget); + + /** + * @brief Creates new instance of AcceptRejectPresenter + * @param[in] parent Parent presenter + * @return Shared reference to AcceptRejectPresenter instance + * on success or NULL otherwise + */ + AcceptRejectPresenterSRef build(ucl::GuiPresenter &parent) const; + + private: + IIncomingCallSRef m_call; + CallMask m_callMask; + ucl::ElmWidgetSRef m_parentWidget; + ISoundManagerSRef m_sm; + }; + + public: + + /** + * @brief Returns widget + * @return Reference to widget + */ + ucl::Widget &getWidget(); + + /** + * @brief Updates presenter + * @param[in] calls Available calls flag + */ + void update(CallMask calls); + + /** + * @brief Gets accept button Access object + * @return Pointer to access object on success, NULL otherwise + */ + ucl::ElmWidget *getAcceptAo(); + + /** + * @brief Gets reject button Access object + * @return Pointer to access object on success, NULL otherwise + */ + ucl::ElmWidget *getRejectAo(); + + private: + AcceptRejectPresenter(ucl::IRefCountObj &rc, + IIncomingCallSRef call, + CallMask calls, + ISoundManagerSRef sm); + ~AcceptRejectPresenter(); + + ucl::Result prepare(ucl::GuiPresenter &parent, + ucl::ElmWidget &parentWidget); + + ucl::Result createWidget(ucl::ElmWidget &parent); + ucl::Result createMotionSensorPresenter(); + + void showPopup(); + + void processAccept(); + void processReject() const; + + void onMotionEvent(); + + bool onAcceptPopupEvent(AcceptDialog &popup, AcceptDialog::Event event); + void onAcceptEvent(); + void onRejectEvent(); + void onBTHeadsetConnectionChanged(); + + // GuiPresenter // + + virtual void onActivate() final override; + virtual void onDeactivate() final override; + + private: + const IIncomingCallSRef m_call; + const ISoundManagerSRef m_sm; + + AcceptRejectWidgetSRef m_widget; + AcceptDialogWRef m_popup; + MotionSensorPresenterSRef m_motionPrs; + CallMask m_callMask; + + friend class ucl::ReffedObj<AcceptRejectPresenter>; + }; +} + +#endif // __CALL_UI_PRESENTERS_MISC_ACCEPT_REJECT_PRESENTER_H__ diff --git a/call-ui/presenters/misc/AccessoryPresenter.cpp b/call-ui/presenters/misc/AccessoryPresenter.cpp new file mode 100644 index 0000000..686d735 --- /dev/null +++ b/call-ui/presenters/misc/AccessoryPresenter.cpp @@ -0,0 +1,646 @@ +/* + * 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 "AccessoryPresenter.h" + +#include "ucl/appfw/types.h" + +#include "call-ui/view/AoSequencer.h" + +#include "call-ui/resources.h" + +#include "call-ui/presenters/common.h" + +#define CU_APP_CONTROL_MIME_CONTACT "application/vnd.tizen.contact" + +namespace callui { namespace { namespace impl { + + using namespace ucl; + + constexpr LayoutTheme LAYOUT_ACCESSORY_WIDGET + {"layout", "callui", "accessory"}; + + constexpr EdjePart PART_SWL_VOLUME_SLIDER {"swl.volume_control"}; + + constexpr EdjePart PART_SWL_SLOT1 {"swl.slot.1"}; + constexpr EdjePart PART_SWL_SLOT2 {"swl.slot.2"}; + constexpr EdjePart PART_SWL_SLOT3 {"swl.slot.3"}; + + constexpr ElmStyle STYLE_BTN_VOLUME {"callui/volume"}; + constexpr ElmStyle STYLE_BTN_MUTE {"callui/mute"}; + constexpr ElmStyle STYLE_BTN_BT {"callui/bluetooth"}; + constexpr ElmStyle STYLE_BTN_ADD_CONTACT {"callui/add_contact"}; + + constexpr EdjeSignal SIGNAL_TURN_ON {"turn.on"}; + constexpr EdjeSignal SIGNAL_TURN_OFF {"turn.off"}; + + Result launchBluetoothSettings() + { + AppCtrlAuto appCtrl; + + FAIL_RETURN(util::getNz(app_control_create, appCtrl), + "app_control_create() failed!"); + + FAIL_RETURN(util::call(app_control_set_app_id, + appCtrl, "org.tizen.bluetooth"), + "app_control_set_app_id() failed!"); + + FAIL_RETURN(util::call(app_control_add_extra_data, + appCtrl, "launch-type", "call"), + "app_control_add_extra_data() failed!"); + + FAIL_RETURN(util::call(app_control_send_launch_request, + appCtrl, nullptr, nullptr), + "app_control_send_launch_request() failed!"); + + return RES_OK; + } + + Result launchAddContact(const std::string &telNumber) + { + AppCtrlAuto appCtrl; + + FAIL_RETURN(util::getNz(app_control_create, appCtrl), + "app_control_create() failed!"); + + FAIL_RETURN(util::call(app_control_set_operation, + appCtrl, APP_CONTROL_OPERATION_ADD), + "app_control_set_app_id() failed!"); + + FAIL_RETURN(util::call(app_control_set_mime, + appCtrl, CU_APP_CONTROL_MIME_CONTACT), + "app_control_set_app_id() failed!"); + + FAIL_RETURN(util::call(app_control_add_extra_data, + appCtrl, APP_CONTROL_DATA_PHONE, telNumber.c_str()), + "app_control_add_extra_data() failed!"); + + FAIL_RETURN(util::call(app_control_send_launch_request, + appCtrl, nullptr, nullptr), + "app_control_send_launch_request() failed!"); + + return RES_OK; + } +}}} + +namespace callui { + + using namespace ucl; + + AccessoryPresenter::Builder::Builder() + { + } + + AccessoryPresenter::Builder & + AccessoryPresenter::Builder::setSoundManager(ISoundManagerSRef sm) + { + m_sm = std::move(sm); + return *this; + } + + AccessoryPresenter::Builder & + AccessoryPresenter::Builder::setCallManager(ICallManagerSRef cm) + { + m_cm = std::move(cm); + return *this; + } + + AccessoryPresenter::Builder & + AccessoryPresenter::Builder::setRequestExitHandler(NotiHandler handler) + { + m_exitHandler = std::move(handler); + return *this; + } + + AccessoryPresenter::Builder & + AccessoryPresenter::Builder::setAoRequestHandler( + AoRequestHandler handler) + { + m_aoRequestHandler = std::move(handler); + return *this; + } + + AccessoryPresenter::Builder & + AccessoryPresenter::Builder::setParentWidget(ElmWidgetSRef parentWidget) + { + m_parentWidget = std::move(parentWidget); + return *this; + } + + AccessoryPresenterSRef + AccessoryPresenter::Builder::build(GuiPresenter &parent) const + { + if (!m_sm || !m_cm || !m_parentWidget || !m_aoRequestHandler) { + LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set"); + } + + auto result = makeShared<AccessoryPresenter>(m_sm, + m_exitHandler, + m_aoRequestHandler); + FAIL_RETURN_VALUE(result->prepare(parent, *m_parentWidget, m_cm), + {}, "result->prepare() failed!"); + + return result; + } + + AccessoryPresenter::AccessoryPresenter(IRefCountObj &rc, + ISoundManagerSRef sm, + NotiHandler exitHandler, + AoRequestHandler aoReqHandler): + GuiPresenter(rc), + m_sm(std::move(sm)), + m_exitHandler(std::move(exitHandler)), + m_aoRequestHandler(std::move(aoReqHandler)), + m_audioState(m_sm->getAudioState()), + m_mode(CallMode::UNDEFINED) + { + } + + AccessoryPresenter::~AccessoryPresenter() + { + unregisterCallbacks(); + } + + Result AccessoryPresenter::prepare(GuiPresenter &parent, + ElmWidget &parentWidget, const ICallManagerSRef &cm) + { + FAIL_RETURN(GuiPresenter::prepare(parent), + "Presenter::prepare() failed!"); + + FAIL_RETURN(createWidget(parentWidget), + "createWidget() failed!"); + FAIL_RETURN(createSlider(), + "createSlider() failed!"); + FAIL_RETURN(createVolumeControlPresenter(parent), + "createVolumeControlPresenter() failed!"); + FAIL_RETURN(createAtspiHighlightHelper(), + "createAtspiHighlightHelper() failed!"); + + updateCurrentVolume(); + + registerCallbacks(); + + updateMode(cm); + + FAIL_RETURN(updateModeRelativeComponents(cm), + "updateComponents() failed!"); + + return RES_OK; + } + + void AccessoryPresenter::updateMode(const ICallManagerSRef &cm) + { + m_mode = getCallMode(cm); + } + + void AccessoryPresenter::setVolumeSliderVisiblity(bool isVisible) + { + if (isVisible) { + m_widget->setContent(*m_slider, impl::PART_SWL_VOLUME_SLIDER); + show(*m_slider); + } else { + m_widget->unsetContent(impl::PART_SWL_VOLUME_SLIDER); + hide(*m_slider); + } + } + + Result AccessoryPresenter::update(const ICallManagerSRef &cm) + { + updateMode(cm); + + m_audioState = m_sm->getAudioState(); + + FAIL_RETURN(updateModeRelativeComponents(cm), + "updateModeRelativeComponents() failed!"); + + return RES_OK; + } + + Result AccessoryPresenter::updateModeRelativeComponents( + const ICallManagerSRef &cm) + { + m_volumeBtn.reset(); + m_muteBtn.reset(); + m_bluetoothBtn.reset(); + m_addContactBtn.reset(); + m_unsavedPhoneNumber.clear(); + + setVolumeSliderVisiblity(m_mode != CallMode::END); + m_voiceControl->setRotaryVisibility(m_mode != CallMode::END); + m_voiceControl->setVisible(false); + + switch (m_mode) { + case CallMode::OUTGOING: + case CallMode::DURING: + FAIL_RETURN(setActiveCallCompomnents(), + "setActiveCallCompomnents() failed!"); + registerActiveCallAoCompomnents(); + break; + case CallMode::END: + FAIL_RETURN(setEndCallCompomnents(cm), + "setEndCallCompomnents() failed!"); + registerEndCallAoCompomnents(); + break; + default: + break; + } + return RES_OK; + } + + Result AccessoryPresenter::setActiveCallCompomnents() + { + updateMaxVolume(); + updateCurrentVolume(); + + FAIL_RETURN(createVolumeBtn(), "createVolumeBtn() failed!"); + m_widget->setContent(*m_volumeBtn, impl::PART_SWL_SLOT1); + + FAIL_RETURN(createMuteBtn(), "createMuteBtn create failed!"); + m_widget->setContent(*m_muteBtn, impl::PART_SWL_SLOT3); + + FAIL_RETURN(createBluetoothBtn(), "createBluetoothBtn() failed!"); + m_widget->setContent(*m_bluetoothBtn, impl::PART_SWL_SLOT2); + + if (m_mode == CallMode::OUTGOING) { + disable(*m_muteBtn); + } else { + enable(*m_muteBtn); + } + + return RES_OK; + } + + Result AccessoryPresenter::setEndCallCompomnents(const ICallManagerSRef &cm) + { + auto endCall = cm->getEndCall(); + if (!endCall) { + FAIL_RETURN(RES_FAIL, "endCall is NULL"); + } + auto callInfo = endCall->getInfo(); + if (!callInfo) { + FAIL_RETURN(RES_FAIL, "callInfo is NULL"); + } + if (!(callInfo->isEmergency() || + callInfo->isVoiceMailNumber() || + isUnknownCaller(*callInfo)) && + !(callInfo->getConferenceMemberCount() > 1) && + !(callInfo->getContactInfo())) { + FAIL_RETURN(createAddContactBtn(), "createAddContactBtn() failed!"); + m_widget->setContent(*m_addContactBtn, impl::PART_SWL_SLOT2); + m_unsavedPhoneNumber = callInfo->getPhoneNumber(); + } + return RES_OK; + } + + + Widget &AccessoryPresenter::getWidget() + { + return *m_widget; + } + + void AccessoryPresenter::hideVolumeControls() + { + m_voiceControl->setVisible(false); + } + + Result AccessoryPresenter::createWidget(ElmWidget &parent) + { + m_widget = Layout::Builder(). + setTheme(impl::LAYOUT_ACCESSORY_WIDGET). + build(parent); + if (!m_widget) { + LOG_RETURN(RES_FAIL, "Layout::build() failed!"); + } + + setDeactivatorSink(m_widget); + + return RES_OK; + } + + Result AccessoryPresenter::createSlider() + { + m_slider = Slider::Builder(). + setMaxValue(m_sm->getMaxVolume()). + build(*m_widget); + if (!m_slider) { + LOG_RETURN(RES_FAIL, "Slider::build() failed!"); + } + m_widget->setContent(*m_slider, impl::PART_SWL_VOLUME_SLIDER); + + return RES_OK; + } + + Result AccessoryPresenter::createVolumeControlPresenter( + GuiPresenter &parent) + { + m_voiceControl = VolumeControlPresenter::Builder(). + setSoundManager(m_sm). + setRotaryVisibility(true). + setParentWidget(m_widget). + build(parent); + if (!m_voiceControl) { + LOG_RETURN(RES_FAIL, "m_voiceControl::build() failed!"); + } + + return RES_OK; + } + + Result AccessoryPresenter::createVolumeBtn() + { + Evas_Object *const eo = elm_button_add(as_eo(*m_widget)); + if (!eo) { + LOG_RETURN(RES_FAIL, "elm_button_add() failed!"); + } + m_volumeBtn = makeShared<StyledWidget>(eo); + m_volumeBtn->setStyle(impl::STYLE_BTN_VOLUME); + m_volumeBtn->addEventHandler(BTN_CLICKED, + WEAK_DELEGATE_THIS(onVolumeBtnClicked)); + show(*m_volumeBtn); + + auto &atspi = m_volumeBtn->getAtspi(); + atspi.setTDomain(TEXT_DOMAIN); + atspi.setName(STR_VOLUME); + + return RES_OK; + } + + Result AccessoryPresenter::createMuteBtn() + { + Evas_Object *const eo = elm_button_add(as_eo(*m_widget)); + if (!eo) { + LOG_RETURN(RES_FAIL, "elm_button_add() failed!"); + } + m_muteBtn = makeShared<StyledWidget>(eo); + m_muteBtn->setStyle(impl::STYLE_BTN_MUTE); + m_muteBtn->addEventHandler(BTN_CLICKED, + WEAK_DELEGATE_THIS(onMuteBtnClicked)); + show(*m_muteBtn); + + auto &atspi = m_muteBtn->getAtspi(); + atspi.setTDomain(TEXT_DOMAIN); + atspi.setName(AO_STR_MUTE); + + return RES_OK; + } + + Result AccessoryPresenter::createBluetoothBtn() + { + Evas_Object *const eo = elm_button_add(as_eo(*m_widget)); + if (!eo) { + LOG_RETURN(RES_FAIL, "elm_button_add() failed!"); + } + m_bluetoothBtn = makeShared<StyledWidget>(eo); + m_bluetoothBtn->setStyle(impl::STYLE_BTN_BT); + m_bluetoothBtn->addEventHandler(BTN_CLICKED, + WEAK_DELEGATE_THIS(onBluetoothBtnClicked)); + show(*m_bluetoothBtn); + + auto &atspi = m_bluetoothBtn->getAtspi(); + atspi.setTDomain(TEXT_DOMAIN); + if (m_audioState == AudioStateType::BT) { + m_bluetoothBtn->emit(impl::SIGNAL_TURN_ON); + atspi.setName(STR_MORE_GEAR); + } else { + m_bluetoothBtn->emit(impl::SIGNAL_TURN_OFF); + atspi.setName(STR_MORE_HEADSET); + } + + if (!m_sm->isBTSupported()) { + disable(*m_bluetoothBtn); + } + + return RES_OK; + } + + Result AccessoryPresenter::createAddContactBtn() + { + Evas_Object *const eo = elm_button_add(as_eo(*m_widget)); + if (!eo) { + LOG_RETURN(RES_FAIL, "elm_button_add() failed!"); + } + m_addContactBtn = makeShared<StyledWidget>(eo); + m_addContactBtn->setStyle(impl::STYLE_BTN_ADD_CONTACT); + m_addContactBtn->addEventHandler(BTN_CLICKED, + WEAK_DELEGATE_THIS(onAddContactBtnClicked)); + show(*m_addContactBtn); + + auto &atspi = m_addContactBtn->getAtspi(); + atspi.setTDomain(TEXT_DOMAIN); + atspi.setName(AO_STR_ADD_TO_CONTACTS); + + return RES_OK; + } + + void AccessoryPresenter::onVolumeBtnClicked(Widget &widget, void *eventInfo) + { + if (!isActive()) { + ILOG("Ignored. Presenter is not active"); + return; + } + + m_voiceControl->setVisible(true); + } + + void AccessoryPresenter::onMuteBtnClicked(Widget &widget, void *eventInfo) + { + if (!isActive()) { + ILOG("Ignored. Presenter is not active"); + return; + } + + m_sm->setMuteState(!m_sm->getMuteState()); + } + + void AccessoryPresenter::onBluetoothBtnClicked(Widget &widget, + void *eventInfo) + { + if (m_audioState == AudioStateType::BT) { + auto res = m_sm->setBluetoothState(false); + if (res != RES_OK && res != RES_NOT_CONNECTED) { + FAIL_RETURN_VOID(res, "setBluetoothState(false) failed!"); + } + } else { + auto res = m_sm->setBluetoothState(true); + if (res == RES_NOT_CONNECTED) { + DLOG("Launch bluetooth settings..."); + FAIL_RETURN_VOID(impl::launchBluetoothSettings(), + "launchBluetoothSettings() failed!"); + } else { + FAIL_RETURN_VOID(res, "setBluetoothState(true) failed!"); + } + } + } + + void AccessoryPresenter::onAddContactBtnClicked(Widget &widget, + void *eventInfo) + { + Result res = impl::launchAddContact(m_unsavedPhoneNumber); + if (res != RES_OK) { + RESLOG(res, "launchAddContact() failed!"); + } + + if (const auto handler = m_exitHandler.lock()) { + handler(); + } + } + + void AccessoryPresenter::registerCallbacks() + { + m_sm->addAudioStateHandler(WEAK_DELEGATE_THIS(onAudioStateChanged)); + m_sm->addVolumeStateHandler(WEAK_DELEGATE_THIS(onVolumeLevelChanged)); + m_sm->addMuteStateHandler(WEAK_DELEGATE_THIS(onMuteStateChanged)); + } + + void AccessoryPresenter::unregisterCallbacks() + { + m_sm->delAudioStateHandler(DELEGATE_THIS(onAudioStateChanged)); + m_sm->delVolumeStateHandler(DELEGATE_THIS(onVolumeLevelChanged)); + m_sm->delMuteStateHandler(DELEGATE_THIS(onMuteStateChanged)); + } + + void AccessoryPresenter::onAudioStateChanged() + { + auto state = m_sm->getAudioState(); + + if ((m_audioState != AudioStateType::BT && + state == AudioStateType::BT) || + (m_audioState == AudioStateType::BT && + state != AudioStateType::BT)) { + m_audioState = state; + + updateMaxVolume(); + updateCurrentVolume(); + + if (m_bluetoothBtn) { + if (m_audioState == AudioStateType::BT) { + m_bluetoothBtn->emit(impl::SIGNAL_TURN_ON); + m_bluetoothBtn->getAtspi().setName(STR_MORE_GEAR); + } else { + m_bluetoothBtn->emit(impl::SIGNAL_TURN_OFF); + m_bluetoothBtn->getAtspi().setName(STR_MORE_HEADSET); + } + } + } + } + + void AccessoryPresenter::updateCurrentVolume() + { + m_slider->setValue(m_sm->getVolume()); + } + + void AccessoryPresenter::updateMaxVolume() + { + m_slider->setMaxValue(m_sm->getMaxVolume()); + } + + void AccessoryPresenter::onVolumeLevelChanged() + { + updateCurrentVolume(); + } + + void AccessoryPresenter::onMuteStateChanged() + { + if (!m_muteBtn) { + return; + } + + if (m_muteBtn->isEnabled()) { + updateMuteBtn(); + } + } + + void AccessoryPresenter::updateMuteBtn() + { + if (!m_muteBtn) { + return; + } + + m_sm->getMuteState() ? m_muteBtn->emit(impl::SIGNAL_TURN_ON) : + m_muteBtn->emit(impl::SIGNAL_TURN_OFF); + } + + Result AccessoryPresenter::createAtspiHighlightHelper() + { + m_atspiHelper = AtspiHighlightHelper::newInstance(*this); + if (!m_atspiHelper) { + LOG_RETURN(RES_FAIL, + "AtspiHighlightHelper::newInstance() failed!"); + } + + m_atspiHelper->setEventHandler( + WEAK_DELEGATE_THIS(onAtspiHighlight)); + + return RES_OK; + } + + const Elm_Interface_Atspi_Accessible *AccessoryPresenter::onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + AoSequencer seq(ao, flowRelation); + + switch (m_mode) { + case CallMode::OUTGOING: + case CallMode::DURING: + return seq.process(requestNextAo(false)). + process(m_volumeBtn). + process(m_bluetoothBtn). + process(m_muteBtn). + process(requestNextAo(true)). + getNext(); + case CallMode::END: + return seq.process(requestNextAo(false)). + process(m_addContactBtn). + process(requestNextAo(true)). + getNext(); + default: + break; + } + + return nullptr; + } + + void AccessoryPresenter::registerActiveCallAoCompomnents() + { + m_atspiHelper->registerObject(*m_volumeBtn); + m_atspiHelper->registerObject(*m_bluetoothBtn); + m_atspiHelper->registerObject(*m_muteBtn); + } + + void AccessoryPresenter::registerEndCallAoCompomnents() + { + m_atspiHelper->registerObject(*m_addContactBtn); + } + + Elm_Interface_Atspi_Accessible *AccessoryPresenter::requestNextAo( + bool isFlowsTo) + { + if (const auto handler = m_aoRequestHandler.lock()) { + return handler(isFlowsTo); + } + return nullptr; + } + + Elm_Interface_Atspi_Accessible *AccessoryPresenter::getNextAo( + bool isFlowsTo) + { + if (m_mode == CallMode::END) { + return as_ao(m_addContactBtn); + } else { + return isFlowsTo ? as_ao(m_volumeBtn) : as_ao(m_muteBtn); + } + } +} diff --git a/call-ui/presenters/misc/AccessoryPresenter.h b/call-ui/presenters/misc/AccessoryPresenter.h new file mode 100644 index 0000000..4664356 --- /dev/null +++ b/call-ui/presenters/misc/AccessoryPresenter.h @@ -0,0 +1,204 @@ +/* + * 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_MISC_ACCESSORY_PRESENTER_H__ +#define __CALL_UI_PRESENTERS_MISC_ACCESSORY_PRESENTER_H__ + +#include "ucl/mvp/GuiPresenter.h" + +#include <app_control.h> + +#include "call-ui/model/ICallManager.h" + +#include "VolumeControlPresenter.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(AccessoryPresenter); + + /** + * @brief Presenter of additional call controls. + * Provides UI controls to manipulate volume, voice mute, + * BT Headset turn on/off. + */ + class AccessoryPresenter final : public ucl::GuiPresenter { + public: + /** + * @brief AccessoryPresenter builder + */ + class Builder { + public: + + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets Sound Manager instance + * @param[in] sm Sound Manager instance + * @return Reference to builder + */ + Builder &setSoundManager(ISoundManagerSRef sm); + + /** + * @brief Sets Call Manager instance + * @param[in] cm Call Manager instance + * @return Reference to builder + */ + Builder &setCallManager(ICallManagerSRef cm); + + /** + * @brief Sets request exit application handler + * @param[in] handler Event Request exit handler + * @return Reference to builder + */ + Builder &setRequestExitHandler(NotiHandler handler); + + /** + * @brief Sets access object request handler + * @param[in] handler Access object request handler + * @return Reference to builder + */ + Builder &setAoRequestHandler(AoRequestHandler handler); + + /** + * @brief Sets parent widget for UI components creation + * @param[in] parentWidget Parent widget + * @return Reference to builder + */ + Builder &setParentWidget(ucl::ElmWidgetSRef parentWidget); + + /** + * @brief Creates new instance of AccessoryPresenter + * @param[in] parent Parent presenter + * @return Shared reference to AccessoryPresenter instance + * on success or NULL otherwise + */ + AccessoryPresenterSRef build(ucl::GuiPresenter &parent) const; + + private: + ISoundManagerSRef m_sm; + ICallManagerSRef m_cm; + ucl::ElmWidgetSRef m_parentWidget; + NotiHandler m_exitHandler; + AoRequestHandler m_aoRequestHandler; + }; + + public: + + /** + * @brief Returns widget + * @return Reference to widget + */ + ucl::Widget &getWidget(); + + /** + * @brief Force hides volume control UI components + */ + void hideVolumeControls(); + + /** + * @brief Updates presenter + * @param[in] cm Call Manager instance + * @return RES_OK on success or another result otherwise + */ + ucl::Result update(const ICallManagerSRef &cm); + + /** + * @brief Gets next ATSPI access object according to + * relation flow direction + * @param[in] isFlowsTo ATSPI highlight flow relation flag (true for + * get to next access object, false for get to previous access object) + * @return Access object pointer + */ + Elm_Interface_Atspi_Accessible *getNextAo(bool isFlowsTo); + + private: + AccessoryPresenter(ucl::IRefCountObj &rc, + ISoundManagerSRef sm, + NotiHandler exitHandler, + AoRequestHandler m_aoRequestHandler); + ~AccessoryPresenter(); + + ucl::Result prepare(ucl::GuiPresenter &parent, + ucl::ElmWidget &parentWidget, const ICallManagerSRef &cm); + + ucl::Result createWidget(ucl::ElmWidget &parent); + ucl::Result createSlider(); + ucl::Result createVolumeControlPresenter(ucl::GuiPresenter &parent); + + ucl::Result createVolumeBtn(); + ucl::Result createMuteBtn(); + ucl::Result createBluetoothBtn(); + ucl::Result createAddContactBtn(); + + void onVolumeBtnClicked(ucl::Widget &widget, void *eventInfo); + void onMuteBtnClicked(ucl::Widget &widget, void *eventInfo); + void onBluetoothBtnClicked(ucl::Widget &widget, void *eventInfo); + void onAddContactBtnClicked(ucl::Widget &widget, void *eventInfo); + + void registerCallbacks(); + void unregisterCallbacks(); + + void onAudioStateChanged(); + void onVolumeLevelChanged(); + void onMuteStateChanged(); + void updateMuteBtn(); + + void updateCurrentVolume(); + void updateMaxVolume(); + + void updateMode(const ICallManagerSRef &cm); + void setVolumeSliderVisiblity(bool isVisible); + + ucl::Result updateModeRelativeComponents(const ICallManagerSRef &cm); + ucl::Result setActiveCallCompomnents(); + ucl::Result setEndCallCompomnents(const ICallManagerSRef &cm); + + ucl::Result createAtspiHighlightHelper(); + const Elm_Interface_Atspi_Accessible *onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation); + void registerActiveCallAoCompomnents(); + void registerEndCallAoCompomnents(); + Elm_Interface_Atspi_Accessible *requestNextAo(bool isFlowsTo); + + private: + const ISoundManagerSRef m_sm; + const NotiHandler m_exitHandler; + const AoRequestHandler m_aoRequestHandler; + + ucl::LayoutSRef m_widget; + ucl::StyledWidgetSRef m_volumeBtn; + ucl::StyledWidgetSRef m_muteBtn; + ucl::StyledWidgetSRef m_bluetoothBtn; + ucl::StyledWidgetSRef m_addContactBtn; + SliderSRef m_slider; + VolumeControlPresenterSRef m_voiceControl; + AtspiHighlightHelperSRef m_atspiHelper; + + AudioStateType m_audioState; + CallMode m_mode; + std::string m_unsavedPhoneNumber; + + friend class ucl::ReffedObj<AccessoryPresenter>; + }; +} + +#endif // __CALL_UI_PRESENTERS_MISC_ACCESSORY_PRESENTER_H__ diff --git a/call-ui/presenters/misc/AtspiHighlightHelper.cpp b/call-ui/presenters/misc/AtspiHighlightHelper.cpp new file mode 100644 index 0000000..472e1b5 --- /dev/null +++ b/call-ui/presenters/misc/AtspiHighlightHelper.cpp @@ -0,0 +1,149 @@ +/* + * 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 "AtspiHighlightHelper.h" + +#include "call-ui/presenters/common.h" + +namespace callui { namespace { namespace impl { + + constexpr EoDataKey ATSPI_HELPER_DATA {"callui,atspi,highlight,helper"}; +}}} + +namespace callui { + + using ucl::Atspi; + using ucl::AtspiGestureEventInfo; + using ucl::ListItemPresenter; + + AtspiHighlightHelperSRef AtspiHighlightHelper::newInstance( + GuiPresenter &parent) + { + auto result = makeShared<AtspiHighlightHelper>(); + + FAIL_RETURN_VALUE(result->prepare(parent), {}, + "result->prepare() failed!"); + + return result; + } + + AtspiHighlightHelper::AtspiHighlightHelper(IRefCountObj &rc) : + GuiPresenter(rc) + { + } + + Result AtspiHighlightHelper::prepare(GuiPresenter &parent) + { + FAIL_RETURN(GuiPresenter::prepare(parent), + "GuiPresenter::prepare() failed!"); + + return RES_OK; + } + + void AtspiHighlightHelper::setEventHandler( + EventHandler handler) + { + m_eventHandler = handler; + } + + void AtspiHighlightHelper::registerObject(ElmWidget &widget) + { + widget.getAtspi().addGestureHandler( + WEAK_DELEGATE_THIS(onAtspiGesture)); + } + + void AtspiHighlightHelper::registerObject(ListItemPresenter &listItemPrs) + { + listItemPrs.setItemAtspiGestureHandler( + WEAK_DELEGATE_THIS(onAtspiGesture)); + } + + void AtspiHighlightHelper::handleAtspiGesture(Atspi &atspi, + AtspiGestureEventInfo &e) + { + Elm_Interface_Atspi_Accessible *currentAo = as_ao(atspi); + DLOG("Access object [%p]", currentAo); + + if (!isActive()) { + DLOG("Ignored. Presenter is not active"); + if ((e.gestureInfo.type != ELM_ATSPI_GESTURE_ONE_FINGER_SINGLE_TAP) + && (currentAo != as_ao(getWindow()))) { + DLOG("Prevent default handler"); + e.preventDefault = true; + } + return; + } + + e.stopPropagation = true; + e.preventDefault = false; + + const Elm_Atspi_Relation_Type relation = getFlowRelation(e.gestureInfo); + if (relation == ELM_ATSPI_RELATION_NULL) { + DLOG("Not supported gesture type for processing"); + return; + } + + const Elm_Interface_Atspi_Accessible *relationAo = nullptr; + if (const auto handler = m_eventHandler.lock()) { + relationAo = handler(currentAo, relation); + } + if (!relationAo) { + DLOG("Relation object is NULL"); + return; + } + DLOG("Relation object [%p]", relationAo); + + if (currentAo == as_ao(getWindow())) { + const auto fakeAtspi = getFakeAtspi(); + if (!fakeAtspi) { + LOG_RETURN_VOID(RES_FAIL, "fakeAtspi is NULL!"); + } + currentAo = as_ao(*fakeAtspi); + fakeAtspi->highlight(); + } + + Atspi currentAtspi {currentAo}; + currentAtspi.delRelationship(relation, nullptr); + currentAtspi.addRelationship(relation, relationAo); + } + + Atspi *AtspiHighlightHelper::getFakeAtspi() + { + auto &win = getWindow(); + auto widget = static_cast<ElmWidget *>(win.getData( + impl::ATSPI_HELPER_DATA)); + + if (!widget) { + const ElmWidgetSRef obj = utils::createFakeAccessObject(win); + if (!obj) { + LOG_RETURN_VALUE(RES_FAIL, nullptr, + "createFakeAccessObject() failed!"); + } + obj->setIsOwner(false); + widget = obj.get(); + win.setData(impl::ATSPI_HELPER_DATA, widget); + } + + return &widget->getAtspi(); + } + + void AtspiHighlightHelper::onAtspiGesture(Atspi &atspi, + AtspiGestureEventInfo &eventInfo) + { + handleAtspiGesture(atspi, eventInfo); + } + +} diff --git a/call-ui/presenters/misc/AtspiHighlightHelper.h b/call-ui/presenters/misc/AtspiHighlightHelper.h new file mode 100644 index 0000000..34fd742 --- /dev/null +++ b/call-ui/presenters/misc/AtspiHighlightHelper.h @@ -0,0 +1,93 @@ +/* + * 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_MISC_ATSPI_HIGHLIGHT_HELPER_H__ +#define __CALL_UI_PRESENTERS_MISC_ATSPI_HIGHLIGHT_HELPER_H__ + +#include "ucl/mvp/GuiPresenter.h" +#include "ucl/mvp/ListItemPresenter.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(AtspiHighlightHelper); + + /** + * @brief Represents helper presenter for Screen Reader feature + */ + class AtspiHighlightHelper final : public ucl::GuiPresenter { + public: + + /** + * @brief Event handler definition + */ + using EventHandler = ucl::WeakDelegate< + const Elm_Interface_Atspi_Accessible *( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation)>; + + public: + + /** + * @brief Creates new instance of AtspiHighlightHelper + * @param[in] parent Parent presenter + * @return Shared reference to AtspiHighlightHelper instance + * on success or NULL otherwise + */ + static AtspiHighlightHelperSRef newInstance(GuiPresenter &parent); + + /** + * @brief Sets event handler + * @param[in] handler Event handler + */ + void setEventHandler(EventHandler handler); + + /** + * @brief Registers widget for handling Atspi gesture events + * @param[in] widget Widget to register + */ + void registerObject(ucl::ElmWidget &widget); + + /** + * @brief Registers List Item presenter for handling Atspi + * gesture events + * @param[in] listItemPrs List item presenter to register + */ + void registerObject(ucl::ListItemPresenter &listItemPrs); + + private: + AtspiHighlightHelper(ucl::IRefCountObj &rc); + ~AtspiHighlightHelper() = default; + + ucl::Result prepare(GuiPresenter &parent); + + void handleAtspiGesture(ucl::Atspi &atspi, + ucl::AtspiGestureEventInfo &e); + + void onAtspiGesture(ucl::Atspi &atspi, + ucl::AtspiGestureEventInfo &eventInfo); + + ucl::Atspi *getFakeAtspi(); + + private: + EventHandler m_eventHandler; + + friend class ucl::ReffedObj<AtspiHighlightHelper>; + }; +} + +#endif // __CALL_UI_PRESENTERS_MISC_ATSPI_HIGHLIGHT_HELPER_H__ diff --git a/src/presenters/CallInfoPresenter.cpp b/call-ui/presenters/misc/CallInfoPresenter.cpp index 9f787da..0936bf7 100644 --- a/src/presenters/CallInfoPresenter.cpp +++ b/call-ui/presenters/misc/CallInfoPresenter.cpp @@ -14,32 +14,24 @@ * limitations under the License. */ -#include "presenters/CallStatusPresenter.h" -#include "presenters/CallInfoPresenter.h" +#include "CallInfoPresenter.h" #include "ucl/gui/Window.h" -#include "model/ICallManager.h" -#include "model/IIncomingCall.h" -#include "model/IActiveCall.h" -#include "model/IHeldCall.h" -#include "model/IEndCall.h" -#include "model/ICallInfo.h" -#include "model/IContactInfo.h" +#include "call-ui/resources.h" -#include "common.h" -#include "resources.h" +#include "call-ui/presenters/common.h" namespace callui { namespace { namespace impl { using namespace ucl; - constexpr int SUB_TXT_WIDTH = 208; - constexpr int INCOM_MAIN_TXT_WIDTH = 190; + constexpr int SUB_TXT_MAX_WIDTH = 208; constexpr int SLIDE_LABEL_DURATION_KOEFF = 8; - const char *CU_BIG_FONT_STYLE = "Tizen:style=Condensed"; - constexpr int CU_BIG_FONT_SIZE = 40; + const char *INCOMING_CALL_MAIN_TEXT_FONT_STYLE = "Tizen:style=Condensed"; + constexpr int INCOMING_CALL_MAIN_TEXT_FONT_SIZE = 40; + constexpr int INCOMING_CALL_MAIN_TEXT_MAX_WIDTH = 190; constexpr LayoutTheme LAYOUT_CALLER_INFO_WIDGET {"layout", "callui", "call_info"}; @@ -55,8 +47,6 @@ namespace callui { namespace { namespace impl { constexpr EdjeSignal SIGN_CID_ENABLE {"caller_id_enable"}; constexpr EdjeSignal SIGN_CID_DISABLE {"caller_id_disable"}; constexpr EdjeSignal SIGN_EMERGENCY {"emergency"}; - constexpr EdjeSignal SIGN_EMERGENCY_BIG_TXT {"big_txt_emergency"}; - constexpr EdjeSignal SIGN_BIG_TXT {"big_txt"}; constexpr EdjeSignal SIGN_CENTRE_1LINE {"centre_1line"}; constexpr EdjeSignal SIGN_CENTRE_2LINE {"centre_2line"}; constexpr EdjeSignal SIGN_INCOMING {"incoming"}; @@ -78,10 +68,13 @@ namespace callui { namespace { namespace impl { "<align=center><color=#4dcfffff><font_size=24>%s" "</color></font_size></align>"}; + constexpr EdjePart PART_AO_MAIN_TXT {"ao_text_1line"}; + constexpr EdjePart PART_AO_SUB_TXT {"ao_text_2line"}; + int getTextWidth(ElmWidget &parent, const char *fontStyle, int fontSize, const std::string &text) { - auto eoText = evas_object_text_add(evas_object_evas_get(parent)); + auto eoText = evas_object_text_add(evas_object_evas_get(as_eo(parent))); evas_object_text_font_set(eoText, fontStyle, fontSize); evas_object_text_style_set(eoText, EVAS_TEXT_STYLE_PLAIN); evas_object_text_text_set(eoText, text.c_str()); @@ -91,51 +84,48 @@ namespace callui { namespace { namespace impl { return size; } + bool isIncomingCallMainTextSingleline(ElmWidget &widget, + const std::string &mainText) + { + return (getTextWidth(widget, + INCOMING_CALL_MAIN_TEXT_FONT_STYLE, + INCOMING_CALL_MAIN_TEXT_FONT_SIZE, + mainText) <= INCOMING_CALL_MAIN_TEXT_MAX_WIDTH); + } + }}} namespace callui { using namespace ucl; - CallInfoPresenter::Builder::Builder(): - m_mode(CallMode::UNDEFINED) - { - } - - CallInfoPresenter::Builder::~Builder() - { - } - - CallInfoPresenter::Builder & - CallInfoPresenter::Builder::setCallManager(const ICallManagerSRef &cm) + CallInfoPresenter::Builder::Builder() { - m_cm = cm; - return *this; } CallInfoPresenter::Builder & - CallInfoPresenter::Builder::setMode(CallMode mode) + CallInfoPresenter::Builder::setCallManager(ICallManagerSRef cm) { - m_mode = mode; + m_cm = std::move(cm); return *this; } CallInfoPresenter::Builder & - CallInfoPresenter::Builder::setParentWidget( - const ucl::ElmWidgetSRef &parentWidget) + CallInfoPresenter::Builder::setParentWidget(ucl::ElmWidgetSRef parentWidget) { - m_parentWidget = parentWidget; + m_parentWidget = std::move(parentWidget); return *this; } CallInfoPresenterSRef CallInfoPresenter::Builder::build(GuiPresenter &parent) const { - if (m_mode == CallMode::UNDEFINED || !m_cm || !m_parentWidget) { - LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are are set"); + if (!m_cm || !m_parentWidget) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, + "Main params are are set"); } - auto result = makeShared<CallInfoPresenter>(m_cm, m_mode); + auto result = makeShared<CallInfoPresenter>(m_cm); FAIL_RETURN_VALUE(result->prepare(parent, *m_parentWidget), {}, "result->prepare() failed!"); @@ -143,18 +133,18 @@ namespace callui { } CallInfoPresenter::CallInfoPresenter(IRefCountObj &rc, - const ICallManagerSRef &cm, - CallMode mode): - GuiPresenter(rc), - m_mode(mode), - m_isSubTxtEnable(false), - m_needModifyCallStatus(false) + const ICallManagerSRef &cm): + GuiPresenter(rc), + m_mode(getCallMode(cm)), + m_isSubTxtEnable(false), + m_needModifyCallStatus(false) { initCallInfos(cm); } CallInfoPresenter::~CallInfoPresenter() { + unsetLanguageChangeCallback(); } Result CallInfoPresenter::prepare(GuiPresenter &parent, @@ -173,14 +163,32 @@ namespace callui { FAIL_RETURN(update(), "update() failed!"); + setLanguageChangeCallback(); + return RES_OK; } + void CallInfoPresenter::setLanguageChangeCallback() + { + getWindow().addEventHandler(WIN_LANGUAGE_CHANGED, + WEAK_DELEGATE_THIS(onLanguageChanged)); + } + + void CallInfoPresenter::unsetLanguageChangeCallback() + { + getWindow().delEventHandler(WIN_LANGUAGE_CHANGED, + DELEGATE_THIS(onLanguageChanged)); + } + + void CallInfoPresenter::onLanguageChanged(Widget &widget, void *eventInfo) + { + update(); + } + Result CallInfoPresenter::createWidget(ElmWidget &parent) { m_widget = Layout::Builder(). setTheme(impl::LAYOUT_CALLER_INFO_WIDGET). - setIsOwner(true). build(parent); if (!m_widget) { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); @@ -193,45 +201,38 @@ namespace callui { return *m_widget; } - CallMode CallInfoPresenter::getMode() const - { - return m_mode; - } - void CallInfoPresenter::initCallInfos(const ICallManagerSRef &cm) { + m_incomCallInfo.reset(); + m_activeCallInfo.reset(); + m_heldCallInfo.reset(); + m_endCallInfo.reset(); + auto incom = cm->getIncomingCall(); if (incom) { m_incomCallInfo = incom->getInfo(); - } else { - m_incomCallInfo.reset(); } auto active = cm->getActiveCall(); if (active) { m_activeCallInfo = active->getInfo(); - } else { - m_activeCallInfo.reset(); } auto held = cm->getHeldCall(); if (held) { m_heldCallInfo = held->getInfo(); - } else { - m_heldCallInfo.reset(); } auto end = cm->getEndCall(); if (end) { m_endCallInfo = end->getInfo(); - } else { - m_endCallInfo.reset(); } } - Result CallInfoPresenter::update(CallMode mode, const ICallManagerSRef &cm) + Result CallInfoPresenter::update(const ICallManagerSRef &cm) { m_needModifyCallStatus = false; + CallMode mode = getCallMode(cm); if (mode != m_mode || mode == CallMode::DURING) { m_needModifyCallStatus = true; } @@ -252,7 +253,9 @@ namespace callui { IContactInfoSCRef contactInfo = callInfo->getContactInfo(); if (contactInfo) { - return callInfo->getPhoneNumber(); + return encloseBidirectionalText(std::move( + callInfo->getPhoneNumber()), + BidiTextEncloseType::LRM); } return ""; } @@ -265,11 +268,20 @@ namespace callui { } if (m_activeCallInfo && m_heldCallInfo) { auto displStr = m_activeCallInfo->getPhoneNumber(); + if (displStr.empty()) { + displStr = encloseBidirectionalText(std::move(displStr), + BidiTextEncloseType::LRM); + } auto contactInfo = m_activeCallInfo->getContactInfo(); if (contactInfo) { const auto contName = contactInfo->getName(); if (!contName.empty()) { displStr = contName; + if (contactInfo->getNameSourceType() == + ContactNameSourceType::NUMBER) { + displStr = encloseBidirectionalText(std::move(displStr), + BidiTextEncloseType::LRM); + } } } if (displStr.empty()) { @@ -330,7 +342,7 @@ namespace callui { Result CallInfoPresenter::createLabel(const std::string &text) { - auto *eo = elm_label_add(*m_widget); + Evas_Object *const eo = elm_label_add(as_eo(*m_widget)); if (!eo) { LOG_RETURN(RES_FAIL, "elm_label_add() failed!"); } @@ -342,41 +354,44 @@ namespace callui { txtStyle = impl::STR_LABEL_SUB_CID_ENABLE; } - m_label = makeShared<StyledWidget>(eo, true); + m_label = makeShared<StyledWidget>(eo); m_label->setStyle(impl::STYLE_SLIDING_LABEL); m_label->setText(txtStyle.format(text.c_str())); - elm_label_slide_mode_set(*m_label,ELM_LABEL_SLIDE_MODE_AUTO); - elm_label_wrap_width_set(*m_label,ELM_SCALE_SIZE(impl::SUB_TXT_WIDTH)); + elm_label_slide_mode_set(eo, ELM_LABEL_SLIDE_MODE_AUTO); + elm_label_wrap_width_set(eo, + ELM_SCALE_SIZE(impl::SUB_TXT_MAX_WIDTH)); double duration = (static_cast<double>(text.size())) / impl::SLIDE_LABEL_DURATION_KOEFF; - elm_label_slide_duration_set(*m_label, duration); - elm_label_slide_go(*m_label); + elm_label_slide_duration_set(eo, duration); + elm_label_slide_go(eo); m_widget->setContent(*m_label, impl::PART_SWL_2LINE); + m_label->getAtspi().setHighlightable(false); + return RES_OK; } Result CallInfoPresenter::createCallerIdImage(const std::string &imagePath) { - auto *eo = elm_image_add(*m_widget); + Evas_Object *const eo = elm_image_add(as_eo(*m_widget)); if (!eo) { - LOG_RETURN(RES_FAIL, "elm_image_add() failed"); + LOG_RETURN(RES_FAIL, "elm_image_add() failed!"); } - auto callerId = makeShared<StyledWidget>(eo, true); - elm_image_file_set(*callerId, imagePath.c_str(), NULL); - elm_image_aspect_fixed_set(*callerId, EINA_TRUE); - elm_image_fill_outside_set(*callerId, EINA_TRUE); + elm_image_file_set(eo, imagePath.c_str(), NULL); + elm_image_aspect_fixed_set(eo, EINA_TRUE); + elm_image_fill_outside_set(eo, EINA_TRUE); + const auto callerId = makeShared<StyledWidget>(eo); auto window = callerId->getWindow(); if (!window) { LOG_RETURN(RES_FAIL, "Window is NULL!"); } int w = 0, h = 0; window->getScreenSize(&w, &h); - evas_object_size_hint_min_set(*callerId, w, h); + callerId->setMin(w, h); m_widget->setContent(*callerId, impl::PART_SWL_CALLER_ID); @@ -388,10 +403,9 @@ namespace callui { Result CallInfoPresenter::updateCallerId() { m_callerId.reset(); - m_widget->emit(impl::SIGN_CID_DISABLE,impl::SRC_CALLER_ID); + m_widget->emit(impl::SIGN_CID_DISABLE, impl::SRC_CALLER_ID); if (m_mode == CallMode::INCOMING) { - if (!m_incomCallInfo) { LOG_RETURN(RES_FAIL, "m_incomCallInfo is NULL"); } @@ -407,7 +421,7 @@ namespace callui { } FAIL_RETURN(createCallerIdImage(callerIdPath), - "createCallerIdImage() failed"); + "createCallerIdImage() failed!"); m_widget->emit(impl::SIGN_CID_ENABLE, impl::SRC_CALLER_ID); } @@ -443,7 +457,7 @@ namespace callui { if (!subTxt.empty()) { m_isSubTxtEnable = true; - FAIL_RETURN(createLabel(subTxt), "createLabel() failed"); + FAIL_RETURN(createLabel(subTxt), "createLabel() failed!"); } if (m_mode == CallMode::INCOMING) { @@ -452,6 +466,9 @@ namespace callui { m_widget->emit(impl::SIGN_DEFAULT, impl::SRC_TXT_2LINE); } + FAIL_RETURN(setSubTxtAccessObject(subTxt), + "setSubTxtAccessObject() failed!"); + return RES_OK; } @@ -459,7 +476,7 @@ namespace callui { const ICallInfoSCRef &callInfo) { if (!callInfo) { - LOG_RETURN_VALUE(RES_FAIL, "", "callInfo is NULL"); + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, "", "callInfo is NULL"); } if (callInfo->getConferenceMemberCount() > 1) { @@ -478,6 +495,11 @@ namespace callui { auto contactInfo = callInfo->getContactInfo(); if (contactInfo) { mainTxt = contactInfo->getName(); + if (contactInfo->getNameSourceType() == + ContactNameSourceType::NUMBER) { + mainTxt = encloseBidirectionalText(std::move(mainTxt), + BidiTextEncloseType::LRM); + } } if (mainTxt.empty()) { @@ -490,10 +512,13 @@ namespace callui { } void CallInfoPresenter::displayMainTxt(const ICallInfoSCRef &info, - const std::string &text) const + const std::string &text) { m_widget->setText(text.c_str(), impl::PART_TXT_MAIN); + FAIL_RETURN_VOID(setMainTxtAccessObject(text), + "setMainTxtAccessObject() failed!"); + if (m_mode == CallMode::INCOMING) { // Font size and color if (m_callerId) { @@ -502,38 +527,14 @@ namespace callui { m_widget->emit(impl::SIGN_CID_DISABLE, impl::SRC_TXT_1LINE); } // Info text top padding - if (impl::getTextWidth(*m_widget, - impl::CU_BIG_FONT_STYLE, - impl::CU_BIG_FONT_SIZE, - text) <= impl::INCOM_MAIN_TXT_WIDTH) { + if (impl::isIncomingCallMainTextSingleline(*m_widget, text)) { m_widget->emit(impl::SIGN_CENTRE_1LINE, impl::SRC_TOP_PAD); } else { m_widget->emit(impl::SIGN_CENTRE_2LINE, impl::SRC_TOP_PAD); } return; - } else if (m_mode == CallMode::END) { - if (info->isEmergency() - || info->getContactInfo() - || (info->getConferenceMemberCount() > 1)) { - // Font size and color - if (info->isEmergency()) { - m_widget->emit(impl::SIGN_EMERGENCY_BIG_TXT, - impl::SRC_TXT_1LINE); - } else { - m_widget->emit(impl::SIGN_BIG_TXT, impl::SRC_TXT_1LINE); - } - // Info text top padding - if (impl::getTextWidth(*m_widget, - impl::CU_BIG_FONT_STYLE, - impl::CU_BIG_FONT_SIZE, - text) <= impl::SUB_TXT_WIDTH) { - m_widget->emit(impl::SIGN_CENTRE_1LINE, impl::SRC_TOP_PAD); - } else { - m_widget->emit(impl::SIGN_CENTRE_2LINE, impl::SRC_TOP_PAD); - } - return; - } } + // Font size and color if (info->isEmergency()) { m_widget->emit(impl::SIGN_EMERGENCY, impl::SRC_TXT_1LINE); @@ -639,11 +640,67 @@ namespace callui { FAIL_RETURN(updateMainTxt(), "diplayMainTxt() failed!"); if (m_needModifyCallStatus) { - if (const auto parent = m_parent.lock()) - return createCallStatus(*parent); + m_needModifyCallStatus = false; + if (const auto parent = m_parent.lock()) { + return createCallStatus(*parent); + } + } + + return RES_OK; + } + + ElmWidget *CallInfoPresenter::getMainTxtAo() + { + return m_mainTxtAo.get(); + } + + ElmWidget *CallInfoPresenter::getSubTxtAo() + { + return m_subTxtAo.get(); + } + + ElmWidget *CallInfoPresenter::getStatusTxtAo() + { + return m_callStatus->getStatusTextAo(); + } + + Result CallInfoPresenter::setMainTxtAccessObject(const std::string &text) + { + if (!m_mainTxtAo) { + m_mainTxtAo = utils::createAccessObjectFromPart(*m_widget, + *m_widget, impl::PART_AO_MAIN_TXT); + if (!m_mainTxtAo) { + LOG_RETURN(RES_FAIL, "createAccessObjectFromPart() failed!"); + } } + auto &atspi = m_mainTxtAo->getAtspi(); + atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); + atspi.setName(text.c_str()); + return RES_OK; } + Result CallInfoPresenter::setSubTxtAccessObject(const std::string &text) + { + if (!text.empty()) { + if (!m_subTxtAo) { + m_subTxtAo = utils::createAccessObjectFromPart(*m_widget, + *m_widget, impl::PART_AO_SUB_TXT); + if (!m_subTxtAo) { + LOG_RETURN(RES_FAIL, + "createAccessObjectFromPart() failed!"); + } + } + + auto &atspi = m_subTxtAo->getAtspi(); + atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); + atspi.setName(text.c_str()); + + } else if (m_subTxtAo) { + m_subTxtAo.reset(); + } + + return RES_OK; + } } diff --git a/call-ui/presenters/misc/CallInfoPresenter.h b/call-ui/presenters/misc/CallInfoPresenter.h new file mode 100644 index 0000000..c10cf68 --- /dev/null +++ b/call-ui/presenters/misc/CallInfoPresenter.h @@ -0,0 +1,174 @@ +/* + * 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_MISC_CALL_INFO_PRESENTER_H__ +#define __CALL_UI_PRESENTERS_MISC_CALL_INFO_PRESENTER_H__ + +#include "ucl/mvp/GuiPresenter.h" + +#include "ucl/gui/Layout.h" +#include "ucl/gui/StyledWidget.h" + +#include "call-ui/model/ICallManager.h" +#include "CallStatusPresenter.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(CallInfoPresenter); + + /** + * @brief Presenter for displaying Call Info information + */ + class CallInfoPresenter final : public ucl::GuiPresenter { + public: + + /** + * @brief CallInfoPresenter builder + */ + class Builder { + public: + + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets Call Manager instance + * @param[in] cm Call Manager instance + * @return Reference to builder + */ + Builder &setCallManager(ICallManagerSRef cm); + + /** + * @brief Sets parent widget for UI components creation + * @param[in] parentWidget Parent widget + * @return Reference to builder + */ + Builder &setParentWidget(ucl::ElmWidgetSRef parentWidget); + + /** + * @brief Creates new instance of CallInfoPresenter + * @param[in] parent Parent presenter + * @return Shared reference to CallInfoPresenter instance + * on success or NULL otherwise + */ + CallInfoPresenterSRef build(ucl::GuiPresenter &parent) const; + + private: + ICallManagerSRef m_cm; + ucl::ElmWidgetSRef m_parentWidget; + }; + + public: + + /** + * @brief Returns widget + * @return Reference to widget + */ + ucl::Widget &getWidget(); + + /** + * @brief Updates presenter + * @param[in] cm Call Manager instance + * @return RES_OK on success or another result otherwise + */ + ucl::Result update(const ICallManagerSRef &cm); + + /** + * @brief Gets Access object for status text area + * @remark Use only for Screen Reader feature + * @return Pointer to widget on success or NULL otherwise + */ + ucl::ElmWidget *getStatusTxtAo(); + + /** + * @brief Gets Access object for main text area + * @remark Use only for Screen Reader feature + * @return Pointer to widget on success or NULL otherwise + */ + ucl::ElmWidget *getMainTxtAo(); + + /** + * @brief Gets Access object for sub text area + * @remark Use only for Screen Reader feature + * @return Pointer to widget on success or NULL otherwise + */ + ucl::ElmWidget *getSubTxtAo(); + + private: + CallInfoPresenter(ucl::IRefCountObj &rc, + const ICallManagerSRef &cm); + ~CallInfoPresenter(); + + ucl::Result prepare(ucl::GuiPresenter &parent, + ucl::ElmWidget &parentWidget); + + void initCallInfos(const ICallManagerSRef &cm); + + ucl::Result createWidget(ucl::ElmWidget &parent); + ucl::Result createLabel(const std::string &text); + ucl::Result createCallerIdImage(const std::string &imagePath); + ucl::Result createCallStatus(ucl::GuiPresenter &parent); + + ucl::Result update(); + ucl::Result updateCallerId(); + ucl::Result updateSubText(); + ucl::Result updateMainTxt(); + std::string getNumberSubText(const ICallInfoSCRef &callInfo) const; + std::string getIncomingCallSubText() const; + std::string getOutgoingCallSubText() const; + std::string getDuringCallSubText() const; + std::string getEndCallSubText() const; + + std::string generateMainTxt(const ICallInfoSCRef &callInfo); + + void displayMainTxt(const ICallInfoSCRef &info, const std::string &text); + + void setLanguageChangeCallback(); + void unsetLanguageChangeCallback(); + void onLanguageChanged(ucl::Widget &widget, void *eventInfo); + + ucl::Result setMainTxtAccessObject(const std::string &text); + ucl::Result setSubTxtAccessObject(const std::string &text); + + private: + ucl::LayoutSRef m_widget; + ucl::StyledWidgetSRef m_callerId; + ucl::StyledWidgetSRef m_label; + ucl::GuiPresenterWRef m_parent; + CallMode m_mode; + + ICallInfoSCRef m_incomCallInfo; + ICallInfoSCRef m_activeCallInfo; + ICallInfoSCRef m_heldCallInfo; + ICallInfoSCRef m_endCallInfo; + CallStatusPresenterSRef m_callStatus; + bool m_isSubTxtEnable; + bool m_needModifyCallStatus; + + ucl::ElmWidgetSRef m_statusAo; + ucl::ElmWidgetSRef m_mainTxtAo; + ucl::ElmWidgetSRef m_subTxtAo; + + friend class ucl::ReffedObj<CallInfoPresenter>; + }; + +} + +#endif // __CALL_UI_PRESENTERS_MISC_CALL_INFO_PRESENTER_H__ diff --git a/src/presenters/CallStatusPresenter.cpp b/call-ui/presenters/misc/CallStatusPresenter.cpp index 61e6d6e..f66602d 100644 --- a/src/presenters/CallStatusPresenter.cpp +++ b/call-ui/presenters/misc/CallStatusPresenter.cpp @@ -14,12 +14,11 @@ * limitations under the License. */ -#include "presenters/CallStatusPresenter.h" +#include "CallStatusPresenter.h" -#include "model/ICallInfo.h" +#include "call-ui/resources.h" -#include "common.h" -#include "resources.h" +#include "call-ui/presenters/common.h" namespace callui { namespace { namespace impl { @@ -31,10 +30,11 @@ namespace callui { namespace { namespace impl { constexpr EdjePart PART_TXT_TEXT_INFO {"text_info"}; - constexpr EdjeSignal SIGN_DOT_RTL {"default:RTL"}; - constexpr EdjeSignal SIGN_DOT_LTR {"default:LTR"}; + constexpr EdjeSignal SIGN_DOT_ANIMATE {"animate"}; constexpr EdjeSignal SIGN_RESET {"reset"}; + constexpr EdjePart PART_AO_STATUS {"ao_text_info"}; + constexpr EdjeSignalSrc SIGN_SRC_DOT {"dot"}; }}} @@ -49,10 +49,6 @@ namespace callui { { } - CallStatusPresenter::Builder::~Builder() - { - } - CallStatusPresenter::Builder & CallStatusPresenter::Builder::setMode(CallMode mode) { @@ -61,9 +57,9 @@ namespace callui { } CallStatusPresenter::Builder & - CallStatusPresenter::Builder::setCallInfo(const ICallInfoWCRef &info) + CallStatusPresenter::Builder::setCallInfo(ICallInfoWCRef info) { - m_info = info; + m_info = std::move(info); return *this; } @@ -75,9 +71,9 @@ namespace callui { } CallStatusPresenter::Builder & - CallStatusPresenter::Builder::setLayout(const LayoutSRef &layout) + CallStatusPresenter::Builder::setLayout(LayoutSRef layout) { - m_ly = layout; + m_ly = std::move(layout); return *this; } @@ -98,14 +94,14 @@ namespace callui { CallStatusPresenter::CallStatusPresenter(IRefCountObj &rc, - const LayoutSRef &layout, + LayoutSRef layout, CallMode mode, - const ICallInfoWCRef &info, + ICallInfoWCRef info, bool isHeld): GuiPresenter(rc), - m_ly(layout), + m_info(std::move(info)), + m_ly(std::move(layout)), m_mode(mode), - m_info(info), m_isOnHold(isHeld), m_timer(nullptr), m_duration{0}, @@ -115,7 +111,8 @@ namespace callui { CallStatusPresenter::~CallStatusPresenter() { - m_ly.reset(); + unsetLanguageChangeCallback(); + if (m_timer) { ecore_timer_del(m_timer); m_timer = nullptr; @@ -127,8 +124,11 @@ namespace callui { FAIL_RETURN(GuiPresenter::prepare(parent, PF_PASSIVE), "Presenter::prepare() failed!"); + setLanguageChangeCallback(); + m_ly->emit(impl::SIGN_RESET, impl::SIGN_SRC_DOT); m_ly->setText("", impl::PART_TXT_TEXT_INFO); + createStatusTxtAo(); switch (m_mode) { case CallMode::INCOMING: return processIncomingMode(); @@ -143,12 +143,45 @@ namespace callui { return RES_OK; } + void CallStatusPresenter::setLanguageChangeCallback() + { + getWindow().addEventHandler(WIN_LANGUAGE_CHANGED, + WEAK_DELEGATE_THIS(onLanguageChanged)); + } + + void CallStatusPresenter::unsetLanguageChangeCallback() + { + getWindow().delEventHandler(WIN_LANGUAGE_CHANGED, + DELEGATE_THIS(onLanguageChanged)); + } + + void CallStatusPresenter::onLanguageChanged(Widget &widget, void *eventInfo) + { + Result res = RES_FAIL; + switch (m_mode) { + case CallMode::INCOMING: + res = processIncomingMode(); + break; + case CallMode::OUTGOING: + res = processOutgoingMode(); + break; + case CallMode::DURING: + res = processDuringMode(); + break; + case CallMode::END: + res = processEndMode(); + break; + default: + ELOG("Unknown mode"); + break; + } + LOG_RETURN_VOID(res, "Failed"); + } + Result CallStatusPresenter::processIncomingMode() { m_ly->setText(STR_INCOMING_CALL, impl::PART_TXT_TEXT_INFO); - - // TODO: need add logic for RTL mode in the future - m_ly->emit(impl::SIGN_DOT_LTR, impl::SIGN_SRC_DOT); + m_ly->emit(impl::SIGN_DOT_ANIMATE, impl::SIGN_SRC_DOT); return RES_OK; } @@ -156,9 +189,7 @@ namespace callui { Result CallStatusPresenter::processOutgoingMode() { m_ly->setText(STR_DIALING_CALL, impl::PART_TXT_TEXT_INFO); - - // TODO: need add logic for RTL mode in the future - m_ly->emit(impl::SIGN_DOT_LTR, impl::SIGN_SRC_DOT); + m_ly->emit(impl::SIGN_DOT_ANIMATE, impl::SIGN_SRC_DOT); return RES_OK; } @@ -172,25 +203,25 @@ namespace callui { } struct tm tmp = info->getDuration(); - tryUpdateCallDurationTime( - m_duration, - tmp, - *m_ly, - impl::PART_TXT_TEXT_INFO); + if ((m_duration.tm_sec - tmp.tm_sec) != 0) { + m_duration = tmp; + m_ly->setText(getCallDurationTxt(m_duration), + impl::PART_TXT_TEXT_INFO); + } return ECORE_CALLBACK_RENEW; } Result CallStatusPresenter::processDuringMode() { - if (m_isOnHold) { m_ly->setText(STR_ON_HOLD, impl::PART_TXT_TEXT_INFO); } else { if (const auto info = m_info.lock()) { m_duration = info->getDuration(); } - setCallDuration(m_duration, *m_ly, impl::PART_TXT_TEXT_INFO); + m_ly->setText(getCallDurationTxt(m_duration), + impl::PART_TXT_TEXT_INFO); if (m_timer) { ecore_timer_del(m_timer); @@ -211,7 +242,8 @@ namespace callui { Eina_Bool CallStatusPresenter::onBlinkingTimerCb() { if ((m_blinkCount % 2) == 0) { - setCallDuration(m_duration, *m_ly, impl::PART_TXT_TEXT_INFO); + m_ly->setText(getCallDurationTxt(m_duration), + impl::PART_TXT_TEXT_INFO); } else if ((m_blinkCount % 2) == 1) { m_ly->setText("", impl::PART_TXT_TEXT_INFO); } @@ -246,4 +278,31 @@ namespace callui { return RES_OK; } + Result CallStatusPresenter::createStatusTxtAo() + { + if (!m_statusTxtAo) { + m_statusTxtAo = utils::createAccessObjectFromPart(*m_ly, *m_ly, + impl::PART_AO_STATUS); + if (!m_statusTxtAo) { + LOG_RETURN(RES_FAIL, "createAccessObjectFromPart() failed!"); + } + + auto &atspi = m_statusTxtAo->getAtspi(); + atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); + atspi.setNameCb(WEAK_DELEGATE_THIS(onStatusTxtAoNameCb)); + } + return RES_OK; + } + + CString CallStatusPresenter::onStatusTxtAoNameCb(Atspi &atspi) + { + const auto txt = m_ly->getText(impl::PART_TXT_TEXT_INFO); + return (!txt.empty()) ? CString::dup(txt.c_str()) : nullptr; + } + + ElmWidget *CallStatusPresenter::getStatusTextAo() + { + return m_statusTxtAo.get(); + } + } diff --git a/call-ui/presenters/misc/CallStatusPresenter.h b/call-ui/presenters/misc/CallStatusPresenter.h new file mode 100644 index 0000000..710d111 --- /dev/null +++ b/call-ui/presenters/misc/CallStatusPresenter.h @@ -0,0 +1,143 @@ +/* + * 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_MISC_CALL_STATUS_PRESENTER_H__ +#define __CALL_UI_PRESENTERS_MISC_CALL_STATUS_PRESENTER_H__ + +#include "ucl/mvp/GuiPresenter.h" + +#include <time.h> + +#include "ucl/gui/Layout.h" + +#include "call-ui/model/ICallInfo.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(CallStatusPresenter); + + /** + * @brief Presenter for displaying Call Status information + */ + class CallStatusPresenter final : public ucl::GuiPresenter { + public: + + /** + * @brief CallStatusPresenter builder + */ + class Builder { + public: + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets Call mode + * @param[in] mode Call mode + * @return Reference to builder + */ + Builder &setMode(CallMode mode); + + /** + * @brief Sets Call Info + * @param[in] info Call Info instance + * @return Reference to builder + */ + Builder &setCallInfo(ICallInfoWCRef info); + + /** + * @brief Sets call Hold state + * @param[in] isOnHold Call Hold state: true if current + * call is on hold, false otherwise + * @return Reference to builder + */ + Builder &setCallHoldState(bool isOnHold); + + /** + * @brief Sets Call Info layout + * @param[in] info Call Info layout + * @return Reference to builder + */ + Builder &setLayout(ucl::LayoutSRef layout); + + /** + * @brief Creates new instance of CallStatusPresenter + * @param[in] parent Parent presenter + * @return Shared reference to CallStatusPresenter instance + * on success or NULL otherwise + */ + CallStatusPresenterSRef build(ucl::GuiPresenter &parent) const; + private: + ucl::LayoutSRef m_ly; + CallMode m_mode; + ICallInfoWCRef m_info; + bool m_isOnHold; + }; + public: + + /** + * @brief Gets Access object for status text area + * @remark Use only for Screen Reader feature + * @return Pointer to widget on success or NULL otherwise + */ + ucl::ElmWidget *getStatusTextAo(); + + private: + CallStatusPresenter(ucl::IRefCountObj &rc, + ucl::LayoutSRef layout, + CallMode mode, + ICallInfoWCRef info, + bool isOnHold); + ~CallStatusPresenter(); + + ucl::Result prepare(ucl::GuiPresenter &parent); + + ucl::Result processIncomingMode(); + ucl::Result processOutgoingMode(); + ucl::Result processDuringMode(); + ucl::Result processEndMode(); + + Eina_Bool onCallDurationTimerCb(); + Eina_Bool onBlinkingTimerCb(); + + void setLanguageChangeCallback(); + void unsetLanguageChangeCallback(); + void onLanguageChanged(ucl::Widget &widget, void *eventInfo); + + ucl::Result createStatusTxtAo(); + ucl::CString onStatusTxtAoNameCb(ucl::Atspi &atspi); + + private: + const ICallInfoWCRef m_info; + const ucl::LayoutSRef m_ly; + + CallMode m_mode; + bool m_isOnHold; + Ecore_Timer *m_timer; + struct tm m_duration; + int m_blinkCount; + + ucl::ElmWidgetSRef m_statusTxtAo; + + friend class ucl::ReffedObj<CallStatusPresenter>; + }; + +} + +#endif // __CALL_UI_PRESENTERS_MISC_CALL_STATUS_PRESENTER_H__ diff --git a/src/presenters/DeviceStatePresenter.cpp b/call-ui/presenters/misc/DeviceStatePresenter.cpp index b651107..bbda1f3 100644 --- a/src/presenters/DeviceStatePresenter.cpp +++ b/call-ui/presenters/misc/DeviceStatePresenter.cpp @@ -14,19 +14,19 @@ * limitations under the License. */ -#include "presenters/DeviceStatePresenter.h" +#include "DeviceStatePresenter.h" #include <device/power.h> #include <device/display.h> #include <efl_util.h> -#include "common.h" +#include "call-ui/presenters/common.h" namespace callui { using namespace ucl; - // DeviceStatePresenter::Builder + // DeviceStatePresenter::Builder // DeviceStatePresenter::Builder::Builder(): m_state(DisplayState::UNDEFINED), @@ -57,19 +57,23 @@ namespace callui { } DeviceStatePresenterSRef - DeviceStatePresenter::Builder::build(const ucl::WindowSRef &window) const + DeviceStatePresenter::Builder::build(ucl::WindowSRef window) const { - auto result = makeShared<DeviceStatePresenter>(window); + if (!window) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "window is NULL"); + } + + auto result = makeShared<DeviceStatePresenter>(std::move(window)); FAIL_RETURN_VALUE(result->prepare(m_state, m_mode, m_lockState), {}, "result->prepare() failed!"); return result; } - // DeviceStatePresenter + // DeviceStatePresenter // - DeviceStatePresenter::DeviceStatePresenter(const ucl::WindowSRef &window): - m_window(window), + DeviceStatePresenter::DeviceStatePresenter(ucl::WindowSRef window): + m_window(std::move(window)), m_mode(DisplayMode::UNDEFINED), m_lockState(false) { @@ -81,17 +85,17 @@ namespace callui { { if (state != DisplayState::UNDEFINED) { FAIL_RETURN(setDisplayState(state, true), - "setDisplayState() failed"); + "setDisplayState() failed!"); } if (mode != DisplayMode::UNDEFINED) { FAIL_RETURN(setDisplayMode(mode), - "setDisplayMode() failed"); + "setDisplayMode() failed!"); } if (lockState) { FAIL_RETURN(setCpuLockState(lockState), - "setCpuLockState() failed"); + "setCpuLockState() failed!"); } return RES_OK; @@ -163,7 +167,8 @@ namespace callui { EFL_UTIL_SCREEN_MODE_ALWAYS_ON : EFL_UTIL_SCREEN_MODE_DEFAULT; - int res = efl_util_set_window_screen_mode(*m_window, setScreenMode); + int res = efl_util_set_window_screen_mode(as_eo(*m_window), + setScreenMode); if (res != EFL_UTIL_ERROR_NONE) { LOG_RETURN(RES_FAIL, "Set window screen mode failed." "res[%d] msg[%s]", res, get_error_message(res)); diff --git a/call-ui/presenters/misc/DeviceStatePresenter.h b/call-ui/presenters/misc/DeviceStatePresenter.h new file mode 100644 index 0000000..0fbf343 --- /dev/null +++ b/call-ui/presenters/misc/DeviceStatePresenter.h @@ -0,0 +1,143 @@ +/* + * 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_MISC_DEVICE_STATE_PRESENTER_H__ +#define __CALL_UI_PRESENTERS_MISC_DEVICE_STATE_PRESENTER_H__ + +#include "ucl/gui/Window.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(DeviceStatePresenter); + + /** + * @brief Presenter for manipulating device parameters + */ + class DeviceStatePresenter final { + public: + + /** + * @brief Enumeration of device Display states + */ + enum class DisplayState { + UNDEFINED, /**< Undefined */ + ON, /**< Display turned on */ + OFF, /**< Display turned off */ + DIM /**< Display dimmed */ + }; + + /** + * @brief Enumeration of device Display modes + */ + enum class DisplayMode { + UNDEFINED, /**< Undefined */ + REGULAR, /**< Turns the screen off after a timeout */ + TOP_PRIORITY /**< Keeps the screen turned on */ + }; + + public: + + /** + * @brief DeviceStatePresenter builder + */ + class Builder { + public: + + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets display state + * @param[in] state Display state + * @return Reference to builder + */ + Builder &setDisplayState(DisplayState state); + + /** + * @brief Sets display mode + * @param[in] mode Display mode + * @return Reference to builder + */ + Builder &setDisplayMode(DisplayMode mode); + + /** + * @brief Sets CPU lock state + * @param[in] lockState CPU lock state + * @return Reference to builder + */ + Builder &setCpuLockState(bool lockState); + + /** + * @brief Creates new instance of DeviceStatePresenter + * @param[in] window Window instance + * @return Shared reference to DeviceStatePresenter instance + * on success or NULL otherwise + */ + DeviceStatePresenterSRef build(ucl::WindowSRef window) const; + private: + DisplayState m_state; + DisplayMode m_mode; + bool m_lockState; + }; + + public: + + /** + * @brief Sets display state + * @param[in] state Display state + * @param[in] forse Force flag: + * true - sets display state no matter on current state, + * false(default) - do not set state if @state is the same as current + * @return RES_OK on success or another result otherwise + */ + ucl::Result setDisplayState(DisplayState state, bool forse = false); + + /** + * @brief Sets display mode + * @param[in] mode Display mode + * @return RES_OK on success or another result otherwise + */ + ucl::Result setDisplayMode(DisplayMode mode); + + /** + * @brief Sets CPU lock state + * @param[in] lockState CPU lock state + * @return RES_OK on success or another result otherwise + */ + ucl::Result setCpuLockState(bool lockState); + + private: + DeviceStatePresenter(ucl::WindowSRef window); + ~DeviceStatePresenter() = default; + + ucl::Result prepare(DisplayState state, + DisplayMode mode, + bool lockState); + + private: + ucl::WindowSRef m_window; + DisplayMode m_mode; + bool m_lockState; + + friend class ucl::ReffedObj<DeviceStatePresenter>; + }; +} + +#endif // __CALL_UI_PRESENTERS_MISC_DEVICE_STATE_PRESENTER_H__ diff --git a/src/presenters/IndicatorPresenter.cpp b/call-ui/presenters/misc/IndicatorPresenter.cpp index 531afe8..6bacecb 100644 --- a/src/presenters/IndicatorPresenter.cpp +++ b/call-ui/presenters/misc/IndicatorPresenter.cpp @@ -14,13 +14,11 @@ * limitations under the License. */ -#include "presenters/IndicatorPresenter.h" +#include "IndicatorPresenter.h" #include <string> -#include "model/IIndicatorStateProvider.h" - -#include "common.h" +#include "call-ui/presenters/common.h" namespace callui { namespace { namespace impl { using namespace ucl; @@ -45,13 +43,9 @@ namespace callui { namespace { namespace impl { constexpr LayoutTheme LAYOUT_HD_CALL {"layout", "callui", "hd_voice"}; - constexpr LayoutTheme LAYOUT_VOICE_CONTROL - {"layout", "callui", "voice_control"}; - constexpr EdjePart PART_SWL_CONN {"swl.connection"}; constexpr EdjePart PART_SWL_RSSI {"swl.rssi"}; constexpr EdjePart PART_SWL_BATTERY {"swl.battery"}; - constexpr EdjePart PART_SWL_VOICE_CONTROL {"swl.voice_control"}; constexpr EdjePart PART_SWL_SIM {"swl.sim"}; constexpr EdjePart PART_SWL_HD_VOICE {"swl.hd_voice"}; @@ -136,10 +130,10 @@ namespace callui { namespace { namespace impl { if (battLvl <= BATTERY_LOW_LIMIT - 1) { return impl::SIGL_BATT_LVL_HIDE; } + return EdjeSignal{std::string("batt_lvl_"). append(std::to_string(battLvl)). c_str()}; - } EdjeSignal getSimSlotUpdateSignal(SimSlot slot, bool isForwarded) @@ -168,22 +162,19 @@ namespace callui { { } - IndicatorPresenter::Builder::~Builder() - { - } - IndicatorPresenter::Builder & IndicatorPresenter::Builder::setIndicatorStateProvider( - const IIndicatorStateProviderSRef &provider) + IIndicatorStateProviderSRef provider) { - m_provider = provider; + m_provider = std::move(provider); return *this; } IndicatorPresenter::Builder & - IndicatorPresenter::Builder::setParentWidget(const ucl::ElmWidgetSRef &parentWidget) + IndicatorPresenter::Builder::setParentWidget( + ucl::ElmWidgetSRef parentWidget) { - m_parentWidget = parentWidget; + m_parentWidget = std::move(parentWidget); return *this; } @@ -201,14 +192,9 @@ namespace callui { } IndicatorPresenter::IndicatorPresenter(IRefCountObj &rc, - const IIndicatorStateProviderSRef &provider): - GuiPresenter(rc), - m_provider(provider), - m_isIncomingCallMode(false) - { - } - - IndicatorPresenter::~IndicatorPresenter() + IIndicatorStateProviderSRef provider): + GuiPresenter(rc), + m_provider(std::move(provider)) { } @@ -225,15 +211,11 @@ namespace callui { "createRssiLayout() failed!"); FAIL_RETURN(createBatteryLayout(), "createBatteryLayout() failed!"); - FAIL_RETURN(createVoiceControlLayout(), - "createBatteryLayout() failed!"); FAIL_RETURN(createSimLayout(), "createSimLayout() failed!"); FAIL_RETURN(createHdVoiceLayout(), "createHdCallLayout() failed!"); - updateCentralIcon(); - m_provider->setListener(asWeak(*this)); return RES_OK; @@ -243,7 +225,6 @@ namespace callui { { m_widget = Layout::Builder(). setTheme(impl::LAYOUT_INDICATOR_WIDGET). - setIsOwner(true). build(parent); if (!m_widget) { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); @@ -256,6 +237,7 @@ namespace callui { { m_connLayout = Layout::Builder(). setTheme(impl::LAYOUT_CONNECTION). + setIsOwner(false). build(*m_widget); if (!m_connLayout) { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); @@ -271,6 +253,7 @@ namespace callui { { m_rssiLayout = Layout::Builder(). setTheme(impl::LAYOUT_RSSI). + setIsOwner(false). build(*m_widget); if (!m_rssiLayout) { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); @@ -286,6 +269,7 @@ namespace callui { { m_batteryLayout = Layout::Builder(). setTheme(impl::LAYOUT_BATTERY). + setIsOwner(false). build(*m_widget); if (!m_batteryLayout) { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); @@ -297,24 +281,11 @@ namespace callui { return RES_OK; } - Result IndicatorPresenter::createVoiceControlLayout() - { - m_voiceControlLayout = Layout::Builder(). - setTheme(impl::LAYOUT_VOICE_CONTROL). - build(*m_widget); - if (!m_voiceControlLayout) { - LOG_RETURN(RES_FAIL, "Layout::build() failed!"); - } - - m_widget->setContent(*m_voiceControlLayout, impl::PART_SWL_VOICE_CONTROL); - - return RES_OK; - } - Result IndicatorPresenter::createSimLayout() { m_simLayout = Layout::Builder(). setTheme(impl::LAYOUT_SIM). + setIsOwner(false). build(*m_widget); if (!m_simLayout) { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); @@ -330,6 +301,7 @@ namespace callui { { m_hdCallLayout = Layout::Builder(). setTheme(impl::LAYOUT_HD_CALL). + setIsOwner(false). build(*m_widget); if (!m_hdCallLayout) { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); @@ -396,39 +368,6 @@ namespace callui { return *m_widget; } - void IndicatorPresenter::udapteIncomingCallMode(bool isIncomingCallMode) - { - if (m_isIncomingCallMode == isIncomingCallMode) { - return; - } - m_isIncomingCallMode = isIncomingCallMode; - updateCentralIcon(); - } - - void IndicatorPresenter::updateCentralIcon() - { - if (m_isIncomingCallMode) { - auto state = m_provider->getState( - IndicatorProperty::VOICE_CONTROL); - - if (getVoiceControlState(state)) { - m_widget->setContent(*m_voiceControlLayout, - impl::PART_SWL_VOICE_CONTROL); - show(*m_voiceControlLayout); - - m_widget->unsetContent(impl::PART_SWL_BATTERY); - hide(*m_batteryLayout); - return; - } - } - m_widget->unsetContent(impl::PART_SWL_VOICE_CONTROL); - hide(*m_voiceControlLayout); - - m_widget->setContent(*m_batteryLayout, - impl::PART_SWL_BATTERY); - show(*m_batteryLayout); - } - void IndicatorPresenter::onStateChanged(IndicatorProperty property) { switch (property) { @@ -441,9 +380,6 @@ namespace callui { case IndicatorProperty::BATTERY: updateBatteryState(); break; - case IndicatorProperty::VOICE_CONTROL: - updateCentralIcon(); - break; case IndicatorProperty::SIM_SLOT: updateSimState(); break; diff --git a/inc/presenters/IndicatorPresenter.h b/call-ui/presenters/misc/IndicatorPresenter.h index 47a098e..26a3797 100644 --- a/inc/presenters/IndicatorPresenter.h +++ b/call-ui/presenters/misc/IndicatorPresenter.h @@ -14,30 +14,61 @@ * limitations under the License. */ -#ifndef __CALLUI_PRESENTERS_INDICATOR_PRESENTER_H__ -#define __CALLUI_PRESENTERS_INDICATOR_PRESENTER_H__ +#ifndef __CALL_UI_PRESENTERS_MISC_MISC_INDICATOR_PRESENTER_H__ +#define __CALL_UI_PRESENTERS_MISC_MISC_INDICATOR_PRESENTER_H__ #include "ucl/mvp/GuiPresenter.h" -#include "model/IIndicatorStateListener.h" #include "ucl/gui/Layout.h" #include "ucl/gui/StyledWidget.h" -#include "types.h" +#include "call-ui/model/IIndicatorStateProvider.h" + +#include "call-ui/presenters/types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(IndicatorPresenter); + + /** + * @brief Presenter of application indicator + */ class IndicatorPresenter final : public ucl::GuiPresenter, public IIndicatorStateListener { public: + + /** + * @brief IndicatorPresenter builder + */ class Builder { public: + + /** + * @brief Constructor + */ Builder(); - ~Builder(); + + /** + * @brief Sets Indicator State provider + * @param[in] provider Indicator State provider + * @return Reference to builder + */ Builder &setIndicatorStateProvider( - const IIndicatorStateProviderSRef &provider); - Builder &setParentWidget(const ucl::ElmWidgetSRef - &parentWidget); + IIndicatorStateProviderSRef provider); + + /** + * @brief Sets parent widget for UI components creation + * @param[in] parentWidget Parent widget + * @return Reference to builder + */ + Builder &setParentWidget(ucl::ElmWidgetSRef parentWidget); + + /** + * @brief Creates new instance of IndicatorPresenter + * @param[in] parent Parent presenter + * @return Shared reference to IndicatorPresenter instance + * on success or NULL otherwise + */ IndicatorPresenterSRef build(ucl::GuiPresenter &parent) const; private: IIndicatorStateProviderSRef m_provider; @@ -45,24 +76,25 @@ namespace callui { }; public: - virtual ~IndicatorPresenter(); + /** + * @brief Returns widget + * @return Reference to widget + */ ucl::Widget &getWidget(); - void udapteIncomingCallMode(bool isIncomingCallMode); - private: - friend class ucl::ReffedObj<IndicatorPresenter>; IndicatorPresenter(ucl::IRefCountObj &rc, - const IIndicatorStateProviderSRef &provider); + IIndicatorStateProviderSRef provider); + ~IndicatorPresenter() = default; - ucl::Result prepare(ucl::GuiPresenter &parent, ucl::ElmWidget &parentWidget); + ucl::Result prepare(ucl::GuiPresenter &parent, + ucl::ElmWidget &parentWidget); ucl::Result createWidget(ucl::ElmWidget &parent); ucl::Result createConnectionLayout(); ucl::Result createRssiLayout(); ucl::Result createBatteryLayout(); - ucl::Result createVoiceControlLayout(); ucl::Result createSimLayout(); ucl::Result createHdVoiceLayout(); @@ -72,25 +104,23 @@ namespace callui { void updateSimState(); void updateHdVoiceState(); - void updateCentralIcon(); - - // IIndicatorStateListener + // IIndicatorStateListener // virtual void onStateChanged(IndicatorProperty property) override final; private: + const IIndicatorStateProviderSRef m_provider; + ucl::LayoutSRef m_widget; ucl::LayoutSRef m_connLayout; ucl::LayoutSRef m_rssiLayout; ucl::LayoutSRef m_batteryLayout; ucl::LayoutSRef m_simLayout; ucl::LayoutSRef m_hdCallLayout; - ucl::LayoutSRef m_voiceControlLayout; - IIndicatorStateProviderSRef m_provider; - bool m_isIncomingCallMode; + + friend class ucl::ReffedObj<IndicatorPresenter>; }; - ucl::EdjeSignal getConnectionSignal(ConnectionType type); } -#endif // __CALLUI_PRESENTERS_INDICATOR_PRESENTER_H__ +#endif // __CALL_UI_PRESENTERS_MISC_MISC_INDICATOR_PRESENTER_H__ diff --git a/src/presenters/MoreOptionsPresenter.cpp b/call-ui/presenters/misc/MoreOptionsPresenter.cpp index 6a98eac..415503a 100644 --- a/src/presenters/MoreOptionsPresenter.cpp +++ b/call-ui/presenters/misc/MoreOptionsPresenter.cpp @@ -14,23 +14,19 @@ * limitations under the License. */ -#include "presenters/MoreOptionsPresenter.h" +#include "MoreOptionsPresenter.h" #include <app_control.h> -#include "ucl/gui/Layout.h" #include "ucl/appfw/types.h" -#include "model/ICallManager.h" -#include "model/IHeldCall.h" -#include "model/IActiveCall.h" -#include "model/ICallInfo.h" -#include "model/ISoundManager.h" +#include "call-ui/view/AoSequencer.h" -#include "presenters/KeypadPage.h" +#include "call-ui/presenters/pages/KeypadPage.h" -#include "resources.h" -#include "common.h" +#include "call-ui/resources.h" + +#include "call-ui/presenters/common.h" namespace callui { namespace { namespace impl { @@ -54,49 +50,51 @@ namespace callui { namespace { namespace impl { constexpr EdjePart PART_SWL_SLOT2 {"swl.slot.2"}; constexpr EdjePart PART_TXT_STATUS {"txt.status"}; + constexpr EdjePart PART_AO_TXT_STATUS {"ao_txt.status"}; + + constexpr EdjePart PART_ACCESS {"access"}; + constexpr EdjeSignal SIGNAL_ODD {"odd"}; constexpr EdjeSignal SIGNAL_EVEN {"even"}; constexpr EdjeSignalSrc SIGNAL_SRC_MORE_OPTION {"more_option"}; - }}} namespace callui { using namespace ucl; - // MoreOptionsPresenter::Builder + // MoreOptionsPresenter::Builder // MoreOptionsPresenter::Builder::Builder() { } MoreOptionsPresenter::Builder & - MoreOptionsPresenter::Builder::setCallManager(const ICallManagerSRef &cm) + MoreOptionsPresenter::Builder::setCallManager(ICallManagerSRef cm) { - m_cm = cm; + m_cm = std::move(cm); return *this; } MoreOptionsPresenter::Builder & - MoreOptionsPresenter::Builder::setSoundManager(const ISoundManagerSRef &sm) + MoreOptionsPresenter::Builder::setSoundManager(ISoundManagerSRef sm) { - m_sm = sm; + m_sm = std::move(sm); return *this; } MoreOptionsPresenter::Builder & - MoreOptionsPresenter::Builder::setNaviframe(const NaviframeSRef &navi) + MoreOptionsPresenter::Builder::setNaviframe(NaviframeSRef navi) { - m_navi = navi; + m_navi = std::move(navi); return *this; } MoreOptionsPresenter::Builder & - MoreOptionsPresenter::Builder::setParentWidget( - const ElmWidgetSRef &parentWidget) + MoreOptionsPresenter::Builder::setParentWidget(ElmWidgetSRef parentWidget) { - m_parentWidget = parentWidget; + m_parentWidget = std::move(parentWidget); return *this; } @@ -114,17 +112,18 @@ namespace callui { return result; } - // MoreOptionsPresenter + // MoreOptionsPresenter // MoreOptionsPresenter::MoreOptionsPresenter(IRefCountObj &rc, - const ICallManagerSRef &cm, - const ISoundManagerSRef &sm, - const NaviframeSRef &navi): - GuiPresenter(rc), - m_cm(cm), - m_sm(sm), - m_navi(navi), - m_timer(nullptr) + ICallManagerSRef cm, + ISoundManagerSRef sm, + NaviframeSRef navi): + GuiPresenter(rc), + m_cm(std::move(cm)), + m_sm(std::move(sm)), + m_navi(std::move(navi)), + m_timer(nullptr), + m_duration() { } @@ -133,15 +132,15 @@ namespace callui { stopCallDurationTimer(); if (m_widget) { - eext_object_event_callback_del(*m_widget, EEXT_CALLBACK_BACK, + eext_object_event_callback_del(as_eo(*m_widget), EEXT_CALLBACK_BACK, CALLBACK_A(MoreOptionsPresenter::onBackKey)); sendActivate(*m_widget); } - if (const auto keypad = m_keypad.lock()) { - keypad->exitNoTransition(); - } + unregisterPageTransitionCallback(); + + util::dispose(m_keypad); } Result MoreOptionsPresenter::prepare(GuiPresenter &parent, @@ -156,9 +155,13 @@ namespace callui { FAIL_RETURN(createPanelLayout(), "createPanelContent() failed!"); - FAIL_RETURN(createButtons(), "createButtons() failed!"); + FAIL_RETURN(createAccessObjects(), "createStaticAo() failed!"); + + updateComponents(); - update(); + FAIL_RETURN(createAtspiHighlightHelper(), "createAtspiHighlightHelper() failed!"); + + registerPageTransitionCallback(); deactivateBy(m_widget.get()); @@ -171,7 +174,6 @@ namespace callui { { m_widget = Layout::Builder(). setTheme(impl::LAYOUT_DRAWER_PANEL). - setIsOwner(true). build(parent); if (!m_widget) { @@ -181,26 +183,45 @@ namespace callui { return RES_OK; } + void MoreOptionsPresenter::onCueClicked(Evas_Object *obj, + const char *emission, + const char *source) + { + show(*m_fakeAo); + m_panel->setContent(*m_panelLy); + show(*m_panelLy); + + createStatusTxtAo(); + if (m_statusTxtAo) { + m_atspiHelper->registerObject(*m_statusTxtAo); + } + } + Result MoreOptionsPresenter::createPanel() { - auto *eo = elm_panel_add(*m_widget); + Evas_Object *const eo = elm_panel_add(as_eo(*m_widget)); if (!eo) { LOG_RETURN(RES_FAIL, "elm_panel_add() failed!"); } - m_panel = makeShared<StyledWidget>(eo, true); - elm_panel_orient_set(*m_panel, ELM_PANEL_ORIENT_RIGHT); + m_panel = makeShared<StyledWidget>(eo); + elm_panel_orient_set(eo, ELM_PANEL_ORIENT_RIGHT); show(*m_panel); m_widget->setContent(*m_panel, impl::PART_SWL_RIGHT); - elm_panel_toggle(*m_panel); + elm_panel_toggle(eo); - elm_layout_signal_callback_add(*m_panel, "elm,state,active,finished", + elm_layout_signal_callback_add(eo, "elm,state,active,finished", "elm", CALLBACK_A(MoreOptionsPresenter::onPanelActivate), this); - elm_layout_signal_callback_add(*m_panel, "elm,state,inactive,finished", + elm_layout_signal_callback_add(eo, "elm,state,inactive,finished", "elm", CALLBACK_A(MoreOptionsPresenter::onPanelInactivate), this); + setDeactivatorSink(m_panel); + + elm_layout_signal_callback_add(eo, "cue,clicked", + "elm", CALLBACK_A(MoreOptionsPresenter::onCueClicked), this); + return RES_OK; } @@ -218,6 +239,28 @@ namespace callui { return RES_OK; } + void MoreOptionsPresenter::registerPageTransitionCallback() + { + m_navi->addEventHandler(NAVI_TRANSITION_FINISHED, + WEAK_DELEGATE_THIS(onPageTransitionFinished)); + } + + void MoreOptionsPresenter::unregisterPageTransitionCallback() + { + m_navi->delEventHandler(NAVI_TRANSITION_FINISHED, + DELEGATE_THIS(onPageTransitionFinished)); + } + + void MoreOptionsPresenter::onPageTransitionFinished(Widget &widget, + void *eventInfo) + { + if (const auto keypad = m_keypad.lock()) { + if (keypad->isAtTop()) { + elm_panel_hidden_set(as_eo(*m_panel), EINA_TRUE); + } + } + } + void MoreOptionsPresenter::updateSlots() { unsetPanelContent(impl::PART_SWL_SLOT1); @@ -226,12 +269,19 @@ namespace callui { auto active = m_cm->getActiveCall(); auto held = m_cm->getHeldCall(); + FAIL_RETURN_VOID(createKeypadButton(), + "createKeypadButton() failed!"); + if (held) { m_panelLy->emit(impl::SIGNAL_EVEN, impl::SIGNAL_SRC_MORE_OPTION); if (active) { + FAIL_RETURN_VOID(createSwapButton(), + "createSwapButton() failed!"); setPanelContent(*m_btnSwap, impl::PART_SWL_SLOT1); } else { + FAIL_RETURN_VOID(createUnholdButton(), + "createUnholdButton() failed!"); setPanelContent(*m_btnUnhold, impl::PART_SWL_SLOT1); } setPanelContent(*m_btnKeypad, impl::PART_SWL_SLOT2); @@ -242,28 +292,32 @@ namespace callui { } } - Result MoreOptionsPresenter::createButtons() + Result MoreOptionsPresenter::createSwapButton() { - // Swap m_btnSwap = createButton(impl::STYLE_BTN_SWAP, STR_MORE_SWAP, - WEAK_DELEGATE(MoreOptionsPresenter::onSwapBtnClick, - asWeak(*this))); + WEAK_DELEGATE_THIS(onSwapBtnClick)); if (!m_btnSwap) { LOG_RETURN(RES_FAIL, "Create Swap button failed!"); } - // Unhold + return RES_OK; + } + + Result MoreOptionsPresenter::createUnholdButton() + { m_btnUnhold = createButton(impl::STYLE_BTN_UNHOLD, STR_MORE_UNHOLD, - WEAK_DELEGATE(MoreOptionsPresenter::onUnholdBtnClick, - asWeak(*this))); + WEAK_DELEGATE_THIS(onUnholdBtnClick)); if (!m_btnUnhold) { LOG_RETURN(RES_FAIL, "Create Unhold button failed!"); } - // Keypad + return RES_OK; + } + + Result MoreOptionsPresenter::createKeypadButton() + { m_btnKeypad = createButton(impl::STYLE_BTN_KEYPAD, STR_MORE_KEYPAD, - WEAK_DELEGATE(MoreOptionsPresenter::onKeypadBtnClick, - asWeak(*this))); + WEAK_DELEGATE_THIS(onKeypadBtnClick)); if (!m_btnKeypad) { LOG_RETURN(RES_FAIL, "Create Keypad button failed!"); } @@ -277,7 +331,7 @@ namespace callui { if (!held) { LOG_RETURN_VOID(RES_FAIL, "Held call is NULL"); } - FAIL_RETURN_VOID(held->swapWithActive(), "swapWithActive() failed"); + FAIL_RETURN_VOID(held->swapWithActive(), "swapWithActive() failed!"); } void MoreOptionsPresenter::onUnholdBtnClick(Widget &sender, void *eventInfo) @@ -286,7 +340,7 @@ namespace callui { if (!held) { LOG_RETURN_VOID(RES_FAIL, "Held call is NULL"); } - FAIL_RETURN_VOID(held->unhold(), "unhold() failed"); + FAIL_RETURN_VOID(held->unhold(), "unhold() failed!"); } void MoreOptionsPresenter::onKeypadBtnClick(Widget &sender, void *eventInfo) @@ -298,9 +352,7 @@ namespace callui { LOG_RETURN_VOID(RES_FAIL, "Naviframe is NULL"); } m_keypad = builder.setSoundManager(m_sm) - .build(WEAK_DELEGATE( - MoreOptionsPresenter::onPageExitRequest, - asWeak(*this))); + .build(WEAK_DELEGATE_THIS(onPageExitRequest)); } void MoreOptionsPresenter::onPageExitRequest(Page &page) @@ -312,16 +364,16 @@ namespace callui { StyledWidgetSRef MoreOptionsPresenter::createButton( const ElmStyle &style, const TString &txt, - const WidgetEventHandler &handler) + WidgetEventHandler handler) { - auto *eo = elm_button_add(*m_panelLy); + Evas_Object *const eo = elm_button_add(as_eo(*m_panelLy)); if (!eo) { LOG_RETURN_VALUE(RES_FAIL, {}, "elm_button_add() failed!"); } - auto btn = makeShared<StyledWidget>(eo, true); + const auto btn = makeShared<StyledWidget>(eo); btn->setStyle(style); btn->setText(txt); - btn->addEventHandler(BTN_CLICKED, handler); + btn->addEventHandler(BTN_CLICKED, std::move(handler)); hide(*btn); btn->bindToEo(); @@ -336,6 +388,11 @@ namespace callui { void MoreOptionsPresenter::update() { + updateComponents(); + } + + void MoreOptionsPresenter::updateComponents() + { updateSlots(); updateStatusText(); } @@ -344,30 +401,40 @@ namespace callui { const char *emission, const char *source) { - eext_object_event_callback_add(*m_widget, EEXT_CALLBACK_BACK, + eext_object_event_callback_add(as_eo(*m_widget), EEXT_CALLBACK_BACK, CALLBACK_A(MoreOptionsPresenter::onBackKey), this); const auto keepAliver = asShared(*this); sendDeactivate(*m_widget); activateBy(m_widget.get()); + + m_fakeAo->getAtspi().highlight(); } void MoreOptionsPresenter::onPanelInactivate(Evas_Object *obj, const char *emission, const char *source) { - eext_object_event_callback_del(*m_widget, EEXT_CALLBACK_BACK, + eext_object_event_callback_del(as_eo(*m_widget), EEXT_CALLBACK_BACK, CALLBACK_A(MoreOptionsPresenter::onBackKey)); const auto keepAliver = asShared(*this); deactivateBy(m_widget.get()); sendActivate(*m_widget); + + m_panel->unsetContent(); + hide(*m_panelLy); + m_statusTxtAo.reset(); + + m_cueAo->getAtspi().setHighlightable(true); + + hide(*m_fakeAo); } void MoreOptionsPresenter::onBackKey(Evas_Object *obj, void *eventInfo) { - if (isActive() && !elm_panel_hidden_get(*m_panel)) { - elm_panel_toggle(*m_panel); + if (isActive() && !elm_panel_hidden_get(as_eo(*m_panel))) { + elm_panel_toggle(as_eo(*m_panel)); } } @@ -391,7 +458,8 @@ namespace callui { } m_info = info; m_duration = info->getDuration(); - setCallDuration(m_duration, *m_panelLy, impl::PART_TXT_STATUS); + auto temp = getCallDurationTxt(m_duration); + m_panelLy->setText(temp, impl::PART_TXT_STATUS); FAIL_RETURN_VOID(startCallDurationTimer(), "startTimer() failed!"); @@ -409,11 +477,11 @@ namespace callui { } struct tm tmp = info->getDuration(); - tryUpdateCallDurationTime( - m_duration, - tmp, - *m_panelLy, - impl::PART_TXT_STATUS); + if ((m_duration.tm_sec - tmp.tm_sec) != 0) { + m_duration = tmp; + m_panelLy->setText(getCallDurationTxt(m_duration), + impl::PART_TXT_STATUS); + } return ECORE_CALLBACK_RENEW; } @@ -454,4 +522,168 @@ namespace callui { m_panelLy->setContent(widget, part); show(widget); } + + Result MoreOptionsPresenter::createAtspiHighlightHelper() + { + m_atspiHelper = AtspiHighlightHelper::newInstance(*this); + if (!m_atspiHelper) { + LOG_RETURN(RES_FAIL, + "AtspiHighlightHelper::newInstance() failed!"); + } + + m_atspiHelper->setEventHandler( + WEAK_DELEGATE_THIS(onAtspiHighlight)); + + + m_atspiHelper->registerObject(getWindow()); + + if (m_fakeAo) { + m_atspiHelper->registerObject(*m_fakeAo); + } + + if (m_panelLy) { + m_atspiHelper->registerObject(*m_panelLy); + } + + if (m_btnSwap) { + m_atspiHelper->registerObject(*m_btnSwap); + } + + if (m_btnUnhold) { + m_atspiHelper->registerObject(*m_btnUnhold); + } + + if (m_btnKeypad) { + m_atspiHelper->registerObject(*m_btnKeypad); + } + + if (m_statusTxtAo) { + m_atspiHelper->registerObject(*m_statusTxtAo); + } + + return RES_OK; + } + + const Elm_Interface_Atspi_Accessible * + MoreOptionsPresenter::onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + if (ao == as_ao(m_fakeAo)) { + if (m_btnSwap) { + return as_ao(m_btnSwap); + } else if (m_btnUnhold) { + return as_ao(m_btnUnhold); + } else { + return as_ao(m_btnKeypad); + } + } + + return AoSequencer(ao, flowRelation). + process(m_btnSwap). + process(m_btnUnhold). + process(m_btnKeypad). + process(m_statusTxtAo). + getNext(); + } + + Result MoreOptionsPresenter::createAccessObjects() + { + FAIL_RETURN(createCueAo(), "createCueAo() failed!"); + FAIL_RETURN(createStatusTxtAo(), "createStatusTxtAo() failed!"); + FAIL_RETURN(createFakeAo(), "createFakeAo() failed!"); + + return RES_OK; + } + + Result MoreOptionsPresenter::createCueAo() + { + m_cueAo = utils::createAccessObjectFromPart(*m_widget, *m_panel, + impl::PART_ACCESS); + if (!m_cueAo) { + LOG_RETURN(RES_FAIL, + "createAccessObjectFromPart() failed!"); + } + elm_access_action_cb_set(as_eo(*m_cueAo), + ELM_ACCESS_ACTION_ACTIVATE, + CALLBACK_A(MoreOptionsPresenter::onCueAoActionCb), + this); + + auto &atspi = m_cueAo->getAtspi(); + atspi.setTDomain(TEXT_DOMAIN); + atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | + ELM_ACCESSIBLE_READING_INFO_TYPE_ROLE); + atspi.setName(AO_STR_MORE_OPTIONS); + atspi.setRole(ELM_ATSPI_ROLE_PUSH_BUTTON); + + return RES_OK; + } + + ElmWidget *MoreOptionsPresenter::getCueAo() + { + return m_cueAo.get(); + } + + Result MoreOptionsPresenter::createFakeAo() + { + m_fakeAo = utils::createFakeAccessObject(*m_panel); + if (!m_fakeAo) { + LOG_RETURN(RES_FAIL, "createFakeAccessObject() failed!"); + } + + return RES_OK; + } + + Result MoreOptionsPresenter::createStatusTxtAo() + { + m_statusTxtAo = utils::createAccessObjectFromPart(*m_panelLy, + *m_panelLy, impl::PART_AO_TXT_STATUS); + if (!m_statusTxtAo) { + LOG_RETURN(RES_FAIL, + "createAccessObjectFromPart() failed!"); + } + + auto &atspi = m_statusTxtAo->getAtspi(); + atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); + atspi.setNameCb(WEAK_DELEGATE_THIS(onStatusTxtAoNameCb)); + + return RES_OK; + } + + CString MoreOptionsPresenter::onStatusTxtAoNameCb(Atspi &atspi) + { + const auto text = m_panelLy->getText(impl::PART_TXT_STATUS); + return (!text.empty()) ? CString::dup(text.c_str()) : nullptr; + } + + Eina_Bool MoreOptionsPresenter::onCueAoActionCb(Evas_Object *obj, + Elm_Access_Action_Info *actionInfo) + { + switch (actionInfo->action_type) { + case ELM_ACCESS_ACTION_ACTIVATE: + { + show(*m_fakeAo); + m_panel->setContent(*m_panelLy); + show(*m_panelLy); + createStatusTxtAo(); + + if (m_statusTxtAo) { + m_atspiHelper->registerObject(*m_statusTxtAo); + } + + elm_panel_toggle(as_eo(*m_panel)); + + auto &atspi = m_cueAo->getAtspi(); + atspi.unhighlight(); + atspi.setHighlightable(false); + + return EINA_TRUE; + break; + } + default: + break; + } + + return EINA_FALSE; + } } diff --git a/call-ui/presenters/misc/MoreOptionsPresenter.h b/call-ui/presenters/misc/MoreOptionsPresenter.h new file mode 100644 index 0000000..ddea718 --- /dev/null +++ b/call-ui/presenters/misc/MoreOptionsPresenter.h @@ -0,0 +1,211 @@ +/* + * 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_MISC_MORE_OPTIONS_PRESENTER_H__ +#define __CALL_UI_PRESENTERS_MISC_MORE_OPTIONS_PRESENTER_H__ + +#include "ucl/mvp/GuiPresenter.h" + +#include "ucl/gui/Layout.h" +#include "ucl/gui/Naviframe.h" + +#include "call-ui/model/ICallManager.h" +#include "call-ui/model/ISoundManager.h" + +#include "call-ui/presenters/pages/base/Page.h" +#include "AtspiHighlightHelper.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(MoreOptionsPresenter); + + /** + * Presenter of More options + */ + class MoreOptionsPresenter final : public ucl::GuiPresenter { + public: + /** + * @brief MoreOptionsPresenter builder + */ + class Builder { + public: + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets Call Manager instance + * @param[in] cm Call Manager instance + * @return Reference to builder + */ + Builder &setCallManager(ICallManagerSRef cm); + + /** + * @brief Sets Sound Manager instance + * @param[in] sm Sound Manager instance + * @return Reference to builder + */ + Builder &setSoundManager(ISoundManagerSRef sm); + + /** + * @brief Sets Naviframe instance + * @param[in] sm Naviframe instance + * @return Reference to builder + */ + Builder &setNaviframe(ucl::NaviframeSRef navi); + + /** + * @brief Sets parent widget for UI components creation + * @param[in] parentWidget Parent widget + * @return Reference to builder + */ + Builder &setParentWidget(ucl::ElmWidgetSRef parentWidget); + + /** + * @brief Creates new instance of MoreOptionsPresenter + * @param[in] parent Parent presenter + * @return Shared reference to MoreOptionsPresenter instance + * on success or NULL otherwise + */ + MoreOptionsPresenterSRef build(ucl::GuiPresenter &parent) const; + + private: + ICallManagerSRef m_cm; + ISoundManagerSRef m_sm; + ucl::NaviframeSRef m_navi; + ucl::ElmWidgetSRef m_parentWidget; + }; + + public: + + /** + * @brief Returns widget + * @return Reference to widget + */ + ucl::Widget &getWidget(); + + /** + * @brief Updates presenter + */ + void update(); + + /** + * @brief Gets Access object of More options cue + * @remark Use only for Screen Reader feature + */ + ucl::ElmWidget *getCueAo(); + + private: + MoreOptionsPresenter(ucl::IRefCountObj &rc, + ICallManagerSRef cm, + ISoundManagerSRef sm, + ucl::NaviframeSRef navi); + ~MoreOptionsPresenter(); + + ucl::Result prepare(ucl::GuiPresenter &parent, + ucl::ElmWidget &parentWidget); + + void updateComponents(); + + ucl::Result createWidget(ucl::ElmWidget &parent); + ucl::Result createPanel(); + ucl::Result createPanelLayout(); + + ucl::Result createSwapButton(); + ucl::Result createUnholdButton(); + ucl::Result createKeypadButton(); + + ucl::StyledWidgetSRef createButton(const ucl::ElmStyle &style, + const ucl::TString &txt, + ucl::WidgetEventHandler handler); + + void registerPageTransitionCallback(); + void unregisterPageTransitionCallback(); + void onPageTransitionFinished(ucl::Widget &widget, void *eventInfo); + + void updateSlots(); + void updateStatusText(); + + void onSwapBtnClick(ucl::Widget &sender, void *eventInfo); + void onUnholdBtnClick(ucl::Widget &sender, void *eventInfo); + void onKeypadBtnClick(ucl::Widget &sender, void *eventInfo); + + void onBackKey(Evas_Object *obj, void *eventInfo); + + void onPanelActivate(Evas_Object *obj, + const char *emission, + const char *source); + void onPanelInactivate(Evas_Object *obj, + const char *emission, + const char *source); + void onCueClicked(Evas_Object *obj, + const char *emission, + const char *source); + + ucl::Result startCallDurationTimer(); + void stopCallDurationTimer(); + Eina_Bool onCallDurationTimerCb(); + + void unsetPanelContent(const ucl::EdjePart &part); + void setPanelContent(ucl::StyledWidget &widget, + const ucl::EdjePart &part); + + void onPageExitRequest(Page &page); + + ucl::Result createAccessObjects(); + ucl::Result createCueAo(); + ucl::Result createStatusTxtAo(); + ucl::Result createFakeAo(); + ucl::Result createAtspiHighlightHelper(); + const Elm_Interface_Atspi_Accessible *onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation); + Eina_Bool onCueAoActionCb(Evas_Object *obj, + Elm_Access_Action_Info *actionInfo); + + ucl::CString onStatusTxtAoNameCb(ucl::Atspi &atspi); + + private: + const ICallManagerSRef m_cm; + const ISoundManagerSRef m_sm; + const ucl::NaviframeSRef m_navi; + + ucl::LayoutSRef m_widget; + ucl::StyledWidgetSRef m_panel; + ucl::LayoutSRef m_panelLy; + ucl::StyledWidgetSRef m_btnSwap; + ucl::StyledWidgetSRef m_btnUnhold; + ucl::StyledWidgetSRef m_btnKeypad; + + PageWRef m_keypad; + ICallInfoWCRef m_info; + + Ecore_Timer *m_timer; + struct tm m_duration; + + AtspiHighlightHelperSRef m_atspiHelper; + ucl::ElmWidgetSRef m_fakeAo; + ucl::ElmWidgetSRef m_cueAo; + ucl::ElmWidgetSRef m_statusTxtAo; + + friend class ucl::ReffedObj<MoreOptionsPresenter>; + }; +} + +#endif // __CALL_UI_PRESENTERS_MISC_MORE_OPTIONS_PRESENTER_H__ diff --git a/src/presenters/MotionSensorPresenter.cpp b/call-ui/presenters/misc/MotionSensorPresenter.cpp index 4914528..c6f290a 100644 --- a/src/presenters/MotionSensorPresenter.cpp +++ b/call-ui/presenters/misc/MotionSensorPresenter.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "presenters/MotionSensorPresenter.h" +#include "MotionSensorPresenter.h" -#include "common.h" +#include "call-ui/presenters/common.h" namespace callui { @@ -26,23 +26,18 @@ namespace callui { { } - MotionSensorPresenter::Builder::~Builder() - { - } - MotionSensorPresenterSRef - MotionSensorPresenter::Builder::build( - const MotionSensorHandler handler) const + MotionSensorPresenter::Builder::build(NotiHandler handler) const { - auto result = makeShared<MotionSensorPresenter>(handler); + auto result = makeShared<MotionSensorPresenter>(std::move(handler)); FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!"); return result; } MotionSensorPresenter::MotionSensorPresenter( - const MotionSensorHandler &handler): - m_handler(handler), + NotiHandler handler): + m_handler(std::move(handler)), m_gesture(nullptr) { } @@ -92,8 +87,10 @@ namespace callui { "err[%d] msg[%s]", res, get_error_message(res)); } - if (event == GESTURE_EVENT_DETECTED && m_handler) { - m_handler(); + if (event == GESTURE_EVENT_DETECTED) { + if (const auto handler = m_handler.lock()) { + handler(); + } } } } diff --git a/inc/presenters/MotionSensorPresenter.h b/call-ui/presenters/misc/MotionSensorPresenter.h index 0805c38..ea9556f 100644 --- a/inc/presenters/MotionSensorPresenter.h +++ b/call-ui/presenters/misc/MotionSensorPresenter.h @@ -14,27 +14,45 @@ * limitations under the License. */ -#ifndef __CALLUI_PRESENTERS_MOTION_SENSOR_PRESENTER_H__ -#define __CALLUI_PRESENTERS_MOTION_SENSOR_PRESENTER_H__ +#ifndef __CALL_UI_PRESENTERS_MISC_MOTION_SENSOR_PRESENTER_H__ +#define __CALL_UI_PRESENTERS_MISC_MOTION_SENSOR_PRESENTER_H__ #include <gesture_recognition.h> -#include "types.h" +#include "call-ui/presenters/types.h" namespace callui { + UCL_DECLARE_REF_ALIASES(MotionSensorPresenter); + + /** + * @brief Presenter of device Motion Sensor + */ class MotionSensorPresenter final { public: + + /** + * @brief MotionSensorPresenter builder + */ class Builder { public: + + /** + * @brief Constructor + */ Builder(); - ~Builder(); - MotionSensorPresenterSRef build(const MotionSensorHandler handler) const; + + /** + * @brief Creates new instance of MotionSensorPresenter + * @param[in] handler Motion event handler + * @return Shared reference to MotionSensorPresenter instance + * on success or NULL otherwise + */ + MotionSensorPresenterSRef build(NotiHandler handler) const; }; private: - friend class ucl::ReffedObj<MotionSensorPresenter>; - MotionSensorPresenter(const MotionSensorHandler &handler); - virtual ~MotionSensorPresenter(); + MotionSensorPresenter(NotiHandler handler); + ~MotionSensorPresenter(); ucl::Result prepare(); @@ -44,10 +62,13 @@ namespace callui { gesture_error_e error); private: - MotionSensorHandler m_handler; + const NotiHandler m_handler; + gesture_h m_gesture; + + friend class ucl::ReffedObj<MotionSensorPresenter>; }; } -#endif // __CALLUI_PRESENTERS_MOTION_SENSOR_PRESENTER_H__ +#endif // __CALL_UI_PRESENTERS_MISC_MOTION_SENSOR_PRESENTER_H__ diff --git a/call-ui/presenters/misc/RejectMsgPresenter.cpp b/call-ui/presenters/misc/RejectMsgPresenter.cpp new file mode 100644 index 0000000..9a7ec34 --- /dev/null +++ b/call-ui/presenters/misc/RejectMsgPresenter.cpp @@ -0,0 +1,501 @@ +/* + * 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 "RejectMsgPresenter.h" + +#include "call-ui/presenters/items/RejectMsgListItem.h" +#include "call-ui/presenters/misc/helpers.h" + +#include "call-ui/view/AoSequencer.h" + +#include "call-ui/resources.h" + +#include "call-ui/presenters/common.h" + +namespace callui { namespace { namespace impl { + + using namespace ucl; + + const int ALPHA_CHANNEL_MAX = 255; + + constexpr LayoutTheme LAYOUT_DRAWER_PANEL + {"layout", "drawer", "panel"}; + + constexpr LayoutTheme LAYOUT_RM_PANEL_CONTENT + {"layout", "callui", "rm_panel_content"}; + + constexpr EdjePart PART_SWL_RIGHT {"elm.swallow.right"}; + constexpr EdjePart PART_SWL_BG {"elm.swallow.bg"}; + + constexpr EdjePart PART_SWL_CONTENT {"swl.content"}; + constexpr EdjePart PART_SWL_SCROLLER {"swl.scroller"}; + + constexpr SmartEvent EVENT_SCROLL {"scroll"}; + +}}} + +namespace callui { + + using namespace ucl; + + class RejectMsgPresenter::RejectMsgItem : public NonCopyable { + public: + RejectMsgItem(const IRejectMsgSRef &rm): + m_rm(rm) + { + } + + virtual ~RejectMsgItem() = default; + + std::string getDisplayText() const + { + auto trnsTxt = TString{m_rm->getText(), true}.translate(); + + auto markupTxt = elm_entry_utf8_to_markup(trnsTxt); + std::string resStr(nz(markupTxt)); + replaceSubstringInString(resStr, "<br/>", " "); + free(markupTxt); + + return resStr; + } + + IRejectMsgSRef getRejectMsg() const + { + return m_rm; + } + + private: + IRejectMsgSRef m_rm; + }; + + RejectMsgPresenter::Builder::Builder() + { + } + + RejectMsgPresenter::Builder & + RejectMsgPresenter::Builder::setProvider(IRejectMsgProviderSRef provider) + { + m_provider = std::move(provider); + return *this; + } + + RejectMsgPresenter::Builder & + RejectMsgPresenter::Builder::setStateHandler(StateHandler handler) + { + m_stateHandler = std::move(handler); + return *this; + } + + RejectMsgPresenter::Builder & + RejectMsgPresenter::Builder::setSelectHandler(SelectHandler handler) + { + m_selectHandler = std::move(handler); + return *this; + } + + RejectMsgPresenter::Builder & + RejectMsgPresenter::Builder::setParentWidget(ElmWidgetSRef parentWidget) + { + m_parentWidget = std::move(parentWidget); + return *this; + } + + RejectMsgPresenterSRef + RejectMsgPresenter::Builder::build(GuiPresenter &parent) const + { + if (!m_provider || !m_parentWidget) { + LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set"); + } + + auto result = makeShared<RejectMsgPresenter>(m_provider, + m_stateHandler, + m_selectHandler); + FAIL_RETURN_VALUE(result->prepare(parent, *m_parentWidget), {}, + "result->prepare() failed!"); + + return result; + } + + RejectMsgPresenter::RejectMsgPresenter(IRefCountObj &rc, + IRejectMsgProviderSRef provider, + StateHandler stateHandler, + SelectHandler selectHandler): + GuiPresenter(rc), + m_provider(std::move(provider)), + m_stateHandler(std::move(stateHandler)), + m_selectHandler(std::move(selectHandler)), + m_circleEo(nullptr), + m_circleSurface(nullptr), + m_state(State::HIDDEN) + { + } + + RejectMsgPresenter::~RejectMsgPresenter() + { + if (m_widget) { + sendActivate(*m_widget); + } + } + + Result RejectMsgPresenter::prepare(GuiPresenter &parent, + ElmWidget &parentWidget) + { + FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR), + "Presenter::prepare() failed!"); + + FAIL_RETURN(createWidget(parentWidget), + "createWidget() failed!"); + FAIL_RETURN(createPanel(), + "createPanel() failed!"); + FAIL_RETURN(createPanelBg(), + "createPanelBg() failed!"); + FAIL_RETURN(createPanelLy(), + "createPanelLy() failed!"); + FAIL_RETURN(createCircleSurfaceLy(), + "createCircleSurfaceLy() failed!"); + FAIL_RETURN(createAtspiHighlightHelper(), + "createScreenReaderRoute() failed!"); + + deactivateSelf(); + + parent.addDeactivatorSource(*m_widget); + + return RES_OK; + } + + Result RejectMsgPresenter::createWidget(ElmWidget &parent) + { + m_widget = Layout::Builder(). + setTheme(impl::LAYOUT_DRAWER_PANEL). + build(parent); + + if (!m_widget) { + LOG_RETURN(RES_FAIL, "Layout::build() failed!"); + } + + eext_object_event_callback_add(as_eo(*m_widget), EEXT_CALLBACK_BACK, + CALLBACK_A(RejectMsgPresenter::onBackKey), this); + + return RES_OK; + } + + void RejectMsgPresenter::onBackKey(Evas_Object *obj, void *eventInfo) + { + if (isActive()) { + hidePanel(); + } + } + + void RejectMsgPresenter::panelScrollCb(Widget &widget, void *eventInfo) + { + Elm_Panel_Scroll_Info *ev = + static_cast<Elm_Panel_Scroll_Info *>(eventInfo); + DLOG("pos x[%f] y[%f]", ev->rel_x, ev->rel_y); + auto prevState = m_state; + + if (ev->rel_y == 1.0) { + m_state = State::SHOWN; + // Prevent panel scrolling + elm_object_scroll_freeze_push(as_eo(*m_panel)); + } else if (ev->rel_y == 0.0) { + m_state = State::HIDDEN; + destroyRejectMsgList(); + } else { + if (!m_listPresenter) { + FAIL_RETURN_VOID(createRejectMsgList(), + "createRejectMsgList() failed!"); + } + + m_state = State::IN_TRANSITION; + const auto alphaValue = + static_cast<int>(impl::ALPHA_CHANNEL_MAX * ev->rel_y); + m_panelBg->setColor(0, alphaValue); + } + + if (prevState != m_state) { + if (m_state == State::SHOWN) { + activateSelf(); + } else { + deactivateSelf(); + } + + if (m_state == State::HIDDEN) { + sendActivate(*m_widget); + } else { + sendDeactivate(*m_widget); + } + + if (const auto handler = m_stateHandler.lock()) { + handler(m_state); + } + } + } + + Result RejectMsgPresenter::createPanel() + { + Evas_Object *const eo = elm_panel_add(as_eo(*m_widget)); + if (!eo) { + LOG_RETURN(RES_FAIL, "elm_panel_add() failed!"); + } + m_panel = makeShared<StyledWidget>(eo); + + elm_panel_scrollable_set(eo, EINA_TRUE); + elm_panel_scrollable_content_size_set(eo, 1.0); + elm_panel_hidden_set(eo, EINA_TRUE); + elm_panel_orient_set(eo, ELM_PANEL_ORIENT_BOTTOM); + show(*m_panel); + + m_panel->addEventHandler(impl::EVENT_SCROLL, + WEAK_DELEGATE_THIS(panelScrollCb)); + + m_widget->setContent(*m_panel, impl::PART_SWL_RIGHT); + + setDeactivatorSink(m_panel); + + return RES_OK; + } + + Result RejectMsgPresenter::createPanelBg() + { + Evas_Object *const eo = evas_object_rectangle_add( + evas_object_evas_get(as_eo(*m_widget))); + if (!eo) { + LOG_RETURN(RES_FAIL, "evas_object_rectangle_add() failed!"); + } + + m_panelBg = makeShared<ElmWidget>(eo); + m_panelBg->setColor(0, 0); + show(*m_panelBg); + + m_widget->setContent(*m_panelBg, impl::PART_SWL_BG); + + return RES_OK; + } + + Result RejectMsgPresenter::createPanelLy() + { + m_panelLy = Layout::Builder(). + setTheme(impl::LAYOUT_RM_PANEL_CONTENT). + build(*m_panel); + if (!m_panelLy) { + LOG_RETURN(RES_FAIL, "Layout::build failed!"); + } + + m_panel->setContent(*m_panelLy); + + return RES_OK; + } + + Result RejectMsgPresenter::createCircleSurfaceLy() + { + const auto circleLy = Layout::Builder(). + setIsOwner(false). + build(*m_panelLy); + if (!circleLy) { + LOG_RETURN(RES_FAIL, "Layout::build failed!"); + } + m_panelLy->setContent(*circleLy, impl::PART_SWL_SCROLLER); + + m_circleSurface = eext_circle_surface_layout_add(as_eo(*circleLy)); + if (!m_circleSurface) { + LOG_RETURN(RES_FAIL, "eext_circle_surface_layout_add() failed!"); + } + + return RES_OK; + } + + Result RejectMsgPresenter::createRejectMsgList() + { + FAIL_RETURN(makeList(), "makeList() failed!"); + + FAIL_RETURN(makeListItems(), "makeListItems() failed!"); + + registerListItemsAo(); + + return RES_OK; + } + + void RejectMsgPresenter::destroyRejectMsgList() + { + deactivateRotary(); + + m_circleEo = nullptr; + + m_firstItem.reset(); + m_lastItem.reset(); + + m_listPresenter.reset(); + } + + Result RejectMsgPresenter::makeList() + { + m_listPresenter = ListPresenter::Builder(). + setParentWidget(m_panelLy). + build(*this); + if (!m_listPresenter) { + LOG_RETURN(RES_FAIL, "ListPresenter::build() failed!"); + } + m_panelLy->setContent(m_listPresenter->getWidget(), + impl::PART_SWL_CONTENT); + + m_circleEo = eext_circle_object_genlist_add( + as_eo(m_listPresenter->getWidget()), m_circleSurface); + if (!m_circleEo) { + LOG_RETURN(RES_FAIL, "elm_genlist_add() failed!"); + } + eext_circle_object_genlist_scroller_policy_set(m_circleEo, + ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + + deactivateRotary(); + + return RES_OK; + } + + Result RejectMsgPresenter::makeListItems() + { + m_firstItem = makeTitleListItem(STR_DECLINE_MESSAGES); + FAIL_RETURN(m_listPresenter->append(*m_firstItem), + "m_listPresenter->append failed!"); + + auto msgList = m_provider->getMsgList(); + const int listSize = msgList.size(); + + for (int i = 0 ; i < listSize; i++) { + RejectMsgListItemSRef rmItem = RejectMsgListItem::newInstance( + msgList[i], + WEAK_DELEGATE_THIS(onRejectMsgListItemSelect)); + FAIL_RETURN(m_listPresenter->append(*rmItem), + "m_listPresenter->append failed!"); + + if (i == listSize - 1) { + m_lastItem = rmItem; + } + } + + FAIL_RETURN(m_listPresenter->append(*makePaddingListItem()), + "m_listPresenter->append failed!"); + + return RES_OK; + } + + void RejectMsgPresenter::onRejectMsgListItemSelect(const IRejectMsgSRef &rm) + { + handleSelectEvent(rm); + } + + void RejectMsgPresenter::handleSelectEvent(const IRejectMsgSRef &rm) + { + if (const auto handler = m_selectHandler.lock()) { + handler(rm); + } + } + + Widget &RejectMsgPresenter::getWidget() + { + return *m_widget; + } + + RejectMsgPresenter::State RejectMsgPresenter::getState() + { + return m_state; + } + + void RejectMsgPresenter::showPanel() + { + DLOG(); + if (m_state != State::SHOWN) { + DLOG("Panel state [NOT SHOWN]"); + elm_panel_hidden_set(as_eo(*m_panel), EINA_FALSE); + } + } + + void RejectMsgPresenter::hidePanel() + { + DLOG(); + if (m_state == State::SHOWN) { + DLOG("Panel state [SHOWN]"); + elm_object_scroll_freeze_pop(as_eo(*m_panel)); + elm_panel_hidden_set(as_eo(*m_panel), EINA_TRUE); + } + } + + void RejectMsgPresenter::onActivate() + { + DLOG(); + activateRotary(); + } + + void RejectMsgPresenter::onDeactivate() + { + DLOG(); + deactivateRotary(); + } + + void RejectMsgPresenter::activateRotary() + { + if (m_circleEo) { + eext_rotary_object_event_activated_set(m_circleEo, EINA_TRUE); + } + } + + void RejectMsgPresenter::deactivateRotary() + { + if (m_circleEo) { + eext_rotary_object_event_activated_set(m_circleEo, EINA_FALSE); + } + } + + Result RejectMsgPresenter::createAtspiHighlightHelper() + { + m_atspiHelper = AtspiHighlightHelper::newInstance(*this); + if (!m_atspiHelper) { + LOG_RETURN(RES_FAIL, + "AtspiHighlightHelper::newInstance() failed!"); + } + + m_atspiHelper->registerObject(getWindow()); + + m_atspiHelper->setEventHandler(WEAK_DELEGATE_THIS(onAtspiHighlight)); + + return RES_OK; + } + + void RejectMsgPresenter::registerListItemsAo() + { + if (m_firstItem) { + m_atspiHelper->registerObject(*m_firstItem); + } + + if (m_lastItem) { + m_atspiHelper->registerObject(*m_lastItem); + } + } + + const Elm_Interface_Atspi_Accessible *RejectMsgPresenter::onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + if (ao == as_ao(getWindow())) { + return as_ao(m_firstItem); + } + + return AoSequencer(ao, flowRelation). + process(m_firstItem). + processDefault(). + process(m_lastItem). + getNext(); + } +} diff --git a/call-ui/presenters/misc/RejectMsgPresenter.h b/call-ui/presenters/misc/RejectMsgPresenter.h new file mode 100644 index 0000000..48fccb5 --- /dev/null +++ b/call-ui/presenters/misc/RejectMsgPresenter.h @@ -0,0 +1,210 @@ +/* + * 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_MISC_REJECT_MESSAGE_PRESENTER_H__ +#define __CALL_UI_PRESENTERS_MISC_REJECT_MESSAGE_PRESENTER_H__ + +#include "ucl/mvp/ListPresenter.h" + +#include "ucl/gui/Layout.h" +#include "ucl/gui/StyledWidget.h" + +#include "call-ui/model/IRejectMsgProvider.h" + +#include "AtspiHighlightHelper.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(RejectMsgPresenter); + + /** + * @brief Presenter of Reject messages view + */ + class RejectMsgPresenter final : public ucl::GuiPresenter { + public: + + /** + * @brief Enumeration of Reject message states + */ + enum class State { + HIDDEN, /**< Reject message panel is hidden */ + IN_TRANSITION, /**< Reject message panel is in animation transition to appear/disappear */ + SHOWN /**< Reject message panel is shown */ + }; + + /** + * State change event handler definition + */ + using StateHandler = ucl::WeakDelegate<void(State)>; + + /** + * Select reject message event handler definition + */ + using SelectHandler = ucl::WeakDelegate<void( + const IRejectMsgSRef &rm)>; + + public: + + /** + * @brief RejectMsgPresenter builder + */ + class Builder { + public: + + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets Reject message provider + * @param[in] provider Reject message provider instance + * @return Reference to builder + */ + Builder &setProvider(IRejectMsgProviderSRef provider); + + /** + * @brief Sets state change event handler + * @param[in] handler State change event handler + * @return Reference to builder + */ + Builder &setStateHandler(StateHandler handler); + + /** + * @brief Sets select reject message event handler + * @param[in] handler Select reject message event handler + * @return Reference to builder + */ + Builder &setSelectHandler(SelectHandler handler); + + /** + * @brief Sets parent widget for UI components creation + * @param[in] parentWidget Parent widget + * @return Reference to builder + */ + Builder &setParentWidget(ucl::ElmWidgetSRef parentWidget); + + /** + * @brief Creates new instance of RejectMsgPresenter + * @param[in] parent Parent presenter + * @return Shared reference to RejectMsgPresenter instance + * on success or NULL otherwise + */ + RejectMsgPresenterSRef build(ucl::GuiPresenter &parent) const; + + private: + IRejectMsgProviderSRef m_provider; + StateHandler m_stateHandler; + SelectHandler m_selectHandler; + ucl::ElmWidgetSRef m_parentWidget; + }; + + public: + + /** + * @brief Returns widget + * @return Reference to widget + */ + ucl::Widget &getWidget(); + + /** + * @brief Returns current state + * @return Current state + */ + State getState(); + + /** + * @brief Requests to show Reject message panel + */ + void showPanel(); + + /** + * @brief Requests to hide Reject message panel + */ + void hidePanel(); + + private: + class RejectMsgItem; + + private: + RejectMsgPresenter(ucl::IRefCountObj &rc, + IRejectMsgProviderSRef provider, + StateHandler stateHandler, + SelectHandler selectHandler); + ~RejectMsgPresenter(); + + ucl::Result prepare(ucl::GuiPresenter &parent, + ucl::ElmWidget &parentWidget); + + ucl::Result createWidget(ucl::ElmWidget &parent); + ucl::Result createPanel(); + ucl::Result createPanelBg(); + ucl::Result createPanelLy(); + ucl::Result createCircleSurfaceLy(); + + ucl::Result createRejectMsgList(); + void destroyRejectMsgList(); + ucl::Result makeList(); + ucl::Result makeListItems(); + void onRejectMsgListItemSelect(const IRejectMsgSRef &rm); + void handleSelectEvent(const IRejectMsgSRef &rm); + + void panelScrollCb(ucl::Widget &widget, void *eventInfo); + + void activateRotary(); + void deactivateRotary(); + + void onBackKey(Evas_Object *obj, void *eventInfo); + + ucl::Result createAtspiHighlightHelper(); + void registerListItemsAo(); + const Elm_Interface_Atspi_Accessible *onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation); + + // GuiPresenter // + + virtual void onActivate() final override; + virtual void onDeactivate() final override; + + private: + const IRejectMsgProviderSRef m_provider; + const StateHandler m_stateHandler; + const SelectHandler m_selectHandler; + + ucl::ListPresenterSRef m_listPresenter; + ucl::ListItemPresenterSRef m_firstItem; + ucl::ListItemPresenterSRef m_lastItem; + + ucl::LayoutSRef m_widget; + ucl::StyledWidgetSRef m_panel; + ucl::ElmWidgetSRef m_panelBg; + ucl::LayoutSRef m_panelLy; + Evas_Object *m_circleEo; + Eext_Circle_Surface *m_circleSurface; + + State m_state; + + AtspiHighlightHelperSRef m_atspiHelper; + + friend class ucl::ReffedObj<RejectMsgPresenter>; + }; + +} + +#endif // __CALL_UI_PRESENTERS_MISC_REJECT_MESSAGE_PRESENTER_H__ diff --git a/call-ui/presenters/misc/VolumeControlPresenter.cpp b/call-ui/presenters/misc/VolumeControlPresenter.cpp new file mode 100644 index 0000000..7d6a81d --- /dev/null +++ b/call-ui/presenters/misc/VolumeControlPresenter.cpp @@ -0,0 +1,418 @@ +/* + * 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 "VolumeControlPresenter.h" + +#include "call-ui/view/AoSequencer.h" + +#include "call-ui/resources.h" + +#include "call-ui/presenters/common.h" + +namespace callui { namespace { namespace impl { + + constexpr auto DEFAULT_TIMER_INTERVAL = 1.5; + constexpr auto SCREEN_READER_TIMER_INTERVAL = 5; + constexpr auto VOLUME_LEVEL_MIN = 1; +}}} + +namespace callui { + + using namespace ucl; + + // VolumeControlPresenter::Builder // + + VolumeControlPresenter::Builder::Builder(): + m_rotaryVisibility(true) + { + } + + VolumeControlPresenter::Builder & + VolumeControlPresenter::Builder::setSoundManager(ISoundManagerSRef sm) + { + m_sm = std::move(sm); + return *this; + } + + VolumeControlPresenter::Builder & + VolumeControlPresenter::Builder::setRotaryVisibility(bool rotaryVisibility) + { + m_rotaryVisibility = rotaryVisibility; + return *this; + } + + VolumeControlPresenter::Builder & + VolumeControlPresenter::Builder::setParentWidget(ElmWidgetSRef parentWidget) + { + m_parentWidget = std::move(parentWidget); + return *this; + } + + VolumeControlPresenterSRef VolumeControlPresenter::Builder::build( + ucl::GuiPresenter &parent) const + { + if (!m_sm || !m_parentWidget) { + LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set"); + } + + auto result = makeShared<VolumeControlPresenter>(m_sm, + m_rotaryVisibility); + FAIL_RETURN_VALUE(result->prepare(parent, *m_parentWidget), {}, + "result->prepare() failed!"); + + return result; + } + + // VolumeControlPresenter // + + VolumeControlPresenter::VolumeControlPresenter(IRefCountObj &rc, + ISoundManagerSRef sm, bool rotaryVisibility): + GuiPresenter(rc), + m_sm(std::move(sm)), + m_audioState(m_sm->getAudioState()), + m_rotaryVisibility(rotaryVisibility), + m_changedByRotary(false) + { + } + + VolumeControlPresenter::~VolumeControlPresenter() + { + unregisterCallbacks(); + } + + Result VolumeControlPresenter::prepare(GuiPresenter &parent, + ElmWidget &parentWidget) + { + FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR), + "Presenter::prepare() failed!"); + + FAIL_RETURN(createWidget(parentWidget), + "createWidget() failed!"); + FAIL_RETURN(setupDeactivatorSink(), + "setupDeactivatorSink() failed!"); + FAIL_RETURN(createAtspiHighlightHelper(), + "createAtspiHighlightHelper() failed!"); + + updateCurrentVolume(); + + registerCallbacks(); + + parent.addDeactivatorSource(*m_widget); + + return RES_OK; + } + + void VolumeControlPresenter::registerCallbacks() + { + addRotaryEventHandler( + CALLBACK_A(VolumeControlPresenter::onRotaryEvent), this); + + m_sm->addAudioStateHandler(WEAK_DELEGATE_THIS(onAudioStateChanged)); + m_sm->addVolumeStateHandler(WEAK_DELEGATE_THIS(onVolumeLevelChanged)); + + eext_object_event_callback_add(as_eo(*m_widget), EEXT_CALLBACK_BACK, + CALLBACK_A(VolumeControlPresenter::onBackKey), this); + } + + void VolumeControlPresenter::unregisterCallbacks() + { + eext_object_event_callback_del(as_eo(*m_widget), EEXT_CALLBACK_BACK, + CALLBACK_A(VolumeControlPresenter::onBackKey)); + + m_sm->delVolumeStateHandler(DELEGATE_THIS(onVolumeLevelChanged)); + m_sm->delAudioStateHandler(DELEGATE_THIS(onAudioStateChanged)); + + delRotaryEventHandler( + CALLBACK_A(VolumeControlPresenter::onRotaryEvent), this); + } + + Result VolumeControlPresenter::createWidget(ElmWidget &parent) + { + m_widget = VolumeControl::Builder(). + setInfoText(STR_VOLUME). + setMaxValue(m_sm->getMaxVolume()). + setEventHandler(WEAK_DELEGATE_THIS(onWidgetEventCb)). + build(parent); + if (!m_widget) { + LOG_RETURN(RES_FAIL, "VolumeControl::build() failed!"); + } + + auto window = m_widget->getWindow(); + if (!window) { + LOG_RETURN(RES_FAIL, "Window is NULL!"); + } + + int w = 0, h = 0; + window->getScreenSize(&w, &h); + + m_widget->move(0, 0); + m_widget->resize(w, h); + hide(*m_widget); + + m_widget->getDecreaseBtn().addEventHandler(ATSPI_HIGHLIGHTED, + WEAK_DELEGATE_THIS(onWidgetBtnAtspiHighlight)); + + m_widget->getIncreaseBtn().addEventHandler(ATSPI_HIGHLIGHTED, + WEAK_DELEGATE_THIS(onWidgetBtnAtspiHighlight)); + + return RES_OK; + } + + Result VolumeControlPresenter::createAtspiHighlightHelper() + { + m_atspiHelper = AtspiHighlightHelper::newInstance(*this); + if (!m_atspiHelper) { + LOG_RETURN(RES_FAIL, + "AtspiHighlightHelper::newInstance() failed!"); + } + m_atspiHelper->deactivateBy(this); + + m_atspiHelper->setEventHandler( + WEAK_DELEGATE_THIS(onAtspiHighlight)); + + m_atspiHelper->registerObject(getWindow()); + + m_atspiHelper->registerObject(*m_widget); + m_atspiHelper->registerObject(m_widget->getDecreaseBtn()); + m_atspiHelper->registerObject(m_widget->getIncreaseBtn()); + m_atspiHelper->registerObject(m_widget->getValueTxtAo()); + + return RES_OK; + } + + const Elm_Interface_Atspi_Accessible * + VolumeControlPresenter::onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + return AoSequencer(ao, flowRelation). + process(m_widget). + process(m_widget->getDecreaseBtn()). + process(m_widget->getValueTxtAo()). + process(m_widget->getIncreaseBtn()). + getNext(); + } + + ucl::Result VolumeControlPresenter::setupDeactivatorSink() + { + Evas_Object *const eo = elm_grid_add(as_eo(m_widget)); + if (!eo) { + LOG_RETURN(RES_FAIL, "evas_object_rectangle_add() failed!"); + } + + const auto sink = makeShared<Widget>(eo, false); + setDeactivatorSink(sink); + hide(*sink); + + return RES_OK; + } + + void VolumeControlPresenter::setVisible(bool isVisible) + { + isVisible ? showWidget() : hideWidget(); + } + + void VolumeControlPresenter::setRotaryVisibility(bool rotaryVisibility) + { + m_rotaryVisibility = rotaryVisibility; + } + + void VolumeControlPresenter::showWidget() + { + show(*m_widget); + m_widget->getAtspi().highlight(); + + scheduleAutoHide(); + + sendDeactivate(*m_widget); + + m_atspiHelper->activateBy(this); + } + + void VolumeControlPresenter::hideWidget() + { + hide(*m_widget); + + m_timeout.reset(); + + sendActivate(*m_widget); + + m_atspiHelper->deactivateBy(this); + } + + void VolumeControlPresenter::scheduleAutoHide() + { + m_timeout = Timeout::create( + (elm_atspi_bridge_utils_is_screen_reader_enabled() ? + impl::SCREEN_READER_TIMER_INTERVAL : + impl::DEFAULT_TIMER_INTERVAL), + WEAK_DELEGATE_THIS(onAutoHideTimeout)); + } + + void VolumeControlPresenter::onAutoHideTimeout(Timeout *sender) + { + hideWidget(); + } + + bool VolumeControlPresenter::checkVolumeChangePossibility(int volume, + bool needIncrease) + { + if (needIncrease) { + return (m_sm->getMaxVolume() >= volume); + } else { + return (volume - 1 >= impl::VOLUME_LEVEL_MIN); + } + return false; + } + + Result VolumeControlPresenter::tryIncreaseVolume() + { + auto cur = m_sm->getVolume(); + if (checkVolumeChangePossibility(cur, true)) { + FAIL_RETURN(m_sm->setVolume(cur + 1), "setVolume() failed!"); + } + return RES_OK; + } + + Result VolumeControlPresenter::tryDecreaseVolume() + { + auto cur = m_sm->getVolume(); + if (checkVolumeChangePossibility(cur, false)) { + FAIL_RETURN(m_sm->setVolume(cur - 1), "setVolume() failed!"); + } + return RES_OK; + } + + void VolumeControlPresenter::updateCurrentVolume() + { + auto cur = m_sm->getVolume(); + + m_widget->setValue(cur); + + if (cur == m_sm->getMaxVolume()) { + m_widget->setIncreaseBtnEnable(false); + m_widget->setDecreaseBtnEnable(true); + } else if (cur <= impl::VOLUME_LEVEL_MIN) { + m_widget->setIncreaseBtnEnable(true); + m_widget->setDecreaseBtnEnable(false); + } else { + m_widget->setIncreaseBtnEnable(true); + m_widget->setDecreaseBtnEnable(true); + } + + if (m_widget->isVisible()) { + if (m_changedByRotary) { + elm_atspi_bridge_utils_say(std::to_string(cur).c_str(), + EINA_TRUE, nullptr, nullptr); + } + m_changedByRotary = false; + } + } + + void VolumeControlPresenter::updateMaxVolume() + { + m_widget->setMaxValue(m_sm->getMaxVolume()); + } + + void VolumeControlPresenter::onWidgetEventCb(VolumeControl::Event event) + { + if (!isActive()) { + LOG_RETURN_VOID(RES_OK, "Ignored. Presenter is not active"); + } + + if (!m_widget->isVisible()) { + LOG_RETURN_VOID(RES_OK, "Ignored. Widget is hidden"); + } + + scheduleAutoHide(); + + switch (event) { + case VolumeControl::Event::INCREASE: + tryIncreaseVolume(); + break; + case VolumeControl::Event::DECREASE: + tryDecreaseVolume(); + break; + default: + break; + } + } + + void VolumeControlPresenter::onWidgetBtnAtspiHighlight(Widget &widget, + void *eventInfo) + { + scheduleAutoHide(); + } + + void VolumeControlPresenter::onVolumeLevelChanged() + { + updateCurrentVolume(); + } + + void VolumeControlPresenter::onAudioStateChanged() + { + auto state = m_sm->getAudioState(); + + if ((m_audioState != AudioStateType::BT && + state == AudioStateType::BT) || + (m_audioState == AudioStateType::BT && + state != AudioStateType::BT)) { + m_audioState = state; + + updateMaxVolume(); + updateCurrentVolume(); + } + } + + Eina_Bool VolumeControlPresenter::onRotaryEvent( + Eext_Rotary_Event_Info *info) + { + if (!isActive()) { + LOG_RETURN_VALUE(RES_OK, EINA_TRUE, + "Ignored. Presenter is not active"); + } + + if (!m_rotaryVisibility) { + LOG_RETURN_VALUE(RES_OK, EINA_TRUE, + "Ignored. Not visible by rotary event"); + } + + if (m_widget->isVisible()) { + scheduleAutoHide(); + } else { + showWidget(); + } + + m_changedByRotary = checkVolumeChangePossibility(m_sm->getVolume(), + info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE); + + auto res = (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE) ? + tryIncreaseVolume() : tryDecreaseVolume(); + if (res != RES_OK) { + m_changedByRotary = false; + } + + return EINA_TRUE; + } + + void VolumeControlPresenter::onBackKey(Evas_Object *obj, void *eventInfo) + { + if (isActive()) { + hideWidget(); + } + } + +} diff --git a/call-ui/presenters/misc/VolumeControlPresenter.h b/call-ui/presenters/misc/VolumeControlPresenter.h new file mode 100644 index 0000000..4889ce1 --- /dev/null +++ b/call-ui/presenters/misc/VolumeControlPresenter.h @@ -0,0 +1,163 @@ +/* + * 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_MISC_VOLUME_CONTROL_PRESENTER_H__ +#define __CALL_UI_PRESENTERS_MISC_VOLUME_CONTROL_PRESENTER_H__ + +#include "ucl/mvp/GuiPresenter.h" + +#include "ucl/misc/Timeout.h" + +#include "call-ui/model/ISoundManager.h" + +#include "call-ui/view/VolumeControl.h" + +#include "AtspiHighlightHelper.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(VolumeControlPresenter); + + /** + * @brief Presenter of volume control UI components + */ + class VolumeControlPresenter final : public ucl::GuiPresenter { + public: + + /** + * @brief Builder for VolumeControlPresenter + */ + class Builder { + public: + + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets ISoundManager instance + * @param[in] sm ISoundManager instance + * @return Reference to builder + */ + Builder &setSoundManager(ISoundManagerSRef sm); + + /** + * @brief Sets visibility of UI components by rotary events flag + * @param[in] rotaryVisibility Visibility of UI components flag + * (true - if UI components will be auto shown by rotary events, + * false - if not) + * @return Reference to builder + */ + Builder &setRotaryVisibility(bool rotaryVisibility); + + /** + * @brief Sets parent widget for UI components creation + * @param[in] parentWidget Parent widget + * @return Reference to builder + */ + Builder &setParentWidget(ucl::ElmWidgetSRef parentWidget); + + /** + * @brief Creates new instance of VolumeControlPresenter + * @param[in] parent Parent presenter + * @return Shared reference to VolumeControlPresenter instance + * on success or NULL otherwise + */ + VolumeControlPresenterSRef build(ucl::GuiPresenter &parent) const; + + private: + ISoundManagerSRef m_sm; + ucl::ElmWidgetSRef m_parentWidget; + bool m_rotaryVisibility; + }; + + public: + + /** + * @brief Sets visibility of UI components + * @param[in] isVisible Visibility flag + */ + void setVisible(bool isVisible); + + /** + * @brief Sets visibility of UI components by rotary events flag + * @param[in] rotaryVisibility Visibility of UI components flag + * (true - if UI components will be auto shown by rotary events, + * false - if not) + */ + void setRotaryVisibility(bool rotaryVisibility); + + private: + VolumeControlPresenter(ucl::IRefCountObj &rc, + ISoundManagerSRef sm, + bool rotaryVisibility); + ~VolumeControlPresenter(); + + ucl::Result prepare(ucl::GuiPresenter &parent, + ucl::ElmWidget &parentWidget); + + ucl::Result createWidget(ucl::ElmWidget &parent); + ucl::Result setupDeactivatorSink(); + + ucl::Result createAtspiHighlightHelper(); + const Elm_Interface_Atspi_Accessible *onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation); + + void registerCallbacks(); + void unregisterCallbacks(); + + void showWidget(); + void hideWidget(); + + void scheduleAutoHide(); + void onAutoHideTimeout(ucl::Timeout *sender); + + bool checkVolumeChangePossibility(int volume, bool needIncrease); + ucl::Result tryIncreaseVolume(); + ucl::Result tryDecreaseVolume(); + + void updateCurrentVolume(); + void updateMaxVolume(); + + void onVolumeLevelChanged(); + void onAudioStateChanged(); + Eina_Bool onRotaryEvent(Eext_Rotary_Event_Info *info); + + void onWidgetEventCb(VolumeControl::Event event); + void onWidgetBtnAtspiHighlight(ucl::Widget &widget, void *eventInfo); + + void onBackKey(Evas_Object *obj, void *eventInfo); + + private: + const ISoundManagerSRef m_sm; + + VolumeControlSRef m_widget; + AtspiHighlightHelperSRef m_atspiHelper; + ucl::TimeoutSRef m_timeout; + AudioStateType m_audioState; + + bool m_rotaryVisibility; + bool m_changedByRotary; + + friend class ucl::ReffedObj<VolumeControlPresenter>; + }; +} + +#endif // __CALL_UI_PRESENTERS_MISC_VOLUME_CONTROL_PRESENTER_H__ diff --git a/call-ui/presenters/misc/helpers.cpp b/call-ui/presenters/misc/helpers.cpp new file mode 100644 index 0000000..1ba8369 --- /dev/null +++ b/call-ui/presenters/misc/helpers.cpp @@ -0,0 +1,188 @@ +/* + * 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 <utils_i18n_ulocale.h> + +#include "ucl/gui/Window.h" + +#include "call-ui/presenters/common.h" + +namespace callui { namespace { namespace impl { + + constexpr EoDataKey INSTANCE_PTR {"callui,instance,data,ptr"}; + + constexpr EdjePart LIST_ITEM_TEXT_PART {"elm.text"}; + + constexpr ElmStyle LIST_ITEM_PADDING_STYLE {"padding"}; + constexpr ElmStyle LIST_ITEM_MENU_STYLE {"1text"};; + constexpr ElmStyle LIST_ITEM_TITLE_STYLE {"title"}; + + const TString STR_HH_MM_SS_TIME{"%02d:%02d:%02d"}; + const TString STR_MM_SS_TIME{"%02d:%02d"}; + + constexpr const char *BIDI_TXT_LRM = "\u200E"; + constexpr const char *BIDI_TXT_RLM = "\u200F"; + constexpr const char *BIDI_TXT_LRM_RLM = "\u200E\u200F"; + constexpr const char *BIDI_TXT_RLM_LRM = "\u200F\u200E"; + +}}} + +namespace callui { + + using namespace ucl; + + void setInstancePaused(Window &win, const bool value) + { + win.setData(impl::INSTANCE_PTR, reinterpret_cast<void *>(value)); + win.callEvent((value ? INSTANCE_PAUSED : INSTANCE_RESUMED), nullptr); + } + + bool isInstancePaused(const Window &win) + { + return (reinterpret_cast<intptr_t>( + win.getData(impl::INSTANCE_PTR)) != 0); + } + + void replaceSubstringInString(std::string &str, + const std::string &from, const std::string &to) + { + if (from.empty()) { + LOG_RETURN_VOID(RES_FAIL, "Parameter from is empty"); + } + + size_t start_pos = 0; + while((start_pos = str.find(from, start_pos)) != std::string::npos) { + str.replace(start_pos, from.length(), to); + start_pos += to.length(); + } + } + + TString getCallDurationTxt(const struct tm &time) + { + TString tmp; + if (time.tm_hour > 0) { + tmp = impl::STR_HH_MM_SS_TIME.format( + time.tm_hour, time.tm_min, time.tm_sec); + } else { + tmp = impl::STR_MM_SS_TIME.format( + time.tm_min, time.tm_sec); + } + return tmp; + } + + std::string encloseBidirectionalText(const std::string &txt, + BidiTextEncloseType type) + { + switch (type) { + case BidiTextEncloseType::LRM: + return impl::BIDI_TXT_LRM + txt + impl::BIDI_TXT_LRM; + case BidiTextEncloseType::RLM: + return impl::BIDI_TXT_RLM + txt + impl::BIDI_TXT_RLM; + case BidiTextEncloseType::LRM_RLM: + return impl::BIDI_TXT_LRM_RLM + txt + impl::BIDI_TXT_RLM_LRM; + case BidiTextEncloseType::RLM_LRM: + return impl::BIDI_TXT_RLM_LRM + txt + impl::BIDI_TXT_LRM_RLM; + default: + ELOG("Invalid type"); + return txt; + } + return txt; + } + + std::string encloseBidirectionalText(std::string &&txt, + BidiTextEncloseType type) + { + switch (type) { + case BidiTextEncloseType::LRM: + txt.insert(0, impl::BIDI_TXT_LRM); + txt.append(impl::BIDI_TXT_LRM); + break; + case BidiTextEncloseType::RLM: + txt.insert(0, impl::BIDI_TXT_RLM); + txt.append(impl::BIDI_TXT_RLM); + break; + case BidiTextEncloseType::LRM_RLM: + txt.insert(0, impl::BIDI_TXT_LRM_RLM); + txt.append(impl::BIDI_TXT_RLM_LRM); + break; + case BidiTextEncloseType::RLM_LRM: + txt.insert(0, impl::BIDI_TXT_RLM_LRM); + txt.append(impl::BIDI_TXT_LRM_RLM); + break; + default: + ELOG("Invalid type"); + break; + } + return std::move(txt); + } + + Result isLTRCharacterOrientation(const std::string &local) + { + if (local.empty()) { + LOG_RETURN(RES_INVALID_ARGUMENTS, "local is empty"); + } + + i18n_ulocale_layout_type_e layout = I18N_ULOCALE_LAYOUT_UNKNOWN; + int ret = i18n_ulocale_get_character_orientation(local.c_str(), + &layout); + if (ret != I18N_ERROR_NONE) { + LOG_RETURN(RES_FAIL, + "i18n_ulocale_get_character_orientation() failed!"); + } + + switch (layout) { + case I18N_ULOCALE_LAYOUT_LTR: + return RES_OK; + case I18N_ULOCALE_LAYOUT_RTL: + return RES_FALSE; + default: + LOG_RETURN(RES_FAIL, + "Unsupported character orientation type [%d]", + layout); + } + return RES_OK; + } + + SimpleListItemSRef makePaddingListItem() + { + return makeShared<SimpleListItem>(impl::LIST_ITEM_PADDING_STYLE); + } + + SimpleListItemSRef makeMenuListItem(TString text, + NotiHandler itemSelectHandler) + { + PartTextMap map; + map.set(impl::LIST_ITEM_TEXT_PART, std::move(text)); + + auto result = makeShared<SimpleListItem>(impl::LIST_ITEM_MENU_STYLE, + std::move(map)); + + result->setItemSelectHandler(std::move(itemSelectHandler)); + + return result; + } + + SimpleListItemSRef makeTitleListItem(TString text) + { + PartTextMap map; + map.set(impl::LIST_ITEM_TEXT_PART, std::move(text)); + + return makeShared<SimpleListItem>(impl::LIST_ITEM_TITLE_STYLE, + std::move(map)); + } + +} + diff --git a/call-ui/presenters/misc/helpers.h b/call-ui/presenters/misc/helpers.h new file mode 100644 index 0000000..5f1c5df --- /dev/null +++ b/call-ui/presenters/misc/helpers.h @@ -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. + */ + +#ifndef __CALL_UI_PRESENTERS_MISC_HELPERS_H__ +#define __CALL_UI_PRESENTERS_MISC_HELPERS_H__ + +#include <string> +#include <time.h> + +#include "ucl/gui/EdjeWidget.h" +#include "ucl/gui/types.h" + +#include "call-ui/presenters/items/SimpleListItem.h" + +namespace callui { + + /** + * @brief Enumeration for text enclose types of bidirectional text + */ + enum class BidiTextEncloseType { + LRM, /**< Encloses text with LRM symbols */ + RLM, /**< Encloses text with RLM symbols */ + LRM_RLM, /**< Encloses text with LRM and RLM symbols */ + RLM_LRM /**< Encloses text with RLM and LRM symbols */ + }; + + /** + * @brief Application Instance pause smart event definition + */ + constexpr ucl::SmartEvent INSTANCE_PAUSED {"callui,instance,paused"}; + + /** + * @brief Application Instance resume smart event definition + */ + constexpr ucl::SmartEvent INSTANCE_RESUMED {"callui,instance,resumed"}; + + /** + * @brief Sets whether application Instance is in pause or not + * @param[in] win Window instance + * @param[in] value Application instance pause state + */ + void setInstancePaused(ucl::Window &win, bool value); + + /** + * @brief Checks whether application Instance is in pause or not + * @param[in] win Window instance + * @return Application instance pause state: + * true - application Instance is paused, false - otherwise + */ + bool isInstancePaused(const ucl::Window &win); + + /** + * @brief Gets call duration as a text + * @param[in] time Time structure + * @return Call duration string + */ + ucl::TString getCallDurationTxt(const struct tm &time); + + /** + * @brief Replaces selected substring in string text + * @param[in] str String text to modify + * @param[in] from Text to replaces + * @param[in] to Text to replace on + */ + void replaceSubstringInString(std::string &str, + const std::string &from, const std::string &to); + + /** + * @brief Checks whether locale is LRT character orientation + * @param[in] locale Locale to check + * @return RES_OK - if local is LRT oriented, + * RES_FALSE - if not, + * other result on error + */ + ucl::Result isLTRCharacterOrientation(const std::string &locale); + + /** + * @brief Encloses text with selected bidirectional symbols + * @param[in] txt Text to modify + * @param[in] type Type of bidirectional symbols to enclose with + * @return Enclosed string + */ + std::string encloseBidirectionalText(const std::string &txt, BidiTextEncloseType type); + + /** + * @brief Encloses text with selected bidirectional symbols + * @param[in] txt Text to modify + * @param[in] type Type of bidirectional symbols to enclose with + * @return Enclosed string + */ + std::string encloseBidirectionalText(std::string &&txt, BidiTextEncloseType type); + + /** + * @brief Creates Padding list item + * @return Shared reference to Padding list item on success, NULL otherwise + */ + SimpleListItemSRef makePaddingListItem(); + + /** + * @brief Creates Menu list item + * @param[in] text Menu item text + * @param[in] itemSelectHandler Select handler + * @return Shared reference to Menu list item on success, NULL otherwise + */ + SimpleListItemSRef makeMenuListItem(ucl::TString text, + NotiHandler itemSelectHandler); + + /** + * @brief Creates Title list item + * @param[in] text Title item text + * @return Shared reference to Title list item on success, NULL otherwise + */ + SimpleListItemSRef makeTitleListItem(ucl::TString text); +} + +#endif // __CALL_UI_PRESENTERS_MISC_HELPERS_H__ diff --git a/call-ui/presenters/pages/KeypadPage.cpp b/call-ui/presenters/pages/KeypadPage.cpp new file mode 100644 index 0000000..ecfe176 --- /dev/null +++ b/call-ui/presenters/pages/KeypadPage.cpp @@ -0,0 +1,403 @@ +/* + * 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 "KeypadPage.h" + +#include "call-ui/view/AoSequencer.h" + +#include "call-ui/resources.h" + +#include "call-ui/presenters/types.h" + +#include "call-ui/presenters/common.h" + +namespace callui { namespace { namespace impl { + + using namespace ucl; + + constexpr LayoutTheme LAYOUT_KEYPAD_WIDGET + {"layout", "callui", "keypad"}; + + constexpr EdjePart PART_SWL_ENTRY {"swl.entry"}; + + constexpr SmartEvent BTN_PRESSED {"pressed"}; + constexpr SmartEvent BTN_UNPRESSED {"unpressed"}; + + constexpr EoDataKey BTN_DATA_KEY {"btnData"}; + + enum class OperationType { + DTMF, + VOLUME + }; + + struct ButtonInfo { + OperationType type; + const char *str; + ElmStyle style; + EdjePart swlPart; + }; + + static ButtonInfo buttonsInfo[] = + { + { OperationType::DTMF, "1", + ElmStyle {"callui/keypad_one"}, EdjePart {"swl.one"} }, + { OperationType::DTMF, "2", + ElmStyle {"callui/keypad_two"}, EdjePart {"swl.two"} }, + { OperationType::DTMF, "3", + ElmStyle {"callui/keypad_three"}, EdjePart {"swl.three"} }, + { OperationType::DTMF, "4", + ElmStyle {"callui/keypad_four"}, EdjePart {"swl.four"} }, + { OperationType::DTMF, "5", + ElmStyle {"callui/keypad_five"}, EdjePart {"swl.five"} }, + { OperationType::DTMF, "6", + ElmStyle {"callui/keypad_six"}, EdjePart {"swl.six"} }, + { OperationType::DTMF, "7", + ElmStyle {"callui/keypad_seven"}, EdjePart {"swl.seven"} }, + { OperationType::DTMF, "8", + ElmStyle {"callui/keypad_eight"}, EdjePart {"swl.eight"} }, + { OperationType::DTMF, "9", + ElmStyle {"callui/keypad_nine"}, EdjePart {"swl.nine"} }, + { OperationType::DTMF, "0", + ElmStyle {"callui/keypad_zero"}, EdjePart {"swl.zero"} }, + { OperationType::DTMF, "#", + ElmStyle {"callui/keypad_sharp"}, EdjePart {"swl.sharp"} }, + { OperationType::DTMF, "*", + ElmStyle {"callui/keypad_asterix"}, EdjePart {"swl.asterix"} }, + { OperationType::VOLUME, "", + ElmStyle {"callui/keypad_speaker"}, EdjePart {"swl.speaker"} } + }; + + const int KEYPAD_BTN_MAX_COUNT = sizeof(buttonsInfo)/sizeof(buttonsInfo[0]); + +}}} + +namespace callui { + + using namespace ucl; + + // KeypadPage::Builder + + KeypadPage::Builder::Builder() + { + } + + KeypadPage::Builder &KeypadPage::Builder::setNaviframe(NaviframeSRef navi) + { + m_navi = std::move(navi); + return *this; + } + + KeypadPage::Builder + &KeypadPage::Builder::setSoundManager(ISoundManagerSRef sm) + { + m_sm = std::move(sm); + return *this; + } + + KeypadPageSRef KeypadPage::Builder::build( + ExitRequestHandler onExitRequest) const + { + if (!onExitRequest) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, + "onExitRequest is NULL"); + } + if (!m_navi) { + LOG_RETURN_VALUE(RES_FAIL, {}, "m_navi is NULL"); + } + + if (!m_sm) { + LOG_RETURN_VALUE(RES_FAIL, {}, "m_sm is NULL"); + } + + auto result = makeShared<KeypadPage>(m_navi, + std::move(onExitRequest), m_sm); + + FAIL_RETURN_VALUE(result->prepare([&result](NaviItem &item) + { + return result->doPrepare(item); + }), + {}, "result->prepare() failed!"); + + return result; + } + + // KeypadPage // + + KeypadPage::KeypadPage(IRefCountObj &rc, + NaviframeSRef navi, + ExitRequestHandler onExitRequest, + ISoundManagerSRef sm): + Page(rc, std::move(navi), std::move(onExitRequest)), + m_sm(std::move(sm)), + m_smInUse(false) + { + } + + KeypadPage::~KeypadPage() + { + stopDtmf(); + + unregisterPowerKeyHandling(); + } + + Result KeypadPage::doPrepare(NaviItem &item) + { + FAIL_RETURN(createWidget(), + "createWidget() failed!"); + FAIL_RETURN(createEntry(), + "createEntry() failed!"); + FAIL_RETURN(createButtons(), + "createButtons() failed!"); + FAIL_RETURN(createVolumeControlPresenter(), + "createVolumeControlPresenter() failed!"); + FAIL_RETURN(registerPowerKeyHandling(), + "registerPowerKeyHandling() failed!"); + FAIL_RETURN(createAtspiHighlightHelper(), + "createAtspiHighlightHelper() failed!"); + + item = getNaviframe().push(*m_widget); + if (!item) { + LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); + } + + return RES_OK; + } + + Result KeypadPage::registerPowerKeyHandling() + { + auto win = m_widget->getWindow(); + if (!win) { + LOG_RETURN(RES_FAIL, "win is NULL!"); + } + + win->addEventHandler(WIN_POWER_KEY_UP_EVENT, + WEAK_DELEGATE_THIS(onPowerKeyUp)); + + return RES_OK; + } + + void KeypadPage::unregisterPowerKeyHandling() + { + auto win = m_widget->getWindow(); + if (!win) { + LOG_RETURN_VOID(RES_FAIL, "win is NULL!"); + } + + win->delEventHandler(WIN_POWER_KEY_UP_EVENT, + DELEGATE_THIS(onPowerKeyUp)); + } + + void KeypadPage::onPowerKeyUp(Widget &widget, void *eventInfo) + { + auto info = static_cast<PowerBtnEventInfo *>(eventInfo); + if (info) { + info->stopPropagation = true; + } + + m_voiceControl->setVisible(false); + + requestExit(); + } + + void KeypadPage::onBtnPressed(Widget &widget, void *eventInfo) + { + impl::ButtonInfo *info = + static_cast<impl::ButtonInfo*>(widget.getData(impl::BTN_DATA_KEY)); + DLOG("Button pressed [%c]", *(info->str)); + + if (info->type == impl::OperationType::DTMF) { + elm_entry_entry_append(as_eo(*m_entry), info->str); + elm_entry_cursor_end_set(as_eo(*m_entry)); + startDtmf(*(info->str)); + } + } + + void KeypadPage::onBtnUnpressed(Widget &widget, void *eventInfo) + { + impl::ButtonInfo *info = + static_cast<impl::ButtonInfo*>(widget.getData(impl::BTN_DATA_KEY)); + DLOG("Button unpressed [%c]", *(info->str)); + stopDtmf(); + } + + void KeypadPage::onBtnClicked(Widget &widget, void *eventInfo) + { + impl::ButtonInfo *info = + static_cast<impl::ButtonInfo*>(widget.getData(impl::BTN_DATA_KEY)); + + if(info->type == impl::OperationType::VOLUME) { + DLOG("Button clicked [volume]"); + m_voiceControl->setVisible(true); + } + } + + Result KeypadPage::createWidget() + { + m_widget = Layout::Builder(). + setTheme(impl::LAYOUT_KEYPAD_WIDGET). + build(getNaviframe()); + if (!m_widget) { + LOG_RETURN(RES_FAIL, "Layout::build() failed!"); + } + + // RTL support + elm_object_mirrored_automatic_set(as_eo(*m_widget), EINA_FALSE); + elm_object_mirrored_set(as_eo(*m_widget), false); + + setDeactivatorSink(m_widget); + + return RES_OK; + } + + ucl::Result KeypadPage::createEntry() + { + Evas_Object *const entry = elm_entry_add(as_eo(*m_widget)); + if (!entry) { + LOG_RETURN(RES_FAIL, "elm_entry_add() failed!"); + } + m_entry = makeShared<ElmWidget>(entry); + + static Elm_Entry_Filter_Accept_Set digitsFilterData; + + digitsFilterData.accepted = "0123456789*#"; + digitsFilterData.rejected = nullptr; + + elm_entry_single_line_set(entry, EINA_TRUE); + elm_entry_editable_set(entry, EINA_FALSE); + elm_entry_scrollable_set(entry, EINA_TRUE); + elm_entry_markup_filter_append(entry, + elm_entry_filter_accept_set, &digitsFilterData); + + m_widget->setContent(*m_entry, impl::PART_SWL_ENTRY); + show(*m_entry); + + return RES_OK; + } + + ucl::Result KeypadPage::createButtons() + { + Evas_Object *eo; + StyledWidgetSRef btn; + + for (int i = 0; i < impl::KEYPAD_BTN_MAX_COUNT; ++i) { + eo = elm_button_add(as_eo(*m_widget)); + if (!eo) { + LOG_RETURN(RES_FAIL, "elm_button_add() failed!"); + } + + btn = makeShared<StyledWidget>(eo, false); + btn->setData(impl::BTN_DATA_KEY, &(impl::buttonsInfo[i])); + btn->setStyle(impl::buttonsInfo[i].style); + m_widget->setContent(*btn, impl::buttonsInfo[i].swlPart); + show(*btn); + + if (impl::buttonsInfo[i].type == impl::OperationType::DTMF) { + btn->addEventHandler(impl::BTN_PRESSED, + WEAK_DELEGATE_THIS(onBtnPressed)); + + btn->addEventHandler(impl::BTN_UNPRESSED, + WEAK_DELEGATE_THIS(onBtnUnpressed)); + } else { + btn->addEventHandler(BTN_CLICKED, + WEAK_DELEGATE_THIS(onBtnClicked)); + + // RTL support + elm_object_mirrored_automatic_set(eo, EINA_FALSE); + elm_object_mirrored_set(eo, false); + } + + auto &atspi = btn->getAtspi(); + atspi.setTDomain(TEXT_DOMAIN); + if (impl::buttonsInfo[i].type == impl::OperationType::DTMF) { + atspi.setName(impl::buttonsInfo[i].str); + } else { + atspi.setName(STR_VOLUME); + } + + if (i == 0) { + m_firstBtn = btn; + } else if (i == impl::KEYPAD_BTN_MAX_COUNT - 1) { + m_lastBtn = btn; + } + } + + return RES_OK; + } + + void KeypadPage::startDtmf(const unsigned char digit) + { + stopDtmf(); + m_smInUse = true; + m_sm->startDtmf(digit); + } + + void KeypadPage::stopDtmf() + { + if (m_smInUse) { + m_smInUse = false; + m_sm->stopDtmf(); + } + } + + Result KeypadPage::createVolumeControlPresenter() + { + m_voiceControl = VolumeControlPresenter::Builder(). + setSoundManager(m_sm). + setRotaryVisibility(false). + setParentWidget(m_widget). + build(*this); + if (!m_voiceControl) { + LOG_RETURN(RES_FAIL, "VolumeControlPresenter::build() failed!"); + } + + return RES_OK; + } + + void KeypadPage::onBackKey() + { + requestExit(); + } + + Result KeypadPage::createAtspiHighlightHelper() + { + m_atspiHelper = AtspiHighlightHelper::newInstance(*this); + if (!m_atspiHelper) { + LOG_RETURN(RES_FAIL, + "AtspiHighlightHelper::newInstance() failed!"); + } + + m_atspiHelper->setEventHandler( + WEAK_DELEGATE_THIS(onAtspiHighlight)); + + m_atspiHelper->registerObject(getWindow()); + + m_atspiHelper->registerObject(*m_firstBtn); + m_atspiHelper->registerObject(*m_lastBtn); + + return RES_OK; + } + + const Elm_Interface_Atspi_Accessible *KeypadPage::onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + return AoSequencer(ao, flowRelation). + process(m_firstBtn). + processDefault(). + process(m_lastBtn). + getNext(); + } +} diff --git a/call-ui/presenters/pages/KeypadPage.h b/call-ui/presenters/pages/KeypadPage.h new file mode 100644 index 0000000..2625b4c --- /dev/null +++ b/call-ui/presenters/pages/KeypadPage.h @@ -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. + */ + +#ifndef __CALL_UI_PRESENTERS_PAGES_KEYPAD_PAGE_H__ +#define __CALL_UI_PRESENTERS_PAGES_KEYPAD_PAGE_H__ + +#include "base/Page.h" + +#include "ucl/gui/Layout.h" + +#include "call-ui/model/ISoundManager.h" + +#include "call-ui/presenters/misc/AtspiHighlightHelper.h" +#include "call-ui/presenters/misc/VolumeControlPresenter.h" + +#include "call-ui/presenters/types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(KeypadPage); + + /** + * @brief Presenter of Keypad page + */ + class KeypadPage final : public Page { + public: + + /** + * @brief KeypadPage builder + */ + class Builder { + public: + + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets Naviframe instance + * @param[in] navi Naviframe instance + * @return Reference to builder + */ + Builder &setNaviframe(ucl::NaviframeSRef navi); + + /** + * @brief Sets Sound Manager instance + * @param[in] navi Sound Manager instance + * @return Reference to builder + */ + Builder &setSoundManager(ISoundManagerSRef sm); + + /** + * @brief Creates new instance of KeypadPage + * @param[in] onExitRequest Page exit request event handler + * @return Shared reference to KeypadPage instance + * on success or NULL otherwise + */ + KeypadPageSRef build(ExitRequestHandler onExitRequest) const; + private: + ISoundManagerSRef m_sm; + ucl::NaviframeSRef m_navi; + }; + + private: + KeypadPage(ucl::IRefCountObj &rc, + ucl::NaviframeSRef navi, + ExitRequestHandler onExitRequest, + ISoundManagerSRef sm); + ~KeypadPage(); + + ucl::Result doPrepare(ucl::NaviItem &item); + + ucl::Result registerPowerKeyHandling(); + void unregisterPowerKeyHandling(); + + void onPowerKeyUp(ucl::Widget &widget, void *eventInfo); + + void onBtnPressed(ucl::Widget &widget, void *eventInfo); + void onBtnUnpressed(ucl::Widget &widget, void *eventInfo); + void onBtnClicked(ucl::Widget &widget, void *eventInfo); + + ucl::Result createWidget(); + ucl::Result createEntry(); + ucl::Result createButtons(); + ucl::Result createVolumeControlPresenter(); + + void startDtmf(const unsigned char digit); + void stopDtmf(); + + ucl::Result createAtspiHighlightHelper(); + const Elm_Interface_Atspi_Accessible *onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation); + + // Page // + + virtual void onBackKey() override final; + + private: + const ISoundManagerSRef m_sm; + + ucl::LayoutSRef m_widget; + ucl::ElmWidgetSRef m_entry; + ucl::ElmWidgetSRef m_firstBtn; + ucl::ElmWidgetSRef m_lastBtn; + VolumeControlPresenterSRef m_voiceControl; + AtspiHighlightHelperSRef m_atspiHelper; + + bool m_smInUse; + + friend class ucl::ReffedObj<KeypadPage>; + }; +} + +#endif // __CALL_UI_PRESENTERS_PAGES_KEYPAD_PAGE_H__ diff --git a/call-ui/presenters/pages/MainPage.cpp b/call-ui/presenters/pages/MainPage.cpp new file mode 100644 index 0000000..5ad70a6 --- /dev/null +++ b/call-ui/presenters/pages/MainPage.cpp @@ -0,0 +1,852 @@ +/* + * 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 "MainPage.h" + +#include "ucl/gui/Window.h" +#include "ucl/gui/Widget.h" + +#include "call-ui/view/AoSequencer.h" + +#include "call-ui/resources.h" + +#include "call-ui/presenters/types.h" + +#include "call-ui/presenters/common.h" + +namespace callui { namespace { namespace impl { + + using namespace ucl; + + constexpr auto RECALL_BTN_SHOW_TIMEOUT = 1.0; + constexpr auto EXIT_APP_TIMEOUT = 4.0; + + constexpr LayoutTheme LAYOUT_MAIN_WIDGET + {"layout", "callui", "main"}; + + constexpr LayoutTheme LAYOUT_REJECT_MSG_WIDGET + {"layout", "callui", "reject_msg"}; + + constexpr EdjePart PART_SWL_INDICATOR {"swl.indicator"}; + constexpr EdjePart PART_SWL_ACCEPT_REJECT {"swl.accept_reject"}; + constexpr EdjePart PART_SWL_CALL_INFO {"swl.call_info"}; + constexpr EdjePart PART_SWL_REJECT_MSG {"swl.rm"}; + constexpr EdjePart PART_SWL_BOTTOM_BTN {"swl.bottom_btn"}; + constexpr EdjePart PART_SWL_OVERLAY {"swl.overlay"}; + constexpr EdjePart PART_SWL_MORE_OPTION {"swl.more_option"}; + constexpr EdjePart PART_TXT_REJECT_MSG {"reject_msg_text"}; + constexpr EdjePart PART_TXT_REJECT_MSG_CUE_AO {"ao_cue"}; + + constexpr ElmStyle STYLE_BB_END_CALL {"callui/end_call"}; + constexpr ElmStyle STYLE_BB_RECALL {"callui/call_back"}; +}}} + +namespace callui { + + using namespace ucl; + + // MainPage::Builder // + + MainPage::Builder::Builder() + { + } + + MainPage::Builder &MainPage::Builder::setNaviframe( + NaviframeSRef navi) + { + m_navi = std::move(navi); + return *this; + } + + MainPage::Builder &MainPage::Builder::setCallUI( + ICallUISRef call) + { + m_call = std::move(call); + return *this; + } + + MainPageSRef MainPage::Builder::build( + ExitRequestHandler onExitRequest) const + { + if (!onExitRequest) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, + "onExitRequest is NULL"); + } + if (!m_navi) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, + "m_navi is NULL"); + } + if (!m_call) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, + "m_call is NULL"); + } + + auto result = makeShared<MainPage>( + m_navi, std::move(onExitRequest), m_call); + + FAIL_RETURN_VALUE(result->prepare([&result](NaviItem &item) + { + return result->doPrepare(item); + }), + {}, "result->prepare() failed!"); + + return result; + } + + // MainPage // + + MainPage::MainPage(IRefCountObj &rc, + NaviframeSRef navi, + ExitRequestHandler onExitRequest, + ICallUISRef call) : + Page(rc, std::move(navi), std::move(onExitRequest)), + m_call(std::move(call)), + m_cm(m_call->getCallManager()), + m_mode(CallMode::UNDEFINED), + m_ecTimer(nullptr), + m_ecTimerBtnReq(false) + { + } + + Result MainPage::doPrepare(NaviItem &item) + { + if (!m_cm) { + LOG_RETURN(RES_FAIL, "Call manager is NULL!"); + } + + FAIL_RETURN(createWidget(), "createWidget() failed!"); + + FAIL_RETURN(createIndicatorPresenter(), + "createIndicatorPresenter() failed!"); + + FAIL_RETURN(createDisplayPresenter(), + "createDisplayPresenter() failed!"); + + FAIL_RETURN(registerPowerKeyHandling(), + "registerPowerKeyHandling() failed!"); + + item = getNaviframe().push(*m_widget); + if (!item) { + LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); + } + + return RES_OK; + } + + Result MainPage::registerPowerKeyHandling() + { + auto win = m_widget->getWindow(); + if (!win) { + LOG_RETURN(RES_FAIL, "win is NULL!"); + } + + win->addEventHandler(WIN_POWER_KEY_UP_EVENT, + WEAK_DELEGATE_THIS(onPowerKeyUp)); + + return RES_OK; + } + + void MainPage::unregisterPowerKeyHandling() + { + auto win = m_widget->getWindow(); + if (!win) { + LOG_RETURN_VOID(RES_FAIL, "win is NULL!"); + } + + win->delEventHandler(WIN_POWER_KEY_UP_EVENT, + DELEGATE_THIS(onPowerKeyUp)); + } + + void MainPage::processKeyPress(bool isPowerKey) + { + if (m_mode == CallMode::END) { + requestExit(); + } else if (m_mode != CallMode::INCOMING) { + if (isPowerKey) { + m_devicePrs->setDisplayState( + DeviceStatePresenter::DisplayState::OFF); + } else { + if (m_accessoryPrs) { + m_accessoryPrs->hideVolumeControls(); + } + } + } + } + + void MainPage::onBackKey() + { + processKeyPress(); + } + + void MainPage::onPowerKeyUp(Widget &widget, void *eventInfo) + { + auto info = static_cast<PowerBtnEventInfo *>(eventInfo); + if (info && info->stopPropagation) { + DLOG("Ignored. Propagation was stopped."); + return; + } + processKeyPress(true); + } + + Result MainPage::processIncomingCallMode() + { + m_accessoryPrs.reset(); + + auto call = m_cm->getIncomingCall(); + if (!call) { + LOG_RETURN(RES_FAIL, "incom is NULL"); + } + + FAIL_RETURN(createAcceptRejectPresenter(), + "createAcceptRejectPresenter() failed!"); + + auto provider = call->getRejectMsgProvider(); + if (!provider) { + ELOG("Reject message provider is NULL"); + } + + if (!isUnknownCaller(*call->getInfo()) + && (provider && provider->getMsgCount() > 0)) { + FAIL_RETURN(createRejectMsgPresenter(provider), + "createRejectMsgPresenter() failed!"); + + FAIL_RETURN(createRejectMsgCue(), + "craeteRejectMsgCue() failed!"); + + if (createRejectMsgCueAo() != RES_OK) { + ELOG("createRejectMsgCueAo() failed!"); + } + } + + return RES_OK; + } + + Result MainPage::createRejectMsgCue() + { + m_rmLy = Layout::Builder(). + setTheme(impl::LAYOUT_REJECT_MSG_WIDGET). + build(*m_widget); + if (!m_rmLy) { + LOG_RETURN(RES_FAIL, "Layout::build() failed!"); + } + + m_rmLy->setText(STR_DECLINE_MESSAGES, impl::PART_TXT_REJECT_MSG); + m_widget->setContent(*m_rmLy, impl::PART_SWL_REJECT_MSG); + + return RES_OK; + } + + Result MainPage::processEndCallMode() + { + FAIL_RETURN(createAccessoryPresenter(), + "createAccessoryPresenter() failed!"); + + auto end = m_cm->getEndCall(); + if (end) { + auto info = end->getInfo(); + if (info && + info->getConferenceMemberCount() == 1 && + !(info->getPhoneNumber().empty() && + !info->isEmergency())) { + FAIL_RETURN(createBottomBtn(impl::STYLE_BB_RECALL, false), + "createBottomBtn() failed!"); + hide(*m_bottomBtn); + } + } else { + ELOG("End call is NULL!"); + } + + startEndCallTimer(); + + return RES_OK; + } + + Result MainPage::processRegularCallModes() + { + m_rmPrs.reset(); + m_acceptRejectPrs.reset(); + m_rmLy.reset(); + m_rmCueAo.reset(); + + FAIL_RETURN(createAccessoryPresenter(), + "createAccessoryPresenter() failed!"); + FAIL_RETURN(createMoreOptionsPresenter(), + "createMoreOptionsPresenter() failed!"); + FAIL_RETURN(createBottomBtn(impl::STYLE_BB_END_CALL), + "createBottomBtn() failed!"); + + return RES_OK; + } + + Result MainPage::showWindow() + { + auto win = getNaviframe().getWindow(); + if (!win) { + LOG_RETURN(RES_FAIL, "win is NULL"); + } + + if (!win->isVisible() && + (m_mode == CallMode::INCOMING || + m_mode == CallMode::OUTGOING)) { + show(*win); + } + return RES_OK; + } + + void MainPage::onBottomBtnClicked(Widget &widget, void *eventInfo) + { + auto active = m_cm->getActiveCall(); + auto held = m_cm->getHeldCall(); + auto end = m_cm->getEndCall(); + + if (active) { + active->end(); + } else if (held) { + held->end(); + } else if (end) { + stopEndCallTimer(); + end->callBack(); + } + } + + void MainPage::startEndCallTimer() + { + stopEndCallTimer(); + + m_ecTimer = ecore_timer_add( + impl::RECALL_BTN_SHOW_TIMEOUT, + CALLBACK_B(MainPage::onEndCallTimerCb), + this); + } + + void MainPage::stopEndCallTimer() + { + m_ecTimerBtnReq = false; + + if (m_ecTimer) { + ecore_timer_del(m_ecTimer); + m_ecTimer = nullptr; + } + } + + Result MainPage::createBottomBtn(const ElmStyle &style, bool setVisible) + { + Evas_Object *const eo = elm_button_add(as_eo(*m_widget)); + if (!eo) { + LOG_RETURN(RES_FAIL, "elm_button_add() failed!"); + } + m_bottomBtn = makeShared<StyledWidget>(eo); + m_bottomBtn->setStyle(style); + m_bottomBtn->addEventHandler(BTN_CLICKED, + WEAK_DELEGATE_THIS(MainPage::onBottomBtnClicked)); + + auto &atspi = m_bottomBtn->getAtspi(); + atspi.setTDomain(TEXT_DOMAIN); + if (style == impl::STYLE_BB_RECALL) { + atspi.setName(AO_STR_CALLBACK); + } else { + atspi.setName(AO_STR_END_CALL); + } + + if (setVisible) { + m_widget->setContent(*m_bottomBtn, impl::PART_SWL_BOTTOM_BTN); + show(*m_bottomBtn); + } else { + hide(*m_bottomBtn); + } + + return RES_OK; + } + + Eina_Bool MainPage::onEndCallTimerCb() + { + if (!m_ecTimerBtnReq) { + if (m_bottomBtn) { + m_widget->setContent(*m_bottomBtn, impl::PART_SWL_BOTTOM_BTN); + show(*m_bottomBtn); + } + ecore_timer_interval_set(m_ecTimer, impl::EXIT_APP_TIMEOUT); + m_ecTimerBtnReq = true; + return ECORE_CALLBACK_RENEW; + } else { + m_ecTimer = nullptr; + requestExit(); + return ECORE_CALLBACK_CANCEL; + } + } + + void MainPage::onCallEvent(CallEventType type) + { + ILOG("CallEventType [%d]", static_cast<int>(type)); + + stopEndCallTimer(); + + CallMode prevMode = m_mode; + m_mode = getCallMode(m_cm); + + if (m_mode == CallMode::UNDEFINED) { + requestExit(); + return; + } + + FAIL_RETURN_VOID(showWindow(), "showWindow failed!"); + + m_acceptRejectPrs.reset(); + m_rmPrs.reset(); + m_moreOptionsPrs.reset(); + m_callInfoPrs.reset(); + + m_rmLy.reset(); + m_rmCueAo.reset(); + m_bottomBtn.reset(); + + switch (m_mode) { + case CallMode::INCOMING: + FAIL_RETURN_VOID(processIncomingCallMode(), + "processIncomingCall() failed!"); + break; + case CallMode::END: + FAIL_RETURN_VOID(processEndCallMode(), + "processEndCallMode() failed!"); + break; + default: + FAIL_RETURN_VOID(processRegularCallModes(), + "processRegularCallModes() failed!"); + break; + } + + FAIL_RETURN_VOID(createCallInfoPresenter(), + "createCallInfoPresenter() failed!"); + + FAIL_RETURN_VOID(updateDeviceState(prevMode, m_mode), + "updateDeviceState() failed!"); + + createAtspiHighlightHelper(); + } + + Result MainPage::updateDeviceState(CallMode prevMode, CallMode curMode) + { + if (curMode == CallMode::INCOMING && curMode != prevMode) { + m_devicePrs->setDisplayState( + DeviceStatePresenter::DisplayState::ON); + m_devicePrs->setDisplayMode( + DeviceStatePresenter::DisplayMode::TOP_PRIORITY); + m_devicePrs->setCpuLockState(true); + } else if (prevMode == CallMode::INCOMING && prevMode != curMode) { + m_devicePrs->setDisplayMode( + DeviceStatePresenter::DisplayMode::REGULAR); + m_devicePrs->setCpuLockState(false); + } + + if (curMode == CallMode::END) { + m_devicePrs->setDisplayState( + DeviceStatePresenter::DisplayState::ON); + } + + return RES_OK; + } + + Result MainPage::createWidget() + { + m_widget = Layout::Builder(). + setTheme(impl::LAYOUT_MAIN_WIDGET). + build(getNaviframe()); + + if (!m_widget) { + LOG_RETURN(RES_FAIL, "Layout::build() failed!"); + } + + setDeactivatorSink(m_widget); + + return RES_OK; + } + + Result MainPage::createIndicatorPresenter() + { + m_indicator = IndicatorPresenter::Builder(). + setIndicatorStateProvider( + m_call->getIndicatorStateProvider()). + setParentWidget(m_widget). + build(*this); + + if (!m_indicator) { + LOG_RETURN(RES_FAIL, "Indicator::build() failed!"); + } + + m_widget->setContent(m_indicator->getWidget(), + impl::PART_SWL_INDICATOR); + + return RES_OK; + } + + Result MainPage::createDisplayPresenter() + { + auto win = m_widget->getWindow(); + if (!win) { + LOG_RETURN(RES_FAIL, "win is NULL!"); + } + + m_devicePrs = DeviceStatePresenter::Builder(). + setDisplayState(DeviceStatePresenter::DisplayState::ON). + build(asShared(win)); + + if (!m_devicePrs) { + LOG_RETURN(RES_FAIL, "DisplayPresenter::build() failed!"); + } + + return RES_OK; + } + + void MainPage::onExitAppRequest() + { + requestExit(); + } + + Result MainPage::createAccessoryPresenter() + { + if (m_accessoryPrs) { + ILOG("Already exists. No need to create new one. Just update."); + m_accessoryPrs->update(m_cm); + return RES_OK; + } + + m_accessoryPrs = AccessoryPresenter::Builder(). + setSoundManager(m_call->getSoundManager()). + setCallManager(m_cm). + setRequestExitHandler(WEAK_DELEGATE_THIS(onExitAppRequest)). + setAoRequestHandler( + WEAK_DELEGATE_THIS(onAccessoryAoRequest)). + setParentWidget(m_widget). + build(*this); + + if (!m_accessoryPrs) { + LOG_RETURN(RES_FAIL, + "AccessoryPresenter::build() failed!"); + } + + m_widget->setContent(m_accessoryPrs->getWidget(), + impl::PART_SWL_OVERLAY); + + return RES_OK; + } + + Result MainPage::createMoreOptionsPresenter() + { + if (m_moreOptionsPrs) { + ILOG("Already exists. No need to create new one. Just update."); + m_moreOptionsPrs->update(); + return RES_OK; + } + + m_moreOptionsPrs = MoreOptionsPresenter::Builder(). + setCallManager(m_cm). + setSoundManager(m_call->getSoundManager()). + setNaviframe(asShared(getNaviframe())). + setParentWidget(m_widget). + build(*this); + + if (!m_moreOptionsPrs) { + LOG_RETURN(RES_FAIL, + "MoreOptionsPresenter::build() failed!"); + } + + m_widget->setContent(m_moreOptionsPrs->getWidget(), + impl::PART_SWL_MORE_OPTION); + + return RES_OK; + } + + Result MainPage::createAcceptRejectPresenter() + { + if (m_acceptRejectPrs) { + m_acceptRejectPrs->update(getAvailableCalls(m_cm)); + return RES_OK; + } + + m_acceptRejectPrs = AcceptRejectPresenter::Builder(). + setIncomingCall(m_cm->getIncomingCall()). + setAvailableCallsFlag(getAvailableCalls(m_cm)). + setSoundManager(m_call->getSoundManager()). + setParentWidget(m_widget). + build(*this); + + if (!m_acceptRejectPrs) { + LOG_RETURN(RES_FAIL, + "AcceptRejectPresenter::build() failed!"); + } + + m_widget->setContent(m_acceptRejectPrs->getWidget(), + impl::PART_SWL_ACCEPT_REJECT); + + return RES_OK; + } + + void MainPage::RejectMsgPresenterStateCb(RejectMsgPresenter::State state) + { + if (state == RejectMsgPresenter::State::HIDDEN) { + show(*m_rmLy); + show(*m_rmCueAo); + } else { + hide(*m_rmLy); + hide(*m_rmCueAo); + } + } + + void MainPage::RejectMsgSelectCb(const IRejectMsgSRef &rm) + { + auto incom = m_cm->getIncomingCall(); + if (incom) { + incom->rejectWithMessage(rm); + } + } + + Result MainPage::createRejectMsgPresenter( + const IRejectMsgProviderSRef &provider) + { + m_rmPrs = RejectMsgPresenter::Builder(). + setProvider(provider). + setStateHandler(WEAK_DELEGATE_THIS(RejectMsgPresenterStateCb)). + setSelectHandler(WEAK_DELEGATE_THIS(RejectMsgSelectCb)). + setParentWidget(m_widget). + build(*this); + + if (!m_rmPrs) { + LOG_RETURN(RES_FAIL, + "RejectMessagePresenter::build() failed!"); + } + + m_widget->setContent(m_rmPrs->getWidget(), + impl::PART_SWL_OVERLAY); + + return RES_OK; + } + + Result MainPage::createCallInfoPresenter() + { + if (m_callInfoPrs) { + return m_callInfoPrs->update(m_cm); + } + + m_callInfoPrs = CallInfoPresenter::Builder(). + setCallManager(m_cm). + setParentWidget(m_widget). + build(*this); + + if (!m_callInfoPrs) { + LOG_RETURN(RES_FAIL, "CallerInfo::build() failed!"); + } + m_widget->setContent(m_callInfoPrs->getWidget(), + impl::PART_SWL_CALL_INFO); + + return RES_OK; + } + + void MainPage::onError(CallErr err) + { + if (getAvailableCalls(m_cm) == CALL_FLAG_NONE) { + requestExit(); + } + } + + Result MainPage::createRejectMsgCueAo() + { + m_rmCueAo = utils::createAccessObjectFromPart(*m_widget, *m_rmLy, + impl::PART_TXT_REJECT_MSG_CUE_AO); + if (!m_rmCueAo) { + LOG_RETURN(RES_FAIL, "createAccessObjectFromPart() failed!"); + } + + auto &atspi = m_rmCueAo->getAtspi(); + atspi.setTDomain(TEXT_DOMAIN); + atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | + ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); + atspi.setName(STR_DECLINE_MESSAGES); + atspi.setDescription( + AO_STR_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE); + atspi.addGestureHandler(WEAK_DELEGATE_THIS(onRejectMsgCueAoGestureCb)); + + return RES_OK; + } + + void MainPage::onRejectMsgCueAoGestureCb(Atspi &atspi, + AtspiGestureEventInfo &eventInfo) + { + // TODO: ELM_ATSPI_GESTURE_TWO_FINGERS_HOVER must be replaced + if (eventInfo.gestureInfo.type == ELM_ATSPI_GESTURE_TWO_FINGERS_HOVER) { + m_rmPrs->showPanel(); + eventInfo.preventDefault = true; + } + } + + Result MainPage::createAtspiHighlightHelper() + { + m_atspiHelper = AtspiHighlightHelper::newInstance(*this); + if (!m_atspiHelper) { + LOG_RETURN(RES_FAIL, + "AtspiHighlightHelper::newInstance() failed!"); + } + + m_atspiHelper->registerObject(getWindow()); + + switch (m_mode) { + case CallMode::INCOMING: + registerIncomingCallModeAo(); + break; + case CallMode::OUTGOING: + case CallMode::DURING: + registerActiveCallModeAo(); + break; + case CallMode::END: + registerEndCallModeAo(); + default: + break; + } + return RES_OK; + } + + void MainPage::registerIncomingCallModeAo() + { + m_atspiHelper->setEventHandler( + WEAK_DELEGATE_THIS(onIncomingCallModeAtspiHighlight)); + + if (const auto acceptAo = m_acceptRejectPrs->getAcceptAo()) { + m_atspiHelper->registerObject(*acceptAo); + } + + if (const auto rejectAo = m_acceptRejectPrs->getRejectAo()) { + m_atspiHelper->registerObject(*rejectAo); + } + + if (const auto statusTxtAo = m_callInfoPrs->getStatusTxtAo()) { + m_atspiHelper->registerObject(*statusTxtAo); + } + + if (const auto mainTxtAo = m_callInfoPrs->getMainTxtAo()) { + m_atspiHelper->registerObject(*mainTxtAo); + } + + if (const auto subTxtAo = m_callInfoPrs->getSubTxtAo()) { + m_atspiHelper->registerObject(*subTxtAo); + } + + if (m_rmCueAo) { + m_atspiHelper->registerObject(*m_rmCueAo); + } + } + + const Elm_Interface_Atspi_Accessible * + MainPage::onIncomingCallModeAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + return AoSequencer(ao, flowRelation). + process(m_acceptRejectPrs->getAcceptAo()). + process(m_callInfoPrs->getStatusTxtAo()). + process(m_callInfoPrs->getMainTxtAo()). + process(m_callInfoPrs->getSubTxtAo()). + process(m_acceptRejectPrs->getRejectAo()). + process(m_rmCueAo). + getNext(); + } + + void MainPage::registerActiveCallModeAo() + { + m_atspiHelper->setEventHandler( + WEAK_DELEGATE_THIS(onActiveCallModeAtspiHighlight)); + + if (const auto statusTxtAo = m_callInfoPrs->getStatusTxtAo()) { + m_atspiHelper->registerObject(*statusTxtAo); + } + + if (const auto mainTxtAo = m_callInfoPrs->getMainTxtAo()) { + m_atspiHelper->registerObject(*mainTxtAo); + } + + if (const auto subTxtAo = m_callInfoPrs->getSubTxtAo()) { + m_atspiHelper->registerObject(*subTxtAo); + } + + if (const auto moreOptCueAo = m_moreOptionsPrs->getCueAo()) { + m_atspiHelper->registerObject(*moreOptCueAo); + } + + if (m_bottomBtn) { + m_atspiHelper->registerObject(*m_bottomBtn); + } + } + + const Elm_Interface_Atspi_Accessible * + MainPage::onActiveCallModeAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + return AoSequencer(ao, flowRelation). + process(m_callInfoPrs->getStatusTxtAo()). + process(m_callInfoPrs->getMainTxtAo()). + process(m_callInfoPrs->getSubTxtAo()). + process(m_accessoryPrs->getNextAo(true)). + process(m_accessoryPrs->getNextAo(false)). + process(m_moreOptionsPrs->getCueAo()). + process(m_bottomBtn). + getNext(); + } + + void MainPage::registerEndCallModeAo() + { + m_atspiHelper->setEventHandler( + WEAK_DELEGATE_THIS(onEndCallModeAtspiHighlight)); + + if (const auto statusTxtAo = m_callInfoPrs->getStatusTxtAo()) { + m_atspiHelper->registerObject(*statusTxtAo); + } + + if (const auto mainTxtAo = m_callInfoPrs->getMainTxtAo()) { + m_atspiHelper->registerObject(*mainTxtAo); + } + + if (m_bottomBtn) { + m_atspiHelper->registerObject(*m_bottomBtn); + } + } + + const Elm_Interface_Atspi_Accessible * + MainPage::onEndCallModeAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + return AoSequencer(ao, flowRelation). + process(m_callInfoPrs->getStatusTxtAo()). + process(m_callInfoPrs->getMainTxtAo()). + process(m_accessoryPrs->getNextAo(true)). + process(m_accessoryPrs->getNextAo(false)). + process(m_bottomBtn). + getNext(); + } + + Elm_Interface_Atspi_Accessible * + MainPage::onAccessoryAoRequest(bool isFlowsTo) + { + if (isFlowsTo) { + return (m_mode == CallMode::END) ? as_ao(m_bottomBtn) : + as_ao(m_moreOptionsPrs->getCueAo()); + } else { + const auto subTxtAo = m_callInfoPrs->getSubTxtAo(); + return (subTxtAo ? as_ao(subTxtAo) : + as_ao(m_callInfoPrs->getMainTxtAo())); + } + return nullptr; + } +} diff --git a/call-ui/presenters/pages/MainPage.h b/call-ui/presenters/pages/MainPage.h new file mode 100644 index 0000000..0eeb700 --- /dev/null +++ b/call-ui/presenters/pages/MainPage.h @@ -0,0 +1,186 @@ +/* + * 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_PAGES_MAIN_PAGE_H__ +#define __CALL_UI_PRESENTERS_PAGES_MAIN_PAGE_H__ + +#include "base/Page.h" +#include "call-ui/model/ICallListener.h" + +#include "ucl/gui/Layout.h" + +#include "call-ui/model/ICallUI.h" +#include "call-ui/presenters/misc/IndicatorPresenter.h" +#include "call-ui/presenters/misc/AcceptRejectPresenter.h" +#include "call-ui/presenters/misc/CallInfoPresenter.h" +#include "call-ui/presenters/misc/RejectMsgPresenter.h" +#include "call-ui/presenters/misc/AccessoryPresenter.h" +#include "call-ui/presenters/misc/MoreOptionsPresenter.h" +#include "call-ui/presenters/misc/DeviceStatePresenter.h" +#include "call-ui/presenters/misc/AtspiHighlightHelper.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(MainPage); + + /** + * @brief Presenter of Main page + */ + class MainPage final : public Page, + public ICallListener { + public: + + /** + * @brief MainPage builder + */ + class Builder { + public: + + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets Naviframe instance + * @param[in] navi Naviframe instance + * @return Reference to builder + */ + Builder &setNaviframe(ucl::NaviframeSRef navi); + + /** + * @brief Sets CallUI instance + * @param[in] call CallUI instance + * @return Reference to builder + */ + Builder &setCallUI(ICallUISRef call); + + /** + * @brief Creates new instance of MainPage + * @param[in] onExitRequest Page exit request event handler + * @return Shared reference to MainPage instance + * on success or NULL otherwise + */ + MainPageSRef build(ExitRequestHandler onExitRequest) const; + private: + ucl::NaviframeSRef m_navi; + ICallUISRef m_call; + }; + + private: + MainPage(ucl::IRefCountObj &rc, + ucl::NaviframeSRef navi, + ExitRequestHandler onExitRequest, + ICallUISRef call); + ~MainPage() = default; + + ucl::Result doPrepare(ucl::NaviItem &item); + + ucl::Result registerPowerKeyHandling(); + void unregisterPowerKeyHandling(); + + void processKeyPress(bool isPowerKey = false); + + ucl::Result showWindow(); + + ucl::Result processIncomingCallMode(); + ucl::Result processEndCallMode(); + ucl::Result processRegularCallModes(); + + ucl::Result createCallInfoPresenter(); + ucl::Result createAccessoryPresenter(); + ucl::Result createMoreOptionsPresenter(); + ucl::Result createAcceptRejectPresenter(); + ucl::Result createRejectMsgPresenter( + const IRejectMsgProviderSRef &provider); + + ucl::Result createRejectMsgCue(); + void RejectMsgPresenterStateCb(RejectMsgPresenter::State state); + void RejectMsgSelectCb(const IRejectMsgSRef &rm); + + ucl::Result createBottomBtn(const ucl::ElmStyle &style, + bool setVisible = true); + void onBottomBtnClicked(ucl::Widget &widget, void *eventInfo); + + void startEndCallTimer(); + void stopEndCallTimer(); + Eina_Bool onEndCallTimerCb(); + + void onPowerKeyUp(ucl::Widget &widget, void *eventInfo); + + ucl::Result updateDeviceState(CallMode prevMode, CallMode curMode); + + ucl::Result createWidget(); + ucl::Result createIndicatorPresenter(); + ucl::Result createDisplayPresenter(); + + void onExitAppRequest(); + + ucl::Result createRejectMsgCueAo(); + void onRejectMsgCueAoGestureCb(ucl::Atspi &atspi, + ucl::AtspiGestureEventInfo &eventInfo); + ucl::Result createAtspiHighlightHelper(); + void registerIncomingCallModeAo(); + void registerActiveCallModeAo(); + void registerEndCallModeAo(); + const Elm_Interface_Atspi_Accessible *onIncomingCallModeAtspiHighlight( + const Elm_Interface_Atspi_Accessible *widget, + Elm_Atspi_Relation_Type flowRelation); + const Elm_Interface_Atspi_Accessible *onActiveCallModeAtspiHighlight( + const Elm_Interface_Atspi_Accessible *widget, + Elm_Atspi_Relation_Type flowRelation); + const Elm_Interface_Atspi_Accessible *onEndCallModeAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation); + Elm_Interface_Atspi_Accessible *onAccessoryAoRequest(bool isFlowsTo); + + // Page // + + virtual void onBackKey() final override; + + // ICallListener // + + virtual void onCallEvent(CallEventType type) final override; + virtual void onError(CallErr err) final override; + + private: + const ICallUISRef m_call; + const ICallManagerSRef m_cm; + + ucl::LayoutSRef m_widget; + ucl::LayoutSRef m_rmLy; + ucl::StyledWidgetSRef m_bottomBtn; + + IndicatorPresenterSRef m_indicator; + CallInfoPresenterSRef m_callInfoPrs; + AcceptRejectPresenterSRef m_acceptRejectPrs; + RejectMsgPresenterSRef m_rmPrs; + AccessoryPresenterSRef m_accessoryPrs; + MoreOptionsPresenterSRef m_moreOptionsPrs; + DeviceStatePresenterSRef m_devicePrs; + + CallMode m_mode; + Ecore_Timer *m_ecTimer; + bool m_ecTimerBtnReq; + + ucl::ElmWidgetSRef m_rmCueAo; + AtspiHighlightHelperSRef m_atspiHelper; + + friend class ucl::ReffedObj<MainPage>; + }; +} + +#endif // __CALL_UI_PRESENTERS_PAGES_MAIN_PAGE_H__ diff --git a/src/presenters/Page.cpp b/call-ui/presenters/pages/base/Page.cpp index 1f5e85d..6d09077 100644 --- a/src/presenters/Page.cpp +++ b/call-ui/presenters/pages/base/Page.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "presenters/Page.h" +#include "Page.h" -#include "common.h" +#include "call-ui/presenters/common.h" namespace callui { namespace { namespace impl { @@ -55,13 +55,13 @@ namespace callui { } m_navi->addEventHandler(NAVI_TRANSITION_STARTED, - WEAK_DELEGATE(Page::onTransitionStarted, asWeak(*this))); + WEAK_DELEGATE_THIS(onTransitionStarted)); m_navi->addEventHandler(NAVI_TRANSITION_FINISHED, - WEAK_DELEGATE(Page::onTransitionFinished, asWeak(*this))); + WEAK_DELEGATE_THIS(onTransitionFinished)); m_navi->addEventHandler(impl::TOP_PAGE_CHANGED, - WEAK_DELEGATE(Page::onTopPageChanged, asWeak(*this))); + WEAK_DELEGATE_THIS(onTopPageChanged)); eext_object_event_callback_add(content, EEXT_CALLBACK_BACK, CALLBACK_A(Page::onHWBackKey), this); @@ -100,20 +100,27 @@ namespace callui { m_navi->pop(); m_item = nullptr; } else { - exitNoTransition(); + dispose(); } } - void Page::exitNoTransition() + void Page::dispose() { - if (isAtTop()) { - m_item.del(); - dispatchTopPageChanged(); - } else if (m_item) { - m_item.del(); + if (m_item) { + if (isAtTop()) { + m_item.del(); + dispatchTopPageChanged(); + } else { + m_item.del(); + } } } + bool Page::isDisposed() const + { + return m_item; + } + void Page::popTo() { if (m_item && !isAtTop()) { @@ -145,8 +152,8 @@ namespace callui { void Page::requestExit() { - if (m_onExitRequest) { - m_onExitRequest(*this); + if (const auto handler = m_onExitRequest.lock()) { + handler(*this); } else { WLOG("m_onExitRequest is NULL"); exit(); diff --git a/call-ui/presenters/pages/base/Page.h b/call-ui/presenters/pages/base/Page.h new file mode 100644 index 0000000..7e346d3 --- /dev/null +++ b/call-ui/presenters/pages/base/Page.h @@ -0,0 +1,181 @@ +/* + * 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_BASE_PAGE_H__ +#define __CALL_UI_PRESENTERS_BASE_PAGE_H__ + +#include "ucl/gui/Naviframe.h" + +#include "ucl/mvp/GuiPresenter.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(Page); + + /** + * @brief Base class for pages + */ + class Page : public ucl::GuiPresenter, + public ucl::IDisposable { + public: + + /** + * @brief Page exit request handler definition + */ + using ExitRequestHandler = ucl::WeakDelegate<void(Page &page)>; + + public: + + /** + * @brief Gets naviframe + * @return Reference to Naviframe + */ + ucl::Naviframe &getNaviframe(); + + /** + * @brief Checks whether page is top in page stack + * @return true if page is top, false otherwise + */ + bool isAtTop() const; + + /** + * @brief Checks whether page is bottom in page stack + * @return true if page is bottom, false otherwise + */ + bool isAtBottom() const; + + /** + * @brief Requests to remove page from stack + * @remark If page is top in page stack it will be removed + * with transition animation. Otherwise it will be removed + * without animation + */ + void exit(); + + /** + * @brief Pops other pages from stack above current page + * @remark Upper pages will be removed with single transition animation + */ + void popTo(); + + /** + * @brief Deletes other pages that are in stack above current page + * @remark No transition animation will be provided + */ + void deleteTo(); + + /** + * @brief Promotes page to the top of the page stack + */ + void promote(); + + /** + * @brief Inserts page after some page that is already in stack + * @param[in] args List of params @see ucl::Naviframe + */ + template <class ...ARGS> + ucl::NaviItem insertAfter(ARGS &&...args); + + /** + * @brief Inserts page before some page that is already in stack + * @param[in] args List of params @see ucl::Naviframe + */ + template <class ...ARGS> + ucl::NaviItem insertBefore(ARGS &&...args); + + // ucl::IDisposable // + + /** + * @see ucl::IDisposable::dispose() + */ + virtual void dispose() override; + + /** + * @see ucl::IDisposable::isDisposed() + */ + virtual bool isDisposed() const final override; + + protected: + + /** + * @brief Constructor + * @param[in] rc Reference count object + * @param[in] navi Application naviframe + * @param[in] onExitRequest Exit request handler + */ + Page(ucl::IRefCountObj &rc, const ucl::NaviframeSRef &navi, + const ExitRequestHandler &onExitRequest); + /** + * @brief Destructor + */ + ~Page(); + + /** + * @brief Prepare method to initialize main Page components + * @param[in] onPrepare Function callback that will be called + * on user side for creation NaviItem and its content + * @return RES_OK on success or another result otherwise + */ + template <class ON_PREPARE> + ucl::Result prepare(ON_PREPARE &&onPrepare); + + /** + * @brief Gets naviframe item + * @return Naviframe item + */ + ucl::NaviItem getItem(); + + /** + * @brief Makes request on Page exit + * @remark Set ExitRequestHandler will be called. + */ + void requestExit(); + + /** + * @brief Called when Page gets Back key event + * @remark By default it make Page exit request + */ + virtual void onBackKey(); + + private: + ucl::Result preparePart2(); + + void dispatchTopPageChanged(); + + void updateActiveState(); + + void onTransitionStarted(ucl::Widget &widget, void *eventInfo); + void onTransitionFinished(ucl::Widget &widget, void *eventInfo); + void onTopPageChanged(ucl::Widget &widget, void *eventInfo); + + void onHWBackKey(Evas_Object *obj, void *eventInfo); + void onItemDel(Evas_Object *obj, void *eventInfo); + + private: + const ucl::NaviframeSRef m_navi; + const ExitRequestHandler m_onExitRequest; + ucl::NaviItem m_item; + PageSRef m_selfRef; + }; + + // Non-member functions // + + bool isLast(const Page &page); +} + +#include "Page.hpp" + +#endif // __CALL_UI_PRESENTERS_BASE_PAGE_H__ diff --git a/inc/presenters/Page.hpp b/call-ui/presenters/pages/base/Page.hpp index 2ef28d2..a5b23bb 100644 --- a/inc/presenters/Page.hpp +++ b/call-ui/presenters/pages/base/Page.hpp @@ -57,7 +57,7 @@ namespace callui { return (m_navi->getBottomItem() == m_item); } - // Non-member functions + // Non-member functions // inline bool isLast(const Page &page) { diff --git a/call-ui/presenters/types.h b/call-ui/presenters/types.h new file mode 100644 index 0000000..eb270f8 --- /dev/null +++ b/call-ui/presenters/types.h @@ -0,0 +1,46 @@ +/* + * 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_TYPES_H__ +#define __CALL_UI_PRESENTERS_TYPES_H__ + +#include "ucl/misc/HashMap.h" + +#include "call-ui/view/types.h" +#include "call-ui/model/types.h" + +namespace callui { + + /** + * @brief Power button event info structure + */ + struct PowerBtnEventInfo { + bool stopPropagation = false; + }; + + /** + * @brief Map of text-containing edje parts + */ + using PartTextMap = ucl::HashMap<ucl::EdjePart, ucl::TString>; + + /** + * @brief Access object request handler definition + */ + using AoRequestHandler = ucl::WeakDelegate< + Elm_Interface_Atspi_Accessible *(bool)>; +} + +#endif // __CALL_UI_PRESENTERS_TYPES_H__ diff --git a/call-ui/resources.cpp b/call-ui/resources.cpp new file mode 100644 index 0000000..111b588 --- /dev/null +++ b/call-ui/resources.cpp @@ -0,0 +1,93 @@ +/* + * 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 "call-ui/resources.h" + +namespace callui { + + const ucl::TString STR_ANSWER_CALL { + "WDS_WMGR_HEADER_ANSWER_CALL_ABB", TEXT_DOMAIN}; + const ucl::TString STR_HOLD_AND_ACCEPT { + "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB", TEXT_DOMAIN}; + const ucl::TString STR_END_AND_ACCEPT { + "WDS_CST_MBODY_END_AND_ACCEPT_ABB", TEXT_DOMAIN}; + const ucl::TString STR_CALL_WITH_PS_WILL_END { + "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB", TEXT_DOMAIN}; + const ucl::TString STR_CALL_ON_HOLD { + "WDS_CST_HEADER_CALL_ON_HOLD_ABB", TEXT_DOMAIN}; + const ucl::TString STR_WITH_PD_PEOPLE { + "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB", TEXT_DOMAIN}; + const ucl::TString STR_CONFERENCE_CALL { + "IDS_CALL_BODY_CONFERENCE", TEXT_DOMAIN}; + const ucl::TString STR_UNKNOWN { + "WDS_CST_BODY_UNKNOWN_M_CALLER", TEXT_DOMAIN}; + const ucl::TString STR_EMERGENCY_CALL { + "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB", TEXT_DOMAIN}; + const ucl::TString STR_VOICEMAIL { + "IDS_COM_HEADER_VOICE_MAIL_ORANGE", TEXT_DOMAIN}; + const ucl::TString STR_INCOMING_CALL { + "WDS_WMGR_HEADER_INCOMING_CALL_ABB", TEXT_DOMAIN}; + const ucl::TString STR_DIALING_CALL { + "WDS_CALL_BODY_DIALING_M_STATUS", TEXT_DOMAIN}; + const ucl::TString STR_ON_HOLD { + "WDS_CST_HEADER_ON_HOLD_ABB", TEXT_DOMAIN}; + const ucl::TString STR_CALL_ENDED { + "WDS_CST_HEADER_CALL_ENDED_ABB", TEXT_DOMAIN}; + const ucl::TString STR_DECLINE_MESSAGES { + "WDS_CALL_BODY_DECLINE_MESSAGES_ABB", TEXT_DOMAIN}; + const ucl::TString STR_VOLUME { + "WDS_CALL_BUTTON_VOLUME_ABB", TEXT_DOMAIN}; + const ucl::TString STR_MORE_SWAP { + "WDS_WMGR_OPT_SWAP_ABB", TEXT_DOMAIN}; + const ucl::TString STR_MORE_KEYPAD { + "WDS_WMGR_OPT_KEYPAD_ABB", TEXT_DOMAIN}; + const ucl::TString STR_MORE_UNHOLD { + "WDS_CST_BUTTON_UNHOLD_ABB", TEXT_DOMAIN}; + const ucl::TString STR_MORE_GEAR { + "IDS_CST_MBODY_GEAR_ABB", TEXT_DOMAIN}; + const ucl::TString STR_MORE_HEADSET{ + "WDS_WMGR_OPT_HEADSET_ABB", TEXT_DOMAIN}; + + // Screen Reader + const ucl::TString AO_STR_CALL { + "WDS_HS_TMBODY_CALL_ABB", TEXT_DOMAIN}; + const ucl::TString AO_STR_MUTE { + "IDS_CALL_BUTTON_MUTE_ABB", TEXT_DOMAIN}; + const ucl::TString AO_STR_MORE_OPTIONS { + "IDS_CALL_OPT_MORE_OPTIONS_TTS", TEXT_DOMAIN}; + const ucl::TString AO_STR_END_CALL { + "IDS_CALL_SK3_END_CALL", TEXT_DOMAIN}; + const ucl::TString AO_STR_CALLBACK { + "IDS_CALL_BUTTON_CALL", TEXT_DOMAIN}; + const ucl::TString AO_STR_ADD_TO_CONTACTS { + "IDS_VCALL_BUTTON_ADD_TO_CONTACTS", TEXT_DOMAIN}; + const ucl::TString AO_STR_ROTATE_BEZEL_TO_ADJUST { + "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS", TEXT_DOMAIN}; + const ucl::TString AO_STR_DECREASE_VOLUME { + "IDS_ACCS_OPT_DECREASE_VOLUME", TEXT_DOMAIN}; + const ucl::TString AO_STR_INCREASE_VOLUME { + "IDS_ACCS_OPT_INCREASE_VOLUME", TEXT_DOMAIN}; + const ucl::TString AO_STR_ACCEPT_CALL { + "WDS_CALL_TBBODY_ACCEPT_CALL", TEXT_DOMAIN}; + const ucl::TString AO_STR_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT { + "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL", TEXT_DOMAIN}; + const ucl::TString AO_STR_REJECT_CALL { + "WDS_CALL_TBBODY_REJECT_CALL", TEXT_DOMAIN}; + const ucl::TString AO_STR_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT { + "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL", TEXT_DOMAIN}; + const ucl::TString AO_STR_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE { + "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE", TEXT_DOMAIN}; +} diff --git a/inc/resources.h b/call-ui/resources.h index a6983ee..8251900 100644 --- a/inc/resources.h +++ b/call-ui/resources.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __CALLUI_RESOURCES_H__ -#define __CALLUI_RESOURCES_H__ +#ifndef __CALL_UI_RESOURCES_H__ +#define __CALL_UI_RESOURCES_H__ #include "ucl/misc/TString.h" @@ -48,12 +48,28 @@ namespace callui { extern const ucl::TString STR_MORE_SWAP; extern const ucl::TString STR_MORE_HEADSET; - extern const ucl::TString STR_MORE_PHONE; extern const ucl::TString STR_MORE_KEYPAD; - extern const ucl::TString STR_MORE_HOLD; extern const ucl::TString STR_MORE_UNHOLD; extern const ucl::TString STR_MORE_TRANSFER; extern const ucl::TString STR_MORE_GEAR; + + // Screen Reader + extern const ucl::TString AO_STR_CALL; + extern const ucl::TString AO_STR_HEADSET; + extern const ucl::TString AO_STR_MUTE; + extern const ucl::TString AO_STR_MORE_OPTIONS; + extern const ucl::TString AO_STR_END_CALL; + extern const ucl::TString AO_STR_CALLBACK; + extern const ucl::TString AO_STR_ADD_TO_CONTACTS; + extern const ucl::TString AO_STR_ROTATE_BEZEL_TO_ADJUST; + extern const ucl::TString AO_STR_DECREASE_VOLUME; + extern const ucl::TString AO_STR_INCREASE_VOLUME; + extern const ucl::TString AO_STR_ACCEPT_CALL; + extern const ucl::TString AO_STR_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT; + extern const ucl::TString AO_STR_REJECT_CALL; + extern const ucl::TString AO_STR_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT; + extern const ucl::TString AO_STR_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE; + } -#endif // __CALLUI_RESOURCES_H__ +#endif // __CALL_UI_RESOURCES_H__ diff --git a/src/types.cpp b/call-ui/types.cpp index 08bd058..08bd058 100644 --- a/src/types.cpp +++ b/call-ui/types.cpp diff --git a/inc/types.h b/call-ui/types.h index 6bf8e12..6bbb1c3 100644 --- a/inc/types.h +++ b/call-ui/types.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __CALLUI_TYPES_H__ -#define __CALLUI_TYPES_H__ +#ifndef __CALL_UI_TYPES_H__ +#define __CALL_UI_TYPES_H__ #include "config.h" @@ -39,4 +39,4 @@ namespace callui { using NotiHandler = ucl::WeakDelegate<void()>; } -#endif // __CALLUI_TYPES_H__ +#endif // __CALL_UI_TYPES_H__ diff --git a/src/view/AcceptRejectWidget.cpp b/call-ui/view/AcceptRejectWidget.cpp index f8841a7..19be23c 100644 --- a/src/view/AcceptRejectWidget.cpp +++ b/call-ui/view/AcceptRejectWidget.cpp @@ -14,8 +14,10 @@ * limitations under the License. */ -#include "view/AcceptRejectWidget.h" +#include "call-ui/view/AcceptRejectWidget.h" +#include "call-ui/resources.h" +#include "helpers.h" #include "common.h" #define CU_COL_TRANSPARENT 0, 0, 0, 0 @@ -55,6 +57,9 @@ namespace callui { namespace { namespace impl { constexpr LayoutTheme LAYOUT_IMG_REJECT {"layout", "callui_image", "reject"}; + const std::string ATSPI_ATTRIBUTE_KEY = "gesture_required"; + const std::string ATSPI_ATTRIBUTE_VALUE = "scroll"; + constexpr auto BC_ITEM_COUNT = 4; constexpr auto BC_ANIMATE_COUNT_MAX = 3; @@ -141,7 +146,6 @@ namespace callui { namespace { namespace impl { { auto layout = Layout::Builder(). setTheme(theme). - setIsOwner(true). build(parent); if (!layout) { LOG_RETURN_VALUE(RES_FAIL, {}, "Layout::build() failed!"); @@ -169,18 +173,16 @@ namespace callui { } AcceptRejectWidget::Builder & - AcceptRejectWidget::Builder::setAcceptEventHandler( - const NotiHandler &handler) + AcceptRejectWidget::Builder::setAcceptEventHandler(NotiHandler handler) { - m_acceptHandler = handler; + m_acceptHandler = std::move(handler); return *this; } AcceptRejectWidget::Builder & - AcceptRejectWidget::Builder::setRejectEventHandler( - const NotiHandler &handler) + AcceptRejectWidget::Builder::setRejectEventHandler(NotiHandler handler) { - m_rejectHandler = handler; + m_rejectHandler = std::move(handler); return *this; } @@ -196,7 +198,6 @@ namespace callui { { auto layout = Layout::Builder(). setTheme(impl::LAYOUT_IMG_ACCEPT_REJECT). - setIsOwner(true). build(parent); if (!layout) { LOG_RETURN_VALUE(RES_FAIL, {}, "Layout::build() failed!"); @@ -205,6 +206,9 @@ namespace callui { auto result = makeShared<AcceptRejectWidget>(layout, m_acceptHandler, m_rejectHandler, m_acceptBtnType); + FAIL_RETURN_VALUE(result->registerAccessObjects(parent), {}, + "registerScreenReaderObjects() failed!"); + result->bindToEo(); return result; @@ -212,13 +216,13 @@ namespace callui { AcceptRejectWidget::AcceptRejectWidget(IRefCountObj &rc, const LayoutSRef &layout, - const NotiHandler &acceptHandler, - const NotiHandler &rejectHandler, + NotiHandler acceptHandler, + NotiHandler rejectHandler, AcceptButtonType acceptBtnType): - ElmWidget(&rc, *layout, true), + ElmWidget(&rc, as_eo(*layout), false), + m_accHandler(std::move(acceptHandler)), + m_rejHandler(std::move(rejectHandler)), m_layout(layout.get()), - m_accHandler(acceptHandler), - m_rejHandler(rejectHandler), m_accBezelCueImg(impl::BC_ITEM_COUNT), m_rejBezelCueImg(impl::BC_ITEM_COUNT), m_isFreezed(false), @@ -252,18 +256,18 @@ namespace callui { m_expandTimeout.reset(); m_accEventLy->delEventHandler(WidgetEvent::MOUSE_DOWN, - WEAK_DELEGATE(AcceptRejectWidget::onMouseDown, asWeak(*this))); + DELEGATE_THIS(onMouseDown)); m_accEventLy->delEventHandler(WidgetEvent::MOUSE_UP, - WEAK_DELEGATE(AcceptRejectWidget::onMouseUp, asWeak(*this))); + DELEGATE_THIS(onMouseUp)); m_accEventLy->delEventHandler(WidgetEvent::MOUSE_MOVE, - WEAK_DELEGATE(AcceptRejectWidget::onMouseMove, asWeak(*this))); + DELEGATE_THIS(onMouseMove)); m_rejEventLy->delEventHandler(WidgetEvent::MOUSE_DOWN, - WEAK_DELEGATE(AcceptRejectWidget::onMouseDown, asWeak(*this))); + DELEGATE_THIS(onMouseDown)); m_rejEventLy->delEventHandler(WidgetEvent::MOUSE_UP, - WEAK_DELEGATE(AcceptRejectWidget::onMouseUp, asWeak(*this))); + DELEGATE_THIS(onMouseUp)); m_rejEventLy->delEventHandler(WidgetEvent::MOUSE_MOVE, - WEAK_DELEGATE(AcceptRejectWidget::onMouseMove, asWeak(*this))); + DELEGATE_THIS(onMouseMove)); DEL_TRANSIT(m_lastAccBezelTr1); DEL_TRANSIT(m_lastAccBezelTr2); @@ -278,7 +282,7 @@ namespace callui { DEL_TRANSIT(m_rejGuideTr); DEL_TRANSIT(m_rejIconTr); - eext_rotary_object_event_callback_del(*m_layout, CALLBACK_A( + eext_rotary_object_event_callback_del(as_eo(*m_layout), CALLBACK_A( AcceptRejectWidget::onRotaryEvent)); } @@ -293,7 +297,7 @@ namespace callui { FAIL_RETURN_VOID(createBezelCueComponents(), "createBezelCueImages() failed!"); - eext_rotary_object_event_callback_add(*m_layout, CALLBACK_A( + eext_rotary_object_event_callback_add(as_eo(*m_layout), CALLBACK_A( AcceptRejectWidget::onRotaryEvent), this); } @@ -301,7 +305,7 @@ namespace callui { { m_accTracer = impl::createImage(*m_layout, impl::LAYOUT_IMG_ACTION_BG); if (!m_accTracer) { - LOG_RETURN(RES_FAIL, "createImage() failed"); + LOG_RETURN(RES_FAIL, "createImage() failed!"); } m_accTracer->setColor(CU_COL_TRANSPARENT); m_layout->setContent(*m_accTracer, @@ -309,7 +313,7 @@ namespace callui { m_accGuide = impl::createImage(*m_layout, impl::LAYOUT_IMG_ACTION_BG); if (!m_accGuide) { - LOG_RETURN(RES_FAIL, "createImage() failed"); + LOG_RETURN(RES_FAIL, "createImage() failed!"); } m_accGuide->setColor(CU_COL_TRANSPARENT); m_layout->setContent(*m_accGuide, @@ -326,7 +330,7 @@ namespace callui { break; } if (!m_accIcon) { - LOG_RETURN(RES_FAIL, "createImage() failed"); + LOG_RETURN(RES_FAIL, "createImage() failed!"); } m_accIcon->setColor(CU_COL_AO0113); m_layout->setContent(*m_accIcon, @@ -335,13 +339,16 @@ namespace callui { m_accEventLy = Layout::Builder(). setTheme(impl::LAYOUT_EVENT_ACCEPT_REJECT). build(*m_layout); - m_accEventLy->setWeight(EXPAND, EXPAND); + m_accEventLy->addEventHandler(WidgetEvent::MOUSE_DOWN, - WEAK_DELEGATE(AcceptRejectWidget::onMouseDown, asWeak(*this))); + WEAK_DELEGATE_THIS(onMouseDown)); + m_accEventLy->addEventHandler(WidgetEvent::MOUSE_UP, - WEAK_DELEGATE(AcceptRejectWidget::onMouseUp, asWeak(*this))); + WEAK_DELEGATE_THIS(onMouseUp)); + m_accEventLy->addEventHandler(WidgetEvent::MOUSE_MOVE, - WEAK_DELEGATE(AcceptRejectWidget::onMouseMove, asWeak(*this))); + WEAK_DELEGATE_THIS(onMouseMove)); + m_layout->setContent(*m_accEventLy, impl::PART_SWL_ACCEPT_FINGER_EVENT); @@ -352,7 +359,7 @@ namespace callui { { m_rejTracer = impl::createImage(*m_layout, impl::LAYOUT_IMG_ACTION_BG); if (!m_rejTracer) { - LOG_RETURN(RES_FAIL, "createImage() failed"); + LOG_RETURN(RES_FAIL, "createImage() failed!"); } m_rejTracer->setColor(CU_COL_TRANSPARENT); m_layout->setContent(*m_rejTracer, @@ -360,7 +367,7 @@ namespace callui { m_rejGuide = impl::createImage(*m_layout, impl::LAYOUT_IMG_ACTION_BG); if (!m_rejGuide) { - LOG_RETURN(RES_FAIL, "createImage() failed"); + LOG_RETURN(RES_FAIL, "createImage() failed!"); } m_rejGuide->setColor(CU_COL_TRANSPARENT); m_layout->setContent(*m_rejGuide, @@ -368,7 +375,7 @@ namespace callui { m_rejIcon = impl::createImage(*m_layout, impl::LAYOUT_IMG_REJECT); if (!m_rejIcon) { - LOG_RETURN(RES_FAIL, "createImage() failed"); + LOG_RETURN(RES_FAIL, "createImage() failed!"); } m_rejIcon->setColor(CU_COL_AO0115); m_layout->setContent(*m_rejIcon, @@ -379,13 +386,13 @@ namespace callui { build(*m_layout); m_rejEventLy->addEventHandler(WidgetEvent::MOUSE_DOWN, - WEAK_DELEGATE(AcceptRejectWidget::onMouseDown, asWeak(*this))); + WEAK_DELEGATE_THIS(onMouseDown)); m_rejEventLy->addEventHandler(WidgetEvent::MOUSE_UP, - WEAK_DELEGATE(AcceptRejectWidget::onMouseUp, asWeak(*this))); + WEAK_DELEGATE_THIS(onMouseUp)); m_rejEventLy->addEventHandler(WidgetEvent::MOUSE_MOVE, - WEAK_DELEGATE(AcceptRejectWidget::onMouseMove, asWeak(*this))); + WEAK_DELEGATE_THIS(onMouseMove)); m_layout->setContent(*m_rejEventLy, impl::PART_SWL_REJECT_FINGER_EVENT); @@ -427,13 +434,13 @@ namespace callui { needTransition = false; } - if (widget == *m_accEventLy) { + if (as_eo(widget) == as_eo(*m_accEventLy)) { DLOG("Accept button down"); m_isAccPressed = true; if (needTransition) { setAcceptPressedState(); } - } else if (widget == *m_rejEventLy) { + } else if (as_eo(widget) == as_eo(*m_rejEventLy)) { DLOG("Reject button down"); m_isRejPressed = true; if (needTransition) { @@ -466,14 +473,14 @@ namespace callui { m_lastMoveDistance = impl::INIT_MOVE_DISTANCE_VAL; - if (widget == *m_accEventLy) { + if (as_eo(widget) == as_eo(*m_accEventLy)) { if (m_isAccPressed) { DLOG("Accept button released"); setAcceptUnpressedState(); } else { LOG_RETURN_VOID(RES_FAIL, "Accept button was not pressed"); } - } else if (widget == *m_rejEventLy) { + } else if (as_eo(widget) == as_eo(*m_rejEventLy)) { if (m_isRejPressed) { DLOG("Reject button released"); setRejectUnpressedState(); @@ -514,12 +521,12 @@ namespace callui { } ElmWidgetSRef img; - if (widget == *m_accEventLy) { + if (as_eo(widget) == as_eo(*m_accEventLy)) { if (!m_isAccPressed) { LOG_RETURN_VOID(RES_FAIL, "Down callback is not come"); } img = m_accTracer; - } else if (widget == *m_rejEventLy) { + } else if (as_eo(widget) == as_eo(*m_rejEventLy)) { if (!m_isRejPressed) { LOG_RETURN_VOID(RES_FAIL, "Down callback is not come"); } @@ -545,10 +552,14 @@ namespace callui { if (m_lastMoveDistance >= impl::FINGER_STROKE_HALF_DIM) { m_isFreezed = true; - if (m_accTracer == img && m_accHandler) { - m_accHandler(); - } else if (m_rejTracer == img && m_rejHandler) { - m_rejHandler(); + if (m_accTracer == img) { + if (const auto handler = m_accHandler.lock()) { + handler(); + } + } else if (m_rejTracer == img ) { + if (const auto handler = m_rejHandler.lock()) { + handler(); + } } } } @@ -570,7 +581,7 @@ namespace callui { m_accBCAnimIndex = impl::BC_ITEM_COUNT - 1; Elm_Transit *tr1 = elm_transit_add(); elm_transit_effect_color_add(tr1, CU_COL_AO0113D, CU_COL_AO0113); - elm_transit_object_add(tr1, *m_accBezelCueImg[m_accBCAnimIndex]); + elm_transit_object_add(tr1, as_eo(*m_accBezelCueImg[m_accBCAnimIndex])); elm_transit_duration_set(tr1, impl::BC_ANIMATION_DURATION[m_accBCAnimIndex]); elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE); @@ -583,7 +594,7 @@ namespace callui { m_rejBCAnimIndex = impl::BC_ITEM_COUNT - 1; Elm_Transit *tr2 = elm_transit_add(); elm_transit_effect_color_add(tr2, CU_COL_AO0115D, CU_COL_AO0115); - elm_transit_object_add(tr2, *m_rejBezelCueImg[m_rejBCAnimIndex]); + elm_transit_object_add(tr2, as_eo(*m_rejBezelCueImg[m_rejBCAnimIndex])); elm_transit_duration_set(tr2, impl::BC_ANIMATION_DURATION[m_rejBCAnimIndex]); elm_transit_objects_final_state_keep_set(tr2, EINA_TRUE); @@ -610,7 +621,7 @@ namespace callui { m_accTracerTr = elm_transit_add(); elm_transit_effect_zoom_add(m_accTracerTr, impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MID); - elm_transit_object_add(m_accTracerTr, *m_accTracer); + elm_transit_object_add(m_accTracerTr, as_eo(*m_accTracer)); elm_transit_duration_set(m_accTracerTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_accTracerTr, EINA_FALSE); elm_transit_del_cb_set(m_accTracerTr, @@ -625,7 +636,7 @@ namespace callui { m_accGuideTr = elm_transit_add(); elm_transit_effect_zoom_add(m_accGuideTr, impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MAX); - elm_transit_object_add(m_accGuideTr, *m_accGuide); + elm_transit_object_add(m_accGuideTr, as_eo(*m_accGuide)); elm_transit_duration_set(m_accGuideTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_accGuideTr, EINA_FALSE); elm_transit_del_cb_set(m_accGuideTr, @@ -639,7 +650,7 @@ namespace callui { DEL_TRANSIT(m_accIconTr); m_accIconTr = elm_transit_add(); elm_transit_effect_color_add(m_accIconTr, CU_COL_AO0113, CU_COL_WHITE); - elm_transit_object_add(m_accIconTr, *m_accIcon); + elm_transit_object_add(m_accIconTr, as_eo(*m_accIcon)); elm_transit_duration_set(m_accIconTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_accIconTr, EINA_TRUE); elm_transit_del_cb_set(m_accIconTr, @@ -654,17 +665,29 @@ namespace callui { Evas_Coord x; m_rejIcon->getGeometry(&x, nullptr, nullptr, nullptr); - int dx = x - impl::REJ_ICON_RIGHT_PAD_X; - int animTrace = impl::ACC_REJ_ICON_HIDE_THRESHOLD_W - dx; - if (animTrace <= 0) { - DLOG("No need to add transition"); - return; + // RTL support + int dx = 0; + int animTrace = 0; + if (utils::getMirroredMode()) { + dx = impl::ACC_ICON_RIGHT_PAD_X - x; + animTrace = dx - impl::ACC_REJ_ICON_HIDE_THRESHOLD_W; + if (animTrace >= 0) { + DLOG("No need to add transition"); + return; + } + } else { + dx = x - impl::REJ_ICON_RIGHT_PAD_X; + animTrace = impl::ACC_REJ_ICON_HIDE_THRESHOLD_W - dx; + if (animTrace <= 0) { + DLOG("No need to add transition"); + return; + } } m_rejIconTr = elm_transit_add(); elm_transit_effect_translation_add(m_rejIconTr, 0, 0, animTrace, 0); - elm_transit_object_add(m_rejIconTr, *m_rejIcon); + elm_transit_object_add(m_rejIconTr, as_eo(*m_rejIcon)); elm_transit_duration_set(m_rejIconTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_rejIconTr, EINA_TRUE); elm_transit_del_cb_set(m_rejIconTr, @@ -679,7 +702,7 @@ namespace callui { m_accTracerTr = elm_transit_add(); elm_transit_effect_zoom_add(m_accTracerTr, impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MAX); - elm_transit_object_add(m_accTracerTr, *m_accTracer); + elm_transit_object_add(m_accTracerTr, as_eo(*m_accTracer)); elm_transit_duration_set(m_accTracerTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_accTracerTr, EINA_FALSE); elm_transit_del_cb_set(m_accTracerTr, @@ -687,7 +710,6 @@ namespace callui { onAcceptFullExpensionTransitDel), this); elm_transit_go(m_accTracerTr); - } void AcceptRejectWidget::setAcceptGuideUnpressedTransition() @@ -696,7 +718,7 @@ namespace callui { m_accGuideTr = elm_transit_add(); elm_transit_effect_zoom_add(m_accGuideTr, impl::ICON_ZOOM_EFF_VAL_MAX, impl::ICON_ZOOM_EFF_VAL_MIN); - elm_transit_object_add(m_accGuideTr, *m_accGuide); + elm_transit_object_add(m_accGuideTr, as_eo(*m_accGuide)); elm_transit_duration_set(m_accGuideTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_accGuideTr, EINA_FALSE); elm_transit_del_cb_set(m_accGuideTr, @@ -711,16 +733,27 @@ namespace callui { Evas_Coord x; m_rejIcon->getGeometry(&x, nullptr, nullptr, nullptr); - int dx = impl::REJ_ICON_RIGHT_PAD_X - x; - if (dx >= 0) { - DLOG("No need to add transition"); - return; + + // RTL support + int dx = 0; + if (utils::getMirroredMode()) { + dx = impl::ACC_ICON_RIGHT_PAD_X - x; + if (dx <= 0) { + DLOG("No need to add transition"); + return; + } + } else { + dx = impl::REJ_ICON_RIGHT_PAD_X - x; + if (dx >= 0) { + DLOG("No need to add transition"); + return; + } } m_rejIconTr = elm_transit_add(); elm_transit_effect_translation_add(m_rejIconTr, 0, 0, dx, 0); - elm_transit_object_add(m_rejIconTr, *m_rejIcon); + elm_transit_object_add(m_rejIconTr, as_eo(*m_rejIcon)); elm_transit_duration_set(m_rejIconTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_rejIconTr, EINA_TRUE); elm_transit_del_cb_set(m_rejIconTr, @@ -751,7 +784,7 @@ namespace callui { m_rejTracerTr = elm_transit_add(); elm_transit_effect_zoom_add(m_rejTracerTr, impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MID); - elm_transit_object_add(m_rejTracerTr, *m_rejTracer); + elm_transit_object_add(m_rejTracerTr, as_eo(*m_rejTracer)); elm_transit_duration_set(m_rejTracerTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_rejTracerTr, EINA_FALSE); elm_transit_del_cb_set(m_rejTracerTr, @@ -766,7 +799,7 @@ namespace callui { m_rejGuideTr = elm_transit_add(); elm_transit_effect_zoom_add(m_rejGuideTr, impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MAX); - elm_transit_object_add(m_rejGuideTr, *m_rejGuide); + elm_transit_object_add(m_rejGuideTr, as_eo(*m_rejGuide)); elm_transit_duration_set(m_rejGuideTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_rejGuideTr, EINA_FALSE); elm_transit_del_cb_set(m_rejGuideTr, @@ -780,7 +813,7 @@ namespace callui { DEL_TRANSIT(m_rejIconTr); m_rejIconTr = elm_transit_add(); elm_transit_effect_color_add(m_rejIconTr, CU_COL_AO0115, CU_COL_WHITE); - elm_transit_object_add(m_rejIconTr, *m_rejIcon); + elm_transit_object_add(m_rejIconTr, as_eo(*m_rejIcon)); elm_transit_duration_set(m_rejIconTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_rejIconTr, EINA_TRUE); elm_transit_del_cb_set(m_rejIconTr, @@ -795,16 +828,29 @@ namespace callui { Evas_Coord x; m_accIcon->getGeometry(&x, nullptr, nullptr, nullptr); - int dx = impl::ACC_ICON_RIGHT_PAD_X - x; - int animTrace = dx - impl::ACC_REJ_ICON_HIDE_THRESHOLD_W; - if (animTrace >= 0) { - DLOG("No need to add transition"); - return; + // RTL support + int dx = 0; + int animTrace = 0; + if (utils::getMirroredMode()) { + dx = x - impl::REJ_ICON_RIGHT_PAD_X; + animTrace = impl::ACC_REJ_ICON_HIDE_THRESHOLD_W - dx; + if (animTrace <= 0) { + DLOG("No need to add transition"); + return; + } + } else { + dx = impl::ACC_ICON_RIGHT_PAD_X - x; + animTrace = dx - impl::ACC_REJ_ICON_HIDE_THRESHOLD_W; + if (animTrace >= 0) { + DLOG("No need to add transition"); + return; + } } + m_accIconTr = elm_transit_add(); elm_transit_effect_translation_add(m_accIconTr, 0, 0, animTrace, 0); - elm_transit_object_add(m_accIconTr, *m_accIcon); + elm_transit_object_add(m_accIconTr, as_eo(*m_accIcon)); elm_transit_duration_set(m_accIconTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_accIconTr, EINA_TRUE); elm_transit_del_cb_set(m_accIconTr, @@ -819,16 +865,26 @@ namespace callui { Evas_Coord x; m_accIcon->getGeometry(&x, nullptr, nullptr, nullptr); - int dx = impl::ACC_ICON_RIGHT_PAD_X - x; - if (dx <= 0) { - DLOG("No need to add transition"); - return; + // RTL support + int dx = 0; + if (utils::getMirroredMode()) { + dx = impl::REJ_ICON_RIGHT_PAD_X - x; + if (dx >= 0) { + DLOG("No need to add transition"); + return; + } + } else { + dx = impl::ACC_ICON_RIGHT_PAD_X - x; + if (dx <= 0) { + DLOG("No need to add transition"); + return; + } } m_accIconTr = elm_transit_add(); elm_transit_effect_translation_add(m_accIconTr, 0, 0, dx, 0); - elm_transit_object_add(m_accIconTr, *m_accIcon); + elm_transit_object_add(m_accIconTr, as_eo(*m_accIcon)); elm_transit_duration_set(m_accIconTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_accIconTr, EINA_TRUE); elm_transit_del_cb_set(m_accIconTr, @@ -843,7 +899,7 @@ namespace callui { m_rejTracerTr = elm_transit_add(); elm_transit_effect_zoom_add(m_rejTracerTr, impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MAX); - elm_transit_object_add(m_rejTracerTr, *m_rejTracer); + elm_transit_object_add(m_rejTracerTr, as_eo(*m_rejTracer)); elm_transit_duration_set(m_rejTracerTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_rejTracerTr, EINA_FALSE); elm_transit_del_cb_set(m_rejTracerTr, @@ -865,7 +921,7 @@ namespace callui { m_rejGuideTr = elm_transit_add(); elm_transit_effect_zoom_add(m_rejGuideTr, impl::ICON_ZOOM_EFF_VAL_MAX, impl::ICON_ZOOM_EFF_VAL_MIN); - elm_transit_object_add(m_rejGuideTr, *m_rejGuide); + elm_transit_object_add(m_rejGuideTr, as_eo(*m_rejGuide)); elm_transit_duration_set(m_rejGuideTr, impl::ROTARY_ACTION_ANIM_DUR); elm_transit_objects_final_state_keep_set(m_rejGuideTr, EINA_FALSE); elm_transit_del_cb_set(m_rejGuideTr, @@ -881,7 +937,7 @@ namespace callui { m_accBezelCueImg[i] = impl::createImage(*m_layout, impl::ACCEPT_BC_PARAMS[i].theme); if (!m_accBezelCueImg[i]) { - LOG_RETURN(RES_FAIL, "Create bezel cue image failed"); + LOG_RETURN(RES_FAIL, "Create bezel cue image failed!"); } m_accBezelCueImg[i]->setColor(CU_COL_AO0113T); show(*m_accBezelCueImg[i]); @@ -892,7 +948,7 @@ namespace callui { m_rejBezelCueImg[i] = impl::createImage(*m_layout, impl::REJECT_BC_PARAMS[i].theme); if (!m_rejBezelCueImg[i]) { - LOG_RETURN(RES_FAIL, "Create bezel cue image failed"); + LOG_RETURN(RES_FAIL, "Create bezel cue image failed!"); } m_rejBezelCueImg[i]->setColor(CU_COL_AO0113T); show(*m_rejBezelCueImg[i]); @@ -932,8 +988,8 @@ namespace callui { m_isFreezed = true; impl::resizeImage(*m_accTracer, impl::FINGER_STROKE_DIM); - if (m_accHandler) { - m_accHandler(); + if (const auto handler = m_accHandler.lock()) { + handler(); } } @@ -979,10 +1035,9 @@ namespace callui { m_isFreezed = true; impl::resizeImage(*m_rejTracer, impl::FINGER_STROKE_DIM); - if (m_rejHandler) { - m_rejHandler(); + if (const auto handler = m_rejHandler.lock()) { + handler(); } - } void AcceptRejectWidget::onRejectBgExpandTransitDel(Elm_Transit *transit) @@ -1017,7 +1072,8 @@ namespace callui { if (m_accBCAnimIndex == 0) { Elm_Transit *tr1 = elm_transit_add(); elm_transit_effect_color_add(tr1, CU_COL_AO0113, CU_COL_AO0113D); - elm_transit_object_add(tr1, *m_accBezelCueImg[m_accBCAnimIndex]); + elm_transit_object_add(tr1, + as_eo(*m_accBezelCueImg[m_accBCAnimIndex])); elm_transit_duration_set(tr1, impl::BC_ANIMATION_DURATION[impl::BC_ITEM_COUNT - 1]); elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE); @@ -1036,7 +1092,7 @@ namespace callui { Elm_Transit *tr1 = elm_transit_add(); elm_transit_effect_color_add(tr1, CU_COL_AO0113, CU_COL_AO0113D); - elm_transit_object_add(tr1, *m_accBezelCueImg[oldIndex]); + elm_transit_object_add(tr1, as_eo(*m_accBezelCueImg[oldIndex])); elm_transit_duration_set(tr1, impl::BC_ANIMATION_DURATION[m_accBCAnimIndex]); elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE); @@ -1044,7 +1100,7 @@ namespace callui { Elm_Transit *tr2 = elm_transit_add(); elm_transit_effect_color_add(tr2, CU_COL_AO0113D, CU_COL_AO0113); - elm_transit_object_add(tr2, *m_accBezelCueImg[m_accBCAnimIndex]); + elm_transit_object_add(tr2, as_eo(*m_accBezelCueImg[m_accBCAnimIndex])); elm_transit_duration_set(tr2, impl::BC_ANIMATION_DURATION[m_accBCAnimIndex]); elm_transit_objects_final_state_keep_set(tr2, EINA_TRUE); @@ -1070,7 +1126,8 @@ namespace callui { CU_COL_AO0113D, CU_COL_AO0113T); for (int i = 0; i < impl::BC_ITEM_COUNT; i++) { m_accBezelCueImg[i]->setColor(CU_COL_AO0113D); - elm_transit_object_add(hideTransit, *m_accBezelCueImg[i]); + elm_transit_object_add(hideTransit, + as_eo(*m_accBezelCueImg[i])); } elm_transit_duration_set(hideTransit, impl::BC_ANIM_DUR_HIDE); elm_transit_objects_final_state_keep_set(hideTransit, EINA_TRUE); @@ -1091,7 +1148,7 @@ namespace callui { m_accBCAnimIndex = impl::BC_ITEM_COUNT - 1; Elm_Transit *tr1 = elm_transit_add(); elm_transit_effect_color_add(tr1, CU_COL_AO0113D, CU_COL_AO0113); - elm_transit_object_add(tr1, *m_accBezelCueImg[m_accBCAnimIndex]); + elm_transit_object_add(tr1, as_eo(*m_accBezelCueImg[m_accBCAnimIndex])); elm_transit_duration_set(tr1, impl::BC_ANIMATION_DURATION[m_accBCAnimIndex]); elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE); @@ -1109,7 +1166,8 @@ namespace callui { if (m_rejBCAnimIndex == 0) { Elm_Transit *tr1 = elm_transit_add(); elm_transit_effect_color_add(tr1, CU_COL_AO0115, CU_COL_AO0115D); - elm_transit_object_add(tr1, *m_rejBezelCueImg[m_rejBCAnimIndex]); + elm_transit_object_add(tr1, + as_eo(*m_rejBezelCueImg[m_rejBCAnimIndex])); elm_transit_duration_set(tr1, impl::BC_ANIMATION_DURATION[impl::BC_ITEM_COUNT - 1]); elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE); @@ -1127,7 +1185,7 @@ namespace callui { Elm_Transit *tr1 = elm_transit_add(); elm_transit_effect_color_add(tr1, CU_COL_AO0115, CU_COL_AO0115D); - elm_transit_object_add(tr1, *m_rejBezelCueImg[oldIndex]); + elm_transit_object_add(tr1, as_eo(*m_rejBezelCueImg[oldIndex])); elm_transit_duration_set(tr1, impl::BC_ANIMATION_DURATION[m_rejBCAnimIndex]); elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE); @@ -1135,7 +1193,7 @@ namespace callui { Elm_Transit *tr2 = elm_transit_add(); elm_transit_effect_color_add(tr2, CU_COL_AO0115D, CU_COL_AO0115); - elm_transit_object_add(tr2, *m_rejBezelCueImg[m_rejBCAnimIndex]); + elm_transit_object_add(tr2, as_eo(*m_rejBezelCueImg[m_rejBCAnimIndex])); elm_transit_duration_set(tr2, impl::BC_ANIMATION_DURATION[m_rejBCAnimIndex]); elm_transit_objects_final_state_keep_set(tr2, EINA_TRUE); @@ -1161,7 +1219,8 @@ namespace callui { CU_COL_AO0115D, CU_COL_AO0115T); for (int i = 0; i < impl::BC_ITEM_COUNT; i++) { m_rejBezelCueImg[i]->setColor(CU_COL_AO0115D); - elm_transit_object_add(hideTransit, *m_rejBezelCueImg[i]); + elm_transit_object_add(hideTransit, + as_eo(*m_rejBezelCueImg[i])); } elm_transit_duration_set(hideTransit, impl::BC_ANIM_DUR_HIDE); elm_transit_objects_final_state_keep_set(hideTransit, EINA_TRUE); @@ -1182,7 +1241,7 @@ namespace callui { m_rejBCAnimIndex = impl::BC_ITEM_COUNT - 1; Elm_Transit *tr1 = elm_transit_add(); elm_transit_effect_color_add(tr1, CU_COL_AO0115D, CU_COL_AO0115); - elm_transit_object_add(tr1, *m_rejBezelCueImg[m_rejBCAnimIndex]); + elm_transit_object_add(tr1, as_eo(*m_rejBezelCueImg[m_rejBCAnimIndex])); elm_transit_duration_set(tr1, impl::BC_ANIMATION_DURATION[m_rejBCAnimIndex]); elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE); @@ -1197,25 +1256,37 @@ namespace callui { void AcceptRejectWidget::onAcceptExpandTimeout(Timeout *sender) { - if (m_rotaryClockwiseCount > 0) { - m_rotaryClockwiseCount = 0; + int *counter = &m_rotaryClockwiseCount; + if (utils::getMirroredMode()) { + counter = &m_rotaryCounterClockwiseCount; + } + + if (*counter > 0) { + *counter = 0; m_isContracting = true; setAcceptUnpressedState(); } else { - DLOG("Counter is 0. Ignored"); + DLOG("Ignored. Counter is 0"); } + m_expandTimeout.reset(); } void AcceptRejectWidget::onRejectExpandTimeout(Timeout *sender) { - if (m_rotaryCounterClockwiseCount > 0) { - m_rotaryCounterClockwiseCount = 0; + int *counter = &m_rotaryCounterClockwiseCount; + if (utils::getMirroredMode()) { + counter = &m_rotaryClockwiseCount; + } + + if (*counter > 0) { + *counter = 0; m_isContracting = true; setRejectUnpressedState(); } else { - DLOG("Counter is 0. Ignored"); + DLOG("Ignored. Counter is 0"); } + m_expandTimeout.reset(); } @@ -1223,52 +1294,83 @@ namespace callui { { if (m_rotaryCounterClockwiseCount > 0) { m_rotaryCounterClockwiseCount = 0; - setRejectUnpressedState(); + if (utils::getMirroredMode()) { + setRejectUnpressedState(); + } else { + setAcceptUnpressedState(); + } return EINA_TRUE; } m_rotaryClockwiseCount++; if (m_rotaryClockwiseCount == 1) { - setAcceptPressedState(); - m_expandTimeout = Timeout::create(impl::EXPAND_WAITING_TIMEOUT, - WEAK_DELEGATE(AcceptRejectWidget::onAcceptExpandTimeout, - asWeak(*this))); + return processFirstRotaryEvent(true); } else if (m_rotaryClockwiseCount == 2) { - m_expandTimeout.reset(); - impl::resizeImage(*m_accTracer, impl::FINGER_TRACER_DIM); - setAcceptFullExpensionTransition(); - return EINA_TRUE; - } else { - LOG_RETURN_VALUE(RES_FAIL, EINA_TRUE, "Illegal state"); + return processSecondRotaryEvent(true); } - return EINA_TRUE; + + LOG_RETURN_VALUE(RES_FAIL, EINA_TRUE, "Illegal state"); } Eina_Bool AcceptRejectWidget::processCounterClockwiseRotaryEvent() { if (m_rotaryClockwiseCount > 0) { m_rotaryClockwiseCount = 0; - setAcceptUnpressedState(); + if (utils::getMirroredMode()) { + setAcceptUnpressedState(); + } else { + setRejectUnpressedState(); + } return EINA_TRUE; } - m_rotaryCounterClockwiseCount ++; + m_rotaryCounterClockwiseCount++; if (m_rotaryCounterClockwiseCount == 1) { + return processFirstRotaryEvent(false); + } else if (m_rotaryCounterClockwiseCount == 2) { + return processSecondRotaryEvent(false); + } + + LOG_RETURN_VALUE(RES_FAIL, EINA_TRUE, "Illegal state"); + } + + Eina_Bool AcceptRejectWidget::processFirstRotaryEvent(bool isClockwise) + { + bool isMirroredMode = utils::getMirroredMode(); + + if ((isClockwise && !isMirroredMode) || + (!isClockwise && isMirroredMode)) { + setAcceptPressedState(); + m_expandTimeout = Timeout::create(impl::EXPAND_WAITING_TIMEOUT, + WEAK_DELEGATE_THIS(onAcceptExpandTimeout)); + } else if ((!isClockwise && !isMirroredMode) || + (isClockwise && isMirroredMode)) { setRejectPressedState(); m_expandTimeout = Timeout::create(impl::EXPAND_WAITING_TIMEOUT, - WEAK_DELEGATE(AcceptRejectWidget::onRejectExpandTimeout, - asWeak(*this))); + WEAK_DELEGATE_THIS(onRejectExpandTimeout)); + } - } else if (m_rotaryCounterClockwiseCount == 2) { - m_expandTimeout.reset(); + return EINA_TRUE; + } + + Eina_Bool AcceptRejectWidget::processSecondRotaryEvent(bool isClockwise) + { + bool isMirroredMode = utils::getMirroredMode(); + + m_expandTimeout.reset(); + + if ((isClockwise && !isMirroredMode) || + (!isClockwise && isMirroredMode)) { + impl::resizeImage(*m_accTracer, impl::FINGER_TRACER_DIM); + setAcceptFullExpensionTransition(); + } else if ((!isClockwise && !isMirroredMode) || + (isClockwise && isMirroredMode)) { impl::resizeImage(*m_rejTracer, impl::FINGER_TRACER_DIM); setRejectFullExpensionTransition(); - return EINA_TRUE; - } else { - LOG_RETURN_VALUE(RES_FAIL, EINA_TRUE, "Illegal state"); } + return EINA_TRUE; } @@ -1288,7 +1390,7 @@ namespace callui { m_expandTimeout.reset(); if (m_isContracting) { - DLOG("Contracting. Ignore"); + DLOG("Ignored. Contracting state"); return EINA_TRUE; } @@ -1303,11 +1405,11 @@ namespace callui { void AcceptRejectWidget::activateRotary() { - eext_rotary_object_event_activated_set(*m_layout, EINA_TRUE); + eext_rotary_object_event_activated_set(as_eo(*m_layout), EINA_TRUE); } void AcceptRejectWidget::deactivateRotary() { - eext_rotary_object_event_activated_set(*m_layout, EINA_FALSE); + eext_rotary_object_event_activated_set(as_eo(*m_layout), EINA_FALSE); } void AcceptRejectWidget::setAcceptBtnType(AcceptButtonType type) @@ -1316,6 +1418,8 @@ namespace callui { DLOG("Accept icon type is already set"); } + m_acceptBtnType = type; + if (!m_accIcon) { return; } @@ -1396,4 +1500,48 @@ namespace callui { setRejectUnpressedTransitions(); } + + ElmWidget *AcceptRejectWidget::getAcceptAo() + { + return m_accAo.get(); + } + + ElmWidget *AcceptRejectWidget::getRejectAo() + { + return m_rejAo.get(); + } + + Result AcceptRejectWidget::registerAccessObjects(ElmWidget &parent) + { + m_accAo = utils::createAccessObject(parent, *m_accEventLy); + if (!m_accAo) { + LOG_RETURN(RES_FAIL, "createAccessObject() failed!"); + } + auto &acceptAtspi = m_accAo->getAtspi(); + acceptAtspi.setTDomain(TEXT_DOMAIN); + acceptAtspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | + ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); + acceptAtspi.setName(AO_STR_ACCEPT_CALL); + acceptAtspi.setDescription( + AO_STR_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT); + acceptAtspi.addAttribute(impl::ATSPI_ATTRIBUTE_KEY, + impl::ATSPI_ATTRIBUTE_VALUE); + + m_rejAo = utils::createAccessObject(parent, *m_rejEventLy); + if (!m_rejAo) { + LOG_RETURN(RES_FAIL, "createAccessObject() failed!"); + } + auto &rejectAtspi = m_rejAo->getAtspi(); + rejectAtspi.setTDomain(TEXT_DOMAIN); + rejectAtspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | + ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); + rejectAtspi.setName(AO_STR_REJECT_CALL); + rejectAtspi.setDescription( + AO_STR_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT); + rejectAtspi.addAttribute(impl::ATSPI_ATTRIBUTE_KEY, + impl::ATSPI_ATTRIBUTE_VALUE); + + return RES_OK; + } + } diff --git a/inc/view/AcceptRejectWidget.h b/call-ui/view/AcceptRejectWidget.h index bd7865b..76cbbe2 100644 --- a/inc/view/AcceptRejectWidget.h +++ b/call-ui/view/AcceptRejectWidget.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __CALLUI_VIEW_ACCEPT_REJECT_WIDGET_H__ -#define __CALLUI_VIEW_ACCEPT_REJECT_WIDGET_H__ +#ifndef __CALL_UI_VIEW_ACCEPT_REJECT_WIDGET_H__ +#define __CALL_UI_VIEW_ACCEPT_REJECT_WIDGET_H__ #include "ucl/gui/ElmWidget.h" @@ -27,14 +27,52 @@ namespace callui { + UCL_DECLARE_REF_ALIASES(AcceptRejectWidget); + + /** + * @brief Widget for accept / reject calls + */ class AcceptRejectWidget final : public ucl::ElmWidget { public: + + /** + * @brief Builder builder + */ class Builder { public: + + /** + * @brief Constructor + */ Builder(); - Builder &setAcceptEventHandler(const NotiHandler &handler); - Builder &setRejectEventHandler(const NotiHandler &handler); + + /** + * @brief Sets accept event handler + * @param[in] handler Accept event handler + * @return Reference to builder + */ + Builder &setAcceptEventHandler(NotiHandler handler); + + /** + * @brief Sets reject event handler + * @param[in] handler Reject event handler + * @return Reference to builder + */ + Builder &setRejectEventHandler(NotiHandler handler); + + /** + * @brief Sets Accept button type + * @param[in] type Accept button type + * @return Reference to builder + */ Builder &setAcceptBtnType(AcceptButtonType type); + + /** + * @brief Creates new instance of AcceptRejectWidget + * @param[in] parent Parent widget + * @return Shared reference to AcceptRejectWidget instance + * on success or NULL otherwise + */ AcceptRejectWidgetSRef build(ucl::ElmWidget &parent) const; private: @@ -44,20 +82,57 @@ namespace callui { }; public: - ~AcceptRejectWidget(); + /** + * @brief Destructor + */ + virtual ~AcceptRejectWidget(); + + /** + * @brief Starts Bezel Cue animation + */ void startBezelCueAnimation(); + + /** + * @brief Resets widget to default state + */ void reset(); + + /** + * @brief Activates rotary to accept rotary events + */ void activateRotary(); + + /** + * @brief Deactivates rotary to not accept rotary events + */ void deactivateRotary(); + + /** + * @brief Sets Accept button type + * @param[in] type Accept button type + */ void setAcceptBtnType(AcceptButtonType type); + /** + * @brief Gets Access object of Accept button + * @remark Use only for Screen Reader feature + * @return Pointer to widget on success or NULL otherwise + */ + ucl::ElmWidget *getAcceptAo(); + + /** + * @brief Gets Access object of Reject button + * @remark Use only for Screen Reader feature + * @return Pointer to widget on success or NULL otherwise + */ + ucl::ElmWidget *getRejectAo(); + private: - friend class ucl::ReffedObj<AcceptRejectWidget>; AcceptRejectWidget(ucl::IRefCountObj &rc, const ucl::LayoutSRef &layout, - const NotiHandler &acceptHandler, - const NotiHandler &rejectHandler, + NotiHandler acceptHandler, + NotiHandler rejectHandler, AcceptButtonType acceptBtnType); void prepare(); @@ -119,16 +194,22 @@ namespace callui { Eina_Bool onRotaryEvent(Evas_Object *obj, Eext_Rotary_Event_Info *info); Eina_Bool processClockwiseRotaryEvent(); Eina_Bool processCounterClockwiseRotaryEvent(); + Eina_Bool processFirstRotaryEvent(bool isClockwise); + Eina_Bool processSecondRotaryEvent(bool isClockwise); void setAcceptPressedState(); void setRejectPressedState(); void setAcceptUnpressedState(); void setRejectUnpressedState(); + ucl::Result registerAccessObjects( + ucl::ElmWidget &widget); + private: + const NotiHandler m_accHandler; + const NotiHandler m_rejHandler; + ucl::Layout *m_layout; - NotiHandler m_accHandler; - NotiHandler m_rejHandler; std::vector<ucl::ElmWidgetSRef> m_accBezelCueImg; std::vector<ucl::ElmWidgetSRef> m_rejBezelCueImg; @@ -173,8 +254,13 @@ namespace callui { int m_rejBCAnimIndex; AcceptButtonType m_acceptBtnType; + + ucl::ElmWidgetSRef m_accAo; + ucl::ElmWidgetSRef m_rejAo; + + friend class ucl::ReffedObj<AcceptRejectWidget>; }; } -#endif // __CALLUI_VIEW_ACCEPT_REJECT_WIDGET_H__ +#endif // __CALL_UI_VIEW_ACCEPT_REJECT_WIDGET_H__ diff --git a/call-ui/view/AoSequencer.cpp b/call-ui/view/AoSequencer.cpp new file mode 100644 index 0000000..d851351 --- /dev/null +++ b/call-ui/view/AoSequencer.cpp @@ -0,0 +1,82 @@ +/* + * 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 "AoSequencer.h" + +#include "common.h" + +namespace callui { + + AoSequencer::AoSequencer( + const Elm_Interface_Atspi_Accessible *const current, + const Elm_Atspi_Relation_Type flowRelation) : + m_current(current), + m_flowRelation(flowRelation), + + m_last(nullptr), + m_next(nullptr), + + m_isNextSet(false), + m_isCurrentFound(false), + m_isComplete(false) + { + } + + void AoSequencer::doProcessAo( + const Elm_Interface_Atspi_Accessible *const itemAo) + { + switch (m_flowRelation) { + case ELM_ATSPI_RELATION_FLOWS_TO: + + if (itemAo == m_current) { + setNext(itemAo); + m_isCurrentFound = true; + return; + } + if (m_isCurrentFound) { + setNext(itemAo); + m_isComplete = true; + return; + } + break; + + case ELM_ATSPI_RELATION_FLOWS_FROM: + + if (itemAo == m_current) { + setNext(m_isNextSet ? m_last : itemAo); + m_isComplete = true; + return; + } + m_last = itemAo; + break; + + default: + WLOG("Unknown: %d", m_flowRelation); + break; + } + + if (!m_isNextSet) { + setNext(itemAo); + } + } + + void AoSequencer::setNext( + const Elm_Interface_Atspi_Accessible *const itemAo) + { + m_next = itemAo; + m_isNextSet = true; + } +} diff --git a/call-ui/view/AoSequencer.h b/call-ui/view/AoSequencer.h new file mode 100644 index 0000000..b1ba65c --- /dev/null +++ b/call-ui/view/AoSequencer.h @@ -0,0 +1,105 @@ +/* + * 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_VIEW_AO_SEQUENCER_H__ +#define __CALL_UI_VIEW_AO_SEQUENCER_H__ + +#include "ucl/gui/Atspi.h" + +#include "types.h" + +namespace callui { + + /** + * @brief Finds next object in the Access objects highlight flow sequence + */ + class AoSequencer final : private ucl::NonCopyable { + public: + /** + * @brief Constructor + * @param[in] current Currently focused Access object + * @param[in] flowRelation Flow relation for finding next Access object + */ + AoSequencer(const Elm_Interface_Atspi_Accessible *current, + Elm_Atspi_Relation_Type flowRelation); + + /** + * @brief Denotes break in sequence for allowing system default flow + * @return Reference to AoSequencer object + */ + AoSequencer &processDefault(); + + /** + * @brief Passes next object in flow sequence + * @param[in] item Item in highlight flow sequence. Any object for which + * as_ao() function may be called. NULL is ignored. + * @return Reference to AoSequencer object + */ + template <class ITEM> + AoSequencer &process(const ITEM &item); + + /** + * @brief Passes next object list in flow sequence + * @param[in] items Item list in highlight flow sequence. + * @return Reference to AoSequencer object + */ + template <class ITEMS> + AoSequencer &processEach(const ITEMS &items); + + /** + * @brief Passes next object range in flow sequence + * @param[in] begin Begin iterator of the range + * @param[in] end End iterator of the range + * @return Reference to AoSequencer object + */ + template <class ITERATOR> + AoSequencer &processEach(ITERATOR begin, ITERATOR end); + + /** + * @brief Gets next Acces object in highlight flow sequence + * @details Result is base on constructor parameters and processed + * sequence. Result may change during processing. + * If current object was not found in the processed sequence + * first object from the sequence is returned. If it is not + * possible to get next object (current is already last) then + * current object is returned. NULL is returned for default + * processing. + * @return Next access object in highlight flow sequence + */ + const Elm_Interface_Atspi_Accessible *getNext(); + + private: + template <class ITEM> + void doProcess(const ITEM &item); + void doProcessAo(const Elm_Interface_Atspi_Accessible *itemAo); + void setNext(const Elm_Interface_Atspi_Accessible *itemAo); + + private: + const Elm_Interface_Atspi_Accessible *const m_current; + const Elm_Atspi_Relation_Type m_flowRelation; + + const Elm_Interface_Atspi_Accessible *m_last; + const Elm_Interface_Atspi_Accessible *m_next; + + bool m_isNextSet; + bool m_isCurrentFound; + bool m_isComplete; + }; +} + +#include "AoSequencer.hpp" + +#endif // __CALL_UI_VIEW_AO_SEQUENCER_H__ diff --git a/call-ui/view/AoSequencer.hpp b/call-ui/view/AoSequencer.hpp new file mode 100644 index 0000000..462fe0a --- /dev/null +++ b/call-ui/view/AoSequencer.hpp @@ -0,0 +1,78 @@ +/* + * 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. + */ + +namespace callui { + + inline AoSequencer &AoSequencer::processDefault() + { + if (!m_isComplete) { + doProcessAo(nullptr); + } + return *this; + } + + template <class ITEM> + inline AoSequencer &AoSequencer::process(const ITEM &item) + { + if (!m_isComplete) { + doProcess(item); + } + return *this; + } + + template <class ITEMS> + inline AoSequencer &AoSequencer::processEach(const ITEMS &items) + { + if (!m_isComplete) { + for (const auto &item: items) { + doProcess(item); + if (m_isComplete) { + break; + } + } + } + return *this; + } + + template <class ITERATOR> + inline AoSequencer &AoSequencer::processEach( + const ITERATOR begin, const ITERATOR end) + { + if (!m_isComplete) { + for (auto it = begin; it != end; ++it) { + doProcess(*it); + if (m_isComplete) { + break; + } + } + } + return *this; + } + + inline const Elm_Interface_Atspi_Accessible *AoSequencer::getNext() + { + return m_next; + } + + template <class ITEM> + inline void AoSequencer::doProcess(const ITEM &item) + { + using ucl::as_ao; + if (const auto itemAo = as_ao(item)) { + doProcessAo(itemAo); + } + } +} diff --git a/src/view/Slider.cpp b/call-ui/view/Slider.cpp index 9e22cd6..2285f68 100644 --- a/src/view/Slider.cpp +++ b/call-ui/view/Slider.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "view/Slider.h" +#include "call-ui/view/Slider.h" #include "common.h" @@ -34,7 +34,7 @@ namespace callui { Slider::Builder::Builder(): m_maxValue(0), - m_curValue(0) + m_value(0) { } @@ -44,9 +44,9 @@ namespace callui { return *this; } - Slider::Builder &Slider::Builder::setValue(int curValue) + Slider::Builder &Slider::Builder::setValue(int value) { - m_curValue = curValue; + m_value = value; return *this; } @@ -54,13 +54,12 @@ namespace callui { { auto layout = Layout::Builder(). setTheme(impl::LAYOUT_SLIDER). - setIsOwner(true). build(parent); if (!layout) { LOG_RETURN_VALUE(RES_FAIL, {}, "Layout::build() failed!"); } - auto result = makeShared<Slider>(layout, m_maxValue, m_curValue); + auto result = makeShared<Slider>(layout, m_maxValue, m_value); result->bindToEo(); @@ -71,27 +70,22 @@ namespace callui { const LayoutSRef &layout, int maxValue, int curValue): - ElmWidget(&rc, *layout, true), + ElmWidget(&rc, as_eo(*layout), false), m_layout(layout.get()), - m_circleLy(elm_layout_add(*m_layout)), - m_circleSurf(eext_circle_surface_layout_add(m_circleLy)), - m_slider(eext_circle_object_slider_add(*m_layout, m_circleSurf)) + m_circleLy(elm_layout_add(as_eo(*m_layout))), + m_circleSurf(eext_circle_surface_layout_add(as_eo(m_circleLy))), + m_slider(eext_circle_object_slider_add(as_eo(*m_layout), + m_circleSurf)) { prepare(maxValue, curValue); } - Slider::~Slider() - { - } - void Slider::prepare(int maxValue, int curValue) { m_layout->setIsOwner(false); - evas_object_size_hint_align_set(m_slider, - EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(m_slider, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + m_slider.setAlign(EVAS_HINT_FILL, EVAS_HINT_FILL); + m_slider.setWeight(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); m_layout->setContent(m_circleLy, impl::PART_SWL_SLIDER); show(m_circleLy); @@ -100,15 +94,21 @@ namespace callui { setMaxValue(maxValue); setValue(curValue); + + // Screen Reader + m_slider.getAtspi().setRole(ELM_ATSPI_ROLE_REDUNDANT_OBJECT); + m_circleLy.getAtspi().setRole(ELM_ATSPI_ROLE_REDUNDANT_OBJECT); + m_layout->getAtspi().setRole(ELM_ATSPI_ROLE_REDUNDANT_OBJECT); } void Slider::setValue(int value) { - eext_circle_object_value_set(m_slider, static_cast<double>(value)); + eext_circle_object_value_set(as_eo(m_slider), + static_cast<double>(value)); } void Slider::setMaxValue(int maxValue) { - eext_circle_object_value_min_max_set(m_slider, 0, maxValue); + eext_circle_object_value_min_max_set(as_eo(m_slider), 0, maxValue); } } diff --git a/inc/view/Slider.h b/call-ui/view/Slider.h index 58ef7cc..7e48de4 100644 --- a/inc/view/Slider.h +++ b/call-ui/view/Slider.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __CALLUI_VIEW_SLIDER_H__ -#define __CALLUI_VIEW_SLIDER_H__ +#ifndef __CALL_UI_VIEW_SLIDER_H__ +#define __CALL_UI_VIEW_SLIDER_H__ #include "ucl/gui/Layout.h" @@ -23,31 +23,75 @@ namespace callui { + UCL_DECLARE_REF_ALIASES(Slider); + + /** + * @brief Slider widget + */ class Slider : public ucl::ElmWidget { public: + /** + * @brief Slider builder + */ class Builder { public: + + /** + * @brief Constructor + */ Builder(); + + /** + * @brief Sets max value to display + * @param[in] maxValue Max value to set + * @return Reference to builder + */ Builder &setMaxValue(int maxValue); - Builder &setValue(int curValue); + + /** + * @brief Sets value to display + * @param[in] value Value to set + * @return Reference to builder + */ + Builder &setValue(int value); + + /** + * @brief Creates new instance of Slider + * @param[in] parent Parent widget + * @return Shared reference to Slider instance + * on success or NULL otherwise + */ SliderSRef build(ucl::ElmWidget &parent) const; private: int m_maxValue; - int m_curValue; + int m_value; }; public: + + /** + * @brief Destructor + */ + virtual ~Slider() = default; + + /** + * @brief Sets value to display + * @param[in] value Value to set + */ virtual void setValue(int value); + + /** + * @brief Sets max value to display + * @param[in] maxValue Max value to set + */ virtual void setMaxValue(int maxValue); protected: - friend class ucl::ReffedObj<Slider>; Slider(ucl::IRefCountObj &rc, const ucl::LayoutSRef &layout, int maxValue, int curValue); - virtual ~Slider(); private: void prepare(int maxValue, int curValue); @@ -57,8 +101,10 @@ namespace callui { ucl::Layout m_circleLy; Eext_Circle_Surface *m_circleSurf; ucl::ElmWidget m_slider; + + friend class ucl::ReffedObj<Slider>; }; } -#endif // __CALLUI_VIEW_SLIDER_H__ +#endif // __CALL_UI_VIEW_SLIDER_H__ diff --git a/call-ui/view/VolumeControl.cpp b/call-ui/view/VolumeControl.cpp new file mode 100644 index 0000000..f775e63 --- /dev/null +++ b/call-ui/view/VolumeControl.cpp @@ -0,0 +1,247 @@ +/* + * 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 "call-ui/view/VolumeControl.h" + +#include "call-ui/resources.h" +#include "common.h" + +namespace callui { namespace { namespace impl { + + using namespace ucl; + + constexpr auto DESCRIPTION_BUFF_SIZE = 512; + + constexpr LayoutTheme LAYOUT_VOLUME + {"layout", "callui", "volume_control"}; + + constexpr ElmStyle STYLE_BTN_MINUS {"callui/minus"}; + constexpr ElmStyle STYLE_BTN_PLUS {"callui/plus"}; + + constexpr EdjePart PART_SWL_MINUS {"swl.minus"}; + constexpr EdjePart PART_SWL_PLUS {"swl.plus"}; + + constexpr EdjePart PART_TXT_INFO {"txt.info"}; + constexpr EdjePart PART_TXT_VALUE {"txt.value"}; + constexpr EdjePart PART_TXT_VALUE_AO {"ao_txt.value"}; + +}}} + +namespace callui { + + using namespace ucl; + + VolumeControl::Builder::Builder(): + m_maxValue(0), + m_value(0) + { + } + + VolumeControl::Builder & + VolumeControl::Builder::setInfoText(TString info) + { + m_info = std::move(info); + return *this; + } + + VolumeControl::Builder &VolumeControl::Builder::setMaxValue(int maxValue) + { + m_maxValue = maxValue; + return *this; + } + + VolumeControl::Builder &VolumeControl::Builder::setValue(int value) + { + m_value = value; + return *this; + } + + VolumeControl::Builder &VolumeControl::Builder::setEventHandler( + EventHandler handler) + { + m_handler = std::move(handler); + return *this; + } + + VolumeControlSRef VolumeControl::Builder::build(ElmWidget &parent) const + { + auto layout = Layout::Builder(). + setTheme(impl::LAYOUT_VOLUME). + build(parent); + if (!layout) { + LOG_RETURN_VALUE(RES_FAIL, {}, "Layout::build() failed!"); + } + + auto result = makeShared<VolumeControl>(layout, + m_info, + m_maxValue, + m_value, + m_handler); + + result->bindToEo(); + + return result; + } + + VolumeControl::VolumeControl(IRefCountObj &rc, + const LayoutSRef &layout, + const TString &info, + int maxValue, + int curValue, + EventHandler handler): + Slider(rc, layout, maxValue, curValue), + m_handler(std::move(handler)), + m_decreaseBtn(elm_button_add(as_eo(*m_layout))), + m_increaseBtn(elm_button_add(as_eo(*m_layout))) + { + prepare(info, curValue); + } + + void VolumeControl::prepare(const TString &info, int curValue) + { + m_layout->addEventHandler(WidgetEvent::SHOW, + WEAK_DELEGATE_THIS(onWidgetShowCb)); + m_layout->addEventHandler(WidgetEvent::HIDE, + WEAK_DELEGATE_THIS(onWidgetHideCb)); + + m_decreaseBtn.setStyle(impl::STYLE_BTN_MINUS); + m_decreaseBtn.addEventHandler(BTN_CLICKED, + WEAK_DELEGATE_THIS(onDecreaseBtnClickedCb)); + m_layout->setContent(m_decreaseBtn, impl::PART_SWL_MINUS); + show(m_decreaseBtn); + + m_increaseBtn.setStyle(impl::STYLE_BTN_PLUS); + m_increaseBtn.addEventHandler(BTN_CLICKED, + WEAK_DELEGATE_THIS(onIncreaseBtnClickedCb)); + m_layout->setContent(m_increaseBtn, impl::PART_SWL_PLUS); + show(m_increaseBtn); + + setInfoText(info); + setValue(curValue); + + registerAccessObjectInformation(); + } + + void VolumeControl::onWidgetShowCb(Widget &widget, void *eventInfo) + { + if (m_valueTxtAo) + show(*m_valueTxtAo); + } + + void VolumeControl::onWidgetHideCb(Widget &widget, void *eventInfo) + { + if (m_valueTxtAo) + hide(*m_valueTxtAo); + } + + void VolumeControl::setInfoText(const TString &info) + { + m_layout->setText(info.translate(), impl::PART_TXT_INFO); + } + + void VolumeControl::setValue(int value) + { + eext_circle_object_value_set(as_eo(m_slider), + static_cast<double>(value)); + m_layout->setText(std::to_string(value), impl::PART_TXT_VALUE); + } + + void VolumeControl::setIncreaseBtnEnable(bool isEnable) + { + isEnable ? enable(m_increaseBtn) : disable(m_increaseBtn); + } + + void VolumeControl::setDecreaseBtnEnable(bool isEnable) + { + isEnable ? enable(m_decreaseBtn) : disable(m_decreaseBtn); + } + + void VolumeControl::onDecreaseBtnClickedCb(Widget &widget, void *eventInfo) + { + if (const auto handler = m_handler.lock()) { + handler(Event::DECREASE); + } + } + + void VolumeControl::onIncreaseBtnClickedCb(Widget &widget, void *eventInfo) + { + if (const auto handler = m_handler.lock()) { + handler(Event::INCREASE); + } + } + + ElmWidget &VolumeControl::getDecreaseBtn() + { + return m_decreaseBtn; + } + + ElmWidget &VolumeControl::getIncreaseBtn() + { + return m_increaseBtn; + } + + ElmWidget &VolumeControl::getValueTxtAo() + { + return *m_valueTxtAo; + } + + void VolumeControl::registerAccessObjectInformation() + { + auto &sliderAtspi = m_slider.getAtspi(); + sliderAtspi.setTDomain(TEXT_DOMAIN); + sliderAtspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME + | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); + sliderAtspi.setName(STR_VOLUME); + sliderAtspi.setDescriptionCb( + WEAK_DELEGATE_THIS(onSliderAoDescriptionCb)); + + auto &dereaseAtspi = m_decreaseBtn.getAtspi(); + dereaseAtspi.setTDomain(TEXT_DOMAIN); + dereaseAtspi.setName(AO_STR_DECREASE_VOLUME); + + auto &increaseAtspi = m_increaseBtn.getAtspi(); + increaseAtspi.setTDomain(TEXT_DOMAIN); + increaseAtspi.setName(AO_STR_INCREASE_VOLUME); + + m_valueTxtAo = utils::createAccessObjectFromPart(*m_layout, *m_layout, + impl::PART_TXT_VALUE_AO); + if (!m_valueTxtAo) { + ELOG("createAccessObjectFromPart() failed!"); + } else { + auto &valueTxtAtspi = m_valueTxtAo->getAtspi(); + valueTxtAtspi.setTDomain(TEXT_DOMAIN); + valueTxtAtspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); + valueTxtAtspi.setNameCb(WEAK_DELEGATE_THIS(onValueTextAoNameCb)); + } + + m_layout->getAtspi().setRole(ELM_ATSPI_ROLE_TEXT); + } + + CString VolumeControl::onSliderAoDescriptionCb(Atspi &atspi) + { + char buff[impl::DESCRIPTION_BUFF_SIZE] = { 0 }; + snprintf(buff, sizeof(buff), + AO_STR_ROTATE_BEZEL_TO_ADJUST.translate(), + STR_VOLUME.translate()); + return CString::dup(buff); + } + + CString VolumeControl::onValueTextAoNameCb(Atspi &atspi) + { + const auto txt = m_layout->getText(impl::PART_TXT_VALUE); + return (!txt.empty()) ? CString::dup(txt.c_str()) : nullptr; + } +} diff --git a/call-ui/view/VolumeControl.h b/call-ui/view/VolumeControl.h new file mode 100644 index 0000000..6a08fde --- /dev/null +++ b/call-ui/view/VolumeControl.h @@ -0,0 +1,191 @@ +/* + * 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_VIEW_VOLUME_CONTROL_H__ +#define __CALL_UI_VIEW_VOLUME_CONTROL_H__ + +#include "call-ui/view/Slider.h" + +#include "ucl/gui/StyledWidget.h" +#include "ucl/gui/Layout.h" + +#include "types.h" + +namespace callui { + + UCL_DECLARE_REF_ALIASES(VolumeControl); + + /** + * @brief Volume Control widget + */ + class VolumeControl final : public Slider { + public: + + /** + * @brief Enumeration of event type + */ + enum class Event { + INCREASE, /**< Increase event type */ + DECREASE /**< Decrease event type */ + }; + + /** + * @brief Event handler definition + */ + using EventHandler = ucl::WeakDelegate<void(Event)>; + public: + + /** + * @brief VolumeControl builder + */ + class Builder { + public: + + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets information text to display + * @param[in] info Text to set + * @return Reference to builder + */ + Builder &setInfoText(ucl::TString info); + + /** + * @brief Sets max volume value to display + * @param[in] maxValue Max value to set + * @return Reference to builder + */ + Builder &setMaxValue(int maxValue); + + /** + * @brief Sets volume value to display + * @param[in] info Value to set + * @return Reference to builder + */ + Builder &setValue(int value); + + /** + * @brief Sets event handler + * @param[in] handler Event handler + * @return Reference to builder + */ + Builder &setEventHandler(EventHandler handler); + + /** + * @brief Creates new instance of VolumeControl + * @param[in] parent Parent widget + * @return Shared reference to VolumeControl instance + * on success or NULL otherwise + */ + VolumeControlSRef build(ucl::ElmWidget &parent) const; + + private: + ucl::TString m_info; + int m_maxValue; + int m_value; + EventHandler m_handler; + }; + + public: + + /** + * @brief Destructor + */ + virtual ~VolumeControl() = default; + + /** + * @brief Sets information text to display + * @param[in] info Text to set + */ + void setInfoText(const ucl::TString &info); + + /** + * @brief Sets decrease volume button enable state + * @param[in] isEnable Button state + */ + void setDecreaseBtnEnable(bool isEnable); + + /** + * @brief Sets increase volume button enable state + * @param[in] isEnable Button state + */ + void setIncreaseBtnEnable(bool isEnable); + + /** + * @brief Gets Access object of decrease volume button + * @remark Use only for Screen Reader feature + * @return Reference to widget + */ + ucl::ElmWidget &getDecreaseBtn(); + + /** + * @brief Gets Access object of increase volume button + * @remark Use only for Screen Reader feature + * @return Reference to widget + */ + ucl::ElmWidget &getIncreaseBtn(); + + /** + * @brief Gets Access object of volume value text area + * @remark Use only for Screen Reader feature + * @return Reference to widget + */ + ucl::ElmWidget &getValueTxtAo(); + + // Slider // + + /** + * @see Slider::setValue() + */ + virtual void setValue(int value) override final; + + private: + VolumeControl(ucl::IRefCountObj &rc, + const ucl::LayoutSRef &layout, + const ucl::TString &info, + int maxValue, + int curValue, + EventHandler handler); + + void prepare(const ucl::TString &info, int curValue); + + void onDecreaseBtnClickedCb(ucl::Widget &widget, void *eventInfo); + void onIncreaseBtnClickedCb(ucl::Widget &widget, void *eventInfo); + + void onWidgetShowCb(Widget &widget, void *eventInfo); + void onWidgetHideCb(Widget &widget, void *eventInfo); + + void registerAccessObjectInformation(); + + ucl::CString onSliderAoDescriptionCb(ucl::Atspi &atspi); + ucl::CString onValueTextAoNameCb(ucl::Atspi &atspi); + private: + const EventHandler m_handler; + + ucl::StyledWidget m_decreaseBtn; + ucl::StyledWidget m_increaseBtn; + + ucl::ElmWidgetSRef m_valueTxtAo; + + friend class ucl::ReffedObj<VolumeControl>; + }; + +} + +#endif // __CALL_UI_VIEW_VOLUME_CONTROL_H__ diff --git a/src/view/common.h b/call-ui/view/common.h index 6e6cd0b..c8e2100 100644 --- a/src/view/common.h +++ b/call-ui/view/common.h @@ -14,15 +14,15 @@ * limitations under the License. */ -#ifndef __CALLUI_VIEW_COMMON_H__ -#define __CALLUI_VIEW_COMMON_H__ +#ifndef __CALL_UI_VIEW_COMMON_H__ +#define __CALL_UI_VIEW_COMMON_H__ #include "ucl/gui/stdTheme.h" #include "ucl/gui/helpers.h" -#include "view/helpers.h" +#include "call-ui/view/helpers.h" -#include "../common.h" +#include "call-ui/common.h" #define DEL_TRANSIT(ptr) \ do { \ @@ -36,6 +36,8 @@ namespace callui { constexpr ucl::SmartEvent BTN_CLICKED {"clicked"}; + constexpr ucl::SmartEvent ATSPI_HIGHLIGHTED {"atspi,highlighted"}; + constexpr ucl::SmartEvent POPUP_DISMISSED {"dismissed"}; } -#endif // __CALLUI_VIEW_COMMON_H__ +#endif // __CALL_UI_VIEW_COMMON_H__ diff --git a/call-ui/view/helpers.cpp b/call-ui/view/helpers.cpp new file mode 100644 index 0000000..31e74a3 --- /dev/null +++ b/call-ui/view/helpers.cpp @@ -0,0 +1,232 @@ +/* + * 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 "call-ui/view/helpers.h" + +#include "ucl/gui/Window.h" +#include "ucl/gui/Naviframe.h" +#include "ucl/gui/Layout.h" + +#include "common.h" + +namespace callui { namespace { namespace impl { + + using namespace ucl; + + constexpr EoDataKey CIRCLE_SURFACE {"callui,eext,circle,surface"}; + + constexpr LayoutTheme LAYOUT_FAKE_ACCESS_OBJECT + {"layout", "callui", "fake_access_object"}; +}}} + +namespace callui { namespace utils { + + using namespace ucl; + + Result createCircleSurface(Naviframe &navi) + { + const auto win = navi.getWindow(); + if (!win) { + LOG_RETURN(RES_FAIL, "Failed to get Window from Naviframe!"); + } + + if (win->getData(impl::CIRCLE_SURFACE)) { + LOG_RETURN(RES_INVALID_OPERATION, "Circle Surface data already set!"); + } + + const auto sfc = eext_circle_surface_conformant_add( + as_eo(win->getConformant())); + if (!sfc) { + LOG_RETURN(RES_FAIL, + "eext_circle_surface_conformant_add() failed!"); + } + + win->setData(impl::CIRCLE_SURFACE, sfc); + + return RES_OK; + } + + Eext_Circle_Surface *getCircleSurface(const ElmWidget &widget) + { + const auto win = widget.getWindow(); + if (!win) { + LOG_RETURN_VALUE(RES_FAIL, nullptr, + "Failed to get Window from widget!"); + } + + const auto sfc = static_cast<Eext_Circle_Surface *>( + win->getData(impl::CIRCLE_SURFACE)); + if (!sfc) { + LOG_RETURN_VALUE(RES_FAIL, nullptr, + "Failed to get Eext_Circle_Surface from window!"); + } + + return sfc; + } + + ElmWidgetSRef createFakeAccessObject(ElmWidget &parent) + { + const auto result = Layout::Builder(). + setTheme(impl::LAYOUT_FAKE_ACCESS_OBJECT). + setNeedBindToEo(true). + build(parent); + if (!result) { + LOG_RETURN_VALUE(RES_FAIL, {}, "Layout::build() failed!"); + } + + result->setGeometry(0, 0, 1, 1); + show(*result); + + struct FakeHandler { + SharedRef<FakeHandler> selfRef; + + void onGestureCb(Atspi &atspi, + AtspiGestureEventInfo &eventInfo) + { + eventInfo.preventDefault = true; + } + }; + + auto fh = makeShared<FakeHandler>(); + fh->selfRef = fh; + + evas_object_event_callback_add(as_eo(*result), EVAS_CALLBACK_DEL, + [](void *data, Evas *e, Evas_Object *obj, void *event_info) + { + static_cast<FakeHandler *>(data)->selfRef.reset(); + }, fh.get()); + + auto &atspi = result->getAtspi(); + atspi.setReadingInfo(0); + atspi.addGestureHandler(WEAK_DELEGATE(FakeHandler::onGestureCb, fh)); + + return result; + } + + + Elm_Genlist_Item_Class createGenlistItemClass(const char *style, + Elm_Gen_Item_Text_Get_Cb txtCb, + Elm_Gen_Item_Content_Get_Cb contentCb, + Elm_Gen_Item_State_Get_Cb stateCb, + Elm_Gen_Item_Del_Cb delCb) + { + Elm_Genlist_Item_Class itc = { ELM_GEN_ITEM_CLASS_HEADER }; + itc.item_style = style; + itc.func.text_get = txtCb; + itc.func.content_get = contentCb; + itc.func.state_get = stateCb; + itc.func.del = delCb; + + return itc; + } + + ElmWidgetSRef createAccessObject(ElmWidget &parent, Widget &obj) + { + auto ao = elm_access_object_register(as_eo(obj), as_eo(parent)); + if (!ao) { + LOG_RETURN_VALUE(RES_FAIL, {}, + "elm_access_object_register() failed!"); + } + + return makeShared<ElmWidget>(ao); + } + + ElmWidgetSRef createAccessObjectFromPart(ElmWidget &parent, + EdjeWidget &widget, EdjePart part) + { + auto edjeLy = elm_layout_edje_get(as_eo(widget)); + if (!edjeLy) { + LOG_RETURN_VALUE(RES_FAIL, {}, + "elm_layout_edje_get() failed!"); + } + + auto edjeObj = const_cast<Evas_Object *>( + edje_object_part_object_get(edjeLy, part.name)); + if (!edjeObj) { + LOG_RETURN_VALUE(RES_FAIL, {}, + "edje_object_part_object_get() failed!"); + } + + auto ao = elm_access_object_register(edjeObj, as_eo(parent)); + if (!ao) { + LOG_RETURN_VALUE(RES_FAIL, {}, + "elm_access_object_register() failed!"); + } + + return makeShared<ElmWidget>(ao); + } + + void setMirroredMode(bool isMirroredMode) + { + elm_config_mirrored_set(isMirroredMode); + } + + bool getMirroredMode() + { + return elm_config_mirrored_get(); + } + + const Elm_Interface_Atspi_Accessible *getAo(ElmWidget *widget) + { + return (widget) ? as_ao(*widget) : nullptr; + } + +}} + +namespace callui { + + void addRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data) + { + eext_rotary_event_handler_add(func, data); + } + + void delRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data) + { + std::vector<void *> backup; + while (true) { + void *const oldData = eext_rotary_event_handler_del(func); + if (!oldData || (oldData == data)) { + break; + } + backup.push_back(oldData); + } + for (auto i = backup.size(); i-- > 0; ) { + eext_rotary_event_handler_add(func, backup[i]); + } + } + + LayoutTheme getImageTheme(const char *const fileName) + { + return {"layout", "callui_image", fileName}; + } + + Elm_Atspi_Relation_Type getFlowRelation(Elm_Atspi_Gesture_Info gestureInfo) + { + switch (gestureInfo.type) { + case ELM_ATSPI_GESTURE_ONE_FINGER_FLICK_RIGHT: + case ELM_ATSPI_GESTURE_ONE_FINGER_FLICK_DOWN: + return ELM_ATSPI_RELATION_FLOWS_TO; + case ELM_ATSPI_GESTURE_ONE_FINGER_FLICK_LEFT: + case ELM_ATSPI_GESTURE_ONE_FINGER_FLICK_UP: + return ELM_ATSPI_RELATION_FLOWS_FROM; + default: + break; + } + return ELM_ATSPI_RELATION_NULL; + } + +} + diff --git a/call-ui/view/helpers.h b/call-ui/view/helpers.h new file mode 100644 index 0000000..c2398c1 --- /dev/null +++ b/call-ui/view/helpers.h @@ -0,0 +1,142 @@ +/* + * 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_VIEW_HELPERS_H__ +#define __CALL_UI_VIEW_HELPERS_H__ + +#include <efl_extension.h> + +#include "ucl/gui/ElmWidget.h" +#include "ucl/gui/Naviframe.h" +#include "ucl/gui/Layout.h" + +#include "types.h" + +namespace callui { namespace utils { + + /** + * @brief Create circular surface from Naviframe for circular objects + * @param[in] navi Naviframe instance + * @return RES_OK on success or another result otherwise + */ + ucl::Result createCircleSurface(ucl::Naviframe &navi); + + /** + * @brief Gets circular surface for widget + * @param[in] widget Widget instance + * @return Pointer on circular surface + */ + Eext_Circle_Surface *getCircleSurface(const ucl::ElmWidget &widget); + + /** + * @brief Creates fake Access object + * @param[in] parent Parent widget + * @return Shared reference to ElmWidget instance + * on success or NULL otherwise + */ + ucl::ElmWidgetSRef createFakeAccessObject(ucl::ElmWidget &parent); + + /** + * @brief Creates elm_genlist item class according to input params + * @param[in] style Item style + * @param[in] txtCb Item text callback function + * @param[in] contentCb Item content callback function + * @param[in] txtCb Item state callback function + * @param[in] txtCb Item delete callback function + * @return Elementary genlist item class instance + */ + Elm_Genlist_Item_Class createGenlistItemClass(const char *style, + Elm_Gen_Item_Text_Get_Cb txtCb = nullptr, + Elm_Gen_Item_Content_Get_Cb contentCb = nullptr, + Elm_Gen_Item_State_Get_Cb stateCb = nullptr, + Elm_Gen_Item_Del_Cb delCb = nullptr); + + /** + * @brief Creates Access object + * @param[in] parent ElmWidget which is used for creating + * @param[in] obj Widget to register as an accessible object + * @return Shared reference to ElmWidget instance + * on success or NULL otherwise + */ + ucl::ElmWidgetSRef createAccessObject(ucl::ElmWidget &parent, + ucl::Widget &obj); + + /** + * @brief Creates Access object from layout part + * @param[in] parent Parent for access object + * @param[in] widget Widget which part is used to register as an accessible object + * @param[in] part Widget part to register as an accessible object + * @return Shared reference to ElmWidget instance + * on success or NULL otherwise + */ + ucl::ElmWidgetSRef createAccessObjectFromPart(ucl::ElmWidget &parent, + ucl::EdjeWidget &widget, + ucl::EdjePart part); + + /** + * @brief Sets mirrored mode status + * @param[in] isMirroredMode Mirrored mode status + */ + void setMirroredMode(bool isMirroredMode); + + /** + * @brief Gets mirrored mode status + * @return true if mirrored mode is on, false otherwise + */ + bool getMirroredMode(); + + /** + * @brief Gets Atspi object of the Widget + * @param[in] widget Pointer on widget + * @return Atspi object on success otherwise null on fail + */ + const Elm_Interface_Atspi_Accessible *getAo(ucl::ElmWidget *widget); + +}} + +namespace callui { + + /** + * @brief Adds rotary event handler + * @param[in] func Callback function on rotary events + * @param[in] data User data + */ + void addRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data); + + /** + * @brief Deletes rotary event handler + * @param[in] func Callback function on rotary events + * @param[in] data User data + */ + void delRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data); + + /** + * @brief Converts image file name into image layout theme + * @param[in] fileName Image filename + * @return Layout theme instance + */ + ucl::LayoutTheme getImageTheme(const char *fileName); + + /** + * @brief Gets Screen Reader relation type from Screen Reader gesture info + * @param[in] gestureInfo Screen Reader gesture info + * @return Screen Reader relation type + */ + Elm_Atspi_Relation_Type getFlowRelation(Elm_Atspi_Gesture_Info gestureInfo); + +} + +#endif // __CALL_UI_VIEW_HELPERS_H__ diff --git a/inc/view/types.h b/call-ui/view/types.h index 8354b06..a3bdd99 100644 --- a/inc/view/types.h +++ b/call-ui/view/types.h @@ -14,32 +14,24 @@ * limitations under the License. */ -#ifndef __CALLUI_VIEW_TYPES_H__ -#define __CALLUI_VIEW_TYPES_H__ +#ifndef __CALL_UI_VIEW_TYPES_H__ +#define __CALL_UI_VIEW_TYPES_H__ #include <efl_extension.h> #include "ucl/gui/types.h" -#include "../types.h" +#include "call-ui/types.h" namespace callui { - enum class VolumeControlEvent { - INCREASE, - DECREASE - }; - + /** + * @brief Enumeration of Acceept button type for AcceptRejectWidget + */ enum class AcceptButtonType { - SIMPLE, - BT_HEADSET + SIMPLE, /**< Normal accept button type */ + BT_HEADSET /**< Accept with BT Headset button type */ }; - - UCL_DECLARE_REF_ALIASES(Slider); - UCL_DECLARE_REF_ALIASES(VolumeControl); - UCL_DECLARE_REF_ALIASES(AcceptRejectWidget); - - using VolumeControlEventHandler = ucl::WeakDelegate<void(VolumeControlEvent)>; } -#endif // __CALLUI_VIEW_TYPES_H__ +#endif // __CALL_UI_VIEW_TYPES_H__ diff --git a/edc/accept_reject.edc b/edc/accept_reject.edc index 6938525..5b1d360 100644 --- a/edc/accept_reject.edc +++ b/edc/accept_reject.edc @@ -73,7 +73,6 @@ group { "elm/layout/callui/event_accept_reject"; rect { "bg"; scale; mouse; - repeat; desc { "default"; min: CU_ACCEPT_REJECT_ICON_BG_SIZE; fixed: 1 1; @@ -162,20 +161,8 @@ group { "elm/layout/callui/accept_reject_main"; // Control parts - swallow { "swl.accept.finger.event"; - scale; - mouse; - desc { "default"; - min: CU_ACCEPT_REJECT_ICON_BG_SIZE; - fixed: 1 1; - rel1 { relative: CU_ACCEPT_COMPONENT_REL; to: "bg"; } - rel2 { relative: CU_ACCEPT_COMPONENT_REL; to: "bg"; } - } - } swallow { "swl.accept.finger.guide.bg"; scale; - mouse; - repeat; desc { "default"; min: CU_ACCEPT_REJECT_ICON_BG_SIZE; fixed: 1 1; @@ -185,8 +172,6 @@ group { "elm/layout/callui/accept_reject_main"; } swallow { "swl.accept.finger.tracer"; scale; - mouse; - repeat; desc { "default"; min: CU_ACCEPT_REJECT_FINGER_TRACER_BG_SIZE; fixed: 1 1; @@ -196,8 +181,6 @@ group { "elm/layout/callui/accept_reject_main"; } swallow { "swl.accept.icon"; scale; - mouse; - repeat; desc { "default"; min: CU_ACCEPT_REJECT_ICON_SIZE; fixed: 1 1; @@ -205,20 +188,18 @@ group { "elm/layout/callui/accept_reject_main"; rel2 { relative: CU_ACCEPT_COMPONENT_REL; to: "bg"; } } } - swallow { "swl.reject.finger.event"; + swallow { "swl.accept.finger.event"; scale; mouse; desc { "default"; min: CU_ACCEPT_REJECT_ICON_BG_SIZE; fixed: 1 1; - rel1 { relative: CU_REJECT_COMPONENT_REL; to: "bg"; } - rel2 { relative: CU_REJECT_COMPONENT_REL; to: "bg"; } + rel1 { relative: CU_ACCEPT_COMPONENT_REL; to: "bg"; } + rel2 { relative: CU_ACCEPT_COMPONENT_REL; to: "bg"; } } } swallow { "swl.reject.finger.guide.bg"; scale; - mouse; - repeat; desc { "default"; min: CU_ACCEPT_REJECT_ICON_BG_SIZE; fixed: 1 1; @@ -228,8 +209,6 @@ group { "elm/layout/callui/accept_reject_main"; } swallow { "swl.reject.finger.tracer"; scale; - mouse; - repeat; desc { "default"; min: CU_ACCEPT_REJECT_FINGER_TRACER_BG_SIZE; fixed: 1 1; @@ -239,8 +218,6 @@ group { "elm/layout/callui/accept_reject_main"; } swallow { "swl.reject.icon"; scale; - mouse; - repeat; desc { "default"; min: CU_ACCEPT_REJECT_ICON_SIZE; fixed: 1 1; @@ -248,5 +225,15 @@ group { "elm/layout/callui/accept_reject_main"; rel2 { relative: CU_REJECT_COMPONENT_REL; to: "bg"; } } } + swallow { "swl.reject.finger.event"; + scale; + mouse; + desc { "default"; + min: CU_ACCEPT_REJECT_ICON_BG_SIZE; + fixed: 1 1; + rel1 { relative: CU_REJECT_COMPONENT_REL; to: "bg"; } + rel2 { relative: CU_REJECT_COMPONENT_REL; to: "bg"; } + } + } } } diff --git a/edc/buttons.edc b/edc/buttons.edc index 8b1ef39..5f92973 100644 --- a/edc/buttons.edc +++ b/edc/buttons.edc @@ -1281,7 +1281,7 @@ CU_BTN_VOLUME_CONTROL("callui/plus", "b_slider_icon_plus.png") CU_BTN_ACCESSORY("callui/volume", "w_outgoing_icon_volume_02.png") CU_BTN_ACCESSORY("callui/mute", "w_outgoing_icon_mute_02.png") -CU_BTN_ACCESSORY_TOGGLE_ICON("callui/bluetooth", "w_outgoing_icon_towatch_02.png", +CU_BTN_ACCESSORY_TOGGLE_ICON("callui/bluetooth", "w_outgoing_icon_gear_02.png", "w_outgoing_icon_headset_02.png") CU_BTN_ACCESSORY("callui/add_contact", "w_outgoing_icon_contact_add_02.png") diff --git a/edc/call_info.edc b/edc/call_info.edc index ccd688e..9ff3dab 100644 --- a/edc/call_info.edc +++ b/edc/call_info.edc @@ -29,7 +29,7 @@ styles { } style { name: "main_text_emergency"; - base: "font=Tizen font_weight=Regular font_width=Condensed font_size=24 align=center valign=center color=#FF870F ellipsis=1.0"; + base: "font=Tizen font_weight=Regular font_width=Condensed font_size=24 align=center valign=center color=#FF4E47 ellipsis=1.0"; } style { name: "main_text_big"; @@ -39,14 +39,10 @@ styles { name: "main_text_big_photo"; base: "font=Tizen font_weight=Regular font_width=Condensed font_size=40 align=center valign=center color=#FFFFFF wrap=mixed ellipsis=1.0"; } - style { - name: "main_text_big_emergency"; - base: "font=Tizen font_weight=Regular font_width=Condensed font_size=40 align=center valign=center color=#FF870F wrap=mixed ellipsis=1.0"; - } } -#define CU_DOT(_name, _ltr_offset, _rtl_offset) \ +#define CU_DOT(_name, _ltr_offset) \ image { _name; \ scale; \ desc { "default"; \ @@ -79,32 +75,6 @@ styles { color_class: AO0311D; \ visible: 1; \ } \ - desc { "default_rtl"; \ - inherit: "default"; \ - align: 1.0 0.5; \ - rel1 { relative: 0.0 0.0; offset: _rtl_offset 0; to: "text_info"; } \ - rel2 { relative: 0.0 1.0; offset: _rtl_offset 0; to: "text_info"; } \ - } \ - desc { "rtl_on"; \ - inherit: "default_rtl"; \ - color_class: AO031; \ - visible: 1; \ - } \ - desc { "rtl_off"; \ - inherit: "default_rtl"; \ - color_class: AO031D; \ - visible: 1; \ - } \ - desc { "rtl_on_photo"; \ - inherit: "default_rtl"; \ - color_class: AO0311; \ - visible: 1; \ - } \ - desc { "rtl_off_photo"; \ - inherit: "default_rtl"; \ - color_class: AO0311D; \ - visible: 1; \ - } \ } group { "elm/layout/callui/call_info"; @@ -188,12 +158,6 @@ group { "elm/layout/callui/call_info"; max: 191 32; rel2 { relative: 0.0 1.0; offset: -17 0; to_x: "right.pad"; to_y: "top.pad"; } } - desc { "incom_rtl"; - inherit: "default"; - min: 191 32; - max: 191 32; - rel1 { relative: 1.0 1.0; offset: 17 0; to_x: "left.pad"; to_y: "top.pad"; } - } } textblock { "text_info"; nomouse; @@ -215,15 +179,20 @@ group { "elm/layout/callui/call_info"; } } } - CU_DOT("dot.first", 3, -3) - CU_DOT("dot.second", 9, -9) - CU_DOT("dot.third", 15, -15) + CU_DOT("dot.first", 3) + CU_DOT("dot.second", 9) + CU_DOT("dot.third", 15) + rect { "ao_text_info"; mouse; scale; desc { "default"; - rel1.to: "text_info"; - rel2.to: "text_info"; + fixed: 1 1; + align: 0.0 0.0; + min: 208 32; + max: 208 32; + rel1 { relative: 1.0 1.0; to_x: "left.pad"; to_y: "top.pad"; } + rel2 { relative: 0.0 1.0; to_x: "right.pad"; to_y: "top.pad"; } color: 0 0 0 0; } } @@ -278,10 +247,6 @@ group { "elm/layout/callui/call_info"; inherit: "default"; text.style: "main_text_big_photo"; } - desc { "big_emergency"; - inherit: "default"; - text.style: "main_text_big_emergency"; - } } rect { "ao_text_1line"; mouse; @@ -441,80 +406,6 @@ group { "elm/layout/callui/call_info"; set_int(blink_dot_timer, timer(0.5, "do_blinking", count+1)); } } - public do_blinking_rtl(count, part_state) { - if (count%6 == 0) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_on_photo", 0.0); - set_state(PART:"dot.second", "rtl_off_photo", 0.0); - set_state(PART:"dot.third", "rtl_off_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_on", 0.0); - set_state(PART:"dot.second", "rtl_off", 0.0); - set_state(PART:"dot.third", "rtl_off", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - else if (count%6 == 1) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_on_photo", 0.0); - set_state(PART:"dot.second", "rtl_on_photo", 0.0); - set_state(PART:"dot.third", "rtl_off_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_on", 0.0); - set_state(PART:"dot.second", "rtl_on", 0.0); - set_state(PART:"dot.third", "rtl_off", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - else if (count%6 == 2) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_on_photo", 0.0); - set_state(PART:"dot.second", "rtl_on_photo", 0.0); - set_state(PART:"dot.third", "rtl_on_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_on", 0.0); - set_state(PART:"dot.second", "rtl_on", 0.0); - set_state(PART:"dot.third", "rtl_on", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - else if (count%6 == 3) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_off_photo", 0.0); - set_state(PART:"dot.second", "rtl_on_photo", 0.0); - set_state(PART:"dot.third", "rtl_on_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_off", 0.0); - set_state(PART:"dot.second", "rtl_on", 0.0); - set_state(PART:"dot.third", "rtl_on", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - else if (count%6 == 4) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_off_photo", 0.0); - set_state(PART:"dot.second", "rtl_off_photo", 0.0); - set_state(PART:"dot.third", "rtl_on_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_off", 0.0); - set_state(PART:"dot.second", "rtl_off", 0.0); - set_state(PART:"dot.third", "rtl_on", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - else if (count%6 == 5) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_off_photo", 0.0); - set_state(PART:"dot.second", "rtl_off_photo", 0.0); - set_state(PART:"dot.third", "rtl_off_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_off", 0.0); - set_state(PART:"dot.second", "rtl_off", 0.0); - set_state(PART:"dot.third", "rtl_off", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - } } program { signal: "reset"; @@ -539,15 +430,7 @@ group { "elm/layout/callui/call_info"; } } program { - signal: "default:RTL"; - source: "dot"; - script { - set_state(PART:"zone.text_info", "incom_rtl", 0.0); - set_int(blink_dot_timer, timer(0.1, "do_blinking_rtl", 0)); - } - } - program { - signal: "default:LTR"; + signal: "animate"; source: "dot"; script { set_state(PART:"zone.text_info", "incom", 0.0); @@ -611,22 +494,6 @@ group { "elm/layout/callui/call_info"; } } program { - signal: "big_txt"; - source: "text_1line"; - script { - set_state(PART:"text_1line", "big", 0.0); - set_state(PART:"text_info", "default", 0.0); - } - } - program { - signal: "big_txt_emergency"; - source: "text_1line"; - script { - set_state(PART:"text_1line", "big_emergency", 0.0); - set_state(PART:"text_info", "default", 0.0); - } - } - program { signal: "default"; source: "text_2line"; script { diff --git a/edc/color_classes.edc b/edc/color_classes.edc index 308a4de..1f65902 100644 --- a/edc/color_classes.edc +++ b/edc/color_classes.edc @@ -108,7 +108,7 @@ color_classes { color: 255 255 255 255; } color_class { name: "AO012"; - color: 0 149 255 255; + color: 77 207 255 255; } color_class { name: "AO012D"; color: 255 255 255 77; diff --git a/edc/images/Indicator_icon/indi_voice_control.png b/edc/images/Indicator_icon/indi_voice_control.png Binary files differdeleted file mode 100644 index f4631d0..0000000 --- a/edc/images/Indicator_icon/indi_voice_control.png +++ /dev/null diff --git a/edc/images/w_outgoing_icon_gear_02.png b/edc/images/w_outgoing_icon_gear_02.png Binary files differnew file mode 100644 index 0000000..ae4cbbc --- /dev/null +++ b/edc/images/w_outgoing_icon_gear_02.png diff --git a/edc/images/w_outgoing_icon_towatch_02.png b/edc/images/w_outgoing_icon_towatch_02.png Binary files differdeleted file mode 100644 index 36bc29a..0000000 --- a/edc/images/w_outgoing_icon_towatch_02.png +++ /dev/null diff --git a/edc/indicator.edc b/edc/indicator.edc index f47ce4b..30f8261 100644 --- a/edc/indicator.edc +++ b/edc/indicator.edc @@ -92,13 +92,6 @@ group { "elm/layout/callui/indicator"; rel2 { relative: CU_SWL_BATTERY_REL2; to: "bg"; } } } - swallow { "swl.voice_control"; - scale; - desc { "default"; - rel1 { relative: CU_SWL_VC_REL1; to: "bg"; } - rel2 { relative: CU_SWL_VC_REL2; to: "bg"; } - } - } swallow { "swl.sim"; scale; desc { "default"; @@ -524,26 +517,6 @@ group { "elm/layout/callui/battery"; } } -// Voice Control - -group { "elm/layout/callui/voice_control"; - images { - image: CU_INDI_ICONS_DIR"/indi_voice_control.png" COMP; - } - parts { - image { "img.voice_control"; - scale; - desc { "default"; - fixed: 1 1; - min: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H; - max: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H; - image.normal: CU_INDI_ICONS_DIR"/indi_voice_control.png"; - color_class: "AO0111"; - } - } - } -} - // SIM group { "elm/layout/callui/sim"; diff --git a/edc/main_ly.edc b/edc/main_ly.edc index e87ac93..cd9bfc4 100644 --- a/edc/main_ly.edc +++ b/edc/main_ly.edc @@ -16,31 +16,47 @@ group { "elm/layout/callui/main"; parts { + rect { "bg"; + scale; + desc { "default"; + min: CU_WIN_W CU_WIN_H; + max: CU_WIN_W CU_WIN_H; + color: 0 0 0 0; + } + } swallow { "swl.call_info"; scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } swallow { "swl.indicator"; scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } swallow { "swl.rm" scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } swallow { "swl.accept_reject"; scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } swallow { "swl.bottom_btn"; scale; desc { "default"; - rel1.relative: 0.0 1.0; - rel2.relative: 1.0 1.0; + rel1 { relative: 0.0 1.0; to: "bg"; } + rel2 { relative: 1.0 1.0; to: "bg"; } align: 0.5 1.0; fixed: 0 1; } @@ -48,12 +64,20 @@ group { "elm/layout/callui/main"; swallow { "swl.overlay"; scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } swallow { "swl.more_option"; scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } } } + +group { "elm/layout/callui/fake_access_object"; + data.item: "access_highlight" "on"; +} diff --git a/edc/more_option.edc b/edc/more_option.edc index 56a6577..f5640cf 100644 --- a/edc/more_option.edc +++ b/edc/more_option.edc @@ -78,6 +78,15 @@ group { "elm/layout/callui/more_option"; text.fit: 1 1; } } + rect { "ao_txt.status"; + mouse; + scale; + desc { "default"; + rel1.to: "txt.status"; + rel2.to: "txt.status"; + color: 0 0 0 0; + } + } swallow { "swl.slot.1"; scale; desc { "default"; diff --git a/edc/reject_msg.edc b/edc/reject_msg.edc index cc88b05..ef23efb 100644 --- a/edc/reject_msg.edc +++ b/edc/reject_msg.edc @@ -43,7 +43,7 @@ group { "elm/layout/callui/reject_msg"; } } image { "cue"; - repeat; + scale; desc { "default"; align: 0.5 1.0; fixed: 0 1; @@ -74,8 +74,6 @@ group { "elm/layout/callui/reject_msg"; } textblock { "reject_msg_text"; scale; - nomouse; - repeat; desc { "default"; rel1 { relative: 0.0 0.0; to: "reject_msg_text_zone"; } rel2 { relative: 1.0 1.0; to: "reject_msg_text_zone"; } @@ -88,6 +86,15 @@ group { "elm/layout/callui/reject_msg"; hid; } } + rect { "ao_cue"; + mouse; + scale; + desc { "default"; + rel1 { relative: 0.0 0.0; to: "reject_msg_text_zone"; } + rel2 { relative: 1.0 1.0; to_x: "reject_msg_text_zone"; } + color: 0 0 0 0; + } + } } } diff --git a/edc/volume_control.edc b/edc/volume_control.edc index e0ab578..21e173d 100644 --- a/edc/volume_control.edc +++ b/edc/volume_control.edc @@ -118,6 +118,18 @@ group { "elm/layout/callui/volume_control"; hid; } } + textblock { "ao_txt.value"; + scale; + mouse; + desc { "default"; + fixed: 1 1; + rel1.to: "txt.value"; + rel2.to: "txt.value"; + } + desc { "hide"; + hid; + } + } swallow { "swl.minus"; scale; desc { "default"; diff --git a/inc/model/IActiveCall.h b/inc/model/IActiveCall.h deleted file mode 100644 index 2d58a09..0000000 --- a/inc/model/IActiveCall.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 __CALLUI_MODEL_I_ACTIVE_CALL_H__ -#define __CALLUI_MODEL_I_ACTIVE_CALL_H__ - -#include "types.h" - -namespace callui { - - class IActiveCall : public ucl::Polymorphic { - public: - virtual ICallInfoSCRef getInfo() const = 0; - virtual bool isDialingMode() const = 0; - virtual ucl::Result hold() = 0; - virtual ucl::Result end() = 0; - virtual ucl::Result split(const IConferenceCallInfoSCRef &confCallInfo) = 0; - }; - -} - -#endif // __CALLUI_MODEL_I_ACTIVE_CALL_H__ diff --git a/inc/model/ICallInfo.h b/inc/model/ICallInfo.h deleted file mode 100644 index f0f0ba8..0000000 --- a/inc/model/ICallInfo.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 __CALLUI_MODEL_I_CALL_INFO_H__ -#define __CALLUI_MODEL_I_CALL_INFO_H__ - -#include "IBaseCallInfo.h" - -#include <time.h> - -#include "types.h" - -namespace callui { - - class ICallInfo : public IBaseCallInfo { - public: - virtual struct tm getDuration() const = 0; - virtual bool isEmergency() const = 0; - virtual bool isHDVoice() const = 0; - virtual bool isForwarded() const = 0; - virtual bool isVoiceMailNumber() const = 0; - virtual int getConferenceMemberCount() const = 0; - virtual const ConfMemberList &getConferenceMemberList() const = 0; - }; - - // Non-member functions - - bool isUnknownCaller(const ICallInfo &info); -} - -#endif // __CALLUI_MODEL_I_CALL_INFO_H__ diff --git a/inc/model/ICallManager.h b/inc/model/ICallManager.h deleted file mode 100644 index 6fbcaa6..0000000 --- a/inc/model/ICallManager.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 __CALLUI_MODEL_I_STATE_PROVIDER_H__ -#define __CALLUI_MODEL_I_STATE_PROVIDER_H__ - -#include "types.h" - -namespace callui { - - class ICallManager : public ucl::Polymorphic { - public: - virtual IIncomingCallSRef getIncomingCall() = 0; - virtual IActiveCallSRef getActiveCall() = 0; - virtual IHeldCallSRef getHeldCall() = 0; - virtual IEndCallSRef getEndCall() = 0; - virtual CallMask getAvailableCalls() const = 0; - }; -} - -#endif // __CALLUI_MODEL_I_STATE_PROVIDER_H__ diff --git a/inc/model/IContactInfo.h b/inc/model/IContactInfo.h deleted file mode 100644 index a71fc9c..0000000 --- a/inc/model/IContactInfo.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 __CALLUI_MODEL_I_CONTACT_INFO_H__ -#define __CALLUI_MODEL_I_CONTACT_INFO_H__ - -#include "types.h" - -namespace callui { - - class IContactInfo : public ucl::Polymorphic { - public: - virtual const std::string &getName() const = 0; - virtual const std::string &getImagePath() const = 0; - virtual ContactNameSourceType getNameSourceType() const = 0; - }; -} - -#endif // __CALLUI_MODEL_I_CONTACT_INFO_H__ diff --git a/inc/model/IHeldCall.h b/inc/model/IHeldCall.h deleted file mode 100644 index 030ae5d..0000000 --- a/inc/model/IHeldCall.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 __CALLUI_MODEL_I_HELD_CALL_H__ -#define __CALLUI_MODEL_I_HELD_CALL_H__ - -#include "types.h" - -namespace callui { - - class IHeldCall : public ucl::Polymorphic { - public: - virtual ICallInfoSCRef getInfo() const = 0; - virtual ucl::Result unhold() = 0; - virtual ucl::Result joinWithActive() = 0; - virtual ucl::Result swapWithActive() = 0; - virtual ucl::Result end() = 0; - virtual ucl::Result split(const IConferenceCallInfoSCRef &confCallInfo) = 0; - }; -} - -#endif // __CALLUI_MODEL_I_HELD_CALL_H__ diff --git a/inc/model/IIncomingCall.h b/inc/model/IIncomingCall.h deleted file mode 100644 index 35d6b90..0000000 --- a/inc/model/IIncomingCall.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 __CALLUI_MODEL_I_INCOMING_CALL_H__ -#define __CALLUI_MODEL_I_INCOMING_CALL_H__ - -#include "types.h" - -namespace callui { - - class IIncomingCall : public ucl::Polymorphic { - public: - virtual ICallInfoSCRef getInfo() const = 0; - virtual IRejectMsgProviderSRef getRejectMsgProvider() const = 0; - virtual ucl::Result answer(CallAnswerType type) = 0; - virtual ucl::Result reject() = 0; - virtual ucl::Result rejectWithMessage(IRejectMsgSRef message) = 0; - virtual ucl::Result stopAlert() = 0; - }; -} - -#endif // __CALLUI_MODEL_I_INCOMING_CALL_H__ diff --git a/inc/model/ISoundManager.h b/inc/model/ISoundManager.h deleted file mode 100644 index bced75a..0000000 --- a/inc/model/ISoundManager.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 __CALLUI_MODEL_I_SOUND_MANAGER_H__ -#define __CALLUI_MODEL_I_SOUND_MANAGER_H__ - -#include "types.h" - -namespace callui { - - class ISoundManager: public ucl::Polymorphic { - public: - virtual ucl::Result setSpeakerState(bool isEnable) = 0; - virtual ucl::Result setBluetoothState(bool isEnable) = 0; - virtual AudioStateType getAudioState() const = 0; - virtual ucl::Result setMuteState(bool isEnable) = 0; - virtual bool getMuteState() const = 0; - virtual ucl::Result startDtmf(const unsigned char dtmfDigit) = 0; - virtual ucl::Result stopDtmf() = 0; - virtual void addAudioStateHandler( - const AudioStateHandler &handler) = 0; - virtual void delAudioStateHandler( - const AudioStateHandler &handler) = 0; - virtual void addMuteStateHandler( - const MuteStateHandler &handler) = 0; - virtual void delMuteStateHandler( - const MuteStateHandler &handler) = 0; - virtual void addVolumeStateHandler( - const VolumeLevelHandler &handler) = 0; - virtual void delVolumeStateHandler( - const VolumeLevelHandler &handler) = 0; - virtual int getMaxVolume() const = 0; - virtual int getVolume() const = 0; - virtual ucl::Result setVolume(int value) = 0; - virtual bool isBTSupported() const = 0; - virtual bool isBTHeadsetConnected() const = 0; - virtual void addBTHeadsetConnectionChangeHandler( - const NotiHandler &handler) = 0; - virtual void delBTHeadsetConnectionChangeHandler( - const NotiHandler &handler) = 0; - }; -} - -#endif // __CALLUI_MODEL_I_SOUND_MANAGER_H__ diff --git a/inc/model/IndicatorState.h b/inc/model/IndicatorState.h deleted file mode 100644 index da7e45f..0000000 --- a/inc/model/IndicatorState.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 __CALLUI_MODEL_INDICATOR_STATE_H__ -#define __CALLUI_MODEL_INDICATOR_STATE_H__ - -#include "types.h" - -namespace callui { - - struct IndicatorState { - uint64_t value; - }; - - ConnectionType getConnectionState(IndicatorState state); - PacketDirection getPacketDirection(IndicatorState state); - RssiState getRssiState(IndicatorState state); - bool getRoamingState(IndicatorState state); - int getBatteryLevel(IndicatorState state); - BatteryState getBatteryState(IndicatorState state); - bool getVoiceControlState(IndicatorState state); - SimSlot getSimSlotType(IndicatorState state); - bool getSimForwardState(IndicatorState state); - bool getHDVoiceState(IndicatorState state); - -} - -#endif // __CALLUI_MODEL_INDICATOR_STATE_H__ diff --git a/inc/model/types.h b/inc/model/types.h deleted file mode 100644 index 3283943..0000000 --- a/inc/model/types.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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 __CALLUI_MODEL_TYPES_H__ -#define __CALLUI_MODEL_TYPES_H__ - -#include <vector> - -#include "../types.h" - -namespace callui { - - enum class CallErr { - DIAL_CANCEL, - DIAL_FAIL, - DIAL_FLIGHT_MODE - }; - - enum class SimSlot { - UNDEFINED = 0, - GEAR, - MOBILE_FIRST, - MOBILE_SECOND, - MOBILE_DEFAULT - }; - - enum class CallAnswerType { - NORMAL, - HOLD_ACTIVE_AND_ACCEPT, - RELEASE_ACTIVE_AND_ACCEPT, - RELEASE_HOLD_AND_ACCEPT, - RELEASE_ALL_AND_ACCEPT - }; - - enum class AudioStateType { - NONE, - SPEAKER, - RECEIVER, - EARJACK, - BT - }; - - enum { - CALL_FLAG_NONE = 0, - CALL_FLAG_INCOMING = 1, - CALL_FLAG_ACTIVE = 2, - CALL_FLAG_HELD = 4, - CALL_FLAG_END = 8 - }; - using CallMask = int; - - enum class CallEventType { - END, - DIALING, - ACTIVE, - HELD, - ALERT, - INCOMING, - WAITING, - JOIN, - SPLIT, - SWAPPED, - RETRIEVED, - SAT_CALL_CONTROL - }; - - enum class ContactNameSourceType { - INVALID, - EMAIL, - NUMBER, - NICKNAME, - COMPANY, - NAME - }; - - enum class ConnectionType { - NONE = 0, - EDGE_E, - GPRS_G, - SIMPLE_2G, - HSDPA_H, - HSPA_H_PLUS, - LTE_4G, - UMTS_3G, - UMTS_3G_PLUS, - NO_SIM, - WIFI_00, - WIFI_01, - WIFI_02, - WIFI_03, - WIFI_04, - NO_SIGNAL - }; - - enum class PacketDirection { - NONE = 0, - NO_INPUT, - IN, - OUT, - INOUT - }; - - enum class RssiState { - NONE = 0, - LEVEL_0, - LEVEL_1, - LEVEL_2, - LEVEL_3, - LEVEL_4, - NO_SIGNAL, - FLIGHT_MODE - }; - - enum class BatteryState { - NORMAL = 0, - CHARGING, - CHARGING_PROBLEM, - UNKNOWN - }; - - enum class IndicatorProperty { - NW_CONNECTION = 0, - RSSI, - BATTERY, - VOICE_CONTROL, - SIM_SLOT, - HD_VOICE - }; - - UCL_DECLARE_REF_ALIASES(ICallUI); - UCL_DECLARE_REF_ALIASES(ICallListener); - - UCL_DECLARE_REF_ALIASES(ICallManager); - UCL_DECLARE_REF_ALIASES(ISoundManager); - - UCL_DECLARE_REF_ALIASES(IIncomingCall); - UCL_DECLARE_REF_ALIASES(IActiveCall); - UCL_DECLARE_REF_ALIASES(IHeldCall); - UCL_DECLARE_REF_ALIASES(IEndCall); - - UCL_DECLARE_REF_ALIASES(ICallInfo); - UCL_DECLARE_REF_ALIASES(IContactInfo); - UCL_DECLARE_REF_ALIASES(IConferenceCallInfo); - - UCL_DECLARE_REF_ALIASES(IRejectMsgProvider); - UCL_DECLARE_REF_ALIASES(IRejectMsg); - - UCL_DECLARE_REF_ALIASES(IIndicatorStateProvider); - UCL_DECLARE_REF_ALIASES(IIndicatorStateListener); - - using AudioStateHandler = ucl::Delegate<void(AudioStateType)>; - using MuteStateHandler = ucl::Delegate<void(bool)>; - using VolumeLevelHandler = ucl::Delegate<void(int)>; - - using ConfMemberList = std::vector<IConferenceCallInfoSCRef>; - using RejectMsgList = std::vector<IRejectMsgSRef>; -} - -#endif // __CALLUI_MODEL_TYPES_H__ diff --git a/inc/presenters/AcceptDialog.h b/inc/presenters/AcceptDialog.h deleted file mode 100644 index e10dc02..0000000 --- a/inc/presenters/AcceptDialog.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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 __CALLUI_VIEW_ACCEPT_DIALOG_H__ -#define __CALLUI_VIEW_ACCEPT_DIALOG_H__ - -#include "ucl/mvp/GuiPresenter.h" - -#include "ucl/gui/StyledWidget.h" -#include "ucl/gui/ElmWidget.h" -#include "ucl/gui/ElmWidget.h" - -#include "types.h" - -namespace callui { - - class AcceptDialog final : public ucl::GuiPresenter, - public ucl::IDisposable { - public: - class Builder { - public: - Builder(); - ~Builder(); - Builder &setHandler(AcceptDialogHandler handler); - AcceptDialogWRef build(ucl::ElmWidget &parent) const; - private: - AcceptDialogHandler m_handler; - }; - - public: - virtual ~AcceptDialog(); - - void dismiss(); - - // ucl::IDisposable - - virtual void dispose() final override; - virtual bool isDisposed() const final override; - - private: - friend class ucl::ReffedObj<AcceptDialog>; - AcceptDialog(ucl::IRefCountObj &rc, - const AcceptDialogHandler &handler); - - ucl::Result prepare(ucl::ElmWidget &parent); - - ucl::Result createPopup(ucl::ElmWidget &parent, ucl::ElmStyle style); - ucl::Result createGenlist(); - ucl::Result fillGenlist(); - ucl::Result addGenlistTitleItem(); - ucl::Result addGenlistTextItem(AcceptDialogEvent event); - ucl::Result addGenlistBottomItem(); - - void handleEvent(AcceptDialogEvent event); - bool dispatchEvent(AcceptDialogEvent event); - - void onPopupDismissed(ucl::Widget &widget, void *eventInfo); - void onPopupHWBackKey(Evas_Object *obj, void *eventInfo); - - void onGenlistItemClickedCb(Evas_Object *obj, void *eventInfo); - - private: - ucl::StyledWidgetSRef m_popup; - ucl::StyledWidgetSRef m_genlist; - AcceptDialogHandler m_handler; - AcceptDialogSRef m_selfRef; - bool m_isDismissed; - }; - -} - -#endif // __CALLUI_VIEW_ACCEPT_DIALOG_H__ diff --git a/inc/presenters/AcceptRejectPresenter.h b/inc/presenters/AcceptRejectPresenter.h deleted file mode 100644 index fd477e9..0000000 --- a/inc/presenters/AcceptRejectPresenter.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_ACCEPT_REJECT_PRESENTER_H__ -#define __CALLUI_PRESENTERS_ACCEPT_REJECT_PRESENTER_H__ - -#include "ucl/mvp/GuiPresenter.h" - -#include "ucl/gui/Layout.h" -#include "ucl/gui/StyledWidget.h" - -#include "types.h" - -namespace callui { - - class AcceptRejectPresenter final : public ucl::GuiPresenter { - public: - class Builder { - public: - Builder(); - ~Builder(); - Builder &setIncomingCall(const IIncomingCallSRef &call); - Builder &setSoundManager(const ISoundManagerSRef &sm); - Builder &setAvailableCallsFlag(CallMask calls); - Builder &setParentWidget(const ucl::ElmWidgetSRef &parentWidget); - AcceptRejectPresenterSRef build(ucl::GuiPresenter &parent) const; - - private: - IIncomingCallSRef m_call; - CallMask m_callMask; - ucl::ElmWidgetSRef m_parentWidget; - ISoundManagerSRef m_sm; - }; - - public: - virtual ~AcceptRejectPresenter(); - - ucl::Widget &getWidget(); - - void update(CallMask calls); - - private: - friend class ucl::ReffedObj<AcceptRejectPresenter>; - AcceptRejectPresenter(ucl::IRefCountObj &rc, - const IIncomingCallSRef &call, - CallMask calls, - const ISoundManagerSRef &sm); - - ucl::Result prepare(ucl::GuiPresenter &parent, - ucl::ElmWidget &parentWidget); - - ucl::Result createWidget(ucl::ElmWidget &parent); - ucl::Result createMotionSensorPresenter(); - - void showPopup(); - - void processAccept(); - void processReject() const; - - void onMotionEvent(); - - bool onAcceptPopupEvent(AcceptDialog &popup, AcceptDialogEvent event); - void onAcceptEvent(); - void onRejectEvent(); - void onBTHeadsetConnectionChanged(); - - // GuiPresenter - virtual void onActivate() final override; - virtual void onDeactivate() final override; - - private: - AcceptRejectWidgetSRef m_widget; - AcceptDialogWRef m_popup; - MotionSensorPresenterSRef m_motionPrs; - - IIncomingCallSRef m_call; - CallMask m_callMask; - ISoundManagerSRef m_sm; - }; -} - - - -#endif // __CALLUI_PRESENTERS_ACCEPT_REJECT_PRESENTER_H__ diff --git a/inc/presenters/AccessoryPresenter.h b/inc/presenters/AccessoryPresenter.h deleted file mode 100644 index 1cd131a..0000000 --- a/inc/presenters/AccessoryPresenter.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_ACCESSORY_PRESENTER_H__ -#define __CALLUI_PRESENTERS_ACCESSORY_PRESENTER_H__ - -#include "ucl/mvp/GuiPresenter.h" - -#include "ucl/gui/Layout.h" -#include "ucl/gui/StyledWidget.h" - -#include <app_control.h> - -#include "types.h" - -namespace callui { - - class AccessoryPresenter final : public ucl::GuiPresenter { - public: - class Builder { - public: - Builder(); - Builder &setSoundManager(const ISoundManagerSRef &sm); - Builder &setCallManager(const ICallManagerSRef &cm); - Builder &setRequestExitHandler(const NotiHandler &handler); - Builder &setParentWidget(const ucl::ElmWidgetSRef &parentWidget); - AccessoryPresenterSRef build(ucl::GuiPresenter &parent) const; - - private: - ISoundManagerSRef m_sm; - ICallManagerSRef m_cm; - ucl::ElmWidgetSRef m_parentWidget; - NotiHandler m_exitHandler; - }; - - public: - virtual ~AccessoryPresenter(); - - ucl::Widget &getWidget(); - void hideVolumeControls(); - ucl::Result update(const ICallManagerSRef &cm); - - private: - enum class ComponentsMode { - UNDEFINED, - OUTGOING, - DURING, - END - }; - private: - friend class ucl::ReffedObj<AccessoryPresenter>; - AccessoryPresenter(ucl::IRefCountObj &rc, const ISoundManagerSRef &sm, - const NotiHandler &handler); - - ucl::Result prepare(ucl::GuiPresenter &parent, - ucl::ElmWidget &parentWidget, const ICallManagerSRef &cm); - - ucl::Result createWidget(ucl::ElmWidget &parent); - ucl::Result createSlider(); - ucl::Result createVolumeControl(); - - ucl::Result createVolumeBtn(); - ucl::Result createMuteBtn(); - ucl::Result createBluetoothBtn(); - ucl::Result createAddContactBtn(); - - void onVolumeBtnClicked(ucl::Widget &widget, void *eventInfo); - void onMuteBtnClicked(ucl::Widget &widget, void *eventInfo); - void onBluetoothBtnClicked(ucl::Widget &widget, void *eventInfo); - void onAddContactBtnClicked(ucl::Widget &widget, void *eventInfo); - - ucl::Result launchContacts(); - ucl::Result launchBluetoothSettings(); - - void registerCallbacks(); - void unregisterCallbacks(); - void onVolumeControlEventCb(VolumeControlEvent event); - Eina_Bool onRotaryEvent(Eext_Rotary_Event_Info *info); - - void tryIncreaseVolume(); - void tryDecreaseVolume(); - - void onAudioStateChanged(AudioStateType state); - void onVolumeLevelChanged(int value); - void onMuteStateChanged(bool isMuted); - void updateMuteBtn(bool isMuted); - - Eina_Bool onVCTimerCb(); - void startVCTimer(); - void restartVCTimer(); - void stopVCTimer(); - - void updateVolume(int value); - - void updateMode(const ICallManagerSRef &cm); - AccessoryPresenter::ComponentsMode getCurrentMode(const ICallManagerSRef &cm); - void setVolumeSliderVisiblity(bool isVisible); - - ucl::Result updateModeRelativeComponents(const ICallManagerSRef &cm); - ucl::Result setActiveCallCompomnents(); - ucl::Result setEndCallCompomnents(const ICallManagerSRef &cm); - - private: - ucl::LayoutSRef m_widget; - ucl::StyledWidgetSRef m_volumeBtn; - ucl::StyledWidgetSRef m_muteBtn; - ucl::StyledWidgetSRef m_bluetoothBtn; - ucl::StyledWidgetSRef m_addContactBtn; - - SliderSRef m_slider; - VolumeControlSRef m_vc; - ISoundManagerSRef m_sm; - - Ecore_Timer *m_vcTimer; - AudioStateType m_audioState; - ComponentsMode m_mode; - std::string m_unsavedPhoneNumber; - NotiHandler m_exitHandler; - }; -} - - - -#endif // __CALLUI_PRESENTERS_ACCESSORY_PRESENTER_H__ diff --git a/inc/presenters/CallInfoPresenter.h b/inc/presenters/CallInfoPresenter.h deleted file mode 100644 index c7bc82c..0000000 --- a/inc/presenters/CallInfoPresenter.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_CALL_INFO_PRESENTER_H__ -#define __CALLUI_PRESENTERS_CALL_INFO_PRESENTER_H__ - -#include "ucl/mvp/GuiPresenter.h" - -#include "ucl/gui/Layout.h" -#include "ucl/gui/StyledWidget.h" - -#include "types.h" - -namespace callui { - - class CallInfoPresenter final : public ucl::GuiPresenter { - public: - class Builder { - public: - Builder(); - virtual ~Builder(); - Builder &setCallManager(const ICallManagerSRef &cm); - Builder &setMode(CallMode mode); - Builder &setParentWidget(const ucl::ElmWidgetSRef &parentWidget); - CallInfoPresenterSRef build(ucl::GuiPresenter &parent) const; - private: - ICallManagerSRef m_cm; - CallMode m_mode; - ucl::ElmWidgetSRef m_parentWidget; - }; - - public: - virtual ~CallInfoPresenter(); - - ucl::Widget &getWidget(); - CallMode getMode() const; - ucl::Result update(CallMode mode, const ICallManagerSRef &cm); - - private: - friend class ucl::ReffedObj<CallInfoPresenter>; - CallInfoPresenter(ucl::IRefCountObj &rc, - const ICallManagerSRef &cm, - CallMode mode); - - ucl::Result prepare(ucl::GuiPresenter &parent, - ucl::ElmWidget &parentWidget); - - void initCallInfos(const ICallManagerSRef &cm); - - ucl::Result createWidget(ucl::ElmWidget &parent); - ucl::Result createLabel(const std::string &text); - ucl::Result createCallerIdImage(const std::string &imagePath); - ucl::Result createCallStatus(ucl::GuiPresenter &parent); - - ucl::Result update(); - ucl::Result updateCallerId(); - ucl::Result updateSubText(); - ucl::Result updateMainTxt(); - - std::string getNumberSubText(const ICallInfoSCRef &callInfo) const; - std::string getIncomingCallSubText() const; - std::string getOutgoingCallSubText() const; - std::string getDuringCallSubText() const; - std::string getEndCallSubText() const; - - std::string generateMainTxt(const ICallInfoSCRef &callInfo); - - void displayMainTxt(const ICallInfoSCRef &info, const std::string &text) const; - private: - ucl::LayoutSRef m_widget; - ucl::StyledWidgetSRef m_callerId; - ucl::StyledWidgetSRef m_label; - ucl::GuiPresenterWRef m_parent; - CallMode m_mode; - ICallInfoSCRef m_incomCallInfo; - ICallInfoSCRef m_activeCallInfo; - ICallInfoSCRef m_heldCallInfo; - ICallInfoSCRef m_endCallInfo; - CallStatusPresenterSRef m_callStatus; - bool m_isSubTxtEnable; - bool m_needModifyCallStatus; - }; - -} - -#endif // __CALLUI_PRESENTERS_CALL_INFO_PRESENTER_H__ diff --git a/inc/presenters/CallStatusPresenter.h b/inc/presenters/CallStatusPresenter.h deleted file mode 100644 index 0f788b3..0000000 --- a/inc/presenters/CallStatusPresenter.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_CALL_STATUS_PRESENTER_H__ -#define __CALLUI_PRESENTERS_CALL_STATUS_PRESENTER_H__ - -#include "ucl/mvp/GuiPresenter.h" - -#include <time.h> - -#include "ucl/gui/Layout.h" - -#include "types.h" - -namespace callui { - - class CallStatusPresenter final : public ucl::GuiPresenter { - public: - class Builder { - public: - Builder(); - virtual ~Builder(); - Builder &setMode(CallMode mode); - Builder &setCallInfo(const ICallInfoWCRef &info); - Builder &setCallHoldState(bool isOnHold); - Builder &setLayout(const ucl::LayoutSRef &layout); - CallStatusPresenterSRef build(ucl::GuiPresenter &parent) const; - private: - ucl::LayoutSRef m_ly; - CallMode m_mode; - ICallInfoWCRef m_info; - bool m_isOnHold; - }; - public: - virtual ~CallStatusPresenter(); - - private: - friend class ucl::ReffedObj<CallStatusPresenter>; - CallStatusPresenter(ucl::IRefCountObj &rc, - const ucl::LayoutSRef &layout, - CallMode mode, - const ICallInfoWCRef &info, - bool isOnHold); - - ucl::Result prepare(ucl::GuiPresenter &parent); - - ucl::Result processIncomingMode(); - ucl::Result processOutgoingMode(); - ucl::Result processDuringMode(); - ucl::Result processEndMode(); - - Eina_Bool onCallDurationTimerCb(); - Eina_Bool onBlinkingTimerCb(); - - private: - ucl::LayoutSRef m_ly; - CallMode m_mode; - ICallInfoWCRef m_info; - bool m_isOnHold; - Ecore_Timer *m_timer; - struct tm m_duration; - int m_blinkCount; - }; - -} - -#endif // __CALLUI_PRESENTERS_CALL_STATUS_PRESENTER_H__ diff --git a/inc/presenters/DeviceStatePresenter.h b/inc/presenters/DeviceStatePresenter.h deleted file mode 100644 index 217ddb2..0000000 --- a/inc/presenters/DeviceStatePresenter.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_DEVICE_STATE_PRESENTER_H__ -#define __CALLUI_PRESENTERS_DEVICE_STATE_PRESENTER_H__ - -#include "ucl/gui/Window.h" - -#include "types.h" - -namespace callui { - - class DeviceStatePresenter final { - public: - class Builder { - public: - Builder(); - Builder &setDisplayState(DisplayState state); - Builder &setDisplayMode(DisplayMode mode); - Builder &setCpuLockState(bool lockState); - DeviceStatePresenterSRef build( - const ucl::WindowSRef &window) const; - private: - DisplayState m_state; - DisplayMode m_mode; - bool m_lockState; - }; - - public: - ucl::Result setDisplayState(DisplayState state, - bool forse = false); - ucl::Result setDisplayMode(DisplayMode mode); - ucl::Result setCpuLockState(bool lockState); - - private: - friend class ucl::ReffedObj<DeviceStatePresenter>; - DeviceStatePresenter(const ucl::WindowSRef &window); - ~DeviceStatePresenter() = default; - - ucl::Result prepare(DisplayState state, - DisplayMode mode, - bool lockState); - - private: - ucl::WindowSRef m_window; - DisplayMode m_mode; - bool m_lockState; - }; -} - -#endif // __CALLUI_PRESENTERS_DEVICE_STATE_PRESENTER_H__ diff --git a/inc/presenters/KeypadPage.h b/inc/presenters/KeypadPage.h deleted file mode 100644 index 027ce64..0000000 --- a/inc/presenters/KeypadPage.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_KEYPAD_PAGE_H__ -#define __CALLUI_PRESENTERS_KEYPAD_PAGE_H__ - -#include "Page.h" - -#include "ucl/gui/Layout.h" -#include "ucl/gui/NaviItem.h" - -#include "types.h" - -#include "model/ISoundManager.h" - -namespace callui { - - class KeypadPage final : public Page { - public: - class Builder { - public: - Builder(); - ~Builder(); - Builder &setNaviframe(const ucl::NaviframeSRef &navi); - Builder &setSoundManager(const ISoundManagerSRef &sm); - KeypadPageSRef build(const ExitRequestHandler onExitRequest) const; - private: - ISoundManagerSRef m_sm; - ucl::NaviframeSRef m_navi; - }; - - private: - friend class ucl::ReffedObj<KeypadPage>; - KeypadPage(ucl::IRefCountObj &rc, - const ISoundManagerSRef &sm, - const ucl::NaviframeSRef &navi, - const ExitRequestHandler onExitRequest); - virtual ~KeypadPage(); - - ucl::Result doPrepare(ucl::NaviItem &item); - - void onBtnPressed(ucl::Widget &widget, void *eventInfo); - void onBtnUnpressed(ucl::Widget &widget, void *eventInfo); - void onBtnClicked(ucl::Widget &widget, void *eventInfo); - - ucl::Result createWidget(); - ucl::Result createEntry(); - ucl::Result createButtons(); - ucl::Result createVolumeControl(); - - void startDtmf(const unsigned char digit); - void stopDtmf(); - - void onAudioStateChanged(AudioStateType state); - void onVolumeControlEventCb(VolumeControlEvent event); - Eina_Bool onVCTimerCb(); - void startVCTimer(); - void restartVCTimer(); - void stopVCTimer(); - void tryIncreaseVolume(); - void tryDecreaseVolume(); - void updateVolume(int value); - void onVolumeLevelChanged(int value); - Eina_Bool onRotaryEvent(Eext_Rotary_Event_Info *info); - - void registerCallbacks(); - void unregisterCallbacks(); - - // Page - - virtual void onBackKey() override final; - - private: - ucl::LayoutSRef m_widget; - ucl::ElmWidgetSRef m_entry; - - ISoundManagerSRef m_sm; - bool m_smInUse; - - VolumeControlSRef m_vc; - Ecore_Timer *m_vcTimer; - - AudioStateType m_audioState; - }; -} - -#endif // __CALLUI_PRESENTERS_KEYPAD_PAGE_H__ diff --git a/inc/presenters/MainPage.h b/inc/presenters/MainPage.h deleted file mode 100644 index 6366dea..0000000 --- a/inc/presenters/MainPage.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_MAIN_PAGE_H__ -#define __CALLUI_PRESENTERS_MAIN_PAGE_H__ - -#include "Page.h" -#include "model/ICallListener.h" - -#include "ucl/gui/Layout.h" -#include "ucl/gui/StyledWidget.h" -#include "ucl/gui/NaviItem.h" - -#include "types.h" - -namespace callui { - - class MainPage final : public Page, - public ICallListener { - public: - class Builder { - public: - Builder(); - ~Builder(); - Builder &setNaviframe(const ucl::NaviframeSRef &navi); - Builder &setCallUI(const ICallUISRef &call); - MainPageSRef build(const ExitRequestHandler handler) const; - private: - ucl::NaviframeSRef m_navi; - ICallUISRef m_call; - }; - - private: - friend class ucl::ReffedObj<MainPage>; - MainPage(ucl::IRefCountObj &rc, - const ucl::NaviframeSRef &navi, - const ExitRequestHandler handler, - const ICallUISRef &call); - virtual ~MainPage(); - - ucl::Result doPrepare(ucl::NaviItem &item); - - ucl::Result showWindow(); - void updateCallMode(); - - ucl::Result processIncomingCallMode(); - ucl::Result processEndCallMode(); - ucl::Result processRegularCallModes(); - - ucl::Result createCallInfoPresenter(CallMode mode); - ucl::Result createAccessoryPresenter(); - ucl::Result createMoreOptionsPresenter(); - ucl::Result createAcceptRejectPresenter(); - ucl::Result createRejectMsgPresenter( - const IRejectMsgProviderSRef &provider); - - void RejectMsgStateCb(RejectMsgState state); - void RejectMsgSelectCb(const IRejectMsgSRef &rm); - - ucl::Result createBottomBtn(const ucl::ElmStyle &style); - void onBottomBtnClicked(ucl::Widget &widget, void *eventInfo); - - void startEndCallTimer(); - void stopEndCallTimer(); - Eina_Bool onEndCallTimerCb(); - - void onPowerKeyUp(ucl::Widget &widget, void *eventInfo); - void processKeyPress(); - - bool detectMuteControlDisableState(); - - ucl::Result updateDeviceState(CallMode prevMode, CallMode curMode); - - ucl::Result createWidget(); - ucl::Result createIndicatorPresenter(); - ucl::Result createDisplayPresenter(); - - void onExitAppRequest(); - - // Page - - virtual void onBackKey() final override; - - // ICallListener - - virtual void onCallEvent(CallEventType type) final override; - virtual void onError(CallErr err) final override; - - private: - ucl::LayoutSRef m_widget; - ucl::LayoutSRef m_rmLy; - ucl::StyledWidgetSRef m_bottomBtn; - - ICallUISRef m_call; - ICallManagerSRef m_cm; - IndicatorPresenterSRef m_indicator; - CallInfoPresenterSRef m_callInfoPrs; - AcceptRejectPresenterSRef m_acceptRejectPrs; - RejectMsgPresenterSRef m_rmPrs; - AccessoryPresenterSRef m_accessoryPrs; - MoreOptionsPresenterSRef m_moreOptionsPrs; - DeviceStatePresenterSRef m_devicePrs; - - CallMode m_mode; - Ecore_Timer *m_ecTimer; - bool m_ecTimerBtnReq; - }; -} - -#endif // __CALLUI_PRESENTERS_MAIN_PAGE_H__ diff --git a/inc/presenters/MoreOptionsPresenter.h b/inc/presenters/MoreOptionsPresenter.h deleted file mode 100644 index a4f4a13..0000000 --- a/inc/presenters/MoreOptionsPresenter.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_MORE_OPTIONS_PRESENTER_H__ -#define __CALLUI_PRESENTERS_MORE_OPTIONS_PRESENTER_H__ - -#include "ucl/mvp/GuiPresenter.h" - -#include "ucl/gui/Layout.h" -#include "ucl/gui/StyledWidget.h" -#include "ucl/gui/Naviframe.h" - -#include "Page.h" - -#include "types.h" - -namespace callui { - - class MoreOptionsPresenter final : public ucl::GuiPresenter { - public: - class Builder { - public: - Builder(); - Builder &setCallManager(const ICallManagerSRef &cm); - Builder &setSoundManager(const ISoundManagerSRef &sm); - Builder &setNaviframe(const ucl::NaviframeSRef &navi); - Builder &setParentWidget(const ucl::ElmWidgetSRef &parentWidget); - MoreOptionsPresenterSRef build(ucl::GuiPresenter &parent) const; - private: - ICallManagerSRef m_cm; - ISoundManagerSRef m_sm; - ucl::NaviframeSRef m_navi; - ucl::ElmWidgetSRef m_parentWidget; - }; - - public: - ucl::Widget &getWidget(); - void update(); - - private: - friend class ucl::ReffedObj<MoreOptionsPresenter>; - MoreOptionsPresenter(ucl::IRefCountObj &rc, - const ICallManagerSRef &cm, - const ISoundManagerSRef &sm, - const ucl::NaviframeSRef &navi); - virtual ~MoreOptionsPresenter(); - - ucl::Result prepare(ucl::GuiPresenter &parent, - ucl::ElmWidget &parentWidget); - - ucl::Result createWidget(ucl::ElmWidget &parent); - ucl::Result createPanel(); - ucl::Result createPanelLayout(); - ucl::Result createButtons(); - ucl::StyledWidgetSRef createButton(const ucl::ElmStyle &style, - const ucl::TString &txt, - const ucl::WidgetEventHandler &handler); - - void updateSlots(); - void updateStatusText(); - - void onSwapBtnClick(ucl::Widget &sender, void *eventInfo); - void onUnholdBtnClick(ucl::Widget &sender, void *eventInfo); - void onKeypadBtnClick(ucl::Widget &sender, void *eventInfo); - - void onBackKey(Evas_Object *obj, void *eventInfo); - - void onPanelActivate(Evas_Object *obj, - const char *emission, - const char *source); - void onPanelInactivate(Evas_Object *obj, - const char *emission, - const char *source); - - ucl::Result startCallDurationTimer(); - void stopCallDurationTimer(); - Eina_Bool onCallDurationTimerCb(); - - void unsetPanelContent(const ucl::EdjePart &part); - void setPanelContent(ucl::StyledWidget &widget, - const ucl::EdjePart &part); - - void onPageExitRequest(Page &page); - - private: - ucl::LayoutSRef m_widget; - ucl::StyledWidgetSRef m_panel; - ucl::LayoutSRef m_panelLy; - ucl::StyledWidgetSRef m_btnSwap; - ucl::StyledWidgetSRef m_btnUnhold; - ucl::StyledWidgetSRef m_btnKeypad; - PageWRef m_keypad; - - ICallManagerSRef m_cm; - ISoundManagerSRef m_sm; - ucl::NaviframeSRef m_navi; - - ICallInfoWCRef m_info; - - Ecore_Timer *m_timer; - struct tm m_duration; - }; -} - -#endif // __CALLUI_PRESENTERS_MORE_OPTIONS_PRESENTER_H__ diff --git a/inc/presenters/Page.h b/inc/presenters/Page.h deleted file mode 100644 index b25fc3a..0000000 --- a/inc/presenters/Page.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_PAGE_H__ -#define __CALLUI_PRESENTERS_PAGE_H__ - -#include "ucl/gui/Naviframe.h" - -#include "ucl/mvp/GuiPresenter.h" - -namespace callui { - - UCL_DECLARE_REF_ALIASES(Page); - - class Page : public ucl::GuiPresenter { - public: - using ExitRequestHandler = ucl::WeakDelegate<void(Page &page)>; - - public: - ucl::Naviframe &getNaviframe(); - - bool isAtTop() const; - bool isAtBottom() const; - - void exit(); - void exitNoTransition(); - - void popTo(); - void deleteTo(); - void promote(); - - template <class ...ARGS> - ucl::NaviItem insertAfter(ARGS &&...args); - - template <class ...ARGS> - ucl::NaviItem insertBefore(ARGS &&...args); - - protected: - Page(ucl::IRefCountObj &rc, const ucl::NaviframeSRef &navi, - const ExitRequestHandler &onExitRequest); - virtual ~Page(); - - template <class ON_PREPARE> - ucl::Result prepare(ON_PREPARE &&onPrepare); - - ucl::NaviItem getItem(); - - void requestExit(); - - virtual void onBackKey(); - - private: - ucl::Result preparePart2(); - - void dispatchTopPageChanged(); - - void updateActiveState(); - - void onTransitionStarted(ucl::Widget &widget, void *eventInfo); - void onTransitionFinished(ucl::Widget &widget, void *eventInfo); - void onTopPageChanged(ucl::Widget &widget, void *eventInfo); - - void onHWBackKey(Evas_Object *obj, void *eventInfo); - void onItemDel(Evas_Object *obj, void *eventInfo); - - private: - const ucl::NaviframeSRef m_navi; - const ExitRequestHandler m_onExitRequest; - ucl::NaviItem m_item; - PageSRef m_selfRef; - }; - - // Non-member functions - - bool isLast(const Page &page); -} - -#include "Page.hpp" - -#endif // __CALLUI_PRESENTERS_PAGE_H__ diff --git a/inc/presenters/RejectMsgPresenter.h b/inc/presenters/RejectMsgPresenter.h deleted file mode 100644 index 31740fb..0000000 --- a/inc/presenters/RejectMsgPresenter.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_REJECT_MESSAGE_PRESENTER_H__ -#define __CALLUI_PRESENTERS_REJECT_MESSAGE_PRESENTER_H__ - -#include "ucl/mvp/GuiPresenter.h" - -#include "ucl/gui/Layout.h" -#include "ucl/gui/StyledWidget.h" - -#include "types.h" - -namespace callui { - - class RejectMsgPresenter final : public ucl::GuiPresenter { - public: - class Builder { - public: - Builder(); - virtual ~Builder(); - Builder &setProvider(const IRejectMsgProviderSRef &provider); - Builder &setStateHandler(const RejectMsgStateHandler &handler); - Builder &setSelectHandler(const RejectMsgSelectHandler &handler); - Builder &setParentWidget(const ucl::ElmWidgetSRef &parentWidget); - RejectMsgPresenterSRef build(ucl::GuiPresenter &parent) const; - - private: - IRejectMsgProviderSRef m_provider; - RejectMsgStateHandler m_stateHandler; - RejectMsgSelectHandler m_selectHandler; - ucl::ElmWidgetSRef m_parentWidget; - }; - - public: - virtual ~RejectMsgPresenter(); - - ucl::Widget &getWidget(); - - RejectMsgState getState(); - - void hidePanel(); - - void setStateHandler(const RejectMsgStateHandler &handler); - void setSelectHandler(const RejectMsgSelectHandler &handler); - - private: - class RejectMsgItem; - - private: - friend class ucl::ReffedObj<RejectMsgPresenter>; - RejectMsgPresenter(ucl::IRefCountObj &rc, - const IRejectMsgProviderSRef &provider, - const RejectMsgStateHandler &stateHandler, - const RejectMsgSelectHandler &selectHandler); - - ucl::Result prepare(ucl::GuiPresenter &parent, - ucl::ElmWidget &parentWidget); - - ucl::Result createWidget(ucl::ElmWidget &parent); - ucl::Result createPanel(); - ucl::Result createPanelBg(); - ucl::Result createPanelLy(); - ucl::Result createGenlist(); - ucl::Result fillGenlist(); - - ucl::Result addGenlistTitleItem(); - ucl::Result addGenlistTextItem(const IRejectMsgSRef &rm); - ucl::Result addGenlistBottomItem(); - - void onGenlistItemClickedCb(Evas_Object *obj, void *eventInfo); - void handleSelectEvent(const RejectMsgItem &item); - - void panelScrollCb(ucl::Widget &widget, void *eventInfo); - - void activateRotary(); - void deactivateRotary(); - - void onBackKey(Evas_Object *obj, void *eventInfo); - - // Presenter - - virtual void onActivate() final override; - virtual void onDeactivate() final override; - - private: - ucl::LayoutSRef m_widget; - ucl::StyledWidgetSRef m_panel; - ucl::ElmWidgetSRef m_panelBg; - ucl::LayoutSRef m_panelLy; - ucl::StyledWidgetSRef m_genlist; - Evas_Object *m_circleEo; - - IRejectMsgProviderSRef m_provider; - RejectMsgStateHandler m_stateHandler; - RejectMsgSelectHandler m_selectHandler; - RejectMsgState m_state; - - }; - -} - -#endif // __CALLUI_PRESENTERS_REJECT_MESSAGE_PRESENTER_H__ diff --git a/inc/presenters/types.h b/inc/presenters/types.h deleted file mode 100644 index eea785e..0000000 --- a/inc/presenters/types.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_TYPES_H__ -#define __CALLUI_PRESENTERS_TYPES_H__ - -#include "../types.h" - -#include "view/types.h" -#include "model/types.h" - -namespace callui { - - enum class AcceptDialogEvent { - HOLD_AND_ACCEPT, - END_AND_ACCEPT, - BACK - }; - - enum class CallMode { - UNDEFINED, - INCOMING, - OUTGOING, - DURING, - END - }; - - enum class RejectMsgState { - HIDDEN, - IN_TRANSITION, - SHOWN - }; - - enum class DisplayState { - UNDEFINED, - ON, - OFF, - DIM - }; - - enum class DisplayMode { - UNDEFINED, - REGULAR, - TOP_PRIORITY - }; - - using AccessoryBtnMask = int; - - UCL_DECLARE_REF_ALIASES(Page); - - UCL_DECLARE_REF_ALIASES(MainPage); - UCL_DECLARE_REF_ALIASES(KeypadPage); - - UCL_DECLARE_REF_ALIASES(AcceptRejectPresenter); - UCL_DECLARE_REF_ALIASES(AcceptDialog); - - UCL_DECLARE_REF_ALIASES(IndicatorPresenter); - UCL_DECLARE_REF_ALIASES(CallInfoPresenter); - UCL_DECLARE_REF_ALIASES(CallStatusPresenter); - - UCL_DECLARE_REF_ALIASES(RejectMsgPresenter); - - UCL_DECLARE_REF_ALIASES(AccessoryPresenter); - UCL_DECLARE_REF_ALIASES(MoreOptionsPresenter); - - UCL_DECLARE_REF_ALIASES(DeviceStatePresenter); - UCL_DECLARE_REF_ALIASES(MotionSensorPresenter); - - using AcceptDialogHandler = ucl::WeakDelegate<bool(AcceptDialog &, AcceptDialogEvent)>; - using RejectMsgStateHandler = ucl::WeakDelegate<void(RejectMsgState)>; - using RejectMsgSelectHandler = ucl::WeakDelegate<void(const IRejectMsgSRef &rm)>; - using MotionSensorHandler = ucl::WeakDelegate<void()>; -} - -#endif // __CALLUI_PRESENTERS_TYPES_H__ diff --git a/inc/view/VolumeControl.h b/inc/view/VolumeControl.h deleted file mode 100644 index d8299d4..0000000 --- a/inc/view/VolumeControl.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 __CALLUI_VIEW_VOLUME_CONTROL_H__ -#define __CALLUI_VIEW_VOLUME_CONTROL_H__ - -#include "view/Slider.h" - -#include "ucl/gui/StyledWidget.h" -#include "ucl/gui/Layout.h" - -#include "types.h" - -namespace callui { - - class VolumeControl final : public Slider { - public: - class Builder { - public: - Builder(); - Builder &setInfoText(const ucl::TString &info); - Builder &setMaxValue(int maxValue); - Builder &setValue(int curValue); - Builder &setEventHandler(const VolumeControlEventHandler &handler); - VolumeControlSRef build(ucl::ElmWidget &parent) const; - - private: - ucl::TString m_info; - int m_maxValue; - int m_curValue; - VolumeControlEventHandler m_handler; - }; - - public: - void setInfoText(const ucl::TString &info); - void setDecreaseBtnEnable(bool isEnable); - void setIncreaseBtnEnable(bool isEnable); - void setEventHandler(const VolumeControlEventHandler &handler); - - // Slider - - virtual void setValue(int value) override final; - - private: - friend class ucl::ReffedObj<VolumeControl>; - VolumeControl(ucl::IRefCountObj &rc, - const ucl::LayoutSRef &layout, - const ucl::TString &info, - int maxValue, - int curValue, - const VolumeControlEventHandler &handler); - - virtual ~VolumeControl(); - - void prepare(const ucl::TString &info, int curValue); - - void onDecreaseBtnClickedCb(ucl::Widget &widget, void *eventInfo); - void onIncreaseBtnClickedCb(ucl::Widget &widget, void *eventInfo); - - private: - ucl::StyledWidget m_decreaseBtn; - ucl::StyledWidget m_increaseBtn; - VolumeControlEventHandler m_handler; - }; - -} - -#endif // __CALLUI_VIEW_VOLUME_CONTROL_H__ diff --git a/inc/view/helpers.h b/inc/view/helpers.h deleted file mode 100644 index d0d3395..0000000 --- a/inc/view/helpers.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 __CALLUI_VIEW_HELPERS_H__ -#define __CALLUI_VIEW_HELPERS_H__ - -#include <efl_extension.h> - -#include "types.h" - -namespace ucl { - - class ElmWidget; - class Naviframe; -} - -namespace callui { - - ucl::Result createCircleSurface(ucl::Naviframe &navi); - - Eext_Circle_Surface *getCircleSurface(const ucl::ElmWidget &widget); - - void addRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data); - - void delRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data); - - Elm_Genlist_Item_Class createGenlistItemClass(const char *style, - Elm_Gen_Item_Text_Get_Cb txtCb = nullptr, - Elm_Gen_Item_Content_Get_Cb contentCb = nullptr, - Elm_Gen_Item_State_Get_Cb stateCb = nullptr, - Elm_Gen_Item_Del_Cb delCb = nullptr); - - ucl::LayoutTheme getImageTheme(const char *fileName); -} - -#endif // __CALLUI_VIEW_HELPERS_H__ diff --git a/project_def.prop b/project_def.prop index 1fe3c17..24fe320 100644 --- a/project_def.prop +++ b/project_def.prop @@ -9,13 +9,13 @@ type = app profile = wearable-4.0 # C/CPP Sources -USER_SRCS = ucl/src/gui/WidgetItem.cpp src/presenters/InstanceManager.cpp ucl/src/appfw/UIApp.cpp src/model/VoiceControlStateProvider.cpp src/presenters/AcceptDialog.cpp ucl/src/gui/NaviItem.cpp ucl/src/gui/Layout.cpp src/model/IncomingCall.cpp src/presenters/Page.cpp src/resources.cpp src/presenters/DeviceStatePresenter.cpp src/model/ContactInfoProvider.cpp ucl/src/gui/Genlist.cpp ucl/src/gui/Window.cpp src/types.cpp src/presenters/RejectMsgPresenter.cpp src/model/ConnectionStateSource.cpp src/presenters/AccessoryPresenter.cpp src/model/ContactInfo.cpp src/model/EndCall.cpp src/presenters/MainPage.cpp src/view/helpers.cpp ucl/src/mvp/ListItemPresenter.cpp ucl/src/util/types/Result.cpp ucl/src/mvp/ListPresenter.cpp ucl/src/misc/Variant.cpp src/model/CallUI.cpp ucl/src/mvp/GuiPresenter.cpp src/view/VolumeControl.cpp src/view/Slider.cpp src/model/CallInfo.cpp ucl/src/gui/ElmWidget.cpp src/model/SimSlotStateSource.cpp src/presenters/AcceptRejectPresenter.cpp ucl/src/gui/EdjeWidget.cpp ucl/src/gui/Naviframe.cpp src/model/CallManager.cpp ucl/src/misc/Timeout.cpp src/presenters/Instance.cpp ucl/src/gui/Widget.cpp src/model/ActiveCall.cpp src/model/RejectMsgProvider.cpp src/presenters/MoreOptionsPresenter.cpp ucl/src/appfw/SysEventProvider.cpp src/presenters/CallInfoPresenter.cpp src/model/BatteryStateSource.cpp src/model/CallClient.cpp src/model/VoiceControlStateSource.cpp src/model/RssiStateSource.cpp src/model/HdVoiceStateSource.cpp ucl/src/util/logging.cpp src/model/IndicatorStateProvider.cpp src/presenters/KeypadPage.cpp src/presenters/helpers.cpp src/presenters/MotionSensorPresenter.cpp src/main.cpp src/model/MsgClient.cpp src/presenters/IndicatorPresenter.cpp ucl/src/appfw/helpers.cpp src/model/CallUIBuilder.cpp src/presenters/CallStatusPresenter.cpp src/model/ConferenceCallInfo.cpp src/model/HeldCall.cpp src/model/SoundManager.cpp src/model/BluetoothManager.cpp src/model/RejectMsg.cpp src/view/AcceptRejectWidget.cpp ucl/src/appfw/InstanceManagerBase.cpp +USER_SRCS = call-ui/presenters/dialogs/base/Dialog.cpp call-ui/view/VolumeControl.cpp call-ui/model/impl/CallInfo.cpp call-ui/presenters/items/SimpleListItem.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/presenters/items/RejectMsgListItem.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/view/AoSequencer.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 call-ui/presenters/misc/VolumeControlPresenter.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 = # PO Sources -USER_POS = +USER_POS = res/po/is.po res/po/ka.po res/po/ko_KR.po res/po/ro.po res/po/it_IT.po res/po/en_PH.po res/po/ru_RU.po res/po/el_GR.po res/po/pt_BR.po res/po/cs.po res/po/hr.po res/po/pl.po res/po/uk.po res/po/en_US.po res/po/sr.po res/po/ga.po res/po/hy.po res/po/lv.po res/po/da.po res/po/ja_JP.po res/po/bg.po res/po/zh_CN.po res/po/de.po res/po/sl.po res/po/sk.po res/po/lt.po res/po/mk.po res/po/nb.po res/po/zh_TW.po res/po/sv.po res/po/uz.po res/po/hu.po res/po/ar.po res/po/fi.po res/po/zh_HK.po res/po/tr_TR.po res/po/ca.po res/po/nl.po res/po/pt_PT.po res/po/gl.po res/po/en.po res/po/es_US.po res/po/hi.po res/po/es_ES.po res/po/fr_CA.po res/po/eu.po res/po/kk.po res/po/et.po res/po/fr.po res/po/az.po # User Defines USER_DEFS = @@ -36,7 +36,7 @@ USER_OBJS = USER_C_INC_DIRS = USER_INC_FILES = ## C++ Compiler -USER_CPP_INC_DIRS = inc ucl/inc +USER_CPP_INC_DIRS = . ucl/include USER_CPP_INC_FILES = USER_INC_DIRS = $(USER_C_INC_DIRS) $(USER_CPP_INC_DIRS) @@ -46,16 +46,16 @@ USER_LIB_DIRS = # EDC Resource Path USER_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edc/images -USER_EDCS_SOUND_DIRS = -USER_EDCS_FONT_DIRS = +USER_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edc/sounds +USER_EDCS_FONT_DIRS = ${OUTPUT_DIR} edc/fonts # EDC Flags USER_EXT_EDC_KEYS = EDC0 USER_EXT_EDC0_EDCS = res/edje/theme.edc USER_EXT_EDC0_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edc/images -USER_EXT_EDC0_EDCS_SOUND_DIRS = -USER_EXT_EDC0_EDCS_FONT_DIRS = +USER_EXT_EDC0_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edc/sounds +USER_EXT_EDC0_EDCS_FONT_DIRS = ${OUTPUT_DIR} edc/fonts # Resource Filter USER_RES_INCLUDE = diff --git a/res/po/ar.po b/res/po/ar.po new file mode 100644 index 0000000..b99d53f --- /dev/null +++ b/res/po/ar.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "عذراً، أنا أقود الآن." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "لا يمكنني التحدث الآن. ما أخبارك؟" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "عذراً، أنا مشغول. سأتصل بك لاحقاً." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "عذراً، أنا مشغول. يرجى إرسال رسالة نصية إلي." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "أنا في اجتماع." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "إنهاء المكالمة" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "كتم" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "مع %d من الأشخاص" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "اتصال" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "اجتماع" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "خفض مستوى الصوت" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "رفع مستوى الصوت" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "قم بتدوير الإطار لتعديل %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "لوحة المفاتيح" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "الرد على المكالمة" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "تعليق وقبول" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "إنهاء وقبول" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "سيتم إنهاء المكالمة مع %s." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "المكالمة قيد التعليق" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "غير معروف" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "مكالمة الطوارئ" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "البريد الصوتي" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "مكالمة واردة" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "التبديل" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "جاري الاتصال" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "قيد التعليق" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "تم إنهاء المكالمة" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "رفض الرسائل" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "مستوى الصوت" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "لوحة المفاتيح" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "إلغاء التعليق" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "اتصال" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "مزيد من الخيارات" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "إضافة لجهات الاتصال" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "قبول المكالمة" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "رفض المكالمة" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "اسحب لليسار بإصبعين لرفض المكالمة." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "اسحب نحو الأعلى بإصبعين لإرسال رسالة رفض." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "اسحب لليمين بإصبعين لقبول المكالمة." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "سماعة الرأس" + diff --git a/res/po/az.po b/res/po/az.po new file mode 100644 index 0000000..6057943 --- /dev/null +++ b/res/po/az.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "İndi sükan arxasındayam." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Danışa bilmirəm. Nə baş verib?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Üzr ist, məşğ. Sonra zng ed." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Məşğulam. Mənə sms yaz." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Mən görüşdəyəm." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Zng btrn" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Səssiz" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d nəfərlə" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Zəng" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konfrans" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Səs səviyyəsini azalt" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Səs səviyyəsini artır" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "%s tənzimləmək üçün pəncərəni saat əqrəbi istiqamətində fırlat." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Klaviatura" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Zng cvb vr" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Gözl və qəb et" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Bit və qəb et" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%s zəng sona çatq." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Zəng gözl" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Naməlum" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Fövqəladə zəng" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Səsli poçt" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Dax ol zng" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Dəyişdir" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Yığılır" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Gözləmədə" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Zəng bitdi" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Mesajl rədd edin" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Səs" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Klaviatr" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Gözlətmə" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Zəng" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Daha çox seçim" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Kontaktlara əlavə et" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Zəngi qəbul et" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Zəngi rədd et" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Zəngi rədd etmək üçün iki barmağınızla sola sürüşdürün." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Rədd mesajı göndərmək üçün iki barmağınızla yuxarı sürüşdürün." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Zəngə cavab vermək üçün iki barmağınızla sağa sürüşdürün." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Qulaqlıq" + diff --git a/res/po/bg.po b/res/po/bg.po new file mode 100644 index 0000000..d1aad6d --- /dev/null +++ b/res/po/bg.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Съжалявам, сега шофирам." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Не мога да говоря. Какво става?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Имам работа. Ще се обадя после." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Не мога в момента. Пиши ми." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "На събрание съм." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Край рзг" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Заглуш." + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "С %d души" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Повикване" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Конферентен" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Намаляване на силата на звука" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Увеличаване на силата на звука" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Завъртете безела за регулиране на %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Клавиатура" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Отг. повикв." + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Задър. и прием." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Край и приемане" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Разг. с %s ще свърши." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Задърж. разговор" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Няма информация" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Спешно повикв." + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Гласова поща" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Входящо пов." + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Смяна" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Набиране" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "На задържане" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Край разговор" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Съобщ. за отхв." + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Сила звук" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Клавиатура" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Освобождаване" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Повикване" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Още опции" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Доб. в указателя" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Приемане на повикване" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Отказване на повикване" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Плъзнете наляво с два пръста, за да отхвърлите повикване." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Плъзнете нагоре с два пръста, за да изпратите съобщение за отказ." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Плъзнете надясно с два пръста, за да приемете повикване." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Слушалка" + diff --git a/res/po/ca.po b/res/po/ca.po new file mode 100644 index 0000000..6aef9a8 --- /dev/null +++ b/res/po/ca.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Estic conduint." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "No puc parlar. Què passa?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Estic ocupat. Et truco més tard." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Estic ocupat. Envia un missatge." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Sóc a una reunió." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Fi truc" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Silenci" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Amb %d persones" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Trucar" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conferència" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Disminuir volum" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Augmentar volum" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Giri el bisell per ajustar %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Teclat" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Respon truca" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Espera i accept" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Fi i acceptar" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Acabarà trucada %s." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Trucada espera" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Desconegut" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Truc emergència" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Bústia de veu" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Trucad entrad" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Intercan." + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Marcant" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "En espera" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Fi de trucada" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Rebutj missatges" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volum" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Teclat" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Desactiva espera" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Trucar" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Més opcions" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Afegir a Contactes" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Acceptar la trucada" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Rebutjar la trucada" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Desplaci's a l'esquerra amb dos dits per rebutjar la trucada." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Desplaci's cap amunt amb dos dits per enviar un missatge de rebuig." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Desplaci's a la dreta amb dos dits per acceptar la trucada." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Auricular" + diff --git a/res/po/cs.po b/res/po/cs.po new file mode 100644 index 0000000..6a2fd86 --- /dev/null +++ b/res/po/cs.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Omlouvám se, řídím." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Teď nemohu mluvit. Co se děje?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Jsem zaneprázdněn. Zavolám." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Jsem zaneprázdněn. Napište mi." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Jsem na poradě." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Konec" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Ztlumit" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Počet účastníků: %d" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Volat" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konference" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Snížit hlasitost" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Zvýšit hlasitost" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Otočte rámeček a upravte %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Klávesnice" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Přijm. hovor" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Držet a přijm." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Ukonč. a přijm." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Hovor s %s skončí." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Držený hovor" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Neznámé" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Tísňové volání" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Hlasová pošta" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Přích. hovor" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Zaměnit" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Vytáčení" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Přidržený" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Hovor ukončen" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Odmítnutí hovorů" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Hlasitost" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Kláves." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Uvolnit" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Volat" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Další možnosti" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Přidat do Kont." + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Přijmout hovor" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Odmítnout hovor" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Potažením dvěma prsty doleva odmítnete hovor." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Potažením dvěma prsty nahoru odešlete zprávu při odmítnutí hovoru." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Potažením dvěma prsty doprava přijmete hovor." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Sluchátka" + diff --git a/res/po/da.po b/res/po/da.po new file mode 100644 index 0000000..3dc1a61 --- /dev/null +++ b/res/po/da.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Beklager, jeg kører lige nu." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Er optaget nu. Hvad sker der?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Jeg er optaget. Ringer senere." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Jeg er optaget. Send en sms." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Jeg er til møde." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Afslut opkald" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Lydløs" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Med %d personer" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Opkald" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konference" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Reducer lydstyrke" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Forøg lydstyrken" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Roter panel for at justere %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Tastatur" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Besv. opkald" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Hold og accept." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Slut og accept." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Opkald med %s slutter." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Opkald på hold" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Ukendt" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Nødopkald" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Telefonsvarer" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Indg. opkald" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Skift" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Ringer op" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "På hold" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Opkald afsluttet" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Afvisn.beskeder" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Lydstyrke" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Tastatur" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Hent" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Ring" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Flere funktioner" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Føj til kontakter" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Accepter opkald" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Afvis opkald" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Stryg til venstre med to fingre for at afvise opkald." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Stryg opad med to fingre for at sende en afvisningsbesked." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Stryg til højre med to fingre for at acceptere opkald." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Headset" + diff --git a/res/po/de.po b/res/po/de.po new file mode 100644 index 0000000..bb6167b --- /dev/null +++ b/res/po/de.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Sorry, ich fahre gerade." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Kann nicht reden. Was ist los?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Beschäftigt. Rufe später zurück." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Bin beschäftigt. Bitte per SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Ich bin in einer Besprechung." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Beenden" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Stumm" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Mit %d Personen" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Anruf" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferenz" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Lautstärke senken" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Lautstärke erhöhen" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Drehen Sie die Lünette, um %s anzupassen." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Tastatur" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Anrufannahme" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Halten & akzept." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Beenden & anneh." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Anruf mit %s endet." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Gehaltener Anruf" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Unbekannt" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Notruf" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Mailbox" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Anrufeingang" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Wechseln" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Wählen" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Gehalten" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Anrufende" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Mit Nachricht abl." + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Lautstärke" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Tasten" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Abrufen" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Anrufen" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Weitere Optionen" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Zu Kontakten hinzufügen" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Anruf annehmen" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Anruf ablehnen" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Mit zwei Fingern nach links streichen, um Anruf abzuweisen." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Mit zwei Fingern nach oben streichen, um eine Ablehnungsnachricht zu senden." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Mit zwei Fingern nach rechts streichen, um Anruf anzunehmen." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Headset" + diff --git a/res/po/el_GR.po b/res/po/el_GR.po new file mode 100644 index 0000000..78a4c57 --- /dev/null +++ b/res/po/el_GR.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Συγνώμη, αυτήν τη στιγμή οδηγώ." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Μπορώ να μιλήσω τώρα. Τι έγινε;" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Απασχολημένος. Θα καλέσω μετά." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Απασχολημένος. Στείλτε μήνυμα." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "ΕΙΜΑΙ ΣΕ ΣΥΝΑΝΤΗΣΗ." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Τερμ.κλ." + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Σίγαση" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Με %d άτομα" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Κλήση" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Συνδιάσκεψη" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Μείωση έντασης" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Αύξηση έντασης" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Περιστρέψτε τη στεφάνη για να προσαρμόσετε το %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Πληκτρολόγιο" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Απάντ. κλήσ." + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Αναμ. και αποδ." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Τερμ. και αποδ." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Η κλήση με %s θα τερμ." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Κλήση σε αναμονή" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Άγνωστο" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Κλ. έκτ. ανάγκ." + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Τηλεφωνητής" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Εισερχ. κλήση" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Εναλλαγή" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Κλήση" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Σε αναμονή" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Η κλήση τερματ." + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Μηνύμ. απόρριψης" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Ένταση" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Πληκτρολ." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Κατάργ. αναμονής" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Κλήση" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Περισσότερες επιλογές" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Προσθ. στις Επαφ." + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Αποδοχή κλήσης" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Απόρριψη κλήσης" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Κάντε σάρωση προς τα αριστερά με δύο δάχτυλα για να απορρίψετε την κλήση." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Κάντε σάρωση προς τα επάνω με δύο δάχτυλα για να στείλετε ένα μήνυμα απόρριψης." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Κάντε σάρωση προς τα δεξιά με δύο δάχτυλα, για να αποδεχτείτε την κλήση." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Ακουστικά" + diff --git a/res/po/en.po b/res/po/en.po new file mode 100644 index 0000000..c1a0451 --- /dev/null +++ b/res/po/en.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Sorry, I'm driving now." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "I can't talk now. What's up?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Sorry, I'm busy. Call you later." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Sorry, I'm busy. Please text me." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "I'm in a meeting." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "End call" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Mute" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "With %d people" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Call" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conference" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Decrease volume" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Increase volume" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Rotate bezel to adjust %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Keypad" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Answer call" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Hold and accept" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "End and accept" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Call with %s will end." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Call on hold" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Unknown" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Emergency call" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Voice Mail" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Incoming call" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Swap" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Dialling" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "On hold" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Call ended" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Decline messages" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volume" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Keypad" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Unhold" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Call" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "More options" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Add to Contacts" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Accept call" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Reject call" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Swipe left with two fingers to reject call." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Swipe up with two fingers to send a decline message." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Swipe right with two fingers to accept call." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Headset" + diff --git a/res/po/en_PH.po b/res/po/en_PH.po new file mode 100644 index 0000000..0af48c7 --- /dev/null +++ b/res/po/en_PH.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Sorry, I'm driving now." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "I can't talk now. What's up?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Sorry, I'm busy. Call you later." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Sorry, I'm busy. Please text me." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "I am in a meeting." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "End call" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Mute" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "With %d people" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Call" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conference" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Decrease volume" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Increase volume" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Rotate bezel to adjust %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Keypad" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Answer call" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Hold and accept" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "End and accept" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Call with %s will end." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Call on hold" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Unknown" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Emergency call" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Voicemail" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Incoming call" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Swap" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Dialing" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "On hold" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Call ended" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Decline messages" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volume" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Keypad" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Unhold" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Call" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "More options" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Add to Contacts" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Accept call" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Reject call" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Swipe left with two fingers to reject call." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Swipe up with two fingers to send a decline message." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Swipe right with two fingers to accept call." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Headset" + diff --git a/res/po/en_US.po b/res/po/en_US.po new file mode 100644 index 0000000..bdac6b5 --- /dev/null +++ b/res/po/en_US.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Sorry, I'm driving now." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "I can't talk now. What's up?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Sorry, I'm busy. Call you later." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Sorry, I'm busy. Please text me." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "I'm in a meeting." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "End call" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Mute" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "With %d people" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Call" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conference" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Decrease volume" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Increase volume" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Rotate bezel to adjust %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Keypad" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Answer call" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Hold and accept" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "End and accept" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Call with %s will end." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Call on hold" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Unknown" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Emergency call" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Voicemail" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Incoming call" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Swap" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Dialing" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "On hold" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Call ended" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Decline messages" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volume" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Keypad" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Unhold" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Call" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "More options" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Add to Contacts" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Accept call" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Reject call" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Swipe left with two fingers to reject call." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Swipe up with two fingers to send a decline message." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Swipe right with two fingers to accept call." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Headset" + diff --git a/res/po/es_ES.po b/res/po/es_ES.po new file mode 100644 index 0000000..7f3beb7 --- /dev/null +++ b/res/po/es_ES.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Ahora estoy conduciendo." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "No puedo hablar. ¿Qué pasa?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Estoy ocupado. Llam más tarde." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Estoy ocupado. Envía un mensaje." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Estoy en una reunión" + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Fin. Llamada" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Silencio" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Con %d personas" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Llamar" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conferencia" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Reducir volumen" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Aumentar volumen" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Gira el bisel para ajustar %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Teclado" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Responder" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Retener/aceptar" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Fin y aceptar" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Fin de llamada con %s." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "En espera" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Desconocido" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Emergencia" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Buzón de voz" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Llam entrante" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Cambiar" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Marcando" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "En espera" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Finalizada" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Mensajes rechazo" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volumen" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Teclado" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Cancelar espera" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Llamar" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Más opciones" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Añadir a Contactos" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Aceptar llamada" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Rechazar llamada" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Desliza hacia la izquierda con dos dedos para rechazar la llamada." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Desliza hacia arriba con dos dedos para enviar un mensaje de rechazo." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Desliza hacia la derecha con dos dedos para aceptar la llamada." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Auricular" + diff --git a/res/po/es_US.po b/res/po/es_US.po new file mode 100644 index 0000000..405dac1 --- /dev/null +++ b/res/po/es_US.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Ahora estoy conduciendo." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "No puedo hablar. ¿Qué pasa?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Estoy ocupado. Lo llamaré luego." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Estoy ocupado. Escríbeme." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Estoy en una reunión." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Fin. llamada" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Silenciar" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Con %d personas" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Llamar" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Multiconferencia" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Disminuir el volumen" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Aumentar el volumen" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Gire el bisel para ajustar %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Teclado" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Responder" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Espera y aceptar" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Fin y aceptar" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Fin de llamada con %s." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "En espera" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Desconocido" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Emergencia" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Correo de voz" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Llam. entran." + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Cambiar" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Marcando" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "En espera" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Fin de llamada" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Mensajes rechazo" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volumen" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Teclado" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Cancelar espera" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Llamar" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Más opciones" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Añadir a Contactos" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Aceptar llamada" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Rechazar llamada" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Deslice hacia la izquierda con dos dedos para rechazar la llamada." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Deslice hacia arriba con dos dedos para enviar un mensaje de rechazo." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Deslice hacia la derecha con dos dedos para aceptar la llamada." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Auricular" + diff --git a/res/po/et.po b/res/po/et.po new file mode 100644 index 0000000..7c2277a --- /dev/null +++ b/res/po/et.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Vabandust, sõidan praegu." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Ma ei saa rääkida. Mis toimub?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Olen hõivatud. Helistan hiljem." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Olen hõivatud. Saada sõnum." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Olen koosolekul." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Lõpeta" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Vaigista" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Koos %d inimesega" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Helista" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konverentskõne" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Vähenda helitugevust" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Suurenda helitugevust" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Keerake rõngast, et seadistada %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Klahvistik" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Kõnele vast." + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Ootele ja nõus." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Lõp. ja nõustu" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%s: kõne lõpetatakse." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Kõne on ootel" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Tundmatu" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Hädaabikõne" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Kõnepost" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Saabuv kõne" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Vaheta" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Valimine" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Ootel" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Kõne lõpetatud" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Sõnumit. keeld." + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Helitugev." + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Klahvist." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Vabasta" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Helistamine" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Veel valikuid" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Lisa kontakt" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Kõnele vastamine" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Kõnest keeldumine" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Kõnest keeldumiseks libistage kahe sõrmega vasakule." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Kõnest keeldumise sõnumi saatmiseks libistage kahe sõrmega üles." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Kõnele vastamiseks libistage kahe sõrmega paremale." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Peakompl." + diff --git a/res/po/eu.po b/res/po/eu.po new file mode 100644 index 0000000..586c558 --- /dev/null +++ b/res/po/eu.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Barkatu, gidatzen ari naiz." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Ezin dut hitz egin. Zer duzu?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Lanpetuta nago. Gero deituko dizut." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Lanpetuta nago. Bidali mezua." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Bilduta nago" + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Deia amaitu" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Isilarazi" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d pertsonarekin" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Deitu" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferentzia" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Jaitsi bolumena" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Igo bolumena" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Biratu %s doitzeko." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Teklatua" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Erantzun" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Zain eta onartu" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Amaitu eta onartu" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Deia (%s) amaituko da." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Deia zain" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Ezezaguna" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Larrialdi deia" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Ahots posta" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Sarrera deia" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Aldatu" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Markatzen" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Zain" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Deia amaitu da" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Ukatzeko mezuak" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Bolumena" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Teklatua" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Aktibatu" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Deitu" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Aukera gehiago" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Gehitu kontaktuetan" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Onartu deia" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Ukatu deia" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Deia ukatzeko, irristatu ezkerrera bi hatzez." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Ukatzeko mezuak bidaltzeko, irristatu gora bi hatzez." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Deia onartzeko, irristatu eskuinera bi hatzez." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Aurikul." + diff --git a/res/po/fi.po b/res/po/fi.po new file mode 100644 index 0000000..d048a5b --- /dev/null +++ b/res/po/fi.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Olen valitettavasti ajamassa." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "En voi puhua nyt. Mikä hätänä?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Olen varattu. Soitan myöhemmin." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Olen varattu. Lähetä tekstiviesti." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Olen kokouksessa." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Lo. puh" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Mykistä" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d ihmisen kanssa" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Puhelu" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Neuvottelu" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Vähennä äänenvoimakkuutta" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Lisää äänenvoimakkuutta" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Säädä kohdetta %s kiertämällä etulevyä." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Näppäimistö" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Vastaa puh." + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Pito ja hyväksy" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Lop. ja hyväksy" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Puh. henk. %s k. päättyy." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Puhelu pidossa" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Tuntematon" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Hätäpuhelu" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Vastaajaviesti" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Saap. puhelu" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Vaihda" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Soitetaan" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Pidossa" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Puhelu päättynyt" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Hylkäysviestit" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Voimakkuus" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Näppäim." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Poista pito" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Soitto" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Lisää asetuksia" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Lisää yht.tiet." + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Hyväksy puhelu" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Hylkää puhelu" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Hylkää puhelu pyyhkäisemällä kahdella sormella vasemmalle." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Lähetä hylkäysviesti pyyhkäisemällä kahdella sormella ylöspäin." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Hyväksy puhelu pyyhkäisemällä kahdella sormella oikealle." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Kuulokem." + diff --git a/res/po/fr.po b/res/po/fr.po new file mode 100644 index 0000000..df9e771 --- /dev/null +++ b/res/po/fr.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Désolé, je conduis." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Indisponible. Qu'y a-t-il ?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Je suis occupé. Je te rappelle." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Je suis occupé. Envoie un SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Je suis en réunion." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Fin" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Muet" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Avec %d personnes" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Appeler" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conférence" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Baisser le volume" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Augmenter le volume" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Tournez la lunette pour ajuster %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Clavier" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Réponse appel" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Att. et accept." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Fin et accept." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Fin d'appel avec %s." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Appel en attente" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Inconnu" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Appel d'urgence" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Messagerie" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Appel entrant" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Permuter" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Numérotation" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Attente" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Fin d'appel" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Messages de refus" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volume" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Clavier" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Récupérer" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Appel" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Options supplémentaires" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Ajouter" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Accepter l'appel" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Refuser l'appel" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Faites glisser deux doigts vers la gauche pour refuser l'appel." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Faites glisser deux doigts vers le haut pour envoyer un message de refus." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Faites glisser deux doigts vers la droite pour accepter l'appel." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Casque" + diff --git a/res/po/fr_CA.po b/res/po/fr_CA.po new file mode 100644 index 0000000..681c493 --- /dev/null +++ b/res/po/fr_CA.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Désolé, je conduis." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Indisponible. Qu'y a-t-il ?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Je suis occupé. Je te rappelle." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Je suis occupé. Envoie un SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Je suis en réunion." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Fin d'appel" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Muet" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Avec %d personnes" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Appel" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conférence" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Baisser le volume" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Augmenter le volume" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Tournez la lunette pour ajuster %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Clavier" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Réponse appel" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Att. et accept." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Fin et accept." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Fin d'appel avec %s." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Appel en attente" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Inconnu" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Appel d'urgence" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Messagerie vocale" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Appel entrant" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Permuter" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Composition" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Attente" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Fin d'appel" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Messages de refus" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volume" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Clavier" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Récupérer" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Appel" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Options supplémentaires" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Ajouter aux contacts" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Accepter l'appel" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Refuser l'appel" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Glissez deux doigts vers la gauche pour refuser l'appel." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Glissez deux doigts vers le haut pour envoyer un message de refus." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Glissez deux doigts vers la droite pour accepter l'appel." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Casque" + diff --git a/res/po/ga.po b/res/po/ga.po new file mode 100644 index 0000000..7a57fb2 --- /dev/null +++ b/res/po/ga.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Táim ag tiomáint faoi láthair." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Gnóthach anois. Cad é an scéal?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Táim gnóthach. Glaofaidh mé ort." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Táim gnóthach. Seol tcht chugam." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Táim i gcruinniú." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Scoir glao" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Balbh" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Le %d duine" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Glaoigh" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Comhdháil" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Ísligh airde" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Ardaigh airde" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Rothlaigh beiséal le %s a cheartú." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Eochaircheap" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Freag. glao" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Ar fion. & glac" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Scoir agus glac" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Scoirfear glao le %s." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Glao ar fionraí" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Anaithnid" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Glao éigeandála" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Glórphost" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Glao isteach" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Malartú" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Diailiú" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Ar fionraí" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Glao scortha" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Tchtaí diúltaithe" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Airde" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "E.cheap" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Dífhionraigh" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Glaoch" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Tuilleadh roghanna" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Cuir le Teagmhálaithe" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Glac le glao" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Diúltaigh do ghlao" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Svaidhpeáil ar chlé le dhá mhéar le diúltú don ghlao." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Svaidhpeáil suas le dhá mhéar le teachtaireacht diúltaithe a sheoladh." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Svaidhpeáil ar dheis le dhá mhéar le glacadh leis an nglao." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Gléas cinn" + diff --git a/res/po/gl.po b/res/po/gl.po new file mode 100644 index 0000000..8b3fc2b --- /dev/null +++ b/res/po/gl.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Estou conducindo." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Non podo falar. Que pasou?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Ocupado. Chámote máis tarde." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Estou ocupado. Envíame unha msx." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Estou nunha reunión" + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Finalizar cham." + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Silenc." + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Con %d persoas" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Chamar" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conferencia" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Reducir volume" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Aumentar volume" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Xira o bisel para axustar %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Teclado" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Resp. cham." + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Manter e acept." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Final. e acept." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Cham.con %s finalizar." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Chama. en espera" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Descoñecido" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Chamada urxenc." + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Caixa de voz" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Cha. entrante" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Cambiar" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Marcando" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "En espera" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Cham. finalizada" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Rexeitar mensaxes" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volume" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Teclado" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Desactivar espe." + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Chamada" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Máis opcións" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Engadir a Contactos" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Aceptar chamada" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Rexeitar chamada" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Pasa dous dedos á esquerda sobre a pantalla para rexeitar unha chamada." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Pasa dous dedos cara arriba para enviar unha mensaxe de rexeite." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Para aceptar unha chamada, pasa dous dedos pola pantalla á dereita." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Auricula." + diff --git a/res/po/hi.po b/res/po/hi.po new file mode 100644 index 0000000..8d1def1 --- /dev/null +++ b/res/po/hi.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "क्षमा करें, मैं अभी गाड़ी चला रहा हूँ।" + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "मैं अभी बात नहीं कर सकता। कैसे हो?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "क्षमा करें, मैं व्यस्त हूँ। बाद में कॉल करता हूँ।" + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "क्षमा करें, मैं व्यस्त हूँ। कृपया मुझे सन्देश भेजें।" + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "मैं एक मीटिंग में हूँ।" + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "कॉल समाप्त" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "म्यूट" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d लोगों के साथ" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "कॉल" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "कॉन्फ़्रेंस" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "वॉल्यूम घटाएँ" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "वॉल्यूम बढ़ाएँ" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "%s को समायोजित करने के लिए बेजल घुमाएँ।" + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "कीपैड" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "कॉल का जवाब" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "होल्ड व स्वीकार करें" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "समाप्त व स्वीकार करें" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%s का कॉल समाप्त होगा।" + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "कॉल होल्ड पर है" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "अज्ञात" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "आपातकालीन कॉल" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "वॉइस मेल" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "आनेवाली कॉल" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "स्वैप" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "डायलिंग" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "होल्ड पर है" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "कॉल समाप्त" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "संदेश अस्वीकारें" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "वॉल्यूम" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "कीपैड" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "अनहोल्ड करें" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "गियर" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "कॉल करें" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "अधिक विकल्प" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "संपर्क में जोड़ें" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "कॉल स्वीकारें" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "कॉल अस्वीकृत करें" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "कॉल अस्वीकार करने के लिए दो उंगलियों से बाईं ओर स्वाइप करें।" + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "कोई अस्वीकृत सन्देश भेजने के लिए दो उंगलियों से ऊपर स्वाइप करें।" + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "कॉल स्वीकार करने के लिए दो उंगलियों से दाईं ओर स्वाइप करें।" + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "हेडसेट" + diff --git a/res/po/hr.po b/res/po/hr.po new file mode 100644 index 0000000..0b75a76 --- /dev/null +++ b/res/po/hr.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Žao mi je, trenutno vozim." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Ne mogu razgovarati. Što ima?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Zauzet/a sam. Nazvat ću kasnije." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Imam posla. Pošaljite mi SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Na sastanku sam." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Prekid" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Bešumno" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "S %d ljudi" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Poziv" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferencija" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Smanji glasnoću" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Povećaj glasnoću" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Zakrenite okvir za podešavanje %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Tipkovnica" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Javite se" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Ček. i prihvati" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Završi i prihv." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Završit će poziv s %s." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Poziv na čekanju" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Nepoznato" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Hitni poziv" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Govorna pošta" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Dolazni poziv" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Zamijeni" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Pozivanje" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Na čekanju" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Poziv završen" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Poruke odbijanja" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Glasnoća" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Tipkov." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Ukl. iz čekanja" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Nazovi" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Više opcija" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Dodaj u Imenik" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Prihvaćanje poziva" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Odbijanje poziva" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Prijeđite s dvama prstima ulijevo za odbijanje poziva." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Prijeđite s dvama prstima prema gore za slanje poruke odbijanja." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Prijeđite s dvama prstima udesno za prihvaćanje poziva." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Slušalica" + diff --git a/res/po/hu.po b/res/po/hu.po new file mode 100644 index 0000000..6c0832e --- /dev/null +++ b/res/po/hu.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Elnézést, vezetek." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Most nem lehet. Mi a helyzet?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Sajnos nem érek rá. Majd hívom." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Most nem érek rá, küldjön SMS-t." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Tárgyaláson vagyok." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Befejez" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Némít" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d résztvevő" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Hívás" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferencia" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Halkítás" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Hangosítás" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "A %s beállításához forgassa el a keretet." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Billentyűzet" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Hívást fogad" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Tart és fogad" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Befej. és fogad" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%s hívása befejeződik." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Tartott hívás" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Ismeretlen" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Segélyhívás" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Hangposta" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Bejövő hívás" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Csere" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Tárcsázás" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Tartott hívás" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Hívás vége" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Elutasító üz.ek" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Hangerő" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Bill.zet" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Tartást felold" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Hívás" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Egyéb opciók" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Névjegyekhez ad" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Hívás fogadása" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Hívás elutasítása" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "A hívás elutasításához húzza balra két ujjal." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Elutasító üzenet küldéséhez húzza felfelé két ujjal." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "A hívás fogadásához húzza jobbra két ujjal." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Headset" + diff --git a/res/po/hy.po b/res/po/hy.po new file mode 100644 index 0000000..4792651 --- /dev/null +++ b/res/po/hy.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Կներեք, հիմա մեքենա եմ վարում:" + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Հիմա չեմ կ. խոսել: Ի՞նչ է եղել:" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Ներեցեք, զբղվծ եմ: Հետո կզանգեմ:" + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Կներեք, զբղվծ եմ: Տեքստ ուղրկեք:" + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Ես հանդիպման եմ:" + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Ավր զնգ" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Անձայն" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d հոգու հետ" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Կանչ" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Կոնֆերանս" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Նվազեցնել ուժգնությունը" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Բարձրացնել ուժգնությունը" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Պտտեք շրջանակը՝ %s կարգավորելու համար:" + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Ստեղնախումբ" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Պտսխն կանչին" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Հտձգ. և ընդուն." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Ավարտ և ընդուն." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%s-ի կանչը կավարտվի:" + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Կանչը հետձգված է" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Անհայտ" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Արտ. իրվճ. կանչ" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Ձայնային փոստ" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Մտից կանչ" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Փոխատեղել" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Համարարկում" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Հետաձգված" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Կանչն ավարտված է" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Մերժել հղգրթները" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Ձայնի ուժ." + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Ստեղնախմբ" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Հետձգումից հանել" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Կանչ" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Այլ ընտրանքներ" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Ավլցնլ Կնտկտնրին" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Ընդունել կանչը" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Մերժել կանչը" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Կանչը մերժելու համար երկու մատը սահեցրեք ձախ:" + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Մերժման հաղորդագրություն ուղարկելու համար երկու մատը սահեցրեք վեր:" + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Կանչն ընդունելու համար երկու մատը սահեցրեք աջ:" + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Գլխ. հռխս" + diff --git a/res/po/is.po b/res/po/is.po new file mode 100644 index 0000000..c3bf48b --- /dev/null +++ b/res/po/is.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Ég er undir stýri." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Kemst ekki í síma. E-ð títt?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Ég upptekin(n). Hringi seinna." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Upptekin(n). Sendu mér SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Ég er á fundi." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Leggj. á" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Hljóð af" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Með %d aðilum" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Símtal" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Símafundur" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Lækka hljóðstyrk" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Hækka hljóðstyrk" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Snúðu skáa til að stilla %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Takkaborð" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Svara" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Í bið og samþ." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Ljúka og samþ." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Símtali við %s lýkur." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Símtal í bið" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Óþekkt" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Neyðarsímtal" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Talhólf" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Símtal berst" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Skipta" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Hringi" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Í bið" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Símtali lokið" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Höfnunarskilaboð" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Hljóðst." + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Takkaborð" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Úr bið" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Hringja" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Fleiri valkostir" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Bæta v. símaskrá" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Svara símtali" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Hafna símtali" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Strjúktu til vinstri með tveimur fingrum til að hafna símtali." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Strjúktu upp með tveimur fingrum til að senda höfnunarskilaboð." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Strjúktu til hægri með tveimur fingrum til að svara símtali." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Höfuðtól" + diff --git a/res/po/it_IT.po b/res/po/it_IT.po new file mode 100644 index 0000000..b2f1e53 --- /dev/null +++ b/res/po/it_IT.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Scusa, sto guidando." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Ora non posso. Che succede?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Sono occupato. Ti chiamo dopo." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Sono occupato. Inviami un SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Sono in riunione." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Termina" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Muto" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Con %d persone" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Chiama" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conferenza" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Riduci volume" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Alza il volume" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Ruota la ghiera per regolare %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Tastiera" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Rispondi" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Attesa e accetta" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Termina e accetta" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "La chiam. con %s term." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Chiam. in attesa" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Sconosciuto" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Chiam. emergenza" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Segreteria" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Chiamata" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Scambia" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Composizione" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "In attesa" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Fine chiamata" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Rifiuta con msg" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volume" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Tastiera" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Recupera" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Chiamate" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Altre opzioni" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Aggiungi a Rubrica" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Accetta chiamata" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Rifiuta chiamata" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Trascina due dita verso sinistra per rifiutare la chiamata." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Trascina due dita verso l'alto per inviare un messaggio di rifiuto." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Trascina due dita verso destra per accettare la chiamata." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Auricolare" + diff --git a/res/po/ja_JP.po b/res/po/ja_JP.po new file mode 100644 index 0000000..11635ed --- /dev/null +++ b/res/po/ja_JP.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "ただいま運転中です。" + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "電話に出られません。ご用件は?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "今忙しいので、後でかけ直します。" + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "今忙しいので、SMSをください。" + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "申し訳ありません、会議中です。" + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "通話を終了" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "消音" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d人と通話中" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "発信" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "会議" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "音量を下げる" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "音量を上げる" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "%sを調整するには、ベゼルを回します。" + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "キーパッド" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "着信に応答" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "保留にして応答" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "終了して応答" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%sとの通話を終了" + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "通話を保留中" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "不明" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "緊急通報" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "留守番電話" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "着信" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "切替" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "ダイヤル中" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "保留中" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "通話終了" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "拒否メッセージ" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "音量" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "キーパッド" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "保留解除" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "通話" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "他のオプション" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "連絡先に追加" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "着信に応答" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "着信を拒否" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "着信を拒否するには、2本の指で左にスワイプしてください。" + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "拒否メッセージを送信するには、2本の指で上にスワイプしてください。" + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "着信に応答するには、2本の指で右にスワイプしてください。" + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "ヘッドセット" + diff --git a/res/po/ka.po b/res/po/ka.po new file mode 100644 index 0000000..3094e03 --- /dev/null +++ b/res/po/ka.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "უკაცრავად, საჭესთან ვარ." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "ახლა ვერ ვილაპარაკებ. რა ხდება?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "დაკავებული ვარ. დაგირეკავ." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "დაკავებული ვარ. მომწერეთ." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "კრებაზე ვარ." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "ზარის დასრ." + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "უხმო" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d ადამიანით" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "დარეკვა" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "კონფერენცია" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "ხმის დაწევა" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "ხმის გაზრდა" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "%s რომ შეარჩიოთ, მოაბრუნეთ წრე." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "კლავიატურა" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "პასუხი ზარზე" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "დაკავება-მიღება" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "დასრულ.-მიღება" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%s-თან ზარი გაითიშება." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "ზარი იცდის" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "უცნობი" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "საგანგებო ზარი" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "ხმოვანი ფოსტა" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "მოსული ზარი" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "გადართვა" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "დარეკვა" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "დაკავება" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "ზარი დასრულდა" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "უარყოფის ტექსტი" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "ხმის დონე" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "კლავიატ." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "დაკავების მოხს." + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "ზარი" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "სხვა ოფციები" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "კონტაქ. დამატება" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "ზარის მიღება" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "ზარის უარყოფა" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "გადაუსვით ორი თითი მარცხნივ, თუ გსურთ უარყოთ ზარი." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "აუსვით ორი თითი ზემოთ, თუ გსურთ გაგზავნოთ უარყოფის შეტყობინება." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "გადაუსვით ორი თითი მარჯვნივ, თუ გსურთ უპასუხოთ ზარს." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "გარნიტურა" + diff --git a/res/po/kk.po b/res/po/kk.po new file mode 100644 index 0000000..4ed3ac8 --- /dev/null +++ b/res/po/kk.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Көлік жүргізудемін." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Қазір сөйл. алмаймын. Не болды?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Бос емеспін. Кейін қоң. шаламын." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Бос емеспін. Хабар жазыңыз." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Мен жиналыстамын." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Қңр соңы" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Дыбыссыз" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d адаммен" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Қоңырау" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Конференция" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Дыбыс деңгейін азайту" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Дыбыс деңгейін көбейту" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "%s уақытын реттеу үшін, тұтқышты бұрыңыз." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Пернетақта" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Қоң-ға жауап" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Күту мен қабыл." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Аяқтау мен қаб." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%s қоңырауы аяқталады." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Қоңырау күтілуде" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Белгісіз" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Төтенше қоңырау" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Дауыс поштасы" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Кіріс қоң." + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Ауыстыру" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Теру" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Күтіп тұр" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Қоңырау аяқталды" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Қабылдамау хабар" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Дыбыс" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Пернетақ." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Күткізбеу" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Қоңырау" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Басқа опциялар" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Контакт-ге қосу" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Қоңырауды қабылдау" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Қоңырауды қабылдамау" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Қоңырауды қабылдамау үшін, екі саусағыңызбен солға қарай жүргізіп өтіңіз." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Қабылдамау хабарын жіберу үшін, екі саусағыңызбен жоғарыға қарай жүргізіп өтіңіз." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Қоңырауды қабылдау үшін, екі саусағыңызбен оңға қарай жүргізіп өтіңіз." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Гарнитура" + diff --git a/res/po/ko_KR.po b/res/po/ko_KR.po new file mode 100644 index 0000000..b51f45d --- /dev/null +++ b/res/po/ko_KR.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "죄송합니다. 운전 중이에요." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "지금은 전화를 받을 수 없습니다. 무슨 일이에요?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "죄송합니다. 지금 전화를 받을 수 없습니다. 나중에 전화할게요." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "지금은 전화를 받을 수 없으니, 문자 메시지를 보내주세요." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "회의 중입니다." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "통화 종료" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "내 소리 차단" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d명과 함께 통화 중" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "통화" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "컨퍼런스 콜" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "음량 낮추기" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "음량 높이기" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "%s 값을 조절하려면 베젤을 돌리세요." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "키패드" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "전화받기" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "대기 후 받기" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "종료 후 받기" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%s님과의 통화를 종료합니다." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "통화 대기 중" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "번호정보 없음" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "긴급전화" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "음성사서함" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "수신전화" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "전환" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "전화 연결 중" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "대기 중" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "통화 종료" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "거절 메시지" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "음량" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "키패드" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "다시 통화" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "전화" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "옵션 더보기" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "연락처에 추가" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "전화 받기" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "전화 거절" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "전화를 거절하려면 두 손가락으로 화면을 왼쪽으로 미세요." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "전화 거절 메시지를 보내려면 두 손가락으로 화면을 위로 올리세요." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "전화를 받으려면 두 손가락으로 화면을 오른쪽으로 미세요." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "헤드셋" + diff --git a/res/po/lt.po b/res/po/lt.po new file mode 100644 index 0000000..480f589 --- /dev/null +++ b/res/po/lt.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Atsiprašau, dabar vairuoju." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Negaliu kalbėti. Kas nutiko?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Deja,esu užsiėm. Paskam. vėliau." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Aš užsiėmęs. Parašyk man." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Aš susitikime." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Bg.skam." + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Nutildyti" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Su %d žmon." + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Skamb." + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferencija" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Sumažinti garsumą" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Padidinti garsumą" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Pasukite rėmelį ir sureguliuokite %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Klaviatūra" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Ats. į skam." + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Atidėt / priimt" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Baigt ir priimt" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Skam. su %s bus baig." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Pokalb. atidėtas" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Nežinomas" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Pagalbos skamb." + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Balso pranešimas" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Gaun. skamb." + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Sukeisti" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Skambinimas" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Sulaikyta" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Pokalbis baigtas" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Atmetimo žinutės" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Garsumas" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Klaviat." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Grįžti" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "„Gear“" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Skambinti" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Daugiau parinkčių" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Prid. prie adres." + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Atsiliepti" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Atmesti skambutį" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Norėdami atmesti skambutį, braukite dviem pirštais į kairę." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Norėdami išsiųsti atmetimo žinutę, braukite dviem pirštais į viršų." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Norėdami atsiliepti, braukite dviem pirštais į dešinę." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Ausinės" + diff --git a/res/po/lv.po b/res/po/lv.po new file mode 100644 index 0000000..6b39880 --- /dev/null +++ b/res/po/lv.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Diemžēl esmu pie stūres." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Nevaru runāt. Kas noticis?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Esmu aizņemts. Piezvanīšu vēlāk." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Esmu aizņemts. Atsūtiet īsziņu." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Esmu sapulcē." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Beigt" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Izsl. sk." + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Ar %d personām" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Zvans" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konference" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Samazināt skaļumu" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Palielināt skaļumu" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Pagrieziet apli, lai regulētu %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Cipartastatūra" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Atb. uz zv." + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Aiztur. un atb." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Pārtr. un atb." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Sar. ar %s tiks pārtr." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Saruna aizturēta" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Nezināms" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Ārkārtas zvans" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Balss pasts" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Ienāk. zvans" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Mainīt" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Zvana" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Aizturēts" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Saruna pabeigta" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Noraidīt ziņas" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Skaļums" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Cipartast." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Atsākt" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Zvans" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Citas iespējas" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Pievienot kontaktiem." + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Pieņemt zvanu" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Noraidīt zvanu" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Lai noraidītu zvanu, pavelciet ar diviem pirkstiem pa kreisi." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Lai nosūtītu noraidīšanas ziņu, pavelciet ar diviem pirkstiem uz augšu." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Lai atbildētu uz zvanu, pavelciet ar diviem pirkstiem pa labi." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Austiņas" + diff --git a/res/po/mk.po b/res/po/mk.po new file mode 100644 index 0000000..c30c51b --- /dev/null +++ b/res/po/mk.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Извини, возам." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Не можам да зборувам. Што има?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Зафатен сум. Ќе ти се јавам." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Извини, зафатен сум. Прати ми SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Na sostanok sum." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Крај" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Иск.мик" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Со %d лица" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Повик" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Конференција" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Намали тон" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Засили тон" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Ротирајте го лежиштето за приспособување на %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Тастатура" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Одг.на повик" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Задржи и приф." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Заврши и приф." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Пов. со %s ќе заврши." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Пов. е задржан" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Непознато" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Итен повик" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Говорна пошта" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Дојдов. повик" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Замени" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Бирање" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "На чекање" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Повикот заврши" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Пораки за отфрл." + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Јачина" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Тастатура" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Врати" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Повикај" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Повеќе опции" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Дод. во Контакти" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Прифати повик" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Отфрли повик" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Поминете налево со два прста за одбивање повик." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Поминете нагоре со два прста за да пратите порака за одбивање." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Поминете надесно со два прста за прифаќање повик." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Слушалка" + diff --git a/res/po/nb.po b/res/po/nb.po new file mode 100644 index 0000000..fdb0ac1 --- /dev/null +++ b/res/po/nb.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Beklager, jeg kjører bil nå." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Kan ikke snakke nå. Hva skjer?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Beklager, opptatt. Ringer senere." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Beklager, opptatt. Send meg mld." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Jeg er i et møte." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Avslutt samtale" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Lyd av" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Med %d personer" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Ring" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferanse" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Reduser volumet" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Øk volumet" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Roter rammen for å justere %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Tastatur" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Besvar anrop" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Park. og godta" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Avsl. og godta" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Samtale med %s avsl." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Anrop på vent" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Ukjent" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Nødanrop" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Mobilsvar" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Innkom. anrop" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Bytt" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Ringer opp" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "På vent" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Anrop avsluttet" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Avvisningsmeld." + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volum" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Tastatur" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Opphev vent" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Ring" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Flere alternativer" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Legg til i Kontakter" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Godta anrop" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Avvis anrop" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Stryk mot venstre med to fingre for å avvise anrop." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Stryk opp med to fingre for å sende en avvisningsmelding." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Stryk mot høyre med to fingre for å godta anrop." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Hodesett" + diff --git a/res/po/nl.po b/res/po/nl.po new file mode 100644 index 0000000..5f1d349 --- /dev/null +++ b/res/po/nl.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Sorry, ik zit nu in de auto." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Ik kan niet praten. Wat is er?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Ik ben bezet. Ik bel u later." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Ik ben bezet. Stuur een sms." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Ik ben in een vergadering." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Einde" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Stil" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Met %d personen" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Bellen" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Vergaderen" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Volume verlagen" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Volume verhogen" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Draai ring om %s aan te passen." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Toetsen" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Aannemen" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "In wacht/aann." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Einde en aann." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Opr. met %s beëindigd." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Oproep in wacht" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Onbekend" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Noodoproep" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Voicemail" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Inkom. oproep" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Wisselen" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Kiezen" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "In de wacht" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Oproep beëindigd" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Berichten weig." + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volume" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Toetsenb." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Uit wacht" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Bellen" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Meer opties" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Toevoegen aan contacten" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Oproep aannemen" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Oproep weigeren" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Veeg met twee vingers naar links om de oproep te weigeren." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Veeg met twee vingers omhoog om een bericht te weigeren." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Veeg met twee vingers naar rechts om de oproep aan te nemen." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Headset" + diff --git a/res/po/pl.po b/res/po/pl.po new file mode 100644 index 0000000..f489ef3 --- /dev/null +++ b/res/po/pl.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Przepraszam, prowadzę samochód." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Nie mogę rozmawiać. Co słychać?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Nie mogę odebrać. Oddzwonię." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Jestem zajęty. Napisz SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Jestem na spotkaniu." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Rozłącz" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Wycisz" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Z %d osobami" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Połącz" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferencja" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Zmniejsz głośność" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Zwiększ głośność" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Obróć ramkę, aby wyregulować ustawienie %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Klawiatura" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Odbieranie" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Zawieś i odb." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Zakończ i odb." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Poł. z %s zost. zakoń." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Zawieszone" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Nieznane" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Połącz. alarm." + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Poczta głosowa" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Poł. przych." + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Zamień" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Wybieranie" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Zawieszone" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Rozłączone" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Wiadom. odrzuc." + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Głośność" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Klawiat." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Powróć" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Połączenie" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Więcej opcji" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Dodaj kontakt" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Odbierz połączenie" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Odrzuć połączenie" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Przeciągnij dwoma palcami w lewo, aby odrzucić połączenie." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Przeciągnij dwoma palcami w górę, aby wysłać wiadomość odrzucania." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Przeciągnij dwoma palcami w prawo, aby odebrać połączenie." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Zest. sł." + diff --git a/res/po/pt_BR.po b/res/po/pt_BR.po new file mode 100644 index 0000000..7b5aea9 --- /dev/null +++ b/res/po/pt_BR.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Desculpe, estou dirigindo agora." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Não posso falar agora. O que houve?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Estou ocupado. Ligo mais tarde." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Estou ocupado. Mande mensagem." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Estou em uma reunião." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Encerrar chamada" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Silenciar" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Com %d pessoas" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Chamar" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conferência" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Reduzir volume" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Aumentar volume" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Gire a coroa para ajustar %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Teclado" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Atend. cham." + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Reter e aceitar" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Term. e aceitar" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Cham. c/ %s encerrará." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Cham. em espera" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Desconhecido" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Cham. de emerg." + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Caixa Postal" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Cham. receb." + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Trocar" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Discando" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Em espera" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Cham. encerrada" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Mens. recusadas" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volume" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Teclado" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Não reter" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Ligar" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Mais opções" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Adic. aos Contatos" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Aceitar chamada" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Recusar a chamada" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Deslize para a esquerda com dois dedos para recusar a chamada." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Deslize para cima com dois dedos para enviar uma mensagem de chamada recusada." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Deslize para a direita com dois dedos para aceitar a chamada." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Fone ouv." + diff --git a/res/po/pt_PT.po b/res/po/pt_PT.po new file mode 100644 index 0000000..e07a54f --- /dev/null +++ b/res/po/pt_PT.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Desculpe, estou a conduzir." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Não posso falar. O q se passa?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Estou ocupado. Ligo mais tarde." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Estou ocupado. Envie mensagem." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Estou numa reunião." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Ter. ch." + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Silenciar" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Com %d pessoas" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Chamada" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conferência" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Diminuir volume" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Aumentar volume" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Rode o aro para ajustar %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Teclado" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Atender chamada" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Reter e aceitar" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Term. e aceitar" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Cham. c/ %s terminará." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Cham. em espera" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Desconhecido" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Cham. emergência" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Correio de voz" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Cham recebida" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Mudar" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "A marcar" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Em espera" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Cham. terminada" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Mensagens recusa" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volume" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Teclado" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Não reter" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Ligar" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Mais opções" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Adic. a Contactos" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Aceitar chamada" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Rejeitar chamada" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Deslize com dois dedos para a esquerda, para rejeitar a chamada." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Deslize com dois dedos para cima, para enviar uma mensagem de recusa." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Deslize com dois dedos para a direita, para aceitar a chamada." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Auricular" + diff --git a/res/po/ro.po b/res/po/ro.po new file mode 100644 index 0000000..431f537 --- /dev/null +++ b/res/po/ro.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Scuze, sunt la volan." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Nu pot vorbi. Ce s-a întâmplat?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Scuze, sunt ocupat. Sun înapoi." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Scuze, sunt ocupat. Trim. SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Sunt în ședință." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Termin. apel" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Mic. oprit" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Cu %d persoane" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Apel" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Conferință" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Reduceți volumul" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Creșteți volumul" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Rotiți rama pentru a ajusta %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Tastatură" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Prel. apel" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Rețin./accept." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Înch./.accept." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Ap. cu %s se va înch." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Apel în aștept." + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Necunoscut" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Apel de urgență" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Mesagerie vocală" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Apel intrare" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Schimbare" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Apelare" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Reținut" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Apel încheiat" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Mesaje refuzate" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volum" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Tastatură" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Reluare" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Apelare" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Mai multe opțiuni" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Adaugă la Contacte" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Acceptare apel" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Respingere apel" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Glisați spre stânga folosind două degete pentru a respinge apelul." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Glisați în sus folosind două degete pentru a trimite un mesaj de respingere." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Glisați spre dreapta folosind două degete pentru a accepta apelul." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Cască" + diff --git a/res/po/ru_RU.po b/res/po/ru_RU.po new file mode 100644 index 0000000..eb7a927 --- /dev/null +++ b/res/po/ru_RU.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Я за рулем." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Я не могу сейчас говорить." + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Извините, я перезвоню Вам позже." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Извините, я занят. Напишите мне." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Я на собрании." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Заверш." + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Звук" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Число участников: %d" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Вызов" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Конференция" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Уменьшить громкость" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Увеличить громкость" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Для настройки %s поверните кольцо." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Клавиатура" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Прием вызова" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Удерж.и принять" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Зав. и принять" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Разг. с %s завершится." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Вызов на удерж." + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Скрытый номер" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Экстрен. вызов" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Голосовая почта" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Вход. вызов" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Перекл." + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Набор номера" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "На удержании" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Вызов завершен" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Ответ сообщением" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Громкость" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Клавиат." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Снять с удержан." + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Вызов" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Другие параметры" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Добавить в контакты" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Принять вызов" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Отклонить вызов" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Проведите двумя пальцами влево, чтобы отклонить вызов." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Проведите двумя пальцами вверх, чтобы отклонить вызов и отправить сообщение." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Проведите двумя пальцами вправо, чтобы принять вызов." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Наушники" + diff --git a/res/po/sk.po b/res/po/sk.po new file mode 100644 index 0000000..c9fb3ef --- /dev/null +++ b/res/po/sk.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Teraz nemôžem, šoférujem." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Teraz nemôžem. Čo sa deje?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Nemám čas. Zavolám neskôr." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Teraz nemám čas. Pošlite správu." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Som na schôdzi." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Uk. hov." + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Stlmiť" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "S %d ľuďmi" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Hovor" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferencia" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Znížiť hlasitosť" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Zvýšiť hlasitosť" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Otočením panela môžete upraviť %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Číselná klávesnica" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Prij. hovoru" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Podrž. a prijať" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Ukončiť a prijať" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Hovor s %s sa ukončí." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Hovor podržaný" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Neznáme" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Tiesňový hovor" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Hlasová pošta" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Prich. hovor" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Vymeniť" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Vytáčanie" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Podržaný" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Hovor sa ukončil" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Spr. pri odmiet." + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Hlasitosť" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Klávesnica" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Uvoľniť" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Hovor" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Ďalšie možnosti" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Pridať do kont." + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Prijať hovor" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Odmietnuť hovor" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Potiahnutím doľava dvomi prstami môžete odmietnuť hovor." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Potiahnutím nahor dvomi prstami môžete odoslať správu pri odmietnutí hovoru." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Potiahnutím doprava dvomi prstami môžete prijať hovor." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Slúchadlá" + diff --git a/res/po/sl.po b/res/po/sl.po new file mode 100644 index 0000000..d36f939 --- /dev/null +++ b/res/po/sl.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Trenutno vozim." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Zdaj ne morem. Kaj se dogaja?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Zaseden sem. Pokličem pozneje." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Zaseden sem. Pošlji sporočilo." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Sem na sestanku." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Kon.klic" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Nemo" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "S toliko ljudmi: %d" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Klic" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferenca" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Zmanjšaj glasnost" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Povečaj glasnost" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Vrtite okvir, da prilagodite možnost %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Številčnica" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Sprejm. klic" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Zad. in sprejmi" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Kon. in sprejmi" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Klic z os. %s bo končan." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Klic na čakanju" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Neznano" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Klic v sili" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Glasovno sporočilo" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Dohodni klic" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Zamenjaj" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Izbiranje" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Na čakanju" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Klic je končan" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Zavrn. sporočila" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Glasnost" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Številčn." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Sprosti" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Klic" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Več možnosti" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Dodaj v stike" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Sprejem klica" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Zavrnitev klica" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Z dvema prstoma podrsajte v levo, da zavrnete klic." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Z dvema prstoma podrsajte navzgor, da pošljete zavrnitveno sporočilo." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Z dvema prstoma podrsajte v desno, da sprejmete klic." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Slušalke" + diff --git a/res/po/sr.po b/res/po/sr.po new file mode 100644 index 0000000..7187182 --- /dev/null +++ b/res/po/sr.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Žao mi je, trenutno vozim." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Ne mogu da pričam. Šta je bilo?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Zauzet/a sam. Zvaću te kasnije." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Zauzet/a sam. Pošalji mi poruku." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Na sastanku sam." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Završi" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Isklj.ton" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Sa %d osobe/a" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Poziv" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferencija" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Smanji jačinu zvuka" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Pojačaj jačinu zvuka" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Rotirajte okvir da biste prilagodili %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Tastatura" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Prihvat. poz." + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Drži i prihvati" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Prekini i prihvati" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Kraj poziva osobe %s." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Poziv na čekanju" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Nepoznato" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Poz. u hit. sluč." + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Govorna pošta" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Dolazni poziv" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Zameni" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Pozivanje" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Na čekanju" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Poziv je završen" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Odbijajuće poruke" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Jač. zvuka" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Tastatura" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Obustavi čekanje" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Pozovi" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Još opcija" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Dodaj u kontakte" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Prihvati poziv" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Odbij poziv" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Prevucite nalevo koristeći dva prsta da biste odbili poziv." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Prevucite nagore koristeći dva prsta da biste poslali poruku odbijanja." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Prevucite nadesno koristeći dva prsta da biste prihvatili poziv." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Slušalice" + diff --git a/res/po/sv.po b/res/po/sv.po new file mode 100644 index 0000000..4bae2b6 --- /dev/null +++ b/res/po/sv.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Jag kör nu." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Kan inte prata nu. Vad händer?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Jag är upptagen. Ringer dig sen." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Jag är upptagen. Skicka SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Jag deltar i ett möte." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Avsl. samt." + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Ljud av" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Med %d personer" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Samtal" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferens" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Sänka volymen" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Höj volymen" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Vrid ramen för att kunna justera %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Knappsats" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Besv. samtal" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Parkera & svara" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Avsluta & godk." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Samtalet med %s avsl." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Samtal parkerat" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Okänd" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Nödsamtal" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Röstbrevlåda" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Inkom. samtal" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Växla" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Ringer upp" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Parkerat" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Samtalet avslut." + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Avvisningsmedd." + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Volym" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Knappsats" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Återta" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Ring" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Fler alternativ" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Lägg till kont." + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Svara på samtal" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Avvisa samtal" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Svep med två fingrar åt vänster för att avvisa samtalet." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Svep uppåt två fingrar om du vill skicka ett avvisningsmeddelande." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Svep med två fingrar åt höger för att besvara samtalet." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Headset" + diff --git a/res/po/tr_TR.po b/res/po/tr_TR.po new file mode 100644 index 0000000..1b9857f --- /dev/null +++ b/res/po/tr_TR.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Üzgünüm, şu an araba kllnyorum." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Şu anda konuşamıyorum. Ne oldu?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Şu an meşgulüm. Sonra arayacağm." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Üzgünm, mşglm. Lütfen msj gndrn." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Toplantıdayım." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Bitir" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Sessiz" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%d kişiyle" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Arama" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferans" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Sesi düzeyini düşür" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Sesi düzeyini arttır" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "%s ayarı için bezeli döndürün." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Klavye" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Aramyı yntla" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Beklt ve kbl et" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Bitr ve kabl et" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%s ile arma snlndrlck." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Arama beklemede" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Bilinmeyen" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Acil drm aramsı" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Telesekreter" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Gelen arama" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Değiştir" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Aranıyor" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Beklemede" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Arama sonlndrldı" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Mesaj ile reddet" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Ses düzeyi" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Klavye" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Beklemeden al" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Ara" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Diğer seçenekler" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Kişilere Ekle" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Aramayı kabul et" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Aramayı reddet" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Aramayı reddetmek için iki parmağınızla sola kaydırın." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Bir reddetme mesajı göndermek için iki parmağınızla yukarı kaydırın." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Aramayı kabul etmek için iki parmağınızla sağa kaydırın." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Kulaklık" + diff --git a/res/po/uk.po b/res/po/uk.po new file mode 100644 index 0000000..c7b897c --- /dev/null +++ b/res/po/uk.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Наразі я за кермом." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Не мож.зараз говор. Що сталося?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Не можу відпов. Передз.пізніше." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Не можу відпов. Надішліть SMS." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "На нараді." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Зав.вик." + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Вимк.звук" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "Із %d абонентами" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Виклик" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Конференція" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Зменшення гучності" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Збільшення гучності" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "Поверніть рамку, щоб налаштувати %s." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Клавіатура" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Прийм. викл." + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Утрим. і прийн." + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Завер. і прийн." + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "Розмова з %s заверш." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Виклик на утрим." + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Невідомо" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Екстрен. виклик" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Голосова пошта" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Вхід. виклик" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Змінити" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Набір" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Утримується" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Виклик завершено" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Відп. повідомленням" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Гучність" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Клавіат." + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Зняти з утрим." + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Виклик" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Інші опції" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Додати до контактів" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Прийняти виклик" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Відхилити виклик" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Проведіть ліворуч двома пальцями, щоб відхилити виклик." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Проведіть угору двома пальцями, щоб відхилити виклик і надіслати повідомлення." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Проведіть праворуч двома пальцями, щоб прийняти виклик." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Гарнітура" + diff --git a/res/po/uz.po b/res/po/uz.po new file mode 100644 index 0000000..6b8d9b1 --- /dev/null +++ b/res/po/uz.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "Hozir transport boshqaryapman." + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "Gaplasholmayman. Nima gap?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "Bandman. Keyin qo‘ng‘. qilaman." + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "Men bandman. Menga SMS yozing." + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "Men uchrashuvdaman." + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "Qo‘n. yakunlash" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "Ovozsiz" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "%dta odam bilan" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "Qo‘ng‘ir." + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "Konferensiya" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "Ovozni pasaytirish" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "Ovozni ko‘tarish" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "%s’ni sozlash uchun tig‘ni aylantiring." + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "Klaviatura" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "Qo‘ng‘-q jvb" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "Kut va qab/qil" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "Tug. va qab/qil" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "%s b-n qo‘n-q tugadi." + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "Qo‘n-q kutishda" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "Noma’lum" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "Favq. qo‘ng‘-q" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "Ovozli pochta" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "Kir. qo‘n-q" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "Almashtir" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "Termoqda" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "Kutish rejimida" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "Qo‘n-q tugatildi" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "Xabar rad etish" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "Ovoz" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "Klaviat" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "Bekor qilish" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "Qo‘ng‘iroq" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "Qo‘shimcha opsiyalar" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "Kontaktlarga qo‘shish" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "Qo‘ng‘iroqni qabul qilish" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "Qo‘ng‘iroqni rad etish" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "Qo‘ng‘iroqni rad etish uchun ikkita barmoq bilan chapga suring." + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "Rad etish xabarini yuborish uchun ikkita barmoq bilan yuqoriga suring." + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "Qo‘ng‘iroqni qabul qilish uchun ikkita barmoq bilan o‘ngga suring." + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "Quloqlik" + diff --git a/res/po/zh_CN.po b/res/po/zh_CN.po new file mode 100644 index 0000000..59ed279 --- /dev/null +++ b/res/po/zh_CN.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "抱歉,我正在开车。" + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "我现在不方便讲话。有什么事吗?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "对不起,我正在忙。一会给你打电话。" + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "对不起,我正在忙。请留言。" + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "我正在开会。" + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "结束通话" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "静音" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "与 %d 人" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "通话" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "多方通话" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "降低音量" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "提高音量" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "转动表圈以调整%s。" + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "键盘" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "接听电话" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "按住并接听" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "结束并接听" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "与%s的通话将结束。" + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "保持通话" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "未知" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "紧急通话" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "语音邮件" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "来电" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "切换" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "正在拨号" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "保持中" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "通话已结束" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "拒绝信息" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "音量" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "键盘" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "取消保持" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "通话" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "更多选项" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "添加到联系人" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "接听来电" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "拒接来电" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "用两根手指向左滑动可拒接来电。" + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "用两根手指向上滑动可发送拒接短信。" + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "用两根手指向右滑动可接听来电。" + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "耳机" + diff --git a/res/po/zh_HK.po b/res/po/zh_HK.po new file mode 100644 index 0000000..e7ed4a6 --- /dev/null +++ b/res/po/zh_HK.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "抱歉,我正在開車。" + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "我現在不方便說話。怎麼了?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "抱歉,我正在忙。稍後回電給您。" + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "抱歉,我正在忙。請發訊息給我。" + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "我正在會議中。" + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "結束通話" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "靜音" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "與 %d 人" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "通話" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "會議" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "降低音量" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "提高音量" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "轉動錶圈以調整%s。" + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "鍵盤" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "接聽來電" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "按住並接聽" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "結束並接聽" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "與%s的通話將結束。" + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "保留通話" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "未知" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "緊急通話" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "留言信箱" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "來電" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "切換" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "撥號中" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "保留中" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "通話已結束" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "拒絕訊息" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "音量" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "鍵盤" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "取消保留" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "撥打" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "更多選項" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "加到聯絡人" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "接聽來電" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "拒絕來電" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "以兩指向左滑動以拒絕來電。" + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "以兩指向上滑動以發送拒絕訊息。" + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "以兩指向右滑動以接聽來電。" + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "耳機" + diff --git a/res/po/zh_TW.po b/res/po/zh_TW.po new file mode 100644 index 0000000..ef39a9e --- /dev/null +++ b/res/po/zh_TW.po @@ -0,0 +1,123 @@ +msgid "IDS_CST_TMBODY_SORRY_IM_DRIVING_NOW" +msgstr "抱歉,我現在在開車。" + +msgid "IDS_CST_TMBODY_I_CANT_TALK_NOW_WHATS_UP_Q" +msgstr "現在不方便接聽。有什麼事嗎?" + +msgid "IDS_CST_MBODY_SORRY_IM_BUSY_CALL_YOU_LATER_ABB" +msgstr "抱歉,我正在忙。稍後回電。" + +msgid "IDS_CST_BODY_SORRY_IM_BUSY_PLEASE_TEXT_ME_ABB" +msgstr "抱歉,我正在忙。請傳簡訊給我。" + +msgid "IDS_CST_BODY_IM_IN_A_MEETING" +msgstr "我在開會。" + +msgid "IDS_CALL_SK3_END_CALL" +msgstr "結束通話" + +msgid "IDS_CALL_BUTTON_MUTE_ABB" +msgstr "靜音" + +msgid "IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB" +msgstr "和 %d 個人" + +msgid "IDS_CALL_BUTTON_CALL" +msgstr "通話" + +msgid "IDS_CALL_BODY_CONFERENCE" +msgstr "會議" + +msgid "IDS_ACCS_OPT_DECREASE_VOLUME" +msgstr "降低音量" + +msgid "IDS_ACCS_OPT_INCREASE_VOLUME" +msgstr "提高音量" + +msgid "WDS_TTS_TBBODY_ROTATE_BEZEL_TO_ADJUST_PS" +msgstr "旋轉邊框來調整%s。" + +msgid "WDS_WMGR_TBOPT_KEYPAD" +msgstr "鍵盤" + +msgid "WDS_WMGR_HEADER_ANSWER_CALL_ABB" +msgstr "接聽來電" + +msgid "WDS_CST_MBODY_HOLD_AND_ACCEPT_ABB" +msgstr "按住並接聽" + +msgid "WDS_CST_MBODY_END_AND_ACCEPT_ABB" +msgstr "結束並接聽" + +msgid "WDS_CST_BODY_CALL_WITH_PS_WILL_END_ABB" +msgstr "將結束與%s的通話。" + +msgid "WDS_CST_HEADER_CALL_ON_HOLD_ABB" +msgstr "保留通話" + +msgid "WDS_CST_BODY_UNKNOWN_M_CALLER" +msgstr "未知" + +msgid "WDS_LOGS_MBODY_EMERGENCY_CALL_ABB" +msgstr "緊急電話" + +msgid "IDS_COM_HEADER_VOICE_MAIL_ORANGE" +msgstr "語音信箱" + +msgid "WDS_WMGR_HEADER_INCOMING_CALL_ABB" +msgstr "來電" + +msgid "WDS_WMGR_OPT_SWAP_ABB" +msgstr "切換" + +msgid "WDS_CALL_BODY_DIALING_M_STATUS" +msgstr "正在撥號" + +msgid "WDS_CST_HEADER_ON_HOLD_ABB" +msgstr "保留中" + +msgid "WDS_CST_HEADER_CALL_ENDED_ABB" +msgstr "通話已結束" + +msgid "WDS_CALL_BODY_DECLINE_MESSAGES_ABB" +msgstr "拒接訊息" + +msgid "WDS_CALL_BUTTON_VOLUME_ABB" +msgstr "音量" + +msgid "WDS_WMGR_OPT_KEYPAD_ABB" +msgstr "鍵盤" + +msgid "WDS_CST_BUTTON_UNHOLD_ABB" +msgstr "解除保留" + +msgid "IDS_CST_MBODY_GEAR_ABB" +msgstr "Gear" + +msgid "WDS_HS_TMBODY_CALL_ABB" +msgstr "撥打" + +msgid "IDS_CALL_OPT_MORE_OPTIONS_TTS" +msgstr "更多選項" + +msgid "IDS_VCALL_BUTTON_ADD_TO_CONTACTS" +msgstr "新增至聯絡人" + +msgid "WDS_CALL_TBBODY_ACCEPT_CALL" +msgstr "接聽來電" + +msgid "WDS_CALL_TBBODY_REJECT_CALL" +msgstr "拒接來電" + +msgid "WDS_CALL_TBBODY_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT_CALL" +msgstr "用雙指向左滑動來拒接來電。" + +msgid "WDS_CALL_TBBODY_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE" +msgstr "用雙指向上滑動來傳送拒接訊息。" + +msgid "WDS_CALL_TBBODY_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT_CALL" +msgstr "用雙指向右滑動來接聽來電。" + +msgid "WDS_WMGR_OPT_HEADSET_ABB" +msgstr "耳機" + diff --git a/src/model/BluetoothManager.h b/src/model/BluetoothManager.h deleted file mode 100644 index e020a1c..0000000 --- a/src/model/BluetoothManager.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 __CALLUI_MODEL_BLUETOOTH_MANAGER_H__ -#define __CALLUI_MODEL_BLUETOOTH_MANAGER_H__ - -#include <vconf.h> - -#include "implTypes.h" - -namespace callui { - - class BluetoothManager final { - public: - static BluetoothManagerSRef newInstance(); - - int getVolume() const; - int getMaxVolume() const; - ucl::Result setVolume(int volume); - - void setVolumeStateHandler(const BluetoothVolumeHandler &handler); - - bool isHeadsetConnected() const; - void setHeadsetConnectionChangeHandler(const NotiHandler &handler); - - private: - friend class ucl::ReffedObj<BluetoothManager>; - BluetoothManager(); - virtual ~BluetoothManager(); - - ucl::Result prepare(); - - ucl::Result initializeBluetooth(); - void deinitializeBluetooth(); - - ucl::Result registerAudioHandling(); - void unregisterAudioHandling(); - void onVolumeChanged(int volume); - - ucl::Result registerHeadsetConnectionHandling(); - void unregisterHeadsetConnectionHandling(); - - bool getHeadsetConnectionState(); - void setHeadsetConnectionState(bool isConnected); - void onHeadsetConnectionChanged(keynode_t *node); - - private: - BluetoothVolumeHandler m_btVolumeHandler; - NotiHandler m_btConnectionHandler; - bool m_btInitialized; - bool m_btAudioInitialized; - bool m_isHeadsetConnected; - }; -} - -#endif // __CALLUI_MODEL_BLUETOOTH_MANAGER_H__ diff --git a/src/model/CallManager.h b/src/model/CallManager.h deleted file mode 100644 index 985a7b8..0000000 --- a/src/model/CallManager.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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 __CALLUI_MODEL_CALL_MANAGER_H__ -#define __CALLUI_MODEL_CALL_MANAGER_H__ - -#include <call-manager-ext.h> - -#include "model/ICallManager.h" - -#include "implTypes.h" - -namespace callui { - - class CallManager final : - public ucl::RefCountAware, - public ICallManager { - public: - static CallManagerSRef newInstance(const CallClientSRef &callClient, - ICallManagerListenerWRef listener); - virtual ~CallManager(); - - CallClient &getCallClient(); - SimSlot getSimSlot() const; - ucl::Result dialVoiceCall(const std::string &number); - ucl::Result endCall(unsigned int callId, CallReleaseType type); - ucl::Result splitCalls(CallInfoSRef callInfo, - const IConferenceCallInfoSCRef &confCallInfo); - ContactInfoProviderSRef getContactInfoProvider(); - RejectMsgProviderSRef getRejectMsgProvider(); - - ucl::Result processOutgoingCall(const std::string &telNum); - ucl::Result processIncomingCall(SimSlot slot); - - // ICallManager - - virtual IIncomingCallSRef getIncomingCall() override final; - virtual IActiveCallSRef getActiveCall() override final; - virtual IHeldCallSRef getHeldCall() override final; - virtual IEndCallSRef getEndCall() override final; - virtual CallMask getAvailableCalls() const override final; - - private: - friend class ucl::ReffedObj<CallManager>; - CallManager(ucl::IRefCountObj &rc, const CallClientSRef &callClient, - ICallManagerListenerWRef listener); - - ucl::Result prepare(); - ucl::Result initCalls(); - - template <class TYPE, class TYPE2> - ucl::Result updateCall(ucl::SharedRef<TYPE> &call, TYPE2 &&data); - - ucl::Result processEndCallEvent(unsigned int callId, - cm_call_data_h cmIncom, - cm_call_data_h cmActive, - cm_call_data_h cmHeld); - - ucl::Result processCommonCallEvent(unsigned int callId, - cm_call_data_h cmIncom, - cm_call_data_h cmActive, - cm_call_data_h cmHeld); - - void callEventCb(cm_call_event_e call_event, cm_call_event_data_h call_state_data); - void dialStatusCb(cm_dial_status_e status); - - private: - CallClientSRef m_callClient; - RejectMsgProviderSRef m_rejectMsgProvider; - ContactInfoProviderSRef m_contactInfoProvider; - ICallManagerListenerWRef m_listener; - IncomingCallSRef m_incomingCall; - ActiveCallSRef m_activeCall; - HeldCallSRef m_heldCall; - EndCallSRef m_endCall; - SimSlot m_slot; - bool m_waitDialing; - - int m_confTypeCallReq; - bool m_blockCMEvents; - }; - -} - -#endif // __CALLUI_MODEL_CALL_MANAGER_H__ diff --git a/src/model/ContactInfo.h b/src/model/ContactInfo.h deleted file mode 100644 index 48cfad9..0000000 --- a/src/model/ContactInfo.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 __CALLUI_MODEL_CONTACT_INFO_H__ -#define __CALLUI_MODEL_CONTACT_INFO_H__ - -#include "contacts_types.h" - -#include "model/IContactInfo.h" - -#include "implTypes.h" - -namespace callui { - - class ContactInfo final : public IContactInfo { - public: - static ContactInfoSRef newInstance(int personId, - const std::string &name, - const std::string &imagePath, - ContactNameSourceType type); - virtual ~ContactInfo(); - - // IContactInfo - - virtual const std::string &getName() const override final; - virtual const std::string &getImagePath() const override final; - virtual ContactNameSourceType getNameSourceType() const override final; - - private: - friend class ucl::ReffedObj<ContactInfo>; - ContactInfo(int personId, - const std::string &name, - const std::string &imagePath, - ContactNameSourceType type); - - private: - int m_personId; - std::string m_name; - std::string m_imagePath; - ContactNameSourceType m_nameSource; - }; - -} - -#endif // __CALLUI_MODEL_CONTACT_INFO_H__ diff --git a/src/model/IIndicatorStateSource.h b/src/model/IIndicatorStateSource.h deleted file mode 100644 index 53eb2cc..0000000 --- a/src/model/IIndicatorStateSource.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 __CALLUI_MODEL_I_STATE_SOURCE_H__ -#define __CALLUI_MODEL_I_STATE_SOURCE_H__ - -#include "implTypes.h" - -#include "model/IndicatorState.h" - -namespace callui { - - class IIndicatorStateSource : public ucl::Polymorphic { - public: - virtual IndicatorState getState() const = 0; - virtual void setStateChangeHandler(const NotiHandler &handler) = 0; - }; -} - -#endif // __CALLUI_MODEL_I_STATE_SOURCE_H__ diff --git a/src/model/RejectMsg.h b/src/model/RejectMsg.h deleted file mode 100644 index acc4a9b..0000000 --- a/src/model/RejectMsg.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 __CALLUI_MODEL_REJECT_MSG_H__ -#define __CALLUI_MODEL_REJECT_MSG_H__ - -#include "model/IRejectMsg.h" - -#include "ucl/misc/TString.h" - -#include "implTypes.h" - -namespace callui { - - class RejectMsg : public IRejectMsg { - public: - static RejectMsgSRef newInstance(MsgClientWRef client, const ucl::TString &string); - virtual ~RejectMsg(); - - ucl::Result send(const std::string &number, SimSlot slot); - - // IRejectMsg - std::string getText() const override final; - - private: - friend class ucl::ReffedObj<RejectMsg>; - RejectMsg(MsgClientWRef client, const ucl::TString &string); - - ucl::Result prepare(); - - private: - MsgClientWRef m_msgClient; - ucl::TString m_msg; - }; - -} - -#endif // __CALLUI_MODEL_REJECT_MSG_H__ diff --git a/src/model/SimSlotStateSource.h b/src/model/SimSlotStateSource.h deleted file mode 100644 index 686eb01..0000000 --- a/src/model/SimSlotStateSource.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 __CALLUI_MODEL_SIM_SLOT_STATE_SOURCE_H__ -#define __CALLUI_MODEL_SIM_SLOT_STATE_SOURCE_H__ - -#include "IIndicatorStateSource.h" - -namespace callui { - - class SimSlotStateSource final : public IIndicatorStateSource { - public: - SimSlotStateSource(SimSlot slot, bool isForwarded); - virtual ~SimSlotStateSource(); - void updateSimSlot(SimSlot slot, bool isForwarded); - - // IIndicatorStateSource - - virtual IndicatorState getState() const override final; - virtual void setStateChangeHandler(const NotiHandler &handler) override final; - - public: - union Bits { - struct { - uint8_t property : 4; - uint8_t simSlot : 4; - uint8_t isForwarded: 1; - }; - uint64_t value; - - Bits(); - Bits(const IndicatorState &state); - }; - - private: - Bits m_bits; - NotiHandler m_handler; - }; - -} - -#endif // __CALLUI_MODEL_SIM_SLOT_STATE_SOURCE_H__ diff --git a/src/model/SoundManager.h b/src/model/SoundManager.h deleted file mode 100644 index 4e993d8..0000000 --- a/src/model/SoundManager.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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 __CALLUI_MODEL_SOUND_MANAGER_H__ -#define __CALLUI_MODEL_SOUND_MANAGER_H__ - -#include <call-manager-ext.h> -#include <sound_manager.h> - -#include "model/ISoundManager.h" - -#include "implTypes.h" - -namespace callui { - - class SoundManager final : - public ucl::RefCountAware, - public ISoundManager { - public: - static SoundManagerSRef newInstance(const CallClientSRef &client); - virtual ~SoundManager(); - - // ISoundManager - - virtual ucl::Result setSpeakerState(bool isEnable) override final; - virtual ucl::Result setBluetoothState(bool isEnable) override final; - virtual AudioStateType getAudioState() const override final; - - virtual ucl::Result setMuteState(bool isEnable) override final; - virtual bool getMuteState() const override final; - - virtual ucl::Result startDtmf( - const unsigned char dtmfDigit) override final; - virtual ucl::Result stopDtmf() override final; - - virtual void addAudioStateHandler( - const AudioStateHandler &handler) override final; - virtual void delAudioStateHandler( - const AudioStateHandler &handler) override final; - - virtual void addMuteStateHandler( - const MuteStateHandler &handler) override final; - virtual void delMuteStateHandler( - const MuteStateHandler &handler) override final; - - virtual void addVolumeStateHandler( - const VolumeLevelHandler &handler) override final; - virtual void delVolumeStateHandler( - const VolumeLevelHandler &handler) override final; - - virtual int getMaxVolume() const override final; - virtual int getVolume() const override final; - virtual ucl::Result setVolume(int value) override final; - - virtual bool isBTSupported() const override final; - - virtual bool isBTHeadsetConnected() const override final; - virtual void addBTHeadsetConnectionChangeHandler( - const NotiHandler &handler) override final; - virtual void delBTHeadsetConnectionChangeHandler( - const NotiHandler &handler) override final; - - private: - friend class ucl::ReffedObj<SoundManager>; - SoundManager(ucl::IRefCountObj &rc, const CallClientSRef &client); - - ucl::Result prepare(); - ucl::Result registerCallbacks(); - - void onAudioStateChanged(cm_audio_state_type_e state); - void onMuteStateChanged(cm_mute_status_e status); - void onHeadsetConnectionChanged(); - - void onBTHeadsetVolumeChanged(int volume); - void onGearVolumeChanged(sound_type_e type, unsigned int volume); - - private: - CallClientSRef m_client; - BluetoothManagerSRef m_btManager; - AudioStateEvent m_audioStateEvent; - MuteStateEvent m_muteStateEvent; - VolumeLevelEvent m_volumeLevelEvent; - ucl::Event<NotiHandler> m_btVoiceDeviceConnEvent; - int m_deviceVolumeCbID; - }; - -} - -#endif // __CALLUI_MODEL_SOUND_MANAGER_H__ diff --git a/src/model/VoiceControlStateProvider.cpp b/src/model/VoiceControlStateProvider.cpp deleted file mode 100644 index d52999d..0000000 --- a/src/model/VoiceControlStateProvider.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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 "VoiceControlStateProvider.h" - -#include "common.h" - -// Temporary until VCONFLAG will not be added to a system -#define VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER VCONFKEY_CISSAPPL_ANSWERING_KEY_BOOL - -namespace callui { - - using namespace ucl; - - VoiceControlStateProvider::VoiceControlStateProvider(): - m_enableState(false) - { - } - - VoiceControlStateProvider::~VoiceControlStateProvider() - { - delSysStateCallback(); - } - - VoiceControlStateProviderSRef VoiceControlStateProvider::newInstance() - { - auto result = makeShared<VoiceControlStateProvider>(); - FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!"); - return result; - } - - Result VoiceControlStateProvider::prepare() - { - FAIL_RETURN(addSysStateCallback(), - "addSysStateCallbacks() failed!"); - - FAIL_RETURN(initState(), "initState() failed!"); - return RES_OK; - } - - Result VoiceControlStateProvider::initState() - { - auto val = 0; - if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, &val) != 0) { - LOG_RETURN(RES_FAIL, "vconf_get_bool() failed!"); - } - updateState(val); - - return RES_OK; - } - - bool VoiceControlStateProvider::getState() const - { - return m_enableState; - } - - void VoiceControlStateProvider::addStateChangeHandler( - const NotiHandler &handler) - { - m_event += handler; - } - - void VoiceControlStateProvider::removeStateChangeHandler( - const NotiHandler &handler) - { - m_event -= handler; - } - - Result VoiceControlStateProvider::addSysStateCallback() - { - if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, - CALLBACK_B(VoiceControlStateProvider::onStateChanged), - this) != 0) { - LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed"); - } - return RES_OK; - } - - void VoiceControlStateProvider::delSysStateCallback() - { - vconf_ignore_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, - CALLBACK_B(VoiceControlStateProvider::onStateChanged)); - } - - void VoiceControlStateProvider::onStateChanged( - keynode_t *node) - { - auto val = 0; - if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, &val) != 0) { - LOG_RETURN_VOID(RES_FAIL, "vconf_get_bool() failed!"); - } - - if (updateState(val) && !m_event.isEmpty()) { - m_event.dispatch(); - } - } - - bool VoiceControlStateProvider::updateState(bool isEnable) - { - if (m_enableState != isEnable) { - m_enableState = isEnable; - return true; - } - return false; - } - - -} diff --git a/src/model/VoiceControlStateProvider.h b/src/model/VoiceControlStateProvider.h deleted file mode 100644 index f0d493c..0000000 --- a/src/model/VoiceControlStateProvider.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 __CALLUI_MODEL_VOICE_CONTROL_STATE_PROVIDER_H__ -#define __CALLUI_MODEL_VOICE_CONTROL_STATE_PROVIDER_H__ - -#include <vconf.h> - -#include "implTypes.h" - -namespace callui { - - class VoiceControlStateProvider final { - public: - static VoiceControlStateProviderSRef newInstance(); - virtual ~VoiceControlStateProvider(); - - bool getState() const; - void addStateChangeHandler(const NotiHandler &handler); - void removeStateChangeHandler(const NotiHandler &handler); - - private: - friend class ucl::ReffedObj<VoiceControlStateProvider>; - VoiceControlStateProvider(); - - ucl::Result prepare(); - - ucl::Result addSysStateCallback(); - void delSysStateCallback(); - ucl::Result initState(); - bool updateState(bool isEnable); - - void onStateChanged(keynode_t *node); - - private: - bool m_enableState; - ucl::Event<NotiHandler> m_event; - }; - -} - -#endif // __CALLUI_MODEL_VOICE_CONTROL_STATE_PROVIDER_H__ diff --git a/src/model/VoiceControlStateSource.cpp b/src/model/VoiceControlStateSource.cpp deleted file mode 100644 index 5009110..0000000 --- a/src/model/VoiceControlStateSource.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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 "VoiceControlStateSource.h" - -#include "VoiceControlStateProvider.h" - -#include "common.h" - -namespace callui { - - using namespace ucl; - - VoiceControlStateSource::Bits::Bits(): - property(convertEnumValueToInt(IndicatorProperty::VOICE_CONTROL)), - isEnable(0) - { - } - - VoiceControlStateSource::Bits::Bits(const IndicatorState &state): - value(state.value) - { - if (property != convertEnumValueToInt( - IndicatorProperty::VOICE_CONTROL)) { - ELOG("State of incorrect property type [%d]", property); - *this = {}; - } - } - - VoiceControlStateSource::VoiceControlStateSource(IRefCountObj &rc, - const VoiceControlStateProviderSRef &provider): - RefCountAware(&rc), - m_vcProvider(provider) - { - m_vcProvider->addStateChangeHandler(WEAK_DELEGATE( - VoiceControlStateSource::onStateChangedEvent, - asWeak(*this))); - - updateStateBits(m_vcProvider->getState()); - } - - VoiceControlStateSource::~VoiceControlStateSource() - { - m_vcProvider->removeStateChangeHandler(WEAK_DELEGATE( - VoiceControlStateSource::onStateChangedEvent, - asWeak(*this))); - } - - VoiceControlStateSourceSRef VoiceControlStateSource::newInstance( - const VoiceControlStateProviderSRef &provider) - { - if (!provider) { - LOG_RETURN_VALUE(RES_FAIL, {}, "provider is NULL"); - } - - return makeShared<VoiceControlStateSource>(provider); - } - - void VoiceControlStateSource::onStateChangedEvent() - { - if (updateStateBits(m_vcProvider->getState()) && m_handler) { - m_handler(); - } - } - - Result VoiceControlStateSource::initState() - { - updateStateBits(m_vcProvider->getState()); - return RES_OK; - } - - IndicatorState VoiceControlStateSource::getState() const - { - return {m_bits.value}; - } - - void VoiceControlStateSource::setStateChangeHandler( - const NotiHandler &handler) - { - m_handler = handler; - } - - bool VoiceControlStateSource::updateStateBits(bool isEnable) - { - if (m_bits.isEnable != isEnable) { - m_bits.isEnable = isEnable; - return true; - } - return false; - } - - bool getVoiceControlState(IndicatorState state) - { - return VoiceControlStateSource::Bits(state).isEnable; - } - -} diff --git a/src/model/VoiceControlStateSource.h b/src/model/VoiceControlStateSource.h deleted file mode 100644 index b0864bb..0000000 --- a/src/model/VoiceControlStateSource.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 __CALLUI_VOICE_CONTROL_STATE_SOURCE_H__ -#define __CALLUI_VOICE_CONTROL_STATE_SOURCE_H__ - -#include "IIndicatorStateSource.h" - -#include <vconf.h> - -#include "implTypes.h" - -namespace callui { - - class VoiceControlStateSource final : - public IIndicatorStateSource, - public ucl::RefCountAware { - public: - static VoiceControlStateSourceSRef newInstance( - const VoiceControlStateProviderSRef &provider); - virtual ~VoiceControlStateSource(); - - // IIndicatorStateSource - - virtual IndicatorState getState() const override final; - virtual void setStateChangeHandler( - const NotiHandler &handler) override final; - - private: - friend class ucl::ReffedObj<VoiceControlStateSource>; - VoiceControlStateSource(ucl::IRefCountObj &rc, - const VoiceControlStateProviderSRef &provider); - - ucl::Result prepare(); - - void onStateChangedEvent(); - ucl::Result initState(); - bool updateStateBits(bool isEnable); - - public: - union Bits { - struct { - uint8_t property : 4; - uint8_t isEnable : 1; - }; - uint64_t value; - - Bits(); - Bits(const IndicatorState &state); - }; - - private: - Bits m_bits; - NotiHandler m_handler; - VoiceControlStateProviderSRef m_vcProvider; - }; - -} - -#endif // __CALLUI_VOICE_ANSWER_STATE_SOURCE_H__ diff --git a/src/model/helpers.h b/src/model/helpers.h deleted file mode 100644 index d92e149..0000000 --- a/src/model/helpers.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 __CALLUI_MODEL_HELPERS_H__ -#define __CALLUI_MODEL_HELPERS_H__ - -#include <call-manager-ext.h> -#include <type_traits> - -#include "implTypes.h" - -namespace callui { - - ucl::Result convertCMResult(int cmRes); - - AudioStateType convertCMAudioState(cm_audio_state_type_e state); - - cm_multi_sim_slot_type_e convertCUISimSlot(SimSlot slot); - - SimSlot convertCMSimSlot(cm_multi_sim_slot_type_e slot); - - cm_call_release_type_e convertCUICallReleaseType(CallReleaseType type); - - ucl::Result convertCMEventType(cm_call_event_e cmEvent, CallEventType *appEvent); - - cm_call_answer_type_e convertCUICallAnswerType(CallAnswerType type); - - bool isFlightModeActive(); - - template<typename TYPE> - constexpr auto convertEnumValueToInt(TYPE e) -> typename std::underlying_type<TYPE>::type - { - return static_cast<typename std::underlying_type<TYPE>::type>(e); - } -} - -#include "helpers.hpp" - -#endif // __CALLUI_MODEL_HELPERS_H__ diff --git a/src/model/implTypes.h b/src/model/implTypes.h deleted file mode 100644 index 7e2b341..0000000 --- a/src/model/implTypes.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 __CALLUI_MODEL_IMPL_TYPES_H__ -#define __CALLUI_MODEL_IMPL_TYPES_H__ - -#include "model/types.h" -#include "ucl/misc/Event.h" -#include "ucl/util/smartDelegation.h" - -namespace callui { - - enum class CallReleaseType { - BY_CALL_HANDLE, - ALL, - ALL_HOLD, - ALL_ACTIVE - }; - - enum class CallManagerErr { - DIAL_CANCEL, - DIAL_FAIL, - DIAL_FAIL_SS, - DIAL_FAIL_FDN, - DIAL_FLIGHT_MODE - }; - - UCL_DECLARE_REF_ALIASES(CallClient); - - UCL_DECLARE_REF_ALIASES(SoundManager); - UCL_DECLARE_REF_ALIASES(CallManager); - - UCL_DECLARE_REF_ALIASES(ICallManagerListener); - - UCL_DECLARE_REF_ALIASES(IncomingCall); - UCL_DECLARE_REF_ALIASES(ActiveCall); - UCL_DECLARE_REF_ALIASES(HeldCall); - UCL_DECLARE_REF_ALIASES(EndCall); - - UCL_DECLARE_REF_ALIASES(CallInfo); - UCL_DECLARE_REF_ALIASES(ContactInfo); - UCL_DECLARE_REF_ALIASES(ConferenceCallInfo); - - UCL_DECLARE_REF_ALIASES(MsgClient); - UCL_DECLARE_REF_ALIASES(RejectMsgProvider); - UCL_DECLARE_REF_ALIASES(RejectMsg); - - UCL_DECLARE_REF_ALIASES(IndicatorStateProvider); - UCL_DECLARE_REF_ALIASES(IIndicatorStateSource); - - UCL_DECLARE_REF_ALIASES(ConnectionStateSource); - UCL_DECLARE_REF_ALIASES(RssiStateSource); - UCL_DECLARE_REF_ALIASES(BatteryStateSource); - UCL_DECLARE_REF_ALIASES(SimSlotStateSource); - UCL_DECLARE_REF_ALIASES(HdVoiceStateSource); - UCL_DECLARE_REF_ALIASES(VoiceControlStateSource); - - UCL_DECLARE_REF_ALIASES(VoiceControlStateProvider); - - UCL_DECLARE_REF_ALIASES(ContactInfoProvider); - - UCL_DECLARE_REF_ALIASES(BluetoothManager); - - using AudioStateEvent = ucl::Event<AudioStateHandler>; - using MuteStateEvent = ucl::Event<MuteStateHandler>; - using VolumeLevelEvent = ucl::Event<VolumeLevelHandler>; - - using BluetoothVolumeHandler = ucl::WeakDelegate<void(int)>; -} - -#endif // __CALLUI_MODEL_IMPL_TYPES_H__ diff --git a/src/presenters/AcceptDialog.cpp b/src/presenters/AcceptDialog.cpp deleted file mode 100644 index df1efbf..0000000 --- a/src/presenters/AcceptDialog.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* - * 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 "presenters/AcceptDialog.h" - -#include "resources.h" -#include "common.h" - -namespace callui { namespace { namespace impl { - - using namespace ucl; - - constexpr ElmStyle POPUP_STYLE {"circle"}; - - constexpr SmartEvent POPUP_DISMISSED {"dismissed"}; - - constexpr EdjePart PART_SWL_CONTENT{"elm.swallow.content"}; - - void *asData(const AcceptDialogEvent event) - { - return reinterpret_cast<void *>(static_cast<intptr_t>(event)); - } - - AcceptDialogEvent asEvent(void *const data) - { - return static_cast<AcceptDialogEvent>( - reinterpret_cast<intptr_t>(data)); - } - -}}} - -namespace callui { - - using namespace ucl; - - AcceptDialog::Builder::Builder() - { - } - - AcceptDialog::Builder::~Builder() - { - } - - AcceptDialog::Builder &AcceptDialog::Builder::setHandler(AcceptDialogHandler handler) - { - m_handler = handler; - return *this; - } - - AcceptDialogWRef AcceptDialog::Builder::build(ElmWidget &parent) const - { - if (!m_handler) { - LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "m_handler is NULL"); - } - - auto result = makeShared<AcceptDialog>(m_handler); - FAIL_RETURN_VALUE(result->prepare(parent), {}, - "result->prepare() failed!"); - - return result; - } - - AcceptDialog::AcceptDialog(IRefCountObj &rc, - const AcceptDialogHandler &handler): - GuiPresenter(rc), - m_handler(handler), - m_isDismissed(false) - { - } - - AcceptDialog::~AcceptDialog() - { - } - - 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); - - addDeactivatorException(this); - broadcastDeactivate(); - - return RES_OK; - } - - Result AcceptDialog::createPopup(ElmWidget &parent, ElmStyle style) - { - Evas_Object *const popupEo = elm_popup_add(parent); - if (!popupEo) { - LOG_RETURN(RES_FAIL, "elm_popup_add() failed!"); - } - evas_object_size_hint_weight_set(popupEo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - m_popup = makeShared<StyledWidget>(popupEo, true); - m_popup->setStyle(style); - - show(*m_popup); - - m_popup->addEventHandler(impl::POPUP_DISMISSED, WEAK_DELEGATE( - AcceptDialog::onPopupDismissed, asWeak(*this))); - - eext_object_event_callback_add(*m_popup, EEXT_CALLBACK_BACK, - CALLBACK_A(AcceptDialog::onPopupHWBackKey), this); - - return RES_OK; - } - - void AcceptDialog::onGenlistItemClickedCb(Evas_Object *obj, void *eventInfo) - { - if (!eventInfo) - LOG_RETURN_VOID(RES_FAIL, "eventInfo is NULL"); - - Elm_Object_Item *item = static_cast<Elm_Object_Item *>(eventInfo); - handleEvent(impl::asEvent(elm_object_item_data_get(item))); - } - - Result AcceptDialog::createGenlist() - { - Evas_Object *const glEo = elm_genlist_add(*m_popup); - if (!glEo) { - LOG_RETURN(RES_FAIL, "elm_genlist_add() failed!"); - } - evas_object_size_hint_weight_set(glEo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(glEo, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_genlist_mode_set(glEo, ELM_LIST_COMPRESS); - elm_genlist_homogeneous_set(glEo, EINA_TRUE); - - m_genlist = makeShared<StyledWidget>(glEo); - - Evas_Object *circleGlEo = eext_circle_object_genlist_add(glEo, getCircleSurface(*m_genlist)); - eext_circle_object_genlist_scroller_policy_set(circleGlEo, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - eext_rotary_object_event_activated_set(circleGlEo, EINA_TRUE); - - FAIL_RETURN(fillGenlist(), "fillGenlist() failed!"); - - m_popup->setContent(glEo, impl::PART_SWL_CONTENT); - - return RES_OK; - } - - Result AcceptDialog::addGenlistTitleItem() - { - static Elm_Genlist_Item_Class titleItc = createGenlistItemClass("title", - [](void *data, Evas_Object *obj, const char *part) -> char * { - return strdup(STR_ANSWER_CALL.translate()); - }); - - Elm_Object_Item *item = elm_genlist_item_append(*m_genlist, &titleItc, - nullptr, - nullptr, - ELM_GENLIST_ITEM_NONE, - nullptr, - nullptr); - if (!item) - LOG_RETURN(RES_FAIL, "elm_genlist_item_append() failed!"); - - return RES_OK; - } - - Result AcceptDialog::addGenlistTextItem(AcceptDialogEvent event) - { - static Elm_Genlist_Item_Class textItc = createGenlistItemClass("1text.1icon", - [](void *data, Evas_Object *obj, const char *part) -> char * { - switch (impl::asEvent(data)) { - case AcceptDialogEvent::HOLD_AND_ACCEPT: - return strdup(STR_HOLD_AND_ACCEPT.translate()); - case AcceptDialogEvent::END_AND_ACCEPT: - return strdup(STR_END_AND_ACCEPT.translate()); - default: - return nullptr; - } - }); - - Elm_Object_Item *item = elm_genlist_item_append(*m_genlist, &textItc, - impl::asData(event), - nullptr, - ELM_GENLIST_ITEM_NONE, - CALLBACK_A(AcceptDialog::onGenlistItemClickedCb), - this); - if (!item) - LOG_RETURN(RES_FAIL, "elm_genlist_item_append() failed!"); - - return RES_OK; - } - - Result AcceptDialog::addGenlistBottomItem() - { - static Elm_Genlist_Item_Class paddingItc = createGenlistItemClass("1text.1icon"); - - Elm_Object_Item *item = elm_genlist_item_append(*m_genlist, &paddingItc, - nullptr, - nullptr, - ELM_GENLIST_ITEM_NONE, - nullptr, - nullptr); - if (!item) - LOG_RETURN(RES_FAIL, "elm_genlist_item_append() failed!"); - - return RES_OK; - } - - - Result AcceptDialog::fillGenlist() - { - FAIL_RETURN(addGenlistTitleItem(), "addGenlistTitleItem() failed!"); - - FAIL_RETURN(addGenlistTextItem(AcceptDialogEvent::HOLD_AND_ACCEPT), - "addGenlistTextItem() failed!"); - - FAIL_RETURN(addGenlistTextItem(AcceptDialogEvent::END_AND_ACCEPT), - "addGenlistTextItem() failed!"); - - FAIL_RETURN(addGenlistBottomItem(), "addGenlistBottomItem() failed!"); - - return RES_OK; - } - - void AcceptDialog::handleEvent(AcceptDialogEvent event) - { - const auto keepAliver = asShared(*this); - if (dispatchEvent(event)) { - dismiss(); - } - } - - bool AcceptDialog::dispatchEvent(AcceptDialogEvent event) - { - if (!m_handler) { - WLOG("Handler was destroyed!"); - return true; - } - return m_handler(*this, event); - } - - void AcceptDialog::onPopupDismissed(ucl::Widget &widget, void *eventInfo) - { - dispose(); - } - - void AcceptDialog::onPopupHWBackKey(Evas_Object *obj, void *eventInfo) - { - if (!m_isDismissed) { - handleEvent(AcceptDialogEvent::BACK); - } - } - - void AcceptDialog::dismiss() - { - if (m_popup && !m_isDismissed) { - m_isDismissed = true; - deactivateBy(m_popup.get()); - elm_popup_dismiss(*m_popup); - } - } - - 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/src/presenters/AccessoryPresenter.cpp b/src/presenters/AccessoryPresenter.cpp deleted file mode 100644 index 23787f0..0000000 --- a/src/presenters/AccessoryPresenter.cpp +++ /dev/null @@ -1,688 +0,0 @@ -/* - * 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 "presenters/AccessoryPresenter.h" - -#include "ucl/appfw/types.h" - -#include "model/ISoundManager.h" -#include "model/ICallManager.h" -#include "model/IActiveCall.h" -#include "model/IEndCall.h" -#include "model/ICallInfo.h" - -#include "view/VolumeControl.h" - -#include "resources.h" -#include "common.h" - -#define CU_APP_CONTROL_MIME_CONTACT "application/vnd.tizen.contact" - -namespace callui { namespace { namespace impl { - - using namespace ucl; - - constexpr LayoutTheme LAYOUT_ACCESSORY_WIDGET - {"layout", "callui", "accessory"}; - - constexpr EdjePart PART_SWL_VOLUME_SLIDER {"swl.volume_control"}; - - constexpr EdjePart PART_SWL_SLOT1 {"swl.slot.1"}; - constexpr EdjePart PART_SWL_SLOT2 {"swl.slot.2"}; - constexpr EdjePart PART_SWL_SLOT3 {"swl.slot.3"}; - - constexpr ElmStyle STYLE_BTN_VOLUME {"callui/volume"}; - constexpr ElmStyle STYLE_BTN_MUTE {"callui/mute"}; - constexpr ElmStyle STYLE_BTN_BT {"callui/bluetooth"}; - constexpr ElmStyle STYLE_BTN_ADD_CONTACT {"callui/add_contact"}; - - constexpr EdjeSignal SIGNAL_TURN_ON {"turn.on"}; - constexpr EdjeSignal SIGNAL_TURN_OFF {"turn.off"}; -}}} - -namespace callui { - - using namespace ucl; - - AccessoryPresenter::Builder::Builder() - { - } - - AccessoryPresenter::Builder & - AccessoryPresenter::Builder::setSoundManager(const ISoundManagerSRef &sm) - { - m_sm = sm; - return *this; - } - - AccessoryPresenter::Builder & - AccessoryPresenter::Builder::setCallManager(const ICallManagerSRef &cm) - { - m_cm = cm; - return *this; - } - - AccessoryPresenter::Builder & - AccessoryPresenter::Builder::setRequestExitHandler(const NotiHandler &handler) - { - m_exitHandler = handler; - return *this; - } - - AccessoryPresenter::Builder & - AccessoryPresenter::Builder::setParentWidget( - const ElmWidgetSRef &parentWidget) - { - m_parentWidget = parentWidget; - return *this; - } - - AccessoryPresenterSRef - AccessoryPresenter::Builder::build(GuiPresenter &parent) const - { - if (!m_sm || !m_cm || !m_parentWidget) { - LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set"); - } - - auto result = makeShared<AccessoryPresenter>(m_sm, m_exitHandler); - FAIL_RETURN_VALUE(result->prepare(parent, *m_parentWidget, m_cm), - {}, "result->prepare() failed!"); - - return result; - } - - AccessoryPresenter::AccessoryPresenter(IRefCountObj &rc, - const ISoundManagerSRef &sm, - const NotiHandler &handler): - GuiPresenter(rc), - m_sm(sm), - m_vcTimer(nullptr), - m_audioState(m_sm->getAudioState()), - m_mode(ComponentsMode::UNDEFINED), - m_exitHandler(handler) - { - } - - AccessoryPresenter::~AccessoryPresenter() - { - stopVCTimer(); - unregisterCallbacks(); - } - - Result AccessoryPresenter::prepare(GuiPresenter &parent, - ElmWidget &parentWidget, const ICallManagerSRef &cm) - { - FAIL_RETURN(GuiPresenter::prepare(parent), "Presenter::prepare() failed"); - - FAIL_RETURN(createWidget(parentWidget), "createWidget() failed"); - - FAIL_RETURN(createSlider(), "createSlider() failed"); - - FAIL_RETURN(createVolumeControl(), "createVolumeControl() failed"); - - updateVolume(m_sm->getVolume()); - - registerCallbacks(); - - updateMode(cm); - - FAIL_RETURN(updateModeRelativeComponents(cm), "updateComponents() failed"); - - return RES_OK; - } - - void AccessoryPresenter::updateMode(const ICallManagerSRef &cm) - { - m_mode = getCurrentMode(cm); - } - - AccessoryPresenter::ComponentsMode AccessoryPresenter::getCurrentMode( - const ICallManagerSRef &cm) - { - auto active = cm->getActiveCall(); - auto held = cm->getHeldCall(); - auto end = cm->getEndCall(); - - if (active && active->isDialingMode()) { - return ComponentsMode::OUTGOING; - } else if (active || held) { - return ComponentsMode::DURING; - } else if (end) { - return ComponentsMode::END; - } - return ComponentsMode::UNDEFINED; - } - - void AccessoryPresenter::setVolumeSliderVisiblity(bool isVisible) - { - if (isVisible) { - m_widget->setContent(*m_slider, impl::PART_SWL_VOLUME_SLIDER); - show(*m_slider); - } else { - m_widget->unsetContent(impl::PART_SWL_VOLUME_SLIDER); - hide(*m_slider); - } - } - - Result AccessoryPresenter::update(const ICallManagerSRef &cm) - { - auto curMode = getCurrentMode(cm); - if (m_mode == curMode) { - LOG_RETURN(RES_OK, "Mode is the same. No need to update"); - } - m_mode = curMode; - - FAIL_RETURN(updateModeRelativeComponents(cm), "updateComponents() failed"); - - return RES_OK; - } - - Result AccessoryPresenter::updateModeRelativeComponents( - const ICallManagerSRef &cm) - { - m_volumeBtn.reset(); - m_muteBtn.reset(); - m_bluetoothBtn.reset(); - m_addContactBtn.reset(); - m_unsavedPhoneNumber.clear(); - - setVolumeSliderVisiblity(m_mode != ComponentsMode::END); - - switch (m_mode) { - case ComponentsMode::OUTGOING: - case ComponentsMode::DURING: - return setActiveCallCompomnents(); - case ComponentsMode::END: - return setEndCallCompomnents(cm); - default: - return RES_OK; - } - return RES_OK; - } - - Result AccessoryPresenter::setActiveCallCompomnents() - { - FAIL_RETURN(createVolumeBtn(), "createVolumeBtn() failed"); - m_widget->setContent(*m_volumeBtn, impl::PART_SWL_SLOT1); - - FAIL_RETURN(createMuteBtn(), "createMuteBtn create failed"); - m_widget->setContent(*m_muteBtn, impl::PART_SWL_SLOT3); - - FAIL_RETURN(createBluetoothBtn(), "createBluetoothBtn() failed"); - m_widget->setContent(*m_bluetoothBtn, impl::PART_SWL_SLOT2); - - if (m_mode == ComponentsMode::OUTGOING) { - disable(*m_muteBtn); - } else { - enable(*m_muteBtn); - } - - return RES_OK; - } - - Result AccessoryPresenter::setEndCallCompomnents(const ICallManagerSRef &cm) - { - auto endCall = cm->getEndCall(); - if (!endCall) { - FAIL_RETURN(RES_FAIL, "endCall is NULL"); - } - auto callInfo = endCall->getInfo(); - if (!callInfo) { - FAIL_RETURN(RES_FAIL, "callInfo is NULL"); - } - if (!(callInfo->isEmergency()) - && !(callInfo->getConferenceMemberCount() > 1) - && !(callInfo->getContactInfo())) { - FAIL_RETURN(createAddContactBtn(), "createAddContactBtn() failed"); - m_widget->setContent(*m_addContactBtn, impl::PART_SWL_SLOT2); - m_unsavedPhoneNumber = callInfo->getPhoneNumber(); - } - return RES_OK; - } - - - Widget &AccessoryPresenter::getWidget() - { - return *m_widget; - } - - void AccessoryPresenter::hideVolumeControls() - { - stopVCTimer(); - hide(*m_vc); - } - - Result AccessoryPresenter::createWidget(ElmWidget &parent) - { - m_widget = Layout::Builder(). - setTheme(impl::LAYOUT_ACCESSORY_WIDGET). - setIsOwner(true). - build(parent); - if (!m_widget) { - LOG_RETURN(RES_FAIL, "Layout::build() failed!"); - } - - return RES_OK; - } - - Result AccessoryPresenter::createSlider() - { - m_slider = Slider::Builder(). - setMaxValue(m_sm->getMaxVolume()). - build(*m_widget); - if (!m_slider) { - LOG_RETURN(RES_FAIL, "Slider::build() failed"); - } - m_widget->setContent(*m_slider, impl::PART_SWL_VOLUME_SLIDER); - - return RES_OK; - } - - Result AccessoryPresenter::createVolumeControl() - { - m_vc = VolumeControl::Builder(). - setInfoText(STR_VOLUME). - setMaxValue(m_sm->getMaxVolume()). - setEventHandler(WEAK_DELEGATE( - AccessoryPresenter::onVolumeControlEventCb, - asWeak(*this))). - build(*m_widget); - if (!m_vc) { - LOG_RETURN(RES_FAIL, "VolumeControl::build() failed"); - } - - auto window = m_vc->getWindow(); - if (!window) { - LOG_RETURN(RES_FAIL, "Window is NULL!"); - } - int w = 0, h = 0; - window->getScreenSize(&w, &h); - - m_vc->move(0, 0); - m_vc->resize(w, h); - hide(*m_vc); - - return RES_OK; - } - - Result AccessoryPresenter::createVolumeBtn() - { - Evas_Object *eo = elm_button_add(*m_widget); - if (!eo) { - LOG_RETURN(RES_FAIL, "eo is NULL"); - } - - m_volumeBtn = makeShared<StyledWidget>(eo, true); - m_volumeBtn->setStyle(impl::STYLE_BTN_VOLUME); - m_volumeBtn->addEventHandler(BTN_CLICKED, - WEAK_DELEGATE(AccessoryPresenter::onVolumeBtnClicked, - asWeak(*this))); - show(*m_volumeBtn); - - return RES_OK; - } - - Result AccessoryPresenter::createMuteBtn() - { - Evas_Object *eo = elm_button_add(*m_widget); - if (!eo) { - LOG_RETURN(RES_FAIL, "eo is NULL"); - } - m_muteBtn = makeShared<StyledWidget>(eo, true); - m_muteBtn->setStyle(impl::STYLE_BTN_MUTE); - m_muteBtn->addEventHandler(BTN_CLICKED, - WEAK_DELEGATE(AccessoryPresenter::onMuteBtnClicked, - asWeak(*this))); - - show(*m_muteBtn); - - return RES_OK; - } - - Result AccessoryPresenter::createBluetoothBtn() - { - Evas_Object *eo = elm_button_add(*m_widget); - if (!eo) { - LOG_RETURN(RES_FAIL, "eo is NULL"); - } - m_bluetoothBtn = makeShared<StyledWidget>(eo, true); - m_bluetoothBtn->setStyle(impl::STYLE_BTN_BT); - m_bluetoothBtn->addEventHandler(BTN_CLICKED, - WEAK_DELEGATE(AccessoryPresenter::onBluetoothBtnClicked, - asWeak(*this))); - - show(*m_bluetoothBtn); - - (m_audioState == AudioStateType::BT) ? - m_bluetoothBtn->emit(impl::SIGNAL_TURN_ON) : - m_bluetoothBtn->emit(impl::SIGNAL_TURN_OFF); - if (!m_sm->isBTSupported()) { - disable(*m_bluetoothBtn); - } - - return RES_OK; - } - - Result AccessoryPresenter::createAddContactBtn() - { - Evas_Object *eo = elm_button_add(*m_widget); - if (!eo) { - LOG_RETURN(RES_FAIL, "eo is NULL"); - } - m_addContactBtn = makeShared<StyledWidget>(eo, true); - m_addContactBtn->setStyle(impl::STYLE_BTN_ADD_CONTACT); - m_addContactBtn->addEventHandler(BTN_CLICKED, - WEAK_DELEGATE(AccessoryPresenter::onAddContactBtnClicked, - asWeak(*this))); - show(*m_addContactBtn); - - return RES_OK; - } - - void AccessoryPresenter::onVolumeBtnClicked(Widget &widget, void *eventInfo) - { - if (!isActive()) { - ILOG("Presenter is not active. Ignore"); - return; - } - - show(*m_vc); - startVCTimer(); - } - - void AccessoryPresenter::onMuteBtnClicked(Widget &widget, void *eventInfo) - { - if (!isActive()) { - ILOG("Presenter is not active. Ignore"); - return; - } - - m_sm->setMuteState(!m_sm->getMuteState()); - } - - void AccessoryPresenter::onBluetoothBtnClicked(Widget &widget, - void *eventInfo) - { - if (m_audioState == AudioStateType::BT) { - auto res = m_sm->setBluetoothState(false); - if (res != RES_OK && res != RES_NOT_CONNECTED) { - FAIL_RETURN_VOID(res, "setBluetoothState(false) failed"); - } - } else { - auto res = m_sm->setBluetoothState(true); - if (res == RES_NOT_CONNECTED) { - FAIL_RETURN_VOID(launchBluetoothSettings(), - "launchBluetoothSettings() failed"); - } else { - FAIL_RETURN_VOID(res, "setBluetoothState(true) failed"); - } - } - } - - Result AccessoryPresenter::launchBluetoothSettings() - { - AutoAppCtrl appCtrl; - - FAIL_RETURN(util::getNz(app_control_create, appCtrl), - "app_control_create() failed!"); - - FAIL_RETURN(util::call(app_control_set_app_id, - appCtrl, "org.tizen.bluetooth"), - "app_control_set_app_id() failed!"); - - FAIL_RETURN(util::call(app_control_add_extra_data, - appCtrl, "launch-type", "call"), - "app_control_add_extra_data() failed!"); - - FAIL_RETURN(util::call(app_control_send_launch_request, - appCtrl, nullptr, nullptr), - "app_control_send_launch_request() failed!"); - - return RES_OK; - } - - Result AccessoryPresenter::launchContacts() - { - AutoAppCtrl appCtrl; - - FAIL_RETURN(util::getNz(app_control_create, appCtrl), - "app_control_create() failed!"); - - FAIL_RETURN(util::call(app_control_set_operation, - appCtrl, APP_CONTROL_OPERATION_ADD), - "app_control_set_app_id() failed!"); - - FAIL_RETURN(util::call(app_control_set_mime, - appCtrl, CU_APP_CONTROL_MIME_CONTACT), - "app_control_set_app_id() failed!"); - - FAIL_RETURN(util::call(app_control_add_extra_data, - appCtrl, APP_CONTROL_DATA_PHONE, m_unsavedPhoneNumber.c_str()), - "app_control_add_extra_data() failed!"); - - FAIL_RETURN(util::call(app_control_send_launch_request, - appCtrl, nullptr, nullptr), - "app_control_send_launch_request() failed!"); - - return RES_OK; - } - - void AccessoryPresenter::onAddContactBtnClicked(Widget &widget, void *eventInfo) - { - launchContacts(); - - if (m_exitHandler) { - m_exitHandler(); - } - } - - void AccessoryPresenter::registerCallbacks() - { - addRotaryEventHandler(CALLBACK_A( - AccessoryPresenter::onRotaryEvent), this); - - m_sm->addAudioStateHandler(DELEGATE( - AccessoryPresenter::onAudioStateChanged, this)); - - m_sm->addVolumeStateHandler(DELEGATE( - AccessoryPresenter::onVolumeLevelChanged, this)); - - m_sm->addMuteStateHandler(DELEGATE( - AccessoryPresenter::onMuteStateChanged, this)); - } - - void AccessoryPresenter::unregisterCallbacks() - { - delRotaryEventHandler( - CALLBACK_A(AccessoryPresenter::onRotaryEvent), this); - - m_sm->delAudioStateHandler(DELEGATE( - AccessoryPresenter::onAudioStateChanged, this)); - - m_sm->delVolumeStateHandler(DELEGATE( - AccessoryPresenter::onVolumeLevelChanged, this)); - - m_sm->delMuteStateHandler(DELEGATE( - AccessoryPresenter::onMuteStateChanged, this)); - } - - Eina_Bool AccessoryPresenter::onVCTimerCb() - { - hide(*m_vc); - m_vcTimer = nullptr; - - return ECORE_CALLBACK_CANCEL; - } - - void AccessoryPresenter::startVCTimer() - { - stopVCTimer(); - - m_vcTimer = ecore_timer_add(CALL_VC_TIMER_INTERVAL, - CALLBACK_B(AccessoryPresenter::onVCTimerCb), - this); - } - - void AccessoryPresenter::restartVCTimer() - { - if (m_vcTimer) { - ecore_timer_reset(m_vcTimer); - } - } - - void AccessoryPresenter::stopVCTimer() - { - if (m_vcTimer) { - ecore_timer_del(m_vcTimer); - m_vcTimer = nullptr; - } - } - - Eina_Bool AccessoryPresenter::onRotaryEvent(Eext_Rotary_Event_Info *info) - { - if (!isActive()) { - LOG_RETURN_VALUE(RES_OK, EINA_TRUE, "Presenter is not active. Ignore"); - } - - if (m_vcTimer) { - restartVCTimer(); - } else { - show(*m_vc); - startVCTimer(); - } - - if (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE) { - tryIncreaseVolume(); - } else { - tryDecreaseVolume(); - } - - return EINA_TRUE; - } - - void AccessoryPresenter::onVolumeControlEventCb(VolumeControlEvent event) - { - if (!isActive()) { - LOG_RETURN_VOID(RES_OK, "Presenter is not active. Ignore"); - } - - if (!m_vcTimer) { - DLOG("Ignore as control is hidden"); - return; - } - - restartVCTimer(); - - switch (event) { - case VolumeControlEvent::INCREASE: - tryIncreaseVolume(); - break; - case VolumeControlEvent::DECREASE: - tryDecreaseVolume(); - break; - default: - break; - } - } - - void AccessoryPresenter::tryIncreaseVolume() - { - auto max = m_sm->getMaxVolume(); - auto cur = m_sm->getVolume(); - - if (max != cur) { - m_sm->setVolume(cur + 1); - } - } - - void AccessoryPresenter::tryDecreaseVolume() - { - auto cur = m_sm->getVolume(); - - if (cur - 1 >= VOLUME_LEVEL_MIN) { - m_sm->setVolume(cur - 1); - } - } - - void AccessoryPresenter::onAudioStateChanged(AudioStateType state) - { - if ((m_audioState != AudioStateType::BT && - state == AudioStateType::BT) || - (m_audioState == AudioStateType::BT && - state != AudioStateType::BT)) { - m_audioState = state; - - m_vc->setValue(0); - m_slider->setValue(0); - - auto maxVol = m_sm->getMaxVolume(); - m_vc->setMaxValue(maxVol); - m_slider->setMaxValue(maxVol); - - updateVolume(m_sm->getVolume()); - - if (m_bluetoothBtn) { - (m_audioState == AudioStateType::BT) ? - m_bluetoothBtn->emit(impl::SIGNAL_TURN_ON) : - m_bluetoothBtn->emit(impl::SIGNAL_TURN_OFF); - } - } - } - - void AccessoryPresenter::updateVolume(int value) - { - m_vc->setValue(value); - m_slider->setValue(value); - - auto max = m_sm->getMaxVolume(); - auto cur = m_sm->getVolume(); - - if (cur == max) { - m_vc->setIncreaseBtnEnable(false); - m_vc->setDecreaseBtnEnable(true); - } else if (cur <= VOLUME_LEVEL_MIN) { - m_vc->setIncreaseBtnEnable(true); - m_vc->setDecreaseBtnEnable(false); - } else { - m_vc->setIncreaseBtnEnable(true); - m_vc->setDecreaseBtnEnable(true); - } - } - - void AccessoryPresenter::onVolumeLevelChanged(int value) - { - updateVolume(value); - } - - void AccessoryPresenter::onMuteStateChanged(bool isMuted) - { - if (!m_muteBtn) { - return; - } - if (!elm_object_disabled_get(*m_muteBtn)) - updateMuteBtn(isMuted); - } - - void AccessoryPresenter::updateMuteBtn(bool isMuted) - { - if (!m_muteBtn) { - return; - } - isMuted ? m_muteBtn->emit(impl::SIGNAL_TURN_ON) : - m_muteBtn->emit(impl::SIGNAL_TURN_OFF); - } -} - diff --git a/src/presenters/KeypadPage.cpp b/src/presenters/KeypadPage.cpp deleted file mode 100644 index d2f512f..0000000 --- a/src/presenters/KeypadPage.cpp +++ /dev/null @@ -1,506 +0,0 @@ -/* - * 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 "presenters/KeypadPage.h" -#include "view/VolumeControl.h" - -#include "resources.h" -#include "common.h" - -namespace callui { namespace { namespace impl { - - using namespace ucl; - - constexpr LayoutTheme LAYOUT_KEYPAD_WIDGET - {"layout", "callui", "keypad"}; - - constexpr EdjePart PART_SWL_ENTRY {"swl.entry"}; - - constexpr SmartEvent BTN_PRESSED {"pressed"}; - constexpr SmartEvent BTN_UNPRESSED {"unpressed"}; - - constexpr EoDataKey BTN_DATA_KEY {"btnData"}; - - enum { - KEYPAD_BTN_MAX_COUNT = 13 - }; - - enum class OperationType { - DTMF, - VOLUME - }; - - struct ButtonInfo { - OperationType type; - const char *str; - ElmStyle style; - EdjePart swlPart; - }; - - static ButtonInfo buttonsInfo[KEYPAD_BTN_MAX_COUNT] = - { - { OperationType::DTMF, "1", - ElmStyle {"callui/keypad_one"}, EdjePart {"swl.one"} }, - { OperationType::DTMF, "2", - ElmStyle {"callui/keypad_two"}, EdjePart {"swl.two"} }, - { OperationType::DTMF, "3", - ElmStyle {"callui/keypad_three"}, EdjePart {"swl.three"} }, - { OperationType::DTMF, "4", - ElmStyle {"callui/keypad_four"}, EdjePart {"swl.four"} }, - { OperationType::DTMF, "5", - ElmStyle {"callui/keypad_five"}, EdjePart {"swl.five"} }, - { OperationType::DTMF, "6", - ElmStyle {"callui/keypad_six"}, EdjePart {"swl.six"} }, - { OperationType::DTMF, "7", - ElmStyle {"callui/keypad_seven"}, EdjePart {"swl.seven"} }, - { OperationType::DTMF, "8", - ElmStyle {"callui/keypad_eight"}, EdjePart {"swl.eight"} }, - { OperationType::DTMF, "9", - ElmStyle {"callui/keypad_nine"}, EdjePart {"swl.nine"} }, - { OperationType::DTMF, "0", - ElmStyle {"callui/keypad_zero"}, EdjePart {"swl.zero"} }, - { OperationType::DTMF, "#", - ElmStyle {"callui/keypad_sharp"}, EdjePart {"swl.sharp"} }, - { OperationType::DTMF, "*", - ElmStyle {"callui/keypad_asterix"}, EdjePart {"swl.asterix"} }, - { OperationType::VOLUME, "", - ElmStyle {"callui/keypad_speaker"}, EdjePart {"swl.speaker"} } - }; -}}} - -namespace callui { - using namespace ucl; - - // KeypadPage::Builder - - KeypadPage::Builder::Builder() - { - } - - KeypadPage::Builder::~Builder() - { - } - - KeypadPage::Builder &KeypadPage::Builder::setNaviframe( - const NaviframeSRef &navi) - { - m_navi = navi; - return *this; - } - - KeypadPage::Builder - &KeypadPage::Builder::setSoundManager(const ISoundManagerSRef &sm) - { - m_sm = sm; - return *this; - } - - KeypadPageSRef KeypadPage::Builder::build( - const ExitRequestHandler onExitRequest) const - { - if (!onExitRequest) { - LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, - "onExitRequest is NULL"); - } - if (!m_navi) { - LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, - "m_navi is NULL"); - } - - if (!m_sm) { - LOG_RETURN_VALUE(RES_FAIL, {}, "m_sm is NULL"); - } - - auto result = makeShared<KeypadPage>(m_sm, m_navi, onExitRequest); - - FAIL_RETURN_VALUE(result->prepare([&result](NaviItem &item) - { - return result->doPrepare(item); - }), - {}, "result->prepare() failed!"); - - return result; - } - - // KeypadPage - - KeypadPage::KeypadPage(IRefCountObj &rc, - const ISoundManagerSRef &sm, - const NaviframeSRef &navi, - const ExitRequestHandler onExitRequest): - Page(rc, navi, onExitRequest), - m_sm(sm), - m_smInUse(false), - m_vcTimer(nullptr), - m_audioState(m_sm->getAudioState()) - { - } - - KeypadPage::~KeypadPage() - { - stopDtmf(); - stopVCTimer(); - unregisterCallbacks(); - } - - void KeypadPage::onBtnPressed(Widget &widget, void *eventInfo) - { - impl::ButtonInfo *btn = - static_cast<impl::ButtonInfo*>(widget.getData(impl::BTN_DATA_KEY)); - ILOG("button pressed: %c", *(btn->str)); - - if (btn->type == impl::OperationType::DTMF) { - elm_entry_entry_append(*m_entry, btn->str); - elm_entry_cursor_end_set(*m_entry); - startDtmf(*(btn->str)); - } - } - - void KeypadPage::onBtnUnpressed(Widget &widget, void *eventInfo) - { - impl::ButtonInfo *btn = - static_cast<impl::ButtonInfo*>(widget.getData(impl::BTN_DATA_KEY)); - ILOG("button unpressed: %c", *(btn->str)); - stopDtmf(); - } - - void KeypadPage::onBtnClicked(Widget &widget, void *eventInfo) - { - impl::ButtonInfo *btn = - static_cast<impl::ButtonInfo*>(widget.getData(impl::BTN_DATA_KEY)); - - if(btn->type == impl::OperationType::VOLUME) { - ILOG("button clicked: volume"); - show(*m_vc); - startVCTimer(); - } - } - - Result KeypadPage::doPrepare(NaviItem &item) - { - FAIL_RETURN(createWidget(), "createWidget() failed!"); - - FAIL_RETURN(createEntry(), "createEntry() failed!"); - - FAIL_RETURN(createButtons(), "createButtons() failed!"); - - FAIL_RETURN(createVolumeControl(), "createVolumeControl() failed!"); - - registerCallbacks(); - - updateVolume(m_sm->getVolume()); - - item = getNaviframe().push(*m_widget); - if (!item) { - LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); - } - - return RES_OK; - } - - Result KeypadPage::createWidget() - { - m_widget = Layout::Builder(). - setTheme(impl::LAYOUT_KEYPAD_WIDGET). - setIsOwner(true). - build(getNaviframe()); - - if (!m_widget) { - LOG_RETURN(RES_FAIL, "Layout::build() failed!"); - } - - return RES_OK; - } - - ucl::Result KeypadPage::createEntry() - { - Evas_Object *entry = elm_entry_add(*m_widget); - if (!entry) { - LOG_RETURN(RES_FAIL, "elm_entry_add() failed!"); - } - m_entry = makeShared<ElmWidget>(entry, true); - - static Elm_Entry_Filter_Accept_Set digitsFilterData; - - digitsFilterData.accepted = "0123456789*#"; - digitsFilterData.rejected = nullptr; - - elm_entry_single_line_set(entry, EINA_TRUE); - elm_entry_editable_set(entry, EINA_FALSE); - elm_entry_scrollable_set(entry, EINA_TRUE); - elm_entry_markup_filter_append(entry, - elm_entry_filter_accept_set, &digitsFilterData); - - m_widget->setContent(entry, impl::PART_SWL_ENTRY); - show(*m_entry); - - return RES_OK; - } - - ucl::Result KeypadPage::createButtons() - { - Evas_Object *button; - StyledWidgetSRef buttonSRef; - - for (int i = 0; i < impl::KEYPAD_BTN_MAX_COUNT; ++i) { - button = elm_button_add(*m_widget); - - if (!button) { - LOG_RETURN(RES_FAIL, "elm_button_add() failed!"); - } - - buttonSRef = makeShared<StyledWidget>(button); - buttonSRef->setData(impl::BTN_DATA_KEY, &(impl::buttonsInfo[i])); - buttonSRef->setStyle(impl::buttonsInfo[i].style); - - if (impl::buttonsInfo[i].type == impl::OperationType::DTMF) { - buttonSRef->addEventHandler(impl::BTN_PRESSED, - WEAK_DELEGATE(KeypadPage::onBtnPressed, - asWeak(*this))); - - buttonSRef->addEventHandler(impl::BTN_UNPRESSED, - WEAK_DELEGATE(KeypadPage::onBtnUnpressed, - asWeak(*this))); - } else { - buttonSRef->addEventHandler(BTN_CLICKED, - WEAK_DELEGATE(KeypadPage::onBtnClicked, - asWeak(*this))); - } - - m_widget->setContent(button, impl::buttonsInfo[i].swlPart); - show(*buttonSRef); - } - - return RES_OK; - } - - void KeypadPage::startDtmf(const unsigned char digit) - { - stopDtmf(); - m_smInUse = true; - m_sm->startDtmf(digit); - } - - void KeypadPage::stopDtmf() - { - if (m_smInUse) { - m_sm->stopDtmf(); - m_smInUse = false; - } - } - - Result KeypadPage::createVolumeControl() - { - m_vc = VolumeControl::Builder(). - setInfoText(STR_VOLUME). - setMaxValue(m_sm->getMaxVolume()). - setEventHandler(WEAK_DELEGATE( - KeypadPage::onVolumeControlEventCb, - asWeak(*this))). - build(*m_widget); - if (!m_vc) { - LOG_RETURN(RES_FAIL, "VolumeControl::build() failed"); - } - - auto window = m_vc->getWindow(); - if (!window) { - LOG_RETURN(RES_FAIL, "Window is NULL!"); - } - int w = 0, h = 0; - window->getScreenSize(&w, &h); - - m_vc->move(0, 0); - m_vc->resize(w, h); - hide(*m_vc); - - return RES_OK; - } - - void KeypadPage::onBackKey() - { - if (m_vcTimer) { - stopVCTimer(); - hide(*m_vc); - } else { - requestExit(); - } - } - - void KeypadPage::onVolumeControlEventCb(VolumeControlEvent event) - { - if (!isActive()) { - LOG_RETURN_VOID(RES_OK, "Presenter is not active. Ignore"); - } - - if (!m_vcTimer) { - DLOG("Ignore as control is hidden"); - return; - } - - restartVCTimer(); - - switch (event) { - case VolumeControlEvent::INCREASE: - tryIncreaseVolume(); - break; - case VolumeControlEvent::DECREASE: - tryDecreaseVolume(); - break; - default: - break; - } - } - - void KeypadPage::updateVolume(int value) - { - m_vc->setValue(value); - - auto max = m_sm->getMaxVolume(); - auto cur = m_sm->getVolume(); - - if (cur == max) { - m_vc->setIncreaseBtnEnable(false); - m_vc->setDecreaseBtnEnable(true); - } else if (cur <= VOLUME_LEVEL_MIN) { - m_vc->setIncreaseBtnEnable(true); - m_vc->setDecreaseBtnEnable(false); - } else { - m_vc->setIncreaseBtnEnable(true); - m_vc->setDecreaseBtnEnable(true); - } - } - - void KeypadPage::onAudioStateChanged(AudioStateType state) - { - if ((m_audioState != AudioStateType::BT && - state == AudioStateType::BT) || - (m_audioState == AudioStateType::BT && - state != AudioStateType::BT)) { - m_audioState = state; - - m_vc->setValue(0); - - auto maxVol = m_sm->getMaxVolume(); - m_vc->setMaxValue(maxVol); - - updateVolume(m_sm->getVolume()); - } - } - - void KeypadPage::onVolumeLevelChanged(int value) - { - updateVolume(value); - } - - Eina_Bool KeypadPage::onVCTimerCb() - { - hide(*m_vc); - m_vcTimer = nullptr; - - return ECORE_CALLBACK_CANCEL; - } - - void KeypadPage::startVCTimer() - { - stopVCTimer(); - - m_vcTimer = ecore_timer_add(CALL_VC_TIMER_INTERVAL, - CALLBACK_B(KeypadPage::onVCTimerCb), - this); - } - - void KeypadPage::restartVCTimer() - { - if (m_vcTimer) { - ecore_timer_reset(m_vcTimer); - } - } - - void KeypadPage::stopVCTimer() - { - if (m_vcTimer) { - ecore_timer_del(m_vcTimer); - m_vcTimer = nullptr; - } - } - - void KeypadPage::tryIncreaseVolume() - { - auto max = m_sm->getMaxVolume(); - auto cur = m_sm->getVolume(); - - if (max != cur) { - m_sm->setVolume(cur + 1); - } - } - - void KeypadPage::tryDecreaseVolume() - { - auto cur = m_sm->getVolume(); - - if (cur - 1 >= VOLUME_LEVEL_MIN) { - m_sm->setVolume(cur - 1); - } - } - - Eina_Bool KeypadPage::onRotaryEvent(Eext_Rotary_Event_Info *info) - { - if (!isActive()) { - LOG_RETURN_VALUE(RES_OK, - EINA_TRUE, - "Presenter is not active. Ignore"); - } - - if (!m_vcTimer) { - DLOG("Ignore as control is hidden"); - return EINA_FALSE; - } - - restartVCTimer(); - - if (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE) { - tryIncreaseVolume(); - } else { - tryDecreaseVolume(); - } - - return EINA_TRUE; - } - - void KeypadPage::registerCallbacks() - { - addRotaryEventHandler(CALLBACK_A( - KeypadPage::onRotaryEvent), this); - - m_sm->addAudioStateHandler(DELEGATE( - KeypadPage::onAudioStateChanged, this)); - - m_sm->addVolumeStateHandler(DELEGATE( - KeypadPage::onVolumeLevelChanged, this)); - } - - void KeypadPage::unregisterCallbacks() - { - delRotaryEventHandler( - CALLBACK_A(KeypadPage::onRotaryEvent), this); - - m_sm->delAudioStateHandler(DELEGATE( - KeypadPage::onAudioStateChanged, this)); - - m_sm->delVolumeStateHandler(DELEGATE( - KeypadPage::onVolumeLevelChanged, this)); - } -} diff --git a/src/presenters/MainPage.cpp b/src/presenters/MainPage.cpp deleted file mode 100644 index 1a491b4..0000000 --- a/src/presenters/MainPage.cpp +++ /dev/null @@ -1,672 +0,0 @@ -/* - * 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 "presenters/MainPage.h" - -#include "ucl/gui/Window.h" -#include "ucl/gui/Widget.h" - -#include "model/ICallUI.h" -#include "model/ICallManager.h" -#include "model/IIncomingCall.h" -#include "model/IActiveCall.h" -#include "model/IHeldCall.h" -#include "model/IEndCall.h" -#include "model/IIndicatorStateProvider.h" -#include "model/ICallInfo.h" -#include "model/IRejectMsgProvider.h" - -#include "presenters/IndicatorPresenter.h" -#include "presenters/AcceptRejectPresenter.h" -#include "presenters/CallInfoPresenter.h" -#include "presenters/RejectMsgPresenter.h" -#include "presenters/AccessoryPresenter.h" -#include "presenters/MoreOptionsPresenter.h" -#include "presenters/DeviceStatePresenter.h" - -#include "resources.h" -#include "common.h" - -namespace callui { namespace { namespace impl { - - using namespace ucl; - - constexpr double CU_RECALL_BTN_SHOW_TIMEOUT = 1.0; - constexpr double CU_EXIT_APP_TIMEOUT = 4.0; - - constexpr LayoutTheme LAYOUT_MAIN_WIDGET - {"layout", "callui", "main"}; - - constexpr LayoutTheme LAYOUT_REJECT_MSG_WIDGET - {"layout", "callui", "reject_msg"}; - - constexpr EdjePart PART_SWL_INDICATOR {"swl.indicator"}; - constexpr EdjePart PART_SWL_ACCEPT_REJECT {"swl.accept_reject"}; - constexpr EdjePart PART_SWL_CALL_INFO {"swl.call_info"}; - constexpr EdjePart PART_SWL_REJECT_MSG {"swl.rm"}; - constexpr EdjePart PART_SWL_BOTTOM_BTN {"swl.bottom_btn"}; - constexpr EdjePart PART_SWL_OVERLAY {"swl.overlay"}; - constexpr EdjePart PART_SWL_MORE_OPTION {"swl.more_option"}; - - constexpr EdjePart PART_TXT_REJECT_MSG {"reject_msg_text"}; - - constexpr ElmStyle STYLE_BB_END_CALL {"callui/end_call"}; - constexpr ElmStyle STYLE_BB_RECALL {"callui/call_back"}; -}}} - -namespace callui { - - using namespace ucl; - - // MainPage::Builder - - MainPage::Builder::Builder() - { - } - - MainPage::Builder::~Builder() - { - } - - MainPage::Builder &MainPage::Builder::setNaviframe( - const NaviframeSRef &navi) - { - m_navi = navi; - return *this; - } - - MainPage::Builder &MainPage::Builder::setCallUI( - const ICallUISRef &call) - { - m_call = call; - return *this; - } - - MainPageSRef MainPage::Builder::build( - const ExitRequestHandler handler) const - { - if (!handler) { - LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, - "onExitRequest is NULL"); - } - if (!m_navi) { - LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, - "m_navi is NULL"); - } - if (!m_call) { - LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, - "m_call is NULL"); - } - - auto result = makeShared<MainPage>( - m_navi, handler, m_call); - - FAIL_RETURN_VALUE(result->prepare([&result](NaviItem &item) - { - return result->doPrepare(item); - }), - {}, "result->prepare() failed!"); - - return result; - } - - // MainPage - - MainPage::MainPage(IRefCountObj &rc, - const NaviframeSRef &navi, - const ExitRequestHandler handler, - const ICallUISRef &call) : - Page(rc, navi, handler), - m_call(call), - m_mode(CallMode::UNDEFINED), - m_ecTimer(nullptr), - m_ecTimerBtnReq(false) - { - } - - MainPage::~MainPage() - { - } - - Result MainPage::doPrepare(NaviItem &item) - { - m_cm = m_call->getCallManager(); - if (!m_cm) { - LOG_RETURN(RES_FAIL, "Call manager is NULL!"); - } - - FAIL_RETURN(createWidget(), "createWidget() failed!"); - FAIL_RETURN(createIndicatorPresenter(), "createIndicatorPresenter() failed!"); - FAIL_RETURN(createDisplayPresenter(), "createDisplayPresenter() failed!"); - - auto win = m_widget->getWindow(); - if (!win) { - LOG_RETURN(RES_FAIL, "win is NULL!"); - } - win->addEventHandler(WIN_POWER_KEY_UP_EVENT, WEAK_DELEGATE( - MainPage::onPowerKeyUp, asWeak(*this))); - - item = getNaviframe().push(*m_widget); - if (!item) { - LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); - } - - return RES_OK; - } - - void MainPage::processKeyPress() - { - switch (m_mode) { - case CallMode::INCOMING: - { - auto incom = m_cm->getIncomingCall(); - if (!incom) { - LOG_RETURN_VOID(RES_FAIL, "incom is NULL"); - } - incom->stopAlert(); - break; - } - case CallMode::END: - requestExit(); - break; - default: - if (m_accessoryPrs) { - m_accessoryPrs->hideVolumeControls(); - } - break; - } - } - - void MainPage::onBackKey() - { - processKeyPress(); - } - - void MainPage::onPowerKeyUp(Widget &widget, void *eventInfo) - { - if (isActive()) { - processKeyPress(); - } - } - - Result MainPage::processIncomingCallMode() - { - m_bottomBtn.reset(); - m_moreOptionsPrs.reset(); - m_accessoryPrs.reset(); - - auto call = m_cm->getIncomingCall(); - if (!call) { - LOG_RETURN(RES_FAIL, "incom is NULL"); - } - - FAIL_RETURN(createAcceptRejectPresenter(), - "createAcceptRejectPresenter() failed!"); - - auto provider = call->getRejectMsgProvider(); - if (!provider) { - ELOG("Reject message provider is NULL"); - } - - if (!isUnknownCaller(*call->getInfo()) - && (provider && provider->getMsgCount() > 0)) { - m_rmLy = Layout::Builder(). - setTheme(impl::LAYOUT_REJECT_MSG_WIDGET). - setIsOwner(true). - build(*m_widget); - if (!m_rmLy) { - LOG_RETURN(RES_FAIL, "Layout::build() failed!"); - } - m_rmLy->setText(STR_DECLINE_MESSAGES, impl::PART_TXT_REJECT_MSG); - - m_widget->setContent(*m_rmLy, impl::PART_SWL_REJECT_MSG); - - FAIL_RETURN(createRejectMsgPresenter(provider), - "createRejectMsgPresenter() failed!"); - } - - if (m_indicator) { - m_indicator->udapteIncomingCallMode(true); - } - - return RES_OK; - } - - Result MainPage::processEndCallMode() - { - m_bottomBtn.reset(); - m_moreOptionsPrs.reset(); - - m_rmPrs.reset(); - m_acceptRejectPrs.reset(); - m_rmLy.reset(); - - if (m_indicator) { - m_indicator->udapteIncomingCallMode(false); - } - - FAIL_RETURN(createAccessoryPresenter(), - "createAccessoryPresenter() failed"); - - startEndCallTimer(); - - return RES_OK; - } - - Result MainPage::processRegularCallModes() - { - m_rmPrs.reset(); - m_acceptRejectPrs.reset(); - m_rmLy.reset(); - - if (m_indicator) { - m_indicator->udapteIncomingCallMode(false); - } - - FAIL_RETURN(createAccessoryPresenter(), - "createAccessoryPresenter() failed"); - FAIL_RETURN(createMoreOptionsPresenter(), - "createMoreOptionsPresenter() failed"); - FAIL_RETURN(createBottomBtn(impl::STYLE_BB_END_CALL), - "createBottomBtn() failed"); - - return RES_OK; - } - - void MainPage::updateCallMode() - { - auto incom = m_cm->getIncomingCall(); - auto active = m_cm->getActiveCall(); - auto held = m_cm->getHeldCall(); - auto end = m_cm->getEndCall(); - - m_mode = CallMode::UNDEFINED; - - if (incom) { - DLOG("Mode [Incoming call]"); - m_mode = CallMode::INCOMING; - } else if (active && active->isDialingMode()) { - DLOG("Mode [Outgoing call]"); - m_mode = CallMode::OUTGOING; - } else if (active || held) { - DLOG("Mode [During call]"); - m_mode = CallMode::DURING; - } else if (end) { - DLOG("Mode [End call]"); - m_mode = CallMode::END; - } else { - DLOG("Mode [Undefined]"); - } - } - - Result MainPage::showWindow() - { - auto win = getNaviframe().getWindow(); - if (!win) { - LOG_RETURN(RES_FAIL, "win is NULL"); - } - - if (!win->isVisible() && - (m_mode == CallMode::INCOMING - || m_mode == CallMode::OUTGOING)) { - show(*win); - } - return RES_OK; - } - - void MainPage::onBottomBtnClicked(Widget &widget, void *eventInfo) - { - auto active = m_cm->getActiveCall(); - auto held = m_cm->getHeldCall(); - auto end = m_cm->getEndCall(); - - if (active) { - active->end(); - } else if (held) { - held->end(); - } else if (end) { - stopEndCallTimer(); - end->callBack(); - } - } - - void MainPage::startEndCallTimer() - { - stopEndCallTimer(); - - m_ecTimer = ecore_timer_add( - impl::CU_RECALL_BTN_SHOW_TIMEOUT, - CALLBACK_B(MainPage::onEndCallTimerCb), - this); - } - - void MainPage::stopEndCallTimer() - { - m_ecTimerBtnReq = false; - - if (m_ecTimer) { - ecore_timer_del(m_ecTimer); - m_ecTimer = nullptr; - } - } - - Result MainPage::createBottomBtn(const ElmStyle &style) - { - m_bottomBtn = makeShared<StyledWidget>( - elm_button_add(*m_widget), true); - m_bottomBtn->setStyle(style); - - m_bottomBtn->addEventHandler(BTN_CLICKED, - WEAK_DELEGATE(MainPage::onBottomBtnClicked, - asWeak(*this))); - - m_widget->setContent(*m_bottomBtn, impl::PART_SWL_BOTTOM_BTN); - show(*m_bottomBtn); - - return RES_OK; - } - - Eina_Bool MainPage::onEndCallTimerCb() - { - auto end = m_cm->getEndCall(); - if (!end) { - m_ecTimer = nullptr; - requestExit(); - LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_CANCEL, "end is NULL"); - } - - auto info = end->getInfo(); - if (!m_bottomBtn && !m_ecTimerBtnReq) { - if (info && info->getConferenceMemberCount() == 1) { - if (createBottomBtn(impl::STYLE_BB_RECALL) != RES_OK) { - m_ecTimer = nullptr; - requestExit(); - LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_CANCEL, - "createBottomBtn() failed!"); - } - } - ecore_timer_interval_set(m_ecTimer, impl::CU_EXIT_APP_TIMEOUT); - m_ecTimerBtnReq = true; - return ECORE_CALLBACK_RENEW; - } else { - m_ecTimer = nullptr; - requestExit(); - return ECORE_CALLBACK_CANCEL; - } - } - - void MainPage::onCallEvent(CallEventType type) - { - ILOG("CallEventType [%d]", static_cast<int>(type)); - - stopEndCallTimer(); - - CallMode prevMode = m_mode; - updateCallMode(); - - if (m_mode == CallMode::UNDEFINED) { - requestExit(); - return; - } - - FAIL_RETURN_VOID(showWindow(), "showWindow failed!"); - - switch (m_mode) { - case CallMode::INCOMING: - FAIL_RETURN_VOID(processIncomingCallMode(), - "processIncomingCall() failed!"); - break; - case CallMode::END: - FAIL_RETURN_VOID(processEndCallMode(), - "processEndCallMode() failed!"); - break; - default: - FAIL_RETURN_VOID(processRegularCallModes(), - "processRegularCallModes() failed!"); - break; - } - - FAIL_RETURN_VOID(createCallInfoPresenter(m_mode), - "createCallInfoPresenter() failed!"); - - FAIL_RETURN_VOID(updateDeviceState(prevMode, m_mode), - "createCallInfoPresenter() failed!"); - } - - Result MainPage::updateDeviceState(CallMode prevMode, CallMode curMode) - { - if (curMode == CallMode::INCOMING && curMode != prevMode) { - m_devicePrs->setDisplayState(DisplayState::ON); - m_devicePrs->setDisplayMode(DisplayMode::TOP_PRIORITY); - m_devicePrs->setCpuLockState(true); - } else if (prevMode == CallMode::INCOMING && prevMode != curMode) { - m_devicePrs->setDisplayMode(DisplayMode::REGULAR); - m_devicePrs->setCpuLockState(false); - } - - if (curMode == CallMode::END) { - m_devicePrs->setDisplayState(DisplayState::ON); - } - - return RES_OK; - } - - bool MainPage::detectMuteControlDisableState() - { - return (m_mode == CallMode::OUTGOING || - (m_mode == CallMode::DURING && - (m_cm->getAvailableCalls() == CALL_FLAG_HELD))); - } - - Result MainPage::createWidget() - { - m_widget = Layout::Builder(). - setTheme(impl::LAYOUT_MAIN_WIDGET). - setIsOwner(true). - build(getNaviframe()); - - if (!m_widget) { - LOG_RETURN(RES_FAIL, "Layout::build() failed!"); - } - - setDeactivatorSink(m_widget); - - return RES_OK; - } - - Result MainPage::createIndicatorPresenter() - { - m_indicator = IndicatorPresenter::Builder(). - setIndicatorStateProvider( - m_call->getIndicatorStateProvider()). - setParentWidget(m_widget). - build(*this); - - if (!m_indicator) { - LOG_RETURN(RES_FAIL, "Indicator::build() failed!"); - } - - m_widget->setContent(m_indicator->getWidget(), impl::PART_SWL_INDICATOR); - - return RES_OK; - } - - Result MainPage::createDisplayPresenter() - { - auto win = m_widget->getWindow(); - if (!win) { - LOG_RETURN(RES_FAIL, "win is NULL!"); - } - - m_devicePrs = DeviceStatePresenter::Builder(). - setDisplayState(DisplayState::ON). - build(asShared(win)); - - if (!m_devicePrs) { - LOG_RETURN(RES_FAIL, "DisplayPresenter::build() failed!"); - } - - return RES_OK; - } - - void MainPage::onExitAppRequest() - { - requestExit(); - } - - Result MainPage::createAccessoryPresenter() - { - if (m_accessoryPrs) { - ILOG("Already exists. No need to create new one. Just update."); - m_accessoryPrs->update(m_cm); - return RES_OK; - } - - m_accessoryPrs = AccessoryPresenter::Builder(). - setSoundManager(m_call->getSoundManager()). - setCallManager(m_cm). - setRequestExitHandler(WEAK_DELEGATE(MainPage::onExitAppRequest, - asWeak(*this))). - setParentWidget(m_widget). - build(*this); - - if (!m_accessoryPrs) { - LOG_RETURN(RES_FAIL, - "AccessoryPresenter::build() failed!"); - } - - m_widget->setContent(m_accessoryPrs->getWidget(), - impl::PART_SWL_OVERLAY); - - return RES_OK; - } - - Result MainPage::createMoreOptionsPresenter() - { - if (m_moreOptionsPrs) { - ILOG("Already exists. No need to create new one. Just update."); - m_moreOptionsPrs->update(); - return RES_OK; - } - - m_moreOptionsPrs = MoreOptionsPresenter::Builder(). - setCallManager(m_cm). - setSoundManager(m_call->getSoundManager()). - setNaviframe(asShared(getNaviframe())). - setParentWidget(m_widget). - build(*this); - - if (!m_moreOptionsPrs) { - LOG_RETURN(RES_FAIL, - "MoreOptionsPresenter::build() failed!"); - } - - m_widget->setContent(m_moreOptionsPrs->getWidget(), - impl::PART_SWL_MORE_OPTION); - - return RES_OK; - } - - Result MainPage::createAcceptRejectPresenter() - { - if (m_acceptRejectPrs) { - m_acceptRejectPrs->update(m_cm->getAvailableCalls()); - return RES_OK; - } - - m_acceptRejectPrs = AcceptRejectPresenter::Builder(). - setIncomingCall(m_cm->getIncomingCall()). - setAvailableCallsFlag(m_cm->getAvailableCalls()). - setSoundManager(m_call->getSoundManager()). - setParentWidget(m_widget). - build(*this); - - if (!m_acceptRejectPrs) { - LOG_RETURN(RES_FAIL, - "AcceptRejectPresenter::build() failed!"); - } - - m_widget->setContent(m_acceptRejectPrs->getWidget(), - impl::PART_SWL_ACCEPT_REJECT); - - return RES_OK; - } - - void MainPage::RejectMsgStateCb(RejectMsgState state) - { - (state == RejectMsgState::HIDDEN) ? - show(*m_rmLy) : hide(*m_rmLy); - } - - void MainPage::RejectMsgSelectCb(const IRejectMsgSRef &rm) - { - auto incom = m_cm->getIncomingCall(); - if (incom) { - incom->rejectWithMessage(rm); - } - } - - Result MainPage::createRejectMsgPresenter( - const IRejectMsgProviderSRef &provider) - { - m_rmPrs = RejectMsgPresenter::Builder(). - setProvider(provider). - setStateHandler(WEAK_DELEGATE(MainPage::RejectMsgStateCb, - asWeak(*this))). - setSelectHandler(WEAK_DELEGATE(MainPage::RejectMsgSelectCb, - asWeak(*this))). - setParentWidget(m_widget). - build(*this); - - if (!m_rmPrs) { - LOG_RETURN(RES_FAIL, - "RejectMessagePresenter::build() failed!"); - } - - m_widget->setContent(m_rmPrs->getWidget(), impl::PART_SWL_OVERLAY); - - return RES_OK; - } - - Result MainPage::createCallInfoPresenter(CallMode mode) - { - if (m_callInfoPrs) { - return m_callInfoPrs->update(mode, m_cm); - } - - m_callInfoPrs = CallInfoPresenter::Builder(). - setCallManager(m_cm). - setMode(mode). - setParentWidget(m_widget). - build(*this); - - if (!m_callInfoPrs) { - LOG_RETURN(RES_FAIL, "CallerInfo::build() failed!"); - } - m_widget->setContent(m_callInfoPrs->getWidget(), - impl::PART_SWL_CALL_INFO); - - return RES_OK; - } - - void MainPage::onError(CallErr err) - { - if (!m_cm->getAvailableCalls()) { - requestExit(); - } - } - -} diff --git a/src/presenters/RejectMsgPresenter.cpp b/src/presenters/RejectMsgPresenter.cpp deleted file mode 100644 index 7774321..0000000 --- a/src/presenters/RejectMsgPresenter.cpp +++ /dev/null @@ -1,496 +0,0 @@ -/* - * 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 "presenters/RejectMsgPresenter.h" - -#include "model/IRejectMsgProvider.h" -#include "model/IRejectMsg.h" - -#include "resources.h" -#include "common.h" - -namespace callui { namespace { namespace impl { - - using namespace ucl; - - const int ALPHA_CHANNEL_MAX = 255; - - constexpr LayoutTheme LAYOUT_DRAWER_PANEL - {"layout", "drawer", "panel"}; - - constexpr LayoutTheme LAYOUT_RM_PANEL_CONTENT - {"layout", "callui", "rm_panel_content"}; - - constexpr EdjePart PART_SWL_RIGHT {"elm.swallow.right"}; - constexpr EdjePart PART_SWL_BG {"elm.swallow.bg"}; - - constexpr EdjePart PART_SWL_CONTENT {"swl.content"}; - constexpr EdjePart PART_SWL_SCROLLER {"swl.scroller"}; - - constexpr SmartEvent EVENT_SCROLL {"scroll"}; - -}}} - -namespace callui { - - using namespace ucl; - - class RejectMsgPresenter::RejectMsgItem : public NonCopyable { - public: - RejectMsgItem(const IRejectMsgSRef &rm): - m_rm(rm) - { - } - - virtual ~RejectMsgItem() - { - } - - std::string getDisplayText() const - { - auto trnsTxt = TString{m_rm->getText(), true}.translate(); - - auto markupTxt = elm_entry_utf8_to_markup(trnsTxt); - std::string resStr(markupTxt); - replaceSubstringInString(resStr, "<br/>", " "); - free(markupTxt); - - return resStr; - } - - IRejectMsgSRef getRejectMsg() const - { - return m_rm; - } - - private: - IRejectMsgSRef m_rm; - }; - - RejectMsgPresenter::Builder::Builder() - { - } - - RejectMsgPresenter::Builder::~Builder() - { - } - - RejectMsgPresenter::Builder & - RejectMsgPresenter::Builder::setProvider( - const IRejectMsgProviderSRef &provider) - { - m_provider = provider; - return *this; - } - - RejectMsgPresenter::Builder & - RejectMsgPresenter::Builder::setStateHandler( - const RejectMsgStateHandler &handler) - { - m_stateHandler = handler; - return *this; - } - - RejectMsgPresenter::Builder & - RejectMsgPresenter::Builder::setSelectHandler( - const RejectMsgSelectHandler &handler) - { - m_selectHandler = handler; - return *this; - } - - RejectMsgPresenter::Builder & - RejectMsgPresenter::Builder::setParentWidget( - const ElmWidgetSRef &parentWidget) - { - m_parentWidget = parentWidget; - return *this; - } - - RejectMsgPresenterSRef - RejectMsgPresenter::Builder::build(GuiPresenter &parent) const - { - if (!m_provider || !m_parentWidget) { - LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set"); - } - - auto result = makeShared<RejectMsgPresenter>(m_provider, - m_stateHandler, - m_selectHandler); - FAIL_RETURN_VALUE(result->prepare(parent, *m_parentWidget), {}, - "result->prepare() failed!"); - - return result; - } - - RejectMsgPresenter::RejectMsgPresenter(IRefCountObj &rc, - const IRejectMsgProviderSRef &provider, - const RejectMsgStateHandler &stateHandler, - const RejectMsgSelectHandler &selectHandler): - GuiPresenter(rc), - m_circleEo(nullptr), - m_provider(provider), - m_stateHandler(stateHandler), - m_selectHandler(selectHandler), - m_state(RejectMsgState::HIDDEN) - { - } - - RejectMsgPresenter::~RejectMsgPresenter() - { - if (m_widget) { - sendActivate(*m_widget); - } - } - - Result RejectMsgPresenter::prepare(GuiPresenter &parent, - ElmWidget &parentWidget) - { - FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR), - "Presenter::prepare() failed!"); - - FAIL_RETURN(createWidget(parentWidget), - "createWidget() failed!"); - - FAIL_RETURN(createPanel(), - "createPanel() failed!"); - - FAIL_RETURN(createPanelBg(), - "createPanelBg() failed!"); - - FAIL_RETURN(createPanelLy(), - "createPanelLy() failed!"); - - FAIL_RETURN(createGenlist(), - "createGenlist() failed!"); - - deactivateBy(m_widget.get()); - - parent.addDeactivatorSource(*m_widget); - - return RES_OK; - } - - Result RejectMsgPresenter::createWidget(ElmWidget &parent) - { - m_widget = Layout::Builder(). - setTheme(impl::LAYOUT_DRAWER_PANEL). - setIsOwner(true). - build(parent); - - if (!m_widget) { - LOG_RETURN(RES_FAIL, "Layout::build() failed!"); - } - - eext_object_event_callback_add(m_widget->getEo(), EEXT_CALLBACK_BACK, - CALLBACK_A(RejectMsgPresenter::onBackKey), this); - - return RES_OK; - } - - void RejectMsgPresenter::onBackKey(Evas_Object *obj, void *eventInfo) - { - if (isActive()) { - hidePanel(); - } - } - - void RejectMsgPresenter::panelScrollCb(Widget &widget, void *eventInfo) - { - Elm_Panel_Scroll_Info *ev = static_cast<Elm_Panel_Scroll_Info *>(eventInfo); - DLOG("pos x[%f] y[%f]", ev->rel_x, ev->rel_y); - - if (ev->rel_y == 1.0) { - m_state = RejectMsgState::SHOWN; - // Prevent panel scrolling - elm_object_scroll_freeze_push(m_panel->getEo()); - sendDeactivate(*m_widget); - activateBy(m_widget.get()); - } else if (ev->rel_y == 0.0) { - m_state = RejectMsgState::HIDDEN; - // Scroll genlist to top - elm_scroller_region_show(m_genlist->getEo(), 0, 0, 0, 0); - } else { - m_state = RejectMsgState::IN_TRANSITION; - const auto alphaValue = - static_cast<int>(impl::ALPHA_CHANNEL_MAX * ev->rel_y); - m_panelBg->setColor(0, alphaValue); - if (isActive()) { - deactivateBy(m_widget.get()); - sendActivate(*m_widget); - } - } - - if (m_stateHandler) { - m_stateHandler(m_state); - } - } - - Result RejectMsgPresenter::createPanel() - { - m_panel = makeShared<StyledWidget>(elm_panel_add(*m_widget), true); - if (!m_panel) { - LOG_RETURN(RES_FAIL, "elm_panel_add() failed!"); - } - elm_panel_scrollable_set(*m_panel, EINA_TRUE); - elm_panel_scrollable_content_size_set(*m_panel, 1.0); - elm_panel_hidden_set(*m_panel, EINA_TRUE); - elm_panel_orient_set(*m_panel, ELM_PANEL_ORIENT_BOTTOM); - show(*m_panel); - - m_panel->addEventHandler(impl::EVENT_SCROLL, - WEAK_DELEGATE(RejectMsgPresenter::panelScrollCb, - asWeak(*this))); - - m_widget->setContent(*m_panel, impl::PART_SWL_RIGHT); - - return RES_OK; - } - - Result RejectMsgPresenter::createPanelBg() - { - m_panelBg = makeShared<ElmWidget>( - evas_object_rectangle_add(evas_object_evas_get(*m_widget))); - if (!m_panelBg) { - LOG_RETURN(RES_FAIL, "evas_object_rectangle_add() failed!"); - } - m_panelBg->setColor(0, 0); - show(*m_panelBg); - - m_widget->setContent(m_panelBg->getEo(), impl::PART_SWL_BG); - - return RES_OK; - } - - Result RejectMsgPresenter::createPanelLy() - { - m_panelLy = Layout::Builder(). - setTheme(impl::LAYOUT_RM_PANEL_CONTENT). - setIsOwner(true). - build(*m_panel); - if (!m_panelLy) { - LOG_RETURN(RES_FAIL, "Layout::build failed!"); - } - m_panel->setContent(*m_panelLy); - - return RES_OK; - } - - Result RejectMsgPresenter::createGenlist() - { - // Genlist scroller Layout - auto circlLy = Layout::Builder().build(*m_panelLy); - if (!circlLy) { - LOG_RETURN(RES_FAIL, "Layout::build failed!"); - } - // Circular surface - Eext_Circle_Surface *const circleSurf = eext_circle_surface_layout_add(*circlLy); - if (!circleSurf) { - LOG_RETURN(RES_FAIL, "eext_circle_surface_layout_add() failed!"); - } - // Genlist - Evas_Object *const glEo = elm_genlist_add(*m_panelLy); - if (!glEo) { - LOG_RETURN(RES_FAIL, "elm_genlist_add() failed!"); - } - evas_object_size_hint_weight_set(glEo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(glEo, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_genlist_mode_set(glEo, ELM_LIST_COMPRESS); - elm_genlist_homogeneous_set(glEo, EINA_TRUE); - - m_genlist = makeShared<StyledWidget>(glEo); - m_circleEo = eext_circle_object_genlist_add(m_genlist->getEo(), circleSurf); - if (!m_circleEo) { - LOG_RETURN(RES_FAIL, "elm_genlist_add() failed!"); - } - eext_circle_object_genlist_scroller_policy_set(m_circleEo, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - deactivateRotary(); - - FAIL_RETURN(fillGenlist(), "fillGenlist() failed!"); - - m_panelLy->setContent(*circlLy, impl::PART_SWL_SCROLLER); - - m_panelLy->setContent(*m_genlist, impl::PART_SWL_CONTENT); - - return RES_OK; - } - - Result RejectMsgPresenter::fillGenlist() - { - FAIL_RETURN(addGenlistTitleItem(), "addGenlistTitleItem() failed!"); - - auto msgList = m_provider->getMsgList(); - for (auto &iter : msgList) { - FAIL_RETURN(addGenlistTextItem(iter), "addGenlistTextItem() failed!"); - } - - FAIL_RETURN(addGenlistBottomItem(), "addGenlistBottomItem() failed!"); - - return RES_OK; - } - - Result RejectMsgPresenter::addGenlistTitleItem() - { - static auto titleItc = createGenlistItemClass("title", - [](void *data, Evas_Object *obj, const char *part) -> char * { - return strdup(STR_DECLINE_MESSAGES.translate()); - }); - - auto *item = elm_genlist_item_append(*m_genlist, &titleItc, - nullptr, - nullptr, - ELM_GENLIST_ITEM_NONE, - nullptr, - nullptr); - if (!item) { - LOG_RETURN(RES_FAIL, "elm_genlist_item_append() failed!"); - } - - return RES_OK; - } - - Result RejectMsgPresenter::addGenlistTextItem(const IRejectMsgSRef &rm) - { - static auto textItc = createGenlistItemClass("1text.1icon", - [](void *data, Evas_Object *obj, const char *part) -> char * { - if (!data) { - LOG_RETURN_VALUE(RES_FAIL, nullptr, "Data is NULL"); - } - RejectMsgItem *rm = static_cast<RejectMsgItem *>(data); - return strdup(rm->getDisplayText().c_str()); - }, - nullptr, - nullptr, - [](void *data, Evas_Object *obj) -> void { - RejectMsgItem *rm = static_cast<RejectMsgItem *>(data); - delete rm; - }); - - auto *rmItem = new RejectMsgItem(rm); - if (!rmItem) { - LOG_RETURN(RES_FAIL, "Create RejectMsgItem failed!"); - } - - auto *item = elm_genlist_item_append(*m_genlist, &textItc, - static_cast<void *>(rmItem), - nullptr, - ELM_GENLIST_ITEM_NONE, - CALLBACK_A(RejectMsgPresenter::onGenlistItemClickedCb), - this); - if (!item) { - delete rmItem; - LOG_RETURN(RES_FAIL, "elm_genlist_item_append() failed!"); - } - - return RES_OK; - } - - Result RejectMsgPresenter::addGenlistBottomItem() - { - static auto paddingItc = createGenlistItemClass("1text.1icon"); - - auto *item = elm_genlist_item_append(*m_genlist, &paddingItc, - nullptr, - nullptr, - ELM_GENLIST_ITEM_NONE, - nullptr, - nullptr); - if (!item) { - LOG_RETURN(RES_FAIL, "elm_genlist_item_append() failed!"); - } - - return RES_OK; - } - - void RejectMsgPresenter::handleSelectEvent(const RejectMsgItem &item) - { - if (m_selectHandler) { - m_selectHandler(item.getRejectMsg()); - } - } - - void RejectMsgPresenter::onGenlistItemClickedCb(Evas_Object *obj, void *eventInfo) - { - if (!eventInfo) { - LOG_RETURN_VOID(RES_FAIL, "eventInfo is NULL"); - } - - auto *item = static_cast<Elm_Object_Item *>(eventInfo); - auto *rmItem = static_cast<RejectMsgItem *>( - elm_object_item_data_get(item)); - - handleSelectEvent(*rmItem); - } - - Widget &RejectMsgPresenter::getWidget() - { - return *m_widget; - } - - RejectMsgState RejectMsgPresenter::getState() - { - return m_state; - } - - void RejectMsgPresenter::hidePanel() - { - DLOG(); - if (m_state == RejectMsgState::SHOWN) { - DLOG("Panel state [SHOWN]"); - elm_object_scroll_freeze_pop(m_panel->getEo()); - elm_panel_hidden_set(m_panel->getEo(), EINA_TRUE); - } - } - - void RejectMsgPresenter::setStateHandler( - const RejectMsgStateHandler &handler) - { - m_stateHandler = handler; - } - - void RejectMsgPresenter::setSelectHandler( - const RejectMsgSelectHandler &handler) - { - m_selectHandler = handler; - } - - void RejectMsgPresenter::onActivate() - { - DLOG(); - activateRotary(); - } - - void RejectMsgPresenter::onDeactivate() - { - DLOG(); - deactivateRotary(); - } - - void RejectMsgPresenter::activateRotary() - { - if (m_circleEo) { - eext_rotary_object_event_activated_set(m_circleEo, EINA_TRUE); - } - } - - void RejectMsgPresenter::deactivateRotary() - { - if (m_circleEo) { - eext_rotary_object_event_activated_set(m_circleEo, EINA_FALSE); - } - } - -} diff --git a/src/presenters/common.h b/src/presenters/common.h deleted file mode 100644 index d07af88..0000000 --- a/src/presenters/common.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_COMMON_H__ -#define __CALLUI_PRESENTERS_COMMON_H__ - -#include "ucl/gui/stdTheme.h" - -#include "view/helpers.h" - -#include "helpers.h" - -#include "../common.h" - -#include "../view/common.h" - -namespace callui { - constexpr auto CALL_VC_TIMER_INTERVAL = 1.5; - constexpr auto VOLUME_LEVEL_MIN = 1; -} - -#endif // __CALLUI_PRESENTERS_COMMON_H__ diff --git a/src/presenters/helpers.cpp b/src/presenters/helpers.cpp deleted file mode 100644 index ef4ea02..0000000 --- a/src/presenters/helpers.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 "common.h" - -namespace callui { namespace { namespace himpl { - - const TString STR_HH_MM_SS_TIME{"%02d:%02d:%02d"}; - const TString STR_MM_SS_TIME{"%02d:%02d"}; - -}}} - -namespace callui { - - using namespace ucl; - - void replaceSubstringInString(std::string &str, - const std::string &from, const std::string &to) - { - if (from.empty()) { - LOG_RETURN_VOID(RES_FAIL, "Parameter from is empty"); - } - - size_t start_pos = 0; - while((start_pos = str.find(from, start_pos)) != std::string::npos) { - str.replace(start_pos, from.length(), to); - start_pos += to.length(); - } - } - - void setCallDuration(const struct tm &time, - EdjeWidget &widget, - const EdjePart &part) - { - TString tmp; - if (time.tm_hour > 0) { - tmp = himpl::STR_HH_MM_SS_TIME.format(time.tm_hour, time.tm_min, time.tm_sec); - } else { - tmp = himpl::STR_MM_SS_TIME.format(time.tm_min, time.tm_sec); - } - widget.setText(tmp, part); - } - - void tryUpdateCallDurationTime( - struct tm &curTime, - struct tm &compTime, - EdjeWidget &widget, - const EdjePart &part) - { - if ((compTime.tm_sec - curTime.tm_sec) != 0) { - curTime = compTime; - setCallDuration(curTime, widget, part); - } - } - -} diff --git a/src/presenters/helpers.h b/src/presenters/helpers.h deleted file mode 100644 index cc46cf7..0000000 --- a/src/presenters/helpers.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 __CALLUI_PRESENTERS_HELPERS_H__ -#define __CALLUI_PRESENTERS_HELPERS_H__ - -#include <string> -#include <time.h> - -#include "ucl/gui/EdjeWidget.h" -#include "ucl/gui/types.h" - -namespace callui { - - void replaceSubstringInString(std::string &str, - const std::string &from, const std::string &to); - - void setCallDuration(const struct tm &time, - ucl::EdjeWidget &widget, const ucl::EdjePart &part); - - void tryUpdateCallDurationTime( - struct tm &curTime, struct tm &compTime, - ucl::EdjeWidget &widget, const ucl::EdjePart &part); - -} - -#endif // __CALLUI_PRESENTERS_HELPERS_H__ diff --git a/src/resources.cpp b/src/resources.cpp deleted file mode 100644 index e2258e7..0000000 --- a/src/resources.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 "resources.h" - -namespace callui { - - // TODO: Need replace with IDS - - const ucl::TString STR_ANSWER_CALL {"Answer call"}; - const ucl::TString STR_HOLD_AND_ACCEPT {"Hold and Accept"}; - const ucl::TString STR_END_AND_ACCEPT {"End and Accept"}; - - const ucl::TString STR_CALL_WITH_PS_WILL_END {"Call with %s will end."}; - const ucl::TString STR_CALL_ON_HOLD {"Call on hold"}; - const ucl::TString STR_WITH_PD_PEOPLE {"With %d people"}; - const ucl::TString STR_CONFERENCE_CALL {"Conference call"}; - const ucl::TString STR_UNKNOWN {"Unknown"}; - const ucl::TString STR_EMERGENCY_CALL {"Emergency call"}; - const ucl::TString STR_VOICEMAIL {"Voicemail"}; - - const ucl::TString STR_INCOMING_CALL {"Incoming call"}; - const ucl::TString STR_DIALING_CALL {"Dialing"}; - const ucl::TString STR_ON_HOLD {"On hold"}; - const ucl::TString STR_CALL_ENDED {"Call ended"}; - - const ucl::TString STR_DECLINE_MESSAGES {"Decline messages"}; - - const ucl::TString STR_VOLUME {"Volume"}; - - const ucl::TString STR_MORE_SWAP {"Swap"}; - const ucl::TString STR_MORE_HEADSET {"Headset"}; - const ucl::TString STR_MORE_PHONE {"Phone"}; - const ucl::TString STR_MORE_KEYPAD {"Keypad"}; - const ucl::TString STR_MORE_HOLD {"Hold"}; - const ucl::TString STR_MORE_UNHOLD {"Unhold"}; - const ucl::TString STR_MORE_GEAR {"Gear"}; -} diff --git a/src/view/VolumeControl.cpp b/src/view/VolumeControl.cpp deleted file mode 100644 index 3cba34d..0000000 --- a/src/view/VolumeControl.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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 "view/VolumeControl.h" - -#include "common.h" - -namespace callui { namespace { namespace impl { - - using namespace ucl; - - constexpr LayoutTheme LAYOUT_VOLUME - {"layout", "callui", "volume_control"}; - - constexpr ElmStyle STYLE_BTN_MINUS {"callui/minus"}; - constexpr ElmStyle STYLE_BTN_PLUS {"callui/plus"}; - - constexpr EdjePart PART_SWL_MINUS {"swl.minus"}; - constexpr EdjePart PART_SWL_PLUS {"swl.plus"}; - - constexpr EdjePart PART_TXT_INFO {"txt.info"}; - constexpr EdjePart PART_TXT_VALUE {"txt.value"}; - -}}} - -namespace callui { - - using namespace ucl; - - VolumeControl::Builder::Builder(): - m_maxValue(0), - m_curValue(0) - { - } - - VolumeControl::Builder &VolumeControl::Builder::setInfoText(const TString &info) - { - m_info = info; - return *this; - } - - VolumeControl::Builder &VolumeControl::Builder::setMaxValue(int maxValue) - { - m_maxValue = maxValue; - return *this; - } - - VolumeControl::Builder &VolumeControl::Builder::setValue(int curValue) - { - m_curValue = curValue; - return *this; - } - - VolumeControl::Builder &VolumeControl::Builder::setEventHandler( - const VolumeControlEventHandler &handler) - { - m_handler = handler; - return *this; - } - - VolumeControlSRef VolumeControl::Builder::build(ElmWidget &parent) const - { - auto layout = Layout::Builder(). - setTheme(impl::LAYOUT_VOLUME). - setIsOwner(true). - build(parent); - if (!layout) { - LOG_RETURN_VALUE(RES_FAIL, {}, "Layout::build() failed!"); - } - - auto result = makeShared<VolumeControl>(layout, - m_info, - m_maxValue, - m_curValue, - m_handler); - - result->bindToEo(); - - return result; - } - - VolumeControl::VolumeControl(IRefCountObj &rc, - const LayoutSRef &layout, - const TString &info, - int maxValue, - int curValue, - const VolumeControlEventHandler &handler): - Slider(rc, layout, maxValue, curValue), - m_decreaseBtn(elm_button_add(*m_layout)), - m_increaseBtn(elm_button_add(*m_layout)), - m_handler(handler) - { - prepare(info, curValue); - } - - VolumeControl::~VolumeControl() - { - } - - void VolumeControl::prepare(const ucl::TString &info, int curValue) - { - m_decreaseBtn.setStyle(impl::STYLE_BTN_MINUS); - m_decreaseBtn.addEventHandler(BTN_CLICKED, WEAK_DELEGATE( - VolumeControl::onDecreaseBtnClickedCb, asWeak(*this))); - m_layout->setContent(m_decreaseBtn, impl::PART_SWL_MINUS); - show(m_decreaseBtn); - - m_increaseBtn.setStyle(impl::STYLE_BTN_PLUS); - m_increaseBtn.addEventHandler(BTN_CLICKED, WEAK_DELEGATE( - VolumeControl::onIncreaseBtnClickedCb, asWeak(*this))); - m_layout->setContent(m_increaseBtn, impl::PART_SWL_PLUS); - show(m_increaseBtn); - - setInfoText(info); - setValue(curValue); - } - - void VolumeControl::setInfoText(const TString &info) - { - m_layout->setText(info.translate(), impl::PART_TXT_INFO); - } - - void VolumeControl::setValue(int value) - { - eext_circle_object_value_set(m_slider, static_cast<double>(value)); - m_layout->setText(std::to_string(value), impl::PART_TXT_VALUE); - } - - void VolumeControl::setIncreaseBtnEnable(bool isEnable) - { - isEnable ? enable(m_increaseBtn) : disable(m_increaseBtn); - } - - void VolumeControl::setDecreaseBtnEnable(bool isEnable) - { - isEnable ? enable(m_decreaseBtn) : disable(m_decreaseBtn); - } - - void VolumeControl::setEventHandler( - const VolumeControlEventHandler &handler) - { - m_handler = handler; - } - - void VolumeControl::onDecreaseBtnClickedCb(Widget &widget, void *eventInfo) - { - if (m_handler) { - m_handler(VolumeControlEvent::DECREASE); - } - } - - void VolumeControl::onIncreaseBtnClickedCb(Widget &widget, void *eventInfo) - { - if (m_handler) { - m_handler(VolumeControlEvent::INCREASE); - } - } - -} diff --git a/src/view/helpers.cpp b/src/view/helpers.cpp deleted file mode 100644 index e4f8595..0000000 --- a/src/view/helpers.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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 "view/helpers.h" - -#include "ucl/gui/Window.h" -#include "ucl/gui/Naviframe.h" - -#include "common.h" - -namespace callui { namespace { namespace impl { - - using namespace ucl; - - constexpr EoDataKey CIRCLE_SURFACE {"callui,eext,circle,surface"}; -}}} - -namespace callui { - - using namespace ucl; - - Result createCircleSurface(Naviframe &navi) - { - const auto win = navi.getWindow(); - if (!win) { - LOG_RETURN(RES_FAIL, "Failed to get Window from Naviframe!"); - } - - if (win->getData(impl::CIRCLE_SURFACE)) { - LOG_RETURN(RES_ILLEGAL_STATE, "Circle Surface data already set!"); - } - - const auto sfc = eext_circle_surface_conformant_add(win->getConformant()); - if (!sfc) { - LOG_RETURN(RES_FAIL, - "eext_circle_surface_conformant_add() failed!"); - } - - win->setData(impl::CIRCLE_SURFACE, sfc); - - return RES_OK; - } - - Eext_Circle_Surface *getCircleSurface(const ElmWidget &widget) - { - const auto win = widget.getWindow(); - if (!win) { - LOG_RETURN_VALUE(RES_FAIL, nullptr, - "Failed to get Window from widget!"); - } - - const auto sfc = static_cast<Eext_Circle_Surface *>( - win->getData(impl::CIRCLE_SURFACE)); - if (!sfc) { - LOG_RETURN_VALUE(RES_FAIL, nullptr, - "Failed to get Eext_Circle_Surface from window!"); - } - - return sfc; - } - - void addRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data) - { - eext_rotary_event_handler_add(func, data); - } - - void delRotaryEventHandler(Eext_Rotary_Handler_Cb func, void *data) - { - std::vector<void *> backup; - while (true) { - void *const oldData = eext_rotary_event_handler_del(func); - if (!oldData || (oldData == data)) { - return; - } - backup.push_back(oldData); - } - for (auto i = backup.size(); i-- > 0; ) { - eext_rotary_event_handler_add(func, backup[i]); - } - } - - Elm_Genlist_Item_Class createGenlistItemClass(const char *style, - Elm_Gen_Item_Text_Get_Cb txtCb, - Elm_Gen_Item_Content_Get_Cb contentCb, - Elm_Gen_Item_State_Get_Cb stateCb, - Elm_Gen_Item_Del_Cb delCb) - { - Elm_Genlist_Item_Class itc = { ELM_GEN_ITEM_CLASS_HEADER }; - itc.item_style = style; - itc.func.text_get = txtCb; - itc.func.content_get = contentCb; - itc.func.state_get = stateCb; - itc.func.del = delCb; - - return itc; - } - - LayoutTheme getImageTheme(const char *const fileName) - { - return {"layout", "callui_image", fileName}; - } - -} - diff --git a/tizen-manifest.xml b/tizen-manifest.xml index 6a76d4d..0c547f7 100644 --- a/tizen-manifest.xml +++ b/tizen-manifest.xml @@ -25,5 +25,6 @@ <privilege>http://tizen.org/privilege/notification</privilege> <privilege>http://tizen.org/privilege/message.read</privilege> <privilege>http://tizen.org/privilege/callhistory.read</privilege> + <privilege>http://tizen.org/privilege/bluetooth.admin</privilege> </privileges> </manifest> diff --git a/ucl/inc/ucl/appfw/IInstance.h b/ucl/inc/ucl/appfw/IInstance.h deleted file mode 100644 index bf09205..0000000 --- a/ucl/inc/ucl/appfw/IInstance.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 __UCL_APPFW_I_INSTANCE_H__ -#define __UCL_APPFW_I_INSTANCE_H__ - -#include "IInstanceContext.h" - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(IInstance); - - class IInstance : public Polymorphic { - public: - virtual Result onCreate(IInstanceContext *context) = 0; - virtual void onPause() = 0; - virtual void onResume() = 0; - }; -} - -#endif // __UCL_APPFW_I_INSTANCE_H__ diff --git a/ucl/inc/ucl/gui/EdjeWidget.h b/ucl/inc/ucl/gui/EdjeWidget.h deleted file mode 100644 index 0ee57f0..0000000 --- a/ucl/inc/ucl/gui/EdjeWidget.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 __UCL_GUI_EDJE_WIDGET_H__ -#define __UCL_GUI_EDJE_WIDGET_H__ - -#include "ElmWidget.h" - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(EdjeWidget); - - class EdjeWidget : public ElmWidget { - public: - void setText(const TString &value); - void setText(const TString &value, EdjePart part); - - TString getText() const; - TString getText(EdjePart part) const; - - void setContent(Evas_Object *content); - void setContent(Evas_Object *content, EdjePart part); - Evas_Object *unsetContent(); - Evas_Object *unsetContent(EdjePart part); - - Evas_Object *getContent() const; - Evas_Object *getContent(EdjePart part) const; - - void emit(EdjeSignal signal, EdjeSignalSrc source = - EdjeSignalSrc("")); - - protected: - EdjeWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = false); - }; -} - -#include "EdjeWidget.hpp" - -#endif // __UCL_GUI_EDJE_WIDGET_H__ diff --git a/ucl/inc/ucl/gui/ElmWidget.h b/ucl/inc/ucl/gui/ElmWidget.h deleted file mode 100644 index 3856b49..0000000 --- a/ucl/inc/ucl/gui/ElmWidget.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 __UCL_GUI_ELM_WIDGET_H__ -#define __UCL_GUI_ELM_WIDGET_H__ - -#include "Widget.h" - -#define UCL_SMART_FWD_ATSPI UCL_SMART_FWD "atspi," - -namespace ucl { - - constexpr SmartEvent ATSPI_ON_GESTURE {UCL_SMART_FWD_ATSPI "gesture"}; - - class Window; - - UCL_DECLARE_REF_ALIASES(ElmWidget); - - class ElmWidget : public Widget { - public: - explicit ElmWidget(Evas_Object *eo, bool isOwner = false); - virtual ~ElmWidget(); - - void setEnabled(bool value); - bool isEnabled() const; - - void setFocusAlowed(bool value); - bool isFocusAlowed() const; - - void setTheme(Elm_Theme *th); - Elm_Theme *getTheme(); - - Evas_Object *getTopWidget() const; - Window *getWindow() const; - - protected: - friend class ReffedObj<ElmWidget>; - ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = false); - - virtual void setFocusedImpl(bool value) final override; - virtual bool isFocusedImpl() const final override; - virtual bool ensureFwdEvent(SmartEvent fwdEvent) override; - - private: - Eina_Bool onAtspiGesture(Elm_Atspi_Gesture_Info gestureInfo, - Evas_Object *obj); - - private: - bool m_isAtspiGestureCbSet; - }; - - // Non-member functions // - - void enable(ElmWidget &widget); - void disable(ElmWidget &widget); -} - -#include "ElmWidget.hpp" - -#endif // __UCL_GUI_ELM_WIDGET_H__ diff --git a/ucl/inc/ucl/gui/Genlist.h b/ucl/inc/ucl/gui/Genlist.h deleted file mode 100644 index ebbb43e..0000000 --- a/ucl/inc/ucl/gui/Genlist.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 __UCL_GUI_GENLIST_H__ -#define __UCL_GUI_GENLIST_H__ - -#include "StyledWidget.h" -#include "GenlistItem.h" - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(Genlist); - - class Genlist : public StyledWidget { - public: - enum class Mode { - COMPRESS = ELM_LIST_COMPRESS, - SCROLL = ELM_LIST_SCROLL, - LIMIT = ELM_LIST_LIMIT, - EXPAND = ELM_LIST_EXPAND - }; - - class Builder final { - public: - Builder(); - Builder &setStyle(ElmStyle style); - Builder &setMode(Mode mode); - Builder &setHomogeneous(bool value); - Builder &setIsOwner(bool value); - Builder &setNeedBindToEo(bool value); - GenlistSRef build(ElmWidget &parent) const; - private: - ElmStyle m_style; - Mode m_mode; - bool m_isHomogeneous; - bool m_isOwner; - bool m_needBindToEo; - }; - - public: - friend class ReffedObj<Genlist>; - using StyledWidget::StyledWidget; - - void setMode(Mode mode); - Mode getMode() const; - - void setHomogeneous(bool isHomogeneous); - bool isHomogeneous() const; - - void updateRealizedItems(); - void clear(); - - GenlistItem append(const Elm_Genlist_Item_Class *itc, - const void *data, SmartCbHandler onSelect = nullptr, - GenlistItem::Type type = GenlistItem::Type::SIMPLE, - GenlistItem parent = nullptr); - - GenlistItem prepend(const Elm_Genlist_Item_Class *itc, - const void *data, SmartCbHandler onSelect = nullptr, - GenlistItem::Type type = GenlistItem::Type::SIMPLE, - GenlistItem parent = nullptr); - - GenlistItem insertAfter(GenlistItem after, - const Elm_Genlist_Item_Class *itc, const void *data, - SmartCbHandler onSelect = nullptr, - GenlistItem::Type type = GenlistItem::Type::SIMPLE, - GenlistItem parent = nullptr); - - GenlistItem insertBefore(GenlistItem before, - const Elm_Genlist_Item_Class *itc, const void *data, - SmartCbHandler onSelect = nullptr, - GenlistItem::Type type = GenlistItem::Type::SIMPLE, - GenlistItem parent = nullptr); - }; -} - -#include "Genlist.hpp" - -#endif // __UCL_GUI_GENLIST_H__ diff --git a/ucl/inc/ucl/gui/Layout.h b/ucl/inc/ucl/gui/Layout.h deleted file mode 100644 index 9eb108e..0000000 --- a/ucl/inc/ucl/gui/Layout.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 __UCL_GUI_LAYOUT_H__ -#define __UCL_GUI_LAYOUT_H__ - -#include "EdjeWidget.h" - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(Layout); - - class Layout : public EdjeWidget { - public: - class Builder final { - public: - Builder(); - Builder &setTheme(const LayoutTheme &value); - Builder &setEdjeFile(std::string filePath, EdjeGroup group); - Builder &setIsOwner(bool value); - Builder &setNeedBindToEo(bool value); - LayoutSRef build(ElmWidget &parent) const; - private: - LayoutTheme m_theme; - std::string m_edjeFilePath; - EdjeGroup m_edjeGroup; - bool m_isOwner; - bool m_needBindToEo; - }; - - public: - friend class ReffedObj<Layout>; - using EdjeWidget::EdjeWidget; - explicit Layout(Evas_Object *eo, bool isOwner = false); - - bool setTheme(const LayoutTheme &theme); - bool setEdjeFile(const std::string &filePath, EdjeGroup group); - - Variant getData(EdjeDataKey key); - }; -} - -#include "Layout.hpp" - -#endif // __UCL_GUI_LAYOUT_H__ diff --git a/ucl/inc/ucl/gui/NaviItem.h b/ucl/inc/ucl/gui/NaviItem.h deleted file mode 100644 index 1161847..0000000 --- a/ucl/inc/ucl/gui/NaviItem.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 __UCL_GUI_NAVI_ITEM_H__ -#define __UCL_GUI_NAVI_ITEM_H__ - -#include "WidgetItem.h" - -namespace ucl { - - class NaviItem final : public WidgetItem { - public: - using PopHandler = Delegate<Eina_Bool(Elm_Object_Item *)>; - - public: - using WidgetItem::WidgetItem; - - void setPopHandler(const PopHandler &handler) const; - - void popTo() const; - void promote() const; - - void setTitleEnabled(bool value, bool useTransition = false) const; - bool isTitleEnabled() const; - - void setTitle(const TString &title) const; - }; -} - -#include "NaviItem.hpp" - -#endif // __UCL_GUI_NAVI_ITEM_H__ diff --git a/ucl/inc/ucl/gui/Naviframe.h b/ucl/inc/ucl/gui/Naviframe.h deleted file mode 100644 index 66693f2..0000000 --- a/ucl/inc/ucl/gui/Naviframe.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 __UCL_GUI_NAVIFRAME_H__ -#define __UCL_GUI_NAVIFRAME_H__ - -#include <vector> - -#include "StyledWidget.h" -#include "NaviItem.h" - -namespace ucl { - - constexpr SmartEvent NAVI_TRANSITION_STARTED {"ucl,transition,started"}; - constexpr SmartEvent NAVI_TRANSITION_FINISHED {"transition,finished"}; - - UCL_DECLARE_REF_ALIASES(Naviframe); - - class Naviframe final : public StyledWidget { - public: - class Builder final { - public: - Builder(); - Builder &setStyle(ElmStyle value); - Builder &setNeedBindToEo(bool value); - NaviframeSRef build(ElmWidget &parent) const; - private: - ElmStyle m_style; - bool m_needBindToEo; - }; - - public: - void setInTransition(bool inTransition); - bool isInTransition() const; - - void setAutoBackBtn(bool value); - bool isAutoBackBtn() const; - - void setPreservePop(bool value); - bool isPreservePop() const; - - void setEventsEnabledOnTransition(bool value); - bool isEventsEnabledOnTransition() const; - - Evas_Object *pop(); - - NaviItem push(const TString &title, - Evas_Object *backBtn, Evas_Object *moreBtn, - Evas_Object *content, ElmStyle style = nullptr); - NaviItem push(const TString &title, - Evas_Object *content, ElmStyle style = nullptr); - NaviItem push(Evas_Object *content, ElmStyle style = nullptr); - - NaviItem insertAfter(NaviItem after, const TString &title, - Evas_Object *backBtn, Evas_Object *moreBtn, - Evas_Object *content, ElmStyle style = nullptr); - NaviItem insertAfter(NaviItem after, const TString &title, - Evas_Object *content, ElmStyle style = nullptr); - NaviItem insertAfter(NaviItem after, - Evas_Object *content, ElmStyle style = nullptr); - - NaviItem insertBefore(NaviItem before, const TString &title, - Evas_Object *backBtn, Evas_Object *moreBtn, - Evas_Object *content, ElmStyle style = nullptr); - NaviItem insertBefore(NaviItem before, const TString &title, - Evas_Object *content, ElmStyle style = nullptr); - NaviItem insertBefore(NaviItem before, - Evas_Object *content, ElmStyle style = nullptr); - - NaviItem getTopItem()const; - NaviItem getBottomItem() const; - std::vector<NaviItem> getItems() const; - - private: - friend class ReffedObj<Naviframe>; - Naviframe(IRefCountObj &rc, Evas_Object *eo); - - void onTransitionFinished(Widget &widget, void *eventInfo); - - private: - bool m_isInTransition; - }; -} - -#include "Naviframe.hpp" - -#endif // __UCL_GUI_NAVIFRAME_H__ diff --git a/ucl/inc/ucl/gui/Naviframe.hpp b/ucl/inc/ucl/gui/Naviframe.hpp deleted file mode 100644 index e8fdc19..0000000 --- a/ucl/inc/ucl/gui/Naviframe.hpp +++ /dev/null @@ -1,185 +0,0 @@ -/* - * 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. - */ - -namespace ucl { - - // Naviframe::Builder // - - inline Naviframe::Builder::Builder() : - m_needBindToEo(true) - { - } - - inline Naviframe::Builder &Naviframe::Builder::setStyle( - const ElmStyle value) - { - m_style = value; - return *this; - } - - inline Naviframe::Builder &Naviframe::Builder::setNeedBindToEo( - const bool value) - { - m_needBindToEo = value; - return *this; - } - - // Naviframe // - - inline bool Naviframe::isInTransition() const - { - return m_isInTransition; - } - - inline void Naviframe::setAutoBackBtn(const bool value) - { - elm_naviframe_prev_btn_auto_pushed_set(getEo(), toEina(value)); - } - - inline bool Naviframe::isAutoBackBtn() const - { - return elm_naviframe_prev_btn_auto_pushed_get(getEo()); - } - - inline void Naviframe::setPreservePop(const bool value) - { - elm_naviframe_content_preserve_on_pop_set(getEo(), toEina(value)); - } - - inline bool Naviframe::isPreservePop() const - { - return elm_naviframe_content_preserve_on_pop_get(getEo()); - } - - inline void Naviframe::setEventsEnabledOnTransition(const bool value) - { - elm_naviframe_event_enabled_set(getEo(), toEina(value)); - } - - inline bool Naviframe::isEventsEnabledOnTransition() const - { - return elm_naviframe_event_enabled_get(getEo()); - } - - inline Evas_Object *Naviframe::pop() - { - auto result = elm_naviframe_item_pop(getEo()); - if (getBottomItem()) { - setInTransition(true); - } - return result; - } - - inline NaviItem Naviframe::push(const TString &title, - Evas_Object *const backBtn, Evas_Object *const moreBtn, - Evas_Object *const content, const ElmStyle style) - { - auto result = NaviItem(elm_naviframe_item_push(getEo(), - nullptr, backBtn, moreBtn, content, style.name)); - result.setTitle(title); - if (result != getBottomItem()) { - setInTransition(true); - } - return result; - } - - inline NaviItem Naviframe::push(const TString &title, - Evas_Object *const content, const ElmStyle style) - { - return push(title, nullptr, nullptr, content, style); - } - - inline NaviItem Naviframe::push( - Evas_Object *const content, const ElmStyle style) - { - return push(nullptr, nullptr, nullptr, content, style); - } - - inline NaviItem Naviframe::insertAfter(NaviItem after, - const TString &title, - Evas_Object *const backBtn, Evas_Object *const moreBtn, - Evas_Object *const content, const ElmStyle style) - { - auto result = NaviItem(elm_naviframe_item_insert_after(getEo(), - after, nullptr, backBtn, moreBtn, content, style.name)); - result.setTitle(title); - return result; - } - - inline NaviItem Naviframe::insertAfter(NaviItem after, - const TString &title, - Evas_Object *const content, const ElmStyle style) - { - return insertAfter(after, title, nullptr, nullptr, content, style); - } - - inline NaviItem Naviframe::insertAfter(NaviItem after, - Evas_Object *const content, const ElmStyle style) - { - return insertAfter(after, nullptr, nullptr, nullptr, content, style); - } - - inline NaviItem Naviframe::insertBefore(NaviItem before, - const TString &title, - Evas_Object *const backBtn, Evas_Object *const moreBtn, - Evas_Object *const content, const ElmStyle style) - { - auto result = NaviItem(elm_naviframe_item_insert_before(getEo(), - before, nullptr, backBtn, moreBtn, content, style.name)); - result.setTitle(title); - return result; - } - - inline NaviItem Naviframe::insertBefore(NaviItem before, - const TString &title, - Evas_Object *const content, const ElmStyle style) - { - return insertAfter(before, title, nullptr, nullptr, content, style); - } - - inline NaviItem Naviframe::insertBefore(NaviItem before, - Evas_Object *const content, const ElmStyle style) - { - return insertAfter(before, nullptr, nullptr, nullptr, content, style); - } - - inline NaviItem Naviframe::getTopItem()const - { - return NaviItem(elm_naviframe_top_item_get(getEo())); - } - - inline NaviItem Naviframe::getBottomItem() const - { - return NaviItem(elm_naviframe_bottom_item_get(getEo())); - } - - inline std::vector<NaviItem> Naviframe::getItems() const - { - std::vector<NaviItem> result; - - Eina_List *const items = elm_naviframe_items_get(getEo()); - Eina_List *l = nullptr; - void *data = nullptr; - - EINA_LIST_FOREACH(items, l, data) { - result.emplace_back(static_cast<Elm_Object_Item *>(data)); - } - - eina_list_free(items); - - return result; - } -} diff --git a/ucl/inc/ucl/gui/Theme.h b/ucl/inc/ucl/gui/Theme.h deleted file mode 100644 index d8b5b31..0000000 --- a/ucl/inc/ucl/gui/Theme.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 __UCL_GUI_THEME_H__ -#define __UCL_GUI_THEME_H__ - -#include "types.h" - -namespace ucl { - - class Theme final : NonCopyable { - public: - static Theme create(); - - friend void swap(Theme &x, Theme &y); - - public: - Theme(); - Theme(std::nullptr_t); - explicit Theme(Elm_Theme *th, bool isOwner = false); - Theme(Theme &&tmp); - Theme &operator=(Theme &&tmp); - ~Theme(); - - Elm_Theme *getTh(); - const Elm_Theme *getTh() const; - - operator Elm_Theme *(); - operator const Elm_Theme *() const; - - void addExtension(const std::string edjePath); - void addOverlay(const std::string edjePath); - - private: - Elm_Theme *m_th; - bool m_isOwner; - }; - - // Non-member functions // - - bool isValid(const Theme &item); -} - -#include "Theme.hpp" - -#endif // __UCL_GUI_THEME_H__ diff --git a/ucl/inc/ucl/gui/Widget.h b/ucl/inc/ucl/gui/Widget.h deleted file mode 100644 index e60c5ec..0000000 --- a/ucl/inc/ucl/gui/Widget.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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 __UCL_GUI_WIDGET_H__ -#define __UCL_GUI_WIDGET_H__ - -#include <list> - -#include "types.h" - -#include "ucl/misc/RefCountAware.h" - -#define UCL_SMART_FWD "ucl,fwd," - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(Widget); - - class Widget : public RefCountAware { - public: - static constexpr auto EXPAND = EVAS_HINT_EXPAND; - static constexpr auto FILL = EVAS_HINT_FILL; - - public: - explicit Widget(Evas_Object *eo, bool isOwner = false); - virtual ~Widget(); - - void bindToEo(); - void unbindFromEo(); - - void setIsOwner(bool value); - - Evas_Object *getEo(); - const Evas_Object *getEo() const; - - operator Evas_Object *(); - operator const Evas_Object *() const; - - Evas *getEvas() const; - - void setData(EoDataKey key, void *data); - void delData(EoDataKey key); - void *getData(EoDataKey key) const; - - void addEventHandler(WidgetEvent event, WidgetEventHandler handler); - void addEventHandler(SmartEvent event, WidgetEventHandler handler); - - void delEventHandler(WidgetEvent event, WidgetEventHandler handler); - void delEventHandler(SmartEvent event, WidgetEventHandler handler); - - void callEvent(SmartEvent event, void *eventInfo = nullptr); - - void markForDeletion(); - - void setVisible(bool value); - bool isVisible() const; - - void setColor(int r, int g, int b, int a = 255); - void setColor(int l, int a = 255); - void getColor(int &r, int &g, int &b, int &a) const; - - void calculate(); - - void setGeometry(int x, int y, int w, int h); - void move(int x, int y); - void resize(int w, int h); - - void getGeometry(int *x, int *y, int *w, int *h) const; - - void setWeight(double w, double h); - void setAlign(double w, double h); - void setMin(int w, int h); - void setMax(int w, int h); - - void getWeight(double *w, double *h) const; - void getAlign(double *w, double *h) const; - void getMin(int *w, int *h) const; - void getMax(int *w, int *h) const; - - void setARHint(WidgetARHint arControl, int w, int h); - void getARHint(WidgetARHint &arControl, int &w, int &h); - - void setFocused(bool value); - bool isFocused() const; - - protected: - friend class ReffedObj<Widget>; - Widget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = false); - - virtual void setFocusedImpl(bool value); - virtual bool isFocusedImpl() const; - virtual bool ensureFwdEvent(SmartEvent fwdEvent); - - private: - class EventProxy; - using EventProxies = std::list<EventProxy>; - using EventProxiesIt = EventProxies::iterator; - - private: - void updateRefs(); - - void updateEoRef(); - bool needKeepEoRef() const; - void updateSelfRef(); - bool needKeepSelfRef() const; - - void setSelfRefUnique(const bool value); - - void onEoDel(Evas *e, Evas_Object *obj, void *event_info); - - void delEventProxy(const EventProxiesIt it); - - public: - // This section MUST be public! - // Signal to RefCountObj<T, C> to call onUniqueChanged() - enum { _ENABLE_ON_UNIQUE_CHANGED_DISPATCH }; - - protected: - // This section MAY be protected - void onUniqueChanged(bool isUnique); - - private: - Evas_Object *m_eo; - EventProxies m_eventProxies; - WidgetSRef m_selfRef; - bool m_isOwner; - bool m_isBoundToEo; - bool m_isEoRefKept; - bool m_isSelfRefUnique; - }; - - // Non-member functions // - - void getPosition(const Widget &widget, int *x, int *y); - void getSize(const Widget &widget, int *w, int *h); - - void show(Widget &widget); - void hide(Widget &widget); - - void makeTransparent(Widget &widget); - void makeWhite(Widget &widget); - - void focus(Widget &widget); - void unfocus(Widget &widget); - - void expand(Widget &widget); - void fill(Widget &widget); - void expandAndFill(Widget &widget); - - bool operator==(const Widget &lhs, const Widget &rhs); - bool operator!=(const Widget &lhs, const Widget &rhs); -} - -#include "Widget.hpp" - -#endif // __UCL_GUI_WIDGET_H__ diff --git a/ucl/inc/ucl/gui/WidgetItem.h b/ucl/inc/ucl/gui/WidgetItem.h deleted file mode 100644 index 7794444..0000000 --- a/ucl/inc/ucl/gui/WidgetItem.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 __UCL_GUI_WIDGET_ITEM_H__ -#define __UCL_GUI_WIDGET_ITEM_H__ - -#include "Widget.h" - -namespace ucl { - - class WidgetItem { - public: - constexpr WidgetItem(); - constexpr WidgetItem(std::nullptr_t); - explicit WidgetItem(Elm_Object_Item *it); - - Elm_Object_Item *getIt() const; - - operator Elm_Object_Item *() const; - operator bool() const; - - Evas_Object *getWidget() const; - - void setDelCallback(Evas_Smart_Cb cb) const; - - void del(); - - void setData(void *data) const; - void *getData() const; - - void setEnabled(bool value) const; - bool isEnabled() const; - - void setStyle(ElmStyle style) const; - - void setText(const TString &value) const; - void setText(const TString &value, EdjePart part) const; - - TString getText() const; - TString getText(EdjePart part) const; - - void setContent(Evas_Object *content) const; - void setContent(Evas_Object *content, EdjePart part) const; - Evas_Object *unsetContent() const; - Evas_Object *unsetContent(EdjePart part) const; - - Evas_Object *getContent() const; - Evas_Object *getContent(EdjePart part) const; - - void emit(EdjeSignal signal,EdjeSignalSrc source = - EdjeSignalSrc("")) const; - - private: - Elm_Object_Item *m_it; - }; - - // Non-member functions // - - void enable(WidgetItem item); - void disable(WidgetItem item); - - bool operator==(WidgetItem lhs, WidgetItem rhs); - bool operator!=(WidgetItem lhs, WidgetItem rhs); -} - -#include "WidgetItem.hpp" - -#endif // __UCL_GUI_WIDGET_ITEM_H__ diff --git a/ucl/inc/ucl/gui/Window.h b/ucl/inc/ucl/gui/Window.h deleted file mode 100644 index 9aa598d..0000000 --- a/ucl/inc/ucl/gui/Window.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 __UCL_GUI_WINDOW_H__ -#define __UCL_GUI_WINDOW_H__ - -#include <vector> - -#include "StyledWidget.h" - -namespace ucl { - - constexpr SmartEvent WIN_ROTATION_CHANGED {"wm,rotation,changed"}; - - UCL_DECLARE_REF_ALIASES(Window); - - class Window final : public ElmWidget { - public: - enum class Type { - BASIC = ELM_WIN_BASIC - }; - - class Builder final { - public: - Builder(); - - Builder &setWinEo(Evas_Object *value); - - Builder &setType(Type type); - Builder &setName(std::string value); - - Builder &setTitle(std::string value); - Builder &setSetIndicatorVisible(bool value); - Builder &setRotations(std::vector<int> value); - - Builder &setIsOwner(bool value); - Builder &setNeedBindToEo(bool value); - - WindowSRef build() const; - private: - std::string m_name; - std::string m_title; - std::vector<int> m_rotations; - Evas_Object *m_winEo; - Type m_type; - bool m_isIndicatorVisible; - bool m_isOwner; - bool m_isOwnerWasSet; - bool m_needBindToEo; - }; - - public: - StyledWidget &getConformant(); - const StyledWidget &getConformant() const; - - void getScreenSize(int *w, int *h) const; - - void setTitle(const std::string &title); - std::string getTitle() const; - - void setIndicatorVisible(bool value); - bool isIndicatorVisible() const; - - bool isRotationsSupported() const; - void setRotations(const std::vector<int> &value); - - void lower(); - - private: - friend class ReffedObj<Window>; - Window(IRefCountObj *rc, Evas_Object *eo, - bool isOwner, Evas_Object *conform); - - private: - StyledWidget m_conform; - }; - - // Non-member functions // - - // Window // - - void showIndicator(Window &win); - void hideIndicator(Window &win); - - // Window::Type // - - bool isValid(Window::Type winType); -} - -#include "Window.hpp" - -#endif // __UCL_GUI_WINDOW_H__ diff --git a/ucl/inc/ucl/gui/helpers.h b/ucl/inc/ucl/gui/helpers.h deleted file mode 100644 index d42eccb..0000000 --- a/ucl/inc/ucl/gui/helpers.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 __UCL_GUI_HELPERS_H__ -#define __UCL_GUI_HELPERS_H__ - -#include "Widget.h" - -namespace ucl { - - // Converts Evas_Object to Widget pointer // - - Widget *asWidget(Evas_Object *eo); - const Widget *asWidget(const Evas_Object *eo); - - // Widget casting functions from Evas_Object // - - template <class WIDGET_TYPE> - inline auto staticWidgetCast(Evas_Object *eo) -> - decltype(static_cast<WIDGET_TYPE *>(asWidget(eo))) - { - return static_cast<WIDGET_TYPE *>(asWidget(eo)); - } - - template <class WIDGET_TYPE> - inline auto staticWidgetCast(const Evas_Object *eo) -> - decltype(static_cast<WIDGET_TYPE *>(asWidget(eo))) - { - return static_cast<WIDGET_TYPE *>(asWidget(eo)); - } - - template <class WIDGET_TYPE> - inline auto dynamicWidgetCast(Evas_Object *eo) -> - decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo))) - { - return dynamic_cast<WIDGET_TYPE *>(asWidget(eo)); - } - - template <class WIDGET_TYPE> - inline auto dynamicWidgetCast(const Evas_Object *eo) -> - decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo))) - { - return dynamic_cast<WIDGET_TYPE *>(asWidget(eo)); - } - - template <class WIDGET_TYPE> - inline auto staticWidgetRefCast(Evas_Object *eo) -> - decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo))) - { - return asShared(staticWidgetCast<WIDGET_TYPE>(eo)); - } - - template <class WIDGET_TYPE> - inline auto staticWidgetRefCast(const Evas_Object *eo) -> - decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo))) - { - return asShared(staticWidgetCast<WIDGET_TYPE>(eo)); - } - - template <class WIDGET_TYPE> - inline auto dynamicWidgetRefCast(Evas_Object *eo) -> - decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo))) - { - return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)); - } - - template <class WIDGET_TYPE> - inline auto dynamicWidgetRefCast(const Evas_Object *eo) -> - decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo))) - { - return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)); - } -} - -#include "helpers.hpp" - -#endif // __UCL_GUI_HELPERS_H__ diff --git a/ucl/inc/ucl/misc/AutoHandle.h b/ucl/inc/ucl/misc/AutoHandle.h deleted file mode 100644 index 27c19f4..0000000 --- a/ucl/inc/ucl/misc/AutoHandle.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 __UCL_MISC_AUTO_HANDLE_H__ -#define __UCL_MISC_AUTO_HANDLE_H__ - -#include "ucl/util/types.h" - -namespace ucl { - - template <class HANDLE, class DEL_RET, DEL_RET(*DEL_FUNC)(HANDLE)> - struct AutoHandle final : ucl::NonCopyable { - using Handle = HANDLE; - - HANDLE value; - - AutoHandle() : - value() - { - } - - AutoHandle(std::nullptr_t) : - AutoHandle() - { - } - - AutoHandle(HANDLE value) : - value(value) - { - } - - ~AutoHandle() - { - if (value) { - DEL_FUNC(value); - } - } - - AutoHandle(AutoHandle &&src) : - value(src.value) - { - src.value = nullptr; - } - - AutoHandle &operator=(AutoHandle src) - { - swap(*this, src); - return *this; - } - - AutoHandle &operator=(HANDLE value) - { - AutoHandle src{value}; - swap(*this, src); - return *this; - } - - HANDLE *operator&() - { - return &value; - } - - operator HANDLE() - { - return value; - } - }; - - // Non-member functions // - - template <class HANDLE, class DEL_RET, DEL_RET(*DEL_FUNC)(HANDLE)> - inline void swap(AutoHandle<HANDLE, DEL_RET, DEL_FUNC> &x, - AutoHandle<HANDLE, DEL_RET, DEL_FUNC> &y) noexcept - { - std::swap(x.value, y.value); - } -} - -#endif // __UCL_MISC_AUTO_HANDLE_H__ diff --git a/ucl/inc/ucl/misc/CString.h b/ucl/inc/ucl/misc/CString.h deleted file mode 100644 index 396f37d..0000000 --- a/ucl/inc/ucl/misc/CString.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 __UCL_MISC_CSTRING_H__ -#define __UCL_MISC_CSTRING_H__ - -#include "ucl/util/types.h" - -namespace ucl { - - class CString final : public NonCopyable { - public: - friend void swap(CString &x, CString &y) noexcept; - - static CString dup(const char *ptr); - static CString takeover(char *ptr) noexcept; - - CString() noexcept; - CString(std::nullptr_t) noexcept; - CString(CString &&s) noexcept; - CString(const std::string &s); - ~CString() noexcept; - - CString &operator=(CString s) noexcept; - - bool isEmpty() const; - - char *release() noexcept; - - char *get() const noexcept; - - private: - explicit CString(char *ptr) noexcept; - - private: - char *m_ptr; - }; -} - -#include "CString.hpp" - -#endif // __UCL_MISC_CSTRING_H__ diff --git a/ucl/inc/ucl/misc/ConstCString.h b/ucl/inc/ucl/misc/ConstCString.h deleted file mode 100644 index 7f600f0..0000000 --- a/ucl/inc/ucl/misc/ConstCString.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 __UCL_MISC_CONST_CSTRING_H__ -#define __UCL_MISC_CONST_CSTRING_H__ - -#include "CString.h" - -namespace ucl { - - class ConstCString final : public NonCopyable { - public: - friend void swap(ConstCString &x, ConstCString &y) noexcept; - - static ConstCString wrap(const char *ptr) noexcept; - - ConstCString() noexcept; - ConstCString(std::nullptr_t) noexcept; - ConstCString(ConstCString &&s) noexcept; - ConstCString(CString &&s) noexcept; - ~ConstCString() noexcept; - - ConstCString &operator=(ConstCString s) noexcept; - - bool isEmpty() const; - - const char *get() const noexcept; - - private: - explicit ConstCString(const char *ptr) noexcept; - - private: - const char *m_ptr; - bool m_isOwner; - }; -} - -#include "ConstCString.hpp" - -#endif // __UCL_MISC_CONST_CSTRING_H__ diff --git a/ucl/inc/ucl/misc/Event.h b/ucl/inc/ucl/misc/Event.h deleted file mode 100644 index cd27f29..0000000 --- a/ucl/inc/ucl/misc/Event.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 __UCL_MISC_EVENT_H__ -#define __UCL_MISC_EVENT_H__ - -#include <vector> - -#include "ucl/util/types.h" - -namespace ucl { - - template <class DELEGATE> - class Event final { - public: - Event(); - - template <class DELEGATE2> - void operator+=(DELEGATE2 &&delegate); - template <class DELEGATE2> - void operator-=(const DELEGATE2 &delegate); - - bool isEmpty() const; - - template <class ...ARGS> - void dispatch(ARGS &&...args); - template <class PREDICATE, class ...ARGS> - void dispatchPred(PREDICATE &&pred, ARGS &&...args); - - private: - template <class DO_INVOKE, class ...ARGS> - void dispatchImpl(const DO_INVOKE &doInvoke, ARGS &&...args); - - void lock(); - void unlock(); - bool isLocked() const; - - void defrag(); - - private: - std::vector<DELEGATE> m_delegates; - int m_lockCount; - bool m_isFragmented; - }; -} - -#include "Event.hpp" - -#endif // __UCL_MISC_EVENT_H__ diff --git a/ucl/inc/ucl/misc/RefCountAware.h b/ucl/inc/ucl/misc/RefCountAware.h deleted file mode 100644 index 6ea5ee9..0000000 --- a/ucl/inc/ucl/misc/RefCountAware.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 __UCL_MISC_REF_COUNT_AWARE_H__ -#define __UCL_MISC_REF_COUNT_AWARE_H__ - -#include "ucl/util/types.h" -#include "ucl/util/memory.h" - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(RefCountAware); - - class RefCountAware : public Polymorphic { - public: - bool isShared() const; - UInt getUseCount() const; - const void *getObjPtr() const; - - template <class T> - SharedRef<T> asSharedThis(T *thisAlias) const; - - template <class T> - WeakRef<T> asWeakThis(T *thisAlias) const; - - protected: - RefCountAware(IRefCountObj *rc); - virtual ~RefCountAware() = default; - - public: - // This section MUST be public! - // Signal to RefCountObj<T, C> to pass IRefCountObj to constructor - enum { _IS_REF_COUNT_AWARE }; - - private: - IRefCountObj *const m_rc; - }; - - // Non-member functions // - - template <class T> - SharedRef<T> asShared(T &obj); - template <class T> - SharedRef<T> asShared(T *obj); - - template <class T> - WeakRef<T> asWeak(T &obj); - template <class T> - WeakRef<T> asWeak(T *obj); - - template <class T, class U, class = typename - std::enable_if<!std::is_same<T, U>::value>::type> - SharedRef<T> asShared(U &obj); - template <class T, class U, class = typename - std::enable_if<!std::is_same<T, U>::value>::type> - SharedRef<T> asShared(U *obj); - - template <class T, class U, class = typename - std::enable_if<!std::is_same<T, U>::value>::type> - WeakRef<T> asWeak(U &obj); - template <class T, class U, class = typename - std::enable_if<!std::is_same<T, U>::value>::type> - WeakRef<T> asWeak(U *obj); - - template <class T, class U, class = typename - std::enable_if<!std::is_same<T, const U>::value>::type> - SharedRef<const T> asShared(const U &obj); - template <class T, class U, class = typename - std::enable_if<!std::is_same<T, const U>::value>::type> - SharedRef<const T> asShared(const U *obj); - - template <class T, class U, class = typename - std::enable_if<!std::is_same<T, const U>::value>::type> - WeakRef<const T> asWeak(const U &obj); - template <class T, class U, class = typename - std::enable_if<!std::is_same<T, const U>::value>::type> - WeakRef<const T> asWeak(const U *obj); -} - -#include "RefCountAware.hpp" - -#endif // __UCL_MISC_REF_COUNT_AWARE_H__ diff --git a/ucl/inc/ucl/misc/TString.h b/ucl/inc/ucl/misc/TString.h deleted file mode 100644 index 71ca2d9..0000000 --- a/ucl/inc/ucl/misc/TString.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 __UCL_MISC_T_STRING_H__ -#define __UCL_MISC_T_STRING_H__ - -#include "ucl/util/types.h" - -namespace ucl { - - class TString final { - public: - TString(); - - /** - * Constructs TString from std::string and domain - * - * @param str Text string or string id if translatable. - * @param domain Valid domain name or "" for default domain, - * nullptr - if string is not translatable - */ - TString(const std::string &str, const char *domain); - TString(const std::string &str, bool translatable = false); - - TString(std::string &&str, const char *domain); - TString(std::string &&str, bool translatable = false); - - TString(const char *str, const char *domain); - TString(const char *str, bool translatable = false); - - bool isEmpty() const; - - bool isTranslatable() const; - bool hasDomain() const; - const char *getDomain() const; - - const std::string &getStr() const; - operator const std::string &() const; - - const char *getCStr() const; - operator const char *() const; - - const char *translate() const; - - template <typename ...ARGS> - std::string format(ARGS ...args) const; - - private: - const char *doTranslate(const char *strId) const; - - private: - std::string m_str; - const char *m_domain; - }; -} - -#include "TString.hpp" - -#endif // __UCL_MISC_T_STRING_H__ diff --git a/ucl/inc/ucl/misc/Variant.h b/ucl/inc/ucl/misc/Variant.h deleted file mode 100644 index 6542358..0000000 --- a/ucl/inc/ucl/misc/Variant.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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 __UCL_MISC_VARIANT_H__ -#define __UCL_MISC_VARIANT_H__ - -#include <array> -#include <vector> -#include <initializer_list> - -#include "ConstCString.h" - -namespace ucl { - - class Variant; - - using VarVector = std::vector<Variant>; - - template <size_t N> - using VarArray = std::array<Variant, N>; - - struct VarInitList final { - VarInitList(const std::initializer_list<Variant> &il) : il(il) {} - const std::initializer_list<Variant> &il; - }; - - class Variant final { - public: - enum Type { - TYPE_NIL, - TYPE_BOOLEAN, - TYPE_INTEGER, - TYPE_FLOAT, - TYPE_DOUBLE, - TYPE_STRING, - TYPE_ARRAY - }; - - public: - friend void swap(Variant &x, Variant &y) noexcept; - - friend bool operator==(const Variant &lhs, const Variant &rhs) noexcept; - friend bool operator!=(const Variant &lhs, const Variant &rhs) noexcept; - - public: - Variant() noexcept; - Variant(std::nullptr_t) noexcept; - - Variant(bool aBool) noexcept; - Variant(int anInt) noexcept; - Variant(float aFloat) noexcept; - Variant(double aDouble) noexcept; - - Variant(const char *aString); - Variant(const char *aString, int length); - Variant(const std::string &aString); - - Variant(std::nullptr_t, int arrayLength); - Variant(const Variant *anArray, int length); - Variant(const VarVector &anArray); - template <size_t N> - Variant(const VarArray<N> &anArray); - Variant(const VarInitList &anArray); - - ~Variant(); - - Variant(const Variant &v); - Variant(Variant &&v) noexcept; - - Variant &operator=(Variant v); - - Type getType() const noexcept; - int getLength() const noexcept; - bool isEmpty() const noexcept; - - bool asBool() const noexcept; - int asInt() const noexcept; - float asFloat() const noexcept; - double asDouble() const noexcept; - - ConstCString asString() const noexcept; - - Variant *asArray() noexcept; - const Variant *asArray() const noexcept; - - Variant *begin() noexcept; - Variant *end() noexcept; - const Variant *begin() const noexcept; - const Variant *end() const noexcept; - - Variant &operator[](int index) noexcept; - const Variant &operator[](int index) const noexcept; - - explicit operator bool() const noexcept; - explicit operator int() const noexcept; - explicit operator float() const noexcept; - explicit operator double() const noexcept; - - bool operator==(Variant::Type rhs) const noexcept; - bool operator!=(Variant::Type rhs) const noexcept; - - private: - const char *getStr() const noexcept; - - public: - union { - uint8_t m_type; - struct { - uint64_t qw1; - uint64_t qw2; - } m_raw; - struct { uint8_t type; bool value; } m_aBool; - struct { uint8_t type; int value; } m_anInt; - struct { uint8_t type; float value; } m_aFloat; - struct { uint8_t type; double value; } m_aDouble; - struct { - uint8_t type; - char buffer[sizeof(m_raw) - 1]; - } m_aSmallStr; - struct { - uint8_t type; - int length; - char *data; - } m_aString; - struct { - uint8_t type; - int length; - Variant *data; - } m_anArray; - }; - }; -} - -#include "Variant.hpp" - -#endif // __UCL_MISC_VARIANT_H__ diff --git a/ucl/inc/ucl/mvp/GuiPresenter.h b/ucl/inc/ucl/mvp/GuiPresenter.h deleted file mode 100644 index 5a94af4..0000000 --- a/ucl/inc/ucl/mvp/GuiPresenter.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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 __UCL_MVP_GUI_PRESENTER_H__ -#define __UCL_MVP_GUI_PRESENTER_H__ - -#include <unordered_set> - -#include "ucl/gui/Window.h" - -#include "types.h" - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(GuiPresenter); - - class GuiPresenter : public RefCountAware { - public: - struct DeactivatorInfo final { - const void *deactivator; - bool isBroadcast; - }; - - public: - bool isActive() const; - bool isDeactivatedBy(const void *deactivator) const; - - void activateBy(const void *deactivator); - void deactivateBy(const void *deactivator); - - void addDeactivatorSource(Widget &source); - void delDeactivatorSource(Widget &source); - - protected: - enum { - PF_ADD_DEACTIVATOR_SOURCES = 1, - PF_ADD_SELF_EXCEPT = 2, - - PF_PASSIVE = 0, - PF_DEACTIVATOR = (PF_ADD_DEACTIVATOR_SOURCES | PF_ADD_SELF_EXCEPT), - PF_DEFAULT = PF_ADD_DEACTIVATOR_SOURCES - }; - - protected: - GuiPresenter(IRefCountObj &rc); - virtual ~GuiPresenter(); - - Result prepare(ElmWidget &widget, int flags = PF_DEFAULT); - Result prepare(GuiPresenter &parent, int flags = PF_DEFAULT); - - Window &getWindow(); - bool isWindowReady() const; - - void addDeactivatorException(const void *deactivator); - void setDeactivatorSink(const WidgetSRef &sink); - - void sendActivate(Widget &sender); - void sendDeactivate(Widget &sender); - - void broadcastActivate(); - void broadcastDeactivate(); - - virtual void onActivate(); - virtual void onDeactivate(); - virtual void onActivateBy(const DeactivatorInfo &info); - virtual void onDeactivateBy(const DeactivatorInfo &info); - - private: - void sendDeactivator(Widget &sender, - SmartEvent event, const void *deactivator); - void broadcastDeactivator(SmartEvent event, - const void *deactivator); - - void sendDeactivatorInfo(Widget &sender, SmartEvent event, - const DeactivatorInfo &info); - - void activateByImpl(const DeactivatorInfo &info); - void deactivateByImpl(const DeactivatorInfo &info); - - void onActivateBySmart(Widget &widget, void *eventInfo); - void onDeactivateBySmart(Widget &widget, void *eventInfo); - - private: - std::unordered_set<const void *> m_deactivatorExceptions; - std::unordered_set<const void *> m_deactivators; - WindowSRef m_window; - WidgetSRef m_sink; - WidgetWRef m_parentSink; - bool m_hasBuildInSources; - bool m_isChild; - bool m_isPrepared; - }; -} - -#endif // __UCL_MVP_GUI_PRESENTER_H__ diff --git a/ucl/inc/ucl/mvp/ListItemPresenter.h b/ucl/inc/ucl/mvp/ListItemPresenter.h deleted file mode 100644 index 2c90f42..0000000 --- a/ucl/inc/ucl/mvp/ListItemPresenter.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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 __UCL_MVP_LIST_ITEM_PRESENTER_H__ -#define __UCL_MVP_LIST_ITEM_PRESENTER_H__ - -#include "ucl/gui/GenlistItem.h" - -#include "ucl/misc/HashMap.h" - -#include "types.h" - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(ListItemPresenter); - - class ListItemPresenter : public RefCountAware, - public IDisposable { - public: - // IDisposable // - - virtual void dispose() final override; - virtual bool isDisposed() const final override; - - protected: - friend class ListPresenter; - - UCL_DECLARE_REF_ALIASES(ItemClass); - UCL_DECLARE_REF_ALIASES(ItemClassCache); - - // Flags - enum { - PF_AUTO_UNSELECT = 1 - }; - - struct ItemInsertionParams { - ElmStyle itemStyle; - GenlistItem::Type itemType; - - ItemInsertionParams(ElmStyle itemStyle, - GenlistItem::Type itemType = GenlistItem::Type::SIMPLE) : - itemStyle(itemStyle), itemType(itemType) {} - }; - - class ItemClass final : public NonCopyable { - public: - static ItemClassSRef newInstance(ElmStyle itemStyle); - public: - Elm_Genlist_Item_Class *get(); - private: - friend class ReffedObj<ItemClass>; - ItemClass(ElmStyle itemStyle); - ~ItemClass(); - private: - Elm_Genlist_Item_Class *const m_itc; - }; - - class ItemClassCache final : public NonCopyable { - public: - ItemClassSRef getItemClass(ElmStyle itemStyle); - void purge(); - private: - HashMap<ElmStyle, ItemClassSRef> m_itcMap; - }; - - protected: - ListItemPresenter(IRefCountObj &rc); - virtual ~ListItemPresenter(); - - void setFlags(int flags); - int getFlags() const; - - bool isActive() const; - - GenlistItem getItem(); - ItemClassCacheSRef getItemClassCache(); - - Result updateItemStyle(ElmStyle newItemStyle); - - virtual ItemInsertionParams getItemInsertionParams() = 0; - - virtual void onItemAttached(); - virtual void onItemDetached(); - - virtual CString getItemPartText(EdjePart part); - virtual WidgetSRef getItemPartContent(EdjePart part); - virtual bool getItemPartState(EdjePart part); - - virtual void onItemSelected(); - virtual void onItemRealized(); - virtual void onItemUnrealized(); - virtual void onItemHighlighted(); - virtual void onItemUnhighlighted(); - - private: - void attachItem(GenlistItem item, - const ItemClassCacheSRef &itcCache, - const SharedRef<bool> &isActiveRef); - - void deleteDetachedItem(bool silent = false); - void detachItem(bool silent = false); - - void onItemSelectedHook(); - void onItemDel(Evas_Object *obj, void *eventInfo); - - private: - ListItemPresenterSRef m_selfRef; - GenlistItem m_item; - ItemClassCacheWRef m_itcCache; - SharedRef<bool> m_isActiveRef; - int m_flags; - }; -} - -#endif // __UCL_MVP_LIST_ITEM_PRESENTER_H__ diff --git a/ucl/inc/ucl/util/delegation/Callback.h b/ucl/inc/ucl/util/delegation/Callback.h deleted file mode 100644 index 69724be..0000000 --- a/ucl/inc/ucl/util/delegation/Callback.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 __UCL_UTIL_DELEGATION_CALLBACK_H__ -#define __UCL_UTIL_DELEGATION_CALLBACK_H__ - -#include "ucl/util/types/baseTypes.h" - -namespace ucl { - - template <class FUNC_SIG> - class Callback; - - template <class R, class ...ARGS> - class Callback<R(ARGS...)> { - public: - using StubA = R(*)(void *, ARGS...); - using StubB = R(*)(ARGS..., void *); - - public: - template <class CLASS, R(CLASS::*METHOD)(ARGS...)> - static R stubA(void *data, ARGS ...args); - template <class CLASS, R(CLASS::*METHOD)(ARGS...)> - static R stubB(ARGS ...args, void *data); - - template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> - static R stubA(void *data, ARGS ...args); - template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> - static R stubB(ARGS ...args, void *data); - - template <class CLASS, R(*FUNC)(CLASS &, ARGS...)> - static R stubA2A(void *data, ARGS ...args); - template <class CLASS, R(*FUNC)(CLASS &, ARGS...)> - static R stubB2A(ARGS ...args, void *data); - - template <class CLASS, R(*FUNC)(ARGS..., CLASS &)> - static R stubA2B(void *data, ARGS ...args); - template <class CLASS, R(*FUNC)(ARGS..., CLASS &)> - static R stubB2B(ARGS ...args, void *data); - - template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)> - static R stubA2A(void *data, ARGS ...args); - template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)> - static R stubB2A(ARGS ...args, void *data); - - template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)> - static R stubA2B(void *data, ARGS ...args); - template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)> - static R stubB2B(ARGS ...args, void *data); - - template <R(*FUNC)(ARGS...)> - static R stubA2V(void *data, ARGS ...args); - template <R(*FUNC)(ARGS...)> - static R stubB2V(ARGS ...args, void *data); - }; -} - -#include "Callback.hpp" - -#endif // __UCL_UTIL_DELEGATION_CALLBACK_H__ diff --git a/ucl/inc/ucl/util/delegation/Delegate.h b/ucl/inc/ucl/util/delegation/Delegate.h deleted file mode 100644 index e1e7416..0000000 --- a/ucl/inc/ucl/util/delegation/Delegate.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 __UCL_UTIL_DELEGATION_DELEGATE_H__ -#define __UCL_UTIL_DELEGATION_DELEGATE_H__ - -#include "BaseDelegate.h" - -namespace ucl { - - template <class FUNC_SIG> - class Delegate; - - template <class R, class ...ARGS> - class Delegate<R(ARGS...)> : public BaseDelegate<R(ARGS...), void *> { - public: - using BaseDelegate<R(ARGS...), void *>::BaseDelegate; - - R operator()(ARGS ...args) const; - - template <class CLASS, R(CLASS::*METHOD)(ARGS...)> - static Delegate make(CLASS *data) noexcept; - template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> - static Delegate make(const CLASS *data) noexcept; - - template <class CLASS, R(*FUNC)(CLASS &, ARGS...)> - static Delegate makeA(CLASS &data) noexcept; - template <class CLASS, R(*FUNC)(ARGS..., CLASS &)> - static Delegate makeB(CLASS &data) noexcept; - - template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)> - static Delegate makeA(HANDLE data) noexcept; - template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)> - static Delegate makeB(HANDLE data) noexcept; - - template <R(*FUNC)(ARGS...)> - static Delegate make() noexcept; - }; -} - -#include "Delegate.hpp" - -#endif // __UCL_UTIL_DELEGATION_DELEGATE_H__ diff --git a/ucl/inc/ucl/util/delegation/Delegate2.h b/ucl/inc/ucl/util/delegation/Delegate2.h deleted file mode 100644 index 56ff3fb..0000000 --- a/ucl/inc/ucl/util/delegation/Delegate2.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 __UCL_UTIL_DELEGATION_DELEGATE2_H__ -#define __UCL_UTIL_DELEGATION_DELEGATE2_H__ - -#include "BaseDelegate2.h" - -namespace ucl { - - template <class FUNC_SIG> - class Delegate2; - - template <class R, class ...ARGS> - class Delegate2<R(ARGS...)> : public BaseDelegate2<R(ARGS...), void *> { - public: - using BaseDelegate2<R(ARGS...), void *>::BaseDelegate2; - - R operator()(ARGS ...args) const; - - template <class CLASS, R(CLASS::*METHOD)(ARGS...)> - static Delegate2 make(CLASS *data) noexcept; - template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> - static Delegate2 make(const CLASS *data) noexcept; - - template <class CLASS, R(*FUNC)(CLASS &, ARGS...)> - static Delegate2 makeA(CLASS &data) noexcept; - template <class CLASS, R(*FUNC)(ARGS..., CLASS &)> - static Delegate2 makeB(CLASS &data) noexcept; - - template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)> - static Delegate2 makeA(HANDLE data) noexcept; - template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)> - static Delegate2 makeB(HANDLE data) noexcept; - - template <R(*FUNC)(ARGS...)> - static Delegate2 make() noexcept; - }; -} - -#include "Delegate2.hpp" - -#endif // __UCL_UTIL_DELEGATION_DELEGATE2_H__ diff --git a/ucl/inc/ucl/util/delegation/macro.h b/ucl/inc/ucl/util/delegation/macro.h deleted file mode 100644 index 62bf88f..0000000 --- a/ucl/inc/ucl/util/delegation/macro.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 __UCL_UTIL_DELEGATION_MACRO_H__ -#define __UCL_UTIL_DELEGATION_MACRO_H__ - -// Helper macro to simplify use of AutoFuncSig template - -#define _UCL_AFS(DELEGATE, FUNC) \ - ::ucl::AutoFuncSig<DELEGATE, void *, decltype(&FUNC)> - -// Helper macro to automatically generate different delegate objects // - -#define _UCL_DELEGATE(DELEGATE, FUNC, DATA) (_UCL_AFS(DELEGATE, FUNC):: \ - Type::make<_UCL_AFS(DELEGATE, FUNC)::Data, &FUNC>(DATA)) - -#define _UCL_DELEGATE_A(DELEGATE, FUNC, DATA) (_UCL_AFS(DELEGATE, FUNC):: \ - Type::makeA<_UCL_AFS(DELEGATE, FUNC)::Data, &FUNC>(DATA)) - -#define _UCL_DELEGATE_V(DELEGATE, FUNC) \ - (::ucl::AutoFuncSig<DELEGATE, void, decltype(&FUNC)>::\ - Type::make<&FUNC>()) - -// Helper macro to automatically generate Delegate objects // - -#define UCL_DELEGATE(FUNC, DATA) _UCL_DELEGATE(::ucl::Delegate, FUNC, DATA) -#define UCL_DELEGATE_A(FUNC, DATA) _UCL_DELEGATE_A(::ucl::Delegate, FUNC, DATA) -#define UCL_DELEGATE_V(FUNC) _UCL_DELEGATE_V(::ucl::Delegate, FUNC) - -// Helper macro to automatically generate Delegate2 objects // - -#define UCL_DELEGATE2(FUNC, DATA) _UCL_DELEGATE(::ucl::Delegate2, FUNC, DATA) -#define UCL_DELEGATE2_A(FUNC, DATA) \ - _UCL_DELEGATE_A(::ucl::Delegate2, FUNC, DATA) -#define UCL_DELEGATE2_V(FUNC) _UCL_DELEGATE_V(::ucl::Delegate2, FUNC) - -// Helper macro to automatically generate Callback stubs // - -#define UCL_CALLBACK_A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC):: \ - Type::stubA<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>) -#define UCL_CALLBACK_B(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC):: \ - Type::stubB<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>) - -#define UCL_CALLBACK_A2A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC)::Type:: \ - stubA2A<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>) -#define UCL_CALLBACK_B2A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC)::Type:: \ - stubB2A<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>) - -#define UCL_CALLBACK_A2V(FUNC) (&::ucl::AutoFuncSig<::ucl::Callback, void, \ - decltype(&FUNC)>::Type::stubA2V<&FUNC>) -#define UCL_CALLBACK_B2V(FUNC) (&::ucl::AutoFuncSig<::ucl::Callback, void, \ - decltype(&FUNC)>::Type::stubB2V<&FUNC>) - -#endif // __UCL_UTIL_DELEGATION_MACRO_H__ diff --git a/ucl/inc/ucl/util/helpers.h b/ucl/inc/ucl/util/helpers.h deleted file mode 100644 index 87485b0..0000000 --- a/ucl/inc/ucl/util/helpers.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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 __UCL_UTIL_HELPERS_H__ -#define __UCL_UTIL_HELPERS_H__ - -#include "types/baseTypes.h" - -namespace ucl { - - constexpr Eina_Bool toEina(bool value); - - // "nz()" - "Not Zero" functions - // return "zValue" if "!value" is true - constexpr const char *nz(const char *value, const char *zValue = ""); - - // "ne()" - "Not Empty" functions - // return "eValue" if "isEmpty(value)" is true - constexpr const char *ne(const char *value, const char *eValue = nullptr); - - constexpr bool isEmpty(const char *value); - - template <class T> - constexpr auto isEmpty(const T &value) -> decltype(value.empty()) - { - return value.empty(); - } - - template <class T> - constexpr auto isEmpty(const T &value) -> decltype(value.isEmpty()) - { - return value.isEmpty(); - } - - template <class T> - constexpr auto isEmpty(const T &value) -> decltype(isEmpty(*value)) - { - return (!value || isEmpty(*value)); - } - - template <class T> - constexpr bool isNotEmpty(T &&value); - - template <class T> - constexpr bool isNotValid(T &&value); - - char *strDupSafe(const char *value); - int strCmpSafe(const char *lhs, const char *rhs); - - template <class T1, class T2> - inline auto dynamicCast(T2 &&src) -> decltype( - dynamic_cast<T1>(std::forward<T2>(src))) - { - return dynamic_cast<T1>(std::forward<T2>(src)); - } - - template <class T1, class T2> - inline auto constCast(T2 &&src) -> decltype( - const_cast<T1>(std::forward<T2>(src))) - { - return const_cast<T1>(std::forward<T2>(src)); - } - - template <class T> - constexpr const T &min(const T &a, const T &b); - - template <class T> - constexpr const T &max(const T &a, const T &b); - - template <class T> - constexpr bool isPot(T value) - { - return (((value - 1) & value) == 0); - } - - template <uint MULTIPLE, class T> - constexpr T ceilDiv(T value); - - template <uint MULTIPLE, class T> - constexpr typename std::enable_if<isPot(MULTIPLE), T>::type - roundUp(T value) - { - return ((value + (MULTIPLE - 1)) & ~static_cast<T>(MULTIPLE - 1)); - } - - template <uint MULTIPLE, class T> - constexpr typename std::enable_if<!isPot(MULTIPLE), T>::type - roundUp(T value) - { - return (ceilDiv<MULTIPLE>(value) * MULTIPLE); - } -} - -namespace ucl { namespace util { - - template <class T> - std::unique_ptr<T> makeUnique(T *p); -}} - -#include "helpers.hpp" - -#endif // __UCL_UTIL_HELPERS_H__ diff --git a/ucl/inc/ucl/util/memory/SharedRef.h b/ucl/inc/ucl/util/memory/SharedRef.h deleted file mode 100644 index 396d176..0000000 --- a/ucl/inc/ucl/util/memory/SharedRef.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 __UCL_UTIL_MEMORY_SHARED_REF_H__ -#define __UCL_UTIL_MEMORY_SHARED_REF_H__ - -#include "BaseRef.h" - -namespace ucl { - - template <class T> - class SharedRef final : public BaseRef<T> { - public: - template <class U> - friend void swap(SharedRef<U> &x, SharedRef<U> &y) noexcept; - - template <class T2, class U> - friend SharedRef<T2> staticRefCast(const SharedRef<U> &r) noexcept; - template <class T2, class U> - friend SharedRef<T2> dynamicRefCast(const SharedRef<U> &r) noexcept; - - public: - constexpr SharedRef() noexcept; - constexpr SharedRef(std::nullptr_t) noexcept; - - SharedRef(IRefCountObj *rc, T *ptr) noexcept; - SharedRef(IRefCountObj *rc, T *ptr, bool noRef) noexcept; - - SharedRef(const SharedRef<T> &r) noexcept; - template <class U> - SharedRef(const SharedRef<U> &r) noexcept; - - SharedRef(SharedRef<T> &&r) noexcept; - template <class U> - SharedRef(SharedRef<U> &&r) noexcept; - - ~SharedRef(); - - SharedRef<T> &operator=(SharedRef<T> r) noexcept; - - void reset() noexcept; - - T *get() const noexcept; - operator bool() const noexcept; - - T *operator->() const noexcept; - typename std::add_lvalue_reference<T>::type operator*() const noexcept; - - template <class U, class = typename std::enable_if< - std::is_convertible<T *, U *>::value && ( - std::is_same<typename std::remove_cv<U>::type, void>::value || - std::is_same<typename std::remove_cv<U>::type, - typename std::remove_cv<T>::type>::value)>::type> - operator const SharedRef<U> &() const noexcept - { - return reinterpret_cast<const SharedRef<U> &>(*this); - } - }; - - // Non-member functions // - - template <class T, class ...ARGS> - SharedRef<T> makeShared(ARGS &&...args); - template <class T, class ...ARGS> - SharedRef<T> makeSharedMT(ARGS &&...args); - - template <class T, class U> - const SharedRef<T> &constRefCast(const SharedRef<U> &r) noexcept; - template <class T, class U> - SharedRef<T> &&constRefCast(SharedRef<U> &&r) noexcept; -} - -#include "SharedRef.hpp" - -#endif // __UCL_UTIL_MEMORY_SHARED_REF_H__ diff --git a/ucl/inc/ucl/util/memory/WeakRef.h b/ucl/inc/ucl/util/memory/WeakRef.h deleted file mode 100644 index 4cccbe6..0000000 --- a/ucl/inc/ucl/util/memory/WeakRef.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 __UCL_UTIL_MEMORY_WEAK_REF_H__ -#define __UCL_UTIL_MEMORY_WEAK_REF_H__ - -#include "SharedRef.h" - -namespace ucl { - - template <class T> - class WeakRef final : public BaseRef<T> { - public: - template <class U> - friend void swap(WeakRef<U> &x, WeakRef<U> &y) noexcept; - - template <class T2, class U> - friend WeakRef<T2> staticRefCast(const WeakRef<U> &r) noexcept; - template <class T2, class U> - friend WeakRef<T2> dynamicRefCast(const WeakRef<U> &r) noexcept; - - public: - constexpr WeakRef() noexcept; - constexpr WeakRef(std::nullptr_t) noexcept; - - WeakRef(IRefCountObj *rc, T *ptr) noexcept; - - WeakRef(const WeakRef<T> &r) noexcept; - template <class U> - WeakRef(const BaseRef<U> &r) noexcept; - - WeakRef(WeakRef<T> &&r) noexcept; - template <class U> - WeakRef(WeakRef<U> &&r) noexcept; - - ~WeakRef(); - - WeakRef<T> &operator=(WeakRef<T> r) noexcept; - - void reset() noexcept; - - SharedRef<T> lock() const noexcept; - - T *getUnsafePtr() const noexcept; - operator bool() const noexcept; - - template <class U, class = typename std::enable_if< - std::is_convertible<T *, U *>::value && ( - std::is_same<typename std::remove_cv<U>::type, void>::value || - std::is_same<typename std::remove_cv<U>::type, - typename std::remove_cv<T>::type>::value)>::type> - operator const WeakRef<U> &() const noexcept - { - return reinterpret_cast<const WeakRef<U> &>(*this); - } - }; - - // Non-member functions // - - template <class T> - WeakRef<T> makeWeak(const SharedRef<T> &r) noexcept; - - template <class T, class U> - const WeakRef<T> &constRefCast(const WeakRef<U> &r) noexcept; - template <class T, class U> - WeakRef<T> &&constRefCast(WeakRef<U> &&r) noexcept; -} - -#include "WeakRef.hpp" - -#endif // __UCL_UTIL_MEMORY_WEAK_REF_H__ diff --git a/ucl/inc/ucl/util/memory/helpers.h b/ucl/inc/ucl/util/memory/helpers.h deleted file mode 100644 index bef907b..0000000 --- a/ucl/inc/ucl/util/memory/helpers.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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 __UCL_UTIL_MEMORY_HELPERS_H__ -#define __UCL_UTIL_MEMORY_HELPERS_H__ - -namespace ucl { - - // Generic casting functions // - - template <class T, class U> - inline auto dynamicCast(const U &src) noexcept -> decltype( - dynamicRefCast<typename T::Type>(src)) - { - return dynamicRefCast<typename T::Type>(src); - } - - template <class T, class U> - inline auto constCast(U &&src) noexcept -> decltype( - constRefCast<typename T::Type>(std::forward<U>(src))) - { - return constRefCast<typename T::Type>(std::forward<U>(src)); - } - - // Relation operators // - - namespace himpl { - - template <class T, class = typename std::enable_if< - !std::is_base_of<BaseRef<typename T::Type>, T>::value>::type> - inline const T &getCmpPtr(const T &ptr) noexcept - { - return ptr; - } - - template <class T> - inline T *getCmpPtr(const SharedRef<T> &r) noexcept - { - return r.get(); - } - - template <class T> - inline T *getCmpPtr(const WeakRef<T> &r) noexcept - { - return r.getUnsafePtr(); - } - } - - template <class T, class U, class = typename std::enable_if< - std::is_base_of<BaseRef<typename T::Type>, T>::value || - std::is_base_of<BaseRef<typename U::Type>, U>::value>::type> - inline bool operator==(const T &lhs, const U &rhs) noexcept - { - return (himpl::getCmpPtr(lhs) == himpl::getCmpPtr(rhs)); - } - - template <class T, class U, class = typename std::enable_if< - std::is_base_of<BaseRef<typename T::Type>, T>::value || - std::is_base_of<BaseRef<typename U::Type>, U>::value>::type> - inline bool operator!=(const T &lhs, const U &rhs) noexcept - { - return (himpl::getCmpPtr(lhs) != himpl::getCmpPtr(rhs)); - } - - template <class T, class U, class = typename std::enable_if< - std::is_base_of<BaseRef<typename T::Type>, T>::value || - std::is_base_of<BaseRef<typename U::Type>, U>::value>::type> - inline bool operator<(const T &lhs, const U &rhs) noexcept - { - return (himpl::getCmpPtr(lhs) < himpl::getCmpPtr(rhs)); - } - - template <class T, class U, class = typename std::enable_if< - std::is_base_of<BaseRef<typename T::Type>, T>::value || - std::is_base_of<BaseRef<typename U::Type>, U>::value>::type> - inline bool operator<=(const T &lhs, const U &rhs) noexcept - { - return (himpl::getCmpPtr(lhs) <= himpl::getCmpPtr(rhs)); - } - - template <class T, class U, class = typename std::enable_if< - std::is_base_of<BaseRef<typename T::Type>, T>::value || - std::is_base_of<BaseRef<typename U::Type>, U>::value>::type> - inline bool operator>(const T &lhs, const U &rhs) noexcept - { - return (himpl::getCmpPtr(lhs) > himpl::getCmpPtr(rhs)); - } - - template <class T, class U, class = typename std::enable_if< - std::is_base_of<BaseRef<typename T::Type>, T>::value || - std::is_base_of<BaseRef<typename U::Type>, U>::value>::type> - inline bool operator>=(const T &lhs, const U &rhs) noexcept - { - return (himpl::getCmpPtr(lhs) >= himpl::getCmpPtr(rhs)); - } - - template <class T, class = typename std::enable_if< - std::is_base_of<BaseRef<typename T::Type>, T>::value>::type> - inline bool operator==(const T &lhs, std::nullptr_t rhs) noexcept - { - return !lhs; - } - - template <class T, class = typename std::enable_if< - std::is_base_of<BaseRef<typename T::Type>, T>::value>::type> - bool operator==(std::nullptr_t lhs, const T &rhs) noexcept - { - return !rhs; - } - - template <class T, class = typename std::enable_if< - std::is_base_of<BaseRef<typename T::Type>, T>::value>::type> - bool operator!=(const T &lhs, std::nullptr_t rhs) noexcept - { - return lhs; - } - - template <class T, class = typename std::enable_if< - std::is_base_of<BaseRef<typename T::Type>, T>::value>::type> - bool operator!=(std::nullptr_t lhs, const T &rhs) noexcept - { - return rhs; - } -} - -#endif // __UCL_UTIL_MEMORY_HELPERS_H__ diff --git a/ucl/inc/ucl/util/smartDelegation/WeakDelegate.h b/ucl/inc/ucl/util/smartDelegation/WeakDelegate.h deleted file mode 100644 index 97e1ae8..0000000 --- a/ucl/inc/ucl/util/smartDelegation/WeakDelegate.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__ -#define __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__ - -#include "ucl/util/delegation.h" -#include "ucl/util/memory.h" - -namespace ucl { - - template <class FUNC_SIG> - class WeakDelegate; - - template <class R, class ...ARGS> - class WeakDelegate<R(ARGS...)> : - public BaseDelegate<R(ARGS...), WeakRef<void>> { - public: - using BaseDelegate<R(ARGS...), WeakRef<void>>::BaseDelegate; - - R operator()(ARGS ...args) const; - - template <class CLASS, R(CLASS::*METHOD)(ARGS...)> - static WeakDelegate make(const WeakRef<CLASS> &data) noexcept; - - template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> - static WeakDelegate make(const WeakRef<const CLASS> &data) noexcept; - }; -} - -#include "WeakDelegate.hpp" - -#endif // __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__ diff --git a/ucl/inc/ucl/util/types/classTypes.h b/ucl/inc/ucl/util/types/classTypes.h deleted file mode 100644 index 5c708d2..0000000 --- a/ucl/inc/ucl/util/types/classTypes.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 __UCL_UTIL_TYPES_CLASS_TYPES_H__ -#define __UCL_UTIL_TYPES_CLASS_TYPES_H__ - -#include "baseTypes.h" - -namespace ucl { - - class NonCopyable { - public: - NonCopyable(const NonCopyable &) = delete; - NonCopyable &operator=(const NonCopyable &) = delete; - protected: - NonCopyable() = default; - ~NonCopyable() = default; - }; - - class Polymorphic : public NonCopyable { - protected: - Polymorphic() = default; - virtual ~Polymorphic() = default; - }; - - class IDisposable : public Polymorphic { - public: - virtual void dispose() = 0; - virtual bool isDisposed() const = 0; - protected: - virtual ~IDisposable() = default; - }; - - template <class IPRODUCT> - class IFactory : public Polymorphic { - public: - using IProduct = IPRODUCT; - public: - virtual IPRODUCT *newInstance() const = 0; - protected: - virtual ~IFactory() = default; - }; - - template <class PRODUCT, class IPRODUCT> - class Factory final : public IFactory<IPRODUCT> { - public: - using Product = PRODUCT; - public: - virtual IPRODUCT *newInstance() const final override - { - return new PRODUCT(); - } - }; - - // Priority selector for SFINAE functions - template <int N> - struct P : P<N - 1> {}; - template <> - struct P<0> {}; -} - -#endif // __UCL_UTIL_TYPES_CLASS_TYPES_H__ diff --git a/ucl/include/ucl/appfw/IInstance.h b/ucl/include/ucl/appfw/IInstance.h new file mode 100644 index 0000000..bef5fc9 --- /dev/null +++ b/ucl/include/ucl/appfw/IInstance.h @@ -0,0 +1,67 @@ +/* + * 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 __UCL_APPFW_I_INSTANCE_H__ +#define __UCL_APPFW_I_INSTANCE_H__ + +#include "IInstanceContext.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(IInstance); + + /** + * @brief Abstract interface for the application instances + * @details Instance is an object inside the application executable that + * represents it. UIApp may have only 1 instance per application. + * Other types of applications (widget) may have more that one + * instance (or none) in a single executable. + */ + class IInstance : protected NonCopyable { + public: + /** + * @brief Called when instance is created. + * @details This function is called when instance gets created. + * Implementation must allocate all global resources in this + * function. For UIApp function called in app's "create" cb. + * @param[in] context Pointer to the context of this instance + * @return RES_OK on success, + * otherwise other result + */ + virtual Result onCreate(IInstanceContext *context) = 0; + + /** + * @brief Called when instance is paused + * @details For UIApp function called in app's "pause" cb. + */ + virtual void onPause() = 0; + + /** + * @brief Called when instance is resumed + * @details For UIApp function called in app's "resume" cb. + */ + virtual void onResume() = 0; + + protected: + /** + * @brief Destructor + * @details Deallocate all resources here + */ + ~IInstance() = default; + }; +} + +#endif // __UCL_APPFW_I_INSTANCE_H__ diff --git a/ucl/inc/ucl/appfw/IInstanceAppControlExt.h b/ucl/include/ucl/appfw/IInstanceAppControlExt.h index 6799a84..02a211b 100644 --- a/ucl/inc/ucl/appfw/IInstanceAppControlExt.h +++ b/ucl/include/ucl/appfw/IInstanceAppControlExt.h @@ -21,9 +21,24 @@ namespace ucl { - class IInstanceAppControlExt : public Polymorphic { + /** + * @brief Extension interface for instances that supports processing of app + * controll requests. + */ + class IInstanceAppControlExt : protected NonCopyable { public: + /** + * @brief Called to process an app control request. + * @details For UIApp function called in app's "app_control" cb. + * @param[in] appControl App control request to process + */ virtual void onAppControl(app_control_h appControl) = 0; + + protected: + /** + * @brief Destructor + */ + ~IInstanceAppControlExt() = default; }; } diff --git a/ucl/include/ucl/appfw/IInstanceContext.h b/ucl/include/ucl/appfw/IInstanceContext.h new file mode 100644 index 0000000..c67d954 --- /dev/null +++ b/ucl/include/ucl/appfw/IInstanceContext.h @@ -0,0 +1,58 @@ +/* + * 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 __UCL_APPFW_I_INSTANCE_CONTEXT_H__ +#define __UCL_APPFW_I_INSTANCE_CONTEXT_H__ + +#include "types.h" + +#include "ucl/gui/Window.h" + +namespace ucl { + + /** + * @brief Abstract interface for the instance context. + * @details Instance context allows an instance to communicate with the + * application + */ + class IInstanceContext : protected NonCopyable { + public: + /** + * @brief Gets type of the application + * @return The application type + */ + virtual AppType getAppType() const = 0; + + /** + * @brief Gets window of the instance + * @return Window object of the instance + */ + virtual WindowSRef getWindow() = 0; + + /** + * @brief Singals to the application to terminate + */ + virtual void exitApp() = 0; + + protected: + /** + * @brief Destructor + */ + ~IInstanceContext() = default; + }; +} + +#endif // __UCL_APPFW_I_INSTANCE_CONTEXT_H__ diff --git a/ucl/inc/ucl/appfw/InstanceManagerBase.h b/ucl/include/ucl/appfw/InstanceManagerBase.h index 0fdde8c..aaa894a 100644 --- a/ucl/inc/ucl/appfw/InstanceManagerBase.h +++ b/ucl/include/ucl/appfw/InstanceManagerBase.h @@ -22,18 +22,49 @@ namespace ucl { - class InstanceManagerBase : public Polymorphic { + /** + * @brief Base class for implementing instance manager + * @details Instance manager is class that is used by the application + * class (UIApp) to create instances. + */ + class InstanceManagerBase : protected NonCopyable { public: - InstanceManagerBase(AppParams appParams); - virtual ~InstanceManagerBase(); - + /** + * @brief Gets customization parameters for the application + * @return Reference to the parameters object + */ const AppParams &getAppParams() const; + /** + * @brief Stores systems event provider in the manager + * @param[in] provider Unique pointer to system event provider object + */ void setSysEventProvider(SysEventProviderUPtr provider); + /** + * @brief Creates new application instance object + * @return Shared reference to the new instance + */ virtual IInstanceSRef newInstance() const = 0; protected: + /** + * @brief Constructor + * @param[in] appParams Customization parameters for the application + */ + InstanceManagerBase(AppParams appParams); + + /** + * @brief Destructor + */ + ~InstanceManagerBase(); + + /** + * @brief Gets system event provider that was stored in the manager + * @details If system event provider was not stored before using this + * function runtime assert is performed + * @return Reference to the stored system event provider + */ SysEventProvider &getSysEventProvider() const; private: diff --git a/ucl/inc/ucl/appfw/SysEventProvider.h b/ucl/include/ucl/appfw/SysEventProvider.h index 8a72758..45a65b1 100644 --- a/ucl/inc/ucl/appfw/SysEventProvider.h +++ b/ucl/include/ucl/appfw/SysEventProvider.h @@ -26,19 +26,45 @@ namespace ucl { class SysEventProvider; using SysEventProviderUPtr = std::unique_ptr<SysEventProvider>; - class SysEventProvider final : public NonCopyable { + /** + * @brief Provider for system events. + */ + class SysEventProvider final : protected NonCopyable { public: + /** + * @brief Pointer to function that adds Tizen system event handler + */ using EventHandlerAddFunc = int (*)(app_event_handler_h *, app_event_type_e, app_event_cb, void *); + + /** + * @brief Pointer to function that deletes Tizen system event handler + */ using EventHandlerDelFunc = int (*)(app_event_handler_h); public: + /** + * @brief Constructor + * @param[in] addFunc Tizen API for adding system event handler + * @param[in] delFunc Tizen API for deleting system event handler + */ SysEventProvider(EventHandlerAddFunc addFunc, EventHandlerDelFunc delFunc); + + /** + * @brief Destructor + */ ~SysEventProvider(); - void addEventHandler(const SysEventHandler &handler); - void delEventHandler(const SysEventHandler &handler); + /** + * @brief Registers system event handler + */ + void addEventHandler(SysEventHandler handler); + + /** + * @brief Deregisters system event handler + */ + void delEventHandler(SysEventHandler::CDRef handler); private: int addEventHandler(app_event_handler_h *handler, diff --git a/ucl/inc/ucl/appfw/SysEventProvider.hpp b/ucl/include/ucl/appfw/SysEventProvider.hpp index 1d52394..d38039f 100644 --- a/ucl/inc/ucl/appfw/SysEventProvider.hpp +++ b/ucl/include/ucl/appfw/SysEventProvider.hpp @@ -17,13 +17,13 @@ namespace ucl { inline void SysEventProvider::addEventHandler( - const SysEventHandler &handler) + SysEventHandler handler) { - m_event += handler; + m_event += std::move(handler); } inline void SysEventProvider::delEventHandler( - const SysEventHandler &handler) + SysEventHandler::CDRef handler) { m_event -= handler; } diff --git a/ucl/inc/ucl/appfw/UIApp.h b/ucl/include/ucl/appfw/UIApp.h index a8b4dbc..39afee8 100644 --- a/ucl/inc/ucl/appfw/UIApp.h +++ b/ucl/include/ucl/appfw/UIApp.h @@ -23,11 +23,33 @@ namespace ucl { + /** + * @brief Represent Tizen UI application. + * @details Root object of any application. + */ class UIApp final : private IInstanceContext { public: + /** + * @brief Constructor + * @param[in] instanceMgr Reference to the instance manager + */ UIApp(InstanceManagerBase &instanceMgr); - virtual ~UIApp(); + /** + * @brief Destructor + */ + ~UIApp(); + + /** + * @brief Runs the application + * @details Must be run in the application "main()" function + * @param[in] argc Count of command line arguments + * (must be passed from "main()"") + * @param[in] argv Array of command line arguments + * (must be passed from "main()"") + * @return 0 on success, + * otherwise a negative error value + */ int run(int argc, char *argv[]); private: diff --git a/ucl/inc/ucl/appfw/helpers.h b/ucl/include/ucl/appfw/helpers.h index fe598d9..dbb850c 100644 --- a/ucl/inc/ucl/appfw/helpers.h +++ b/ucl/include/ucl/appfw/helpers.h @@ -21,6 +21,12 @@ namespace ucl { + /** + * @brief Generates full path to the resource file. + * @param[in] relativePath Relative (to the "res" folder) path of the + * resource file (without leading "/") + * @return Full path to the resource file + */ std::string getResPath(const char *relativePath); } diff --git a/ucl/inc/ucl/appfw/types.h b/ucl/include/ucl/appfw/types.h index 48f8adc..8268e57 100644 --- a/ucl/inc/ucl/appfw/types.h +++ b/ucl/include/ucl/appfw/types.h @@ -26,25 +26,37 @@ #include "ucl/misc/HashMap.h" #include "ucl/misc/Event.h" -#include "ucl/misc/AutoHandle.h" +#include "ucl/misc/AutoObject.h" namespace ucl { + /** + * @brief Enumeration of application types + */ enum class AppType { UI, WIDGET, WATCH }; + /** + * @brief Defines keys for the application customization parameters + */ enum class AppParam { BASE_SCALE, - ACCELERATION_PREFERENECE, + ACCELERATION_PREFERENCE, WINDOW_TYPE, - WINDOW_NAME + WINDOW_NAME, }; + /** + * @brief Application customization parameters + */ using AppParams = HashMap<AppParam, Variant>; + /** + * @brief Enumeration of system events + */ enum class SysEvent { LANGUAGE_CHANGED, REGION_FMT_CHANGED, @@ -55,9 +67,15 @@ namespace ucl { UPDATE_REQUESTED }; + /** + * @brief Delegate to handle system events + */ using SysEventHandler = WeakDelegate<void(SysEvent)>; - using AutoAppCtrl = AutoHandle<app_control_h, int, app_control_destroy>; + /** + * @brief Automatic handle to native Tizen app control + */ + using AppCtrlAuto = AutoObject<app_control_h, int, app_control_destroy>; } #endif // __UCL_APPFW_TYPES_H__ diff --git a/ucl/inc/ucl/config.h b/ucl/include/ucl/config.h index cd36042..cd36042 100644 --- a/ucl/inc/ucl/config.h +++ b/ucl/include/ucl/config.h diff --git a/ucl/include/ucl/gui/Atspi.h b/ucl/include/ucl/gui/Atspi.h new file mode 100644 index 0000000..56a0bf8 --- /dev/null +++ b/ucl/include/ucl/gui/Atspi.h @@ -0,0 +1,274 @@ +/* + * 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 __UCL_GUI_ATSPI_H__ +#define __UCL_GUI_ATSPI_H__ + +#include "types.h" + +#include "ucl/misc/Event.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(Atspi); + + /** + * @brief Provides Accessibility interface + */ + class Atspi final : private NonCopyable { + public: + /** + * @brief Gets the underlying Access object + * @param[in] atspi Reference to target atspi + * @return Pointer to the underlying Access object + */ + friend Elm_Interface_Atspi_Accessible *as_ao(Atspi &atspi); + + /** + * @brief Gets the underlying constant Access object + * @param[in] atspi Constant reference to target atspi + * @return Pointer to the underlying constant Access object + */ + friend const Elm_Interface_Atspi_Accessible *as_ao(const Atspi &atspi); + + public: + /** + * @brief Constructor + * @param[in] eo Underlying Access object of the Atspi + */ + explicit Atspi(Elm_Interface_Atspi_Accessible *ao); + + /** + * @brief Destructor + * @details Unregisters all Access object callbacks + */ + ~Atspi(); + + /** + * @brief Sets name + * @param[in] name New name + */ + void setName(const std::string &name); + + /** + * @brief Gets name + * @return Current name + */ + std::string getName() const; + + /** + * @brief Sets name callback + * @param[in] cb name callback + */ + void setNameCb(AtspiStringCb cb); + + /** + * @brief Sets description + * @param[in] description New description + */ + void setDescription(const std::string &description); + + /** + * @brief Gets description + * @return Current description + */ + std::string getDescription() const; + + /** + * @brief Sets description callback + * @param[in] cb description callback + */ + void setDescriptionCb(AtspiStringCb cb); + + /** + * @brief Sets translation domain + * @param[in] domain New translation domain + */ + void setTDomain(const std::string &domain); + + /** + * @brief Gets translation domain + * @return Current translation domain + */ + std::string getTDomain() const; + + /** + * @brief Sets reading information type mask + * @param[in] info New reading information type mask + */ + void setReadingInfo(Elm_Atspi_Reading_Info_Type_Mask info); + + /** + * @brief Gets reading information type mask + * @return Current reading information type mask + */ + Elm_Atspi_Reading_Info_Type_Mask getReadingInfo() const; + + /** + * @brief Sets role + * @param[in] role New role + */ + void setRole(Elm_Atspi_Role role); + + /** + * @brief Gets role + * @return Current role + */ + Elm_Atspi_Role getRole() const; + + /** + * @brief Sets higlightability status + * @param[in] value New higlightability status + */ + void setHighlightable(bool value); + + /** + * @brief Gets higlightability status + * @return Current higlightability status + */ + bool isHighlightable() const; + + /** + * @brief Makes this Access object highlighted + */ + void highlight(); + + /** + * @brief Makes this Access object not highlighted + */ + void unhighlight(); + + /** + * @brief Adds new relationship + * @param[in] type Type of the new relationship + * @param[in] relation Pointer to relation Access object + */ + void addRelationship(Elm_Atspi_Relation_Type type, + const Elm_Interface_Atspi_Accessible *relation); + + /** + * @brief Deletes exiting relationship + * @param[in] type Type of the exiting relationship + * @param[in] relation Pointer to relation Access object, + * or NULL for all relations of the type (optional) + */ + void delRelationship(Elm_Atspi_Relation_Type type, + const Elm_Interface_Atspi_Accessible *relation = nullptr); + + /** + * @brief Deletes all exiting relationships + */ + void clearRelationships(); + + /** + * @brief Adds key-value pair identifying widget extra attribute + * @param[in] key The string key to give extra information + * @param[in] value The string value to give extra information + */ + void addAttribute(const std::string &key, const std::string &value); + + /** + * @brief Removes all attributes in accessible object + */ + void clearAttributes(); + + /** + * @brief Registers gesture event handler + * @param[in] handler Handler of the event + */ + void addGestureHandler(AtspiGestureHandler handler); + + /** + * @brief Deregisters gesture event handler + * @param[in] handler Handler of the event + */ + void delGestureHandler(const AtspiGestureHandler &handler); + + private: + Elm_Interface_Atspi_Accessible *getAo(); + const Elm_Interface_Atspi_Accessible *getAo() const; + + void registerGestureCb(); + void registerNameCb(); + void registerDescriptionCb(); + + void unregisterGestureCb(); + void unregisterNameCb(); + void unregisterDescriptionCb(); + void unregisterAllCallbacks(); + + Eina_Bool onAtspiGesture( + Elm_Atspi_Gesture_Info gestureInfo, Evas_Object *obj); + char *onAtspiNameCb(Evas_Object *obj); + char *onAtspiDescriptionCb(Evas_Object *obj); + + private: + Elm_Interface_Atspi_Accessible *const m_ao; + + Event<AtspiGestureHandler> m_onGesture; + AtspiStringCb m_nameCb; + AtspiStringCb m_descriptionCb; + + bool m_isGestureCbRegistered; + bool m_isNameCbRegistered; + bool m_isDescriptionCbRegistered; + }; + + // Non-member functions // + + /** + * @brief Gets Access object from pointed object + * @param[in] ptr Target object pointer + * @return Pointer to Access object or NULL + */ + template <class T> + inline auto as_ao(const T &ptr) -> typename std::enable_if< + std::is_constructible<bool, T>::value, decltype(as_ao(*ptr))>::type + { + return (ptr ? as_ao(*ptr) : nullptr); + } + + /** + * @brief Gets Access object from iterator + * @param[in] it Target object iterator + * @return Pointer to Access object or NULL + */ + template <class T> + inline auto as_ao(const T &it) -> typename std::enable_if< + !std::is_constructible<bool, T>::value, decltype(as_ao(*it))>::type + { + return as_ao(*it); + } + + /** + * @brief Passes through original Access object pointer + * @param[in] ao Access object pointer + * @return Access object pointer + */ + Elm_Interface_Atspi_Accessible *as_ao(Elm_Interface_Atspi_Accessible *ao); + + /** + * @brief Passes through original constant Access object pointer + * @param[in] ao Constant Access object pointer + * @return Constant Access object pointer + */ + const Elm_Interface_Atspi_Accessible *as_ao( + const Elm_Interface_Atspi_Accessible *ao); +} + +#include "Atspi.hpp" + +#endif // __UCL_GUI_ATSPI_H__ diff --git a/ucl/include/ucl/gui/Atspi.hpp b/ucl/include/ucl/gui/Atspi.hpp new file mode 100644 index 0000000..9a6d732 --- /dev/null +++ b/ucl/include/ucl/gui/Atspi.hpp @@ -0,0 +1,282 @@ +/* + * 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/helpers.h" +#include "ucl/util/logging.h" + +namespace ucl { + + inline Atspi::Atspi(Elm_Interface_Atspi_Accessible *const ao) : + m_ao(ao), + m_isGestureCbRegistered(false), + m_isNameCbRegistered(false), + m_isDescriptionCbRegistered(false) + { + UCL_ASSERT(ao, "ao is NULL"); + } + + inline Atspi::~Atspi() + { + unregisterAllCallbacks(); + } + + inline Elm_Interface_Atspi_Accessible *Atspi::getAo() + { + return m_ao; + } + + inline const Elm_Interface_Atspi_Accessible *Atspi::getAo() const + { + return m_ao; + } + + inline void Atspi::setName(const std::string &name) + { + elm_atspi_accessible_name_set(getAo(), name.c_str()); + } + + inline std::string Atspi::getName() const + { + return nz(elm_atspi_accessible_name_get(getAo())); + } + + inline void Atspi::setNameCb(AtspiStringCb cb) + { + if (cb) { + registerNameCb(); + } + m_nameCb = std::move(cb); + } + + inline void Atspi::setDescription(const std::string &description) + { + elm_atspi_accessible_description_set(getAo(), description.c_str()); + } + + inline std::string Atspi::getDescription() const + { + return nz(elm_atspi_accessible_description_get(getAo())); + } + + inline void Atspi::setDescriptionCb(AtspiStringCb cb) + { + if (cb) { + registerDescriptionCb(); + } + m_descriptionCb = std::move(cb); + } + + inline void Atspi::setTDomain(const std::string &domain) + { + elm_atspi_accessible_translation_domain_set(getAo(), domain.c_str()); + } + + inline std::string Atspi::getTDomain() const + { + return nz(elm_atspi_accessible_translation_domain_get(getAo())); + } + + inline void Atspi::setReadingInfo( + const Elm_Atspi_Reading_Info_Type_Mask info) + { + elm_atspi_accessible_reading_info_type_set(getAo(), info); + } + + inline Elm_Atspi_Reading_Info_Type_Mask Atspi::getReadingInfo() const + { + return elm_atspi_accessible_reading_info_type_get(getAo()); + } + + inline void Atspi::setRole(const Elm_Atspi_Role role) + { + elm_atspi_accessible_role_set(getAo(), role); + } + + inline Elm_Atspi_Role Atspi::getRole() const + { + return elm_atspi_accessible_role_get(getAo()); + } + + inline void Atspi::setHighlightable(const bool value) + { + elm_atspi_accessible_can_highlight_set(getAo(), toEina(value)); + } + + inline bool Atspi::isHighlightable() const + { + return elm_atspi_accessible_can_highlight_get(getAo()); + } + + inline void Atspi::highlight() + { + elm_atspi_component_highlight_grab(getAo()); + } + + inline void Atspi::unhighlight() + { + elm_atspi_component_highlight_clear(getAo()); + } + + inline void Atspi::addRelationship(const Elm_Atspi_Relation_Type type, + const Elm_Interface_Atspi_Accessible *const relation) + { + elm_atspi_accessible_relationship_append(getAo(), type, relation); + } + + inline void Atspi::delRelationship(const Elm_Atspi_Relation_Type type, + const Elm_Interface_Atspi_Accessible *const relation) + { + elm_atspi_accessible_relationship_remove(getAo(), type, relation); + } + + inline void Atspi::clearRelationships() + { + elm_atspi_accessible_relationships_clear(getAo()); + } + + inline void Atspi::addAttribute(const std::string &key, + const std::string &value) + { + elm_atspi_accessible_attribute_append(getAo(), + key.c_str(), value.c_str()); + } + + inline void Atspi::clearAttributes() + { + elm_atspi_accessible_attributes_clear(getAo()); + } + + inline void Atspi::addGestureHandler(AtspiGestureHandler handler) + { + if (handler) { + registerGestureCb(); + m_onGesture += std::move(handler); + } + } + + inline void Atspi::delGestureHandler(const AtspiGestureHandler &handler) + { + m_onGesture -= handler; + } + + inline void Atspi::registerGestureCb() + { + if (!m_isGestureCbRegistered) { + m_isGestureCbRegistered = true; + elm_atspi_accessible_gesture_cb_set(m_ao, + UCL_CALLBACK_A(Atspi::onAtspiGesture), this); + } + } + + inline void Atspi::registerNameCb() + { + if (!m_isNameCbRegistered) { + m_isNameCbRegistered = true; + elm_atspi_accessible_name_cb_set(m_ao, + UCL_CALLBACK_A(Atspi::onAtspiNameCb), this); + } + } + + inline void Atspi::registerDescriptionCb() + { + if (!m_isDescriptionCbRegistered) { + m_isDescriptionCbRegistered = true; + elm_atspi_accessible_description_cb_set(m_ao, + UCL_CALLBACK_A(Atspi::onAtspiDescriptionCb), this); + } + } + + inline void Atspi::unregisterGestureCb() + { + if (m_isGestureCbRegistered) { + m_isGestureCbRegistered = false; + elm_atspi_accessible_gesture_cb_set(m_ao, nullptr, nullptr); + } + } + + inline void Atspi::unregisterNameCb() + { + if (m_isNameCbRegistered) { + m_isNameCbRegistered = false; + elm_atspi_accessible_name_cb_set(m_ao, nullptr, nullptr); + } + } + + inline void Atspi::unregisterDescriptionCb() + { + if (m_isDescriptionCbRegistered) { + m_isDescriptionCbRegistered = false; + elm_atspi_accessible_description_cb_set(m_ao, nullptr, nullptr); + } + } + + inline void Atspi::unregisterAllCallbacks() + { + unregisterGestureCb(); + unregisterNameCb(); + unregisterDescriptionCb(); + } + + inline Eina_Bool Atspi::onAtspiGesture( + Elm_Atspi_Gesture_Info gestureInfo, Evas_Object *obj) + { + AtspiGestureEventInfo eventInfo{gestureInfo}; + m_onGesture.dispatchPred( + [&eventInfo]() { return !eventInfo.stopPropagation; }, + *this, eventInfo); + return toEina(eventInfo.preventDefault); + } + + inline char *Atspi::onAtspiNameCb(Evas_Object *obj) + { + if (const auto cb = m_nameCb.lock()) { + return cb(*this).release(); + } + return nullptr; + } + + inline char *Atspi::onAtspiDescriptionCb(Evas_Object *obj) + { + if (const auto cb = m_descriptionCb.lock()) { + return cb(*this).release(); + } + return nullptr; + } + + // Non-member functions // + + inline Elm_Interface_Atspi_Accessible *as_ao(Atspi &atspi) + { + return atspi.m_ao; + } + + inline const Elm_Interface_Atspi_Accessible *as_ao(const Atspi &atspi) + { + return atspi.m_ao; + } + + inline Elm_Interface_Atspi_Accessible *as_ao( + Elm_Interface_Atspi_Accessible *const ao) + { + return ao; + } + + inline const Elm_Interface_Atspi_Accessible *as_ao( + const Elm_Interface_Atspi_Accessible *const ao) + { + return ao; + } +} diff --git a/ucl/include/ucl/gui/EdjeWidget.h b/ucl/include/ucl/gui/EdjeWidget.h new file mode 100644 index 0000000..da32501 --- /dev/null +++ b/ucl/include/ucl/gui/EdjeWidget.h @@ -0,0 +1,117 @@ +/* + * 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 __UCL_GUI_EDJE_WIDGET_H__ +#define __UCL_GUI_EDJE_WIDGET_H__ + +#include "ElmWidget.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(EdjeWidget); + + /** + * @brief Base class for all widgets that has Edje theme + */ + class EdjeWidget : public ElmWidget { + public: + /** + * @brief Sets text to default part + * @param[in] value Translatable text value to set + */ + void setText(const TString &value); + + /** + * @brief Sets text to specific part + * @param[in] value Translatable text value to set + * @param[in] part Destination Edje part + */ + void setText(const TString &value, EdjePart part); + + /** + * @brief Gets text from default part + * @return Translated text from default part + */ + std::string getText() const; + + /** + * @brief Gets text from specific part + * @param[in] part Source Edje part + * @return Translated text from specific part + */ + std::string getText(EdjePart part) const; + + /** + * @brief Sets content to default part + * @param[in] content Content widget + */ + void setContent(Widget &content); + + /** + * @brief Sets content to specific part + * @param[in] content Content widget + * @param[in] part Destination Edje part + */ + void setContent(Widget &content, EdjePart part); + + /** + * @brief Unsets content from default part + * @return Content Evas object or NULL + */ + Evas_Object *unsetContent(); + + /** + * @brief Unsets content from specific part + * @param[in] part Source Edje part + * @return content Evas object or NULL + */ + Evas_Object *unsetContent(EdjePart part); + + /** + * @brief Gets content from default part + * @return Content Evas object or NULL + */ + Evas_Object *getContent() const; + + /** + * @brief Gets content from specific part + * @param[in] part Source Edje part + * @return content Evas object or NULL + */ + Evas_Object *getContent(EdjePart part) const; + + /** + * @brief Emits signal to the widget's Edje theme + * @param[in] signal Emitted signal + * @param[in] signal Emitted signal source (optional) + */ + void emit(EdjeSignal signal, EdjeSignalSrc source = + EdjeSignalSrc("")); + + protected: + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + * @param[in] eo Underlying Evas object of the widget + * @param[in] isOwner Evas object ownership flag (optional: true) + */ + EdjeWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true); + }; +} + +#include "EdjeWidget.hpp" + +#endif // __UCL_GUI_EDJE_WIDGET_H__ diff --git a/ucl/inc/ucl/gui/EdjeWidget.hpp b/ucl/include/ucl/gui/EdjeWidget.hpp index 3f989c7..763808e 100644 --- a/ucl/inc/ucl/gui/EdjeWidget.hpp +++ b/ucl/include/ucl/gui/EdjeWidget.hpp @@ -22,25 +22,25 @@ namespace ucl { { } - inline TString EdjeWidget::getText() const + inline std::string EdjeWidget::getText() const { return elm_object_text_get(getEo()); } - inline TString EdjeWidget::getText(const EdjePart part) const + inline std::string EdjeWidget::getText(const EdjePart part) const { return elm_object_part_text_get(getEo(), part.name); } - inline void EdjeWidget::setContent(Evas_Object *const content) + inline void EdjeWidget::setContent(Widget &content) { - elm_object_content_set(getEo(), content); + elm_object_content_set(getEo(), as_eo(content)); } - inline void EdjeWidget::setContent(Evas_Object *const content, + inline void EdjeWidget::setContent(Widget &content, const EdjePart part) { - elm_object_part_content_set(getEo(), part.name, content); + elm_object_part_content_set(getEo(), part.name, as_eo(content)); } inline Evas_Object *EdjeWidget::unsetContent() diff --git a/ucl/include/ucl/gui/ElmWidget.h b/ucl/include/ucl/gui/ElmWidget.h new file mode 100644 index 0000000..a0e2d60 --- /dev/null +++ b/ucl/include/ucl/gui/ElmWidget.h @@ -0,0 +1,148 @@ +/* + * 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 __UCL_GUI_ELM_WIDGET_H__ +#define __UCL_GUI_ELM_WIDGET_H__ + +#include "Widget.h" +#include "Atspi.h" + +namespace ucl { + + class Window; + + UCL_DECLARE_REF_ALIASES(ElmWidget); + + /** + * @brief Represents Elementary widget and serves as base class for more + * concrete widget types + */ + class ElmWidget : public Widget { + public: + using Widget::Widget; + + /** + * @brief Gets Atspi of this widget + * @return Reference to the Atspi object + */ + Atspi &getAtspi(); + + /** + * @brief Gets Atspi of this widget (constant version) + * @return Reference to the constant Atspi object + */ + Atspi &getAtspi() const; + + /** + * @brief Sets enabled state of the widget + * @param[in] value New state + */ + void setEnabled(bool value); + + /** + * @brief Gets enabled state of the widget + * @return true if enabled, false if disabled + */ + bool isEnabled() const; + + /** + * @brief Sets if key-input focus is allowed for the widget + * @param[in] value New state + */ + void setFocusAllowed(bool value); + + /** + * @brief Gets if key-input focus is allowed for the widget + * @return true if allowed, false if not allowed + */ + bool isFocusAllowed() const; + + /** + * @brief Sets theme object to the widget + * @details This function does not affect look of this widget directly, + * instead it makes all styles from Theme visible to this + * widget and all it's children. + * @param[in] th Theme object to set + */ + void setTheme(Elm_Theme *th); + + /** + * @brief Gets theme object that assigned to the widget + * @return Assigned Theme object + */ + Elm_Theme *getTheme(); + + /** + * @brief Gets top level parent of the widget + * @return Top level Evas object + */ + Evas_Object *getTopWidget() const; + + /** + * @brief Tries to get top level parent of the widget as Window widget + * @return Window widget or NULL + */ + Window *getWindow() const; + + protected: + // Widget // + + virtual void setFocusedImpl(bool value) final override; + virtual bool isFocusedImpl() const final override; + + private: + void ensureAtspi(); + + private: + AtspiSRef m_atspi; + + friend class ReffedObj<ElmWidget>; + }; + + // Non-member functions // + + /** + * @brief Gets corresponding Access object + * @param[in] widget Reference to target widget + * @return Pointer to the corresponding Access object + */ + Elm_Interface_Atspi_Accessible *as_ao(ElmWidget &widget); + + /** + * @brief Gets corresponding constant Access object + * @param[in] widget Constant reference to target widget + * @return Pointer to the corresponding constant Access object + */ + const Elm_Interface_Atspi_Accessible *as_ao(const ElmWidget &widget); + + /** + * @brief Sets widget to enabled state + * @details This is equivalent to: widget.setEnabled(true); + * @param[in] widget Reference to target widget + */ + void enable(ElmWidget &widget); + + /** + * @brief Sets widget to disabled state + * @details This is equivalent to: widget.setEnabled(false); + * @param[in] widget Reference to target widget + */ + void disable(ElmWidget &widget); +} + +#include "ElmWidget.hpp" + +#endif // __UCL_GUI_ELM_WIDGET_H__ diff --git a/ucl/inc/ucl/gui/ElmWidget.hpp b/ucl/include/ucl/gui/ElmWidget.hpp index 0673a57..6fe586d 100644 --- a/ucl/inc/ucl/gui/ElmWidget.hpp +++ b/ucl/include/ucl/gui/ElmWidget.hpp @@ -16,9 +16,24 @@ namespace ucl { - inline ElmWidget::ElmWidget(Evas_Object *const eo, const bool isOwner) : - ElmWidget(nullptr, eo, isOwner) + inline Atspi &ElmWidget::getAtspi() { + ensureAtspi(); + return *m_atspi; + } + + inline Atspi &ElmWidget::getAtspi() const + { + // Need cast for lazy initialization. Can't use mutable. + const_cast<ElmWidget *>(this)->ensureAtspi(); + return *m_atspi; + } + + inline void ElmWidget::ensureAtspi() + { + if (!m_atspi) { + m_atspi = makeShared<Atspi>(getEo()); + } } inline void ElmWidget::setEnabled(const bool value) @@ -31,12 +46,12 @@ namespace ucl { return !elm_object_disabled_get(getEo()); } - inline void ElmWidget::setFocusAlowed(const bool value) + inline void ElmWidget::setFocusAllowed(const bool value) { elm_object_focus_allow_set(getEo(), toEina(value)); } - inline bool ElmWidget::isFocusAlowed() const + inline bool ElmWidget::isFocusAllowed() const { return elm_object_focus_allow_get(getEo()); } @@ -58,6 +73,16 @@ namespace ucl { // Non-member functions // + inline Elm_Interface_Atspi_Accessible *as_ao(ElmWidget &widget) + { + return as_ao(widget.getAtspi()); + } + + inline const Elm_Interface_Atspi_Accessible *as_ao(const ElmWidget &widget) + { + return as_ao(widget.getAtspi()); + } + inline void enable(ElmWidget &widget) { widget.setEnabled(true); diff --git a/ucl/include/ucl/gui/Genlist.h b/ucl/include/ucl/gui/Genlist.h new file mode 100644 index 0000000..3791d8f --- /dev/null +++ b/ucl/include/ucl/gui/Genlist.h @@ -0,0 +1,214 @@ +/* + * 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 __UCL_GUI_GENLIST_H__ +#define __UCL_GUI_GENLIST_H__ + +#include "StyledWidget.h" +#include "GenlistItem.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(Genlist); + + /** + * @brief Represents Elementary Genlist widget + */ + class Genlist final : public StyledWidget { + public: + /** + * @brief Enumeration of Genlist modes + */ + enum class Mode { + COMPRESS = ELM_LIST_COMPRESS, + SCROLL = ELM_LIST_SCROLL, + LIMIT = ELM_LIST_LIMIT, + EXPAND = ELM_LIST_EXPAND + }; + + /** + * @brief Builder of Genlist objects + */ + class Builder final { + public: + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets style of the future object + * @param[in] style Style of the future object + * @return Reference to this builder + */ + Builder &setStyle(ElmStyle style); + + /** + * @brief Sets mode of the future object + * @param[in] mode Mode of the future object + * @return Reference to this builder + */ + Builder &setMode(Mode mode); + + /** + * @brief Sets if future object will be homogeneous or not + * @param[in] value true if homogeneous, false - otherwise + * @return Reference to this builder + */ + Builder &setHomogeneous(bool value); + + /** + * @brief Sets Evas object ownership flag of the future object + * @param[in] value true if owner, false - otherwise + * @return Reference to this builder + */ + Builder &setIsOwner(bool value); + + /** + * @brief Sets if future object needs to be bind to it's Evas object + * @param[in] value true if need to bind, false - otherwise + * @return Reference to this builder + */ + Builder &setNeedBindToEo(bool value); + + /** + * @brief Creates new Genlist object using current parameters + * @param[in] parent Reference to parent widget + * @return Shared reference to new Genlist object or NULL + */ + GenlistSRef build(ElmWidget &parent) const; + + private: + ElmStyle m_style; + Mode m_mode; + bool m_isHomogeneous; + bool m_isOwner; + bool m_needBindToEo; + }; + + public: + using StyledWidget::StyledWidget; + + /** + * @brief Sets mode of the genlist + * @param[in] mode New mode of the genlist + */ + void setMode(Mode mode); + + /** + * @brief Gets mode of the genlist + * @return Current mode of the genlist + */ + Mode getMode() const; + + /** + * @brief Sets homogeneous flag of the genlist + * @param[in] mode New flag value + */ + void setHomogeneous(bool isHomogeneous); + + /** + * @brief Gets homogeneous flag of the genlist + * @return Current flag value + */ + bool isHomogeneous() const; + + /** + * @brief Updates all items that are realized + */ + void updateRealizedItems(); + + /** + * @brief Removes all items from the genlist + */ + void clear(); + + /** + * @brief Appends new item to the genlist + * @param[in] itc Item class of the future item + * @param[in] data Pointer to user data of the item + * @param[in] onSelect Convenience callback when item + * is selected (optional) + * @param[in] type Type of the future item + * (optional: GenlistItem::Type::SIMPLE) + * @param[in] parent Parent item for the future item (optional) + * @return New item + */ + GenlistItem append(const Elm_Genlist_Item_Class *itc, + const void *data, SmartCbHandler onSelect = nullptr, + GenlistItem::Type type = GenlistItem::Type::SIMPLE, + GenlistItem parent = nullptr); + + /** + * @brief Prepends new item to the genlist + * @param[in] itc Item class of the future item + * @param[in] data Pointer to user data of the item + * @param[in] onSelect Convenience callback when item + * is selected (optional) + * @param[in] type Type of the future item + * (optional: GenlistItem::Type::SIMPLE) + * @param[in] parent Parent item for the future item (optional) + * @return New item + */ + GenlistItem prepend(const Elm_Genlist_Item_Class *itc, + const void *data, SmartCbHandler onSelect = nullptr, + GenlistItem::Type type = GenlistItem::Type::SIMPLE, + GenlistItem parent = nullptr); + + /** + * @brief Inserts new item to the genlist after specific item + * @param[in] after Item after which future item will be inserted + * @param[in] itc Item class of the future item + * @param[in] data Pointer to user data of the item + * @param[in] onSelect Convenience callback when item + * is selected (optional) + * @param[in] type Type of the future item + * (optional: GenlistItem::Type::SIMPLE) + * @param[in] parent Parent item for the future item (optional) + * @return New item + */ + GenlistItem insertAfter(GenlistItem after, + const Elm_Genlist_Item_Class *itc, const void *data, + SmartCbHandler onSelect = nullptr, + GenlistItem::Type type = GenlistItem::Type::SIMPLE, + GenlistItem parent = nullptr); + + /** + * @brief Inserts new item to the genlist before specific item + * @param[in] before Item before which future item will be inserted + * @param[in] itc Item class of the future item + * @param[in] data Pointer to user data of the item + * @param[in] onSelect Convenience callback when item + * is selected (optional) + * @param[in] type Type of the future item + * (optional: GenlistItem::Type::SIMPLE) + * @param[in] parent Parent item for the future item (optional) + * @return New item + */ + GenlistItem insertBefore(GenlistItem before, + const Elm_Genlist_Item_Class *itc, const void *data, + SmartCbHandler onSelect = nullptr, + GenlistItem::Type type = GenlistItem::Type::SIMPLE, + GenlistItem parent = nullptr); + + private: + friend class ReffedObj<Genlist>; + }; +} + +#include "Genlist.hpp" + +#endif // __UCL_GUI_GENLIST_H__ diff --git a/ucl/inc/ucl/gui/Genlist.hpp b/ucl/include/ucl/gui/Genlist.hpp index d3cfed0..3c93031 100644 --- a/ucl/inc/ucl/gui/Genlist.hpp +++ b/ucl/include/ucl/gui/Genlist.hpp @@ -21,7 +21,7 @@ namespace ucl { inline Genlist::Builder::Builder() : m_mode(Mode::COMPRESS), m_isHomogeneous(true), - m_isOwner(false), + m_isOwner(true), m_needBindToEo(false) { } diff --git a/ucl/inc/ucl/gui/GenlistItem.h b/ucl/include/ucl/gui/GenlistItem.h index 2c96b9c..3de1517 100644 --- a/ucl/inc/ucl/gui/GenlistItem.h +++ b/ucl/include/ucl/gui/GenlistItem.h @@ -21,14 +21,27 @@ namespace ucl { + /** + * @brief Represents Elementary Genlist widget item + * @details This class has semantic of a pointer and therefore does not + * manage lifetime of the item. Pointer is always point to the non + * constant Genlist item. Most of the methods marked as const + * because pointer is not changed in these method calls. + */ class GenlistItem final : public WidgetItem { public: + /** + * @brief Enumeration of Genlist item types + */ enum class Type { SIMPLE = ELM_GENLIST_ITEM_NONE, TREE = ELM_GENLIST_ITEM_TREE, GROUP = ELM_GENLIST_ITEM_GROUP }; + /** + * @brief Enumeration of select modes for Genlist item + */ enum class SelectMode { DEFAULT = ELM_OBJECT_SELECT_MODE_DEFAULT, ALWAYS = ELM_OBJECT_SELECT_MODE_ALWAYS, @@ -36,6 +49,9 @@ namespace ucl { DISPLAY_ONLY = ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY }; + /** + * @brief Enumeration of update field flags + */ enum { FIELD_ALL = ELM_GENLIST_ITEM_FIELD_ALL, FIELD_TEXT = ELM_GENLIST_ITEM_FIELD_TEXT, @@ -46,14 +62,48 @@ namespace ucl { public: using WidgetItem::WidgetItem; + /** + * @brief Sets select mode of the genlist item + * @param[in] mode New select mode of the genlist item + */ void setSelectMode(SelectMode mode) const; + + /** + * @brief Gets select mode of the genlist item + * @return Current mode of the genlist item + */ SelectMode getSelectMode() const; + /** + * @brief Sets selected state of the genlist item + * @param[in] isSelected New select state of the genlist item + */ void setSelected(bool isSelected) const; + + /** + * @brief Gets selected state of the genlist item + * @return Current selected state of the genlist item + */ bool isSelected() const; + /** + * @brief Performs full update of the genlist item + */ void update() const; + + /** + * @brief Changes item class of the genlist item and + * performs full update + */ void update(const Elm_Genlist_Item_Class *newItc) const; + + /** + * @brief Update only specific parts and fields of the item + * @param[in] parts Globbing expresion to match a part name. + * Can include '*', '?', and '.' + * @param[in] fields Bitwise or of FILED_* enumeration + * (optional: FIELD_ALL) + */ void update(const char *parts, int fields = FIELD_ALL) const; }; } diff --git a/ucl/inc/ucl/gui/GenlistItem.hpp b/ucl/include/ucl/gui/GenlistItem.hpp index 6920a88..6920a88 100644 --- a/ucl/inc/ucl/gui/GenlistItem.hpp +++ b/ucl/include/ucl/gui/GenlistItem.hpp diff --git a/ucl/include/ucl/gui/Layout.h b/ucl/include/ucl/gui/Layout.h new file mode 100644 index 0000000..2a25de0 --- /dev/null +++ b/ucl/include/ucl/gui/Layout.h @@ -0,0 +1,132 @@ +/* + * 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 __UCL_GUI_LAYOUT_H__ +#define __UCL_GUI_LAYOUT_H__ + +#include "EdjeWidget.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(Layout); + + /** + * @brief Represents Elementary Layout widget + */ + class Layout : public EdjeWidget { + public: + /** + * @brief Builder of Layout objects + */ + class Builder final { + public: + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets layout theme of the future object + * @details EdjeFile property takes precedence over this property + * if both are set. + * @param[in] value Layout of the future object + * @return Reference to this builder + */ + Builder &setTheme(const LayoutTheme &value); + + /** + * @brief Sets edje file and group of the future object + * @details This property takes precedence over Theme property + * if both are set. + * @param[in] filePath Path to the Edje file + * @param[in] group Edje group to apply to the future object + * @return Reference to this builder + */ + Builder &setEdjeFile(std::string filePath, EdjeGroup group); + + /** + * @brief Sets Evas object ownership flag of the future object + * @param[in] value true if owner, false - otherwise + * @return Reference to this builder + */ + Builder &setIsOwner(bool value); + + /** + * @brief Sets if future object needs to be bind to it's Evas object + * @param[in] value true if need to bind, false - otherwise + * @return Reference to this builder + */ + Builder &setNeedBindToEo(bool value); + + /** + * @brief Creates new Layout object using current parameters + * @param[in] parent Reference to parent widget + * @return Shared reference to new Layout object or NULL + */ + LayoutSRef build(ElmWidget &parent) const; + + private: + LayoutTheme m_theme; + std::string m_edjeFilePath; + EdjeGroup m_edjeGroup; + bool m_isOwner; + bool m_needBindToEo; + }; + + public: + using ElmWidget::setTheme; + + /** + * @brief Constructor + * @param[in] eo Underlying Elementary Layout Evas object + * @param[in] isOwner Evas object ownership flag (optional: true) + */ + explicit Layout(Evas_Object *eo, bool isOwner = true); + + /** + * @brief Applies LayoutTheme to the layout + * @param[in] theme LayoutTheme to apply + * @return true on success, false on failure + */ + bool setTheme(const LayoutTheme &theme); + + /** + * @brief Applies edje file and group to the layout + * @param[in] filePath Path to the Edje file + * @param[in] group Edje group to apply to the layout + * @return true on success, false on failure + */ + bool setEdjeFile(const std::string &filePath, EdjeGroup group); + + /** + * @brief Gets data from Edje theme applied to the layout + * @param[in] key Edje data key of the data + * @return TYPE_STRING Variant value of the Edje data, + * or TYPE_NIL if not found + */ + Variant getData(EdjeDataKey key); + + protected: + using EdjeWidget::EdjeWidget; + + private: + friend class ReffedObj<Layout>; + }; +} + +#include "Layout.hpp" + +#endif // __UCL_GUI_LAYOUT_H__ diff --git a/ucl/inc/ucl/gui/Layout.hpp b/ucl/include/ucl/gui/Layout.hpp index e3df1db..d6d18a3 100644 --- a/ucl/inc/ucl/gui/Layout.hpp +++ b/ucl/include/ucl/gui/Layout.hpp @@ -19,7 +19,7 @@ namespace ucl { // Layout::Builder // inline Layout::Builder::Builder() : - m_isOwner(false), + m_isOwner(true), m_needBindToEo(false) { } diff --git a/ucl/include/ucl/gui/NaviItem.h b/ucl/include/ucl/gui/NaviItem.h new file mode 100644 index 0000000..495d3d8 --- /dev/null +++ b/ucl/include/ucl/gui/NaviItem.h @@ -0,0 +1,81 @@ +/* + * 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 __UCL_GUI_NAVI_ITEM_H__ +#define __UCL_GUI_NAVI_ITEM_H__ + +#include "WidgetItem.h" + +namespace ucl { + + /** + * @brief Represents Elementary Naviframe widget item + * @details This class has semantic of a pointer and therefore does not + * manage lifetime of the item. Pointer is always point to the non + * constant Naviframe item. Most of the methods marked as const + * because pointer is not changed in these method calls. + */ + class NaviItem final : public WidgetItem { + public: + /** + * @brief Delegate for handling naviframe item pop event + */ + using PopHandler = Delegate<Eina_Bool(Elm_Object_Item *)>; + + public: + using WidgetItem::WidgetItem; + + /** + * @brief Registers item pop handler + * @param[in] handler Handler delegate + */ + void setPopHandler(PopHandler handler) const; + + /** + * @brief Pops all items of the naviframe state to this item + */ + void popTo() const; + + /** + * @brief Moves this naviframe item to the top of the naviframe stack + */ + void promote() const; + + /** + * @brief Sets naviframe item tile visibility state + * @param[in] value Visibility state. true - visible, false - invisible + * @param[in] useTransition Title show/hide transition animation flag. + * true - use transition animation, false - no transition. + */ + void setTitleEnabled(bool value, bool useTransition = false) const; + + /** + * @brief Gets naviframe item tile visibility state + * @retrun Visibility state. true - visible, false - invisible + */ + bool isTitleEnabled() const; + + /** + * @brief Sets naviframe item tile text + * @param[in] title Translatable text to use as a title + */ + void setTitle(const TString &title) const; + }; +} + +#include "NaviItem.hpp" + +#endif // __UCL_GUI_NAVI_ITEM_H__ diff --git a/ucl/inc/ucl/gui/NaviItem.hpp b/ucl/include/ucl/gui/NaviItem.hpp index 6b33fe4..8b4730d 100644 --- a/ucl/inc/ucl/gui/NaviItem.hpp +++ b/ucl/include/ucl/gui/NaviItem.hpp @@ -16,7 +16,7 @@ namespace ucl { - inline void NaviItem::setPopHandler(const PopHandler &handler) const + inline void NaviItem::setPopHandler(const PopHandler handler) const { elm_naviframe_item_pop_cb_set(getIt(), handler.getStubA(), handler.getData()); @@ -36,11 +36,6 @@ namespace ucl { inline void NaviItem::setTitle(const TString &title) const { - if (isEmpty(title)) { - setTitleEnabled(false); - } else { - setText(title); - setTitleEnabled(true); - } + setText(title); } } diff --git a/ucl/include/ucl/gui/Naviframe.h b/ucl/include/ucl/gui/Naviframe.h new file mode 100644 index 0000000..cc7a94f --- /dev/null +++ b/ucl/include/ucl/gui/Naviframe.h @@ -0,0 +1,304 @@ +/* + * 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 __UCL_GUI_NAVIFRAME_H__ +#define __UCL_GUI_NAVIFRAME_H__ + +#include <vector> + +#include "StyledWidget.h" +#include "NaviItem.h" + +namespace ucl { + + constexpr SmartEvent NAVI_TRANSITION_STARTED {"ucl,transition,started"}; + constexpr SmartEvent NAVI_TRANSITION_FINISHED {"transition,finished"}; + + UCL_DECLARE_REF_ALIASES(Naviframe); + + /** + * @brief Represents Elementary Naviframe widget + */ + class Naviframe final : public StyledWidget { + public: + /** + * @brief Builder of Naviframe objects + */ + class Builder final { + public: + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets style of the future object + * @param[in] style Style of the future object + * @return Reference to this builder + */ + Builder &setStyle(ElmStyle value); + + /** + * @brief Sets if future object needs to be bind to it's Evas object + * @param[in] value true if need to bind, false - otherwise + * @return Reference to this builder + */ + Builder &setNeedBindToEo(bool value); + + /** + * @brief Creates new Naviframe object using current parameters + * @param[in] parent Reference to parent widget + * @return Shared reference to new Naviframe object or NULL + */ + NaviframeSRef build(ElmWidget &parent) const; + + private: + ElmStyle m_style; + bool m_needBindToEo; + }; + + public: + /** + * @brief Sets transition state of naviframe + * @details Warning! It is workaround function for internal use only. + * TODO Need to remove when page manager will be implemented. + * @param[in] inTransition true if in transition, false - otherwise + */ + void setInTransition(bool inTransition); + + /** + * @brief Gets current transition state of naviframe + * @details Warning! It is workaround function for internal use only. + * TODO Need to remove when page manager will be implemented. + * @return true if in transition, false - otherwise + */ + bool isInTransition() const; + + /** + * @brief Sets if back button should be automatically created in + * items on push + * @param[in] value true if need create, false - otherwise + */ + void setAutoBackBtn(bool value); + + /** + * @brief Gets if back button will be automatically created in + * items on push + * @return true if will be created, false - otherwise + */ + bool isAutoBackBtn() const; + + /** + * @brief Sets if item content should be preserved on pop + * @param[in] value true if need preserve, false - otherwise + */ + void setPreservePop(bool value); + + /** + * @brief Gets if item content will be preserved on pop + * @return true if will be preserve, false - otherwise + */ + bool isPreservePop() const; + + /** + * @brief Sets if events should be processed by naviframe + * on item transition + * @param[in] value true if need to process events, false - otherwise + */ + void setEventsEnabledOnTransition(bool value); + + /** + * @brief Gets if events will be processed by naviframe + * on item transition + * @return true if will be process events, false - otherwise + */ + bool isEventsEnabledOnTransition() const; + + /** + * @brief Pops and then deletes topmost item from stack with transition + * @return Preserved content of the popped item or NULL + */ + Evas_Object *pop(); + + /** + * @brief Pushes new item to the naviframe stack + * @param[in] title Translatable item title (may be empty) + * @param[in] content Content of the item + * @param[in] backBtn Back button widget pointer (may be NULL) + * @param[in] moreBtn More button widget pointer (may be NULL) + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem push(const TString &title, Widget &content, + Widget *backBtn, Widget *moreBtn, + ElmStyle style = nullptr); + + /** + * @brief Pushes new item to the naviframe stack + * @param[in] title Translatable item title (may be empty) + * @param[in] content Content of the item + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem push(const TString &title, Widget &content, + ElmStyle style = nullptr); + + /** + * @brief Pushes new item to the naviframe stack + * @param[in] content Content of the item + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem push(Widget &content, ElmStyle style = nullptr); + + /** + * @brief Pushes new item to the naviframe stack + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem push(ElmStyle style = nullptr); + + /** + * @brief Inserts new item to the naviframe stack after specific item + * @param[in] after Item after which future item will be inserted + * @param[in] title Translatable item title (may be empty) + * @param[in] content Content of the item + * @param[in] backBtn Back button widget pointer (may be NULL) + * @param[in] moreBtn More button widget pointer (may be NULL) + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem insertAfter(NaviItem after, const TString &title, + Widget &content, Widget *backBtn, Widget *moreBtn, + ElmStyle style = nullptr); + + /** + * @brief Inserts new item to the naviframe stack after specific item + * @param[in] after Item after which future item will be inserted + * @param[in] title Translatable item title (may be empty) + * @param[in] content Content of the item + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem insertAfter(NaviItem after, const TString &title, + Widget &content, ElmStyle style = nullptr); + + /** + * @brief Inserts new item to the naviframe stack after specific item + * @param[in] after Item after which future item will be inserted + * @param[in] content Content of the item + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem insertAfter(NaviItem after, + Widget &content, ElmStyle style = nullptr); + + /** + * @brief Inserts new item to the naviframe stack after specific item + * @param[in] after Item after which future item will be inserted + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem insertAfter(NaviItem after, ElmStyle style = nullptr); + + /** + * @brief Inserts new item to the naviframe stack before specific item + * @param[in] before Item before which future item will be inserted + * @param[in] title Translatable item title (may be empty) + * @param[in] content Content of the item + * @param[in] backBtn Back button widget pointer (may be NULL) + * @param[in] moreBtn More button widget pointer (may be NULL) + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem insertBefore(NaviItem before, const TString &title, + Widget &content, Widget *backBtn, Widget *moreBtn, + ElmStyle style = nullptr); + + /** + * @brief Inserts new item to the naviframe stack before specific item + * @param[in] before Item before which future item will be inserted + * @param[in] title Translatable item title (may be empty) + * @param[in] content Content of the item + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem insertBefore(NaviItem before, const TString &title, + Widget &content, ElmStyle style = nullptr); + + /** + * @brief Inserts new item to the naviframe stack before specific item + * @param[in] before Item before which future item will be inserted + * @param[in] content Content of the item + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem insertBefore(NaviItem before, + Widget &content, ElmStyle style = nullptr); + + /** + * @brief Inserts new item to the naviframe stack before specific item + * @param[in] before Item before which future item will be inserted + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem insertBefore(NaviItem before, ElmStyle style = nullptr); + + /** + * @brief Gets top item of the naviframe stack + * @return Top item + */ + NaviItem getTopItem()const; + + /** + * @brief Gets bottom item of the naviframe stack + * @return Bottom item + */ + NaviItem getBottomItem() const; + + /** + * @brief Gets all items of the naviframe stack + * @return Items vector + */ + std::vector<NaviItem> getItems() const; + + private: + Naviframe(IRefCountObj &rc, Evas_Object *eo, Private); + + NaviItem push(const TString &title, + Widget *content, Widget *backBtn, Widget *moreBtn, + ElmStyle style); + + NaviItem insertAfter(NaviItem after, const TString &title, + Widget *content, Widget *backBtn, Widget *moreBtn, + ElmStyle style); + + NaviItem insertBefore(NaviItem before, const TString &title, + Widget *content, Widget *backBtn, Widget *moreBtn, + ElmStyle style); + + void onTransitionFinished(Widget &widget, void *eventInfo); + + private: + bool m_isInTransition; + + friend class ReffedObj<Naviframe>; + }; +} + +#include "Naviframe.hpp" + +#endif // __UCL_GUI_NAVIFRAME_H__ diff --git a/ucl/include/ucl/gui/Naviframe.hpp b/ucl/include/ucl/gui/Naviframe.hpp new file mode 100644 index 0000000..c5dc4bf --- /dev/null +++ b/ucl/include/ucl/gui/Naviframe.hpp @@ -0,0 +1,240 @@ +/* + * 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. + */ + +namespace ucl { namespace himpl { + + inline void initItemTitle(const NaviItem item, const TString &title) + { + if (isEmpty(title)) { + item.setTitleEnabled(false); + } else { + item.setTitle(title); + item.setTitleEnabled(true); + } + } +}} + +namespace ucl { + + // Naviframe::Builder // + + inline Naviframe::Builder::Builder() : + m_needBindToEo(true) + { + } + + inline Naviframe::Builder &Naviframe::Builder::setStyle( + const ElmStyle value) + { + m_style = value; + return *this; + } + + inline Naviframe::Builder &Naviframe::Builder::setNeedBindToEo( + const bool value) + { + m_needBindToEo = value; + return *this; + } + + // Naviframe // + + inline bool Naviframe::isInTransition() const + { + return m_isInTransition; + } + + inline void Naviframe::setAutoBackBtn(const bool value) + { + elm_naviframe_prev_btn_auto_pushed_set(getEo(), toEina(value)); + } + + inline bool Naviframe::isAutoBackBtn() const + { + return elm_naviframe_prev_btn_auto_pushed_get(getEo()); + } + + inline void Naviframe::setPreservePop(const bool value) + { + elm_naviframe_content_preserve_on_pop_set(getEo(), toEina(value)); + } + + inline bool Naviframe::isPreservePop() const + { + return elm_naviframe_content_preserve_on_pop_get(getEo()); + } + + inline void Naviframe::setEventsEnabledOnTransition(const bool value) + { + elm_naviframe_event_enabled_set(getEo(), toEina(value)); + } + + inline bool Naviframe::isEventsEnabledOnTransition() const + { + return elm_naviframe_event_enabled_get(getEo()); + } + + inline Evas_Object *Naviframe::pop() + { + auto result = elm_naviframe_item_pop(getEo()); + if (getBottomItem()) { + setInTransition(true); + } + return result; + } + + inline NaviItem Naviframe::push(const TString &title, Widget *const content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) + { + auto result = NaviItem(elm_naviframe_item_push(getEo(), + nullptr, as_eo(backBtn), as_eo(moreBtn), + as_eo(content), style.name)); + himpl::initItemTitle(result, title); + if (result != getBottomItem()) { + setInTransition(true); + } + return result; + } + + inline NaviItem Naviframe::push(const TString &title, Widget &content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) + { + return push(title, &content, backBtn, moreBtn, style); + } + + inline NaviItem Naviframe::push(const TString &title, Widget &content, + const ElmStyle style) + { + return push(title, &content, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::push(Widget &content, const ElmStyle style) + { + return push(nullptr, &content, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::push(const ElmStyle style) + { + return push(nullptr, nullptr, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::insertAfter(const NaviItem after, + const TString &title, Widget *const content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) + { + auto result = NaviItem(elm_naviframe_item_insert_after(getEo(), + after, nullptr, as_eo(backBtn), as_eo(moreBtn), + as_eo(content), style.name)); + himpl::initItemTitle(result, title); + return result; + } + + inline NaviItem Naviframe::insertAfter(const NaviItem after, + const TString &title, Widget &content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) + { + return insertAfter(after, title, &content, backBtn, moreBtn, style); + } + + inline NaviItem Naviframe::insertAfter(const NaviItem after, + const TString &title, Widget &content, + const ElmStyle style) + { + return insertAfter(after, title, &content, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::insertAfter(const NaviItem after, + Widget &content, const ElmStyle style) + { + return insertAfter(after, nullptr, &content, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::insertAfter(const NaviItem after, + const ElmStyle style) + { + return insertAfter(after, nullptr, nullptr, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::insertBefore(const NaviItem before, + const TString &title, Widget *const content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) + { + auto result = NaviItem(elm_naviframe_item_insert_before(getEo(), + before, nullptr, as_eo(backBtn), as_eo(moreBtn), + as_eo(content), style.name)); + himpl::initItemTitle(result, title); + return result; + } + + inline NaviItem Naviframe::insertBefore(const NaviItem before, + const TString &title, Widget &content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) + { + return insertAfter(before, title, &content, backBtn, moreBtn, style); + } + + inline NaviItem Naviframe::insertBefore(const NaviItem before, + const TString &title, Widget &content, + const ElmStyle style) + { + return insertAfter(before, title, &content, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::insertBefore(const NaviItem before, + Widget &content, const ElmStyle style) + { + return insertAfter(before, nullptr, &content, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::insertBefore(const NaviItem before, + const ElmStyle style) + { + return insertAfter(before, nullptr, nullptr, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::getTopItem()const + { + return NaviItem(elm_naviframe_top_item_get(getEo())); + } + + inline NaviItem Naviframe::getBottomItem() const + { + return NaviItem(elm_naviframe_bottom_item_get(getEo())); + } + + inline std::vector<NaviItem> Naviframe::getItems() const + { + std::vector<NaviItem> result; + + Eina_List *const items = elm_naviframe_items_get(getEo()); + Eina_List *l = nullptr; + void *data = nullptr; + + EINA_LIST_FOREACH(items, l, data) { + result.emplace_back(static_cast<Elm_Object_Item *>(data)); + } + + eina_list_free(items); + + return result; + } +} diff --git a/ucl/include/ucl/gui/RadioBox.h b/ucl/include/ucl/gui/RadioBox.h new file mode 100644 index 0000000..715b0bd --- /dev/null +++ b/ucl/include/ucl/gui/RadioBox.h @@ -0,0 +1,136 @@ +/* + * 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 __UCL_GUI_RADIO_BOX_H__ +#define __UCL_GUI_RADIO_BOX_H__ + +#include "StyledWidget.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(RadioBox); + + /** + * @brief Represents Elementary Radio widget + */ + class RadioBox final : public StyledWidget { + public: + /** + * @brief Builder of RadioBox objects + */ + class Builder final { + public: + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets style of the future object + * @param[in] style Style of the future object + * @return Reference to this builder + */ + Builder &setStyle(ElmStyle style); + + /** + * @brief Sets Evas object ownership flag of the future object + * @param[in] value true if owner, false - otherwise + * @return Reference to this builder + */ + Builder &setIsOwner(bool value); + + /** + * @brief Sets if future object needs to be bind to it's Evas object + * @param[in] value true if need to bind, false - otherwise + * @return Reference to this builder + */ + Builder &setNeedBindToEo(bool value); + + /** + * @brief Creates new RadioBox object using current parameters + * @param[in] parent Reference to parent widget + * @return Shared reference to new RadioBox object or NULL + */ + RadioBoxSRef build(ElmWidget &parent) const; + + private: + ElmStyle m_style; + bool m_isOwner; + bool m_needBindToEo; + }; + + public: + using StyledWidget::StyledWidget; + + /** + * @brief Assigns a value that this radio box represents + * @param[in] value Integer value for this radio box + */ + void setItemValue(int value); + + /** + * @brief Gets a value that this radio box represents + * @return Integer value for this radio box + */ + int getItemValue() const; + + /** + * @brief Adds this radio box to the group of other radio boxes + * @param[in] group Radio box to which group this radio box + * should be added + */ + void addToGroup(RadioBox &group); + + /** + * @brief Sets a value of the group in which this radio box is member + * @details All radio boxes in the same group will be selected if + * their index matches group index. + * @param[in] value Integer value for the group of this radio box + */ + void setGroupValue(int value); + + /** + * @brief Gets a value of the group in which this radio box is member + * @return Integer value for the group of this radio box + */ + int getGroupValue() const; + + /** + * @brief Sets pointer to track group value of this radio box + * @details If pointer is not NULL group value will be changed to the + * value pointed by this pointer. From this time value pointed + * by this pointer will automatically change each time when + * group value changes. Do not change pointed value manually. + * @param[in] valuePtr Pointer to integer for tracking the group value. + * Use NULL to remove previous pointer. + */ + void setGroupValuePointer(int *valuePtr); + + /** + * @brief Gets currently selected radio box Evas object + * @return Pointer to selected radio box Evas object, + * or NULL if no selection + */ + Elm_Radio *getSelectedObject() const; + + private: + friend class ReffedObj<RadioBox>; + }; +} + +#include "RadioBox.hpp" + +#endif // __UCL_GUI_RADIO_BOX_H__ diff --git a/ucl/include/ucl/gui/RadioBox.hpp b/ucl/include/ucl/gui/RadioBox.hpp new file mode 100644 index 0000000..3efe0e0 --- /dev/null +++ b/ucl/include/ucl/gui/RadioBox.hpp @@ -0,0 +1,82 @@ +/* + * 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. + */ + +namespace ucl { + + // RadioBox::Builder // + + inline RadioBox::Builder::Builder() : + m_isOwner(true), + m_needBindToEo(true) + { + } + + inline RadioBox::Builder &RadioBox::Builder::setStyle(const ElmStyle style) + { + m_style = style; + return *this; + } + + inline RadioBox::Builder &RadioBox::Builder::setIsOwner(const bool value) + { + m_isOwner = value; + return *this; + } + + inline RadioBox::Builder & + RadioBox::Builder::setNeedBindToEo(const bool value) + { + m_needBindToEo = value; + return *this; + } + + // RadioBox // + + inline void RadioBox::setItemValue(const int value) + { + elm_radio_state_value_set(getEo(), value); + } + + inline int RadioBox::getItemValue() const + { + return elm_radio_state_value_get(getEo()); + } + + inline void RadioBox::addToGroup(RadioBox &group) + { + elm_radio_group_add(getEo(), as_eo(group)); + } + + inline void RadioBox::setGroupValue(const int value) + { + elm_radio_value_set(getEo(), value); + } + + inline int RadioBox::getGroupValue() const + { + return elm_radio_value_get(getEo()); + } + + inline void RadioBox::setGroupValuePointer(int *const valuePtr) + { + elm_radio_value_pointer_set(getEo(), valuePtr); + } + + inline Elm_Radio *RadioBox::getSelectedObject() const + { + return elm_radio_selected_object_get(getEo()); + } +} diff --git a/ucl/inc/ucl/gui/StyledWidget.h b/ucl/include/ucl/gui/StyledWidget.h index 2a0280c..c852c7c 100644 --- a/ucl/inc/ucl/gui/StyledWidget.h +++ b/ucl/include/ucl/gui/StyledWidget.h @@ -23,13 +23,29 @@ namespace ucl { UCL_DECLARE_REF_ALIASES(StyledWidget); + /** + * @brief Represents Elementary widget which can apply ElmStyle + * and serves as base class for more concrete widget types + */ class StyledWidget : public EdjeWidget { public: - friend class ReffedObj<StyledWidget>; using EdjeWidget::EdjeWidget; - explicit StyledWidget(Evas_Object *eo, bool isOwner = false); + /** + * @brief Constructor + * @param[in] eo Underlying Evas object of the widget + * @param[in] isOwner Evas object ownership flag (optional: true) + */ + explicit StyledWidget(Evas_Object *eo, bool isOwner = true); + + /** + * @brief Applies style to the widget + * @param[in] style Style to apply + */ void setStyle(ElmStyle style); + + private: + friend class ReffedObj<StyledWidget>; }; } diff --git a/ucl/inc/ucl/gui/StyledWidget.hpp b/ucl/include/ucl/gui/StyledWidget.hpp index cb32329..cb32329 100644 --- a/ucl/inc/ucl/gui/StyledWidget.hpp +++ b/ucl/include/ucl/gui/StyledWidget.hpp diff --git a/ucl/include/ucl/gui/Theme.h b/ucl/include/ucl/gui/Theme.h new file mode 100644 index 0000000..d819186 --- /dev/null +++ b/ucl/include/ucl/gui/Theme.h @@ -0,0 +1,146 @@ +/* + * 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 __UCL_GUI_THEME_H__ +#define __UCL_GUI_THEME_H__ + +#include "types.h" + +namespace ucl { + + /** + * @brief Represents Elementary theme object that can be assigned to + * any Elementary widget. + * @see ElmWidget::setTheme + */ + class Theme final : NonCopyable { + public: + /** + * @brief Creates new Theme object that refers default theme + * @return New Theme object (may not valid) + */ + static Theme create(); + + /** + * @brief Swaps Theme objects with each other + * @param[in/out] x First theme object + * @param[in/out] y Second theme object + */ + friend void swap(Theme &x, Theme &y); + + public: + /** + * @brief Default constructor + * @details Constructs empty non valid theme + */ + Theme(); + + /** + * @brief Constructor + * @details Same as default constructor + */ + Theme(std::nullptr_t); + + /** + * @brief Constructor + * @details Wraps native Elementary theme object. Native Elementary + * theme objet will be deleted if Theme object is owner. + * @param[in] th Native Elementary theme object + * @param[in] isOwner Elementary theme object ownership + * flag (optional: false) + */ + explicit Theme(Elm_Theme *th, bool isOwner = false); + + /** + * @brief Move constructor + * @param[in] tmp Source temporary Theme object + */ + Theme(Theme &&tmp); + + /** + * @brief Destructor + * @details Deletes native Elementary theme object if owner. + */ + ~Theme(); + + /** + * @brief Assigns one Them object to another + * @details Only move assignment is possible. Original will be deleted. + * @param[in] tmp Source Theme object + * @return Reference to this Theme object + */ + Theme &operator=(Theme tmp); + + /** + * @brief Gets native Elementary theme object + * @return Pointer to native Elementary theme object + */ + Elm_Theme *getTh(); + + /** + * @brief Gets native Elementary theme object (constant version) + * @return Pointer to native constant Elementary theme object + */ + const Elm_Theme *getTh() const; + + /** + * @brief Implicitly casts to native Elementary theme object + * @return Pointer to native Elementary theme object + */ + operator Elm_Theme *(); + + /** + * @brief Implicitly casts to native Elementary + * theme object (constant version) + * @return Pointer to native constant Elementary theme object + */ + operator const Elm_Theme *() const; + + /** + * @brief Adds specified Edje file as extension to this Theme object + * @details All Edje groups from the extension will be examined after + * all groups currently existing in this theme. + * @param[in] edjePath File path to Edje file with extension + */ + void addExtension(const std::string edjePath); + + /** + * @brief Adds specified Edje file as overlay to this Theme object + * @details All Edje groups from the overlay will be examined before + * all groups currently existing in this theme. + * @param[in] edjePath File path to Edje file with overlay + */ + void addOverlay(const std::string edjePath); + + private: + Elm_Theme *m_th; + bool m_isOwner; + }; + + // Non-member functions // + + /** + * @brief Checks whether Theme object is valid + * @details This is equivalent to: item.getTh() != NULL; + * @param[in] theme Reference to target Theme object + * @return true if valid, false if not valid + */ + bool isValid(const Theme &theme); +} + +#include "Theme.hpp" + +#endif // __UCL_GUI_THEME_H__ diff --git a/ucl/inc/ucl/gui/Theme.hpp b/ucl/include/ucl/gui/Theme.hpp index 65910df..b357dd7 100644 --- a/ucl/inc/ucl/gui/Theme.hpp +++ b/ucl/include/ucl/gui/Theme.hpp @@ -48,12 +48,6 @@ namespace ucl { tmp.m_th = nullptr; } - inline Theme &Theme::operator=(Theme &&tmp) - { - swap(*this, tmp); - return *this; - } - inline Theme::~Theme() { if (m_isOwner && m_th) { @@ -61,6 +55,12 @@ namespace ucl { } } + inline Theme &Theme::operator=(Theme tmp) + { + swap(*this, tmp); + return *this; + } + inline Elm_Theme *Theme::getTh() { return m_th; @@ -93,9 +93,9 @@ namespace ucl { // Non-member functions // - inline bool isValid(const Theme &item) + inline bool isValid(const Theme &theme) { - return !!item.getTh(); + return !!theme.getTh(); } inline void swap(Theme &x, Theme &y) diff --git a/ucl/include/ucl/gui/Widget.h b/ucl/include/ucl/gui/Widget.h new file mode 100644 index 0000000..df4713e --- /dev/null +++ b/ucl/include/ucl/gui/Widget.h @@ -0,0 +1,559 @@ +/* + * 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 __UCL_GUI_WIDGET_H__ +#define __UCL_GUI_WIDGET_H__ + +#include <list> + +#include "types.h" + +#include "ucl/misc/RefCountAware.h" + +#define UCL_SMART_FWD "ucl,fwd," + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(Widget); + + /** + * @brief Represents Evas widget and serves as base class for more + * concrete widget types + */ + class Widget : public RefCountAware { + public: + /** + * @brief Constant for setWeight() method + */ + static constexpr auto EXPAND = EVAS_HINT_EXPAND; + + /** + * @brief Constant for setAllign() method + */ + static constexpr auto FILL = EVAS_HINT_FILL; + + public: + /** + * @brief Gets the underlying Evas object + * @param[in] widget Reference to target widget + * @return Pointer to the underlying Evas object + */ + friend Evas_Object *as_eo(Widget &widget); + + /** + * @brief Gets the underlying constant Evas object + * @param[in] widget Constant reference to target widget + * @return Pointer to the underlying constant Evas object + */ + friend const Evas_Object *as_eo(const Widget &widget); + + public: + /** + * @brief Constructor + * @param[in] eo Underlying Evas object of the widget + * @param[in] isOwner Evas object ownership flag (optional: true) + */ + explicit Widget(Evas_Object *eo, bool isOwner = true); + + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + * @param[in] eo Underlying Evas object of the widget + * @param[in] isOwner Evas object ownership flag (optional: true) + */ + Widget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true); + + /** + * @brief Destructor + */ + virtual ~Widget(); + + /** + * @brief Binds underlying Evas object to this widget + * @details When Evas object is bound it makes possible to convert + * Evas object pointer to Widget pointer. Only single + * Widget object may be bound same Evas object. + */ + void bindToEo(); + + /** + * @brief Unbinds underlying Evas object from this widget + * @details Reverts the effect of bindToEo() function call. Use this + * function if you want to bind different Widget object to + * same Evas object (usefull when wrapping widgets). + */ + void unbindFromEo(); + + /** + * @brief Sets ownership of Evas object flag to this widget + * @details In all cases: + * Evas object can't be destroyed while Widget object is alive. + * But it can still be marked for deletion. + * + * In all cases when ownership flag is true: + * Underlying Evas object is marked for deletion in the + * destructor of this Widget object. Otherwise... + * + * In case if Widget object is shared: + * While Evas object is alive Widget object is also remains + * alive even if all visible shared references destroyed. + * It is possible to create new shared reference to Widget + * from Evas object pointer. + * + * In case if Widget object is not shared: + * Underlying Evas object is not marked for deletion in the + * destructor of this Widget object + * + * @param[in] value Ownership flag. true - owner, false - not owner. + */ + void setIsOwner(bool value); + + /** + * @brief Gets Evas canvas on which underlying Evas object resides + * @return Pointer to the Evas canvas + */ + Evas *getEvas() const; + + /** + * @brief Assigns user data to this widget + * @param[in] key Name of the data key + * @param[in] data Pointer to the user data + */ + void setData(EoDataKey key, void *data); + + /** + * @brief Deletes user data from this widget + * @param[in] key Name of the data key + */ + void delData(EoDataKey key); + + /** + * @brief Gets user data from this widget + * @param[in] key Name of the data key + * @return Pointer to the user data or NULL if not found + */ + void *getData(EoDataKey key) const; + + /** + * @brief Registers standard widget event handler + * @param[in] event Value of the standart widget event enumeration + * @param[in] handler Handler of the event + */ + void addEventHandler(WidgetEvent event, WidgetEventHandler handler); + + /** + * @brief Registers smart widget event handler + * @param[in] event Name of the smart widget event + * @param[in] handler Handler of the event + */ + void addEventHandler(SmartEvent event, WidgetEventHandler handler); + + /** + * @brief Deregisters standard widget event handler + * @param[in] event Value of the standart widget event enumeration + * @param[in] handler Handler of the event + */ + void delEventHandler(WidgetEvent event, + WidgetEventHandler::CDRef handler); + + /** + * @brief Deregisters smart widget event handler + * @param[in] event Name of the smart widget event + * @param[in] handler Handler of the event + */ + void delEventHandler(SmartEvent event, + WidgetEventHandler::CDRef handler); + + /** + * @brief Calls smart widget event on this widget + * @details All handler of this event on this widget will handle this + * event synchronously during call to this function. + * @param[in] event Name of the smart widget event + * @param[in] eventInfo Pointer to event info (optional) + */ + void callEvent(SmartEvent event, void *eventInfo = nullptr); + + /** + * @brief Marks underlying Evas object for deletion + * @details Evas object will be deleted when there is no Widget objects + * referencing it and no other references to it. + */ + void markForDeletion(); + + /** + * @brief Sets visibility state of the widget + * @param[in] value New state + */ + void setVisible(bool value); + + /** + * @brief Gets visibility state of the widget + * @return true if visible, false if invisible + */ + bool isVisible() const; + + /** + * @brief Sets color to this widget + * @details Color component values must be premultiplied if alpha + * is not 255. + * @param[in] r Red component of the color [0-255] + * @param[in] g Green component of the color [0-255] + * @param[in] b Blue component of the color [0-255] + * @param[in] a Alpha transparency of the color [0-255] (optional: 255) + */ + void setColor(int r, int g, int b, int a = 255); + + /** + * @brief Sets gray color to this widget + * @param[in] l Luminosity of the color [0-255] + * @param[in] a Alpha transparency of the color [0-255] (optional: 255) + */ + void setColor(int l, int a = 255); + + /** + * @brief Gets color of this widget + * @param[out] r Reference to the red component of the color + * @param[out] g Reference to the green component of the color + * @param[out] b Reference to the blue component of the color + * @param[out] a Reference to the alpha + */ + void getColor(int &r, int &g, int &b, int &a) const; + + /** + * @brief Performs forced size calculations on the widget + */ + void calculate(); + + /** + * @brief Sets geometry of this widget + * @param[in] x Top-left X coordinate of the widget + * @param[in] y Top-left Y coordinate of the widget + * @param[in] w New width of the widget + * @param[in] h New height of the widget + */ + void setGeometry(int x, int y, int w, int h); + + /** + * @brief Changes position of this widget + * @param[in] x Top-left X coordinate of the widget + * @param[in] y Top-left Y coordinate of the widget + */ + void move(int x, int y); + + /** + * @brief Changes size of this widget + * @param[in] w New width of the widget + * @param[in] h New height of the widget + */ + void resize(int w, int h); + + /** + * @brief Gets geometry of this widget + * @param[out] x Top-left X coordinate of the widget (may be NULL) + * @param[out] y Top-left Y coordinate of the widget (may be NULL) + * @param[out] w Width of the widget (may be NULL) + * @param[out] h Height of the widget (may be NULL) + */ + void getGeometry(int *x, int *y, int *w, int *h) const; + + /** + * @brief Sets weight size hints to the widget + * @details Use EXPAND to expand container to the parent size + * @param[in] x Weight of the widget along X axis + * @param[in] y Weight of the widget along Y axis + */ + void setWeight(double x, double y); + + /** + * @brief Sets align size hints to the widget + * @details Use FILL to streth to the size of the container + * @param[in] x Align of the widget along X axis [0.0-1.0] + * @param[in] y Align of the widget along Y axis [0.0-1.0] + */ + void setAlign(double x, double y); + + /** + * @brief Sets mimimum size hints to the widget + * @param[in] w Minimul allowed with of the widget + * @param[in] h Minimul allowed height of the widget + */ + void setMin(int w, int h); + + /** + * @brief Sets maximum size hints to the widget + * @details Use -1 for infinity. + * @param[in] w Maximum allowed with of the widget + * @param[in] h Maximum allowed height of the widget + */ + void setMax(int w, int h); + + /** + * @brief Gets weight size hints of the widget + * @param[out] x Weight of the widget along X axis (may be NULL) + * @param[out] y Weight of the widget along Y axis (may be NULL) + */ + void getWeight(double *x, double *y) const; + + /** + * @brief Gets align size hints of the widget + * @param[out] x Align of the widget along X axis (may be NULL) + * @param[out] y Align of the widget along Y axis (may be NULL) + */ + void getAlign(double *x, double *y) const; + + /** + * @brief Gets mimimum size hints of the widget + * @param[in] w Minimul allowed with of the widget (may be NULL) + * @param[in] h Minimul allowed height of the widget (may be NULL) + */ + void getMin(int *w, int *h) const; + + /** + * @brief Gets maximum size hints of the widget + * @param[in] w Maximum allowed with of the widget (may be NULL) + * @param[in] h Maximum allowed height of the widget (may be NULL) + */ + void getMax(int *w, int *h) const; + + /** + * @brief Sets aspect ratio size hints to the widget + * @param[in] arControl Type of aspect ration control + * @param[in] w Width aspect ration term + * @param[in] h Height aspect ration term + */ + void setARHint(WidgetARHint arControl, int w, int h); + + /** + * @brief Gets aspect ratio size hints of the widget + * @param[out] arControl Type of aspect ration control + * @param[out] w Width aspect ration term + * @param[out] h Height aspect ration term + */ + void getARHint(WidgetARHint &arControl, int &w, int &h); + + /** + * @brief Sets key-input focus state to the widget + * @param[in] value New state. true - to set focus, false - to unset + */ + void setFocused(bool value); + + /** + * @brief Gets key-input focus state of the widget + * @return true if focused, false id not focused + */ + bool isFocused() const; + + protected: + /** + * @brief Gets the underlying Evas object + * @return Pointer to the underlying Evas object + */ + Evas_Object *getEo(); + + /** + * @brief Gets the underlying Evas object (constant version) + * @return Pointer to the constant underlying Evas object + */ + const Evas_Object *getEo() const; + + /** + * @brief Actually sets key-input focus state to the widget + * @details May be overriden in subclasses to change behaviour + * @param[in] value New state. true - to set focus, false - to unset + */ + virtual void setFocusedImpl(bool value); + + /** + * @brief Actually gets key-input focus state of the widget + * @details May be overriden in subclasses to change behaviour + * @return true if focused, false id not focused + */ + virtual bool isFocusedImpl() const; + + /** + * @brief Setups all necessary state to handle forwarded smart events + * @details Called when a handler for UCL_SMART_FWD is added. + * @param[in] fwdEvent Smart event that needs to be forwarded + * @return true - if forwarded event is supported and necessary state + * was succesfully prepared, false - otherwise + */ + virtual bool ensureFwdEvent(SmartEvent fwdEvent); + + private: + class EventProxy; + using EventProxies = std::list<EventProxy>; + using EventProxiesIt = EventProxies::iterator; + + private: + void updateRefs(); + + void updateEoRef(); + bool needKeepEoRef() const; + void updateSelfRef(); + bool needKeepSelfRef() const; + + void setSelfRefUnique(const bool value); + + void onEoDel(Evas *e, Evas_Object *obj, void *event_info); + + void delEventProxy(const EventProxiesIt it); + + public: + // This section MUST be public! + // Signal to RefCountObj<T, C> to call onUniqueChanged() + enum { _ENABLE_ON_UNIQUE_CHANGED_DISPATCH }; + + protected: + // This section MAY be protected + void onUniqueChanged(bool isUnique); + + private: + Evas_Object *m_eo; + EventProxies m_eventProxies; + WidgetSRef m_selfRef; + bool m_isOwner; + bool m_isBoundToEo; + bool m_isEoRefKept; + bool m_isSelfRefUnique; + + friend class ReffedObj<Widget>; + }; + + // Non-member functions // + + /** + * @brief Gets Evas object from pointed object + * @param[in] ptr Target object pointer + * @return Pointer to Evas object or NULL + */ + template <class T> + inline auto as_eo(const T &ptr) -> typename std::enable_if< + std::is_constructible<bool, T>::value, decltype(as_eo(*ptr))>::type + { + return (ptr ? as_eo(*ptr) : nullptr); + } + + /** + * @brief Gets Evas object from iterator + * @param[in] it Target object iterator + * @return Pointer to Evas object or NULL + */ + template <class T> + inline auto as_eo(const T &it) -> typename std::enable_if< + !std::is_constructible<bool, T>::value, decltype(as_eo(*it))>::type + { + return as_eo(*it); + } + + /** + * @brief Passes through original Evas object pointer + * @param[in] eo Evas object pointer + * @return Evas object pointer + */ + Evas_Object *as_eo(Evas_Object *eo); + + /** + * @brief Passes through original constant Evas object pointer + * @param[in] eo Constant Evas object pointer + * @return Constant Evas object pointer + */ + const Evas_Object *as_eo(const Evas_Object *eo); + + /** + * @brief Gets position of the widget + * @param[in] widget Reference to target widget + * @param[out] x Top-left X coordinate of the widget (may be NULL) + * @param[out] y Top-left Y coordinate of the widget (may be NULL) + */ + void getPosition(const Widget &widget, int *x, int *y); + + /** + * @brief Gets size of the widget + * @param[in] widget Reference to target widget + * @param[out] w Width of the widget (may be NULL) + * @param[out] h Height of the widget (may be NULL) + */ + void getSize(const Widget &widget, int *w, int *h); + + /** + * @brief Makes the widget visible + * @details This is equivalent to: widget.setVisible(true); + * @param[in] widget Reference to target widget + */ + void show(Widget &widget); + + /** + * @brief Makes the widget invisible + * @details This is equivalent to: widget.setVisible(false); + * @param[in] widget Reference to target widget + */ + void hide(Widget &widget); + + /** + * @brief Makes the widget transparent + * @details This is equivalent to: widget.setColor(0, 0); + * @param[in] widget Reference to target widget + */ + void makeTransparent(Widget &widget); + + /** + * @brief Makes the widget color white + * @details This is equivalent to: widget.setColor(255); + * @param[in] widget Reference to target widget + */ + void makeWhite(Widget &widget); + + /** + * @brief Sets widget to focused state + * @details This is equivalent to: widget.setFocused(true); + * @param[in] widget Reference to target widget + */ + void focus(Widget &widget); + + /** + * @brief Sets widget to unfocused state + * @details This is equivalent to: widget.setFocused(false); + * @param[in] widget Reference to target widget + */ + void unfocus(Widget &widget); + + /** + * @brief Sets EXPAND weight size hits to the widget + * @details This is equivalent to: + * widget.setWight(Widget::EXPAND, Widget::EXPAND); + * @param[in] widget Reference to target widget + */ + void expand(Widget &widget); + + /** + * @brief Sets FILL align size hits to the widget + * @details This is equivalent to: + * widget.setAlign(Widget::FILL, Widget::FILL); + * @param[in] widget Reference to target widget + */ + void fill(Widget &widget); + + /** + * @brief Sets EXPAND weight and FILL align size hits to the widget + * @details This is equivalent to: expand(widget); fill(widget); + * @param[in] widget Reference to target widget + */ + void expandAndFill(Widget &widget); +} + +#include "Widget.hpp" + +#endif // __UCL_GUI_WIDGET_H__ diff --git a/ucl/inc/ucl/gui/Widget.hpp b/ucl/include/ucl/gui/Widget.hpp index 95da66a..4d2cf29 100644 --- a/ucl/inc/ucl/gui/Widget.hpp +++ b/ucl/include/ucl/gui/Widget.hpp @@ -44,16 +44,6 @@ namespace ucl { return m_eo; } - inline Widget::operator Evas_Object *() - { - return getEo(); - } - - inline Widget::operator const Evas_Object *() const - { - return getEo(); - } - inline Evas *Widget::getEvas() const { return evas_object_evas_get(getEo()); @@ -141,14 +131,14 @@ namespace ucl { evas_object_geometry_get(getEo(), x, y, w, h); } - inline void Widget::setWeight(const double w, const double h) + inline void Widget::setWeight(const double x, const double y) { - evas_object_size_hint_weight_set(getEo(), w, h); + evas_object_size_hint_weight_set(getEo(), x, y); } - inline void Widget::setAlign(const double w, const double h) + inline void Widget::setAlign(const double x, const double y) { - evas_object_size_hint_align_set(getEo(), w, h); + evas_object_size_hint_align_set(getEo(), x, y); } inline void Widget::setMin(const int w, const int h) @@ -161,14 +151,14 @@ namespace ucl { evas_object_size_hint_max_set(getEo(), w, h); } - inline void Widget::getWeight(double *const w, double *const h) const + inline void Widget::getWeight(double *const x, double *const y) const { - evas_object_size_hint_weight_get(getEo(), w, h); + evas_object_size_hint_weight_get(getEo(), x, y); } - inline void Widget::getAlign(double *const w, double *const h) const + inline void Widget::getAlign(double *const x, double *const y) const { - evas_object_size_hint_align_get(getEo(), w, h); + evas_object_size_hint_align_get(getEo(), x, y); } inline void Widget::getMin(int *const w, int *const h) const @@ -206,6 +196,26 @@ namespace ucl { // Non-member functions // + inline Evas_Object *as_eo(Widget &widget) + { + return widget.m_eo; + } + + inline const Evas_Object *as_eo(const Widget &widget) + { + return widget.m_eo; + } + + inline Evas_Object *as_eo(Evas_Object *const eo) + { + return eo; + } + + inline const Evas_Object *as_eo(const Evas_Object *const eo) + { + return eo; + } + inline void getPosition(const Widget &widget, int *x, int *y) { widget.getGeometry(x, y, nullptr, nullptr); @@ -261,14 +271,4 @@ namespace ucl { expand(widget); fill(widget); } - - inline bool operator==(const Widget &lhs, const Widget &rhs) - { - return (lhs.getEo() == rhs.getEo()); - } - - inline bool operator!=(const Widget &lhs, const Widget &rhs) - { - return (lhs.getEo() != rhs.getEo()); - } } diff --git a/ucl/include/ucl/gui/WidgetItem.h b/ucl/include/ucl/gui/WidgetItem.h new file mode 100644 index 0000000..3ef57d4 --- /dev/null +++ b/ucl/include/ucl/gui/WidgetItem.h @@ -0,0 +1,230 @@ +/* + * 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 __UCL_GUI_WIDGET_ITEM_H__ +#define __UCL_GUI_WIDGET_ITEM_H__ + +#include "Widget.h" + +namespace ucl { + + /** + * @brief Represents generic Elementary widget item and serves as base + * class for more concrete widget item types + * @details This class has semantic of a pointer and therefore does not + * manage lifetime of the item. Pointer is always point to the non + * constant Genlist item. Most of the methods marked as const + * because pointer is not changed in these method calls. + */ + class WidgetItem { + public: + /** + * @brief Default constructor + * @details Constructs NULL item + */ + constexpr WidgetItem(); + + /** + * @brief Constructor + * @details Same as default constructor + */ + constexpr WidgetItem(std::nullptr_t); + + /** + * @brief Constructor + * @details Wraps native Elementary widget item. + * @param[in] it Native Elementary widget item + */ + explicit WidgetItem(Elm_Object_Item *it); + + /** + * @brief Gets native Elementary widget item + * @return Pointer to native Elementary widget item + */ + Elm_Object_Item *getIt() const; + + /** + * @brief Implicitly casts to native Elementary widget item + * @return Pointer to native Elementary widget item + */ + operator Elm_Object_Item *() const; + + /** + * @brief Explicitly casts to boolen type + * @return true if native item is not NULL, false - if NULL + */ + explicit operator bool() const; + + /** + * @brief Gets owning Evas object of this widget item + * @return Pointer to the owning Evas object + */ + Evas_Object *getWidget() const; + + /** + * @brief Sets widget item delete callback + * @details Callback is called when item is deleted. + * Data of the callback is set by setData() method. + * @param[in] cb Pointer to callback function + */ + void setDelCallback(Evas_Smart_Cb cb) const; + + /** + * Deletes this widget item and NULL the pointer + */ + void del(); + + /** + * @brief Assigns user data to this widget item + * @param[in] data Pointer to the user data + */ + void setData(void *data) const; + + /** + * @brief Gets assigned user data to this widget item + * @return Pointer to the assigned user data or NULL + */ + void *getData() const; + + /** + * @brief Sets enabled state of the widget item + * @param[in] value New state + */ + void setEnabled(bool value) const; + + /** + * @brief Gets enabled state of the widget item + * @return true if enabled, false if disabled + */ + bool isEnabled() const; + + /** + * @brief Applies style to the widget item + * @param[in] style Style to apply + */ + void setStyle(ElmStyle style) const; + + /** + * @brief Sets text to default part of the widget item + * @param[in] value Translatable text value to set + */ + void setText(const TString &value) const; + + /** + * @brief Sets text to specific part of the widget item + * @param[in] value Translatable text value to set + * @param[in] part Destination Edje part + */ + void setText(const TString &value, EdjePart part) const; + + /** + * @brief Gets text from default part of the widget item + * @return Translated text from default part + */ + std::string getText() const; + + /** + * @brief Gets text from specific part of the widget item + * @param[in] part Source Edje part + * @return Translated text from specific part + */ + std::string getText(EdjePart part) const; + + /** + * @brief Sets content to default part of the widget item + * @param[in] content Content widget + */ + void setContent(Widget &content) const; + + /** + * @brief Sets content to specific part of the widget item + * @param[in] content Content widget + * @param[in] part Destination Edje part + */ + void setContent(Widget &content, EdjePart part) const; + + /** + * @brief Unsets content from default part of the widget item + * @return Content Evas object or NULL + */ + Evas_Object *unsetContent() const; + + /** + * @brief Unsets content from specific part of the widget item + * @param[in] part Source Edje part + * @return content Evas object or NULL + */ + Evas_Object *unsetContent(EdjePart part) const; + + /** + * @brief Gets content from default part of the widget item + * @return Content Evas object or NULL + */ + Evas_Object *getContent() const; + + /** + * @brief Gets content from specific part of the widget item + * @param[in] part Source Edje part + * @return content Evas object or NULL + */ + Evas_Object *getContent(EdjePart part) const; + + /** + * @brief Emits signal to the widget item's Edje theme + * @param[in] signal Emitted signal + * @param[in] signal Emitted signal source (optional) + */ + void emit(EdjeSignal signal, EdjeSignalSrc source = + EdjeSignalSrc("")) const; + + private: + Elm_Object_Item *m_it; + }; + + // Non-member functions // + + /** + * @brief Sets widget item to enabled state + * @details This is equivalent to: item.setEnabled(true); + * @param[in] item Reference to target widget item + */ + void enable(WidgetItem item); + + /** + * @brief Sets widget item to disabled state + * @details This is equivalent to: item.setEnabled(false); + * @param[in] item Reference to target widget item + */ + void disable(WidgetItem item); + + /** + * @brief Compares equals underlying item pointers of target widgets items + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + */ + bool operator==(WidgetItem lhs, WidgetItem rhs); + + /** + * @brief Compares unequals underlying item pointers of target widget items + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + */ + bool operator!=(WidgetItem lhs, WidgetItem rhs); +} + +#include "WidgetItem.hpp" + +#endif // __UCL_GUI_WIDGET_ITEM_H__ diff --git a/ucl/inc/ucl/gui/WidgetItem.hpp b/ucl/include/ucl/gui/WidgetItem.hpp index 26b6cbd..b36cfa4 100644 --- a/ucl/inc/ucl/gui/WidgetItem.hpp +++ b/ucl/include/ucl/gui/WidgetItem.hpp @@ -87,25 +87,25 @@ namespace ucl { elm_object_item_style_set(getIt(), style.name); } - inline TString WidgetItem::getText() const + inline std::string WidgetItem::getText() const { return elm_object_item_text_get(getIt()); } - inline TString WidgetItem::getText(const EdjePart part) const + inline std::string WidgetItem::getText(const EdjePart part) const { return elm_object_item_part_text_get(getIt(), part.name); } - inline void WidgetItem::setContent(Evas_Object *const content) const + inline void WidgetItem::setContent(Widget &content) const { - elm_object_item_content_set(getIt(), content); + elm_object_item_content_set(getIt(), as_eo(content)); } - inline void WidgetItem::setContent(Evas_Object *const content, + inline void WidgetItem::setContent(Widget &content, const EdjePart part) const { - elm_object_item_part_content_set(getIt(), part.name, content); + elm_object_item_part_content_set(getIt(), part.name, as_eo(content)); } inline Evas_Object *WidgetItem::unsetContent() const diff --git a/ucl/include/ucl/gui/Window.h b/ucl/include/ucl/gui/Window.h new file mode 100644 index 0000000..053a627 --- /dev/null +++ b/ucl/include/ucl/gui/Window.h @@ -0,0 +1,240 @@ +/* + * 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 __UCL_GUI_WINDOW_H__ +#define __UCL_GUI_WINDOW_H__ + +#include <vector> + +#include "StyledWidget.h" + +namespace ucl { + + constexpr SmartEvent WIN_ROTATION_CHANGED {"wm,rotation,changed"}; + + UCL_DECLARE_REF_ALIASES(Window); + + /** + * @brief Represents Elementary Window widget with Conformant + */ + class Window final : public ElmWidget { + public: + /** + * @brief Enumeration of Window types + */ + enum class Type { + BASIC = ELM_WIN_BASIC + }; + + /** + * @brief Builder of Window objects + */ + class Builder final { + public: + /** + * @brief Constructor + */ + Builder(); + + /** + * @brief Sets Evas object for the future window + * @details If Evas object is set builder will create wrapper + * Window object. + * @param[in] value Pointer to window Evas object + * @return Reference to this builder + */ + Builder &setWinEo(Evas_Object *value); + + /** + * @brief Sets type of the future window + * @details Ignored if WinEo is set. + * @param[in] type Type of the future window + * @return Reference to this builder + */ + Builder &setType(Type type); + + /** + * @brief Sets name of the future window + * @details Ignored if WinEo is set or used as title (if not set). + * @param[in] value Name of the future window + * @return Reference to this builder + */ + Builder &setName(std::string value); + + /** + * @brief Sets title of the future window + * @details Name is used if not set. + * @param[in] value Title of the future window + * @return Reference to this builder + */ + Builder &setTitle(std::string value); + + /** + * @brief Sets indicator visibility state of the future window + * @param[in] value Indicator visibility state of the future window + * @return Reference to this builder + */ + Builder &setIndicatorVisible(bool value); + + /** + * @brief Sets supported rotations by the future window + * @param[in] value Rotations supported by the future window + * @return Reference to this builder + */ + Builder &setRotations(std::vector<int> value); + + /** + * @brief Sets Evas object ownership flag of the future object + * @details If not set and WinEo is also not IsOwner + * is true by default, otherwise - false. + * @param[in] value true if owner, false - otherwise + * @return Reference to this builder + */ + Builder &setIsOwner(bool value); + + /** + * @brief Sets if future object needs to be bind to it's Evas object + * @param[in] value true if need to bind, false - otherwise + * @return Reference to this builder + */ + Builder &setNeedBindToEo(bool value); + + /** + * @brief Creates new Window object using current parameters + * @param[in] parent Reference to parent widget + * @return Shared reference to new Window object or NULL + */ + WindowSRef build() const; + + private: + std::string m_name; + std::string m_title; + std::vector<int> m_rotations; + Evas_Object *m_winEo; + Type m_type; + bool m_isIndicatorVisible; + bool m_isOwner; + bool m_isOwnerWasSet; + bool m_needBindToEo; + }; + + public: + /** + * @brief Gets conformant of this Window + * @return Reference to Conformant widget + */ + StyledWidget &getConformant(); + + /** + * @brief Gets conformant of this Window (constant version) + * @return Reference to constant Conformant widget + */ + const StyledWidget &getConformant() const; + + /** + * @brief Gets screen size of the window + * @param[out] w Width of the screen (may be NULL) + * @param[out] h Height of the screen (may be NULL) + */ + void getScreenSize(int *w, int *h) const; + + /** + * @brief Sets title of the window + * @param[in] value Title of the window + */ + void setTitle(const std::string &title); + + /** + * @brief Gets title of the window + * @return Title of the window + */ + std::string getTitle() const; + + /** + * Sets window indicator visibility state + * @param[in] value Visibility state. true - visible, false - invisible + */ + void setIndicatorVisible(bool value); + + /** + * Gets window indicator visibility state + * @retrun Visibility state. true - visible, false - invisible + */ + bool isIndicatorVisible() const; + + /** + * Gets window rotations support status + * @retrun true - rotation supported, false - no supported + */ + bool isRotationsSupported() const; + + /** + * @brief Sets supported rotations to the window + * @param[in] value Rotations supported by the window + */ + void setRotations(const std::vector<int> &value); + + /** + * @brief Resizes the window to fill whole screen + */ + void resizeToScreen(); + + /** + * @brief Moves window to foreground + */ + void lower(); + + private: + Window(IRefCountObj *rc, Evas_Object *eo, + bool isOwner, Evas_Object *conform, Private); + + private: + StyledWidget m_conform; + + friend class ReffedObj<Window>; + }; + + // Non-member functions // + + // Window // + + /** + * @brief Makes the window indicator visible + * @details This is equivalent to: win.setIndicatorVisible(true); + * @param[in] win Reference to target window + */ + void showIndicator(Window &win); + + /** + * @brief Makes the window indicator invisible + * @details This is equivalent to: win.setIndicatorVisible(false); + * @param[in] win Reference to target window + */ + void hideIndicator(Window &win); + + // Window::Type // + + /** + * @brief Checks validity of window type value + * @param[in] winType Window type value to validate + * @return true - if window type valid, false - otherwise + */ + bool isValid(Window::Type winType); +} + +#include "Window.hpp" + +#endif // __UCL_GUI_WINDOW_H__ diff --git a/ucl/inc/ucl/gui/Window.hpp b/ucl/include/ucl/gui/Window.hpp index d5b1828..7a9ab93 100644 --- a/ucl/inc/ucl/gui/Window.hpp +++ b/ucl/include/ucl/gui/Window.hpp @@ -55,7 +55,7 @@ namespace ucl { return *this; } - inline Window::Builder &Window::Builder::setSetIndicatorVisible( + inline Window::Builder &Window::Builder::setIndicatorVisible( const bool value) { m_isIndicatorVisible = value; @@ -85,7 +85,7 @@ namespace ucl { // Window // inline Window::Window(IRefCountObj *const rc, Evas_Object *const eo, - const bool isOwner, Evas_Object *const conform) : + const bool isOwner, Evas_Object *const conform, Private) : ElmWidget(rc, eo, isOwner), m_conform(conform) { diff --git a/ucl/include/ucl/gui/helpers.h b/ucl/include/ucl/gui/helpers.h new file mode 100644 index 0000000..6e2bd22 --- /dev/null +++ b/ucl/include/ucl/gui/helpers.h @@ -0,0 +1,158 @@ +/* + * 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 __UCL_GUI_HELPERS_H__ +#define __UCL_GUI_HELPERS_H__ + +#include "Widget.h" + +namespace ucl { + + // Converts Evas_Object to Widget pointer // + + /** + * @brief Converts Evas object pointer to Widget pointer + * @details Widget::bindToEo() must be called on widget object in order + * for this function to work. + * @return Pointer to the corresponding Widget object or NULL + */ + Widget *asWidget(Evas_Object *eo); + + /** + * @brief Converts pointer to constant Evas object to pointer + * to constant Widget + * @details Widget::bindToEo() must be called on widget object in order + * for this function to work. + * @return Pointer to the corresponding Widget object or NULL + */ + const Widget *asWidget(const Evas_Object *eo); + + // Widget casting functions from Evas_Object // + + /** + * @brief Statically casts Evas object pointer to WIDGET_TYPE pointer + * @details This function performs static_cast<WIDGET_TYPE *> on + * the result of asWidget() function call. + * @return Pointer to the corresponding WIDGET_TYPE object or NULL + */ + template <class WIDGET_TYPE> + inline auto staticWidgetCast(Evas_Object *eo) -> + decltype(static_cast<WIDGET_TYPE *>(asWidget(eo))) + { + return static_cast<WIDGET_TYPE *>(asWidget(eo)); + } + + /** + * @brief Statically casts pointer to constant Evas object to pointer + * to constant WIDGET_TYPE + * @details This function performs static_cast<const WIDGET_TYPE *> on + * the result of asWidget() function call. + * Do not need to add const to WIDGET_TYPE. + * @return Pointer to the corresponding WIDGET_TYPE object or NULL + */ + template <class WIDGET_TYPE> + inline auto staticWidgetCast(const Evas_Object *eo) -> + decltype(static_cast<const WIDGET_TYPE *>(asWidget(eo))) + { + return static_cast<const WIDGET_TYPE *>(asWidget(eo)); + } + + /** + * @brief Dynamically casts Evas object pointer to WIDGET_TYPE pointer + * @details This function performs dynamic_cast<WIDGET_TYPE *> on + * the result of asWidget() function call. + * @return Pointer to the corresponding WIDGET_TYPE object or NULL + */ + template <class WIDGET_TYPE> + inline auto dynamicWidgetCast(Evas_Object *eo) -> + decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo))) + { + return dynamic_cast<WIDGET_TYPE *>(asWidget(eo)); + } + + /** + * @brief Dynamically casts pointer to constant Evas object to pointer + * to constant WIDGET_TYPE + * @details This function performs dynamic_cast<const WIDGET_TYPE *> + * on the result of asWidget() function call. + * Do not need to add const to WIDGET_TYPE. + * @return Pointer to the corresponding WIDGET_TYPE object or NULL + */ + template <class WIDGET_TYPE> + inline auto dynamicWidgetCast(const Evas_Object *eo) -> + decltype(dynamic_cast<const WIDGET_TYPE *>(asWidget(eo))) + { + return dynamic_cast<const WIDGET_TYPE *>(asWidget(eo)); + } + + /** + * @brief Statically casts Evas object pointer to SharedRef<WIDGET_TYPE> + * @details This function calls asShared() on the result of + * staticWidgetCast<WIDGET_TYPE>() function call. + * @return Shared reference to the corresponding WIDGET_TYPE object or NULL + */ + template <class WIDGET_TYPE> + inline auto staticWidgetRefCast(Evas_Object *eo) -> + decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo))) + { + return asShared(staticWidgetCast<WIDGET_TYPE>(eo)); + } + + /** + * @brief Statically casts pointer to constant Evas object + * to SharedRef<const WIDGET_TYPE> + * @details This function calls asShared() on the result of + * staticWidgetCast<WIDGET_TYPE>() function call. + * @return Shared reference to the corresponding WIDGET_TYPE object or NULL + */ + template <class WIDGET_TYPE> + inline auto staticWidgetRefCast(const Evas_Object *eo) -> + decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo))) + { + return asShared(staticWidgetCast<WIDGET_TYPE>(eo)); + } + + /** + * @brief Dynamically casts Evas object pointer to SharedRef<WIDGET_TYPE> + * @details This function calls asShared() on the result of + * dynamicWidgetCast<WIDGET_TYPE>() function call. + * @return Shared reference to the corresponding WIDGET_TYPE object or NULL + */ + template <class WIDGET_TYPE> + inline auto dynamicWidgetRefCast(Evas_Object *eo) -> + decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo))) + { + return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)); + } + + /** + * @brief Dynamically casts pointer to constant Evas object + * to SharedRef<const WIDGET_TYPE> + * @details This function calls asShared() on the result of + * dynamicWidgetCast<WIDGET_TYPE>() function call. + * @return Shared reference to the corresponding WIDGET_TYPE object or NULL + */ + template <class WIDGET_TYPE> + inline auto dynamicWidgetRefCast(const Evas_Object *eo) -> + decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo))) + { + return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)); + } +} + +#include "helpers.hpp" + +#endif // __UCL_GUI_HELPERS_H__ diff --git a/ucl/inc/ucl/gui/helpers.hpp b/ucl/include/ucl/gui/helpers.hpp index 29df283..29df283 100644 --- a/ucl/inc/ucl/gui/helpers.hpp +++ b/ucl/include/ucl/gui/helpers.hpp diff --git a/ucl/inc/ucl/gui/stdTheme.h b/ucl/include/ucl/gui/stdTheme.h index 13202cc..13202cc 100644 --- a/ucl/inc/ucl/gui/stdTheme.h +++ b/ucl/include/ucl/gui/stdTheme.h diff --git a/ucl/inc/ucl/gui/stdTheme/common.h b/ucl/include/ucl/gui/stdTheme/common.h index 7ec81b9..d7537c2 100644 --- a/ucl/inc/ucl/gui/stdTheme/common.h +++ b/ucl/include/ucl/gui/stdTheme/common.h @@ -23,15 +23,36 @@ namespace ucl { // Styles // + /** + * @brief Style that is default for wide range of widgets + */ constexpr ElmStyle STYLE_DEFAULT {"default"}; // Parts // + /** + * @brief Default text part for wide range of widgets + */ constexpr EdjePart PART_TEXT {"elm.text"}; + + /** + * @brief Default title text part for wide range of widgets + */ constexpr EdjePart PART_TITLE {"elm.text.title"}; + /** + * @brief Default content part for wide range of widgets + */ constexpr EdjePart PART_CONTENT {"elm.swallow.content"}; + + /** + * @brief Default icon part for wide range of widgets + */ constexpr EdjePart PART_ICON {"elm.swallow.icon"}; + + /** + * @brief Default button part for wide range of widgets + */ constexpr EdjePart PART_BUTTON {"elm.swallow.button"}; } diff --git a/ucl/inc/ucl/gui/stdTheme/layout.h b/ucl/include/ucl/gui/stdTheme/layout.h index 79ff426..24bc361 100644 --- a/ucl/inc/ucl/gui/stdTheme/layout.h +++ b/ucl/include/ucl/gui/stdTheme/layout.h @@ -21,8 +21,14 @@ namespace ucl { + /** + * @brief Application default layout theme + */ constexpr LayoutTheme LAYOUT_DEFAULT {"layout", "application", "default"}; + /** + * @brief No contents layout theme + */ constexpr LayoutTheme LAYOUT_NO_CONTENTS {"layout", "nocontents", "default"}; } diff --git a/ucl/inc/ucl/gui/stdTheme/naviframe.h b/ucl/include/ucl/gui/stdTheme/naviframe.h index fd99fdc..9c0cc49 100644 --- a/ucl/inc/ucl/gui/stdTheme/naviframe.h +++ b/ucl/include/ucl/gui/stdTheme/naviframe.h @@ -21,6 +21,9 @@ namespace ucl { + /** + * @brief Empty naviframe style (only with content part) + */ constexpr ElmStyle NAVIFRAME_EMPTY {"empty"}; } diff --git a/ucl/inc/ucl/gui/types.h b/ucl/include/ucl/gui/types.h index 6d43d76..03dd8aa 100644 --- a/ucl/inc/ucl/gui/types.h +++ b/ucl/include/ucl/gui/types.h @@ -33,34 +33,70 @@ namespace ucl { // Aspects // + /** + * @brief Represent Edje part name + */ struct EdjePart : Aspect<EdjePart> { using Aspect::Aspect; }; + + /** + * @brief Represent Edje group name + */ struct EdjeGroup : Aspect<EdjeGroup> { using Aspect::Aspect; }; + + /** + * @brief Represent Edje data key name + */ struct EdjeDataKey : Aspect<EdjeDataKey> { using Aspect::Aspect; }; + /** + * @brief Represent Edje signal name + */ struct EdjeSignal : Aspect<EdjeSignal> { using Aspect::Aspect; }; + + /** + * @brief Represent Edje signal source name + */ struct EdjeSignalSrc : Aspect<EdjeSignalSrc> { using Aspect::Aspect; }; + /** + * @brief Represent Elementary widget style name + */ struct ElmStyle : Aspect<ElmStyle> { using Aspect::Aspect; }; + /** + * @brief Represent Evas object smart callback name + */ struct SmartEvent : Aspect<SmartEvent> { using Aspect::Aspect; }; + /** + * @brief Represent Evas object data key name + */ struct EoDataKey : Aspect<EoDataKey> { using Aspect::Aspect; }; // Delegates // + /** + * @brief Handler for events with the Evas object smart callback signature + */ using SmartCbHandler = Delegate<void(Evas_Object *obj, void *eventInfo)>; // WidgetEventHandler // class Widget; + /** + * @brief Handler for Widget standard/smart events + */ using WidgetEventHandler = WeakDelegate<void(Widget &widget, void *eventInfo)>; // WidgetEvent // + /** + * @brief Enumeration of Widget standard events + */ enum class WidgetEvent { - DEL = EVAS_CALLBACK_DEL, + DEL = EVAS_CALLBACK_DEL, MOUSE_IN = EVAS_CALLBACK_MOUSE_IN, MOUSE_OUT = EVAS_CALLBACK_MOUSE_OUT, @@ -94,16 +130,34 @@ namespace ucl { // AtspiGestureEventInfo // + class Atspi; + + /** + * @brief Event info data for ATSPI gesture smart event + */ struct AtspiGestureEventInfo final { Elm_Atspi_Gesture_Info gestureInfo; bool preventDefault; bool stopPropagation; }; + /** + * @brief Handler for Atspi gesture events + */ + using AtspiGestureHandler = WeakDelegate<void(Atspi &atspi, + AtspiGestureEventInfo &eventInfo)>; + + /** + * @brief Callback for Atspi string requesting functions (name, description) + */ + using AtspiStringCb = WeakDelegate<CString(Atspi &atspi)>; + // WidgetARHint // - enum class WidgetARHint - { + /** + * @brief Enumeration of widget aspect ration hints + */ + enum class WidgetARHint { NEITHER = EVAS_ASPECT_CONTROL_NEITHER, HORIZONTAL = EVAS_ASPECT_CONTROL_HORIZONTAL, VERTICAL = EVAS_ASPECT_CONTROL_VERTICAL, @@ -112,19 +166,54 @@ namespace ucl { // LayoutTheme // + /** + * @brief Represents Layout theme description + */ struct LayoutTheme final { + /** + * @brief Name of the widget class + */ const char *klass; + + /** + * @brief Name of the group + */ const char *group; + + /** + * @brief Name of the style + */ const char *style; + /** + * @brief Default constructor + * @details Constructs empty non valid LayoutTheme + */ constexpr LayoutTheme(); + + /** + * @brief Constructor + * @details Same as default constructor + */ constexpr LayoutTheme(std::nullptr_t); + + /** + * @brief Constructor + * @param[in] klass Name of the widget class + * @param[in] group Name of the group + * @param[in] style Name of the style + */ constexpr LayoutTheme(const char *klass, const char *group, const char *style); }; // LayoutTheme non-member functions // + /** + * @brief Checks whether LayoutTheme object is valid + * @param[in] value Reference to target LayoutTheme object + * @return true if valid, false if not valid + */ constexpr bool isValid(const LayoutTheme &value); } diff --git a/ucl/inc/ucl/gui/types.hpp b/ucl/include/ucl/gui/types.hpp index 7f128c8..7f128c8 100644 --- a/ucl/inc/ucl/gui/types.hpp +++ b/ucl/include/ucl/gui/types.hpp diff --git a/ucl/inc/ucl/misc/Aspect.h b/ucl/include/ucl/misc/Aspect.h index 0c55bf6..88c92b6 100644 --- a/ucl/inc/ucl/misc/Aspect.h +++ b/ucl/include/ucl/misc/Aspect.h @@ -21,16 +21,44 @@ namespace ucl { + /** + * @brief Implementation for CHILD aspect + * @details CHILD class must inherit from this template to implement + * specific aspect + */ template <class CHILD> struct Aspect { + /** + * @brief Name of the aspect + */ const char *name; + /** + * @brief Default constructor + * @details Initializes "name" to NULL. + */ constexpr Aspect(); + + /** + * @brief Constructor + * @details Same as default constructor + */ constexpr Aspect(std::nullptr_t); + + /** + * @brief Constructor + * @param[in] name Name for the new aspect or NULL + */ explicit constexpr Aspect(const char *name); + /** + * @brief Returns name of the aspect + */ constexpr operator const char *() const; + /** + * @brief Custom hash functor for Aspect<CHILD> + */ struct Hash final { size_t operator()(const Aspect &key) const; }; @@ -38,11 +66,29 @@ namespace ucl { // Non-member functions // + /** + * @brief Checks validity of the Aspect<CHILD> (name is not NULL) + * @param[in] aspect Target aspect + * @return Validity status. true - valid, false - not valid + */ template <class CHILD> constexpr bool isValid(Aspect<CHILD> aspect); + /** + * @brief Compares equals names of target aspects + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if equal, false - not equal + */ template <class CHILD> constexpr bool operator==(Aspect<CHILD> lhs, Aspect<CHILD> rhs); + + /** + * @brief Compares unequals names of target aspects + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if not equal, false - equal + */ template <class CHILD> constexpr bool operator!=(Aspect<CHILD> lhs, Aspect<CHILD> rhs); } diff --git a/ucl/inc/ucl/misc/Aspect.hpp b/ucl/include/ucl/misc/Aspect.hpp index 9894681..9894681 100644 --- a/ucl/inc/ucl/misc/Aspect.hpp +++ b/ucl/include/ucl/misc/Aspect.hpp diff --git a/ucl/include/ucl/misc/AutoObject.h b/ucl/include/ucl/misc/AutoObject.h new file mode 100644 index 0000000..cb65f9e --- /dev/null +++ b/ucl/include/ucl/misc/AutoObject.h @@ -0,0 +1,137 @@ +/* + * 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 __UCL_MISC_AUTO_OBJECT_H__ +#define __UCL_MISC_AUTO_OBJECT_H__ + +#include "ucl/util/types.h" + +namespace ucl { + + /** + * @brief Resource wrapper for automatically deallocate OBJ_TYPE + * using DEL_FUNC in destructor + */ + template <class OBJ_TYPE, class DEL_RET, DEL_RET(*DEL_FUNC)(OBJ_TYPE)> + struct AutoObject final : ucl::NonCopyable { + /** + * @brief Type of the wrapped object + */ + using ObjType = OBJ_TYPE; + + /** + * @brief Value of the object + */ + OBJ_TYPE obj; + + /** + * @brief Default constructor + * @details Initializes "obj" using value initialization + */ + AutoObject() : + obj{} + { + } + + /** + * @brief Constructor + * @details Same as default constructor + */ + AutoObject(std::nullptr_t) : + AutoObject() + { + } + + /** + * @brief Constructor + * @param[in] obj Source object to wrap + */ + AutoObject(const OBJ_TYPE &obj) : + obj{obj} + { + } + + /** + * @brief Destructor + * @details Calls DEL_FUNC on the object if it explicitly + * casts to "true" + */ + ~AutoObject() + { + if (obj) { + DEL_FUNC(obj); + } + } + + /** + * @brief Move constructor + * @details Source will be in the default constructed state + * @param[in] src Source of the move + */ + AutoObject(AutoObject &&src) : + obj{src.obj} + { + src.obj = {}; + } + + /** + * @brief Assigns one AutoObject to another + * @details Only move assignment is possible. Original will be deleted. + * @param[in] src Source AutoObject + * @return Reference to this AutoObject + */ + AutoObject &operator=(AutoObject src) + { + swap(*this, src); + return *this; + } + + /** + * @brief Returns pointer to "obj" member + * @datails This is unsafe function, avoid using it. May use in + * templates to get the underlying object type. + */ + OBJ_TYPE *operator&() + { + return &obj; + } + + /** + * @brief Returns constant reference to "obj" + */ + operator const OBJ_TYPE &() const + { + return obj; + } + }; + + // Non-member functions // + + /** + * @brief Swaps AutoObject objects with each other + * @param[in/out] x First AutoObject + * @param[in/out] y Second AutoObject + */ + template <class OBJ_TYPE, class DEL_RET, DEL_RET(*DEL_FUNC)(OBJ_TYPE)> + inline void swap(AutoObject<OBJ_TYPE, DEL_RET, DEL_FUNC> &x, + AutoObject<OBJ_TYPE, DEL_RET, DEL_FUNC> &y) noexcept + { + using std::swap; + swap(x.obj, y.obj); + } +} + +#endif // __UCL_MISC_AUTO_HANDLE_H__ diff --git a/ucl/include/ucl/misc/CArray.h b/ucl/include/ucl/misc/CArray.h new file mode 100644 index 0000000..9e5ca11 --- /dev/null +++ b/ucl/include/ucl/misc/CArray.h @@ -0,0 +1,97 @@ +/* + * 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 __UCL_MISC_CARRAY_H__ +#define __UCL_MISC_CARRAY_H__ + +#include "ucl/util/types.h" + +namespace ucl { + + /** + * @brief Simple wrapper for C-Style array of T + */ + template <class T> + struct CArray { + /** + * @brief Data of the array + */ + T *data; + + /** + * @brief Length of the array + */ + int length; + + /** + * @brief Default constructor + * @details Creates empty array + */ + CArray() noexcept; + + /** + * @brief Constructor + * @details Same as default constructor + */ + CArray(std::nullptr_t) noexcept; + + /** + * @brief Checks if array is no empty + * @return true - array is not empty, false - array is empty + */ + explicit operator bool() const noexcept; + }; + + // Non-member functions // + + /** + * @brief Checks validity of the CArray<T> + * @param[in] array Target array + * @return Validity status. true - valid, false - not valid + */ + template <class T> + bool isValid(const CArray<T> &array); + + /** + * @brief Checks emptiness of the CArray<T> + * @param[in] array Target array + * @return Emptiness status. true - empty, false - not empty + */ + template <class T> + bool isEmpty(const CArray<T> &array); + + /** + * @brief Performs destruction of the array and array items + * @param[in] array Target array + * @param[in] itemDelCb Callback which is called to delete each item + */ + template <class T, class ITEM_DEL_CB> + void performDestroy(const CArray<T> &array, ITEM_DEL_CB &&itemDelCb); +} + +namespace ucl { namespace aux { + + /** + * @brief Performs destruction of the array and array items using free + * @param[in] array Target array + */ + template <class T> + void destroyUsingFree(CArray<T> array); +}} + +#include "CArray.hpp" + +#endif // __UCL_MISC_CARRAY_H__ diff --git a/ucl/include/ucl/misc/CArray.hpp b/ucl/include/ucl/misc/CArray.hpp new file mode 100644 index 0000000..28e9974 --- /dev/null +++ b/ucl/include/ucl/misc/CArray.hpp @@ -0,0 +1,71 @@ +/* + * 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. + */ + +namespace ucl { + + template <class T> + inline CArray<T>::CArray() noexcept : + data{nullptr}, + length{0} + { + } + + template <class T> + inline CArray<T>::CArray(std::nullptr_t) noexcept : + CArray() + { + } + + template <class T> + inline CArray<T>::operator bool() const noexcept + { + return !!data; + } + + // Non-member functions // + + template <class T> + inline bool isValid(const CArray<T> &array) + { + return (isEmpty(array) || (array.data && (array.length > 0))); + } + + template <class T> + inline bool isEmpty(const CArray<T> &array) + { + return (array.length == 0); + } + + template <class T, class ITEM_DEL_CB> + inline void performDestroy(const CArray<T> &array, ITEM_DEL_CB &&itemDelCb) + { + if (array.data) { + for (int i = 0; i < array.length; ++i) { + itemDelCb(array.data[i]); + } + free(array.data); + } + } +} + +namespace ucl { namespace aux { + + template <class T> + inline void destroyUsingFree(CArray<T> array) + { + performDestroy(array, ::free); + } +}} diff --git a/ucl/include/ucl/misc/CString.h b/ucl/include/ucl/misc/CString.h new file mode 100644 index 0000000..1704f63 --- /dev/null +++ b/ucl/include/ucl/misc/CString.h @@ -0,0 +1,123 @@ +/* + * 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 __UCL_MISC_CSTRING_H__ +#define __UCL_MISC_CSTRING_H__ + +#include "ucl/util/types.h" + +namespace ucl { + + /** + * @brief Represents managed mutable C-String + */ + class CString final : protected NonCopyable { + public: + /** + * @brief Swaps CString objects with each other + * @param[in/out] x First theme object + * @param[in/out] y Second theme object + */ + friend void swap(CString &x, CString &y) noexcept; + + /** + * @brief Creates new CString object by duplicating source C-String + * @param[in] ptr Pointer to source C-String + * @details New C-String will be freed in destructor. + */ + static CString dup(const char *ptr); + + /** + * @brief Creates new CString object by taking over source C-String + * @param[in] ptr Pointer to source C-String + * @details Source C-String will be freed in destructor. + */ + static CString takeover(char *ptr) noexcept; + + /** + * @brief Defatult constructor + * @details Creates NULL CString object + */ + CString() noexcept; + + /** + * @brief Constructor + * @details Same as default constructor + */ + CString(std::nullptr_t) noexcept; + + /** + * @brief Move constructor + * @details Transfers ownership from source to the new object. + * Source string pointer will become NULL. + * @param[in] s Source CString object + */ + CString(CString &&s) noexcept; + + /** + * @brief Converting constructor + * @details Duplicates source std::string if it is not empty. + * If std::string is empty NULL CString object will be created. + * @param[in] s Source std::string object + */ + CString(const std::string &s); + + /** + * @brief Destructor + * @details Frees C-String pointer if not NULL + */ + ~CString() noexcept; + + /** + * @brief Assigns one CString object to another + * @details Only move assignment is possible. Original will be deleted. + * @param[in] s Source CString object + * @return Reference to this CString object + */ + CString &operator=(CString s) noexcept; + + /** + * @brief Releases this CString object from C-String ownership + * @details This CString object will become NULL + * @return Pointer to underlying C-String + */ + char *release() noexcept; + + /** + * @brief Gets underlying C-String pointer; + * @return Pointer to underlying C-String + */ + char *get() const noexcept; + + private: + explicit CString(char *ptr) noexcept; + + private: + char *m_ptr; + }; + + /** + * @brief Checks whether string is empty + * @details This is equivalent to: isEmpty(s.get()); + * @param[in] s Reference to target CString object + * @return true if empty, false if not empty + */ + bool isEmpty(const CString &s); +} + +#include "CString.hpp" + +#endif // __UCL_MISC_CSTRING_H__ diff --git a/ucl/inc/ucl/misc/CString.hpp b/ucl/include/ucl/misc/CString.hpp index 086b3c2..b7456f3 100644 --- a/ucl/inc/ucl/misc/CString.hpp +++ b/ucl/include/ucl/misc/CString.hpp @@ -67,11 +67,6 @@ namespace ucl { return *this; } - inline bool CString::isEmpty() const - { - return !m_ptr; - } - inline char *CString::release() noexcept { char *const result = m_ptr; @@ -90,4 +85,9 @@ namespace ucl { { std::swap(x.m_ptr, y.m_ptr); } + + inline bool isEmpty(const CString &s) + { + return isEmpty(s.get()); + } } diff --git a/ucl/include/ucl/misc/ConstCString.h b/ucl/include/ucl/misc/ConstCString.h new file mode 100644 index 0000000..51bd3ca --- /dev/null +++ b/ucl/include/ucl/misc/ConstCString.h @@ -0,0 +1,111 @@ +/* + * 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 __UCL_MISC_CONST_CSTRING_H__ +#define __UCL_MISC_CONST_CSTRING_H__ + +#include "CString.h" + +namespace ucl { + + /** + * @brief Represents managed constant C-String + */ + class ConstCString final : protected NonCopyable { + public: + /** + * @brief Swaps ConstCString objects with each other + * @param[in/out] x First theme object + * @param[in/out] y Second theme object + */ + friend void swap(ConstCString &x, ConstCString &y) noexcept; + + /** + * @brief Creates new ConstCString object by wrapping source C-String + * @param[in] ptr Pointer to source C-String + * @details Source C-String will not be freed in destructor. + * Ownership can be transferred only using move constructors. + */ + static ConstCString wrap(const char *ptr) noexcept; + + /** + * @brief Defatult constructor + * @details Creates NULL ConstCString object + */ + ConstCString() noexcept; + + /** + * @brief Constructor + * @details Same as default constructor + */ + ConstCString(std::nullptr_t) noexcept; + + /** + * @brief Move constructor + * @details Transfers ownership from source to the new object. + * Source string pointer will not change. + * @param[in] s Source ConstCString object + */ + ConstCString(ConstCString &&s) noexcept; + + /** + * @brief Move constructor + * @details Transfers ownership from source to the new object. + * Source string pointer will become NULL. + * @param[in] s Source CString object + */ + ConstCString(CString &&s) noexcept; + + /** + * @brief Destructor + * @details Frees C-String pointer if owner + */ + ~ConstCString() noexcept; + + /** + * @brief Assigns one ConstCString object to another + * @details Only move assignment is possible. Original will be deleted. + * @param[in] s Source ConstCString object + * @return Reference to this ConstCString object + */ + ConstCString &operator=(ConstCString s) noexcept; + + /** + * @brief Gets underlying C-String pointer; + * @return Pointer to underlying C-String + */ + const char *get() const noexcept; + + private: + explicit ConstCString(const char *ptr) noexcept; + + private: + const char *m_ptr; + bool m_isOwner; + }; + + /** + * @brief Checks whether string is empty + * @details This is equivalent to: isEmpty(s.get()); + * @param[in] s Reference to target ConstCString object + * @return true if empty, false if not empty + */ + bool isEmpty(const ConstCString &s); +} + +#include "ConstCString.hpp" + +#endif // __UCL_MISC_CONST_CSTRING_H__ diff --git a/ucl/inc/ucl/misc/ConstCString.hpp b/ucl/include/ucl/misc/ConstCString.hpp index 50df605..7089b52 100644 --- a/ucl/inc/ucl/misc/ConstCString.hpp +++ b/ucl/include/ucl/misc/ConstCString.hpp @@ -66,11 +66,6 @@ namespace ucl { return *this; } - inline bool ConstCString::isEmpty() const - { - return !m_ptr; - } - inline const char *ConstCString::get() const noexcept { return m_ptr; @@ -83,4 +78,9 @@ namespace ucl { std::swap(x.m_ptr, y.m_ptr); std::swap(x.m_isOwner, y.m_isOwner); } + + inline bool isEmpty(const ConstCString &s) + { + return isEmpty(s.get()); + } } diff --git a/ucl/include/ucl/misc/Event.h b/ucl/include/ucl/misc/Event.h new file mode 100644 index 0000000..cb72292 --- /dev/null +++ b/ucl/include/ucl/misc/Event.h @@ -0,0 +1,103 @@ +/* + * 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 __UCL_MISC_EVENT_H__ +#define __UCL_MISC_EVENT_H__ + +#include <vector> + +#include "ucl/util/types.h" + +namespace ucl { + + /** + * @brief Implements event dispatching using specified DELEGATE class + */ + template <class DELEGATE> + class Event final { + public: + /** + * @brief Default constructor + */ + Event(); + + /** + * @brief Adds new delegate to the delegate list + * @param[in] delegate Delagate object to add. + * DELEGATE2 must be convertible to DELEGATE + */ + template <class DELEGATE2> + void operator+=(DELEGATE2 &&delegate); + + /** + * @brief Removes existing delegate from the delegate list + * @param[in] delegate Delagate object to add. + * DELEGATE2 must be comparable with DELEGATE + */ + template <class DELEGATE2> + void operator-=(const DELEGATE2 &delegate); + + /** + * @brief Checks if the delegate list is empty + * @return true - the delegate list is empty, false - not empty + */ + bool isEmpty() const; + + /** + * @brief Dispatches event on delegates in list + * @details Delegates are called in order from old to new. If new + * delegates will be added in the dispatch process they will + * be ignored until next dispatch. It is possible to remove + * existing delegate from list. Removed delagate will not be + * invoked. + * @param[in] args Event dispatch arguments + */ + template <class ...ARGS> + void dispatch(ARGS &&...args); + + /** + * @brief Dispatches event on delegates using canceling predecate + * @details Same as dispatch() but with canceling predecate. Predicate + * is called on each delegate invoke with the return result of + * this invoke as single argument or no arguments if return + * type is void. Predicate must return true if dispatch should + * continue or false if it should stop. Result type of the + * predicate may be any object convertible to bool. + * @param[in] args Event dispatch arguments + */ + template <class PREDICATE, class ...ARGS> + void dispatchPred(PREDICATE &&pred, ARGS &&...args); + + private: + template <class DO_INVOKE, class ...ARGS> + void dispatchImpl(const DO_INVOKE &doInvoke, ARGS &&...args); + + void lock(); + void unlock(); + bool isLocked() const; + + void defrag(); + + private: + std::vector<DELEGATE> m_delegates; + int m_lockCount; + bool m_isFragmented; + }; +} + +#include "Event.hpp" + +#endif // __UCL_MISC_EVENT_H__ diff --git a/ucl/inc/ucl/misc/Event.hpp b/ucl/include/ucl/misc/Event.hpp index ed4e402..4e80515 100644 --- a/ucl/inc/ucl/misc/Event.hpp +++ b/ucl/include/ucl/misc/Event.hpp @@ -56,13 +56,13 @@ namespace ucl { void Event<DELEGATE>::operator-=(const DELEGATE2 &delegate) { const auto it = std::find( - m_delegates.begin(), m_delegates.end(), delegate); - if (it != m_delegates.end()) { + m_delegates.rbegin(), m_delegates.rend(), delegate); + if (it != m_delegates.rend()) { if (isLocked()) { *it = {}; m_isFragmented = true; } else { - m_delegates.erase(it); + m_delegates.erase(it.base() - 1); } } } @@ -78,7 +78,7 @@ namespace ucl { void Event<DELEGATE>::dispatch(ARGS &&...args) { dispatchImpl( - [](const DELEGATE &delegate, ARGS &&...args) + [](const typename DELEGATE::LockDelegate &delegate, ARGS &&...args) { delegate(std::forward<ARGS>(args)...); return true; @@ -91,7 +91,8 @@ namespace ucl { void Event<DELEGATE>::dispatchPred(PREDICATE &&pred, ARGS &&...args) { dispatchImpl( - [&pred](const DELEGATE &delegate, ARGS &&...args) + [&pred](const typename DELEGATE::LockDelegate &delegate, + ARGS &&...args) { return impl::doInvokePred(std::forward<PREDICATE>(pred), delegate, std::forward<ARGS>(args)...); @@ -106,8 +107,7 @@ namespace ucl { lock(); const auto size = m_delegates.size(); for (size_t i = 0; i < size; ++i) { - const auto &delegate = m_delegates[i]; - if (delegate) { + if (const auto delegate = m_delegates[i].lock()) { if (!doInvoke(delegate, std::forward<ARGS>(args)...)) { break; } diff --git a/ucl/inc/ucl/misc/HashMap.h b/ucl/include/ucl/misc/HashMap.h index 8470fed..ada832e 100644 --- a/ucl/inc/ucl/misc/HashMap.h +++ b/ucl/include/ucl/misc/HashMap.h @@ -31,17 +31,51 @@ namespace ucl { using VarDict = Dict<Variant>; + /** + * @brief Represents simple to use HashMap collection + * @details Enumerations are supported as KEY type. Custom hashing function + * may be specified for KEY using nested KEY::Hash functor. + */ template <class KEY, class VALUE> class HashMap final { public: + /** + * @brief Sets value with specified key to the map + * @details Overrides existing values + * @param[in] key Key of the value + * @param[in] value Value + * @return Reference to this hashMap object + */ template <class VALUE2> HashMap &set(const KEY &key, VALUE2 &&value); + + /** + * @brief Unsets value with specified key from the map + * @details Removes existing value or do nothing + * @param[in] key Key of the value + * @return Reference to this hashMap object + */ HashMap &unset(const KEY &key); + /** + * @brief Gets value with specified key from the map + * @param[in] key Key of the value + * @param[out] value Existing value if exists + * @return true - if value with key exists, false - not exists + */ template <class VALUE2> bool get(const KEY &key, VALUE2 &value) const; + + /** + * @brief Gets value with specified key from the map + * @param[in] key Key of the value + * @return Existing value if exists, or {} if not exists + */ VALUE get(const KEY &key) const; + /** + * @brief Removes all values from the map + */ void clear(); private: diff --git a/ucl/inc/ucl/misc/HashMap.hpp b/ucl/include/ucl/misc/HashMap.hpp index 2ba4ffd..2ba4ffd 100644 --- a/ucl/inc/ucl/misc/HashMap.hpp +++ b/ucl/include/ucl/misc/HashMap.hpp diff --git a/ucl/include/ucl/misc/MonoObservable.h b/ucl/include/ucl/misc/MonoObservable.h new file mode 100644 index 0000000..dd4c9bf --- /dev/null +++ b/ucl/include/ucl/misc/MonoObservable.h @@ -0,0 +1,114 @@ +/* + * 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 __UCL_MISC_MONO_OBSERVABLE_H__ +#define __UCL_MISC_MONO_OBSERVABLE_H__ + +#include "ucl/util/types.h" + +#include "types.h" + +namespace ucl { + + /** + * @brief Represents observable value of type T by single observer + */ + template <class T> + class MonoObservable final : protected NonCopyable { + public: + /** + * @brief Swaps MonoObservable objects with each other + * @param[in/out] x First theme object + * @param[in/out] y Second theme object + */ + template <class U> + friend void swap(MonoObservable<U> &x, MonoObservable<U> &y) noexcept; + + public: + /** + * @brief Defatult constructor + * @details Value will be initialized with {} + */ + MonoObservable() noexcept; + + /** + * @brief Conversion constructor + * @param[in] value Source value + */ + explicit MonoObservable(T value) noexcept; + + /** + * @brief Constructor + * @param[in] value Source value + * @param[in] handler Observer of the value change + */ + MonoObservable(T value, NotiHandler handler) noexcept; + + /** + * @brief Move constructor + * @param[in] rv Source MonoObservable object + */ + MonoObservable(MonoObservable &&rv) noexcept; + + /** + * @brief Assigns one MonoObservable object to another + * @details Only move assignment is possible. Original will be deleted. + * @param[in] s Source MonoObservable object + * @return Reference to this MonoObservable object + */ + MonoObservable &operator=(MonoObservable v) noexcept; + + /** + * @brief Assigns an observer to this observable + * @param[in] handler Observer delegate (may be empty to remove) + */ + void setObserver(NotiHandler handler) noexcept; + + /** + * @brief Gets value of this observable + * @return Constant reference to the value of this observable + */ + const T &getValue() const noexcept; + + /** + * @brief Casts to the value of this observable + * @return Constant reference to the value of this observable + */ + operator const T &() const noexcept; + + /** + * @brief Assigns new value to this observable + * @param[in] value New value + * @return Reference to this MonoObservable object + */ + MonoObservable &operator=(const T &value); + + /** + * @brief Move-assigns new value to this observable + * @param[in] value New value + * @return Reference to this MonoObservable object + */ + MonoObservable &operator=(T &&value); + + private: + T m_value; + NotiHandler m_onValueChanged; + }; +} + +#include "MonoObservable.hpp" + +#endif // __UCL_MISC_MONO_OBSERVABLE_H__ diff --git a/ucl/include/ucl/misc/MonoObservable.hpp b/ucl/include/ucl/misc/MonoObservable.hpp new file mode 100644 index 0000000..1be4a6b --- /dev/null +++ b/ucl/include/ucl/misc/MonoObservable.hpp @@ -0,0 +1,105 @@ +/* + * 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. + */ + +namespace ucl { + + template <class T> + inline MonoObservable<T>::MonoObservable() noexcept : + m_value{} + { + } + + template <class T> + inline MonoObservable<T>::MonoObservable(T value) noexcept : + m_value{std::move(value)} + { + } + + template <class T> + inline MonoObservable<T>::MonoObservable( + T value, NotiHandler handler) noexcept : + m_value{std::move(value)}, + m_onValueChanged{std::move(handler)} + { + } + + template <class T> + inline MonoObservable<T>::MonoObservable(MonoObservable &&rv) noexcept : + m_value{std::move(rv.m_value)}, + m_onValueChanged{std::move(rv.m_onValueChanged)} + { + rv.m_onValueChanged = {}; + } + + template <class T> + inline MonoObservable<T> & + MonoObservable<T>::operator=(MonoObservable v) noexcept + { + swap(*this, v); + } + + template <class T> + inline void MonoObservable<T>::setObserver(NotiHandler handler) noexcept + { + m_onValueChanged = std::move(handler); + } + + template <class T> + inline const T &MonoObservable<T>::getValue() const noexcept + { + return m_value; + } + + template <class T> + inline MonoObservable<T>::operator const T &() const noexcept + { + return getValue(); + } + + template <class T> + inline MonoObservable<T> &MonoObservable<T>::operator=(const T &value) + { + if (!(value == m_value)) { + m_value = value; + if (const auto handler = m_onValueChanged.lock()) { + handler(); + } + } + return *this; + } + + template <class T> + inline MonoObservable<T> &MonoObservable<T>::operator=(T &&value) + { + if (!(value == m_value)) { + m_value = std::move(value); + if (m_onValueChanged) { + m_onValueChanged(); + } + } + return *this; + } + + // Non-member functions // + + template <class T> + inline void swap(MonoObservable<T> &x, MonoObservable<T> &y) noexcept + { + using std::swap; + swap(x.m_value, y.m_value); + swap(x.m_onValueChanged, y.m_onValueChanged); + } +} diff --git a/ucl/include/ucl/misc/Observable.h b/ucl/include/ucl/misc/Observable.h new file mode 100644 index 0000000..0fc7209 --- /dev/null +++ b/ucl/include/ucl/misc/Observable.h @@ -0,0 +1,112 @@ +/* + * 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 __UCL_MISC_OBSERVABLE_H__ +#define __UCL_MISC_OBSERVABLE_H__ + +#include "types.h" +#include "Event.h" + +namespace ucl { + + /** + * @brief Represents observable value of type T by multiple observers + */ + template <class T> + class Observable final : protected NonCopyable { + public: + /** + * @brief Swaps Observable objects with each other + * @param[in/out] x First theme object + * @param[in/out] y Second theme object + */ + template <class U> + friend void swap(Observable<U> &x, Observable<U> &y) noexcept; + + public: + /** + * @brief Defatult constructor + * @details Value will be initialized with {} + */ + Observable() noexcept; + + /** + * @brief Conversion constructor + * @param[in] value Source value + */ + explicit Observable(T value) noexcept; + + /** + * @brief Move constructor + * @param[in] rv Source Observable object + */ + Observable(Observable &&rv) noexcept; + + /** + * @brief Assigns one Observable object to another + * @details Only move assignment is possible. Original will be deleted. + * @param[in] s Source Observable object + * @return Reference to this Observable object + */ + Observable &operator=(Observable v) noexcept; + + /** + * @brief Adds new observer to this observable + * @param[in] handler Observer delegate + */ + void addObserver(NotiHandler handler); + + /** + * @brief Removes existing observer from this observable + * @param[in] handler Observer delegate + */ + void removeObserver(NotiHandler::CDRef handler); + + /** + * @brief Gets value of this observable + * @return Constant reference to the value of this observable + */ + const T &getValue() const noexcept; + + /** + * @brief Casts to the value of this observable + * @return Constant reference to the value of this observable + */ + operator const T &() const noexcept; + + /** + * @brief Assigns new value to this observable + * @param[in] value New value + * @return Reference to this Observable object + */ + Observable &operator=(const T &value); + + /** + * @brief Move-assigns new value to this observable + * @param[in] value New value + * @return Reference to this Observable object + */ + Observable &operator=(T &&value); + + private: + T m_value; + Event<NotiHandler> m_onValueChanged; + }; +} + +#include "Observable.hpp" + +#endif // __UCL_MISC_OBSERVABLE_H__ diff --git a/ucl/include/ucl/misc/Observable.hpp b/ucl/include/ucl/misc/Observable.hpp new file mode 100644 index 0000000..d79b5e4 --- /dev/null +++ b/ucl/include/ucl/misc/Observable.hpp @@ -0,0 +1,98 @@ +/* + * 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. + */ + +namespace ucl { + + template <class T> + inline Observable<T>::Observable() noexcept : + m_value{} + { + } + + template <class T> + inline Observable<T>::Observable(T value) noexcept : + m_value{std::move(value)} + { + } + + template <class T> + inline Observable<T>::Observable(Observable &&rv) noexcept : + m_value{std::move(rv.m_value)}, + m_onValueChanged{std::move(rv.m_onValueChanged)} + { + rv.m_onValueChanged = {}; + } + + template <class T> + inline Observable<T> &Observable<T>::operator=(Observable v) noexcept + { + swap(*this, v); + } + + template <class T> + inline void Observable<T>::addObserver(NotiHandler handler) + { + m_onValueChanged += std::move(handler); + } + + template <class T> + inline void Observable<T>::removeObserver(NotiHandler::CDRef handler) + { + m_onValueChanged -= handler; + } + + template <class T> + inline const T &Observable<T>::getValue() const noexcept + { + return m_value; + } + + template <class T> + inline Observable<T>::operator const T &() const noexcept + { + return getValue(); + } + + template <class T> + inline Observable<T> &Observable<T>::operator=(const T &value) + { + if (!(value == m_value)) { + m_value = value; + m_onValueChanged.dispatch(); + } + return *this; + } + + template <class T> + inline Observable<T> &Observable<T>::operator=(T &&value) + { + if (!(value == m_value)) { + m_value = std::move(value); + m_onValueChanged.dispatch(); + } + return *this; + } + + // Non-member functions // + + template <class T> + inline void swap(Observable<T> &x, Observable<T> &y) noexcept + { + using std::swap; + swap(x.m_value, y.m_value); + swap(x.m_onValueChanged, y.m_onValueChanged); + } +} diff --git a/ucl/include/ucl/misc/RefCountAware.h b/ucl/include/ucl/misc/RefCountAware.h new file mode 100644 index 0000000..7d2ff6e --- /dev/null +++ b/ucl/include/ucl/misc/RefCountAware.h @@ -0,0 +1,200 @@ +/* + * 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 __UCL_MISC_REF_COUNT_AWARE_H__ +#define __UCL_MISC_REF_COUNT_AWARE_H__ + +#include "ucl/util/types.h" +#include "ucl/util/memory.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(RefCountAware); + + /** + * @brief Base class for objects that aware if they are shared or not + */ + class RefCountAware : protected NonCopyable { + public: + /** + * @brief Returns shared state of the object + * @return true - object is shared, false - no shared + */ + bool isShared() const; + + /** + * @brief Returns count of shared references to this object if shared + * @return Count of shared references (0 on error) + */ + UInt getUseCount() const; + + /** + * @brief Gets pointer to the allocated storage of this object + * @details Matches "this" of the instance's class. + * @return Pointer to the allocated storage of this object + */ + const void *getObjPtr() const; + + /** + * @brief Creates shared reference to T from "this" pointer + * @param[in] thisAlias Pointer to "this" implicitly converted to "T *" + * @return Shared reference to T + */ + template <class T> + SharedRef<T> asSharedThis(T *thisAlias) const; + + /** + * @brief Creates weak reference to T from "this" pointer + * @param[in] thisAlias Pointer to "this" implicitly converted to "T *" + * @return Weak reference to T + */ + template <class T> + WeakRef<T> asWeakThis(T *thisAlias) const; + + protected: + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (may be NULL) + */ + RefCountAware(IRefCountObj *rc); + + /** + * @brief Destructor + */ + ~RefCountAware() = default; + + private: + virtual void polymorphismEnabler() final {} + + public: + // This section MUST be public! + // Signal to RefCountObj<T, C> to pass IRefCountObj to constructor + enum { _IS_REF_COUNT_AWARE }; + + private: + IRefCountObj *const m_rc; + }; + + // Non-member functions // + + /** + * @brief Creates shared reference to specified object + * @param[in] obj Reference to target object + * @return Shared reference to specified object or NULL + */ + template <class T> + SharedRef<T> asShared(T &obj); + + /** + * @brief Creates shared reference to specified object + * @param[in] obj Pointer to target object + * @return Shared reference to specified object or NULL + */ + template <class T> + SharedRef<T> asShared(T *obj); + + /** + * @brief Creates weak reference to specified object + * @param[in] obj Reference to target object + * @return Weak reference to specified object or NULL + */ + template <class T> + WeakRef<T> asWeak(T &obj); + + /** + * @brief Creates weak reference to specified object + * @param[in] obj Pointer to target object + * @return Weak reference to specified object or NULL + */ + template <class T> + WeakRef<T> asWeak(T *obj); + + /** + * @brief Creates shared reference to T from specified object + * @param[in] obj Reference to target object + * @return Shared reference to specified object as T + */ + template <class T, class U, class = typename + std::enable_if<!std::is_same<T, U>::value>::type> + SharedRef<T> asShared(U &obj); + + /** + * @brief Creates shared reference to T from specified object + * @param[in] obj Pointer to target object + * @return Shared reference to specified object as T + */ + template <class T, class U, class = typename + std::enable_if<!std::is_same<T, U>::value>::type> + SharedRef<T> asShared(U *obj); + + /** + * @brief Creates weak reference to T from specified object + * @param[in] obj Reference to target object + * @return Weak reference to specified object as T + */ + template <class T, class U, class = typename + std::enable_if<!std::is_same<T, U>::value>::type> + WeakRef<T> asWeak(U &obj); + + /** + * @brief Creates weak reference to T from specified object + * @param[in] obj Pointer to target object + * @return Weak reference to specified object as T + */ + template <class T, class U, class = typename + std::enable_if<!std::is_same<T, U>::value>::type> + WeakRef<T> asWeak(U *obj); + + /** + * @brief Creates shared reference to T from specified constant object + * @param[in] obj Reference to target constant object + * @return Shared reference to specified constant object as T + */ + template <class T, class U, class = typename + std::enable_if<!std::is_same<T, const U>::value>::type> + SharedRef<const T> asShared(const U &obj); + + /** + * @brief Creates shared reference to T from specified constant object + * @param[in] obj Pointer to target constant object + * @return Shared reference to specified constant object as T + */ + template <class T, class U, class = typename + std::enable_if<!std::is_same<T, const U>::value>::type> + SharedRef<const T> asShared(const U *obj); + + /** + * @brief Creates weak reference to T from specified constant object + * @param[in] obj Reference to target constant object + * @return Weak reference to specified constant object as T + */ + template <class T, class U, class = typename + std::enable_if<!std::is_same<T, const U>::value>::type> + WeakRef<const T> asWeak(const U &obj); + + /** + * @brief Creates weak reference to T from specified constant object + * @param[in] obj Pointer to target constant object + * @return Weak reference to specified constant object as T + */ + template <class T, class U, class = typename + std::enable_if<!std::is_same<T, const U>::value>::type> + WeakRef<const T> asWeak(const U *obj); +} + +#include "RefCountAware.hpp" + +#endif // __UCL_MISC_REF_COUNT_AWARE_H__ diff --git a/ucl/inc/ucl/misc/RefCountAware.hpp b/ucl/include/ucl/misc/RefCountAware.hpp index 8fb3812..8fb3812 100644 --- a/ucl/inc/ucl/misc/RefCountAware.hpp +++ b/ucl/include/ucl/misc/RefCountAware.hpp diff --git a/ucl/include/ucl/misc/TString.h b/ucl/include/ucl/misc/TString.h new file mode 100644 index 0000000..7ce0e8a --- /dev/null +++ b/ucl/include/ucl/misc/TString.h @@ -0,0 +1,164 @@ +/* + * 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 __UCL_MISC_T_STRING_H__ +#define __UCL_MISC_T_STRING_H__ + +#include "ucl/util/types.h" + +namespace ucl { + + /** + * @brief Represents translatable string + */ + class TString final { + public: + /** + * @brief Default constructor + * @datails Creates empty string + */ + TString(); + + /** + * @brief Constructor + * @details Constructs TString from std::string and domain + * @param[in] str Text string or string id if translatable + * @param[in] domain Valid domain name or "" for default domain, + * NULL - if string is not translatable + */ + TString(const std::string &str, const char *domain); + + /** + * @brief Constructor + * @details Constructs TString from std::string + * @param[in] str Text string or string id if translatable. + * @param[in] translatable true - translate using default domain, + * false - if string is not translatable + */ + TString(const std::string &str, bool translatable = false); + + /** + * @brief Constructor + * @details Constructs TString from temporrary std::string and domain + * @param[in] str Temporrary text string or string id if translatable + * @param[in] domain Valid domain name or "" for default domain, + * NULL - if string is not translatable + */ + TString(std::string &&str, const char *domain); + + /** + * @brief Constructor + * @details Constructs TString from temporrary std::string + * @param[in] str Temporrary text string or string id if translatable. + * @param[in] translatable true - translate using default domain, + * false - if string is not translatable + */ + TString(std::string &&str, bool translatable = false); + + /** + * @brief Constructor + * @details Constructs TString from C-String and domain + * @param[in] str Text string or string id if translatable + * @param[in] domain Valid domain name or "" for default domain, + * NULL - if string is not translatable + */ + TString(const char *str, const char *domain); + + /** + * @brief Constructor + * @details Constructs TString from C-String + * @param[in] str Text string or string id if translatable. + * @param[in] translatable true - translate using default domain, + * false - if string is not translatable + */ + TString(const char *str, bool translatable = false); + + /** + * @brief Checks if string is empty + * @return true - if empty, false - if not empty + */ + bool isEmpty() const; + + /** + * @brief Gets translatable state of the string + * @return true - if translatable, false - if not translateable + */ + bool isTranslatable() const; + + /** + * @brief Checks if string has translatable domain + * @return true - if has domain, false - otherwise (domain is NULL) + */ + bool hasDomain() const; + + /** + * @brief Gets translatable domain of the string + * @return Translatable domain of the string, + * "" - default, + * NULL - not translatable + */ + const char *getDomain() const; + + /** + * @brief Gets underlying std::string of the string + * @return Constant reference to the underlying std::string + */ + const std::string &getStr() const; + + /** + * @brief Casts to underlying std::string of the string + * @return Constant reference to the underlying std::string + */ + operator const std::string &() const; + + /** + * @brief Gets C-String of the underlying std::string + * @return Underlying C-String of the underlying std::string + */ + const char *getCStr() const; + + /** + * @brief Casts to C-String of the underlying std::string + * @return Underlying C-String of the underlying std::string + */ + operator const char *() const; + + /** + * @brief Translates the string if translatable + * @return Translated string or original if not translated + */ + const char *translate() const; + + /** + * @brief Formats translation (if translatable) of the string + * @param[in] args Format arguments + * @return Formatted translation (if translatable) of the string + */ + template <typename ...ARGS> + std::string format(ARGS ...args) const; + + private: + const char *doTranslate(const char *strId) const; + + private: + std::string m_str; + const char *m_domain; + }; +} + +#include "TString.hpp" + +#endif // __UCL_MISC_T_STRING_H__ diff --git a/ucl/inc/ucl/misc/TString.hpp b/ucl/include/ucl/misc/TString.hpp index 01c1327..01c1327 100644 --- a/ucl/inc/ucl/misc/TString.hpp +++ b/ucl/include/ucl/misc/TString.hpp diff --git a/ucl/inc/ucl/misc/Timeout.h b/ucl/include/ucl/misc/Timeout.h index 165265c..2f572a6 100644 --- a/ucl/inc/ucl/misc/Timeout.h +++ b/ucl/include/ucl/misc/Timeout.h @@ -26,19 +26,33 @@ namespace ucl { UCL_DECLARE_REF_ALIASES(Timeout); - class Timeout final : public NonCopyable { + /** + * @brief Eecutes specific action after specified timeout + */ + class Timeout final : protected NonCopyable { public: + /** + * @brief Delegate of the timeout action + */ using TimeoutHandler = WeakDelegate<void(Timeout *sender)>; public: - static TimeoutSRef create(double timeoutSec, - const TimeoutHandler &handler); + /** + * @brief Creates new Timeout object + * @param[in] timeoutSec Timeout value in seconds + * @param[in] handler Action of the timeout + * @return Shared reference to new Timeout object + */ + static TimeoutSRef create(double timeoutSec, TimeoutHandler handler); + /** + * @brief Gets expiration status of the timeout + * @return true - timeout is already expired, false - in progress + */ bool isExpired() const; private: - friend class ReffedObj<Timeout>; - Timeout(const TimeoutHandler &handler); + Timeout(TimeoutHandler handler, Private); ~Timeout(); Result prepare(double timeoutSec); @@ -46,8 +60,10 @@ namespace ucl { Eina_Bool onTimer(); private: + const TimeoutHandler m_handler; Ecore_Timer *m_timer; - TimeoutHandler m_handler; + + friend class ReffedObj<Timeout>; }; } diff --git a/ucl/include/ucl/misc/Variant.h b/ucl/include/ucl/misc/Variant.h new file mode 100644 index 0000000..92c4f9b --- /dev/null +++ b/ucl/include/ucl/misc/Variant.h @@ -0,0 +1,404 @@ +/* + * 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 __UCL_MISC_VARIANT_H__ +#define __UCL_MISC_VARIANT_H__ + +#include <array> +#include <vector> +#include <initializer_list> + +#include "ConstCString.h" + +namespace ucl { + + class Variant; + + using VarVector = std::vector<Variant>; + + template <size_t N> + using VarArray = std::array<Variant, N>; + + /** + * @brief Represents value with dynamic type + */ + class Variant final { + public: + /** + * @brief Enumeration of possible value types + */ + enum Type { + TYPE_NIL, + TYPE_BOOLEAN, + TYPE_INTEGER, + TYPE_FLOAT, + TYPE_DOUBLE, + TYPE_STRING, + TYPE_ARRAY + }; + + public: + /** + * @brief Swaps Variant objects with each other + * @param[in/out] x First theme object + * @param[in/out] y Second theme object + */ + friend void swap(Variant &x, Variant &y) noexcept; + + /** + * @brief Compares equals two Variant objects by value + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if equal, false - not equal + */ + friend bool operator==(const Variant &lhs, const Variant &rhs) noexcept; + + /** + * @brief Compares unequals two Variant objects by value + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if not equal, false - equal + */ + friend bool operator!=(const Variant &lhs, const Variant &rhs) noexcept; + + public: + /** + * @brief Default constructor + * @details Creates TYPE_NIL value + */ + Variant() noexcept; + + /** + * @brief Constructor + * @details Same as deafult constructor + */ + Variant(std::nullptr_t) noexcept; + + /** + * @brief Constructor + * @details Creates TYPE_BOOLEAN value + * @param[in] aBool Source value + */ + Variant(bool aBool) noexcept; + + /** + * @brief Constructor + * @details Creates TYPE_INTEGER value + * @param[in] anInt Source value + */ + Variant(int anInt) noexcept; + + /** + * @brief Constructor + * @details Creates TYPE_FLOAT value + * @param[in] aFloat Source value + */ + Variant(float aFloat) noexcept; + + /** + * @brief Constructor + * @details Creates TYPE_DOUBLE value + * @param[in] aDouble Source value + */ + Variant(double aDouble) noexcept; + + /** + * @brief Constructor + * @details Creates TYPE_STRING value + * @param[in] aString NULL-terminated source value + */ + Variant(const char *aString); + + /** + * @brief Constructor + * @details Creates TYPE_STRING value + * @param[in] aString Source value + * @param[in] length Length of the string + */ + Variant(const char *aString, int length); + + /** + * @brief Constructor + * @details Creates TYPE_STRING value + * @param[in] aString Source value + */ + Variant(const std::string &aString); + + /** + * @brief Constructor + * @details Creates TYPE_ARRAY value + * @param[in] <std::nullptr_t> nullptr for all TYPE_NIL elements + * @param[in] arrayLength Length of the array + */ + Variant(std::nullptr_t, int arrayLength); + + /** + * @brief Constructor + * @details Creates TYPE_ARRAY value + * @param[in] anArray Source Variant C-Array + * @param[in] length Length of the array + */ + Variant(const Variant *anArray, int length); + + /** + * @brief Constructor + * @details Creates TYPE_ARRAY value + * @param[in] anArray Source std::vector<Variant> + */ + Variant(const VarVector &anArray); + + /** + * @brief Constructor + * @details Creates TYPE_ARRAY value + * @param[in] anArray Source std::array<Variant, N> + */ + template <size_t N> + Variant(const VarArray<N> &anArray); + + /** + * @brief Constructor + * @details Creates TYPE_ARRAY value + * @param[in] anArray Source std::initializer_list<Variant> + */ + Variant(std::initializer_list<Variant> anArray); + + /** + * @brief Destructor + */ + ~Variant(); + + /** + * @brief Copy constructor + * @param[in] v Source value + */ + Variant(const Variant &v); + + /** + * @brief Move constructor + * @param[in] v Source value + */ + Variant(Variant &&v) noexcept; + + /** + * @brief Assigns one Variant object to another + * @param[in] v Source value + * @return Reference to this Variant object + */ + Variant &operator=(Variant v); + + /** + * @brief Gets type of the variant value + * @return Type of the value + */ + Type getType() const noexcept; + + /** + * @brief Gets lengths of the value + * @return Lengths of string/array, 1 for other types and 0 for TYPE_NIL + */ + int getLength() const noexcept; + + /** + * @brief Checks whether variant is empty + * @details This is equivalent to: (getLength() == 0); + * @return true if empty, false if not empty + */ + bool isEmpty() const noexcept; + + /** + * @brief Reads current variant value as bool + * @return Value of the variant converted to bool: + * as is - for boolean; + * true - (numeric values != 0); + * true - string in case insensitive + * ("true", "yes", "ok", "on", "1"); + * true - (array length != 0); + * false - otherwise + */ + bool asBool() const noexcept; + + /** + * @brief Reads current variant value as int + * @return Value of the variant converted to int: + * static_cast<int>() - all numeric values; + * std::atoi() - for string; + * length - for array; + * 0 - otherwise + */ + int asInt() const noexcept; + + /** + * @brief Reads current variant value as float + * @return Value of the variant converted to float: + * static_cast<float>() - all numeric values; + * static_cast<float>(std::atof()) - for string; + * static_cast<float>(length) - for array; + * 0.0f - otherwise + */ + float asFloat() const noexcept; + + /** + * @brief Reads current variant value as double + * @return Value of the variant converted to double: + * static_cast<double>() - all numeric values; + * std::atof() - for string; + * static_cast<double>(length) - for array; + * 0.0 - otherwise + */ + double asDouble() const noexcept; + + /** + * @brief Reads current variant value as string + * @return Value of the variant converted to string: + * as is - for string + * "true"|"false" - for boolean; + * printf("%d") - integer, array length; + * printf("%f") - float and double; + * "" - otherwise + */ + ConstCString asString() const noexcept; + + /** + * @brief Reads current variant value as Variant C-Array + * @return Value of the variant converted as Variant C-Array + * as is - for array + * this - for simple value + */ + Variant *asArray() noexcept; + + /** + * @brief Reads current variant value as constant Variant C-Array + * @return Value of the variant converted as constant Variant C-Array + * as is - for array + * this - for simple value + */ + const Variant *asArray() const noexcept; + + /** + * @brief Gets begin iterator of this variant as an array + * @return Begin iterator + */ + Variant *begin() noexcept; + + /** + * @brief Gets end iterator of this variant as an array + * @return End iterator + */ + Variant *end() noexcept; + + /** + * @brief Gets begin constant iterator of this variant as an array + * @return Begin constant iterator + */ + const Variant *begin() const noexcept; + + /** + * @brief Gets end constant iterator of this variant as an array + * @return End constant iterator + */ + const Variant *end() const noexcept; + + /** + * @brief Gets indexed element of this variant as an array + * @param[in] index Index of the element + * @return Reference to indexed element + */ + Variant &operator[](int index) noexcept; + + /** + * @brief Gets indexed constant element of this variant as an array + * @param[in] index Index of the element + * @return Reference to indexed constant element + */ + const Variant &operator[](int index) const noexcept; + + /** + * @brief Explicitly casts to bool + * @details Same as asBool() + * @return Value of the variant converted to bool + */ + explicit operator bool() const noexcept; + + /** + * @brief Explicitly casts to int + * @details Same as asInt() + * @return Value of the variant converted to int + */ + explicit operator int() const noexcept; + + /** + * @brief Explicitly casts to float + * @details Same as asFloat() + * @return Value of the variant converted to float + */ + explicit operator float() const noexcept; + + /** + * @brief Explicitly casts to double + * @details Same as asDouble() + * @return Value of the variant converted to double + */ + explicit operator double() const noexcept; + + /** + * @brief Compares equals Variant object type with other type + * @param[in] rhs Right hand side operand + * @return true - if equal, false - not equal + */ + bool operator==(Variant::Type rhs) const noexcept; + + /** + * @brief Compares unequals Variant object type with other type + * @param[in] rhs Right hand side operand + * @return true - if not equal, false - equal + */ + bool operator!=(Variant::Type rhs) const noexcept; + + private: + const char *getStr() const noexcept; + + private: + union { + uint8_t m_type; + struct { + uint64_t qw1; + uint64_t qw2; + } m_raw; + struct { uint8_t type; bool value; } m_aBool; + struct { uint8_t type; int value; } m_anInt; + struct { uint8_t type; float value; } m_aFloat; + struct { uint8_t type; double value; } m_aDouble; + struct { + uint8_t type; + char buffer[sizeof(m_raw) - 1]; + } m_aSmallStr; + struct { + uint8_t type; + int length; + char *data; + } m_aString; + struct { + uint8_t type; + int length; + Variant *data; + } m_anArray; + }; + }; +} + +#include "Variant.hpp" + +#endif // __UCL_MISC_VARIANT_H__ diff --git a/ucl/inc/ucl/misc/Variant.hpp b/ucl/include/ucl/misc/Variant.hpp index fe6d977..a648e29 100644 --- a/ucl/inc/ucl/misc/Variant.hpp +++ b/ucl/include/ucl/misc/Variant.hpp @@ -85,8 +85,8 @@ namespace ucl { { } - inline Variant::Variant(const VarInitList &anArray) : - Variant(anArray.il.begin(), anArray.il.size()) + inline Variant::Variant(std::initializer_list<Variant> anArray) : + Variant(anArray.begin(), anArray.size()) { } diff --git a/ucl/include/ucl/misc/types.h b/ucl/include/ucl/misc/types.h new file mode 100644 index 0000000..adf79dc --- /dev/null +++ b/ucl/include/ucl/misc/types.h @@ -0,0 +1,30 @@ +/* + * 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 __UCL_MISC_TYPES_H__ +#define __UCL_MISC_TYPES_H__ + +#include "ucl/util/smartDelegation.h" + +namespace ucl { + + /** + * @brief Represents delegate to handle simple notification events + */ + using NotiHandler = WeakDelegate<void()>; +} + +#endif // __UCL_MISC_TYPES_H__ diff --git a/ucl/include/ucl/mvp/GuiPresenter.h b/ucl/include/ucl/mvp/GuiPresenter.h new file mode 100644 index 0000000..c2942ef --- /dev/null +++ b/ucl/include/ucl/mvp/GuiPresenter.h @@ -0,0 +1,317 @@ +/* + * 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 __UCL_MVP_GUI_PRESENTER_H__ +#define __UCL_MVP_GUI_PRESENTER_H__ + +#include <unordered_set> + +#include "ucl/gui/Window.h" + +#include "types.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(GuiPresenter); + + /** + * @brief Base class for presenters with GUI + */ + class GuiPresenter : public RefCountAware { + public: + /** + * @brief Information about deactivator that used in events + */ + struct DeactivatorInfo final { + /** + * @brief Deactivator pointer + */ + const void *deactivator; + /** + * @brief true - deactivator was broadcasted, false - otherwise + */ + bool isBroadcast; + }; + + public: + /** + * @brief Gets activation status + * @return true - if presenter is active, false - if not active + */ + bool isActive() const; + + /** + * @brief Checks whether this presenter is deactivated + * by specific deactivator + * @param[in] deactivator Pointer to the target deactivator + * @return true - if deactivated by the deactivator, false - otherwise + */ + bool isDeactivatedBy(const void *deactivator) const; + + /** + * @brief Activates the presenter by specific deactivator + * @details If this presenter was not deactivated by the deactivator + * this function has no effect, otherwise deactivation + * imposed by the deactivator is lifted. Deactivator exception + * does not affect this function. + * @param[in] deactivator Pointer to the target deactivator + */ + void activateBy(const void *deactivator); + + /** + * @brief Deactivates the presenter by specific deactivator + * @details If this presenter is already deactivated by the deactivator + * or listed in the deactivator exception list this function + * has no effect, otherwise this presenter becomes deactivated + * by the deactivator. + * @param[in] deactivator Pointer to the target deactivator + */ + void deactivateBy(const void *deactivator); + + /** + * @brief Registers specific widget as a deactivator source + * @details This presenter will be automatically activated/deactivated + * by the events send by the widget. These events may be send + * directly by the call to sendActivate()/sendDeactivate() + * methods or through parant's deactivator sink. + * @param[in] source Reference to the deactivator source widget + */ + void addDeactivatorSource(Widget &source); + + /** + * @brief Deregisters specific widget as a deactivator source + * @param[in] source Reference to the deactivator source widget + */ + void delDeactivatorSource(Widget &source); + + protected: + /** + * @brief Enumeration of preparation flags + */ + enum { + /** + * @brief Indicates that new presenter needs to be automatically + * activated/deactivated by it's parent or broadcast events + * @details This flag is needed for all presenters that needs to use + * isActive() property, which should be all presenters + * processing user events. Presenters that only display + * information (PASSIVE) does not require this flag. + */ + PF_ADD_DEACTIVATOR_SOURCES = 1, + + /** + * @brief Indicates that new presenter needs to add self to the + * deactivator exception list + * @details This flag is needed for all presenters that emit + * activate/deactivate events (DEACTIVATORs) because there + * is a big chance that this events may return to the + * calling presenter and cause undesired effect. + */ + PF_ADD_SELF_EXCEPT = 2, + + /** + * @brief Helper flag set to use for PASSIVE presenters + */ + PF_PASSIVE = 0, + + /** + * @brief Helper flag set to use for DEACTIVATOR presenters + */ + PF_DEACTIVATOR = (PF_ADD_DEACTIVATOR_SOURCES | PF_ADD_SELF_EXCEPT), + + /** + * @brief Helper flag set to use for not PASSIVE not DEACTIVATOR + * presenters + */ + PF_DEFAULT = PF_ADD_DEACTIVATOR_SOURCES + }; + + protected: + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + */ + GuiPresenter(IRefCountObj &rc); + + /** + * @brief Destructor + */ + ~GuiPresenter(); + + /** + * @brief Prepares this presenter instance as a root presenter + * @details Specified widget must have a Window as a top level parent. + * @param[in] widget Any widget to which tree this presenter + * should belong + * @param[in] flags Preparation flags (optional: PF_DEFAULT) + * @retrun RES_OK on success, error otherwise + */ + Result prepare(ElmWidget &widget, int flags = PF_DEFAULT); + + /** + * @brief Prepares this presenter instance as a child presenter + * @details Parent presenter must have deactivator sink registered + * unless this presenter does not specify + * PF_ADD_DEACTIVATOR_SOURCES flag. + * @param[in] parent Reference to the parent presenter + * @param[in] flags Preparation flags (optional: PF_DEFAULT) + * @retrun RES_OK on success, error otherwise + */ + Result prepare(GuiPresenter &parent, int flags = PF_DEFAULT); + + /** + * @brief Gets reference to the Window widget + * @details If Window was not initialized application will terminate + * with assertion. + */ + Window &getWindow(); + + /** + * @brief Gets shared reference to the Window widget + * @details Use in destructor and check for NULL, because destructor + * is always called event after prepare() failure + * (Window may be not initialized yet). + */ + WindowSRef getWindowRef(); + + /** + * @brief Adds specific deactivator as exception + * @details All deactivating functionality will ignore specified + * deactivator. Note however that this does not cancel any + * deactivation effect that was imposed by this deactivator + * before adding exception. Therefore, activation functionality + * will work fo this deactivator. + * @param[in] deactivator Pointer to the target deactivator + */ + void addDeactivatorException(const void *deactivator); + + /** + * @brief Sets specified widget as deactivator sink fo this presenter + * @details All activate/deactivate actions that occurs on this + * presenter will be send as events on this widget. This + * function needs to be called if this presenter may be a + * parent for other presenters. This will enable propagation of + * activate/deactivate actions from parent to children. + * @param[in] sink Shared reference to the event sink widget + */ + void setDeactivatorSink(const WidgetSRef &sink); + + /** + * @brief Gets deactivator that can be used for self deactivation + * @details Self deactivator pointer is garanteed to be unique and + * unknown for external code. So it is not possible to + * accidentally deactivate this presenter by this deactivator + * from external code. + * @return Pointer to the deactivator + */ + const void *getSelfDeactivator() const; + + /** + * @brief Activates self using self deactivator + */ + void activateSelf(); + + /** + * @brief Deactivates self using self deactivator + */ + void deactivateSelf(); + + /** + * @brief Sends activation event using specified widget sender + * @details All presenters that added this widget as a deactivator + * source will be activate by this event. + * @param[in] sender Reference to sender widgets + */ + void sendActivate(Widget &sender); + + /** + * @brief Sends deactivation event using specified widget sender + * @details All presenters that added this widget as a deactivator + * source will be deactivated by this event. + * @param[in] sender Reference to sender widgets + */ + void sendDeactivate(Widget &sender); + + /** + * @brief Broadcasts activation event + * @details All root presenters with PF_ADD_DEACTIVATOR_SOURCES flag + * will be activate by this event. + */ + void broadcastActivate(); + + /** + * @brief Broadcasts deactivation event + * @details All root presenters with PF_ADD_DEACTIVATOR_SOURCES flag + * will be deactivated by this event. + */ + void broadcastDeactivate(); + + /** + * @brief Occurs when this presenter becomes active + * @details This event occurs after onActivateBy(). + */ + virtual void onActivate(); + + /** + * @brief Occurs when this presenter becomes inactive + * @details This event occurs after onDeactivateBy(). + */ + virtual void onDeactivate(); + + /** + * @brief Occurs when this presenter is first time activated by + * specific deactivator + * @details This event occurs after processing the deactivator sink. + * @param[in] info Deactivator info of the deactivator + */ + virtual void onActivateBy(const DeactivatorInfo &info); + + /** + * @brief Occurs when this presenter is first time deactivated by + * specific deactivator + * @details This event occurs after processing the deactivator sink. + * @param[in] info Deactivator info of the deactivator + */ + virtual void onDeactivateBy(const DeactivatorInfo &info); + + private: + void sendDeactivator(Widget &sender, + SmartEvent event, const void *deactivator); + void broadcastDeactivator(SmartEvent event, + const void *deactivator); + + void sendDeactivatorInfo(Widget &sender, SmartEvent event, + const DeactivatorInfo &info); + + void activateByImpl(const DeactivatorInfo &info); + void deactivateByImpl(const DeactivatorInfo &info); + + void onActivateBySmart(Widget &widget, void *eventInfo); + void onDeactivateBySmart(Widget &widget, void *eventInfo); + + private: + std::unordered_set<const void *> m_deactivatorExceptions; + std::unordered_set<const void *> m_deactivators; + WindowWRef m_window; + WidgetSRef m_sink; + WidgetWRef m_parentSink; + bool m_hasBuildInSources; + bool m_isChild; + bool m_isPrepared; + }; +} + +#endif // __UCL_MVP_GUI_PRESENTER_H__ diff --git a/ucl/include/ucl/mvp/IPickable.h b/ucl/include/ucl/mvp/IPickable.h new file mode 100644 index 0000000..fdd20b9 --- /dev/null +++ b/ucl/include/ucl/mvp/IPickable.h @@ -0,0 +1,45 @@ +/* + * 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 __UCL_MVP_I_PICKABLE_H__ +#define __UCL_MVP_I_PICKABLE_H__ + +#include "IPicker.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(IPickable); + + /** + * @brief Abstract interface for a object that can be picked (selected) + */ + class IPickable : protected NonCopyable { + public: + /** + * @brief Gets IPicker interface to perform picking + * @return Reference to IPicker interface + */ + virtual IPicker &getPicker() = 0; + + protected: + /** + * @brief Destructor + */ + ~IPickable() = default; + }; +} + +#endif // __UCL_MVP_I_PICKABLE_H__ diff --git a/ucl/include/ucl/mvp/IPicker.h b/ucl/include/ucl/mvp/IPicker.h new file mode 100644 index 0000000..4fb6959 --- /dev/null +++ b/ucl/include/ucl/mvp/IPicker.h @@ -0,0 +1,68 @@ +/* + * 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 __UCL_MVP_I_PICKER_H__ +#define __UCL_MVP_I_PICKER_H__ + +#include "IPickerHost.h" + +namespace ucl { + + /** + * @brief Abstract interface to perform picking process on item (selection) + */ + class IPicker : protected NonCopyable { + public: + /** + * @brief Assigns a picker host to this picker + * @details Picker host is handles global activities of + * a picking process + * @param[in] host Weak reference to a IPickerHost implementation + */ + virtual void setPickerHost(IPickerHostWRef host) = 0; + + /** + * @brief Sets a picked state to this picker + * @details This function may not update any related states + * (such as GUI representing a new state). All synchronizations + * need to be performed eternally. + * param[in] isPicked A picked state. true - picked, false - not picked + */ + virtual void setPicked(bool isPicked) = 0; + + /** + * @brief Updates a picked state to this picker + * @details This function is also updates any related states (such as + * GUI representing a new state). + * param[in] isPicked A picked state. true - picked, false - not picked + */ + virtual void updatePicked(bool isPicked) = 0; + + /** + * @brief Gets current picked state of this picker + * @return Current picked state. true - picked, false -not picked. + */ + virtual bool isPicked() const = 0; + + protected: + /** + * @brief Destructor + */ + ~IPicker() = default; + }; +} + +#endif // __UCL_MVP_I_PICKER_H__ diff --git a/ucl/include/ucl/mvp/IPickerHost.h b/ucl/include/ucl/mvp/IPickerHost.h new file mode 100644 index 0000000..9e7cad6 --- /dev/null +++ b/ucl/include/ucl/mvp/IPickerHost.h @@ -0,0 +1,64 @@ +/* + * 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 __UCL_MVP_I_PICKER_HOST_H__ +#define __UCL_MVP_I_PICKER_HOST_H__ + +#include "types.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(IPickerHost); + + /** + * @brief Abstract interface that handles global activities of + * a picking process + */ + class IPickerHost : protected NonCopyable { + public: + /** + * @brief Increments count of picked items + * @details This method must be called whenewer picked state of the + * IPicker changes internally without calls to setPicked() or + * updatePicked() functions (by the user from GUI). + */ + virtual void incrementPickCounter() = 0; + + /** + * @brief Decrements count of picked items + * @details This method must be called whenewer picked state of the + * IPicker changes internally without calls to setPicked() or + * updatePicked() functions (by the user from GUI). + */ + virtual void decrementPickCounter() = 0; + + /** + * @brief Returs pick mode state + * @details None of the modifying function of this iterface must be + * called if pick mode is not active. + * @return Pick mode state. true - active, false - not active. + */ + virtual bool isPickModeActive() const = 0; + + protected: + /** + * @brief Destructor + */ + ~IPickerHost() = default; + }; +} + +#endif // __UCL_MVP_I_PICKER_HOST_H__ diff --git a/ucl/include/ucl/mvp/ListItemPresenter.h b/ucl/include/ucl/mvp/ListItemPresenter.h new file mode 100644 index 0000000..690623e --- /dev/null +++ b/ucl/include/ucl/mvp/ListItemPresenter.h @@ -0,0 +1,401 @@ +/* + * 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 __UCL_MVP_LIST_ITEM_PRESENTER_H__ +#define __UCL_MVP_LIST_ITEM_PRESENTER_H__ + +#include "ucl/gui/GenlistItem.h" +#include "ucl/gui/ElmWidget.h" + +#include "ucl/misc/HashMap.h" + +#include "IPicker.h" + +namespace ucl { + + UCL_DECLARE_REF_ALIASES(ListItemPresenter); + + /** + * @brief Represents presenter of the ListPresenter item + */ + class ListItemPresenter : public RefCountAware, + public IDisposable, + protected IPicker { + public: + /** + * @brief Gets GUI item Access object of the item presenter + * @param[in] item List item presenter + * @return Pointer to Access object or NULL + */ + friend const Elm_Interface_Atspi_Accessible *as_ao( + const ListItemPresenter &item); + + public: + /** + * @brief Updates GUI item of this item + */ + Result updateItem(); + + /** + * @brief Scrolls GUI item of this item to specific position + * with animation + * @param[in] type Scroll type (optional: ELM_GENLIST_ITEM_SCROLLTO_IN) + */ + Result bringInItem(Elm_Genlist_Item_Scrollto_Type type = + ELM_GENLIST_ITEM_SCROLLTO_IN); + + /** + * @brief Scrolls GUI item of this item to specific position + * without animation + * @param[in] type Scroll type (optional: ELM_GENLIST_ITEM_SCROLLTO_IN) + */ + Result showItem(Elm_Genlist_Item_Scrollto_Type type = + ELM_GENLIST_ITEM_SCROLLTO_IN); + + /** + * @brief Sets GUI item Atspi gesture event handler + * @param[in] handler Handler of the event + */ + void setItemAtspiGestureHandler(AtspiGestureHandler handler); + + // IDisposable // + + virtual void dispose() final override; + virtual bool isDisposed() const final override; + + protected: + UCL_DECLARE_REF_ALIASES(ItemClass); + UCL_DECLARE_REF_ALIASES(ItemClassCache); + + /** + * @brief Enumeration of behaviour flags + */ + enum { + /** + * @brief Automatically unselect GUI item in select callback + */ + PF_AUTO_UNSELECT = 1 + }; + + /** + * @brief Information about GUI item that is used when this item is + * inserted into the ListPresenter + */ + struct ItemInsertionParams { + /** + * @brief GUI item style + */ + ElmStyle itemStyle; + + /** + * @brief GUI item type + */ + GenlistItem::Type itemType; + + /** + * @brief Constructor + * @param[in] itemStyle GUI item style + * @param[in] itemType GUI item type + * (optional: GenlistItem::Type::SIMPLE) + */ + ItemInsertionParams(ElmStyle itemStyle, + GenlistItem::Type itemType = GenlistItem::Type::SIMPLE) : + itemStyle(itemStyle), itemType(itemType) {} + }; + + /** + * @brief Information that is used to create GUI for pick mode + */ + struct ItemPickModeParams { + /** + * @brief Part in GUI item for check widget + */ + EdjePart checkPart; + + /** + * @brief Style of the check widget + */ + ElmStyle checkStyle; + + /** + * @brief Enable/disable Atspi support state + */ + bool enableAtspi; + + /** + * @brief Constructor + * @param[in] checkPart Part in GUI item for check widget + * @param[in] checkStyle Style of the check widget + * @param[in] enableAtspi Enable/disable Atspi support state + */ + ItemPickModeParams(EdjePart checkPart, ElmStyle checkStyle, + bool enableAtspi = false) : + checkPart(checkPart), checkStyle(checkStyle), + enableAtspi(enableAtspi) {} + + /** + * @brief Checks validity of data in this structure + * @return true - if valid, false - if not valid + */ + bool isValid() const; + }; + + /** + * @brief Represents GUI item class + */ + class ItemClass final : protected NonCopyable { + public: + /** + * @brief Creates new instance of ItemClass object + * @param[in] itemStyle GUI item style of new item class + */ + static ItemClassSRef newInstance(ElmStyle itemStyle); + + public: + /** + * @brief Gets native Elementary genlist itm class object + * @return Pointer to the underlying Elementary genlist ITC + */ + Elm_Genlist_Item_Class *get(); + + private: + ItemClass(ElmStyle itemStyle, Private); + ~ItemClass(); + private: + Elm_Genlist_Item_Class *const m_itc; + friend class ReffedObj<ItemClass>; + }; + + /** + * @brief Cache storage and factory for ItemClass objects + */ + class ItemClassCache final : protected NonCopyable { + public: + /** + * @brief Gets an instance of ItemClass object (new or from cache) + * @param[in] itemStyle GUI item style of item class + */ + ItemClassSRef getItemClass(ElmStyle itemStyle); + + /** + * Removes all cached objects + */ + void purge(); + + private: + HashMap<ElmStyle, ItemClassSRef> m_itcMap; + }; + + protected: + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + */ + ListItemPresenter(IRefCountObj &rc); + + /** + * @brief Destructor + */ + ~ListItemPresenter(); + + /** + * @brief Sets behaviour flags to this item presenter + * @param[in] flags New behaviour flags + */ + void setFlags(int flags); + + /** + * @brief Gets behaviour flags from this item presenter + * @return Current behaviour flags + */ + int getFlags() const; + + /** + * @brief Gets activation status of this item presenter + * @return true - if presenter is active, false - if not active + */ + bool isActive() const; + + /** + * @brief Gets pick mode activation status + * @return true - active, false - not active + */ + bool isPickModeActive() const; + + /** + * @brief Handles item pick event + * @param[in] isPicked New item picked state. + * true - picked, false - not picked + */ + void handleItemPick(bool isPicked); + + /** + * @brief Gets attached GUI item of this item presenter + * @return Attached GUI item + */ + GenlistItem getItem(); + + /** + * @brief Gets Atspi of attached GUI item of this presenter + * @return Pointer to Atspi of attached GUI item or NULL + */ + Atspi *getItemAtspi(); + + /** + * @brief Gets constant Atspi of attached GUI item of this presenter + * @return Pointer to Constant Atspi of attached GUI item or NULL + */ + const Atspi *getItemAtspi() const; + + /** + * @brief Gets attached GUI item class cache of this item presenter + * @return Attached GUI item class cache + */ + ItemClassCache *getItemClassCache(); + + /** + * @brief Updates GUI item style + * @details Internally uses item class cache to get GUI item class for + * specified GUI item style. + * @param[in] newItemStyle New GUI item style to apply + * @return RES_OK on success, error otherwise + */ + Result updateItemStyle(ElmStyle newItemStyle); + + /** + * @brief Creates GUI item part content for pick mode if in pick mode + * @param[in] part Edje part for which to try create the content widget + * @param[in] parent Parent widget to use for the content widget + * @param[in] params Parameters for the content widget creation + * @return Shared reference to the content widget or NULL + */ + WidgetSRef tryCreatePickModeItemPartContent( + EdjePart part, ElmWidget &parent, + const ItemPickModeParams ¶ms); + + /** + * @brief Gets GUI item insertion parameters + * @details Called just before item is added to list + * @return Item insertion params structure + */ + virtual ItemInsertionParams getItemInsertionParams() = 0; + + /** + * @brief Occurs when GUI item is attached to this item presenter + * @details Called after getItemInsertionParams() at the end of + * item to list addition process. + */ + virtual void onItemAttached(); + + /** + * @brief Occurs when GUI item is detached from this item presenter + * @details Called when GUI item is removed. + */ + virtual void onItemDetached(); + + /** + * @brief Gets text for specific GUI item part + * @param[in] part Target GUI item part + * @return Text for specific part or NULL + */ + virtual CString getItemPartText(EdjePart part); + + /** + * @brief Gets the content widget for specific GUI item part + * @param[in] part Target GUI item part + * @param[in] parent Parent widget to use for the content widget + * @return Shared reference to the content widget or NULL + */ + virtual WidgetSRef getItemPartContent(EdjePart part, ElmWidget &parent); + + /** + * @brief Gets state for specific GUI item part + * @param[in] part Target GUI item part + * @return State of the part + */ + virtual bool getItemPartState(EdjePart part); + + /** + * @brief Occurs when GUI item is selected + */ + virtual void onItemSelected(); + + /** + * @brief Occurs when GUI item is realized + */ + virtual void onItemRealized(); + + /** + * @brief Occurs when GUI item is unrealized + */ + virtual void onItemUnrealized(); + + /** + * @brief Occurs when GUI item is highlighted + */ + virtual void onItemHighlighted(); + + /** + * @brief Occurs when GUI item is unhighlighted + */ + virtual void onItemUnhighlighted(); + + /** + * @brief Occurs when GUI item is long pressed + */ + virtual void onItemLongpressed(); + + // IPicker // + + virtual void setPickerHost(IPickerHostWRef host) final override; + virtual void setPicked(bool isPicked) final override; + virtual void updatePicked(bool isPicked) final override; + virtual bool isPicked() const final override; + + private: + void attachItem(GenlistItem item, ElmWidgetSRef parent, + ItemClassCacheSRef itcCache, SharedRef<bool> isActiveRef); + + void deleteDetachedItem(bool silent = false); + void detachItem(bool silent = false); + void tryEnsureItemAtspi(); + void tryListenToItemAtspiGesture(); + + void onPickCheckChanged(Widget &widget, void *eventInfo); + void onItemSelectedHook(); + void onItemDel(Evas_Object *obj, void *eventInfo); + void onItemAtspiGesture(Atspi &atspi, AtspiGestureEventInfo &eventInfo); + + private: + ListItemPresenterSRef m_selfRef; + IPickerHostWRef m_pickerHost; + AtspiGestureHandler m_itemAtspiGestureHandler; + + GenlistItem m_item; + AtspiSRef m_itemAtspi; + ElmWidgetSRef m_parent; + ItemClassCacheSRef m_itcCache; + SharedRef<bool> m_isActiveRef; + + int m_flags; + bool m_isItemPicked; + bool m_isListeningToItemAtspiGesture; + + friend class ListPresenter; + }; +} + +#endif // __UCL_MVP_LIST_ITEM_PRESENTER_H__ diff --git a/ucl/inc/ucl/mvp/ListPresenter.h b/ucl/include/ucl/mvp/ListPresenter.h index 1d62e41..1415c05 100644 --- a/ucl/inc/ucl/mvp/ListPresenter.h +++ b/ucl/include/ucl/mvp/ListPresenter.h @@ -26,26 +26,94 @@ namespace ucl { UCL_DECLARE_REF_ALIASES(ListPresenter); + /** + * @brief Represents presenter of item list using Genlist widget + */ class ListPresenter final : public GuiPresenter { public: + /** + * @brief Enumeration of build flags + */ enum { + /** + * @brief Need to apply homogeneous mode to genlist + */ FLAG_HOMOGENEOUS = (1 << 0), + + /** + * @brief Need to calculate X min size hint for genlist + */ FLAG_CALC_X_MIN = (1 << 1), + + /** + * @brief Need to calculate Y min size hint for genlist + */ FLAG_CALC_Y_MIN = (1 << 2), + /** + * @brief Need to notify item realized event + */ FLAG_NOTIFY_REALIZED = (1 << 8), + + /** + * @brief Need to notify item unrealized event + */ FLAG_NOTIFY_UNREALIZED = (1 << 9), + + /** + * @brief Need to notify item highlighted event + */ FLAG_NOTIFY_HIGHLIGHTED = (1 << 10), + + /** + * @brief Need to notify item unhighlighted event + */ FLAG_NOTIFY_UNHIGHLIGHTED = (1 << 11), + + /** + * @brief Need to notify item long pressed event + */ + FLAG_NOTIFY_LONGPRESSED = (1 << 12), }; + /** + * @brief Builder of ListPresenter objects + */ class Builder final { public: + /** + * @brief Constructor + */ Builder(); + + /** + * @brief Sets genlist style of the future object + * @param[in] style Genlist Style of the future object + * @return Reference to this builder + */ Builder &setStyle(ElmStyle style); + + /** + * @brief Sets build flags for the future object + * @param[in] flags Build flags for the future object + * @return Reference to this builder + */ Builder &setFlags(int flags); + + /** + * @brief Sets genlist parent widget of the future object + * @param[in] parentWidget Genlist parent widget + * @return Reference to this builder + */ Builder &setParentWidget(const ElmWidgetSRef &parentWidget); + + /** + * @brief Creates new ListPresenter object using current parameters + * @param[in] parent Reference to parent presenter + * @return Shared reference to new ListPresenter object or NULL + */ ListPresenterSRef build(GuiPresenter &parent) const; + private: ucl::ElmWidgetSRef m_parentWidget; ElmStyle m_style; @@ -53,31 +121,64 @@ namespace ucl { }; public: + /** + * @brief Gets underlying genlist widget + * @return Reference to the Genlist object + */ Genlist &getWidget(); + /** + * @brief Removes all items from the list + */ void clear(); + /** + * @brief Appends an item to the list + * @param[in] itemPresenter Reference to the target item + * @param[in] parent Parent item (optional) + * @return RES_OK on success, error otherwise + */ Result append(ListItemPresenter &itemPresenter, ListItemPresenter *parent = nullptr); + /** + * @brief Prepends an item to the list + * @param[in] itemPresenter Reference to the target item + * @param[in] parent Parent item (optional) + * @return RES_OK on success, error otherwise + */ Result prepend(ListItemPresenter &itemPresenter, ListItemPresenter *parent = nullptr); + /** + * @brief Inserts an item to the list after specific item in this list + * @param[in] after Reference to the "after" item + * @param[in] itemPresenter Reference to the target item + * @param[in] parent Parent item (optional) + * @return RES_OK on success, error otherwise + */ Result insertAfter(const ListItemPresenter &after, ListItemPresenter &itemPresenter, ListItemPresenter *parent = nullptr); + /** + * @brief Inserts an item to the list before specific item in this list + * @param[in] before Reference to the "before" item + * @param[in] itemPresenter Reference to the target item + * @param[in] parent Parent item (optional) + * @return RES_OK on success, error otherwise + */ Result insertBefore(const ListItemPresenter &before, ListItemPresenter &itemPresenter, ListItemPresenter *parent = nullptr); private: - friend class ReffedObj<ListPresenter>; - ListPresenter(IRefCountObj &rc); - virtual ~ListPresenter(); + ListPresenter(IRefCountObj &rc, Private); + ~ListPresenter(); Result prepare(GuiPresenter &parent, ElmWidget &parentWidget, ElmStyle style, int flags); + void registerItemEvents(int flags); template <class INSERT_FUNC> Result insert(ListItemPresenter &itemPresenter, @@ -97,6 +198,7 @@ namespace ucl { void onItemUnrealized(Widget &widget, void *eventInfo); void onItemHighlighted(Widget &widget, void *eventInfo); void onItemUnhighlighted(Widget &widget, void *eventInfo); + void onItemLongpressed(Widget &widget, void *eventInfo); // GuiPresenter // @@ -107,6 +209,8 @@ namespace ucl { GenlistSRef m_genlist; ListItemPresenter::ItemClassCacheSRef m_itcCache; SharedRef<bool> m_isActiveRef; + + friend class ReffedObj<ListPresenter>; }; } diff --git a/ucl/inc/ucl/mvp/types.h b/ucl/include/ucl/mvp/types.h index 6c263e2..6c263e2 100644 --- a/ucl/inc/ucl/mvp/types.h +++ b/ucl/include/ucl/mvp/types.h diff --git a/ucl/inc/ucl/util/delegation.h b/ucl/include/ucl/util/delegation.h index a624c08..a624c08 100644 --- a/ucl/inc/ucl/util/delegation.h +++ b/ucl/include/ucl/util/delegation.h diff --git a/ucl/inc/ucl/util/delegation/BaseDelegate.h b/ucl/include/ucl/util/delegation/BaseDelegate.h index 62b92ff..11805b9 100644 --- a/ucl/inc/ucl/util/delegation/BaseDelegate.h +++ b/ucl/include/ucl/util/delegation/BaseDelegate.h @@ -27,32 +27,96 @@ namespace ucl { template <class FUNC_SIG, class DATA> class BaseDelegate2; + /** + * @brief Base class for implementing delegates with 1 function stub + */ template <class R, class ...ARGS, class DATA> class BaseDelegate<R(ARGS...), DATA> { public: + /** + * @brief Callback of this delegate + */ using Cb = Callback<R(ARGS...)>; + + /** + * @brief StubA function pointer type of this delegate + */ using StubA = typename Cb::StubA; public: + /** + * @brief Default constructor + * @details Creates NULL delegate + */ constexpr BaseDelegate() noexcept; + + /** + * @brief Constructor + * @details Safe as default constructor + */ constexpr BaseDelegate(std::nullptr_t) noexcept; + /** + * @brief Conversion constructor from BaseDelegate2 + * @param[in] d Source delegate + */ template <class FUNC_SIG> BaseDelegate(const BaseDelegate2<FUNC_SIG, DATA> &d) noexcept; + + /** + * @brief Conversion move constructor from BaseDelegate2 + * @param[in] d Source delegate + */ template <class FUNC_SIG> BaseDelegate(BaseDelegate2<FUNC_SIG, DATA> &&d) noexcept; + /** + * @brief Resets this delegate to NULL + */ void reset() noexcept; + /** + * @brief Gets bound object data pointer + * @details May be used to invoke this delegate from C code. + * @return Bound object data pointer + */ const DATA &getData() const noexcept; + + /** + * @brief Gets bound StubA function pointer + * @details May be used to invoke this delegate from C code. + * @return Pointer to bound StubA function + */ StubA getStubA() const noexcept; - operator bool() const noexcept; + + /** + * @brief Checks if this delegate is not NULL + * @return true - if not NULL, false - if NULL + */ + explicit operator bool() const noexcept; protected: - BaseDelegate(const DATA &data, StubA stubA) noexcept; + /** + * @brief Constructor + * @param[in] data Object data pointer + * @param[in] stubA StubA function pointer + */ + BaseDelegate(DATA data, StubA stubA) noexcept; + + /** + * @brief Destructor + */ + ~BaseDelegate() = default; protected: + /** + * @brief Bound object data pointer + */ DATA m_data; + + /** + * @brief Bound StubA function pointer + */ StubA m_stubA; }; } diff --git a/ucl/inc/ucl/util/delegation/BaseDelegate.hpp b/ucl/include/ucl/util/delegation/BaseDelegate.hpp index f25c0a7..2f7544f 100644 --- a/ucl/inc/ucl/util/delegation/BaseDelegate.hpp +++ b/ucl/include/ucl/util/delegation/BaseDelegate.hpp @@ -32,8 +32,8 @@ namespace ucl { template <class R, class ...ARGS, class DATA> inline BaseDelegate<R(ARGS...), DATA>:: - BaseDelegate(const DATA &data, StubA stubA) noexcept : - m_data(data), + BaseDelegate(DATA data, StubA stubA) noexcept : + m_data(std::move(data)), m_stubA(stubA) { } diff --git a/ucl/inc/ucl/util/delegation/BaseDelegate2.h b/ucl/include/ucl/util/delegation/BaseDelegate2.h index ff3b635..c47d611 100644 --- a/ucl/inc/ucl/util/delegation/BaseDelegate2.h +++ b/ucl/include/ucl/util/delegation/BaseDelegate2.h @@ -24,23 +24,56 @@ namespace ucl { template <class FUNC_SIG, class DATA> class BaseDelegate2; + /** + * @brief Base class for implementing delegates with 2 function stub + */ template <class R, class ...ARGS, class DATA> class BaseDelegate2<R(ARGS...), DATA> : public BaseDelegate<R(ARGS...), DATA> { public: + /** + * @brief Callback of this delegate + */ using Cb = typename BaseDelegate2::Cb; + + /** + * @brief StubA function pointer type of this delegate + */ using StubA = typename Cb::StubA; + + /** + * @brief StubB function pointer type of this delegate + */ using StubB = typename Cb::StubB; public: using BaseDelegate<R(ARGS...), DATA>::BaseDelegate; + /** + * @brief Gets bound StubB function pointer + * @details May be used to invoke this delegate from C code. + * @return Pointer to bound StubB function + */ StubB getStubB() const noexcept; protected: - BaseDelegate2(const DATA &data, StubA stubA, StubB stubB) noexcept; + /** + * @brief Constructor + * @param[in] data Object data pointer + * @param[in] stubA StubA function pointer + * @param[in] stubB StubB function pointer + */ + BaseDelegate2(DATA data, StubA stubA, StubB stubB) noexcept; + + /** + * @brief Destructor + */ + ~BaseDelegate2() = default; private: + /** + * @brief Bound StubB function pointer + */ StubB m_stubB; }; } diff --git a/ucl/inc/ucl/util/delegation/BaseDelegate2.hpp b/ucl/include/ucl/util/delegation/BaseDelegate2.hpp index 6d8efa7..82c2333 100644 --- a/ucl/inc/ucl/util/delegation/BaseDelegate2.hpp +++ b/ucl/include/ucl/util/delegation/BaseDelegate2.hpp @@ -18,8 +18,8 @@ namespace ucl { template <class R, class ...ARGS, class DATA> inline BaseDelegate2<R(ARGS...), DATA>:: - BaseDelegate2(const DATA &data, StubA stubA, StubB stubB) noexcept : - BaseDelegate<R(ARGS...), DATA>(data, stubA), + BaseDelegate2(DATA data, StubA stubA, StubB stubB) noexcept : + BaseDelegate<R(ARGS...), DATA>(std::move(data), stubA), m_stubB(stubB) { } diff --git a/ucl/include/ucl/util/delegation/Callback.h b/ucl/include/ucl/util/delegation/Callback.h new file mode 100644 index 0000000..76a7345 --- /dev/null +++ b/ucl/include/ucl/util/delegation/Callback.h @@ -0,0 +1,179 @@ +/* + * 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 __UCL_UTIL_DELEGATION_CALLBACK_H__ +#define __UCL_UTIL_DELEGATION_CALLBACK_H__ + +#include "ucl/util/types/baseTypes.h" + +namespace ucl { + + template <class FUNC_SIG> + class Callback; + + /** + * @brief Generates function stubs to use in callbacks and delegates + */ + template <class R, class ...ARGS> + class Callback<R(ARGS...)> { + public: + /** + * @brief StubA function pointer type + * @details This function takes data argument as first parameter + */ + using StubA = R(*)(void *, ARGS...); + + /** + * @brief StubB function pointer type + * @details This function takes data argument as last parameter + */ + using StubB = R(*)(ARGS..., void *); + + public: + /** + * @brief Wraps instance method as StubA + * @param[in] data This pointer of the instance + * @param[in] args Method arguments + * @return R Result of the method call + */ + template <class CLASS, R(CLASS::*METHOD)(ARGS...)> + static R stubA(void *data, ARGS ...args); + + /** + * @brief Wraps instance method as StubB + * @param[in] args Method arguments + * @param[in] data This pointer of the instance + * @return R Result of the method call + */ + template <class CLASS, R(CLASS::*METHOD)(ARGS...)> + static R stubB(ARGS ...args, void *data); + + /** + * @brief Wraps constant instance method as StubA + * @param[in] data This pointer of the instance + * @param[in] args Method arguments + * @return R Result of the method call + */ + template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> + static R stubA(void *data, ARGS ...args); + + /** + * @brief Wraps constant instance method as StubB + * @param[in] args Method arguments + * @param[in] data This pointer of the instance + * @return R Result of the method call + */ + template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> + static R stubB(ARGS ...args, void *data); + + /** + * @brief Wraps StubA-style function taking object as StubA + * @param[in] data Pointer of the object + * @param[in] args Function arguments + * @return R Result of the function call + */ + template <class CLASS, R(*FUNC)(CLASS &, ARGS...)> + static R stubA2A(void *data, ARGS ...args); + + /** + * @brief Wraps StubA-style function taking object as StubB + * @param[in] args Function arguments + * @param[in] data Pointer of the object + * @return R Result of the function call + */ + template <class CLASS, R(*FUNC)(CLASS &, ARGS...)> + static R stubB2A(ARGS ...args, void *data); + + /** + * @brief Wraps StubB-style function taking object as StubA + * @param[in] data Pointer of the object + * @param[in] args Function arguments + * @return R Result of the function call + */ + template <class CLASS, R(*FUNC)(ARGS..., CLASS &)> + static R stubA2B(void *data, ARGS ...args); + + /** + * @brief Wraps StubB-style function taking object as StubB + * @param[in] args Function arguments + * @param[in] data Pointer of the object + * @return R Result of the function call + */ + template <class CLASS, R(*FUNC)(ARGS..., CLASS &)> + static R stubB2B(ARGS ...args, void *data); + + /** + * @brief Wraps StubA-style function taking object handle as StubA + * @param[in] data Handle of the object + * @param[in] args Function arguments + * @return R Result of the function call + */ + template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)> + static R stubA2A(void *data, ARGS ...args); + + /** + * @brief Wraps StubA-style function taking object handle as StubB + * @param[in] args Function arguments + * @param[in] data Handle of the object + * @return R Result of the function call + */ + template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)> + static R stubB2A(ARGS ...args, void *data); + + /** + * @brief Wraps StubB-style function taking object handle as StubA + * @param[in] data Handle of the object + * @param[in] args Function arguments + * @return R Result of the function call + */ + template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)> + static R stubA2B(void *data, ARGS ...args); + + /** + * @brief Wraps StubB-style function taking object handle as StubB + * @param[in] args Function arguments + * @param[in] data Handle of the object + * @return R Result of the function call + */ + template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)> + static R stubB2B(ARGS ...args, void *data); + + /** + * @brief Wraps static function as StubA + * @param[in] data Not used + * @param[in] args Function arguments + * @return R Result of the function call + */ + template <R(*FUNC)(ARGS...)> + static R stubA2V(void *data, ARGS ...args); + + /** + * @brief Wraps static function as StubB + * @param[in] args Function arguments + * @param[in] data Not used + * @return R Result of the function call + */ + template <R(*FUNC)(ARGS...)> + static R stubB2V(ARGS ...args, void *data); + + private: + Callback() = delete; + }; +} + +#include "Callback.hpp" + +#endif // __UCL_UTIL_DELEGATION_CALLBACK_H__ diff --git a/ucl/inc/ucl/util/delegation/Callback.hpp b/ucl/include/ucl/util/delegation/Callback.hpp index 28d2145..28d2145 100644 --- a/ucl/inc/ucl/util/delegation/Callback.hpp +++ b/ucl/include/ucl/util/delegation/Callback.hpp diff --git a/ucl/include/ucl/util/delegation/Delegate.h b/ucl/include/ucl/util/delegation/Delegate.h new file mode 100644 index 0000000..9243ef6 --- /dev/null +++ b/ucl/include/ucl/util/delegation/Delegate.h @@ -0,0 +1,117 @@ +/* + * 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 __UCL_UTIL_DELEGATION_DELEGATE_H__ +#define __UCL_UTIL_DELEGATION_DELEGATE_H__ + +#include "BaseDelegate.h" + +namespace ucl { + + template <class FUNC_SIG> + class Delegate; + + /** + * @brief Delegate that uses "void *" as data pointer + */ + template <class R, class ...ARGS> + class Delegate<R(ARGS...)> : public BaseDelegate<R(ARGS...), void *> { + public: + /** + * @brief Result delegate of the lock() method + */ + using LockDelegate = Delegate; + + public: + using BaseDelegate<R(ARGS...), void *>::BaseDelegate; + + /** + * @brief Locks this delegate before further invoke + * @details This function simply returns copy of this delegate. + * Provided for interface compatibility with other delegate + * types. + * @return Lock delegate + */ + LockDelegate lock() const; + + /** + * @brief Invokes this delegate + * @details Delgates must be checked for NULL before invoke. + * @params[in] args Arguments of the invoke + * @return Result of the invoke + */ + R operator()(ARGS ...args) const; + + /** + * @brief Creates delegate to instance method + * @param[in] data This pointer of the instance + * @return Created delegate + */ + template <class CLASS, R(CLASS::*METHOD)(ARGS...)> + static Delegate make(CLASS *data) noexcept; + + /** + * @brief Creates delegate to constant instance method + * @param[in] data Constant this pointer of the instance + * @return Created delegate + */ + template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> + static Delegate make(const CLASS *data) noexcept; + + /** + * @brief Creates delegate to StubA-style function taking object + * @param[in] data Pointer of the object + * @return Created delegate + */ + template <class CLASS, R(*FUNC)(CLASS &, ARGS...)> + static Delegate makeA(CLASS *data) noexcept; + + /** + * @brief Creates delegate to StubB-style function taking object + * @param[in] data Pointer of the object + * @return Created delegate + */ + template <class CLASS, R(*FUNC)(ARGS..., CLASS &)> + static Delegate makeB(CLASS *data) noexcept; + + /** + * @brief Creates delegate to StubA-style function taking object handle + * @param[in] data Handle of the object + * @return Created delegate + */ + template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)> + static Delegate makeA(HANDLE data) noexcept; + + /** + * @brief Creates delegate to StubB-style function taking object handle + * @param[in] data Handle of the object + * @return Created delegate + */ + template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)> + static Delegate makeB(HANDLE data) noexcept; + + /** + * @brief Creates delegate to static function + * @return Created delegate + */ + template <R(*FUNC)(ARGS...)> + static Delegate make() noexcept; + }; +} + +#include "Delegate.hpp" + +#endif // __UCL_UTIL_DELEGATION_DELEGATE_H__ diff --git a/ucl/inc/ucl/util/delegation/Delegate.hpp b/ucl/include/ucl/util/delegation/Delegate.hpp index 632ec24..18d1228 100644 --- a/ucl/inc/ucl/util/delegation/Delegate.hpp +++ b/ucl/include/ucl/util/delegation/Delegate.hpp @@ -17,6 +17,13 @@ namespace ucl { template <class R, class ...ARGS> + inline typename Delegate<R(ARGS...)>::LockDelegate + Delegate<R(ARGS...)>::lock() const + { + return *this; + } + + template <class R, class ...ARGS> inline R Delegate<R(ARGS...)>::operator()(ARGS ...args) const { return this->m_stubA(this->m_data, std::forward<ARGS>(args)...); @@ -43,18 +50,18 @@ namespace ucl { template <class R, class ...ARGS> template <class CLASS, R(*FUNC)(CLASS &, ARGS...)> inline Delegate<R(ARGS...)> - Delegate<R(ARGS...)>::makeA(CLASS &data) noexcept + Delegate<R(ARGS...)>::makeA(CLASS *data) noexcept { - return {const_cast<void *>(static_cast<const void *>(&data)), + return {const_cast<void *>(static_cast<const volatile void *>(data)), Delegate::Cb::template stubA2A<CLASS, FUNC>}; } template <class R, class ...ARGS> template <class CLASS, R(*FUNC)(ARGS..., CLASS &)> inline Delegate<R(ARGS...)> - Delegate<R(ARGS...)>::makeB(CLASS &data) noexcept + Delegate<R(ARGS...)>::makeB(CLASS *data) noexcept { - return {const_cast<void *>(static_cast<const void *>(&data)), + return {const_cast<void *>(static_cast<const volatile void *>(data)), Delegate::Cb::template stubA2B<CLASS, FUNC>}; } @@ -63,7 +70,7 @@ namespace ucl { inline Delegate<R(ARGS...)> Delegate<R(ARGS...)>::makeA(const HANDLE data) noexcept { - return {const_cast<void *>(static_cast<const void *>(data)), + return {const_cast<void *>(static_cast<const volatile void *>(data)), Delegate::Cb::template stubA2A<HANDLE, FUNC>}; } @@ -72,7 +79,7 @@ namespace ucl { inline Delegate<R(ARGS...)> Delegate<R(ARGS...)>::makeB(const HANDLE data) noexcept { - return {const_cast<void *>(static_cast<const void *>(data)), + return {const_cast<void *>(static_cast<const volatile void *>(data)), Delegate::Cb::template stubA2B<HANDLE, FUNC>}; } @@ -81,6 +88,7 @@ namespace ucl { inline Delegate<R(ARGS...)> Delegate<R(ARGS...)>::make() noexcept { - return {nullptr, Delegate::Cb::template stubA2V<FUNC>}; + const auto fakeData = reinterpret_cast<void *>(1); + return {fakeData, Delegate::Cb::template stubA2V<FUNC>}; } } diff --git a/ucl/include/ucl/util/delegation/Delegate2.h b/ucl/include/ucl/util/delegation/Delegate2.h new file mode 100644 index 0000000..330419f --- /dev/null +++ b/ucl/include/ucl/util/delegation/Delegate2.h @@ -0,0 +1,117 @@ +/* + * 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 __UCL_UTIL_DELEGATION_DELEGATE2_H__ +#define __UCL_UTIL_DELEGATION_DELEGATE2_H__ + +#include "BaseDelegate2.h" + +namespace ucl { + + template <class FUNC_SIG> + class Delegate2; + + /** + * @brief Delegate2 that uses "void *" as data pointer + */ + template <class R, class ...ARGS> + class Delegate2<R(ARGS...)> : public BaseDelegate2<R(ARGS...), void *> { + public: + /** + * @brief Result delegate of the lock() method + */ + using LockDelegate = Delegate2; + + public: + using BaseDelegate2<R(ARGS...), void *>::BaseDelegate2; + + /** + * @brief Locks this delegate before further invoke + * @details This function simply returns copy of this delegate. + * Provided for interface compatibility with other delegate + * types. + * @return Lock delegate + */ + LockDelegate lock() const; + + /** + * @brief Invokes this delegate + * @details Delgates must be checked for NULL before invoke. + * @params[in] args Arguments of the invoke + * @return Result of the invoke + */ + R operator()(ARGS ...args) const; + + /** + * @brief Creates delegate to instance method + * @param[in] data This pointer of the instance + * @return Created delegate + */ + template <class CLASS, R(CLASS::*METHOD)(ARGS...)> + static Delegate2 make(CLASS *data) noexcept; + + /** + * @brief Creates delegate to constant instance method + * @param[in] data Constant this pointer of the instance + * @return Created delegate + */ + template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> + static Delegate2 make(const CLASS *data) noexcept; + + /** + * @brief Creates delegate to StubA-style function taking object + * @param[in] data Pointer of the object + * @return Created delegate + */ + template <class CLASS, R(*FUNC)(CLASS &, ARGS...)> + static Delegate2 makeA(CLASS *data) noexcept; + + /** + * @brief Creates delegate to StubB-style function taking object + * @param[in] data Pointer of the object + * @return Created delegate + */ + template <class CLASS, R(*FUNC)(ARGS..., CLASS &)> + static Delegate2 makeB(CLASS *data) noexcept; + + /** + * @brief Creates delegate to StubA-style function taking object handle + * @param[in] data Handle of the object + * @return Created delegate + */ + template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)> + static Delegate2 makeA(HANDLE data) noexcept; + + /** + * @brief Creates delegate to StubB-style function taking object handle + * @param[in] data Handle of the object + * @return Created delegate + */ + template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)> + static Delegate2 makeB(HANDLE data) noexcept; + + /** + * @brief Creates delegate to static function + * @return Created delegate + */ + template <R(*FUNC)(ARGS...)> + static Delegate2 make() noexcept; + }; +} + +#include "Delegate2.hpp" + +#endif // __UCL_UTIL_DELEGATION_DELEGATE2_H__ diff --git a/ucl/inc/ucl/util/delegation/Delegate2.hpp b/ucl/include/ucl/util/delegation/Delegate2.hpp index 085ba46..6b6fe09 100644 --- a/ucl/inc/ucl/util/delegation/Delegate2.hpp +++ b/ucl/include/ucl/util/delegation/Delegate2.hpp @@ -17,6 +17,13 @@ namespace ucl { template <class R, class ...ARGS> + inline typename Delegate2<R(ARGS...)>::LockDelegate + Delegate2<R(ARGS...)>::lock() const + { + return *this; + } + + template <class R, class ...ARGS> inline R Delegate2<R(ARGS...)>::operator()(ARGS ...args) const { return this->m_stubA(this->m_data, std::forward<ARGS>(args)...); @@ -45,9 +52,9 @@ namespace ucl { template <class R, class ...ARGS> template <class CLASS, R(*FUNC)(CLASS &, ARGS...)> inline Delegate2<R(ARGS...)> - Delegate2<R(ARGS...)>::makeA(CLASS &data) noexcept + Delegate2<R(ARGS...)>::makeA(CLASS *data) noexcept { - return {const_cast<void *>(static_cast<const void *>(&data)), + return {const_cast<void *>(static_cast<const volatile void *>(data)), Delegate2::Cb::template stubA2A<CLASS, FUNC>, Delegate2::Cb::template stubB2A<CLASS, FUNC>}; } @@ -55,9 +62,9 @@ namespace ucl { template <class R, class ...ARGS> template <class CLASS, R(*FUNC)(ARGS..., CLASS &)> inline Delegate2<R(ARGS...)> - Delegate2<R(ARGS...)>::makeB(CLASS &data) noexcept + Delegate2<R(ARGS...)>::makeB(CLASS *data) noexcept { - return {const_cast<void *>(static_cast<const void *>(&data)), + return {const_cast<void *>(static_cast<const volatile void *>(data)), Delegate2::Cb::template stubA2B<CLASS, FUNC>, Delegate2::Cb::template stubB2B<CLASS, FUNC>}; } @@ -67,7 +74,7 @@ namespace ucl { inline Delegate2<R(ARGS...)> Delegate2<R(ARGS...)>::makeA(const HANDLE data) noexcept { - return {const_cast<void *>(static_cast<const void *>(data)), + return {const_cast<void *>(static_cast<const volatile void *>(data)), Delegate2::Cb::template stubA2A<HANDLE, FUNC>, Delegate2::Cb::template stubB2A<HANDLE, FUNC>}; } @@ -77,7 +84,7 @@ namespace ucl { inline Delegate2<R(ARGS...)> Delegate2<R(ARGS...)>::makeB(const HANDLE data) noexcept { - return {const_cast<void *>(static_cast<const void *>(data)), + return {const_cast<void *>(static_cast<const volatile void *>(data)), Delegate2::Cb::template stubA2B<HANDLE, FUNC>, Delegate2::Cb::template stubB2B<HANDLE, FUNC>}; } @@ -87,7 +94,8 @@ namespace ucl { inline Delegate2<R(ARGS...)> Delegate2<R(ARGS...)>::make() noexcept { - return {nullptr, + const auto fakeData = reinterpret_cast<void *>(1); + return {fakeData, Delegate2::Cb::template stubA2V<FUNC>, Delegate2::Cb::template stubB2V<FUNC>}; } diff --git a/ucl/inc/ucl/util/delegation/helpers.h b/ucl/include/ucl/util/delegation/helpers.h index 54ebb99..2c471b6 100644 --- a/ucl/inc/ucl/util/delegation/helpers.h +++ b/ucl/include/ucl/util/delegation/helpers.h @@ -19,47 +19,14 @@ namespace ucl { - // Automatic function signature detection for a specific type // - - template <template <typename ...> class T, class TAG, class FUNC> - struct AutoFuncSig; - - template <template <typename ...> class T, - class R, class CLASS, class ...ARGS> - struct AutoFuncSig<T, void *, R(CLASS::*)(ARGS...)> { - using Data = CLASS; - using Type = T<R(ARGS...)>; - }; - - template <template <typename ...> class T, - class CLASS, class R, class ...ARGS> - struct AutoFuncSig<T, void *, R(CLASS::*)(ARGS...) const> { - using Data = CLASS; - using Type = T<R(ARGS...)>; - }; - - template <template <typename ...> class T, - class CLASS, class R, class ...ARGS> - struct AutoFuncSig<T, void *, R(*)(CLASS &, ARGS...)> { - using Data = CLASS; - using Type = T<R(ARGS...)>; - }; - - template <template <typename ...> class T, - class HANDLE, class R, class ...ARGS> - struct AutoFuncSig<T, void *, R(*)(HANDLE, ARGS...)> { - using Data = HANDLE; - using Type = T<R(ARGS...)>; - }; - - template <template <typename ...> class T, - class R, class ...ARGS> - struct AutoFuncSig<T, void, R(*)(ARGS...)> { - using Type = T<R(ARGS...)>; - }; - // Relation operators // + /** + * @brief Compares equals target delegates + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if equal, false - not equal + */ template <class R, class ...ARGS, class DATA1, class DATA2> inline bool operator==(const BaseDelegate<R(ARGS...), DATA1> &lhs, const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept @@ -68,6 +35,12 @@ namespace ucl { lhs.getData() == rhs.getData())); } + /** + * @brief Compares unequals target delegates + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if not equal, false - equal + */ template <class R, class ...ARGS, class DATA1, class DATA2> inline bool operator!=(const BaseDelegate<R(ARGS...), DATA1> &lhs, const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept @@ -76,6 +49,12 @@ namespace ucl { lhs.getData() != rhs.getData())); } + /** + * @brief Compares less target delegates + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if left is less than right, false - otherwise + */ template <class R, class ...ARGS, class DATA1, class DATA2> inline bool operator<(const BaseDelegate<R(ARGS...), DATA1> &lhs, const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept @@ -85,6 +64,12 @@ namespace ucl { lhs.getData() < rhs.getData()))); } + /** + * @brief Compares less or equals target delegates + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if left is less or equals to right, false - otherwise + */ template <class R, class ...ARGS, class DATA1, class DATA2> inline bool operator<=(const BaseDelegate<R(ARGS...), DATA1> &lhs, const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept @@ -94,6 +79,12 @@ namespace ucl { lhs.getData() <= rhs.getData()))); } + /** + * @brief Compares greater target delegates + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if left is greater than right, false - otherwise + */ template <class R, class ...ARGS, class DATA1, class DATA2> inline bool operator>(const BaseDelegate<R(ARGS...), DATA1> &lhs, const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept @@ -103,6 +94,12 @@ namespace ucl { lhs.getData() > rhs.getData()))); } + /** + * @brief Compares greater or equals target delegates + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if left is greater or equals to right, false - otherwise + */ template <class R, class ...ARGS, class DATA1, class DATA2> inline bool operator>=(const BaseDelegate<R(ARGS...), DATA1> &lhs, const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept diff --git a/ucl/include/ucl/util/delegation/internal.h b/ucl/include/ucl/util/delegation/internal.h new file mode 100644 index 0000000..daf00ef --- /dev/null +++ b/ucl/include/ucl/util/delegation/internal.h @@ -0,0 +1,98 @@ +/* + * 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 __UCL_UTIL_DELEGATION_INTERNAL_H__ +#define __UCL_UTIL_DELEGATION_INTERNAL_H__ + +namespace ucl { namespace himpl { + + // Automatic function signature detection for a specific type // + + template <template <typename ...> class T, class FUNC> + struct AutoFuncSig; + + template <template <typename ...> class T, + class R, class CLASS, class ...ARGS> + struct AutoFuncSig<T, R(CLASS::*)(ARGS...)> { + using Data = CLASS; + using Type = T<R(ARGS...)>; + + template <R(CLASS::*METHOD)(ARGS...), class DATA> + static Type makeDelegate(DATA &&data) noexcept + { + return Type::template make<CLASS, METHOD>(std::forward<DATA>(data)); + } + }; + + template <template <typename ...> class T, + class CLASS, class R, class ...ARGS> + struct AutoFuncSig<T, R(CLASS::*)(ARGS...) const> { + using Data = CLASS; + using Type = T<R(ARGS...)>; + + template <R(CLASS::*METHOD)(ARGS...) const, class DATA> + static Type makeDelegate(DATA &&data) noexcept + { + return Type::template make<CLASS, METHOD>(std::forward<DATA>(data)); + } + }; + + template <template <typename ...> class T, + class CLASS, class R, class ...ARGS> + struct AutoFuncSig<T, R(*)(CLASS &, ARGS...)> { + using Data = CLASS; + using Type = T<R(ARGS...)>; + + template <R(*FUNC)(CLASS &, ARGS...), class DATA> + static Type makeDelegate(DATA &&data) noexcept + { + return Type::template makeA<CLASS, FUNC>(std::forward<DATA>(data)); + } + }; + + template <template <typename ...> class T, + class HANDLE, class R, class ...ARGS> + struct AutoFuncSig<T, R(*)(HANDLE, ARGS...)> { + using Data = HANDLE; + using Type = T<R(ARGS...)>; + using TypeV = T<R(HANDLE, ARGS...)>; + + template <R(*FUNC)(HANDLE, ARGS...), class DATA> + static Type makeDelegate(DATA &&data) noexcept + { + return Type::template makeA<HANDLE, FUNC>(std::forward<DATA>(data)); + } + + template <R(*FUNC)(HANDLE, ARGS...)> + static TypeV makeDelegate() noexcept + { + return TypeV::template make<FUNC>(); + } + }; + + template <template <typename ...> class T, class R> + struct AutoFuncSig<T, R(*)()> { + using TypeV = T<R()>; + + template <R(*FUNC)()> + static TypeV makeDelegate() noexcept + { + return TypeV::template make<FUNC>(); + } + }; +}} + +#endif // __UCL_UTIL_DELEGATION_INTERNAL_H__ diff --git a/ucl/include/ucl/util/delegation/macro.h b/ucl/include/ucl/util/delegation/macro.h new file mode 100644 index 0000000..a590557 --- /dev/null +++ b/ucl/include/ucl/util/delegation/macro.h @@ -0,0 +1,120 @@ +/* + * 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 __UCL_UTIL_DELEGATION_MACRO_H__ +#define __UCL_UTIL_DELEGATION_MACRO_H__ + +#include "internal.h" + +// Helper macro to simplify use of AutoFuncSig template + +#define _UCL_AFS(DELEGATE, FUNC) \ + ::ucl::himpl::AutoFuncSig<DELEGATE, decltype(&FUNC)> + +// Helper macro to automatically generate different delegate objects // + +#define _UCL_DELEGATE(DELEGATE, FUNC, DATA...) \ + _UCL_AFS(DELEGATE, FUNC)::template makeDelegate<&FUNC>(DATA) + +// Helper macro to automatically generate Delegate objects // + +/** + * @brief Creates Delegate<auto> to specified function + * @param FUNC Function for the delegate without & + * @param DATA Data for the delegate (optional) + * @return Created delegate + */ +#define UCL_DELEGATE(FUNC, DATA...) _UCL_DELEGATE( \ + ::ucl::Delegate, FUNC, ##DATA) + +/** + * @brief Creates Delegate<auto> to "this" instance method + * @param FUNC_NAME name of the function of the "this" class + * @return Created delegate + */ +#define UCL_DELEGATE_THIS(FUNC_NAME) UCL_DELEGATE( \ + std::remove_pointer<decltype(this)>::type::FUNC_NAME, this) + +// Helper macro to automatically generate Delegate2 objects // + +/** + * @brief Creates Delegate2<auto> to specified function + * @param FUNC Function for the delegate without & + * @param DATA Data for the delegate (optional) + * @return Created delegate + */ +#define UCL_DELEGATE2(FUNC, DATA...) _UCL_DELEGATE( \ + ::ucl::Delegate2, FUNC, ##DATA) + +/** + * @brief Creates Delegate2<auto> to "this" instance method + * @param FUNC_NAME name of the function of the "this" class + * @return Created delegate + */ +#define UCL_DELEGATE2_THIS(FUNC_NAME) UCL_DELEGATE2( \ + std::remove_pointer<decltype(this)>::type::FUNC_NAME, this) + +// Helper macro to automatically generate Callback stubs // + +/** + * @brief Returns Callback<auto>::stubA to specified function + * @param FUNC Function for the callback without & + * @return Pointer to the stab function + */ +#define UCL_CALLBACK_A(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \ + template stubA<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC> + +/** + * @brief Returns Callback<auto>::stubB to specified function + * @param FUNC Function for the callback without & + * @return Pointer to the stab function + */ +#define UCL_CALLBACK_B(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \ + template stubB<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC> + +/** + * @brief Returns Callback<auto>::stubA2A to specified function + * @param FUNC Function for the callback without & + * @return Pointer to the stab function + */ +#define UCL_CALLBACK_A2A(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \ + template stubA2A<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC> + +/** + * @brief Returns Callback<auto>::stubB2A to specified function + * @param FUNC Function for the callback without & + * @return Pointer to the stab function + */ +#define UCL_CALLBACK_B2A(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \ + template stubB2A<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC> + +/** + * @brief Returns Callback<auto>::stubA2V to specified function + * @param FUNC Function for the callback without & + * @return Pointer to the stab function + */ +#define UCL_CALLBACK_A2V(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::TypeV:: \ + template stubA2V<&FUNC> + +/** + * @brief Returns Callback<auto>::stubB2V to specified function + * @param FUNC Function for the callback without & + * @return Pointer to the stab function + */ +#define UCL_CALLBACK_B2V(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::TypeV:: \ + template stubB2V<&FUNC> + +#endif // __UCL_UTIL_DELEGATION_MACRO_H__ diff --git a/ucl/inc/ucl/util/delegation/shortMacro.h b/ucl/include/ucl/util/delegation/shortMacro.h index 3837977..99e1e0d 100644 --- a/ucl/inc/ucl/util/delegation/shortMacro.h +++ b/ucl/include/ucl/util/delegation/shortMacro.h @@ -19,15 +19,15 @@ // Helper macro to automatically generate Delegate objects // -#define DELEGATE(FUNC, DATA) UCL_DELEGATE(FUNC, DATA) -#define DELEGATE_A(FUNC, DATA) UCL_DELEGATE_A(FUNC, DATA) -#define DELEGATE_V(FUNC) UCL_DELEGATE_V(FUNC) +#define DELEGATE(FUNC, DATA...) UCL_DELEGATE(FUNC, ##DATA) + +#define DELEGATE_THIS(FUNC_NAME) UCL_DELEGATE_THIS(FUNC_NAME) // Helper macro to automatically generate Delegate2 objects // -#define DELEGATE2(FUNC, DATA) UCL_DELEGATE2(FUNC, DATA) -#define DELEGATE2_A(FUNC, DATA) UCL_DELEGATE2_A(FUNC, DATA) -#define DELEGATE2_V(FUNC) UCL_DELEGATE2_V(FUNC) +#define DELEGATE2(FUNC, DATA...) UCL_DELEGATE2(FUNC, ##DATA) + +#define DELEGATE2_THIS(FUNC_NAME) UCL_DELEGATE2_THIS(FUNC_NAME) // Helper macro to automatically generate Callback stubs // diff --git a/ucl/include/ucl/util/helpers.h b/ucl/include/ucl/util/helpers.h new file mode 100644 index 0000000..fe6b029 --- /dev/null +++ b/ucl/include/ucl/util/helpers.h @@ -0,0 +1,283 @@ +/* + * 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 __UCL_UTIL_HELPERS_H__ +#define __UCL_UTIL_HELPERS_H__ + +#include "types/baseTypes.h" +#include "types/classTypes.h" + +namespace ucl { + + /** + * @brief Converts a value to corresponding Eina type + * @param[in] value Original bool value + * @return Corresponding Eina_Bool value + */ + constexpr Eina_Bool toEina(bool value); + + /** + * @brief Returns "zValue" if source is NULL + * @param[in] value Source C-String + * @param[in] zValue Value to return when "value" is NULL (optional: "") + * @return "value" - if not NULL, "zValue" - otherwise + */ + constexpr const char *nz(const char *value, const char *zValue = ""); + + /** + * @brief Returns "eValue" if source is empty string + * @param[in] value Source C-String + * @param[in] eValue Value to return when "value" is NULL (optional: NULL) + * @return "value" - if not empty, "eValue" - otherwise + */ + constexpr const char *ne(const char *value, const char *eValue = nullptr); + + /** + * @brief Checks C-String for emptiness + * @param[in] value Source C-String + * @return true - if empty (NULL or ""), false - otherwise + */ + constexpr bool isEmpty(const char *value); + + /** + * @brief Checks T object for emptiness + * @details Works by wrapping object's empty() method if exists + * @param[in] value Source object + * @return true - if empty, false - otherwise + */ + template <class T> + constexpr auto isEmpty(const T &value) -> decltype(value.empty()) + { + return value.empty(); + } + + /** + * @brief Checks T object for emptiness + * @details Works by wrapping object's isEmpty() method if exists + * @param[in] value Source object + * @return true - if empty, false - otherwise + */ + template <class T> + constexpr auto isEmpty(const T &value) -> decltype(value.isEmpty()) + { + return value.isEmpty(); + } + + /** + * @brief Checks T object passed by pointer for emptiness + * @details Uses isEmpty() function on dereferenced value if not NULL. + * @param[in] value Source object pointer + * @return true - if empty or NULL, false - otherwise + */ + template <class T> + constexpr auto isEmpty(const T &value) -> decltype(isEmpty(*value)) + { + return (!value || isEmpty(*value)); + } + + /** + * @brief Checks T object for validity + * @details Works by wrapping object's valid() method if exists + * @param[in] value Source object + * @return true - if valid, false - otherwise + */ + template <class T> + constexpr auto isValid(const T &value) -> decltype(value.valid()) + { + return value.valid(); + } + + /** + * @brief Checks T object for validity + * @details Works by wrapping object's isValid() method if exists + * @param[in] value Source object + * @return true - if valid, false - otherwise + */ + template <class T> + constexpr auto isValid(const T &value) -> decltype(value.isValid()) + { + return value.isValid(); + } + + /** + * @brief Checks T object passed by pointer for validity + * @details Uses isValid() function on dereferenced value if not NULL. + * @param[in] value Source object pointer + * @return true - if valid, false - otherwise + */ + template <class T> + constexpr auto isValid(const T &value) -> decltype(isValid(*value)) + { + return (value && isValid(*value)); + } + + /** + * @brief Checks T object for not emptiness + * @details Works by negating isEmpty() function + * @param[in] value Source object + * @return true - if not empty, false - otherwise + */ + template <class T> + constexpr bool isNotEmpty(T &&value); + + /** + * @brief Checks T object for not validity + * @details Works by negating isValid() function + * @param[in] value Source object + * @return true - if not valid, false - otherwise + */ + template <class T> + constexpr bool isNotValid(T &&value); + + /** + * @brief Duplicates C-String with NULL check + * @param[in] value Source C-String + * @return Duplicated C-String or NULL + */ + char *strDupSafe(const char *value); + + /** + * @brief Compares C-String wrapped with nz() function + * @param[in] lhs Left hand side C-String + * @param[in] lhs Right hand side C-String + * @return 0 - equals, <0 - less, >0 - greater + */ + int strCmpSafe(const char *lhs, const char *rhs); + + /** + * @brief Dynamically casts an object + * @param[in] src Source object + * @return Result object + */ + template <class T1, class T2> + inline auto dynamicCast(T2 &&src) -> decltype( + dynamic_cast<T1>(std::forward<T2>(src))) + { + return dynamic_cast<T1>(std::forward<T2>(src)); + } + + /** + * @brief Const casts an object + * @param[in] src Source object + * @return Result object + */ + template <class T1, class T2> + inline auto constCast(T2 &&src) -> decltype( + const_cast<T1>(std::forward<T2>(src))) + { + return const_cast<T1>(std::forward<T2>(src)); + } + + /** + * @brief Calculates minimum from two values + * @param[in] a First value + * @param[in] b Second value + * @return Constant reference to minimum value + */ + template <class T> + constexpr const T &min(const T &a, const T &b); + + /** + * @brief Calculates maximum from two values + * @param[in] a First value + * @param[in] b Second value + * @return Constant reference to maximum value + */ + template <class T> + constexpr const T &max(const T &a, const T &b); + + /** + * @brief Checks if a value is a Power of Two + * @param[in] value Source value + * @return true - if value is POT, false - otherwise + */ + template <class T> + constexpr bool isPot(T value) + { + return (((value - 1) & value) == 0); + } + + /** + * @brief Divides integer T by MULTIPLE with ceiling + * @param[in] value Source value + * @return Ceiled result of the division + */ + template <uint MULTIPLE, class T> + constexpr T ceilDiv(T value); + + /** + * @brief Rounds integer T to not less value that is a multiple of MULTIPLE + * @details Optimized version for POT numbers + * @param[in] value Source value + * @return Result of the rounding + */ + template <uint MULTIPLE, class T> + constexpr typename std::enable_if<isPot(MULTIPLE), T>::type + roundUp(T value) + { + return ((value + (MULTIPLE - 1)) & ~static_cast<T>(MULTIPLE - 1)); + } + + /** + * @brief Rounds integer T to not less value that is a multiple of MULTIPLE + * @details Version for not POT numbers + * @param[in] value Source value + * @return Result of the rounding + */ + template <uint MULTIPLE, class T> + constexpr typename std::enable_if<!isPot(MULTIPLE), T>::type + roundUp(T value) + { + return (ceilDiv<MULTIPLE>(value) * MULTIPLE); + } +} + +namespace ucl { namespace util { + + /** + * @brief Wraps T object pointer with std::unique_ptr + * @param[in] p Source pointer + * @return Result std::unique_ptr + */ + template <class T> + std::unique_ptr<T> wrapUnique(T *p); + + /** + * @brief Makes new instance of T and calls wrapUnique() + * @param[in] args Arguments for T constructor + * @return Result std::unique_ptr + */ + template <class T, class ...ARGS> + std::unique_ptr<T> makeUnique(ARGS &&...args); + + /** + * @brief Safely disposes object and NULLs pointer + * @param[in/out] p Target pointer + */ + template <class T, class = typename std::enable_if< + std::is_convertible<T *, IDisposable *>::value>::type> + inline void dispose(T *&p) noexcept + { + if (p) { + p->dispose(); + p = nullptr; + } + } +}} + +#include "helpers.hpp" + +#endif // __UCL_UTIL_HELPERS_H__ diff --git a/ucl/inc/ucl/util/helpers.hpp b/ucl/include/ucl/util/helpers.hpp index a7606f8..33fd326 100644 --- a/ucl/inc/ucl/util/helpers.hpp +++ b/ucl/include/ucl/util/helpers.hpp @@ -80,8 +80,14 @@ namespace ucl { namespace ucl { namespace util { template <class T> - inline std::unique_ptr<T> makeUnique(T *const p) + inline std::unique_ptr<T> wrapUnique(T *const p) { return std::unique_ptr<T>(p); } + + template <class T, class ...ARGS> + inline std::unique_ptr<T> makeUnique(ARGS &&...args) + { + return wrapUnique(new T(std::forward<ARGS>(args)...)); + } }} diff --git a/ucl/inc/ucl/util/logging.h b/ucl/include/ucl/util/logging.h index 804a513..da3e115 100644 --- a/ucl/inc/ucl/util/logging.h +++ b/ucl/include/ucl/util/logging.h @@ -23,6 +23,11 @@ #include "types/Result.h" +/** + * @brief Gets result data for result codes defined in "ucl/types/Result.h" + * @param[in] result Result value + * @return Corresponding result data for the result value + */ ::ucl::ResultData getUCLResultData(::ucl::Result result); #ifndef UCL_LOG_LEVEL diff --git a/ucl/inc/ucl/util/memory.h b/ucl/include/ucl/util/memory.h index cc33960..cc33960 100644 --- a/ucl/inc/ucl/util/memory.h +++ b/ucl/include/ucl/util/memory.h diff --git a/ucl/inc/ucl/util/memory/BaseRef.h b/ucl/include/ucl/util/memory/BaseRef.h index 8146eae..405bf85 100644 --- a/ucl/inc/ucl/util/memory/BaseRef.h +++ b/ucl/include/ucl/util/memory/BaseRef.h @@ -21,31 +21,66 @@ namespace ucl { + /** + * @brief Base class for reference-counted pointers + */ template <class T> class BaseRef { public: + /** + * @brief Alias for "T" + */ using Type = T; - template <class U> - friend class BaseRef; - template <class U> - friend class SharedRef; - template <class U> - friend class WeakRef; - public: + /** + * @brief Gets use count of the pointed object (strong count) + */ UInt getUseCount() const noexcept; protected: + /** + * @brief Default constructor + */ constexpr BaseRef() noexcept; + + /** + * @brief Constructor + * @param[in] rc Pointer to reference-counted objet + * @param[in] ptr Pointed object pointer + */ BaseRef(IRefCountObj *rc, T *ptr) noexcept; + + /** + * @brief Move constructor + * @param[in] r Source object + */ BaseRef(BaseRef<T> &&r) noexcept; + + /** + * @brief Conversion move constructor + * @param[in] r Source object + */ template <class U> BaseRef(BaseRef<U> &&r) noexcept; protected: + /** + * @brief Reference counter-counted objet + */ IRefCountObj *m_rc; + + /** + * @brief Pointed object pointer + */ T *m_ptr; + + template <class U> + friend class BaseRef; + template <class U> + friend class SharedRef; + template <class U> + friend class WeakRef; }; } diff --git a/ucl/inc/ucl/util/memory/BaseRef.hpp b/ucl/include/ucl/util/memory/BaseRef.hpp index 312c38e..312c38e 100644 --- a/ucl/inc/ucl/util/memory/BaseRef.hpp +++ b/ucl/include/ucl/util/memory/BaseRef.hpp diff --git a/ucl/inc/ucl/util/memory/IRefCountObj.h b/ucl/include/ucl/util/memory/IRefCountObj.h index 69d6a1c..5dc2c3e 100644 --- a/ucl/inc/ucl/util/memory/IRefCountObj.h +++ b/ucl/include/ucl/util/memory/IRefCountObj.h @@ -21,17 +21,55 @@ namespace ucl { - class IRefCountObj : public Polymorphic { + /** + * @brief Interface for reference-counted object + */ + class IRefCountObj : protected NonCopyable { public: + /** + * @brief Increments use counter + */ virtual void ref() noexcept = 0; + + /** + * @brief Decrements use counter + * @details When use count reches 0 object will be destroyed + */ virtual void unref() noexcept = 0; + + /** + * @brief Increments use counter if it is not 0 + */ virtual bool refNz() noexcept = 0; + + /** + * @brief Increments weak counter + */ virtual void refWeak() noexcept = 0; + + /** + * @brief Decrements weak counter + * @details When weak count reches 0 "delete this" will be called + */ virtual void unrefWeak() noexcept = 0; + + /** + * @brief Gets use count (strong count) + * @return use count + */ virtual UInt getUseCount() const noexcept = 0; + + /** + * @brief Gets pointer of the object + * @return Pointer of the object + */ virtual const void *getObjPtr() const noexcept = 0; + protected: - virtual ~IRefCountObj() = default; + /** + * @brief Destructor + */ + ~IRefCountObj() = default; }; } diff --git a/ucl/inc/ucl/util/memory/RefCountObj.h b/ucl/include/ucl/util/memory/RefCountObj.h index 7237aa4..c132e23 100644 --- a/ucl/inc/ucl/util/memory/RefCountObj.h +++ b/ucl/include/ucl/util/memory/RefCountObj.h @@ -22,12 +22,23 @@ namespace ucl { + /** + * @brief Represents reference-counted object of type T and counter C + */ template <class T, class C> class RefCountObj final : public IRefCountObj { public: + /** + * @brief Constructor + * @param[in] args Arguments for T constructor + */ template <class ...ARGS> RefCountObj(ARGS &&...args); + /** + * @brief Gets pointer of the object + * @return Pointer of the object + */ T *getObj() noexcept; // IRefCountObj // @@ -55,8 +66,6 @@ namespace ucl { std::true_type {}; private: - virtual ~RefCountObj() = default; - template <class T2, class ...ARGS, class = typename std::enable_if<!IsRefCountAware<T2>::value>::type> void createObj(const P<0> &, ARGS &&...args) diff --git a/ucl/inc/ucl/util/memory/RefCountObj.hpp b/ucl/include/ucl/util/memory/RefCountObj.hpp index 8a2c065..8a2c065 100644 --- a/ucl/inc/ucl/util/memory/RefCountObj.hpp +++ b/ucl/include/ucl/util/memory/RefCountObj.hpp diff --git a/ucl/inc/ucl/util/memory/RefCounterMT.h b/ucl/include/ucl/util/memory/RefCounterMT.h index 1d2fb95..5b7ea17 100644 --- a/ucl/inc/ucl/util/memory/RefCounterMT.h +++ b/ucl/include/ucl/util/memory/RefCounterMT.h @@ -21,14 +21,39 @@ namespace ucl { + /** + * @brief Represents multithreaded reference counter + */ class RefCounterMT final { public: + /** + * @brief Constructor + * @param[in] count Initial counter value + */ explicit RefCounterMT(const UInt count = 0) noexcept; + /** + * @brief Atomically increments counter + * @return New counter value + */ UInt ref() noexcept; + + /** + * @brief Atomically decrements counter + * @return New counter value + */ UInt unref() noexcept; + + /** + * @brief Atomically increments counter if not 0 + * @return New counter value + */ UInt refNz() noexcept; + /** + * @brief Atomically gets current counter value + * @return Current counter value + */ UInt get() const noexcept; private: diff --git a/ucl/inc/ucl/util/memory/RefCounterMT.hpp b/ucl/include/ucl/util/memory/RefCounterMT.hpp index 1ff459b..1ff459b 100644 --- a/ucl/inc/ucl/util/memory/RefCounterMT.hpp +++ b/ucl/include/ucl/util/memory/RefCounterMT.hpp diff --git a/ucl/inc/ucl/util/memory/RefCounterST.h b/ucl/include/ucl/util/memory/RefCounterST.h index 30e5e35..ca941a7 100644 --- a/ucl/inc/ucl/util/memory/RefCounterST.h +++ b/ucl/include/ucl/util/memory/RefCounterST.h @@ -21,14 +21,39 @@ namespace ucl { + /** + * @brief Represents singlethreaded reference counter + */ class RefCounterST final { public: + /** + * @brief Constructor + * @param[in] count Initial counter value + */ explicit RefCounterST(const UInt count = 0) noexcept; + /** + * @brief Increments counter + * @return New counter value + */ UInt ref() noexcept; + + /** + * @brief Decrements counter + * @return New counter value + */ UInt unref() noexcept; + + /** + * @brief Increments counter if not 0 + * @return New counter value + */ UInt refNz() noexcept; + /** + * @brief Gets current counter value + * @return Current counter value + */ UInt get() const noexcept; private: diff --git a/ucl/inc/ucl/util/memory/RefCounterST.hpp b/ucl/include/ucl/util/memory/RefCounterST.hpp index 45781c7..45781c7 100644 --- a/ucl/inc/ucl/util/memory/RefCounterST.hpp +++ b/ucl/include/ucl/util/memory/RefCounterST.hpp diff --git a/ucl/inc/ucl/util/memory/ReffedObj.h b/ucl/include/ucl/util/memory/ReffedObj.h index c521544..490a236 100644 --- a/ucl/inc/ucl/util/memory/ReffedObj.h +++ b/ucl/include/ucl/util/memory/ReffedObj.h @@ -25,19 +25,42 @@ namespace ucl { template <class T, class C> class RefCountObj; + /** + * @brief Helpers class to store object of type T for reference counting + * @details You need to friend ReffedObj<T> if constructor/destructor + * of T is not public + */ template <class T> class ReffedObj final { private: - friend class RefCountObj<T, RefCounterST>; - friend class RefCountObj<T, RefCounterMT>; - + /** + * @brief Calls constructor of T + * @param[in] Arguments for T constructor + */ template <class ...ARGS> void create(ARGS &&...args); + + /** + * @brief Calls destructor of T + */ void destroy() noexcept; + /** + * @brief Gets pointer to T object + * @return Pointer to T object + */ T *get() noexcept; + + /** + * @brief Gets pointer to constant T object + * @return Pointer to constant T object + */ const T *get() const noexcept; + /** + * @brief Calls "get()->onUniqueChanged()" on the T object + * @param[in] isUnique true - if use count is 1, false - otherwise + */ template <class T2> void dispatchOnUniqueChanged(bool isUnique); @@ -51,6 +74,9 @@ namespace ucl { private: typename std::aligned_storage<sizeof(T), alignof(T)>::type m_obj; + + friend class RefCountObj<T, RefCounterST>; + friend class RefCountObj<T, RefCounterMT>; }; } diff --git a/ucl/inc/ucl/util/memory/ReffedObj.hpp b/ucl/include/ucl/util/memory/ReffedObj.hpp index cfc1e84..cfc1e84 100644 --- a/ucl/inc/ucl/util/memory/ReffedObj.hpp +++ b/ucl/include/ucl/util/memory/ReffedObj.hpp diff --git a/ucl/include/ucl/util/memory/SharedRef.h b/ucl/include/ucl/util/memory/SharedRef.h new file mode 100644 index 0000000..614fa9f --- /dev/null +++ b/ucl/include/ucl/util/memory/SharedRef.h @@ -0,0 +1,205 @@ +/* + * 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 __UCL_UTIL_MEMORY_SHARED_REF_H__ +#define __UCL_UTIL_MEMORY_SHARED_REF_H__ + +#include "BaseRef.h" + +namespace ucl { + + /** + * @brief Implements shared reference (pointer) to T object + */ + template <class T> + class SharedRef final : public BaseRef<T> { + public: + /** + * @brief Swaps SharedRef objects with each other + * @param[in/out] x First SharedRef + * @param[in/out] y Second SharedRef + */ + template <class U> + friend void swap(SharedRef<U> &x, SharedRef<U> &y) noexcept; + + /** + * @brief Statically casts SharedRef<U> to SharedRef<T2> + * @param[in] r Source shared reference + * @return Result shared reference + */ + template <class T2, class U> + friend SharedRef<T2> staticRefCast(const SharedRef<U> &r) noexcept; + + /** + * @brief Dynamically casts SharedRef<U> to SharedRef<T2> + * @param[in] r Source shared reference + * @return Result shared reference + */ + template <class T2, class U> + friend SharedRef<T2> dynamicRefCast(const SharedRef<U> &r) noexcept; + + public: + /** + * @brief Default constructor + * @details Creates empty reference + */ + constexpr SharedRef() noexcept; + + /** + * @brief Constructor + * @details Same as default constructor + */ + constexpr SharedRef(std::nullptr_t) noexcept; + + /** + * @brief Constructor + * @details Increments reference counter + * @param[in] rc Pointer to reference-counted objet + * @param[in] ptr Pointed object pointer + */ + SharedRef(IRefCountObj *rc, T *ptr) noexcept; + + /** + * @brief Constructor + * @details Does not increment reference counter + * @param[in] rc Pointer to reference-counted objet + * @param[in] ptr Pointed object pointer + * @param[in] noRef Not used. + */ + SharedRef(IRefCountObj *rc, T *ptr, bool noRef) noexcept; + + /** + * @brief Copy constructor + * @param[in] r Source object + */ + SharedRef(const SharedRef<T> &r) noexcept; + + /** + * @brief Converting copy constructor + * @param[in] r Source object + */ + template <class U> + SharedRef(const SharedRef<U> &r) noexcept; + + /** + * @brief Move constructor + * @param[in] r Source object + */ + SharedRef(SharedRef<T> &&r) noexcept; + + /** + * @brief Converting move constructor + * @param[in] r Source object + */ + template <class U> + SharedRef(SharedRef<U> &&r) noexcept; + + /** + * @brief Destructor + * @details Decrements reference counter + */ + ~SharedRef(); + + /** + * @brief Assigns one SharedRef to another + * @param[in] r Source object + * @return Reference to this SharedRef + */ + SharedRef<T> &operator=(SharedRef<T> r) noexcept; + + /** + * @brief Makes this reference empty + */ + void reset() noexcept; + + /** + * @brief Gets pointed object pointer + * @return Pointer object pointer + */ + T *get() const noexcept; + + /** + * @brief Explicitly casts to bool + * @return true - if not empty, false - otherwise + */ + explicit operator bool() const noexcept; + + /** + * @brief Gets pointed object pointer + * @return Pointer object pointer + */ + T *operator->() const noexcept; + + /** + * @brief Gets pointed object reference + * @return Pointer object reference + */ + typename std::add_lvalue_reference<T>::type operator*() const noexcept; + + /** + * @brief Implicitly casts to compatible SharedRef type + * @return Reference to this object as casted type + */ + template <class U, class = typename std::enable_if< + std::is_convertible<T *, U *>::value && ( + std::is_same<typename std::remove_cv<U>::type, void>::value || + std::is_same<typename std::remove_cv<U>::type, + typename std::remove_cv<T>::type>::value)>::type> + operator const SharedRef<U> &() const noexcept + { + return reinterpret_cast<const SharedRef<U> &>(*this); + } + }; + + // Non-member functions // + + /** + * @brief Makes new instance of T as shared object + * @param[in] args Arguments for T constructor + * @return Shared reference to new T + */ + template <class T, class ...ARGS> + SharedRef<T> makeShared(ARGS &&...args); + + /** + * @brief Makes new instance of T as shared object + * @details Multiple thread may refer to this object + * @param[in] args Arguments for T constructor + * @return Shared reference to new T + */ + template <class T, class ...ARGS> + SharedRef<T> makeSharedMT(ARGS &&...args); + + /** + * @brief Const casts SharedRef<U> to SharedRef<T> + * @param[in] r Source shared reference + * @return Result shared reference + */ + template <class T, class U> + const SharedRef<T> &constRefCast(const SharedRef<U> &r) noexcept; + + /** + * @brief Const casts SharedRef<U> to SharedRef<T> + * @param[in] r Source shared reference + * @return Result shared reference + */ + template <class T, class U> + SharedRef<T> &&constRefCast(SharedRef<U> &&r) noexcept; +} + +#include "SharedRef.hpp" + +#endif // __UCL_UTIL_MEMORY_SHARED_REF_H__ diff --git a/ucl/inc/ucl/util/memory/SharedRef.hpp b/ucl/include/ucl/util/memory/SharedRef.hpp index f085b9c..f085b9c 100644 --- a/ucl/inc/ucl/util/memory/SharedRef.hpp +++ b/ucl/include/ucl/util/memory/SharedRef.hpp diff --git a/ucl/include/ucl/util/memory/WeakRef.h b/ucl/include/ucl/util/memory/WeakRef.h new file mode 100644 index 0000000..cad6841 --- /dev/null +++ b/ucl/include/ucl/util/memory/WeakRef.h @@ -0,0 +1,182 @@ +/* + * 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 __UCL_UTIL_MEMORY_WEAK_REF_H__ +#define __UCL_UTIL_MEMORY_WEAK_REF_H__ + +#include "SharedRef.h" + +namespace ucl { + + /** + * @brief Implements weak reference (pointer) to T object + */ + template <class T> + class WeakRef final : public BaseRef<T> { + public: + /** + * @brief Swaps WeakRef objects with each other + * @param[in/out] x First WeakRef + * @param[in/out] y Second WeakRef + */ + template <class U> + friend void swap(WeakRef<U> &x, WeakRef<U> &y) noexcept; + + /** + * @brief Statically casts WeakRef<U> to WeakRef<T2> + * @param[in] r Source weak reference + * @return Result weak reference + */ + template <class T2, class U> + friend WeakRef<T2> staticRefCast(const WeakRef<U> &r) noexcept; + + /** + * @brief Dynamically casts WeakRef<U> to WeakRef<T2> + * @param[in] r Source weak reference + * @return Result weak reference + */ + template <class T2, class U> + friend WeakRef<T2> dynamicRefCast(const WeakRef<U> &r) noexcept; + + public: + /** + * @brief Default constructor + * @details Creates expired reference + */ + constexpr WeakRef() noexcept; + + /** + * @brief Constructor + * @details Same as default constructor + */ + constexpr WeakRef(std::nullptr_t) noexcept; + + /** + * @brief Constructor + * @details Increments weak reference counter + * @param[in] rc Pointer to reference-counted objet + * @param[in] ptr Pointed object pointer + */ + WeakRef(IRefCountObj *rc, T *ptr) noexcept; + + /** + * @brief Copy constructor + * @param[in] r Source object + */ + WeakRef(const WeakRef<T> &r) noexcept; + + /** + * @brief Converting copy constructor + * @param[in] r Source object + */ + template <class U> + WeakRef(const BaseRef<U> &r) noexcept; + + /** + * @brief Move constructor + * @param[in] r Source object + */ + WeakRef(WeakRef<T> &&r) noexcept; + + /** + * @brief Converting move constructor + * @param[in] r Source object + */ + template <class U> + WeakRef(WeakRef<U> &&r) noexcept; + + /** + * @brief Destructor + * @details Decrements weak reference counter + */ + ~WeakRef(); + + /** + * @brief Assigns one WeakRef to another + * @param[in] r Source object + * @return Reference to this WeakRef + */ + WeakRef<T> &operator=(WeakRef<T> r) noexcept; + + /** + * @brief Makes this reference empty + */ + void reset() noexcept; + + /** + * @brief Returns SharedRef for this weak reference + * @details Will return empty shared reference if expired + */ + SharedRef<T> lock() const noexcept; + + /** + * @brief Gets pointed object pointer + * @details Do not dereference. Use as ID for comparison. + * @return Pointer object pointer + */ + T *getUnsafePtr() const noexcept; + + /** + * @brief Explicitly casts to bool + * @return true - if not empty/expired, false - otherwise + */ + explicit operator bool() const noexcept; + + /** + * @brief Implicitly casts to compatible WeakRef type + * @return Reference to this object as casted type + */ + template <class U, class = typename std::enable_if< + std::is_convertible<T *, U *>::value && ( + std::is_same<typename std::remove_cv<U>::type, void>::value || + std::is_same<typename std::remove_cv<U>::type, + typename std::remove_cv<T>::type>::value)>::type> + operator const WeakRef<U> &() const noexcept + { + return reinterpret_cast<const WeakRef<U> &>(*this); + } + }; + + // Non-member functions // + + /** + * @brief Makes weak reference for specific shared reference + * @param[in] r Source shared reference + * @return Result weak reference + */ + template <class T> + WeakRef<T> makeWeak(const SharedRef<T> &r) noexcept; + + /** + * @brief Const casts WeakRef<U> to WeakRef<T> + * @param[in] r Source weak reference + * @return Result weak reference + */ + template <class T, class U> + const WeakRef<T> &constRefCast(const WeakRef<U> &r) noexcept; + + /** + * @brief Const casts WeakRef<U> to WeakRef<T> + * @param[in] r Source weak reference + * @return Result weak reference + */ + template <class T, class U> + WeakRef<T> &&constRefCast(WeakRef<U> &&r) noexcept; +} + +#include "WeakRef.hpp" + +#endif // __UCL_UTIL_MEMORY_WEAK_REF_H__ diff --git a/ucl/inc/ucl/util/memory/WeakRef.hpp b/ucl/include/ucl/util/memory/WeakRef.hpp index 6634f3c..21b1a58 100644 --- a/ucl/inc/ucl/util/memory/WeakRef.hpp +++ b/ucl/include/ucl/util/memory/WeakRef.hpp @@ -99,7 +99,7 @@ namespace ucl { template <class T> inline T *WeakRef<T>::getUnsafePtr() const noexcept { - return (operator bool() ? this->m_ptr : nullptr); + return this->m_ptr; } template <class T> diff --git a/ucl/include/ucl/util/memory/helpers.h b/ucl/include/ucl/util/memory/helpers.h new file mode 100644 index 0000000..24074cc --- /dev/null +++ b/ucl/include/ucl/util/memory/helpers.h @@ -0,0 +1,243 @@ +/* + * 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 __UCL_UTIL_MEMORY_HELPERS_H__ +#define __UCL_UTIL_MEMORY_HELPERS_H__ + +namespace ucl { + + // Misc // + + namespace util { + + /** + * @brief Safely disposes object and resets shared reference + * @param[in/out] r Target shared reference + */ + template <class T, class = typename std::enable_if< + std::is_convertible<T *, IDisposable *>::value>::type> + inline void dispose(SharedRef<T> &r) noexcept + { + if (r) { + r->dispose(); + r.reset(); + } + } + + /** + * @brief Safely disposes object and resets weak reference + * @param[in/out] r Target weak reference + */ + template <class T, class = typename std::enable_if< + std::is_convertible<T *, IDisposable *>::value>::type> + inline void dispose(WeakRef<T> &r) noexcept + { + if (const auto shared = r.lock()) { + shared->dispose(); + r.reset(); + } + } + } + + // Generic casting functions // + + /** + * @brief Dynamically casts reference objects + * @param[in] src Source reference object + * @return Result reference object + */ + template <class T, class U> + inline auto dynamicCast(const U &src) noexcept -> decltype( + dynamicRefCast<typename T::Type>(src)) + { + return dynamicRefCast<typename T::Type>(src); + } + + /** + * @brief Const casts reference objects + * @param[in] src Source reference object + * @return Result reference object + */ + template <class T, class U> + inline auto constCast(U &&src) noexcept -> decltype( + constRefCast<typename T::Type>(std::forward<U>(src))) + { + return constRefCast<typename T::Type>(std::forward<U>(src)); + } + + // Relation operators // + + namespace himpl { + + template <class T> + struct IsShared : std::false_type {}; + template <class T> + struct IsShared<SharedRef<T>> : std::true_type {}; + template <class T> + struct IsShared<WeakRef<T>> : std::true_type {}; + + template <class T, class = typename std::enable_if< + !IsShared<T>::value>::type> + inline const T &getCmpPtr(const T &ptr) noexcept + { + return ptr; + } + + template <class T> + inline T *getCmpPtr(const SharedRef<T> &r) noexcept + { + return r.get(); + } + + template <class T> + inline T *getCmpPtr(const WeakRef<T> &r) noexcept + { + return r.getUnsafePtr(); + } + } + + /** + * @brief Compares equals target pointers/references + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if equal, false - not equal + */ + template <class T, class U, class = typename std::enable_if< + himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type> + inline bool operator==(const T &lhs, const U &rhs) noexcept + { + return (himpl::getCmpPtr(lhs) == himpl::getCmpPtr(rhs)); + } + + /** + * @brief Compares unequals target pointers/references + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if not equal, false - equal + */ + template <class T, class U, class = typename std::enable_if< + himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type> + inline bool operator!=(const T &lhs, const U &rhs) noexcept + { + return (himpl::getCmpPtr(lhs) != himpl::getCmpPtr(rhs)); + } + + /** + * @brief Compares less target pointers/references + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if left is less than right, false - otherwise + */ + template <class T, class U, class = typename std::enable_if< + himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type> + inline bool operator<(const T &lhs, const U &rhs) noexcept + { + return (himpl::getCmpPtr(lhs) < himpl::getCmpPtr(rhs)); + } + + /** + * @brief Compares less or equals target pointers/references + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if left is less or equals to right, false - otherwise + */ + template <class T, class U, class = typename std::enable_if< + himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type> + inline bool operator<=(const T &lhs, const U &rhs) noexcept + { + return (himpl::getCmpPtr(lhs) <= himpl::getCmpPtr(rhs)); + } + + /** + * @brief Compares greater target pointers/references + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if left is greater than right, false - otherwise + */ + template <class T, class U, class = typename std::enable_if< + himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type> + inline bool operator>(const T &lhs, const U &rhs) noexcept + { + return (himpl::getCmpPtr(lhs) > himpl::getCmpPtr(rhs)); + } + + /** + * @brief Compares greater or equals target pointers/references + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if left is greater or equals to right, false - otherwise + */ + template <class T, class U, class = typename std::enable_if< + himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type> + inline bool operator>=(const T &lhs, const U &rhs) noexcept + { + return (himpl::getCmpPtr(lhs) >= himpl::getCmpPtr(rhs)); + } + + /** + * @brief Compares equals target reference and NULL + * @param[in] lhs Left hand side operand + * @param[in] rhs NULL + * @return true - if equal, false - not equal + */ + template <class T, class = typename std::enable_if< + himpl::IsShared<T>::value>::type> + inline bool operator==(const T &lhs, std::nullptr_t rhs) noexcept + { + return !lhs; + } + + /** + * @brief Compares equals target reference and NULL + * @param[in] lhs NULL + * @param[in] rhs Right hand side operand + * @return true - if equal, false - not equal + */ + template <class T, class = typename std::enable_if< + himpl::IsShared<T>::value>::type> + bool operator==(std::nullptr_t lhs, const T &rhs) noexcept + { + return !rhs; + } + + /** + * @brief Compares unequals target reference and NULL + * @param[in] lhs Left hand side operand + * @param[in] rhs NULL + * @return true - if not equal, false - equal + */ + template <class T, class = typename std::enable_if< + himpl::IsShared<T>::value>::type> + bool operator!=(const T &lhs, std::nullptr_t rhs) noexcept + { + return lhs; + } + + /** + * @brief Compares unequals target reference and NULL + * @param[in] lhs NULL + * @param[in] rhs Right hand side operand + * @return true - if not equal, false - equal + */ + template <class T, class = typename std::enable_if< + himpl::IsShared<T>::value>::type> + bool operator!=(std::nullptr_t lhs, const T &rhs) noexcept + { + return rhs; + } +} + +#endif // __UCL_UTIL_MEMORY_HELPERS_H__ diff --git a/ucl/inc/ucl/util/memory/macro.h b/ucl/include/ucl/util/memory/macro.h index b97175a..c55adac 100644 --- a/ucl/inc/ucl/util/memory/macro.h +++ b/ucl/include/ucl/util/memory/macro.h @@ -17,12 +17,15 @@ #ifndef __UCL_UTIL_MEMORY_MACRO_H__ #define __UCL_UTIL_MEMORY_MACRO_H__ +#define UCL_DECLARE_REF_ALIASES_NOFW(TYPE_NAME) \ + using TYPE_NAME##SRef = ::ucl::SharedRef<TYPE_NAME>; \ + using TYPE_NAME##WRef = ::ucl::WeakRef<TYPE_NAME>; \ + using TYPE_NAME##SCRef = ::ucl::SharedRef<const TYPE_NAME>; \ + using TYPE_NAME##WCRef = ::ucl::WeakRef<const TYPE_NAME> + #define UCL_DECLARE_REF_ALIASES(CLASS_NAME) \ class CLASS_NAME; \ - using CLASS_NAME##SRef = ::ucl::SharedRef<CLASS_NAME>; \ - using CLASS_NAME##WRef = ::ucl::WeakRef<CLASS_NAME>; \ - using CLASS_NAME##SCRef = ::ucl::SharedRef<const CLASS_NAME>; \ - using CLASS_NAME##WCRef = ::ucl::WeakRef<const CLASS_NAME> + UCL_DECLARE_REF_ALIASES_NOFW(CLASS_NAME) #define UCL_USING_REF_ALIASES(CLASS_NAME) \ using CLASS_NAME; \ diff --git a/ucl/inc/ucl/util/shortLogs.h b/ucl/include/ucl/util/shortLogs.h index 02f8bbf..02f8bbf 100644 --- a/ucl/inc/ucl/util/shortLogs.h +++ b/ucl/include/ucl/util/shortLogs.h diff --git a/ucl/inc/ucl/util/smartDelegation.h b/ucl/include/ucl/util/smartDelegation.h index 6714411..6714411 100644 --- a/ucl/inc/ucl/util/smartDelegation.h +++ b/ucl/include/ucl/util/smartDelegation.h diff --git a/ucl/include/ucl/util/smartDelegation/WeakDelegate.h b/ucl/include/ucl/util/smartDelegation/WeakDelegate.h new file mode 100644 index 0000000..65725c5 --- /dev/null +++ b/ucl/include/ucl/util/smartDelegation/WeakDelegate.h @@ -0,0 +1,100 @@ +/* + * 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 __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__ +#define __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__ + +#include "ucl/util/delegation.h" +#include "ucl/util/memory.h" + +namespace ucl { + + template <class FUNC_SIG> + class WeakDelegate; + + /** + * @brief Delegate that uses WeakRef<void> as data pointer + */ + template <class R, class ...ARGS> + class WeakDelegate<R(ARGS...)> : + public BaseDelegate<R(ARGS...), WeakRef<void>> { + public: + /** + * @brief Constant reference to regular Delegate with same signature + * @details Useful as unsubscribe delegate. Especially useful in + * destructors because asWeak(*this) will return NULL + * reference. + */ + using CDRef = const Delegate<R(ARGS...)> &; + + /** + * @brief Result delegate of the lock() method + */ + class LockDelegate { + public: + /** + * @brief Checks if this delegate is not NULL + * @return true - if not NULL, false - if NULL + */ + explicit operator bool() const noexcept; + + /** + * @brief Invokes this delegate + * @details Delgates must be checked for NULL before invoke. + * @params[in] args Arguments of the invoke + * @return Result of the invoke + */ + R operator()(ARGS ...args) const; + + private: + LockDelegate(SharedRef<void> data, + typename WeakDelegate::StubA stubA) noexcept; + private: + SharedRef<void> m_data; + typename WeakDelegate::StubA m_stubA; + friend class WeakDelegate; + }; + + public: + using BaseDelegate<R(ARGS...), WeakRef<void>>::BaseDelegate; + + /** + * @brief Locks this delegate for further invoke + * @return Lock delegate + */ + LockDelegate lock() const; + + /** + * @brief Creates delegate to shared instance method + * @param[in] data This weak reference of the instance + * @return Created delegate + */ + template <class CLASS, R(CLASS::*METHOD)(ARGS...)> + static WeakDelegate make(WeakRef<CLASS> data) noexcept; + + /** + * @brief Creates delegate to constant shared instance method + * @param[in] data Constant this weak reference of the instance + * @return Created delegate + */ + template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> + static WeakDelegate make(WeakRef<const CLASS> data) noexcept; + }; +} + +#include "WeakDelegate.hpp" + +#endif // __UCL_UTIL_SMART_DELEGATION_WEAK_DELEGATE_H__ diff --git a/ucl/inc/ucl/util/smartDelegation/WeakDelegate.hpp b/ucl/include/ucl/util/smartDelegation/WeakDelegate.hpp index fa7b3f8..b528aad 100644 --- a/ucl/inc/ucl/util/smartDelegation/WeakDelegate.hpp +++ b/ucl/include/ucl/util/smartDelegation/WeakDelegate.hpp @@ -16,30 +16,55 @@ namespace ucl { + // WeakDelegate<R(ARGS...)>::Lock // + + template <class R, class ...ARGS> + inline WeakDelegate<R(ARGS...)>::LockDelegate::LockDelegate( + SharedRef<void> data, + const typename WeakDelegate::StubA stubA) noexcept : + m_data(std::move(data)), + m_stubA(stubA) + { + } + template <class R, class ...ARGS> - inline R WeakDelegate<R(ARGS...)>::operator()(ARGS ...args) const + inline WeakDelegate<R(ARGS...)>::LockDelegate:: + operator bool() const noexcept { - const auto tmp = this->m_data.lock(); - if (tmp) { - return this->m_stubA(tmp.get(), std::forward<ARGS>(args)...); - } - return R(); + return !!m_data; + } + + template <class R, class ...ARGS> + inline R WeakDelegate<R(ARGS...)>::LockDelegate:: + operator()(ARGS ...args) const + { + return m_stubA(m_data.get(), std::forward<ARGS>(args)...); + } + + // WeakDelegate<R(ARGS...)> // + + template <class R, class ...ARGS> + typename WeakDelegate<R(ARGS...)>::LockDelegate + WeakDelegate<R(ARGS...)>::lock() const + { + return {this->m_data.lock(), this->m_stubA}; } template <class R, class ...ARGS> template <class CLASS, R(CLASS::*METHOD)(ARGS...)> inline WeakDelegate<R(ARGS...)> WeakDelegate<R(ARGS...)>::make( - const WeakRef<CLASS> &data) noexcept + WeakRef<CLASS> data) noexcept { - return {data, WeakDelegate::Cb::template stubA<CLASS, METHOD>}; + return {std::move(data), + WeakDelegate::Cb::template stubA<CLASS, METHOD>}; } template <class R, class ...ARGS> template <class CLASS, R(CLASS::*METHOD)(ARGS...) const> inline WeakDelegate<R(ARGS...)> WeakDelegate<R(ARGS...)>::make( - const WeakRef<const CLASS> &data) noexcept + WeakRef<const CLASS> data) noexcept { - return {constRefCast<CLASS>(data), + return {constRefCast<CLASS>(std::move(data)), WeakDelegate::Cb::template stubA<CLASS, METHOD>}; } } diff --git a/ucl/inc/ucl/util/smartDelegation/macro.h b/ucl/include/ucl/util/smartDelegation/macro.h index b117820..cd4baa5 100644 --- a/ucl/inc/ucl/util/smartDelegation/macro.h +++ b/ucl/include/ucl/util/smartDelegation/macro.h @@ -17,7 +17,21 @@ #ifndef __UCL_UTIL_SMART_DELEGATION_MACRO_H__ #define __UCL_UTIL_SMART_DELEGATION_MACRO_H__ -#define UCL_WEAK_DELEGATE(FUNC, DATA) \ - _UCL_DELEGATE(::ucl::WeakDelegate, FUNC, DATA) +/** + * @brief Creates WeakDelegate<auto> to specified shared instance method + * @param FUNC Function for the delegate without & + * @param DATA Weak reference of the instance + * @return Created delegate + */ +#define UCL_WEAK_DELEGATE(FUNC, DATA) _UCL_DELEGATE( \ + ::ucl::WeakDelegate, FUNC, DATA) + +/** + * @brief Creates WeakDelegate<auto> to shared "this" instance method + * @param FUNC_NAME name of the function of the "this" class + * @return Created delegate + */ +#define UCL_WEAK_DELEGATE_THIS(FUNC_NAME) UCL_WEAK_DELEGATE( \ + std::remove_pointer<decltype(this)>::type::FUNC_NAME, asWeak(*this)) #endif // __UCL_UTIL_SMART_DELEGATION_MACRO_H__ diff --git a/ucl/inc/ucl/util/smartDelegation/shortMacro.h b/ucl/include/ucl/util/smartDelegation/shortMacro.h index ddf5e35..6a8219d 100644 --- a/ucl/inc/ucl/util/smartDelegation/shortMacro.h +++ b/ucl/include/ucl/util/smartDelegation/shortMacro.h @@ -19,4 +19,6 @@ #define WEAK_DELEGATE(FUNC, DATA) UCL_WEAK_DELEGATE(FUNC, DATA) +#define WEAK_DELEGATE_THIS(FUNC_NAME) UCL_WEAK_DELEGATE_THIS(FUNC_NAME) + #endif // __UCL_UTIL_SMART_DELEGATION_SHORT_MACRO_H__ diff --git a/ucl/inc/ucl/util/threading.h b/ucl/include/ucl/util/threading.h index 4595b1b..4595b1b 100644 --- a/ucl/inc/ucl/util/threading.h +++ b/ucl/include/ucl/util/threading.h diff --git a/ucl/inc/ucl/util/threading/CondVar.h b/ucl/include/ucl/util/threading/CondVar.h index e73a763..8226520 100644 --- a/ucl/inc/ucl/util/threading/CondVar.h +++ b/ucl/include/ucl/util/threading/CondVar.h @@ -21,14 +21,43 @@ namespace ucl { - class CondVar final : public NonCopyable { + /** + * @brief Implements conditional variable + */ + class CondVar final : private NonCopyable { public: + /** + * @brief Constructor + */ CondVar(); + + /** + * @brief Destructor + */ ~CondVar(); + + /** + * @brief Waits on MutexLock until notification + * @param[in] lock Target MutexLock object + */ void wait(MutexLock &lock); + + /** + * @brief Notifies single waiter of this variable + */ void notify(); + + /** + * @brief Notifies all waiters of this variable + */ void notifyAll(); + + /** + * @brief Gets native pthread conditional variable + * @return Pointer to pthread conditional variable + */ pthread_cond_t *getHandle(); + private: pthread_cond_t m_cond; }; diff --git a/ucl/inc/ucl/util/threading/CondVar.hpp b/ucl/include/ucl/util/threading/CondVar.hpp index 09b0ae0..09b0ae0 100644 --- a/ucl/inc/ucl/util/threading/CondVar.hpp +++ b/ucl/include/ucl/util/threading/CondVar.hpp diff --git a/ucl/inc/ucl/util/threading/Mutex.h b/ucl/include/ucl/util/threading/Mutex.h index eda90ff..7370f69 100644 --- a/ucl/inc/ucl/util/threading/Mutex.h +++ b/ucl/include/ucl/util/threading/Mutex.h @@ -25,13 +25,38 @@ namespace ucl { - class Mutex final : public NonCopyable { + /** + * @brief Implements mutex + */ + class Mutex final : protected NonCopyable { public: + /** + * @brief Constructor + * @param[in] recursive Allow reentrancy for this mutex + */ Mutex(bool recursive = false); + + /** + * @brief Destructor + */ ~Mutex(); + + /** + * @brief Acquires lock for this mutex by calling thread + */ void lock(); + + /** + * @brief Releases lock for this mutex from calling thread + */ void unlock(); + + /** + * @brief Gets native pthread mutex + * @return Pointer to pthread mutex + */ pthread_mutex_t *getHandle(); + private: pthread_mutex_t m_mutex; }; diff --git a/ucl/inc/ucl/util/threading/Mutex.hpp b/ucl/include/ucl/util/threading/Mutex.hpp index c3b75be..c3b75be 100644 --- a/ucl/inc/ucl/util/threading/Mutex.hpp +++ b/ucl/include/ucl/util/threading/Mutex.hpp diff --git a/ucl/inc/ucl/util/threading/MutexLock.h b/ucl/include/ucl/util/threading/MutexLock.h index 062837f..927e223 100644 --- a/ucl/inc/ucl/util/threading/MutexLock.h +++ b/ucl/include/ucl/util/threading/MutexLock.h @@ -21,11 +21,30 @@ namespace ucl { - class MutexLock final : public NonCopyable { + /** + * @brief Implements mutex lock + */ + class MutexLock final : protected NonCopyable { public: + /** + * @brief Constructor + * @details Locks target mutex + * @param[in] mutex Target mutex + */ MutexLock(Mutex &mutex); + + /** + * @brief Destructor + * @details Unlocks locked mutex + */ ~MutexLock(); + + /** + * @brief Gets locked mutex + * @return Reference to locked mutex + */ Mutex &getMutex(); + private: Mutex &m_mutex; }; diff --git a/ucl/inc/ucl/util/threading/MutexLock.hpp b/ucl/include/ucl/util/threading/MutexLock.hpp index a30d995..a30d995 100644 --- a/ucl/inc/ucl/util/threading/MutexLock.hpp +++ b/ucl/include/ucl/util/threading/MutexLock.hpp diff --git a/ucl/inc/ucl/util/threading/Thread.h b/ucl/include/ucl/util/threading/Thread.h index 0839921..affb7f7 100644 --- a/ucl/inc/ucl/util/threading/Thread.h +++ b/ucl/include/ucl/util/threading/Thread.h @@ -17,28 +17,68 @@ #ifndef __UCL_UTIL_THREADING_THREAD_H__ #define __UCL_UTIL_THREADING_THREAD_H__ -// Use pthread because Tizen 3.0 officially not support C++ 11 -// And there were problems with threading in C++ 11 and Tizen 3.0 +// Use pthread because Tizen officially not support C++ 11 +// And there were problems with threading in C++ 11 and Tizen #include <pthread.h> #include "ucl/util/types/classTypes.h" namespace ucl { - class Thread final : public NonCopyable { + /** + * @brief Implements executing thread + */ + class Thread final : protected NonCopyable { public: + /** + * @brief Constructor + * @details Creates idling thread + */ Thread(); + + /** + * @brief Constructor + * @details Creates running thread + * @param[in] func Function to call in new the thread + */ template <class FUNC> explicit Thread(FUNC &&func); + + /** + * @brief Destructor + * @details Joins if was started and not joined + */ ~Thread(); + /** + * @brief Gets started status of the thread + * @return true - if was started, false - otherwise + */ bool wasStarted() const; + + /** + * @brief Gets joined status of the thread + * @return true - if was joined, false - otherwise + */ bool wasJoinded() const; + /** + * @brief Starts the thread + * @param[in] func Function to call in the new thread + * @return true - if was started, false - otherwise + */ template <class FUNC> bool start(FUNC &&func); + + /** + * @brief Joins with the thread + */ void join(); + /** + * @brief Gets native pthread thread + * @return Pointer to pthread thread + */ pthread_t *getHandle(); private: diff --git a/ucl/inc/ucl/util/threading/Thread.hpp b/ucl/include/ucl/util/threading/Thread.hpp index 74259c1..eea5e14 100644 --- a/ucl/inc/ucl/util/threading/Thread.hpp +++ b/ucl/include/ucl/util/threading/Thread.hpp @@ -34,7 +34,7 @@ namespace ucl { inline Thread::~Thread() { - if (!m_wasJoined) { + if (m_wasStarted && !m_wasJoined) { join(); } } @@ -76,7 +76,7 @@ namespace ucl { inline void Thread::join() { if (!m_wasStarted) { - UCL_WLOG("Not stared started!"); + UCL_WLOG("Not started!"); return; } if (m_wasJoined) { diff --git a/ucl/inc/ucl/util/types.h b/ucl/include/ucl/util/types.h index 70a33d3..70a33d3 100644 --- a/ucl/inc/ucl/util/types.h +++ b/ucl/include/ucl/util/types.h diff --git a/ucl/inc/ucl/util/types/Result.h b/ucl/include/ucl/util/types/Result.h index 099223f..224a1aa 100644 --- a/ucl/inc/ucl/util/types/Result.h +++ b/ucl/include/ucl/util/types/Result.h @@ -23,6 +23,9 @@ namespace ucl { // ResultData declaration // + /** + * @brief Data that for specific result code + */ struct ResultData final { const char *name; int logPrio; @@ -30,44 +33,102 @@ namespace ucl { // Result declaration // + /** + * @brief Type safe container for "int" result codes + */ struct Result final { + /** + * @brief Result code value + */ int value; + /** + * @brief Defaulted default constructor + */ Result() = default; + /** + * @brief Conversion constructor + * @details v Value of result. Can be any type convertible to "int" + * that has "_UCL_RESULT" constant as public member. + */ template <class VALUE, class = char(*)[VALUE::_UCL_RESULT * 0 + 1]> constexpr Result(const VALUE &v) : value(v) {} }; // Result non-member functions // + /** + * @brief Gets result data for specific result code + * @param[in] result Specific result code + * @return Reference to ResultData + */ const ResultData &getResultData(Result result); + /** + * @brief Checks if specific result code is good (>= 0) + * @param[in] result Specific result code + * @return true - if good, false - otherwise + */ constexpr bool isGood(Result result); + + /** + * @brief Checks if specific result code is bad (< 0) + * @param[in] result Specific result code + * @return true - if bad, false - otherwise + */ constexpr bool isBad(Result result); + /** + * @brief Compares equals values of target results + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if equal, false - not equal + */ constexpr bool operator==(Result lhs, Result rhs); + + /** + * @brief Compares unequals values of target results + * @param[in] lhs Left hand side operand + * @param[in] rhs Right hand side operand + * @return true - if not equal, false - equal + */ constexpr bool operator!=(Result lhs, Result rhs); // Basic Result values // + /** + * @brief Enumeration of basic result codes + */ enum { + /** + * @brief Allows conversion to Result + */ _UCL_RESULT, RES_OK = 0, RES_FALSE = 1, + + /** + * @brief Denotes past-end result code of the enumeration range + * @details Do not move this value around. + */ _RES_END, RES_FAIL = -1, RES_INVALID_ARGUMENTS = -2, - RES_ILLEGAL_STATE = -3, + RES_INVALID_OPERATION = -3, RES_OUT_OF_MEMORY = -4, RES_IO_ERROR = -5, RES_NOT_SUPPORTED = -6, RES_INVALID_DATA = -7, RES_FATAL = -8, - // TODO MUST match previous item! - _RES_BEGIN = RES_FATAL + + /** + * @brief Denotes first result code of the enumeration range + * @details Must be last and match previous enumeration value + */ + _RES_BEGIN = RES_FATAL }; } diff --git a/ucl/inc/ucl/util/types/Result.hpp b/ucl/include/ucl/util/types/Result.hpp index c83db4c..c83db4c 100644 --- a/ucl/inc/ucl/util/types/Result.hpp +++ b/ucl/include/ucl/util/types/Result.hpp diff --git a/ucl/inc/ucl/util/types/baseTypes.h b/ucl/include/ucl/util/types/baseTypes.h index c5062db..2e59dab 100644 --- a/ucl/inc/ucl/util/types/baseTypes.h +++ b/ucl/include/ucl/util/types/baseTypes.h @@ -33,6 +33,10 @@ #include "ucl/config.h" namespace ucl { + + /** + * @brief Alias for "unsigned int" + */ using UInt = unsigned int; } diff --git a/ucl/include/ucl/util/types/classTypes.h b/ucl/include/ucl/util/types/classTypes.h new file mode 100644 index 0000000..c289809 --- /dev/null +++ b/ucl/include/ucl/util/types/classTypes.h @@ -0,0 +1,150 @@ +/* + * 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 __UCL_UTIL_TYPES_CLASS_TYPES_H__ +#define __UCL_UTIL_TYPES_CLASS_TYPES_H__ + +#include "baseTypes.h" + +namespace ucl { + + /** + * @brief Base class for all non-copyable objects + */ + class NonCopyable { + public: + /** + * @brief Deleted copy constructor + */ + NonCopyable(const NonCopyable &) = delete; + + /** + * @brief Deleted assignment operator + */ + NonCopyable &operator=(const NonCopyable &) = delete; + + private: + struct PrivateType {}; + + protected: + /** + * @brief Tag-type for restricting non public access + */ + using Private = const PrivateType &; + + /** + * @brief Value for Private type to allow access + */ + static const PrivateType PRIVATE; + + protected: + /** + * @brief Default constructor + */ + NonCopyable() = default; + + /** + * @brief Destructor + */ + ~NonCopyable() = default; + }; + + /** + * @brief Interface for object that cen be disposed (half destroyed) + */ + class IDisposable : protected NonCopyable { + public: + /** + * @brief Disposes the object if not already disposed + */ + virtual void dispose() = 0; + + /** + * @brief Gets the dispose state + * @return true - if disposed, false - otherwise + */ + virtual bool isDisposed() const = 0; + + protected: + /** + * @brief Destructor + */ + ~IDisposable() = default; + }; + + /** + * @brief Template interface for factory that builds IPRODUCT + */ + template <class IPRODUCT> + class IFactory : protected NonCopyable { + public: + /** + * @brief Alias for "IPRODUCT" + */ + using IProduct = IPRODUCT; + + public: + /** + * @brief Creates new instance of type IPRODUCT + * @return Pointer to new instance of type IPRODUCT + */ + virtual IPRODUCT *newInstance() const = 0; + + protected: + /** + * @brief Destructor + */ + ~IFactory() = default; + }; + + /** + * @brief Template implementation of factory that builds PRODUCT + */ + template <class PRODUCT, class IPRODUCT> + class Factory final : public IFactory<IPRODUCT> { + public: + /** + * @brief Alias for "PRODUCT" + */ + using Product = PRODUCT; + + public: + /** + * @brief Creates new instance of PRODUCT + * @return Pointer to new instance of PRODUCT as IPRODUCT + */ + virtual IPRODUCT *newInstance() const final override + { + return new PRODUCT(); + } + }; + + /** + * @brief Priority selector for SFINAE functions + * @details Main tamplate for N > 0 + */ + template <int N> + struct P : P<N - 1> {}; + + /** + * @brief Priority selector for SFINAE functions + * @details Breaks recursion for N = 0 + */ + template <> + struct P<0> {}; +} + +#endif // __UCL_UTIL_TYPES_CLASS_TYPES_H__ diff --git a/ucl/src/appfw/InstanceManagerBase.cpp b/ucl/source/appfw/InstanceManagerBase.cpp index 2e90b24..2e90b24 100644 --- a/ucl/src/appfw/InstanceManagerBase.cpp +++ b/ucl/source/appfw/InstanceManagerBase.cpp diff --git a/ucl/src/appfw/SysEventProvider.cpp b/ucl/source/appfw/SysEventProvider.cpp index 8958aaf..b2b6afe 100644 --- a/ucl/src/appfw/SysEventProvider.cpp +++ b/ucl/source/appfw/SysEventProvider.cpp @@ -22,7 +22,7 @@ namespace ucl { // SysEventProvider::EventProxy // - class SysEventProvider::EventProxy : public NonCopyable { + class SysEventProvider::EventProxy : protected NonCopyable { public: EventProxy(SysEventProvider &provider, const SysEvent sysEvent, diff --git a/ucl/src/appfw/UIApp.cpp b/ucl/source/appfw/UIApp.cpp index 4e1a4de..debb5ac 100644 --- a/ucl/src/appfw/UIApp.cpp +++ b/ucl/source/appfw/UIApp.cpp @@ -81,7 +81,11 @@ namespace ucl { { m_instance.reset(); m_instanceMgr.setSysEventProvider(nullptr); - m_window.reset(); + if (m_window) { + m_window->setIsOwner(false); + m_window->markForDeletion(); + m_window.reset(); + } } void UIApp::onPause() @@ -122,11 +126,11 @@ namespace ucl { elm_app_base_scale_set(baseScale); } - if (appParams.get(AppParam::ACCELERATION_PREFERENECE, paramValue)) { + if (appParams.get(AppParam::ACCELERATION_PREFERENCE, paramValue)) { const auto accelPreference = paramValue.asString(); if (isEmpty(accelPreference)) { LOG_RETURN(RES_INVALID_DATA, - "Invalid parameter ACCELERATION_PREFERENECE: %s", + "Invalid parameter ACCELERATION_PREFERENCE: %s", accelPreference.get()); } elm_config_accel_preference_set(accelPreference.get()); @@ -158,7 +162,6 @@ namespace ucl { m_window = Window::Builder(). setType(winType). setName(paramValue.asString().get()). - setIsOwner(true). build(); if (!m_window) { LOG_RETURN(RES_FAIL, "Window::Builder().build() Failed!"); @@ -170,9 +173,9 @@ namespace ucl { void UIApp::initSysEventManager() { m_instanceMgr.setSysEventProvider( - util::makeUnique(new SysEventProvider( + util::makeUnique<SysEventProvider>( &ui_app_add_event_handler, - &ui_app_remove_event_handler))); + &ui_app_remove_event_handler)); } Result UIApp::createInstance() @@ -183,7 +186,7 @@ namespace ucl { } const auto res = instance->onCreate(this); - if (isBad(res)) { + if (res != RES_OK) { LOG_RETURN(res, "instance->onCreate() failed!"); } diff --git a/ucl/source/appfw/common.h b/ucl/source/appfw/common.h new file mode 100644 index 0000000..402bb6e --- /dev/null +++ b/ucl/source/appfw/common.h @@ -0,0 +1,22 @@ +/* + * 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 __UCL_SOURCE_APPFW_COMMON_H__ +#define __UCL_SOURCE_APPFW_COMMON_H__ + +#include "ucl/source/common.h" + +#endif // __UCL_SOURCE_APPFW_COMMON_H__ diff --git a/ucl/src/appfw/helpers.cpp b/ucl/source/appfw/helpers.cpp index c547dce..c547dce 100644 --- a/ucl/src/appfw/helpers.cpp +++ b/ucl/source/appfw/helpers.cpp diff --git a/ucl/src/common.h b/ucl/source/common.h index f358669..3312380 100644 --- a/ucl/src/common.h +++ b/ucl/source/common.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __UCL_COMMON_H__ -#define __UCL_COMMON_H__ +#ifndef __UCL_SOURCE_COMMON_H__ +#define __UCL_SOURCE_COMMON_H__ #include <cmath> #include <cstring> @@ -32,4 +32,4 @@ #include "ucl/util/delegation/shortMacro.h" #include "ucl/util/smartDelegation/shortMacro.h" -#endif // __UCL_COMMON_H__ +#endif // __UCL_SOURCE_COMMON_H__ diff --git a/ucl/src/gui/EdjeWidget.cpp b/ucl/source/gui/EdjeWidget.cpp index 8d67596..8d67596 100644 --- a/ucl/src/gui/EdjeWidget.cpp +++ b/ucl/source/gui/EdjeWidget.cpp diff --git a/ucl/inc/ucl/appfw/IInstanceContext.h b/ucl/source/gui/ElmWidget.cpp index b06c177..cace7be 100644 --- a/ucl/inc/ucl/appfw/IInstanceContext.h +++ b/ucl/source/gui/ElmWidget.cpp @@ -14,21 +14,27 @@ * limitations under the License. */ -#ifndef __UCL_APPFW_I_INSTANCE_CONTEXT_H__ -#define __UCL_APPFW_I_INSTANCE_CONTEXT_H__ - -#include "types.h" +#include "ucl/gui/ElmWidget.h" #include "ucl/gui/Window.h" +#include "ucl/gui/helpers.h" + +#include "common.h" namespace ucl { - class IInstanceContext : public Polymorphic { - public: - virtual AppType getAppType() const = 0; - virtual WindowSRef getWindow() = 0; - virtual void exitApp() = 0; - }; -} + void ElmWidget::setFocusedImpl(const bool value) + { + elm_object_focus_set(getEo(), toEina(value)); + } -#endif // __UCL_APPFW_I_INSTANCE_CONTEXT_H__ + bool ElmWidget::isFocusedImpl() const + { + return elm_object_focus_get(getEo()); + } + + Window *ElmWidget::getWindow() const + { + return dynamicWidgetCast<Window>(getTopWidget()); + } +} diff --git a/ucl/src/gui/Genlist.cpp b/ucl/source/gui/Genlist.cpp index b0e31a5..2b20d48 100644 --- a/ucl/src/gui/Genlist.cpp +++ b/ucl/source/gui/Genlist.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "ucl/gui/Genlist.h" #include "common.h" @@ -23,7 +24,7 @@ namespace ucl { GenlistSRef Genlist::Builder::build(ElmWidget &parent) const { - Evas_Object *const eo = elm_genlist_add(parent); + Evas_Object *const eo = elm_genlist_add(as_eo(parent)); if (!eo) { LOG_RETURN_VALUE(RES_FAIL, {}, "elm_genlist_add() failed!"); } diff --git a/ucl/src/gui/Layout.cpp b/ucl/source/gui/Layout.cpp index 1509fc5..f5fb2fd 100644 --- a/ucl/src/gui/Layout.cpp +++ b/ucl/source/gui/Layout.cpp @@ -26,7 +26,7 @@ namespace ucl { LayoutSRef Layout::Builder::build(ElmWidget &parent) const { - Evas_Object *const eo = elm_layout_add(parent); + Evas_Object *const eo = elm_layout_add(as_eo(parent)); if (!eo) { LOG_RETURN_VALUE(RES_FAIL, {}, "elm_layout_add() failed!"); } diff --git a/ucl/src/gui/NaviItem.cpp b/ucl/source/gui/NaviItem.cpp index 02f5da2..02f5da2 100644 --- a/ucl/src/gui/NaviItem.cpp +++ b/ucl/source/gui/NaviItem.cpp diff --git a/ucl/src/gui/Naviframe.cpp b/ucl/source/gui/Naviframe.cpp index 69d80a5..7943607 100644 --- a/ucl/src/gui/Naviframe.cpp +++ b/ucl/source/gui/Naviframe.cpp @@ -24,13 +24,13 @@ namespace ucl { NaviframeSRef Naviframe::Builder::build(ElmWidget &parent) const { - Evas_Object *const eo = elm_naviframe_add(parent); + Evas_Object *const eo = elm_naviframe_add(as_eo(parent)); if (!eo) { ELOG("elm_naviframe_add() failed!"); return {}; } - auto result = makeShared<Naviframe>(eo); + auto result = makeShared<Naviframe>(eo, PRIVATE); if (m_needBindToEo) { result->bindToEo(); @@ -47,12 +47,12 @@ namespace ucl { // Naviframe // - Naviframe::Naviframe(IRefCountObj &rc, Evas_Object *eo) : - StyledWidget(&rc, eo, true), + Naviframe::Naviframe(IRefCountObj &rc, Evas_Object *eo, Private) : + StyledWidget(&rc, eo), m_isInTransition(false) { - addEventHandler(NAVI_TRANSITION_FINISHED, WEAK_DELEGATE( - Naviframe::onTransitionFinished, asWeak(*this))); + addEventHandler(NAVI_TRANSITION_FINISHED, + WEAK_DELEGATE_THIS(onTransitionFinished)); } void Naviframe::setInTransition(const bool inTransition) diff --git a/ucl/source/gui/RadioBox.cpp b/ucl/source/gui/RadioBox.cpp new file mode 100644 index 0000000..ce8ecc7 --- /dev/null +++ b/ucl/source/gui/RadioBox.cpp @@ -0,0 +1,46 @@ +/* + * 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/gui/RadioBox.h" + +#include "common.h" + +namespace ucl { + + // RadioBox::Builder // + + RadioBoxSRef RadioBox::Builder::build(ElmWidget &parent) const + { + Evas_Object *const eo = elm_radio_add(as_eo(parent)); + if (!eo) { + LOG_RETURN_VALUE(RES_FAIL, {}, "elm_genlist_add() failed!"); + } + + auto result = makeShared<RadioBox>(eo, m_isOwner); + + if (m_needBindToEo) { + result->bindToEo(); + } + + if (isValid(m_style)) { + result->setStyle(m_style); + } + + show(*result); + + return result; + } +} diff --git a/ucl/src/gui/Widget.cpp b/ucl/source/gui/Widget.cpp index 096c6e1..7da5d29 100644 --- a/ucl/src/gui/Widget.cpp +++ b/ucl/source/gui/Widget.cpp @@ -27,36 +27,36 @@ namespace ucl { // Widget::EventProxy // - class Widget::EventProxy : public NonCopyable { + class Widget::EventProxy : protected NonCopyable { public: EventProxy(Widget &widget, const WidgetEvent event, - const WidgetEventHandler handler) : + WidgetEventHandler handler) : m_widget(widget), - m_handler(handler), + m_handler(std::move(handler)), m_type(static_cast<Evas_Callback_Type>(event)) { - evas_object_event_callback_add(m_widget.getEo(), + evas_object_event_callback_add(as_eo(m_widget), m_type, event_cb, this); } EventProxy(Widget &widget, const SmartEvent event, - const WidgetEventHandler handler) : + WidgetEventHandler handler) : m_widget(widget), m_smartEvent(event), - m_handler(handler), + m_handler(std::move(handler)), m_type(impl::WIDGET_EVENT_SMART) { - evas_object_smart_callback_add(m_widget.getEo(), + evas_object_smart_callback_add(as_eo(m_widget), m_smartEvent.c_str(), smart_cb, this); } ~EventProxy() { if (m_type == impl::WIDGET_EVENT_SMART) { - evas_object_smart_callback_del_full(m_widget.getEo(), + evas_object_smart_callback_del_full(as_eo(m_widget), m_smartEvent.c_str(), smart_cb, this); } else { - evas_object_event_callback_del_full(m_widget.getEo(), + evas_object_event_callback_del_full(as_eo(m_widget), m_type, event_cb, this); } } @@ -66,13 +66,15 @@ namespace ucl { m_selfIt = it; } - bool operator==(const std::pair<WidgetEvent, WidgetEventHandler> &rhs) + bool operator==( + const std::pair<WidgetEvent, WidgetEventHandler::CDRef> &rhs) { return ((m_type == static_cast<Evas_Callback_Type>(rhs.first)) && (m_handler == rhs.second)); } - bool operator==(const std::pair<SmartEvent, WidgetEventHandler> &rhs) + bool operator==( + const std::pair<SmartEvent, WidgetEventHandler::CDRef> &rhs) { return ((m_type == impl::WIDGET_EVENT_SMART) && (m_handler == rhs.second) && @@ -93,8 +95,8 @@ namespace ucl { void dispatchEvent(void *const event_info) { - if (m_handler) { - m_handler(m_widget, event_info); + if (const auto handler = m_handler.lock()) { + handler(m_widget, event_info); } else { m_widget.delEventProxy(m_selfIt); } @@ -250,14 +252,14 @@ namespace ucl { } void Widget::addEventHandler(const WidgetEvent event, - const WidgetEventHandler handler) + WidgetEventHandler handler) { - m_eventProxies.emplace_front(*this, event, handler); + m_eventProxies.emplace_front(*this, event, std::move(handler)); m_eventProxies.front().setSelfIt(m_eventProxies.begin()); } void Widget::addEventHandler(const SmartEvent event, - const WidgetEventHandler handler) + WidgetEventHandler handler) { if (strncmp(event.name, UCL_SMART_FWD, strlen(UCL_SMART_FWD)) == 0) { if (!ensureFwdEvent(event)) { @@ -265,19 +267,19 @@ namespace ucl { "Event is not supported: %s;", event.name); } } - m_eventProxies.emplace_front(*this, event, handler); + m_eventProxies.emplace_front(*this, event, std::move(handler)); m_eventProxies.front().setSelfIt(m_eventProxies.begin()); } void Widget::delEventHandler(const WidgetEvent event, - const WidgetEventHandler handler) + WidgetEventHandler::CDRef handler) { delEventProxy(std::find(m_eventProxies.begin(), m_eventProxies.end(), std::make_pair(event, handler))); } void Widget::delEventHandler(const SmartEvent event, - const WidgetEventHandler handler) + WidgetEventHandler::CDRef handler) { delEventProxy(std::find(m_eventProxies.begin(), m_eventProxies.end(), std::make_pair(event, handler))); diff --git a/ucl/src/gui/WidgetItem.cpp b/ucl/source/gui/WidgetItem.cpp index 04d1fca..04d1fca 100644 --- a/ucl/src/gui/WidgetItem.cpp +++ b/ucl/source/gui/WidgetItem.cpp diff --git a/ucl/src/gui/Window.cpp b/ucl/source/gui/Window.cpp index 3f74e9e..78addf3 100644 --- a/ucl/src/gui/Window.cpp +++ b/ucl/source/gui/Window.cpp @@ -45,21 +45,22 @@ namespace ucl { } } - StyledWidget bg(elm_bg_add(winEo)); + StyledWidget bg(elm_bg_add(winEo), false); expand(bg); show(bg); - StyledWidget conform(elm_conformant_add(winEo)); + StyledWidget conform(elm_conformant_add(winEo), false); expand(conform); show(conform); - elm_win_resize_object_add(winEo, bg); - elm_win_resize_object_add(winEo, conform); + elm_win_resize_object_add(winEo, as_eo(bg)); + elm_win_resize_object_add(winEo, as_eo(conform)); elm_win_indicator_opacity_set(winEo, ELM_WIN_INDICATOR_OPAQUE); elm_win_conformant_set(winEo, EINA_TRUE); - auto result = makeShared<Window>(winEo, isOwner, conform); + auto result = makeShared<Window>(winEo, isOwner, + as_eo(conform), PRIVATE); if (m_needBindToEo) { result->bindToEo(); @@ -75,4 +76,17 @@ namespace ucl { return result; } + + // Window // + + void Window::resizeToScreen() + { + int w = 0; + int h = 0; + getScreenSize(&w, &h); + if ((w > 0) && (h > 0)) { + setGeometry(0, 0, w, h); + m_conform.setGeometry(0, 0, w, h); + } + } } diff --git a/ucl/src/gui/common.h b/ucl/source/gui/common.h index 6b543d3..b8a0028 100644 --- a/ucl/src/gui/common.h +++ b/ucl/source/gui/common.h @@ -14,9 +14,9 @@ * limitations under the License. */ -#ifndef __UCL_GUI_COMMON_H__ -#define __UCL_GUI_COMMON_H__ +#ifndef __UCL_SOURCE_GUI_COMMON_H__ +#define __UCL_SOURCE_GUI_COMMON_H__ -#include "../common.h" +#include "ucl/source/common.h" -#endif // __UCL_GUI_COMMON_H__ +#endif // __UCL_SOURCE_GUI_COMMON_H__ diff --git a/ucl/src/misc/Timeout.cpp b/ucl/source/misc/Timeout.cpp index 41a3d3f..9fb98ac 100644 --- a/ucl/src/misc/Timeout.cpp +++ b/ucl/source/misc/Timeout.cpp @@ -20,10 +20,9 @@ namespace ucl { - TimeoutSRef Timeout::create(double timeoutSec, - const TimeoutHandler &handler) + TimeoutSRef Timeout::create(double timeoutSec, TimeoutHandler handler) { - auto result = makeShared<Timeout>(handler); + auto result = makeShared<Timeout>(std::move(handler), PRIVATE); FAIL_RETURN_VALUE(result->prepare(timeoutSec), {}, "result->prepare() failed!"); @@ -31,9 +30,9 @@ namespace ucl { return result; } - Timeout::Timeout(const TimeoutHandler &handler) : - m_timer(nullptr), - m_handler(handler) + Timeout::Timeout(TimeoutHandler handler, Private) : + m_handler(std::move(handler)), + m_timer(nullptr) { } @@ -51,8 +50,8 @@ namespace ucl { { const auto self = static_cast<Timeout *>(data); self->m_timer = nullptr; - if (self->m_handler) { - self->m_handler(self); + if (const auto handler = self->m_handler.lock()) { + handler(self); } return ECORE_CALLBACK_CANCEL; }, diff --git a/ucl/src/misc/Variant.cpp b/ucl/source/misc/Variant.cpp index f723f34..8be8708 100644 --- a/ucl/src/misc/Variant.cpp +++ b/ucl/source/misc/Variant.cpp @@ -26,7 +26,7 @@ namespace ucl { m_type(aString ? TYPE_STRING : TYPE_NIL) { if (aString) { - const int realLength = ((length < 0) ? strlen(aString) : length); + const size_t realLength = ((length < 0) ? strlen(aString) : length); if (realLength < sizeof(m_aSmallStr.buffer)) { strncpy(m_aSmallStr.buffer, aString, realLength); m_aSmallStr.buffer[realLength] = '\0'; diff --git a/ucl/src/appfw/common.h b/ucl/source/misc/common.h index b612dfb..fd9d17e 100644 --- a/ucl/src/appfw/common.h +++ b/ucl/source/misc/common.h @@ -14,9 +14,9 @@ * limitations under the License. */ -#ifndef __UCL_APPFW_COMMON_H__ -#define __UCL_APPFW_COMMON_H__ +#ifndef __UCL_SOURCE_MISC_COMMON_H__ +#define __UCL_SOURCE_MISC_COMMON_H__ -#include "../common.h" +#include "ucl/source/common.h" -#endif // __UCL_APPFW_COMMON_H__ +#endif // __UCL_SOURCE_MISC_COMMON_H__ diff --git a/ucl/src/mvp/GuiPresenter.cpp b/ucl/source/mvp/GuiPresenter.cpp index e23bc02..20fba5c 100644 --- a/ucl/src/mvp/GuiPresenter.cpp +++ b/ucl/source/mvp/GuiPresenter.cpp @@ -41,21 +41,21 @@ namespace ucl { if (const auto parentSink = m_parentSink.lock()) { delDeactivatorSource(*parentSink); } - } else if (m_window) { - delDeactivatorSource(*m_window); + } else if (const auto window = getWindowRef()) { + delDeactivatorSource(*window); } } } Result GuiPresenter::prepare(ElmWidget &widget, const int flags) { - m_window = asShared(widget.getWindow()); - if (!m_window) { - LOG_RETURN(RES_FAIL, "m_window is NULL!"); + const auto window = asShared(widget.getWindow()); + if (!window) { + LOG_RETURN(RES_FAIL, "window is NULL!"); } if (flags & PF_ADD_DEACTIVATOR_SOURCES) { - addDeactivatorSource(*m_window); + addDeactivatorSource(*window); m_hasBuildInSources = true; } @@ -63,6 +63,7 @@ namespace ucl { addDeactivatorException(getObjPtr()); } + m_window = window; m_isPrepared = true; return RES_OK; @@ -70,8 +71,12 @@ namespace ucl { Result GuiPresenter::prepare(GuiPresenter &parent, const int flags) { - if (flags & PF_ADD_DEACTIVATOR_SOURCES) { + const auto window = parent.getWindowRef(); + if (!window) { + LOG_RETURN(RES_FAIL, "window is NULL!"); + } + if (flags & PF_ADD_DEACTIVATOR_SOURCES) { if (!parent.m_sink) { LOG_RETURN(RES_FAIL, "parent.m_sink is NULL!"); } @@ -92,7 +97,7 @@ namespace ucl { addDeactivatorException(getObjPtr()); } - m_window = parent.m_window; + m_window = window; m_isChild = true; m_isPrepared = true; @@ -101,13 +106,16 @@ namespace ucl { Window &GuiPresenter::getWindow() { - UCL_ASSERT(isWindowReady(), "m_window is NULL!"); - return *m_window; + const auto window = getWindowRef(); + UCL_ASSERT(window, "window is NULL!"); + // Since GUI is single threaded Window instance will not be deleted + // on "window" shared reference destroy + return *window; } - bool GuiPresenter::isWindowReady() const + WindowSRef GuiPresenter::getWindowRef() { - return !!m_window; + return m_window.lock(); } void GuiPresenter::addDeactivatorException(const void *const deactivator) @@ -123,6 +131,22 @@ namespace ucl { m_sink = sink; } + const void *GuiPresenter::getSelfDeactivator() const + { + // Just return some unknown pointer that will never be aliaced + return &m_isPrepared; + } + + void GuiPresenter::activateSelf() + { + activateByImpl({getSelfDeactivator(), false}); + } + + void GuiPresenter::deactivateSelf() + { + deactivateByImpl({getSelfDeactivator(), false}); + } + void GuiPresenter::sendActivate(Widget &sender) { sendDeactivator(sender, impl::ACTIVATE_BY, getObjPtr()); @@ -152,7 +176,9 @@ namespace ucl { void GuiPresenter::broadcastDeactivator(const SmartEvent event, const void *const deactivator) { - sendDeactivatorInfo(*m_window, event, {deactivator, true}); + if (const auto window = getWindowRef()) { + sendDeactivatorInfo(*window, event, {deactivator, true}); + } } void GuiPresenter::sendDeactivatorInfo(Widget &sender, @@ -183,18 +209,18 @@ namespace ucl { void GuiPresenter::addDeactivatorSource(Widget &source) { - source.addEventHandler(impl::ACTIVATE_BY, WEAK_DELEGATE( - GuiPresenter::onActivateBySmart, asWeak(*this))); - source.addEventHandler(impl::DEACTIVATE_BY, WEAK_DELEGATE( - GuiPresenter::onDeactivateBySmart, asWeak(*this))); + source.addEventHandler( + impl::ACTIVATE_BY, WEAK_DELEGATE_THIS(onActivateBySmart)); + source.addEventHandler( + impl::DEACTIVATE_BY, WEAK_DELEGATE_THIS(onDeactivateBySmart)); } void GuiPresenter::delDeactivatorSource(Widget &source) { - source.delEventHandler(impl::ACTIVATE_BY, WEAK_DELEGATE( - GuiPresenter::onActivateBySmart, asWeak(*this))); - source.delEventHandler(impl::DEACTIVATE_BY, WEAK_DELEGATE( - GuiPresenter::onDeactivateBySmart, asWeak(*this))); + source.delEventHandler( + impl::ACTIVATE_BY, DELEGATE_THIS(onActivateBySmart)); + source.delEventHandler( + impl::DEACTIVATE_BY, DELEGATE_THIS(onDeactivateBySmart)); } void GuiPresenter::activateByImpl(const DeactivatorInfo &info) diff --git a/ucl/source/mvp/ListItemPresenter.cpp b/ucl/source/mvp/ListItemPresenter.cpp new file mode 100644 index 0000000..bb8d719 --- /dev/null +++ b/ucl/source/mvp/ListItemPresenter.cpp @@ -0,0 +1,520 @@ +/* + * 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/mvp/ListItemPresenter.h" + +#include "ucl/gui/StyledWidget.h" +#include "ucl/gui/helpers.h" + +#include "common.h" + +namespace ucl { namespace { namespace impl { + + constexpr SmartEvent CHECK_CHANGED {"changed"}; +}}} + +namespace ucl { + + // ListItemPresenter::ItemClass // + + ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClass:: + newInstance(const ElmStyle itemStyle) + { + auto result = makeShared<ItemClass>(itemStyle, PRIVATE); + if (!result->get()) { + LOG_RETURN_VALUE(RES_FAIL, {}, "Failed to create ItemClass()!"); + } + return result; + } + + ListItemPresenter::ItemClass::ItemClass(const ElmStyle itemStyle, Private) : + m_itc(elm_genlist_item_class_new()) + { + if (!m_itc) { + return; + } + + m_itc->item_style = itemStyle.name; + + m_itc->func.text_get = + [](void *data, Evas_Object *obj, const char *part) -> char * + { + if (!data) { + LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL"); + } + return static_cast<ListItemPresenter *>(data)-> + getItemPartText(EdjePart(part)).release(); + }; + + m_itc->func.content_get = + [](void *data, Evas_Object *obj, const char *part) -> Evas_Object * + { + if (!data) { + LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL"); + } + auto &&item = *static_cast<ListItemPresenter *>(data); + if (const auto widget = item.getItemPartContent( + EdjePart(part), *item.m_parent)) { + widget->setIsOwner(false); + return as_eo(*widget); + } + return nullptr; + }; + + m_itc->func.state_get = + [](void *data, Evas_Object *obj, const char *part) -> Eina_Bool + { + if (!data) { + LOG_RETURN_VALUE(RES_FATAL, false, "data is NULL"); + } + return static_cast<ListItemPresenter *>(data)-> + getItemPartState(EdjePart(part)); + }; + } + + ListItemPresenter::ItemClass::~ItemClass() + { + if (m_itc) { + elm_genlist_item_class_free(m_itc); + } + } + + Elm_Genlist_Item_Class *ListItemPresenter::ItemClass::get() + { + return m_itc; + } + + // ListItemPresenter::ItemClassCache // + + ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClassCache:: + getItemClass(const ElmStyle itemStyle) + { + ItemClassSRef result; + + if (!m_itcMap.get(itemStyle, result)) { + result = ItemClass::newInstance(itemStyle); + if (result) { + m_itcMap.set(itemStyle, result); + } else { + ELOG("ItemClass::newInstance() failed!"); + } + } + + return result; + } + + void ListItemPresenter::ItemClassCache::purge() + { + m_itcMap.clear(); + } + + // ListItemPresenter::ItemPickModeParams // + + bool ListItemPresenter::ItemPickModeParams::isValid() const + { + using ucl::isValid; + return (isValid(checkPart) && isValid(checkStyle)); + } + + // ListItemPresenter // + + ListItemPresenter::ListItemPresenter(IRefCountObj &rc) : + RefCountAware(&rc), + m_flags(PF_AUTO_UNSELECT), + m_isItemPicked(false), + m_isListeningToItemAtspiGesture(false) + { + } + + ListItemPresenter::~ListItemPresenter() + { + if (m_item) { + FLOG("m_item is still alive!"); + deleteDetachedItem(true); + } + } + + void ListItemPresenter::attachItem(GenlistItem item, ElmWidgetSRef parent, + ItemClassCacheSRef itcCache, SharedRef<bool> isActiveRef) + { + if (m_item) { + deleteDetachedItem(); + } + + m_item = item; + m_item.setData(this); + m_item.setDelCallback(CALLBACK_A(ListItemPresenter::onItemDel)); + + if (m_itemAtspiGestureHandler) { + tryListenToItemAtspiGesture(); + } + + m_parent = std::move(parent); + m_itcCache = std::move(itcCache); + m_isActiveRef = std::move(isActiveRef); + + if (!m_selfRef) { + m_selfRef = asShared(*this); + } + + onItemAttached(); + } + + void ListItemPresenter::deleteDetachedItem(const bool silent) + { + auto item = m_item; + detachItem(silent); + item.del(); + } + + void ListItemPresenter::detachItem(const bool silent) + { + m_itemAtspi.reset(); + m_isListeningToItemAtspiGesture = false; + + m_item.setData(nullptr); + m_item.setDelCallback(nullptr); + m_item = nullptr; + + m_parent.reset(); + m_itcCache.reset(); + m_isActiveRef.reset(); + + if (!silent) { + onItemDetached(); + } + } + + void ListItemPresenter::tryEnsureItemAtspi() + { + if (!m_itemAtspi && m_item) { + m_itemAtspi = makeShared<Atspi>(m_item); + } + } + + void ListItemPresenter::tryListenToItemAtspiGesture() + { + if (!m_isListeningToItemAtspiGesture) { + if (const auto atspi = getItemAtspi()) { + m_isListeningToItemAtspiGesture = true; + atspi->addGestureHandler( + WEAK_DELEGATE_THIS(onItemAtspiGesture)); + } + } + } + + void ListItemPresenter::onItemDel(Evas_Object *obj, void *eventInfo) + { + if (m_item) { + detachItem(); + } + m_selfRef.reset(); + } + + void ListItemPresenter::onItemAtspiGesture(Atspi &atspi, + AtspiGestureEventInfo &eventInfo) + { + if (const auto handler = m_itemAtspiGestureHandler.lock()) { + handler(atspi, eventInfo); + } + } + + void ListItemPresenter::setFlags(const int flags) + { + m_flags = flags; + } + + int ListItemPresenter::getFlags() const + { + return m_flags; + } + + bool ListItemPresenter::isActive() const + { + return (m_isActiveRef ? *m_isActiveRef : false); + } + + bool ListItemPresenter::isPickModeActive() const + { + if (const auto host = m_pickerHost.lock()) { + return host->isPickModeActive(); + } + return false; + } + + void ListItemPresenter::handleItemPick(const bool isPicked) + { + if (const auto host = m_pickerHost.lock()) { + if (!host->isPickModeActive()) { + WLOG("Pick mode is not active!"); + return; + } + + if (isPicked != m_isItemPicked) { + m_isItemPicked = isPicked; + if (isPicked) { + host->incrementPickCounter(); + } else { + host->decrementPickCounter(); + } + } + + } else { + WLOG("m_pickerHost is NULL"); + } + } + + void ListItemPresenter::setPickerHost(IPickerHostWRef host) + { + m_pickerHost = std::move(host); + } + + void ListItemPresenter::setPicked(const bool isPicked) + { + m_isItemPicked = isPicked; + } + + void ListItemPresenter::updatePicked(const bool isPicked) + { + if (isPicked != m_isItemPicked) { + m_isItemPicked = isPicked; + updateItem(); + } + } + + bool ListItemPresenter::isPicked() const + { + return m_isItemPicked; + } + + WidgetSRef ListItemPresenter::tryCreatePickModeItemPartContent( + EdjePart part, ElmWidget &parent, + const ItemPickModeParams ¶ms) + { + if (isNotValid(params)) { + LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "params is not Valid!"); + } + if (!isPickModeActive()) { + return nullptr; + } + if (part != params.checkPart) { + return nullptr; + } + + auto check = makeShared<StyledWidget>(elm_check_add(as_eo(parent))); + check->setStyle(params.checkStyle); + + elm_check_state_set(as_eo(*check), toEina(m_isItemPicked)); + evas_object_repeat_events_set(as_eo(*check), EINA_FALSE); + evas_object_propagate_events_set(as_eo(*check), EINA_FALSE); + + check->addEventHandler( + impl::CHECK_CHANGED, WEAK_DELEGATE_THIS(onPickCheckChanged)); + + if (params.enableAtspi) { + auto itemAtspi = getItemAtspi(); + if (itemAtspi) { + auto &checkAtspi = check->getAtspi(); + + checkAtspi.addRelationship(ELM_ATSPI_RELATION_CONTROLLED_BY, + as_ao(*itemAtspi)); + itemAtspi->addRelationship(ELM_ATSPI_RELATION_CONTROLLER_FOR, + as_ao(checkAtspi)); + itemAtspi->addRelationship(ELM_ATSPI_RELATION_DESCRIBED_BY, + as_ao(checkAtspi)); + } + } + + return check; + } + + void ListItemPresenter::onPickCheckChanged(Widget &widget, void *eventInfo) + { + if (!isActive()) { + elm_check_state_set(as_eo(widget), toEina(m_isItemPicked)); + return; + } + + handleItemPick(elm_check_state_get(as_eo(widget))); + + if (m_item) { + elm_genlist_item_bring_in(m_item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); + } else { + WLOG("m_item is NULL"); + } + } + + GenlistItem ListItemPresenter::getItem() + { + return m_item; + } + + Atspi *ListItemPresenter::getItemAtspi() + { + tryEnsureItemAtspi(); + return m_itemAtspi.get(); + } + + const Atspi *ListItemPresenter::getItemAtspi() const + { + // Need cast for lazy initialization. Can't use mutable. + const_cast<ListItemPresenter *>(this)->tryEnsureItemAtspi(); + return m_itemAtspi.get(); + } + + ListItemPresenter::ItemClassCache *ListItemPresenter::getItemClassCache() + { + return m_itcCache.get(); + } + + Result ListItemPresenter::updateItem() + { + if (!m_item) { + LOG_RETURN(RES_INVALID_OPERATION, "m_item is NULL!"); + } + + m_item.update(); + + return RES_OK; + } + + Result ListItemPresenter::bringInItem(Elm_Genlist_Item_Scrollto_Type type) + { + if (!m_item) { + LOG_RETURN(RES_INVALID_OPERATION, "m_item is NULL!"); + } + + elm_genlist_item_bring_in(m_item, type); + + return RES_OK; + } + + Result ListItemPresenter::showItem(Elm_Genlist_Item_Scrollto_Type type) + { + if (!m_item) { + LOG_RETURN(RES_INVALID_OPERATION, "m_item is NULL!"); + } + + elm_genlist_item_show(m_item, type); + + return RES_OK; + } + + void ListItemPresenter::setItemAtspiGestureHandler( + AtspiGestureHandler handler) + { + if (handler) { + tryListenToItemAtspiGesture(); + } + m_itemAtspiGestureHandler = std::move(handler); + } + + Result ListItemPresenter::updateItemStyle(const ElmStyle newItemStyle) + { + if (!m_item) { + LOG_RETURN(RES_INVALID_OPERATION, "m_item is NULL!"); + } + if (!m_itcCache) { + LOG_RETURN(RES_FATAL, "m_itcCache is NULL!"); + } + + const auto itc = m_itcCache->getItemClass(newItemStyle); + if (!itc) { + LOG_RETURN(RES_FAIL, "m_itcCache->getItemClass() failed!"); + } + + m_item.update(itc->get()); + + return RES_OK; + } + + void ListItemPresenter::dispose() + { + if (m_item) { + deleteDetachedItem(); + m_selfRef.reset(); + } + } + + bool ListItemPresenter::isDisposed() const + { + return !m_item; + } + + void ListItemPresenter::onItemAttached() + { + } + + void ListItemPresenter::onItemDetached() + { + } + + WidgetSRef ListItemPresenter::getItemPartContent(const EdjePart part, + ElmWidget &parent) + { + return nullptr; + } + + CString ListItemPresenter::getItemPartText(const EdjePart part) + { + return nullptr; + } + + bool ListItemPresenter::getItemPartState(const EdjePart part) + { + return false; + } + + void ListItemPresenter::onItemSelectedHook() + { + if (m_flags & PF_AUTO_UNSELECT) { + m_item.setSelected(false); + } + onItemSelected(); + } + + void ListItemPresenter::onItemSelected() + { + } + + void ListItemPresenter::onItemRealized() + { + } + + void ListItemPresenter::onItemUnrealized() + { + } + + void ListItemPresenter::onItemHighlighted() + { + } + + void ListItemPresenter::onItemUnhighlighted() + { + } + + void ListItemPresenter::onItemLongpressed() + { + } + + // Non-member functions // + + const Elm_Interface_Atspi_Accessible *as_ao( + const ListItemPresenter &item) + { + return as_ao(item.getItemAtspi()); + } +} diff --git a/ucl/src/mvp/ListPresenter.cpp b/ucl/source/mvp/ListPresenter.cpp index 220b10e..242928e 100644 --- a/ucl/src/mvp/ListPresenter.cpp +++ b/ucl/source/mvp/ListPresenter.cpp @@ -26,6 +26,7 @@ namespace ucl { namespace { namespace impl { constexpr SmartEvent ITEM_UNREALIZED {"unrealized"}; constexpr SmartEvent ITEM_HIGHLIGHTED {"highlighted"}; constexpr SmartEvent ITEM_UNHIGHLIGHTED {"unhighlighted"}; + constexpr SmartEvent ITEM_LONGPRESSED {"longpressed"}; ListItemPresenter *toItemPresenter(void *eventInfo) { @@ -79,7 +80,7 @@ namespace ucl { "m_parentWidget is NULL!"); } - auto result = makeShared<ListPresenter>(); + auto result = makeShared<ListPresenter>(PRIVATE); FAIL_RETURN_VALUE(result->prepare( parent, *m_parentWidget, m_style, m_flags), @@ -90,13 +91,16 @@ namespace ucl { // ListPresenter // - ListPresenter::ListPresenter(IRefCountObj &rc) : + ListPresenter::ListPresenter(IRefCountObj &rc, Private) : GuiPresenter(rc) { } ListPresenter::~ListPresenter() { + if (m_genlist) { + m_genlist->clear(); + } } Result ListPresenter::prepare( @@ -110,7 +114,6 @@ namespace ucl { setStyle(style). setMode(Genlist::Mode::COMPRESS). setHomogeneous(flags & FLAG_HOMOGENEOUS). - setIsOwner(true). setNeedBindToEo(true). build(parentWidget); if (!m_genlist) { @@ -120,7 +123,7 @@ namespace ucl { expandAndFill(*m_genlist); // TODO Add Scroller widget. - elm_scroller_content_min_limit(*m_genlist, + elm_scroller_content_min_limit(as_eo(*m_genlist), toEina((flags & FLAG_CALC_X_MIN) != 0), toEina((flags & FLAG_CALC_Y_MIN) != 0)); @@ -129,27 +132,36 @@ namespace ucl { m_isActiveRef = makeShared<bool>(); *m_isActiveRef = isActive(); - m_genlist->addEventHandler(impl::ITEM_SELECTED, WEAK_DELEGATE( - ListPresenter::onItemSelected, asWeak(*this))); + registerItemEvents(flags); + + return RES_OK; + } + + void ListPresenter::registerItemEvents(int flags) + { + m_genlist->addEventHandler(impl::ITEM_SELECTED, + WEAK_DELEGATE_THIS(onItemSelected)); if (flags & FLAG_NOTIFY_REALIZED) { - m_genlist->addEventHandler(impl::ITEM_REALIZED, WEAK_DELEGATE( - ListPresenter::onItemRealized, asWeak(*this))); + m_genlist->addEventHandler(impl::ITEM_REALIZED, + WEAK_DELEGATE_THIS(onItemRealized)); } if (flags & FLAG_NOTIFY_UNREALIZED) { - m_genlist->addEventHandler(impl::ITEM_UNREALIZED, WEAK_DELEGATE( - ListPresenter::onItemUnrealized, asWeak(*this))); + m_genlist->addEventHandler(impl::ITEM_UNREALIZED, + WEAK_DELEGATE_THIS(onItemUnrealized)); } if (flags & FLAG_NOTIFY_HIGHLIGHTED) { - m_genlist->addEventHandler(impl::ITEM_HIGHLIGHTED, WEAK_DELEGATE( - ListPresenter::onItemHighlighted, asWeak(*this))); + m_genlist->addEventHandler(impl::ITEM_HIGHLIGHTED, + WEAK_DELEGATE_THIS(onItemHighlighted)); } if (flags & FLAG_NOTIFY_UNHIGHLIGHTED) { - m_genlist->addEventHandler(impl::ITEM_UNHIGHLIGHTED, WEAK_DELEGATE( - ListPresenter::onItemUnhighlighted, asWeak(*this))); + m_genlist->addEventHandler(impl::ITEM_UNHIGHLIGHTED, + WEAK_DELEGATE_THIS(onItemUnhighlighted)); + } + if (flags & FLAG_NOTIFY_LONGPRESSED) { + m_genlist->addEventHandler(impl::ITEM_LONGPRESSED, + WEAK_DELEGATE_THIS(onItemLongpressed)); } - - return RES_OK; } Genlist &ListPresenter::getWidget() @@ -236,7 +248,7 @@ namespace ucl { LOG_RETURN(RES_FAIL, "insertFunc() failed!"); } - itemPresenter.attachItem(item, m_itcCache, m_isActiveRef); + itemPresenter.attachItem(item, m_genlist, m_itcCache, m_isActiveRef); return RES_OK; } @@ -250,7 +262,7 @@ namespace ucl { if (!relItem) { LOG_RETURN(RES_FAIL, "relItem is NULL!"); } - if (relItem.getWidget() != m_genlist->getEo()) { + if (relItem.getWidget() != as_eo(*m_genlist)) { LOG_RETURN(RES_FAIL, "relItem has wrong genlist!"); } return insert(itemPresenter, parent, @@ -314,6 +326,15 @@ namespace ucl { itemPresenter->onItemUnhighlighted(); } + void ListPresenter::onItemLongpressed(Widget &widget, void *eventInfo) + { + const auto itemPresenter = impl::toItemPresenter(eventInfo); + if (!itemPresenter) { + LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL"); + } + itemPresenter->onItemLongpressed(); + } + void ListPresenter::onActivate() { setIsActiveRef(true); diff --git a/ucl/src/misc/common.h b/ucl/source/mvp/common.h index 372ad4d..11a4d84 100644 --- a/ucl/src/misc/common.h +++ b/ucl/source/mvp/common.h @@ -14,9 +14,9 @@ * limitations under the License. */ -#ifndef __UCL_MISC_COMMON_H__ -#define __UCL_MISC_COMMON_H__ +#ifndef __UCL_SOURCE_MVP_COMMON_H__ +#define __UCL_SOURCE_MVP_COMMON_H__ -#include "../common.h" +#include "ucl/source/common.h" -#endif // __UCL_MISC_COMMON_H__ +#endif // __UCL_SOURCE_MVP_COMMON_H__ diff --git a/ucl/src/util/logging.cpp b/ucl/source/util/logging.cpp index 311f25b..311f25b 100644 --- a/ucl/src/util/logging.cpp +++ b/ucl/source/util/logging.cpp diff --git a/ucl/src/util/types/Result.cpp b/ucl/source/util/types/Result.cpp index b42875e..9ba6c17 100644 --- a/ucl/src/util/types/Result.cpp +++ b/ucl/source/util/types/Result.cpp @@ -26,7 +26,7 @@ namespace ucl { namespace { namespace impl { {"RES_NOT_SUPPORTED", DLOG_ERROR}, {"RES_IO_ERROR", DLOG_ERROR}, {"RES_OUT_OF_MEMORY", DLOG_ERROR}, - {"RES_ILLEGAL_STATE", DLOG_ERROR}, + {"RES_INVALID_OPERATION", DLOG_ERROR}, {"RES_INVALID_ARGUMENTS", DLOG_ERROR}, {"RES_FAIL", DLOG_ERROR}, {"RES_OK", DLOG_INFO}, diff --git a/ucl/src/mvp/common.h b/ucl/source/util/types/classTypes.cpp index 2894a14..d3eabaf 100644 --- a/ucl/src/mvp/common.h +++ b/ucl/source/util/types/classTypes.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ -#ifndef __UCL_MVP_COMMON_H__ -#define __UCL_MVP_COMMON_H__ +#include "ucl/util/types/classTypes.h" -#include "../common.h" +namespace ucl { -#endif // __UCL_MVP_COMMON_H__ + const NonCopyable::PrivateType NonCopyable::PRIVATE; +} diff --git a/ucl/src/gui/ElmWidget.cpp b/ucl/src/gui/ElmWidget.cpp deleted file mode 100644 index b7d227e..0000000 --- a/ucl/src/gui/ElmWidget.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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/gui/ElmWidget.h" - -#include "ucl/gui/Window.h" -#include "ucl/gui/helpers.h" - -namespace ucl { - - ElmWidget::ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner) : - Widget(rc, eo, isOwner), - m_isAtspiGestureCbSet(false) - { - } - - ElmWidget::~ElmWidget() - { - if (m_isAtspiGestureCbSet) { - elm_atspi_accessible_gesture_cb_set(getEo(), nullptr, nullptr); - } - } - - void ElmWidget::setFocusedImpl(const bool value) - { - elm_object_focus_set(getEo(), toEina(value)); - } - - bool ElmWidget::isFocusedImpl() const - { - return elm_object_focus_get(getEo()); - } - - bool ElmWidget::ensureFwdEvent(const SmartEvent fwdEvent) - { - if (Widget::ensureFwdEvent(fwdEvent)) { - return true; - } - if (fwdEvent == ATSPI_ON_GESTURE) { - if (!m_isAtspiGestureCbSet) { - m_isAtspiGestureCbSet = true; - elm_atspi_accessible_gesture_cb_set(getEo(), - CALLBACK_A(ElmWidget::onAtspiGesture), this); - } - return true; - } - return false; - } - - Eina_Bool ElmWidget::onAtspiGesture(Elm_Atspi_Gesture_Info gestureInfo, - Evas_Object *obj) - { - AtspiGestureEventInfo eventInfo{gestureInfo}; - callEvent(ATSPI_ON_GESTURE, &eventInfo); - return toEina(eventInfo.preventDefault); - } - - Window *ElmWidget::getWindow() const - { - return dynamicWidgetCast<Window>(getTopWidget()); - } -} diff --git a/ucl/src/mvp/ListItemPresenter.cpp b/ucl/src/mvp/ListItemPresenter.cpp deleted file mode 100644 index e2ad69a..0000000 --- a/ucl/src/mvp/ListItemPresenter.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* - * 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/mvp/ListItemPresenter.h" - -#include "common.h" - -namespace ucl { - - // ListItemPresenter::ItemClass // - - ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClass:: - newInstance(const ElmStyle itemStyle) - { - auto result = makeShared<ItemClass>(itemStyle); - if (!result->get()) { - LOG_RETURN_VALUE(RES_FAIL, {}, "Failed to create ItemClass()!"); - } - return result; - } - - ListItemPresenter::ItemClass::ItemClass(const ElmStyle itemStyle) : - m_itc(elm_genlist_item_class_new()) - { - if (!m_itc) { - return; - } - - m_itc->item_style = itemStyle.name; - - m_itc->func.text_get = - [](void *data, Evas_Object *obj, const char *part) -> char * - { - if (!data) { - LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL"); - } - return static_cast<ListItemPresenter *>(data)-> - getItemPartText(EdjePart(part)).release(); - }; - - m_itc->func.content_get = - [](void *data, Evas_Object *obj, const char *part) -> Evas_Object * - { - if (!data) { - LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL"); - } - if (const auto widget = static_cast<ListItemPresenter *>(data)-> - getItemPartContent(EdjePart(part))) { - widget->setIsOwner(false); - return widget->getEo(); - } - return nullptr; - }; - - m_itc->func.state_get = - [](void *data, Evas_Object *obj, const char *part) -> Eina_Bool - { - if (!data) { - LOG_RETURN_VALUE(RES_FATAL, false, "data is NULL"); - } - return static_cast<ListItemPresenter *>(data)-> - getItemPartState(EdjePart(part)); - }; - } - - ListItemPresenter::ItemClass::~ItemClass() - { - if (m_itc) { - elm_genlist_item_class_free(m_itc); - } - } - - Elm_Genlist_Item_Class *ListItemPresenter::ItemClass::get() - { - return m_itc; - } - - // ListItemPresenter::ItemClassCache // - - ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClassCache:: - getItemClass(const ElmStyle itemStyle) - { - ItemClassSRef result; - - if (!m_itcMap.get(itemStyle, result)) { - result = ItemClass::newInstance(itemStyle); - if (result) { - m_itcMap.set(itemStyle, result); - } else { - ELOG("ItemClass::newInstance() failed!"); - } - } - - return result; - } - - void ListItemPresenter::ItemClassCache::purge() - { - m_itcMap.clear(); - } - - // ListItemPresenter // - - ListItemPresenter::ListItemPresenter(IRefCountObj &rc) : - RefCountAware(&rc), - m_flags(PF_AUTO_UNSELECT) - { - } - - ListItemPresenter::~ListItemPresenter() - { - if (m_item) { - FLOG("m_item is still alive!"); - deleteDetachedItem(true); - } - } - - void ListItemPresenter::attachItem(GenlistItem item, - const ItemClassCacheSRef &itcCache, - const SharedRef<bool> &isActiveRef) - { - if (!item) { - LOG_RETURN_VOID(RES_FAIL, "item is NULL!"); - } - - if (m_item) { - deleteDetachedItem(); - } - - m_item = item; - m_item.setData(this); - m_item.setDelCallback(CALLBACK_A(ListItemPresenter::onItemDel)); - - m_itcCache = itcCache; - m_isActiveRef = isActiveRef; - - if (!m_selfRef) { - m_selfRef = asShared(*this); - } - - onItemAttached(); - } - - void ListItemPresenter::deleteDetachedItem(const bool silent) - { - auto item = m_item; - detachItem(silent); - item.del(); - } - - void ListItemPresenter::detachItem(const bool silent) - { - m_item.setData(nullptr); - m_item.setDelCallback(nullptr); - m_item = nullptr; - if (!silent) { - onItemDetached(); - } - } - - void ListItemPresenter::onItemDel(Evas_Object *obj, void *eventInfo) - { - if (m_item) { - detachItem(); - } - m_selfRef.reset(); - } - - void ListItemPresenter::setFlags(const int flags) - { - m_flags = flags; - } - - int ListItemPresenter::getFlags() const - { - return m_flags; - } - - bool ListItemPresenter::isActive() const - { - return (m_isActiveRef ? *m_isActiveRef : false); - } - - GenlistItem ListItemPresenter::getItem() - { - return m_item; - } - - ListItemPresenter::ItemClassCacheSRef - ListItemPresenter::getItemClassCache() - { - return m_itcCache.lock(); - } - - Result ListItemPresenter::updateItemStyle(const ElmStyle newItemStyle) - { - if (!m_item) { - LOG_RETURN(RES_ILLEGAL_STATE, "m_item is NULL!"); - } - - const auto itcCache = getItemClassCache(); - if (!itcCache) { - LOG_RETURN(RES_FATAL, "itcCache is NULL!"); - } - - const auto itc = itcCache->getItemClass(newItemStyle); - if (!itc) { - LOG_RETURN(RES_FAIL, "itcCache.getItemClass() failed!"); - } - - m_item.update(itc->get()); - - return RES_OK; - } - - void ListItemPresenter::dispose() - { - if (m_item) { - deleteDetachedItem(); - m_selfRef.reset(); - } - } - - bool ListItemPresenter::isDisposed() const - { - return !m_item; - } - - void ListItemPresenter::onItemAttached() - { - } - - void ListItemPresenter::onItemDetached() - { - } - - WidgetSRef ListItemPresenter::getItemPartContent(const EdjePart part) - { - return nullptr; - } - - CString ListItemPresenter::getItemPartText(const EdjePart part) - { - return nullptr; - } - - bool ListItemPresenter::getItemPartState(const EdjePart part) - { - return false; - } - - void ListItemPresenter::onItemSelectedHook() - { - if (m_flags & PF_AUTO_UNSELECT) { - m_item.setSelected(false); - } - onItemSelected(); - } - - void ListItemPresenter::onItemSelected() - { - } - - void ListItemPresenter::onItemRealized() - { - } - - void ListItemPresenter::onItemUnrealized() - { - } - - void ListItemPresenter::onItemHighlighted() - { - } - - void ListItemPresenter::onItemUnhighlighted() - { - } -} |