#ifndef STATUSFLAGWIDGET_H
#define STATUSFLAGWIDGET_H

#include <QWidget>
#include <QMutex>

class StatusFlagWidget : public QWidget
{
    Q_OBJECT
public:
    explicit StatusFlagWidget(QWidget *parent = nullptr);

protected:
    virtual void leaveEvent(QEvent * event) override;
    virtual void enterEvent(QEvent * event) override;
    virtual void paintEvent(QPaintEvent *event) override;
    virtual void mousePressEvent(QMouseEvent *ev) override;

signals:
    void mouseEntered(QString tooltip);
    void flagIdChanged(int flag_id);
    void mouseLeaved();

public slots:
    void changeImageSrcAnimated(const QString& src);
    void changeImageSrcInstantly(const QString& src);
    void changeFlagId(int new_flag_id);

private:
    QMutex bg_lock;
    int flag_id;
    bool is_hovered;

    QString current_flag_src;
    QString current_flag_hover_src;

    QPixmap current_bg;
};

#endif // STATUSFLAGWIDGET_H
