QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SubtitleTrack.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QList>
4#include <QtCore/QObject>
5#include <QtCore/QString>
6#include <QtCore/QUrl>
7#include <QtCore/QVariantList>
8#include <QtQmlIntegration/QtQmlIntegration>
9
16class SubtitleTrack : public QObject
17{
18 Q_OBJECT
19 QML_ELEMENT
20
21 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
22 Q_PROPERTY(qint64 position READ position WRITE setPosition NOTIFY positionChanged)
23 Q_PROPERTY(int playResX READ playResX NOTIFY sourceChanged)
24 Q_PROPERTY(int playResY READ playResY NOTIFY sourceChanged)
25 Q_PROPERTY(double fontSize READ fontSize NOTIFY sourceChanged)
26 Q_PROPERTY(QVariantList events READ events NOTIFY eventsChanged)
27
28public:
29 explicit SubtitleTrack(QObject* parent = nullptr);
30
32 QUrl source() const { return _source; }
33
34 void setSource(const QUrl& source);
35
37 qint64 position() const { return _position; }
38
39 void setPosition(qint64 position);
40
41 int playResX() const { return _playResX; }
42
43 int playResY() const { return _playResY; }
44
45 double fontSize() const { return _fontSize; }
46
50 QVariantList events() const { return _shown; }
51
52signals:
56
57private:
58 struct Event
59 {
60 qint64 startMs = 0;
61 qint64 endMs = 0;
62 QString text;
63 double x = 0;
64 double y = 0;
65 int alignment = 1;
66 };
67
69 void _parse(const QString& content);
70 void _updateShown();
71
72 QUrl _source;
73 qint64 _position = 0;
74 int _playResX = 384;
75 int _playResY = 288;
76 double _fontSize = 20;
77 QList<Event> _events;
79 QList<qsizetype> _shownIndexes;
80 QVariantList _shown;
81};
int playResY() const
int playResX() const
void positionChanged()
QUrl source() const
A local file; empty for none.
void setSource(const QUrl &source)
QVariantList events() const
void sourceChanged()
void setPosition(qint64 position)
double fontSize() const
qint64 position() const
Milliseconds from the start of the recording.
SubtitleTrack(QObject *parent=nullptr)
void eventsChanged()