[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Wed Jan 25 07:28:44 CET 2006
SVN commit 502177 by staikos:
another round of refactoring to fix linking. Needs to be reworked for 1.3
M +1 -2 Makefile.am
M +17 -31 curveplacementwidget.ui.h
M +56 -0 kstdatacollection-gui.cpp
M +6 -0 kstdatacollection-gui.h
M +26 -0 kstdatacollection.cpp
M +13 -0 kstdatacollection.h
--- trunk/extragear/graphics/kst/kst/Makefile.am #502176:502177
@@ -108,8 +108,7 @@
kstcombobox.cpp \
datarangewidget.ui
-libkstwidgets_la_LDFLAGS = -version-info @KST_LIBKST_VERSION@ $(all_libraries)
-#-no-undefined
+libkstwidgets_la_LDFLAGS = -version-info @KST_LIBKST_VERSION@ $(all_libraries) -no-undefined
libkstwidgets_la_LIBADD = $(LIB_KIO) libkstmath.la
--- trunk/extragear/graphics/kst/kst/curveplacementwidget.ui.h #502176:502177
@@ -49,25 +49,20 @@
void CurvePlacementWidget::newWindow()
{
- KstApp *app = KstApp::inst();
- app->slotFileNewWindow(this);
+ KstData::self()->newWindow(this);
update();
}
void CurvePlacementWidget::update()
{
- KstApp *app = KstApp::inst();
-
_plotWindow->clear();
- KMdiIterator<KMdiChildView*> *it = app->createIterator();
- while (it->currentItem()) {
- _plotWindow->insertItem(it->currentItem()->caption());
- it->next();
+ QStringList windows = KstData::self()->windowList();
+ for (QStringList::ConstIterator i = windows.begin(); i != windows.end(); ++i) {
+ _plotWindow->insertItem(*i);
}
- app->deleteIterator(it);
- KMdiChildView *c = app->activeWindow();
- if (c) {
- _plotWindow->setCurrentItem(c->caption());
+ QString cur = KstData::self()->currentWindow();
+ if (!cur.isEmpty()) {
+ _plotWindow->setCurrentItem(cur);
}
updatePlotList();
@@ -79,25 +74,19 @@
void CurvePlacementWidget::updatePlotList()
{
- KstApp *app = KstApp::inst();
- KMdiChildView *c = app->findWindow(_plotWindow->currentText());
-
QString old;
if (_plotList->count()) {
old = _plotList->currentText();
}
+ QStringList plots = KstData::self()->plotList(_plotWindow->currentText());
_plotList->clear();
- if (c) {
- Kst2DPlotList plots = static_cast<KstViewWindow*>(c)->view()->findChildrenType<Kst2DPlot>();
+ for (QStringList::ConstIterator i = plots.begin(); i != plots.end(); ++i) {
+ _plotList->insertItem(*i);
+ }
- for (Kst2DPlotList::ConstIterator i = plots.begin(); i != plots.end(); ++i) {
- _plotList->insertItem((*i)->tagName());
- }
-
- if (!old.isNull() && _plotList->count() > 0) {
- _plotList->setCurrentText(old);
- }
+ if (!old.isNull() && _plotList->count() > 0) {
+ _plotList->setCurrentText(old);
}
}
@@ -116,13 +105,10 @@
void CurvePlacementWidget::updateGrid()
{
- KstApp *app = KstApp::inst();
- KMdiChildView *c = app->findWindow(_plotWindow->currentText());
- KstViewWindow *w = dynamic_cast<KstViewWindow*>(c);
- if (w) {
- KstTopLevelViewPtr view = w->view();
- _reGrid->setChecked(view->onGrid());
- _plotColumns->setValue(view->columns());
+ int cols = KstData::self()->columns(_plotWindow->currentText());
+ _reGrid->setChecked(cols > -1);
+ if (cols > -1) {
+ _plotColumns->setValue(cols);
}
}
--- trunk/extragear/graphics/kst/kst/kstdatacollection-gui.cpp #502176:502177
@@ -29,6 +29,7 @@
#include "kst.h"
#include "kst2dplot.h"
#include "kstdatacollection-gui.h"
+#include "kstviewwindow.h"
KstGuiData::KstGuiData()
@@ -244,4 +245,59 @@
}
+QStringList KstGuiData::plotList(const QString& window) {
+ if (window.isEmpty()) {
+ return Kst2DPlot::globalPlotList().tagNames();
+ }
+
+ KstApp *app = KstApp::inst();
+ KMdiChildView *c = app->findWindow(window);
+ QStringList rc;
+ if (c) {
+ Kst2DPlotList plots = static_cast<KstViewWindow*>(c)->view()->findChildrenType<Kst2DPlot>();
+
+ for (Kst2DPlotList::ConstIterator i = plots.begin(); i != plots.end(); ++i) {
+ rc << (*i)->tagName();
+ }
+ }
+ return rc;
+}
+
+
+int KstGuiData::columns(const QString& window) {
+ KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(window));
+ if (w) {
+ KstTopLevelViewPtr view = w->view();
+ if (view->onGrid()) {
+ return view->columns();
+ }
+ }
+ return -1;
+}
+
+
+void KstGuiData::newWindow(QWidget *dialogParent) {
+ KstApp::inst()->slotFileNewWindow(dialogParent);
+}
+
+
+QStringList KstGuiData::windowList() {
+ QStringList rc;
+ KMdiIterator<KMdiChildView*> *it = KstApp::inst()->createIterator();
+ while (it->currentItem()) {
+ rc << it->currentItem()->caption();
+ it->next();
+ }
+ KstApp::inst()->deleteIterator(it);
+
+ return rc;
+}
+
+
+QString KstGuiData::currentWindow() {
+ KMdiChildView *c = KstApp::inst()->activeWindow();
+ return c ? c->caption() : QString::null;
+}
+
+
// vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstdatacollection-gui.h #502176:502177
@@ -35,6 +35,12 @@
/** Save a vector to a file */
int vectorToFile(KstVectorPtr v, QFile *f);
int vectorsToFile(const KstVectorList& l, QFile *f, bool interpolate);
+
+ QStringList plotList(const QString& window = QString::null);
+ int columns(const QString& window);
+ void newWindow(QWidget *dialogParent = 0L);
+ QStringList windowList();
+ QString currentWindow();
};
#endif
--- trunk/extragear/graphics/kst/kst/kstdatacollection.cpp #502176:502177
@@ -214,6 +214,12 @@
}
+QStringList KstData::plotList(const QString& window) {
+ Q_UNUSED(window)
+ return QStringList();
+}
+
+
void KstData::removeCurveFromPlots(KstBaseCurve *c) {
Q_UNUSED(c)
// meaningless in no GUI: no plots!
@@ -230,4 +236,24 @@
}
+int KstData::columns(const QString& window) {
+ Q_UNUSED(window)
+}
+
+
+void KstData::newWindow(QWidget *dialogParent) {
+ Q_UNUSED(dialogParent)
+}
+
+
+QStringList KstData::windowList() {
+ return QStringList();
+}
+
+
+QString KstData::currentWindow() {
+ return QString::null;
+}
+
+
// vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstdatacollection.h #502176:502177
@@ -51,6 +51,19 @@
/** Save a vector to a file */
virtual int vectorToFile(KstVectorPtr v, QFile *f);
virtual int vectorsToFile(const KstVectorList& l, QFile *f, bool interpolate);
+
+ /** The list of plots for the given window. Returns all plots if
+ the window is empty/null. */
+ virtual QStringList plotList(const QString& window = QString::null);
+ /** FIXME: move these to a new class in 1.3 */
+ /** Returns the number of columns in the given window. -1 if not on grid */
+ virtual int columns(const QString& window);
+ /** Triggers creation of a new window. */
+ virtual void newWindow(QWidget *dialogParent = 0L);
+ /** Returns the names of all windows. */
+ virtual QStringList windowList();
+ /** Returns the name of the current window. */
+ virtual QString currentWindow();
};
More information about the Kst
mailing list