Blame view

Segment.h 1.56 KB
3f2992b2c   bostx   V1.0
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
  #ifndef SEGMENT_H
  #define SEGMENT_H
  
  #include <QString>
  #include <QList>
  #include <QJsonObject>
  
  class Segment
  {
   public:
    enum Source {
      Manual, Automatic, Both
    };
  
    Segment(Segment *parent = 0);
    Segment(qint64 position = 0, Segment *parent = 0, Source source = Manual);
    virtual ~Segment();
    virtual void read(const QJsonObject &json);
    virtual void write(QJsonObject &json) const;
  
    Segment *child(int row);
    void appendChild(Segment *childSegment);
    void insertChild(int row, Segment *segment);
    void removeChild(int row);
    int childCount() const;
    virtual QString display() const = 0;
    int row() const;
    Segment *parent();
    Segment *getNextSegment();
  
    qint64 getPosition() const;
    QString getFormattedPosition() const;
    QList<Segment *> getChildren() const;
    int getHeight() const;
    Source getSource() const;
    void containsSpeech(bool &flag) const;
    void setPosition(qint64 position);
    void setSource(Source source);
  
    void setChildren(const QList<Segment *> &children);
    void setParent(Segment *parent);
    int childIndexFromPosition(qint64 position);
    void clearChildren();
    void splitChildren(QList<Segment *> &subList1, QList<Segment *> &subList2, int pos, Segment *newParent);
  
    virtual void setEnd(qint64 end);
    virtual int getNumber() const;
    virtual qint64 getEnd() const;
    virtual QString getLabel() const;
    virtual void setLabel(const QString &label);
    virtual int getCamera(Segment::Source source) const;
  
   protected:
    qint64 m_position;
    Source m_source;
    QList<Segment *> m_childSegments;
  
   private:
    Segment *m_parentSegment;
  };
  
  #endif