AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/loader THEME_LOADER_SRCS)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/utils THEME_UTILS_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/dbus THEME_UTILS_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/api THEME_UTILS_SRCS)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/loader/)
ADD_LIBRARY(${TARGET_TIZEN_THEME} SHARED
${THEME_LOADER_SRCS}
--- /dev/null
+/*
+ * 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.
+ */
+
+#include "theme/api/theme.h"
+
--- /dev/null
+/*
+ * 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 __TIZEN_THEME_MANAGER_THEME_H__
+#define __TIZEN_THEME_MANAGER_THEME_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __TIZEN_THEME_MANAGER_THEME_H__ */
--- /dev/null
+/*
+ * 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.
+ */
+
+#include "theme/api/theme_loader.h"
+
--- /dev/null
+/*
+ * 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 __TIZEN_THEME_MANAGER_THEME_LOADER_H__
+#define __TIZEN_THEME_MANAGER_THEME_LOADER_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __TIZEN_THEME_MANAGER_THEME_LOADER_H__ */
-// 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.
+/*
+ * 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 THEME_DBUS_REQUEST_BROKER_H_
#define THEME_DBUS_REQUEST_BROKER_H_
#include <gio/gio.h>
-#include "request_filter.h"
+#include "theme/dbus/request_filter.h"
namespace ttm {
+namespace dbus {
class RequestBroker {
public:
GDBusConnection* connection_ = nullptr;
std::List<std::shared_ptr<RequestFilter>> filters_;
};
+
+} // namespace dbus
} // namespace ttm
#endif // THEME_DBUS_REQUEST_BROKER_H_
-// 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.
+/*
+ * 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 THEME_DBUS_REQUEST_HANDLER_H_
-#define THEME_DBUS_REQUEST_HANDLER_H_
+#ifndef THEME_DBUS_REQUEST_FILTER_H_
+#define THEME_DBUS_REQUEST_FILTER_H_
-#include "request_handler.h"
+#include <memory>
+
+#include "theme/dbus/request_handler.h"
namespace ttm {
+namespace dbus {
class RequestFilter {
public:
std::shared_ptr<IRequestHandler> handler_;
};
+} // namespace dbus
} // namespace ttm
-#endif // THEME_DBUS_REQUEST_HANDLER_H_
+#endif // THEME_DBUS_REQUEST_FILTER_H_
-// 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.
+/*
+ * 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 THEME_DBUS_REQUEST_HANDLER_H_
#define THEME_DBUS_REQUEST_HANDLER_H_
#include <bundle_cpp.h>
namespace ttm {
+namespace dbus {
enum class Command : int {
+ GET_IDS,
+ SET_ID,
+ GET,
+ RESULT,
+ ADD,
+ UPDATE,
+ REMOVE,
+ CHANGED,
+ REMOVED
};
class IRequestHandler {
public:
+ virtual ~IRequestHandler() = default;
virtual tizen_base::Bundle OnRequest(Command cmd,
const tizen_base::Bundle& args) = 0;
};
+} // namespace dbus
} // namespace ttm
#endif // THEME_DBUS_REQUEST_HANDLER_H_
-// 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.
+/*
+ * 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 THEME_LOADER_THEME_EVENT_H_
#define THEME_LOADER_THEME_EVENT_H_
-#include "theme_info.h"
+#include "theme/loader/theme_info.h"
namespace ttm {
+namespace loader {
class IThemeEvent {
public:
+ virtual ~IThemeEvent() = default;
virtual void OnThemeLoaded(const ThemeInfo,
const tizen_base::Bundle& args) = 0;
};
+} // namespace loader
} // namespace ttm
#endif // THEME_LOADER_THEME_EVENT_H_
-// 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.
+/*
+ * 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.
+ */
#include <string>
-#include "theme_info.h"
+#include "theme/loader/theme_info.h"
namespace ttm {
+namespace loader {
-class ThemeInfo;
-
-std::string ThemeInfo::GetId() {
+std::string ThemeInfo::GetId() const {
return id_;
}
-std::string ThemeInfo::GetVesion() {
+std::string ThemeInfo::GetVesion() const {
return version_;
}
-std::string ThemeInfo::GetToolVersion() {
+std::string ThemeInfo::GetToolVersion() const {
return tool_version_;
}
-std::string ThemeInfo::GetTitle() {
+std::string ThemeInfo::GetTitle() const {
return title_;
}
-std::string ThemeInfo::GetResolution() {
+std::string ThemeInfo::GetResolution() const {
return resolution_;
}
-std::string ThemeInfo::GetPreview() {
+std::string ThemeInfo::GetPreview() const {
return preview_;
}
-std::string ThemeInfo::GetDescription() {
+std::string ThemeInfo::GetDescription() const {
return description_;
}
-std::string ThemeInfo::GetString(std::string& key) {
+std::string ThemeInfo::GetString(std::string& key) const {
return id_;
}
-std::vector<std::string> ThemeInfo::GetStringArray(std::string& key) {
+std::vector<std::string> ThemeInfo::GetStringArray(std::string& key) const {
std::vector<std::string> v;
return v;
}
-int ThemeInfo::GetInt(std::string& key) {
+int ThemeInfo::GetInt(std::string& key) const {
return 0;
}
-float ThemeInfo::GetFloat(std::string& key) {
+float ThemeInfo::GetFloat(std::string& key) const {
return 1.0;
}
-bool ThemeInfo::GetBool(std::string& key) {
+bool ThemeInfo::GetBool(std::string& key) const {
return true;
}
return 0;
}
+} // namespace loader
} // namespace ttm
-// 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.
+/*
+ * 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 THEME_LOADER_THEME_INFO_H_
#define THEME_LOADER_THEME_INFO_H_
#include <bundle_cpp.h>
namespace ttm {
+namespace loader {
class ThemeInfo {
public:
title_(title), resolution_(resolution), preview_(preview),
description_(description) { }
- std::string GetId();
- std::string GetVesion();
- std::string GetToolVersion();
- std::string GetTitle();
- std::string GetResolution();
- std::string GetPreview();
- std::string GetDescription();
- std::string GetString(std::string& key);
- std::vector<std::string> GetStringArray(std::string& key);
- int GetInt(std::string& key);
- float GetFloat(std::string& key);
- bool GetBool(std::string& key);
+ std::string GetId() const;
+ std::string GetVesion() const;
+ std::string GetToolVersion() const;
+ std::string GetTitle() const;
+ std::string GetResolution() const;
+ std::string GetPreview() const;
+ std::string GetDescription() const;
+ std::string GetString(std::string& key) const;
+ std::vector<std::string> GetStringArray(std::string& key) const;
+ int GetInt(std::string& key) const;
+ float GetFloat(std::string& key) const;
+ bool GetBool(std::string& key) const;
int Serialize(tizen_base::Bundle& bundle);
int Deserialize(const tizen_base::Bundle& bundle);
std::string description_;
};
+} // namespace loader
} // namespace ttm
#endif // THEME_LOADER_THEME_INFO_H_
-// 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.
+/*
+ * 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 THEME_LOADER_THEME_INFO_LOADER_H_
#define THEME_LOADER_THEME_INFO_LOADER_H_
#include "theme/dbus/request_handler.h"
namespace ttm {
+namespace loader {
class ThemeInfoLoader : public IRequestHandler {
public:
std::List<IThemeEvent> listeners_;
};
+} // namespace loader
} // namespace ttm
#endif // THEME_LOADER_THEME_INFO_LOADER_H_
return *this;\r
}\r
\r
-ThemeInfo ThemeInfoBuilder::Build() {\r
- ThemeInfo info("id", "0.1", "0.1", "title", "resolution", "preview", "desc");\r
+loader::ThemeInfo ThemeInfoBuilder::Build() {\r
+ loader::ThemeInfo info("id", "0.1", "0.1", "title", "resolution", "preview", "desc");\r
return info;\r
}\r
\r
ThemeInfoBuilder& SetResolution(std::string resolution);\r
ThemeInfoBuilder& PutExtra(std::string key, std::string value);\r
ThemeInfoBuilder& PutExtraArray(std::string key, std::string value[]);\r
- ThemeInfo Build();\r
+ loader::ThemeInfo Build();\r
\r
};\r
\r
\r
namespace ttm {\r
\r
-ThemeInfo ThemeParser::Inflate(std::string json) {\r
- ThemeInfo info("id", "0.1", "0.1", "title", "resolution", "preview", "desc");\r
+loader::ThemeInfo ThemeParser::Inflate(std::string json) {\r
+ loader::ThemeInfo info("id", "0.1", "0.1", "title", "resolution", "preview",\r
+ "desc");\r
return info;\r
}\r
\r
-int ThemeParser::Commit(ThemeOperation operation, const ThemeInfo& theme) {\r
+int ThemeParser::Commit(ThemeOperation operation,\r
+ const loader::ThemeInfo& theme) {\r
return 0;\r
}\r
\r
REMOVE\r
};\r
\r
- ThemeInfo Inflate(std::string json);\r
- int Commit(ThemeOperation operation, const ThemeInfo& theme);\r
+ loader::ThemeInfo Inflate(std::string json);\r
+ int Commit(ThemeOperation operation, const loader::ThemeInfo& theme);\r
};\r
\r
} // namespace ttm\r
namespace ttm {
+using namespace dbus;
+
tizen_base::Bundle ControlRequestHandler::OnRequest(Command cmd,
const tizen_base::Bundle& args) {
return {};
class ThemeInfoProxy;
-class ControlRequestHandler : public IRequestHandler {
+class ControlRequestHandler : public dbus::IRequestHandler {
public:
explicit ControlRequestHandler(std::shared_ptr<ThemeInfoProxy> proxy)
: IRequestHandler(), proxy_(proxy) { }
- tizen_base::Bundle OnRequest(Command cmd, const tizen_base::Bundle& args);
+ tizen_base::Bundle OnRequest(dbus::Command cmd, const tizen_base::Bundle& args);
private:
std::shared_ptr<ThemeInfoProxy> proxy_;
namespace ttm {
-tizen_base::Bundle PackageEventRequestHandler::OnRequest(Command cmd,
+tizen_base::Bundle PackageEventRequestHandler::OnRequest(dbus::Command cmd,
const tizen_base::Bundle& args) {
return {};
}
class ThemeInfoProxy;
-class PackageEventRequestHandler : public IRequestHandler {
+class PackageEventRequestHandler : public dbus::IRequestHandler {
public:
explicit PackageEventRequestHandler(std::shared_ptr<ThemeInfoProxy> proxy)
: IRequestHandler(), proxy_(proxy) { }
- tizen_base::Bundle OnRequest(Command cmd, const tizen_base::Bundle& args);
+ tizen_base::Bundle OnRequest(dbus::Command cmd, const tizen_base::Bundle& args);
private:
std::shared_ptr<ThemeInfoProxy> proxy_;
namespace ttm {
+using namespace dbus;
+
tizen_base::Bundle SelectionRequestHandler::OnRequest(Command cmd,
const tizen_base::Bundle& args) {
return {};
class ThemeInfoProxy;
-class SelectionRequestHandler : public IRequestHandler {
+class SelectionRequestHandler : public dbus::IRequestHandler {
public:
explicit SelectionRequestHandler(std::shared_ptr<ThemeInfoProxy> proxy)
: IRequestHandler(), proxy_(proxy) { }
- tizen_base::Bundle OnRequest(Command cmd, const tizen_base::Bundle& args);
+ tizen_base::Bundle OnRequest(dbus::Command cmd, const tizen_base::Bundle& args);
private:
std::shared_ptr<ThemeInfoProxy> proxy_;