GeopsyGui/RingEditor.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GeopsyGui.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2005-09-13
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef RINGEDITOR_H
00029 #define RINGEDITOR_H
00030 
00031 #include <SciFigs.h>
00032 
00033 #include "ui_RingEditor.h"
00034 #include "GeopsyGuiDLLExport.h"
00035 
00036 namespace GeopsyGui {
00037 
00038 #define RingEditor_MinCol 0
00039 #define RingEditor_MaxCol 1
00040 #define RingEditor_PairsNumCol 2
00041 #define RingEditor_ColorCol 3
00042 
00043 class ArrayMap;
00044 
00045 class RingEditorDelegate : public QItemDelegate
00046 {
00047   Q_OBJECT
00048 public:
00049   RingEditorDelegate(QObject *parent=0);
00050 
00051   QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
00052                         const QModelIndex &index) const;
00053   void setEditorData(QWidget *editor, const QModelIndex &index) const;
00054   void setModelData(QWidget *editor, QAbstractItemModel *model,
00055                       const QModelIndex &index) const;
00056 private slots:
00057   inline void commitSpin();
00058 };
00059 
00060 inline void RingEditorDelegate::commitSpin()
00061 {
00062   TRACE;
00063   DoubleSpinBox * w=qobject_cast<DoubleSpinBox *>(sender());
00064   if(w) emit commitData (w);
00065 }
00066 
00067 class GEOPSYGUI_EXPORT RingEditor : public QWidget, public Ui::RingEditor
00068 {
00069   Q_OBJECT
00070 public:
00071   RingEditor(QWidget* parent=0, Qt::WFlags fl=0);
00072   ~RingEditor();
00073 
00074   int countPairs(int ringIndex);
00075   int ringCount();
00076 public slots:
00077   void setCoArrayGraph(ArrayMap * w);
00078   void addBut_clicked();
00079   void removeBut_clicked();
00080   void on_rings_itemClicked(QTableWidgetItem * item);
00081   void on_rings_itemChanged(QTableWidgetItem * item);
00082   void updateCounts();
00083   void updateGraph();
00084   void loadBut_clicked();
00085   void load(QString fileName);
00086   void saveBut_clicked();
00087   void optimizeBut_clicked();
00088 private:
00089   void initRow(int row);
00090   CircleViewer * _circleLayer;
00091 };
00092 
00093 } // namespace GeopsyGui
00094 
00095 #endif // RINGEDITOR_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines