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 : 2004-09-02 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (ULg, Liège, Belgium) 00024 ** Marc Wathelet (LGIT, Grenoble, France) 00025 ** 00026 ***************************************************************************/ 00027 00028 #ifndef TOOLFACTORY_H 00029 #define TOOLFACTORY_H 00030 00031 #include <GeopsyGui.h> 00032 00033 #define TOOLFACTORY_NPOPULAR 5 00034 00035 class ToolFactory : public QObject 00036 { 00037 Q_OBJECT 00038 public: 00039 ToolFactory(); 00040 ~ToolFactory(); 00041 00042 void addActions(QWidget * w); 00043 bool addPopularActions(QMenu * menu, const QObject * receiver, const char * slot); 00044 void showTool(QAction * a); 00045 int exec(SubSignalPool * subPool, GeopsyGuiInterface * info, int slot, int& argc, char ** argv); 00046 00047 void createToolActions(); 00048 QList<QAction *> createImportActions(QObject * parent) const; 00049 void createPreferenceTabs(QTabWidget * tab); 00050 00051 void setPreferences(); 00052 void infoTools(); 00053 00054 void setHelp(ApplicationHelp * h); 00055 GeopsyGuiInterface * tool(QString pluginTag); 00056 public slots: 00057 void showTool(); 00058 void newGraphicWindow(const SubSignalPool& subPool); 00059 private: 00060 QString action2Tag(QAction * a); 00061 QAction * tag2Action(QString tag); 00062 void addPopular(QAction * a); 00063 void showTool(GeopsyGuiInterface * info, int slot); 00064 00065 QList<GeopsyGuiInterface *> _list; 00066 QList<QAction *> _popular; 00067 }; 00068 00069 class ToolSeparator : public GeopsyGuiInterface 00070 { 00071 public: 00072 virtual QString tag() const {return "separator";} 00073 virtual QString title() const {return tr("--- Separator ---");} 00074 00075 virtual void createToolActions(QObject * toolFactory); 00076 QList<QAction *> createImportActions(QObject * parent) const; 00077 virtual ToolBase * createTool(int , QWidget *) const {return 0;} 00078 00079 virtual const char * interfaceVersion() const {return GEOPSYCORE_VERSION;} 00080 }; 00081 00082 00083 #endif // TOOLFACTORY_H