/** * @RDE_HEADER@ * widget in MVC pattern which manages the entire timeline to add on a layout or widget * $Id$ * $HeadURL$ * $Author$ * Created by Mike Wille, SLSE, 2014-10-01 */ #pragma once #include #include "Range.h" #include #include namespace Ui { class Timeline; } namespace LtsTimelineClassic { class AbstractTimelineModel; class EventGraphic; class TimelineHeaderView; /** * @brief widget in MVC pattern which manages the entire timeline to add on a layout or widget */ class LTSTIMELINECLASSIC_EXPORT TimelineWidget : public QWidget { Q_OBJECT public: /** * @brief sets, creates, connects, etc. all needed components, classes and widgets * @param parent parent qwidget to lie on */ explicit TimelineWidget(QWidget *parent = nullptr); ~TimelineWidget(); /** * @brief sets the position marker at the position at time * @param time time to set the position marker to */ void setPositionMarkerTime(const qint64 time); qint64 getRangeMinimum() const; qint64 getRangeMaximum() const; void setPos(qint64 pos); void setMaxPos(); int getPos() const; int getMaxPos() const; void knownRangesChanged(const QVector &newRanges); void hideDebugWidget(); void setLiveTime(qint64 time); private: /** * @brief sets new timeline boundaries and is called by updateTimeline() after the model has its data updated * @param min new first event in timeline in seconds since epoch * @param max new last event in timeline in seconds since epoch */ void setTimelineRange(qint64 min, qint64 max); void refreshData(); NGL::INGLLogger &m_logger; Ui::Timeline *m_timelineUi; // could have used vars from EventTools qint64 m_min; qint64 m_max; qint64 m_sbPos; qint64 m_zoomFactor; TimelineHeaderView *m_headerView; AbstractTimelineModel *m_model; signals: /** * @brief tells the parent of the timeline controller to load new events from 'from' to 'to' * @param from x * @param to y */ void signalLoadNewEvents(qint64 from, qint64 to); /** * @brief to output playback request to desired class * @param eventSet EventSet to play */ //void signalPlayback(const NGLDAO::EventSet &eventSet); void signalEventAction(EventGraphic *eg, int); // int => action type void signalRangeChanged(); void signalArm(bool arm); void signalZoomChanged(); public slots: /** * @brief filters the scrollbar events and gives new scrollbar position to necessary classes * @param x scrollbar event */ void scrollBarFilter1(int x); /** * @brief gives new scrollbar position to necessary classes */ void scrollBarFilter2(); /** * @brief sets new zoom factor * @param zoomFactor zoom factor in percent points */ void slotSetZoomFactor(qint64 zoomFactor); /** * @brief sets new values to this class * @param index affected column * @param oldSize old width of column * @param newSize new width of column */ void slotSectionResized(int logicalIndex, int oldSize, int newSize); /** * @brief set timeline model for the timeline widget's view * @param model model of the view - of the widget */ void setTimelineModel(AbstractTimelineModel *model); /** * @brief slotUpdateTimeline updates all data of the timeline by setting the * new range (if new), shoes new events (if any), etc.. and is emitted by * the model after there is no new data anymore arriving, after data has arrived - saves resources and prevents flickering */ void slotUpdateTimeline(); void slotRefreshData(); }; } // namespace LtsTimelineClassic