140 lines
3.1 KiB
C++
Executable File
140 lines
3.1 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* offers zoom-buttons, current zoom in percent and date-time indicators coresponding to the viewport
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Mike Wille, SLSE, 2014-10-01
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "EventTools.h"
|
|
#include "LineMap.h"
|
|
#include <QWidget>
|
|
#include <QPoint>
|
|
#include <QPair>
|
|
|
|
|
|
namespace NGL
|
|
{
|
|
class INGLLogger;
|
|
//class Settings;
|
|
}
|
|
class QPushButton;
|
|
class QLabel;
|
|
class QComboBox;
|
|
|
|
|
|
namespace LtsTimelineClassic
|
|
{
|
|
|
|
/**
|
|
* @brief offers zoom-buttons, current zoom in percent and date-time indicators coresponding to the viewport
|
|
*/
|
|
class TimelineIndicator : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
//static const int s_MinimalZoomPoints = 1; // no need to zoom out of 100% (logically)
|
|
static const int s_TimeTextDistanceTolerancePixels = 10;
|
|
static const int s_pbSize = 18;
|
|
|
|
public:
|
|
explicit TimelineIndicator(QWidget *parent);
|
|
~TimelineIndicator();
|
|
qint64 zoomFactorPoints() const { return m_zoomFactorPoints * 1000; }
|
|
|
|
/**
|
|
* @brief refreshes the indicator data, which triggers all views to refresh also
|
|
*/
|
|
void refreshData();
|
|
|
|
private:
|
|
QVector<qint64> m_timeArray;
|
|
qint64 m_zoomFactorPoints;
|
|
QPushButton *m_pbZoom;
|
|
QPushButton *m_pbUnzoom;
|
|
QComboBox *m_cbZoomLevel;
|
|
int m_currentTextHeight; // text height of last drawn text
|
|
int m_currentTextWidth;
|
|
LineMap m_lineMap;
|
|
int m_sectionPos;
|
|
int m_sectionSize;
|
|
NGL::INGLLogger &m_logger;
|
|
|
|
protected:
|
|
/**
|
|
* @brief draws all date texts on itself
|
|
*/
|
|
void paintEvent(QPaintEvent *);
|
|
|
|
signals:
|
|
/**
|
|
* @brief gives connected classes new max & min values
|
|
* @param min new first event in timeline in seconds since epoch
|
|
* @param max new last event in timeline in seconds since epoch
|
|
*/
|
|
void signalSetTimelineRange(qint64 min, qint64 max);
|
|
|
|
/**
|
|
* @brief gives connected classes new zoom factor value (seconds)
|
|
* @param zoomFactor new zoom factor
|
|
*/
|
|
void signalSetZoomFactor(qint64 zoomFactor);
|
|
|
|
/**
|
|
* @brief gives connected classes the command to delete their line list (date text line lists)
|
|
*/
|
|
void signalResetLineList();
|
|
|
|
/**
|
|
* @brief gives connected classes date text line pixel position which should be added to a list,
|
|
* so that the view can draw them on itself
|
|
* @param posX pixel position of date text line
|
|
*/
|
|
void signalAddLine(int posX, qint64 time);
|
|
|
|
void signalZoomChanged();
|
|
|
|
|
|
private slots:
|
|
void afterZoom();
|
|
|
|
|
|
public slots:
|
|
|
|
/**
|
|
* @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 is called when push button "zoom" (+) is pressed
|
|
*/
|
|
void slotZoom();
|
|
|
|
/**
|
|
* @brief is called when push button "zoom" (+) is pressed
|
|
*/
|
|
void slotUnzoom();
|
|
|
|
/**
|
|
* @brief deletes line list (date text line lists)
|
|
*/
|
|
void slotResetLineList();
|
|
|
|
/**
|
|
* @brief add date text line pixel position which should be added to a list,
|
|
* so that the view can draw them on itself
|
|
* @param posX pixel position of date text line
|
|
*/
|
|
void slotAddLine(double posX, qint64 time);
|
|
|
|
};
|
|
|
|
}
|