#ifndef PROGRAMMEDCOOKPANELBUTTON_H #define PROGRAMMEDCOOKPANELBUTTON_H #include #include #include #include #include #include "cookhistory.h" namespace Ui { class ProgrammedCookPanelButton; } class ProgrammedCookPanelButton : public QWidget { Q_OBJECT public: explicit ProgrammedCookPanelButton(CookRecord record, QWidget *parent = 0); ~ProgrammedCookPanelButton(); void setText(QString text); void showInfo(); void hideInfo(); void setLongPressEnabled(bool enabled); QPushButton *bar(); QPushButton *infoButton(); QPushButton *deleteButton(); CookRecord record; public slots: void setEnabled(bool enabled = true); protected: void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); private: Ui::ProgrammedCookPanelButton *ui; QTimer longPressedTimer; bool rendered; QLabel *label; bool emitted; bool longPressEnabled; QWidget *pushed = NULL; void onEncoderLeft(); void onEncoderRight(); void onEncoderClicked(QWidget *clicked); private slots: void emitLongPressed(); void on_pushButton_pressed(); void on_pushButton_released(); void on_pushButton_clicked(); void on_showInfoButton_clicked(); void on_deleteButton_clicked(); signals: void clicked(ProgrammedCookPanelButton *); void infoClicked(ProgrammedCookPanelButton *); void deleteClicked(ProgrammedCookPanelButton *); void longPressed(ProgrammedCookPanelButton *); }; #endif // PROGRAMMEDCOOKPANELBUTTON_H