#ifndef NEWSWIDGET_H
#define NEWSWIDGET_H

#include <QWidget>
#include <QTimer>
#include "networkdownloader.h"

namespace Ui {
class NewsWidget;
}

class LegacyApp;

class NewsWidget : public QWidget
{
    Q_OBJECT

public:
    explicit NewsWidget(LegacyApp *_app, QWidget *parent = 0);
    ~NewsWidget();

public slots:
    void updateNews();

private:
    void constructNewsPiece(int piece_id, QString title, QString text, QString news_src);
    void setImgToNewsPiece(int piece_id, QPixmap img);

private:
    Ui::NewsWidget *ui;
    LegacyApp *app;
    QTimer news_update_timer;
    QByteArray news_data;
    NetworkDownloader news_downloader;
};

#endif // NEWSWIDGET_H
