/** * @RDE_HEADER@ * Exportable widget with replay controls * $Id$ * $HeadURL$ * $Author$ * Created by Mike Wille, NLE, 2019-10-02 */ #pragma once #include #include #include #include #include //SituationMap #include #include #include namespace MarkerManagement { class MarkerManagementDialogModel; } namespace Ui { class SituationReplayControlWidget; } class QTimer; namespace SituationReplay { // -------------------------------------------------------- // SituationReplayControlWidget // -------------------------------------------------------- class SituationReplayControlWidget final : public QWidget , protected Interface::Ftc::ChangeReplayStateReplyHandler { Q_OBJECT public: explicit SituationReplayControlWidget(QWidget *parent = nullptr); ~SituationReplayControlWidget(); bool init(LtsSession::LtsSession *session, const std::shared_ptr &dtc, const std::shared_ptr &ftc, const std::shared_ptr &mrkDtc, const std::shared_ptr &sitMapGuiIfc, int partitionId, bool useExistingReplay = true); void onChangeReplayStateReply(const Core::FunctionReplyObject &replyObject) override final { // QTimer::singleShot(3000, this, [this, replyObject]() // { m_requestHelper->requestReply(replyObject); // }); } qint64 startTime() const; void setStartTime(qint64 startTime); int speed() const; void setSpeed(int speed); void showEditorWidget(bool visibility = true); bool startReplay(qint64 start, qint64 end = 0 /* 0 = infinite */, double speed = 1.0f); void pauseReplay(); void stopReplay(); void resumeReplay(); SrpState getReplayState() { return m_state; } int getId() { return m_id; } signals: void signalSetStart(qint64 start); void signalSetEnd(qint64 end); void signalSetSpeed(double speed); void signalSetMapFilter(const QByteArray &mapFilter); void signalSetMapSettings(const QByteArray &mapSettings); void replayStarted(); void replayPaused(); void replayStopped(); private slots: void onSitReplayChanged(const SitReplay &data, DataModification modType); void onPartitionTimeChanged(qint64 newPartitionTime); void onMarkerClicked(const QModelIndex &index); void enaDisa(); bool startReplayDelayed(qint64 start, qint64 end = 0 /* 0 = infinite */, double speed = 1.0f); void onStartReplay(); void onStopReplay(); void onPauseResumeReplay(); void onStartPauseButtonToggled(bool checked); // if true means we start play void onSpeedValueChanged(); void onPeriodSliderChanged(int seconds); void onDteStartChanged(); private: void disableAllReplayButtons(); qint64 getMSecs(qint64 sec); qint64 getSecs(qint64 msec); Ui::SituationReplayControlWidget *m_ui; LtsSession::LtsSession *m_session; std::shared_ptr m_dtc; std::shared_ptr m_ftc; std::shared_ptr m_mrkDtc; MarkerManagement::MarkerManagementDialogModel *m_markerModel; std::shared_ptr m_sitMapGuiIfc; std::shared_ptr m_exmDtc; LtsUtils::RequestHelper *m_requestHelper; int m_id; int m_partitionId; SrpState m_state; qint64 m_endTime; bool m_toggleStartPauseButton; // if true, only one button is used for Start/Pause QTimer *m_speedValueChangedTimer; LOGGER_T m_logger; }; } // namespace SituationReplay