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_OPTICALDISC_H
8#define SOLID_OPTICALDISC_H
9
10#include <solid/solid_export.h>
11
12#include <solid/storagevolume.h>
13
14namespace Solid
15{
16class OpticalDiscPrivate;
17class Device;
18
19/*!
20 * \class Solid::OpticalDisc
21 * \inheaderfile Solid/OpticalDisc
22 * \inmodule Solid
23 *
24 * \brief This device interface is available on optical discs.
25 *
26 * An optical disc is a volume that can be inserted in CD-R*,DVD*,Blu-Ray,HD-DVD drives.
27 */
28class SOLID_EXPORT OpticalDisc : public StorageVolume
29{
30 Q_OBJECT
31
32 /*!
33 * \property Solid::OpticalDisc::availableContent
34 */
35 Q_PROPERTY(ContentTypes availableContent READ availableContent)
36
37 /*!
38 * \property Solid::OpticalDisc::discType
39 */
40 Q_PROPERTY(DiscType discType READ discType)
41
42 /*!
43 * \property Solid::OpticalDisc::appendable
44 */
45 Q_PROPERTY(bool appendable READ isAppendable)
46
47 /*!
48 * \property Solid::OpticalDisc::blank
49 */
50 Q_PROPERTY(bool blank READ isBlank)
51
52 /*!
53 * \property Solid::OpticalDisc::rewritable
54 */
55 Q_PROPERTY(bool rewritable READ isRewritable)
56
57 /*!
58 * \property Solid::OpticalDisc::capacity
59 */
60 Q_PROPERTY(qulonglong capacity READ capacity)
61
62 Q_DECLARE_PRIVATE(OpticalDisc)
63 friend class Device;
64
65public:
66 /*!
67 * This enum type defines the type of content available in an optical disc.
68 *
69 * \value NoContent
70 * \value Audio A disc containing audio
71 * \value Data A disc containing data
72 * \value VideoCd A Video Compact Disc (VCD)
73 * \value SuperVideoCd A Super Video Compact Disc (SVCD)
74 * \value VideoDvd A Video Digital Versatile Disc (DVD-Video)
75 * \value VideoBluRay
76 */
77 enum ContentType {
78 NoContent = 0x00,
79 Audio = 0x01,
80 Data = 0x02,
81 VideoCd = 0x04,
82 SuperVideoCd = 0x08,
83 VideoDvd = 0x10,
84 VideoBluRay = 0x20,
85 };
86 Q_ENUM(ContentType)
87
88 Q_DECLARE_FLAGS(ContentTypes, ContentType)
89 Q_FLAG(ContentTypes)
90
91 /*!
92 * This enum type defines the type of optical disc it can be.
93 *
94 * \value UnknownDiscType An undetermined disc type
95 * \value CdRom A Compact Disc Read-Only Memory (CD-ROM)
96 * \value CdRecordable A Compact Disc Recordable (CD-R)
97 * \value CdRewritable A Compact Disc ReWritable (CD-RW)
98 * \value DvdRom A Digital Versatile Disc Read-Only Memory (DVD-ROM)
99 * \value DvdRam A Digital Versatile Disc Random Access Memory (DVD-RAM)
100 * \value DvdRecordable A Digital Versatile Disc Recordable (DVD-R)
101 * \value DvdRewritable A Digital Versatile Disc ReWritable (DVD-RW)
102 * \value DvdPlusRecordable A Digital Versatile Disc Recordable (DVD+R)
103 * \value DvdPlusRewritable A Digital Versatile Disc ReWritable (DVD+RW)
104 * \value DvdPlusRecordableDuallayer A Digital Versatile Disc Recordable Dual-Layer (DVD+R DL)
105 * \value DvdPlusRewritableDuallayer A Digital Versatile Disc ReWritable Dual-Layer (DVD+RW DL)
106 * \value BluRayRom A Blu-ray Disc (BD)
107 * \value BluRayRecordable A Blu-ray Disc Recordable (BD-R)
108 * \value BluRayRewritable A Blu-ray Disc (BD-RE)
109 * \value HdDvdRom: A High Density Digital Versatile Disc (HD DVD)
110 * \value HdDvdRecordable A High Density Digital Versatile Disc Recordable (HD DVD-R)
111 * \value HdDvdRewritable A High Density Digital Versatile Disc ReWritable (HD DVD-RW)
112 */
113 enum DiscType {
114 UnknownDiscType = -1,
115 CdRom,
116 CdRecordable,
117 CdRewritable,
118 DvdRom,
119 DvdRam,
120 DvdRecordable,
121 DvdRewritable,
122 DvdPlusRecordable,
123 DvdPlusRewritable,
124 DvdPlusRecordableDuallayer,
125 DvdPlusRewritableDuallayer,
126 BluRayRom,
127 BluRayRecordable,
128 BluRayRewritable,
129 HdDvdRom,
130 HdDvdRecordable,
131 HdDvdRewritable,
132 };
133 Q_ENUM(DiscType)
134
135private:
136 /*!
137 * \internal
138 * Creates a new OpticalDisc object.
139 * You generally won't need this. It's created when necessary using
140 * Device::as().
141 *
142 * \a backendObject the device interface object provided by the backend
143 * \sa Solid::Device::as()
144 */
145 SOLID_NO_EXPORT explicit OpticalDisc(QObject *backendObject);
146
147public:
148 ~OpticalDisc() override;
149
150 /*!
151 * Get the Solid::DeviceInterface::Type of the OpticalDisc device interface.
152 *
153 * Returns the OpticalDisc device interface type
154 * \sa Solid::Ifaces::Enums::DeviceInterface::Type
155 */
156 static Type deviceInterfaceType()
157 {
158 return DeviceInterface::OpticalDisc;
159 }
160
161 /*!
162 * Retrieves the content types this disc contains (audio, video,
163 * data...).
164 *
165 * Returns the flag set indicating the available contents
166 * \sa Solid::OpticalDisc::ContentType
167 */
168 ContentTypes availableContent() const;
169
170 /*!
171 * Retrieves the disc type (cdr, cdrw...).
172 *
173 * Returns the disc type
174 */
175 DiscType discType() const;
176
177 /*!
178 * Indicates if it's possible to write additional data to the disc.
179 *
180 * Returns true if the disc is appendable, false otherwise
181 */
182 bool isAppendable() const;
183
184 /*!
185 * Indicates if the disc is blank.
186 *
187 * Returns true if the disc is blank, false otherwise
188 */
189 bool isBlank() const;
190
191 /*!
192 * Indicates if the disc is rewritable.
193 *
194 * A disc is rewritable if you can write on it several times.
195 *
196 * Returns true if the disc is rewritable, false otherwise
197 */
198 bool isRewritable() const;
199
200 /*!
201 * Retrieves the disc capacity (that is the maximum size of a
202 * volume could have on this disc).
203 *
204 * Returns the capacity of the disc in bytes
205 */
206 qulonglong capacity() const;
207};
208
209Q_DECLARE_OPERATORS_FOR_FLAGS(OpticalDisc::ContentTypes)
210
211}
212
213#endif
214

source code of solid/src/solid/devices/frontend/opticaldisc.h