#ifndef EVENTSLISTWIDGET_H
#define EVENTSLISTWIDGET_H

#include <QWidget>
#include <QVBoxLayout>
#include "models/downloader.h"
#include <QTimer>
#include <QMutex>

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

signals:
    void eventsUpdated();

public slots:
    void updateEvents();
private slots:
    void setImgToEventPiece(int piece_id, QPixmap img);

private:
    void constructEventPiece(int piece_id, QString title, QString text, QString news_src, QString news_date);

private:
    QVBoxLayout* event_layout;
    QTimer event_update_timer;
    QByteArray events_data;
    Downloader event_downloader;

signals:

public slots:
};

#endif // EVENTSLISTWIDGET_H
