Commit 2576fd06a148124bdb04652d06214e66ef35b0cb

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

수동 요리 예약 디자인/동작 변경

- 설정 단위를 시/분으로 한정
- 설정 시간에 시작하는 것이 아닌 설정한 시간만큼 흐른 뒤 시작
app/gui/oven_control/reservedtimepopup.cpp
... ... @@ -15,6 +15,10 @@ ReservedTimePopup::ReservedTimePopup(QWidget *parent, QDateTime target) :
15 15  
16 16 setAttribute(Qt::WA_DeleteOnClose);
17 17  
  18 + int remainingTime = QDateTime::currentDateTime().msecsTo(target);
  19 + ui->remainingTime->setMaximum(remainingTime);
  20 + ui->remainingTime->setValue(remainingTime);
  21 +
18 22 connect(&checkTimeTimer, SIGNAL(timeout()), SLOT(checkTime()));
19 23 checkTimeTimer.start(100);
20 24  
... ... @@ -63,7 +67,10 @@ void ReservedTimePopup::checkTime()
63 67 {
64 68 qint64 remaining = QDateTime::currentDateTime().msecsTo(target);
65 69 if (remaining > 0)
  70 + {
66 71 ui->timeLabel->setText(Stringer::remainingTime(remaining));
  72 + ui->remainingTime->setValue(remaining);
  73 + }
67 74 else
68 75 {
69 76 emit timeout();
... ...
app/gui/oven_control/reservedtimepopup.ui
... ... @@ -61,7 +61,7 @@ QSpinBox{
61 61 </font>
62 62 </property>
63 63 <property name="text">
64   - <string>예약 시간</string>
  64 + <string>예약하기</string>
65 65 </property>
66 66 <property name="alignment">
67 67 <set>Qt::AlignCenter</set>
... ... @@ -70,16 +70,16 @@ QSpinBox{
70 70 <widget class="QLabel" name="timeLabel">
71 71 <property name="geometry">
72 72 <rect>
73   - <x>0</x>
74   - <y>100</y>
75   - <width>900</width>
76   - <height>199</height>
  73 + <x>70</x>
  74 + <y>190</y>
  75 + <width>151</width>
  76 + <height>58</height>
77 77 </rect>
78 78 </property>
79 79 <property name="font">
80 80 <font>
81 81 <family>나눔고딕</family>
82   - <pointsize>18</pointsize>
  82 + <pointsize>14</pointsize>
83 83 <weight>75</weight>
84 84 <bold>true</bold>
85 85 </font>
... ... @@ -88,7 +88,7 @@ QSpinBox{
88 88 <string>0</string>
89 89 </property>
90 90 <property name="alignment">
91   - <set>Qt::AlignCenter</set>
  91 + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
92 92 </property>
93 93 </widget>
94 94 <widget class="QPushButton" name="cancelButton">
... ... @@ -120,8 +120,26 @@ QSpinBox{
120 120 <bool>true</bool>
121 121 </property>
122 122 </widget>
  123 + <widget class="WashStepGauge" name="remainingTime" native="true">
  124 + <property name="geometry">
  125 + <rect>
  126 + <x>250</x>
  127 + <y>190</y>
  128 + <width>532</width>
  129 + <height>58</height>
  130 + </rect>
  131 + </property>
  132 + </widget>
123 133 </widget>
124 134 </widget>
  135 + <customwidgets>
  136 + <customwidget>
  137 + <class>WashStepGauge</class>
  138 + <extends>QWidget</extends>
  139 + <header>washstepgauge.h</header>
  140 + <container>1</container>
  141 + </customwidget>
  142 + </customwidgets>
125 143 <resources/>
126 144 <connections/>
127 145 </ui>
... ...
app/gui/oven_control/reservetimepopup.cpp
... ... @@ -17,10 +17,8 @@ ReserveTimePopup::ReserveTimePopup(QWidget *parent) :
17 17 setAttribute(Qt::WA_DeleteOnClose);
18 18  
19 19 QDateTime dt = QDateTime::currentDateTime();
20   - ui->month->setValue(dt.date().month());
21   - ui->day->setValue(dt.date().day());
22   - ui->hour->setValue(dt.time().hour());
23   - ui->min->setValue(dt.time().minute());
  20 + ui->hour->setValue(1);
  21 + ui->min->setValue(0);
24 22  
25 23 connect(ui->keyboard, SIGNAL(onOkKeyClicked()), ui->keyboard, SLOT(focusOutKeyboard()));
26 24 connect(ui->keyboard, SIGNAL(onCancelKeyClicked()), ui->keyboard, SLOT(focusOutKeyboard()));
... ... @@ -102,13 +100,8 @@ void ReserveTimePopup::revert()
102 100  
103 101 void ReserveTimePopup::on_okButton_clicked()
104 102 {
105   - QDateTime current = QDateTime::currentDateTime();
106   - QDateTime target;
107   - target.setDate(QDate(current.date().year(), ui->month->value(), ui->day->value()));
108   - target.setTime(QTime(ui->hour->value(), ui->min->value()));
109   -
110   - if (current >= target)
111   - target = target.addYears(1);
  103 + QDateTime target = QDateTime::currentDateTime()
  104 + .addSecs(ui->hour->value() * 3600 + ui->min->value() * 60);
112 105  
113 106 ReservedTimePopup *p = new ReservedTimePopup(parentWidget(), target);
114 107 connect(p, SIGNAL(timeout()), SIGNAL(timeout()));
... ... @@ -127,7 +120,7 @@ void ReserveTimePopup::on_cancelButton_clicked()
127 120  
128 121 void ReserveTimePopup::onEncoderLeft()
129 122 {
130   - if (focusWidget() == ui->month)
  123 + if (focusWidget() == ui->hour)
131 124 ui->cancelButton->setFocus();
132 125 else
133 126 focusPreviousChild();
... ... @@ -137,8 +130,8 @@ void ReserveTimePopup::onEncoderRight()
137 130 {
138 131 if (focusWidget() == ui->cancelButton)
139 132 {
140   - ui->month->setFocus();
141   - ui->month->selectAll();
  133 + ui->hour->setFocus();
  134 + ui->hour->selectAll();
142 135 }
143 136 else
144 137 focusNextChild();
... ...
app/gui/oven_control/reservetimepopup.ui
... ... @@ -119,37 +119,16 @@ QSpinBox{
119 119 </font>
120 120 </property>
121 121 <property name="text">
122   - <string>예약 시간 설정</string>
  122 + <string>예약하기</string>
123 123 </property>
124 124 <property name="alignment">
125 125 <set>Qt::AlignCenter</set>
126 126 </property>
127 127 </widget>
128   - <widget class="QLabel" name="label_4">
129   - <property name="geometry">
130   - <rect>
131   - <x>246</x>
132   - <y>100</y>
133   - <width>44</width>
134   - <height>199</height>
135   - </rect>
136   - </property>
137   - <property name="font">
138   - <font>
139   - <family>나눔고딕</family>
140   - <pointsize>18</pointsize>
141   - <weight>75</weight>
142   - <bold>true</bold>
143   - </font>
144   - </property>
145   - <property name="text">
146   - <string>월</string>
147   - </property>
148   - </widget>
149 128 <widget class="QLabel" name="label_5">
150 129 <property name="geometry">
151 130 <rect>
152   - <x>575</x>
  131 + <x>386</x>
153 132 <y>100</y>
154 133 <width>44</width>
155 134 <height>199</height>
... ... @@ -170,9 +149,9 @@ QSpinBox{
170 149 <widget class="QLabel" name="label_6">
171 150 <property name="geometry">
172 151 <rect>
173   - <x>739</x>
  152 + <x>550</x>
174 153 <y>100</y>
175   - <width>44</width>
  154 + <width>121</width>
176 155 <height>199</height>
177 156 </rect>
178 157 </property>
... ... @@ -185,78 +164,13 @@ QSpinBox{
185 164 </font>
186 165 </property>
187 166 <property name="text">
188   - <string>분</string>
189   - </property>
190   - </widget>
191   - <widget class="FormatterSpinBox" name="month">
192   - <property name="geometry">
193   - <rect>
194   - <x>141</x>
195   - <y>100</y>
196   - <width>90</width>
197   - <height>199</height>
198   - </rect>
199   - </property>
200   - <property name="sizePolicy">
201   - <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
202   - <horstretch>0</horstretch>
203   - <verstretch>0</verstretch>
204   - </sizepolicy>
205   - </property>
206   - <property name="font">
207   - <font>
208   - <family>나눔고딕</family>
209   - <pointsize>18</pointsize>
210   - <underline>true</underline>
211   - </font>
212   - </property>
213   - <property name="focusPolicy">
214   - <enum>Qt::StrongFocus</enum>
215   - </property>
216   - <property name="frame">
217   - <bool>false</bool>
218   - </property>
219   - <property name="alignment">
220   - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
221   - </property>
222   - <property name="buttonSymbols">
223   - <enum>QAbstractSpinBox::NoButtons</enum>
224   - </property>
225   - <property name="minimum">
226   - <number>1</number>
227   - </property>
228   - <property name="maximum">
229   - <number>12</number>
230   - </property>
231   - <property name="value">
232   - <number>12</number>
233   - </property>
234   - </widget>
235   - <widget class="QLabel" name="label_3">
236   - <property name="geometry">
237   - <rect>
238   - <x>410</x>
239   - <y>100</y>
240   - <width>45</width>
241   - <height>199</height>
242   - </rect>
243   - </property>
244   - <property name="font">
245   - <font>
246   - <family>나눔고딕</family>
247   - <pointsize>18</pointsize>
248   - <weight>75</weight>
249   - <bold>true</bold>
250   - </font>
251   - </property>
252   - <property name="text">
253   - <string>일</string>
  167 + <string>분 후</string>
254 168 </property>
255 169 </widget>
256 170 <widget class="FormatterSpinBox" name="min">
257 171 <property name="geometry">
258 172 <rect>
259   - <x>634</x>
  173 + <x>445</x>
260 174 <y>100</y>
261 175 <width>90</width>
262 176 <height>199</height>
... ... @@ -313,54 +227,10 @@ QSpinBox{
313 227 <number>20</number>
314 228 </property>
315 229 </widget>
316   - <widget class="FormatterSpinBox" name="day">
317   - <property name="geometry">
318   - <rect>
319   - <x>305</x>
320   - <y>100</y>
321   - <width>90</width>
322   - <height>199</height>
323   - </rect>
324   - </property>
325   - <property name="sizePolicy">
326   - <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
327   - <horstretch>0</horstretch>
328   - <verstretch>0</verstretch>
329   - </sizepolicy>
330   - </property>
331   - <property name="font">
332   - <font>
333   - <family>나눔고딕</family>
334   - <pointsize>18</pointsize>
335   - <underline>true</underline>
336   - </font>
337   - </property>
338   - <property name="focusPolicy">
339   - <enum>Qt::StrongFocus</enum>
340   - </property>
341   - <property name="frame">
342   - <bool>false</bool>
343   - </property>
344   - <property name="alignment">
345   - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
346   - </property>
347   - <property name="buttonSymbols">
348   - <enum>QAbstractSpinBox::NoButtons</enum>
349   - </property>
350   - <property name="minimum">
351   - <number>1</number>
352   - </property>
353   - <property name="maximum">
354   - <number>31</number>
355   - </property>
356   - <property name="value">
357   - <number>20</number>
358   - </property>
359   - </widget>
360 230 <widget class="FormatterSpinBox" name="hour">
361 231 <property name="geometry">
362 232 <rect>
363   - <x>470</x>
  233 + <x>281</x>
364 234 <y>100</y>
365 235 <width>90</width>
366 236 <height>199</height>
... ... @@ -427,8 +297,6 @@ QSpinBox{
427 297 </customwidget>
428 298 </customwidgets>
429 299 <tabstops>
430   - <tabstop>month</tabstop>
431   - <tabstop>day</tabstop>
432 300 <tabstop>hour</tabstop>
433 301 <tabstop>min</tabstop>
434 302 <tabstop>okButton</tabstop>
... ...