autocookcheckconfigwindow.h 1.12 KB
#ifndef AUTOCOOKCHECKCONFIGWINDOW_H
#define AUTOCOOKCHECKCONFIGWINDOW_H

#include <QMainWindow>
#include <QPushButton>
#include <QLabel>
#include <QSlider>

#include "cook.h"
#include "slider.h"

namespace Ui {
class AutoCookCheckConfigWindow;
}

class AutoCookCheckConfigWindow : public QMainWindow
{
    Q_OBJECT

    struct ConfigWidget {
        QPushButton *button;
        QLabel *minimum;
        QLabel *maximum;
        QLabel *current;
        Slider *slider;
    };

public:
    explicit AutoCookCheckConfigWindow(QWidget *parent, Cook cook);
    ~AutoCookCheckConfigWindow();

    bool eventFilter(QObject *watched, QEvent *event);

protected:
    void keyPressEvent(QKeyEvent *event);
    void keyReleaseEvent(QKeyEvent *event);

private:
    Ui::AutoCookCheckConfigWindow *ui;
    QList<ConfigWidget> configWidgets;
    Cook cook;

    void setupUi();

    QTimer afterThreeSecsTimer;

    QWidget *pushed = NULL;

    void onEncoderLeft();
    void onEncoderRight();
    void onEncoderClicked(QWidget *clicked);

private slots:
    void afterThreeSecs();
    void on_backButton_clicked();
};

#endif // AUTOCOOKCHECKCONFIGWINDOW_H