[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Sun Oct 30 20:17:51 CET 2005
SVN commit 475850 by staikos:
add missing locking, use the dialog launcher
M +29 -4 dialoglauncher-gui.cpp
M +13 -0 dialoglauncher-nogui.cpp
M +5 -0 dialoglauncher.h
M +3 -1 vectorselector.ui
M +12 -9 vectorselector.ui.h
--- trunk/extragear/graphics/kst/kst/dialoglauncher-gui.cpp #475849:475850
@@ -17,13 +17,14 @@
#include "dialoglauncher.h"
#include "kstcsddialog_i.h"
+#include "kstcurvedialog_i.h"
#include "ksteqdialog_i.h"
#include "ksthsdialog_i.h"
#include "kstimagedialog_i.h"
#include "kstmatrixdialog_i.h"
#include "kstplugindialog_i.h"
#include "kstpsddialog_i.h"
-#include "kstcurvedialog_i.h"
+#include "kstvectordialog_i.h"
namespace KstDialogs {
void showHistogramDialog(const QString& name) {
@@ -40,25 +41,49 @@
KstEqDialogI::globalInstance()->show_Edit(name);
}
+
void showCSDDialog(const QString& name) {
KstCsdDialogI::globalInstance()->show_Edit(name);
}
+
void showPSDDialog(const QString& name) {
KstPsdDialogI::globalInstance()->show_Edit(name);
}
+ void newVectorDialog(QWidget *parent, const char *createdSlot, const char *selectedSlot, const char *updateSlot) {
+ KstVectorDialogI *ad = new KstVectorDialogI(parent, "vector dialog");
+ if (createdSlot) {
+ QObject::connect(ad, SIGNAL(vectorCreated(KstVectorPtr)), parent, createdSlot);
+ }
+ if (selectedSlot) {
+ QObject::connect(ad, SIGNAL(vectorCreated(KstVectorPtr)), parent, selectedSlot);
+ }
+ if (updateSlot) {
+ QObject::connect(ad, SIGNAL(modified()), parent, updateSlot);
+ }
+ ad->show_New();
+ ad->exec();
+ delete ad;
+ }
+
+
+ void showVectorDialog(const QString& name) {
+ KstVectorDialogI::globalInstance()->show_Edit(name);
+ }
+
+
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);
+ QObject::connect(ad, SIGNAL(matrixCreated(KstMatrixPtr)), parent, createdSlot);
}
if (selectedSlot) {
- connect(ad, SIGNAL(matrixCreated(KstMatrixPtr)), parent, selectedSlot);
+ QObject::connect(ad, SIGNAL(matrixCreated(KstMatrixPtr)), parent, selectedSlot);
}
if (updateSlot) {
- connect(ad, SIGNAL(modified()), parent, updateSlot);
+ QObject::connect(ad, SIGNAL(modified()), parent, updateSlot);
}
ad->show_New();
ad->exec();
--- trunk/extragear/graphics/kst/kst/dialoglauncher-nogui.cpp #475849:475850
@@ -43,6 +43,19 @@
}
+ void newVectorDialog(QWidget *parent, const char *createdSlot, const char *selectedSlot, const char *updateSlot) {
+ Q_UNUSED(parent)
+ Q_UNUSED(createdSlot)
+ Q_UNUSED(selectedSlot)
+ Q_UNUSED(updateSlot)
+ }
+
+
+ void showVectorDialog(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)
--- trunk/extragear/graphics/kst/kst/dialoglauncher.h #475849:475850
@@ -20,6 +20,8 @@
#include <qstring.h>
#include "kst_export.h"
+class QWidget;
+
namespace KstDialogs {
KST_EXPORT void showHistogramDialog(const QString& name);
@@ -37,6 +39,9 @@
KST_EXPORT void showImageDialog(const QString& name);
KST_EXPORT void showCurveDialog(const QString& name);
+
+ KST_EXPORT void newVectorDialog(QWidget *parent, const char *createdSlot = 0L, const char *selectedSlot = 0L, const char *updateSlot = 0L);
+ KST_EXPORT void showVectorDialog(const QString& name);
}
#endif
--- trunk/extragear/graphics/kst/kst/vectorselector.ui #475849:475850
@@ -112,7 +112,9 @@
</connections>
<includes>
<include location="local" impldecl="in declaration">kstdatacollection.h</include>
- <include location="local" impldecl="in implementation">kstvectordialog_i.h</include>
+ <include location="local" impldecl="in implementation">kstrvector.h</include>
+ <include location="local" impldecl="in implementation">kstsvector.h</include>
+ <include location="local" impldecl="in implementation">dialoglauncher.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 implementation">vectorselector.ui.h</include>
--- trunk/extragear/graphics/kst/kst/vectorselector.ui.h #475849:475850
@@ -46,14 +46,18 @@
_vector->insertItem(tr("<None>"));
}
QStringList vectors;
- for (KstVectorList::Iterator i = KST::vectorList.begin(); i != KST::vectorList.end(); ++i) {
+ KST::vectorList.lock().readLock();
+ for (KstVectorList::ConstIterator i = KST::vectorList.begin(); i != KST::vectorList.end(); ++i) {
+ (*i)->readLock();
if (!(*i)->isScalarList()){
vectors << (*i)->tagName();
if (!found && (*i)->tagName() == prev) {
found = true;
}
}
+ (*i)->readUnlock();
}
+ KST::vectorList.lock().readUnlock();
qHeapSort(vectors);
_vector->insertStringList(vectors);
if (found) {
@@ -66,13 +70,7 @@
void VectorSelector::createNewVector()
{
- KstVectorDialogI *vd = new KstVectorDialogI(this, "vector dialog");
- connect(vd, SIGNAL(vectorCreated(KstVectorPtr)), this, SLOT(newVectorCreated(KstVectorPtr)));
- connect(vd, SIGNAL(vectorCreated(KstVectorPtr)), this, SLOT(setSelection(KstVectorPtr)));
- connect(vd, SIGNAL(modified()), this, SLOT(update()));
- vd->show_New();
- vd->exec();
- delete vd;
+ KstDialogs::newVectorDialog(this, SLOT(newVectorCreated(KstVectorPtr)), SLOT(setSelection(KstVectorPtr)), SLOT(update()));
}
@@ -106,7 +104,9 @@
void VectorSelector::newVectorCreated( KstVectorPtr v )
{
+ v->readLock();
QString name = v->tagName();
+ v->readUnlock();
v = 0L; // deref
emit newVectorCreated(name);
}
@@ -114,7 +114,9 @@
void VectorSelector::setSelection( KstVectorPtr v )
{
+ v->readLock();
setSelection(v->tagName());
+ v->readUnlock();
}
@@ -129,9 +131,10 @@
void VectorSelector::editVector()
{
- KstVectorDialogI::globalInstance()->show_Edit(_vector->currentText());
+ KstDialogs::showVectorDialog(_vector->currentText());
}
+
void VectorSelector::setEdit( const QString& tag )
{
KST::vectorList.lock().readLock();
More information about the Kst
mailing list