131 lines
3.3 KiB
C++
Executable File
131 lines
3.3 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* TopicReplay
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Christian Fröbel, NLSE, 2018-06-26
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AudioVideoManagement/logger.h>
|
|
#include <AudioVideoManagement/Shared/playback_app.h>
|
|
#include <PluginInterfaces/topic_replay_interface.h>
|
|
|
|
#include <QString>
|
|
#include <QRect>
|
|
#include <QVector>
|
|
#include <QWidget>
|
|
#include <boost/optional.hpp>
|
|
#include <memory>
|
|
#include <AudioVideoManagement/ava_control.h>
|
|
#include <AudioVideoManagement/ava_session.h>
|
|
|
|
|
|
namespace AudioVideoManagement
|
|
{
|
|
enum class AvaStreamType;
|
|
|
|
/**
|
|
* Helper class used to determine where the AVS dialog for presentation shall be placed.
|
|
* An instance of this class will be returned by TopicReplay::createWidget().
|
|
* The ScriptPlayer will then place (and resize) this widget accordingly.
|
|
*/
|
|
class ScreenPlacementHelper : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
ScreenPlacementHelper(QWidget *parent = nullptr)
|
|
: QWidget(parent)
|
|
{
|
|
setWindowTitle(QStringLiteral("Topic Replay Screen Placement Helper"));
|
|
|
|
// NOTE: the widget has to be visible in order to receive resizeEvents !!
|
|
|
|
// make widget transparent so that it's not disturbing
|
|
setWindowFlags(Qt::FramelessWindowHint/* | Qt::Popup*/);
|
|
setAttribute(Qt::WA_TranslucentBackground);
|
|
|
|
activateWindow(); // force it into a window
|
|
show();
|
|
}
|
|
|
|
protected:
|
|
void moveEvent(QMoveEvent *) override
|
|
{
|
|
emitNewGeometry();
|
|
}
|
|
|
|
void resizeEvent(QResizeEvent *) override
|
|
{
|
|
emitNewGeometry();
|
|
}
|
|
|
|
void emitNewGeometry()
|
|
{
|
|
//QRect globalGeometry(mapToGlobal(geometry().topLeft()), size());
|
|
emit widgetPlaced(geometry());//globalGeometry);
|
|
}
|
|
|
|
signals:
|
|
void widgetPlaced(const QRect &geometry);
|
|
};
|
|
|
|
|
|
class DataInterface;
|
|
class AvaControl;
|
|
class VdControl;
|
|
struct AvaScriptEntry;
|
|
|
|
|
|
class TopicReplay final : public QObject, public ::TopicReplay::Interface
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
TopicReplay(DataInterface *dataIfc, bool isAudio);
|
|
~TopicReplay();
|
|
|
|
/**
|
|
* @return nullptr for audio topics.
|
|
*/
|
|
QWidget *createWidget() override;
|
|
|
|
|
|
bool playbackInit(const QJsonObject &attributes) override;
|
|
bool playbackStart(int secondsOffset) override;
|
|
bool playbackPause() override;
|
|
bool playbackStop() override;
|
|
|
|
bool exportTopic(const QJsonObject &attributes,
|
|
const QString &folderPath,
|
|
TopicEditorBase::ExportNotifier *pExportNotifier) override;
|
|
|
|
private slots:
|
|
void onWidgetPlaced(const QRect &geometry);
|
|
void avScriptFinished(const QString &exportDir, AvaStreamType streamType, bool success);
|
|
void slotSetScriptResponse(const AvaStreamInfo &, AvaStreamState);
|
|
|
|
private:
|
|
AvaControl* getAvaControl();
|
|
VdControl* getVdControl();
|
|
|
|
//class ScreenPlacementHelper;
|
|
class ExportScript;
|
|
|
|
const bool m_isAudio;
|
|
PlaybackAppHandle m_appHandle;
|
|
DataInterface *m_dataIfc;
|
|
QString m_scriptName;
|
|
bool m_isPlaying{false};
|
|
QScopedPointer<ScreenPlacementHelper> m_screenPlacementHelper;
|
|
boost::optional<QRect> m_dialogGeometry;
|
|
QScopedPointer<ExportScript> m_exportScript;
|
|
LOGGER_T m_logger;
|
|
QJsonObject m_playbackAttributes;
|
|
};
|
|
|
|
} // namespace AudioVideoManagement
|