1
/*
2
    <Simple class representing an USB device with needed information>
3
    Copyright (C) <2011>  <Lisa "shainer" Vitolo>
4
5
    This program is free software: you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation, either version 3 of the License, or
8
    (at your option) any later version.
9
10
    This program 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
13
    GNU General Public License for more details.
14
15
    You should have received a copy of the GNU General Public License
16
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
20
#include "usbdevice.h"
21
22
using namespace Solid;
23
24
USBDevice::USBDevice() {}
25
26
USBDevice::USBDevice(QString p, Device d) : path(p), device(d) {}
27
28
QString USBDevice::getPath()
29
{
30
  return path;
31
}
32
33
Device USBDevice::getDevice()
34
{
35
  return device;
36
}
37
38
QString USBDevice::getVendor()
39
{
40
  return device.vendor();
41
}
42
43
int USBDevice::getCapacity()
44
{
45
  QString giga = QVariant(device.as<StorageVolume>()->size()).toString();
46
  float g = giga.toFloat();
47
  int gig = (int) (g / 1024) / 1024;
48
  
49
  return gig;
50
}
51
52
QString USBDevice::getFilesystem()
53
{
54
  return device.as<StorageVolume>()->fsType();
55
}