Solid::StorageDrive Class
class Solid::StorageDriveThis device interface is available on storage devices. More...
| Header: | #include <Solid/StorageDrive> |
| CMake: | find_package(KF6 REQUIRED COMPONENTS Solid)target_link_libraries(mytarget PRIVATE KF6::Solid) |
| Inherits: | Solid::DeviceInterface |
| Inherited By: |
Public Types
| enum | Bus { Ide, Usb, Ieee1394, Scsi, Sata, Platform } |
| enum | DriveType { HardDisk, CdromDrive, Floppy, Tape, CompactFlash, …, Xd } |
Properties
|
|
Public Functions
| Solid::StorageDrive::Bus | bus() const |
| Solid::StorageDrive::DriveType | driveType() const |
| bool | isHotpluggable() const |
| bool | isInUse() const |
| bool | isRemovable() const |
| qulonglong | size() const |
(since 6.0) QDateTime | timeDetected() const |
(since 6.0) QDateTime | timeMediaDetected() const |
Static Public Members
| Solid::DeviceInterface::Type | deviceInterfaceType() |
Detailed Description
A storage is anything that can contain a set of volumes (card reader, hard disk, cdrom drive...). It's a particular kind of block device.
A StorageDrive is commonly used in conjunction with StorageVolume and StorageAccess.
| StorageDrive | StorageVolume | StorageAccess |
|---|---|---|
| drives | partition tables / filesystems | mount points / partitions |
It can be used to fetch a parent device of a StorageVolume that is a StorageDrive in order to check its properties, for example:
const Solid::Device& dev = m_device;
if (dev.is<Solid::StorageVolume>() && dev.parent().is<Solid::StorageDrive>()) {
auto parent = dev.parent().as<Solid::StorageDrive>();
if (parent->isRemovable() || parent->isHotpluggable()) {
usable = false;
}
const Solid::StorageVolume* volume = dev.as<Solid::StorageVolume>();
if (volume->isIgnored() || volume->usage() != Solid::StorageVolume::FileSystem) {
usable = false;
}
}
Member Type Documentation
enum StorageDrive::Bus
This enum type defines the type of bus a storage device is attached to.
| Constant | Value | Description |
|---|---|---|
Solid::StorageDrive::Ide | 0 | An Integrated Drive Electronics (IDE) bus, also known as ATA |
Solid::StorageDrive::Usb | 1 | An Universal Serial Bus (USB) |
Solid::StorageDrive::Ieee1394 | 2 | An Ieee1394 bus, also known as Firewire |
Solid::StorageDrive::Scsi | 3 | A Small Computer System Interface bus |
Solid::StorageDrive::Sata | 4 | A Serial Advanced Technology Attachment (SATA) bus |
Solid::StorageDrive::Platform | 5 | A legacy bus that is part of the underlying platform |
enum StorageDrive::DriveType
This enum type defines the type of drive a storage device can be.
| Constant | Value | Description |
|---|---|---|
Solid::StorageDrive::HardDisk | 0 | A hard disk |
Solid::StorageDrive::CdromDrive | 1 | An optical drive |
Solid::StorageDrive::Floppy | 2 | A floppy disk drive |
Solid::StorageDrive::Tape | 3 | A tape drive |
Solid::StorageDrive::CompactFlash | 4 | A Compact Flash card reader |
Solid::StorageDrive::MemoryStick | 5 | A Memory Stick card reader |
Solid::StorageDrive::SmartMedia | 6 | A Smart Media card reader |
Solid::StorageDrive::SdMmc | 7 | A SecureDigital/MultiMediaCard card reader |
Solid::StorageDrive::Xd | 8 | A xD card reader |
Property Documentation
[read-only] bus : Bus
Access functions:
| Solid::StorageDrive::Bus | bus() const |
[read-only] driveType : DriveType
Access functions:
| Solid::StorageDrive::DriveType | driveType() const |
[read-only] hotpluggable : bool
Access functions:
| bool | isHotpluggable() const |
[read-only] inUse : bool
Access functions:
| bool | isInUse() const |
[read-only] removable : bool
Access functions:
| bool | isRemovable() const |
[read-only] size : qulonglong
Access functions:
| qulonglong | size() const |
[read-only] timeDetected : const QDateTime
Access functions:
| QDateTime | timeDetected() const |
[read-only] timeMediaDetected : QDateTime
Access functions:
| QDateTime | timeDetected() const |
Member Function Documentation
Solid::StorageDrive::Bus StorageDrive::bus() const
Returns the bus type of the physical interface this storage device is connected to.
Note: Getter function for property bus.
See also Solid::StorageDrive::Bus.
[static] Solid::DeviceInterface::Type StorageDrive::deviceInterfaceType()
Returns the Solid::DeviceInterface::Type of the StorageDrive device interface.
See also Solid::DeviceInterface::Type.
Solid::StorageDrive::DriveType StorageDrive::driveType() const
Returns the type of this storage drive.
Note: Getter function for property driveType.
See also Solid::StorageDrive::DriveType.
bool StorageDrive::isHotpluggable() const
Returns whether this storage device can be plugged or unplugged while the computer is running (that is, it supports hotplugging).
Note: Getter function for property hotpluggable.
bool StorageDrive::isInUse() const
Returns whether the storage device is currently in use, that is, if at least one child storage access is mounted.
Note: Getter function for property inUse.
bool StorageDrive::isRemovable() const
Returns whether the media contained by this drive can be removed.
For example, a memory card can be removed from the drive by the user, while partitions can't be removed from hard disks.
Note: Getter function for property removable.
qulonglong StorageDrive::size() const
Returns this drive's size in bytes.
Note: Getter function for property size.
[since 6.0] QDateTime StorageDrive::timeDetected() const
Returns the time when the drive was detected.
Typically this means the time a drive was plugged in, or the computer rebooted.
An invalid datetime may be returned if the underlying information is not available.
Note: Getter function for properties timeDetected and timeMediaDetected.
This function was introduced in 6.0.
[since 6.0] QDateTime StorageDrive::timeMediaDetected() const
Returns the time when media in the drive was detected.
Typically this means the time a card was inserted into a reader, or the computer rebooted.
An invalid datetime may be returned if the underlying information is not available.
This function was introduced in 6.0.