Blame view

app/gui/oven_control/configtimeformatdlg.cpp 1.65 KB
92fef6124   고영탁   환경 설정 - 설정 UI 완료
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  #include "config.h"
  #include "configtimeformatdlg.h"
  #include "ui_configtimeformatdlg.h"
  
  using namespace Define;
  
  ConfigTimeFormatDlg::ConfigTimeFormatDlg(QWidget *parent) :
      QDialog(parent),
      ui(new Ui::ConfigTimeFormatDlg)
  {
      Config* cfg = Config::getInstance();
      config_item item;
      item = cfg->getConfigValue(config_time_type);
      m_nCurSel = item.d32;
      ui->setupUi(this);
      this->setWindowFlags( Qt::FramelessWindowHint);
      this->setAttribute( Qt::WA_DeleteOnClose);
  
  
      ui->pushButton_1->setText(tr(time_type_menu[0]));
      ui->pushButton_2->setText(tr(time_type_menu[1]));
  
      reloadUi();
  
      m_pSignalMapper = new QSignalMapper(this);
      m_pSignalMapper->setMapping(ui->pushButton_1,0);
      m_pSignalMapper->setMapping(ui->pushButton_2,1);
  
      connect(ui->pushButton_1,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
      connect(ui->pushButton_2,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
  
      connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int)));
  }
  
  ConfigTimeFormatDlg::~ConfigTimeFormatDlg()
  {
      delete ui;
  }
  
  void ConfigTimeFormatDlg::on_ctrBtnOk_clicked()
  {
      Config* cfg = Config::getInstance();
      config_item item;
      item.d32 = m_nCurSel;
      cfg->setConfigValue(config_time_type,item);
      accept();
  }
  
  void ConfigTimeFormatDlg::on_ctrBtnCancel_clicked()
  {
      reject();
  }
  
  void ConfigTimeFormatDlg::onConfigBtnClicked(const int sel){
        m_nCurSel = sel;
  }
  
  
  
  void ConfigTimeFormatDlg::reloadUi(){
      switch(m_nCurSel){
      case 0:
          ui->pushButton_1->setChecked(true);
          break;
     case 1:
          ui->pushButton_2->setChecked(true);
          break;
      default:
          break;
      }
  }