GeopsyGui/ToolBase.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 : 2004-09-02
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (ULg, Liège, Belgium)
00025 **    Marc Wathelet (LGIT, Grenoble, France)
00026 **
00027 ***************************************************************************/
00028 
00029 #ifndef TOOLBASE_H
00030 #define TOOLBASE_H
00031 
00032 #include <QtGui>
00033 #include <GeopsyCore.h>
00034 
00035 #include "GeopsyGuiDLLExport.h"
00036 
00037 namespace GeopsyGui {
00038 
00039 class SignalLayer;
00040 class PickLayer;
00041 class TimeWindowLayer;
00042 class SubPoolWindow;
00043 class GeopsyGuiInterface;
00044 
00045 class GEOPSYGUI_EXPORT ToolBase : public QWidget
00046 {
00047   Q_OBJECT
00048 public:
00049   ToolBase(QWidget * parent, int nChildren);
00050   ~ToolBase();
00051 
00052   void setSubPoolParent(SubPoolWindow * subPoolParent) {_subPoolParent=subPoolParent;}
00053   void setLayers(SignalLayer * sl, PickLayer * pl, TimeWindowLayer * wl);
00054   virtual bool initStations(SubSignalPool * ) {return false;}
00055   virtual void closeChildren();
00056   virtual void restoreFields();
00057   virtual void refreshSignal(Signal * ) {}
00058   virtual void updateAllFields() {}
00059   virtual void paintTimeWindows(QPainter& , Signal* , double , int , int ,
00060                                  double , double) {}
00061   virtual void setParameters(int&, char **);
00062   virtual void outputResults(int&, char **) {}
00063   virtual void start() {}
00064   virtual void waitFinished() {}
00065   void setWindowTitle(QString t);
00066 
00067   void setLibSlot(GeopsyGuiInterface * lib, int slot) {_lib=lib; _libSlot=slot;}
00068   bool isLibSlot(GeopsyGuiInterface * lib, int slot) {return _lib==lib && _libSlot==slot;}
00069 
00070   SignalLayer * signalLayer() const {return _signalLayer;}
00071   TimeWindowLayer * timeWindowLayer() const {return _timeWindowLayer;}
00072   PickLayer * pickLayer() const {return _pickLayer;}
00073 public slots:
00074   void windowActivated(QWidget * w);
00075   void loadLogParameters(QString fileName=QString::null);
00076   void saveLogParameters(QString fileName=QString::null);
00077   virtual void showTool();
00078 signals:
00079   void updateSubPool();
00080 protected:
00081   virtual AbstractParameters * parameters(AbstractParameters * param=0) const {return param;}
00082   virtual void setParameters(const AbstractParameters * param) {Q_UNUSED(param);}
00083 
00084   virtual void contextMenuEvent(QContextMenuEvent *e);
00085 
00086   bool subPoolLocked();
00087   void lockSubPool();
00088   void unlockSubPool();
00089 protected:
00090   SubSignalPool * _subPool;
00091   int _nChildren;
00092   QWidget ** _childrenList;
00093 private:
00094   SubPoolWindow * _subPoolParent;
00095   SignalLayer * _signalLayer;
00096   TimeWindowLayer * _timeWindowLayer;
00097   PickLayer * _pickLayer;
00098   GeopsyGuiInterface * _lib;
00099   int _libSlot;
00100 };
00101 
00102 inline void ToolBase::setLayers(SignalLayer * sl, PickLayer * pl, TimeWindowLayer * wl)
00103 {
00104   TRACE;
00105   _signalLayer=sl;
00106   _timeWindowLayer=wl;
00107   _pickLayer=pl;
00108 }
00109 
00110 } // namespace GeopsyGui
00111 
00112 #endif // TOOLBASE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines