20 QVector< US_DataIO::RawData >& rData,
21 QVector< US_DataIO::EditedData >& eData,
33 setAttribute ( Qt::WA_DeleteOnClose );
34 setWindowTitle( tr(
"Load Edited Data" ) );
36 setMinimumSize( 320, 300 );
39 QVBoxLayout*
main =
new QVBoxLayout(
this );
40 main->setContentsMargins( 2, 2, 2, 2 );
41 main->setSpacing ( 2 );
44 QGridLayout* top =
new QGridLayout;
61 QString inv_name = ( ( invlev > 0 )
70 QLabel* lb_filtdata =
us_label( tr(
"Search" ) );
71 top->addWidget( lb_filtdata, row, 0 );
76 connect(
le_dfilter, SIGNAL( textChanged(
const QString& ) ),
77 SLOT (
search (
const QString& ) ) );
79 main->addLayout( top );
85 tw_data =
new QTreeWidget(
this );
86 tw_data->setFrameStyle ( QFrame::NoFrame );
89 tw_data->setSelectionMode( QAbstractItemView::ExtendedSelection );
90 tw_data->installEventFilter(
this );
95 te_notes->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
97 te_notes->setText( tr(
"Right-mouse-button-click on a list selection"
99 int font_ht = QFontMetrics( tw_font ).lineSpacing();
100 te_notes->setMaximumHeight( font_ht * 2 + 12 );
104 QHBoxLayout* buttons =
new QHBoxLayout;
107 QPushButton* pb_shedit =
us_pushbutton( tr(
"Show Edits" ) );
109 buttons->addWidget( pb_help );
110 buttons->addWidget( pb_cancel );
111 buttons->addWidget( pb_shedit );
112 buttons->addWidget( pb_accept );
113 connect( pb_help, SIGNAL( clicked() ), SLOT(
help() ) );
114 connect( pb_cancel, SIGNAL( clicked() ), SLOT(
cancelled() ) );
115 connect( pb_shedit, SIGNAL( clicked() ), SLOT(
selected() ) );
116 connect( pb_accept, SIGNAL( clicked() ), SLOT(
accepted() ) );
118 main->addLayout( buttons );
132 tw_data->setCurrentItem( NULL );
134 for (
int i = 0; i <
tw_data->topLevelItemCount(); i++ )
136 QTreeWidgetItem* twi =
tw_data->topLevelItem( i );
137 bool hide = ! twi->text( 0 ).contains( search_string,
138 Qt::CaseInsensitive );
139 twi->setHidden( hide );
150 QList< QTreeWidgetItem* > selections =
tw_data->selectedItems();
153 QTreeWidgetItem* twi;
154 QList< QTreeWidgetItem* > topLevel;
156 foreach ( twi, selections )
158 while ( twi->parent() != NULL ) twi = twi->parent();
159 if ( ! topLevel.contains( twi ) )
166 if ( topLevel.size() > 1 )
168 QMessageBox::warning(
this,
169 tr(
"Invalid Selection" ),
170 tr(
"Only items from one run may be selected." ) );
179 QTreeWidgetItem* twi = selections[ 0 ];
181 while ( twi->parent() != NULL )
189 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
190 te_notes->setText( tr(
"Gathering information on triples and edits"
191 " for run ID\n\"%1\"..." ).arg(
runID_sel ) );
192 qApp->processEvents();
193 qApp->processEvents();
206 QApplication::restoreOverrideCursor();
207 QApplication::restoreOverrideCursor();
208 qApp->processEvents();
215 QList< int > indexes;
217 if ( selections.size() > 1 || selections[ 0 ]->parent() != NULL )
219 foreach ( twi, selections )
222 if ( ! indexes.contains( index ) ) indexes << index;
226 foreach ( index, indexes )
228 QString key =
dlabels[ index ];
229 QString triple = QString(
datamap[ key ].tripID )
230 .replace(
".",
" / " );
232 if (
triples.contains( triple ) )
234 QMessageBox::warning(
this,
235 tr(
"Invalid Selection" ),
236 tr(
"Only one edit from each triple may be selected." ) );
245 if ( selections.size() == 1 && selections[ 0 ]->parent() == NULL )
247 qDebug() <<
"LdEd: Only 1 top-level item dlabsize" <<
dlabels.size();
252 twi = selections[ 0 ];
254 for (
int i = 0; i < twi->childCount(); i++ )
256 QTreeWidgetItem* child = twi->child( i );
257 if ( child == NULL )
continue;
260 indexes << child->child( 0 )->type();
266 for (
int ii = 0; ii <
dlabels.size(); ii++ )
271 qDebug() <<
"LdEd: selsz" << selections.size() <<
"dlabsz" <<
dlabels.size();
273 if ( indexes.size() < 1 )
275 twi = selections[ 0 ];
276 QMessageBox::warning(
this,
277 tr(
"No Edits Available" ),
278 tr(
"No Edit children exist for selected run"
279 " '%1'. The run will be hidden." ).arg(
runID_sel ) );
280 twi->setHidden(
true );
284 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
285 te_notes->setText( tr(
"Loading data from " ) +
288 qApp->processEvents();
292 for (
int ii = 0; ii < indexes.size(); ii++ )
294 QString key =
dlabels[ indexes[ ii ] ];
298 QString triple = QString( dtriple ).replace(
".",
" / " );
302 QString clambda = dtriple .section(
".", -1, -1 );
303 QString filedir = filename.section(
"/", 0, -2 );
304 filename = filename.section(
"/", -1, -1 );
305 QString ftriple = filename.section(
".", -4, -2 );
306 QString message = tr(
"Loading triple " ) + triple;
308 if ( triple != ftriple && ftriple.contains(
"-" ) )
310 QString ftrnode =
"." + ftriple +
".";
311 QString utrnode =
"." + ftriple +
"@" + clambda +
".";
312 filename = filename.replace( ftrnode, utrnode );
316 qApp->processEvents();
324 QApplication::restoreOverrideCursor();
325 QMessageBox::warning(
this,
333 QApplication::restoreOverrideCursor();
334 QMessageBox::warning(
this,
350 QApplication::restoreOverrideCursor();
351 QMessageBox::information(
this,
352 tr(
"DB Connection Problem" ),
353 tr(
"There was an error connecting to the database:\n" )
360 QString prvfname =
"";
362 bool dnld_auc =
true;
363 bool dnld_edt =
true;
367 qDebug() <<
"LdEd: ndx0" << indexes[0] <<
"dlab0" <<
dlabels[indexes[0]];
368 QString recID = QString::number(
ddesc.
DB_id );
371 QString uresdir = rdir +
"/" + runID +
"/";
372 QDir( rdir ).mkpath( runID );
373 QString message = tr(
"Browsing AUC data..." );
375 qApp->processEvents();
376 qDebug() <<
"LdEd:TM:10: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
378 for (
int ii = 0; ii < indexes.size(); ii++ )
380 QString key =
dlabels[ indexes[ ii ] ];
384 QString triple = QString( dtriple ).replace(
".",
" / " );
385 qDebug() <<
"LdEd: ii" << ii <<
"ndxii" << indexes[ii] <<
"triple" << triple;
390 QString filename = dscfname;
391 QString clambda = dtriple .section(
".", -1, -1 );
392 QString filedir = filename.section(
"/", 0, -2 );
393 filename = filename.section(
"/", -1, -1 );
394 QString ftriple = filename.section(
".", -4, -2 );
396 if ( triple != ftriple && ftriple.contains(
"-" ) )
398 QString ftrnode =
"." + ftriple +
".";
399 QString utrnode =
"." + ftriple +
"@" + clambda +
".";
400 filename = filename.replace( ftrnode, utrnode );
403 QString recID = QString::number( idRec );
406 + filename.section(
".", -5, -3 )
407 +
"." + clambda +
".auc";
408 QString afn = uresdir + aucfn;
410 efn = uresdir + dscfname;
413 QString message = tr(
"Loading triple " ) + triple;
415 qApp->processEvents();
417 if ( QFile( afn ).exists() )
423 QString aucID = QString::number( idAUC );
424 qDebug() <<
"LdEd: was-empty, aucID" << aucID << idAUC;
426 query <<
"get_rawData" << aucID;
428 qDebug() <<
"LdEd: w-e, num_rows" << db.numRows();
430 qDebug() <<
"LdEd: w-e, dberr" << db.lastErrno() <<
US_DB2::OK;
432 db.value( 9 ).toString();
433 qDebug() <<
"LdEd: was-empty, now acheck" <<
ddesc.
acheck;
435 qDebug() <<
"LdEd: fcheck" << fcheck;
440 qDebug() <<
"LdEd: dnld_auc" << dnld_auc <<
"afn" << afn;
444 db.readBlobFromDB( afn,
"download_aucData", idAUC );
445 qDebug() <<
"LdEd: dnld_auc DONE" << dscfname << prvfname;
448 if ( dscfname != prvfname )
450 efn = uresdir + dscfname;
454 if ( QFile( efn ).exists() )
460 qDebug() <<
"LdEd: dnld_edt" << dnld_edt <<
"efn" << efn;
462 db.readBlobFromDB( efn,
"download_editData", idRec );
463 qDebug() <<
"LdEd: dnld_edt DONE";
466 qApp->processEvents();
468 qDebug() <<
"LdEd: loadData uresdir filename" << uresdir << filename;
470 qDebug() <<
"LdEd: loadData DONE";
472 qDebug() <<
"LdEd:TM:11: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
475 QApplication::restoreOverrideCursor();
482 dt = ( dt < delta ) ? delta : dt;
487 QMessageBox::warning(
this,
488 tr(
"Temperature Problem" ),
489 tr(
"The temperature in this run varied over the course\n"
490 "of the run to a larger extent than allowed by the\n"
491 "current threshold (" )
493 +
" " +
DEGC + tr(
". The accuracy of experimental\n"
494 "results may be affected significantly." ) );
505 QString dbID = QString::number(
ddesc.
DB_id );
510 QString cdesc = label + descript + filename + dataGUID + aucGUID + dbID;
513 if ( cdesc.contains( sep ) )
534 SIGNAL( investigator_accepted(
int ) ),
543 QString number = ( ID > 0 ) ? QString::number( ID ) +
": " :
"";
551 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
565 te_notes->setText( tr(
"Right-mouse-button-click on a list selection"
567 "Select triples/edits and click on \"Load\""
568 " to load selected data." ) );
581 te_notes->setText( tr(
"Select a run, then click on \"Show Edits\""
582 " to fill in triples and edits;\n"
583 "or click on \"Load\" to load all the latest"
584 " edits of triples for the selected run." ) );
588 qApp->processEvents();
589 QStringList crlabels;
591 hdrs << (
sel_run ? tr(
"Run|Triple|Edit" ) : tr(
"Run" ) )
597 tw_data->setHeaderLabels( hdrs );
598 tw_data->setSortingEnabled(
false );
600 QTreeWidgetItem* twi_edit = NULL;
601 QTreeWidgetItem* twi_runi = NULL;
602 QTreeWidgetItem* twi_trip = NULL;
605 QList< DataDesc > ddescrs =
datamap.values();
606 QString prlabel =
"";
607 QString ptlabel =
"";
614 QString clabel = tr(
"No data found." );
615 twi_runi =
new QTreeWidgetItem( QStringList( clabel), 0 );
616 tw_data->addTopLevelItem( twi_runi );
617 QApplication::restoreOverrideCursor();
618 QApplication::restoreOverrideCursor();
622 for (
int ii = 0; ii <
dlabels.size(); ii++ )
624 QString cdescr =
dlabels.at( ii );
626 QString dbID = fromDB
627 ? QString().sprintf(
"%6d", ddesc.
DB_id )
630 crlabels << ddesc.
runID
631 << QString( ddesc.
date ).section(
" ", 0, 0 ).simplified()
634 QString crlabel = ddesc.
runID;
635 QString ctlabel = ddesc.
tripID;
636 QString celabel = ddesc.
editID;
638 if ( crlabel != prlabel )
640 twi_runi =
new QTreeWidgetItem( crlabels, ii );
641 tw_data->addTopLevelItem( twi_runi );
645 twi_trip =
new QTreeWidgetItem( QStringList( ctlabel ), ii );
646 twi_runi->addChild( twi_trip );
654 else if ( ctlabel != ptlabel )
656 twi_trip =
new QTreeWidgetItem( QStringList( ctlabel ), ii );
657 twi_runi->addChild( twi_trip );
670 twi_edit =
new QTreeWidgetItem( QStringList( celabel ), ii );
671 twi_trip->addChild( twi_edit );
682 tw_data->resizeColumnToContents( 0 );
683 tw_data->resizeColumnToContents( 1 );
684 tw_data->resizeColumnToContents( 2 );
686 tw_data->setSortingEnabled(
true );
687 tw_data->sortByColumn( 0, Qt::AscendingOrder );
688 tw_data->sortByColumn( 1, Qt::DescendingOrder );
697 for (
int ii =
dlabels.size() - 1; ii >= 0; ii-- )
700 QString cdescr =
dlabels.at( ii );
702 QString crlabel = ddesc.
runID;
703 QString ctlabel = ddesc.
tripID;
705 if ( crlabel != prlabel )
719 if ( ctlabel != ptlabel )
736 QApplication::restoreOverrideCursor();
749 QList< QTreeWidgetItem* > selitems =
tw_data->selectedItems();
751 if ( selitems.size() < 1 )
754 te_notes->setText( tr(
"Reading edit information to fully populate"
755 " the list data tree..." ) );
760 QTreeWidgetItem* twi = selitems[ 0 ];
762 while ( twi->parent() != NULL )
766 te_notes->setText( tr(
"Reading edit information for run \"%1\",\n"
767 " to populate its list data tree..." )
771 qApp->processEvents();
780 QList< QTreeWidgetItem* > selitems =
tw_data->selectedItems();
781 QList< DataDesc > ddescrs =
datamap.values();
783 if ( selitems.size() == 0 )
785 QMessageBox::information(
this,
786 tr(
"No Data Selected" ),
787 tr(
"You have not selected any data.\nSelect+Load or Cancel" ) );
802 qDebug() <<
"ScDB:TM:00: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
808 QMessageBox::information(
this,
809 tr(
"DB Connection Problem" ),
810 tr(
"There was an error connecting to the database:\n" )
816 bool rfilter = ( !
runID_sel.isEmpty() );
819 if ( ! dir.exists( tempdir ) )
820 dir.mkpath( tempdir );
825 setWindowTitle( tr(
"Load Edited Data from DB" ) );
828 QMap< QString, QString > aucIDs;
829 qDebug() <<
"ScDB:TM:01: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
833 query <<
"get_raw_desc_by_runID" << invID <<
runID_sel;
835 query <<
"get_rawData_desc" << invID;
838 qDebug() <<
"ScDB:TM:02: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
842 QString rLabel = db.value( 1 ).toString();
843 QString aFname = db.value( 2 ).toString();
844 QString aucID = db.value( 0 ).toString();
845 QString expID = db.value( 3 ).toString();
846 QString aucGUID = db.value( 7 ).toString();
847 aucIDs[ aFname ] = aucID +
"^" + aucGUID +
"^" + expID +
"^" + rLabel;
851 qDebug() <<
"ScDB:TM:03: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
852 QStringList editpars;
856 query <<
"get_edit_desc_by_runID" << invID <<
runID_sel;
858 query <<
"all_editedDataIDs" << invID;
861 qDebug() <<
"ScDB:TM:04: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
862 qDebug() <<
"ScDB: tfilter etype_filt" << tfilter <<
etype_filt;
868 QString etype = db.value( 8 ).toString().toLower();
870 if ( tfilter && etype != etype_filt )
873 QString recID = db.value( 0 ).toString();
874 QString descrip = db.value( 1 ).toString();
875 QString filename = db.value( 2 ).toString().replace(
"\\",
"/" );
876 QString filebase = filename.section(
"/", -1, -1 );
877 QString runID = descrip.isEmpty() ? filebase.section(
".", 0, -7 )
879 QString parID = db.value( 3 ).toString();
881 .toDateTime().toString( Qt::ISODate ), true );
882 QString cksum = db.value( 6 ).toString();
883 QString recsize = db.value( 7 ).toString();
884 QString recGUID = db.value( 9 ).toString();
888 editpars << filename;
892 editpars << cksum +
" " + recsize;
894 qDebug() <<
"ScDB:TM:05: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
897 int nedit = edtIDs.size();
898 qDebug() <<
"ScDB: nedit" << nedit;
900 for (
int ii = 0; ii < nedit; ii++ )
902 QString recID = edtIDs[ ii ];
903 int idRec = recID.toInt();
905 QString descrip = editpars[ kp++ ];
906 QString filename = editpars[ kp++ ];
907 QString parID = editpars[ kp++ ];
908 QString date = editpars[ kp++ ];
909 QString recGUID = editpars[ kp++ ];
910 QString echeck = editpars[ kp++ ];
912 QString filebase = filename.section(
"/", -1, -1 );
913 QString runID = descrip.isEmpty() ? filebase.section(
".", 0, -7 )
915 QString editID = filebase.section(
".", -6, -6 );
916 QString dataType = filebase.section(
".", -5, -5 );
917 QString tripID = filebase.section(
".", -4, -2 );
918 QString edtlamb = tripID .section(
".", 2, 2 );
919 QString aucfname = runID +
"." + dataType +
"." + tripID +
".auc";
920 bool isMwl = edtlamb.contains(
"-" );
921 int idAUC = aucIDs[ aucfname ].section(
"^", 0, 0 ).toInt();
922 QString aucGUID = aucIDs[ aucfname ].section(
"^", 1, 1 );
923 int idExp = aucIDs[ aucfname ].section(
"^", 2, 2 ).toInt();
924 QString elabel = aucIDs[ aucfname ].section(
"^", 3, 3 );
925 QString acheck = aucIDs[ aucfname ].section(
"^", 4, 4 ).simplified();
934 QString label = runID;
935 descrip = runID +
"." + tripID +
"." + editID;
936 QString baselabl = label;
962 QString edtfname = runID +
"." + dataType +
"." + tripID +
".xml";
963 QString edtpath = tempdir +
"/" + edtfname;
966 db.readBlobFromDB( edtpath,
"download_editData", idRec );
967 qApp->processEvents();
971 QFile filei( edtpath );
973 if ( ! filei.open( QIODevice::ReadOnly | QIODevice::Text ) )
975 QStringList mwlambds;
976 QXmlStreamReader xml( &filei );
977 QXmlStreamAttributes attr;
982 while( ! xml.atEnd() )
986 if ( xml.isStartElement() && xml.name() ==
"lambda" )
988 attr = xml.attributes();
989 elambda = attr.value(
"value" ).toString();
993 else if ( xml.isEndElement() && xml.name() ==
"lambdas" )
1000 QString otripID = tripID;
1001 QString odescrip = descrip;
1003 int tripknt = mwlambds.size();
1005 for (
int ii = 0; ii < tripknt; ii++ )
1007 elambda = mwlambds[ ii ];
1008 tripID = QString( otripID ).replace( edtlamb, elambda );
1009 descrip = QString( odescrip ).replace( otripID, tripID );
1010 aucfname = runID +
"." + dataType +
"." + tripID +
".auc";
1011 aucEntr = aucIDs[ aucfname ];
1012 idAUC = aucEntr.section(
"^", 0, 0 ).toInt();
1013 parGUID = aucEntr.section(
"^", 1, 1 );
1014 idExp = aucEntr.section(
"^", 2, 2 ).toInt();
1033 qDebug() <<
"ScDB:TM:08: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
1037 qDebug() <<
"ScDB:TM:09: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
1043 setWindowTitle( tr(
"Load Edited Data from Local Disk" ) );
1046 bool rfilter = ( !
runID_sel.isEmpty() );
1048 QStringList aucdirs = QDir( rdir ).entryList(
1049 QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name );
1051 QStringList aucfilt(
"*.auc" );
1052 QStringList edtfilt;
1056 for (
int ii = 0; ii < aucdirs.size(); ii++ )
1058 QString subdir = rdir +
"/" + aucdirs.at( ii );
1059 QStringList aucfiles = QDir( subdir ).entryList(
1060 aucfilt, QDir::Files, QDir::Name );
1062 if ( aucfiles.size() < 1 )
1065 QString aucfbase = aucfiles.at( 0 );
1066 QString aucfname = subdir +
"/" + aucfbase;
1067 QString runID = aucfbase.section(
".", 0, -6 );
1074 QString subType = aucfbase.section(
".", -5, -5 );
1075 QString tripl = aucfbase.section(
".", -4, -2 );
1076 QString auclamb = tripl .section(
".", 2, 2 );
1079 edtfilt << runID +
".*." + subType +
".*.xml";
1080 QStringList edtfiles = QDir( subdir ).entryList(
1081 edtfilt, QDir::Files, QDir::Name );
1084 if ( edtfiles.size() < 1 )
1087 for (
int jj = 0; jj < edtfiles.size(); jj++ )
1089 QStringList mwlambds;
1090 QString filebase = edtfiles.at( jj );
1091 QString filename = subdir +
"/" + filebase;
1092 QString runID = filebase.section(
".", 0, -7 );
1093 QString editID = filebase.section(
".", -6, -6 );
1094 editID = ( editID.length() == 12 && editID.startsWith(
"20" ) ) ?
1095 editID.mid( 2 ) : editID;
1096 QString tripID = filebase.section(
".", -4, -2 );
1097 QString edtlamb = tripID .section(
".", 2, 2 );
1098 QString label = runID;
1099 QString descrip = runID +
"." + tripID +
"." + editID;
1100 QString baselabl = label;
1102 QFile filei( filename );
1104 if ( ! filei.open( QIODevice::ReadOnly | QIODevice::Text ) )
1108 .lastModified().toUTC().toString( Qt::ISODate ),
true );
1110 QXmlStreamReader xml( &filei );
1111 QXmlStreamAttributes a;
1116 bool isMwl = edtlamb.contains(
"-" );
1118 while( ! xml.atEnd() )
1122 if ( xml.isStartElement() )
1124 if ( xml.name() ==
"editGUID" )
1126 a = xml.attributes();
1127 recGUID = a.value(
"value" ).toString();
1130 else if ( xml.name() ==
"rawDataGUID" )
1132 a = xml.attributes();
1133 parGUID = a.value(
"value" ).toString();
1136 else if ( xml.name() ==
"experiment" )
1138 a = xml.attributes();
1139 expType = a.value(
"type" ).toString().toLower();
1142 if ( isMwl && xml.name() ==
"lambda" )
1144 a = xml.attributes();
1145 elambda = a.value(
"value" ).toString();
1146 mwlambds << elambda;
1181 QString otripID = tripID;
1182 QString odescrip = descrip;
1183 int tripknt = mwlambds.size();
1185 for (
int ii = 0; ii < tripknt; ii++ )
1187 elambda = mwlambds[ ii ];
1188 tripID = QString( otripID ).replace( edtlamb, elambda );
1189 descrip = QString( odescrip ).replace( otripID, tripID );
1211 qDebug() <<
"ScDB:TM:00: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
1217 QMessageBox::information(
this,
1218 tr(
"DB Connection Problem" ),
1219 tr(
"There was an error connecting to the database:\n" )
1227 setWindowTitle( tr(
"Load Run Data from DB" ) );
1230 QMap< QString, QString > runinfo;
1231 qDebug() <<
"ScDB:TM:01: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
1233 query <<
"get_experiment_desc" << invID;
1235 qDebug() <<
"ScDB:TM:02: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
1252 QString expID = db.value( 0 ).toString();
1253 QString runID = db.value( 1 ).toString();
1254 QString label = db.value( 4 ).toString();
1256 .toDateTime().toString( Qt::ISODate ), true );
1269 qDebug() <<
"ScDB:TM:09: " << QTime::currentTime().toString(
"hh:mm:ss:zzzz");
1275 setWindowTitle( tr(
"Load Run Data from Local Disk" ) );
1279 QStringList aucdirs = QDir( rdir ).entryList(
1280 QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name );
1282 QStringList aucfilt(
"*.auc" );
1283 QStringList edtfilt;
1302 for (
int ii = 0; ii < aucdirs.size(); ii++ )
1304 QString subdir = rdir +
"/" + aucdirs.at( ii );
1305 QStringList aucfiles = QDir( subdir ).entryList(
1306 aucfilt, QDir::Files, QDir::Name );
1308 if ( aucfiles.size() < 1 )
1313 QString aucfbase = aucfiles.at( 0 );
1314 QString aucfname = subdir +
"/" + aucfbase;
1315 QString runID = aucfbase.section(
".", 0, -6 );
1316 QString subType = aucfbase.section(
".", -5, -5 );
1317 QString tripl = aucfbase.section(
".", -4, -2 );
1318 QString auclamb = tripl .section(
".", 2, 2 );
1321 edtfilt << runID +
".*." + subType +
".*.xml";
1322 QStringList edtfiles = QDir( subdir ).entryList(
1323 edtfilt, QDir::Files, QDir::Name );
1326 if ( edtfiles.size() < 1 )
1329 QStringList mwlambds;
1330 QString filebase = edtfiles.at( 0 );
1331 QString filename = subdir +
"/" + filebase;
1332 QString editID = filebase.section(
".", -6, -6 );
1333 editID = ( editID.length() == 12 && editID.startsWith(
"20" ) ) ?
1334 editID.mid( 2 ) : editID;
1335 QString tripID = filebase.section(
".", -4, -2 );
1336 QString edtlamb = tripID .section(
".", 2, 2 );
1337 QString label = runID;
1338 QString descrip = runID +
"." + tripID +
"." + editID;
1339 QString baselabl = label;
1341 QFile filei( filename );
1343 if ( ! filei.open( QIODevice::ReadOnly | QIODevice::Text ) )
1347 .lastModified().toUTC().toString( Qt::ISODate ),
true );
1349 QXmlStreamReader xml( &filei );
1350 QXmlStreamAttributes a;
1355 bool isMwl = edtlamb.contains(
"-" );
1357 while( ! xml.atEnd() )
1361 if ( xml.isStartElement() )
1363 if ( xml.name() ==
"editGUID" )
1365 a = xml.attributes();
1366 recGUID = a.value(
"value" ).toString();
1369 else if ( xml.name() ==
"rawDataGUID" )
1371 a = xml.attributes();
1372 parGUID = a.value(
"value" ).toString();
1375 else if ( xml.name() ==
"experiment" )
1377 a = xml.attributes();
1378 expType = a.value(
"type" ).toString().toLower();
1381 if ( isMwl && xml.name() ==
"lambda" )
1383 a = xml.attributes();
1384 elambda = a.value(
"value" ).toString();
1385 mwlambds << elambda;
1414 for (
int kk = 0; kk < 2; kk++ )
1416 QStringList keys =
datamap.keys();
1417 QList< DataDesc > vals =
datamap.values();
1420 for (
int ii = 0; ii < keys.size() - 1; ii++ )
1424 QString clabel = keys.at( ii );
1425 QString flabel = keys.at( jj );
1427 QString crunid = clabel.section(
".", 0, -2 );
1428 QString frunid = flabel.section(
".", 0, -2 );
1430 if ( crunid != frunid )
1432 QString cruncc = clabel.section(
".", 0, -3 );
1433 QString fruncc = flabel.section(
".", 0, -3 );
1435 if ( cruncc == fruncc )
1442 QString cdtxt = vals.at( ii ).date;
1443 QString fdtxt = vals.at( jj ).date;
1444 QDateTime cdate = QDateTime::fromString( cdtxt, Qt::ISODate );
1445 QDateTime fdate = QDateTime::fromString( fdtxt, Qt::ISODate );
1450 if ( cdate <= fdate )
1463 if ( kchg == 0 )
break;
1475 QStringList keys =
datamap.keys();
1476 QList< DataDesc > vals =
datamap.values();
1482 for (
int ii = 0; ii < keys.size(); ii++ )
1484 QString fname = vals.at( ii ).filename;
1485 QString cwavln = fname.section(
".", -2, -2 );
1487 if ( ! cwavln.contains(
"-" ) )
1490 QString cedit = fname.section(
".", 0, -6 );
1491 QString crunid = cedit.section(
".", 0, -2 );
1493 if ( ! mwruns.contains( crunid ) )
1496 if ( ! mwedts.contains( cedit ) )
1502 if ( mwedts.count() < 2 || mwedts.count() == mwruns.count() )
1507 QString prevedt = mwedts[ 0 ];
1508 QString prevrun = prevedt.section(
".", 0, -2 );
1510 for (
int ii = 1; ii < mwedts.count(); ii++ )
1512 QString curredt = mwedts[ ii ];
1513 QString currrun = curredt.section(
".", 0, -2 );
1515 if ( currrun == prevrun )
1525 for (
int ii = 0; ii < keys.size(); ii++ )
1527 QString fname = vals.at( ii ).filename;
1528 QString cwavln = fname.section(
".", -2, -2 );
1530 if ( ! cwavln.contains(
"-" ) )
1533 QString cedit = fname.section(
".", 0, -6 );
1535 if ( mwrmvs.contains( cedit ) )
1537 QString clabel = keys.at( ii );
1547 e->type() == QEvent::ContextMenu )
1549 QPoint mpos = ((QContextMenuEvent*)e)->pos();
1557 return US_WidgetsDialog::eventFilter( obj, e );
1564 QList< QTreeWidgetItem* > selitems =
tw_data->selectedItems();
1566 QTreeWidgetItem* item = selitems.size() > 0 ? selitems.at( 0 )
1568 int keyndx = item->type();
1574 QString dbID = QString::number(
ddesc.
DB_id );
1578 QString filespec = filename;
1582 filespec = filename.section(
"/", -1, -1 )
1583 + tr(
"\n File Directory: " )
1584 + filename.section(
"/", 0, -2 );
1587 QString dtext = tr(
"Data Information:" )
1588 + tr(
"\n Label: " ) + label
1589 + tr(
"\n Description: " ) + descript
1590 + tr(
"\n Edit Database ID: " ) + dbID
1591 + tr(
"\n Filename: " ) + filespec
1592 + tr(
"\n Last Updated: " ) +
ddesc.
date
1595 + tr(
"\n AUC DB ID: " ) + aucID
1596 + tr(
"\n Experiment DB ID: " ) + expID
1601 + tr(
"\n Triples per Run: " ) + QString::number(
ddesc.
tripknt )
1602 + tr(
"\n Triple Index: " ) + QString::number(
ddesc.
tripndx )
1603 + tr(
"\n Edits per Triple: " ) + QString::number(
ddesc.
editknt )
1604 + tr(
"\n Edit Index: " ) + QString::number(
ddesc.
editndx )
1609 edit->setWindowTitle( tr(
"Data Information" ) );
1610 edit->move( this->pos() + pos + QPoint( 100, 100 ) );
1611 edit->resize( 700, 350 );
1614 edit->
e->setText( dtext );
1625 connect(
le_dfilter, SIGNAL( textChanged(
const QString& ) ),
1626 SLOT (
search (
const QString& ) ) );
1639 rundir.replace(
"\\",
"/" );
1640 if ( QString( rundir ).right( 1 ) !=
"/" )
1643 QString runID = QString( rundir ).section(
"/", -2, -2 );
1644 QStringList ffilt( runID +
".??.xml" );
1645 QStringList efiles = QDir( rundir ).entryList( ffilt, QDir::Files,
1647 if ( efiles.size() != 1 )
1650 QString fname = efiles[ 0 ];
1651 QString fpath = rundir + efiles[ 0 ];
1652 QFile filei( fpath );
1654 if ( ! filei.open( QIODevice::ReadOnly | QIODevice::Text ) )
1657 QXmlStreamReader xml( &filei );
1659 while( ! xml.atEnd() )
1663 if ( xml.isStartElement() )
1665 if ( xml.name() ==
"experiment" )
1667 QXmlStreamAttributes atts = xml.attributes();
1668 expID = atts.value(
"id" ).toString();
1671 else if ( xml.name() ==
"label" )
1674 elabel = xml.text().toString();