1 /*************************************************************************** 2 * * 3 * copyright : (C) 2007 The University of Toronto * 4 * netterfield@astro.utoronto.ca * 5 * * 6 * This program is free software; you can redistribute it and/or modify * 7 * it under the terms of the GNU General Public License as published by * 8 * the Free Software Foundation; either version 2 of the License, or * 9 * (at your option) any later version. * 10 * * 11 ***************************************************************************/ 12 13 #include "viewmatrixdialog.h" 14 15 #include "document.h" 16 #include "matrixmodel.h" 17 18 #include <datacollection.h> 19 20 namespace Kst { 21 ViewMatrixDialog(QWidget * parent,Document * doc)22ViewMatrixDialog::ViewMatrixDialog(QWidget *parent, Document *doc) 23 : QDialog(parent), _doc(doc) { 24 _model = 0; 25 setupUi(this); 26 27 connect(matrixSelector, SIGNAL(selectionChanged()), this, SLOT(matrixSelected())); 28 matrixSelector->setObjectStore(doc->objectStore()); 29 30 setAttribute(Qt::WA_DeleteOnClose); 31 } 32 33 ~ViewMatrixDialog()34ViewMatrixDialog::~ViewMatrixDialog() { 35 delete _model; 36 _model = 0; 37 } 38 39 show()40void ViewMatrixDialog::show() { 41 matrixSelector->updateMatrices(); 42 matrixSelected(); 43 QDialog::show(); 44 } 45 46 matrixSelected()47void ViewMatrixDialog::matrixSelected() { 48 if (_model) { 49 delete _model; 50 _model = 0; 51 } 52 53 MatrixPtr m = matrixSelector->selectedMatrix(); 54 if (m) { 55 _model = new MatrixModel(matrixSelector->selectedMatrix()); 56 _matrices->setModel(_model); 57 } 58 } 59 60 61 62 } 63 64 // vim: ts=2 sw=2 et 65