some fixes to the cmake files. It still is not working
[kdeedu-porting.git] / kalzium / libavogadro-kalzium / src / engine.cpp
bloba148e32c7b8ddbfd4dab2bc8cfbeb12b3b93fd85
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
22 02110-1301, USA.
23 **********************************************************************/
25 #include "engine.h"
27 namespace Avogadro {
29 class EnginePrivate
31 public:
32 EnginePrivate() : colorMap(0), enabled(false) {}
34 PrimitiveList primitives;
35 Color *colorMap;
36 bool enabled;
38 QString name;
39 QString description;
42 Engine::Engine(QObject *parent) : QObject(parent), d(new EnginePrivate)
46 Engine::~Engine()
48 delete d;
51 PrimitiveList Engine::primitives() const
53 return d->primitives;
56 void Engine::setPrimitives(const PrimitiveList &primitives)
58 d->primitives = primitives;
59 emit changed();
62 double Engine::radius(const PainterDevice*, const Primitive*) const
64 return 0.0;
67 void Engine::clearPrimitives()
69 d->primitives.clear();
72 bool Engine::isEnabled() const
74 return d->enabled;
77 void Engine::setEnabled(bool enabled)
79 d->enabled = enabled;
80 emit changed();
83 void Engine::addPrimitive(Primitive *primitive)
85 d->primitives.append(primitive);
86 emit changed();
89 void Engine::updatePrimitive(Primitive*)
91 emit changed();
94 void Engine::removePrimitive(Primitive *primitive)
96 d->primitives.removeAll(primitive);
97 emit changed();
100 void Engine::setColorMap(Color *map)
102 d->colorMap = map;
105 QWidget *Engine::settingsWidget()
107 return 0;
110 Color *Engine::colorMap()
112 return d->colorMap;
115 void Engine::setName(const QString &name)
117 d->name = name;
120 QString Engine::name() const
122 if(d->name.isEmpty()) { return type(); }
123 return d->name;
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
143 return 0.0;
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"