| 1 | #ifndef DRAGDROPATOMSDLG_H |
| 2 | #define DRAGDROPATOMSDLG_H |
| 3 | |
| 4 | #include <QtGui> |
| 5 | #include <QDialog> |
| 6 | #include <QPushButton> |
| 7 | #include <QScrollArea> |
| 8 | #include "molecule.h" |
| 9 | #include "chgl.h" |
| 10 | /*! \brief DragAtom is an atom label that can be draged in the 'Inherit Labels' feature. |
| 11 | * |
| 12 | * DragAtom is colored like the element the label refers to and represent the old label of the target molecule that |
| 13 | * should inhereit its labels from an refence molecule with final labels. It behaves like a fridge magnet from the QtDemo examples. |
| 14 | */ |
| 15 | class DragAtom : public QLabel { |
| 16 | public: |
| 17 | DragAtom(const int index,const QString &text, QColor c=Qt::lightGray, QWidget *parent=0); |
| 18 | QString labelText() const;//!< The Label of the DragAtom. |
| 19 | int index() const;//!< The current position index in the list of DragAtoms. |
| 20 | QColor color() const;//!< The Color of the DragAtom |
| 21 | |
| 22 | private: |
| 23 | QString m_labelText; |
| 24 | int m_index; |
| 25 | QColor m_c; |
| 26 | }; |
| 27 | |
| 28 | /*! \brief DragDropAtomsDialog A Dialog for the 'Inherit Labels' feature. |
| 29 | * |
| 30 | * Features two columns of Atom Labels and DragAtoms. The left colomn referes to the final labeled recerence molecule and the |
| 31 | * right one referes to the target molecule which shall be labeled the same way. The DragAtoms of the right column can be draged around the list to |
| 32 | * change the ordereing sequence if the program was not able to assign them correct automatically. |
| 33 | */ |
| 34 | class DragDropAtomsDialog : public QDialog { |
| 35 | Q_OBJECT |
| 36 | public: |
| 37 | DragDropAtomsDialog(ChGL *gl, Molecule &mole, const QList<int> &reference, QList<int> *target, QWidget *parent = 0); |
| 38 | QLineEdit *resiResiClass;//!< A QLineEdit for the residue class which can be 4 letters long or 3 letters to be compatible to the pdb standard. |
| 39 | QSpinBox *resiNrSpin;//!< A QSpinBox |
| 40 | QComboBox *resiFinder;//!< A QComboBox that contains all existing residues found in the sructure. |
| 41 | QPushButton * ok;//!< The Ok Button |
| 42 | QToolButton *zoomIn; |
| 43 | QToolButton *zoomOut; |
| 44 | QToolButton *rotLeft; |
| 45 | QToolButton *rotRight; |
| 46 | QToolButton *rotUp; |
| 47 | QToolButton *rotDown; |
| 48 | ChGL *chgl; |
| 49 | signals: |
| 50 | void pairs(const QString &);//!< When an atom label of the left column is clicked the signal is emitted to select the two atoms in the structure. @param _t1 the atom labels separated by a space. |
| 51 | public slots: |
| 52 | void grossRC(const QString &text);//!< The text passed by this slot is capitalized an passed to the resiResiClass text. @param text Text to be capitalized and passed to resiResiClass.setText() |
| 53 | void renameRNchanged(int ii);//!< called when the resiNrSpin changes the residue number if it is found in the structure the resiResiClass text gets updated and dissabled for user input. @params ii Residue number |
| 54 | void zoomin(); |
| 55 | void zoomout(); |
| 56 | void rotr(); |
| 57 | void rotl(); |
| 58 | void rotu(); |
| 59 | void rotd(); |
| 60 | }; |
| 61 | |
| 62 | /*! \brief DragDropAtoms contains a list of DragAtoms to assign the labels of the reference molecule to the target molecule. |
| 63 | */ |
| 64 | class DragDropAtoms : public QWidget { |
| 65 | Q_OBJECT |
| 66 | public: |
| 67 | DragDropAtoms(Molecule &mole, const QList<int> &reference, QList<int> *target, QWidget *parent = 0); |
| 68 | |
| 69 | signals: |
| 70 | void pairs(const QString &);//!< When an atom label of the left column is clicked the signal is emitted to select the two atoms in the structure. @param _t1 the atom labels separated by a space. |
| 71 | protected: |
| 72 | void dragEnterEvent(QDragEnterEvent *event);//!< When draging of an DragAtom starts... |
| 73 | void dragMoveEvent(QDragMoveEvent *event);//!< When the DragAtom is moved by the mouse... |
| 74 | void dropEvent(QDropEvent *event);//!< When when the DragAtom is released |
| 75 | void mousePressEvent(QMouseEvent *event); |
| 76 | // void mouseMoveEvent(QMouseEvent *event); |
| 77 | private: |
| 78 | int itemheight,current; |
| 79 | QStringList dadas; |
| 80 | Molecule m_mole; |
| 81 | QList<int> *m_target; |
| 82 | QList<int> m_reference; |
| 83 | QList<DragAtom *> dragAtoms; |
| 84 | }; |
| 85 | #endif |