Commit c598b01b225b5dbf5659c2157f1c327cc44e8c8b

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

GUI 업데이트

app/gui/oven_control/main.cpp
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 int main(int argc, char *argv[]) 7 int main(int argc, char *argv[])
8 { 8 {
9 QApplication a(argc, argv); 9 QApplication a(argc, argv);
10 - 10 + a.primaryScreen().
11 MainWindow w; 11 MainWindow w;
12 w.showFullScreen(); 12 w.showFullScreen();
13 13
app/gui/oven_control/mainwindow.cpp
@@ -26,6 +26,7 @@ MainWindow::MainWindow(QWidget *parent) : @@ -26,6 +26,7 @@ MainWindow::MainWindow(QWidget *parent) :
26 interface->setUdpHandler(udp); 26 interface->setUdpHandler(udp);
27 27
28 ManualCookWindow *window = new ManualCookWindow(this, oven, udp); 28 ManualCookWindow *window = new ManualCookWindow(this, oven, udp);
  29 + window->setWindowModality(Qt::WindowModal);
29 window->hide(); 30 window->hide();
30 31
31 connect(ui->steamButton, SIGNAL(clicked()), this, SIGNAL(modeButtonClicked())); 32 connect(ui->steamButton, SIGNAL(clicked()), this, SIGNAL(modeButtonClicked()));
@@ -43,8 +44,6 @@ MainWindow::MainWindow(QWidget *parent) : @@ -43,8 +44,6 @@ MainWindow::MainWindow(QWidget *parent) :
43 connect(ui->combiButton, SIGNAL(clicked()), sm, SLOT(map())); 44 connect(ui->combiButton, SIGNAL(clicked()), sm, SLOT(map()));
44 connect(ui->dryheatButton, SIGNAL(clicked()), sm, SLOT(map())); 45 connect(ui->dryheatButton, SIGNAL(clicked()), sm, SLOT(map()));
45 connect(sm, SIGNAL(mapped(int)), this, SLOT(onModeButtonClicked(int))); 46 connect(sm, SIGNAL(mapped(int)), this, SLOT(onModeButtonClicked(int)));
46 -  
47 -  
48 } 47 }
49 48
50 MainWindow::~MainWindow() 49 MainWindow::~MainWindow()
@@ -54,7 +53,6 @@ MainWindow::~MainWindow() @@ -54,7 +53,6 @@ MainWindow::~MainWindow()
54 53
55 void MainWindow::onModeButtonClicked(int mode) 54 void MainWindow::onModeButtonClicked(int mode)
56 { 55 {
57 -// oven->setMode((Oven::Mode) mode);  
58 oven->setDefault((Oven::Mode) mode); 56 oven->setDefault((Oven::Mode) mode);
59 } 57 }
60 58
@@ -65,5 +63,6 @@ void MainWindow::on_configButton_clicked() @@ -65,5 +63,6 @@ void MainWindow::on_configButton_clicked()
65 // w->showFullScreen(); 63 // w->showFullScreen();
66 64
67 FunctionTestWindow *w = new FunctionTestWindow(this, udp); 65 FunctionTestWindow *w = new FunctionTestWindow(this, udp);
  66 + w->setWindowModality(Qt::WindowModal);
68 w->showFullScreen(); 67 w->showFullScreen();
69 } 68 }
app/gui/oven_control/manualcookwindow.cpp
@@ -156,7 +156,12 @@ void ManualCookWindow::updateLabels() @@ -156,7 +156,12 @@ void ManualCookWindow::updateLabels()
156 else 156 else
157 time = oven->time(); 157 time = oven->time();
158 158
159 - ui->timeLabel->setText(buf.sprintf("%02d:%02d H/M", time / 3600, (time % 3600) / 60)); 159 + if (time >= 3600)
  160 + ui->timeLabel->setText(buf.sprintf("%d시간 %02d분", time / 3600, (time % 3600) / 60));
  161 + else if (time >= 60)
  162 + ui->timeLabel->setText(buf.sprintf("%d분 %02d초", time / 60, time % 60));
  163 + else
  164 + ui->timeLabel->setText(buf.sprintf("%d초", time));
160 165
161 if (oven->interTempEnabled()) 166 if (oven->interTempEnabled())
162 { 167 {
@@ -268,7 +273,40 @@ QPushButton#interTempButton:pressed {\ @@ -268,7 +273,40 @@ QPushButton#interTempButton:pressed {\
268 ui->innerInterTempSlider->setValue(oven->interTemp()); 273 ui->innerInterTempSlider->setValue(oven->interTemp());
269 ui->innerInterTempSlider->blockSignals(old); 274 ui->innerInterTempSlider->blockSignals(old);
270 275
271 - ui->runStopButton->setChecked(oven->cooking()); 276 + if (oven->cooking())
  277 + ui->runStopButton->setStyleSheet(
  278 + "border-image: url(:/images/images/manual/012_play_btn_ov_stop.png)");
  279 + else
  280 + ui->runStopButton->setStyleSheet(
  281 + "border-image: url(:/images/images/manual/012_play_btn.png)");
  282 +
  283 + if (oven->preheating())
  284 + ui->preheatButton->setStyleSheet(
  285 + "border-image: url(:/images/images/manual/013_sys_icon_01_ov.png)");
  286 + else
  287 + ui->preheatButton->setStyleSheet(
  288 + "border-image: url(:/images/images/manual/013_sys_icon_01.png)");
  289 +
  290 + if (oven->damper())
  291 + ui->damperButton->setStyleSheet(
  292 + "border-image: url(:/images/images/manual/013_sys_icon_02_ov.png)");
  293 + else
  294 + ui->damperButton->setStyleSheet(
  295 + "border-image: url(:/images/images/manual/013_sys_icon_02.png)");
  296 +
  297 + if (oven->humidification())
  298 + ui->humidificationButton->setStyleSheet(
  299 + "border-image: url(:/images/images/manual/013_sys_icon_03_ov.png)");
  300 + else
  301 + ui->humidificationButton->setStyleSheet(
  302 + "border-image: url(:/images/images/manual/013_sys_icon_03.png)");
  303 +
  304 + if (oven->cooldown())
  305 + ui->cooldownButton->setStyleSheet(
  306 + "border-image: url(:/images/images/manual/013_sys_icon_05_ov.png)");
  307 + else
  308 + ui->cooldownButton->setStyleSheet(
  309 + "border-image: url(:/images/images/manual/013_sys_icon_05.png)");
272 310
273 switch (oven->fan()) 311 switch (oven->fan())
274 { 312 {
@@ -301,15 +339,15 @@ QPushButton#interTempButton:pressed {\ @@ -301,15 +339,15 @@ QPushButton#interTempButton:pressed {\
301 updateLabels(); 339 updateLabels();
302 } 340 }
303 341
304 -void ManualCookWindow::on_runStopButton_toggled(bool checked) 342 +void ManualCookWindow::on_runStopButton_clicked()
305 { 343 {
306 - if (checked)  
307 - oven->startCooking();  
308 - else 344 + if (oven->cooking())
309 { 345 {
310 oven->stopCooking(); 346 oven->stopCooking();
311 emit cookStopRequested(); 347 emit cookStopRequested();
312 } 348 }
  349 + else
  350 + oven->startCooking();
313 } 351 }
314 352
315 void ManualCookWindow::on_fanButton_clicked() 353 void ManualCookWindow::on_fanButton_clicked()
@@ -331,10 +369,7 @@ void ManualCookWindow::on_applyButton_clicked() @@ -331,10 +369,7 @@ void ManualCookWindow::on_applyButton_clicked()
331 ui->bodyStack->setCurrentIndex(0); 369 ui->bodyStack->setCurrentIndex(0);
332 370
333 oven->setInterTemp(ui->innerInterTempSlider->value()); 371 oven->setInterTemp(ui->innerInterTempSlider->value());
334 -// bool old = oven->blockSignals(true);  
335 oven->setInterTempEnabled(true); 372 oven->setInterTempEnabled(true);
336 -// oven->blockSignals(old);  
337 -  
338 } 373 }
339 374
340 void ManualCookWindow::on_interTempButton_clicked() 375 void ManualCookWindow::on_interTempButton_clicked()
@@ -347,84 +382,47 @@ void ManualCookWindow::on_interTempButton_clicked() @@ -347,84 +382,47 @@ void ManualCookWindow::on_interTempButton_clicked()
347 382
348 void ManualCookWindow::on_preheatButton_clicked() 383 void ManualCookWindow::on_preheatButton_clicked()
349 { 384 {
350 - static bool sw = false;  
351 - udp->turnOn(TG_MANUAL_RELAY);  
352 - if (sw)  
353 - udp->turnOn(TG_DV); 385 + if (oven->preheating())
  386 + oven->stopPreheating();
354 else 387 else
355 - udp->turnOff(TG_DV);  
356 -  
357 - sw = !sw; 388 + oven->startPreheating();
358 } 389 }
359 390
360 void ManualCookWindow::on_damperButton_clicked() 391 void ManualCookWindow::on_damperButton_clicked()
361 { 392 {
362 - static bool sw = false;  
363 - udp->turnOn(TG_MANUAL_RELAY);  
364 - if (sw)  
365 - udp->turnOn(TG_UNP); 393 + if (oven->damper())
  394 + oven->closeDamper();
366 else 395 else
367 - udp->turnOff(TG_UNP);  
368 -  
369 - sw = !sw; 396 + oven->openDamper();
370 } 397 }
371 398
372 void ManualCookWindow::on_humidificationButton_clicked() 399 void ManualCookWindow::on_humidificationButton_clicked()
373 { 400 {
374 - static bool sw = false;  
375 - udp->turnOn(TG_MANUAL_RELAY);  
376 - if (sw)  
377 - udp->turnOn(TG_HDM); 401 + if (oven->humidification())
  402 + oven->stopHumidification();
378 else 403 else
379 - udp->turnOff(TG_HDM);  
380 -  
381 - sw = !sw; 404 + oven->startHumidification();
382 } 405 }
383 406
384 void ManualCookWindow::on_repeatButton_clicked() 407 void ManualCookWindow::on_repeatButton_clicked()
385 { 408 {
386 - static bool sw = false;  
387 - udp->turnOn(TG_MANUAL_RELAY);  
388 - if (sw)  
389 - udp->turnOn(TG_SSV);  
390 - else  
391 - udp->turnOff(TG_SSV);  
392 409
393 - sw = !sw;  
394 } 410 }
395 411
396 void ManualCookWindow::on_cooldownButton_clicked() 412 void ManualCookWindow::on_cooldownButton_clicked()
397 { 413 {
398 - static bool sw = false;  
399 - udp->turnOn(TG_MANUAL_RELAY);  
400 - if (sw)  
401 - udp->turnOn(TG_SNV); 414 + if (oven->cooldown())
  415 + oven->stopCooldown();
402 else 416 else
403 - udp->turnOff(TG_SNV);  
404 -  
405 - sw = !sw; 417 + oven->startCooldown();
406 } 418 }
407 419
408 void ManualCookWindow::on_reserveButton_clicked() 420 void ManualCookWindow::on_reserveButton_clicked()
409 { 421 {
410 - static bool sw = false;  
411 - udp->turnOn(TG_MANUAL_RELAY);  
412 - if (sw)  
413 - udp->turnOn(TG_HL);  
414 - else  
415 - udp->turnOff(TG_HL);  
416 422
417 - sw = !sw;  
418 } 423 }
419 424
420 void ManualCookWindow::on_favoritesButton_clicked() 425 void ManualCookWindow::on_favoritesButton_clicked()
421 { 426 {
422 - static bool sw = false;  
423 - udp->turnOn(TG_MANUAL_RELAY);  
424 - if (sw)  
425 - udp->turnOn(TG_DP);  
426 - else  
427 - udp->turnOff(TG_DP);  
428 427
429 - sw = !sw;  
430 } 428 }
app/gui/oven_control/manualcookwindow.h
@@ -34,7 +34,7 @@ private slots: @@ -34,7 +34,7 @@ private slots:
34 void showCurrentTemp(); 34 void showCurrentTemp();
35 void hideCurrentTemp(); 35 void hideCurrentTemp();
36 36
37 - void on_runStopButton_toggled(bool checked); 37 + void on_runStopButton_clicked();
38 void on_fanButton_clicked(); 38 void on_fanButton_clicked();
39 void on_goOuterButton_clicked(); 39 void on_goOuterButton_clicked();
40 void on_applyButton_clicked(); 40 void on_applyButton_clicked();
app/gui/oven_control/manualcookwindow.ui
@@ -469,18 +469,11 @@ background-image: url(:/images/images/manual/010_gauge_bar_set.png); @@ -469,18 +469,11 @@ background-image: url(:/images/images/manual/010_gauge_bar_set.png);
469 <property name="styleSheet"> 469 <property name="styleSheet">
470 <string notr="true">QPushButton { 470 <string notr="true">QPushButton {
471 border-image: url(:/images/images/manual/012_play_btn.png); 471 border-image: url(:/images/images/manual/012_play_btn.png);
472 -}  
473 -  
474 -QPushButton:checked {  
475 - border-image: url(:/images/images/manual/012_play_btn_ov_stop.png);  
476 }</string> 472 }</string>
477 </property> 473 </property>
478 <property name="text"> 474 <property name="text">
479 <string/> 475 <string/>
480 </property> 476 </property>
481 - <property name="checkable">  
482 - <bool>true</bool>  
483 - </property>  
484 </widget> 477 </widget>
485 <widget class="QSlider" name="interTempSlider"> 478 <widget class="QSlider" name="interTempSlider">
486 <property name="enabled"> 479 <property name="enabled">
app/gui/oven_control/oven.cpp
@@ -10,6 +10,9 @@ Oven::Oven(QObject *parent) : QObject(parent) @@ -10,6 +10,9 @@ Oven::Oven(QObject *parent) : QObject(parent)
10 cookingTimer.setSingleShot(true); 10 cookingTimer.setSingleShot(true);
11 connect(&cookingTimer, SIGNAL(timeout()), this, SLOT(stopCooking())); 11 connect(&cookingTimer, SIGNAL(timeout()), this, SLOT(stopCooking()));
12 12
  13 + damperTimer.setSingleShot(true);
  14 + connect(&damperTimer, SIGNAL(timeout()), this, SLOT(closeDamper()));
  15 +
13 humidificationTimer.setSingleShot(true); 16 humidificationTimer.setSingleShot(true);
14 connect(&humidificationTimer, SIGNAL(timeout()), this, SLOT(stopHumidification())); 17 connect(&humidificationTimer, SIGNAL(timeout()), this, SLOT(stopHumidification()));
15 } 18 }
@@ -72,6 +75,7 @@ void Oven::setDefault(Mode mode) @@ -72,6 +75,7 @@ void Oven::setDefault(Mode mode)
72 75
73 setTime(0); 76 setTime(0);
74 setInterTempEnabled_(false); 77 setInterTempEnabled_(false);
  78 + setInterTemp_(minInterTemp());
75 setFan_(4); 79 setFan_(4);
76 80
77 cooking_ = false; 81 cooking_ = false;
@@ -202,7 +206,7 @@ bool Oven::setFan_(int speed) @@ -202,7 +206,7 @@ bool Oven::setFan_(int speed)
202 if (speed == fan_) 206 if (speed == fan_)
203 return false; 207 return false;
204 208
205 - int rpm; 209 + int rpm = 0;
206 switch (speed) 210 switch (speed)
207 { 211 {
208 case 1: 212 case 1:
@@ -230,7 +234,7 @@ bool Oven::setFan_(int speed) @@ -230,7 +234,7 @@ bool Oven::setFan_(int speed)
230 234
231 bool Oven::cookingStartable() 235 bool Oven::cookingStartable()
232 { 236 {
233 - if (/*door() || */cooking()) 237 + if (/*door() || */cooking() || time() <= 0)
234 return false; 238 return false;
235 239
236 return true; 240 return true;
@@ -267,6 +271,9 @@ void Oven::stop() @@ -267,6 +271,9 @@ void Oven::stop()
267 if (preheating()) 271 if (preheating())
268 stopPreheating(); 272 stopPreheating();
269 273
  274 + if (damper())
  275 + closeDamper();
  276 +
270 if (cooldown()) 277 if (cooldown())
271 stopCooldown(); 278 stopCooldown();
272 279
@@ -405,12 +412,28 @@ void Oven::stopWashing() @@ -405,12 +412,28 @@ void Oven::stopWashing()
405 412
406 void Oven::openDamper() 413 void Oven::openDamper()
407 { 414 {
  415 + if (!damper())
  416 + {
  417 + damper_ = true;
  418 + damperTimer.start(5 * 60 * 1000);
  419 + interface->openDamper();
408 420
  421 + emit changed(this);
  422 + }
409 } 423 }
410 424
411 void Oven::closeDamper() 425 void Oven::closeDamper()
412 { 426 {
  427 + if (damper())
  428 + {
  429 + damper_ = false;
  430 + if (damperTimer.isActive())
  431 + damperTimer.stop();
  432 +
  433 + interface->closeDamper();
413 434
  435 + emit changed(this);
  436 + }
414 } 437 }
415 438
416 439
app/gui/oven_control/oven.h
@@ -9,6 +9,7 @@ class OvenInterface : public QObject @@ -9,6 +9,7 @@ class OvenInterface : public QObject
9 Q_OBJECT 9 Q_OBJECT
10 10
11 public: 11 public:
  12 + OvenInterface(QObject *parent = 0) : QObject(parent) {}
12 virtual ~OvenInterface(){} 13 virtual ~OvenInterface(){}
13 virtual int currentTemp() = 0; 14 virtual int currentTemp() = 0;
14 virtual int currentHumidity() = 0; 15 virtual int currentHumidity() = 0;
@@ -16,8 +17,8 @@ public: @@ -16,8 +17,8 @@ public:
16 virtual bool door() = 0; 17 virtual bool door() = 0;
17 18
18 signals: 19 signals:
19 - virtual void doorOpened() = 0;  
20 - virtual void doorClosed() = 0; 20 + void doorOpened();
  21 + void doorClosed();
21 22
22 public slots: 23 public slots:
23 // virtual void setMode(Oven::Mode mode) = 0; 24 // virtual void setMode(Oven::Mode mode) = 0;
@@ -70,6 +71,7 @@ private: @@ -70,6 +71,7 @@ private:
70 bool paused_; 71 bool paused_;
71 72
72 QTimer cookingTimer; 73 QTimer cookingTimer;
  74 + QTimer damperTimer;
73 QTimer humidificationTimer; 75 QTimer humidificationTimer;
74 QTimer interTempTimer; 76 QTimer interTempTimer;
75 77
app/gui/oven_control/oven_control.pro
@@ -65,3 +65,6 @@ FORMS += mainwindow.ui \ @@ -65,3 +65,6 @@ FORMS += mainwindow.ui \
65 65
66 RESOURCES += \ 66 RESOURCES += \
67 resources.qrc 67 resources.qrc
  68 +
  69 +target.path = /root
  70 +INSTALLS += target
app/gui/oven_control/ovencontroller.cpp
1 #include "ovencontroller.h" 1 #include "ovencontroller.h"
2 2
3 -OvenController::OvenController() 3 +OvenController::OvenController(QObject *parent) : OvenInterface(parent)
4 { 4 {
5 5
6 } 6 }
app/gui/oven_control/ovencontroller.h
@@ -14,7 +14,7 @@ class OvenController : public OvenInterface @@ -14,7 +14,7 @@ class OvenController : public OvenInterface
14 oven_state_t state; 14 oven_state_t state;
15 15
16 public: 16 public:
17 - OvenController(); 17 + OvenController(QObject *parent = 0);
18 18
19 void setUdpHandler(UdpHandler *udp); 19 void setUdpHandler(UdpHandler *udp);
20 int currentTemp(); 20 int currentTemp();