mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +08:00
Merge remote-tracking branch 'source/dev-1.3' into demo
This commit is contained in:
commit
f7a1275e58
@ -87,9 +87,17 @@ Annotation::Annotation(const srd_proto_data *const pdata, DecoderStatus *status)
|
||||
|
||||
//get numeric data
|
||||
if (pda->str_number_hex[0]){
|
||||
int str_len = strlen(pda->str_number_hex);
|
||||
|
||||
if (str_len <= DECODER_MAX_DATA_BLOCK_LEN){
|
||||
resItem->str_number_hex = (char*)malloc(str_len + 1);
|
||||
|
||||
if (resItem->str_number_hex != NULL){
|
||||
strcpy(resItem->str_number_hex, pda->str_number_hex);
|
||||
resItem->is_numeric = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_status->m_bNumeric |= resItem->is_numeric;
|
||||
}
|
||||
|
@ -117,6 +117,7 @@ int AnnotationResTable::MakeIndex(const std::string &key, AnnotationSourceItem*
|
||||
|
||||
item->cur_display_format = -1;
|
||||
item->is_numeric = false;
|
||||
item->str_number_hex = NULL;
|
||||
newItem = item;
|
||||
|
||||
int dex = m_indexs.size();
|
||||
@ -331,6 +332,8 @@ void AnnotationResTable::reset()
|
||||
{
|
||||
//release all resource
|
||||
for (auto p : m_resourceTable){
|
||||
if (p->str_number_hex)
|
||||
free(p->str_number_hex);
|
||||
delete p;
|
||||
}
|
||||
m_resourceTable.clear();
|
||||
|
@ -26,14 +26,14 @@
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
|
||||
#define DECODER_MAX_DATA_BLOCK_LEN 35
|
||||
#define DECODER_MAX_DATA_BLOCK_LEN 256
|
||||
#define CONVERT_STR_MAX_LEN 150
|
||||
|
||||
struct AnnotationSourceItem
|
||||
{
|
||||
bool is_numeric;
|
||||
char str_number_hex[DECODER_MAX_DATA_BLOCK_LEN]; //numerical value hex format string
|
||||
long long numberic_value;
|
||||
char *str_number_hex; //numerical value hex format string
|
||||
|
||||
std::vector<QString> src_lines; //the origin source string lines
|
||||
std::vector<QString> cvt_lines; //the converted to bin/hex/oct format string lines
|
||||
int cur_display_format; //current format as bin/ex/oct..., init with -1
|
||||
|
@ -29,10 +29,8 @@ namespace pv
|
||||
namespace dialogs
|
||||
{
|
||||
|
||||
class ApplicationParamDlg : public QObject
|
||||
class ApplicationParamDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ApplicationParamDlg();
|
||||
~ApplicationParamDlg();
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "../sigsession.h"
|
||||
#include "../ui/langresource.h"
|
||||
#include "../log.h"
|
||||
#include <QDebug>
|
||||
#include "../ui/msgbox.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
@ -578,14 +578,9 @@ void DeviceOptions::channel_checkbox_clicked(QCheckBox *sc)
|
||||
int vld_ch_num = g_variant_get_int16(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (cur_ch_num > vld_ch_num) {
|
||||
dialogs::DSMessageBox msg(this);
|
||||
msg.mBox()->setText(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_INFORMATION), "Information"));
|
||||
msg.mBox()->setInformativeText(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_MAX_CHANNEL), "Current mode only suppport max ")
|
||||
+ QString::number(vld_ch_num)
|
||||
+ L_S(STR_PAGE_MSG, S_ID(IDS_MSG_CHANNEL), " channels!"));
|
||||
msg.mBox()->addButton(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_OK), "Ok"), QMessageBox::AcceptRole);
|
||||
msg.mBox()->setIcon(QMessageBox::Information);
|
||||
msg.exec();
|
||||
QString msg_str(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_MAX_CHANNEL_COUNT_WARNING), "max count of channels!"));
|
||||
msg_str = msg_str.replace("{0}", QString::number(vld_ch_num) );
|
||||
MsgBox::Show("", msg_str);
|
||||
|
||||
sc->setChecked(false);
|
||||
}
|
||||
|
@ -43,9 +43,7 @@
|
||||
#include <QJsonValue>
|
||||
#include <QJsonArray>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
@ -517,21 +515,30 @@ namespace pv
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
QString default_name = app._userHistory.screenShotPath + "/" + APP_NAME + QDateTime::currentDateTime().toString("-yyMMdd-hhmmss");
|
||||
|
||||
#ifdef _WIN32
|
||||
int x = parentWidget()->pos().x();
|
||||
int y = parentWidget()->pos().y();
|
||||
int w = parentWidget()->frameGeometry().width();
|
||||
int h = parentWidget()->frameGeometry().height();
|
||||
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
int curMonitor = desktop->screenNumber(this);
|
||||
|
||||
#ifdef _WIN32
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QPixmap pixmap = QGuiApplication::primaryScreen()->grabWindow(desktop->winId(), x, y, w, h);
|
||||
#else
|
||||
QPixmap pixmap = QPixmap::grabWidget(parentWidget());
|
||||
#endif
|
||||
|
||||
#elif __APPLE__
|
||||
int x = parentWidget()->pos().x() + MainFrame::Margin;
|
||||
int y = parentWidget()->pos().y() + MainFrame::Margin;
|
||||
int w = parentWidget()->geometry().width() - MainFrame::Margin * 2;
|
||||
int h = parentWidget()->geometry().height() - MainFrame::Margin * 2;
|
||||
QPixmap pixmap = QGuiApplication::primaryScreen()->grabWindow(winId(), x, y, w, h);
|
||||
x += MainFrame::Margin;
|
||||
y += MainFrame::Margin;
|
||||
w -= MainFrame::Margin * 2;
|
||||
h -= MainFrame::Margin * 2;
|
||||
QPixmap pixmap = QGuiApplication::screens().at(curMonitor)->grabWindow(winId(), x, y, w, h);
|
||||
|
||||
#else
|
||||
QPixmap pixmap = QGuiApplication::primaryScreen()->grabWindow(winId());
|
||||
QPixmap pixmap = QGuiApplication::screens().at(curMonitor)->grabWindow(winId());
|
||||
#endif
|
||||
|
||||
QString format = "png";
|
||||
@ -1705,12 +1712,10 @@ namespace pv
|
||||
break;
|
||||
|
||||
case DSV_MSG_COLLECT_END:
|
||||
dsv_info("Mainwindow:DSV_MSG_COLLECT_END");
|
||||
prgRate(0);
|
||||
_view->repeat_unshow();
|
||||
_view->on_state_changed(true);
|
||||
_protocol_widget->update_view_status();
|
||||
dsv_info("Mainwindow-end:DSV_MSG_COLLECT_END");
|
||||
break;
|
||||
|
||||
case DSV_MSG_END_COLLECT_WORK:
|
||||
@ -1779,7 +1784,7 @@ namespace pv
|
||||
{
|
||||
_view->auto_set_max_scale();
|
||||
|
||||
if(_pattern_mode != "random")
|
||||
if(_pattern_mode != "random" && _device_agent->path() != "")
|
||||
{
|
||||
StoreSession ss(_session);
|
||||
QJsonArray deArray = get_decoder_json_from_file(_device_agent->path());
|
||||
|
@ -576,7 +576,8 @@ namespace pv
|
||||
|
||||
if (_device_agent.have_enabled_channel() == false)
|
||||
{
|
||||
_callback->show_error("No probes enabled.");
|
||||
QString err_str(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_NO_ENABLED_CHANNEL), "No channels enabled!"));
|
||||
_callback->show_error(err_str);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -383,10 +383,12 @@ void DecodeTrace::draw_annotation(const pv::data::decode::Annotation &a,
|
||||
((type%100 != a.type()%100) && (type%100 != 0)))
|
||||
continue;
|
||||
|
||||
const double mark_end = a.end_sample() / samples_per_pixel - pixels_offset;
|
||||
|
||||
for(auto s : _session->get_signals()) {
|
||||
if((s->get_index() == iter.second) && s->signal_type() == LOGIC_SIGNAL) {
|
||||
view::LogicSignal *logicSig = (view::LogicSignal*)s;
|
||||
logicSig->paint_mark(p, start, end, type/100);
|
||||
logicSig->paint_mark(p, start, mark_end, type/100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_A_CAL_START",
|
||||
"text": "自动校准程序将启动。不要连接任何探头。这可能需要一段时间!"
|
||||
"text": "自动校准程序将启动。不要连接任何探头。这可能需要一段时间!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_A_CAL",
|
||||
@ -56,11 +56,11 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_RE_WIN_ST_ER",
|
||||
"text": " 还原窗口状态错误!"
|
||||
"text": "还原窗口状态错误!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_INVAILD_CURSOR",
|
||||
"text": " 样本范围的游标索引无效!"
|
||||
"text": "样本范围的游标索引无效!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_SEL_FILENAME",
|
||||
@ -104,15 +104,11 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_ALL_CHANNEL_DISABLE",
|
||||
"text": " 所有频道已禁用请至少启用一个通道"
|
||||
"text": "所有通道已禁用,请至少启用一个通道!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_MAX_CHANNEL",
|
||||
"text": "当前模式仅支持最大"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_CHANNEL",
|
||||
"text": " 频道数!"
|
||||
"id": "IDS_MSG_MAX_CHANNEL_COUNT_WARNING",
|
||||
"text": "当前模式仅支持最大 {0}\n通道数!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_TRI_SET_ISSUE",
|
||||
@ -132,7 +128,7 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_CHANGE_SOURCE_FAIL",
|
||||
"text": " 更改触发源失败!"
|
||||
"text": "更改触发源失败!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_CHANGE_CHANNEL_FAIL",
|
||||
@ -176,7 +172,7 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_AD_TRIGGER_NEED_HARDWARE",
|
||||
"text": " 高级触发模式需要DSLogic硬件支持!"
|
||||
"text": "高级触发模式需要DSLogic硬件支持!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_SET_TRI_MULTI_CHANNEL",
|
||||
@ -217,7 +213,7 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_MALLOC_ERROR_DET",
|
||||
"text": " 内存不足,无法容纳此样本!\n请降低采样深度!"
|
||||
"text": "内存不足,无法容纳此样本!\n请降低采样深度!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DATA_ERROR",
|
||||
@ -225,7 +221,7 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_DATA_ERROR_DET1",
|
||||
"text": " 接收的数据与预定义的测试数据不一致!"
|
||||
"text": "接收的数据与预定义的测试数据不一致!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DATA_ERROR_DET2",
|
||||
@ -237,7 +233,7 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_PACKET_ERROR_DET",
|
||||
"text": " 接收到的数据包的内容不是预期的 !"
|
||||
"text": "接收到的数据包的内容不是预期的 !"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_DATA_OVERFLOW",
|
||||
@ -245,7 +241,7 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_DATA_OVERFLOW_DET",
|
||||
"text": " USB带宽无法支持当前采样率 ! \n请降低采样深度!"
|
||||
"text": "USB带宽无法支持当前采样率 ! \n请降低采样深度!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_UNDEFINED_ERROR",
|
||||
@ -257,7 +253,7 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_STORESESS_SAVESTART_ERROR1",
|
||||
"text": " DSView当前不支持\n多数据类型的文件保存."
|
||||
"text": "DSView当前不支持\n多数据类型的文件保存."
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_STORESESS_SAVESTART_ERROR2",
|
||||
@ -269,7 +265,7 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_STORESESS_SAVESTART_ERROR4",
|
||||
"text": " 生成临时文件数据失败."
|
||||
"text": "生成临时文件数据失败."
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_STORESESS_SAVESTART_ERROR5",
|
||||
@ -369,6 +365,10 @@
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_DEVICE_BUSY_SWITCH_FAILED",
|
||||
"text": "设置在使用中,切换失败!"
|
||||
"text": "设备在使用中,切换失败!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_NO_ENABLED_CHANNEL",
|
||||
"text": "未启用通道!"
|
||||
}
|
||||
]
|
@ -108,12 +108,8 @@
|
||||
"text": "All channel disabled! Please enable at least one channel."
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_MAX_CHANNEL",
|
||||
"text": "Current mode only suppport max "
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_CHANNEL",
|
||||
"text": " channels!"
|
||||
"id": "IDS_MSG_MAX_CHANNEL_COUNT_WARNING",
|
||||
"text": "Current mode only suppport max {0}\nchannels!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_TRI_SET_ISSUE",
|
||||
@ -371,5 +367,9 @@
|
||||
{
|
||||
"id": "IDS_MSG_DEVICE_BUSY_SWITCH_FAILED",
|
||||
"text": "The device is busy,switch failed!"
|
||||
},
|
||||
{
|
||||
"id": "IDS_MSG_NO_ENABLED_CHANNEL",
|
||||
"text": "No channels enabled!"
|
||||
}
|
||||
]
|
@ -239,7 +239,7 @@ static void get_pattern_mode_from_file(uint8_t device_mode)
|
||||
dir = g_dir_open(dir_str,0,NULL);
|
||||
if(dir == NULL)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((filename = g_dir_read_name(dir)) != NULL)
|
||||
@ -270,6 +270,8 @@ static void get_pattern_mode_from_file(uint8_t device_mode)
|
||||
pattern_dso_count = index;
|
||||
else if(device_mode == ANALOG)
|
||||
pattern_analog_count = index;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void scan_dsl_file(struct sr_dev_inst *sdi)
|
||||
@ -438,7 +440,7 @@ static void init_random_data(struct session_vdev * vdev,struct sr_dev_inst *sdi)
|
||||
probe_count[cur_probe] -= 1;
|
||||
}
|
||||
}
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -463,7 +465,7 @@ static GSList *hw_scan(GSList *options)
|
||||
if (vdev == NULL)
|
||||
{
|
||||
sr_err("%s: sdi->priv malloc failed", __func__);
|
||||
return SR_ERR_MALLOC;
|
||||
return devices;
|
||||
}
|
||||
|
||||
sdi = sr_dev_inst_new(LOGIC, SR_ST_INACTIVE,
|
||||
|
@ -136,7 +136,7 @@ struct DEMO_caps {
|
||||
const uint64_t *vdivs;
|
||||
uint8_t vga_id;
|
||||
uint16_t default_channelmode;
|
||||
enum DEMO_PATTERN default_pattern;
|
||||
int default_pattern; /**enum DEMO_PATTERN type*/
|
||||
uint64_t default_timebase;
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <glib.h>
|
||||
#include <log/xlog.h>
|
||||
|
||||
#define DECODE_NUM_HEX_MAX_LEN 35
|
||||
#define DECODE_NUM_HEX_MAX_LEN 256
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -132,6 +132,7 @@ static int py_parse_ann_data(PyObject *list_obj, char ***out_strv, int list_size
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user