Blame view

app/gui/oven_control/mainwindow.cpp 3.08 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"
05f2a7552   김태훈   image 관리 구조 변경
13
  #include "washwindow.h"
8c2952457   김태훈   응용 프로그램 추가
14
15
16
17
18
19
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui->setupUi(this);
652e9cd54   고영탁   Merge
20
21
      //for singletone event debug
      pcombiButton = ui->helpButton;
fd8461350   김태훈   오븐 기능 추가 및 수정
22
      oven = Oven::getInstance();
8c2952457   김태훈   응용 프로그램 추가
23
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
24
      OvenController *interface = new OvenController(this, oven);
8c2952457   김태훈   응용 프로그램 추가
25
26
27
      oven->setInterface(interface);
  
      udp = new UdpHandler(this);
652e9cd54   고영탁   Merge
28
8c2952457   김태훈   응용 프로그램 추가
29
30
      qDebug() << udp->init();
      interface->setUdpHandler(udp);
652e9cd54   고영탁   Merge
31
      ovenStatics = OvenStatics::getInstance(this,udp,oven);
6f96c947a   김태훈   GUI 0.1.4
32
33
34
35
36
37
38
39
      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   김태훈   응용 프로그램 추가
40
      ManualCookWindow *window = new ManualCookWindow(this, oven, udp);
c598b01b2   김태훈   GUI 업데이트
41
      window->setWindowModality(Qt::WindowModal);
8c2952457   김태훈   응용 프로그램 추가
42
43
44
45
46
47
48
49
      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()));
8c2952457   김태훈   응용 프로그램 추가
50
51
52
53
54
55
56
57
58
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::onModeButtonClicked(int mode)
  {
8c2952457   김태훈   응용 프로그램 추가
59
60
61
62
63
64
65
66
67
68
      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 업데이트
69
      w->setWindowModality(Qt::WindowModal);
8c2952457   김태훈   응용 프로그램 추가
70
      w->showFullScreen();
fd8461350   김태훈   오븐 기능 추가 및 수정
71
      w->raise();
8c2952457   김태훈   응용 프로그램 추가
72
  }
99b8066f4   김태훈   V0.1.1
73
74
75
  
  void MainWindow::on_poultryButton_clicked()
  {
fd8461350   김태훈   오븐 기능 추가 및 수정
76
      AutoCookSelectionWindow *w = new AutoCookSelectionWindow(this, oven, Define::Poultry);
99b8066f4   김태훈   V0.1.1
77
78
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
fd8461350   김태훈   오븐 기능 추가 및 수정
79
      w->raise();
99b8066f4   김태훈   V0.1.1
80
81
82
83
  }
  
  void MainWindow::on_meatButton_clicked()
  {
fd8461350   김태훈   오븐 기능 추가 및 수정
84
      AutoCookSelectionWindow *w = new AutoCookSelectionWindow(this, oven, Define::Meat);
99b8066f4   김태훈   V0.1.1
85
86
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
fd8461350   김태훈   오븐 기능 추가 및 수정
87
      w->raise();
99b8066f4   김태훈   V0.1.1
88
89
90
91
  }
  
  void MainWindow::on_breadButton_clicked()
  {
fd8461350   김태훈   오븐 기능 추가 및 수정
92
      AutoCookSelectionWindow *w = new AutoCookSelectionWindow(this, oven, Define::Bread);
99b8066f4   김태훈   V0.1.1
93
94
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
fd8461350   김태훈   오븐 기능 추가 및 수정
95
      w->raise();
99b8066f4   김태훈   V0.1.1
96
  }
05f2a7552   김태훈   image 관리 구조 변경
97
98
99
100
101
102
  
  void MainWindow::on_washButton_clicked()
  {
      WashWindow *w = new WashWindow(this, udp);
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
fd8461350   김태훈   오븐 기능 추가 및 수정
103
      w->raise();
05f2a7552   김태훈   image 관리 구조 변경
104
  }