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 "Logger.h"
22#include "dataqueue.h"
23#include "sharedframe.h"
24
25#include <QFuture>
26#include <QMutex>
27#include <QString>
28#include <QThread>
29#include <QWidget>
30
56
57class ScopeWidget : public QWidget
58{
59 Q_OBJECT
60
61public:
68 explicit ScopeWidget(const QString &name);
69
71 virtual ~ScopeWidget();
72
77 virtual QString getTitle() = 0;
78
83 virtual void setOrientation(Qt::Orientation){};
84
85public slots:
87 virtual void onNewFrame(const SharedFrame &frame) Q_DECL_FINAL;
88
89signals:
91 void moved();
92
93protected:
99 virtual void requestRefresh() Q_DECL_FINAL;
100
108 virtual void refreshScope(const QSize &size, bool full) = 0;
109
117
118 void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
119 void changeEvent(QEvent *) Q_DECL_OVERRIDE;
120
121private:
122 Q_INVOKABLE virtual void onRefreshThreadComplete() Q_DECL_FINAL;
123 virtual void refreshInThread() Q_DECL_FINAL;
124 QFuture<void> m_future;
125 bool m_refreshPending;
126
127 // Members accessed in multiple threads (mutex protected).
128 QMutex m_mutex;
129 bool m_forceRefresh;
130 QSize m_size;
131};
132
133#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
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:126
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:116
virtual void setOrientation(Qt::Orientation)
Definition scopewidget.h:83
ScopeWidget(const QString &name)
Definition scopewidget.cpp:24
virtual ~ScopeWidget()
Destructs a ScopeWidget.
Definition scopewidget.cpp:38
The SharedFrame provides thread safe access to Mlt::Frame data.
Definition sharedframe.h:50