[Kst] branches/work/kst/portto4/kst/src
Mike Fenton
mike at staikos.net
Fri Oct 19 23:08:58 CEST 2007
SVN commit 727131 by fenton:
Add stub version of ImageDialog and implement Matrix Selector.
M +4 -4 libkstapp/datamanager.cpp
M +3 -1 libkstapp/dialoglaunchergui.cpp
A libkstapp/imagedialog.cpp [License: GPL (v2+)]
A libkstapp/imagedialog.h [License: GPL (v2+)]
A libkstapp/imagetab.ui
M +3 -0 libkstapp/libkstapp.pro
M +56 -2 widgets/matrixselector.cpp
M +7 -0 widgets/matrixselector.h
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #727130:727131
@@ -91,10 +91,10 @@
// connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showEventMonitorDialog()));
// _dataObjects->addAction(action);
//
-// action = new DataButtonAction(tr("Image"));
-// connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showImageDialog()));
-// _dataObjects->addAction(action);
-//
+ action = new DataButtonAction(tr("Image"));
+ connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showImageDialog()));
+ _dataObjects->addAction(action);
+
action = new DataButtonAction(tr("Spectrogram"));
connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showCSDDialog()));
_dataObjects->addAction(action);
--- branches/work/kst/portto4/kst/src/libkstapp/dialoglaunchergui.cpp #727130:727131
@@ -20,6 +20,7 @@
#include "matrixdialog.h"
#include "powerspectrumdialog.h"
#include "csddialog.h"
+#include "imagedialog.h"
namespace Kst {
@@ -61,7 +62,8 @@
void DialogLauncherGui::showImageDialog(ObjectPtr objectPtr) {
- Q_UNUSED(objectPtr);
+ ImageDialog dialog(objectPtr, kstApp->mainWindow());
+ dialog.exec();
}
--- branches/work/kst/portto4/kst/src/libkstapp/libkstapp.pro #727130:727131
@@ -53,6 +53,7 @@
gridlayouthelper.cpp \
gridtab.cpp \
histogramdialog.cpp \
+ imagedialog.cpp \
labelitem.cpp \
labelrenderer.cpp \
layoutboxitem.cpp \
@@ -122,6 +123,7 @@
gridlayouthelper.h \
gridtab.h \
histogramdialog.h \
+ imagedialog.h \
labelitem.h \
labelrenderer.h \
layoutboxitem.h \
@@ -171,6 +173,7 @@
generaltab.ui \
gridtab.ui \
histogramtab.ui \
+ imagetab.ui \
layouttab.ui \
matrixtab.ui \
powerspectrumtab.ui \
--- branches/work/kst/portto4/kst/src/widgets/matrixselector.cpp #727130:727131
@@ -11,6 +11,9 @@
#include "matrixselector.h"
+#include "dialoglauncher.h"
+#include "datacollection.h"
+
namespace Kst {
MatrixSelector::MatrixSelector(QWidget *parent)
@@ -25,6 +28,11 @@
_newMatrix->setFixedSize(size + 8, size + 8);
_editMatrix->setFixedSize(size + 8, size + 8);
+
+ fillMatrices();
+
+ connect(_newMatrix, SIGNAL(pressed()), this, SLOT(newMatrix()));
+ connect(_editMatrix, SIGNAL(pressed()), this, SLOT(editMatrix()));
}
@@ -33,14 +41,60 @@
MatrixPtr MatrixSelector::selectedMatrix() const {
- return 0;
+ return qVariantValue<Matrix*>(_matrix->itemData(_matrix->currentIndex()));
}
void MatrixSelector::setSelectedMatrix(MatrixPtr selectedMatrix) {
- Q_UNUSED(selectedMatrix);
+ int i = _matrix->findData(qVariantFromValue(selectedMatrix.data()));
+ Q_ASSERT(i != -1);
+ _matrix->setCurrentIndex(i);
}
+
+void MatrixSelector::newMatrix() {
+ DialogLauncher::self()->showMatrixDialog();
+ fillMatrices();
}
+
+void MatrixSelector::editMatrix() {
+ DialogLauncher::self()->showMatrixDialog(ObjectPtr(selectedMatrix()));
+}
+
+void MatrixSelector::fillMatrices() {
+ QHash<QString, MatrixPtr> matrices;
+
+ matrixList.lock().readLock();
+
+ MatrixList::ConstIterator it = matrixList.begin();
+ for (; it != matrixList.end(); ++it) {
+ MatrixPtr matrix = (*it);
+
+ matrix->readLock();
+ matrices.insert(matrix->tag().displayString(), matrix);
+ matrix->unlock();
+ }
+
+ matrixList.lock().unlock();
+
+ QStringList list = matrices.keys();
+
+ qSort(list);
+
+ MatrixPtr current = selectedMatrix();
+
+ _matrix->clear();
+ foreach (QString string, list) {
+ MatrixPtr m = matrices.value(string);
+ _matrix->addItem(string, qVariantFromValue(m.data()));
+ }
+
+ if (current)
+ setSelectedMatrix(current);
+}
+
+
+}
+
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/widgets/matrixselector.h #727130:727131
@@ -32,6 +32,13 @@
Q_SIGNALS:
void selectionChanged();
+
+ private Q_SLOTS:
+ void newMatrix();
+ void editMatrix();
+
+ private:
+ void fillMatrices();
};
}
More information about the Kst
mailing list