Blame view

app/gui/oven_control/mainwindow.cpp 2.67 KB
8c2952457   김태훈   응용 프로그램 추가
1
2
3
4
5
6
7
8
9
10
11
  #include "mainwindow.h"
  #include "ui_mainwindow.h"
  
  #include <QtDebug>
  #include <QSignalMapper>
  
  #include "abstractoveninterface.h"
  #include "manualcookwindow.h"
  #include "ovencontroller.h"
  #include "configwindow.h"
  #include "functiontestwindow.h"
99b8066f4   김태훈   V0.1.1
12
  #include "autocookselectionwindow.h"
8c2952457   김태훈   응용 프로그램 추가
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui->setupUi(this);
  
      oven = new Oven(this);
  
      OvenController *interface = new OvenController;
      oven->setInterface(interface);
  
      udp = new UdpHandler(this);
      qDebug() << udp->init();
      interface->setUdpHandler(udp);
  
      ManualCookWindow *window = new ManualCookWindow(this, oven, udp);
c598b01b2   김태훈   GUI 업데이트
30
      window->setWindowModality(Qt::WindowModal);
8c2952457   김태훈   응용 프로그램 추가
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
      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()));
  
      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)));
8c2952457   김태훈   응용 프로그램 추가
48
49
50
51
52
53
54
55
56
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::onModeButtonClicked(int mode)
  {
8c2952457   김태훈   응용 프로그램 추가
57
58
59
60
61
62
63
64
65
66
      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);
c598b01b2   김태훈   GUI 업데이트
67
      w->setWindowModality(Qt::WindowModal);
8c2952457   김태훈   응용 프로그램 추가
68
69
      w->showFullScreen();
  }
99b8066f4   김태훈   V0.1.1
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
  
  void MainWindow::on_poultryButton_clicked()
  {
      AutoCookSelectionWindow *w = new AutoCookSelectionWindow(this, oven, Cook::Poultry);
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
  }
  
  void MainWindow::on_meatButton_clicked()
  {
      AutoCookSelectionWindow *w = new AutoCookSelectionWindow(this, oven, Cook::Meat);
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
  }
  
  void MainWindow::on_breadButton_clicked()
  {
      AutoCookSelectionWindow *w = new AutoCookSelectionWindow(this, oven, Cook::Bread);
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
  }