GeopsyGui/RelativePositions.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-20
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef RELATIVEPOSITIONS_H
00029 #define RELATIVEPOSITIONS_H
00030 
00031 #include <QGpCoreTools.h>
00032 #include <QGpGuiTools.h>
00033 #include "ui_RelativePositions.h"
00034 #include "GeopsyGuiDLLExport.h"
00035 
00036 namespace GeopsyGui {
00037 
00038 class GEOPSYGUI_EXPORT RelativePositionsDelegate : public QItemDelegate
00039 {
00040   Q_OBJECT
00041 public:
00042   RelativePositionsDelegate(QObject *parent=0);
00043 
00044   QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
00045                          const QModelIndex &index) const;
00046   void setEditorData(QWidget *editor, const QModelIndex &index) const;
00047   void setModelData(QWidget *editor, QAbstractItemModel *model,
00048                      const QModelIndex &index) const;
00049   void addStation(QString stationName) {_stationList << ("%1. "+ stationName).arg(_stationList.count()+1);}
00050   int indexOf(QString stationName) {return _stationList.indexOf(stationName);}
00051   QString stationAt(int i) {return _stationList.at(i);}
00052 private slots:
00053   inline void comboCommit();
00054 private:
00055   QStringList _stationList;
00056 };
00057 
00058 inline void RelativePositionsDelegate::comboCommit()
00059 {
00060   TRACE;
00061   QComboBox * w=qobject_cast<QComboBox *>(sender());
00062   if(w) emit commitData (w);
00063 }
00064 
00065 class GEOPSYGUI_EXPORT RelativePositions : public Dialog, public Ui::RelativePositions
00066 {
00067   Q_OBJECT
00068 
00069 public:
00070   RelativePositions(QWidget* parent=0, Qt::WFlags fl=0);
00071   ~RelativePositions();
00072 
00073 public slots:
00074   virtual void setStationList(const QList<NamedPoint> * stations);
00075   virtual void addBut_clicked();
00076   virtual void removeBut_clicked();
00077   virtual void updateCurrentDistAz(QTableWidgetItem * item);
00078   virtual void calculateAverage();
00079 
00080 protected:
00081   const QList<NamedPoint> * _stations;
00082 
00083 };
00084 
00085 } // namespace GeopsyGui
00086 
00087 #endif // RELATIVEPOSITIONS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines