[Kst] branches/work/kst/pluginify/kst/src
Adam Treat
treat at kde.org
Tue Sep 19 17:42:05 CEST 2006
SVN commit 586430 by treat:
* Fix typos, reset the dialog, refactor a bit
-This line, and those below, will be ignored--
M kst/src/libkstmath/kstbasicplugin.cpp
M kst/src/libkstapp/kstbasicdialog_i.h
M kst/src/libkstapp/basicdialogwidget.ui
M kst/src/libkstapp/kstbasicdialog_i.cpp
M +1 -1 libkstapp/basicdialogwidget.ui
M +50 -52 libkstapp/kstbasicdialog_i.cpp
M +6 -6 libkstapp/kstbasicdialog_i.h
M +6 -6 libkstmath/kstbasicplugin.cpp
--- branches/work/kst/pluginify/kst/src/libkstapp/basicdialogwidget.ui #586429:586430
@@ -38,7 +38,7 @@
</property>
<widget class="QFrame" row="0" column="0">
<property name="name">
- <cstring>_inputOutputFrame</cstring>
+ <cstring>_frame</cstring>
</property>
<property name="frameShape">
<enum>NoFrame</enum>
--- branches/work/kst/pluginify/kst/src/libkstapp/kstbasicdialog_i.cpp #586429:586430
@@ -55,7 +55,7 @@
connect(this, SIGNAL(modified()), KstApp::inst()->document(), SLOT(wasModified())); //FIXME this should be in KstDataDialog constructor...
_pluginName = QString::null;
- _inputOutputGrid = 0L;
+ _grid = 0L;
}
@@ -73,6 +73,16 @@
Q_ASSERT(ptr); //shouldn't happen
+ if (_grid) { //reset
+ QLayoutIterator it = _grid->iterator();
+ while(QLayoutItem *item = it.takeCurrent()) {
+ delete item->widget();
+ delete item;
+ }
+ delete _grid;
+ _grid = 0;
+ }
+
int cnt = 0;
int numInputOutputs = ptr->inputVectors().count()
+ ptr->inputScalars().count()
@@ -81,44 +91,38 @@
+ ptr->outputScalars().count()
+ ptr->outputStrings().count();
- _inputOutputGrid = new QGridLayout(_w->_inputOutputFrame, numInputOutputs + 1, 2, 0, 8);
- _inputOutputGrid->setColStretch(1,1);
- _inputOutputGrid->setColStretch(0,0);
+ _grid = new QGridLayout(_w->_frame, numInputOutputs + 1, 2, 0, 8);
+ _grid->setColStretch(1,1);
+ _grid->setColStretch(0,0);
//create input widgets
//First, the inputVectors...
QStringList iv = ptr->inputVectors();
QStringList::ConstIterator ivI = iv.begin();
for (; ivI != iv.end(); ++ivI) {
- createInputVector(*ivI,
- _w->_inputOutputFrame,
- _inputOutputGrid, ++cnt);
+ createInputVector(*ivI, ++cnt);
}
//Now, the inputScalars...
QStringList is = ptr->inputScalars();
QStringList::ConstIterator isI = is.begin();
for (; isI != is.end(); ++isI) {
- createInputScalar(*isI,
- _w->_inputOutputFrame,
- _inputOutputGrid, ++cnt);
+ createInputScalar(*isI, ++cnt);
}
//Finally, the inputStrings...
QStringList istr = ptr->inputStrings();
QStringList::ConstIterator istrI = istr.begin();
for (; istrI != istr.end(); ++istrI) {
- createInputString(*istrI,
- _w->_inputOutputFrame,
- _inputOutputGrid, ++cnt);
+ createInputString(*istrI, ++cnt);
}
//create sep
cnt++;
- QFrame* line = new QFrame(_w->_inputOutputFrame);
+ QFrame* line = new QFrame(_w->_frame);
line->setFrameShadow(QFrame::Sunken);
line->setFrameShape(QFrame::HLine);
- _inputOutputGrid->addMultiCellWidget(line, cnt, cnt, 0, 1);
+ _grid->addMultiCellWidget(line, cnt, cnt, 0, 1);
line->show();
cnt++;
@@ -127,83 +131,77 @@
QStringList ov = ptr->outputVectors();
QStringList::ConstIterator ovI = ov.begin();
for (; ovI != ov.end(); ++ovI) {
- createOutputWidget(*ovI,
- _w->_inputOutputFrame,
- _inputOutputGrid, ++cnt);
+ createOutputWidget(*ovI, ++cnt);
}
//output scalars...
QStringList os = ptr->outputScalars();
QStringList::ConstIterator osI = os.begin();
for (; osI != os.end(); ++osI) {
- createOutputWidget(*osI,
- _w->_inputOutputFrame,
- _inputOutputGrid, ++cnt);
+ createOutputWidget(*osI, ++cnt);
}
//ouput strings...
QStringList ostr = ptr->outputStrings();
QStringList::ConstIterator ostrI = ostr.begin();
for (; ostrI != ostr.end(); ++ostrI) {
- createOutputWidget(*ostrI,
- _w->_inputOutputFrame,
- _inputOutputGrid, ++cnt);
+ createOutputWidget(*ostrI, ++cnt);
}
}
-void KstBasicDialogI::createInputVector(const QString &name, QWidget *parent, QGridLayout *grid, int row) {
- QLabel *label = new QLabel(name, parent);
+void KstBasicDialogI::createInputVector(const QString &name, int row) {
+ QLabel *label = new QLabel(name, _w->_frame);
- VectorSelector *widget = new VectorSelector(parent,
+ VectorSelector *widget = new VectorSelector(_w->_frame,
name.latin1());
connect(widget, SIGNAL(newVectorCreated(const QString&)),
this, SIGNAL(modified()));
- grid->addWidget(label, row, 0);
+ _grid->addWidget(label, row, 0);
label->show();
- grid->addWidget(widget, row, 1);
+ _grid->addWidget(widget, row, 1);
widget->show();
}
-void KstBasicDialogI::createInputScalar(const QString &name, QWidget *parent, QGridLayout *grid, int row) {
- QLabel *label = new QLabel(name, parent);
+void KstBasicDialogI::createInputScalar(const QString &name, int row) {
+ QLabel *label = new QLabel(name, _w->_frame);
- ScalarSelector *widget = new ScalarSelector(parent,
+ ScalarSelector *widget = new ScalarSelector(_w->_frame,
name.latin1());
connect(widget, SIGNAL(newScalarCreated()),
this, SIGNAL(modified()));
widget->allowDirectEntry(true);
- grid->addWidget(label, row, 0);
+ _grid->addWidget(label, row, 0);
label->show();
- grid->addWidget(widget, row, 1);
+ _grid->addWidget(widget, row, 1);
widget->show();
}
-void KstBasicDialogI::createInputString(const QString &name, QWidget *parent, QGridLayout *grid, int row) {
- QLabel *label = new QLabel(name, parent);
+void KstBasicDialogI::createInputString(const QString &name, int row) {
+ QLabel *label = new QLabel(name, _w->_frame);
- StringSelector *widget = new StringSelector(parent,
+ StringSelector *widget = new StringSelector(_w->_frame,
name.latin1());
connect(widget, SIGNAL(newStringCreated()),
this, SIGNAL(modified()));
- grid->addWidget(label, row, 0);
+ _grid->addWidget(label, row, 0);
label->show();
- grid->addWidget(widget, row, 1);
+ _grid->addWidget(widget, row, 1);
widget->show();
}
-void KstBasicDialogI::createOutputWidget(const QString &name, QWidget *parent, QGridLayout *grid, int row) {
- QLabel *label = new QLabel(name, parent);
- QLineEdit *widget = new QLineEdit(parent, name.latin1());
- grid->addWidget(label, row, 0);
+void KstBasicDialogI::createOutputWidget(const QString &name, int row) {
+ QLabel *label = new QLabel(name, _w->_frame);
+ QLineEdit *widget = new QLineEdit(_w->_frame, name.latin1());
+ _grid->addWidget(label, row, 0);
label->show();
- grid->addWidget(widget, row, 1);
+ _grid->addWidget(widget, row, 1);
widget->show();
}
@@ -296,13 +294,13 @@
void KstBasicDialogI::showNew(const QString &field) {
- if (_pluginName != field) {
+// if (_pluginName != field) {
_pluginName = field;
KstDataDialog::showNew(field);
init();
- } else {
- KstDataDialog::showNew(field);
- }
+// } else {
+// KstDataDialog::showNew(field);
+// }
}
@@ -424,22 +422,22 @@
VectorSelector *KstBasicDialogI::vector(const QString &name) const {
- return ::qt_cast<VectorSelector*>(_w->_inputOutputFrame->child(name.latin1()));
+ return ::qt_cast<VectorSelector*>(_w->_frame->child(name.latin1()));
}
ScalarSelector *KstBasicDialogI::scalar(const QString &name) const {
- return ::qt_cast<ScalarSelector*>(_w->_inputOutputFrame->child(name.latin1()));
+ return ::qt_cast<ScalarSelector*>(_w->_frame->child(name.latin1()));
}
StringSelector *KstBasicDialogI::string(const QString &name) const {
- return ::qt_cast<StringSelector*>(_w->_inputOutputFrame->child(name.latin1()));
+ return ::qt_cast<StringSelector*>(_w->_frame->child(name.latin1()));
}
QLineEdit *KstBasicDialogI::output(const QString &name) const {
- return ::qt_cast<QLineEdit*>(_w->_inputOutputFrame->child(name.latin1()));
+ return ::qt_cast<QLineEdit*>(_w->_frame->child(name.latin1()));
}
#include "kstbasicdialog_i.moc"
--- branches/work/kst/pluginify/kst/src/libkstapp/kstbasicdialog_i.h #586429:586430
@@ -24,10 +24,10 @@
#include "kstdatadialog.h"
#include "kstbasicplugin.h"
+class QLineEdit;
class VectorSelector;
class ScalarSelector;
class StringSelector;
-class QLineEdit;
class BasicDialogWidget;
@@ -55,10 +55,10 @@
private:
bool editSingleObject(KstBasicPluginPtr ptr);
- void createInputVector(const QString &name, QWidget *parent, QGridLayout *grid, int row);
- void createInputScalar(const QString &name, QWidget *parent, QGridLayout *grid, int row);
- void createInputString(const QString &name, QWidget *parent, QGridLayout *grid, int row);
- void createOutputWidget(const QString &name, QWidget *parent, QGridLayout *grid, int row);
+ void createInputVector(const QString &name, int row);
+ void createInputScalar(const QString &name, int row);
+ void createInputString(const QString &name, int row);
+ void createOutputWidget(const QString &name, int row);
VectorSelector *vector(const QString &name) const;
ScalarSelector *scalar(const QString &name) const;
@@ -72,7 +72,7 @@
BasicDialogWidget *_w;
// layout items
- QGridLayout *_inputOutputGrid;
+ QGridLayout *_grid;
QValueList<QWidget*> _widgets;
};
--- branches/work/kst/pluginify/kst/src/libkstmath/kstbasicplugin.cpp #586429:586430
@@ -83,8 +83,8 @@
KstVectorPtr KstBasicPlugin::outputVector(const QString& vector) const {
- KstVectorMap::ConstIterator i = _inputVectors.find(vector);
- if (i != _inputVectors.end())
+ KstVectorMap::ConstIterator i = _outputVectors.find(vector);
+ if (i != _outputVectors.end())
return *i;
else
return 0;
@@ -92,8 +92,8 @@
KstScalarPtr KstBasicPlugin::outputScalar(const QString& scalar) const {
- KstScalarMap::ConstIterator i = _inputScalars.find(scalar);
- if (i != _inputScalars.end())
+ KstScalarMap::ConstIterator i = _outputScalars.find(scalar);
+ if (i != _outputScalars.end())
return *i;
else
return 0;
@@ -101,8 +101,8 @@
KstStringPtr KstBasicPlugin::outputString(const QString& string) const {
- KstStringMap::ConstIterator i = _inputStrings.find(string);
- if (i != _inputStrings.end())
+ KstStringMap::ConstIterator i = _outputStrings.find(string);
+ if (i != _outputStrings.end())
return *i;
else
return 0;
More information about the Kst
mailing list