File indexing completed on 2024-04-28 04:52:21

0001 /*
0002     SPDX-FileCopyrightText: 2010 Simon Andreas Eugster <simon.eu@gmail.com>
0003     This file is part of kdenlive. See www.kdenlive.org.
0004 
0005 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #pragma once
0009 
0010 #include <QString>
0011 #include <QWidget>
0012 
0013 #include "../abstractscopewidget.h"
0014 
0015 /**
0016 * @brief Abstract class for scopes analyzing image frames.
0017 */
0018 class AbstractGfxScopeWidget : public AbstractScopeWidget
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit AbstractGfxScopeWidget(bool trackMouse = false, QWidget *parent = nullptr);
0024     ~AbstractGfxScopeWidget() override; // Must be virtual because of inheritance, to avoid memory leaks
0025 
0026 protected:
0027     ///// Variables /////
0028 
0029     /** @brief Scope renderer. Must emit signalScopeRenderingFinished()
0030      *  when calculation has finished, to allow multi-threading.
0031      *  accelerationFactor hints how much faster than usual the calculation should be accomplished, if possible. */
0032     virtual QImage renderGfxScope(uint accelerationFactor, const QImage &) = 0;
0033 
0034     QImage renderScope(uint accelerationFactor) override;
0035 
0036     void mouseReleaseEvent(QMouseEvent *) override;
0037 
0038 private:
0039     QImage m_scopeImage;
0040     QMutex m_mutex;
0041 
0042 public Q_SLOTS:
0043     /** @brief Must be called when the active monitor has shown a new frame.
0044      * This slot must be connected in the implementing class, it is *not*
0045      * done in this abstract class. */
0046     void slotRenderZoneUpdated(const QImage &);
0047 
0048 protected Q_SLOTS:
0049     virtual void slotAutoRefreshToggled(bool autoRefresh);
0050 
0051 Q_SIGNALS:
0052     void signalFrameRequest(const QString &widgetName);
0053 };