itom 1.0.14
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2013, Institut für Technische Optik (ITO), 00005 Universität Stuttgart, Germany 00006 00007 This file is part of itom. 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 itom is distributed in the hope that it will be useful, but 00015 WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00017 General Public Licence for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with itom. If not, see <http://www.gnu.org/licenses/>. 00021 *********************************************************************** */ 00022 00023 #ifndef DESIGNERWIDGETORGANIZER_H 00024 #define DESIGNERWIDGETORGANIZER_H 00025 00026 #include "../../common/sharedStructures.h" 00027 #include "../../common/sharedStructuresGraphics.h" 00028 #include "../models/PlugInModel.h" 00029 #include "plot/AbstractItomDesignerPlugin.h" 00030 00031 #include <qobject.h> 00032 #include <qlist.h> 00033 #include <qtranslator.h> 00034 00035 class QPluginLoader; //forward declaration 00036 00037 namespace ito 00038 { 00039 00040 class DummyItomDesignerPlugin : public AbstractItomDesignerPlugin 00041 { 00042 public: 00043 QString name() const { return ""; } 00044 QString group() const { return ""; } 00045 QString toolTip() const { return ""; } 00046 QString whatsThis() const { return ""; } 00047 QString includeFile() const { return ""; } 00048 QIcon icon() const { return QIcon(); } 00049 00050 bool isContainer() const { return false; } 00051 00052 QWidget *createWidget(QWidget *parent) { return NULL; } 00053 00054 DummyItomDesignerPlugin(QObject *parent) : AbstractItomDesignerPlugin(parent) {} 00055 virtual QWidget *createWidgetWithMode(ito::AbstractFigure::WindowMode winMode, QWidget *parent) { return NULL; } 00056 }; 00057 00058 struct FigurePlugin 00059 { 00060 QString filename; 00061 QString classname; 00062 PlotDataTypes plotDataTypes; 00063 PlotDataFormats plotDataFormats; 00064 PlotFeatures plotFeatures; 00065 QIcon icon; 00066 QPluginLoader *factory; 00067 }; 00068 00069 struct FigureCategory 00070 { 00071 public: 00072 FigureCategory(const QString description, const PlotDataTypes allowedPlotDataTypes, const PlotDataFormats allowedPlotDataFormats, const PlotFeatures requiredPlotFeatures, const PlotFeatures excludedPlotFeatures, const QString defaultClassName) 00073 : m_description(description), 00074 m_allowedPlotDataTypes(allowedPlotDataTypes), 00075 m_allowedPlotDataFormats(allowedPlotDataFormats), 00076 m_requiredPlotFeatures(requiredPlotFeatures), 00077 m_excludedPlotFeatures(excludedPlotFeatures), 00078 m_defaultClassName(defaultClassName) 00079 { 00080 } 00081 00082 FigureCategory() : m_description("") {} 00083 00084 QString m_description; 00085 PlotDataTypes m_allowedPlotDataTypes; 00086 PlotDataFormats m_allowedPlotDataFormats; 00087 PlotFeatures m_requiredPlotFeatures; 00088 PlotFeatures m_excludedPlotFeatures; 00089 QString m_defaultClassName; 00090 }; 00091 00092 class DesignerWidgetOrganizer : public QObject 00093 { 00094 Q_OBJECT 00095 00096 public: 00097 00098 DesignerWidgetOrganizer(ito::RetVal &retValue); 00099 ~DesignerWidgetOrganizer(); 00100 00101 const QList<PluginLoadStatus> getPluginLoadStatus() const { return m_pluginLoadStatus; } 00102 const QMap<QString, FigureCategory> getFigureCategories() const { return m_figureCategories; } 00103 00104 bool figureClassExists( const QString &className ); 00105 ito::RetVal figureClassMinimumRequirementCheck( const QString &className, int plotDataTypesMask, int plotDataFormatsMask, int plotFeaturesMask, bool *ok = NULL ); 00106 QList<FigurePlugin> getPossibleFigureClasses( int plotDataTypesMask, int plotDataFormatsMask, int plotFeaturesMask ); 00107 QList<FigurePlugin> getPossibleFigureClasses( const FigureCategory &figureCat ); 00108 QString getFigureClass( const QString &figureCategory, const QString &defaultClassName, ito::RetVal &retVal ); 00109 RetVal setFigureDefaultClass( const QString &figureCategory, const QString &defaultClassName); 00110 00111 QWidget* createWidget(const QString &className, QWidget *parentWidget, const QString &name = QString(), AbstractFigure::WindowMode winMode = AbstractFigure::ModeStandaloneInUi); 00112 00113 protected: 00114 RetVal scanDesignerPlugins(); 00115 00116 private: 00117 QList<FigurePlugin> m_figurePlugins; 00118 QList<PluginLoadStatus> m_pluginLoadStatus; 00119 QMap<QString, FigureCategory> m_figureCategories; 00120 QVector<QTranslator*> m_Translator; 00121 00122 signals: 00123 00124 public slots: 00125 00126 private slots: 00127 00128 }; 00129 00130 } //namespace ito 00131 00132 #endif