Commit efecf3b066a0893326e2f51702ad80f33673f317

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

자동 요리 선택 화면에 페이지 기능 추가

app/gui/oven_control/autocookselectionwindow.cpp
... ... @@ -12,6 +12,9 @@
12 12 #include "mainwindow.h"
13 13 #include "manualviewerdlg.h"
14 14  
  15 +#define MAX_BUTTONS 30
  16 +#define BUTTONS_PER_PAGE 27
  17 +
15 18 AutoCookSelectionWindow::AutoCookSelectionWindow(QWidget *parent, Define::CookType type) :
16 19 QMainWindow(parent),
17 20 ui(new Ui::AutoCookSelectionWindow),
... ... @@ -41,8 +44,12 @@ AutoCookSelectionWindow::AutoCookSelectionWindow(QWidget *parent, Define::CookTy
41 44 "border-image: url(:/images/button/288_ov.png);\n"
42 45 "}");
43 46  
  47 + int cnt = book.list.size();
  48 + if (cnt > MAX_BUTTONS)
  49 + cnt = BUTTONS_PER_PAGE;
  50 +
44 51 QWidget *last = this;
45   - for (int idx = 0; idx < book.list.size(); idx++)
  52 + for (int idx = 0; idx < cnt; idx++)
46 53 {
47 54 int x = 12 + (idx % 3) * 294;
48 55 int y = 615 + (idx / 3) * 80;
... ... @@ -58,10 +65,24 @@ AutoCookSelectionWindow::AutoCookSelectionWindow(QWidget *parent, Define::CookTy
58 65  
59 66 setTabOrder(last, pb);
60 67  
  68 + button.append(pb);
  69 +
61 70 last = pb;
62 71 }
63 72  
64   - setTabOrder(last, ui->backButton);
  73 + if (book.list.size() > MAX_BUTTONS) {
  74 + ui->bullets->setBulletPixmap(":/images/auto_popup/bullet.png");
  75 + ui->bullets->setCurrentBulletPixmap(":/images/auto_popup/bullet_selected.png");
  76 + ui->bullets->setMaximum(book.list.size() / BUTTONS_PER_PAGE);
  77 + } else {
  78 + ui->bullets->hide();
  79 + ui->prev->hide();
  80 + ui->next->hide();
  81 + }
  82 +
  83 + setTabOrder(last, ui->prev);
  84 + setTabOrder(ui->prev, ui->next);
  85 + setTabOrder(ui->next, ui->backButton);
65 86 setTabOrder(ui->backButton, ui->configButton);
66 87 setTabOrder(ui->configButton, ui->washButton);
67 88 setTabOrder(ui->washButton, ui->helpButton);
... ... @@ -116,6 +137,8 @@ void AutoCookSelectionWindow::onCookSelected(int idx)
116 137 {
117 138 setFocus();
118 139  
  140 + idx += ui->bullets->currentIndex() * BUTTONS_PER_PAGE;
  141 +
119 142 AutoCookConfigWindow *w = new AutoCookConfigWindow(this, book.get(idx));
120 143 w->setWindowModality(Qt::WindowModal);
121 144 w->showFullScreen();
... ... @@ -170,3 +193,31 @@ void AutoCookSelectionWindow::onEncoderClicked(QWidget *clicked)
170 193 if (b)
171 194 b->click();
172 195 }
  196 +
  197 +void AutoCookSelectionWindow::list()
  198 +{
  199 + int startAt = ui->bullets->currentIndex() * BUTTONS_PER_PAGE;
  200 + for (int i = 0; i < button.size(); i++) {
  201 + QPushButton *pb = button.at(i);
  202 +
  203 + int cookIdx = startAt + i;
  204 + if (cookIdx >= book.list.size())
  205 + pb->hide();
  206 + else {
  207 + pb->setText(book.list.at(cookIdx));
  208 + pb->show();
  209 + }
  210 + }
  211 +}
  212 +
  213 +void AutoCookSelectionWindow::on_prev_clicked()
  214 +{
  215 + ui->bullets->setCurrentIndex(ui->bullets->currentIndex() - 1);
  216 + list();
  217 +}
  218 +
  219 +void AutoCookSelectionWindow::on_next_clicked()
  220 +{
  221 + ui->bullets->setCurrentIndex(ui->bullets->currentIndex() + 1);
  222 + list();
  223 +}
... ...
app/gui/oven_control/autocookselectionwindow.h
... ... @@ -34,10 +34,15 @@ private slots:
34 34  
35 35 void on_helpButton_clicked();
36 36  
  37 + void on_prev_clicked();
  38 +
  39 + void on_next_clicked();
  40 +
37 41 private:
38 42 Ui::AutoCookSelectionWindow *ui;
39 43 Define::CookType type;
40 44 CookBook book;
  45 + QList<QPushButton *> button;
41 46  
42 47 bool autoCookWindowOpened;
43 48  
... ... @@ -46,6 +51,7 @@ private:
46 51 void onEncoderLeft();
47 52 void onEncoderRight();
48 53 void onEncoderClicked(QWidget *clicked);
  54 + void list();
49 55 };
50 56  
51 57 #endif // AUTOCOOKSELECTIONWINDOW_H
... ...
app/gui/oven_control/autocookselectionwindow.ui
... ... @@ -231,10 +231,60 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/h
231 231 <set>Qt::AlignCenter</set>
232 232 </property>
233 233 </widget>
  234 + <widget class="QPushButton" name="prev">
  235 + <property name="geometry">
  236 + <rect>
  237 + <x>254</x>
  238 + <y>1335</y>
  239 + <width>125</width>
  240 + <height>105</height>
  241 + </rect>
  242 + </property>
  243 + <property name="styleSheet">
  244 + <string notr="true">QPushButton { border: none; background-repeat: no-repeat; background-position: center; background-image: url(:/images/auto_popup/prev.png); }
  245 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/auto_popup/prev_ov.png); }</string>
  246 + </property>
  247 + </widget>
  248 + <widget class="BulletIndicator" name="bullets" native="true">
  249 + <property name="geometry">
  250 + <rect>
  251 + <x>325</x>
  252 + <y>1335</y>
  253 + <width>250</width>
  254 + <height>105</height>
  255 + </rect>
  256 + </property>
  257 + </widget>
  258 + <widget class="QPushButton" name="next">
  259 + <property name="geometry">
  260 + <rect>
  261 + <x>529</x>
  262 + <y>1335</y>
  263 + <width>125</width>
  264 + <height>105</height>
  265 + </rect>
  266 + </property>
  267 + <property name="styleSheet">
  268 + <string notr="true">QPushButton { border: none; background-repeat: no-repeat; background-position: center; background-image: url(:/images/auto_popup/next.png); }
  269 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/auto_popup/next_ov.png); }</string>
  270 + </property>
  271 + </widget>
  272 + <zorder>upperStack</zorder>
  273 + <zorder>bottomBar</zorder>
  274 + <zorder>cookTypeIcon</zorder>
  275 + <zorder>bullets</zorder>
  276 + <zorder>next</zorder>
  277 + <zorder>prev</zorder>
234 278 </widget>
235 279 </widget>
236 280 <customwidgets>
237 281 <customwidget>
  282 + <class>BulletIndicator</class>
  283 + <extends>QWidget</extends>
  284 + <header>bulletindicator.h</header>
  285 + <container>1</container>
  286 + </customwidget>
  287 + <customwidget>
238 288 <class>Clock</class>
239 289 <extends>QWidget</extends>
240 290 <header>clock.h</header>
... ...