- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document
C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+
Build status: BUILD_RTI=OFF successful (0 errors, warnings only)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
262 lines
6.1 KiB
C++
262 lines
6.1 KiB
C++
|
|
|
|
#pragma once
|
|
#include "ltstimeline_export.h"
|
|
#include "timeline_header_view.h"
|
|
#include "timeline_model.h"
|
|
#include "timeline_view_drag_handler.h"
|
|
#include "timeline_view_resize_handler.h"
|
|
#include "timeline_view_selection_handler.h"
|
|
#include "timeline_view_track_handler.h"
|
|
|
|
#include <QtWidgets/QLabel>
|
|
#include <QtCore/QObject>
|
|
#include <QtWidgets/QTreeView>
|
|
#include <functional>
|
|
|
|
class QAbstractProxyModel;
|
|
|
|
namespace LtsTimeline
|
|
{
|
|
|
|
class TimelineViewDragHandler;
|
|
class TimelineViewResizeHandler;
|
|
class TimelineViewSelectHandler;
|
|
class TimelineViewTrackHandler;
|
|
class TimelineWidget;
|
|
|
|
class LTSTIMELINE_EXPORT TimelineView : public QTreeView
|
|
{
|
|
Q_OBJECT
|
|
|
|
friend class ItemDelegate;
|
|
friend class TimelineHeaderView;
|
|
friend class TimelineViewDragHandler;
|
|
friend class TimelineViewResizeHandler;
|
|
friend class TimelineViewSelectHandler;
|
|
friend class TimelineViewTrackHandler;
|
|
friend class TimelineWidget;
|
|
|
|
public:
|
|
static const int s_textHeight;
|
|
|
|
explicit TimelineView(QWidget* parent = nullptr);
|
|
|
|
TimelineHeaderView* header()
|
|
{
|
|
return m_header;
|
|
}
|
|
|
|
void setHeader(QHeaderView* header);
|
|
|
|
QAbstractItemModel* model()
|
|
{
|
|
return m_model;
|
|
}
|
|
|
|
TimelineModel* timelineModel()
|
|
{
|
|
return m_timelineModel;
|
|
}
|
|
|
|
void setModel(QAbstractItemModel* model) override;
|
|
|
|
QAbstractProxyModel* proxyModel()
|
|
{
|
|
return m_proxyModel;
|
|
}
|
|
|
|
void setProxyModel(QAbstractProxyModel* proxy) noexcept(false);
|
|
|
|
void setItemDelegate(QAbstractItemDelegate* delegate);
|
|
|
|
ItemDelegate* itemDelegate() const
|
|
{
|
|
return m_delegate;
|
|
}
|
|
|
|
ZoomFactor zoomFactor() const
|
|
{
|
|
return m_zoomFactor;
|
|
}
|
|
|
|
void setZoomFactor(ZoomFactor zoomFactor);
|
|
|
|
ZoomFactor minimumZoomFactor() const
|
|
{
|
|
return m_minZoomFactor;
|
|
}
|
|
|
|
void setMinimumZoomFactor(ZoomFactor zoomFactor);
|
|
|
|
ZoomFactor maximumZoomFactor() const
|
|
{
|
|
return m_maxZoomFactor;
|
|
}
|
|
|
|
void setMaximumZoomFactor(ZoomFactor zoomFactor);
|
|
|
|
ZoomFactor upperZoomFactor() const
|
|
{
|
|
return m_upperZoomFactor;
|
|
}
|
|
|
|
qint64 startTime() const
|
|
{
|
|
return m_startTime;
|
|
}
|
|
|
|
void setStartTime(qint64 time);
|
|
|
|
qint64 currentTime() const
|
|
{
|
|
return m_currentTime;
|
|
}
|
|
|
|
void setCurrentTime(qint64 time);
|
|
|
|
qint64 endTime() const
|
|
{
|
|
return m_startTime + m_duration;
|
|
}
|
|
|
|
void setEndTime(qint64 time);
|
|
|
|
int duration() const
|
|
{
|
|
return m_duration;
|
|
}
|
|
|
|
void setDuration(int duration);
|
|
|
|
void setRange(qint64 start, qint64 end);
|
|
|
|
bool isCursorTextVisible() const
|
|
{
|
|
return m_isCursorTextVisible;
|
|
}
|
|
|
|
void setCursorTextVisible(bool visible);
|
|
void setCursorText(const QString& text);
|
|
|
|
int toPixel(qint64 time) const;
|
|
qint64 toTime(int pixel) const;
|
|
qint64 toDuration(int pixel) const;
|
|
int fromDuration(qint64 time) const;
|
|
|
|
const QVector<int>& selectedItemIds() const
|
|
{
|
|
return m_selectedItemIds;
|
|
}
|
|
|
|
bool hasSelectedItems() const
|
|
{
|
|
return !m_selectedItemIds.isEmpty();
|
|
}
|
|
|
|
void clearSelectedItems();
|
|
void selectAllItems();
|
|
void selectItem(int itemId, bool reset = true);
|
|
void selectItems(const QVector<int>& itemIds, bool reset = true);
|
|
void unselectItem(int itemId);
|
|
|
|
TimelineViewDragHandler* dragHandler()
|
|
{
|
|
return m_dragHandler;
|
|
}
|
|
|
|
void setDragHandler(TimelineViewDragHandler* dragHandler)
|
|
{
|
|
m_dragHandler = dragHandler;
|
|
}
|
|
|
|
TimelineViewResizeHandler* resizeHandler()
|
|
{
|
|
return m_resizeHandler;
|
|
}
|
|
|
|
void setResizeHandler(TimelineViewResizeHandler* resizeHandler)
|
|
{
|
|
m_resizeHandler = resizeHandler;
|
|
}
|
|
|
|
TimelineViewSelectHandler* selectHandler()
|
|
{
|
|
return m_selectHandler;
|
|
}
|
|
|
|
void setSelectHandler(TimelineViewSelectHandler* selectHandler)
|
|
{
|
|
m_selectHandler = selectHandler;
|
|
}
|
|
|
|
TimelineViewTrackHandler* trackHandler()
|
|
{
|
|
return m_trackHandler;
|
|
}
|
|
|
|
void setTrackHandler(TimelineViewTrackHandler* trackHandler)
|
|
{
|
|
m_trackHandler = trackHandler;
|
|
}
|
|
|
|
bool isCursorWithinRange(const QPoint& pos) const
|
|
{
|
|
return isCursorWithinRangeX(pos.x()) && isCursorWithinRangeY(pos.y());
|
|
}
|
|
|
|
bool isCursorWithinRangeX(int x) const;
|
|
bool isCursorWithinRangeY(int y) const;
|
|
|
|
protected:
|
|
NGL::INGLLogger& m_logger;
|
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
|
void dragMoveEvent(QDragMoveEvent* event) override;
|
|
void dragLeaveEvent(QDragLeaveEvent* event) override;
|
|
void dropEvent(QDropEvent* event) override;
|
|
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
|
void mouseMoveEvent(QMouseEvent* event) override;
|
|
void mousePressEvent(QMouseEvent* event) override;
|
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
|
void keyPressEvent(QKeyEvent* event) override;
|
|
void wheelEvent(QWheelEvent* event) override;
|
|
virtual void paintEvent(QPaintEvent* event) override;
|
|
|
|
signals:
|
|
void rangeChanged(qint64, qint64);
|
|
void currentTimeChanged(qint64);
|
|
void zoomChanged(ZoomFactor);
|
|
void trackActivated(int);
|
|
void selectedItemsChanged(const QVector<int>&);
|
|
void itemActivated(int);
|
|
void currentItemTimeChanged();
|
|
|
|
private:
|
|
TimelineHeaderView* m_header{nullptr};
|
|
TimelineModel* m_timelineModel{nullptr};
|
|
QAbstractItemModel* m_model{nullptr};
|
|
QAbstractProxyModel* m_proxyModel{nullptr};
|
|
ItemDelegate* m_delegate{nullptr};
|
|
TimelineViewDragHandler* m_dragHandler{nullptr};
|
|
TimelineViewResizeHandler* m_resizeHandler{nullptr};
|
|
TimelineViewSelectHandler* m_selectHandler{nullptr};
|
|
TimelineViewTrackHandler* m_trackHandler{nullptr};
|
|
|
|
ZoomFactor m_zoomFactor{ZoomFactor::ThirtyMinutes};
|
|
ZoomFactor m_upperZoomFactor{ZoomFactor::OneDay};
|
|
ZoomFactor m_minZoomFactor{ZoomFactor::FifteenSeconds};
|
|
ZoomFactor m_maxZoomFactor{ZoomFactor::OneDay};
|
|
|
|
qint64 m_startTime{-1};
|
|
qint64 m_currentTime{-1};
|
|
int m_duration{-1};
|
|
|
|
bool m_isCursorTextVisible{false};
|
|
QString m_cursorText;
|
|
QPoint m_cursorPosition;
|
|
|
|
QVector<int> m_selectedItemIds;
|
|
};
|
|
|
|
} // namespace LtsTimeline
|