[krita] /: FEATURE: Make it possible to set the maximum brush size to 10, 000

Boudewijn Rempt null at kde.org
Wed Feb 1 13:43:49 UTC 2017


Git commit 85ec5a10916f4b5eefe36c14272957154b49e4fb by Boudewijn Rempt.
Committed on 01/02/2017 at 13:42.
Pushed by rempt into branch 'master'.

FEATURE: Make it possible to set the maximum brush size to 10,000

Now users can set the maximum brush size to 10,000. The default is
still 1,000 -- and trust me, a 10,000 pixel diameter brush is
slow and takes a huge amount of memory.

BUG:334123
CCMAIL:kimageshop at kde.org

M  +6    -4    libs/image/brushengine/kis_standard_uniform_properties_factory.cpp
M  +5    -0    libs/ui/dialogs/kis_dlg_preferences.cc
M  +68   -38   libs/ui/forms/wdggeneralsettings.ui
M  +1    -1    libs/ui/kis_paintop_box.cc
M  +2    -1    plugins/paintops/dynadraw/kis_dyna_paintop_settings.cpp
M  +2    -2    plugins/paintops/dynadraw/kis_dynaop_option.cpp
M  +5    -1    plugins/paintops/libpaintop/kis_auto_brush_widget.cpp
M  +5    -1    plugins/paintops/libpaintop/kis_brush_chooser.cpp

https://commits.kde.org/krita/85ec5a10916f4b5eefe36c14272957154b49e4fb

diff --git a/libs/image/brushengine/kis_standard_uniform_properties_factory.cpp b/libs/image/brushengine/kis_standard_uniform_properties_factory.cpp
index 5d8b714df60..a3bd739097c 100644
--- a/libs/image/brushengine/kis_standard_uniform_properties_factory.cpp
+++ b/libs/image/brushengine/kis_standard_uniform_properties_factory.cpp
@@ -21,9 +21,9 @@
 #include "kis_slider_based_paintop_property.h"
 #include "kis_paintop_settings.h"
 #include "kis_paintop_settings_update_proxy.h"
-
-
-
+#include <kconfig.h>
+#include <ksharedconfig.h>
+#include <kconfiggroup.h>
 
 namespace KisStandardUniformPropertiesFactory {
 
@@ -51,7 +51,9 @@ KisUniformPaintOpPropertySP createProperty(const QString &id,
                     i18n("Size"),
                     settings, 0);
 
-        prop->setRange(0, 1000);
+
+
+        prop->setRange(0, KSharedConfig::openConfig()->group("").readEntry("maximumBrushSize", 1000));
         prop->setDecimals(2);
         prop->setSingleStep(1);
         prop->setExponentRatio(3.0);
diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc
index 4d27bb43567..3003738cec3 100644
--- a/libs/ui/dialogs/kis_dlg_preferences.cc
+++ b/libs/ui/dialogs/kis_dlg_preferences.cc
@@ -119,6 +119,8 @@ GeneralTab::GeneralTab(QWidget *_parent, const char *_name)
     KConfigGroup group = KSharedConfig::openConfig()->group("File Dialogs");
     m_chkNativeFileDialog->setChecked(!group.readEntry("DontUseNativeFileDialog", true));
 
+    intMaxBrushSize->setValue(cfg.readEntry("maximumBrushSize", 1000));
+
     m_cmbMDIType->setCurrentIndex(cfg.readEntry<int>("mdi_viewmode", (int)QMdiArea::TabbedView));
     m_chkRubberBand->setChecked(cfg.readEntry<int>("mdi_rubberband", cfg.useOpenGL()));
     m_favoritePresetsSpinBox->setValue(cfg.favoritePresets());
@@ -152,6 +154,7 @@ void GeneralTab::setDefault()
     m_showOutlinePainting->setChecked(cfg.showOutlineWhilePainting(true));
     m_hideSplashScreen->setChecked(cfg.hideSplashScreen(true));
     m_chkNativeFileDialog->setChecked(false);
+    intMaxBrushSize->setValue(1000);
 
     m_cmbMDIType->setCurrentIndex((int)QMdiArea::TabbedView);
     m_chkRubberBand->setChecked(cfg.useOpenGL(true));
@@ -1003,6 +1006,8 @@ bool KisDlgPreferences::editPreferences()
         KConfigGroup group = KSharedConfig::openConfig()->group("File Dialogs");
         group.writeEntry("DontUseNativeFileDialog", !dialog->m_general->m_chkNativeFileDialog->isChecked());
 
+        cfg.writeEntry<int>("maximumBrushSize", dialog->m_general->intMaxBrushSize->value());
+
         cfg.writeEntry<int>("mdi_viewmode", dialog->m_general->mdiMode());
         cfg.setMDIBackgroundColor(dialog->m_general->m_mdiColor->color().toQColor());
         cfg.setMDIBackgroundImage(dialog->m_general->m_backgroundimage->text());
diff --git a/libs/ui/forms/wdggeneralsettings.ui b/libs/ui/forms/wdggeneralsettings.ui
index ed586057fa6..993dd82cbd7 100644
--- a/libs/ui/forms/wdggeneralsettings.ui
+++ b/libs/ui/forms/wdggeneralsettings.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>552</width>
-    <height>295</height>
+    <width>759</width>
+    <height>468</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -29,7 +29,7 @@
    <item row="0" column="0">
     <widget class="QTabWidget" name="tabWidget">
      <property name="currentIndex">
-      <number>0</number>
+      <number>3</number>
      </property>
      <widget class="QWidget" name="tab">
       <attribute name="title">
@@ -412,7 +412,7 @@
       <attribute name="title">
        <string>Miscellaneous</string>
       </attribute>
-      <layout class="QGridLayout" name="gridLayout_3">
+      <layout class="QFormLayout" name="formLayout_3">
        <item row="0" column="0">
         <widget class="QCheckBox" name="m_autosaveCheckBox">
          <property name="sizePolicy">
@@ -470,21 +470,21 @@
          </property>
         </widget>
        </item>
-       <item row="2" column="1">
+       <item row="3" column="1">
         <widget class="QCheckBox" name="m_backupFileCheckBox">
          <property name="text">
           <string>Create backup file </string>
          </property>
         </widget>
        </item>
-       <item row="3" column="1">
+       <item row="5" column="1">
         <widget class="QCheckBox" name="m_chkConvertOnImport">
          <property name="text">
           <string>On importing images as layers, convert to the image colorspace</string>
          </property>
         </widget>
        </item>
-       <item row="4" column="0">
+       <item row="7" column="0">
         <widget class="QLabel" name="label">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@@ -500,7 +500,7 @@
          </property>
         </widget>
        </item>
-       <item row="4" column="1">
+       <item row="7" column="1">
         <widget class="KisIntParseSpinBox" name="m_undoStackSize">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -528,7 +528,7 @@
          </property>
         </widget>
        </item>
-       <item row="5" column="0">
+       <item row="8" column="0">
         <widget class="QLabel" name="label_3">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@@ -544,7 +544,7 @@
          </property>
         </widget>
        </item>
-       <item row="5" column="1">
+       <item row="8" column="1">
         <widget class="KisIntParseSpinBox" name="m_favoritePresetsSpinBox">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -566,60 +566,90 @@
          </property>
         </widget>
        </item>
-       <item row="6" column="1">
+       <item row="9" column="1">
         <widget class="QCheckBox" name="chkShowRootLayer">
          <property name="text">
           <string>Show root layer</string>
          </property>
         </widget>
        </item>
-       <item row="7" column="1">
+       <item row="11" column="1">
         <widget class="QCheckBox" name="m_hideSplashScreen">
          <property name="text">
           <string>Hide splash screen on startup</string>
          </property>
         </widget>
        </item>
-       <item row="8" column="0">
+       <item row="13" column="1">
+        <widget class="QCheckBox" name="m_chkNativeFileDialog">
+         <property name="toolTip">
+          <string>Warning: if you enable this setting and the file dialogs do weird stuff, do not report a bug.</string>
+         </property>
+         <property name="text">
+          <string>Enable native file dialogs (warning: may not work correctly on some systems)</string>
+         </property>
+        </widget>
+       </item>
+       <item row="15" column="0">
+        <widget class="QLabel" name="label_9">
+         <property name="text">
+          <string>Maximum brush size:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="15" column="1">
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QSpinBox" name="intMaxBrushSize">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="toolTip">
+            <string>The maximum diameter of a brush in pixels.</string>
+           </property>
+           <property name="suffix">
+            <string comment="pixel">px</string>
+           </property>
+           <property name="minimum">
+            <number>100</number>
+           </property>
+           <property name="maximum">
+            <number>10000</number>
+           </property>
+           <property name="value">
+            <number>1000</number>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_10">
+           <property name="text">
+            <string>(Needs restart)</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item row="17" column="1">
         <spacer name="verticalSpacer_4">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
-           <width>20</width>
-           <height>40</height>
+           <width>504</width>
+           <height>13</height>
           </size>
          </property>
         </spacer>
        </item>
-       <item row="8" column="1">
-        <widget class="QCheckBox" name="m_chkNativeFileDialog">
-         <property name="toolTip">
-          <string>Warning: if you enable this setting and the file dialogs do weird stuff, do not report a bug.</string>
-         </property>
-         <property name="text">
-          <string>Enable native file dialogs (warning: they may not work correctly on systems)</string>
-         </property>
-        </widget>
-       </item>
       </layout>
      </widget>
     </widget>
    </item>
-   <item row="1" column="0">
-    <spacer name="verticalSpacer_5">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <customwidgets>
diff --git a/libs/ui/kis_paintop_box.cc b/libs/ui/kis_paintop_box.cc
index ba4a5dabdcb..a7516df4a7f 100644
--- a/libs/ui/kis_paintop_box.cc
+++ b/libs/ui/kis_paintop_box.cc
@@ -283,7 +283,7 @@ KisPaintopBox::KisPaintopBox(KisViewManager *view, QWidget *parent, const char *
         slFlow->setFixedHeight(iconsize);
         slFlow->setBlockUpdateSignalOnDrag(true);
 
-        slSize->setRange(0, 1000, 2);
+        slSize->setRange(0, cfg.readEntry("maximumBrushSize", 1000), 2);
         slSize->setValue(100);
 
         slSize->setSingleStep(1);
diff --git a/plugins/paintops/dynadraw/kis_dyna_paintop_settings.cpp b/plugins/paintops/dynadraw/kis_dyna_paintop_settings.cpp
index 68c28c12370..e315b9876b7 100644
--- a/plugins/paintops/dynadraw/kis_dyna_paintop_settings.cpp
+++ b/plugins/paintops/dynadraw/kis_dyna_paintop_settings.cpp
@@ -20,6 +20,7 @@
 #include <kis_paint_action_type_option.h>
 #include <kis_airbrush_option.h>
 #include "kis_dynaop_option.h"
+#include <kis_config.h>
 
 struct KisDynaPaintOpSettings::Private
 {
@@ -88,7 +89,7 @@ QList<KisUniformPaintOpPropertySP> KisDynaPaintOpSettings::uniformProperties(Kis
                     i18n("Diameter"),
                     settings, 0);
 
-            prop->setRange(0, 1000);
+            prop->setRange(0, KisConfig().readEntry("maximumBrushSize", 1000));
             prop->setSingleStep(1);
             prop->setSuffix(i18n(" px"));
 
diff --git a/plugins/paintops/dynadraw/kis_dynaop_option.cpp b/plugins/paintops/dynadraw/kis_dynaop_option.cpp
index 9ca5d0cbe66..398d1e738b0 100644
--- a/plugins/paintops/dynadraw/kis_dynaop_option.cpp
+++ b/plugins/paintops/dynadraw/kis_dynaop_option.cpp
@@ -17,7 +17,7 @@
  */
 #include "kis_dynaop_option.h"
 #include <klocalizedstring.h>
-
+#include <kis_config.h>
 #include <brushengine/kis_paintop_lod_limitations.h>
 
 #include "ui_wdgdynaoptions.h"
@@ -33,7 +33,7 @@ public:
         angleSlider->setSingleStep(1);
         angleSlider->setSuffix(QChar(Qt::Key_degree));
 
-        diameterDSSB->setRange(0, 1000, 0);
+        diameterDSSB->setRange(0, KisConfig().readEntry("maximumBrushSize", 1000), 0);
         diameterDSSB->setValue(20);
         diameterDSSB->setExponentRatio(3.0);
 
diff --git a/plugins/paintops/libpaintop/kis_auto_brush_widget.cpp b/plugins/paintops/libpaintop/kis_auto_brush_widget.cpp
index 94329dab3bf..83acd478aee 100644
--- a/plugins/paintops/libpaintop/kis_auto_brush_widget.cpp
+++ b/plugins/paintops/libpaintop/kis_auto_brush_widget.cpp
@@ -21,6 +21,10 @@
 #include <compositeops/KoVcMultiArchBuildSupport.h> //MSVC requires that Vc come first
 #include "kis_auto_brush_widget.h"
 
+#include <kconfig.h>
+#include <ksharedconfig.h>
+#include <kconfiggroup.h>
+
 #include <math.h>
 #include <kis_debug.h>
 #include <QSpinBox>
@@ -52,7 +56,7 @@ KisAutoBrushWidget::KisAutoBrushWidget(QWidget *parent, const char* name)
 
     connect((QObject*)comboBoxShape, SIGNAL(activated(int)), m_updateCompressor.data(), SLOT(start()));
 
-    inputRadius->setRange(0, 1000, 2);
+    inputRadius->setRange(0, KSharedConfig::openConfig()->group("").readEntry("maximumBrushSize", 1000), 2);
     inputRadius->setExponentRatio(3.0);
     inputRadius->setSingleStep(1);
     inputRadius->setValue(5);
diff --git a/plugins/paintops/libpaintop/kis_brush_chooser.cpp b/plugins/paintops/libpaintop/kis_brush_chooser.cpp
index dc2d6d5bcc2..8db32f1d86f 100644
--- a/plugins/paintops/libpaintop/kis_brush_chooser.cpp
+++ b/plugins/paintops/libpaintop/kis_brush_chooser.cpp
@@ -33,6 +33,10 @@
 #include <QAbstractItemDelegate>
 #include <klocalizedstring.h>
 
+#include <kconfig.h>
+#include <ksharedconfig.h>
+#include <kconfiggroup.h>
+
 #include <KoResourceItemChooser.h>
 
 #include <kis_icon.h>
@@ -105,7 +109,7 @@ KisPredefinedBrushChooser::KisPredefinedBrushChooser(QWidget *parent, const char
 
     setupUi(this);
 
-    brushSizeSpinBox->setRange(0, 1000, 2);
+    brushSizeSpinBox->setRange(0, KSharedConfig::openConfig()->group("").readEntry("maximumBrushSize", 1000), 2);
     brushSizeSpinBox->setValue(5);
     brushSizeSpinBox->setExponentRatio(3.0);
     brushSizeSpinBox->setSuffix(i18n(" px"));


More information about the kimageshop mailing list