Commit 8a1db78e6e53800bdda32d15cd6cbb2f9bfcced6
1 parent
af879dd59e
Exists in
master
and in
2 other branches
소스 코드 정리
Showing
3 changed files
with
38 additions
and
24 deletions
Show diff stats
app/gui/oven_control/mainwindow.cpp
@@ -2,20 +2,15 @@ | @@ -2,20 +2,15 @@ | ||
2 | #include "ui_mainwindow.h" | 2 | #include "ui_mainwindow.h" |
3 | 3 | ||
4 | #include <QtDebug> | 4 | #include <QtDebug> |
5 | -#include <QSignalMapper> | ||
6 | #include <QKeyEvent> | 5 | #include <QKeyEvent> |
7 | 6 | ||
8 | #include "soundplayer.h" | 7 | #include "soundplayer.h" |
9 | -#include "abstractoveninterface.h" | ||
10 | #include "manualcookwindow.h" | 8 | #include "manualcookwindow.h" |
11 | -#include "ovencontroller.h" | ||
12 | -#include "configwindow.h" | ||
13 | -#include "functiontestwindow.h" | ||
14 | #include "autocookselectionwindow.h" | 9 | #include "autocookselectionwindow.h" |
15 | -#include "washwindow.h" | ||
16 | -#include "engineermenuwindow.h" | ||
17 | -#include "programmingwindow.h" | ||
18 | #include "primewindow.h" | 10 | #include "primewindow.h" |
11 | +#include "programmingwindow.h" | ||
12 | +#include "washwindow.h" | ||
13 | +#include "configwindow.h" | ||
19 | 14 | ||
20 | MainWindow *MainWindow::instance = NULL; | 15 | MainWindow *MainWindow::instance = NULL; |
21 | 16 | ||
@@ -59,21 +54,18 @@ void MainWindow::killChild() | @@ -59,21 +54,18 @@ void MainWindow::killChild() | ||
59 | instance->child = NULL; | 54 | instance->child = NULL; |
60 | } | 55 | } |
61 | 56 | ||
62 | -static QPushButton *pushedChild = NULL; | ||
63 | - | ||
64 | void MainWindow::keyPressEvent(QKeyEvent *event) | 57 | void MainWindow::keyPressEvent(QKeyEvent *event) |
65 | { | 58 | { |
66 | switch (event->key()) | 59 | switch (event->key()) |
67 | { | 60 | { |
68 | case 0x01000030: // Turn left | 61 | case 0x01000030: // Turn left |
69 | - focusPreviousChild(); | 62 | + onEncoderLeft(); |
70 | break; | 63 | break; |
71 | case 0x01000031: // Push | 64 | case 0x01000031: // Push |
72 | - if (focusWidget() != this) | ||
73 | - pushedChild = static_cast<QPushButton *>(focusWidget()); | 65 | + pushed = focusWidget(); |
74 | break; | 66 | break; |
75 | case 0x01000032: // Turn right | 67 | case 0x01000032: // Turn right |
76 | - focusNextChild(); | 68 | + onEncoderRight(); |
77 | break; | 69 | break; |
78 | } | 70 | } |
79 | } | 71 | } |
@@ -83,20 +75,37 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event) | @@ -83,20 +75,37 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event) | ||
83 | switch (event->key()) | 75 | switch (event->key()) |
84 | { | 76 | { |
85 | case 0x01000030: // Turn left | 77 | case 0x01000030: // Turn left |
86 | - focusPreviousChild(); | 78 | + onEncoderLeft(); |
87 | break; | 79 | break; |
88 | case 0x01000031: // Push | 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 | break; | 85 | break; |
94 | case 0x01000032: // Turn right | 86 | case 0x01000032: // Turn right |
95 | - focusNextChild(); | 87 | + onEncoderRight(); |
96 | break; | 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 | void MainWindow::showManualCookWindow(Define::Mode mode) | 109 | void MainWindow::showManualCookWindow(Define::Mode mode) |
101 | { | 110 | { |
102 | ManualCookWindow *w = new ManualCookWindow(this, mode); | 111 | ManualCookWindow *w = new ManualCookWindow(this, mode); |
app/gui/oven_control/mainwindow.h
@@ -3,7 +3,6 @@ | @@ -3,7 +3,6 @@ | ||
3 | 3 | ||
4 | #include <QMainWindow> | 4 | #include <QMainWindow> |
5 | 5 | ||
6 | -#include "oven.h" | ||
7 | #include "define.h" | 6 | #include "define.h" |
8 | 7 | ||
9 | namespace Ui { | 8 | namespace Ui { |
@@ -28,6 +27,15 @@ protected: | @@ -28,6 +27,15 @@ protected: | ||
28 | void keyPressEvent(QKeyEvent *event); | 27 | void keyPressEvent(QKeyEvent *event); |
29 | void keyReleaseEvent(QKeyEvent *event); | 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 | private slots: | 39 | private slots: |
32 | void showManualCookWindow(Define::Mode mode); | 40 | void showManualCookWindow(Define::Mode mode); |
33 | void showAutoCookSelectionWindow(Define::CookType type); | 41 | void showAutoCookSelectionWindow(Define::CookType type); |
@@ -51,10 +59,6 @@ private slots: | @@ -51,10 +59,6 @@ private slots: | ||
51 | 59 | ||
52 | void on_configButton_clicked(); | 60 | void on_configButton_clicked(); |
53 | void on_helpButton_clicked(); | 61 | void on_helpButton_clicked(); |
54 | - | ||
55 | -private: | ||
56 | - Ui::MainWindow *ui; | ||
57 | - QMainWindow *child; | ||
58 | }; | 62 | }; |
59 | 63 | ||
60 | #endif // MAINWINDOW_H | 64 | #endif // MAINWINDOW_H |
app/gui/oven_control/programmingmanualwindow.cpp
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | 3 | ||
4 | #include <QKeyEvent> | 4 | #include <QKeyEvent> |
5 | 5 | ||
6 | +#include "oven.h" | ||
6 | #include "stringer.h" | 7 | #include "stringer.h" |
7 | #include "programmingmanualcoretemppopup.h" | 8 | #include "programmingmanualcoretemppopup.h" |
8 | #include "cookprogram.h" | 9 | #include "cookprogram.h" |