[calligra/calligra/2.9] krita: [FEATURE] Implemented memoru consumption configuration UI

Dmitry Kazakov dimula73 at gmail.com
Wed Jun 3 13:35:08 UTC 2015


Git commit 8aed44bc8fca2f6ac98f8e202a9ec420af498d31 by Dmitry Kazakov.
Committed on 03/06/2015 at 13:27.
Pushed by dkazakov into branch 'calligra/2.9'.

[FEATURE] Implemented memoru consumption configuration UI

1) One can configure memory consumption
2) Changed default values for memory. Now pool takes much
   less space (intentionally)
3) One can also activate performance logging using GUI

CCMAIL:kimageshop at kde.org

M  +31   -13   krita/image/kis_image_config.cpp
M  +7    -5    krita/image/kis_image_config.h
M  +1    -0    krita/ui/CMakeLists.txt
M  +112  -17   krita/ui/dialogs/kis_dlg_preferences.cc
M  +12   -2    krita/ui/dialogs/kis_dlg_preferences.h
A  +72   -0    krita/ui/dialogs/slider_and_spin_box_sync.cpp     [License: GPL (v2+)]
A  +65   -0    krita/ui/dialogs/slider_and_spin_box_sync.h     [License: GPL (v2+)]
M  +193  -62   krita/ui/forms/wdgperformancesettings.ui
M  +0    -10   krita/ui/kis_config.cc
M  +0    -4    krita/ui/kis_config.h
M  +5    -3    krita/ui/widgets/kis_slider_spin_box.h

http://commits.kde.org/calligra/8aed44bc8fca2f6ac98f8e202a9ec420af498d31

diff --git a/krita/image/kis_image_config.cpp b/krita/image/kis_image_config.cpp
index 7d9c378..c047ad5 100644
--- a/krita/image/kis_image_config.cpp
+++ b/krita/image/kis_image_config.cpp
@@ -42,9 +42,15 @@ KisImageConfig::~KisImageConfig()
     m_config.sync();
 }
 
-bool KisImageConfig::enablePerfLog() const
+bool KisImageConfig::enablePerfLog(bool requestDefault) const
 {
-    return m_config.readEntry("enablePerfLog", false);
+    return !requestDefault ?
+        m_config.readEntry("enablePerfLog", false) :false;
+}
+
+void KisImageConfig::setEnablePerfLog(bool value)
+{
+    m_config.writeEntry("enablePerfLog", value);
 }
 
 qreal KisImageConfig::transformMaskOffBoundsReadArea() const
@@ -100,9 +106,10 @@ void KisImageConfig::setSchedulerBalancingRatio(qreal value)
     m_config.writeEntry("schedulerBalancingRatio", value);
 }
 
-int KisImageConfig::maxSwapSize() const
+int KisImageConfig::maxSwapSize(bool requestDefault) const
 {
-    return m_config.readEntry("maxSwapSize", 4096); // in MiB
+    return !requestDefault ?
+        m_config.readEntry("maxSwapSize", 4096) : 4096; // in MiB
 }
 
 void KisImageConfig::setMaxSwapSize(int value)
@@ -132,22 +139,31 @@ void KisImageConfig::setSwapWindowSize(int value)
 
 int KisImageConfig::tilesHardLimit() const
 {
-    return totalRAM() * (memoryHardLimitPercent() - memoryPoolLimitPercent()) / 100;
+    qreal hp = qreal(memoryHardLimitPercent()) / 100.0;
+    qreal pp = qreal(memoryPoolLimitPercent()) / 100.0;
+
+    return totalRAM() * hp * (1 - pp);
 }
 
 int KisImageConfig::tilesSoftLimit() const
 {
-    return totalRAM() * (memorySoftLimitPercent() - memoryPoolLimitPercent()) / 100;
+    qreal sp = qreal(memorySoftLimitPercent()) / 100.0;
+
+    return tilesHardLimit() * sp;
 }
 
 int KisImageConfig::poolLimit() const
 {
-    return totalRAM() * memoryPoolLimitPercent() / 100;
+    qreal hp = qreal(memoryHardLimitPercent()) / 100.0;
+    qreal pp = qreal(memoryPoolLimitPercent()) / 100.0;
+
+    return totalRAM() * hp * pp;
 }
 
-qreal KisImageConfig::memoryHardLimitPercent() const
+qreal KisImageConfig::memoryHardLimitPercent(bool requestDefault) const
 {
-    return m_config.readEntry("memoryHardLimitPercent", 50.);
+    return !requestDefault ?
+        m_config.readEntry("memoryHardLimitPercent", 50.) : 50.;
 }
 
 void KisImageConfig::setMemoryHardLimitPercent(qreal value)
@@ -155,9 +171,10 @@ void KisImageConfig::setMemoryHardLimitPercent(qreal value)
     m_config.writeEntry("memoryHardLimitPercent", value);
 }
 
-qreal KisImageConfig::memorySoftLimitPercent() const
+qreal KisImageConfig::memorySoftLimitPercent(bool requestDefault) const
 {
-    return m_config.readEntry("memorySoftLimitPercent", 25.);
+    return !requestDefault ?
+        m_config.readEntry("memorySoftLimitPercent", 2.) : 2.;
 }
 
 void KisImageConfig::setMemorySoftLimitPercent(qreal value)
@@ -165,9 +182,10 @@ void KisImageConfig::setMemorySoftLimitPercent(qreal value)
     m_config.writeEntry("memorySoftLimitPercent", value);
 }
 
-qreal KisImageConfig::memoryPoolLimitPercent() const
+qreal KisImageConfig::memoryPoolLimitPercent(bool requestDefault) const
 {
-    return m_config.readEntry("memoryPoolLimitPercent", 20.);
+    return !requestDefault ?
+        m_config.readEntry("memoryPoolLimitPercent", 2.) : 2.;
 }
 
 void KisImageConfig::setMemoryPoolLimitPercent(qreal value)
diff --git a/krita/image/kis_image_config.h b/krita/image/kis_image_config.h
index dd595c9..9d950ff 100644
--- a/krita/image/kis_image_config.h
+++ b/krita/image/kis_image_config.h
@@ -29,7 +29,9 @@ public:
     KisImageConfig();
     ~KisImageConfig();
 
-    bool enablePerfLog() const;
+    bool enablePerfLog(bool requestDefault = false) const;
+    void setEnablePerfLog(bool value);
+
     qreal transformMaskOffBoundsReadArea() const;
 
     int updatePatchHeight() const;
@@ -43,7 +45,7 @@ public:
     qreal schedulerBalancingRatio() const;
     void setSchedulerBalancingRatio(qreal value);
 
-    int maxSwapSize() const;
+    int maxSwapSize(bool requestDefault = false) const;
     void setMaxSwapSize(int value);
 
     int swapSlabSize() const;
@@ -56,9 +58,9 @@ public:
     int tilesSoftLimit() const; // MiB
     int poolLimit() const; // MiB
 
-    qreal memoryHardLimitPercent() const; // % of total RAM
-    qreal memorySoftLimitPercent() const; // % of total RAM
-    qreal memoryPoolLimitPercent() const; // % of total RAM
+    qreal memoryHardLimitPercent(bool requestDefault = false) const; // % of total RAM
+    qreal memorySoftLimitPercent(bool requestDefault = false) const; // % of memoryHardLimitPercent() * (1 - 0.01 * memoryPoolLimitPercent())
+    qreal memoryPoolLimitPercent(bool requestDefault = false) const; // % of memoryHardLimitPercent()
     void setMemoryHardLimitPercent(qreal value);
     void setMemorySoftLimitPercent(qreal value);
     void setMemoryPoolLimitPercent(qreal value);
diff --git a/krita/ui/CMakeLists.txt b/krita/ui/CMakeLists.txt
index 73ee29c..a2a293e 100644
--- a/krita/ui/CMakeLists.txt
+++ b/krita/ui/CMakeLists.txt
@@ -61,6 +61,7 @@ set(kritaui_LIB_SRCS
     dialogs/kis_dlg_image_properties.cc
     dialogs/kis_dlg_layer_properties.cc
     dialogs/kis_dlg_preferences.cc
+    dialogs/slider_and_spin_box_sync.cpp
     dialogs/kis_dlg_blacklist_cleanup.cpp
     dialogs/kis_dlg_layer_style.cpp
     dialogs/kis_dlg_png_import.cpp
diff --git a/krita/ui/dialogs/kis_dlg_preferences.cc b/krita/ui/dialogs/kis_dlg_preferences.cc
index fd00f6e..fd1e138 100644
--- a/krita/ui/dialogs/kis_dlg_preferences.cc
+++ b/krita/ui/dialogs/kis_dlg_preferences.cc
@@ -41,6 +41,9 @@
 #include <QMessageBox>
 #include <QDesktopWidget>
 
+#include <boost/bind.hpp>
+
+
 #ifdef HAVE_OPENGL
 #include <qgl.h>
 #endif
@@ -74,6 +77,8 @@
 #include "kis_factory2.h"
 #include "kis_color_manager.h"
 
+#include "slider_and_spin_box_sync.h"
+
 // for the performance update
 #include <kis_cubic_curve.h>
 
@@ -474,21 +479,119 @@ TabletSettingsTab::TabletSettingsTab(QWidget* parent, const char* name): QWidget
 
 
 //---------------------------------------------------------------------------------------------------
+#include "kis_image_config.h"
+#include "kis_acyclic_signal_connector.h"
+
+int getTotalRAM() {
+    KisImageConfig cfg;
+    return cfg.totalRAM();
+}
+
+int PerformanceTab::realTilesRAM()
+{
+    return intMemoryLimit->value() - intPoolLimit->value();
+}
+
 PerformanceTab::PerformanceTab(QWidget *parent, const char *name)
     : WdgPerformanceSettings(parent, name)
 {
-    // XXX: Make sure only profiles that fit the specified color model
-    // are shown in the profile combos
+    KisImageConfig cfg;
+    const int totalRAM = cfg.totalRAM();
+    lblTotalMemory->setText(i18n("%1 MiB", totalRAM));
+
+    sliderMemoryLimit->setSuffix(" %");
+    sliderMemoryLimit->setRange(1, 100, 2);
+    sliderMemoryLimit->setSingleStep(0.01);
+
+    sliderPoolLimit->setSuffix(" %");
+    sliderPoolLimit->setRange(0, 20, 2);
+    sliderMemoryLimit->setSingleStep(0.01);
+
+    sliderUndoLimit->setSuffix(" %");
+    sliderUndoLimit->setRange(0, 50, 2);
+    sliderMemoryLimit->setSingleStep(0.01);
+
+    intMemoryLimit->setMinimumWidth(80);
+    intPoolLimit->setMinimumWidth(80);
+    intUndoLimit->setMinimumWidth(80);
+
+
+    SliderAndSpinBoxSync *sync1 =
+        new SliderAndSpinBoxSync(sliderMemoryLimit,
+                                 intMemoryLimit,
+                                 getTotalRAM);
+
+    sync1->slotParentValueChanged();
+    m_syncs << sync1;
+
+    SliderAndSpinBoxSync *sync2 =
+        new SliderAndSpinBoxSync(sliderPoolLimit,
+                                 intPoolLimit,
+                                 boost::bind(&QSpinBox::value,
+                                             intMemoryLimit));
+
+
+    connect(intMemoryLimit, SIGNAL(valueChanged(int)), sync2, SLOT(slotParentValueChanged()));
+    sync2->slotParentValueChanged();
+    m_syncs << sync2;
+
+    SliderAndSpinBoxSync *sync3 =
+        new SliderAndSpinBoxSync(sliderUndoLimit,
+                                 intUndoLimit,
+                                 boost::bind(&PerformanceTab::realTilesRAM,
+                                             this));
 
-    KisConfig cfg;
 
-    m_maxTiles->setValue(cfg.maxTilesInMem());
+    connect(intPoolLimit, SIGNAL(valueChanged(int)), sync3, SLOT(slotParentValueChanged()));
+    sync3->slotParentValueChanged();
+    m_syncs << sync3;
+
+    sliderSwapSize->setSuffix(i18n(" GiB"));
+    sliderSwapSize->setRange(1, 64);
+    intSwapSize->setRange(1, 64);
+
+    KisAcyclicSignalConnector *swapSizeConnector =
+        new KisAcyclicSignalConnector(this);
+
+    swapSizeConnector->connectForwardInt(sliderSwapSize, SIGNAL(valueChanged(int)),
+                                         intSwapSize, SLOT(setValue(int)));
+
+    swapSizeConnector->connectBackwardInt(intSwapSize, SIGNAL(valueChanged(int)),
+                                          sliderSwapSize, SLOT(setValue(int)));
+
+
+    load(false);
 }
 
-void PerformanceTab::setDefault()
+PerformanceTab::~PerformanceTab()
 {
-    KisConfig cfg;
-    m_maxTiles->setValue(cfg.maxTilesInMem(true));
+    qDeleteAll(m_syncs);
+}
+
+void PerformanceTab::load(bool requestDefault)
+{
+    KisImageConfig cfg;
+
+    sliderMemoryLimit->setValue(cfg.memoryHardLimitPercent(requestDefault));
+    sliderPoolLimit->setValue(cfg.memoryPoolLimitPercent(requestDefault));
+    sliderUndoLimit->setValue(cfg.memorySoftLimitPercent(requestDefault));
+
+    chkPerformanceLogging->setChecked(cfg.enablePerfLog(requestDefault));
+
+    sliderSwapSize->setValue(cfg.maxSwapSize(requestDefault) / 1024);
+}
+
+void PerformanceTab::save()
+{
+    KisImageConfig cfg;
+
+    cfg.setMemoryHardLimitPercent(sliderMemoryLimit->value());
+    cfg.setMemorySoftLimitPercent(sliderUndoLimit->value());
+    cfg.setMemoryPoolLimitPercent(sliderPoolLimit->value());
+
+    cfg.setEnablePerfLog(chkPerformanceLogging->isChecked());
+
+    cfg.setMaxSwapSize(sliderSwapSize->value() * 1024);
 }
 
 //---------------------------------------------------------------------------------------------------
@@ -772,14 +875,12 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
     m_colorSettings = new ColorSettingsTab(vbox);
 
     // Performance
-#if 0
     vbox = new KVBox();
     page = new KPageWidgetItem(vbox, i18n("Performance"));
     page->setHeader(i18n("Performance"));
     page->setIcon(koIcon("preferences-system-performance"));
     addPage(page);
     m_performanceSettings = new PerformanceTab(vbox);
-#endif
 
     // Grid
     vbox = new KVBox();
@@ -851,9 +952,7 @@ void KisDlgPreferences::slotDefault()
 {
     m_general->setDefault();
     m_colorSettings->setDefault();
-#if 0
-    m_performanceSettings->setDefault();
-#endif
+    m_performanceSettings->load(true);
 #ifdef HAVE_OPENGL
     m_displaySettings->setDefault();
 #endif
@@ -922,11 +1021,7 @@ bool KisDlgPreferences::editPreferences()
         // Tablet settings
         cfg.setPressureTabletCurve( dialog->m_tabletSettings->m_page->pressureCurve->curve().toString() );
 
-#if 0
-        cfg.setMaxTilesInMem(dialog->m_performanceSettings->m_maxTiles->value());
-        // let the tile manager know
-        //KisTileManager::instance()->configChanged();
-#endif
+        dialog->m_performanceSettings->save();
 
 #ifdef HAVE_OPENGL
         if (!cfg.useOpenGL() && dialog->m_displaySettings->grpOpenGL->isChecked())
diff --git a/krita/ui/dialogs/kis_dlg_preferences.h b/krita/ui/dialogs/kis_dlg_preferences.h
index 6e6bf1c..804b55a 100644
--- a/krita/ui/dialogs/kis_dlg_preferences.h
+++ b/krita/ui/dialogs/kis_dlg_preferences.h
@@ -149,6 +149,8 @@ public:
   * "Performance"-tab for preferences dialog
  */
 
+class SliderAndSpinBoxSync;
+
 class WdgPerformanceSettings : public QWidget, public Ui::WdgPerformanceSettings
 {
     Q_OBJECT
@@ -166,8 +168,16 @@ class PerformanceTab : public WdgPerformanceSettings
 public:
     PerformanceTab(QWidget *parent = 0, const char *name = 0);
 
-public:
-    void setDefault();
+    ~PerformanceTab();
+
+    void load(bool requestDefault);
+    void save();
+
+private:
+    int realTilesRAM();
+
+private:
+    QVector<SliderAndSpinBoxSync*> m_syncs;
 };
 
 //=======================
diff --git a/krita/ui/dialogs/slider_and_spin_box_sync.cpp b/krita/ui/dialogs/slider_and_spin_box_sync.cpp
new file mode 100644
index 0000000..24ff5dc
--- /dev/null
+++ b/krita/ui/dialogs/slider_and_spin_box_sync.cpp
@@ -0,0 +1,72 @@
+/*
+ *  Copyright (c) 2015 Dmitry Kazakov <dimula73 at gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "slider_and_spin_box_sync.h"
+
+#include <QSpinBox>
+#include "kis_slider_spin_box.h"
+
+#include "kis_debug.h"
+#include "kis_signals_blocker.h"
+
+
+SliderAndSpinBoxSync::SliderAndSpinBoxSync(KisDoubleSliderSpinBox *slider,
+                                           QSpinBox *spinBox,
+                                           boost::function<int()> parentValueOp)
+    : m_slider(slider),
+      m_spinBox(spinBox),
+      m_parentValueOp(parentValueOp),
+      m_blockUpdates(false)
+{
+    connect(m_slider, SIGNAL(valueChanged(qreal)), SLOT(sliderChanged(qreal)));
+    connect(m_spinBox, SIGNAL(valueChanged(int)), SLOT(spinBoxChanged(int)));
+}
+
+SliderAndSpinBoxSync::~SliderAndSpinBoxSync()
+{
+
+}
+
+void SliderAndSpinBoxSync::slotParentValueChanged()
+{
+    int parentValue = m_parentValueOp();
+
+    m_spinBox->setRange(m_slider->minimum() * parentValue / 100,
+                        m_slider->maximum() * parentValue / 100);
+
+    sliderChanged(m_slider->value());
+}
+
+void SliderAndSpinBoxSync::sliderChanged(qreal value) {
+    if (m_blockUpdates) return;
+    m_blockUpdates = true;
+
+    m_spinBox->setValue(value * m_parentValueOp() / 100);
+
+    m_blockUpdates = false;
+}
+
+void SliderAndSpinBoxSync::spinBoxChanged(int value)
+{
+    if (m_blockUpdates) return;
+    m_blockUpdates = true;
+
+    m_slider->setValue(qreal(value) * 100 / m_parentValueOp());
+
+    m_blockUpdates = false;
+}
diff --git a/krita/ui/dialogs/slider_and_spin_box_sync.h b/krita/ui/dialogs/slider_and_spin_box_sync.h
new file mode 100644
index 0000000..368bbc7
--- /dev/null
+++ b/krita/ui/dialogs/slider_and_spin_box_sync.h
@@ -0,0 +1,65 @@
+/*
+ *  Copyright (c) 2015 Dmitry Kazakov <dimula73 at gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __SLIDER_AND_SPIN_BOX_SYNC_H
+#define __SLIDER_AND_SPIN_BOX_SYNC_H
+
+#include <QObject>
+#include <boost/function.hpp>
+
+class QSpinBox;
+class KisDoubleSliderSpinBox;
+
+/**
+ * Syncs a slider measured in percentage with a spin box
+ * measuring real value getting value from \p parentValueOp.
+ *
+ * E.g.
+ *
+ * parentValueOp() --- total system memory in MiB
+ * slider --- percentage of the memory we can use
+ * spinBox --- amount o fmemory we can use in MiB
+ * slotParentValueChanged() --- should be called every time
+ *                              total memory changes
+ */
+class SliderAndSpinBoxSync : public QObject
+{
+    Q_OBJECT
+public:
+    SliderAndSpinBoxSync(KisDoubleSliderSpinBox *slider,
+                         QSpinBox *spinBox,
+                         boost::function<int()> parentValueOp);
+
+    ~SliderAndSpinBoxSync();
+
+public Q_SLOTS:
+    void slotParentValueChanged();
+
+private Q_SLOTS:
+    void sliderChanged(qreal value);
+    void spinBoxChanged(int value);
+
+private:
+    KisDoubleSliderSpinBox *m_slider;
+    QSpinBox *m_spinBox;
+    boost::function<int()> m_parentValueOp;
+
+    bool m_blockUpdates;
+};
+
+#endif /* __SLIDER_AND_SPIN_BOX_SYNC_H */
diff --git a/krita/ui/forms/wdgperformancesettings.ui b/krita/ui/forms/wdgperformancesettings.ui
index 799b421..fbcf01f 100644
--- a/krita/ui/forms/wdgperformancesettings.ui
+++ b/krita/ui/forms/wdgperformancesettings.ui
@@ -6,77 +6,202 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>513</width>
-    <height>383</height>
+    <width>711</width>
+    <height>574</height>
    </rect>
   </property>
-  <layout class="QGridLayout">
-   <item row="0" column="0" colspan="2">
-    <layout class="QHBoxLayout">
-     <property name="leftMargin">
-      <number>0</number>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>RAM (needs restarting Krita)</string>
      </property>
-     <property name="topMargin">
-      <number>0</number>
-     </property>
-     <property name="rightMargin">
-      <number>0</number>
+     <layout class="QFormLayout" name="formLayout">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>Memory available:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QLabel" name="lblTotalMemory">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>XXX MiB</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>Memory Limit:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="KisDoubleSliderSpinBox" name="sliderMemoryLimit" native="true">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="intMemoryLimit">
+          <property name="suffix">
+           <string> MiB</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="label_5">
+        <property name="text">
+         <string>Internal Pool:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <layout class="QHBoxLayout" name="horizontalLayout_3">
+        <item>
+         <widget class="KisDoubleSliderSpinBox" name="sliderPoolLimit" native="true">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="intPoolLimit">
+          <property name="suffix">
+           <string> MiB</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="3" column="0">
+       <widget class="QLabel" name="label_4">
+        <property name="text">
+         <string>Swap Undo After:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <widget class="KisDoubleSliderSpinBox" name="sliderUndoLimit" native="true">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="intUndoLimit">
+          <property name="suffix">
+           <string> MiB</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>Swapping (needs restarting Krita)</string>
      </property>
-     <property name="bottomMargin">
-      <number>0</number>
+     <layout class="QFormLayout" name="formLayout_2">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_6">
+        <property name="text">
+         <string>File Size Limit</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <layout class="QHBoxLayout" name="horizontalLayout_4">
+        <item>
+         <widget class="KisSliderSpinBox" name="sliderSwapSize" native="true">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QSpinBox" name="intSwapSize">
+          <property name="suffix">
+           <string> GiB</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_3">
+     <property name="title">
+      <string>Advanced</string>
      </property>
-     <item>
-      <widget class="QLabel" name="textLabel1">
-       <property name="whatsThis">
-        <string>The maximum number of "tiles" that are kept in memory. For regular RGBA8 images, each tile is about 16 kB in size. Thus, for a value of 500 tiles this usually means about 8 megabytes are used for image data. If you regularly handle large images, a greater value here might be useful.
-Note that this number is only a guideline for Krita, and is not guaranteed to be the actual number of tiles in memory.</string>
-       </property>
-       <property name="text">
-        <string>Maximum number of tiles kept in memory:</string>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="KIntNumInput" name="m_maxTiles" native="true">
-       <property name="whatsThis">
-        <string>The maximum number of "tiles" that are kept in memory. For regular RGBA8 images, each tile is about 16 kB in size. Thus, for a value of 500 tiles this usually means about 8 megabytes are used for image data. If you regularly handle large images, a greater value here might be useful.
-Note that this number is only a guideline for Krita, and is not guaranteed to be the actual number of tiles in memory.</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer>
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeType">
-        <enum>QSizePolicy::Expanding</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>81</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QCheckBox" name="chkPerformanceLogging">
+        <property name="text">
+         <string>Enable performace logging (needs restarting Krita)</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="label_7">
+        <property name="frameShape">
+         <enum>QFrame::NoFrame</enum>
+        </property>
+        <property name="text">
+         <string>When performance logging is enabed Krita saves all strokes timing information into '<working_dir>/log' subdirectly. In case of performace problems, enable this option and send directory contetns to developers.</string>
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
    </item>
-   <item row="1" column="0" colspan="2">
-    <spacer>
+   <item>
+    <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::Expanding</enum>
-     </property>
      <property name="sizeHint" stdset="0">
       <size>
-       <width>495</width>
-       <height>71</height>
+       <width>20</width>
+       <height>40</height>
       </size>
      </property>
     </spacer>
@@ -85,9 +210,15 @@ Note that this number is only a guideline for Krita, and is not guaranteed to be
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KIntNumInput</class>
+   <class>KisSliderSpinBox</class>
+   <extends>QWidget</extends>
+   <header location="global">kis_slider_spin_box.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>KisDoubleSliderSpinBox</class>
    <extends>QWidget</extends>
-   <header>knuminput.h</header>
+   <header>kis_slider_spin_box.h</header>
    <container>1</container>
   </customwidget>
  </customwidgets>
diff --git a/krita/ui/kis_config.cc b/krita/ui/kis_config.cc
index 4c4c2bb..db2da91 100644
--- a/krita/ui/kis_config.cc
+++ b/krita/ui/kis_config.cc
@@ -666,16 +666,6 @@ void KisConfig::setMaxNumberOfThreads(qint32 maxThreads)
     m_cfg.writeEntry("maxthreads", maxThreads);
 }
 
-qint32 KisConfig::maxTilesInMem(bool defaultValue) const
-{
-    return (defaultValue ? 5000 : m_cfg.readEntry("maxtilesinmem", 5000));
-}
-
-void KisConfig::setMaxTilesInMem(qint32 tiles) const
-{
-    m_cfg.writeEntry("maxtilesinmem", tiles);
-}
-
 quint32 KisConfig::getGridMainStyle(bool defaultValue) const
 {
     quint32 v = m_cfg.readEntry("gridmainstyle", 0);
diff --git a/krita/ui/kis_config.h b/krita/ui/kis_config.h
index 43f52f8..d21848a 100644
--- a/krita/ui/kis_config.h
+++ b/krita/ui/kis_config.h
@@ -173,10 +173,6 @@ public:
     qint32 maxNumberOfThreads(bool defaultValue = false) const;
     void setMaxNumberOfThreads(qint32 numberOfThreads);
 
-    /// Maximum tiles in memory (this is a guideline, not absolute)
-    qint32 maxTilesInMem(bool defaultValue = false) const;
-    void setMaxTilesInMem(qint32 tiles) const;
-
     quint32 getGridMainStyle(bool defaultValue = false) const;
     void setGridMainStyle(quint32 v) const;
 
diff --git a/krita/ui/widgets/kis_slider_spin_box.h b/krita/ui/widgets/kis_slider_spin_box.h
index 7b8dec0..229e445 100644
--- a/krita/ui/widgets/kis_slider_spin_box.h
+++ b/krita/ui/widgets/kis_slider_spin_box.h
@@ -112,12 +112,14 @@ public:
     ///Get the value, don't use value()
     int value();
 
-    ///Set the value, don't use setValue()
-    void setValue(int value);
-
     void setSingleStep(int value);
     void setPageStep(int value);
 
+public Q_SLOTS:
+
+    ///Set the value, don't use setValue()
+    void setValue(int value);
+
 protected:
     virtual QString valueString() const;
     virtual void setInternalValue(int value);


More information about the kimageshop mailing list