#include "mainwindow.h" #include "ui_mainwindow.h" #include #include #include "abstractoveninterface.h" #include "manualcookwindow.h" #include "ovencontroller.h" #include "configwindow.h" #include "functiontestwindow.h" #include "autocookselectionwindow.h" #include "washwindow.h" #include "engineermenuwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //for singletone event debug pcombiButton = ui->helpButton; oven = Oven::getInstance(); OvenController *interface = new OvenController(this, oven); oven->setInterface(interface); udp = new UdpHandler(this); qDebug() << udp->init(); interface->setUdpHandler(udp); ovenStatics = OvenStatics::getInstance(this,udp,oven); QSignalMapper *sm = new QSignalMapper(this); sm->setMapping(ui->steamButton, (int) Oven::SteamMode); sm->setMapping(ui->combiButton, (int) Oven::CombinationMode); sm->setMapping(ui->dryheatButton, (int) Oven::HeatMode); connect(ui->steamButton, SIGNAL(clicked()), sm, SLOT(map())); connect(ui->combiButton, SIGNAL(clicked()), sm, SLOT(map())); connect(ui->dryheatButton, SIGNAL(clicked()), sm, SLOT(map())); connect(sm, SIGNAL(mapped(int)), this, SLOT(onModeButtonClicked(int))); ManualCookWindow *window = new ManualCookWindow(this, oven, udp); window->setWindowModality(Qt::WindowModal); window->hide(); connect(ui->steamButton, SIGNAL(clicked()), this, SIGNAL(modeButtonClicked())); connect(ui->combiButton, SIGNAL(clicked()), this, SIGNAL(modeButtonClicked())); connect(ui->dryheatButton, SIGNAL(clicked()), this, SIGNAL(modeButtonClicked())); connect(this, SIGNAL(modeButtonClicked()), window, SLOT(showFullScreen())); connect(this, SIGNAL(modeButtonClicked()), window, SLOT(raise())); } MainWindow::~MainWindow() { delete ui; } void MainWindow::onModeButtonClicked(int mode) { oven->setDefault((Oven::Mode) mode); } void MainWindow::on_configButton_clicked() { // ConfigWindow *w = new ConfigWindow(this, udp); // w->setAttribute(Qt::WA_DeleteOnClose); // w->showFullScreen(); FunctionTestWindow *w = new FunctionTestWindow(this, udp); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); } void MainWindow::on_poultryButton_clicked() { AutoCookSelectionWindow *w = new AutoCookSelectionWindow(this, oven, Define::Poultry); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); } void MainWindow::on_meatButton_clicked() { AutoCookSelectionWindow *w = new AutoCookSelectionWindow(this, oven, Define::Meat); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); } void MainWindow::on_breadButton_clicked() { AutoCookSelectionWindow *w = new AutoCookSelectionWindow(this, oven, Define::Bread); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); } void MainWindow::on_washButton_clicked() { WashWindow *w = new WashWindow(this, udp); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); } void MainWindow::on_helpButton_clicked() { engineermenuwindow *w = new engineermenuwindow(this); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); }