SegmentMonitor.h
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef SEGMENTMONITOR_H
#define SEGMENTMONITOR_H
#include <QWidget>
#include <QMenu>
#include "SpeechSegment.h"
#include "VideoFrame.h"
class SegmentMonitor: public QWidget
{
Q_OBJECT
public:
SegmentMonitor(QWidget *parent = 0);
void reset();
qreal getRatio() const;
void setAnnotMode(bool annotMode);
public slots:
void processShot(Segment *shot);
void processSpokenFrame(qint64 position, const QString &text, const QString &speaker);
void segmentationRetrieved();
void positionChanged(qint64 position);
void updateDuration(qint64 duration);
void setWidth(int width);
void showContextMenu(const QPoint &point);
void addNewSpeaker();
void endOfAnnotation();
signals:
void playSegments(QList<QPair<qint64, qint64>> utterances);
void setSpeaker(qint64 start, qint64 end, const QString &speaker, VideoFrame::SpeakerSource source);
void resetSpeaker(qint64 prevStart, qint64 prevEnd, qint64 start, qint64 end, bool resetSub, VideoFrame::SpeakerSource source);
protected:
void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
private:
bool testShotPattern(const QList<QString> &lblWindow);
QMenu *m_speakers;
QList<QString> m_annotSpeakers;
QAction *m_newSpeakerAct;
QAction *m_endAct;
QList<QList <Segment *>> m_segmentationList;
QList <Segment *> m_currList;
qint64 m_lastStart;
qint64 m_currPosition;
QString m_currText;
QString m_currSpeaker;;
int m_width;
qreal m_ratio;
int m_step;
int m_segmentHeight;
qint64 m_duration;
QList<QColor> m_colors;
QHash<QString, QColor> m_segColors;
int m_idxColor;
QStringList m_selectedLabels;
bool m_annotMode;
qint64 m_prevPosition;
};
#endif