Commit ac60b5cec2d77cf03911c475804aa15fbb834ac3

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

음향 효과 일부 적용 및 소스 코드 정리

app/app-prime-modbus/include/dirtylevel.cpp
... ... @@ -0,0 +1,51 @@
  1 +#include "dirtylevel.h"
  2 +
  3 +#include <QDateTime>
  4 +
  5 +namespace {
  6 +QDateTime cookStartTime;
  7 +qint64 cookingTime;
  8 +int cookingCount;
  9 +}
  10 +
  11 +
  12 +void DirtyLevel::cookStart()
  13 +{
  14 + cookStartTime = QDateTime.currentDateTime();
  15 + cookingCount++;
  16 +}
  17 +
  18 +void DirtyLevel::cookEnd()
  19 +{
  20 + cookingTime += cookStartTime.secsTo(QDateTime.currentDateTime());
  21 +}
  22 +
  23 +int DirtyLevel::dirty()
  24 +{
  25 + if (cookingCount < 1)
  26 + return 0;
  27 + if (cookingTime < 1 * 3600)
  28 + return 1;
  29 + if (cookingTime < 3 * 3600)
  30 + return 2;
  31 + if (cookingTime < 5 * 3600)
  32 + return 3;
  33 + if (cookingTime < 7 * 3600)
  34 + return 4;
  35 + return 5;
  36 +}
  37 +
  38 +int DirtyLevel::state()
  39 +{
  40 + if (cookingCount < 1)
  41 + return 0;
  42 + if (cookingCount < 4)
  43 + return 1;
  44 + if (cookingCount < 7)
  45 + return 2;
  46 + if (cookingCount < 10)
  47 + return 3;
  48 + if (cookingCount < 13)
  49 + return 4;
  50 + return 5;
  51 +}
... ...
app/app-prime-modbus/include/dirtylevel.h
... ... @@ -0,0 +1,13 @@
  1 +#ifndef DIRTYLEVEL_H
  2 +#define DIRTYLEVEL_H
  3 +
  4 +
  5 +namespace DirtyLevel {
  6 +void cookStart();
  7 +void cookEnd();
  8 +
  9 +int dirty();
  10 +int state();
  11 +}
  12 +
  13 +#endif // DIRTYLEVEL_H
... ...
app/gui/oven_control/mainwindow.cpp
... ... @@ -5,6 +5,7 @@
5 5 #include <QSignalMapper>
6 6 #include <QKeyEvent>
7 7  
  8 +#include "soundplayer.h"
8 9 #include "abstractoveninterface.h"
9 10 #include "manualcookwindow.h"
10 11 #include "ovencontroller.h"
... ... @@ -23,6 +24,13 @@ MainWindow::MainWindow(QWidget *parent) :
23 24 ui->setupUi(this);
24 25  
25 26 setFocus();
  27 +
  28 + QList<QPushButton *> buttons = findChildren<QPushButton *>();
  29 + foreach (QPushButton *button, buttons)
  30 + {
  31 + connect(button, &QPushButton::pressed, SoundPlayer::playClick);
  32 + connect(button, SIGNAL(clicked()), SLOT(setFocus()));
  33 + }
26 34 }
27 35  
28 36 MainWindow::~MainWindow()
... ... @@ -60,7 +68,6 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
60 68 if (focusWidget() == pushedChild)
61 69 pushedChild->click();
62 70  
63   - setFocus();
64 71 pushedChild = NULL;
65 72 break;
66 73 case 0x01000032: // Turn right
... ... @@ -143,6 +150,19 @@ void MainWindow::on_primeButton_clicked()
143 150 w->raise();
144 151 }
145 152  
  153 +void MainWindow::on_multiButton_clicked()
  154 +{
  155 +
  156 +}
  157 +
  158 +void MainWindow::on_programmingButton_clicked()
  159 +{
  160 + ProgrammingWindow *w = new ProgrammingWindow(this);
  161 + w->setWindowModality(Qt::WindowModal);
  162 + w->showFullScreen();
  163 + w->raise();
  164 +}
  165 +
146 166 void MainWindow::on_washButton_clicked()
147 167 {
148 168 WashWindow *w = new WashWindow(this);
... ... @@ -157,21 +177,9 @@ void MainWindow::on_configButton_clicked()
157 177 w->setWindowModality(Qt::WindowModal);
158 178 w->showFullScreen();
159 179 w->raise();
160   -// EngineerMenuWindow *w = new EngineerMenuWindow(this);
161   -// w->setWindowModality(Qt::WindowModal);
162   -// w->showFullScreen();
163   -// w->raise();
164 180 }
165 181  
166 182 void MainWindow::on_helpButton_clicked()
167 183 {
168 184  
169 185 }
170   -
171   -void MainWindow::on_programmingButton_clicked()
172   -{
173   - ProgrammingWindow *w = new ProgrammingWindow(this);
174   - w->setWindowModality(Qt::WindowModal);
175   - w->showFullScreen();
176   - w->raise();
177   -}
... ...
app/gui/oven_control/mainwindow.h
... ... @@ -37,16 +37,15 @@ private slots:
37 37 void on_grainButton_clicked();
38 38 void on_breadButton_clicked();
39 39 void on_etcButton_clicked();
  40 + void on_primeButton_clicked();
40 41  
  42 + void on_multiButton_clicked();
  43 + void on_programmingButton_clicked();
41 44 void on_washButton_clicked();
42 45  
43 46 void on_configButton_clicked();
44 47 void on_helpButton_clicked();
45 48  
46   - void on_programmingButton_clicked();
47   -
48   - void on_primeButton_clicked();
49   -
50 49 private:
51 50 Ui::MainWindow *ui;
52 51 };
... ...
app/gui/oven_control/manualcookwindow.cpp
... ... @@ -5,6 +5,7 @@
5 5 #include <QTimer>
6 6 #include <QtDebug>
7 7  
  8 +#include "soundplayer.h"
8 9 #include "preheatpopup.h"
9 10 #include "cooldownpopup.h"
10 11 #include "cookhistory.h"
... ... @@ -376,6 +377,8 @@ void ManualCookWindow::setOvenDefault(Define::Mode mode)
376 377  
377 378 void ManualCookWindow::start()
378 379 {
  380 + SoundPlayer::playStart();
  381 +
379 382 if (oven->time() > 0)
380 383 {
381 384 if (startCookingTimer.isActive())
... ... @@ -398,6 +401,9 @@ void ManualCookWindow::start()
398 401  
399 402 void ManualCookWindow::stop()
400 403 {
  404 + if (oven->cooking())
  405 + SoundPlayer::playStop();
  406 +
401 407 oven->stop();
402 408 startCookingTimer.stop();
403 409 }
... ...
app/gui/oven_control/oven.cpp
... ... @@ -4,6 +4,8 @@
4 4 #include <QTime>
5 5 #include <cmath>
6 6  
  7 +#include "soundplayer.h"
  8 +
7 9 Oven *Oven::instance = 0;
8 10  
9 11 Oven::Oven(QObject *parent) : QObject(parent)
... ... @@ -368,7 +370,11 @@ void Oven::stopCooking()
368 370 cookingTimer.stop();
369 371 }
370 372 else
  373 + {
  374 + SoundPlayer::playStop();
  375 +
371 376 setTime(0);
  377 + }
372 378  
373 379 cooking_ = false;
374 380 interface->stopCooking();
... ...
app/gui/oven_control/ovenstatics.cpp
... ... @@ -64,7 +64,6 @@ void OvenStatistics::onDataChanged()
64 64 error_item *item;
65 65 time_t ltime=0;
66 66 uint16_t errstatetemp;
67   - qDebug() << "statics event fired";
68 67 udp->fillControl(control);
69 68 udp->fillData(state);
70 69 bDataRefreshed = true;
... ...
app/gui/oven_control/stringer.cpp
... ... @@ -40,17 +40,17 @@ int toFahrenheit(int celsius)
40 40 return celsius * 1.8 + 32;
41 41 }
42 42  
43   -enum RealTimeFormat { UseAmPm, Use24 };
  43 +enum RealTimeFormat { Hour12, Hour24 };
44 44 RealTimeFormat realTimeFormat()
45 45 {
46 46 Define::config_item item = Config::getInstance()->getConfigValue(Define::config_time_type);
47 47 switch (item.d32)
48 48 {
49 49 case Define::time_type_12h:
50   - return UseAmPm;
  50 + return Hour12;
51 51 case Define::time_type_24h:
52 52 default:
53   - return Use24;
  53 + return Hour24;
54 54 }
55 55 }
56 56  
... ... @@ -72,9 +72,9 @@ QString Stringer::remainingTime(int msecs)
72 72 QDateTime dateTime = QDateTime::currentDateTime().addMSecs(msecs);
73 73 switch (realTimeFormat())
74 74 {
75   - case UseAmPm:
  75 + case Hour12:
76 76 return dateTime.toString("A hh:mm:ss");
77   - case Use24:
  77 + case Hour24:
78 78 return dateTime.toString("HH:mm:ss");
79 79 }
80 80 }
... ... @@ -108,9 +108,9 @@ QString Stringer::remainingTime(int msecs, QString style)
108 108 QDateTime dateTime = QDateTime::currentDateTime().addMSecs(msecs);
109 109 switch (realTimeFormat())
110 110 {
111   - case UseAmPm:
  111 + case Hour12:
112 112 return heavySpan.arg(dateTime.toString("A hh:mm:ss"));
113   - case Use24:
  113 + case Hour24:
114 114 return heavySpan.arg(dateTime.toString("HH:mm:ss"));
115 115 }
116 116 }
... ...
app/gui/oven_control/washwindow.cpp
... ... @@ -3,6 +3,8 @@
3 3  
4 4 #include <QSignalMapper>
5 5  
  6 +#include "soundplayer.h"
  7 +
6 8 WashWindow::WashWindow(QWidget *parent) :
7 9 QMainWindow(parent),
8 10 ui(new Ui::WashWindow),
... ... @@ -52,6 +54,8 @@ WashWindow::~WashWindow()
52 54  
53 55 void WashWindow::start(int type)
54 56 {
  57 + SoundPlayer::playClick();
  58 +
55 59 if (selected)
56 60 return;
57 61  
... ... @@ -126,6 +130,8 @@ void WashWindow::onChanged()
126 130 {
127 131 started = true;
128 132  
  133 + SoundPlayer::playStart();
  134 +
129 135 ui->closeDoorArrow->hide();
130 136 ui->animation->clear();
131 137  
... ... @@ -199,10 +205,14 @@ void WashWindow::onChanged()
199 205 }
200 206 else if (canceled)
201 207 {
  208 + SoundPlayer::playStop();
  209 +
202 210 close();
203 211 }
204 212 else if (run)
205 213 {
  214 + SoundPlayer::playStop();
  215 +
206 216 ui->titleLabel->setText("세척이 종료되었습니다");
207 217 ui->descLabel->setText("");
208 218 ui->washStepTypeLabel->setText("");
... ... @@ -223,8 +233,24 @@ void WashWindow::onChanged()
223 233  
224 234 void WashWindow::on_backButton_clicked()
225 235 {
  236 + SoundPlayer::playClick();
  237 +
226 238 if (started)
227 239 stop();
228 240 else
229 241 close();
230 242 }
  243 +
  244 +void WashWindow::on_configButton_clicked()
  245 +{
  246 + SoundPlayer::playClick();
  247 +
  248 +
  249 +}
  250 +
  251 +void WashWindow::on_helpButton_clicked()
  252 +{
  253 + SoundPlayer::playClick();
  254 +
  255 +
  256 +}
... ...
app/gui/oven_control/washwindow.h
... ... @@ -25,6 +25,10 @@ private slots:
25 25 void onChanged();
26 26 void on_backButton_clicked();
27 27  
  28 + void on_configButton_clicked();
  29 +
  30 + void on_helpButton_clicked();
  31 +
28 32 private:
29 33 Ui::WashWindow *ui;
30 34 UdpHandler *udp;
... ...
release/ramdisk-prime_oven-128M.gz
No preview for this file type
release/rootfs.tar
No preview for this file type
release/u-boot.imx
No preview for this file type
release/uImage
No preview for this file type