UltraScan III
us_manage_data.cpp
Go to the documentation of this file.
1 
3 #include <QApplication>
4 
5 #include "us_manage_data.h"
6 #include "us_data_model.h"
7 #include "us_data_tree.h"
8 #include "us_data_process.h"
9 #include "us_settings.h"
10 #include "us_gui_settings.h"
11 #include "us_matrix.h"
12 #include "us_constants.h"
13 #include "us_license_t.h"
14 #include "us_license.h"
15 #include "us_passwd.h"
16 #include "us_investigator.h"
17 #include "us_editor.h"
18 #include "us_util.h"
19 
20 const QColor colorRed( 240, 0, 0 );
21 const QColor colorBlue( 0, 0, 255 );
22 const QColor colorBrown( 120, 60, 0 );
23 const QColor colorGreen( 0, 150, 0 );
24 const QColor colorGray( 110, 110, 110 );
25 const QColor colorWhite( 255, 255, 240 );
26 
27 #define timeFmt QString("hh:mm:ss")
28 #define nowTime() "T="+QDateTime::currentDateTime().toString(timeFmt)
29 
30 // main program
31 int main( int argc, char* argv[] )
32 {
33  QApplication application( argc, argv );
34 
35  #include "main1.inc"
36 
37  // License is OK. Start up.
38 
39  US_ManageData w;
40  //w.show(); //!< \memberof QWidget
41  if ( w.db != NULL )
42  return application.exec();
43  else
44  return -1;
45 }
46 
47 // US_ManageData class constructor
49 {
51 
52  // set up the GUI
53  setWindowTitle( tr( "Manage US DB/Local Data Sets" ) );
54  setPalette( US_GuiSettings::frameColor() );
55 DbgLv(1) << "GUI setup begun";
56 
57  // primary layouts
58  QHBoxLayout* mainLayout = new QHBoxLayout( this );
59  QVBoxLayout* leftLayout = new QVBoxLayout();
60  QVBoxLayout* rghtLayout = new QVBoxLayout();
61  QGridLayout* dctlLayout = new QGridLayout();
62  QVBoxLayout* smryLayout = new QVBoxLayout();
63  QGridLayout* statLayout = new QGridLayout();
64  QGridLayout* treeLayout = new QGridLayout();
65  mainLayout->setSpacing ( 2 );
66  mainLayout->setContentsMargins( 2, 2, 2, 2 );
67  leftLayout->setSpacing ( 0 );
68  leftLayout->setContentsMargins( 0, 1, 0, 1 );
69  rghtLayout->setSpacing ( 0 );
70  rghtLayout->setContentsMargins( 0, 1, 0, 1 );
71  dctlLayout->setSpacing ( 1 );
72  dctlLayout->setContentsMargins( 0, 0, 0, 0 );
73  smryLayout->setSpacing ( 0 );
74  smryLayout->setContentsMargins( 0, 1, 0, 1 );
75  statLayout->setSpacing ( 1 );
76  statLayout->setContentsMargins( 0, 0, 0, 0 );
77  treeLayout->setSpacing ( 1 );
78  treeLayout->setContentsMargins( 0, 0, 0, 0 );
79 
80  // fill in the GUI components
81  int row = 0;
82 
83  pb_invtor = us_pushbutton( tr( "Investigator" ) );
84  dctlLayout->addWidget( pb_invtor, row, 0, 1, 3 );
85 
87  QString invn = ( personID > 0 ) ? QString::number( personID ) : "";
89  1, true );
90  dctlLayout->addWidget( le_invtor, row++, 3, 1, 5 );
91 
92  pb_reset = us_pushbutton( tr( "Reset" ), false );
93  dctlLayout->addWidget( pb_reset, row, 0, 1, 4 );
94  connect( pb_reset, SIGNAL( clicked() ),
95  this, SLOT ( reset() ) );
96 
97  pb_scanda = us_pushbutton( tr( "Scan Data" ) );
98  dctlLayout->addWidget( pb_scanda, row++, 4, 1, 4 );
99  connect( pb_scanda, SIGNAL( clicked() ),
100  this, SLOT( scan_data() ) );
101 
102  pb_hsedit = us_pushbutton( tr( "Show All Edits" ) );
103  dctlLayout->addWidget( pb_hsedit, row, 0, 1, 4 );
104  connect( pb_hsedit, SIGNAL( clicked() ),
105  this, SLOT( toggle_edits() ) );
106 
107  pb_hsmodl = us_pushbutton( tr( "Show All Models" ) );
108  dctlLayout->addWidget( pb_hsmodl, row++, 4, 1, 4 );
109  connect( pb_hsmodl, SIGNAL( clicked() ),
110  this, SLOT( toggle_models() ) );
111 
112  pb_hsnois = us_pushbutton( tr( "Show All Noises" ) );
113  dctlLayout->addWidget( pb_hsnois, row, 0, 1, 4 );
114  connect( pb_hsnois, SIGNAL( clicked() ),
115  this, SLOT( toggle_noises() ) );
116 
117  pb_helpdt = us_pushbutton( tr( "Data Tree Help" ) );
118  dctlLayout->addWidget( pb_helpdt, row++, 4, 1, 4 );
119 
120  pb_help = us_pushbutton( tr( "Help" ) );
121  dctlLayout->addWidget( pb_help, row, 0, 1, 4 );
122  connect( pb_help, SIGNAL( clicked() ),
123  this, SLOT( help() ) );
124 
125  pb_close = us_pushbutton( tr( "Close" ) );
126  dctlLayout->addWidget( pb_close, row++, 4, 1, 4 );
127  connect( pb_close, SIGNAL( clicked() ),
128  this, SLOT( close() ) );
129 
130  QLabel* lb_runid = us_label( tr( "RunID:" ) );
131  cb_runid = us_comboBox();
132  cb_runid ->addItem( "ALL" );
133  dctlLayout->addWidget( lb_runid, row, 0, 1, 2 );
134  dctlLayout->addWidget( cb_runid, row++, 2, 1, 6 );
135  connect( cb_runid, SIGNAL( currentIndexChanged( QString ) ),
136  this, SLOT( selected_runID ( QString ) ) );
137 
138  QLabel* lb_triple = us_label( tr( "Triple:" ) );
140  cb_triple ->addItem( "ALL" );
141  dctlLayout->addWidget( lb_triple, row, 0, 1, 2 );
142  dctlLayout->addWidget( cb_triple, row++, 2, 1, 6 );
143 
144  QLabel* lb_source = us_label( tr( "Source:" ) );
146  cb_source ->addItem( "ALL" );
147  cb_source ->addItem( "DB Only" );
148  cb_source ->addItem( "Local Only" );
149  cb_source ->addItem( "Exclude Local-Only Trees" );
150  cb_source ->addItem( "Exclude DB-Only Trees" );
151  dctlLayout->addWidget( lb_source, row, 0, 1, 2 );
152  dctlLayout->addWidget( cb_source, row++, 2, 1, 6 );
153 
154  pb_invtor->setToolTip(
155  tr( "Use an Investigator dialog to set the database person ID" ) );
156  pb_scanda->setToolTip(
157  tr( "Scan Database and Local data, with content analysis" ) );
158  pb_helpdt->setToolTip(
159  tr( "Show a short Help/Legend dialog for notes on the data tree" ) );
160  pb_reset ->setToolTip(
161  tr( "Reset the data display to its default state" ) );
162  pb_help ->setToolTip(
163  tr( "Display detailed US_ManageData documentation text and images" ) );
164  pb_close ->setToolTip(
165  tr( "Close the US_ManageData window and exit" ) );
166  cb_runid ->setToolTip(
167  tr( "Select a single run ID with which to populate the data tree " ) );
168  cb_triple->setToolTip(
169  tr( "Select a single triple of the run to populate the data tree " ) );
170  cb_source->setToolTip(
171  tr( "Select a filter to limit records based on source (DB/Local) " ) );
172 
173  QLabel* lb_info2 = us_banner( tr( "User Data Sets Summary:" ) );
174  dctlLayout->addWidget( lb_info2, row++, 0, 1, 8 );
175 
176  QPalette pa( le_invtor->palette() );
177  te_status = us_textedit( );
178  te_status->setPalette( US_GuiSettings::normalColor() );
179  te_status->setTextBackgroundColor( pa.color( QPalette::Window ) );
180  te_status->setTextColor( pa.color( QPalette::WindowText ) );
181  te_status->setFont( QFont( US_Widgets::fixedFont().family(),
182  US_GuiSettings::fontSize() - 2 ) );
183  te_status->setText(
184  tr( " 0 Combined Total data sets;\n"
185  " 0 Combined RawData records;\n"
186  " 0 Combined EditedData records;\n"
187  " 0 Combined Model records;\n"
188  " 0 Combined Noise records.\n"
189  " 0 Database Total data sets;\n"
190  " 0 Database RawData records;\n"
191  " 0 Database EditedData records;\n"
192  " 0 Database Model records;\n"
193  " 0 Database Noise records.\n"
194  " 0 Local Total data sets;\n"
195  " 0 Local RawData records;\n"
196  " 0 Local EditedData records;\n"
197  " 0 Local Model records;\n"
198  " 0 Local Noise records.\n" ) );
199  smryLayout->addWidget( te_status );
200  QFontMetrics fm( te_status->font() );
201 DbgLv(1) << "te_status font family" << te_status->font().family();
202  int fontw = fm.maxWidth();
203  fontw = ( fontw > 0 ) ? fontw : fm.width( 'W' );
204  int fonth = fm.lineSpacing();
205  int minsw = fontw * 44 + 10;
206  int minsh = fonth * 18 + 10;
207 DbgLv(1) << "te_status fw fh mw mh" << fontw << fonth << " " << minsw << minsh;
208  int maxsw = ( minsw * 5 ) / 4;
209  int maxsh = ( minsh * 5 ) / 4;
210 
211  if ( maxsw > 500 || maxsh > 450 )
212  {
213  maxsw = qMin( maxsw, 500 );
214  maxsh = qMin( maxsh, 450 );
215  minsw = ( maxsw * 4 ) / 5;
216  minsh = ( maxsh * 4 ) / 5;
217  }
218 
219  cb_runid ->setMaximumSize( ( maxsw * 3 ) / 4, fonth * 2 );
220  cb_triple->setMaximumSize( ( maxsw * 3 ) / 4, fonth * 2 );
221  cb_source->setMaximumSize( ( maxsw * 3 ) / 4, fonth * 2 );
222 
223  te_status->setMinimumSize( minsw, minsh );
224  te_status->setMaximumSize( maxsw, maxsh );
225 DbgLv(1) << "te_status minw minh" << minsw << minsh;
226 DbgLv(1) << "te_status maxw maxh" << maxsw << maxsh;
227  te_status->adjustSize();
228 DbgLv(1) << "te_status size" << te_status->size();
229 
230  row = 0;
231  QLabel* lb_progr = us_label( tr( "% Completed:" ) );
232  progress = us_progressBar( 0, 100, 0 );
233  statLayout->addWidget( lb_progr, row, 0, 1, 4 );
234  statLayout->addWidget( progress, row++, 4, 1, 4 );
235 
236  lb_status = us_label( tr( "Status" ) );
237  statLayout->addWidget( lb_status, row, 0, 1, 8 );
238 
239  // set up data tree; populate with sample data
240  rbtn_click = false;
241  tw_recs = new QTreeWidget();
242  tw_recs->setPalette( te_status->palette() );
243  treeLayout->addWidget( tw_recs );
244 
245  QStringList theads;
246  theads << "Type" << "Label" << "SubType" << "Source"
247  << "Children\nDB, Local" << "Descendants\nDB, Local";
248  ntrows = 5;
249  ntcols = theads.size();
250  tw_recs->setHeaderLabels( theads );
251  tw_recs->setFont( QFont( US_Widgets::fixedFont().family(),
252  US_GuiSettings::fontSize() - 1 ) );
253  tw_recs->setObjectName( QString( "tree-widget" ) );
254  tw_recs->setAutoFillBackground( true );
255  tw_recs->installEventFilter( this );
256  tw_recs->setSelectionMode( QAbstractItemView::ExtendedSelection );
257 
258  connect( tw_recs, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ),
259  this, SLOT( clickedItem( QTreeWidgetItem* ) ) );
260 
261  reset_hsbuttons( false, true, true, true ); // hs button labels,tooltips
262 
263  // put layouts together for overall layout
264  leftLayout->addLayout( dctlLayout );
265  leftLayout->addLayout( smryLayout );
266  leftLayout->setStretchFactor( smryLayout, 10 );
267  leftLayout->addLayout( statLayout );
268  rghtLayout->addLayout( treeLayout );
269 
270  mainLayout->addLayout( leftLayout );
271  mainLayout->addLayout( rghtLayout );
272  mainLayout->setStretchFactor( leftLayout, 2 );
273  mainLayout->setStretchFactor( rghtLayout, 8 );
274 
275  setMinimumWidth( (int)( maxsw * 2.6 ) );
276 
277  show(); // display main window before password dialog appears
278 
279  // insure we can connect to the database
280  US_Passwd pw;
281  db = new US_DB2( pw.getPasswd() );
282  if ( db->lastErrno() != US_DB2::OK )
283  {
284  QMessageBox::information( this,
285  tr( "DB Connection Problem" ),
286  tr( "There was an error connecting to the database:\n" )
287  + db->lastError() + "\n"
288  //+ tr( "Cannot continue. Closing" ) );
289  + tr( "Continuing without database." ) );
290  db = NULL;
291  //return;
292  }
293 DbgLv(1) << "db passwd complete";
294 
295  connect( pb_invtor, SIGNAL( clicked() ),
296  this, SLOT( sel_investigator() ) );
297 DbgLv(1) << "GUI setup complete";
298 
299  // Create an object to handle the data itself
300  da_model = new US_DataModel( this );
301 
302  // Set needed pointers for class interaction in model object
303  da_model->setDatabase( db );
305 
306  // Create an object to handle processing the data (upload,download,remove)
307  da_process = new US_DataProcess( da_model, this );
308 
309  // Create an object to handle the data tree display
310  da_tree = new US_DataTree( da_model, tw_recs, this );
311 
312  // Set needed pointers to sibling classes in model object
313  da_model->setSiblings( (QObject*)da_process, (QObject*)da_tree );
314 DbgLv(1) << "classes setup complete";
315 
316  // Set up initial state of GUI
317  connect( pb_helpdt, SIGNAL( clicked() ),
318  da_tree, SLOT( dtree_help() ) );
319 
320  reset();
321 }
322 
323 // Reset the GUI
325 {
326  da_model->dummy_data ();
327  da_tree ->build_dtree();
328 
330 
332 
333  cb_runid ->clear();
334  cb_runid ->addItem ( "ALL" );
335  cb_runid ->addItems( runIDs );
336  cb_triple->clear();
337  cb_triple->addItem ( "ALL" );
338 
339 }
340 
341 // filter events to catch right-mouse-button-click on tree widget
342 bool US_ManageData::eventFilter( QObject *obj, QEvent *e )
343 {
344  if ( obj->objectName() == "tree-widget" &&
345  e->type() == QEvent::ContextMenu )
346  { // catch tree row right-mouse click
347  rbtn_click = true;
348  return false;
349  }
350 
351  else
352  { // pass all others for normal handling
353  return US_Widgets::eventFilter( obj, e );
354  }
355 }
356 
357 // toggle edits between hide/show
359 {
360  bool show = pb_hsedit->text().startsWith( "Show" ); // show or hide?
361 
362  da_tree->toggle_expand( "Raw", show ); // expand/collapse one level up
363 
364  if ( show )
365  { // for show edits, need only relabel edit button
366  reset_hsbuttons( show, true, false, false );
367  }
368 
369  else
370  { // for hide edits, must toggle labels below; relabel all buttons
371  da_tree->toggle_expand( "Model", show );
372  da_tree->toggle_expand( "Noise", show );
373 
374  reset_hsbuttons( show, true, true, true );
375  }
376 }
377 
378 // toggle models between hide/show
380 {
381  bool show = pb_hsmodl->text().startsWith( "Show" ); // show or hide?
382 
383  da_tree->toggle_expand( "Edited", show ); // expand/collapse one level up
384 
385  if ( show )
386  { // for show models, must expand levels above; reset edit,model buttons
387  da_tree->toggle_expand( "Raw", show );
388 
389  reset_hsbuttons( show, false, true, true );
390  }
391 
392  else
393  { // for hide models, must collapse below; reset model,noise buttons
394  da_tree->toggle_expand( "Noise", false );
395 
396  reset_hsbuttons( show, false, true, true );
397  }
398 }
399 
400 // toggle noises between hide/show
402 {
403  bool show = pb_hsnois->text().startsWith( "Show" ) // show or hide?
404  || pb_hsnois->text().startsWith( "Expand" );
405 
406  da_tree->toggle_expand( "Model", show ); // expand/collapse one level up
407 
408  if ( show )
409  { // for show noise, must expand above; reset edit,model,noise buttons
410  da_tree->toggle_expand( "Edited", show );
411  da_tree->toggle_expand( "Raw", show );
412 
413  reset_hsbuttons( show, true, true, true );
414  }
415 
416  else
417  { // for hide noise, need only reset noise button
418  reset_hsbuttons( show, false, false, true );
419  }
420 
421 }
422 
423 // change hide/show button text and tooltips for new expand/collapse state
425  bool edts, bool mods, bool nois )
426 {
427  QString blabl;
428  QString btool;
429 
430  if ( show )
431  { // show (expand) is the new state
432  if ( edts )
433  { // Hide Edits
434  pb_hsedit->setText( tr( "Collapse All" ) );
435  pb_hsedit->setToolTip(
436  tr( "Collapse All, so Edits and all descendants are hidden" ) );
437  }
438 
439  if ( mods )
440  { // Hide Models
441  pb_hsmodl->setText( tr( "Hide All Models" ) );
442  pb_hsmodl->setToolTip(
443  tr( "Collapse Edits, so Models and their children are hidden" ) );
444  }
445 
446  if ( nois )
447  { // Hide Noises
448  pb_hsnois->setText( tr( "Hide All Noises" ) );
449  pb_hsnois->setToolTip(
450  tr( "Collapse Models, so Noises are hidden" ) );
451  }
452  }
453 
454  else
455  { // hide (collapse) is the new state
456  if ( edts )
457  { // Show Edits
458  pb_hsedit->setText( tr( "Show All Edits" ) );
459  pb_hsedit->setToolTip(
460  tr( "Expand Raws, so Edits and parent Raws are shown" ) );
461  }
462 
463  if ( mods )
464  { // Show Models
465  pb_hsmodl->setText( tr( "Show All Models" ) );
466  pb_hsmodl->setToolTip(
467  tr( "Expand Edits, so Models and their parents are shown" ) );
468  }
469 
470  if ( nois )
471  { // Show Noises
472  pb_hsnois->setText( tr( "Expand All" ) );
473  pb_hsnois->setToolTip(
474  tr( "Expand All, so Noises and all ancestors are shown" ) );
475  }
476  }
477 }
478 
479 // Scan the database and local disk for R/E/M/N data sets
481 {
482  QString rF = cb_runid ->currentText();
483  QString tF = cb_triple->currentText();
484  QString sF = cb_source->currentText();
485 DbgLv(1) << "ScnDM: Start " << nowTime();
486  da_model->setFilters( rF, tF, sF ); // Set any run,triple,source filters
487 
488  da_model->scan_data(); // Scan the data
489 DbgLv(1) << "ScnDM: Scan Done " << nowTime();
490 
491  lb_status->setText( tr( "Building Data Tree..." ) );
492  qApp->processEvents();
493 
494  da_tree ->build_dtree(); // Rebuild the data tree with present data
495 DbgLv(1) << "ScnDM: Tree Built " << nowTime();
496 
497  lb_status->setText( tr( "Data Tree Build Complete" ) );
498  qApp->processEvents();
499 
500  // resize so all of columns are shown
501  tw_recs->expandAll(); // expand the entire tree
502 
503  for ( int jj = 0; jj < ntcols; jj++ )
504  {
505  tw_recs->resizeColumnToContents( jj ); // resize to fit contents
506  }
507 
508  tw_recs->collapseAll(); // collapse the entire tree
509 
510  this->resize( 1000, 500 );
511 
512  reset_hsbuttons( false, true, true, true ); // hs button labels,tooltips
513 
514  // reformat and display report on record counts
516 
517  pb_reset->setEnabled( true );
518 DbgLv(1) << "ScnDM: Scan All Done " << nowTime();
519 }
520 
521 
522 // Open dialog and get investigator when button clicked
524 {
525  US_Investigator* inv_dialog = new US_Investigator( true, personID );
526 
527  connect( inv_dialog,
528  SIGNAL( investigator_accepted( int ) ),
529  SLOT( assign_investigator ( int ) ) );
530 
531  inv_dialog->exec();
532 }
533 
534 // Assign an investigator string in proper id:lastname,firstname form
536 {
537  personID = invID;
538  le_invtor->setText( QString::number( personID )
539  + ": " + US_Settings::us_inv_name() );
540 
541  da_model->setDatabase( db );
542 }
543 
544 // Handle a right-mouse click of a row cell
545 void US_ManageData::clickedItem( QTreeWidgetItem* item )
546 {
547 //DbgLv(2) << "TABLE ITEM CLICKED rbtn_click" << rbtn_click;
548 
549  if ( rbtn_click )
550  { // only bring up context menu if right-mouse-button was clicked
551  da_tree->row_context_menu( item );
552  }
553  rbtn_click = false;
554 }
555 
556 // open a dialog and display data tree help
558 {
559 }
560 
561 // format an item action text for a message box
562 QString US_ManageData::action_text( QString exstext, QString acttext )
563 {
564  return tr( "This item exists on %1.<br>"
565  "Are you sure you want to proceed with a %2?<ul>"
566  "<li><b>No </b> to cancel the action;</li>"
567  "<li><b>Yes</b> to proceed with the action.</li></ul>" )
568  .arg( exstext ).arg( acttext );
569 }
570 
571 // report the result of an item action
572 void US_ManageData::action_result( int stat, QString item_act )
573 {
574  if ( stat != 999 )
575  { // proceed was selected: test status of action
576 
577  if ( stat == 0 )
578  { // action was successful
579  //QMessageBox::information( this,
580  // item_act + tr( " Successful!" ),
581  // tr( "The \"%1\" action was successfully performed." )
582  // .arg( item_act ) );
583  lb_status->setText( tr( "\"%1\" Success!" ).arg( item_act ) );
584  }
585 
586  else
587  { // action got an error
588  QMessageBox::warning( this,
589  item_act + tr( " *ERROR*!" ),
590  tr( "The \"%1\" action had an error: %2" )
591  .arg( item_act ).arg( stat ) );
592  lb_status->setText( tr( "\"%1\" ERROR!" ).arg( item_act ) );
593  }
594  }
595 
596  else
597  { // cancel was selected: report it
598  //QMessageBox::information( this,
599  // item_act + tr( " Cancelled!" ),
600  // tr( "The \"%1\" action was cancelled." ).arg( item_act ) );
601  lb_status->setText( tr( "\"%1\" Cancelled!" ).arg( item_act ) );
602  }
603 }
604 
605 // report status of data
607 {
609 
610  // count each type of record
611  ncrecs = da_model->recCount();
614  ncraws = ncedts = ncmods = ncnois = 0;
615  ndraws = ndedts = ndmods = ndnois = 0;
616  nlraws = nledts = nlmods = nlnois = 0;
617 
618  for ( int ii = 0; ii < ncrecs; ii++ )
619  {
620  cdesc = da_model->row_datadesc( ii );
621 
622  if ( cdesc.recType == 1 )
623  {
624  ncraws++;
625  ndraws += ( cdesc.recState & US_DataModel::REC_DB ) != 0 ? 1 : 0;
626  nlraws += ( cdesc.recState & US_DataModel::REC_LO ) != 0 ? 1 : 0;
627  }
628 
629  else if ( cdesc.recType == 2 )
630  {
631  ncedts++;
632  ndedts += ( cdesc.recState & US_DataModel::REC_DB ) != 0 ? 1 : 0;
633  nledts += ( cdesc.recState & US_DataModel::REC_LO ) != 0 ? 1 : 0;
634  }
635 
636  else if ( cdesc.recType == 3 )
637  {
638  ncmods++;
639  ndmods += ( cdesc.recState & US_DataModel::REC_DB ) != 0 ? 1 : 0;
640  nlmods += ( cdesc.recState & US_DataModel::REC_LO ) != 0 ? 1 : 0;
641  }
642 
643  else if ( cdesc.recType == 4 )
644  {
645  ncnois++;
646  ndnois += ( cdesc.recState & US_DataModel::REC_DB ) != 0 ? 1 : 0;
647  nlnois += ( cdesc.recState & US_DataModel::REC_LO ) != 0 ? 1 : 0;
648  }
649  }
650 
651  // In case there was filtering, recompute counts
652  ndrecs = ndraws + ndedts + ndmods + ndnois;
653  nlrecs = nlraws + nledts + nlmods + nlnois;
654  ncrecs = ndrecs + nlrecs;
655  ncraws = ndraws + nlraws;
656  ncedts = ndedts + nledts;
657  ncmods = ndmods + nlmods;
658  ncnois = ndnois + nlnois;
659 
660  // Reformat and display report on record counts
661  te_status->setText(
662  QString().sprintf( "%5d", ncrecs ) +
663  tr( " Combined Total data sets;\n " ) +
664  QString().sprintf( "%5d", ncraws ) +
665  tr( " Combined RawData records;\n " ) +
666  QString().sprintf( "%5d", ncedts ) +
667  tr( " Combined EditedData records;\n " ) +
668  QString().sprintf( "%5d", ncmods ) +
669  tr( " Combined Model records;\n " ) +
670  QString().sprintf( "%5d", ncnois ) +
671  tr( " Combined Noise records.\n" ) +
672  QString().sprintf( "%5d", ndrecs ) +
673  tr( " Database Total data sets;\n " ) +
674  QString().sprintf( "%5d", ndraws ) +
675  tr( " Database RawData records;\n " ) +
676  QString().sprintf( "%5d", ndedts ) +
677  tr( " Database EditedData records;\n " ) +
678  QString().sprintf( "%5d", ndmods ) +
679  tr( " Database Model records;\n " ) +
680  QString().sprintf( "%5d", ndnois ) +
681  tr( " Database Noise records.\n" ) +
682  QString().sprintf( "%5d", nlrecs ) +
683  tr( " Local Total data sets;\n " ) +
684  QString().sprintf( "%5d", nlraws ) +
685  tr( " Local RawData records;\n " ) +
686  QString().sprintf( "%5d", nledts ) +
687  tr( " Local EditedData records;\n " ) +
688  QString().sprintf( "%5d", nlmods ) +
689  tr( " Local Model records;\n " ) +
690  QString().sprintf( "%5d", nlnois ) +
691  tr( " Local Noise records.\n" ) );
692 }
693 
694 // Slot to handle a newly select runID filter
695 void US_ManageData::selected_runID( QString selrunID )
696 {
697 DbgLv(0) << "selected_runID: selrunID" << selrunID;
698  if ( selrunID.isEmpty() || selrunID == "ALL" )
699  {
700  cb_triple->clear();
701  cb_triple->addItem( "ALL" );
702  return;
703  }
704 
705  lb_status->setText( tr( "Scanning triples for a run..." ) );
706  qApp->processEvents();
707  QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
708  da_model->getTriples( triples, selrunID );
709 DbgLv(0) << "selected_runID: da_m getTriples size" << triples.size();
710 
711  cb_triple->clear();
712  cb_triple->addItem( "ALL" );
713  cb_triple->addItems( triples );
714  QApplication::restoreOverrideCursor();
715  int ntriple = triples.size();
716 
717  lb_status->setText(
718  ( ntriple == 1 ) ? tr( "The run has a single triple" )
719  : tr( "%1 triples are available to select" ).arg( ntriple ) );
720 
721 }
722