[graphics/krita/rempt/fast_transform_tool_config] /: Transform tool: add tool preview option to tool options widget

Halla Rempt null at kde.org
Tue Sep 21 11:08:51 BST 2021


Git commit 0aa760b0034ccef7e9f7d10261afd382fd7a824d by Halla Rempt.
Committed on 21/09/2021 at 10:07.
Pushed by rempt into branch 'rempt/fast_transform_tool_config'.

Transform tool: add tool preview option to tool options widget

This adds a combobox where the user can select between the three
transform tool preview options, in-stack, in-stack with lod, fast
(on top of everything else).

CCMAIL:kimageshop at kde.org

M  +8    -8    libs/ui/forms/wdgperformancesettings.ui
M  +36   -1    plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
M  +3    -0    plugins/tools/tool_transform2/kis_tool_transform_config_widget.h
M  +62   -13   plugins/tools/tool_transform2/wdg_tool_transform.ui

https://invent.kde.org/graphics/krita/commit/0aa760b0034ccef7e9f7d10261afd382fd7a824d

diff --git a/libs/ui/forms/wdgperformancesettings.ui b/libs/ui/forms/wdgperformancesettings.ui
index c16d5d72b3..5706d59636 100644
--- a/libs/ui/forms/wdgperformancesettings.ui
+++ b/libs/ui/forms/wdgperformancesettings.ui
@@ -10,8 +10,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>505</width>
-    <height>446</height>
+    <width>509</width>
+    <height>490</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_3">
@@ -631,15 +631,10 @@
   </layout>
  </widget>
  <customwidgets>
-  <customwidget>
-   <class>KisIntParseSpinBox</class>
-   <extends>QSpinBox</extends>
-   <header>kis_int_parse_spin_box.h</header>
-  </customwidget>
   <customwidget>
    <class>KisDoubleSliderSpinBox</class>
    <extends>QWidget</extends>
-   <header location="global">kis_slider_spin_box.h</header>
+   <header>kis_slider_spin_box.h</header>
    <container>1</container>
   </customwidget>
   <customwidget>
@@ -648,6 +643,11 @@
    <header location="global">kis_slider_spin_box.h</header>
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>KisIntParseSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>kis_int_parse_spin_box.h</header>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>
diff --git a/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp b/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
index 1a8d9c7564..a6b46c9103 100644
--- a/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
+++ b/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
@@ -15,7 +15,7 @@
 #include "KisMainWindow.h"
 #include "KisViewManager.h"
 #include "kis_transform_utils.h"
-
+#include "kis_config_notifier.h"
 #include <kstandardguiitem.h>
 
 
@@ -34,6 +34,23 @@ KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionP
       m_configChanged(false)
 {
     setupUi(this);
+
+    KConfigGroup group = KSharedConfig::openConfig()->group("KisToolTransform");
+    bool useInStackPreview = !group.readEntry("useOverlayPreviewStyle", false);
+    bool forceLodMode = group.readEntry("forceLodMode", true);
+
+    if (useInStackPreview && !forceLodMode) {
+       cmbPreviewMode->setCurrentIndex(0);
+    }
+    else if (useInStackPreview && forceLodMode) {
+        cmbPreviewMode->setCurrentIndex(1);
+    }
+    else {
+        cmbPreviewMode->setCurrentIndex(2);
+    }
+
+    connect(cmbPreviewMode, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPreviewChanged(int)));
+
     flipXButton->setIcon(KisIconUtils::loadIcon("transform_icons_mirror_x"));
     flipYButton->setIcon(KisIconUtils::loadIcon("transform_icons_mirror_y"));
     rotateCWButton->setIcon(KisIconUtils::loadIcon("transform_icons_rotate_cw"));
@@ -1321,3 +1338,21 @@ void KisToolTransformConfigWidget::slotMeshScaleHandlesChanged()
     notifyConfigChanged();
     notifyEditingFinished();
 }
+
+void KisToolTransformConfigWidget::slotPreviewChanged(int index)
+{
+    KConfigGroup group = KSharedConfig::openConfig()->group("KisToolTransform");
+    switch(index) {
+    case 0:
+        group.writeEntry("useOverlayPreviewStyle", false);
+        group.writeEntry("forceLodMode", false);
+        break;
+    case 1:
+        group.writeEntry("useOverlayPreviewStyle", false);
+        group.writeEntry("forceLodMode", true);
+        break;
+    default:
+        group.writeEntry("useOverlayPreviewStyle", true);
+    }
+    KisConfigNotifier::instance()->notifyConfigChanged();
+}
diff --git a/plugins/tools/tool_transform2/kis_tool_transform_config_widget.h b/plugins/tools/tool_transform2/kis_tool_transform_config_widget.h
index 64cf97dcff..e2f2ca52dc 100644
--- a/plugins/tools/tool_transform2/kis_tool_transform_config_widget.h
+++ b/plugins/tools/tool_transform2/kis_tool_transform_config_widget.h
@@ -110,6 +110,9 @@ public Q_SLOTS:
     void slotMeshShowHandlesChanged();
     void slotMeshSymmetricalHandlesChanged();
     void slotMeshScaleHandlesChanged();
+
+    void slotPreviewChanged(int index);
+
 private:
 
     void blockNotifications();
diff --git a/plugins/tools/tool_transform2/wdg_tool_transform.ui b/plugins/tools/tool_transform2/wdg_tool_transform.ui
index f6fbb173ba..cf50b24143 100644
--- a/plugins/tools/tool_transform2/wdg_tool_transform.ui
+++ b/plugins/tools/tool_transform2/wdg_tool_transform.ui
@@ -10,8 +10,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>515</width>
-    <height>780</height>
+    <width>615</width>
+    <height>932</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -41,7 +41,43 @@
   <property name="layoutDirection">
    <enum>Qt::LeftToRight</enum>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout_5">
+  <layout class="QVBoxLayout" name="verticalLayout_3">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_6">
+     <item>
+      <widget class="QLabel" name="label_3">
+       <property name="text">
+        <string>Preview</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QComboBox" name="cmbPreviewMode">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <item>
+        <property name="text">
+         <string>Accurate</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>Accurate with Instant Preview</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>Fast</string>
+        </property>
+       </item>
+      </widget>
+     </item>
+    </layout>
+   </item>
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0">
      <property name="bottomMargin">
@@ -2196,6 +2232,19 @@
      </item>
     </layout>
    </item>
+   <item>
+    <spacer name="verticalSpacer_7">
+     <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>
     <widget class="QWidget" name="SpecialSpacer" native="true"/>
    </item>
@@ -2203,27 +2252,27 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KisIntParseSpinBox</class>
-   <extends>QSpinBox</extends>
-   <header>kis_int_parse_spin_box.h</header>
+   <class>KoAspectButton</class>
+   <extends>QWidget</extends>
+   <header>KoAspectButton.h</header>
+   <container>1</container>
   </customwidget>
   <customwidget>
    <class>KisCmbIDList</class>
    <extends></extends>
    <header>widgets/kis_cmb_idlist.h</header>
   </customwidget>
-  <customwidget>
-   <class>KoAspectButton</class>
-   <extends>QWidget</extends>
-   <header>KoAspectButton.h</header>
-   <container>1</container>
-  </customwidget>
   <customwidget>
    <class>KisDoubleSliderSpinBox</class>
    <extends>QWidget</extends>
    <header>kis_slider_spin_box.h</header>
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>KisIntParseSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>kis_int_parse_spin_box.h</header>
+  </customwidget>
   <customwidget>
    <class>KisAngleSelector</class>
    <extends>QWidget</extends>
@@ -2235,7 +2284,7 @@
  <connections/>
  <buttongroups>
   <buttongroup name="buttonGroup"/>
-  <buttongroup name="freeTransformRadioGroup"/>
   <buttongroup name="cageTransformButtonGroup"/>
+  <buttongroup name="freeTransformRadioGroup"/>
  </buttongroups>
 </ui>


More information about the kimageshop mailing list