16 signal_wanted( signal ),
20 setWindowTitle( tr(
"Analyte Management" ) );
22 setAttribute( Qt::WA_DeleteOnClose );
30 QGridLayout*
main =
new QGridLayout(
this );
31 main->setSpacing ( 2 );
32 main->setContentsMargins ( 2, 2, 2, 2 );
40 db_name =
"No Default Set";
44 QLabel* lb_DB =
us_banner( tr(
"Database: " ) + db_name, -1 );
46 main->addWidget( lb_DB, row++, 0, 1, 3 );
54 QHBoxLayout* radios =
new QHBoxLayout;
55 radios->addLayout( protein );
56 radios->addLayout( dna );
57 radios->addLayout( rna );
58 radios->addLayout( carb );
60 main->addLayout( radios, row++, 0, 1, 3 );
62 QButtonGroup* typeButtons =
new QButtonGroup(
this );
67 connect( typeButtons, SIGNAL( buttonClicked (
int ) ),
70 QPushButton* pb_investigator =
us_pushbutton( tr(
"Select Investigator" ) );
72 main->addWidget( pb_investigator, row, 0 );
78 pb_investigator->setEnabled(
false );
83 QBoxLayout*
search =
new QHBoxLayout;
86 QLabel* lb_search =
us_label( tr(
"Search:" ) );
87 search->addWidget( lb_search );
91 connect(
le_search, SIGNAL( textChanged(
const QString& ) ),
92 SLOT ( search (
const QString& ) ) );
94 main->addLayout( search, row++, 0 );
97 QLabel* lb_banner1 =
us_banner( tr(
"Doubleclick on analyte data to select" ), -1 );
99 main->addWidget( lb_banner1, row++, 0 );
102 connect(
lw_analytes, SIGNAL( itemDoubleClicked( QListWidgetItem* ) ),
109 QGridLayout* description =
new QGridLayout;
110 QLabel* lb_description =
us_label( tr(
"Analyte Description:" ) );
111 description->addWidget( lb_description, 0, 0 );
118 QLabel* lb_guid =
us_label( tr(
"Global Identifier:" ) );
119 description->addWidget( lb_guid, 1, 0 );
122 description->addWidget(
le_guid, 1, 1 );
123 main->addLayout( description, row, 0, 2, 3 );
127 lb_guid->setVisible(
false );
138 QLabel* lb_banner3 =
us_banner( tr(
"Database/Disk Functions" ), -2 );
140 main->addWidget( lb_banner3, row++, 1, 1, 2 );
143 tr(
"List Descriptions" ) );
144 connect( pb_list, SIGNAL( clicked() ), SLOT(
list() ) );
145 main->addWidget( pb_list, row, 1 );
148 connect( pb_new, SIGNAL( clicked() ), SLOT(
new_analyte() ) );
149 main->addWidget( pb_new, row++, 2 );
152 connect(
pb_save, SIGNAL( clicked() ), SLOT(
save() ) );
153 main->addWidget(
pb_save, row, 1 );
159 QLabel* lb_banner4 =
us_banner( tr(
"Other Functions" ), -2 );
161 main->addWidget( lb_banner4, row++, 1, 1, 2 );
173 main->addWidget(
pb_more, row, 1 );
180 QSpacerItem* spacer0 =
new QSpacerItem( 20, 9 );
181 main->addItem ( spacer0, row++, 2 );
189 protein_info->setSpacing ( 2 );
190 protein_info->setContentsMargins( 2, 2, 2, 2 );
194 QLabel* lb_protein_mw =
us_label( tr(
"MW <small>(Daltons)</small>:" ) );
195 protein_info->addWidget( lb_protein_mw, prow, 0 );
200 QLabel* lb_protein_vbar20 =
us_label(
201 tr(
"VBar <small>(cm<sup>3</sup>/g at 20" ) +
DEGC +
")</small>:" );
202 protein_info->addWidget( lb_protein_vbar20, prow, 2 );
210 tr(
"Temperature <small>(" ) +
DEGC +
")</small>:" );
211 protein_info->addWidget( lb_protein_temp, prow, 0 );
228 tr(
"VBar <small>(cm<sup>3</sup>/g at T " ) +
DEGC +
")</small>:" );
230 protein_info->addWidget( lb_protein_vbar, prow, 2 );
235 QLabel* lb_protein_residues =
us_label( tr(
"Residue count:" ) );
236 protein_info->addWidget( lb_protein_residues, prow, 0 );
243 tr(
"E280 <small>(OD/(mol*cm))</small>:" ) );
244 protein_info->addWidget( lb_protein_e280, prow, 2 );
247 QSpacerItem* spacer1 =
new QSpacerItem( 20, 0 );
248 protein_info->addItem( spacer1, prow, 0, 1, 4 );
249 protein_info->setRowStretch( prow, 100 );
255 QGridLayout* dna_layout =
new QGridLayout(
dna_widget );
256 dna_layout->setSpacing ( 2 );
257 dna_layout->setContentsMargins( 2, 2, 2, 2 );
261 QGroupBox* gb_double =
new QGroupBox( tr(
"Calculate MW" ) );
262 gb_double->setPalette( p );
263 QGridLayout* grid1 =
new QGridLayout;
264 grid1->setSpacing ( 2 );
265 grid1->setContentsMargins( 2, 2, 2, 2 );
269 grid1->addLayout( box1, 0, 0 );
270 grid1->addLayout( box2, 1, 0 );
273 connect(
ck_mw_only , SIGNAL( toggled (
bool ) ),
276 QVBoxLayout* stretch1 =
new QVBoxLayout;
277 stretch1->addStretch();
278 grid1->addLayout( stretch1, 2, 0 );
280 gb_double->setLayout( grid1 );
281 dna_layout->addWidget( gb_double, 0, 0 );
284 QGroupBox* gb_three_prime =
new QGroupBox( tr(
"Three prime" ) );
285 gb_three_prime->setPalette( p );
286 QGridLayout* grid2 =
new QGridLayout;
287 grid2->setSpacing ( 2 );
288 grid2->setContentsMargins( 2, 2, 2, 2 );
293 grid2->addLayout( box3, 0, 0 );
294 grid2->addLayout( box4, 0, 1 );
295 gb_three_prime->setLayout( grid2 );
299 dna_layout->addWidget( gb_three_prime, 1, 0 );
301 QGroupBox* gb_five_prime =
new QGroupBox( tr(
"Five prime" ) );
302 gb_five_prime->setPalette( p );
303 QGridLayout* grid3 =
new QGridLayout;
304 grid3->setSpacing ( 2 );
305 grid3->setContentsMargins( 2, 2, 2, 2 );
310 grid3->addLayout( box5, 0, 0 );
311 grid3->addLayout( box6, 0, 1 );
313 gb_five_prime->setLayout( grid3 );
317 dna_layout->addWidget( gb_five_prime, 2, 0 );
319 QGridLayout* ratios =
new QGridLayout;
321 QLabel* lb_ratios =
us_banner( tr(
"Counterion molar ratio/nucletide" ) );
322 ratios->addWidget( lb_ratios, 0, 0, 1, 3 );
324 QLabel* lb_sodium =
us_label( tr(
"Sodium, Na+" ) );
325 ratios->addWidget( lb_sodium, 1, 0 );
331 ratios->addWidget(
ct_sodium, 1, 1, 1, 2 );
333 QLabel* lb_potassium =
us_label( tr(
"Potassium, K+" ) );
334 ratios->addWidget( lb_potassium, 2, 0 );
342 QLabel* lb_lithium =
us_label( tr(
"Lithium, Li+" ) );
343 ratios->addWidget( lb_lithium, 3, 0 );
351 QLabel* lb_magnesium =
us_label( tr(
"Magnesium, Mg+" ) );
352 ratios->addWidget( lb_magnesium, 4, 0 );
360 QLabel* lb_calcium =
us_label( tr(
"Calcium, Ca+" ) );
361 ratios->addWidget( lb_calcium, 5, 0 );
369 dna_layout->addLayout( ratios, 0, 1, 4, 2 );
371 QGridLayout* nucle_data =
new QGridLayout;
372 QLabel* lb_nucle_mw =
us_label( tr(
"MW <small>(Daltons)</small>:" ) );
373 nucle_data->addWidget( lb_nucle_mw, 0, 0 );
379 tr(
"VBar<small>(cm<sup>3</sup>/g)</small>:" ) );
380 nucle_data->addWidget( lb_nucle_vbar, 1, 0 );
383 connect(
le_nucle_vbar, SIGNAL( textChanged (
const QString& ) ),
387 dna_layout->addLayout( nucle_data, 4, 0, 2, 3 );
394 QGridLayout* carbs_info =
new QGridLayout(
carbs_widget );
395 carbs_info->setSpacing ( 2 );
396 carbs_info->setContentsMargins( 2, 2, 2, 2 );
398 QLabel* lb_carbs_mw =
us_label( tr(
"MW <small>(Daltons)</small>:" ) );
399 carbs_info->addWidget( lb_carbs_mw, 0, 0 );
405 tr(
"VBar<small>(cm<sup>3</sup>/g)</small>:" ) );
406 carbs_info->addWidget( lb_carbs_vbar, 0, 2 );
411 QGridLayout* box7 =
us_checkbox( tr(
"Gradient-Forming" ),
413 carbs_info->addLayout( box7, 1, 0, 1, 2 );
421 QBoxLayout* buttons =
new QHBoxLayout;
424 connect( pb_reset, SIGNAL( clicked() ), SLOT(
reset() ) );
425 buttons->addWidget( pb_reset );
428 connect( pb_help, SIGNAL( clicked() ), SLOT(
help() ) );
429 buttons->addWidget( pb_help );
431 QPushButton* pb_accept;
436 connect( pb_cancel, SIGNAL( clicked() ), SLOT( reject() ) );
437 buttons->addWidget( pb_cancel );
444 connect( pb_accept, SIGNAL( clicked() ), SLOT(
close() ) );
445 buttons->addWidget( pb_accept );
447 main->addLayout( buttons, row, 0, 1, 3 );
449 if (
guid.size() == 0 )
466 QMessageBox::information(
this,
467 tr(
"Database Error" ),
468 tr(
"The following error was returned:\n" ) + db.lastError() );
481 QMessageBox::warning(
this,
482 tr(
"Analyte Missing" ),
483 tr(
"No Analyte was found " )
485 ? tr(
"in the database" )
486 : tr(
"on local disk" ) )
487 + tr(
", with a GUID of\n" ) +
guid );
529 qApp->processEvents();
557 QMessageBox::warning(
this,
559 tr(
"There is no default database set." ) );
592 pb_save->setEnabled( row < 0 );
600 if ( row < 0 )
return;
631 QString spectrum_type =
cmb_optics->currentText();
635 if ( spectrum_type == tr(
"Absorbance" ) )
640 else if ( spectrum_type == tr(
"Interference" ) )
657 ?
rb_rna->setChecked(
true )
658 :
rb_dna->setChecked(
true );
703 rb_dna ->setChecked(
true );
706 rb_rna ->setChecked(
true );
758 int response = QMessageBox::question(
this,
759 tr(
"Analyte Changed" ),
760 tr(
"Are you sure?\n\n"
761 "The displayed analyte has changed.\n"
762 "You will not be able to easily reproduce this analyte.\n\n"
763 "Do you really want to continue without saving?" ),
764 QMessageBox::Yes | QMessageBox::No );
766 if ( response == QMessageBox::No )
return;
775 QMessageBox::warning(
this, tr(
"Negative Buoyancy Implied" ),
776 tr(
"The current vbar value implies a non-positive buoyancy.\n"
777 "This will have to be changed with any 2DSA operations.\n\n"
778 "Floating data is indicated there by negative sedimentation\n"
779 "coefficient values, rather than negative buoyancy." ) );
865 qApp->processEvents();
873 double vbar = vbar20 + 4.25e-4 * ( temperature - 20.0 );
889 connect( edit, SIGNAL( sequenceChanged( QString ) ),
897 seq = seq.toLower().remove( QRegExp(
"[\\s0-9]" ) );
905 seq.remove( QRegExp(
"[^a-z\\+\\?\\@]" ) );
909 seq.remove( QRegExp(
"[^acgt]" ) );
913 seq.remove( QRegExp(
"[^acgu]" ) );
922 int response = QMessageBox::question(
this,
924 tr(
"There are invalid characters in the sequence!\n"
925 "Invalid characters will be removed\n"
926 "Do you want to continue?" ),
927 QMessageBox::Yes, QMessageBox::No );
929 if ( response == QMessageBox::No )
return;
933 const int gsize = 10;
937 int segments = ( seq.size() + gsize - 1 ) / gsize;
941 for (
int i = 0; i < segments; i++ )
945 if ( i % lsize == 0 )
946 s += t.sprintf(
"%04i ", i * gsize + 1 );
948 s += seq.mid( p, gsize );
951 if ( i % lsize == lsize - 1 )
977 QString spectrum_type =
cmb_optics->currentText();
979 if ( spectrum_type == tr(
"Absorbance" ) )
984 else if ( spectrum_type == tr(
"Interference" ) )
1015 if ( checked )
ck_mw_only->setChecked(
false );
1044 bool isDNA =
rb_dna ->isChecked();
1061 const double mw_A = 313.209;
1062 const double mw_C = 289.184;
1063 const double mw_G = 329.208;
1064 const double mw_T = 304.196;
1065 const double mw_U = 274.170;
1101 MW +=
A * ( mw_A + 15.999 );
1102 MW +=
G * ( mw_G + 15.999 );
1103 MW +=
C * ( mw_C + 15.999 );
1104 MW += U * ( mw_U + 15.999 );
1105 MW +=
A * ( mw_U + 15.999 );
1106 MW +=
G * ( mw_C + 15.999 );
1107 MW +=
C * ( mw_G + 15.999 );
1108 MW += U * ( mw_A + 15.999 );
1113 MW +=
A * ( mw_U + 15.999 );
1114 MW +=
G * ( mw_C + 15.999 );
1115 MW +=
C * ( mw_G + 15.999 );
1116 MW += U * ( mw_A + 15.999 );
1121 MW +=
A * ( mw_A + 15.999 );
1122 MW +=
G * ( mw_G + 15.999 );
1123 MW +=
C * ( mw_C + 15.999 );
1124 MW += U * ( mw_U + 15.999 );
1157 s.sprintf(
" %2.5e kD (%d A, %d G, %d C, %d U, %d T, %d bp)",
1158 MW / 1000.0,
A,
G,
C, U,
T, total / 2);
1162 s.sprintf(
" %2.5e kD (%d A, %d G, %d C, %d U, %d T, %d bases)",
1163 MW / 1000.0,
A,
G,
C, U,
T, total );
1168 if (
rb_dna->isChecked() )
1171 if ( MW > 0 &&
T == 0 && U > 0)
1172 QMessageBox::question(
this,
1174 tr(
"Are you sure?\n"
1175 "There don't appear to be any thymine residues present,\n"
1176 "instead there are uracil residues in this sequence." ) );
1180 if ( MW > 0 &&
T > 0 && U == 0 )
1181 QMessageBox::question(
this,
1183 tr(
"Are you sure?\n"
1184 "There don't appear to be any uracil residues present,\n"
1185 "instead there are thymine residues in this sequence." ) );
1205 "***************************************************\n" +
1206 tr(
"* Analyte Analysis Results *\n" ) +
1207 "***************************************************\n\n\n" +
1213 s1 += tr(
"Number of Residues: " ) + s.sprintf(
"%i", p.
residues ) +
" AA\n";
1214 s1 += tr(
"Molecular Weight: " ) + s.sprintf(
"%i", (
int)p.
mw ) +
1217 tr(
"V-bar at 20.0 " ) +
DEGC +
": " +
1218 QString::number( p.
vbar20,
'f', 4 ) + tr(
" cm^3/g\n" );
1221 bool override =
false;
1224 if ( fabs( vbar20 - p.
vbar20 ) > 1e-4 )
override =
true;
1227 s1 += tr(
"V-bar at 20.0 " ) +
DEGC +
": " +
1228 QString::number( vbar20,
'f', 4 ) +
1229 tr(
" cm^3/g (override)\n" );
1231 if ( temperature != 20.0 )
1233 s1+= tr(
"V-bar at " ) + QString::number( temperature,
'f', 1 ) +
" " +
1234 DEGC +
": " + QString::number( p.
vbar,
'f', 4 ) +
1238 s1+= tr(
"V-bar at " ) + QString::number( temperature,
'f', 1 ) +
" " +
1240 tr(
" cm^3/g (override)\n" );
1245 s1 += tr(
"Molecular Weight: " ) +
le_nucle_mw->text() +
"\n" +
1247 tr(
"V-bar: " ) +
le_nucle_vbar->text() + tr(
" cm^3/g\n" );
1251 s1 += tr(
"\nExtinction coefficients for the denatured analyte:\n"
1252 " Wavelength (nm) OD/(mol cm)\n" );
1257 for (
int i = 0; i < keys.size(); i++ )
1260 s.sprintf(
" %4.1f %9.4f\n",
1265 s1 += tr(
"\nRefraction coefficients for the analyte:\n"
1266 " Wavelength (nm) OD/(mol cm)\n" );
1271 for (
int i = 0; i < keys.size(); i++ )
1274 s.sprintf(
" %4.1f %9.4f\n",
1279 s1 += tr(
"\nFluorescence coefficients for the analyte:\n"
1280 " Wavelength (nm) OD/(mol cm)\n" );
1285 for (
int i = 0; i < keys.size(); i++ )
1288 s.sprintf(
" %4.1f %9.4f\n",
1293 s1 += tr(
"\nComposition: \n\n" );
1298 s1 += tr(
"Alanine: " ) + s.sprintf(
"%3i", p.
a ) +
" ";
1299 s1 += tr(
"Arginine: " ) + s.sprintf(
"%3i", p.
r ) +
"\n";
1301 s1 += tr(
"Asparagine: " ) + s.sprintf(
"%3i", p.
n ) +
" ";
1302 s1 += tr(
"Aspartate: " ) + s.sprintf(
"%3i", p.
d ) +
"\n";
1304 s1 += tr(
"Asparagine or \n" ) +
1305 tr(
"Aspartate: " ) + s.sprintf(
"%3i", p.
b ) +
"\n";
1307 s1 += tr(
"Cysteine: " ) + s.sprintf(
"%3i", p.
c ) +
" ";
1308 s1 += tr(
"Glutamate: " ) + s.sprintf(
"%3i", p.
e ) +
"\n";
1310 s1 += tr(
"Glutamine: " ) + s.sprintf(
"%3i", p.
q ) +
" ";
1311 s1 += tr(
"Glycine: " ) + s.sprintf(
"%3i", p.
g ) +
"\n";
1313 s1 += tr(
"Glutamine or \n" ) +
1314 tr(
"Glutamate: " ) + s.sprintf(
"%3i", p.
z ) +
"\n";
1316 s1 += tr(
"Histidine: " ) + s.sprintf(
"%3i", p.
h ) +
" ";
1317 s1 += tr(
"Isoleucine: " ) + s.sprintf(
"%3i", p.
i ) +
"\n";
1319 s1 += tr(
"Leucine: " ) + s.sprintf(
"%3i", p.
l ) +
" ";
1320 s1 += tr(
"Lysine: " ) + s.sprintf(
"%3i", p.
k ) +
"\n";
1322 s1 += tr(
"Methionine: " ) + s.sprintf(
"%3i", p.
m ) +
" ";
1323 s1 += tr(
"Phenylalanine: " ) + s.sprintf(
"%3i", p.
f ) +
"\n";
1325 s1 += tr(
"Proline: " ) + s.sprintf(
"%3i", p.
p ) +
" ";
1326 s1 += tr(
"Serine: " ) + s.sprintf(
"%3i", p.
s ) +
"\n";
1328 s1 += tr(
"Threonine: " ) + s.sprintf(
"%3i", p.
t ) +
" ";
1329 s1 += tr(
"Tryptophan: " ) + s.sprintf(
"%3i", p.
w ) +
"\n";
1331 s1 += tr(
"Tyrosine: " ) + s.sprintf(
"%3i", p.
y ) +
" ";
1332 s1 += tr(
"Valine: " ) + s.sprintf(
"%3i", p.
v ) +
"\n";
1334 s1 += tr(
"Unknown: " ) + s.sprintf(
"%3i", p.
x ) +
" ";
1335 s1 += tr(
"Hao: " ) + s.sprintf(
"%3i", p.
j ) +
"\n";
1337 s1 += tr(
"Delta-linked Ornithine: " ) + QString::number( p.
o ) +
"\n";
1347 s1 += tr(
"Adenine: " ) + s.sprintf(
"%3i", a ) +
" ";
1348 s1 += tr(
"Cytosine: " ) + s.sprintf(
"%3i", c ) +
"\n";
1350 s1 += tr(
"Guanine: " ) + s.sprintf(
"%3i", g ) +
" ";
1353 s1 += tr(
"Thymine: " ) + s.sprintf(
"%3i", t ) +
"\n";
1356 s1 += tr(
"Uracil: " ) + s.sprintf(
"%3i", u ) +
"\n";
1361 dialog->
editor->
e->setFont( font );
1362 dialog->
editor->
e->setText( s1 );
1364 QFontMetrics fm( font );
1366 dialog->resize( fm.width(
'W' ) * 80, fm.height() * 20 );
1380 QRegExp(
".*" + text +
".*", Qt::CaseInsensitive ) ) )
1407 connect( inv_dialog,
1408 SIGNAL( investigator_accepted(
int ) ),
1419 ? QString::number( invID ) +
": "
1427 pb_save ->setEnabled (
false );
1433 QString spectrum_type =
cmb_optics->currentText();
1434 QString strExtinc = tr(
"Extinction:" );
1435 bool changed =
false;
1440 if ( spectrum_type == tr(
"Absorbance" ) )
1447 else if ( spectrum_type == tr(
"Interference" ) )
1462 dialog->setWindowTitle( tr(
"Manage %1 Values" ).arg( spectrum_type ) );
1469 QMessageBox::warning(
this, tr(
"Connection Problem" ),
1470 tr(
"Could not connect to database\n" ) + error );
1488 QMessageBox::information(
this,
1489 tr(
"Investigator not set" ),
1490 tr(
"Please select an investigator first." ) );
1503 QStringList q(
"get_analyte_desc" );
1510 QMessageBox::information(
this,
1511 tr(
"Database Error" ),
1512 tr(
"The following error was returned:\n" ) + db.lastError() );
1523 QString a_type = db.value( 2 ).toString();
1553 QStringList filter(
"A*.xml" );
1554 QStringList f_names = f.entryList( filter, QDir::Files, QDir::Name );
1556 QString type =
"*Unknown*";
1557 if (
rb_protein->isChecked() ) type =
"PROTEIN";
1558 else if (
rb_dna ->isChecked() ) type =
"DNA";
1559 else if (
rb_rna ->isChecked() ) type =
"RNA";
1560 else if (
rb_carb ->isChecked() ) type =
"CARBOHYDRATE";
1564 for (
int i = 0; i < f_names.size(); i++ )
1566 a_file.setFileName( path +
"/" + f_names[ i ] );
1568 if ( ! a_file.open( QIODevice::ReadOnly | QIODevice::Text) )
continue;
1570 QXmlStreamReader xml( &a_file );
1572 while ( ! xml.atEnd() )
1576 if ( xml.isStartElement() )
1578 if ( xml.name() ==
"analyte" )
1580 QXmlStreamAttributes a = xml.attributes();
1582 if ( a.value(
"type" ).toString() == type )
1585 GUIDs << a.value(
"analyteGUID" ).toString();
1603 QMessageBox::information(
this,
1604 tr(
"Database Error" ),
1605 tr(
"The following error was returned:\n" ) + db.
lastError() );
1615 QMessageBox question( QMessageBox::Question,
1617 tr(
"There is no sequence defined.\n\n"
1622 question.addButton( tr(
"Continue" ), QMessageBox::YesRole );
1624 if ( question.exec() == QMessageBox::No )
1632 QMessageBox question( QMessageBox::Question,
1634 tr(
"There is no description for this analyte.\n\n"
1639 question.addButton( tr(
"Continue" ), QMessageBox::YesRole );
1641 if ( question.exec() == QMessageBox::No )
1650 QMessageBox::information(
this,
1652 tr(
"The vbar entry (%1) is not a reasonable value." )
1660 mwvl =
le_nucle_mw->text().section(
" ", 1, 1 ).toDouble();
1666 QMessageBox::information(
this,
1668 tr(
"The Molecular Weight entry (%1) is not a reasonable value." )
1684 return db.lastErrno();
1687 db.statusQuery( q );
1689 int status = db.lastErrno();
1697 QMessageBox::information(
this,
1698 tr(
"Database Error" ),
1699 tr(
"The following errro was returned:\n" ) + db.lastError() );
1711 int response = QMessageBox::question(
this,
1712 tr(
"Analyte Changed" ),
1713 tr(
"The analyte has changed.\n"
1714 "Do you want to continue without saving?" ),
1715 QMessageBox::Cancel, QMessageBox::Yes );
1717 if ( response == QMessageBox::Yes )
return true;
1730 pb_save ->setEnabled(
false );
1732 pb_more ->setEnabled(
false );
1765 if ( index < 0 )
throw -1;
1766 if (
info[ index ].filename.isEmpty() )
1775 QMessageBox::warning(
this,
1776 tr(
"Analyte Load Rrror" ),
1777 tr(
"Load error when reading the disk:\n\n" ) +
analyte.
message );
1788 if ( index < 0 )
throw -1;
1796 throw db.lastErrno();
1804 int i =
info[ index ].index;
1809 QString
guid = db.value( 0 ).toString();
1815 QMessageBox::warning(
this,
1816 tr(
"Analyte Load Error" ),
1817 tr(
"Load error when reading the database:\n\n" ) +
analyte.
message );
1837 QStringList mw =
le_nucle_mw->text().split(
" ", QString::SkipEmptyParts );
1841 QMessageBox::warning(
this,
1842 tr(
"Analyte Error" ),
1843 tr(
"Molecular weight is empty. Define a sequence." ) );
1847 analyte.
mw = mw[ 0 ].toDouble() * 1000.0;
1875 QMessageBox::information(
this,
1876 tr(
"Database Error" ),
1877 tr(
"The following error was returned:\n" ) + db.lastError() );
1895 QMessageBox::information(
this,
1896 tr(
"Save successful" ),
1897 tr(
"The analyte has been successfully saved." ) );
1899 QMessageBox::warning(
this,
1931 QMessageBox::warning(
this,
1932 tr(
"Not Deleted" ),
1933 tr(
"The analyte could not be deleted,\n"
1934 "since it is in use in one or more solutions." ) );
1940 if ( file.exists() )
1945 QMessageBox::information(
this,
1946 tr(
"Analyte Deleted" ),
1947 tr(
"The analyte has been deleted from the disk." ) );
1960 QMessageBox::warning(
this,
1961 tr(
"Analyte Not Deleted" ),
1962 tr(
"The analyte could not be deleted,\n"
1963 "since it is in use in one or more solutions." ) );
1971 QMessageBox::information(
this,
1972 tr(
"Analyte Deleted" ),
1973 tr(
"The analyte has been deleted from the database." ) );
1989 else if ( mwval != 0.0 && qAbs( mwval - p.
mw ) > 1.0 )
1992 "There is a difference between<br/>"
1993 "the Molecular Weight value that you specified and<br/>"
1994 "the one calculated from the protein sequence.<br/> <br/>"
1995 "Do you wish to accept the specified value?<ul>"
1996 "<li><b>Yes</b> to use %1 (the specified);</li>"
1997 "<li><b>No </b> to use %2 (the calculated).</li></ul>" )
1998 .arg( mwval ).arg( p.
mw );
2000 QMessageBox msgBox (
this );
2001 msgBox.setWindowTitle ( tr(
"Analyte MW Difference" ) );
2002 msgBox.setTextFormat ( Qt::RichText );
2003 msgBox.setText ( msg );
2004 msgBox.addButton ( QMessageBox::No );
2005 msgBox.addButton ( QMessageBox::Yes );
2006 msgBox.setDefaultButton( QMessageBox::Yes );
2008 if ( msgBox.exec() == QMessageBox::No )
2012 else if ( mwval == 0.0 )
2020 if ( qAbs( vbar20 - pvbar ) > 1e-4 )
2023 "There is a difference between<br/>"
2024 "the vbar20 value that you specified and<br/>"
2025 "the one calculated from the protein sequence.<br/> <br/>"
2026 "Do you wish to accept the specified value?<ul>"
2027 "<li><b>Yes</b> to use %1 (the specified);</li>"
2028 "<li><b>No </b> to use %2 (the calculated).</li></ul>" )
2029 .arg( vbar20 ).arg( pvbar );
2031 QMessageBox msgBox(
this );
2032 msgBox.setWindowTitle( tr(
"Analyte Vbar Difference" ) );
2033 msgBox.setTextFormat ( Qt::RichText );
2034 msgBox.setText ( msg );
2035 msgBox.addButton ( QMessageBox::No );
2036 msgBox.addButton ( QMessageBox::Yes );
2037 msgBox.setDefaultButton( QMessageBox::Yes );
2039 if ( msgBox.exec() == QMessageBox::No )
2051 bool in_use =
false;
2053 QStringList sfilt(
"S*.xml" );
2054 QStringList snames = QDir( soldir )
2055 .entryList( sfilt, QDir::Files, QDir::Name );
2057 for (
int ii = 0; ii < snames.size(); ii++ )
2059 QString sfname = soldir + snames.at( ii );
2060 QFile sfile( sfname );
2062 if ( ! sfile.open( QIODevice::ReadOnly | QIODevice::Text ) )
continue;
2064 QXmlStreamReader xml( &sfile );
2066 while ( ! xml.atEnd() )
2070 if ( xml.isStartElement() && xml.name() ==
"analyte" )
2072 QXmlStreamAttributes atts = xml.attributes();
2074 if ( atts.value(
"guid" ).toString() == analyteGUID )
2084 if ( in_use )
break;
2095 setWindowTitle( tr(
"Sequence Management" ) );
2097 setAttribute( Qt::WA_DeleteOnClose );
2099 QGridLayout*
main =
new QGridLayout(
this );
2100 main->setSpacing ( 2 );
2101 main->setContentsMargins ( 2, 2, 2, 2 );
2104 edit->
e->setAcceptRichText(
false );
2105 edit->
e->setText( sequence );
2106 main->addWidget(
edit, 0, 0, 5, 2 );
2109 connect( pb_cancel, SIGNAL( clicked() ), SLOT( close() ) );
2110 main->addWidget( pb_cancel, 5, 0 );
2113 connect( pb_accept, SIGNAL( clicked() ), SLOT(
accept() ) );
2114 main->addWidget( pb_accept, 5, 1 );
2117 edit->
e->setFont( font );
2119 QFontMetrics fm( font );
2120 resize( fm.width(
'W' ) * 80, fm.height() * 20 );