优化json目录,更加方便json文件更新与配置:烧录目录:/user/res/clocks/dialconfig/
authorCaisking <3449750381@qq.com>
Sat, 20 Jan 2024 07:45:10 +0000 (15:45 +0800)
committerCaisking <3449750381@qq.com>
Sat, 20 Jan 2024 07:45:10 +0000 (15:45 +0800)
code/sdk/application/wearable/nativeapp/nativeui/dial/include/Digital_clockView.h
code/sdk/application/wearable/nativeapp/nativeui/dial/src/DialPresenter.cpp
code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp
code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/dialconfig/KUMI.json [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/KUMI.json with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/dialconfig/default.json [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/default.json with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/dialconfig/flowerbud.json [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/flowerbud.json with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/dialconfig/maliao.json [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/maliao.json with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/dialconfig/maomao.json [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/maomao.json with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/dialconfig/momo.json [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clocks/momo.json with 100% similarity]

index 880bd35..d5b4d55 100644 (file)
@@ -297,7 +297,7 @@ namespace OHOS
         const char **imagePaths;
         std::string digitspath;
         std::string stringtime;
-        std::string JosnfilePath = "/user/res/clocks/default.json";
+        std::string JosnfilePath = "/user/res/clocks/dialconfig/default.json";
     };
 } // namespace OHOS
 #endif // Digital_clock_PRESENTER_H
index 5ffd7f6..f125fa5 100644 (file)
@@ -97,35 +97,35 @@ namespace OHOS
         if (strcmp(view.GetViewId(), "kumibutton") == 0)\r
         {\r
             // printf("join click\n");\r
-            const std::string jsonPath = "/user/res/clocks/KUMI.json";\r
+            const std::string jsonPath = "/user/res/clocks/dialconfig/KUMI.json";\r
             g_pDigital_clockView->setJsonFilePath(jsonPath);\r
             NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE);\r
         }\r
         if (strcmp(view.GetViewId(), "flowerbudbutton") == 0)\r
         {\r
             // printf("join click\n");\r
-            const std::string jsonPath = "/user/res/clocks/flowerbud.json";\r
+            const std::string jsonPath = "/user/res/clocks/dialconfig/flowerbud.json";\r
             g_pDigital_clockView->setJsonFilePath(jsonPath);\r
             NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE);\r
         }\r
         if (strcmp(view.GetViewId(), "maomaobutton") == 0)\r
         {\r
             // printf("join click\n");\r
-            const std::string jsonPath = "/user/res/clocks/maomao.json";\r
+            const std::string jsonPath = "/user/res/clocks/dialconfig/maomao.json";\r
             g_pDigital_clockView->setJsonFilePath(jsonPath);\r
             NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE);\r
         }\r
         if (strcmp(view.GetViewId(), "momobutton") == 0)\r
         {\r
             // printf("join click\n");\r
-            const std::string jsonPath = "/user/res/clocks/momo.json";\r
+            const std::string jsonPath = "/user/res/clocks/dialconfig/momo.json";\r
             g_pDigital_clockView->setJsonFilePath(jsonPath);\r
             NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE);\r
         }\r
         if (strcmp(view.GetViewId(), "maliaobutton") == 0)\r
         {\r
             // printf("join click\n");\r
-            const std::string jsonPath = "/user/res/clocks/maliao.json";\r
+            const std::string jsonPath = "/user/res/clocks/dialconfig/maliao.json";\r
             g_pDigital_clockView->setJsonFilePath(jsonPath);\r
             NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE);\r
         }\r
index 7f35ff5..528659b 100644 (file)
@@ -46,7 +46,7 @@ namespace OHOS
      */
     void Digital_clockView::setJsonFilePath(const std::string &filePath)
     {
-        std::string defaultFile = "/user/res/clocks/default.json";
+        std::string defaultFile = "/user/res/clocks/dialconfig/default.json";
         std::ifstream sourceFile(filePath, std::ios::binary);                      // 打开源文件
         std::ofstream targetFile(defaultFile, std::ios::binary | std::ios::trunc); // 打开目标文件,使用trunc标志来覆盖目标文件
         //("%s|%s\n", defaultFile.c_str(), filePath.c_str());                  // 使用c_str()将std::string转换为C风格字符串