|
|
@ -26,6 +26,9 @@ |
|
|
|
#define SPIN_ARROW_H 50
|
|
|
|
#define SPIN_FONT_SZ 20
|
|
|
|
|
|
|
|
// otherwise, the Rpi screen is too small
|
|
|
|
#define MAX_PROGRAMS 4
|
|
|
|
|
|
|
|
EditDlg::EditDlg(int idx, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) |
|
|
|
{ |
|
|
|
Settings *s = Settings::getInstance(); |
|
|
@ -63,8 +66,8 @@ EditDlg::EditDlg(int idx, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, |
|
|
|
upperLayout->addWidget(room_name); |
|
|
|
upperLayout->addWidget(&m_default_temperature); |
|
|
|
|
|
|
|
m_add_btn = new QPushButton(tr("Add"), this); |
|
|
|
QPushButton *ok_btn = new QPushButton(tr("Ok"), this); |
|
|
|
QPushButton *add_btn = new QPushButton(tr("Add"), this); |
|
|
|
QPushButton *cancel_btn = new QPushButton(tr("Cancel"), this); |
|
|
|
|
|
|
|
|
|
|
@ -73,21 +76,23 @@ EditDlg::EditDlg(int idx, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, |
|
|
|
QSizePolicy::PushButton); |
|
|
|
|
|
|
|
set_font(ok_btn); |
|
|
|
set_font(add_btn); |
|
|
|
set_font(m_add_btn); |
|
|
|
set_font(cancel_btn); |
|
|
|
|
|
|
|
ok_btn->setSizePolicy(*szPolicy); |
|
|
|
add_btn->setSizePolicy(*szPolicy); |
|
|
|
m_add_btn->setSizePolicy(*szPolicy); |
|
|
|
cancel_btn->setSizePolicy(*szPolicy); |
|
|
|
|
|
|
|
m_add_btn->setEnabled(m_progs.count() < MAX_PROGRAMS); |
|
|
|
|
|
|
|
connect(ok_btn, SIGNAL(clicked(void)), this, SLOT(save(void))); |
|
|
|
connect(add_btn, SIGNAL(clicked(void)), this, SLOT(add(void))); |
|
|
|
connect(m_add_btn, SIGNAL(clicked(void)), this, SLOT(add(void))); |
|
|
|
connect(cancel_btn, SIGNAL(clicked(void)), this, SLOT(reject(void))); |
|
|
|
|
|
|
|
QHBoxLayout *btnLayout = new QHBoxLayout; |
|
|
|
|
|
|
|
btnLayout->addWidget(cancel_btn); |
|
|
|
btnLayout->addWidget(add_btn); |
|
|
|
btnLayout->addWidget(m_add_btn); |
|
|
|
btnLayout->addWidget(ok_btn); |
|
|
|
|
|
|
|
QVBoxLayout *topLayout = new QVBoxLayout; |
|
|
@ -284,6 +289,8 @@ void EditDlg::add(void) |
|
|
|
|
|
|
|
layout = add_prog_layout(idx); |
|
|
|
m_progsLayout->addLayout(layout); |
|
|
|
|
|
|
|
m_add_btn->setEnabled(m_progs.count() < MAX_PROGRAMS); |
|
|
|
} |
|
|
|
|
|
|
|
void EditDlg::delete_prog_clicked(void) |
|
|
@ -357,6 +364,8 @@ void EditDlg::delete_prog_clicked(void) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
m_add_btn->setEnabled(m_progs.count() < MAX_PROGRAMS); |
|
|
|
} |
|
|
|
|
|
|
|
void EditDlg::edit_prog_clicked(void) |
|
|
|