2
0
forked from Ivasoft/DSView

Remove the letter of '@' from decode result

This commit is contained in:
dreamsourcelabTAI
2023-05-29 17:56:07 +08:00
parent ee0d88f91c
commit 939a7b1719
2 changed files with 34 additions and 19 deletions

View File

@@ -74,9 +74,11 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession *session) :
_stages_label = new QLabel(_widget);
_stages_label->setDisabled(true);
stages_comboBox = new DsComboBox(_widget);
for (int i = 1; i <= TriggerStages; i++)
for (int i = 1; i <= TriggerStages; i++){
stages_comboBox->addItem(QString::number(i));
//stages_comboBox->setCurrentIndex(stages_comboBox->count() - 1);
}
stages_comboBox->setDisabled(true);
_adv_tabWidget = new QTabWidget(_widget);
@@ -110,7 +112,6 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession *session) :
_widget->setLayout(layout);
this->setWidget(_widget);
//_widget->setGeometry(0, 0, sizeHint().width(), 1000);
_widget->setObjectName("triggerWidget");
retranslateUi();
@@ -148,21 +149,26 @@ void TriggerDock::retranslateUi()
"X: Don't care\n0: Low level\n1: High level\nR: Rising edge\nF: Falling edge\nC: Rising/Falling edge"));
_data_bits_label->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_DATA_BITS), "Data Bits"));
for (int i = 0; i < _inv_exp_label_list.length(); i++)
for (int i = 0; i < _inv_exp_label_list.length(); i++){
_inv_exp_label_list.at(i)->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_INV), "Inv"));
}
for (int i = 0; i < _count_exp_label_list.length(); i++)
for (int i = 0; i < _count_exp_label_list.length(); i++){
_count_exp_label_list.at(i)->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_COUNTER), "Counter"));
}
for (int i = 0; i < _contiguous_label_list.length(); i++)
for (int i = 0; i < _contiguous_label_list.length(); i++){
_contiguous_label_list.at(i)->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CONTIGUOUS), "Contiguous"));
}
for (int i = 0; i < _stage_groupBox_list.length(); i++)
for (int i = 0; i < _stage_groupBox_list.length(); i++){
_stage_groupBox_list.at(i)->setTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_STAGE), "Stage")+QString::number(i));
}
for (int i = 0; i < _stage_note_label_list.length(); i++)
for (int i = 0; i < _stage_note_label_list.length(); i++){
_stage_note_label_list.at(i)->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_SERIAL_NOTE_LABEL),
"X: Don't care\n0: Low level\n1: High level\nR: Rising edge\nF: Falling edge\nC: Rising/Falling edge"));
}
}
void TriggerDock::reStyle()
@@ -219,9 +225,11 @@ void TriggerDock::widget_enable(int index)
stages_comboBox->setDisabled(false);
_adv_tabWidget->setDisabled(false);
enable_stages = stages_comboBox->currentText().toInt();
for (int i = 0; i < enable_stages; i++) {
_stage_tabWidget->setTabEnabled(i, true);
}
for (int i = enable_stages; i < TriggerStages; i++) {
_stage_tabWidget->setTabEnabled(i, false);
}

View File

@@ -71,6 +71,7 @@ static int py_parse_ann_data(PyObject *list_obj, char ***out_strv, int list_size
int nstr;
char *up_ptr;
char c;
char *str_tmp;
gstate = PyGILState_Ensure();
@@ -130,27 +131,33 @@ static int py_parse_ann_data(PyObject *list_obj, char ***out_strv, int list_size
//check numberic field value
if (str[0]== '@'){
nstr = strlen(str) - 1;
if (nstr > 0 && nstr < DECODE_NUM_HEX_MAX_LEN){
strcpy(hex_str_buf, str + 1);
str[0] = '\n'; //set ignore flag
str[1] = 0;
}
//convert to upper
up_ptr = hex_str_buf;
//convert to upper
up_ptr = hex_str_buf;
while (*up_ptr)
{
c = *up_ptr;
while (*up_ptr)
{
c = *up_ptr;
if (c >= 'a' && c <= 'f'){
*up_ptr = c - 32;
if (c >= 'a' && c <= 'f'){
*up_ptr = c - 32;
}
up_ptr++;
}
up_ptr++;
}
else if (nstr > 0){
// Remove the first letter.
str_tmp = g_strdup(str+1);
free(str);
str = str_tmp;
}
}
strv[i] = str;