projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Made Probes popup reusable
[pulseview.git]
/
pv
/
toolbars
/
samplingbar.cpp
diff --git
a/pv/toolbars/samplingbar.cpp
b/pv/toolbars/samplingbar.cpp
index ae4f298b6f2eae30f744ce4636e344459b87b5c6..b80d6f80f0df737811aeb6c24c2132b11b77d613 100644
(file)
--- a/
pv/toolbars/samplingbar.cpp
+++ b/
pv/toolbars/samplingbar.cpp
@@
-64,11
+64,14
@@
const uint64_t SamplingBar::RecordLengths[20] = {
const uint64_t SamplingBar::DefaultRecordLength = 1000000;
const uint64_t SamplingBar::DefaultRecordLength = 1000000;
-SamplingBar::SamplingBar(QWidget *parent) :
+SamplingBar::SamplingBar(
SigSession &session,
QWidget *parent) :
QToolBar("Sampling Bar", parent),
QToolBar("Sampling Bar", parent),
+ _session(session),
_device_selector(this),
_device_selector(this),
+ _updating_device_selector(false),
_configure_button(this),
_probes_button(this),
_configure_button(this),
_probes_button(this),
+ _probes_popup(_session, this),
_record_length_selector(this),
_sample_rate_list(this),
_icon_red(":/icons/status-red.svg"),
_record_length_selector(this),
_sample_rate_list(this),
_icon_red(":/icons/status-red.svg"),
@@
-100,8
+103,10
@@
SamplingBar::SamplingBar(QWidget *parent) :
_configure_button.setIcon(QIcon::fromTheme("configure",
QIcon(":/icons/configure.png")));
_configure_button.setIcon(QIcon::fromTheme("configure",
QIcon(":/icons/configure.png")));
+
_probes_button.setIcon(QIcon::fromTheme("probes",
QIcon(":/icons/probes.svg")));
_probes_button.setIcon(QIcon::fromTheme("probes",
QIcon(":/icons/probes.svg")));
+ _probes_button.set_popup(&_probes_popup);
_run_stop_button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
_run_stop_button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@@
-122,6
+127,8
@@
SamplingBar::SamplingBar(QWidget *parent) :
void SamplingBar::set_device_list(
const std::list<struct sr_dev_inst*> &devices)
{
void SamplingBar::set_device_list(
const std::list<struct sr_dev_inst*> &devices)
{
+ _updating_device_selector = true;
+
_device_selector.clear();
BOOST_FOREACH (sr_dev_inst *sdi, devices) {
_device_selector.clear();
BOOST_FOREACH (sr_dev_inst *sdi, devices) {
@@
-130,7
+137,9
@@
void SamplingBar::set_device_list(
qVariantFromValue((void*)sdi));
}
qVariantFromValue((void*)sdi));
}
- update_sample_rate_selector();
+ _updating_device_selector = false;
+
+ on_device_selected();
}
struct sr_dev_inst* SamplingBar::get_selected_device() const
}
struct sr_dev_inst* SamplingBar::get_selected_device() const
@@
-296,14
+305,15
@@
void SamplingBar::on_device_selected()
{
using namespace pv::popups;
{
using namespace pv::popups;
+ if (_updating_device_selector)
+ return;
+
update_sample_rate_selector();
sr_dev_inst *const sdi = get_selected_device();
update_sample_rate_selector();
sr_dev_inst *const sdi = get_selected_device();
+ _session.set_device(sdi);
_configure_button.set_popup(new DeviceOptions(sdi, this));
_configure_button.set_popup(new DeviceOptions(sdi, this));
- _probes_button.set_popup(new Probes(sdi, this));
-
- device_selected();
}
void SamplingBar::on_sample_rate_changed()
}
void SamplingBar::on_sample_rate_changed()