Blame view

app/gui/oven_control/mainwindow.cpp 4.16 KB
8c2952457   김태훈   응용 프로그램 추가
1
2
3
4
5
  #include "mainwindow.h"
  #include "ui_mainwindow.h"
  
  #include <QtDebug>
  #include <QSignalMapper>
0ce283850   김태훈   로터리 엔코더 임시 구현
6
  #include <QKeyEvent>
8c2952457   김태훈   응용 프로그램 추가
7
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
8
  #include "soundplayer.h"
8c2952457   김태훈   응용 프로그램 추가
9
10
11
12
13
  #include "abstractoveninterface.h"
  #include "manualcookwindow.h"
  #include "ovencontroller.h"
  #include "configwindow.h"
  #include "functiontestwindow.h"
99b8066f4   김태훈   V0.1.1
14
  #include "autocookselectionwindow.h"
05f2a7552   김태훈   image 관리 구조 변경
15
  #include "washwindow.h"
6a965b9f1   고영탁   엔지니어 모드 2차 구현
16
  #include "engineermenuwindow.h"
8597f5496   김태훈   Merge
17
  #include "programmingwindow.h"
b85726132   김태훈   부가 기능 UI 추가
18
  #include "primewindow.h"
8c2952457   김태훈   응용 프로그램 추가
19
e00c6a2a9   김태훈   기능 추가 구현
20
  MainWindow *MainWindow::instance = NULL;
8c2952457   김태훈   응용 프로그램 추가
21
22
23
24
25
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui->setupUi(this);
0ce283850   김태훈   로터리 엔코더 임시 구현
26
e00c6a2a9   김태훈   기능 추가 구현
27
28
      instance = this;
      child = NULL;
0ce283850   김태훈   로터리 엔코더 임시 구현
29
      setFocus();
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
30
31
32
33
34
35
36
  
      QList<QPushButton *> buttons = findChildren<QPushButton *>();
      foreach (QPushButton *button, buttons)
      {
          connect(button, &QPushButton::pressed, SoundPlayer::playClick);
          connect(button, SIGNAL(clicked()), SLOT(setFocus()));
      }
8c2952457   김태훈   응용 프로그램 추가
37
38
39
40
41
42
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
e00c6a2a9   김태훈   기능 추가 구현
43
44
45
46
47
48
49
  void MainWindow::jump(QMainWindow *newChild)
  {
      if (instance->child)
          instance->child->deleteLater();
  
      instance->child = newChild;
  }
0ce283850   김태훈   로터리 엔코더 임시 구현
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
  static QPushButton *pushedChild = NULL;
  
  void MainWindow::keyPressEvent(QKeyEvent *event)
  {
      switch (event->key())
      {
      case 0x01000030:    // Turn left
          focusPreviousChild();
          break;
      case 0x01000031:    // Push
          if (focusWidget() != this)
              pushedChild = static_cast<QPushButton *>(focusWidget());
          break;
      case 0x01000032:    // Turn right
          focusNextChild();
          break;
      }
  }
  
  void MainWindow::keyReleaseEvent(QKeyEvent *event)
  {
      switch (event->key())
      {
      case 0x01000030:    // Turn left
          focusPreviousChild();
          break;
      case 0x01000031:    // Push
          if (focusWidget() == pushedChild)
              pushedChild->click();
0ce283850   김태훈   로터리 엔코더 임시 구현
79
80
81
82
83
84
85
          pushedChild = NULL;
          break;
      case 0x01000032:    // Turn right
          focusNextChild();
          break;
      }
  }
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
86
  void MainWindow::showManualCookWindow(Define::Mode mode)
538041ab9   김태훈   소스 코드 구조 개선
87
88
89
90
91
  {
      ManualCookWindow *w = new ManualCookWindow(this, mode);
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
      w->raise();
e00c6a2a9   김태훈   기능 추가 구현
92
93
  
      child = w;
538041ab9   김태훈   소스 코드 구조 개선
94
  }
3f52600cc   김태훈   소스 코드 구조 개선
95
96
97
98
99
100
  void MainWindow::showAutoCookSelectionWindow(Define::CookType type)
  {
      AutoCookSelectionWindow *w = new AutoCookSelectionWindow(this, type);
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
      w->raise();
e00c6a2a9   김태훈   기능 추가 구현
101
102
  
      child = w;
3f52600cc   김태훈   소스 코드 구조 개선
103
  }
538041ab9   김태훈   소스 코드 구조 개선
104
  void MainWindow::on_steamButton_clicked()
8c2952457   김태훈   응용 프로그램 추가
105
  {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
106
      showManualCookWindow(Define::SteamMode);
8c2952457   김태훈   응용 프로그램 추가
107
  }
538041ab9   김태훈   소스 코드 구조 개선
108
  void MainWindow::on_combiButton_clicked()
8c2952457   김태훈   응용 프로그램 추가
109
  {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
110
      showManualCookWindow(Define::CombiMode);
538041ab9   김태훈   소스 코드 구조 개선
111
112
113
114
  }
  
  void MainWindow::on_dryheatButton_clicked()
  {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
115
      showManualCookWindow(Define::DryMode);
8c2952457   김태훈   응용 프로그램 추가
116
  }
99b8066f4   김태훈   V0.1.1
117
118
119
  
  void MainWindow::on_poultryButton_clicked()
  {
3f52600cc   김태훈   소스 코드 구조 개선
120
      showAutoCookSelectionWindow(Define::Poultry);
99b8066f4   김태훈   V0.1.1
121
122
123
124
  }
  
  void MainWindow::on_meatButton_clicked()
  {
3f52600cc   김태훈   소스 코드 구조 개선
125
      showAutoCookSelectionWindow(Define::Meat);
99b8066f4   김태훈   V0.1.1
126
  }
538041ab9   김태훈   소스 코드 구조 개선
127
128
129
130
131
132
133
134
135
136
137
138
139
140
  void MainWindow::on_fishButton_clicked()
  {
      showAutoCookSelectionWindow(Define::Fish);
  }
  
  void MainWindow::on_dessertButton_clicked()
  {
      showAutoCookSelectionWindow(Define::Desert);
  }
  
  void MainWindow::on_grainButton_clicked()
  {
      showAutoCookSelectionWindow(Define::Vegetable);
  }
99b8066f4   김태훈   V0.1.1
141
142
  void MainWindow::on_breadButton_clicked()
  {
3f52600cc   김태훈   소스 코드 구조 개선
143
      showAutoCookSelectionWindow(Define::Bread);
99b8066f4   김태훈   V0.1.1
144
  }
05f2a7552   김태훈   image 관리 구조 변경
145
538041ab9   김태훈   소스 코드 구조 개선
146
147
148
149
  void MainWindow::on_etcButton_clicked()
  {
      showAutoCookSelectionWindow(Define::Etc);
  }
b85726132   김태훈   부가 기능 UI 추가
150
151
  void MainWindow::on_primeButton_clicked()
  {
f588aa273   김태훈   부가 기능 로직 추가
152
153
154
155
      PrimeWindow *w = new PrimeWindow(this);
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
      w->raise();
e00c6a2a9   김태훈   기능 추가 구현
156
157
  
      child = w;
b85726132   김태훈   부가 기능 UI 추가
158
  }
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
159
160
161
162
163
164
165
166
167
168
169
  void MainWindow::on_multiButton_clicked()
  {
  
  }
  
  void MainWindow::on_programmingButton_clicked()
  {
      ProgrammingWindow *w = new ProgrammingWindow(this);
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
      w->raise();
e00c6a2a9   김태훈   기능 추가 구현
170
171
  
      child = w;
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
172
  }
05f2a7552   김태훈   image 관리 구조 변경
173
174
  void MainWindow::on_washButton_clicked()
  {
538041ab9   김태훈   소스 코드 구조 개선
175
176
177
178
      WashWindow *w = new WashWindow(this);
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
      w->raise();
e00c6a2a9   김태훈   기능 추가 구현
179
180
  
      child = w;
538041ab9   김태훈   소스 코드 구조 개선
181
182
183
184
  }
  
  void MainWindow::on_configButton_clicked()
  {
f588aa273   김태훈   부가 기능 로직 추가
185
      ConfigWindow *w = new ConfigWindow(this);
453d18662   김태훈   GUI 버전 0.1.11
186
187
188
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
      w->raise();
e00c6a2a9   김태훈   기능 추가 구현
189
190
  
      child = w;
05f2a7552   김태훈   image 관리 구조 변경
191
  }
6a965b9f1   고영탁   엔지니어 모드 2차 구현
192
193
194
  
  void MainWindow::on_helpButton_clicked()
  {
069c75507   고영탁   메인 설정 버튼 기능 변경
195
6a965b9f1   고영탁   엔지니어 모드 2차 구현
196
  }