#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();

protected:
    virtual void leaveEvent(QEvent * event) override;
    virtual void enterEvent(QEvent * event) override;

signals:
    void showHelpToolTip();
    void showNoToolTip();
    void newsUpdated();

public slots:
    void updateNews();

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
