From 774c1995b273ddcbc31604ac8d38801490ff1cf0 Mon Sep 17 00:00:00 2001 From: byloveletter Date: Mon, 8 May 2017 20:12:33 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=8C=9D=EC=97=85=20?= =?UTF-8?q?=ED=88=AC=EB=AA=85=20=ED=9A=A8=EA=B3=BC=20=EC=9E=AC=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Parent Window 인자 처리 완료 --- app/gui/oven_control/config.cpp | 124 +++++++++++++++++++++++++ app/gui/oven_control/config.h | 139 ++++++++++++++++++++++++++++- app/gui/oven_control/errorpopupdlg.cpp | 2 + app/gui/oven_control/errorpopupdlg.h | 4 + app/gui/oven_control/errorpopupdlg.ui | 4 +- app/gui/oven_control/main.cpp | 3 + app/gui/oven_control/operationtimemode.cpp | 2 +- app/gui/oven_control/ovenstatics.cpp | 11 +-- app/gui/oven_control/ovenstatics.h | 2 +- 9 files changed, 280 insertions(+), 11 deletions(-) diff --git a/app/gui/oven_control/config.cpp b/app/gui/oven_control/config.cpp index ecc9730..55e02f9 100644 --- a/app/gui/oven_control/config.cpp +++ b/app/gui/oven_control/config.cpp @@ -1,6 +1,130 @@ +#include #include "config.h" +using namespace Define; + +Config* Config::instance = NULL; + Config::Config(QObject *parent) : QObject(parent) { + memcpy(config_format,config_format_kr,MAX_CONFIG_COUNT*64); +// m_setFavorite.insert(2); +// m_setFavorite.insert(3); +// m_setFavorite.insert(1); +// QSetIterator i = getConstBeginFavorite(); +// while(i.hasNext()){ +// temp = i.next(); +// qDebug() << temp; +// } +// while(i.hasPrevious()){ +// temp = i.previous(); +// qDebug() << temp; +// } +} + +Config::~Config(){ + +} +Config* Config::getInstance(QObject *parent){ + if(instance ==NULL){ + instance = new Config(parent); + } + return instance; } + +bool Config::saveConfig(){ + return false; +} + +bool Config::loadConfig(){ + return false; +} + + +Define::config_item Config::getConfigValue(Define::ConfigType idx){ + return configlist.values[idx]; +} + + + +void Config::setConfigValue(Define::ConfigType idx, Define::config_item& itemdata){ + configlist.values[idx] = itemdata; +} + + +QString Config::getValueString(Define::ConfigType idx){ + QString qstrTemp=""; + if( (config_data_type[(uint32_t)idx] & 0x80) ==0){ + switch(config_data_type[(uint32_t)idx]){ + case 0: + qstrTemp.sprintf(config_format[(uint32_t)idx], configlist.values[(uint32_t)idx].d32); + break; + case 1: + qstrTemp.sprintf(config_format[(uint32_t)idx], configlist.values[(uint32_t)idx].f32); + break; + } + } + switch(idx){ + case config_language: + qstrTemp = tr(language_menu[configlist.items.language.d32]); + break; + } + return qstrTemp; +} + +QString Config::getTitleString(Define::ConfigType idx){ + QString strTemp =""; + strTemp = tr(config_title[idx]); + return strTemp; +} + +bool Config::isFavorite(Define::ConfigType idx){ + return m_setFavorite.contains((uint32_t)idx); + return true; +} + +QSetIterator Config::getConstBeginFavorite(){ + QSetIterator i(m_setFavorite); + return i; +} + +bool Config::loadFavorite(void){ + return false; +} + +bool Config::saveFavorite(void){ + return false; +} + +void Config::insertFavorite(Define::ConfigType idx){ + m_setFavorite.insert((uint32_t)idx); +} +void Config::removeFavorite(Define::ConfigType idx){ + m_setFavorite.remove((uint32_t)idx); +} + +QString Config::getDateTimeString(uint32_t sec){ + Config* ins = getInstance(); + QString strTemp=""; + if(ins->configlist.items.temptype.d32==0){ + + } + return strTemp; +} + +QString Config::getTempString(int cel_temp){ + Config* ins = getInstance(); + QString strTemp=""; + if(ins->configlist.items.temptype.d32==0){ + + } + return strTemp; +} + +void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){ + +} + + + diff --git a/app/gui/oven_control/config.h b/app/gui/oven_control/config.h index fcaf62f..e34ae64 100644 --- a/app/gui/oven_control/config.h +++ b/app/gui/oven_control/config.h @@ -3,29 +3,162 @@ #include +#include + +#define STRUCT_PACK __attribute__ ((packed)) + + +#define MAX_CONFIG_COUNT 14 namespace Define { enum ConfigType { - + config_language = 0, + config_datetime, + config_temptype, + config_backlight, + config_stop_delay, + config_best_dish_weight, + config_party_dish_weight, + config_ilc_rack_number, + config_ilc_rack_sequnece, + config_ilc_cook_wait_time, + config_cooktime_format, + config_time_type, + config_resttime_format, + config_marster_vol, }; + + typedef union _config_item{ + uint32_t d32; + float f32; + struct{ + uint8_t d8_0; + uint8_t d8_1; + uint8_t d8_2; + uint8_t d8_3; + }d8; + }config_item; + + typedef union _config_lists{ + uint8_t data[MAX_CONFIG_COUNT*4]; + config_item values[MAX_CONFIG_COUNT]; + struct{ + config_item language; + config_item datetime; + config_item temptype; + config_item backlight; + config_item stop_delay; + config_item best_dish_weight; + config_item party_dish_weight; + config_item ilc_rack_number; + config_item ilc_rack_sequnece; + config_item ilc_cook_wait_time; + config_item cooktime_format; + config_item time_type; + config_item resttime_format; + config_item marster_vol; + }items; + }STRUCT_PACK config_lists; } + + class Config : public QObject { Q_OBJECT explicit Config(QObject *parent = 0); + ~Config(void); static Config *instance; + const char language_menu[3][20]{ + "한국어\0", + "中國語\0", + "English" + }; + + + /* config_data_type Description + * 80 = Custom + * 0 = int + * 1 = float + */ + const uint8_t config_data_type[MAX_CONFIG_COUNT] = { + 0x80, 0x80, 0x80, 0, 0, 0, 0, 0, 0, 0, + 0x80,0x80,0x80,0 + }; + + const char config_format_kr[MAX_CONFIG_COUNT][64]={ + "%S", + "%S", + "%S", + "%d", + "%d 분", + "%d g", //5 + "%d g", + "%d", + "%d", + "%d min", //9 + "%S", + "%S", + "%S", + "%d" + }; + + char config_format[MAX_CONFIG_COUNT][64]; + + const char config_title[MAX_CONFIG_COUNT][64]={ + "언어설정", //0 + "날짜와 시간", + "온도단위", + "화면밝기", + "응축식 후드의 정지지연", + "일품요리용 접시무게", //5 + "연회용 접시무게", + "ILC 조리선반 개수", + "ILC 조리선반 순서", + "ILC 조리 온습도 대기시간", //9 + "조리시간 포맷", + "실시간 포맷", + "잔여시간 포맷", + "마스터 볼륨" + }; + + QSet m_setFavorite; + + public: - static Config *getInstance(); - static void init(); + static Config *getInstance(QObject *parent=0); + //static void init(); + bool loadConfig(void); + bool saveConfig(void); + Define::config_item getConfigValue(Define::ConfigType idx); + void setConfigValue(Define::ConfigType idx, Define::config_item& itemdata); + QString getValueString(Define::ConfigType idx); + QString getTitleString(Define::ConfigType idx); + bool isFavorite(Define::ConfigType idx); + QSetIterator getConstBeginFavorite(); + bool loadFavorite(void); + bool saveFavorite(void); + void insertFavorite(Define::ConfigType idx); + void removeFavorite(Define::ConfigType idx); + static QString getDateTimeString(uint32_t sec); + static QString getTempString(int cel_temp); + + void execConfigWindow(QWidget *parent, Define::ConfigType idx); + + + Define::config_lists configlist; + + signals: public slots: }; + + #endif // CONFIG_H diff --git a/app/gui/oven_control/errorpopupdlg.cpp b/app/gui/oven_control/errorpopupdlg.cpp index 9c1be5c..de060ec 100644 --- a/app/gui/oven_control/errorpopupdlg.cpp +++ b/app/gui/oven_control/errorpopupdlg.cpp @@ -13,6 +13,7 @@ ErrorPopupDlg::ErrorPopupDlg(QWidget *parent, const QString &MsgDesc, const QStr ui->centralwidget->setWindowFlags(Qt::FramelessWindowHint); ui->ctrlWarnDescription->setText(MsgDesc); ui->ctrlWarnTitle->setText(MsgTitle); + m_pParent = parent; } ErrorPopupDlg::~ErrorPopupDlg() @@ -22,5 +23,6 @@ ErrorPopupDlg::~ErrorPopupDlg() void ErrorPopupDlg::on_ctrlOkBtn_clicked() { + emit closedPopup(m_pParent); close(); } diff --git a/app/gui/oven_control/errorpopupdlg.h b/app/gui/oven_control/errorpopupdlg.h index 7152f36..899ef84 100644 --- a/app/gui/oven_control/errorpopupdlg.h +++ b/app/gui/oven_control/errorpopupdlg.h @@ -15,11 +15,15 @@ public: explicit ErrorPopupDlg(QWidget *parent = 0, const QString &MsgDesc=0, const QString &MsgTitle=0); ~ErrorPopupDlg(); +signals: + void closedPopup(QWidget* parent=0); + private slots: void on_ctrlOkBtn_clicked(); private: Ui::ErrorPopupDlg *ui; + QWidget* m_pParent; }; #endif // ERRORPOPUPDLG_H diff --git a/app/gui/oven_control/errorpopupdlg.ui b/app/gui/oven_control/errorpopupdlg.ui index d544361..7d34f0c 100644 --- a/app/gui/oven_control/errorpopupdlg.ui +++ b/app/gui/oven_control/errorpopupdlg.ui @@ -16,7 +16,9 @@ #centralwidget { background-image: url(:/images/background/popup/error.png); background-color: rgba(0, 0, 0, 255); -} +} + +QDialog { background: transparent; } diff --git a/app/gui/oven_control/main.cpp b/app/gui/oven_control/main.cpp index 9916c7f..858f84e 100644 --- a/app/gui/oven_control/main.cpp +++ b/app/gui/oven_control/main.cpp @@ -3,6 +3,7 @@ #include "ovencontroller.h" #include "udphandler.h" #include "ovenstatics.h" +#include "config.h" #include int main(int argc, char *argv[]) @@ -18,6 +19,8 @@ int main(int argc, char *argv[]) interface->setUdpHandler(udp); OvenStatistics::getInstance(oven); + Config::getInstance(oven); + MainWindow w; w.showFullScreen(); diff --git a/app/gui/oven_control/operationtimemode.cpp b/app/gui/oven_control/operationtimemode.cpp index bce4b04..725d409 100644 --- a/app/gui/oven_control/operationtimemode.cpp +++ b/app/gui/oven_control/operationtimemode.cpp @@ -29,7 +29,7 @@ void OperationTimeMode::reloadUi(void){ uint32_t timetemp; OvenStatistics* ovs = OvenStatistics::getInstance(); QString strTemp=""; - uint32_t totaltime; + uint32_t totaltime=0; if(ovs!=NULL){ //건열 조리 모드 timetemp = ovs->srvdata->use_log.items.cook_dry_mode; diff --git a/app/gui/oven_control/ovenstatics.cpp b/app/gui/oven_control/ovenstatics.cpp index aa5e6a0..11b5c7c 100644 --- a/app/gui/oven_control/ovenstatics.cpp +++ b/app/gui/oven_control/ovenstatics.cpp @@ -539,8 +539,9 @@ void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype, { if(m_bPopupShow==false){ m_bPopupShow = true; - ErrorPopupDlg *dlg = new ErrorPopupDlg(0,MsgDesc,MsgTitle); - connect(dlg,SIGNAL(destroyed(QObject*)),this, SLOT(onErrorPopupClosed())); + ErrorPopupDlg *dlg = new ErrorPopupDlg(QApplication::activeWindow(),MsgDesc,MsgTitle); + //connect(dlg,SIGNAL(destroyed(QObject*)),this, SLOT(onErrorPopupClosed())); + connect(dlg,SIGNAL(closedPopup(QWidget*)),this, SLOT(onErrorPopupClosed(QWidget*))); dlg->showFullScreen(); m_nLastPopupidx = erridx; } @@ -583,7 +584,7 @@ type_temp OvenStatistics::getCurSensorValueByIdx(uint16_t idx){ return curSensorValue[idx]; } -void OvenStatistics::onErrorPopupClosed(void){ +void OvenStatistics::onErrorPopupClosed(QWidget* parent){ qDebug() << "Error Popup Closed!"; if(bNeedErrorClear) { qDebug() << "send error clear command"; @@ -595,9 +596,9 @@ void OvenStatistics::onErrorPopupClosed(void){ item = m_mapPopupList.first(); m_nLastPopupidx = m_mapPopupList.firstKey(); bNeedErrorClear = item.bNeedClear; - ErrorPopupDlg *dlg = new ErrorPopupDlg(0,item.strDesc,item.strTitle); + ErrorPopupDlg *dlg = new ErrorPopupDlg(parent,item.strDesc,item.strTitle); m_mapPopupList.remove(m_nLastPopupidx); - connect(dlg,SIGNAL(destroyed(QObject*)),this, SLOT(onErrorPopupClosed())); + connect(dlg,SIGNAL(closedPopup(QWidget*)),this, SLOT(onErrorPopupClosed(QWidget*))); dlg->showFullScreen(); } else{ diff --git a/app/gui/oven_control/ovenstatics.h b/app/gui/oven_control/ovenstatics.h index df24c2a..b729f94 100644 --- a/app/gui/oven_control/ovenstatics.h +++ b/app/gui/oven_control/ovenstatics.h @@ -258,7 +258,7 @@ private: public slots: void onDataChanged(); void oneSecTimerFired(void); - void onErrorPopupClosed(void); + void onErrorPopupClosed(QWidget* parent); }; #endif // OVENSTATICS_H -- 2.1.4