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

George Staikos staikos at kde.org
Fri Apr 21 15:29:41 CEST 2006


SVN commit 532182 by staikos:

- disable sorting on the plot vectors
- items are appended to the list
- add a checkbox to reorder column-wise

I'm not going to do drag and drop reorder right now.  It's more of a distraction
from important things than anything else.
BUG: 125871
BUG: 125873


 M  +18 -2     datawizard.ui  
 M  +37 -5     datawizard.ui.h  


--- trunk/extragear/graphics/kst/src/libkstapp/datawizard.ui #532181:532182
@@ -425,7 +425,7 @@
                             <enum>AutoOneFit</enum>
                         </property>
                         <property name="selectionMode">
-                            <enum>Extended</enum>
+                            <enum>QListView::Extended</enum>
                         </property>
                         <property name="showSortIndicator">
                             <bool>true</bool>
@@ -515,7 +515,7 @@
                             <enum>AutoOneFit</enum>
                         </property>
                         <property name="selectionMode">
-                            <enum>Extended</enum>
+                            <enum>QListView::Extended</enum>
                         </property>
                         <property name="showSortIndicator">
                             <bool>true</bool>
@@ -933,6 +933,14 @@
                             </widget>
                         </hbox>
                     </widget>
+                    <widget class="QCheckBox">
+                        <property name="name">
+                            <cstring>_orderInColumns</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Order in columns</string>
+                        </property>
+                    </widget>
                 </vbox>
             </widget>
             <widget class="QButtonGroup" row="0" column="1" rowspan="2" colspan="1">
@@ -1515,6 +1523,12 @@
         <receiver>DataWizard</receiver>
         <slot>vectorsDroppedBack(QDropEvent*)</slot>
     </connection>
+    <connection>
+        <sender>_vectorsToPlot</sender>
+        <signal>dropped(QDropEvent*)</signal>
+        <receiver>DataWizard</receiver>
+        <slot>updateVectorPageButtons()</slot>
+    </connection>
 </connections>
 <tabstops>
     <tabstop>_url</tabstop>
@@ -1599,6 +1613,7 @@
     <include location="local" impldecl="in implementation">datarangewidget.h</include>
     <include location="global" impldecl="in implementation">kurlcompletion.h</include>
     <include location="global" impldecl="in implementation">kdebug.h</include>
+    <include location="global" impldecl="in implementation">vectorlistview.h</include>
     <include location="local" impldecl="in implementation">datawizard.ui.h</include>
 </includes>
 <variables>
@@ -1636,6 +1651,7 @@
     <slot access="private">configureSource()</slot>
     <slot access="private">up()</slot>
     <slot access="private">down()</slot>
+    <slot access="private">updateVectorPageButtons()</slot>
     <slot access="private">add()</slot>
     <slot access="private">remove()</slot>
     <slot access="private">clear()</slot>
--- trunk/extragear/graphics/kst/src/libkstapp/datawizard.ui.h #532181:532182
@@ -34,6 +34,7 @@
     _vectorsToPlot->setAcceptDrops(true);
     _vectors->addColumn(i18n("Position"));
     _vectors->setSorting(1);
+    _vectorsToPlot->setSorting(-1);
 
     // No help button
     setHelpEnabled(_pageDataSource, false);
@@ -727,6 +728,23 @@
 	    }
 	}
     }
+
+    // Reorder the vectors if the user wants it
+    if (_orderInColumns) {
+	const KstVectorList lOld = l;
+	const int count = lOld.count();
+	const int cols = signed(sqrt(plots.count()));
+	int row = 0, col = 0;
+	for (int i = 0; i < count; ++i) {
+	    l[row * cols + col] = lOld[i];
+	    ++row;
+	    if (row >= cols) {
+		++col;
+		row = 0;
+	    }
+	}
+    }
+
     // create the data curves
     app->slotUpdateProgress(n_steps, prg, i18n("Creating curves..."));
     KstViewObjectList::Iterator pit = plots.begin();
@@ -1038,6 +1056,8 @@
     cfg.writeEntry("CycleThrough", _cycleThrough->isChecked());
     cfg.writeEntry("CycleExisting", _cycleExisting->isChecked());
     cfg.writeEntry("PlotNumber", _plotNumber->value());
+
+    cfg.writeEntry("OrderInColumns", _orderInColumns->isChecked());
 }
 
 
@@ -1104,6 +1124,7 @@
     _cycleThrough->setChecked(cfg.readBoolEntry("CycleThrough", false));
     _cycleExisting->setChecked(cfg.readBoolEntry("CycleExisting", false));
     _plotNumber->setValue(cfg.readNumEntry("PlotNumber", 2));
+    _orderInColumns->setChecked(cfg.readBoolEntry("OrderInColumns", false));
 }
 
 
@@ -1190,6 +1211,12 @@
 }
 
 
+void DataWizard::updateVectorPageButtons()
+{
+    setNextEnabled(_pageVectors, yVectorsOk());
+}
+
+
 void DataWizard::add()
 {
     QPtrList<QListViewItem> lst;
@@ -1202,11 +1229,15 @@
 	++it;
     }
 
+    QListViewItem *last = _vectorsToPlot->lastItem();
     QPtrListIterator<QListViewItem> iter(lst);
     while (iter.current()) {
-	_vectors->takeItem(iter.current());
-	_vectorsToPlot->insertItem(iter.current());
-	iter.current()->setSelected(false);
+	QListViewItem *item = iter.current();
+	_vectors->takeItem(item);
+	_vectorsToPlot->insertItem(item);
+	item->moveItem(last);
+	item->setSelected(false);
+	last = item;
 	++iter;
     }
 
@@ -1214,7 +1245,7 @@
     if (_vectors->currentItem()) {
 	_vectors->currentItem()->setSelected(true);
     }
-    setNextEnabled(_pageVectors, yVectorsOk());
+    updateVectorPageButtons();
 }
 
 
@@ -1242,7 +1273,7 @@
     if (_vectorsToPlot->currentItem()) {
 	_vectorsToPlot->currentItem()->setSelected(true);
     }
-    setNextEnabled(_pageVectors, yVectorsOk());
+    updateVectorPageButtons();
 
     vectorsDroppedBack(0L); // abuse
 }
@@ -1261,6 +1292,7 @@
 	++it;
     }
     _vectors->sort();
+    updateVectorPageButtons();
 }
 
 // vim: ts=8 sw=4 noet


More information about the Kst mailing list