File indexing completed on 2024-05-12 04:01:51
0001 /* 0002 SPDX-FileCopyrightText: 2006-2007 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_OPTICALDISC_H 0008 #define SOLID_OPTICALDISC_H 0009 0010 #include <solid/solid_export.h> 0011 0012 #include <solid/storagevolume.h> 0013 0014 namespace Solid 0015 { 0016 class OpticalDiscPrivate; 0017 class Device; 0018 0019 /** 0020 * @class Solid::OpticalDisc opticaldisc.h <Solid/OpticalDisc> 0021 * 0022 * This device interface is available on optical discs. 0023 * 0024 * An optical disc is a volume that can be inserted in CD-R*,DVD*,Blu-Ray,HD-DVD drives. 0025 */ 0026 class SOLID_EXPORT OpticalDisc : public StorageVolume 0027 { 0028 Q_OBJECT 0029 Q_PROPERTY(ContentTypes availableContent READ availableContent) 0030 Q_PROPERTY(DiscType discType READ discType) 0031 Q_PROPERTY(bool appendable READ isAppendable) 0032 Q_PROPERTY(bool blank READ isBlank) 0033 Q_PROPERTY(bool rewritable READ isRewritable) 0034 Q_PROPERTY(qulonglong capacity READ capacity) 0035 Q_DECLARE_PRIVATE(OpticalDisc) 0036 friend class Device; 0037 0038 public: 0039 /** 0040 * This enum type defines the type of content available in an optical disc. 0041 * 0042 * - Audio : A disc containing audio 0043 * - Data : A disc containing data 0044 * - VideoCd : A Video Compact Disc (VCD) 0045 * - SuperVideoCd : A Super Video Compact Disc (SVCD) 0046 * - VideoDvd : A Video Digital Versatile Disc (DVD-Video) 0047 * 0048 * @see ContentTypes 0049 */ 0050 enum ContentType { 0051 NoContent = 0x00, 0052 Audio = 0x01, 0053 Data = 0x02, 0054 VideoCd = 0x04, 0055 SuperVideoCd = 0x08, 0056 VideoDvd = 0x10, 0057 VideoBluRay = 0x20, 0058 }; 0059 Q_ENUM(ContentType) 0060 0061 /** 0062 * Stores a combination of #ContentType values. 0063 */ 0064 Q_DECLARE_FLAGS(ContentTypes, ContentType) 0065 Q_FLAG(ContentTypes) 0066 0067 /** 0068 * This enum type defines the type of optical disc it can be. 0069 * 0070 * - UnknownDiscType : An undetermined disc type 0071 * - CdRom : A Compact Disc Read-Only Memory (CD-ROM) 0072 * - CdRecordable : A Compact Disc Recordable (CD-R) 0073 * - CdRewritable : A Compact Disc ReWritable (CD-RW) 0074 * - DvdRom : A Digital Versatile Disc Read-Only Memory (DVD-ROM) 0075 * - DvdRam : A Digital Versatile Disc Random Access Memory (DVD-RAM) 0076 * - DvdRecordable : A Digital Versatile Disc Recordable (DVD-R) 0077 * - DvdRewritable : A Digital Versatile Disc ReWritable (DVD-RW) 0078 * - DvdPlusRecordable : A Digital Versatile Disc Recordable (DVD+R) 0079 * - DvdPlusRewritable : A Digital Versatile Disc ReWritable (DVD+RW) 0080 * - DvdPlusRecordableDuallayer : A Digital Versatile Disc Recordable Dual-Layer (DVD+R DL) 0081 * - DvdPlusRewritableDuallayer : A Digital Versatile Disc ReWritable Dual-Layer (DVD+RW DL) 0082 * - BluRayRom : A Blu-ray Disc (BD) 0083 * - BluRayRecordable : A Blu-ray Disc Recordable (BD-R) 0084 * - BluRayRewritable : A Blu-ray Disc (BD-RE) 0085 * - HdDvdRom: A High Density Digital Versatile Disc (HD DVD) 0086 * - HdDvdRecordable : A High Density Digital Versatile Disc Recordable (HD DVD-R) 0087 * - HdDvdRewritable : A High Density Digital Versatile Disc ReWritable (HD DVD-RW) 0088 */ 0089 enum DiscType { 0090 UnknownDiscType = -1, 0091 CdRom, 0092 CdRecordable, 0093 CdRewritable, 0094 DvdRom, 0095 DvdRam, 0096 DvdRecordable, 0097 DvdRewritable, 0098 DvdPlusRecordable, 0099 DvdPlusRewritable, 0100 DvdPlusRecordableDuallayer, 0101 DvdPlusRewritableDuallayer, 0102 BluRayRom, 0103 BluRayRecordable, 0104 BluRayRewritable, 0105 HdDvdRom, 0106 HdDvdRecordable, 0107 HdDvdRewritable, 0108 }; 0109 Q_ENUM(DiscType) 0110 0111 private: 0112 /** 0113 * Creates a new OpticalDisc object. 0114 * You generally won't need this. It's created when necessary using 0115 * Device::as(). 0116 * 0117 * @param backendObject the device interface object provided by the backend 0118 * @see Solid::Device::as() 0119 */ 0120 SOLID_NO_EXPORT explicit OpticalDisc(QObject *backendObject); 0121 0122 public: 0123 /** 0124 * Destroys an OpticalDisc object. 0125 */ 0126 ~OpticalDisc() override; 0127 0128 /** 0129 * Get the Solid::DeviceInterface::Type of the OpticalDisc device interface. 0130 * 0131 * @return the OpticalDisc device interface type 0132 * @see Solid::Ifaces::Enums::DeviceInterface::Type 0133 */ 0134 static Type deviceInterfaceType() 0135 { 0136 return DeviceInterface::OpticalDisc; 0137 } 0138 0139 /** 0140 * Retrieves the content types this disc contains (audio, video, 0141 * data...). 0142 * 0143 * @return the flag set indicating the available contents 0144 * @see Solid::OpticalDisc::ContentType 0145 */ 0146 ContentTypes availableContent() const; 0147 0148 /** 0149 * Retrieves the disc type (cdr, cdrw...). 0150 * 0151 * @return the disc type 0152 */ 0153 DiscType discType() const; 0154 0155 /** 0156 * Indicates if it's possible to write additional data to the disc. 0157 * 0158 * @return true if the disc is appendable, false otherwise 0159 */ 0160 bool isAppendable() const; 0161 0162 /** 0163 * Indicates if the disc is blank. 0164 * 0165 * @return true if the disc is blank, false otherwise 0166 */ 0167 bool isBlank() const; 0168 0169 /** 0170 * Indicates if the disc is rewritable. 0171 * 0172 * A disc is rewritable if you can write on it several times. 0173 * 0174 * @return true if the disc is rewritable, false otherwise 0175 */ 0176 bool isRewritable() const; 0177 0178 /** 0179 * Retrieves the disc capacity (that is the maximum size of a 0180 * volume could have on this disc). 0181 * 0182 * @return the capacity of the disc in bytes 0183 */ 0184 qulonglong capacity() const; 0185 }; 0186 0187 Q_DECLARE_OPERATORS_FOR_FLAGS(OpticalDisc::ContentTypes) 0188 0189 } 0190 0191 #endif