From 2576fd06a148124bdb04652d06214e66ef35b0cb Mon Sep 17 00:00:00 2001
From: victor <taehoon@falinux.com>
Date: Mon, 17 Jul 2017 11:23:23 +0900
Subject: [PATCH] =?UTF-8?q?=EC=88=98=EB=8F=99=20=EC=9A=94=EB=A6=AC=20?=
 =?UTF-8?q?=EC=98=88=EC=95=BD=20=EB=94=94=EC=9E=90=EC=9D=B8/=EB=8F=99?=
 =?UTF-8?q?=EC=9E=91=20=EB=B3=80=EA=B2=BD=20-=20=EC=84=A4=EC=A0=95=20?=
 =?UTF-8?q?=EB=8B=A8=EC=9C=84=EB=A5=BC=20=EC=8B=9C/=EB=B6=84=EC=9C=BC?=
 =?UTF-8?q?=EB=A1=9C=20=ED=95=9C=EC=A0=95=20-=20=EC=84=A4=EC=A0=95=20?=
 =?UTF-8?q?=EC=8B=9C=EA=B0=84=EC=97=90=20=EC=8B=9C=EC=9E=91=ED=95=98?=
 =?UTF-8?q?=EB=8A=94=20=EA=B2=83=EC=9D=B4=20=EC=95=84=EB=8B=8C=20=EC=84=A4?=
 =?UTF-8?q?=EC=A0=95=ED=95=9C=20=EC=8B=9C=EA=B0=84=EB=A7=8C=ED=81=BC=20?=
 =?UTF-8?q?=ED=9D=90=EB=A5=B8=20=EB=92=A4=20=EC=8B=9C=EC=9E=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/gui/oven_control/reservedtimepopup.cpp |   7 ++
 app/gui/oven_control/reservedtimepopup.ui  |  32 +++++--
 app/gui/oven_control/reservetimepopup.cpp  |  21 ++---
 app/gui/oven_control/reservetimepopup.ui   | 146 ++---------------------------
 4 files changed, 46 insertions(+), 160 deletions(-)

diff --git a/app/gui/oven_control/reservedtimepopup.cpp b/app/gui/oven_control/reservedtimepopup.cpp
index 6d42957..816fd63 100644
--- a/app/gui/oven_control/reservedtimepopup.cpp
+++ b/app/gui/oven_control/reservedtimepopup.cpp
@@ -15,6 +15,10 @@ ReservedTimePopup::ReservedTimePopup(QWidget *parent, QDateTime target) :
 
     setAttribute(Qt::WA_DeleteOnClose);
 
+    int remainingTime = QDateTime::currentDateTime().msecsTo(target);
+    ui->remainingTime->setMaximum(remainingTime);
+    ui->remainingTime->setValue(remainingTime);
+
     connect(&checkTimeTimer, SIGNAL(timeout()), SLOT(checkTime()));
     checkTimeTimer.start(100);
 
@@ -63,7 +67,10 @@ void ReservedTimePopup::checkTime()
 {
     qint64 remaining = QDateTime::currentDateTime().msecsTo(target);
     if (remaining > 0)
+    {
         ui->timeLabel->setText(Stringer::remainingTime(remaining));
+        ui->remainingTime->setValue(remaining);
+    }
     else
     {
         emit timeout();
diff --git a/app/gui/oven_control/reservedtimepopup.ui b/app/gui/oven_control/reservedtimepopup.ui
index b553bba..88ac99f 100644
--- a/app/gui/oven_control/reservedtimepopup.ui
+++ b/app/gui/oven_control/reservedtimepopup.ui
@@ -61,7 +61,7 @@ QSpinBox{
      </font>
     </property>
     <property name="text">
-     <string>예약 시간</string>
+     <string>예약하기</string>
     </property>
     <property name="alignment">
      <set>Qt::AlignCenter</set>
@@ -70,16 +70,16 @@ QSpinBox{
    <widget class="QLabel" name="timeLabel">
     <property name="geometry">
      <rect>
-      <x>0</x>
-      <y>100</y>
-      <width>900</width>
-      <height>199</height>
+      <x>70</x>
+      <y>190</y>
+      <width>151</width>
+      <height>58</height>
      </rect>
     </property>
     <property name="font">
      <font>
       <family>나눔고딕</family>
-      <pointsize>18</pointsize>
+      <pointsize>14</pointsize>
       <weight>75</weight>
       <bold>true</bold>
      </font>
@@ -88,7 +88,7 @@ QSpinBox{
      <string>0</string>
     </property>
     <property name="alignment">
-     <set>Qt::AlignCenter</set>
+     <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
     </property>
    </widget>
    <widget class="QPushButton" name="cancelButton">
@@ -120,8 +120,26 @@ QSpinBox{
      <bool>true</bool>
     </property>
    </widget>
+   <widget class="WashStepGauge" name="remainingTime" native="true">
+    <property name="geometry">
+     <rect>
+      <x>250</x>
+      <y>190</y>
+      <width>532</width>
+      <height>58</height>
+     </rect>
+    </property>
+   </widget>
   </widget>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>WashStepGauge</class>
+   <extends>QWidget</extends>
+   <header>washstepgauge.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>
diff --git a/app/gui/oven_control/reservetimepopup.cpp b/app/gui/oven_control/reservetimepopup.cpp
index cfb9e6d..2ebca42 100644
--- a/app/gui/oven_control/reservetimepopup.cpp
+++ b/app/gui/oven_control/reservetimepopup.cpp
@@ -17,10 +17,8 @@ ReserveTimePopup::ReserveTimePopup(QWidget *parent) :
     setAttribute(Qt::WA_DeleteOnClose);
 
     QDateTime dt = QDateTime::currentDateTime();
-    ui->month->setValue(dt.date().month());
-    ui->day->setValue(dt.date().day());
-    ui->hour->setValue(dt.time().hour());
-    ui->min->setValue(dt.time().minute());
+    ui->hour->setValue(1);
+    ui->min->setValue(0);
 
     connect(ui->keyboard, SIGNAL(onOkKeyClicked()), ui->keyboard, SLOT(focusOutKeyboard()));
     connect(ui->keyboard, SIGNAL(onCancelKeyClicked()), ui->keyboard, SLOT(focusOutKeyboard()));
@@ -102,13 +100,8 @@ void ReserveTimePopup::revert()
 
 void ReserveTimePopup::on_okButton_clicked()
 {
-    QDateTime current = QDateTime::currentDateTime();
-    QDateTime target;
-    target.setDate(QDate(current.date().year(), ui->month->value(), ui->day->value()));
-    target.setTime(QTime(ui->hour->value(), ui->min->value()));
-
-    if (current >= target)
-        target = target.addYears(1);
+    QDateTime target = QDateTime::currentDateTime()
+            .addSecs(ui->hour->value() * 3600 + ui->min->value() * 60);
 
     ReservedTimePopup *p = new ReservedTimePopup(parentWidget(), target);
     connect(p, SIGNAL(timeout()), SIGNAL(timeout()));
@@ -127,7 +120,7 @@ void ReserveTimePopup::on_cancelButton_clicked()
 
 void ReserveTimePopup::onEncoderLeft()
 {
-    if (focusWidget() == ui->month)
+    if (focusWidget() == ui->hour)
         ui->cancelButton->setFocus();
     else
         focusPreviousChild();
@@ -137,8 +130,8 @@ void ReserveTimePopup::onEncoderRight()
 {
     if (focusWidget() == ui->cancelButton)
     {
-        ui->month->setFocus();
-        ui->month->selectAll();
+        ui->hour->setFocus();
+        ui->hour->selectAll();
     }
     else
         focusNextChild();
diff --git a/app/gui/oven_control/reservetimepopup.ui b/app/gui/oven_control/reservetimepopup.ui
index 88faa19..1a6695b 100644
--- a/app/gui/oven_control/reservetimepopup.ui
+++ b/app/gui/oven_control/reservetimepopup.ui
@@ -119,37 +119,16 @@ QSpinBox{
      </font>
     </property>
     <property name="text">
-     <string>예약 시간 설정</string>
+     <string>예약하기</string>
     </property>
     <property name="alignment">
      <set>Qt::AlignCenter</set>
     </property>
    </widget>
-   <widget class="QLabel" name="label_4">
-    <property name="geometry">
-     <rect>
-      <x>246</x>
-      <y>100</y>
-      <width>44</width>
-      <height>199</height>
-     </rect>
-    </property>
-    <property name="font">
-     <font>
-      <family>나눔고딕</family>
-      <pointsize>18</pointsize>
-      <weight>75</weight>
-      <bold>true</bold>
-     </font>
-    </property>
-    <property name="text">
-     <string>월</string>
-    </property>
-   </widget>
    <widget class="QLabel" name="label_5">
     <property name="geometry">
      <rect>
-      <x>575</x>
+      <x>386</x>
       <y>100</y>
       <width>44</width>
       <height>199</height>
@@ -170,9 +149,9 @@ QSpinBox{
    <widget class="QLabel" name="label_6">
     <property name="geometry">
      <rect>
-      <x>739</x>
+      <x>550</x>
       <y>100</y>
-      <width>44</width>
+      <width>121</width>
       <height>199</height>
      </rect>
     </property>
@@ -185,78 +164,13 @@ QSpinBox{
      </font>
     </property>
     <property name="text">
-     <string>분</string>
-    </property>
-   </widget>
-   <widget class="FormatterSpinBox" name="month">
-    <property name="geometry">
-     <rect>
-      <x>141</x>
-      <y>100</y>
-      <width>90</width>
-      <height>199</height>
-     </rect>
-    </property>
-    <property name="sizePolicy">
-     <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-      <horstretch>0</horstretch>
-      <verstretch>0</verstretch>
-     </sizepolicy>
-    </property>
-    <property name="font">
-     <font>
-      <family>나눔고딕</family>
-      <pointsize>18</pointsize>
-      <underline>true</underline>
-     </font>
-    </property>
-    <property name="focusPolicy">
-     <enum>Qt::StrongFocus</enum>
-    </property>
-    <property name="frame">
-     <bool>false</bool>
-    </property>
-    <property name="alignment">
-     <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-    </property>
-    <property name="buttonSymbols">
-     <enum>QAbstractSpinBox::NoButtons</enum>
-    </property>
-    <property name="minimum">
-     <number>1</number>
-    </property>
-    <property name="maximum">
-     <number>12</number>
-    </property>
-    <property name="value">
-     <number>12</number>
-    </property>
-   </widget>
-   <widget class="QLabel" name="label_3">
-    <property name="geometry">
-     <rect>
-      <x>410</x>
-      <y>100</y>
-      <width>45</width>
-      <height>199</height>
-     </rect>
-    </property>
-    <property name="font">
-     <font>
-      <family>나눔고딕</family>
-      <pointsize>18</pointsize>
-      <weight>75</weight>
-      <bold>true</bold>
-     </font>
-    </property>
-    <property name="text">
-     <string>일</string>
+     <string>분 후</string>
     </property>
    </widget>
    <widget class="FormatterSpinBox" name="min">
     <property name="geometry">
      <rect>
-      <x>634</x>
+      <x>445</x>
       <y>100</y>
       <width>90</width>
       <height>199</height>
@@ -313,54 +227,10 @@ QSpinBox{
      <number>20</number>
     </property>
    </widget>
-   <widget class="FormatterSpinBox" name="day">
-    <property name="geometry">
-     <rect>
-      <x>305</x>
-      <y>100</y>
-      <width>90</width>
-      <height>199</height>
-     </rect>
-    </property>
-    <property name="sizePolicy">
-     <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-      <horstretch>0</horstretch>
-      <verstretch>0</verstretch>
-     </sizepolicy>
-    </property>
-    <property name="font">
-     <font>
-      <family>나눔고딕</family>
-      <pointsize>18</pointsize>
-      <underline>true</underline>
-     </font>
-    </property>
-    <property name="focusPolicy">
-     <enum>Qt::StrongFocus</enum>
-    </property>
-    <property name="frame">
-     <bool>false</bool>
-    </property>
-    <property name="alignment">
-     <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-    </property>
-    <property name="buttonSymbols">
-     <enum>QAbstractSpinBox::NoButtons</enum>
-    </property>
-    <property name="minimum">
-     <number>1</number>
-    </property>
-    <property name="maximum">
-     <number>31</number>
-    </property>
-    <property name="value">
-     <number>20</number>
-    </property>
-   </widget>
    <widget class="FormatterSpinBox" name="hour">
     <property name="geometry">
      <rect>
-      <x>470</x>
+      <x>281</x>
       <y>100</y>
       <width>90</width>
       <height>199</height>
@@ -427,8 +297,6 @@ QSpinBox{
   </customwidget>
  </customwidgets>
  <tabstops>
-  <tabstop>month</tabstop>
-  <tabstop>day</tabstop>
   <tabstop>hour</tabstop>
   <tabstop>min</tabstop>
   <tabstop>okButton</tabstop>
-- 
2.1.4