1 /**********************************************************************
2 Engine - Engine interface and plugin factory.
4 Copyright (C) 2006,2007 Donald Ephraim Curtis
6 This file is part of the Avogadro molecular editor project.
7 For more information, see <http://avogadro.sourceforge.net/>
9 Avogadro is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 Avogadro is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 **********************************************************************/
32 EnginePrivate() : colorMap(0), enabled(false) {}
34 PrimitiveList primitives
;
42 Engine::Engine(QObject
*parent
) : QObject(parent
), d(new EnginePrivate
)
51 PrimitiveList
Engine::primitives() const
56 void Engine::setPrimitives(const PrimitiveList
&primitives
)
58 d
->primitives
= primitives
;
62 double Engine::radius(const PainterDevice
*, const Primitive
*) const
67 void Engine::clearPrimitives()
69 d
->primitives
.clear();
72 bool Engine::isEnabled() const
77 void Engine::setEnabled(bool enabled
)
83 void Engine::addPrimitive(Primitive
*primitive
)
85 d
->primitives
.append(primitive
);
89 void Engine::updatePrimitive(Primitive
*)
94 void Engine::removePrimitive(Primitive
*primitive
)
96 d
->primitives
.removeAll(primitive
);
100 void Engine::setColorMap(Color
*map
)
105 QWidget
*Engine::settingsWidget()
110 Color
*Engine::colorMap()
115 void Engine::setName(const QString
&name
)
120 QString
Engine::name() const
122 if(d
->name
.isEmpty()) { return type(); }
126 void Engine::setDescription(const QString
&description
)
128 d
->description
= description
;
131 QString
Engine::description() const
133 return d
->description
;
136 Engine::EngineFlags
Engine::flags() const
138 return Engine::NoFlags
;
141 double Engine::transparencyDepth() const
146 void Engine::writeSettings(QSettings
&settings
) const
148 settings
.setValue("enabled", isEnabled());
149 settings
.setValue("name", name());
150 settings
.setValue("description", description());
153 void Engine::readSettings(QSettings
&settings
)
155 setEnabled(settings
.value("enabled", false).toBool());
156 setName(settings
.value("name", name()).toString());
157 setDescription(settings
.value("description", description()).toString());
161 #include "engine.moc"