_menu_file->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8));
_menu_view->setTitle(QApplication::translate("MainWindow", "&View", 0, QApplication::UnicodeUTF8));
_menu_help->setTitle(QApplication::translate("MainWindow", "&Help", 0, QApplication::UnicodeUTF8));
+
+ // Setup _session events
+ connect(&_session, SIGNAL(capture_state_changed(int)), this,
+ SLOT(capture_state_changed(int)));
+
}
void MainWindow::on_actionOpen_triggered()
}
}
+void MainWindow::capture_state_changed(int state)
+{
+ _sampling_bar->set_sampling(state != SigSession::Stopped);
+}
+
} // namespace pv
void on_actionAbout_triggered();
void run_stop();
+
+ void capture_state_changed(int state);
};
} // namespace pv
g_free(text);
}
- _run_stop_button.setText("Run");
+ set_sampling(false);
addWidget(&_device_selector);
addWidget(&_record_length_selector);
return 0;
}
+void SamplingBar::set_sampling(bool sampling)
+{
+ _run_stop_button.setText(sampling ? "Stop" : "Run");
+}
+
void SamplingBar::update_device_selector()
{
GSList *devices = NULL;
uint64_t get_record_length() const;
uint64_t get_sample_rate() const;
+ void set_sampling(bool sampling);
+
signals:
void run_stop();
if(_sampling_thread.get())
_sampling_thread->join();
_sampling_thread.reset();
-
- _capture_state = Stopped;
}
vector< shared_ptr<view::Signal> > SigSession::get_signals()
return _logic_data;
}
+void SigSession::set_capture_state(capture_state state)
+{
+ lock_guard<mutex> lock(_state_mutex);
+ _capture_state = state;
+ capture_state_changed(state);
+}
+
void SigSession::sample_thread_proc(struct sr_dev_inst *sdi,
uint64_t record_length, uint64_t sample_rate)
{
return;
}
- {
- lock_guard<mutex> lock(_state_mutex);
- _capture_state = Running;
- }
+ set_capture_state(Running);
sr_session_run();
sr_session_destroy();
+
+ set_capture_state(Stopped);
}
void SigSession::data_feed_in(const struct sr_dev_inst *sdi,
boost::shared_ptr<LogicData> get_data();
+private:
+ void set_capture_state(capture_state state);
+
private:
void sample_thread_proc(struct sr_dev_inst *sdi,
uint64_t record_length, uint64_t sample_rate);
std::auto_ptr<boost::thread> _sampling_thread;
signals:
+ void capture_state_changed(int state);
+
void signals_changed();
void data_updated();