Blame view

app/gui/oven_control/cookpanelbutton.cpp 1.39 KB
b85726132   김태훈   부가 기능 UI 추가
1
2
  #include "cookpanelbutton.h"
  #include "ui_cookpanelbutton.h"
f588aa273   김태훈   부가 기능 로직 추가
3
4
5
  #include "manualcooksettingwidget.h"
  
  CookPanelButton::CookPanelButton(CookRecord record, QWidget *parent) :
b85726132   김태훈   부가 기능 UI 추가
6
      QWidget(parent),
f588aa273   김태훈   부가 기능 로직 추가
7
8
9
      record(record),
      ui(new Ui::CookPanelButton),
      rendered(false)
b85726132   김태훈   부가 기능 UI 추가
10
11
  {
      ui->setupUi(this);
f588aa273   김태훈   부가 기능 로직 추가
12
13
  
      setText(record.name);
b85726132   김태훈   부가 기능 UI 추가
14
15
16
17
18
19
20
21
22
23
24
  }
  
  CookPanelButton::~CookPanelButton()
  {
      delete ui;
  }
  
  void CookPanelButton::setText(QString text)
  {
      ui->pushButton->setText(text);
  }
f588aa273   김태훈   부가 기능 로직 추가
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
72
73
74
75
76
  
  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);
  }