From efecf3b066a0893326e2f51702ad80f33673f317 Mon Sep 17 00:00:00 2001 From: taehoon Date: Wed, 22 Jan 2020 15:40:42 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EC=9A=94=EB=A6=AC=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=20=ED=99=94=EB=A9=B4=EC=97=90=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gui/oven_control/autocookselectionwindow.cpp | 55 +++++++++++++++++++++++- app/gui/oven_control/autocookselectionwindow.h | 6 +++ app/gui/oven_control/autocookselectionwindow.ui | 50 +++++++++++++++++++++ 3 files changed, 109 insertions(+), 2 deletions(-) diff --git a/app/gui/oven_control/autocookselectionwindow.cpp b/app/gui/oven_control/autocookselectionwindow.cpp index 1ec7c88..1a2d2e3 100644 --- a/app/gui/oven_control/autocookselectionwindow.cpp +++ b/app/gui/oven_control/autocookselectionwindow.cpp @@ -12,6 +12,9 @@ #include "mainwindow.h" #include "manualviewerdlg.h" +#define MAX_BUTTONS 30 +#define BUTTONS_PER_PAGE 27 + AutoCookSelectionWindow::AutoCookSelectionWindow(QWidget *parent, Define::CookType type) : QMainWindow(parent), ui(new Ui::AutoCookSelectionWindow), @@ -41,8 +44,12 @@ AutoCookSelectionWindow::AutoCookSelectionWindow(QWidget *parent, Define::CookTy "border-image: url(:/images/button/288_ov.png);\n" "}"); + int cnt = book.list.size(); + if (cnt > MAX_BUTTONS) + cnt = BUTTONS_PER_PAGE; + QWidget *last = this; - for (int idx = 0; idx < book.list.size(); idx++) + for (int idx = 0; idx < cnt; idx++) { int x = 12 + (idx % 3) * 294; int y = 615 + (idx / 3) * 80; @@ -58,10 +65,24 @@ AutoCookSelectionWindow::AutoCookSelectionWindow(QWidget *parent, Define::CookTy setTabOrder(last, pb); + button.append(pb); + last = pb; } - setTabOrder(last, ui->backButton); + if (book.list.size() > MAX_BUTTONS) { + ui->bullets->setBulletPixmap(":/images/auto_popup/bullet.png"); + ui->bullets->setCurrentBulletPixmap(":/images/auto_popup/bullet_selected.png"); + ui->bullets->setMaximum(book.list.size() / BUTTONS_PER_PAGE); + } else { + ui->bullets->hide(); + ui->prev->hide(); + ui->next->hide(); + } + + setTabOrder(last, ui->prev); + setTabOrder(ui->prev, ui->next); + setTabOrder(ui->next, ui->backButton); setTabOrder(ui->backButton, ui->configButton); setTabOrder(ui->configButton, ui->washButton); setTabOrder(ui->washButton, ui->helpButton); @@ -116,6 +137,8 @@ void AutoCookSelectionWindow::onCookSelected(int idx) { setFocus(); + idx += ui->bullets->currentIndex() * BUTTONS_PER_PAGE; + AutoCookConfigWindow *w = new AutoCookConfigWindow(this, book.get(idx)); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); @@ -170,3 +193,31 @@ void AutoCookSelectionWindow::onEncoderClicked(QWidget *clicked) if (b) b->click(); } + +void AutoCookSelectionWindow::list() +{ + int startAt = ui->bullets->currentIndex() * BUTTONS_PER_PAGE; + for (int i = 0; i < button.size(); i++) { + QPushButton *pb = button.at(i); + + int cookIdx = startAt + i; + if (cookIdx >= book.list.size()) + pb->hide(); + else { + pb->setText(book.list.at(cookIdx)); + pb->show(); + } + } +} + +void AutoCookSelectionWindow::on_prev_clicked() +{ + ui->bullets->setCurrentIndex(ui->bullets->currentIndex() - 1); + list(); +} + +void AutoCookSelectionWindow::on_next_clicked() +{ + ui->bullets->setCurrentIndex(ui->bullets->currentIndex() + 1); + list(); +} diff --git a/app/gui/oven_control/autocookselectionwindow.h b/app/gui/oven_control/autocookselectionwindow.h index 8b96d19..426a7ea 100644 --- a/app/gui/oven_control/autocookselectionwindow.h +++ b/app/gui/oven_control/autocookselectionwindow.h @@ -34,10 +34,15 @@ private slots: void on_helpButton_clicked(); + void on_prev_clicked(); + + void on_next_clicked(); + private: Ui::AutoCookSelectionWindow *ui; Define::CookType type; CookBook book; + QList button; bool autoCookWindowOpened; @@ -46,6 +51,7 @@ private: void onEncoderLeft(); void onEncoderRight(); void onEncoderClicked(QWidget *clicked); + void list(); }; #endif // AUTOCOOKSELECTIONWINDOW_H diff --git a/app/gui/oven_control/autocookselectionwindow.ui b/app/gui/oven_control/autocookselectionwindow.ui index b6932d0..b1a50d1 100644 --- a/app/gui/oven_control/autocookselectionwindow.ui +++ b/app/gui/oven_control/autocookselectionwindow.ui @@ -231,10 +231,60 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/h Qt::AlignCenter + + + + 254 + 1335 + 125 + 105 + + + + QPushButton { border: none; background-repeat: no-repeat; background-position: center; background-image: url(:/images/auto_popup/prev.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/auto_popup/prev_ov.png); } + + + + + + 325 + 1335 + 250 + 105 + + + + + + + 529 + 1335 + 125 + 105 + + + + QPushButton { border: none; background-repeat: no-repeat; background-position: center; background-image: url(:/images/auto_popup/next.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/auto_popup/next_ov.png); } + + + upperStack + bottomBar + cookTypeIcon + bullets + next + prev + BulletIndicator + QWidget +
bulletindicator.h
+ 1 +
+ Clock QWidget
clock.h
-- 2.1.4