Log Viewer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

65 lines
2.0 KiB

#include "AdvancedFilterDialog.h"
#include "ui_AdvancedFilterDialog.h"
AdvancedFilterDialog::AdvancedFilterDialog(QWidget* parent) :
QDialog(parent),
ui(new Ui::AdvancedFilterDialog)
{
ui->setupUi(this);
makeConnections();
}
AdvancedFilterDialog::~AdvancedFilterDialog()
{
delete ui;
}
/*************************************************************************************************/
void AdvancedFilterDialog::setActiveScopes(QMap<QString, bool> options)
{
QMap<QString, bool>::const_iterator i;
for(i = options.constBegin(); i != options.constEnd(); i++)
{
auto item = new QListWidgetItem(i.key(), ui->listWidget);
item->setCheckState(i.value() ? Qt::Checked : Qt::Unchecked);
ui->listWidget->addItem(item);
}
}
/*************************************************************************************************/
QMap<QString, bool> AdvancedFilterDialog::getActiveScopes() const
{
QMap<QString, bool> options;
for(int i = 0; i < ui->listWidget->count(); ++i)
{
QListWidgetItem* item = ui->listWidget->item(i);
options[item->text()] = item->checkState() == Qt::Checked;
}
return options;
}
/*************************************************************************************************/
void AdvancedFilterDialog::checkAll()
{
for(int i = 0; i < ui->listWidget->count(); ++i)
{
ui->listWidget->item(i)->setCheckState(Qt::Checked);
}
}
/*************************************************************************************************/
void AdvancedFilterDialog::uncheckAll()
{
for(int i = 0; i < ui->listWidget->count(); ++i)
{
ui->listWidget->item(i)->setCheckState(Qt::Unchecked);
}
}
/*************************************************************************************************/
void AdvancedFilterDialog::makeConnections()
{
connect(ui->checkAllButton, &QPushButton::clicked, this, &AdvancedFilterDialog::checkAll);
connect(ui->uncheckAllButton, &QPushButton::clicked, this, &AdvancedFilterDialog::uncheckAll);
}