From 0e279295fda7fa6d3b3eb7bd3dd8acb686782c6c Mon Sep 17 00:00:00 2001 From: victor Date: Thu, 1 Jun 2017 16:58:09 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EB=8F=99=20=EC=9A=94=EB=A6=AC=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20-=20=EC=9A=94=EB=A6=AC=20=EC=98=88?= =?UTF-8?q?=EC=95=BD=20-=20=EC=9A=94=EB=A6=AC=20=EB=B0=98=EB=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gui/oven_control/manualcookwindow.cpp | 31 +-- app/gui/oven_control/oven_control.pro | 12 +- app/gui/oven_control/reservedtimepopup.cpp | 44 +++ app/gui/oven_control/reservedtimepopup.h | 34 +++ app/gui/oven_control/reservedtimepopup.ui | 130 +++++++++ app/gui/oven_control/reservetimepopup.cpp | 51 ++++ app/gui/oven_control/reservetimepopup.h | 31 +++ app/gui/oven_control/reservetimepopup.ui | 434 +++++++++++++++++++++++++++++ app/gui/oven_control/stringer.cpp | 26 ++ app/gui/oven_control/stringer.h | 5 +- 10 files changed, 773 insertions(+), 25 deletions(-) create mode 100644 app/gui/oven_control/reservedtimepopup.cpp create mode 100644 app/gui/oven_control/reservedtimepopup.h create mode 100644 app/gui/oven_control/reservedtimepopup.ui create mode 100644 app/gui/oven_control/reservetimepopup.cpp create mode 100644 app/gui/oven_control/reservetimepopup.h create mode 100644 app/gui/oven_control/reservetimepopup.ui diff --git a/app/gui/oven_control/manualcookwindow.cpp b/app/gui/oven_control/manualcookwindow.cpp index cf7bb2f..d1c1bde 100644 --- a/app/gui/oven_control/manualcookwindow.cpp +++ b/app/gui/oven_control/manualcookwindow.cpp @@ -14,6 +14,8 @@ #include "stringer.h" #include "config.h" #include "coretempsettingpopup.h" +#include "reservetimepopup.h" +#include "reservedtimepopup.h" #include @@ -505,26 +507,15 @@ void ManualCookWindow::on_cooldownButton_clicked() void ManualCookWindow::on_reserveButton_clicked() { -// if (isReserved) -// { -// isReserved = false; -// ui->reserveButton->setStyleSheet("\ -//QPushButton { background-image: url(:/images/manual_button/reserve.png); }\ -//QPushButton:pressed { background-image: url(:/images/manual_button/reserve_ov.png); }"); -// } -// else -// { -// isReserved = true; -// ui->reserveButton->setStyleSheet("\ -//QPushButton { background-image: url(:/images/manual_button/reserve_ov.png); }\ -//QPushButton:pressed { background-image: url(:/images/manual_button/reserve.png); }"); -// reserved.mode = oven->mode(); -// reserved.humidity = oven->humidity(); -// reserved.temp= oven->temp(); -// reserved.time = oven->time(); -// reserved.coreTempEnabled = oven->interTempEnabled(); -// reserved.coreTemp = oven->interTemp(); -// } + if (oven->time() > 0) + { + startCookingTimer.stop(); + + ReserveTimePopup *p = new ReserveTimePopup(this); + connect(p, SIGNAL(timeout()), SLOT(start())); + connect(p, SIGNAL(canceled()), &startCookingTimer, SLOT(start())); + p->showFullScreen(); + } } void ManualCookWindow::on_favoriteButton_clicked() diff --git a/app/gui/oven_control/oven_control.pro b/app/gui/oven_control/oven_control.pro index 9db4aea..d8764ca 100644 --- a/app/gui/oven_control/oven_control.pro +++ b/app/gui/oven_control/oven_control.pro @@ -113,7 +113,9 @@ SOURCES += main.cpp\ cookprogram.cpp \ programmingautoselectionwindow.cpp \ programmingautoconfigwindow.cpp \ - programmingnamepopup.cpp + programmingnamepopup.cpp \ + reservetimepopup.cpp \ + reservedtimepopup.cpp HEADERS += mainwindow.h \ cook.h \ @@ -216,7 +218,9 @@ HEADERS += mainwindow.h \ cookprogram.h \ programmingautoselectionwindow.h \ programmingautoconfigwindow.h \ - programmingnamepopup.h + programmingnamepopup.h \ + reservetimepopup.h \ + reservedtimepopup.h FORMS += mainwindow.ui \ manualcookwindow.ui \ @@ -286,7 +290,9 @@ FORMS += mainwindow.ui \ programmingmanualcoretemppopup.ui \ programmingautoselectionwindow.ui \ programmingautoconfigwindow.ui \ - programmingnamepopup.ui + programmingnamepopup.ui \ + reservetimepopup.ui \ + reservedtimepopup.ui RESOURCES += \ resources.qrc diff --git a/app/gui/oven_control/reservedtimepopup.cpp b/app/gui/oven_control/reservedtimepopup.cpp new file mode 100644 index 0000000..24135e7 --- /dev/null +++ b/app/gui/oven_control/reservedtimepopup.cpp @@ -0,0 +1,44 @@ +#include "reservedtimepopup.h" +#include "ui_reservedtimepopup.h" + +#include + +#include "stringer.h" + +ReservedTimePopup::ReservedTimePopup(QWidget *parent, QDateTime target) : + QWidget(parent), + ui(new Ui::ReservedTimePopup), + target(target) +{ + ui->setupUi(this); + + setAttribute(Qt::WA_DeleteOnClose); + + connect(&checkTimeTimer, SIGNAL(timeout()), SLOT(checkTime())); + checkTimeTimer.start(100); + + checkTime(); +} + +ReservedTimePopup::~ReservedTimePopup() +{ + delete ui; +} + +void ReservedTimePopup::checkTime() +{ + qint64 remaining = QDateTime::currentDateTime().msecsTo(target); + if (remaining > 0) + ui->timeLabel->setText(Stringer::remainingTime(remaining)); + else + { + emit timeout(); + close(); + } +} + +void ReservedTimePopup::on_cancelButton_clicked() +{ + emit canceled(); + close(); +} diff --git a/app/gui/oven_control/reservedtimepopup.h b/app/gui/oven_control/reservedtimepopup.h new file mode 100644 index 0000000..23cc4b6 --- /dev/null +++ b/app/gui/oven_control/reservedtimepopup.h @@ -0,0 +1,34 @@ +#ifndef RESERVEDTIMEPOPUP_H +#define RESERVEDTIMEPOPUP_H + +#include +#include +#include + +namespace Ui { +class ReservedTimePopup; +} + +class ReservedTimePopup : public QWidget +{ + Q_OBJECT + +public: + explicit ReservedTimePopup(QWidget *parent, QDateTime target); + ~ReservedTimePopup(); + +private: + Ui::ReservedTimePopup *ui; + QDateTime target; + QTimer checkTimeTimer; + +private slots: + void checkTime(); + void on_cancelButton_clicked(); + +signals: + void timeout(); + void canceled(); +}; + +#endif // RESERVEDTIMEPOPUP_H diff --git a/app/gui/oven_control/reservedtimepopup.ui b/app/gui/oven_control/reservedtimepopup.ui new file mode 100644 index 0000000..70d44ab --- /dev/null +++ b/app/gui/oven_control/reservedtimepopup.ui @@ -0,0 +1,130 @@ + + + ReservedTimePopup + + + + 0 + 0 + 900 + 1600 + + + + Form + + + #background { background-image: url(:/images/background/popup/503.png); } +QLabel, QPushButton, QLineEdit { color: white; } +QLineEdit { background : transparent; border: none; } +QPushButton { border: none; } +QPushButton:pressed { color: yellow; } +QSpinBox{ + background-color : transparent; + color : white; +} + + + + + 0 + 426 + 900 + 424 + + + + + + 0 + 95 + 900 + 3 + + + + color: rgb(255, 255, 255); + + + Qt::Horizontal + + + + + + 0 + 0 + 900 + 95 + + + + + 14 + + + + 예약 시간 + + + Qt::AlignCenter + + + + + + 0 + 100 + 900 + 199 + + + + + 나눔고딕 + 18 + 75 + true + + + + 0 + + + Qt::AlignCenter + + + + + + 649 + 321 + 181 + 99 + + + + + 0 + 0 + + + + + 나눔고딕 + 12 + true + + + + 취소 + + + true + + + + + + + diff --git a/app/gui/oven_control/reservetimepopup.cpp b/app/gui/oven_control/reservetimepopup.cpp new file mode 100644 index 0000000..c36720e --- /dev/null +++ b/app/gui/oven_control/reservetimepopup.cpp @@ -0,0 +1,51 @@ +#include "reservetimepopup.h" +#include "ui_reservetimepopup.h" + +#include + +#include "reservedtimepopup.h" + +ReserveTimePopup::ReserveTimePopup(QWidget *parent) : + QWidget(parent), + ui(new Ui::ReserveTimePopup) +{ + ui->setupUi(this); + + 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()); +} + +ReserveTimePopup::~ReserveTimePopup() +{ + delete ui; +} + +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); + + ReservedTimePopup *p = new ReservedTimePopup(parentWidget(), target); + connect(p, SIGNAL(timeout()), SIGNAL(timeout())); + connect(p, SIGNAL(canceled()), SIGNAL(canceled())); + connect(p, SIGNAL(destroyed(QObject*)), SLOT(deleteLater())); + p->showFullScreen(); + + hide(); +} + +void ReserveTimePopup::on_cancelButton_clicked() +{ + emit canceled(); + close(); +} diff --git a/app/gui/oven_control/reservetimepopup.h b/app/gui/oven_control/reservetimepopup.h new file mode 100644 index 0000000..e9be12e --- /dev/null +++ b/app/gui/oven_control/reservetimepopup.h @@ -0,0 +1,31 @@ +#ifndef RESERVETIMEPOPUP_H +#define RESERVETIMEPOPUP_H + +#include + +namespace Ui { +class ReserveTimePopup; +} + +class ReserveTimePopup : public QWidget +{ + Q_OBJECT + +public: + explicit ReserveTimePopup(QWidget *parent = 0); + ~ReserveTimePopup(); + +private slots: + void on_okButton_clicked(); + + void on_cancelButton_clicked(); + +private: + Ui::ReserveTimePopup *ui; + +signals: + void timeout(); + void canceled(); +}; + +#endif // RESERVETIMEPOPUP_H diff --git a/app/gui/oven_control/reservetimepopup.ui b/app/gui/oven_control/reservetimepopup.ui new file mode 100644 index 0000000..0e26ceb --- /dev/null +++ b/app/gui/oven_control/reservetimepopup.ui @@ -0,0 +1,434 @@ + + + ReserveTimePopup + + + + 0 + 0 + 900 + 1600 + + + + Form + + + #background { background-image: url(:/images/background/popup/503.png); } +QLabel, QPushButton, QLineEdit { color: white; } +QLineEdit { background : transparent; border: none; } +QPushButton { border: none; } +QPushButton:pressed { color: yellow; } +QSpinBox{ + background-color : transparent; + color : white; +} + + + + + 0 + 426 + 900 + 1024 + + + + + + 0 + 95 + 900 + 3 + + + + color: rgb(255, 255, 255); + + + Qt::Horizontal + + + + + + 460 + 320 + 371 + 101 + + + + + + + + 0 + 0 + + + + + 나눔고딕 + 12 + true + + + + 확인 + + + true + + + + + + + + 0 + 0 + + + + + 나눔고딕 + 12 + true + + + + 취소 + + + true + + + + + + + + + 0 + 0 + 900 + 95 + + + + + 14 + + + + 예약 시간 설정 + + + Qt::AlignCenter + + + + + + 246 + 100 + 44 + 199 + + + + + 나눔고딕 + 18 + 75 + true + + + + + + + + + + 575 + 100 + 44 + 199 + + + + + 나눔고딕 + 18 + 75 + true + + + + + + + + + + 739 + 100 + 44 + 199 + + + + + 나눔고딕 + 18 + 75 + true + + + + + + + + + + 141 + 100 + 90 + 199 + + + + + 0 + 0 + + + + + 나눔고딕 + 18 + true + + + + Qt::StrongFocus + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + QAbstractSpinBox::NoButtons + + + 1 + + + 12 + + + 12 + + + + + + 410 + 100 + 45 + 199 + + + + + 나눔고딕 + 18 + 75 + true + + + + + + + + + + 634 + 100 + 90 + 199 + + + + + 0 + 0 + + + + + 86 + 0 + + + + + 나눔고딕 + 18 + true + true + + + + false + + + Qt::StrongFocus + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + QAbstractSpinBox::NoButtons + + + + + + + + + 0 + + + 60 + + + 20 + + + + + + 305 + 100 + 90 + 199 + + + + + 0 + 0 + + + + + 나눔고딕 + 18 + true + + + + Qt::StrongFocus + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + QAbstractSpinBox::NoButtons + + + 1 + + + 31 + + + 20 + + + + + + 470 + 100 + 90 + 199 + + + + + 0 + 0 + + + + + 나눔고딕 + 18 + true + + + + Qt::StrongFocus + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + QAbstractSpinBox::NoButtons + + + 0 + + + 23 + + + 20 + + + + + + + 0 + 850 + 900 + 600 + + + + + + + KeyboardWidget + QWidget +
keyboardwidget.h
+ 1 +
+ + FormatterSpinBox + QSpinBox +
formatterspinbox.h
+
+
+ + +
diff --git a/app/gui/oven_control/stringer.cpp b/app/gui/oven_control/stringer.cpp index 1826b1d..ca58764 100644 --- a/app/gui/oven_control/stringer.cpp +++ b/app/gui/oven_control/stringer.cpp @@ -118,6 +118,32 @@ QString Stringer::remainingTime(int msecs, QString style) return QString(); } +QString Stringer::remainingTime(qint64 msecs) +{ + switch (::remainingTime()) + { + case RemainingTime: + msecs /= 1000; + if (msecs >= 3600) + return QString("%1시간 %2분").arg(msecs / 3600).arg((msecs % 3600) / 60, 2, 10, QLatin1Char('0')); + if (msecs >= 60) + return QString("%1분 %2초").arg(msecs / 60).arg(msecs % 60, 2, 10, QLatin1Char('0')); + + return QString("%1초").arg(msecs); + case FinishTime: + QDateTime dateTime = QDateTime::currentDateTime().addMSecs(msecs); + switch (realTimeFormat()) + { + case Hour12: + return dateTime.toString("A hh:mm:ss"); + case Hour24: + return dateTime.toString("HH:mm:ss"); + } + } + + return QString(); +} + QString Stringer::temperature(int celsius) { switch (temperatureFormat()) diff --git a/app/gui/oven_control/stringer.h b/app/gui/oven_control/stringer.h index 1d874cc..ca296ab 100644 --- a/app/gui/oven_control/stringer.h +++ b/app/gui/oven_control/stringer.h @@ -20,8 +20,9 @@ span.light { font-size: 11pt; }\ span.lightest { font-size: 9pt; }\ "); -QString remainingTime(int secs); -QString remainingTime(int secs, QString style); +QString remainingTime(int msecs); +QString remainingTime(int msecs, QString style); +QString remainingTime(qint64 msecs); QString temperature(int celsius); QString temperature(int celsius, QString style); QString temperature(int current, int target); -- 2.1.4