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 UDISKSOPTICALDRIVE_H
0009 #define UDISKSOPTICALDRIVE_H
0010 
0011 #include "udisksstoragedrive.h"
0012 #include <solid/devices/ifaces/opticaldrive.h>
0013 
0014 namespace Solid
0015 {
0016 namespace Backends
0017 {
0018 namespace UDisks2
0019 {
0020 class OpticalDrive : public StorageDrive, virtual public Solid::Ifaces::OpticalDrive
0021 {
0022     Q_OBJECT
0023     Q_INTERFACES(Solid::Ifaces::OpticalDrive)
0024 
0025 public:
0026     OpticalDrive(Device *device);
0027     ~OpticalDrive() override;
0028 
0029 Q_SIGNALS:
0030     void ejectPressed(const QString &udi) override;
0031     void ejectDone(Solid::ErrorType error, QVariant errorData, const QString &udi) override;
0032     void ejectRequested(const QString &udi);
0033 
0034 public:
0035     bool eject() override;
0036     QList<int> writeSpeeds() const override;
0037     int writeSpeed() const override;
0038     int readSpeed() const override;
0039     Solid::OpticalDrive::MediumTypes supportedMedia() const override;
0040 
0041 private Q_SLOTS:
0042     void slotDBusReply(const QDBusMessage &reply);
0043     void slotDBusError(const QDBusError &error);
0044 
0045     void slotEjectRequested();
0046     void slotEjectDone(int error, const QString &errorString);
0047 
0048     void slotChanged();
0049 
0050 private:
0051     void initReadWriteSpeeds() const;
0052 
0053     bool m_ejectInProgress;
0054 
0055     // read/write speeds
0056     mutable int m_readSpeed;
0057     mutable int m_writeSpeed;
0058     mutable QList<int> m_writeSpeeds;
0059     mutable bool m_speedsInit;
0060 };
0061 
0062 }
0063 }
0064 }
0065 
0066 #endif // UDISKSOPTICALDRIVE_H