|
|
@ -89,7 +89,7 @@ EditDlg::EditDlg(int idx, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, |
|
|
|
|
|
|
|
topLayout->addLayout(upperLayout); |
|
|
|
|
|
|
|
QGridLayout *progLayout = new QGridLayout; |
|
|
|
m_progLayout = new QGridLayout; |
|
|
|
for (int i = 0; i < m_progs.count(); i++) { |
|
|
|
|
|
|
|
p = &(m_progs.at(i)); |
|
|
@ -108,7 +108,7 @@ EditDlg::EditDlg(int idx, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, |
|
|
|
|
|
|
|
QLabel *prog_temperature = new QLabel(QString(text)); |
|
|
|
set_font(prog_temperature); |
|
|
|
progLayout->addWidget(prog_temperature, i, 1, Qt::AlignHCenter); |
|
|
|
m_progLayout->addWidget(prog_temperature, i, 0, Qt::AlignHCenter); |
|
|
|
|
|
|
|
text = QString(""); |
|
|
|
if (p->DoW == 0) { |
|
|
@ -137,7 +137,7 @@ EditDlg::EditDlg(int idx, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, |
|
|
|
} |
|
|
|
QLabel *prog_DoW = new QLabel(QString(text)); |
|
|
|
set_font(prog_DoW); |
|
|
|
progLayout->addWidget(prog_DoW, i, 2, Qt::AlignHCenter); |
|
|
|
m_progLayout->addWidget(prog_DoW, i, 1, Qt::AlignHCenter); |
|
|
|
|
|
|
|
text = QString(""); |
|
|
|
text += p->start_time.toString(QString(" HH:mm")); |
|
|
@ -145,7 +145,7 @@ EditDlg::EditDlg(int idx, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, |
|
|
|
|
|
|
|
QLabel *prog_time= new QLabel(QString(text)); |
|
|
|
set_font(prog_time); |
|
|
|
progLayout->addWidget(prog_time, i, 3, Qt::AlignHCenter); |
|
|
|
m_progLayout->addWidget(prog_time, i, 2, Qt::AlignHCenter); |
|
|
|
|
|
|
|
QPushButton *edit_btn = new QPushButton(tr("Edit"), this); |
|
|
|
QPushButton *delete_btn = new QPushButton(tr("Delete"), this); |
|
|
@ -161,10 +161,10 @@ EditDlg::EditDlg(int idx, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, |
|
|
|
|
|
|
|
connect(delete_btn, SIGNAL(clicked(void)), this, SLOT(delete_prog_clicked(void))); |
|
|
|
|
|
|
|
progLayout->addWidget(edit_btn, i, 4, Qt::AlignHCenter); |
|
|
|
progLayout->addWidget(delete_btn, i, 5, Qt::AlignHCenter); |
|
|
|
m_progLayout->addWidget(edit_btn, i, 3, Qt::AlignHCenter); |
|
|
|
m_progLayout->addWidget(delete_btn, i, 4, Qt::AlignHCenter); |
|
|
|
|
|
|
|
topLayout->addLayout(progLayout); |
|
|
|
topLayout->addLayout(m_progLayout); |
|
|
|
} |
|
|
|
|
|
|
|
topLayout->addLayout(btnLayout); |
|
|
@ -202,6 +202,38 @@ void EditDlg::reject(void) |
|
|
|
|
|
|
|
void EditDlg::delete_prog_clicked(void) |
|
|
|
{ |
|
|
|
QLayoutItem *item; |
|
|
|
QObject* obj = sender(); |
|
|
|
QVariant v; |
|
|
|
QWidget *w; |
|
|
|
int idx; |
|
|
|
|
|
|
|
v = obj->property("idx"); |
|
|
|
if (!v.isValid()) |
|
|
|
return; |
|
|
|
|
|
|
|
idx = v.toInt(); |
|
|
|
if (idx >= m_progLayout->rowCount()) { |
|
|
|
// TODO ERROR: index mismatch
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
m_progs.remove(idx); |
|
|
|
|
|
|
|
for (int i = 0; i < m_progLayout->columnCount(); i++) { |
|
|
|
item = m_progLayout->itemAtPosition(idx, i); |
|
|
|
if (item && item->widget()) { |
|
|
|
w = item->widget(); |
|
|
|
m_progLayout->removeWidget(w); |
|
|
|
w->hide(); |
|
|
|
delete w; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (int j = idx; j < (m_progLayout->rowCount() - 1); j++) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
EditDlg::~EditDlg() |
|
|
|