File indexing completed on 2024-05-26 04:05:37

0001 /*
0002     SPDX-FileCopyrightText: 2010 Michael Zanetti <mzanetti@kde.org>
0003     SPDX-FileCopyrightText: 2010-2012 Lukáš Tinkl <ltinkl@redhat.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #ifndef UDISKSOPTICALDISC_H
0009 #define UDISKSOPTICALDISC_H
0010 
0011 #include <solid/devices/ifaces/opticaldisc.h>
0012 
0013 #include "../shared/udevqt.h"
0014 #include <config-solid.h>
0015 
0016 #include "udisksdevice.h"
0017 #include "udisksstoragevolume.h"
0018 
0019 namespace Solid
0020 {
0021 namespace Backends
0022 {
0023 namespace UDisks2
0024 {
0025 class OpticalDisc : public StorageVolume, virtual public Solid::Ifaces::OpticalDisc
0026 {
0027     Q_OBJECT
0028     Q_INTERFACES(Solid::Ifaces::OpticalDisc)
0029 
0030 public:
0031     OpticalDisc(Device *dev);
0032     ~OpticalDisc() override;
0033 
0034     qulonglong capacity() const override;
0035     bool isRewritable() const override;
0036     bool isBlank() const override;
0037     bool isAppendable() const override;
0038     Solid::OpticalDisc::DiscType discType() const override;
0039     Solid::OpticalDisc::ContentTypes availableContent() const override;
0040 
0041     class Identity
0042     {
0043     public:
0044         Identity();
0045         Identity(const Device &device, const Device &drive);
0046         bool operator==(const Identity &) const;
0047 
0048     private:
0049         long long m_detectTime;
0050         long long m_size;
0051         uint m_labelHash;
0052     };
0053 
0054 private:
0055     mutable Identity m_identity;
0056     QString media() const;
0057     mutable Solid::OpticalDisc::ContentTypes m_cachedContent;
0058     Device *m_drive;
0059 #if UDEV_FOUND
0060     UdevQt::Device m_udevDevice;
0061 #endif
0062 };
0063 
0064 }
0065 }
0066 }
0067 #endif // UDISKSOPTICALDISC_H