[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Sun Oct 30 20:00:23 CET 2005
SVN commit 475837 by staikos:
- add locking (untested, but completely missing!)
- use the dialog launcher
- remove dependency between matrix selector and dialog
M +17 -0 dialoglauncher-gui.cpp
M +10 -0 dialoglauncher-nogui.cpp
M +1 -0 dialoglauncher.h
M +1 -1 matrixselector.ui
M +18 -14 matrixselector.ui.h
--- trunk/extragear/graphics/kst/kst/dialoglauncher-gui.cpp #475836:475837
@@ -49,6 +49,23 @@
}
+ void newMatrixDialog(QWidget *parent, const char *createdSlot, const char *selectedSlot, const char *updateSlot) {
+ KstMatrixDialogI *ad = new KstMatrixDialogI(parent, "matrix dialog");
+ if (createdSlot) {
+ connect(ad, SIGNAL(matrixCreated(KstMatrixPtr)), parent, createdSlot);
+ }
+ if (selectedSlot) {
+ connect(ad, SIGNAL(matrixCreated(KstMatrixPtr)), parent, selectedSlot);
+ }
+ if (updateSlot) {
+ connect(ad, SIGNAL(modified()), parent, updateSlot);
+ }
+ ad->show_New();
+ ad->exec();
+ delete ad;
+ }
+
+
void showMatrixDialog(const QString& name) {
KstMatrixDialogI::globalInstance()->show_Edit(name);
}
--- trunk/extragear/graphics/kst/kst/dialoglauncher-nogui.cpp #475836:475837
@@ -32,15 +32,25 @@
Q_UNUSED(name)
}
+
void showCSDDialog(const QString& name) {
Q_UNUSED(name)
}
+
void showPSDDialog(const QString& name) {
Q_UNUSED(name)
}
+ void newMatrixDialog(QWidget *parent, const char *createdSlot, const char *selectedSlot, const char *updateSlot) {
+ Q_UNUSED(parent)
+ Q_UNUSED(createdSlot)
+ Q_UNUSED(selectedSlot)
+ Q_UNUSED(updateSlot)
+ }
+
+
void showMatrixDialog(const QString& name) {
Q_UNUSED(name)
}
--- trunk/extragear/graphics/kst/kst/dialoglauncher.h #475836:475837
@@ -31,6 +31,7 @@
KST_EXPORT void showPSDDialog(const QString& name);
+ KST_EXPORT void newMatrixDialog(QWidget *parent, const char *createdSlot = 0L, const char *selectedSlot = 0L, const char *updateSlot = 0L);
KST_EXPORT void showMatrixDialog(const QString& name);
KST_EXPORT void showImageDialog(const QString& name);
--- trunk/extragear/graphics/kst/kst/matrixselector.ui #475836:475837
@@ -105,11 +105,11 @@
</connection>
</connections>
<includes>
- <include location="local" impldecl="in implementation">kstmatrixdialog_i.h</include>
<include location="global" impldecl="in implementation">qlistbox.h</include>
<include location="global" impldecl="in implementation">qtimer.h</include>
<include location="local" impldecl="in declaration">kstdatacollection.h</include>
<include location="local" impldecl="in declaration">kstmatrix.h</include>
+ <include location="local" impldecl="in implementation">dialoglauncher.h</include>
<include location="local" impldecl="in implementation">matrixselector.ui.h</include>
</includes>
<variables>
--- trunk/extragear/graphics/kst/kst/matrixselector.ui.h #475836:475837
@@ -39,12 +39,17 @@
}
KstMatrixList matrices = KST::matrixList;
- for (KstMatrixList::Iterator i = matrices.begin(); i != matrices.end(); ++i) {
- _matrix->insertItem((*i)->tagName());
- if (!found && (*i)->tagName() == prev) {
+ KST::matrixList.lock().readLock();
+ for (KstMatrixList::ConstIterator i = matrices.begin(); i != matrices.end(); ++i) {
+ (*i)->readLock();
+ QString tag = (*i)->tagName();
+ (*i)->readUnlock();
+ _matrix->insertItem(tag);
+ if (!found && tag == prev) {
found = true;
}
}
+ KST::matrixList.lock().readUnlock();
if (found) {
_matrix->setCurrentText(prev);
}
@@ -63,19 +68,13 @@
void MatrixSelector::createNewMatrix()
{
- KstMatrixDialogI *ad = new KstMatrixDialogI(this, "matrix dialog");
- connect(ad, SIGNAL(matrixCreated(KstMatrixPtr)), this, SLOT(newMatrixCreated(KstMatrixPtr)));
- connect(ad, SIGNAL(matrixCreated(KstMatrixPtr)), this, SLOT(setSelection(KstMatrixPtr)));
- connect(ad, SIGNAL(modified()), this, SLOT(update()));
- ad->show_New();
- ad->exec();
- delete ad;
+ KstDialogs::newMatrixDialog(this, SLOT(newMatrixCreated(KstMatrixPtr)), SLOT(setSelection(KstMatrixPtr)), SLOT(update()));
}
void MatrixSelector::selectionWatcher( const QString & tag )
{
- QString label = "["+tag+"]";
+ QString label = "[" + tag + "]";
emit selectionChangedLabel(label);
setEdit(tag);
}
@@ -102,7 +101,9 @@
void MatrixSelector::newMatrixCreated( KstMatrixPtr v )
{
+ v->readLock();
QString name = v->tagName();
+ v->readUnlock();
v = 0L; // deref
emit newMatrixCreated(name);
}
@@ -110,7 +111,9 @@
void MatrixSelector::setSelection( KstMatrixPtr v )
{
+ v->readLock();
setSelection(v->tagName());
+ v->readUnlock();
}
@@ -125,14 +128,15 @@
void MatrixSelector::editMatrix()
{
- KstMatrixDialogI::globalInstance()->show_Edit(_matrix->currentText());
+ KstDialogs::showMatrixDialog(_matrix->currentText());
}
void MatrixSelector::setEdit(const QString& tag)
{
- KstMatrixList matrices = KST::matrixList;;
- _editMatrix->setEnabled(matrices.findTag(tag) != matrices.end());
+ KST::matrixList.lock().readLock();
+ _editMatrix->setEnabled(KST::matrixList.findTag(tag) != KST::matrixList.end());
+ KST::matrixList.lock().readUnlock();
}
// vim: ts=8 sw=4 noet
More information about the Kst
mailing list