Skip to content

Commit

Permalink
Use getRef for ease of use. Refs #8538.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Apr 8, 2014
1 parent c8c27c2 commit edf82a7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/ICat/src/ICat4/ICat4Catalog.cpp
Expand Up @@ -390,7 +390,7 @@ namespace Mantid
if (outputws->getColumnNames().empty())
{
// Add rows headers to the output workspace.
outputws->addColumn("str","Investigation id");
outputws->addColumn("str","InvestigationID");
outputws->addColumn("str","Facility");
outputws->addColumn("str","Title");
outputws->addColumn("str","Instrument");
Expand Down
Expand Up @@ -72,14 +72,15 @@ namespace MantidQt
// Populate the form with investigations that the user can publish to.
for (size_t row = 0; row < workspace->rowCount(); row++)
{
m_uiForm.investigationNumberCb->addItem(QString::fromStdString(workspace->cell<std::string>(row, 0)));
m_uiForm.investigationNumberCb->addItem(QString::fromStdString(workspace->getRef<std::string>("InvestigationID",row)));
// Added tooltips to improve usability.
m_uiForm.investigationNumberCb->setItemData(static_cast<int>(row),
QString::fromStdString("The title of the investigation is: \"" + workspace->cell<std::string>(row, 1) +
"\".\nThe instrument of the investigation is: \"" + workspace->cell<std::string>(row, 2)) + "\".",Qt::ToolTipRole);
QString::fromStdString("The title of the investigation is: \"" + workspace->getRef<std::string>("Title",row) +
"\".\nThe instrument of the investigation is: \"" + workspace->getRef<std::string>("Instrument",row)) + "\".",
Qt::ToolTipRole);
// Set the user role to the sessionID.
m_uiForm.investigationNumberCb->setItemData(static_cast<int>(row),
QString::fromStdString(workspace->cell<std::string>(row, 7)),Qt::UserRole);
QString::fromStdString(workspace->getRef<std::string>("SessionID",row)),Qt::UserRole);
}
}
else
Expand Down
16 changes: 11 additions & 5 deletions Code/Mantid/MantidQt/MantidWidgets/src/CatalogSearch.cpp
Expand Up @@ -845,8 +845,9 @@ namespace MantidQt

QTableWidget* searchResultsTable = m_icatUiForm.searchResultsTbl;

// Obtain the investigation id from the selected
QTableWidgetItem* investigationId = searchResultsTable->item(item->row(),0);
// Obtain the investigationID from the selected
QTableWidgetItem* investigationId = searchResultsTable->item(
item->row(),headerIndexByName(searchResultsTable,"InvestigationID"));

// Remove previous dataFile search results.
std::string dataFileResults = "dataFileResults";
Expand Down Expand Up @@ -995,14 +996,19 @@ namespace MantidQt
*/
void CatalogSearch::updateDataFileLabels(QTableWidgetItem* item)
{
QTableWidget* searchResultsTable = m_icatUiForm.searchResultsTbl;

// Set the "title" label using the data from the investigation results workspace.
m_icatUiForm.dataFileTitleRes->setText(m_icatUiForm.searchResultsTbl->item(item->row(),1)->text());
m_icatUiForm.dataFileTitleRes->setText(searchResultsTable->item(item->row(),
headerIndexByName(searchResultsTable, "Title"))->text());

// Set the instrument label using data from the investigation results workspace.
m_icatUiForm.dataFileInstrumentRes->setText(m_icatUiForm.searchResultsTbl->item(item->row(),2)->text());
m_icatUiForm.dataFileInstrumentRes->setText(searchResultsTable->item(item->row(),
headerIndexByName(searchResultsTable, "Instrument"))->text());

// Show the related "run-range" for the specific dataFiles.
m_icatUiForm.dataFileRunRangeRes->setText(m_icatUiForm.searchResultsTbl->item(item->row(),3)->text());
m_icatUiForm.dataFileRunRangeRes->setText(searchResultsTable->item(item->row(),
headerIndexByName(searchResultsTable, "Run range"))->text());
}

/**
Expand Down

0 comments on commit edf82a7

Please sign in to comment.