Commit 8a1db78e6e53800bdda32d15cd6cbb2f9bfcced6

Authored by 김태훈
1 parent af879dd59e
Exists in master and in 2 other branches fhd, fhd-demo

소스 코드 정리

app/gui/oven_control/mainwindow.cpp
... ... @@ -2,20 +2,15 @@
2 2 #include "ui_mainwindow.h"
3 3  
4 4 #include <QtDebug>
5   -#include <QSignalMapper>
6 5 #include <QKeyEvent>
7 6  
8 7 #include "soundplayer.h"
9   -#include "abstractoveninterface.h"
10 8 #include "manualcookwindow.h"
11   -#include "ovencontroller.h"
12   -#include "configwindow.h"
13   -#include "functiontestwindow.h"
14 9 #include "autocookselectionwindow.h"
15   -#include "washwindow.h"
16   -#include "engineermenuwindow.h"
17   -#include "programmingwindow.h"
18 10 #include "primewindow.h"
  11 +#include "programmingwindow.h"
  12 +#include "washwindow.h"
  13 +#include "configwindow.h"
19 14  
20 15 MainWindow *MainWindow::instance = NULL;
21 16  
... ... @@ -59,21 +54,18 @@ void MainWindow::killChild()
59 54 instance->child = NULL;
60 55 }
61 56  
62   -static QPushButton *pushedChild = NULL;
63   -
64 57 void MainWindow::keyPressEvent(QKeyEvent *event)
65 58 {
66 59 switch (event->key())
67 60 {
68 61 case 0x01000030: // Turn left
69   - focusPreviousChild();
  62 + onEncoderLeft();
70 63 break;
71 64 case 0x01000031: // Push
72   - if (focusWidget() != this)
73   - pushedChild = static_cast<QPushButton *>(focusWidget());
  65 + pushed = focusWidget();
74 66 break;
75 67 case 0x01000032: // Turn right
76   - focusNextChild();
  68 + onEncoderRight();
77 69 break;
78 70 }
79 71 }
... ... @@ -83,20 +75,37 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
83 75 switch (event->key())
84 76 {
85 77 case 0x01000030: // Turn left
86   - focusPreviousChild();
  78 + onEncoderLeft();
87 79 break;
88 80 case 0x01000031: // Push
89   - if (focusWidget() == pushedChild)
90   - pushedChild->click();
  81 + if (focusWidget() == pushed)
  82 + onEncoderClicked(pushed);
91 83  
92   - pushedChild = NULL;
  84 + pushed = NULL;
93 85 break;
94 86 case 0x01000032: // Turn right
95   - focusNextChild();
  87 + onEncoderRight();
96 88 break;
97 89 }
98 90 }
99 91  
  92 +void MainWindow::onEncoderLeft()
  93 +{
  94 + focusPreviousChild();
  95 +}
  96 +
  97 +void MainWindow::onEncoderRight()
  98 +{
  99 + focusNextChild();
  100 +}
  101 +
  102 +void MainWindow::onEncoderClicked(QWidget *clicked)
  103 +{
  104 + QPushButton *b = qobject_cast<QPushButton *>(clicked);
  105 + if (b)
  106 + b->click();
  107 +}
  108 +
100 109 void MainWindow::showManualCookWindow(Define::Mode mode)
101 110 {
102 111 ManualCookWindow *w = new ManualCookWindow(this, mode);
... ...
app/gui/oven_control/mainwindow.h
... ... @@ -3,7 +3,6 @@
3 3  
4 4 #include <QMainWindow>
5 5  
6   -#include "oven.h"
7 6 #include "define.h"
8 7  
9 8 namespace Ui {
... ... @@ -28,6 +27,15 @@ protected:
28 27 void keyPressEvent(QKeyEvent *event);
29 28 void keyReleaseEvent(QKeyEvent *event);
30 29  
  30 +private:
  31 + Ui::MainWindow *ui;
  32 + QMainWindow *child;
  33 + QWidget *pushed = NULL;
  34 +
  35 + void onEncoderLeft();
  36 + void onEncoderRight();
  37 + void onEncoderClicked(QWidget *clicked);
  38 +
31 39 private slots:
32 40 void showManualCookWindow(Define::Mode mode);
33 41 void showAutoCookSelectionWindow(Define::CookType type);
... ... @@ -51,10 +59,6 @@ private slots:
51 59  
52 60 void on_configButton_clicked();
53 61 void on_helpButton_clicked();
54   -
55   -private:
56   - Ui::MainWindow *ui;
57   - QMainWindow *child;
58 62 };
59 63  
60 64 #endif // MAINWINDOW_H
... ...
app/gui/oven_control/programmingmanualwindow.cpp
... ... @@ -3,6 +3,7 @@
3 3  
4 4 #include <QKeyEvent>
5 5  
  6 +#include "oven.h"
6 7 #include "stringer.h"
7 8 #include "programmingmanualcoretemppopup.h"
8 9 #include "cookprogram.h"
... ...