CuteLogger
Fast and simple logging solution for Qt based applications
scopewidget.h
1 /*
2  * Copyright (c) 2015-2016 Meltytech, LLC
3  * Author: Brian Matherly <code@brianmatherly.com>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef SCOPEWIDGET_H
20 #define SCOPEWIDGET_H
21 
22 #include <QWidget>
23 #include <QString>
24 #include <Logger.h>
25 #include <QThread>
26 #include <QFuture>
27 #include <QMutex>
28 #include "sharedframe.h"
29 #include "dataqueue.h"
30 
57 class ScopeWidget : public QWidget
58 {
59  Q_OBJECT
60 
61 public:
68  explicit ScopeWidget(const QString& name);
69 
71  virtual ~ScopeWidget();
72 
77  virtual QString getTitle() = 0;
78 
83  virtual void setOrientation(Qt::Orientation) {};
84 
85 public slots:
87  virtual void onNewFrame(const SharedFrame& frame) Q_DECL_FINAL;
88 
89 protected:
95  virtual void requestRefresh() Q_DECL_FINAL;
96 
104  virtual void refreshScope(const QSize& size, bool full) = 0;
105 
113 
114  void resizeEvent(QResizeEvent*) Q_DECL_OVERRIDE;
115  void changeEvent(QEvent*) Q_DECL_OVERRIDE;
116 
117 private:
118  Q_INVOKABLE virtual void onRefreshThreadComplete() Q_DECL_FINAL;
119  virtual void refreshInThread() Q_DECL_FINAL;
120  QFuture<void> m_future;
121  bool m_refreshPending;
122 
123  // Members accessed in multiple threads (mutex protected).
124  QMutex m_mutex;
125  bool m_forceRefresh;
126  QSize m_size;
127 };
128 
129 #endif // SCOPEWIDGET_H
virtual void refreshScope(const QSize &size, bool full)=0
virtual ~ScopeWidget()
Destructs a ScopeWidget.
Definition: scopewidget.cpp:37
The ScopeWidget provides a common interface for all scopes in Shotcut.
Definition: scopewidget.h:57
The DataQueue provides a thread safe container for passing data between objects.
Definition: dataqueue.h:47
DataQueue< SharedFrame > m_queue
Definition: scopewidget.h:112
A file containing the description of Logger class and and additional useful macros for logging...
virtual void requestRefresh() Q_DECL_FINAL
Definition: scopewidget.cpp:47
ScopeWidget(const QString &name)
Definition: scopewidget.cpp:23
The SharedFrame provides thread safe access to Mlt::Frame data.
Definition: sharedframe.h:48
virtual void onNewFrame(const SharedFrame &frame) Q_DECL_FINAL
Provides a new frame to the scope. Should be called by the application.
Definition: scopewidget.cpp:41
virtual QString getTitle()=0
virtual void setOrientation(Qt::Orientation)
Definition: scopewidget.h:83