kwave
18.07.70
|
#include <SignalWidget.h>
Public Slots | |
void | requestRepaint (Kwave::SignalView *view) |
void | forwardCommand (const QString &command) |
Signals | |
void | sigRepaint () |
void | selectedTimeInfo (sample_index_t offset, sample_index_t length, double rate) |
void | sigCommand (const QString &command) |
void | sigCursorChanged (sample_index_t pos) |
Public Member Functions | |
SignalWidget (QWidget *parent, Kwave::SignalManager *signal_manager, QVBoxLayout *upper_dock, QVBoxLayout *lower_dock) | |
virtual | ~SignalWidget () Q_DECL_OVERRIDE |
void | setZoomAndOffset (double zoom, sample_index_t offset) |
int | mapToViewPort (const QPoint &pos) const |
int | visibleWidth () const |
virtual void | insertView (Kwave::SignalView *view, QWidget *controls) Q_DECL_OVERRIDE |
![]() | |
virtual | ~ViewManager () |
Protected Slots | |
virtual void | contextMenuEvent (QContextMenuEvent *e) Q_DECL_OVERRIDE |
Protected Member Functions | |
virtual void | wheelEvent (QWheelEvent *event) Q_DECL_OVERRIDE |
Private Slots | |
void | repaintTimerElapsed () |
void | slotTrackInserted (unsigned int index, Kwave::Track *track) |
void | slotTrackDeleted (unsigned int index, Kwave::Track *track) |
void | contextMenuEditUndo () |
void | contextMenuEditRedo () |
void | contextMenuEditCut () |
void | contextMenuEditCopy () |
void | contextMenuEditPaste () |
void | contextMenuSaveSelection () |
void | contextMenuSelectionExpandToLabels () |
void | contextMenuSelectionNextLabels () |
void | contextMenuSelectionPrevLabels () |
void | updateMinimumHeight () |
Private Member Functions | |
void | setVerticalZoom (double zoom) |
void | insertRow (int index, Kwave::SignalView *view, QWidget *controls) |
void | deleteRow (int index) |
Private Attributes | |
Kwave::SignalManager * | m_signal_manager |
QList< QPointer< Kwave::SignalView > > | m_views |
QGridLayout | m_layout |
QPointer< QVBoxLayout > | m_upper_dock |
QPointer< QVBoxLayout > | m_lower_dock |
sample_index_t | m_offset |
double | m_zoom |
double | m_vertical_zoom |
QTimer | m_repaint_timer |
QQueue< QPointer< Kwave::SignalView > > | m_repaint_queue |
The SignalWidget class is responsible for displaying and managing the views that belong to a signal.
Definition at line 75 of file SignalWidget.h.
Kwave::SignalWidget::SignalWidget | ( | QWidget * | parent, |
Kwave::SignalManager * | signal_manager, | ||
QVBoxLayout * | upper_dock, | ||
QVBoxLayout * | lower_dock | ||
) |
Constructor
parent | parent widget |
signal_manager | signal manager of the file context |
upper_dock | layout of the upper docking area |
lower_dock | layout of the lower docking area |
Definition at line 83 of file SignalWidget.cpp.
References Kwave::connect(), m_layout, m_repaint_timer, m_signal_manager, repaintTimerElapsed(), slotTrackDeleted(), and slotTrackInserted().
|
virtual |
|
inlineprivateslot |
context menu: "edit/copy"
Definition at line 182 of file SignalWidget.h.
References _.
Referenced by contextMenuEvent().
|
inlineprivateslot |
context menu: "edit/cut"
Definition at line 179 of file SignalWidget.h.
References _.
Referenced by contextMenuEvent().
|
inlineprivateslot |
context menu: "edit/paste"
Definition at line 185 of file SignalWidget.h.
References _.
Referenced by contextMenuEvent().
|
inlineprivateslot |
context menu: "edit/redo"
Definition at line 176 of file SignalWidget.h.
References _.
Referenced by contextMenuEvent().
|
inlineprivateslot |
context menu: "edit/undo"
Definition at line 173 of file SignalWidget.h.
References _.
Referenced by contextMenuEvent().
|
protectedvirtualslot |
Handler for context menus
Definition at line 177 of file SignalWidget.cpp.
References _, Kwave::SignalManager::canRedo(), Kwave::SignalManager::canUndo(), Kwave::connect(), contextMenuEditCopy(), contextMenuEditCut(), contextMenuEditPaste(), contextMenuEditRedo(), contextMenuEditUndo(), contextMenuSaveSelection(), contextMenuSelectionExpandToLabels(), contextMenuSelectionNextLabels(), contextMenuSelectionPrevLabels(), forwardCommand(), Kwave::ClipBoard::instance(), Kwave::SignalManager::isEmpty(), Kwave::Selection::length(), m_signal_manager, m_views, Kwave::SignalManager::metaData(), Kwave::SignalManager::selection(), and sigCommand().
|
inlineprivateslot |
context menu: "save selection"
Definition at line 188 of file SignalWidget.h.
References _.
Referenced by contextMenuEvent().
|
inlineprivateslot |
context menu: "expand to labels"
Definition at line 193 of file SignalWidget.h.
References _.
Referenced by contextMenuEvent().
|
inlineprivateslot |
context menu: "select next labels"
Definition at line 198 of file SignalWidget.h.
References _.
Referenced by contextMenuEvent().
|
inlineprivateslot |
context menu: "select previous labels"
Definition at line 203 of file SignalWidget.h.
References _.
Referenced by contextMenuEvent().
|
private |
delete a row in the m_layout, shifting all following rows back to the start by one
index | the index if the row |
Definition at line 416 of file SignalWidget.cpp.
References m_layout.
Referenced by slotTrackDeleted().
|
slot |
forward a sigCommand to the next layer
Definition at line 145 of file SignalWidget.cpp.
References sigCommand().
Referenced by contextMenuEvent().
|
private |
insert a row in the m_layout, shifting all following rows to the end by one
index | the index if the row |
view | a view widget, must not be null |
controls | a widget with controls, can be null |
Definition at line 375 of file SignalWidget.cpp.
References Kwave::SignalView::addSibling(), and m_layout.
Referenced by insertView().
|
virtual |
Insert a new signal view into this widget (or the upper/lower dock area.
view | the signal view, must not be a null pointer |
controls | a widget with controls, optionally, can be null |
Implements Kwave::ViewManager.
Definition at line 437 of file SignalWidget.cpp.
References Kwave::SignalView::AboveTrackBottom, Kwave::SignalView::AboveTrackTop, Kwave::SignalView::BelowTrackBottom, Kwave::SignalView::BelowTrackTop, Kwave::SignalView::Bottom, Kwave::connect(), insertRow(), Kwave::SignalView::LowerDockBottom, Kwave::SignalView::LowerDockTop, m_layout, m_lower_dock, m_offset, m_upper_dock, m_vertical_zoom, m_views, m_zoom, Kwave::SignalView::preferredLocation(), requestRepaint(), Kwave::SignalView::setVerticalZoom(), Kwave::SignalView::setZoomAndOffset(), sigCommand(), sigCursorChanged(), Kwave::SignalView::Top, Kwave::SignalView::track(), updateMinimumHeight(), Kwave::SignalView::UpperDockBottom, and Kwave::SignalView::UpperDockTop.
Referenced by slotTrackInserted().
int Kwave::SignalWidget::mapToViewPort | ( | const QPoint & | pos | ) | const |
Returns the x coordinate of an absolute pixel position to a relative coordinate within the viewport area (without controls)
Definition at line 361 of file SignalWidget.cpp.
References m_layout, and m_views.
Referenced by Kwave::MainWidget::wheelEvent().
|
privateslot |
called when the repaint timer has elapsed, to refresh all views that have requested a repaint and are in the repaint queue
Definition at line 166 of file SignalWidget.cpp.
References m_repaint_queue, and Kwave::SignalView::refresh().
Referenced by SignalWidget().
|
slot |
can be called by views to request a repaint, synchronized and throttled through our repaint timer
Definition at line 151 of file SignalWidget.cpp.
References m_repaint_queue, m_repaint_timer, and REPAINT_INTERVAL.
Referenced by insertView().
|
signal |
Emits the offset and length of the current selection and the sample rate for converting it into milliseconds
offset | index of the first selected sample |
length | number of selected samples |
rate | sample rate |
|
private |
propagates the vertical zoom to all views
Definition at line 341 of file SignalWidget.cpp.
References m_vertical_zoom, m_views, VERTICAL_ZOOM_MAX, and VERTICAL_ZOOM_MIN.
Referenced by wheelEvent().
void Kwave::SignalWidget::setZoomAndOffset | ( | double | zoom, |
sample_index_t | offset | ||
) |
sets new zoom factor and offset
zoom | the new zoom factor in pixels/sample |
offset | the index of the first visible sample |
Definition at line 137 of file SignalWidget.cpp.
References m_views.
Referenced by Kwave::MainWidget::updateViewRange().
|
signal |
Emits a command to be processed by the next higher instance.
Referenced by contextMenuEvent(), forwardCommand(), and insertView().
|
signal |
emitted to request update of the cursor
Referenced by insertView().
|
signal |
child views can connected to this signal to synchronize repaints
|
privateslot |
Connected to the signal's sigTrackDeleted.
index | numeric index of the deleted track |
track | reference to the deleted track |
Definition at line 612 of file SignalWidget.cpp.
References deleteRow(), m_layout, m_views, Kwave::SignalView::setTrack(), Kwave::toInt(), and Kwave::SignalView::track().
Referenced by SignalWidget().
|
privateslot |
Connected to the signal's sigTrackInserted.
index | numeric index of the inserted track |
track | reference to the inserted track |
Definition at line 579 of file SignalWidget.cpp.
References insertView(), m_signal_manager, m_views, Kwave::SignalView::setTrack(), and Kwave::toInt().
Referenced by SignalWidget().
|
privateslot |
updates the minimum height of the widget according to the number of rows
Definition at line 658 of file SignalWidget.cpp.
References m_layout.
Referenced by insertView().
int Kwave::SignalWidget::visibleWidth | ( | ) | const |
Returns the width of the viewport with the signal (without controls)
Definition at line 368 of file SignalWidget.cpp.
References m_layout, and m_views.
Referenced by Kwave::MainWidget::visibleWidth().
|
protectedvirtual |
slot for mouse wheel events, used for vertical zoom
Definition at line 316 of file SignalWidget.cpp.
References m_vertical_zoom, setVerticalZoom(), and VERTICAL_ZOOM_STEP_FACTOR.
|
private |
the central layout with the views
Definition at line 273 of file SignalWidget.h.
Referenced by deleteRow(), insertRow(), insertView(), mapToViewPort(), SignalWidget(), slotTrackDeleted(), updateMinimumHeight(), and visibleWidth().
|
private |
layout of the lower docking area
Definition at line 279 of file SignalWidget.h.
Referenced by insertView().
|
private |
Offset from which signal is being displayed. This is equal to the index of the first visible sample.
Definition at line 285 of file SignalWidget.h.
Referenced by insertView().
|
private |
queue with pointers to all signal views that need a repaint
Definition at line 297 of file SignalWidget.h.
Referenced by repaintTimerElapsed(), and requestRepaint().
|
private |
timer for limiting the number of repaints per second
Definition at line 294 of file SignalWidget.h.
Referenced by requestRepaint(), and SignalWidget().
|
private |
the signal manager of the corresponding context
Definition at line 262 of file SignalWidget.h.
Referenced by contextMenuEvent(), SignalWidget(), and slotTrackInserted().
|
private |
layout of the upper docking area
Definition at line 276 of file SignalWidget.h.
Referenced by insertView().
|
private |
vertical zoom factor
Definition at line 291 of file SignalWidget.h.
Referenced by insertView(), setVerticalZoom(), and wheelEvent().
|
private |
list of signal views. Contains one entry for each signal view, starting with the ones in m_upper_dock, then the ones in m_layout, and at the end the ones from m_lower_dock. The list is sorted in the order of the appearance in the GUI.
Definition at line 270 of file SignalWidget.h.
Referenced by contextMenuEvent(), insertView(), mapToViewPort(), setVerticalZoom(), setZoomAndOffset(), slotTrackDeleted(), slotTrackInserted(), and visibleWidth().
|
private |
number of samples per pixel
Definition at line 288 of file SignalWidget.h.
Referenced by insertView().