Solid

frontend/opticaldrive.h
1/*
2 SPDX-FileCopyrightText: 2006-2007 Kevin Ottens <ervin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef SOLID_OPTICALDRIVE_H
8#define SOLID_OPTICALDRIVE_H
9
10#include <QList>
11#include <QVariant>
12
13#include <solid/solid_export.h>
14#include <solid/solidnamespace.h>
15
16#include <solid/storagedrive.h>
17
18namespace Solid
19{
20class OpticalDrivePrivate;
21class Device;
22
23/**
24 * @class Solid::OpticalDrive opticaldrive.h <Solid/OpticalDrive>
25 *
26 * This device interface is available on CD-R*,DVD*,Blu-Ray,HD-DVD drives.
27 *
28 * An OpticalDrive is a storage that can handle optical discs.
29 */
30class SOLID_EXPORT OpticalDrive : public StorageDrive
31{
32 Q_OBJECT
33 Q_PROPERTY(MediumTypes supportedMedia READ supportedMedia)
34 Q_PROPERTY(int readSpeed READ readSpeed)
35 Q_PROPERTY(int writeSpeed READ writeSpeed)
36 Q_PROPERTY(QList<int> writeSpeeds READ writeSpeeds)
37 Q_DECLARE_PRIVATE(OpticalDrive)
38 friend class Device;
39
40public:
41 /**
42 * This enum type defines the type of medium an optical drive supports.
43 *
44 * - Cdr : A Recordable Compact Disc (CD-R)
45 * - Cdrw : A ReWritable Compact Disc (CD-RW)
46 * - Dvd : A Digital Versatile Disc (DVD)
47 * - Dvdr : A Recordable Digital Versatile Disc (DVD-R)
48 * - Dvdrw : A ReWritable Digital Versatile Disc (DVD-RW)
49 * - Dvdram : A Random Access Memory Digital Versatile Disc (DVD-RAM)
50 * - Dvdplusr : A Recordable Digital Versatile Disc (DVD+R)
51 * - Dvdplusrw : A ReWritable Digital Versatile Disc (DVD+RW)
52 * - Dvdplusdl : A Dual Layer Digital Versatile Disc (DVD+R DL)
53 * - Dvdplusdlrw : A Dual Layer Digital Versatile Disc (DVD+RW DL)
54 * - Bd : A Blu-ray Disc (BD)
55 * - Bdr : A Blu-ray Disc Recordable (BD-R)
56 * - Bdre : A Blu-ray Disc Recordable and Eraseable (BD-RE)
57 * - HdDvd : A High Density Digital Versatile Disc (HD DVD)
58 * - HdDvdr : A High Density Digital Versatile Disc Recordable (HD DVD-R)
59 * - HdDvdrw : A High Density Digital Versatile Disc ReWritable (HD DVD-RW)
60 *
61 * @see MediumTypes
62 */
64 UnknownMediumType = 0x00000,
65 Cdr = 0x00001,
66 Cdrw = 0x00002,
67 Dvd = 0x00004,
68 Dvdr = 0x00008,
69 Dvdrw = 0x00010,
70 Dvdram = 0x00020,
71 Dvdplusr = 0x00040,
72 Dvdplusrw = 0x00080,
73 Dvdplusdl = 0x00100,
74 Dvdplusdlrw = 0x00200,
75 Bd = 0x00400,
76 Bdr = 0x00800,
77 Bdre = 0x01000,
78 HdDvd = 0x02000,
79 HdDvdr = 0x04000,
80 HdDvdrw = 0x08000,
81 };
82 Q_ENUM(MediumType)
83
84 /**
85 * Stores a combination of #MediumType values.
86 */
87 Q_DECLARE_FLAGS(MediumTypes, MediumType)
88 Q_FLAG(MediumTypes)
89
90private:
91 /**
92 * Creates a new OpticalDrive object.
93 * You generally won't need this. It's created when necessary using
94 * Device::as().
95 *
96 * @param backendObject the device interface object provided by the backend
97 * @see Solid::Device::as()
98 */
99 SOLID_NO_EXPORT explicit OpticalDrive(QObject *backendObject);
100
101public:
102 /**
103 * Destroys an OpticalDrive object.
104 */
105 ~OpticalDrive() override;
106
107 /**
108 * Get the Solid::DeviceInterface::Type of the OpticalDrive device interface.
109 *
110 * @return the OpticalDrive device interface type
111 * @see Solid::Ifaces::Enums::DeviceInterface::Type
112 */
113 static Type deviceInterfaceType()
114 {
115 return DeviceInterface::OpticalDrive;
116 }
117
118 /**
119 * Retrieves the medium types this drive supports.
120 *
121 * @return the flag set indicating the supported medium types
122 */
123 MediumTypes supportedMedia() const;
124
125 /**
126 * Retrieves the maximum read speed of this drive in kilobytes per second.
127 *
128 * @return the maximum read speed
129 */
130 int readSpeed() const;
131
132 /**
133 * Retrieves the maximum write speed of this drive in kilobytes per second.
134 *
135 * @return the maximum write speed
136 */
137 int writeSpeed() const;
138
139 /**
140 * Retrieves the list of supported write speeds of this drive in
141 * kilobytes per second.
142 *
143 * @return the list of supported write speeds
144 */
145 QList<int> writeSpeeds() const;
146
147 /**
148 * Ejects any disc that could be contained in this drive.
149 * If this drive is empty, but has a tray it'll be opened.
150 *
151 * @return the status of the eject operation
152 */
153 bool eject();
154
155Q_SIGNALS:
156 /**
157 * This signal is emitted when the eject button is pressed
158 * on the drive.
159 *
160 * Please note that some (broken) drives doesn't report this event.
161 * @param udi the UDI of the drive
162 */
163 void ejectPressed(const QString &udi);
164
165 /**
166 * This signal is emitted when the attempted eject process on this
167 * drive is completed. The signal might be spontaneous, i.e.
168 * it can be triggered by another process.
169 *
170 * @param error type of error that occurred, if any
171 * @param errorData more information about the error, if any
172 * @param udi the UDI of the volume
173 */
174 void ejectDone(Solid::ErrorType error, QVariant errorData, const QString &udi);
175
176 /**
177 * This signal is emitted when eject on this drive is
178 * requested. The signal might be spontaneous, i.e. it
179 * can be triggered by another process.
180 *
181 * @param udi the UDI of the volume
182 */
183 void ejectRequested(const QString &udi);
184};
185
186Q_DECLARE_OPERATORS_FOR_FLAGS(OpticalDrive::MediumTypes)
187
188}
189
190#endif // SOLID_OPTICALDRIVE_H
Type
This enum type defines the type of device interface that a Device can have.
This class allows applications to deal with devices available in the underlying system.
This device interface is available on CD-R*,DVD*,Blu-Ray,HD-DVD drives.
void ejectDone(Solid::ErrorType error, QVariant errorData, const QString &udi)
This signal is emitted when the attempted eject process on this drive is completed.
MediumType
This enum type defines the type of medium an optical drive supports.
void ejectRequested(const QString &udi)
This signal is emitted when eject on this drive is requested.
void ejectPressed(const QString &udi)
This signal is emitted when the eject button is pressed on the drive.
This device interface is available on storage devices.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:23 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.