Commit 2f6b5512893218a83eebec9a933e1435223ecb24

Authored by 김태훈
Committed by 고영탁
1 parent e1e70a3b23
Exists in master and in 2 other branches fhd, fhd-demo

다중 요리 구현

Showing 42 changed files with 6866 additions and 91 deletions   Show diff stats
app/gui/oven_control/define.cpp
... ... @@ -528,3 +528,41 @@ QString Define::name(Define::Process type)
528 528 return "";
529 529 }
530 530 }
  531 +
  532 +QString Define::name(Define::CookType type)
  533 +{
  534 + switch (type)
  535 + {
  536 + case Define::Poultry:
  537 + return "poultry";
  538 + case Define::Meat:
  539 + return"meat";
  540 + case Define::Fish:
  541 + return "fish";
  542 + case Define::Desert:
  543 + return "desert";
  544 + case Define::Vegetable:
  545 + return "vegetable";
  546 + case Define::Bread:
  547 + return "bread";
  548 + case Define::Etc:
  549 + return "etc";
  550 + default:
  551 + return "";
  552 + }
  553 +}
  554 +
  555 +QString Define::name(Define::Mode mode)
  556 +{
  557 + switch (mode)
  558 + {
  559 + case Define::SteamMode:
  560 + return "steam";
  561 + case Define::CombiMode:
  562 + return "combi";
  563 + case Define::DryMode:
  564 + return "dry";
  565 + default:
  566 + return "";
  567 + }
  568 +}
... ...
app/gui/oven_control/define.h
... ... @@ -3,10 +3,14 @@
3 3  
4 4 #include <QtCore>
5 5  
6   -#define MAJOR_VER 1
  6 +#define MAJOR_VER 1
7 7 #define MINOR_VER 0
8 8 #define HOTFIX_VER 5
9 9  
  10 +// 0 for normal
  11 +// 1 for premium
  12 +#define MODEL_GRADE 1
  13 +
10 14 namespace Define
11 15 {
12 16 enum CookType
... ... @@ -22,6 +26,7 @@ namespace Define
22 26 };
23 27  
24 28 QString icon(CookType type);
  29 + QString name(CookType type);
25 30  
26 31 enum CookConfigType
27 32 {
... ... @@ -105,6 +110,7 @@ namespace Define
105 110 };
106 111  
107 112 Mode identifyMode(QString mode);
  113 + QString name(Mode mode);
108 114  
109 115 enum Process
110 116 {
... ...
app/gui/oven_control/interruptibletime.cpp
... ... @@ -0,0 +1,61 @@
  1 +#include "interruptibletime.h"
  2 +
  3 +InterruptibleTime::InterruptibleTime(QObject *parent) : QObject(parent)
  4 +{
  5 + elapsed_ = -1;
  6 +}
  7 +
  8 +int InterruptibleTime::elapsed()
  9 +{
  10 + if (isNull())
  11 + return -1;
  12 +
  13 + if (time.isValid())
  14 + return elapsed_ + time.elapsed();
  15 +
  16 + return elapsed_;
  17 +}
  18 +
  19 +bool InterruptibleTime::isValid()
  20 +{
  21 + return elapsed_ != -1;
  22 +}
  23 +
  24 +bool InterruptibleTime::isNull()
  25 +{
  26 + return elapsed_ == -1;
  27 +}
  28 +
  29 +void InterruptibleTime::start()
  30 +{
  31 + elapsed_ = 0;
  32 + time.start();
  33 +}
  34 +
  35 +void InterruptibleTime::pause()
  36 +{
  37 + if (isNull())
  38 + return;
  39 +
  40 + elapsed_ += time.elapsed();
  41 + time = QTime();
  42 +}
  43 +
  44 +void InterruptibleTime::resume()
  45 +{
  46 + if (isNull())
  47 + return;
  48 +
  49 + time.start();
  50 +}
  51 +
  52 +int InterruptibleTime::restart()
  53 +{
  54 + if (isNull())
  55 + return -1;
  56 +
  57 + int t = elapsed();
  58 + elapsed_ = 0;
  59 + time.start();
  60 + return t;
  61 +}
... ...
app/gui/oven_control/interruptibletime.h
... ... @@ -0,0 +1,30 @@
  1 +#ifndef INTERRUPTIBLETIME_H
  2 +#define INTERRUPTIBLETIME_H
  3 +
  4 +#include <QObject>
  5 +#include <QTime>
  6 +
  7 +class InterruptibleTime : public QObject
  8 +{
  9 + Q_OBJECT
  10 +public:
  11 + explicit InterruptibleTime(QObject *parent = 0);
  12 +
  13 + int elapsed();
  14 + bool isValid();
  15 + bool isNull();
  16 +
  17 +signals:
  18 +
  19 +public slots:
  20 + void start();
  21 + void pause();
  22 + void resume();
  23 + int restart();
  24 +
  25 +private:
  26 + QTime time;
  27 + int elapsed_;
  28 +};
  29 +
  30 +#endif // INTERRUPTIBLETIME_H
... ...
app/gui/oven_control/main.cpp
... ... @@ -26,11 +26,11 @@ int main(int argc, char *argv[])
26 26  
27 27 OvenStatistics::getInstance(oven);
28 28  
29   -
30   -
31   -// QTranslator* trans = new QTranslator();
32   -// qDebug() << trans->load(":/lang_en.qm");
33   -// QApplication::installTranslator(trans);
  29 + // Removing etching effect
  30 + QPalette pal = QApplication::palette();
  31 + pal.setColor(QPalette::Disabled, QPalette::Text, QColor(80, 80, 80));
  32 + pal.setColor(QPalette::Disabled, QPalette::Light, QColor(0, 0, 0, 0));
  33 + QApplication::setPalette(pal);
34 34  
35 35 MainWindow w;
36 36 w.showFullScreen();
... ...
app/gui/oven_control/mainwindow.cpp
... ... @@ -13,6 +13,7 @@
13 13 #include "configwindow.h"
14 14 #include "ovenstatics.h"
15 15 #include "notipopupdlg.h"
  16 +#include "multicookwindow.h"
16 17  
17 18 MainWindow *MainWindow::instance = NULL;
18 19  
... ... @@ -22,6 +23,13 @@ MainWindow::MainWindow(QWidget *parent) :
22 23 {
23 24 ui->setupUi(this);
24 25  
  26 +#if MODEL_GRADE > 0
  27 + ui->logo->hide();
  28 +#else
  29 + ui->multiButton->hide();
  30 + ui->programmingButton->hide();
  31 +#endif
  32 +
25 33 instance = this;
26 34 child = NULL;
27 35  
... ... @@ -227,17 +235,22 @@ void MainWindow::on_primeButton_clicked()
227 235  
228 236 void MainWindow::on_multiButton_clicked()
229 237 {
  238 + MultiCookWindow *w = new MultiCookWindow(this);
  239 + w->setWindowModality(Qt::WindowModal);
  240 + w->showFullScreen();
  241 + w->raise();
230 242  
  243 + newChild(w);
231 244 }
232 245  
233 246 void MainWindow::on_programmingButton_clicked()
234 247 {
235   -// ProgrammingWindow *w = new ProgrammingWindow(this);
236   -// w->setWindowModality(Qt::WindowModal);
237   -// w->showFullScreen();
238   -// w->raise();
  248 + ProgrammingWindow *w = new ProgrammingWindow(this);
  249 + w->setWindowModality(Qt::WindowModal);
  250 + w->showFullScreen();
  251 + w->raise();
239 252  
240   -// newChild(w);
  253 + newChild(w);
241 254 }
242 255  
243 256 void MainWindow::on_washButton_clicked()
... ...
app/gui/oven_control/mainwindow.ui
... ... @@ -152,12 +152,12 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/h
152 152 </widget>
153 153 <widget class="QPushButton" name="multiButton">
154 154 <property name="enabled">
155   - <bool>false</bool>
  155 + <bool>true</bool>
156 156 </property>
157 157 <property name="geometry">
158 158 <rect>
159 159 <x>0</x>
160   - <y>1700</y>
  160 + <y>1164</y>
161 161 <width>300</width>
162 162 <height>286</height>
163 163 </rect>
... ... @@ -180,13 +180,10 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_but
180 180 </property>
181 181 </widget>
182 182 <widget class="QPushButton" name="programmingButton">
183   - <property name="enabled">
184   - <bool>false</bool>
185   - </property>
186 183 <property name="geometry">
187 184 <rect>
188 185 <x>300</x>
189   - <y>1700</y>
  186 + <y>1164</y>
190 187 <width>300</width>
191 188 <height>286</height>
192 189 </rect>
... ... @@ -659,7 +656,10 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_typ
659 656 <enum>Qt::Horizontal</enum>
660 657 </property>
661 658 </widget>
662   - <widget class="QLabel" name="label_5">
  659 + <widget class="QLabel" name="logo">
  660 + <property name="enabled">
  661 + <bool>true</bool>
  662 + </property>
663 663 <property name="geometry">
664 664 <rect>
665 665 <x>0</x>
... ... @@ -675,6 +675,30 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_typ
675 675 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
676 676 </property>
677 677 </widget>
  678 + <zorder>logo</zorder>
  679 + <zorder>bottomBar</zorder>
  680 + <zorder>multiButton</zorder>
  681 + <zorder>programmingButton</zorder>
  682 + <zorder>washButton</zorder>
  683 + <zorder>line</zorder>
  684 + <zorder>line_2</zorder>
  685 + <zorder>line_3</zorder>
  686 + <zorder>line_4</zorder>
  687 + <zorder>line_5</zorder>
  688 + <zorder>line_6</zorder>
  689 + <zorder>dryheatButton</zorder>
  690 + <zorder>combiButton</zorder>
  691 + <zorder>steamButton</zorder>
  692 + <zorder>meatButton</zorder>
  693 + <zorder>dessertButton</zorder>
  694 + <zorder>etcButton</zorder>
  695 + <zorder>grainButton</zorder>
  696 + <zorder>poultryButton</zorder>
  697 + <zorder>fishButton</zorder>
  698 + <zorder>breadButton</zorder>
  699 + <zorder>primeButton</zorder>
  700 + <zorder>clockContainer</zorder>
  701 + <zorder>line_7</zorder>
678 702 </widget>
679 703 </widget>
680 704 <layoutdefault spacing="6" margin="11"/>
... ...
app/gui/oven_control/multiautocook.cpp
... ... @@ -0,0 +1,277 @@
  1 +#include "multiautocook.h"
  2 +
  3 +#include "oven.h"
  4 +
  5 +MultiAutoCook::MultiAutoCook(QObject *parent) : MultiCook(parent)
  6 +{
  7 + name_ = "";
  8 + mode_ = Define::InvalidMode;
  9 + state = Idle;
  10 + isModifying = false;
  11 + increasedTimeCount = 6;
  12 + decreasedTimeCount = 6;
  13 +
  14 + checkTimer.setInterval(100);
  15 + connect(&checkTimer, SIGNAL(timeout()), SLOT(check()));
  16 +}
  17 +
  18 +QString MultiAutoCook::name()
  19 +{
  20 + return name_;
  21 +}
  22 +
  23 +Define::Mode MultiAutoCook::mode()
  24 +{
  25 + return mode_;
  26 +}
  27 +
  28 +int MultiAutoCook::temperature()
  29 +{
  30 + if (steps.isEmpty())
  31 + return 30;
  32 +
  33 + return steps.first().temperature;
  34 +}
  35 +
  36 +int MultiAutoCook::humidity()
  37 +{
  38 + if (steps.isEmpty())
  39 + return 0;
  40 +
  41 + return steps.first().humidity;
  42 +}
  43 +
  44 +int MultiAutoCook::remainingTime()
  45 +{
  46 + if (steps.isEmpty())
  47 + return 0;
  48 +
  49 + if (isModifying)
  50 + {
  51 + int t = 0;
  52 + foreach (const Step &s, modifiedSteps)
  53 + t += s.time;
  54 +
  55 + return t;
  56 + }
  57 +
  58 + if (state == Running)
  59 + updateTime();
  60 +
  61 + int t = 0;
  62 + foreach (const Step &s, steps)
  63 + t += s.time;
  64 +
  65 + return t;
  66 +}
  67 +
  68 +void MultiAutoCook::increaseTime()
  69 +{
  70 + if (state == Finished)
  71 + return;
  72 +
  73 + if (!isModifying)
  74 + {
  75 + isModifying = true;
  76 + updateTime();
  77 + modifiedSteps = steps;
  78 + }
  79 +
  80 + modifiedSteps.last().time += 60 * 1000;
  81 +}
  82 +
  83 +void MultiAutoCook::decreaseTime()
  84 +{
  85 + if (state == Finished)
  86 + return;
  87 +
  88 + if (!isModifying)
  89 + {
  90 + isModifying = true;
  91 + updateTime();
  92 + modifiedSteps = steps;
  93 + }
  94 +
  95 + Step &s = modifiedSteps.last();
  96 + s.time = qMax(30 * 1000, s.time - 60 * 1000);
  97 +}
  98 +
  99 +void MultiAutoCook::setTime()
  100 +{
  101 + if (state == Finished)
  102 + return;
  103 +
  104 + if (!isModifying)
  105 + return;
  106 +
  107 + isModifying = false;
  108 + elapsed.start();
  109 + steps = modifiedSteps;
  110 +}
  111 +
  112 +void MultiAutoCook::start()
  113 +{
  114 + state = Running;
  115 + elapsed.start();
  116 + decreasedTime.start();
  117 +
  118 + checkTimer.start();
  119 +}
  120 +
  121 +void MultiAutoCook::stop()
  122 +{
  123 + state = Finished;
  124 + checkTimer.stop();
  125 +}
  126 +
  127 +void MultiAutoCook::pause()
  128 +{
  129 + if (state != Running)
  130 + return;
  131 +
  132 + state = Paused;
  133 + decreasedTime.pause();
  134 + if (increasedTime.isValid())
  135 + increasedTime.pause();
  136 +
  137 + updateTime();
  138 +
  139 + checkTimer.stop();
  140 +}
  141 +
  142 +void MultiAutoCook::resume()
  143 +{
  144 + if (state != Paused)
  145 + return;
  146 +
  147 + state = Running;
  148 + steps.last().time += 30 * 1000;
  149 + elapsed.start();
  150 + decreasedTime.resume();
  151 + if (increasedTime.isValid())
  152 + increasedTime.resume();
  153 +}
  154 +
  155 +MultiCook *MultiAutoCook::clone(QObject *parent)
  156 +{
  157 + MultiAutoCook *c = new MultiAutoCook(parent);
  158 + c->name_ = name_;
  159 + c->mode_ = mode_;
  160 + c->steps = steps;
  161 +
  162 + return (MultiCook *) c;
  163 +}
  164 +
  165 +bool MultiAutoCook::equals(MultiCook *other)
  166 +{
  167 + MultiAutoCook *o = qobject_cast<MultiAutoCook *>(other);
  168 + if (o == Q_NULLPTR)
  169 + return false;
  170 +
  171 + if (o->name_ != name_)
  172 + return false;
  173 +
  174 + if (o->mode_ != mode_)
  175 + return false;
  176 +
  177 + if (o->steps != steps)
  178 + return false;
  179 +
  180 + return true;
  181 +}
  182 +
  183 +void MultiAutoCook::setName(QString name)
  184 +{
  185 + name_ = name;
  186 +}
  187 +
  188 +void MultiAutoCook::setMode(Define::Mode mode)
  189 +{
  190 + mode_ = mode;
  191 +}
  192 +
  193 +void MultiAutoCook::append(int temperature, int humidity, int time)
  194 +{
  195 + if (temperature < 30 || temperature > 300)
  196 + return;
  197 +
  198 + if (humidity < 0 || humidity > 100)
  199 + return;
  200 +
  201 + if (time < 0 || time > 24 * 60 * 60)
  202 + return;
  203 +
  204 + steps.append(Step{temperature, humidity, time * 1000});
  205 +}
  206 +
  207 +void MultiAutoCook::updateTime()
  208 +{
  209 + int e = elapsed.restart();
  210 +
  211 + while (steps.size() > 0)
  212 + {
  213 + Step &s = steps.first();
  214 + if (s.time > e)
  215 + {
  216 + s.time -= e;
  217 + break;
  218 + }
  219 +
  220 + e -= s.time;
  221 + steps.removeFirst();
  222 + }
  223 +}
  224 +
  225 +void MultiAutoCook::check()
  226 +{
  227 + if (state != Running)
  228 + return;
  229 +
  230 + int dt = Oven::getInstance()->currentTemp() - temperature();
  231 +
  232 + // checking under temperature
  233 + if ((remainingTime() < 10 * 60 * 1000 && increasedTime.isNull())
  234 + || (increasedTime.isValid() && increasedTime.elapsed() > 3 * 60 * 1000))
  235 + {
  236 + increasedTime.start();
  237 + if (dt < -20 && increasedTimeCount > 0)
  238 + {
  239 + increasedTimeCount--;
  240 +
  241 + steps.last().time += remainingTime() * 0.1;
  242 + }
  243 + }
  244 +
  245 + // checking over temperature
  246 + if (decreasedTime.elapsed() > 2 * 60 * 1000)
  247 + {
  248 + decreasedTime.start();
  249 + if (dt > 20 && decreasedTimeCount > 0)
  250 + {
  251 + decreasedTimeCount--;
  252 +
  253 + Step &s = steps.last();
  254 + if (s.time > 30 * 1000)
  255 + {
  256 + s.time -= remainingTime() * 0.2;
  257 + if (s.time < 30 * 1000)
  258 + s.time = 30 * 1000;
  259 + }
  260 + }
  261 + }
  262 +
  263 + if (remainingTime() <= 0)
  264 + stop();
  265 +}
  266 +
  267 +bool MultiAutoCook::Step::operator==(const MultiAutoCook::Step &other)
  268 +{
  269 + if (other.temperature != temperature)
  270 + return false;
  271 + if (other.humidity != humidity)
  272 + return false;
  273 + if (other.time != time)
  274 + return false;
  275 +
  276 + return true;
  277 +}
... ...
app/gui/oven_control/multiautocook.h
... ... @@ -0,0 +1,74 @@
  1 +#ifndef MULTIAUTOCOOK_H
  2 +#define MULTIAUTOCOOK_H
  3 +
  4 +#include "multicook.h"
  5 +#include "interruptibletime.h"
  6 +
  7 +class MultiAutoCook : public MultiCook
  8 +{
  9 + Q_OBJECT
  10 +public:
  11 + explicit MultiAutoCook(QObject *parent = 0);
  12 +
  13 + virtual QString name();
  14 + virtual Define::Mode mode();
  15 + virtual int temperature();
  16 + virtual int humidity();
  17 + virtual int remainingTime();
  18 +
  19 + virtual void increaseTime();
  20 + virtual void decreaseTime();
  21 + virtual void setTime();
  22 +
  23 + virtual void start();
  24 + virtual void stop();
  25 + virtual void pause();
  26 + virtual void resume();
  27 +
  28 + virtual MultiCook *clone(QObject *parent);
  29 + virtual bool equals(MultiCook *other);
  30 +
  31 + void setName(QString name);
  32 + void setMode(Define::Mode mode);
  33 + void append(int temperature, int humidity, int time);
  34 +
  35 +signals:
  36 +
  37 +public slots:
  38 +
  39 +private:
  40 + void updateTime();
  41 +
  42 + QString name_;
  43 + Define::Mode mode_;
  44 +
  45 + struct Step {
  46 + int temperature;
  47 + int humidity;
  48 + int time;
  49 +
  50 + bool operator==(const Step &other);
  51 + };
  52 +
  53 + QList<Step> steps;
  54 +
  55 + enum State {
  56 + Idle, Running, Paused, Finished
  57 + } state;
  58 +
  59 + QTime elapsed;
  60 + int decreasedTimeCount;
  61 + int increasedTimeCount;
  62 + InterruptibleTime decreasedTime;
  63 + InterruptibleTime increasedTime;
  64 +
  65 + QTimer checkTimer;
  66 +
  67 + bool isModifying;
  68 + QList<Step> modifiedSteps;
  69 +
  70 +private slots:
  71 + void check();
  72 +};
  73 +
  74 +#endif // MULTIAUTOCOOK_H
... ...
app/gui/oven_control/multicook.cpp
... ... @@ -0,0 +1,7 @@
  1 +#include "multicook.h"
  2 +
  3 +#include <QDebug>
  4 +
  5 +MultiCook::MultiCook(QObject *parent) : QObject(parent)
  6 +{
  7 +}
... ...
app/gui/oven_control/multicook.h
... ... @@ -0,0 +1,34 @@
  1 +#ifndef MULTICOOK_H
  2 +#define MULTICOOK_H
  3 +
  4 +#include <QObject>
  5 +#include <QTime>
  6 +
  7 +#include "define.h"
  8 +
  9 +class MultiCook : public QObject
  10 +{
  11 + Q_OBJECT
  12 +public:
  13 + explicit MultiCook(QObject *parent = 0);
  14 +
  15 + virtual QString name() = 0;
  16 + virtual Define::Mode mode() = 0;
  17 + virtual int temperature() = 0;
  18 + virtual int humidity() = 0;
  19 + virtual int remainingTime() = 0;
  20 +
  21 + virtual void increaseTime() = 0;
  22 + virtual void decreaseTime() = 0;
  23 + virtual void setTime() = 0;
  24 +
  25 + virtual void start() = 0;
  26 + virtual void stop() = 0;
  27 + virtual void pause() = 0;
  28 + virtual void resume() = 0;
  29 +
  30 + virtual MultiCook *clone(QObject *parent = 0) = 0;
  31 + virtual bool equals(MultiCook *other) = 0;
  32 +};
  33 +
  34 +#endif // MULTICOOK_H
... ...
app/gui/oven_control/multicookautowindow.cpp
... ... @@ -0,0 +1,162 @@
  1 +#include "multicookautowindow.h"
  2 +#include "ui_multicookautowindow.h"
  3 +
  4 +#include <QKeyEvent>
  5 +
  6 +#include "soundplayer.h"
  7 +#include "confirmpopup.h"
  8 +
  9 +MultiCookAutoWindow::MultiCookAutoWindow(QWidget *parent) :
  10 + QMainWindow(parent),
  11 + ui(new Ui::MultiCookAutoWindow)
  12 +{
  13 + ui->setupUi(this);
  14 +
  15 + ui->clockContainer->setParent(ui->upperStack);
  16 + setAttribute(Qt::WA_DeleteOnClose);
  17 +
  18 + book = Q_NULLPTR;
  19 +
  20 + setFocus();
  21 +}
  22 +
  23 +MultiCookAutoWindow::~MultiCookAutoWindow()
  24 +{
  25 + delete ui;
  26 +}
  27 +
  28 +void MultiCookAutoWindow::setType(Define::CookType type)
  29 +{
  30 + ui->cookTypeIcon->setPixmap(Define::icon(type));
  31 +}
  32 +
  33 +void MultiCookAutoWindow::setBook(MultiCookBook *book)
  34 +{
  35 + this->book = book;
  36 +
  37 + QSignalMapper *sm = new QSignalMapper(this);
  38 + connect(sm, SIGNAL(mapped(int)), SLOT(select(int)));
  39 +
  40 + QFont font = this->font();
  41 + font.setPointSize(10);
  42 + font.setBold(true);
  43 + font.setWeight(75);
  44 +
  45 + QLatin1String stylesheet("QPushButton {\n"
  46 + "border-image: url(:/images/button/288.png);\n"
  47 + "}\n"
  48 + "QPushButton::pressed, QPushButton:focus {\n"
  49 + "border-image: url(:/images/button/288_ov.png);\n"
  50 + "}");
  51 +
  52 + QList<QString> list = book->names();
  53 +
  54 + QWidget *last = this;
  55 + for (int idx = 0; idx < list.size(); idx++)
  56 + {
  57 + int x = 12 + (idx % 3) * 294;
  58 + int y = 615 + (idx / 3) * 80;
  59 +
  60 + QPushButton *pb = new QPushButton(this);
  61 + pb->setGeometry(QRect(x, y, 288, 70));
  62 + pb->setFont(font);
  63 + pb->setStyleSheet(stylesheet);
  64 + pb->setText(list.at(idx));
  65 +
  66 + sm->setMapping(pb, idx);
  67 + connect(pb, SIGNAL(clicked()), sm, SLOT(map()));
  68 +
  69 + setTabOrder(last, pb);
  70 +
  71 + last = pb;
  72 + }
  73 +
  74 + setTabOrder(last, ui->backButton);
  75 + setTabOrder(ui->backButton, ui->helpButton);
  76 +
  77 + foreach (QPushButton *button, findChildren<QPushButton *>())
  78 + connect(button, &QPushButton::pressed, SoundPlayer::playClick);
  79 +}
  80 +
  81 +void MultiCookAutoWindow::keyPressEvent(QKeyEvent *event)
  82 +{
  83 + switch (event->key())
  84 + {
  85 + case 0x01000032: // Turn left
  86 + onEncoderLeft();
  87 + break;
  88 + case 0x01000031: // Push
  89 + pushed = focusWidget();
  90 + break;
  91 + case 0x01000030: // Turn right
  92 + onEncoderRight();
  93 + break;
  94 + }
  95 +}
  96 +
  97 +void MultiCookAutoWindow::keyReleaseEvent(QKeyEvent *event)
  98 +{
  99 + switch (event->key())
  100 + {
  101 + case 0x01000032: // Turn left
  102 + onEncoderLeft();
  103 + break;
  104 + case 0x01000031: // Push
  105 + if (focusWidget() == pushed)
  106 + onEncoderClicked(pushed);
  107 +
  108 + pushed = NULL;
  109 + break;
  110 + case 0x01000030: // Turn right
  111 + onEncoderRight();
  112 + break;
  113 + }
  114 +}
  115 +
  116 +void MultiCookAutoWindow::onEncoderLeft()
  117 +{
  118 + focusPreviousChild();
  119 +}
  120 +
  121 +void MultiCookAutoWindow::onEncoderRight()
  122 +{
  123 + focusNextChild();
  124 +}
  125 +
  126 +void MultiCookAutoWindow::onEncoderClicked(QWidget *clicked)
  127 +{
  128 + QPushButton *b = qobject_cast<QPushButton *>(clicked);
  129 + if (b)
  130 + b->click();
  131 +}
  132 +
  133 +void MultiCookAutoWindow::select(int idx)
  134 +{
  135 + selectedIndex = idx;
  136 +
  137 + setFocus();
  138 +
  139 + ConfirmPopup *p = new ConfirmPopup(this, tr("다중 요리 목록에 추가하시겠습니까?"));
  140 + p->showFullScreen();
  141 +
  142 + connect(p, SIGNAL(accepted()), SLOT(confirm()));
  143 +}
  144 +
  145 +void MultiCookAutoWindow::confirm()
  146 +{
  147 + MultiAutoCook *cook = book->cook(selectedIndex);
  148 + if (cook == Q_NULLPTR)
  149 + return;
  150 +
  151 + emit selected(cook);
  152 +}
  153 +
  154 +void MultiCookAutoWindow::on_backButton_clicked()
  155 +{
  156 + close();
  157 +}
  158 +
  159 +void MultiCookAutoWindow::on_helpButton_clicked()
  160 +{
  161 +
  162 +}
... ...
app/gui/oven_control/multicookautowindow.h
... ... @@ -0,0 +1,50 @@
  1 +#ifndef MULTICOOKAUTOWINDOW_H
  2 +#define MULTICOOKAUTOWINDOW_H
  3 +
  4 +#include <QMainWindow>
  5 +
  6 +#include "multicookbook.h"
  7 +
  8 +namespace Ui {
  9 +class MultiCookAutoWindow;
  10 +}
  11 +
  12 +class MultiCookAutoWindow : public QMainWindow
  13 +{
  14 + Q_OBJECT
  15 +
  16 +public:
  17 + explicit MultiCookAutoWindow(QWidget *parent = 0);
  18 + ~MultiCookAutoWindow();
  19 +
  20 + void setType(Define::CookType type);
  21 + void setBook(MultiCookBook *book);
  22 +
  23 +signals:
  24 + void selected(MultiCook *);
  25 +
  26 +protected:
  27 + void keyPressEvent(QKeyEvent *event);
  28 + void keyReleaseEvent(QKeyEvent *event);
  29 +
  30 +private:
  31 + Ui::MultiCookAutoWindow *ui;
  32 +
  33 + MultiCookBook *book;
  34 + int selectedIndex;
  35 +
  36 + QWidget *pushed = NULL;
  37 +
  38 + void onEncoderLeft();
  39 + void onEncoderRight();
  40 + void onEncoderClicked(QWidget *clicked);
  41 +
  42 +private slots:
  43 + void select(int idx);
  44 + void confirm();
  45 +
  46 + void on_backButton_clicked();
  47 + void on_helpButton_clicked();
  48 +};
  49 +
  50 +#endif // MULTICOOKAUTOWINDOW_H
... ...
app/gui/oven_control/multicookautowindow.ui
... ... @@ -0,0 +1,194 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<ui version="4.0">
  3 + <class>MultiCookAutoWindow</class>
  4 + <widget class="QMainWindow" name="MultiCookAutoWindow">
  5 + <property name="geometry">
  6 + <rect>
  7 + <x>0</x>
  8 + <y>0</y>
  9 + <width>900</width>
  10 + <height>1600</height>
  11 + </rect>
  12 + </property>
  13 + <property name="styleSheet">
  14 + <string notr="true">#centralwidget { background-image: url(:/images/background/auto.png); }
  15 +#bottomBar { background-image: url(:/images/bottom_bar/background.png); }</string>
  16 + </property>
  17 + <widget class="QWidget" name="centralwidget">
  18 + <widget class="QStackedWidget" name="upperStack">
  19 + <property name="geometry">
  20 + <rect>
  21 + <x>0</x>
  22 + <y>0</y>
  23 + <width>900</width>
  24 + <height>426</height>
  25 + </rect>
  26 + </property>
  27 + <widget class="QWidget" name="clockContainer">
  28 + <property name="styleSheet">
  29 + <string notr="true">#clockContainer { background-image: url(:/images/clock/background.png); }</string>
  30 + </property>
  31 + <widget class="Clock" name="clock" native="true">
  32 + <property name="geometry">
  33 + <rect>
  34 + <x>272</x>
  35 + <y>36</y>
  36 + <width>356</width>
  37 + <height>355</height>
  38 + </rect>
  39 + </property>
  40 + </widget>
  41 + <widget class="WashWarnIcon" name="label">
  42 + <property name="geometry">
  43 + <rect>
  44 + <x>800</x>
  45 + <y>320</y>
  46 + <width>80</width>
  47 + <height>84</height>
  48 + </rect>
  49 + </property>
  50 + </widget>
  51 + <widget class="DemoIcon" name="label_2">
  52 + <property name="geometry">
  53 + <rect>
  54 + <x>780</x>
  55 + <y>230</y>
  56 + <width>101</width>
  57 + <height>90</height>
  58 + </rect>
  59 + </property>
  60 + </widget>
  61 + <widget class="HalfEnergyIcon" name="label_3">
  62 + <property name="geometry">
  63 + <rect>
  64 + <x>780</x>
  65 + <y>160</y>
  66 + <width>108</width>
  67 + <height>67</height>
  68 + </rect>
  69 + </property>
  70 + </widget>
  71 + <widget class="DigitalClock" name="label_4">
  72 + <property name="geometry">
  73 + <rect>
  74 + <x>20</x>
  75 + <y>310</y>
  76 + <width>600</width>
  77 + <height>100</height>
  78 + </rect>
  79 + </property>
  80 + <property name="alignment">
  81 + <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
  82 + </property>
  83 + </widget>
  84 + </widget>
  85 + <widget class="QWidget" name="page_2"/>
  86 + </widget>
  87 + <widget class="QLabel" name="cookTypeIcon">
  88 + <property name="geometry">
  89 + <rect>
  90 + <x>0</x>
  91 + <y>430</y>
  92 + <width>900</width>
  93 + <height>150</height>
  94 + </rect>
  95 + </property>
  96 + <property name="text">
  97 + <string/>
  98 + </property>
  99 + <property name="pixmap">
  100 + <pixmap>:/images/images/auto/005_auto_icon_01_ov.png</pixmap>
  101 + </property>
  102 + <property name="alignment">
  103 + <set>Qt::AlignCenter</set>
  104 + </property>
  105 + </widget>
  106 + <widget class="QWidget" name="bottomBar" native="true">
  107 + <property name="geometry">
  108 + <rect>
  109 + <x>0</x>
  110 + <y>1450</y>
  111 + <width>900</width>
  112 + <height>150</height>
  113 + </rect>
  114 + </property>
  115 + <widget class="QPushButton" name="backButton">
  116 + <property name="geometry">
  117 + <rect>
  118 + <x>345</x>
  119 + <y>26</y>
  120 + <width>97</width>
  121 + <height>97</height>
  122 + </rect>
  123 + </property>
  124 + <property name="sizePolicy">
  125 + <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
  126 + <horstretch>0</horstretch>
  127 + <verstretch>0</verstretch>
  128 + </sizepolicy>
  129 + </property>
  130 + <property name="styleSheet">
  131 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/back.png); }
  132 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/back_ov.png); }</string>
  133 + </property>
  134 + <property name="text">
  135 + <string/>
  136 + </property>
  137 + </widget>
  138 + <widget class="QPushButton" name="helpButton">
  139 + <property name="geometry">
  140 + <rect>
  141 + <x>458</x>
  142 + <y>26</y>
  143 + <width>97</width>
  144 + <height>97</height>
  145 + </rect>
  146 + </property>
  147 + <property name="sizePolicy">
  148 + <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
  149 + <horstretch>0</horstretch>
  150 + <verstretch>0</verstretch>
  151 + </sizepolicy>
  152 + </property>
  153 + <property name="styleSheet">
  154 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/help.png); }
  155 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/help_ov.png); }</string>
  156 + </property>
  157 + <property name="text">
  158 + <string/>
  159 + </property>
  160 + </widget>
  161 + </widget>
  162 + </widget>
  163 + </widget>
  164 + <customwidgets>
  165 + <customwidget>
  166 + <class>Clock</class>
  167 + <extends>QWidget</extends>
  168 + <header>clock.h</header>
  169 + <container>1</container>
  170 + </customwidget>
  171 + <customwidget>
  172 + <class>WashWarnIcon</class>
  173 + <extends>QLabel</extends>
  174 + <header>washwarnicon.h</header>
  175 + </customwidget>
  176 + <customwidget>
  177 + <class>DemoIcon</class>
  178 + <extends>QLabel</extends>
  179 + <header>demoicon.h</header>
  180 + </customwidget>
  181 + <customwidget>
  182 + <class>HalfEnergyIcon</class>
  183 + <extends>QLabel</extends>
  184 + <header>halfenergyicon.h</header>
  185 + </customwidget>
  186 + <customwidget>
  187 + <class>DigitalClock</class>
  188 + <extends>QLabel</extends>
  189 + <header>digitalclock.h</header>
  190 + </customwidget>
  191 + </customwidgets>
  192 + <resources/>
  193 + <connections/>
  194 +</ui>
... ...
app/gui/oven_control/multicookbook.cpp
... ... @@ -0,0 +1,171 @@
  1 +#include "multicookbook.h"
  2 +
  3 +namespace
  4 +{
  5 +
  6 +void showError(QString message)
  7 +{
  8 +
  9 +}
  10 +
  11 +}
  12 +
  13 +MultiCookBook::MultiCookBook(QObject *parent) : QObject(parent)
  14 +{
  15 + mode = Define::InvalidMode;
  16 + type = Define::InvalidCookType;
  17 +}
  18 +
  19 +void MultiCookBook::setMode(Define::Mode mode)
  20 +{
  21 + this->mode = mode;
  22 +
  23 + loadTypes();
  24 +}
  25 +
  26 +void MultiCookBook::setType(Define::CookType type)
  27 +{
  28 + this->type = type;
  29 +
  30 + loadCooks();
  31 + book = CookBook(type);
  32 +}
  33 +
  34 +bool MultiCookBook::checkType(Define::CookType type)
  35 +{
  36 + return availables.contains(type);
  37 +}
  38 +
  39 +QList<QString> MultiCookBook::names()
  40 +{
  41 + QList<QString> list;
  42 + foreach (QString root, roots)
  43 + list.append(book.name(root));
  44 +
  45 + return list;
  46 +}
  47 +
  48 +MultiAutoCook *MultiCookBook::cook(int index)
  49 +{
  50 + QString type = Define::name(this->type);
  51 + if (type.isEmpty())
  52 + {
  53 + showError("Invalid cook type");
  54 + return Q_NULLPTR;
  55 + }
  56 +
  57 + QString root = QString("/prime/cookbook/%1/%2").arg(type).arg(roots.at(index));
  58 + QString name = book.name(root);
  59 +
  60 + Cook cook(this->type, root, name);
  61 + cook.load();
  62 +
  63 + if (!cook.isLoaded())
  64 + {
  65 + showError("Invalid cook data");
  66 + return Q_NULLPTR;
  67 + }
  68 +
  69 + MultiAutoCook *c = new MultiAutoCook;
  70 + c->setName(name);
  71 + c->setMode(mode);
  72 +
  73 + foreach (CookStep s, cook.steps)
  74 + c->append(s.temp, s.humidity, s.time);
  75 +
  76 + return c;
  77 +}
  78 +
  79 +void MultiCookBook::loadTypes()
  80 +{
  81 + QString mode = Define::name(this->mode);
  82 + if (mode.isEmpty())
  83 + {
  84 + showError("Invalid cook mode");
  85 + return;
  86 + }
  87 +
  88 + QString filename = QString("/prime/multi/types.%1").arg(mode);
  89 +
  90 + QFile file(filename);
  91 + if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
  92 + {
  93 + showError("File not found: " + filename);
  94 + return;
  95 + }
  96 +
  97 + availables.clear();
  98 +
  99 + int lineCount = 0;
  100 + while (!file.atEnd())
  101 + {
  102 + lineCount++;
  103 +
  104 + QString line = QString::fromUtf8(file.readLine().trimmed());
  105 + if (line.isEmpty())
  106 + continue;
  107 +
  108 + Define::CookType type;
  109 + if (line == "poultry")
  110 + type = Define::Poultry;
  111 + else if (line == "meat")
  112 + type = Define::Meat;
  113 + else if (line == "fish")
  114 + type = Define::Fish;
  115 + else if (line == "desert")
  116 + type = Define::Desert;
  117 + else if (line == "vegetable")
  118 + type = Define::Vegetable;
  119 + else if (line == "bread")
  120 + type = Define::Bread;
  121 + else if (line == "etc")
  122 + type = Define::Etc;
  123 + else
  124 + {
  125 + showError("Invalid cook type");
  126 + return;
  127 + }
  128 +
  129 + availables.append(type);
  130 + }
  131 +}
  132 +
  133 +void MultiCookBook::loadCooks()
  134 +{
  135 + QString type = Define::name(this->type);
  136 + if (type.isEmpty())
  137 + {
  138 + showError("Invalid cook type");
  139 + return;
  140 + }
  141 +
  142 + QString mode = Define::name(this->mode);
  143 + if (mode.isEmpty())
  144 + {
  145 + showError("Invalid cook mode");
  146 + return;
  147 + }
  148 +
  149 + QString filename = QString("/prime/multi/%1.%2").arg(type).arg(mode);
  150 +
  151 + QFile file(filename);
  152 + if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
  153 + {
  154 + showError("File not found: " + filename);
  155 + return;
  156 + }
  157 +
  158 + roots.clear();
  159 +
  160 + int lineCount = 0;
  161 + while (!file.atEnd())
  162 + {
  163 + lineCount++;
  164 +
  165 + QString line = QString::fromUtf8(file.readLine().trimmed());
  166 + if (line.isEmpty())
  167 + continue;
  168 +
  169 + roots.append(line);
  170 + }
  171 +}
... ...
app/gui/oven_control/multicookbook.h
... ... @@ -0,0 +1,38 @@
  1 +#ifndef MULTICOOKBOOK_H
  2 +#define MULTICOOKBOOK_H
  3 +
  4 +#include <QObject>
  5 +
  6 +#include "define.h"
  7 +#include "multiautocook.h"
  8 +#include "cookbook.h"
  9 +
  10 +class MultiCookBook : public QObject
  11 +{
  12 + Q_OBJECT
  13 +public:
  14 + explicit MultiCookBook(QObject *parent = 0);
  15 +
  16 + void setMode(Define::Mode mode);
  17 + void setType(Define::CookType type);
  18 +
  19 + bool checkType(Define::CookType type);
  20 + QList<QString> names();
  21 + MultiAutoCook *cook(int index);
  22 +
  23 +signals:
  24 +
  25 +public slots:
  26 +
  27 +private:
  28 + Define::Mode mode;
  29 + Define::CookType type;
  30 + CookBook book;
  31 + QList<Define::CookType> availables;
  32 + QList<QString> roots;
  33 +
  34 + void loadTypes();
  35 + void loadCooks();
  36 +};
  37 +
  38 +#endif // MULTICOOKBOOK_H
... ...
app/gui/oven_control/multicookcontainer.cpp
... ... @@ -0,0 +1,175 @@
  1 +#include "multicookcontainer.h"
  2 +
  3 +MultiCookContainer::MultiCookContainer(QObject *parent) : QObject(parent)
  4 +{
  5 + for (int i = 0; i < 10; i++)
  6 + list.append(Q_NULLPTR);
  7 +
  8 + isEmpty_ = true;
  9 + state = Idle;
  10 +}
  11 +
  12 +void MultiCookContainer::add(int slot, MultiCook *cook)
  13 +{
  14 + list.replace(slot, cook);
  15 + if (isEmpty_)
  16 + {
  17 + mode_ = cook->mode();
  18 + isEmpty_ = false;
  19 + }
  20 +
  21 + switch (state)
  22 + {
  23 + case Idle:
  24 + // Do nothing
  25 + break;
  26 + case Running:
  27 + cook->start();
  28 + break;
  29 + case Paused:
  30 + cook->start();
  31 + cook->pause();
  32 + break;
  33 + }
  34 +}
  35 +
  36 +void MultiCookContainer::remove(int slot)
  37 +{
  38 + MultiCook *cook = list.at(slot);
  39 + if (cook == Q_NULLPTR)
  40 + return;
  41 +
  42 + cook->stop();
  43 +
  44 + list.replace(slot, Q_NULLPTR);
  45 +
  46 + isEmpty_ = true;
  47 + foreach (MultiCook *c, list)
  48 + if (c != Q_NULLPTR)
  49 + {
  50 + isEmpty_ = false;
  51 + break;
  52 + }
  53 +
  54 + if (isEmpty_)
  55 + {
  56 + mode_ = Define::InvalidMode;
  57 + state = Idle;
  58 + }
  59 +}
  60 +
  61 +MultiCook *MultiCookContainer::at(int slot)
  62 +{
  63 + return list.at(slot);
  64 +}
  65 +
  66 +bool MultiCookContainer::isEmpty()
  67 +{
  68 + return isEmpty_;
  69 +}
  70 +
  71 +bool MultiCookContainer::isFinished()
  72 +{
  73 + foreach (MultiCook *c, list)
  74 + if (c != Q_NULLPTR && c->remainingTime() > 0)
  75 + return false;
  76 +
  77 + return true;
  78 +}
  79 +
  80 +Define::Mode MultiCookContainer::mode()
  81 +{
  82 + return mode_;
  83 +}
  84 +
  85 +int MultiCookContainer::temperature()
  86 +{
  87 + int count = 0;
  88 + int temp = 0;
  89 + foreach (MultiCook *c, list)
  90 + if (c != Q_NULLPTR && c->remainingTime() > 0)
  91 + {
  92 + temp += c->temperature();
  93 + count++;
  94 + }
  95 +
  96 + if (count == 0)
  97 + return -1;
  98 +
  99 + return temp / count;
  100 +}
  101 +
  102 +int MultiCookContainer::humidity()
  103 +{
  104 + int count = 0;
  105 + int hum = 0;
  106 + foreach (MultiCook *c, list)
  107 + if (c != Q_NULLPTR && c->remainingTime() > 0)
  108 + {
  109 + hum += c->humidity();
  110 + count++;
  111 + }
  112 +
  113 + if (count == 0)
  114 + return -1;
  115 +
  116 + return hum / count;
  117 +}
  118 +
  119 +int MultiCookContainer::remainingTime()
  120 +{
  121 + int max = 0;
  122 + foreach (MultiCook *c, list)
  123 + if (c != Q_NULLPTR)
  124 + max = qMax(max, c->remainingTime());
  125 +
  126 + return max;
  127 +}
  128 +
  129 +void MultiCookContainer::start()
  130 +{
  131 + if (isEmpty_ || state != Idle)
  132 + return;
  133 +
  134 + state = Running;
  135 +
  136 + foreach (MultiCook *c, list)
  137 + if (c != Q_NULLPTR)
  138 + c->start();
  139 +}
  140 +
  141 +void MultiCookContainer::stop()
  142 +{
  143 + if (isEmpty_ || state != Running)
  144 + return;
  145 +
  146 + state = Idle;
  147 +
  148 + foreach (MultiCook *c, list)
  149 + if (c != Q_NULLPTR)
  150 + c->stop();
  151 +}
  152 +
  153 +void MultiCookContainer::pause()
  154 +{
  155 + if (isEmpty_ || state != Running)
  156 + return;
  157 +
  158 + state = Paused;
  159 +
  160 + foreach (MultiCook *c, list)
  161 + if (c != Q_NULLPTR)
  162 + c->pause();
  163 +}
  164 +
  165 +void MultiCookContainer::resume()
  166 +{
  167 + if (isEmpty_ || state != Paused)
  168 + return;
  169 +
  170 + state = Running;
  171 +
  172 + foreach (MultiCook *c, list)
  173 + if (c != Q_NULLPTR)
  174 + c->resume();
  175 +}
... ...
app/gui/oven_control/multicookcontainer.h
... ... @@ -0,0 +1,45 @@
  1 +#ifndef MULTICOOKCONTAINER_H
  2 +#define MULTICOOKCONTAINER_H
  3 +
  4 +#include <QObject>
  5 +
  6 +#include "multicook.h"
  7 +
  8 +class MultiCookContainer : public QObject
  9 +{
  10 + Q_OBJECT
  11 +public:
  12 + explicit MultiCookContainer(QObject *parent = 0);
  13 +
  14 + void add(int slot, MultiCook *cook);
  15 + void remove(int slot);
  16 +
  17 + MultiCook *at(int slot);
  18 + bool isEmpty();
  19 + bool isFinished();
  20 +
  21 + Define::Mode mode();
  22 + int temperature();
  23 + int humidity();
  24 + int remainingTime();
  25 +
  26 + void start();
  27 + void stop();
  28 + void pause();
  29 + void resume();
  30 +
  31 +signals:
  32 +
  33 +public slots:
  34 +
  35 +private:
  36 + QList<MultiCook *> list;
  37 + bool isEmpty_;
  38 + Define::Mode mode_;
  39 +
  40 + enum State {
  41 + Idle, Running, Paused
  42 + } state;
  43 +};
  44 +
  45 +#endif // MULTICOOKCONTAINER_H
... ...
app/gui/oven_control/multicookcontroller.cpp
... ... @@ -0,0 +1,202 @@
  1 +#include "multicookcontroller.h"
  2 +
  3 +#include "oven.h"
  4 +
  5 +MultiCookController::MultiCookController(QObject *parent) : QObject(parent)
  6 +{
  7 + state = Idle;
  8 +
  9 + connect(&checkTimer, SIGNAL(timeout()), SLOT(check()));
  10 +}
  11 +
  12 +void MultiCookController::setContainer(MultiCookContainer *container)
  13 +{
  14 + this->container = container;
  15 + checkTimer.start(100);
  16 +}
  17 +
  18 +bool MultiCookController::requireOpen()
  19 +{
  20 + if (state == OpenDoor || state == Finished)
  21 + return true;
  22 +
  23 + if (state != Running)
  24 + return false;
  25 +
  26 + for (int i = 0; i < 10; i++)
  27 + {
  28 + MultiCook *cook = container->at(i);
  29 + if (cook != Q_NULLPTR && cook->remainingTime() <= 0)
  30 + return true;
  31 + }
  32 +
  33 + return false;
  34 +}
  35 +
  36 +bool MultiCookController::requireClose()
  37 +{
  38 + if (state == Idle || state == OpenDoor)
  39 + return false;
  40 +
  41 + return true;
  42 +}
  43 +
  44 +void MultiCookController::check()
  45 +{
  46 + switch (state)
  47 + {
  48 + case Idle:
  49 + if (!container->isEmpty())
  50 + state = Preheating;
  51 + break;
  52 + case Preheating:
  53 + checkPreheating();
  54 + break;
  55 + case OpenDoor:
  56 + if (Oven::getInstance()->door())
  57 + state = CloseDoor;
  58 + break;
  59 + case CloseDoor:
  60 + if (!Oven::getInstance()->door())
  61 + {
  62 + state = Running;
  63 + container->start();
  64 + }
  65 + break;
  66 + case Running:
  67 + checkRunning();
  68 + break;
  69 + case Paused:
  70 + checkPaused();
  71 + break;
  72 + case Finished:
  73 + checkFinished();
  74 + break;
  75 + }
  76 +}
  77 +
  78 +void MultiCookController::checkPreheating()
  79 +{
  80 + Oven *oven = Oven::getInstance();
  81 + if (container->isEmpty())
  82 + {
  83 + state = Idle;
  84 + oven->stop();
  85 + return;
  86 + }
  87 +
  88 + int temp = container->temperature();
  89 + if (temp <= oven->currentTemp())
  90 + {
  91 + state = OpenDoor;
  92 + oven->stop();
  93 + return;
  94 + }
  95 +
  96 + if (temp != oven->temp())
  97 + oven->setTemp(temp);
  98 +
  99 + int hum = container->humidity();
  100 + if (hum != oven->humidity())
  101 + oven->setHumidity(hum);
  102 +
  103 + if (!oven->preheating())
  104 + oven->startPreheating();
  105 +}
  106 +
  107 +void MultiCookController::checkRunning()
  108 +{
  109 + Oven *oven = Oven::getInstance();
  110 + if (container->isEmpty())
  111 + {
  112 + state = Idle;
  113 + oven->stop();
  114 + return;
  115 + }
  116 +
  117 + if (container->isFinished())
  118 + {
  119 + state = Finished;
  120 + oven->stop();
  121 + container->stop();
  122 + return;
  123 + }
  124 +
  125 + if (oven->door())
  126 + {
  127 + state = Paused;
  128 + oven->stopCooking();
  129 + container->pause();
  130 + return;
  131 + }
  132 +
  133 +// Define::Mode mode = container->mode();
  134 +// switch (mode)
  135 +// {
  136 +// case Define::Invalid:
  137 +// // Do nothing
  138 +// break;
  139 +// case Define::SteamMode:
  140 +// case Define::CombiMode:
  141 +// case Define::DryMode:
  142 +// oven->setMode(mode);
  143 +// break;
  144 +// }
  145 +
  146 +// int temp = container->temperature();
  147 +// if (temp != oven->temp())
  148 +// oven->setTemp(temp);
  149 +
  150 +// int hum = container->humidity();
  151 +// if (hum != oven->humidity())
  152 +// oven->setHumidity(hum);
  153 +
  154 + oven->setMode(container->mode());
  155 + oven->setTemp(container->temperature());
  156 + oven->setHumidity(container->humidity());
  157 +
  158 + if (!oven->cooking())
  159 + {
  160 + oven->setTime(12 * 60 * 60);
  161 + oven->startCooking();
  162 + }
  163 +}
  164 +
  165 +void MultiCookController::checkPaused()
  166 +{
  167 + Oven *oven = Oven::getInstance();
  168 + if (oven->door())
  169 + return;
  170 +
  171 + for (int i = 0; i < 10; i++)
  172 + {
  173 + MultiCook *cook = container->at(i);
  174 + if (cook != Q_NULLPTR && cook->remainingTime() <= 0)
  175 + {
  176 + container->remove(i);
  177 + cook->deleteLater();
  178 + }
  179 + }
  180 +
  181 + state = Running;
  182 + container->resume();
  183 +}
  184 +
  185 +void MultiCookController::checkFinished()
  186 +{
  187 + Oven *oven = Oven::getInstance();
  188 + if (oven->door())
  189 + {
  190 + state = Idle;
  191 +
  192 + for (int i = 0; i < 10; i++)
  193 + {
  194 + MultiCook *cook = container->at(i);
  195 + if (cook != Q_NULLPTR)
  196 + {
  197 + container->remove(i);
  198 + cook->deleteLater();
  199 + }
  200 + }
  201 + }
  202 +}
... ...
app/gui/oven_control/multicookcontroller.h
... ... @@ -0,0 +1,41 @@
  1 +#ifndef MULTICOOKCONTROLLER_H
  2 +#define MULTICOOKCONTROLLER_H
  3 +
  4 +#include <QObject>
  5 +#include <QTimer>
  6 +
  7 +#include "multicookcontainer.h"
  8 +
  9 +class MultiCookController : public QObject
  10 +{
  11 + Q_OBJECT
  12 +public:
  13 + explicit MultiCookController(QObject *parent = 0);
  14 +
  15 + void setContainer(MultiCookContainer *container);
  16 + bool requireOpen();
  17 + bool requireClose();
  18 +
  19 +signals:
  20 +
  21 +public slots:
  22 +
  23 +private:
  24 + MultiCookContainer *container;
  25 + QTimer checkTimer;
  26 +
  27 + enum State {
  28 + Idle, Preheating, OpenDoor, CloseDoor, Running, Paused, Finished
  29 + } state;
  30 +
  31 +private slots:
  32 + void check();
  33 +
  34 + void checkPreheating();
  35 + void checkRunning();
  36 + void checkPaused();
  37 + void checkFinished();
  38 +
  39 +};
  40 +
  41 +#endif // MULTICOOKCONTROLLER_H
... ...
app/gui/oven_control/multicookmanualwindow.cpp
... ... @@ -0,0 +1,282 @@
  1 +#include "multicookmanualwindow.h"
  2 +#include "ui_multicookmanualwindow.h"
  3 +
  4 +#include <QKeyEvent>
  5 +
  6 +#include "stringer.h"
  7 +#include "multimanualcook.h"
  8 +#include "mainwindow.h"
  9 +#include "configwindow.h"
  10 +#include "soundplayer.h"
  11 +
  12 +MultiCookManualWindow::MultiCookManualWindow(QWidget *parent) :
  13 + QMainWindow(parent),
  14 + ui(new Ui::MultiCookManualWindow)
  15 +{
  16 + ui->setupUi(this);
  17 +
  18 + ui->clockContainer->setParent(ui->upperStack);
  19 + setAttribute(Qt::WA_DeleteOnClose);
  20 +
  21 + ui->humiditySlider->setSubPixmap(":/images/slider/humidity.png");
  22 + ui->humiditySlider->setRange(0, 100);
  23 + ui->humiditySlider->bigTickInterval = 50;
  24 + ui->humiditySlider->tickInterval = 10;
  25 +
  26 + ui->tempSlider->setSubPixmap(":/images/slider/temp.png");
  27 + ui->tempSlider->bigTickInterval = 50;
  28 + ui->tempSlider->tickInterval = 10;
  29 +
  30 + ui->timeSlider->setSubPixmap(":/images/slider/time.png");
  31 + ui->timeSlider->setRange(0, 342);
  32 + ui->timeSlider->bigTicks.append(0);
  33 + ui->timeSlider->bigTicks.append(180);
  34 + ui->timeSlider->bigTicks.append(270);
  35 + ui->timeSlider->bigTicks.append(342);
  36 + ui->timeSlider->ticks.append(60);
  37 + ui->timeSlider->ticks.append(120);
  38 + ui->timeSlider->ticks.append(180 + 30);
  39 + ui->timeSlider->ticks.append(180 + 60);
  40 + ui->timeSlider->ticks.append(270 + 4 * 6);
  41 + ui->timeSlider->ticks.append(270 + 4 * 12);
  42 +
  43 + connect(ui->humiditySlider, SIGNAL(sliderMoved(int)), SLOT(updateView()));
  44 + connect(ui->tempSlider, SIGNAL(sliderMoved(int)), SLOT(updateView()));
  45 + connect(ui->timeSlider, SIGNAL(sliderMoved(int)), SLOT(updateView()));
  46 +
  47 + connect(ui->humiditySlider, SIGNAL(sliderPressed()), SLOT(updateView()));
  48 + connect(ui->tempSlider, SIGNAL(sliderPressed()), SLOT(updateView()));
  49 + connect(ui->timeSlider, SIGNAL(sliderPressed()), SLOT(updateView()));
  50 +
  51 + foreach (QPushButton *button, findChildren<QPushButton *>())
  52 + connect(button, &QPushButton::pressed, SoundPlayer::playClick);
  53 +
  54 + setFocus();
  55 +
  56 + afterThreeSecsTimer.setSingleShot(true);
  57 + afterThreeSecsTimer.setInterval(3000);
  58 + connect(&afterThreeSecsTimer, SIGNAL(timeout()), SLOT(afterThreeSecs()));
  59 +
  60 + foreach (QWidget *w, findChildren<QWidget *>())
  61 + w->installEventFilter(this);
  62 +
  63 + installEventFilter(this);
  64 +
  65 + pushed = NULL;
  66 +}
  67 +
  68 +MultiCookManualWindow::~MultiCookManualWindow()
  69 +{
  70 + delete ui;
  71 +}
  72 +
  73 +void MultiCookManualWindow::setMode(Define::Mode mode)
  74 +{
  75 + switch (mode)
  76 + {
  77 + case Define::SteamMode:
  78 + ui->steamButton->setChecked(true);
  79 + ui->combiButton->setChecked(false);
  80 + ui->dryheatButton->setChecked(false);
  81 + ui->humidityButton->setEnabled(false);
  82 + ui->humiditySlider->setEnabled(false);
  83 + ui->humiditySlider->setValue(100);
  84 + ui->tempSlider->setRange(30, 130);
  85 + ui->tempSlider->setValue(100);
  86 + ui->timeSlider->setValue(0);
  87 + updateView();
  88 + this->mode = mode;
  89 + break;
  90 + case Define::CombiMode:
  91 + ui->steamButton->setChecked(false);
  92 + ui->combiButton->setChecked(true);
  93 + ui->dryheatButton->setChecked(false);
  94 + ui->humidityButton->setEnabled(true);
  95 + ui->humiditySlider->setEnabled(true);
  96 + ui->humiditySlider->setValue(50);
  97 + ui->tempSlider->setRange(30, 300);
  98 + ui->tempSlider->setValue(100);
  99 + ui->timeSlider->setValue(0);
  100 + updateView();
  101 + this->mode = mode;
  102 + break;
  103 + case Define::DryMode:
  104 + ui->steamButton->setChecked(false);
  105 + ui->combiButton->setChecked(false);
  106 + ui->dryheatButton->setChecked(true);
  107 + ui->humidityButton->setEnabled(false);
  108 + ui->humiditySlider->setEnabled(false);
  109 + ui->humiditySlider->setValue(0);
  110 + ui->tempSlider->setRange(30, 300);
  111 + ui->tempSlider->setValue(160);
  112 + ui->timeSlider->setValue(0);
  113 + updateView();
  114 + this->mode = mode;
  115 + break;
  116 + default:
  117 + return;
  118 + }
  119 +}
  120 +
  121 +bool MultiCookManualWindow::eventFilter(QObject */*watched*/, QEvent *event)
  122 +{
  123 + switch (event->type())
  124 + {
  125 + case QEvent::KeyPress:
  126 + case QEvent::KeyRelease:
  127 + case QEvent::MouseButtonPress:
  128 + case QEvent::MouseButtonRelease:
  129 + case QEvent::MouseMove:
  130 + afterThreeSecsTimer.start();
  131 + break;
  132 + default:
  133 + break;
  134 + }
  135 +
  136 + return false;
  137 +}
  138 +
  139 +void MultiCookManualWindow::keyPressEvent(QKeyEvent *event)
  140 +{
  141 + switch (event->key())
  142 + {
  143 + case 0x01000032: // Turn left
  144 + onEncoderLeft();
  145 + break;
  146 + case 0x01000031: // Push
  147 + pushed = focusWidget();
  148 + break;
  149 + case 0x01000030: // Turn right
  150 + onEncoderRight();
  151 + break;
  152 + }
  153 +}
  154 +
  155 +void MultiCookManualWindow::keyReleaseEvent(QKeyEvent *event)
  156 +{
  157 + switch (event->key())
  158 + {
  159 + case 0x01000032: // Turn left
  160 + onEncoderLeft();
  161 + break;
  162 + case 0x01000031: // Push
  163 + if (focusWidget() == pushed)
  164 + onEncoderClicked(pushed);
  165 +
  166 + pushed = NULL;
  167 + break;
  168 + case 0x01000030: // Turn right
  169 + onEncoderRight();
  170 + break;
  171 + }
  172 +}
  173 +
  174 +int MultiCookManualWindow::sliderToTime(int value)
  175 +{
  176 + if (value <= 180)
  177 + return value * 60;
  178 + if (value <= 270)
  179 + return 180 * 60 + (value - 180) * 2 * 60;
  180 + return 360 * 60 + (value - 270) * 15 * 60;
  181 +}
  182 +
  183 +void MultiCookManualWindow::onEncoderLeft()
  184 +{
  185 + focusPreviousChild();
  186 +}
  187 +
  188 +void MultiCookManualWindow::onEncoderRight()
  189 +{
  190 + focusNextChild();
  191 +}
  192 +
  193 +void MultiCookManualWindow::onEncoderClicked(QWidget *clicked)
  194 +{
  195 + if (clicked == NULL)
  196 + return;
  197 +
  198 + QPushButton *b = qobject_cast<QPushButton *>(clicked);
  199 + if (b)
  200 + b->click();
  201 +
  202 + Slider *slider = qobject_cast<Slider *>(clicked);
  203 + if (slider)
  204 + {
  205 + if (slider == ui->humiditySlider)
  206 + ui->humidityButton->setFocus();
  207 + else if (slider == ui->tempSlider)
  208 + ui->tempButton->setFocus();
  209 + else if (slider == ui->timeSlider)
  210 + ui->timeButton->setFocus();
  211 +
  212 + updateView();
  213 + }
  214 +}
  215 +
  216 +void MultiCookManualWindow::updateView()
  217 +{
  218 + ui->humidityLabel->setText(QString("%1%").arg(ui->humiditySlider->sliderPosition()));
  219 + ui->tempLabel->setText(Stringer::temperature(ui->tempSlider->sliderPosition(), Stringer::fontSize14));
  220 + ui->timeLabel->setText(Stringer::remainingTime(sliderToTime(ui->timeSlider->sliderPosition()) * 1000, Stringer::fontSize14));
  221 +
  222 + QWidget *focused = focusWidget();
  223 + ui->humidityButton->setChecked(focused == ui->humiditySlider);
  224 + ui->tempButton->setChecked(focused == ui->tempSlider);
  225 + ui->timeButton->setChecked(focused == ui->timeSlider);
  226 +}
  227 +
  228 +void MultiCookManualWindow::afterThreeSecs()
  229 +{
  230 + Slider *slider = qobject_cast<Slider *>(focusWidget());
  231 + if (slider)
  232 + {
  233 + if (slider == ui->humiditySlider)
  234 + ui->humidityButton->setFocus();
  235 + else if (slider == ui->tempSlider)
  236 + ui->tempButton->setFocus();
  237 + else if (slider == ui->timeSlider)
  238 + ui->timeButton->setFocus();
  239 +
  240 + updateView();
  241 + }
  242 +}
  243 +
  244 +void MultiCookManualWindow::on_humidityButton_clicked()
  245 +{
  246 + ui->humiditySlider->setFocus();
  247 + updateView();
  248 +}
  249 +
  250 +void MultiCookManualWindow::on_tempButton_clicked()
  251 +{
  252 + ui->tempSlider->setFocus();
  253 + updateView();
  254 +}
  255 +
  256 +void MultiCookManualWindow::on_timeButton_clicked()
  257 +{
  258 + ui->timeSlider->setFocus();
  259 + updateView();
  260 +}
  261 +
  262 +void MultiCookManualWindow::on_backButton_clicked()
  263 +{
  264 + close();
  265 +}
  266 +
  267 +void MultiCookManualWindow::on_helpButton_clicked()
  268 +{
  269 +
  270 +}
  271 +
  272 +void MultiCookManualWindow::on_okButton_clicked()
  273 +{
  274 + MultiManualCook *c = new MultiManualCook;
  275 + c->setMode(mode);
  276 + c->setHumidity(ui->humiditySlider->value());
  277 + c->setTemperature(ui->tempSlider->value());
  278 + c->setTime(sliderToTime(ui->timeSlider->value()));
  279 +
  280 + emit selected(c);
  281 + close();
  282 +}
... ...
app/gui/oven_control/multicookmanualwindow.h
... ... @@ -0,0 +1,59 @@
  1 +#ifndef MULTICOOKMANUALWINDOW_H
  2 +#define MULTICOOKMANUALWINDOW_H
  3 +
  4 +#include <QMainWindow>
  5 +
  6 +#include "multicook.h"
  7 +
  8 +namespace Ui {
  9 +class MultiCookManualWindow;
  10 +}
  11 +
  12 +class MultiCookManualWindow : public QMainWindow
  13 +{
  14 + Q_OBJECT
  15 +
  16 +public:
  17 + explicit MultiCookManualWindow(QWidget *parent = 0);
  18 + ~MultiCookManualWindow();
  19 +
  20 + void setMode(Define::Mode mode);
  21 +
  22 + bool eventFilter(QObject *watched, QEvent *event);
  23 +
  24 +protected:
  25 + void keyPressEvent(QKeyEvent *event);
  26 + void keyReleaseEvent(QKeyEvent *event);
  27 +
  28 +signals:
  29 + void selected(MultiCook*);
  30 +
  31 +private:
  32 + Ui::MultiCookManualWindow *ui;
  33 +
  34 + Define::Mode mode;
  35 +
  36 + int sliderToTime(int value);
  37 +
  38 + QTimer afterThreeSecsTimer;
  39 + QWidget *pushed = NULL;
  40 +
  41 + void onEncoderLeft();
  42 + void onEncoderRight();
  43 + void onEncoderClicked(QWidget *clicked);
  44 +
  45 +private slots:
  46 + void updateView();
  47 + void afterThreeSecs();
  48 +
  49 + void on_humidityButton_clicked();
  50 + void on_tempButton_clicked();
  51 + void on_timeButton_clicked();
  52 +
  53 + void on_backButton_clicked();
  54 + void on_helpButton_clicked();
  55 + void on_okButton_clicked();
  56 +
  57 +};
  58 +
  59 +#endif // MULTICOOKMANUALWINDOW_H
... ...
app/gui/oven_control/multicookmanualwindow.ui
... ... @@ -0,0 +1,902 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<ui version="4.0">
  3 + <class>MultiCookManualWindow</class>
  4 + <widget class="QMainWindow" name="MultiCookManualWindow">
  5 + <property name="geometry">
  6 + <rect>
  7 + <x>0</x>
  8 + <y>0</y>
  9 + <width>900</width>
  10 + <height>1600</height>
  11 + </rect>
  12 + </property>
  13 + <property name="styleSheet">
  14 + <string notr="true">#bottomBar { background-image: url(:/images/bottom_bar/background.png); }
  15 +#centralwidget { background-image: url(:/images/background/manual.png); }
  16 +
  17 +QPushButton {
  18 +background-repeat: no-repeat;
  19 +background-position: center;
  20 +border: none;
  21 +}
  22 +
  23 +QPushButton[style=&quot;mode&quot;] {
  24 +background-clip: border;
  25 +background-origin: border;
  26 +margin-bottom: 50px;
  27 +
  28 +border-top: 200px;
  29 +border-bottom: -50px;
  30 +border-style: hidden;
  31 +color: #7B7B7B;
  32 +font-size: 40px;
  33 +}
  34 +
  35 +QPushButton[style=&quot;mode&quot;]:checked {
  36 +color: white;
  37 +image: url(:/images/cook_mode/indicator.png);
  38 +image-position: bottom;
  39 +}
  40 +
  41 +QPushButton[style=&quot;icon&quot;] {
  42 +background-image: url(:/images/slider_icon/background.png);
  43 +}
  44 +
  45 +QSlider::groove {
  46 +background-image: url(:/images/slider/groove_ticks.png);
  47 +background-repeat: no-repeat;
  48 +}
  49 +
  50 +QSlider::sub-page {
  51 +background-repeat: no-repeat;
  52 +margin: 5px;
  53 +}
  54 +
  55 +QSlider::handle {
  56 +background-image: url(:/images/slider/handle_big.png);
  57 +background-repeat: no-repeat;
  58 +width: 23px;
  59 +height: 33px;
  60 +}</string>
  61 + </property>
  62 + <widget class="QWidget" name="centralwidget">
  63 + <widget class="QPushButton" name="dryheatButton">
  64 + <property name="enabled">
  65 + <bool>false</bool>
  66 + </property>
  67 + <property name="geometry">
  68 + <rect>
  69 + <x>600</x>
  70 + <y>426</y>
  71 + <width>300</width>
  72 + <height>293</height>
  73 + </rect>
  74 + </property>
  75 + <property name="styleSheet">
  76 + <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_dryheat_hide.png); }
  77 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_dryheat_ov.png); }
  78 +QPushButton:checked { background-image: url(:/images/cook_mode/big_dryheat.png); }</string>
  79 + </property>
  80 + <property name="text">
  81 + <string>건열</string>
  82 + </property>
  83 + <property name="checkable">
  84 + <bool>true</bool>
  85 + </property>
  86 + <property name="style" stdset="0">
  87 + <string notr="true">mode</string>
  88 + </property>
  89 + </widget>
  90 + <widget class="QPushButton" name="timeButton">
  91 + <property name="geometry">
  92 + <rect>
  93 + <x>27</x>
  94 + <y>1025</y>
  95 + <width>140</width>
  96 + <height>140</height>
  97 + </rect>
  98 + </property>
  99 + <property name="styleSheet">
  100 + <string notr="true">QPushButton { image: url(:/images/slider_icon/time.png); }
  101 +QPushButton:pressed,
  102 +QPushButton:focus { image: url(:/images/slider_icon/011_icon_03_active.png); }
  103 +QPushButton:checked { image: url(:/images/slider_icon/time_ov.png); }</string>
  104 + </property>
  105 + <property name="checkable">
  106 + <bool>true</bool>
  107 + </property>
  108 + <property name="style" stdset="0">
  109 + <string notr="true">icon</string>
  110 + </property>
  111 + </widget>
  112 + <widget class="QLabel" name="humidityLabel">
  113 + <property name="enabled">
  114 + <bool>true</bool>
  115 + </property>
  116 + <property name="geometry">
  117 + <rect>
  118 + <x>690</x>
  119 + <y>810</y>
  120 + <width>150</width>
  121 + <height>51</height>
  122 + </rect>
  123 + </property>
  124 + <property name="palette">
  125 + <palette>
  126 + <active>
  127 + <colorrole role="WindowText">
  128 + <brush brushstyle="SolidPattern">
  129 + <color alpha="255">
  130 + <red>255</red>
  131 + <green>255</green>
  132 + <blue>255</blue>
  133 + </color>
  134 + </brush>
  135 + </colorrole>
  136 + </active>
  137 + <inactive>
  138 + <colorrole role="WindowText">
  139 + <brush brushstyle="SolidPattern">
  140 + <color alpha="255">
  141 + <red>255</red>
  142 + <green>255</green>
  143 + <blue>255</blue>
  144 + </color>
  145 + </brush>
  146 + </colorrole>
  147 + </inactive>
  148 + <disabled>
  149 + <colorrole role="WindowText">
  150 + <brush brushstyle="SolidPattern">
  151 + <color alpha="255">
  152 + <red>123</red>
  153 + <green>123</green>
  154 + <blue>123</blue>
  155 + </color>
  156 + </brush>
  157 + </colorrole>
  158 + </disabled>
  159 + </palette>
  160 + </property>
  161 + <property name="font">
  162 + <font>
  163 + <family>Roboto</family>
  164 + <pointsize>16</pointsize>
  165 + <weight>75</weight>
  166 + <bold>true</bold>
  167 + </font>
  168 + </property>
  169 + <property name="text">
  170 + <string>0%</string>
  171 + </property>
  172 + <property name="alignment">
  173 + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
  174 + </property>
  175 + </widget>
  176 + <widget class="QLabel" name="steamLabel_2">
  177 + <property name="enabled">
  178 + <bool>true</bool>
  179 + </property>
  180 + <property name="geometry">
  181 + <rect>
  182 + <x>160</x>
  183 + <y>740</y>
  184 + <width>91</width>
  185 + <height>51</height>
  186 + </rect>
  187 + </property>
  188 + <property name="palette">
  189 + <palette>
  190 + <active>
  191 + <colorrole role="WindowText">
  192 + <brush brushstyle="SolidPattern">
  193 + <color alpha="255">
  194 + <red>255</red>
  195 + <green>255</green>
  196 + <blue>255</blue>
  197 + </color>
  198 + </brush>
  199 + </colorrole>
  200 + </active>
  201 + <inactive>
  202 + <colorrole role="WindowText">
  203 + <brush brushstyle="SolidPattern">
  204 + <color alpha="255">
  205 + <red>255</red>
  206 + <green>255</green>
  207 + <blue>255</blue>
  208 + </color>
  209 + </brush>
  210 + </colorrole>
  211 + </inactive>
  212 + <disabled>
  213 + <colorrole role="WindowText">
  214 + <brush brushstyle="SolidPattern">
  215 + <color alpha="255">
  216 + <red>123</red>
  217 + <green>123</green>
  218 + <blue>123</blue>
  219 + </color>
  220 + </brush>
  221 + </colorrole>
  222 + </disabled>
  223 + </palette>
  224 + </property>
  225 + <property name="font">
  226 + <font>
  227 + <family>Malgun Gothic</family>
  228 + <pointsize>9</pointsize>
  229 + </font>
  230 + </property>
  231 + <property name="text">
  232 + <string>감소</string>
  233 + </property>
  234 + <property name="alignment">
  235 + <set>Qt::AlignCenter</set>
  236 + </property>
  237 + </widget>
  238 + <widget class="QLabel" name="steamLabel_3">
  239 + <property name="enabled">
  240 + <bool>true</bool>
  241 + </property>
  242 + <property name="geometry">
  243 + <rect>
  244 + <x>780</x>
  245 + <y>740</y>
  246 + <width>91</width>
  247 + <height>51</height>
  248 + </rect>
  249 + </property>
  250 + <property name="palette">
  251 + <palette>
  252 + <active>
  253 + <colorrole role="WindowText">
  254 + <brush brushstyle="SolidPattern">
  255 + <color alpha="255">
  256 + <red>255</red>
  257 + <green>255</green>
  258 + <blue>255</blue>
  259 + </color>
  260 + </brush>
  261 + </colorrole>
  262 + </active>
  263 + <inactive>
  264 + <colorrole role="WindowText">
  265 + <brush brushstyle="SolidPattern">
  266 + <color alpha="255">
  267 + <red>255</red>
  268 + <green>255</green>
  269 + <blue>255</blue>
  270 + </color>
  271 + </brush>
  272 + </colorrole>
  273 + </inactive>
  274 + <disabled>
  275 + <colorrole role="WindowText">
  276 + <brush brushstyle="SolidPattern">
  277 + <color alpha="255">
  278 + <red>123</red>
  279 + <green>123</green>
  280 + <blue>123</blue>
  281 + </color>
  282 + </brush>
  283 + </colorrole>
  284 + </disabled>
  285 + </palette>
  286 + </property>
  287 + <property name="font">
  288 + <font>
  289 + <family>Malgun Gothic</family>
  290 + <pointsize>9</pointsize>
  291 + </font>
  292 + </property>
  293 + <property name="text">
  294 + <string>증가</string>
  295 + </property>
  296 + <property name="alignment">
  297 + <set>Qt::AlignCenter</set>
  298 + </property>
  299 + </widget>
  300 + <widget class="QPushButton" name="humidityButton">
  301 + <property name="geometry">
  302 + <rect>
  303 + <x>27</x>
  304 + <y>725</y>
  305 + <width>140</width>
  306 + <height>140</height>
  307 + </rect>
  308 + </property>
  309 + <property name="styleSheet">
  310 + <string notr="true">QPushButton { image: url(:/images/slider_icon/humidity.png); }
  311 +QPushButton:pressed,
  312 +QPushButton:focus { image: url(:/images/slider_icon/011_icon_01_active.png); }
  313 +QPushButton:checked { image: url(:/images/slider_icon/humidity_ov.png); }</string>
  314 + </property>
  315 + <property name="checkable">
  316 + <bool>true</bool>
  317 + </property>
  318 + <property name="style" stdset="0">
  319 + <string notr="true">icon</string>
  320 + </property>
  321 + </widget>
  322 + <widget class="QLabel" name="steamLabel_4">
  323 + <property name="enabled">
  324 + <bool>true</bool>
  325 + </property>
  326 + <property name="geometry">
  327 + <rect>
  328 + <x>160</x>
  329 + <y>890</y>
  330 + <width>91</width>
  331 + <height>51</height>
  332 + </rect>
  333 + </property>
  334 + <property name="palette">
  335 + <palette>
  336 + <active>
  337 + <colorrole role="WindowText">
  338 + <brush brushstyle="SolidPattern">
  339 + <color alpha="255">
  340 + <red>255</red>
  341 + <green>255</green>
  342 + <blue>255</blue>
  343 + </color>
  344 + </brush>
  345 + </colorrole>
  346 + </active>
  347 + <inactive>
  348 + <colorrole role="WindowText">
  349 + <brush brushstyle="SolidPattern">
  350 + <color alpha="255">
  351 + <red>255</red>
  352 + <green>255</green>
  353 + <blue>255</blue>
  354 + </color>
  355 + </brush>
  356 + </colorrole>
  357 + </inactive>
  358 + <disabled>
  359 + <colorrole role="WindowText">
  360 + <brush brushstyle="SolidPattern">
  361 + <color alpha="255">
  362 + <red>123</red>
  363 + <green>123</green>
  364 + <blue>123</blue>
  365 + </color>
  366 + </brush>
  367 + </colorrole>
  368 + </disabled>
  369 + </palette>
  370 + </property>
  371 + <property name="font">
  372 + <font>
  373 + <family>Malgun Gothic</family>
  374 + <pointsize>9</pointsize>
  375 + </font>
  376 + </property>
  377 + <property name="text">
  378 + <string>감소</string>
  379 + </property>
  380 + <property name="alignment">
  381 + <set>Qt::AlignCenter</set>
  382 + </property>
  383 + </widget>
  384 + <widget class="QWidget" name="bottomBar" native="true">
  385 + <property name="geometry">
  386 + <rect>
  387 + <x>0</x>
  388 + <y>1450</y>
  389 + <width>900</width>
  390 + <height>150</height>
  391 + </rect>
  392 + </property>
  393 + <widget class="QPushButton" name="backButton">
  394 + <property name="geometry">
  395 + <rect>
  396 + <x>288</x>
  397 + <y>26</y>
  398 + <width>97</width>
  399 + <height>97</height>
  400 + </rect>
  401 + </property>
  402 + <property name="styleSheet">
  403 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/back.png); }
  404 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/back_ov.png); }</string>
  405 + </property>
  406 + <property name="text">
  407 + <string/>
  408 + </property>
  409 + </widget>
  410 + <widget class="QPushButton" name="okButton">
  411 + <property name="geometry">
  412 + <rect>
  413 + <x>514</x>
  414 + <y>26</y>
  415 + <width>97</width>
  416 + <height>97</height>
  417 + </rect>
  418 + </property>
  419 + <property name="styleSheet">
  420 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/006_sys_icon_16.png); }
  421 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/006_sys_icon_16_ov.png); }</string>
  422 + </property>
  423 + <property name="text">
  424 + <string/>
  425 + </property>
  426 + </widget>
  427 + <widget class="QPushButton" name="helpButton">
  428 + <property name="geometry">
  429 + <rect>
  430 + <x>401</x>
  431 + <y>26</y>
  432 + <width>97</width>
  433 + <height>97</height>
  434 + </rect>
  435 + </property>
  436 + <property name="styleSheet">
  437 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/help.png); }
  438 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/help_ov.png); }</string>
  439 + </property>
  440 + <property name="text">
  441 + <string/>
  442 + </property>
  443 + </widget>
  444 + </widget>
  445 + <widget class="QLabel" name="timeLabel">
  446 + <property name="enabled">
  447 + <bool>true</bool>
  448 + </property>
  449 + <property name="geometry">
  450 + <rect>
  451 + <x>539</x>
  452 + <y>1110</y>
  453 + <width>301</width>
  454 + <height>51</height>
  455 + </rect>
  456 + </property>
  457 + <property name="palette">
  458 + <palette>
  459 + <active>
  460 + <colorrole role="WindowText">
  461 + <brush brushstyle="SolidPattern">
  462 + <color alpha="255">
  463 + <red>255</red>
  464 + <green>255</green>
  465 + <blue>255</blue>
  466 + </color>
  467 + </brush>
  468 + </colorrole>
  469 + </active>
  470 + <inactive>
  471 + <colorrole role="WindowText">
  472 + <brush brushstyle="SolidPattern">
  473 + <color alpha="255">
  474 + <red>255</red>
  475 + <green>255</green>
  476 + <blue>255</blue>
  477 + </color>
  478 + </brush>
  479 + </colorrole>
  480 + </inactive>
  481 + <disabled>
  482 + <colorrole role="WindowText">
  483 + <brush brushstyle="SolidPattern">
  484 + <color alpha="255">
  485 + <red>123</red>
  486 + <green>123</green>
  487 + <blue>123</blue>
  488 + </color>
  489 + </brush>
  490 + </colorrole>
  491 + </disabled>
  492 + </palette>
  493 + </property>
  494 + <property name="font">
  495 + <font>
  496 + <family>Roboto</family>
  497 + <pointsize>16</pointsize>
  498 + <weight>75</weight>
  499 + <bold>true</bold>
  500 + </font>
  501 + </property>
  502 + <property name="text">
  503 + <string>0&lt;span style=&quot;font-size:11pt;&quot;&gt;초&lt;/span&gt;</string>
  504 + </property>
  505 + <property name="alignment">
  506 + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
  507 + </property>
  508 + </widget>
  509 + <widget class="QPushButton" name="combiButton">
  510 + <property name="enabled">
  511 + <bool>false</bool>
  512 + </property>
  513 + <property name="geometry">
  514 + <rect>
  515 + <x>300</x>
  516 + <y>426</y>
  517 + <width>300</width>
  518 + <height>293</height>
  519 + </rect>
  520 + </property>
  521 + <property name="styleSheet">
  522 + <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_combi_hide.png); }
  523 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_combi_ov.png); }
  524 +QPushButton:checked { background-image: url(:/images/cook_mode/big_combi.png); }</string>
  525 + </property>
  526 + <property name="text">
  527 + <string>콤비</string>
  528 + </property>
  529 + <property name="checkable">
  530 + <bool>true</bool>
  531 + </property>
  532 + <property name="style" stdset="0">
  533 + <string notr="true">mode</string>
  534 + </property>
  535 + </widget>
  536 + <widget class="Slider" name="timeSlider" native="true">
  537 + <property name="geometry">
  538 + <rect>
  539 + <x>185</x>
  540 + <y>1065</y>
  541 + <width>666</width>
  542 + <height>60</height>
  543 + </rect>
  544 + </property>
  545 + <property name="focusPolicy">
  546 + <enum>Qt::ClickFocus</enum>
  547 + </property>
  548 + </widget>
  549 + <widget class="Slider" name="humiditySlider" native="true">
  550 + <property name="geometry">
  551 + <rect>
  552 + <x>185</x>
  553 + <y>765</y>
  554 + <width>666</width>
  555 + <height>60</height>
  556 + </rect>
  557 + </property>
  558 + <property name="focusPolicy">
  559 + <enum>Qt::ClickFocus</enum>
  560 + </property>
  561 + </widget>
  562 + <widget class="QPushButton" name="steamButton">
  563 + <property name="enabled">
  564 + <bool>false</bool>
  565 + </property>
  566 + <property name="geometry">
  567 + <rect>
  568 + <x>0</x>
  569 + <y>426</y>
  570 + <width>300</width>
  571 + <height>293</height>
  572 + </rect>
  573 + </property>
  574 + <property name="styleSheet">
  575 + <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_steam_hide.png); }
  576 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_steam_ov.png); }
  577 +QPushButton:checked { background-image: url(:/images/cook_mode/big_steam.png); }</string>
  578 + </property>
  579 + <property name="text">
  580 + <string>스팀</string>
  581 + </property>
  582 + <property name="checkable">
  583 + <bool>true</bool>
  584 + </property>
  585 + <property name="style" stdset="0">
  586 + <string notr="true">mode</string>
  587 + </property>
  588 + </widget>
  589 + <widget class="QLabel" name="tempLabel">
  590 + <property name="enabled">
  591 + <bool>true</bool>
  592 + </property>
  593 + <property name="geometry">
  594 + <rect>
  595 + <x>690</x>
  596 + <y>960</y>
  597 + <width>150</width>
  598 + <height>51</height>
  599 + </rect>
  600 + </property>
  601 + <property name="palette">
  602 + <palette>
  603 + <active>
  604 + <colorrole role="WindowText">
  605 + <brush brushstyle="SolidPattern">
  606 + <color alpha="255">
  607 + <red>255</red>
  608 + <green>255</green>
  609 + <blue>255</blue>
  610 + </color>
  611 + </brush>
  612 + </colorrole>
  613 + </active>
  614 + <inactive>
  615 + <colorrole role="WindowText">
  616 + <brush brushstyle="SolidPattern">
  617 + <color alpha="255">
  618 + <red>255</red>
  619 + <green>255</green>
  620 + <blue>255</blue>
  621 + </color>
  622 + </brush>
  623 + </colorrole>
  624 + </inactive>
  625 + <disabled>
  626 + <colorrole role="WindowText">
  627 + <brush brushstyle="SolidPattern">
  628 + <color alpha="255">
  629 + <red>123</red>
  630 + <green>123</green>
  631 + <blue>123</blue>
  632 + </color>
  633 + </brush>
  634 + </colorrole>
  635 + </disabled>
  636 + </palette>
  637 + </property>
  638 + <property name="font">
  639 + <font>
  640 + <family>Roboto</family>
  641 + <pointsize>16</pointsize>
  642 + <weight>75</weight>
  643 + <bold>true</bold>
  644 + </font>
  645 + </property>
  646 + <property name="text">
  647 + <string>30&lt;span style=&quot;font-size:11pt;&quot;&gt;℃&lt;/span&gt;</string>
  648 + </property>
  649 + <property name="alignment">
  650 + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
  651 + </property>
  652 + </widget>
  653 + <widget class="QLabel" name="steamLabel_5">
  654 + <property name="enabled">
  655 + <bool>true</bool>
  656 + </property>
  657 + <property name="geometry">
  658 + <rect>
  659 + <x>780</x>
  660 + <y>890</y>
  661 + <width>91</width>
  662 + <height>51</height>
  663 + </rect>
  664 + </property>
  665 + <property name="palette">
  666 + <palette>
  667 + <active>
  668 + <colorrole role="WindowText">
  669 + <brush brushstyle="SolidPattern">
  670 + <color alpha="255">
  671 + <red>255</red>
  672 + <green>255</green>
  673 + <blue>255</blue>
  674 + </color>
  675 + </brush>
  676 + </colorrole>
  677 + </active>
  678 + <inactive>
  679 + <colorrole role="WindowText">
  680 + <brush brushstyle="SolidPattern">
  681 + <color alpha="255">
  682 + <red>255</red>
  683 + <green>255</green>
  684 + <blue>255</blue>
  685 + </color>
  686 + </brush>
  687 + </colorrole>
  688 + </inactive>
  689 + <disabled>
  690 + <colorrole role="WindowText">
  691 + <brush brushstyle="SolidPattern">
  692 + <color alpha="255">
  693 + <red>123</red>
  694 + <green>123</green>
  695 + <blue>123</blue>
  696 + </color>
  697 + </brush>
  698 + </colorrole>
  699 + </disabled>
  700 + </palette>
  701 + </property>
  702 + <property name="font">
  703 + <font>
  704 + <family>Malgun Gothic</family>
  705 + <pointsize>9</pointsize>
  706 + </font>
  707 + </property>
  708 + <property name="text">
  709 + <string>증가</string>
  710 + </property>
  711 + <property name="alignment">
  712 + <set>Qt::AlignCenter</set>
  713 + </property>
  714 + </widget>
  715 + <widget class="QStackedWidget" name="upperStack">
  716 + <property name="geometry">
  717 + <rect>
  718 + <x>0</x>
  719 + <y>0</y>
  720 + <width>900</width>
  721 + <height>426</height>
  722 + </rect>
  723 + </property>
  724 + <widget class="QWidget" name="clockContainer">
  725 + <property name="styleSheet">
  726 + <string notr="true">#clockContainer { background-image: url(:/images/clock/background.png); }</string>
  727 + </property>
  728 + <widget class="Clock" name="clock" native="true">
  729 + <property name="geometry">
  730 + <rect>
  731 + <x>272</x>
  732 + <y>36</y>
  733 + <width>356</width>
  734 + <height>355</height>
  735 + </rect>
  736 + </property>
  737 + </widget>
  738 + <widget class="WashWarnIcon" name="label_6">
  739 + <property name="geometry">
  740 + <rect>
  741 + <x>800</x>
  742 + <y>320</y>
  743 + <width>80</width>
  744 + <height>84</height>
  745 + </rect>
  746 + </property>
  747 + </widget>
  748 + <widget class="DemoIcon" name="label_2">
  749 + <property name="geometry">
  750 + <rect>
  751 + <x>780</x>
  752 + <y>230</y>
  753 + <width>101</width>
  754 + <height>90</height>
  755 + </rect>
  756 + </property>
  757 + </widget>
  758 + <widget class="HalfEnergyIcon" name="label_3">
  759 + <property name="geometry">
  760 + <rect>
  761 + <x>780</x>
  762 + <y>160</y>
  763 + <width>108</width>
  764 + <height>67</height>
  765 + </rect>
  766 + </property>
  767 + </widget>
  768 + <widget class="DigitalClock" name="label_4">
  769 + <property name="geometry">
  770 + <rect>
  771 + <x>20</x>
  772 + <y>310</y>
  773 + <width>600</width>
  774 + <height>100</height>
  775 + </rect>
  776 + </property>
  777 + <property name="alignment">
  778 + <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
  779 + </property>
  780 + </widget>
  781 + </widget>
  782 + <widget class="QWidget" name="closeDoorWidget">
  783 + <property name="styleSheet">
  784 + <string notr="true">#closeDoorWidget { background-image: url(:/images/clock/background.png); }</string>
  785 + </property>
  786 + <widget class="AnimatedImageBox" name="openDoorAnimation">
  787 + <property name="geometry">
  788 + <rect>
  789 + <x>366</x>
  790 + <y>20</y>
  791 + <width>251</width>
  792 + <height>292</height>
  793 + </rect>
  794 + </property>
  795 + </widget>
  796 + <widget class="QLabel" name="label_5">
  797 + <property name="geometry">
  798 + <rect>
  799 + <x>430</x>
  800 + <y>170</y>
  801 + <width>85</width>
  802 + <height>24</height>
  803 + </rect>
  804 + </property>
  805 + <property name="pixmap">
  806 + <pixmap resource="resources.qrc">:/images/animation/close_door_arrow.png</pixmap>
  807 + </property>
  808 + </widget>
  809 + </widget>
  810 + </widget>
  811 + <widget class="Slider" name="tempSlider" native="true">
  812 + <property name="geometry">
  813 + <rect>
  814 + <x>185</x>
  815 + <y>915</y>
  816 + <width>666</width>
  817 + <height>60</height>
  818 + </rect>
  819 + </property>
  820 + <property name="focusPolicy">
  821 + <enum>Qt::ClickFocus</enum>
  822 + </property>
  823 + </widget>
  824 + <widget class="QPushButton" name="tempButton">
  825 + <property name="geometry">
  826 + <rect>
  827 + <x>27</x>
  828 + <y>875</y>
  829 + <width>140</width>
  830 + <height>140</height>
  831 + </rect>
  832 + </property>
  833 + <property name="styleSheet">
  834 + <string notr="true">QPushButton { image: url(:/images/slider_icon/temp.png); }
  835 +QPushButton:pressed,
  836 +QPushButton:focus { image: url(:/images/slider_icon/011_icon_02_active.png); }
  837 +QPushButton:checked { image: url(:/images/slider_icon/temp_ov.png); }</string>
  838 + </property>
  839 + <property name="checkable">
  840 + <bool>true</bool>
  841 + </property>
  842 + <property name="style" stdset="0">
  843 + <string notr="true">icon</string>
  844 + </property>
  845 + </widget>
  846 + </widget>
  847 + </widget>
  848 + <customwidgets>
  849 + <customwidget>
  850 + <class>Clock</class>
  851 + <extends>QWidget</extends>
  852 + <header>clock.h</header>
  853 + <container>1</container>
  854 + </customwidget>
  855 + <customwidget>
  856 + <class>WashWarnIcon</class>
  857 + <extends>QLabel</extends>
  858 + <header>washwarnicon.h</header>
  859 + </customwidget>
  860 + <customwidget>
  861 + <class>DemoIcon</class>
  862 + <extends>QLabel</extends>
  863 + <header>demoicon.h</header>
  864 + </customwidget>
  865 + <customwidget>
  866 + <class>HalfEnergyIcon</class>
  867 + <extends>QLabel</extends>
  868 + <header>halfenergyicon.h</header>
  869 + </customwidget>
  870 + <customwidget>
  871 + <class>DigitalClock</class>
  872 + <extends>QLabel</extends>
  873 + <header>digitalclock.h</header>
  874 + </customwidget>
  875 + <customwidget>
  876 + <class>AnimatedImageBox</class>
  877 + <extends>QLabel</extends>
  878 + <header>animatedimagebox.h</header>
  879 + </customwidget>
  880 + <customwidget>
  881 + <class>Slider</class>
  882 + <extends>QWidget</extends>
  883 + <header>slider.h</header>
  884 + <container>1</container>
  885 + </customwidget>
  886 + </customwidgets>
  887 + <tabstops>
  888 + <tabstop>steamButton</tabstop>
  889 + <tabstop>combiButton</tabstop>
  890 + <tabstop>dryheatButton</tabstop>
  891 + <tabstop>humidityButton</tabstop>
  892 + <tabstop>tempButton</tabstop>
  893 + <tabstop>timeButton</tabstop>
  894 + <tabstop>backButton</tabstop>
  895 + <tabstop>helpButton</tabstop>
  896 + <tabstop>okButton</tabstop>
  897 + </tabstops>
  898 + <resources>
  899 + <include location="resources.qrc"/>
  900 + </resources>
  901 + <connections/>
  902 +</ui>
... ...
app/gui/oven_control/multicookrecorder.cpp
... ... @@ -0,0 +1,75 @@
  1 +#include "multicookrecorder.h"
  2 +
  3 +namespace
  4 +{
  5 +
  6 +Define::Mode mode = Define::InvalidMode;
  7 +
  8 +struct Entry
  9 +{
  10 + MultiCook *cook;
  11 + int count;
  12 +};
  13 +
  14 +QList<Entry> sortedList;
  15 +
  16 +void sort()
  17 +{
  18 + // Insertion sort
  19 + int size = sortedList.size();
  20 + for (int i = 1; i < size; i++)
  21 + {
  22 + for (int j = i; j > 0; j--)
  23 + {
  24 + Entry c = sortedList.at(j);
  25 + Entry t = sortedList.at(j - 1);
  26 +
  27 + if (c.count > t.count)
  28 + {
  29 + // Swap
  30 + sortedList.replace(j, t);
  31 + sortedList.replace(j - 1, c);
  32 + }
  33 + else
  34 + break;
  35 + }
  36 + }
  37 +}
  38 +
  39 +}
  40 +
  41 +namespace MultiCookRecorder
  42 +{
  43 +
  44 +void record(MultiCook *cook)
  45 +{
  46 + if (mode != cook->mode())
  47 + {
  48 + mode = cook->mode();
  49 + sortedList.clear();
  50 + }
  51 +
  52 + for (int i = 0; i < sortedList.size(); i++)
  53 + {
  54 + Entry &e = sortedList[i];
  55 + if (e.cook->equals(cook))
  56 + {
  57 + e.count++;
  58 + sort();
  59 + return;
  60 + }
  61 + }
  62 +
  63 + sortedList.append(Entry{cook->clone(), 1});
  64 +}
  65 +
  66 +QList<MultiCook *> list()
  67 +{
  68 + QList<MultiCook *> l;
  69 + foreach (Entry e, sortedList)
  70 + l.append(e.cook);
  71 +
  72 + return l;
  73 +}
  74 +
  75 +}
... ...
app/gui/oven_control/multicookrecorder.h
... ... @@ -0,0 +1,14 @@
  1 +#ifndef MULTICOOKRECORDER_H
  2 +#define MULTICOOKRECORDER_H
  3 +
  4 +#include "multicook.h"
  5 +
  6 +namespace MultiCookRecorder
  7 +{
  8 +
  9 +void record(MultiCook *cook);
  10 +QList<MultiCook *> list();
  11 +
  12 +}
  13 +
  14 +#endif // MULTICOOKRECORDER_H
... ...
app/gui/oven_control/multicookselectionwindow.cpp
... ... @@ -0,0 +1,236 @@
  1 +#include "multicookselectionwindow.h"
  2 +#include "ui_multicookselectionwindow.h"
  3 +
  4 +#include <QKeyEvent>
  5 +
  6 +#include "mainwindow.h"
  7 +#include "configwindow.h"
  8 +#include "multicookmanualwindow.h"
  9 +#include "multicookautowindow.h"
  10 +#include "soundplayer.h"
  11 +
  12 +MultiCookSelectionWindow::MultiCookSelectionWindow(QWidget *parent) :
  13 + QMainWindow(parent),
  14 + ui(new Ui::MultiCookSelectionWindow)
  15 +{
  16 + ui->setupUi(this);
  17 +
  18 + ui->clockContainer->setParent(ui->upperStack);
  19 + setAttribute(Qt::WA_DeleteOnClose);
  20 +
  21 + mode = Define::InvalidMode;
  22 +
  23 + updateView();
  24 +
  25 + setFocus();
  26 +
  27 + foreach (QPushButton *button, findChildren<QPushButton *>())
  28 + connect(button, &QPushButton::pressed, SoundPlayer::playClick);
  29 +}
  30 +
  31 +MultiCookSelectionWindow::~MultiCookSelectionWindow()
  32 +{
  33 + delete ui;
  34 +}
  35 +
  36 +void MultiCookSelectionWindow::setMode(Define::Mode mode)
  37 +{
  38 + this->mode = mode;
  39 + book.setMode(mode);
  40 + updateView();
  41 +}
  42 +
  43 +void MultiCookSelectionWindow::keyPressEvent(QKeyEvent *event)
  44 +{
  45 + switch (event->key())
  46 + {
  47 + case 0x01000032: // Turn left
  48 + onEncoderLeft();
  49 + break;
  50 + case 0x01000031: // Push
  51 + pushed = focusWidget();
  52 + break;
  53 + case 0x01000030: // Turn right
  54 + onEncoderRight();
  55 + break;
  56 + }
  57 +}
  58 +
  59 +void MultiCookSelectionWindow::keyReleaseEvent(QKeyEvent *event)
  60 +{
  61 + switch (event->key())
  62 + {
  63 + case 0x01000032: // Turn left
  64 + onEncoderLeft();
  65 + break;
  66 + case 0x01000031: // Push
  67 + if (focusWidget() == pushed)
  68 + onEncoderClicked(pushed);
  69 +
  70 + pushed = NULL;
  71 + break;
  72 + case 0x01000030: // Turn right
  73 + onEncoderRight();
  74 + break;
  75 + }
  76 +}
  77 +
  78 +void MultiCookSelectionWindow::updateView()
  79 +{
  80 + if (mode == Define::InvalidMode)
  81 + {
  82 + ui->steamButton->setEnabled(true);
  83 + ui->combiButton->setEnabled(true);
  84 + ui->dryheatButton->setEnabled(true);
  85 +
  86 + ui->poultryButton->setEnabled(false);
  87 + ui->meatButton->setEnabled(false);
  88 + ui->fishButton->setEnabled(false);
  89 + ui->dessertButton->setEnabled(false);
  90 + ui->grainButton->setEnabled(false);
  91 + ui->breadButton->setEnabled(false);
  92 + ui->etcButton->setEnabled(false);
  93 + }
  94 + else
  95 + {
  96 + ui->steamButton->setEnabled(mode == Define::SteamMode);
  97 + ui->combiButton->setEnabled(mode == Define::CombiMode);
  98 + ui->dryheatButton->setEnabled(mode == Define::DryMode);
  99 +
  100 + ui->poultryButton->setEnabled(book.checkType(Define::Poultry));
  101 + ui->meatButton->setEnabled(book.checkType(Define::Meat));
  102 + ui->fishButton->setEnabled(book.checkType(Define::Fish));
  103 + ui->dessertButton->setEnabled(book.checkType(Define::Desert));
  104 + ui->grainButton->setEnabled(book.checkType(Define::Vegetable));
  105 + ui->breadButton->setEnabled(book.checkType(Define::Bread));
  106 + ui->etcButton->setEnabled(book.checkType(Define::Etc));
  107 + }
  108 +
  109 + ui->primeButton->setEnabled(false);
  110 +
  111 + ui->multiButton->setEnabled(false);
  112 + ui->programmingButton->setEnabled(false);
  113 + ui->washButton->setEnabled(false);
  114 +}
  115 +
  116 +void MultiCookSelectionWindow::handleModeClick(Define::Mode mode)
  117 +{
  118 + setFocus();
  119 +
  120 + if (this->mode == Define::InvalidMode)
  121 + {
  122 + setMode(mode);
  123 + }
  124 + else
  125 + {
  126 + MultiCookManualWindow *w = new MultiCookManualWindow(this);
  127 + w->setMode(mode);
  128 + w->setWindowModality(Qt::WindowModal);
  129 + w->showFullScreen();
  130 + w->raise();
  131 +
  132 + connect(w, SIGNAL(selected(MultiCook*)), SIGNAL(selected(MultiCook*)));
  133 + connect(w, SIGNAL(selected(MultiCook*)), SLOT(hide()));
  134 + connect(w, SIGNAL(selected(MultiCook*)), SLOT(close()));
  135 + }
  136 +}
  137 +
  138 +void MultiCookSelectionWindow::handleTypeClick(Define::CookType type)
  139 +{
  140 + setFocus();
  141 +
  142 + book.setType(type);
  143 +
  144 + MultiCookAutoWindow *w = new MultiCookAutoWindow(this);
  145 + w->setType(type);
  146 + w->setBook(&book);
  147 + w->setWindowModality(Qt::WindowModal);
  148 + w->showFullScreen();
  149 + w->raise();
  150 +
  151 + connect(w, SIGNAL(selected(MultiCook*)), SIGNAL(selected(MultiCook*)));
  152 + connect(w, SIGNAL(selected(MultiCook*)), SLOT(hide()));
  153 + connect(w, SIGNAL(selected(MultiCook*)), SLOT(close()));
  154 +}
  155 +
  156 +void MultiCookSelectionWindow::on_steamButton_clicked()
  157 +{
  158 + handleModeClick(Define::SteamMode);
  159 +}
  160 +
  161 +void MultiCookSelectionWindow::on_combiButton_clicked()
  162 +{
  163 + handleModeClick(Define::CombiMode);
  164 +}
  165 +
  166 +void MultiCookSelectionWindow::on_dryheatButton_clicked()
  167 +{
  168 + handleModeClick(Define::DryMode);
  169 +}
  170 +
  171 +void MultiCookSelectionWindow::on_poultryButton_clicked()
  172 +{
  173 + handleTypeClick(Define::Poultry);
  174 +}
  175 +
  176 +void MultiCookSelectionWindow::on_meatButton_clicked()
  177 +{
  178 + handleTypeClick(Define::Meat);
  179 +}
  180 +
  181 +void MultiCookSelectionWindow::on_fishButton_clicked()
  182 +{
  183 + handleTypeClick(Define::Fish);
  184 +}
  185 +
  186 +void MultiCookSelectionWindow::on_dessertButton_clicked()
  187 +{
  188 + handleTypeClick(Define::Desert);
  189 +}
  190 +
  191 +void MultiCookSelectionWindow::on_grainButton_clicked()
  192 +{
  193 + handleTypeClick(Define::Vegetable);
  194 +}
  195 +
  196 +void MultiCookSelectionWindow::on_breadButton_clicked()
  197 +{
  198 + handleTypeClick(Define::Bread);
  199 +}
  200 +
  201 +void MultiCookSelectionWindow::on_etcButton_clicked()
  202 +{
  203 + handleTypeClick(Define::Etc);
  204 +}
  205 +
  206 +void MultiCookSelectionWindow::on_backButton_clicked()
  207 +{
  208 + close();
  209 +}
  210 +
  211 +void MultiCookSelectionWindow::on_helpButton_clicked()
  212 +{
  213 +
  214 +}
  215 +
  216 +void MultiCookSelectionWindow::on_okButton_clicked()
  217 +{
  218 +
  219 +}
  220 +
  221 +void MultiCookSelectionWindow::onEncoderLeft()
  222 +{
  223 + focusPreviousChild();
  224 +}
  225 +
  226 +void MultiCookSelectionWindow::onEncoderRight()
  227 +{
  228 + focusNextChild();
  229 +}
  230 +
  231 +void MultiCookSelectionWindow::onEncoderClicked(QWidget *clicked)
  232 +{
  233 + QPushButton *b = qobject_cast<QPushButton *>(clicked);
  234 + if (b)
  235 + b->click();
  236 +}
... ...
app/gui/oven_control/multicookselectionwindow.h
... ... @@ -0,0 +1,64 @@
  1 +#ifndef MULTICOOKSELECTIONWINDOW_H
  2 +#define MULTICOOKSELECTIONWINDOW_H
  3 +
  4 +#include <QMainWindow>
  5 +
  6 +#include "multicook.h"
  7 +#include "multicookbook.h"
  8 +
  9 +namespace Ui {
  10 +class MultiCookSelectionWindow;
  11 +}
  12 +
  13 +class MultiCookSelectionWindow : public QMainWindow
  14 +{
  15 + Q_OBJECT
  16 +
  17 +public:
  18 + explicit MultiCookSelectionWindow(QWidget *parent = 0);
  19 + ~MultiCookSelectionWindow();
  20 +
  21 + void setMode(Define::Mode mode);
  22 +
  23 +signals:
  24 + void selected(MultiCook*);
  25 +
  26 +protected:
  27 + void keyPressEvent(QKeyEvent *event);
  28 + void keyReleaseEvent(QKeyEvent *event);
  29 +
  30 +private slots:
  31 + void updateView();
  32 +
  33 + void handleModeClick(Define::Mode mode);
  34 + void handleTypeClick(Define::CookType type);
  35 +
  36 + void on_steamButton_clicked();
  37 + void on_combiButton_clicked();
  38 + void on_dryheatButton_clicked();
  39 +
  40 + void on_poultryButton_clicked();
  41 + void on_meatButton_clicked();
  42 + void on_fishButton_clicked();
  43 + void on_dessertButton_clicked();
  44 + void on_grainButton_clicked();
  45 + void on_breadButton_clicked();
  46 + void on_etcButton_clicked();
  47 +
  48 + void on_backButton_clicked();
  49 + void on_helpButton_clicked();
  50 + void on_okButton_clicked();
  51 +
  52 +private:
  53 + Ui::MultiCookSelectionWindow *ui;
  54 + Define::Mode mode;
  55 + MultiCookBook book;
  56 +
  57 + QWidget *pushed = NULL;
  58 +
  59 + void onEncoderLeft();
  60 + void onEncoderRight();
  61 + void onEncoderClicked(QWidget *clicked);
  62 +};
  63 +
  64 +#endif // MULTICOOKSELECTIONWINDOW_H
... ...
app/gui/oven_control/multicookselectionwindow.ui
... ... @@ -0,0 +1,767 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<ui version="4.0">
  3 + <class>MultiCookSelectionWindow</class>
  4 + <widget class="QMainWindow" name="MultiCookSelectionWindow">
  5 + <property name="geometry">
  6 + <rect>
  7 + <x>0</x>
  8 + <y>0</y>
  9 + <width>900</width>
  10 + <height>1600</height>
  11 + </rect>
  12 + </property>
  13 + <property name="styleSheet">
  14 + <string notr="true">#centralwidget { background-image: url(:/images/background/main.png); }
  15 +#bottomBar { background-image: url(:/images/bottom_bar/background.png); }
  16 +
  17 +QWidget { outline: none; }
  18 +
  19 +QPushButton[style=&quot;mode&quot;] {
  20 +background-repeat: no-repeat;
  21 +background-position: center;
  22 +background-clip: border;
  23 +background-origin: border;
  24 +margin-bottom: 50px;
  25 +
  26 +border-top: 200px;
  27 +border-bottom: -50px;
  28 +border-style: hidden;
  29 +color: white;
  30 +font-size: 40px;
  31 +}
  32 +
  33 +QPushButton[style=&quot;type&quot;] {
  34 +background-repeat: no-repeat;
  35 +background-position: center;
  36 +background-clip: border;
  37 +background-origin: border;
  38 +
  39 +border-top: 165px;
  40 +border-style: hidden;
  41 +color: white;
  42 +font-size: 30px;
  43 +}
  44 +
  45 +QPushButton[style=&quot;function&quot;] {
  46 +background-repeat: no-repeat;
  47 +background-position: center;
  48 +background-clip: border;
  49 +background-origin: border;
  50 +
  51 +border-top: 206px;
  52 +border-style: hidden;
  53 +color: white;
  54 +font-size: 30px;
  55 +}
  56 +
  57 +QPushButton:disabled { color: #7B7B7B; }</string>
  58 + </property>
  59 + <widget class="QWidget" name="centralwidget">
  60 + <widget class="QPushButton" name="dryheatButton">
  61 + <property name="enabled">
  62 + <bool>false</bool>
  63 + </property>
  64 + <property name="geometry">
  65 + <rect>
  66 + <x>600</x>
  67 + <y>426</y>
  68 + <width>300</width>
  69 + <height>293</height>
  70 + </rect>
  71 + </property>
  72 + <property name="styleSheet">
  73 + <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_dryheat.png); }
  74 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_dryheat_ov.png); }
  75 +QPushButton:disabled { background-image: url(:/images/cook_mode/big_dryheat_hide.png); }</string>
  76 + </property>
  77 + <property name="text">
  78 + <string>건열</string>
  79 + </property>
  80 + <property name="style" stdset="0">
  81 + <string notr="true">mode</string>
  82 + </property>
  83 + </widget>
  84 + <widget class="Line" name="line_2">
  85 + <property name="geometry">
  86 + <rect>
  87 + <x>450</x>
  88 + <y>771</y>
  89 + <width>1</width>
  90 + <height>120</height>
  91 + </rect>
  92 + </property>
  93 + <property name="orientation">
  94 + <enum>Qt::Vertical</enum>
  95 + </property>
  96 + </widget>
  97 + <widget class="QPushButton" name="grainButton">
  98 + <property name="enabled">
  99 + <bool>false</bool>
  100 + </property>
  101 + <property name="geometry">
  102 + <rect>
  103 + <x>0</x>
  104 + <y>942</y>
  105 + <width>225</width>
  106 + <height>222</height>
  107 + </rect>
  108 + </property>
  109 + <property name="sizePolicy">
  110 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  111 + <horstretch>0</horstretch>
  112 + <verstretch>0</verstretch>
  113 + </sizepolicy>
  114 + </property>
  115 + <property name="styleSheet">
  116 + <string notr="true">QPushButton { background-image: url(:/images/cook_type/vegetable.png); }
  117 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/vegetable_ov.png); }
  118 +QPushButton:disabled { background-image: url(:/images/cook_type/vegetable_hide.png); }</string>
  119 + </property>
  120 + <property name="text">
  121 + <string>채소및곡류</string>
  122 + </property>
  123 + <property name="style" stdset="0">
  124 + <string notr="true">type</string>
  125 + </property>
  126 + </widget>
  127 + <widget class="Line" name="line_5">
  128 + <property name="geometry">
  129 + <rect>
  130 + <x>450</x>
  131 + <y>993</y>
  132 + <width>1</width>
  133 + <height>120</height>
  134 + </rect>
  135 + </property>
  136 + <property name="orientation">
  137 + <enum>Qt::Vertical</enum>
  138 + </property>
  139 + </widget>
  140 + <widget class="QPushButton" name="breadButton">
  141 + <property name="enabled">
  142 + <bool>false</bool>
  143 + </property>
  144 + <property name="geometry">
  145 + <rect>
  146 + <x>225</x>
  147 + <y>942</y>
  148 + <width>225</width>
  149 + <height>222</height>
  150 + </rect>
  151 + </property>
  152 + <property name="sizePolicy">
  153 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  154 + <horstretch>0</horstretch>
  155 + <verstretch>0</verstretch>
  156 + </sizepolicy>
  157 + </property>
  158 + <property name="styleSheet">
  159 + <string notr="true">QPushButton { background-image: url(:/images/cook_type/bread.png); }
  160 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/bread_ov.png); }
  161 +QPushButton:disabled { background-image: url(:/images/cook_type/bread_hide.png); }</string>
  162 + </property>
  163 + <property name="text">
  164 + <string>제과제빵류</string>
  165 + </property>
  166 + <property name="style" stdset="0">
  167 + <string notr="true">type</string>
  168 + </property>
  169 + </widget>
  170 + <widget class="Line" name="line_3">
  171 + <property name="geometry">
  172 + <rect>
  173 + <x>675</x>
  174 + <y>771</y>
  175 + <width>1</width>
  176 + <height>120</height>
  177 + </rect>
  178 + </property>
  179 + <property name="orientation">
  180 + <enum>Qt::Vertical</enum>
  181 + </property>
  182 + </widget>
  183 + <widget class="QPushButton" name="meatButton">
  184 + <property name="enabled">
  185 + <bool>false</bool>
  186 + </property>
  187 + <property name="geometry">
  188 + <rect>
  189 + <x>225</x>
  190 + <y>720</y>
  191 + <width>225</width>
  192 + <height>222</height>
  193 + </rect>
  194 + </property>
  195 + <property name="sizePolicy">
  196 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  197 + <horstretch>0</horstretch>
  198 + <verstretch>0</verstretch>
  199 + </sizepolicy>
  200 + </property>
  201 + <property name="styleSheet">
  202 + <string notr="true">QPushButton { background-image: url(:/images/cook_type/meat.png); }
  203 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/meat_ov.png); }
  204 +QPushButton:disabled { background-image: url(:/images/cook_type/meat_hide.png); }</string>
  205 + </property>
  206 + <property name="text">
  207 + <string>육류</string>
  208 + </property>
  209 + <property name="style" stdset="0">
  210 + <string notr="true">type</string>
  211 + </property>
  212 + </widget>
  213 + <widget class="Line" name="line">
  214 + <property name="geometry">
  215 + <rect>
  216 + <x>225</x>
  217 + <y>771</y>
  218 + <width>1</width>
  219 + <height>120</height>
  220 + </rect>
  221 + </property>
  222 + <property name="orientation">
  223 + <enum>Qt::Vertical</enum>
  224 + </property>
  225 + </widget>
  226 + <widget class="QPushButton" name="dessertButton">
  227 + <property name="enabled">
  228 + <bool>false</bool>
  229 + </property>
  230 + <property name="geometry">
  231 + <rect>
  232 + <x>675</x>
  233 + <y>720</y>
  234 + <width>225</width>
  235 + <height>222</height>
  236 + </rect>
  237 + </property>
  238 + <property name="sizePolicy">
  239 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  240 + <horstretch>0</horstretch>
  241 + <verstretch>0</verstretch>
  242 + </sizepolicy>
  243 + </property>
  244 + <property name="styleSheet">
  245 + <string notr="true">QPushButton { background-image: url(:/images/cook_type/desert.png); }
  246 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/desert_ov.png); }
  247 +QPushButton:disabled { background-image: url(:/images/cook_type/desert_hide.png); }</string>
  248 + </property>
  249 + <property name="text">
  250 + <string>디저트류</string>
  251 + </property>
  252 + <property name="style" stdset="0">
  253 + <string notr="true">type</string>
  254 + </property>
  255 + </widget>
  256 + <widget class="QPushButton" name="poultryButton">
  257 + <property name="enabled">
  258 + <bool>false</bool>
  259 + </property>
  260 + <property name="geometry">
  261 + <rect>
  262 + <x>0</x>
  263 + <y>720</y>
  264 + <width>225</width>
  265 + <height>222</height>
  266 + </rect>
  267 + </property>
  268 + <property name="sizePolicy">
  269 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  270 + <horstretch>0</horstretch>
  271 + <verstretch>0</verstretch>
  272 + </sizepolicy>
  273 + </property>
  274 + <property name="styleSheet">
  275 + <string notr="true">QPushButton { background-image: url(:/images/cook_type/poultry.png); }
  276 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/poultry_ov.png); }
  277 +QPushButton:disabled { background-image: url(:/images/cook_type/poultry_hide.png); }</string>
  278 + </property>
  279 + <property name="text">
  280 + <string>가금류</string>
  281 + </property>
  282 + <property name="style" stdset="0">
  283 + <string notr="true">type</string>
  284 + </property>
  285 + </widget>
  286 + <widget class="QPushButton" name="combiButton">
  287 + <property name="enabled">
  288 + <bool>false</bool>
  289 + </property>
  290 + <property name="geometry">
  291 + <rect>
  292 + <x>300</x>
  293 + <y>426</y>
  294 + <width>300</width>
  295 + <height>293</height>
  296 + </rect>
  297 + </property>
  298 + <property name="styleSheet">
  299 + <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_combi.png); }
  300 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_combi_ov.png); }
  301 +QPushButton:disabled { background-image: url(:/images/cook_mode/big_combi_hide.png); }</string>
  302 + </property>
  303 + <property name="text">
  304 + <string>콤비</string>
  305 + </property>
  306 + <property name="style" stdset="0">
  307 + <string notr="true">mode</string>
  308 + </property>
  309 + </widget>
  310 + <widget class="QPushButton" name="multiButton">
  311 + <property name="enabled">
  312 + <bool>false</bool>
  313 + </property>
  314 + <property name="geometry">
  315 + <rect>
  316 + <x>0</x>
  317 + <y>1164</y>
  318 + <width>300</width>
  319 + <height>286</height>
  320 + </rect>
  321 + </property>
  322 + <property name="sizePolicy">
  323 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  324 + <horstretch>0</horstretch>
  325 + <verstretch>0</verstretch>
  326 + </sizepolicy>
  327 + </property>
  328 + <property name="focusPolicy">
  329 + <enum>Qt::NoFocus</enum>
  330 + </property>
  331 + <property name="styleSheet">
  332 + <string notr="true">QPushButton { background-image: url(:/images/main_button/multi.png); }
  333 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/multi_ov.png); }
  334 +QPushButton:disabled { background-image: url(:/images/main_button/multi_hide.png); }</string>
  335 + </property>
  336 + <property name="text">
  337 + <string>다중요리</string>
  338 + </property>
  339 + <property name="style" stdset="0">
  340 + <string notr="true">function</string>
  341 + </property>
  342 + </widget>
  343 + <widget class="QPushButton" name="programmingButton">
  344 + <property name="enabled">
  345 + <bool>false</bool>
  346 + </property>
  347 + <property name="geometry">
  348 + <rect>
  349 + <x>300</x>
  350 + <y>1164</y>
  351 + <width>300</width>
  352 + <height>286</height>
  353 + </rect>
  354 + </property>
  355 + <property name="sizePolicy">
  356 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  357 + <horstretch>0</horstretch>
  358 + <verstretch>0</verstretch>
  359 + </sizepolicy>
  360 + </property>
  361 + <property name="focusPolicy">
  362 + <enum>Qt::NoFocus</enum>
  363 + </property>
  364 + <property name="styleSheet">
  365 + <string notr="true">QPushButton { background-image: url(:/images/main_button/custom.png); }
  366 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/custom_ov.png); }
  367 +QPushButton:disabled { background-image: url(:/images/main_button/custom_hide.png); }</string>
  368 + </property>
  369 + <property name="text">
  370 + <string>프로그래밍모드</string>
  371 + </property>
  372 + <property name="style" stdset="0">
  373 + <string notr="true">function</string>
  374 + </property>
  375 + </widget>
  376 + <widget class="Line" name="line_7">
  377 + <property name="geometry">
  378 + <rect>
  379 + <x>18</x>
  380 + <y>942</y>
  381 + <width>863</width>
  382 + <height>1</height>
  383 + </rect>
  384 + </property>
  385 + <property name="orientation">
  386 + <enum>Qt::Horizontal</enum>
  387 + </property>
  388 + </widget>
  389 + <widget class="QPushButton" name="etcButton">
  390 + <property name="enabled">
  391 + <bool>false</bool>
  392 + </property>
  393 + <property name="geometry">
  394 + <rect>
  395 + <x>450</x>
  396 + <y>942</y>
  397 + <width>225</width>
  398 + <height>222</height>
  399 + </rect>
  400 + </property>
  401 + <property name="sizePolicy">
  402 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  403 + <horstretch>0</horstretch>
  404 + <verstretch>0</verstretch>
  405 + </sizepolicy>
  406 + </property>
  407 + <property name="styleSheet">
  408 + <string notr="true">QPushButton { background-image: url(:/images/cook_type/etc.png); }
  409 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/etc_ov.png); }
  410 +QPushButton:disabled { background-image: url(:/images/cook_type/etc_hide.png); }</string>
  411 + </property>
  412 + <property name="text">
  413 + <string>기타요리</string>
  414 + </property>
  415 + <property name="style" stdset="0">
  416 + <string notr="true">type</string>
  417 + </property>
  418 + </widget>
  419 + <widget class="Line" name="line_4">
  420 + <property name="geometry">
  421 + <rect>
  422 + <x>225</x>
  423 + <y>993</y>
  424 + <width>1</width>
  425 + <height>120</height>
  426 + </rect>
  427 + </property>
  428 + <property name="orientation">
  429 + <enum>Qt::Vertical</enum>
  430 + </property>
  431 + </widget>
  432 + <widget class="QPushButton" name="washButton">
  433 + <property name="enabled">
  434 + <bool>false</bool>
  435 + </property>
  436 + <property name="geometry">
  437 + <rect>
  438 + <x>600</x>
  439 + <y>1164</y>
  440 + <width>300</width>
  441 + <height>286</height>
  442 + </rect>
  443 + </property>
  444 + <property name="sizePolicy">
  445 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  446 + <horstretch>0</horstretch>
  447 + <verstretch>0</verstretch>
  448 + </sizepolicy>
  449 + </property>
  450 + <property name="focusPolicy">
  451 + <enum>Qt::NoFocus</enum>
  452 + </property>
  453 + <property name="styleSheet">
  454 + <string notr="true">QPushButton { background-image: url(:/images/main_button/wash.png); }
  455 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/wash_ov.png); }
  456 +QPushButton:disabled { background-image: url(:/images/main_button/wash_hide.png); }</string>
  457 + </property>
  458 + <property name="text">
  459 + <string>세척모드</string>
  460 + </property>
  461 + <property name="style" stdset="0">
  462 + <string notr="true">function</string>
  463 + </property>
  464 + </widget>
  465 + <widget class="QPushButton" name="primeButton">
  466 + <property name="enabled">
  467 + <bool>false</bool>
  468 + </property>
  469 + <property name="geometry">
  470 + <rect>
  471 + <x>675</x>
  472 + <y>942</y>
  473 + <width>225</width>
  474 + <height>222</height>
  475 + </rect>
  476 + </property>
  477 + <property name="sizePolicy">
  478 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  479 + <horstretch>0</horstretch>
  480 + <verstretch>0</verstretch>
  481 + </sizepolicy>
  482 + </property>
  483 + <property name="styleSheet">
  484 + <string notr="true">QPushButton { background-image: url(:/images/cook_type/additional.png); }
  485 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/additional_ov.png); }
  486 +QPushButton:disabled { background-image: url(:/images/cook_type/additional_hide.png); }</string>
  487 + </property>
  488 + <property name="text">
  489 + <string>부가기능</string>
  490 + </property>
  491 + <property name="style" stdset="0">
  492 + <string notr="true">type</string>
  493 + </property>
  494 + </widget>
  495 + <widget class="Line" name="line_6">
  496 + <property name="geometry">
  497 + <rect>
  498 + <x>675</x>
  499 + <y>993</y>
  500 + <width>1</width>
  501 + <height>120</height>
  502 + </rect>
  503 + </property>
  504 + <property name="orientation">
  505 + <enum>Qt::Vertical</enum>
  506 + </property>
  507 + </widget>
  508 + <widget class="QWidget" name="bottomBar" native="true">
  509 + <property name="geometry">
  510 + <rect>
  511 + <x>0</x>
  512 + <y>1450</y>
  513 + <width>900</width>
  514 + <height>150</height>
  515 + </rect>
  516 + </property>
  517 + <property name="minimumSize">
  518 + <size>
  519 + <width>900</width>
  520 + <height>150</height>
  521 + </size>
  522 + </property>
  523 + <property name="maximumSize">
  524 + <size>
  525 + <width>900</width>
  526 + <height>150</height>
  527 + </size>
  528 + </property>
  529 + <widget class="QPushButton" name="helpButton">
  530 + <property name="geometry">
  531 + <rect>
  532 + <x>401</x>
  533 + <y>26</y>
  534 + <width>97</width>
  535 + <height>97</height>
  536 + </rect>
  537 + </property>
  538 + <property name="sizePolicy">
  539 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  540 + <horstretch>0</horstretch>
  541 + <verstretch>0</verstretch>
  542 + </sizepolicy>
  543 + </property>
  544 + <property name="minimumSize">
  545 + <size>
  546 + <width>62</width>
  547 + <height>71</height>
  548 + </size>
  549 + </property>
  550 + <property name="styleSheet">
  551 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/help.png); }
  552 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/help_ov.png); }</string>
  553 + </property>
  554 + <property name="text">
  555 + <string/>
  556 + </property>
  557 + </widget>
  558 + <widget class="QPushButton" name="backButton">
  559 + <property name="geometry">
  560 + <rect>
  561 + <x>288</x>
  562 + <y>26</y>
  563 + <width>97</width>
  564 + <height>97</height>
  565 + </rect>
  566 + </property>
  567 + <property name="styleSheet">
  568 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/back.png); }
  569 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/back_ov.png); }</string>
  570 + </property>
  571 + <property name="text">
  572 + <string/>
  573 + </property>
  574 + </widget>
  575 + <widget class="QPushButton" name="okButton">
  576 + <property name="geometry">
  577 + <rect>
  578 + <x>514</x>
  579 + <y>26</y>
  580 + <width>97</width>
  581 + <height>97</height>
  582 + </rect>
  583 + </property>
  584 + <property name="styleSheet">
  585 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/006_sys_icon_16.png); }
  586 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/006_sys_icon_16_ov.png); }</string>
  587 + </property>
  588 + <property name="text">
  589 + <string/>
  590 + </property>
  591 + </widget>
  592 + </widget>
  593 + <widget class="QPushButton" name="steamButton">
  594 + <property name="enabled">
  595 + <bool>false</bool>
  596 + </property>
  597 + <property name="geometry">
  598 + <rect>
  599 + <x>0</x>
  600 + <y>426</y>
  601 + <width>300</width>
  602 + <height>293</height>
  603 + </rect>
  604 + </property>
  605 + <property name="styleSheet">
  606 + <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_steam.png); }
  607 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_steam_ov.png); }
  608 +QPushButton:disabled { background-image: url(:/images/cook_mode/big_steam_hide.png); }</string>
  609 + </property>
  610 + <property name="text">
  611 + <string>스팀</string>
  612 + </property>
  613 + <property name="style" stdset="0">
  614 + <string notr="true">mode</string>
  615 + </property>
  616 + </widget>
  617 + <widget class="QPushButton" name="fishButton">
  618 + <property name="enabled">
  619 + <bool>false</bool>
  620 + </property>
  621 + <property name="geometry">
  622 + <rect>
  623 + <x>450</x>
  624 + <y>720</y>
  625 + <width>225</width>
  626 + <height>222</height>
  627 + </rect>
  628 + </property>
  629 + <property name="sizePolicy">
  630 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  631 + <horstretch>0</horstretch>
  632 + <verstretch>0</verstretch>
  633 + </sizepolicy>
  634 + </property>
  635 + <property name="styleSheet">
  636 + <string notr="true">QPushButton { background-image: url(:/images/cook_type/fish.png); }
  637 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/fish_ov.png); }
  638 +QPushButton:disabled { background-image: url(:/images/cook_type/fish_hide.png); }</string>
  639 + </property>
  640 + <property name="text">
  641 + <string>생선류</string>
  642 + </property>
  643 + <property name="style" stdset="0">
  644 + <string notr="true">type</string>
  645 + </property>
  646 + </widget>
  647 + <widget class="QStackedWidget" name="upperStack">
  648 + <property name="geometry">
  649 + <rect>
  650 + <x>0</x>
  651 + <y>0</y>
  652 + <width>900</width>
  653 + <height>426</height>
  654 + </rect>
  655 + </property>
  656 + <property name="currentIndex">
  657 + <number>0</number>
  658 + </property>
  659 + <widget class="QWidget" name="clockContainer">
  660 + <property name="styleSheet">
  661 + <string notr="true">#clockContainer { background-image: url(:/images/clock/background.png); }</string>
  662 + </property>
  663 + <widget class="Clock" name="clock" native="true">
  664 + <property name="geometry">
  665 + <rect>
  666 + <x>272</x>
  667 + <y>36</y>
  668 + <width>356</width>
  669 + <height>355</height>
  670 + </rect>
  671 + </property>
  672 + </widget>
  673 + <widget class="WashWarnIcon" name="label">
  674 + <property name="geometry">
  675 + <rect>
  676 + <x>800</x>
  677 + <y>320</y>
  678 + <width>80</width>
  679 + <height>84</height>
  680 + </rect>
  681 + </property>
  682 + </widget>
  683 + <widget class="DemoIcon" name="label_2">
  684 + <property name="geometry">
  685 + <rect>
  686 + <x>780</x>
  687 + <y>230</y>
  688 + <width>101</width>
  689 + <height>90</height>
  690 + </rect>
  691 + </property>
  692 + </widget>
  693 + <widget class="HalfEnergyIcon" name="label_3">
  694 + <property name="geometry">
  695 + <rect>
  696 + <x>780</x>
  697 + <y>160</y>
  698 + <width>108</width>
  699 + <height>67</height>
  700 + </rect>
  701 + </property>
  702 + </widget>
  703 + <widget class="DigitalClock" name="label_4">
  704 + <property name="geometry">
  705 + <rect>
  706 + <x>20</x>
  707 + <y>310</y>
  708 + <width>600</width>
  709 + <height>100</height>
  710 + </rect>
  711 + </property>
  712 + <property name="alignment">
  713 + <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
  714 + </property>
  715 + </widget>
  716 + </widget>
  717 + <widget class="QWidget" name="page_2"/>
  718 + </widget>
  719 + </widget>
  720 + </widget>
  721 + <customwidgets>
  722 + <customwidget>
  723 + <class>Clock</class>
  724 + <extends>QWidget</extends>
  725 + <header>clock.h</header>
  726 + <container>1</container>
  727 + </customwidget>
  728 + <customwidget>
  729 + <class>WashWarnIcon</class>
  730 + <extends>QLabel</extends>
  731 + <header>washwarnicon.h</header>
  732 + </customwidget>
  733 + <customwidget>
  734 + <class>DemoIcon</class>
  735 + <extends>QLabel</extends>
  736 + <header>demoicon.h</header>
  737 + </customwidget>
  738 + <customwidget>
  739 + <class>HalfEnergyIcon</class>
  740 + <extends>QLabel</extends>
  741 + <header>halfenergyicon.h</header>
  742 + </customwidget>
  743 + <customwidget>
  744 + <class>DigitalClock</class>
  745 + <extends>QLabel</extends>
  746 + <header>digitalclock.h</header>
  747 + </customwidget>
  748 + </customwidgets>
  749 + <tabstops>
  750 + <tabstop>steamButton</tabstop>
  751 + <tabstop>combiButton</tabstop>
  752 + <tabstop>dryheatButton</tabstop>
  753 + <tabstop>poultryButton</tabstop>
  754 + <tabstop>meatButton</tabstop>
  755 + <tabstop>fishButton</tabstop>
  756 + <tabstop>dessertButton</tabstop>
  757 + <tabstop>grainButton</tabstop>
  758 + <tabstop>breadButton</tabstop>
  759 + <tabstop>etcButton</tabstop>
  760 + <tabstop>primeButton</tabstop>
  761 + <tabstop>backButton</tabstop>
  762 + <tabstop>helpButton</tabstop>
  763 + <tabstop>okButton</tabstop>
  764 + </tabstops>
  765 + <resources/>
  766 + <connections/>
  767 +</ui>
... ...
app/gui/oven_control/multicooktimebar.cpp
... ... @@ -0,0 +1,77 @@
  1 +#include "multicooktimebar.h"
  2 +
  3 +#include <QPainter>
  4 +#include <QTime>
  5 +#include <QDebug>
  6 +
  7 +MultiCookTimeBar::MultiCookTimeBar(QWidget *parent) : QWidget(parent)
  8 +{
  9 + format = "hh:mm";
  10 + timePosition = 0;
  11 +
  12 + checkTimer.start(100);
  13 + connect(&checkTimer, SIGNAL(timeout()), SLOT(check()));
  14 +}
  15 +
  16 +void MultiCookTimeBar::showNow()
  17 +{
  18 + timePosition = 0;
  19 + update();
  20 +}
  21 +
  22 +void MultiCookTimeBar::showPrev()
  23 +{
  24 + timePosition--;
  25 + update();
  26 +}
  27 +
  28 +void MultiCookTimeBar::showNext()
  29 +{
  30 + timePosition++;
  31 + update();
  32 +}
  33 +
  34 +void MultiCookTimeBar::paintEvent(QPaintEvent */*event*/)
  35 +{
  36 + int w = width();
  37 + int h = height();
  38 + int y = h / 2;
  39 +
  40 + QPoint c1(w * 2 / 10, y);
  41 + QPoint c2(w * 5 / 10, y);
  42 + QPoint c3(w * 8 / 10, y);
  43 +
  44 +// QFont font = this->font();
  45 +// font.setBold(true);
  46 +
  47 + QRect rect(0, 0, w, h);
  48 +
  49 + QTime t = QTime::currentTime();
  50 +
  51 + QString s1 = t.addSecs(200 * (timePosition + 0)).toString(format);
  52 + QString s2 = t.addSecs(200 * (timePosition + 3)).toString(format);
  53 + QString s3 = t.addSecs(200 * (timePosition + 6)).toString(format);
  54 +
  55 + QPainter painter(this);
  56 + painter.setPen(Qt::white);
  57 +// painter.setFont(font);
  58 +
  59 + rect.moveCenter(c1);
  60 + painter.drawText(rect, Qt::AlignCenter, s1);
  61 +
  62 + rect.moveCenter(c2);
  63 + painter.drawText(rect, Qt::AlignCenter, s2);
  64 +
  65 + rect.moveCenter(c3);
  66 + painter.drawText(rect, Qt::AlignCenter, s3);
  67 +}
  68 +
  69 +void MultiCookTimeBar::check()
  70 +{
  71 + QString s = QTime::currentTime().toString(format);
  72 + if (lastDraw.isNull() || s != lastDraw)
  73 + {
  74 + update();
  75 + lastDraw = s;
  76 + }
  77 +}
... ...
app/gui/oven_control/multicooktimebar.h
... ... @@ -0,0 +1,33 @@
  1 +#ifndef MULTICOOKTIMEBAR_H
  2 +#define MULTICOOKTIMEBAR_H
  3 +
  4 +#include <QWidget>
  5 +#include <QTimer>
  6 +
  7 +class MultiCookTimeBar : public QWidget
  8 +{
  9 + Q_OBJECT
  10 +public:
  11 + explicit MultiCookTimeBar(QWidget *parent = 0);
  12 +
  13 +signals:
  14 +
  15 +public slots:
  16 + void showNow();
  17 + void showPrev();
  18 + void showNext();
  19 +
  20 +protected:
  21 + virtual void paintEvent(QPaintEvent *event);
  22 +
  23 +private:
  24 + int timePosition;
  25 + QString lastDraw;
  26 + QTimer checkTimer;
  27 + QString format;
  28 +
  29 +private slots:
  30 + void check();
  31 +};
  32 +
  33 +#endif // MULTICOOKTIMEBAR_H
... ...
app/gui/oven_control/multicookview.cpp
... ... @@ -0,0 +1,282 @@
  1 +#include "multicookview.h"
  2 +
  3 +#include <QMouseEvent>
  4 +#include <QPainter>
  5 +#include <QDebug>
  6 +
  7 +MultiCookView::MultiCookView(QWidget *parent)
  8 + : QWidget(parent),
  9 + timePosition(0)
  10 +{
  11 + barPixmap.load(":/images/multi/bar.png");
  12 +
  13 + connect(&checkTimer, SIGNAL(timeout()), SLOT(check()));
  14 +}
  15 +
  16 +void MultiCookView::setContainer(MultiCookContainer *container)
  17 +{
  18 + this->container = container;
  19 + rects = calcRects();
  20 + checkTimer.start(33);
  21 +}
  22 +
  23 +void MultiCookView::setTimeBar(MultiCookTimeBar *bar)
  24 +{
  25 + this->bar = bar;
  26 +}
  27 +
  28 +void MultiCookView::showNow()
  29 +{
  30 + timePosition = 0;
  31 + updateView();
  32 +
  33 + bar->showNow();
  34 +}
  35 +
  36 +void MultiCookView::showNext()
  37 +{
  38 + if (timePosition < 0 || !nothingOnRight())
  39 + {
  40 + timePosition++;
  41 + updateView();
  42 +
  43 + bar->showNext();
  44 + }
  45 +}
  46 +
  47 +void MultiCookView::showPrev()
  48 +{
  49 + if (timePosition > 0)
  50 + {
  51 + timePosition--;
  52 + updateView();
  53 +
  54 + bar->showPrev();
  55 + }
  56 +}
  57 +
  58 +void MultiCookView::updateView()
  59 +{
  60 + rects = calcRects();
  61 + update();
  62 +}
  63 +
  64 +void MultiCookView::mousePressEvent(QMouseEvent *event)
  65 +{
  66 + int x = event->x();
  67 + int y = event->y();
  68 +
  69 + pressedSlot = calcSlot(x, y);
  70 +}
  71 +
  72 +void MultiCookView::mouseReleaseEvent(QMouseEvent *event)
  73 +{
  74 + if (pressedSlot == -1)
  75 + return;
  76 +
  77 + int x = event->x();
  78 + int y = event->y();
  79 +
  80 + if (calcSlot(x, y) == pressedSlot)
  81 + emit clicked(pressedSlot);
  82 +}
  83 +
  84 +void MultiCookView::paintEvent(QPaintEvent */*event*/)
  85 +{
  86 + QPainter painter(this);
  87 + paintGrids(painter);
  88 + paintBars(painter);
  89 + paintCurrentTime(painter);
  90 +}
  91 +
  92 +void MultiCookView::resizeEvent(QResizeEvent *event)
  93 +{
  94 + rects = calcRects();
  95 +
  96 + QWidget::resizeEvent(event);
  97 +}
  98 +
  99 +void MultiCookView::check()
  100 +{
  101 + bool needUpdate = false;
  102 +
  103 + QList<QRect> rects = calcRects();
  104 + for (int i = 0; i < 10; i++)
  105 + {
  106 + if (rects.at(i) != this->rects.at(i))
  107 + {
  108 + needUpdate = true;
  109 + break;
  110 + }
  111 + }
  112 +
  113 + if (needUpdate)
  114 + {
  115 + this->rects = rects;
  116 + update();
  117 + }
  118 +}
  119 +
  120 +QList<QRect> MultiCookView::calcRects()
  121 +{
  122 + int w = width();
  123 + int h = height();
  124 + int x = w * (2-timePosition) / 10 + 1;
  125 + int y = (h / 10 - 56) / 2;
  126 +
  127 + QList<QRect> list;
  128 + for (int i = 0; i < 10; i++)
  129 + {
  130 + MultiCook *cook = container->at(i);
  131 + if (cook == Q_NULLPTR)
  132 + {
  133 + list.append(QRect());
  134 + continue;
  135 + }
  136 +
  137 + int barY = y + h * i / 10;
  138 + int barW = 0;
  139 +
  140 + // bar width = remaining time(ms) / 200s * width of a grid
  141 + int remainingTime = cook->remainingTime();
  142 + if (remainingTime > 0)
  143 + barW = qCeil(remainingTime / 2000000.0 * w);
  144 +
  145 + list.append(QRect(x, barY, barW, 56));
  146 + }
  147 +
  148 + return list;
  149 +}
  150 +
  151 +int MultiCookView::calcSlot(int x, int y)
  152 +{
  153 + for (int i = 0; i < 10; i++)
  154 + {
  155 + const QRect &r = rects.at(i);
  156 + if (r.isNull())
  157 + continue;
  158 +
  159 + if (r.contains(x, y))
  160 + return i;
  161 + }
  162 +
  163 + return -1;
  164 +}
  165 +
  166 +void MultiCookView::paintGrids(QPainter &painter)
  167 +{
  168 + static const int padding = 10;
  169 +
  170 + int w = width();
  171 + int h = height();
  172 +
  173 + painter.setBrush(Qt::NoBrush);
  174 + painter.setPen(QColor(70,70,70));
  175 +
  176 + for (int i = 1; i < 10; i++)
  177 + painter.drawLine(0, h * i / 10, w, h * i / 10);
  178 +
  179 + for (int i = 1; i < 10; i++)
  180 + painter.drawLine(w * i / 10, padding, w * i / 10, h - padding);
  181 +}
  182 +
  183 +void MultiCookView::paintBars(QPainter &painter)
  184 +{
  185 + for (int i = 0; i < 10; i++)
  186 + {
  187 + MultiCook *cook = container->at(i);
  188 + if (cook == Q_NULLPTR)
  189 + continue;
  190 +
  191 + QRect r = rects.at(i);
  192 + if (!r.isNull())
  193 + paintBar(painter, r);
  194 +
  195 + r.translate(10, 0);
  196 +
  197 + if (r.left() < 10)
  198 + r.moveLeft(10);
  199 +
  200 + painter.setBrush(Qt::NoBrush);
  201 + painter.setPen(Qt::white);
  202 + painter.drawText(r, Qt::AlignVCenter | Qt::TextDontClip, cook->name());
  203 + }
  204 +}
  205 +
  206 +void MultiCookView::paintCurrentTime(QPainter &painter)
  207 +{
  208 + static const int padding = 10;
  209 +
  210 + int w = width();
  211 + int h = height();
  212 + int x = w * (2-timePosition) / 10;
  213 +
  214 + QPen pen(Qt::yellow);
  215 + pen.setWidth(3);
  216 + painter.setPen(pen);
  217 + painter.setBrush(Qt::NoBrush);
  218 + painter.drawLine(x, padding, x, h - padding);
  219 +}
  220 +
  221 +void MultiCookView::paintBar(QPainter &painter, QRect r)
  222 +{
  223 + static const int fullWidth = 281;
  224 + static const int headWidth = 7;
  225 + static const int tailWidth = fullWidth - 255;
  226 + static const int bodyWidth = fullWidth - headWidth - tailWidth;
  227 + static const int height = 56;
  228 +
  229 + static const int bodyOffset = headWidth;
  230 + static const int tailOffset = fullWidth - tailWidth;
  231 +
  232 + int w = r.width();
  233 + if (w < tailWidth)
  234 + {
  235 + // Clip tail
  236 + QRect sourceRect(tailWidth - w + tailOffset, 0, w, height);
  237 + painter.drawPixmap(r, barPixmap, sourceRect);
  238 + }
  239 + else if (w < headWidth + tailWidth)
  240 + {
  241 + // Full tail
  242 + QRect sourceRect(tailOffset, 0, tailWidth, height);
  243 + QRect targetRect(r.x() + w - tailWidth, r.y(), tailWidth, height);
  244 + painter.drawPixmap(targetRect, barPixmap, sourceRect);
  245 +
  246 + // Clip head
  247 +// sourceRect = QRect(0, 0, w - tailWidth, height);
  248 +// targetRect = QRect(r.x(), r.y(), w - tailWidth, height);
  249 +// painter.drawPixmap(targetRect, barPixmap, sourceRect);
  250 + sourceRect = QRect(headWidth - (w - tailWidth), 0, w - tailWidth, height);
  251 + targetRect = QRect(r.x(), r.y(), w - tailWidth, height);
  252 + painter.drawPixmap(targetRect, barPixmap, sourceRect);
  253 + }
  254 + else
  255 + {
  256 + // Full tail
  257 + QRect sourceRect(tailOffset, 0, tailWidth, height);
  258 + QRect targetRect(r.x() + w - tailWidth, r.y(), tailWidth, height);
  259 + painter.drawPixmap(targetRect, barPixmap, sourceRect);
  260 +
  261 + // Full head
  262 + sourceRect = QRect(0, 0, headWidth, height);
  263 + targetRect = QRect(r.x(), r.y(), headWidth, height);
  264 + painter.drawPixmap(targetRect, barPixmap, sourceRect);
  265 +
  266 + // Stretch body
  267 + sourceRect = QRect(bodyOffset, 0, bodyWidth, 0);
  268 + targetRect = QRect(r.x() + bodyOffset, r.y(), w - headWidth - tailWidth, height);
  269 + painter.drawPixmap(targetRect, barPixmap, sourceRect);
  270 + }
  271 +}
  272 +
  273 +bool MultiCookView::nothingOnRight()
  274 +{
  275 + int rightMost = width() * 2 / 3;
  276 +
  277 + foreach (QRect r, rects)
  278 + if (r.right() > rightMost)
  279 + return false;
  280 +
  281 + return true;
  282 +}
... ...
app/gui/oven_control/multicookview.h
... ... @@ -0,0 +1,64 @@
  1 +#ifndef MULTICOOKVIEW_H
  2 +#define MULTICOOKVIEW_H
  3 +
  4 +#include <QWidget>
  5 +#include <QPixmap>
  6 +#include <QTimer>
  7 +
  8 +#include "multicookcontainer.h"
  9 +#include "multicooktimebar.h"
  10 +
  11 +class MultiCookView : public QWidget
  12 +{
  13 + Q_OBJECT
  14 +public:
  15 + explicit MultiCookView(QWidget *parent = 0);
  16 +
  17 + void setContainer(MultiCookContainer *container);
  18 + void setTimeBar(MultiCookTimeBar *bar);
  19 +
  20 +signals:
  21 + void clicked(int);
  22 +
  23 +public slots:
  24 + void showNow();
  25 + void showNext();
  26 + void showPrev();
  27 + void updateView();
  28 +
  29 +protected:
  30 + virtual void mousePressEvent(QMouseEvent *event);
  31 + virtual void mouseReleaseEvent(QMouseEvent *event);
  32 + virtual void paintEvent(QPaintEvent *event);
  33 + virtual void resizeEvent(QResizeEvent *event);
  34 +
  35 +private:
  36 + // helper methods
  37 + QList<QRect> calcRects();
  38 + int calcSlot(int x, int y);
  39 + void paintGrids(QPainter &painter);
  40 + void paintBars(QPainter &painter);
  41 + void paintCurrentTime(QPainter &painter);
  42 + void paintBar(QPainter &painter, QRect r);
  43 + int currentTimePosition();
  44 + bool nothingOnRight();
  45 +
  46 + MultiCookContainer *container;
  47 + MultiCookTimeBar *bar;
  48 + QList<QRect> rects;
  49 + int timePosition;
  50 +
  51 + // for click signal
  52 + int pressedSlot;
  53 +
  54 + QPixmap barPixmap;
  55 +
  56 + QTimer checkTimer;
  57 +
  58 +private slots:
  59 + void check();
  60 +
  61 +};
  62 +
  63 +
  64 +#endif // MULTICOOKVIEW_H
... ...
app/gui/oven_control/multicookwindow.cpp
... ... @@ -0,0 +1,538 @@
  1 +#include "multicookwindow.h"
  2 +#include "ui_multicookwindow.h"
  3 +
  4 +#include <QDebug>
  5 +#include <QKeyEvent>
  6 +
  7 +#include "multimanualcook.h"
  8 +#include "multiautocook.h"
  9 +#include "multicookrecorder.h"
  10 +#include "multicookselectionwindow.h"
  11 +#include "oven.h"
  12 +#include "stringer.h"
  13 +#include "confirmpopup.h"
  14 +#include "configwindow.h"
  15 +#include "washwindow.h"
  16 +#include "mainwindow.h"
  17 +
  18 +MultiCookWindow::MultiCookWindow(QWidget *parent) :
  19 + QMainWindow(parent),
  20 + ui(new Ui::MultiCookWindow)
  21 +{
  22 + ui->setupUi(this);
  23 + setAttribute(Qt::WA_DeleteOnClose);
  24 +
  25 + controller = new MultiCookController(this);
  26 + container = new MultiCookContainer(this);
  27 + controller->setContainer(container);
  28 + ui->view->setContainer(container);
  29 + ui->view->setTimeBar(ui->bar);
  30 +
  31 +
  32 + buttons.append(ui->selectButton_1);
  33 + buttons.append(ui->selectButton_2);
  34 + buttons.append(ui->selectButton_3);
  35 + buttons.append(ui->selectButton_4);
  36 + buttons.append(ui->selectButton_5);
  37 + buttons.append(ui->selectButton_6);
  38 + buttons.append(ui->selectButton_7);
  39 + buttons.append(ui->selectButton_8);
  40 + buttons.append(ui->selectButton_9);
  41 + buttons.append(ui->selectButton_10);
  42 +
  43 + cookButtons.append(ui->cookButton_1);
  44 + cookButtons.append(ui->cookButton_2);
  45 + cookButtons.append(ui->cookButton_3);
  46 + cookButtons.append(ui->cookButton_4);
  47 + cookButtons.append(ui->cookButton_5);
  48 + cookButtons.append(ui->cookButton_6);
  49 + cookButtons.append(ui->cookButton_7);
  50 + cookButtons.append(ui->cookButton_8);
  51 + cookButtons.append(ui->cookButton_9);
  52 + cookButtons.append(ui->cookButton_10);
  53 + cookButtons.append(ui->cookButton_11);
  54 + cookButtons.append(ui->cookButton_12);
  55 +
  56 + mode = Define::InvalidMode;
  57 +
  58 + lastClickedButton = -1;
  59 + lastClickedCookButton = -1;
  60 + trashClicked = false;
  61 +
  62 + updateViewTimer.start(100);
  63 + connect(&updateViewTimer, SIGNAL(timeout()), SLOT(updateView()));
  64 +
  65 + setFocus();
  66 +
  67 + ui->closeDoorAnimationArea->hide();
  68 + ui->closeDoorAnimation->load(":/images/animation/door_big_09.png");
  69 + ui->closeDoorAnimation->load(":/images/animation/door_big_08.png");
  70 + ui->closeDoorAnimation->load(":/images/animation/door_big_07.png");
  71 + ui->closeDoorAnimation->load(":/images/animation/door_big_06.png");
  72 + ui->closeDoorAnimation->load(":/images/animation/door_big_05.png");
  73 + ui->closeDoorAnimation->load(":/images/animation/door_big_04.png");
  74 + ui->closeDoorAnimation->load(":/images/animation/door_big_03.png");
  75 + ui->closeDoorAnimation->load(":/images/animation/door_big_02.png");
  76 + ui->closeDoorAnimation->load(":/images/animation/door_big_01.png");
  77 + ui->closeDoorAnimation->start(300);
  78 +
  79 + ui->openDoorAnimationArea->hide();
  80 + ui->openDoorAnimation->load(":/images/animation/door_big_01.png");
  81 + ui->openDoorAnimation->load(":/images/animation/door_big_02.png");
  82 + ui->openDoorAnimation->load(":/images/animation/door_big_03.png");
  83 + ui->openDoorAnimation->load(":/images/animation/door_big_04.png");
  84 + ui->openDoorAnimation->load(":/images/animation/door_big_05.png");
  85 + ui->openDoorAnimation->load(":/images/animation/door_big_06.png");
  86 + ui->openDoorAnimation->load(":/images/animation/door_big_07.png");
  87 + ui->openDoorAnimation->load(":/images/animation/door_big_08.png");
  88 + ui->openDoorAnimation->load(":/images/animation/door_big_09.png");
  89 + ui->openDoorAnimation->start(300);
  90 +
  91 +}
  92 +
  93 +MultiCookWindow::~MultiCookWindow()
  94 +{
  95 + delete ui;
  96 +
  97 + Oven::getInstance()->stop();
  98 +}
  99 +
  100 +void MultiCookWindow::keyPressEvent(QKeyEvent *event)
  101 +{
  102 + switch (event->key())
  103 + {
  104 + case 0x01000032: // Turn left
  105 + onEncoderLeft();
  106 + break;
  107 + case 0x01000031: // Push
  108 + if (focusWidget() != this)
  109 + pushed = focusWidget();
  110 + break;
  111 + case 0x01000030: // Turn right
  112 + onEncoderRight();
  113 + break;
  114 + }
  115 +}
  116 +
  117 +void MultiCookWindow::keyReleaseEvent(QKeyEvent *event)
  118 +{
  119 + switch (event->key())
  120 + {
  121 + case 0x01000032: // Turn left
  122 + onEncoderLeft();
  123 + break;
  124 + case 0x01000031: // Push
  125 + if (focusWidget() == pushed)
  126 + onEncoderClicked(pushed);
  127 +
  128 + pushed = NULL;
  129 + break;
  130 + case 0x01000030: // Turn right
  131 + onEncoderRight();
  132 + break;
  133 + }
  134 +}
  135 +
  136 +void MultiCookWindow::updateView()
  137 +{
  138 + Oven *oven = Oven::getInstance();
  139 + if (controller->requireOpen() && !oven->door())
  140 + {
  141 + ui->blockingArea->setEnabled(false);
  142 + ui->closeDoorAnimationArea->hide();
  143 + ui->openDoorAnimationArea->show();
  144 + }
  145 + else if (controller->requireClose() && oven->door())
  146 + {
  147 + ui->blockingArea->setEnabled(false);
  148 + ui->closeDoorAnimationArea->show();
  149 + ui->openDoorAnimationArea->hide();
  150 + }
  151 + else
  152 + {
  153 + ui->blockingArea->setEnabled(true);
  154 + ui->closeDoorAnimationArea->hide();
  155 + ui->openDoorAnimationArea->hide();
  156 + }
  157 +
  158 +
  159 + QTime currentTime = QTime::currentTime();
  160 + ui->showNowButton->setText(QString("%1:%2")
  161 + .arg(currentTime.hour(), 2, 10, QLatin1Char('0'))
  162 + .arg(currentTime.minute(), 2, 10, QLatin1Char('0')));
  163 +
  164 + for (int i = 0; i < 10; i++)
  165 + {
  166 + QPushButton *button = buttons.at(i);
  167 +
  168 + MultiCook *cook = container->at(i);
  169 + if (cook == Q_NULLPTR)
  170 + button->setText("-");
  171 + else
  172 + button->setText(Stringer::time(cook->remainingTime()));
  173 + }
  174 +}
  175 +
  176 +void MultiCookWindow::handleButtonClick(int button)
  177 +{
  178 + MultiCook *cook = container->at(button);
  179 + if (cook)
  180 + {
  181 + if (trashClicked)
  182 + {
  183 + trashClicked = false;
  184 + container->remove(button);
  185 + cook->deleteLater();
  186 + }
  187 + else
  188 + {
  189 + if (lastClickedButton == -1)
  190 + lastClickedButton = button;
  191 + else
  192 + cook->setTime();
  193 + }
  194 + }
  195 + else
  196 + {
  197 + if (lastClickedCookButton != -1)
  198 + {
  199 + MultiCook *c = favorites.at(lastClickedCookButton)->clone(this);
  200 + addCook(button, c);
  201 +
  202 + lastClickedCookButton = -1;
  203 + }
  204 + else
  205 + {
  206 + lastClickedButton = button;
  207 +
  208 + ui->upperStack->setCurrentIndex(0);
  209 + setFocus();
  210 +
  211 + selectCook();
  212 + }
  213 + }
  214 +}
  215 +
  216 +void MultiCookWindow::handleFavoriteButtonClick(int button)
  217 +{
  218 + lastClickedCookButton = button;
  219 +}
  220 +
  221 +void MultiCookWindow::selectCook()
  222 +{
  223 + MultiCookSelectionWindow *w = new MultiCookSelectionWindow(this);
  224 +
  225 + if (mode != Define::InvalidMode)
  226 + w->setMode(mode);
  227 +
  228 + w->setWindowModality(Qt::WindowModal);
  229 + w->showFullScreen();
  230 + w->raise();
  231 +
  232 + connect(w, SIGNAL(selected(MultiCook*)), SLOT(onCookSelected(MultiCook*)));
  233 +}
  234 +
  235 +void MultiCookWindow::onCookSelected(MultiCook *cook)
  236 +{
  237 + cook->setParent(this);
  238 +
  239 + if (lastClickedButton != -1)
  240 + {
  241 + addCook(lastClickedButton, cook);
  242 + lastClickedButton = -1;
  243 + }
  244 +}
  245 +
  246 +void MultiCookWindow::showFavorites()
  247 +{
  248 + favorites = MultiCookRecorder::list();
  249 +
  250 + int max = qMin(12, favorites.size());
  251 + for (int i = 0; i < max; i++)
  252 + {
  253 + cookButtons.at(i)->show();
  254 + cookButtons.at(i)->setText(favorites.at(i)->name());
  255 + }
  256 +
  257 + for (int i = max; i < 12; i++)
  258 + cookButtons.at(i)->hide();
  259 +
  260 + ui->upperStack->setCurrentIndex(1);
  261 +}
  262 +
  263 +void MultiCookWindow::showClock()
  264 +{
  265 + ui->upperStack->setCurrentIndex(0);
  266 +}
  267 +
  268 +void MultiCookWindow::addCook(int slot, MultiCook *cook)
  269 +{
  270 + mode = cook->mode();
  271 + MultiCookRecorder::record(cook);
  272 + container->add(slot, cook);
  273 +}
  274 +
  275 +void MultiCookWindow::jumpConfig()
  276 +{
  277 + ConfigWindow *w = new ConfigWindow(MainWindow::getInstance());
  278 + w->setWindowModality(Qt::WindowModal);
  279 + w->showFullScreen();
  280 + w->raise();
  281 +
  282 + MainWindow::jump(w);
  283 +}
  284 +
  285 +void MultiCookWindow::jumpWash()
  286 +{
  287 + WashWindow *w = new WashWindow(MainWindow::getInstance());
  288 + w->setWindowModality(Qt::WindowModal);
  289 + w->showFullScreen();
  290 + w->raise();
  291 +
  292 + MainWindow::jump(w);
  293 +}
  294 +
  295 +void MultiCookWindow::on_showPrevButton_clicked()
  296 +{
  297 + ui->view->showPrev();
  298 +}
  299 +
  300 +void MultiCookWindow::on_showNowButton_clicked()
  301 +{
  302 + ui->view->showNow();
  303 +}
  304 +
  305 +void MultiCookWindow::on_showNextButton_clicked()
  306 +{
  307 + ui->view->showNext();
  308 +}
  309 +
  310 +void MultiCookWindow::on_showFavoritesButton_clicked()
  311 +{
  312 + if (ui->upperStack->currentIndex() == 0)
  313 + showFavorites();
  314 + else
  315 + showClock();
  316 +}
  317 +
  318 +void MultiCookWindow::on_backButton_clicked()
  319 +{
  320 + if (container->isEmpty() || container->isFinished())
  321 + {
  322 + close();
  323 + }
  324 + else
  325 + {
  326 + ConfirmPopup *p = new ConfirmPopup(this, tr("요리를 취소하시겠습니까?"));
  327 + p->showFullScreen();
  328 +
  329 + connect(p, SIGNAL(accepted()), SLOT(close()));
  330 + }
  331 +}
  332 +
  333 +void MultiCookWindow::on_configButton_clicked()
  334 +{
  335 + if (container->isEmpty() || container->isFinished())
  336 + {
  337 + jumpConfig();
  338 + }
  339 + else
  340 + {
  341 + ConfirmPopup *p = new ConfirmPopup(this, tr("요리를 취소하시겠습니까?"));
  342 + p->showFullScreen();
  343 +
  344 + connect(p, SIGNAL(accepted()), SLOT(jumpConfig()));
  345 + }
  346 +}
  347 +
  348 +void MultiCookWindow::on_washButton_clicked()
  349 +{
  350 + if (container->isEmpty() || container->isFinished())
  351 + {
  352 + jumpConfig();
  353 + }
  354 + else
  355 + {
  356 + ConfirmPopup *p = new ConfirmPopup(this, tr("요리를 취소하시겠습니까?"));
  357 + p->showFullScreen();
  358 +
  359 + connect(p, SIGNAL(accepted()), SLOT(jumpWash()));
  360 + }
  361 +}
  362 +
  363 +void MultiCookWindow::on_deleteButton_clicked()
  364 +{
  365 + trashClicked = true;
  366 +}
  367 +
  368 +void MultiCookWindow::on_helpButton_clicked()
  369 +{
  370 +
  371 +}
  372 +
  373 +void MultiCookWindow::onEncoderLeft()
  374 +{
  375 + MultiCook *c = Q_NULLPTR;
  376 +
  377 + if (lastClickedButton != -1)
  378 + {
  379 + QPushButton *b = buttons.at(lastClickedButton);
  380 + if (b == focusWidget())
  381 + c = container->at(lastClickedButton);
  382 + }
  383 +
  384 + if (c)
  385 + c->decreaseTime();
  386 + else
  387 + focusPreviousChild();
  388 +}
  389 +
  390 +void MultiCookWindow::onEncoderRight()
  391 +{
  392 + MultiCook *c = Q_NULLPTR;
  393 +
  394 + if (lastClickedButton != -1)
  395 + {
  396 + QPushButton *b = buttons.at(lastClickedButton);
  397 + if (b == focusWidget())
  398 + c = container->at(lastClickedButton);
  399 + }
  400 +
  401 + if (c)
  402 + c->increaseTime();
  403 + else
  404 + focusNextChild();
  405 +}
  406 +
  407 +void MultiCookWindow::onEncoderClicked(QWidget *clicked)
  408 +{
  409 + MultiCook *c = Q_NULLPTR;
  410 +
  411 + if (lastClickedButton != -1)
  412 + {
  413 + QPushButton *b = buttons.at(lastClickedButton);
  414 + if (b == focusWidget())
  415 + c = container->at(lastClickedButton);
  416 +
  417 + lastClickedButton = -1;
  418 + }
  419 +
  420 + if (c)
  421 + c->setTime();
  422 + else
  423 + {
  424 + QPushButton *b = qobject_cast<QPushButton *>(clicked);
  425 + if (b)
  426 + b->click();
  427 + }
  428 +}
  429 +
  430 +void MultiCookWindow::on_selectButton_1_clicked()
  431 +{
  432 + handleButtonClick(0);
  433 +}
  434 +
  435 +void MultiCookWindow::on_selectButton_2_clicked()
  436 +{
  437 + handleButtonClick(1);
  438 +}
  439 +
  440 +void MultiCookWindow::on_selectButton_3_clicked()
  441 +{
  442 + handleButtonClick(2);
  443 +}
  444 +
  445 +void MultiCookWindow::on_selectButton_4_clicked()
  446 +{
  447 + handleButtonClick(3);
  448 +}
  449 +
  450 +void MultiCookWindow::on_selectButton_5_clicked()
  451 +{
  452 + handleButtonClick(4);
  453 +}
  454 +
  455 +void MultiCookWindow::on_selectButton_6_clicked()
  456 +{
  457 + handleButtonClick(5);
  458 +}
  459 +
  460 +void MultiCookWindow::on_selectButton_7_clicked()
  461 +{
  462 + handleButtonClick(6);
  463 +}
  464 +
  465 +void MultiCookWindow::on_selectButton_8_clicked()
  466 +{
  467 + handleButtonClick(7);
  468 +}
  469 +
  470 +void MultiCookWindow::on_selectButton_9_clicked()
  471 +{
  472 + handleButtonClick(8);
  473 +}
  474 +
  475 +void MultiCookWindow::on_selectButton_10_clicked()
  476 +{
  477 + handleButtonClick(9);
  478 +}
  479 +
  480 +void MultiCookWindow::on_cookButton_1_clicked()
  481 +{
  482 + handleFavoriteButtonClick(0);
  483 +}
  484 +
  485 +void MultiCookWindow::on_cookButton_2_clicked()
  486 +{
  487 + handleFavoriteButtonClick(1);
  488 +}
  489 +
  490 +void MultiCookWindow::on_cookButton_3_clicked()
  491 +{
  492 + handleFavoriteButtonClick(2);
  493 +}
  494 +
  495 +void MultiCookWindow::on_cookButton_4_clicked()
  496 +{
  497 + handleFavoriteButtonClick(3);
  498 +}
  499 +
  500 +void MultiCookWindow::on_cookButton_5_clicked()
  501 +{
  502 + handleFavoriteButtonClick(4);
  503 +}
  504 +
  505 +void MultiCookWindow::on_cookButton_6_clicked()
  506 +{
  507 + handleFavoriteButtonClick(5);
  508 +}
  509 +
  510 +void MultiCookWindow::on_cookButton_7_clicked()
  511 +{
  512 + handleFavoriteButtonClick(6);
  513 +}
  514 +
  515 +void MultiCookWindow::on_cookButton_8_clicked()
  516 +{
  517 + handleFavoriteButtonClick(7);
  518 +}
  519 +
  520 +void MultiCookWindow::on_cookButton_9_clicked()
  521 +{
  522 + handleFavoriteButtonClick(8);
  523 +}
  524 +
  525 +void MultiCookWindow::on_cookButton_10_clicked()
  526 +{
  527 + handleFavoriteButtonClick(9);
  528 +}
  529 +
  530 +void MultiCookWindow::on_cookButton_11_clicked()
  531 +{
  532 + handleFavoriteButtonClick(10);
  533 +}
  534 +
  535 +void MultiCookWindow::on_cookButton_12_clicked()
  536 +{
  537 + handleFavoriteButtonClick(11);
  538 +}
... ...
app/gui/oven_control/multicookwindow.h
... ... @@ -0,0 +1,96 @@
  1 +#ifndef MULTICOOKWINDOW_H
  2 +#define MULTICOOKWINDOW_H
  3 +
  4 +#include <QMainWindow>
  5 +#include <QPushButton>
  6 +
  7 +#include "multicookview.h"
  8 +#include "multicookcontroller.h"
  9 +
  10 +namespace Ui {
  11 +class MultiCookWindow;
  12 +}
  13 +
  14 +class MultiCookWindow : public QMainWindow
  15 +{
  16 + Q_OBJECT
  17 +
  18 +public:
  19 + explicit MultiCookWindow(QWidget *parent = 0);
  20 + ~MultiCookWindow();
  21 +
  22 +protected:
  23 + void keyPressEvent(QKeyEvent *event);
  24 + void keyReleaseEvent(QKeyEvent *event);
  25 +
  26 +private slots:
  27 + void updateView();
  28 + void handleButtonClick(int button);
  29 + void handleFavoriteButtonClick(int button);
  30 + void selectCook();
  31 + void onCookSelected(MultiCook *cook);
  32 + void showFavorites();
  33 + void showClock();
  34 + void addCook(int slot, MultiCook *cook);
  35 + void jumpConfig();
  36 + void jumpWash();
  37 +
  38 + void on_showPrevButton_clicked();
  39 + void on_showNowButton_clicked();
  40 + void on_showNextButton_clicked();
  41 + void on_showFavoritesButton_clicked();
  42 +
  43 + void on_backButton_clicked();
  44 + void on_configButton_clicked();
  45 + void on_washButton_clicked();
  46 + void on_deleteButton_clicked();
  47 + void on_helpButton_clicked();
  48 +
  49 + void onEncoderLeft();
  50 + void onEncoderRight();
  51 + void onEncoderClicked(QWidget *clicked);
  52 +
  53 + void on_selectButton_1_clicked();
  54 + void on_selectButton_2_clicked();
  55 + void on_selectButton_3_clicked();
  56 + void on_selectButton_4_clicked();
  57 + void on_selectButton_5_clicked();
  58 + void on_selectButton_6_clicked();
  59 + void on_selectButton_7_clicked();
  60 + void on_selectButton_8_clicked();
  61 + void on_selectButton_9_clicked();
  62 + void on_selectButton_10_clicked();
  63 +
  64 + void on_cookButton_1_clicked();
  65 + void on_cookButton_2_clicked();
  66 + void on_cookButton_3_clicked();
  67 + void on_cookButton_4_clicked();
  68 + void on_cookButton_5_clicked();
  69 + void on_cookButton_6_clicked();
  70 + void on_cookButton_7_clicked();
  71 + void on_cookButton_8_clicked();
  72 + void on_cookButton_9_clicked();
  73 + void on_cookButton_10_clicked();
  74 + void on_cookButton_11_clicked();
  75 + void on_cookButton_12_clicked();
  76 +
  77 +private:
  78 + Ui::MultiCookWindow *ui;
  79 +
  80 + MultiCookContainer *container;
  81 + MultiCookController *controller;
  82 +
  83 + QList<QPushButton *> buttons;
  84 + QList<QPushButton *> cookButtons;
  85 + QList<MultiCook *> favorites;
  86 + QTimer updateViewTimer;
  87 +
  88 + int lastClickedButton;
  89 + int lastClickedCookButton;
  90 + bool trashClicked;
  91 +
  92 + Define::Mode mode;
  93 + QWidget *pushed = NULL;
  94 +};
  95 +
  96 +#endif // MULTICOOKWINDOW_H
... ...
app/gui/oven_control/multicookwindow.ui
... ... @@ -0,0 +1,1283 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<ui version="4.0">
  3 + <class>MultiCookWindow</class>
  4 + <widget class="QMainWindow" name="MultiCookWindow">
  5 + <property name="geometry">
  6 + <rect>
  7 + <x>0</x>
  8 + <y>0</y>
  9 + <width>900</width>
  10 + <height>1600</height>
  11 + </rect>
  12 + </property>
  13 + <property name="windowTitle">
  14 + <string>MainWindow</string>
  15 + </property>
  16 + <property name="styleSheet">
  17 + <string notr="true">#centralwidget { background-image: url(:/images/background/original.png); }
  18 +#bottomBar { background-image: url(:/images/bottom_bar/background.png); }
  19 +
  20 +QWidget { etch-disabled-text: 0; }
  21 +QPushButton {
  22 +background-position: center;
  23 +background-repeat: no-repeat;
  24 +border: none;
  25 +}
  26 +
  27 +QPushButton[style=&quot;select&quot;]
  28 +{ background-image: url(:/images/button/154.png); }
  29 +QPushButton[style=&quot;select&quot;]:pressed,
  30 +QPushButton[style=&quot;select&quot;]:focus
  31 +{ background-image: url(:/images/button/154_ov.png); }
  32 +
  33 +QPushButton[style=&quot;favorite&quot;]
  34 +{ background-image: url(:/images/button/288.png); }
  35 +QPushButton[style=&quot;favorite&quot;]:pressed,
  36 +QPushButton[style=&quot;favorite&quot;]:focus
  37 +{ background-image: url(:/images/button/288_ov.png); }
  38 +
  39 +QLabel[style=&quot;slotLabel&quot;] { color: #C4C4C4; font-size: 24px; font-style: bold; }</string>
  40 + </property>
  41 + <widget class="QWidget" name="centralwidget">
  42 + <widget class="QWidget" name="closeDoorAnimationArea" native="true">
  43 + <property name="geometry">
  44 + <rect>
  45 + <x>0</x>
  46 + <y>426</y>
  47 + <width>900</width>
  48 + <height>1024</height>
  49 + </rect>
  50 + </property>
  51 + <widget class="AnimatedImageBox" name="closeDoorAnimation">
  52 + <property name="geometry">
  53 + <rect>
  54 + <x>366</x>
  55 + <y>366</y>
  56 + <width>251</width>
  57 + <height>292</height>
  58 + </rect>
  59 + </property>
  60 + </widget>
  61 + <widget class="QLabel" name="closeDoorArrow">
  62 + <property name="geometry">
  63 + <rect>
  64 + <x>440</x>
  65 + <y>520</y>
  66 + <width>85</width>
  67 + <height>24</height>
  68 + </rect>
  69 + </property>
  70 + <property name="pixmap">
  71 + <pixmap resource="resources.qrc">:/images/animation/close_door_arrow.png</pixmap>
  72 + </property>
  73 + </widget>
  74 + </widget>
  75 + <widget class="QWidget" name="openDoorAnimationArea" native="true">
  76 + <property name="geometry">
  77 + <rect>
  78 + <x>0</x>
  79 + <y>426</y>
  80 + <width>900</width>
  81 + <height>1024</height>
  82 + </rect>
  83 + </property>
  84 + <widget class="AnimatedImageBox" name="openDoorAnimation">
  85 + <property name="geometry">
  86 + <rect>
  87 + <x>366</x>
  88 + <y>366</y>
  89 + <width>251</width>
  90 + <height>292</height>
  91 + </rect>
  92 + </property>
  93 + </widget>
  94 + <widget class="QLabel" name="openDoorArrow">
  95 + <property name="geometry">
  96 + <rect>
  97 + <x>440</x>
  98 + <y>520</y>
  99 + <width>85</width>
  100 + <height>24</height>
  101 + </rect>
  102 + </property>
  103 + <property name="pixmap">
  104 + <pixmap resource="resources.qrc">:/images/animation/open_door_arrow.png</pixmap>
  105 + </property>
  106 + </widget>
  107 + </widget>
  108 + <widget class="QWidget" name="blockingArea" native="true">
  109 + <property name="geometry">
  110 + <rect>
  111 + <x>0</x>
  112 + <y>0</y>
  113 + <width>900</width>
  114 + <height>1450</height>
  115 + </rect>
  116 + </property>
  117 + <widget class="QPushButton" name="showPrevButton">
  118 + <property name="geometry">
  119 + <rect>
  120 + <x>0</x>
  121 + <y>1314</y>
  122 + <width>70</width>
  123 + <height>136</height>
  124 + </rect>
  125 + </property>
  126 + <property name="styleSheet">
  127 + <string notr="true">QPushButton
  128 +{ background-image: url(:/images/auto_button/prev_step.png); }
  129 +QPushButton:pressed,
  130 +QPushButton:focus
  131 +{ background-image: url(:/images/auto_button/prev_step_ov.png); }</string>
  132 + </property>
  133 + </widget>
  134 + <widget class="QPushButton" name="showNextButton">
  135 + <property name="geometry">
  136 + <rect>
  137 + <x>830</x>
  138 + <y>1314</y>
  139 + <width>70</width>
  140 + <height>136</height>
  141 + </rect>
  142 + </property>
  143 + <property name="styleSheet">
  144 + <string notr="true">QPushButton
  145 +{ background-image: url(:/images/auto_button/next_step.png); }
  146 +QPushButton:pressed,
  147 +QPushButton:focus
  148 +{ background-image: url(:/images/auto_button/next_step_ov.png); }</string>
  149 + </property>
  150 + </widget>
  151 + <widget class="QPushButton" name="showNowButton">
  152 + <property name="geometry">
  153 + <rect>
  154 + <x>70</x>
  155 + <y>1314</y>
  156 + <width>85</width>
  157 + <height>136</height>
  158 + </rect>
  159 + </property>
  160 + <property name="font">
  161 + <font>
  162 + <pointsize>-1</pointsize>
  163 + <weight>75</weight>
  164 + <bold>true</bold>
  165 + </font>
  166 + </property>
  167 + <property name="styleSheet">
  168 + <string notr="true">QPushButton
  169 +{ background-image: url(:/images/multi/button.png); font-size: 24px; font-weight: bold; }
  170 +QPushButton:pressed,
  171 +QPushButton:focus
  172 +{ background-image: url(:/images/multi/button_ov.png); }</string>
  173 + </property>
  174 + </widget>
  175 + <widget class="QPushButton" name="showFavoritesButton">
  176 + <property name="geometry">
  177 + <rect>
  178 + <x>160</x>
  179 + <y>1314</y>
  180 + <width>85</width>
  181 + <height>136</height>
  182 + </rect>
  183 + </property>
  184 + <property name="styleSheet">
  185 + <string notr="true">QPushButton
  186 +{ background-image: url(:/images/multi/button.png); }
  187 +QPushButton:pressed,
  188 +QPushButton:focus
  189 +{ background-image: url(:/images/multi/button_ov.png); }</string>
  190 + </property>
  191 + <property name="icon">
  192 + <iconset resource="resources.qrc">
  193 + <normaloff>:/images/multi/icon_prime.png</normaloff>:/images/multi/icon_prime.png</iconset>
  194 + </property>
  195 + <property name="iconSize">
  196 + <size>
  197 + <width>50</width>
  198 + <height>57</height>
  199 + </size>
  200 + </property>
  201 + </widget>
  202 + <widget class="MultiCookView" name="view" native="true">
  203 + <property name="geometry">
  204 + <rect>
  205 + <x>215</x>
  206 + <y>554</y>
  207 + <width>685</width>
  208 + <height>760</height>
  209 + </rect>
  210 + </property>
  211 + </widget>
  212 + <widget class="MultiCookTimeBar" name="bar" native="true">
  213 + <property name="geometry">
  214 + <rect>
  215 + <x>200</x>
  216 + <y>1314</y>
  217 + <width>700</width>
  218 + <height>136</height>
  219 + </rect>
  220 + </property>
  221 + <property name="font">
  222 + <font>
  223 + <weight>75</weight>
  224 + <bold>true</bold>
  225 + </font>
  226 + </property>
  227 + </widget>
  228 + <widget class="QPushButton" name="selectButton_1">
  229 + <property name="geometry">
  230 + <rect>
  231 + <x>0</x>
  232 + <y>554</y>
  233 + <width>200</width>
  234 + <height>76</height>
  235 + </rect>
  236 + </property>
  237 + <property name="style" stdset="0">
  238 + <string notr="true">select</string>
  239 + </property>
  240 + </widget>
  241 + <widget class="QPushButton" name="selectButton_2">
  242 + <property name="geometry">
  243 + <rect>
  244 + <x>0</x>
  245 + <y>630</y>
  246 + <width>200</width>
  247 + <height>76</height>
  248 + </rect>
  249 + </property>
  250 + <property name="style" stdset="0">
  251 + <string notr="true">select</string>
  252 + </property>
  253 + </widget>
  254 + <widget class="QPushButton" name="selectButton_3">
  255 + <property name="geometry">
  256 + <rect>
  257 + <x>0</x>
  258 + <y>706</y>
  259 + <width>200</width>
  260 + <height>76</height>
  261 + </rect>
  262 + </property>
  263 + <property name="style" stdset="0">
  264 + <string notr="true">select</string>
  265 + </property>
  266 + </widget>
  267 + <widget class="QPushButton" name="selectButton_4">
  268 + <property name="geometry">
  269 + <rect>
  270 + <x>0</x>
  271 + <y>782</y>
  272 + <width>200</width>
  273 + <height>76</height>
  274 + </rect>
  275 + </property>
  276 + <property name="style" stdset="0">
  277 + <string notr="true">select</string>
  278 + </property>
  279 + </widget>
  280 + <widget class="QPushButton" name="selectButton_5">
  281 + <property name="geometry">
  282 + <rect>
  283 + <x>0</x>
  284 + <y>858</y>
  285 + <width>200</width>
  286 + <height>76</height>
  287 + </rect>
  288 + </property>
  289 + <property name="style" stdset="0">
  290 + <string notr="true">select</string>
  291 + </property>
  292 + </widget>
  293 + <widget class="QPushButton" name="selectButton_6">
  294 + <property name="geometry">
  295 + <rect>
  296 + <x>0</x>
  297 + <y>934</y>
  298 + <width>200</width>
  299 + <height>76</height>
  300 + </rect>
  301 + </property>
  302 + <property name="style" stdset="0">
  303 + <string notr="true">select</string>
  304 + </property>
  305 + </widget>
  306 + <widget class="QPushButton" name="selectButton_7">
  307 + <property name="geometry">
  308 + <rect>
  309 + <x>0</x>
  310 + <y>1010</y>
  311 + <width>200</width>
  312 + <height>76</height>
  313 + </rect>
  314 + </property>
  315 + <property name="style" stdset="0">
  316 + <string notr="true">select</string>
  317 + </property>
  318 + </widget>
  319 + <widget class="QPushButton" name="selectButton_8">
  320 + <property name="geometry">
  321 + <rect>
  322 + <x>0</x>
  323 + <y>1086</y>
  324 + <width>200</width>
  325 + <height>76</height>
  326 + </rect>
  327 + </property>
  328 + <property name="style" stdset="0">
  329 + <string notr="true">select</string>
  330 + </property>
  331 + </widget>
  332 + <widget class="QPushButton" name="selectButton_9">
  333 + <property name="geometry">
  334 + <rect>
  335 + <x>0</x>
  336 + <y>1162</y>
  337 + <width>200</width>
  338 + <height>76</height>
  339 + </rect>
  340 + </property>
  341 + <property name="style" stdset="0">
  342 + <string notr="true">select</string>
  343 + </property>
  344 + </widget>
  345 + <widget class="QPushButton" name="selectButton_10">
  346 + <property name="geometry">
  347 + <rect>
  348 + <x>0</x>
  349 + <y>1238</y>
  350 + <width>200</width>
  351 + <height>76</height>
  352 + </rect>
  353 + </property>
  354 + <property name="style" stdset="0">
  355 + <string notr="true">select</string>
  356 + </property>
  357 + </widget>
  358 + <widget class="QStackedWidget" name="upperStack">
  359 + <property name="geometry">
  360 + <rect>
  361 + <x>0</x>
  362 + <y>0</y>
  363 + <width>900</width>
  364 + <height>426</height>
  365 + </rect>
  366 + </property>
  367 + <widget class="QWidget" name="clockContainer">
  368 + <property name="styleSheet">
  369 + <string notr="true">#clockContainer { background-image: url(:/images/clock/background.png); }</string>
  370 + </property>
  371 + <widget class="Clock" name="clock" native="true">
  372 + <property name="geometry">
  373 + <rect>
  374 + <x>272</x>
  375 + <y>36</y>
  376 + <width>356</width>
  377 + <height>355</height>
  378 + </rect>
  379 + </property>
  380 + </widget>
  381 + <widget class="WashWarnIcon" name="label_2">
  382 + <property name="geometry">
  383 + <rect>
  384 + <x>800</x>
  385 + <y>320</y>
  386 + <width>80</width>
  387 + <height>84</height>
  388 + </rect>
  389 + </property>
  390 + </widget>
  391 + <widget class="DemoIcon" name="label_3">
  392 + <property name="geometry">
  393 + <rect>
  394 + <x>780</x>
  395 + <y>230</y>
  396 + <width>101</width>
  397 + <height>90</height>
  398 + </rect>
  399 + </property>
  400 + </widget>
  401 + <widget class="HalfEnergyIcon" name="label_4">
  402 + <property name="geometry">
  403 + <rect>
  404 + <x>780</x>
  405 + <y>160</y>
  406 + <width>108</width>
  407 + <height>67</height>
  408 + </rect>
  409 + </property>
  410 + </widget>
  411 + <widget class="DigitalClock" name="label_5">
  412 + <property name="geometry">
  413 + <rect>
  414 + <x>20</x>
  415 + <y>310</y>
  416 + <width>600</width>
  417 + <height>100</height>
  418 + </rect>
  419 + </property>
  420 + <property name="alignment">
  421 + <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
  422 + </property>
  423 + </widget>
  424 + </widget>
  425 + <widget class="QWidget" name="favoritesContainer">
  426 + <property name="styleSheet">
  427 + <string notr="true">#progressContainer { background-image: url(:/images/clock/background.png); }</string>
  428 + </property>
  429 + <widget class="QLabel" name="titleLabel">
  430 + <property name="enabled">
  431 + <bool>true</bool>
  432 + </property>
  433 + <property name="geometry">
  434 + <rect>
  435 + <x>0</x>
  436 + <y>0</y>
  437 + <width>900</width>
  438 + <height>88</height>
  439 + </rect>
  440 + </property>
  441 + <property name="palette">
  442 + <palette>
  443 + <active>
  444 + <colorrole role="WindowText">
  445 + <brush brushstyle="SolidPattern">
  446 + <color alpha="255">
  447 + <red>255</red>
  448 + <green>255</green>
  449 + <blue>255</blue>
  450 + </color>
  451 + </brush>
  452 + </colorrole>
  453 + </active>
  454 + <inactive>
  455 + <colorrole role="WindowText">
  456 + <brush brushstyle="SolidPattern">
  457 + <color alpha="255">
  458 + <red>255</red>
  459 + <green>255</green>
  460 + <blue>255</blue>
  461 + </color>
  462 + </brush>
  463 + </colorrole>
  464 + </inactive>
  465 + <disabled>
  466 + <colorrole role="WindowText">
  467 + <brush brushstyle="SolidPattern">
  468 + <color alpha="255">
  469 + <red>123</red>
  470 + <green>123</green>
  471 + <blue>123</blue>
  472 + </color>
  473 + </brush>
  474 + </colorrole>
  475 + </disabled>
  476 + </palette>
  477 + </property>
  478 + <property name="font">
  479 + <font>
  480 + <family>Roboto</family>
  481 + <pointsize>13</pointsize>
  482 + <weight>75</weight>
  483 + <bold>true</bold>
  484 + </font>
  485 + </property>
  486 + <property name="text">
  487 + <string>다중 요리 즐겨찾기 목록입니다</string>
  488 + </property>
  489 + <property name="alignment">
  490 + <set>Qt::AlignCenter</set>
  491 + </property>
  492 + </widget>
  493 + <widget class="Line" name="line">
  494 + <property name="geometry">
  495 + <rect>
  496 + <x>0</x>
  497 + <y>88</y>
  498 + <width>900</width>
  499 + <height>1</height>
  500 + </rect>
  501 + </property>
  502 + <property name="orientation">
  503 + <enum>Qt::Horizontal</enum>
  504 + </property>
  505 + </widget>
  506 + <widget class="QPushButton" name="cookButton_1">
  507 + <property name="geometry">
  508 + <rect>
  509 + <x>0</x>
  510 + <y>102</y>
  511 + <width>300</width>
  512 + <height>70</height>
  513 + </rect>
  514 + </property>
  515 + <property name="font">
  516 + <font>
  517 + <weight>75</weight>
  518 + <bold>true</bold>
  519 + </font>
  520 + </property>
  521 + <property name="style" stdset="0">
  522 + <string notr="true">favorite</string>
  523 + </property>
  524 + </widget>
  525 + <widget class="QPushButton" name="cookButton_2">
  526 + <property name="geometry">
  527 + <rect>
  528 + <x>300</x>
  529 + <y>102</y>
  530 + <width>300</width>
  531 + <height>70</height>
  532 + </rect>
  533 + </property>
  534 + <property name="font">
  535 + <font>
  536 + <weight>75</weight>
  537 + <bold>true</bold>
  538 + </font>
  539 + </property>
  540 + <property name="style" stdset="0">
  541 + <string notr="true">favorite</string>
  542 + </property>
  543 + </widget>
  544 + <widget class="QPushButton" name="cookButton_3">
  545 + <property name="geometry">
  546 + <rect>
  547 + <x>600</x>
  548 + <y>102</y>
  549 + <width>300</width>
  550 + <height>70</height>
  551 + </rect>
  552 + </property>
  553 + <property name="font">
  554 + <font>
  555 + <weight>75</weight>
  556 + <bold>true</bold>
  557 + </font>
  558 + </property>
  559 + <property name="style" stdset="0">
  560 + <string notr="true">favorite</string>
  561 + </property>
  562 + </widget>
  563 + <widget class="QPushButton" name="cookButton_4">
  564 + <property name="geometry">
  565 + <rect>
  566 + <x>0</x>
  567 + <y>182</y>
  568 + <width>300</width>
  569 + <height>70</height>
  570 + </rect>
  571 + </property>
  572 + <property name="font">
  573 + <font>
  574 + <weight>75</weight>
  575 + <bold>true</bold>
  576 + </font>
  577 + </property>
  578 + <property name="style" stdset="0">
  579 + <string notr="true">favorite</string>
  580 + </property>
  581 + </widget>
  582 + <widget class="QPushButton" name="cookButton_6">
  583 + <property name="geometry">
  584 + <rect>
  585 + <x>600</x>
  586 + <y>182</y>
  587 + <width>300</width>
  588 + <height>70</height>
  589 + </rect>
  590 + </property>
  591 + <property name="font">
  592 + <font>
  593 + <weight>75</weight>
  594 + <bold>true</bold>
  595 + </font>
  596 + </property>
  597 + <property name="style" stdset="0">
  598 + <string notr="true">favorite</string>
  599 + </property>
  600 + </widget>
  601 + <widget class="QPushButton" name="cookButton_5">
  602 + <property name="geometry">
  603 + <rect>
  604 + <x>300</x>
  605 + <y>182</y>
  606 + <width>300</width>
  607 + <height>70</height>
  608 + </rect>
  609 + </property>
  610 + <property name="font">
  611 + <font>
  612 + <weight>75</weight>
  613 + <bold>true</bold>
  614 + </font>
  615 + </property>
  616 + <property name="style" stdset="0">
  617 + <string notr="true">favorite</string>
  618 + </property>
  619 + </widget>
  620 + <widget class="QPushButton" name="cookButton_9">
  621 + <property name="geometry">
  622 + <rect>
  623 + <x>600</x>
  624 + <y>262</y>
  625 + <width>300</width>
  626 + <height>70</height>
  627 + </rect>
  628 + </property>
  629 + <property name="font">
  630 + <font>
  631 + <weight>75</weight>
  632 + <bold>true</bold>
  633 + </font>
  634 + </property>
  635 + <property name="style" stdset="0">
  636 + <string notr="true">favorite</string>
  637 + </property>
  638 + </widget>
  639 + <widget class="QPushButton" name="cookButton_7">
  640 + <property name="geometry">
  641 + <rect>
  642 + <x>0</x>
  643 + <y>262</y>
  644 + <width>300</width>
  645 + <height>70</height>
  646 + </rect>
  647 + </property>
  648 + <property name="font">
  649 + <font>
  650 + <weight>75</weight>
  651 + <bold>true</bold>
  652 + </font>
  653 + </property>
  654 + <property name="style" stdset="0">
  655 + <string notr="true">favorite</string>
  656 + </property>
  657 + </widget>
  658 + <widget class="QPushButton" name="cookButton_8">
  659 + <property name="geometry">
  660 + <rect>
  661 + <x>300</x>
  662 + <y>262</y>
  663 + <width>300</width>
  664 + <height>70</height>
  665 + </rect>
  666 + </property>
  667 + <property name="font">
  668 + <font>
  669 + <weight>75</weight>
  670 + <bold>true</bold>
  671 + </font>
  672 + </property>
  673 + <property name="style" stdset="0">
  674 + <string notr="true">favorite</string>
  675 + </property>
  676 + </widget>
  677 + <widget class="QPushButton" name="cookButton_10">
  678 + <property name="geometry">
  679 + <rect>
  680 + <x>0</x>
  681 + <y>342</y>
  682 + <width>300</width>
  683 + <height>70</height>
  684 + </rect>
  685 + </property>
  686 + <property name="font">
  687 + <font>
  688 + <weight>75</weight>
  689 + <bold>true</bold>
  690 + </font>
  691 + </property>
  692 + <property name="style" stdset="0">
  693 + <string notr="true">favorite</string>
  694 + </property>
  695 + </widget>
  696 + <widget class="QPushButton" name="cookButton_11">
  697 + <property name="geometry">
  698 + <rect>
  699 + <x>300</x>
  700 + <y>342</y>
  701 + <width>300</width>
  702 + <height>70</height>
  703 + </rect>
  704 + </property>
  705 + <property name="font">
  706 + <font>
  707 + <weight>75</weight>
  708 + <bold>true</bold>
  709 + </font>
  710 + </property>
  711 + <property name="style" stdset="0">
  712 + <string notr="true">favorite</string>
  713 + </property>
  714 + </widget>
  715 + <widget class="QPushButton" name="cookButton_12">
  716 + <property name="geometry">
  717 + <rect>
  718 + <x>600</x>
  719 + <y>342</y>
  720 + <width>300</width>
  721 + <height>70</height>
  722 + </rect>
  723 + </property>
  724 + <property name="font">
  725 + <font>
  726 + <weight>75</weight>
  727 + <bold>true</bold>
  728 + </font>
  729 + </property>
  730 + <property name="style" stdset="0">
  731 + <string notr="true">favorite</string>
  732 + </property>
  733 + </widget>
  734 + </widget>
  735 + </widget>
  736 + <widget class="QLabel" name="slotLabel_1">
  737 + <property name="geometry">
  738 + <rect>
  739 + <x>170</x>
  740 + <y>554</y>
  741 + <width>50</width>
  742 + <height>76</height>
  743 + </rect>
  744 + </property>
  745 + <property name="font">
  746 + <font>
  747 + <pointsize>-1</pointsize>
  748 + </font>
  749 + </property>
  750 + <property name="text">
  751 + <string notr="true">01</string>
  752 + </property>
  753 + <property name="alignment">
  754 + <set>Qt::AlignCenter</set>
  755 + </property>
  756 + <property name="style" stdset="0">
  757 + <string>slotLabel</string>
  758 + </property>
  759 + </widget>
  760 + <widget class="QLabel" name="slotLabel_2">
  761 + <property name="geometry">
  762 + <rect>
  763 + <x>170</x>
  764 + <y>630</y>
  765 + <width>50</width>
  766 + <height>76</height>
  767 + </rect>
  768 + </property>
  769 + <property name="font">
  770 + <font>
  771 + <pointsize>-1</pointsize>
  772 + </font>
  773 + </property>
  774 + <property name="text">
  775 + <string notr="true">02</string>
  776 + </property>
  777 + <property name="alignment">
  778 + <set>Qt::AlignCenter</set>
  779 + </property>
  780 + <property name="style" stdset="0">
  781 + <string>slotLabel</string>
  782 + </property>
  783 + </widget>
  784 + <widget class="QLabel" name="slotLabel_3">
  785 + <property name="geometry">
  786 + <rect>
  787 + <x>170</x>
  788 + <y>706</y>
  789 + <width>50</width>
  790 + <height>76</height>
  791 + </rect>
  792 + </property>
  793 + <property name="font">
  794 + <font>
  795 + <pointsize>-1</pointsize>
  796 + </font>
  797 + </property>
  798 + <property name="text">
  799 + <string notr="true">03</string>
  800 + </property>
  801 + <property name="alignment">
  802 + <set>Qt::AlignCenter</set>
  803 + </property>
  804 + <property name="style" stdset="0">
  805 + <string>slotLabel</string>
  806 + </property>
  807 + </widget>
  808 + <widget class="QLabel" name="slotLabel_4">
  809 + <property name="geometry">
  810 + <rect>
  811 + <x>170</x>
  812 + <y>782</y>
  813 + <width>50</width>
  814 + <height>76</height>
  815 + </rect>
  816 + </property>
  817 + <property name="font">
  818 + <font>
  819 + <pointsize>-1</pointsize>
  820 + </font>
  821 + </property>
  822 + <property name="text">
  823 + <string notr="true">04</string>
  824 + </property>
  825 + <property name="alignment">
  826 + <set>Qt::AlignCenter</set>
  827 + </property>
  828 + <property name="style" stdset="0">
  829 + <string>slotLabel</string>
  830 + </property>
  831 + </widget>
  832 + <widget class="QLabel" name="slotLabel_5">
  833 + <property name="geometry">
  834 + <rect>
  835 + <x>170</x>
  836 + <y>858</y>
  837 + <width>50</width>
  838 + <height>76</height>
  839 + </rect>
  840 + </property>
  841 + <property name="font">
  842 + <font>
  843 + <pointsize>-1</pointsize>
  844 + </font>
  845 + </property>
  846 + <property name="text">
  847 + <string notr="true">05</string>
  848 + </property>
  849 + <property name="alignment">
  850 + <set>Qt::AlignCenter</set>
  851 + </property>
  852 + <property name="style" stdset="0">
  853 + <string>slotLabel</string>
  854 + </property>
  855 + </widget>
  856 + <widget class="QLabel" name="slotLabel_6">
  857 + <property name="geometry">
  858 + <rect>
  859 + <x>170</x>
  860 + <y>934</y>
  861 + <width>50</width>
  862 + <height>76</height>
  863 + </rect>
  864 + </property>
  865 + <property name="font">
  866 + <font>
  867 + <pointsize>-1</pointsize>
  868 + </font>
  869 + </property>
  870 + <property name="text">
  871 + <string notr="true">06</string>
  872 + </property>
  873 + <property name="alignment">
  874 + <set>Qt::AlignCenter</set>
  875 + </property>
  876 + <property name="style" stdset="0">
  877 + <string>slotLabel</string>
  878 + </property>
  879 + </widget>
  880 + <widget class="QLabel" name="slotLabel_7">
  881 + <property name="geometry">
  882 + <rect>
  883 + <x>170</x>
  884 + <y>1010</y>
  885 + <width>50</width>
  886 + <height>76</height>
  887 + </rect>
  888 + </property>
  889 + <property name="font">
  890 + <font>
  891 + <pointsize>-1</pointsize>
  892 + </font>
  893 + </property>
  894 + <property name="text">
  895 + <string notr="true">07</string>
  896 + </property>
  897 + <property name="alignment">
  898 + <set>Qt::AlignCenter</set>
  899 + </property>
  900 + <property name="style" stdset="0">
  901 + <string>slotLabel</string>
  902 + </property>
  903 + </widget>
  904 + <widget class="QLabel" name="slotLabel_8">
  905 + <property name="geometry">
  906 + <rect>
  907 + <x>170</x>
  908 + <y>1086</y>
  909 + <width>50</width>
  910 + <height>76</height>
  911 + </rect>
  912 + </property>
  913 + <property name="font">
  914 + <font>
  915 + <pointsize>-1</pointsize>
  916 + </font>
  917 + </property>
  918 + <property name="text">
  919 + <string notr="true">08</string>
  920 + </property>
  921 + <property name="alignment">
  922 + <set>Qt::AlignCenter</set>
  923 + </property>
  924 + <property name="style" stdset="0">
  925 + <string>slotLabel</string>
  926 + </property>
  927 + </widget>
  928 + <widget class="QLabel" name="slotLabel_9">
  929 + <property name="geometry">
  930 + <rect>
  931 + <x>170</x>
  932 + <y>1162</y>
  933 + <width>50</width>
  934 + <height>76</height>
  935 + </rect>
  936 + </property>
  937 + <property name="font">
  938 + <font>
  939 + <pointsize>-1</pointsize>
  940 + </font>
  941 + </property>
  942 + <property name="text">
  943 + <string notr="true">09</string>
  944 + </property>
  945 + <property name="alignment">
  946 + <set>Qt::AlignCenter</set>
  947 + </property>
  948 + <property name="style" stdset="0">
  949 + <string>slotLabel</string>
  950 + </property>
  951 + </widget>
  952 + <widget class="QLabel" name="slotLabel_10">
  953 + <property name="geometry">
  954 + <rect>
  955 + <x>170</x>
  956 + <y>1238</y>
  957 + <width>50</width>
  958 + <height>76</height>
  959 + </rect>
  960 + </property>
  961 + <property name="font">
  962 + <font>
  963 + <pointsize>-1</pointsize>
  964 + </font>
  965 + </property>
  966 + <property name="text">
  967 + <string notr="true">10</string>
  968 + </property>
  969 + <property name="alignment">
  970 + <set>Qt::AlignCenter</set>
  971 + </property>
  972 + <property name="style" stdset="0">
  973 + <string>slotLabel</string>
  974 + </property>
  975 + </widget>
  976 + <widget class="QLabel" name="label">
  977 + <property name="geometry">
  978 + <rect>
  979 + <x>0</x>
  980 + <y>426</y>
  981 + <width>125</width>
  982 + <height>128</height>
  983 + </rect>
  984 + </property>
  985 + <property name="pixmap">
  986 + <pixmap resource="resources.qrc">:/images/symbol/symbol_01.png</pixmap>
  987 + </property>
  988 + <property name="alignment">
  989 + <set>Qt::AlignCenter</set>
  990 + </property>
  991 + </widget>
  992 + <widget class="QPushButton" name="homeButton">
  993 + <property name="geometry">
  994 + <rect>
  995 + <x>750</x>
  996 + <y>426</y>
  997 + <width>150</width>
  998 + <height>128</height>
  999 + </rect>
  1000 + </property>
  1001 + <property name="styleSheet">
  1002 + <string notr="true">QPushButton { background-image: url(:/images/button/100.png); }
  1003 +QPushButton::pressed, QPushButton:focus { background-image: url(:/images/button/100_ov.png); }</string>
  1004 + </property>
  1005 + <property name="text">
  1006 + <string/>
  1007 + </property>
  1008 + <property name="icon">
  1009 + <iconset resource="resources.qrc">
  1010 + <normaloff>:/images/auto_button/btn_icon_02.png</normaloff>:/images/auto_button/btn_icon_02.png</iconset>
  1011 + </property>
  1012 + <property name="iconSize">
  1013 + <size>
  1014 + <width>40</width>
  1015 + <height>51</height>
  1016 + </size>
  1017 + </property>
  1018 + </widget>
  1019 + <widget class="QLabel" name="label_6">
  1020 + <property name="geometry">
  1021 + <rect>
  1022 + <x>0</x>
  1023 + <y>426</y>
  1024 + <width>900</width>
  1025 + <height>128</height>
  1026 + </rect>
  1027 + </property>
  1028 + <property name="text">
  1029 + <string>1. 해당 조리 칸 버튼을 눌러 메뉴를 선택해주세요.
  1030 +2. 메뉴가 선택되면, 해당 작업 시간이 적용됩니다.</string>
  1031 + </property>
  1032 + <property name="indent">
  1033 + <number>125</number>
  1034 + </property>
  1035 + <property name="style" stdset="0">
  1036 + <string>slotLabel</string>
  1037 + </property>
  1038 + </widget>
  1039 + <zorder>label_6</zorder>
  1040 + <zorder>slotLabel_10</zorder>
  1041 + <zorder>slotLabel_9</zorder>
  1042 + <zorder>slotLabel_8</zorder>
  1043 + <zorder>slotLabel_7</zorder>
  1044 + <zorder>slotLabel_6</zorder>
  1045 + <zorder>slotLabel_5</zorder>
  1046 + <zorder>slotLabel_4</zorder>
  1047 + <zorder>slotLabel_3</zorder>
  1048 + <zorder>slotLabel_2</zorder>
  1049 + <zorder>slotLabel_1</zorder>
  1050 + <zorder>bar</zorder>
  1051 + <zorder>showPrevButton</zorder>
  1052 + <zorder>showNextButton</zorder>
  1053 + <zorder>showNowButton</zorder>
  1054 + <zorder>showFavoritesButton</zorder>
  1055 + <zorder>view</zorder>
  1056 + <zorder>selectButton_1</zorder>
  1057 + <zorder>selectButton_2</zorder>
  1058 + <zorder>selectButton_3</zorder>
  1059 + <zorder>selectButton_4</zorder>
  1060 + <zorder>selectButton_5</zorder>
  1061 + <zorder>selectButton_6</zorder>
  1062 + <zorder>selectButton_7</zorder>
  1063 + <zorder>selectButton_8</zorder>
  1064 + <zorder>selectButton_9</zorder>
  1065 + <zorder>selectButton_10</zorder>
  1066 + <zorder>upperStack</zorder>
  1067 + <zorder>label</zorder>
  1068 + <zorder>homeButton</zorder>
  1069 + </widget>
  1070 + <widget class="QWidget" name="bottomBar" native="true">
  1071 + <property name="geometry">
  1072 + <rect>
  1073 + <x>0</x>
  1074 + <y>1450</y>
  1075 + <width>900</width>
  1076 + <height>150</height>
  1077 + </rect>
  1078 + </property>
  1079 + <widget class="QPushButton" name="backButton">
  1080 + <property name="geometry">
  1081 + <rect>
  1082 + <x>175</x>
  1083 + <y>26</y>
  1084 + <width>97</width>
  1085 + <height>97</height>
  1086 + </rect>
  1087 + </property>
  1088 + <property name="sizePolicy">
  1089 + <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
  1090 + <horstretch>0</horstretch>
  1091 + <verstretch>0</verstretch>
  1092 + </sizepolicy>
  1093 + </property>
  1094 + <property name="styleSheet">
  1095 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/back.png); }
  1096 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/back_ov.png); }</string>
  1097 + </property>
  1098 + <property name="text">
  1099 + <string/>
  1100 + </property>
  1101 + </widget>
  1102 + <widget class="QPushButton" name="washButton">
  1103 + <property name="geometry">
  1104 + <rect>
  1105 + <x>401</x>
  1106 + <y>26</y>
  1107 + <width>97</width>
  1108 + <height>97</height>
  1109 + </rect>
  1110 + </property>
  1111 + <property name="sizePolicy">
  1112 + <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
  1113 + <horstretch>0</horstretch>
  1114 + <verstretch>0</verstretch>
  1115 + </sizepolicy>
  1116 + </property>
  1117 + <property name="styleSheet">
  1118 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/wash.png); }
  1119 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/wash_ov.png); }</string>
  1120 + </property>
  1121 + <property name="text">
  1122 + <string/>
  1123 + </property>
  1124 + </widget>
  1125 + <widget class="QPushButton" name="configButton">
  1126 + <property name="geometry">
  1127 + <rect>
  1128 + <x>288</x>
  1129 + <y>26</y>
  1130 + <width>97</width>
  1131 + <height>97</height>
  1132 + </rect>
  1133 + </property>
  1134 + <property name="sizePolicy">
  1135 + <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
  1136 + <horstretch>0</horstretch>
  1137 + <verstretch>0</verstretch>
  1138 + </sizepolicy>
  1139 + </property>
  1140 + <property name="styleSheet">
  1141 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/config.png); }
  1142 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/config_ov.png); }</string>
  1143 + </property>
  1144 + <property name="text">
  1145 + <string/>
  1146 + </property>
  1147 + </widget>
  1148 + <widget class="QPushButton" name="helpButton">
  1149 + <property name="geometry">
  1150 + <rect>
  1151 + <x>627</x>
  1152 + <y>26</y>
  1153 + <width>97</width>
  1154 + <height>97</height>
  1155 + </rect>
  1156 + </property>
  1157 + <property name="sizePolicy">
  1158 + <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
  1159 + <horstretch>0</horstretch>
  1160 + <verstretch>0</verstretch>
  1161 + </sizepolicy>
  1162 + </property>
  1163 + <property name="styleSheet">
  1164 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/help.png); }
  1165 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/help_ov.png); }</string>
  1166 + </property>
  1167 + <property name="text">
  1168 + <string/>
  1169 + </property>
  1170 + </widget>
  1171 + <widget class="QPushButton" name="deleteButton">
  1172 + <property name="geometry">
  1173 + <rect>
  1174 + <x>514</x>
  1175 + <y>26</y>
  1176 + <width>97</width>
  1177 + <height>97</height>
  1178 + </rect>
  1179 + </property>
  1180 + <property name="sizePolicy">
  1181 + <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
  1182 + <horstretch>0</horstretch>
  1183 + <verstretch>0</verstretch>
  1184 + </sizepolicy>
  1185 + </property>
  1186 + <property name="styleSheet">
  1187 + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/006_sys_icon_19.png); }
  1188 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/006_sys_icon_19_ov.png); }</string>
  1189 + </property>
  1190 + <property name="text">
  1191 + <string/>
  1192 + </property>
  1193 + </widget>
  1194 + </widget>
  1195 + <zorder>blockingArea</zorder>
  1196 + <zorder>bottomBar</zorder>
  1197 + <zorder>closeDoorAnimationArea</zorder>
  1198 + <zorder>openDoorAnimationArea</zorder>
  1199 + </widget>
  1200 + </widget>
  1201 + <customwidgets>
  1202 + <customwidget>
  1203 + <class>Clock</class>
  1204 + <extends>QWidget</extends>
  1205 + <header>clock.h</header>
  1206 + <container>1</container>
  1207 + </customwidget>
  1208 + <customwidget>
  1209 + <class>WashWarnIcon</class>
  1210 + <extends>QLabel</extends>
  1211 + <header>washwarnicon.h</header>
  1212 + </customwidget>
  1213 + <customwidget>
  1214 + <class>DemoIcon</class>
  1215 + <extends>QLabel</extends>
  1216 + <header>demoicon.h</header>
  1217 + </customwidget>
  1218 + <customwidget>
  1219 + <class>HalfEnergyIcon</class>
  1220 + <extends>QLabel</extends>
  1221 + <header>halfenergyicon.h</header>
  1222 + </customwidget>
  1223 + <customwidget>
  1224 + <class>DigitalClock</class>
  1225 + <extends>QLabel</extends>
  1226 + <header>digitalclock.h</header>
  1227 + </customwidget>
  1228 + <customwidget>
  1229 + <class>AnimatedImageBox</class>
  1230 + <extends>QLabel</extends>
  1231 + <header>animatedimagebox.h</header>
  1232 + </customwidget>
  1233 + <customwidget>
  1234 + <class>MultiCookView</class>
  1235 + <extends>QWidget</extends>
  1236 + <header>multicookview.h</header>
  1237 + <container>1</container>
  1238 + </customwidget>
  1239 + <customwidget>
  1240 + <class>MultiCookTimeBar</class>
  1241 + <extends>QWidget</extends>
  1242 + <header>multicooktimebar.h</header>
  1243 + <container>1</container>
  1244 + </customwidget>
  1245 + </customwidgets>
  1246 + <tabstops>
  1247 + <tabstop>selectButton_1</tabstop>
  1248 + <tabstop>selectButton_2</tabstop>
  1249 + <tabstop>selectButton_3</tabstop>
  1250 + <tabstop>selectButton_4</tabstop>
  1251 + <tabstop>selectButton_5</tabstop>
  1252 + <tabstop>selectButton_6</tabstop>
  1253 + <tabstop>selectButton_7</tabstop>
  1254 + <tabstop>selectButton_8</tabstop>
  1255 + <tabstop>selectButton_9</tabstop>
  1256 + <tabstop>selectButton_10</tabstop>
  1257 + <tabstop>showPrevButton</tabstop>
  1258 + <tabstop>showNowButton</tabstop>
  1259 + <tabstop>showFavoritesButton</tabstop>
  1260 + <tabstop>showNextButton</tabstop>
  1261 + <tabstop>backButton</tabstop>
  1262 + <tabstop>configButton</tabstop>
  1263 + <tabstop>washButton</tabstop>
  1264 + <tabstop>deleteButton</tabstop>
  1265 + <tabstop>helpButton</tabstop>
  1266 + <tabstop>cookButton_1</tabstop>
  1267 + <tabstop>cookButton_2</tabstop>
  1268 + <tabstop>cookButton_3</tabstop>
  1269 + <tabstop>cookButton_4</tabstop>
  1270 + <tabstop>cookButton_5</tabstop>
  1271 + <tabstop>cookButton_6</tabstop>
  1272 + <tabstop>cookButton_7</tabstop>
  1273 + <tabstop>cookButton_8</tabstop>
  1274 + <tabstop>cookButton_9</tabstop>
  1275 + <tabstop>cookButton_10</tabstop>
  1276 + <tabstop>cookButton_11</tabstop>
  1277 + <tabstop>cookButton_12</tabstop>
  1278 + </tabstops>
  1279 + <resources>
  1280 + <include location="resources.qrc"/>
  1281 + </resources>
  1282 + <connections/>
  1283 +</ui>
... ...
app/gui/oven_control/multimanualcook.cpp
... ... @@ -0,0 +1,247 @@
  1 +#include "multimanualcook.h"
  2 +
  3 +#include "oven.h"
  4 +
  5 +MultiManualCook::MultiManualCook(QObject *parent) : MultiCook(parent)
  6 +{
  7 + mode_ = Define::InvalidMode;
  8 + temp = 30;
  9 + hum = 0;
  10 + time = 0;
  11 + modifiedTime = -1;
  12 + state = Idle;
  13 +
  14 + checkTimer.setInterval(100);
  15 + connect(&checkTimer, SIGNAL(timeout()), SLOT(check()));
  16 +}
  17 +
  18 +QString MultiManualCook::name()
  19 +{
  20 + QString n("%1, %2, %3");
  21 + QString m;
  22 + switch (mode_)
  23 + {
  24 + case Define::InvalidMode:
  25 + m = "Invalid";
  26 + break;
  27 + case Define::SteamMode:
  28 + m = "Steam";
  29 + break;
  30 + case Define::CombiMode:
  31 + m = "Combi";
  32 + break;
  33 + case Define::DryMode:
  34 + m = "Dry";
  35 + break;
  36 + }
  37 +
  38 + return n.arg(m).arg(temp).arg(hum);
  39 +}
  40 +
  41 +Define::Mode MultiManualCook::mode()
  42 +{
  43 + return mode_;
  44 +}
  45 +
  46 +int MultiManualCook::temperature()
  47 +{
  48 + return temp;
  49 +}
  50 +
  51 +int MultiManualCook::humidity()
  52 +{
  53 + return hum;
  54 +}
  55 +
  56 +int MultiManualCook::remainingTime()
  57 +{
  58 + if (modifiedTime != -1)
  59 + return modifiedTime;
  60 +
  61 + switch (state)
  62 + {
  63 + case Idle:
  64 + return time;
  65 + case Running:
  66 + return time -= elapsed.restart();
  67 + case Paused:
  68 + return time;
  69 + case Finished:
  70 + return 0;
  71 + }
  72 +
  73 + return 0;
  74 +}
  75 +
  76 +void MultiManualCook::increaseTime()
  77 +{
  78 + if (state == Finished)
  79 + return;
  80 +
  81 + if (modifiedTime == -1)
  82 + modifiedTime = remainingTime() + 60 * 1000;
  83 + else
  84 + modifiedTime += 60 * 1000;
  85 +}
  86 +
  87 +void MultiManualCook::decreaseTime()
  88 +{
  89 + if (state == Finished)
  90 + return;
  91 +
  92 + if (modifiedTime == -1)
  93 + modifiedTime = remainingTime() - 60 * 1000;
  94 + else
  95 + modifiedTime -= 60 * 1000;
  96 +
  97 + if (modifiedTime < 60 * 1000)
  98 + modifiedTime = 60 * 1000;
  99 +}
  100 +
  101 +void MultiManualCook::setTime()
  102 +{
  103 + if (state == Finished)
  104 + return;
  105 +
  106 + if (modifiedTime == -1)
  107 + return;
  108 +
  109 + time = modifiedTime;
  110 + elapsed.start();
  111 + modifiedTime = -1;
  112 +
  113 + qDebug() << QTime::currentTime() << "setTime to" << time;
  114 +}
  115 +
  116 +void MultiManualCook::start()
  117 +{
  118 + state = Running;
  119 + elapsed.start();
  120 + decreasedTime.start();
  121 +
  122 + checkTimer.start();
  123 +}
  124 +
  125 +void MultiManualCook::stop()
  126 +{
  127 + state = Finished;
  128 + checkTimer.stop();
  129 +}
  130 +
  131 +void MultiManualCook::pause()
  132 +{
  133 + if (state != Running)
  134 + return;
  135 +
  136 + state = Paused;
  137 + time -= elapsed.elapsed();
  138 + decreasedTime.pause();
  139 + if (increasedTime.isValid())
  140 + increasedTime.pause();
  141 +
  142 + checkTimer.stop();
  143 +}
  144 +
  145 +void MultiManualCook::resume()
  146 +{
  147 + if (state != Paused)
  148 + return;
  149 +
  150 + state = Running;
  151 + time += 30 * 1000;
  152 + elapsed.start();
  153 + decreasedTime.resume();
  154 + if (increasedTime.isValid())
  155 + increasedTime.resume();
  156 +
  157 + checkTimer.start();
  158 +}
  159 +
  160 +MultiCook *MultiManualCook::clone(QObject *parent)
  161 +{
  162 + MultiManualCook *c = new MultiManualCook(parent);
  163 + c->mode_ = mode_;
  164 + c->temp = temp;
  165 + c->hum = hum;
  166 + c->time = time;
  167 +
  168 + return (MultiCook *) c;
  169 +}
  170 +
  171 +bool MultiManualCook::equals(MultiCook *other)
  172 +{
  173 + MultiManualCook *o = qobject_cast<MultiManualCook *>(other);
  174 + if (o == Q_NULLPTR)
  175 + return false;
  176 +
  177 + if (o->mode_ != mode_)
  178 + return false;
  179 +
  180 + if (o->temp != temp)
  181 + return false;
  182 +
  183 + if (o->hum != hum)
  184 + return false;
  185 +
  186 + if (o->time != time)
  187 + return false;
  188 +
  189 + return true;
  190 +}
  191 +
  192 +void MultiManualCook::setMode(Define::Mode mode)
  193 +{
  194 + mode_ = mode;
  195 +}
  196 +
  197 +void MultiManualCook::setTemperature(int temperature)
  198 +{
  199 + temp = temperature;
  200 + checkTimer.start();
  201 +}
  202 +
  203 +void MultiManualCook::setHumidity(int humidity)
  204 +{
  205 + hum = humidity;
  206 +}
  207 +
  208 +void MultiManualCook::setTime(int secs)
  209 +{
  210 + time = secs * 1000;
  211 +}
  212 +
  213 +void MultiManualCook::check()
  214 +{
  215 + if (state != Running)
  216 + return;
  217 +
  218 + int dt = Oven::getInstance()->currentTemp() - temp;
  219 +
  220 + // checking under temperature
  221 + if ((remainingTime() < 10 * 60 * 1000 && increasedTime.isNull())
  222 + || (increasedTime.isValid() && increasedTime.elapsed() > 3 * 60 * 1000))
  223 + {
  224 + increasedTime.start();
  225 + if (dt < -20)
  226 + {
  227 + int t = remainingTime();
  228 + time = remainingTime() * 1.1;
  229 + qDebug() << QTime::currentTime() << "Increase from" << t << "to" << remainingTime();
  230 + }
  231 + }
  232 +
  233 + // checking over temperature
  234 + if (decreasedTime.elapsed() > 2 * 60 * 1000)
  235 + {
  236 + decreasedTime.start();
  237 + if (dt > 20)
  238 + {
  239 + int t = remainingTime();
  240 + time = remainingTime() * 0.8;
  241 + qDebug() << QTime::currentTime() << "Reduce from" << t << "to" << remainingTime();
  242 + }
  243 + }
  244 +
  245 + if (remainingTime() <= 0)
  246 + stop();
  247 +}
... ...
app/gui/oven_control/multimanualcook.h
... ... @@ -0,0 +1,61 @@
  1 +#ifndef MULTIMANUALCOOK_H
  2 +#define MULTIMANUALCOOK_H
  3 +
  4 +#include "multicook.h"
  5 +#include "interruptibletime.h"
  6 +
  7 +class MultiManualCook : public MultiCook
  8 +{
  9 + Q_OBJECT
  10 +public:
  11 + explicit MultiManualCook(QObject *parent = 0);
  12 +
  13 + virtual QString name();
  14 + virtual Define::Mode mode();
  15 + virtual int temperature();
  16 + virtual int humidity();
  17 + virtual int remainingTime();
  18 +
  19 + virtual void increaseTime();
  20 + virtual void decreaseTime();
  21 + virtual void setTime();
  22 +
  23 + virtual void start();
  24 + virtual void stop();
  25 + virtual void pause();
  26 + virtual void resume();
  27 +
  28 + virtual MultiCook *clone(QObject *parent);
  29 + virtual bool equals(MultiCook *other);
  30 +
  31 + void setMode(Define::Mode mode);
  32 + void setTemperature(int temperature);
  33 + void setHumidity(int humidity);
  34 + void setTime(int secs);
  35 +
  36 +signals:
  37 +
  38 +public slots:
  39 +
  40 +private:
  41 + Define::Mode mode_;
  42 + int temp;
  43 + int hum;
  44 + int time;
  45 + int modifiedTime;
  46 +
  47 + QTimer checkTimer;
  48 + QTime elapsed;
  49 +
  50 + enum State {
  51 + Idle, Running, Paused, Finished
  52 + } state;
  53 +
  54 + InterruptibleTime decreasedTime;
  55 + InterruptibleTime increasedTime;
  56 +
  57 +private slots:
  58 + void check();
  59 +};
  60 +
  61 +#endif // MULTIMANUALCOOK_H
... ...
app/gui/oven_control/oven_control.pro
... ... @@ -122,14 +122,28 @@ SOURCES += main.cpp\
122 122 autocookselectionpopup.cpp \
123 123 autocookcheckwindow.cpp \
124 124 autocookcheckconfigwindow.cpp \
125   - programmedcookpanelbutton.cpp \
  125 + #programmedcookpanelbutton.cpp \
126 126 configdemomodedlg.cpp \
127 127 demoicon.cpp \
128 128 halfenergyicon.cpp \
129 129 notipopupdlg.cpp \
130 130 configsteamwashdlg.cpp \
131 131 digitalclock.cpp \
132   - manualviewerdlg.cpp
  132 + manualviewerdlg.cpp \
  133 + multicookwindow.cpp \
  134 + multicookview.cpp \
  135 + multicook.cpp \
  136 + multicookcontainer.cpp \
  137 + multicookcontroller.cpp \
  138 + multicooktimebar.cpp \
  139 + multimanualcook.cpp \
  140 + interruptibletime.cpp \
  141 + multiautocook.cpp \
  142 + multicookrecorder.cpp \
  143 + multicookselectionwindow.cpp \
  144 + multicookmanualwindow.cpp \
  145 + multicookautowindow.cpp \
  146 + multicookbook.cpp
133 147  
134 148  
135 149 HEADERS += mainwindow.h \
... ... @@ -242,14 +256,28 @@ HEADERS += mainwindow.h \
242 256 autocookselectionpopup.h \
243 257 autocookcheckwindow.h \
244 258 autocookcheckconfigwindow.h \
245   - programmedcookpanelbutton.h \
  259 + #programmedcookpanelbutton.h \
246 260 configdemomodedlg.h \
247 261 demoicon.h \
248 262 halfenergyicon.h \
249 263 notipopupdlg.h \
250 264 configsteamwashdlg.h \
251 265 digitalclock.h \
252   - manualviewerdlg.h
  266 + manualviewerdlg.h \
  267 + multicookwindow.h \
  268 + multicookview.h \
  269 + multicook.h \
  270 + multicookcontainer.h \
  271 + multicookcontroller.h \
  272 + multicooktimebar.h \
  273 + multimanualcook.h \
  274 + interruptibletime.h \
  275 + multiautocook.h \
  276 + multicookrecorder.h \
  277 + multicookselectionwindow.h \
  278 + multicookmanualwindow.h \
  279 + multicookautowindow.h \
  280 + multicookbook.h
253 281  
254 282 FORMS += mainwindow.ui \
255 283 manualcookwindow.ui \
... ... @@ -327,11 +355,15 @@ FORMS += mainwindow.ui \
327 355 autocookselectionpopup.ui \
328 356 autocookcheckwindow.ui \
329 357 autocookcheckconfigwindow.ui \
330   - programmedcookpanelbutton.ui \
  358 + #programmedcookpanelbutton.ui \
331 359 configdemomodedlg.ui \
332 360 notipopupdlg.ui \
333 361 configsteamwashdlg.ui \
334   - manualviewerdlg.ui
  362 + manualviewerdlg.ui \
  363 + multicookwindow.ui \
  364 + multicookselectionwindow.ui \
  365 + multicookmanualwindow.ui \
  366 + multicookautowindow.ui
335 367  
336 368 RESOURCES += \
337 369 resources.qrc
... ...
app/gui/oven_control/programmingselectionwindow.cpp
... ... @@ -15,7 +15,7 @@ ProgrammingSelectionWindow::ProgrammingSelectionWindow(QWidget *parent) :
15 15 {
16 16 ui->setupUi(this);
17 17  
18   -// ui->clockContainer->setParent(ui->upperStack);
  18 + ui->clockContainer->setParent(ui->upperStack);
19 19 setAttribute(Qt::WA_DeleteOnClose);
20 20  
21 21 setFocus();
... ...
app/gui/oven_control/programmingselectionwindow.ui
... ... @@ -643,72 +643,6 @@ QPushButton:disabled { background-image: url(:/images/cook_type/additional_hide.
643 643 <string>type</string>
644 644 </property>
645 645 </widget>
646   - <widget class="QWidget" name="clockContainer" native="true">
647   - <property name="geometry">
648   - <rect>
649   - <x>0</x>
650   - <y>0</y>
651   - <width>900</width>
652   - <height>426</height>
653   - </rect>
654   - </property>
655   - <property name="styleSheet">
656   - <string notr="true">#clockContainer { background-image: url(:/images/clock/background.png); }</string>
657   - </property>
658   - <widget class="Clock" name="clock" native="true">
659   - <property name="geometry">
660   - <rect>
661   - <x>272</x>
662   - <y>36</y>
663   - <width>356</width>
664   - <height>355</height>
665   - </rect>
666   - </property>
667   - </widget>
668   - <widget class="WashWarnIcon" name="label">
669   - <property name="geometry">
670   - <rect>
671   - <x>800</x>
672   - <y>320</y>
673   - <width>80</width>
674   - <height>84</height>
675   - </rect>
676   - </property>
677   - </widget>
678   - <widget class="DemoIcon" name="label_2">
679   - <property name="geometry">
680   - <rect>
681   - <x>780</x>
682   - <y>230</y>
683   - <width>101</width>
684   - <height>90</height>
685   - </rect>
686   - </property>
687   - </widget>
688   - <widget class="HalfEnergyIcon" name="label_3">
689   - <property name="geometry">
690   - <rect>
691   - <x>780</x>
692   - <y>160</y>
693   - <width>108</width>
694   - <height>67</height>
695   - </rect>
696   - </property>
697   - </widget>
698   - <widget class="DigitalClock" name="label_4">
699   - <property name="geometry">
700   - <rect>
701   - <x>20</x>
702   - <y>310</y>
703   - <width>600</width>
704   - <height>100</height>
705   - </rect>
706   - </property>
707   - <property name="alignment">
708   - <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
709   - </property>
710   - </widget>
711   - </widget>
712 646 <widget class="QPushButton" name="breadButton">
713 647 <property name="enabled">
714 648 <bool>false</bool>
... ... @@ -739,6 +673,78 @@ QPushButton:disabled { background-image: url(:/images/cook_type/bread_hide.png);
739 673 <string>type</string>
740 674 </property>
741 675 </widget>
  676 + <widget class="QStackedWidget" name="upperStack">
  677 + <property name="geometry">
  678 + <rect>
  679 + <x>0</x>
  680 + <y>0</y>
  681 + <width>900</width>
  682 + <height>426</height>
  683 + </rect>
  684 + </property>
  685 + <property name="currentIndex">
  686 + <number>0</number>
  687 + </property>
  688 + <widget class="QWidget" name="clockContainer">
  689 + <property name="styleSheet">
  690 + <string notr="true">#clockContainer { background-image: url(:/images/clock/background.png); }</string>
  691 + </property>
  692 + <widget class="Clock" name="clock" native="true">
  693 + <property name="geometry">
  694 + <rect>
  695 + <x>272</x>
  696 + <y>36</y>
  697 + <width>356</width>
  698 + <height>355</height>
  699 + </rect>
  700 + </property>
  701 + </widget>
  702 + <widget class="WashWarnIcon" name="label">
  703 + <property name="geometry">
  704 + <rect>
  705 + <x>800</x>
  706 + <y>320</y>
  707 + <width>80</width>
  708 + <height>84</height>
  709 + </rect>
  710 + </property>
  711 + </widget>
  712 + <widget class="DemoIcon" name="label_2">
  713 + <property name="geometry">
  714 + <rect>
  715 + <x>780</x>
  716 + <y>230</y>
  717 + <width>101</width>
  718 + <height>90</height>
  719 + </rect>
  720 + </property>
  721 + </widget>
  722 + <widget class="HalfEnergyIcon" name="label_3">
  723 + <property name="geometry">
  724 + <rect>
  725 + <x>780</x>
  726 + <y>160</y>
  727 + <width>108</width>
  728 + <height>67</height>
  729 + </rect>
  730 + </property>
  731 + </widget>
  732 + <widget class="DigitalClock" name="label_4">
  733 + <property name="geometry">
  734 + <rect>
  735 + <x>20</x>
  736 + <y>310</y>
  737 + <width>600</width>
  738 + <height>100</height>
  739 + </rect>
  740 + </property>
  741 + <property name="alignment">
  742 + <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
  743 + </property>
  744 + </widget>
  745 + </widget>
  746 + <widget class="QWidget" name="page_2"/>
  747 + </widget>
742 748 </widget>
743 749 </widget>
744 750 <customwidgets>
... ...
app/gui/oven_control/stringer.cpp
... ... @@ -234,3 +234,17 @@ QString Stringer::dateTime(const QDateTime &amp;dateTime, DateTimeType type)
234 234 return dateTime.toString("yy-MM-dd\nHH:mm");
235 235 }
236 236 }
  237 +
  238 +QString Stringer::time(int msecs)
  239 +{
  240 + int t = qCeil(msecs / 1000.0);
  241 +
  242 + int h = t / (60*60);
  243 + int m = (t/60) % 60;
  244 + int s = t % 60;
  245 +
  246 + return QString("%1:%2:%3")
  247 + .arg(h, 2, 10, QLatin1Char('0'))
  248 + .arg(m, 2, 10, QLatin1Char('0'))
  249 + .arg(s, 2, 10, QLatin1Char('0'));
  250 +}
... ...
app/gui/oven_control/stringer.h
... ... @@ -27,6 +27,7 @@ QString temperature(int current, int target, QString style);
27 27 QString unusedTemperature();
28 28 QString unusedTemperature(QString style);
29 29 QString dateTime(const QDateTime &dateTime, DateTimeType type = TwoLine);
  30 +QString time(int msecs);
30 31  
31 32 }
32 33  
... ...