| 1 | /* |
|---|---|
| 2 | SPDX-FileCopyrightText: 2010 Michael Zanetti <mzanetti@kde.org> |
| 3 | SPDX-FileCopyrightText: 2010-2012 Lukáš Tinkl <ltinkl@redhat.com> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 6 | */ |
| 7 | |
| 8 | #ifndef UDISKSOPTICALDISC_H |
| 9 | #define UDISKSOPTICALDISC_H |
| 10 | |
| 11 | #include <solid/devices/ifaces/opticaldisc.h> |
| 12 | |
| 13 | #include "../shared/udevqt.h" |
| 14 | #include <config-solid.h> |
| 15 | |
| 16 | #include "udisksdevice.h" |
| 17 | #include "udisksstoragevolume.h" |
| 18 | |
| 19 | namespace Solid |
| 20 | { |
| 21 | namespace Backends |
| 22 | { |
| 23 | namespace UDisks2 |
| 24 | { |
| 25 | class OpticalDisc : public StorageVolume, virtual public Solid::Ifaces::OpticalDisc |
| 26 | { |
| 27 | Q_OBJECT |
| 28 | Q_INTERFACES(Solid::Ifaces::OpticalDisc) |
| 29 | |
| 30 | public: |
| 31 | OpticalDisc(Device *dev); |
| 32 | ~OpticalDisc() override; |
| 33 | |
| 34 | qulonglong capacity() const override; |
| 35 | bool isRewritable() const override; |
| 36 | bool isBlank() const override; |
| 37 | bool isAppendable() const override; |
| 38 | Solid::OpticalDisc::DiscType discType() const override; |
| 39 | Solid::OpticalDisc::ContentTypes availableContent() const override; |
| 40 | |
| 41 | class Identity |
| 42 | { |
| 43 | public: |
| 44 | Identity(); |
| 45 | Identity(const Device &device, const Device &drive); |
| 46 | bool operator==(const Identity &) const; |
| 47 | |
| 48 | private: |
| 49 | long long m_detectTime; |
| 50 | long long m_size; |
| 51 | uint m_labelHash; |
| 52 | }; |
| 53 | |
| 54 | private: |
| 55 | mutable Identity m_identity; |
| 56 | QString media() const; |
| 57 | mutable Solid::OpticalDisc::ContentTypes m_cachedContent; |
| 58 | Device *m_drive; |
| 59 | #if UDEV_FOUND |
| 60 | UdevQt::Device m_udevDevice; |
| 61 | #endif |
| 62 | }; |
| 63 | |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | #endif // UDISKSOPTICALDISC_H |
| 68 |
