Commit 774c1995b273ddcbc31604ac8d38801490ff1cf0

Authored by 고영탁
1 parent ecfb5801a8
Exists in master and in 2 other branches fhd, fhd-demo

에러 팝업 투명 효과 재처리

- Parent Window 인자 처리 완료
app/gui/oven_control/config.cpp
  1 +#include <QDebug>
1 2 #include "config.h"
2 3  
  4 +using namespace Define;
  5 +
  6 +Config* Config::instance = NULL;
  7 +
3 8 Config::Config(QObject *parent) : QObject(parent)
4 9 {
  10 + memcpy(config_format,config_format_kr,MAX_CONFIG_COUNT*64);
  11 +// m_setFavorite.insert(2);
  12 +// m_setFavorite.insert(3);
  13 +// m_setFavorite.insert(1);
  14 +// QSetIterator<uint32_t> i = getConstBeginFavorite();
  15 +// while(i.hasNext()){
  16 +// temp = i.next();
  17 +// qDebug() << temp;
  18 +// }
  19 +// while(i.hasPrevious()){
  20 +// temp = i.previous();
  21 +// qDebug() << temp;
  22 +// }
  23 +}
  24 +
  25 +Config::~Config(){
  26 +
  27 +}
5 28  
  29 +Config* Config::getInstance(QObject *parent){
  30 + if(instance ==NULL){
  31 + instance = new Config(parent);
  32 + }
  33 + return instance;
6 34 }
  35 +
  36 +bool Config::saveConfig(){
  37 + return false;
  38 +}
  39 +
  40 +bool Config::loadConfig(){
  41 + return false;
  42 +}
  43 +
  44 +
  45 +Define::config_item Config::getConfigValue(Define::ConfigType idx){
  46 + return configlist.values[idx];
  47 +}
  48 +
  49 +
  50 +
  51 +void Config::setConfigValue(Define::ConfigType idx, Define::config_item& itemdata){
  52 + configlist.values[idx] = itemdata;
  53 +}
  54 +
  55 +
  56 +QString Config::getValueString(Define::ConfigType idx){
  57 + QString qstrTemp="";
  58 + if( (config_data_type[(uint32_t)idx] & 0x80) ==0){
  59 + switch(config_data_type[(uint32_t)idx]){
  60 + case 0:
  61 + qstrTemp.sprintf(config_format[(uint32_t)idx], configlist.values[(uint32_t)idx].d32);
  62 + break;
  63 + case 1:
  64 + qstrTemp.sprintf(config_format[(uint32_t)idx], configlist.values[(uint32_t)idx].f32);
  65 + break;
  66 + }
  67 + }
  68 + switch(idx){
  69 + case config_language:
  70 + qstrTemp = tr(language_menu[configlist.items.language.d32]);
  71 + break;
  72 + }
  73 + return qstrTemp;
  74 +}
  75 +
  76 +QString Config::getTitleString(Define::ConfigType idx){
  77 + QString strTemp ="";
  78 + strTemp = tr(config_title[idx]);
  79 + return strTemp;
  80 +}
  81 +
  82 +bool Config::isFavorite(Define::ConfigType idx){
  83 + return m_setFavorite.contains((uint32_t)idx);
  84 + return true;
  85 +}
  86 +
  87 +QSetIterator<uint32_t> Config::getConstBeginFavorite(){
  88 + QSetIterator<uint32_t> i(m_setFavorite);
  89 + return i;
  90 +}
  91 +
  92 +bool Config::loadFavorite(void){
  93 + return false;
  94 +}
  95 +
  96 +bool Config::saveFavorite(void){
  97 + return false;
  98 +}
  99 +
  100 +void Config::insertFavorite(Define::ConfigType idx){
  101 + m_setFavorite.insert((uint32_t)idx);
  102 +}
  103 +void Config::removeFavorite(Define::ConfigType idx){
  104 + m_setFavorite.remove((uint32_t)idx);
  105 +}
  106 +
  107 +QString Config::getDateTimeString(uint32_t sec){
  108 + Config* ins = getInstance();
  109 + QString strTemp="";
  110 + if(ins->configlist.items.temptype.d32==0){
  111 +
  112 + }
  113 + return strTemp;
  114 +}
  115 +
  116 +QString Config::getTempString(int cel_temp){
  117 + Config* ins = getInstance();
  118 + QString strTemp="";
  119 + if(ins->configlist.items.temptype.d32==0){
  120 +
  121 + }
  122 + return strTemp;
  123 +}
  124 +
  125 +void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){
  126 +
  127 +}
  128 +
  129 +
  130 +
... ...
app/gui/oven_control/config.h
... ... @@ -3,29 +3,162 @@
3 3  
4 4  
5 5 #include <QObject>
  6 +#include <QSet>
  7 +
  8 +#define STRUCT_PACK __attribute__ ((packed))
  9 +
  10 +
  11 +#define MAX_CONFIG_COUNT 14
6 12  
7 13 namespace Define
8 14 {
9 15 enum ConfigType {
10   -
  16 + config_language = 0,
  17 + config_datetime,
  18 + config_temptype,
  19 + config_backlight,
  20 + config_stop_delay,
  21 + config_best_dish_weight,
  22 + config_party_dish_weight,
  23 + config_ilc_rack_number,
  24 + config_ilc_rack_sequnece,
  25 + config_ilc_cook_wait_time,
  26 + config_cooktime_format,
  27 + config_time_type,
  28 + config_resttime_format,
  29 + config_marster_vol,
11 30 };
  31 +
  32 + typedef union _config_item{
  33 + uint32_t d32;
  34 + float f32;
  35 + struct{
  36 + uint8_t d8_0;
  37 + uint8_t d8_1;
  38 + uint8_t d8_2;
  39 + uint8_t d8_3;
  40 + }d8;
  41 + }config_item;
  42 +
  43 + typedef union _config_lists{
  44 + uint8_t data[MAX_CONFIG_COUNT*4];
  45 + config_item values[MAX_CONFIG_COUNT];
  46 + struct{
  47 + config_item language;
  48 + config_item datetime;
  49 + config_item temptype;
  50 + config_item backlight;
  51 + config_item stop_delay;
  52 + config_item best_dish_weight;
  53 + config_item party_dish_weight;
  54 + config_item ilc_rack_number;
  55 + config_item ilc_rack_sequnece;
  56 + config_item ilc_cook_wait_time;
  57 + config_item cooktime_format;
  58 + config_item time_type;
  59 + config_item resttime_format;
  60 + config_item marster_vol;
  61 + }items;
  62 + }STRUCT_PACK config_lists;
12 63 }
13 64  
  65 +
  66 +
14 67 class Config : public QObject
15 68 {
16 69 Q_OBJECT
17 70  
18 71 explicit Config(QObject *parent = 0);
  72 + ~Config(void);
19 73  
20 74 static Config *instance;
21 75  
  76 + const char language_menu[3][20]{
  77 + "한국어\0",
  78 + "中國語\0",
  79 + "English"
  80 + };
  81 +
  82 +
  83 + /* config_data_type Description
  84 + * 80 = Custom
  85 + * 0 = int
  86 + * 1 = float
  87 + */
  88 + const uint8_t config_data_type[MAX_CONFIG_COUNT] = {
  89 + 0x80, 0x80, 0x80, 0, 0, 0, 0, 0, 0, 0,
  90 + 0x80,0x80,0x80,0
  91 + };
  92 +
  93 + const char config_format_kr[MAX_CONFIG_COUNT][64]={
  94 + "%S",
  95 + "%S",
  96 + "%S",
  97 + "%d",
  98 + "%d 분",
  99 + "%d g", //5
  100 + "%d g",
  101 + "%d",
  102 + "%d",
  103 + "%d min", //9
  104 + "%S",
  105 + "%S",
  106 + "%S",
  107 + "%d"
  108 + };
  109 +
  110 + char config_format[MAX_CONFIG_COUNT][64];
  111 +
  112 + const char config_title[MAX_CONFIG_COUNT][64]={
  113 + "언어설정", //0
  114 + "날짜와 시간",
  115 + "온도단위",
  116 + "화면밝기",
  117 + "응축식 후드의 정지지연",
  118 + "일품요리용 접시무게", //5
  119 + "연회용 접시무게",
  120 + "ILC 조리선반 개수",
  121 + "ILC 조리선반 순서",
  122 + "ILC 조리 온습도 대기시간", //9
  123 + "조리시간 포맷",
  124 + "실시간 포맷",
  125 + "잔여시간 포맷",
  126 + "마스터 볼륨"
  127 + };
  128 +
  129 + QSet<uint32_t> m_setFavorite;
  130 +
  131 +
22 132 public:
23   - static Config *getInstance();
24   - static void init();
  133 + static Config *getInstance(QObject *parent=0);
  134 + //static void init();
  135 + bool loadConfig(void);
  136 + bool saveConfig(void);
  137 + Define::config_item getConfigValue(Define::ConfigType idx);
  138 + void setConfigValue(Define::ConfigType idx, Define::config_item& itemdata);
  139 + QString getValueString(Define::ConfigType idx);
  140 + QString getTitleString(Define::ConfigType idx);
  141 + bool isFavorite(Define::ConfigType idx);
  142 + QSetIterator<uint32_t> getConstBeginFavorite();
  143 + bool loadFavorite(void);
  144 + bool saveFavorite(void);
  145 + void insertFavorite(Define::ConfigType idx);
  146 + void removeFavorite(Define::ConfigType idx);
  147 + static QString getDateTimeString(uint32_t sec);
  148 + static QString getTempString(int cel_temp);
  149 +
  150 + void execConfigWindow(QWidget *parent, Define::ConfigType idx);
  151 +
  152 +
  153 + Define::config_lists configlist;
  154 +
  155 +
25 156  
26 157 signals:
27 158  
28 159 public slots:
29 160 };
30 161  
  162 +
  163 +
31 164 #endif // CONFIG_H
... ...
app/gui/oven_control/errorpopupdlg.cpp
... ... @@ -13,6 +13,7 @@ ErrorPopupDlg::ErrorPopupDlg(QWidget *parent, const QString &amp;MsgDesc, const QStr
13 13 ui->centralwidget->setWindowFlags(Qt::FramelessWindowHint);
14 14 ui->ctrlWarnDescription->setText(MsgDesc);
15 15 ui->ctrlWarnTitle->setText(MsgTitle);
  16 + m_pParent = parent;
16 17 }
17 18  
18 19 ErrorPopupDlg::~ErrorPopupDlg()
... ... @@ -22,5 +23,6 @@ ErrorPopupDlg::~ErrorPopupDlg()
22 23  
23 24 void ErrorPopupDlg::on_ctrlOkBtn_clicked()
24 25 {
  26 + emit closedPopup(m_pParent);
25 27 close();
26 28 }
... ...
app/gui/oven_control/errorpopupdlg.h
... ... @@ -15,11 +15,15 @@ public:
15 15 explicit ErrorPopupDlg(QWidget *parent = 0, const QString &MsgDesc=0, const QString &MsgTitle=0);
16 16 ~ErrorPopupDlg();
17 17  
  18 +signals:
  19 + void closedPopup(QWidget* parent=0);
  20 +
18 21 private slots:
19 22 void on_ctrlOkBtn_clicked();
20 23  
21 24 private:
22 25 Ui::ErrorPopupDlg *ui;
  26 + QWidget* m_pParent;
23 27 };
24 28  
25 29 #endif // ERRORPOPUPDLG_H
... ...
app/gui/oven_control/errorpopupdlg.ui
... ... @@ -16,7 +16,9 @@
16 16 <property name="styleSheet">
17 17 <string notr="true">#centralwidget { background-image: url(:/images/background/popup/error.png);
18 18 background-color: rgba(0, 0, 0, 255);
19   -}</string>
  19 +}
  20 +
  21 +QDialog { background: transparent; }</string>
20 22 </property>
21 23 <widget class="QWidget" name="centralwidget" native="true">
22 24 <property name="geometry">
... ...
app/gui/oven_control/main.cpp
... ... @@ -3,6 +3,7 @@
3 3 #include "ovencontroller.h"
4 4 #include "udphandler.h"
5 5 #include "ovenstatics.h"
  6 +#include "config.h"
6 7 #include <QApplication>
7 8  
8 9 int main(int argc, char *argv[])
... ... @@ -18,6 +19,8 @@ int main(int argc, char *argv[])
18 19 interface->setUdpHandler(udp);
19 20  
20 21 OvenStatistics::getInstance(oven);
  22 + Config::getInstance(oven);
  23 +
21 24  
22 25 MainWindow w;
23 26 w.showFullScreen();
... ...
app/gui/oven_control/operationtimemode.cpp
... ... @@ -29,7 +29,7 @@ void OperationTimeMode::reloadUi(void){
29 29 uint32_t timetemp;
30 30 OvenStatistics* ovs = OvenStatistics::getInstance();
31 31 QString strTemp="";
32   - uint32_t totaltime;
  32 + uint32_t totaltime=0;
33 33 if(ovs!=NULL){
34 34 //건열 조리 모드
35 35 timetemp = ovs->srvdata->use_log.items.cook_dry_mode;
... ...
app/gui/oven_control/ovenstatics.cpp
... ... @@ -539,8 +539,9 @@ void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype,
539 539 {
540 540 if(m_bPopupShow==false){
541 541 m_bPopupShow = true;
542   - ErrorPopupDlg *dlg = new ErrorPopupDlg(0,MsgDesc,MsgTitle);
543   - connect(dlg,SIGNAL(destroyed(QObject*)),this, SLOT(onErrorPopupClosed()));
  542 + ErrorPopupDlg *dlg = new ErrorPopupDlg(QApplication::activeWindow(),MsgDesc,MsgTitle);
  543 + //connect(dlg,SIGNAL(destroyed(QObject*)),this, SLOT(onErrorPopupClosed()));
  544 + connect(dlg,SIGNAL(closedPopup(QWidget*)),this, SLOT(onErrorPopupClosed(QWidget*)));
544 545 dlg->showFullScreen();
545 546 m_nLastPopupidx = erridx;
546 547 }
... ... @@ -583,7 +584,7 @@ type_temp OvenStatistics::getCurSensorValueByIdx(uint16_t idx){
583 584 return curSensorValue[idx];
584 585 }
585 586  
586   -void OvenStatistics::onErrorPopupClosed(void){
  587 +void OvenStatistics::onErrorPopupClosed(QWidget* parent){
587 588 qDebug() << "Error Popup Closed!";
588 589 if(bNeedErrorClear) {
589 590 qDebug() << "send error clear command";
... ... @@ -595,9 +596,9 @@ void OvenStatistics::onErrorPopupClosed(void){
595 596 item = m_mapPopupList.first();
596 597 m_nLastPopupidx = m_mapPopupList.firstKey();
597 598 bNeedErrorClear = item.bNeedClear;
598   - ErrorPopupDlg *dlg = new ErrorPopupDlg(0,item.strDesc,item.strTitle);
  599 + ErrorPopupDlg *dlg = new ErrorPopupDlg(parent,item.strDesc,item.strTitle);
599 600 m_mapPopupList.remove(m_nLastPopupidx);
600   - connect(dlg,SIGNAL(destroyed(QObject*)),this, SLOT(onErrorPopupClosed()));
  601 + connect(dlg,SIGNAL(closedPopup(QWidget*)),this, SLOT(onErrorPopupClosed(QWidget*)));
601 602 dlg->showFullScreen();
602 603 }
603 604 else{
... ...
app/gui/oven_control/ovenstatics.h
... ... @@ -258,7 +258,7 @@ private:
258 258 public slots:
259 259 void onDataChanged();
260 260 void oneSecTimerFired(void);
261   - void onErrorPopupClosed(void);
  261 + void onErrorPopupClosed(QWidget* parent);
262 262 };
263 263  
264 264 #endif // OVENSTATICS_H
... ...