13 setWindowTitle( tr(
"Available US3 Runs..." ) );
16 QVBoxLayout*
main =
new QVBoxLayout(
this );
17 main->setSpacing ( 2 );
18 main->setContentsMargins( 2, 2, 2, 2 );
21 QFontMetrics* fm =
new QFontMetrics( font );
32 tw =
new QTableWidget(
runInfo.size(), 4, this );
41 tw->setHorizontalHeaderLabels( headers );
42 tw->verticalHeader()->hide();
43 tw->setShowGrid(
false );
44 tw->setSelectionBehavior( QAbstractItemView::SelectRows );
45 tw->setMinimumWidth( 640 );
46 tw->setMinimumHeight( 480 );
47 tw->setRowHeight( 0, fm->height() + 4 );
48 tw->setColumnWidth( 0, 50 );
49 tw->setColumnWidth( 1, 150 );
50 tw->setColumnWidth( 2, 250 );
51 tw->setColumnWidth( 3, 350 );
54 for (
int i = 0; i <
runInfo.size(); i++ )
58 QTableWidgetItem* item =
new QTableWidgetItem( QString::number( r.
ID ) );
59 item ->setFlags(item->flags() ^ Qt::ItemIsEditable);
60 tw ->setItem( i, 0, item );
62 item =
new QTableWidgetItem( r.
date );
63 item ->setFlags(item->flags() ^ Qt::ItemIsEditable);
64 tw ->setItem( i, 1, item );
66 item =
new QTableWidgetItem( r.
runID );
67 item ->setFlags(item->flags() ^ Qt::ItemIsEditable);
68 tw ->setItem( i, 2, item );
70 item =
new QTableWidgetItem( r.
label );
71 item ->setFlags(item->flags() ^ Qt::ItemIsEditable);
72 tw ->setItem( i, 3, item );
76 QHeaderView* qHeader =
tw ->horizontalHeader();
77 connect( qHeader, SIGNAL( sectionClicked(
int ) ),
80 main->addWidget(
tw );
83 QHBoxLayout* buttons =
new QHBoxLayout;
86 connect( pb_cancel, SIGNAL( clicked() ), SLOT( reject() ) );
87 buttons->addWidget( pb_cancel );
90 connect( pb_delete, SIGNAL( clicked() ), SLOT(
deleteRun() ) );
91 buttons->addWidget( pb_delete );
94 connect( pb_accept, SIGNAL( clicked() ), SLOT(
select() ) );
95 buttons->addWidget( pb_accept );
97 main->addLayout( buttons );
109 QMessageBox::information(
this,
111 tr(
"Error making the DB connection.\n" ) );
118 QStringList q(
"get_experiment_desc" );
122 expIDs << db.
value( 0 ).toString();
126 foreach ( QString expID, expIDs )
129 q << QString(
"get_experiment_info" )
135 r.
ID = expID.toInt();
145 QMessageBox::information(
this,
147 tr(
"There are no US3 runs in the DB to load.\n" ) );
157 tw -> sortItems( col );
163 int ndx =
tw ->currentRow();
165 runID =
tw ->item( ndx, 2 )->text();
178 QMessageBox::information(
this,
180 tr(
"Error making the DB connection.\n" ) );
184 int status = QMessageBox::information(
this,
186 tr(
"Are you sure you want to delete this run from the DB? " ) +
187 tr(
"This action is not reversible. Proceed? " ),
188 tr(
"&OK" ), tr(
"&Cancel" ),
190 if ( status != 0 )
return;
192 int ndx =
tw ->currentRow();
193 QString expID =
tw ->item( ndx, 0 )->text();
196 QStringList q(
"count_calibration_experiments " );
202 qDebug() <<
"count_calibration_experiments( "
204 <<
" ) returned a negative count";
208 else if ( count > 0 )
210 QMessageBox::information(
this,
212 tr(
"Cannot delete an experiment that is associated "
213 "with a rotor calibration\n" ) );
217 tw->removeRow( ndx );
221 q <<
"delete_experiment_solutions"
227 q <<
"delete_cell_experiments"
234 q <<
"delete_experiment"
240 QMessageBox::information(
this,
242 db.
lastError() +
" (" + status +
")\n" );