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