source: smplayer/trunk/src/titletracks.h@ 188

Last change on this file since 188 was 188, checked in by Silvan Scherrer, 8 years ago

SMPlayer: update trunk to version 17.1.0

  • Property svn:eol-style set to LF
File size: 2.3 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
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 TITLETRACKS_H
20#define TITLETRACKS_H
21
22#include <QMap>
23#include "helper.h"
24
25/* Class to store info about DVD titles */
26
27class TitleData {
28
29public:
30 TitleData() { _name = ""; _duration = 0; _ID = -1; _chapters = 0; _angles = 0; };
31 ~TitleData() {};
32
33 void setName( const QString & n ) { _name = n; };
34 void setDuration( double d ) { _duration = d; };
35 void setChapters( int n ) { _chapters = n; };
36 void setAngles( int n ) { _angles = n; };
37 void setID( int id ) { _ID = id; };
38
39 QString name() const { return _name; };
40 double duration() const { return _duration; };
41 int chapters() const { return _chapters; };
42 int angles() const { return _angles; };
43 int ID() const { return _ID; };
44
45 QString displayName() const {
46 QString dname = "";
47
48 if (!_name.isEmpty()) {
49 dname = _name;
50 }
51 else
52 dname = QString::number(_ID);
53
54 if (_duration > 0) {
55 dname += " ("+ Helper::formatTime( (int) _duration ) +")";
56 }
57
58 return dname;
59 };
60
61protected:
62 QString _name;
63 double _duration;
64 int _chapters;
65 int _angles;
66
67 int _ID;
68};
69
70
71class TitleTracks {
72
73public:
74 TitleTracks();
75 ~TitleTracks();
76
77 void clear();
78 void list();
79
80 void addName(int ID, QString name);
81 void addDuration(int ID, double duration);
82 void addChapters(int ID, int n);
83 void addAngles(int ID, int n);
84 void addID(int ID);
85
86 int numItems();
87 bool existsItemAt(int n);
88
89 TitleData itemAt(int n);
90 TitleData item(int ID);
91 int find(int ID);
92
93protected:
94 typedef QMap <int, TitleData> TitleMap;
95 TitleMap tm;
96};
97
98#endif
Note: See TracBrowser for help on using the repository browser.