ProjectBuildSettings.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. //
  2. // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include <Atomic/Core/Object.h>
  24. #include <Atomic/Resource/JSONValue.h>
  25. using namespace Atomic;
  26. namespace ToolCore
  27. {
  28. class MacBuildSettings : public RefCounted
  29. {
  30. ATOMIC_REFCOUNTED(MacBuildSettings)
  31. public:
  32. MacBuildSettings() {}
  33. const String& GetAppName() const { return appName_; }
  34. const String& GetPackageName() const { return packageName_; }
  35. const String& GetCompanyName() const { return companyName_; }
  36. const String& GetProductName() const { return productName_; }
  37. void SetAppName(const String& name) { appName_ = name; }
  38. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  39. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  40. void SetProductName(const String& productName) { productName_ = productName; }
  41. void Write(JSONValue& parent);
  42. void Read(JSONValue& parent);
  43. private:
  44. String appName_;
  45. String packageName_;
  46. String companyName_;
  47. String productName_;
  48. };
  49. class WebBuildSettings : public RefCounted
  50. {
  51. ATOMIC_REFCOUNTED(WebBuildSettings)
  52. public:
  53. WebBuildSettings() {}
  54. const String& GetAppName() const { return appName_; }
  55. const String& GetGameWidth() const { return gameWidth_; }
  56. const String& GetGameHeight() const { return gameHeight_; }
  57. const String& GetFaviconName() const { return faviconName_; }
  58. int GetPageTheme() const { return pageTheme_; }
  59. void SetAppName(const String& name) { appName_ = name; }
  60. void SetGameWidth(const String& packageName) { gameWidth_ = packageName; }
  61. void SetGameHeight(const String& companyName) { gameHeight_ = companyName; }
  62. void SetFaviconName(const String& productName) { faviconName_ = productName; }
  63. void SetPageTheme( int number ) { pageTheme_ = number; }
  64. void Write(JSONValue& parent);
  65. void Read(JSONValue& parent);
  66. private:
  67. String appName_;
  68. String gameWidth_;
  69. String gameHeight_;
  70. String faviconName_;
  71. int pageTheme_;
  72. };
  73. class WindowsBuildSettings : public RefCounted
  74. {
  75. ATOMIC_REFCOUNTED(WindowsBuildSettings)
  76. public:
  77. WindowsBuildSettings() {}
  78. const String& GetAppName() const { return appName_; }
  79. const String& GetPackageName() const { return packageName_; }
  80. const String& GetCompanyName() const { return companyName_; }
  81. const String& GetProductName() const { return productName_; }
  82. void SetAppName(const String& name) { appName_ = name; }
  83. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  84. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  85. void SetProductName(const String& productName) { productName_ = productName; }
  86. void Write(JSONValue& parent);
  87. void Read(JSONValue& parent);
  88. private:
  89. String appName_;
  90. String packageName_;
  91. String companyName_;
  92. String productName_;
  93. };
  94. class AndroidBuildSettings : public RefCounted
  95. {
  96. ATOMIC_REFCOUNTED(AndroidBuildSettings)
  97. public:
  98. AndroidBuildSettings() {}
  99. const String& GetAppName() const { return appName_; }
  100. const String& GetPackageName() const { return packageName_; }
  101. const String& GetCompanyName() const { return companyName_; }
  102. const String& GetProductName() const { return productName_; }
  103. const String& GetSDKVersion() const { return targetSDKVersion_; }
  104. const String& GetMinSDKVersion() const { return minSDKVersion_; }
  105. const String& GetActivityName() const { return activityName_; }
  106. const String& GetIconPath() const { return iconPath_; }
  107. void SetAppName(const String& name) { appName_ = name; }
  108. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  109. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  110. void SetProductName(const String& productName) { productName_ = productName; }
  111. void SetSDKVersion(const String& value) { targetSDKVersion_ = value; }
  112. void SetMinSDKVersion(const String& value) { minSDKVersion_ = value; }
  113. void SetActivityName(const String& value) { activityName_ = value; }
  114. void SetIconPath(const String& value) { iconPath_ = value; }
  115. void Write(JSONValue& parent);
  116. void Read(JSONValue& parent);
  117. private:
  118. String appName_;
  119. String packageName_;
  120. String companyName_;
  121. String productName_;
  122. String targetSDKVersion_;
  123. String minSDKVersion_;
  124. String activityName_;
  125. String iconPath_;
  126. };
  127. class IOSBuildSettings : public RefCounted
  128. {
  129. ATOMIC_REFCOUNTED(IOSBuildSettings)
  130. public:
  131. IOSBuildSettings() {}
  132. const String& GetAppName() const { return appName_; }
  133. const String& GetPackageName() const { return packageName_; }
  134. const String& GetCompanyName() const { return companyName_; }
  135. const String& GetProductName() const { return productName_; }
  136. const String& GetProvisionFile() const { return provisionFile_; }
  137. const String& GetAppIDPrefix() const { return appidPrefix_; }
  138. void SetAppName(const String& name) { appName_ = name; }
  139. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  140. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  141. void SetProductName(const String& productName) { productName_ = productName; }
  142. void SetProvisionFile(const String& value) { provisionFile_ = value; }
  143. void SetAppIDPrefix(const String& value) { appidPrefix_ = value; }
  144. void Write(JSONValue& parent);
  145. void Read(JSONValue& parent);
  146. private:
  147. String appName_;
  148. String packageName_;
  149. String companyName_;
  150. String productName_;
  151. String provisionFile_;
  152. String appidPrefix_;
  153. };
  154. class LinuxBuildSettings : public RefCounted
  155. {
  156. ATOMIC_REFCOUNTED(LinuxBuildSettings)
  157. public:
  158. LinuxBuildSettings() {}
  159. const String& GetAppName() const { return appName_; }
  160. const String& GetPackageName() const { return packageName_; }
  161. const String& GetCompanyName() const { return companyName_; }
  162. const String& GetProductName() const { return productName_; }
  163. void SetAppName(const String& name) { appName_ = name; }
  164. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  165. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  166. void SetProductName(const String& productName) { productName_ = productName; }
  167. void Write(JSONValue& parent);
  168. void Read(JSONValue& parent);
  169. private:
  170. String appName_;
  171. String packageName_;
  172. String companyName_;
  173. String productName_;
  174. };
  175. class ProjectBuildSettings : public Object
  176. {
  177. ATOMIC_OBJECT(ProjectBuildSettings, Object);
  178. public:
  179. /// Construct.
  180. ProjectBuildSettings(Context* context);
  181. /// Destruct.
  182. virtual ~ProjectBuildSettings();
  183. MacBuildSettings* GetMacBuildSettings() { return macBuildSettings_; }
  184. WindowsBuildSettings* GetWindowsBuildSettings() { return windowsBuildSettings_; }
  185. WebBuildSettings* GetWebBuildSettings() { return webBuildSettings_; }
  186. AndroidBuildSettings* GetAndroidBuildSettings() { return androidBuildSettings_; }
  187. IOSBuildSettings* GetIOSBuildSettings() { return iosBuildSettings_; }
  188. LinuxBuildSettings* GetLinuxBuildSettings() { return linuxBuildSettings_; }
  189. bool Load(const String& path);
  190. void Save(const String& path);
  191. private:
  192. SharedPtr<MacBuildSettings> macBuildSettings_;
  193. SharedPtr<WindowsBuildSettings> windowsBuildSettings_;
  194. SharedPtr<WebBuildSettings> webBuildSettings_;
  195. SharedPtr<AndroidBuildSettings> androidBuildSettings_;
  196. SharedPtr<IOSBuildSettings> iosBuildSettings_;
  197. SharedPtr<LinuxBuildSettings> linuxBuildSettings_;
  198. };
  199. }