File indexing completed on 2024-05-12 04:01:52

0001 /*
0002     SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef SOLID_IFACE_OPTICALDRIVE_H
0008 #define SOLID_IFACE_OPTICALDRIVE_H
0009 
0010 #include <QList>
0011 
0012 #include <solid/devices/ifaces/storagedrive.h>
0013 #include <solid/opticaldrive.h>
0014 
0015 namespace Solid
0016 {
0017 namespace Ifaces
0018 {
0019 /**
0020  * This device interface is available on CD-ROM drives.
0021  *
0022  * A Cdrom is a storage that can handle optical discs.
0023  */
0024 class OpticalDrive : virtual public StorageDrive
0025 {
0026 public:
0027     /**
0028      * Destroys a Cdrom object.
0029      */
0030     ~OpticalDrive() override;
0031 
0032     /**
0033      * Retrieves the medium types this drive supports.
0034      *
0035      * @return the flag set indicating the supported medium types
0036      */
0037     virtual Solid::OpticalDrive::MediumTypes supportedMedia() const = 0;
0038 
0039     /**
0040      * Retrieves the maximum read speed of this drive in kilobytes.
0041      *
0042      * @return the maximum read speed
0043      */
0044     virtual int readSpeed() const = 0;
0045 
0046     /**
0047      * Retrieves the maximum write speed of this drive in kilobytes.
0048      *
0049      * @return the maximum write speed
0050      */
0051     virtual int writeSpeed() const = 0;
0052 
0053     /**
0054      * Retrieves the list of supported write speeds of this drive in
0055      * kilobytes.
0056      *
0057      * @return the list of supported write speeds
0058      */
0059     virtual QList<int> writeSpeeds() const = 0;
0060 
0061     /**
0062      * Ejects any disc that could be contained in this drive.
0063      * If this drive is empty, but has a tray it'll be opened
0064      *
0065      * @return
0066      */
0067     virtual bool eject() = 0;
0068 
0069 protected:
0070     // Q_SIGNALS:
0071     /**
0072      * This signal is emitted when the eject button is pressed
0073      * on the drive.
0074      *
0075      * Please note that some (broken) drives doesn't report this event.
0076      * @param udi the UDI of the drive
0077      */
0078     virtual void ejectPressed(const QString &udi) = 0;
0079 
0080     virtual void ejectDone(Solid::ErrorType error, QVariant errorData, const QString &udi) = 0;
0081 };
0082 }
0083 }
0084 
0085 Q_DECLARE_INTERFACE(Solid::Ifaces::OpticalDrive, "org.kde.Solid.Ifaces.OpticalDrive/0.1")
0086 
0087 #endif // SOLID_IFACE_OPTICALDRIVE_H