#ifndef BURNIMAGE_H
#define BURNIMAGE_H

#include <QWidget>
#include <QMutex>
#include <QLabel>
#include <QListWidget>
#include <QTimer>

namespace Ui {
class BurnImage;
}

class BurnImage : public QWidget
{
    Q_OBJECT
signals:
    // log
    void info(QString); void warn(QString);
    void error(QString); void debug(QString);
    // logic
    void newISOPath(QString);
    void newBurner(int);
    void busness(bool);
public:
    static BurnImage *instance();
public:
    BurnImage(const BurnImage*)=delete;
    BurnImage *operator =(const BurnImage*)=delete;
public:
    void update();
    void destroy() { delete this; }
protected:
    void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
private:
    explicit BurnImage(QWidget *parent = nullptr);
    ~BurnImage();
public slots:
    void slotsNewISOPath(QString);
private slots:
    void slotsBrowseISO();
    void slotsISOChange(int);
    void slotsISOError(QString);
    void slotsBurnerError(QString);
    void slotsReady(QString);
    void slotsNewBurner(QString, QString);
    void slotsDeleteBurner(int);
    void slotsBurnerChange(int);
    void slotsUpdateBurnerInfo();
private:
    static BurnImage *m_oInstance;
    static QMutex     m_oMutex;
private:
    QWidget          *m_oShowISO;
    QLabel           *m_oIcon;
    QLabel           *m_oDisplay;
    QWidget          *m_oShowBurner;
    QLabel           *m_oIconBurner;
    QLabel           *m_oDisplayBurner;
    QListWidget      *m_oListWidget;
    QStringList       m_oISOPaths;
    QListWidget      *m_oListWidgetBurner;
    QTimer           *m_oUpdateTimer;
private:
    Ui::BurnImage    *ui;
};
#define PAGE_BurnImage BurnImage::instance()
#endif // BURNIMAGE_H
