UltraScan III
us_project_gui.cpp
Go to the documentation of this file.
1 
3 #include <QtGui>
4 
5 #include "us_settings.h"
6 #include "us_gui_settings.h"
7 #include "us_passwd.h"
8 #include "us_db2.h"
9 #include "us_investigator.h"
10 #include "us_project.h"
11 #include "us_project_gui.h"
12 
14  bool signal_wanted,
15  int select_db_disk,
16  const US_Project& dataIn
17  ) : US_WidgetsDialog( 0, 0 ), project( dataIn )
18 {
19  signal = signal_wanted;
21 
22  setWindowTitle( tr( "Project Management" ) );
23  setPalette( US_GuiSettings::frameColor() );
24 
25  QVBoxLayout* main = new QVBoxLayout( this );
26  main->setSpacing ( 2 );
27  main->setContentsMargins ( 2, 2, 2, 2 );
28 
29  QFontMetrics fm( QFont( US_GuiSettings::fontFamily(),
31 
32  QStringList DB = US_Settings::defaultDB();
33  if ( DB.isEmpty() ) DB << "Undefined";
34 
35  QLabel* lb_DB = us_banner( tr( "Database: " ) + DB.at( 0 ) );
36  lb_DB->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
37  main->addWidget( lb_DB );
38 
39  // Second row - tab widget
41  generalTab = new US_ProjectGuiGeneral( &investigatorID, select_db_disk );
51 
52  tabWidget -> addTab( generalTab, tr( "1: General" ) );
53  tabWidget -> addTab( goalsTab, tr( "2: Goals" ) );
54  tabWidget -> addTab( moleculesTab, tr( "3: Molecules" ) );
55  tabWidget -> addTab( purityTab, tr( "4: Purity" ) );
56  tabWidget -> addTab( expenseTab, tr( "5: Expense" ) );
57  tabWidget -> addTab( bufferComponentsTab, tr( "6: Buffer Components" ) );
58  tabWidget -> addTab( saltInformationTab, tr( "7: Salt Information" ) );
59  tabWidget -> addTab( auc_questionsTab, tr( "8: AUC Questions" ) );
60  tabWidget -> addTab( expDesignTab, tr( "9: Experiment Design" ) );
61  tabWidget -> addTab( notesTab, tr( "10: Notes" ) );
62 
63  main->addWidget( tabWidget );
64 
65  // Some pushbuttons
66  QHBoxLayout* buttons = new QHBoxLayout;
67 
68  QPushButton* pb_reset = us_pushbutton( tr( "Reset" ) );
69  connect( pb_reset, SIGNAL( clicked() ), SLOT( resetAll() ) );
70  buttons->addWidget( pb_reset );
71 
72  QPushButton* pb_help = us_pushbutton( tr( "Help" ) );
73  connect( pb_help, SIGNAL( clicked() ), SLOT( help() ) );
74  buttons->addWidget( pb_help );
75 
76  pb_accept = us_pushbutton( tr( "Close" ) );
77 
78  if ( signal )
79  {
80  QPushButton* pb_cancel = us_pushbutton( tr( "Cancel" ) );
81  connect( pb_cancel, SIGNAL( clicked() ), SLOT( cancel() ) );
82  buttons->addWidget( pb_cancel );
83 
84  pb_accept -> setText( tr( "Accept" ) );
85  }
86 
87  connect( pb_accept, SIGNAL( clicked() ), SLOT( accept() ) );
88  buttons->addWidget( pb_accept );
89 
90  // Global signals
91  connect( generalTab, SIGNAL( source_changed ( bool ) ),
92  SLOT ( source_changed ( bool ) ) );
93 
94  connect( generalTab, SIGNAL( newProject ( ) ),
95  SLOT ( newProject ( ) ) );
96 
97  connect( generalTab, SIGNAL( load ( ) ),
98  SLOT ( load ( ) ) );
99 
100  connect( generalTab, SIGNAL( selectProject( QListWidgetItem* ) ),
101  SLOT ( selectProject( QListWidgetItem* ) ) );
102 
103  connect( generalTab, SIGNAL( saveDescription( const QString& ) ),
104  SLOT ( saveDescription( const QString& ) ) );
105 
106  connect( generalTab, SIGNAL( save ( ) ),
107  SLOT ( saveProject ( ) ) );
108 
109  connect( generalTab, SIGNAL( deleteProject ( ) ),
110  SLOT ( deleteProject ( ) ) );
111 
112  connect( goalsTab, SIGNAL( goalsTabChanged ( ) ),
113  SLOT ( tabTextChanged ( ) ) );
114 
115  connect( moleculesTab,SIGNAL( moleculesTabChanged ( ) ),
116  SLOT ( tabTextChanged ( ) ) );
117 
118  connect( purityTab, SIGNAL( purityTabChanged ( const QString& ) ),
119  SLOT ( tabTextChanged ( const QString& ) ) );
120 
121  connect( expenseTab, SIGNAL( expenseTabChanged ( ) ),
122  SLOT ( tabTextChanged ( ) ) );
123 
124  connect( bufferComponentsTab,SIGNAL( bufferComponentsTabChanged ( ) ),
125  SLOT ( tabTextChanged ( ) ) );
126 
127  connect( saltInformationTab, SIGNAL( saltInformationTabChanged ( ) ),
128  SLOT ( tabTextChanged ( ) ) );
129 
130  connect( auc_questionsTab, SIGNAL( AUC_questionsTabChanged ( ) ),
131  SLOT ( tabTextChanged ( ) ) );
132 
133  connect( expDesignTab,SIGNAL( expDesignTabChanged ( ) ),
134  SLOT ( tabTextChanged ( ) ) );
135 
136  connect( notesTab, SIGNAL( notesTabChanged ( ) ),
137  SLOT ( tabTextChanged ( ) ) );
138 
139  // Now let's assemble the page
140 
141  main->addLayout( buttons );
142 
143  // Load the project descriptions
144  load();
145 
146  // Select the current one if we know what it is
147  if ( project.projectID > 0 )
148  {
149  QList< QListWidgetItem* > items
150  = generalTab->lw_projects->findItems( project.projectDesc, Qt::MatchExactly );
151 
152  // Should be exactly 1, but let's make sure
153  if ( items.size() == 1 )
154  {
155  selectProject( items[ 0 ] );
156  generalTab->lw_projects->setCurrentItem( items[ 0 ] );
157  }
158  }
159 }
160 
161 // Function to clean up all the tab pointers
163 {
164  delete generalTab ;
165  delete goalsTab ;
166  delete moleculesTab ;
167  delete purityTab ;
168  delete expenseTab ;
169  delete bufferComponentsTab ;
170  delete saltInformationTab ;
171  delete auc_questionsTab ;
172  delete expDesignTab ;
173  delete notesTab ;
174  delete tabWidget ;
175 }
176 
177 // Function to enable/disable buttons
179 {
191 
192  text_changed = false;
193 
194  enableButtons();
195 
196  generalTab->reset();
197 }
198 
199 // Function to determine which buttons should be enabled
201 {
202  // Let's calculate if we're eligible to save this project
203  generalTab->pb_save-> setEnabled( text_changed );
204 
205  // We can always delete something, even if it's just what's in the dialog
206  generalTab->pb_del->setEnabled( false );
207 
208  if ( generalTab->lw_projects->currentRow() != -1 )
209  {
210  generalTab->pb_del->setEnabled( true );
211  }
212 
213  // Figure out if the accept button should be enabled
214  if ( ! signal ) // Then it's just a close button
215  pb_accept->setEnabled( true );
216 
217  else if ( project.saveStatus == US_Project::BOTH )
218  pb_accept->setEnabled( true );
219 
221  pb_accept->setEnabled( true );
222 
224  pb_accept->setEnabled( true );
225 
226  else
227  pb_accept->setEnabled( false );
228 }
229 
230 // Function to clear out all data
232 {
233  IDs.clear();
234  descriptions.clear();
235  GUIDs.clear();
236  filenames.clear();
237 
238  projectMap.clear();
239 
240  info.clear();
241  project.clear();
242 
243  generalTab->lw_projects->clear();
244  reset();
245 }
246 
247 // Function to accept the current set of projects and return
249 {
250  if ( signal )
251  {
252  if ( generalTab->le_projectDesc->text().isEmpty() )
253  {
254  QMessageBox::information( this,
255  tr( "Attention" ),
256  tr( "Please enter a description for\n"
257  "your project before accepting." ) );
258  return;
259  }
260 
262  }
263 
264  close();
265 }
266 
267 // Function to cancel the current dialog and return
269 {
270  if ( signal )
272 
273  close();
274 }
275 
276 // Function to create a new project
278 {
279  resetAll();
280 
281  generalTab ->setDesc ( tr( "New Project" ) );
282 
283  goalsTab ->setGoals ( tr( "Please replace with an introduction to your "
284  "research project and explain the goals "
285  "of your research. We will use this "
286  "information to optimally design your "
287  "experiment. Please provide enough background "
288  "so we can assess the biological significance "
289  "of this research." ) );
290  moleculesTab ->setMolecules ( tr( "Please include their approximate molecular weights" ) );
291  purityTab ->setPurity ( tr( "%" ) );
292  expenseTab ->setExpense ( tr( "Would this expense be acceptable? If not, what amount "
293  "would you feel comfortable with?" ) );
294  bufferComponentsTab ->setBufferComponents ( tr( "What buffers do you plan to use? Is phosphate or "
295  "MOPS buffer an option?\n"
296  "To minimize absorbance we prefer to run phosphate or "
297  "MOPS buffers in low concentration (~ 5-10 mM). Salts "
298  "also absorb and should be kept to a minimum, although "
299  "a certain ionic sliength (25-50 mM) is desired to aid "
300  "with the hydrodynamic ideality behavior.\n\n"
301  "Do you need to have drugs in your sample, such as "
302  "reductants and nucleotide analogs?\n"
303  "Please list all components in your buffer. If reductants "
304  "are required it is essential that you use TCEP, which "
305  "can be used at 280 nm, but not lower wavelengths.\n\n"
306  "Please use this space to list all buffer components:" ) );
307  saltInformationTab ->setSaltInformation ( tr( "If not, please explain why not." ) );
308  auc_questionsTab ->setAUC_questions ( tr( "How do you propose to approach the research with "
309  "AUC experiments?" ) );
310  expDesignTab ->setExpDesign ( tr( "Please enter any notes about the experiment design." ) );
311  notesTab ->setNotes ( tr( "Special instructions, questions, and notes (optional)" ) );
312 
313  enableButtons();
314 }
315 
316 // Function to load projects into projects list widget
318 {
319  if ( generalTab->disk_controls->db() )
320  loadDB();
321 
322  else
323  loadDisk();
324 
325  text_changed = false;
326  enableButtons();
327 
328 }
329 
330 // Function to load projects from disk
332 {
333  QString path;
334  if ( ! project.diskPath( path ) ) return;
335 
336  IDs.clear();
337  descriptions.clear();
338  GUIDs.clear();
339  filenames.clear();
340 
341  QDir dir( path );
342  QStringList filter( "P*.xml" );
343  QStringList names = dir.entryList( filter, QDir::Files, QDir::Name );
344 
345  QFile a_file;
346 
347  for ( int i = 0; i < names.size(); i++ )
348  {
349  a_file.setFileName( path + "/" + names[ i ] );
350 
351  if ( ! a_file.open( QIODevice::ReadOnly | QIODevice::Text) ) continue;
352 
353  QXmlStreamReader xml( &a_file );
354 
355  while ( ! xml.atEnd() )
356  {
357  xml.readNext();
358 
359  if ( xml.isStartElement() )
360  {
361  if ( xml.name() == "project" )
362  {
363  QXmlStreamAttributes a = xml.attributes();
364 
365  IDs << a.value( "id" ).toString();
366  GUIDs << a.value( "guid" ).toString();
367  filenames << path + "/" + names[ i ];
368 
369  }
370 
371  else if ( xml.name() == "description" )
372  {
373  xml.readNext();
374  descriptions << xml.text().toString();
375  }
376  }
377  }
378 
379  a_file.close();
380  }
381 
382  loadProjects();
383 }
384 
385 // Function to load projects from db
387 {
388  US_Passwd pw;
389  QString masterPW = pw.getPasswd();
390  US_DB2 db( masterPW );
391 
392  if ( db.lastErrno() != US_DB2::OK )
393  {
394  db_error( db.lastError() );
395  return;
396  }
397 
399 
400  QStringList q( "get_project_desc" );
401  q << QString::number( investigatorID );
402  db.query( q );
403 
404  if ( db.lastErrno() != US_DB2::OK ) return;
405 
406  IDs.clear();
407  descriptions.clear();
408  GUIDs.clear();
409  filenames.clear();
410 
411  while ( db.next() )
412  {
413  QString newID = db.value( 0 ).toString();
414  IDs << newID;
415  descriptions << db.value( 1 ).toString();
416  GUIDs << QString( "" );
417  filenames << QString( "" );
418  }
419 
420  loadProjects();
421 }
422 
423 // Function to load the projects list widget from the projects data structure
425 {
426  generalTab->lw_projects->clear();
427  info.clear();
428  projectMap.clear();
429 
430  for ( int i = 0; i < descriptions.size(); i++ )
431  {
432  ProjectInfo si;
433  si.projectID = IDs [ i ].toInt();
434  si.description = descriptions[ i ];
435  si.GUID = GUIDs [ i ];
436  si.filename = filenames [ i ];
437  si.index = i;
438  info << si;
439 
440  // Create a map to account for automatic sorting of the list
441  QListWidgetItem* item = new QListWidgetItem( descriptions[ i ], generalTab->lw_projects );
442  projectMap[ item ] = i;
443 
444  generalTab->lw_projects->addItem( item );
445  }
446 }
447 
448 // Function to handle when project listwidget item is selected
449 void US_ProjectGui::selectProject( QListWidgetItem* item )
450 {
451  // Account for the fact that the list has been sorted
452  int ndx = projectMap[ item ];
453  int projectID = info[ ndx ].projectID;
454  QString projectGUID = info[ ndx ].GUID;
455 
456  project.clear();
457 
458  int status = US_DB2::OK;
459 
460  if ( generalTab->disk_controls->db() )
461  {
462  US_Passwd pw;
463  QString masterPW = pw.getPasswd();
464  US_DB2 db( masterPW );
465 
466  if ( db.lastErrno() != US_DB2::OK )
467  {
468  db_error( db.lastError() );
469  return;
470  }
471 
472  status = project.readFromDB ( projectID, &db );
473 
474  // Error reporting
475  if ( status == US_DB2::NO_PROJECT )
476  {
477  QMessageBox::information( this,
478  tr( "Attention" ),
479  tr( "The project was not found.\n"
480  "Please restore and try again.\n" ) );
481  }
482 
483  else if ( status != US_DB2::OK )
484  db_error( db.lastError() );
485  }
486 
487  else
488  {
489  status = project.readFromDisk( projectGUID );
490 
491  // Error reporting
492  if ( status == US_DB2::NO_PROJECT )
493  {
494  QMessageBox::information( this,
495  tr( "Attention" ),
496  tr( "The project was not found.\n"
497  "Please select an existing project and try again.\n" ) );
498  }
499 
500  else if ( status != US_DB2::OK )
501  {
502  QMessageBox::information( this,
503  tr( "Disk Read Problem" ),
504  tr( "Could not read data from the disk.\n"
505  "Disk status: " ) + QString::number( status ) );
506  }
507  }
508 
509  reset();
510 }
511 
512 // Function to update the description associated with the current project
513 void US_ProjectGui::saveDescription( const QString& )
514 {
516 
517  // Find the description in the lw; first making sure an item is selected
518  if ( generalTab->lw_projects->currentRow() > 0 )
519  {
520  QListWidgetItem* item = generalTab->lw_projects->currentItem();
521  item->setText( project.projectDesc );
522  generalTab->lw_projects->setCurrentItem( item );
523  }
524 
525  // Enable save
526  text_changed = true;
527  generalTab->pb_save-> setEnabled( true );
528 }
529 
530 // Function to save project information from all tabs to disk or db
532 {
533  // Load information from tabs
544 
545  if ( generalTab->disk_controls->db() )
546  {
547  US_Passwd pw;
548  QString masterPW = pw.getPasswd();
549  US_DB2 db( masterPW );
550 
551  if ( db.lastErrno() != US_DB2::OK )
552  {
553  db_error( db.lastError() );
554  return;
555  }
556 
557  int status = project.saveToDB( &db );
558 
559  if ( status == US_DB2::NO_PROJECT )
560  {
561  QMessageBox::information( this,
562  tr( "Attention" ),
563  tr( "There was a problem saving the project to the database.\n" ) );
564  return;
565  }
566 
567  else if ( status != US_DB2::OK )
568  {
569  db_error( db.lastError() );
570  return;
571  }
572 
573  }
574 
575  else
577 
578  QMessageBox::information( this,
579  tr( "Save results" ),
580  tr( "Project saved" ) );
581 
582  // Refresh project list
583  load();
584  reset();
585 
586  // Select the current item in the list
587  QList< QListWidgetItem* > items
588  = generalTab->lw_projects->findItems( project.projectDesc, Qt::MatchExactly );
589 
590  // should be exactly 1, but let's make sure
591  if ( items.size() == 1 )
592  {
593  selectProject( items[ 0 ] );
594  generalTab->lw_projects->setCurrentItem( items[ 0 ] );
595  }
596 }
597 
598 // Function to delete a project from disk, db, or in the current form
600 {
601  if ( generalTab->disk_controls->db() )
602  {
603  US_Passwd pw;
604  QString masterPW = pw.getPasswd();
605  US_DB2 db( masterPW );
606 
607  if ( db.lastErrno() != US_DB2::OK )
608  {
609  db_error( db.lastError() );
610  return;
611  }
612 
613  project.deleteFromDB( &db );
614  }
615 
616  else
618 
619  project.clear();
620  load();
621  reset();
622 
623  QMessageBox::information( this,
624  tr( "Delete results" ),
625  tr( "Project Deleted" ) );
626 }
627 
628 // Function to change the data source (disk/db)
630 {
631  QStringList DB = US_Settings::defaultDB();
632 
633  if ( DB.size() < 5 )
634  {
635  QMessageBox::warning( this,
636  tr( "Attention" ),
637  tr( "There is no default database set." ) );
638  }
639 
640  emit use_db( db );
641  qApp->processEvents();
642 
643  // Clear out project list
644  projectMap.clear();
645  generalTab->lw_projects->clear();
646 
647  load();
648  reset();
649 }
650 
651 void US_ProjectGui::tabTextChanged( const QString& )
652 {
653  text_changed = true;
654  generalTab->pb_save-> setEnabled( true );
655 }
656 
657 // Function to display an error returned from the database
658 void US_ProjectGui::db_error( const QString& error )
659 {
660  QMessageBox::warning( this, tr( "Database Problem" ),
661  tr( "Database returned the following error: \n" ) + error );
662 }
663 
665  int select_db_disk
666  ) : US_Widgets()
667 {
668  investigatorID = invID;
669 
670  // Very light gray, for read-only line edits
671  QPalette gray = US_GuiSettings::editColor();
672  gray.setColor( QPalette::Base, QColor( 0xe0, 0xe0, 0xe0 ) );
673 
674  QGridLayout* general = new QGridLayout( this );
675  general->setSpacing ( 2 );
676  general->setContentsMargins ( 2, 2, 2, 2 );
677 
678  int row = 0;
679 
680  // First row
681  if ( US_Settings::us_inv_level() > 2 )
682  {
683  QPushButton* pb_investigator = us_pushbutton( tr( "Select Investigator" ) );
684  connect( pb_investigator, SIGNAL( clicked() ), SLOT( sel_investigator() ) );
685  general->addWidget( pb_investigator, row, 0 );
686  }
687  else
688  {
689  QLabel* lb_investigator = us_label( tr( "Investigator:" ) );
690  general->addWidget( lb_investigator, row, 0 );
691  }
692 
693  le_investigator = us_lineedit( tr( "Not Selected" ) );
694  le_investigator->setReadOnly( true );
695  general->addWidget( le_investigator, row++, 1, 1, 2 );
696 
697  // Row 2 - Available projects
698  QLabel* lb_banner2 = us_banner( tr( "Click on project to select" ), -2 );
699  lb_banner2->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
700  lb_banner2->setMinimumWidth( 400 );
701  general->addWidget( lb_banner2, row, 0 );
702 
703  // Radio buttons
704  disk_controls = new US_Disk_DB_Controls( select_db_disk );
705  connect( disk_controls, SIGNAL( changed ( bool ) ),
706  SIGNAL( source_changed( bool ) ) );
707  general->addLayout( disk_controls, row++, 1, 1, 2 );
708 
709  // Row 3
711  lw_projects-> setSortingEnabled( true );
712  connect( lw_projects, SIGNAL( itemClicked ( QListWidgetItem* ) ),
713  SIGNAL( selectProject ( QListWidgetItem* ) ) );
714 
715  int add_rows = ( US_Settings::us_debug() == 0 ) ? 5 : 7;
716 
717  general->addWidget( lw_projects, row, 0, add_rows, 1 );
718 
719  // Row 4
720  pb_query = us_pushbutton( tr( "Query Projects" ), true );
721  connect( pb_query, SIGNAL( clicked() ), SIGNAL( load() ) );
722  general->addWidget( pb_query, row, 1 );
723 
724  pb_save = us_pushbutton( tr( "Save Project" ), false );
725  connect( pb_save, SIGNAL( clicked() ), SIGNAL( save() ) );
726  general->addWidget( pb_save, row++, 2 );
727 
728  // Row 5
729  pb_newProject = us_pushbutton( tr( "New Project" ), true );
730  connect( pb_newProject, SIGNAL( clicked() ), SIGNAL( newProject() ) );
731  general->addWidget( pb_newProject, row, 1 );
732 
733  pb_del = us_pushbutton( tr( "Delete Project" ), false );
734  connect( pb_del, SIGNAL( clicked() ), SIGNAL( deleteProject() ) );
735  general->addWidget( pb_del, row++, 2 );
736 
737  // Row 6
738  QLabel* lb_projectDesc = us_label( tr( "Project Name:" ) );
739  general->addWidget( lb_projectDesc, row++, 1, 1, 2 );
740 
741  // Row 7
742  le_projectDesc = us_lineedit( "", 1 );
743  connect( le_projectDesc, SIGNAL( textEdited ( const QString& ) ),
744  SIGNAL( saveDescription ( const QString& ) ) );
745  general->addWidget( le_projectDesc, row++, 1, 1, 2 );
746 
747  // Row 8
748  QLabel* lb_guid = us_label( tr( "Global Identifier:" ) );
749  general->addWidget( lb_guid, row++, 1, 1, 2 );
750 
751  // Row 9
752  le_guid = us_lineedit( "" );
753  le_guid->setPalette ( gray );
754  le_guid->setReadOnly( true );
755  general->addWidget( le_guid, row++, 1, 1, 2 );
756 
757  if ( US_Settings::us_debug() == 0 )
758  {
759  lb_guid->setVisible( false );
760  le_guid->setVisible( false );
761  }
762 
763  reset(); // This is the GeneralTab reset();
764 }
765 
766 // Function to refresh the display with values from the project structure,
767 // and to enable/disable features
769 {
770  // Display investigator
771  if ( *investigatorID == 0 )
773 
774  QString number = ( *investigatorID > 0 )
775  ? QString::number( *investigatorID ) + ": "
776  : "";
777 
778  le_investigator->setText( number + US_Settings::us_inv_name() );
779 }
780 
781 // Function to select the current investigator
783 {
784  US_Investigator* inv_dialog = new US_Investigator( true, *investigatorID );
785 
786  connect( inv_dialog,
787  SIGNAL( investigator_accepted( int ) ),
788  SLOT ( assign_investigator ( int ) ) );
789 
790  inv_dialog->exec();
791 }
792 
793 // Function to assign the selected investigator as current
795 {
796  *investigatorID = invID;
797 
798  QString number = ( *investigatorID > 0 )
799  ? QString::number( *investigatorID ) + ": "
800  : "";
801 
802  le_investigator->setText( number + US_Settings::us_inv_name() );
803 }
804 
805 void US_ProjectGuiGeneral::setGUID( QString newGUID )
806 {
807  le_guid->setText( newGUID );
808 }
809 
810 void US_ProjectGuiGeneral::setDesc( QString newDesc )
811 {
812  le_projectDesc->setText( newDesc );
813 }
814 
816 {
817  return( le_projectDesc->text() );
818 }
819 
821 {
822  QVBoxLayout* goals = new QVBoxLayout;
823 
824  QLabel* lb_goals =
825  us_label( tr( "Please provide a detailed description of your research, \n"
826  "including an introduction and goals:" ) );
827 
828  goals->addWidget( lb_goals );
829 
830  te_goals = us_textedit();
831  connect( te_goals, SIGNAL( textChanged () ),
832  SIGNAL( goalsTabChanged() ) );
833  goals->addWidget( te_goals );
834  te_goals->setMinimumHeight( 200 );
835  te_goals->setReadOnly( false );
836 
837  goals -> addStretch( 1 );
838  setLayout( goals );
839 }
840 
841 void US_ProjectGuiGoals::setGoals( QString newGoals )
842 {
843  te_goals->setText( newGoals );
844 }
845 
847 {
848  return( te_goals->toPlainText() );
849 }
850 
852 {
853  QVBoxLayout* molecules = new QVBoxLayout;
854 
855  QLabel* lb_molecules =
856  us_label( tr( "What proteins/DNA molecules are involved in the research?" ) );
857 
858  molecules->addWidget( lb_molecules );
859 
861  connect( te_molecules, SIGNAL( textChanged () ),
862  SIGNAL( moleculesTabChanged() ) );
863  molecules->addWidget( te_molecules );
864  te_molecules->setMinimumHeight( 200 );
865  te_molecules->setReadOnly( false );
866 
867  molecules -> addStretch( 1 );
868  setLayout( molecules );
869 }
870 
871 void US_ProjectGuiMolecules::setMolecules( QString newMolecules )
872 {
873  te_molecules->setText( newMolecules );
874 }
875 
877 {
878  return( te_molecules->toPlainText() );
879 }
880 
882 {
883  QVBoxLayout* purity = new QVBoxLayout;
884 
885  QLabel* lb_purity =
886  us_label( tr( "Please indicate the approximate purity of your sample(s)." ) );
887 
888  purity->addWidget( lb_purity );
889 
891  connect( le_purity, SIGNAL( textChanged ( const QString& ) ),
892  SIGNAL( purityTabChanged( const QString& ) ) );
893  purity->addWidget( le_purity );
894 // le_purity->setMinimumHeight( 200 );
895  le_purity->setReadOnly( false );
896 
897  purity -> addStretch( 1 );
898  setLayout( purity );
899 }
900 
901 void US_ProjectGuiPurity::setPurity( QString newPurity )
902 {
903  le_purity->setText( newPurity );
904 }
905 
907 {
908  return( le_purity->text() );
909 }
910 
912 {
913  QVBoxLayout* expense = new QVBoxLayout;
914 
915  QLabel* lb_expense =
916  us_label( tr( "Please rate the expense of providing 5 ml at 1 OD 280 concentration:" ) );
917 
918  expense->addWidget( lb_expense );
919 
921  connect( te_expense, SIGNAL( textChanged () ),
922  SIGNAL( expenseTabChanged() ) );
923  expense->addWidget( te_expense );
924  te_expense->setMinimumHeight( 200 );
925  te_expense->setReadOnly( false );
926 
927  expense -> addStretch( 1 );
928  setLayout( expense );
929 }
930 
931 void US_ProjectGuiExpense::setExpense( QString newExpense )
932 {
933  te_expense->setText( newExpense );
934 }
935 
937 {
938  return( te_expense->toPlainText() );
939 }
940 
942 {
943  QVBoxLayout* bufferComponents = new QVBoxLayout;
944 
945  QLabel* lb_bufferComponents =
946  us_label( tr( "What buffers do you plan to use?" ) );
947 
948  bufferComponents->addWidget( lb_bufferComponents );
949 
951  connect( te_bufferComponents, SIGNAL( textChanged () ),
952  SIGNAL( bufferComponentsTabChanged() ) );
953  bufferComponents->addWidget( te_bufferComponents );
954  te_bufferComponents->setMinimumHeight( 200 );
955  te_bufferComponents->setReadOnly( false );
956 
957  bufferComponents -> addStretch( 1 );
958  setLayout( bufferComponents );
959 }
960 
961 void US_ProjectGuiBufferComponents::setBufferComponents( QString newBufferComponents )
962 {
963  te_bufferComponents->setText( newBufferComponents );
964 }
965 
967 {
968  return( te_bufferComponents->toPlainText() );
969 }
970 
972 {
973  QVBoxLayout* saltInformation = new QVBoxLayout;
974 
975  QLabel* lb_saltInformation =
976  us_label( tr( "Is a salt concentration between 20-50 mM for your experiment acceptable?" ) );
977  saltInformation->addWidget( lb_saltInformation );
978 
980  connect( te_saltInformation, SIGNAL( textChanged () ),
981  SIGNAL( saltInformationTabChanged() ) );
982  saltInformation->addWidget( te_saltInformation );
983  te_saltInformation->setMinimumHeight( 200 );
984  te_saltInformation->setReadOnly( false );
985 
986  saltInformation -> addStretch( 1 );
987  setLayout( saltInformation );
988 }
989 
990 void US_ProjectGuiSaltInformation::setSaltInformation( QString newSaltInformation )
991 {
992  te_saltInformation->setText( newSaltInformation );
993 }
994 
996 {
997  return( te_saltInformation->toPlainText() );
998 }
999 
1001 {
1002  QVBoxLayout* auc_questions = new QVBoxLayout;
1003 
1004  QLabel* lb_auc_questions =
1005  us_label( tr( "What questions are you trying to answer with AUC?" ) );
1006  auc_questions->addWidget( lb_auc_questions );
1007 
1009  connect( te_auc_questions, SIGNAL( textChanged () ),
1010  SIGNAL( AUC_questionsTabChanged() ) );
1011  auc_questions->addWidget( te_auc_questions );
1012  te_auc_questions->setMinimumHeight( 200 );
1013  te_auc_questions->setReadOnly( false );
1014 
1015  auc_questions -> addStretch( 1 );
1016  setLayout( auc_questions );
1017 }
1018 
1019 void US_ProjectGuiAUC_questions::setAUC_questions( QString newAUC_questions )
1020 {
1021  te_auc_questions->setText( newAUC_questions );
1022 }
1023 
1025 {
1026  return( te_auc_questions->toPlainText() );
1027 }
1028 
1030 {
1031  QVBoxLayout* exp_design = new QVBoxLayout;
1032 
1033  QLabel* lb_exp_design =
1034  us_label( tr( "Do you have any notes about the design of the experiment?" ) );
1035  exp_design->addWidget( lb_exp_design );
1036 
1038  connect( te_exp_design, SIGNAL( textChanged () ),
1039  SIGNAL( expDesignTabChanged() ) );
1040  exp_design->addWidget( te_exp_design );
1041  te_exp_design->setMinimumHeight( 200 );
1042  te_exp_design->setReadOnly( false );
1043 
1044  exp_design -> addStretch( 1 );
1045  setLayout( exp_design );
1046 }
1047 
1048 void US_ProjectGuiExpDesign::setExpDesign( QString newExpDesign )
1049 {
1050  te_exp_design->setText( newExpDesign );
1051 }
1052 
1054 {
1055  return( te_exp_design->toPlainText() );
1056 }
1057 
1059 {
1060  QVBoxLayout* notes = new QVBoxLayout;
1061 
1062  QLabel* lb_notes = us_label( tr( "Notes:" ) );
1063  notes->addWidget( lb_notes );
1064 
1065  te_notes = us_textedit();
1066  connect( te_notes, SIGNAL( textChanged () ),
1067  SIGNAL( notesTabChanged() ) );
1068  notes->addWidget( te_notes );
1069  te_notes->setMinimumHeight( 200 );
1070  te_notes->setReadOnly( false );
1071 
1072  notes -> addStretch( 1 );
1073  setLayout( notes );
1074 }
1075 
1076 void US_ProjectGuiNotes::setNotes( QString newNotes )
1077 {
1078  te_notes->setText( newNotes );
1079 }
1080 
1082 {
1083  return( te_notes->toPlainText() );
1084 }