#include "automat.h"
#include "ui_automat.h"

Automat::Automat(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Automat)
{
    ui->setupUi(this);
    connect(ui->Btn_RUN,SIGNAL(clicked()),this,SLOT(Btn_RUN_clicked()));

    connect(ui->Check_HD,SIGNAL(stateChanged(int)),this,SLOT(Check_Box_Change(int)));
    connect(ui->Check_MHD,SIGNAL(stateChanged(int)),this,SLOT(Check_Box_Change(int)));
    connect(ui->Check_CIS,SIGNAL(stateChanged(int)),this,SLOT(Check_Box_Change(int)));
    connect(ui->Check_RIS,SIGNAL(stateChanged(int)),this,SLOT(Check_Box_Change(int)));
    connect(ui->Check_RISCIS,SIGNAL(stateChanged(int)),this,SLOT(Check_Box_Change(int)));
    connect(ui->Check_Korel,SIGNAL(stateChanged(int)),this,SLOT(Check_Box_Change(int)));


}



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

void Automat::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}


void Automat::Btn_RUN_clicked(){
    emit this->RUN_Automat();
}


void Automat::Check_Box_Change(int state){
    this->HD=ui->Check_HD->checkState();
    this->MHD=ui->Check_MHD->checkState();
    this->CISS=ui->Check_CIS->checkState();
    this->RISS=ui->Check_RIS->checkState();
    this->RISSCISS=ui->Check_RISCIS->checkState();
    this->Korel=ui->Check_Korel->checkState();
    if(state)
        std::cout<<std::endl;
    if(RISSCISS && !CISS){
        ui->Check_CIS->setChecked(true);
    }
}

