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