128 lines
3.8 KiB
C++
Executable File
128 lines
3.8 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Exportable widget with replay controls
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Mike Wille, NLE, 2019-10-02
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <SituationReplay/srp_ftc.h>
|
|
#include <SituationReplay/srp_dtc.h>
|
|
#include <SituationReplay/logger.h>
|
|
|
|
#include <Plugins/MarkerManagement/mrk_data_plugin_interface.h>
|
|
#include <Plugins/ExerciseManagement/exm_data_plugin_interface.h>
|
|
|
|
//SituationMap
|
|
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
|
|
|
#include <LtsSession/lts_session.h>
|
|
#include <LtsUtilsGuiDds/request_helper.h>
|
|
|
|
|
|
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<Interface::Dtc> &dtc,
|
|
const std::shared_ptr<Interface::Ftc> &ftc,
|
|
const std::shared_ptr<MarkerManagement::Interface::Dtc> &mrkDtc,
|
|
const std::shared_ptr<SituationMap::ForeignGuiInterface> &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<SituationReplay::Interface::Dtc> m_dtc;
|
|
std::shared_ptr<SituationReplay::Interface::Ftc> m_ftc;
|
|
std::shared_ptr<MarkerManagement::Interface::Dtc> m_mrkDtc;
|
|
MarkerManagement::MarkerManagementDialogModel *m_markerModel;
|
|
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
|
std::shared_ptr<ExerciseManagement::Interface::Dtc> 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
|