, menu_decoders_add_(new pv::widgets::DecoderMenu(this, true))
#endif
{
+ qRegisterMetaType<util::Timestamp>("util::Timestamp");
+
setup_ui();
restore_ui_settings();
if (open_file_name.empty())
SLOT(capture_state_changed(int)));
connect(&session_, SIGNAL(device_selected()), this,
SLOT(device_selected()));
+ connect(&session_, SIGNAL(trigger_event(util::Timestamp)), view_,
+ SLOT(trigger_event(util::Timestamp)));
// Setup view_ events
connect(view_, SIGNAL(sticky_scrolling_changed(bool)), this,
SLOT(sticky_scrolling_changed(bool)));
connect(view_, SIGNAL(always_zoom_to_fit_changed(bool)), this,
SLOT(always_zoom_to_fit_changed(bool)));
+
}
void MainWindow::select_init_device() {
signals_changed();
}
+void Session::feed_in_trigger()
+{
+ // The channel containing most samples should be most accurate
+ uint64_t sample_count = 0;
+
+ for (const shared_ptr<pv::data::SignalData> d : get_data()) {
+ assert(d);
+ uint64_t temp_count = 0;
+
+ const vector< shared_ptr<pv::data::Segment> > segments =
+ d->segments();
+ for (const shared_ptr<pv::data::Segment> &s : segments)
+ temp_count += s->get_sample_count();
+
+ if (temp_count > sample_count)
+ sample_count = temp_count;
+ }
+
+ trigger_event(sample_count / get_samplerate());
+}
+
void Session::feed_in_frame_begin()
{
if (cur_logic_segment_ || !cur_analog_segments_.empty())
feed_in_meta(dynamic_pointer_cast<Meta>(packet->payload()));
break;
+ case SR_DF_TRIGGER:
+ feed_in_trigger();
+ break;
+
case SR_DF_FRAME_BEGIN:
feed_in_frame_begin();
break;
#include <QObject>
#include <QString>
+#include "util.hpp"
+
struct srd_decoder;
struct srd_channel;
void feed_in_meta(std::shared_ptr<sigrok::Meta> meta);
+ void feed_in_trigger();
+
void feed_in_frame_begin();
void feed_in_logic(std::shared_ptr<sigrok::Logic> logic);
void signals_changed();
+ void trigger_event(util::Timestamp location);
+
void frame_began();
void data_received();
view_.time_item_appearance_changed(true, false);
}
+void Flag::drag_by(const QPoint &delta)
+{
+ // Treat trigger markers as immovable
+ if (text_ == "T")
+ return;
+
+ TimeMarker::drag_by(delta);
+}
+
+
} // namespace view
} // namespace pv
void delete_pressed();
+ void drag_by(const QPoint &delta);
+
private Q_SLOTS:
void on_delete();
{
flags_.push_back(shared_ptr<Flag>(new Flag(*this, time,
QString("%1").arg(next_flag_text_))));
+
next_flag_text_ = (next_flag_text_ >= 'Z') ? 'A' :
(next_flag_text_ + 1);
+
+ // Skip 'T' (for trigger) as it's treated special
+ if (next_flag_text_ == 'T')
+ next_flag_text_ += 1;
+
time_item_appearance_changed(true, true);
}
i->animate_to_layout_v_offset();
}
+void View::trigger_event(util::Timestamp location)
+{
+ char next_flag_text = next_flag_text_;
+
+ next_flag_text_ = 'T';
+ add_flag(location);
+
+ next_flag_text_ = next_flag_text;
+}
+
void View::get_scroll_layout(double &length, Timestamp &offset) const
{
const pair<Timestamp, Timestamp> extents = get_time_extents();
/// Emitted when the time_unit changed.
void time_unit_changed();
+public Q_SLOTS:
+ void trigger_event(util::Timestamp location);
+
private:
void get_scroll_layout(double &length, pv::util::Timestamp &offset) const;