Revert previous commit, was incorrect
[amarok.git] / src / devicemanager.h
blob7fa66a84afce4d09a4f6a4de4e42e7671ee61f64
1 //
2 // C++ Interface: devicemanager
3 //
4 // Description: Controls device/medium object handling, providing
5 // helper functions for other objects
6 //
7 //
8 // Author: Jeff Mitchell <kde-dev@emailgoeshere.com>, (C) 2006
9 // Maximilian Kossick <maximilian.kossick@googlemail.com>, (C) 2006
11 // Copyright: See COPYING file that comes with this distribution
16 #ifndef AMAROK_DEVICE_MANAGER_H
17 #define AMAROK_DEVICE_MANAGER_H
19 #include "medium.h"
21 #include <QMap>
24 typedef QMap<QString, Medium*> MediumMap;
26 //this class provides support for MountPointManager and MediaDeviceManager
27 //the latter is responsible for handling mediadevices (e.g. ipod)
28 //unless you have special requirements you should use either MountPointManager or
29 //MediaDeviceManager instead of this class.
30 class DeviceManager : public QObject
33 Q_OBJECT
34 public:
35 DeviceManager();
36 ~DeviceManager();
37 static DeviceManager *instance();
39 void mediumAdded( const QString name );
40 void mediumChanged( const QString name);
41 void mediumRemoved( const QString name);
43 MediumMap getMediumMap() { return m_mediumMap; }
44 Medium* getDevice( const QString name );
45 // reconciles m_mediumMap to whatever kded has in it.
46 void reconcileMediumMap();
48 bool isValid() { return m_valid; }
50 //only use getDeviceList to initialise clients
51 Medium::List getDeviceList();
53 //public so can be called from DCOP...but don't use this, see the
54 //warning about getDeviceList()
55 QStringList getDeviceStringList();
57 // Converts a media://media/hdc URL as provided by the KDE media
58 // manager on CD insert to /dev/hdc so amarok can play it.
59 // This method is safe to call with a device path, it returns it
60 // unchanged.
61 QString convertMediaUrlToDevice( QString url );
63 public slots:
64 void deviceAdded( const QString &dui );
65 void deviceRemoved( const QString &udi );
67 signals:
68 void deviceAdded( const QString &udi );
69 void deviceRemoved( const QString &udi );
71 private:
73 bool m_valid;
74 MediumMap m_mediumMap;
78 #endif