[Kst] branches/work/kst/kst1kde4/kst/src
Andrew Walker
arwalker at sumusltd.com
Wed May 5 02:21:44 CEST 2010
SVN commit 1122904 by arwalker:
continue kst1kde4
M +0 -2 libkst/kstdatasource.cpp
M +14 -5 libkst/kstobject.h
M +13 -20 libkstapp/ksttoplevelview.cpp
M +34 -22 libkstapp/kstviewobject.cpp
M +3 -3 libkstapp/kstviewwindow.cpp
M +0 -2 libkstapp/kstviewwindow.h
--- branches/work/kst/kst1kde4/kst/src/libkst/kstdatasource.cpp #1122903:1122904
@@ -17,8 +17,6 @@
#include "kstdatasource.h"
-#include <assert.h>
-
#include <q3deepcopy.h>
#include <QFile>
#include <QFileInfo>
--- branches/work/kst/kst1kde4/kst/src/libkst/kstobject.h #1122903:1122904
@@ -274,8 +274,8 @@
return QLinkedList<T>::end();
}
- virtual typename QLinkedList<T>::ConstIterator findTag(const QString& x) const {
- for (typename QLinkedList<T>::ConstIterator it = QLinkedList<T>::begin(); it != QLinkedList<T>::end(); ++it) {
+ virtual typename QLinkedList<T>::const_iterator findTag(const QString& x) const {
+ for (typename QLinkedList<T>::const_iterator it = QLinkedList<T>::begin(); it != QLinkedList<T>::end(); ++it) {
if (*(*it) == x) {
return it;
}
@@ -283,9 +283,18 @@
return QLinkedList<T>::end();
}
+ virtual typename QLinkedList<T>::iterator findChild(T& x) {
+ for (typename QLinkedList<T>::iterator it = QLinkedList<T>::begin(); it != QLinkedList<T>::end(); ++it) {
+ if (*it == x) {
+ return it;
+ }
+ }
+ return QLinkedList<T>::end();
+ }
+
virtual int findIndexTag(const QString& x) const {
int i = 0;
- for (typename QLinkedList<T>::ConstIterator it = QLinkedList<T>::begin(); it != QLinkedList<T>::end(); ++it) {
+ for (typename QLinkedList<T>::const_iterator it = QLinkedList<T>::begin(); it != QLinkedList<T>::end(); ++it) {
if (*(*it) == x) {
return i;
}
@@ -294,8 +303,8 @@
return -1;
}
- virtual typename QLinkedList<T>::Iterator removeTag(const QString& x) {
- typename QLinkedList<T>::Iterator it = findTag(x);
+ virtual typename QLinkedList<T>::iterator removeTag(const QString& x) {
+ typename QLinkedList<T>::iterator it = findTag(x);
if (it != QLinkedList<T>::end()) {
return QLinkedList<T>::erase(it);
}
--- branches/work/kst/kst1kde4/kst/src/libkstapp/ksttoplevelview.cpp #1122903:1122904
@@ -435,21 +435,16 @@
_pressDirection = _pressTarget->directionFor(pos);
if (shift && _pressDirection < 1) {
- KstViewObjectList::iterator it;
-
-// xxx it = _selectionList.find(_pressTarget);
-
if (_pressTarget->isSelected()) {
_pressTarget->setSelected(false);
- if (it != _selectionList.end()) {
-// xxx _selectionList.remove(it);
- }
+ _selectionList.removeAll(_pressTarget);
} else {
_pressTarget->setSelected(true);
- if (it == _selectionList.end()) {
-// xxx _selectionList.append(_pressTarget);
+ if (!_selectionList.contains(_pressTarget)) {
+ _selectionList.append(_pressTarget);
}
}
+
_pressTarget = 0L;
_pressDirection = -1;
_moveOffset = QPoint(-1, -1);
@@ -619,8 +614,7 @@
KstViewObjectList::const_iterator i;
for (i = obj->children().begin(); i != obj->children().end(); ++i) {
-/* xxx
- if (_selectionList.find(*i) == _selectionList.end() && _pressTarget != *i) {
+ if (!_selectionList.contains(*i) && _pressTarget != *i) {
const QRect rect((*i)->geometry());
moveSnapToBorders(xMin, yMin, *i, r);
@@ -654,7 +648,6 @@
}
}
}
-*/
}
}
@@ -1504,22 +1497,22 @@
if (geom.top() - geomItem.bottom() == 1) {
geom = geom.unite(geomItem);
plotsProcess.append(*i);
-// xxx plots.remove(*i);
+ plots.removeAll(*i);
added = true;
break;
} else if (geomItem.top() - geom.bottom() == 1) {
plotsProcess.prepend(*i);
-// xxx plots.remove(*i);
+ plots.removeAll(*i);
added = true;
break;
} else if (fabs(aspect.y - (aspectItem.y + aspectItem.h)) < close) {
plotsProcess.append(*i);
-// xxx plots.remove(*i);
+ plots.removeAll(*i);
added = true;
break;
} else if (fabs(aspectItem.y - (aspect.y + aspect.h)) < close) {
plotsProcess.prepend(*i);
-// xxx plots.remove(*i);
+ plots.removeAll(*i);
added = true;
break;
}
@@ -1609,22 +1602,22 @@
(fabs(aspectItem.y - aspect.y) < close && fabs(aspectItem.h - aspect.h) < close)) {
if (geom.left() - geomItem.right() == 1) {
plotsProcess.append(*i);
-// xxx plots.remove(*i);
+ plots.removeAll(*i);
added = true;
break;
} else if (geomItem.left() - geom.right() == 1) {
plotsProcess.prepend(*i);
-// xxx plots.remove(*i);
+ plots.removeAll(*i);
added = true;
break;
} else if (fabs(aspect.x - (aspectItem.x + aspectItem.w)) < close) {
plotsProcess.append(*i);
-// xxx plots.remove(*i);
+ plots.removeAll(*i);
added = true;
break;
} else if (fabs(aspectItem.x - (aspect.x + aspect.w)) < close) {
plotsProcess.prepend(*i);
-// xxx plots.remove(*i);
+ plots.removeAll(*i);
added = true;
break;
}
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kstviewobject.cpp #1122903:1122904
@@ -1602,6 +1602,7 @@
if (_parent->_children.contains(obj)) {
_parent->_children.removeAll(obj);
_parent->_children.append(obj);
+
KstApp::inst()->document()->setModified();
setDirty();
}
@@ -1617,6 +1618,7 @@
if (_parent->_children.contains(obj)) {
_parent->_children.removeAll(obj);
_parent->_children.prepend(obj);
+
KstApp::inst()->document()->setModified();
setDirty();
}
@@ -1627,51 +1629,60 @@
void KstViewObject::raise() {
if (_parent) {
KstViewObjectPtr obj;
-/* xxx
+ KstViewObjectList::iterator it;
+
obj = this;
- if (_parent->_children.contains(obj)) {
- it = _parent->_children.remove(it);
+ it = _parent->_children.findChild(obj);
+
+ if (it != _parent->_children.end()) {
+ it = _parent->_children.erase(it);
+ if (it != _parent->_children.end()) {
++it;
+ }
if (it != _parent->_children.end()) {
- _parent->_children.insert(it, t);
+ _parent->_children.insert(it, obj);
} else {
- _parent->_children.append(t);
+ _parent->_children.append(obj);
}
+
KstApp::inst()->document()->setModified();
setDirty();
}
-*/
}
}
void KstViewObject::lower() {
if (_parent) {
-/* xxx
- KstViewObjectPtr t = this;
- KstViewObjectList::iterator it = _parent->_children.find(t);
+ KstViewObjectPtr obj;
+ KstViewObjectList::iterator it;
+ obj = this;
+ it = _parent->_children.findChild(obj);
+
if (it != _parent->_children.end()) {
- it = _parent->_children.remove(it);
+ it = _parent->_children.erase(it);
if (!_parent->_children.isEmpty() && it != _parent->_children.begin()) {
--it;
- _parent->_children.insert(it, t);
+ _parent->_children.insert(it, obj);
} else {
- _parent->_children.prepend(t);
+ _parent->_children.prepend(obj);
}
+
KstApp::inst()->document()->setModified();
setDirty();
}
-*/
}
}
void KstViewObject::remove() {
- KstApp::inst()->document()->setModified();
- KstViewObjectPtr vop(this);
+ KstViewObjectPtr vop;
KstViewObjectPtr tlp;
+ KstApp::inst()->document()->setModified();
+
+ vop = this;
tlp = topLevelParent();
if (tlp) {
KstTopLevelViewPtr tlv;
@@ -1694,7 +1705,7 @@
removeChild(_children.first());
}
- vop = 0L; // basically "delete this;"
+ vop = 0L; // deref
QTimer::singleShot(0, KstApp::inst(), SLOT(updateDialogs()));
}
@@ -1714,11 +1725,11 @@
KstViewObjectList::iterator it;
t = this;
-// xxx it = _parent->_children.find(t);
+ it = _parent->_children.findChild(t);
if (it != _parent->_children.end()) {
KstApp::inst()->document()->setModified();
setDirty();
-// xxx _parent->_children.remove(it);
+ _parent->_children.erase(it);
viewWindow->view()->appendChild(t, true);
viewWindow->view()->paint(KstPainter::P_PAINT);
}
@@ -1745,7 +1756,6 @@
void KstViewObject::updateFromAspect() {
- // FIXME: also take into account the maximum minimum child size in our children
setMinimumSize(minimumSize().expandedTo(QSize(_children.count(), _children.count())));
const QRect myOldGeom(_geom);
@@ -1840,6 +1850,8 @@
void KstViewObject::zoomToggle() {
+ KstViewObjectList::iterator it;
+
if (_maximized) {
_maximized = false;
_aspect = _aspectOldZoomedObject;
@@ -1859,7 +1871,7 @@
setOnGrid(false);
}
- for (KstViewObjectList::Iterator it = _children.begin(); it != _children.end(); ++it) {
+ for (it = _children.begin(); it != _children.end(); ++it) {
(*it)->parentResized();
}
setDirty();
@@ -1870,7 +1882,7 @@
bool has = (this->*method)();
if (has) {
-// xxx list.append(this);
+ list.append(KstViewObjectPtr(this));
}
if (!has || (has && matchRecurse)) {
@@ -1885,7 +1897,7 @@
void KstViewObject::detach() {
if (_parent) {
-// xxx _parent->removeChild(this);
+ _parent->removeChild(KstViewObjectPtr(this));
_parent = 0L;
}
}
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kstviewwindow.cpp #1122903:1122904
@@ -84,11 +84,11 @@
void KstViewWindow::commonConstructor() {
-// xxx config = kapp->config();
+ config = new QSettings();
-// xxx connect(this, SIGNAL(focusInEventOccurs( QMdiSubWindow*)), this, SLOT(slotActivated(QMdiSubWindow*)));
+ connect(this, SIGNAL(focusInEventOccurs( QMdiSubWindow*)), this, SLOT(slotActivated(QMdiSubWindow*)));
-// xxx QTimer::singleShot(0, this, SLOT(updateActions()));
+ QTimer::singleShot(0, this, SLOT(updateActions()));
// xxx QVBoxLayout *vb = new QVBoxLayout(this);
// xxx vb->setAutoAdd(true);
--- branches/work/kst/kst1kde4/kst/src/libkstapp/kstviewwindow.h #1122903:1122904
@@ -18,8 +18,6 @@
#ifndef KSTVIEWWINDOW_H
#define KSTVIEWWINDOW_H
-#include <config.h>
-
#include "kst.h"
#include "kstdatacollection.h"
#include "kstdefaultnames.h"
More information about the Kst
mailing list