source: projectionDesigner/trunk/projdesignerplugins/defaultplugin/defaultplugin.cpp @ 9

Last change on this file since 9 was 4, checked in by Torben Dannhauer, 15 years ago
File size: 4.0 KB
RevLine 
[4]1#include <QtGui>
2#include "defaultplugin.h"
3
4/**
5 * Default constructor of the DefaultPlugin class.
6 *
7 * This constructor should be called just one time, by Qt mechanisms
8 * (not manually).
9 *
10 */
11DefaultPlugin::DefaultPlugin(): QObject()
12{
13}
14
15
16/**
17 * DefaultPlugin destructor.
18 *
19 * This destructor, just like the constructor, is not called manually.
20 *
21 */
22DefaultPlugin::~DefaultPlugin()
23{
24}
25
26
27/**
28 * Gets the name of the Interface (ie. the public name of the plugin).
29 *
30 * @return The name of the Interface (ie. the public name of the plugin).
31 *
32 */
33QString DefaultPlugin::name() const
34{
35    return QString (tr("Default Plugin"));
36}
37
38
39/**
40 * Gets the list of the projectors implemented by the DefaultPlugin.
41 *
42 * @return The list of the projectors implemented by the DefaultPlugin.
43 *
44 */
45QStringList DefaultPlugin::projectors() const
46{
47    return QStringList(DefaultPluginData::g_projector_name);
48}
49
50
51/**
52 * Gets a new ProjectorWidget for a projector.
53 *
54 * @remark The responsability is transfered to the user, especially the
55 *         responsability to delete the widget at the end of use.
56 *
57 * @param projector The name of a projector, from the projectors()-list.
58 *
59 * @return A pointer on the ProjectorWidget.
60 *
61 */
62ProjectorWidget* DefaultPlugin::newProjectorWidget(const QString& projector)
63{
64    if (projector!=DefaultPluginData::g_projector_name) return NULL;
65    return new DefaultProjectorWidget(this);
66}
67
68
69/**
70 * Gets a new ProjectorData for a projector.
71 *
72 * @remark The responsability is transfered to the user, especially the
73 *         responsability to delete the data at the end of use.
74 *
75 * @param projector The name of a projector, from the projectors()-list.
76 *
77 * @return A pointer on the ProjectorData.
78 *
79 */
80ProjectorData *DefaultPlugin::newProjectorData(const QString& projector)
81{
82    if (projector!=DefaultPluginData::g_projector_name) 
83    {
84        return NULL;
85    }
86    return new DefaultPluginData(this);
87}
88
89
90/**
91 * Gets the list of the scenes implemented by the DefaultPlugin.
92 *
93 * @return The list of the scenes implemented by the DefaultPlugin.
94 *
95 */
96QStringList DefaultPlugin::scenes() const
97{
98    return QStringList() << DefaultEmptySceneContent::g_scene_name << DefaultTeapotSceneContent::g_scene_name << DefaultCubemapSceneContent::g_scene_name << DefaultModelSceneContent::g_scene_name;
99}
100
101
102/**
103 * Gets a new SceneWidget for a scene.
104 *
105 * @remark The responsability is transfered to the user, especially the
106 *         responsability to delete the widget at the end of use.
107 *
108 * @param scene_name The name of a scene, from the scenes()-list.
109 *
110 * @return A pointer on the SceneWidget.
111 *
112 */
113SceneContent* DefaultPlugin::newSceneContent(const QString& scene_name)
114{
115    if (scene_name==DefaultEmptySceneContent::g_scene_name) return new DefaultEmptySceneContent(this);
116    else if (scene_name==DefaultTeapotSceneContent::g_scene_name) return new DefaultTeapotSceneContent(this);
117    else if (scene_name==DefaultCubemapSceneContent::g_scene_name) return new DefaultCubemapSceneContent(this);
118    else if (scene_name==DefaultModelSceneContent::g_scene_name) return new DefaultModelSceneContent(this);
119    else return NULL;
120}
121
122/**
123 * Gets a new SceneContent for a scene.
124 *
125 * @remark The responsability is transfered to the user, especially the
126 *         responsability to delete the content at the end of use.
127 *
128 * @param scene The name of a scene, from the scenes()-list.
129 *
130 * @return A pointer on the SceneContent.
131 *
132 */
133SceneWidget* DefaultPlugin::newSceneWidget(const QString& scene_name)
134{
135    if (scene_name==DefaultEmptySceneContent::g_scene_name) return new DefaultEmptySceneWidget(this);
136    else if (scene_name==DefaultTeapotSceneContent::g_scene_name) return new DefaultTeapotSceneWidget(this);
137    else if (scene_name==DefaultCubemapSceneContent::g_scene_name) return new DefaultCubemapSceneWidget(this);
138    else if (scene_name==DefaultModelSceneContent::g_scene_name) return new DefaultModelSceneWidget(this);
139    else return NULL;
140}
141
142
143Q_EXPORT_PLUGIN2(projdesigner_default, DefaultPlugin)
Note: See TracBrowser for help on using the repository browser.