16 setWindowTitle( tr(
"Scan Exclusion Profile Editor" ) );
19 QGridLayout*
main =
new QGridLayout(
this );
20 main->setSpacing ( 2 );
21 main->setContentsMargins( 2, 2, 2, 2 );
27 QLabel* lb_banner =
us_banner( tr(
"Create a Scan Exclusion Profile" ) );
28 main->addWidget( lb_banner, row++, 0, 1, 2 );
31 QLabel* lb_start =
us_label( tr(
"Start Exclusion at Scan:" ) );
32 main->addWidget( lb_start, row, 0 );
37 ct_start->setMinimumWidth( fm.maxWidth() * 10 );
39 connect(
ct_start, SIGNAL( valueChanged (
double ) ),
41 main->addWidget(
ct_start, row++, 1 );
44 QLabel* lb_stop =
us_label( tr(
"Stop Exclusion at Scan:" ) );
45 main->addWidget( lb_stop, row, 0 );
49 connect(
ct_stop, SIGNAL( valueChanged (
double ) ),
51 main->addWidget(
ct_stop, row++, 1 );
54 QLabel* lb_nth =
us_label( tr(
"Include every nth Scan:" ) );
55 main->addWidget( lb_nth, row, 0 );
59 connect(
ct_nth, SIGNAL( valueChanged (
double ) ),
60 SLOT (
update (
double ) ) );
61 main->addWidget(
ct_nth, row++, 1 );
64 QLabel* lb_remaining =
us_label( tr(
"Remaining Scans:" ) );
65 main->addWidget( lb_remaining, row, 0 );
71 QLabel* lb_excluded =
us_label( tr(
"Excluded Scans:" ) );
72 main->addWidget( lb_excluded, row, 0 );
78 QHBoxLayout* buttons =
new QHBoxLayout;
81 connect( pb_reset, SIGNAL( clicked() ), SLOT(
reset() ) );
82 buttons->addWidget( pb_reset );
85 connect( pb_help, SIGNAL( clicked() ), SLOT(
help() ) );
86 buttons->addWidget( pb_help );
89 connect( pb_cancel, SIGNAL( clicked() ), SLOT(
terminate() ) );
90 buttons->addWidget( pb_cancel );
93 connect( pb_apply, SIGNAL( clicked() ), SLOT(
apply() ) );
94 buttons->addWidget( pb_apply );
97 connect( pb_accept, SIGNAL( clicked() ), SLOT(
done() ) );
98 buttons->addWidget( pb_accept );
100 main->addLayout( buttons, row++, 0, 1, 2 );
109 connect(
ct_stop, SIGNAL( valueChanged (
double ) ),
113 if ( (
int)
ct_nth->value() > 1 )
123 connect(
ct_start, SIGNAL( valueChanged (
double ) ),
127 if ( (
int)
ct_nth->value() > 1 )
142 int start = (int)
ct_start->value() - 1;
143 int stop = (int)
ct_stop ->value();
144 int nth = (int)
ct_nth ->value();
147 QList< int > scnincl;
149 int exclCount =
current.size();
150 DbgLv(1) <<
"UPD: scanCount exclsize" << scanCount << exclCount;
151 if ( exclCount > 2 ) {
159 for (
int ii = 0; ii <=
original[ scanCount - 1 ]; ii++ )
160 if ( !
excludes.contains( ii ) ) scnincl << ii;
165 for (
int ii = 0; ii <
original[ scanCount - 1 ]; ii++ )
166 if ( original.contains( ii ) ) scnincl << ii;
169 stop = qMin( stop, scnincl.size() );
170 DbgLv(1) <<
"UPD: scninclsz" << scnincl.size() <<
"startstop" << start << stop;
173 for (
int ii = start; ii < stop; ii++ )
175 int scnnbr = scnincl[ ii ];
176 if(ii<(start+6)||ii>(stop-7)||ii==stop/2)
177 DbgLv(1) <<
"UPD: ii" << ii <<
"scnnbr" << scnnbr;
179 if ( ( ii - start ) % nth != 0 && !
excludes.contains( scnnbr ) )
182 if(ii<(start+6)||ii>(stop-7)||ii==stop/2)
183 DbgLv(1) <<
"UPD: excl UPD-scnnbr" << scnnbr;
190 QString scans = ( remaining == 1 ) ? tr(
" scan" ) : tr(
" scans" );
191 le_remaining->setText( QString::number( remaining ) + scans );
193 scans = ( excluded == 1 ) ? tr(
" scan" ) : tr(
" scans" );
194 le_excluded->setText( QString::number( excluded ) + scans );
198 if ( remaining < 10 )
200 int result = QMessageBox::question(
this,
201 tr(
"Exclude Error" ),
202 tr(
"Your profile should include\nat least 10 scans..." ),
203 QMessageBox::Cancel, QMessageBox::Ok);
205 if ( result == QMessageBox::Cancel )
return;
221 ct_stop ->setValue( scanCount );