Commit ec04831f577033dcd47e62fa98f0b0baa1c01094

Authored by 고영탁
1 parent 66338dd9aa
Exists in master and in 2 other branches fhd, fhd-demo

모델 설정 변경

 - 변경 확인 팝업 추가
 - 버튼 체크 추가
app/gui/oven_control/electricmodelsettingwindow.cpp
1 1 #include "electricmodelsettingwindow.h"
2 2 #include "ui_electricmodelsettingwindow.h"
  3 +#include "yesnopopupdlg.h"
3 4  
4 5 #include "soundplayer.h"
5 6  
... ... @@ -14,6 +15,26 @@ ElectricModelSettingWindow::ElectricModelSettingWindow(QWidget *parent) :
14 15  
15 16 foreach (QPushButton *button, findChildren<QPushButton *>())
16 17 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
  18 +
  19 + Config* cfg = Config::getInstance();
  20 + Define::config_item item;
  21 + item = cfg->getConfigValue(Define::config_model);
  22 + selitem = item.d32;
  23 + switch(selitem){
  24 + case Define::model_electric_10:
  25 + ui->e10Button->setChecked(true);
  26 + break;
  27 + case Define::model_electric_20:
  28 + ui->e20Button->setChecked(true);
  29 + break;
  30 + case Define::model_electric_24:
  31 + ui->e24Button->setChecked(true);
  32 + break;
  33 + case Define::model_electric_40:
  34 + ui->e40Button->setChecked(true);
  35 + break;
  36 + }
  37 +
17 38 }
18 39  
19 40 ElectricModelSettingWindow::~ElectricModelSettingWindow()
... ... @@ -33,25 +54,42 @@ void ElectricModelSettingWindow::setModel(Define::model_type model)
33 54  
34 55 void ElectricModelSettingWindow::on_e10Button_clicked()
35 56 {
36   - setModel(Define::model_electric_10);
  57 + //setModel(Define::model_electric_10);
  58 + selitem = Define::model_electric_10;
37 59 }
38 60  
39 61 void ElectricModelSettingWindow::on_e20Button_clicked()
40 62 {
41   - setModel(Define::model_electric_20);
  63 + //setModel(Define::model_electric_20);
  64 + selitem = Define::model_electric_20;
42 65 }
43 66  
44 67 void ElectricModelSettingWindow::on_e24Button_clicked()
45 68 {
46   - setModel(Define::model_electric_24);
  69 + //setModel(Define::model_electric_24);
  70 + selitem = Define::model_electric_24;
  71 +
47 72 }
48 73  
49 74 void ElectricModelSettingWindow::on_e40Button_clicked()
50 75 {
51   - setModel(Define::model_electric_40);
  76 + //setModel(Define::model_electric_40);
  77 + selitem = Define::model_electric_40;
52 78 }
53 79  
54 80 void ElectricModelSettingWindow::on_backButton_clicked()
55 81 {
  82 + Config* cfg = Config::getInstance();
  83 + Define::config_item item;
  84 + item = cfg->getConfigValue(Define::config_model);
  85 +
  86 + if(selitem != item.d32){
  87 + YesNoPopupDlg* yesnopop = new YesNoPopupDlg(this, tr("모델을 변경하시겠습니까?"));
  88 + yesnopop->setModal(true);
  89 + yesnopop->exec();
  90 + if(yesnopop->result() == QDialog::Accepted){
  91 + setModel((Define::model_type)selitem);
  92 + }
  93 + }
56 94 close();
57 95 }
... ...
app/gui/oven_control/electricmodelsettingwindow.h
... ... @@ -29,6 +29,7 @@ private slots:
29 29  
30 30 private:
31 31 Ui::ElectricModelSettingWindow *ui;
  32 + int selitem;
32 33 };
33 34  
34 35 #endif // ELECTRICMODELSETTINGWINDOW_H
... ...
app/gui/oven_control/electricmodelsettingwindow.ui
... ... @@ -40,11 +40,17 @@
40 40 </property>
41 41 <property name="styleSheet">
42 42 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
43   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  43 +QPushButton:pressed, QPushButton:checked { border-image: url(:/images/button/379_ov.png); }</string>
44 44 </property>
45 45 <property name="text">
46 46 <string>24단</string>
47 47 </property>
  48 + <property name="checkable">
  49 + <bool>true</bool>
  50 + </property>
  51 + <property name="autoExclusive">
  52 + <bool>true</bool>
  53 + </property>
48 54 </widget>
49 55 <widget class="QWidget" name="widget" native="true">
50 56 <property name="geometry">
... ... @@ -168,11 +174,17 @@ QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }&lt;/string&gt;
168 174 </property>
169 175 <property name="styleSheet">
170 176 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
171   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  177 +QPushButton:pressed, QPushButton:checked { border-image: url(:/images/button/379_ov.png); }</string>
172 178 </property>
173 179 <property name="text">
174 180 <string>40단</string>
175 181 </property>
  182 + <property name="checkable">
  183 + <bool>true</bool>
  184 + </property>
  185 + <property name="autoExclusive">
  186 + <bool>true</bool>
  187 + </property>
176 188 </widget>
177 189 <widget class="QLabel" name="label_15">
178 190 <property name="geometry">
... ... @@ -375,11 +387,17 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); }&lt;/str
375 387 </property>
376 388 <property name="styleSheet">
377 389 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
378   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  390 +QPushButton:pressed, QPushButton:checked { border-image: url(:/images/button/379_ov.png); }</string>
379 391 </property>
380 392 <property name="text">
381 393 <string>10단</string>
382 394 </property>
  395 + <property name="checkable">
  396 + <bool>true</bool>
  397 + </property>
  398 + <property name="autoExclusive">
  399 + <bool>true</bool>
  400 + </property>
383 401 </widget>
384 402 <widget class="QPushButton" name="e20Button">
385 403 <property name="geometry">
... ... @@ -406,11 +424,17 @@ QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }&lt;/string&gt;
406 424 </property>
407 425 <property name="styleSheet">
408 426 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
409   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  427 +QPushButton:pressed, QPushButton:checked { border-image: url(:/images/button/379_ov.png); }</string>
410 428 </property>
411 429 <property name="text">
412 430 <string>20단</string>
413 431 </property>
  432 + <property name="checkable">
  433 + <bool>true</bool>
  434 + </property>
  435 + <property name="autoExclusive">
  436 + <bool>true</bool>
  437 + </property>
414 438 </widget>
415 439 <widget class="Line" name="line_3">
416 440 <property name="geometry">
... ...
app/gui/oven_control/gasmodelsettingwindow.cpp
  1 +#include <QDebug>
1 2 #include "gasmodelsettingwindow.h"
2 3 #include "ui_gasmodelsettingwindow.h"
  4 +#include "yesnopopupdlg.h"
3 5  
4 6 #include "soundplayer.h"
5 7  
... ... @@ -14,6 +16,37 @@ GasModelSettingWindow::GasModelSettingWindow(QWidget *parent) :
14 16  
15 17 foreach (QPushButton *button, findChildren<QPushButton *>())
16 18 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
  19 +
  20 + Config* cfg = Config::getInstance();
  21 + Define::config_item item;
  22 + item = cfg->getConfigValue(Define::config_model);
  23 + selitem = item.d32;
  24 + switch(item.d32){
  25 + case Define::model_gas_lng_10:
  26 + ui->lng10Button->setChecked(true);
  27 + break;
  28 + case Define::model_gas_lng_20:
  29 + ui->lng20Button->setChecked(true);
  30 + break;
  31 + case Define::model_gas_lng_24:
  32 + ui->lng24Button->setChecked(true);
  33 + break;
  34 + case Define::model_gas_lng_40:
  35 + ui->lng40Button->setChecked(true);
  36 + break;
  37 + case Define::model_gas_lpg_10:
  38 + ui->lpg10Button->setChecked(true);
  39 + break;
  40 + case Define::model_gas_lpg_20:
  41 + ui->lpg20Button->setChecked(true);
  42 + break;
  43 + case Define::model_gas_lpg_24:
  44 + ui->lpg24Button->setChecked(true);
  45 + break;
  46 + case Define::model_gas_lpg_40:
  47 + ui->lpg40Button->setChecked(true);
  48 + break;
  49 + }
17 50 }
18 51  
19 52 GasModelSettingWindow::~GasModelSettingWindow()
... ... @@ -33,45 +66,66 @@ void GasModelSettingWindow::setModel(Define::model_type model)
33 66  
34 67 void GasModelSettingWindow::on_lpg10Button_clicked()
35 68 {
36   - setModel(Define::model_gas_lpg_10);
  69 + //setModel(Define::model_gas_lpg_10);
  70 + selitem = Define::model_gas_lpg_10;
37 71 }
38 72  
39 73 void GasModelSettingWindow::on_lng10Button_clicked()
40 74 {
41   - setModel(Define::model_gas_lng_10);
  75 + //setModel(Define::model_gas_lng_10);
  76 + selitem = Define::model_gas_lng_10;
42 77 }
43 78  
44 79 void GasModelSettingWindow::on_lpg20Button_clicked()
45 80 {
46   - setModel(Define::model_gas_lpg_20);
  81 + //setModel(Define::model_gas_lpg_20);
  82 + selitem = Define::model_gas_lpg_20;
47 83 }
48 84  
49 85 void GasModelSettingWindow::on_lng20Button_clicked()
50 86 {
51   - setModel(Define::model_gas_lng_20);
  87 + //setModel(Define::model_gas_lng_20);
  88 + selitem = Define::model_gas_lng_20;
52 89 }
53 90  
54 91 void GasModelSettingWindow::on_lpg24Button_clicked()
55 92 {
56   - setModel(Define::model_gas_lpg_24);
  93 + //setModel(Define::model_gas_lpg_24);
  94 + selitem = Define::model_gas_lpg_24;
57 95 }
58 96  
59 97 void GasModelSettingWindow::on_lng24Button_clicked()
60 98 {
61   - setModel(Define::model_gas_lng_24);
  99 + //setModel(Define::model_gas_lng_24);
  100 + selitem = Define::model_gas_lng_24;
62 101 }
63 102  
64 103 void GasModelSettingWindow::on_lpg40Button_clicked()
65 104 {
66   - setModel(Define::model_gas_lpg_40);
  105 + //setModel(Define::model_gas_lpg_40);
  106 + selitem = Define::model_gas_lpg_40;
67 107 }
68 108  
69 109 void GasModelSettingWindow::on_lng40Button_clicked()
70 110 {
71   - setModel(Define::model_gas_lng_40);
  111 + //setModel(Define::model_gas_lng_40);
  112 + selitem = Define::model_gas_lng_40;
72 113 }
73 114  
74 115 void GasModelSettingWindow::on_backButton_clicked()
75 116 {
  117 + Config* cfg = Config::getInstance();
  118 + Define::config_item item;
  119 + item = cfg->getConfigValue(Define::config_model);
  120 +
  121 + if(selitem != item.d32){
  122 + YesNoPopupDlg* yesnopop = new YesNoPopupDlg(this, tr("모델을 변경하시겠습니까?"));
  123 + yesnopop->setModal(true);
  124 + yesnopop->exec();
  125 + if(yesnopop->result() == QDialog::Accepted){
  126 + setModel((Define::model_type)selitem);
  127 + qDebug() << "saved";
  128 + }
  129 + }
76 130 close();
77 131 }
... ...
app/gui/oven_control/gasmodelsettingwindow.h
... ... @@ -32,6 +32,7 @@ private slots:
32 32  
33 33 private:
34 34 Ui::GasModelSettingWindow *ui;
  35 + uint32_t selitem;
35 36 };
36 37  
37 38 #endif // GASMODELSETTINGWINDOW_H
... ...
app/gui/oven_control/gasmodelsettingwindow.ui
... ... @@ -40,11 +40,17 @@
40 40 </property>
41 41 <property name="styleSheet">
42 42 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
43   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  43 +QPushButton:pressed, QPushButton::checked { border-image: url(:/images/button/379_ov.png); }</string>
44 44 </property>
45 45 <property name="text">
46 46 <string>20단 LPG</string>
47 47 </property>
  48 + <property name="checkable">
  49 + <bool>true</bool>
  50 + </property>
  51 + <property name="autoExclusive">
  52 + <bool>true</bool>
  53 + </property>
48 54 </widget>
49 55 <widget class="QWidget" name="widget" native="true">
50 56 <property name="geometry">
... ... @@ -181,11 +187,17 @@ QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }&lt;/string&gt;
181 187 </property>
182 188 <property name="styleSheet">
183 189 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
184   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  190 +QPushButton:pressed, QPushButton::checked { border-image: url(:/images/button/379_ov.png); }</string>
185 191 </property>
186 192 <property name="text">
187 193 <string>24단 LNG</string>
188 194 </property>
  195 + <property name="checkable">
  196 + <bool>true</bool>
  197 + </property>
  198 + <property name="autoExclusive">
  199 + <bool>true</bool>
  200 + </property>
189 201 </widget>
190 202 <widget class="QPushButton" name="lng20Button">
191 203 <property name="geometry">
... ... @@ -212,11 +224,17 @@ QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }&lt;/string&gt;
212 224 </property>
213 225 <property name="styleSheet">
214 226 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
215   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  227 +QPushButton:pressed , QPushButton::checked { border-image: url(:/images/button/379_ov.png); }</string>
216 228 </property>
217 229 <property name="text">
218 230 <string>20단 LNG</string>
219 231 </property>
  232 + <property name="checkable">
  233 + <bool>true</bool>
  234 + </property>
  235 + <property name="autoExclusive">
  236 + <bool>true</bool>
  237 + </property>
220 238 </widget>
221 239 <widget class="QPushButton" name="lpg24Button">
222 240 <property name="geometry">
... ... @@ -243,11 +261,17 @@ QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }&lt;/string&gt;
243 261 </property>
244 262 <property name="styleSheet">
245 263 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
246   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  264 +QPushButton:pressed, QPushButton::checked { border-image: url(:/images/button/379_ov.png); }</string>
247 265 </property>
248 266 <property name="text">
249 267 <string>24단 LPG</string>
250 268 </property>
  269 + <property name="checkable">
  270 + <bool>true</bool>
  271 + </property>
  272 + <property name="autoExclusive">
  273 + <bool>true</bool>
  274 + </property>
251 275 </widget>
252 276 <widget class="QLabel" name="label_15">
253 277 <property name="geometry">
... ... @@ -463,11 +487,17 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); }&lt;/str
463 487 </property>
464 488 <property name="styleSheet">
465 489 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
466   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  490 +QPushButton:pressed, QPushButton::checked { border-image: url(:/images/button/379_ov.png); }</string>
467 491 </property>
468 492 <property name="text">
469 493 <string>10단 LPG</string>
470 494 </property>
  495 + <property name="checkable">
  496 + <bool>true</bool>
  497 + </property>
  498 + <property name="autoExclusive">
  499 + <bool>true</bool>
  500 + </property>
471 501 </widget>
472 502 <widget class="QPushButton" name="lng10Button">
473 503 <property name="geometry">
... ... @@ -494,11 +524,17 @@ QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }&lt;/string&gt;
494 524 </property>
495 525 <property name="styleSheet">
496 526 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
497   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  527 +QPushButton:pressed , QPushButton::checked{ border-image: url(:/images/button/379_ov.png); }</string>
498 528 </property>
499 529 <property name="text">
500 530 <string>10단 LNG</string>
501 531 </property>
  532 + <property name="checkable">
  533 + <bool>true</bool>
  534 + </property>
  535 + <property name="autoExclusive">
  536 + <bool>true</bool>
  537 + </property>
502 538 </widget>
503 539 <widget class="Line" name="line_3">
504 540 <property name="geometry">
... ... @@ -574,11 +610,17 @@ QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }&lt;/string&gt;
574 610 </property>
575 611 <property name="styleSheet">
576 612 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
577   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  613 +QPushButton:pressed,QPushButton::checked { border-image: url(:/images/button/379_ov.png); }</string>
578 614 </property>
579 615 <property name="text">
580 616 <string>40단 LPG</string>
581 617 </property>
  618 + <property name="checkable">
  619 + <bool>true</bool>
  620 + </property>
  621 + <property name="autoExclusive">
  622 + <bool>true</bool>
  623 + </property>
582 624 </widget>
583 625 <widget class="Line" name="line_8">
584 626 <property name="geometry">
... ... @@ -631,11 +673,17 @@ QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }&lt;/string&gt;
631 673 </property>
632 674 <property name="styleSheet">
633 675 <string notr="true">QPushButton { border-image: url(:/images/button/379.png); }
634   -QPushButton:pressed { border-image: url(:/images/button/379_ov.png); }</string>
  676 +QPushButton:pressed, QPushButton::checked { border-image: url(:/images/button/379_ov.png); }</string>
635 677 </property>
636 678 <property name="text">
637 679 <string>40단 LNG</string>
638 680 </property>
  681 + <property name="checkable">
  682 + <bool>true</bool>
  683 + </property>
  684 + <property name="autoExclusive">
  685 + <bool>true</bool>
  686 + </property>
639 687 </widget>
640 688 </widget>
641 689 </widget>
... ...