1 /* 2 Copyright 2006-2007 Kevin Ottens <ervin@kde.org> 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) version 3, or any 8 later version accepted by the membership of KDE e.V. (or its 9 successor approved by the membership of KDE e.V.), which shall 10 act as a proxy defined in Section 6 of version 3 of the license. 11 12 This library is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Lesser General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with this library. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef SOLID_OPTICALDISC_H 22 #define SOLID_OPTICALDISC_H 23 24 #include <solid-lite/solid_export.h> 25 26 #include <solid-lite/storagevolume.h> 27 28 namespace Solid 29 { 30 class OpticalDiscPrivate; 31 class Device; 32 33 /** 34 * This device interface is available on optical discs. 35 * 36 * An optical disc is a volume that can be inserted in CD-R*,DVD*,Blu-Ray,HD-DVD drives. 37 */ 38 class SOLID_EXPORT OpticalDisc : public StorageVolume 39 { 40 Q_OBJECT 41 Q_ENUMS(ContentType DiscType) 42 Q_FLAGS(ContentTypes) 43 Q_PROPERTY(ContentTypes availableContent READ availableContent) 44 Q_PROPERTY(DiscType discType READ discType) 45 Q_PROPERTY(bool appendable READ isAppendable) 46 Q_PROPERTY(bool blank READ isBlank) 47 Q_PROPERTY(bool rewritable READ isRewritable) 48 Q_PROPERTY(qulonglong capacity READ capacity) 49 Q_DECLARE_PRIVATE(OpticalDisc) 50 friend class Device; 51 52 public: 53 /** 54 * This enum type defines the type of content available in an optical disc. 55 * 56 * - Audio : A disc containing audio 57 * - Data : A disc containing data 58 * - VideoCd : A Video Compact Disc (VCD) 59 * - SuperVideoCd : A Super Video Compact Disc (SVCD) 60 * - VideoDvd : A Video Digital Versatile Disc (DVD-Video) 61 */ 62 enum ContentType { 63 NoContent = 0x00, 64 Audio = 0x01, 65 Data = 0x02, 66 VideoCd = 0x04, 67 SuperVideoCd = 0x08, 68 VideoDvd = 0x10, 69 VideoBluRay = 0x20 70 }; 71 72 /** 73 * This type stores an OR combination of ContentType values. 74 */ 75 Q_DECLARE_FLAGS(ContentTypes, ContentType) 76 77 /** 78 * This enum type defines the type of optical disc it can be. 79 * 80 * - UnknownDiscType : An undetermined disc type 81 * - CdRom : A Compact Disc Read-Only Memory (CD-ROM) 82 * - CdRecordable : A Compact Disc Recordable (CD-R) 83 * - CdRewritable : A Compact Disc ReWritable (CD-RW) 84 * - DvdRom : A Digital Versatile Disc Read-Only Memory (DVD-ROM) 85 * - DvdRam : A Digital Versatile Disc Random Access Memory (DVD-RAM) 86 * - DvdRecordable : A Digital Versatile Disc Recordable (DVD-R) 87 * - DvdRewritable : A Digital Versatile Disc ReWritable (DVD-RW) 88 * - DvdPlusRecordable : A Digital Versatile Disc Recordable (DVD+R) 89 * - DvdPlusRewritable : A Digital Versatile Disc ReWritable (DVD+RW) 90 * - DvdPlusRecordableDuallayer : A Digital Versatile Disc Recordable Dual-Layer (DVD+R DL) 91 * - DvdPlusRewritableDuallayer : A Digital Versatile Disc ReWritable Dual-Layer (DVD+RW DL) 92 * - BluRayRom : A Blu-ray Disc (BD) 93 * - BluRayRecordable : A Blu-ray Disc Recordable (BD-R) 94 * - BluRayRewritable : A Blu-ray Disc (BD-RE) 95 * - HdDvdRom: A High Density Digital Versatile Disc (HD DVD) 96 * - HdDvdRecordable : A High Density Digital Versatile Disc Recordable (HD DVD-R) 97 * - HdDvdRewritable : A High Density Digital Versatile Disc ReWritable (HD DVD-RW) 98 */ 99 enum DiscType { UnknownDiscType = -1, 100 CdRom, CdRecordable, CdRewritable, DvdRom, DvdRam, 101 DvdRecordable, DvdRewritable, 102 DvdPlusRecordable, DvdPlusRewritable, 103 DvdPlusRecordableDuallayer, DvdPlusRewritableDuallayer, 104 BluRayRom, BluRayRecordable, BluRayRewritable, 105 HdDvdRom, HdDvdRecordable, HdDvdRewritable }; 106 107 108 private: 109 /** 110 * Creates a new OpticalDisc object. 111 * You generally won't need this. It's created when necessary using 112 * Device::as(). 113 * 114 * @param backendObject the device interface object provided by the backend 115 * @see Solid::Device::as() 116 */ 117 explicit OpticalDisc(QObject *backendObject); 118 119 public: 120 /** 121 * Destroys an OpticalDisc object. 122 */ 123 ~OpticalDisc() override; 124 125 126 /** 127 * Get the Solid::DeviceInterface::Type of the OpticalDisc device interface. 128 * 129 * @return the OpticalDisc device interface type 130 * @see Solid::Ifaces::Enums::DeviceInterface::Type 131 */ deviceInterfaceType()132 static Type deviceInterfaceType() { return DeviceInterface::OpticalDisc; } 133 134 135 /** 136 * Retrieves the content types this disc contains (audio, video, 137 * data...). 138 * 139 * @return the flag set indicating the available contents 140 * @see Solid::OpticalDisc::ContentType 141 */ 142 ContentTypes availableContent() const; 143 144 /** 145 * Retrieves the disc type (cdr, cdrw...). 146 * 147 * @return the disc type 148 */ 149 DiscType discType() const; 150 151 /** 152 * Indicates if it's possible to write additional data to the disc. 153 * 154 * @return true if the disc is appendable, false otherwise 155 */ 156 bool isAppendable() const; 157 158 /** 159 * Indicates if the disc is blank. 160 * 161 * @return true if the disc is blank, false otherwise 162 */ 163 bool isBlank() const; 164 165 /** 166 * Indicates if the disc is rewritable. 167 * 168 * A disc is rewritable if you can write on it several times. 169 * 170 * @return true if the disc is rewritable, false otherwise 171 */ 172 bool isRewritable() const; 173 174 /** 175 * Retrieves the disc capacity (that is the maximum size of a 176 * volume could have on this disc). 177 * 178 * @return the capacity of the disc in bytes 179 */ 180 qulonglong capacity() const; 181 }; 182 } 183 184 Q_DECLARE_OPERATORS_FOR_FLAGS(Solid::OpticalDisc::ContentTypes) 185 186 #endif 187