slight improvement to the context view layout imo.
[amarok.git] / src / MediaDeviceCache.h
blob867d6b5e295875f169d4a57af5631a3e663ff760
1 /*
2 * Copyright (c) 2007 Jeff Mitchell <kde-dev@emailgoeshere.com>
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #ifndef AMAROK_MEDIADEVICECACHE_H
19 #define AMAROK_MEDIADEVICECACHE_H
21 #include "amarok_export.h"
23 #include <QObject>
24 #include <QMap>
25 #include <QString>
27 namespace Solid {
28 class Device;
31 class MediaDeviceCache : public QObject
33 Q_OBJECT
35 public:
37 enum DeviceType { SolidPMPType, SolidVolumeType, ManualType, InvalidType };
39 static MediaDeviceCache* instance() { return s_instance ? s_instance : new MediaDeviceCache(); }
41 /**
42 * Creates a new MediaDeviceCache.
45 MediaDeviceCache();
46 ~MediaDeviceCache();
48 void refreshCache();
49 const QStringList getAll() const { return m_type.keys(); }
50 const MediaDeviceCache::DeviceType deviceType( const QString &udi ) const;
51 const QString deviceName( const QString &udi ) const;
52 bool isGenericEnabled( const QString &udi ) const;
53 const QString volumeMountPoint( const QString &udi ) const;
55 signals:
56 void deviceAdded( const QString &udi );
57 void deviceRemoved( const QString &udi );
59 public slots:
60 void slotAddSolidDevice( const QString &udi );
61 void slotRemoveSolidDevice( const QString &udi );
62 void slotAccessibilityChanged( bool accessible, const QString &udi );
64 private:
65 QMap<QString, MediaDeviceCache::DeviceType> m_type;
66 QMap<QString, QString> m_name;
67 QStringList m_volumes;
68 static MediaDeviceCache* s_instance;
71 #endif /* AMAROK_MEDIADEVICECACHE_H */