PulseView  0.3.0
A Qt-based sigrok GUI
pv::view::View Class Reference

#include <view.hpp>

Inheritance diagram for pv::view::View:
Collaboration diagram for pv::view::View:

Public Slots

void trigger_event (util::Timestamp location)
 

Signals

void hover_point_changed ()
 
void selection_changed ()
 
void offset_changed ()
 Emitted when the offset changed. More...
 
void scale_changed ()
 Emitted when the scale changed. More...
 
void sticky_scrolling_changed (bool state)
 
void always_zoom_to_fit_changed (bool state)
 
void tick_prefix_changed ()
 Emitted when the tick_prefix changed. More...
 
void tick_precision_changed ()
 Emitted when the tick_precision changed. More...
 
void tick_period_changed ()
 Emitted when the tick_period changed. More...
 
void time_unit_changed ()
 Emitted when the time_unit changed. More...
 

Public Member Functions

 View (Session &session, QWidget *parent=0)
 
Sessionsession ()
 
const Sessionsession () const
 
virtual pv::view::Viewview ()
 
virtual const pv::view::Viewview () const
 
Viewportviewport ()
 
const Viewportviewport () const
 
std::vector< std::shared_ptr< TimeItem > > time_items () const
 
double scale () const
 
const pv::util::Timestampoffset () const
 
int owner_visual_v_offset () const
 
void set_v_offset (int offset)
 
pv::util::SIPrefix tick_prefix () const
 
unsigned int tick_precision () const
 
const pv::util::Timestamptick_period () const
 
util::TimeUnit time_unit () const
 
unsigned int depth () const
 
void zoom (double steps)
 
void zoom (double steps, int offset)
 
void zoom_fit (bool gui_state)
 
void zoom_one_to_one ()
 
void set_scale_offset (double scale, const pv::util::Timestamp &offset)
 
std::set< std::shared_ptr< pv::data::SignalData > > get_visible_data () const
 
std::pair< pv::util::Timestamp, pv::util::Timestampget_time_extents () const
 
void enable_sticky_scrolling (bool state)
 
void enable_coloured_bg (bool state)
 
bool cursors_shown () const
 
void show_cursors (bool show=true)
 
void centre_cursors ()
 
std::shared_ptr< CursorPaircursors () const
 
void add_flag (const pv::util::Timestamp &time)
 
void remove_flag (std::shared_ptr< Flag > flag)
 
std::vector< std::shared_ptr< Flag > > flags () const
 
const QPoint & hover_point () const
 
void update_viewport ()
 
void restack_all_trace_tree_items ()
 
void row_item_appearance_changed (bool label, bool content)
 
void time_item_appearance_changed (bool label, bool content)
 
void extents_changed (bool horz, bool vert)
 
- Public Member Functions inherited from pv::view::TraceTreeItemOwner
virtual const item_listchild_items () const
 
std::vector< std::shared_ptr< TraceTreeItem > > trace_tree_child_items () const
 
void clear_child_items ()
 
void add_child_item (std::shared_ptr< TraceTreeItem > item)
 
void remove_child_item (std::shared_ptr< TraceTreeItem > item)
 
virtual void restack_items ()
 
std::pair< int, int > v_extents () const
 
bool reassign_bgcolour_states (bool next_bgcolour_state)
 
- Public Member Functions inherited from pv::view::ViewItemOwner
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
template<class T >
std::vector< std::shared_ptr< T > > list_by_type ()
 

Private Types

enum  StickyEvents { TraceTreeItemHExtentsChanged = 1, TraceTreeItemVExtentsChanged = 2 }
 

Private Slots

void h_scroll_value_changed (int value)
 
void v_scroll_value_changed ()
 
void signals_changed ()
 
void capture_state_updated (int state)
 
void data_updated ()
 
void perform_delayed_view_update ()
 
void process_sticky_events ()
 
void on_hover_point_changed ()
 
void set_offset (const pv::util::Timestamp &offset)
 
void set_scale (double scale)
 
void set_tick_prefix (pv::util::SIPrefix tick_prefix)
 
void set_tick_precision (unsigned tick_precision)
 
void set_tick_period (const pv::util::Timestamp &tick_period)
 
void set_time_unit (pv::util::TimeUnit time_unit)
 

Private Member Functions

void get_scroll_layout (double &length, pv::util::Timestamp &offset) const
 
void set_zoom (double scale, int offset)
 
void calculate_tick_spacing ()
 
void update_scroll ()
 
void update_layout ()
 
void paint_label (QPainter &p, const QRect &rect, bool hover)
 
QRectF label_rect (const QRectF &rect)
 
TraceTreeItemOwnerfind_prevalent_trace_group (const std::shared_ptr< sigrok::ChannelGroup > &group, const std::unordered_map< std::shared_ptr< sigrok::Channel >, std::shared_ptr< Signal > > &signal_map)
 
void determine_time_unit ()
 
bool eventFilter (QObject *object, QEvent *event)
 
bool viewportEvent (QEvent *e)
 
void resizeEvent (QResizeEvent *e)
 

Static Private Member Functions

static std::vector< std::shared_ptr< Trace > > extract_new_traces_for_channels (const std::vector< std::shared_ptr< sigrok::Channel > > &channels, const std::unordered_map< std::shared_ptr< sigrok::Channel >, std::shared_ptr< Signal > > &signal_map, std::set< std::shared_ptr< Trace > > &add_list)
 

Private Attributes

Sessionsession_
 
Viewportviewport_
 
Rulerruler_
 
Headerheader_
 
double scale_
 The view time scale in seconds per pixel. More...
 
pv::util::Timestamp offset_
 The view time offset in seconds. More...
 
bool updating_scroll_
 
bool sticky_scrolling_
 
bool always_zoom_to_fit_
 
QTimer delayed_view_updater_
 
pv::util::Timestamp tick_period_
 
pv::util::SIPrefix tick_prefix_
 
unsigned int tick_precision_
 
util::TimeUnit time_unit_
 
bool show_cursors_
 
std::shared_ptr< CursorPaircursors_
 
std::list< std::shared_ptr< Flag > > flags_
 
char next_flag_text_
 
std::vector< std::shared_ptr< TriggerMarker > > trigger_markers_
 
QPoint hover_point_
 
unsigned int sticky_events_
 
QTimer lazy_event_handler_
 

Static Private Attributes

static const pv::util::Timestamp MaxScale
 
static const pv::util::Timestamp MinScale
 
static const int MaxScrollValue = INT_MAX / 2
 
static const int MaxViewAutoUpdateRate = 25
 
static const int ScaleUnits [3] = {1, 2, 5}
 

Additional Inherited Members

- Public Types inherited from pv::view::ViewItemOwner
typedef std::vector< std::shared_ptr< ViewItem > > item_list
 
typedef ViewItemIterator< ViewItemOwner, ViewItemiterator
 
typedef ViewItemIterator< const ViewItemOwner, ViewItemconst_iterator
 
- Protected Attributes inherited from pv::view::ViewItemOwner
item_list items_
 

Detailed Description

Definition at line 60 of file view.hpp.

Member Enumeration Documentation

Enumerator
TraceTreeItemHExtentsChanged 
TraceTreeItemVExtentsChanged 

Definition at line 64 of file view.hpp.

Constructor & Destructor Documentation

pv::view::View::View ( Session session,
QWidget *  parent = 0 
)
explicit

Definition at line 101 of file view.cpp.

Here is the call graph for this function:

Member Function Documentation

void pv::view::View::add_flag ( const pv::util::Timestamp time)

Adds a new flag at a specified time.

Definition at line 492 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::always_zoom_to_fit_changed ( bool  state)
signal

Definition at line 338 of file moc_view.cpp.

Here is the caller graph for this function:

void pv::view::View::calculate_tick_spacing ( )
private

Find a tick spacing and number formatting that does not cause the values to collide.

Definition at line 585 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::capture_state_updated ( int  state)
privateslot

Definition at line 1048 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::centre_cursors ( )

Moves the cursors to a convenient position in the view.

Definition at line 478 of file view.cpp.

Here is the caller graph for this function:

std::shared_ptr< CursorPair > pv::view::View::cursors ( ) const

Returns a reference to the pair of cursors.

Definition at line 487 of file view.cpp.

Here is the caller graph for this function:

bool pv::view::View::cursors_shown ( ) const

Returns true if cursors are displayed. false otherwise.

Definition at line 466 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::data_updated ( )
privateslot

Definition at line 1069 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int pv::view::View::depth ( ) const
virtual

Returns the number of nested parents that this row item owner has.

Implements pv::view::TraceTreeItemOwner.

Definition at line 258 of file view.cpp.

void pv::view::View::determine_time_unit ( )
private

Definition at line 778 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::enable_coloured_bg ( bool  state)

Enables or disables coloured trace backgrounds. If they're not coloured then they will use alternating colors.

Definition at line 441 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::enable_sticky_scrolling ( bool  state)

Enables or disables sticky scrolling, i.e. the view always shows the most recent samples when capturing data.

Definition at line 436 of file view.cpp.

Here is the caller graph for this function:

bool pv::view::View::eventFilter ( QObject object,
QEvent *  event 
)
private

Definition at line 799 of file view.cpp.

void pv::view::View::extents_changed ( bool  horz,
bool  vert 
)
virtual

Implements pv::view::TraceTreeItemOwner.

Definition at line 863 of file view.cpp.

vector< shared_ptr< Trace > > pv::view::View::extract_new_traces_for_channels ( const std::vector< std::shared_ptr< sigrok::Channel > > &  channels,
const std::unordered_map< std::shared_ptr< sigrok::Channel >, std::shared_ptr< Signal > > &  signal_map,
std::set< std::shared_ptr< Trace > > &  add_list 
)
staticprivate

Definition at line 753 of file view.cpp.

Here is the caller graph for this function:

TraceTreeItemOwner * pv::view::View::find_prevalent_trace_group ( const std::shared_ptr< sigrok::ChannelGroup > &  group,
const std::unordered_map< std::shared_ptr< sigrok::Channel >, std::shared_ptr< Signal > > &  signal_map 
)
private

Definition at line 716 of file view.cpp.

Here is the caller graph for this function:

vector< std::shared_ptr< Flag > > pv::view::View::flags ( ) const

Gets the list of flags.

Definition at line 509 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::get_scroll_layout ( double &  length,
pv::util::Timestamp offset 
) const
private

Definition at line 566 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

pair< Timestamp, Timestamp > pv::view::View::get_time_extents ( ) const

Definition at line 408 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

set< shared_ptr< SignalData > > pv::view::View::get_visible_data ( ) const

Definition at line 395 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::h_scroll_value_changed ( int  value)
privateslot

Definition at line 871 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

const QPoint & pv::view::View::hover_point ( ) const

Definition at line 520 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::hover_point_changed ( )
signal

Definition at line 307 of file moc_view.cpp.

Here is the caller graph for this function:

QRectF pv::view::View::label_rect ( const QRectF &  rect)
private

Computes the outline rectangle of a label.

Parameters
rectthe rectangle of the header area.
Returns
Returns the rectangle of the signal label.

Definition at line 710 of file view.cpp.

const Timestamp & pv::view::View::offset ( ) const

Returns the time offset of the left edge of the view in seconds.

Definition at line 233 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::offset_changed ( )
signal

Emitted when the offset changed.

Definition at line 319 of file moc_view.cpp.

Here is the caller graph for this function:

void pv::view::View::on_hover_point_changed ( )
privateslot

Definition at line 1118 of file view.cpp.

Here is the caller graph for this function:

int pv::view::View::owner_visual_v_offset ( ) const
virtual

Returns the vertical scroll offset.

Implements pv::view::TraceTreeItemOwner.

Definition at line 246 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::paint_label ( QPainter &  p,
const QRect &  rect,
bool  hover 
)
private

Satisifies TraceTreeItem functionality.

Parameters
pthe QPainter to paint into.
rectthe rectangle of the header area.
hovertrue if the label is being hovered over by the mouse.

Definition at line 703 of file view.cpp.

void pv::view::View::perform_delayed_view_update ( )
privateslot

Definition at line 1082 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::process_sticky_events ( )
privateslot

Definition at line 1105 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::remove_flag ( std::shared_ptr< Flag flag)

Removes a flag from the list.

Definition at line 503 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::resizeEvent ( QResizeEvent *  e)
private

Definition at line 842 of file view.cpp.

Here is the call graph for this function:

void pv::view::View::restack_all_trace_tree_items ( )

Definition at line 532 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::row_item_appearance_changed ( bool  label,
bool  content 
)
virtual

Implements pv::view::TraceTreeItemOwner.

Definition at line 847 of file view.cpp.

double pv::view::View::scale ( ) const

Returns the view time scale in seconds per pixel.

Definition at line 220 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::scale_changed ( )
signal

Emitted when the scale changed.

Definition at line 325 of file moc_view.cpp.

Here is the caller graph for this function:

void pv::view::View::selection_changed ( )
signal

Definition at line 313 of file moc_view.cpp.

Here is the caller graph for this function:

Session & pv::view::View::session ( )
virtual

Returns the session of the onwer.

Implements pv::view::TraceTreeItemOwner.

Definition at line 176 of file view.cpp.

Here is the caller graph for this function:

const Session & pv::view::View::session ( ) const
virtual

Returns the session of the owner.

Implements pv::view::TraceTreeItemOwner.

Definition at line 181 of file view.cpp.

void pv::view::View::set_offset ( const pv::util::Timestamp offset)
privateslot

Sets the 'offset_' member and emits the 'offset_changed' signal if needed.

Definition at line 238 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::set_scale ( double  scale)
privateslot

Sets the 'scale_' member and emits the 'scale_changed' signal if needed.

Definition at line 225 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::set_scale_offset ( double  scale,
const pv::util::Timestamp offset 
)

Sets the scale and offset.

Parameters
scaleThe new view scale in seconds per pixel.
offsetThe view time offset in seconds.

Definition at line 367 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::set_tick_period ( const pv::util::Timestamp tick_period)
privateslot

Sets the 'tick_period_' member and emits the 'tick_period_changed' signal if needed.

Definition at line 294 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::set_tick_precision ( unsigned  tick_precision)
privateslot

Sets the 'tick_precision_' member and emits the 'tick_precision_changed' signal if needed.

Definition at line 281 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::set_tick_prefix ( pv::util::SIPrefix  tick_prefix)
privateslot

Sets the 'tick_prefix_' member and emits the 'tick_prefix_changed' signal if needed.

Definition at line 268 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::set_time_unit ( pv::util::TimeUnit  time_unit)
privateslot

Sets the 'time_unit' member and emits the 'time_unit_changed' signal if needed.

Definition at line 307 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::set_v_offset ( int  offset)

Sets the visual v-offset.

Definition at line 251 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::set_zoom ( double  scale,
int  offset 
)
private

Simultaneously sets the zoom and offset.

Parameters
scaleThe scale to set the view to in seconds per pixel. This value is clamped between MinScale and MaxScale.
offsetThe offset of the left edge of the view in seconds.

Definition at line 573 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::show_cursors ( bool  show = true)

Shows or hides the cursors.

Definition at line 471 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::signals_changed ( )
privateslot

Definition at line 903 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::sticky_scrolling_changed ( bool  state)
signal

Definition at line 331 of file moc_view.cpp.

Here is the caller graph for this function:

const pv::util::Timestamp & pv::view::View::tick_period ( ) const

Returns period of the graticule time markings.

Definition at line 289 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::tick_period_changed ( )
signal

Emitted when the tick_period changed.

Definition at line 357 of file moc_view.cpp.

Here is the caller graph for this function:

unsigned int pv::view::View::tick_precision ( ) const

Returns the number of fractional digits shown for the time markings.

Definition at line 276 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::tick_precision_changed ( )
signal

Emitted when the tick_precision changed.

Definition at line 351 of file moc_view.cpp.

Here is the caller graph for this function:

pv::util::SIPrefix pv::view::View::tick_prefix ( ) const

Returns the SI prefix to apply to the graticule time markings.

Definition at line 263 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::tick_prefix_changed ( )
signal

Emitted when the tick_prefix changed.

Definition at line 345 of file moc_view.cpp.

Here is the caller graph for this function:

void pv::view::View::time_item_appearance_changed ( bool  label,
bool  content 
)

Definition at line 855 of file view.cpp.

Here is the caller graph for this function:

vector< shared_ptr< TimeItem > > pv::view::View::time_items ( ) const

Gets a list of time markers.

Definition at line 206 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

TimeUnit pv::view::View::time_unit ( ) const

Returns the unit of time currently used.

Definition at line 302 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::time_unit_changed ( )
signal

Emitted when the time_unit changed.

Definition at line 363 of file moc_view.cpp.

Here is the caller graph for this function:

void pv::view::View::trigger_event ( util::Timestamp  location)
slot

Definition at line 560 of file view.cpp.

void pv::view::View::update_layout ( )
private

Definition at line 691 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::update_scroll ( )
private

Definition at line 652 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::update_viewport ( )

Definition at line 525 of file view.cpp.

void pv::view::View::v_scroll_value_changed ( )
privateslot

Definition at line 897 of file view.cpp.

Here is the caller graph for this function:

View * pv::view::View::view ( )
virtual

Returns the view of the owner.

Implements pv::view::TraceTreeItemOwner.

Definition at line 186 of file view.cpp.

const View * pv::view::View::view ( ) const
virtual

Returns the view of the owner.

Implements pv::view::TraceTreeItemOwner.

Definition at line 191 of file view.cpp.

Viewport * pv::view::View::viewport ( )

Definition at line 196 of file view.cpp.

Here is the caller graph for this function:

const Viewport * pv::view::View::viewport ( ) const

Definition at line 201 of file view.cpp.

bool pv::view::View::viewportEvent ( QEvent *  e)
private

Definition at line 824 of file view.cpp.

void pv::view::View::zoom ( double  steps)

Definition at line 315 of file view.cpp.

Here is the caller graph for this function:

void pv::view::View::zoom ( double  steps,
int  offset 
)

Definition at line 320 of file view.cpp.

Here is the call graph for this function:

void pv::view::View::zoom_fit ( bool  gui_state)

Definition at line 325 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::view::View::zoom_one_to_one ( )

Definition at line 350 of file view.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

bool pv::view::View::always_zoom_to_fit_
private

Definition at line 379 of file view.hpp.

std::shared_ptr<CursorPair> pv::view::View::cursors_
private

Definition at line 388 of file view.hpp.

QTimer pv::view::View::delayed_view_updater_
private

Definition at line 380 of file view.hpp.

std::list< std::shared_ptr<Flag> > pv::view::View::flags_
private

Definition at line 390 of file view.hpp.

Header* pv::view::View::header_
private

Definition at line 369 of file view.hpp.

QPoint pv::view::View::hover_point_
private

Definition at line 395 of file view.hpp.

QTimer pv::view::View::lazy_event_handler_
private

Definition at line 398 of file view.hpp.

const Timestamp pv::view::View::MaxScale
staticprivate

Definition at line 70 of file view.hpp.

const int pv::view::View::MaxScrollValue = INT_MAX / 2
staticprivate

Definition at line 73 of file view.hpp.

const int pv::view::View::MaxViewAutoUpdateRate = 25
staticprivate

Definition at line 74 of file view.hpp.

const Timestamp pv::view::View::MinScale
staticprivate

Definition at line 71 of file view.hpp.

char pv::view::View::next_flag_text_
private

Definition at line 391 of file view.hpp.

pv::util::Timestamp pv::view::View::offset_
private

The view time offset in seconds.

Definition at line 375 of file view.hpp.

Ruler* pv::view::View::ruler_
private

Definition at line 368 of file view.hpp.

double pv::view::View::scale_
private

The view time scale in seconds per pixel.

Definition at line 372 of file view.hpp.

const int pv::view::View::ScaleUnits = {1, 2, 5}
staticprivate

Definition at line 76 of file view.hpp.

Session& pv::view::View::session_
private

Definition at line 365 of file view.hpp.

bool pv::view::View::show_cursors_
private

Definition at line 387 of file view.hpp.

unsigned int pv::view::View::sticky_events_
private

Definition at line 397 of file view.hpp.

bool pv::view::View::sticky_scrolling_
private

Definition at line 378 of file view.hpp.

pv::util::Timestamp pv::view::View::tick_period_
private

Definition at line 382 of file view.hpp.

unsigned int pv::view::View::tick_precision_
private

Definition at line 384 of file view.hpp.

pv::util::SIPrefix pv::view::View::tick_prefix_
private

Definition at line 383 of file view.hpp.

util::TimeUnit pv::view::View::time_unit_
private

Definition at line 385 of file view.hpp.

std::vector< std::shared_ptr<TriggerMarker> > pv::view::View::trigger_markers_
private

Definition at line 393 of file view.hpp.

bool pv::view::View::updating_scroll_
private

Definition at line 377 of file view.hpp.

Viewport* pv::view::View::viewport_
private

Definition at line 367 of file view.hpp.


The documentation for this class was generated from the following files: