| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#ifndef AVOGADRO_QTPLUGINS_BONDING_H |
| 7 |
#define AVOGADRO_QTPLUGINS_BONDING_H |
| 8 |
|
| 9 |
#include <avogadro/core/avogadrocore.h> |
| 10 |
#include <avogadro/qtgui/extensionplugin.h> |
| 11 |
|
| 12 |
#include <QtWidgets/QDialog> |
| 13 |
|
| 14 |
namespace Ui { |
| 15 |
class BondingDialog; |
| 16 |
} |
| 17 |
|
| 18 |
namespace Avogadro::QtPlugins { |
| 19 |
|
| 20 |
/** |
| 21 |
* @brief The Bonding class performs bonding operations on demand. |
| 22 |
*/ |
| 23 |
class Bonding : public QtGui::ExtensionPlugin |
| 24 |
{ |
| 25 |
Q_OBJECT |
| 26 |
public: |
| 27 |
explicit Bonding(QObject* parent_ = nullptr); |
| 28 |
~Bonding() override = default; |
| 29 |
|
| 30 |
QString name() const override { return tr("Bonding"); } |
| 31 |
|
| 32 |
QString description() const override |
| 33 |
{ |
| 34 |
return tr("Perform bonding operations."); |
| 35 |
} |
| 36 |
|
| 37 |
QList<QAction*> actions() const override; |
| 38 |
|
| 39 |
QStringList menuPath(QAction* action) const override; |
| 40 |
|
| 41 |
bool handleCommand(const QString& command, |
| 42 |
const QVariantMap& options) override; |
| 43 |
|
| 44 |
void registerCommands() override; |
| 45 |
|
| 46 |
public slots: |
| 47 |
void setMolecule(QtGui::Molecule* mol) override; |
| 48 |
|
| 49 |
private slots: |
| 50 |
void bond(); |
| 51 |
void createBond(); |
| 52 |
void bondOrders(); |
| 53 |
void clearBonds(); |
| 54 |
void configure(); |
| 55 |
void setValues(); |
| 56 |
|
| 57 |
private: |
| 58 |
QtGui::Molecule* m_molecule; |
| 59 |
|
| 60 |
double m_tolerance; |
| 61 |
double m_minDistance; |
| 62 |
|
| 63 |
QAction* m_action; |
| 64 |
QAction* m_orderAction; |
| 65 |
QAction* m_clearAction; |
| 66 |
QAction* m_configAction; |
| 67 |
QAction* m_createBondsAction; |
| 68 |
|
| 69 |
QDialog* m_dialog; |
| 70 |
Ui::BondingDialog* m_ui; |
| 71 |
}; |
| 72 |
|
| 73 |
} // namespace Avogadro::QtPlugins |
| 74 |
|
| 75 |
#endif // AVOGADRO_QTPLUGINS_BONDING_H |