autocooksettingwidget.h 978 Bytes
#ifndef AUTOCOOKSETTINGWIDGET_H
#define AUTOCOOKSETTINGWIDGET_H

#include <QWidget>
#include <QPushButton>
#include <QLabel>
#include <QSlider>

#include "define.h"
#include "cook.h"
#include "cookhistory.h"

namespace Ui {
class AutoCookSettingWidget;
}

class AutoCookSettingWidget : public QWidget
{
    Q_OBJECT

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

public:
    explicit AutoCookSettingWidget(AutoCookSetting setting, QWidget *parent = 0);
    ~AutoCookSettingWidget();

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

private:
    Ui::AutoCookSettingWidget *ui;
    QList<ConfigWidget> configWidgets;

    void setupUi(Cook cook);

    QWidget *pushed = NULL;

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

#endif // AUTOCOOKSETTINGWIDGET_H