2017-05-01 11:28:54 +02:00
|
|
|
#include "blurdialog.hpp"
|
|
|
|
#include "ui_blurdialog.h"
|
|
|
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
#include <QDoubleSpinBox>
|
|
|
|
#include <QSlider>
|
|
|
|
|
2017-05-09 17:26:00 +02:00
|
|
|
BlurDialog::BlurDialog(QGraphicsBlurEffect *e, QWidget *parent) : QDialog(parent), ui(new Ui::BlurDialog) {
|
|
|
|
effect = e;
|
|
|
|
ui->setupUi(this);
|
|
|
|
ui->animated->setChecked(effect->blurHints().testFlag(QGraphicsBlurEffect::AnimationHint));
|
|
|
|
ui->performance->setChecked(effect->blurHints().testFlag(QGraphicsBlurEffect::PerformanceHint));
|
|
|
|
ui->quality->setChecked(effect->blurHints().testFlag(QGraphicsBlurEffect::QualityHint));
|
|
|
|
ui->radSlider->setValue(effect->blurRadius() * 100);
|
|
|
|
ui->radSpinner->setValue(effect->blurRadius());
|
2017-05-11 14:49:00 +02:00
|
|
|
this->setFocus();
|
2017-05-09 17:26:00 +02:00
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, [&] {
|
|
|
|
QFlags<QGraphicsBlurEffect::BlurHint> hints;
|
|
|
|
hints.setFlag(QGraphicsBlurEffect::AnimationHint, ui->animated->isChecked());
|
|
|
|
hints.setFlag(QGraphicsBlurEffect::PerformanceHint, ui->performance->isChecked());
|
|
|
|
hints.setFlag(QGraphicsBlurEffect::QualityHint, ui->quality->isChecked());
|
|
|
|
effect->setBlurHints(hints);
|
|
|
|
effect->setBlurRadius(ui->radSpinner->value());
|
2017-05-16 21:08:42 +02:00
|
|
|
accept();
|
2017-05-09 17:26:00 +02:00
|
|
|
close();
|
|
|
|
});
|
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, [&] {
|
2017-05-16 21:08:42 +02:00
|
|
|
reject();
|
2017-05-09 17:26:00 +02:00
|
|
|
close();
|
2017-05-16 21:08:42 +02:00
|
|
|
emit finished(result());
|
2017-05-09 17:26:00 +02:00
|
|
|
});
|
2017-05-01 11:28:54 +02:00
|
|
|
}
|
|
|
|
|
2017-05-09 17:26:00 +02:00
|
|
|
BlurDialog::~BlurDialog() {
|
|
|
|
delete ui;
|
|
|
|
}
|
2017-05-01 11:28:54 +02:00
|
|
|
|
2017-05-06 13:21:12 +02:00
|
|
|
void BlurDialog::on_radSpinner_valueChanged(double arg1) {
|
2017-05-09 17:26:00 +02:00
|
|
|
ui->radSlider->setValue(arg1 * 100);
|
2017-05-01 11:28:54 +02:00
|
|
|
}
|
|
|
|
|
2017-05-06 13:21:12 +02:00
|
|
|
void BlurDialog::on_radSlider_sliderMoved(int position) {
|
2017-05-09 17:26:00 +02:00
|
|
|
ui->radSpinner->setValue(position / 100.);
|
2017-05-01 11:28:54 +02:00
|
|
|
}
|