fix: The 'sample count' param can't restore from file

This commit is contained in:
dreamsourcelabTAI 2023-03-21 17:26:34 +08:00
parent a3b4525113
commit cec352ca8b
8 changed files with 35 additions and 17 deletions

View File

@ -999,7 +999,7 @@ bool ProtocolDock::protocol_sort_callback(const DecoderInfoItem *o1, const Decod
}
}
void ProtocolDock::ResetView()
void ProtocolDock::reset_view()
{
decoded_progress(0);
}

View File

@ -84,7 +84,7 @@ public:
void del_all_protocol();
bool add_protocol_by_id(QString id, bool silent, std::list<pv::data::decode::Decoder*> &sub_decoders);
void ResetView();
void reset_view();
private:
void changeEvent(QEvent *event);

View File

@ -90,6 +90,7 @@ public:
#define DSV_MSG_TRIG_NEXT_COLLECT 7001
#define DSV_MSG_SAVE_COMPLETE 7002
#define DSV_MSG_STORE_CONF_PREV 7003
#define DSV_MSG_CLEAR_DECODE_DATA 8001

View File

@ -1005,7 +1005,7 @@ namespace pv
}
// update UI settings
_sampling_bar->update_sample_rate_selector();
_sampling_bar->update_sample_rate_list();
_trigger_widget->device_updated();
_view->header_updated();
@ -1691,7 +1691,7 @@ namespace pv
break;
case DSV_MSG_DEVICE_MODE_CHANGED:
_sampling_bar->update_sample_rate_selector();
_sampling_bar->update_sample_rate_list();
_view->mode_changed();
reset_all_view();
load_device_config();
@ -1759,7 +1759,13 @@ namespace pv
break;
case DSV_MSG_CLEAR_DECODE_DATA:
_protocol_widget->ResetView();
_protocol_widget->reset_view();
break;
case DSV_MSG_STORE_CONF_PREV:
if (_device_agent->is_hardware() && _session->have_hardware_data() == false){
_sampling_bar->commit_settings();
}
break;
}
}

View File

@ -32,6 +32,7 @@
#include "../ui/langresource.h"
#include "../log.h"
#include "../interface/icallbacks.h"
namespace pv {
namespace toolbars {
@ -104,8 +105,6 @@ void FileBar::changeEvent(QEvent *event)
QToolBar::changeEvent(event);
}
void FileBar::retranslateUi()
{
_file_button.setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_FILEBAR_FILE), "File"));
@ -223,6 +222,8 @@ void FileBar::on_actionStore_triggered()
app._userHistory.sessionDir = fname;
app.SaveHistory();
}
_session->broadcast_msg(DSV_MSG_STORE_CONF_PREV);
sig_store_session(file_name);
}

View File

@ -273,7 +273,7 @@ namespace pv
{
_session->broadcast_msg(DSV_MSG_DEVICE_OPTIONS_UPDATED);
update_sample_rate_selector();
update_sample_rate_list();
int mode = _device_agent->get_work_mode();
GVariant *gvar;
@ -634,7 +634,8 @@ namespace pv
{
for (int i = 0; i < _sample_count.count(); i++)
{
if (pre_duration >= _sample_count.itemData(i).value<double>())
double sel_val = _sample_count.itemData(i).value<double>();
if (pre_duration >= sel_val)
{
_sample_count.setCurrentIndex(i);
break;
@ -690,11 +691,13 @@ namespace pv
assert(!_updating_sample_count);
_updating_sample_count = true;
if (duration != _sample_count.itemData(_sample_count.currentIndex()).value<double>())
double cur_duration = _sample_count.itemData(_sample_count.currentIndex()).value<double>();
if (duration != cur_duration)
{
for (int i = 0; i < _sample_count.count(); i++)
{
if (duration >= _sample_count.itemData(i).value<double>())
double sel_val = _sample_count.itemData(i).value<double>();
if (duration >= sel_val)
{
_sample_count.setCurrentIndex(i);
break;
@ -1132,7 +1135,7 @@ namespace pv
_device_selector.setCurrentIndex(select_index);
if (cur_dev_handle != _last_device_handle){
update_sample_rate_selector();
update_sample_rate_list();
_last_device_handle = cur_dev_handle;
}

View File

@ -84,7 +84,6 @@ namespace pv
void update_view_status();
void config_device();
ds_device_handle get_next_device_handle();
void update_sample_rate_selector();
inline void set_view(view::View *view){
_view = view;
@ -94,6 +93,13 @@ namespace pv
void run_or_stop_instant();
inline void update_sample_rate_list()
{
update_sample_rate_selector();
}
void commit_settings();
signals:
void sig_store_session_data();
@ -103,11 +109,12 @@ namespace pv
void reStyle();
void set_sample_rate(uint64_t sample_rate);
double commit_hori_res();
void update_sample_rate_selector();
void update_sample_rate_selector_value();
void update_sample_count_selector();
void update_sample_count_selector_value();
void commit_settings();
void update_sample_count_selector_value();
void setting_adj();
void enable_toggle(bool enable);
void update_mode_icon();

View File

@ -48,8 +48,8 @@ static struct sr_config_info sr_config_info_data[] = {
{SR_CONF_CONN, SR_T_CHAR, "Connection"},
{SR_CONF_SERIALCOMM, SR_T_CHAR,"Serial communication"},
{SR_CONF_SAMPLERATE, SR_T_UINT64,"Sample rate"},
{SR_CONF_LIMIT_SAMPLES, SR_T_UINT64,"Sample depth"},
{SR_CONF_ACTUAL_SAMPLES, SR_T_UINT64,"Sample count"},
{SR_CONF_LIMIT_SAMPLES, SR_T_UINT64,"Sample count"},
{SR_CONF_ACTUAL_SAMPLES, SR_T_UINT64,"Sample count-actual"},
{SR_CONF_CLOCK_TYPE, SR_T_BOOL,"Using External Clock"},
{SR_CONF_CLOCK_EDGE, SR_T_BOOL, "Using Clock Negedge"},
{SR_CONF_CAPTURE_RATIO, SR_T_UINT64,"Pre-trigger capture ratio"},