Developer Documentation

FileLgt.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42 #pragma once
43
44 #include <QObject>
45
46 #include <OpenFlipper/common/Types.hh>
47 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
48 #include <OpenFlipper/BasePlugin/FileInterface.hh>
49 #include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
50 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
51 #include <OpenFlipper/BasePlugin/ScriptInterface.hh>
52 #include <ObjectTypes/Light/Light.hh>
53
54 class FileLightPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInterface, LoggingInterface, ScriptInterface
55 {
56 Q_OBJECT
57 Q_INTERFACES(FileInterface)
58 Q_INTERFACES(LoadSaveInterface)
59 Q_INTERFACES(LoggingInterface)
60 Q_INTERFACES(BaseInterface)
61 Q_INTERFACES(ScriptInterface)
62 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-FileLgt")
63 signals:
64 void openedFile( int _id );
65 void addEmptyObject( DataType _type, int& _id);
66 void load(QString _filename, DataType _type, int& _id);
67 void save(int _id , QString _filename );
68 void log(Logtype _type, QString _message);
69 void log(QString _message);
70
71 void updatedObject(int _id, const UpdateType& _type);
72
73 private slots:
74
75 void fileOpened( int /*_id*/ ){};
76
77 void noguiSupported( ) {} ;
78
79 void initializePlugin();
80
81 public :
82
83 ~FileLightPlugin() {};
84
85 QString name() { return (QString("FileLight")); };
86 QString description( ) { return (QString(tr("Load/Save Lights"))); };
87
88 DataType supportedType();
89
90 QString getSaveFilters();
91 QString getLoadFilters();
92
93 QWidget* saveOptionsWidget(QString /*_currentFilter*/) { return 0; };
94 QWidget* loadOptionsWidget(QString /*_currentFilter*/) { return 0; };
95
96 public slots:
97
98 int loadObject(QString _filename);
99
100 bool saveObject(int _id, QString _filename);
101
102 QString version() { return QString("1.0"); };
103
104 };
FileLightPlugin::loadOptionsWidget
QWidget * loadOptionsWidget(QString)
Definition: FileLgt.hh:94
ScriptInterface.hh
FileLightPlugin::getSaveFilters
QString getSaveFilters()
Definition: FileLgt.cc:55
LoadSaveInterface.hh
FileLightPlugin::getLoadFilters
QString getLoadFilters()
Definition: FileLgt.cc:51
Light.hh
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:92
FileLightPlugin::description
QString description()
Return a description of what the plugin is doing.
Definition: FileLgt.hh:86
FileLightPlugin::noguiSupported
void noguiSupported()
Definition: FileLgt.hh:77
DataType
Predefined datatypes.
Definition: DataTypes.hh:83
LoggingInterface
Interface for all Plugins which do logging to the logging window of the framework.
Definition: LoggingInterface.hh:112
FileLightPlugin
Definition: FileLgt.hh:54
LoggingInterface.hh
FileLightPlugin::supportedType
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Definition: FileLgt.cc:59
FileLightPlugin::saveOptionsWidget
QWidget * saveOptionsWidget(QString)
Definition: FileLgt.hh:93
UpdateType
Update type class.
Definition: UpdateType.hh:60
FileLightPlugin::name
QString name()
Return a name for the plugin.
Definition: FileLgt.hh:85
FileInterface.hh
ScriptInterface
Interface for all Plugins which provide scriptable Functions.
Definition: ScriptInterface.hh:58
Types.hh
FileLightPlugin::initializePlugin
void initializePlugin()
Initialize Plugin.
Definition: FileLgt.cc:48
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:65
BaseInterface.hh
FileInterface
Interface class for file handling.
Definition: FileInterface.hh:63
LoadSaveInterface
Interface for all plugins which want to Load or Save files and create Objects.
Definition: LoadSaveInterface.hh:59