}
}
+void MainWindow::run_stop()
+{
+ switch(session_.get_capture_state()) {
+ case SigSession::Stopped:
+ session_.start_capture([&](QString message) {
+ session_error("Capture failed", message); });
+ break;
+
+ case SigSession::AwaitingTrigger:
+ case SigSession::Running:
+ session_.stop_capture();
+ break;
+ }
+}
+
void MainWindow::setup_ui()
{
setObjectName(QString::fromUtf8("MainWindow"));
addToolBar(toolbar);
// Setup the sampling bar
- sampling_bar_ = new toolbars::SamplingBar(session_, this);
+ sampling_bar_ = new toolbars::SamplingBar(session_, *this);
// Populate the device list and select the initially selected device
update_device_list();
- connect(sampling_bar_, SIGNAL(run_stop()), this,
- SLOT(run_stop()));
addToolBar(sampling_bar_);
// Set the title
#endif
}
-void MainWindow::run_stop()
-{
- switch(session_.get_capture_state()) {
- case SigSession::Stopped:
- session_.start_capture([&](QString message) {
- session_error("Capture failed", message); });
- break;
-
- case SigSession::AwaitingTrigger:
- case SigSession::Running:
- session_.stop_capture();
- break;
- }
-}
-
void MainWindow::capture_state_changed(int state)
{
sampling_bar_->set_capture_state((pv::SigSession::capture_state)state);
#include "samplingbar.hpp"
#include <pv/devicemanager.hpp>
+#include <pv/mainwindow.hpp>
#include <pv/popups/deviceoptions.hpp>
#include <pv/popups/channels.hpp>
#include <pv/util.hpp>
const uint64_t SamplingBar::MaxSampleCount = 1000000000000ULL;
const uint64_t SamplingBar::DefaultSampleCount = 1000000;
-SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
- QToolBar("Sampling Bar", parent),
+SamplingBar::SamplingBar(SigSession &session, MainWindow &main_window) :
+ QToolBar("Sampling Bar", &main_window),
session_(session),
+ main_window_(main_window),
device_selector_(this),
updating_device_selector_(false),
configure_button_(this),
{
commit_sample_count();
commit_sample_rate();
- run_stop();
+ main_window_.run_stop();
}
void SamplingBar::on_config_changed()
namespace pv {
+class MainWindow;
class SigSession;
namespace toolbars {
static const uint64_t DefaultSampleCount;
public:
- SamplingBar(SigSession &session, QWidget *parent);
+ SamplingBar(SigSession &session, pv::MainWindow &main_window);
void set_device_list(
const std::list< std::pair<std::shared_ptr<sigrok::Device>, std::string> > &devices,
private:
SigSession &session_;
+ MainWindow &main_window_;
QComboBox device_selector_;
bool updating_device_selector_;