Commit ac60b5cec2d77cf03911c475804aa15fbb834ac3
1 parent
be77ef79eb
Exists in
master
and in
2 other branches
음향 효과 일부 적용 및 소스 코드 정리
Showing
14 changed files
with
137 additions
and
25 deletions
Show diff stats
app/app-prime-modbus/include/dirtylevel.cpp
| @@ -0,0 +1,51 @@ | @@ -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
app/gui/oven_control/mainwindow.cpp
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | #include <QSignalMapper> | 5 | #include <QSignalMapper> |
| 6 | #include <QKeyEvent> | 6 | #include <QKeyEvent> |
| 7 | 7 | ||
| 8 | +#include "soundplayer.h" | ||
| 8 | #include "abstractoveninterface.h" | 9 | #include "abstractoveninterface.h" |
| 9 | #include "manualcookwindow.h" | 10 | #include "manualcookwindow.h" |
| 10 | #include "ovencontroller.h" | 11 | #include "ovencontroller.h" |
| @@ -23,6 +24,13 @@ MainWindow::MainWindow(QWidget *parent) : | @@ -23,6 +24,13 @@ MainWindow::MainWindow(QWidget *parent) : | ||
| 23 | ui->setupUi(this); | 24 | ui->setupUi(this); |
| 24 | 25 | ||
| 25 | setFocus(); | 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 | MainWindow::~MainWindow() | 36 | MainWindow::~MainWindow() |
| @@ -60,7 +68,6 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event) | @@ -60,7 +68,6 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event) | ||
| 60 | if (focusWidget() == pushedChild) | 68 | if (focusWidget() == pushedChild) |
| 61 | pushedChild->click(); | 69 | pushedChild->click(); |
| 62 | 70 | ||
| 63 | - setFocus(); | ||
| 64 | pushedChild = NULL; | 71 | pushedChild = NULL; |
| 65 | break; | 72 | break; |
| 66 | case 0x01000032: // Turn right | 73 | case 0x01000032: // Turn right |
| @@ -143,6 +150,19 @@ void MainWindow::on_primeButton_clicked() | @@ -143,6 +150,19 @@ void MainWindow::on_primeButton_clicked() | ||
| 143 | w->raise(); | 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 | void MainWindow::on_washButton_clicked() | 166 | void MainWindow::on_washButton_clicked() |
| 147 | { | 167 | { |
| 148 | WashWindow *w = new WashWindow(this); | 168 | WashWindow *w = new WashWindow(this); |
| @@ -157,21 +177,9 @@ void MainWindow::on_configButton_clicked() | @@ -157,21 +177,9 @@ void MainWindow::on_configButton_clicked() | ||
| 157 | w->setWindowModality(Qt::WindowModal); | 177 | w->setWindowModality(Qt::WindowModal); |
| 158 | w->showFullScreen(); | 178 | w->showFullScreen(); |
| 159 | w->raise(); | 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 | void MainWindow::on_helpButton_clicked() | 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,16 +37,15 @@ private slots: | ||
| 37 | void on_grainButton_clicked(); | 37 | void on_grainButton_clicked(); |
| 38 | void on_breadButton_clicked(); | 38 | void on_breadButton_clicked(); |
| 39 | void on_etcButton_clicked(); | 39 | void on_etcButton_clicked(); |
| 40 | + void on_primeButton_clicked(); | ||
| 40 | 41 | ||
| 42 | + void on_multiButton_clicked(); | ||
| 43 | + void on_programmingButton_clicked(); | ||
| 41 | void on_washButton_clicked(); | 44 | void on_washButton_clicked(); |
| 42 | 45 | ||
| 43 | void on_configButton_clicked(); | 46 | void on_configButton_clicked(); |
| 44 | void on_helpButton_clicked(); | 47 | void on_helpButton_clicked(); |
| 45 | 48 | ||
| 46 | - void on_programmingButton_clicked(); | ||
| 47 | - | ||
| 48 | - void on_primeButton_clicked(); | ||
| 49 | - | ||
| 50 | private: | 49 | private: |
| 51 | Ui::MainWindow *ui; | 50 | Ui::MainWindow *ui; |
| 52 | }; | 51 | }; |
app/gui/oven_control/manualcookwindow.cpp
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | #include <QTimer> | 5 | #include <QTimer> |
| 6 | #include <QtDebug> | 6 | #include <QtDebug> |
| 7 | 7 | ||
| 8 | +#include "soundplayer.h" | ||
| 8 | #include "preheatpopup.h" | 9 | #include "preheatpopup.h" |
| 9 | #include "cooldownpopup.h" | 10 | #include "cooldownpopup.h" |
| 10 | #include "cookhistory.h" | 11 | #include "cookhistory.h" |
| @@ -376,6 +377,8 @@ void ManualCookWindow::setOvenDefault(Define::Mode mode) | @@ -376,6 +377,8 @@ void ManualCookWindow::setOvenDefault(Define::Mode mode) | ||
| 376 | 377 | ||
| 377 | void ManualCookWindow::start() | 378 | void ManualCookWindow::start() |
| 378 | { | 379 | { |
| 380 | + SoundPlayer::playStart(); | ||
| 381 | + | ||
| 379 | if (oven->time() > 0) | 382 | if (oven->time() > 0) |
| 380 | { | 383 | { |
| 381 | if (startCookingTimer.isActive()) | 384 | if (startCookingTimer.isActive()) |
| @@ -398,6 +401,9 @@ void ManualCookWindow::start() | @@ -398,6 +401,9 @@ void ManualCookWindow::start() | ||
| 398 | 401 | ||
| 399 | void ManualCookWindow::stop() | 402 | void ManualCookWindow::stop() |
| 400 | { | 403 | { |
| 404 | + if (oven->cooking()) | ||
| 405 | + SoundPlayer::playStop(); | ||
| 406 | + | ||
| 401 | oven->stop(); | 407 | oven->stop(); |
| 402 | startCookingTimer.stop(); | 408 | startCookingTimer.stop(); |
| 403 | } | 409 | } |
app/gui/oven_control/oven.cpp
| @@ -4,6 +4,8 @@ | @@ -4,6 +4,8 @@ | ||
| 4 | #include <QTime> | 4 | #include <QTime> |
| 5 | #include <cmath> | 5 | #include <cmath> |
| 6 | 6 | ||
| 7 | +#include "soundplayer.h" | ||
| 8 | + | ||
| 7 | Oven *Oven::instance = 0; | 9 | Oven *Oven::instance = 0; |
| 8 | 10 | ||
| 9 | Oven::Oven(QObject *parent) : QObject(parent) | 11 | Oven::Oven(QObject *parent) : QObject(parent) |
| @@ -368,7 +370,11 @@ void Oven::stopCooking() | @@ -368,7 +370,11 @@ void Oven::stopCooking() | ||
| 368 | cookingTimer.stop(); | 370 | cookingTimer.stop(); |
| 369 | } | 371 | } |
| 370 | else | 372 | else |
| 373 | + { | ||
| 374 | + SoundPlayer::playStop(); | ||
| 375 | + | ||
| 371 | setTime(0); | 376 | setTime(0); |
| 377 | + } | ||
| 372 | 378 | ||
| 373 | cooking_ = false; | 379 | cooking_ = false; |
| 374 | interface->stopCooking(); | 380 | interface->stopCooking(); |
app/gui/oven_control/ovenstatics.cpp
| @@ -64,7 +64,6 @@ void OvenStatistics::onDataChanged() | @@ -64,7 +64,6 @@ void OvenStatistics::onDataChanged() | ||
| 64 | error_item *item; | 64 | error_item *item; |
| 65 | time_t ltime=0; | 65 | time_t ltime=0; |
| 66 | uint16_t errstatetemp; | 66 | uint16_t errstatetemp; |
| 67 | - qDebug() << "statics event fired"; | ||
| 68 | udp->fillControl(control); | 67 | udp->fillControl(control); |
| 69 | udp->fillData(state); | 68 | udp->fillData(state); |
| 70 | bDataRefreshed = true; | 69 | bDataRefreshed = true; |
app/gui/oven_control/stringer.cpp
| @@ -40,17 +40,17 @@ int toFahrenheit(int celsius) | @@ -40,17 +40,17 @@ int toFahrenheit(int celsius) | ||
| 40 | return celsius * 1.8 + 32; | 40 | return celsius * 1.8 + 32; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | -enum RealTimeFormat { UseAmPm, Use24 }; | 43 | +enum RealTimeFormat { Hour12, Hour24 }; |
| 44 | RealTimeFormat realTimeFormat() | 44 | RealTimeFormat realTimeFormat() |
| 45 | { | 45 | { |
| 46 | Define::config_item item = Config::getInstance()->getConfigValue(Define::config_time_type); | 46 | Define::config_item item = Config::getInstance()->getConfigValue(Define::config_time_type); |
| 47 | switch (item.d32) | 47 | switch (item.d32) |
| 48 | { | 48 | { |
| 49 | case Define::time_type_12h: | 49 | case Define::time_type_12h: |
| 50 | - return UseAmPm; | 50 | + return Hour12; |
| 51 | case Define::time_type_24h: | 51 | case Define::time_type_24h: |
| 52 | default: | 52 | default: |
| 53 | - return Use24; | 53 | + return Hour24; |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | 56 | ||
| @@ -72,9 +72,9 @@ QString Stringer::remainingTime(int msecs) | @@ -72,9 +72,9 @@ QString Stringer::remainingTime(int msecs) | ||
| 72 | QDateTime dateTime = QDateTime::currentDateTime().addMSecs(msecs); | 72 | QDateTime dateTime = QDateTime::currentDateTime().addMSecs(msecs); |
| 73 | switch (realTimeFormat()) | 73 | switch (realTimeFormat()) |
| 74 | { | 74 | { |
| 75 | - case UseAmPm: | 75 | + case Hour12: |
| 76 | return dateTime.toString("A hh:mm:ss"); | 76 | return dateTime.toString("A hh:mm:ss"); |
| 77 | - case Use24: | 77 | + case Hour24: |
| 78 | return dateTime.toString("HH:mm:ss"); | 78 | return dateTime.toString("HH:mm:ss"); |
| 79 | } | 79 | } |
| 80 | } | 80 | } |
| @@ -108,9 +108,9 @@ QString Stringer::remainingTime(int msecs, QString style) | @@ -108,9 +108,9 @@ QString Stringer::remainingTime(int msecs, QString style) | ||
| 108 | QDateTime dateTime = QDateTime::currentDateTime().addMSecs(msecs); | 108 | QDateTime dateTime = QDateTime::currentDateTime().addMSecs(msecs); |
| 109 | switch (realTimeFormat()) | 109 | switch (realTimeFormat()) |
| 110 | { | 110 | { |
| 111 | - case UseAmPm: | 111 | + case Hour12: |
| 112 | return heavySpan.arg(dateTime.toString("A hh:mm:ss")); | 112 | return heavySpan.arg(dateTime.toString("A hh:mm:ss")); |
| 113 | - case Use24: | 113 | + case Hour24: |
| 114 | return heavySpan.arg(dateTime.toString("HH:mm:ss")); | 114 | return heavySpan.arg(dateTime.toString("HH:mm:ss")); |
| 115 | } | 115 | } |
| 116 | } | 116 | } |
app/gui/oven_control/washwindow.cpp
| @@ -3,6 +3,8 @@ | @@ -3,6 +3,8 @@ | ||
| 3 | 3 | ||
| 4 | #include <QSignalMapper> | 4 | #include <QSignalMapper> |
| 5 | 5 | ||
| 6 | +#include "soundplayer.h" | ||
| 7 | + | ||
| 6 | WashWindow::WashWindow(QWidget *parent) : | 8 | WashWindow::WashWindow(QWidget *parent) : |
| 7 | QMainWindow(parent), | 9 | QMainWindow(parent), |
| 8 | ui(new Ui::WashWindow), | 10 | ui(new Ui::WashWindow), |
| @@ -52,6 +54,8 @@ WashWindow::~WashWindow() | @@ -52,6 +54,8 @@ WashWindow::~WashWindow() | ||
| 52 | 54 | ||
| 53 | void WashWindow::start(int type) | 55 | void WashWindow::start(int type) |
| 54 | { | 56 | { |
| 57 | + SoundPlayer::playClick(); | ||
| 58 | + | ||
| 55 | if (selected) | 59 | if (selected) |
| 56 | return; | 60 | return; |
| 57 | 61 | ||
| @@ -126,6 +130,8 @@ void WashWindow::onChanged() | @@ -126,6 +130,8 @@ void WashWindow::onChanged() | ||
| 126 | { | 130 | { |
| 127 | started = true; | 131 | started = true; |
| 128 | 132 | ||
| 133 | + SoundPlayer::playStart(); | ||
| 134 | + | ||
| 129 | ui->closeDoorArrow->hide(); | 135 | ui->closeDoorArrow->hide(); |
| 130 | ui->animation->clear(); | 136 | ui->animation->clear(); |
| 131 | 137 | ||
| @@ -199,10 +205,14 @@ void WashWindow::onChanged() | @@ -199,10 +205,14 @@ void WashWindow::onChanged() | ||
| 199 | } | 205 | } |
| 200 | else if (canceled) | 206 | else if (canceled) |
| 201 | { | 207 | { |
| 208 | + SoundPlayer::playStop(); | ||
| 209 | + | ||
| 202 | close(); | 210 | close(); |
| 203 | } | 211 | } |
| 204 | else if (run) | 212 | else if (run) |
| 205 | { | 213 | { |
| 214 | + SoundPlayer::playStop(); | ||
| 215 | + | ||
| 206 | ui->titleLabel->setText("세척이 종료되었습니다"); | 216 | ui->titleLabel->setText("세척이 종료되었습니다"); |
| 207 | ui->descLabel->setText(""); | 217 | ui->descLabel->setText(""); |
| 208 | ui->washStepTypeLabel->setText(""); | 218 | ui->washStepTypeLabel->setText(""); |
| @@ -223,8 +233,24 @@ void WashWindow::onChanged() | @@ -223,8 +233,24 @@ void WashWindow::onChanged() | ||
| 223 | 233 | ||
| 224 | void WashWindow::on_backButton_clicked() | 234 | void WashWindow::on_backButton_clicked() |
| 225 | { | 235 | { |
| 236 | + SoundPlayer::playClick(); | ||
| 237 | + | ||
| 226 | if (started) | 238 | if (started) |
| 227 | stop(); | 239 | stop(); |
| 228 | else | 240 | else |
| 229 | close(); | 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,6 +25,10 @@ private slots: | ||
| 25 | void onChanged(); | 25 | void onChanged(); |
| 26 | void on_backButton_clicked(); | 26 | void on_backButton_clicked(); |
| 27 | 27 | ||
| 28 | + void on_configButton_clicked(); | ||
| 29 | + | ||
| 30 | + void on_helpButton_clicked(); | ||
| 31 | + | ||
| 28 | private: | 32 | private: |
| 29 | Ui::WashWindow *ui; | 33 | Ui::WashWindow *ui; |
| 30 | UdpHandler *udp; | 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