Phonon  4.7.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
mediacontroller.h
1 /*
2  Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
3  Copyright (C) 2011 Harald Sitter <sitter@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) version 3, or any
9  later version accepted by the membership of KDE e.V. (or its
10  successor approved by the membership of KDE e.V.), Nokia Corporation
11  (or its successors, if any) and the KDE Free Qt Foundation, which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifndef PHONON_MEDIACONTROLLER_H
25 #define PHONON_MEDIACONTROLLER_H
26 
27 #include "phonon_export.h"
28 #include "objectdescription.h"
29 
30 #include <QtCore/QObject>
31 #include <QtCore/QtGlobal>
32 
33 
34 #ifndef QT_NO_PHONON_MEDIACONTROLLER
35 
36 namespace Phonon
37 {
38 class MediaControllerPrivate;
39 class MediaObject;
40 
47 class PHONON_EXPORT MediaController : public QObject
48 {
49  Q_OBJECT
50  Q_FLAGS(Features)
51  public:
52  enum Feature {
58  Angles = 1,
63  Chapters = 2,
68  Navigations = 3,
73  Titles = 4,
77  Subtitles = 5,
82  AudioChannels = 6
83  };
84  Q_DECLARE_FLAGS(Features, Feature)
85 
87  RootMenu,
98  AngleMenu
99  };
100 
101  MediaController(MediaObject *parent);
102  ~MediaController();
103 
104  Features supportedFeatures() const;
105 
106  int availableAngles() const;
107  int currentAngle() const;
108 
109  int availableChapters() const;
110  int currentChapter() const;
111 
129  static QString navigationMenuToString(NavigationMenu menu);
130 
142  QList<NavigationMenu> availableMenus() const;
143 
144  int availableTitles() const;
145  int currentTitle() const;
146 
147  bool autoplayTitles() const;
148 
155  AudioChannelDescription currentAudioChannel() const;
156 
163  SubtitleDescription currentSubtitle() const;
164 
189  bool subtitleAutodetect() const;
190 
197  QString subtitleEncoding() const;
198 
206  QFont subtitleFont() const;
207 
215  QList<Phonon::AudioChannelDescription> availableAudioChannels() const;
216 
224  QList<SubtitleDescription> availableSubtitles() const;
225 
237  void setCurrentAudioChannel(const Phonon::AudioChannelDescription &stream);
238 
244  void setCurrentMenu(NavigationMenu menu);
245 
257  void setCurrentSubtitle(const Phonon::SubtitleDescription &stream);
258 
267  void setCurrentSubtitle(const QUrl &url);
268 
284  void setSubtitleAutodetect(bool enable);
285 
301  void setSubtitleEncoding(const QString &encoding);
302 
317  void setSubtitleFont(const QFont &font);
318 
319  public Q_SLOTS:
320  void setCurrentAngle(int angleNumber);
321  void setCurrentChapter(int chapterNumber);
322 
329  void setCurrentTitle(int titleNumber);
330  void setAutoplayTitles(bool);
331 
338  void nextTitle();
339 
346  void previousTitle();
347 
348  Q_SIGNALS:
349  void availableAnglesChanged(int availableAngles);
350  void availableAudioChannelsChanged();
351  void availableChaptersChanged(int availableChapters);
352 
363  void availableMenusChanged(QList<NavigationMenu> menus);
364  void availableSubtitlesChanged();
365  void availableTitlesChanged(int availableTitles);
366 
367  void angleChanged(int angleNumber);
368  void chapterChanged(int chapterNumber);
369  void titleChanged(int titleNumber);
370 
371  protected:
372  MediaControllerPrivate *const d;
373 };
374 
375 } // namespace Phonon
376 
377 Q_DECLARE_OPERATORS_FOR_FLAGS(Phonon::MediaController::Features)
378 
379 Q_DECLARE_METATYPE(Phonon::MediaController::NavigationMenu)
380 Q_DECLARE_METATYPE(QList<Phonon::MediaController::NavigationMenu>)
381 
382 #endif //QT_NO_PHONON_MEDIACONTROLLER
383 
384 
385 #endif // PHONON_MEDIACONTROLLER_H