Skip to content

Commit

Permalink
GMP: 1.EXP-> SV vs. ABDE: fixed introduced bug for conventional SV ex…
Browse files Browse the repository at this point in the history
…periments.; testing wtite/read to/from DB for ABDE types...
  • Loading branch information
alexsav815 committed Apr 16, 2024
1 parent b81740f commit 0b94782
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 13 deletions.
192 changes: 183 additions & 9 deletions gui/us_report_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,155 @@ US_ReportGui::US_ReportGui( QMap < QString, US_ReportGMP* > report_map ) : US_Wi
QLabel* bn_report = us_banner( QString( tr( "Report Parameters for channel: %1" ) ).arg( report->channel_name ), 1 );
bn_report->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
main->addWidget( bn_report ); // row++, 0, 1,-1 );

params = new QGridLayout();
params ->setSpacing ( 2 );
params ->setContentsMargins ( 2, 2, 2, 2 );

lb_tot_conc = us_label( tr( "Total Concentration" ) );
lb_tot_conc_tol = us_label( tr( "Tolerance (+/-%)" ) );
lb_rmsd_limit = us_label( tr( "RMSD (upper limit)" ) );
lb_av_intensity = us_label( tr( "Minimum Intensity" ) );
lb_duration = us_label( tr( "Experiment Duration" ) );
lb_duration_tol = us_label( tr( "Tolerance (+/-%)" ) );
lb_wvl = us_label( tr( "Wavelength" ) );
QHBoxLayout* lo_duratlay = us_ddhhmmsslay( 0, 0,0,0,1, &sb_durat_dd, &sb_durat_hh, &sb_durat_mm, &sb_durat_ss ); // ALEXEY 0 - visible, 1 - hidden

le_tot_conc = us_lineedit( QString::number(report->tot_conc), 0, false );

le_tot_conc_tol = us_lineedit( QString::number(report->tot_conc_tol), 0, false );
le_duration_tol = us_lineedit( QString::number(report->experiment_duration_tol), 0, false );

le_rmsd_limit = us_lineedit( QString::number(report->rmsd_limit), 0, false );
le_av_intensity = us_lineedit( QString::number(report->av_intensity), 0, false );
if ( report->channel_name.contains("Interf.") )
le_av_intensity->setEnabled( false );

le_tot_conc -> setObjectName( "tot_conc" );
le_rmsd_limit -> setObjectName( "rmsd" );
le_av_intensity -> setObjectName( "av_intensity" );

le_tot_conc_tol -> setObjectName( "tot_conc_tol" );
le_duration_tol -> setObjectName( "duration_tol" );

//set connecitons btw textChanged() and slot
connect( le_tot_conc, SIGNAL( textChanged ( const QString& ) ),
this, SLOT ( verify_text ( const QString& ) ) );
connect( le_rmsd_limit, SIGNAL( textChanged ( const QString& ) ),
this, SLOT ( verify_text ( const QString& ) ) );
connect( le_av_intensity, SIGNAL( textChanged ( const QString& ) ),
this, SLOT ( verify_text ( const QString& ) ) );
connect( le_tot_conc_tol, SIGNAL( textChanged ( const QString& ) ),
this, SLOT ( verify_text ( const QString& ) ) );
connect( le_duration_tol, SIGNAL( textChanged ( const QString& ) ),
this, SLOT ( verify_text ( const QString& ) ) );

qDebug() << "Report params on load: tot_conc, conc_tol, duraiton, duration_tol -- "
<< report->tot_conc
<< report->tot_conc_tol
<< report->experiment_duration
<< report->experiment_duration_tol;

QList< int > dhms_dur;
double exp_dur = report->experiment_duration;
US_RunProtocol::timeToList( exp_dur, dhms_dur );
sb_durat_dd ->setValue( (int)dhms_dur[ 0 ] );
sb_durat_hh ->setValue( (int)dhms_dur[ 1 ] );
sb_durat_mm ->setValue( (int)dhms_dur[ 2 ] );
sb_durat_ss ->setValue( (int)dhms_dur[ 3 ] );

//Connect Exp. Duration counters to changes:
connect( sb_durat_dd, SIGNAL( valueChanged ( int ) ),
this, SLOT ( ssChgDuratTime_dd ( int ) ) );
connect( sb_durat_hh, SIGNAL( valueChanged ( int ) ),
this, SLOT ( ssChgDuratTime_hh ( int ) ) );
connect( sb_durat_mm, SIGNAL( valueChanged ( int ) ),
this, SLOT ( ssChgDuratTime_mm ( int ) ) );
connect( sb_durat_ss, SIGNAL( valueChanged ( int ) ),
this, SLOT ( ssChgDuratTime_ss ( int ) ) );

//ALEXEY_NEW_REPORT: wvl
cb_wvl = us_comboBox();
cb_wvl -> addItems( wvl_passed );
cb_wvl -> setCurrentIndex( init_index );
connect( cb_wvl, SIGNAL( currentIndexChanged( int ) ),
this, SLOT ( changeWvl ( int ) ) );
/////////////////////////////////////////////////////////////////////////////

pb_prev_wvl = us_pushbutton( tr( "previous" ), true, 0 );
pb_next_wvl = us_pushbutton( tr( "next" ), true, 0 );
pb_prev_wvl ->setIcon( US_Images::getIcon( US_Images::ARROW_LEFT ) );
pb_next_wvl ->setIcon( US_Images::getIcon( US_Images::ARROW_RIGHT ) );

connect( pb_prev_wvl, SIGNAL( clicked () ),
this, SLOT ( wvl_prev () ) );
connect( pb_next_wvl, SIGNAL( clicked () ),
this, SLOT ( wvl_next () ) );
////////////////////////////////////////////////////////////////////////////

pb_apply_all = us_pushbutton( tr( "Apply to all wvls" ), true, 0 );
connect( pb_apply_all, SIGNAL( clicked () ),
this, SLOT ( apply_all_wvls () ) );

row = 0;

params->addWidget( lb_tot_conc, row, 0, 1, 2 );
params->addWidget( le_tot_conc, row, 2, 1, 2 );

params->addWidget( lb_tot_conc_tol, row, 4, 1, 2 );
params->addWidget( le_tot_conc_tol, row, 6, 1, 2 );

params->addWidget( lb_rmsd_limit, row, 8, 1, 2 );
params->addWidget( le_rmsd_limit, row, 10, 1, 2 );

params->addWidget( lb_wvl, row, 12, 1, 2 );
params->addWidget( cb_wvl, row++, 14, 1, 2 );

params->addWidget( lb_duration, row, 0, 1, 2 );
params->addLayout( lo_duratlay, row, 2, 1, 2 );

params->addWidget( lb_duration_tol, row, 4, 1, 2 );
params->addWidget( le_duration_tol, row, 6, 1, 2 );

params->addWidget( lb_av_intensity, row, 8, 1, 2 );
params->addWidget( le_av_intensity, row, 10, 1, 2 );

params->addWidget( pb_prev_wvl, row, 12, 1, 2 );
params->addWidget( pb_next_wvl, row++, 14, 1, 2 );
params->addWidget( pb_apply_all, row++, 14, 1, 2 );

topContainerWidget = new QWidget;
topContainerWidget->setLayout( params );
main->addWidget( topContainerWidget );

////////////////////////////////////////////////////////////////////////////
if ( report_map.keys().size() == 1) //single-wvl
{
pb_prev_wvl ->setEnabled( false );
pb_next_wvl ->setEnabled( false );
pb_apply_all ->setEnabled( false );

pb_prev_wvl ->hide();
pb_next_wvl ->hide();
pb_apply_all ->hide();

cb_wvl ->setEnabled( false );
}

/////////////////////////////////////////////////////////////////////////////
if ( init_index == 0 )
pb_prev_wvl ->setEnabled( false );
if ( (init_index + 1 ) == cb_wvl->count() )
pb_next_wvl ->setEnabled( false );


bn_report_t = us_banner( tr( "Report Parameters: Type | Method" ) );
bn_report_t->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
main->addWidget( bn_report_t );

//Main Table
bn_report_t = NULL;
params = NULL;
// bn_report_t = NULL;
// params = NULL;
genL = NULL;
addRem_buttons = NULL;
reportmask = NULL;
Expand Down Expand Up @@ -105,7 +250,8 @@ void US_ReportGui::ssChgDuratTime_ss( int val )
void US_ReportGui::build_report_layout( void )
{
qDebug() << "Building Tabular Layout -- ";


/*
//clean params: upper panel
if ( params != NULL && params->layout() != NULL )
{
Expand Down Expand Up @@ -210,9 +356,9 @@ void US_ReportGui::build_report_layout( void )
connect( pb_apply_all, SIGNAL( clicked () ),
this, SLOT ( apply_all_wvls () ) );

**/
////////////////////////////////////////////////////////////////////////////

/**
row = 0;
if (!abde_mode )
{
Expand Down Expand Up @@ -264,12 +410,12 @@ void US_ReportGui::build_report_layout( void )
pb_apply_all -> setVisible( false );
}

**/
// int ihgt = le_tot_conc->height();
// QSpacerItem* spacer1 = new QSpacerItem( 20, 0.75*ihgt, QSizePolicy::Expanding );
// params->setRowStretch( row, 1 );
// params->addItem( spacer1, row++, 0, 1, 1 );

/***
topContainerWidget = new QWidget;
topContainerWidget->setLayout( params );
main->addWidget( topContainerWidget );
Expand Down Expand Up @@ -302,7 +448,26 @@ void US_ReportGui::build_report_layout( void )
bn_report_t = us_banner( tr( "Report Parameters: Type | Method" ) );
bn_report_t->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
main->addWidget( bn_report_t );
***/

//For param layout
if ( abde_mode )
{
lb_tot_conc -> setVisible( false );
le_tot_conc -> setVisible( false );
lb_tot_conc_tol -> setVisible( false );
le_tot_conc_tol -> setVisible( false );
lb_rmsd_limit -> setVisible( false );
le_rmsd_limit -> setVisible( false );
lb_wvl -> setVisible( false );
cb_wvl -> setVisible( false );
lb_av_intensity -> setVisible( false );
le_av_intensity -> setVisible( false );
pb_prev_wvl -> setVisible( false );
pb_next_wvl -> setVisible( false );
pb_apply_all -> setVisible( false );
}


//Clean genL layout first:
if ( genL != NULL && genL->layout() != NULL )
Expand Down Expand Up @@ -1238,8 +1403,11 @@ void US_ReportGui::changeWvl( int ndx )
sb_durat_ss ->setValue( (int)dhms_dur[ 3 ] );

//re-build genL layout ( lower portion, the reportItems )
//init_index = ndx;
build_report_layout( );

qDebug() << "in ChangeWvl: after build_report_layout( )1";

//Reconnect upper-portion Gui elements to ::verify_text()
connect( le_tot_conc, SIGNAL( textChanged ( const QString& ) ),
this, SLOT ( verify_text ( const QString& ) ) );
Expand All @@ -1251,7 +1419,8 @@ void US_ReportGui::changeWvl( int ndx )
this, SLOT ( verify_text ( const QString& ) ) );
connect( le_duration_tol, SIGNAL( textChanged ( const QString& ) ),
this, SLOT ( verify_text ( const QString& ) ) );


qDebug() << "in ChangeWvl: after build_report_layout( )2";
//Next/Previous wvl btns
if ( ndx == 0 )
pb_prev_wvl->setEnabled( false );
Expand All @@ -1262,7 +1431,8 @@ void US_ReportGui::changeWvl( int ndx )
pb_next_wvl->setEnabled( false );
else
pb_next_wvl->setEnabled( true );


qDebug() << "in ChangeWvl: after build_report_layout( )3";
}

// Slot to select next channel's wavelength
Expand All @@ -1284,12 +1454,16 @@ void US_ReportGui::wvl_next( void )
pb_prev_wvl ->setEnabled( true );
int row = cb_wvl->currentIndex() + 1;

qDebug() << "WVL_NEXT: 1";
if ( (row + 1 ) <= cb_wvl->count() )
{
qDebug() << "WVL_NEXT: 1A";
cb_wvl->setCurrentIndex( row );
qDebug() << "WVL_NEXT: 2";

if ( (row + 1 ) == cb_wvl->count() )
pb_next_wvl ->setEnabled( false );
qDebug() << "WVL_NEXT: 3";
}
else
pb_next_wvl->setEnabled( row < cb_wvl->count() );
Expand Down
8 changes: 8 additions & 0 deletions gui/us_report_gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ class US_GUI_EXTERN US_ReportGui: public US_Widgets

QLabel* bn_report_t;

QLabel* lb_tot_conc;
QLabel* lb_tot_conc_tol;
QLabel* lb_rmsd_limit;
QLabel* lb_av_intensity;
QLabel* lb_duration;
QLabel* lb_duration_tol;
QLabel* lb_wvl;

QLineEdit* le_tot_conc;
QLineEdit* le_tot_conc_tol;
QLineEdit* le_rmsd_limit;
Expand Down
11 changes: 7 additions & 4 deletions programs/us_analysis_profile/us_analysis_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ DbgLv(1) << "APG: ipro: o.ii" << ii << "chname" << chname

// //ALEXEY: also US_ReportGMP (blank/default for now)
// US_ReportGMP reportGMP = US_ReportGMP();



for ( int jj = 0; jj < ods.count(); jj++ )
{ // Create a channel entry for each optics type of this channel
QString opdesc = ods[ jj ];
Expand All @@ -290,7 +291,8 @@ DbgLv(1) << "APG: ipro: o.jj" << jj << "chentr" << chentr;
//ALEXEY: chname for currProf.ch_wvls:
QString sodesc_cut = QString( chentr ).section( ":", 2, 2 );
QString chentr_wvls = chname + ":" + opdesc + ":" + sodesc_cut;



if ( nchn < kchn )
{ // Replace channel and channel description

Expand Down Expand Up @@ -363,9 +365,9 @@ DbgLv(1) << "APG: ipro: o.jj" << jj << "chentr" << chentr;
for ( int i=0; i<ch_wavelengths.size(); ++i )
{
QString c_wvl = QString::number ( ch_wavelengths[ i ] );
//currProf.ch_reports[ chentr_wvls ][ c_wvl ] = currProf.ch_reports[ currProf.chndescs_alt[ nchn ] ][ c_wvl ];
currProf.ch_reports[ chentr_wvls ][ c_wvl ] = currProf.ch_reports[ currProf.chndescs_alt[ nchn ] ][ c_wvl ];

currProf.ch_reports[ chentr_wvls ][ c_wvl ] = currProf.ch_reports[ old_desc ][ old_wvl ];
//currProf.ch_reports[ chentr_wvls ][ c_wvl ] = currProf.ch_reports[ old_desc ][ old_wvl ];
currProf.ch_reports[ chentr_wvls ][ c_wvl ].channel_name = chentr_wvls;

qDebug() << "nchn < kchn: Filling currProf.ch_reports -- ";
Expand Down Expand Up @@ -457,6 +459,7 @@ DbgLv(1) << "APG: ipro: chx nchn dae" << chx << nchn
{
QString c_wvl = QString::number ( ch_wavelengths[ i ] );
currProf.ch_reports[ chentr_wvls ][ c_wvl ] = currProf.ch_reports[ currProf.chndescs_alt[ nchn ] ][ c_wvl ];
//currProf.ch_reports[ chentr_wvls ][ c_wvl ] = currProf.ch_reports[ currProf.chndescs_alt[ nchn - 1 ] ][ old_wvl ];
currProf.ch_reports[ chentr_wvls ][ c_wvl ].channel_name = chentr_wvls;

qDebug() << "nchn > kchn: Filling currProf.ch_reports -- ";
Expand Down
1 change: 1 addition & 0 deletions programs/us_experiment/us_exp_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ DbgLv(1) << "EGRo: inP: calib_entr" << cal_entr;
expType_old = cb_exptype ->currentText();

qDebug() << "Rotor::initPanel(), expType_old -- " << expType_old;

}

void US_ExperGuiRotor::init_grevs( void )
Expand Down
Loading

0 comments on commit 0b94782

Please sign in to comment.