#ifndef MONITORCDROM_H
#define MONITORCDROM_H

#include <QObject>
#include <QThread>
#include <QMutex>

class MonitorCDROM : public QThread
{
    Q_OBJECT
signals:
    // cdrom
    void addCDROM(QString);
    void changeCDROM(QString);
    void removeCDROM(QString);
    // log
    void info(QString); void warn(QString);
    void error(QString); void debug(QString);
public:
    static MonitorCDROM *instance();
public:
    MonitorCDROM(const MonitorCDROM*)=delete;
    MonitorCDROM *operator =(const MonitorCDROM*)=delete;
public:
    void stop();
protected:
    void run() Q_DECL_OVERRIDE;
private:
    MonitorCDROM(QObject *parent = nullptr);
    ~MonitorCDROM();
private:
    int preception();
    void update();
    bool isCDROM(QString);
private:
    static MonitorCDROM *m_oInstance;
    static QMutex        m_oMutex;
private:
    bool                 m_bAppRunning;
    int                  m_iPreception;
    QStringList          m_oBlocks;
};
#define MONITOR MonitorCDROM::instance()
#endif // MONITORCDROM_H
