#include "waitanimationwidget.h"
#include "ui_waitanimationwidget.h"

WaitAnimationWidget::WaitAnimationWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::WaitAnimationWidget),
    loadingMovie(nullptr)
{
    ui->setupUi(this);
}

void WaitAnimationWidget::initialize(QMovie *movie,QWidget *parent)
{
    ui->MovieLabel->setMovie(movie);
    loadingMovie = movie;
    setFixedSize(parent->width(),parent->height());
    hide();
}

void WaitAnimationWidget::showWithPlay()
{
    show();
    loadingMovie->start();
}

void WaitAnimationWidget::hideWithStop()
{
    hide();
    loadingMovie->stop();
}

void WaitAnimationWidget::resize(QSize size)
{
    setFixedSize(size);
}

WaitAnimationWidget::~WaitAnimationWidget()
{
    delete ui;
}
