Debian Codegraph @

eacDlg.cpp

raw symbols SCIP
1
2 /****************************************************************************
3 **
4 ** Copyright (C) 2011 Christian B. Huebschle & George M. Sheldrick
5 ** All rights reserved.
6 ** Contact: [email protected]
7 **
8 ** This file is part of the ShelXle
9 **
10 ** This file may be used under the terms of the GNU Lesser
11 ** General Public License version 2.1 as published by the Free Software
12 ** Foundation and appearing in the file COPYING included in the
13 ** packaging of this file. Please review the following information to
14 ** ensure the GNU Lesser General Public License version 2.1 requirements
15 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 **
18 ****************************************************************************/
19 //äöüß needed to keep this file UTF8 QString::fromUtf8("»")
20 #include "eacDlg.h"
21 #include "deprecation.h"
22 #include "opengltestwidget.h"
23 #include <QColorDialog>
24 #include <QPushButton>
25 #include <QFileDialog>
26 #include <QFontDialog>
27 #include <QLineEdit>
28 #include <QLabel>
29 #include <QGroupBox>
30 #include <QDialogButtonBox>
31
32 // #include "glureplace.h"
33 #include "itsme.h"
34 #ifndef GL_MULTISAMPLE
35 #define GL_MULTISAMPLE 0x809D
36 #endif
37
38 /*
39
40 EacGLW::EacGLW(Molecule *externMole, QWidget * parent): QOpenGLWidget(parent){
41 this->setParent(parent);
42 mol=externMole;
43 mol->loadSettings();
44 //printf("EacGLW %p\n",mol);
45 einstellung = new QSettings( QSettings::IniFormat, QSettings::UserScope ,PROGRAM_NAME,mol->mynewnameis ,this);
46 einstellung->beginGroup("Colors");
47 backGroundColor=einstellung->value("BackGroundColor",QColor("lightskyblue")).value<QColor>();
48 labelColor=einstellung->value("LabelColor").value<QColor>();
49 einstellung->endGroup();
50
51 //printf("einstellung %s\n",einstellung->fileName().toStdString().c_str());
52 einstellung->sync();
53 exmin=mol->pmin;
54 exmax=mol->pmax;
55 mol->pmax=0.99;
56 mol->pmin=0.39;
57 //mol->copyAcol(mol->AtomColor,mol->arad,mol->AtomStyle);
58 //mol->loadSettings();
59 proba=50;
60 MyAtom xda;
61 xda.symmGroup=0;
62 xda.hidden=0;
63 xda.part=0;
64 //xda.ownStyle=false;
65 xda.Label="C";
66 xda.pos.x=0;
67 xda.pos.y=0;
68 xda.pos.z=0;
69 xda.uc.m11=0.1;
70 xda.uc.m22=0.07;
71 xda.uc.m33=0.025;
72 xda.uc.m13=xda.uc.m31=0.01;
73 xda.uc.m12=xda.uc.m21=-0.02;
74 xda.uc.m23=xda.uc.m32=0.01;
75 xda.an = 5;
76 xd.append(xda);
77
78 xda.Label="H1(noADP)";
79 xda.pos.x=0.00001;
80 xda.pos.y=0.00001;
81 xda.pos.z=1.0;
82 // xda.ownStyle=true;
83 //xda.style=ATOM_STYLE_NOADP;
84 //xda.rad=mol->arad[0];
85 //xda.color=mol->AtomColor[0];
86 xda.uc.m11=0.05;
87 xda.uc.m22=0.05;
88 xda.uc.m33=0.05;
89 xda.uc.m13=0.0;
90 xda.uc.m12=0.0;
91 xda.uc.m23=0.0;
92 xda.an=0;
93 xd.append(xda);
94
95 xda.Label="H2";
96 //xda.ownStyle=false;
97 xda.pos.x=0.81649658102978810529098386315336;
98 xda.pos.y=-0.4714045208499572479996295714055;
99 xda.pos.z=-0.333333;
100 xda.uc.m11=0.05;
101 xda.uc.m22=0.05;
102 xda.uc.m33=0.05;
103 xda.uc.m13=0.0;
104 xda.uc.m12=0.0;
105 xda.uc.m23=0.0;
106 xda.an=0;
107 xd.append(xda);
108
109 xda.Label="H3";
110 xda.pos.x=0;
111 xda.pos.y=0.94280904169991449599925914281199;
112 xda.pos.z=-0.333333;
113 xda.uc.m11=0.05;
114 xda.uc.m22=0.05;
115 xda.uc.m33=0.05;
116 xda.uc.m13=0.0;
117 xda.uc.m12=0.0;
118 xda.uc.m23=0.0;
119 xda.an=0;
120 xd.append(xda);
121
122 xda.Label="H4";
123 xda.pos.x=-0.81649658102978810529098386315336;
124 xda.pos.y=-0.4714045208499572479996295714055;
125 xda.pos.z=-0.333333;
126 xda.uc.m11=0.05;
127 xda.uc.m22=0.05;
128 xda.uc.m33=0.05;
129 xda.uc.m13=0.0;
130 xda.uc.m12=0.0;
131 xda.uc.m23=0.0;
132 xda.an=0;
133 xd.append(xda);
134 xda.Label="Q1";
135 xda.pos.x=-0.81649658102978810529098386315336;
136 xda.pos.y=-0.4714045208499572479996295714055;
137 xda.pos.z=0.333333;
138 xda.peakHeight=0.91;
139 xda.uc.m11=0.05;
140 xda.uc.m22=0.05;
141 xda.uc.m33=0.05;
142 xda.uc.m13=0.0;
143 xda.uc.m12=0.0;
144 xda.uc.m23=0.0;
145 xda.an=-1;
146 xd.append(xda);
147 xda.Label="Q2";
148 xda.pos.x=0.81649658102978810529098386315336;
149 xda.pos.y=0.4714045208499572479996295714055;
150 xda.pos.z=0.333333;
151 xda.peakHeight=0.41;
152 xda.uc.m11=0.05;
153 xda.uc.m22=0.05;
154 xda.uc.m33=0.05;
155 xda.uc.m13=0.0;
156 xda.uc.m12=0.0;
157 xda.uc.m23=0.0;
158 xda.an=-1;
159 xd.append(xda);
160 xda.Label="Q3";
161 xda.pos.x=0;
162 xda.pos.y=-0.94280904169991449599925914281199;
163 xda.pos.z=0.333333;
164 xda.peakHeight=0.71;
165 xda.uc.m11=0.05;
166 xda.uc.m22=0.05;
167 xda.uc.m33=0.05;
168 xda.uc.m13=0.0;
169 xda.uc.m12=0.0;
170 xda.uc.m23=0.0;
171 xda.an=-1;
172 xd.append(xda);
173 printf("make bonds\n");
174 bonds=mol->connecting(xd,true);
175 xd[0].an=0;//das ist ein ... trick um bindungen vom zentralatom zu den liganden zu erzeugen.
176
177 }
178
179 void EacGLW::qglColor(QColor color) {
180 glColor4d(color.redF(), color.greenF(), color.blueF(), color.alphaF());
181 }
182
183 void EacGLW::renderText(double x, double y, double z, const QString &text){
184 // Identify x and y locations to render text within widget
185 GLdouble textPosX = 0.0, textPosY = 0.0;
186 project(x, y, z, textPosX, textPosY);
187 //printf("%f %f %f -> %f %f\n",x,y,z,textPosX,textPosY);
188 // Render text
189 QPainter painter(this);
190 QFontMetrics mtr(myFont);
191 QRect rc=mtr.boundingRect(text+"L");
192 QImage image(rc.width(),rc.height(), QImage::Format_ARGB32_Premultiplied);
193 image.fill(0);
194 QPainter p;
195 p.begin(&image);
196 p.setPen(labelColor);
197 p.setBackground(Qt::NoBrush);
198 p.setFont(myFont);
199 p.drawText(image.rect(), Qt::AlignCenter, text);
200 p.end();
201 painter.drawImage(textPosX, textPosY-rc.height(), image);
202 painter.end();
203 }
204
205 void EacGLW::setMSAA(bool b){
206 QSurfaceFormat glf = format();
207 printf("samples %d\n", glf.samples());
208 if (b) {
209 glEnable(GL_MULTISAMPLE);
210 }
211 else {
212 glDisable(GL_MULTISAMPLE);;
213 }
214 update();
215 }
216
217 void EacGLW::draw(){
218 //int pr;
219 //glGetIntegerv(GL_CURRENT_PROGRAM,&pr);
220 //printf("@@@%d %d \n",pr,mol->g_program);
221 const GLfloat OBJ_SPE[] = { 0.8f, 0.8f, 0.8f, 1.0f };
222 const GLfloat OBJ_SHIN = 32.0f;
223 glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, OBJ_SPE );
224 glEnable ( GL_COLOR_MATERIAL ) ;
225 glColorMaterial ( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ) ;
226 glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, OBJ_SHIN );
227 static double rtx=2.0;
228 glRotated(rtx/2.5,1.0,0.0,0.0);
229 glRotated(rtx,0.0,0.0,1.0);
230 glRotated(rtx/4.0,0.0,1.0,0.0);
231 rtx+=0.5;
232 mol->dratom=0;
233 glEnable(GL_DEPTH_TEST );
234 glDepthFunc(GL_LEQUAL);
235 mol->monoQrom = false;
236 //mol->nonPositiveDefinite=0;
237 // mol->parthigh=false;
238 glPushMatrix();
239 glScaled( 40, 40, 40 );
240 mol->adp=1;
241 mol->intern=1;
242 mol->tubes=0;
243 glEnable(GL_CULL_FACE);
244 mol->atoms(xd,proba);
245 glDisable(GL_CULL_FACE);
246 if (mol->bondColorStyle){
247 qglColor(mol->bondColor);
248 glDisable(GL_COLOR_MATERIAL);
249 }
250 //printf("bonds %d\n",bonds.size());
251 mol->bonds(bonds);
252 glEnable(GL_COLOR_MATERIAL);
253 glEnable(GL_BLEND);
254 mol->intern=0;
255 mol->dratom=0;
256 //if (!mol->useShaders) mol->atoms(xd,proba);
257 mol->lbond();
258 glDisable(GL_BLEND);
259 glColor3f(0,0,0);
260 glClear( GL_DEPTH_BUFFER_BIT);
261 for (int i=0; i<xd.size();i++){
262 if ((i==1)||(!(mol->AtomStyle[xd[i].an]&ATOM_STYLE_NOLABEL)))
263 renderText( xd.at(i).pos.x,xd.at(i).pos.y,xd.at(i).pos.z, xd.at(i).Label);
264 }
265 glPopMatrix();
266 }
267
268 void EacGLW::initializeGL(){
269 glEnable(GL_LINE_SMOOTH);
270 glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
271
272 timer = new QTimer(this);
273 connect( timer, SIGNAL(timeout()),
274 this, SLOT(update()) );
275 timer->start(20);
276
277 //glEnable(GL_POLYGON_SMOOTH);
278 myFont = QFont("Arial", 24, -1, false);
279 myFont.setStyleStrategy(QFont::NoAntialias);
280 const GLfloat position[] = {100.0f, 100.0f,100.0f,0.0f};
281 const GLfloat diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
282 const GLfloat specular[] = { 1.0f, 0.9f, 0.9f, 1.0f };
283 const GLfloat ambient[] = { 0.4f, 0.4f, 0.4f, 1.0f };
284
285 glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, 1 );
286
287 glLightfv( GL_LIGHT0, GL_POSITION, position );
288 glLightfv( GL_LIGHT0, GL_AMBIENT, ambient );
289 glLightfv( GL_LIGHT0, GL_DIFFUSE, diffuse );
290 glLightfv( GL_LIGHT0, GL_SPECULAR, specular );
291
292 glLightfv( GL_LIGHT1, GL_POSITION, position );
293 glLightfv( GL_LIGHT1, GL_DIFFUSE, diffuse );
294 glLightfv( GL_LIGHT1, GL_AMBIENT, ambient );
295 glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, 1);
296
297 glLightfv( GL_LIGHT2, GL_DIFFUSE, diffuse );
298
299 glLineWidth(2.0);
300 QOpenGLTexture *hbtex = new QOpenGLTexture(QImage(QString(mol->theIconPath+"hbb.png")).mirrored());
301 hbtex->bind();
302 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
303 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
304 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
305 glEnable( GL_LIGHTING );
306 glEnable( GL_LIGHT0 );
307 glDisable(GL_BLEND);
308 glAlphaFunc ( GL_GREATER, 0.01f ) ;
309 glEnable(GL_ALPHA_TEST);
310 glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
311 const GLfloat OBJ_SPE[] = { 1.0f, 1.0f, 1.0f, 1.0f };
312 const GLfloat OBJ_SHIN = 127.0f;
313 glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, OBJ_SPE );
314 glEnable ( GL_COLOR_MATERIAL ) ;
315 glColorMaterial ( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ) ;
316 glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, OBJ_SHIN );
317 glShadeModel( GL_SMOOTH );
318 glEnable(GL_NORMALIZE);
319 glClearColor(0.4f,0.4f,0.4f,1.0f);
320 glEnable(GL_DEPTH_TEST );
321 glDepthFunc(GL_LEQUAL);
322 gluLookAt_(0.0, 200, 50 , 0.0, 0.0, 0.0, 0.0, -100, 400 );
323 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
324 saveProgram=mol->g_Program;
325 mol->g_Program=new QOpenGLShaderProgram(this);
326 mol->g_program=mol->installShader();
327 }
328
329 void EacGLW::resizeGL(int width, int height){
330 retinafktr=devicePixelRatio();// it qt5 this is in in qt6 its qreal!!
331 glViewport(0, 0, width*retinafktr, height*retinafktr);
332 glGetIntegerv(GL_VIEWPORT, vp);
333 glMatrixMode(GL_PROJECTION);
334 glLoadIdentity();
335 //FIXME
336 gluPerspective_( 29.0, (double)width/height, 5.0, 8000.0 );
337 }
338
339 void EacGLW::paintGL(){
340 GLenum err = GL_NO_ERROR;
341 while((err = glGetError()) != GL_NO_ERROR)
342 {
343 printf("eac paintGL %s err=%X\n",glError2String(err).toStdString().c_str(),err);
344 //printf("%s\n",(char*)gluErrorString(err));
345 }
346 glClearColor(backGroundColor.redF(), backGroundColor.greenF(), backGroundColor.blueF(), 1.0);
347 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
348 glViewport(0, 0, QOpenGLWidget::width()*retinafktr, QOpenGLWidget::height()*retinafktr);
349 glGetIntegerv(GL_VIEWPORT, vp);
350 glMatrixMode(GL_PROJECTION);
351 glLoadIdentity();
352 gluPerspective_( 29.0, (double)QOpenGLWidget::width()/QOpenGLWidget::height(), 5.0, 8000.0 );
353 glMatrixMode(GL_MODELVIEW);
354 glPushMatrix();
355 draw();
356 glPopMatrix();
357 }
358
359 void EacGLW::changeAtom(int OZ,bool HisD){
360 xd[0].Label=(HisD)?QString("D"):mol->pse(OZ);
361 xd[0].an=OZ;
362 xd[1].Label=QString("%1(noADP)").arg(xd[0].Label);
363 xd[1].an=OZ;
364 //xd[1].ownStyle=true;
365 //xd[1].style=ATOM_STYLE_NOADP;
366 //xd[1].rad=mol->arad[OZ];
367 //xd[1].color=mol->AtomColor[OZ];
368 update();
369 }
370
371 void EacGLW::colorDLG(){
372 QColor bgcolor;
373 //printf("EacGLW::colorDLG()\n");
374 bool hisd = (psew==NULL)?false:psew->HisD;
375 bgcolor=QColorDialog::getColor(mol->atomColor(xd.at(0).an,hisd), this);
376 if (bgcolor.isValid()) {
377 if (hisd)
378 mol->deuteriumColor=bgcolor;
379 else
380 mol->AtomColor[xd.at(0).an]=bgcolor;
381 mol->AtomColor[xd.at(0).an].setAlpha(63);
382 xd[1].an=xd.at(0).an;
383 einstellung->beginGroup("Atoms");
384 einstellung->beginWriteArray("AtomColors",107);
385 for (int i = 0; i < 107; ++i) {
386 einstellung->setArrayIndex(i);
387 einstellung->setValue("Color", mol->AtomColor[i]);
388 }
389 einstellung->endArray();
390 einstellung->endGroup();
391 einstellung->sync();
392 emit colorchanged(bgcolor);
393
394 }
395 }
396
397
398 */
399 void EacDlg::changeAtom(int OZ,bool HisD){
400 mol->showatoms.first().Label=(HisD)?QString("D"):mol->pse(OZ);
401 mol->showatoms.first().an=OZ;
402 mol->showatoms[1].Label=QString("%1(noADP)").arg(mol->showatoms.first().Label);
403 mol->showatoms[1].an=OZ;
404 updateLEs(OZ,HisD);
405 printf("changeAtom OZ%d\n",OZ);
406 if (!pause4LE) emit statesChanged();
407 //xd[1].ownStyle=true;
408 //xd[1].style=ATOM_STYLE_NOADP;
409 //xd[1].rad=mol->arad[OZ];
410 //xd[1].color=mol->AtomColor[OZ];
411 update();
412 }
413
414 void EacDlg::colorDLG(){
415 QColor bgcolor;
416 //printf("EacGLW::colorDLG()\n");
417 int an = mol->showatoms.first().an;
418 bool hisd = (psew==NULL)?false:psew->HisD;
419 bgcolor=QColorDialog::getColor(mol->atomColor(an,hisd), this);
420 if (bgcolor.isValid()) {
421 if (hisd)
422 mol->deuteriumColor=bgcolor;
423 else
424 mol->AtomColor[an]=bgcolor;
425 mol->AtomColor[an].setAlpha(63);
426 mol->showatoms[1].an=an;
427 einstellung->beginGroup("Atoms");
428 einstellung->beginWriteArray("AtomColors",107);
429 for (int i = 0; i < 107; ++i) {
430 einstellung->setArrayIndex(i);
431 einstellung->setValue("Color", mol->AtomColor[i]);
432 }
433 einstellung->endArray();
434 einstellung->endGroup();
435 einstellung->sync();
436 colorchange(bgcolor);
437 emit colorchanged(bgcolor);
438 }
439 }
440
441
442 void EacDlg::colorchange(QColor bgcolor){
443 colorbut->setStyleSheet(QString(
444 "QPushButton {"
445 "border: 1px solid #000000;"
446 "border-radius: 9px;"
447 "color: %4;"
448 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
449 "}"
450 "QPushButton:hover {"
451 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %2, stop: 0.5 %1, stop: 1 %2);"
452 "}"
453 "QPushButton:flat {"
454 " border: none; /* no border for a flat push button */"
455 "}"
456 )
457 .arg(bgcolor.name())
458 .arg(bgcolor.darker(200).name())
459 .arg(bgcolor.lighter(200).name())
460 .arg((bgcolor.value()<90)?"#ffffff":"#000000"));
461 //printf("colorchange %s\n",bgcolor.name().toStdString().c_str());
462 if (!pause4LE) emit statesChanged();
463 }
464
465 void EacDlg::colorDLG2(){
466 QColor bgcolor;
467 bgcolor = QColorDialog::getColor(mol->bondColor, this, "bond color", QColorDialog::ShowAlphaChannel);
468 if (bgcolor.isValid()) {
469 mol->bondColor=mol->bondColor=bgcolor;
470
471 colorbut2->setStyleSheet(QString(
472 "QPushButton {"
473 "border: 1px solid #000000;"
474 "border-radius: 9px;"
475 "color: %4;"
476 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
477 "}"
478 "QPushButton:hover {"
479 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %2, stop: 0.5 %1, stop: 1 %2);"
480 "}"
481 "QPushButton:flat {"
482 " border: none; /* no border for a flat push button */"
483 "}"
484 )
485 .arg(bgcolor.name())
486 .arg(bgcolor.darker(200).name())
487 .arg(bgcolor.lighter(200).name())
488 .arg((bgcolor.value()<90)?"#ffffff":"#000000"));
489
490 einstellung->beginGroup("Bonds");
491 einstellung->setValue("BondColor",mol->bondColor);
492 einstellung->setValue("BondStyle",mol->bondColorStyle);
493 einstellung->setValue("BondStrength",mol->bondStrength);
494 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
495 einstellung->setValue("enviBondColor",mol->enviBondColor);
496 einstellung->setValue("enviHBColor",mol->enviHBColor);
497 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
498 einstellung->endGroup();
499 }
500 update();
501 }
502
503 void EacDlg::colorDLGLabel(){
504 QPushButton *but = qobject_cast<QPushButton *>(sender());
505 qDebug()<<sender()<<but;
506 QColor bgcolor;
507 bgcolor = QColorDialog::getColor(mol->bondColor, this, "Label color", QColorDialog::ShowAlphaChannel);
508 if (bgcolor.isValid()) {
509 ogl->labelColor=bgcolor;
510 if (but!=nullptr) {
511 QString stsh=QString(
512 "QPushButton {"
513 "border: 1px solid #000000;"
514 "border-radius: 9px;"
515 "color: %1;"
516 "opacity: %2;"
517 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
518 "}"
519 "QPushButton:hover {"
520 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
521 "border: 0px"
522 "}"
523 "QPushButton:flat {"
524 " border: none; /* no border for a flat push button */"
525 "}"
526 )
527 .arg((bgcolor.value()<128)?"#ffffff":"#000000")//1
528 .arg(bgcolor.alphaF(),0,'f')//2
529 .arg(bgcolor.red())//3
530 .arg(bgcolor.green())//4
531 .arg(bgcolor.blue())//5
532 .arg(bgcolor.alpha())//6
533 .arg(bgcolor.darker(200).red())//7
534 .arg(bgcolor.darker(200).green())//8
535 .arg(bgcolor.darker(200).blue())//9
536 .arg(bgcolor.lighter(200).red())//10
537 .arg(bgcolor.lighter(200).green())//11
538 .arg(bgcolor.lighter(200).blue());//12
539 but->setStyleSheet(stsh);
540 }
541 einstellung->beginGroup("Bonds");
542 einstellung->setValue("BondColor",mol->bondColor);
543 einstellung->setValue("BondStyle",mol->bondColorStyle);
544 einstellung->setValue("BondStrength",mol->bondStrength);
545 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
546 einstellung->setValue("enviBondColor",mol->enviBondColor);
547 einstellung->setValue("enviHBColor",mol->enviHBColor);
548 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
549 einstellung->endGroup();
550
551 storeColors();
552 }
553 }
554
555 void EacDlg::colorDLGSLabel(){
556 QPushButton *but = qobject_cast<QPushButton *>(sender());
557 QColor bgcolor;
558 bgcolor = QColorDialog::getColor(mol->bondColor, this, "Selected Label Color", QColorDialog::ShowAlphaChannel);
559 if (bgcolor.isValid()) {
560 ogl->selectedLabelColor=bgcolor;
561 if (but!=nullptr){
562 QString stsh=QString(
563 "QPushButton {"
564 "border: 1px solid #000000;"
565 "border-radius: 9px;"
566 "color: %1;"
567 "opacity: %2;"
568 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
569 "}"
570 "QPushButton:hover {"
571 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
572 "border: 0px"
573 "}"
574 "QPushButton:flat {"
575 " border: none; /* no border for a flat push button */"
576 "}"
577 )
578 .arg((bgcolor.value()<128)?"#ffffff":"#000000")//1
579 .arg(bgcolor.alphaF(),0,'f')//2
580 .arg(bgcolor.red())//3
581 .arg(bgcolor.green())//4
582 .arg(bgcolor.blue())//5
583 .arg(bgcolor.alpha())//6
584 .arg(bgcolor.darker(200).red())//7
585 .arg(bgcolor.darker(200).green())//8
586 .arg(bgcolor.darker(200).blue())//9
587 .arg(bgcolor.lighter(200).red())//10
588 .arg(bgcolor.lighter(200).green())//11
589 .arg(bgcolor.lighter(200).blue());//12
590 but->setStyleSheet(stsh);
591 }
592 einstellung->beginGroup("Bonds");
593 einstellung->setValue("BondColor",mol->bondColor);
594 einstellung->setValue("BondStyle",mol->bondColorStyle);
595 einstellung->setValue("BondStrength",mol->bondStrength);
596 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
597 einstellung->setValue("enviBondColor",mol->enviBondColor);
598 einstellung->setValue("enviHBColor",mol->enviHBColor);
599 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
600 einstellung->endGroup();
601
602 storeColors();
603 }
604 }
605
606 void EacDlg::colorDLGFLabel(){
607 QPushButton *but = qobject_cast<QPushButton *>(sender());
608 QColor bgcolor;
609 bgcolor = QColorDialog::getColor(ogl->focusedLabelColor, this, "Focused Label Color", QColorDialog::ShowAlphaChannel);
610 if (bgcolor.isValid()) {
611 ogl->focusedLabelColor=bgcolor;
612 if (but!=nullptr) {
613 QString stsh=QString(
614 "QPushButton {"
615 "border: 1px solid #000000;"
616 "border-radius: 9px;"
617 "color: %1;"
618 "opacity: %2;"
619 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
620 "}"
621 "QPushButton:hover {"
622 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
623 "border: 0px"
624 "}"
625 "QPushButton:flat {"
626 " border: none; /* no border for a flat push button */"
627 "}"
628 )
629 .arg((bgcolor.value()<128)?"#ffffff":"#000000")//1
630 .arg(bgcolor.alphaF(),0,'f')//2
631 .arg(bgcolor.red())//3
632 .arg(bgcolor.green())//4
633 .arg(bgcolor.blue())//5
634 .arg(bgcolor.alpha())//6
635 .arg(bgcolor.darker(200).red())//7
636 .arg(bgcolor.darker(200).green())//8
637 .arg(bgcolor.darker(200).blue())//9
638 .arg(bgcolor.lighter(200).red())//10
639 .arg(bgcolor.lighter(200).green())//11
640 .arg(bgcolor.lighter(200).blue());//12
641 but->setStyleSheet(stsh);
642 }
643 einstellung->beginGroup("Bonds");
644 einstellung->setValue("BondColor",mol->bondColor);
645 einstellung->setValue("BondStyle",mol->bondColorStyle);
646 einstellung->setValue("BondStrength",mol->bondStrength);
647 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
648 einstellung->setValue("enviBondColor",mol->enviBondColor);
649 einstellung->setValue("enviHBColor",mol->enviHBColor);
650 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
651 einstellung->endGroup();
652
653 storeColors();
654 }
655 }
656
657
658
659 void EacDlg::bgColorDLGLabel(){
660 QPushButton *but = qobject_cast<QPushButton *>(sender());
661 qDebug()<<sender()<<but;
662 QColor bgcolor;
663 bgcolor = QColorDialog::getColor(ogl->labelBGColor, this, "Label color", QColorDialog::ShowAlphaChannel);
664 if (bgcolor.isValid()) {
665 ogl->labelBGColor=bgcolor;
666 if (but!=nullptr) {
667 QString stsh=QString(
668 "QPushButton {"
669 "border: 1px solid #000000;"
670 "border-radius: 9px;"
671 "color: %1;"
672 "opacity: %2;"
673 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
674 "}"
675 "QPushButton:hover {"
676 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
677 "border: 0px"
678 "}"
679 "QPushButton:flat {"
680 " border: none; /* no border for a flat push button */"
681 "}"
682 )
683 .arg((bgcolor.value()<128)?"#ffffff":"#000000")//1
684 .arg(bgcolor.alphaF(),0,'f')//2
685 .arg(bgcolor.red())//3
686 .arg(bgcolor.green())//4
687 .arg(bgcolor.blue())//5
688 .arg(bgcolor.alpha())//6
689 .arg(bgcolor.darker(200).red())//7
690 .arg(bgcolor.darker(200).green())//8
691 .arg(bgcolor.darker(200).blue())//9
692 .arg(bgcolor.lighter(200).red())//10
693 .arg(bgcolor.lighter(200).green())//11
694 .arg(bgcolor.lighter(200).blue());//12
695 but->setStyleSheet(stsh);
696 }
697 einstellung->beginGroup("Bonds");
698 einstellung->setValue("BondColor",mol->bondColor);
699 einstellung->setValue("BondStyle",mol->bondColorStyle);
700 einstellung->setValue("BondStrength",mol->bondStrength);
701 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
702 einstellung->setValue("enviBondColor",mol->enviBondColor);
703 einstellung->setValue("enviHBColor",mol->enviHBColor);
704 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
705 einstellung->endGroup();
706
707 storeColors();
708 }
709 }
710
711 void EacDlg::bgColorDLGSLabel(){
712 QPushButton *but = qobject_cast<QPushButton *>(sender());
713 QColor bgcolor;
714 bgcolor = QColorDialog::getColor(ogl->selectedLabelBGColor, this, "Selected Label Color", QColorDialog::ShowAlphaChannel);
715 if (bgcolor.isValid()) {
716 ogl->selectedLabelBGColor=bgcolor;
717 if (but!=nullptr) {
718 QString stsh=QString(
719 "QPushButton {"
720 "border: 1px solid #000000;"
721 "border-radius: 9px;"
722 "color: %1;"
723 "opacity: %2;"
724 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
725 "}"
726 "QPushButton:hover {"
727 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
728 "border: 0px"
729 "}"
730 "QPushButton:flat {"
731 " border: none; /* no border for a flat push button */"
732 "}"
733 )
734 .arg((bgcolor.value()<128)?"#ffffff":"#000000")//1
735 .arg(bgcolor.alphaF(),0,'f')//2
736 .arg(bgcolor.red())//3
737 .arg(bgcolor.green())//4
738 .arg(bgcolor.blue())//5
739 .arg(bgcolor.alpha())//6
740 .arg(bgcolor.darker(200).red())//7
741 .arg(bgcolor.darker(200).green())//8
742 .arg(bgcolor.darker(200).blue())//9
743 .arg(bgcolor.lighter(200).red())//10
744 .arg(bgcolor.lighter(200).green())//11
745 .arg(bgcolor.lighter(200).blue());//12
746 but->setStyleSheet(stsh);
747 }
748 einstellung->beginGroup("Bonds");
749 einstellung->setValue("BondColor",mol->bondColor);
750 einstellung->setValue("BondStyle",mol->bondColorStyle);
751 einstellung->setValue("BondStrength",mol->bondStrength);
752 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
753 einstellung->setValue("enviBondColor",mol->enviBondColor);
754 einstellung->setValue("enviHBColor",mol->enviHBColor);
755 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
756 einstellung->endGroup();
757
758 storeColors();
759 }
760 }
761
762 void EacDlg::labelColorAlpha(int a){
763 ogl->labelColor.setAlpha(a);
764 QColor color = ogl->labelColor;
765 QString stsh=QString(
766 "QPushButton {"
767 "border: 1px solid #000000;"
768 "border-radius: 9px;"
769 "color: %1;"
770 "opacity: %2;"
771 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
772 "}"
773 "QPushButton:hover {"
774 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
775 "border: 0px"
776 "}"
777 "QPushButton:flat {"
778 " border: none; /* no border for a flat push button */"
779 "}"
780 )
781 .arg((color.value()<128)?"#ffffff":"#000000")//1
782 .arg(color.alphaF(),0,'f')//2
783 .arg(color.red())//3
784 .arg(color.green())//4
785 .arg(color.blue())//5
786 .arg(color.alpha())//6
787 .arg(color.darker(200).red())//7
788 .arg(color.darker(200).green())//8
789 .arg(color.darker(200).blue())//9
790 .arg(color.lighter(200).red())//10
791 .arg(color.lighter(200).green())//11
792 .arg(color.lighter(200).blue());//12
793 colorbutlab->setStyleSheet(stsh);
794 storeColors();
795 }
796 void EacDlg::slabelColorAlpha(int a){
797 ogl->selectedLabelColor.setAlpha(a);
798 QColor color = ogl->selectedLabelColor;
799 QString stsh=QString(
800 "QPushButton {"
801 "border: 1px solid #000000;"
802 "border-radius: 9px;"
803 "color: %1;"
804 "opacity: %2;"
805 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
806 "}"
807 "QPushButton:hover {"
808 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
809 "border: 0px"
810 "}"
811 "QPushButton:flat {"
812 " border: none; /* no border for a flat push button */"
813 "}"
814 )
815 .arg((color.value()<128)?"#ffffff":"#000000")//1
816 .arg(color.alphaF(),0,'f')//2
817 .arg(color.red())//3
818 .arg(color.green())//4
819 .arg(color.blue())//5
820 .arg(color.alpha())//6
821 .arg(color.darker(200).red())//7
822 .arg(color.darker(200).green())//8
823 .arg(color.darker(200).blue())//9
824 .arg(color.lighter(200).red())//10
825 .arg(color.lighter(200).green())//11
826 .arg(color.lighter(200).blue());//12
827 colorbutslab->setStyleSheet(stsh);
828 storeColors();
829 }
830 void EacDlg::flabelColorAlpha(int a){
831 ogl->focusedLabelColor.setAlpha(a);
832 QColor color = ogl->focusedLabelColor;
833 QString stsh=QString(
834 "QPushButton {"
835 "border: 1px solid #000000;"
836 "border-radius: 9px;"
837 "color: %1;"
838 "opacity: %2;"
839 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
840 "}"
841 "QPushButton:hover {"
842 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
843 "border: 0px"
844 "}"
845 "QPushButton:flat {"
846 " border: none; /* no border for a flat push button */"
847 "}"
848 )
849 .arg((color.value()<128)?"#ffffff":"#000000")//1
850 .arg(color.alphaF(),0,'f')//2
851 .arg(color.red())//3
852 .arg(color.green())//4
853 .arg(color.blue())//5
854 .arg(color.alpha())//6
855 .arg(color.darker(200).red())//7
856 .arg(color.darker(200).green())//8
857 .arg(color.darker(200).blue())//9
858 .arg(color.lighter(200).red())//10
859 .arg(color.lighter(200).green())//11
860 .arg(color.lighter(200).blue());//12
861 colorbutflab->setStyleSheet(stsh);
862 storeColors();
863 }
864 void EacDlg::labelBGColorAlpha(int a){
865 ogl->labelBGColor.setAlpha(a);
866 QColor color = ogl->labelBGColor;
867 QString stsh=QString(
868 "QPushButton {"
869 "border: 1px solid #000000;"
870 "border-radius: 9px;"
871 "color: %1;"
872 "opacity: %2;"
873 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
874 "}"
875 "QPushButton:hover {"
876 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
877 "border: 0px"
878 "}"
879 "QPushButton:flat {"
880 " border: none; /* no border for a flat push button */"
881 "}"
882 )
883 .arg((color.value()<128)?"#ffffff":"#000000")//1
884 .arg(color.alphaF(),0,'f')//2
885 .arg(color.red())//3
886 .arg(color.green())//4
887 .arg(color.blue())//5
888 .arg(color.alpha())//6
889 .arg(color.darker(200).red())//7
890 .arg(color.darker(200).green())//8
891 .arg(color.darker(200).blue())//9
892 .arg(color.lighter(200).red())//10
893 .arg(color.lighter(200).green())//11
894 .arg(color.lighter(200).blue());//12
895 bgcolorbutlab->setStyleSheet(stsh);
896 storeColors();
897 }
898 void EacDlg::slabelBGColorAlpha(int a){
899 ogl->selectedLabelBGColor.setAlpha(a);
900 QColor color = ogl->selectedLabelBGColor;
901 QString stsh=QString(
902 "QPushButton {"
903 "border: 1px solid #000000;"
904 "border-radius: 9px;"
905 "color: %1;"
906 "opacity: %2;"
907 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
908 "}"
909 "QPushButton:hover {"
910 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
911 "border: 0px"
912 "}"
913 "QPushButton:flat {"
914 " border: none; /* no border for a flat push button */"
915 "}"
916 )
917 .arg((color.value()<128)?"#ffffff":"#000000")//1
918 .arg(color.alphaF(),0,'f')//2
919 .arg(color.red())//3
920 .arg(color.green())//4
921 .arg(color.blue())//5
922 .arg(color.alpha())//6
923 .arg(color.darker(200).red())//7
924 .arg(color.darker(200).green())//8
925 .arg(color.darker(200).blue())//9
926 .arg(color.lighter(200).red())//10
927 .arg(color.lighter(200).green())//11
928 .arg(color.lighter(200).blue());//12
929 bgcolorbutslab->setStyleSheet(stsh);
930 storeColors();
931 }
932
933 void EacDlg::flabelBGColorAlpha(int a){
934 ogl->focusedLabelBGColor.setAlpha(a);
935 QColor color = ogl->focusedLabelBGColor;
936 QString stsh=QString(
937 "QPushButton {"
938 "border: 1px solid #000000;"
939 "border-radius: 9px;"
940 "color: %1;"
941 "opacity: %2;"
942 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
943 "}"
944 "QPushButton:hover {"
945 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
946 "border: 0px"
947 "}"
948 "QPushButton:flat {"
949 " border: none; /* no border for a flat push button */"
950 "}"
951 )
952 .arg((color.value()<128)?"#ffffff":"#000000")//1
953 .arg(color.alphaF(),0,'f')//2
954 .arg(color.red())//3
955 .arg(color.green())//4
956 .arg(color.blue())//5
957 .arg(color.alpha())//6
958 .arg(color.darker(200).red())//7
959 .arg(color.darker(200).green())//8
960 .arg(color.darker(200).blue())//9
961 .arg(color.lighter(200).red())//10
962 .arg(color.lighter(200).green())//11
963 .arg(color.lighter(200).blue());//12
964 bgcolorbutflab->setStyleSheet(stsh);
965 storeColors();
966 }
967
968
969 void EacDlg::bgColorDLGFLabel(){
970 QPushButton *but = qobject_cast<QPushButton *>(sender());
971 QColor bgcolor;
972 bgcolor = QColorDialog::getColor(ogl->focusedLabelBGColor, this, "Focused Label Color", QColorDialog::ShowAlphaChannel);
973 if (bgcolor.isValid()) {
974 ogl->focusedLabelBGColor=bgcolor;
975 if (but!=nullptr) {
976 QString stsh=QString(
977 "QPushButton {"
978 "border: 1px solid #000000;"
979 "border-radius: 9px;"
980 "color: %1;"
981 "opacity: %2;"
982 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
983 "}"
984 "QPushButton:hover {"
985 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
986 "border: 0px"
987 "}"
988 "QPushButton:flat {"
989 " border: none; /* no border for a flat push button */"
990 "}"
991 )
992 .arg((bgcolor.value()<128)?"#ffffff":"#000000")//1
993 .arg(bgcolor.alphaF(),0,'f')//2
994 .arg(bgcolor.red())//3
995 .arg(bgcolor.green())//4
996 .arg(bgcolor.blue())//5
997 .arg(bgcolor.alpha())//6
998 .arg(bgcolor.darker(200).red())//7
999 .arg(bgcolor.darker(200).green())//8
1000 .arg(bgcolor.darker(200).blue())//9
1001 .arg(bgcolor.lighter(200).red())//10
1002 .arg(bgcolor.lighter(200).green())//11
1003 .arg(bgcolor.lighter(200).blue());//12
1004 but->setStyleSheet(stsh);
1005 }
1006 einstellung->beginGroup("Bonds");
1007 einstellung->setValue("BondColor",mol->bondColor);
1008 einstellung->setValue("BondStyle",mol->bondColorStyle);
1009 einstellung->setValue("BondStrength",mol->bondStrength);
1010 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
1011 einstellung->setValue("enviBondColor",mol->enviBondColor);
1012 einstellung->setValue("enviHBColor",mol->enviHBColor);
1013 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
1014 einstellung->endGroup();
1015
1016 storeColors();
1017 }
1018 }
1019
1020 void EacDlg::colorDLGenvidef(){
1021 QColor bgcolor;
1022 bgcolor=QColorDialog::getColor(mol->enviDefaultColor, this);
1023 if (bgcolor.isValid()) {
1024 mol->enviDefaultColor=mol->enviDefaultColor=bgcolor;
1025
1026 colorbutEdf->setStyleSheet(QString(
1027 "QPushButton {"
1028 "border: 1px solid #000000;"
1029 "border-radius: 9px;"
1030 "color: %4;"
1031 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
1032 "}"
1033 "QPushButton:hover {"
1034 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %2, stop: 0.5 %1, stop: 1 %2);"
1035 "}"
1036 "QPushButton:flat {"
1037 " border: none; /* no border for a flat push button */"
1038 "}"
1039 )
1040 .arg(bgcolor.name())
1041 .arg(bgcolor.darker(200).name())
1042 .arg(bgcolor.lighter(200).name())
1043 .arg((bgcolor.value()<90)?"#ffffff":"#000000"));
1044 einstellung->beginGroup("Bonds");
1045 einstellung->setValue("BondColor",mol->bondColor);
1046 einstellung->setValue("BondStyle",mol->bondColorStyle);
1047 einstellung->setValue("BondStrength",mol->bondStrength);
1048 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
1049 einstellung->setValue("enviBondColor",mol->enviBondColor);
1050 einstellung->setValue("enviHBColor",mol->enviHBColor);
1051 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
1052 einstellung->beginWriteArray("HBondDonors",mol->theseAreDonors.size());
1053 for (int i = 0; i < mol->theseAreDonors.size(); ++i) {
1054 einstellung->setArrayIndex(i);
1055 einstellung->setValue("Element",mol->pse(mol->theseAreDonors.at(i)));
1056 }
1057 einstellung->endArray();
1058
1059 einstellung->beginWriteArray("HBondAcceptors",mol->theseAreAcceptors.size());
1060 for (int i = 0; i < mol->theseAreAcceptors.size(); ++i) {
1061 einstellung->setArrayIndex(i);
1062 einstellung->setValue("Element",mol->pse(mol->theseAreAcceptors.at(i)));
1063 }
1064 einstellung->endArray();
1065 einstellung->endGroup();
1066 }
1067 update();
1068 }
1069
1070 void EacDlg::colorDLGenvibon(){
1071 QColor bgcolor;
1072 bgcolor=QColorDialog::getColor(mol->enviBondColor, this);
1073 if (bgcolor.isValid()) {
1074 mol->enviBondColor=mol->enviBondColor=bgcolor;
1075
1076 colorbutEbo->setStyleSheet(QString(
1077 "QPushButton {"
1078 "border: 1px solid #000000;"
1079 "border-radius: 9px;"
1080 "color: %4;"
1081 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
1082 "}"
1083 "QPushButton:hover {"
1084 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %2, stop: 0.5 %1, stop: 1 %2);"
1085 "}"
1086 "QPushButton:flat {"
1087 " border: none; /* no border for a flat push button */"
1088 "}"
1089 )
1090 .arg(bgcolor.name())
1091 .arg(bgcolor.darker(200).name())
1092 .arg(bgcolor.lighter(200).name())
1093 .arg((bgcolor.value()<90)?"#ffffff":"#000000"));
1094 einstellung->beginGroup("Bonds");
1095 einstellung->setValue("BondColor",mol->bondColor);
1096 einstellung->setValue("BondStyle",mol->bondColorStyle);
1097 einstellung->setValue("BondStrength",mol->bondStrength);
1098 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
1099
1100 einstellung->setValue("enviBondColor",mol->enviBondColor);
1101 einstellung->setValue("enviHBColor",mol->enviHBColor);
1102 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
1103
1104 einstellung->beginWriteArray("HBondDonors",mol->theseAreDonors.size());
1105 for (int i = 0; i < mol->theseAreDonors.size(); ++i) {
1106 einstellung->setArrayIndex(i);
1107 einstellung->setValue("Element",mol->pse(mol->theseAreDonors.at(i)));
1108 }
1109 einstellung->endArray();
1110
1111 einstellung->beginWriteArray("HBondAcceptors",mol->theseAreAcceptors.size());
1112 for (int i = 0; i < mol->theseAreAcceptors.size(); ++i) {
1113 einstellung->setArrayIndex(i);
1114 einstellung->setValue("Element",mol->pse(mol->theseAreAcceptors.at(i)));
1115 }
1116 einstellung->endArray();
1117 einstellung->endGroup();
1118 }
1119 update();
1120 }
1121
1122 void EacDlg::colorDLGenvihbo(){
1123 QColor bgcolor;
1124 bgcolor=QColorDialog::getColor(mol->enviHBColor, this);
1125 if (bgcolor.isValid()) {
1126 mol->enviHBColor=mol->enviHBColor=bgcolor;
1127
1128 colorbutEhb->setStyleSheet(QString(
1129 "QPushButton {"
1130 "border: 1px solid #000000;"
1131 "border-radius: 9px;"
1132 "color: %4;"
1133 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
1134 "}"
1135 "QPushButton:hover {"
1136 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %2, stop: 0.5 %1, stop: 1 %2);"
1137 "}"
1138 "QPushButton:flat {"
1139 " border: none; /* no border for a flat push button */"
1140 "}"
1141 )
1142 .arg(bgcolor.name())
1143 .arg(bgcolor.darker(200).name())
1144 .arg(bgcolor.lighter(200).name())
1145 .arg((bgcolor.value()<90)?"#ffffff":"#000000"));
1146 einstellung->beginGroup("Bonds");
1147 einstellung->setValue("BondColor",mol->bondColor);
1148 einstellung->setValue("BondStyle",mol->bondColorStyle);
1149 einstellung->setValue("BondStrength",mol->bondStrength);
1150 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
1151 einstellung->setValue("enviBondColor",mol->enviBondColor);
1152 einstellung->setValue("enviHBColor",mol->enviHBColor);
1153 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
1154
1155 einstellung->beginWriteArray("HBondDonors",mol->theseAreDonors.size());
1156 for (int i = 0; i < mol->theseAreDonors.size(); ++i) {
1157 einstellung->setArrayIndex(i);
1158 einstellung->setValue("Element",mol->pse(mol->theseAreDonors.at(i)));
1159 }
1160 einstellung->endArray();
1161
1162 einstellung->beginWriteArray("HBondAcceptors",mol->theseAreAcceptors.size());
1163 for (int i = 0; i < mol->theseAreAcceptors.size(); ++i) {
1164 einstellung->setArrayIndex(i);
1165 einstellung->setValue("Element",mol->pse(mol->theseAreAcceptors.at(i)));
1166 }
1167 einstellung->endArray();
1168 einstellung->endGroup();
1169 }
1170 update();
1171 }
1172 /*
1173 void EacGLW::wallA(int st){
1174 if (st) mol->AtomStyle[xd.at(0).an]|=ATOM_STYLE_WALLS;
1175 else if (mol->AtomStyle[xd.at(0).an]&ATOM_STYLE_WALLS) mol->AtomStyle[xd.at(0).an]-=ATOM_STYLE_WALLS;
1176 if (st==Qt::PartiallyChecked) mol->AtomStyle[xd.at(0).an]|=ATOM_STYLE_PLAID;
1177 else if (mol->AtomStyle[xd.at(0).an]&ATOM_STYLE_PLAID) mol->AtomStyle[xd.at(0).an]-=ATOM_STYLE_PLAID;
1178
1179 }
1180
1181 void EacGLW::ringA(int st){
1182 if (st==Qt::PartiallyChecked) mol->AtomStyle[xd.at(0).an]|=ATOM_STYLE_WHITERING;
1183 else if (mol->AtomStyle[xd.at(0).an]&ATOM_STYLE_WHITERING) mol->AtomStyle[xd.at(0).an]-=ATOM_STYLE_WHITERING;
1184 if (st) mol->AtomStyle[xd.at(0).an]|=ATOM_STYLE_RINGS;
1185 else if (mol->AtomStyle[xd.at(0).an]&ATOM_STYLE_RINGS) mol->AtomStyle[xd.at(0).an]-=ATOM_STYLE_RINGS;
1186
1187 }
1188
1189 void EacGLW::spheA(int st){
1190 if (st) mol->AtomStyle[xd.at(0).an]|=ATOM_STYLE_SPHERE;
1191 else if (mol->AtomStyle[xd.at(0).an]&ATOM_STYLE_SPHERE) mol->AtomStyle[xd.at(0).an]-=ATOM_STYLE_SPHERE;
1192
1193 }
1194
1195 void EacGLW::soldA(int st){
1196 if (st) {
1197 mol->AtomStyle[xd.at(0).an]|=ATOM_STYLE_SOLID;
1198 }
1199 else if (mol->AtomStyle[xd.at(0).an]&ATOM_STYLE_SOLID) mol->AtomStyle[xd.at(0).an]-=ATOM_STYLE_SOLID;
1200
1201 }
1202 */
1203
1204 void EacDlg::wallA(int st){
1205 int an = mol->showatoms.first().an;
1206 if (st) mol->AtomStyle[an]|=ATOM_STYLE_WALLS;
1207 else if (mol->AtomStyle[an]&ATOM_STYLE_WALLS) mol->AtomStyle[an]-=ATOM_STYLE_WALLS;
1208 if (st==Qt::PartiallyChecked) mol->AtomStyle[an]|=ATOM_STYLE_PLAID;
1209 else if (mol->AtomStyle[an]&ATOM_STYLE_PLAID) mol->AtomStyle[an]-=ATOM_STYLE_PLAID;
1210 //printf("wallA state %d\n",st);
1211 if (!pause4LE) emit statesChanged();
1212 }
1213
1214 void EacDlg::ringA(int st){
1215 int an = mol->showatoms.first().an;
1216 if (st==Qt::PartiallyChecked) mol->AtomStyle[an]|=ATOM_STYLE_WHITERING;
1217 else if (mol->AtomStyle[an]&ATOM_STYLE_WHITERING) mol->AtomStyle[an]-=ATOM_STYLE_WHITERING;
1218 if (st) mol->AtomStyle[an]|=ATOM_STYLE_RINGS;
1219 else if (mol->AtomStyle[an]&ATOM_STYLE_RINGS) mol->AtomStyle[an]-=ATOM_STYLE_RINGS;
1220 //printf("ringlA state %d\n",st);
1221 if (!pause4LE) emit statesChanged();
1222 }
1223
1224 void EacDlg::spheA(int st){
1225 int an = mol->showatoms.first().an;
1226 if (st) mol->AtomStyle[an]|=ATOM_STYLE_SPHERE;
1227 else if (mol->AtomStyle[an]&ATOM_STYLE_SPHERE) mol->AtomStyle[an]-=ATOM_STYLE_SPHERE;
1228 //printf("spheA state %d\n",st);
1229 if (!pause4LE) emit statesChanged();
1230 }
1231
1232 void EacDlg::soldA(int st){
1233 int an = mol->showatoms.first().an;
1234 if (st) {
1235 mol->AtomStyle[an]|=ATOM_STYLE_SOLID;
1236 }
1237 else if (mol->AtomStyle[an]&ATOM_STYLE_SOLID) mol->AtomStyle[an]-=ATOM_STYLE_SOLID;
1238 //printf("soldA state %d\n",st);
1239 if (!pause4LE) emit statesChanged();
1240 }
1241
1242
1243
1244 void EacDlg::woADP(bool b){
1245 walbx->setDisabled(b);
1246 rinbx->setDisabled(b);
1247 sphbx->setDisabled(b);
1248 sldbx->setDisabled(b);
1249 if (b) {
1250 mol->AtomStyle[mol->showatoms.first().an]|=ATOM_STYLE_NOADP;
1251 sldbx->setChecked(b);
1252 }
1253 else
1254 if (mol->AtomStyle[mol->showatoms.first().an]&ATOM_STYLE_NOADP)
1255 mol->AtomStyle[mol->showatoms.first().an]-=ATOM_STYLE_NOADP;
1256
1257 //printf("woADP state %d OZ %d\n",b,mol->showatoms.first().an);
1258 if (!pause4LE) emit statesChanged();
1259 }
1260
1261 void EacDlg::whitA(int st){
1262 if (st) {
1263 mol->AtomStyle[mol->showatoms.first().an]|=ATOM_STYLE_WHITERING;
1264 }
1265 else if (mol->AtomStyle[mol->showatoms.first().an]&ATOM_STYLE_WHITERING) mol->AtomStyle[mol->showatoms.first().an]-=ATOM_STYLE_WHITERING;
1266 //printf("whitA state %d\n",st);
1267 if (!pause4LE) emit statesChanged();
1268 }
1269
1270 void EacDlg::nolaA(int st){
1271 if (st) {
1272 mol->AtomStyle[mol->showatoms.first().an]|=ATOM_STYLE_NOLABEL;
1273 }
1274 else if (mol->AtomStyle[mol->showatoms.first().an]&ATOM_STYLE_NOLABEL) mol->AtomStyle[mol->showatoms.first().an]-=ATOM_STYLE_NOLABEL;
1275 //printf("nolaA state %d\n",st);
1276 if (!pause4LE) emit statesChanged();
1277 }
1278
1279 void EacDlg::metalA(int st){
1280 if (st) {
1281 mol->AtomStyle[mol->showatoms.first().an]|=ATOM_STYLE_METAL;
1282 }
1283 else if (mol->AtomStyle[mol->showatoms.first().an]&ATOM_STYLE_METAL) mol->AtomStyle[mol->showatoms.first().an]-=ATOM_STYLE_METAL;
1284 //printf("metalA state %d\n",st);
1285 if (!pause4LE) emit statesChanged();
1286 }
1287
1288
1289
1290 void EacDlg::checkWall(){
1291 if (sldbx->checkState()&&(walbx->checkState()))walbx->setCheckState(Qt::Unchecked);
1292 //printf("checkWall\n");
1293 if (!pause4LE) emit statesChanged();
1294 }
1295
1296 void EacDlg::checkSolid(){
1297 if (sldbx->checkState()&&(walbx->checkState()))sldbx->setCheckState(Qt::Unchecked);
1298 //printf("checkSolid\n");
1299 if (!pause4LE) emit statesChanged();
1300 }
1301
1302 void EacDlg::checkBall(){
1303 if (sphbx->checkState())
1304 sldbx->setEnabled(true);
1305 else
1306 sldbx->setEnabled(false);
1307 //printf("checkBall\n");
1308 if (!pause4LE) emit statesChanged();
1309 }
1310
1311 void EacDlg::updateLEs(int OZ,bool HisD){
1312 //printf("updateLEs %d ; H is D%d\n",OZ,HisD);
1313 int an = OZ;
1314 pause4LE = true;
1315 eacKRAD->setValue(mol->Kovalenz_Radien[an]/100.0);
1316 eacRAD->setValue(mol->arad[an]);
1317
1318 rinbx->setCheckState((mol->AtomStyle[an]&ATOM_STYLE_RINGS)?((mol->AtomStyle[OZ]&ATOM_STYLE_WHITERING)?Qt::PartiallyChecked :Qt::Checked):Qt::Unchecked);
1319 sphbx->setCheckState((mol->AtomStyle[an]&ATOM_STYLE_SPHERE)?Qt::Checked:Qt::Unchecked);
1320 sldbx->setCheckState((mol->AtomStyle[an]&ATOM_STYLE_SOLID)?Qt::Checked:Qt::Unchecked);
1321
1322 walbx->setCheckState((mol->AtomStyle[an]&ATOM_STYLE_WALLS)?((mol->AtomStyle[OZ]&ATOM_STYLE_PLAID)?Qt::PartiallyChecked: Qt::Checked):Qt::Unchecked);
1323 nlabx->setCheckState((mol->AtomStyle[an]&ATOM_STYLE_NOLABEL)?Qt::Checked:Qt::Unchecked);
1324 metalic->setCheckState((mol->AtomStyle[an]&ATOM_STYLE_METAL)?Qt::Checked:Qt::Unchecked);
1325 noadp->setChecked((mol->AtomStyle[an]&ATOM_STYLE_NOADP)?true:false);
1326 woADP(noadp->isChecked());
1327 QColor colr=mol->atomColor(an,HisD);
1328
1329 colorbut->setStyleSheet(QString(
1330 "QPushButton {"
1331 "border: 1px solid #000000;"
1332 "border-radius: 9px;"
1333 "color: %4;"
1334 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
1335 "}"
1336 "QPushButton:hover {"
1337 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %2, stop: 0.5 %1, stop: 1 %2);"
1338 "}"
1339 "QPushButton:flat {"
1340 " border: none; /* no border for a flat push button */"
1341 "}"
1342 )
1343 .arg( colr.name())
1344 .arg( colr.darker(200).name())
1345 .arg( colr.lighter(200).name())
1346 .arg((colr.value()<90)?"#ffffff":"#000000"));
1347
1348 pause4LE = false;
1349 emit statesChanged();
1350 update();
1351 }
1352
1353 void EacDlg::probaChanged(int ix){
1354 mol->proba=eacProba->itemData(ix).toInt() ;
1355 //printf("probaChanged %d\n",ix);
1356 if (!pause4LE) emit statesChanged();
1357 update();
1358 }
1359
1360 void EacDlg::unicolor(bool b){
1361 mol->bondColor = mol->bondColor;
1362 mol->bondColorStyle=mol->bondColorStyle=(b)?1:0;
1363 einstellung->beginGroup("Bonds");
1364 einstellung->setValue("BondColor",mol->bondColor);
1365 einstellung->setValue("BondStyle",mol->bondColorStyle);
1366 einstellung->setValue("BondStrength",mol->bondStrength);
1367 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
1368 einstellung->setValue("enviBondColor",mol->enviBondColor);
1369 einstellung->setValue("enviHBColor",mol->enviHBColor);
1370 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
1371
1372 einstellung->beginWriteArray("HBondDonors",mol->theseAreDonors.size());
1373 for (int i = 0; i < mol->theseAreDonors.size(); ++i) {
1374 einstellung->setArrayIndex(i);
1375 einstellung->setValue("Element",mol->pse(mol->theseAreDonors.at(i)));
1376 }
1377 einstellung->endArray();
1378
1379 einstellung->beginWriteArray("HBondAcceptors",mol->theseAreAcceptors.size());
1380 for (int i = 0; i < mol->theseAreAcceptors.size(); ++i) {
1381 einstellung->setArrayIndex(i);
1382 einstellung->setValue("Element",mol->pse(mol->theseAreAcceptors.at(i)));
1383 }
1384 einstellung->endArray();
1385
1386 einstellung->endGroup();
1387 //printf("unicolor %d\n",b);
1388 if (!pause4LE) emit statesChanged();
1389
1390 update();
1391
1392 }
1393
1394 void EacDlg::strengthChanged(double d){
1395 mol->bondStrength=d;
1396 einstellung->beginGroup("Bonds");
1397 einstellung->setValue("BondColor",mol->bondColor);
1398 einstellung->setValue("BondStyle",mol->bondColorStyle);
1399 einstellung->setValue("BondStrength",mol->bondStrength);
1400 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
1401 einstellung->setValue("enviBondColor",mol->enviBondColor);
1402 einstellung->setValue("enviHBColor",mol->enviHBColor);
1403 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
1404
1405 einstellung->beginWriteArray("HBondDonors",mol->theseAreDonors.size());
1406 for (int i = 0; i < mol->theseAreDonors.size(); ++i) {
1407 einstellung->setArrayIndex(i);
1408 einstellung->setValue("Element",mol->pse(mol->theseAreDonors.at(i)));
1409 }
1410 einstellung->endArray();
1411
1412 einstellung->beginWriteArray("HBondAcceptors",mol->theseAreAcceptors.size());
1413 for (int i = 0; i < mol->theseAreAcceptors.size(); ++i) {
1414 einstellung->setArrayIndex(i);
1415 einstellung->setValue("Element",mol->pse(mol->theseAreAcceptors.at(i)));
1416 }
1417 einstellung->endArray();
1418 einstellung->endGroup();
1419 //printf("strengthChanged %f\n",d);
1420 if (!pause4LE) emit statesChanged();
1421 update();
1422 }
1423
1424 void EacDlg::qStrengthChanged(double d){
1425 mol->q_bondWidth=d;
1426 einstellung->beginGroup("Bonds");
1427 einstellung->setValue("BondColor",mol->bondColor);
1428 einstellung->setValue("BondStyle",mol->bondColorStyle);
1429 einstellung->setValue("BondStrength",mol->bondStrength);
1430 einstellung->setValue("Q-BondStrength",mol->q_bondWidth);
1431 einstellung->setValue("enviBondColor",mol->enviBondColor);
1432 einstellung->setValue("enviHBColor",mol->enviHBColor);
1433 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
1434
1435 einstellung->beginWriteArray("HBondDonors",mol->theseAreDonors.size());
1436 for (int i = 0; i < mol->theseAreDonors.size(); ++i) {
1437 einstellung->setArrayIndex(i);
1438 einstellung->setValue("Element",mol->pse(mol->theseAreDonors.at(i)));
1439 }
1440 einstellung->endArray();
1441
1442 einstellung->beginWriteArray("HBondAcceptors",mol->theseAreAcceptors.size());
1443 for (int i = 0; i < mol->theseAreAcceptors.size(); ++i) {
1444 einstellung->setArrayIndex(i);
1445 einstellung->setValue("Element",mol->pse(mol->theseAreAcceptors.at(i)));
1446 }
1447 einstellung->endArray();
1448 einstellung->endGroup();
1449 //printf("qStrengthChanged %f\n",d);
1450 if (!pause4LE) emit statesChanged();
1451 update();
1452 }
1453
1454
1455 void EacDlg::QPeakRadChanged(double d){
1456 mol->qPeakRad=mol->qPeakRad=d;
1457 einstellung->beginGroup("QPeaks");
1458 einstellung->setValue("QPeaksRadius",mol->qPeakRad);
1459 einstellung->endGroup();
1460 //printf("QPeakRadChanged %f\n",d);
1461 if (!pause4LE) emit statesChanged();
1462 //settings...
1463 update();
1464 }
1465
1466 void EacDlg::lodChanged(int d){
1467 ogl->setLOD(d);
1468 mol->LOD = d;
1469 einstellung->beginGroup("Window");
1470 einstellung->setValue("LevelOfDetail",mol->LOD);
1471 einstellung->endGroup();
1472 //printf("lodChaged %d\n",d);
1473 if (!pause4LE) emit statesChanged();
1474 update();
1475 }
1476
1477 void EacDlg::importSettings(){
1478
1479 //printf("createOGL %d\n",__LINE__);
1480 einstellung->beginGroup("Files");
1481 QString dn=einstellung->value("lastFile").toString();
1482 einstellung->endGroup();
1483 if (!dn.isEmpty()) {
1484 dn.replace(QRegularExpression(".ins$"),".ini");
1485 dn.replace(QRegularExpression(".res$"),".ini");
1486 }
1487 QString fn = QFileDialog::getOpenFileName (this,"Exporting atom style settings...",dn,"Settings (*.ini)");
1488 if (fn.isNull())return;
1489 QSettings *eaSettings = new QSettings(fn,QSettings::IniFormat);
1490
1491 //-------------------------
1492 //
1493 eaSettings->beginGroup("Atoms");
1494 int ri=eaSettings->beginReadArray("CovaleceRadii");
1495 for (int i = 0; i < ri; ++i) {
1496 eaSettings->setArrayIndex(i);
1497 mol->Kovalenz_Radien[i]=eaSettings->value("Radius").toInt();
1498 }
1499 eaSettings->endArray();
1500
1501 ri = eaSettings->beginReadArray("BallRadii");
1502 for (int i = 0; i < ri; ++i) {
1503 eaSettings->setArrayIndex(i);
1504 mol->arad[i]=eaSettings->value("Radius").toDouble();
1505 }
1506 eaSettings->endArray();
1507 ri = eaSettings->beginReadArray("AtomStyles");
1508 for (int i = 0; i < ri; ++i) {
1509 eaSettings->setArrayIndex(i);
1510 mol->AtomStyle[i]=eaSettings->value("Style" ).toInt();
1511 }
1512 eaSettings->endArray();
1513 ri = eaSettings->beginReadArray("AtomColors");
1514 for (int i = 0; i < ri; ++i) {
1515 eaSettings->setArrayIndex(i);
1516 mol->AtomColor[i]=eaSettings->value("Color").value<QColor>();
1517 mol->AtomColor[i].setAlphaF(0.25);
1518 }
1519 eaSettings->endArray();
1520 eaSettings->endGroup();
1521
1522 eaSettings->beginGroup("Bonds");
1523 mol->bondColor = eaSettings->value("BondColor").value<QColor>();
1524 mol->bondColorStyle = eaSettings->value("BondStyle").toInt();;
1525 mol->bondStrength = eaSettings->value("BondStrength").toDouble();
1526
1527 mol->enviBondColor=eaSettings->value("enviBondColor",QColor(Qt::darkGreen)).value<QColor>();
1528 mol->enviHBColor=eaSettings->value("enviHBColor",QColor(Qt::darkYellow)).value<QColor>();
1529 mol->enviDefaultColor=eaSettings->value("enviDefaultColor",QColor(Qt::black)).value<QColor>();
1530
1531 eaSettings->endGroup();
1532 delete eaSettings;
1533
1534 //
1535 einstellung->beginGroup("Atoms");
1536 einstellung->beginWriteArray("CovaleceRadii",95);
1537 for (int i = 0; i < 95; ++i) {
1538 einstellung->setArrayIndex(i);
1539 einstellung->setValue("Radius", mol->Kovalenz_Radien[i]);
1540 }
1541 einstellung->endArray();
1542
1543 einstellung->beginWriteArray("BallRadii");
1544 for (int i = 0; i < 109; ++i) {
1545 einstellung->setArrayIndex(i);
1546 einstellung->setValue("Radius",mol->arad[i]);
1547 }
1548 einstellung->endArray();
1549 einstellung->beginWriteArray("AtomStyles",107);
1550 for (int i = 0; i < 107; ++i) {
1551 einstellung->setArrayIndex(i);
1552 einstellung->setValue("Style", mol->AtomStyle[i]);
1553 }
1554 einstellung->endArray();
1555 int asel=psew->selection;
1556 einstellung->beginWriteArray("AtomColors",107);
1557 for (int i = 0; i < 107; ++i) {
1558 einstellung->setArrayIndex(i);
1559 einstellung->setValue("Color", mol->AtomColor[i]);
1560 psew->selection=i;
1561 psew->colorchange(mol->atomColor(i));
1562 }
1563 psew->selection=asel;
1564 einstellung->endArray();
1565 einstellung->endGroup();
1566
1567 einstellung->beginGroup("Bonds");
1568 einstellung->setValue("BondColor",mol->bondColor);
1569 einstellung->setValue("BondStyle",mol->bondColorStyle);
1570 einstellung->setValue("BondStrength",mol->bondStrength);
1571 einstellung->setValue("enviBondColor",mol->enviBondColor);
1572 einstellung->setValue("enviHBColor",mol->enviHBColor);
1573 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
1574 einstellung->beginWriteArray("HBondDonors",mol->theseAreDonors.size());
1575 for (int i = 0; i < mol->theseAreDonors.size(); ++i) {
1576 einstellung->setArrayIndex(i);
1577 einstellung->setValue("Element",mol->pse(mol->theseAreDonors.at(i)));
1578 }
1579 einstellung->endArray();
1580
1581 einstellung->beginWriteArray("HBondAcceptors",mol->theseAreAcceptors.size());
1582 for (int i = 0; i < mol->theseAreAcceptors.size(); ++i) {
1583 einstellung->setArrayIndex(i);
1584 einstellung->setValue("Element",mol->pse(mol->theseAreAcceptors.at(i)));
1585 }
1586 einstellung->endArray();
1587
1588 einstellung->endGroup();
1589 //--------------------------------------
1590 }
1591
1592 void EacDlg::exportSettings(){
1593 einstellung->beginGroup("Files");
1594 QString dn=einstellung->value("lastFile").toString();
1595 einstellung->endGroup();
1596 if (!dn.isEmpty()) {
1597 dn.replace(QRegularExpression(".ins$"),".ini");
1598 dn.replace(QRegularExpression(".res$"),".ini");
1599 }
1600 QString fn = QFileDialog::getSaveFileName (this,"Exporting atom style settings...",dn,"Settings (*.ini)");
1601 QSettings *eaSettings = new QSettings(fn,QSettings::IniFormat);
1602 //-------------------------
1603 //
1604 eaSettings->beginGroup("Atoms");
1605 eaSettings->beginWriteArray("CovaleceRadii",95);
1606 for (int i = 0; i < 95; ++i) {
1607 eaSettings->setArrayIndex(i);
1608 eaSettings->setValue("Radius", mol->Kovalenz_Radien[i]);
1609 }
1610 eaSettings->endArray();
1611
1612 eaSettings->beginWriteArray("BallRadii");
1613 for (int i = 0; i < 109; ++i) {
1614 eaSettings->setArrayIndex(i);
1615 eaSettings->setValue("Radius",mol->arad[i]);
1616 }
1617 eaSettings->endArray();
1618 eaSettings->beginWriteArray("AtomStyles",107);
1619 for (int i = 0; i < 107; ++i) {
1620 eaSettings->setArrayIndex(i);
1621 eaSettings->setValue("Style", mol->AtomStyle[i]);
1622 }
1623 eaSettings->endArray();
1624 eaSettings->beginWriteArray("AtomColors",107);
1625 for (int i = 0; i < 107; ++i) {
1626 eaSettings->setArrayIndex(i);
1627 eaSettings->setValue("Color", mol->AtomColor[i]);
1628 }
1629 eaSettings->endArray();
1630 eaSettings->endGroup();
1631
1632 eaSettings->beginGroup("Bonds");
1633 eaSettings->setValue("BondColor",mol->bondColor);
1634 eaSettings->setValue("BondStyle",mol->bondColorStyle);
1635 eaSettings->setValue("BondStrength",mol->bondStrength);
1636 eaSettings->setValue("enviBondColor",mol->enviBondColor);
1637 eaSettings->setValue("enviHBColor",mol->enviHBColor);
1638 eaSettings->setValue("enviDefaultColor",mol->enviDefaultColor);
1639
1640 eaSettings->setValue("HBondMaxDist",mol->hbdist());
1641 eaSettings->value("HBondMaxAng",mol->hbangl());
1642 eaSettings->endGroup();
1643 delete eaSettings;
1644 //--------------------------------------
1645 //
1646 }
1647
1648 void EacDlg::kradChanged(double d){
1649 mol->Kovalenz_Radien[psew->selection]=mol->Kovalenz_Radien[psew->selection]=(int)(d*100);
1650 einstellung->beginGroup("Atoms");
1651 einstellung->beginWriteArray("CovaleceRadii",95);
1652 for (int i = 0; i < 95; ++i) {
1653 einstellung->setArrayIndex(i);
1654 einstellung->setValue("Radius", mol->Kovalenz_Radien[i]);
1655 }
1656 einstellung->endArray();
1657 einstellung->endGroup();
1658 einstellung->sync();
1659 //printf("kradChanged %f\n",d);
1660 if (!pause4LE) emit statesChanged();
1661 update();
1662 }
1663
1664 void EacDlg::hbdistChanged(double d){
1665 einstellung->beginGroup("Bonds");
1666 mol->setHBondMaxDist(eacHBDist->value());
1667 einstellung->setValue("HBondMaxDist",eacHBDist->value());
1668 mol->setHBondMaxAngl(eacHBAngl->value());
1669 einstellung->setValue("HBondMaxAng",eacHBAngl->value());
1670 einstellung->endGroup();
1671 einstellung->sync();
1672 //printf("hbdistChanged %f\n",d);
1673 if (!pause4LE) emit statesChanged();
1674 update();
1675 }
1676
1677 void EacDlg::updateHBElemnts(){
1678 //printf("updateHBElemnts\n");
1679 QStringList accst=accLE->text().simplified().split(",",skipEmptyParts);
1680 mol->theseAreAcceptors.clear();
1681 for (int i=0; i<accst.size();i++){
1682 int an=mol->getOZ(accst.at(i));
1683 if (an>=0) mol->theseAreAcceptors.append(an);
1684 }
1685 QStringList donst=donLE->text().simplified().split(",",skipEmptyParts);
1686 mol->theseAreDonors.clear();
1687 for (int i=0; i<donst.size();i++){
1688 int an=mol->getOZ(donst.at(i));
1689 if (an>=0) mol->theseAreDonors.append(an);
1690 }
1691 donst.clear();
1692 for (int i=0; i<mol->theseAreDonors.size(); i++) donst.append(mol->pse(mol->theseAreDonors.at(i)));
1693 donLE->setText(donst.join(","));
1694 accst.clear();
1695 for (int i=0; i<mol->theseAreAcceptors.size(); i++) accst.append(mol->pse(mol->theseAreAcceptors.at(i)));
1696 accLE->setText(accst.join(","));
1697
1698 einstellung->beginGroup("Bonds");
1699 einstellung->setValue("BondColor",mol->bondColor);
1700 einstellung->setValue("BondStyle",mol->bondColorStyle);
1701 einstellung->setValue("BondStrength",mol->bondStrength);
1702 einstellung->setValue("enviBondColor",mol->enviBondColor);
1703 einstellung->setValue("enviHBColor",mol->enviHBColor);
1704 einstellung->setValue("enviDefaultColor",mol->enviDefaultColor);
1705
1706 einstellung->beginWriteArray("HBondDonors",mol->theseAreDonors.size());
1707 for (int i = 0; i < mol->theseAreDonors.size(); ++i) {
1708 einstellung->setArrayIndex(i);
1709 einstellung->setValue("Element",mol->pse(mol->theseAreDonors.at(i)));
1710 }
1711 einstellung->endArray();
1712
1713 einstellung->beginWriteArray("HBondAcceptors",mol->theseAreAcceptors.size());
1714 for (int i = 0; i < mol->theseAreAcceptors.size(); ++i) {
1715 einstellung->setArrayIndex(i);
1716 einstellung->setValue("Element",mol->pse(mol->theseAreAcceptors.at(i)));
1717 }
1718 einstellung->endArray();
1719 einstellung->endGroup();
1720 //printf("updateHBElemnts \n");
1721 if (!pause4LE) emit statesChanged();
1722 }
1723
1724 void EacDlg::hbanglChanged(double d){
1725 einstellung->beginGroup("Bonds");
1726 mol->setHBondMaxDist(eacHBDist->value());
1727 einstellung->setValue("HBondMaxDist",eacHBDist->value());
1728 mol->setHBondMaxAngl(eacHBAngl->value());
1729 einstellung->setValue("HBondMaxAng",eacHBAngl->value());
1730 einstellung->endGroup();
1731 einstellung->sync();
1732 //printf("hbanglChanged %f\n",d);
1733 if (!pause4LE) emit statesChanged();
1734 update();
1735 }
1736
1737 void EacDlg::radChanged(double d){
1738
1739 mol->arad[psew->selection] = mol->arad[psew->selection] = d;
1740 //eacGLW->xd[1].rad=d;
1741 einstellung->beginGroup("Atoms");
1742
1743 einstellung->beginWriteArray("BallRadii");
1744 for (int i = 0; i < 109; ++i) {
1745 einstellung->setArrayIndex(i);
1746 einstellung->setValue("Radius",mol->arad[i]);
1747 }
1748 einstellung->endArray();
1749 einstellung->endGroup();
1750 einstellung->sync();
1751 //printf("radChanged %f\n",d);
1752 if (!pause4LE) emit statesChanged();
1753 update();
1754 }
1755
1756 void EacDlg::createOGL(){
1757 ogl = new PlayOpenGL(mol);
1758
1759 //ogl->setParent(this);
1760 ogl->setMinimumWidth(510);
1761 ogl->fVertexes.resize(28);
1762 ogl->fNormals.resize(28);
1763 qpv = new QPeakView(this);
1764 qpv->setMinimumWidth(50);
1765 ogl->rotze=0;
1766
1767 connect(qpv, SIGNAL(cutOffChanged(double)), ogl, SLOT(setQpeakCutoff(double)));
1768 connect(qpv,SIGNAL(findQP(double)),ogl,SLOT(highliteQPeak(double)));
1769 connect(ogl,SIGNAL(qpfoci(double)),qpv,SLOT(qpeaksInFocus(double)));
1770
1771 qpv->dark=false;
1772 qpv->update();
1773 //printf("createOGL %d\n",__LINE__);
1774
1775 //QToolBar *vito;
1776 //printf("theIconPath='%s'\n",theIconPath.toStdString().c_str());
1777 vito = new QToolBar(this);
1778 ogl->sfacMenu = new QMenu(tr("Change element to..."));
1779 ogl->selSfacMenu = new QMenu(tr("Change elements of selection to..."));
1780 QAction *a = ogl->h_bonds = vito->addAction(QIcon(theIconPath+"hbrs.svg"),"Toggle H-bonds");
1781 ogl->h_bonds->setCheckable(true);
1782 ogl->h_bonds->setChecked(true);
1783 connect(a,SIGNAL(triggered(bool)), ogl,SLOT(update()));
1784
1785 a=ogl->adp=new QAction(QIcon(theIconPath+"adp.svg"),"ADP");
1786 vito->addAction(ogl->adp);
1787 ogl->adp->setCheckable(true);
1788 ogl->adp->setChecked(true);
1789
1790 connect(a,SIGNAL(triggered(bool)), ogl,SLOT(update()));
1791 a = new QAction(QIcon(theIconPath+"bonds.svg"), "Toggle Bonds");
1792 a->setCheckable(true);
1793 a->setChecked(true);
1794 connect(a,SIGNAL(toggled(bool)), ogl, SLOT(setBonds(bool)));
1795 connect(a,SIGNAL(triggered(bool)), ogl,SLOT(update()));
1796 vito->addAction(a);
1797 a=new QAction(QIcon(theIconPath+"labels.svg"), "Toggle Labels");
1798 a->setCheckable(true);
1799 a->setChecked(true);
1800 connect(a,SIGNAL(toggled(bool)), ogl, SLOT(setLabels(bool)));
1801 connect(a,SIGNAL(triggered(bool)), ogl,SLOT(update()));
1802 vito->addAction(a);
1803 ogl->tubes=new QAction(QIcon(theIconPath+"tubes.svg"),"tubes");
1804 ogl->tubes->setCheckable(true);
1805 ogl->tubes->setChecked(false);
1806
1807 connect(ogl->tubes,SIGNAL(triggered(bool)), ogl,SLOT(update()));
1808
1809 vito->addAction(ogl->tubes);
1810 ogl->ballStick=new QAction(QIcon(theIconPath+"ballstick.svg"),"ballstick");
1811 ogl->ballStick->setCheckable(true);
1812 ogl->ballStick->setChecked(true);
1813 vito->addAction(ogl->ballStick);
1814 connect(ogl->ballStick,SIGNAL(triggered(bool)), ogl,SLOT(update()));
1815
1816 QActionGroup *tubeGroup = new QActionGroup(this);
1817 tubeGroup->addAction(ogl->tubes);
1818 tubeGroup->addAction(ogl->ballStick);
1819 ogl->QPeakLegend=new QAction(QIcon(theIconPath+"qlegend.svg"),"qpeaklegend");
1820 vito->addAction(ogl->QPeakLegend);
1821 ogl->QPeakLegend->setCheckable(true);
1822 ogl->QPeakLegend->setChecked(true);
1823 connect(ogl->QPeakLegend,SIGNAL(toggled(bool)), qpv, SLOT(setVisible(bool)));
1824 ogl->hideHydrogen=new QAction(QIcon(theIconPath+"hideh.svg"),"hide h");
1825 connect(ogl->hideHydrogen,SIGNAL(triggered(bool)), ogl, SLOT(hideHydrogens()));
1826
1827 vito->addAction(ogl->hideHydrogen);
1828 ogl->addBond=new QAction("add bond");
1829 ogl->killBond=new QAction("kill bond");
1830 ogl->clearSelection=new QAction("clear select");
1831 ogl->centerSelection=new QAction("center select");
1832 ogl->hideNotSelection=new QAction("hide not select");
1833 ogl->unhide=new QAction(QIcon(theIconPath+"show.svg"),"unhide");
1834 vito->addAction(ogl->unhide);
1835 connect(ogl->unhide,SIGNAL(triggered(bool)), ogl, SLOT(showHidden()));
1836 ogl->invhide=new QAction("invert hide");
1837 //vito->addAction(ogl->invhide);
1838 //printf("createOGL %d\n",__LINE__);
1839 ogl->grow=new QAction("grow");
1840 //vito->addAction(ogl->grow);
1841 ogl->fuse=new QAction("fuse");
1842 //vito->addAction(ogl->fuse);
1843 ogl->shpm1=new QAction(QIcon(theIconPath+"part-1.svg"),"show part -n");
1844 vito->addAction(ogl->shpm1);
1845 connect(ogl->shpm1,SIGNAL(triggered(bool)), ogl,SLOT(update()));
1846 ogl->qPeakBonds=new QAction(QIcon(theIconPath+"qbond.svg"),"q peak bonds");
1847 ogl->qPeakBonds->setCheckable(true);
1848 ogl->qPeakBonds->setChecked(true);
1849 vito->addAction(ogl->qPeakBonds);
1850 ogl->qPeakBonds->setCheckable(true);
1851 ogl->qPeakBonds->setChecked(true);
1852 ogl->toggleDockWidgets=new QAction("tog doc widgets");
1853 //vito->addAction(ogl->toggleDockWidgets);
1854 ogl->delSelAt=new QAction("delete selected atoms");
1855 //vito->addAction(ogl->delSelAt);
1856 ogl->highlightParts=new QAction(QIcon(theIconPath+"parts.svg"),"highlight parts");
1857 ogl->highlightParts->setCheckable(true);
1858 ogl->highlightParts->setChecked(true);
1859
1860 connect(ogl->highlightParts,SIGNAL(triggered(bool)), ogl,SLOT(update()));
1861 vito->addAction(ogl->highlightParts);
1862 a=ogl->centroid=new QAction("centroid");
1863 connect(a,SIGNAL(triggered(bool)), ogl,SLOT(update()));
1864 //vito->addAction(ogl->centroid);
1865 ogl->enviNoQ=new QAction("envi no q");
1866 //vito->addAction(ogl->enviNoQ);
1867 ogl->enviCova=new QAction("envi covalent");
1868 //vito->addAction(ogl->enviCova);
1869 ogl->invSelection=new QAction("invert selection");
1870 //vito->addAction(ogl->invSelection);
1871 ogl->cntrPlot=new QAction("contour plot");
1872 //vito->addAction(ogl->cntrPlot);
1873 ogl->nocntrPlot=new QAction("no contour plot");
1874 //vito->addAction(ogl->nocntrPlot);
1875 ogl->rainbowPlot=new QAction("rainbow contour plot");
1876 //vito->addAction(ogl->rainbowPlot);
1877 ogl->togUnit=new QAction("unit cell");
1878 ogl->toggleOrthoView=new QAction("toggle ortho view");
1879 //vito->addAction(ogl->toggleOrthoView);
1880 a=ogl->hideBeLo=new QAction(QIcon(theIconPath+"ideal.svg"),"hide bede lone objects");
1881 ogl->hideBeLo->setCheckable(true);
1882 ogl->hideBeLo->setChecked(true);
1883 vito->addAction(ogl->hideBeLo);
1884
1885 connect(a,SIGNAL(triggered(bool)), ogl,SLOT(update()));
1886 ogl->shortLabels=new QAction("short labels");
1887 ogl->shortLabels->setCheckable(true);
1888 ogl->shortLabels->setChecked(false);
1889 //vito->addAction(ogl->shortLabels);
1890 ogl->atomLegend=new QAction("atom legend");
1891 //vito->addAction(ogl->atomLegend);
1892 //printf("createOGL %d\n",__LINE__);
1893 einstellung->beginGroup("Colors");
1894 ogl->backGroundColor=einstellung->value("BackGroundColor",QColor("lightskyblue")).value<QColor>();
1895 ogl->labelColor=einstellung->value("LabelColor").value<QColor>();
1896
1897 ogl->backGroundColor=einstellung->value("BackGroundColor",QColor("lightskyblue")).value<QColor>();
1898 ogl->labelColor=einstellung->value("LabelColor").value<QColor>();
1899 ogl->labelBGColor = einstellung->value("LabelBGColor", QColor(0,0,0,0)).value<QColor>();
1900 ogl->focusedLabelBGColor = einstellung->value("focusedLabelBGColor", QColor(0,0,0,10)).value<QColor>();
1901 ogl->focusedLabelColor = einstellung->value("focusedLabelColor", QColor(255,255,0,255)).value<QColor>();
1902 ogl->selectedLabelBGColor = einstellung->value("selectedLabelBGColor", QColor(0,0,0,51)).value<QColor>();
1903 ogl->selectedLabelColor = einstellung->value("selectedLabelColor", QColor(135, 206, 235 ,255)).value<QColor>();
1904
1905 einstellung->endGroup();
1906
1907 einstellung->beginGroup("Window");
1908 if (einstellung->contains("ShortLabels"))
1909 ogl->shortLabels->setChecked(einstellung->value("ShortLabels").toBool());
1910 /*
1911 QAction *togBackGr = new QAction("Toggle Background Gradient");
1912 togBackGr->setCheckable(true);
1913 togBackGr->setChecked(true);
1914 togBackGr->setShortcut(QKeySequence("F6"));
1915 connect(togBackGr,SIGNAL(toggled(bool)),ogl, SLOT(setBGGradient(bool)));
1916 if (einstellung->contains("BackGroundGradient"))
1917 togBackGr->setChecked(einstellung->value("BackGroundGradient").toBool());
1918 ogl->setBGGradient(togBackGr->isChecked());
1919 */
1920 einstellung->endGroup();
1921
1922 connect(ogl, SIGNAL(initialized()), this, SLOT(makedemomol()));
1923 //xd[0].an=0;//das ist ein ... trick um bindungen vom zentralatom zu den liganden zu erzeugen.
1924 }
1925 void EacDlg::makedemomol(){
1926
1927 printf("makedemomol line %d\n",__LINE__);
1928
1929 QFile f(QString(":/shaders/%1").arg(demoMoleculeBox->currentData().toString()));
1930 //QFile f("C:/_DEV/branch/qt6/shaders/example7.shelxle");
1931 //QFile f("C:/_DEV/branch/qt6/shaders/aceclofenac.shelxle");
1932 //QFile f("C:/_DEV/branch/qt6/shaders/mo_sample1.shelxle");
1933 //QFile f("C:/_DEV/branch/qt6/shaders/vino_0m.shelxle");
1934 //QFile f("C:/_DEV/branch/qt6/shaders/testmol1.shelxle");
1935
1936 demo.clear();
1937 f.open(QIODevice::Text|QIODevice::ReadOnly);
1938 QList<QByteArray> all = f.readAll().split('\n');
1939 MyAtom xda;
1940 for (int i=0; i<all.size();i++){
1941 xda = mol->fromAtomString(QString::fromLatin1(all.at(i)));
1942 if (xda.an>-81) demo.append(xda);
1943 }
1944
1945 demo[1].isIso = true;
1946 demo[1].Label = QString("%1(_noADP)").arg(demo.first().Label);
1947 demo[1].style = ATOM_STYLE_NOADP|ATOM_STYLE_NOADP;
1948 //printf("make bonds\n");
1949 mol->showatoms=demo;
1950 mol->pmin=1000.0;
1951 mol->pmax=-1000.0;
1952 for (int i=0; i<demo.size(); i++){
1953 if (demo.at(i).an==-1) {
1954 mol->pmax=qMax(demo.at(i).peakHeight,mol->pmax);
1955 mol->pmin=qMin(demo.at(i).peakHeight,mol->pmin);
1956 }
1957 }
1958
1959 qpv->setMin(mol->pmin);
1960 qpv->setMax(mol->pmax);
1961 changeAtom(5,false);
1962 ogl->updateBondActions();
1963 ogl->updateSceenAtoms();
1964 eacGLO->addWidget(ogl->enviButt,1,4,1,1);
1965 eacGLO->addWidget(ogl->enviSelect,1,5,1,1);
1966 if (timer==nullptr){
1967 timer = new QTimer(this);
1968 connect( timer, SIGNAL(timeout()),
1969 ogl, SLOT(rotY()) );
1970 }
1971 if (idlerot->isChecked()) timer->start(20);
1972 }
1973
1974 EacDlg::EacDlg(Molecule *externMole){
1975 mol=externMole;
1976 exmol = mol->showatoms;
1977 exbond = mol->showbonds;
1978 //printf(PROGRAM_NAME "my new name is:%s:\n",mol->mynewnameis.toStdString().c_str());
1979 if (mol->mynewnameis.startsWith("shelXle")){
1980 theIconPath=QString(":/xle-icons/");
1981 }else{
1982 theIconPath=QString(":/bicons/");
1983 }
1984 setObjectName("Edit Atom Parameters Dialog");
1985 einstellung = new QSettings( QSettings::IniFormat, QSettings::UserScope ,PROGRAM_NAME,mol->mynewnameis ,this);
1986 setWindowTitle("Edit Atom Parameters");
1987 createOGL();
1988
1989 //printf("? %d\n",__LINE__);
1990 eacGLO = new QGridLayout;
1991 //eacCB = new QComboBox;
1992 eacRAD = new QDoubleSpinBox();
1993 eacKRAD = new QDoubleSpinBox();
1994 eacHBDist = new QDoubleSpinBox();
1995 eacHBAngl = new QDoubleSpinBox();
1996 QLabel *rad =new QLabel("Sphere radius");
1997 QLabel *krad =new QLabel("Covalent radius");
1998 QWidget *globalStuff = new QWidget(this);
1999 QWidget *atomStuff = new QWidget(this);
2000 QWidget *labelStuff = new QWidget(this);
2001 QGridLayout *atomlt = new QGridLayout(atomStuff);
2002 QVBoxLayout *glt = new QVBoxLayout();
2003 QGridLayout *llt = new QGridLayout();
2004 eacProba = new QComboBox(this);
2005 eacProba->addItem("90 % Probability",90);
2006 eacProba->addItem("70 % Probability",70);
2007 eacProba->addItem("50 % Probability",50);
2008 eacProba->addItem("30 % Probability",30);
2009 eacProba->addItem("10 % Probability",10);
2010 eacProba->setCurrentIndex(2);
2011 switch (mol->proba){
2012 case 10: eacProba->setCurrentIndex(4);break;
2013 case 30: eacProba->setCurrentIndex(3);break;
2014 case 50: eacProba->setCurrentIndex(2);break;
2015 case 70: eacProba->setCurrentIndex(1);break;
2016 case 90: eacProba->setCurrentIndex(0);break;
2017 }
2018
2019 connect(eacProba,SIGNAL(currentIndexChanged(int)),this,SLOT(probaChanged(int)));
2020 QCheckBox *singleC =new QCheckBox("uni colored bonds");
2021 singleC->setChecked(mol->bondColorStyle);
2022
2023 unicolor(mol->bondColorStyle);
2024
2025 connect(singleC,SIGNAL(toggled(bool)),this,SLOT(unicolor(bool)));
2026 impbut = new QPushButton("Import atom styles");
2027 expbut = new QPushButton("Export atom styles");
2028 connect(impbut,SIGNAL(pressed()),this,SLOT(importSettings()));
2029 connect(expbut,SIGNAL(pressed()),this,SLOT(exportSettings()));
2030 colorbut2 = new QPushButton("Bond Color");
2031 colorbut2->setStyleSheet(QString(
2032 "QPushButton {"
2033 "border: 1px solid #000000;"
2034 "border-radius: 9px;"
2035 "color: %4;"
2036 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
2037 "}"
2038 "QPushButton:hover {"
2039 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %2, stop: 1 %1);"
2040 "border: 0px"
2041 "}"
2042 "QPushButton:flat {"
2043 " border: none; /* no border for a flat push button */"
2044 "}"
2045 )
2046 .arg(mol->bondColor.name())
2047 .arg(mol->bondColor.darker(200).name())
2048 .arg(mol->bondColor.lighter(200).name())
2049 .arg((mol->bondColor.value()<90)?"#ffffff":"#000000"));
2050 connect(colorbut2,SIGNAL(pressed()),this,SLOT(colorDLG2()));
2051 colorbutlab = new QPushButton("Label Color");
2052
2053 QString stsh=QString(
2054 "QPushButton {"
2055 "border: 1px solid #000000;"
2056 "border-radius: 9px;"
2057 "color: %1;"
2058 "opacity: %2;"
2059 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
2060 "}"
2061 "QPushButton:hover {"
2062 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
2063 "border: 0px"
2064 "}"
2065 "QPushButton:flat {"
2066 " border: none; /* no border for a flat push button */"
2067 "}"
2068 )
2069 .arg((ogl->labelColor.value()<128)?"#ffffff":"#000000")//1
2070 .arg(ogl->labelColor.alphaF(),0,'f')//2
2071 .arg(ogl->labelColor.red())//3
2072 .arg(ogl->labelColor.green())//4
2073 .arg(ogl->labelColor.blue())//5
2074 .arg(ogl->labelColor.alpha())//6
2075 .arg(ogl->labelColor.darker(200).red())//7
2076 .arg(ogl->labelColor.darker(200).green())//8
2077 .arg(ogl->labelColor.darker(200).blue())//9
2078 .arg(ogl->labelColor.lighter(200).red())//10
2079 .arg(ogl->labelColor.lighter(200).green())//11
2080 .arg(ogl->labelColor.lighter(200).blue());//12
2081 colorbutlab->setStyleSheet(stsh);
2082 connect(colorbutlab,SIGNAL(pressed()),this,SLOT(colorDLGLabel()));
2083 QSpinBox *sbx = new QSpinBox();
2084 sbx->setRange(0,255);
2085 sbx->setPrefix("Alpha: ");
2086 sbx->setValue(ogl->labelColor.alpha());
2087 connect(sbx,SIGNAL(valueChanged(int)),this,SLOT(labelColorAlpha(int)));
2088 llt->addWidget(new QLabel("Label Color:"),0,0);
2089 llt->addWidget(colorbutlab,0,1);
2090 llt->addWidget(sbx,0,2);
2091 bgcolorbutlab = new QPushButton("Label Background Color");
2092
2093 stsh=QString(
2094 "QPushButton {"
2095 "border: 1px solid #000000;"
2096 "border-radius: 9px;"
2097 "color: %1;"
2098 "opacity: %2;"
2099 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
2100 "}"
2101 "QPushButton:hover {"
2102 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
2103 "border: 0px"
2104 "}"
2105 "QPushButton:flat {"
2106 " border: none; /* no border for a flat push button */"
2107 "}"
2108 )
2109 .arg((ogl->labelBGColor.value()<128)?"#ffffff":"#000000")//1
2110 .arg(ogl->labelBGColor.alphaF(),0,'f')//2
2111 .arg(ogl->labelBGColor.red())//3
2112 .arg(ogl->labelBGColor.green())//4
2113 .arg(ogl->labelBGColor.blue())//5
2114 .arg(ogl->labelBGColor.alpha())//6
2115 .arg(ogl->labelBGColor.darker(200).red())//7
2116 .arg(ogl->labelBGColor.darker(200).green())//8
2117 .arg(ogl->labelBGColor.darker(200).blue())//9
2118 .arg(ogl->labelBGColor.lighter(200).red())//10
2119 .arg(ogl->labelBGColor.lighter(200).green())//11
2120 .arg(ogl->labelBGColor.lighter(200).blue());//12
2121 bgcolorbutlab->setStyleSheet(stsh);
2122 connect(bgcolorbutlab,SIGNAL(pressed()),this,SLOT(bgColorDLGLabel()));
2123 sbx = new QSpinBox();
2124 sbx->setRange(0,255);
2125 sbx->setPrefix("Alpha: ");
2126 sbx->setValue(ogl->labelBGColor.alpha());
2127 connect(sbx,SIGNAL(valueChanged(int)),this,SLOT(labelBGColorAlpha(int)));
2128 llt->addWidget(new QLabel("Label Background Color"),1,0);
2129 llt->addWidget(bgcolorbutlab,1,1);
2130 llt->addWidget(sbx,1,2);
2131
2132 colorbutflab = new QPushButton("Focused Label Color");
2133 stsh=QString(
2134 "QPushButton {"
2135 "border: 1px solid #000000;"
2136 "border-radius: 9px;"
2137 "color: %1;"
2138 "opacity: %2;"
2139 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
2140 "}"
2141 "QPushButton:hover {"
2142 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
2143 "border: 0px"
2144 "}"
2145 "QPushButton:flat {"
2146 " border: none; /* no border for a flat push button */"
2147 "}"
2148 )
2149 .arg((ogl->focusedLabelColor.value()<128)?"#ffffff":"#000000")//1
2150 .arg(ogl->focusedLabelColor.alphaF(),0,'f')//2
2151 .arg(ogl->focusedLabelColor.red())//3
2152 .arg(ogl->focusedLabelColor.green())//4
2153 .arg(ogl->focusedLabelColor.blue())//5
2154 .arg(ogl->focusedLabelColor.alpha())//6
2155 .arg(ogl->focusedLabelColor.darker(200).red())//7
2156 .arg(ogl->focusedLabelColor.darker(200).green())//8
2157 .arg(ogl->focusedLabelColor.darker(200).blue())//9
2158 .arg(ogl->focusedLabelColor.lighter(200).red())//10
2159 .arg(ogl->focusedLabelColor.lighter(200).green())//11
2160 .arg(ogl->focusedLabelColor.lighter(200).blue());//12
2161 colorbutflab->setStyleSheet(stsh);
2162 connect(colorbutflab,SIGNAL(pressed()),this,SLOT(colorDLGFLabel()));
2163 sbx = new QSpinBox();
2164 sbx->setRange(0,255);
2165 sbx->setPrefix("Alpha: ");
2166 sbx->setValue(ogl->focusedLabelColor.alpha());
2167 connect(sbx,SIGNAL(valueChanged(int)),this,SLOT(flabelColorAlpha(int)));
2168 llt->addWidget(new QLabel("Focused Label Color"),2,0);
2169 llt->addWidget(colorbutflab,2,1);
2170 llt->addWidget(sbx,2,2);
2171
2172 bgcolorbutflab = new QPushButton("Focused Label Background Color");
2173 stsh=QString(
2174 "QPushButton {"
2175 "border: 1px solid #000000;"
2176 "border-radius: 9px;"
2177 "color: %1;"
2178 "opacity: %2;"
2179 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
2180 "}"
2181 "QPushButton:hover {"
2182 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
2183 "border: 0px"
2184 "}"
2185 "QPushButton:flat {"
2186 " border: none; /* no border for a flat push button */"
2187 "}"
2188 )
2189 .arg((ogl->focusedLabelBGColor.value()<128)?"#ffffff":"#000000")//1
2190 .arg(ogl->focusedLabelBGColor.alphaF(),0,'f')//2
2191 .arg(ogl->focusedLabelBGColor.red())//3
2192 .arg(ogl->focusedLabelBGColor.green())//4
2193 .arg(ogl->focusedLabelBGColor.blue())//5
2194 .arg(ogl->focusedLabelBGColor.alpha())//6
2195 .arg(ogl->focusedLabelBGColor.darker(200).red())//7
2196 .arg(ogl->focusedLabelBGColor.darker(200).green())//8
2197 .arg(ogl->focusedLabelBGColor.darker(200).blue())//9
2198 .arg(ogl->focusedLabelBGColor.lighter(200).red())//10
2199 .arg(ogl->focusedLabelBGColor.lighter(200).green())//11
2200 .arg(ogl->focusedLabelBGColor.lighter(200).blue());//12
2201 bgcolorbutflab->setStyleSheet(stsh);
2202 connect(bgcolorbutflab,SIGNAL(pressed()),this,SLOT(bgColorDLGFLabel()));
2203 sbx = new QSpinBox();
2204 sbx->setRange(0,255);
2205 sbx->setPrefix("Alpha: ");
2206 sbx->setValue(ogl->focusedLabelBGColor.alpha());
2207 connect(sbx,SIGNAL(valueChanged(int)),this,SLOT(flabelBGColorAlpha(int)));
2208 llt->addWidget(new QLabel("Focused Label Background Color"),3,0);
2209 llt->addWidget(bgcolorbutflab,3,1);
2210 llt->addWidget(sbx,3,2);
2211
2212 colorbutslab = new QPushButton("Selected Label Color");
2213 stsh=QString(
2214 "QPushButton {"
2215 "border: 1px solid #000000;"
2216 "border-radius: 9px;"
2217 "color: %1;"
2218 "opacity: %2;"
2219 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
2220 "}"
2221 "QPushButton:hover {"
2222 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
2223 "border: 0px"
2224 "}"
2225 "QPushButton:flat {"
2226 " border: none; /* no border for a flat push button */"
2227 "}"
2228 )
2229 .arg((ogl->selectedLabelColor.value()<128)?"#ffffff":"#000000")//1
2230 .arg(ogl->selectedLabelColor.alphaF(),0,'f')//2
2231 .arg(ogl->selectedLabelColor.red())//3
2232 .arg(ogl->selectedLabelColor.green())//4
2233 .arg(ogl->selectedLabelColor.blue())//5
2234 .arg(ogl->selectedLabelColor.alpha())//6
2235 .arg(ogl->selectedLabelColor.darker(200).red())//7
2236 .arg(ogl->selectedLabelColor.darker(200).green())//8
2237 .arg(ogl->selectedLabelColor.darker(200).blue())//9
2238 .arg(ogl->selectedLabelColor.lighter(200).red())//10
2239 .arg(ogl->selectedLabelColor.lighter(200).green())//11
2240 .arg(ogl->selectedLabelColor.lighter(200).blue());//12
2241 colorbutslab->setStyleSheet(stsh);
2242 connect(colorbutslab,SIGNAL(pressed()),this,SLOT(colorDLGSLabel()));
2243 sbx = new QSpinBox();
2244 sbx->setRange(0,255);
2245 sbx->setPrefix("Alpha: ");
2246 sbx->setValue(ogl->selectedLabelColor.alpha());
2247 connect(sbx,SIGNAL(valueChanged(int)),this,SLOT(slabelColorAlpha(int)));
2248 llt->addWidget(new QLabel("Selected Label Color"),4,0);
2249 llt->addWidget(colorbutslab,4,1);
2250 llt->addWidget(sbx,4,2);
2251
2252
2253 bgcolorbutslab = new QPushButton("Selected Label Background Color");
2254 stsh=QString(
2255 "QPushButton {"
2256 "border: 1px solid #000000;"
2257 "border-radius: 9px;"
2258 "color: %1;"
2259 "opacity: %2;"
2260 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%10,%11,%12,%6), stop: 1 rgba(%7,%8,%9,%6));"
2261 "}"
2262 "QPushButton:hover {"
2263 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(%3,%4,%5,%6), stop: 0.5 rgba(%7,%8,%9,%6), stop: 1 rgba(%3,%4,%5,%6));"
2264 "border: 0px"
2265 "}"
2266 "QPushButton:flat {"
2267 " border: none; /* no border for a flat push button */"
2268 "}"
2269 )
2270 .arg((ogl->selectedLabelBGColor.value()<128)?"#ffffff":"#000000")//1
2271 .arg(ogl->selectedLabelBGColor.alphaF(),0,'f')//2
2272 .arg(ogl->selectedLabelBGColor.red())//3
2273 .arg(ogl->selectedLabelBGColor.green())//4
2274 .arg(ogl->selectedLabelBGColor.blue())//5
2275 .arg(ogl->selectedLabelBGColor.alpha())//6
2276 .arg(ogl->selectedLabelBGColor.darker(200).red())//7
2277 .arg(ogl->selectedLabelBGColor.darker(200).green())//8
2278 .arg(ogl->selectedLabelBGColor.darker(200).blue())//9
2279 .arg(ogl->selectedLabelBGColor.lighter(200).red())//10
2280 .arg(ogl->selectedLabelBGColor.lighter(200).green())//11
2281 .arg(ogl->selectedLabelBGColor.lighter(200).blue());//12
2282 bgcolorbutslab->setStyleSheet(stsh);
2283 //printf("BG alpha : %f %f %f\n",ogl->labelBGColor.alphaF(),ogl->focusedLabelBGColor.alphaF(),ogl->selectedLabelBGColor.alphaF());
2284 connect(bgcolorbutslab,SIGNAL(pressed()),this,SLOT(bgColorDLGSLabel()));
2285 sbx = new QSpinBox();
2286 sbx->setRange(0,255);
2287 sbx->setPrefix("Alpha: ");
2288 sbx->setValue(ogl->selectedLabelBGColor.alpha());
2289 connect(sbx,SIGNAL(valueChanged(int)),this,SLOT(slabelBGColorAlpha(int)));
2290 llt->addWidget(new QLabel("Selected Label Background Color"),5,0);
2291 llt->addWidget(bgcolorbutslab,5,1);
2292 llt->addWidget(sbx,5,2);
2293 QToolButton *tobu= new QToolButton();
2294 tobu->setDefaultAction(ogl->shortLabels);
2295 tobu->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
2296 connect(ogl->shortLabels,SIGNAL(toggled(bool)), ogl, SLOT(makeLabels()));
2297 llt->addWidget(tobu,6,0);
2298 QPushButton *fontbut = new QPushButton("Change Label Font");
2299 connect(fontbut,SIGNAL(clicked(bool)),this,SLOT(changeLabelFont()));
2300 llt->addWidget(fontbut,6,1);
2301 colorbutEdf = new QPushButton("ENVI default color");
2302 colorbutEdf->setStyleSheet(QString(
2303 "QPushButton {"
2304 "border: 1px solid #000000;"
2305 "border-radius: 9px;"
2306 "color: %4;"
2307 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
2308 "}"
2309 "QPushButton:hover {"
2310 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %2, stop: 1 %1);"
2311 "border: 0px"
2312 "}"
2313 "QPushButton:flat {"
2314 " border: none; /* no border for a flat push button */"
2315 "}"
2316 )
2317 .arg(mol->enviDefaultColor.name())
2318 .arg(mol->enviDefaultColor.darker(200).name())
2319 .arg(mol->enviDefaultColor.lighter(200).name())
2320 .arg((mol->enviDefaultColor.value()<90)?"#ffffff":"#000000"));
2321 connect(colorbutEdf,SIGNAL(pressed()),this,SLOT(colorDLGenvidef()));
2322 colorbutEbo =new QPushButton("ENVI covalent color");
2323 colorbutEbo->setStyleSheet(QString(
2324 "QPushButton {"
2325 "border: 1px solid #000000;"
2326 "border-radius: 9px;"
2327 "color: %4;"
2328 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
2329 "}"
2330 "QPushButton:hover {"
2331 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %2, stop: 1 %1);"
2332 "border: 0px"
2333 "}"
2334 "QPushButton:flat {"
2335 " border: none; /* no border for a flat push button */"
2336 "}"
2337 )
2338 .arg(mol->enviBondColor.name())
2339 .arg(mol->enviBondColor.darker(200).name())
2340 .arg(mol->enviBondColor.lighter(200).name())
2341 .arg((mol->enviBondColor.value()<90)?"#ffffff":"#000000"));
2342 connect(colorbutEbo,SIGNAL(pressed()),this,SLOT(colorDLGenvibon()));
2343
2344 colorbutEhb =new QPushButton("ENVI H-Bond color");
2345 colorbutEhb->setStyleSheet(QString(
2346 "QPushButton {"
2347 "border: 1px solid #000000;"
2348 "border-radius: 9px;"
2349 "color: %4;"
2350 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
2351 "}"
2352 "QPushButton:hover {"
2353 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %2, stop: 1 %1);"
2354 "border: 0px"
2355 "}"
2356 "QPushButton:flat {"
2357 " border: none; /* no border for a flat push button */"
2358 "}"
2359 )
2360 .arg(mol->enviHBColor.name())
2361 .arg(mol->enviHBColor.darker(200).name())
2362 .arg(mol->enviHBColor.lighter(200).name())
2363 .arg((mol->enviHBColor.value()<90)?"#ffffff":"#000000"));
2364 connect(colorbutEhb,SIGNAL(pressed()),this,SLOT(colorDLGenvihbo()));
2365 bondStrength = new QDoubleSpinBox();
2366 bondStrength->setValue(mol->bondStrength);
2367 bondStrength->setDecimals(2);
2368 bondStrength->setSingleStep(0.01);
2369 bondStrength->setToolTip("Bond Strength");
2370 connect(bondStrength,SIGNAL(valueChanged(double)),this,SLOT(strengthChanged(double)) );
2371
2372 q_bondWidth = new QDoubleSpinBox();
2373 q_bondWidth->setValue(mol->q_bondWidth);
2374 q_bondWidth->setDecimals(1);
2375 q_bondWidth->setSingleStep(0.1);
2376 q_bondWidth->setToolTip("Bond Strength");
2377 connect(q_bondWidth,SIGNAL(valueChanged(double)),this,SLOT(qStrengthChanged(double)) );
2378 glt->addWidget(eacProba);
2379 glt->addWidget(singleC);
2380 glt->addWidget(colorbut2);
2381 glt->addWidget(colorbutEdf);
2382 glt->addWidget(colorbutEbo);
2383 glt->addWidget(colorbutEhb);
2384 QHBoxLayout *glt2= new QHBoxLayout();
2385 QHBoxLayout *glt9= new QHBoxLayout();
2386 QHBoxLayout *glt5= new QHBoxLayout();
2387 QHBoxLayout *glt6= new QHBoxLayout();
2388 QHBoxLayout *glt7= new QHBoxLayout();
2389 QHBoxLayout *glt8= new QHBoxLayout();
2390 QStringList accsl;
2391
2392 for (int i=0; i<mol->theseAreAcceptors.size(); i++) accsl.append(mol->pse(mol->theseAreAcceptors.at(i)));
2393 accLE = new QLineEdit(accsl.join(","));
2394 QLabel *accla = new QLabel("H-Bond Acceptor Elements");
2395 glt7->addWidget(accLE);
2396 glt7->addWidget(accla);
2397
2398 QStringList donsl;
2399 for (int i=0; i<mol->theseAreDonors.size(); i++) donsl.append(mol->pse(mol->theseAreDonors.at(i)));
2400 donLE = new QLineEdit(donsl.join(","));
2401 QLabel *donla = new QLabel("H-Bond Donor Elements ");
2402 glt8->addWidget(donLE);
2403 glt8->addWidget(donla);
2404 connect(accLE,SIGNAL(editingFinished()),this,SLOT(updateHBElemnts()));
2405 glt2->addWidget(bondStrength);
2406 glt9->addWidget(q_bondWidth);
2407 glt9->addWidget(new QLabel("Q-Bond line width"));
2408 QLabel *bsl = new QLabel("Bond strength");
2409 QLabel *lodl = new QLabel("Level of detail");
2410 QLabel *qradl = new QLabel("QPeak-size");
2411 glt2->addWidget(bsl);
2412 lodSpinBox = new QSpinBox();
2413 lodSpinBox->setValue(mol->LOD);
2414 lodSpinBox->setMinimum(2);
2415 lodSpinBox->setMaximum(8);
2416 connect(lodSpinBox,SIGNAL(valueChanged(int)),this,SLOT(lodChanged(int)));
2417 QHBoxLayout *glt3= new QHBoxLayout();
2418 glt3->addWidget(lodSpinBox);
2419 glt3->addWidget(lodl);
2420 glt6->addWidget(eacHBDist);
2421 QLabel *hbdl = new QLabel("Max H-Acceptor Distance");
2422 glt6->addWidget(hbdl);
2423 QLabel *hbal = new QLabel("Min H-Bond Angle");
2424 glt5->addWidget(eacHBAngl);
2425 glt5->addWidget(hbal);
2426 QDoubleSpinBox* qPeakSizeSBx = new QDoubleSpinBox();
2427 qPeakSizeSBx->setValue(mol->qPeakRad);
2428 qPeakSizeSBx->setDecimals(3);
2429 qPeakSizeSBx->setMinimum(0.005);
2430 qPeakSizeSBx->setMaximum(0.5);
2431 qPeakSizeSBx->setSingleStep(0.003);
2432 qPeakSizeSBx->setToolTip("QPeak-size");
2433 connect(qPeakSizeSBx,SIGNAL(valueChanged(double)),this,SLOT(QPeakRadChanged(double)) );
2434
2435 demoMoleculeBox = new QComboBox();
2436 demoMoleculeBox->addItem("default molecule1", "trypto.shelxle");
2437 //demoMoleculeBox->addItem("default molecule2", "trypto1.shelxle" );
2438 demoMoleculeBox->addItem("Tartrate", "vino_0m.shelxle" );
2439 demoMoleculeBox->addItem("IDEAL @ Aceclofenac", "aceclofenac.shelxle");
2440 demoMoleculeBox->addItem("CP* rings", "example7.shelxle" );
2441 demoMoleculeBox->addItem("Packed Vitamin C", "ascorbic.shelxle" );
2442 demoMoleculeBox->addItem("dissorder", "mo_sample1.shelxle" );
2443 //demoMoleculeBox->addItem("default molecule5", "testmol1.shelxle" );
2444
2445 connect(demoMoleculeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(makedemomol()));
2446
2447
2448
2449
2450
2451 QHBoxLayout *glt4= new QHBoxLayout();
2452 glt4->addWidget(qPeakSizeSBx);
2453 glt4->addWidget(qradl);
2454
2455 glt->addLayout(glt2);
2456 glt->addLayout(glt3);
2457 glt->addLayout(glt4);
2458 glt->addLayout(glt9);
2459 glt->addLayout(glt5);
2460 glt->addLayout(glt6);
2461 glt->addLayout(glt7);
2462 glt->addLayout(glt8);
2463
2464 globalStuff->setLayout(glt);
2465 labelStuff->setLayout(llt);
2466 walbx = new QCheckBox("Draw intersecting planes");
2467 //walbx->setTristate();
2468 rinbx = new QCheckBox("Draw principal ellipses (check again for black or white)");
2469 rinbx->setTristate();
2470 sphbx = new QCheckBox("Draw ellipsoid surface");
2471 sldbx = new QCheckBox("Solid closed ellipsoid");
2472 noadp = new QCheckBox("No ADP");
2473 metalic = new QCheckBox("Dashed bonds to other elements\n (metals)");
2474 nlabx = new QCheckBox("No label!");
2475 metalic->setCheckState ( Qt::Unchecked);
2476 walbx->setCheckState ( Qt::Checked);
2477 rinbx->setCheckState ( Qt::Checked);
2478 rinbx->setWhatsThis("If this check box is half selected <font color=gray><b>white</b></font> <b>outer lines</b> will be drawn around the ellipsoid which looks nice when the atom has a dark color.<br> If this is fully selected <b>black outer lines</b> will be drawn around the ellipsoid.");
2479 sphbx->setCheckState ( Qt::Checked);
2480 sldbx->setCheckState ( Qt::Unchecked);
2481 nlabx->setCheckState ( Qt::Unchecked);
2482 noadp->setCheckState ( Qt::Unchecked);
2483 psew = new PSEWidget(mol);
2484 psew->selection=5;
2485 idlerot = new QCheckBox("spin demo molecule");
2486 idlerot->setCheckable(true);
2487 idlerot->setChecked(true);
2488 connect(idlerot,SIGNAL(toggled(bool)),this,SLOT(toggleRotation(bool)));
2489 QPushButton *multi = new QPushButton("Style Multiple Elements");
2490 colorbut =new QPushButton("Atom Color");
2491 colorbut->setStyleSheet(QString(
2492 "QPushButton {"
2493 "border: 1px solid #000000;"
2494 "border-radius: 9px;"
2495 "color: %4;"
2496 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %1, stop: 0.5 %3, stop: 1 %2);"
2497 "}"
2498 "QPushButton:hover {"
2499 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %2, stop: 0.5 %1, stop: 1 %2);"
2500 "}"
2501 "QPushButton:flat {"
2502 " border: none; /* no border for a flat push button */"
2503 "}"
2504 )
2505 .arg( mol->atomColor(0,psew->HisD).name())
2506 .arg( mol->atomColor(0,psew->HisD).darker(200).name())
2507 .arg( mol->atomColor(0,psew->HisD).lighter(200).name())
2508 .arg((mol->atomColor(0,psew->HisD).value()<90)?"#ffffff":"#000000"));
2509 eacKRAD->setValue(mol->Kovalenz_Radien[5]/100.0);
2510 eacKRAD->setDecimals(2);
2511 eacKRAD->setSingleStep(0.01);
2512 eacRAD->setValue(mol->arad[5]);
2513 eacRAD->setDecimals(2);
2514 eacRAD->setSingleStep(0.01);
2515 eacHBDist->setValue(mol->hbdist());
2516 eacHBDist->setDecimals(2);
2517 eacHBDist->setSingleStep(0.01);
2518
2519 eacHBAngl->setMaximum(180.0);
2520 eacHBAngl->setMinimum(0.0);
2521 eacHBAngl->setValue(mol->hbangl());
2522 eacHBAngl->setDecimals(1);
2523 eacHBAngl->setSingleStep(0.1);
2524 QTabWidget *tabby = new QTabWidget(this);
2525 tabby->insertTab(0,atomStuff,"Atom settings");
2526 tabby->insertTab(1,globalStuff,"Global settings");
2527 tabby->insertTab(2,labelStuff, "Label settings");
2528
2529 //eacGLO->addWidget(eacGLW,0,0,1,6);
2530 eacGLO->addWidget(qpv,0,0,1,1);
2531 #if defined (Q_OS_MAC)
2532 QWidget *container = QWidget::createWindowContainer(ogl);
2533 // container->setMinimumHeight(400);
2534 eacGLO->addWidget(container,0,1,1,5);
2535 #else
2536 eacGLO->addWidget(ogl,0,1,1,5);
2537 #endif
2538
2539 eacGLO->addWidget(demoMoleculeBox, 1, 0, 1, 2);
2540 eacGLO->addWidget(idlerot, 1, 3, 1,1);
2541 eacGLO->addWidget(tabby,0,6,1,3);
2542 atomlt->addWidget(rad,2,1);
2543 atomlt->addWidget(krad,3,1);
2544 atomlt->addWidget(eacRAD,2,0);
2545 atomlt->addWidget(eacKRAD,3,0);
2546 atomlt->addWidget(psew,0,0,1,3);
2547 atomlt->addWidget(colorbut,1,0,1,3);
2548 atomlt->addWidget(nlabx,4,0);
2549 eacGLO->addWidget(multi,8,1);
2550 eacGLO->addWidget(expbut,8,2);
2551 eacGLO->addWidget(impbut,8,3);
2552 eacGLO->addWidget(vito,8,4,1,4);
2553 atomlt->addWidget(walbx,5,0);
2554 atomlt->addWidget(rinbx,6,0,1,3);
2555 atomlt->addWidget(sphbx,5,1);
2556 atomlt->addWidget(sldbx,5,2);
2557 atomlt->addWidget(noadp,4,1);
2558 atomlt->addWidget(metalic,4,2);
2559 setLayout(eacGLO);
2560 connect(eacHBDist,SIGNAL(valueChanged(double)),this,SLOT(hbdistChanged(double)) );
2561 connect(eacKRAD,SIGNAL(valueChanged(double)),this,SLOT(kradChanged(double)) );
2562 connect(eacRAD,SIGNAL(valueChanged(double)),this,SLOT(radChanged(double)) );
2563 connect(eacHBAngl,SIGNAL(valueChanged(double)),this,SLOT(hbanglChanged(double)) );
2564 connect(multi,SIGNAL(pressed()),this , SLOT(doMulti()));
2565 //connect(psew,SIGNAL(pseSelected(int,bool)), this, SLOT(updateLEs(int,bool)));
2566 //connect(psew,SIGNAL(Htransmutated(int,bool)),this,SLOT(updateLEs(int,bool)));
2567 connect(psew,SIGNAL(pseSelected(int,bool)), this, SLOT(changeAtom(int,bool)));
2568
2569 connect(this,SIGNAL(colorchanged(QColor)),psew,SLOT(colorchange(QColor)));
2570 connect(noadp,SIGNAL(toggled(bool)),this,SLOT(woADP(bool)));
2571
2572 connect(colorbut,SIGNAL(pressed()),this,SLOT(colorDLG()));
2573 connect(walbx,SIGNAL(stateChanged(int)),this,SLOT(wallA(int)));
2574 connect(walbx,SIGNAL(stateChanged(int)),this,SLOT(checkSolid()));
2575 connect(nlabx,SIGNAL(stateChanged(int)),this,SLOT(nolaA(int)));
2576 connect(rinbx,SIGNAL(stateChanged(int)),this,SLOT(ringA(int)));
2577 connect(sphbx,SIGNAL(stateChanged(int)),this,SLOT(spheA(int)));
2578 connect(sphbx,SIGNAL(stateChanged(int)),this,SLOT(checkBall()));
2579 connect(sldbx,SIGNAL(stateChanged(int)),this,SLOT(soldA(int)));
2580 connect(sldbx,SIGNAL(stateChanged(int)),this,SLOT(checkWall()));
2581 connect(metalic,SIGNAL(stateChanged(int)),this,SLOT(metalA(int)));
2582 // connect(ogl,SIGNAL(initialized()),this,SLOT(updateLEs()));
2583 connect(this,SIGNAL(statesChanged()),this,SLOT(updateShaders()));
2584 //eacGLW->setMSAA(true);
2585
2586 }
2587 void EacDlg::updateShaders(){
2588 //printf("updateShaders\n");
2589 mol->showbonds = mol->connecting(mol->showatoms,true);
2590 ogl->makeAtoms(mol->showatoms);
2591 ogl->makeBonds(mol->showatoms, mol->showbonds, mol->lbonds, mol->theH_Bonds);
2592 ogl->makeLabels();
2593 }
2594
2595
2596 void EacDlg::doMulti(){
2597 MultiStyle *m = new MultiStyle(mol);
2598 if (m->exec()==QDialog::Accepted){
2599 int stt=0;
2600 if (m->sphbx->checkState())stt|=ATOM_STYLE_SPHERE;
2601 if (m->rinbx->checkState())stt|=ATOM_STYLE_RINGS;
2602 if (m->rinbx->checkState()==Qt::PartiallyChecked)stt|=ATOM_STYLE_WHITERING;
2603 if (m->walbx->checkState())stt|=ATOM_STYLE_WALLS;
2604 if (m->walbx->checkState()==Qt::PartiallyChecked)stt|=ATOM_STYLE_PLAID;
2605 if (m->sldbx->checkState())stt|=ATOM_STYLE_SOLID;
2606 if (m->metalic->checkState())stt|=ATOM_STYLE_METAL;
2607 int mi=qMin(m->start->currentIndex(),m->end->currentIndex()),
2608 ma=qMax(m->start->currentIndex(),m->end->currentIndex());
2609 for (int i=mi;i<=ma;i++){
2610 mol->AtomStyle[i]=stt;
2611 }
2612 emit statesChanged();
2613 }
2614 }
2615
2616 MultiStyle::MultiStyle(Molecule *externMole){
2617 mol=externMole;
2618 setWindowTitle("Multiple Elements Styler");
2619 start = new QComboBox();
2620 end = new QComboBox();
2621 start->addItems(mol->thepse());
2622 start->setCurrentIndex(2);
2623 end->addItems(mol->thepse());
2624 end->setCurrentIndex(93);
2625 QLabel *staL =new QLabel("From: ");
2626 QLabel *endL =new QLabel("To: ");
2627 walbx = new QCheckBox("Draw intersecting planes");
2628 //walbx->setTristate();
2629 rinbx = new QCheckBox("Draw principal ellipses");
2630 rinbx->setTristate();
2631 sphbx = new QCheckBox("Draw ellipsoid surface");
2632 sldbx = new QCheckBox("Solid ellipsoid");
2633 metalic = new QCheckBox("Dashed Bonds to others");
2634 metalic->setCheckState ( Qt::Unchecked);
2635 walbx->setCheckState ( Qt::Checked);
2636 rinbx->setCheckState ( Qt::Checked);
2637 sphbx->setCheckState ( Qt::Checked);
2638 sldbx->setCheckState ( Qt::Unchecked);
2639 QGridLayout *eacGLO = new QGridLayout;
2640 eacGLO->addWidget(staL,0,0,1,1,Qt::AlignRight);
2641 eacGLO->addWidget(endL,0,2,1,1,Qt::AlignRight);
2642 eacGLO->addWidget(start,0,1);
2643 eacGLO->addWidget(end,0,3);
2644 eacGLO->addWidget(walbx,1,0);
2645 eacGLO->addWidget(rinbx,1,1);
2646 eacGLO->addWidget(sphbx,1,2);
2647 eacGLO->addWidget(sldbx,1,3);
2648 eacGLO->addWidget(metalic,1,4);
2649 connect(start,SIGNAL(currentIndexChanged(int)),this,SLOT(commonDefault()));
2650 connect(end,SIGNAL(currentIndexChanged(int)),this,SLOT(commonDefault()));
2651 commonDefault();
2652 connect(walbx,SIGNAL(stateChanged(int)),this,SLOT(checkSolid()));
2653 connect(sphbx,SIGNAL(stateChanged(int)),this,SLOT(checkBall()));
2654 connect(sldbx,SIGNAL(stateChanged(int)),this,SLOT(checkWall()));
2655 QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
2656 connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
2657 connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
2658 eacGLO->addWidget(buttonBox,2,0,1,5);
2659 // eacGLO->addWidget(,1,);
2660 setLayout(eacGLO);
2661 }
2662 void MultiStyle::commonDefault(){
2663 int
2664 mi=qMin(start->currentIndex(),end->currentIndex()),
2665 ma=qMax(start->currentIndex(),end->currentIndex());
2666 int stt=mol->AtomStyle[mi];
2667 int fstt=stt;
2668 for (int i=mi;i<=ma;i++){
2669 printf("%s %d %X\n",mol->pse(i).toStdString().c_str(),i,mol->AtomStyle[i]);
2670 if (mol->AtomStyle[i] != stt) {
2671 stt=-1;
2672 break;
2673 }
2674 }
2675 printf("commonDefault %s %s %X %X\n",mol->pse(mi).toStdString().c_str(),mol->pse(ma).toStdString().c_str(),stt,fstt);
2676 if (stt!=-1){
2677 /* if (m->sphbx->checkState())stt|=ATOM_STYLE_SPHERE;
2678 if (m->rinbx->checkState())stt|=ATOM_STYLE_RINGS;
2679 if (m->rinbx->checkState()==Qt::PartiallyChecked)stt|=ATOM_STYLE_WHITERING;
2680 if (m->walbx->checkState())stt|=ATOM_STYLE_WALLS;
2681 if (m->walbx->checkState()==Qt::PartiallyChecked)stt|=ATOM_STYLE_PLAID;
2682 if (m->sldbx->checkState())stt|=ATOM_STYLE_SOLID;
2683 if (m->metalic->checkState())stt|=ATOM_STYLE_METAL;*/
2684 metalic->setCheckState((stt&ATOM_STYLE_METAL)? Qt::Checked: Qt::Unchecked);
2685 walbx->setCheckState((stt&ATOM_STYLE_WALLS)? Qt::Checked: Qt::Unchecked);
2686 rinbx->setCheckState((stt&ATOM_STYLE_RINGS)? (stt&ATOM_STYLE_WHITERING)? Qt::PartiallyChecked: Qt::Checked: Qt::Unchecked);
2687 sphbx->setCheckState((stt&ATOM_STYLE_SPHERE)? Qt::Checked: Qt::Unchecked);
2688 sldbx->setCheckState((stt&ATOM_STYLE_SOLID)? Qt::Checked: Qt::Unchecked);
2689 update();
2690 }
2691
2692 }
2693 void MultiStyle::checkWall(){
2694 if (sldbx->checkState()&&(walbx->checkState()))walbx->setCheckState(Qt::Unchecked);
2695 }
2696
2697 void MultiStyle::checkSolid(){
2698 if (sldbx->checkState()&&(walbx->checkState()))sldbx->setCheckState(Qt::Unchecked);
2699 }
2700
2701 void MultiStyle::checkBall(){
2702 if (sphbx->checkState())sldbx->setEnabled(true);
2703 else sldbx->setEnabled(false);
2704 }
2705
2706 void EacDlg::changeLabelFont(){
2707 bool ok;
2708 QFont font = QFontDialog::getFont(&ok, ogl->myFont, this,"Change Label Font");
2709 if (ok) {
2710 //font.setStyleStrategy(QFont::OpenGLCompatible);
2711 ogl->myFont=font;
2712 einstellung->beginGroup("Fonts");
2713 einstellung->setValue("LabelFont",ogl->myFont);
2714 einstellung->endGroup();
2715 //chgl->updateLabelTextures();
2716 ogl->makeLabels();
2717 ogl->update();
2718 }
2719 }
2720
2721 void EacDlg::reject(){
2722 //printf("reject\n");
2723 timer->stop();
2724 einstellung->beginGroup("Atoms");
2725 einstellung->beginWriteArray("AtomStyles",107);
2726 for (int i = 0; i < 107; ++i) {
2727 einstellung->setArrayIndex(i);
2728 einstellung->setValue("Style", mol->AtomStyle[i]);
2729 }
2730 einstellung->endArray();
2731 einstellung->endGroup();
2732 einstellung->beginGroup("Fonts");
2733 einstellung->setValue("LabelFont",ogl->myFont);
2734 einstellung->endGroup();
2735 //mol->pmin=eacGLW->exmin;
2736 //mol->pmax=eacGLW->exmax;
2737
2738 psew->esm->disconnect();
2739 delete psew->esm;
2740 psew->disconnect();
2741 //eacGLW->disconnect();
2742 this->disconnect();
2743 //ogl->deleteLater();
2744
2745 if (!exmol.isEmpty()){
2746 mol->showatoms=exmol;
2747 mol->showbonds=exbond;
2748 }
2749 //mol->g_Program->release();
2750 //mol->g_Program->deleteLater();
2751 //mol->g_Program=eacGLW->saveProgram;
2752 //delete eacGLW;
2753 done(QDialog::Rejected);
2754 }
2755
2756 void EacDlg::accept(){
2757 printf("accept\n");
2758 done(QDialog::Accepted);
2759 }
2760
2761 /*
2762 void EacGLW::project(double x, double y, double z, GLdouble &tx, GLdouble &ty){
2763 makeCurrent();
2764 GLdouble model[16];
2765 GLdouble proj[16];
2766 GLint viewport[4];
2767 glGetIntegerv(GL_VIEWPORT, viewport);
2768 glGetDoublev( GL_PROJECTION_MATRIX , (double*)proj );
2769 glGetDoublev( GL_MODELVIEW_MATRIX, (double*)model );
2770 V3 pos(x,y,z);
2771 posTo2D(pos, model, proj, viewport, tx, ty, retinafktr);
2772 }
2773
2774 inline void EacGLW::transform_point(GLdouble out[4], const GLdouble m[16], const GLdouble in[4]) {
2775 #define M(row,col) m[col*4+row]
2776 out[0] =
2777 M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * in[3];
2778 out[1] =
2779 M(1, 0) * in[0] + M(1, 1) * in[1] + M(1, 2) * in[2] + M(1, 3) * in[3];
2780 out[2] =
2781 M(2, 0) * in[0] + M(2, 1) * in[1] + M(2, 2) * in[2] + M(2, 3) * in[3];
2782 out[3] =
2783 M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * in[3];
2784 #undef M
2785 }
2786 inline bool EacGLW::posTo2D(V3 obj,
2787 const GLdouble model[16], const GLdouble proj[16], const GLint viewport[4],
2788 GLdouble &winx, GLdouble &winy,double retinafktr) {
2789 GLdouble in[4], out[4];
2790
2791 in[0] = obj.x;
2792 in[1] = obj.y;
2793 in[2] = obj.z;
2794 in[3] = 1.0;
2795 transform_point(out, model, in);
2796 transform_point(in, proj, out);
2797
2798 if (in[3] == 0.0) return false;
2799
2800 in[0] /= in[3];
2801 in[1] /= in[3];
2802 in[2] /= in[3];
2803
2804 winx = viewport[0] + (1 + in[0]) * viewport[2] / 2;
2805 winy = viewport[1] + (1 - in[1]) * viewport[3] / 2;
2806 winx/=retinafktr;
2807 winy/=retinafktr;
2808 return true;
2809
2810 }
2811 */