#include "cook.h" #include #include #include AbstractCook::~AbstractCook() { for (int idx = 0; idx < 5; idx++) if (configurations[idx] != NULL) { delete configurations[idx]; configurations[idx] = NULL; } } Cook::CookType AbstractCook::type() { return type_; } QString AbstractCook::name() { return name_; } int AbstractCook::time() { int t = time_; for (int idx = 0; idx < 5; idx++) if (configurations[idx] != NULL) t = configurations[idx]->configureTime(t); return t; } bool AbstractCook::interTempEnabled() { return interTempEnabled_; } void AbstractCook::setInterTempEnabled(bool enabled) { interTempEnabled_ = enabled; } int AbstractCook::interTemp() { int t = interTemp_; for (int idx = 0; idx < 5; idx++) if (configurations[idx] != NULL) t = configurations[idx]->configureInterTemp(t); return t; } Cook::Step AbstractCook::currentStep() { return step(currentStepIndex()); } int AbstractCook::currentStepIndex() { return currentStep_; } void AbstractCook::setCurrentStepIndex(int index) { if (index < stepCount_ && index >= 0) currentStep_ = index; } int AbstractCook::stepCount() { return stepCount_; } Cook::Step AbstractCook::step(int index) { if (index < stepCount_) { Cook::Step s = stepList[index]; for (int idx = 0; idx < 5; idx++) if (configurations[idx] != NULL) s = configurations[idx]->configureStep(s); return s; } else return Cook::Step { Cook::Invalid, Cook::SteamMode, 0, 0 }; } Cook::StepClass Cook::classify(Cook::StepType type) { switch (type) { case Preheat: return PreheatClass; case PutThermometer: case Load: case Cut: case Pour: return DoorClass; case Bake: case Dry: case Ferment: case BlowSteam: case CoolDown: case Steam: case Roast: case Boil: case Thicken: case WarmUp: case MakeCrispy: case Finish: case Damp: case Defer: case Grill: case End: case Burn: case Fry: case HeatUp: case Ripen: case RipenKeep: case BoilSteadily: case CookGratin: case Brown: case Simmer: case Moisten: return CookClass; default: return InvalidClass; } } Cook::Configuration AbstractCookConfig::type() { return type_; } QString AbstractCookConfig::icon() { return icon_; } QString AbstractCookConfig::overlayIcon() { return overayIcon_; } QString AbstractCookConfig::minLabel() { return minLabel_; } QString AbstractCookConfig::maxLabel() { return maxLabel_; } QString AbstractCookConfig::currentLabel() { return currentLabel_; } int AbstractCookConfig::count() { return count_; } void AbstractCookConfig::setCount(int value) { count_ = value; if (current_ > count_) current_ = count_; } int AbstractCookConfig::current() { return current_; } void AbstractCookConfig::setCurrent(int value) { current_ = qBound(1, value, count_); } int AbstractCookConfig::standard() { return standard_; } void AbstractCookConfig::setStandard(int value) { standard_ = qBound(1, value, count_); setCurrent(standard_); } int AbstractCookConfig::configureTime(int standardTime) { return standardTime; } int AbstractCookConfig::configureInterTemp(int standardInterTemp) { return standardInterTemp; } Cook::Step AbstractCookConfig::configureStep(Cook::Step standardStep) { return standardStep; } BrightnessConfig::BrightnessConfig() { type_ = Cook::Brightness; icon_ = ":/images/slider_icon/gau_icon_01.png"; overayIcon_ = ":/images/slider_icon/gau_icon_01_ov.png"; minLabel_ = "연한색"; maxLabel_ = "진한색"; } Cook::Step BrightnessConfig::configureStep(Cook::Step standardStep) { int dVal = current_ - standard_; qreal m = 1.0 - 0.05 * dVal; standardStep.humidity = qBound(0, (int) round(standardStep.humidity * m), 100); return standardStep; } TimeConfig::TimeConfig() { type_ = Cook::Time; icon_ = ":/images/slider_icon/time.png"; overayIcon_ = ":/images/slider_icon/time_ov.png"; minLabel_ = "단시간"; maxLabel_ = "장시간"; } int TimeConfig::configureTime(int standardTime) { int dVal = current_ - standard_; qreal m = 1.0 + 0.1 * dVal; standardTime = qBound(0, (int) round(standardTime * m), 24 * 60 * 60); return standardTime; } BurnDegreeConfig::BurnDegreeConfig() { type_ = Cook::BurnDegree; icon_ = ":/images/slider_icon/gau_icon_02.png"; overayIcon_ = ":/images/slider_icon/gau_icon_02_ov.png"; minLabel_ = "중간 익힘"; maxLabel_ = "완전 익힘"; } Cook::Step BurnDegreeConfig::configureStep(Cook::Step standardStep) { int dVal = current_ - standard_; qreal m = 1.0 + 0.03 * dVal; standardStep.temp = qBound(30, (int) round(standardStep.temp * m), 300); return standardStep; } int BurnDegreeConfig::configureInterTemp(int standardInterTemp) { int dVal = current_ - standard_; qreal m = 1.0 + 0.03 * dVal; standardInterTemp = qBound(0, (int) round(standardInterTemp * m), 99); return standardInterTemp; } QString Cook::name(Cook::StepType type) { switch (type) { case Cook::Roast: return "로스팅"; case Cook::Grill: return "그릴"; case Cook::Boil: return "끓이기"; case Cook::BoilSteadily: return "뭉근하게 끓이기"; case Cook::HeatUp: return "온도 높이기"; case Cook::Thicken: return "걸쭉하게 만들기"; case Cook::WarmUp: return "데우기"; case Cook::Simmer: return "약한 불로 끓이기"; case Cook::End: return "종료"; case Cook::MakeCrispy: return "바삭함 주기"; case Cook::Brown: return "브라우닝(갈색 내기)"; case Cook::BlowSteam: return "스팀 쏘이기"; case Cook::Damp: return "습윤 주기"; case Cook::Finish: return "피니싱"; case Cook::Burn: return "그을리기"; case Cook::CookGratin: return "그라탱 요리"; case Cook::CoolDown: return "식히기"; case Cook::Defer: return "보류"; case Cook::RipenKeep: return "숙성 & 보존"; case Cook::Bake: return "베이킹"; case Cook::Fry: return "기름에 재빨리 볶기"; case Cook::Steam: return "찌기"; case Cook::Ripen: return "촉촉하게"; case Cook::Ferment: return "숙성"; case Cook::Moisten: return "발효"; case Cook::Dry: return "건조시키기"; default: return ""; } } QString Cook::icon(Cook::StepType type) { switch (type) { case Cook::Roast: case Cook::Grill: return ":/images/cook_step_type/sys_icon_01.png"; case Cook::Boil: case Cook::BoilSteadily: case Cook::HeatUp: case Cook::Thicken: case Cook::WarmUp: case Cook::Simmer: return ":/images/cook_step_type/sys_icon_02.png"; case Cook::End: return ":/images/cook_step_type/sys_icon_03.png"; case Cook::MakeCrispy: case Cook::Brown: case Cook::BlowSteam: case Cook::Damp: return ":/images/cook_step_type/sys_icon_04.png"; case Cook::Finish: return ":/images/cook_step_type/sys_icon_05.png"; case Cook::Burn: case Cook::CookGratin: return ":/images/cook_step_type/sys_icon_06.png"; case Cook::CoolDown: return ":/images/cook_step_type/sys_icon_07.png"; case Cook::Defer: case Cook::RipenKeep: return ":/images/cook_step_type/sys_icon_08.png"; case Cook::Bake: return ":/images/cook_step_type/sys_icon_09.png"; case Cook::Fry: case Cook::Steam: return ":/images/cook_step_type/sys_icon_10.png"; case Cook::Ripen: case Cook::Ferment: case Cook::Moisten: return ":/images/cook_step_type/sys_icon_11.png"; case Cook::Dry: return ":/images/cook_step_type/sys_icon_12.png"; default: return ""; } } QString Cook::icon(Cook::CookType type) { switch (type) { case Poultry: return ":/images/cook_type/poultry_ov.png"; case Meat: return ":/images/cook_type/meat_ov.png"; case Fish: return ":/images/cook_type/fish_ov.png"; case Desert: return ":/images/cook_type/desert_ov.png"; case Vegetable: return ":/images/cook_type/vegetable_ov.png"; case Bread: return ":/images/cook_type/bread_ov.png"; case Etc: return ":/images/cook_type/etc_ov.png"; default: return ""; } } FriedRice::FriedRice() { name_ = QCoreApplication::tr("볶음밥"); currentStep_ = 0; stepCount_ = 4; stepList[0] = { Cook::Preheat, Cook::CombiMode, 100, 150 }; stepList[1] = { Cook::Load, Cook::CombiMode, 0, 0 }; stepList[2] = { Cook::Roast, Cook::CombiMode, 80, 130 }; stepList[3] = { Cook::Roast, Cook::DryMode, 30, 170 }; } ChickenCook::ChickenCook() { type_ = Cook::Poultry; name_ = QCoreApplication::tr("닭고기 요리"); currentStep_ = 0; stepCount_ = 5; stepList[0] = { Cook::Preheat, Cook::CombiMode, 100, 230 }; stepList[1] = { Cook::Load, Cook::CombiMode, 0, 0 }; stepList[2] = { Cook::Roast, Cook::CombiMode, 90, 210 }; stepList[3] = { Cook::Roast, Cook::CombiMode, 50, 173 }; stepList[4] = { Cook::Roast, Cook::DryMode, 50, 200 }; time_ = 39 * 60; interTempEnabled_ = true; interTemp_ = 88; BrightnessConfig *brightness = new BrightnessConfig; brightness->setCount(5); brightness->setStandard(3); brightness->setCurrent(3); configurations[0] = brightness; BurnDegreeConfig *burnDegree = new BurnDegreeConfig; burnDegree->setCount(3); burnDegree->setStandard(3); burnDegree->setCurrent(3); configurations[1] = burnDegree; } MeatPie::MeatPie() { type_ = Cook::Meat; name_ = QCoreApplication::tr("고기 파이"); currentStep_ = 0; stepCount_ = 5; stepList[0] = { Cook::Preheat, Cook::DryMode, 100, 211 }; stepList[1] = { Cook::Load, Cook::DryMode, 0, 0 }; stepList[2] = { Cook::Bake, Cook::DryMode, 100, 191 }; stepList[3] = { Cook::CoolDown, Cook::DryMode, 100, 120 }; stepList[4] = { Cook::Bake, Cook::DryMode, 40, 120 }; time_ = (1 * 60 + 17) * 60; interTempEnabled_ = true; interTemp_ = 62; BrightnessConfig *brightness = new BrightnessConfig; brightness->setCount(5); brightness->setStandard(3); brightness->setCurrent(3); configurations[0] = brightness; BurnDegreeConfig *burnDegree = new BurnDegreeConfig; burnDegree->setCount(3); burnDegree->setStandard(2); burnDegree->setCurrent(2); configurations[1] = burnDegree; } Croissant::Croissant() { type_ = Cook::Bread; name_ = QCoreApplication::tr("크로와상/페이스트리"); currentStep_ = 0; stepCount_ = 6; stepList[0] = { Cook::Preheat, Cook::CombiMode, 100, 180 }; stepList[1] = { Cook::Load, Cook::DryMode, 0, 0 }; stepList[2] = { Cook::BlowSteam, Cook::SteamMode, 100, 98 }; stepList[3] = { Cook::Bake, Cook::DryMode, 100, 170 }; stepList[4] = { Cook::Bake, Cook::DryMode, 70, 170 }; stepList[5] = { Cook::Bake, Cook::DryMode, 20, 170 }; time_ = 18 * 60; interTempEnabled_ = false; interTemp_ = 0; BrightnessConfig *brightness = new BrightnessConfig; brightness->setCount(5); brightness->setStandard(3); brightness->setCurrent(3); configurations[0] = brightness; TimeConfig *timeConf = new TimeConfig; timeConf->setCount(3); timeConf->setStandard(2); timeConf->setCurrent(2); configurations[4] = timeConf; }