CuteLogger
Fast and simple logging solution for Qt based applications
|
The ScopeWidget provides a common interface for all scopes in Shotcut. More...
#include <scopewidget.h>
Public Slots | |
virtual void | onNewFrame (const SharedFrame &frame) Q_DECL_FINAL |
Provides a new frame to the scope. Should be called by the application. | |
Signals | |
void | moved () |
Tells the widget it has been moved. Should be called by the application. | |
Public Member Functions | |
ScopeWidget (const QString &name) | |
virtual | ~ScopeWidget () |
Destructs a ScopeWidget. | |
virtual QString | getTitle ()=0 |
virtual void | setOrientation (Qt::Orientation) |
Protected Member Functions | |
virtual void | requestRefresh () Q_DECL_FINAL |
virtual void | refreshScope (const QSize &size, bool full)=0 |
Protected Attributes | |
DataQueue< SharedFrame > | m_queue |
The ScopeWidget provides a common interface for all scopes in Shotcut.
ScopeWidget is a QWidget that provides some additional functionality that is common to all scopes. One common function is a queue that can receive and store frames until they can be processed by the scope. Another common function is the ability to trigger the "heavy lifting" to be done in a worker thread.
Frames are received by the onNewFrame() slot. The ScopeWidget automatically places new frames in the DataQueue (m_queue). Subclasses shall implement the refreshScope() function and can check for new frames in m_queue.
refreshScope() is run from a separate thread. Therefore, any members that are accessed by both the worker thread (refreshScope) and the GUI thread (paintEvent(), resizeEvent(), etc) must be protected by a mutex. After the refreshScope() function returns, the ScopeWidget will automatically request the GUI thread to update(). A well implemented ScopeWidget will be designed such that most of the CPU intensive work will be done in refreshScope() and the paintEvent() implementation will complete quickly to avoid hanging up the GUI thread.
Subclasses shall also implement getTitle() so that the application can display an appropriate title for the scope.
|
explicit |
Constructs an ScopeWidget.
The name will be set as the objectName and should be initialized by subclasses.
|
pure virtual |
Returns the title of the scope to be displayed by the application. This virtual function must be implemented by subclasses.
|
protectedpure virtual |
Performs the main, CPU intensive, scope drawing in a new thread.
refreshScope() Shall be implemented by subclasses. Care must be taken to protect any members that may be accessed concurrently by the refresh thread and the GUI thread.
|
protectedvirtual |
Triggers refreshScope() to be called in a new thread context. Typically requestRefresh would be called from the GUI thread (e.g. in resizeEvent()). onNewFrame() also calls requestRefresh().
|
inlinevirtual |
Sets the preferred orientation on the scope. This virtual function may be reimplemented by subclasses.
|
protected |
Stores frames received by onNewFrame().
Subclasses should check this queue for new frames in the refreshScope() implementation.