From 947aae271c3c736fc7986e11fa5486e9f111e46b Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Sat, 20 Jul 2024 10:41:58 +0000 Subject: [PATCH] Merge #566 into sdk602patch0626 from refs/changes/566/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/566/head: (8 commits squashed) - 添加滑动关机和重启功能: 恢复出厂设置未加 目前是长按才是滑动关机和重启 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 滑动关机和重启添加恢复出厂设置功能 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 滑动关机和重启界面多国语言修改 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - QRcode 添加版本号,title改为设别名 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/566 --- .../watchQRcode/src/WatchQRCodeView.cpp | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodeView.cpp index 2985642a9..02f000086 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodeView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodeView.cpp @@ -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); -- 2.17.1