From 37e2f03cc53656ea120e05c1f285679e0b4d7ee5 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Tue, 2 Apr 2024 11:21:22 +0800 Subject: [PATCH] When saving data, if there is no data within the specified range, a warning will be prompted --- DSView/pv/dialogs/storeprogress.cpp | 12 +++++++++++- lang/cn/msg.json | 4 ++++ lang/en/msg.json | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/DSView/pv/dialogs/storeprogress.cpp b/DSView/pv/dialogs/storeprogress.cpp index 6ab9a052..285333b0 100644 --- a/DSView/pv/dialogs/storeprogress.cpp +++ b/DSView/pv/dialogs/storeprogress.cpp @@ -192,7 +192,17 @@ void StoreProgress::accept() MsgBox::Show(mStr); return; } - else if (start_index > end_index){ + + int total_count = _view->session().get_ring_sample_count(); + + if (start_index > total_count && end_index > total_count) + { + QString mStr = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_DATA_RANGE_HAVE_NO_DATA), "No data in the data range"); + MsgBox::Show(mStr); + return; + } + + if (start_index > end_index){ uint64_t tmp = start_index; start_index = end_index; end_index = tmp; diff --git a/lang/cn/msg.json b/lang/cn/msg.json index 8d0c1ef6..dcb0ab25 100644 --- a/lang/cn/msg.json +++ b/lang/cn/msg.json @@ -381,5 +381,9 @@ { "id": "IDS_MSG_DATA_RANGE_ERROR", "text": "数据范围设置错误!" + }, + { + "id": "IDS_MSG_DATA_RANGE_HAVE_NO_DATA", + "text": "数据范围内无数据!" } ] diff --git a/lang/en/msg.json b/lang/en/msg.json index b4eb92e0..28ea8fd7 100644 --- a/lang/en/msg.json +++ b/lang/en/msg.json @@ -382,5 +382,9 @@ { "id": "IDS_MSG_DATA_RANGE_ERROR", "text": "Data range is error!" + }, + { + "id": "IDS_MSG_DATA_RANGE_HAVE_NO_DATA", + "text": "No data in the data range!" } ]