some fixes to the cmake files. It still is not working
[kdeedu-porting.git] / kalzium / libavogadro-kalzium / src / tool.cpp
blob1395a6e8428daf8df3f6f525721d697e19a94f6d
1 /**********************************************************************
2 Tool - Avogadro Tool Interface
4 Copyright (C) 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 "tool.h"
26 #include <config.h>
28 #include <QAction>
29 #include <QIcon>
31 namespace Avogadro {
33 class ToolPrivate
35 public:
36 ToolPrivate() : activateAction(0) {}
38 QAction *activateAction;
41 Tool::Tool(QObject *parent) : QObject(parent), d(new ToolPrivate)
43 d->activateAction = new QAction(this);
44 d->activateAction->setCheckable(true);
45 d->activateAction->setIcon(QIcon(QString::fromUtf8(":/icons/tool.png")));
48 Tool::~Tool()
50 d->activateAction->deleteLater();
51 delete d;
54 QString Tool::description() const
56 return QObject::tr("No Description");
59 QAction* Tool::activateAction() const {
61 if(d->activateAction->toolTip().isEmpty())
62 d->activateAction->setToolTip(description());
64 if(d->activateAction->text().isEmpty())
65 d->activateAction->setText(name());
67 return d->activateAction;
70 QWidget* Tool::settingsWidget()
72 return 0;
75 void Tool::setMolecule(Molecule *)
79 int Tool::usefulness() const
81 return 0;
84 bool Tool::operator<(const Tool &other) const {
85 return usefulness() < other.usefulness();
88 bool Tool::paint(GLWidget*)
90 return true;
93 void Tool::writeSettings(QSettings &settings) const
95 Q_UNUSED(settings);
98 void Tool::readSettings(QSettings &settings)
100 Q_UNUSED(settings);
103 } // end namespace Avogadro
105 #include "tool.moc"