[Kst] branches/work/kst/portto4/kst/src/libkstapp

George Staikos staikos at kde.org
Mon May 28 18:19:20 CEST 2007


SVN commit 669142 by staikos:

completely refactor, start namespacing.  more to come.


 M  +3 -1      CMakeLists.txt  
 M  +2 -0      kstmainwindow.cpp  
 M  +15 -13    kstplotcommands.cpp  
 M  +21 -20    kstplotcommands.h  
 D             kstplotitems.cpp  
 D             kstplotitems.h  
 M  +1 -1      kstplotview.cpp  
 M  +5 -3      kstplotview.h  
 A             labelitem.cpp   kstplotitems.cpp#668589 [License: GPL (v2+)]
 A             labelitem.h   kstplotitems.h#668589 [License: GPL (v2+)]
 A             lineitem.cpp   kstplotitems.cpp#668589 [License: GPL (v2+)]
 A             lineitem.h   kstplotitems.h#668589 [License: GPL (v2+)]
 A             viewitem.cpp   kstplotitems.cpp#668589 [License: GPL (v2+)]
 A             viewitem.h   kstplotitems.h#668589 [License: GPL (v2+)]


--- branches/work/kst/portto4/kst/src/libkstapp/CMakeLists.txt #669141:669142
@@ -4,7 +4,9 @@
    kstapplication.cpp
    kstmainwindow.cpp
    kstplotview.cpp
-   kstplotitems.cpp
+   viewitem.cpp
+   lineitem.cpp
+   labelitem.cpp
    kstplotcommands.cpp
    )
 
--- branches/work/kst/portto4/kst/src/libkstapp/kstmainwindow.cpp #669141:669142
@@ -17,6 +17,8 @@
 
 #include <QtGui>
 
+using namespace Kst;
+
 KstMainWindow::KstMainWindow() {
 
   _tabWidget = new QTabWidget(this);
--- branches/work/kst/portto4/kst/src/libkstapp/kstplotcommands.cpp #669141:669142
@@ -12,21 +12,24 @@
 #include "kstplotcommands.h"
 #include "kstapplication.h"
 #include "kstplotview.h"
-#include "kstplotitems.h"
+#include "viewitem.h"
+#include "labelitem.h"
+#include "lineitem.h"
 
 #include <QDebug>
+#include <QGraphicsItem>
+#include <QGraphicsScene>
 #include <QObject>
-#include <QGraphicsScene>
 
-KstPlotViewCommand::KstPlotViewCommand(const QString &text,
-                                       bool addToStack, QUndoCommand *parent)
+namespace Kst {
+ViewCommand::ViewCommand(const QString &text, bool addToStack, QUndoCommand *parent)
     : QUndoCommand(text, parent), _view(kstApp->mainWindow()->currentPlotView()) {
   if (addToStack)
     _view->undoStack()->push(this);
 }
 
 
-KstPlotViewCommand::KstPlotViewCommand(KstPlotView *view, const QString &text,
+ViewCommand::ViewCommand(KstPlotView *view, const QString &text,
                                        bool addToStack, QUndoCommand *parent)
     : QUndoCommand(text, parent), _view(view) {
   if (addToStack)
@@ -34,37 +37,35 @@
 }
 
 
-KstPlotViewCommand::~KstPlotViewCommand() {
+ViewCommand::~ViewCommand() {
 }
 
 
-KstPlotItemCommand::KstPlotItemCommand(const QString &text,
-                                       bool addToStack, QUndoCommand *parent)
+ViewItemCommand::ViewItemCommand(const QString &text, bool addToStack, QUndoCommand *parent)
     : QUndoCommand(text, parent), _item(kstApp->mainWindow()->currentPlotView()->currentPlotItem()) {
   if (addToStack)
     _item->parentView()->undoStack()->push(this);
 }
 
 
-KstPlotItemCommand::KstPlotItemCommand(KstPlotItem *item, const QString &text,
-                                       bool addToStack, QUndoCommand *parent)
+ViewItemCommand::ViewItemCommand(ViewItem *item, const QString &text, bool addToStack, QUndoCommand *parent)
     : QUndoCommand(text, parent), _item(item) {
   if (addToStack)
     _item->parentView()->undoStack()->push(this);
 }
 
 
-KstPlotItemCommand::~KstPlotItemCommand() {
+ViewItemCommand::~ViewItemCommand() {
 }
 
 
 CreateCommand::CreateCommand(const QString &text, QUndoCommand *parent)
-    : KstPlotViewCommand(text, false, parent) {
+    : ViewCommand(text, false, parent) {
 }
 
 
 CreateCommand::CreateCommand(KstPlotView *view, const QString &text, QUndoCommand *parent)
-    : KstPlotViewCommand(view, text, false, parent) {
+    : ViewCommand(view, text, false, parent) {
 }
 
 
@@ -121,6 +122,7 @@
   _item->graphicsItem()->setPos(_newPos);
 }
 
+}
 
 #include "kstplotcommands.moc"
 
--- branches/work/kst/portto4/kst/src/libkstapp/kstplotcommands.h #669141:669142
@@ -20,35 +20,34 @@
 #include "kst_export.h"
 
 class KstPlotView;
-class KstPlotItem;
 
-class KST_EXPORT KstPlotViewCommand : public QUndoCommand
+namespace Kst {
+
+class ViewItem;
+
+class KST_EXPORT ViewCommand : public QUndoCommand
 {
 public:
-  KstPlotViewCommand(const QString &text,
-                     bool addToStack = true, QUndoCommand *parent = 0);
-  KstPlotViewCommand(KstPlotView *view, const QString &text,
-                     bool addToStack = true, QUndoCommand *parent = 0);
-  virtual ~KstPlotViewCommand();
+  ViewCommand(const QString &text, bool addToStack = true, QUndoCommand *parent = 0);
+  ViewCommand(KstPlotView *view, const QString &text, bool addToStack = true, QUndoCommand *parent = 0);
+  virtual ~ViewCommand();
 
 protected:
   QPointer<KstPlotView> _view;
 };
 
-class KST_EXPORT KstPlotItemCommand : public QUndoCommand
+class KST_EXPORT ViewItemCommand : public QUndoCommand
 {
 public:
-  KstPlotItemCommand(const QString &text,
-                     bool addToStack = true, QUndoCommand *parent = 0);
-  KstPlotItemCommand(KstPlotItem *item, const QString &text,
-                     bool addToStack = true, QUndoCommand *parent = 0);
-  virtual ~KstPlotItemCommand();
+  ViewItemCommand(const QString &text, bool addToStack = true, QUndoCommand *parent = 0);
+  ViewItemCommand(ViewItem *item, const QString &text, bool addToStack = true, QUndoCommand *parent = 0);
+  virtual ~ViewItemCommand();
 
 protected:
-  QPointer<KstPlotItem> _item;
+  QPointer<ViewItem> _item;
 };
 
-class KST_EXPORT CreateCommand : public QObject, public KstPlotViewCommand
+class KST_EXPORT CreateCommand : public QObject, public ViewCommand
 {
   Q_OBJECT
 public:
@@ -64,7 +63,7 @@
   void creationComplete();
 
 protected:
-  QPointer<KstPlotItem> _item;
+  QPointer<ViewItem> _item;
 };
 
 class KST_EXPORT CreateLabelCommand : public CreateCommand
@@ -85,15 +84,15 @@
   virtual void createItem();
 };
 
-class KST_EXPORT MoveCommand : public KstPlotItemCommand
+class KST_EXPORT MoveCommand : public ViewItemCommand
 {
 public:
   MoveCommand(QPointF originalPos, QPointF newPos)
-      : KstPlotItemCommand(QObject::tr("Move Object")),
+      : ViewItemCommand(QObject::tr("Move Object")),
         _originalPos(originalPos),
         _newPos(newPos) {}
-  MoveCommand(KstPlotItem *item, QPointF originalPos, QPointF newPos)
-      : KstPlotItemCommand(item, QObject::tr("Move Object")),
+  MoveCommand(ViewItem *item, QPointF originalPos, QPointF newPos)
+      : ViewItemCommand(item, QObject::tr("Move Object")),
         _originalPos(originalPos),
         _newPos(newPos) {}
 
@@ -117,6 +116,8 @@
   PLOT
 */
 
+}
+
 #endif
 
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/kstplotview.cpp #669141:669142
@@ -41,7 +41,7 @@
 }
 
 
-KstPlotItem *KstPlotView::currentPlotItem() const {
+Kst::ViewItem *KstPlotView::currentPlotItem() const {
   return _currentPlotItem;
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/kstplotview.h #669141:669142
@@ -17,7 +17,9 @@
 #include "kst_export.h"
 
 class QUndoStack;
-class KstPlotItem;
+namespace Kst {
+  class ViewItem;
+}
 
 class KST_EXPORT KstPlotView : public QGraphicsView
 {
@@ -35,7 +37,7 @@
   virtual ~KstPlotView();
 
   QUndoStack *undoStack() const;
-  KstPlotItem* currentPlotItem() const;
+  Kst::ViewItem* currentPlotItem() const;
 
   MouseMode mouseMode() const;
   void setMouseMode(MouseMode mode);
@@ -56,7 +58,7 @@
 
 private:
   QUndoStack *_undoStack;
-  KstPlotItem *_currentPlotItem;
+  Kst::ViewItem *_currentPlotItem;
   MouseMode _mouseMode;
   QPolygonF _creationPolygonPress;
   QPolygonF _creationPolygonMove;


More information about the Kst mailing list