File indexing completed on 2024-04-28 04:49:52

0001 /*
0002     SPDX-FileCopyrightText: 2005-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 
0009 #ifndef _K3B_MEDIA_CACHE_P_H_
0010 #define _K3B_MEDIA_CACHE_P_H_
0011 
0012 #include "k3bmediacache.h"
0013 
0014 class K3b::MediaCache::DeviceEntry
0015 {
0016 public:
0017     DeviceEntry( MediaCache* cache, Device::Device* dev );
0018     ~DeviceEntry();
0019 
0020     Medium medium;
0021 
0022     int blockedId;
0023 
0024     QMutex readMutex;
0025     QMutex writeMutex;
0026 
0027     MediaCache::PollThread* thread;
0028 
0029     MediaCache* cache;
0030 
0031     void clear() {
0032         medium.reset();
0033     }
0034 };
0035 
0036 
0037 class K3b::MediaCache::PollThread : public QThread
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     PollThread( MediaCache::DeviceEntry* de )
0043         : m_deviceEntry( de ) {}
0044 
0045 Q_SIGNALS:
0046     void mediumChanged( K3b::Device::Device* dev );
0047     void checkingMedium( K3b::Device::Device* dev, const QString& );
0048 
0049 protected:
0050     void run() override;
0051 
0052 private:
0053     MediaCache::DeviceEntry* m_deviceEntry;
0054 };
0055 
0056 #endif