Skip to content

Commit

Permalink
Merge branch 'feature/8244_icat_date_selector_issues' into develop. R…
Browse files Browse the repository at this point in the history
…efs #8321.

Conflicts:
	Code/Mantid/Framework/ICat/src/CatalogSearch.cpp
  • Loading branch information
jawrainey committed Nov 6, 2013
2 parents 56093bd + 1fca2b0 commit 00af515
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ namespace MantidQt

public:
/// Obtain the list of instruments that are available.
std::vector<std::string> getInstrumentList();
const std::vector<std::string> getInstrumentList();
/// Obtain the list of instruments that are available.
std::vector<std::string> getInvestigationTypeList();
const std::vector<std::string> getInvestigationTypeList();
/// Run the search algorithm with the given user input.
void executeSearch(std::map<std::string, std::string> userInputs);
void executeSearch(const std::map<std::string, std::string> &userInputs);
/// Search for all related dataFiles for the specified investigation.
void executeGetDataFiles(int64_t investigationId);
void executeGetDataFiles(const int64_t &investigationId);
/// Download dataFile (via HTTP or copy if access to archive) and return the path to it.
std::vector<std::string> downloadDataFiles(std::vector<std::pair<int64_t, std::string>> userSelectedFiles, std::string downloadPath);
const std::vector<std::string> downloadDataFiles(const std::vector<std::pair<int64_t, std::string>> &userSelectedFiles, const std::string &downloadPath);
/// Validate each input field against the related algorithm property.
std::map<std::string, std::string> validateProperties(std::map<std::string, std::string> &inputFields);
const std::map<std::string, std::string> validateProperties(const std::map<std::string, std::string> &inputFields);
/// Using a property (isValid) in the list instruments algorithm verify if the session is valid.
bool validSession();
/// Open the login dialog if user not logged in.
Expand All @@ -35,7 +35,7 @@ namespace MantidQt
/// Obtain the documentation for a given name from the given algorithm properties.
const std::string propertyDocumentation(const std::vector<Mantid::Kernel::Property*> &properties, const std::string &name);
/// Execute the given algorithm asynchronously.
void executeAsynchronously(Mantid::API::IAlgorithm_sptr algorithm);
void executeAsynchronously(const Mantid::API::IAlgorithm_sptr &algorithm);

};
} // namespace MantidWidgets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ namespace MantidQt
/// Make the headers in the provided table bold.
void emboldenTableHeaders(QTableWidget* table);
/// Setup table prior to adding data to it, such hiding vertical header.
void setupTable(QTableWidget* table, size_t numOfRows, size_t numOfColumns);
void setupTable(QTableWidget* table, const size_t &numOfRows, const size_t &numOfColumns);
/// Populate the provided table with data from the provided workspace.
void populateTable(QTableWidget* table, Mantid::API::ITableWorkspace_sptr workspace);
void populateTable(QTableWidget* table, const Mantid::API::ITableWorkspace_sptr &workspace);
/// Removes data associated with previous search.
void clearSearch(QTableWidget* table, std::string& workspace);
void clearSearch(QTableWidget* table, const std::string &workspace);
/// Clear the "search" frame when an investigation has been selected.
void clearSearchFrame();
/// Clear the "search results" frame if no results are returned from search.
Expand All @@ -78,13 +78,13 @@ namespace MantidQt
///////////////////////////////////////////////////////////////////////////////

/// Ensures the correct text box is updated when the date is selected on the calendar.
void dateSelected(std::string buttonName);
void dateSelected(const std::string &buttonName);
/// Populate the instrument list-box.
void populateInstrumentBox();
/// Populate the investigation type list-box.
void populateInvestigationTypeBox();
/// Obtain the users' text input for each search field.
std::map<std::string, std::string> getSearchFields();
const std::map<std::string, std::string> getSearchFields();

///////////////////////////////////////////////////////////////////////////////
// Methods for: "Search results"
Expand All @@ -106,17 +106,17 @@ namespace MantidQt
/// Add a row of checkboxes to the first column of a table.
void addCheckBoxColumn(QTableWidget* table);
/// Obtain the file details (file ID and name) for the file to download. (Used in downloadDataFiles).
std::vector<std::pair<int64_t, std::string>> selectedDataFileNames();
const std::vector<std::pair<int64_t, std::string>> selectedDataFileNames();
/// Updates the dataFile text boxes with relevant info about the selected dataFile.
void updateDataFileLabels(QTableWidgetItem* item);
/// Obtain all file extensions from the provided column (dataFileResults -> File name).
std::set<std::string> getDataFileExtensions(Mantid::API::Column_sptr column);
/// Add the list of file extensions to the "Filter type..." drop-down.
void populateDataFileType(std::set<std::string> extensions);
void populateDataFileType(const std::set<std::string> &extensions);

private slots:
/// Selects/deselects ALL rows in dataFile table.
void selectAllDataFiles(bool toggled);
void selectAllDataFiles(const bool &toggled);
/// When the facility login button is clicked
void onFacilityLogin();
/// When the help button is clicked.
Expand Down Expand Up @@ -168,7 +168,7 @@ namespace MantidQt
/// Enables the download & load button if user has selected a data file to download.
void enableDownloadButtons();
/// Performs filterDataFileType() for specified filer type.
void doFilter(int index);
void doFilter(const int &index);
/// Downloads selected datFiles to a specified location.
void downloadDataFiles();
/// Loads the selected dataFiles into workspaces.
Expand Down
20 changes: 10 additions & 10 deletions Code/Mantid/MantidQt/MantidWidgets/src/ICatHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace MantidQt
* Obtain the list of instruments from the ICAT Catalog algorithm.
* @return A vector containing the list of all instruments available.
*/
std::vector<std::string> ICatHelper::getInstrumentList()
const std::vector<std::string> ICatHelper::getInstrumentList()
{
auto catalogAlgorithm = createCatalogAlgorithm("CatalogListInstruments");
executeAsynchronously(catalogAlgorithm);
Expand All @@ -25,7 +25,7 @@ namespace MantidQt
* Obtain the list of investigation types from the ICAT Catalog algorithm.
* @return A vector containing the list of all investigation types available.
*/
std::vector<std::string> ICatHelper::getInvestigationTypeList()
const std::vector<std::string> ICatHelper::getInvestigationTypeList()
{
auto catalogAlgorithm = createCatalogAlgorithm("CatalogListInvestigationTypes");
executeAsynchronously(catalogAlgorithm);
Expand All @@ -37,7 +37,7 @@ namespace MantidQt
* Search the archive with the user input terms provided and save them to a workspace ("searchResults").
* @param userInputFields :: A map containing all users' search fields - (key => FieldName, value => FieldValue).
*/
void ICatHelper::executeSearch(std::map<std::string, std::string> userInputFields)
void ICatHelper::executeSearch(const std::map<std::string, std::string> &userInputFields)
{
auto catalogAlgorithm = createCatalogAlgorithm("CatalogSearch");

Expand All @@ -46,7 +46,7 @@ namespace MantidQt

// Iterate over the provided map of user input fields. For each field that isn't empty (e.g. a value was input by the user)
// then we will set the algorithm property with the key and value of that specific value.
for ( std::map<std::string, std::string>::const_iterator it = userInputFields.begin(); it != userInputFields.end(); it++)
for (auto it = userInputFields.begin(); it != userInputFields.end(); it++)
{
std::string value = it->second;
// If the user has input any search terms.
Expand All @@ -64,7 +64,7 @@ namespace MantidQt
* Search the archives for all dataFiles related to an "investigation id" then save results to workspace ("dataFileResults").
* @param investigationId :: The investigation id to use for the search.
*/
void ICatHelper::executeGetDataFiles(int64_t investigationId)
void ICatHelper::executeGetDataFiles(const int64_t &investigationId)
{
auto catalogAlgorithm = createCatalogAlgorithm("CatalogGetDataFiles");

Expand All @@ -83,7 +83,7 @@ namespace MantidQt
* @param downloadPath :: The location to save the datafile(s).
* @return A vector containing the paths to the file(s) the user wants.
*/
std::vector<std::string> ICatHelper::downloadDataFiles(std::vector<std::pair<int64_t, std::string>> userSelectedFiles, std::string downloadPath)
const std::vector<std::string> ICatHelper::downloadDataFiles(const std::vector<std::pair<int64_t, std::string>> &userSelectedFiles,const std::string &downloadPath)
{
auto catalogAlgorithm = createCatalogAlgorithm("CatalogDownloadDataFiles");

Expand All @@ -94,7 +94,7 @@ namespace MantidQt
std::vector<std::string> fileNames;

// For each pair in userSelectedFiles we want to add them to their related vector to pass to the algorithm.
for (std::vector<std::pair<int64_t,std::string>>::iterator it = userSelectedFiles.begin(); it != userSelectedFiles.end(); ++it)
for (auto it = userSelectedFiles.begin(); it != userSelectedFiles.end(); ++it)
{
fileIDs.push_back(it->first);
fileNames.push_back(it->second);
Expand All @@ -117,7 +117,7 @@ namespace MantidQt
* @param inputFields :: The name of the input field and value of the field (key => "StartDate", value => "00/00/0000").
* @return The name of the input field(s) marker to update and related error to throw.
*/
std::map<std::string, std::string> ICatHelper::validateProperties(std::map<std::string, std::string> &inputFields)
const std::map<std::string, std::string> ICatHelper::validateProperties(const std::map<std::string, std::string> &inputFields)
{
auto catalogAlgorithm = createCatalogAlgorithm("CatalogSearch");

Expand Down Expand Up @@ -202,7 +202,7 @@ namespace MantidQt
* @param algName :: The name of the algorithm to create.
* @return A shared pointer to the algorithm created.
*/
Mantid::API::IAlgorithm_sptr ICatHelper::createCatalogAlgorithm(const std::string& algName)
Mantid::API::IAlgorithm_sptr ICatHelper::createCatalogAlgorithm(const std::string &algName)
{
// If there is an exception we want it to be thrown.
return Mantid::API::AlgorithmManager::Instance().create(algName);
Expand All @@ -212,7 +212,7 @@ namespace MantidQt
* Execute the given algorithm asynchronously.
* @param algorithm :: The algorithm to execute.
*/
void ICatHelper::executeAsynchronously(Mantid::API::IAlgorithm_sptr algorithm)
void ICatHelper::executeAsynchronously(const Mantid::API::IAlgorithm_sptr &algorithm)
{
Poco::ActiveResult<bool> result(algorithm->executeAsync());
while(!result.available())
Expand Down
18 changes: 9 additions & 9 deletions Code/Mantid/MantidQt/MantidWidgets/src/ICatSearch2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ namespace MantidQt
* @param numOfRows :: The number of rows in the workspace.
* @param numOfColumns :: The number of columns in the workspace.
*/
void ICatSearch2::setupTable(QTableWidget* table, size_t numOfRows, size_t numOfColumns)
void ICatSearch2::setupTable(QTableWidget* table, const size_t &numOfRows, const size_t &numOfColumns)
{
table->setRowCount(static_cast<int>(numOfRows));
table->setColumnCount(static_cast<int>(numOfColumns));
Expand All @@ -224,7 +224,7 @@ namespace MantidQt
* @param table :: The table we want to setup.
* @param workspace :: The workspace to obtain data information from.
*/
void ICatSearch2::populateTable(QTableWidget* table, Mantid::API::ITableWorkspace_sptr workspace)
void ICatSearch2::populateTable(QTableWidget* table, const Mantid::API::ITableWorkspace_sptr &workspace)
{
//NOTE: This method freezes up the ICAT search GUI. We will need to do this adding in another thread.

Expand Down Expand Up @@ -264,7 +264,7 @@ namespace MantidQt
* @param table :: The table to modify and remove previous results from.
* @param workspace :: The workspace to remove.
*/
void ICatSearch2::clearSearch(QTableWidget* table, std::string & workspace)
void ICatSearch2::clearSearch(QTableWidget* table, const std::string &workspace)
{
// Remove workspace if it exists.
if(Mantid::API::AnalysisDataService::Instance().doesExist(workspace))
Expand Down Expand Up @@ -372,7 +372,7 @@ namespace MantidQt
* Updates text field depending on button picker selected.
* @param buttonName :: The name of the text field is derived from the buttonName.
*/
void ICatSearch2::dateSelected(std::string buttonName)
void ICatSearch2::dateSelected(const std::string &buttonName)
{
if (buttonName.compare("startDatePicker") == 0)
{
Expand Down Expand Up @@ -440,7 +440,7 @@ namespace MantidQt
* Get the users' input for each search field.
* @return A map containing all users' search fields - (key => FieldName, value => FieldValue).
*/
std::map<std::string, std::string> ICatSearch2::getSearchFields()
const std::map<std::string, std::string> ICatSearch2::getSearchFields()
{
std::map<std::string, std::string> searchFieldInput;

Expand Down Expand Up @@ -896,7 +896,7 @@ namespace MantidQt
*
* @return A vector containing the fileID and fileName of the datafile(s) to download.
*/
std::vector<std::pair<int64_t, std::string>> ICatSearch2::selectedDataFileNames()
const std::vector<std::pair<int64_t, std::string>> ICatSearch2::selectedDataFileNames()
{
QTableWidget* table = m_icatUiForm.dataFileResultsTbl;

Expand Down Expand Up @@ -955,7 +955,7 @@ namespace MantidQt
/**
* Add the list of file extensions to the "Filter type..." drop-down.
*/
void ICatSearch2::populateDataFileType(std::set<std::string> extensions)
void ICatSearch2::populateDataFileType(const std::set<std::string> &extensions)
{
for( std::set<std::string>::const_iterator iter = extensions.begin(); iter != extensions.end(); ++iter)
{
Expand All @@ -971,7 +971,7 @@ namespace MantidQt
* If the user has checked "check all", then check and select ALL rows. Otherwise, deselect all.
* @param toggled :: True if user has checked the checkbox in the dataFile table header.
*/
void ICatSearch2::selectAllDataFiles(bool toggled)
void ICatSearch2::selectAllDataFiles(const bool &toggled)
{
QTableWidget* table = m_icatUiForm.dataFileResultsTbl;

Expand Down Expand Up @@ -1021,7 +1021,7 @@ namespace MantidQt
/**
* Performs filter option for specified filer type.
*/
void ICatSearch2::doFilter(int index)
void ICatSearch2::doFilter(const int &index)
{
QTableWidget* table = m_icatUiForm.dataFileResultsTbl;

Expand Down

0 comments on commit 00af515

Please sign in to comment.