From cf37db548d7b1c8c4e5d0295eb46c38c57893bc0 Mon Sep 17 00:00:00 2001 From: Nick Holland Date: Tue, 15 Dec 2015 11:29:02 +0000 Subject: [PATCH] Moved ECore specific indicator-impl out of common Change-Id: If65c380e6a62b92e7e8f51cd2048c88323f96b8d --- adaptors/base/interfaces/indicator-interface.h | 160 +++++++++++++++++++++ adaptors/common/accessibility-adaptor-impl.h | 9 +- adaptors/common/file.list | 4 +- adaptors/common/window-impl.h | 21 ++- .../common/ecore-indicator-impl.cpp} | 4 +- .../common/ecore-indicator-impl.h} | 101 ++++--------- .../common/ecore-server-connection.cpp} | 2 +- .../common/ecore-server-connection.h} | 6 +- adaptors/ecore/common/file.list | 4 +- .../tizen/accessibility-adaptor-impl-tizen.cpp | 2 +- .../ubuntu/accessibility-adaptor-impl-ubuntu.cpp | 2 +- adaptors/ubuntu/accessibility-adaptor-impl.h | 6 +- adaptors/wayland/window-impl-wl.cpp | 4 +- adaptors/x11/window-impl-x.cpp | 4 +- 14 files changed, 222 insertions(+), 107 deletions(-) create mode 100644 adaptors/base/interfaces/indicator-interface.h rename adaptors/{common/indicator-impl.cpp => ecore/common/ecore-indicator-impl.cpp} (99%) rename adaptors/{common/indicator-impl.h => ecore/common/ecore-indicator-impl.h} (78%) rename adaptors/{common/server-connection.cpp => ecore/common/ecore-server-connection.cpp} (99%) rename adaptors/{common/server-connection.h => ecore/common/ecore-server-connection.h} (95%) diff --git a/adaptors/base/interfaces/indicator-interface.h b/adaptors/base/interfaces/indicator-interface.h new file mode 100644 index 0000000..4c06a97 --- /dev/null +++ b/adaptors/base/interfaces/indicator-interface.h @@ -0,0 +1,160 @@ +#ifndef __DALI_INTERNAL_BASE_INDICATOR_INTERFACE_H__ +#define __DALI_INTERNAL_BASE_INDICATOR_INTERFACE_H__ + +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + * + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ +namespace Internal +{ +namespace Adaptor +{ + +class Adaptor; + +/** + * @brief The Indicator interface. + * Can be used to draw an indicator graphic generated from the platform as an overlay on + * top of DALi scene contents. + */ +class IndicatorInterface +{ +public: + + /** + * @brief Type of indiciator + */ + enum Type + { + INDICATOR_TYPE_UNKNOWN, + INDICATOR_TYPE_1, + INDICATOR_TYPE_2 + }; + + +public: + + /** + * @brief observer for listening to indicator events + */ + class Observer + { + public: + /** + * @brief Notify the observer if the indicator type changes + * @param[in] type The new indicator type + */ + virtual void IndicatorTypeChanged( Type type ) = 0; + + /** + * @brief Notify the observer when the upload has completed. + * @param[in] indicator The indicator that has finished uploading. + */ + virtual void IndicatorClosed(IndicatorInterface* indicator) = 0; + + /** + * @brief Notify the observer when the indicator visible status is changed. + * @param[in] isShowing Whether the indicator is visible. + */ + virtual void IndicatorVisibilityChanged( bool isVisible ) = 0; + }; + + +public: + + /** + * @brief constructor + */ + IndicatorInterface() {} + + /** + * @brief Virtual Destructor + */ + virtual ~IndicatorInterface() {} + + /** + * @brief assign the adaptor to this object + * @param[in] adaptor + */ + virtual void SetAdaptor(Adaptor* adaptor) = 0; + + /** + * @brief Get the actor which contains the indicator image. Ensure that the handle is + * released when no longer needed. + * Changes from the indicator service will modify the image and resize the actor appropriately. + * @return The indicator actor. + */ + virtual Dali::Actor GetActor() = 0; + + /** + * Opens a new connection for the required orientation. + * @param[in] orientation The new orientation + */ + virtual void Open( Dali::Window::WindowOrientation orientation ) = 0; + + /** + * Close the current connection. Will respond with Observer::IndicatorClosed() + * when done. + * @note, IndicatorClosed() will be called synchronously if there's no update + * in progress, or asychronously if waiting for SignalUploaded ) + */ + virtual void Close() = 0; + + /** + * Set the opacity mode of the indicator background. + * @param[in] mode opacity mode + */ + virtual void SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ) = 0; + + /** + * Set whether the indicator is visible or not. + * @param[in] visibleMode visible mode for indicator bar. + * @param[in] forceUpdate true if want to change visible mode forcely + */ + virtual void SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate = false ) = 0; + + /** + * Check whether the indicator is connected to the indicator service. + * @return whether the indicator is connected or not. + */ + virtual bool IsConnected() = 0; + + /** + * Send message to the indicator service. + * @param[in] messageDomain Message Reference number + * @param[in] messageId Reference number of the message this message refers to + * @param[in] data The data to send as part of the message + * @param[in] size Length of the data, in bytes, to send + * @return whether the message is sent successfully or not + */ + virtual bool SendMessage( int messageDomain, int messageId, const void *data, int size ) = 0; + + +}; + +} // Adaptor +} // Internal +} // Dali + +#endif diff --git a/adaptors/common/accessibility-adaptor-impl.h b/adaptors/common/accessibility-adaptor-impl.h index c529a80..dd2e065 100644 --- a/adaptors/common/accessibility-adaptor-impl.h +++ b/adaptors/common/accessibility-adaptor-impl.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include namespace Dali @@ -97,9 +97,10 @@ public: void SetGestureHandler(AccessibilityGestureHandler& handler); /** - * Set the Indicator + * @brief Set the Indicator + * @param[in] Indiciator interface */ - void SetIndicator(Indicator* indicator); + void SetIndicator( IndicatorInterface* indicator ); /** * @copydoc Dali::AccessibilityAdaptor::HandleActionNextEvent() @@ -265,7 +266,7 @@ private: AccessibilityGestureDetectorPtr mAccessibilityGestureDetector; ///< The accessibility gesture detector - Indicator* mIndicator; ///< The indicator + IndicatorInterface* mIndicator; ///< The indicator bool mIndicatorFocused; ///< Whether the Indicator is focused public: diff --git a/adaptors/common/file.list b/adaptors/common/file.list index 96880e6..2a4fa38 100644 --- a/adaptors/common/file.list +++ b/adaptors/common/file.list @@ -11,7 +11,6 @@ adaptor_common_internal_src_files = \ $(adaptor_common_dir)/command-line-options.cpp \ $(adaptor_common_dir)/drag-and-drop-detector-impl.cpp \ $(adaptor_common_dir)/feedback-player-impl.cpp \ - $(adaptor_common_dir)/indicator-impl.cpp \ $(adaptor_common_dir)/indicator-buffer.cpp \ $(adaptor_common_dir)/kernel-trace.cpp \ $(adaptor_common_dir)/system-trace.cpp \ @@ -22,7 +21,6 @@ adaptor_common_internal_src_files = \ $(adaptor_common_dir)/orientation-impl.cpp \ $(adaptor_common_dir)/performance-logger-impl.cpp \ $(adaptor_common_dir)/physical-keyboard-impl.cpp \ - $(adaptor_common_dir)/server-connection.cpp \ $(adaptor_common_dir)/shared-file.cpp \ $(adaptor_common_dir)/singleton-service-impl.cpp \ $(adaptor_common_dir)/sound-player-impl.cpp \ @@ -56,7 +54,7 @@ adaptor_common_internal_ecore_src_files = \ $(adaptor_common_dir)/event-loop/ecore/ecore-file-descriptor-monitor.cpp \ $(adaptor_common_dir)/event-loop/ecore/ecore-timer-impl.cpp - adaptor_common_internal_uv_src_files = \ +adaptor_common_internal_uv_src_files = \ $(adaptor_common_dir)/event-loop/lib-uv/uv-callback-manager.cpp \ $(adaptor_common_dir)/event-loop/lib-uv/uv-file-descriptor-monitor.cpp \ $(adaptor_common_dir)/event-loop/lib-uv/uv-timer-impl.cpp diff --git a/adaptors/common/window-impl.h b/adaptors/common/window-impl.h index d1403b5..767cd98 100644 --- a/adaptors/common/window-impl.h +++ b/adaptors/common/window-impl.h @@ -24,8 +24,8 @@ // INTERNAL INCLUDES #include +#include #include -#include #include #include #include @@ -45,7 +45,6 @@ namespace Internal { namespace Adaptor { -class Indicator; class Orientation; class Window; @@ -55,7 +54,7 @@ typedef IntrusivePtr OrientationPtr; /** * Window provides a surface to render onto with orientation & indicator properties. */ -class Window : public Dali::BaseObject, public Indicator::Observer, public LifeCycleObserver +class Window : public Dali::BaseObject, public IndicatorInterface::Observer, public LifeCycleObserver { public: typedef Dali::Window::IndicatorSignalType IndicatorSignalType; @@ -202,20 +201,20 @@ private: */ void SetIndicatorProperties( bool isShown, Dali::Window::WindowOrientation lastOrientation ); -private: // Indicator::Observer interface +private: // IndicatorInterface::Observer interface /** - * @copydoc Dali::Internal::Adaptor::Indicator::Observer::IndicatorTypeChanged() + * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorTypeChanged() */ - virtual void IndicatorTypeChanged( Indicator::Type type ); + virtual void IndicatorTypeChanged( IndicatorInterface::Type type ); /** - * @copydoc Dali::Internal::Adaptor::Indicator::Observer::IndicatorClosed() + * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorClosed() */ - virtual void IndicatorClosed(Indicator* indicator); + virtual void IndicatorClosed( IndicatorInterface* indicator); /** - * @copydoc Dali::Internal::Adaptor::Indicator::Observer::IndicatorVisibilityChanged() + * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorVisibilityChanged() */ virtual void IndicatorVisibilityChanged( bool isVisible ); @@ -260,7 +259,7 @@ public: // Signals private: - typedef std::vector DiscardedIndicators; + typedef std::vector< IndicatorInterface * > DiscardedIndicators; RenderSurface* mSurface; Dali::Window::IndicatorVisibleMode mIndicatorVisible; ///< public state @@ -270,7 +269,7 @@ private: bool mIsTransparent:1; bool mWMRotationAppSet:1; bool mEcoreEventHander:1; - Indicator* mIndicator; + IndicatorInterface* mIndicator; Dali::Window::WindowOrientation mIndicatorOrientation; Dali::Window::WindowOrientation mNextIndicatorOrientation; Dali::Window::IndicatorBgOpacity mIndicatorOpacityMode; diff --git a/adaptors/common/indicator-impl.cpp b/adaptors/ecore/common/ecore-indicator-impl.cpp similarity index 99% rename from adaptors/common/indicator-impl.cpp rename to adaptors/ecore/common/ecore-indicator-impl.cpp index 23d4b81..e44f2ff 100644 --- a/adaptors/common/indicator-impl.cpp +++ b/adaptors/ecore/common/ecore-indicator-impl.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "indicator-impl.h" +#include "ecore-indicator-impl.h" // EXTERNAL INCLUDES #include @@ -332,7 +332,7 @@ bool Indicator::ScopedLock::IsLocked() return mLocked; } -Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, Observer* observer ) +Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) : mPixmap( 0 ), mGestureDetected( false ), mConnection( this ), diff --git a/adaptors/common/indicator-impl.h b/adaptors/ecore/common/ecore-indicator-impl.h similarity index 78% rename from adaptors/common/indicator-impl.h rename to adaptors/ecore/common/ecore-indicator-impl.h index e2c676e..5f2b9be 100644 --- a/adaptors/common/indicator-impl.h +++ b/adaptors/ecore/common/ecore-indicator-impl.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_INDICATOR_H__ -#define __DALI_INTERNAL_INDICATOR_H__ +#ifndef __DALI_INTERNAL_ECORE_INDICATOR_H__ +#define __DALI_INTERNAL_ECORE_INDICATOR_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -19,15 +19,16 @@ */ // EXTERNAL INCLUDES -#include #include +#include #include #include #include // INTERNAL INCLUDES +#include #include -#include +#include #include #include #include @@ -51,44 +52,16 @@ typedef unsigned int PixmapId; * The Indicator class connects to the indicator server, and gets and draws the indicator * for the given orientation. */ -class Indicator : public ConnectionTracker, public ServerConnection::Observer +class Indicator : public ConnectionTracker, public ServerConnection::Observer, public IndicatorInterface { public: + enum State { DISCONNECTED, CONNECTED }; - enum Type - { - INDICATOR_TYPE_UNKNOWN, - INDICATOR_TYPE_1, - INDICATOR_TYPE_2 - }; - -public: - class Observer - { - public: - /** - * Notify the observer if the indicator type changes - * @param[in] type The new indicator type - */ - virtual void IndicatorTypeChanged( Type type ) = 0; - - /** - * Notify the observer when the upload has completed. - * @param[in] indicator The indicator that has finished uploading. - */ - virtual void IndicatorClosed(Indicator* indicator) = 0; - - /** - * Notify the observer when the indicator visible status is changed. - * @param[in] isShowing Whether the indicator is visible. - */ - virtual void IndicatorVisibilityChanged( bool isVisible ) = 0; - }; protected: /** @@ -160,74 +133,56 @@ protected: }; -public: +public: // Dali::Internal::Adaptor::IndicicatorInterface /** - * Constructor. Creates a new indicator and opens a connection for - * the required orientation. - * @param[in] orientation The orientation in which to draw the indicator - * @param[in] observer The indicator closed + * @copydoc Dali::Internal::IndicatorInterface::IndicatorInterface */ Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, - Observer* observer ); + IndicatorInterface::Observer* observer ); /** - * Destructor + * @copydoc Dali::Internal::IndicatorInterface::~IndicatorInterface */ virtual ~Indicator(); - void SetAdaptor(Adaptor* adaptor); + + virtual void SetAdaptor(Adaptor* adaptor); /** - * Get the actor which contains the indicator image. Ensure that the handle is - * released when no longer needed. - * Changes from the indicator service will modify the image and resize the actor appropriately. - * @return The indicator actor. + * @copydoc Dali::Internal::IndicatorInterface::GetActor */ - Dali::Actor GetActor(); + virtual Dali::Actor GetActor(); /** - * Opens a new connection for the required orientation. - * @param[in] orientation The new orientation + * @copydoc Dali::Internal::IndicatorInterface::Open */ - void Open( Dali::Window::WindowOrientation orientation ); + virtual void Open( Dali::Window::WindowOrientation orientation ); /** - * Close the current connection. Will respond with Observer::IndicatorClosed() - * when done. - * @note, IndicatorClosed() will be called synchronously if there's no update - * in progress, or asychronously if waiting for SignalUploaded ) + * @copydoc Dali::Internal::IndicatorInterface::Close */ - void Close(); + virtual void Close(); /** - * Set the opacity mode of the indicator background. - * @param[in] mode opacity mode + * @copydoc Dali::Internal::IndicatorInterface::SetOpacityMode */ - void SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ); + virtual void SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ); /** - * Set whether the indicator is visible or not. - * @param[in] visibleMode visible mode for indicator bar. - * @param[in] forceUpdate true if want to change visible mode forcely + * @copydoc Dali::Internal::IndicatorInterface::SetVisible */ - void SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate = false ); + virtual void SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate = false ); /** - * Check whether the indicator is connected to the indicator service. - * @return whether the indicator is connected or not. + * @copydoc Dali::Internal::IndicatorInterface::IsConnected */ - bool IsConnected(); + virtual bool IsConnected(); /** - * Send message to the indicator service. - * @param[in] messageDomain Message Reference number - * @param[in] messageId Reference number of the message this message refers to - * @param[in] data The data to send as part of the message - * @param[in] size Length of the data, in bytes, to send - * @return whether the message is sent successfully or not + * @copydoc Dali::Internal::IndicatorInterface::SendMessage */ - bool SendMessage( int messageDomain, int messageId, const void *data, int size ); + virtual bool SendMessage( int messageDomain, int messageId, const void *data, int size ); private: /** @@ -448,7 +403,7 @@ private: Adaptor* mAdaptor; ServerConnection* mServerConnection; - Indicator::Observer* mObserver; ///< Upload observer + IndicatorInterface::Observer* mObserver; ///< Upload observer Dali::Window::WindowOrientation mOrientation; int mImageWidth; diff --git a/adaptors/common/server-connection.cpp b/adaptors/ecore/common/ecore-server-connection.cpp similarity index 99% rename from adaptors/common/server-connection.cpp rename to adaptors/ecore/common/ecore-server-connection.cpp index 598ba06..5f7a841 100644 --- a/adaptors/common/server-connection.cpp +++ b/adaptors/ecore/common/ecore-server-connection.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "server-connection.h" +#include "ecore-server-connection.h" // EXTERNAL INCLUDES #include diff --git a/adaptors/common/server-connection.h b/adaptors/ecore/common/ecore-server-connection.h similarity index 95% rename from adaptors/common/server-connection.h rename to adaptors/ecore/common/ecore-server-connection.h index 3838570..72941b9 100644 --- a/adaptors/common/server-connection.h +++ b/adaptors/ecore/common/ecore-server-connection.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_ADAPTOR_CONNECTION_H_ -#define __DALI_INTERNAL_ADAPTOR_CONNECTION_H_ +#ifndef __DALI_INTERNAL_ADAPTOR_ECORE_SERVER_CONNECTION_H_ +#define __DALI_INTERNAL_ADAPTOR_ECORE_SERVER_CONNECTION_H_ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -141,4 +141,4 @@ private: } // Internal } // Dali -#endif // __DALI_INTERNAL_ADAPTOR_CONNECTION_H_ +#endif // __DALI_INTERNAL_ADAPTOR_ECORE_SERVER_CONNECTION_H_ diff --git a/adaptors/ecore/common/file.list b/adaptors/ecore/common/file.list index d07a8d4..e02a4ac 100644 --- a/adaptors/ecore/common/file.list +++ b/adaptors/ecore/common/file.list @@ -1,4 +1,6 @@ # ECore Common adaptor_ecore_common_internal_src_files = \ - $(adaptor_ecore_common_dir)/ecore-virtual-keyboard.cpp + $(adaptor_ecore_common_dir)/ecore-virtual-keyboard.cpp \ + $(adaptor_ecore_common_dir)/ecore-indicator-impl.cpp \ + $(adaptor_ecore_common_dir)/ecore-server-connection.cpp diff --git a/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp b/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp index bcc2332..8b758d2 100644 --- a/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp +++ b/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp @@ -259,7 +259,7 @@ bool AccessibilityAdaptor::IsEnabled() const return mIsEnabled; } -void AccessibilityAdaptor::SetIndicator(Indicator* indicator) +void AccessibilityAdaptor::SetIndicator(IndicatorInterface* indicator) { mIndicator = indicator; } diff --git a/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp b/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp index e967819..d85e6a9 100644 --- a/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp +++ b/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp @@ -221,7 +221,7 @@ bool AccessibilityAdaptor::IsEnabled() const return mIsEnabled; } -void AccessibilityAdaptor::SetIndicator(Indicator* indicator) +void AccessibilityAdaptor::SetIndicator(IndicatorInterface* indicator) { mIndicator = indicator; } diff --git a/adaptors/ubuntu/accessibility-adaptor-impl.h b/adaptors/ubuntu/accessibility-adaptor-impl.h index 82f2e70..55d43e8 100644 --- a/adaptors/ubuntu/accessibility-adaptor-impl.h +++ b/adaptors/ubuntu/accessibility-adaptor-impl.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include namespace Dali @@ -99,7 +99,7 @@ public: /** * Set the Indicator */ - void SetIndicator(Indicator* indicator); + void SetIndicator(IndicatorInterface* indicator); /** * @copydoc Dali::AccessibilityAdaptor::HandleActionNextEvent() @@ -265,7 +265,7 @@ private: AccessibilityGestureDetectorPtr mAccessibilityGestureDetector; ///< The accessibility gesture detector - Indicator* mIndicator; ///< The indicator + IndicatorInterface* mIndicator; ///< The indicator bool mIndicatorFocused; ///< Whether the Indicator is focused public: diff --git a/adaptors/wayland/window-impl-wl.cpp b/adaptors/wayland/window-impl-wl.cpp index 4d59200..0202d5f 100644 --- a/adaptors/wayland/window-impl-wl.cpp +++ b/adaptors/wayland/window-impl-wl.cpp @@ -31,7 +31,7 @@ // INTERNAL HEADERS #include #include -#include +#include #include #include @@ -296,7 +296,7 @@ void Window::IndicatorTypeChanged(Indicator::Type type) { } -void Window::IndicatorClosed( Indicator* indicator ) +void Window::IndicatorClosed( IndicatorInterface* indicator ) { DALI_LOG_TRACE_METHOD( gWindowLogFilter ); diff --git a/adaptors/x11/window-impl-x.cpp b/adaptors/x11/window-impl-x.cpp index 23fae2d..c15f51b 100644 --- a/adaptors/x11/window-impl-x.cpp +++ b/adaptors/x11/window-impl-x.cpp @@ -30,7 +30,7 @@ // INTERNAL HEADERS #include #include -#include +#include #include #include #include @@ -508,7 +508,7 @@ void Window::IndicatorTypeChanged(Indicator::Type type) } } -void Window::IndicatorClosed( Indicator* indicator ) +void Window::IndicatorClosed( IndicatorInterface* indicator ) { DALI_LOG_TRACE_METHOD( gWindowLogFilter ); -- 2.7.4