Browse Source

Remove the blur dialog. Settings are in settings.

tags/v5.0.0
ArsenArsen 5 years ago
parent
commit
5fa398a124
  1. 3
      KShare.pro
  2. 10
      cropeditor/drawing/bluritem.cpp
  3. 45
      cropeditor/settings/blurdialog.cpp
  4. 27
      cropeditor/settings/blurdialog.hpp
  5. 101
      cropeditor/settings/blurdialog.ui
  6. 21
      cropeditor/settings/brushpenselection.cpp
  7. 6
      cropeditor/settings/brushpenselection.hpp
  8. 122
      cropeditor/settings/brushpenselection.ui

3
KShare.pro

@ -44,7 +44,6 @@ SOURCES += main.cpp\
cropeditor/drawing/dotitem.cpp \
cropeditor/settings/brushpenselection.cpp \
cropeditor/drawing/bluritem.cpp \
cropeditor/settings/blurdialog.cpp \
cropeditor/drawing/pathitem.cpp \
cropeditor/drawing/lineitem.cpp \
cropeditor/drawing/textitem.cpp \
@ -85,7 +84,6 @@ HEADERS += mainwindow.hpp \
cropeditor/drawing/dotitem.hpp \
cropeditor/settings/brushpenselection.hpp \
cropeditor/drawing/bluritem.hpp \
cropeditor/settings/blurdialog.hpp \
cropeditor/drawing/pathitem.hpp \
cropeditor/drawing/lineitem.hpp \
cropeditor/drawing/textitem.hpp \
@ -130,7 +128,6 @@ mac {
FORMS += mainwindow.ui \
cropeditor/settings/brushpenselection.ui \
cropeditor/settings/blurdialog.ui \
recording/encoders/encodersettingsdialog.ui \
settingsdialog.ui \
aboutbox.ui \

10
cropeditor/drawing/bluritem.cpp

@ -1,10 +1,16 @@
#include "bluritem.hpp"
#include <cropeditor/settings/blurdialog.hpp>
#include <settings.hpp>
bool BlurItem::init(CropScene *) {
effect = new QGraphicsBlurEffect;
return BlurDialog(effect).exec();
QFlags<QGraphicsBlurEffect::BlurHint> blurHints;
blurHints.setFlag(QGraphicsBlurEffect::AnimationHint, settings::settings().value("blur/animatedHint", false).toBool());
blurHints.setFlag(QGraphicsBlurEffect::PerformanceHint, settings::settings().value("blur/performanceHint", true).toBool());
blurHints.setFlag(QGraphicsBlurEffect::QualityHint, settings::settings().value("blur/qualityHint", false).toBool());
effect->setBlurHints(blurHints);
effect->setBlurRadius(settings::settings().value("blurRadius", 5.).toDouble());
return true;
}
void BlurItem::mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) {

45
cropeditor/settings/blurdialog.cpp

@ -1,45 +0,0 @@
#include "blurdialog.hpp"
#include "ui_blurdialog.h"
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QDoubleSpinBox>
#include <QSlider>
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());
this->setFocus();
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());
accept();
close();
});
connect(ui->buttonBox, &QDialogButtonBox::rejected, [&] {
reject();
close();
emit finished(result());
});
}
BlurDialog::~BlurDialog() {
delete ui;
}
void BlurDialog::on_radSpinner_valueChanged(double arg1) {
ui->radSlider->setValue(arg1 * 100);
}
void BlurDialog::on_radSlider_sliderMoved(int position) {
ui->radSpinner->setValue(position / 100.);
}

27
cropeditor/settings/blurdialog.hpp

@ -1,27 +0,0 @@
#ifndef BLURDIALOG_HPP
#define BLURDIALOG_HPP
#include <QDialog>
#include <QGraphicsBlurEffect>
namespace Ui {
class BlurDialog;
}
class BlurDialog : public QDialog {
Q_OBJECT
public:
explicit BlurDialog(QGraphicsBlurEffect *effect, QWidget *parent = 0);
~BlurDialog();
private slots:
void on_radSpinner_valueChanged(double arg1);
void on_radSlider_sliderMoved(int position);
private:
Ui::BlurDialog *ui;
QGraphicsBlurEffect *effect;
};
#endif // BLURDIALOG_HPP

101
cropeditor/settings/blurdialog.ui

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlurDialog</class>
<widget class="QDialog" name="BlurDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>222</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="windowTitle">
<string>Blur Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QSlider" name="radSlider">
<property name="maximum">
<number>3000</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="radSpinner">
<property name="suffix">
<string>px</string>
</property>
<property name="maximum">
<double>30.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QLabel" name="label_2">
<property name="whatsThis">
<string>http://doc.qt.io/qt-5/qgraphicsblureffect.html#BlurHint-enum</string>
</property>
<property name="text">
<string>&lt;a href=&quot;http://doc.qt.io/qt-5/qgraphicsblureffect.html#BlurHint-enum&quot;&gt;Blur Hints</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label">
<property name="text">
<string>Blur Radius</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="performance">
<property name="text">
<string>Performance Hint</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="animated">
<property name="text">
<string>Animated Hint</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="quality">
<property name="text">
<string>Quality Hint</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

21
cropeditor/settings/brushpenselection.cpp

@ -5,6 +5,7 @@
#include <QColorDialog>
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QGraphicsBlurEffect>
#include <QInputDialog>
#include <QSlider>
#include <cropeditor/cropview.hpp>
@ -12,6 +13,13 @@
BrushPenSelection::BrushPenSelection(CropScene *scene) : QDialog(), ui(new Ui::BrushPenSelection) {
ui->setupUi(this);
ui->animated->setChecked(settings::settings().value("blur/animatedHint", false).toBool());
ui->performance->setChecked(settings::settings().value("blur/performanceHint", true).toBool());
ui->quality->setChecked(settings::settings().value("blur/qualityHint", false).toBool());
ui->radSlider->setValue(settings::settings().value("blur/radius", 5.).toDouble() * 100);
ui->radSpinner->setValue(settings::settings().value("blur/radius", 5.).toDouble());
ui->cosmetic->setChecked(scene->pen().isCosmetic());
ui->widthSlider->setValue(scene->pen().width());
ui->widthSpinner->setValue(scene->pen().widthF());
@ -41,12 +49,17 @@ void BrushPenSelection::on_buttonBox_accepted() {
scene->pen().setWidthF(ui->widthSpinner->value());
scene->brush().setColor(brush);
scene->brush().setStyle((Qt::BrushStyle)ui->brushStyle->currentIndex());
settings::settings().setValue("penColor", scene->pen().color());
settings::settings().setValue("penCosmetic", scene->pen().isCosmetic());
settings::settings().setValue("penWidth", scene->pen().widthF());
settings::settings().setValue("brushColor", scene->brush().color());
settings::settings().setValue("brushStyle", (int)scene->brush().style());
settings::settings().setValue("brushPath", ui->pathItemHasBrush->isChecked());
settings::settings().setValue("blur/radius", ui->radSpinner->value());
settings::settings().setValue("blur/animatedHint", ui->animated->isChecked());
settings::settings().setValue("blur/qualityHint", ui->quality->isChecked());
settings::settings().setValue("blur/performanceHint", ui->performance->isChecked());
close();
}
@ -61,3 +74,11 @@ void BrushPenSelection::on_widthSlider_sliderMoved(int position) {
void BrushPenSelection::on_widthSpinner_valueChanged(double arg) {
ui->widthSlider->setValue(arg * 100);
}
void BrushPenSelection::on_radSpinner_valueChanged(double arg1) {
ui->radSlider->setValue(arg1 * 100);
}
void BrushPenSelection::on_radSlider_sliderMoved(int position) {
ui->radSpinner->setValue(position / 100.);
}

6
cropeditor/settings/brushpenselection.hpp

@ -15,13 +15,13 @@ public:
explicit BrushPenSelection(CropScene *scene);
~BrushPenSelection();
private slots:
public slots:
void on_radSlider_sliderMoved(int position);
void on_radSpinner_valueChanged(double arg1);
void on_penColor_clicked(bool);
void on_brushColor_clicked(bool);
void on_buttonBox_accepted();
void on_buttonBox_rejected();
void on_widthSlider_sliderMoved(int position);
void on_widthSpinner_valueChanged(double arg1);

122
cropeditor/settings/brushpenselection.ui

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>416</width>
<width>449</width>
<height>367</height>
</rect>
</property>
@ -16,27 +16,24 @@
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Pen settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="penColor">
<property name="text">
<string>Width</string>
<string>Choose pen color</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QSlider" name="widthSlider">
<property name="maximum">
<number>2500</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
@ -50,17 +47,20 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="penColor">
<property name="text">
<string>Choose pen color</string>
<item row="1" column="0">
<widget class="QSlider" name="widthSlider">
<property name="maximum">
<number>2500</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<item row="1" column="0" rowspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Brush settings</string>
@ -162,7 +162,7 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
@ -172,6 +172,92 @@
</property>
</widget>
</item>
<item row="0" column="1" rowspan="3">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Blur settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="whatsThis">
<string>http://doc.qt.io/qt-5/qgraphicsblureffect.html#BlurHint-enum</string>
</property>
<property name="text">
<string>&lt;a href=&quot;http://doc.qt.io/qt-5/qgraphicsblureffect.html#BlurHint-enum&quot;&gt;Blur Hints</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QSlider" name="radSlider">
<property name="maximum">
<number>3000</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="radSpinner">
<property name="suffix">
<string>px</string>
</property>
<property name="maximum">
<double>30.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="performance">
<property name="text">
<string>Performance Hint</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="animated">
<property name="text">
<string>Animated Hint</string>
</property>
</widget>
</item>
<item row="5" column="0" rowspan="2" colspan="3">
<widget class="QCheckBox" name="quality">
<property name="text">
<string>Quality Hint</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label">
<property name="text">
<string>Blur Radius</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>

Loading…
Cancel
Save