itom  3.0.0
designerWidgetOrganizer.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2016, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef DESIGNERWIDGETORGANIZER_H
24 #define DESIGNERWIDGETORGANIZER_H
25 
26 #include "../../common/sharedStructures.h"
27 #include "../../common/sharedStructuresGraphics.h"
28 #include "../../AddInManager/pluginModel.h"
29 #include "plot/AbstractItomDesignerPlugin.h"
30 
31 #include <qobject.h>
32 #include <qlist.h>
33 #include <qtranslator.h>
34 
35 class QPluginLoader; //forward declaration
36 
37 namespace ito
38 {
39 
41 {
42 public:
43  QString name() const { return ""; }
44  QString group() const { return ""; }
45  QString toolTip() const { return ""; }
46  QString whatsThis() const { return ""; }
47  QString includeFile() const { return ""; }
48  QIcon icon() const { return QIcon(); }
49 
50  bool isContainer() const { return false; }
51 
52  QWidget *createWidget(QWidget *parent) { return NULL; }
53 
54  DummyItomDesignerPlugin(QObject *parent) : AbstractItomDesignerPlugin(parent) {}
55  virtual QWidget *createWidgetWithMode(ito::AbstractFigure::WindowMode winMode, QWidget *parent) { return NULL; }
56 };
57 
59 {
60  FigurePlugin() : filename(""), classname(""), plotDataTypes(DataObjLine), plotFeatures(Static), factory(NULL) {}
61  QString filename;
62  QString classname;
63  PlotDataTypes plotDataTypes;
64  PlotDataFormats plotDataFormats;
65  PlotFeatures plotFeatures;
66  QIcon icon;
67  QPluginLoader *factory;
68 };
69 
71 {
72 public:
73  FigureCategory(const QString description, const PlotDataTypes allowedPlotDataTypes, const PlotDataFormats allowedPlotDataFormats, const PlotFeatures requiredPlotFeatures, const PlotFeatures excludedPlotFeatures, const QString defaultClassName)
74  : m_description(description),
75  m_allowedPlotDataTypes(allowedPlotDataTypes),
76  m_allowedPlotDataFormats(allowedPlotDataFormats),
77  m_requiredPlotFeatures(requiredPlotFeatures),
78  m_excludedPlotFeatures(excludedPlotFeatures),
79  m_defaultClassName(defaultClassName)
80  {
81  }
82 
83  FigureCategory() : m_description("") {}
84 
85  QString m_description;
86  PlotDataTypes m_allowedPlotDataTypes;
87  PlotDataFormats m_allowedPlotDataFormats;
88  PlotFeatures m_requiredPlotFeatures;
89  PlotFeatures m_excludedPlotFeatures;
90  QString m_defaultClassName;
91 };
92 
93 class DesignerWidgetOrganizer : public QObject
94 {
95  Q_OBJECT
96 
97 public:
98 
101 
102  const QList<PluginLoadStatus> getPluginLoadStatus() const { return m_pluginLoadStatus; }
103  const QMap<QString, FigureCategory> getFigureCategories() const { return m_figureCategories; }
104 
105  bool figureClassExists( const QString &className );
106  ito::RetVal figureClassMinimumRequirementCheck( const QString &className, int plotDataTypesMask, int plotDataFormatsMask, int plotFeaturesMask, bool *ok = NULL );
107  QList<FigurePlugin> getPossibleFigureClasses( int plotDataTypesMask, int plotDataFormatsMask, int plotFeaturesMask );
108  QList<FigurePlugin> getPossibleFigureClasses( const FigureCategory &figureCat );
109  QString getFigureClass( const QString &figureCategory, const QString &defaultClassName, ito::RetVal &retVal );
110  RetVal setFigureDefaultClass( const QString &figureCategory, const QString &defaultClassName);
111  QStringList getPlotInputTypes(const int plotInputType);
112  QStringList getPlotType(const int plotType);
113  QStringList getPlotFeatures(const int plotFeatures);
114  QStringList getPlotDataFormats(const int plotDataFormats);
115 
116  QWidget* createWidget(const QString &className, QWidget *parentWidget, const QString &name = QString(), AbstractFigure::WindowMode winMode = AbstractFigure::ModeStandaloneInUi);
117 
118 protected:
119  RetVal scanDesignerPlugins();
120  void setApiPointersToWidgetAndChildren(QWidget *widget);
121 
122 private:
123  QList<FigurePlugin> m_figurePlugins;
124  QList<PluginLoadStatus> m_pluginLoadStatus;
125  QMap<QString, FigureCategory> m_figureCategories;
126  QVector<QTranslator*> m_Translator;
127 
128 signals:
129 
130 public slots:
131 
132 private slots:
133 
134 };
135 
136 } //namespace ito
137 
138 #endif
Definition: designerWidgetOrganizer.h:70
Class for managing status values (like errors or warning)
Definition: retVal.h:54
AbstractItomDesignerPlugin(QObject *parent)
the classinfo ito.AbstractItomDesignerPlugin is the interface number of AbstractItomDesignerPlugin.
Definition: AbstractItomDesignerPlugin.h:57
Definition: AbstractItomDesignerPlugin.h:45
Definition: apiFunctionsGraph.cpp:39
Definition: sharedStructuresGraphics.h:49
Definition: designerWidgetOrganizer.h:40
Definition: designerWidgetOrganizer.h:93
Definition: designerWidgetOrganizer.h:58
QString m_description
a brief descrition of the plugin
Definition: AbstractItomDesignerPlugin.h:108