00001 /*************************************************************************** 00002 ** 00003 ** This file is part of dinver. 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 : 2005-10-31 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef DINVERGUI_H 00028 #define DINVERGUI_H 00029 00030 #include <QtGui> 00031 #include <QGpGuiTools.h> 00032 #include <DinverCore.h> 00033 00034 #include "PSViewer.h" 00035 00036 class ThreadLauncher; 00037 class ProcessStatus; 00038 00039 class DinverGui : public QMainWindow, public DinverCoreObject 00040 { 00041 Q_OBJECT 00042 public: 00043 DinverGui(QWidget* parent=0, Qt::WFlags fl=0 ); 00044 ~DinverGui(); 00045 00046 static QString pluginSelector(QString tag, bool debug); 00047 bool setPlugin(QString pluginFile); 00048 00049 ThreadTimer& bigBen() {return _bigBen;} 00050 00051 ProcessStatus * status() const {return _status;} 00052 LogWidget * logs() const {return _logs;} 00053 ThreadLauncher * runs() const {return _runs;} 00054 00055 PSViewerList psViewerList() {return findChildren<PSViewer *>();} 00056 void addThread(InversionThread * t); 00057 void removeThread(InversionThread * t); 00058 void clearThread(InversionThread * t); 00059 virtual QStringList selectedReports(const QString& title) const; 00060 ThreadList threads() const {return _threads;} 00061 ThreadList threads(QString t) const; 00062 ThreadList selectedThreads(bool& allOfTheSameType) const; 00063 00064 virtual bool useProgress() {return true;} 00065 virtual AbstractProgress * progress() {return _progressBar;} 00066 bool closeAllPSViewers(); 00067 00068 QDir currentReportDir() const; 00069 public slots: 00070 void activeWindowChanged(QWidget * w); 00071 void setToolsMenuState(); 00072 // File menu 00073 bool clear(); 00074 void open(QString fileName=QString::null); 00075 void save(); 00076 void saveAs(QString fileName=QString::null); 00077 void importTargets(QString fileName=QString::null); 00078 void exportTargets(QString fileName=QString::null); 00079 void importParameters(QString fileName=QString::null); 00080 void exportParameters(QString fileName=QString::null); 00081 // View menu 00082 void viewPS(); 00083 // Window menu 00084 virtual void addWindow(QWidget * w); 00085 virtual void showWindow(QWidget * w); 00086 void removeWindow (QWidget * w); 00087 void updateWindowTitle (QWidget * w); 00088 void windowsMenuAdd(QWidget * w); 00089 void windowsMenuRemove(QWidget * w); 00090 void windowsMenuSetCurrent(QWidget * w); 00091 void windowsMenuTriggered(); 00092 Q_SCRIPTABLE void windowsMinimize(); 00093 Q_SCRIPTABLE void tileHorizontal(); 00094 Q_SCRIPTABLE void closeAllWindows() {_ws->closeAllWindows();} 00095 // Help menu 00096 Q_SCRIPTABLE void helpDocumentation(); 00097 Q_SCRIPTABLE void helpAbout(); 00098 00099 virtual void setProgressMaximum(int); 00100 virtual int progressMaximum(); 00101 virtual void setProgressValue(int); 00102 virtual void showMessage(QString); 00103 private slots: 00104 void setCurrentRuns(ThreadList tList); 00105 signals: 00106 void newThread(InversionThread * ); 00107 void pluginsReady(); 00108 protected: 00109 void setTempDir(const QDir& d); 00110 void cleanTempDir(); 00111 bool stopAll (); 00112 bool warnBeforeClose(); 00113 virtual void closeEvent (QCloseEvent * e); 00114 void addDocks(DockWidget * leftDock, DockWidget * bottomDock); 00115 void addActions(); 00116 void setWindowsMenuEnabled(bool b); 00117 void addFileActions(); 00118 void addViewActions(); 00119 void addRunsActions(); 00120 void addToolsActions(); 00121 void addWindowsActions(); 00122 void addHelpActions(); 00123 QAction * windowsMenuAction(QWidget * w); 00124 QList<PSViewer *> psViewers(); 00125 00126 ThreadTimer _bigBen; 00127 ThreadList _threads; 00128 00129 ThreadLauncher * _runs; 00130 QWorkspace * _ws; 00131 LogWidget * _logs; 00132 ProcessStatus * _status; 00133 ProgressBar * _progressBar; 00134 00135 QString _currentFile; 00136 TemporaryDirectory _tempDir; 00137 00138 QMenu * _toolsMenu; 00139 QMenu * _windowsMenu; 00140 QAction * _importTargetsAction; 00141 QAction * _importParamsAction; 00142 QAction * _showRunAction; 00143 QAction * _windowsCascadeAction; 00144 QAction * _windowsTileVAction; 00145 QAction * _windowsTileHAction; 00146 QAction * _windowsCloseAllAction; 00147 QAction * _windowsMinimizeAction; 00148 DockWidget * _targetDock; 00149 DockWidget * _paramDock; 00150 }; 00151 00152 #define dinverGui static_cast<DinverGui *>(dinverCore) 00153 00154 #endif // DINVERGUI_H