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