Blame view

app/gui/oven_control/configlanguagedlg.cpp 2.05 KB
92fef6124   고영탁   환경 설정 - 설정 UI 완료
1
2
3
  #include "config.h"
  #include "configlanguagedlg.h"
  #include "ui_configlanguagedlg.h"
66e60ceb5   김태훈   모든 버튼에 음향 효과 추가
4
  #include "soundplayer.h"
92fef6124   고영탁   환경 설정 - 설정 UI 완료
5
6
7
8
9
10
11
12
13
14
  
  using namespace Define;
  
  ConfigLanguageDlg::ConfigLanguageDlg(QWidget *parent) :
      QDialog(parent),
      ui(new Ui::ConfigLanguageDlg)
  {
      ui->setupUi(this);
      this->setWindowFlags( Qt::FramelessWindowHint);
      this->setAttribute( Qt::WA_DeleteOnClose);
66e60ceb5   김태훈   모든 버튼에 음향 효과 추가
15
16
      foreach (QPushButton *button, findChildren<QPushButton *>())
          connect(button, &QPushButton::pressed, SoundPlayer::playClick);
92fef6124   고영탁   환경 설정 - 설정 UI 완료
17
18
19
20
  
      ui->pushButton_1->setText(tr(language_menu[0]));
      ui->pushButton_2->setText(tr(language_menu[1]));
      ui->pushButton_3->setText(tr(language_menu[2]));
663943a37   고영탁   설정 기능 마무리 진행 중
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
      Config *cfg = Config::getInstance();
      config_item item;
      cfg->getConfigValue(config_language);
      m_nCurSelLang = item.d32;
  
      m_pSignalMapper = new QSignalMapper(this);
      m_pSignalMapper->setMapping(ui->pushButton_1,0);
      m_pSignalMapper->setMapping(ui->pushButton_2,1);
      m_pSignalMapper->setMapping(ui->pushButton_3,2);
  
      connect(ui->pushButton_1,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
      connect(ui->pushButton_2,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
      connect(ui->pushButton_3,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
  
      connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int)));
92fef6124   고영탁   환경 설정 - 설정 UI 완료
36
37
38
39
40
41
42
43
44
  }
  
  ConfigLanguageDlg::~ConfigLanguageDlg()
  {
      delete ui;
  }
  
  void ConfigLanguageDlg::on_ctrBtnOk_clicked()
  {
663943a37   고영탁   설정 기능 마무리 진행 중
45
46
47
48
      Config* cfg = Config::getInstance();
      config_item item;
      item.d32 = m_nCurSelLang;
      cfg->setConfigValue(config_language, item);
92fef6124   고영탁   환경 설정 - 설정 UI 완료
49
50
51
52
53
54
55
      this->accept();
  }
  
  void ConfigLanguageDlg::on_ctrBtnCancel_clicked()
  {
      this->reject();
  }
663943a37   고영탁   설정 기능 마무리 진행 중
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  
  void ConfigLanguageDlg::onConfigBtnClicked(const int sel){
            m_nCurSelLang = sel;
  }
  
  void ConfigLanguageDlg::reloadUi(){
      switch(m_nCurSelLang){
      case 0:
          ui->pushButton_1->setChecked(true);
          break;
     case 1:
          ui->pushButton_2->setChecked(true);
          break;
      case 2:
          ui->pushButton_3->setChecked(true);
          break;
      default:
          break;
      }
  }