From 392db9696ba419103e962a5d7d2c431a04a3ad08 Mon Sep 17 00:00:00 2001 From: hyunho Date: Mon, 15 Jun 2020 19:45:57 +0900 Subject: [PATCH] Apply pimpl idiom Change-Id: I26093be80aecca65c04b5d154cf542f03d00bbf6 Signed-off-by: hyunho --- .../src/ambient-viewer-implementation.hh | 56 ++++++++++++++ ambient-viewer/src/ambient-viewer.cc | 73 ++++++++++--------- ambient-viewer/src/ambient-viewer.hh | 13 +--- .../src/top-app-surface-implementation.hh | 47 ++++++++++++ ambient-viewer/src/top-app-surface.cc | 60 ++++++++------- ambient-viewer/src/top-app-surface.hh | 8 +- .../src/watch-surface-implementation.hh | 47 ++++++++++++ ambient-viewer/src/watch-surface.cc | 42 ++++++----- ambient-viewer/src/watch-surface.hh | 7 +- watch-holder-base/src/ambient_listener.cc | 22 ++++-- watch-holder-base/src/ambient_listener.hh | 5 +- .../src/ambient_listener_implementation.hh | 46 ++++++++++++ watch-holder-base/src/watch_base.cc | 69 +++++++++++------- watch-holder-base/src/watch_base.hh | 9 +-- .../src/watch_base_implementation.hh | 53 ++++++++++++++ watch-holder-base/src/watch_holder_base.cc | 64 ++++++++-------- watch-holder-base/src/watch_holder_base.hh | 20 +---- .../src/watch_holder_base_implementation.hh | 59 +++++++++++++++ watch-holder-base/src/watch_mirror_base.cc | 39 +++++----- watch-holder-base/src/watch_mirror_base.hh | 21 ++---- .../src/watch_mirror_base_implementation.hh | 49 +++++++++++++ watch-holder/src/watch.cc | 50 +++++++------ watch-holder/src/watch.hh | 7 +- watch-holder/src/watch_holder.cc | 23 ++++-- watch-holder/src/watch_holder.hh | 3 +- .../src/watch_holder_implementation.hh | 43 +++++++++++ watch-holder/src/watch_implementation.hh | 52 +++++++++++++ watch-holder/src/watch_mirror.cc | 17 +++-- watch-holder/src/watch_mirror.hh | 7 +- .../src/watch_mirror_implementation.hh | 43 +++++++++++ 30 files changed, 787 insertions(+), 267 deletions(-) create mode 100644 ambient-viewer/src/ambient-viewer-implementation.hh create mode 100644 ambient-viewer/src/top-app-surface-implementation.hh create mode 100644 ambient-viewer/src/watch-surface-implementation.hh create mode 100644 watch-holder-base/src/ambient_listener_implementation.hh create mode 100644 watch-holder-base/src/watch_base_implementation.hh create mode 100644 watch-holder-base/src/watch_holder_base_implementation.hh create mode 100644 watch-holder-base/src/watch_mirror_base_implementation.hh create mode 100644 watch-holder/src/watch_holder_implementation.hh create mode 100644 watch-holder/src/watch_implementation.hh create mode 100644 watch-holder/src/watch_mirror_implementation.hh diff --git a/ambient-viewer/src/ambient-viewer-implementation.hh b/ambient-viewer/src/ambient-viewer-implementation.hh new file mode 100644 index 00000000..82fd103a --- /dev/null +++ b/ambient-viewer/src/ambient-viewer-implementation.hh @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2020 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. + */ + +#ifndef AMBIENT_VIEWER_SRC_AMBIENT_VIEWER_IMPLEMENTATION_HH_ +#define AMBIENT_VIEWER_SRC_AMBIENT_VIEWER_IMPLEMENTATION_HH_ + + +#include + +#include +#include +#include + +#include "ambient-viewer.hh" + +namespace ambient_viewer { + +class AmbientViewer::Impl { + public: + virtual ~Impl(); + + private: + friend class AmbientViewer; + Impl(AmbientViewer* parent, Evas_Object* win); + + private: + AmbientViewer* parent_; + std::string GetUUID(std::string rid) const; + static int OnDeadSignal(const char* endpoint, aul_app_com_result_e e, + bundle* envelope, void* user_data); + static void OnChangedSignal(keynode_t* node, void* user_data); + static int OnReceiveSignal(const char* endpoint, aul_app_com_result_e e, + bundle* envelope, void* user_data); + Evas_Object* win_; + std::list> watch_stack_; + std::shared_ptr top_app_surface_; + aul_app_com_connection_h dead_signal_conn_ = nullptr; + aul_app_com_connection_h receive_signal_conn_ = nullptr; +}; + +} // namespace ambient_viewer + +#endif // AMBIENT_VIEWER_SRC_AMBIENT_VIEWER_IMPLEMENTATION_HH_ diff --git a/ambient-viewer/src/ambient-viewer.cc b/ambient-viewer/src/ambient-viewer.cc index d33cec48..7bad32c2 100644 --- a/ambient-viewer/src/ambient-viewer.cc +++ b/ambient-viewer/src/ambient-viewer.cc @@ -22,6 +22,7 @@ #include #include +#include "ambient-viewer-implementation.hh" #include "ambient-viewer.hh" #include "top-app-surface.hh" #include "watch-surface.hh" @@ -39,15 +40,20 @@ using namespace std; using namespace tizen_base; namespace ambient_viewer { +AmbientViewer::Impl::Impl(AmbientViewer* parent, Evas_Object* win) + : parent_(parent), win_(win) { +} +AmbientViewer::Impl::~Impl() = default; + AmbientViewer::AmbientViewer(Evas_Object* win) - : win_(win) { - if (aul_app_com_create("aod.ambientevent", nullptr, OnReceiveSignal, - this, &receive_signal_conn_) != AUL_R_OK) { + : impl_(new Impl(this, win)) { + if (aul_app_com_create("aod.ambientevent", nullptr, impl_->OnReceiveSignal, + this, &impl_->receive_signal_conn_) != AUL_R_OK) { LOGE("Failed to listen send extra signal"); } if (aul_app_com_create("watch.dead", nullptr, - OnDeadSignal, this, &dead_signal_conn_) != AUL_R_OK) { + impl_->OnDeadSignal, this, &impl_->dead_signal_conn_) != AUL_R_OK) { LOGE("failed to listen dead signal"); } @@ -55,10 +61,10 @@ AmbientViewer::AmbientViewer(Evas_Object* win) } AmbientViewer::~AmbientViewer() { - if (receive_signal_conn_) - aul_app_com_leave(receive_signal_conn_); - if (dead_signal_conn_) - aul_app_com_leave(dead_signal_conn_); + if (impl_->receive_signal_conn_) + aul_app_com_leave(impl_->receive_signal_conn_); + if (impl_->dead_signal_conn_) + aul_app_com_leave(impl_->dead_signal_conn_); } std::shared_ptr AmbientViewer::CreateWatchSurface(int rid, @@ -74,7 +80,7 @@ std::shared_ptr AmbientViewer::CreateTopAppSurface( return make_shared(std::move(surface), listener, mock); } -string AmbientViewer::GetUUID(string rid) const { +string AmbientViewer::Impl::GetUUID(string rid) const { char uuid[37]; uuid_t u; @@ -83,7 +89,7 @@ string AmbientViewer::GetUUID(string rid) const { return string(uuid) + rid; } -void AmbientViewer::OnChangedSignal(keynode_t *node, void *user_data) { +void AmbientViewer::Impl::OnChangedSignal(keynode_t *node, void *user_data) { AmbientViewer* viewer = (AmbientViewer*)user_data; char* raw = vconf_get_str(VCONFKEY_WATCH_CURRENT_WATCH_INFO); unique_ptr safe_raw(raw, free); @@ -94,15 +100,15 @@ void AmbientViewer::OnChangedSignal(keynode_t *node, void *user_data) { Bundle data(safe_raw.get()); string appid = data.GetString(NOTIFY_CHANGED_EVENT_APPID_KEY); LOGW("changed (%s)", appid.c_str()); - if (!viewer->watch_stack_.empty()) { - if (viewer->watch_stack_.back()->GetAppId() == appid) { + if (!viewer->impl_->watch_stack_.empty()) { + if (viewer->impl_->watch_stack_.back()->GetAppId() == appid) { LOGW("Already activated watch(%s)", appid.c_str()); return; } } string rid = data.GetString(NOTIFY_CHANGED_EVENT_RID_KEY); - viewer->watch_stack_.push_back(viewer->CreateWatchSurface( - stoi(rid), viewer->GetUUID(rid), appid, viewer->win_, viewer)); + viewer->impl_->watch_stack_.push_back(viewer->CreateWatchSurface( + stoi(rid), viewer->impl_->GetUUID(rid), appid, viewer->impl_->win_, viewer)); viewer->OnReceived(EVENT_WATCH_CHANGED, appid, data); } catch (const std::exception& e) { LOGE("Exception occurred : %s", e.what()); @@ -110,16 +116,16 @@ void AmbientViewer::OnChangedSignal(keynode_t *node, void *user_data) { } } -int AmbientViewer::OnDeadSignal(const char *endpoint, aul_app_com_result_e e, +int AmbientViewer::Impl::OnDeadSignal(const char *endpoint, aul_app_com_result_e e, bundle *envelope, void *user_data) { AmbientViewer* viewer = (AmbientViewer*)user_data; Bundle data(envelope, false, false); string appid = data.GetString(AUL_K_APPID); LOGW("Watch(%s) DEAD", appid.c_str()); list>::iterator it; - for (it = viewer->watch_stack_.begin(); it != viewer->watch_stack_.end(); ++it) { + for (it = viewer->impl_->watch_stack_.begin(); it != viewer->impl_->watch_stack_.end(); ++it) { if ((*it)->GetAppId() == appid) { - viewer->watch_stack_.erase(it); + viewer->impl_->watch_stack_.erase(it); LOGW("REMOVE DEAD WATCH (%s)", appid.c_str()); break; } @@ -131,36 +137,37 @@ int AmbientViewer::OnDeadSignal(const char *endpoint, aul_app_com_result_e e, void AmbientViewer::Monitor(bool full) { if (full) { - top_app_surface_ = CreateTopAppSurface( - make_shared(win_, false), this); + impl_->top_app_surface_ = CreateTopAppSurface( + make_shared(impl_->win_, false), this); } if (vconf_notify_key_changed( - VCONFKEY_WATCH_CURRENT_WATCH_INFO, OnChangedSignal, this) != 0) { + VCONFKEY_WATCH_CURRENT_WATCH_INFO, impl_->OnChangedSignal, this) != 0) { LOGE("failed to listen on changed signal"); return; } - OnChangedSignal(nullptr, this); + impl_->OnChangedSignal(nullptr, this); } void AmbientViewer::Unmonitor() { - vconf_ignore_key_changed(VCONFKEY_WATCH_CURRENT_WATCH_INFO, OnChangedSignal); - top_app_surface_.reset(); - watch_stack_.clear(); + vconf_ignore_key_changed( + VCONFKEY_WATCH_CURRENT_WATCH_INFO, impl_->OnChangedSignal); + impl_->top_app_surface_.reset(); + impl_->watch_stack_.clear(); } void AmbientViewer::BlockUpdate(bool enable) { - if (top_app_surface_ != nullptr && top_app_surface_.get() != nullptr) { - top_app_surface_->BlockUpdate(enable); + if (impl_->top_app_surface_ != nullptr && impl_->top_app_surface_.get() != nullptr) { + impl_->top_app_surface_->BlockUpdate(enable); LOGW("Top App Block Update (%d)", enable); } - if (watch_stack_.empty()) { + if (impl_->watch_stack_.empty()) { LOGW("Empty stack!"); return; } - watch_stack_.back()->BlockUpdate(enable); + impl_->watch_stack_.back()->BlockUpdate(enable); LOGW("Watch Block Update (%d)", enable); } @@ -222,19 +229,19 @@ int AmbientViewer::NotifyAmbientEvent(AmbientState state, AmbientViewer::Directi } const ISurface& AmbientViewer::GetWatchSurface() const { - if (watch_stack_.empty()) { + if (impl_->watch_stack_.empty()) { LOGE("watch surface stack is empty !"); throw std::runtime_error("watch surface stack is empty !"); } - return *watch_stack_.back(); + return *impl_->watch_stack_.back(); } const ISurface& AmbientViewer::GetTopAppSurface() const { - return *top_app_surface_; + return *impl_->top_app_surface_; } -int AmbientViewer::OnReceiveSignal(const char* endpoint, aul_app_com_result_e e, - bundle* envelope, void* user_data) { +int AmbientViewer::Impl::OnReceiveSignal(const char* endpoint, + aul_app_com_result_e e, bundle* envelope, void* user_data) { AmbientViewer* av = (AmbientViewer*)user_data; LOGD("OnReceiveSignal"); diff --git a/ambient-viewer/src/ambient-viewer.hh b/ambient-viewer/src/ambient-viewer.hh index da120068..a5d88005 100644 --- a/ambient-viewer/src/ambient-viewer.hh +++ b/ambient-viewer/src/ambient-viewer.hh @@ -77,17 +77,8 @@ class EXPORT_API AmbientViewer : public IAmbientViewer { IAmbientViewer* listener, bool mock = false); private: - std::string GetUUID(std::string rid) const; - static int OnDeadSignal(const char *endpoint, aul_app_com_result_e e, - bundle *envelope, void *user_data); - static void OnChangedSignal(keynode_t *node, void *user_data); - static int OnReceiveSignal(const char *endpoint, aul_app_com_result_e e, - bundle *envelope, void *user_data); - Evas_Object* win_; - std::list> watch_stack_; - std::shared_ptr top_app_surface_; - aul_app_com_connection_h dead_signal_conn_ = nullptr; - aul_app_com_connection_h receive_signal_conn_ = nullptr; + class Impl; + std::unique_ptr impl_; }; } // namespace ambient_viewer diff --git a/ambient-viewer/src/top-app-surface-implementation.hh b/ambient-viewer/src/top-app-surface-implementation.hh new file mode 100644 index 00000000..e5021c61 --- /dev/null +++ b/ambient-viewer/src/top-app-surface-implementation.hh @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2020 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. + */ + +#ifndef AMBIENT_VIEWER_SRC_TOP_APP_SURFACE_IMPLEMENTATION_HH_ +#define AMBIENT_VIEWER_SRC_TOP_APP_SURFACE_IMPLEMENTATION_HH_ + +#include + +#include + +#include "top-app-surface.hh" + +namespace ambient_viewer { + +class TopAppSurface::Impl { + public: + virtual ~Impl(); + + private: + friend class TopAppSurface; + Impl(TopAppSurface* parent, IAmbientViewer* listener); + + private: + TopAppSurface* parent_; + Evas_Object* image_ = nullptr; + std::string app_id_; + std::string inst_id_; + int pid_ = 0; + IAmbientViewer* listener_; +}; + +} // namespace ambient_viewer + +#endif // AMBIENT_VIEWER_SRC_TOP_APP_SURFACE_IMPLEMENTATION_HH_ diff --git a/ambient-viewer/src/top-app-surface.cc b/ambient-viewer/src/top-app-surface.cc index 433166e1..1f7134a2 100644 --- a/ambient-viewer/src/top-app-surface.cc +++ b/ambient-viewer/src/top-app-surface.cc @@ -16,6 +16,7 @@ #include +#include "top-app-surface-implementation.hh" #include "top-app-surface.hh" #include "util.hh" @@ -27,18 +28,23 @@ namespace ambient_viewer { +TopAppSurface::Impl::Impl(TopAppSurface* parent, + IAmbientViewer* listener) : parent_(parent), listener_(listener) { +} +TopAppSurface::Impl::~Impl() = default; + TopAppSurface::TopAppSurface( std::shared_ptr surface, IAmbientViewer* listener, bool mock) : screen_connector::RemoteSurfaceWatcher( screen_connector::RemoteSurface::UI, surface, true, mock), - listener_(listener) { + impl_(new Impl(this, listener)) { } TopAppSurface::~TopAppSurface() = default; Evas_Object* TopAppSurface::GetCurrentImage() const { - return image_; + return impl_->image_; } bool TopAppSurface::IsWatch() const { @@ -46,11 +52,11 @@ bool TopAppSurface::IsWatch() const { } std::string TopAppSurface::GetAppId() const { - return app_id_; + return impl_->app_id_; } std::string TopAppSurface::GetInstId() const { - return inst_id_; + return impl_->inst_id_; } float TopAppSurface::GetOpr() const { @@ -64,12 +70,12 @@ float TopAppSurface::GetOpr() const { tbm_surface_info_s info = {0, }; void* source_data; - if (image_ == nullptr) + if (impl_->image_ == nullptr) return 0; - evas_object_geometry_get(image_, nullptr, nullptr, &width, &height); + evas_object_geometry_get(impl_->image_, nullptr, nullptr, &width, &height); - ns = evas_object_image_native_surface_get(image_); + ns = evas_object_image_native_surface_get(impl_->image_); if (ns == nullptr) { return 0; } @@ -105,10 +111,10 @@ void TopAppSurface::BlockUpdate(bool enable) { void TopAppSurface::OnWatcherAdded(const std::string& appId, const std::string& instId, const int pid) { LOGD("WatcherAdded (%s:%s:%d)", appId.c_str(), instId.c_str(), pid); - if (app_id_ == "" && inst_id_ == "") { - app_id_ = appId; - inst_id_ = instId; - pid_ = pid; + if (impl_->app_id_ == "" && impl_->inst_id_ == "") { + impl_->app_id_ = appId; + impl_->inst_id_ = instId; + impl_->pid_ = pid; } } @@ -116,38 +122,38 @@ void TopAppSurface::OnWatcherChanged(const std::string& appId, const std::string& instId, const int pid, const screen_connector::EvasObject& image) { LOGD("WatcherChanged (%s:%s:%d)", appId.c_str(), instId.c_str(), pid); - if (app_id_ == appId && instId == inst_id_) { - bool not_added = image_ == nullptr; + if (impl_->app_id_ == appId && instId == impl_->inst_id_) { + bool not_added = impl_->image_ == nullptr; - image_ = image.GetRaw(); + impl_->image_ = image.GetRaw(); if (not_added) - listener_->OnAdded(*this); + impl_->listener_->OnAdded(*this); else - listener_->OnUpdated(*this); + impl_->listener_->OnUpdated(*this); } } void TopAppSurface::OnWatcherRemoved(const std::string& appId, const std::string& instId, const int pid) { LOGD("WatcherRemoved (%s:%s:%d)", appId.c_str(), instId.c_str(), pid); - if (app_id_ == appId && instId == inst_id_) { - app_id_ = ""; - inst_id_ = ""; - pid_ = 0; - listener_->OnRemoved(*this); - image_ = nullptr; + if (impl_->app_id_ == appId && instId == impl_->inst_id_) { + impl_->app_id_ = ""; + impl_->inst_id_ = ""; + impl_->pid_ = 0; + impl_->listener_->OnRemoved(*this); + impl_->image_ = nullptr; } } void TopAppSurface::OnWatcherFocusChanged(const std::string& appId, const std::string& instId, const int pid) { LOGD("WatcherFocusChanged (%s:%s:%d)", appId.c_str(), instId.c_str(), pid); - if (app_id_ != appId || instId != inst_id_) - OnWatcherRemoved(app_id_, inst_id_, pid_); + if (impl_->app_id_ != appId || instId != impl_->inst_id_) + OnWatcherRemoved(impl_->app_id_, impl_->inst_id_, impl_->pid_); - app_id_ = appId; - inst_id_ = instId; - pid_ = pid; + impl_->app_id_ = appId; + impl_->inst_id_ = instId; + impl_->pid_ = pid; } } // namespace ambient_viewer diff --git a/ambient-viewer/src/top-app-surface.hh b/ambient-viewer/src/top-app-surface.hh index 8d65f797..ae5dd272 100644 --- a/ambient-viewer/src/top-app-surface.hh +++ b/ambient-viewer/src/top-app-surface.hh @@ -54,12 +54,8 @@ class TopAppSurface : public screen_connector::RemoteSurfaceWatcher, const std::string& instId, const int pid) override; private: - Evas_Object* image_ = nullptr; - std::string app_id_; - std::string inst_id_; - int pid_ = 0; - - IAmbientViewer* listener_; + class Impl; + std::unique_ptr impl_; }; } // namespace ambient_viewer diff --git a/ambient-viewer/src/watch-surface-implementation.hh b/ambient-viewer/src/watch-surface-implementation.hh new file mode 100644 index 00000000..b093780f --- /dev/null +++ b/ambient-viewer/src/watch-surface-implementation.hh @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2020 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. + */ + +#ifndef AMBIENT_VIEWER_SRC_WATCH_SURFACE_IMPLEMENTATION_HH_ +#define AMBIENT_VIEWER_SRC_WATCH_SURFACE_IMPLEMENTATION_HH_ + +#include + +#include + +#include "watch-surface.hh" + +namespace ambient_viewer { + +class WatchSurface::Impl { + public: + virtual ~Impl(); + + private: + friend class WatchSurface; + Impl(WatchSurface* parent, std::string appid, IAmbientViewer* listener); + + private: + WatchSurface* parent_; + Evas_Object* image_ = nullptr; + std::string appid_; + std::string inst_id_; + + IAmbientViewer* listener_; +}; + +} // namespace ambient_viewer + +#endif // AMBIENT_VIEWER_SRC_WATCH_SURFACE_IMPLEMENTATION_HH_ diff --git a/ambient-viewer/src/watch-surface.cc b/ambient-viewer/src/watch-surface.cc index ca2ededf..1dfd37e6 100644 --- a/ambient-viewer/src/watch-surface.cc +++ b/ambient-viewer/src/watch-surface.cc @@ -15,6 +15,7 @@ */ #include +#include "watch-surface-implementation.hh" #include "watch-surface.hh" #include "util.hh" @@ -26,22 +27,29 @@ namespace ambient_viewer { +WatchSurface::Impl::Impl(WatchSurface* parent, std::string appid, + IAmbientViewer* listener) + : parent_(parent), appid_(appid), listener_(listener) { +} +WatchSurface::Impl::~Impl() = default; + WatchSurface::WatchSurface( int rid, std::string id, std::string appid, Evas_Object* viewer_win, IAmbientViewer* listener, bool mock) : RemoteSurfaceEvas(rid, id, RemoteSurface::WATCH, - std::make_shared(viewer_win, false), mock), - appid_(appid), listener_(listener) { + std::make_shared( + viewer_win, false), mock), + impl_(new Impl(this, appid, listener)) { RemoteSurfaceEvas::SetAutoVisibility(false); LOGI("WatchSurface created (%s)", appid.c_str()); } WatchSurface::~WatchSurface() { - LOGI("WatchSurface DESTROYED (%s)", appid_.c_str()); + LOGI("WatchSurface DESTROYED (%s)", impl_->appid_.c_str()); } Evas_Object* WatchSurface::GetCurrentImage() const { - return image_; + return impl_->image_; } bool WatchSurface::IsWatch() const { @@ -49,11 +57,11 @@ bool WatchSurface::IsWatch() const { } std::string WatchSurface::GetAppId() const { - return appid_; + return impl_->appid_; } std::string WatchSurface::GetInstId() const { - return inst_id_; + return impl_->inst_id_; } float WatchSurface::GetOpr() const { @@ -67,12 +75,12 @@ float WatchSurface::GetOpr() const { tbm_surface_info_s info = {0, }; void* source_data; - if (image_ == nullptr) + if (impl_->image_ == nullptr) return 0; - evas_object_geometry_get(image_, nullptr, nullptr, &width, &height); + evas_object_geometry_get(impl_->image_, nullptr, nullptr, &width, &height); - ns = evas_object_image_native_surface_get(image_); + ns = evas_object_image_native_surface_get(impl_->image_); if (ns == nullptr) { return 0; } @@ -107,25 +115,25 @@ void WatchSurface::BlockUpdate(bool enable) { void WatchSurface::OnEvasAdded(const std::string& appId, const std::string& instId, int pid, const screen_connector::EvasObject& image) { - inst_id_ = instId; - image_ = image.GetRaw(); + impl_->inst_id_ = instId; + impl_->image_ = image.GetRaw(); - listener_->OnAdded(*this); + impl_->listener_->OnAdded(*this); } void WatchSurface::OnEvasRemoved(const std::string& appId, const std::string& instId, int pid, const screen_connector::EvasObject& image) { - image_ = nullptr; - listener_->OnRemoved(*this); - LOGW("watch surface removed (%s) (%d)", appid_.c_str(), pid); + impl_->image_ = nullptr; + impl_->listener_->OnRemoved(*this); + LOGW("watch surface removed (%s) (%d)", impl_->appid_.c_str(), pid); } void WatchSurface::OnEvasChanged(const std::string& appId, const std::string& instId, int pid, const screen_connector::EvasObject& image) { - image_ = image.GetRaw(); - listener_->OnUpdated(*this); + impl_->image_ = image.GetRaw(); + impl_->listener_->OnUpdated(*this); } } // namespace ambient_viewer diff --git a/ambient-viewer/src/watch-surface.hh b/ambient-viewer/src/watch-surface.hh index 29e25161..cd1ac5b4 100644 --- a/ambient-viewer/src/watch-surface.hh +++ b/ambient-viewer/src/watch-surface.hh @@ -49,11 +49,8 @@ class WatchSurface : public screen_connector::RemoteSurfaceEvas, public ISurface int pid, const screen_connector::EvasObject& image) override; private: - Evas_Object* image_ = nullptr; - std::string appid_; - std::string inst_id_; - - IAmbientViewer* listener_; + class Impl; + std::unique_ptr impl_; }; } // namespace ambient_viewer diff --git a/watch-holder-base/src/ambient_listener.cc b/watch-holder-base/src/ambient_listener.cc index d0379881..c5704c1a 100644 --- a/watch-holder-base/src/ambient_listener.cc +++ b/watch-holder-base/src/ambient_listener.cc @@ -22,6 +22,7 @@ #include #include "common.hh" +#include "ambient_listener_implementation.hh" #include "ambient_listener.hh" #ifdef LOG_TAG @@ -35,14 +36,14 @@ using namespace std; namespace watch_holder { -AmbientListener::AmbientListener() { +AmbientListener::AmbientListener() : impl_(new Impl(this)) { if (aul_app_com_create("watch.ambientchange", nullptr, OnAmbientChangedSignal, - this, &ambient_changed_signal_conn_) != AUL_R_OK) { + this, &impl_->ambient_changed_signal_conn_) != AUL_R_OK) { LOGE("Failed to listen watch.ambientchange signal"); } if (aul_app_com_create("aod.ambientevent", nullptr, OnReceiveSignal, - this, &ambient_event_signal_conn_) != AUL_R_OK) { + this, &impl_->ambient_event_signal_conn_) != AUL_R_OK) { LOGE("Failed to listen aod.ambientevent signal"); } } @@ -57,7 +58,7 @@ int AmbientListener::OnReceiveSignal(const char* endpoint, return -1; } - tizen_base::Bundle b = tizen_base::Bundle(envelope, true, true); + tizen_base::Bundle b(envelope, true, true); std::string event_type = b.GetString("__APP_AMBIENT_EVENT__"); LOGI("event type (%s)", event_type.c_str()); int type = stoi(event_type); @@ -100,11 +101,16 @@ int AmbientListener::OnAmbientChangedSignal(const char *endpoint, } AmbientListener::~AmbientListener() { - if (ambient_changed_signal_conn_) - aul_app_com_leave(ambient_changed_signal_conn_); + if (impl_->ambient_changed_signal_conn_) + aul_app_com_leave(impl_->ambient_changed_signal_conn_); - if (ambient_event_signal_conn_) - aul_app_com_leave(ambient_event_signal_conn_); + if (impl_->ambient_event_signal_conn_) + aul_app_com_leave(impl_->ambient_event_signal_conn_); } +AmbientListener::Impl::Impl(AmbientListener* parent) + : parent_(parent) { +} +AmbientListener::Impl::~Impl() = default; + } // namespace watch_holder diff --git a/watch-holder-base/src/ambient_listener.hh b/watch-holder-base/src/ambient_listener.hh index 23ebf16b..272cfa61 100644 --- a/watch-holder-base/src/ambient_listener.hh +++ b/watch-holder-base/src/ambient_listener.hh @@ -21,6 +21,7 @@ #include #include +#include #include "common.hh" @@ -52,8 +53,8 @@ class AmbientListener { tizen_base::Bundle extra) = 0; private: - aul_app_com_connection_h ambient_changed_signal_conn_ = nullptr; - aul_app_com_connection_h ambient_event_signal_conn_ = nullptr; + class Impl; + std::unique_ptr impl_; }; } // namespace watch_holder diff --git a/watch-holder-base/src/ambient_listener_implementation.hh b/watch-holder-base/src/ambient_listener_implementation.hh new file mode 100644 index 00000000..c907b461 --- /dev/null +++ b/watch-holder-base/src/ambient_listener_implementation.hh @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2020 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. + */ + +#ifndef WATCH_HOLDER_BASE_SRC_AMBIENT_LISTENER_IMPLEMENTATION_HH_ +#define WATCH_HOLDER_BASE_SRC_AMBIENT_LISTENER_IMPLEMENTATION_HH_ + + +#include +#include + +#include + +#include "ambient_listener.hh" + +namespace watch_holder { + +class AmbientListener::Impl { + public: + virtual ~Impl(); + + private: + friend class AmbientListener; + Impl(AmbientListener* parent); + + private: + AmbientListener* parent_; + aul_app_com_connection_h ambient_changed_signal_conn_ = nullptr; + aul_app_com_connection_h ambient_event_signal_conn_ = nullptr; +}; + +} // namespace watch_holder + +#endif // WATCH_HOLDER_BASE_SRC_AMBIENT_LISTENER_IMPLEMENTATION_HH_ diff --git a/watch-holder-base/src/watch_base.cc b/watch-holder-base/src/watch_base.cc index ed4d1f68..d263f748 100644 --- a/watch-holder-base/src/watch_base.cc +++ b/watch-holder-base/src/watch_base.cc @@ -19,6 +19,7 @@ #include #include +#include "watch_base_implementation.hh" #include "watch_base.hh" #ifdef LOG_TAG @@ -36,31 +37,45 @@ WatchBase::WatchBase(std::string appid, std::shared_ptr surface, tizen_base::Bundle extra, IEvent* listener, bool mock) : RemoteSurface(appid, RemoteSurface::WATCH, surface, mock), - appid_(appid), listener_(listener), extra_data_(extra) { + impl_(new Impl(this, appid, listener, extra)) { } WatchBase::WatchBase(int rid, std::string id, std::string appid, std::shared_ptr surface, tizen_base::Bundle extra, IEvent* listener, bool mock) : RemoteSurface(rid, id, RemoteSurface::WATCH, surface, mock), - appid_(appid), listener_(listener), extra_data_(extra) { + impl_(new Impl(this, appid, listener, extra)) { } WatchBase::WatchBase(std::string appid, std::shared_ptr surface, IEvent* listener, bool mock) : RemoteSurface(appid, RemoteSurface::WATCH, surface, mock), - appid_(appid), listener_(listener) { + impl_(new Impl(this, appid, listener)) { } WatchBase::WatchBase(int rid, std::string id, std::string appid, std::shared_ptr surface, IEvent* listener, bool mock) : RemoteSurface(rid, id, RemoteSurface::WATCH, surface, mock), - appid_(appid), listener_(listener) { + impl_(new Impl(this, appid, listener)) { } WatchBase::~WatchBase() = default; + +WatchBase::Impl::Impl(WatchBase* parent, std::string appid, + WatchBase::IEvent* listener, tizen_base::Bundle extra) + : parent_(parent), appid_(appid), listener_(listener), extra_data_(extra) { +} + +WatchBase::Impl::Impl(WatchBase* parent, std::string appid, + WatchBase::IEvent* listener) + : parent_(parent), appid_(appid), listener_(listener) { +} + +WatchBase::Impl::~Impl() = default; + + void WatchBase::Resume() { RemoteSurface::SendVisibility(true); } @@ -70,8 +85,8 @@ void WatchBase::Pause() { } int WatchBase::Terminate() { - LOGW("Terminate (%d)", pid_); - return aul_terminate_pid(pid_); + LOGW("Terminate (%d)", impl_->pid_); + return aul_terminate_pid(impl_->pid_); } void WatchBase::BlockUpdate(bool enable) { @@ -88,55 +103,55 @@ int WatchBase::GetRid() const { } int WatchBase::GetPid() const { - return pid_; + return impl_->pid_; } bool WatchBase::IsBound() const { - return is_bound_; + return impl_->is_bound_; } string WatchBase::GetAppId() const { - return appid_; + return impl_->appid_; } bool WatchBase::IsFaulted() const { - return is_faulted_; + return impl_->is_faulted_; } void WatchBase::Bind(std::shared_ptr surface) { RemoteSurface::Bind(surface); - is_bound_ = true; + impl_->is_bound_ = true; } void WatchBase::Unbind() { RemoteSurface::Unbind(); - is_bound_ = false; + impl_->is_bound_ = false; } std::shared_ptr WatchBase::GetCurrentImage() const { - return current_buffer_; + return impl_->current_buffer_; } tizen_base::Bundle WatchBase::GetExtra() const { - return extra_data_; + return impl_->extra_data_; } void WatchBase::SetFaulted(bool faulted) { - is_faulted_ = faulted; + impl_->is_faulted_ = faulted; } void WatchBase::OnBufferAdded(const std::string& appId, const std::string& instId, int pid) { - pid_ = pid; + impl_->pid_ = pid; } void WatchBase::OnBufferRemoved(const std::string& appId, const std::string& instId, int pid) { - if (current_buffer_ == nullptr) + if (impl_->current_buffer_ == nullptr) return; - OnRemoved(appId, instId, pid, current_buffer_); - current_buffer_ = nullptr; + OnRemoved(appId, instId, pid, impl_->current_buffer_); + impl_->current_buffer_ = nullptr; } void WatchBase::OnBufferChanged(int type, @@ -153,34 +168,34 @@ void WatchBase::OnBufferChanged(int type, if (GetType() == RemoteSurface::WATCH && RemoteSurface::IsBound()) return; - if (current_buffer_ == nullptr) { + if (impl_->current_buffer_ == nullptr) { LOGD("first added !!!! %d %s", type, GetAppId().c_str()); OnAdded(GetAppId(), GetInstId(), GetPid(), tbm); } else { OnChanged(GetAppId(), GetInstId(), GetPid(), tbm); } - current_buffer_ = tbm; + impl_->current_buffer_ = tbm; } void WatchBase::OnAdded(const std::string& appId, const std::string& instId, int pid, std::shared_ptr tbm) { - pid_ = pid; - listener_->OnAdded(*this); + impl_->pid_ = pid; + impl_->listener_->OnAdded(*this); } void WatchBase::OnRemoved(const std::string& appId, const std::string& instId, int pid, std::shared_ptr tbm) { - listener_->OnRemoved(*this); + impl_->listener_->OnRemoved(*this); } void WatchBase::OnChanged(const std::string& appId, const std::string& instId, int pid, std::shared_ptr tbm) { - listener_->OnUpdated(*this); + impl_->listener_->OnUpdated(*this); } int WatchBase::NotifyChangedEvent() const { tizen_base::Bundle b; - b.Add(NOTIFY_CHANGED_EVENT_APPID_KEY, appid_); + b.Add(NOTIFY_CHANGED_EVENT_APPID_KEY, impl_->appid_); b.Add(NOTIFY_CHANGED_EVENT_RID_KEY, to_string(GetRid())); int ret = vconf_set_str( VCONFKEY_WATCH_CURRENT_WATCH_INFO, (const char*)b.ToRaw().first.get()); @@ -192,7 +207,7 @@ int WatchBase::NotifyChangedEvent() const { } WatchBase::IEvent* WatchBase::GetListener() { - return listener_; + return impl_->listener_; } } // namespace watch_holder diff --git a/watch-holder-base/src/watch_base.hh b/watch-holder-base/src/watch_base.hh index c5dd9584..d6709f28 100644 --- a/watch-holder-base/src/watch_base.hh +++ b/watch-holder-base/src/watch_base.hh @@ -91,13 +91,8 @@ class EXPORT_API WatchBase : public screen_connector::RemoteSurface, void SetFaulted(bool is_faulted); private: - int pid_ = 0; - std::string appid_; - IEvent* listener_; - std::shared_ptr current_buffer_ = nullptr; - tizen_base::Bundle extra_data_; - bool is_faulted_ = false; - bool is_bound_ = false; + class Impl; + std::unique_ptr impl_; }; } // namespace watch_holder diff --git a/watch-holder-base/src/watch_base_implementation.hh b/watch-holder-base/src/watch_base_implementation.hh new file mode 100644 index 00000000..8e4b513e --- /dev/null +++ b/watch-holder-base/src/watch_base_implementation.hh @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2020 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. + */ + +#ifndef WATCH_HOLDER_BASE_SRC_WATCH_BASE_IMPLEMENTATION_HH_ +#define WATCH_HOLDER_BASE_SRC_WATCH_BASE_IMPLEMENTATION_HH_ + +#include + +#include +#include +#include + +#include "watch_base.hh" + +namespace watch_holder { + +class WatchBase::Impl { + public: + virtual ~Impl(); + + private: + friend class WatchBase; + Impl(WatchBase* parent, std::string appid, WatchBase::IEvent* listener, + tizen_base::Bundle extra); + Impl(WatchBase* parent, std::string appid, WatchBase::IEvent* listener); + + private: + WatchBase* parent_; + int pid_ = 0; + std::string appid_; + WatchBase::IEvent* listener_; + std::shared_ptr current_buffer_ = nullptr; + tizen_base::Bundle extra_data_; + bool is_faulted_ = false; + bool is_bound_ = false; +}; + +} // namespace watch_holder + +#endif // WATCH_HOLDER_BASE_SRC_WATCH_BASE_IMPLEMENTATION_HH_ diff --git a/watch-holder-base/src/watch_holder_base.cc b/watch-holder-base/src/watch_holder_base.cc index e066e797..8af92434 100644 --- a/watch-holder-base/src/watch_holder_base.cc +++ b/watch-holder-base/src/watch_holder_base.cc @@ -27,6 +27,7 @@ #include +#include "watch_holder_base_implementation.hh" #include "watch_holder_base.hh" #ifdef LOG_TAG @@ -41,22 +42,21 @@ using namespace std; namespace watch_holder { WatchHolderBase::~WatchHolderBase() { - if (dead_signal_conn_) - aul_app_com_leave(dead_signal_conn_); - if (launch_signal_conn_) - aul_app_com_leave(launch_signal_conn_); + if (impl_->launch_signal_conn_) + aul_app_com_leave(impl_->launch_signal_conn_); + if (impl_->launch_signal_conn_) + aul_app_com_leave(impl_->launch_signal_conn_); } -WatchHolderBase::WatchHolderBase( - std::shared_ptr surface, int w, int h) - : surface_(surface), w_(w), h_(h) { +WatchHolderBase::WatchHolderBase(int w, int h) + : impl_(new Impl(this, w, h)) { if (aul_app_com_create("watch.dead", nullptr, - OnDeadSignal, this, &dead_signal_conn_) != AUL_R_OK) { + impl_->OnDeadSignal, this, &impl_->launch_signal_conn_) != AUL_R_OK) { LOGE("failed to create status"); } - if (aul_app_com_create("watch.launch", nullptr, OnLaunchSignal, - this, &launch_signal_conn_) != AUL_R_OK) { + if (aul_app_com_create("watch.launch", nullptr, impl_->OnLaunchSignal, + this, &impl_->launch_signal_conn_) != AUL_R_OK) { LOGE("Failed to listen watch.launch signal"); } @@ -65,9 +65,15 @@ WatchHolderBase::WatchHolderBase( getpid(), appid_buf, sizeof(appid_buf)) != AUL_R_OK) { LOGE("Failed to get appid (%d)", getpid()); } - appid_ = appid_buf; + impl_->appid_ = appid_buf; } +WatchHolderBase::Impl::Impl(WatchHolderBase* parent, int w, int h) + : parent_(parent), w_(w), h_(h) { +} + +WatchHolderBase::Impl::~Impl() = default; + int WatchHolderBase::Launch( string watch_appid, bool background, bundle* extra) { Bundle data; @@ -75,13 +81,13 @@ int WatchHolderBase::Launch( if (extra != nullptr) data = Bundle(extra, true, true); aul_svc_set_appid(data.GetHandle(), watch_appid.c_str()); - data.Add("WATCH_WIDTH", std::to_string(w_)); - data.Add("WATCH_HEIGHT", std::to_string(h_)); + data.Add("WATCH_WIDTH", std::to_string(impl_->w_)); + data.Add("WATCH_HEIGHT", std::to_string(impl_->h_)); data.Add("WATCH_BG_LAUNCH", std::to_string((int)background)); - data.Add(AUL_K_WIDGET_VIEWER, appid_); + data.Add(AUL_K_WIDGET_VIEWER, impl_->appid_); if (extra != nullptr) - extra_map_[watch_appid] = Bundle(extra, true, true); + impl_->extra_map_[watch_appid] = Bundle(extra, true, true); int pid = appsvc_run_service(data.GetHandle(), 0, nullptr, nullptr); if (pid < 0) { @@ -93,15 +99,15 @@ int WatchHolderBase::Launch( } const std::list>& WatchHolderBase::GetStack() const { - return stack_; + return impl_->stack_; } std::shared_ptr WatchHolderBase::GetCurrent() const { - if (stack_.empty()) { + if (impl_->stack_.empty()) { LOGW("Empty stack!"); return nullptr; } - return stack_.back(); + return impl_->stack_.back(); } void WatchHolderBase::OnAmbientChanged(bool enter, const Bundle& extra) { @@ -111,7 +117,7 @@ void WatchHolderBase::OnAmbientEvent(EventType ev, std::string sender, tizen_base::Bundle extra) { } -int WatchHolderBase::OnDeadSignal(const char *endpoint, aul_app_com_result_e e, +int WatchHolderBase::Impl::OnDeadSignal(const char *endpoint, aul_app_com_result_e e, bundle *envelope, void *user_data) { WatchHolderBase* holder = (WatchHolderBase*)user_data; Bundle data(envelope, false, false); @@ -120,12 +126,12 @@ int WatchHolderBase::OnDeadSignal(const char *endpoint, aul_app_com_result_e e, string is_faulted = data.GetString(AUL_K_IS_FAULT); LOGW("WatchBase(%s)(%s) DEAD", appid.c_str(), pid.c_str()); list>::iterator it; - for (it = holder->stack_.begin(); it != holder->stack_.end(); ++it) { + for (it = holder->impl_->stack_.begin(); it != holder->impl_->stack_.end(); ++it) { if ((*it)->GetAppId() == appid && pid == to_string((*it)->GetPid())) { (*it)->SetFaulted(is_faulted == "true"); holder->OnDead(**it); - holder->stack_.erase(it); + holder->impl_->stack_.erase(it); LOGW("REMOVE DEAD WATCH (%s)(%s)", appid.c_str(), pid.c_str()); break; } @@ -134,24 +140,24 @@ int WatchHolderBase::OnDeadSignal(const char *endpoint, aul_app_com_result_e e, return 0; } -int WatchHolderBase::OnLaunchSignal(const char *endpoint, +int WatchHolderBase::Impl::OnLaunchSignal(const char *endpoint, aul_app_com_result_e res, bundle *envelope, void *user_data) { Bundle launch_data(envelope, false, false); WatchHolderBase* holder = (WatchHolderBase*)user_data; string viewer_appid = launch_data.GetString(AUL_K_WIDGET_VIEWER); - if (viewer_appid != holder->appid_) { - LOGE("It's not mine (%s:%s)", viewer_appid.c_str(), holder->appid_.c_str()); + if (viewer_appid != holder->impl_->appid_) { + LOGE("It's not mine (%s:%s)", viewer_appid.c_str(), holder->impl_->appid_.c_str()); return 0; } string watch_appid = launch_data.GetString(AUL_K_APPID); - if (holder->extra_map_.find(watch_appid) != holder->extra_map_.end()) { - Bundle extra(holder->extra_map_[watch_appid]); - holder->stack_.push_back(holder->CreateWatch( + if (holder->impl_->extra_map_.find(watch_appid) != holder->impl_->extra_map_.end()) { + Bundle extra(holder->impl_->extra_map_[watch_appid]); + holder->impl_->stack_.push_back(holder->CreateWatch( watch_appid, extra)); - holder->extra_map_.erase(watch_appid); + holder->impl_->extra_map_.erase(watch_appid); } else { - holder->stack_.push_back(holder->CreateWatch(watch_appid)); + holder->impl_->stack_.push_back(holder->CreateWatch(watch_appid)); } holder->OnLaunched(*holder->GetCurrent()); LOGI("LAUNCH DONE (%s)", viewer_appid.c_str()); diff --git a/watch-holder-base/src/watch_holder_base.hh b/watch-holder-base/src/watch_holder_base.hh index eee44adc..fb699430 100644 --- a/watch-holder-base/src/watch_holder_base.hh +++ b/watch-holder-base/src/watch_holder_base.hh @@ -36,8 +36,7 @@ namespace watch_holder { class EXPORT_API WatchHolderBase : public WatchBase::IEvent, public AmbientListener { public: - WatchHolderBase( - std::shared_ptr surface, int w, int h); + WatchHolderBase(int w, int h); virtual ~WatchHolderBase() = 0; int Launch(std::string appid, bool background, bundle* extra); const std::list>& GetStack() const; @@ -65,21 +64,8 @@ class EXPORT_API WatchHolderBase std::string appid, tizen_base::Bundle extra, bool mock = false) = 0; private: - static int OnDeadSignal(const char *endpoint, aul_app_com_result_e e, - bundle *envelope, void *user_data); - static int OnLaunchSignal(const char *endpoint, - aul_app_com_result_e res, bundle *envelope, void *user_data); - - private: - std::string appid_; - std::map extra_map_; - std::list> stack_; - aul_app_com_connection_h launch_signal_conn_ = nullptr; - aul_app_com_connection_h dead_signal_conn_ = nullptr; - aul_app_com_connection_h ambient_changed_signal_conn_ = nullptr; - std::shared_ptr surface_; - int w_; - int h_; + class Impl; + std::unique_ptr impl_; }; } // namespace watch_holder diff --git a/watch-holder-base/src/watch_holder_base_implementation.hh b/watch-holder-base/src/watch_holder_base_implementation.hh new file mode 100644 index 00000000..a4b18367 --- /dev/null +++ b/watch-holder-base/src/watch_holder_base_implementation.hh @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020 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. + */ + +#ifndef WATCH_HOLDER_BASE_SRC_WATCH_HOLDER_BASE_IMPLEMENTATION_HH_ +#define WATCH_HOLDER_BASE_SRC_WATCH_HOLDER_BASE_IMPLEMENTATION_HH_ + +#include + +#include +#include +#include +#include +#include + +#include "watch_holder_base.hh" + +namespace watch_holder { + +class WatchHolderBase::Impl { + public: + virtual ~Impl(); + + private: + friend class WatchHolderBase; + Impl(WatchHolderBase* parent, int w, int h); + + static int OnDeadSignal(const char *endpoint, aul_app_com_result_e e, + bundle *envelope, void *user_data); + static int OnLaunchSignal(const char *endpoint, + aul_app_com_result_e res, bundle *envelope, void *user_data); + + private: + WatchHolderBase* parent_; + std::string appid_; + std::map extra_map_; + std::list> stack_; + aul_app_com_connection_h launch_signal_conn_ = nullptr; + aul_app_com_connection_h dead_signal_conn_ = nullptr; + aul_app_com_connection_h ambient_changed_signal_conn_ = nullptr; + int w_; + int h_; +}; + +} // namespace watch_holder + +#endif // WATCH_HOLDER_BASE_SRC_WATCH_HOLDER_BASE_IMPLEMENTATION_HH_ diff --git a/watch-holder-base/src/watch_mirror_base.cc b/watch-holder-base/src/watch_mirror_base.cc index b9c54826..e9b70496 100644 --- a/watch-holder-base/src/watch_mirror_base.cc +++ b/watch-holder-base/src/watch_mirror_base.cc @@ -19,6 +19,7 @@ #include #include +#include "watch_mirror_base_implementation.hh" #include "watch_mirror_base.hh" #include "bundle_cpp.h" @@ -32,12 +33,19 @@ using namespace tizen_base; using namespace std; namespace watch_holder { -WatchMirrorBase::~WatchMirrorBase() = default; -WatchMirrorBase::WatchMirrorBase( - shared_ptr surface) { +WatchMirrorBase::Impl::Impl(WatchMirrorBase* parent) : parent_(parent) { } -string WatchMirrorBase::GetUUID(string rid) const { +WatchMirrorBase::Impl::~Impl() = default; +WatchMirrorBase::~WatchMirrorBase() { + vconf_ignore_key_changed(VCONFKEY_WATCH_CURRENT_WATCH_INFO, + impl_->OnChangedSignal); +} + +WatchMirrorBase::WatchMirrorBase() : impl_(new Impl(this)) { +} + +string WatchMirrorBase::Impl::GetUUID(string rid) const { char uuid[37]; uuid_t u; @@ -46,7 +54,7 @@ string WatchMirrorBase::GetUUID(string rid) const { return string(uuid) + rid; } -void WatchMirrorBase::OnChangedSignal(keynode_t *node, void *user_data) { +void WatchMirrorBase::Impl::OnChangedSignal(keynode_t *node, void *user_data) { WatchMirrorBase* mirror = (WatchMirrorBase*)user_data; const char* raw = vconf_get_str(VCONFKEY_WATCH_CURRENT_WATCH_INFO); if (raw == nullptr || strlen(raw) == 0) { @@ -61,9 +69,9 @@ void WatchMirrorBase::OnChangedSignal(keynode_t *node, void *user_data) { Bundle data(raw_str); string appid = data.GetString(NOTIFY_CHANGED_EVENT_APPID_KEY); string rid = data.GetString(NOTIFY_CHANGED_EVENT_RID_KEY); - mirror->stack_.push_back(mirror->CreateWatch( - stoi(rid), mirror->GetUUID(rid), appid)); - mirror->OnChanged(stoi(rid), mirror->GetUUID(rid), appid); + mirror->impl_->stack_.push_back(mirror->CreateWatch( + stoi(rid), mirror->impl_->GetUUID(rid), appid)); + mirror->OnChanged(stoi(rid), mirror->impl_->GetUUID(rid), appid); } catch (const std::exception& e) { LOGE("Exception occurred : %s", e.what()); return; @@ -72,24 +80,24 @@ void WatchMirrorBase::OnChangedSignal(keynode_t *node, void *user_data) { int WatchMirrorBase::Listen() { if (vconf_notify_key_changed( - VCONFKEY_WATCH_CURRENT_WATCH_INFO, OnChangedSignal, this) != 0) { + VCONFKEY_WATCH_CURRENT_WATCH_INFO, impl_->OnChangedSignal, this) != 0) { LOGE("failed to listen on changed signal"); return -1; } - OnChangedSignal(nullptr, this); + impl_->OnChangedSignal(nullptr, this); return 0; } std::shared_ptr WatchMirrorBase::GetCurrent() const { - if (stack_.empty()) { + if (impl_->stack_.empty()) { LOGW("Empty stack!"); return nullptr; } - return stack_.back(); + return impl_->stack_.back(); } void WatchMirrorBase::AddWatch(shared_ptr watch) { - stack_.push_back(watch); + impl_->stack_.push_back(watch); } void WatchMirrorBase::OnAmbientChanged(bool enter, const Bundle& extra) { @@ -126,7 +134,4 @@ void WatchMirrorBase::OnRemoved(const WatchBase& watch) { void WatchMirrorBase::OnBound(const WatchBase& watch) { } -void WatchMirrorBase::OnChanged(int, std::string inst_id, std::string appid) { -} - -} // namespace watch_holder \ No newline at end of file +} // namespace watch_holder diff --git a/watch-holder-base/src/watch_mirror_base.hh b/watch-holder-base/src/watch_mirror_base.hh index dce0a479..1fbfc60a 100644 --- a/watch-holder-base/src/watch_mirror_base.hh +++ b/watch-holder-base/src/watch_mirror_base.hh @@ -35,7 +35,7 @@ namespace watch_holder { class EXPORT_API WatchMirrorBase : public WatchBase::IEvent, public AmbientListener { public: - WatchMirrorBase(std::shared_ptr surface); + WatchMirrorBase(); virtual ~WatchMirrorBase() = 0; int Listen(); std::shared_ptr GetCurrent() const; @@ -49,25 +49,20 @@ class EXPORT_API WatchMirrorBase : public WatchBase::IEvent, public AmbientListe tizen_base::Bundle extra) override; void AddWatch(std::shared_ptr watch); - private: - std::string GetUUID(std::string rid) const; - void OnAdded(const WatchBase& watch) final; - void OnUpdated(const WatchBase& watch) final; - void OnRemoved(const WatchBase& watch) final; - void OnBound(const WatchBase& watch) final; - virtual void OnChanged(int, std::string inst_id, std::string appid); - static void OnChangedSignal(keynode_t *node, void *user_data); - protected: virtual std::shared_ptr CreateWatch(int rid, std::string id, std::string appid, bool mock = false) = 0; virtual std::shared_ptr CreateWatch(int rid, std::string id, std::string appid, tizen_base::Bundle extra, bool mock = false) = 0; + virtual void OnChanged(int rid, std::string inst_id, std::string appid) = 0; + void OnAdded(const WatchBase& watch) override; + void OnUpdated(const WatchBase& watch) override; + void OnRemoved(const WatchBase& watch) override; + void OnBound(const WatchBase& watch) override; private: - std::string appid_; - aul_app_com_connection_h watch_changed_conn_ = nullptr; - std::list> stack_; + class Impl; + std::unique_ptr impl_; }; } // namespace watch_holder diff --git a/watch-holder-base/src/watch_mirror_base_implementation.hh b/watch-holder-base/src/watch_mirror_base_implementation.hh new file mode 100644 index 00000000..0390cf0a --- /dev/null +++ b/watch-holder-base/src/watch_mirror_base_implementation.hh @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020 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. + */ + +#ifndef WATCH_HOLDER_BASE_SRC_WATCH_MIRROR_BASE_IMPLEMENTATION_HH_ +#define WATCH_HOLDER_BASE_SRC_WATCH_MIRROR_BASE_IMPLEMENTATION_HH_ + +#include + +#include +#include +#include +#include +#include + +#include "watch_mirror_base.hh" + +namespace watch_holder { + +class WatchMirrorBase::Impl { + public: + virtual ~Impl(); + + private: + friend class WatchMirrorBase; + Impl(WatchMirrorBase* parent); + std::string GetUUID(std::string rid) const; + static void OnChangedSignal(keynode_t *node, void *user_data); + + private: + WatchMirrorBase* parent_; + std::list> stack_; +}; + +} // namespace watch_holder + +#endif // WATCH_HOLDER_BASE_SRC_WATCH_MIRROR_BASE_IMPLEMENTATION_HH_ diff --git a/watch-holder/src/watch.cc b/watch-holder/src/watch.cc index 546eed18..e565caf5 100644 --- a/watch-holder/src/watch.cc +++ b/watch-holder/src/watch.cc @@ -21,6 +21,7 @@ #include #include +#include "watch_implementation.hh" #include "watch.hh" #ifdef LOG_TAG @@ -34,12 +35,16 @@ using namespace tizen_base; using namespace screen_connector; namespace watch_holder { +Watch::Impl::Impl(Watch* parent, Evas_Object* viewer_win) + : parent_(parent), viewer_win_(viewer_win), + image_event_listener_((screen_connector::ImageEventListener*)parent) { +} +Watch::Impl::~Impl() = default; + Watch::Watch(std::string appid, Evas_Object* viewer_win, tizen_base::Bundle extra, IEvent* listener, bool mock) : WatchBase(appid, screen_connector::util::GetWlSurface(viewer_win), - extra, listener, mock), - viewer_win_(make_shared(viewer_win, false)), - image_event_listner_(make_shared(this)) { + extra, listener, mock), impl_(new Impl(this, viewer_win)) { } Watch::Watch(int rid, std::string id, std::string appid, @@ -47,37 +52,34 @@ Watch::Watch(int rid, std::string id, std::string appid, WatchBase::IEvent* listener, bool mock) : WatchBase(rid, id, appid, screen_connector::util::GetWlSurface(viewer_win), extra, listener, mock), - viewer_win_(make_shared(viewer_win, false)), - image_event_listner_(make_shared(this)) { + impl_(new Impl(this, viewer_win)) { } Watch::Watch(std::string appid, Evas_Object* viewer_win, IEvent* listener, bool mock) : WatchBase(appid, screen_connector::util::GetWlSurface(viewer_win), listener, mock), - viewer_win_(make_shared(viewer_win, false)), - image_event_listner_(make_shared(this)) { + impl_(new Impl(this, viewer_win)) { } Watch::Watch(int rid, std::string id, std::string appid, Evas_Object* viewer_win, WatchBase::IEvent* listener, bool mock) : WatchBase(rid, id, appid, screen_connector::util::GetWlSurface(viewer_win), listener, mock), - viewer_win_(make_shared(viewer_win, false)), - image_event_listner_(make_shared(this)) { + impl_(new Impl(this, viewer_win)) { } Watch::~Watch() = default; void Watch::OnAuxMsg(void *data, Evas_Object *o, void *ev_info) { Watch* wa = (Watch*)data; - if (wa->bind_win_ == nullptr) { + if (wa->impl_->bind_win_ == nullptr) { LOGW("Null bind win"); return; } Elm_Win_Aux_Message *msg = (Elm_Win_Aux_Message *)ev_info; - const char *key = elm_win_aux_msg_key_get(wa->bind_win_, msg); - const char *val = elm_win_aux_msg_val_get(wa->bind_win_, msg); + const char *key = elm_win_aux_msg_key_get(wa->impl_->bind_win_, msg); + const char *val = elm_win_aux_msg_val_get(wa->impl_->bind_win_, msg); if (key == nullptr || val == nullptr) { LOGW("Null msg data"); @@ -87,13 +89,13 @@ void Watch::OnAuxMsg(void *data, Evas_Object *o, void *ev_info) { if (!strcmp(key, "tz_remote_surface_mng") && !strcmp(val, "prebind")) { wa->GetListener()->OnBound(*wa); LOGI("Start bind mode !!"); - evas_object_smart_callback_del(wa->bind_win_, + evas_object_smart_callback_del(wa->impl_->bind_win_, "aux,msg,received", OnAuxMsg); } } void Watch::Bind(Evas_Object* win) { - bind_win_ = win; + impl_->bind_win_ = win; elm_win_aux_hint_add(win, "wm.policy.win.msg.use", "1"); evas_object_smart_callback_add(win, "aux,msg,received", OnAuxMsg, this); @@ -102,12 +104,12 @@ void Watch::Bind(Evas_Object* win) { void Watch::NoRenderPush(int timeout) { LOGI("No render push start"); - elm_win_norender_push(evas_object_evas_get(viewer_win_->GetRaw())); - no_render_timer_ = g_timeout_add(timeout, + elm_win_norender_push(evas_object_evas_get(impl_->viewer_win_)); + impl_->no_render_timer_ = g_timeout_add(timeout, [](gpointer user_data)->gboolean { Watch* wa = static_cast(user_data); - elm_win_norender_pop(evas_object_evas_get(wa->viewer_win_->GetRaw())); - wa->no_render_timer_ = 0; + elm_win_norender_pop(evas_object_evas_get(wa->impl_->viewer_win_)); + wa->impl_->no_render_timer_ = 0; LOGW("No render push timeout!"); return G_SOURCE_REMOVE; }, this); @@ -119,26 +121,26 @@ void Watch::Resume() { } Evas_Object* Watch::GetCurrentImageEvas() const { - return current_image_->GetRaw(); + return impl_->current_image_->GetRaw(); } void Watch::OnAdded(const string& appid, const string& inst_id, int pid, shared_ptr tbm) { - current_image_.reset(new Image(evas_object_image_filled_add( - evas_object_evas_get(viewer_win_->GetRaw())), - image_event_listner_.get(), inst_id, pid, this)); + impl_->current_image_.reset(new Image(evas_object_image_filled_add( + evas_object_evas_get(impl_->viewer_win_)), + impl_->image_event_listener_, inst_id, pid, this)); WatchBase::OnAdded(appid, inst_id, pid, tbm); } void Watch::OnRemoved(const string& appid, const string& inst_id, int pid, shared_ptr tbm) { WatchBase::OnRemoved(appid, inst_id, pid, tbm); - current_image_ = nullptr; + impl_->current_image_ = nullptr; } void Watch::OnChanged(const string& appid, const string& inst_id, int pid, shared_ptr tbm) { - current_image_->Update(tbm); + impl_->current_image_->Update(tbm); WatchBase::OnChanged(appid, inst_id, pid, tbm); } diff --git a/watch-holder/src/watch.hh b/watch-holder/src/watch.hh index 6f3ea617..7fa0800a 100644 --- a/watch-holder/src/watch.hh +++ b/watch-holder/src/watch.hh @@ -60,11 +60,8 @@ class EXPORT_API Watch : public WatchBase, public virtual ISharableWatch { static void OnAuxMsg(void *data, Evas_Object *o, void *ev_info); private: - Evas_Object* bind_win_ = nullptr; - int no_render_timer_ = 0; - std::unique_ptr current_image_ = nullptr; - std::shared_ptr viewer_win_ = nullptr; - std::shared_ptr image_event_listner_ = nullptr; + class Impl; + std::unique_ptr impl_; }; } // namespace watch_holder diff --git a/watch-holder/src/watch_holder.cc b/watch-holder/src/watch_holder.cc index 99467bc2..20f11029 100644 --- a/watch-holder/src/watch_holder.cc +++ b/watch-holder/src/watch_holder.cc @@ -21,7 +21,10 @@ #include #include +#include + #include "util.hh" +#include "watch_holder_implementation.hh" #include "watch_holder.hh" #include "bundle_cpp.h" @@ -35,35 +38,39 @@ using namespace tizen_base; using namespace std; namespace watch_holder { -WatchHolder::~WatchHolder() = default; +WatchHolder::Impl::Impl(WatchHolder* parent, Evas_Object* win) + : parent_(parent), viewer_win_(win) { +} +WatchHolder::Impl::~Impl() = default; +WatchHolder::~WatchHolder() = default; WatchHolder::WatchHolder(Evas_Object* win) : - WatchHolderBase(screen_connector::util::GetWlSurface(win), - util::GetWidth(win), util::GetHeight(win)), viewer_win_(win) { + WatchHolderBase(util::GetWidth(win), util::GetHeight(win)), + impl_(new Impl(this, win)) { } std::shared_ptr WatchHolder::CreateWatch(std::string appid, bool mock) { return make_shared( - std::move(appid), viewer_win_, this, mock); + std::move(appid), impl_->viewer_win_, this, mock); } std::shared_ptr WatchHolder::CreateWatch(int rid, std::string id, std::string appid, bool mock) { return make_shared(rid, std::move(id), - std::move(appid), viewer_win_, this, mock); + std::move(appid), impl_->viewer_win_, this, mock); } std::shared_ptr WatchHolder::CreateWatch(std::string appid, tizen_base::Bundle extra, bool mock) { - return make_shared(std::move(appid), viewer_win_, std::move(extra), - this, mock); + return make_shared(std::move(appid), impl_->viewer_win_, + std::move(extra), this, mock); } std::shared_ptr WatchHolder::CreateWatch(int rid, std::string id, std::string appid, tizen_base::Bundle extra, bool mock) { return make_shared(rid, std::move(id), std::move(appid), - viewer_win_, std::move(extra), this, mock); + impl_->viewer_win_, std::move(extra), this, mock); } shared_ptr WatchHolder::Cast(shared_ptr watch) { diff --git a/watch-holder/src/watch_holder.hh b/watch-holder/src/watch_holder.hh index 2bef2f16..22554346 100644 --- a/watch-holder/src/watch_holder.hh +++ b/watch-holder/src/watch_holder.hh @@ -52,7 +52,8 @@ class EXPORT_API WatchHolder : public WatchHolderBase { std::string appid, tizen_base::Bundle extra, bool mock = false) override; private: - Evas_Object* viewer_win_; + class Impl; + std::unique_ptr impl_; }; } // namespace watch_holder diff --git a/watch-holder/src/watch_holder_implementation.hh b/watch-holder/src/watch_holder_implementation.hh new file mode 100644 index 00000000..540d7b8f --- /dev/null +++ b/watch-holder/src/watch_holder_implementation.hh @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2020 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. + */ + +#ifndef WATCH_HOLDER_SRC_WATCH_HOLDER_IMPLEMENTATION_HH_ +#define WATCH_HOLDER_SRC_WATCH_HOLDER_IMPLEMENTATION_HH_ + +#include + +#include + +#include "watch_holder.hh" + +namespace watch_holder { + +class WatchHolder::Impl { + public: + virtual ~Impl(); + + private: + friend class WatchHolder; + Impl(WatchHolder* parent, Evas_Object* viewer_win); + + private: + WatchHolder* parent_; + Evas_Object* viewer_win_; +}; + +} // namespace watch_holder + +#endif // WATCH_HOLDER_SRC_WATCH_HOLDER_IMPLEMENTATION_HH_ diff --git a/watch-holder/src/watch_implementation.hh b/watch-holder/src/watch_implementation.hh new file mode 100644 index 00000000..63a05461 --- /dev/null +++ b/watch-holder/src/watch_implementation.hh @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2020 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. + */ + +#ifndef WATCH_HOLDER_SRC_WATCH_IMPLEMENTATION_HH_ +#define WATCH_HOLDER_SRC_WATCH_IMPLEMENTATION_HH_ + +#include +#include + +#include +#include +#include +#include +#include + +#include "watch.hh" + +namespace watch_holder { + +class Watch::Impl { + public: + virtual ~Impl(); + + private: + friend class Watch; + Impl(Watch* parent, Evas_Object* viewer_win); + + private: + Watch* parent_; + Evas_Object* bind_win_ = nullptr; + int no_render_timer_ = 0; + std::unique_ptr current_image_ = nullptr; + Evas_Object* viewer_win_ = nullptr; + screen_connector::ImageEventListener* image_event_listener_ = nullptr; +}; + +} // namespace watch_holder + +#endif // WATCH_HOLDER_SRC_WATCH_IMPLEMENTATION_HH_ diff --git a/watch-holder/src/watch_mirror.cc b/watch-holder/src/watch_mirror.cc index ebedf1e0..20c5e8a9 100644 --- a/watch-holder/src/watch_mirror.cc +++ b/watch-holder/src/watch_mirror.cc @@ -18,6 +18,7 @@ #include +#include "watch_mirror_implementation.hh" #include "watch_mirror.hh" #include "watch.hh" #include "util.hh" @@ -32,10 +33,14 @@ using namespace tizen_base; using namespace std; namespace watch_holder { +WatchMirror::Impl::Impl(WatchMirror* parent, Evas_Object* win) + : parent_(parent), viewer_win_(win) { +} +WatchMirror::Impl::~Impl() = default; + WatchMirror::~WatchMirror() = default; -WatchMirror::WatchMirror(Evas_Object* win) - : WatchMirrorBase(screen_connector::util::GetWlSurface(win)), - viewer_win_(win) { +WatchMirror::WatchMirror(Evas_Object* win) : WatchMirrorBase(), + impl_(new Impl(this, win)) { } void WatchMirror::OnChanged(const ISharableWatchBase& watch) { @@ -43,7 +48,7 @@ void WatchMirror::OnChanged(const ISharableWatchBase& watch) { void WatchMirror::OnChanged(int rid, std::string inst_id, std::string appid) { WatchMirrorBase::AddWatch(make_shared( - rid, inst_id, appid, viewer_win_, nullptr, this)); + rid, inst_id, appid, impl_->viewer_win_, nullptr, this)); shared_ptr cur = WatchMirrorBase::GetCurrent(); OnChanged(*cur.get()); } @@ -62,13 +67,13 @@ const ISharableWatch& WatchMirror::Cast(const ISharableWatchBase& watch) { std::shared_ptr WatchMirror::CreateWatch(int rid, std::string id, std::string appid, bool mock) { return make_shared(rid, std::move(id), std::move(appid), - viewer_win_, this, mock); + impl_->viewer_win_, this, mock); } std::shared_ptr WatchMirror::CreateWatch(int rid, std::string id, std::string appid, tizen_base::Bundle extra, bool mock) { return make_shared(rid, std::move(id), std::move(appid), - viewer_win_, std::move(extra), this, mock); + impl_->viewer_win_, std::move(extra), this, mock); } } // namespace watch_holder diff --git a/watch-holder/src/watch_mirror.hh b/watch-holder/src/watch_mirror.hh index 24e15fa1..c08e70d3 100644 --- a/watch-holder/src/watch_mirror.hh +++ b/watch-holder/src/watch_mirror.hh @@ -44,12 +44,11 @@ class EXPORT_API WatchMirror : public WatchMirrorBase { std::string appid, bool mock = false) override; std::shared_ptr CreateWatch(int rid, std::string id, std::string appid, tizen_base::Bundle extra, bool mock = false) override; + void OnChanged(int rid, std::string inst_id, std::string appid) override; private: - void OnChanged(int, std::string inst_id, std::string appid) override; - - private: - Evas_Object* viewer_win_; + class Impl; + std::unique_ptr impl_; }; } // namespace watch_holder diff --git a/watch-holder/src/watch_mirror_implementation.hh b/watch-holder/src/watch_mirror_implementation.hh new file mode 100644 index 00000000..b4ebabda --- /dev/null +++ b/watch-holder/src/watch_mirror_implementation.hh @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2020 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. + */ + +#ifndef WATCH_HOLDER_SRC_WATCH_MIRROR_IMPLEMENTATION_HH_ +#define WATCH_HOLDER_SRC_WATCH_MIRROR_IMPLEMENTATION_HH_ + +#include + +#include + +#include "watch_mirror.hh" + +namespace watch_holder { + +class WatchMirror::Impl { + public: + virtual ~Impl(); + + private: + friend class WatchMirror; + Impl(WatchMirror* parent, Evas_Object* viewer_win); + + private: + WatchMirror* parent_; + Evas_Object* viewer_win_; +}; + +} // namespace watch_holder + +#endif // WATCH_HOLDER_SRC_WATCH_MIRROR_IMPLEMENTATION_HH_ -- 2.34.1