Merge #566 into sdk602patch0626 from refs/changes/566/head 568/target/1
author罗正 <1732036298@qq.com>
Sat, 20 Jul 2024 10:41:58 +0000 (10:41 +0000)
committersnickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Sat, 20 Jul 2024 10:41:58 +0000 (10:41 +0000)
Code review from 罗正

* refs/changes/566/head: (8 commits squashed)

  - 添加滑动关机和重启功能:
    恢复出厂设置未加
    目前是长按才是滑动关机和重启

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - 滑动关机和重启添加恢复出厂设置功能

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - 滑动关机和重启界面多国语言修改

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - QRcode 添加版本号,title改为设别名

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

Signed-off-by: 罗正 <1732036298@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Merged-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/566
code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodeView.cpp

index 2985642..02f0000 100644 (file)
@@ -3,6 +3,8 @@
 #include "wearable_log.h"
 #include "custom_utils.h"
 #include "language/font/ui_resource_string.h"
+#include "iostream"
+#include "string"
 namespace OHOS
 {
 
@@ -17,7 +19,6 @@ namespace OHOS
     WatchQRCodeView::~WatchQRCodeView()
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::~WatchQRCodeView");
-        ClearAll();
         g_pWatchQRCodePresenter = nullptr;
     }
 
@@ -58,6 +59,13 @@ namespace OHOS
         }
     }
 
+    extern "C"
+    {
+#include "build_version.h"
+
+        const char *get_version_string(void);
+    }
+
     bool WatchQRCodeView::WatchQRCodeInitViewGroup(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::WatchQRCodeInitViewGroup");
@@ -91,7 +99,7 @@ namespace OHOS
             return false;
         }
         Watch_QR_Code_View->SetPosition(93, 100, 280, 280);
-        Watch_QR_Code_View->SetECCLevel(QrCode::Ecc::LOW);/*QR 码的 ECC(Error Correction Code ,错误纠正码)级别表示二维码的纠错能力或容错率*/
+        Watch_QR_Code_View->SetECCLevel(QrCode::Ecc::LOW); /*QR 码的 ECC(Error Correction Code ,错误纠正码)级别表示二维码的纠错能力或容错率*/
         Watch_QR_Code_View->SetAutoEnable(false);
         Watch_QR_Code_View->SetResizeMode(UIImageView::ImageResizeMode::CENTER);
         std::string str = WatchQRCodePresenter::GetInstance()->WatchQRCodeGetQRCodeStr();
@@ -112,7 +120,11 @@ namespace OHOS
         TitleLabel->SetPosition(83, 50, 300, 35);
         TitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
         TitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
-        TitleLabel->SetTextId(STR_SCANNING_BINDING);
+        uint8_t ble_name[30] = {0};
+        uint32_t ble_name_len = sizeof(ble_name);
+        errcode_t ret = uapi_get_nv_btname(ble_name, &ble_name_len);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get btname %s ,ret 0x%X\n", ble_name, ret);
+        TitleLabel->SetText((char *)ble_name);
         TitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         TitleLabel->SetRollSpeed(70);
         TitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
@@ -125,12 +137,9 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::DeviceNameLabel new label fail");
             return false;
         }
-
-        uint8_t ble_name[30] = {0};
-        uint32_t ble_name_len = sizeof(ble_name);
-        errcode_t ret = uapi_get_nv_btname(ble_name, &ble_name_len);
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get btname %s ,ret 0x%X\n", ble_name, ret);
-        DeviceNameLabel->SetText((char *)ble_name);
+        std::string temp = get_version_string();
+        std::string version_string = "V" + temp;
+        DeviceNameLabel->SetText(version_string.c_str());
         DeviceNameLabel->SetPosition(83, 402, 300, 35);
         DeviceNameLabel->SetStyle(STYLE_TEXT_FONT, 30);
         DeviceNameLabel->SetStyle(STYLE_LINE_HEIGHT, 35);