#include <QHBoxLayout>
#include "dialogchekertask.h"

DialogChekerTask::DialogChekerTask(ConnectorToServer* connectorToServer, QString type, QWidget *parent) :
    QDialog(parent,
              Qt::WindowSystemMenuHint
            | Qt::WindowMaximizeButtonHint
            | Qt::WindowMinimizeButtonHint
            | Qt::WindowCloseButtonHint),
    checkerTask(nullptr)
{
    checkerTask = new CheckerTask(connectorToServer, type, this);

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->addWidget(checkerTask);
    this->setWindowTitle(tr("Check Task"));

    if(type == "fim")
    {
        this->setMinimumSize(1400, 700);
        this->setWindowState(Qt::WindowMaximized);
    }
    else
    {
        this->setMinimumSize(400, 200);
    }
    this->setModal(true);
}

DialogChekerTask::~DialogChekerTask()
{
    delete checkerTask;
}

void DialogChekerTask::closeEvent(QCloseEvent *event)
{
    checkerTask->close();
}

void DialogChekerTask::setTask(TaskAmmFim *task)
{
    checkerTask->setTask(task);
}

bool DialogChekerTask::getFlChanged()
{
    return checkerTask->getFlChanged();
}
