#ifndef NEWSLISTWIDGET_H
#define NEWSLISTWIDGET_H

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

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

signals:
    void newsUpdated();

public slots:
    void updateNews();
private slots:
    void setImgToNewsPiece(int piece_id, QPixmap img);

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

private:
    QVBoxLayout* news_layout;
    QTimer news_update_timer;
    QByteArray news_data;
    Downloader news_downloader;

signals:

public slots:
};

#endif // NEWSLISTWIDGET_H
