9 #include "qwt_arrow_button.h"
17 setWindowTitle( tr(
"Set Analyte Properties" ) );
18 setAttribute ( Qt::WA_DeleteOnClose );
30 QGridLayout*
main =
new QGridLayout(
this );
31 main->setSpacing( 2 );
32 main->setContentsMargins( 2, 2, 2, 2 );
35 QPushButton* pb_delete =
us_pushbutton( tr(
"Remove Current Analyte" ) );
36 QPushButton* pb_edit =
us_pushbutton( tr(
"Edit Current Analyte" ) );
37 QLabel* lb_desc =
us_label( tr(
"Analyte Description:" ) );
44 QLabel* lb_guid =
us_label( tr(
"Global Identifier:" ) );
50 lb_guid->setVisible(
false );
55 QLabel* lb_vbar =
us_label( tr(
"Vbar at 20 " ) +
DEGC +
" (ml/g):" );
59 QLabel* lb_extinction =
us_label( tr(
"Extinction (OD/(mol*cm)):" ) );
60 QLabel* lb_wavelength =
us_label( tr(
"Wavelength (nm):" ) );
66 le_wavelength->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );
71 tr(
"Signal Concentration:" ),
ck_sigConc,
true );
74 tr(
"Analyte is a Product" ),
ck_isProd,
false );
78 tr(
"Molar Concentration:" ),
ck_molConc,
false );
84 QPushButton* pb_sim =
us_pushbutton( tr(
"Simulate s and D" ) );
94 tr(
"Molecular Wt. (mw,S20W)" ),
ck_mw,
true );
96 QLabel* lb_oligomer =
us_label( tr(
"Oligomer:" ) );
103 QFontMetrics fmet( font() );
104 int fwid = fmet.maxWidth();
107 int csizw = cminw + fwid * 2;
112 QGridLayout* lo_f_f0 =
120 tr(
"Sedimentation Coeff. (s,20W)" ),
ck_s );
125 tr(
"Diffusion Coeff. (D,20W)" ),
ck_D );
131 tr(
"Frictional Coeff. (f,20W)" ),
ck_f );
137 tr(
"Conc. Dependency of s (<span>σ</span>):" ) );
143 tr(
"Conc. Dependency of D (<span>δ</span>):" ) );
150 tr(
"Co-sedimenting Solute" ),
ck_co_sed );
159 main->addWidget( pb_new, row, 0, 1, 2 );
160 main->addWidget( pb_delete, row, 2, 1, 2 );
161 main->addWidget( pb_edit, row++, 4, 1, 2 );
162 main->addWidget( lb_desc, row, 0, 1, 2 );
165 main->addWidget( lb_guid, row, 0, 1, 2 );
166 main->addWidget(
le_guid, row++, 2, 1, 4 );
167 main->addWidget( lb_vbar, row, 0, 1, 2 );
168 main->addWidget(
le_vbar, row++, 2, 1, 1 );
169 main->addWidget( lb_extinction, row, 0, 1, 2 );
171 main->addWidget( lb_wavelength, row, 3, 1, 2 );
173 main->addLayout( lo_molConc, row, 0, 1, 2 );
174 main->addWidget(
le_molConc, row++, 2, 1, 1 );
175 main->addLayout( lo_sigConc, row, 0, 1, 2 );
177 main->addLayout( lo_isProd, row++, 3, 1, 3 );
178 main->addWidget( pb_sim, row, 0, 1, 2 );
179 main->addWidget(
cb_shape, row++, 2, 1, 4 );
180 main->addLayout( lo_mw, row, 0, 1, 2 );
181 main->addWidget(
le_mw, row, 2, 1, 1 );
182 main->addWidget( lb_oligomer, row, 3, 1, 2 );
184 main->addLayout( lo_f_f0, row, 0, 1, 2 );
185 main->addWidget(
le_f_f0, row++, 2, 1, 1 );
186 main->addLayout( lo_s, row, 0, 1, 2 );
187 main->addWidget(
le_s, row++, 2, 1, 1 );
188 main->addLayout( lo_D, row, 0, 1, 2 );
189 main->addWidget(
le_D, row++, 2, 1, 1 );
190 main->addLayout( lo_f, row, 0, 1, 2 );
191 main->addWidget(
le_f, row++, 2, 1, 1 );
192 main->addWidget( lb_sigma, row, 0, 1, 2 );
193 main->addWidget(
le_sigma, row, 2, 1, 1 );
194 main->addWidget( lb_delta, row, 3, 1, 2 );
195 main->addWidget(
le_delta, row++, 5, 1, 1 );
197 main->addLayout( lo_co_sed, row++, 3, 1, 3 );
198 main->addWidget( pb_help, row, 0, 1, 2 );
199 main->addWidget( pb_close, row, 2, 1, 2 );
200 main->addWidget( pb_accept, row++, 4, 1, 2 );
203 connect( pb_new, SIGNAL( clicked() ),
205 connect( pb_delete, SIGNAL( clicked() ),
207 connect( pb_edit, SIGNAL( clicked() ),
212 SLOT (
update (
int ) ) );
213 connect(
le_vbar, SIGNAL( editingFinished() ),
217 connect(
ck_molConc, SIGNAL( toggled(
bool ) ),
219 connect(
ck_sigConc, SIGNAL( toggled(
bool ) ),
221 connect(
le_sigConc, SIGNAL( editingFinished() ),
223 connect( pb_sim, SIGNAL( clicked() ),
225 connect(
cb_shape, SIGNAL( currentIndexChanged(
int ) ),
227 connect(
ck_mw, SIGNAL( toggled(
bool ) ),
229 connect(
le_mw, SIGNAL( editingFinished() ),
233 connect(
ck_f_f0, SIGNAL( toggled(
bool ) ),
235 connect(
le_f_f0, SIGNAL( editingFinished () ),
237 connect(
ck_s, SIGNAL( toggled(
bool ) ),
239 connect(
le_s, SIGNAL( editingFinished() ),
241 connect(
ck_D, SIGNAL( toggled(
bool ) ),
243 connect(
le_D, SIGNAL( editingFinished() ),
245 connect(
ck_f, SIGNAL( toggled(
bool ) ),
247 connect(
le_f, SIGNAL( editingFinished () ),
251 connect(
ck_co_sed, SIGNAL( stateChanged(
int ) ),
253 connect( pb_help, SIGNAL( clicked() ),
255 connect( pb_close, SIGNAL( clicked() ),
257 connect( pb_accept, SIGNAL( clicked() ),
290 le_mw ->setEnabled(
false );
292 le_s ->setEnabled(
false );
293 le_D ->setEnabled(
false );
294 le_f ->setEnabled(
false );
299 ck_mw ->setEnabled(
false );
301 ck_s ->setEnabled(
false );
302 ck_D ->setEnabled(
false );
303 ck_f ->setEnabled(
false );
325 connect( dialog, SIGNAL(
use_db (
bool ) ),
329 if ( dialog->exec() == QDialog::Rejected )
351 if ( keys.length() > 0 )
362 qDebug() <<
"Prop: updAna: extinc" << sc->
extinction;
377 if ( row < 0 )
return;
380 int response = QMessageBox::question(
this,
381 tr(
"Delete Analyte?" ),
382 tr(
"Delete the following analyte?\n" ) + item->text(),
383 QMessageBox::Yes, QMessageBox::No );
385 if ( response == QMessageBox::No )
return;
409 if ( row < 0 )
return;
417 le_mw->setText( QString::number( sc->
mw,
'e', 3 ) );
440 if ( oligomer > 1.0 )
444 ck_mw ->setChecked(
true );
446 ck_s ->setChecked(
false );
447 ck_D ->setChecked(
false );
448 ck_f ->setChecked(
false );
455 bool mwuck = !
ck_mw->isChecked();
456 bool scck =
ck_s ->isChecked();
460 ck_mw->setChecked(
true );
461 ck_s ->setChecked(
false );
474 ck_mw->setChecked(
false );
475 ck_s ->setChecked( scck );
484 if ( row < 0 )
return;
487 if ( desc.isEmpty() )
return;
498 lw_components->disconnect( SIGNAL( currentRowChanged(
int ) ) );
501 lw_components->insertItem( row,
new QListWidgetItem( desc ) );
508 SLOT (
update (
int ) ) );
515 if ( row < 0 )
return;
535 if ( row < 0 )
return;
540 int response = QMessageBox::question(
this,
541 tr(
"Remove C0 Data?" ),
542 tr(
"The C0 infomation is loaded.\n"
544 QMessageBox::Yes, QMessageBox::No );
546 if ( response == QMessageBox::Yes )
558 QMessageBox::information(
this,
559 tr(
"UltraScan Information" ),
560 tr(
"Please note:\n\n"
561 "The initial concentration file should have\n"
562 "the following format:\n\n"
563 "radius_value1 concentration_value1\n"
564 "radius_value2 concentration_value2\n"
565 "radius_value3 concentration_value3\n"
567 "radius values smaller than the meniscus or\n"
568 "larger than the bottom of the cell will be\n"
569 "excluded from the concentration vector." ) );
571 QString fn = QFileDialog::getOpenFileName(
574 if ( ! fn.isEmpty() )
578 if ( f.open( QIODevice::ReadOnly | QIODevice::Text ) )
580 QTextStream ts( &f );
594 while ( ! ts.atEnd() )
611 QMessageBox::warning(
this,
612 tr(
"UltraScan Warning" ),
613 tr(
"UltraScan could not open the file specified\n" ) + fn );
623 if ( row < 0 )
return;
659 sc->
f =
le_f ->text().toDouble();
660 sc->
s =
le_s ->text().toDouble();
661 sc->
D =
le_D ->text().toDouble();
667 if ( row < 0 )
return;
672 double signalConc =
le_sigConc ->text().toDouble();
674 if ( extinction > 0.0 )
685 if ( row < 0 )
return;
695 if ( row < 0 )
return;
703 if (
le_guid->text().isEmpty() )
740 sc->
mw =
le_mw ->text().toDouble();
741 sc->
s =
le_s ->text().toDouble();
742 sc->
D =
le_D ->text().toDouble();
743 sc->
f =
le_f ->text().toDouble();
759 le_mw ->setEnabled(
true );
761 le_s ->setEnabled(
true );
762 le_D ->setEnabled(
true );
763 le_f ->setEnabled(
true );
768 ck_mw ->setEnabled(
true );
774 if ( row < 0 )
return;
819 default:
cb_shape->setCurrentIndex( 3 );
break;
823 le_mw ->setText( QString::number( sc->
mw ,
'e', 3 ) );
824 le_f_f0 ->setText( QString::number( sc->
f_f0 ,
'e', 3 ) );
825 le_s ->setText( QString::number( sc->
s ,
'e', 4 ) );
826 le_D ->setText( QString::number( sc->
D ,
'e', 4 ) );
827 le_f ->setText( QString::number( sc->
f ,
'e', 4 ) );
845 if ( row < 0 )
return;
853 if ( sc->
name.isEmpty() )
872 connect( dialog, SIGNAL( changed (
US_Analyte ) ),
875 connect( dialog, SIGNAL(
use_db (
bool ) ),
883 if ( row < 0 )
return;
896 lw_components->disconnect( SIGNAL( currentRowChanged(
int ) ) );
902 SLOT (
update (
int ) ) );
986 le->setReadOnly( status );
987 le->setPalette ( p );
993 if (
ck_mw ->isChecked() ) checked++;
994 if (
ck_s ->isChecked() ) checked++;
995 if (
ck_D ->isChecked() ) checked++;
996 if (
ck_f ->isChecked() ) checked++;
997 if (
ck_f_f0->isChecked() ) checked++;
1003 if ( !
ck_mw ->isChecked() )
le_mw ->setText( tr(
"n/a" ) );
1004 if ( !
ck_s ->isChecked() )
le_s ->setText( tr(
"n/a" ) );
1005 if ( !
ck_D ->isChecked() )
le_D ->setText( tr(
"n/a" ) );
1006 if ( !
ck_f ->isChecked() )
le_f ->setText( tr(
"n/a" ) );
1015 if ( new_state == Qt::Checked )
1021 int response = QMessageBox::question(
this,
1022 tr(
"Change co-sedimenting solute?" ),
1023 tr(
"Another component is marked as the co-sedimenting solute.\n"
1024 "Change it to the current analyte?" ),
1025 QMessageBox::Yes, QMessageBox::No );
1027 if ( response == QMessageBox::No )
1031 connect(
ck_co_sed, SIGNAL( stateChanged(
int ) ),
1032 SLOT (
co_sed (
int ) ) );
1044 if (
le_guid->text().isEmpty() )
return false;
1046 int response = QMessageBox::question(
this,
1047 tr(
"Changing Standard Value" ),
1048 tr(
"You are changing a value that does not correspond\n"
1049 "with a saved analyte.\n\n"
1051 QMessageBox::Yes, QMessageBox::No );
1053 if ( response == QMessageBox::Yes )
1079 double vbar =
le_vbar->text().toDouble();
1081 if ( row < 0 || vbar <= 0.0 )
1087 ck_mw ->setEnabled(
true );
1089 ck_f ->setEnabled(
true );
1090 ck_s ->setEnabled(
true );
1091 ck_D ->setEnabled(
true );
1098 ck_f ->setEnabled(
ck_f ->isChecked() );
1099 ck_s ->setEnabled(
ck_s ->isChecked() );
1100 ck_D ->setEnabled(
ck_D ->isChecked() );
1103 sc->
mw =
ck_mw ->isChecked() ?
le_mw ->text().toDouble() :
1106 sc->
f =
ck_f ->isChecked() ?
le_f ->text().toDouble() : 0.0;
1107 sc->
s =
ck_s ->isChecked() ?
le_s ->text().toDouble() : 0.0;
1108 sc->
D =
ck_D ->isChecked() ?
le_D ->text().toDouble() : 0.0;
1114 le_mw ->setText( QString::number( sc->
mw ,
'e', 3 ) );
1115 le_f_f0->setText( QString::number( sc->
f_f0,
'e', 3 ) );
1116 le_s ->setText( QString::number( sc->
s ,
'e', 4 ) );
1117 le_D ->setText( QString::number( sc->
D ,
'e', 4 ) );
1118 le_f ->setText( QString::number( sc->
f ,
'e', 4 ) );
1121 bool is_prod =
false;
1127 for (
int jj = 0; jj < as->
rcomps.count(); jj++ )
1146 qApp->processEvents();
1153 QString aguid =
le_guid->text();
1154 if ( aguid.isEmpty() )
1162 connect( dialog, SIGNAL(
use_db (
bool ) ),
1179 connect(
ck_sigConc, SIGNAL( toggled(
bool ) ),
1193 connect(
ck_molConc, SIGNAL( toggled(
bool ) ),