- Formatted all CodeGen module files (9 files) - Formatted LtsAppDescriptor module files - Formatted LtsAppManager/AppChooser files - Applied clang-format to all DTC and enum headers across modules - Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/) Cosmetic changes only, no functional modifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
303 lines
6.2 KiB
C++
303 lines
6.2 KiB
C++
#pragma once
|
|
#include "ltstimeline_export.h"
|
|
#include "timeline_header_view_mouse_handler.h"
|
|
#include "timeline_utils.h"
|
|
|
|
#include <QHeaderView>
|
|
#include <QObject>
|
|
|
|
class QMouseEvent;
|
|
class QPainter;
|
|
class QRect;
|
|
class QTimer;
|
|
class QWheelEvent;
|
|
|
|
namespace LtsTimeline
|
|
{
|
|
|
|
class TimelineView;
|
|
|
|
class LTSTIMELINE_EXPORT TimelineHeaderView : public QHeaderView
|
|
{
|
|
Q_OBJECT
|
|
|
|
friend class TimelineHeaderViewMouseHandler;
|
|
friend class TimelineViewMouseHandler;
|
|
|
|
public:
|
|
static const QColor backgroundColor();
|
|
static const QColor highlightColor();
|
|
|
|
static const int s_limitHeight;
|
|
|
|
enum Section { eActuator = 0, eItems = 1 };
|
|
|
|
TimelineHeaderView(QWidget* parent = nullptr);
|
|
~TimelineHeaderView();
|
|
|
|
void setParent(QWidget*);
|
|
void setTrackLabel(const QString& trackLabel);
|
|
|
|
const Ticks& majorTicks() const
|
|
{
|
|
return m_majorTicks;
|
|
}
|
|
|
|
const Ticks& mediumTicks() const
|
|
{
|
|
return m_mediumTicks;
|
|
}
|
|
|
|
const Ticks& minorTicks() const
|
|
{
|
|
return m_minorTicks;
|
|
}
|
|
|
|
DateTimeFormat dateTimeFormat() const
|
|
{
|
|
return m_dateTimeFormat;
|
|
}
|
|
|
|
void setDateTimeFormat(DateTimeFormat dateTimeFormat);
|
|
|
|
void setDateTimeFormatChangable(bool changable)
|
|
{
|
|
m_isDateTimeFormatChangable = changable;
|
|
}
|
|
|
|
bool isDateTimeFormatChangable() const
|
|
{
|
|
return m_isDateTimeFormatChangable;
|
|
}
|
|
|
|
double indicatorScalingFactor() const
|
|
{
|
|
return m_indicatorScalingFactor;
|
|
}
|
|
|
|
void setIndicatorScalingFactor(double factor);
|
|
|
|
qint64 indicatorTime() const
|
|
{
|
|
return m_indicatorTime;
|
|
}
|
|
|
|
void setIndicatorTime(qint64 time);
|
|
|
|
int indicatorPosition() const
|
|
{
|
|
return toPixel(m_indicatorTime);
|
|
}
|
|
|
|
void setIndicatorPosition(int position);
|
|
|
|
bool isIndicatorVisible() const
|
|
{
|
|
return m_isIndicatorVisible;
|
|
}
|
|
|
|
void setIndicatorVisible(bool isIndicatorVisible);
|
|
|
|
bool indicatorLocked() const
|
|
{
|
|
return m_isIndicatorLocked;
|
|
}
|
|
|
|
void setIndicatorLocked(bool locked)
|
|
{
|
|
m_isIndicatorLocked = locked;
|
|
}
|
|
|
|
void lockIndicator()
|
|
{
|
|
setIndicatorLocked(true);
|
|
}
|
|
|
|
void unlockIndicator()
|
|
{
|
|
setIndicatorLocked(false);
|
|
}
|
|
|
|
double liveIndicatorScalingFactor() const
|
|
{
|
|
return m_liveIndicatorScalingFactor;
|
|
}
|
|
|
|
void setLiveIndicatorScalingFactor(double factor);
|
|
|
|
QColor liveIndicatorColor() const
|
|
{
|
|
return m_liveIndicatorColor;
|
|
}
|
|
|
|
void setLiveIndicatorColor(const QColor& color);
|
|
|
|
qint64 liveIndicatorTime() const
|
|
{
|
|
return m_liveIndicatorTime;
|
|
}
|
|
|
|
void setLiveIndicatorTime(qint64 time);
|
|
|
|
int liveIndicatorPosition() const
|
|
{
|
|
return toPixel(m_liveIndicatorTime);
|
|
}
|
|
|
|
void setLiveIndicatorPosition(int position);
|
|
|
|
bool isLiveIndicatorVisible() const
|
|
{
|
|
return m_isLiveIndicatorVisible;
|
|
}
|
|
|
|
void setLiveIndicatorVisible(bool isLiveIndicatorVisible);
|
|
void startLiveTimer(qint64 startTime = -1, int interval = 1000);
|
|
void stopLiveTimer();
|
|
|
|
qint64 hoverTime() const
|
|
{
|
|
return m_hoverTime;
|
|
}
|
|
|
|
void setHoverTime(qint64 time);
|
|
|
|
int hoverPosition() const
|
|
{
|
|
return m_hoverPosition;
|
|
}
|
|
|
|
void setHoverPosition(int position);
|
|
|
|
bool isHoverVisible() const
|
|
{
|
|
return m_isHoverVisible;
|
|
}
|
|
|
|
void setHoverVisible(bool visible);
|
|
|
|
bool isHoverTimeVisible() const
|
|
{
|
|
return m_isHoverTimeVisible;
|
|
}
|
|
|
|
void setHoverTimeVisible(bool visible);
|
|
|
|
DateTimeFormat hoverDateTimeFormat() const
|
|
{
|
|
return m_hoverDateTimeFormat;
|
|
}
|
|
|
|
void setHoverDateTimeFormat(DateTimeFormat format);
|
|
|
|
bool isLimitsVisible() const
|
|
{
|
|
return m_isLimitsVisible;
|
|
}
|
|
|
|
void setLimitsVisible(bool visible);
|
|
|
|
DateTimeFormat limitsDateTimeFormat() const
|
|
{
|
|
return m_limitsDateTimeFormat;
|
|
}
|
|
|
|
void setLimitsDateTimeFormat(DateTimeFormat format);
|
|
|
|
int toPixel(qint64 time) const;
|
|
qint64 toTime(int pixel) const;
|
|
|
|
QFont& font()
|
|
{
|
|
return m_font;
|
|
}
|
|
|
|
TimelineHeaderViewMouseHandler* mouseHandler()
|
|
{
|
|
return m_mouseHandler;
|
|
}
|
|
|
|
void wheelEvent(QWheelEvent* e) override
|
|
{
|
|
m_mouseHandler->wheelEvent(e);
|
|
}
|
|
|
|
protected:
|
|
void mouseMoveEvent(QMouseEvent* e) override
|
|
{
|
|
m_mouseHandler->mouseMoveEvent(e);
|
|
}
|
|
|
|
void mousePressEvent(QMouseEvent* e) override
|
|
{
|
|
m_mouseHandler->mousePressEvent(e);
|
|
}
|
|
|
|
void mouseReleaseEvent(QMouseEvent* e) override
|
|
{
|
|
m_mouseHandler->mouseReleaseEvent(e);
|
|
}
|
|
|
|
void paintSection(QPainter* painter, const QRect& rect, int logicalIndex) const;
|
|
|
|
private:
|
|
void updateMajorTicks();
|
|
void updateMediumTicks();
|
|
void updateMinorTicks();
|
|
|
|
public slots:
|
|
void onUpdateTicks();
|
|
|
|
private slots:
|
|
void onLiveTimeout();
|
|
|
|
signals:
|
|
void ticksChanged(const Ticks&);
|
|
void indicatorTimeChanged(qint64);
|
|
void indicatorVisibilityChanged(bool);
|
|
void liveIndicatorTimeChanged(qint64);
|
|
void liveIndicatorVisibilityChanged(bool);
|
|
void hoverPositionChanged(int);
|
|
void hoverVisibilityChanged(bool);
|
|
|
|
private:
|
|
TimelineHeaderViewMouseHandler* m_mouseHandler{nullptr};
|
|
TimelineView* m_timelineView{nullptr};
|
|
Ticks m_majorTicks;
|
|
Ticks m_mediumTicks;
|
|
Ticks m_minorTicks;
|
|
DateTimeFormat m_dateTimeFormat{DateTimeFormat::DTG};
|
|
bool m_isDateTimeFormatChangable{true};
|
|
|
|
double m_indicatorScalingFactor{0.5};
|
|
qint64 m_indicatorTime{-1};
|
|
bool m_isIndicatorVisible{true};
|
|
bool m_isIndicatorLocked{false};
|
|
|
|
double m_liveIndicatorScalingFactor{0.5};
|
|
QColor m_liveIndicatorColor;
|
|
qint64 m_liveIndicatorTime{-1};
|
|
bool m_isLiveIndicatorVisible{false};
|
|
QTimer* m_liveTimer{nullptr};
|
|
int m_liveTimerInterval{1000};
|
|
|
|
qint64 m_hoverTime{-1};
|
|
int m_hoverPosition{-1};
|
|
bool m_isHoverVisible{true};
|
|
bool m_isHoverTimeVisible{true};
|
|
DateTimeFormat m_hoverDateTimeFormat{DateTimeFormat::DTG};
|
|
|
|
bool m_isLimitsVisible{false};
|
|
DateTimeFormat m_limitsDateTimeFormat{DateTimeFormat::DTG};
|
|
const QPixmap m_minLimitIndicator;
|
|
const QPixmap m_maxLimitIndicator;
|
|
|
|
QString m_trackLabel;
|
|
|
|
QFont m_font;
|
|
};
|
|
|
|
typedef TimelineHeaderView::Section Section;
|
|
|
|
} // namespace LtsTimeline
|