You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.1 KiB
68 lines
1.1 KiB
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QMap>
|
|
#include <QList>
|
|
|
|
#include <parted/parted.h>
|
|
|
|
class DeviceInfo
|
|
{
|
|
public:
|
|
QString model;
|
|
QString transport;
|
|
QString size;
|
|
long sec_ph;
|
|
long sec_log;
|
|
DeviceInfo(): size(0), sec_ph(0), sec_log(0) {}
|
|
};
|
|
|
|
class PartitionInfo
|
|
{
|
|
public:
|
|
int num;
|
|
long begin;
|
|
long end;
|
|
QString size;
|
|
QString type;
|
|
QString fs;
|
|
QString name;
|
|
long flags;
|
|
PartitionInfo(): num(0), begin(0), end(0), size(0), flags(0) {}
|
|
};
|
|
|
|
typedef QMap<int, PedPartition*> Partitions;
|
|
typedef QMap<QString, PedDevice*> Devices;
|
|
|
|
class LibPartedError
|
|
{
|
|
public:
|
|
LibPartedError() {}
|
|
virtual ~LibPartedError() {}
|
|
};
|
|
|
|
class LibParted : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit LibParted(QObject *parent = 0);
|
|
~LibParted();
|
|
|
|
public:
|
|
QString getVersion();
|
|
void Init();
|
|
QStringList getDevices();
|
|
DeviceInfo getDeviceInfo(const QString& path) throw(LibPartedError);
|
|
QList<PartitionInfo> getPartitionList(const QString& path) throw(LibPartedError);
|
|
|
|
private:
|
|
DeviceInfo convertPedDevice(const PedDevice* dev);
|
|
QString sizeHuman(const long long size);
|
|
|
|
private:
|
|
Devices m_DeviceList;
|
|
|
|
};
|
|
|