programmingselectionwindow.cpp 2.48 KB
#include "programmingselectionwindow.h"
#include "ui_programmingselectionwindow.h"

#include "programmingmanualwindow.h"

ProgrammingSelectionWindow::ProgrammingSelectionWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ProgrammingSelectionWindow)
{
    ui->setupUi(this);

//    ui->clockContainer->setParent(ui->upperStack);
    setAttribute(Qt::WA_DeleteOnClose);

    setFocus();
}

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

void ProgrammingSelectionWindow::setModeEnabled(bool enabled)
{
    ui->steamButton->setEnabled(enabled);
    ui->combiButton->setEnabled(enabled);
    ui->dryheatButton->setEnabled(enabled);
}

void ProgrammingSelectionWindow::setCookTypeEnabled(bool enabled)
{
    ui->poultryButton->setEnabled(enabled);
    ui->meatButton->setEnabled(enabled);
    ui->fishButton->setEnabled(enabled);
    ui->dessertButton->setEnabled(enabled);
    ui->grainButton->setEnabled(enabled);
    ui->breadButton->setEnabled(enabled);
    ui->etcButton->setEnabled(enabled);
}

void ProgrammingSelectionWindow::onModeClicked(Define::Mode mode)
{
    ProgrammingManualWindow *w = new ProgrammingManualWindow(this, mode);
    connect(w, SIGNAL(added()), SIGNAL(added()));
    connect(w, SIGNAL(destroyed(QObject*)), SLOT(deleteLater()));
    w->setWindowModality(Qt::WindowModal);
    w->showFullScreen();
    w->raise();

    hide();
}

void ProgrammingSelectionWindow::onCookTypeClicked(Define::CookType type)
{
    emit cookTypeSelected(type);
    close();
}

void ProgrammingSelectionWindow::on_steamButton_clicked()
{
    onModeClicked(Define::SteamMode);
}

void ProgrammingSelectionWindow::on_combiButton_clicked()
{
    onModeClicked(Define::CombiMode);
}

void ProgrammingSelectionWindow::on_dryheatButton_clicked()
{
    onModeClicked(Define::DryMode);
}

void ProgrammingSelectionWindow::on_poultryButton_clicked()
{
    onCookTypeClicked(Define::Poultry);
}

void ProgrammingSelectionWindow::on_meatButton_clicked()
{
    onCookTypeClicked(Define::Meat);
}

void ProgrammingSelectionWindow::on_fishButton_clicked()
{
    onCookTypeClicked(Define::Fish);
}

void ProgrammingSelectionWindow::on_dessertButton_clicked()
{
    onCookTypeClicked(Define::Desert);
}

void ProgrammingSelectionWindow::on_grainButton_clicked()
{
    onCookTypeClicked(Define::Vegetable);
}

void ProgrammingSelectionWindow::on_breadButton_clicked()
{
    onCookTypeClicked(Define::Bread);
}

void ProgrammingSelectionWindow::on_etcButton_clicked()
{
    onCookTypeClicked(Define::Etc);
}