forked from Ivasoft/DSView
Add a new param for The trig position dispay mode
This commit is contained in:
@@ -98,6 +98,7 @@ void _loadApp(AppOptions &o, QSettings &st){
|
||||
getFiled("appendLogMode", st, o.appendLogMode, false);
|
||||
getFiled("logLevel", st, o.logLevel, 3);
|
||||
getFiled("transDecoderDlg", st, o.transDecoderDlg, true);
|
||||
getFiled("trigPosDisplayInMid", st, o.trigPosDisplayInMid, true);
|
||||
|
||||
QString fmt;
|
||||
getFiled("protocalFormats", st, fmt, "");
|
||||
@@ -117,6 +118,7 @@ void _saveApp(AppOptions &o, QSettings &st){
|
||||
setFiled("appendLogMode", st, o.appendLogMode);
|
||||
setFiled("logLevel", st, o.logLevel);
|
||||
setFiled("transDecoderDlg", st, o.transDecoderDlg);
|
||||
setFiled("trigPosDisplayInMid", st, o.trigPosDisplayInMid);
|
||||
|
||||
QString fmt = FormatArrayToString(o.m_protocolFormats);
|
||||
setFiled("protocalFormats", st, fmt);
|
||||
|
||||
@@ -61,6 +61,7 @@ struct AppOptions
|
||||
bool appendLogMode;
|
||||
int logLevel;
|
||||
bool transDecoderDlg;
|
||||
bool trigPosDisplayInMid;
|
||||
|
||||
std::vector<StringPair> m_protocolFormats;
|
||||
};
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "../config/appconfig.h"
|
||||
|
||||
#include "../ui/langresource.h"
|
||||
#include "../appcontrol.h"
|
||||
#include "../sigsession.h"
|
||||
|
||||
namespace pv
|
||||
{
|
||||
@@ -53,9 +55,21 @@ bool ApplicationParamDlg::ShowDlg(QWidget *parent)
|
||||
//show config
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
|
||||
int mode = AppControl::Instance()->GetSession()->get_device()->get_work_mode();
|
||||
|
||||
QCheckBox *ck_quickScroll = new QCheckBox();
|
||||
ck_quickScroll->setChecked(app._appOptions.quickScroll);
|
||||
lay.addRow(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_QUICK_SCROLL), "Quick scroll"), ck_quickScroll);
|
||||
|
||||
QCheckBox *ck_trigInMid = new QCheckBox();
|
||||
ck_trigInMid->setChecked(app._appOptions.trigPosDisplayInMid);
|
||||
|
||||
if (mode == LOGIC){
|
||||
lay.addRow(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_QUICK_SCROLL), "Quick scroll"), ck_quickScroll);
|
||||
}
|
||||
else if (mode == DSO){
|
||||
lay.addRow(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TRIG_DISPLAY_MIDDLE), "Tig pos in middle"), ck_trigInMid);
|
||||
}
|
||||
|
||||
dlg.layout()->addLayout(&lay);
|
||||
|
||||
dlg.exec();
|
||||
@@ -65,6 +79,8 @@ bool ApplicationParamDlg::ShowDlg(QWidget *parent)
|
||||
//save config
|
||||
if (ret){
|
||||
app._appOptions.quickScroll = ck_quickScroll->isChecked();
|
||||
app._appOptions.trigPosDisplayInMid = ck_trigInMid->isChecked();
|
||||
|
||||
app.SaveApp();
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,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(_action_dispalyOptions, SIGNAL(triggered()), this, SLOT(on_application_param()));
|
||||
connect(_action_dispalyOptions, SIGNAL(triggered()), this, SLOT(on_display_setting()));
|
||||
}
|
||||
|
||||
//语言变化
|
||||
@@ -262,7 +262,7 @@ void TrigBar::reload()
|
||||
_search_action->setVisible(false);
|
||||
_function_action->setVisible(true);
|
||||
_action_lissajous->setVisible(true);
|
||||
_action_dispalyOptions->setVisible(false);
|
||||
_action_dispalyOptions->setVisible(true);
|
||||
}
|
||||
|
||||
DockOptions *opt = getDockOptions();
|
||||
@@ -314,7 +314,7 @@ void TrigBar::on_actionLissajous_triggered()
|
||||
lissajous_dlg.exec();
|
||||
}
|
||||
|
||||
void TrigBar::on_application_param()
|
||||
void TrigBar::on_display_setting()
|
||||
{
|
||||
pv::dialogs::ApplicationParamDlg dlg;
|
||||
dlg.ShowDlg(this);
|
||||
|
||||
@@ -69,7 +69,7 @@ private slots:
|
||||
void on_actionLissajous_triggered();
|
||||
void on_actionFft_triggered();
|
||||
void on_actionMath_triggered();
|
||||
void on_application_param();
|
||||
void on_display_setting();
|
||||
|
||||
public slots:
|
||||
void protocol_clicked();
|
||||
|
||||
@@ -522,7 +522,6 @@ void Ruler::draw_osc_tick_mark(QPainter &p)
|
||||
double typical_width;
|
||||
double tick_period = 0;
|
||||
double scale = _view.scale();
|
||||
//int64_t offset = _view.offset();
|
||||
int64_t offset = 0;
|
||||
|
||||
// Find tick spacing, and number formatting that does not cause
|
||||
@@ -588,8 +587,7 @@ void Ruler::draw_osc_tick_mark(QPainter &p)
|
||||
p.drawText(x, 2 * ValueMargin, 0, text_height,
|
||||
AlignCenter | AlignTop | TextDontClip,
|
||||
format_time(t, prefix));
|
||||
p.drawLine(QPoint(x, major_tick_y1),
|
||||
QPoint(x, tick_y2));
|
||||
p.drawLine(QPoint(x, major_tick_y1), QPoint(x, tick_y2));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -604,8 +602,7 @@ void Ruler::draw_osc_tick_mark(QPainter &p)
|
||||
p.drawText(x, 2 * ValueMargin, 0, minor_tick_y1 + ValueMargin,
|
||||
AlignCenter | AlignTop | TextDontClip,
|
||||
format_time(t - major_t, minor_prefix));
|
||||
p.drawLine(QPoint(x, minor_tick_y1),
|
||||
QPoint(x, tick_y2));
|
||||
p.drawLine(QPoint(x, minor_tick_y1), QPoint(x, tick_y2));
|
||||
}
|
||||
|
||||
division++;
|
||||
@@ -625,6 +622,7 @@ void Ruler::draw_osc_tick_mark(QPainter &p)
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (_view.trig_cursor_shown()) {
|
||||
_view.get_trig_cursor()->paint_fix_label(p, rect(), prefix, 'T', _view.get_trig_cursor()->colour(), false);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "../dialogs/lissajousoptions.h"
|
||||
#include "../dsvdef.h"
|
||||
#include "../log.h"
|
||||
#include "../config/appconfig.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
@@ -488,11 +489,16 @@ void View::receive_trigger(quint64 trig_pos)
|
||||
{
|
||||
const double time = trig_pos * 1.0 / _session->cur_snap_samplerate();
|
||||
_trig_cursor->set_index(trig_pos);
|
||||
|
||||
if (ds_trigger_get_en() ||
|
||||
_device_agent->is_virtual() ||
|
||||
_device_agent->get_work_mode() == DSO) {
|
||||
_show_trig_cursor = true;
|
||||
set_scale_offset(_scale, (time / _scale) - (get_view_width() / 2));
|
||||
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
if (app._appOptions.trigPosDisplayInMid){
|
||||
set_scale_offset(_scale, (time / _scale) - (get_view_width() / 2));
|
||||
}
|
||||
}
|
||||
|
||||
_ruler->update();
|
||||
@@ -598,8 +604,6 @@ void View::update_scale_offset()
|
||||
_preScale = _scale;
|
||||
_preOffset = _offset;
|
||||
|
||||
//_trig_cursor->set_index(_session->get_trigger_pos());
|
||||
|
||||
_ruler->update();
|
||||
viewport_update();
|
||||
}
|
||||
|
||||
@@ -682,5 +682,9 @@
|
||||
{
|
||||
"id": "IDS_DLG_APPEND_MODE",
|
||||
"text": "追加模式"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DLG_TRIG_DISPLAY_MIDDLE",
|
||||
"text": "触发位置自动居中显示"
|
||||
}
|
||||
]
|
||||
@@ -682,5 +682,9 @@
|
||||
{
|
||||
"id": "IDS_DLG_APPEND_MODE",
|
||||
"text": "Append mode"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DLG_TRIG_DISPLAY_MIDDLE",
|
||||
"text": "Trig pos display at the middle"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user