1
/*
2
    <Class representing the USB devices currently connected to the system: header file>
3
    Copyright (C) <2011>  <Lisa "shainer" Vitolo>
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) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Lesser General Public License for more details.
14
15
    You should have received a copy of the GNU Lesser General Public
16
    License along with this library; if not, write to the Free Software
17
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18
*/
19
20
#ifndef DEVICES_H
21
#define DEVICES_H
22
23
#include <QtCore>
24
#include <QString>
25
#include <QObject>
26
27
/*
28
 * Dbus classes for device-related events
29
 */
30
#include <QDBusConnection>
31
#include <QDBusObjectPath>
32
#include <QtCore>
33
#include <QtGui>
34
35
#include <solid/device.h>
36
#include <solid/storageaccess.h>
37
#include <solid/storagevolume.h>	
38
#include <solid/storagedrive.h>
39
#include <solid/block.h>
40
41
#include <exception>
42
#include <vector>
43
44
#include "usbdevice.h"
45
46
using namespace Solid;
47
48
class DeviceList : public QObject
49
{
50
  Q_OBJECT
51
  
52
public:
53
    DeviceList() : isNotifier(false) {}
54
    USBDevice findDeviceFromPath(QString);
55
    void initOperation();
56
    void setDeviceNotifier(Device const&);
57
  
58
  signals:
59
    void refreshDevices(USBDevice, bool);
60
    
61
private:
62
    std::vector<USBDevice> devices;
63
    Device devNotifier;
64
    bool isNotifier;
65
    
66
    void initList();
67
    void addDeviceToList(Device);
68
    QString getDevPath(QString);
69
    
70
private slots:
71
    void addDevice(QDBusObjectPath dev);
72
    void removeDevice(QDBusObjectPath dev);
73
    
74
};
75
76
#endif // DEVICES_H