PROJECT(tizen-theme-manager)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(EXEC_PREFIX "\${prefix}")
+SET(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
SET(LIBDIR ${LIB_INSTALL_DIR})
SET(INCLUDEDIR "\${prefix}/include")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
## Targets
-SET(TARGET_TIZEN_THEME_MANAGER "tizen-theme-manager")
+SET(TARGET_TIZEN_THEME_PROVIDER "tizen-theme-provider")
INCLUDE(FindPkgConfig)
INCLUDE(ApplyPkgConfig)
ADD_DEFINITIONS("-DPROJECT_TAG=\"TIZEN_THEME_MANAGER\"")
## Find all needed packages once
+PKG_CHECK_MODULES(BUNDLE_DEPS REQUIRED bundle)
+
+ADD_SUBDIRECTORY(src)
Source0: %{name}-%{version}.tar.gz
Source1001: %{name}.manifest
BuildRequires: cmake
+BuildRequires: pkgconfig(bundle)
%description
Tizen Theme Manager
%manifest %{name}.manifest
%license LICENSE
%defattr(-,root,root,-)
+%{_bindir}/*
--- /dev/null
+ADD_SUBDIRECTORY(theme_provider)
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef THEME_DBUS_REQUEST_HANDLER_H_
+#define THEME_DBUS_REQUEST_HANDLER_H_
+
+#include <bundle_cpp.h>
+
+namespace ttm {
+
+enum class Command : int {
+};
+
+class IRequestHandler {
+ public:
+ virtual tizen_base::Bundle OnRequest(Command cmd,
+ const tizen_base::Bundle& args) = 0;
+};
+
+} // namespace ttm
+
+#endif // THEME_DBUS_REQUEST_HANDLER_H_
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef THEME_LOADER_THEME_INFO_H_
+#define THEME_LOADER_THEME_INFO_H_
+
+namespace ttm {
+
+class ThemeInfo {
+};
+
+} // namespace ttm
+
+#endif // THEME_LOADER_THEME_INFO_H_
--- /dev/null
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} THEME_PROVIDER_SRCS)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+
+ADD_EXECUTABLE(${TARGET_TIZEN_THEME_PROVIDER}
+ ${THEME_PROVIDER_SRCS}
+)
+
+APPLY_PKG_CONFIG(${TARGET_TIZEN_THEME_PROVIDER} PUBLIC
+ BUNDLE_DEPS
+)
+
+SET_TARGET_PROPERTIES(${TARGET_TIZEN_THEME_PROVIDER} PROPERTIES COMPILE_FLAGS "-fPIE")
+SET_TARGET_PROPERTIES(${TARGET_TIZEN_THEME_PROVIDER} PROPERTIES LINK_FLAGS "-pie")
+
+INSTALL(TARGETS ${TARGET_TIZEN_THEME_PROVIDER} DESTINATION ${BINDIR})
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "theme_provider/control_request_handler.h"
+
+#include <bundle_cpp.h>
+
+namespace ttm {
+
+tizen_base::Bundle ControlRequestHandler::OnRequest(Command cmd,
+ const tizen_base::Bundle& args) {
+ return {};
+}
+
+} // namespace ttm
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef THEME_PROVIDER_CONTROL_REQUEST_HANDLER_H_
+#define THEME_PROVIDER_CONTROL_REQUEST_HANDLER_H_
+
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+
+#include "theme/dbus/request_handler.h"
+
+namespace ttm {
+
+class ThemeInfoProxy;
+
+class ControlRequestHandler : public IRequestHandler {
+ public:
+ explicit ControlRequestHandler(std::shared_ptr<ThemeInfoProxy> proxy)
+ : IRequestHandler(), proxy_(proxy) { }
+ tizen_base::Bundle OnRequest(Command cmd, const tizen_base::Bundle& args);
+
+ private:
+ std::shared_ptr<ThemeInfoProxy> proxy_;
+};
+
+} // namespace ttm
+
+#endif // THEME_PROVIDER_CONTROL_REQUEST_HANDLER_H_
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "theme_provider/db_manager.h"
+
+#include <bundle_cpp.h>
+
+#include <string>
+
+namespace ttm {
+
+bool DbManager::Insert(const std::string& id, const tizen_base::Bundle& info) {
+ return true;
+}
+
+bool DbManager::Delete(const std::string& id) {
+ return true;
+}
+
+tizen_base::Bundle DbManager::Select(const std::string& id) {
+ return {};
+}
+
+bool DbManager::UpdateCurrentId(const std::string& id) {
+ return true;
+}
+
+void DbManager::AddPackageEventListener(
+ std::shared_ptr<IThemePackageEvent> listener) {
+ listeners_.emplace_back(listener);
+}
+
+
+} // namespace ttm
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef THEME_PROVIDER_DB_MANAGER_H_
+#define THEME_PROVIDER_DB_MANAGER_H_
+
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace ttm {
+
+class IThemePackageEvent {
+ public:
+ virtual void OnThemePackageChanged(const std::string& id) = 0;
+};
+
+class DbManager {
+ public:
+ bool Insert(const std::string& id, const tizen_base::Bundle& info);
+ bool Delete(const std::string& id);
+ tizen_base::Bundle Select(const std::string& id);
+ bool UpdateCurrentId(const std::string& id);
+ void AddPackageEventListener(std::shared_ptr<IThemePackageEvent> listener);
+
+ private:
+ std::vector<std::shared_ptr<IThemePackageEvent>> listeners_;
+};
+
+} // namespace ttm
+
+#endif // THEME_PROVIDER_DB_MANAGER_H_
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+int main(int argc, char** argv) {
+ return 0;
+}
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "theme_provider/package_event_request_handler.h"
+
+#include <bundle_cpp.h>
+
+namespace ttm {
+
+tizen_base::Bundle PackageEventRequestHandler::OnRequest(Command cmd,
+ const tizen_base::Bundle& args) {
+ return {};
+}
+
+} // namespace ttm
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef THEME_PROVIDER_PACKAGE_EVENT_REQUEST_HANDLER_H_
+#define THEME_PROVIDER_PACKAGE_EVENT_REQUEST_HANDLER_H_
+
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+
+#include "theme/dbus/request_handler.h"
+
+namespace ttm {
+
+class ThemeInfoProxy;
+
+class PackageEventRequestHandler : public IRequestHandler {
+ public:
+ explicit PackageEventRequestHandler(std::shared_ptr<ThemeInfoProxy> proxy)
+ : IRequestHandler(), proxy_(proxy) { }
+ tizen_base::Bundle OnRequest(Command cmd, const tizen_base::Bundle& args);
+
+ private:
+ std::shared_ptr<ThemeInfoProxy> proxy_;
+};
+
+} // namespace ttm
+
+#endif // THEME_PROVIDER_PACKAGE_EVENT_REQUEST_HANDLER_H_
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "theme_provider/selection_request_handler.h"
+
+#include <bundle_cpp.h>
+
+namespace ttm {
+
+tizen_base::Bundle SelectionRequestHandler::OnRequest(Command cmd,
+ const tizen_base::Bundle& args) {
+ return {};
+}
+
+} // namespace ttm
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef THEME_PROVIDER_SELECTION_REQUEST_HANDLER_H_
+#define THEME_PROVIDER_SELECTION_REQUEST_HANDLER_H_
+
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <string>
+
+#include "theme/dbus/request_handler.h"
+
+namespace ttm {
+
+class ThemeInfoProxy;
+
+class SelectionRequestHandler : public IRequestHandler {
+ public:
+ explicit SelectionRequestHandler(std::shared_ptr<ThemeInfoProxy> proxy)
+ : IRequestHandler(), proxy_(proxy) { }
+ tizen_base::Bundle OnRequest(Command cmd, const tizen_base::Bundle& args);
+
+ private:
+ std::shared_ptr<ThemeInfoProxy> proxy_;
+};
+
+} // namespace ttm
+
+#endif // THEME_PROVIDER_SELECTION_REQUEST_HANDLER_H_
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "theme_provider/theme_info_proxy.h"
+
+#include <string>
+
+#include "theme/loader/theme_info.h"
+
+namespace ttm {
+
+class ThemeInfo;
+
+ThemeInfo LoadTheme(const std::string& id) {
+ return {};
+}
+
+bool SaveTheme(const ThemeInfo& info) {
+ return true;
+}
+
+ThemeInfo GetLoadedTheme() {
+ return {};
+}
+
+bool SetCurrentTheme(const std::string& id) {
+ return true;
+}
+
+void OnThemePackageChanged(const std::string& id) {
+}
+
+} // namespace ttm
--- /dev/null
+// Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef THEME_PROVIDER_THEME_INFO_PROXY_H_
+#define THEME_PROVIDER_THEME_INFO_PROXY_H_
+
+#include <string>
+
+#include "theme/loader/theme_info.h"
+#include "theme_provider/db_manager.h"
+
+namespace ttm {
+
+class ThemeInfo;
+
+class ThemeInfoProxy : public IThemePackageEvent {
+ public:
+ ThemeInfo LoadTheme(const std::string& id);
+ bool SaveTheme(const ThemeInfo& info);
+ ThemeInfo GetLoadedTheme();
+ bool SetCurrentTheme(const std::string& id);
+ void OnThemePackageChanged(const std::string& id) override;
+};
+
+} // namespace ttm
+
+#endif // THEME_PROVIDER_THEME_INFO_PROXY_H_