multiautocook.h 1.38 KB
#ifndef MULTIAUTOCOOK_H
#define MULTIAUTOCOOK_H

#include "multicook.h"
#include "interruptibletime.h"

class MultiAutoCook : public MultiCook
{
    Q_OBJECT
public:
    explicit MultiAutoCook(QObject *parent = 0);

    virtual QString name();
    virtual Define::Mode mode();
    virtual int temperature();
    virtual int humidity();
    virtual int remainingTime();

    virtual void increaseTime();
    virtual void decreaseTime();
    virtual void setTime();

    virtual void start();
    virtual void stop();
    virtual void pause();
    virtual void resume();

    virtual MultiCook *clone(QObject *parent);
    virtual bool equals(MultiCook *other);

    void setName(QString name);
    void setMode(Define::Mode mode);
    void append(int temperature, int humidity, int time);

signals:

public slots:

private:
    void updateTime();

    QString name_;
    Define::Mode mode_;

    struct Step {
        int temperature;
        int humidity;
        int time;

        bool operator==(const Step &other);
    };

    QList<Step> steps;

    enum State {
        Idle, Running, Paused, Finished
    } state;

    QTime elapsed;
    int decreasedTimeCount;
    int increasedTimeCount;
    InterruptibleTime decreasedTime;
    InterruptibleTime increasedTime;

    QTimer checkTimer;

    bool isModifying;
    QList<Step> modifiedSteps;

private slots:
    void check();
};

#endif // MULTIAUTOCOOK_H