00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _LINUXCDPOLLING_H_
00020 #define _LINUXCDPOLLING_H_
00021
00022 #include "backendbase.h"
00023
00024 #include <tqobject.h>
00025 #include <tqcstring.h>
00026 #include <tqmap.h>
00027 #include <tqtimer.h>
00028
00029 class DiscType
00030 {
00031 public:
00032 enum Type { None, Unknown, Audio, Data, DVD, Mixed,
00033 Blank, VCD, SVCD, UnknownType, Broken };
00034
00035 DiscType(Type type = Unknown);
00036
00037 bool isKnownDisc() const;
00038 bool isDisc() const;
00039 bool isNotDisc() const;
00040 bool isData() const;
00041
00042 operator int() const;
00043
00044 private:
00045 Type m_type;
00046 };
00047
00048 class PollingThread;
00049
00050 class LinuxCDPolling : public TQObject, public BackendBase
00051 {
00052 Q_OBJECT
00053
00054 public:
00055
00056 LinuxCDPolling(MediaList &list);
00057 virtual ~LinuxCDPolling();
00058
00067 static DiscType identifyDiscType(const TQCString &devNode,
00068 const DiscType ¤t = DiscType::Unknown);
00069
00070 private slots:
00071 void slotMediumAdded(const TQString &id);
00072 void slotMediumRemoved(const TQString &id);
00073 void slotMediumStateChanged(const TQString &id);
00074 void slotTimeout();
00075
00076 private:
00077 void applyType(DiscType type, const Medium *medium);
00078
00079 static bool hasDirectory(const TQCString &devNode, const TQCString &dir);
00080
00081 TQMap<TQString, PollingThread*> m_threads;
00082 TQStringList m_excludeNotification;
00083 TQTimer m_timer;
00084 };
00085
00086 #endif