Blame view

app/gui/oven_control/functiontestwindow.cpp 2.6 KB
8c2952457   김태훈   응용 프로그램 추가
1
2
  #include "functiontestwindow.h"
  #include "ui_functiontestwindow.h"
9e1f8d093   김태훈   엔코더 구현 대비 선행 수정
3
  #include <QKeyEvent>
8c2952457   김태훈   응용 프로그램 추가
4
5
6
7
8
9
  #include "burnertestwindow.h"
  #include "componenttestwindow.h"
  #include "valvetestwindow.h"
  #include "washtestwindow.h"
  #include "fantestwindow.h"
  #include "gastestwindow.h"
66e60ceb5   김태훈   모든 버튼에 음향 효과 추가
10
  #include "soundplayer.h"
8c2952457   김태훈   응용 프로그램 추가
11
538041ab9   김태훈   소스 코드 구조 개선
12
  FunctionTestWindow::FunctionTestWindow(QWidget *parent) :
8c2952457   김태훈   응용 프로그램 추가
13
      QMainWindow(parent),
538041ab9   김태훈   소스 코드 구조 개선
14
      ui(new Ui::FunctionTestWindow)
8c2952457   김태훈   응용 프로그램 추가
15
16
  {
      ui->setupUi(this);
6f96c947a   김태훈   GUI 0.1.4
17
8c2952457   김태훈   응용 프로그램 추가
18
      ui->clockContainer->setParent(ui->upperStack);
6f96c947a   김태훈   GUI 0.1.4
19
      setAttribute(Qt::WA_DeleteOnClose);
66e60ceb5   김태훈   모든 버튼에 음향 효과 추가
20
21
      foreach (QPushButton *button, findChildren<QPushButton *>())
          connect(button, &QPushButton::pressed, SoundPlayer::playClick);
22f83e90f   김태훈   모델 설정 UI 추가
22
      connect(ui->backButton, SIGNAL(clicked(bool)), SLOT(close()));
8c2952457   김태훈   응용 프로그램 추가
23
24
25
26
27
28
  }
  
  FunctionTestWindow::~FunctionTestWindow()
  {
      delete ui;
  }
9e1f8d093   김태훈   엔코더 구현 대비 선행 수정
29
30
31
32
  void FunctionTestWindow::keyPressEvent(QKeyEvent *event)
  {
      switch (event->key())
      {
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
33
      case 0x01000032:    // Turn left
9e1f8d093   김태훈   엔코더 구현 대비 선행 수정
34
35
36
37
38
          onEncoderLeft();
          break;
      case 0x01000031:    // Push
          pushed = focusWidget();
          break;
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
39
      case 0x01000030:    // Turn right
9e1f8d093   김태훈   엔코더 구현 대비 선행 수정
40
41
42
43
44
45
46
47
48
          onEncoderRight();
          break;
      }
  }
  
  void FunctionTestWindow::keyReleaseEvent(QKeyEvent *event)
  {
      switch (event->key())
      {
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
49
      case 0x01000032:    // Turn left
9e1f8d093   김태훈   엔코더 구현 대비 선행 수정
50
51
52
53
54
55
56
57
          onEncoderLeft();
          break;
      case 0x01000031:    // Push
          if (focusWidget() == pushed)
              onEncoderClicked(pushed);
  
          pushed = NULL;
          break;
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
58
      case 0x01000030:    // Turn right
9e1f8d093   김태훈   엔코더 구현 대비 선행 수정
59
60
61
62
          onEncoderRight();
          break;
      }
  }
8c2952457   김태훈   응용 프로그램 추가
63
64
  void FunctionTestWindow::on_burnerTestButton_clicked()
  {
538041ab9   김태훈   소스 코드 구조 개선
65
      BurnerTestWindow *w = new BurnerTestWindow(this);
8c2952457   김태훈   응용 프로그램 추가
66
67
68
69
70
      w->showFullScreen();
  }
  
  void FunctionTestWindow::on_componentTestButton_clicked()
  {
538041ab9   김태훈   소스 코드 구조 개선
71
      ComponentTestWindow *w = new ComponentTestWindow(this);
8c2952457   김태훈   응용 프로그램 추가
72
73
74
75
76
      w->showFullScreen();
  }
  
  void FunctionTestWindow::on_valveTestButton_clicked()
  {
538041ab9   김태훈   소스 코드 구조 개선
77
      ValveTestWindow *w = new ValveTestWindow(this);
8c2952457   김태훈   응용 프로그램 추가
78
79
80
81
82
      w->showFullScreen();
  }
  
  void FunctionTestWindow::on_washTestButton_clicked()
  {
538041ab9   김태훈   소스 코드 구조 개선
83
      WashTestWindow *w = new WashTestWindow(this);
8c2952457   김태훈   응용 프로그램 추가
84
85
86
87
88
      w->showFullScreen();
  }
  
  void FunctionTestWindow::on_fanTestButton_clicked()
  {
538041ab9   김태훈   소스 코드 구조 개선
89
      FanTestWindow *w = new FanTestWindow(this);
8c2952457   김태훈   응용 프로그램 추가
90
91
92
93
94
      w->showFullScreen();
  }
  
  void FunctionTestWindow::on_gasTestButton_clicked()
  {
4fc65fb81   김태훈   GUI V0.1.6(이 버전으로...
95
  //    GasTestWindow *w = new GasTestWindow(this, udp);
9e1f8d093   김태훈   엔코더 구현 대비 선행 수정
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
      //    w->showFullScreen();
  }
  
  void FunctionTestWindow::onEncoderLeft()
  {
      focusPreviousChild();
  }
  
  void FunctionTestWindow::onEncoderRight()
  {
      focusNextChild();
  }
  
  void FunctionTestWindow::onEncoderClicked(QWidget *clicked)
  {
      QPushButton *b = qobject_cast<QPushButton *>(clicked);
      if (b)
          b->click();
8c2952457   김태훈   응용 프로그램 추가
114
  }