Debian Codegraph @

dsrgui.h

raw symbols SCIP
1 /*
2 ----------------------------------------------------------------------------
3 "THE BEER-WARE LICENSE" (Revision 42):
4 <[email protected]> wrote this file. As long as you retain
5 this notice you can do whatever you want with this stuff. If we meet some day,
6 and you think this stuff is worth it, you can buy me a beer in return.
7 Daniel Kratzert
8 ----------------------------------------------------------------------------
9 */
10
11 #ifndef DSRGUI_H
12 #define DSRGUI_H
13
14 #include <QtGui>
15 #if (QT_VERSION >= 0x050000)
16 #include <QtWidgets>
17 #endif
18 #include <QDialog>
19 #include <QModelIndex>
20 #include <QNetworkAccessManager>
21 //#include <QNetworkSession>
22 //#include <QTcpServer>
23 //#include <QTcpSocket>
24 //#include <QUdpSocket>
25
26 class Window;
27 class Molecule;
28 class DSRGlWindow;
29 class DSREditWindow;
30
31 typedef struct DSRMol {
32 // Data structure to hold the information getting from "DSR -ah name"
33 QString tag; //!< the name tag
34 QString comment; //!< the name or first comment
35 QString source; //!< the source or reference
36 QList<double> cell; //!< unit cell
37 QString residue; //!< residue class
38 QString dbtype; //!< "dsr_db" or "dsr_usr_db"
39 QStringList restr; //!< list of restraints
40 QVector<QStringList> atoms; //!< list of atoms
41 } DSRMol;
42
43 class DSRGui : public QWidget
44 {
45 Q_OBJECT
46
47 public:
48 explicit DSRGui(Molecule *mole, QString shelxlPath, Window *parent = 0);
49 DSREditWindow *editwindow; //!< A window where you can edit a fragment
50 DSRMol *header; //!< The dsr header information of the current fragment
51 QStringList SHXkeywords; //!< A StringList of all SHELXL cards
52 virtual ~DSRGui();
53 DSRGlWindow *mygl; //!< The 3D window of the current fragment
54 void checkForDSRexecutable(QSplashScreen *splash);
55 QSize minimumSizeHint() const;
56 QSize sizeHint() const;
57 static QString textWrap(QString inText, QString indent = QString("=\n ")); //! wraps text after specific amount of characters with a line ending
58 private:
59 QString getSelectedAtomsList(); //!< returns the list of the selected atoms in ShelXle
60 QString getSelectedAtomsCoords(); //!< returns the coordinates of the selected atoms in ShelXle
61 Molecule *m_molecule; //!< A pointer to the molecule object in ShelXle
62 Window *m_shelxle; //!< The Window object of ShelXle
63 QVector<QStringList> *fragmentsList; //!< tag;;fullname;;line number;;db
64 QTextBrowser *outtext; //!< The message output field
65 QTextBrowser *info; //!< Information table with bond distances of fitted fragments
66 QLineEdit *SearchInp; //!< Search input field
67 QLineEdit *occEdit; //!< Input field for the SHELXL occupancy
68 //QLineEdit *resinumEdit; //!< Input field for residue numbers (obsolete, because is automatically determined)
69 QLineEdit *resiclassEdit; //!< Input field for the residue class
70 QGridLayout *mainLayout;
71 QHBoxLayout *editLayout;
72 QGridLayout *optionsLayout1; //!< Layout for the PARt FVAR OCC replace options
73 QVBoxLayout *optionsLayout2; //!< Layout for invert external and rigid group options
74 QVBoxLayout *optionsLayout3; //!< Layout for the residue and user manual options
75 QVBoxLayout *buttonLayout; //!< Layout for fit, export and edit buttons
76 QHBoxLayout *searchLayout;
77 QHBoxLayout *resclassLayout;
78 QHBoxLayout *optionboxes;
79 QGridLayout *glo;
80 QGridLayout *flo;
81 QSpinBox *partspinner; //!< part definition spinbox
82 QSpinBox *fvarspinner; //!< part definition spinbox
83 QPushButton *editButton; //! Button to start the fragment editor
84 QPushButton *openLastButton; //! Button to open the last .res file version before last "DSR -r fileName" run.
85 QPushButton *fitDSRButton; //! Button to fit/transfer the fragment
86 QPushButton *exportFragButton; //! Button to export the Fragment to a .res file
87 QPushButton *splitButton; //! Button to split the currently selected atoms on two positions
88 QGroupBox *groupBox1;
89 QGroupBox *groupBox2;
90 QGroupBox *residueOptionsBox;
91 QLabel *searchLabel, //!< The label for the search field
92 *partLabel,
93 *occLabel,
94 *resiLabel,
95 *classLabel,
96 *resiTextLabel,
97 *usermanualLabel;
98 QPushButton *fvarLabel; //! label for the free variable spinner (Is a button to be clickable)
99 QTableView *fragmentTableView; //!< list of fragments from DSR
100 QString dsrResulttext; //!< Resulting output text of a dsr run
101 QString *resnumbertext; //!< The text string that tells about the residue number
102 QCheckBox *runExtBox, //!< Enable external restraints button
103 *invertFragBox, //!< enable/disable inverted fragment coordinates
104 *dfixBox, //!< enable/disable rigid group instead of restraints
105 *replaceModeBox, //!< enable replace mode
106 *rigidBox, //!< keep fragment as rigid AFIX 9 group and omit restraints
107 *splitModeBox; //!< Only for CF6 fragment. Enables spitting of pivot carbon atom
108 bool runext; //!< Should DSR write external restraints file?
109 bool invert; //!< Should DSr invert the coordinates?
110 bool norefine;
111 bool replace;
112 bool rigid;
113 bool resiIsEnabled;
114 bool cf3;
115 bool splitmode;
116 QString export_dir;
117 QString target_atoms;
118 QString dfix;
119 QString part;
120 QString fvarocc;
121 QString resistr;
122 QString resinum;
123 QString resiclass;
124 QString fragmentNameTag;
125 QString dsrpath, dsr_db_path;
126 QString combiDSRline;
127 void displayFragmentsList(QVector<QStringList>, QString);
128 QString getDSRDir();
129 QString getDSRdbDir();
130 void connect_signals_and_slots();
131 void setToolTips();
132 QString m_shelxlPath;
133 QString dsrVersion;
134 QNetworkAccessManager *net_manager;
135 QNetworkReply *reply; //! reply from the net_manager with the version information of DSR
136 void getVersionFromServer();
137 bool runTCPServer();
138 QLabel *statusLabel;
139 //QTcpServer *tcpServer;
140 signals:
141 void optionTextChanged(void);
142 void fragmentSelected(void);
143 void exportDirChanged(QString export_dir);
144 void currentFragmentChanged(DSRMol header);
145 void closed();
146
147 public slots:
148 void aboutDSR();
149 bool listDSRdbFragments(QString fav); // list fragments in the DB
150 void runEditWindow();
151 void setInfo(QString);
152 bool getFragmentHeader(QString frag);
153 int getCharWidth(int numchars);
154 void activateFitButton(void);
155 bool fitDSR(void);
156 void fitDSRExtern(bool checked);
157 void invertFrag(bool checked);
158 void rigid_group(bool checked);
159 void refineOrNot(bool checked);
160 void replaceOrNot(bool checked);
161 void setFragName(QModelIndex name);
162 void searchFragment(QString searchName);
163 bool exportFrag(QString dirname);
164 void DFIX(bool checked);
165 void setPART(int part);
166 void setFvarOcc(void);
167 void setResiClass(QString rclass);
168 void combineOptionstext(void);
169 void setExportDirDialog(void);
170 bool isDSRVersionCorrect(QString version);
171 QStringList readResfile();
172 void resetSelection();
173 int findFVARlines(QStringList *reslist);
174 QVector<int> findDSRLines(QStringList *reslist);
175 int decideDSRInsertLine(QStringList *reslist);
176 QString findFreeResiNumber();
177 QStringList which(QString programName = "dsr");
178 QString loadFavoriteFragment();
179 void writeFavorites(QString name);
180 void updateTarget();
181 void isDSRUpToDate(QNetworkReply* reply);//!< Interpretes the network reply for the check for updates (manual version)
182 void updateDSR(void);
183 void invertFvar();
184 void splitDecide();
185 void splitSelectedAtoms();
186 bool runDSR(QString option, bool showresults=true, QString workdir="");
187 bool open_last_fileversion();
188 //void ReadClientData();
189 protected:
190 virtual void closeEvent(QCloseEvent * event);
191
192 protected slots:
193
194 private slots:
195
196
197
198 };
199
200
201
202
203 #endif // DSRGUI
204