2
0
forked from Ivasoft/DSView

Merge branch 'dev-tai' of https://github.com/dreamsourcelab/DSView into dev-tai

This commit is contained in:
dreamsourcelabTAI
2022-04-25 13:13:34 +08:00
11 changed files with 60 additions and 108 deletions

View File

@@ -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);

View File

@@ -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()

View File

@@ -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

View File

@@ -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()

View File

@@ -145,7 +145,7 @@ bool StoreSession::save_start()
}
if (_file_name == ""){
_error = tr("No set file name.");
_error = tr("No file name.");
return false;
}

View File

@@ -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();

View File

@@ -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;