156 lines
3.4 KiB
C++
Executable File
156 lines
3.4 KiB
C++
Executable File
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <LtsTimelineClassic/ltstimelineclassic_export.h>
|
|
|
|
#include <QColor>
|
|
#include <QJsonObject>
|
|
#include <QStringList>
|
|
#include <LtsUtilsCore/qpoint3d.h>
|
|
|
|
class QPainter;
|
|
class QRect;
|
|
|
|
namespace LtsSession
|
|
{
|
|
class LtsSession;
|
|
}
|
|
|
|
namespace LtsTimelineClassic
|
|
{
|
|
|
|
|
|
|
|
class LTSTIMELINECLASSIC_EXPORT Event
|
|
{
|
|
public:
|
|
enum ButtonType
|
|
{
|
|
ActiveEvent,
|
|
EventBlock,
|
|
};
|
|
|
|
|
|
typedef void (*EventPaintFunc)(QPainter *, const QRect &);
|
|
static void drawCustomEventGraphicTriangle(QPainter *painter, const QRect &rect);
|
|
static void drawCustomEventGraphicInvertTriangle(QPainter *painter, const QRect &rect);
|
|
static void drawCustomEventGraphicEllipse(QPainter *painter, const QRect &rect);
|
|
static void drawCustomEventGraphicRect(QPainter *painter, const QRect &rect);
|
|
static void drawCustomEventGraphicRoundedRect(QPainter *painter, const QRect &rect);
|
|
static void drawMultipleEventGraphic(QPainter *painter, const QRect &rect);
|
|
|
|
|
|
Event() = default;
|
|
Event(int uniqueId, int typeId, qint64 startTime, qint64 endTime,
|
|
int playerId, int partyId, int equipmentId, const QStringList &path,
|
|
const EventPaintFunc &paintFunc, const QColor &paintColor,
|
|
const QJsonObject &detailData, int subEventId = -1,
|
|
const LtsUtils::QPoint3D &pos = LtsUtils::QPoint3D(),
|
|
LtsSession::LtsSession *session = nullptr);
|
|
|
|
|
|
|
|
|
|
QStringList getActuator() const { return m_path; }
|
|
|
|
int typeId() const { return m_typeId; }
|
|
int uniqueId() const { return m_uniqueId; }
|
|
|
|
int getSubEventID() const;
|
|
|
|
QColor getColor() const { return m_eventColor; }
|
|
|
|
EventPaintFunc getPaintFunc() const { return m_paintFunc; }
|
|
|
|
|
|
|
|
qint64 startTime() const { return m_startTime; }
|
|
qint64 endTime() const { return m_endTime; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const QJsonObject &detailData() const { return m_detailData; }
|
|
void setDetailData(const QJsonObject &detailData) { m_detailData = detailData; }
|
|
|
|
void setEndT(qint64 newEnd);
|
|
|
|
|
|
|
|
qint64 duration(bool ignoreLiveEvents = false) const;
|
|
|
|
int playerId() const { return m_playerId; }
|
|
void setPlayerId(int playerId) { m_playerId = playerId; }
|
|
|
|
int partyId() const { return m_partyId; }
|
|
void setPartyId(int teamId) { m_partyId = teamId; }
|
|
|
|
int equipmentId() const { return m_equipmentId; }
|
|
void setEquipmentId(int eqId) { m_equipmentId = eqId; }
|
|
|
|
QString getShortActuator() const;
|
|
|
|
bool positionValid() const { return !std::isnan(m_position.x()) && !std::isnan(m_position.y()); }
|
|
const LtsUtils::QPoint3D &position() const { return m_position; }
|
|
QPointF pos2d() const { return QPointF(m_position.x(), m_position.y()); }
|
|
void setPosition(const LtsUtils::QPoint3D &pos) { m_position = pos; }
|
|
|
|
|
|
|
|
|
|
void hide();
|
|
|
|
|
|
|
|
void show();
|
|
|
|
|
|
|
|
bool isVisible() const { return m_visible; }
|
|
|
|
|
|
|
|
void setVisible(bool visibility = true);
|
|
|
|
void setDeleted() { m_deleted = true; }
|
|
|
|
bool isDeleted() const { return m_deleted; }
|
|
|
|
|
|
protected:
|
|
QStringList m_path;
|
|
QJsonObject m_detailData;
|
|
|
|
LtsUtils::QPoint3D m_position;
|
|
EventPaintFunc m_paintFunc = nullptr;
|
|
LtsSession::LtsSession *m_session = nullptr;
|
|
QColor m_eventColor;
|
|
qint64 m_startTime = -1;
|
|
qint64 m_endTime = -1;
|
|
mutable qint64 m_duration = -1;
|
|
|
|
|
|
int m_uniqueId = -1;
|
|
int m_typeId = -1;
|
|
int m_subEventId = -1;
|
|
int m_playerId = -1;
|
|
int m_partyId = -1;
|
|
int m_equipmentId = -1;
|
|
bool m_deleted = false;
|
|
bool m_visible = false;
|
|
|
|
private:
|
|
|
|
|
|
static bool checkDuration();
|
|
};
|
|
|
|
}
|