Commit 3f330f97 authored by DreamSourceLab's avatar DreamSourceLab

Add sample duration setting replace of sample count

Improve channel control panel under DSO mode
parent a2a326f0
...@@ -184,6 +184,8 @@ void MainWindow::setup_ui() ...@@ -184,6 +184,8 @@ void MainWindow::setup_ui()
SLOT(hide_calibration())); SLOT(hide_calibration()));
connect(_dso_trigger_widget, SIGNAL(set_trig_pos(int)), _view, connect(_dso_trigger_widget, SIGNAL(set_trig_pos(int)), _view,
SLOT(set_trig_pos(int))); SLOT(set_trig_pos(int)));
connect(_sampling_bar, SIGNAL(hori_res_changed(double)), _view,
SLOT(hori_res_changed(double)));
setIconSize(QSize(40,40)); setIconSize(QSize(40,40));
addToolBar(_sampling_bar); addToolBar(_sampling_bar);
...@@ -567,7 +569,8 @@ void MainWindow::capture_state_changed(int state) ...@@ -567,7 +569,8 @@ void MainWindow::capture_state_changed(int state)
_sampling_bar->set_sampling(state == SigSession::Running); _sampling_bar->set_sampling(state == SigSession::Running);
_view->on_state_changed(state != SigSession::Running); _view->on_state_changed(state != SigSession::Running);
if (_session.get_device()->dev_inst()->mode != DSO) { if (_session.get_device()->dev_inst()->mode != DSO ||
_session.get_instant()) {
_sampling_bar->enable_toggle(state != SigSession::Running); _sampling_bar->enable_toggle(state != SigSession::Running);
_trig_bar->enable_toggle(state != SigSession::Running); _trig_bar->enable_toggle(state != SigSession::Running);
//_measure_dock->widget()->setEnabled(state != SigSession::Running); //_measure_dock->widget()->setEnabled(state != SigSession::Running);
...@@ -754,8 +757,6 @@ bool MainWindow::load_session(QString name) ...@@ -754,8 +757,6 @@ bool MainWindow::load_session(QString name)
_session.get_device()->set_config(NULL, NULL, info->key, g_variant_new_string(sessionObj[info->name].toString().toUtf8())); _session.get_device()->set_config(NULL, NULL, info->key, g_variant_new_string(sessionObj[info->name].toString().toUtf8()));
} }
} }
_sampling_bar->update_record_length();
_sampling_bar->update_sample_rate();
// load channel settings // load channel settings
for (const GSList *l = _session.get_device()->dev_inst()->channels; l; l = l->next) { for (const GSList *l = _session.get_device()->dev_inst()->channels; l; l = l->next) {
...@@ -782,7 +783,7 @@ bool MainWindow::load_session(QString name) ...@@ -782,7 +783,7 @@ bool MainWindow::load_session(QString name)
if (!isEnabled) if (!isEnabled)
probe->enabled = false; probe->enabled = false;
} }
_sampling_bar->update_record_length(); _sampling_bar->update_sample_rate_selector();
_trigger_widget->device_updated(); _trigger_widget->device_updated();
//_session.init_signals(); //_session.init_signals();
......
...@@ -510,14 +510,6 @@ void StoreSession::export_proc(shared_ptr<data::Snapshot> snapshot) ...@@ -510,14 +510,6 @@ void StoreSession::export_proc(shared_ptr<data::Snapshot> snapshot)
g_hash_table_insert(params, (char*)"filename", filenameGVariant); g_hash_table_insert(params, (char*)"filename", filenameGVariant);
GVariant* typeGVariant = g_variant_new_int16(channel_type); GVariant* typeGVariant = g_variant_new_int16(channel_type);
g_hash_table_insert(params, (char*)"type", typeGVariant); g_hash_table_insert(params, (char*)"type", typeGVariant);
BOOST_FOREACH(const boost::shared_ptr<view::Signal> s, _session.get_signals()) {
boost::shared_ptr<view::DsoSignal> dsoSig;
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(s)) {
GVariant* timebaseGVariant = g_variant_new_uint64(dsoSig->get_hDialValue());
g_hash_table_insert(params, (char*)"timebase", timebaseGVariant);
break;
}
}
struct sr_output output; struct sr_output output;
output.module = (sr_output_module*) _outModule; output.module = (sr_output_module*) _outModule;
......
This diff is collapsed.
...@@ -60,10 +60,13 @@ class SamplingBar : public QToolBar ...@@ -60,10 +60,13 @@ class SamplingBar : public QToolBar
Q_OBJECT Q_OBJECT
private: private:
static const uint64_t RecordLengths[19];
static const uint64_t DefaultRecordLength;
static const int ComboBoxMaxWidth = 200; static const int ComboBoxMaxWidth = 200;
static const int RefreshShort = 200;
static const uint64_t LogicMaxSWDepth64 = SR_GB(16);
static const uint64_t LogicMaxSWDepth32 = SR_GB(8);
static const uint64_t AnalogMaxSWDepth = SR_Mn(100);
static const QString RLEString; static const QString RLEString;
static const QString DIVString;
public: public:
SamplingBar(SigSession &session, QWidget *parent); SamplingBar(SigSession &session, QWidget *parent);
...@@ -73,11 +76,7 @@ public: ...@@ -73,11 +76,7 @@ public:
boost::shared_ptr<pv::device::DevInst> get_selected_device() const; boost::shared_ptr<pv::device::DevInst> get_selected_device() const;
uint64_t get_record_length() const; void update_sample_rate_selector();
void set_record_length(uint64_t length);
void update_record_length();
void update_sample_rate();
void set_sampling(bool sampling); void set_sampling(bool sampling);
bool get_sampling() const; bool get_sampling() const;
...@@ -89,9 +88,11 @@ public: ...@@ -89,9 +88,11 @@ public:
void enable_instant(bool enable); void enable_instant(bool enable);
void hori_knob(int dir);
void commit_hori_res();
public slots: public slots:
void set_sample_rate(uint64_t sample_rate); void set_sample_rate(uint64_t sample_rate);
void set_sample_limit(uint64_t sample_limit);
signals: signals:
void run_stop(); void run_stop();
...@@ -101,14 +102,13 @@ signals: ...@@ -101,14 +102,13 @@ signals:
void sample_count_changed(); void sample_count_changed();
void show_calibration(); void show_calibration();
void hide_calibration(); void hide_calibration();
void hori_res_changed(double hori_res);
private: private:
void update_sample_rate_selector();
void update_sample_rate_selector_value(); void update_sample_rate_selector_value();
void update_sample_count_selector(); void update_sample_count_selector();
void update_sample_count_selector_value(); void update_sample_count_selector_value();
void commit_sample_rate(); void commit_settings();
void commit_sample_count();
void setting_adj(); void setting_adj();
private slots: private slots:
......
...@@ -47,35 +47,38 @@ dslDial::~dslDial() ...@@ -47,35 +47,38 @@ dslDial::~dslDial()
{ {
} }
void dslDial::paint(QPainter &p, QRectF dialRect, QColor dialColor, bool hover, bool inc) void dslDial::paint(QPainter &p, QRectF dialRect, QColor dialColor, const QPoint pt)
{ {
p.setRenderHint(QPainter::Antialiasing, true); p.setRenderHint(QPainter::Antialiasing, true);
p.setPen(dialColor); p.setPen(dialColor);
p.setBrush(dialColor); p.setBrush(dialColor);
int dialStartAngle = 225 * 16; int dialMarginAngle = 15 * 16;
int dialSpanAngle = -270 * 16; int dialStartAngle = 75 * 16;
int dialSpanAngle = -150 * 16;
// draw dial arc // draw dial arc
p.drawArc(dialRect, dialStartAngle, dialSpanAngle); p.drawArc(dialRect, dialStartAngle + dialMarginAngle,
dialSpanAngle - dialMarginAngle * 2);
// draw ticks // draw ticks
p.save(); p.save();
p.translate(dialRect.center()); p.translate(dialRect.center());
p.rotate(45); p.rotate(270 - dialStartAngle/16);
// draw pointer
p.rotate(-dialSpanAngle/16.0/(_div-1)*_sel);
p.drawEllipse(-3, -3, 6, 6);
p.drawLine(3, 0, 0, dialRect.width()/2-3);
p.drawLine(-3, 0, 0, dialRect.width()/2-3);
p.rotate(+dialSpanAngle/16.0/(_div-1)*_sel);
for (uint64_t i = 0; i < _div; i++) { for (uint64_t i = 0; i < _div; i++) {
// draw major ticks // draw major ticks
p.drawLine(0, dialRect.width()/2+3, 0, dialRect.width()/2+8); p.drawLine(0, dialRect.width()/2+3, 0, dialRect.width()/2+8);
// draw minor ticks // draw minor ticks
for (uint64_t j = 0; (j < 5) && (i < _div - 1); j++) { for (uint64_t j = 0; (j < 5) && (i < _div - 1); j++) {
p.drawLine(0, dialRect.width()/2+3, 0, dialRect.width()/2+5); p.drawLine(0, dialRect.width()/2+3, 0, dialRect.width()/2+5);
p.rotate(54.0/(_div-1)); p.rotate(-dialSpanAngle/16/5.0/(_div-1));
} }
} }
// draw pointer
p.rotate(90+270.0/(_div-1)*_sel);
p.drawEllipse(-3, -3, 6, 6);
p.drawLine(3, 0, 0, dialRect.width()/2-3);
p.drawLine(-3, 0, 0, dialRect.width()/2-3);
p.restore(); p.restore();
// draw value // draw value
uint64_t displayValue = _value[_sel]*_factor; uint64_t displayValue = _value[_sel]*_factor;
...@@ -84,23 +87,27 @@ void dslDial::paint(QPainter &p, QRectF dialRect, QColor dialColor, bool hover, ...@@ -84,23 +87,27 @@ void dslDial::paint(QPainter &p, QRectF dialRect, QColor dialColor, bool hover,
displayValue = displayValue / _step; displayValue = displayValue / _step;
displayIndex++; displayIndex++;
} }
QString pText = QString::number(displayValue) + _unit[displayIndex] + "/div"; QString pText = QString::number(displayValue) + _unit[displayIndex] + tr(" / div");
QFontMetrics fm(p.font()); QFontMetrics fm(p.font());
const QRectF valueRect = QRectF(dialRect.left(), dialRect.bottom()-dialRect.width()*0.3+fm.height()*0.5, dialRect.width(), fm.height()); const QRectF valueRect = QRectF(dialRect.left(), dialRect.top()-fm.height()-10, dialRect.width(), fm.height());
p.drawText(valueRect, Qt::AlignCenter, pText); p.drawText(valueRect, Qt::AlignCenter, pText);
// draw +/- // draw +/-
if (hover) { if (dialRect.contains(pt) && pt.x() > dialRect.center().x()) {
const int arcInc = 15; const int arcInc = 12;
const QRectF hoverRect = QRectF(dialRect.left()-arcInc, dialRect.top()-arcInc, dialRect.width()+arcInc*2, dialRect.height()+arcInc*2); const QRectF hoverRect = QRectF(dialRect.left()-arcInc, dialRect.top()-arcInc,
const double arcSpan = hoverRect.width()/(2*sqrt(2)); dialRect.width()+arcInc*2, dialRect.height()+arcInc*2);
p.drawArc(hoverRect, 135 * 16, -90 * 16); p.drawArc(hoverRect, dialStartAngle + dialSpanAngle/4, dialSpanAngle/2);
p.save();
p.translate(hoverRect.center());
const bool inc = pt.y() > dialRect.center().y();
if (inc) if (inc)
p.drawLine(hoverRect.center().x()+arcSpan, hoverRect.center().y()-arcSpan, p.rotate(270-(dialStartAngle/16 + dialSpanAngle/16/4 + dialSpanAngle/16/2));
hoverRect.center().x()+arcSpan-4, hoverRect.center().y()-arcSpan-10);
else else
p.drawLine(hoverRect.center().x()-arcSpan, hoverRect.center().y()-arcSpan, p.rotate(270-(dialStartAngle/16 + dialSpanAngle/16/4));
hoverRect.center().x()-arcSpan+4, hoverRect.center().y()-arcSpan-10); p.drawLine(0, hoverRect.width()/2,
inc ? 10 : -10, hoverRect.width()/2 + 4);
p.restore();
} }
} }
......
...@@ -28,8 +28,10 @@ ...@@ -28,8 +28,10 @@
namespace pv { namespace pv {
namespace view { namespace view {
class dslDial class dslDial : public QObject
{ {
//Q_OBJECT
public: public:
dslDial(const uint64_t div, const uint64_t step, dslDial(const uint64_t div, const uint64_t step,
const QVector<uint64_t> value, const QVector<QString> unit); const QVector<uint64_t> value, const QVector<QString> unit);
...@@ -41,7 +43,8 @@ public: ...@@ -41,7 +43,8 @@ public:
* @param p the QPainter to paint into. * @param p the QPainter to paint into.
* @param dialRect the rectangle to draw the dial at. * @param dialRect the rectangle to draw the dial at.
**/ **/
void paint(QPainter &p, QRectF dialRect, QColor dialColor, bool hover, bool inc); void paint(QPainter &p, QRectF dialRect, QColor dialColor,
const QPoint pt);
// set/get current select // set/get current select
void set_sel(uint64_t sel); void set_sel(uint64_t sel);
......
This diff is collapsed.
...@@ -40,6 +40,8 @@ namespace view { ...@@ -40,6 +40,8 @@ namespace view {
class DsoSignal : public Signal class DsoSignal : public Signal
{ {
//Q_OBJECT
private: private:
static const QColor SignalColours[4]; static const QColor SignalColours[4];
static const float EnvelopeThreshold; static const float EnvelopeThreshold;
...@@ -48,15 +50,9 @@ private: ...@@ -48,15 +50,9 @@ private:
static const uint64_t vDialValueCount = 8; static const uint64_t vDialValueCount = 8;
static const uint64_t vDialValueStep = 1000; static const uint64_t vDialValueStep = 1000;
static const uint64_t vDialUnitCount = 2; static const uint64_t vDialUnitCount = 2;
static const uint64_t hDialValueCount = 28;
static const uint64_t hDialValueStep = 1000;
static const uint64_t hDialUnitCount = 4;
static const uint64_t vDialValue[vDialValueCount]; static const uint64_t vDialValue[vDialValueCount];
static const QString vDialUnit[vDialUnitCount]; static const QString vDialUnit[vDialUnitCount];
static const uint64_t hDialValue[hDialValueCount];
static const QString hDialUnit[hDialUnitCount];
static const int UpMargin = 30; static const int UpMargin = 30;
static const int DownMargin = 0; static const int DownMargin = 0;
static const int RightMargin = 30; static const int RightMargin = 30;
...@@ -70,13 +66,9 @@ public: ...@@ -70,13 +66,9 @@ public:
enum DsoSetRegions { enum DsoSetRegions {
DSO_NONE = -1, DSO_NONE = -1,
DSO_VDIAL, DSO_VDIAL,
DSO_HDIAL,
DSO_VDEC,
DSO_VINC,
DSO_HDEC,
DSO_HINC,
DSO_CHEN, DSO_CHEN,
DSO_ACDC, DSO_ACDC,
DSO_AUTO,
DSO_X1, DSO_X1,
DSO_X10, DSO_X10,
DSO_X100, DSO_X100,
...@@ -103,23 +95,19 @@ public: ...@@ -103,23 +95,19 @@ public:
void set_scale(int height); void set_scale(int height);
float get_scale(); float get_scale();
int get_name_width() const;
/** /**
* *
*/ */
void set_enable(bool enable); void set_enable(bool enable);
bool get_vDialActive() const; bool get_vDialActive() const;
void set_vDialActive(bool active); void set_vDialActive(bool active);
bool get_hDialActive() const;
void set_hDialActive(bool active);
bool go_vDialPre(); bool go_vDialPre();
bool go_vDialNext(); bool go_vDialNext();
bool go_hDialPre(bool setted);
bool go_hDialNext(bool setted);
bool update_capture(bool instant); bool update_capture(bool instant);
uint64_t get_vDialValue() const; uint64_t get_vDialValue() const;
uint64_t get_hDialValue() const;
uint16_t get_vDialSel() const; uint16_t get_vDialSel() const;
uint16_t get_hDialSel() const;
uint8_t get_acCoupling() const; uint8_t get_acCoupling() const;
void set_acCoupling(uint8_t coupling); void set_acCoupling(uint8_t coupling);
void set_trig_vpos(int pos, bool delta_change); void set_trig_vpos(int pos, bool delta_change);
...@@ -223,9 +211,7 @@ private: ...@@ -223,9 +211,7 @@ private:
float _scale; float _scale;
dslDial *_vDial; dslDial *_vDial;
dslDial *_hDial;
bool _vDialActive; bool _vDialActive;
bool _hDialActive;
uint8_t _acCoupling; uint8_t _acCoupling;
uint8_t _bits; uint8_t _bits;
......
...@@ -261,7 +261,8 @@ void Header::wheelEvent(QWheelEvent *event) ...@@ -261,7 +261,8 @@ void Header::wheelEvent(QWheelEvent *event)
void Header::changeName(QMouseEvent *event) void Header::changeName(QMouseEvent *event)
{ {
if ((event->button() == Qt::LeftButton)) { if ((event->button() == Qt::LeftButton) &&
(_context_trace->get_type() != SR_CHANNEL_DSO)) {
header_resize(); header_resize();
nameEdit->setText(_context_trace->get_name()); nameEdit->setText(_context_trace->get_name());
nameEdit->selectAll(); nameEdit->selectAll();
......
...@@ -78,6 +78,7 @@ MathTrace::MathTrace(pv::SigSession &session, ...@@ -78,6 +78,7 @@ MathTrace::MathTrace(pv::SigSession &session,
_scale(1), _scale(1),
_offset(0) _offset(0)
{ {
_typeWidth = 0;
const vector< boost::shared_ptr<Signal> > sigs(_session.get_signals()); const vector< boost::shared_ptr<Signal> > sigs(_session.get_signals());
for(size_t i = 0; i < sigs.size(); i++) { for(size_t i = 0; i < sigs.size(); i++) {
const boost::shared_ptr<view::Signal> s(sigs[i]); const boost::shared_ptr<view::Signal> s(sigs[i]);
......
...@@ -120,6 +120,14 @@ QString Trace::get_name() const ...@@ -120,6 +120,14 @@ QString Trace::get_name() const
return _name; return _name;
} }
int Trace::get_name_width() const
{
QFont font = QApplication::font();
QFontMetrics fm(font);
return fm.boundingRect(get_name()).width();
}
void Trace::set_name(QString name) void Trace::set_name(QString name)
{ {
_name = name; _name = name;
...@@ -271,10 +279,16 @@ void Trace::paint_label(QPainter &p, int right, const QPoint pt) ...@@ -271,10 +279,16 @@ void Trace::paint_label(QPainter &p, int right, const QPoint pt)
p.setPen(Qt::transparent); p.setPen(Qt::transparent);
p.setBrush(enabled() ? _colour : dsDisable); p.setBrush(enabled() ? _colour : dsDisable);
p.drawRect(color_rect); p.drawRect(color_rect);
if (_type == SR_CHANNEL_DSO) {
p.setPen(enabled() ? Qt::white: dsDisable);
p.drawText(color_rect, Qt::AlignCenter | Qt::AlignVCenter, _name);
}
// Paint the signal name if (_type != SR_CHANNEL_DSO) {
p.setPen(enabled() ? DARK_FORE: dsDisable); // Paint the signal name
p.drawText(name_rect, Qt::AlignLeft | Qt::AlignVCenter, _name); p.setPen(enabled() ? DARK_FORE: dsDisable);
p.drawText(name_rect, Qt::AlignLeft | Qt::AlignVCenter, _name);
}
// Paint the trigButton // Paint the trigButton
paint_type_options(p, right, pt); paint_type_options(p, right, pt);
......
...@@ -92,6 +92,7 @@ public: ...@@ -92,6 +92,7 @@ public:
* Gets the name of this signal. * Gets the name of this signal.
*/ */
QString get_name() const; QString get_name() const;
virtual int get_name_width() const;
/** /**
* Sets the name of the signal. * Sets the name of the signal.
......
...@@ -231,7 +231,8 @@ void View::capture_init(bool instant) ...@@ -231,7 +231,8 @@ void View::capture_init(bool instant)
if (_session.get_device()->dev_inst()->mode == ANALOG) if (_session.get_device()->dev_inst()->mode == ANALOG)
set_scale_offset(_maxscale, 0); set_scale_offset(_maxscale, 0);
update_sample(instant); _session.get_device()->set_config(NULL, NULL, SR_CONF_INSTANT, g_variant_new_boolean(instant));
update_hori_res();
status_clear(); status_clear();
} }
...@@ -251,34 +252,13 @@ void View::set_all_update(bool need_update) ...@@ -251,34 +252,13 @@ void View::set_all_update(bool need_update)
viewport->set_need_update(need_update); viewport->set_need_update(need_update);
} }
void View::update_sample(bool instant) void View::update_hori_res()
{
_session.get_device()->set_config(NULL, NULL, SR_CONF_INSTANT, g_variant_new_boolean(instant));
BOOST_FOREACH(const boost::shared_ptr<pv::view::Signal> s, _session.get_signals()) {
boost::shared_ptr<pv::view::DsoSignal> dsoSig;
if (dsoSig = dynamic_pointer_cast<pv::view::DsoSignal>(s)) {
dsoSig->update_capture(instant);
break;
}
}
}
void View::set_sample_rate(uint64_t sample_rate, bool force)
{ {
if (_session.get_capture_state() != pv::SigSession::Stopped || force) { _sampling_bar->hori_knob(0);
_sampling_bar->set_sample_rate(sample_rate);
_session.set_cur_samplerate(_session.get_device()->get_sample_rate());
}
}
void View::set_sample_limit(uint64_t sample_limit, bool force) const uint64_t final_limit = _session.get_device()->get_sample_limit();
{ _trig_cursor->set_index(_trig_cursor->index() * 1.0 / _session.cur_samplelimits() * final_limit);
if (_session.get_capture_state() != pv::SigSession::Stopped || force) { _session.set_cur_samplelimits(final_limit);
_sampling_bar->set_sample_limit(sample_limit);
const uint64_t final_limit = _session.get_device()->get_sample_limit();
_trig_cursor->set_index(_trig_cursor->index() * 1.0 / _session.cur_samplelimits() * final_limit);
_session.set_cur_samplelimits(final_limit);
}
} }
void View::zoom(double steps, int offset) void View::zoom(double steps, int offset)
...@@ -291,21 +271,15 @@ void View::zoom(double steps, int offset) ...@@ -291,21 +271,15 @@ void View::zoom(double steps, int offset)
//_scale *= std::pow(3.0/2.0, -steps); //_scale *= std::pow(3.0/2.0, -steps);
_scale *= std::pow(2, -steps); _scale *= std::pow(2, -steps);
_scale = max(min(_scale, _maxscale), _minscale); _scale = max(min(_scale, _maxscale), _minscale);
}else { } else {
const vector< boost::shared_ptr<Signal> > sigs(_session.get_signals()); if (_session.get_capture_state() == SigSession::Running &&
bool setted = false; _session.get_instant())
BOOST_FOREACH(const boost::shared_ptr<Signal> s, sigs) { return;
boost::shared_ptr<DsoSignal> dsoSig;
if (dsoSig = dynamic_pointer_cast<DsoSignal>(s)) { if(steps > 0.5)
if(steps > 0.5) _sampling_bar->hori_knob(-1);
dsoSig->go_hDialPre(setted); else if (steps < -0.5)
else if (steps < -0.5) _sampling_bar->hori_knob(1);
dsoSig->go_hDialNext(setted);
else
break;
setted = true;
}
}
} }
_offset = floor((_offset + offset) * (_preScale / _scale) - offset); _offset = floor((_offset + offset) * (_preScale / _scale) - offset);
...@@ -320,6 +294,14 @@ void View::zoom(double steps, int offset) ...@@ -320,6 +294,14 @@ void View::zoom(double steps, int offset)
//} //}
} }
void View::hori_res_changed(double hori_res)
{
if (hori_res > 0) {
const double scale = hori_res * DS_CONF_DSO_HDIVS / SR_SEC(1) / get_view_width();
set_scale_offset(scale, this->offset());
}
}
void View::set_scale_offset(double scale, int64_t offset) void View::set_scale_offset(double scale, int64_t offset)
{ {
...@@ -769,24 +751,14 @@ bool View::viewportEvent(QEvent *e) ...@@ -769,24 +751,14 @@ bool View::viewportEvent(QEvent *e)
int View::headerWidth() int View::headerWidth()
{ {
int headerWidth; int headerWidth = _header->get_nameEditWidth();
int maxNameWidth = 25;
int maxLeftWidth = 0;
int maxRightWidth = 0;
QFont font = QApplication::font();
QFontMetrics fm(font);
const vector< boost::shared_ptr<Trace> > traces(get_traces(ALL_VIEW)); const vector< boost::shared_ptr<Trace> > traces(get_traces(ALL_VIEW));
if (!traces.empty()){ if (!traces.empty()) {
BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces) { BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces)
maxNameWidth = max(fm.boundingRect(t->get_name()).width(), maxNameWidth); headerWidth = max(t->get_name_width() + t->get_leftWidth() + t->get_rightWidth(),
maxLeftWidth = max(t->get_leftWidth(), maxLeftWidth); headerWidth);
maxRightWidth = max(t->get_rightWidth(), maxRightWidth);
}
} }
maxNameWidth = max(_header->get_nameEditWidth(), maxNameWidth);
headerWidth = maxLeftWidth + maxNameWidth + maxRightWidth;
setViewportMargins(headerWidth, RulerHeight, 0, 0); setViewportMargins(headerWidth, RulerHeight, 0, 0);
......
...@@ -182,11 +182,7 @@ public: ...@@ -182,11 +182,7 @@ public:
int get_view_width(); int get_view_width();
int get_view_height(); int get_view_height();
void update_sample(bool instant); void update_hori_res();
void set_sample_rate(uint64_t sample_rate, bool force = false);
void set_sample_limit(uint64_t sample_limit, bool force = false);
QString get_measure(QString option); QString get_measure(QString option);
...@@ -244,6 +240,8 @@ public slots: ...@@ -244,6 +240,8 @@ public slots:
void repeat_unshow(); void repeat_unshow();
// -- repeat // -- repeat
void repeat_show(); void repeat_show();
// -- hori resolution
void hori_res_changed(double hori_res);
private slots: private slots:
......
...@@ -1140,6 +1140,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi, ...@@ -1140,6 +1140,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_PROBE_EN)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_PROBE_EN));
if (dsl_en_ch_num(sdi) != 0) { if (dsl_en_ch_num(sdi) != 0) {
ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, 0, SR_CONF_SAMPLERATE)); ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, 0, SR_CONF_SAMPLERATE));
devc->limit_samples = DSCOPE_MAX_DEPTH / dsl_en_ch_num(sdi);
} }
} }