Phonon

phononnamespace.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) version 3, or any
8 later version accepted by the membership of KDE e.V. (or its
9 successor approved by the membership of KDE e.V.), Nokia Corporation
10 (or its successors, if any) and the KDE Free Qt Foundation, which shall
11 act as a proxy defined in Section 6 of version 3 of the license.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library. If not, see <http://www.gnu.org/licenses/>.
20
21*/
22
23#include "phononnamespace.h"
24#include "phononnamespace_p.h"
25#include "phonondefs_p.h"
26
27#include "experimental/videoframe2.h"
28
29#include "factory_p.h"
30
31#include <QCoreApplication>
32#include <QList>
33
34namespace Phonon
35{
36 /*!
37 Returns the version number of Phonon at run-time as a string (for
38 example, "4.0.0"). This may be a different version than the
39 version the application was compiled against.
40
41 \sa PHONON_VERSION_STR
42 */
43 const char *phononVersion()
44 {
45 return PHONON_VERSION_STR;
46 }
47
48 QString categoryToString(Category c)
49 {
50 switch(c)
51 {
52 case Phonon::NoCategory:
53 break;
54 case Phonon::NotificationCategory:
55 return QCoreApplication::translate("Phonon::", "Notifications");
56 case Phonon::MusicCategory:
57 return QCoreApplication::translate("Phonon::", "Music");
58 case Phonon::VideoCategory:
59 return QCoreApplication::translate("Phonon::", "Video");
60 case Phonon::CommunicationCategory:
61 return QCoreApplication::translate("Phonon::", "Communication");
62 case Phonon::GameCategory:
63 return QCoreApplication::translate("Phonon::", "Games");
64 case Phonon::AccessibilityCategory:
65 return QCoreApplication::translate("Phonon::", "Accessibility");
66 }
67 return QString();
68 }
69
70 QString categoryToString(CaptureCategory c)
71 {
72 switch(c)
73 {
74 case Phonon::NoCaptureCategory:
75 break;
76 case Phonon::CommunicationCaptureCategory:
77 return QCoreApplication::translate("Phonon::", "Communication");
78 case Phonon::RecordingCaptureCategory:
79 return QCoreApplication::translate("Phonon::", "Recording");
80 case Phonon::ControlCaptureCategory:
81 return QCoreApplication::translate("Phonon::", "Control");
82 }
83 return QString();
84 }
85
86 QDebug operator <<(QDebug dbg, const Phonon::DiscType &type)
87 {
88 switch (type) {
89 case Phonon::NoDisc:
90 dbg.space() << "Phonon::NoDisc";
91 break;
92 case Phonon::Cd:
93 dbg.space() << "Phonon::Cd";
94 break;
95 case Phonon::Dvd:
96 dbg.space() << "Phonon::Dvd";
97 break;
98 case Phonon::Vcd:
99 dbg.space() << "Phonon::Vcd";
100 break;
101 case Phonon::BluRay:
102 dbg.space() << "Phonon::BluRay";
103 break;
104 }
105 return dbg.maybeSpace();
106 }
107
108 QDebug operator <<(QDebug dbg, const Phonon::MetaData &metaData)
109 {
110 switch (metaData) {
111 case Phonon::ArtistMetaData:
112 dbg.space() << "Phonon::ArtistMetaData";
113 break;
114 case Phonon::AlbumMetaData:
115 dbg.space() << "Phonon::AlbumMetaData";
116 break;
117 case Phonon::TitleMetaData:
118 dbg.space() << "Phonon::TitleMetaData";
119 break;
120 case Phonon::DateMetaData:
121 dbg.space() << "Phonon::DateMetaData";
122 break;
123 case Phonon::GenreMetaData:
124 dbg.space() << "Phonon::GenreMetaData";
125 break;
126 case Phonon::TracknumberMetaData:
127 dbg.space() << "Phonon::TracknumberMetaData";
128 break;
129 case Phonon::DescriptionMetaData:
130 dbg.space() << "Phonon::DescriptionMetaData";
131 break;
132 case Phonon::MusicBrainzDiscIdMetaData:
133 dbg.space() << "Phonon::MusicBrainzDiscIdMetaData";
134 break;
135 }
136 return dbg.maybeSpace();
137 }
138
139 QDebug operator <<(QDebug dbg, const Phonon::State &state)
140 {
141 switch (state) {
142 case Phonon::LoadingState:
143 dbg.space() << "Phonon::LoadingState";
144 break;
145 case Phonon::StoppedState:
146 dbg.space() << "Phonon::StoppedState";
147 break;
148 case Phonon::PlayingState:
149 dbg.space() << "Phonon::PlayingState";
150 break;
151 case Phonon::BufferingState:
152 dbg.space() << "Phonon::BufferingState";
153 break;
154 case Phonon::PausedState:
155 dbg.space() << "Phonon::PausedState";
156 break;
157 case Phonon::ErrorState:
158 dbg.space() << "Phonon::ErrorState";
159 break;
160 }
161 return dbg.maybeSpace();
162 }
163
164 QDebug operator <<(QDebug dbg, const Phonon::Category &category)
165 {
166 dbg.space() << categoryToString(category);
167 return dbg.maybeSpace();
168 }
169
170 QDebug operator <<(QDebug dbg, const Phonon::CaptureCategory &category)
171 {
172 dbg.space() << categoryToString(category);
173 return dbg.maybeSpace();
174 }
175
176 QDebug operator <<(QDebug dbg, const Phonon::Capture::DeviceType &type)
177 {
178 switch (type) {
179 case Phonon::Capture::AudioType:
180 dbg.space() << "Phonon::Capture::AudioType";
181 break;
182 case Phonon::Capture::VideoType:
183 dbg.space() << "Phonon::Capture::VideoType";
184 break;
185 }
186 return dbg.maybeSpace();
187 }
188
189 QDebug operator <<(QDebug dbg, const Phonon::ErrorType &errorType)
190 {
191 switch (errorType) {
192 case Phonon::NoError:
193 dbg.space() << "Phonon::NoError";
194 break;
195 case Phonon::NormalError:
196 dbg.space() << "Phonon::NormalError";
197 break;
198 case Phonon::FatalError:
199 dbg.space() << "Phonon::FatalError";
200 break;
201 }
202 return dbg.maybeSpace();
203 }
204}
205
206static int registerPhononMetaTypes()
207{
208 qRegisterMetaType<Phonon::State>();
209 qRegisterMetaType<Phonon::ErrorType>();
210 qRegisterMetaType<Phonon::Category>();
211 qRegisterMetaType<Phonon::CaptureCategory>();
212
213 // need those for QSettings
214 qRegisterMetaType<QList<int> >();
215#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
216 qRegisterMetaTypeStreamOperators<QList<int> >("QList<int>");
217#endif
218 qRegisterMetaType<Phonon::Experimental::VideoFrame2>();
219
220 qRegisterMetaType<Phonon::DeviceAccess>();
221#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
222 qRegisterMetaTypeStreamOperators<Phonon::DeviceAccess>("Phonon::DeviceAccess");
223#endif
224 qRegisterMetaType<Phonon::DeviceAccessList>();
225#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
226 qRegisterMetaTypeStreamOperators<Phonon::DeviceAccessList>("Phonon::DeviceAccessList");
227#endif
228 return 0; // something
229}
230
231#ifdef Q_CONSTRUCTOR_FUNCTION
232Q_CONSTRUCTOR_FUNCTION(registerPhononMetaTypes)
233#else
234static const int _Phonon_registerMetaTypes = registerPhononMetaTypes();
235#endif
236
237// vim: sw=4 ts=4
QString translate(const char *context, const char *sourceText, const char *disambiguation, int n)
QDebug & maybeSpace()
QDebug & space()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 4 2024 11:55:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.