[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/krita
From:       Sven Langkamp <sven.langkamp () gmail ! com>
Date:       2010-09-09 0:46:50
Message-ID: 20100909004650.D73F4AC871 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1173233 by langkamp:

add a warning icon if the preset is not valid
required brush filenames are saved to the preset settings
BUG:249127


 M  +5 -0      image/brushengine/kis_paintop_settings.cpp  
 M  +5 -0      image/brushengine/kis_paintop_settings.h  
 M  +13 -0     plugins/paintops/libpaintop/kis_brush_based_paintop_settings.cpp  
 M  +3 -0      plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h  
 M  +3 -0      plugins/paintops/libpaintop/kis_brush_option.cpp  
 M  +3 -0      ui/kis_paintop_box.cc  
 M  +6 -0      ui/widgets/kis_preset_chooser.cpp  


--- trunk/koffice/krita/image/brushengine/kis_paintop_settings.cpp #1173232:1173233
@@ -179,6 +179,11 @@
     return d->settingsWidget.data();
 }
 
+bool KisPaintOpSettings::isValid()
+{
+    return true;
+}
+
 QPainterPath KisPaintOpSettings::brushOutline(const QPointF& pos, OutlineMode mode, qreal scale, qreal \
rotation) const  {
     QPainterPath path;
--- trunk/koffice/krita/image/brushengine/kis_paintop_settings.h #1173232:1173233
@@ -174,6 +174,11 @@
      */
     void setModelName(const QString & modelName);
     
+    /// Check if the settings are valid, setting might be invalid through missing brushes etc
+    /// Overwrite if the settings of a paintop can be invalid
+    /// @return state of the settings, default implementation is true
+    virtual bool isValid();
+    
 protected:
      /**
      * @return the option widget of the paintop (can be 0 is no option widgets is set)
--- trunk/koffice/krita/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.cpp #1173232:1173233
@@ -22,6 +22,7 @@
 #include <kis_airbrush_option.h>
 #include "kis_brush_based_paintop_options_widget.h"
 #include <kis_boundary.h>
+#include "kis_brush_server.h"
 
 bool KisBrushBasedPaintOpSettings::paintIncremental()
 {
@@ -103,3 +104,15 @@
     return path;
 }
 
+bool KisBrushBasedPaintOpSettings::isValid()
+{
+    QString filename = getString("requiredBrushFile","");
+    if (!filename.isEmpty()) {
+        KisBrushSP brush = KisBrushServer::instance()->brushServer()->getResourceByFilename(filename);
+        if (!brush) {
+            return false;
+        }
+    }
+    return true;
+}
+
--- trunk/koffice/krita/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h #1173232:1173233
@@ -41,6 +41,9 @@
     virtual void paintOutline(const QPointF& pos, KisImageWSP image, QPainter& painter, \
KisPaintOpSettings::OutlineMode _mode) const;  
     virtual QPainterPath brushOutline(const QPointF& pos, OutlineMode mode, qreal scale = 1.0, qreal \
rotation = 0.0) const; +
+    ///Reimplemented
+    virtual bool isValid();
 };
 
 #endif // KIS_BRUSH_BASED_PAINTOP_SETTINGS_H
--- trunk/koffice/krita/plugins/paintops/libpaintop/kis_brush_option.cpp #1173232:1173233
@@ -35,7 +35,10 @@
     m_brush->toXML( d, e );
     d.appendChild(e);
     setting->setProperty( "brush_definition", d.toString() );
+    if (!m_brush->filename().isEmpty()) {
+        setting->setProperty( "requiredBrushFile", m_brush->filename() );
 }
+}
 
 void KisBrushOption::readOptionSetting(const KisPropertiesConfiguration* setting)
 {
--- trunk/koffice/krita/ui/kis_paintop_box.cc #1173232:1173233
@@ -250,6 +250,9 @@
 {
     KisPaintOpPreset* preset = static_cast<KisPaintOpPreset*>(resource);
     dbgUI << "preset " << preset->name() << "selected";
+    if (!preset->settings()->isValid()) {
+        return;
+    }
 
     if(preset->paintOp() != currentPaintop()) {
         setCurrentPaintop(preset->paintOp());
--- trunk/koffice/krita/ui/widgets/kis_preset_chooser.cpp #1173232:1173233
@@ -28,6 +28,7 @@
 #include <klocale.h>
 #include <kstandarddirs.h>
 #include <klineedit.h>
+#include <kicon.h>
 
 #include <KoResourceItemChooser.h>
 #include <KoResourceModel.h>
@@ -90,7 +91,12 @@
         painter->setPen(Qt::black);      
         painter->drawText(pixSize.width() + 10, option.rect.y() + option.rect.height() - 10, \
preset->name());        }
+    
+    if (!preset->settings()->isValid()) {
+        KIcon icon("edit-delete");
+        icon.paint(painter, QRect(paintRect.x() + paintRect.height() - 25, paintRect.y() + \
paintRect.height() - 25, 25, 25));  }
+}
 
 class KisPresetProxyAdapter : public KoResourceServerAdapter<KisPaintOpPreset>
 {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic