projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
92b139d
)
Update the SigSession device, when it is selected by the user
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Wed, 24 Apr 2013 19:09:15 +0000
(20:09 +0100)
committer
Joel Holdsworth
<joel@airwebreathe.org.uk>
Wed, 24 Apr 2013 19:18:47 +0000
(20:18 +0100)
pv/mainwindow.cpp
patch
|
blob
|
history
pv/mainwindow.h
patch
|
blob
|
history
pv/sigsession.cpp
patch
|
blob
|
history
pv/sigsession.h
patch
|
blob
|
history
pv/toolbars/samplingbar.cpp
patch
|
blob
|
history
pv/toolbars/samplingbar.h
patch
|
blob
|
history
diff --git
a/pv/mainwindow.cpp
b/pv/mainwindow.cpp
index f95cd45123eb1345f56a65160ed7b6268d3b7d18..bd2f5fea99a112fcfa94e848b39cbe5e12d5a73a 100644
(file)
--- a/
pv/mainwindow.cpp
+++ b/
pv/mainwindow.cpp
@@
-177,7
+177,7
@@
void MainWindow::setup_ui()
setMenuBar(_menu_bar);
QMetaObject::connectSlotsByName(this);
setMenuBar(_menu_bar);
QMetaObject::connectSlotsByName(this);
- // Setup the toolbar
s
+ // Setup the toolbar
_toolbar = new QToolBar(this);
_toolbar->addAction(_action_open);
_toolbar->addSeparator();
_toolbar = new QToolBar(this);
_toolbar->addAction(_action_open);
_toolbar->addSeparator();
@@
-185,12
+185,24
@@
void MainWindow::setup_ui()
_toolbar->addAction(_action_view_zoom_out);
addToolBar(_toolbar);
_toolbar->addAction(_action_view_zoom_out);
addToolBar(_toolbar);
+ // Setup the sampling bar
_sampling_bar = new toolbars::SamplingBar(this);
_sampling_bar = new toolbars::SamplingBar(this);
+
+ // Populate the device list and select the initially selected device
scan_devices();
scan_devices();
+ if(!_devices.empty()) {
+ struct sr_dev_inst *const initial_sdi = _devices.front();
+ _sampling_bar->set_selected_device(initial_sdi);
+ _session.set_device(initial_sdi);
+ }
+
+ connect(_sampling_bar, SIGNAL(device_selected()), this,
+ SLOT(device_selected()));
connect(_sampling_bar, SIGNAL(run_stop()), this,
SLOT(run_stop()));
addToolBar(_sampling_bar);
connect(_sampling_bar, SIGNAL(run_stop()), this,
SLOT(run_stop()));
addToolBar(_sampling_bar);
+ // Set the title
setWindowTitle(QApplication::translate("MainWindow", "PulseView", 0,
QApplication::UnicodeUTF8));
setWindowTitle(QApplication::translate("MainWindow", "PulseView", 0,
QApplication::UnicodeUTF8));
@@
-268,6
+280,8
@@
void MainWindow::on_actionConnect_triggered()
_devices.push_back(sdi);
_sampling_bar->set_device_list(_devices);
_sampling_bar->set_selected_device(sdi);
_devices.push_back(sdi);
_sampling_bar->set_device_list(_devices);
_sampling_bar->set_selected_device(sdi);
+
+ _session.set_device(sdi);
}
}
}
}
@@
-303,11
+317,15
@@
void MainWindow::on_actionAbout_triggered()
dlg.exec();
}
dlg.exec();
}
+void MainWindow::device_selected()
+{
+ _session.set_device(_sampling_bar->get_selected_device());
+}
+
void MainWindow::run_stop()
{
switch(_session.get_capture_state()) {
case SigSession::Stopped:
void MainWindow::run_stop()
{
switch(_session.get_capture_state()) {
case SigSession::Stopped:
- _session.set_device(_sampling_bar->get_selected_device());
_session.start_capture(_sampling_bar->get_record_length(),
boost::bind(&MainWindow::session_error, this,
QString("Capture failed"), _1));
_session.start_capture(_sampling_bar->get_record_length(),
boost::bind(&MainWindow::session_error, this,
QString("Capture failed"), _1));
diff --git
a/pv/mainwindow.h
b/pv/mainwindow.h
index 47d3e66d0cad0efa131b7a72b4d796026966eb34..8129020348109ec6c395672f27bfa98995f9f9c3 100644
(file)
--- a/
pv/mainwindow.h
+++ b/
pv/mainwindow.h
@@
-79,6
+79,8
@@
private slots:
void on_actionAbout_triggered();
void on_actionAbout_triggered();
+ void device_selected();
+
void run_stop();
void capture_state_changed(int state);
void run_stop();
void capture_state_changed(int state);
diff --git
a/pv/sigsession.cpp
b/pv/sigsession.cpp
index 131f057de5d881e72d442418dff4952ebef74a27..354082c7262c351a3fe09423761823e7beab302d 100644
(file)
--- a/
pv/sigsession.cpp
+++ b/
pv/sigsession.cpp
@@
-59,11
+59,6
@@
SigSession::~SigSession()
_session = NULL;
}
_session = NULL;
}
-struct sr_dev_inst* SigSession::get_device() const
-{
- return _sdi;
-}
-
void SigSession::set_device(struct sr_dev_inst *sdi)
{
_sdi = sdi;
void SigSession::set_device(struct sr_dev_inst *sdi)
{
_sdi = sdi;
diff --git
a/pv/sigsession.h
b/pv/sigsession.h
index fa2c7af413db55b174ad78ffa85593f409e69975..1978293481423b0dbae4645c6f57d38e98ceb2e1 100644
(file)
--- a/
pv/sigsession.h
+++ b/
pv/sigsession.h
@@
-62,11
+62,6
@@
public:
~SigSession();
~SigSession();
- /**
- * Gets device instance that will be used in the next capture session.
- */
- struct sr_dev_inst* get_device() const;
-
/**
* Sets device instance that will be used in the next capture session.
*/
/**
* Sets device instance that will be used in the next capture session.
*/
diff --git
a/pv/toolbars/samplingbar.cpp
b/pv/toolbars/samplingbar.cpp
index 401652cbe7b251eba52fe6bcd998cd2a98dd80d4..7e052f81cf6c16e77d91307fc956097fff410711 100644
(file)
--- a/
pv/toolbars/samplingbar.cpp
+++ b/
pv/toolbars/samplingbar.cpp
@@
-283,6
+283,7
@@
void SamplingBar::commit_sample_rate()
void SamplingBar::on_device_selected()
{
update_sample_rate_selector();
void SamplingBar::on_device_selected()
{
update_sample_rate_selector();
+ device_selected();
}
void SamplingBar::on_sample_rate_changed()
}
void SamplingBar::on_sample_rate_changed()
diff --git
a/pv/toolbars/samplingbar.h
b/pv/toolbars/samplingbar.h
index a61a949eabc0ef8538d9c2ac0fa5343f81cfccf7..d24534bef185867883ec9657b5360011b1bafebb 100644
(file)
--- a/
pv/toolbars/samplingbar.h
+++ b/
pv/toolbars/samplingbar.h
@@
-57,6
+57,8
@@
public:
void set_sampling(bool sampling);
signals:
void set_sampling(bool sampling);
signals:
+ void device_selected();
+
void run_stop();
private:
void run_stop();
private: