itom
1.0.13
|
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 00034 class QPluginLoader; //forward declaration 00035 00036 namespace ito 00037 { 00038 00039 class DummyItomDesignerPlugin : public AbstractItomDesignerPlugin 00040 { 00041 public: 00042 QString name() const { return ""; } 00043 QString group() const { return ""; } 00044 QString toolTip() const { return ""; } 00045 QString whatsThis() const { return ""; } 00046 QString includeFile() const { return ""; } 00047 QIcon icon() const { return QIcon(); } 00048 00049 bool isContainer() const { return false; } 00050 00051 QWidget *createWidget(QWidget *parent) { return NULL; } 00052 00053 DummyItomDesignerPlugin(QObject *parent) : AbstractItomDesignerPlugin(parent) {} 00054 virtual QWidget *createWidgetWithMode(ito::AbstractFigure::WindowMode winMode, QWidget *parent) { return NULL; } 00055 }; 00056 00057 struct FigurePlugin 00058 { 00059 QString filename; 00060 QString classname; 00061 PlotDataTypes plotDataTypes; 00062 PlotDataFormats plotDataFormats; 00063 PlotFeatures plotFeatures; 00064 QIcon icon; 00065 QPluginLoader *factory; 00066 }; 00067 00068 struct FigureCategory 00069 { 00070 public: 00071 FigureCategory(const QString description, const PlotDataTypes allowedPlotDataTypes, const PlotDataFormats allowedPlotDataFormats, const PlotFeatures requiredPlotFeatures, const PlotFeatures excludedPlotFeatures, const QString defaultClassName) 00072 : m_description(description), 00073 m_allowedPlotDataTypes(allowedPlotDataTypes), 00074 m_allowedPlotDataFormats(allowedPlotDataFormats), 00075 m_requiredPlotFeatures(requiredPlotFeatures), 00076 m_excludedPlotFeatures(excludedPlotFeatures), 00077 m_defaultClassName(defaultClassName) 00078 { 00079 } 00080 00081 FigureCategory() : m_description("") {} 00082 00083 QString m_description; 00084 PlotDataTypes m_allowedPlotDataTypes; 00085 PlotDataFormats m_allowedPlotDataFormats; 00086 PlotFeatures m_requiredPlotFeatures; 00087 PlotFeatures m_excludedPlotFeatures; 00088 QString m_defaultClassName; 00089 }; 00090 00091 class DesignerWidgetOrganizer : public QObject 00092 { 00093 Q_OBJECT 00094 00095 public: 00096 00097 DesignerWidgetOrganizer(ito::RetVal &retValue); 00098 ~DesignerWidgetOrganizer(); 00099 00100 const QList<PluginLoadStatus> getPluginLoadStatus() const { return m_pluginLoadStatus; } 00101 const QMap<QString, FigureCategory> getFigureCategories() const { return m_figureCategories; } 00102 00103 bool figureClassExists( const QString &className ); 00104 ito::RetVal figureClassMinimumRequirementCheck( const QString &className, int plotDataTypesMask, int plotDataFormatsMask, int plotFeaturesMask, bool *ok = NULL ); 00105 QList<FigurePlugin> getPossibleFigureClasses( int plotDataTypesMask, int plotDataFormatsMask, int plotFeaturesMask ); 00106 QList<FigurePlugin> getPossibleFigureClasses( const FigureCategory &figureCat ); 00107 QString getFigureClass( const QString &figureCategory, const QString &defaultClassName, ito::RetVal &retVal ); 00108 RetVal setFigureDefaultClass( const QString &figureCategory, const QString &defaultClassName); 00109 00110 QWidget* createWidget(const QString &className, QWidget *parentWidget, const QString &name = QString(), AbstractFigure::WindowMode winMode = AbstractFigure::ModeStandaloneInUi); 00111 00112 protected: 00113 RetVal scanDesignerPlugins(); 00114 00115 private: 00116 QList<FigurePlugin> m_figurePlugins; 00117 QList<PluginLoadStatus> m_pluginLoadStatus; 00118 QMap<QString, FigureCategory> m_figureCategories; 00119 00120 signals: 00121 00122 public slots: 00123 00124 private slots: 00125 00126 }; 00127 00128 } //namespace ito 00129 00130 #endif