| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#ifndef AVOGADRO_QTPLUGINS_SYMMETRY_H |
| 7 |
#define AVOGADRO_QTPLUGINS_SYMMETRY_H |
| 8 |
|
| 9 |
#include <avogadro/qtgui/extensionplugin.h> |
| 10 |
|
| 11 |
#include "symmetrywidget.h" |
| 12 |
|
| 13 |
namespace msym { |
| 14 |
extern "C" |
| 15 |
{ |
| 16 |
#include <libmsym/msym.h> |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
namespace Avogadro { |
| 21 |
namespace QtPlugins { |
| 22 |
class SymmetryWidget; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
class Symmetry : public Avogadro::QtGui::ExtensionPlugin |
| 28 |
{ |
| 29 |
Q_OBJECT |
| 30 |
public: |
| 31 |
explicit Symmetry(QObject* parent_ = nullptr); |
| 32 |
~Symmetry() override; |
| 33 |
|
| 34 |
QString name() const override { return tr("Symmetry"); } |
| 35 |
QString description() const override; |
| 36 |
QList<QAction*> actions() const override; |
| 37 |
QStringList menuPath(QAction*) const override; |
| 38 |
|
| 39 |
public slots: |
| 40 |
void setMolecule(QtGui::Molecule* mol) override; |
| 41 |
|
| 42 |
void moleculeChanged(unsigned int changes); |
| 43 |
|
| 44 |
private slots: |
| 45 |
void updateActions(); |
| 46 |
|
| 47 |
void viewSymmetry(); |
| 48 |
|
| 49 |
void detectSymmetry(); |
| 50 |
|
| 51 |
void symmetrizeMolecule(); |
| 52 |
|
| 53 |
private: |
| 54 |
QList<QAction*> m_actions; |
| 55 |
QtGui::Molecule* m_molecule; |
| 56 |
SymmetryWidget* m_symmetryWidget; |
| 57 |
|
| 58 |
QAction* m_viewSymmetryAction; |
| 59 |
|
| 60 |
msym::msym_context m_ctx; |
| 61 |
|
| 62 |
bool m_dirty = true; |
| 63 |
}; |
| 64 |
|
| 65 |
inline QString Symmetry::description() const |
| 66 |
{ |
| 67 |
return tr("Provide symmetry functionality."); |
| 68 |
} |
| 69 |
|
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
#endif |