/** * @RDE_HEADER@ * AvmPlaybackMenu * $Id$ * $HeadURL$ * $Author$ * Created by Christian Fröbel, SLSE, 2017-06-26 */ #pragma once #include "ui_avm_playback_menu.h" #include "interval_model.h" #include #include #include #include #include #include #include #include namespace MarkerManagement { class MarkerManagementDialogModel; class MarkerSortFilterProxyModel; class ForeignDataInterface; } namespace LtsUtils { class RequestHelper; } namespace AudioVideoManagement { class AvaSession; class AvaControl; class AvsSequence; class StreamNameMapping; class AvmPlaybackMenu; class QueryTimeline : public QObject { Q_OBJECT private: friend class AvmPlaybackMenu; QueryTimeline(const AvaStream &stream, const AvaTimePoint &start, const AvaTimePoint &end, AvaControl *control); AvaControl *m_avaCtrl { nullptr }; private slots: //void slotTimelineComplete(const AvaTimeline &timeline); signals: void signalTimelineComplete(const AvaTimeline &timeline); }; class AvmPlaybackMenu : public QWidget, protected MarkerManagement::Interface::Ftc::MarkerModifyReplyHandler { Q_OBJECT public: explicit AvmPlaybackMenu(QWidget *parent = nullptr); ~AvmPlaybackMenu(); bool init(LtsSession::LtsSession *session, AvaSession *avaSession, PlaybackAppHandle &&appHandle, StreamNameMapping* streamNameMapping, bool isAudio, bool insideTopicEditor, const boost::optional &streamName = boost::none, const boost::optional &startTime = boost::none, bool setInitialSearchContentMarkers = true); void setPlaybackPreset(const QString &streamName, const AvaTimePoint &startTime, bool autostartPresetAfterInit); void setMarkerPreset(int markerId, bool autostartPresetAfterInit); QueryTimeline *queryTimeline(const AvaTimePoint &start, const AvaTimePoint &end); void onMarkerModifyReply(const Core::FunctionReplyObject &replyObject) override final; void retranslate(); //void setStreamTime(AvaTimePoint t); void setStreamTime(qint64 time); void hideStreamSelection(); qint64 getCurrentTime() const; AvaSpeed getSpeed() const; void setSpeed(AvaSpeed newSpeed); int getVolume() const; void setVolume(int newVolume); void setStreamByName(const QString &name); //QString selectedStreamName() const; QString getInternalStreamName() const; void setStreamName(const QString &internalStreamName); bool getSkipPause() const; void setSkipPause(bool bSkip); void startPlayback(bool usePresets = false); void setSavedPos(qint64 msecs); int currentOffset() const { return m_currentOffset; } void selectMarker(const MarkerManagement::Marker &marker); void selectMarker(int markerId); signals: void signalSetOverlay(QWidget *widget); void signalUnsetOverlay(); void setTopicButtonStates(bool enable); void markerSelected(const QString &description); // both for topic editor void signalSetStart(qint64 start); void signalSetEnd(qint64 end); void signalCurrentStreamChanged(const QString &displayName); void signalTimezoneChanged(int timezoneHoursOffset); public slots: void onStreamSelectionChanged(const QVector &selectedStreams); private slots: void onSessionEstablished(); void onDisconnected(); void onStreamListReceived(const QVector &streams); void onTimelineComplete(const AvaTimeline &timeline); void onStreamPositionReceived(const QString &dialogId, const QString &streamName, AvaTimePoint); void onVolumeReceived(AvaVolume db); void onCommandQueueEmpty(); void onUiTimeChanged(AvaTimePoint t); void onIntervalActivated(const QModelIndex &index); void onMarkerClicked(const QModelIndex &index); void onSetMarkerClicked(); void onStartClicked(); void onPauseClicked(); void onStopClicked(); void onSkipPauseClicked(); void onAllStreams(); void onIntervalBackwardClicked(); void onIntervalForwardClicked(); void onSpeedChanged(); void onVolumeChanged(int percent); void onCurrentIntervalChanged(bool hasPreviousInterval, bool hasNextInterval, const QModelIndex &rowIndex); void onStreamSelected(); void onMarkerStreamSelected(); void onStreamNameMappingChanged(/*int32_t mountingPointId, const QString &internalName, const QString &displayName*/); void onAddStreamClip(); void onAddStreamMarker(); void onRemoveSelectedStreams(); void onTabChanged(int index); void onPauseFromPlaybackApp(); void onResumeFromPlaybackApp(); private: enum class ButtonStates { AllOff, //!< initial state when no stream is selected or when disconnected Started, Paused, Stopped }; void processPresets(); void preselectStream(const QString &fallbackInternalStreamName); AvaSpeed currentSpeed() const; void setButtonStates(ButtonStates); void enableAll(bool enabled = true); void disableAll() { enableAll(false); } bool trySelectedStreams(); void addStream(QComboBox *cb); void applyAvsPos(); void applyAvsVolume(); //void onStreamListReceived(const QVector &streams); PlaybackAppHandle m_playbackApp; bool m_isAudio = false; StreamNameMapping *m_streamNameMapping = nullptr; boost::optional m_presetStreamName; boost::optional m_markerIdPreset; boost::optional m_presetStartTime; class TimelineBuilder; std::unique_ptr m_timelineBuilder; std::unique_ptr m_ui; class TimeControl; std::unique_ptr m_timeControl; boost::optional> m_selectedStreams; IntervalModel m_intervalModel; boost::optional m_savedPos; std::unique_ptr m_markerModel; std::unique_ptr m_markerProxy; AvaControl *m_avaCtrl = nullptr; LtsSession::LtsSession *m_session = nullptr; bool m_skipEmpty = true; ButtonStates m_currentButtonState; std::shared_ptr m_mrkDataIfc; boost::optional m_lastAvsPos; boost::optional m_lastAvsVolume; std::unique_ptr m_requestHelper; QVector m_streams; boost::optional m_currentStream; bool m_autostartOnce { false }; int m_maxSelectedStreams = 12; bool m_queryTimelineActive { false }; int m_currentOffset = 0; bool m_videoScreenSelectionDone { false }; bool m_timelineIsComplete { false }; ButtonStates m_buttonStateBeforePlaybackAppPause { ButtonStates::AllOff }; LOGGER_T m_logger; }; } // namespace AudioVideoManagement