1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@escomposlinux.org>
|
---|
3 |
|
---|
4 | This program is free software; you can redistribute it and/or modify
|
---|
5 | it under the terms of the GNU General Public License as published by
|
---|
6 | the Free Software Foundation; either version 2 of the License, or
|
---|
7 | (at your option) any later version.
|
---|
8 |
|
---|
9 | This program is distributed in the hope that it will be useful,
|
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License
|
---|
15 | along with this program; if not, write to the Free Software
|
---|
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef CHAPTERS_H
|
---|
20 | #define CHAPTERS_H
|
---|
21 |
|
---|
22 | #include <QMap>
|
---|
23 | #include "helper.h"
|
---|
24 |
|
---|
25 | /* Class to store info about chapters */
|
---|
26 |
|
---|
27 | class ChapterData {
|
---|
28 |
|
---|
29 | public:
|
---|
30 | ChapterData() { _name = ""; _start = 0 ; _end = 0 ; _ID = -1; };
|
---|
31 | ~ChapterData() { };
|
---|
32 |
|
---|
33 | void setName( const QString & n ) { _name = n; };
|
---|
34 | void setStart( double start ) { _start = start; };
|
---|
35 | void setEnd( double end ) { _end = end; };
|
---|
36 | void setID( int id ) { _ID = id; };
|
---|
37 |
|
---|
38 | QString name() const { return _name; };
|
---|
39 | double start() const { return _start; };
|
---|
40 | double end() const { return _end; };
|
---|
41 | int ID() const { return _ID; };
|
---|
42 | protected:
|
---|
43 | QString _name;
|
---|
44 | double _start;
|
---|
45 | double _end;
|
---|
46 |
|
---|
47 | int _ID;
|
---|
48 | };
|
---|
49 |
|
---|
50 | class Chapters {
|
---|
51 |
|
---|
52 | public:
|
---|
53 | Chapters();
|
---|
54 | ~Chapters();
|
---|
55 |
|
---|
56 | void clear();
|
---|
57 | void list();
|
---|
58 |
|
---|
59 | void addName(int ID, QString name);
|
---|
60 | void addStart(int ID, double start);
|
---|
61 | void addEnd(int ID, double end);
|
---|
62 | void addID(int ID);
|
---|
63 |
|
---|
64 | int numItems();
|
---|
65 | bool existsItemAt(int n);
|
---|
66 |
|
---|
67 | ChapterData itemAt(int n);
|
---|
68 | ChapterData item(int ID);
|
---|
69 | ChapterData itemFromTime(double sec);
|
---|
70 | ChapterData itemAfterTime(double sec);
|
---|
71 | ChapterData itemBeforeTime(double sec);
|
---|
72 | int find(int ID);
|
---|
73 |
|
---|
74 | protected:
|
---|
75 | typedef QMap <int, ChapterData> ChapterMap;
|
---|
76 | ChapterMap cm;
|
---|
77 | };
|
---|
78 |
|
---|
79 | #endif
|
---|