cookhistory.h 1.21 KB
#ifndef COOKHISTORY_H
#define COOKHISTORY_H


#include <QList>
#include <QMainWindow>

#include "cook.h"

struct ManualCookSetting
{
    Define::Mode mode;
    int humidity;
    int temp;
    int time;
    bool coreTempEnabled;
    int coreTemp;
    int fan;
};

struct ManualCookRecord
{
    ManualCookSetting setting;
    QDateTime cookedTime;
};

struct AutoCookSetting
{
    Define::CookType type;
    QString name;
    QString root;
    int configs[5];
};

struct AutoCookRecord
{
    AutoCookSetting setting;
    int count;
};

struct CookRecord
{
    QString name;
    int id;
    enum Type { Manual, Auto } type;
    ManualCookRecord manualRecord;
    AutoCookRecord autoRecord;
};

namespace CookHistory
{
void record(ManualCookSetting cook);
void record(AutoCookSetting cook);
int addFavorite(ManualCookSetting cook, QString name);
int addFavorite(AutoCookSetting cook, QString name);

void removeMostCooked(CookRecord record);
void removeRecent(CookRecord record);
void removeFavorite(CookRecord record);

QList<CookRecord> listMostCooked();
QList<CookRecord> listRecents();
QList<CookRecord> listFavorites();

QPixmap render(CookRecord record);
QMainWindow *start(CookRecord record, QWidget *parent = 0);
}

#endif // COOKHISTORY_H