forked from Larswad/uno2iec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logfiltersetup.cpp
48 lines (37 loc) · 1.24 KB
/
logfiltersetup.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifdef _MSC_VER
#include <iso646.h>
#endif
#include "logfiltersetup.hpp"
#include "ui_logfiltersetup.h"
LogFilterSetup::LogFilterSetup(LogFilterMap& logFilters, QVector<bool>& logLevels, QWidget* parent) :
QDialog(parent),
m_logFilters(logFilters),
m_logLevels(logLevels),
ui(new Ui::LogFilterSetup)
{
ui->setupUi(this);
LogFilterMap::const_iterator it;
int ix = 0;
for(it = m_logFilters.begin(); it not_eq m_logFilters.end(); ++it, ++ix) {
ui->m_facilityFilterList->addItem(it.key());
ui->m_facilityFilterList->item(ix)->setCheckState(it.value() ? Qt::Checked : Qt::Unchecked);
}
for(ix = 0; ix < m_logLevels.size(); ++ix)
ui->m_severityFilterList->item(ix)->setCheckState(m_logLevels[ix] ? Qt::Checked : Qt::Unchecked);
} // ctor
LogFilterSetup::~LogFilterSetup()
{
delete ui;
} // dtor
void LogFilterSetup::on_m_close_clicked()
{
close();
} // close
void LogFilterSetup::on_m_facilityFilterList_itemChanged(QListWidgetItem *item)
{
m_logFilters[item->text()] = item->checkState() == Qt::Checked;
}
void LogFilterSetup::on_m_severityFilterList_itemChanged(QListWidgetItem *item)
{
m_logLevels[ui->m_severityFilterList->row(item)] = item->checkState() == Qt::Checked;
}