Browse Source

thermostat: edit_dlg: save default room temperature

master
Richard Genoud 4 years ago
parent
commit
a205c9cfb0
2 changed files with 10 additions and 3 deletions
  1. +2
    -1
      soft/thermostat/inc/edit_dlg.h
  2. +8
    -2
      soft/thermostat/src/edit_dlg.cpp

+ 2
- 1
soft/thermostat/inc/edit_dlg.h View File

@ -23,12 +23,13 @@ public:
EditDlg(int idx, QWidget *parent = Q_NULLPTR,
Qt::WindowFlags f = Qt::WindowFlags());
~EditDlg();
int m_idx; // room index
private:
void set_font(QWidget *widget);
QDoubleSpinBox m_default_temperature;
QVector<struct Program> m_progs;
int m_idx; // room index
private slots:
void save(void);


+ 8
- 2
soft/thermostat/src/edit_dlg.cpp View File

@ -38,6 +38,7 @@ EditDlg::EditDlg(int idx, QWidget *parent, Qt::WindowFlags f) : QWidget(parent,
set_font(room_name);
m_idx = idx;
m_progs = r.progs;
m_default_temperature.setDecimals(1);
m_default_temperature.setValue(r.default_temperature);
m_default_temperature.setSingleStep(0.1);
@ -89,9 +90,9 @@ EditDlg::EditDlg(int idx, QWidget *parent, Qt::WindowFlags f) : QWidget(parent,
topLayout->addLayout(upperLayout);
QGridLayout *progLayout = new QGridLayout;
for (int i = 0; i < r.progs.count(); i++) {
for (int i = 0; i < m_progs.count(); i++) {
p = &(r.progs.at(i));
p = &(m_progs.at(i));
text = QString("");
if (p->temperature == FORCE_OFF) {
@ -186,6 +187,11 @@ void EditDlg::set_font(QWidget *widget)
void EditDlg::save(void)
{
Settings *s = Settings::getInstance();
s->setRoomDefaultTemperature(m_idx, m_default_temperature.value());
s->setRoomPrograms(m_idx, m_progs);
emit close_edit_dlg();
}


Loading…
Cancel
Save