| 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_TEMPLATETOOLWIDGET_H |
| 7 |
#define AVOGADRO_QTPLUGINS_TEMPLATETOOLWIDGET_H |
| 8 |
|
| 9 |
#include <QtWidgets/QWidget> |
| 10 |
|
| 11 |
namespace Avogadro { |
| 12 |
namespace QtGui { |
| 13 |
class PeriodicTableView; |
| 14 |
class InsertFragmentDialog; |
| 15 |
} // namespace QtGui |
| 16 |
|
| 17 |
namespace QtPlugins { |
| 18 |
|
| 19 |
namespace Ui { |
| 20 |
class TemplateToolWidget; |
| 21 |
} |
| 22 |
|
| 23 |
class TemplateToolWidget : public QWidget |
| 24 |
{ |
| 25 |
Q_OBJECT |
| 26 |
|
| 27 |
public: |
| 28 |
explicit TemplateToolWidget(QWidget* parent_ = nullptr); |
| 29 |
~TemplateToolWidget() override; |
| 30 |
|
| 31 |
void setAtomicNumber(unsigned char atomicNum); |
| 32 |
unsigned char atomicNumber() const; |
| 33 |
|
| 34 |
void setFormalCharge(int charge); |
| 35 |
signed char formalCharge() const; |
| 36 |
|
| 37 |
void setCoordination(unsigned char geometry); |
| 38 |
unsigned char coordination() const; |
| 39 |
QString coordinationString() const; |
| 40 |
|
| 41 |
unsigned char ligand() const; |
| 42 |
QString ligandString() const; |
| 43 |
|
| 44 |
int denticity() const; |
| 45 |
std::vector<size_t>& selectedUIDs(); |
| 46 |
|
| 47 |
int currentTab() const; |
| 48 |
void setCurrentTab(int index); |
| 49 |
|
| 50 |
void setGroup(const QString& groupName); |
| 51 |
void setLigand(const QString& ligandName); |
| 52 |
|
| 53 |
private slots: |
| 54 |
void elementChanged(int index); |
| 55 |
void updateElementCombo(); |
| 56 |
void addUserElement(unsigned char element); |
| 57 |
void elementSelectedFromTable(int element); |
| 58 |
void selectElement(unsigned char element); |
| 59 |
|
| 60 |
void coordinationChanged(int index); |
| 61 |
|
| 62 |
void typeChanged(int index); |
| 63 |
void ligandChanged(int index); |
| 64 |
void groupChanged(int index); |
| 65 |
|
| 66 |
void otherLigandInsert(const QString& fileName, bool crystal); |
| 67 |
|
| 68 |
private: |
| 69 |
void buildElements(); |
| 70 |
void buildBondOrders(); |
| 71 |
void saveElements(); |
| 72 |
|
| 73 |
Ui::TemplateToolWidget* m_ui; |
| 74 |
QtGui::InsertFragmentDialog* m_fragmentDialog; |
| 75 |
QtGui::PeriodicTableView* m_elementSelector; |
| 76 |
QList<unsigned char> m_defaultElements; |
| 77 |
QList<unsigned char> m_userElements; |
| 78 |
unsigned char m_currentElement; |
| 79 |
QStringList m_centers; |
| 80 |
QStringList m_ligands; |
| 81 |
QStringList m_groups; |
| 82 |
QString m_ligandPath; |
| 83 |
|
| 84 |
int m_denticity; |
| 85 |
std::vector<size_t> m_selectedUIDs; |
| 86 |
}; |
| 87 |
|
| 88 |
} // namespace QtPlugins |
| 89 |
} // namespace Avogadro |
| 90 |
#endif // AVOGADRO_QTPLUGINS_TEMPLATETOOLWIDGET_H |