#ifndef MULTICOOKVIEW_H #define MULTICOOKVIEW_H #include #include #include #include "multicookcontainer.h" #include "multicooktimebar.h" class MultiCookView : public QWidget { Q_OBJECT public: explicit MultiCookView(QWidget *parent = 0); void setContainer(MultiCookContainer *container); void setTimeBar(MultiCookTimeBar *bar); signals: void clicked(int); public slots: void showNow(); void showNext(); void showPrev(); void updateView(); protected: virtual void mousePressEvent(QMouseEvent *event); virtual void mouseReleaseEvent(QMouseEvent *event); virtual void paintEvent(QPaintEvent *event); virtual void resizeEvent(QResizeEvent *event); private: // helper methods QList calcRects(); int calcSlot(int x, int y); void paintGrids(QPainter &painter); void paintBars(QPainter &painter); void paintCurrentTime(QPainter &painter); void paintBar(QPainter &painter, QRect r); int currentTimePosition(); bool nothingOnRight(); MultiCookContainer *container; MultiCookTimeBar *bar; QList rects; int timePosition; // for click signal int pressedSlot; QPixmap barPixmap; QTimer checkTimer; private slots: void check(); }; #endif // MULTICOOKVIEW_H