[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Jul 8 01:48:59 CEST 2008
SVN commit 829276 by netterfield:
-matrixSelector, scalarSelector and vectorSelector now can access the
name of newly created objects, and set themselves to view them
-move to icons only on toolbar (more compact!)
M +1 -0 images/images.qrc
M +7 -0 libkstapp/datadialog.cpp
M +2 -0 libkstapp/datadialog.h
M +4 -2 libkstapp/datamanager.cpp
M +4 -3 libkstapp/dialoglaunchergui.cpp
M +1 -1 libkstapp/dialoglaunchergui.h
M +3 -3 libkstapp/mainwindow.cpp
M +6 -2 libkstapp/matrixdialog.cpp
M +2 -2 libkstapp/matrixdialog.h
M +1 -7 libkstapp/scalardialog.cpp
M +0 -2 libkstapp/scalardialog.h
M +3 -8 libkstapp/vectordialog.cpp
M +0 -3 libkstapp/vectordialog.h
M +2 -1 libkstmath/dialoglauncher.cpp
M +1 -1 libkstmath/dialoglauncher.h
M +9 -2 widgets/matrixselector.cpp
M +0 -3 widgets/scalarselector.cpp
--- branches/work/kst/portto4/kst/src/images/images.qrc #829275:829276
@@ -27,6 +27,7 @@
<file>kst_error_1.png</file>
<file>kst_error_2.png</file>
<file>kst_eventnew.png</file>
+ <file>kst_gfx_label.png</file>
<file>kst_gfx_arrow.png</file>
<file>kst_gfx_ellipse.png</file>
<file>kst_gfx_line.png</file>
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.cpp #829275:829276
@@ -32,6 +32,8 @@
DataDialog::DataDialog(Kst::ObjectPtr dataObject, QWidget *parent)
: Dialog(parent), _defaultTagString("<Auto Name>"), _dataObject(dataObject), _modified(false) {
+ _dataObjectName = QString();
+
if (_dataObject)
_mode = Edit;
else
@@ -172,7 +174,12 @@
clearModified();
}
+QString DataDialog::dataObjectName() const {
+ return _dataObjectName;
+}
+
+
}
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.h #829275:829276
@@ -35,6 +35,7 @@
EditMode editMode() const { return _mode; }
void addDataTab(DataTab *tab);
+ QString dataObjectName() const;
protected:
virtual QString tagString() const;
@@ -49,6 +50,7 @@
Document *_document;
EditMultipleWidget *_editMultipleWidget;
+ QString _dataObjectName;
private Q_SLOTS:
void slotApply();
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #829275:829276
@@ -274,7 +274,8 @@
QString tmp;
DialogLauncher::self()->showVectorDialog(tmp, vector);
} else if (MatrixPtr matrix = kst_cast<Matrix>(_currentObject)) {
- DialogLauncher::self()->showMatrixDialog(matrix);
+ QString tmp;
+ DialogLauncher::self()->showMatrixDialog(tmp, matrix);
} else if (BasicPluginPtr plugin = kst_cast<BasicPlugin>(_currentObject)) {
DialogLauncher::self()->showBasicPluginDialog(plugin->pluginName(), plugin);
}
@@ -296,7 +297,8 @@
void DataManager::showMatrixDialog() {
- DialogLauncher::self()->showMatrixDialog();
+ QString tmp;
+ DialogLauncher::self()->showMatrixDialog(tmp);
_doc->session()->triggerReset();
}
--- branches/work/kst/portto4/kst/src/libkstapp/dialoglaunchergui.cpp #829275:829276
@@ -37,20 +37,21 @@
void DialogLauncherGui::showVectorDialog(QString &vectorname, ObjectPtr objectPtr) {
VectorDialog dialog(objectPtr, kstApp->mainWindow());
dialog.exec();
- vectorname = dialog.vectorName();
+ vectorname = dialog.dataObjectName();
}
-void DialogLauncherGui::showMatrixDialog(ObjectPtr objectPtr) {
+void DialogLauncherGui::showMatrixDialog(QString &matrixName, ObjectPtr objectPtr) {
MatrixDialog dialog(objectPtr, kstApp->mainWindow());
dialog.exec();
+ matrixName = dialog.dataObjectName();
}
void DialogLauncherGui::showScalarDialog(QString &scalarname, ObjectPtr objectPtr) {
ScalarDialog dialog(objectPtr, kstApp->mainWindow());
dialog.exec();
- scalarname = dialog.scalarName();
+ scalarname = dialog.dataObjectName();
}
--- branches/work/kst/portto4/kst/src/libkstapp/dialoglaunchergui.h #829275:829276
@@ -26,7 +26,7 @@
//primitives
virtual void showVectorDialog(QString &vectorname, ObjectPtr objectPtr = 0);
- virtual void showMatrixDialog(ObjectPtr objectPtr = 0);
+ virtual void showMatrixDialog(QString &matrixName, ObjectPtr objectPtr = 0);
virtual void showScalarDialog(QString &scalarname, ObjectPtr objectPtr = 0);
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #829275:829276
@@ -466,7 +466,7 @@
_createLabelAct = new QAction(tr("&Create label"), this);
_createLabelAct->setStatusTip(tr("Create a label for the current view"));
- _createLabelAct->setIcon(QPixmap(":kst_gfx_label.png"));
+ _createLabelAct->setIcon(QPixmap(":kst_gfx_label.png"));
_createLabelAct->setEnabled(false);
connect(_createLabelAct, SIGNAL(triggered()), this, SLOT(createLabel()));
@@ -712,7 +712,7 @@
void MainWindow::createToolBars() {
- setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+ setToolButtonStyle(Qt::ToolButtonIconOnly);
_dataToolBar = addToolBar(tr("Data"));
_dataToolBar->addAction(_dataManagerAct);
@@ -726,7 +726,7 @@
_viewToolBar->addAction(_layoutModeAct);
_layoutToolBar = new QToolBar(tr("Layout"), this);
-// _layoutToolBar->addAction(_createLabelAct); //no icon
+ _layoutToolBar->addAction(_createLabelAct); //no icon
_layoutToolBar->addAction(_createBoxAct);
_layoutToolBar->addAction(_createCircleAct);
_layoutToolBar->addAction(_createEllipseAct);
--- branches/work/kst/portto4/kst/src/libkstapp/matrixdialog.cpp #829275:829276
@@ -690,7 +690,7 @@
}
-ObjectPtr MatrixDialog::createNewDataMatrix() const {
+ObjectPtr MatrixDialog::createNewDataMatrix() {
const DataSourcePtr dataSource = _matrixTab->dataSource();
//FIXME better validation than this please...
@@ -747,11 +747,13 @@
setDataMatrixDefaults(matrix);
+ _dataObjectName = matrix->Name();
+
return static_cast<ObjectPtr>(matrix);
}
-ObjectPtr MatrixDialog::createNewGeneratedMatrix() const {
+ObjectPtr MatrixDialog::createNewGeneratedMatrix() {
const uint nX = _matrixTab->nX();
const uint nY = _matrixTab->nY();
const double minX = _matrixTab->minX();
@@ -784,6 +786,8 @@
matrix->update();
matrix->unlock();
+ _dataObjectName = matrix->Name();
+
return static_cast<ObjectPtr>(matrix);
}
--- branches/work/kst/portto4/kst/src/libkstapp/matrixdialog.h #829275:829276
@@ -166,8 +166,8 @@
virtual ObjectPtr editExistingDataObject() const;
private:
- ObjectPtr createNewDataMatrix() const;
- ObjectPtr createNewGeneratedMatrix() const;
+ ObjectPtr createNewDataMatrix();
+ ObjectPtr createNewGeneratedMatrix();
void configureTab(ObjectPtr vector);
private Q_SLOTS:
--- branches/work/kst/portto4/kst/src/libkstapp/scalardialog.cpp #829275:829276
@@ -50,8 +50,6 @@
ScalarDialog::ScalarDialog(ObjectPtr dataObject, QWidget *parent)
: DataDialog(dataObject, parent) {
- _scalarName = QString();
-
if (editMode() == Edit)
setWindowTitle(tr("Edit Scalar"));
else
@@ -118,7 +116,7 @@
scalar->update();
scalar->unlock();
- _scalarName = scalar->Name();
+ _dataObjectName = scalar->Name();
return static_cast<ObjectPtr>(scalar);
}
@@ -139,10 +137,6 @@
return dataObject();
}
-QString ScalarDialog::scalarName() const {
- return _scalarName;
}
-}
-
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/scalardialog.h #829275:829276
@@ -45,7 +45,6 @@
public:
ScalarDialog(ObjectPtr dataObject, QWidget *parent = 0);
virtual ~ScalarDialog();
- QString scalarName() const;
protected:
// virtual QString tagString() const;
@@ -60,7 +59,6 @@
private:
ScalarTab *_scalarTab;
- QString _scalarName;
};
}
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #829275:829276
@@ -262,8 +262,6 @@
VectorDialog::VectorDialog(ObjectPtr dataObject, QWidget *parent)
: DataDialog(dataObject, parent) {
- _vectorName = QString();
-
if (editMode() == Edit)
setWindowTitle(tr("Edit Vector"));
else
@@ -408,7 +406,7 @@
vector->update();
vector->unlock();
- _vectorName = vector->Name();
+ _dataObjectName = vector->Name();
return vector;
}
@@ -435,7 +433,7 @@
vector->setDescriptiveName(DataDialog::tagString().replace(defaultTagString(), QString()));
- _vectorName = vector->Name();
+ _dataObjectName = vector->Name();
// return static_cast<ObjectPtr>(vector);
return vector;
@@ -519,13 +517,10 @@
setGenVectorDefaults(generatedVector);
}
}
+
return dataObject();
}
-QString VectorDialog::vectorName() const {
- return _vectorName;
}
-}
-
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.h #829275:829276
@@ -95,8 +95,6 @@
VectorDialog(ObjectPtr dataObject, QWidget *parent = 0);
virtual ~VectorDialog();
- QString vectorName() const;
-
protected:
// virtual QString tagString() const;
virtual ObjectPtr createNewDataObject();
@@ -106,7 +104,6 @@
ObjectPtr createNewDataVector();
ObjectPtr createNewGeneratedVector();
void configureTab(ObjectPtr vector=0);
- QString _vectorName;
private Q_SLOTS:
void updateButtons();
--- branches/work/kst/portto4/kst/src/libkstmath/dialoglauncher.cpp #829275:829276
@@ -58,8 +58,9 @@
}
-void DialogLauncher::showMatrixDialog(ObjectPtr objectPtr) {
+void DialogLauncher::showMatrixDialog(QString &matrixName, ObjectPtr objectPtr) {
Q_UNUSED(objectPtr);
+ Q_UNUSED(matrixName);
}
--- branches/work/kst/portto4/kst/src/libkstmath/dialoglauncher.h #829275:829276
@@ -44,7 +44,7 @@
//primitives
virtual void showVectorDialog(QString &vectorname, ObjectPtr objectPtr = 0);
- virtual void showMatrixDialog(ObjectPtr objectPtr = 0);
+ virtual void showMatrixDialog(QString &matrixName, ObjectPtr objectPtr = 0);
virtual void showScalarDialog(QString &scalarname, ObjectPtr objectPtr = 0);
--- branches/work/kst/portto4/kst/src/widgets/matrixselector.cpp #829275:829276
@@ -76,13 +76,20 @@
void MatrixSelector::newMatrix() {
- DialogLauncher::self()->showMatrixDialog();
+ QString matrixName;
+ DialogLauncher::self()->showMatrixDialog(matrixName);
fillMatrices();
+ MatrixPtr matrix = kst_cast<Matrix>(_store->retrieveObject(matrixName));
+
+ if (matrix) {
+ setSelectedMatrix(matrix);
+ }
}
void MatrixSelector::editMatrix() {
- DialogLauncher::self()->showMatrixDialog(ObjectPtr(selectedMatrix()));
+ QString matrixName;
+ DialogLauncher::self()->showMatrixDialog(matrixName, ObjectPtr(selectedMatrix()));
}
--- branches/work/kst/portto4/kst/src/widgets/scalarselector.cpp #829275:829276
@@ -88,13 +88,10 @@
void ScalarSelector::newScalar() {
QString scalarName;
-
DialogLauncher::self()->showScalarDialog(scalarName);
fillScalars();
-
ScalarPtr scalar = kst_cast<Scalar>(_store->retrieveObject(scalarName));
-
if (scalar) {
setSelectedScalar(scalar);
emitSelectionChanged();
More information about the Kst
mailing list