23 signal( signal_wanted ), solution( dataIn ), autosave( auto_save )
25 setAttribute( Qt::WA_DeleteOnClose );
29 setWindowTitle( tr(
"Solution Management" ) );
34 gray.setColor( QPalette::Base, QColor( 0xe0, 0xe0, 0xe0 ) );
36 QGridLayout*
main =
new QGridLayout(
this );
37 main->setSpacing ( 2 );
38 main->setContentsMargins ( 2, 2, 2, 2 );
46 if ( DB.isEmpty() ) DB <<
"Undefined";
47 QLabel* lb_DB =
us_banner( tr(
"Database: " ) + DB.at( 0 ) );
49 main->addWidget( lb_DB, row++, 0, 1, 3 );
54 QPushButton* pb_investigator =
us_pushbutton( tr(
"Select Investigator" ) );
56 main->addWidget( pb_investigator, row++, 0 );
60 QLabel* lb_investigator =
us_label( tr(
"Investigator:" ) );
61 main->addWidget( lb_investigator, row++, 0 );
65 QLabel* lb_banner2 =
us_banner( tr(
"Click on solution to select" ), -2 );
67 lb_banner2->setMinimumWidth( 400 );
68 main->addWidget( lb_banner2, row++, 0 );
72 connect(
lw_solutions, SIGNAL( itemClicked ( QListWidgetItem* ) ),
78 QHBoxLayout* lo_amount =
new QHBoxLayout();
88 main->addLayout( lo_amount, row++, 0 );
90 QLabel* lb_banner3 =
us_banner( tr(
"Current solution contents" ), -2 );
92 main->addWidget( lb_banner3, row++, 0 );
96 connect(
lw_analytes, SIGNAL( itemClicked ( QListWidgetItem* ) ),
98 connect(
lw_analytes, SIGNAL( itemDoubleClicked ( QListWidgetItem* ) ),
103 main->addWidget(
lw_analytes, row, 0, add_rows, 1 );
120 connect(
pb_query, SIGNAL( clicked() ), SLOT(
load() ) );
121 main->addWidget(
pb_query, row, 1 );
124 connect(
pb_save, SIGNAL( clicked() ), SLOT(
save() ) );
125 main->addWidget(
pb_save, row++, 2 );
133 main->addWidget(
pb_del, row++, 2 );
148 QLabel* lb_banner4 =
us_banner( tr(
"Edit solution properties" ), -2 );
150 main->addWidget( lb_banner4, row++, 1, 1, 2 );
152 QLabel* lb_solutionDesc =
us_label( tr(
"Solution Name:" ) );
153 main->addWidget( lb_solutionDesc, row++, 1, 1, 2 );
160 QLabel* lb_commonVbar20 =
us_label( tr(
"Common VBar (20C):" ) );
161 main->addWidget( lb_commonVbar20, row, 1 );
168 QLabel* lb_density =
us_label( tr(
"Buffer density:" ) );
169 main->addWidget( lb_density, row, 1 );
176 QLabel* lb_viscosity =
us_label( tr(
"Buffer viscosity:" ) );
177 main->addWidget( lb_viscosity, row, 1 );
184 QLabel* lb_storageTemp =
us_label( tr(
"Storage Temperature:" ) );
185 main->addWidget( lb_storageTemp, row, 1 );
192 QLabel* lb_notes =
us_label( tr(
"Solution notes:" ) );
193 main->addWidget( lb_notes, row++, 1, 1, 2 );
196 connect(
te_notes, SIGNAL( textChanged(
void ) ),
198 main->addWidget(
te_notes, row, 1, 5, 2 );
203 QLabel* lb_guid =
us_label( tr(
"Global Identifier:" ) );
204 main->addWidget( lb_guid, row++, 1, 1, 2 );
209 main->addWidget(
le_guid, row++, 1, 1, 2 );
213 lb_guid->setVisible(
false );
218 QHBoxLayout* buttons =
new QHBoxLayout;
221 connect( pb_reset, SIGNAL( clicked() ), SLOT(
newSolution() ) );
222 buttons->addWidget( pb_reset );
225 connect( pb_help, SIGNAL( clicked() ), SLOT(
help() ) );
226 buttons->addWidget( pb_help );
233 connect( pb_cancel, SIGNAL( clicked() ), SLOT(
cancel() ) );
234 buttons->addWidget( pb_cancel );
244 main->addLayout( buttons, row, 0, 1, 3 );
256 QList< QListWidgetItem* > items
260 if ( items.size() == 1 )
293 pb_save -> setEnabled(
false );
294 if ( ! bufferDesc.isEmpty() )
300 pb_del -> setEnabled(
false );
303 pb_del -> setEnabled(
true );
309 for (
int i = 0; i < ai.size(); i++ )
312 QListWidgetItem* item =
new QListWidgetItem( ai[ i ].analyte.description,
lw_analytes );
320 p.setColor( QPalette::WindowText, Qt::white );
358 int response = QMessageBox::question(
this,
359 tr(
"Save Changed Solution?" ),
360 tr(
"Changes were made to the solution and you did not save them.\n"
361 "Do you wish to save the solution now?" ),
362 QMessageBox::Yes, QMessageBox::No );
364 save_it = ( response == QMessageBox::Yes );
377 QMessageBox::information(
this,
379 tr(
"Please enter a description for\n"
380 "your solution before accepting." ) );
408 SIGNAL( investigator_accepted(
int ) ),
449 QStringList filter(
"S*.xml" );
450 QStringList names = dir.entryList( filter, QDir::Files, QDir::Name );
454 for (
int i = 0; i < names.size(); i++ )
456 a_file.setFileName( path +
"/" + names[ i ] );
458 if ( ! a_file.open( QIODevice::ReadOnly | QIODevice::Text) )
continue;
460 QXmlStreamReader xml( &a_file );
462 while ( ! xml.atEnd() )
466 if ( xml.isStartElement() )
468 if ( xml.name() ==
"solution" )
470 QXmlStreamAttributes a = xml.attributes();
472 IDs << a.value(
"id" ).toString();
473 GUIDs << a.value(
"guid" ).toString();
478 else if ( xml.name() ==
"description" )
507 QStringList q(
"all_solutionIDs" );
520 QString newID = db.
value( 0 ).toString();
523 GUIDs << QString(
"" );
561 int solutionID =
info[ ndx ].solutionID;
562 QString solutionGUID =
info[ ndx ].GUID;
585 QMessageBox::information(
this,
587 tr(
"The buffer this solution refers to was not found.\n"
588 "Please restore and try again.\n" ) );
593 QMessageBox::information(
this,
595 tr(
"One of the analytes this solution refers to was not found.\n"
596 "Please restore and try again.\n" ) );
611 QMessageBox::information(
this,
613 tr(
"The buffer this solution refers to was not found.\n"
614 "Please restore and try again.\n" ) );
619 QMessageBox::information(
this,
621 tr(
"One of the analytes this solution refers to was not found.\n"
622 "Please restore and try again.\n" ) );
627 QMessageBox::information(
this,
628 tr(
"Disk Read Problem" ),
629 tr(
"Could not read data from the disk.\n"
630 "Disk status: " ) + QString::number( status ) );
646 connect( analyte_dialog, SIGNAL( valueChanged (
US_Analyte ) ),
649 connect( analyte_dialog, SIGNAL(
use_db (
bool ) ),
652 analyte_dialog->exec();
653 qApp->processEvents();
674 QStringList q(
"get_analyteID" );
698 QMessageBox::information(
this,
700 tr(
"Your solution already contains this analyte\n"
701 "If you wish to change the amount, remove it and "
702 "add it again.\n" ) );
727 p.setColor( QPalette::WindowText, Qt::red );
732 connect(
ct_amount, SIGNAL( valueChanged (
double ) ),
751 connect( analyte_dialog, SIGNAL( valueChanged (
US_Analyte ) ),
754 connect( analyte_dialog, SIGNAL(
use_db (
bool ) ),
757 analyte_dialog->exec();
758 qApp->processEvents();
778 QStringList q(
"get_analyteID" );
788 QListWidgetItem* item =
lw_analytes->currentItem();
809 QMessageBox::information(
this,
811 tr(
"Your solution already contains this analyte\n"
812 "If you wish to change the amount, remove it and "
813 "add it again.\n" ) );
844 QListWidgetItem* item =
lw_analytes->currentItem();
866 double numerator = 0.0;
867 double denominator = 0.0;
890 connect( buffer_dialog, SIGNAL( valueChanged (
US_Buffer ) ),
893 connect( buffer_dialog, SIGNAL(
use_db (
bool ) ),
896 buffer_dialog->exec();
897 qApp->processEvents();
913 QStringList q(
"get_bufferID" );
921 newBuffer.
bufferID = QString(
"-1" );
936 QListWidgetItem* item =
lw_analytes->currentItem();
1006 QMessageBox::information(
this,
1008 tr(
"Please enter a description for\n"
1009 "your solution before saving it!" ) );
1030 if ( status !=
US_DB2::OK && ! display_status )
1035 QMessageBox::information(
this,
1037 tr(
"There was a problem saving the buffer to the database.\n" ) );
1043 QMessageBox::information(
this,
1045 tr(
"A solution component is missing from the database, "
1046 "and the attempt to save it failed.\n") );
1052 QMessageBox::information(
this,
1063 if ( display_status )
1065 QMessageBox::information(
this,
1066 tr(
"Save results" ),
1067 tr(
"Solution saved" ) );
1078 QList< QListWidgetItem* > items
1082 if ( items.size() == 1 )
1116 QMessageBox::warning(
this,
1117 tr(
"Delete aborted" ),
1118 tr(
"Solution NOT Deleted, since it is in use\n"
1119 "by one or more experiments" ) );
1128 QMessageBox::information(
this,
1129 tr(
"Delete results" ),
1130 tr(
"Solution Deleted" ) );
1138 if ( db && ( DB.size() < 5 ) )
1140 QMessageBox::warning(
this,
1142 tr(
"There is no default database set." ) );
1146 qApp->processEvents();
1167 QMessageBox::warning(
this, tr(
"Database Problem" ),
1168 tr(
"Database returned the following error: \n" ) + error );