[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasma-mediacenter] libs/mediacenter: Cleanup mediacenter utility
From: Shantanu Tushar <shaan7in () gmail ! com>
Date: 2012-07-20 12:58:31
Message-ID: 20120720125831.1DC89A6094 () git ! kde ! org
[Download RAW message or body]
Git commit fd69b4558c9cf55f5a9bfdeba2c96000a5d6894e by Shantanu Tushar.
Committed on 20/07/2012 at 14:58.
Pushed by shantanu into branch 'master'.
Cleanup mediacenter utility
M +0 -62 libs/mediacenter/mediacenter.cpp
M +0 -70 libs/mediacenter/mediacenter.h
http://commits.kde.org/plasma-mediacenter/fd69b4558c9cf55f5a9bfdeba2c96000a5d6894e
diff --git a/libs/mediacenter/mediacenter.cpp b/libs/mediacenter/mediacenter.cpp
index 510bba6..0a3fdc4 100644
--- a/libs/mediacenter/mediacenter.cpp
+++ b/libs/mediacenter/mediacenter.cpp
@@ -30,68 +30,6 @@
namespace MediaCenter {
-MediaType getType(const QString &media)
-{
- QFileInfo info(media);
- if (info.exists()) {
- KMimeType::Ptr mime = KMimeType::findByPath(media);
- if (mime->name().startsWith(QLatin1String("image/"))) {
- return Picture;
- } else if (mime->name().startsWith(QLatin1String("video/"))) {
- return Video;
- } else if (mime->name().startsWith(QLatin1String("audio/"))) {
- return Audio;
- } else {
- return Invalid;
- }
- } else { // it is not a file
- Solid::Device genericDevice(media);
- if (!genericDevice.isValid()) {
- return Invalid;
- }
- Solid::OpticalDisc *opticalDisc = genericDevice.as<Solid::OpticalDisc>();
- if (!opticalDisc) {
- return Invalid;
- }
-
- return OpticalDisc;
- }
-}
-
-Media mediaFromMediaSource(const Phonon::MediaSource &source)
-{
- if (source.url().isValid()) {
- Media media;
- media.second = KUrl(source.url()).path();
- media.first = getType(media.second);
- if (media.first == MediaCenter::Invalid) {
- media.second = "";
- return media;
- }
- return media;
- }
-
- if (!source.fileName().isEmpty()) {
- Media media;
- media.second = source.fileName();
- media.first = getType(media.second);
- if (media.first == MediaCenter::Invalid) {
- media.second = "";
- return media;
- }
- return media;
- }
-
- if (!source.deviceName().isEmpty()) {
- Media media;
- media.second = source.deviceName();
- media.first = MediaCenter::OpticalDisc;
- return media;
- }
-
- return Media();
-}
-
QHash<int, QByteArray> appendAdditionalMediaRoles (const QHash<int, QByteArray> \
&roles) {
QHash<int, QByteArray> newRoles(roles);
diff --git a/libs/mediacenter/mediacenter.h b/libs/mediacenter/mediacenter.h
index 8bb48c3..c9d073f 100644
--- a/libs/mediacenter/mediacenter.h
+++ b/libs/mediacenter/mediacenter.h
@@ -40,77 +40,7 @@ enum AdditionalMediaRoles {
ResourceIdRole
};
-enum MediaType {
- Invalid = 0x0,
- Picture = 0x1,
- Video = 0x2,
- Audio = 0x4,
- OpticalDisc = 0x8
-};
-Q_DECLARE_FLAGS(MediaTypes, MediaType)
-
-enum UIComponent {
- UIControlBar,
- UIInfoBar,
- UIBrowser,
- UIPlayer,
- UIPlaylist,
- UIHomeScreen
-};
-
-enum InfoDisplayMode {
- InfoDisplayFloating,
- InfoDisplayBottom
-};
-
-enum PlaybackState {
- PlayingState,
- StoppedState,
- PausedState,
- SinglePictureState
-};
-
-/**
- * Each applet needs to be able to accept widgets into
- * different zones. The states that send the widgets to the applets, also send
- * this zone information along
- */
-
-enum LayoutZone {
- LeftZone,
- MiddleZone,
- RightZone,
-};
-
MEDIACENTER_EXPORT QHash<int, QByteArray> appendAdditionalMediaRoles (const \
QHash<int, QByteArray> &roles);
-
-/**
- * @typedef Media defines a QPair of MediaCenter::MediaType and QString.
- * The first argument is the type of the media while the second is a QString
- * defining the media. It might be both an udi string pointing to the device
- * hosting the media or the path to a media file.
- */
-typedef QPair<MediaType, QString> Media;
-
-/**
- * Returns the correct type identifying the source represented
- * by the given string.
- *
- * @param media: the string representing the media. It could be
- * either the udi of the device hosting the media
- * or the path of the local file.
- */
-MEDIACENTER_EXPORT MediaType getType(const QString &media);
-
-/**
- * @return a MediaCenter::Media from the given Phonon::MediaSource or
- * an invalid MediaCenter::Media if an error occurrs.
- * @note an invalid MediaCenter::Media has MediaType Invalid and empty QString.
- */
-MEDIACENTER_EXPORT Media mediaFromMediaSource(const Phonon::MediaSource &);
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(MediaCenter::MediaTypes)
-
} // namespace MediaCenter
#endif // MEDIACENTER_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic