diff --git a/app/gui/oven_control/config.cpp b/app/gui/oven_control/config.cpp index 55e02f9..3129f4c 100644 --- a/app/gui/oven_control/config.cpp +++ b/app/gui/oven_control/config.cpp @@ -1,4 +1,5 @@ #include +#include #include "config.h" using namespace Define; @@ -63,11 +64,45 @@ QString Config::getValueString(Define::ConfigType idx){ case 1: qstrTemp.sprintf(config_format[(uint32_t)idx], configlist.values[(uint32_t)idx].f32); break; + case 2: + qstrTemp = tr(config_format[(uint32_t)idx]); } + return qstrTemp; } + + QDateTime qdt = QDateTime::currentDateTime(); + switch(idx){ case config_language: - qstrTemp = tr(language_menu[configlist.items.language.d32]); + if(configlist.items.language.d32 >=3) configlist.items.language.d32 = 0; + qstrTemp = tr(language_menu[configlist.items.language.d32]); + break; + + case config_datetime: + qstrTemp = qdt.toString("yyyy.MM.dd hh:mm"); + break; + + case config_temptype: + if(configlist.items.temptype.d32 >=2 ) configlist.items.temptype.d32 = 0; + qstrTemp = tr(temptype_menu[configlist.items.temptype.d32]); + break; + case config_best_dish_weight: + if(configlist.items.best_dish_weight.d32 >=4) configlist.items.best_dish_weight.d32 = 0; + qstrTemp = tr(best_dish_weight_menu[configlist.items.best_dish_weight.d32]); + break; + case config_party_dish_weight: + if(configlist.items.party_dish_weight.d32 >=4) configlist.items.party_dish_weight.d32 = 0; + qstrTemp = tr(best_dish_weight_menu[configlist.items.party_dish_weight.d32]); + break; + case config_time_type: + if(configlist.items.time_type.d32 >=2) configlist.items.time_type.d32 = 0; + qstrTemp = tr(time_type_menu[configlist.items.time_type.d32]); + break; + case config_resttime_format: + if(configlist.items.resttime_format.d32 >=2) configlist.items.resttime_format.d32 = 0; + qstrTemp = tr(rest_time_type_menu[configlist.items.resttime_format.d32]); + break; + default: break; } return qstrTemp; diff --git a/app/gui/oven_control/config.h b/app/gui/oven_control/config.h index e34ae64..080843e 100644 --- a/app/gui/oven_control/config.h +++ b/app/gui/oven_control/config.h @@ -8,7 +8,7 @@ #define STRUCT_PACK __attribute__ ((packed)) -#define MAX_CONFIG_COUNT 14 +#define MAX_CONFIG_COUNT 21 namespace Define { @@ -27,6 +27,14 @@ namespace Define config_time_type, config_resttime_format, config_marster_vol, + config_keypad_sound1, + config_keypad_sound2, + config_request_loadexec, + config_programstep_finish, + config_cooktime_finish, + config_stoperror_distinguish, + config_sound_factory_reset, + config_invalid = 65535 }; typedef union _config_item{ @@ -58,6 +66,13 @@ namespace Define config_item time_type; config_item resttime_format; config_item marster_vol; + config_item keypad_sound1; + config_item keypad_sound2; + config_item request_loadexec; + config_item programstep_finish; + config_item cooktime_finish; + config_item stoperror_distinguish; + config_item sound_factory_reset; }items; }STRUCT_PACK config_lists; } @@ -79,15 +94,39 @@ class Config : public QObject "English" }; + const char temptype_menu[2][16]{ + "섭씨(℃)\0", + "화씨(℉)\0" + }; + + const char best_dish_weight_menu[4][16]={ + "700g\0", + "700-899g\0", + "900-1099g\0", + "1100g" + }; + + const char time_type_menu[2][16]={ + "24h\0", + "am/pm\0" + }; + + const char rest_time_type_menu[2][16] = { + "잔여시간\0", + "타겟시간\0" + }; - /* config_data_type Description - * 80 = Custom + + + /* config_data_type & Formatter Description + * 80 = use Cutom Formatter * 0 = int * 1 = float + * 2 = only String, */ const uint8_t config_data_type[MAX_CONFIG_COUNT] = { - 0x80, 0x80, 0x80, 0, 0, 0, 0, 0, 0, 0, - 0x80,0x80,0x80,0 + 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x80, 0x80, 0x80, //Settings + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }; const char config_format_kr[MAX_CONFIG_COUNT][64]={ @@ -101,10 +140,17 @@ class Config : public QObject "%d", "%d", "%d min", //9 + "%S", //10 "%S", - "%S", - "%S", - "%d" + "%S", //end of Settings + "%d" ,//start of Sound + "%d번", + "%d번", + "%d번", + "%d번", + "%d번", + "%d번", + "공장초기화" }; char config_format[MAX_CONFIG_COUNT][64]; @@ -119,11 +165,18 @@ class Config : public QObject "연회용 접시무게", "ILC 조리선반 개수", "ILC 조리선반 순서", - "ILC 조리 온습도 대기시간", //9 - "조리시간 포맷", + "ILC 조리 온습도 대기시간", + "조리시간 포맷", //10 "실시간 포맷", - "잔여시간 포맷", - "마스터 볼륨" + "잔여시간 포맷", //12 + "마스터 볼륨", //13 + "키패드 소리 - 1", + "키패드 소리 - 2 ", //15 + "프로그램 단계 종료", + "적재/실행 요청", + "조리시간 종료", + "과정 중단/오류 식별", //19 + "음향설정 초기화" //20 }; QSet m_setFavorite; @@ -152,8 +205,6 @@ public: Define::config_lists configlist; - - signals: public slots: diff --git a/app/gui/oven_control/configwindow.cpp b/app/gui/oven_control/configwindow.cpp index f33d22c..91a3994 100644 --- a/app/gui/oven_control/configwindow.cpp +++ b/app/gui/oven_control/configwindow.cpp @@ -3,30 +3,45 @@ #include "functiontestwindow.h" #include "engineermenuwindow.h" +#include "config.h" + + -#include "configpanelbutton.h" ConfigWindow::ConfigWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::ConfigWindow) { + uint32_t idx; ui->setupUi(this); ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); ui->scrollAreaMenuLayout->setAlignment(Qt::AlignTop); + ConfigPanelButton *configbtn; - for(int i = 0;i <20;i++){ - configbtn = new ConfigPanelButton(this,i); - configbtn->showFavoriteButton(); - configbtn->setText("TEST"); - configbtn->setValue("test"); - ui->scrollAreaMenuLayout->addWidget(configbtn); - connect(configbtn,SIGNAL(clicked(uint16_t)),SLOT(onConfigBtnClicked(uint16_t))); +// for(int i = 0;i <20;i++){ +// configbtn = new ConfigPanelButton(this,i); +// configbtn->showFavoriteButton(); +// configbtn->setText("TEST"); +// configbtn->setValue("test"); +// ui->scrollAreaMenuLayout->addWidget(configbtn); +// connect(configbtn,SIGNAL(clicked(uint16_t)),SLOT(onConfigBtnClicked(uint16_t))); +// } + Config* cfg = Config::getInstance(); + + QSetIterator itr = cfg->getConstBeginFavorite(); + while(itr.hasNext()) itr.next(); + + while(itr.hasPrevious()){ + idx = itr.previous(); + //configbtn = new ConfigPanelButton(this,idx); } + m_nCurConfigPos = config_menu_favorite; + reloadUi(); } @@ -52,16 +67,60 @@ void ConfigWindow::on_pushButton_3_clicked() w->showFullScreen(); } -void ConfigWindow::on_pushButton_8_clicked() +void ConfigWindow::on_pushButton_8_clicked() //설정 버튼 { - + if(m_nCurConfigPos != config_menu_setting){ + m_nCurConfigPos = config_menu_setting; + reloadUi(); + } } void ConfigWindow::onConfigBtnClicked(uint16_t id){ - qDebug() << "pressed id " << id; + qDebug() << "config id prsess : " << id; } void ConfigWindow::onConfigCheckBtnClicked(uint16_t id, bool checked){ } + +void ConfigWindow::reloadUi(void){ + QWidget** pws = m_vectorMenuList.data(); + QWidget* pw; + ConfigPanelButton *pcb; + Config* cfg = Config::getInstance(); + QString strtemp=""; + for(int i = 0; i < m_vectorMenuList.count();i++){ + pw = pws[i]; + ui->scrollAreaMenuLayout->removeWidget(pw); + delete pw; + } + m_vectorMenuList.clear(); + + if(m_nCurConfigPos != config_menu_favorite){ + for(int i=0 ; i < m_arrMaxMenuCount[m_nCurConfigPos] ;i++){ + pcb = new ConfigPanelButton(this,m_arrConfigListInfos[m_nCurConfigPos][i]); + qDebug() <getTitleString(m_arrConfigListInfos[m_nCurConfigPos][i]); + strtemp = cfg->getTitleString(m_arrConfigListInfos[m_nCurConfigPos][i]); + pcb->setText(strtemp); + strtemp = cfg->getValueString(m_arrConfigListInfos[m_nCurConfigPos][i]); + pcb->setValue(strtemp); + pcb->showFavoriteButton(); + pcb->setFavoriteCheck(cfg->isFavorite(m_arrConfigListInfos[m_nCurConfigPos][i])); + ui->scrollAreaMenuLayout->addWidget(pcb); + m_vectorMenuList.append(pcb); + connect(pcb ,SIGNAL(clicked(uint16_t)),SLOT(onConfigBtnClicked(uint16_t))); + } + } + + ui->scrollAreaMenu->adjustSize(); //Display 전 Contents 사이즈 수정 깜빡임 제거함. + +} + +void ConfigWindow::on_pushButton_7_clicked() //음향 관리 +{ + if(m_nCurConfigPos != config_menu_sound){ + m_nCurConfigPos = config_menu_sound; + reloadUi(); + } +} diff --git a/app/gui/oven_control/configwindow.h b/app/gui/oven_control/configwindow.h index 68d2a01..3146451 100644 --- a/app/gui/oven_control/configwindow.h +++ b/app/gui/oven_control/configwindow.h @@ -2,8 +2,24 @@ #define CONFIGWINDOW_H #include +#include #include "udphandler.h" +#include "configpanelbutton.h" +#include "config.h" + +using namespace Define; + +enum CONFIG_MENU_POS{ + config_menu_favorite = -1, + config_menu_setting =0, + config_menu_sound, + config_menu_system, + config_menu_energy, + config_menu_expert, + config_menu_display, + config_menu_service +}; namespace Ui { class ConfigWindow; @@ -15,8 +31,19 @@ class ConfigWindow : public QMainWindow private: const uint16_t m_arrMaxMenuCount[7] ={ - 9,7, + 9,8,0, }; + const Define::ConfigType m_arrConfigListInfos[7][20] = { + {config_language, config_datetime, config_temptype,config_backlight, config_stop_delay , config_best_dish_weight,config_party_dish_weight, config_time_type,config_resttime_format,}, + {config_marster_vol,config_keypad_sound1,config_keypad_sound2,config_request_loadexec,config_programstep_finish,config_cooktime_finish,config_stoperror_distinguish,config_sound_factory_reset}, + {config_invalid,}, + {config_invalid,}, + {config_invalid,}, + {config_invalid,}, + {config_invalid,} + }; + void reloadUi(void); + public: explicit ConfigWindow(QWidget *parent = 0); ~ConfigWindow(); @@ -31,12 +58,16 @@ private slots: void on_pushButton_8_clicked(); + void on_pushButton_7_clicked(); + public slots: void onConfigBtnClicked(uint16_t id); void onConfigCheckBtnClicked(uint16_t id, bool checked); private: Ui::ConfigWindow *ui; + QVector m_vectorMenuList; + CONFIG_MENU_POS m_nCurConfigPos; }; #endif // CONFIGWINDOW_H diff --git a/app/gui/oven_control/configwindow.ui b/app/gui/oven_control/configwindow.ui index e3c873c..0da82d9 100644 --- a/app/gui/oven_control/configwindow.ui +++ b/app/gui/oven_control/configwindow.ui @@ -30,6 +30,30 @@ font-size: 30px; + + 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; +} + @@ -84,11 +108,20 @@ font-size: 30px; QPushButton { background-image: url(:/images/config/050_setting_btn_01.png); } -QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_01_ov.png); } +QPushButton:pressed, QPushButton:focus, QPushButton:checked { background-image: url(:/images/config/050_setting_btn_01_ov.png); } 즐겨찾기 + + true + + + true + + + true + type @@ -117,11 +150,17 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/0 QPushButton { background-image: url(:/images/config/050_setting_btn_02.png); } -QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_02_ov.png); } +QPushButton:pressed, QPushButton:focus,QPushButton:checked { background-image: url(:/images/config/050_setting_btn_02_ov.png); } 설정 + + true + + + true + type @@ -150,11 +189,17 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/0 QPushButton { background-image: url(:/images/config/050_setting_btn_03.png); } -QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_03_ov.png); } +QPushButton:pressed, QPushButton:focus, QPushButton:checked { background-image: url(:/images/config/050_setting_btn_03_ov.png); } 음향 관리 + + true + + + true + type @@ -183,11 +228,17 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/0 QPushButton { background-image: url(:/images/config/050_setting_btn_04.png); } -QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_04_ov.png); } +QPushButton:pressed, QPushButton:focus,QPushButton:checked { background-image: url(:/images/config/050_setting_btn_04_ov.png); } 시스템 관리 + + true + + + true + type @@ -207,11 +258,17 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/0 QPushButton { background-image: url(:/images/config/050_setting_btn_05.png); } -QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_05_ov.png); } +QPushButton:pressed, QPushButton:focus ,QPushButton:checked{ background-image: url(:/images/config/050_setting_btn_05_ov.png); } 에너지 관리 + + true + + + true + type @@ -240,11 +297,17 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/0 QPushButton { background-image: url(:/images/config/050_setting_btn_06.png); } -QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_06_ov.png); } +QPushButton:pressed, QPushButton:focus,QPushButton:checked { background-image: url(:/images/config/050_setting_btn_06_ov.png); } 전문가 설정 + + true + + + true + type @@ -273,11 +336,17 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/0 QPushButton { background-image: url(:/images/config/050_setting_btn_07.png); } -QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_07_ov.png); } +QPushButton:pressed, QPushButton:focus,QPushButton:checked { background-image: url(:/images/config/050_setting_btn_07_ov.png); } 화면 관리 + + true + + + true + type @@ -306,11 +375,17 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/0 QPushButton { background-image: url(:/images/config/050_setting_btn_08.png); } -QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_08_ov.png); } +QPushButton:pressed, QPushButton:focus ,QPushButton:checked{ background-image: url(:/images/config/050_setting_btn_08_ov.png); } 서비스 + + true + + + true + type @@ -410,7 +485,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); } - + background-color : transparent; QFrame::NoFrame @@ -446,9 +521,18 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); } QLayout::SetDefaultConstraint + + 20 + + + 30 + 0 + + 26 +