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

List:       kde-commits
Subject:    koffice/kexi/shapes/relationdesign
From:       Adam Pigg <adam () piggz ! co ! uk>
Date:       2009-09-08 18:49:56
Message-ID: 1252435796.003415.22823.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1021278 by piggz:

save a preview image for suites that dont support the shape directly

 M  +12 -6     kexirelationdesignshape.cpp  
 M  +3 -0      kexirelationdesignshape.h  


--- trunk/koffice/kexi/shapes/relationdesign/kexirelationdesignshape.cpp \
#1021277:1021278 @@ -26,6 +26,7 @@
 #include <KoShapeSavingContext.h>
 #include <KoXmlReader.h>
 #include <KoShapeBackground.h>
+#include <KoZoomHandler.h>
 
 KexiRelationDesignShape::KexiRelationDesignShape() : \
KoFrameShape("http://www.koffice.org/kexirelationdesign", "shape"){  m_connection = \
0; @@ -57,15 +58,19 @@
     writer.endElement(); //relation
     writer.endElement(); //kexirelation:shape
 
-#if 0
+
     // Save a preview image
-    qreal previewDPI = 150;
+    qreal previewDPI = 200;
     QSizeF imgSize = size(); // in points
     imgSize *= previewDPI / 72;
     QImage img(imgSize.toSize(), QImage::Format_ARGB32);
     QPainter painter(&img);
     painter.setRenderHint(QPainter::Antialiasing);
     painter.setRenderHint(QPainter::TextAntialiasing);
+
+    //Fill to white
+    painter.fillRect(QRectF(QPointF(0,0), imgSize), Qt::white);
+    
     KoZoomHandler converter;
     converter.setZoomAndResolution(100, previewDPI, previewDPI);
     constPaint(painter, converter);
@@ -77,10 +82,7 @@
     writer.addAttribute("xlink:actuate", "onLoad");
     writer.addAttribute("xlink:href", name);
     writer.endElement(); // draw:image
-    
-    // TODO: Save a preview svg
 
-#endif
     saveOdfCommonChildElements(context);
     writer.endElement(); // draw:frame
 
@@ -121,6 +123,10 @@
 }
 
 void KexiRelationDesignShape::paint ( QPainter& painter, const KoViewConverter& \
converter ) { +    constPaint(painter, converter);
+}
+
+void KexiRelationDesignShape::constPaint ( QPainter& painter, const KoViewConverter& \
converter ) const {  applyConversion(painter, converter);
     
     painter.save();
@@ -130,7 +136,7 @@
 
     painter.setClipPath(pp);
     painter.setPen(QPen(Qt::black, 1.0));
-
+    
     //Draw user specified background
     if (background()) {
         background()->paint(painter, pp);
--- trunk/koffice/kexi/shapes/relationdesign/kexirelationdesignshape.h \
#1021277:1021278 @@ -37,7 +37,10 @@
         
         virtual void saveOdf ( KoShapeSavingContext& context ) const;
         virtual bool loadOdf ( const KoXmlElement& element, KoShapeLoadingContext& \
context ); +
         virtual void paint ( QPainter& painter, const KoViewConverter& converter );
+        void constPaint( QPainter& painter, const KoViewConverter& converter ) \
const; +        
         virtual void setSize(const QSizeF &size);
         
         void setConnectionData(KexiDB::ConnectionData*);


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

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