[Kst] extragear/graphics/kst/src/libkstapp

Andrew Walker arwalker at sumusltd.com
Fri May 12 21:02:37 CEST 2006


SVN commit 540245 by arwalker:

use shartedPtr

 M  +16 -16    kstviewmanager_i.cpp  
 M  +1 -1      kstviewmanager_i.h  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.cpp #540244:540245
@@ -65,7 +65,7 @@
         QStringList objects;
         KstViewObjectList vol;
         KstViewWindow *win;
-        KstViewObject *viewObject = koi->viewObject(&win);
+        KstViewObjectPtr viewObject = koi->viewObject(&win);
         
         drag = multipleDrag;
 
@@ -78,8 +78,8 @@
           multipleDrag->addDragObject(imd);
         }
       } else if(koi->rtti() == RTTI_OBJ_DATA_OBJECT) {
-        Kst2DPlot *plot;
-        KstDataObject *dataObject = koi->dataObject(&plot);
+        Kst2DPlotPtr plot;
+        KstDataObjectPtr dataObject = koi->dataObject(plot);
       
         if (dataObject) {
           QStoredDrag *storedDrag = new QStoredDrag("application/x-kst-curve-list", this);
@@ -163,7 +163,7 @@
     }
   } else if (rtti() == RTTI_OBJ_VIEW_OBJECT) {
     KstViewWindow *win;
-    KstViewObject *obj = viewObject(&win);
+    KstViewObjectPtr obj = viewObject(&win);
     
     if (mime->provides(PlotMimeSource::mimeType())) {
       if (obj && obj->isContainer()) {
@@ -172,9 +172,9 @@
     } else {     
       if (obj) {
         if (mime->provides("application/x-kst-curve-list")) {
-          if (dynamic_cast<Kst2DPlot*>(obj)) {
+          if (dynamic_cast<Kst2DPlot*>(obj.data())) {
             retVal = true;
-          } else if (dynamic_cast<KstViewLegend*>(obj)) {
+          } else if (dynamic_cast<KstViewLegend*>(obj.data())) {
             retVal = true;
           }
         }
@@ -207,7 +207,7 @@
     }
   } else if (rtti() == RTTI_OBJ_VIEW_OBJECT) {
     KstViewWindow *win;
-    KstViewObject *obj = viewObject(&win);
+    KstViewObjectPtr obj = viewObject(&win);
     
     if (win) {
       if (e->provides(PlotMimeSource::mimeType())) {
@@ -225,8 +225,8 @@
           accepted = true;
         }
       } else if (obj && e->provides("application/x-kst-curve-list")) {
-        Kst2DPlot* plot = dynamic_cast<Kst2DPlot*>(obj);
-        KstViewLegend* legend = dynamic_cast<KstViewLegend*>(obj);
+        Kst2DPlotPtr plot = dynamic_cast<Kst2DPlot*>(obj.data());
+        KstViewLegendPtr legend = dynamic_cast<KstViewLegend*>(obj.data());
         if (plot || legend) {
           KstBaseCurveList curves = kstObjectSubList<KstDataObject, KstBaseCurve>(KST::dataObjectList);
           QByteArray data = e->encodedData("application/x-kst-curve-list");
@@ -258,17 +258,17 @@
   e->accept(accepted);
 }
 
-KstDataObjectPtr KstViewObjectItem::dataObject(Kst2DPlot **plot) const {
+KstDataObjectPtr KstViewObjectItem::dataObject(Kst2DPlotPtr &plot) const {
   KstDataObjectPtr dataObj;
   
-  *plot = 0L;
+  plot = 0L;
   
   if (rtti() == RTTI_OBJ_VIEW_OBJECT) {
     KstViewWindow *win;
     KstViewObjectPtr viewObj = viewObject(&win);
     
     if (viewObj) {
-      *plot = dynamic_cast<Kst2DPlot*>(viewObj.data());
+      plot = dynamic_cast<Kst2DPlot*>(viewObj.data());
     }
   } else if (rtti() == RTTI_OBJ_DATA_OBJECT) {
     KstViewObjectItem *koi;
@@ -531,8 +531,8 @@
         obj->showDialog(win->view());  
       }
     } else if (qi->rtti() == RTTI_OBJ_DATA_OBJECT) {
-      Kst2DPlot *plot;
-      KstDataObjectPtr obj = koi->dataObject(&plot);
+      Kst2DPlotPtr plot;
+      KstDataObjectPtr obj = koi->dataObject(plot);
       if (obj) {
         obj->showDialog();  
       }
@@ -564,8 +564,8 @@
         }
       } else if (koi->rtti() == RTTI_OBJ_DATA_OBJECT) {
         KstViewWindow *win;
-        Kst2DPlot *plot;
-        KstDataObjectPtr obj = koi->dataObject(&plot);
+        Kst2DPlotPtr plot;
+        KstDataObjectPtr obj = koi->dataObject(plot);
         KstBaseCurvePtr curve = dynamic_cast<KstBaseCurve*>(obj.data());
         koi->viewObject(&win);
         if (curve && plot && win) {
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.h #540244:540245
@@ -48,7 +48,7 @@
 
     void update(KstViewObjectPtr x, bool recursive = true, int localUseCount = 0);
     const QString& tagName() const { return _name; }
-    KstDataObjectPtr dataObject(Kst2DPlot **plot) const;
+    KstDataObjectPtr dataObject(Kst2DPlotPtr &plot) const;
     KstViewObjectPtr viewObject(KstViewWindow **win) const;
     bool removable() const { return _removable; }
     void updateButtons();


More information about the Kst mailing list