mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +08:00
Merge branch 'dev-tai' of https://github.com/dreamsourcelab/DSView into dev-tai
This commit is contained in:
commit
956b4140be
@ -43,7 +43,7 @@ ApplicationParamDlg::~ApplicationParamDlg()
|
||||
bool ApplicationParamDlg::ShowDlg(QWidget *parent)
|
||||
{
|
||||
DSDialog dlg(parent, true, true);
|
||||
dlg.setTitle("Application options");
|
||||
dlg.setTitle("Display options");
|
||||
dlg.setMinimumSize(300, 200);
|
||||
QFormLayout &lay = *(new QFormLayout());
|
||||
lay.setContentsMargins(0,20,0,30);
|
||||
|
@ -135,7 +135,12 @@ MainFrame::MainFrame()
|
||||
_layout->addWidget(_bottom, 2, 1);
|
||||
_layout->addWidget(_bottom_right, 2, 2);
|
||||
|
||||
connect(&_timer, SIGNAL(timeout()), this, SLOT(unfreezing()));
|
||||
#ifdef _WIN32
|
||||
_taskBtn = new QWinTaskbarButton(this);
|
||||
connect(_mainWindow, SIGNAL(prgRate(int)), this, SLOT(setTaskbarProgress(int)));
|
||||
#endif
|
||||
|
||||
connect(&_timer, SIGNAL(timeout()), this, SLOT(unfreezing()));
|
||||
}
|
||||
|
||||
void MainFrame::resizeEvent(QResizeEvent *event)
|
||||
@ -437,9 +442,30 @@ void MainFrame::readSettings()
|
||||
_titleBar->setRestoreButton(app._frameOptions.isMax);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void MainFrame::showEvent(QShowEvent *event)
|
||||
{
|
||||
// Taskbar Progress Effert for Win7 and Above
|
||||
if (_taskBtn->window() == NULL) {
|
||||
_taskBtn->setWindow(windowHandle());
|
||||
_taskPrg = _taskBtn->progress();
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainFrame::setTaskbarProgress(int progress)
|
||||
{
|
||||
(void)progress;
|
||||
#ifdef _WIN32
|
||||
if (progress > 0) {
|
||||
_taskPrg->setVisible(true);
|
||||
_taskPrg->setValue(progress);
|
||||
} else {
|
||||
_taskPrg->setVisible(false);
|
||||
}
|
||||
#else
|
||||
(void)progress;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainFrame::show_doc()
|
||||
|
@ -28,6 +28,10 @@
|
||||
#include <QFrame>
|
||||
#include <QGridLayout>
|
||||
#include <QTimer>
|
||||
#ifdef _WIN32
|
||||
#include <QWinTaskbarButton>
|
||||
#include <QWinTaskbarProgress>
|
||||
#endif
|
||||
|
||||
namespace pv {
|
||||
|
||||
@ -73,6 +77,9 @@ protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
#ifdef _WIN32
|
||||
void showEvent(QShowEvent *event);
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
void unfreezing();
|
||||
@ -107,6 +114,11 @@ private:
|
||||
int _hit_border;
|
||||
QTimer _timer;
|
||||
bool _freezing;
|
||||
// Taskbar Progress Effert for Win7 and Above
|
||||
#ifdef _WIN32
|
||||
QWinTaskbarButton *_taskBtn;
|
||||
QWinTaskbarProgress *_taskPrg;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace pv
|
||||
|
@ -1206,7 +1206,8 @@ void SigSession::data_feed_in_proc(const struct sr_dev_inst *sdi,
|
||||
/*
|
||||
* hotplug function
|
||||
*/
|
||||
void SigSession::hotplug_callback(void *ctx, void *dev, int event, void *user_data) {
|
||||
void SigSession::hotplug_callback(void *ctx, void *dev, int event, void *user_data)
|
||||
{
|
||||
|
||||
(void)ctx;
|
||||
(void)dev;
|
||||
@ -1214,32 +1215,32 @@ void SigSession::hotplug_callback(void *ctx, void *dev, int event, void *user_da
|
||||
|
||||
if (USB_EV_HOTPLUG_ATTACH == event) {
|
||||
_session->_hot_attach = true;
|
||||
qDebug("receive event:DreamSourceLab Hardware attached!");
|
||||
}else if (USB_EV_HOTPLUG_DETTACH == event) {
|
||||
_session->_hot_detach = true;
|
||||
qDebug("receive event:DreamSourceLab Hardware detached!");
|
||||
}else{
|
||||
qDebug("Unhandled event %d\n", event);
|
||||
}
|
||||
}
|
||||
|
||||
void SigSession::hotplug_proc()
|
||||
{
|
||||
{
|
||||
if (!_dev_inst)
|
||||
return;
|
||||
|
||||
|
||||
qDebug("Hotplug thread start!");
|
||||
|
||||
try {
|
||||
while(_session && !_bHotplugStop) {
|
||||
|
||||
sr_hotplug_wait_timout(_sr_ctx);
|
||||
|
||||
if (_hot_attach) {
|
||||
qDebug("process event:DreamSourceLab hardware attached!");
|
||||
qDebug("process event: DreamSourceLab hardware attached!");
|
||||
_callback->device_attach();
|
||||
_hot_attach = false;
|
||||
}
|
||||
if (_hot_detach) {
|
||||
qDebug("process event:DreamSourceLab hardware detached!");
|
||||
qDebug("process event: DreamSourceLab hardware detached!");
|
||||
_callback->device_detach();
|
||||
_hot_detach = false;
|
||||
}
|
||||
@ -1248,7 +1249,7 @@ void SigSession::hotplug_proc()
|
||||
} catch(...) {
|
||||
qDebug("Interrupt exception for hotplug thread was thrown.");
|
||||
}
|
||||
// qDebug("Hotplug thread exit!");
|
||||
qDebug("Hotplug thread exit!");
|
||||
}
|
||||
|
||||
void SigSession::register_hotplug_callback()
|
||||
|
@ -145,7 +145,7 @@ bool StoreSession::save_start()
|
||||
}
|
||||
|
||||
if (_file_name == ""){
|
||||
_error = tr("No set file name.");
|
||||
_error = tr("No file name.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -87,14 +87,14 @@ TrigBar::TrigBar(SigSession *session, QWidget *parent) :
|
||||
_themes->addAction(_light_style);
|
||||
_themes->addAction(_dark_style);
|
||||
|
||||
_appParam_action = new QAction(this);
|
||||
_action_dispalyOptions = new QAction(this);
|
||||
|
||||
_display_menu = new QMenu(this);
|
||||
_display_menu->setContentsMargins(0,0,0,0);
|
||||
|
||||
_display_menu->addAction(_appParam_action);
|
||||
_display_menu->addAction(_action_lissajous);
|
||||
_display_menu->addMenu(_themes);
|
||||
_display_menu->addAction(_action_dispalyOptions);
|
||||
|
||||
_setting_button.setPopupMode(QToolButton::InstantPopup);
|
||||
_setting_button.setMenu(_display_menu);
|
||||
@ -127,7 +127,7 @@ TrigBar::TrigBar(SigSession *session, QWidget *parent) :
|
||||
connect(_action_lissajous, SIGNAL(triggered()), this, SLOT(on_actionLissajous_triggered()));
|
||||
connect(_dark_style, SIGNAL(triggered()), this, SLOT(on_actionDark_triggered()));
|
||||
connect(_light_style, SIGNAL(triggered()), this, SLOT(on_actionLight_triggered()));
|
||||
connect(_appParam_action, SIGNAL(triggered()), this, SLOT(on_application_param()));
|
||||
connect(_action_dispalyOptions, SIGNAL(triggered()), this, SLOT(on_application_param()));
|
||||
}
|
||||
|
||||
void TrigBar::changeEvent(QEvent *event)
|
||||
@ -146,7 +146,7 @@ void TrigBar::retranslateUi()
|
||||
_measure_button.setText(tr("Measure"));
|
||||
_search_button.setText(tr("Search"));
|
||||
_function_button.setText(tr("Function"));
|
||||
_setting_button.setText(tr("Setting"));
|
||||
_setting_button.setText(tr("Display"));
|
||||
|
||||
_action_lissajous->setText(tr("&Lissajous"));
|
||||
|
||||
@ -157,7 +157,7 @@ void TrigBar::retranslateUi()
|
||||
_action_fft->setText(tr("FFT"));
|
||||
_action_math->setText(tr("Math"));
|
||||
|
||||
_appParam_action->setText(tr("Application"));
|
||||
_action_dispalyOptions->setText(tr("Options"));
|
||||
}
|
||||
|
||||
void TrigBar::reStyle()
|
||||
@ -177,7 +177,7 @@ void TrigBar::reStyle()
|
||||
_dark_style->setIcon(QIcon(iconPath+"/dark.svg"));
|
||||
_light_style->setIcon(QIcon(iconPath+"/light.svg"));
|
||||
|
||||
_appParam_action->setIcon(QIcon(iconPath+"/params.svg"));
|
||||
_action_dispalyOptions->setIcon(QIcon(iconPath+"/params.svg"));
|
||||
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
|
||||
|
@ -109,7 +109,7 @@ private:
|
||||
|
||||
QMenu *_display_menu;
|
||||
QMenu *_themes;
|
||||
QAction *_appParam_action;
|
||||
QAction *_action_dispalyOptions;
|
||||
QAction *_dark_style;
|
||||
QAction *_light_style;
|
||||
QAction *_action_lissajous;
|
||||
|
@ -288,9 +288,6 @@ static GSList *scan(GSList *options)
|
||||
/* Find all DSLogic compatible devices and upload firmware to them. */
|
||||
devices = NULL;
|
||||
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
|
||||
int stdnum = 0;
|
||||
|
||||
|
||||
for (i = 0; devlist[i]; i++) {
|
||||
if (conn) {
|
||||
usb = NULL;
|
||||
@ -317,8 +314,6 @@ static GSList *scan(GSList *options)
|
||||
(usb_speed != LIBUSB_SPEED_SUPER))
|
||||
continue;
|
||||
|
||||
stdnum++;
|
||||
|
||||
prof = NULL;
|
||||
for (j = 0; supported_DSLogic[j].vid; j++) {
|
||||
if (des.idVendor == supported_DSLogic[j].vid &&
|
||||
|
@ -168,9 +168,8 @@ static const struct DEMO_profile supported_Demo[] = {
|
||||
(1 << DEMO_LOGIC100x16) |
|
||||
(1 << DEMO_ANALOG10x2) |
|
||||
(1 << DEMO_DSO200x2),
|
||||
//SR_Mn(100),
|
||||
SR_Gn(16),
|
||||
SR_Kn(20),
|
||||
SR_Mn(100),
|
||||
SR_Kn(20),
|
||||
0,
|
||||
vdivs10to2000,
|
||||
0,
|
||||
|
@ -27,8 +27,6 @@
|
||||
#include <glib.h>
|
||||
#include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */
|
||||
|
||||
#include "hardware/DSL/dsl.h"
|
||||
|
||||
/* Message logging helpers with subsystem-specific prefix string. */
|
||||
#define LOG_PREFIX "hwdriver: "
|
||||
#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args)
|
||||
@ -477,81 +475,3 @@ SR_PRIV int sr_source_add(int fd, int events, int timeout,
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
test usb device api
|
||||
*/
|
||||
/*
|
||||
SR_API void sr_test_usb_api()
|
||||
{
|
||||
libusb_context *ctx;
|
||||
struct libusb_device_descriptor des;
|
||||
int usb_speed;
|
||||
int ret;
|
||||
int i;
|
||||
int num_devs;
|
||||
libusb_device **devlist;
|
||||
int stdnum = 0;
|
||||
int j;
|
||||
int bfind = 0;
|
||||
int dlsnum = 0;
|
||||
struct libusb_device_handle *devhandle;
|
||||
|
||||
printf("\n");
|
||||
|
||||
ret = libusb_init(&ctx);
|
||||
if (ret) {
|
||||
printf("unable to initialize libusb: %i\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
num_devs = libusb_get_device_list(ctx, &devlist);
|
||||
printf("usb dev num:%d\n", num_devs);
|
||||
|
||||
for (i=0; i<num_devs; i++){
|
||||
libusb_get_device_descriptor(devlist[i], &des);
|
||||
|
||||
usb_speed = libusb_get_device_speed( devlist[i]);
|
||||
|
||||
if ((usb_speed != LIBUSB_SPEED_HIGH) && (usb_speed != LIBUSB_SPEED_SUPER))
|
||||
continue;
|
||||
stdnum++;
|
||||
bfind = 0;
|
||||
|
||||
for (j = 0; supported_DSLogic[j].vid; j++) {
|
||||
if (des.idVendor == supported_DSLogic[j].vid &&
|
||||
des.idProduct == supported_DSLogic[j].pid &&
|
||||
usb_speed == supported_DSLogic[j].usb_speed) {
|
||||
bfind = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bfind){
|
||||
dlsnum++;
|
||||
|
||||
devhandle = NULL;
|
||||
ret = libusb_open(devlist[i], &devhandle);
|
||||
if (ret){
|
||||
printf("open device error!%s\n", libusb_error_name(ret));
|
||||
}
|
||||
else{
|
||||
//printf("dev open success\n");
|
||||
ret = libusb_claim_interface(devhandle, USB_INTERFACE);
|
||||
if (ret){
|
||||
printf("Unable to claim interface: %s\n", libusb_error_name(ret));
|
||||
}
|
||||
|
||||
libusb_close(devhandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("std usb dev num:%d\n", stdnum);
|
||||
printf("dls dev num:%d\n", dlsnum);
|
||||
|
||||
libusb_free_device_list(devlist, 0);
|
||||
|
||||
libusb_exit(NULL);
|
||||
}
|
||||
*/
|
||||
|
@ -621,7 +621,6 @@ SR_API int sr_session_append(const char *filename, const unsigned char *buf,
|
||||
goto err;
|
||||
}
|
||||
if (zip_file_add(archive, chunk_name, logicsrc, ZIP_FL_OVERWRITE) == -1) {
|
||||
// if (zip_add(archive, chunk_name, logicsrc) == -1) {
|
||||
goto err;
|
||||
}
|
||||
if ((ret = zip_close(archive)) == -1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user