Blame view

app/gui/oven_control/cookpanelbutton.cpp 1.55 KB
b85726132   김태훈   부가 기능 UI 추가
1
2
  #include "cookpanelbutton.h"
  #include "ui_cookpanelbutton.h"
bbd7d8f29   김태훈   버튼 음향 추가
3
  #include "soundplayer.h"
f588aa273   김태훈   부가 기능 로직 추가
4
5
6
  #include "manualcooksettingwidget.h"
  
  CookPanelButton::CookPanelButton(CookRecord record, QWidget *parent) :
b85726132   김태훈   부가 기능 UI 추가
7
      QWidget(parent),
f588aa273   김태훈   부가 기능 로직 추가
8
9
10
      record(record),
      ui(new Ui::CookPanelButton),
      rendered(false)
b85726132   김태훈   부가 기능 UI 추가
11
12
  {
      ui->setupUi(this);
f588aa273   김태훈   부가 기능 로직 추가
13
14
  
      setText(record.name);
bbd7d8f29   김태훈   버튼 음향 추가
15
16
17
  
      foreach (QPushButton *button, findChildren<QPushButton *>())
          connect(button, &QPushButton::pressed, SoundPlayer::playClick);
b85726132   김태훈   부가 기능 UI 추가
18
19
20
21
22
23
24
25
26
27
28
  }
  
  CookPanelButton::~CookPanelButton()
  {
      delete ui;
  }
  
  void CookPanelButton::setText(QString text)
  {
      ui->pushButton->setText(text);
  }
f588aa273   김태훈   부가 기능 로직 추가
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
72
73
74
75
76
77
78
79
80
  
  void CookPanelButton::showInfo()
  {
      if (!rendered)
      {
          QPixmap p = CookHistory::render(record);
  
          label = new QLabel(this);
          label->setPixmap(p);
          label->setGeometry((width() - p.width()) / 2, 65, p.width(), p.height());
      }
  
      label->show();
      setMinimumHeight(ui->pushButton->height() + label->height());
  }
  
  void CookPanelButton::hideInfo()
  {
      label->hide();
      setMinimumHeight(ui->pushButton->height());
  }
  
  void CookPanelButton::focusBar()
  {
      ui->pushButton->setFocus();
  }
  
  void CookPanelButton::focusInfoButton()
  {
      ui->showInfoButton->setFocus();
  }
  
  void CookPanelButton::focusDeleteButton()
  {
      ui->deleteButton->setFocus();
  }
  
  
  void CookPanelButton::on_showInfoButton_toggled(bool checked)
  {
      emit infoClicked(this);
  }
  
  void CookPanelButton::on_pushButton_clicked()
  {
      CookHistory::start(record, parentWidget());
  }
  
  void CookPanelButton::on_deleteButton_clicked()
  {
      emit deleteClicked(this);
  }