[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Mon Mar 17 15:53:59 CET 2008
SVN commit 786650 by fenton:
Add TriggerReset to SessionModel to allow DataManager to update correctly.
M +63 -10 datamanager.cpp
M +9 -0 datamanager.h
M +0 -4 mainwindow.cpp
M +6 -0 sessionmodel.cpp
M +2 -0 sessionmodel.h
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #786649:786650
@@ -77,15 +77,15 @@
// Create canonical items...
QAction *action = new DataButtonAction(tr("Vector"));
- connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showVectorDialog()));
+ connect(action, SIGNAL(triggered()), this, SLOT(showVectorDialog()));
_primitives->addAction(action);
action = new DataButtonAction(tr("Matrix"));
- connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showMatrixDialog()));
+ connect(action, SIGNAL(triggered()), this, SLOT(showMatrixDialog()));
_primitives->addAction(action);
action = new DataButtonAction(tr("Scalar"));
- connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showScalarDialog()));
+ connect(action, SIGNAL(triggered()), this, SLOT(showScalarDialog()));
_primitives->addAction(action);
//
// action = new DataButtonAction(tr("String"));
@@ -93,31 +93,31 @@
// _primitives->addAction(action);
action = new DataButtonAction(tr("Curve"));
- connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showCurveDialog()));
+ connect(action, SIGNAL(triggered()), this, SLOT(showCurveDialog()));
_dataObjects->addAction(action);
action = new DataButtonAction(tr("Equation"));
- connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showEquationDialog()));
+ connect(action, SIGNAL(triggered()), this, SLOT(showEquationDialog()));
_dataObjects->addAction(action);
action = new DataButtonAction(tr("Histogram"));
- connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showHistogramDialog()));
+ connect(action, SIGNAL(triggered()), this, SLOT(showHistogramDialog()));
_dataObjects->addAction(action);
action = new DataButtonAction(tr("Power Spectrum"));
- connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showPowerSpectrumDialog()));
+ connect(action, SIGNAL(triggered()), this, SLOT(showPowerSpectrumDialog()));
_dataObjects->addAction(action);
action = new DataButtonAction(tr("Event Monitor"));
- connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showEventMonitorDialog()));
+ connect(action, SIGNAL(triggered()), this, SLOT(showEventMonitorDialog()));
_dataObjects->addAction(action);
action = new DataButtonAction(tr("Image"));
- connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showImageDialog()));
+ connect(action, SIGNAL(triggered()), this, SLOT(showImageDialog()));
_dataObjects->addAction(action);
action = new DataButtonAction(tr("Spectrogram"));
- connect(action, SIGNAL(triggered()), DialogLauncher::self(), SLOT(showCSDDialog()));
+ connect(action, SIGNAL(triggered()), this, SLOT(showCSDDialog()));
_dataObjects->addAction(action);
}
@@ -260,41 +260,93 @@
} else if (MatrixPtr matrix = kst_cast<Matrix>(_currentObject)) {
DialogLauncher::self()->showMatrixDialog(matrix);
}
+ _doc->session()->triggerReset();
}
+void DataManager::show() {
+ _doc->session()->triggerReset();
+ QDialog::show();
+}
+
+
+void DataManager::showVectorDialog() {
+ DialogLauncher::self()->showVectorDialog();
+ _doc->session()->triggerReset();
+}
+
+
+void DataManager::showMatrixDialog() {
+ DialogLauncher::self()->showMatrixDialog();
+ _doc->session()->triggerReset();
+}
+
+
+void DataManager::showScalarDialog() {
+ DialogLauncher::self()->showScalarDialog();
+ _doc->session()->triggerReset();
+}
+
+
+void DataManager::showEventMonitorDialog() {
+ DialogLauncher::self()->showEventMonitorDialog();
+ _doc->session()->triggerReset();
+}
+
+
+void DataManager::showEquationDialog() {
+ DialogLauncher::self()->showEquationDialog();
+ _doc->session()->triggerReset();
+}
+
+
void DataManager::showCurveDialog() {
if (VectorPtr vector = kst_cast<Vector>(_currentObject)) {
DialogLauncher::self()->showCurveDialog(0, vector);
+ } else {
+ DialogLauncher::self()->showCurveDialog();
}
+ _doc->session()->triggerReset();
}
void DataManager::showCSDDialog() {
if (VectorPtr vector = kst_cast<Vector>(_currentObject)) {
DialogLauncher::self()->showCSDDialog(0, vector);
+ } else {
+ DialogLauncher::self()->showCSDDialog();
}
+ _doc->session()->triggerReset();
}
void DataManager::showPowerSpectrumDialog() {
if (VectorPtr vector = kst_cast<Vector>(_currentObject)) {
DialogLauncher::self()->showPowerSpectrumDialog(0, vector);
+ } else {
+ DialogLauncher::self()->showPowerSpectrumDialog();
}
+ _doc->session()->triggerReset();
}
void DataManager::showHistogramDialog() {
if (VectorPtr vector = kst_cast<Vector>(_currentObject)) {
DialogLauncher::self()->showHistogramDialog(0, vector);
+ } else {
+ DialogLauncher::self()->showHistogramDialog();
}
+ _doc->session()->triggerReset();
}
void DataManager::showImageDialog() {
if (MatrixPtr matrix = kst_cast<Matrix>(_currentObject)) {
DialogLauncher::self()->showImageDialog(0, matrix);
+ } else {
+ DialogLauncher::self()->showImageDialog();
}
+ _doc->session()->triggerReset();
}
@@ -308,6 +360,7 @@
_doc->objectStore()->removeObject(primitive);
}
_currentObject = 0;
+ _doc->session()->triggerReset();
}
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.h #786649:786650
@@ -36,15 +36,24 @@
void showContextMenu(const QPoint &);
void showEditDialog();
void deleteObject();
+
+ void showVectorDialog();
+ void showMatrixDialog();
+ void showScalarDialog();
+
void showCurveDialog();
void showCSDDialog();
void showHistogramDialog();
void showPowerSpectrumDialog();
void showImageDialog();
+ void showEventMonitorDialog();
+ void showEquationDialog();
void addToPlot(QAction* action);
void removeFromPlot(QAction* action);
+ virtual void show();
+
private:
Document *_doc;
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #786649:786650
@@ -771,10 +771,6 @@
void MainWindow::showDataManager() {
- //FIXME Remove this force re-create of the DataManager when the session model is being reset.
- delete _dataManager;
- _dataManager = 0;
-
if (!_dataManager) {
_dataManager = new DataManager(this, _doc);
}
--- branches/work/kst/portto4/kst/src/libkstapp/sessionmodel.cpp #786649:786650
@@ -37,6 +37,11 @@
}
+void SessionModel::triggerReset() {
+ reset();
+}
+
+
const ObjectList<Object> SessionModel::generateObjectList() const {
ObjectList<Object> ol;
ObjectList<DataVector> dvol = _store->getObjects<DataVector>();
@@ -72,6 +77,7 @@
return ol;
}
+
int SessionModel::rowCount(const QModelIndex& parent) const {
Q_ASSERT(_store);
ObjectList<Object> dol = generateObjectList();
--- branches/work/kst/portto4/kst/src/libkstapp/sessionmodel.h #786649:786650
@@ -36,6 +36,8 @@
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
const ObjectList<Object> generateObjectList() const;
+ void triggerReset();
+
private:
QVariant dataObjectOutputData(DataObjectPtr parent, const QModelIndex& index) const;
QVariant vectorData(VectorPtr parent, const QModelIndex& index) const;
More information about the Kst
mailing list