[Kst] [Bug 130278] Optionally remember settings for view object creation

Andrew Walker arwalker at sumusltd.com
Wed Aug 29 01:33:01 CEST 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=130278         
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2007-08-29 01:32 -------
SVN commit 705936 by arwalker:

BUG:130278 Add set defaults and restore defaults button to the edit view object dialog. This allows the user to create session defaults for each of the view objects.

 M  +49 -3     editviewobjectdialog.ui  
 M  +27 -16    ksteditviewobjectdialog_i.cpp  
 M  +2 -0      ksteditviewobjectdialog_i.h  
 M  +1 -0      kstgfxellipsemousehandler.cpp  
 M  +2 -0      kstgfxmousehandler.h  
 M  +8 -0      ksttoplevelview.cpp  
 M  +6 -5      ksttoplevelview.h  
 M  +1 -1      kstviewellipse.cpp  


--- branches/work/kst/1.5/kst/src/libkstapp/editviewobjectdialog.ui #705935:705936
 @ -19,7 +19,7  @
         <property name="name">
             <cstring>unnamed</cstring>
         </property>
-        <widget class="EditMultipleWidget" row="0" column="1" rowspan="3" colspan="1">
+        <widget class="EditMultipleWidget" row="0" column="1" rowspan="4" colspan="1">
             <property name="name">
                 <cstring>_editMultipleWidget</cstring>
             </property>
 @ -76,7 +76,7  @
                 </widget>
             </hbox>
         </widget>
-        <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2">
+        <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2">
             <property name="name">
                 <cstring>layout6</cstring>
             </property>
 @ -167,10 +167,56  @
             <property name="sizeHint">
                 <size>
                     <width>41</width>
-                    <height>241</height>
+                    <height>210</height>
                 </size>
             </property>
         </spacer>
+        <widget class="QButtonGroup" row="3" column="0">
+            <property name="name">
+                <cstring>buttonGroup2</cstring>
+            </property>
+            <property name="title">
+                <string>Object defaults:</string>
+            </property>
+            <hbox>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <widget class="QPushButton">
+                    <property name="name">
+                        <cstring>_pushButtonSetDefaults</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Set</string>
+                    </property>
+                </widget>
+                <widget class="QPushButton">
+                    <property name="name">
+                        <cstring>_pushButtonRestoreDefaults</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Restore</string>
+                    </property>
+                </widget>
+                <spacer>
+                    <property name="name">
+                        <cstring>spacer4_2</cstring>
+                    </property>
+                    <property name="orientation">
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property name="sizeType">
+                        <enum>Expanding</enum>
+                    </property>
+                    <property name="sizeHint">
+                        <size>
+                            <width>181</width>
+                            <height>21</height>
+                        </size>
+                    </property>
+                </spacer>
+            </hbox>
+        </widget>
     </grid>
 </widget>
 <customwidgets>
--- branches/work/kst/1.5/kst/src/libkstapp/ksteditviewobjectdialog_i.cpp #705935:705936
 @ -47,6 +47,8  @
   connect(_apply, SIGNAL(clicked()), this, SLOT(applyClicked()));
   connect(_OK, SIGNAL(clicked()), this, SLOT(okClicked()));
   connect(_editMultiple, SIGNAL(clicked()), this, SLOT(toggleEditMultiple()));
+  connect(_pushButtonSetDefaults, SIGNAL(clicked()), this, SLOT(setDefaults()));
+  connect(_pushButtonRestoreDefaults, SIGNAL(clicked()), this, SLOT(restoreDefaults()));
 
   _grid = 0L;
   _viewObject = 0L;
 @ -103,11 +105,14  @
   if (_editMultipleMode) {
     _editMultipleWidget->hide();
     _editMultiple->setText(i18n("Edit Multiple >>"));
-
+    _pushButtonSetDefaults->setEnabled(true);
+    _pushButtonRestoreDefaults->setEnabled(true);
     updateWidgets();
   } else {
     _editMultipleWidget->show();
     _editMultiple->setText(i18n("Edit Multiple <<"));
+    _pushButtonSetDefaults->setEnabled(false);
+    _pushButtonRestoreDefaults->setEnabled(false);
 
     if (_customWidget) {
       if (_viewObject) {
 @ -467,20 +472,6  @
         viewObject->setProperty(propertyName.latin1(), (*iter)->property(widgetPropertyName.latin1()));
       }
     }
-
-#if 0
-    // Removed by George.  This is very strange.  Some dialogs have 10+
-    // properties, and when I change 8 of them, the next "new" object of the
-    // same type has all of these modified on me.  I have to go through and
-    // change them all back to what they were before.  I think this is too
-    // confusing and annoying.  We could add a sticky flag or something like
-    // that if this feature is really demanded.
-
-    // and then save this viewObject's properties as the default
-    if (_top) {
-      _top->saveDefaults(_viewObject);
-    }
-#endif
   }
 }
 
 @ -531,6 +522,26  @
 }
 
 
+void KstEditViewObjectDialogI::setDefaults() {
+  if (_top) {
+    KstViewObjectPtr viewObject = _viewObject->copyObjectQuietly(*_top, QString(""));
+    _top->removeChild(viewObject);
+
+    if (viewObject) {
+      applySettings(viewObject);
+      _top->saveDefaults(viewObject);
+    }
+  }
+}
+
+
+void KstEditViewObjectDialogI::restoreDefaults() {
+  if (_top) {
+    _top->restoreDefaults(_viewObject);
+  }
+}
+
+
 void KstEditViewObjectDialogI::applyClicked() {
   apply();
 }
 @ -544,4 +555,4  @
 
 
 #include "ksteditviewobjectdialog_i.moc"
-// vim: ts=2 sw=2 et
+
--- branches/work/kst/1.5/kst/src/libkstapp/ksteditviewobjectdialog_i.h #705935:705936
 @ -42,6 +42,8  @
     void showEditViewObjectDialog(KstViewObjectPtr viewObject, KstTopLevelViewPtr top);
     void setNew();
     void toggleEditMultiple();
+    void setDefaults();
+    void restoreDefaults();
 
   private:
     void updateWidgets();
--- branches/work/kst/1.5/kst/src/libkstapp/kstgfxellipsemousehandler.cpp #705935:705936
 @ -34,6 +34,7  @
   defaultEllipse->setBorderColor(Qt::black);
   defaultEllipse->setForegroundColor(Qt::white);
   _defaultObject = KstViewObjectPtr(defaultEllipse);
+  _currentDefaultObject = KstViewObjectPtr(defaultEllipse);
 }
 
 
--- branches/work/kst/1.5/kst/src/libkstapp/kstgfxmousehandler.h #705935:705936
 @ -39,12 +39,14  @
     virtual void cancelMouseOperations(KstTopLevelViewPtr view);
 
     void saveDefaults(KstViewObjectPtr obj);
+    void restoreDefaults();
 
   protected:
     // copy defaults to newObj
     void copyDefaults(KstViewObjectPtr newObj);
 
     KstViewObjectPtr _defaultObject;
+    KstViewObjectPtr _currentDefaultObject;
     QPoint _mouseOrigin;
     QRect _prevBand;
     bool _mouseMoved;
--- branches/work/kst/1.5/kst/src/libkstapp/ksttoplevelview.cpp #705935:705936
 @ -1847,6 +1847,14  @
 }
 
 
+void KstTopLevelView::restoreDefaults(KstViewObjectPtr object) {
+  KstGfxMouseHandler *handler = handlerForObject(object->type());
+  if (handler) {
+    handler->restoreDefaults();
+  }
+}
+
+
 bool KstTopLevelView::handleDoubleClick(const QPoint& pos, bool shift) {
   handlePress(pos, shift);
   if (_pressTarget) {
--- branches/work/kst/1.5/kst/src/libkstapp/ksttoplevelview.h #705935:705936
 @ -60,25 +60,26  @
     KstViewObjectList& selectionList() { return _selectionList; }
     KstViewObjectPtr pressTarget() const { return _pressTarget; }
     void clearPressTarget() { _pressTarget = 0L; }
-    
+
     template<class T> KstSharedPtr<T> createObject(const QString& name, bool doCleanup = true);
 
     bool mouseGrabbed() const { return _mouseGrabbed; }
     KstViewObjectPtr mouseGrabber() const { return _mouseGrabber; }
     bool grabMouse(KstViewObjectPtr me);
     void releaseMouse(KstViewObjectPtr me);
-    
+
     // save defaults for mouse mode from a given object
     void saveDefaults(KstViewObjectPtr object);
-  
+    void restoreDefaults(KstViewObjectPtr object);
+
     bool tiedZoomPrev(const QString& plotName);
     bool tiedZoomMode(int zoom, bool flag, double center, int mode, int modeExtra, const QString& plotName);
     bool tiedZoom(bool x, double xmin, double xmax, bool y, double ymin, double ymax, const QString& plotName);
 
   public slots:
     void cleanupDefault();
-    void cleanupCustom();      
-  
+    void cleanupCustom();
+
   private slots:
     void menuClosed();
     void condenseXAxis();
--- branches/work/kst/1.5/kst/src/libkstapp/kstviewellipse.cpp #705935:705936
 @ -44,7 +44,7  @
     if (!el.isNull()) {
       if (metaObject()->findProperty(el.tagName().latin1(), true) > -1) {
         setProperty(el.tagName().latin1(), QVariant(el.text()));  
-      }  
+      }
     }
     n = n.nextSibling();
   }


More information about the Kst mailing list