geopsy/GeopsyMainWindow.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of geopsy.
00004 **
00005 **  This file may be distributed and/or modified under the terms of the
00006 **  GNU General Public License version 2 or 3 as published by the Free
00007 **  Software Foundation and appearing in the file LICENSE.GPL included
00008 **  in the packaging of this file.
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 General Public License for
00013 **  more details.
00014 **
00015 **  You should have received a copy of the GNU General Public License
00016 **  along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 **
00018 **  See http://www.geopsy.org for more information.
00019 **
00020 **  Created : 2003-12-01
00021 **  Authors:
00022 **    Marc Wathelet
00023 **    Marc Wathelet (ULg, Liège, Belgium)
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef GeopsyMainWindow_H
00029 #define GeopsyMainWindow_H
00030 
00031 #include <GeopsyGui.h>
00032 #include <GeopsySLinkGui.h>
00033 #include <QGpGuiTools.h>
00034 
00035 class ToolFactory;
00036 class FileView;
00037 class GroupWidget;
00038 class WaveformConsole;
00039 
00040 class GeopsyMainWindow : public QMainWindow
00041 {
00042   Q_OBJECT
00043 public:
00044   GeopsyMainWindow(QWidget* parent=0, Qt::WFlags fl=0);
00045   ~GeopsyMainWindow();
00046 
00047   QLabel * databaseInfo;
00048 
00049   void initTools();
00050   SubPoolWindow * currentSubPoolWin() {return _subPoolWin;}
00051   QWorkspace * workspace() {return _ws;}
00052 
00053   void setToolFactory(ToolFactory * tf);
00054   ToolFactory * toolFactory() {return _toolFactory;}
00055 
00056   ProgressBar * progressBar() const {return _progressBar;}
00057   const QAction * viewTableAction() const {return _viewTableAction;}
00058   const QAction * viewGraphicAction() const {return _viewGraphicAction;}
00059   const QAction * viewMapAction() const {return _viewMapAction;}
00060 
00061   bool isTableEditionLocked() {return _tableEditionLocked;}
00062   virtual bool useProgress() {return true;}
00063   virtual QStatusBar * statusBar() {return QMainWindow::statusBar();}
00064   virtual ProgressBar * progressBar() {return _progressBar;}
00065   void startupPreferences();
00066   static QAction * newAction(const QAction& original, QWidget * parent=0);
00067   void filesRemoved(const QList<SignalFile *>& fList);
00068   void refreshLists();
00069 public slots:
00070   void activeWindowChanged(QWidget * w);
00071   void setSubPoolActionEnabled(bool b, bool rw);
00072 
00073   void clearAll();
00074   void exportSignal();
00075   void importTable();
00076   void setPreferences();
00077   void saveDBAs();
00078   void openDB(QString fileName=QString::null);
00079   void saveDB();
00080   void load();
00081   void loadFilePattern();
00082   void directoryMonitor();
00083   void seedlink(QByteArray serverAddress=0, qint16 serverPort=0,
00084                 QString streamSelection=QString::null);
00085   void loadCity();
00086   void quit(bool force=false);
00087   SubPoolWindow * newTableWindow();
00088   AbstractGraphicWindow * newGraphicWindow();
00089   SubPoolWindow * newMapWindow();
00090   SubPoolWindow * newChronogramWindow();
00091   SubPoolWindow * newTableWindow(const SubSignalPool& subPool);
00092   AbstractGraphicWindow * newGraphicWindow(const SubSignalPool& subPool);
00093   SubPoolWindow * newMapWindow(const SubSignalPool& subPool);
00094   SubPoolWindow * newChronogramWindow(const SubSignalPool& subPool);
00095 
00096   // Edit menu
00097   Q_SCRIPTABLE void setTableLocked(bool l);
00098   Q_SCRIPTABLE void sort();
00099   Q_SCRIPTABLE void setHeader();
00100   Q_SCRIPTABLE void setReceivers();
00101   Q_SCRIPTABLE void setSources();
00102   Q_SCRIPTABLE void createNewGroup();
00103   // View menu
00104   Q_SCRIPTABLE void viewRefreshNow();
00105   Q_SCRIPTABLE void viewSetDataFields();
00106   Q_SCRIPTABLE void fftTime();
00107   Q_SCRIPTABLE void fftAmpl();
00108   Q_SCRIPTABLE void fftPhase();
00109   // Windows menu
00110   void addWindow(QWidget * w);
00111   void removeWindow(QWidget * w);
00112   void showWindow(QWidget * w);
00113   void updateWindowTitle(QWidget * w);
00114   void windowsMenuAdd(QWidget * w);
00115   void windowsMenuRemove(QWidget * w);
00116   void windowsMenuSetCurrent(QWidget * w);
00117   void windowsMenuTriggered();
00118   void windowsMinimize();
00119   void tileHorizontal();
00120   Q_SCRIPTABLE void closeAllWindows() {_ws->closeAllWindows();}
00121   void showToolBarMenu();
00122   // Help menu
00123   Q_SCRIPTABLE void helpDocumentation();
00124   Q_SCRIPTABLE void helpAbout();
00125 
00126   void showDBStatus();
00127 
00128   void setProgressMaximum(int value);
00129   int progressMaximum();
00130   void setProgressValue(int value);
00131   int progressValue();
00132   void increaseProgressValue(int value=1);
00133   void hideProgressBar();
00134   void showMessage(QString message);
00135   void showLoadedSignals(const SubSignalPool& subPool);
00136 signals:
00137   void asyncSetProgressMaximum(int value);
00138   void asyncSetProgressValue(int value);
00139   void asyncIncreaseProgressValue(int value);
00140   void asyncShowMessage(QString message);
00141 protected:
00142   friend class GeopsyMainWindowInt;
00143 
00144   virtual void dragEnterEvent(QDragEnterEvent * event);
00145   virtual void dragMoveEvent(QDragMoveEvent * event);
00146   virtual void dropEvent(QDropEvent * event);
00147   virtual void closeEvent(QCloseEvent * e);
00148   bool warnBeforeClear (QString action);
00149 
00150   ToolFactory * _toolFactory;
00151   SeedLinkLoader * _seedLink;
00152   DirectoryMonitor * _directoryMonitor;
00153   QWorkspace* _ws;
00154   SubPoolWindow * _subPoolWin;
00155 
00156   FileView * _fList;
00157   GroupWidget * _gList;
00158   WaveformConsole * _waveformConsole;
00159 
00160   QAction * _fileExportAction;
00161   QAction * _fileImportAction;
00162 
00163   QAction * _viewTableAction;
00164   QAction * _viewGraphicAction;
00165   QAction * _viewMapAction;
00166   QAction * _viewChronogramAction;
00167 
00168   QAction * _viewSetDataFieldsAction;
00169 
00170   QAction * _fftTimeAction;
00171   QAction * _fftAmplitudeAction;
00172   QAction * _fftPhaseAction;
00173 
00174   QAction * _windowsCascadeAction;
00175   QAction * _windowsTileVAction;
00176   QAction * _windowsTileHAction;
00177   QAction * _windowsCloseAllAction;
00178   QAction * _windowsMinimizeAction;
00179 
00180   QMenu * _importSignalMenu;
00181   QMenu * _editMenu;
00182   QMenu * _viewMenu;
00183   QMenu * _toolsMenu;
00184   QMenu * _waveMenu;
00185   QMenu * _windowsMenu;
00186   QMenu * _toolBarsMenu;
00187 
00188   QToolBar * _toolsBar;
00189   ProgressBar * _progressBar;
00190   QTimer _progressHideTimer;
00191 
00192   bool _tableEditionLocked;
00193 
00194   uint _dbStatusChecksum;
00195   QTimer _dbStatusTimer;
00196 private:
00197   void addActions();
00198   void setWindowsMenuEnabled(bool b);
00199   void addFileActions();
00200   void addViewActions();
00201   void addEditActions();
00202   void addWaveformActions();
00203   void addToolsActions();
00204   void addWindowsActions();
00205   void addHelpActions();
00206   QAction * windowsMenuAction(QWidget * w);
00207   void addSplitGroup(SubSignalPool& splitGroupSubPool, AbstractSignalGroup * parent,
00208                      ExpressionString& gName, SignalExpressionContext& context,
00209                      int viewerIndex, int groupIndex);
00210 };
00211 
00212 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines