File indexing completed on 2024-10-06 04:25:57

0001 /*
0002     SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef _K3B_APP_DEVICE_MANAGER_H_
0007 #define _K3B_APP_DEVICE_MANAGER_H_
0008 
0009 #include "k3bdevicemanager.h"
0010 
0011 #include <KXMLGUIClient>
0012 #include <Solid/SolidNamespace>
0013 
0014 
0015 namespace K3b {
0016     class MediaCache;
0017 }
0018 
0019 namespace Device {
0020     class Device;
0021 }
0022 
0023 /**
0024  * Enhanced device manager which can do some additional actions
0025  * and maintains a current device
0026  */
0027 namespace K3b {
0028     class AppDeviceManager : public Device::DeviceManager, public KXMLGUIClient
0029     {
0030         Q_OBJECT
0031 
0032     public:
0033         explicit AppDeviceManager( QObject* parent = 0 );
0034         ~AppDeviceManager() override;
0035 
0036         Device::Device* currentDevice() const;
0037         void setMediaCache( MediaCache* c );
0038 
0039     Q_SIGNALS:
0040         void currentDeviceChanged( K3b::Device::Device* );
0041 
0042         /**
0043          * Emitted when starting to detect the diskinfo. This may be used to show some info
0044          * to the user since detecting the diskinfo might take some time.
0045          */
0046         void detectingDiskInfo( K3b::Device::Device* );
0047 
0048         void mountFinished( const QString& mountPoint );
0049         void unmountFinished( bool success );
0050 
0051     public Q_SLOTS:
0052         /**
0053          * \reimplemented for internal reasons. The API is unaffected.
0054          */
0055         void clear() override;
0056 
0057         void setCurrentDevice( K3b::Device::Device* );
0058 
0059         void diskInfo();
0060         void unlockDevice();
0061         void lockDevice();
0062         void mountDisk();
0063         void unmountDisk();
0064         void ejectDisk();
0065         void loadDisk();
0066         void setReadSpeed();
0067 
0068         void diskInfo( K3b::Device::Device* );
0069         void unlockDevice( K3b::Device::Device* );
0070         void lockDevice( K3b::Device::Device* );
0071         void mountDisk( K3b::Device::Device* );
0072         void unmountDisk( K3b::Device::Device* );
0073         void ejectDisk( K3b::Device::Device* );
0074         void loadDisk( K3b::Device::Device* );
0075         void setReadSpeed( K3b::Device::Device* );
0076 
0077     private Q_SLOTS:
0078         void slotMediumChanged( K3b::Device::Device* dev );
0079         void slotMountChanged( bool accessible, const QString& udi );
0080         void slotMountFinished( Solid::ErrorType error, QVariant errorData, const QString& udi );
0081         void slotUnmountFinished( Solid::ErrorType error, QVariant errorData, const QString& udi );
0082 
0083     private:
0084         /**
0085          * \reimplemented for internal reasons. The API is unaffected.
0086          */
0087         Device::Device* addDevice( const Solid::Device& solidDev ) override;
0088         void removeDevice( const Solid::Device& solidDev ) override;
0089 
0090         class Private;
0091         Private* const d;
0092     };
0093 }
0094 
0095 #endif