Commit 11c6117822bda7947098ebee9b658da6aded0588

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

자동 요리 세부 사항 구현

- 요리 다시 선택하기 기능 추가
app/gui/oven_control/autocookconfigwindow.cpp
... ... @@ -11,6 +11,7 @@
11 11 #include "configwindow.h"
12 12 #include "washwindow.h"
13 13 #include "mainwindow.h"
  14 +#include "autocookselectionpopup.h"
14 15  
15 16 AutoCookConfigWindow::AutoCookConfigWindow(QWidget *parent, Cook cook) :
16 17 QMainWindow(parent),
... ... @@ -63,6 +64,9 @@ AutoCookConfigWindow::AutoCookConfigWindow(QWidget *parent, Cook cook) :
63 64 ui->configSlider_5
64 65 });
65 66  
  67 + foreach (Slider *s, findChildren<Slider *>())
  68 + connect(s, SIGNAL(sliderMoved(int)), SLOT(updateConfig()));
  69 +
66 70 setupUi();
67 71  
68 72 afterThreeSecsTimer.setSingleShot(true);
... ... @@ -75,8 +79,6 @@ AutoCookConfigWindow::AutoCookConfigWindow(QWidget *parent, Cook cook) :
75 79 foreach (QWidget *w, findChildren<QWidget *>())
76 80 w->installEventFilter(this);
77 81  
78   - installEventFilter(this);
79   -
80 82 setFocus();
81 83  
82 84 afterThreeSecsTimer.start();
... ... @@ -162,6 +164,22 @@ void AutoCookConfigWindow::afterThreeSecs()
162 164 start();
163 165 }
164 166  
  167 +void AutoCookConfigWindow::changeCook(Cook cook)
  168 +{
  169 + if (this->cook.root == cook.root)
  170 + return;
  171 +
  172 + this->cook = cook;
  173 +
  174 + setupUi();
  175 +}
  176 +
  177 +void AutoCookConfigWindow::connectNewWindow(AutoCookWindow *w)
  178 +{
  179 + connect(w, SIGNAL(back()), &afterThreeSecsTimer, SLOT(start()));
  180 + connect(w, SIGNAL(newWindow(AutoCookWindow*)), SLOT(connectNewWindow(AutoCookWindow*)));
  181 +}
  182 +
165 183 void AutoCookConfigWindow::onEncoderLeft()
166 184 {
167 185 focusPreviousChild();
... ... @@ -222,6 +240,12 @@ void AutoCookConfigWindow::setupUi()
222 240 else
223 241 {
224 242 ConfigWidget cw = configWidgets.at(idx);
  243 + cw.button->show();
  244 + cw.minimum->show();
  245 + cw.maximum->show();
  246 + cw.current->show();
  247 + cw.slider->show();
  248 +
225 249 cw.button->setStyleSheet(
226 250 "QPushButton { image: url("
227 251 + Define::icon(config.type)
... ... @@ -254,8 +278,6 @@ void AutoCookConfigWindow::setupUi()
254 278 cw.slider->setValue(config.current);
255 279 cw.slider->blockSignals(false);
256 280 cw.slider->bigTickInterval = 1;
257   -
258   - connect(cw.slider, SIGNAL(sliderMoved(int)), SLOT(updateConfig()));
259 281 }
260 282 }
261 283  
... ... @@ -309,6 +331,7 @@ void AutoCookConfigWindow::start()
309 331 w->raise();
310 332  
311 333 connect(w, SIGNAL(back()), &afterThreeSecsTimer, SLOT(start()));
  334 + connect(w, SIGNAL(newWindow(AutoCookWindow*)), SLOT(connectNewWindow(AutoCookWindow*)));
312 335 }
313 336  
314 337 void AutoCookConfigWindow::addFavorite()
... ... @@ -386,3 +409,19 @@ void AutoCookConfigWindow::on_configButton_5_clicked()
386 409 {
387 410 ui->configSlider_5->setFocus();
388 411 }
  412 +
  413 +void AutoCookConfigWindow::on_selectCookButton_clicked()
  414 +{
  415 + AutoCookSelectionPopup *p = new AutoCookSelectionPopup(this, cook.type);
  416 + p->showFullScreen();
  417 + p->raise();
  418 +
  419 + connect(p, SIGNAL(selected(Cook)), SLOT(changeCook(Cook)));
  420 +
  421 + if (afterThreeSecsTimer.isActive())
  422 + {
  423 + afterThreeSecsTimer.stop();
  424 + connect(p, SIGNAL(selected(Cook)), &afterThreeSecsTimer, SLOT(start()));
  425 + connect(p, SIGNAL(canceled()), &afterThreeSecsTimer, SLOT(start()));
  426 + }
  427 +}
... ...
app/gui/oven_control/autocookconfigwindow.h
... ... @@ -11,6 +11,7 @@
11 11 //#include "cook.h"
12 12 #include "cookbook.h"
13 13 #include "slider.h"
  14 +#include "autocookwindow.h"
14 15  
15 16 namespace Ui {
16 17 class AutoCookConfigWindow;
... ... @@ -60,6 +61,8 @@ private slots:
60 61 void start();
61 62 void addFavorite();
62 63 void afterThreeSecs();
  64 + void changeCook(Cook cook);
  65 + void connectNewWindow(AutoCookWindow *w);
63 66  
64 67 void on_backButton_clicked();
65 68 void on_configButton_clicked();
... ... @@ -70,6 +73,7 @@ private slots:
70 73 void on_configButton_3_clicked();
71 74 void on_configButton_4_clicked();
72 75 void on_configButton_5_clicked();
  76 + void on_selectCookButton_clicked();
73 77 };
74 78  
75 79 #endif // AUTOCOOKCONFIGWINDOW_H
... ...
app/gui/oven_control/autocookselectionpopup.cpp
... ... @@ -0,0 +1,178 @@
  1 +#include "autocookselectionpopup.h"
  2 +#include "ui_autocookselectionpopup.h"
  3 +
  4 +#include <QSignalMapper>
  5 +#include <QKeyEvent>
  6 +
  7 +#include "soundplayer.h"
  8 +
  9 +AutoCookSelectionPopup::AutoCookSelectionPopup(QWidget *parent, Define::CookType type) :
  10 + QWidget(parent),
  11 + ui(new Ui::AutoCookSelectionPopup),
  12 + type(type), book(CookBook(type))
  13 +{
  14 + ui->setupUi(this);
  15 +
  16 + QSignalMapper *m = new QSignalMapper(this);
  17 + m->setMapping(ui->selection1, 0);
  18 + m->setMapping(ui->selection2, 1);
  19 + m->setMapping(ui->selection3, 2);
  20 + m->setMapping(ui->selection4, 3);
  21 + m->setMapping(ui->selection5, 4);
  22 + m->setMapping(ui->selection6, 5);
  23 + connect(m, SIGNAL(mapped(int)), SLOT(on_clicked(int)));
  24 +
  25 + connect(ui->selection1, SIGNAL(clicked()), m, SLOT(map()));
  26 + connect(ui->selection2, SIGNAL(clicked()), m, SLOT(map()));
  27 + connect(ui->selection3, SIGNAL(clicked()), m, SLOT(map()));
  28 + connect(ui->selection4, SIGNAL(clicked()), m, SLOT(map()));
  29 + connect(ui->selection5, SIGNAL(clicked()), m, SLOT(map()));
  30 + connect(ui->selection6, SIGNAL(clicked()), m, SLOT(map()));
  31 +
  32 + ui->bullets->setBulletPixmap(":/images/auto_popup/bullet.png");
  33 + ui->bullets->setCurrentBulletPixmap(":/images/auto_popup/bullet_selected.png");
  34 + ui->bullets->setMaximum((book.list.size() - 1) / 6);
  35 +
  36 + list();
  37 +
  38 + foreach (QPushButton *button, findChildren<QPushButton *>())
  39 + connect(button, &QPushButton::pressed, SoundPlayer::playClick);
  40 +
  41 + setFocus();
  42 +}
  43 +
  44 +AutoCookSelectionPopup::~AutoCookSelectionPopup()
  45 +{
  46 + delete ui;
  47 +}
  48 +
  49 +void AutoCookSelectionPopup::keyPressEvent(QKeyEvent *event)
  50 +{
  51 + switch (event->key())
  52 + {
  53 + case 0x01000030: // Turn left
  54 + onEncoderLeft();
  55 + break;
  56 + case 0x01000031: // Push
  57 + pushed = focusWidget();
  58 + break;
  59 + case 0x01000032: // Turn right
  60 + onEncoderRight();
  61 + break;
  62 + }
  63 +}
  64 +
  65 +void AutoCookSelectionPopup::keyReleaseEvent(QKeyEvent *event)
  66 +{
  67 + switch (event->key())
  68 + {
  69 + case 0x01000030: // Turn left
  70 + onEncoderLeft();
  71 + break;
  72 + case 0x01000031: // Push
  73 + if (focusWidget() == pushed)
  74 + onEncoderClicked(pushed);
  75 +
  76 + pushed = NULL;
  77 + break;
  78 + case 0x01000032: // Turn right
  79 + onEncoderRight();
  80 + break;
  81 + }
  82 +}
  83 +
  84 +void AutoCookSelectionPopup::onEncoderLeft()
  85 +{
  86 + QWidget *focused = focusWidget();
  87 + if (focused == NULL || focused == this || focused == ui->selection1)
  88 + ui->next->setFocus();
  89 + else
  90 + focusPreviousChild();
  91 +}
  92 +
  93 +void AutoCookSelectionPopup::onEncoderRight()
  94 +{
  95 + QWidget *focused = focusWidget();
  96 + if (focused == NULL || focused == this || focused == ui->next)
  97 + ui->selection1->setFocus();
  98 + else
  99 + focusNextChild();
  100 +}
  101 +
  102 +void AutoCookSelectionPopup::onEncoderClicked(QWidget *clicked)
  103 +{
  104 + QPushButton *b = qobject_cast<QPushButton *>(clicked);
  105 + if (b)
  106 + b->click();
  107 +}
  108 +
  109 +void AutoCookSelectionPopup::list()
  110 +{
  111 + int startAt = ui->bullets->currentIndex() * 6;
  112 + for (int i = 0; i < 6; i++)
  113 + {
  114 + QPushButton *b;
  115 + switch (i)
  116 + {
  117 + case 0:
  118 + b = ui->selection1;
  119 + break;
  120 + case 1:
  121 + b = ui->selection2;
  122 + break;
  123 + case 2:
  124 + b = ui->selection3;
  125 + break;
  126 + case 3:
  127 + b = ui->selection4;
  128 + break;
  129 + case 4:
  130 + b = ui->selection5;
  131 + break;
  132 + case 5:
  133 + b = ui->selection6;
  134 + break;
  135 + }
  136 +
  137 + int idx = startAt + i;
  138 + if (idx >= book.list.size())
  139 + b->hide();
  140 + else
  141 + {
  142 + b->show();
  143 + b->setText(book.list.at(idx));
  144 + }
  145 + }
  146 +}
  147 +
  148 +void AutoCookSelectionPopup::on_clicked(int index)
  149 +{
  150 + index += ui->bullets->currentIndex() * 6;
  151 +
  152 + emit selected(book.get(index));
  153 + close();
  154 +}
  155 +
  156 +void AutoCookSelectionPopup::on_prev_clicked()
  157 +{
  158 + ui->bullets->setCurrentIndex(ui->bullets->currentIndex() - 1);
  159 + list();
  160 +}
  161 +
  162 +void AutoCookSelectionPopup::on_next_clicked()
  163 +{
  164 + ui->bullets->setCurrentIndex(ui->bullets->currentIndex() + 1);
  165 + list();
  166 +}
  167 +
  168 +void AutoCookSelectionPopup::on_upperClose_clicked()
  169 +{
  170 + emit canceled();
  171 + close();
  172 +}
  173 +
  174 +void AutoCookSelectionPopup::on_lowerClose_clicked()
  175 +{
  176 + emit canceled();
  177 + close();
  178 +}
... ...
app/gui/oven_control/autocookselectionpopup.h
... ... @@ -0,0 +1,53 @@
  1 +#ifndef AUTOCOOKSELECTIONPOPUP_H
  2 +#define AUTOCOOKSELECTIONPOPUP_H
  3 +
  4 +#include <QWidget>
  5 +
  6 +#include "cookbook.h"
  7 +
  8 +namespace Ui {
  9 +class AutoCookSelectionPopup;
  10 +}
  11 +
  12 +class AutoCookSelectionPopup : public QWidget
  13 +{
  14 + Q_OBJECT
  15 +
  16 +public:
  17 + explicit AutoCookSelectionPopup(QWidget *parent, Define::CookType type);
  18 + ~AutoCookSelectionPopup();
  19 +
  20 +protected:
  21 + void keyPressEvent(QKeyEvent *event);
  22 + void keyReleaseEvent(QKeyEvent *event);
  23 +
  24 +private:
  25 + Ui::AutoCookSelectionPopup *ui;
  26 +
  27 + Define::CookType type;
  28 + CookBook book;
  29 +
  30 + QWidget *pushed = NULL;
  31 +
  32 + void onEncoderLeft();
  33 + void onEncoderRight();
  34 + void onEncoderClicked(QWidget *clicked);
  35 +
  36 +private slots:
  37 + void list();
  38 + void on_clicked(int index);
  39 +
  40 + void on_prev_clicked();
  41 +
  42 + void on_next_clicked();
  43 +
  44 + void on_upperClose_clicked();
  45 +
  46 + void on_lowerClose_clicked();
  47 +
  48 +signals:
  49 + void selected(Cook);
  50 + void canceled();
  51 +};
  52 +
  53 +#endif // AUTOCOOKSELECTIONPOPUP_H
... ...
app/gui/oven_control/autocookselectionpopup.ui
... ... @@ -0,0 +1,258 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<ui version="4.0">
  3 + <class>AutoCookSelectionPopup</class>
  4 + <widget class="QWidget" name="AutoCookSelectionPopup">
  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>Form</string>
  15 + </property>
  16 + <property name="styleSheet">
  17 + <string notr="true">#background { background-image: url(:/images/auto_popup/background.png); }
  18 +#pannel { background-image: url(:/images/auto_popup/pannel.png); }
  19 +
  20 +QPushButton { border: none; background-repeat: no-repeat; background-position: center; }
  21 +QPushButton[style=&quot;cook&quot;] { background-image: url(:/images/auto_popup/button.png); }
  22 +QPushButton[style=&quot;cook&quot;]:pressed, QPushButton[style=&quot;cook&quot;]:focus { background-image: url(:/images/auto_popup/button_ov.png); }</string>
  23 + </property>
  24 + <widget class="QWidget" name="background" native="true">
  25 + <property name="geometry">
  26 + <rect>
  27 + <x>0</x>
  28 + <y>593</y>
  29 + <width>900</width>
  30 + <height>600</height>
  31 + </rect>
  32 + </property>
  33 + <widget class="QWidget" name="pannel" native="true">
  34 + <property name="geometry">
  35 + <rect>
  36 + <x>34</x>
  37 + <y>135</y>
  38 + <width>832</width>
  39 + <height>365</height>
  40 + </rect>
  41 + </property>
  42 + <widget class="QPushButton" name="prev">
  43 + <property name="geometry">
  44 + <rect>
  45 + <x>216</x>
  46 + <y>197</y>
  47 + <width>125</width>
  48 + <height>129</height>
  49 + </rect>
  50 + </property>
  51 + <property name="styleSheet">
  52 + <string notr="true">QPushButton { background-image: url(:/images/auto_popup/prev.png); }
  53 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/auto_popup/prev_ov.png); }</string>
  54 + </property>
  55 + </widget>
  56 + <widget class="QPushButton" name="next">
  57 + <property name="geometry">
  58 + <rect>
  59 + <x>491</x>
  60 + <y>197</y>
  61 + <width>125</width>
  62 + <height>129</height>
  63 + </rect>
  64 + </property>
  65 + <property name="styleSheet">
  66 + <string notr="true">QPushButton { background-image: url(:/images/auto_popup/next.png); }
  67 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/auto_popup/next_ov.png); }</string>
  68 + </property>
  69 + </widget>
  70 + <widget class="BulletIndicator" name="bullets" native="true">
  71 + <property name="geometry">
  72 + <rect>
  73 + <x>287</x>
  74 + <y>197</y>
  75 + <width>250</width>
  76 + <height>129</height>
  77 + </rect>
  78 + </property>
  79 + </widget>
  80 + <widget class="QPushButton" name="selection1">
  81 + <property name="geometry">
  82 + <rect>
  83 + <x>25</x>
  84 + <y>50</y>
  85 + <width>261</width>
  86 + <height>64</height>
  87 + </rect>
  88 + </property>
  89 + <property name="font">
  90 + <font>
  91 + <pointsize>10</pointsize>
  92 + <weight>75</weight>
  93 + <bold>true</bold>
  94 + </font>
  95 + </property>
  96 + <property name="style" stdset="0">
  97 + <string>cook</string>
  98 + </property>
  99 + </widget>
  100 + <widget class="QPushButton" name="selection2">
  101 + <property name="geometry">
  102 + <rect>
  103 + <x>286</x>
  104 + <y>50</y>
  105 + <width>261</width>
  106 + <height>64</height>
  107 + </rect>
  108 + </property>
  109 + <property name="font">
  110 + <font>
  111 + <pointsize>10</pointsize>
  112 + <weight>75</weight>
  113 + <bold>true</bold>
  114 + </font>
  115 + </property>
  116 + <property name="style" stdset="0">
  117 + <string>cook</string>
  118 + </property>
  119 + </widget>
  120 + <widget class="QPushButton" name="selection3">
  121 + <property name="geometry">
  122 + <rect>
  123 + <x>547</x>
  124 + <y>50</y>
  125 + <width>261</width>
  126 + <height>64</height>
  127 + </rect>
  128 + </property>
  129 + <property name="font">
  130 + <font>
  131 + <pointsize>10</pointsize>
  132 + <weight>75</weight>
  133 + <bold>true</bold>
  134 + </font>
  135 + </property>
  136 + <property name="style" stdset="0">
  137 + <string>cook</string>
  138 + </property>
  139 + </widget>
  140 + <widget class="QPushButton" name="selection6">
  141 + <property name="geometry">
  142 + <rect>
  143 + <x>547</x>
  144 + <y>125</y>
  145 + <width>261</width>
  146 + <height>64</height>
  147 + </rect>
  148 + </property>
  149 + <property name="font">
  150 + <font>
  151 + <pointsize>10</pointsize>
  152 + <weight>75</weight>
  153 + <bold>true</bold>
  154 + </font>
  155 + </property>
  156 + <property name="style" stdset="0">
  157 + <string>cook</string>
  158 + </property>
  159 + </widget>
  160 + <widget class="QPushButton" name="selection4">
  161 + <property name="geometry">
  162 + <rect>
  163 + <x>25</x>
  164 + <y>125</y>
  165 + <width>261</width>
  166 + <height>64</height>
  167 + </rect>
  168 + </property>
  169 + <property name="font">
  170 + <font>
  171 + <pointsize>10</pointsize>
  172 + <weight>75</weight>
  173 + <bold>true</bold>
  174 + </font>
  175 + </property>
  176 + <property name="style" stdset="0">
  177 + <string>cook</string>
  178 + </property>
  179 + </widget>
  180 + <widget class="QPushButton" name="selection5">
  181 + <property name="geometry">
  182 + <rect>
  183 + <x>286</x>
  184 + <y>125</y>
  185 + <width>261</width>
  186 + <height>64</height>
  187 + </rect>
  188 + </property>
  189 + <property name="font">
  190 + <font>
  191 + <pointsize>10</pointsize>
  192 + <weight>75</weight>
  193 + <bold>true</bold>
  194 + </font>
  195 + </property>
  196 + <property name="style" stdset="0">
  197 + <string>cook</string>
  198 + </property>
  199 + </widget>
  200 + <zorder>bullets</zorder>
  201 + <zorder>prev</zorder>
  202 + <zorder>next</zorder>
  203 + <zorder>selection1</zorder>
  204 + <zorder>selection2</zorder>
  205 + <zorder>selection3</zorder>
  206 + <zorder>selection6</zorder>
  207 + <zorder>selection4</zorder>
  208 + <zorder>selection5</zorder>
  209 + </widget>
  210 + </widget>
  211 + <widget class="QPushButton" name="upperClose">
  212 + <property name="geometry">
  213 + <rect>
  214 + <x>0</x>
  215 + <y>0</y>
  216 + <width>900</width>
  217 + <height>593</height>
  218 + </rect>
  219 + </property>
  220 + <property name="focusPolicy">
  221 + <enum>Qt::NoFocus</enum>
  222 + </property>
  223 + </widget>
  224 + <widget class="QPushButton" name="lowerClose">
  225 + <property name="geometry">
  226 + <rect>
  227 + <x>0</x>
  228 + <y>1193</y>
  229 + <width>900</width>
  230 + <height>407</height>
  231 + </rect>
  232 + </property>
  233 + <property name="focusPolicy">
  234 + <enum>Qt::NoFocus</enum>
  235 + </property>
  236 + </widget>
  237 + </widget>
  238 + <customwidgets>
  239 + <customwidget>
  240 + <class>BulletIndicator</class>
  241 + <extends>QWidget</extends>
  242 + <header>bulletindicator.h</header>
  243 + <container>1</container>
  244 + </customwidget>
  245 + </customwidgets>
  246 + <tabstops>
  247 + <tabstop>selection1</tabstop>
  248 + <tabstop>selection2</tabstop>
  249 + <tabstop>selection3</tabstop>
  250 + <tabstop>selection4</tabstop>
  251 + <tabstop>selection5</tabstop>
  252 + <tabstop>selection6</tabstop>
  253 + <tabstop>prev</tabstop>
  254 + <tabstop>next</tabstop>
  255 + </tabstops>
  256 + <resources/>
  257 + <connections/>
  258 +</ui>
... ...
app/gui/oven_control/autocookwindow.cpp
... ... @@ -14,6 +14,7 @@
14 14 #include "mainwindow.h"
15 15 #include "config.h"
16 16 #include "errorpopupdlg.h"
  17 +#include "autocookselectionpopup.h"
17 18  
18 19 AutoCookWindow::AutoCookWindow(QWidget *parent, Cook cook) :
19 20 QMainWindow(parent),
... ... @@ -667,6 +668,8 @@ void AutoCookWindow::startProcess(int process)
667 668 w->showFullScreen();
668 669 w->raise();
669 670  
  671 + emit newWindow(w);
  672 +
670 673 break;
671 674 }
672 675 case Define::MakeCrisper:
... ... @@ -739,6 +742,18 @@ void AutoCookWindow::checkProcess()
739 742 updateView();
740 743 }
741 744  
  745 +void AutoCookWindow::changeCook(Cook cook)
  746 +{
  747 + close();
  748 +
  749 + AutoCookWindow *w = new AutoCookWindow(parentWidget(), cook);
  750 + w->setWindowModality(Qt::WindowModal);
  751 + w->showFullScreen();
  752 + w->raise();
  753 +
  754 + emit newWindow(w);
  755 +}
  756 +
742 757 void AutoCookWindow::returnToCurrentStep()
743 758 {
744 759 selectedStepIndex = autocook.currentStepIndex;
... ... @@ -904,7 +919,14 @@ void AutoCookWindow::monitor()
904 919  
905 920 void AutoCookWindow::on_selectCookButton_clicked()
906 921 {
  922 + if (!autocook.done())
  923 + return;
  924 +
  925 + AutoCookSelectionPopup *p = new AutoCookSelectionPopup(this, cook.type);
  926 + p->showFullScreen();
  927 + p->raise();
907 928  
  929 + connect(p, SIGNAL(selected(Cook)), SLOT(changeCook(Cook)));
908 930 }
909 931  
910 932 void AutoCookWindow::on_homeButton_clicked()
... ...
app/gui/oven_control/autocookwindow.h
... ... @@ -92,6 +92,7 @@ private slots:
92 92 void checkCook();
93 93 void startProcess(int process);
94 94 void checkProcess();
  95 + void changeCook(Cook cook);
95 96  
96 97 void returnToCurrentStep();
97 98 void showCurrentHumidity();
... ... @@ -120,6 +121,7 @@ private slots:
120 121  
121 122 signals:
122 123 void back();
  124 + void newWindow(AutoCookWindow *);
123 125 };
124 126  
125 127 #endif // AUTOCOOKWINDOW_H
... ...
app/gui/oven_control/bulletindicator.cpp
... ... @@ -26,7 +26,7 @@ BulletIndicator::BulletIndicator(QWidget *parent) : QWidget(parent)
26 26 updatePosition();
27 27 }
28 28  
29   -void BulletIndicator::setBulletPixmap(QPixmap &pixmap)
  29 +void BulletIndicator::setBulletPixmap(const QPixmap &pixmap)
30 30 {
31 31 bulletPixmap = pixmap;
32 32  
... ... @@ -39,7 +39,13 @@ void BulletIndicator::setBulletPixmap(QPixmap &amp;pixmap)
39 39 updatePosition();
40 40 }
41 41  
42   -void BulletIndicator::setCurrentBulletPixmap(QPixmap &pixmap)
  42 +void BulletIndicator::setBulletPixmap(const QString &path)
  43 +{
  44 + QPixmap pix(path);
  45 + setBulletPixmap(pix);
  46 +}
  47 +
  48 +void BulletIndicator::setCurrentBulletPixmap(const QPixmap &pixmap)
43 49 {
44 50 currentBulletPixmap = pixmap;
45 51  
... ... @@ -50,6 +56,12 @@ void BulletIndicator::setCurrentBulletPixmap(QPixmap &amp;pixmap)
50 56 updatePosition();
51 57 }
52 58  
  59 +void BulletIndicator::setCurrentBulletPixmap(const QString &path)
  60 +{
  61 + QPixmap pix(path);
  62 + setCurrentBulletPixmap(pix);
  63 +}
  64 +
53 65 void BulletIndicator::setCurrentIndex(int index)
54 66 {
55 67 if (index == cur || index < 0 || index > max)
... ... @@ -65,7 +77,7 @@ void BulletIndicator::setCurrentIndex(int index)
65 77  
66 78 void BulletIndicator::setMaximum(int maximum)
67 79 {
68   - if (maximum == max || maximum < 1)
  80 + if (maximum == max || maximum < 0)
69 81 return;
70 82  
71 83 if (bullets.size() <= maximum)
... ... @@ -82,23 +94,11 @@ void BulletIndicator::setMaximum(int maximum)
82 94 }
83 95  
84 96 if (maximum > max)
85   - {
86 97 for (int i = max + 1; i <= maximum; i++)
87   - {
88   - QLabel *l = bullets.at(i);
89   - if (l->isHidden())
90   - l->show();
91   - }
92   - }
  98 + bullets.at(i)->show();
93 99 else if (maximum < max)
94   - {
95 100 for (int i = maximum + 1; i <= max; i++)
96   - {
97   - QLabel *l = bullets.at(i);
98   - if (l->isVisible())
99   - l->hide();
100   - }
101   - }
  101 + bullets.at(i)->hide();
102 102  
103 103 max = maximum;
104 104  
... ...
app/gui/oven_control/bulletindicator.h
... ... @@ -10,8 +10,10 @@ class BulletIndicator : public QWidget
10 10 public:
11 11 explicit BulletIndicator(QWidget *parent = 0);
12 12  
13   - void setBulletPixmap(QPixmap &pixmap);
14   - void setCurrentBulletPixmap(QPixmap &pixmap);
  13 + void setBulletPixmap(const QPixmap &pixmap);
  14 + void setBulletPixmap(const QString &path);
  15 + void setCurrentBulletPixmap(const QPixmap &pixmap);
  16 + void setCurrentBulletPixmap(const QString &path);
15 17  
16 18 int maximum() { return max; }
17 19 int currentIndex() { return cur; }
... ...
app/gui/oven_control/images/auto_popup/background.png

158 KB

app/gui/oven_control/images/auto_popup/bullet.png

3.02 KB

app/gui/oven_control/images/auto_popup/bullet_selected.png

2.87 KB

app/gui/oven_control/images/auto_popup/button.png

7.57 KB

app/gui/oven_control/images/auto_popup/button_ov.png

9.28 KB

app/gui/oven_control/images/auto_popup/next.png

3.4 KB

app/gui/oven_control/images/auto_popup/next_ov.png

3.46 KB

app/gui/oven_control/images/auto_popup/pannel.png

33.1 KB

app/gui/oven_control/images/auto_popup/prev.png

3.44 KB

app/gui/oven_control/images/auto_popup/prev_ov.png

3.41 KB

app/gui/oven_control/images/symbol/demo.png

7.87 KB

app/gui/oven_control/images/symbol/half_energy.png

6.41 KB

app/gui/oven_control/oven_control.pro
... ... @@ -118,7 +118,8 @@ SOURCES += main.cpp\
118 118 reservedtimepopup.cpp \
119 119 configdoormonitoring.cpp \
120 120 config1digitsetandenablesetdlg.cpp \
121   - slider.cpp
  121 + slider.cpp \
  122 + autocookselectionpopup.cpp
122 123  
123 124 HEADERS += mainwindow.h \
124 125 cook.h \
... ... @@ -226,7 +227,8 @@ HEADERS += mainwindow.h \
226 227 reservedtimepopup.h \
227 228 configdoormonitoring.h \
228 229 config1digitsetandenablesetdlg.h \
229   - slider.h
  230 + slider.h \
  231 + autocookselectionpopup.h
230 232  
231 233 FORMS += mainwindow.ui \
232 234 manualcookwindow.ui \
... ... @@ -300,7 +302,8 @@ FORMS += mainwindow.ui \
300 302 reservetimepopup.ui \
301 303 reservedtimepopup.ui \
302 304 configdoormonitoring.ui \
303   - config1digitsetandenablesetdlg.ui
  305 + config1digitsetandenablesetdlg.ui \
  306 + autocookselectionpopup.ui
304 307  
305 308 RESOURCES += \
306 309 resources.qrc
... ...
app/gui/oven_control/resources.qrc
... ... @@ -572,5 +572,17 @@
572 572 <file>images/config/pannel_fav.png</file>
573 573 <file>images/config/pannel_fav_ov.png</file>
574 574 <file>images/etc/main_btn_04_ov.png</file>
  575 + <file>images/auto_popup/background.png</file>
  576 + <file>images/auto_popup/bullet.png</file>
  577 + <file>images/auto_popup/bullet_selected.png</file>
  578 + <file>images/auto_popup/button.png</file>
  579 + <file>images/auto_popup/button_ov.png</file>
  580 + <file>images/auto_popup/next.png</file>
  581 + <file>images/auto_popup/next_ov.png</file>
  582 + <file>images/auto_popup/pannel.png</file>
  583 + <file>images/auto_popup/prev.png</file>
  584 + <file>images/auto_popup/prev_ov.png</file>
  585 + <file>images/symbol/demo.png</file>
  586 + <file>images/symbol/half_energy.png</file>
575 587 </qresource>
576 588 </RCC>
... ...