67 lines
1.3 KiB
C++
Executable File
67 lines
1.3 KiB
C++
Executable File
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <AudioVideoManagement/ava_types.h>
|
|
#include <LtsWidgets/lts_abstract_table_model.h>
|
|
#include <boost/optional.hpp>
|
|
|
|
|
|
namespace AudioVideoManagement
|
|
{
|
|
|
|
|
|
|
|
class IntervalModel : public LtsWidgets::LtsAbstractTableModel<AvaTimelinePart>
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum Columns
|
|
{
|
|
Start = 0,
|
|
End,
|
|
Duration,
|
|
};
|
|
|
|
IntervalModel();
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
|
|
|
void reset();
|
|
|
|
bool isEmpty() const { return m_vecData.isEmpty(); }
|
|
|
|
void setCurrentPosition(AvaTimePoint pos, bool forceSignal = false);
|
|
boost::optional<AvaTimePoint> currentPosition() const { return m_currentPos; }
|
|
|
|
|
|
|
|
const AvaTimelinePart &previousInterval() const;
|
|
const AvaTimelinePart &nextInterval() const;
|
|
|
|
signals:
|
|
|
|
|
|
void currentIntervalChanged(bool hasPreviousInterval, bool hasNextInterval, const QModelIndex &rowIndex);
|
|
|
|
public slots:
|
|
void setTimezoneHoursOffset(int timezoneHoursOffset);
|
|
|
|
private:
|
|
QString dateTimeToStringy(const QDateTime &dt) const;
|
|
QString msecsSinceEpochToStringy(qint64 msecs) const;
|
|
|
|
|
|
|
|
using HalfIndex = int;
|
|
HalfIndex intervalForPos(AvaTimePoint pos) const;
|
|
|
|
boost::optional<AvaTimePoint> m_currentPos;
|
|
boost::optional<HalfIndex> m_currentInterval;
|
|
|
|
int m_timezoneHoursOffset = 0;
|
|
};
|
|
|
|
}
|