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

Adam Treat treat at kde.org
Fri Sep 7 17:25:30 CEST 2007


SVN commit 709482 by treat:

* Add new base classes for all kst dialogs
  -Kst::Dialog
  -Kst::DialogPage
  -Kst::DialogTab
* Move fillandstroke and break it out into
individual tabs
* Modify ViewItemDialog to use the new classes


 A             libkstapp/dialog.cpp   [License: GPL (v2+)]
 A             libkstapp/dialog.h   [License: GPL (v2+)]
 A             libkstapp/dialog.ui  
 A             libkstapp/dialogpage.cpp   [License: GPL (v2+)]
 A             libkstapp/dialogpage.h   [License: GPL (v2+)]
 A             libkstapp/dialogpage.ui  
 A             libkstapp/dialogtab.cpp   [License: GPL (v2+)]
 A             libkstapp/dialogtab.h   [License: GPL (v2+)]
 A             libkstapp/fillandstroke.cpp   widgets/fillandstroke.cpp#707016 [License: GPL (v2+)]
 A             libkstapp/fillandstroke.h   widgets/fillandstroke.h#706444 [License: GPL (v2+)]
 A             libkstapp/fillandstroke.ui   widgets/fillandstroke.ui#706444
 A             libkstapp/filltab.cpp   [License: GPL (v2+)]
 A             libkstapp/filltab.h   [License: GPL (v2+)]
 A             libkstapp/filltab.ui  
 M  +14 -0     libkstapp/libkstapp.pro  
 A             libkstapp/stroketab.cpp   [License: GPL (v2+)]
 A             libkstapp/stroketab.h   [License: GPL (v2+)]
 A             libkstapp/stroketab.ui  
 M  +39 -33    libkstapp/viewitemdialog.cpp  
 M  +7 -4      libkstapp/viewitemdialog.h  
 D             widgets/fillandstroke.cpp  
 D             widgets/fillandstroke.h  
 D             widgets/fillandstroke.ui  
 M  +0 -1      widgets/kstwidgets.cpp  
 M  +0 -15     widgets/kstwidgets.h  
 M  +0 -4      widgets/widgets.pro  


--- branches/work/kst/portto4/kst/src/libkstapp/libkstapp.pro #709481:709482
@@ -26,9 +26,13 @@
     datamanager.cpp \
     debugdialog.cpp \
     debugnotifier.cpp \
+    dialog.cpp \
+    dialogpage.cpp \
+    dialogtab.cpp \
     document.cpp \
     ellipseitem.cpp \
     exportgraphicsdialog.cpp \
+    filltab.cpp \
     graphicsfactory.cpp \
     kstapplication.cpp \
     labelitem.cpp \
@@ -43,6 +47,7 @@
     qgetoptions.cpp \
     vectorcurverenderitem.cpp \
     sessionmodel.cpp \
+    stroketab.cpp \
     svgitem.cpp \
     tabwidget.cpp \
     vectoreditordialog.cpp \
@@ -64,9 +69,13 @@
     dataref.h \
     debugdialog.h \
     debugnotifier.h \
+    dialog.h \
+    dialogpage.h \
+    dialogtab.h \
     document.h \
     ellipseitem.h \
     exportgraphicsdialog.h \
+    filltab.h \
     graphicsfactory.h \
     kstapplication.h \
     labelitem.h \
@@ -82,6 +91,7 @@
     vectorcurverenderitem.h \
     sessionmodel.h \
     svgitem.h \
+    stroketab.h \
     tabwidget.h \
     vectoreditordialog.h \
     vectormodel.h \
@@ -96,8 +106,12 @@
 FORMS += \
     aboutdialog.ui \
     datamanager.ui \
+    dialog.ui \
+    dialogpage.ui \
     debugdialog.ui \
     exportgraphicsdialog.ui \
+    filltab.ui \
+    stroketab.ui \
     vectoreditordialog.ui \
     viewmanager.ui
 
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.cpp #709481:709482
@@ -12,8 +12,12 @@
 #include "viewitemdialog.h"
 
 #include "viewitem.h"
-#include "fillandstroke.h"
 
+#include "dialogpage.h"
+
+#include "filltab.h"
+#include "stroketab.h"
+
 #include <QPen>
 #include <QBrush>
 #include <QDebug>
@@ -37,20 +41,22 @@
 
 
 ViewItemDialog::ViewItemDialog(QWidget *parent)
-    : QDialog(parent) {
+    : Dialog(parent) {
 
-  setModal(false);
   setWindowTitle(tr("Edit View Item"));
 
-  _fillAndStroke = new FillAndStroke(this);
-  connect(_fillAndStroke, SIGNAL(fillChanged()), this, SLOT(fillChanged()));
-  connect(_fillAndStroke, SIGNAL(strokeChanged()), this, SLOT(strokeChanged()));
+  setModal(true);
 
-  QVBoxLayout *layout = new QVBoxLayout(this);
-  layout->setMargin(0);
-  layout->setSpacing(0);
-  layout->addWidget(_fillAndStroke);
-  setLayout(layout);
+  _fillTab = new FillTab(this);
+  _strokeTab = new StrokeTab(this);
+  connect(_fillTab, SIGNAL(changed()), this, SLOT(fillChanged()));
+  connect(_strokeTab, SIGNAL(changed()), this, SLOT(strokeChanged()));
+
+  DialogPage *page = new DialogPage(this);
+  page->setPageTitle(tr("Appearance"));
+  page->addDialogTab(_fillTab);
+  page->addDialogTab(_strokeTab);
+  addDialogPage(page);
 }
 
 
@@ -63,22 +69,22 @@
   setupFill();
   setupStroke();
 
-  QDialog::show();
-  QDialog::raise();
-  QDialog::activateWindow();
+  Dialog::show();
+  Dialog::raise();
+  Dialog::activateWindow();
 }
 
 void ViewItemDialog::setupFill() {
   Q_ASSERT(_item);
   QBrush b = _item->brush();
 
-  _fillAndStroke->setFillColor(b.color());
-  _fillAndStroke->setFillStyle(b.style());
+  _fillTab->setColor(b.color());
+  _fillTab->setStyle(b.style());
 
   //FIXME gradient editor is disabled for now as it is not ready
 #if 0
   if (const QGradient *gradient = b.gradient()) {
-    _fillAndStroke->setFillGradient(*gradient);
+    _fillTab->setGradient(*gradient);
   }
 #endif
 }
@@ -89,26 +95,26 @@
   QPen p = _item->pen();
   QBrush b = p.brush();
 
-  _fillAndStroke->setStrokeStyle(p.style());
-  _fillAndStroke->setStrokeWidth(p.widthF());
+  _strokeTab->setStyle(p.style());
+  _strokeTab->setWidth(p.widthF());
 
-  _fillAndStroke->setBrushColor(b.color());
-  _fillAndStroke->setBrushStyle(b.style());
+  _strokeTab->setBrushColor(b.color());
+  _strokeTab->setBrushStyle(b.style());
 
-  _fillAndStroke->setJoinStyle(p.joinStyle());
-  _fillAndStroke->setCapStyle(p.capStyle());
+  _strokeTab->setJoinStyle(p.joinStyle());
+  _strokeTab->setCapStyle(p.capStyle());
 }
 
 
 void ViewItemDialog::fillChanged() {
   QBrush b = _item->brush();
 
-  b.setColor(_fillAndStroke->fillColor());
-  b.setStyle(_fillAndStroke->fillStyle());
+  b.setColor(_fillTab->color());
+  b.setStyle(_fillTab->style());
 
   //FIXME gradient editor is disabled for now as it is not ready
 #if 0
-  QGradient gradient = _fillAndStroke->fillGradient();
+  QGradient gradient = _fillTab->gradient();
   if (gradient.type() != QGradient::NoGradient)
     b = QBrush(gradient);
 #endif
@@ -123,14 +129,14 @@
   QPen p = _item->pen();
   QBrush b = p.brush();
 
-  p.setStyle(_fillAndStroke->strokeStyle());
-  p.setWidthF(_fillAndStroke->strokeWidth());
+  p.setStyle(_strokeTab->style());
+  p.setWidthF(_strokeTab->width());
 
-  b.setColor(_fillAndStroke->brushColor());
-  b.setStyle(_fillAndStroke->brushStyle());
+  b.setColor(_strokeTab->brushColor());
+  b.setStyle(_strokeTab->brushStyle());
 
-  p.setJoinStyle(_fillAndStroke->joinStyle());
-  p.setCapStyle(_fillAndStroke->capStyle());
+  p.setJoinStyle(_strokeTab->joinStyle());
+  p.setCapStyle(_strokeTab->capStyle());
   p.setBrush(b);
 
   _item->setPen(p);
@@ -141,7 +147,7 @@
   if (visible && !_item)
     return; //nothing to show...
 
-  QDialog::setVisible(visible);
+  Dialog::setVisible(visible);
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.h #709481:709482
@@ -12,7 +12,8 @@
 #ifndef VIEWITEMDIALOG_H
 #define VIEWITEMDIALOG_H
 
-#include <QDialog>
+#include "dialog.h"
+
 #include <QPointer>
 
 #include "kst_export.h"
@@ -20,9 +21,10 @@
 namespace Kst {
 
 class ViewItem;
-class FillAndStroke;
+class FillTab;
+class StrokeTab;
 
-class KST_EXPORT ViewItemDialog : public QDialog
+class KST_EXPORT ViewItemDialog : public Dialog
 {
   Q_OBJECT
 public:
@@ -46,7 +48,8 @@
 
 private:
   QPointer<ViewItem> _item;
-  FillAndStroke *_fillAndStroke;
+  FillTab *_fillTab;
+  StrokeTab *_strokeTab;
 };
 
 }
--- branches/work/kst/portto4/kst/src/widgets/kstwidgets.cpp #709481:709482
@@ -14,7 +14,6 @@
 KstWidgets::KstWidgets(QObject *parent)
     : QObject(parent) {
   _plugins.append(new ColorButtonPlugin(this));
-  _plugins.append(new FillAndStrokePlugin(this));
   _plugins.append(new GradientEditorPlugin(this));
 }
 
--- branches/work/kst/portto4/kst/src/widgets/kstwidgets.h #709481:709482
@@ -82,21 +82,6 @@
 };
 
 
-#include "fillandstroke.h"
-class FillAndStrokePlugin : public KstWidgetPlugin {
-  Q_OBJECT
-  Q_INTERFACES(QDesignerCustomWidgetInterface)
-public:
-  FillAndStrokePlugin(QObject *parent = 0) : KstWidgetPlugin(parent) {}
-  QString name() const {
-    return QLatin1String("Kst::FillAndStroke");
-  } //do not translate
-  QWidget *createWidget(QWidget *parent) {
-    return new Kst::FillAndStroke(parent);
-  }
-};
-
-
 #include "gradienteditor.h"
 class GradientEditorPlugin : public KstWidgetPlugin {
   Q_OBJECT
--- branches/work/kst/portto4/kst/src/widgets/widgets.pro #709481:709482
@@ -22,13 +22,9 @@
 SOURCES += \
     kstwidgets.cpp \
     colorbutton.cpp \
-    fillandstroke.cpp \
     gradienteditor.cpp
 
 HEADERS += \
     colorbutton.h \
     gradienteditor.h \
-    fillandstroke.h \
     kstwidgets.h
-
-FORMS += fillandstroke.ui


More information about the Kst mailing list