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
23 **********************************************************************/
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")));
50 d
->activateAction
->deleteLater();
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()
75 void Tool::setMolecule(Molecule
*)
79 int Tool::usefulness() const
84 bool Tool::operator<(const Tool
&other
) const {
85 return usefulness() < other
.usefulness();
88 bool Tool::paint(GLWidget
*)
93 void Tool::writeSettings(QSettings
&settings
) const
98 void Tool::readSettings(QSettings
&settings
)
103 } // end namespace Avogadro