From dcfd897f3155f978bea1e94259a2de7bed87534e Mon Sep 17 00:00:00 2001 From: victor Date: Wed, 24 May 2017 17:03:34 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EB=8F=99=20=EC=9A=94=EB=A6=AC=20?= =?UTF-8?q?=EB=A7=8C=EB=93=A4=EA=B8=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gui/oven_control/cookprogram.cpp | 714 +++++++++++++++ app/gui/oven_control/cookprogram.h | 20 + app/gui/oven_control/oven_control.pro | 17 +- .../programmingmanualcoretemppopup.cpp | 30 + .../oven_control/programmingmanualcoretemppopup.h | 10 + .../oven_control/programmingmanualcoretemppopup.ui | 219 ++++- app/gui/oven_control/programmingmanualwindow.cpp | 229 ++++- app/gui/oven_control/programmingmanualwindow.h | 32 +- app/gui/oven_control/programmingmanualwindow.ui | 990 ++++++++++++++++++++- .../oven_control/programmingselectionwindow.cpp | 93 ++ app/gui/oven_control/programmingselectionwindow.h | 25 + app/gui/oven_control/programmingselectionwindow.ui | 698 ++++++++++++++- app/gui/oven_control/programmingwindow.cpp | 188 ++++ app/gui/oven_control/programmingwindow.h | 25 + app/gui/oven_control/programmingwindow.ui | 96 +- 15 files changed, 3351 insertions(+), 35 deletions(-) create mode 100644 app/gui/oven_control/cookprogram.cpp create mode 100644 app/gui/oven_control/cookprogram.h diff --git a/app/gui/oven_control/cookprogram.cpp b/app/gui/oven_control/cookprogram.cpp new file mode 100644 index 0000000..1671936 --- /dev/null +++ b/app/gui/oven_control/cookprogram.cpp @@ -0,0 +1,714 @@ +#include "cookprogram.h" + +#include + +#include "cookbook.h" + +namespace { +Define::CookType toCookType(QString type) +{ + if (type == "poutry") + return Define::Poultry; + if (type == "meat") + return Define::Meat; + if (type == "fish") + return Define::Fish; + if (type == "desert") + return Define::Desert; + if (type == "vegetable") + return Define::Vegetable; + if (type == "bread") + return Define::Bread; + if (type == "etc") + return Define::Etc; + + return Define::InvalidCookType; +} + +QString toString(Define::CookType type) +{ + switch (type) + { + case Define::Poultry: + return "poultry"; + case Define::Meat: + return "meat"; + case Define::Fish: + return "fish"; + case Define::Desert: + return "desert"; + case Define::Vegetable: + return "vegetable"; + case Define::Bread: + return "bread"; + case Define::Etc: + return "etc"; + default: + return QString(); + } +} + +Define::Mode toMode(QString mode) +{ + if (mode == "steam") + return Define::SteamMode; + if (mode == "combi") + return Define::CombiMode; + if (mode == "dry") + return Define::DryMode; + + return Define::InvalidMode; +} + +QString toString(Define::Mode mode) +{ + switch (mode) + { + case Define::SteamMode: + return "steam"; + case Define::CombiMode: + return "combi"; + case Define::DryMode: + return "dry"; + default: + return QString(); + } +} + +QString name(Define::CookType type, QString root) +{ + CookBook book(type); + return book.name(root); +} +} + +namespace { + +const int maxAuto = 20; +const int maxManual = 20; + +struct AutoEntry +{ + int id; + QString name; + Define::CookType type; + QString root; + int configs[5]; + + bool operator==(const AutoEntry &other) + { + for (int i = 0; i < 5; i++) + if (configs[i] != other.configs[i]) + return false; + + return id == other.id + && name == other.name + && type == other.type + && root == other.root; + } +}; + +struct ManualEntry +{ + int id; + QString name; + Define::Mode mode; + int humidity; + int temp; + int time; + int fan; + int coreTemp; + + bool operator==(const ManualEntry &other) + { + return id == other.id + && name == other.name + && mode == other.mode + && humidity == other.humidity + && temp == other.temp + && time == other.time + && fan == other.fan + && coreTemp == other.coreTemp; + } +}; + +QList savedAutoList; +QList savedManualList; +QList currentAutoList; +QList currentManualList; + +void readAuto() +{ + QFile file("/prime/program/auto.csv"); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + { + qDebug() << "File not found: " + file.fileName(); + return; + } + + QString errorMessage = QString("%3: %1, line %2").arg(file.fileName()); + int lineCount = 0; + while (!file.atEnd()) + { + lineCount++; + + QString line = QString::fromUtf8(file.readLine()).trimmed(); + if (line.isEmpty()) + continue; + + QString error = errorMessage.arg(lineCount); + + QString id = line.section(',', 0, 0).trimmed(); + if (id.isEmpty()) + { + qDebug() << error.arg("Invalid id"); + continue; + } + + QString name = line.section(',', 1, 1).trimmed(); + if (name.isEmpty()) + { + qDebug() << error.arg("Invalid name"); + continue; + } + + QString type = line.section(',', 2, 2).trimmed(); + if (type.isEmpty()) + { + qDebug() << error.arg("Invalid type"); + continue; + } + + QString root = line.section(',', 3, 3).trimmed(); + if (root.isEmpty()) + { + qDebug() << error.arg("Invalid root"); + continue; + } + + QString config1 = line.section(',', 4, 4).trimmed(); + if (config1.isEmpty()) + { + qDebug() << error.arg("Invalid config1"); + continue; + } + + QString config2 = line.section(',', 5, 5).trimmed(); + if (config2.isEmpty()) + { + qDebug() << error.arg("Invalid config2"); + continue; + } + + QString config3 = line.section(',', 6, 6).trimmed(); + if (config3.isEmpty()) + { + qDebug() << error.arg("Invalid config3"); + continue; + } + + QString config4 = line.section(',', 7, 7).trimmed(); + if (config4.isEmpty()) + { + qDebug() << error.arg("Invalid config4"); + continue; + } + + QString config5 = line.section(',', 8, 8).trimmed(); + if (config5.isEmpty()) + { + qDebug() << error.arg("Invalid config5"); + continue; + } + + AutoEntry e; + + bool ok; + e.id = id.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid id"); + continue; + } + + e.name = name.replace("\\c", ","); + + e.type = toCookType(type); + if (e.type == Define::InvalidCookType) + { + qDebug() << error.arg("Invalid type"); + continue; + } + + e.root = root; + + e.configs[0] = config1.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid config1"); + continue; + } + + e.configs[1] = config2.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid config2"); + continue; + } + + e.configs[2] = config3.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid config3"); + continue; + } + + e.configs[3] = config4.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid config4"); + continue; + } + + e.configs[4] = config5.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid config5"); + continue; + } + + savedAutoList.append(e); + } + + currentAutoList = savedAutoList; +} + +void readManual() +{ + QFile file("/prime/program/manual.csv"); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + { + qDebug() << "File not found: " + file.fileName(); + return; + } + + QString errorMessage = QString("%3: %1, line %2").arg(file.fileName()); + int lineCount = 0; + while (!file.atEnd()) + { + lineCount++; + + QString line = QString::fromUtf8(file.readLine()).trimmed(); + if (line.isEmpty()) + continue; + + QString error = errorMessage.arg(lineCount); + + QString id = line.section(',', 0, 0).trimmed(); + if (id.isEmpty()) + { + qDebug() << error.arg("Invalid id"); + continue; + } + + QString name = line.section(',', 1, 1).trimmed(); + if (name.isEmpty()) + { + qDebug() << error.arg("Invalid name"); + continue; + } + + QString mode = line.section(',', 2, 2).trimmed(); + if (mode.isEmpty()) + { + qDebug() << error.arg("Invalid mode"); + continue; + } + + QString humidity = line.section(',', 3, 3).trimmed(); + if (humidity.isEmpty()) + { + qDebug() << error.arg("Invalid humidity"); + continue; + } + + QString temp = line.section(',', 4, 4).trimmed(); + if (temp.isEmpty()) + { + qDebug() << error.arg("Invalid temp"); + continue; + } + + QString time = line.section(',', 5, 5).trimmed(); + if (time.isEmpty()) + { + qDebug() << error.arg("Invalid time"); + continue; + } + + QString fan = line.section(',', 6, 6).trimmed(); + if (fan.isEmpty()) + { + qDebug() << error.arg("Invalid fan"); + continue; + } + + QString coreTemp = line.section(',', 7, 7).trimmed(); + if (coreTemp.isEmpty()) + { + qDebug() << error.arg("Invalid coreTemp"); + continue; + } + + ManualEntry e; + + bool ok; + e.id = id.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid id"); + continue; + } + + e.name = name.replace("\\c", ","); + + e.mode = toMode(mode); + if (e.mode == Define::InvalidMode) + { + qDebug() << error.arg("Invalid mode"); + continue; + } + + e.humidity = humidity.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid humidity"); + continue; + } + + e.temp = temp.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid temp"); + continue; + } + + e.time = time.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid time"); + continue; + } + + e.fan = fan.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid fan"); + continue; + } + + e.coreTemp = coreTemp.toInt(&ok); + if (!ok) + { + qDebug() << error.arg("Invalid coreTemp"); + continue; + } + + savedManualList.append(e); + } + + currentManualList = savedManualList; +} + +void writeAuto() +{ + QFile file("/prime/program/auto.csv"); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + { + qDebug() << "File not opened: " + file.fileName(); + return; + } + + QTextStream stream(&file); + stream.setCodec("UTF-8"); + foreach (AutoEntry e, savedAutoList) + { + stream << e.id << "," + << e.name.replace(",", "\\c").toUtf8() << "," + << toString(e.type) << "," + << e.root; + for (int i = 0; i < 5; i++) + stream << "," << e.configs[i]; + + stream << "\n"; + } +} + +void writeManual() +{ + QFile file("/prime/program/manual.csv"); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) + { + qDebug() << "File not opened: " + file.fileName(); + return; + } + + QTextStream stream(&file); + stream.setCodec("UTF-8"); + foreach (ManualEntry e, savedManualList) + { + stream << e.id << "," + << e.name.replace(",", "\\c").toUtf8() << "," + << toString(e.mode) << "," + << e.humidity << "," + << e.temp << "," + << e.time << "," + << e.fan << "," + << e.coreTemp << "\n"; + } +} + +bool initialized = false; +void initialize() +{ + initialized = true; + + readAuto(); + readManual(); +} + +void checkInitialized() +{ + if (!initialized) + initialize(); +} + +int newAutoId() +{ + for (int i = 0; i < 1000; i++) + { + bool absent = true; + foreach (AutoEntry e, currentAutoList) + if (e.id == i) + { + absent = false; + break; + } + + if (absent) + return i; + } + + return -1; +} + +int newManualId() +{ + for (int i = 0; i < 1000; i++) + { + bool absent = true; + foreach (ManualEntry e, currentManualList) + if (e.id == i) + { + absent = false; + break; + } + + if (absent) + return i; + } + + return -1; +} +} + +void CookProgram::add(AutoCookSetting cook) +{ + checkInitialized(); + + AutoEntry e; + e.id = newAutoId(); + e.name = cook.name; + e.type = cook.type; + e.root = cook.root; + + for (int i = 0; i < 5; i++) + e.configs[i] = cook.configs[i]; + + currentAutoList.append(e); +} + +void CookProgram::add(ManualCookSetting cook) +{ + checkInitialized(); + + ManualEntry e; + e.id = newManualId(); + e.name = "Manual"; + e.mode = cook.mode; + e.humidity = cook.humidity; + e.temp = cook.temp; + e.time = cook.time; + e.fan = cook.fan; + e.coreTemp = cook.coreTempEnabled ? cook.coreTemp : -1; + + currentManualList.append(e); +} + +void CookProgram::remove(CookRecord record) +{ + checkInitialized(); + + switch (record.type) + { + case CookRecord::Auto: + { + AutoEntry e; + e.id = record.id; + e.name = record.name; + e.type = record.autoRecord.setting.type; + e.root = record.autoRecord.setting.root; + for (int i = 0; i < 5; i++) + e.configs[i] = record.autoRecord.setting.configs[i]; + + currentAutoList.removeAll(e); + } + break; + case CookRecord::Manual: + { + ManualEntry e; + e.id = record.id; + e.name = record.name; + e.mode = record.manualRecord.setting.mode; + e.humidity = record.manualRecord.setting.humidity; + e.temp = record.manualRecord.setting.temp; + e.time = record.manualRecord.setting.time; + e.fan = record.manualRecord.setting.fan; + e.coreTemp = record.manualRecord.setting.coreTempEnabled ? record.manualRecord.setting.coreTemp : -1; + + currentManualList.removeAll(e); + } + break; + } +} + +QList CookProgram::listAuto() +{ + checkInitialized(); + + QList list; + foreach (AutoEntry e, currentAutoList) + { + CookRecord r; + r.type = CookRecord::Auto; + r.id = e.id; + r.name = e.name; + r.autoRecord.setting.name = name(e.type, e.root); + r.autoRecord.setting.type = e.type; + r.autoRecord.setting.root = e.root; + + for (int i = 0; i < 5; i++) + r.autoRecord.setting.configs[i] = e.configs[i]; + + list.append(r); + } + + return list; +} + +QList CookProgram::listManual() +{ + checkInitialized(); + + QList list; + foreach (ManualEntry e, currentManualList) + { + CookRecord r; + r.type = CookRecord::Manual; + r.id = e.id; + r.name = e.name; + r.manualRecord.setting.mode = e.mode; + r.manualRecord.setting.humidity = e.humidity; + r.manualRecord.setting.temp = e.temp; + r.manualRecord.setting.time = e.time; + r.manualRecord.setting.fan = e.fan; + r.manualRecord.setting.coreTempEnabled = e.coreTemp > 0; + r.manualRecord.setting.coreTemp = e.coreTemp; + + list.append(r); + } + + return list; +} + +void CookProgram::rename(CookRecord record, QString name) +{ + checkInitialized(); + + switch (record.type) + { + case CookRecord::Auto: + { + AutoEntry e; + e.id = record.id; + e.name = record.name; + e.type = record.autoRecord.setting.type; + e.root = record.autoRecord.setting.root; + for (int i = 0; i < 5; i++) + e.configs[i] = record.autoRecord.setting.configs[i]; + + int index = currentAutoList.indexOf(e); + if (index != -1) + { + AutoEntry &e = currentAutoList[index]; + e.name = name; + } + } + break; + case CookRecord::Manual: + { + ManualEntry e; + e.id = record.id; + e.name = record.name; + e.mode = record.manualRecord.setting.mode; + e.humidity = record.manualRecord.setting.humidity; + e.temp = record.manualRecord.setting.temp; + e.time = record.manualRecord.setting.time; + e.fan = record.manualRecord.setting.fan; + e.coreTemp = record.manualRecord.setting.coreTempEnabled ? record.manualRecord.setting.coreTemp : -1; + + int index = currentManualList.indexOf(e); + if (index != -1) + { + ManualEntry &e = currentManualList[index]; + e.name = name; + } + } + break; + } +} + +void CookProgram::save() +{ + checkInitialized(); + + if (currentAutoList != savedAutoList) + { + savedAutoList = currentAutoList; + writeAuto(); + } + + if (currentManualList != savedManualList) + { + savedManualList = currentManualList; + writeManual(); + } +} + +void CookProgram::discard() +{ + checkInitialized(); + + currentAutoList = savedAutoList; + currentManualList = savedManualList; +} diff --git a/app/gui/oven_control/cookprogram.h b/app/gui/oven_control/cookprogram.h new file mode 100644 index 0000000..a269949 --- /dev/null +++ b/app/gui/oven_control/cookprogram.h @@ -0,0 +1,20 @@ +#ifndef COOKPROGRAM_H +#define COOKPROGRAM_H + + +#include "cookhistory.h" + +namespace CookProgram +{ +void add(AutoCookSetting cook); +void add(ManualCookSetting cook); +void remove(CookRecord record); +void rename(CookRecord record, QString name); +void save(); +void discard(); + +QList listAuto(); +QList listManual(); +} + +#endif // COOKPROGRAM_H diff --git a/app/gui/oven_control/oven_control.pro b/app/gui/oven_control/oven_control.pro index e007093..fcdd7e6 100644 --- a/app/gui/oven_control/oven_control.pro +++ b/app/gui/oven_control/oven_control.pro @@ -106,7 +106,11 @@ SOURCES += main.cpp\ coretempsettingpopup.cpp \ fileprocessor.cpp \ fileprocessgauge.cpp \ - fileprocessdlg.cpp + fileprocessdlg.cpp \ + programmingselectionwindow.cpp \ + programmingmanualwindow.cpp \ + programmingmanualcoretemppopup.cpp \ + cookprogram.cpp HEADERS += mainwindow.h \ cook.h \ @@ -202,7 +206,11 @@ HEADERS += mainwindow.h \ coretempsettingpopup.h \ fileprocessor.h \ fileprocessgauge.h \ - fileprocessdlg.h + fileprocessdlg.h \ + programmingselectionwindow.h \ + programmingmanualwindow.h \ + programmingmanualcoretemppopup.h \ + cookprogram.h FORMS += mainwindow.ui \ manualcookwindow.ui \ @@ -266,7 +274,10 @@ FORMS += mainwindow.ui \ electricmodelsettingwindow.ui \ servicepassinputdlg.ui \ coretempsettingpopup.ui \ - fileprocessdlg.ui + fileprocessdlg.ui \ + programmingselectionwindow.ui \ + programmingmanualwindow.ui \ + programmingmanualcoretemppopup.ui RESOURCES += \ resources.qrc diff --git a/app/gui/oven_control/programmingmanualcoretemppopup.cpp b/app/gui/oven_control/programmingmanualcoretemppopup.cpp index 1264ee8..da03bba 100644 --- a/app/gui/oven_control/programmingmanualcoretemppopup.cpp +++ b/app/gui/oven_control/programmingmanualcoretemppopup.cpp @@ -1,14 +1,44 @@ #include "programmingmanualcoretemppopup.h" #include "ui_programmingmanualcoretemppopup.h" +#include "stringer.h" + ProgrammingManualCoreTempPopup::ProgrammingManualCoreTempPopup(QWidget *parent) : QWidget(parent), ui(new Ui::ProgrammingManualCoreTempPopup) { ui->setupUi(this); + + setAttribute(Qt::WA_DeleteOnClose); + + connect(ui->coreTempSlider, SIGNAL(valueChanged(int)), SLOT(updateCoreTempLabel())); + + updateCoreTempLabel(); } ProgrammingManualCoreTempPopup::~ProgrammingManualCoreTempPopup() { delete ui; } + +void ProgrammingManualCoreTempPopup::updateCoreTempLabel() +{ + ui->coreTempLabel->setText(Stringer::temperature(ui->coreTempSlider->value(), Stringer::fontSize14)); +} + +void ProgrammingManualCoreTempPopup::on_coreTempButton_clicked() +{ + +} + +void ProgrammingManualCoreTempPopup::on_cancelButton_clicked() +{ + close(); +} + +void ProgrammingManualCoreTempPopup::on_applyButton_clicked() +{ + emit coreTempEnabled(ui->coreTempSlider->value()); + + close(); +} diff --git a/app/gui/oven_control/programmingmanualcoretemppopup.h b/app/gui/oven_control/programmingmanualcoretemppopup.h index ee5b6a4..8d5f588 100644 --- a/app/gui/oven_control/programmingmanualcoretemppopup.h +++ b/app/gui/oven_control/programmingmanualcoretemppopup.h @@ -15,8 +15,18 @@ public: explicit ProgrammingManualCoreTempPopup(QWidget *parent = 0); ~ProgrammingManualCoreTempPopup(); +private slots: + void updateCoreTempLabel(); + + void on_coreTempButton_clicked(); + void on_cancelButton_clicked(); + void on_applyButton_clicked(); + private: Ui::ProgrammingManualCoreTempPopup *ui; + +signals: + void coreTempEnabled(int); }; #endif // PROGRAMMINGMANUALCORETEMPPOPUP_H diff --git a/app/gui/oven_control/programmingmanualcoretemppopup.ui b/app/gui/oven_control/programmingmanualcoretemppopup.ui index 196bf73..5740cbe 100644 --- a/app/gui/oven_control/programmingmanualcoretemppopup.ui +++ b/app/gui/oven_control/programmingmanualcoretemppopup.ui @@ -1,21 +1,228 @@ + - - - ProgrammingManualCoreTempPopup 0 0 - 400 - 300 + 900 + 1600 Form + + #background { +background-image: url(:/images/background/manual_core.png); +margin-top: -720px; +} + +QPushButton[style="icon"] { +background-image: url(:/images/slider_icon/background.png); +background-repeat: no-repeat; +background-position: center; +border: none; +} + +QPushButton[style="interTemp"] { +background-repeat: no-repeat; +background-position: center; +background-clip: border; +background-origin: border; + +border-top: 130px; +border-style: hidden; +color: white; +font-size: 30px; +} + +QSlider::groove { +background-image: url(:/images/slider/groove_ticks.png); +background-repeat: no-repeat; +} + +QSlider::sub-page { +background-repeat: no-repeat; +margin: 5px; +} + +QSlider::handle { +background-image: url(:/images/slider/handle_big.png); +background-repeat: no-repeat; +width: 23px; +height: 33px; +} + + + + + 185 + 1012 + 666 + 33 + + + + QSlider::sub-page { background-image: url(:/images/slider/core.png); } + + + 30 + + + 99 + + + 30 + + + true + + + Qt::Horizontal + + + + + + 27 + 954 + 140 + 140 + + + + QPushButton { image: url(:/images/slider_icon/core_temp_enabled.png); } +QPushButton:pressed { image: url(:/images/slider_icon/core_temp_ov.png); } + + + icon + + + + + + 200 + 1260 + 250 + 190 + + + + QPushButton { background-image: url(:/images/manual_button/back.png); } +QPushButton:pressed { background-image: url(:/images/manual_button/back_ov.png); } + + + 이전으로 + + + interTemp + + + + + + 450 + 1260 + 250 + 190 + + + + QPushButton { background-image: url(:/images/manual_button/ok.png); } +QPushButton:pressed { background-image: url(:/images/manual_button/ok_ov.png); } + + + 확인/적용하기 + + + interTemp + + + + + + 0 + 720 + 900 + 730 + + + + + + true + + + + 690 + 1038 + 150 + 50 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + background + coreTempSlider + coreTempButton + cancelButton + applyButton + coreTempLabel - + + + diff --git a/app/gui/oven_control/programmingmanualwindow.cpp b/app/gui/oven_control/programmingmanualwindow.cpp index b722cea..8e8a112 100644 --- a/app/gui/oven_control/programmingmanualwindow.cpp +++ b/app/gui/oven_control/programmingmanualwindow.cpp @@ -1,14 +1,241 @@ #include "programmingmanualwindow.h" #include "ui_programmingmanualwindow.h" -ProgrammingManualWindow::ProgrammingManualWindow(QWidget *parent) : +#include "stringer.h" +#include "programmingmanualcoretemppopup.h" +#include "cookprogram.h" + +ProgrammingManualWindow::ProgrammingManualWindow(QWidget *parent, Define::Mode mode) : QMainWindow(parent), ui(new Ui::ProgrammingManualWindow) { ui->setupUi(this); + + ui->clockContainer->setParent(ui->upperStack); + setAttribute(Qt::WA_DeleteOnClose); + + connect(ui->humiditySlider, SIGNAL(valueChanged(int)), SLOT(updateHumidityLabel())); + connect(ui->tempSlider, SIGNAL(valueChanged(int)), SLOT(updateTempLabel())); + connect(ui->timeSlider, SIGNAL(valueChanged(int)), SLOT(updateTimeLabel())); + connect(ui->interTempSlider, SIGNAL(valueChanged(int)), SLOT(updateCoreTempLabel())); + + setDefault(mode); } ProgrammingManualWindow::~ProgrammingManualWindow() { delete ui; } + +void ProgrammingManualWindow::setDefault(Define::Mode mode) +{ + switch (mode) + { + case Define::SteamMode: + ui->steamButton->setChecked(true); + ui->humiditySlider->setEnabled(false); + ui->humiditySlider->setValue(100); + ui->tempSlider->setRange(30, 130); + ui->tempSlider->setValue(100); + ui->timeSlider->setValue(0); + ui->interTempSlider->setEnabled(false); + ui->interTempSlider->setValue(30); + setFan(4); + updateCoreTempButton(); + updateCoreTempLabel(); + this->mode = mode; + break; + case Define::CombiMode: + ui->combiButton->setChecked(true); + ui->humiditySlider->setEnabled(true); + ui->humiditySlider->setValue(50); + ui->tempSlider->setRange(30, 300); + ui->tempSlider->setValue(100); + ui->timeSlider->setValue(0); + ui->interTempSlider->setEnabled(false); + ui->interTempSlider->setValue(30); + setFan(4); + updateCoreTempButton(); + updateCoreTempLabel(); + this->mode = mode; + break; + case Define::DryMode: + ui->dryheatButton->setChecked(true); + ui->humiditySlider->setEnabled(false); + ui->humiditySlider->setValue(0); + ui->tempSlider->setRange(30, 300); + ui->tempSlider->setValue(160); + ui->timeSlider->setValue(0); + ui->interTempSlider->setEnabled(false); + ui->interTempSlider->setValue(30); + setFan(4); + updateCoreTempButton(); + updateCoreTempLabel(); + this->mode = mode; + break; + default: + return; + } +} + +void ProgrammingManualWindow::setFan(int level) +{ + fan = level; + + updateFanButton(); +} + +void ProgrammingManualWindow::updateHumidityLabel() +{ +// ui->humidityLabel->setText(QString::number(ui->humiditySlider->value())); + ui->humidityLabel->setText(QString("%1%").arg(ui->humiditySlider->value())); +} + +void ProgrammingManualWindow::updateTempLabel() +{ + ui->tempLabel->setText(Stringer::temperature(ui->tempSlider->value(), Stringer::fontSize14)); +} + +void ProgrammingManualWindow::updateTimeLabel() +{ + ui->timeLabel->setText(Stringer::remainingTime(ui->timeSlider->value() * 1000, Stringer::fontSize14)); +} + +void ProgrammingManualWindow::updateCoreTempButton() +{ + if (ui->interTempSlider->isEnabled()) + ui->interTempButton->setStyleSheet("\ +QPushButton {\ + image: url(:/images/slider_icon/core_temp_enabled.png);\ +}\ +QPushButton:pressed {\ + image: url(:/images/slider_icon/core_temp_ov.png);\ +}"); + else + ui->interTempButton->setStyleSheet("\ +QPushButton {\ + image: url(:/images/slider_icon/core_temp.png);\ +}\ +QPushButton:pressed {\ + image: url(:/images/slider_icon/core_temp_ov.png);\ +}"); +} + +void ProgrammingManualWindow::updateCoreTempLabel() +{ + if (ui->interTempSlider->isEnabled()) + ui->interTempLabel->setText(Stringer::temperature(ui->interTempSlider->value(), Stringer::fontSize14)); + else + ui->interTempLabel->setText(Stringer::unusedTemperature(Stringer::fontSize14)); +} + +void ProgrammingManualWindow::updateFanButton() +{ + switch (fan) + { + case 1: + ui->fanButton->setStyleSheet( + "background-image: url(:/images/manual_button/fan_1.png)"); + break; + case 2: + ui->fanButton->setStyleSheet( + "background-image: url(:/images/manual_button/fan_2.png)"); + break; + case 3: + ui->fanButton->setStyleSheet( + "background-image: url(:/images/manual_button/fan_3.png)"); + break; + case 4: + ui->fanButton->setStyleSheet( + "background-image: url(:/images/manual_button/fan_4.png)"); + break; + case 5: + ui->fanButton->setStyleSheet( + "background-image: url(:/images/manual_button/fan_5.png)"); + break; + default: + ui->fanButton->setStyleSheet( + "background-image: url(:/images/manual_button/fan_1.png)"); + break; + } +} + +void ProgrammingManualWindow::onCoreTempEnabled(int celsius) +{ + ui->interTempSlider->setEnabled(true); + ui->interTempSlider->setValue(celsius); + updateCoreTempButton(); + updateCoreTempLabel(); +} + +void ProgrammingManualWindow::on_steamButton_clicked() +{ + setDefault(Define::SteamMode); +} + +void ProgrammingManualWindow::on_combiButton_clicked() +{ + setDefault(Define::CombiMode); +} + +void ProgrammingManualWindow::on_dryheatButton_clicked() +{ + setDefault(Define::DryMode); +} + +void ProgrammingManualWindow::on_interTempButton_clicked() +{ + if (ui->interTempSlider->isEnabled()) + { + ui->interTempSlider->setEnabled(false); + updateCoreTempButton(); + updateCoreTempLabel(); + } + else + { + ProgrammingManualCoreTempPopup *p = new ProgrammingManualCoreTempPopup(this); + connect(p, SIGNAL(coreTempEnabled(int)), SLOT(onCoreTempEnabled(int))); + p->showFullScreen(); + } +} + +void ProgrammingManualWindow::on_fanButton_clicked() +{ + fan++; + if (fan > 5) + fan = 1; + + updateFanButton(); +} + +void ProgrammingManualWindow::on_backButton_clicked() +{ + close(); +} + +void ProgrammingManualWindow::on_configButton_clicked() +{ + +} + +void ProgrammingManualWindow::on_helpButton_clicked() +{ + +} + +void ProgrammingManualWindow::on_okButton_clicked() +{ + ManualCookSetting s; + s.mode = mode; + s.humidity = ui->humiditySlider->value(); + s.temp = ui->tempSlider->value(); + s.time = ui->timeSlider->value(); + s.coreTempEnabled = ui->interTempSlider->isEnabled(); + s.coreTemp = ui->interTempSlider->value(); + s.fan = fan; + + CookProgram::add(s); + + emit added(); + close(); +} diff --git a/app/gui/oven_control/programmingmanualwindow.h b/app/gui/oven_control/programmingmanualwindow.h index cf2104d..196a632 100644 --- a/app/gui/oven_control/programmingmanualwindow.h +++ b/app/gui/oven_control/programmingmanualwindow.h @@ -3,6 +3,8 @@ #include +#include "define.h" + namespace Ui { class ProgrammingManualWindow; } @@ -12,11 +14,39 @@ class ProgrammingManualWindow : public QMainWindow Q_OBJECT public: - explicit ProgrammingManualWindow(QWidget *parent = 0); + explicit ProgrammingManualWindow(QWidget *parent, Define::Mode mode); ~ProgrammingManualWindow(); private: Ui::ProgrammingManualWindow *ui; + + Define::Mode mode; + int fan; + +private slots: + void setDefault(Define::Mode mode); + void setFan(int level); + void updateHumidityLabel(); + void updateTempLabel(); + void updateTimeLabel(); + void updateCoreTempButton(); + void updateCoreTempLabel(); + void updateFanButton(); + + void onCoreTempEnabled(int celsius); + + void on_steamButton_clicked(); + void on_combiButton_clicked(); + void on_dryheatButton_clicked(); + void on_interTempButton_clicked(); + void on_fanButton_clicked(); + void on_backButton_clicked(); + void on_configButton_clicked(); + void on_helpButton_clicked(); + void on_okButton_clicked(); + +signals: + void added(); }; #endif // PROGRAMMINGMANUALWINDOW_H diff --git a/app/gui/oven_control/programmingmanualwindow.ui b/app/gui/oven_control/programmingmanualwindow.ui index 48df9fb..83b5e66 100644 --- a/app/gui/oven_control/programmingmanualwindow.ui +++ b/app/gui/oven_control/programmingmanualwindow.ui @@ -1,24 +1,996 @@ + - - - ProgrammingManualWindow 0 0 - 800 - 600 + 900 + 1600 MainWindow - - - + + #bottomBar { background-image: url(:/images/bottom_bar/background.png); } +#centralwidget { background-image: url(:/images/background/manual.png); } + +QPushButton { +background-repeat: no-repeat; +background-position: center; +border: none; +} + +QPushButton[style="mode"] { +background-clip: border; +background-origin: border; +margin-bottom: 50px; + +border-top: 200px; +border-bottom: -50px; +border-style: hidden; +color: #7B7B7B; +font-size: 40px; +} + +QPushButton[style="mode"]:checked { +color: white; +image: url(:/images/cook_mode/indicator.png); +image-position: bottom; +} + +QPushButton[style="icon"] { +background-image: url(:/images/slider_icon/background.png); +} + +QSlider::groove { +background-image: url(:/images/slider/groove_ticks.png); +background-repeat: no-repeat; +} + +QSlider::sub-page { +background-repeat: no-repeat; +margin: 5px; +} + +QSlider::handle { +background-image: url(:/images/slider/handle_big.png); +background-repeat: no-repeat; +width: 23px; +height: 33px; +} + + + + + true + + + + 690 + 810 + 150 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 0% + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 0 + 0 + 900 + 426 + + + + + #clockContainer { background-image: url(:/images/clock/background.png); } + + + + + 272 + 36 + 356 + 355 + + + + + + + 800 + 320 + 80 + 84 + + + + + + + #closeDoorWidget { background-image: url(:/images/clock/background.png); } + + + + + 366 + 20 + 251 + 292 + + + + + + + 430 + 170 + 85 + 24 + + + + :/images/animation/close_door_arrow.png + + + + + + + + 600 + 426 + 300 + 293 + + + + QPushButton { background-image: url(:/images/cook_mode/big_dryheat_hide.png); } +QPushButton:pressed { background-image: url(:/images/cook_mode/big_dryheat_ov.png); } +QPushButton:checked { background-image: url(:/images/cook_mode/big_dryheat.png); } + + + 건열 + + + true + + + true + + + mode + + + + + + 27 + 1025 + 140 + 140 + + + + QPushButton { image: url(:/images/slider_icon/time.png); } +QPushButton:pressed { image: url(:/images/slider_icon/time_ov.png); } + + + icon + + + + + true + + + + 780 + 740 + 91 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignCenter + + + + + + 185 + 1083 + 666 + 33 + + + + QSlider::sub-page { background-image: url(:/images/slider/time.png); } + + + 86400 + + + 60 + + + 3600 + + + 0 + + + Qt::Horizontal + + + + + false + + + + 185 + 1233 + 666 + 33 + + + + QSlider::sub-page { background-image: url(:/images/slider/core.png); } +QSlider::sub-page:disabled { background: #00000000; } +QSlider::handle:disabled { background: #00000000; } + + + 30 + + + 99 + + + 30 + + + Qt::Horizontal + + + + + true + + + + 690 + 1260 + 150 + 50 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + <span style="font-size:11pt;">℃</span> + + + Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing + + + + + true + + + + 780 + 890 + 91 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignCenter + + + + + true + + + + 160 + 890 + 91 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignCenter + + + + + + 0 + 1450 + 900 + 150 + + + + + + 232 + 26 + 97 + 97 + + + + QPushButton { border-image: url(:/images/bottom_bar/back.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); } + + + + + + + + + 345 + 26 + 97 + 97 + + + + QPushButton { border-image: url(:/images/bottom_bar/config.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/config_ov.png); } + + + + + + + + + 571 + 26 + 97 + 97 + + + + QPushButton { border-image: url(:/images/bottom_bar/006_sys_icon_16.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/006_sys_icon_16_ov.png); } + + + + + + + + + 458 + 26 + 97 + 97 + + + + QPushButton { border-image: url(:/images/bottom_bar/help.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); } + + + + + + + + + + 27 + 875 + 140 + 140 + + + + QPushButton { image: url(:/images/slider_icon/temp.png); } +QPushButton:pressed { image: url(:/images/slider_icon/temp_ov.png); } + + + icon + + + + + + 185 + 933 + 666 + 33 + + + + QSlider::sub-page { background-image: url(:/images/slider/temp.png); } + + + 6 + + + 0 + + + Qt::Horizontal + + + + + + 0 + 426 + 300 + 293 + + + + QPushButton { background-image: url(:/images/cook_mode/big_steam_hide.png); } +QPushButton:pressed { background-image: url(:/images/cook_mode/big_steam_ov.png); } +QPushButton:checked { background-image: url(:/images/cook_mode/big_steam.png); } + + + 스팀 + + + true + + + true + + + mode + + + + + true + + + + 690 + 960 + 150 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 30<span style="font-size:11pt;">℃</span> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + true + + + + 160 + 740 + 91 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignCenter + + + + + + 185 + 783 + 666 + 33 + + + + QSlider::sub-page { background-image: url(:/images/slider/humidity.png); } + + + 100 + + + Qt::Horizontal + + + + + + 27 + 725 + 140 + 140 + + + + QPushButton { image: url(:/images/slider_icon/humidity.png); } +QPushButton:pressed { image: url(:/images/slider_icon/humidity_ov.png); } + + + icon + + + + + + 27 + 1175 + 140 + 140 + + + + QPushButton { image: url(:/images/slider_icon/core_temp.png); } +QPushButton:pressed { image: url(:/images/slider_icon/core_temp_ov.png); } + + + icon + + + + + + 300 + 426 + 300 + 293 + + + + QPushButton { background-image: url(:/images/cook_mode/big_combi_hide.png); } +QPushButton:pressed { background-image: url(:/images/cook_mode/big_combi_ov.png); } +QPushButton:checked { background-image: url(:/images/cook_mode/big_combi.png); } + + + 콤비 + + + true + + + true + + + mode + + + + + true + + + + 539 + 1110 + 301 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 0<span style="font-size:11pt;">초</span> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 449 + 1319 + 112 + 131 + + + + QPushButton { background-image: url(:/images/manual_button/fan_4.png); } + + + - + + + Clock + QWidget +
clock.h
+ 1 +
+ + WashWarnIcon + QLabel +
washwarnicon.h
+
+ + AnimatedImageBox + QLabel +
animatedimagebox.h
+
+
+ + +
diff --git a/app/gui/oven_control/programmingselectionwindow.cpp b/app/gui/oven_control/programmingselectionwindow.cpp index e19a6f3..cdb006c 100644 --- a/app/gui/oven_control/programmingselectionwindow.cpp +++ b/app/gui/oven_control/programmingselectionwindow.cpp @@ -1,14 +1,107 @@ #include "programmingselectionwindow.h" #include "ui_programmingselectionwindow.h" +#include "programmingmanualwindow.h" + ProgrammingSelectionWindow::ProgrammingSelectionWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::ProgrammingSelectionWindow) { ui->setupUi(this); + +// ui->clockContainer->setParent(ui->upperStack); + setAttribute(Qt::WA_DeleteOnClose); + + setFocus(); } ProgrammingSelectionWindow::~ProgrammingSelectionWindow() { delete ui; } + +void ProgrammingSelectionWindow::setModeEnabled(bool enabled) +{ + ui->steamButton->setEnabled(enabled); + ui->combiButton->setEnabled(enabled); + ui->dryheatButton->setEnabled(enabled); +} + +void ProgrammingSelectionWindow::setCookTypeEnabled(bool enabled) +{ + ui->poultryButton->setEnabled(enabled); + ui->meatButton->setEnabled(enabled); + ui->fishButton->setEnabled(enabled); + ui->dessertButton->setEnabled(enabled); + ui->grainButton->setEnabled(enabled); + ui->breadButton->setEnabled(enabled); + ui->etcButton->setEnabled(enabled); +} + +void ProgrammingSelectionWindow::onModeClicked(Define::Mode mode) +{ + ProgrammingManualWindow *w = new ProgrammingManualWindow(this, mode); + connect(w, SIGNAL(added()), SIGNAL(added())); + connect(w, SIGNAL(destroyed(QObject*)), SLOT(deleteLater())); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + hide(); +} + +void ProgrammingSelectionWindow::onCookTypeClicked(Define::CookType type) +{ + emit cookTypeSelected(type); + close(); +} + +void ProgrammingSelectionWindow::on_steamButton_clicked() +{ + onModeClicked(Define::SteamMode); +} + +void ProgrammingSelectionWindow::on_combiButton_clicked() +{ + onModeClicked(Define::CombiMode); +} + +void ProgrammingSelectionWindow::on_dryheatButton_clicked() +{ + onModeClicked(Define::DryMode); +} + +void ProgrammingSelectionWindow::on_poultryButton_clicked() +{ + onCookTypeClicked(Define::Poultry); +} + +void ProgrammingSelectionWindow::on_meatButton_clicked() +{ + onCookTypeClicked(Define::Meat); +} + +void ProgrammingSelectionWindow::on_fishButton_clicked() +{ + onCookTypeClicked(Define::Fish); +} + +void ProgrammingSelectionWindow::on_dessertButton_clicked() +{ + onCookTypeClicked(Define::Desert); +} + +void ProgrammingSelectionWindow::on_grainButton_clicked() +{ + onCookTypeClicked(Define::Vegetable); +} + +void ProgrammingSelectionWindow::on_breadButton_clicked() +{ + onCookTypeClicked(Define::Bread); +} + +void ProgrammingSelectionWindow::on_etcButton_clicked() +{ + onCookTypeClicked(Define::Etc); +} diff --git a/app/gui/oven_control/programmingselectionwindow.h b/app/gui/oven_control/programmingselectionwindow.h index 7fafca6..23149f8 100644 --- a/app/gui/oven_control/programmingselectionwindow.h +++ b/app/gui/oven_control/programmingselectionwindow.h @@ -3,6 +3,8 @@ #include +#include "define.h" + namespace Ui { class ProgrammingSelectionWindow; } @@ -15,8 +17,31 @@ public: explicit ProgrammingSelectionWindow(QWidget *parent = 0); ~ProgrammingSelectionWindow(); + void setModeEnabled(bool enabled); + void setCookTypeEnabled(bool enabled); + private: Ui::ProgrammingSelectionWindow *ui; + +signals: + void added(); + void modeSelected(Define::Mode); + void cookTypeSelected(Define::CookType); + +private slots: + void onModeClicked(Define::Mode mode); + void onCookTypeClicked(Define::CookType type); + + void on_steamButton_clicked(); + void on_combiButton_clicked(); + void on_dryheatButton_clicked(); + void on_poultryButton_clicked(); + void on_meatButton_clicked(); + void on_fishButton_clicked(); + void on_dessertButton_clicked(); + void on_grainButton_clicked(); + void on_breadButton_clicked(); + void on_etcButton_clicked(); }; #endif // PROGRAMMINGSELECTIONWINDOW_H diff --git a/app/gui/oven_control/programmingselectionwindow.ui b/app/gui/oven_control/programmingselectionwindow.ui index 84534fd..01eae84 100644 --- a/app/gui/oven_control/programmingselectionwindow.ui +++ b/app/gui/oven_control/programmingselectionwindow.ui @@ -1,24 +1,704 @@ + - - - ProgrammingSelectionWindow 0 0 - 800 - 600 + 900 + 1600 MainWindow - - - + + #centralwidget { background-image: url(:/images/background/main.png); } +#bottomBar { background-image: url(:/images/bottom_bar/background.png); } + +QWidget { outline: none; } + +QPushButton[style="mode"] { +background-repeat: no-repeat; +background-position: center; +background-clip: border; +background-origin: border; +margin-bottom: 50px; + +border-top: 200px; +border-bottom: -50px; +border-style: hidden; +color: white; +font-size: 40px; +} + +QPushButton[style="type"] { +background-repeat: no-repeat; +background-position: center; +background-clip: border; +background-origin: border; + +border-top: 165px; +border-style: hidden; +color: white; +font-size: 30px; +} + +QPushButton[style="function"] { +background-repeat: no-repeat; +background-position: center; +background-clip: border; +background-origin: border; + +border-top: 206px; +border-style: hidden; +color: white; +font-size: 30px; +} + +QPushButton:disabled { color: #7B7B7B; } + + + + + false + + + + 675 + 720 + 225 + 222 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/cook_type/desert.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/desert_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_type/desert_hide.png); } + + + 디저트류 + + + type + + + + + false + + + + 450 + 720 + 225 + 222 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/cook_type/fish.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/fish_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_type/fish_hide.png); } + + + 생선류 + + + type + + + + + + 675 + 993 + 1 + 120 + + + + Qt::Vertical + + + + + + 225 + 993 + 1 + 120 + + + + Qt::Vertical + + + + + false + + + + 0 + 1164 + 300 + 286 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/main_button/multi.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/multi_ov.png); } +QPushButton:disabled { background-image: url(:/images/main_button/multi_hide.png); } + + + 다중요리 + + + function + + + + + false + + + + 0 + 942 + 225 + 222 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/cook_type/vegetable.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/vegetable_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_type/vegetable_hide.png); } + + + 채소및곡류 + + + type + + + + + false + + + + 225 + 720 + 225 + 222 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/cook_type/meat.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/meat_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_type/meat_hide.png); } + + + 육류 + + + type + + + + + + 0 + 1450 + 900 + 150 + + + + + 900 + 150 + + + + + 900 + 150 + + + + + + 345 + 26 + 97 + 97 + + + + + 0 + 0 + + + + + 62 + 71 + + + + QPushButton { border-image: url(:/images/bottom_bar/config.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/config_ov.png); } + + + + + + + + + 458 + 26 + 97 + 97 + + + + + 0 + 0 + + + + + 62 + 71 + + + + QPushButton { border-image: url(:/images/bottom_bar/help.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/help_ov.png); } + + + + + + + + + + 675 + 771 + 1 + 120 + + + + Qt::Vertical + + + + + false + + + + 600 + 426 + 300 + 293 + + + + QPushButton { background-image: url(:/images/cook_mode/big_dryheat.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_dryheat_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_mode/big_dryheat_hide.png); } + + + 건열 + + + mode + + + + + false + + + + 450 + 942 + 225 + 222 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/cook_type/etc.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/etc_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_type/etc_hide.png); } + + + 기타요리 + + + type + + + + + + 18 + 942 + 863 + 1 + + + + Qt::Horizontal + + + + + false + + + + 600 + 1164 + 300 + 286 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/main_button/wash.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/wash_ov.png); } +QPushButton:disabled { background-image: url(:/images/main_button/wash_hide.png); } + + + 세척모드 + + + function + + + + + false + + + + 300 + 1164 + 300 + 286 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/main_button/custom.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/custom_ov.png); } +QPushButton:disabled { background-image: url(:/images/main_button/custom_hide.png); } + + + 프로그래밍모드 + + + function + + + + + false + + + + 0 + 426 + 300 + 293 + + + + QPushButton { background-image: url(:/images/cook_mode/big_steam.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_steam_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_mode/big_steam_hide.png); } + + + 스팀 + + + mode + + + + + + 225 + 771 + 1 + 120 + + + + Qt::Vertical + + + + + + 450 + 993 + 1 + 120 + + + + Qt::Vertical + + + + + + 450 + 771 + 1 + 120 + + + + Qt::Vertical + + + + + false + + + + 0 + 720 + 225 + 222 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/cook_type/poultry.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/poultry_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_type/poultry_hide.png); } + + + 가금류 + + + type + + + + + false + + + + 300 + 426 + 300 + 293 + + + + QPushButton { background-image: url(:/images/cook_mode/big_combi.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_combi_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_mode/big_combi_hide.png); } + + + 콤비 + + + mode + + + + + false + + + + 675 + 942 + 225 + 222 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/cook_type/additional.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/additional_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_type/additional_hide.png); } + + + 부가기능 + + + type + + + + + + 0 + 0 + 900 + 426 + + + + #clockContainer { background-image: url(:/images/clock/background.png); } + + + + + 272 + 36 + 356 + 355 + + + + + + + 800 + 320 + 80 + 84 + + + + + + + false + + + + 225 + 942 + 225 + 222 + + + + + 0 + 0 + + + + QPushButton { background-image: url(:/images/cook_type/bread.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/bread_ov.png); } +QPushButton:disabled { background-image: url(:/images/cook_type/bread_hide.png); } + + + 제과제빵류 + + + type + + + - + + + Clock + QWidget +
clock.h
+ 1 +
+ + WashWarnIcon + QLabel +
washwarnicon.h
+
+
+ + steamButton + combiButton + dryheatButton + poultryButton + meatButton + fishButton + dessertButton + grainButton + breadButton + etcButton + primeButton + multiButton + programmingButton + washButton + configButton + helpButton + +
diff --git a/app/gui/oven_control/programmingwindow.cpp b/app/gui/oven_control/programmingwindow.cpp index 456edcd..6ef92c3 100644 --- a/app/gui/oven_control/programmingwindow.cpp +++ b/app/gui/oven_control/programmingwindow.cpp @@ -1,6 +1,13 @@ #include "programmingwindow.h" #include "ui_programmingwindow.h" +#include +#include + +#include "programmingmanualwindow.h" +#include "programmingselectionwindow.h" +#include "cookprogram.h" + ProgrammingWindow::ProgrammingWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::ProgrammingWindow) @@ -9,6 +16,8 @@ ProgrammingWindow::ProgrammingWindow(QWidget *parent) : ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); + + setupUi(); } ProgrammingWindow::~ProgrammingWindow() @@ -16,7 +25,186 @@ ProgrammingWindow::~ProgrammingWindow() delete ui; } +void ProgrammingWindow::listAuto() +{ + if (!ui->autoButton->isChecked()) + { + ui->autoButton->blockSignals(true); + ui->autoButton->setChecked(true); + ui->autoButton->blockSignals(false); + } + + listButtons(CookProgram::listAuto()); +} + +void ProgrammingWindow::listManual() +{ + if (!ui->manualButton->isChecked()) + { + ui->manualButton->blockSignals(true); + ui->manualButton->setChecked(true); + ui->manualButton->blockSignals(false); + } + + listButtons(CookProgram::listManual()); +} + +void ProgrammingWindow::setupUi() +{ + ui->verticalScrollLayout->setAlignment(Qt::AlignTop); + + QFont font = ui->addButton->font(); + font.setPixelSize(30); + + int textWidth = QFontMetrics(font).width(tr("추가하기")); + + QPixmap iconPix(":/images/etc/bar_icon_03.png"); + + QPixmap pixmap(QSize(iconPix.width() + 20 + textWidth, ui->addButton->height())); + pixmap.fill(Qt::transparent); + + QRect textRect(iconPix.width() + 20, 0, textWidth, pixmap.height()); + + QPainter painter(&pixmap); + painter.setFont(font); + painter.setPen(Qt::white); + painter.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, tr("추가하기")); + painter.drawPixmap(0, (pixmap.height() - iconPix.height()) / 2, iconPix); + + QIcon icon(pixmap); + ui->addButton->setIcon(icon); + ui->addButton->setIconSize(pixmap.size()); + ui->addButton->hide(); +} + +void ProgrammingWindow::updateView() +{ + if (ui->autoButton->isChecked()) + listAuto(); + else if (ui->manualButton->isChecked()) + listManual(); +} + +void ProgrammingWindow::listButtons(QList record) +{ + clear(); + + ui->addButton->show(); + + foreach (CookRecord r, record) + newButton(r); + + ui->scrollAreaWidgetContents->adjustSize(); +} + +void ProgrammingWindow::clear() +{ + lastInfoDisplayed = NULL; + while (!list.isEmpty()) + list.takeFirst()->deleteLater(); +} + +CookPanelButton *ProgrammingWindow::newButton(CookRecord record) +{ + CookPanelButton *button = new CookPanelButton(record, this); + connect(button, SIGNAL(infoClicked(CookPanelButton*)), SLOT(onInfoButtonClicked(CookPanelButton*))); + connect(button, SIGNAL(deleteClicked(CookPanelButton*)), SLOT(onDeleteButtonClicked(CookPanelButton*))); + + ui->verticalScrollLayout->addWidget(button); + list.append(button); + + return button; +} + +void ProgrammingWindow::onInfoButtonClicked(CookPanelButton *panelButton) +{ + if (lastInfoDisplayed) + { + if (panelButton == lastInfoDisplayed) + { + lastInfoDisplayed->hideInfo(); + lastInfoDisplayed = NULL; + + ui->scrollAreaWidgetContents->adjustSize(); + } + else + { + lastInfoDisplayed->hideInfo(); + lastInfoDisplayed = panelButton; + lastInfoDisplayed->showInfo(); + + ui->scrollAreaWidgetContents->adjustSize(); + ui->scrollArea->ensureWidgetVisible(lastInfoDisplayed); + } + } + else + { + lastInfoDisplayed = panelButton; + lastInfoDisplayed->showInfo(); + + ui->scrollAreaWidgetContents->adjustSize(); + ui->scrollArea->ensureWidgetVisible(lastInfoDisplayed); + } +} + +void ProgrammingWindow::onDeleteButtonClicked(CookPanelButton *panelButton) +{ + if (panelButton == lastInfoDisplayed) + lastInfoDisplayed = NULL; + + CookProgram::remove(panelButton->record); + + list.removeAll(panelButton); + panelButton->deleteLater(); +} + +void ProgrammingWindow::on_addButton_clicked() +{ + ProgrammingSelectionWindow *w = new ProgrammingSelectionWindow(this); + + if (ui->autoButton->isChecked()) + w->setCookTypeEnabled(true); + else if (ui->manualButton->isChecked()) + w->setModeEnabled(true); + + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + connect(w, SIGNAL(added()), SLOT(updateView())); +} + +void ProgrammingWindow::on_autoButton_toggled(bool checked) +{ + if (!checked) + return; + + listAuto(); +} + +void ProgrammingWindow::on_manualButton_toggled(bool checked) +{ + if (!checked) + return; + + listManual(); +} + void ProgrammingWindow::on_backButton_clicked() { + CookProgram::discard(); + + close(); +} + +void ProgrammingWindow::on_saveButton_clicked() +{ + CookProgram::save(); + close(); } + +void ProgrammingWindow::on_helpButton_clicked() +{ + +} diff --git a/app/gui/oven_control/programmingwindow.h b/app/gui/oven_control/programmingwindow.h index ff8d118..b558749 100644 --- a/app/gui/oven_control/programmingwindow.h +++ b/app/gui/oven_control/programmingwindow.h @@ -3,6 +3,8 @@ #include +#include "cookpanelbutton.h" + namespace Ui { class ProgrammingWindow; } @@ -15,11 +17,34 @@ public: explicit ProgrammingWindow(QWidget *parent = 0); ~ProgrammingWindow(); + void listAuto(); + void listManual(); + private slots: + void setupUi(); + void updateView(); + + void listButtons(QList record); + void clear(); + CookPanelButton *newButton(CookRecord record); + + void onInfoButtonClicked(CookPanelButton *panelButton); + void onDeleteButtonClicked(CookPanelButton *panelButton); + + void on_addButton_clicked(); + + void on_autoButton_toggled(bool checked); + void on_manualButton_toggled(bool checked); + void on_backButton_clicked(); + void on_saveButton_clicked(); + void on_helpButton_clicked(); private: Ui::ProgrammingWindow *ui; + + QList list; + CookPanelButton *lastInfoDisplayed; }; #endif // PROGRAMMINGWINDOW_H diff --git a/app/gui/oven_control/programmingwindow.ui b/app/gui/oven_control/programmingwindow.ui index 70e5ee9..3f0d6a0 100644 --- a/app/gui/oven_control/programmingwindow.ui +++ b/app/gui/oven_control/programmingwindow.ui @@ -16,11 +16,16 @@ #centralwidget { background-image: url(:/images/background/etc.png); } #bottomBar { background-image: url(:/images/bottom_bar/background.png); } +QScrollArea { background: transparent; } +QScrollArea > QWidget > QWidget { background: transparent; } - -QPushButton[style="mode"] { +QPushButton { background-repeat: no-repeat; background-position: center; +border: none; +color: white; +} +QPushButton[style="mode"] { background-clip: border; background-origin: border; margin-bottom: 50px; @@ -28,13 +33,35 @@ margin-bottom: 50px; border-top: 130px; border-bottom: -50px; border-style: hidden; -color: white; font-size: 30px; } QPushButton[style="mode"]:checked { image: url(:/images/cook_mode/indicator.png); image-position: bottom; +} + +QScrollBar:vertical { +border: none; +background: transparent; +width: 35px; +margin: 30px 15px 30px 0px; +} +QScrollBar::handle:vertical { +background: #B7B7B7; +border-radius: 10px; +min-height: 100px; +} +QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { +border: none; +background: none; +height: 0px; +} +QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical { +border: none; +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { +background: none; } @@ -100,7 +127,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); } - + 402 @@ -146,7 +173,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); } - + 0 @@ -172,7 +199,7 @@ QPushButton:pressed { background-image: url(:/images/etc/main_btn_01_ov.png); }< - + 0 @@ -199,6 +226,63 @@ QPushButton:pressed { background-image: url(:/images/etc/main_btn_02_ov.png); }< + + + + 0 + 647 + 900 + 803 + + + + true + + + + + 0 + 0 + 898 + 801 + + + + + 10 + + + 20 + + + 28 + + + 28 + + + + + + 0 + 0 + + + + + 821 + 65 + + + + QPushButton { background-image: url(:/images/etc/bar_01.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/etc/bar_02.png); } + + + + + + -- 2.1.4