Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PluginInfo.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2016 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OMNI_PLUGININFO_H_
21 #define OMNI_PLUGININFO_H_
22 
23 #include <QObject>
24 #include <QString>
25 #include <QMetaClassInfo>
26 
27 namespace omni {
28  class PluginLoader;
29 
30  /**@brief Holds meta information about a plugins
31  @detail Only plugin loader can construct a plugin info
32  **/
33  class PluginInfo {
34  public:
35  /// Only plugin loader can construct a plugin info
36  friend class PluginLoader;
37 
38  /// Return name of plugin
39  QString const& name() const;
40 
41  /// Return type of plugin (e.g. input, mapping or canvas)
42  QString const& type() const;
43 
44  /// Return author of plugin
45  QString const& author() const;
46 
47  /// Return url of plugin
48  QString const& url() const;
49 
50  /// Return description of plugin
51  QString const& description() const;
52 
53  /// Return version string (MAJOR.MINOR.REV.BUILD) of plugin
54  QString versionString() const;
55 
56  /// Return major version
57  int majorVersion() const;
58 
59  /// Return minor version
60  int minorVersion() const;
61 
62  /// Return revision number
63  int revision() const;
64 
65  /// Return build number
66  int build() const;
67 
68  /// Return class name from meta object
69  QString const& className() const;
70 
71  /// Return file name of plugin
72  QString const& file() const;
73 
74  /// Return handle (pointer to underlying QObject)
75  QObject const* handle() const;
76 
77  private:
78  /// Make a PluginInfo from file and QObject
79  static PluginInfo make(QString const& _file,
80  QObject const *);
81 
82  QString name_;
83  QString type_;
84  QString author_;
85  QString url_;
86  QString description_;
87  QString className_;
88  int majorVersion_ = 0;
89  int minorVersion_ = 0;
90  int revision_ = 0;
91  int build_ = 0;
92  QString file_;
93  };
94 }
95 
96 #define OMNI_PLUGIN_AUTHOR(AUTHOR) \
97  Q_CLASSINFO("author", AUTHOR)
98 
99 #define OMNI_PLUGIN_URL(URL) \
100  Q_CLASSINFO("url", URL)
101 
102 #define OMNI_PLUGIN_NAME(NAME) \
103  Q_CLASSINFO("name", NAME)
104 
105 #define OMNI_PLUGIN_DESCRIPTION(DESC) \
106  Q_CLASSINFO("description", DESC)
107 
108 #define OMNI_PLUGIN_VERSION(MAJOR, MINOR, REV, BUILD) \
109  Q_CLASSINFO("version",# MAJOR "." # MINOR "." # REV "." # BUILD)
110 
111 #define OMNI_PLUGIN_TYPE(T) \
112  Q_CLASSINFO("type", T)
113 
114 #define OMNI_PLUGIN_CR8TR(NAME, DESC) \
115  Q_CLASSINFO("version", OMNIDOME_VERSION_STRING) \
116  OMNI_PLUGIN_AUTHOR("CR8TR") \
117  OMNI_PLUGIN_URL("cr8tr.org / omnido.me") \
118  OMNI_PLUGIN_NAME(NAME) \
119  OMNI_PLUGIN_DESCRIPTION(DESC)
120 
121 #endif /* OMNI_PLUGININFO_H_ */
PluginLoader singleton to load plugins from multiple directories Plugins have the extension omnix...
Definition: PluginLoader.h:13
int majorVersion_
Definition: PluginInfo.h:88
QString className_
Definition: PluginInfo.h:87
QString const & className() const
Return class name from meta object.
Definition: PluginInfo.cpp:48
int minorVersion_
Definition: PluginInfo.h:89
QString const & name() const
Return name of plugin.
Definition: PluginInfo.cpp:28
int build_
Definition: PluginInfo.h:91
int minorVersion() const
Return minor version.
Definition: PluginInfo.cpp:64
QString const & type() const
Return type of plugin (e.g. input, mapping or canvas)
Definition: PluginInfo.cpp:32
QString url_
Definition: PluginInfo.h:85
int majorVersion() const
Return major version.
Definition: PluginInfo.cpp:60
QString description_
Definition: PluginInfo.h:86
QString name_
Definition: PluginInfo.h:82
QString const & url() const
Return url of plugin.
Definition: PluginInfo.cpp:40
int revision() const
Return revision number.
Definition: PluginInfo.cpp:68
QObject const * handle() const
Return handle (pointer to underlying QObject)
QString const & description() const
Return description of plugin.
Definition: PluginInfo.cpp:44
QString versionString() const
Return version string (MAJOR.MINOR.REV.BUILD) of plugin.
Definition: PluginInfo.cpp:52
int revision_
Definition: PluginInfo.h:90
QString author_
Definition: PluginInfo.h:84
Holds meta information about a plugins Only plugin loader can construct a plugin info...
Definition: PluginInfo.h:33
static PluginInfo make(QString const &_file, QObject const *)
Make a PluginInfo from file and QObject.
Definition: PluginInfo.cpp:80
QString const & author() const
Return author of plugin.
Definition: PluginInfo.cpp:36
QString const & file() const
Return file name of plugin.
Definition: PluginInfo.cpp:76
int build() const
Return build number.
Definition: PluginInfo.cpp:72
QString type_
Definition: PluginInfo.h:83
QString file_
Definition: PluginInfo.h:92