itom
Loading...
Searching...
No Matches
designerWidgetOrganizer.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität 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
35class QPluginLoader; //forward declaration
36
37namespace ito
38{
39
41{
42 FigurePlugin() : filename(""), classname(""), plotDataTypes(DataObjLine), plotFeatures(Static), factory(nullptr), pluginVersion(0) {}
43 QString filename;
44 QString classname;
45 PlotDataTypes plotDataTypes;
46 PlotDataFormats plotDataFormats;
47 PlotFeatures plotFeatures;
48 QIcon icon;
49 int pluginVersion;
50 QPluginLoader *factory;
51};
52
54{
55public:
56 FigureCategory(const QString description, const PlotDataTypes allowedPlotDataTypes, const PlotDataFormats allowedPlotDataFormats, const PlotFeatures requiredPlotFeatures, const PlotFeatures excludedPlotFeatures, const QString defaultClassName)
57 : m_description(description),
58 m_allowedPlotDataTypes(allowedPlotDataTypes),
59 m_allowedPlotDataFormats(allowedPlotDataFormats),
60 m_requiredPlotFeatures(requiredPlotFeatures),
61 m_excludedPlotFeatures(excludedPlotFeatures),
62 m_defaultClassName(defaultClassName)
63 {
64 }
65
66 FigureCategory() : m_description("") {}
67
68 QString m_description;
69 PlotDataTypes m_allowedPlotDataTypes;
70 PlotDataFormats m_allowedPlotDataFormats;
71 PlotFeatures m_requiredPlotFeatures;
72 PlotFeatures m_excludedPlotFeatures;
73 QString m_defaultClassName;
74};
75
76class DesignerWidgetOrganizer : public QObject
77{
78 Q_OBJECT
79
80public:
81
84
85 const QList<PluginLoadStatus> getPluginLoadStatus() const { return m_pluginLoadStatus; }
86 const QMap<QString, FigureCategory> getFigureCategories() const { return m_figureCategories; }
87
88 QStringList getListOfIncompatibleDesignerPlugins() const;
89
90 bool figureClassExists( const QString &className );
91 ito::RetVal figureClassMinimumRequirementCheck( const QString &className, int plotDataTypesMask, int plotDataFormatsMask, int plotFeaturesMask, bool *ok = NULL );
92 QList<FigurePlugin> getPossibleFigureClasses( int plotDataTypesMask, int plotDataFormatsMask, int plotFeaturesMask );
93 QList<FigurePlugin> getPossibleFigureClasses( const FigureCategory &figureCat );
94 QString getFigureClass( const QString &figureCategory, const QString &defaultClassName, ito::RetVal &retVal );
95 RetVal setFigureDefaultClass( const QString &figureCategory, const QString &defaultClassName);
96 QStringList getPlotInputTypes(const int plotInputType);
97 QStringList getPlotType(const int plotType);
98 QStringList getPlotFeatures(const int plotFeatures);
99 QStringList getPlotDataFormats(const int plotDataFormats);
100
101 QWidget* createWidget(const QString &className, QWidget *parentWidget, AbstractFigure::WindowMode winMode = AbstractFigure::ModeStandaloneInUi);
102
103protected:
105 void setApiPointersToWidgetAndChildren(QWidget *widget);
106
107private:
108 QList<FigurePlugin> m_figurePlugins;
109 QList<PluginLoadStatus> m_pluginLoadStatus;
110 QMap<QString, FigureCategory> m_figureCategories;
111 QVector<QTranslator*> m_Translator;
112
113signals:
114
115public slots:
116
117private slots:
118
119};
120
121} //namespace ito
122
123#endif
Definition designerWidgetOrganizer.h:77
QString getFigureClass(const QString &figureCategory, const QString &defaultClassName, ito::RetVal &retVal)
short
Definition designerWidgetOrganizer.cpp:553
QList< FigurePlugin > getPossibleFigureClasses(int plotDataTypesMask, int plotDataFormatsMask, int plotFeaturesMask)
short
Definition designerWidgetOrganizer.cpp:497
QStringList getPlotFeatures(const int plotFeatures)
Return plot features as string list.
Definition designerWidgetOrganizer.cpp:833
QStringList getPlotInputTypes(const int plotInputType)
Return plot input types as string list.
Definition designerWidgetOrganizer.cpp:740
RetVal setFigureDefaultClass(const QString &figureCategory, const QString &defaultClassName)
short
Definition designerWidgetOrganizer.cpp:681
ito::RetVal figureClassMinimumRequirementCheck(const QString &className, int plotDataTypesMask, int plotDataFormatsMask, int plotFeaturesMask, bool *ok=NULL)
short
Definition designerWidgetOrganizer.cpp:446
RetVal scanDesignerPlugins()
short
Definition designerWidgetOrganizer.cpp:120
QWidget * createWidget(const QString &className, QWidget *parentWidget, AbstractFigure::WindowMode winMode=AbstractFigure::ModeStandaloneInUi)
short
Definition designerWidgetOrganizer.cpp:704
bool figureClassExists(const QString &className)
short
Definition designerWidgetOrganizer.cpp:423
~DesignerWidgetOrganizer()
destructor
Definition designerWidgetOrganizer.cpp:97
QStringList getPlotDataFormats(const int plotDataFormats)
Return plot data formats as string list.
Definition designerWidgetOrganizer.cpp:779
QStringList getPlotType(const int plotType)
Return plot input types as string list.
Definition designerWidgetOrganizer.cpp:883
DesignerWidgetOrganizer(ito::RetVal &retValue)
constructor
Definition designerWidgetOrganizer.cpp:59
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition apiFunctionsGraph.cpp:40
@ DataObjLine
Definition sharedStructuresGraphics.h:45
Definition designerWidgetOrganizer.h:54
Definition designerWidgetOrganizer.h:41